// Merge -> revision 8984

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8988 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-10-03 15:48:07 +00:00
parent 79115b2572
commit ae5fc92bf7
60 changed files with 669 additions and 356 deletions
+1 -2
View File
@@ -36,7 +36,6 @@ if (!isset($_POST['controller']) && isset($_POST['tab']))
$_POST['controller'] = strtolower($_POST['tab']); $_POST['controller'] = strtolower($_POST['tab']);
if (!isset($_REQUEST['controller']) && isset($_REQUEST['tab'])) if (!isset($_REQUEST['controller']) && isset($_REQUEST['tab']))
$_REQUEST['controller'] = strtolower($_REQUEST['tab']); $_REQUEST['controller'] = strtolower($_REQUEST['tab']);
Dispatcher::getInstance()->setControllerDirectories(array(_PS_ADMIN_DIR_.'/tabs/', _PS_ADMIN_CONTROLLER_DIR_)); Dispatcher::getInstance()->setControllerDirectories(array(_PS_ADMIN_DIR_.'/tabs/', _PS_ADMIN_CONTROLLER_DIR_));
Dispatcher::getInstance()->dispatch(); Dispatcher::getInstance()->dispatch();
+16 -5
View File
@@ -1376,6 +1376,18 @@ class AdminImport extends AdminTab
}; };
</script>'; </script>';
echo ' echo '
<fieldset style="float:right;margin:0 10px 10px 0">
<legend><img src="../img/admin/excel_file.png">'.$this->l('Sample files').'</legend>
<ul style="">
<li style="text-decoration: underline"><a href="../docs/csv_import/categories_import.csv">'.$this->l('Categories sample file').'</a></li>
<li style="text-decoration: underline"><a href="../docs/csv_import/products_import.csv">'.$this->l('Products sample file').'</a></li>
<li style="text-decoration: underline"><a href="../docs/csv_import/combinations_import.csv">'.$this->l('Combinations sample file').'</a></li>
<li style="text-decoration: underline"><a href="../docs/csv_import/customers_import.csv">'.$this->l('Customers sample file').'</a></li>
<li style="text-decoration: underline"><a href="../docs/csv_import/addresses_import.csv">'.$this->l('Addresses sample file').'</a></li>
<li style="text-decoration: underline"><a href="../docs/csv_import/manufacturers_import.csv">'.$this->l('Manufacturers sample file').'</a></li>
<li style="text-decoration: underline"><a href="../docs/csv_import/suppliers_import.csv">'.$this->l('Suppliers sample file').'</a></li>
</ul>
</fieldset>
<fieldset class="width3"> <fieldset class="width3">
<legend><img src="../img/admin/import.gif" />'.$this->l('Upload').'</legend> <legend><img src="../img/admin/import.gif" />'.$this->l('Upload').'</legend>
<form action="'.self::$currentIndex.'&token='.$this->token.'" method="POST" enctype="multipart/form-data"> <form action="'.self::$currentIndex.'&token='.$this->token.'" method="POST" enctype="multipart/form-data">
@@ -1456,12 +1468,11 @@ class AdminImport extends AdminTab
<div class="space margin-form"> <div class="space margin-form">
<input type="submit" name="submitImportFile" value="'.$this->l('Next step').'" class="button"/> <input type="submit" name="submitImportFile" value="'.$this->l('Next step').'" class="button"/>
</div> </div>
<div> <div class="warn">
'.$this->l('Note that the category import does not support categories of the same name').'. <p>'.$this->l('Note that the category import does not support categories of the same name').'.</p>
<p>'.$this->l('Note that references are not specified as UNIQUE in the database').'.</p>
</div> </div>
<div>
'.$this->l('Note that references are not specified as UNIQUE in the database').'.
</div>
'; ';
} }
else else
+100 -34
View File
@@ -40,44 +40,83 @@ class AdminModules extends AdminTab
private $listTabModules; private $listTabModules;
private $listPartnerModules = array(); private $listPartnerModules = array();
private $listNativeModules = array(); private $listNativeModules = array();
private $_moduleCacheFile; private $_moduleCacheFile = '/config/modules_list.xml';
public static $xml_modules_list = 'http://www.prestashop.com/xml/modules_list.xml';
static private $MAX_DISP_AUTHOR = 20; // maximum length to display static private $MAX_DISP_AUTHOR = 20; // maximum length to display
function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
$this->_moduleCacheFile = _PS_ROOT_DIR_.'/config/modules_list.xml'; $this->listTabModules['administration'] = $this->l('Administration');
$this->listTabModules['advertising_marketing'] = $this->l('Advertising & Marketing');
$this->listTabModules['analytics_stats'] = $this->l('Analytics & Stats');
$this->listTabModules['billing_invoicing'] = $this->l('Billing & Invoicing');
$this->listTabModules['checkout'] = $this->l('Checkout');
$this->listTabModules['content_management'] = $this->l('Content Management');
$this->listTabModules['export'] = $this->l('Export');
$this->listTabModules['front_office_features'] = $this->l('Front Office Features');
$this->listTabModules['i18n_localization'] = $this->l('I18n & Localization');
$this->listTabModules['merchandizing'] = $this->l('Merchandizing');
$this->listTabModules['migration_tools'] = $this->l('Migration Tools');
$this->listTabModules['payments_gateways'] = $this->l('Payments & Gateways');
$this->listTabModules['payment_security'] = $this->l('Payment Security');
$this->listTabModules['pricing_promotion'] = $this->l('Pricing & Promotion');
$this->listTabModules['quick_bulk_update'] = $this->l('Quick / Bulk update');
$this->listTabModules['search_filter'] = $this->l('Search & Filter');
$this->listTabModules['seo'] = $this->l('SEO');
$this->listTabModules['shipping_logistics'] = $this->l('Shipping & Logistics');
$this->listTabModules['slideshows'] = $this->l('Slideshows');
$this->listTabModules['smart_shopping'] = $this->l('Smart Shopping');
$this->listTabModules['market_place'] = $this->l('Market Place');
$this->listTabModules['social_networks'] = $this->l('Social Networks');
$this->listTabModules['others'] = $this->l('Other Modules');
// refresh modules_list.xml every week if (file_exists(_PS_ROOT_DIR_.$this->_moduleCacheFile))
$xmlModules = @simplexml_load_file(_PS_ROOT_DIR_.$this->_moduleCacheFile);
else
$xmlModules = false;
if ($xmlModules)
{
foreach($xmlModules->children() as $xmlModule)
{
if ($xmlModule->attributes() == 'native')
foreach($xmlModule->children() as $module)
foreach($module->attributes() as $key => $value)
if ($key == 'name')
$this->listNativeModules[] = (string)$value;
if ($xmlModule->attributes() == 'partner')
foreach ($xmlModule->children() as $module)
foreach ($module->attributes() as $key => $value)
if ($key == 'name')
$this->listPartnerModules[] = (string)$value;
}
}
}
/** if modules_list.xml is outdated,
* this function will re-upload it from prestashop.com
*
* @return null
*/
public function ajaxProcessRefreshModuleList()
{
//refresh modules_list.xml every week
if (!$this->isFresh()) if (!$this->isFresh())
{
$this->refresh(); $this->refresh();
$this->status = 'refresh';
}
else
$this->status = 'cache';
}
$this->listTabModules = array( public function displayAjaxRefreshModuleList()
'administration' => $this->l('Administration'), 'advertising_marketing' => $this->l('Advertising & Marketing'), {
'analytics_stats' => $this->l('Analytics & Stats'), 'billing_invoicing' => $this->l('Billing & Invoicing'), 'checkout' => $this->l('Checkout'), echo Tools::jsonEncode(array('status' => $this->status));
'content_management' => $this->l('Content Management'), 'export' => $this->l('Export'), 'front_office_features' => $this->l('Front Office Features'),
'i18n_localization' => $this->l('I18n & Localization'), 'merchandizing' => $this->l('Merchandizing'), 'migration_tools' => $this->l('Migration Tools'),
'payments_gateways' => $this->l('Payments & Gateways'), 'payment_security' => $this->l('Payment Security'), 'pricing_promotion' => $this->l('Pricing & Promotion'),
'quick_bulk_update' => $this->l('Quick / Bulk update'), 'search_filter' => $this->l('Search & Filter'), 'seo' => $this->l('SEO'), 'shipping_logistics' => $this->l('Shipping & Logistics'),
'slideshows' => $this->l('Slideshows'), 'smart_shopping' => $this->l('Smart Shopping'), 'market_place' => $this->l('Market Place'), 'social_networks' => $this->l('Social Networks'),
'others'=> $this->l('Other Modules')
);
$xmlModules = @simplexml_load_file($this->_moduleCacheFile);
foreach($xmlModules->children() as $xmlModule)
if ($xmlModule->attributes() == 'native')
foreach($xmlModule->children() as $module)
foreach($module->attributes() as $key => $value)
if ($key == 'name')
$this->listNativeModules[] = (string)$value;
if ($xmlModule->attributes() == 'partner')
foreach($xmlModule->children() as $module)
foreach($module->attributes() as $key => $value)
if ($key == 'name')
$this->listPartnerModules[] = (string)$value;
} }
public function postProcess() public function postProcess()
@@ -343,7 +382,7 @@ class AdminModules extends AdminTab
$return = ($method == 'install' ? 12 : 13); $return = ($method == 'install' ? 12 : 13);
elseif ($echo === false) elseif ($echo === false)
$module_errors[] = $name; $module_errors[] = $name;
if (Shop::isMultiShopActivated() && Context::shop() != Shop::CONTEXT_ALL && isset(Context::getContext()->tmpOldShop)) if (Shop::isMultiShopActivated() && Context::shop() != Shop::CONTEXT_ALL && isset(Context::getContext()->tmpOldShop))
{ {
Context::getContext()->shop = clone(Context::getContext()->tmpOldShop); Context::getContext()->shop = clone(Context::getContext()->tmpOldShop);
@@ -443,10 +482,38 @@ class AdminModules extends AdminTab
$(\'input[name="filtername"]\').result(function(event, data, formatted) { $(\'input[name="filtername"]\').result(function(event, data, formatted) {
$(\'#filternameForm\').submit(); $(\'#filternameForm\').submit();
}); });
}); });';
// the following to get modules_list.xml from prestashop.com
echo '$(document).ready(function(){
try
{
resAjax = $.ajax({
type:"POST",
url : "'. str_replace('index','ajax-tab',$currentIndex) . '",
async: true,
data : {
ajaxMode : "1",
ajax : "1",
token : "'.$this->token.'",
tab : "AdminModules",
action : "refreshModuleList"
},
success : function(res,textStatus,jqXHR)
{
// res.status = cache or refresh
},
error: function(res,textStatus,jqXHR)
{
alert("TECHNICAL ERROR"+res);
}
});
}
catch(e){}
});
</script>'; </script>';
} }
public static function sortModule($a, $b) public static function sortModule($a, $b)
{ {
if (sizeof($a) == sizeof($b)) { if (sizeof($a) == sizeof($b)) {
@@ -666,7 +733,6 @@ class AdminModules extends AdminTab
'.$this->l('Add a module from my computer').' '.$this->l('Add a module from my computer').'
</span> </span>
&nbsp;|&nbsp;'; &nbsp;|&nbsp;';
if (@fsockopen('www.prestashop.com', 80))
echo '<a href="index.php?tab=AdminAddonsMyAccount&token='.Tools::getAdminTokenLite('AdminAddonsMyAccount').'"> echo '<a href="index.php?tab=AdminAddonsMyAccount&token='.Tools::getAdminTokenLite('AdminAddonsMyAccount').'">
<img src="https://addons.prestashop.com/modules.php?'.(isset($_SERVER['SERVER_ADDR']) ? 'server='.ip2long($_SERVER['SERVER_ADDR']).'&' : '').'mods='.$serialModules.'" alt="Add" class="middle" /> <img src="https://addons.prestashop.com/modules.php?'.(isset($_SERVER['SERVER_ADDR']) ? 'server='.ip2long($_SERVER['SERVER_ADDR']).'&' : '').'mods='.$serialModules.'" alt="Add" class="middle" />
'.$this->l('Add a module from PrestaShop Addons').' '.$this->l('Add a module from PrestaShop Addons').'
@@ -968,15 +1034,15 @@ class AdminModules extends AdminTab
public function isFresh($timeout = 604800000) public function isFresh($timeout = 604800000)
{ {
if (file_exists($this->_moduleCacheFile)) if (file_exists(_PS_ROOT_DIR_ . $this->_moduleCacheFile))
return ((time() - filemtime($this->_moduleCacheFile)) < $timeout); return ((time() - filemtime(_PS_ROOT_DIR_ . $this->_moduleCacheFile)) < $timeout);
else else
return false; return false;
} }
public function refresh() public function refresh()
{ {
return file_put_contents($this->_moduleCacheFile, Tools::file_get_contents('http://www.prestashop.com/xml/modules_list.xml')); return file_put_contents(_PS_ROOT_DIR_.$this->_moduleCacheFile, Tools::file_get_contents($this->xml_modules_list));
} }
public function displaySelectedFilter() public function displaySelectedFilter()
-4
View File
@@ -62,10 +62,6 @@ abstract class CacheCore
{ {
} }
protected function __destruct()
{
}
protected function isBlacklist($query) protected function isBlacklist($query)
{ {
foreach ($this->_blackList AS $find) foreach ($this->_blackList AS $find)
+2
View File
@@ -271,6 +271,8 @@ class LocalizationPackCore
$this->_errors[] = Tools::displayError('An error occurred while importing the currency: ').strval($attributes['name']); $this->_errors[] = Tools::displayError('An error occurred while importing the currency: ').strval($attributes['name']);
return false; return false;
} }
PaymentModule::addCurrencyPermissions($currency->id);
} }
} }
+52
View File
@@ -538,5 +538,57 @@ abstract class PaymentModuleCore extends Module
return false; return false;
return (new Currency($id_currency)); return (new Currency($id_currency));
} }
/**
* Allows specified payment modules to be used by a specific currency
*
* @since 1.4.5
* @param int $id_currency
* @param array $id_module_list
* @return boolean
*/
public static function addCurrencyPermissions($id_currency, array $id_module_list = array())
{
$values = '';
if (count($id_module_list) == 0)
{
// fetch all installed module ids
$modules = PaymentModuleCore::getInstalledPaymentModules();
foreach ($modules as $module)
$id_module_list[] = $module['id_module'];
}
foreach ($id_module_list as $id_module)
$values .= '('.(int)$id_module.','.(int)$id_currency.'),';
if (!empty($values))
{
return Db::getInstance()->Execute('
INSERT INTO `'._DB_PREFIX_.'module_currency` (`id_module`, `id_currency`)
VALUES '.rtrim($values, ',')
);
}
return true;
}
/**
* List all installed and active payment modules
* @see Module::getPaymentModules() if you need a list of module related to the user context
*
* @since 1.4.5
* @return array module informations
*/
public static function getInstalledPaymentModules()
{
return Db::getInstance()->executeS('
SELECT DISTINCT m.`id_module`, h.`id_hook`, m.`name`, hm.`position`
FROM `'._DB_PREFIX_.'module` m
LEFT JOIN `'._DB_PREFIX_.'hook_module` hm ON hm.`id_module` = m.`id_module`
LEFT JOIN `'._DB_PREFIX_.'hook` h ON hm.`id_hook` = h.`id_hook`
WHERE h.`name` = \'payment\'
AND m.`active` = 1
');
}
} }
+5 -1
View File
@@ -2656,7 +2656,11 @@ class ProductCore extends ObjectModel
public static function duplicateDownload($id_product_old, $id_product_new) public static function duplicateDownload($id_product_old, $id_product_new)
{ {
$resource = Db::getInstance()->ExecuteS('SELECT `display_filename`, `filename`, `date_add`, `date_expiration`, `nb_days_accessible`, `nb_downloadable`, `active`, `is_shareable` FROM `'._DB_PREFIX_.'product_download` WHERE `id_product` = '.(int)($id_product_old)); $sql = 'SELECT `display_filename`, `filename`, `date_add`, `date_expiration`, `nb_days_accessible`, `nb_downloadable`, `active`, `is_shareable`
FROM `'._DB_PREFIX_.'product_download`
WHERE `id_product` = '.(int)$id_product_old;
$resource = Db::getInstance()->Execute($sql);
if (!Db::getInstance()->NumRows()) if (!Db::getInstance()->NumRows())
return true; return true;
$query = 'INSERT INTO `'._DB_PREFIX_.'product_download` (`id_product`, `display_filename`, `filename`, `date_add`, `date_expiration`, `nb_days_accessible`, `nb_downloadable`, `active`, `is_shareable`) VALUES'; $query = 'INSERT INTO `'._DB_PREFIX_.'product_download` (`id_product`, `display_filename`, `filename`, `date_add`, `date_expiration`, `nb_days_accessible`, `nb_downloadable`, `active`, `is_shareable`) VALUES';
+16 -16
View File
@@ -29,7 +29,7 @@ class ProductDownloadCore extends ObjectModel
{ {
/** @var integer Product id which download belongs */ /** @var integer Product id which download belongs */
public $id_product; public $id_product;
/** @var integer Attribute Product id which download belongs */ /** @var integer Attribute Product id which download belongs */
public $id_product_attribute; public $id_product_attribute;
@@ -38,13 +38,13 @@ class ProductDownloadCore extends ObjectModel
/** @var string PhysicallyFilename the name of the file on hard disk */ /** @var string PhysicallyFilename the name of the file on hard disk */
public $filename; public $filename;
/** @var string DateDeposit when the file is upload */ /** @var string DateDeposit when the file is upload */
public $date_add; public $date_add;
/** @var string DateExpiration deadline of the file */ /** @var string DateExpiration deadline of the file */
public $date_expiration; public $date_expiration;
/** @var string NbDaysAccessible how many days the customer can access to file */ /** @var string NbDaysAccessible how many days the customer can access to file */
public $nb_days_accessible; public $nb_days_accessible;
@@ -53,7 +53,7 @@ class ProductDownloadCore extends ObjectModel
/** @var boolean Active if file is accessible or not */ /** @var boolean Active if file is accessible or not */
public $active = 1; public $active = 1;
/** @var boolean is_shareable indicates whether the product can be shared */ /** @var boolean is_shareable indicates whether the product can be shared */
public $is_shareable = 0; public $is_shareable = 0;
@@ -133,20 +133,20 @@ class ProductDownloadCore extends ObjectModel
public function getFields() public function getFields()
{ {
$this->validateFields(); $this->validateFields();
$date_expiration = $this->date_expiration;
if (!$date_expiration)
$date_expiration = '0000-00-00 00:00:00';
if (!$this->date_expiration) $fields['id_product'] = (int)$this->id_product;
$this->date_expiration = '0000-00-00 00:00:00';
$fields['id_product'] = (int)($this->id_product);
$fields['id_product_attribute'] = pSQL($this->id_product_attribute); $fields['id_product_attribute'] = pSQL($this->id_product_attribute);
$fields['display_filename'] = pSQL($this->display_filename); $fields['display_filename'] = pSQL($this->display_filename);
$fields['filename'] = pSQL($this->filename); $fields['filename'] = pSQL($this->filename);
$fields['date_add'] = pSQL($this->date_add); $fields['date_add'] = pSQL($this->date_add);
$fields['date_expiration'] = pSQL($this->date_expiration); $fields['date_expiration'] = pSQL($date_expiration);
$fields['nb_days_accessible'] = (int)($this->nb_days_accessible); $fields['nb_days_accessible'] = (int)$this->nb_days_accessible;
$fields['nb_downloadable'] = (int)($this->nb_downloadable); $fields['nb_downloadable'] = (int)$this->nb_downloadable;
$fields['active'] = (int)($this->active); $fields['active'] = (int)$this->active;
$fields['is_shareable'] = (int)($this->is_shareable); $fields['is_shareable'] = (int)$this->is_shareable;
return $fields; return $fields;
} }
@@ -220,7 +220,7 @@ class ProductDownloadCore extends ObjectModel
WHERE `id_product_attribute` = '.(int)$id_product_attribute.' AND `active` = 1'); WHERE `id_product_attribute` = '.(int)$id_product_attribute.' AND `active` = 1');
return self::$_productIds[$id_product_attribute]; return self::$_productIds[$id_product_attribute];
} }
/** /**
* Return the display filename from a physical filename * Return the display filename from a physical filename
* *
@@ -237,7 +237,7 @@ class ProductDownloadCore extends ObjectModel
FROM `'._DB_PREFIX_.'product_download` FROM `'._DB_PREFIX_.'product_download`
WHERE `id_product` = '.(int)$id_product.' AND `active` = 1'); WHERE `id_product` = '.(int)$id_product.' AND `active` = 1');
} }
/** /**
* Return the display filename from a physical filename * Return the display filename from a physical filename
* *
@@ -254,7 +254,7 @@ class ProductDownloadCore extends ObjectModel
FROM `'._DB_PREFIX_.'product_download` FROM `'._DB_PREFIX_.'product_download`
WHERE `filename` = \''.pSQL($filename).'\''); WHERE `filename` = \''.pSQL($filename).'\'');
} }
/** /**
* Return the filename from an id_product * Return the filename from an id_product
* *
-5
View File
@@ -466,11 +466,6 @@ class SearchCore
// If we find words that need to be indexed, they're added to the word table in the database // If we find words that need to be indexed, they're added to the word table in the database
if (count($pArray)) if (count($pArray))
{ {
$list = '';
foreach ($pArray AS $word => $weight)
$list .= '\''.$word.'\',';
$list = rtrim($list, ',');
$queryArray = array(); $queryArray = array();
$queryArray2 = array(); $queryArray2 = array();
foreach ($pArray AS $word => $weight) foreach ($pArray AS $word => $weight)
+49 -9
View File
@@ -1206,11 +1206,11 @@ class ToolsCore
else else
return false; return false;
} }
/** /**
* @deprecated as of 1.5 use Media::minifyHTML() * @deprecated as of 1.5 use Media::minifyHTML()
*/ */
public static function minifyHTML($html_content) public static function minifyHTML($html_content)
{ {
Tools::displayAsDeprecated(); Tools::displayAsDeprecated();
@@ -1237,7 +1237,7 @@ class ToolsCore
$b = hexdec(substr($hex, 4, 2)); $b = hexdec(substr($hex, 4, 2));
return (($r * 299) + ($g * 587) + ($b * 114)) / 1000; return (($r * 299) + ($g * 587) + ($b * 114)) / 1000;
} }
/** /**
* @deprecated as of 1.5 use Media::minifyHTMLpregCallback() * @deprecated as of 1.5 use Media::minifyHTMLpregCallback()
*/ */
@@ -1246,7 +1246,7 @@ class ToolsCore
Tools::displayAsDeprecated(); Tools::displayAsDeprecated();
return Media::minifyHTMLpregCallback($preg_matches); return Media::minifyHTMLpregCallback($preg_matches);
} }
/** /**
* @deprecated as of 1.5 use Media::packJSinHTML() * @deprecated as of 1.5 use Media::packJSinHTML()
*/ */
@@ -1255,7 +1255,7 @@ class ToolsCore
Tools::displayAsDeprecated(); Tools::displayAsDeprecated();
return Media::packJSinHTML($html_content); return Media::packJSinHTML($html_content);
} }
/** /**
* @deprecated as of 1.5 use Media::packJSinHTMLpregCallback() * @deprecated as of 1.5 use Media::packJSinHTMLpregCallback()
*/ */
@@ -1285,7 +1285,7 @@ class ToolsCore
} }
return false; return false;
} }
/** /**
* @deprecated as of 1.5 use Media::minifyCSS() * @deprecated as of 1.5 use Media::minifyCSS()
*/ */
@@ -1341,7 +1341,7 @@ class ToolsCore
/** /**
* @deprecated as of 1.5 use Media::cccCss() * @deprecated as of 1.5 use Media::cccCss()
*/ */
public static function cccCss($css_files) public static function cccCss($css_files)
{ {
Tools::displayAsDeprecated(); Tools::displayAsDeprecated();
return Media::cccCss($css_files); return Media::cccCss($css_files);
@@ -1351,14 +1351,14 @@ class ToolsCore
/** /**
* @deprecated as of 1.5 use Media::cccJS() * @deprecated as of 1.5 use Media::cccJS()
*/ */
public static function cccJS($js_files) public static function cccJS($js_files)
{ {
Tools::displayAsDeprecated(); Tools::displayAsDeprecated();
return Media::cccJS($css_files); return Media::cccJS($css_files);
} }
private static $_cache_nb_media_servers = null; private static $_cache_nb_media_servers = null;
public static function getMediaServer($filename) public static function getMediaServer($filename)
{ {
if (self::$_cache_nb_media_servers === null) if (self::$_cache_nb_media_servers === null)
@@ -1912,6 +1912,46 @@ FileETag INode MTime Size
$result = min($post_max_size, $upload_max_filesize); $result = min($post_max_size, $upload_max_filesize);
return $result; return $result;
} }
/**
* apacheModExists return true if the apache module $name is loaded
* @TODO move this method in class Information (when it will exist)
*
* @param string $name module name
* @return boolean true if exists
* @since 1.4.5.0
*/
public static function apacheModExists($name)
{
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)
{
if (strpos($module, $name)!==false)
return true;
}
}
else
{
// If apache_get_modules does not exists,
// one solution should be parsing httpd.conf,
// but we could simple parse phpinfo(INFO_MODULES) return string
ob_start();
phpinfo(INFO_MODULES);
$phpinfo = ob_get_contents();
ob_end_clean();
if (strpos($phpinfo, $module) !== false)
return true;
}
return false;
}
} }
/** /**
+4
View File
@@ -52,6 +52,10 @@ class TaxCore extends ObjectModel
protected static $_product_country_tax = array(); protected static $_product_country_tax = array();
protected static $_product_tax_via_rules = array(); protected static $_product_tax_via_rules = array();
protected $webserviceParameters = array(
'objectsNodeName' => 'taxes',
);
public function getFields() public function getFields()
{ {
$this->validateFields(); $this->validateFields();
+77 -76
View File
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -32,13 +32,13 @@
class WebserviceOutputBuilderCore class WebserviceOutputBuilderCore
{ {
/** /**
* *
* @var int constant * @var int constant
*/ */
const VIEW_LIST = 1; const VIEW_LIST = 1;
const VIEW_DETAILS = 2; const VIEW_DETAILS = 2;
protected $wsUrl; protected $wsUrl;
protected $output; protected $output;
public $objectRender; public $objectRender;
protected $wsResource; protected $wsResource;
@@ -47,7 +47,7 @@ class WebserviceOutputBuilderCore
protected $fieldsToDisplay; protected $fieldsToDisplay;
protected $specificFields = array(); protected $specificFields = array();
protected $virtualFields = array(); protected $virtualFields = array();
// Header properties // Header properties
protected $headerParams = array( protected $headerParams = array(
'Access-Time' => 0, 'Access-Time' => 0,
@@ -55,22 +55,22 @@ class WebserviceOutputBuilderCore
'PSWS-Version' => 0, 'PSWS-Version' => 0,
'Content-Type' => 0, 'Content-Type' => 0,
); );
/** /**
* @var string Status header sent at return * @var string Status header sent at return
*/ */
protected $status; protected $status;
public function __construct($ws_url) public function __construct($ws_url)
{ {
$this->status = $_SERVER['SERVER_PROTOCOL'].' 200 OK'; $this->status = $_SERVER['SERVER_PROTOCOL'].' 200 OK';
$this->wsUrl = $ws_url; $this->wsUrl = $ws_url;
} }
/** /**
* Set the render object for set the output format. * Set the render object for set the output format.
* Set the Content-type for the http header. * Set the Content-type for the http header.
* *
* @param WebserviceOutputInterface $obj_render * @param WebserviceOutputInterface $obj_render
* @throw WebserviceException if the object render is not an instance of WebserviceOutputInterface * @throw WebserviceException if the object render is not an instance of WebserviceOutputInterface
* @return $this * @return $this
@@ -79,14 +79,14 @@ class WebserviceOutputBuilderCore
{ {
if (!$obj_render instanceof WebserviceOutputInterface) if (!$obj_render instanceof WebserviceOutputInterface)
throw new WebserviceException('Obj_render param must be an WebserviceOutputInterface object type', array(83, 500)); throw new WebserviceException('Obj_render param must be an WebserviceOutputInterface object type', array(83, 500));
$this->objectRender = $obj_render; $this->objectRender = $obj_render;
$this->objectRender->setWsUrl($this->wsUrl); $this->objectRender->setWsUrl($this->wsUrl);
if ($this->objectRender->getContentType()) if ($this->objectRender->getContentType())
$this->setHeaderParams('Content-Type', $this->objectRender->getContentType()); $this->setHeaderParams('Content-Type', $this->objectRender->getContentType());
return $this; return $this;
} }
/** /**
* getter * getter
* @return WebserviceOutputInterface * @return WebserviceOutputInterface
@@ -94,12 +94,12 @@ class WebserviceOutputBuilderCore
public function getObjectRender() public function getObjectRender()
{ {
return $this->objectRender; return $this->objectRender;
} }
/** /**
* Need to have the resource list to get the class name for an entity, * Need to have the resource list to get the class name for an entity,
* To build * To build
* *
* @param array $resources * @param array $resources
* @return $this * @return $this
*/ */
@@ -108,13 +108,13 @@ class WebserviceOutputBuilderCore
$this->wsResource = $resources; $this->wsResource = $resources;
return $this; return $this;
} }
/** /**
* This method return an array with each http header params for a content. * This method return an array with each http header params for a content.
* This check each required params. * This check each required params.
* *
* If this method is overrided don't forget to check required specific params (for xml etc...) * If this method is overrided don't forget to check required specific params (for xml etc...)
* *
* @return array * @return array
*/ */
public function buildHeader() public function buildHeader()
@@ -127,7 +127,7 @@ class WebserviceOutputBuilderCore
} }
return $return; return $return;
} }
/** /**
* @param $key The normalized key expected for an http response * @param $key The normalized key expected for an http response
* @param $value * @param $value
@@ -142,7 +142,7 @@ class WebserviceOutputBuilderCore
$this->headerParams[$key] = $value; $this->headerParams[$key] = $value;
return $this; return $this;
} }
/** /**
* @param null|string $key if null get all header params otherwise the params specified by the key * @param null|string $key if null get all header params otherwise the params specified by the key
* @throw WebserviceException if the key is corrupted (use Validate::isCleanHtml method) * @throw WebserviceException if the key is corrupted (use Validate::isCleanHtml method)
@@ -152,10 +152,10 @@ class WebserviceOutputBuilderCore
public function getHeaderParams($key = null) public function getHeaderParams($key = null)
{ {
$return = ''; $return = '';
if (!is_null($key)) if (!is_null($key))
{ {
if (!is_null($key) && Validate::isCleanHtml($key)) if (!Validate::isCleanHtml($key))
throw new WebserviceException('the key you write is a corrupted text.', array(95, 500)); throw new WebserviceException('the key you write is a corrupted text.', array(95, 500));
if (!array_key_exists($key, $this->headerParams)) if (!array_key_exists($key, $this->headerParams))
throw new WebserviceException(sprintf('The key %s does\'nt exist', $key), array(96, 500)); throw new WebserviceException(sprintf('The key %s does\'nt exist', $key), array(96, 500));
@@ -163,13 +163,13 @@ class WebserviceOutputBuilderCore
} }
else else
$return = $this->headerParams; $return = $this->headerParams;
return $return; return $return;
} }
/** /**
* Delete all Header parameters previously set. * Delete all Header parameters previously set.
* *
* @return $this * @return $this
*/ */
public function resetHeaderParams() public function resetHeaderParams()
@@ -177,7 +177,7 @@ class WebserviceOutputBuilderCore
$this->headerParams = array(); $this->headerParams = array();
return $this; return $this;
} }
/** /**
* @return string the normalized status for http request * @return string the normalized status for http request
*/ */
@@ -233,10 +233,10 @@ class WebserviceOutputBuilderCore
break; break;
} }
} }
/** /**
* Build errors output using an error array * Build errors output using an error array
* *
* @param array $errors * @param array $errors
* @return string output in the format specified by WebserviceOutputBuilder::objectRender * @return string output in the format specified by WebserviceOutputBuilder::objectRender
*/ */
@@ -264,7 +264,7 @@ class WebserviceOutputBuilderCore
} }
return $str_output; return $str_output;
} }
/** /**
* Build the resource list in the output format specified by WebserviceOutputBuilder::objectRender * Build the resource list in the output format specified by WebserviceOutputBuilder::objectRender
* @param $key_permissions * @param $key_permissions
@@ -290,11 +290,11 @@ class WebserviceOutputBuilderCore
'head' => (in_array('HEAD', $key_permissions[$resourceName]) ? 'true' : 'false'), 'head' => (in_array('HEAD', $key_permissions[$resourceName]) ? 'true' : 'false'),
); );
$output .= $this->objectRender->renderNodeHeader($resourceName, array(), $more_attr); $output .= $this->objectRender->renderNodeHeader($resourceName, array(), $more_attr);
$output .= $this->objectRender->renderNodeHeader('description', array(), $more_attr); $output .= $this->objectRender->renderNodeHeader('description', array(), $more_attr);
$output .= $resource['description']; $output .= $resource['description'];
$output .= $this->objectRender->renderNodeFooter('description', array()); $output .= $this->objectRender->renderNodeFooter('description', array());
if (!isset($resource['specific_management']) || !$resource['specific_management']) if (!isset($resource['specific_management']) || !$resource['specific_management'])
{ {
$more_attr_schema = array( $more_attr_schema = array(
@@ -322,8 +322,8 @@ class WebserviceOutputBuilderCore
* - list of entities, * - list of entities,
* - tree diagram of entity details (full or minimum), * - tree diagram of entity details (full or minimum),
* - schema (synopsis & blank), * - schema (synopsis & blank),
* *
* @param array $objects each object created by entity asked * @param array $objects each object created by entity asked
* @see WebserviceOutputBuilder::executeEntityGetAndHead * @see WebserviceOutputBuilder::executeEntityGetAndHead
* @param null|string $schema_to_display if null display the entities list or entity details. * @param null|string $schema_to_display if null display the entities list or entity details.
* @param string|array $fields_to_display the fields allow for the output * @param string|array $fields_to_display the fields allow for the output
@@ -336,22 +336,22 @@ class WebserviceOutputBuilderCore
$this->fieldsToDisplay = $fields_to_display; $this->fieldsToDisplay = $fields_to_display;
$this->depth = $depth; $this->depth = $depth;
$output = ''; $output = '';
if ($schema_to_display != null) if ($schema_to_display != null)
{ {
$this->schemaToDisplay = $schema_to_display; $this->schemaToDisplay = $schema_to_display;
$this->objectRender->setSchemaToDisplay($this->schemaToDisplay); $this->objectRender->setSchemaToDisplay($this->schemaToDisplay);
// If a shema is asked the view must be an details type // If a shema is asked the view must be an details type
$type_of_view = self::VIEW_DETAILS; $type_of_view = self::VIEW_DETAILS;
} }
$ws_params = $objects['empty']->getWebserviceParameters(); $ws_params = $objects['empty']->getWebserviceParameters();
// If a list is asked, need to wrap with a plural node // If a list is asked, need to wrap with a plural node
if ($type_of_view === self::VIEW_LIST) if ($type_of_view === self::VIEW_LIST)
$output .= $this->setIndent($depth).$this->objectRender->renderNodeHeader($ws_params['objectsNodeName'], $ws_params); $output .= $this->setIndent($depth).$this->objectRender->renderNodeHeader($ws_params['objectsNodeName'], $ws_params);
if (is_null($this->schemaToDisplay)) if (is_null($this->schemaToDisplay))
{ {
foreach ($objects as $key => $object) foreach ($objects as $key => $object)
@@ -369,11 +369,11 @@ class WebserviceOutputBuilderCore
{ {
$output .= $this->renderSchema($objects['empty'], $ws_params); $output .= $this->renderSchema($objects['empty'], $ws_params);
} }
// If a list is asked, need to wrap with a plural node // If a list is asked, need to wrap with a plural node
if ($type_of_view === self::VIEW_LIST) if ($type_of_view === self::VIEW_LIST)
$output .= $this->setIndent($depth).$this->objectRender->renderNodeFooter($ws_params['objectsNodeName'], $ws_params); $output .= $this->setIndent($depth).$this->objectRender->renderNodeFooter($ws_params['objectsNodeName'], $ws_params);
if ($override) if ($override)
$output = $this->objectRender->overrideContent($output); $output = $this->objectRender->overrideContent($output);
return $output; return $output;
@@ -381,7 +381,7 @@ class WebserviceOutputBuilderCore
/** /**
* Create the tree diagram with no details * Create the tree diagram with no details
* *
* @param $object create by the entity * @param $object create by the entity
* @param $depth the depth for the tree diagram * @param $depth the depth for the tree diagram
* @return string * @return string
@@ -397,7 +397,7 @@ class WebserviceOutputBuilderCore
/** /**
* Build a schema blank or synopsis * Build a schema blank or synopsis
* *
* @param $object create by the entity * @param $object create by the entity
* @param $ws_params webserviceParams from the entity * @param $ws_params webserviceParams from the entity
* @return string * @return string
@@ -420,7 +420,7 @@ class WebserviceOutputBuilderCore
/** /**
* Build the entity detail. * Build the entity detail.
* *
* @param ObjectModel $object create by the entity * @param ObjectModel $object create by the entity
* @param int $depth the depth for the tree diagram * @param int $depth the depth for the tree diagram
* @return string * @return string
@@ -430,14 +430,14 @@ class WebserviceOutputBuilderCore
$output = ''; $output = '';
$ws_params = $object->getWebserviceParameters(); $ws_params = $object->getWebserviceParameters();
$output .= $this->setIndent($depth).$this->objectRender->renderNodeHeader($ws_params['objectNodeName'], $ws_params); $output .= $this->setIndent($depth).$this->objectRender->renderNodeHeader($ws_params['objectNodeName'], $ws_params);
if ($object->id != 0) if ($object->id != 0)
{ {
// This to add virtual Fields for a particular entity. // This to add virtual Fields for a particular entity.
$virtual_fields = $this->addVirtualFields($ws_params['objectsNodeName'], $object); $virtual_fields = $this->addVirtualFields($ws_params['objectsNodeName'], $object);
if (!empty($virtual_fields)) if (!empty($virtual_fields))
$ws_params['fields'] = array_merge($ws_params['fields'], $virtual_fields); $ws_params['fields'] = array_merge($ws_params['fields'], $virtual_fields);
foreach ($ws_params['fields'] as $field_name => $field) foreach ($ws_params['fields'] as $field_name => $field)
{ {
if ($this->fieldsToDisplay === 'full' || array_key_exists($field_name, $this->fieldsToDisplay)) if ($this->fieldsToDisplay === 'full' || array_key_exists($field_name, $this->fieldsToDisplay))
@@ -468,7 +468,7 @@ class WebserviceOutputBuilderCore
/** /**
* Build a field and use recursivity depend on the depth parameter. * Build a field and use recursivity depend on the depth parameter.
* *
* @param ObjectModel $object create by the entity * @param ObjectModel $object create by the entity
* @param array $ws_params webserviceParams from the entity * @param array $ws_params webserviceParams from the entity
* @param string $field_name * @param string $field_name
@@ -480,7 +480,7 @@ class WebserviceOutputBuilderCore
{ {
$output = ''; $output = '';
$show_field = true; $show_field = true;
if (isset($ws_params['hidden_fields']) && in_array($field_name, $ws_params['hidden_fields'])) if (isset($ws_params['hidden_fields']) && in_array($field_name, $ws_params['hidden_fields']))
return; return;
@@ -489,9 +489,10 @@ class WebserviceOutputBuilderCore
$field['synopsis_details'] = $this->getSynopsisDetails($field); $field['synopsis_details'] = $this->getSynopsisDetails($field);
if ($field_name === 'id') if ($field_name === 'id')
$show_field = false; $show_field = false;
elseif (isset($field['setter']) && !$field['setter'])
$show_field = false;
} }
else if ($this->schemaToDisplay === 'blank')
if (isset($field['setter']) && !$field['setter'])
$show_field = false;
// don't set any value for a schema // don't set any value for a schema
if (isset($field['synopsis_details']) || $this->schemaToDisplay === 'blank') if (isset($field['synopsis_details']) || $this->schemaToDisplay === 'blank')
@@ -504,10 +505,10 @@ class WebserviceOutputBuilderCore
$field['value'] = $object->$field['getter'](); $field['value'] = $object->$field['getter']();
elseif (!isset($field['value'])) elseif (!isset($field['value']))
$field['value'] = $object->$field_name; $field['value'] = $object->$field_name;
// this apply specific function for a particular field on a choosen entity // this apply specific function for a particular field on a choosen entity
$field = $this->overrideSpecificField($ws_params['objectsNodeName'], $field_name, $field, $object, $ws_params); $field = $this->overrideSpecificField($ws_params['objectsNodeName'], $field_name, $field, $object, $ws_params);
// don't display informations for a not existant id // don't display informations for a not existant id
if (substr($field['sqlId'], 0, 3) == 'id_' && $field['value'] == 0) if (substr($field['sqlId'], 0, 3) == 'id_' && $field['value'] == 0)
{ {
@@ -519,8 +520,8 @@ class WebserviceOutputBuilderCore
// set "id" for each node name which display the id of the entity // set "id" for each node name which display the id of the entity
if ($field_name === 'id') if ($field_name === 'id')
$field['sqlId'] = 'id'; $field['sqlId'] = 'id';
// don't display the node id for a synopsis schema // don't display the node id for a synopsis schema
if ($show_field) if ($show_field)
$output .= $this->setIndent($depth-1).$this->objectRender->renderField($field); $output .= $this->setIndent($depth-1).$this->objectRender->renderField($field);
@@ -528,8 +529,8 @@ class WebserviceOutputBuilderCore
} }
/** /**
* *
* *
* @param $object * @param $object
* @param $depth * @param $depth
* @param $associations * @param $associations
@@ -545,17 +546,17 @@ class WebserviceOutputBuilderCore
{ {
$getter = $association['getter']; $getter = $association['getter'];
$objects_assoc = array(); $objects_assoc = array();
$fields_assoc = array(); $fields_assoc = array();
if (isset($association['fields'])) if (isset($association['fields']))
$fields_assoc = $association['fields']; $fields_assoc = $association['fields'];
$parent_details = array( $parent_details = array(
'object_id' => $object->id, 'object_id' => $object->id,
'entity_name' => $ws_params['objectNodeName'], 'entity_name' => $ws_params['objectNodeName'],
'entities_name' => $ws_params['objectsNodeName'], 'entities_name' => $ws_params['objectsNodeName'],
); );
if (method_exists($object, $getter) && is_null($this->schemaToDisplay)) if (method_exists($object, $getter) && is_null($this->schemaToDisplay))
{ {
$association_resources = $object->$getter(); $association_resources = $object->$getter();
@@ -571,7 +572,7 @@ class WebserviceOutputBuilderCore
{ {
$objects_assoc[] = ''; $objects_assoc[] = '';
} }
$class_name = null; $class_name = null;
if (isset($this->wsResource[$assoc_name]['class']) && class_exists($this->wsResource[$assoc_name]['class'], true)) if (isset($this->wsResource[$assoc_name]['class']) && class_exists($this->wsResource[$assoc_name]['class'], true))
$class_name = $this->wsResource[$assoc_name]['class']; $class_name = $this->wsResource[$assoc_name]['class'];
@@ -614,7 +615,7 @@ class WebserviceOutputBuilderCore
$output .= $this->objectRender->renderAssociationWrapperFooter(); $output .= $this->objectRender->renderAssociationWrapperFooter();
return $output; return $output;
} }
private function renderFlatAssociation($object, $depth, $assoc_name, $resource_name, $fields_assoc, $object_assoc, $parent_details) private function renderFlatAssociation($object, $depth, $assoc_name, $resource_name, $fields_assoc, $object_assoc, $parent_details)
{ {
$output = ''; $output = '';
@@ -627,7 +628,7 @@ class WebserviceOutputBuilderCore
$more_attr['xlink_resource'] = $this->wsUrl.$assoc_name.'/'.$object_assoc['id']; $more_attr['xlink_resource'] = $this->wsUrl.$assoc_name.'/'.$object_assoc['id'];
} }
$output .= $this->setIndent($depth-1).$this->objectRender->renderNodeHeader($resource_name, array(), $more_attr); $output .= $this->setIndent($depth-1).$this->objectRender->renderNodeHeader($resource_name, array(), $more_attr);
foreach ($fields_assoc as $field_name=>$field) foreach ($fields_assoc as $field_name=>$field)
{ {
if (!is_array($this->fieldsToDisplay) || in_array($field_name, $this->fieldsToDisplay[$assoc_name])) if (!is_array($this->fieldsToDisplay) || in_array($field_name, $this->fieldsToDisplay[$assoc_name]))
@@ -644,17 +645,17 @@ class WebserviceOutputBuilderCore
} }
$field['entities_name'] = $assoc_name; $field['entities_name'] = $assoc_name;
$field['entity_name'] = $resource_name; $field['entity_name'] = $resource_name;
if (!is_null($this->schemaToDisplay)) if (!is_null($this->schemaToDisplay))
$field['synopsis_details'] = $this->getSynopsisDetails($field); $field['synopsis_details'] = $this->getSynopsisDetails($field);
$output .= $this->setIndent($depth-1).$this->objectRender->renderField($field); $output .= $this->setIndent($depth-1).$this->objectRender->renderField($field);
} }
} }
$output .= $this->setIndent($depth-1).$this->objectRender->renderNodeFooter($resource_name, array()); $output .= $this->setIndent($depth-1).$this->objectRender->renderNodeFooter($resource_name, array());
return $output; return $output;
} }
public function setIndent($depth) public function setIndent($depth)
{ {
$string = ''; $string = '';
@@ -663,7 +664,7 @@ class WebserviceOutputBuilderCore
$string .= "\t"; $string .= "\t";
return $string; return $string;
} }
public function getSynopsisDetails($field) public function getSynopsisDetails($field)
{ {
$arr_details = ''; $arr_details = '';
@@ -675,9 +676,9 @@ class WebserviceOutputBuilderCore
$arr_details['format'] = $field['validateMethod']; $arr_details['format'] = $field['validateMethod'];
return $arr_details; return $arr_details;
} }
/** /**
* *
* @param string|object $object * @param string|object $object
* @param string $method * @param string $method
* @return $this * @return $this
@@ -689,9 +690,9 @@ class WebserviceOutputBuilderCore
} catch (WebserviceException $e) { } catch (WebserviceException $e) {
throw $e; throw $e;
} }
$this->specificFields[$field_name] = array('entity'=>$entity_name, 'object' => $object, 'method' => $method, 'type' => gettype($object)); $this->specificFields[$field_name] = array('entity'=>$entity_name, 'object' => $object, 'method' => $method, 'type' => gettype($object));
return $this; return $this;
} }
private function validateObjectAndMethod($object, $method) private function validateObjectAndMethod($object, $method)
{ {
@@ -712,7 +713,7 @@ class WebserviceOutputBuilderCore
$object = new $this->specificFields[$field_name]['object'](); $object = new $this->specificFields[$field_name]['object']();
elseif ($this->specificFields[$field_name]['type'] == 'object') elseif ($this->specificFields[$field_name]['type'] == 'object')
$object= $this->specificFields[$field_name]['object']; $object= $this->specificFields[$field_name]['object'];
$field = $object->{$this->specificFields[$field_name]['method']}($field, $entity_object, $ws_params); $field = $object->{$this->specificFields[$field_name]['method']}($field, $entity_object, $ws_params);
} }
return $field; return $field;
@@ -724,7 +725,7 @@ class WebserviceOutputBuilderCore
} catch (WebserviceException $e) { } catch (WebserviceException $e) {
throw $e; throw $e;
} }
$this->virtualFields[$entity_name][] = array('parameters' => $parameters, 'object' => $object, 'method' => $method, 'type' => gettype($object)); $this->virtualFields[$entity_name][] = array('parameters' => $parameters, 'object' => $object, 'method' => $method, 'type' => gettype($object));
} }
public function getVirtualFields() public function getVirtualFields()
@@ -743,7 +744,7 @@ class WebserviceOutputBuilderCore
$object = new $function_infos['object'](); $object = new $function_infos['object']();
elseif ($function_infos['type'] == 'object') elseif ($function_infos['type'] == 'object')
$object= $function_infos['object']; $object= $function_infos['object'];
$return_fields = $object->{$function_infos['method']}($entity_object, $function_infos['parameters']); $return_fields = $object->{$function_infos['method']}($entity_object, $function_infos['parameters']);
foreach ($return_fields as $field_name => $value) foreach ($return_fields as $field_name => $value)
{ {
@@ -756,7 +757,7 @@ class WebserviceOutputBuilderCore
} }
return $arr_return; return $arr_return;
} }
public function setFieldsToDisplay($fields) public function setFieldsToDisplay($fields)
{ {
$this->fieldsToDisplay = $fields; $this->fieldsToDisplay = $fields;
+148 -147
View File
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2010 PrestaShop * 2007-2010 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -28,173 +28,173 @@
class WebserviceRequestCore class WebserviceRequestCore
{ {
protected $_available_languages = null; protected $_available_languages = null;
/** /**
* Errors triggered at execution * Errors triggered at execution
* @var array * @var array
*/ */
public $errors = array(); public $errors = array();
/** /**
* Set if return should display content or not * Set if return should display content or not
* @var boolean * @var boolean
*/ */
protected $_outputEnabled = true; protected $_outputEnabled = true;
/** /**
* Set if the management is specific or if it is classic (entity management) * Set if the management is specific or if it is classic (entity management)
* @var boolean * @var boolean
*/ */
protected $objectSpecificManagement = false; protected $objectSpecificManagement = false;
/** /**
* Base PrestaShop webservice URL * Base PrestaShop webservice URL
* @var string * @var string
*/ */
public $wsUrl; public $wsUrl;
/** /**
* PrestaShop Webservice Documentation URL * PrestaShop Webservice Documentation URL
* @var string * @var string
*/ */
protected $_docUrl = 'http://prestashop.com/docs/1.4/webservice'; protected $_docUrl = 'http://prestashop.com/docs/1.4/webservice';
/** /**
* Set if the authentication key was checked * Set if the authentication key was checked
* @var boolean * @var boolean
*/ */
protected $_authenticated = false; protected $_authenticated = false;
/** /**
* HTTP Method to support * HTTP Method to support
* @var string * @var string
*/ */
public $method; public $method;
/** /**
* The segment of the URL * The segment of the URL
* @var array * @var array
*/ */
public $urlSegment = array(); public $urlSegment = array();
/** /**
* The segment list of the URL after the "api" segment * The segment list of the URL after the "api" segment
* @var array * @var array
*/ */
public $urlFragments = array(); public $urlFragments = array();
/** /**
* The time in microseconds of the start of the execution of the web service request * The time in microseconds of the start of the execution of the web service request
* @var int * @var int
*/ */
protected $_startTime = 0; protected $_startTime = 0;
/** /**
* The list of each resources manageable via web service * The list of each resources manageable via web service
* @var array * @var array
*/ */
public $resourceList; public $resourceList;
/** /**
* The configuration parameters of the current resource * The configuration parameters of the current resource
* @var array * @var array
*/ */
public $resourceConfiguration; public $resourceConfiguration;
/** /**
* The permissions for the current key * The permissions for the current key
* @var array * @var array
*/ */
public $keyPermissions; public $keyPermissions;
/** /**
* The XML string to display if web service call succeed * The XML string to display if web service call succeed
* @var string * @var string
*/ */
protected $specificOutput = ''; protected $specificOutput = '';
/** /**
* The list of objects to display * The list of objects to display
* @var array * @var array
*/ */
public $objects; public $objects;
/** /**
* The current object to support, it extends the PrestaShop ObjectModel * The current object to support, it extends the PrestaShop ObjectModel
* @var ObjectModel * @var ObjectModel
*/ */
protected $_object; protected $_object;
/** /**
* The schema to display. * The schema to display.
* If null, no schema have to be displayed and normal management has to be performed * If null, no schema have to be displayed and normal management has to be performed
* @var string * @var string
*/ */
public $schemaToDisplay; public $schemaToDisplay;
/** /**
* The fields to display. These fields will be displayed when retrieving objects * The fields to display. These fields will be displayed when retrieving objects
* @var string * @var string
*/ */
public $fieldsToDisplay = 'minimum'; public $fieldsToDisplay = 'minimum';
/** /**
* If we are in PUT or POST case, we use this attribute to store the xml string value during process * If we are in PUT or POST case, we use this attribute to store the xml string value during process
* @var string * @var string
*/ */
protected $_inputXml; protected $_inputXml;
/** /**
* Object instance for singleton * Object instance for singleton
* @var WebserviceRequest * @var WebserviceRequest
*/ */
protected static $_instance; protected static $_instance;
/** /**
* Key used for authentication * Key used for authentication
* @var string * @var string
*/ */
protected $_key; protected $_key;
/** /**
* This is used to have a deeper tree diagram. * This is used to have a deeper tree diagram.
* @var int * @var int
*/ */
public $depth = 0; public $depth = 0;
/** /**
* Name of the output format * Name of the output format
* @var string * @var string
*/ */
protected $outputFormat = 'xml'; protected $outputFormat = 'xml';
/** /**
* The object to build the output. * The object to build the output.
* @var WebserviceOutputBuilder * @var WebserviceOutputBuilder
*/ */
protected $objOutput; protected $objOutput;
/** /**
* Save the class name for override used in getInstance() * Save the class name for override used in getInstance()
* @var ws_current_classname * @var ws_current_classname
*/ */
public static $ws_current_classname; public static $ws_current_classname;
public static $shopIDs; public static $shopIDs;
public function getOutputEnabled() public function getOutputEnabled()
{ {
return $this->_outputEnabled; return $this->_outputEnabled;
} }
public function setOutputEnabled($bool) public function setOutputEnabled($bool)
{ {
if (Validate::isBool($bool)) if (Validate::isBool($bool))
$this->_outputEnabled = $bool; $this->_outputEnabled = $bool;
return $this; return $this;
} }
/** /**
* Get WebserviceRequest object instance (Singleton) * Get WebserviceRequest object instance (Singleton)
* *
@@ -206,7 +206,7 @@ class WebserviceRequestCore
self::$_instance = new WebserviceRequest::$ws_current_classname(); self::$_instance = new WebserviceRequest::$ws_current_classname();
return self::$_instance; return self::$_instance;
} }
protected function getOutputObject($type) protected function getOutputObject($type)
{ {
switch ($type) switch ($type)
@@ -218,7 +218,7 @@ class WebserviceRequestCore
} }
return $obj_render; return $obj_render;
} }
public static function getResources() public static function getResources()
{ {
$resources = array( $resources = array(
@@ -262,16 +262,17 @@ class WebserviceRequestCore
'stock_movement_reasons' => array('description' => 'The stock movement reason', 'class' => 'StockMvtReason'), 'stock_movement_reasons' => array('description' => 'The stock movement reason', 'class' => 'StockMvtReason'),
'shops' => array('description' => 'Shops from multi-shop feature', 'class' => 'Shop'), 'shops' => array('description' => 'Shops from multi-shop feature', 'class' => 'Shop'),
'shop_groups' => array('description' => 'Shop groups from multi-shop feature', 'class' => 'GroupShop'), 'shop_groups' => array('description' => 'Shop groups from multi-shop feature', 'class' => 'GroupShop'),
'taxes' => array('description' => 'The tax rate', 'class' => 'Tax'),
); );
ksort($resources); ksort($resources);
return $resources; return $resources;
} }
// @todo Check how get parameters // @todo Check how get parameters
// @todo : set this method out // @todo : set this method out
/** /**
* This method is used for calculate the price for products on the output details * This method is used for calculate the price for products on the output details
* *
* @param $field * @param $field
* @param $entity_object * @param $entity_object
* @param $ws_params * @param $ws_params
@@ -286,11 +287,11 @@ class WebserviceRequestCore
} }
return $field; return $field;
} }
// @todo : set this method out // @todo : set this method out
/** /**
* This method is used for calculate the price for products on a virtual fields * This method is used for calculate the price for products on a virtual fields
* *
* @param $entity_object * @param $entity_object
* @param array $parameters * @param array $parameters
* @return array * @return array
@@ -318,12 +319,12 @@ class WebserviceRequestCore
$decimals = (isset($value['decimals']) ? $value['decimals'] : Configuration::get('PS_PRICE_ROUND_MODE')); $decimals = (isset($value['decimals']) ? $value['decimals'] : Configuration::get('PS_PRICE_ROUND_MODE'));
$id_product_attribute = (isset($value['product_attribute']) ? $value['product_attribute'] : null); $id_product_attribute = (isset($value['product_attribute']) ? $value['product_attribute'] : null);
$id_county = (isset($value['county']) ? $value['county'] : null); $id_county = (isset($value['county']) ? $value['county'] : null);
$only_reduc = (isset($value['only_reduction']) ? $value['only_reduction'] : false); $only_reduc = (isset($value['only_reduction']) ? $value['only_reduction'] : false);
$use_reduc = (isset($value['use_reduction']) ? $value['use_reduction'] : true); $use_reduc = (isset($value['use_reduction']) ? $value['use_reduction'] : true);
$use_ecotax = (isset($value['use_ecotax']) ? $value['use_ecotax'] : Configuration::get('PS_USE_ECOTAX')); $use_ecotax = (isset($value['use_ecotax']) ? $value['use_ecotax'] : Configuration::get('PS_USE_ECOTAX'));
$specific_price_output = null; $specific_price_output = null;
$return_value = Product::priceCalculation(null, $value['object_id'], $id_product_attribute, $id_country, $id_state, $id_county, $id_currency, $id_group, $quantity, $return_value = Product::priceCalculation(null, $value['object_id'], $id_product_attribute, $id_country, $id_state, $id_county, $id_currency, $id_group, $quantity,
$use_tax, $decimals, $only_reduc, $use_reduc, $use_ecotax, $specific_price_output, null); $use_tax, $decimals, $only_reduc, $use_reduc, $use_ecotax, $specific_price_output, null);
$arr_return[$name] = array('sqlId'=>strtolower($name), 'value'=>$return_value); $arr_return[$name] = array('sqlId'=>strtolower($name), 'value'=>$return_value);
} }
@@ -332,7 +333,7 @@ class WebserviceRequestCore
// @todo : set this method out // @todo : set this method out
/** /**
* This method is used for calculate the price for products on a virtual fields * This method is used for calculate the price for products on a virtual fields
* *
* @param $entity_object * @param $entity_object
* @param array $parameters * @param array $parameters
* @return array * @return array
@@ -347,7 +348,7 @@ class WebserviceRequestCore
$arr_return = $this->specificPriceCalculation($parameters); $arr_return = $this->specificPriceCalculation($parameters);
return $arr_return; return $arr_return;
} }
/** /**
* Start Webservice request * Start Webservice request
* Check webservice activation * Check webservice activation
@@ -356,7 +357,7 @@ class WebserviceRequestCore
* Check HTTP Method * Check HTTP Method
* Execute the action * Execute the action
* Display the result * Display the result
* *
* @param string $key * @param string $key
* @param string $method * @param string $method
* @param string $url * @param string $url
@@ -370,7 +371,7 @@ class WebserviceRequestCore
// Time logger // Time logger
$this->_startTime = microtime(true); $this->_startTime = microtime(true);
$this->objects = array(); $this->objects = array();
// Two global vars, for compatibility with the PS core... // Two global vars, for compatibility with the PS core...
global $webservice_call, $display_errors; global $webservice_call, $display_errors;
$webservice_call = true; $webservice_call = true;
@@ -379,13 +380,13 @@ class WebserviceRequestCore
$this->wsUrl = Tools::getHttpHost(true).__PS_BASE_URI__; $this->wsUrl = Tools::getHttpHost(true).__PS_BASE_URI__;
// set the output object which manage the content and header structure and informations // set the output object which manage the content and header structure and informations
$this->objOutput = new WebserviceOutputBuilder($this->wsUrl); $this->objOutput = new WebserviceOutputBuilder($this->wsUrl);
// Error handler // Error handler
set_error_handler(array($this, 'webserviceErrorHandler')); set_error_handler(array($this, 'webserviceErrorHandler'));
ini_set('html_errors', 'off'); ini_set('html_errors', 'off');
$this->_key = trim($key); $this->_key = trim($key);
$this->outputFormat = isset($params['output_format']) ? $params['output_format'] : $this->outputFormat; $this->outputFormat = isset($params['output_format']) ? $params['output_format'] : $this->outputFormat;
// Set the render object to build the output on the asked format (XML, JSON, CSV, ...) // Set the render object to build the output on the asked format (XML, JSON, CSV, ...)
$this->objOutput->setObjectRender($this->getOutputObject($this->outputFormat)); $this->objOutput->setObjectRender($this->getOutputObject($this->outputFormat));
@@ -400,8 +401,8 @@ class WebserviceRequestCore
$this->urlFragments = $params; $this->urlFragments = $params;
$this->_inputXml = $inputXml; $this->_inputXml = $inputXml;
$this->depth = isset($this->urlFragments['depth']) ? (int)$this->urlFragments['depth'] : $this->depth; $this->depth = isset($this->urlFragments['depth']) ? (int)$this->urlFragments['depth'] : $this->depth;
try { try {
// Method below set a particular fonction to use on the price field for products entity // Method below set a particular fonction to use on the price field for products entity
// @see WebserviceRequest::getPriceForProduct() method // @see WebserviceRequest::getPriceForProduct() method
@@ -415,7 +416,7 @@ class WebserviceRequestCore
} catch (Exception $e) { } catch (Exception $e) {
$this->setError(500, $e->getMessage(), $e->getCode()); $this->setError(500, $e->getMessage(), $e->getCode());
} }
if (isset($this->urlFragments['language'])) if (isset($this->urlFragments['language']))
$this->_available_languages = $this->filterLanguage(); $this->_available_languages = $this->filterLanguage();
else else
@@ -423,25 +424,25 @@ class WebserviceRequestCore
foreach (Language::getLanguages() as $key=>$language) foreach (Language::getLanguages() as $key=>$language)
$this->_available_languages[] = $language['id_lang']; $this->_available_languages[] = $language['id_lang'];
} }
if (empty($this->_available_languages)) if (empty($this->_available_languages))
$this->setError(400, 'language is not available', 81); $this->setError(400, 'language is not available', 81);
// Need to set available languages for the render object. // Need to set available languages for the render object.
// Thus we can filter i18n field for the output // Thus we can filter i18n field for the output
// @see WebserviceOutputXML::renderField() method for example // @see WebserviceOutputXML::renderField() method for example
$this->objOutput->objectRender->setLanguages($this->_available_languages); $this->objOutput->objectRender->setLanguages($this->_available_languages);
// check method and resource // check method and resource
if (empty($this->errors) && $this->checkResource() && $this->checkHTTPMethod()) if (empty($this->errors) && $this->checkResource() && $this->checkHTTPMethod())
{ {
// The resource list is necessary for build the output // The resource list is necessary for build the output
$this->objOutput->setWsResources($this->resourceList); $this->objOutput->setWsResources($this->resourceList);
// if the resource is a core entity... // if the resource is a core entity...
if (!isset($this->resourceList[$this->urlSegment[0]]['specific_management']) || !$this->resourceList[$this->urlSegment[0]]['specific_management']) if (!isset($this->resourceList[$this->urlSegment[0]]['specific_management']) || !$this->resourceList[$this->urlSegment[0]]['specific_management'])
{ {
// load resource configuration // load resource configuration
if ($this->urlSegment[0] != '') if ($this->urlSegment[0] != '')
{ {
@@ -472,7 +473,7 @@ class WebserviceRequestCore
$this->executeEntityDelete(); $this->executeEntityDelete();
break; break;
} }
// Need to set an object for the WebserviceOutputBuilder object in any case // Need to set an object for the WebserviceOutputBuilder object in any case
// because schema need to get webserviceParameters of this object // because schema need to get webserviceParameters of this object
if (isset($object)) if (isset($object))
$this->objects['empty'] = $object; $this->objects['empty'] = $object;
@@ -489,7 +490,7 @@ class WebserviceRequestCore
$this->objectSpecificManagement = new $specificObjectName(); $this->objectSpecificManagement = new $specificObjectName();
$this->objectSpecificManagement->setObjectOutput($this->objOutput) $this->objectSpecificManagement->setObjectOutput($this->objOutput)
->setWsObject($this); ->setWsObject($this);
try { try {
$this->objectSpecificManagement->manage(); $this->objectSpecificManagement->manage();
} catch (WebserviceException $e) { } catch (WebserviceException $e) {
@@ -506,8 +507,8 @@ class WebserviceRequestCore
unset($webservice_call); unset($webservice_call);
unset ($display_errors); unset ($display_errors);
} }
/** /**
* Set a webservice error * Set a webservice error
* *
@@ -522,7 +523,7 @@ class WebserviceRequestCore
$this->objOutput->setStatus($status); $this->objOutput->setStatus($status);
$this->errors[] = $display_errors ? array($code, $label) : 'Internal error. To see this error please display the PHP errors.'; $this->errors[] = $display_errors ? array($code, $label) : 'Internal error. To see this error please display the PHP errors.';
} }
/** /**
* Set a webservice error and propose a new value near from the available values * Set a webservice error and propose a new value near from the available values
* *
@@ -537,7 +538,7 @@ class WebserviceRequestCore
{ {
$this->setError($num, $label.'. Did you mean: "'.$this->getClosest($value, $available_values).'"?'.(count($available_values) > 1 ? ' The full list is: "'.implode('", "', $available_values).'"' : ''), $code); $this->setError($num, $label.'. Did you mean: "'.$this->getClosest($value, $available_values).'"?'.(count($available_values) > 1 ? ' The full list is: "'.implode('", "', $available_values).'"' : ''), $code);
} }
/** /**
* Return the nearest value picked in the values list * Return the nearest value picked in the values list
* *
@@ -565,9 +566,9 @@ class WebserviceRequestCore
} }
return $closest; return $closest;
} }
/** /**
* Used to replace the default PHP error handler, in order to display PHP errors in a XML format * Used to replace the default PHP error handler, in order to display PHP errors in a XML format
* *
* @param string $errno contains the level of the error raised, as an integer * @param string $errno contains the level of the error raised, as an integer
* @param array $errstr contains the error message, as a string * @param array $errstr contains the error message, as a string
@@ -579,7 +580,7 @@ class WebserviceRequestCore
{ {
if (!(error_reporting() & $errno)) if (!(error_reporting() & $errno))
return; return;
switch($errno) switch($errno)
{ {
case E_ERROR: case E_ERROR:
@@ -626,7 +627,7 @@ class WebserviceRequestCore
} }
return true; return true;
} }
/** /**
* Check if there is one or more error * Check if there is one or more error
* *
@@ -636,7 +637,7 @@ class WebserviceRequestCore
{ {
return (boolean)$this->errors; return (boolean)$this->errors;
} }
/** /**
* Check request authentication * Check request authentication
* *
@@ -675,7 +676,7 @@ class WebserviceRequestCore
{ {
$this->setError(401, 'Authentification key is not active', 20); $this->setError(401, 'Authentification key is not active', 20);
} }
if (!$this->keyPermissions) if (!$this->keyPermissions)
{ {
$this->setError(401, 'No permission for this authentication key', 21); $this->setError(401, 'No permission for this authentication key', 21);
@@ -696,7 +697,7 @@ class WebserviceRequestCore
} }
} }
} }
/** /**
* Check webservice activation * Check webservice activation
* *
@@ -711,7 +712,7 @@ class WebserviceRequestCore
} }
return true; return true;
} }
protected function shopHasRight($key) protected function shopHasRight($key)
{ {
$sql = 'SELECT 1 $sql = 'SELECT 1
@@ -727,7 +728,7 @@ class WebserviceRequestCore
} }
return true; return true;
} }
protected function shopExists($params) protected function shopExists($params)
{ {
// Case no shop specified // Case no shop specified
@@ -736,7 +737,7 @@ class WebserviceRequestCore
self::$shopIDs[] = Configuration::get('PS_SHOP_DEFAULT'); self::$shopIDs[] = Configuration::get('PS_SHOP_DEFAULT');
return true; return true;
} }
if ($params['id_shop'][0] == '[' && $params['id_shop'][strlen($params['id_shop']) - 1] == ']') if ($params['id_shop'][0] == '[' && $params['id_shop'][strlen($params['id_shop']) - 1] == ']')
$shops = explode(',', substr($params['id_shop'], 1, strlen($params['id_shop']) - 2)); $shops = explode(',', substr($params['id_shop'], 1, strlen($params['id_shop']) - 2));
else else
@@ -767,7 +768,7 @@ class WebserviceRequestCore
$this->setError(404, 'This shop id doesn\'t exist', 129); $this->setError(404, 'This shop id doesn\'t exist', 129);
return false; return false;
} }
/** /**
* Check HTTP method * Check HTTP method
* *
@@ -785,7 +786,7 @@ class WebserviceRequestCore
return true; return true;
return false; return false;
} }
/** /**
* Check resource validity * Check resource validity
* *
@@ -812,8 +813,8 @@ class WebserviceRequestCore
} }
return true; return true;
} }
protected function setObjects() protected function setObjects()
{ {
$objects = array(); $objects = array();
@@ -840,18 +841,18 @@ class WebserviceRequestCore
$objects[] = $object; $objects[] = $object;
} }
} }
if (!empty($arr_avoid_id) || empty($ids)) if (!empty($arr_avoid_id) || empty($ids))
{ {
$this->setError(404, 'Id(s) not exists: '.implode(', ', $arr_avoid_id), 87); $this->setError(404, 'Id(s) not exists: '.implode(', ', $arr_avoid_id), 87);
$this->_outputEnabled = true; $this->_outputEnabled = true;
} }
else else
{ {
} }
} }
protected function parseDisplayFields($str) protected function parseDisplayFields($str)
{ {
$bracket_level = 0; $bracket_level = 0;
@@ -891,7 +892,7 @@ class WebserviceRequestCore
} }
return $fields; return $fields;
} }
public function setFieldsToDisplay() public function setFieldsToDisplay()
{ {
// set the fields to display in the list : "full", "minimum", "field_1", "field_1,field_2,field_3" // set the fields to display in the list : "full", "minimum", "field_1", "field_1,field_2,field_3"
@@ -943,7 +944,7 @@ class WebserviceRequestCore
} }
return true; return true;
} }
protected function manageFilters() protected function manageFilters()
{ {
// filtered fields which can not use filters : hidden_fields // filtered fields which can not use filters : hidden_fields
@@ -953,12 +954,12 @@ class WebserviceRequestCore
foreach ($this->resourceConfiguration['fields'] as $fieldName => $field) foreach ($this->resourceConfiguration['fields'] as $fieldName => $field)
if ((!isset($this->resourceConfiguration['hidden_fields']) || if ((!isset($this->resourceConfiguration['hidden_fields']) ||
(isset($this->resourceConfiguration['hidden_fields']) && !in_array($fieldName, $this->resourceConfiguration['hidden_fields'])))) (isset($this->resourceConfiguration['hidden_fields']) && !in_array($fieldName, $this->resourceConfiguration['hidden_fields']))))
if ((!isset($field['i18n']) || if ((!isset($field['i18n']) ||
(isset($field['i18n']) && !$field['i18n']))) (isset($field['i18n']) && !$field['i18n'])))
$available_filters[] = $fieldName; $available_filters[] = $fieldName;
else else
$i18n_available_filters[] = $fieldName; $i18n_available_filters[] = $fieldName;
// Date feature : date=1 // Date feature : date=1
if (!empty($this->urlFragments['date']) && $this->urlFragments['date']) if (!empty($this->urlFragments['date']) && $this->urlFragments['date'])
{ {
@@ -1011,7 +1012,7 @@ class WebserviceRequestCore
{ {
// contruct SQL join for linked tables // contruct SQL join for linked tables
$sql_join .= 'LEFT JOIN `'._DB_PREFIX_.pSQL($this->resourceConfiguration['linked_tables'][$field]['table']).'` '.pSQL($field).' ON (main.`'.pSQL($this->resourceConfiguration['fields']['id']['sqlId']).'` = '.pSQL($field).'.`'.pSQL($this->resourceConfiguration['fields']['id']['sqlId']).'`)'."\n"; $sql_join .= 'LEFT JOIN `'._DB_PREFIX_.pSQL($this->resourceConfiguration['linked_tables'][$field]['table']).'` '.pSQL($field).' ON (main.`'.pSQL($this->resourceConfiguration['fields']['id']['sqlId']).'` = '.pSQL($field).'.`'.pSQL($this->resourceConfiguration['fields']['id']['sqlId']).'`)'."\n";
// construct SQL filter for linked tables // construct SQL filter for linked tables
foreach ($url_param as $field2 => $value) foreach ($url_param as $field2 => $value)
{ {
@@ -1081,7 +1082,7 @@ class WebserviceRequestCore
} }
} }
} }
if (!$this->setFieldsToDisplay()) if (!$this->setFieldsToDisplay())
return false; return false;
// construct SQL Sort // construct SQL Sort
@@ -1093,7 +1094,7 @@ class WebserviceRequestCore
$sorts = explode(',', $matches[1]); $sorts = explode(',', $matches[1]);
else else
$sorts = array($this->urlFragments['sort']); $sorts = array($this->urlFragments['sort']);
$sql_sort .= ' ORDER BY '; $sql_sort .= ' ORDER BY ';
foreach ($sorts as $sort) foreach ($sorts as $sort)
{ {
@@ -1147,12 +1148,12 @@ class WebserviceRequestCore
$filters['sql_filter'] = $sql_filter; $filters['sql_filter'] = $sql_filter;
$filters['sql_sort'] = $sql_sort; $filters['sql_sort'] = $sql_sort;
$filters['sql_limit'] = $sql_limit; $filters['sql_limit'] = $sql_limit;
return $filters; return $filters;
} }
public function getFilteredObjectList() public function getFilteredObjectList()
{ {
$objects = array(); $objects = array();
@@ -1162,7 +1163,7 @@ class WebserviceRequestCore
$this->resourceConfiguration['retrieveData']['params'][] = $filters['sql_sort']; $this->resourceConfiguration['retrieveData']['params'][] = $filters['sql_sort'];
$this->resourceConfiguration['retrieveData']['params'][] = $filters['sql_limit']; $this->resourceConfiguration['retrieveData']['params'][] = $filters['sql_limit'];
//list entities //list entities
$tmp = new $this->resourceConfiguration['retrieveData']['className'](); $tmp = new $this->resourceConfiguration['retrieveData']['className']();
$sqlObjects = call_user_func_array(array($tmp, $this->resourceConfiguration['retrieveData']['retrieveMethod']), $this->resourceConfiguration['retrieveData']['params']); $sqlObjects = call_user_func_array(array($tmp, $this->resourceConfiguration['retrieveData']['retrieveMethod']), $this->resourceConfiguration['retrieveData']['params']);
if ($sqlObjects) if ($sqlObjects)
@@ -1174,13 +1175,13 @@ class WebserviceRequestCore
return $objects; return $objects;
} }
} }
public function getFilteredObjectDetails() public function getFilteredObjectDetails()
{ {
$objects = array(); $objects = array();
if (!isset($this->urlFragments['display'])) if (!isset($this->urlFragments['display']))
$this->fieldsToDisplay = 'full'; $this->fieldsToDisplay = 'full';
// Check if Object is accessible for this/those id_shop // Check if Object is accessible for this/those id_shop
$assoc = Shop::getAssoTables(); $assoc = Shop::getAssoTables();
if (array_key_exists($this->resourceConfiguration['retrieveData']['table'] ,$assoc)) if (array_key_exists($this->resourceConfiguration['retrieveData']['table'] ,$assoc))
@@ -1207,15 +1208,15 @@ class WebserviceRequestCore
return false; return false;
} }
} }
/** /**
* Execute GET and HEAD requests * Execute GET and HEAD requests
* *
* Build filter * Build filter
* Build fields display * Build fields display
* Build sort * Build sort
* Build limit * Build limit
* *
* @return boolean * @return boolean
*/ */
public function executeEntityGetAndHead() public function executeEntityGetAndHead()
@@ -1226,7 +1227,7 @@ class WebserviceRequestCore
$return = $this->getFilteredObjectList(); $return = $this->getFilteredObjectList();
else else
$return = $this->getFilteredObjectDetails(); $return = $this->getFilteredObjectDetails();
if (!$return) if (!$return)
return false; return false;
else else
@@ -1234,20 +1235,20 @@ class WebserviceRequestCore
} }
return true; return true;
} }
/** /**
* Execute POST method on a PrestaShop entity * Execute POST method on a PrestaShop entity
* *
* @return boolean * @return boolean
*/ */
protected function executeEntityPost() protected function executeEntityPost()
{ {
return $this->saveEntityFromXml(201); return $this->saveEntityFromXml(201);
} }
/** /**
* Execute PUT method on a PrestaShop entity * Execute PUT method on a PrestaShop entity
* *
* @return boolean * @return boolean
*/ */
protected function executeEntityPut() protected function executeEntityPut()
@@ -1255,13 +1256,13 @@ class WebserviceRequestCore
return $this->saveEntityFromXml(200); return $this->saveEntityFromXml(200);
} }
/** /**
* Execute DELETE method on a PrestaShop entity * Execute DELETE method on a PrestaShop entity
* *
* @return boolean * @return boolean
*/ */
protected function executeEntityDelete() protected function executeEntityDelete()
@@ -1290,13 +1291,13 @@ class WebserviceRequestCore
$objects[] = $object; $objects[] = $object;
} }
} }
if (!empty($arr_avoid_id) || empty($ids)) if (!empty($arr_avoid_id) || empty($ids))
{ {
$this->setError(404, 'Id(s) not exists: '.implode(', ', $arr_avoid_id), 87); $this->setError(404, 'Id(s) not exists: '.implode(', ', $arr_avoid_id), 87);
$this->_outputEnabled = true; $this->_outputEnabled = true;
} }
else else
{ {
$assoc = Shop::getAssoTables(); $assoc = Shop::getAssoTables();
foreach ($objects as $object) foreach ($objects as $object)
@@ -1305,12 +1306,12 @@ class WebserviceRequestCore
$result = $object->{$this->resourceConfiguration['objectMethods']['delete']}(); $result = $object->{$this->resourceConfiguration['objectMethods']['delete']}();
else else
$result = $object->delete(); $result = $object->delete();
if (!$result) if (!$result)
$arr_avoid_id[] = $object->id; $arr_avoid_id[] = $object->id;
elseif (array_key_exists($this->resourceConfiguration['retrieveData']['table'] ,$assoc)) elseif (array_key_exists($this->resourceConfiguration['retrieveData']['table'] ,$assoc))
{ {
$sql = 'DELETE FROM `'._DB_PREFIX_.$this->resourceConfiguration['retrieveData']['table'].'_'.$assoc[$this->resourceConfiguration['retrieveData']['table']]['type'].'` $sql = 'DELETE FROM `'._DB_PREFIX_.$this->resourceConfiguration['retrieveData']['table'].'_'.$assoc[$this->resourceConfiguration['retrieveData']['table']]['type'].'`
WHERE '.$this->resourceConfiguration['fields']['id']['sqlId'].' = '.$object->id; WHERE '.$this->resourceConfiguration['fields']['id']['sqlId'].' = '.$object->id;
Db::getInstance()->Execute($sql); Db::getInstance()->Execute($sql);
} }
@@ -1326,16 +1327,16 @@ class WebserviceRequestCore
} }
} }
} }
/** /**
* Write XML output after GET and HEAD action * Write XML output after GET and HEAD action
* *
* @return void * @return void
*/ */
/** /**
* save Entity Object from XML * save Entity Object from XML
* *
* @param int $successReturnCode * @param int $successReturnCode
* @return boolean * @return boolean
*/ */
@@ -1352,9 +1353,9 @@ class WebserviceRequestCore
} }
$xmlEntities = $xml->children(); $xmlEntities = $xml->children();
$object = null; $object = null;
$ids = array(); $ids = array();
foreach ($xmlEntities as $entity) foreach ($xmlEntities as $entity)
{ {
// To cast in string allow to check null values // To cast in string allow to check null values
if ((string)$entity->id != '') if ((string)$entity->id != '')
@@ -1380,11 +1381,11 @@ class WebserviceRequestCore
$this->setError(400, 'id is forbidden when adding a new resource', 91); $this->setError(400, 'id is forbidden when adding a new resource', 91);
return false; return false;
} }
foreach ($xmlEntities as $xmlEntity) foreach ($xmlEntities as $xmlEntity)
{ {
$attributes = $xmlEntity->children(); $attributes = $xmlEntity->children();
if ($this->method == 'POST') if ($this->method == 'POST')
$object = new $this->resourceConfiguration['retrieveData']['className'](); $object = new $this->resourceConfiguration['retrieveData']['className']();
elseif ($this->method == 'PUT') elseif ($this->method == 'PUT')
@@ -1402,7 +1403,7 @@ class WebserviceRequestCore
foreach ($this->resourceConfiguration['fields'] as $fieldName => $fieldProperties) foreach ($this->resourceConfiguration['fields'] as $fieldName => $fieldProperties)
{ {
$sqlId = $fieldProperties['sqlId']; $sqlId = $fieldProperties['sqlId'];
if ($fieldName == 'id') if ($fieldName == 'id')
$sqlId = $fieldName; $sqlId = $fieldName;
if (isset($attributes->$fieldName) && isset($fieldProperties['sqlId']) && (!isset($fieldProperties['i18n']) || !$fieldProperties['i18n'])) if (isset($attributes->$fieldName) && isset($fieldProperties['sqlId']) && (!isset($fieldProperties['i18n']) || !$fieldProperties['i18n']))
@@ -1423,7 +1424,7 @@ class WebserviceRequestCore
$object->$sqlId = (string)$attributes->$fieldName; $object->$sqlId = (string)$attributes->$fieldName;
else else
$this->setError(400, 'Parameter "'.$fieldName.'" can\'t be set to the object "'.$this->resourceConfiguration['retrieveData']['className'].'"', 123); $this->setError(400, 'Parameter "'.$fieldName.'" can\'t be set to the object "'.$this->resourceConfiguration['retrieveData']['className'].'"', 123);
} }
elseif (isset($fieldProperties['required']) && $fieldProperties['required'] && !$fieldProperties['i18n']) elseif (isset($fieldProperties['required']) && $fieldProperties['required'] && !$fieldProperties['i18n'])
{ {
@@ -1432,7 +1433,7 @@ class WebserviceRequestCore
} }
elseif ((!isset($fieldProperties['required']) || !$fieldProperties['required']) && Tools::property_exists($object, $sqlId)) elseif ((!isset($fieldProperties['required']) || !$fieldProperties['required']) && Tools::property_exists($object, $sqlId))
$object->$sqlId = null; $object->$sqlId = null;
if (isset($fieldProperties['i18n']) && $fieldProperties['i18n']) if (isset($fieldProperties['i18n']) && $fieldProperties['i18n'])
{ {
$i18n = true; $i18n = true;
@@ -1440,7 +1441,7 @@ class WebserviceRequestCore
$object->{$fieldName}[(int)$lang->attributes()->id] = (string)$lang; $object->{$fieldName}[(int)$lang->attributes()->id] = (string)$lang;
} }
} }
if (!$this->hasErrors()) if (!$this->hasErrors())
{ {
if ($i18n && ($retValidateFieldsLang = $object->validateFieldsLang(false, true)) !== true) if ($i18n && ($retValidateFieldsLang = $object->validateFieldsLang(false, true)) !== true)
@@ -1512,10 +1513,10 @@ class WebserviceRequestCore
return true; return true;
} }
} }
/** /**
* get SQL retrieve Filter * get SQL retrieve Filter
* *
* @param string $sqlId * @param string $sqlId
* @param string $filterValue * @param string $filterValue
* @param string $tableAlias = 'main.' * @param string $tableAlias = 'main.'
@@ -1565,7 +1566,7 @@ class WebserviceRequestCore
$ret .= ' AND '.$tableAlias.'`'.pSQL($sqlId).'` '.(Validate::isFloat(pSQL($filterValue)) ? 'LIKE' : '=').' "'.pSQL($filterValue)."\"\n"; $ret .= ' AND '.$tableAlias.'`'.pSQL($sqlId).'` '.(Validate::isFloat(pSQL($filterValue)) ? 'LIKE' : '=').' "'.pSQL($filterValue)."\"\n";
return $ret; return $ret;
} }
public function filterLanguage() public function filterLanguage()
{ {
$arr_languages = array(); $arr_languages = array();
@@ -1617,40 +1618,40 @@ class WebserviceRequestCore
$this->setError(400, 'Language ID must be numeric', 80); $this->setError(400, 'Language ID must be numeric', 80);
return false; return false;
} }
foreach ($arr_languages as $key=>$id_lang) foreach ($arr_languages as $key=>$id_lang)
if (!Language::getLanguage($id_lang)) if (!Language::getLanguage($id_lang))
unset($arr_languages[$key]); unset($arr_languages[$key]);
return $arr_languages; return $arr_languages;
} }
/** /**
* Thanks to the (WebserviceOutputBuilder) WebserviceKey::objOutput * Thanks to the (WebserviceOutputBuilder) WebserviceKey::objOutput
* Method build the output depend on the WebserviceRequest::outputFormat * Method build the output depend on the WebserviceRequest::outputFormat
* and set HTTP header parameters. * and set HTTP header parameters.
* *
* @return array with displaying informations (used in the dispatcher). * @return array with displaying informations (used in the dispatcher).
*/ */
protected function returnOutput() protected function returnOutput()
{ {
$return = array(); $return = array();
// write headers // write headers
$this->objOutput->setHeaderParams('Access-Time', time()) $this->objOutput->setHeaderParams('Access-Time', time())
->setHeaderParams('X-Powered-By', 'PrestaShop Webservice') ->setHeaderParams('X-Powered-By', 'PrestaShop Webservice')
->setHeaderParams('PSWS-Version', _PS_VERSION_) ->setHeaderParams('PSWS-Version', _PS_VERSION_)
->setHeaderParams('Execution-Time', round(microtime(true) - $this->_startTime,3)); ->setHeaderParams('Execution-Time', round(microtime(true) - $this->_startTime,3));
$return['type'] = strtolower($this->outputFormat); $return['type'] = strtolower($this->outputFormat);
// write this header only now (avoid hackers happiness...) // write this header only now (avoid hackers happiness...)
if ($this->_authenticated) if ($this->_authenticated)
{ {
$this->objOutput->setHeaderParams('PSWS-Version', _PS_VERSION_); $this->objOutput->setHeaderParams('PSWS-Version', _PS_VERSION_);
} }
// If Specific Management is asked // If Specific Management is asked
if ($this->objectSpecificManagement instanceof WebserviceSpecificManagementInterface) if ($this->objectSpecificManagement instanceof WebserviceSpecificManagementInterface)
{ {
@@ -1663,7 +1664,7 @@ class WebserviceRequestCore
$this->setError($e->getStatus(), $e->getMessage(), $e->getCode()); $this->setError($e->getStatus(), $e->getMessage(), $e->getCode());
} }
} }
// for use a general output // for use a general output
if (!$this->hasErrors() && $this->objectSpecificManagement == null) if (!$this->hasErrors() && $this->objectSpecificManagement == null)
{ {
@@ -1685,13 +1686,13 @@ class WebserviceRequestCore
$type_of_view = WebserviceOutputBuilder::VIEW_DETAILS; $type_of_view = WebserviceOutputBuilder::VIEW_DETAILS;
else else
$type_of_view = WebserviceOutputBuilder::VIEW_LIST; $type_of_view = WebserviceOutputBuilder::VIEW_LIST;
if (in_array($this->method, array('PUT', 'POST'))) if (in_array($this->method, array('PUT', 'POST')))
{ {
$type_of_view = WebserviceOutputBuilder::VIEW_DETAILS; $type_of_view = WebserviceOutputBuilder::VIEW_DETAILS;
$this->fieldsToDisplay = 'full'; $this->fieldsToDisplay = 'full';
} }
$return['content'] = $this->objOutput->getContent($this->objects, $this->schemaToDisplay, $this->fieldsToDisplay, $this->depth, $type_of_view); $return['content'] = $this->objOutput->getContent($this->objects, $this->schemaToDisplay, $this->fieldsToDisplay, $this->depth, $type_of_view);
} catch (WebserviceException $e) { } catch (WebserviceException $e) {
if ($e->getType() == WebserviceException::DID_YOU_MEAN) if ($e->getType() == WebserviceException::DID_YOU_MEAN)
@@ -1703,7 +1704,7 @@ class WebserviceRequestCore
} }
} }
} }
// if the output is not enable, delete the content // if the output is not enable, delete the content
// the type content too // the type content too
if (!$this->_outputEnabled) if (!$this->_outputEnabled)
@@ -1713,18 +1714,18 @@ class WebserviceRequestCore
if (isset($return['content'])) if (isset($return['content']))
unset($return['content']); unset($return['content']);
} }
elseif (isset($return['content'])) elseif (isset($return['content']))
$this->objOutput->setHeaderParams('Content-Sha1', sha1($return['content'])); $this->objOutput->setHeaderParams('Content-Sha1', sha1($return['content']));
// if errors happends when creating returned xml, // if errors happends when creating returned xml,
// the usual xml content is replaced by the nice error handler content // the usual xml content is replaced by the nice error handler content
if ($this->hasErrors()) if ($this->hasErrors())
{ {
$this->_outputEnabled = true; $this->_outputEnabled = true;
$return['content'] = $this->objOutput->getErrors($this->errors); $return['content'] = $this->objOutput->getErrors($this->errors);
} }
if (!isset($return['content']) || strlen($return['content']) <= 0) if (!isset($return['content']) || strlen($return['content']) <= 0)
{ {
$this->objOutput->setHeaderParams('Content-Type', ''); $this->objOutput->setHeaderParams('Content-Type', '');
+1
View File
@@ -0,0 +1 @@
Allow from ALL
+4
View File
@@ -0,0 +1,4 @@
ID;Alias*;Active (0/1);Customer e-mail;Manufacturer;Supplier;Company;Lastname*;Firstname*;Address 1*;Address 2;Postcode* / Zipcode*;City*;Country*;State;Other;Phone;Mobile Phone;VAT number
1;My Adress;1;johndoe@prestashop.com;;;;Doe;John;16, Main street;2nd floor;75000;PARIS ;France;;;140138844;;
2;My work;1;johndoe@prestashop.com;;;My Company;Doe;John;535, Baker street;;13000;Marseile;France;;;235445588;;
3;My work;0;;Apple Computer, Inc;;;Jobs;Steve;1 Infinite Loop;;95014;CUPERTINO;United States;California;;(800) 275-2273;;
1 ID Alias* Active (0/1) Customer e-mail Manufacturer Supplier Company Lastname* Firstname* Address 1* Address 2 Postcode* / Zipcode* City* Country* State Other Phone Mobile Phone VAT number
2 1 My Adress 1 johndoe@prestashop.com Doe John 16, Main street 2nd floor 75000 PARIS France 140138844
3 2 My work 1 johndoe@prestashop.com My Company Doe John 535, Baker street 13000 Marseile France 235445588
4 3 My work 0 Apple Computer, Inc Jobs Steve 1 Infinite Loop 95014 CUPERTINO United States California (800) 275-2273
+4
View File
@@ -0,0 +1,4 @@
ID;Active (0/1);Name*;Parent Category;Description;Meta-title;Meta-keywords;Meta-description;URL rewritten;Image URL
2;1;iPods;Home;Now that you can buy movies from the iTunes Store and sync them to your iPod, the whole world is your theater.;;;;music-ipods;http://youlinktotheimage.com/img1000.jpg
3;1;Accessories;Home;Wonderful accessories for your iPod;;;;accessories-ipod;http://youlinktotheimage.com/img1001.jpg
4;1;Laptops;Home;The latest Intel processor, a bigger hard drive, plenty of memory, and even more new features all fit inside just one liberating inch. The new Mac laptops have the performance, power, and connectivity of a desktop computer. Without the desk part.;Apple laptops;Apple laptops MacBook Air;Powerful and chic Apple laptops;laptops;http://youlinktotheimage.com/img1002.jpg
1 ID Active (0/1) Name* Parent Category Description Meta-title Meta-keywords Meta-description URL rewritten Image URL
2 2 1 iPods Home Now that you can buy movies from the iTunes Store and sync them to your iPod, the whole world is your theater. music-ipods http://youlinktotheimage.com/img1000.jpg
3 3 1 Accessories Home Wonderful accessories for your iPod accessories-ipod http://youlinktotheimage.com/img1001.jpg
4 4 1 Laptops Home The latest Intel processor, a bigger hard drive, plenty of memory, and even more new features all fit inside just one liberating inch. The new Mac laptops have the performance, power, and connectivity of a desktop computer. Without the desk part. Apple laptops Apple laptops MacBook Air Powerful and chic Apple laptops laptops http://youlinktotheimage.com/img1002.jpg
+3
View File
@@ -0,0 +1,3 @@
Product ID*;Options (Group:Value)*;Reference;Supplier reference;EAN13;UPC;Wholesale price;Price;Ecotax;Quantity;Weight;Default
1;"Color:Blue, Disk Space:16GO;";958456;254644;;;;41;;50;;
1;"Color:pINK, Disk Space:8GO;";958456;254644;;;;;;;;
1 Product ID* Options (Group:Value)* Reference Supplier reference EAN13 UPC Wholesale price Price Ecotax Quantity Weight Default
2 1 Color:Blue, Disk Space:16GO; 958456 254644 41 50
3 1 Color:pINK, Disk Space:8GO; 958456 254644
+3
View File
@@ -0,0 +1,3 @@
ID;Active (0/1);Gender ID (Mr=1, Ms=2, else 9);E-mail*;Password*;Birthday;Lastname*;Firstname*;Newletter (0/1);Opt-in (0/1)
1;1;1;johndoe@prestashop.com;#res152EDRF;sous quelle forme ? ;Doe;John;1;1
2;1;2;mariedoe@prestashop.com;58@ret26#;sous quelle forme ? ;Doe;Marie;0;1
1 ID Active (0/1) Gender ID (Mr=1, Ms=2, else 9) E-mail* Password* Birthday Lastname* Firstname* Newletter (0/1) Opt-in (0/1)
2 1 1 1 johndoe@prestashop.com #res152EDRF sous quelle forme ? Doe John 1 1
3 2 1 2 mariedoe@prestashop.com 58@ret26# sous quelle forme ? Doe Marie 0 1
+3
View File
@@ -0,0 +1,3 @@
ID;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description
1;1;Apple Computer, Inc;;;;;
2;1;Shure Incorporated;;;;;
1 ID Active (0/1) Name* Description Short description Meta-title Meta-keywords Meta-description
2 1 1 Apple Computer, Inc
3 2 1 Shure Incorporated
+3
View File
@@ -0,0 +1,3 @@
ID;Active (0/1);Name*;Categories (x,y,z,...);Price tax excl. Or Price tax excl;Tax rules id;Wholesale price;On sale (0/1);Discount amount;Discount percent;Discount from (yyy-mm-dd);Discount to (yyy-mm-dd);Reference #;Supplier reference #;Supplier;Manufacturer;EAN13;UPC;Ecotax;Weight;Quantity;Short description;Description;Tags (x,y,z,...);Meta-title;Meta-keywords;Meta-description;URL rewritten;Text when in-stock;Text if back-order allowed;Image URLs (x,y,z,...);Feature;Only available online
1;1;iPod Nano;Home, iPods;49;1;;1;;;;;92458844;54778855;AppleStore;Apple Computer, Inc;;;;0.5;800;New design. New features. Now i….;Curved ahead of the curve. For those about to rock, we give you nine amazing colors. But that's only part of the story. Feel the curved, all-aluminum and glass de...;apple, ipod, nano;;;;ipod-nano;In stock;;http://youdomain.com/img.jpg, http://yourdomain.com/img1.jpg;;
2;1;iPod shuffle;Home, iPods;66.05;1;79;1;;;;;92458845;54778855;AppleStore;Apple Computer, Inc;;;;0;500;iPod shuffle, the world’s most wearabl….;;ipod, shuffle;;;;ipod-shuffle;In stock;;http://youdomain.com/img25.jpg, http://yourdomain.com/img30.jpg;;
1 ID Active (0/1) Name* Categories (x,y,z,...) Price tax excl. Or Price tax excl Tax rules id Wholesale price On sale (0/1) Discount amount Discount percent Discount from (yyy-mm-dd) Discount to (yyy-mm-dd) Reference # Supplier reference # Supplier Manufacturer EAN13 UPC Ecotax Weight Quantity Short description Description Tags (x,y,z,...) Meta-title Meta-keywords Meta-description URL rewritten Text when in-stock Text if back-order allowed Image URLs (x,y,z,...) Feature Only available online
2 1 1 iPod Nano Home, iPods 49 1 1 92458844 54778855 AppleStore Apple Computer, Inc 0.5 800 New design. New features. Now i…. Curved ahead of the curve. For those about to rock, we give you nine amazing colors. But that's only part of the story. Feel the curved, all-aluminum and glass de... apple, ipod, nano ipod-nano In stock http://youdomain.com/img.jpg, http://yourdomain.com/img1.jpg
3 2 1 iPod shuffle Home, iPods 66.05 1 79 1 92458845 54778855 AppleStore Apple Computer, Inc 0 500 iPod shuffle, the world’s most wearabl…. ipod, shuffle ipod-shuffle In stock http://youdomain.com/img25.jpg, http://yourdomain.com/img30.jpg
+3
View File
@@ -0,0 +1,3 @@
ID;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description
1;1;Applestore;;;;;
2;1;Shure Online Store;;;;;
1 ID Active (0/1) Name* Description Short description Meta-title Meta-keywords Meta-description
2 1 1 Applestore
3 2 1 Shure Online Store
+1 -1
View File
@@ -730,7 +730,7 @@ if ($lm->getIncludeTradFilename())
</div> </div>
</div> </div>
<div id="benefitsBlock"> <div id="benefitsBlock" style="display: none;">
<!-- Partner Modules --> <!-- Partner Modules -->
<?php <?php
if (!isset($_GET['language'])) if (!isset($_GET['language']))
+8 -1
View File
@@ -1315,7 +1315,6 @@ State:name
Country:name Country:name
phone' where `id_country`=10; phone' where `id_country`=10;
INSERT INTO `PREFIX_gender` (`id_gender`, `type`) VALUES INSERT INTO `PREFIX_gender` (`id_gender`, `type`) VALUES
(1, 0), (1, 0),
(2, 1), (2, 1),
@@ -1337,3 +1336,11 @@ INSERT INTO `PREFIX_gender_lang` (`id_gender`, `id_lang`, `name`) VALUES
(3, 3, 'Miss'), (3, 3, 'Miss'),
(3, 4, 'Miss'), (3, 4, 'Miss'),
(3, 5, 'Miss'); (3, 5, 'Miss');
UPDATE `PREFIX_address_format` set `format` = 'firstname lastname
company
address1
address2
city State:name postcode
Country:name
phone' WHERE `PREFIX_address_format`.`id_country` =4;
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<localizationPack name="Canada" version="1.0"> <localizationPack name="Canada" version="1.0">
<currencies> <currencies>
<currency name="Dollar" iso_code="CAD" iso_code_num="124" sign="$" blank="0" conversion_rate="1.40054" format="1" decimals="1" /> <currency name="Dollar (CAD)" iso_code="CAD" iso_code_num="124" sign="CAD$" blank="0" conversion_rate="1.40054" format="1" decimals="1" />
</currencies> </currencies>
<languages> <languages>
<language iso_code="fr" /> <language iso_code="fr" />
+1 -38
View File
@@ -1427,46 +1427,9 @@ $this->standalone = true;
} }
} }
if ($this->apacheModExists('evasive')) if (Tools::apacheModExists('evasive'))
sleep(1); sleep(1);
} }
/**
* apacheModExists return true if the apache module $name is loaded
* @TODO move this method in class Information (when it will exist)
*
* @param string $name module name
* @return boolean true if exists
*/
function apacheModExists($name)
{
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)
{
if (strpos($module, $name)!==false)
return true;
}
}
else{
// If apache_get_modules does not exists,
// one solution should be parsing httpd.conf,
// but we could simple parse phpinfo(INFO_MODULES) return string
ob_start();
phpinfo(INFO_MODULES);
$phpinfo = ob_get_contents();
ob_end_clean();
if (strpos($phpinfo, $module) !== false)
return true;
}
return false;
}
private function _getJsErrorMsgs() private function _getJsErrorMsgs()
{ {
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+29
View File
@@ -87,6 +87,7 @@ function initSliders()
function initLayered() function initLayered()
{ {
initSliders(); initSliders();
initLocationChange();
if (window.location.href.split('#').length == 2 && window.location.href.split('#')[1] != '') if (window.location.href.split('#').length == 2 && window.location.href.split('#')[1] != '')
{ {
var params = window.location.href.split('#')[1]; var params = window.location.href.split('#')[1];
@@ -312,3 +313,31 @@ function reloadContent(params_plus)
}); });
ajaxQueries.push(ajaxQuery); ajaxQueries.push(ajaxQuery);
} }
function initLocationChange(func, time) {
if(!time) time = 500;
var currLoc = '';
setInterval(function()
{
if(window.location.href != currLoc)
{
currLoc = window.location.href;
// Don't reload page if current_friendly_url and real url match
if (window.location.href.split('#').length == 2 && window.location.href.split('#')[1] != '')
current_url = '#'+window.location.href.split('#')[1];
else
current_url = '';
if (current_friendly_url.replace(/^#(\/)?/, '') == current_url.replace(/^#(\/)?/, ''))
return;
if (window.location.href.split('#').length == 2 && window.location.href.split('#')[1] != '')
{
var params = window.location.href.split('#')[1];
reloadContent('&selected_filters='+params);
}
else
reloadContent('&selected_filters=#');
}
}, time);
}
+13 -13
View File
@@ -484,7 +484,7 @@ class BlockLayered extends Module
$id_lang = (int)$language['id_lang']; $id_lang = (int)$language['id_lang'];
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_feature_lang Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_feature_lang
VALUES ('.(int)$params['id_feature'].', '.$id_lang.', \''.Tools::link_rewrite(Tools::getValue('url_name_'.$id_lang)).'\', VALUES ('.(int)$params['id_feature'].', '.$id_lang.', \''.Tools::link_rewrite(Tools::getValue('url_name_'.$id_lang)).'\',
\''.pSQL(htmlspecialchars(Tools::getValue('meta_title_'.$id_lang))).'\')'); \''.pSQL(Tools::safeOutput(Tools::getValue('meta_title_'.$id_lang), true)).'\')');
} }
} }
@@ -500,7 +500,7 @@ class BlockLayered extends Module
$id_lang = (int)$language['id_lang']; $id_lang = (int)$language['id_lang'];
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_feature_value_lang Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_feature_value_lang
VALUES ('.(int)$params['id_feature_value'].', '.$id_lang.', \''.Tools::link_rewrite(Tools::getValue('url_name_'.$id_lang)).'\', VALUES ('.(int)$params['id_feature_value'].', '.$id_lang.', \''.Tools::link_rewrite(Tools::getValue('url_name_'.$id_lang)).'\',
\''.pSQL(htmlspecialchars(Tools::getValue('meta_title_'.$id_lang))).'\')'); \''.pSQL(Tools::safeOutput(Tools::getValue('meta_title_'.$id_lang), true)).'\')');
} }
} }
@@ -537,7 +537,7 @@ class BlockLayered extends Module
foreach ($languages as $language) foreach ($languages as $language)
$return .= ' $return .= '
<div id="url_name_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $default_form_language ? 'block' : 'none').'; float: left;"> <div id="url_name_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $default_form_language ? 'block' : 'none').'; float: left;">
<input size="33" type="text" name="url_name_'.$language['id_lang'].'" value="'.htmlspecialchars(@$langValue[$language['id_lang']]['url_name']).'" /> <input size="33" type="text" name="url_name_'.$language['id_lang'].'" value="'.Tools::safeOutput(@$langValue[$language['id_lang']]['url_name'], true).'" />
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}_<span class="hint-pointer">&nbsp;</span></span> <span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}_<span class="hint-pointer">&nbsp;</span></span>
<p style="clear: both">'.$this->l('Specific format in url block layered generation').'</p> <p style="clear: both">'.$this->l('Specific format in url block layered generation').'</p>
</div>'; </div>';
@@ -550,7 +550,7 @@ class BlockLayered extends Module
foreach ($languages as $language) foreach ($languages as $language)
$return .= ' $return .= '
<div id="meta_title_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $default_form_language ? 'block' : 'none').'; float: left;"> <div id="meta_title_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $default_form_language ? 'block' : 'none').'; float: left;">
<input size="33" type="text" name="meta_title_'.$language['id_lang'].'" value="'.htmlspecialchars(@$langValue[$language['id_lang']]['meta_title']).'" /> <input size="33" type="text" name="meta_title_'.$language['id_lang'].'" value="'.Tools::safeOutput(@$langValue[$language['id_lang']]['meta_title'], true).'" />
<p style="clear: both">'.$this->l('Specific format for meta title').'</p> <p style="clear: both">'.$this->l('Specific format for meta title').'</p>
</div>'; </div>';
$return .= $this->displayFlags($languages, $default_form_language, 'flag_fields', 'meta_title', true, true); $return .= $this->displayFlags($languages, $default_form_language, 'flag_fields', 'meta_title', true, true);
@@ -572,7 +572,7 @@ class BlockLayered extends Module
$id_lang = (int)$language['id_lang']; $id_lang = (int)$language['id_lang'];
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_attribute_lang Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_attribute_lang
VALUES ('.(int)$params['id_attribute'].', '.$id_lang.', \''.Tools::link_rewrite(Tools::getValue('url_name_'.$id_lang)).'\', VALUES ('.(int)$params['id_attribute'].', '.$id_lang.', \''.Tools::link_rewrite(Tools::getValue('url_name_'.$id_lang)).'\',
\''.pSQL(htmlspecialchars(Tools::getValue('meta_title_'.$id_lang))).'\')'); \''.pSQL(Tools::safeOutput(Tools::getValue('meta_title_'.$id_lang), true)).'\')');
} }
} }
@@ -609,7 +609,7 @@ class BlockLayered extends Module
foreach ($languages as $language) foreach ($languages as $language)
$return .= ' $return .= '
<div id="url_name_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $default_form_language ? 'block' : 'none').'; float: left;"> <div id="url_name_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $default_form_language ? 'block' : 'none').'; float: left;">
<input size="33" type="text" name="url_name_'.$language['id_lang'].'" value="'.htmlspecialchars(@$langValue[$language['id_lang']]['url_name']).'" /> <input size="33" type="text" name="url_name_'.$language['id_lang'].'" value="'.Tools::safeOutput(@$langValue[$language['id_lang']]['url_name'], true).'" />
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}_<span class="hint-pointer">&nbsp;</span></span> <span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}_<span class="hint-pointer">&nbsp;</span></span>
<p style="clear: both">'.$this->l('Specific format in url block layered generation').'</p> <p style="clear: both">'.$this->l('Specific format in url block layered generation').'</p>
</div>'; </div>';
@@ -622,7 +622,7 @@ class BlockLayered extends Module
foreach ($languages as $language) foreach ($languages as $language)
$return .= ' $return .= '
<div id="meta_title_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $default_form_language ? 'block' : 'none').'; float: left;"> <div id="meta_title_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $default_form_language ? 'block' : 'none').'; float: left;">
<input size="33" type="text" name="meta_title_'.$language['id_lang'].'" value="'.htmlspecialchars(@$langValue[$language['id_lang']]['meta_title']).'" /> <input size="33" type="text" name="meta_title_'.$language['id_lang'].'" value="'.Tools::safeOutput(@$langValue[$language['id_lang']]['meta_title'], true).'" />
<p style="clear: both">'.$this->l('Specific format for meta title').'</p> <p style="clear: both">'.$this->l('Specific format for meta title').'</p>
</div>'; </div>';
$return .= $this->displayFlags($languages, $default_form_language, 'flag_fields', 'meta_title', true, true); $return .= $this->displayFlags($languages, $default_form_language, 'flag_fields', 'meta_title', true, true);
@@ -659,7 +659,7 @@ class BlockLayered extends Module
$id_lang = (int)$language['id_lang']; $id_lang = (int)$language['id_lang'];
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_attribute_group_lang Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'layered_indexable_attribute_group_lang
VALUES ('.(int)$params['id_attribute_group'].', '.$id_lang.', \''.Tools::link_rewrite(Tools::getValue('url_name_'.$id_lang)).'\', VALUES ('.(int)$params['id_attribute_group'].', '.$id_lang.', \''.Tools::link_rewrite(Tools::getValue('url_name_'.$id_lang)).'\',
\''.pSQL(htmlspecialchars(Tools::getValue('meta_title_'.$id_lang))).'\')'); \''.pSQL(Tools::safeOutput(Tools::getValue('meta_title_'.$id_lang), true)).'\')');
} }
} }
@@ -722,7 +722,7 @@ class BlockLayered extends Module
foreach ($languages as $language) foreach ($languages as $language)
$return .= ' $return .= '
<div id="url_name_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $default_form_language ? 'block' : 'none').'; float: left;"> <div id="url_name_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $default_form_language ? 'block' : 'none').'; float: left;">
<input size="33" type="text" name="url_name_'.$language['id_lang'].'" value="'.htmlspecialchars(@$langValue[$language['id_lang']]['url_name']).'" /> <input size="33" type="text" name="url_name_'.$language['id_lang'].'" value="'.Tools::safeOutput(@$langValue[$language['id_lang']]['url_name'], true).'" />
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}_<span class="hint-pointer">&nbsp;</span></span> <span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}_<span class="hint-pointer">&nbsp;</span></span>
<p style="clear: both">'.$this->l('Specific format in url block layered generation').'</p> <p style="clear: both">'.$this->l('Specific format in url block layered generation').'</p>
</div>'; </div>';
@@ -735,7 +735,7 @@ class BlockLayered extends Module
foreach ($languages as $language) foreach ($languages as $language)
$return .= ' $return .= '
<div id="meta_title_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $default_form_language ? 'block' : 'none').'; float: left;"> <div id="meta_title_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $default_form_language ? 'block' : 'none').'; float: left;">
<input size="33" type="text" name="meta_title_'.$language['id_lang'].'" value="'.htmlspecialchars(@$langValue[$language['id_lang']]['meta_title']).'" /> <input size="33" type="text" name="meta_title_'.$language['id_lang'].'" value="'.Tools::safeOutput(@$langValue[$language['id_lang']]['meta_title'], true).'" />
<p style="clear: both">'.$this->l('Specific format for meta title').'</p> <p style="clear: both">'.$this->l('Specific format for meta title').'</p>
</div>'; </div>';
$return .= $this->displayFlags($languages, $default_form_language, 'flag_fields', 'meta_title', true, true); $return .= $this->displayFlags($languages, $default_form_language, 'flag_fields', 'meta_title', true, true);
@@ -782,7 +782,7 @@ class BlockLayered extends Module
foreach ($languages as $language) foreach ($languages as $language)
$return .= ' $return .= '
<div id="url_name_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $default_form_language ? 'block' : 'none').'; float: left;"> <div id="url_name_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $default_form_language ? 'block' : 'none').'; float: left;">
<input size="33" type="text" name="url_name_'.$language['id_lang'].'" value="'.htmlspecialchars(@$langValue[$language['id_lang']]['url_name']).'" /> <input size="33" type="text" name="url_name_'.$language['id_lang'].'" value="'.Tools::safeOutput(@$langValue[$language['id_lang']]['url_name'], true).'" />
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}_<span class="hint-pointer">&nbsp;</span></span> <span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}_<span class="hint-pointer">&nbsp;</span></span>
<p style="clear: both">'.$this->l('Specific format in url block layered generation').'</p> <p style="clear: both">'.$this->l('Specific format in url block layered generation').'</p>
</div>'; </div>';
@@ -795,7 +795,7 @@ class BlockLayered extends Module
foreach ($languages as $language) foreach ($languages as $language)
$return .= ' $return .= '
<div id="meta_title_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $default_form_language ? 'block' : 'none').'; float: left;"> <div id="meta_title_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $default_form_language ? 'block' : 'none').'; float: left;">
<input size="33" type="text" name="meta_title_'.$language['id_lang'].'" value="'.htmlspecialchars(@$langValue[$language['id_lang']]['meta_title']).'" /> <input size="33" type="text" name="meta_title_'.$language['id_lang'].'" value="'.Tools::safeOutput(@$langValue[$language['id_lang']]['meta_title'], true).'" />
<p style="clear: both">'.$this->l('Specific format for meta title').'</p> <p style="clear: both">'.$this->l('Specific format for meta title').'</p>
</div>'; </div>';
$return .= $this->displayFlags($languages, $default_form_language, 'flag_fields', 'meta_title', true, true); $return .= $this->displayFlags($languages, $default_form_language, 'flag_fields', 'meta_title', true, true);
@@ -1732,7 +1732,7 @@ class BlockLayered extends Module
if(Tools::getValue('selected_filters')) if(Tools::getValue('selected_filters'))
$url = Tools::getValue('selected_filters'); $url = Tools::getValue('selected_filters');
else else
$url = preg_replace('/\/(?:\w*)\/(?:[0-9]+[-\w]*)([^\?]*)\??.*/', '$1', Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI'])); $url = preg_replace('/\/(?:\w*)\/(?:[0-9]+[-\w]*)([^\?]*)\??.*/', '$1', Tools::safeOutput($_SERVER['REQUEST_URI'], true));
$urlAttributes = explode('/',$url); $urlAttributes = explode('/',$url);
array_shift($urlAttributes); array_shift($urlAttributes);
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
-1
View File
@@ -6,7 +6,6 @@
<description><![CDATA[Open your shop on the eBay market place !]]></description> <description><![CDATA[Open your shop on the eBay market place !]]></description>
<author><![CDATA[PrestaShop]]></author> <author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[market_place]]></tab> <tab><![CDATA[market_place]]></tab>
<confirmUninstall>Are you sure you want uninstall this module ? All your configuration will be lost.</confirmUninstall>
<is_configurable>1</is_configurable> <is_configurable>1</is_configurable>
<need_instance>1</need_instance> <need_instance>1</need_instance>
<limited_countries></limited_countries> <limited_countries></limited_countries>
+1 -1
View File
@@ -915,7 +915,7 @@ class Ebay extends Module
// Load categories only if necessary // Load categories only if necessary
if (Db::getInstance()->getValue('SELECT COUNT(`id_ebay_category_configuration`) FROM `'._DB_PREFIX_.'ebay_category_configuration`') > 4 && Tools::getValue('section') != 'category') if (Db::getInstance()->getValue('SELECT COUNT(`id_ebay_category_configuration`) FROM `'._DB_PREFIX_.'ebay_category_configuration`') > 4 && Tools::getValue('section') != 'category')
return '<p align="center"><b>'.$this->l('Your categories have already been configured.').'</b></p> return '<p align="center"><b>'.$this->l('Your categories have already been configured.').'</b></p>
<form action="index.php?tab='.$_GET['tab'].'&configure='.$_GET['configure'].'&token='.$_GET['token'].'&tab_module='.$_GET['tab_module'].'&module_name='.$_GET['module_name'].'&id_tab=2&section=category" method="post" class="form"> <form action="index.php?tab='.Tools::safeOuput($_GET['tab']).'&configure='.Tools::safeOuput($_GET['configure']).'&token='.Tools::safeOuput($_GET['token']).'&tab_module='.Tools::safeOuput($_GET['tab_module']).'&module_name='.Tools::safeOuput($_GET['module_name']).'&id_tab=2&section=category" method="post" class="form">
<p align="center"><input class="button" name="submitSave" type="submit" value="'.$this->l('See Categories').'" /></p></form>'; <p align="center"><input class="button" name="submitSave" type="submit" value="'.$this->l('See Categories').'" /></p></form>';
// Display eBay Categories // Display eBay Categories
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+1 -1
View File
@@ -701,7 +701,7 @@ class shopimporter extends ImportModule
{ {
$this->saveMatchId(strtolower($className), (int)$object->id, (int)$id); $this->saveMatchId(strtolower($className), (int)$object->id, (int)$id);
if ($className == 'Customer') if ($className == 'Customer')
Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'customer SET `passwd_'.bqSQL(Tools::getValue('moduleName')).'̀ = \''.pSQL($password).'\' WHERE id_customer = '.(int)$object->id); Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'customer SET `passwd_'.bqSQL(Tools::getValue('moduleName')).'` = \''.pSQL($password).'\' WHERE id_customer = '.(int)$object->id);
if (array_key_exists('hasImage', $this->supportedImports[strtolower($className)]) AND Tools::isSubmit('images_'.$className)) if (array_key_exists('hasImage', $this->supportedImports[strtolower($className)]) AND Tools::isSubmit('images_'.$className))
$this->copyImg($item, $className); $this->copyImg($item, $className);
} }
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();
+4
View File
@@ -0,0 +1,4 @@
<?php
global $_MODULE;
$_MODULE = array();