diff --git a/cache/class_index.php b/cache/class_index.php index 9116b0300..e2c72f61c 100644 --- a/cache/class_index.php +++ b/cache/class_index.php @@ -192,6 +192,7 @@ 'RangeWeight' => 'override/classes/RangeWeight.php', 'ReferrerCore' => 'classes/Referrer.php', 'Referrer' => 'override/classes/Referrer.php', + 'RequestSql' => 'classes/RequestSql.php', 'RijndaelCore' => 'classes/Rijndael.php', 'Rijndael' => 'override/classes/Rijndael.php', 'SceneCore' => 'classes/Scene.php', @@ -230,22 +231,6 @@ 'Upgrader' => 'override/classes/Upgrader.php', 'ValidateCore' => 'classes/Validate.php', 'Validate' => 'override/classes/Validate.php', - 'WebserviceExceptionCore' => 'classes/WebserviceException.php', - 'WebserviceException' => 'override/classes/WebserviceException.php', - 'WebserviceKeyCore' => 'classes/WebserviceKey.php', - 'WebserviceKey' => 'override/classes/WebserviceKey.php', - 'WebserviceOutputBuilderCore' => 'classes/WebserviceOutputBuilder.php', - 'WebserviceOutputBuilder' => 'override/classes/WebserviceOutputBuilder.php', - 'WebserviceOutputInterface' => 'classes/WebserviceOutputInterface.php', - 'WebserviceOutputXMLCore' => 'classes/WebserviceOutputXML.php', - 'WebserviceOutputXML' => 'override/classes/WebserviceOutputXML.php', - 'WebserviceRequestCore' => 'classes/WebserviceRequest.php', - 'WebserviceRequest' => 'override/classes/WebserviceRequest.php', - 'WebserviceSpecificManagementImagesCore' => 'classes/WebserviceSpecificManagementImages.php', - 'WebserviceSpecificManagementImages' => 'override/classes/WebserviceSpecificManagementImages.php', - 'WebserviceSpecificManagementInterface' => 'classes/WebserviceSpecificManagementInterface.php', - 'WebserviceSpecificManagementSearchCore' => 'classes/WebserviceSpecificManagementSearch.php', - 'WebserviceSpecificManagementSearch' => 'override/classes/WebserviceSpecificManagementSearch.php', 'ZoneCore' => 'classes/Zone.php', 'Zone' => 'override/classes/Zone.php', 'DbCore' => 'classes/db/Db.php', @@ -258,6 +243,14 @@ 'DbQuery' => 'override/classes/db/DbQuery.php', 'MySQLCore' => 'classes/db/MySQL.php', 'MySQL' => 'override/classes/db/MySQL.php', + 'PrestashopDatabaseExceptionCore' => 'classes/exception/PrestashopDatabaseException.php', + 'PrestashopDatabaseException' => 'override/classes/exception/PrestashopDatabaseException.php', + 'PrestashopExceptionCore' => 'classes/exception/PrestashopException.php', + 'PrestashopException' => 'override/classes/exception/PrestashopException.php', + 'PrestashopModuleExceptionCore' => 'classes/exception/PrestashopModuleException.php', + 'PrestashopModuleException' => 'override/classes/exception/PrestashopModuleException.php', + 'PrestashopPaymentExceptionCore' => 'classes/exception/PrestashopPaymentException.php', + 'PrestashopPaymentException' => 'override/classes/exception/PrestashopPaymentException.php', 'GroupShopCore' => 'classes/shop/GroupShop.php', 'GroupShop' => 'override/classes/shop/GroupShop.php', 'ShopCore' => 'classes/shop/Shop.php', @@ -279,6 +272,22 @@ 'TaxRulesGroup' => 'override/classes/tax/TaxRulesGroup.php', 'TaxRulesTaxManagerCore' => 'classes/tax/TaxRulesTaxManager.php', 'TaxRulesTaxManager' => 'override/classes/tax/TaxRulesTaxManager.php', + 'WebserviceExceptionCore' => 'classes/webservice/WebserviceException.php', + 'WebserviceException' => 'override/classes/webservice/WebserviceException.php', + 'WebserviceKeyCore' => 'classes/webservice/WebserviceKey.php', + 'WebserviceKey' => 'override/classes/webservice/WebserviceKey.php', + 'WebserviceOutputBuilderCore' => 'classes/webservice/WebserviceOutputBuilder.php', + 'WebserviceOutputBuilder' => 'override/classes/webservice/WebserviceOutputBuilder.php', + 'WebserviceOutputInterface' => 'classes/webservice/WebserviceOutputInterface.php', + 'WebserviceOutputXMLCore' => 'classes/webservice/WebserviceOutputXML.php', + 'WebserviceOutputXML' => 'override/classes/webservice/WebserviceOutputXML.php', + 'WebserviceRequestCore' => 'classes/webservice/WebserviceRequest.php', + 'WebserviceRequest' => 'override/classes/webservice/WebserviceRequest.php', + 'WebserviceSpecificManagementImagesCore' => 'classes/webservice/WebserviceSpecificManagementImages.php', + 'WebserviceSpecificManagementImages' => 'override/classes/webservice/WebserviceSpecificManagementImages.php', + 'WebserviceSpecificManagementInterface' => 'classes/webservice/WebserviceSpecificManagementInterface.php', + 'WebserviceSpecificManagementSearchCore' => 'classes/webservice/WebserviceSpecificManagementSearch.php', + 'WebserviceSpecificManagementSearch' => 'override/classes/webservice/WebserviceSpecificManagementSearch.php', 'FB' => 'override/classes/fb.php', 'AdminHomeControllerCore' => 'controllers/admin/AdminHomeController.php', 'AdminHomeController' => '', diff --git a/classes/Autoload.php b/classes/Autoload.php index 20d608ec4..9b7eb5b65 100644 --- a/classes/Autoload.php +++ b/classes/Autoload.php @@ -78,7 +78,10 @@ class Autoload public function load($classname) { // regenerate the class index if the requested class is not found in the index or if the requested file doesn't exists - if (!isset($this->index[$classname]) || ($this->index[$classname] && !file_exists($this->root_dir.$this->index[$classname]))) + if (!isset($this->index[$classname]) + || ($this->index[$classname] && !is_file($this->root_dir.$this->index[$classname])) + || (isset($this->index[$classname.'Core']) && $this->index[$classname.'Core'] && !is_file($this->root_dir.$this->index[$classname])) + ) $this->generateIndex(); // If $classname has not core suffix (E.g. Shop, Product) @@ -87,7 +90,6 @@ class Autoload // If requested class does not exist, load associated core class if (isset($this->index[$classname]) && !$this->index[$classname]) { - require_once($this->root_dir.$this->index[$classname.'Core']); if (file_exists($this->root_dir.'override/'.$this->index[$classname.'Core'])) { diff --git a/classes/Tools.php b/classes/Tools.php index 32ea1d948..e52d710c5 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -598,7 +598,7 @@ class ToolsCore */ public static function d($object, $kill = true) { - return (self::dieObject($object, $kill = true)); + return (self::dieObject($object, $kill)); } /** diff --git a/classes/exception/PrestashopDatabaseException.php b/classes/exception/PrestashopDatabaseException.php new file mode 100644 index 000000000..bb849dae3 --- /dev/null +++ b/classes/exception/PrestashopDatabaseException.php @@ -0,0 +1,35 @@ + +* @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 +*/ + +/** + * @since 1.5.0 + */ +class PrestashopDatabaseExceptionCore extends PrestashopException +{ + +} + diff --git a/classes/exception/PrestashopException.php b/classes/exception/PrestashopException.php new file mode 100644 index 000000000..057b5496a --- /dev/null +++ b/classes/exception/PrestashopException.php @@ -0,0 +1,139 @@ + +* @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 +*/ + +/** + * @since 1.5.0 + */ +class PrestashopExceptionCore extends Exception +{ + /** + * This method acts like an error handler, if dev mode is on, display the error else use a better silent way + */ + public function displayMessage() + { + if (_PS_MODE_DEV_) + { + // Display error message + echo ''; + echo '
'; + echo '

['.get_class($this).']

'; + printf( + '

%s
at line %d in file %s

', + $this->getMessage(), + $this->getLine(), + ltrim(str_replace(array(_PS_ROOT_DIR_, '\\'), array('', '/'), $this->getFile()), '/') + ); + + // Display debug backtrace + echo ''; + echo '
'; + } + else + { + // If not in mode dev, launch a http 500 error + header('HTTP/1.1 500 Internal Server Error'); + if (file_exists(_PS_ROOT_DIR_.'/error500.html')) + echo file_get_contents(_PS_ROOT_DIR_.'/error500.html'); + } + exit; + } + + /** + * Display lines around current line + * + * @param string $file + * @param int $line + * @param string $id + */ + protected function displayFileDebug($file, $line, $id) + { + $lines = file($file); + $offset = $line - 6; + $total = 11; + if ($offset < 0) + { + $total += $offset; + $offset = 0; + } + $lines = array_slice($lines, $offset, $total); + + echo '
';
+		foreach ($lines as $k => $l)
+		{
+			if ($offset + $k == $line - 1)
+				echo ''.($offset + $k).'. '.htmlspecialchars($l).'';
+			else
+				echo ($offset + $k).'. '.htmlspecialchars($l);
+		}
+		echo '
'; + } + + /** + * Display arguments list of traced function + * + * @param array $args List of arguments + * @param string $id ID of argument + */ + protected function displayArgsDebug($args, $id) + { + echo '
';
+		foreach ($args as $arg => $value)
+		{
+			echo 'Argument ['.$arg."]\n";
+			print_r($value);
+			echo "\n";
+		}
+		echo '
'; + } +} \ No newline at end of file diff --git a/classes/PrestashopException.php b/classes/exception/PrestashopModuleException.php similarity index 86% rename from classes/PrestashopException.php rename to classes/exception/PrestashopModuleException.php index 7a3b7eca6..bc326c89b 100644 --- a/classes/PrestashopException.php +++ b/classes/exception/PrestashopModuleException.php @@ -1,31 +1,35 @@ - -* @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 PrestashopExceptionCore Extends Exception -{ - -} \ No newline at end of file + +* @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 +*/ + +/** + * @since 1.5.0 + */ +class PrestashopModuleExceptionCore extends PrestashopException +{ + +} + diff --git a/classes/exception/PrestashopPaymentException.php b/classes/exception/PrestashopPaymentException.php new file mode 100644 index 000000000..176c776c1 --- /dev/null +++ b/classes/exception/PrestashopPaymentException.php @@ -0,0 +1,35 @@ + +* @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 +*/ + +/** + * @since 1.5.0 + */ +class PrestashopPaymentExceptionCore extends PrestashopException +{ + +} + diff --git a/classes/exception/index.php b/classes/exception/index.php new file mode 100644 index 000000000..4e2611d37 --- /dev/null +++ b/classes/exception/index.php @@ -0,0 +1,36 @@ + +* @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 +*/ + +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; \ No newline at end of file diff --git a/override/classes/exception/PrestashopDatabaseException.php b/override/classes/exception/PrestashopDatabaseException.php new file mode 100644 index 000000000..8d65f5903 --- /dev/null +++ b/override/classes/exception/PrestashopDatabaseException.php @@ -0,0 +1,7 @@ + +* @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 +*/ + +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; \ No newline at end of file diff --git a/override/classes/WebserviceException.php b/override/classes/webservice/WebserviceException.php similarity index 100% rename from override/classes/WebserviceException.php rename to override/classes/webservice/WebserviceException.php diff --git a/override/classes/WebserviceKey.php b/override/classes/webservice/WebserviceKey.php similarity index 100% rename from override/classes/WebserviceKey.php rename to override/classes/webservice/WebserviceKey.php diff --git a/override/classes/WebserviceOutputBuilder.php b/override/classes/webservice/WebserviceOutputBuilder.php similarity index 100% rename from override/classes/WebserviceOutputBuilder.php rename to override/classes/webservice/WebserviceOutputBuilder.php diff --git a/override/classes/WebserviceOutputXML.php b/override/classes/webservice/WebserviceOutputXML.php similarity index 100% rename from override/classes/WebserviceOutputXML.php rename to override/classes/webservice/WebserviceOutputXML.php diff --git a/override/classes/WebserviceRequest.php b/override/classes/webservice/WebserviceRequest.php similarity index 100% rename from override/classes/WebserviceRequest.php rename to override/classes/webservice/WebserviceRequest.php diff --git a/override/classes/WebserviceSpecificManagementImages.php b/override/classes/webservice/WebserviceSpecificManagementImages.php similarity index 100% rename from override/classes/WebserviceSpecificManagementImages.php rename to override/classes/webservice/WebserviceSpecificManagementImages.php diff --git a/override/classes/WebserviceSpecificManagementSearch.php b/override/classes/webservice/WebserviceSpecificManagementSearch.php similarity index 100% rename from override/classes/WebserviceSpecificManagementSearch.php rename to override/classes/webservice/WebserviceSpecificManagementSearch.php diff --git a/override/classes/webservice/index.php b/override/classes/webservice/index.php new file mode 100644 index 000000000..4e2611d37 --- /dev/null +++ b/override/classes/webservice/index.php @@ -0,0 +1,36 @@ + +* @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 +*/ + +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; \ No newline at end of file