//fix correction norm in SQL manager

This commit is contained in:
lLefevre
2011-09-28 07:10:24 +00:00
parent 43575ba605
commit 3f5e26ab40
9 changed files with 2263 additions and 248 deletions

View File

@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -24,49 +24,56 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
define('PS_ADMIN_DIR', getcwd());
include(PS_ADMIN_DIR.'/../config/config.inc.php');
include(PS_ADMIN_DIR.'/functions.php');
$file = 'request_sql_'.Tools::getValue('id_request_sql').'.csv';
if ($csv = fopen(PS_ADMIN_DIR.'/export/'.$file, 'w'))
if ($id = Tools::getValue('id_request_sql'))
{
$sql = RequestSql::getRequestSqlById(Tools::getValue('id_request_sql'));
if ($sql)
$file = 'request_sql_'.$id.'.csv';
if ($csv = fopen(PS_ADMIN_DIR.'/export/'.$file, 'w'))
{
$results = Db::getInstance()->ExecuteS($sql[0]['sql']);
foreach (array_keys($results[0]) as $key)
$sql = RequestSql::getRequestSqlById($id);
if ($sql)
{
$tab_key[] = $key;
fputs($csv, $key.';');
}
foreach ($results as $result)
{
fputs($csv, "\n");
foreach ($tab_key as $name)
fputs($csv, $result[$name].';');
}
if (file_exists(PS_ADMIN_DIR.'/export/'.$file))
{
$filesize = filesize(PS_ADMIN_DIR.'/export/'.$file);
$upload_max_filesize = return_bytes(ini_get('upload_max_filesize'));
if ($filesize < $upload_max_filesize)
$results = Db::getInstance()->ExecuteS($sql[0]['sql']);
foreach (array_keys($results[0]) as $key)
{
header("Content-type: text/csv");
header("Cache-Control: no-store, no-cache");
header("Content-Disposition: attachment; filename=\"$file\"");
header("Content-Length: ".$filesize);
readfile(PS_ADMIN_DIR.'/export/'.$file);
die();
$tab_key[] = $key;
fputs($csv, $key.';');
}
else
foreach ($results as $result)
{
header('Location: '.$_SERVER['HTTP_REFERER'].'&maxsize=1');
die();
fputs($csv, "\n");
foreach ($tab_key as $name)
fputs($csv, '"'.Tools::safeOutput($result[$name]).'";');
}
if (file_exists(PS_ADMIN_DIR.'/export/'.$file))
{
$filesize = filesize(PS_ADMIN_DIR.'/export/'.$file);
$upload_max_filesize = returnBytes(ini_get('upload_max_filesize'));
if ($filesize < $upload_max_filesize)
{
header('Content-type: text/csv');
header('Cache-Control: no-store, no-cache');
header('Content-Disposition: attachment; filename="$file"');
header('Content-Length: '.$filesize);
readfile(PS_ADMIN_DIR.'/export/'.$file);
die();
}
else
{
header('Location: '.$_SERVER['HTTP_REFERER'].'&maxsize=1');
die();
}
}
}
else
{
header('Location: '.$_SERVER['HTTP_REFERER']);
die();
}
}
else
@@ -81,13 +88,12 @@ else
die();
}
function return_bytes($val)
function returnBytes($val)
{
$val = trim($val);
$last = strtolower($val[strlen($val)-1]);
$last = strtolower($val[strlen($val) - 1]);
switch ($last)
{
// Le modifieur 'G' est disponible depuis PHP 5.1.0
{
case 'g':
$val *= 1024;
case 'm':
@@ -95,6 +101,5 @@ function return_bytes($val)
case 'k':
$val *= 1024;
}
return $val;
}

View File

@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -27,7 +27,7 @@
class AdminRequestSql extends AdminTab
{
public function __construct()
{
$this->table = 'request_sql';
@@ -44,7 +44,7 @@ class AdminRequestSql extends AdminTab
);
parent::__construct();
}
public function displayList()
{
return parent::displayList();
@@ -52,44 +52,44 @@ class AdminRequestSql extends AdminTab
public function displayTop()
{
echo
'<div class="hint clear" style="display:block;">'.
'&nbsp;<b>'.$this->l('How to create a new sql query?').'</b>'.
'<br />'.
'<ul>'.'
<li>'.$this->l('Click "Add new".').'<br />'.'</li>
echo '<div class="hint clear" style="display:block;">
&nbsp;<b>'.$this->l('How to create a new sql query?').'</b>
<br />
<ul>
<li>'.$this->l('Click "Add new".').'<br /></li>
<li>'.$this->l('Fill in the fields and click "Save".').'</li>
<li>'.$this->l('You can then view the query results by clicking on the tab: ').' <img src="../img/admin/details.gif"></li>
<li>'.$this->l('You can then export the query results as a file. Csv file by clicking on the tab: ').' <img src="../img/admin/export.gif"></li>
</ul>
</div><br />
<div class="warn"><img src="../img/admin/warn2.png">'.$this->l('Warning: when saving the query, only the request type "SELECT" are allowed.').'</div>';
<div class="warn"><img src="../img/admin/warn2.png">'.$this->l('Warning: when saving the query, only the request type "SELECT" are allowed.').
'</div>';
if (isset($_GET['maxsize']))
{
echo '<div class="error"><img src="../img/admin/error2.png">'.$this->l('The file is too large and can not be downloaded. Please use the clause "LIMIT" in this query.').'</div>';
}
echo '<div class="error"><img src="../img/admin/error2.png">'.
$this->l('The file is too large and can not be downloaded. Please use the clause "LIMIT" in this query.').'</div>';
}
public function displayForm($isMainTab = true)
{
parent::displayForm();
if (!($obj = $this->loadObject(true)))
return;
echo '
<div class="warn"><img src="../img/admin/warn2.png">'.$this->l('Warning: when saving the query, only the request type "SELECT" are allowed.').'</div>
<div class="warn"><img src="../img/admin/warn2.png">'.$this->l('Warning: when saving the query, only the request type "SELECT" are allowed.').
'</div>
<form action="'.self::$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post">
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
<fieldset><legend><img src="../img/admin/subdomain.gif" /> '.$this->l('Request').'</legend>
<label>'.$this->l('Name:').' </label>
<label>'.$this->l('Name:').' <sup>*</sup></label>
<div class="margin-form">
<textarea name="name" cols="100" rows="10">'.$this->getFieldValue($obj, 'name').'</textarea><sup>*</sup>
<input type="text" name="name" value="'.$this->getFieldValue($obj, 'name').'" size="103" />
</div>
<label>'.$this->l('Request:').' </label>
<label>'.$this->l('Request:').' <sup>*</sup></label>
<div class="margin-form">
<textarea name="sql" cols="100" rows="10">'.$this->getFieldValue($obj, 'sql').'</textarea><sup>*</sup>
<textarea name="sql" cols="100" rows="10">'.$this->getFieldValue($obj, 'sql').'</textarea>
</div>
<div class="margin-form">
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
@@ -98,20 +98,20 @@ class AdminRequestSql extends AdminTab
</fieldset>
</form>';
}
public function postProcess()
{
if (!($obj = $this->loadObject(true)))
return;
$result = Db::getInstance()->ExecuteS('
SELECT `id_request_sql`
FROM `'._DB_PREFIX_.'request_sql`
');
if (sizeof($result) === 1)
foreach ($result AS $row)
if (count($result) === 1)
foreach ($result as $row)
$this->_listSkipDelete = array($row['id_request_sql']);
return parent::postProcess();
}
@@ -119,26 +119,27 @@ class AdminRequestSql extends AdminTab
{
if (Tools::getValue('submitAdd'.$this->table) && $sql = Tools::getValue('sql'))
{
$requestSql = new RequestSql();
$parser = $requestSql->parsingSql($sql);
$validate = $requestSql->validateSql($parser, false, $sql);
if (!$validate || !empty($requestSql->errorSql))
$this->_DisplayError($requestSql->errorSql);
$request_sql = new RequestSql();
$parser = $request_sql->parsingSql($sql);
$validate = $request_sql->validateParser($parser, false, $sql);
if (!$validate || !empty($request_sql->error_sql))
$this->displayError($request_sql->error_sql);
}
}
public function _DisplayError($e)
public function displayError($e)
{
foreach(array_keys($e) as $key)
foreach (array_keys($e) as $key)
{
switch($key)
switch ($key)
{
case 'checkedFrom':
if (isset($e[$key]['table']))
$this->_errors[] = Tools::DisplayError($this->l('The Table ').' "'.$e[$key]['table'].'" '.$this->l(' doesn\'t exist.'));
else if (isset($e[$key]['attribut']))
$this->_errors[] = Tools::DisplayError($this->l('The attribute ').' "'.$e[$key]['attribut'][0].'" '.$this->l(' does not exist in the following tables: ').$e[$key]['attribut'][1].'.');
$this->_errors[] = Tools::DisplayError($this->l('The attribute ').' "'.
$e[$key]['attribut'][0].'" '.$this->l(' does not exist in the table: ').$e[$key]['attribut'][1].'.');
else
$this->_errors[] = Tools::DisplayError($this->l('Error'));
break;
@@ -146,7 +147,8 @@ class AdminRequestSql extends AdminTab
if (isset($e[$key]['table']))
$this->_errors[] = Tools::DisplayError($this->l('The Table ').' "'.$e[$key]['table'].'" '.$this->l(' doesn\'t exist.'));
else if (isset($e[$key]['attribut']))
$this->_errors[] = Tools::DisplayError($this->l('The attribute ').' "'.$e[$key]['attribut'][0].'" '.$this->l(' does not exist in the following tables: ').$e[$key]['attribut'][1].'.');
$this->_errors[] = Tools::DisplayError($this->l('The attribute ').' "'.
$e[$key]['attribut'][0].'" '.$this->l(' does not exist in the table: ').$e[$key]['attribut'][1].'.');
else if (isset($e[$key]['*']))
$this->_errors[] = Tools::DisplayError($this->l('The operand "*" can be used in a nested query.'));
else
@@ -156,27 +158,31 @@ class AdminRequestSql extends AdminTab
if (isset($e[$key]['operator']))
$this->_errors[] = Tools::DisplayError($this->l('The operator ').' "'.$e[$key]['operator'].'" '.$this->l(' used is incorrect.'));
else if (isset($e[$key]['attribut']))
$this->_errors[] = Tools::DisplayError($this->l('The attribute ').' "'.$e[$key]['attribut'][0].'" '.$this->l(' does not exist in the following tables: ').$e[$key]['attribut'][1].'.');
$this->_errors[] = Tools::DisplayError($this->l('The attribute ').' "'.
$e[$key]['attribut'][0].'" '.$this->l(' does not exist in the table: ').$e[$key]['attribut'][1].'.');
else
$this->_errors[] = Tools::DisplayError($this->l('Error'));
break;
case 'checkedHaving':
if (isset($e[$key]['operator']))
$this->_errors[] = Tools::DisplayError($this->l('The operator ').' "'.$e[$key]['operator'].'" '.$this->l(' used is incorrect.'));
else if(isset($e[$key]['attribut']))
$this->_errors[] = Tools::DisplayError($this->l('The attribute ').' "'.$e[$key]['attribut'][0].'" '.$this->l(' does not exist in the following tables: ').$e[$key]['attribut'][1].'.');
else if (isset($e[$key]['attribut']))
$this->_errors[] = Tools::DisplayError($this->l('The attribute ').' "'.
$e[$key]['attribut'][0].'" '.$this->l(' does not exist in the table: ').$e[$key]['attribut'][1].'.');
else
$this->_errors[] = Tools::DisplayError($this->l('Error'));
break;
case 'checkedOrder':
if(isset($e[$key]['attribut']))
$this->_errors[] = Tools::DisplayError($this->l('The attribute ').' "'.$e[$key]['attribut'][0].'" '.$this->l(' does not exist in the following tables: ').$e[$key]['attribut'][1].'.');
if (isset($e[$key]['attribut']))
$this->_errors[] = Tools::DisplayError($this->l('The attribute ').' "'.
$e[$key]['attribut'][0].'" '.$this->l(' does not exist in the table: ').$e[$key]['attribut'][1].'.');
else
$this->_errors[] = Tools::DisplayError($this->l('Error'));
break;
case 'checkedGroupBy':
if(isset($e[$key]['attribut']))
$this->_errors[] = Tools::DisplayError($this->l('The attribute ').' "'.$e[$key]['attribut'][0].'" '.$this->l(' does not exist in the following tables: ').$e[$key]['attribut'][1].'.');
if (isset($e[$key]['attribut']))
$this->_errors[] = Tools::DisplayError($this->l('The attribute ').' "'.
$e[$key]['attribut'][0].'" '.$this->l(' does not exist in the table: ').$e[$key]['attribut'][1].'.');
else
$this->_errors[] = Tools::DisplayError($this->l('Error'));
break;
@@ -184,8 +190,9 @@ class AdminRequestSql extends AdminTab
$this->_errors[] = Tools::DisplayError($this->l('The LIMIT clause must contain numeric arguments.'));
break;
case 'returnNameTable':
if(isset($e[$key]['reference']))
$this->_errors[] = Tools::DisplayError($this->l('The reference ').'"'.$e[$key]['reference'][0].'"'.$this->l(' doesn\'t exist in : ').$e[$key]['reference'][1]);
if (isset($e[$key]['reference']))
$this->_errors[] = Tools::DisplayError($this->l('The reference ').'"'.
$e[$key]['reference'][0].'"'.$this->l(' doesn\'t exist in : ').$e[$key]['reference'][1]);
else
$this->_errors[] = Tools::DisplayError($this->l('When multiple tables are used, each attribute must be referenced to a table.'));
break;
@@ -195,19 +202,20 @@ class AdminRequestSql extends AdminTab
case 'testedUnauthorized':
$this->_errors[] = Tools::DisplayError($e[$key].' '.$this->l(' is a unauthorized keyword.'));
break;
default:
default:
break;
}
}
}
public function viewRequest_sql()
{
if (!($obj = $this->loadObject(true)))
return;
echo '<h2>'.$obj->name.'</h2>';
if($results = Db::getInstance()->ExecuteS($obj->sql))
if ($results = Db::getInstance()->ExecuteS($obj->sql))
{
$tab_key = array();
foreach (array_keys($results[0]) as $key)
@@ -215,15 +223,22 @@ class AdminRequestSql extends AdminTab
echo '
<table cellpadding="0" cellspacing="0" class="table" id="viewRequestSql">
<tr>';
foreach ($tab_key as $keyName)
echo '<th align="center">'.$keyName.'</th>';
foreach ($tab_key as $key_name)
echo '<th align="center">'.$key_name.'</th>';
echo '
</tr>';
$request_sql = new RequestSql();
$attributes = $request_sql->attributes;
foreach ($results as $result)
{
echo '<tr>';
foreach ($tab_key as $name)
echo '<td>'.$result[$name].'</td>';
{
if (!isset($attributes[$name]))
echo '<td>'.Tools::safeOutput($result[$name]).'</td>';
else
echo '<td>'.$attributes[$name].'</td>';
}
echo '</tr>';
}
echo '
@@ -231,7 +246,7 @@ class AdminRequestSql extends AdminTab
<script type="text/javascript">
$(function(){
var width = $("#viewRequestSql").width();
if(width > 990){
if (width > 990){
$("#viewRequestSql").css("display","block").css("overflow-x","scroll");
}
});
@@ -240,7 +255,10 @@ class AdminRequestSql extends AdminTab
echo '<br /><br /><a href="'.((Tools::getValue('back')) ? Tools::getValue('back') : self::$currentIndex.'&token='.$this->token).'"><img src="../img/admin/arrow2.gif" /> '.((Tools::getValue('back')) ? $this->l('Back') : $this->l('Back to list')).'</a><br />';
}
public function displayListContent($token = NULL)
/**
* Override displayListContent method for add a button "export"
*/
public function displayListContent($token = null)
{
/* Display results in a table
*
@@ -254,7 +272,7 @@ class AdminRequestSql extends AdminTab
$id_category = 1; // default categ
$irow = 0;
if ($this->_list AND isset($this->fieldsDisplay['position']))
if ($this->_list && isset($this->fieldsDisplay['position']))
{
$positions = array_map(create_function('$elem', 'return (int)($elem[\'position\']);'), $this->_list);
sort($positions);
@@ -265,7 +283,7 @@ class AdminRequestSql extends AdminTab
if (preg_match('/cms/Ui', $this->identifier))
$isCms = true;
$keyToGet = 'id_'.($isCms ? 'cms_' : '').'category'.(in_array($this->identifier, array('id_category', 'id_cms_category')) ? '_parent' : '');
foreach ($this->_list AS $tr)
foreach ($this->_list as $tr)
{
$id = $tr[$this->identifier];
echo '<tr'.(array_key_exists($this->identifier,$this->identifiersDnd) ? ' id="tr_'.(($id_category = (int)(Tools::getValue('id_'.($isCms ? 'cms_' : '').'category', '1'))) ? $id_category : '').'_'.$id.'_'.$tr['position'].'"' : '').($irow++ % 2 ? ' class="alt_row"' : '').' '.((isset($tr['color']) AND $this->colorOnBackground) ? 'style="background-color: '.$tr['color'].'"' : '').'>
@@ -273,28 +291,28 @@ class AdminRequestSql extends AdminTab
if ($this->delete AND (!isset($this->_listSkipDelete) OR !in_array($id, $this->_listSkipDelete)))
echo '<input type="checkbox" name="'.$this->table.'Box[]" value="'.$id.'" class="noborder" />';
echo '</td>';
foreach ($this->fieldsDisplay AS $key => $params)
foreach ($this->fieldsDisplay as $key => $params)
{
$tmp = explode('!', $key);
$key = isset($tmp[1]) ? $tmp[1] : $tmp[0];
echo '
<td '.(isset($params['position']) ? ' id="td_'.(isset($id_category) AND $id_category ? $id_category : 0).'_'.$id.'"' : '').' class="'.((!isset($this->noLink) OR !$this->noLink) ? 'pointer' : '').((isset($params['position']) AND $this->_orderBy == 'position')? ' dragHandle' : ''). (isset($params['align']) ? ' '.$params['align'] : '').'" ';
if (!isset($params['position']) AND (!isset($this->noLink) OR !$this->noLink))
<td '.(isset($params['position']) ? ' id="td_'.(isset($id_category) AND $id_category ? $id_category : 0).'_'.$id.'"' : '').' class="'.((!isset($this->noLink) || !$this->noLink) ? 'pointer' : '').((isset($params['position']) && $this->_orderBy == 'position')? ' dragHandle' : ''). (isset($params['align']) ? ' '.$params['align'] : '').'" ';
if (!isset($params['position']) && (!isset($this->noLink) || !$this->noLink))
echo ' onclick="document.location = \''.self::$currentIndex.'&'.$this->identifier.'='.$id.($this->view? '&view' : '&update').$this->table.'&token='.($token!=NULL ? $token : $this->token).'\'">'.(isset($params['prefix']) ? $params['prefix'] : '');
else
echo '>';
if (isset($params['active']) AND isset($tr[$key]))
if (isset($params['active']) && isset($tr[$key]))
$this->_displayEnableLink($token, $id, $tr[$key], $params['active'], Tools::getValue('id_category'), Tools::getValue('id_product'));
else if (isset($params['activeVisu']) AND isset($tr[$key]))
else if (isset($params['activeVisu']) && isset($tr[$key]))
echo '<img src="../img/admin/'.($tr[$key] ? 'enabled.gif' : 'disabled.gif').'"
alt="'.($tr[$key] ? $this->l('Enabled') : $this->l('Disabled')).'" title="'.($tr[$key] ? $this->l('Enabled') : $this->l('Disabled')).'" />';
else if (isset($params['position']))
{
if ($this->_orderBy == 'position' AND $this->_orderWay != 'DESC')
if ($this->_orderBy == 'position' && $this->_orderWay != 'DESC')
{
echo '<a'.(!($tr[$key] != $positions[sizeof($positions) - 1]) ? ' style="display: none;"' : '').' href="'.self::$currentIndex.
'&'.$keyToGet.'='.(int)($id_category).'&'.$this->identifiersDnd[$this->identifier].'='.$id.'
&way=1&position='.(int)($tr['position'] + 1).'&token='.($token!=NULL ? $token : $this->token).'">
&way=1&position='.(int)($tr['position'] + 1).'&token='.($token!=null ? $token : $this->token).'">
<img src="../img/admin/'.($this->_orderWay == 'ASC' ? 'down' : 'up').'.gif"
alt="'.$this->l('Down').'" title="'.$this->l('Down').'" /></a>';
@@ -325,7 +343,7 @@ class AdminRequestSql extends AdminTab
echo '<td class="center" '.(($name != $tr['shop_name']) ? 'title="'.$tr['shop_name'].'"' : '').'>'.$name.'</td>';
}
if ($this->edit OR $this->delete OR ($this->view AND $this->view !== 'noActionColumn'))
if ($this->edit || $this->delete || ($this->view && $this->view !== 'noActionColumn'))
{
echo '<td class="center" style="white-space: nowrap;">';
if ($this->export)
@@ -334,7 +352,7 @@ class AdminRequestSql extends AdminTab
$this->_displayViewLink($token, $id);
if ($this->edit)
$this->_displayEditLink($token, $id);
if ($this->delete AND (!isset($this->_listSkipDelete) OR !in_array($id, $this->_listSkipDelete)))
if ($this->delete && (!isset($this->_listSkipDelete) || !in_array($id, $this->_listSkipDelete)))
$this->_displayDeleteLink($token, $id);
if ($this->duplicate)
$this->_displayDuplicate($token, $id);
@@ -344,15 +362,14 @@ class AdminRequestSql extends AdminTab
}
}
}
protected function _displayExportLink($token = NULL, $id)
protected function _displayExportLink($token = null, $id)
{
$_cacheLang['export'] = $this->l('export');
echo '
<a href="requestSql.php?id_request_sql='.$id.'">
<img src="../img/admin/export.gif" alt="'.$_cacheLang['export'].'" title="'.$_cacheLang['export'].'" /></a>';
}
}

View File

@@ -36,15 +36,26 @@ class RequestSql extends ObjectModel
protected $table = 'request_sql';
protected $identifier = 'id_request_sql';
public $tested = array('required' => array ('SELECT', 'FROM'),
'option' => array('WHERE', 'ORDER', 'LIMIT', 'HAVING', 'GROUP'),
'operator' => array('AND', '&&', 'BETWEEN', 'AND', 'BINARY', '&', '~', '|', '^', 'CASE', 'WHEN', 'END', 'DIV', '/', '<=>', '=', '>=', '>', 'IS', 'NOT', 'NULL', '<<', '<=', '<', 'LIKE', '-', '%',
'!=', '<>', 'REGEXP', '!', '||', 'OR', '+', '>>', 'RLIKE', 'SOUNDS', '*', '-', 'XOR', 'IN'),
'function' => array('AVG', 'SUM', 'COUNT', 'MIN', 'MAX', 'STDDEV', 'STDDEV_SAMP', 'STDDEV_POP', 'VARIANCE', 'VAR_SAMP', 'VAR_POP', 'GROUP_CONCAT', 'BIT_AND', 'BIT_OR', 'BIT_XOR'),
'unauthorized' => array('DELETE', 'ALTER', 'INSERT', 'REPLACE', 'CREATE', 'TRUNCATE', 'OPTIMIZE', 'GRANT', 'REVOKE', 'SHOW', 'HANDLER', 'LOAD', 'ROLLBACK', 'SAVEPOINT', 'UNLOCK', 'INSTALL', 'UNINSTALL', 'ANALZYE', 'BACKUP', 'CHECK', 'CHECKSUM', 'REPAIR', 'RESTORE', 'CACHE', 'DESCRIBE', 'EXPLAIN', 'USE', 'HELP', 'SET', 'DUPLICATE', 'VALUES', 'INTO', 'RENAME', 'CALL', 'PROCEDURE', 'FUNCTION', 'DATABASE', 'SERVER', 'LOGFILE', 'DEFINER', 'RETURNS', 'EVENT', 'TABLESPACE', 'VIEW', 'TRIGGER', 'DATA', 'DO', 'PASSWORD', 'USER', 'PLUGIN', 'FLUSH', 'KILL', 'RESET', 'START', 'STOP', 'PURGE', 'EXECUTE', 'PREPARE', 'DEALLOCATE', 'LOCK', 'USING', 'DROP', 'FOR', 'UPDATE', "BEGIN", 'BY', 'ALL', 'SHARE', 'MODE', 'TO', 'KEY', 'DISTINCTROW', 'DISTINCT', 'HIGH_PRIORITY', 'LOW_PRIORITY', 'DELAYED', 'IGNORE', 'FORCE', 'STRAIGHT_JOIN', 'SQL_SMALL_RESULT', 'SQL_BIG_RESULT', 'QUICK', 'SQL_BUFFER_RESULT', 'SQL_CACHE', 'SQL_NO_CACHE', 'SQL_CALC_FOUND_ROWS', 'WITH'));
public $errorSql = array();
public $tested = array('required' => array ('SELECT', 'FROM'),
'option' => array('WHERE', 'ORDER', 'LIMIT', 'HAVING', 'GROUP', 'UNION'),
'operator' => array('AND', '&&', 'BETWEEN', 'AND', 'BINARY', '&', '~', '|', '^', 'CASE', 'WHEN', 'END', 'DIV', '/', '<=>', '=', '>=',
'>', 'IS', 'NOT', 'NULL', '<<', '<=', '<', 'LIKE', '-', '%', '!=', '<>', 'REGEXP', '!', '||', 'OR', '+', '>>', 'RLIKE', 'SOUNDS', '*',
'-', 'XOR', 'IN'),
'function' => array('AVG', 'SUM', 'COUNT', 'MIN', 'MAX', 'STDDEV', 'STDDEV_SAMP', 'STDDEV_POP', 'VARIANCE', 'VAR_SAMP', 'VAR_POP',
'GROUP_CONCAT', 'BIT_AND', 'BIT_OR', 'BIT_XOR'),
'unauthorized' => array('DELETE', 'ALTER', 'INSERT', 'REPLACE', 'CREATE', 'TRUNCATE', 'OPTIMIZE', 'GRANT', 'REVOKE', 'SHOW', 'HANDLER',
'LOAD', 'ROLLBACK', 'SAVEPOINT', 'UNLOCK', 'INSTALL', 'UNINSTALL', 'ANALZYE', 'BACKUP', 'CHECK', 'CHECKSUM', 'REPAIR', 'RESTORE', 'CACHE',
'DESCRIBE', 'EXPLAIN', 'USE', 'HELP', 'SET', 'DUPLICATE', 'VALUES', 'INTO', 'RENAME', 'CALL', 'PROCEDURE', 'FUNCTION', 'DATABASE', 'SERVER',
'LOGFILE', 'DEFINER', 'RETURNS', 'EVENT', 'TABLESPACE', 'VIEW', 'TRIGGER', 'DATA', 'DO', 'PASSWORD', 'USER', 'PLUGIN', 'FLUSH', 'KILL',
'RESET', 'START', 'STOP', 'PURGE', 'EXECUTE', 'PREPARE', 'DEALLOCATE', 'LOCK', 'USING', 'DROP', 'FOR', 'UPDATE', 'BEGIN', 'BY', 'ALL', 'SHARE',
'MODE', 'TO','KEY', 'DISTINCTROW', 'DISTINCT', 'HIGH_PRIORITY', 'LOW_PRIORITY', 'DELAYED', 'IGNORE', 'FORCE', 'STRAIGHT_JOIN',
'SQL_SMALL_RESULT', 'SQL_BIG_RESULT', 'QUICK', 'SQL_BUFFER_RESULT', 'SQL_CACHE', 'SQL_NO_CACHE', 'SQL_CALC_FOUND_ROWS', 'WITH'));
public $attributes = array('passwd' => '*******************',
'secure_key' => '*******************');
public $error_sql = array();
public function getFields()
{
@@ -56,41 +67,55 @@ class RequestSql extends ObjectModel
public static function getRequestSql()
{
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT `name` FROM `'._DB_PREFIX_.'request_sql` ORDER BY `id_request_sql`'))
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'request_sql` ORDER BY `id_request_sql`'))
return false;
$requestSql = array();
foreach ($result AS $row)
$requestSql[] = $row['sql'];
return $requestSql;
$request_sql = array();
foreach ($result as $row)
$request_sql[] = $row['sql'];
return $request_sql;
}
public static function getRequestSqlById($id)
{
return Db::getInstance()->ExecuteS(sprintf('SELECT `sql` FROM `'._DB_PREFIX_.'request_sql` WHERE `id_request_sql` = %s', $id));
return Db::getInstance()->ExecuteS(sprintf('SELECT `sql` FROM `'._DB_PREFIX_.'request_sql` WHERE `id_request_sql` = %d', $id));
}
public function parsingSql($sql)
{
return Tools::parserSQL($sql);
}
public function validateParser($tab, $in = false, $sql)
{
if (!$tab)
return false;
else if (isset($tab['UNION']))
{
$union = $tab['UNION'];
foreach ($union as $tab)
{
if (!$this->validateSql($tab, $in, $sql))
return false;
}
return true;
}
else
return $this->validateSql($tab, $in, $sql);
}
public function validateSql($tab, $in = false, $sql)
{
if(!$tab)
return false;
else if (!$this->testedRequired($tab))
if (!$this->testedRequired($tab))
return false;
else if (!$this->testedUnauthorized($tab))
return false;
else if (!$this->checkedFrom($tab['FROM']))
return false;
else if (!$this->checkedSelect($tab['SELECT'], $tab['FROM'], $in))
{
return false;
}
else if (isset($tab['WHERE']))
{
if (!$this->checkedWhere($tab['WHERE'], $tab['FROM'], $this->tested['operator'], $sql))
if (!$this->checkedWhere($tab['WHERE'], $tab['FROM'], $sql))
return false;
}
else if (isset($tab['HAVING']))
@@ -113,9 +138,9 @@ class RequestSql extends ObjectModel
if (!$this->checkedLimit($tab['LIMIT']))
return false;
}
if (empty($this->_errors))
if (@!Db::getInstance()->ExecuteS($sql))
if (!Db::getInstance()->ExecuteS($sql))
return false;
return true;
}
@@ -149,49 +174,41 @@ class RequestSql extends ObjectModel
if (preg_match('#^((`(\()?([a-z_])+`(\))?)|((\()?([a-z_])+(\))?))\.((`(\()?([a-z_])+`(\))?)|((\()?([a-z_])+(\))?))$#i', $attr))
{
$tab = explode('.', str_replace(array('`', '(', ')'), '', $attr));
if (!$table = $this->returnNameTable($tab[0], $from, $attr))
if (!$table = $this->returnNameTable($tab[0], $from))
return false;
else
return array ('table' => $table,
'alias' => $tab[0],
'attribut' => $tab[1],
'string' => $attr);
return array ('table' => $table,
'alias' => $tab[0],
'attribut' => $tab[1],
'string' => $attr);
}
else if (preg_match('#^((`(\()?([a-z_])+`(\))?)|((\()?([a-z_])+(\))?))$#i', $attr))
{
$attribut = str_replace(array('`', '(', ')'), '', $attr);
if (!$table = $this->returnNameTable(false, $from, $attr))
if (!$table = $this->returnNameTable(false, $from))
return false;
else
return array('table' => $table,
'attribut' => $attribut,
return array('table' => $table,
'attribut' => $attribut,
'string' => $attr);
}
else
return false;
}
public function returnNameTable($alias = false, $tables, $expr)
public function returnNameTable($alias = false, $tables)
{
if ($alias)
{
foreach ($tables as $table)
{
$tabA['alias'][] = str_replace(array('`', '(', ')'), '', $table['alias']);
$tabA['table'][] = str_replace(array('`', '(', ')'), '', $table['table']);
}
if (in_array($alias, $tabA['alias']))
return $tabA['table'];
else
{
$this->errorSql['returnNameTable']['reference'] = array($alias, $expr);
return false;
if ($table['alias'] == $alias)
return array($table['table']);
}
}
else if (!$alias && (count($tables) > 1))
{
$this->errorSql['returnNameTable'] = false;
$this->error_sql['returnNameTable'] = false;
return false;
}
else
@@ -202,73 +219,73 @@ class RequestSql extends ObjectModel
}
}
public function attributExistInTable($attr, $tables)
public function attributExistInTable($attr, $table)
{
foreach ($tables as $table)
{
$attributs = Db::getInstance()->ExecuteS(sprintf("DESCRIBE %s", $table));
foreach ($attributs as $attribut)
if ($attribut['Field'] == trim($attr))
return true;
}
if (is_array($table) && (count($table) == 1))
$table = $table[0];
$attributs = Db::getInstance()->ExecuteS(sprintf('DESCRIBE `%s`', $table));
foreach ($attributs as $attribut)
if ($attribut['Field'] == trim($attr))
return true;
return false;
}
public function testedRequired($tab)
{
foreach ($this->tested['required'] as $key)
if (@!array_key_exists($key, $tab))
if (!array_key_exists($key, $tab))
{
$this->errorSql['testedRequired'] = $key;
$this->error_sql['testedRequired'] = $key;
return false;
}
return true;
}
public function testedUnauthorized($tab)
{
foreach ($this->tested['unauthorized'] as $key)
if (@array_key_exists($key, $tab))
if (array_key_exists($key, $tab))
{
$this->errorSql['testedUnauthorized'] = $key;
$this->error_sql['testedUnauthorized'] = $key;
return false;
}
return true;
}
public function checkedFrom($from)
{
for ($i = 0 ; $i < count($from) ; $i++)
$nb = count($from);
for ($i = 0; $i < $nb; $i++)
{
$table = $from[$i];
if (!in_array(str_replace('`', '', $table['table']), $this->showTables()))
{
$this->errorSql['checkedFrom']['table'] = $table['table'];
return false;
$this->error_sql['checkedFrom']['table'] = $table['table'];
return false;
}
if ($table['ref_type'] == "ON" && (trim($table['join_type']) == "LEFT" || trim($table['join_type']) == "JOIN"))
if ($table['ref_type'] == 'ON' && (trim($table['join_type']) == 'LEFT' || trim($table['join_type']) == 'JOIN'))
{
if($attrs = $this->cutJoin($table['ref_clause'], $from))
if ($attrs = $this->cutJoin($table['ref_clause'], $from))
{
foreach($attrs as $attr)
foreach ($attrs as $attr)
{
if(!$this->attributExistInTable($attr['attribut'],$attr['table']))
if (!$this->attributExistInTable($attr['attribut'], $attr['table']))
{
$this->errorSql['checkedFrom']['attribut'] = array($attr['attribut'], implode(', ', $attr['table']));
$this->error_sql['checkedFrom']['attribut'] = array($attr['attribut'], implode(', ', $attr['table']));
return false;
}
}
}
else
{
if(isset($this->errorSql['returnNameTable']))
if (isset($this->error_sql['returnNameTable']))
{
$this->errorSql['checkedFrom'] = $this->errorSql['returnNameTable'];
$this->error_sql['checkedFrom'] = $this->error_sql['returnNameTable'];
return false;
}
else
{
$this->errorSql['checkedFrom'] = false;
$this->error_sql['checkedFrom'] = false;
return false;
}
}
@@ -276,35 +293,35 @@ class RequestSql extends ObjectModel
}
return true;
}
public function checkedSelect($select, $from, $in = false)
{
for($i = 0 ; $i < count($select) ; $i++ )
$nb = count($select);
for ($i = 0; $i < $nb; $i++)
{
$attribut = $select[$i];
if ($attribut['base_expr'] != '*')
{
if ($attribut['expr_type'] == "colref" || $attribut['expr_type'] == "reserved")
if ($attribut['expr_type'] == 'colref' || $attribut['expr_type'] == 'reserved')
{
if ($attr = $this->cutAttribute($attribut['base_expr'], $from))
{
if (!$this->attributExistInTable($attr['attribut'],$attr['table']))
if (!$this->attributExistInTable($attr['attribut'], $attr['table']))
{
$this->errorSql['checkedSelect']['attribut'] = array($attr['attribut'], implode(', ', $attr['table']));
$this->error_sql['checkedSelect']['attribut'] = array($attr['attribut'], implode(', ', $attr['table']));
return false;
}
}
else
{
if (isset($this->errorSql['returnNameTable']))
if (isset($this->error_sql['returnNameTable']))
{
$this->errorSql['checkedSelect'] = $this->errorSql['returnNameTable'];
$this->error_sql['checkedSelect'] = $this->error_sql['returnNameTable'];
return false;
}
else
{
$this->errorSql['checkedSelect'] = false;
$this->error_sql['checkedSelect'] = false;
return false;
}
}
@@ -314,7 +331,7 @@ class RequestSql extends ObjectModel
{
if ($in)
{
$this->errorSql['checkedSelect']['*'] = false;
$this->error_sql['checkedSelect']['*'] = false;
return false;
}
}
@@ -322,53 +339,48 @@ class RequestSql extends ObjectModel
return true;
}
public function checkedWhere($where, $from, $operator, $sql)
public function checkedWhere($where, $from, $sql)
{
for ($i = 0 ; $i < count($where) ; $i++ )
$nb = count($where);
for ($i = 0; $i < $nb; $i++)
{
$attribut = $where[$i];
if ($attribut['expr_type'] == "colref" || $attribut['expr_type'] == "reserved")
if ($attribut['expr_type'] == 'colref' || $attribut['expr_type'] == 'reserved')
{
if ($attr = $this->cutAttribute($attribut['base_expr'], $from))
{
if (!$this->attributExistInTable($attr['attribut'],$attr['table']))
if (!$this->attributExistInTable($attr['attribut'], $attr['table']))
{
$this->errorSql['checkedWhere']['attribut'] = array($attr['attribut'], implode(', ', $attr['table']));
$this->error_sql['checkedWhere']['attribut'] = array($attr['attribut'], implode(', ', $attr['table']));
return false;
}
}
else
{
if (isset($this->errorSql['returnNameTable']))
if (isset($this->error_sql['returnNameTable']))
{
$this->errorSql['checkedWhere'] = $this->errorSql['returnNameTable'];
$this->error_sql['checkedWhere'] = $this->error_sql['returnNameTable'];
return false;
}
else
{
$this->errorSql['checkedWhere'] = false;
$this->error_sql['checkedWhere'] = false;
return false;
}
}
}
else if ($attribut['expr_type'] == "operator")
else if ($attribut['expr_type'] == 'operator')
{
if (!in_array(strtoupper($attribut['base_expr']), $this->tested['operator']))
{
$this->errorSql['checkedWhere']['operator'] = array($attribut['base_expr']);
return false;
}
else if (!$this->attributExistInTable($attr['attribut'],$attr['table']))
{
$this->errorSql['checkedWhere']['operator'] = array($attribut['base_expr']);
$this->error_sql['checkedWhere']['operator'] = array($attribut['base_expr']);
return false;
}
}
else if ($attribut['expr_type'] == "subquery")
else if ($attribut['expr_type'] == 'subquery')
{
$tab = $attribut['sub_tree'];
return $this->validateSql($tab, true, $sql);
return $this->validateParser($tab, true, $sql);
}
}
return true;
@@ -377,42 +389,41 @@ class RequestSql extends ObjectModel
public function checkedHaving($having, $from)
{
$nb = count($having);
for ($i = 0 ; $i < $nb ; $i++ )
for ($i = 0; $i < $nb; $i++)
{
$attribut = $having[$i];
if ($attribut['expr_type'] == "colref")
if ($attribut['expr_type'] == 'colref')
{
if ($attr = $this->cutAttribute($attribut['base_expr'], $from))
{
if (!$this->attributExistInTable($attr['attribut'],$attr['table']))
if (!$this->attributExistInTable($attr['attribut'], $attr['table']))
{
$this->errorSql['checkedHaving']['attribut'] = array($attr['attribut'], implode(', ', $attr['table']));
$this->error_sql['checkedHaving']['attribut'] = array($attr['attribut'], implode(', ', $attr['table']));
return false;
}
}
else
{
if (isset($this->errorSql['returnNameTable']))
if (isset($this->error_sql['returnNameTable']))
{
$this->errorSql['checkedHaving'] = $this->errorSql['returnNameTable'];
$this->error_sql['checkedHaving'] = $this->error_sql['returnNameTable'];
return false;
}
else
{
$this->errorSql['checkedHaving'] = false;
$this->error_sql['checkedHaving'] = false;
return false;
}
}
}
if ($attribut['expr_type'] == "operator")
if ($attribut['expr_type'] == 'operator')
{
if (!in_array(strtoupper($attribut['base_expr']), $this->tested['operator']))
{
$this->errorSql['checkedHaving']['operator'] = array($attribut['base_expr']);
$this->error_sql['checkedHaving']['operator'] = array($attribut['base_expr']);
return false;
}
}
}
return true;
@@ -421,26 +432,26 @@ class RequestSql extends ObjectModel
public function checkedOrder($order, $from)
{
$order = $order[0];
if ($order['type'] == "expression")
if ($order['type'] == 'expression')
{
if ($attr = $this->cutAttribute($order['base_expr'], $from))
{
if (!$this->attributExistInTable($attr['attribut'],$attr['table']))
if (!$this->attributExistInTable($attr['attribut'], $attr['table']))
{
$this->errorSql['checkedOrder']['attribut'] = array($attr['attribut'], implode(', ', $attr['table']));
$this->error_sql['checkedOrder']['attribut'] = array($attr['attribut'], implode(', ', $attr['table']));
return false;
}
}
else
{
if (isset($this->errorSql['returnNameTable']))
if (isset($this->error_sql['returnNameTable']))
{
$this->errorSql['checkedOrder'] = $this->errorSql['returnNameTable'];
$this->error_sql['checkedOrder'] = $this->error_sql['returnNameTable'];
return false;
}
else
{
$this->errorSql['checkedOrder'] = false;
$this->error_sql['checkedOrder'] = false;
return false;
}
}
@@ -451,26 +462,26 @@ class RequestSql extends ObjectModel
public function checkedGroupBy($group, $from)
{
$group = $group[0];
if ($group['type'] == "expression")
if ($group['type'] == 'expression')
{
if ($attr = $this->cutAttribute($group['base_expr'], $from))
{
if (!$this->attributExistInTable($attr['attribut'],$attr['table']))
if (!$this->attributExistInTable($attr['attribut'], $attr['table']))
{
$this->errorSql['checkedGroupBy']['attribut'] = array($attr['attribut'], implode(', ', $attr['table']));
$this->error_sql['checkedGroupBy']['attribut'] = array($attr['attribut'], implode(', ', $attr['table']));
return false;
}
}
else
{
if (isset($this->errorSql['returnNameTable']))
if (isset($this->error_sql['returnNameTable']))
{
$this->errorSql['checkedGroupBy'] = $this->errorSql['returnNameTable'];
$this->error_sql['checkedGroupBy'] = $this->error_sql['returnNameTable'];
return false;
}
else
{
$this->errorSql['checkedGroupBy'] = false;
$this->error_sql['checkedGroupBy'] = false;
return false;
}
}
@@ -482,11 +493,10 @@ class RequestSql extends ObjectModel
{
if (!preg_match('#^[0-9]+$#', trim($limit['start'])) || !preg_match('#^[0-9]+$#', trim($limit['end'])))
{
$this->errorSql['checkedLimit'] = false;
$this->error_sql['checkedLimit'] = false;
return false;
}
return true;
}
}

View File

@@ -1322,7 +1322,7 @@ class ToolsCore
{
if (strlen($sql) > 0)
{
require_once(_PS_TOOL_DIR_.'parser_sql/parser_sql.php');
require_once(_PS_TOOL_DIR_.'parser_sql/php-sql-parser.php');
$parser = new parserSql($sql);
return $parser->parsed;
}

View File

@@ -0,0 +1,12 @@
Copyright (c) 2011, greenlion (http://code.google.com/p/php-sql-parser/)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the David Spurr nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
http://www.opensource.org/licenses/bsd-license.php

View File

@@ -862,7 +862,7 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(1, 61, 'Search Engines'),(1, 62, 'Referrers'),(1, 63, 'Groups'),(1, 64, 'Generators'),(1, 65, 'Shopping Carts'),(1, 66, 'Tags'),(1, 67, 'Search'),
(1, 68, 'Attachments'),(1, 69, 'Configuration Information'),(1, 70, 'Performance'),(1, 71, 'Customer Service'),(1, 72, 'Webservice'),(1, 73, 'Stock Movements'),
(1, 80, 'Modules & Themes Catalog'),(1, 81, 'My Account'),(1, 82, 'Stores'),(1, 83, 'Themes'),(1, 84, 'Geolocation'),(1, 85, 'Tax Rules'),(1, 86, 'Log'),
(1, 87, 'Home'), (1, 88, 'Shops'), (1, 89, 'Group Shops'), (1, 90, 'Shop Urls'),(1, 91, 'Genders'),(1, 92, 'Request');
(1, 87, 'Home'), (1, 88, 'Shops'), (1, 89, 'Group Shops'), (1, 90, 'Shop Urls'),(1, 91, 'Genders'),(1, 92, 'SQL Manager');
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(2, 1, 'Catalogue'),(2, 2, 'Clients'),(2, 3, 'Commandes'),(2, 4, 'Paiement'),(2, 5, 'Transport'),
@@ -877,7 +877,7 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(2, 62, 'Sites affluents'),(2, 63, 'Groupes'),(2, 64, 'Générateurs'),(2, 65, 'Paniers'),(2, 66, 'Tags'),(2, 67, 'Recherche'),
(2, 68, 'Documents joints'),(2, 69, 'Informations'),(2, 70, 'Performances'),(2, 71, 'SAV'),(2, 72, 'Service web'),(2, 73, 'Mouvements de Stock'),
(2, 80, 'Catalogue de modules et thèmes'),(2, 81, 'Mon compte'),(2, 82, 'Magasins'),(2, 83, 'Thèmes'),(2, 84, 'Géolocalisation'),(2, 85, 'Règles de taxes'),(2, 86, 'Log'),
(2, 87,'Accueil'), (2, 88, 'Boutiques'), (2, 89, 'Groupes de boutique'), (2, 90, 'URLs de boutique'),(2, 91, 'Genres'),(2, 92, 'requête');
(2, 87,'Accueil'), (2, 88, 'Boutiques'), (2, 89, 'Groupes de boutique'), (2, 90, 'URLs de boutique'),(2, 91, 'Genres'),(2, 92, 'SQL Manager');
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(3, 1, 'Catálogo'),(3, 2, 'Clientes'),(3, 3, 'Pedidos'),(3, 4, 'Pago'),(3, 5, 'Transporte'),
@@ -891,7 +891,7 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(3, 55, 'Albaranes de entrega'),(3, 56, 'SEO & URLs'),(3, 57, 'CMS'),(3, 58, 'Mapeo de la imagen'),(3, 59, 'Mensajes del cliente'),(3, 60, 'Rastreo'),
(3, 61, 'Motores de búsqueda'),(3, 62, 'Referido'),(3, 63, 'Grupos'),(3, 64, 'Generadores'),(3, 65, 'Carritos'),(3, 66, 'Etiquetas'),(3, 67, 'Búsqueda'),(3, 68, 'Adjuntos'),
(3, 69, 'Informaciones'),(3, 70, 'Rendimiento'),(3, 72, 'Web service'),(3, 71, 'Servicio al cliente'),(3, 73, 'Movimiento de Stock'), (3, 82, 'Tiendas'),(3, 83, 'Temas'),(3, 84, 'Geolocalización'),(3, 85, 'Reglas de Impuestos'),(3, 86, 'Log'),
(3, 87,'Home'), (3, 88, 'Shops'), (3, 89, 'Group Shops'), (3, 90, 'Shop Urls'),(3, 91, 'Genders'),(3, 92, 'Solicitud');
(3, 87,'Home'), (3, 88, 'Shops'), (3, 89, 'Group Shops'), (3, 90, 'Shop Urls'),(3, 91, 'Genders'),(3, 92, 'SQL Manager');
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(4, 1, 'Katalog'),(4, 2, 'Kunden'),(4, 3, 'Bestellungen'),(4, 4, 'Zahlung'),
@@ -906,7 +906,7 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(4, 61, 'Suchmaschinen'),(4, 62, 'Referrer'),(4, 63, 'Gruppen'),(4, 64, 'Generatoren'),(4, 65, 'Warenkörbe'),(4, 66, 'Tags'),(4, 67, 'Suche'),
(4, 68, 'Anhänge'),(4, 69, 'Konfigurationsinformationen'),(4, 70, 'Leistung'),(4, 71, 'Kundenservice'),(4, 72, 'Webservice'),(4, 73, 'Lagerbewegungen'),
(4, 80, 'Module und Themenkatalog'),(4, 81, 'Mein Konto'),(4, 82, 'Shops'),(4, 83, 'Themen'),(4, 84, 'Geotargeting'),(4, 85, 'Steuerregeln'),(4, 86, 'Log'),
(4, 87,'Home'), (4, 88, 'Shops'), (4, 89, 'Group Shops'), (4, 90, 'Shop Urls'),(4, 91, 'Genders'),(4, 92, 'Wunsch');
(4, 87,'Home'), (4, 88, 'Shops'), (4, 89, 'Group Shops'), (4, 90, 'Shop Urls'),(4, 91, 'Genders'),(4, 92, 'SQL Manager');
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(5, 1, 'Catalogo'),(5, 2, 'Clienti'),(5, 3, 'Ordini'),(5, 4, 'Pagamento'),
@@ -921,7 +921,7 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(5, 61, 'Motori di ricerca'),(5, 62, 'Referenti'),(5, 63, 'Gruppi'),(5, 64, 'Generatori'),(5, 65, 'Carrelli shopping'),(5, 66, 'Tag'),(5, 67, 'Cerca'),
(5, 68, 'Allegati'),(5, 69, 'Informazioni di configurazione'),(5, 70, 'Performance'),(5, 71, 'Servizio clienti'),(5, 72, 'Webservice'),(5, 73, 'Movimenti magazzino'),
(5, 80, 'Moduli & Temi catalogo'),(5, 81, 'Il mio Account'),(5, 82, 'Negozi'),(5, 83, 'Temi'),(5, 84, 'Geolocalizzazione'),(5, 85, 'Regimi fiscali'),(5, 86, 'Log'),
(5, 87,'Home'), (5, 88, 'Shops'), (5, 89, 'Group Shops'), (5, 90, 'Shop Urls'),(5, 91, 'Genders'),(5, 92, 'Richiesta');
(5, 87,'Home'), (5, 88, 'Shops'), (5, 89, 'Group Shops'), (5, 90, 'Shop Urls'),(5, 91, 'Genders'),(5, 92, 'SQL Manager');
INSERT IGNORE INTO `PREFIX_tab_lang` (`id_tab`, `id_lang`, `name`)
(SELECT `id_tab`, id_lang, (SELECT tl.`name`

View File

@@ -169,4 +169,4 @@ CREATE TABLE IF NOT EXISTS `PREFIX_request_sql` (
PRIMARY KEY (`id_request_sql`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
/* PHP:add_new_tab(AdminRequestSql, fr:Requête|es:Solicitud|en:Request|de:Wunsh|it:Richiesta, 9); */;
/* PHP:add_new_tab(AdminRequestSql, fr:SQL Manager|es:SQL Manager|en:SQL Manager|de:Wunsh|it:SQL Manager, 9); */;

File diff suppressed because it is too large Load Diff

View File

@@ -2,6 +2,8 @@
global $_LANGADM;
$_LANGADM = array();
$_LANGADM['AdminAccessc7ef4a3f21bade4d6bee2baa9aadcd02'] = 'Les permissions on bien été mise à jour.';
$_LANGADM['AdminAccessc226d69141a405b8f9765506dcada57b'] = 'Une erreur est survenue, lors de la mise à jour des permissions.';
$_LANGADM['AdminAccess9d3aff6bea8ffbe99b0dd0538fe143ff'] = 'Profil mis à jour';
$_LANGADM['AdminAccess8cd14e237b4f34d4e669885f9e1da00f'] = 'Requête impossible !';
$_LANGADM['AdminAccess1c70a41f285848d38656b2d7be9fdc62'] = 'Changements en cours. Merci de patienter.';
@@ -1245,7 +1247,6 @@ $_LANGADM['AdminImporte1a5e653bc356ed6745d6814d50213eb'] = 'Afficher le prix';
$_LANGADM['AdminImport4d2589e1bcd4263cb99927b59f0f88d2'] = 'URLs des images (x,y,z...)';
$_LANGADM['AdminImport14913d7e9d486e77b5c8d085e3797f94'] = 'Supprimer les images existantes (0 = non, 1 = oui)';
$_LANGADM['AdminImporte6691747add3b37b9c381b8d9476fd4c'] = 'Si vous ne spécifiez pas cette colonne et vous spécifier la colonne images, toutes les images du produit seront remplacé par celle spécifié dans le fichier d\'import';
$_LANGADM['AdminImport21021ea0e52be8e9c599f4dff41e5be0'] = 'Caractéristique';
$_LANGADM['AdminImport71d0ceacdf562024f2d4c3a76d3b63e4'] = 'Uniquement disponible en ligne';
$_LANGADM['AdminImport9e2941b3c81256fac10392aaca4ccfde'] = 'Etat';
$_LANGADM['AdminImportf8a0fa3674c3336359b77bbe8e942a2c'] = 'ID ou nom de la boutique';
@@ -2498,11 +2499,11 @@ $_LANGADM['AdminReferrersf2a6c498fb90ee345d997f888fce3b18'] = 'Supprimer';
$_LANGADM['AdminRequestSqlb718adec73e04ce3ec720dd11a06a308'] = 'ID';
$_LANGADM['AdminRequestSql49ee3087348e8d44e1feda1917443987'] = 'Nom';
$_LANGADM['AdminRequestSql15c2d85f1fae22a3c3a0594510a1f611'] = 'Requête';
$_LANGADM['AdminRequestSqla5d1e00410f8e55885dbb6eddd4fe3cd'] = 'Comment créer une nouvelle requête SQL?';
$_LANGADM['AdminRequestSqla5d1e00410f8e55885dbb6eddd4fe3cd'] = 'Comment créer une nouvelle requête SQL ?';
$_LANGADM['AdminRequestSqlb8bf3ffcbb8025ef76f8d67fff0cdf2b'] = 'Cliquez sur \"Nouveau\".';
$_LANGADM['AdminRequestSqlb7ccdf6ab58f5514acc520721ddc9f08'] = 'Remplissez les champs et cliquez sur \"Enregistrer\".';
$_LANGADM['AdminRequestSqlab5aab7b64571636a2f508cd3ea62e89'] = 'Vous pouvez ensuite afficher les résultats de requête en cliquant sur l\'onglet :';
$_LANGADM['AdminRequestSqla8ad7f90ed8755a68b8f2c9a583480da'] = 'Vous pouvez aussi exporter les résultats de la requête sous forme de fichier. Csv en cliquant sur l\'onglet :';
$_LANGADM['AdminRequestSqla8ad7f90ed8755a68b8f2c9a583480da'] = 'Vous pouvez aussi exporter les résultats de la requête sous forme de fichier .csv en cliquant sur l\'onglet :';
$_LANGADM['AdminRequestSqla08e4672a3def34050a314583dac3e2f'] = 'Attention : Lors de la sauvegarde de la requête, seul les requêtes de type \"SELECT\" sont autorisées.';
$_LANGADM['AdminRequestSqlb60c0cab3cfd0d38042c8878f2181dc5'] = 'Le fichier est trop grand et ne peut donc pas être téléchargé. Veuillez utilisé la clause \"LIMIT\" dans cette requête.';
$_LANGADM['AdminRequestSql4e140ba723a03baa6948340bf90e2ef6'] = 'Nom : ';
@@ -2512,11 +2513,11 @@ $_LANGADM['AdminRequestSql19f823c6453c2b1ffd09cb715214813d'] = 'Champs requis';
$_LANGADM['AdminRequestSql3ace3d5364e85ed551126b5a788700dd'] = 'La table';
$_LANGADM['AdminRequestSql97cf45dd5a8ff5a1a1a15f059e25bfc8'] = 'n\'existe pas';
$_LANGADM['AdminRequestSql70e9732e7c12426a3031cc856aba10c7'] = 'L\'attribut ';
$_LANGADM['AdminRequestSqlf4953e56dea0f7d2efa8592b2cb68e47'] = 'n\'existe pas dans les tables suivantes : ';
$_LANGADM['AdminRequestSql6df70dcd4f3168d0f608f4eeeecd3385'] = 'n\'existe pas dans la table : ';
$_LANGADM['AdminRequestSql902b0d55fddef6f8d651fe1035b7d4bd'] = 'Votre requête est incorrecte.';
$_LANGADM['AdminRequestSql1fb2b468d4bc45d026b04629d7367ec5'] = 'L\'opérande \"*\" ne peut être utilisé dans une requete imbriquée.';
$_LANGADM['AdminRequestSql3a36318229eb9597af8430e8cc12c6e3'] = 'L\'opérateur ';
$_LANGADM['AdminRequestSqlad63922dff7de9001b68aa5ffe98dbbb'] = ' utilisé est incorrecte.';
$_LANGADM['AdminRequestSqlad63922dff7de9001b68aa5ffe98dbbb'] = ' utilisé est incorrect.';
$_LANGADM['AdminRequestSql19681d28ed1cc72479bc26b7e76ad240'] = 'La clause LIMIT doit comporter des arguments de type numerique.';
$_LANGADM['AdminRequestSql569a67022452692cad0c2da1243ad7ab'] = 'La référence ';
$_LANGADM['AdminRequestSqld2c0d63fe01c737e0afe765ffb89fc75'] = 'n\'existe pas dans : ';
@@ -2525,7 +2526,7 @@ $_LANGADM['AdminRequestSql627e3d3b6303c563993e54186ffa3fdb'] = 'est un mot clé
$_LANGADM['AdminRequestSql0557fa923dcee4d0f86b1409f5c2167f'] = 'Retour';
$_LANGADM['AdminRequestSql630f6dc397fe74e52d5189e2c80f282b'] = 'Retourner à la liste';
$_LANGADM['AdminRequestSql00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Activé';
$_LANGADM['AdminRequestSqlb9f5c797ebbf55adccdd8539a65a0241'] = 'Handicapés';
$_LANGADM['AdminRequestSqlb9f5c797ebbf55adccdd8539a65a0241'] = 'Désactivé';
$_LANGADM['AdminRequestSql08a38277b0309070706f6652eeae9a53'] = 'Bas';
$_LANGADM['AdminRequestSql258f49887ef8d14ac268c92b02503aaa'] = 'Jusqu\'à';
$_LANGADM['AdminRequestSqlb2507468f95156358fa490fd543ad2f0'] = 'Export';
@@ -3307,12 +3308,6 @@ $_LANGADM['index7286baef44d09300636a4b99c533523c'] = 'Temps de chargement :';
$_LANGADM['indexbbaff12800505b22a853e8b7f4eb6a22'] = 'Contact';
$_LANGADM['index3e937d04c1c83492260a33d926ca587c'] = 'Bug Tracker';
$_LANGADM['indexe6a7f8a2f42cc35979973da8dfb10720'] = 'Forum';
$_LANGADM['indexeed2839c1e3e5f7069ed03b2f6d4c6dd'] = 'Panneau d\'administration';
$_LANGADM['indexe67615d6c998f1a013f1d27bbc555cff'] = 'Vous configurez votre site pour le groupe de magasins %s';
$_LANGADM['index1165ec47ce359708f4a608d4decd04f6'] = 'Vous configurez votre site pour le magasin %s';
$_LANGADM['indexdb26e10564e958809d798e8048fcbc0a'] = 'Clé de sécurité invalide';
$_LANGADM['indexa4da6f31ab268a5310bc475e63ab92db'] = 'Je comprends les risques et je veux afficher la page';
$_LANGADM['index5196611ad1bf27e9cef5375b038c04db'] = 'Sortez-moi d\'ici !';
$_LANGADM['indexc6a8757e591d6090eb75d11e8d316f57'] = 'SSL est activé. Nonobstant, votre IP est autorisée à utiliser le mode non sécurisé (IP locale ou maintenance)';
$_LANGADM['index3af4334b6b2afb79aeb803577ccc0473'] = 'SSL est activé. Merci de vous connecter en utilisant une url sécurisée (https)';
$_LANGADM['index98bbe7bd134ad088f6b211fe3bd41408'] = 'Cliquez-ici pour accéder au panneau d\'administration';
@@ -3335,5 +3330,11 @@ $_LANGADM['index1928895508822da82ce5c4932a114044'] = 'Indiquez votre adresse e-m
$_LANGADM['index449d3718fc3a9e9bf3f3fc0254bb5625'] = '(celle que vous avez indiquée durant l\'installation) afin de recevoir vos nouveaux codes d\'accès par e-mail';
$_LANGADM['index94966d90747b97d1f0f206c98a8b1ac3'] = 'Envoyer';
$_LANGADM['index804ccd6219996d12eda865d1c0707423'] = 'Toutes les boutiques';
$_LANGADM['indexeed2839c1e3e5f7069ed03b2f6d4c6dd'] = 'Panneau d\'administration';
$_LANGADM['indexe67615d6c998f1a013f1d27bbc555cff'] = 'Vous configurez votre site pour le groupe de magasins %s';
$_LANGADM['index1165ec47ce359708f4a608d4decd04f6'] = 'Vous configurez votre site pour le magasin %s';
$_LANGADM['indexdb26e10564e958809d798e8048fcbc0a'] = 'Clé de sécurité invalide';
$_LANGADM['indexa4da6f31ab268a5310bc475e63ab92db'] = 'Je comprends les risques et je veux afficher la page';
$_LANGADM['index5196611ad1bf27e9cef5375b038c04db'] = 'Sortez-moi d\'ici !';
?>