[+] BO : add SQL manager
This commit is contained in:
2
admin-dev/export/.htaccess
Normal file
2
admin-dev/export/.htaccess
Normal file
@@ -0,0 +1,2 @@
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
36
admin-dev/export/index.php
Normal file
36
admin-dev/export/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 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/osl-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 license@prestashop.com 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 <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
98
admin-dev/requestSql.php
Normal file
98
admin-dev/requestSql.php
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 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/osl-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 license@prestashop.com 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 <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7310 $
|
||||
* @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'))
|
||||
{
|
||||
$sql = RequestSql::getRequestSqlById(Tools::getValue('id_request_sql'));
|
||||
|
||||
if($sql)
|
||||
{
|
||||
$results = Db::getInstance()->ExecuteS($sql[0]['sql']);
|
||||
foreach(array_keys($results[0]) as $key)
|
||||
{
|
||||
$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)
|
||||
{
|
||||
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
|
||||
{
|
||||
header('Location: '.$_SERVER['HTTP_REFERER']);
|
||||
die();
|
||||
}
|
||||
|
||||
function return_bytes($val) {
|
||||
$val = trim($val);
|
||||
$last = strtolower($val[strlen($val)-1]);
|
||||
switch($last) {
|
||||
// Le modifieur 'G' est disponible depuis PHP 5.1.0
|
||||
case 'g':
|
||||
$val *= 1024;
|
||||
case 'm':
|
||||
$val *= 1024;
|
||||
case 'k':
|
||||
$val *= 1024;
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
@@ -460,11 +460,11 @@ class AdminImages extends AdminTab
|
||||
<legend><img src="../img/admin/picture.gif" /> '.$this->l('Move images').'</legend><br />'.
|
||||
$this->l('You can choose to keep your images stored in the previous system - nothing wrong with that.').'<br />'.
|
||||
$this->l('You can also decide to move your images to the new storage system: in this case, click on the "Move images" button below. Please be patient, as this can take several minutes.').
|
||||
'<br /><br /><p class="hint clear" style="display: block;"> '.
|
||||
'<br /><br /><div class="hint clear" style="display: block;"> '.
|
||||
$this->l('After moving all of your product images, for best performance go to the ').
|
||||
'<a style="text-decoration:underline" href="index.php?tab=AdminPPreferences&token='.Tools::getAdminTokenLite('AdminPPreferences').'#PS_LEGACY_IMAGES_on">'.$this->l('product preferences tab').'</a>'.
|
||||
$this->l(' and set "Activate legacy images compatibility" to NO.').'
|
||||
</p>
|
||||
</div>
|
||||
<center><input type="Submit" name="submitMoveImages'.$this->table.'" value="'.$this->l('Move images').'" class="button space" onclick="return confirm(\''.$this->l('Are you sure?', __CLASS__, true, false).'\');" /></center>
|
||||
</fieldset>
|
||||
</form>';
|
||||
|
||||
358
admin-dev/tabs/AdminRequestSql.php
Normal file
358
admin-dev/tabs/AdminRequestSql.php
Normal file
@@ -0,0 +1,358 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 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/osl-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 license@prestashop.com 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 <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminRequestSql extends AdminTab
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'request_sql';
|
||||
$this->className = 'RequestSql';
|
||||
$this->edit = true;
|
||||
$this->delete = true;
|
||||
$this->view = true;
|
||||
$this->export = true;
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_request_sql' => array('title' => $this->l('ID'), 'width' => 25),
|
||||
'name' => array('title' => $this->l('Name'), 'width' => 300),
|
||||
'sql' => array('title' => $this->l('Request'), 'width' => 500)
|
||||
);
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function displayList()
|
||||
{
|
||||
return parent::displayList();
|
||||
}
|
||||
|
||||
public function displayTop()
|
||||
{
|
||||
echo
|
||||
'<div class="hint clear" style="display:block;">'.
|
||||
' <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>';
|
||||
|
||||
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>';
|
||||
}
|
||||
}
|
||||
|
||||
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>
|
||||
<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>
|
||||
<div class="margin-form">
|
||||
<textarea name="name" cols="100" rows="10">'.$this->getFieldValue($obj, 'name').'</textarea><sup>*</sup>
|
||||
</div>
|
||||
<label>'.$this->l('Request:').' </label>
|
||||
<div class="margin-form">
|
||||
<textarea name="sql" cols="100" rows="10">'.$this->getFieldValue($obj, 'sql').'</textarea><sup>*</sup>
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</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)
|
||||
$this->_listSkipDelete = array($row['id_request_sql']);
|
||||
|
||||
return parent::postProcess();
|
||||
}
|
||||
|
||||
public function _childValidation()
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public function _DisplayError($e)
|
||||
{
|
||||
foreach(array_keys($e) as $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.'));
|
||||
elseif(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
|
||||
$this->_errors[] = Tools::DisplayError($this->l('Error'));
|
||||
break;
|
||||
case 'checkedSelect':
|
||||
if(isset($e[$key]['table']))
|
||||
$this->_errors[] = Tools::DisplayError($this->l('The Table ').' "'.$e[$key]['table'].'" '.$this->l(' doesn\'t exist.'));
|
||||
elseif(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].'.');
|
||||
elseif(isset($e[$key]['*']))
|
||||
$this->_errors[] = Tools::DisplayError($this->l('The operand "*" can be used in a nested query.'));
|
||||
else
|
||||
$this->_errors[] = Tools::DisplayError($this->l('Error'));
|
||||
break;
|
||||
case 'checkedWhere':
|
||||
if(isset($e[$key]['operator']))
|
||||
$this->_errors[] = Tools::DisplayError($this->l('The operator ').' "'.$e[$key]['operator'].'" '.$this->l(' used is incorrect.'));
|
||||
elseif(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
|
||||
$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.'));
|
||||
elseif(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
|
||||
$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].'.');
|
||||
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].'.');
|
||||
else
|
||||
$this->_errors[] = Tools::DisplayError($this->l('Error'));
|
||||
break;
|
||||
case 'checkedLimit':
|
||||
$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]);
|
||||
else
|
||||
$this->_errors[] = Tools::DisplayError($this->l('When multiple tables are used, each attribute must be referenced to a table.'));
|
||||
break;
|
||||
case 'testedRequired':
|
||||
$this->_errors[] = Tools::DisplayError($e[$key].' '.$this->l(' doesn\'t exist.'));
|
||||
break;
|
||||
case 'testedUnauthorized':
|
||||
$this->_errors[] = Tools::DisplayError($e[$key].' '.$this->l(' is a unauthorized keyword.'));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function viewRequest_sql()
|
||||
{
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
echo '<h2>'.$obj->name.'</h2>';
|
||||
|
||||
if($results = Db::getInstance()->ExecuteS($obj->sql))
|
||||
{
|
||||
$tab_key = array();
|
||||
foreach(array_keys($results[0]) as $key)
|
||||
$tab_key[] = $key;
|
||||
echo '
|
||||
<table cellpadding="0" cellspacing="0" class="table" id="viewRequestSql">
|
||||
<tr>';
|
||||
foreach($tab_key as $keyName)
|
||||
echo '<th align="center">'.$keyName.'</th>';
|
||||
echo '
|
||||
</tr>';
|
||||
foreach($results as $result)
|
||||
{
|
||||
echo '<tr>';
|
||||
foreach($tab_key as $name)
|
||||
echo '<td>'.$result[$name].'</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
var width = $("#viewRequestSql").width();
|
||||
if(width > 990){
|
||||
$("#viewRequestSql").css("display","block").css("overflow-x","scroll");
|
||||
}
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
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)
|
||||
{
|
||||
/* Display results in a table
|
||||
*
|
||||
* align : determine value alignment
|
||||
* prefix : displayed before value
|
||||
* suffix : displayed after value
|
||||
* image : object image
|
||||
* icon : icon determined by values
|
||||
* active : allow to toggle status
|
||||
*/
|
||||
$id_category = 1; // default categ
|
||||
|
||||
$irow = 0;
|
||||
if ($this->_list AND isset($this->fieldsDisplay['position']))
|
||||
{
|
||||
$positions = array_map(create_function('$elem', 'return (int)($elem[\'position\']);'), $this->_list);
|
||||
sort($positions);
|
||||
}
|
||||
if ($this->_list)
|
||||
{
|
||||
$isCms = false;
|
||||
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)
|
||||
{
|
||||
$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'].'"' : '').'>
|
||||
<td class="center">';
|
||||
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)
|
||||
{
|
||||
$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))
|
||||
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]))
|
||||
$this->_displayEnableLink($token, $id, $tr[$key], $params['active'], Tools::getValue('id_category'), Tools::getValue('id_product'));
|
||||
elseif (isset($params['activeVisu']) AND 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')).'" />';
|
||||
elseif (isset($params['position']))
|
||||
{
|
||||
if ($this->_orderBy == 'position' AND $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).'">
|
||||
<img src="../img/admin/'.($this->_orderWay == 'ASC' ? 'down' : 'up').'.gif"
|
||||
alt="'.$this->l('Down').'" title="'.$this->l('Down').'" /></a>';
|
||||
|
||||
echo '<a'.(!($tr[$key] != $positions[0]) ? ' style="display: none;"' : '').' href="'.self::$currentIndex.
|
||||
'&'.$keyToGet.'='.(int)($id_category).'&'.$this->identifiersDnd[$this->identifier].'='.$id.'
|
||||
&way=0&position='.(int)($tr['position'] - 1).'&token='.($token!=NULL ? $token : $this->token).'">
|
||||
<img src="../img/admin/'.($this->_orderWay == 'ASC' ? 'up' : 'down').'.gif"
|
||||
alt="'.$this->l('Up').'" title="'.$this->l('Up').'" /></a>'; }
|
||||
else
|
||||
echo (int)($tr[$key] + 1);
|
||||
}
|
||||
elseif (isset($tr[$key]))
|
||||
{
|
||||
$echo = $tr[$key];
|
||||
|
||||
echo isset($params['callback']) ? call_user_func_array(array((isset($params['callback_object'])) ? $params['callback_object'] : $this->className, $params['callback']), array($echo, $tr)) : $echo;
|
||||
}
|
||||
else
|
||||
echo '--';
|
||||
|
||||
echo (isset($params['suffix']) ? $params['suffix'] : '').
|
||||
'</td>';
|
||||
}
|
||||
|
||||
if ($this->shopLinkType)
|
||||
{
|
||||
$name = (Tools::strlen($tr['shop_name']) > 15) ? Tools::substr($tr['shop_name'], 0, 15).'...' : $tr['shop_name'];
|
||||
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'))
|
||||
{
|
||||
echo '<td class="center" style="white-space: nowrap;">';
|
||||
if ($this->export)
|
||||
$this->_displayExportLink($token, $id);
|
||||
if ($this->view)
|
||||
$this->_displayViewLink($token, $id);
|
||||
if ($this->edit)
|
||||
$this->_displayEditLink($token, $id);
|
||||
if ($this->delete AND (!isset($this->_listSkipDelete) OR !in_array($id, $this->_listSkipDelete)))
|
||||
$this->_displayDeleteLink($token, $id);
|
||||
if ($this->duplicate)
|
||||
$this->_displayDuplicate($token, $id);
|
||||
echo '</td>';
|
||||
}
|
||||
echo '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
492
classes/RequestSql.php
Normal file
492
classes/RequestSql.php
Normal file
@@ -0,0 +1,492 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 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/osl-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 license@prestashop.com 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 <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class RequestSql extends ObjectModel
|
||||
{
|
||||
public $name;
|
||||
public $sql;
|
||||
|
||||
protected $fieldsRequired = array('name', 'sql');
|
||||
protected $fieldsSize = array('name' => 200 , 'sql' => 400);
|
||||
protected $fieldsValidate = array('name' => 'isString', 'sql' => 'isString');
|
||||
|
||||
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 function getFields()
|
||||
{
|
||||
parent::validateFields();
|
||||
$fields['name'] = pSQL($this->name);
|
||||
$fields['sql'] = pSQL($this->sql);
|
||||
return $fields;
|
||||
}
|
||||
|
||||
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`'))
|
||||
return false;
|
||||
$requestSql = array();
|
||||
foreach ($result AS $row)
|
||||
$requestSql[] = $row['sql'];
|
||||
return $requestSql;
|
||||
}
|
||||
|
||||
public static function getRequestSqlById($id)
|
||||
{
|
||||
return Db::getInstance()->ExecuteS(sprintf('SELECT `sql` FROM `'._DB_PREFIX_.'request_sql` WHERE `id_request_sql` = %s', $id));
|
||||
}
|
||||
|
||||
public function parsingSql($sql)
|
||||
{
|
||||
return Tools::parserSQL($sql);
|
||||
}
|
||||
|
||||
public function validateSql($tab, $in = false, $sql)
|
||||
{
|
||||
if(!$tab)
|
||||
return false;
|
||||
elseif (!$this->testedRequired($tab))
|
||||
return false;
|
||||
elseif (!$this->testedUnauthorized($tab))
|
||||
return false;
|
||||
elseif (!$this->checkedFrom($tab['FROM']))
|
||||
return false;
|
||||
elseif (!$this->checkedSelect($tab['SELECT'], $tab['FROM'], $in))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
elseif (isset($tab['WHERE']))
|
||||
{
|
||||
if (!$this->checkedWhere($tab['WHERE'], $tab['FROM'], $this->tested['operator'], $sql))
|
||||
return false;
|
||||
}
|
||||
elseif (isset($tab['HAVING']))
|
||||
{
|
||||
if (!$this->checkedHaving($tab['HAVING'], $tab['FROM']))
|
||||
return false;
|
||||
}
|
||||
elseif (isset($tab['ORDER']))
|
||||
{
|
||||
if (!$this->checkedOrder($tab['ORDER'], $tab['FROM']))
|
||||
return false;
|
||||
}
|
||||
elseif (isset($tab['GROUP']))
|
||||
{
|
||||
if (!$this->checkedGroupBy($tab['GROUP'], $tab['FROM']))
|
||||
return false;
|
||||
}
|
||||
elseif (isset($tab['LIMIT']))
|
||||
{
|
||||
if (!$this->checkedLimit($tab['LIMIT']))
|
||||
return false;
|
||||
}
|
||||
|
||||
if(empty($this->_errors))
|
||||
if(@!Db::getInstance()->ExecuteS($sql))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function showTables()
|
||||
{
|
||||
$results = Db::getInstance()->ExecuteS('SHOW TABLES');
|
||||
foreach($results as $result)
|
||||
{
|
||||
$key = array_keys($result);
|
||||
$tables[] = $result[$key[0]];
|
||||
}
|
||||
return $tables;
|
||||
}
|
||||
|
||||
public function cutJoin($attrs, $from)
|
||||
{
|
||||
$attrs = explode('=', str_replace(' ', '', $attrs));
|
||||
foreach($attrs as $attr)
|
||||
{
|
||||
if($attribut = $this->cutAttribute($attr, $from))
|
||||
$tab[] = $attribut;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
return $tab;
|
||||
}
|
||||
|
||||
public function cutAttribute($attr, $from)
|
||||
{
|
||||
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))
|
||||
return false;
|
||||
else
|
||||
return array ('table' => $table,
|
||||
'alias' => $tab[0],
|
||||
'attribut' => $tab[1],
|
||||
'string' => $attr);
|
||||
}
|
||||
elseif (preg_match('#^((`(\()?([a-z_])+`(\))?)|((\()?([a-z_])+(\))?))$#i', $attr))
|
||||
{
|
||||
$attribut = str_replace(array('`', '(', ')'), '', $attr);
|
||||
if(!$table = $this->returnNameTable(false, $from, $attr))
|
||||
return false;
|
||||
else
|
||||
return array('table' => $table,
|
||||
'attribut' => $attribut,
|
||||
'string' => $attr);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public function returnNameTable($alias = false, $tables, $expr)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
elseif(!$alias && (count($tables) > 1))
|
||||
{
|
||||
$this->errorSql['returnNameTable'] = false;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($tables as $table)
|
||||
$tab[] = $table['table'];
|
||||
return $tab;
|
||||
}
|
||||
}
|
||||
|
||||
public function attributExistInTable($attr, $tables)
|
||||
{
|
||||
foreach($tables as $table)
|
||||
{
|
||||
$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))
|
||||
{
|
||||
$this->errorSql['testedRequired'] = $key;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function testedUnauthorized($tab)
|
||||
{
|
||||
foreach($this->tested['unauthorized'] as $key)
|
||||
if(@array_key_exists($key, $tab))
|
||||
{
|
||||
$this->errorSql['testedUnauthorized'] = $key;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkedFrom($from)
|
||||
{
|
||||
for($i = 0 ; $i < count($from) ; $i++)
|
||||
{
|
||||
$table = $from[$i];
|
||||
if(!in_array(str_replace('`', '', $table['table']), $this->showTables()))
|
||||
{
|
||||
$this->errorSql['checkedFrom']['table'] = $table['table'];
|
||||
return false;
|
||||
}
|
||||
if($table['ref_type'] == "ON" && (trim($table['join_type']) == "LEFT" || trim($table['join_type']) == "JOIN"))
|
||||
{
|
||||
if($attrs = $this->cutJoin($table['ref_clause'], $from))
|
||||
{
|
||||
foreach($attrs as $attr)
|
||||
{
|
||||
if(!$this->attributExistInTable($attr['attribut'],$attr['table']))
|
||||
{
|
||||
$this->errorSql['checkedFrom']['attribut'] = array($attr['attribut'], implode(', ', $attr['table']));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($this->errorSql['returnNameTable']))
|
||||
{
|
||||
$this->errorSql['checkedFrom'] = $this->errorSql['returnNameTable'];
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errorSql['checkedFrom'] = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function checkedSelect($select, $from, $in = false)
|
||||
{
|
||||
for($i = 0 ; $i < count($select) ; $i++ )
|
||||
{
|
||||
$attribut = $select[$i];
|
||||
if($attribut['base_expr'] != '*')
|
||||
{
|
||||
if ($attribut['expr_type'] == "colref" || $attribut['expr_type'] == "reserved")
|
||||
{
|
||||
if($attr = $this->cutAttribute($attribut['base_expr'], $from))
|
||||
{
|
||||
if(!$this->attributExistInTable($attr['attribut'],$attr['table']))
|
||||
{
|
||||
$this->errorSql['checkedSelect']['attribut'] = array($attr['attribut'], implode(', ', $attr['table']));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($this->errorSql['returnNameTable']))
|
||||
{
|
||||
$this->errorSql['checkedSelect'] = $this->errorSql['returnNameTable'];
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errorSql['checkedSelect'] = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($in)
|
||||
{
|
||||
$this->errorSql['checkedSelect']['*'] = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkedWhere($where, $from, $operator, $sql)
|
||||
{
|
||||
for($i = 0 ; $i < count($where) ; $i++ )
|
||||
{
|
||||
$attribut = $where[$i];
|
||||
if ($attribut['expr_type'] == "colref" || $attribut['expr_type'] == "reserved")
|
||||
{
|
||||
if($attr = $this->cutAttribute($attribut['base_expr'], $from))
|
||||
{
|
||||
if (!$this->attributExistInTable($attr['attribut'],$attr['table']))
|
||||
{
|
||||
$this->errorSql['checkedWhere']['attribut'] = array($attr['attribut'], implode(', ', $attr['table']));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($this->errorSql['returnNameTable']))
|
||||
{
|
||||
$this->errorSql['checkedWhere'] = $this->errorSql['returnNameTable'];
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errorSql['checkedWhere'] = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($attribut['expr_type'] == "operator")
|
||||
{
|
||||
if (!in_array(strtoupper($attribut['base_expr']), $this->tested['operator']))
|
||||
{
|
||||
$this->errorSql['checkedWhere']['operator'] = array($attribut['base_expr']);
|
||||
return false;
|
||||
}
|
||||
elseif (!$this->attributExistInTable($attr['attribut'],$attr['table']))
|
||||
{
|
||||
$this->errorSql['checkedWhere']['operator'] = array($attribut['base_expr']);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
elseif ($attribut['expr_type'] == "subquery")
|
||||
{
|
||||
$tab = $attribut['sub_tree'];
|
||||
return $this->validateSql($tab, true, $sql);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkedHaving($having, $from)
|
||||
{
|
||||
$nb = count($having);
|
||||
for($i = 0 ; $i < $nb ; $i++ )
|
||||
{
|
||||
$attribut = $having[$i];
|
||||
if($attribut['expr_type'] == "colref")
|
||||
{
|
||||
if($attr = $this->cutAttribute($attribut['base_expr'], $from))
|
||||
{
|
||||
if(!$this->attributExistInTable($attr['attribut'],$attr['table']))
|
||||
{
|
||||
$this->errorSql['checkedHaving']['attribut'] = array($attr['attribut'], implode(', ', $attr['table']));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($this->errorSql['returnNameTable']))
|
||||
{
|
||||
$this->errorSql['checkedHaving'] = $this->errorSql['returnNameTable'];
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errorSql['checkedHaving'] = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($attribut['expr_type'] == "operator")
|
||||
{
|
||||
if(!in_array(strtoupper($attribut['base_expr']), $this->tested['operator']))
|
||||
{
|
||||
$this->errorSql['checkedHaving']['operator'] = array($attribut['base_expr']);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkedOrder($order, $from)
|
||||
{
|
||||
$order = $order[0];
|
||||
if($order['type'] == "expression")
|
||||
{
|
||||
if($attr = $this->cutAttribute($order['base_expr'], $from))
|
||||
{
|
||||
if(!$this->attributExistInTable($attr['attribut'],$attr['table']))
|
||||
{
|
||||
$this->errorSql['checkedOrder']['attribut'] = array($attr['attribut'], implode(', ', $attr['table']));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($this->errorSql['returnNameTable']))
|
||||
{
|
||||
$this->errorSql['checkedOrder'] = $this->errorSql['returnNameTable'];
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errorSql['checkedOrder'] = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkedGroupBy($group, $from)
|
||||
{
|
||||
$group = $group[0];
|
||||
if($group['type'] == "expression")
|
||||
{
|
||||
if($attr = $this->cutAttribute($group['base_expr'], $from))
|
||||
{
|
||||
if(!$this->attributExistInTable($attr['attribut'],$attr['table']))
|
||||
{
|
||||
$this->errorSql['checkedGroupBy']['attribut'] = array($attr['attribut'], implode(', ', $attr['table']));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($this->errorSql['returnNameTable']))
|
||||
{
|
||||
$this->errorSql['checkedGroupBy'] = $this->errorSql['returnNameTable'];
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errorSql['checkedGroupBy'] = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function checkedLimit($limit)
|
||||
{
|
||||
if(!preg_match('#^[0-9]+$#', trim($limit['start'])) || !preg_match('#^[0-9]+$#', trim($limit['end'])))
|
||||
{
|
||||
$this->errorSql['checkedLimit'] = false;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1317,6 +1317,18 @@ class ToolsCore
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static function parserSQL($sql)
|
||||
{
|
||||
if (strlen($sql) > 0)
|
||||
{
|
||||
require_once(_PS_TOOL_DIR_.'parser_sql/parser_sql.php');
|
||||
$parser = new parserSql($sql);
|
||||
return $parser->parsed;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function minifyCSS($css_content, $fileuri = false)
|
||||
{
|
||||
global $current_css_file;
|
||||
|
||||
@@ -1392,6 +1392,13 @@ CREATE TABLE `PREFIX_referrer_shop` (
|
||||
PRIMARY KEY (`id_referrer`, `id_shop`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `PREFIX_request_sql` (
|
||||
`id_request_sql` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(200) NOT NULL,
|
||||
`sql` text NOT NULL,
|
||||
PRIMARY KEY (`id_request_sql`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `PREFIX_scene` (
|
||||
`id_scene` int(10) unsigned NOT NULL auto_increment,
|
||||
`active` tinyint(1) NOT NULL default '1',
|
||||
|
||||
@@ -940,6 +940,7 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del
|
||||
(2, 89, 0, 0, 0, 0),
|
||||
(2, 90, 0, 0, 0, 0),
|
||||
(2, 91, 0, 0, 0, 0),
|
||||
(2, 92, 0, 0, 0, 0),
|
||||
(3, 1, 1, 1, 1, 1),
|
||||
(3, 2, 0, 0, 0, 0),
|
||||
(3, 3, 0, 0, 0, 0),
|
||||
@@ -1022,6 +1023,7 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del
|
||||
(3, 89, 0, 0, 0, 0),
|
||||
(3, 90, 0, 0, 0, 0),
|
||||
(3, 91, 0, 0, 0, 0),
|
||||
(3, 92, 0, 0, 0, 0),
|
||||
(4, 1, 1, 1, 1, 1),
|
||||
(4, 2, 1, 1, 1, 1),
|
||||
(4, 3, 1, 1, 1, 1),
|
||||
@@ -1103,7 +1105,8 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del
|
||||
(4, 88, 1, 1, 1, 1),
|
||||
(4, 89, 0, 0, 0, 0),
|
||||
(4, 90, 0, 0, 0, 0),
|
||||
(4, 91, 0, 0, 0, 0);
|
||||
(4, 91, 0, 0, 0, 0),
|
||||
(4, 92, 0, 0, 0, 0);
|
||||
|
||||
INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) (SELECT 2, id_module, 0, 1 FROM PREFIX_module);
|
||||
INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) (SELECT 3, id_module, 0, 1 FROM PREFIX_module);
|
||||
|
||||
@@ -845,7 +845,7 @@ INSERT INTO `PREFIX_tab` (`id_tab`, `class_name`, `id_parent`, `position`) VALUE
|
||||
(70, 'AdminPerformance', 8, 11),(71, 'AdminCustomerThreads', 29, 4),(72, 'AdminWebservice', 9, 12),(73, 'AdminStockMvt', 1, 9),
|
||||
(80, 'AdminAddonsCatalog', 7, 1),(81, 'AdminAddonsMyAccount', 7, 2),(83, 'AdminThemes', 7, 3),(84, 'AdminGeolocation', 8, 12),
|
||||
(85, 'AdminTaxRulesGroup', 4, 3),(86, 'AdminLogs', 9, 13), (87,'AdminHome',-1,0),
|
||||
(88,'AdminShop', 0, 11), (89,'AdminGroupShop', 88, 1),(90, 'AdminShopUrl', 88, 2),(91, 'AdminGenders', 2, 4);
|
||||
(88,'AdminShop', 0, 11), (89,'AdminGroupShop', 88, 1),(90, 'AdminShopUrl', 88, 2),(91, 'AdminGenders', 2, 4),(92, 'AdminRequestSql', 9, 14);
|
||||
|
||||
INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) (SELECT 1, id_tab, 1, 1, 1, 1 FROM PREFIX_tab);
|
||||
|
||||
@@ -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, 87, 'Home'), (1, 88, 'Shops'), (1, 89, 'Group Shops'), (1, 90, 'Shop Urls'),(1, 91, 'Genders'),(1, 92, 'Request');
|
||||
|
||||
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, 87,'Accueil'), (2, 88, 'Boutiques'), (2, 89, 'Groupes de boutique'), (2, 90, 'URLs de boutique'),(2, 91, 'Genres'),(2, 92, 'requête');
|
||||
|
||||
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, 87,'Home'), (3, 88, 'Shops'), (3, 89, 'Group Shops'), (3, 90, 'Shop Urls'),(3, 91, 'Genders'),(3, 92, 'Solicitud');
|
||||
|
||||
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, 87,'Home'), (4, 88, 'Shops'), (4, 89, 'Group Shops'), (4, 90, 'Shop Urls'),(4, 91, 'Genders'),(4, 92, 'Wunsch');
|
||||
|
||||
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, 87,'Home'), (5, 88, 'Shops'), (5, 89, 'Group Shops'), (5, 90, 'Shop Urls'),(5, 91, 'Genders'),(5, 92, 'Richiesta');
|
||||
|
||||
INSERT IGNORE INTO `PREFIX_tab_lang` (`id_tab`, `id_lang`, `name`)
|
||||
(SELECT `id_tab`, id_lang, (SELECT tl.`name`
|
||||
|
||||
@@ -157,3 +157,12 @@ ALTER TABLE `PREFIX_attribute_group` ADD `position` INT( 10 ) UNSIGNED NOT NULL
|
||||
ALTER TABLE `PREFIX_feature` ADD `position` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0';
|
||||
|
||||
/* PHP:add_feature_position(); */;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `PREFIX_request_sql` (
|
||||
`id_request_sql` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(200) NOT NULL,
|
||||
`sql` text NOT NULL,
|
||||
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); */;
|
||||
|
||||
36
tools/parser_sql/index.php
Normal file
36
tools/parser_sql/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 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/osl-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 license@prestashop.com 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 <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7776 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
1970
tools/parser_sql/parser_sql.php
Normal file
1970
tools/parser_sql/parser_sql.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -2495,6 +2495,40 @@ $_LANGADM['AdminReferrers4351cfebe4b61d8aa5efa1d020710005'] = 'Voir';
|
||||
$_LANGADM['AdminReferrers7dce122004969d56ae2e0245cb754d35'] = 'Modifier';
|
||||
$_LANGADM['AdminReferrersf9d49c6baa1183b09d4068c3e4d1ba2e'] = 'Supprimer l\'affilié ?';
|
||||
$_LANGADM['AdminReferrersf2a6c498fb90ee345d997f888fce3b18'] = 'Supprimer';
|
||||
$_LANGADM['AdminRequestSqlb718adec73e04ce3ec720dd11a06a308'] = 'ID';
|
||||
$_LANGADM['AdminRequestSql49ee3087348e8d44e1feda1917443987'] = 'Nom';
|
||||
$_LANGADM['AdminRequestSql15c2d85f1fae22a3c3a0594510a1f611'] = 'Requête';
|
||||
$_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['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 : ';
|
||||
$_LANGADM['AdminRequestSqlab1d92ebad371934228c8b85f65fa449'] = 'Requête : ';
|
||||
$_LANGADM['AdminRequestSql38fb7d24e0d60a048f540ecb18e13376'] = 'Sauvegarder';
|
||||
$_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['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['AdminRequestSql19681d28ed1cc72479bc26b7e76ad240'] = 'La clause LIMIT doit comporter des arguments de type numerique.';
|
||||
$_LANGADM['AdminRequestSql569a67022452692cad0c2da1243ad7ab'] = 'La référence ';
|
||||
$_LANGADM['AdminRequestSqld2c0d63fe01c737e0afe765ffb89fc75'] = 'n\'existe pas dans : ';
|
||||
$_LANGADM['AdminRequestSql36296325727560bc0b1ae0e0801c82b7'] = 'Lorsque plusieurs tables sont utilisées, chaque attribut doit être référencé à l\'une de ces tables.';
|
||||
$_LANGADM['AdminRequestSql627e3d3b6303c563993e54186ffa3fdb'] = 'est un mot clé non autorisé.';
|
||||
$_LANGADM['AdminRequestSql0557fa923dcee4d0f86b1409f5c2167f'] = 'Retour';
|
||||
$_LANGADM['AdminRequestSql630f6dc397fe74e52d5189e2c80f282b'] = 'Retourner à la liste';
|
||||
$_LANGADM['AdminRequestSql00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Activé';
|
||||
$_LANGADM['AdminRequestSqlb9f5c797ebbf55adccdd8539a65a0241'] = 'Handicapés';
|
||||
$_LANGADM['AdminRequestSql08a38277b0309070706f6652eeae9a53'] = 'Bas';
|
||||
$_LANGADM['AdminRequestSql258f49887ef8d14ac268c92b02503aaa'] = 'Jusqu\'à';
|
||||
$_LANGADM['AdminRequestSqlb2507468f95156358fa490fd543ad2f0'] = 'Export';
|
||||
$_LANGADM['AdminReturnb718adec73e04ce3ec720dd11a06a308'] = 'ID';
|
||||
$_LANGADM['AdminReturnd79cf3f429596f77db95c65074663a54'] = 'ID commande';
|
||||
$_LANGADM['AdminReturnec53a8c4f07baed5d8825072c89799be'] = 'Statut';
|
||||
|
||||
Reference in New Issue
Block a user