From bd69875675068aa88b8fa0c2db61d8d563071375 Mon Sep 17 00:00:00 2001 From: Deltik Date: Thu, 9 May 2013 22:48:27 -0500 Subject: [PATCH] Bad SQL fix in model_class.php ; eMessage class constants created --- README.md | 2 +- e107_handlers/message_handler.php | 19 +++++++++++++++++-- e107_handlers/model_class.php | 6 +++--- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bcedebe3a..76844f142 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ e107 is a free (open-source) content management system which allows you to easil ### Reporting Bugs Be sure you are using the most recent version prior to reporting an issue. -Your may report any bugs or feature requests on Github (https://github.com/e107inc/e107/issues) +You may report any bugs or feature requests on GitHub (https://github.com/e107inc/e107/issues) ### Pull-Requests diff --git a/e107_handlers/message_handler.php b/e107_handlers/message_handler.php index c276eca10..c01acce55 100644 --- a/e107_handlers/message_handler.php +++ b/e107_handlers/message_handler.php @@ -18,6 +18,10 @@ if (!defined('e107_INIT')) { exit; } /* * Type defines * XXX - convert to eMessage class constants + * @note 07 May 2013: These have been converted to eMessage class constants! + * Example: eMessage::E_MESSAGE_SUCCESS is 'success' + * -- Deltik + * P.S. Now somebody needs to get rid of these universal constants... */ define('E_MESSAGE_INFO', 'info'); define('E_MESSAGE_SUCCESS', 'success'); @@ -39,6 +43,17 @@ define('E_MESSAGE_NODISPLAY', 'nodisplay'); // Appears to be needed by update_ro */ class eMessage { + /** + * Type defines + */ + const E_INFO = 'info'; + const E_SUCCESS = 'success'; + const E_WARNING = 'warning'; + const E_ERROR = 'error'; + const E_DEBUG = 'debug'; + const E_NODISPLAY = 'nodisplay'; + + /** * System Message Array * in format [type][message_stack] = array(message[, ...]) @@ -172,7 +187,7 @@ class eMessage * @param boolean $session * @return eMessage */ - public function add($message, $type = E_MESSAGE_INFO, $session = false) + public function add($message, $type = eMessage::E_INFO, $session = false) { if(empty($message)) return $this; @@ -997,4 +1012,4 @@ function show_emessage($mode, $message, $line = 0, $file = "") { } } -?> \ No newline at end of file +?> diff --git a/e107_handlers/model_class.php b/e107_handlers/model_class.php index 036822066..e59ac2dd2 100644 --- a/e107_handlers/model_class.php +++ b/e107_handlers/model_class.php @@ -3485,7 +3485,7 @@ class e_admin_tree_model extends e_front_tree_model $idstr = implode(', ', $ids); $sql = e107::getDb(); - $res = $sql->db_Delete($this->getModelTable(), $this->getFieldIdName().' IN ('.$idstr.')'); + $res = $sql->db_Delete($this->getModelTable(), $this->getFieldIdName().' IN (\''.$idstr.'\')'); $this->_db_errno = $sql->getLastErrorNumber(); $this->_db_errmsg = $sql->getLastErrorText(); $modelCacheCheck = $this->getParam('clearModelCache'); @@ -3493,7 +3493,7 @@ class e_admin_tree_model extends e_front_tree_model { if($sql->getLastErrorNumber()) { - $this->addMessageError('SQL Delete Error', $session_messages); //TODO - Lan + $this->addMessageError('SQL Delete Error: ' . $sql->getLastQuery(), $session_messages); //TODO - Lan $this->addMessageDebug('SQL Error #'.$sql->getLastErrorNumber().': '.$sql->getLastErrorText()); } } @@ -3561,4 +3561,4 @@ class e_admin_tree_model extends e_front_tree_model } return $ret; } -} \ No newline at end of file +}