Skip to content
Merged

Sigh #183

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion includes/class_31_styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private function qi_install_style($style)

private function qi_set_default($id)
{
set_config('default_style', $id);
qi_set_config('default_style', $id);

// Set it for guests and the admin too.
$sql = 'UPDATE ' . USERS_TABLE . '
Expand Down
6 changes: 3 additions & 3 deletions includes/db/31/mssql.php → includes/db/30x/mssql.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
* MSSQL dbal extension
* @package dbal
*/
class dbal_mssql_qi extends \phpbb\db\driver\mssql
class dbal_mssql_qi extends dbal_mssql
{
/**
* Connect to server
*/
public function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{
$this->persistency = $persistency;
$this->user = $sqluser;
Expand All @@ -45,7 +45,7 @@ public function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port
*
* @param string $dbname
*/
public function sql_select_db($dbname)
function sql_select_db($dbname)
{
return @mssql_select_db($dbname, $this->db_connect_id);
}
Expand Down
11 changes: 5 additions & 6 deletions includes/db/31/mysql.php → includes/db/30x/mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,28 @@
* MySQL dbal extension
* @package dbal
*/
class dbal_mysql_qi extends \phpbb\db\driver\mysql
class dbal_mysql_qi extends dbal_mysql
{
public $mysql_version;

/**
* Connect to server
*/
public function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{
$this->persistency = $persistency;
$this->user = $sqluser;
$this->server = $sqlserver . (($port) ? ':' . $port : '');
$this->dbname = $database;

$this->sql_layer = 'mysql4';
$this->sql_layer = 'mysql_40';

$this->db_connect_id = ($this->persistency) ? @mysql_pconnect($this->server, $this->user, $sqlpassword, $new_link) : @mysql_connect($this->server, $this->user, $sqlpassword, $new_link);

if ($this->db_connect_id)
{
// Determine what version we are using and if it natively supports UNICODE
$this->mysql_version = $this->sql_server_info(true);
$this->mysql_version = mysql_get_server_info($this->db_connect_id);

if (version_compare($this->mysql_version, '4.1.3', '>='))
{
Expand All @@ -61,9 +61,8 @@ public function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port
* Select a database
*
* @param string $dbname
* @return bool
*/
public function sql_select_db($dbname)
function sql_select_db($dbname)
{
return @mysql_select_db($dbname, $this->db_connect_id);
}
Expand Down
9 changes: 4 additions & 5 deletions includes/db/31/mysqli.php → includes/db/30x/mysqli.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@
* MySQLi dbal extension
* @package dbal
*/
class dbal_mysqli_qi extends \phpbb\db\driver\mysqli
class dbal_mysqli_qi extends dbal_mysqli
{
/**
* Connect to server
*/
public function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false , $new_link = false)
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false , $new_link = false)
{
$this->persistency = $persistency;
$this->user = $sqluser;
$this->server = $sqlserver;
$this->dbname = $database;
$port = (!$port) ? null : $port;
$port = (!$port) ? NULL : $port;

$this->sql_layer = 'mysql_41';

Expand All @@ -50,9 +50,8 @@ public function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port
* Select a database
*
* @param string $dbname
* @return bool
*/
public function sql_select_db($dbname)
function sql_select_db($dbname)
{
return @mysqli_select_db($this->db_connect_id, $dbname);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* Postgres dbal extension
* @package dbal
*/
class dbal_postgres_qi extends \phpbb\db\driver\postgres
class dbal_postgres_qi extends dbal_postgres
{
public function sql_connect($dbhost, $dbuser, $dbpass, $dbname, $dbport = false, $persistency = false, $new_link= false)
{
Expand Down
2 changes: 1 addition & 1 deletion includes/db/31/sqlite.php → includes/db/30x/sqlite.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* SQLite dbal extension
* @package dbal
*/
class dbal_sqlite_qi extends \phpbb\db\driver\sqlite
class dbal_sqlite_qi extends dbal_sqlite
{
/**
* Connection error
Expand Down
6 changes: 3 additions & 3 deletions includes/db/mssql.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
* MSSQL dbal extension
* @package dbal
*/
class dbal_mssql_qi extends dbal_mssql
class dbal_mssql_qi extends \phpbb\db\driver\mssql
{
/**
* Connect to server
*/
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
public function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{
$this->persistency = $persistency;
$this->user = $sqluser;
Expand All @@ -45,7 +45,7 @@ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = fals
*
* @param string $dbname
*/
function sql_select_db($dbname)
public function sql_select_db($dbname)
{
return @mssql_select_db($dbname, $this->db_connect_id);
}
Expand Down
11 changes: 6 additions & 5 deletions includes/db/mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,28 @@
* MySQL dbal extension
* @package dbal
*/
class dbal_mysql_qi extends dbal_mysql
class dbal_mysql_qi extends \phpbb\db\driver\mysql
{
public $mysql_version;

/**
* Connect to server
*/
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
public function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{
$this->persistency = $persistency;
$this->user = $sqluser;
$this->server = $sqlserver . (($port) ? ':' . $port : '');
$this->dbname = $database;

$this->sql_layer = 'mysql_40';
$this->sql_layer = 'mysql4';

$this->db_connect_id = ($this->persistency) ? @mysql_pconnect($this->server, $this->user, $sqlpassword, $new_link) : @mysql_connect($this->server, $this->user, $sqlpassword, $new_link);

if ($this->db_connect_id)
{
// Determine what version we are using and if it natively supports UNICODE
$this->mysql_version = mysql_get_server_info($this->db_connect_id);
$this->mysql_version = $this->sql_server_info(true);

if (version_compare($this->mysql_version, '4.1.3', '>='))
{
Expand All @@ -61,8 +61,9 @@ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = fals
* Select a database
*
* @param string $dbname
* @return bool
*/
function sql_select_db($dbname)
public function sql_select_db($dbname)
{
return @mysql_select_db($dbname, $this->db_connect_id);
}
Expand Down
9 changes: 5 additions & 4 deletions includes/db/mysqli.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@
* MySQLi dbal extension
* @package dbal
*/
class dbal_mysqli_qi extends dbal_mysqli
class dbal_mysqli_qi extends \phpbb\db\driver\mysqli
{
/**
* Connect to server
*/
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false , $new_link = false)
public function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false , $new_link = false)
{
$this->persistency = $persistency;
$this->user = $sqluser;
$this->server = $sqlserver;
$this->dbname = $database;
$port = (!$port) ? NULL : $port;
$port = (!$port) ? null : $port;

$this->sql_layer = 'mysql_41';

Expand All @@ -50,8 +50,9 @@ function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = fals
* Select a database
*
* @param string $dbname
* @return bool
*/
function sql_select_db($dbname)
public function sql_select_db($dbname)
{
return @mysqli_select_db($this->db_connect_id, $dbname);
}
Expand Down
2 changes: 1 addition & 1 deletion includes/db/postgres.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* Postgres dbal extension
* @package dbal
*/
class dbal_postgres_qi extends dbal_postgres
class dbal_postgres_qi extends \phpbb\db\driver\postgres
{
public function sql_connect($dbhost, $dbuser, $dbpass, $dbname, $dbport = false, $persistency = false, $new_link= false)
{
Expand Down
2 changes: 1 addition & 1 deletion includes/db/sqlite.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* SQLite dbal extension
* @package dbal
*/
class dbal_sqlite_qi extends dbal_sqlite
class dbal_sqlite_qi extends \phpbb\db\driver\sqlite
{
/**
* Connection error
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions includes/qi.php
Original file line number Diff line number Diff line change
Expand Up @@ -848,12 +848,12 @@ public static function get_backtrace()
*
* See http://www.php.net/manual/en/function.version-compare.php
*
* @param string $version1 First version number
* @param string $version2 Second version number
* @param string $operator Comparison operator (optional)
* @param string $version1 First version number
* @param string $version2 Second version number
* @param string $operator Comparison operator (optional)
*
* @return mixed Boolean (true, false) if comparison operator is specified.
* Integer (-1, 0, 1) otherwise.
* @return bool|int Boolean (true, false) if comparison operator is specified.
* Integer (-1, 0, 1) otherwise.
*/
public static function phpbb_version_compare($version1, $version2, $operator = null)
{
Expand Down
94 changes: 86 additions & 8 deletions includes/qi_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -490,25 +490,23 @@ function db_connect($db_data = '')
if (!class_exists('dbal_' . $dbal . '_qi'))
{
// now the quickinstall dbal extension
include($quickinstall_path . 'includes/db/31/' . $dbal . '.' . $phpEx);
include($quickinstall_path . 'includes/db/' . $dbal . '.' . $phpEx);
}

$sql_db = 'dbal_' . $dbal . '_qi';
}
else
{
$dbal = $available_dbms[$dbms]['DRIVER'];
// Load the appropriate database class if not already loaded.
if (!class_exists('dbal_' . $available_dbms[$dbms]['DRIVER'] . '_qi'))
if (!class_exists('dbal_' . $dbal . '_qi'))
{
// phpBB dbal class.
include($phpbb_root_path . 'includes/db/' . $available_dbms[$dbms]['DRIVER'] . '.' . $phpEx);
include($phpbb_root_path . 'includes/db/' . $dbal . '.' . $phpEx);

// now the quickinstall dbal extension
include($quickinstall_path . 'includes/db/' . $available_dbms[$dbms]['DRIVER'] . '.' . $phpEx);
include($quickinstall_path . 'includes/db/30x/' . $dbal . '.' . $phpEx);
}
$sql_db = 'dbal_' . $available_dbms[$dbms]['DRIVER'] . '_qi';
}

$sql_db = 'dbal_' . $dbal . '_qi';
$db = new $sql_db();

if (defined('PHPBB_31'))
Expand Down Expand Up @@ -575,3 +573,83 @@ function qi_get_phpbb_version()

return '3.0';
}

/**
* Sets a configuration option's value.
*
* QI uses this for legacy reasons. In 3.0.x set_config() is used to set config
* object values. In 3.1.x, 3.2.x and 3.3.x it is deprecated. This function
* emulates the deprecated function in case it is ever removed from 4.x.x.
*
* Please note that this function does not update the is_dynamic value for
* an already existing config option.
*
* @param string $config_name The configuration option's name
* @param string $config_value New configuration value
* @param bool $is_dynamic Whether this variable should be cached (false) or
* if it changes too frequently (true) to be
* efficiently cached.
* @param null $set_config The config object
* @return void
*/
function qi_set_config($config_name, $config_value, $is_dynamic = false, $set_config = null)
{
if (function_exists('set_config'))
{
set_config($config_name, $config_value, $is_dynamic, $set_config);
return;
}

static $config = null;

if ($set_config !== null)
{
$config = $set_config;

if (empty($config_name))
{
return;
}
}

$config->set($config_name, $config_value, !$is_dynamic);
}

/**
* Increments an integer config value directly in the database.
*
* QI uses this for legacy reasons. In 3.0.x set_config_count() is used to
* increment config values. In 3.1.x, 3.2.x and 3.3.x it is deprecated. This
* function emulates the deprecated function in case it is ever removed from 4.x.x.
*
* @param string $config_name The configuration option's name
* @param int $increment Amount to increment by
* @param bool $is_dynamic Whether this variable should be cached (false) or
* if it changes too frequently (true) to be
* efficiently cached.
* @param null $set_config The config object
*
* @return void
*/
function qi_set_config_count($config_name, $increment, $is_dynamic = false, $set_config = null)
{
if (function_exists('set_config_count'))
{
set_config_count($config_name, $increment, $is_dynamic, $set_config);
return;
}

static $config = null;

if ($set_config !== null)
{
$config = $set_config;

if (empty($config_name))
{
return;
}
}

$config->increment($config_name, $increment, !$is_dynamic);
}
Loading