1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 12:20:44 +02:00

Fixes #713, Fixes #897 - MySQL Strict Mode fixes.

This commit is contained in:
Cameron
2015-02-20 11:03:14 -08:00
parent 5eda1d3096
commit d7f603ae8b
5 changed files with 21 additions and 10 deletions

View File

@@ -1325,6 +1325,11 @@ class users_admin_ui extends e_admin_ui
} }
return; return;
} }
else
{
$mes->addError(LAN_CREATED_FAILED);
$mes->addError($sql->getLastErrorText());
}
} }
/** /**

View File

@@ -375,20 +375,20 @@ CREATE TABLE page (
page_sef varchar (250) NOT NULL default '', page_sef varchar (250) NOT NULL default '',
page_chapter int(10) unsigned NOT NULL default '0', page_chapter int(10) unsigned NOT NULL default '0',
page_metakeys varchar (250) NOT NULL default '', page_metakeys varchar (250) NOT NULL default '',
page_metadscr mediumtext NOT NULL, page_metadscr mediumtext,
page_text mediumtext NOT NULL, page_text mediumtext,
page_author int(10) unsigned NOT NULL default '0', page_author int(10) unsigned NOT NULL default '0',
page_datestamp int(10) unsigned NOT NULL default '0', page_datestamp int(10) unsigned NOT NULL default '0',
page_rating_flag tinyint(1) unsigned NOT NULL default '0', page_rating_flag tinyint(1) unsigned NOT NULL default '0',
page_comment_flag tinyint(1) unsigned NOT NULL default '0', page_comment_flag tinyint(1) unsigned NOT NULL default '0',
page_password varchar(50) NOT NULL default '', page_password varchar(50) NOT NULL default '',
page_class varchar(250) NOT NULL default '0', page_class varchar(250) NOT NULL default '0',
page_ip_restrict text NOT NULL, page_ip_restrict text,
page_template varchar(50) NOT NULL default '', page_template varchar(50) NOT NULL default '',
page_order int(4) unsigned NOT NULL default '9999', page_order int(4) unsigned NOT NULL default '9999',
menu_name varchar(50) NOT NULL default '', menu_name varchar(50) NOT NULL default '',
menu_title varchar(250) NOT NULL default '', menu_title varchar(250) NOT NULL default '',
menu_text mediumtext NOT NULL, menu_text mediumtext,
menu_image varchar(250) NOT NULL default '', menu_image varchar(250) NOT NULL default '',
menu_icon varchar(250) NOT NULL default '', menu_icon varchar(250) NOT NULL default '',
menu_template varchar(50) NOT NULL default '', menu_template varchar(50) NOT NULL default '',
@@ -546,7 +546,7 @@ CREATE TABLE user (
user_perms text NOT NULL, user_perms text NOT NULL,
user_realm text NOT NULL, user_realm text NOT NULL,
user_pwchange int(10) unsigned NOT NULL default '0', user_pwchange int(10) unsigned NOT NULL default '0',
user_xup text NOT NULL, user_xup text,
PRIMARY KEY (user_id), PRIMARY KEY (user_id),
UNIQUE KEY user_name (user_name), UNIQUE KEY user_name (user_name),
UNIQUE KEY user_loginname (user_loginname), UNIQUE KEY user_loginname (user_loginname),

View File

@@ -5176,6 +5176,12 @@ class e_admin_ui extends e_admin_controller_ui
$this->dataFields = array(); $this->dataFields = array();
foreach ($this->fields as $key => $att) foreach ($this->fields as $key => $att)
{ {
if($key == $this->pid && empty($att['data'])) // Set integer as default for primary ID when not specified. MySQL Strict Fix.
{
$this->dataFields[$key] = 'int';
continue;
}
if($att['type'] == 'comma' && (!vartrue($att['data']) || !vartrue($att['rule']))) if($att['type'] == 'comma' && (!vartrue($att['data']) || !vartrue($att['rule'])))
{ {
$att['data'] = 'set'; $att['data'] = 'set';

View File

@@ -2552,17 +2552,17 @@ class e_front_model extends e_model
$id = $this->getId(); $id = $this->getId();
$qry['data'][$this->getFieldIdName()] = $id; $qry['data'][$this->getFieldIdName()] = $id;
//XXX This check is done in _setModel() of admin-ui. NULL below will break MySQL strict.
// Allow admin config to specify the best data type.
/*
if($action == 'create' && !$id) $qry['_FIELD_TYPES'][$this->getFieldIdName()] = 'NULL'; if($action == 'create' && !$id) $qry['_FIELD_TYPES'][$this->getFieldIdName()] = 'NULL';
elseif(is_numeric($id)) $qry['_FIELD_TYPES'][$this->getFieldIdName()] = 'integer'; elseif(is_numeric($id)) $qry['_FIELD_TYPES'][$this->getFieldIdName()] = 'integer';
else $qry['_FIELD_TYPES'][$this->getFieldIdName()] = 'string'; else $qry['_FIELD_TYPES'][$this->getFieldIdName()] = 'string';
*/
foreach ($this->_data_fields as $key => $type) foreach ($this->_data_fields as $key => $type)
{ {
if($key == $this->getFieldIdName())
{
continue;
}
if(!isset($qry['_FIELD_TYPES'][$key])) if(!isset($qry['_FIELD_TYPES'][$key]))
{ {
$qry['_FIELD_TYPES'][$key] = $type; //_FIELD_TYPES much more optional now... $qry['_FIELD_TYPES'][$key] = $type; //_FIELD_TYPES much more optional now...

View File

@@ -182,7 +182,7 @@ class faq_main_ui extends e_admin_ui
//TODO - finish 'user' type, set 'data' to all editable fields, set 'noedit' for all non-editable fields //TODO - finish 'user' type, set 'data' to all editable fields, set 'noedit' for all non-editable fields
protected $fields = array( protected $fields = array(
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'), 'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
'faq_id' => array('title'=> LAN_ID, 'tab' => 0, 'type' => 'int', 'width' =>'5%', 'forced'=> TRUE), 'faq_id' => array('title'=> LAN_ID, 'tab' => 0, 'type' => null, 'width' =>'5%', 'forced'=> TRUE),
'faq_question' => array('title'=> LANA_FAQ_QUESTION, 'tab' => 0, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left first', 'required'=>TRUE, 'readParms'=>'editable=1', 'writeParms'=>'size=block-level'), 'faq_question' => array('title'=> LANA_FAQ_QUESTION, 'tab' => 0, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left first', 'required'=>TRUE, 'readParms'=>'editable=1', 'writeParms'=>'size=block-level'),
'faq_answer' => array('title'=> LANA_FAQ_ANSWER, 'tab' => 0, 'type' => 'bbarea', 'width' => '30%', 'readParms' => 'expand=1&truncate=50&bb=1'), 'faq_answer' => array('title'=> LANA_FAQ_ANSWER, 'tab' => 0, 'type' => 'bbarea', 'width' => '30%', 'readParms' => 'expand=1&truncate=50&bb=1'),
'faq_parent' => array('title'=> LAN_CATEGORY, 'tab' => 0, 'type' => 'dropdown', 'data'=> 'int', 'inline'=>true,'width' => '10%', 'filter'=>TRUE, 'batch'=>TRUE), 'faq_parent' => array('title'=> LAN_CATEGORY, 'tab' => 0, 'type' => 'dropdown', 'data'=> 'int', 'inline'=>true,'width' => '10%', 'filter'=>TRUE, 'batch'=>TRUE),