// remove deprecated PS_ADMIN_DIR by _PS_ADMIN_DIR_

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8666 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
tDidierjean
2011-09-20 15:53:57 +00:00
parent b9e7daf0b7
commit b45dd02452
79 changed files with 339 additions and 339 deletions
+3 -4
View File
@@ -25,8 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
define('_PS_ADMIN_DIR_', getcwd());
define('PS_ADMIN_DIR', _PS_ADMIN_DIR_); // Retro-compatibility
define('_PS_ADMIN_DIR_', dirname(__FILE__));
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
include(_PS_ADMIN_DIR_.'/functions.php');
@@ -49,7 +48,7 @@ if (empty($tab) and !sizeof($_POST))
$adminObj->ajax = true;
if ($adminObj->checkToken())
{
// the differences with index.php is here
// the differences with index.php is here
$adminObj->ajaxPreProcess();
$action = Tools::getValue('action');
@@ -60,7 +59,7 @@ if (empty($tab) and !sizeof($_POST))
$adminObj->{'ajaxProcess'.Tools::toCamelCase($action)}();
else
$adminObj->ajaxProcess();
// @TODO We should use a displayAjaxError
$adminObj->displayErrors();
if (!empty($action) AND method_exists($adminObj, 'displayAjax'.Tools::toCamelCase($action)) )
+14 -14
View File
@@ -25,8 +25,8 @@
* International Registered Trademark & Property of PrestaShop SA
*/
define('PS_ADMIN_DIR', getcwd());
include(PS_ADMIN_DIR.'/../config/config.inc.php');
define('_PS_ADMIN_DIR_', getcwd());
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
/* Getting cookie or logout */
require_once(dirname(__FILE__).'/init.php');
@@ -363,7 +363,7 @@ if (array_key_exists('ajaxProductImagesPositions', $_POST))
else
die('{"hasError" : true, "errors" : "This image cannot be loaded"}');
}
if (isset($_GET['ajaxProductPackItems']))
{
@@ -396,7 +396,7 @@ if (isset($_GET['ajaxStates']) AND isset($_GET['id_country']))
$list = '';
if (Tools::getValue('no_empty') != true)
{
$empty_value = (Tools::isSubmit('empty_value')) ? Tools::getValue('empty_value') : '----------';
$empty_value = (Tools::isSubmit('empty_value')) ? Tools::getValue('empty_value') : '----------';
$list = '<option value="0">'.Tools::htmlentitiesUTF8($empty_value).'</option>'."\n";
}
@@ -655,7 +655,7 @@ if (Tools::isSubmit('getAdminHomeElement'))
{
$content = explode('|', $content);
if ($content[0] == 'OK' && Validate::isCleanHtml($content[2]) && Validate::isCleanHtml($content[1]))
{
{
$result['partner_preactivation'] = $content[2];
$content[1] = explode('#%#', $content[1]);
foreach ($content[1] as $partnerPopUp)
@@ -730,9 +730,9 @@ if (Tools::isSubmit('syncImapMail'))
OR !$user = Configuration::get('PS_SAV_IMAP_USER')
OR !$password = Configuration::get('PS_SAV_IMAP_PWD'))
die('{"hasError" : true, "errors" : "Configuration is not correct"}');
$mbox = @imap_open('{'.$url.':'.$port.'}', $user, $password);
$errors = imap_errors();
if (sizeof($errors))
{
@@ -745,10 +745,10 @@ if (Tools::isSubmit('syncImapMail'))
die('{"hasError" : true, "errors" : ["Can not connect to the mailbox"]}');
$check = imap_check($mbox);
if ($check->Nmsgs == 0)
die('{"hasError" : true, "errors" : ["NO message to sync"]}');
$result = imap_fetch_overview($mbox,"1:{$check->Nmsgs}",0);
foreach ($result as $overview)
{
@@ -757,16 +757,16 @@ if (Tools::isSubmit('syncImapMail'))
$subject = $overview->subject;
else
$subject = '';
$md5 = md5($overview->date.$overview->from.$subject);
$exist = Db::getInstance()->getValue(
'SELECT md5_header
FROM `'._DB_PREFIX_.'customer_message_sync_imap`
'SELECT md5_header
FROM `'._DB_PREFIX_.'customer_message_sync_imap`
WHERE md5_header = \''.pSQL($md5).'\'');
if ($exist)
{
if (Configuration::get('PS_SAV_IMAP_DELETE_MSG'))
imap_delete($mbox, $overview->msgno);
imap_delete($mbox, $overview->msgno);
}
else
{
@@ -778,7 +778,7 @@ if (Tools::isSubmit('syncImapMail'))
{
//check if order exist in database
$ct = new CustomerThread((int)$matches1[1]);
if (Validate::isLoadedObject($ct) && $ct->token == $matches2[1])
{
$cm = new CustomerMessage();
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
include_once('../config/config.inc.php');
include_once('tabs/AdminCatalog.php');
include_once('tabs/AdminProducts.php');
+2 -2
View File
@@ -25,8 +25,8 @@
* International Registered Trademark & Property of PrestaShop SA
*/
define('PS_ADMIN_DIR', getcwd());
include(PS_ADMIN_DIR.'/../config/config.inc.php');
define('_PS_ADMIN_DIR_', getcwd());
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
/* Getting cookie or logout */
require_once(dirname(__FILE__).'/init.php');
+2 -2
View File
@@ -25,8 +25,8 @@
* International Registered Trademark & Property of PrestaShop SA
*/
define('PS_ADMIN_DIR', getcwd());
include(PS_ADMIN_DIR.'/../config/config.inc.php');
define('_PS_ADMIN_DIR_', getcwd());
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
/* Getting cookie or logout */
require_once(dirname(__FILE__).'/init.php');
+1 -1
View File
@@ -24,7 +24,7 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
include_once(dirname(__FILE__).'/../config/config.inc.php');
/* Getting cookie or logout */
@@ -1,6 +1,6 @@
<?php
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
require_once('../../config/config.inc.php');
require_once('../init.php');
?>
@@ -6,16 +6,15 @@
* @since 22/May/2007
*
*/
define('PS_ADMIN_DIR', getcwd());
require_once('../../config/config.inc.php');
require_once('../init.php');
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
@ob_start();
displayArray($_POST);
writeInfo(@ob_get_clean());
writeInfo(@ob_get_clean());
echo "{";
$error = "";
$info = "";
$info = "";
/* $_POST['new_folder'] = substr(md5(time()), 1, 5);
$_POST['currentFolderPath'] = "../../uploaded/";*/
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_NEWFOLDER)
@@ -45,12 +44,12 @@
$manager = new manager(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder'], false);
$pathInfo = $manager->getFolderInfo(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder']);
foreach($pathInfo as $k=>$v)
{
{
switch ($k)
{
case "ctime";
case "ctime";
case "mtime":
case "atime":
$v = date(DATE_TIME_FORMAT, $v);
@@ -61,10 +60,10 @@
case 'cssClass':
$v = 'folderEmpty';
break;
}
}
$info .= sprintf(", %s:'%s'", $k, $v);
}
}else
}else
{
$error = ERR_FOLDER_CREATION_FAILED;
}
@@ -6,7 +6,7 @@
* @since 22/April/2007
*
*/
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
require_once('../../config/config.inc.php');
require_once('../init.php');
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
+1 -1
View File
@@ -6,7 +6,7 @@
* @since 22/April/2007
*
*/
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
require_once('../../config/config.inc.php');
require_once('../init.php');
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
@@ -6,7 +6,7 @@
* @since 22/May/2007
*
*/
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
require_once('../../config/config.inc.php');
require_once('../init.php');
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
+1 -1
View File
@@ -6,7 +6,7 @@
* @since 22/May/2007
*
*/
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
require_once('../../config/config.inc.php');
require_once('../init.php');
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
+1 -1
View File
@@ -6,7 +6,7 @@
* @since 22/May/2007
*
*/
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
require_once('../../config/config.inc.php');
require_once('../init.php');
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
@@ -1,6 +1,6 @@
<?
include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
require_once('../../config/config.inc.php');
require_once('../init.php');
$error = '';
@@ -6,7 +6,7 @@
* @since 22/May/2007
*
*/
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
require_once('../../config/config.inc.php');
require_once('../init.php');
@@ -1,5 +1,5 @@
<?php
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
require_once('../../config/config.inc.php');
require_once('../init.php');
/**
@@ -1,5 +1,5 @@
<?php
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
require_once('../../config/config.inc.php');
require_once('../init.php');
/**
@@ -1,5 +1,5 @@
<?php
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
require_once('../../config/config.inc.php');
require_once('../init.php');
/**
@@ -1,5 +1,5 @@
<?php
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
require_once('../../config/config.inc.php');
require_once('../init.php');
/**
+1 -1
View File
@@ -1,5 +1,5 @@
<?php
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
require_once('../../config/config.inc.php');
require_once('../init.php');
/**
+1 -1
View File
@@ -1,5 +1,5 @@
<?php
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
require_once('../../config/config.inc.php');
require_once('../init.php');
/**
@@ -1,5 +1,5 @@
<?php
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
require_once('../../config/config.inc.php');
require_once('../init.php');
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
+1 -1
View File
@@ -1,5 +1,5 @@
<?php
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
require_once('../../config/config.inc.php');
require_once('../init.php');
/**
+1 -1
View File
@@ -1,5 +1,5 @@
<?php
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
require_once('../../config/config.inc.php');
require_once('../init.php');
/**
@@ -1,5 +1,5 @@
<?php
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
require_once('../../config/config.inc.php');
require_once('../init.php');
/**
@@ -1,5 +1,5 @@
<?php
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
require_once('../../config/config.inc.php');
require_once('../init.php');
/**
+3 -3
View File
@@ -25,9 +25,9 @@
* International Registered Trademark & Property of PrestaShop SA
*/
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
include(PS_ADMIN_DIR.'/../config/config.inc.php');
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
if (!Context::getContext()->employee->isLoggedBack())
Tools::redirectAdmin('login.php');
@@ -37,7 +37,7 @@ $tabAccess = Profile::getProfileAccess(Context::getContext()->employee->id_profi
if ($tabAccess['view'] !== '1')
die (Tools::displayError('You do not have permission to view here'));
$backupdir = realpath( PS_ADMIN_DIR . '/backups/');
$backupdir = realpath(_PS_ADMIN_DIR_ . '/backups/');
if ($backupdir === false)
die (Tools::displayError('Backups directory does not exist.'));
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
include_once(dirname(__FILE__).'/../config/config.inc.php');
$module = Tools::getValue('module');
+6 -4
View File
@@ -98,7 +98,7 @@ function rewriteSettingsFile($baseUrls = NULL, $theme = NULL, $arrayDB = NULL)
foreach ($defines as $k => $value)
$content .= 'define(\''.$k.'\', \''.addslashes($value).'\');'."\n";
$content .= "\n?>";
if ($fd = @fopen(PS_ADMIN_DIR.'/../config/settings.inc.php', 'w'))
if ($fd = @fopen(_PS_ADMIN_DIR_.'/../config/settings.inc.php', 'w'))
{
fwrite($fd, $content);
fclose($fd);
@@ -255,9 +255,8 @@ function checkingTab($tab)
}
if ($row['module'] AND file_exists(_PS_MODULE_DIR_.'/'.$row['module'].'/'.$tab.'.php'))
include_once(_PS_MODULE_DIR_.'/'.$row['module'].'/'.$tab.'.php');
elseif (file_exists(PS_ADMIN_DIR.'/tabs/'.$tab.'.php'))
include_once(PS_ADMIN_DIR.'/tabs/'.$tab.'.php');
elseif (file_exists(_PS_ADMIN_DIR_.'/tabs/'.$tab.'.php'))
include_once(_PS_ADMIN_DIR_.'/tabs/'.$tab.'.php');
if (!class_exists($tab, false) OR !$row['id_tab'])
{
echo Tools::displayError('Tab file cannot be found.');
@@ -273,6 +272,9 @@ function checkingTab($tab)
return $adminObj;
}
/**
* @TODO deprecate for Tab::checkTabRights()
*/
function checkTabRights($id_tab)
{
static $tabAccesses = NULL;
+1 -1
View File
@@ -25,6 +25,6 @@
* International Registered Trademark & Property of PrestaShop SA
*/
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
require(dirname(dirname(__FILE__)).'/config/config.inc.php');
Controller::getController('getFileController')->run();
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
include_once(dirname(__FILE__).'/../config/config.inc.php');
$module = Tools::getValue('module');
+4 -4
View File
@@ -26,10 +26,10 @@
*/
ob_start();
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
include(PS_ADMIN_DIR.'/../config/config.inc.php');
include(PS_ADMIN_DIR.'/functions.php');
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
include(_PS_ADMIN_DIR_.'/functions.php');
$clientIsMaintenanceOrLocal = in_array(Tools::getRemoteAddr(), array_merge(array('127.0.0.1'),explode(',', Configuration::get('PS_MAINTENANCE_IP'))));
@@ -142,7 +142,7 @@ echo '
<form action="'.Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']).'" method="post">';
$randomNb = rand(100, 999);
if(file_exists(PS_ADMIN_DIR.'/../install') OR file_exists(PS_ADMIN_DIR.'/../admin'))
if(file_exists(_PS_ADMIN_DIR_.'/../install') OR file_exists(_PS_ADMIN_DIR_.'/../admin'))
{
echo ' <span>'.translate('For security reasons, you cannot connect to the Back Office until after you have:').'<br /><br />
- '.translate('delete the /install folder').'<br />
+3 -3
View File
@@ -25,10 +25,10 @@
* International Registered Trademark & Property of PrestaShop SA
*/
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
include(PS_ADMIN_DIR.'/../config/config.inc.php');
include(PS_ADMIN_DIR.'/functions.php');
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
include(_PS_ADMIN_DIR_.'/functions.php');
$errors = array();
+2 -2
View File
@@ -25,9 +25,9 @@
* International Registered Trademark & Property of PrestaShop SA
*/
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
include(PS_ADMIN_DIR.'/../config/config.inc.php');
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
if (!Context::getContext()->employee->id)
Tools::redirectAdmin('login.php');
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php');
class AdminAccess extends AdminTab
{
+1 -1
View File
@@ -24,7 +24,7 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php');
if(Configuration::get('VATNUMBER_MANAGEMENT') AND file_exists(_PS_MODULE_DIR_.'vatnumber/vatnumber.php'))
include_once(_PS_MODULE_DIR_.'vatnumber/vatnumber.php');
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php');
class AdminAttachments extends AdminTab
{
+1 -1
View File
@@ -26,7 +26,7 @@
*/
@ini_set('max_execution_time', 3600);
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php');
class AdminAttributeGenerator extends AdminTab
{
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php');
class AdminAttributes extends AdminTab
{
+2 -2
View File
@@ -25,8 +25,8 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
include_once(PS_ADMIN_DIR.'/tabs/AdminAttributes.php');
include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php');
include_once(_PS_ADMIN_DIR_.'/tabs/AdminAttributes.php');
class AdminAttributesGroups extends AdminTab
{
+6 -6
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php');
class AdminBackup extends AdminTab
{
@@ -87,7 +87,7 @@ class AdminBackup extends AdminTab
*/
public function displayForm($isMainTab = true)
{
if(is_writable(PS_ADMIN_DIR.'/backups/'))
if(is_writable(_PS_ADMIN_DIR_.'/backups/'))
{
if (!($object = $this->loadObject()))
return;
@@ -179,7 +179,7 @@ class AdminBackup extends AdminTab
public function displayList()
{
// Test if the backup dir is writable
if(!is_writable(PS_ADMIN_DIR.'/backups/'))
if(!is_writable(_PS_ADMIN_DIR_.'/backups/'))
$this->displayWarning($this->l('"Backups" Directory in admin directory must be writeable (CHMOD 755 / 777)'));
$this->displayErrors();
@@ -235,10 +235,10 @@ class AdminBackup extends AdminTab
$this->_list = array();
// Find all the backups
$dh = @opendir(PS_ADMIN_DIR.'/backups/');
$dh = @opendir(_PS_ADMIN_DIR_.'/backups/');
if ($dh === false)
{
$this->_errors[] = Tools::displayError('Unable to open backup directory .').addslashes(PS_ADMIN_DIR.'/backups/').'"';
$this->_errors[] = Tools::displayError('Unable to open backup directory .').addslashes(_PS_ADMIN_DIR_.'/backups/').'"';
return;
}
while (($file = readdir($dh)) !== false)
@@ -260,7 +260,7 @@ class AdminBackup extends AdminTab
$age = floor($age / 86400);
$age = $age.' '.(($age == 1) ? $this->l('day') : $this->l('days'));
}
$size = filesize(PS_ADMIN_DIR.'/backups/'.$file);
$size = filesize(_PS_ADMIN_DIR_.'/backups/'.$file);
$this->_list[] = array(
'filename' => $file,
'age' => $age,
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php');
class AdminCMS extends AdminTab
{
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php');
class AdminCMSCategories extends AdminTab
{
+3 -3
View File
@@ -25,9 +25,9 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
include(PS_ADMIN_DIR.'/tabs/AdminCMSCategories.php');
include(PS_ADMIN_DIR.'/tabs/AdminCMS.php');
include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php');
include(_PS_ADMIN_DIR_.'/tabs/AdminCMSCategories.php');
include(_PS_ADMIN_DIR_.'/tabs/AdminCMS.php');
class AdminCMSContent extends AdminTab
{
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php');
class AdminCarriers extends AdminTab
{
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php');
class AdminCarts extends AdminTab
{
+5 -5
View File
@@ -25,9 +25,9 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
include(PS_ADMIN_DIR.'/tabs/AdminCategories.php');
include(PS_ADMIN_DIR.'/tabs/AdminProducts.php');
include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php');
include(_PS_ADMIN_DIR_.'/tabs/AdminCategories.php');
include(_PS_ADMIN_DIR_.'/tabs/AdminProducts.php');
class AdminCatalog extends AdminTab
{
@@ -105,7 +105,7 @@ class AdminCatalog extends AdminTab
{
if (!isset($this->attributeGenerator))
{
include_once(PS_ADMIN_DIR.'/tabs/AdminAttributeGenerator.php');
include_once(_PS_ADMIN_DIR_.'/tabs/AdminAttributeGenerator.php');
$this->attributeGenerator = new AdminAttributeGenerator();
}
$this->attributeGenerator->postProcess();
@@ -153,7 +153,7 @@ class AdminCatalog extends AdminTab
{
if (!isset($this->attributeGenerator))
{
include_once(PS_ADMIN_DIR.'/tabs/AdminAttributeGenerator.php');
include_once(_PS_ADMIN_DIR_.'/tabs/AdminAttributeGenerator.php');
$this->attributeGenerator = new AdminAttributeGenerator();
}
$this->attributeGenerator->displayForm();
+2 -2
View File
@@ -25,8 +25,8 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
include_once(PS_ADMIN_DIR.'/tabs/AdminPreferences.php');
include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php');
include_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php');
class AdminContact extends AdminPreferences
{
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php');
class AdminContacts extends AdminTab
{
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php');
class AdminCountries extends AdminTab
{
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php');
class AdminCurrencies extends AdminTab
{
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/tabs/AdminPreferences.php');
include_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php');
class AdminDb extends AdminPreferences
{
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/tabs/AdminPreferences.php');
include_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php');
class AdminEmails extends AdminPreferences
{
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/tabs/AdminFeaturesValues.php');
include_once(_PS_ADMIN_DIR_.'/tabs/AdminFeaturesValues.php');
class AdminFeatures extends AdminTab
{
+2 -2
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/../images.inc.php');
include_once(_PS_ADMIN_DIR_.'/../images.inc.php');
@ini_set('max_execution_time', 0);
// No max line limit since the lines can be more than 4096. Performance impact is not significant.
define('MAX_LINE_SIZE', 0);
@@ -1325,7 +1325,7 @@ class AdminImport extends AdminTab
if ((Tools::getValue('import')) AND (isset($this->_warnings) AND !sizeof($this->_warnings)))
echo '<div class="module_confirmation conf confirm"><img src="../img/admin/ok.gif" alt="" title="" style="margin-right:5px; float:left;" />'.$this->l('The .CSV file has been imported into your shop.').'</div>';
if(!is_writable(PS_ADMIN_DIR.'/import/'))
if(!is_writable(_PS_ADMIN_DIR_.'/import/'))
$this->displayWarning($this->l('directory import on admin directory must be writable (CHMOD 755 / 777)'));
if(isset($this->_warnings) AND sizeof($this->_warnings))
+11 -11
View File
@@ -40,17 +40,17 @@ class AdminInformation extends AdminTab
'system' => $funcs,
'gd' => false,
'mysql_support' => false,
'config_dir' => PS_ADMIN_DIR.'/../config/',
'tools_dir' => PS_ADMIN_DIR.'/../tools/smarty/compile',
'cache_dir' => PS_ADMIN_DIR.'/../tools/smarty/cache/',
'sitemap' => PS_ADMIN_DIR.'/../sitemap.xml',
'img_dir' => PS_ADMIN_DIR.'/../img/',
'mails_dir' => PS_ADMIN_DIR.'/../mails/',
'module_dir' => PS_ADMIN_DIR.'/../modules/',
'theme_lang_dir' => PS_ADMIN_DIR.'/../themes/'._THEME_NAME_.'/lang/',
'translations_dir' => PS_ADMIN_DIR.'/../translations/',
'customizable_products_dir' => PS_ADMIN_DIR.'/../upload/',
'virtual_products_dir' => PS_ADMIN_DIR.'/../download/'
'config_dir' => _PS_ADMIN_DIR_.'/../config/',
'tools_dir' => _PS_ADMIN_DIR_.'/../tools/smarty/compile',
'cache_dir' => _PS_ADMIN_DIR_.'/../tools/smarty/cache/',
'sitemap' => _PS_ADMIN_DIR_.'/../sitemap.xml',
'img_dir' => _PS_ADMIN_DIR_.'/../img/',
'mails_dir' => _PS_ADMIN_DIR_.'/../mails/',
'module_dir' => _PS_ADMIN_DIR_.'/../modules/',
'theme_lang_dir' => _PS_ADMIN_DIR_.'/../themes/'._THEME_NAME_.'/lang/',
'translations_dir' => _PS_ADMIN_DIR_.'/../translations/',
'customizable_products_dir' => _PS_ADMIN_DIR_.'/../upload/',
'virtual_products_dir' => _PS_ADMIN_DIR_.'/../download/'
);
$tests_op = array(
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/tabs/AdminPreferences.php');
include_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php');
class AdminLocalization extends AdminPreferences
{
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php');
class AdminLogs extends AdminTab
{
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/../tools/tar/Archive_Tar.php');
include_once(_PS_ADMIN_DIR_.'/../tools/tar/Archive_Tar.php');
class AdminModules extends AdminTab
{
+2 -2
View File
@@ -96,9 +96,9 @@ class AdminOrdersStates extends AdminTab
private function getTemplates($iso_code)
{
$array = array();
if (!file_exists(PS_ADMIN_DIR.'/../mails/'.$iso_code))
if (!file_exists(_PS_ADMIN_DIR_.'/../mails/'.$iso_code))
return false;
$templates = scandir(PS_ADMIN_DIR.'/../mails/'.$iso_code);
$templates = scandir(_PS_ADMIN_DIR_.'/../mails/'.$iso_code);
foreach ($templates AS $template)
if (!strncmp(strrev($template), 'lmth.', 5))
$array[] = substr($template, 0, -5);
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/tabs/AdminPreferences.php');
include_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php');
class AdminPDF extends AdminPreferences
{
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/tabs/AdminPreferences.php');
include_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php');
class AdminPPreferences extends AdminPreferences
{
+1 -1
View File
@@ -24,7 +24,7 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/tabs/AdminProfiles.php');
include_once(_PS_ADMIN_DIR_.'/tabs/AdminProfiles.php');
class AdminProducts extends AdminTab
{
+3 -3
View File
@@ -25,9 +25,9 @@
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('PS_ADMIN_DIR')) define('PS_ADMIN_DIR', getcwd().'/..');
include_once(PS_ADMIN_DIR.'/../config/config.inc.php');
include_once(PS_ADMIN_DIR.'/init.php');
if (!defined('_PS_ADMIN_DIR_')) define('_PS_ADMIN_DIR_', getcwd().'/..');
include_once(_PS_ADMIN_DIR_.'/../config/config.inc.php');
include_once(_PS_ADMIN_DIR_.'/init.php');
if (Tools::getValue('token') == Tools::getAdminToken('AdminReferrers'.(int)(Tab::getIdFromClassName('AdminReferrers')).(int)(Tools::getValue('id_employee'))))
{
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/tabs/AdminPreferences.php');
include_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php');
class AdminSearchConf extends AdminPreferences
{
+1 -1
View File
@@ -26,7 +26,7 @@
*/
include_once(dirname(__FILE__).'/AdminStatsTab.php');
include_once(PS_ADMIN_DIR.'/tabs/AdminPreferences.php');
include_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php');
class AdminStatsConf extends AdminPreferences
{
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/tabs/AdminPreferences.php');
include_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php');
abstract class AdminStatsTab extends AdminPreferences
{
+2 -2
View File
@@ -25,8 +25,8 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include(PS_ADMIN_DIR.'/tabs/AdminOrdersStates.php');
include(PS_ADMIN_DIR.'/tabs/AdminReturnStates.php');
include(_PS_ADMIN_DIR_.'/tabs/AdminOrdersStates.php');
include(_PS_ADMIN_DIR_.'/tabs/AdminReturnStates.php');
class AdminStatuses extends AdminTab
{
+1 -1
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/tabs/AdminPreferences.php');
include_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php');
class AdminThemes extends AdminPreferences
{
+121 -121
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -25,9 +25,9 @@
* International Registered Trademark & Property of PrestaShop SA
*/
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
include_once(PS_ADMIN_DIR.'/../tools/tar/Archive_Tar.php');
include_once(PS_ADMIN_DIR.'/../tools/pear/PEAR.php');
include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php');
include_once(_PS_ADMIN_DIR_.'/../tools/tar/Archive_Tar.php');
include_once(_PS_ADMIN_DIR_.'/../tools/pear/PEAR.php');
define ('TEXTAREA_SIZED', 70);
class AdminTranslations extends AdminTab
@@ -40,12 +40,12 @@ class AdminTranslations extends AdminTab
protected static $php_regexp = '';
/**
* Is true if number of var exceed the suhosin request or post limit
*
* Is true if number of var exceed the suhosin request or post limit
*
* @var boolean
*/
protected $suhosin_limit_exceed = false;
public function __construct()
{
parent::__construct();
@@ -53,11 +53,11 @@ class AdminTranslations extends AdminTab
// added ? after spaces because some peoples forget them. see PSCFI-2501
self::$php_regexp = '/->l\(\''._PS_TRANS_PATTERN_.'\'(, ?\'(.+)\')?(, ?(.+))?\)/U';
}
/**
* This method merge each arrays of modules translation in
* This method merge each arrays of modules translation in
* the array of modules translations
*
*
* @param boolean $is_default if true a prefix is set before each keys in global $_MODULES array
*/
protected function getModuleTranslations($is_default = false)
@@ -80,15 +80,15 @@ class AdminTranslations extends AdminTab
$_MODULES = (is_array($_MODULES) AND is_array($_MODULE)) ? array_merge($_MODULES, $_MODULE) : $_MODULE;
}
}
/**
* This method is only used by AdminTranslations::submitCopyLang().
*
*
* It try to create folder in new theme.
*
*
* When a translation file is copied for a module, its translation key is wrong.
* We have to change the translation key and rewrite the file.
*
*
* @param string $dest file name
* @return bool
*/
@@ -151,7 +151,7 @@ class AdminTranslations extends AdminTab
{
$bool &= $this->checkDirAndCreate($dest);
$bool &= @copy($source, $dest);
if (strpos($dest, 'modules') AND basename($source) === $fromLang.'.php' AND $bool !== false)
{
$bool &= $this->changeModulesKeyTranslation($dest, $fromTheme, $toTheme);
@@ -161,10 +161,10 @@ class AdminTranslations extends AdminTab
Tools::redirectAdmin(self::$currentIndex.'&conf=14&token='.$this->token);
$this->_errors[] = $this->l('a part of the data has been copied but some language files could not be found or copied');
}
/**
* Change the key translation to according it to theme name.
*
*
* @param string $path
* @param string $theme_from
* @param string $theme_to
@@ -200,7 +200,7 @@ class AdminTranslations extends AdminTab
}
$this->_errors[] = Tools::displayError('Please choose a language and theme.');
}
public function checkAndAddMailsFiles ($iso_code, $files_list)
{
$mails = scandir(_PS_MAIL_DIR_.'en/');
@@ -244,7 +244,7 @@ class AdminTranslations extends AdminTab
$this->_errors[] = Tools::displayError('Archive cannot be extracted.');
}
}
public function submitAddLang()
{
$arr_import_lang = explode('|', Tools::getValue('params_import_language')); /* 0 = Language ISO code, 1 = PS version */
@@ -279,11 +279,11 @@ class AdminTranslations extends AdminTab
else
$this->_errors[] = Tools::displayError('Invalid parameter');
}
/**
* This method check each file (tpl or php file), get its sentences to translate,
* compare with posted values and write in iso code translation file.
*
*
* @param string $file_name
* @param array $files
* @param string $theme_name
@@ -297,10 +297,10 @@ class AdminTranslations extends AdminTab
static $_cache_file = array();
static $str_write = '';
static $array_check_duplicate = array();
// Default translations and Prestashop overriding themes are distinguish
$is_default = $theme_name === self::DEFAULT_THEME_NAME ? true : false;
// Set file_name in static var, this allow to open and wright the file just one time
if (!isset($_cache_file[($is_default ? self::DEFAULT_THEME_NAME : $theme_name).'-'.$file_name]) )
{
@@ -310,15 +310,15 @@ class AdminTranslations extends AdminTab
file_put_contents($file_name, '');
if (!is_writable($file_name))
die ($this->l('Cannot write the theme\'s language file ').'('.$file_name.')'.$this->l('. Please check write permissions.'));
// this string is initialized one time for a file
$str_write .= "<?php\n\nglobal \$_MODULE;\n\$_MODULE = array();\n";
$array_check_duplicate = array();
}
if (!$dir)
$dir = ($theme_name == self::DEFAULT_THEME_NAME ? _PS_MODULE_DIR_.$module_name.'/' : _PS_ALL_THEMES_DIR_.$theme_name.'/modules/'.$module_name.'/');
foreach ($files AS $template_file)
{
if ((preg_match('/^(.*).tpl$/', $template_file) OR ($is_default AND preg_match('/^(.*).php$/', $template_file))) AND file_exists($tpl = $dir.$template_file))
@@ -326,10 +326,10 @@ class AdminTranslations extends AdminTab
// Get translations key
$content = file_get_contents($tpl);
preg_match_all(substr($template_file, -4) == '.tpl' ? self::$tpl_regexp : self::$php_regexp, $content, $matches);
// Write each translation on its module file
$template_name = substr(basename($template_file), 0, -4);
foreach ($matches[1] AS $key)
{
$post_key = md5(strtolower($module_name).'_'.($is_default ? self::DEFAULT_THEME_NAME : strtolower($theme_name)).'_'.strtolower($template_name).'_'.md5($key));
@@ -358,15 +358,15 @@ class AdminTranslations extends AdminTab
unset($files[$key]);
else if ($type_clear === 'directory' AND (!is_dir($path.$file) OR in_array($file, $arr_exclude)))
unset($files[$key]);
}
return $files;
}
/**
* This method get translation for each files of a module,
* compare with global $_MODULES array and fill AdminTranslations::modules_translations array
* With key as English sentences and values as their iso code translations.
*
* With key as English sentences and values as their iso code translations.
*
* @param array $files
* @param string $theme_name
* @param string $module_name
@@ -379,14 +379,14 @@ class AdminTranslations extends AdminTab
global $_MODULES;
// added for compatibility
$_MODULES = array_change_key_case($_MODULES);
// Default translations and Prestashop overriding themes are distinguish
$is_default = $theme_name === self::DEFAULT_THEME_NAME ? true : false;
if (!$dir)
$dir = ($theme_name === self::DEFAULT_THEME_NAME ? _PS_MODULE_DIR_.$module_name.'/' : _PS_ALL_THEMES_DIR_.$theme_name.'/modules/'.$module_name.'/');
// Thank to this var similar keys are not duplicate
// Thank to this var similar keys are not duplicate
// in AndminTranslation::modules_translations array
// see below
$array_check_duplicate = array();
@@ -397,10 +397,10 @@ class AdminTranslations extends AdminTab
// Get translations key
$content = file_get_contents($tpl);
preg_match_all(substr($template_file, -4) == '.tpl' ? self::$tpl_regexp : self::$php_regexp, $content, $matches);
// Write each translation on its module file
$template_name = substr(basename($template_file), 0, -4);
foreach ($matches[1] AS $key)
{
$module_key = ($is_default ? self::DEFAULT_THEME_NAME : '').'<{'.Tools::strtolower($module_name).'}'.strtolower($is_default ? 'prestashop' : $theme_name).'>'.Tools::strtolower($template_name).'_'.md5($key);
@@ -519,7 +519,7 @@ class AdminTranslations extends AdminTab
$array_lang_src = Language::getLanguages(false);
foreach ($array_lang_src as $language)
$this->all_iso_lang[] = $language['iso_code'];
$lang = Tools::strtolower($_POST['lang']);
if (!Validate::isLanguageIsoCode($lang))
die(Tools::displayError());
@@ -530,14 +530,14 @@ class AdminTranslations extends AdminTab
$arr_find_and_write = array();
$arr_files = $this->getAllModuleFiles($modules, _PS_MODULE_DIR_, $lang, true);
$arr_find_and_write = array_merge($arr_find_and_write, $arr_files);
if(file_exists(_PS_THEME_DIR_.'/modules/'))
{
$modules = scandir(_PS_THEME_DIR_.'/modules/');
$arr_files = $this->getAllModuleFiles($modules, _PS_THEME_DIR_.'modules/', $lang);
$arr_find_and_write = array_merge($arr_find_and_write, $arr_files);
}
foreach ($arr_find_and_write as $key=>$value)
$this->findAndWriteTranslationsIntoFile($value['file_name'], $value['files'], $value['theme'], $value['module'], $value['dir']);
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
@@ -563,17 +563,17 @@ class AdminTranslations extends AdminTab
}
/**
* This method is used to wright translation for mails.
* This wrights subject translation files
* This wrights subject translation files
* (in root/mails/lang_choosen/lang.php or root/_PS_THEMES_DIR_/mails/lang_choosen/lang.php)
* and mails files.
*
* and mails files.
*
* @param int $id_lang
*/
protected function submitTranslationsMails ($id_lang)
{
$obj_lang = new Language($id_lang);
$params_redirect = (Tools::isSubmit('submitTranslationsMailsAndStay') ? '&lang='.Tools::getValue('lang').'&type='.Tools::getValue('type') : '');
$arr_mail_content = array();
$arr_mail_path = array();
if (Tools::getValue('core_mail')) {
@@ -592,7 +592,7 @@ class AdminTranslations extends AdminTab
$arr_mail_content['theme_module_mail'] = Tools::getValue('theme_module_mail');
$arr_mail_path['theme_module_mail'] = _PS_THEME_DIR_.'modules/{module}'.'/mails/'.$obj_lang->iso_code.'/';
}
// Save each mail content
foreach ($arr_mail_content as $group_name=>$all_content)
{
@@ -600,7 +600,7 @@ class AdminTranslations extends AdminTab
{
foreach ($mails as $mail_name=>$content)
{
$module_name = false;
$module_name_pipe_pos = stripos($mail_name, '|');
if ($module_name_pipe_pos)
@@ -608,14 +608,14 @@ class AdminTranslations extends AdminTab
$module_name = substr($mail_name, 0, $module_name_pipe_pos);
$mail_name = substr($mail_name, $module_name_pipe_pos+1);
}
if ($type_content == 'html')
{
$content = Tools::htmlentitiesUTF8($content);
$content = htmlspecialchars_decode($content);
// replace correct end of line
$content = str_replace("\r\n", PHP_EOL, $content);
$title = '';
if (Tools::getValue('title_'.$group_name.'_'.$mail_name))
{
@@ -643,7 +643,7 @@ class AdminTranslations extends AdminTab
}
}
}
// Update subjects
$array_subjects = array();
if ($subjects = Tools::getValue('subject') AND is_array($subjects))
@@ -651,7 +651,7 @@ class AdminTranslations extends AdminTab
$array_subjects['core_and_modules'] = array('translations'=>array(), 'path'=>$arr_mail_path['core_mail'].'lang.php');
if (isset($arr_mail_path['theme_mail']))
$array_subjects['themes_and_modules'] = array('translations'=>array(), 'path'=>$arr_mail_path['theme_mail'].'lang.php');
foreach ($subjects AS $group => $subject_translation)
{
if ($group == 'core_mail' || $group == 'module_mail') {
@@ -711,25 +711,25 @@ class AdminTranslations extends AdminTab
<div id="submitAddLangContent" style="float:left;"><p>'.$this->l('You can add or update a language directly from prestashop.com here').'</p>';
$this->displayWarning($this->l('If you choose to update an existing language pack, all your previous customization in the theme named prestashop will be lost. This includes front office expressions and default e-mail templates.'));
echo '<div style="font-weight:bold; float:left;">'.$this->l('Language you want to add or update:').' ';
if ($lang_packs = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_each_language_pack.php?version='._PS_VERSION_, false, stream_context_create(array('http' => array('method' => 'GET', 'timeout' => 5)))))
{
// Notice : for php < 5.2 compatibility, Tools::jsonDecode. The second parameter to true will set us
// Notice : for php < 5.2 compatibility, Tools::jsonDecode. The second parameter to true will set us
if ($lang_packs != '' AND $lang_packs = Tools::jsonDecode($lang_packs,true))
{
echo '
<select id="params_import_language" name="params_import_language">
<optgroup label="'.$this->l('Add a language').'">';
$alreadyInstalled = '<optgroup label="'.$this->l('Update a language').'">';
foreach($lang_packs AS $lang_pack)
{
if (!Language::isInstalled($lang_pack['iso_code']))
echo '<option value="'.$lang_pack['iso_code'].'|'.$lang_pack['version'].'">'.$lang_pack['name'].'</option>';
else
else
$alreadyInstalled.='<option value="'.$lang_pack['iso_code'].'|'.$lang_pack['version'].'">'.$lang_pack['name'].'</option>';
}
echo '
</optgroup>'.$alreadyInstalled.'</optgroup>
</select> &nbsp;<input type="submit" value="'.$this->l('Add or update the language').'" name="submitAddLanguage" class="button" />';
@@ -853,14 +853,14 @@ class AdminTranslations extends AdminTab
<script type="text/javascript">toggleElemValue(\'buttonall\', '.($closed ? 'openAll' : 'closeAll').', '.($closed ? 'closeAll' : 'openAll').');</script>';
return $str_output;
}
protected function displaySubmitButtons($name)
{
return '
<input type="submit" name="submitTranslations'.ucfirst($name).'" value="'.$this->l('Update translations').'" class="button" />
<input type="submit" name="submitTranslations'.ucfirst($name).'AndStay" value="'.$this->l('Update and stay').'" class="button" />';
}
public function displayAutoTranslate()
{
$languageCode = Tools::htmlentitiesUTF8(Language::getLanguageCodeByIso(Tools::getValue('lang')));
@@ -915,7 +915,7 @@ class AdminTranslations extends AdminTab
}
</script>';
}
public function displayLimitPostWarning($count)
{
$str_output = '';
@@ -929,7 +929,7 @@ class AdminTranslations extends AdminTab
.'<b>'.ini_get('suhosin.post.max_vars').'</b> '.$this->l('for suhosin.post.max_vars.').'<br/>'
.'<b>'.ini_get('suhosin.request.max_vars').'</b> '.$this->l('for suhosin.request.max_vars.').'<br/>'
.$this->l('Please ask your hosting provider to increase the suhosin post and request limit to')
.' <u><b>'.((int)$count + 100).'</b></u> '.$this->l('at least.').' '.$this->l('or edit the translation file manually.').'</div>';
.' <u><b>'.((int)$count + 100).'</b></u> '.$this->l('at least.').' '.$this->l('or edit the translation file manually.').'</div>';
}
}
return $str_output;
@@ -939,7 +939,7 @@ class AdminTranslations extends AdminTab
{
$_LANG = $this->fileExists(_PS_THEME_DIR_.'lang', Tools::strtolower($lang).'.php', '_LANG');
$str_output = '';
/* List templates to parse */
$templates = array_merge(scandir(_PS_THEME_DIR_), scandir(_PS_ALL_THEMES_DIR_));
$count = 0;
@@ -1023,11 +1023,11 @@ class AdminTranslations extends AdminTab
$str_output = '';
/* List templates to parse */
$count = 0;
$tabs = scandir(PS_ADMIN_DIR.'/tabs');
$tabs = scandir(_PS_ADMIN_DIR_.'/tabs');
$tabs[] = '../../classes/AdminTab.php';
$files = array();
foreach ($tabs AS $tab)
if (preg_match('/^(.*)\.php$/', $tab) AND file_exists($tpl = PS_ADMIN_DIR.'/tabs/'.$tab))
if (preg_match('/^(.*)\.php$/', $tab) AND file_exists($tpl = _PS_ADMIN_DIR_.'/tabs/'.$tab))
{
$tab = basename(substr($tab, 0, -4));
$fd = fopen($tpl, 'r');
@@ -1041,7 +1041,7 @@ class AdminTranslations extends AdminTab
}
foreach (array('header.inc', 'footer.inc', 'index', 'login', 'password', 'functions') AS $tab)
{
$tab = PS_ADMIN_DIR.'/'.$tab.'.php';
$tab = _PS_ADMIN_DIR_.'/'.$tab.'.php';
$fd = fopen($tab, 'r');
$content = fread($fd, filesize($tab));
fclose($fd);
@@ -1093,18 +1093,18 @@ class AdminTranslations extends AdminTab
public function displayFormErrors($lang)
{
$_ERRORS = $this->fileExists(_PS_TRANSLATIONS_DIR_.$lang, 'errors.php', '_ERRORS');
$str_output = '';
/* List files to parse */
$stringToTranslate = array();
$dirToParse = array(PS_ADMIN_DIR.'/../',
PS_ADMIN_DIR.'/../classes/',
PS_ADMIN_DIR.'/../controllers/',
PS_ADMIN_DIR.'/../override/classes/',
PS_ADMIN_DIR.'/../override/controllers/',
PS_ADMIN_DIR.'/',
PS_ADMIN_DIR.'/tabs/');
$dirToParse = array(_PS_ADMIN_DIR_.'/../',
_PS_ADMIN_DIR_.'/../classes/',
_PS_ADMIN_DIR_.'/../controllers/',
_PS_ADMIN_DIR_.'/../override/classes/',
_PS_ADMIN_DIR_.'/../override/controllers/',
_PS_ADMIN_DIR_.'/',
_PS_ADMIN_DIR_.'/tabs/');
if (!file_exists(_PS_MODULE_DIR_))
die($this->displayWarning(Tools::displayError('Fatal error: Module directory is not here anymore ').'('._PS_MODULE_DIR_.')'));
if (!is_writable(_PS_MODULE_DIR_))
@@ -1211,10 +1211,10 @@ class AdminTranslations extends AdminTab
}
echo $str_output;
}
/**
* Get each informations for each mails founded in the folder $dir.
*
*
* @since 1.4.0.14
* @param string $dir
* @param string $lang
@@ -1223,7 +1223,7 @@ class AdminTranslations extends AdminTab
public function getMailFiles($dir, $lang, $group_name = 'mail')
{
$arr_return = array();
// Very usefull to name input and textarea fields
$arr_return['group_name'] = $group_name;
$arr_return['empty_values'] = 0;
@@ -1243,7 +1243,7 @@ class AdminTranslations extends AdminTab
$arr_return['files'][$email_name] = array();
}
$arr_return['files'][$email_name][$type]['en'] = $this->getMailContent($dir, $email_file, 'en');
// check if the file exists in the language to translate
if (file_exists($dir.$lang.'/'.$email_file)) {
$arr_return['files'][$email_name][$type][$lang] = $this->getMailContent($dir, $email_file, $lang);
@@ -1260,10 +1260,10 @@ class AdminTranslations extends AdminTab
}
return $arr_return;
}
/**
* Get content of the mail file.
*
*
* @since 1.4.0.14
* @param string $dir
* @param string $file
@@ -1273,17 +1273,17 @@ class AdminTranslations extends AdminTab
{
$arr_return = array();
$content = file_get_contents($dir.$lang.'/'.$file);
if (Tools::strlen($content) === 0) {
$content = '';
}
return $content;
}
/**
* Display mails in html format.
* This was create for factorize the html displaying
*
*
* @since 1.4.0.14
* @param array $mails
* @param array $all_subject_mail
@@ -1357,7 +1357,7 @@ class AdminTranslations extends AdminTab
}
/**
* Just build the html structure for display txt mails
*
*
* @since 1.4.0.14
* @param array $content with english and language needed contents
* @param string $lang iso code of the needed language
@@ -1376,31 +1376,31 @@ class AdminTranslations extends AdminTab
</div><!-- .block-mail -->';
}
/**
* Just build the html structure for display html mails.
*
* Just build the html structure for display html mails.
*
* @since 1.4.0.14
* @param array $content with english and language needed contents
* @param string $lang iso code of the needed language
* @param string $url for the html page and displaying an outline
* @param string $mail_name name of the file to translate (same for txt and html files)
* @param string $group_name group name allow to distinguish each block of mail.
* @param string|boolean $name_for_module is not false define add a name for disntiguish mails module
* @param string $group_name group name allow to distinguish each block of mail.
* @param string|boolean $name_for_module is not false define add a name for disntiguish mails module
*/
protected function displayMailBlockHtml($content, $lang, $url, $mail_name, $group_name, $name_for_module = false)
{
$title = array();
// Because TinyMCE don't work correctly with <DOCTYPE>, <html> and <body> tags
if (stripos($content[$lang], '<body'))
{
$array_lang = $lang != 'en' ? array('en', $lang) : array($lang);
foreach ($array_lang as $language)
{
$title[$language] = substr($content[$language], 0, stripos($content[$language], '<body'));
preg_match('#<title>([^<]+)</title>#Ui', $title[$language], $matches);
$title[$language] = empty($matches[1])?'':$matches[1];
// The 2 lines below allow to exlude <body> tag from the content.
// This allow to exclude body tag even if attributs are setted.
$content[$language] = substr($content[$language], stripos($content[$language], '<body')+5);
@@ -1408,7 +1408,7 @@ class AdminTranslations extends AdminTab
$content[$language] = substr($content[$language], 0, stripos($content[$language], '</body>'));
}
}
$str_return = '';
$str_return .= '
<div class="block-mail" >
@@ -1429,10 +1429,10 @@ class AdminTranslations extends AdminTab
</div><!-- .block-mail -->';
return $str_return;
}
/**
* Check in each module if contains mails folder.
*
*
* @return array of module which has mails
*/
public function getModulesHasMails()
@@ -1444,7 +1444,7 @@ class AdminTranslations extends AdminTab
{
$arr_modules[$module_dir] = _PS_MODULE_DIR_.$module_dir;
}
}
return $arr_modules;
}
@@ -1454,7 +1454,7 @@ class AdminTranslations extends AdminTab
$isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso_lang.'.js') ? $iso_lang : 'en');
$ad = dirname($_SERVER["PHP_SELF"]);
return '
<script type="text/javascript">
<script type="text/javascript">
var iso = \''.$isoTinyMCE.'\' ;
var pathCSS = \''._THEME_CSS_DIR_.'\' ;
var ad = \''.$ad.'\' ;
@@ -1473,20 +1473,20 @@ class AdminTranslations extends AdminTab
$module_mails = array();
$theme_mails = array();
$str_output = '';
// get all mail subjects, this method parse each files in Prestashop !!
$subject_mail = array();
$modules_has_mails = $this->getModulesHasMails();
$arr_files_to_parse = array(
_PS_ROOT_DIR_.'/controllers',
_PS_ROOT_DIR_.'/classes',
PS_ADMIN_DIR.'/tabs',
_PS_ADMIN_DIR_.'/tabs',
);
$arr_files_to_parse = array_merge($arr_files_to_parse, $modules_has_mails);
foreach ($arr_files_to_parse as $path) {
$subject_mail = self::getSubjectMail($path, $subject_mail);
}
$core_mails = $this->getMailFiles(_PS_MAIL_DIR_, $lang, 'core_mail');
$core_mails['subject'] = $this->getSubjectMailContent(_PS_MAIL_DIR_.$lang);
foreach ($modules_has_mails AS $module_name=>$module_path)
@@ -1494,7 +1494,7 @@ class AdminTranslations extends AdminTab
$module_mails[$module_name] = $this->getMailFiles($module_path.'/mails/', $lang, 'module_mail');
$module_mails[$module_name]['subject'] = $core_mails['subject'];
}
// Before 1.4.0.14 each theme folder was parsed,
// This page was really to low to load.
// Now just use the current theme.
@@ -1517,7 +1517,7 @@ class AdminTranslations extends AdminTab
}
}
}
if ($noDisplay)
{
$empty = 0;
@@ -1538,10 +1538,10 @@ class AdminTranslations extends AdminTab
}
$obj_lang = new Language(Language::getIdByIso($lang));
// TinyMCE
$str_output .= $this->getTinyMCEForMails($obj_lang->iso_code);
$str_output .= '<!--'.$this->l('Language').'-->';
$str_output .= '
<h2>'.$this->l('Language').' : '.Tools::strtoupper($lang).' - '.$this->l('E-mail template translations').'</h2>'
@@ -1622,7 +1622,7 @@ class AdminTranslations extends AdminTab
protected function getSubjectMailContent($directory)
{
$subject_mail_content = array();
if (Tools::file_exists_cache($directory.'/lang.php'))
{
// we need to include this even if already included
@@ -1663,16 +1663,16 @@ class AdminTranslations extends AdminTab
else
die($this->l('Cannot write language file for e-mail subjects, path is:').$path);
}
/**
* This get files to translate in module directory.
* Recursive method allow to get each files for a module no matter his depth.
*
*
* @param string $path directory path to scan
* @param array $array_files by reference - array which saved files to parse.
* @param string $module_name module name
* @param string $lang_file full path of translation file
* @param boolean $is_default
* @param boolean $is_default
*/
protected function recursiveGetModuleFiles($path, &$array_files, $module_name, $lang_file, $is_default = false)
{
@@ -1697,16 +1697,16 @@ class AdminTranslations extends AdminTab
}
}
}
/**
* This method get translation in each translations file.
* The file depend on $lang param.
*
*
* @param array $modules list of modules
* @param string $root_dir path where it get each modules
* @param string $lang iso code of choosen language to translate
* @param boolean $is_default set it if modules are located in root/prestashop/modules folder
* This allow to distinguish overrided prestashop theme and original module
* This allow to distinguish overrided prestashop theme and original module
*/
protected function getAllModuleFiles($modules, $root_dir, $lang, $is_default = false)
{
@@ -1725,10 +1725,10 @@ class AdminTranslations extends AdminTab
public function displayFormModules($lang)
{
global $_MODULES;
$array_lang_src = Language::getLanguages(false);
$str_output = '';
foreach ($array_lang_src as $language)
{
$this->all_iso_lang[] = $language['iso_code'];
@@ -1743,10 +1743,10 @@ class AdminTranslations extends AdminTab
else
{
$arr_find_and_fill = array();
$arr_files = $this->getAllModuleFiles($modules, _PS_MODULE_DIR_, $lang, true);
$arr_find_and_fill = array_merge($arr_find_and_fill, $arr_files);
if(file_exists(_PS_THEME_DIR_.'/modules/'))
{
$modules = scandir(_PS_THEME_DIR_.'/modules/');
@@ -1755,7 +1755,7 @@ class AdminTranslations extends AdminTab
}
foreach ($arr_find_and_fill as $value)
$this->findAndFillTranslations($value['files'], $value['theme'], $value['module'], $value['dir'], $lang);
$str_output .= '
<h2>'.$this->l('Language').' : '.Tools::strtoupper($lang).' - '.$this->l('Modules translations').'</h2>
'.$this->l('Total expressions').' : <b>'.$this->total_expression.'</b>. '.$this->l('Click the fieldset title to expand or close the fieldset.').'.<br /><br />';
@@ -1767,8 +1767,8 @@ class AdminTranslations extends AdminTab
$str_output .= $this->displayToggleButton();
$str_output .= $this->displayAutoTranslate();
$str_output .= '<input type="hidden" name="lang" value="'.$lang.'" /><input type="submit" name="submitTranslationsModules" value="'.$this->l('Update translations').'" class="button" /><br /><br />';
if (count($this->modules_translations) > 1)
if (count($this->modules_translations) > 1)
{
$str_output .= '<h3 style="padding:0;margin:0;">'.$this->l('List of Themes - Click to access theme translation:').'</h3>';
$str_output .= '<ul style="list-style-type:none;padding:0;margin:0 0 10px 0;">';
@@ -1813,13 +1813,13 @@ class AdminTranslations extends AdminTab
echo $str_output;
}
/** parse $filepath to find expression which match $regex, and return an
*
/** 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
* @param array $tabsArray
* @return array containing all datas needed for building the translation form
* @since 1.4.5.0
*/
@@ -1837,13 +1837,13 @@ class AdminTranslations extends AdminTab
$lang = Tools::strtolower(Tools::getValue('lang'));
$_LANG = array();
$str_output = '';
if (!file_exists(_PS_TRANSLATIONS_DIR_.$lang))
if (!mkdir(_PS_TRANSLATIONS_DIR_.$lang, 0700))
die('Please create a "'.$iso.'" directory in '._PS_TRANSLATIONS_DIR_);
if (!file_exists(_PS_TRANSLATIONS_DIR_.$lang.'/pdf.php'))
if (!file_put_contents(_PS_TRANSLATIONS_DIR_.$lang.'/pdf.php', "<?php\n\nglobal \$_LANGPDF;\n\$_LANGPDF = array();\n\n?>"))
die('Please create a "'.Tools::strtolower($lang).'.php" file in '.realpath(PS_ADMIN_DIR.'/'));
die('Please create a "'.Tools::strtolower($lang).'.php" file in '.realpath(_PS_ADMIN_DIR_.'/'));
unset($_LANGPDF);
@include(_PS_TRANSLATIONS_DIR_.$lang.'/pdf.php');
$files = array();
@@ -1859,7 +1859,7 @@ class AdminTranslations extends AdminTab
$count += isset($tabsArray[$tab]) ? sizeof($tabsArray[$tab]) : 0;
$closed = sizeof($_LANGPDF) >= $count;
$str_output .= $this->displayAutoTranslate();
$str_output .= '<h2>'.$this->l('Language').' : '.Tools::strtoupper($lang).'</h2>'
.$this->l('Expressions to translate').' : <b>'.$count.'</b>. '.$this->l('Click on the titles to open fieldsets').'.<br /><br />';
+2 -2
View File
@@ -25,9 +25,9 @@
* International Registered Trademark & Property of PrestaShop SA
*/
define('PS_ADMIN_DIR', getcwd());
define('_PS_ADMIN_DIR_', getcwd());
include(PS_ADMIN_DIR.'/../config/config.inc.php');
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
if (!isset(Context::getContext()->employee) || !Context::getContext()->employee->isLoggedBack())
die;
+1 -1
View File
@@ -364,7 +364,7 @@ abstract class AdminTabCore
$classname = 'Admin'.$subtab;
if ($module = Db::getInstance()->getValue('SELECT `module` FROM `'._DB_PREFIX_.'tab` WHERE `class_name` = \''.pSQL($classname).'\'') AND file_exists(_PS_MODULE_DIR_.'/'.$module.'/'.$classname.'.php'))
include_once(_PS_MODULE_DIR_.'/'.$module.'/'.$classname.'.php');
elseif (file_exists(PS_ADMIN_DIR.'/tabs/'.$classname.'.php'))
elseif (file_exists(_PS_ADMIN_DIR_.'/tabs/'.$classname.'.php'))
include_once('tabs/'.$classname.'.php');
if (!isset($this->_includeObj[$key]))
$this->_includeObj[$key] = new $classname;
+4 -4
View File
@@ -209,7 +209,7 @@ class ShopCore extends ObjectModel
$excluded_uris[] = $directory;
// Find current shop from URL
if (!$id_shop = Tools::getValue('id_shop') && !defined('PS_ADMIN_DIR'))
if (!$id_shop = Tools::getValue('id_shop') && !defined('_PS_ADMIN_DIR_'))
{
$sql = 'SELECT s.id_shop, CONCAT(su.physical_uri, su.virtual_uri) AS uri
FROM '._DB_PREFIX_.'shop_url su
@@ -313,7 +313,7 @@ class ShopCore extends ObjectModel
*/
public function getGroupID()
{
if (defined('PS_ADMIN_DIR'))
if (defined('_PS_ADMIN_DIR_'))
return Shop::getContextGroupID();
return (int)$this->id_group_shop;
}
@@ -541,7 +541,7 @@ class ShopCore extends ObjectModel
$shopID = $context->shop->id;
$shopGroupID = $context->shop->id_group_shop;
if (defined('PS_ADMIN_DIR'))
if (defined('_PS_ADMIN_DIR_'))
{
if (!isset($context->cookie) || !$context->cookie->shopContext)
return ($type == 'shop' || $type == 'group') ? '' : array('', '');
@@ -561,7 +561,7 @@ class ShopCore extends ObjectModel
if (!$executed)
{
$context = Context::getContext();
if (defined('PS_ADMIN_DIR'))
if (defined('_PS_ADMIN_DIR_'))
{
// While cookie is not instancied in admin, we wait ...
if (!isset($context->cookie))
+1 -1
View File
@@ -488,7 +488,7 @@ class AdminPreferences extends AdminTab
if (get_class($this) == 'Adminemails')
echo '<script type="text/javascript">if (getE(\'PS_MAIL_METHOD2_on\').checked) getE(\'smtp\').style.display = \'block\'; else getE(\'smtp\').style.display = \'none\';</script></div>';
if (!is_writable(PS_ADMIN_DIR.'/../config/settings.inc.php') AND $name == 'themes')
if (!is_writable(_PS_ADMIN_DIR_.'/../config/settings.inc.php') AND $name == 'themes')
echo '<p><img src="../img/admin/warning.gif" alt="" /> '.$this->l('if you change the theme, the settings.inc.php file must be writable (CHMOD 755 / 777)').'</p>';
echo ' <div align="center" style="margin-top: 20px;">
+2 -2
View File
@@ -390,7 +390,7 @@ abstract class AdminSelfTab
if (get_class($this) == 'Adminemails')
echo '<script type="text/javascript">if (getE(\'PS_MAIL_METHOD2_on\').checked) getE(\'smtp\').style.display = \'block\'; else getE(\'smtp\').style.display = \'none\';</script></div>';
if (!is_writable(PS_ADMIN_DIR.'/../config/settings.inc.php') AND $name == 'themes')
if (!is_writable(_PS_ADMIN_DIR_.'/../config/settings.inc.php') AND $name == 'themes')
echo '<p><img src="../img/admin/warning.gif" alt="" /> '.$this->l('if you change the theme, the settings.inc.php file must be writable (CHMOD 755 / 777)').'</p>';
echo ' <div align="center" style="margin-top: 20px;">
@@ -550,7 +550,7 @@ abstract class AdminSelfTab
$classname = 'Admin'.$subtab;
if ($module = Db::getInstance()->getValue('SELECT `module` FROM `'._DB_PREFIX_.'tab` WHERE `class_name` = \''.pSQL($classname).'\'') AND file_exists(_PS_MODULE_DIR_.'/'.$module.'/'.$classname.'.php'))
include_once(_PS_MODULE_DIR_.'/'.$module.'/'.$classname.'.php');
elseif (file_exists(PS_ADMIN_DIR.'/tabs/'.$classname.'.php'))
elseif (file_exists(_PS_ADMIN_DIR_.'/tabs/'.$classname.'.php'))
include_once('tabs/'.$classname.'.php');
if (!isset($this->_includeObj[$key]))
$this->_includeObj[$key] = new $classname;
+62 -62
View File
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
if(!defined('_PS_ADMIN_DIR_'))
define('_PS_ADMIN_DIR_',PS_ADMIN_DIR);
define('_PS_ADMIN_DIR_', _PS_ADMIN_DIR_);
if(!defined('_PS_USE_SQL_SLAVE_'))
define('_PS_USE_SQL_SLAVE_',false);
@@ -44,7 +44,7 @@ if(empty($_POST['action']) OR !in_array($_POST['action'],array('upgradeDb')))
require_once(dirname(__FILE__).'/AdminSelfTab.php');
require_once(dirname(__FILE__).'/SelfModule.php');
// Add Upgrader class
// Add Upgrader class
if(!version_compare(_PS_VERSION_,'1.4.5.0','<') AND file_exists(_PS_ROOT_DIR_.'/classes/Upgrader.php'))
require_once(_PS_ROOT_DIR_.'/classes/Upgrader.php');
else
@@ -70,10 +70,10 @@ class AdminSelfUpgrade extends AdminSelfTab
public $ajax = false;
public $nextResponseType = 'json'; // json, xml
public $next = 'N/A';
public $upgrader = null;
public $standalone = true;
/**
* set to false if the current step is a loop
*
@@ -102,12 +102,12 @@ class AdminSelfUpgrade extends AdminSelfTab
'backupDbFilename',
'backupFilesFilename',
);
public $autoupgradePath = null;
/**
* autoupgradeDir
*
* autoupgradeDir
*
* @var string directory relative to admin dir
*/
public $autoupgradeDir = 'autoupgrade';
@@ -127,7 +127,7 @@ class AdminSelfUpgrade extends AdminSelfTab
private $backupFilesFilename = '';
private $backupDbFilename = '';
/**
* int loopBackupFiles : if your server has a low memory size, lower this value
* @TODO remove the static, add a const, and use it like this : min(AdminUpgrade::DEFAULT_LOOP_ADD_FILE_TO_ZIP,Configuration::get('LOOP_ADD_FILE_TO_ZIP');
@@ -170,7 +170,7 @@ class AdminSelfUpgrade extends AdminSelfTab
public function createCustomToken()
{
// ajax-mode for autoupgrade, we can't use the classic authentication
// so, we'll create a cookie in admin dir, based on cookie key
// so, we'll create a cookie in admin dir, based on cookie key
global $cookie;
$id_employee = $cookie->id_employee;
@@ -224,7 +224,7 @@ class AdminSelfUpgrade extends AdminSelfTab
/**
* _setFields function to set fields (only when we need it).
*
*
* @return void
*/
private function _setFields()
@@ -263,7 +263,7 @@ class AdminSelfUpgrade extends AdminSelfTab
);
}
}
public function configOk()
{
$allowed = (ConfigurationTest::test_fopen() && $this->rootWritable);
@@ -274,7 +274,7 @@ class AdminSelfUpgrade extends AdminSelfTab
}
/**
* isUpgradeAllowed checks if all server configuration is valid for upgrade
*
*
* @return void
*/
public function isUpgradeAllowed()
@@ -314,7 +314,7 @@ class AdminSelfUpgrade extends AdminSelfTab
if (!in_array($this->action,array('upgradeFile', 'upgradeDb', 'upgradeComplete','rollback','restoreFiles','restoreDb')))
{
// checkPSVersion will be not
// checkPSVersion will be not
$this->upgrader = new Upgrader();
$this->upgrader->checkPSVersion();
$this->nextParams['install_version'] = $this->upgrader->version_num;
@@ -333,7 +333,7 @@ $this->standalone = true;
}
else
$this->useSvn = false;
// If not exists in this sessions, "create"
// session handling : from current to next params
@@ -361,7 +361,7 @@ $this->standalone = true;
$this->backupDbFilename = Configuration::get('UPGRADER_BACKUPDB_FILENAME');
if(!file_exists($this->backupDbFilename))
{
// If not exists, the filename is generated by Backup.php
// If not exists, the filename is generated by Backup.php
$this->backupDbFilename = '';
Configuration::updateValue('UPGRADER_BACKUPDB_FILENAME', $this->backupDbFilename);
}
@@ -402,7 +402,7 @@ $this->standalone = true;
$this->manualMode = $this->currentParams['manualMode'];
$this->desactivateCustomModule = $this->currentParams['desactivateCustomModule'];
}
// We can add any file or directory in the exclude dir : theses files will be not removed or overwritten
// We can add any file or directory in the exclude dir : theses files will be not removed or overwritten
// @TODO cache should be ignored recursively, but we have to reconstruct it after upgrade
// - compiled from smarty
// - .svn
@@ -425,18 +425,18 @@ $this->standalone = true;
if ($this->dontBackupImages)
$this->backupIgnoreAbsoluteFiles[] = "/img";
if ($this->keepDefaultTheme)
$this->excludeAbsoluteFilesFromUpgrade[] = "/themes/prestashop";
if ($this->keepTrad)
$this->excludeFilesFromUpgrade[] = "translations";
}
/**
* getFilePath return the path to the zipfile containing prestashop.
*
*
* @return void
*/
private function getFilePath()
@@ -594,13 +594,13 @@ $this->standalone = true;
if ($file[0] != '.')
{
$fullPath = $dir.DIRECTORY_SEPARATOR.$file;
if (!$this->_skipFile($file, $fullPath,'backup'))
{
if (is_dir($fullPath))
$this->_listBackupFiles($fullPath);
else
$list[] = $fullPath;
$list[] = $fullPath;
}
else
$list[] = $fullPath;
@@ -616,7 +616,7 @@ $this->standalone = true;
foreach ($allFiles as $file)
{
$fullPath = $dir.DIRECTORY_SEPARATOR.$file;
if (!$this->_skipFile($file, $fullPath, "upgrade"))
{
$list[] = $fullPath;
@@ -698,7 +698,7 @@ $this->standalone = true;
@ini_set('memory_limit','128M');
}
require_once($this->prodRootDir.'/config/autoload.php');
/* Redefine REQUEST_URI if empty (on some webservers...) */
if (!isset($_SERVER['REQUEST_URI']) || $_SERVER['REQUEST_URI'] == '')
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
@@ -753,7 +753,7 @@ $this->standalone = true;
case 'doUpgrade' :
require_once(INSTALL_PATH.DIRECTORY_SEPARATOR.'xml'.DIRECTORY_SEPARATOR.'doUpgrade.php');
break;
case 'getVersionFromDb' :
require_once(INSTALL_PATH.DIRECTORY_SEPARATOR.'xml'.DIRECTORY_SEPARATOR.'getVersionFromDb.php');
break;
@@ -913,7 +913,7 @@ $this->standalone = true;
/**
* ajaxProcessRestoreFiles restore the previously saved files.
*
*
* @return boolean true if succeed
*/
public function ajaxProcessRestoreFiles()
@@ -1015,7 +1015,7 @@ $this->standalone = true;
// @TODO need to check if a ";" in description could block that (I suppose it can at the end of a line)
preg_match_all('/(.*;)[\n\r]+/Usm', $content, $requests);
/* @TODO maybe improve regex pattern ... */
$db = Db::getInstance();
$db = Db::getInstance();
if (count($requests[0])>0)
{
foreach ($requests[1] as $request)
@@ -1062,7 +1062,7 @@ $this->standalone = true;
if(!class_exists('MySQL',false))
eval('Class MySQL extends MySQLCore{}');
}
if(!class_exists('Validate',false))
{
require_once(_PS_ROOT_DIR_.'/classes/Validate.php');
@@ -1104,7 +1104,7 @@ $this->standalone = true;
if ($res)
{
$this->nextParams['backupDbFilename'] = $backup->id;
// We need to load configuration to use it ...
// We need to load configuration to use it ...
Configuration::loadConfiguration();
Configuration::updateValue('UPGRADER_BACKUPDB_FILENAME', $backup->id);
@@ -1147,12 +1147,12 @@ $this->standalone = true;
//$current = crc32(file_get_contents($file));
//$file = $this->nextParams['filesForBackup'][0];
//$latestFile = str_replace(_PS_ROOT_DIR_,$this->latestRootDir,$file);
// if (file_exists($latestFile))
// $latest = crc32($latestFile);
// else
// $latest = '';
$zip = new ZipArchive();
if ($zip->open($this->backupFilesFilename, ZIPARCHIVE::CREATE))
{
@@ -1269,13 +1269,13 @@ $this->standalone = true;
return $resRemove;
}
public function ajaxProcessSvnCheckout()
{
$this->nextParams = $this->currentParams;
if ($this->useSvn){
$dest = $this->autoupgradePath . DIRECTORY_SEPARATOR . $this->svnDir;
$svnStatus = svn_status($dest);
if (is_array($svnStatus))
{
@@ -1363,7 +1363,7 @@ $this->standalone = true;
$this->nextParams[$v] = $this->$v;
$return['nextParams'] = $this->nextParams;
$return['nextParams']['typeResult'] = $this->nextResponseType;
$return['nextQuickInfo'] = $this->nextQuickInfo;
@@ -1383,14 +1383,14 @@ $this->standalone = true;
$this->_errors[] = Tools::displayError('This class depends of several files modified in 1.4.5.0 version and should not be used in an older version');
}
parent::displayConf();
}
public function ajaxPreProcess()
{
if (!empty($_POST['responseType']) AND $_POST['responseType'] == 'json')
header('Content-Type: application/json');
if(!empty($_POST['action']))
{
$action = $_POST['action'];
@@ -1424,10 +1424,10 @@ $this->standalone = true;
if(function_exists('apache_get_modules'))
{
static $apacheModuleList = null;
if (!is_array($apacheModuleList))
$apacheModuleList = apache_get_modules();
// we need strpos (example can be evasive20
foreach($apacheModuleList as $module)
{
@@ -1437,7 +1437,7 @@ $this->standalone = true;
}
else{
// If apache_get_modules does not exists,
// one solution should be parsing httpd.conf,
// one solution should be parsing httpd.conf,
// but we could simple parse phpinfo(INFO_MODULES) return string
ob_start();
phpinfo(INFO_MODULES);
@@ -1547,7 +1547,7 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where
else
$srcRootWritable = '../img/admin/disabled.gif';
echo '<b>'.$this->l('Root directory status').' : </b>'.'<img src="'.$srcRootWritable.'" /> '.($this->rootWritable?$this->l('fully writable'):$this->l('not writable recursively')).'<br/><br/>';
if ($this->upgrader->needUpgrade)
{
if ($this->upgrader->autoupgrade)
@@ -1621,19 +1621,19 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where
{
echo '<span class="button-autoupgrade upgradestep" >'.$this->l('Your shop is already up to date.').'</span> ';
}
echo '<br/><br/><small>'.sprintf($this->l('last datetime check : %s '),date('Y-m-d H:i:s',Configuration::get('PS_LAST_VERSION_CHECK'))).'</span>
echo '<br/><br/><small>'.sprintf($this->l('last datetime check : %s '),date('Y-m-d H:i:s',Configuration::get('PS_LAST_VERSION_CHECK'))).'</span>
<a class="button" href="index.php?tab=AdminSelfUpgrade&token='.Tools::getAdminToken('AdminSelfUpgrade'.(int)(Tab::getIdFromClassName(get_class($this))).(int)$cookie->id_employee).'&refreshCurrentVersion=1">'.$this->l('Please click to refresh').'</a>
</small>';
echo'</div>
<div id="currentlyProcessing" style="display:none;float:right"><h4>Currently processing <img id="pleaseWait" src="'.__PS_BASE_URI__.'img/loader.gif"/></h4>
<div id="infoStep" class="processing" style=height:50px;width:400px;" >'.$this->l('I\'m waiting for your command, sir').'</div>';
echo '</div>';
echo '</fieldset>';
if (defined('_PS_MODE_DEV_') AND _PS_MODE_DEV_ AND $this->manualMode)
{
@@ -1720,10 +1720,10 @@ echo '</script>';
<p class="warning">'.$this->l('Your current configuration indicate you want to upgrade your system from the unstable development branch, with no version number. If you upgrade, you will not be able to follow the official release process anymore').'.</p>
</div>';
$this->_displayUpgraderForm();
echo '<br/>';
$this->_displayRollbackForm();
echo '<br/>';
$this->_displayForm('autoUpgradeOptions',$this->_fieldsAutoUpgrade,'<a href="" name="options" id="options">'.$this->l('Options').'</a>', '','prefs');
@@ -1776,7 +1776,7 @@ function addQuickInfo(arrQuickInfo){
$("#quickInfo").show();
for(i=0;i<arrQuickInfo.length;i++)
$("#quickInfo").append(arrQuickInfo[i]+"<br/>");
$("#quickInfo").attr({ scrollTop: $("#quickInfo").attr("scrollHeight") });
}
}';
@@ -1800,11 +1800,11 @@ $(document).ready(function(){
// more convenient to have that param for handling success and error
var requestParams;
// set timeout to 5 minutes (download can be long)?
$.ajaxSetup({timeout:300000});
// prepare available button here, without params ?
prepareNextButton("#upgradeNow",firstTimeParams);
prepareNextButton("#rollback",firstTimeParams);
@@ -1845,7 +1845,7 @@ function handleXMLResult(xmlRet, previousParams)
// this will be used in after** javascript functions
resGlobal = $.xml2json(xmlRet);
switch(previousParams.upgradeDbStep)
switch(previousParams.upgradeDbStep)
{
case 0: // getVersionFromDb
result = "ok";
@@ -1886,7 +1886,7 @@ function handleXMLResult(xmlRet, previousParams)
.show("slow");
$("#dbCreateResultCheck")
.hide("slow");
// propose rollback if there is an error
if (confirm("An error happen\r\n'.$this->l('Do you want to rollback ?').'"))
resGlobal = {next:"rollback",nextParams:{typeResult:"json"},status:"error"};
@@ -1915,8 +1915,8 @@ function afterUpgradeComplete()
$("#infoStep").html("<h3>'.$this->l('Upgrade Complete ! ').'</h3>");
}
/**
* afterBackupDb display the button
*
* afterBackupDb display the button
*
*/
function afterBackupDb()
{
@@ -1999,7 +1999,7 @@ function doAjaxRequest(action, nextParams){
$("#"+action).addClass("done");
if (res.stepDone)
$("#"+action).addClass("stepok");
// if a function "after[action name]" exists, it should be called.
// This is used for enabling restore buttons for example
funcName = "after"+ucFirst(action);
@@ -2107,7 +2107,7 @@ function handleError(res)
{
$("#rollback").click();
}
}
}
';
@@ -2132,7 +2132,7 @@ $js.= '$(document).ready(function(){
$("#checkPrestaShopFilesVersion").append("<a id=\"toggleChangedList\" class=\"button\" href=\"\">'.$this->l('See or hide the list').'</a><br/>");
$("#checkPrestaShopFilesVersion").append("<div id=\"changedList\" style=\"display:none \">");
$("#changedList").html("<ul>");
$(answer.result).each(function(k,v){
$("#changedList ul").append("<li>"+v+"</li>");
@@ -2192,7 +2192,7 @@ $("#toggleChangedList").bind("click",function(e){e.preventDefault();$("#changedL
return true;
}
/**
* @desc extract a zip file to the given directory
* @return bool success
@@ -2230,7 +2230,7 @@ $("#toggleChangedList").bind("click",function(e){e.preventDefault();$("#changedL
return true;
}
}
private function _listArchivedFiles()
{
if (!empty($this->nextParams['backupFilesFilepath']))
@@ -2242,7 +2242,7 @@ $("#toggleChangedList").bind("click",function(e){e.preventDefault();$("#changedL
{
while ($entry=zip_read($zip))
$files[] = zip_entry_name($entry);
zip_close($zip);
}
}
@@ -2255,7 +2255,7 @@ $("#toggleChangedList").bind("click",function(e){e.preventDefault();$("#changedL
}
return false;
}
/**
* bool _skipFile : check whether a file is in backup or restore skip list
*
@@ -2282,7 +2282,7 @@ $("#toggleChangedList").bind("click",function(e){e.preventDefault();$("#changedL
case 'upgrade':
if (in_array($file, $this->excludeFilesFromUpgrade))
return true;
foreach ($this->excludeAbsoluteFilesFromUpgrade as $path)
if (strpos($fullpath, $rootpath.$path) !== false)
return true;
+1 -2
View File
@@ -44,7 +44,6 @@ if ( _PS_ROOT_DIR_.DIRECTORY_SEPARATOR.$_POST['dir'] !== realpath(_PS_ROOT_DIR_
die('not allowed');
define('_PS_ADMIN_DIR_', _PS_ROOT_DIR_.DIRECTORY_SEPARATOR.$_POST['dir']);
define('PS_ADMIN_DIR', _PS_ADMIN_DIR_); // Retro-compatibility
//require(_PS_ADMIN_DIR_.'/functions.php');
include(AUTOUPGRADE_MODULE_DIR.'init.php');
@@ -56,7 +55,7 @@ $adminObj->ajax = true;
{
if ($adminObj->checkToken())
{
// the differences with index.php is here
// the differences with index.php is here
$adminObj->ajaxPreProcess();
$action = Tools14::getValue('action');
+9 -8
View File
@@ -1,4 +1,5 @@
<?php
class Autoupgrade extends Module
{
function __construct()
@@ -9,11 +10,11 @@ class Autoupgrade extends Module
if (!defined('_PS_ADMIN_DIR_'))
{
if (defined('PS_ADMIN_DIR'))
define('_PS_ADMIN_DIR_',PS_ADMIN_DIR);
if (defined('_PS_ADMIN_DIR_'))
define('_PS_ADMIN_DIR_', _PS_ADMIN_DIR_);
else
{
$this->_errors[] = $this->l('This version of PrestaShop cannot be upgraded : PS_ADMIN_DIR constant is missing');
$this->_errors[] = $this->l('This version of PrestaShop cannot be upgraded :_PS_ADMIN_DIR_ constant is missing');
$autoupgradeCanWork = false;
}
}
@@ -36,7 +37,7 @@ class Autoupgrade extends Module
$tab = new Tab($idTab);
$res &= $tab->delete();
}
$idTab = Tab::getIdFromClassName('AdminSelfUpgrade');
// Then we add AdminSelfUpgrade only if not exists
if (!$idTab)
@@ -58,11 +59,11 @@ class Autoupgrade extends Module
if(file_exists($autoupgradeDir.DIRECTORY_SEPARATOR.'ajax-upgradetab.php'))
$res &= unlink($autoupgradeDir.DIRECTORY_SEPARATOR.'ajax-upgradetab.php');
$path = dirname(__FILE__).'/';
$res &= copy($path.'ajax-upgradetab.php',$autoupgradeDir . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php');
$res &= copy($path.'logo.gif',_PS_ROOT_DIR_. DIRECTORY_SEPARATOR . 'img/t/AdminSelfUpgrade.gif');
if (!$res
if (!$res
OR !Tab::getIdFromClassName('AdminSelfUpgrade')
OR !parent::install()
)
@@ -85,7 +86,7 @@ class Autoupgrade extends Module
}
$res &= unlink(_PS_ADMIN_DIR_.DIRECTORY_SEPARATOR.'tabs'.'AdminUpgrade.php');
}
if (file_exists(_PS_ADMIN_DIR_.DIRECTORY_SEPARATOR.'autoupgrade'.DIRECTORY_SEPARATOR.'ajax-upgradetab.php'))
$res &= @unlink(_PS_ADMIN_DIR_.DIRECTORY_SEPARATOR.'autoupgrade'.DIRECTORY_SEPARATOR.'ajax-upgradetab.php');
if (!$res OR !parent::uninstall())
+3 -3
View File
@@ -101,7 +101,7 @@ function rewriteSettingsFile($baseUrls = NULL, $theme = NULL, $arrayDB = NULL)
foreach ($defines as $k => $value)
$content .= 'define(\''.$k.'\', \''.addslashes($value).'\');'."\n";
$content .= "\n?>";
if ($fd = @fopen(PS_ADMIN_DIR.'/../config/settings.inc.php', 'w'))
if ($fd = @fopen(_PS_ADMIN_DIR_.'/../config/settings.inc.php', 'w'))
{
fwrite($fd, $content);
fclose($fd);
@@ -254,8 +254,8 @@ function checkingTab($tab)
}
if ($row['module'] AND file_exists(_PS_MODULE_DIR_.'/'.$row['module'].'/'.$tab.'.php'))
include_once(_PS_MODULE_DIR_.'/'.$row['module'].'/'.$tab.'.php');
elseif (file_exists(PS_ADMIN_DIR.'/tabs/'.$tab.'.php'))
include_once(PS_ADMIN_DIR.'/tabs/'.$tab.'.php');
elseif (file_exists(_PS_ADMIN_DIR_.'/tabs/'.$tab.'.php'))
include_once(_PS_ADMIN_DIR_.'/tabs/'.$tab.'.php');
if (!class_exists($tab, false) OR !$row['id_tab'])
{