1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 03:40:37 +02:00

Bad SQL fix in model_class.php ; eMessage class constants created

This commit is contained in:
Deltik
2013-05-09 22:48:27 -05:00
parent bee8c3d559
commit bd69875675
3 changed files with 21 additions and 6 deletions

View File

@@ -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

View File

@@ -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 = "") {
}
}
?>
?>

View File

@@ -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;
}
}
}