mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 06:38:00 +02:00
Issue #1788 - Correct MYSQL return results with PDO on CREATE TABLE commands etc. Fixes forum installation issues on PHP7.
This commit is contained in:
@@ -951,9 +951,9 @@ function update_706_to_800($type='')
|
||||
}
|
||||
|
||||
// Check need for user timezone before we delete the field
|
||||
if (vartrue($pref['signup_option_timezone']))
|
||||
// if (vartrue($pref['signup_option_timezone']))
|
||||
{
|
||||
if ($sql->db_Field('user', 'user_timezone', '', TRUE) && !$sql->db_Field('user_extended','user_timezone','',TRUE))
|
||||
if ($sql->field('user', 'user_timezone')===true && $sql->field('user_extended','user_timezone')===false)
|
||||
{
|
||||
if ($just_check) return update_needed('Move user timezone info');
|
||||
if (!copy_user_timezone())
|
||||
@@ -1797,15 +1797,25 @@ function copy_user_timezone()
|
||||
$sql2 = e107::getDb('sql2');
|
||||
$tp = e107::getParser();
|
||||
|
||||
require_once(e_HANDLER.'user_extended_class.php');
|
||||
$ue = new e107_user_extended;
|
||||
// require_once(e_HANDLER.'user_extended_class.php');
|
||||
$ue = e107::getUserExt();
|
||||
$tmp = $ue->parse_extended_xml('getfile');
|
||||
|
||||
$tmp['timezone']['parms'] = $tp->toDB($tmp['timezone']['parms']);
|
||||
|
||||
if(!$ue->user_extended_add($tmp['timezone']))
|
||||
{
|
||||
return FALSE;
|
||||
e107::getMessage()->addError("Unable to add user_timezone field to user_extended table.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if($sql->field('user_extended', 'user_timezone')===false)
|
||||
{
|
||||
e107::getMessage()->addError("user_timezone field missing from user_extended table.");
|
||||
return false;
|
||||
}
|
||||
|
||||
e107::getMessage()->addDebug("Line:".__LINE__);
|
||||
// Created the field - now copy existing data
|
||||
if ($sql->db_Select('user','user_id, user_timezone'))
|
||||
{
|
||||
@@ -1814,7 +1824,7 @@ function copy_user_timezone()
|
||||
$sql2->update('user_extended',"`user_timezone`='{$row['user_timezone']}' WHERE `user_extended_id`={$row['user_id']}");
|
||||
}
|
||||
}
|
||||
return TRUE; // All done!
|
||||
return true; // All done!
|
||||
}
|
||||
|
||||
|
||||
|
@@ -490,9 +490,21 @@ class e_db_mysql
|
||||
{
|
||||
try
|
||||
{
|
||||
// var_dump($rli);
|
||||
// var_dump($this->mySQLaccess);
|
||||
|
||||
if(preg_match('#^(CREATE TABLE|DROP TABLE|ALTER TABLE|RENAME TABLE|CREATE DATABASE|CREATE INDEX)#',$query, $matches))
|
||||
{
|
||||
$sQryRes = is_null($rli) ? $this->mySQLaccess->exec($query) : $rli->exec($query);
|
||||
|
||||
if($sQryRes !==false)
|
||||
{
|
||||
$sQryRes = true; // match with non-PDO results.
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$sQryRes = is_null($rli) ? $this->mySQLaccess->query($query) : $rli->query($query);
|
||||
}
|
||||
|
||||
}
|
||||
catch(PDOException $ex)
|
||||
@@ -1741,7 +1753,6 @@ class e_db_mysql
|
||||
|
||||
//$query = str_replace("#",$this->mySQLPrefix,$query); //FIXME - quick fix for those that slip-thru - but destroys
|
||||
// the point of requiring backticks round table names - wrecks ', for example
|
||||
|
||||
if (($this->mySQLresult = $this->db_Query($query, NULL, 'db_Select_gen', $debug, $log_type, $log_remark)) === FALSE)
|
||||
{ // Failed query
|
||||
$this->dbError('db_Select_gen('.$query.')');
|
||||
@@ -2133,7 +2144,7 @@ class e_db_mysql
|
||||
* @param string $table - table name (no prefix)
|
||||
* @param string $fieldid - Numeric offset or field/key name
|
||||
* @param string $key - PRIMARY|INDEX|UNIQUE - type of key when searching for key name
|
||||
* @param boolean $retinfo = FALSE - just returns array of field names. TRUE - returns all field info
|
||||
* @param boolean $retinfo = FALSE - just returns true|false. TRUE - returns all field info
|
||||
* @return array|boolean - FALSE on error, field information on success
|
||||
*/
|
||||
function field($table,$fieldid="",$key="", $retinfo = FALSE)
|
||||
@@ -2171,7 +2182,7 @@ class e_db_mysql
|
||||
if(($fieldid == $row['Field']) && (($key == "OFF") || ($key == $row['Key'])))
|
||||
{
|
||||
if ($retinfo) return $row;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
$c++;
|
||||
|
@@ -552,7 +552,7 @@ class e107_user_extended
|
||||
return $this->user_extended_add($name, '_system_', $type, $source, '', $default, 0, 255, 255, 255, 0, 0);
|
||||
}
|
||||
|
||||
function user_extended_add($name, $text, $type, $parms, $values, $default, $required, $read, $write, $applicable, $order='', $parent)
|
||||
function user_extended_add($name, $text='', $type='', $parms='', $values='', $default='', $required='', $read='', $write='', $applicable='', $order='', $parent='')
|
||||
{
|
||||
|
||||
$sql = e107::getDb('ue');
|
||||
@@ -570,13 +570,16 @@ class e107_user_extended
|
||||
$type = $this->typeArray[$type];
|
||||
}
|
||||
|
||||
if($this->user_extended_field_exist($name))
|
||||
if($this->user_extended_field_exist($name) && $sql->field('user_extended', 'user_'.$name)!==false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!$this->user_extended_reserved($name))
|
||||
if ($this->user_extended_reserved($name))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$field_info = $this->user_extended_type_text($type, $default);
|
||||
|
||||
// wrong type
|
||||
@@ -619,21 +622,20 @@ class e107_user_extended
|
||||
'user_extended_struct_applicable' => '',
|
||||
'user_extended_struct_order' => '',
|
||||
'user_extended_struct_parent' => ''
|
||||
|
||||
);
|
||||
|
||||
*/
|
||||
|
||||
$rest = $sql->insert('user_extended_struct',"null,'".$tp -> toDB($name, true)."','".$tp -> toDB($text, true)."','".intval($type)."','".$tp -> toDB($parms, true)."','".$tp -> toDB($values, true)."', '".$tp -> toDB($default, true)."', '".intval($read)."', '".intval($write)."', '".intval($required)."', '0', '".intval($applicable)."', '".intval($order)."', '".intval($parent)."'");
|
||||
|
||||
if(!$this->user_extended_field_exist($name))
|
||||
{
|
||||
$sql->insert('user_extended_struct',"null,'".$tp -> toDB($name, true)."','".$tp -> toDB($text, true)."','".intval($type)."','".$tp -> toDB($parms, true)."','".$tp -> toDB($values, true)."', '".$tp -> toDB($default, true)."', '".intval($read)."', '".intval($write)."', '".intval($required)."', '0', '".intval($applicable)."', '".intval($order)."', '".intval($parent)."'");
|
||||
}
|
||||
|
||||
if($this->user_extended_field_exist($name))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -397,7 +397,7 @@ function step4()
|
||||
|
||||
if ($viewed != '')
|
||||
{
|
||||
$ue -> user_extended_setvalue($userId, 'plugin_forum_viewed', mysql_real_escape_string($viewed));
|
||||
$ue->user_extended_setvalue($userId, 'plugin_forum_viewed', ($viewed));
|
||||
$result['viewcount']++;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user