// Add exceptions in db classes + normalize some files + split defines.inc file
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9216 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -144,7 +144,7 @@ class AdminShop extends AdminTab
|
||||
$categories = Category::getCategories($this->context->language->id, false);
|
||||
Category::recurseCategory($categories, $categories[0][1], 1, $obj->id_category);
|
||||
|
||||
echo '
|
||||
echo '
|
||||
</select>
|
||||
</div>
|
||||
<label>'.$this->l('Status:').' </label>
|
||||
|
||||
@@ -906,7 +906,7 @@ abstract class AdminTabCore
|
||||
Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.$this->table.'_'.$assos[1].' (`'.pSQL($this->identifier).'`, id_'.$assos[1].')
|
||||
VALUES('.(int)$asso['id_object'].', '.(int)$asso['id_'.$assos[1]].')');
|
||||
}
|
||||
|
||||
|
||||
protected static function getAssoShop($table, $id_object = false)
|
||||
{
|
||||
$shopAsso = Shop::getAssoTables();
|
||||
|
||||
+2
-2
@@ -484,8 +484,8 @@ abstract class DbCore
|
||||
else if (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS'))
|
||||
{
|
||||
if ($sql)
|
||||
die(Tools::displayError($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>'));
|
||||
die(Tools::displayError($this->getMsgError()));
|
||||
throw new PrestashopDatabaseException(Tools::displayError($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>'));
|
||||
throw new PrestashopDatabaseException(Tools::displayError($this->getMsgError()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,15 +35,15 @@ class DbMySQLiCore extends Db
|
||||
*/
|
||||
public function connect()
|
||||
{
|
||||
$this->link = new mysqli($this->server, $this->user, $this->password, $this->database);
|
||||
$this->link = @new mysqli($this->server, $this->user, $this->password, $this->database);
|
||||
|
||||
// Do not use object way for error because this work bad before PHP 5.2.9
|
||||
if (mysqli_connect_error())
|
||||
die(Tools::displayError('Link to database cannot be established : '.mysqli_connect_error()));
|
||||
throw new PrestashopDatabaseException(Tools::displayError('Link to database cannot be established : '.mysqli_connect_error()));
|
||||
|
||||
// UTF-8 support
|
||||
if (!$this->link->query('SET NAMES \'utf8\''))
|
||||
die(Tools::displayError('PrestaShop Fatal error: no utf-8 support. Please check your server configuration.'));
|
||||
throw new PrestashopDatabaseException(Tools::displayError('PrestaShop Fatal error: no utf-8 support. Please check your server configuration.'));
|
||||
|
||||
return $this->link;
|
||||
}
|
||||
@@ -53,7 +53,7 @@ class DbMySQLiCore extends Db
|
||||
*/
|
||||
public function disconnect()
|
||||
{
|
||||
$this->link->close();
|
||||
@$this->link->close();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,12 +43,12 @@ class DbPDOCore extends Db
|
||||
}
|
||||
catch (PDOException $e)
|
||||
{
|
||||
die(Tools::displayError('Link to database cannot be established. ('.$e->getMessage().')'));
|
||||
throw new PrestashopDatabaseException(Tools::displayError('Link to database cannot be established. ('.$e->getMessage().')'));
|
||||
}
|
||||
|
||||
// UTF-8 support
|
||||
if ($this->link->exec('SET NAMES \'utf8\'') === false)
|
||||
die(Tools::displayError('PrestaShop Fatal error: no utf-8 support. Please check your server configuration.'));
|
||||
throw new PrestashopDatabaseException(Tools::displayError('PrestaShop Fatal error: no utf-8 support. Please check your server configuration.'));
|
||||
|
||||
return $this->link;
|
||||
}
|
||||
|
||||
@@ -36,14 +36,14 @@ class MySQLCore extends Db
|
||||
define('_PS_MYSQL_REAL_ESCAPE_STRING_', function_exists('mysql_real_escape_string'));
|
||||
|
||||
if (!$this->link = mysql_connect($this->server, $this->user, $this->password))
|
||||
die(Tools::displayError('Link to database cannot be established.'));
|
||||
throw new PrestashopDatabaseException(Tools::displayError('Link to database cannot be established.'));
|
||||
|
||||
if (!$this->set_db($this->database))
|
||||
die(Tools::displayError('The database selection cannot be made.'));
|
||||
throw new PrestashopDatabaseException(Tools::displayError('The database selection cannot be made.'));
|
||||
|
||||
// UTF-8 support
|
||||
if (!mysql_query('SET NAMES \'utf8\'', $this->link))
|
||||
die(Tools::displayError('PrestaShop Fatal error: no utf-8 support. Please check your server configuration.'));
|
||||
throw new PrestashopDatabaseException(Tools::displayError('PrestaShop Fatal error: no utf-8 support. Please check your server configuration.'));
|
||||
|
||||
return $this->link;
|
||||
}
|
||||
|
||||
@@ -388,14 +388,14 @@ class ShopCore extends ObjectModel
|
||||
}
|
||||
|
||||
$sql = 'SELECT gs.*, s.*, gs.name AS group_name, s.name AS shop_name, s.active, su.domain, su.domain_ssl, su.physical_uri, su.virtual_uri'.$select.'
|
||||
FROM '._DB_PREFIX_.'group_shop gs
|
||||
LEFT JOIN '._DB_PREFIX_.'shop s
|
||||
ON s.id_group_shop = gs.id_group_shop
|
||||
LEFT JOIN '._DB_PREFIX_.'shop_url su
|
||||
ON s.id_shop = su.id_shop AND su.main = 1
|
||||
'.$from.'
|
||||
WHERE s.deleted = 0
|
||||
AND gs.deleted = 0
|
||||
FROM '._DB_PREFIX_.'group_shop gs
|
||||
LEFT JOIN '._DB_PREFIX_.'shop s
|
||||
ON s.id_group_shop = gs.id_group_shop
|
||||
LEFT JOIN '._DB_PREFIX_.'shop_url su
|
||||
ON s.id_shop = su.id_shop AND su.main = 1
|
||||
'.$from.'
|
||||
WHERE s.deleted = 0
|
||||
AND gs.deleted = 0
|
||||
'.$where.'
|
||||
ORDER BY gs.name, s.name';
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ if (!file_exists(dirname(__FILE__).'/settings.inc.php'))
|
||||
exit;
|
||||
}
|
||||
require_once(dirname(__FILE__).'/settings.inc.php');
|
||||
require_once(dirname(__FILE__).'/defines.inc.php');
|
||||
require_once(dirname(__FILE__).'/autoload.php');
|
||||
|
||||
/* Redefine REQUEST_URI if empty (on some webservers...) */
|
||||
@@ -84,8 +85,8 @@ Context::getContext()->shop = Shop::initialize();
|
||||
define('_THEME_NAME_', Context::getContext()->shop->getTheme());
|
||||
define('__PS_BASE_URI__', Context::getContext()->shop->getBaseURI());
|
||||
|
||||
/* Include all defines */
|
||||
require_once(dirname(__FILE__).'/defines.inc.php');
|
||||
/* Include all defines related to base uri and theme name */
|
||||
require_once(dirname(__FILE__).'/defines_uri.inc.php');
|
||||
|
||||
if (!defined('_PS_MODULE_DIR_'))
|
||||
define('_PS_MODULE_DIR_', _PS_ROOT_DIR_.'/modules/');
|
||||
|
||||
+2
-33
@@ -35,38 +35,6 @@ if (!defined('PHP_VERSION_ID'))
|
||||
define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2]));
|
||||
}
|
||||
|
||||
/* Theme URLs */
|
||||
define('_THEMES_DIR_', __PS_BASE_URI__.'themes/');
|
||||
define('_THEME_DIR_', _THEMES_DIR_._THEME_NAME_.'/');
|
||||
define('_THEME_IMG_DIR_', _THEME_DIR_.'img/');
|
||||
define('_THEME_CSS_DIR_', _THEME_DIR_.'css/');
|
||||
define('_THEME_JS_DIR_', _THEME_DIR_.'js/');
|
||||
|
||||
/* Image URLs */
|
||||
define('_PS_IMG_', __PS_BASE_URI__.'img/');
|
||||
define('_PS_ADMIN_IMG_', _PS_IMG_.'admin/');
|
||||
define('_PS_TMP_IMG_', _PS_IMG_.'tmp/');
|
||||
define('_THEME_CAT_DIR_', _PS_IMG_.'c/');
|
||||
define('_THEME_PROD_DIR_', _PS_IMG_.'p/');
|
||||
define('_THEME_MANU_DIR_', _PS_IMG_.'m/');
|
||||
define('_THEME_SCENE_DIR_', _PS_IMG_.'scenes/');
|
||||
define('_THEME_SCENE_THUMB_DIR_', _PS_IMG_.'scenes/thumbs');
|
||||
define('_THEME_SUP_DIR_', _PS_IMG_.'su/');
|
||||
define('_THEME_SHIP_DIR_', _PS_IMG_.'s/');
|
||||
define('_THEME_STORE_DIR_', _PS_IMG_.'st/');
|
||||
define('_THEME_LANG_DIR_', _PS_IMG_.'l/');
|
||||
define('_THEME_COL_DIR_', _PS_IMG_.'co/');
|
||||
define('_THEME_GENDERS_DIR_', _PS_IMG_.'genders/');
|
||||
define('_SUPP_DIR_', _PS_IMG_.'su/');
|
||||
define('_PS_PROD_IMG_', 'img/p/');
|
||||
|
||||
/* Other URLs */
|
||||
define('_PS_JS_DIR_', __PS_BASE_URI__.'js/');
|
||||
define('_PS_CSS_DIR_', __PS_BASE_URI__.'css/');
|
||||
define('_THEME_PROD_PIC_DIR_', __PS_BASE_URI__.'upload/');
|
||||
define('_MAIL_DIR_', __PS_BASE_URI__.'mails/');
|
||||
define('_MODULE_DIR_', __PS_BASE_URI__.'modules/');
|
||||
|
||||
/* Directories */
|
||||
define('_PS_ROOT_DIR_', realpath($currentDir.'/..'));
|
||||
define('_PS_CLASS_DIR_', _PS_ROOT_DIR_.'/classes/');
|
||||
@@ -77,7 +45,6 @@ define('_PS_TRANSLATIONS_DIR_', _PS_ROOT_DIR_.'/translations/');
|
||||
define('_PS_DOWNLOAD_DIR_', _PS_ROOT_DIR_.'/download/');
|
||||
define('_PS_MAIL_DIR_', _PS_ROOT_DIR_.'/mails/');
|
||||
define('_PS_ALL_THEMES_DIR_', _PS_ROOT_DIR_.'/themes/');
|
||||
define('_PS_THEME_DIR_', _PS_ROOT_DIR_.'/themes/'._THEME_NAME_.'/');
|
||||
define('_PS_IMG_DIR_', _PS_ROOT_DIR_.'/img/');
|
||||
if (!defined('_PS_MODULE_DIR_'))
|
||||
define('_PS_MODULE_DIR_', _PS_ROOT_DIR_.'/modules/');
|
||||
@@ -151,6 +118,8 @@ define('_STOCK_MOVEMENT_MISSING_REASON_', 4);
|
||||
|
||||
define('_PS_DEFAULT_CUSTOMER_GROUP_', 1);
|
||||
|
||||
define('_PS_CACHEFS_DIRECTORY_', _PS_ROOT_DIR_.'/cache/cachefs/');
|
||||
|
||||
/* Geolocation */
|
||||
define('_PS_GEOLOCATION_NO_CATALOG_', 0);
|
||||
define('_PS_GEOLOCATION_NO_ORDER_', 1);
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
<?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$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
/* Theme URLs */
|
||||
define('_PS_THEME_DIR_', _PS_ROOT_DIR_.'/themes/'._THEME_NAME_.'/');
|
||||
define('_THEMES_DIR_', __PS_BASE_URI__.'themes/');
|
||||
define('_THEME_DIR_', _THEMES_DIR_._THEME_NAME_.'/');
|
||||
define('_THEME_IMG_DIR_', _THEME_DIR_.'img/');
|
||||
define('_THEME_CSS_DIR_', _THEME_DIR_.'css/');
|
||||
define('_THEME_JS_DIR_', _THEME_DIR_.'js/');
|
||||
|
||||
/* Image URLs */
|
||||
define('_PS_IMG_', __PS_BASE_URI__.'img/');
|
||||
define('_PS_ADMIN_IMG_', _PS_IMG_.'admin/');
|
||||
define('_PS_TMP_IMG_', _PS_IMG_.'tmp/');
|
||||
define('_THEME_CAT_DIR_', _PS_IMG_.'c/');
|
||||
define('_THEME_PROD_DIR_', _PS_IMG_.'p/');
|
||||
define('_THEME_MANU_DIR_', _PS_IMG_.'m/');
|
||||
define('_THEME_SCENE_DIR_', _PS_IMG_.'scenes/');
|
||||
define('_THEME_SCENE_THUMB_DIR_', _PS_IMG_.'scenes/thumbs');
|
||||
define('_THEME_SUP_DIR_', _PS_IMG_.'su/');
|
||||
define('_THEME_SHIP_DIR_', _PS_IMG_.'s/');
|
||||
define('_THEME_STORE_DIR_', _PS_IMG_.'st/');
|
||||
define('_THEME_LANG_DIR_', _PS_IMG_.'l/');
|
||||
define('_THEME_COL_DIR_', _PS_IMG_.'co/');
|
||||
define('_THEME_GENDERS_DIR_', _PS_IMG_.'genders/');
|
||||
define('_SUPP_DIR_', _PS_IMG_.'su/');
|
||||
define('_PS_PROD_IMG_', 'img/p/');
|
||||
|
||||
/* Other URLs */
|
||||
define('_PS_JS_DIR_', __PS_BASE_URI__.'js/');
|
||||
define('_PS_CSS_DIR_', __PS_BASE_URI__.'css/');
|
||||
define('_THEME_PROD_PIC_DIR_', __PS_BASE_URI__.'upload/');
|
||||
define('_MAIL_DIR_', __PS_BASE_URI__.'mails/');
|
||||
define('_MODULE_DIR_', __PS_BASE_URI__.'modules/');
|
||||
Reference in New Issue
Block a user