// Merge -> revision 9435

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9438 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-10-19 08:14:42 +00:00
parent 43958d54e7
commit 42564ca3d0
35 changed files with 853 additions and 572 deletions
+7 -2
View File
@@ -35,8 +35,13 @@ $errors = array();
$id_lang = (int)Configuration::get('PS_LANG_DEFAULT');
$iso = strtolower(Language::getIsoById((int)$id_lang));
include(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php');
if (isset($_POST['Submit']))
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
{
$errors[] = Tools::displayError('This functionnality has been disabled.');
}
/* PrestaShop demo mode*/
else if (isset($_POST['Submit']))
{
$errors = array();
if (empty($_POST['email']))
+37 -29
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -31,7 +31,7 @@ class AdminAccess extends AdminTab
{
private $return_status;
private $return_message;
public function processSubmitAddAccess()
{
$perm = Tools::getValue('perm') ;
@@ -39,7 +39,7 @@ class AdminAccess extends AdminTab
throw new PrestashopException('permission not exists');
$enabled = (int)Tools::getValue('enabled') ;
$id_tab = (int)(Tools::getValue('id_tab'));
$id_tab = (int)(Tools::getValue('id_tab'));
$id_profile = (int)(Tools::getValue('id_profile'));
$res = true;
@@ -53,7 +53,7 @@ class AdminAccess extends AdminTab
$res &= Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'access` SET `view` = '.$enabled.', `add` = '.$enabled.', `edit` = '.$enabled.', `delete` = '.$enabled.' WHERE `id_tab` = '.(int)($id_tab).' AND `id_profile` = '.(int)($id_profile));
else
$res &= Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'access` SET `'.pSQL($perm).'` = '.$enabled.' WHERE `id_tab` = '.(int)($id_tab).' AND `id_profile` = '.(int)($id_profile));
$this->return_status = $res?'ok':'error';
if ($res)
$this->return_message = $this->l('Access successfully updated');
@@ -71,24 +71,24 @@ class AdminAccess extends AdminTab
if (!in_array($perm, array('view', 'configure')))
throw new PrestashopException('permission not exists');
if ($id_module == -1)
$res &= Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'module_access` SET `'.pSQL($perm).'` = '.(int)$enabled.' WHERE `id_profile` = '.(int)$id_profile);
else
$res &= Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'module_access` SET `'.pSQL($perm).'` = '.(int)$enabled.' WHERE `id_module` = '.(int)$id_module.' AND `id_profile` = '.(int)$id_profile);
$this->return_status = $res?'ok':'error';
if ($res)
$this->return_message = $this->l('Access successfully updated.');
else
$this->return_message = $this->l('An error when updating access.');
}
public function displayAjax()
{
$return = array('result'=>$this->return_status,'msg'=>$this->return_message);
echo Tools::jsonEncode($return);
}
public function display()
@@ -97,16 +97,16 @@ class AdminAccess extends AdminTab
echo '<script type="text/javascript">
$(document).ready(function(){
$(".ajaxPower").change(function(){
var tout = $(this).attr("rel").split("||");
var tout = $(this).attr("rel").split("||");
var id_tab = tout[0];
var id_profile = tout[1];
var perm = tout[2];
var enabled = $(this).is(":checked")? 1 : 0;
var tabsize = tout[3];
var tabnumber = tout[4];
perfect_access_js_gestion(this, perm, id_tab, tabsize, tabnumber);
$.ajax({
type:"POST",
url : "ajax-tab.php",
@@ -139,9 +139,9 @@ class AdminAccess extends AdminTab
});
});
});</script>';
}
/**
* Get the current profile id
*
@@ -151,7 +151,7 @@ class AdminAccess extends AdminTab
{
return (isset($_GET['profile']) AND !empty($_GET['profile']) AND is_numeric($_GET['profile'])) ? (int)($_GET['profile']) : 1;
}
public function displayForm($isMainTab = true)
{
parent::displayForm();
@@ -159,7 +159,7 @@ class AdminAccess extends AdminTab
$tabs = Tab::getTabs($this->context->language->id);
$profiles = Profile::getProfiles($this->context->language->id);
$accesses = Profile::getProfileAccesses($currentProfile);
echo '
<script type="text/javascript">
setLang(Array(\''.$this->l('Profile updated').'\', \''.$this->l('Request failed!').'\', \''.$this->l('Update in progress. Please wait.').'\', \''.$this->l('Server connection failed!').'\'));
@@ -178,7 +178,7 @@ class AdminAccess extends AdminTab
$tabsize = $tab['id_tab'];
echo ' </select>
</th>';
if ($currentProfile != (int)(_PS_ADMIN_PROFILE_))
echo '
<th class="center">
@@ -192,17 +192,17 @@ class AdminAccess extends AdminTab
'.$this->l('Add').'
</th>
<th class="center">
<input type="checkbox" name="1" id="editall"
<input type="checkbox" name="1" id="editall"
'.($this->tabAccess['edit'] == 1 ? ' rel="-1||'.$currentProfile.'||edit||'.$tabsize.'||'.sizeof($tabs).'" class="ajaxPower"' : 'disabled="disabled"').' />
'.$this->l('Edit').'
</th>
<th class="center">
<input type="checkbox" name="1" id="deleteall"
<input type="checkbox" name="1" id="deleteall"
'.($this->tabAccess['edit'] == 1 ? ' rel="-1||'.$currentProfile.'||delete||'.$tabsize.'||'.sizeof($tabs).'" class="ajaxPower"' : 'disabled="disabled"').' />
'.$this->l('Delete').'
</th>
<th class="center">
<input type="checkbox" name="1" id="allall"
<input type="checkbox" name="1" id="allall"
'.($this->tabAccess['edit'] == 1 ? ' rel="-1||'.$currentProfile.'||all||'.$tabsize.'||'.sizeof($tabs).'" class="ajaxPower"' : 'disabled="disabled"').' />
'.$this->l('All').'
</th>
@@ -212,7 +212,7 @@ class AdminAccess extends AdminTab
echo '<tr><td colspan="5">'.$this->l('No tab').'</td></tr>';
elseif ($currentProfile == (int)(_PS_ADMIN_PROFILE_))
echo '<tr><td colspan="5">'.$this->l('Administrator permissions can\'t be modified.').'</td></tr>';
else
else
foreach ($tabs AS $tab)
if (!$tab['id_parent'] OR (int)($tab['id_parent']) == -1)
{
@@ -221,17 +221,17 @@ class AdminAccess extends AdminTab
if ($child['id_parent'] === $tab['id_tab'])
if (isset($accesses[$child['id_tab']]))
{
$this->printTabAccess($currentProfile, $child, $accesses[$child['id_tab']], true, $tabsize, sizeof($tabs));
}
}
echo '</table>';
if ($currentProfile != (int)(_PS_ADMIN_PROFILE_))
$this->displayModuleAccesses($currentProfile);
echo '<div class="clear">&nbsp;</div>';
}
private function printTabAccess($currentProfile, $tab, $access, $is_child, $tabsize, $tabnumber)
{
$result_accesses = 0;
@@ -252,9 +252,17 @@ class AdminAccess extends AdminTab
/>
</td></tr>';
}
public function ajaxProcess()
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
{
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
return;
}
/* PrestaShop demo mode*/
if ($this->tabAccess['edit'] == 1)
{
if (Tools::isSubmit('submitAddaccess'))
@@ -263,7 +271,7 @@ class AdminAccess extends AdminTab
$this->processChangeModuleAccess();
}
}
private function displayModuleAccesses($currentProfile)
{
echo '
@@ -274,7 +282,7 @@ class AdminAccess extends AdminTab
var id_module = tout[0];
var perm = tout[1];
var enabled = $(this).is(":checked")? 1 : 0;
if (id_module == -1)
$(\'.ajax-ma-\'+perm).each(function(key, value) {
$(this).attr("checked", enabled);
@@ -316,7 +324,7 @@ class AdminAccess extends AdminTab
});
});
});
</script>
</script>
<table class="table float" cellspacing="0" style="margin-left:20px">
<tr>
<th>'.$this->l('Modules').'</th>
@@ -332,7 +340,7 @@ class AdminAccess extends AdminTab
ORDER BY m.name');
if (!sizeof($modules))
echo '<tr><td colspan="2">'.$this->l('No modules installed').'</td></tr>';
else
else
foreach ($modules AS $module)
echo '<tr>
<td>&raquo; '.$module['name'].'</td>
+7
View File
@@ -50,6 +50,13 @@ class AdminAttachments extends AdminTab
public function postProcess()
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
{
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
return;
}
/* PrestaShop demo mode*/
if (Tools::isSubmit('submitAdd'.$this->table))
{
if ($id = (int)(Tools::getValue('id_attachment')) AND $a = new Attachment($id))
+8
View File
@@ -54,6 +54,14 @@ class AdminDb extends AdminPreferences
public function postProcess()
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
{
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
return;
}
/* PrestaShop demo mode*/
if (isset($_POST['submitDatabase'.$this->table]))
{
if ($this->tabAccess['edit'] === '1')
+9
View File
@@ -66,6 +66,14 @@ class AdminEmails extends AdminPreferences
public function beforeUpdateOptions()
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
{
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
return;
}
/* PrestaShop demo mode*/
if ($_POST['PS_MAIL_METHOD'] == 2 AND (empty($_POST['PS_MAIL_SERVER']) OR empty($_POST['PS_MAIL_SMTP_PORT'])))
$this->_errors[] = Tools::displayError('You must define a SMTP server and a SMTP port. If you do not know, use the PHP mail() function instead.');
}
@@ -73,6 +81,7 @@ class AdminEmails extends AdminPreferences
public function display()
{
parent::display();
$this->_displayMailTest();
}
+15 -7
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -29,17 +29,17 @@ class AdminEmployees extends AdminTab
{
/** @var array profiles list */
private $profilesArray = array();
public function __construct()
{
$this->context = Context::getContext();
$this->table = 'employee';
$this->className = 'Employee';
$this->lang = false;
$this->edit = true;
$this->edit = true;
$this->delete = true;
$this->_select = 'pl.`name` AS profile';
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'profile` p ON a.`id_profile` = p.`id_profile`
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'profile` p ON a.`id_profile` = p.`id_profile`
LEFT JOIN `'._DB_PREFIX_.'profile_lang` pl ON (pl.`id_profile` = p.`id_profile` AND pl.`id_lang` = '.(int)$this->context->language->id.')';
$profiles = Profile::getProfiles($this->context->language->id);
@@ -53,7 +53,7 @@ class AdminEmployees extends AdminTab
'id_employee' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'lastname' => array('title' => $this->l('Last name'), 'width' => 130),
'firstname' => array('title' => $this->l('First name'), 'width' => 130),
'email' => array('title' => $this->l('E-mail address'), 'width' => 180),
'email' => array('title' => $this->l('E-mail address'), 'width' => 180),
'profile' => array('title' => $this->l('Profile'), 'width' => 90, 'type' => 'select', 'select' => $this->profilesArray, 'filter_key' => 'pl!name'),
'active' => array('title' => $this->l('Can log in'), 'align' => 'center', 'active' => 'status', 'type' => 'bool'),
);
@@ -98,7 +98,7 @@ class AdminEmployees extends AdminTab
var employeePage = true;
</script>
<form action="'.self::$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.((int)$this->tabAccess['view'] ? '' : '&updateemployee&id_employee='.(int)$obj->id).'" method="post" enctype="multipart/form-data" autocomplete="off">
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
'.((int)$this->tabAccess['view'] ? '' : '<input type="hidden" name="back" value="'.self::$currentIndex.'&token='.$this->token.'&updateemployee&id_employee='.(int)$obj->id.'" />').'
@@ -184,7 +184,7 @@ class AdminEmployees extends AdminTab
$(\'select[name=id_profile]\').change(function(){
ifSuperAdmin($(this));
});
ifSuperAdmin($(\'select[name=id_profile]\'));
});
@@ -220,6 +220,14 @@ class AdminEmployees extends AdminTab
$this->context = Context::getContext();
if (Tools::isSubmit('deleteemployee') || Tools::isSubmit('status') || Tools::isSubmit('statusemployee'))
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_ && $id_employee = Tools::getValue('id_employee') && (int)$id_employee == _PS_DEMO_MAIN_BO_ACCOUNT_)
{
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
return;
}
/* PrestaShop demo mode*/
if ($this->context->employee->id == Tools::getValue('id_employee'))
{
$this->_errors[] = Tools::displayError('You cannot disable or delete your own account.');
+9
View File
@@ -1732,6 +1732,7 @@ class AdminImport extends AdminTab
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'specific_price');
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'specific_price_priority');
Image::deleteAllImages(_PS_PROD_IMG_DIR_);
mkdir(_PS_PROD_IMG_DIR_);
break;
case $this->entities[$this->l('Customers')]:
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'customer');
@@ -1770,6 +1771,14 @@ class AdminImport extends AdminTab
public function postProcess()
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
{
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
return;
}
/* PrestaShop demo mode*/
if (Tools::isSubmit('submitFileUpload'))
{
if (isset($_FILES['file']) AND !empty($_FILES['file']['error']))
+14
View File
@@ -223,6 +223,13 @@ class AdminModules extends AdminTab
/* Automatically copy a module from external URL and unarchive it in the appropriated directory */
if (Tools::isSubmit('submitDownload'))
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
{
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
return;
}
/* PrestaShop demo mode*/
if ($this->tabAccess['add'] === '1')
{
if (Validate::isModuleUrl($url = Tools::getValue('url'), $this->_errors))
@@ -238,6 +245,13 @@ class AdminModules extends AdminTab
}
if (Tools::isSubmit('submitDownload2'))
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
{
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
return;
}
/* PrestaShop demo mode*/
if ($this->tabAccess['add'] === '1')
{
if (!isset($_FILES['file']['tmp_name']) OR empty($_FILES['file']['tmp_name']))
+8
View File
@@ -50,6 +50,14 @@ class AdminProfiles extends AdminTab
public function postProcess()
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
{
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
return;
}
/* PrestaShop demo mode*/
if (isset($_GET['delete'.$this->table]) AND $_GET[$this->identifier] == (int)(_PS_ADMIN_PROFILE_))
$this->_errors[] = $this->l('For security reasons, you cannot delete the Administrator profile');
else
+8
View File
@@ -55,6 +55,14 @@ class AdminTabs extends AdminTab
public function postProcess()
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
{
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
return;
}
/* PrestaShop demo mode*/
if (($id_tab = (int)(Tools::getValue('id_tab'))) AND ($direction = Tools::getValue('move')) AND Validate::isLoadedObject($tab = new Tab($id_tab)))
{
if ($tab->move($direction))
+8
View File
@@ -424,6 +424,14 @@ class AdminTranslations extends AdminTab
public function postProcess()
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_)
{
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
return;
}
/* PrestaShop demo mode*/
if (Tools::isSubmit('submitCopyLang'))
{
if ($this->tabAccess['add'] === '1')