PageRenderTime 59ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 1ms

/admin800/tabs/AdminModules.php

http://marocmall.googlecode.com/
PHP | 918 lines | 831 code | 51 blank | 36 comment | 101 complexity | 0f0dea39546a1c4138949c7f495b798c MD5 | raw file
Possible License(s): LGPL-2.1
  1. <?php
  2. /*
  3. * 2007-2011 PrestaShop
  4. *
  5. * NOTICE OF LICENSE
  6. *
  7. * This source file is subject to the Open Software License (OSL 3.0)
  8. * that is bundled with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://opensource.org/licenses/osl-3.0.php
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@prestashop.com so we can send you a copy immediately.
  14. *
  15. * DISCLAIMER
  16. *
  17. * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
  18. * versions in the future. If you wish to customize PrestaShop for your
  19. * needs please refer to http://www.prestashop.com for more information.
  20. *
  21. * @author PrestaShop SA <contact@prestashop.com>
  22. * @copyright 2007-2011 PrestaShop SA
  23. * @version Release: $Revision: 6965 $
  24. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  25. * International Registered Trademark & Property of PrestaShop SA
  26. */
  27. include_once(PS_ADMIN_DIR.'/../tools/tar/Archive_Tar.php');
  28. class AdminModules extends AdminTab
  29. {
  30. /** @var array map with $_GET keywords and their callback */
  31. private $map = array(
  32. 'install' => 'install',
  33. 'uninstall' => 'uninstall',
  34. 'configure' => 'getContent',
  35. 'delete' => 'delete'
  36. );
  37. private $listTabModules;
  38. private $listPartnerModules = array();
  39. private $listNativeModules = array();
  40. private $_moduleCacheFile;
  41. static private $MAX_DISP_AUTHOR = 20; // maximum length to display
  42. function __construct()
  43. {
  44. parent::__construct ();
  45. $this->_moduleCacheFile = _PS_ROOT_DIR_.'/config/modules_list.xml';
  46. //refresh modules_list.xml every week
  47. if (!$this->isFresh())
  48. $this->refresh();
  49. $this->listTabModules = array('administration' => $this->l('Administration'), 'advertising_marketing' => $this->l('Advertising & Marketing'),
  50. 'analytics_stats' => $this->l('Analytics & Stats'), 'billing_invoicing' => $this->l('Billing & Invoicing'), 'checkout' => $this->l('Checkout'),
  51. 'content_management' => $this->l('Content Management'), 'export' => $this->l('Export'), 'front_office_features' => $this->l('Front Office Features'),
  52. 'i18n_localization' => $this->l('I18n & Localization'), 'merchandizing' => $this->l('Merchandizing'), 'migration_tools' => $this->l('Migration Tools'),
  53. 'payments_gateways' => $this->l('Payments & Gateways'), 'payment_security' => $this->l('Payment Security'), 'pricing_promotion' => $this->l('Pricing & Promotion'),
  54. 'quick_bulk_update' => $this->l('Quick / Bulk update'), 'search_filter' => $this->l('Search & Filter'), 'seo' => $this->l('SEO'), 'shipping_logistics' => $this->l('Shipping & Logistics'),
  55. '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'));
  56. $xmlModules = @simplexml_load_file($this->_moduleCacheFile);
  57. foreach($xmlModules->children() as $xmlModule)
  58. if ($xmlModule->attributes() == 'native')
  59. foreach($xmlModule->children() as $module)
  60. foreach($module->attributes() as $key => $value)
  61. if ($key == 'name')
  62. $this->listNativeModules[] = (string)$value;
  63. if ($xmlModule->attributes() == 'partner')
  64. foreach($xmlModule->children() as $module)
  65. foreach($module->attributes() as $key => $value)
  66. if ($key == 'name')
  67. $this->listPartnerModules[] = (string)$value;
  68. }
  69. public function postProcess()
  70. {
  71. global $currentIndex, $cookie;
  72. $id_employee = (int)($cookie->id_employee);
  73. $filter_conf = Configuration::getMultiple(array(
  74. 'PS_SHOW_TYPE_MODULES_'.$id_employee,
  75. 'PS_SHOW_COUNTRY_MODULES_'.$id_employee,
  76. 'PS_SHOW_INSTALLED_MODULES_'.$id_employee,
  77. 'PS_SHOW_ENABLED_MODULES_'.$id_employee
  78. ));
  79. //reset filtre
  80. if (Tools::isSubmit('desactive') && isset($filter_conf['PS_SHOW_ENABLED_MODULES_'.$id_employee]) && $filter_conf['PS_SHOW_ENABLED_MODULES_'.$id_employee] != 'enabledDisabled')
  81. $this->setFilterModules($filter_conf['PS_SHOW_TYPE_MODULES_'.$id_employee], $filter_conf['PS_SHOW_COUNTRY_MODULES_'.$id_employee], $filter_conf['PS_SHOW_INSTALLED_MODULES_'.$id_employee], 'disabled');
  82. if (Tools::isSubmit('active') && isset($filter_conf['PS_SHOW_ENABLED_MODULES_'.$id_employee]) && $filter_conf['PS_SHOW_ENABLED_MODULES_'.$id_employee] != 'enabledDisabled')
  83. $this->setFilterModules($filter_conf['PS_SHOW_TYPE_MODULES_'.$id_employee], $filter_conf['PS_SHOW_COUNTRY_MODULES_'.$id_employee], $filter_conf['PS_SHOW_INSTALLED_MODULES_'.$id_employee], 'enabled');
  84. if (Tools::isSubmit('uninstall') && isset($filter_conf['PS_SHOW_INSTALLED_MODULES_'.$id_employee]) && $filter_conf['PS_SHOW_INSTALLED_MODULES_'.$id_employee] != 'installedUninstalled')
  85. $this->setFilterModules($filter_conf['PS_SHOW_TYPE_MODULES_'.$id_employee], $filter_conf['PS_SHOW_COUNTRY_MODULES_'.$id_employee], 'unistalled', $filter_conf['PS_SHOW_ENABLED_MODULES_'.$id_employee]);
  86. if (Tools::isSubmit('install') && isset($filter_conf['PS_SHOW_INSTALLED_MODULES_'.$id_employee]) && $filter_conf['PS_SHOW_INSTALLED_MODULES_'.$id_employee] != 'installedUninstalled')
  87. $this->setFilterModules($filter_conf['PS_SHOW_TYPE_MODULES_'.$id_employee], $filter_conf['PS_SHOW_COUNTRY_MODULES_'.$id_employee], 'installed', $filter_conf['PS_SHOW_ENABLED_MODULES_'.$id_employee]);
  88. if (Tools::isSubmit('filterModules'))
  89. {
  90. $this->setFilterModules(Tools::getValue('module_type'), Tools::getValue('country_module_value'), Tools::getValue('module_install'), Tools::getValue('module_status'));
  91. Tools::redirectAdmin($currentIndex.'&token='.$this->token);
  92. }
  93. elseif (Tools::isSubmit('resetFilterModules'))
  94. {
  95. $this->resetFilterModules();
  96. Tools::redirectAdmin($currentIndex.'&token='.$this->token);
  97. }
  98. if (Tools::isSubmit('active'))
  99. {
  100. if ($this->tabAccess['edit'] === '1')
  101. {
  102. $module = Module::getInstanceByName(Tools::getValue('module_name'));
  103. if (Validate::isLoadedObject($module))
  104. {
  105. $module->enable();
  106. Tools::redirectAdmin($currentIndex.'&conf=5'.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name);
  107. } else
  108. $this->_errors[] = Tools::displayError('Cannot load module object');
  109. } else
  110. $this->_errors[] = Tools::displayError('You do not have permission to add here.');
  111. }
  112. elseif (Tools::isSubmit('desactive'))
  113. {
  114. if ($this->tabAccess['edit'] === '1')
  115. {
  116. $module = Module::getInstanceByName(Tools::getValue('module_name'));
  117. if (Validate::isLoadedObject($module))
  118. {
  119. $module->disable();
  120. Tools::redirectAdmin($currentIndex.'&conf=5'.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name);
  121. } else
  122. $this->_errors[] = Tools::displayError('Cannot load module object');
  123. } else
  124. $this->_errors[] = Tools::displayError('You do not have permission to add here.');
  125. }
  126. elseif (Tools::isSubmit('reset'))
  127. {
  128. if ($this->tabAccess['edit'] === '1')
  129. {
  130. $module = Module::getInstanceByName(Tools::getValue('module_name'));
  131. if (Validate::isLoadedObject($module))
  132. {
  133. if ($module->uninstall())
  134. if ($module->install())
  135. Tools::redirectAdmin($currentIndex.'&conf=21'.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name);
  136. else
  137. $this->_errors[] = Tools::displayError('Cannot install module');
  138. else
  139. $this->_errors[] = Tools::displayError('Cannot uninstall module');
  140. } else
  141. $this->_errors[] = Tools::displayError('Cannot load module object');
  142. } else
  143. $this->_errors[] = Tools::displayError('You do not have permission to add here.');
  144. }
  145. /* Automatically copy a module from external URL and unarchive it in the appropriated directory */
  146. if (Tools::isSubmit('submitDownload'))
  147. {
  148. if ($this->tabAccess['add'] === '1')
  149. {
  150. if (Validate::isModuleUrl($url = Tools::getValue('url'), $this->_errors))
  151. {
  152. if (!@copy($url, _PS_MODULE_DIR_.basename($url)))
  153. $this->_errors[] = Tools::displayError('404 Module not found');
  154. else
  155. $this->extractArchive(_PS_MODULE_DIR_.basename($url));
  156. }
  157. }
  158. else
  159. $this->_errors[] = Tools::displayError('You do not have permission to add here.');
  160. }
  161. if (Tools::isSubmit('submitDownload2'))
  162. {
  163. if ($this->tabAccess['add'] === '1')
  164. {
  165. if (!isset($_FILES['file']['tmp_name']) OR empty($_FILES['file']['tmp_name']))
  166. $this->_errors[] = $this->l('no file selected');
  167. elseif (substr($_FILES['file']['name'], -4) != '.tar' AND substr($_FILES['file']['name'], -4) != '.zip' AND substr($_FILES['file']['name'], -4) != '.tgz' AND substr($_FILES['file']['name'], -7) != '.tar.gz')
  168. $this->_errors[] = Tools::displayError('Unknown archive type');
  169. elseif (!@copy($_FILES['file']['tmp_name'], _PS_MODULE_DIR_.$_FILES['file']['name']))
  170. $this->_errors[] = Tools::displayError('An error occurred while copying archive to module directory.');
  171. else
  172. $this->extractArchive(_PS_MODULE_DIR_.$_FILES['file']['name']);
  173. }
  174. else
  175. $this->_errors[] = Tools::displayError('You do not have permission to add here.');
  176. }
  177. if (Tools::isSubmit('deleteModule'))
  178. {
  179. if ($this->tabAccess['delete'] === '1')
  180. {
  181. if (Tools::getValue('module_name') != '')
  182. {
  183. $moduleDir = _PS_MODULE_DIR_.str_replace(array('.', '/', '\\'), array('', '', ''), Tools::getValue('module_name'));
  184. $this->recursiveDeleteOnDisk($moduleDir);
  185. Tools::redirectAdmin($currentIndex.'&conf=22&token='.$this->token.'&tab_module='.Tools::getValue('tab_module').'&module_name='.Tools::getValue('module_name'));
  186. }
  187. Tools::redirectAdmin($currentIndex.'&token='.$this->token);
  188. }
  189. else
  190. $this->_errors[] = Tools::displayError('You do not have permission to delete here.');
  191. }
  192. /* Call appropriate module callback */
  193. else
  194. {
  195. $return = false;
  196. foreach ($this->map as $key => $method)
  197. {
  198. $modules = Tools::getValue($key);
  199. if (strpos($modules, '|'))
  200. $modules = explode('|', $modules);
  201. else
  202. $modules = empty($modules) ? false : array($modules);
  203. $module_errors = array();
  204. if ($modules)
  205. foreach ($modules AS $name)
  206. {
  207. if (!($module = Module::getInstanceByName(urldecode($name))))
  208. $this->_errors[] = $this->l('module not found');
  209. elseif ($key == 'install' AND $this->tabAccess['add'] !== '1')
  210. $this->_errors[] = Tools::displayError('You do not have permission to add here.');
  211. elseif ($key == 'uninstall' AND $this->tabAccess['delete'] !== '1')
  212. $this->_errors[] = Tools::displayError('You do not have permission to delete here.');
  213. elseif ($key == 'configure' AND $this->tabAccess['edit'] !== '1')
  214. $this->_errors[] = Tools::displayError('You do not have permission to edit here.');
  215. elseif ($key == 'install' AND Module::isInstalled($module->name))
  216. $this->_errors[] = Tools::displayError('This module is already installed : ').$module->name;
  217. elseif ($key == 'uninstall' AND !Module::isInstalled($module->name))
  218. $this->_errors[] = Tools::displayError('This module is already uninstalled : ').$module->name;
  219. elseif (($echo = $module->{$method}()) AND ($key == 'configure') AND Module::isInstalled($module->name))
  220. {
  221. $backlink = $currentIndex.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name;
  222. $hooklink = 'index.php?tab=AdminModulesPositions&token='.Tools::getAdminTokenLite('AdminModulesPositions').'&show_modules='.(int)$module->id;
  223. $tradlink = 'index.php?tab=AdminTranslations&token='.Tools::getAdminTokenLite('AdminTranslations').'&type=modules&lang=';
  224. $toolbar = '
  225. <table class="table" cellpadding="0" cellspacing="0" style="margin:auto;text-align:center">
  226. <tr>
  227. <th>'.$this->l('Module').' <span style="color: green;">'.$module->name.'</span></th>
  228. <th><a href="'.$backlink.'" style="padding:5px 10px">'.$this->l('Back').'</a></th>
  229. <th><a href="'.$hooklink.'" style="padding:5px 10px">'.$this->l('Manage hooks').'</a></th>
  230. <th style="padding:5px 10px">'.$this->l('Manage translations:').' ';
  231. foreach (Language::getLanguages(false) AS $language)
  232. $toolbar .= '<a href="'.$tradlink.$language['iso_code'].'#'.$module->name.'" style="margin-left:5px"><img src="'._THEME_LANG_DIR_.$language['id_lang'].'.jpg" alt="'.$language['iso_code'].'" title="'.$language['iso_code'].'" /></a>';
  233. $toolbar .= '
  234. </th>
  235. </tr>
  236. </table>';
  237. echo
  238. $toolbar.'
  239. <div class="clear">&nbsp;</div>'.$echo.'<div class="clear">&nbsp;</div>
  240. '.$toolbar;
  241. }
  242. elseif($echo)
  243. $return = ($method == 'install' ? 12 : 13);
  244. elseif ($echo === false)
  245. $module_errors[] = $name;
  246. if ($key != 'configure' AND isset($_GET['bpay']))
  247. Tools::redirectAdmin('index.php?tab=AdminPayment&token='.Tools::getAdminToken('AdminPayment'.(int)(Tab::getIdFromClassName('AdminPayment')).(int)($cookie->id_employee)));
  248. }
  249. if (sizeof($module_errors))
  250. {
  251. $htmlError = '';
  252. foreach ($module_errors AS $module_error)
  253. $htmlError .= '<li>'.$module_error.'</li>';
  254. $htmlError .= '</ul>';
  255. $this->_errors[] = Tools::displayError('The following module(s) were not installed successfully:'.$htmlError);
  256. }
  257. }
  258. if ($return)
  259. Tools::redirectAdmin($currentIndex.'&conf='.$return.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name);
  260. }
  261. }
  262. function extractArchive($file)
  263. {
  264. global $currentIndex;
  265. $success = false;
  266. if (substr($file, -4) == '.zip')
  267. {
  268. if (!Tools::ZipExtract($file, _PS_MODULE_DIR_))
  269. $this->_errors[] = Tools::displayError('Error while extracting module (file may be corrupted).');
  270. }
  271. else
  272. {
  273. $archive = new Archive_Tar($file);
  274. if ($archive->extract(_PS_MODULE_DIR_))
  275. $success = true;
  276. else
  277. $this->_errors[] = Tools::displayError('Error while extracting module (file may be corrupted).');
  278. }
  279. @unlink($file);
  280. if ($success)
  281. Tools::redirectAdmin($currentIndex.'&conf=8'.'&token='.$this->token);
  282. }
  283. public function display()
  284. {
  285. if (!isset($_GET['configure']) AND !isset($_GET['delete']) OR sizeof($this->_errors) )
  286. $this->displayList();
  287. }
  288. public function displayJavascript()
  289. {
  290. global $currentIndex;
  291. echo '<script type="text/javascript" src="'._PS_JS_DIR_.'jquery/jquery.autocomplete.js"></script>
  292. <script type="text/javascript" src="'._PS_JS_DIR_.'jquery/jquery.fancybox-1.3.4.js"></script>
  293. <script type="text/javascript">
  294. function getPrestaStore(){if (getE("prestastore").style.display!=\'block\')return;$.post("'.dirname($currentIndex).'/ajax.php",{page:"prestastore"},function(a){getE("prestastore-content").innerHTML=a;})}
  295. function truncate_author(author)
  296. {
  297. return ((author.length > '.self::$MAX_DISP_AUTHOR.') ? author.substring(0, '.self::$MAX_DISP_AUTHOR.')+"..." : author);
  298. }
  299. function modules_management(action)
  300. {
  301. var modules = document.getElementsByName(\'modules\');
  302. var module_list = \'\';
  303. for (var i = 0; i < modules.length; i++)
  304. {
  305. if (modules[i].checked == true)
  306. {
  307. rel = modules[i].getAttribute(\'rel\');
  308. if (rel != "false" && action == "uninstall")
  309. {
  310. if (!confirm(rel))
  311. return false;
  312. }
  313. module_list += \'|\'+modules[i].value;
  314. }
  315. }
  316. document.location.href=\''.$currentIndex.'&token='.$this->token.'&\'+action+\'=\'+module_list.substring(1, module_list.length);
  317. }
  318. $(\'document\').ready( function() {
  319. $(\'input[name="filtername"]\').autocomplete(moduleList, {
  320. minChars: 0,
  321. width: 310,
  322. matchContains: true,
  323. highlightItem: true,
  324. formatItem: function(row, i, max, term) {
  325. return "<img src=\"../modules/"+row.name+"/logo.gif\" style=\"float:left;margin:5px\"><strong>" + row.displayName + "</strong>"+((row.author != \'\') ? " '.$this->l("by").' "+ truncate_author(row.author) :"") + "<br /><span style=\'font-size: 80%;\'>"+ row.desc +"</span>";
  326. },
  327. formatResult: function(row) {
  328. return row.displayName;
  329. }
  330. });
  331. $(\'input[name="filtername"]\').result(function(event, data, formatted) {
  332. $(\'#filternameForm\').submit();
  333. });
  334. });
  335. </script>';
  336. }
  337. public static function sortModule($a, $b)
  338. {
  339. if (sizeof($a) == sizeof($b)) {
  340. return 0;
  341. }
  342. return (sizeof($a) < sizeof($b)) ? -1 : 1;
  343. }
  344. /**
  345. * Used for retreiving author name from submited field authorModules[name]
  346. * @param String $value value to be clean
  347. *
  348. * @return String cleant value: name
  349. */
  350. private function _getSubmitedModuleAuthor($value)
  351. {
  352. $value = str_replace('authorModules[', '', $value);
  353. $value = str_replace("\'", "'", $value);
  354. $value = substr($value, 0, -1);
  355. return $value;
  356. }
  357. /**
  358. * Used for building option group
  359. * @param Array $authors contains modules authors
  360. * @param String $fieldName name of optiongroup
  361. * @return String built comp
  362. */
  363. private function _buildModuleAuthorsOptGroup($authors, $fieldName = "UNDEFINED")
  364. {
  365. $out = '<optgroup label="'.$this->l('Authors').'">';
  366. foreach($authors as $author_item => $status)
  367. {
  368. $author_item = Tools::htmlentitiesUTF8($author_item);
  369. $disp_author = $this->_getDispAuthor($author_item);
  370. $out .= '<option value="'.$fieldName.'['.$author_item. ']"'. (($status === "selected") ? ' selected>' : '>').$disp_author .'</option>';
  371. }
  372. $out .= '</optgroup>';
  373. return $out;
  374. }
  375. /**
  376. * Used for truncating author name to display it nicely
  377. * @param String $author original author
  378. * @return String truncated author name
  379. */
  380. private function _getDispAuthor($author)
  381. {
  382. return ((strlen($author) > self::$MAX_DISP_AUTHOR) ? substr($author, 0, self::$MAX_DISP_AUTHOR).'...' : $author);
  383. }
  384. public function displayList()
  385. {
  386. global $currentIndex, $cookie;
  387. $modulesAuthors = array();
  388. $autocompleteList = 'var moduleList = [';
  389. $showTypeModules = Configuration::get('PS_SHOW_TYPE_MODULES_'.(int)($cookie->id_employee));
  390. $showInstalledModules = Configuration::get('PS_SHOW_INSTALLED_MODULES_'.(int)($cookie->id_employee));
  391. $showEnabledModules = Configuration::get('PS_SHOW_ENABLED_MODULES_'.(int)($cookie->id_employee));
  392. $showCountryModules = Configuration::get('PS_SHOW_COUNTRY_MODULES_'.(int)($cookie->id_employee));
  393. $nameCountryDefault = Country::getNameById($cookie->id_lang, Configuration::get('PS_COUNTRY_DEFAULT'));
  394. $isoCountryDefault = Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'));
  395. $serialModules = '';
  396. $modules = Module::getModulesOnDisk(true);
  397. foreach ($modules AS $module)
  398. {
  399. if (!in_array($module->name, $this->listNativeModules))
  400. $serialModules .= $module->name.' '.$module->version.'-'.($module->active ? 'a' : 'i')."\n";
  401. $moduleAuthor = $module->author;
  402. if (!empty($moduleAuthor)&& ($moduleAuthor != ""))
  403. $modulesAuthors[(string)$moduleAuthor] = true;
  404. }
  405. $serialModules = urlencode($serialModules);
  406. $filterName = Tools::getValue('filtername');
  407. if (!empty($filterName))
  408. {
  409. echo '
  410. <script type="text/javascript">
  411. $(document).ready(function() {
  412. $(\'#all_open\').hide();
  413. $(\'#all_close\').show();
  414. $(\'.tab_module_content\').each(function(){
  415. $(this).slideDown();
  416. $(\'.header_module_img\').each(function(){
  417. $(this).attr(\'src\', \'../img/admin/less.png\');
  418. });
  419. });
  420. });
  421. </script>';
  422. }
  423. //filter module list
  424. foreach($modules as $key => $module)
  425. {
  426. switch ($showTypeModules)
  427. {
  428. case 'nativeModules':
  429. if (!in_array($module->name, $this->listNativeModules))
  430. unset($modules[$key]);
  431. break;
  432. case 'partnerModules':
  433. if (!in_array($module->name, $this->listPartnerModules))
  434. unset($modules[$key]);
  435. break;
  436. case 'otherModules':
  437. if (in_array($module->name, $this->listPartnerModules) OR in_array($module->name, $this->listNativeModules))
  438. unset($modules[$key]);
  439. break;
  440. default:
  441. if (strpos($showTypeModules, 'authorModules[') !== false)
  442. {
  443. $author_selected = $this->_getSubmitedModuleAuthor($showTypeModules);
  444. $modulesAuthors[$author_selected] = 'selected'; // setting selected author in authors set
  445. if (empty($module->author) || $module->author != $author_selected)
  446. unset($modules[$key]);
  447. }
  448. break;
  449. }
  450. switch ($showInstalledModules)
  451. {
  452. case 'installed':
  453. if (!$module->id)
  454. unset($modules[$key]);
  455. break;
  456. case 'unistalled':
  457. if ($module->id)
  458. unset($modules[$key]);
  459. break;
  460. }
  461. switch ($showEnabledModules)
  462. {
  463. case 'enabled':
  464. if (!$module->active)
  465. unset($modules[$key]);
  466. break;
  467. case 'disabled':
  468. if ($module->active)
  469. unset($modules[$key]);
  470. break;
  471. }
  472. if ($showCountryModules)
  473. if (isset($module->limited_countries) AND !empty($module->limited_countries) AND ((is_array($module->limited_countries) AND sizeof($module->limited_countries) AND !in_array(strtolower($isoCountryDefault), $module->limited_countries)) OR (!is_array($module->limited_countries) AND strtolower($isoCountryDefault) != strval($module->limited_countries))))
  474. unset($modules[$key]);
  475. if (!empty($filterName))
  476. if (stristr($module->name, $filterName) === false AND stristr($module->displayName, $filterName) === false AND stristr($module->description, $filterName) === false)
  477. unset($modules[$key]);
  478. }
  479. foreach($modules as $module)
  480. $autocompleteList .= Tools::jsonEncode(array(
  481. 'displayName' => (string)$module->displayName,
  482. 'desc' => (string)$module->description,
  483. 'name' => (string)$module->name,
  484. 'author' => (string)$module->author
  485. )).', ';
  486. $autocompleteList = rtrim($autocompleteList, ' ,').'];';
  487. // Display CSS Fancy Box
  488. echo '<link href="'._PS_CSS_DIR_.'jquery.fancybox-1.3.4.css" rel="stylesheet" type="text/css" media="screen" />';
  489. echo '<script type="text/javascript">'.$autocompleteList.'</script>';
  490. $this->displayJavascript();
  491. echo '
  492. <span onclick="$(\'#module_install\').slideToggle()" style="cursor:pointer"><img src="../img/admin/add.gif" alt="'.$this->l('Add a new module').'" class="middle" />
  493. '.$this->l('Add a module from my computer').'
  494. </span>
  495. &nbsp;|&nbsp;';
  496. if (@fsockopen('www.prestashop.com', 80))
  497. echo '<a href="index.php?tab=AdminAddonsMyAccount&token='.Tools::getAdminTokenLite('AdminAddonsMyAccount').'">
  498. <img src="https://addons.prestashop.com/modules.php?'.(isset($_SERVER['SERVER_ADDR']) ? 'server='.ip2long($_SERVER['SERVER_ADDR']).'&' : '').'mods='.$serialModules.'" alt="Add" class="middle" />
  499. '.$this->l('Add a module from PrestaShop Addons').'
  500. </a>';
  501. echo '<form action="'.$currentIndex.'&token='.$this->token.'" method="post" id="filternameForm" style="float:right"><input type="text" name="filtername" value="'.Tools::htmlentitiesUTF8(Tools::getValue('filtername')).'" /> <input type="submit" value="'.$this->l('Search').'" class="button" /></form>
  502. <div class="clear">&nbsp;</div>
  503. <div id="module_install" style="width:900px; '.((Tools::isSubmit('submitDownload') OR Tools::isSubmit('submitDownload2')) ? '' : 'display: none;').'">
  504. <fieldset>
  505. <legend><img src="../img/admin/add.gif" alt="'.$this->l('Add a new module').'" class="middle" /> '.$this->l('Add a new module').'</legend>
  506. <p>'.$this->l('The module must be either a zip file or a tarball.').'</p>
  507. <hr />
  508. <div style="float:right;margin-right:50px;border-left:solid 1px #DFD5C3">
  509. <form action="'.$currentIndex.'&token='.$this->token.'" method="post" enctype="multipart/form-data">
  510. <label style="width: 100px">'.$this->l('Module file').'</label>
  511. <div class="margin-form" style="padding-left: 140px">
  512. <input type="file" name="file" />
  513. <p>'.$this->l('Upload the module from your computer.').'</p>
  514. </div>
  515. <div class="margin-form" style="padding-left: 140px">
  516. <input type="submit" name="submitDownload2" value="'.$this->l('Upload this module').'" class="button" />
  517. </div>
  518. </form>
  519. </div>
  520. <div>
  521. <form action="'.$currentIndex.'&token='.$this->token.'" method="post">
  522. <label style="width: 100px">'.$this->l('Module URL').'</label>
  523. <div class="margin-form" style="padding-left: 140px">
  524. <input type="text" name="url" style="width: 200px;" value="'.(Tools::getValue('url') ? Tools::getValue('url') : 'http://').'" />
  525. <p>'.$this->l('Download the module directly from a website.').'</p>
  526. </div>
  527. <div class="margin-form" style="padding-left: 140px">
  528. <input type="submit" name="submitDownload" value="'.$this->l('Download this module').'" class="button" />
  529. </div>
  530. </form>
  531. </div>
  532. </fieldset>
  533. <br />
  534. </div>';
  535. if (Configuration::get('PRESTASTORE_LIVE'))
  536. echo '
  537. <div id="prestastore" style="margin-left:40px; display:none; float: left" class="width1">
  538. </div>';
  539. /* Scan modules directories and load modules classes */
  540. $warnings = array();
  541. $orderModule = array();
  542. $irow = 0;
  543. foreach ($modules AS $module)
  544. $orderModule[(isset($module->tab) AND !empty($module->tab) AND array_key_exists(strval($module->tab), $this->listTabModules)) ? strval($module->tab) : 'others' ][] = $module;
  545. uasort($orderModule,array('AdminModules', 'sortModule'));
  546. $concatWarning = array();
  547. foreach ($orderModule AS $tabModule)
  548. foreach ($tabModule AS $module)
  549. if ($module->active AND $module->warning)
  550. $warnings[] ='<a href="'.$currentIndex.'&configure='.urlencode($module->name).'&token='.$this->token.'">'.$module->displayName.'</a> - '.stripslashes(pSQL($module->warning));
  551. $this->displayWarning($warnings);
  552. echo '<form method="POST">
  553. <table cellpadding="0" cellspacing="0" style="width:100%;;margin-bottom:5px;">
  554. <tr>
  555. <th style="border-right:solid 1px;border:inherit">
  556. <span class="button" style="padding:0.4em;">
  557. <a id="all_open" class="module_toggle_all" style="display:inherit;text-decoration:none;" href="#">
  558. <span style="padding-right:0.5em">
  559. <img src="../img/admin/more.png" alt="" />
  560. </span>
  561. <span id="all_open">'.$this->l('Open all tabs').'</span>
  562. </a>
  563. <a id="all_close" class="module_toggle_all" style="display:none;text-decoration:none;" href="#">
  564. <span style="padding-right:0.5em">
  565. <img src="../img/admin/less.png" alt="" />
  566. </span>
  567. <span id="all_open">'.$this->l('Close all tabs').'</span>
  568. </a>
  569. </span>
  570. </th>
  571. <th colspan="3" style="border:inherit">
  572. <select name="module_type">
  573. <option value="allModules" '.($showTypeModules == 'allModules' ? 'selected="selected"' : '').'>'.$this->l('All Modules').'</option>
  574. <option value="nativeModules" '.($showTypeModules == 'nativeModules' ? 'selected="selected"' : '').'>'.$this->l('Native Modules').'</option>
  575. <option value="partnerModules" '.($showTypeModules == 'partnerModules' ? 'selected="selected"' : '').'>'.$this->l('Partners Modules').'</option>'
  576. .$this->_buildModuleAuthorsOptGroup($modulesAuthors, 'authorModules')
  577. .'
  578. <option value="otherModules" '.($showTypeModules == 'otherModules' ? 'selected="selected"' : '').'>'.$this->l('Others Modules').'</option>
  579. </select>
  580. &nbsp;
  581. <select name="module_install">
  582. <option value="installedUninstalled" '.($showInstalledModules == 'installedUninstalled' ? 'selected="selected"' : '').'>'.$this->l('Installed & Uninstalled').'</option>
  583. <option value="installed" '.($showInstalledModules == 'installed' ? 'selected="selected"' : '').'>'.$this->l('Installed Modules').'</option>
  584. <option value="unistalled" '.($showInstalledModules == 'unistalled' ? 'selected="selected"' : '').'>'.$this->l('Uninstalled Modules').'</option>
  585. </select>
  586. &nbsp;
  587. <select name="module_status">
  588. <option value="enabledDisabled" '.($showEnabledModules == 'enabledDisabled' ? 'selected="selected"' : '').'>'.$this->l('Enabled & Disabled').'</option>
  589. <option value="enabled" '.($showEnabledModules == 'enabled' ? 'selected="selected"' : '').'>'.$this->l('Enabled Modules').'</option>
  590. <option value="disabled" '.($showEnabledModules == 'disabled' ? 'selected="selected"' : '').'>'.$this->l('Disabled Modules').'</option>
  591. </select>
  592. &nbsp;
  593. <select name="country_module_value">
  594. <option value="0" >'.$this->l('All countries').'</option>
  595. <option value="1" '.($showCountryModules == 1 ? 'selected="selected"' : '').'>'.$this->l('Current country:').' '.$nameCountryDefault.'</option>
  596. </select>
  597. </th>
  598. <th style="border:inherit">
  599. <div style="float:right">
  600. <input type="submit" class="button" name="resetFilterModules" value="'.$this->l('Reset').'">
  601. <input type="submit" class="button" name="filterModules" value="'.$this->l('Filter').'">
  602. </div>
  603. </th>
  604. </tr>
  605. </table>
  606. </form>';
  607. echo $this->displaySelectedFilter();
  608. if ($tab_module = Tools::getValue('tab_module'))
  609. if (array_key_exists($tab_module, $this->listTabModules))
  610. $goto = $tab_module;
  611. else
  612. $goto = 'others';
  613. else
  614. $goto = false;
  615. echo '
  616. <script src="'.__PS_BASE_URI__.'js/jquery/jquery.scrollTo-1.4.2-min.js"></script>
  617. <script>
  618. $(document).ready(function() {
  619. $(\'.header_module_toggle, .module_toggle_all\').unbind(\'click\').click(function(){
  620. var id = $(this).attr(\'id\');
  621. if (id == \'all_open\')
  622. $(\'.tab_module_content\').each(function(){
  623. $(this).slideDown();
  624. $(\'#all_open\').hide();
  625. $(\'#all_close\').show();
  626. $(\'.header_module_img\').each(function(){
  627. $(this).attr(\'src\', \'../img/admin/less.png\');
  628. });
  629. });
  630. else if (id == \'all_close\')
  631. $(\'.tab_module_content\').each(function(){
  632. $(\'#all_open\').show();
  633. $(\'#all_close\').hide();
  634. $(this).slideUp();
  635. $(\'.header_module_img\').each(function(){
  636. $(this).attr(\'src\', \'../img/admin/more.png\');
  637. });
  638. });
  639. else
  640. {
  641. if ($(\'#\'+id+\'_content\').css(\'display\') == \'none\')
  642. $(\'#\'+id+\'_img\').attr(\'src\', \'../img/admin/less.png\');
  643. else
  644. $(\'#\'+id+\'_img\').attr(\'src\', \'../img/admin/more.png\');
  645. $(\'#\'+$(this).attr(\'id\')+\'_content\').slideToggle();
  646. }
  647. return false;
  648. });
  649. '.(!$goto ? '': '$(\'#'.$goto.'_content\').slideToggle( function (){
  650. $(\'#'.$goto.'_img\').attr(\'src\', \'../img/admin/less.png\');
  651. '.(!$goto ? '' : '$.scrollTo($("#modgo_'.Tools::getValue('module_name').'"), 300 ,
  652. {onAfter:function(){
  653. $("#modgo_'.Tools::getValue('module_name').'").fadeTo(100, 0, function (){
  654. $(this).fadeTo(100, 0, function (){
  655. $(this).fadeTo(50, 1, function (){
  656. $(this).fadeTo(50, 0, function (){
  657. $(this).fadeTo(50, 1 )}
  658. )}
  659. )}
  660. )}
  661. )}
  662. });').'
  663. });').'
  664. });
  665. </script>';
  666. if (!empty($orderModule))
  667. {
  668. /* Browse modules by tab type */
  669. foreach ($orderModule AS $tab => $tabModule)
  670. {
  671. echo '
  672. <div id="'.$tab.'" class="header_module">
  673. <span class="nbr_module" style="width:100px;text-align:right">'.sizeof($tabModule).' '.((sizeof($tabModule) > 1) ? $this->l('modules') : $this->l('module')).'</span>
  674. <a class="header_module_toggle" id="'.$tab.'" href="modgo_'.$tab.'" style="margin-left: 5px;">
  675. <span style="padding-right:0.5em">
  676. <img class="header_module_img" id="'.$tab.'_img" src="../img/admin/more.png" alt="" />
  677. </span>'.$this->listTabModules[$tab].'</a>
  678. </div>
  679. <div id="'.$tab.'_content" class="tab_module_content" style="display:none;border:solid 1px #CCC">';
  680. /* Display modules for each tab type */
  681. foreach ($tabModule as $module)
  682. {
  683. echo '<div id="modgo_'.$module->name.'" title="' . $module->name . '">';
  684. if ($module->id)
  685. {
  686. $img = '<img src="../img/admin/module_install.png" alt="'.$this->l('Module enabled').'" title="'.$this->l('Module enabled').'" />';
  687. if ($module->warning)
  688. $img = '<img src="../img/admin/module_warning.png" alt="'.$this->l('Module installed but with warnings').'" title="'.$this->l('Module installed but with warnings').'" />';
  689. if (!$module->active)
  690. $img = '<img src="../img/admin/module_disabled.png" alt="'.$this->l('Module disabled').'" title="'.$this->l('Module disabled').'" />';
  691. } else
  692. $img = '<img src="../img/admin/module_notinstall.png" alt="'.$this->l('Module not installed').'" title="'.$this->l('Module not installed').'" />';
  693. $disp_author = $this->_getDispAuthor($module->author);
  694. $disp_author = (empty($disp_author)) ? '' : ' '.$this->l('by').' <i>'.Tools::htmlentitiesUTF8($disp_author).'</i>';
  695. echo '<table style="width:100%" cellpadding="0" cellspacing="0" >
  696. <tr'.($irow % 2 ? ' class="alt_row"' : '').' style="height: 42px;">
  697. <td style="padding-right: 10px;padding-left:10px;width:30px">
  698. <input type="checkbox" name="modules" value="'.urlencode($module->name).'" '.(empty($module->confirmUninstall) ? 'rel="false"' : 'rel="'.addslashes($module->confirmUninstall).'"').' />
  699. </td>
  700. <td style="padding:2px 4px 2px 10px;width:500px"><img src="../modules/'.$module->name.'/logo.gif" alt="" /> <b>'.stripslashes($module->displayName).'</b>'.($module->version ? ' v'.$module->version.(strpos($module->version, '.') !== false ? '' : '.0') : '').$disp_author.'<br />'.stripslashes($module->description).'</td>
  701. <td rowspan="2">';
  702. if (Tools::getValue('module_name') == $module->name)
  703. $this->displayConf();
  704. echo '</td>
  705. <td class="center" style="width:60px" rowspan="2">';
  706. if ($module->id)
  707. echo '<a href="'.$currentIndex.'&token='.$this->token.'&module_name='.$module->name.'&'.($module->active ? 'desactive' : 'active').'">';
  708. echo $img;
  709. if ($module->id)
  710. '</a>';
  711. $href = $currentIndex.'&uninstall='.urlencode($module->name).'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name;
  712. echo '
  713. </td>
  714. <td class="center" width="120" rowspan="2">'.((!$module->id)
  715. ? '<input type="button" class="button small" name="Install" value="'.$this->l('Install').'"
  716. onclick="javascript:document.location.href=\''.$currentIndex.'&install='.urlencode($module->name).'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name.'\'">'
  717. : '<input type="button" class="button small" name="Uninstall" value="'.$this->l('Uninstall').'"
  718. onclick="'.((!method_exists($module, 'onclickOption')) ? ((empty($module->confirmUninstall)) ? '' : 'if(confirm(\''.addslashes($module->confirmUninstall).'\')) ').'document.location.href=\''.$href.'\'' : $module->onclickOption('uninstall', $href)).'">').'</td>
  719. </tr>
  720. <tr'.($irow++ % 2 ? ' class="alt_row"' : '').'>
  721. <td style="padding-left:50px;padding-bottom:5px;padding-top:5px" colspan="2">'.$this->displayOptions($module).'</td>
  722. </tr>
  723. </table>
  724. </div>';
  725. }
  726. echo '</div>';
  727. }
  728. echo '
  729. <div style="margin-top: 12px; width:600px;">
  730. <input type="button" class="button big" value="'.$this->l('Install the selection').'" onclick="modules_management(\'install\')"/>
  731. <input type="button" class="button big" value="'.$this->l('Uninstall the selection').'" onclick="modules_management(\'uninstall\')" />
  732. </div>
  733. <br />
  734. <table cellpadding="0" cellspacing="0" class="table" style="width:100%;">
  735. <tr style="height:35px;background-color:#EEEEEE">
  736. <td><strong>'.$this->l('Icon legend').' : </strong></td>
  737. <td style="text-align:center;border-right:solid 1px gray"><img src="../img/admin/module_install.png" />&nbsp;&nbsp;'.$this->l('Module installed and enabled').'</td>
  738. <td style="text-align:center;border-right:solid 1px gray"><img src="../img/admin/module_disabled.png" />&nbsp;&nbsp;'.$this->l('Module installed but disabled').'</td>
  739. <td style="text-align:center;border-right:solid 1px gray"><img src="../img/admin/module_warning.png" />&nbsp;&nbsp;'.$this->l('Module installed but with warnings').'</td>
  740. <td style="text-align:center"><img src="../img/admin/module_notinstall.png" />&nbsp;&nbsp;'.$this->l('Module not installed').'</td>
  741. </tr>
  742. </table>
  743. <div style="clear:both">&nbsp;</div>';
  744. }
  745. else
  746. echo '<table cellpadding="0" cellspacing="0" class="table" style="width:100%;"><tr><td align="center">'.$this->l('No module found').'</td></tr></table>';
  747. }
  748. public function recursiveDeleteOnDisk($dir)
  749. {
  750. if (strpos(realpath($dir), realpath(_PS_MODULE_DIR_)) === false)
  751. return ;
  752. if (is_dir($dir))
  753. {
  754. $objects = scandir($dir);
  755. foreach ($objects as $object)
  756. if ($object != "." && $object != "..")
  757. {
  758. if (filetype($dir."/".$object) == "dir")
  759. $this->recursiveDeleteOnDisk($dir."/".$object);
  760. else
  761. unlink($dir."/".$object);
  762. }
  763. reset($objects);
  764. rmdir($dir);
  765. }
  766. }
  767. public function displayOptions($module)
  768. {
  769. global $currentIndex;
  770. $return = '';
  771. $href = $currentIndex.'&token='.$this->token.'&module_name='.
  772. urlencode($module->name).'&tab_module='.$module->tab;
  773. if ((int)($module->id))
  774. $return .= '<a class="action_module" '.($module->active && method_exists($module, 'onclickOption')? 'onclick="'.$module->onclickOption('desactive', $href).'"' : '').' href="'.$currentIndex.'&token='.$this->token.'&module_name='.urlencode($module->name).'&'.($module->active ? 'desactive' : 'active').'&tab_module='.$module->tab.'&module_name='.urlencode($module->name).'">'.($module->active ? $this->l('Disable') : $this->l('Enable')).'</a>&nbsp;&nbsp;';
  775. if ((int)($module->id) AND $module->active)
  776. $return .= '<a class="action_module" '.(method_exists($module, 'onclickOption')? 'onclick="'.$module->onclickOption('reset', $href).'"' : '').' href="'.$currentIndex.'&token='.$this->token.'&module_name='.urlencode($module->name).'&reset&tab_module='.$module->tab.'&module_name='.urlencode($module->name).'">'.$this->l('Reset').'</a>&nbsp;&nbsp;';
  777. if ((int)($module->id) AND (method_exists($module, 'getContent') OR (isset($module->is_configurable) AND (int)$module->is_configurable)))
  778. $return .= '<a class="action_module" '.(method_exists($module, 'onclickOption')? 'onclick="'.$module->onclickOption('configure', $href).'"' : '').' href="'.$currentIndex.'&configure='.urlencode($module->name).'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.urlencode($module->name).'">'.$this->l('Configure').'</a>&nbsp;&nbsp;';
  779. $return .= '<a class="action_module" '.(method_exists($module, 'onclickOption')? 'onclick="'.$module->onclickOption('delete', $href).'"' : '').' onclick="return confirm(\''.$this->l('This action will permanently remove the module from the server. Are you sure you want to do this ?').'\');" href="'.$currentIndex.'&deleteModule='.urlencode($module->name).'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.urlencode($module->name).'">'.$this->l('Delete').'</a>&nbsp;&nbsp;';
  780. return $return;
  781. }
  782. public function isFresh($timeout = 604800000)
  783. {
  784. if (file_exists($this->_moduleCacheFile))
  785. return ((time() - filemtime($this->_moduleCacheFile)) < $timeout);
  786. else
  787. return false;
  788. }
  789. public function refresh()
  790. {
  791. return file_put_contents($this->_moduleCacheFile, Tools::file_get_contents('http://www.prestashop.com/xml/modules_list.xml'));
  792. }
  793. public function displaySelectedFilter()
  794. {
  795. global $cookie;
  796. $selected_filter = '';
  797. $id_employee = (int)($cookie->id_employee);
  798. $showTypeModules = Configuration::get('PS_SHOW_TYPE_MODULES_'.(int)($cookie->id_employee));
  799. $showInstalledModules = Configuration::get('PS_SHOW_INSTALLED_MODULES_'.(int)($cookie->id_employee));
  800. $showEnabledModules = Configuration::get('PS_SHOW_ENABLED_MODULES_'.(int)($cookie->id_employee));
  801. $showCountryModules = Configuration::get('PS_SHOW_COUNTRY_MODULES_'.(int)($cookie->id_employee));
  802. $selected_filter .= ($showTypeModules == 'allModules' ? $this->l('All Modules').' - ' : '').
  803. ($showTypeModules == 'nativeModules' ? $this->l('Native Modules').' - ' : '').
  804. ($showTypeModules == 'partnerModules' ? $this->l('Partners Modules').' - ' : '').
  805. ($showTypeModules == 'otherModules' ? $this->l('Others Modules').' - ' : '').
  806. ($showInstalledModules == 'installedUninstalled' ? $this->l('Installed & Uninstalled').' - ' : '').
  807. ($showInstalledModules == 'installed' ? $this->l('Installed Modules').' - ' : '').
  808. ($showInstalledModules == 'unistalled' ? $this->l('Uninstalled Modules').' - ' : '').
  809. ($showEnabledModules == 'enabledDisabled' ? $this->l('Enabled & Disabled').' - ' : '').
  810. ($showEnabledModules == 'enabled' ? $this->l('Enabled Modules').' - ' : '').
  811. ($showEnabledModules == 'disabled' ? $this->l('Disabled Modules').' - ' : '').
  812. ($showCountryModules === 1 ? $this->l('Current country:').' '.$nameCountryDefault.' - ' : '').
  813. ($showCountryModules === 0 ? $this->l('All countries').' - ' : '');
  814. if (strlen($selected_filter) != 0)
  815. $selected_filter = '<div class="hint" style="display:block;background:#DDE9F7 no-repeat 6px 5px url(../img/admin/filter.png);"><b>'.$this->l('Selected filters').' : </b>'.rtrim($selected_filter, ' - ').'</div>';
  816. return $selected_filter;
  817. }
  818. private function setFilterModules($module_type, $country_module_value, $module_install, $module_status)
  819. {
  820. global $cookie;
  821. Configuration::updateValue('PS_SHOW_TYPE_MODULES_'.(int)($cookie->id_employee), $module_type);
  822. Configuration::updateValue('PS_SHOW_COUNTRY_MODULES_'.(int)($cookie->id_employee), $country_module_value);
  823. Configuration::updateValue('PS_SHOW_INSTALLED_MODULES_'.(int)($cookie->id_employee), $module_install);
  824. Configuration::updateValue('PS_SHOW_ENABLED_MODULES_'.(int)($cookie->id_employee), $module_status);
  825. }
  826. private function resetFilterModules()
  827. {
  828. global $cookie;
  829. Configuration::updateValue('PS_SHOW_TYPE_MODULES_'.(int)($cookie->id_employee), 'allModules');
  830. Configuration::updateValue('PS_SHOW_COUNTRY_MODULES_'.(int)($cookie->id_employee), 0);
  831. Configuration::updateValue('PS_SHOW_INSTALLED_MODULES_'.(int)($cookie->id_employee), 'installedUninstalled');
  832. Configuration::updateValue('PS_SHOW_ENABLED_MODULES_'.(int)($cookie->id_employee), 'enabledDisabled');
  833. }
  834. }