Skip to content

Commit

Permalink
// Added a second secure mode for modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Damien Metzger committed Jun 9, 2014
1 parent 46b208b commit a658c6e
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{*
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <[email protected]>
* @copyright 2007-2014 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}

{assign var=module_name value='<strong><span class="module-name-placeholder"></span></strong>'}
<div class="modal-body">
<div class="alert alert-danger">
<h4>{l s='The module "%s" could not be identified securely by PrestaShop.' sprintf=$module_name}</h4>
<p>
{l s='This generally happens when the module is not distributed through our official marketplace, PrestaShop Addons - or when your server failed to communicate with PrestaShop Addons.'}
{l s='Since you did not download the module from PrestaShop Addons, we cannot assert that the module is safe (i.e. that it is not adding some undisclosed functionality like backdoors, ads, hidden links, spam, etc.).'}
</p>
</div>
<h3>{l s='What Should I Do?'}</h3>
<p>{l s='You can look for similar modules on the official marketplace.'} <a class="catalog-link" target="_blank" href="#">{l s='Click here to browse PrestaShop Addons.'}</a></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{l s='Back to safety'}</button>
</div>
7 changes: 4 additions & 3 deletions controllers/admin/AdminModulesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,8 @@ public function postProcessCallback()
$this->errors[] = Tools::displayError('You do not have permission to access this module.');
elseif ($key == 'install' && $this->tabAccess['add'] !== '1')
$this->errors[] = Tools::displayError('You do not have permission to install this module.');
elseif ($key == 'install' && defined('_PS_HOST_MODE_') && _PS_HOST_MODE_ && !Module::isModuleTrusted($module->name))
$this->errors[] = Tools::displayError('You do not have permission to install this module.');
elseif ($key == 'delete' && ($this->tabAccess['delete'] !== '1' || !$module->getPermission('configure')))
$this->errors[] = Tools::displayError('You do not have permission to delete this module.');
elseif ($key == 'configure' && ($this->tabAccess['edit'] !== '1' || !$module->getPermission('configure') || !Module::isInstalled(urldecode($name))))
Expand Down Expand Up @@ -1261,17 +1263,16 @@ public function initModal()
'module_languages' => Language::getLanguages(false),
'module_name' => Tools::getValue('module_name'),
));

$modal_content = $this->context->smarty->fetch('controllers/modules/modal_translation.tpl');

$this->modals[] = array(
'modal_id' => "moduleTradLangSelect",
'modal_class' => "modal-sm",
'modal_title' => $this->l('Translate this module'),
'modal_content' => $modal_content
);

$modal_content = $this->context->smarty->fetch('controllers/modules/modal_not_trusted.tpl');

$modal_content = $this->context->smarty->fetch('controllers/modules/'.((defined('_PS_HOST_MODE_') && _PS_HOST_MODE_) ? 'modal_not_trusted_blocked.tpl' : 'modal_not_trusted.tpl'));
$this->modals[] = array(
'modal_id' => "moduleNotTrusted",
'modal_class' => "modal-lg",
Expand Down

0 comments on commit a658c6e

Please sign in to comment.