// Merge -> revision 8123
This commit is contained in:
@@ -38,6 +38,7 @@ echo '
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.$iso.'" lang="'.$iso.'">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="robots" content="NOFOLLOW, NOINDEX" />
|
||||
<link type="text/css" rel="stylesheet" href="'._PS_JS_DIR_.'jquery/datepicker/datepicker.css" />
|
||||
<link type="text/css" rel="stylesheet" href="'._PS_CSS_DIR_.'admin.css" />
|
||||
<link type="text/css" rel="stylesheet" href="'._PS_CSS_DIR_.'jquery.cluetip.css" />
|
||||
|
||||
@@ -1813,6 +1813,25 @@ class AdminTranslations extends AdminTab
|
||||
echo $str_output;
|
||||
}
|
||||
|
||||
/** parse $filepath to find expression which match $regex, and return an
|
||||
*
|
||||
* @param string $filepath file to parse
|
||||
* @param string $regex regexp to use
|
||||
* @param array $langArray contains expression in the chosen language
|
||||
* @param string $tab name to use with the md5 key
|
||||
* @param array $tabsArray
|
||||
* @return array containing all datas needed for building the translation form
|
||||
* @since 1.4.5.0
|
||||
*/
|
||||
private function _parsePdfClass($filepath, $regex, $langArray, $tab, $tabsArray)
|
||||
{
|
||||
$content = file_get_contents($filepath);
|
||||
preg_match_all($regex, $content, $matches);
|
||||
foreach ($matches[1] as $key)
|
||||
$tabsArray[$tab][$key] = stripslashes(key_exists($tab.md5(addslashes($key)), $langArray) ? html_entity_decode($langArray[$tab.md5(addslashes($key))], ENT_COMPAT, 'UTF-8') : '');
|
||||
return $tabsArray;
|
||||
}
|
||||
|
||||
public function displayFormPDF()
|
||||
{
|
||||
$lang = Tools::strtolower(Tools::getValue('lang'));
|
||||
@@ -1829,16 +1848,15 @@ class AdminTranslations extends AdminTab
|
||||
@include(_PS_TRANSLATIONS_DIR_.$lang.'/pdf.php');
|
||||
$files = array();
|
||||
$count = 0;
|
||||
$tabsArray = array($tab=>array());
|
||||
$tab = 'PDF_invoice';
|
||||
$pdf = _PS_CLASS_DIR_.'PDF.php';
|
||||
$newLang = array();
|
||||
$fd = fopen($pdf, 'r');
|
||||
$content = fread($fd, filesize($pdf));
|
||||
fclose($fd);
|
||||
$regex = '/self::l\(\''._PS_TRANS_PATTERN_.'\'[\)|\,]/U';
|
||||
preg_match_all($regex, $content, $matches);
|
||||
foreach($matches[1] AS $key)
|
||||
$tabsArray[$tab][$key] = stripslashes(key_exists($tab.md5(addslashes($key)), $_LANGPDF) ? html_entity_decode($_LANGPDF[$tab.md5(addslashes($key))], ENT_COMPAT, 'UTF-8') : '');
|
||||
// need to parse PDF.php in order to find $regex and add this to $tabsArray
|
||||
// this has to be done for the core class, and eventually for the override
|
||||
$tabsArray = $this->_parsePdfClass(_PS_CLASS_DIR_.'PDF.php', $regex, $_LANGPDF, $tab, $tabsArray);
|
||||
if(file_exists(_PS_ROOT_DIR_.'/override/classes/PDF.php'))
|
||||
$tabsArray = $this->_parsePdfClass(_PS_ROOT_DIR_.'/override/classes/PDF.php', $regex, $_LANGPDF, $tab, $tabsArray);
|
||||
|
||||
$count += isset($tabsArray[$tab]) ? sizeof($tabsArray[$tab]) : 0;
|
||||
$closed = sizeof($_LANGPDF) >= $count;
|
||||
|
||||
|
||||
+9
-13
@@ -572,28 +572,24 @@ abstract class ModuleCore
|
||||
$modulesNameToCursor = array();
|
||||
$errors = array();
|
||||
$modules_dir = self::getModulesDirOnDisk();
|
||||
|
||||
$memory_limit = Tools::getMemoryLimit();
|
||||
|
||||
foreach ($modules_dir AS $module)
|
||||
{
|
||||
// Memory usage checking
|
||||
if ($memory_limit = strtoupper(@ini_get('memory_limit')))
|
||||
if (function_exists('memory_get_usage') && $memory_limit !== -1)
|
||||
{
|
||||
if (strpos($memory_limit, 'M'))
|
||||
{
|
||||
$memory_limit = str_replace('M', '', $memory_limit);
|
||||
$memory_limit *= 1024 * 1024;
|
||||
}
|
||||
elseif (strpos($memory_limit, 'K'))
|
||||
{
|
||||
$memory_limit = str_replace('K', '', $memory_limit);
|
||||
$memory_limit *= 1024;
|
||||
}
|
||||
|
||||
if ($memory_limit - memory_get_usage() <= (512 * 1024))
|
||||
$current_memory = memory_get_usage(true);
|
||||
// memory_threshold in MB
|
||||
$memory_threshold = (Tools::isX86_64arch() ? 3 : 1.5);
|
||||
if (($memory_limit - $current_memory) <= ($memory_threshold * 1024 * 1024))
|
||||
{
|
||||
$errors[] = Tools::displayError('All modules cannot be loaded due to memory limit restriction reason, please increase your memory_limit value on your server configuration');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$configFile = _PS_MODULE_DIR_.$module.'/config.xml';
|
||||
$xml_exist = file_exists($configFile);
|
||||
if ($xml_exist)
|
||||
|
||||
@@ -2038,6 +2038,33 @@ FileETag INode MTime Size
|
||||
else
|
||||
$smarty->clear_all_cache();
|
||||
}
|
||||
|
||||
/**
|
||||
* getMemoryLimit allow to get the memory limit in octet
|
||||
*
|
||||
* @since 1.4.5.0
|
||||
* @return int the memory limit value in octet
|
||||
*/
|
||||
public static function getMemoryLimit()
|
||||
{
|
||||
$memory_limit = @ini_get('memory_limit');
|
||||
|
||||
if (preg_match('/[0-9]+k/i', $memory_limit))
|
||||
return 1024 * (int)$memory_limit;
|
||||
|
||||
if (preg_match('/[0-9]+m/i', $memory_limit))
|
||||
return 1024 * 1024 * (int)$memory_limit;
|
||||
|
||||
if (preg_match('/[0-9]+g/i', $memory_limit))
|
||||
return 1024 * 1024 * 1024 * (int)$memory_limit;
|
||||
|
||||
return $memory_limit;
|
||||
}
|
||||
|
||||
public static function isX86_64arch()
|
||||
{
|
||||
return (PHP_INT_MAX == '9223372036854775807');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-8
@@ -42,16 +42,10 @@ function cacheImage($image, $cacheImage, $size, $imageType = 'jpg', $disableCach
|
||||
{
|
||||
$infos = getimagesize($image);
|
||||
|
||||
$memory_limit = ini_get('memory_limit');
|
||||
$memory_limit = Tools::getMemoryLimit();
|
||||
// memory_limit == -1 => unlimited memory
|
||||
if (function_exists('memory_get_usage') AND (int)$memory_limit != -1)
|
||||
if (function_exists('memory_get_usage') && (int)$memory_limit != -1)
|
||||
{
|
||||
if (preg_match('/[0-9]+k/i', $memory_limit))
|
||||
$memory_limit = 1024 * (int)$memory_limit;
|
||||
elseif (preg_match('/[0-9]+m/i', $memory_limit))
|
||||
$memory_limit = 1024 * 1024 * (int)$memory_limit;
|
||||
elseif (preg_match('/[0-9]+g/i', $memory_limit))
|
||||
$memory_limit = 1024 * 1024 * 1024 * (int)$memory_limit;
|
||||
$current_memory = memory_get_usage();
|
||||
|
||||
// Evaluate the memory required to resize the image: if it's too much, you can't resize it.
|
||||
|
||||
@@ -11,6 +11,7 @@ $_ERRORS['dea850f4b2aebd535089e1042c789b7c'] = 'Un montant minimum d\'achat de';
|
||||
$_ERRORS['a2284157626fd717badf9887b326392b'] = 'Une réduction existe déjà pour cette catégorie.';
|
||||
$_ERRORS['6945cb79a997b9823a8bff9e72dd1cb8'] = 'Un bon avec ce nom existe déjà. Merci de choisir un autre nom.';
|
||||
$_ERRORS['08de2fdaabcd120b8ca1388d21179921'] = 'accès interdit';
|
||||
$_ERRORS['7eb3eacf05efbe5c577df2f83e663291'] = 'Tous les modules ne peuvent pas être chargé en raison d\'une restriction de mémoire, merci d\'augmenter la valeur du memory_limit dans votre configuration serveur';
|
||||
$_ERRORS['4ee13cb828cde6949c31c24478a6069b'] = 'un compte existe déjà avec cette adresse mail :';
|
||||
$_ERRORS['c40e77fb4435d6520a59d8778c771b74'] = 'Un compte existe déjà avec cette adresse mail, merci de renseigner le champ mot de passe ou d\'en demander un nouveau';
|
||||
$_ERRORS['86de674d7405670db52e79ec1665b0b1'] = 'une adresse localisée dans un pays contenant des états doit en sélectionner un';
|
||||
|
||||
Reference in New Issue
Block a user