mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
Adjust some files to support new methods...
git-svn-id: file:///svn/phpbb/trunk@9279 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -43,9 +43,7 @@ if (!defined('IN_PHPBB'))
|
||||
*/
|
||||
function gen_sort_selects(&$limit_days, &$sort_by_text, &$sort_days, &$sort_key, &$sort_dir, &$s_limit_days, &$s_sort_key, &$s_sort_dir, &$u_sort_param, $def_st = false, $def_sk = false, $def_sd = false)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']);
|
||||
$sort_dir_text = array('a' => phpbb::$user->lang['ASCENDING'], 'd' => phpbb::$user->lang['DESCENDING']);
|
||||
|
||||
$sorts = array(
|
||||
'st' => array(
|
||||
@@ -110,8 +108,6 @@ function gen_sort_selects(&$limit_days, &$sort_by_text, &$sort_days, &$sort_key,
|
||||
*/
|
||||
function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list = false, $force_display = false)
|
||||
{
|
||||
global $auth, $template, $user, $db;
|
||||
|
||||
// We only return if the jumpbox is not forced to be displayed (in case it is needed for functionality)
|
||||
if (!phpbb::$config['load_jumpbox'] && $force_display === false)
|
||||
{
|
||||
@@ -121,7 +117,7 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list
|
||||
$sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id
|
||||
FROM ' . FORUMS_TABLE . '
|
||||
ORDER BY left_id ASC';
|
||||
$result = $db->sql_query($sql, 600);
|
||||
$result = phpbb::$db->sql_query($sql, 600);
|
||||
|
||||
$right = $padding = 0;
|
||||
$padding_store = array('0' => 0);
|
||||
@@ -132,7 +128,7 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list
|
||||
// This is the result of forums not displayed at index, having list permissions and a parent of a forum with no permissions.
|
||||
// If this happens, the padding could be "broken"
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
if ($row['left_id'] < $right)
|
||||
{
|
||||
@@ -154,22 +150,22 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$auth->acl_get('f_list', $row['forum_id']))
|
||||
if (!phpbb::$acl->acl_get('f_list', $row['forum_id']))
|
||||
{
|
||||
// if the user does not have permissions to list this forum skip
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id']))
|
||||
if ($acl_list && !phpbb::$acl->acl_gets($acl_list, $row['forum_id']))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$display_jumpbox)
|
||||
{
|
||||
$template->assign_block_vars('jumpbox_forums', array(
|
||||
phpbb::$template->assign_block_vars('jumpbox_forums', array(
|
||||
'FORUM_ID' => ($select_all) ? 0 : -1,
|
||||
'FORUM_NAME' => ($select_all) ? $user->lang['ALL_FORUMS'] : $user->lang['SELECT_FORUM'],
|
||||
'FORUM_NAME' => ($select_all) ? phpbb::$user->lang['ALL_FORUMS'] : phpbb::$user->lang['SELECT_FORUM'],
|
||||
'S_FORUM_COUNT' => $iteration)
|
||||
);
|
||||
|
||||
@@ -177,7 +173,7 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list
|
||||
$display_jumpbox = true;
|
||||
}
|
||||
|
||||
$template->assign_block_vars('jumpbox_forums', array(
|
||||
phpbb::$template->assign_block_vars('jumpbox_forums', array(
|
||||
'FORUM_ID' => $row['forum_id'],
|
||||
'FORUM_NAME' => $row['forum_name'],
|
||||
'SELECTED' => ($row['forum_id'] == $forum_id) ? ' selected="selected"' : '',
|
||||
@@ -189,17 +185,17 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list
|
||||
|
||||
for ($i = 0; $i < $padding; $i++)
|
||||
{
|
||||
$template->assign_block_vars('jumpbox_forums.level', array());
|
||||
phpbb::$template->assign_block_vars('jumpbox_forums.level', array());
|
||||
}
|
||||
$iteration++;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
unset($padding_store);
|
||||
|
||||
$template->assign_vars(array(
|
||||
phpbb::$template->assign_vars(array(
|
||||
'S_DISPLAY_JUMPBOX' => $display_jumpbox,
|
||||
'S_JUMPBOX_ACTION' => $action)
|
||||
);
|
||||
'S_JUMPBOX_ACTION' => phpbb::$url->append_sid($action),
|
||||
));
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -209,10 +205,8 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list
|
||||
*/
|
||||
function bump_topic_allowed($forum_id, $topic_bumped, $last_post_time, $topic_poster, $last_topic_poster)
|
||||
{
|
||||
global $auth, $user;
|
||||
|
||||
// Check permission and make sure the last post was not already bumped
|
||||
if (!$auth->acl_get('f_bump', $forum_id) || $topic_bumped)
|
||||
if (!phpbb::$acl->acl_get('f_bump', $forum_id) || $topic_bumped)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -227,7 +221,7 @@ function bump_topic_allowed($forum_id, $topic_bumped, $last_post_time, $topic_po
|
||||
}
|
||||
|
||||
// Check bumper, only topic poster and last poster are allowed to bump
|
||||
if ($topic_poster != $user->data['user_id'] && $last_topic_poster != $user->data['user_id'])
|
||||
if ($topic_poster != phpbb::$user->data['user_id'] && $last_topic_poster != phpbb::$user->data['user_id'])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -732,16 +726,15 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
|
||||
return;
|
||||
}
|
||||
|
||||
global $template, $user;
|
||||
global $extensions;
|
||||
|
||||
//
|
||||
$compiled_attachments = array();
|
||||
|
||||
// @todo: do we really need this check?
|
||||
if (!isset($template->filename['attachment_tpl']))
|
||||
if (!isset(phpbb::$template->filename['attachment_tpl']))
|
||||
{
|
||||
$template->set_filenames(array(
|
||||
phpbb::$template->set_filenames(array(
|
||||
'attachment_tpl' => 'attachment.html')
|
||||
);
|
||||
}
|
||||
@@ -765,16 +758,14 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
|
||||
// Grab attachments (security precaution)
|
||||
if (sizeof($attach_ids))
|
||||
{
|
||||
global $db;
|
||||
|
||||
$new_attachment_data = array();
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . ATTACHMENTS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('attach_id', array_keys($attach_ids));
|
||||
$result = $db->sql_query($sql);
|
||||
WHERE ' . phpbb::$db->sql_in_set('attach_id', array_keys($attach_ids));
|
||||
$result = phpbb::$db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||
{
|
||||
if (!isset($attach_ids[$row['attach_id']]))
|
||||
{
|
||||
@@ -789,7 +780,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
|
||||
|
||||
$new_attachment_data[$attach_ids[$row['attach_id']]] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
phpbb::$db->sql_freeresult($result);
|
||||
|
||||
$attachments = $new_attachment_data;
|
||||
unset($new_attachment_data);
|
||||
@@ -815,7 +806,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
|
||||
}
|
||||
|
||||
// We need to reset/empty the _file block var, because this function might be called more than once
|
||||
$template->destroy_block_vars('_file');
|
||||
phpbb::$template->destroy_block_vars('_file');
|
||||
|
||||
$block_array = array();
|
||||
|
||||
@@ -828,9 +819,9 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
|
||||
|
||||
if (isset($extensions[$attachment['extension']]))
|
||||
{
|
||||
if ($user->img('icon_topic_attach', '') && !$extensions[$attachment['extension']]['upload_icon'])
|
||||
if (phpbb::$user->img('icon_topic_attach', '') && !$extensions[$attachment['extension']]['upload_icon'])
|
||||
{
|
||||
$upload_icon = $user->img('icon_topic_attach', '');
|
||||
$upload_icon = phpbb::$user->img('icon_topic_attach', '');
|
||||
}
|
||||
else if ($extensions[$attachment['extension']]['upload_icon'])
|
||||
{
|
||||
@@ -839,7 +830,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
|
||||
}
|
||||
|
||||
$filesize = $attachment['filesize'];
|
||||
$size_lang = ($filesize >= 1048576) ? $user->lang['MIB'] : (($filesize >= 1024) ? $user->lang['KIB'] : $user->lang['BYTES']);
|
||||
$size_lang = ($filesize >= 1048576) ? phpbb::$user->lang['MIB'] : (($filesize >= 1024) ? phpbb::$user->lang['KIB'] : phpbb::$user->lang['BYTES']);
|
||||
$filesize = get_formatted_filesize($filesize, false);
|
||||
|
||||
$comment = bbcode_nl2br(censor_text($attachment['attach_comment']));
|
||||
@@ -860,7 +851,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
|
||||
|
||||
$block_array += array(
|
||||
'S_DENIED' => true,
|
||||
'DENIED_MESSAGE' => sprintf($user->lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension'])
|
||||
'DENIED_MESSAGE' => phpbb::$user->lang('EXTENSION_DISABLED_AFTER_POSTING', $attachment['extension']),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -902,12 +893,12 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
|
||||
}
|
||||
|
||||
// Make some descisions based on user options being set.
|
||||
if (($display_cat == ATTACHMENT_CATEGORY_IMAGE || $display_cat == ATTACHMENT_CATEGORY_THUMB) && !$user->optionget('viewimg'))
|
||||
if (($display_cat == ATTACHMENT_CATEGORY_IMAGE || $display_cat == ATTACHMENT_CATEGORY_THUMB) && !phpbb::$user->optionget('viewimg'))
|
||||
{
|
||||
$display_cat = ATTACHMENT_CATEGORY_NONE;
|
||||
}
|
||||
|
||||
if ($display_cat == ATTACHMENT_CATEGORY_FLASH && !$user->optionget('viewflash'))
|
||||
if ($display_cat == ATTACHMENT_CATEGORY_FLASH && !phpbb::$user->optionget('viewflash'))
|
||||
{
|
||||
$display_cat = ATTACHMENT_CATEGORY_NONE;
|
||||
}
|
||||
@@ -1001,17 +992,15 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
|
||||
break;
|
||||
}
|
||||
|
||||
$l_download_count = (!isset($attachment['download_count']) || $attachment['download_count'] == 0) ? $user->lang[$l_downloaded_viewed . '_NONE'] : (($attachment['download_count'] == 1) ? sprintf($user->lang[$l_downloaded_viewed], $attachment['download_count']) : sprintf($user->lang[$l_downloaded_viewed . 'S'], $attachment['download_count']));
|
||||
|
||||
$block_array += array(
|
||||
'U_DOWNLOAD_LINK' => $download_link,
|
||||
'L_DOWNLOAD_COUNT' => $l_download_count
|
||||
'L_DOWNLOAD_COUNT' => phpbb::$user->lang($l_downloaded_viewed, $attachment['download_count']),
|
||||
);
|
||||
}
|
||||
|
||||
$template->assign_block_vars('_file', $block_array);
|
||||
phpbb::$template->assign_block_vars('_file', $block_array);
|
||||
|
||||
$compiled_attachments[] = $template->assign_display('attachment_tpl');
|
||||
$compiled_attachments[] = phpbb::$template->assign_display('attachment_tpl');
|
||||
}
|
||||
|
||||
$attachments = $compiled_attachments;
|
||||
@@ -1030,7 +1019,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
|
||||
$index = (phpbb::$config['display_order']) ? ($tpl_size-($matches[1][$num] + 1)) : $matches[1][$num];
|
||||
|
||||
$replace['from'][] = $matches[0][$num];
|
||||
$replace['to'][] = (isset($attachments[$index])) ? $attachments[$index] : sprintf($user->lang['MISSING_INLINE_ATTACHMENT'], $matches[2][array_search($index, $matches[1])]);
|
||||
$replace['to'][] = (isset($attachments[$index])) ? $attachments[$index] : sprintf(phpbb::$user->lang['MISSING_INLINE_ATTACHMENT'], $matches[2][array_search($index, $matches[1])]);
|
||||
|
||||
$unset_tpl[] = $index;
|
||||
}
|
||||
@@ -1159,8 +1148,6 @@ function get_username_string($mode, $user_id, $username, $username_colour = '',
|
||||
$_profile_cache['tpl_profile_colour'] = '<a href="{PROFILE_URL}" style="color: {USERNAME_COLOUR};" class="username-coloured">{USERNAME}</a>';
|
||||
}
|
||||
|
||||
global $user, $auth;
|
||||
|
||||
// This switch makes sure we only run code required for the mode
|
||||
switch ($mode)
|
||||
{
|
||||
|
@@ -37,6 +37,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_30
|
||||
'firebird' => array(
|
||||
'LABEL' => 'FireBird',
|
||||
'MODULE' => 'interbase',
|
||||
'DRIVER' => 'firebird',
|
||||
'AVAILABLE' => true,
|
||||
'3.0.x' => true,
|
||||
),
|
||||
@@ -50,48 +51,56 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_30
|
||||
'mysql' => array(
|
||||
'LABEL' => 'MySQL',
|
||||
'MODULE' => 'mysql',
|
||||
'DRIVER' => 'mysql',
|
||||
'AVAILABLE' => true,
|
||||
'3.0.x' => true,
|
||||
),
|
||||
'mssql' => array(
|
||||
'LABEL' => 'MS SQL Server 2000+',
|
||||
'MODULE' => 'mssql',
|
||||
'DRIVER' => 'mssql',
|
||||
'AVAILABLE' => true,
|
||||
'3.0.x' => true,
|
||||
),
|
||||
'mssql_odbc'=> array(
|
||||
'LABEL' => 'MS SQL Server [ ODBC ]',
|
||||
'MODULE' => 'odbc',
|
||||
'DRIVER' => 'mssql_odbc',
|
||||
'AVAILABLE' => true,
|
||||
'3.0.x' => true,
|
||||
),
|
||||
'mssql_2005'=> array(
|
||||
'LABEL' => 'MS SQL Server [ 2005 ]',
|
||||
'MODULE' => 'sqlsrv',
|
||||
'DRIVER' => 'mssql_2005',
|
||||
'AVAILABLE' => true,
|
||||
'3.0.x' => true,
|
||||
),
|
||||
'db2' => array(
|
||||
'LABEL' => 'IBM DB2',
|
||||
'MODULE' => 'ibm_db2',
|
||||
'DRIVER' => 'db2',
|
||||
'AVAILABLE' => true,
|
||||
'3.0.x' => false,
|
||||
),
|
||||
'oracle' => array(
|
||||
'LABEL' => 'Oracle',
|
||||
'MODULE' => 'oci8',
|
||||
'DRIVER' => 'oracle',
|
||||
'AVAILABLE' => true,
|
||||
'3.0.x' => true,
|
||||
),
|
||||
'postgres' => array(
|
||||
'LABEL' => 'PostgreSQL 7.x/8.x',
|
||||
'MODULE' => 'pgsql',
|
||||
'DRIVER' => 'postgres',
|
||||
'AVAILABLE' => true,
|
||||
'3.0.x' => true,
|
||||
),
|
||||
'sqlite' => array(
|
||||
'LABEL' => 'SQLite',
|
||||
'MODULE' => 'sqlite',
|
||||
'DRIVER' => 'sqlite',
|
||||
'AVAILABLE' => true,
|
||||
'3.0.x' => true,
|
||||
),
|
||||
@@ -222,12 +231,10 @@ function get_tables($db)
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$tables = array();
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$tables[] = current($row);
|
||||
}
|
||||
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
return $tables;
|
||||
@@ -239,7 +246,7 @@ function get_tables($db)
|
||||
* @param array $dbms should be of the format of an element of the array returned by {@link get_available_dbms get_available_dbms()}
|
||||
* necessary extensions should be loaded already
|
||||
*/
|
||||
function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport, $prefix_may_exist = false, $unicode_check = true)
|
||||
function connect_check_db($dbms_details, $table_prefix, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport, &$error, $prefix_may_exist = false)
|
||||
{
|
||||
$dbms = $dbms_details['DRIVER'];
|
||||
|
||||
@@ -310,179 +317,179 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
|
||||
{
|
||||
$db_error = $db->sql_error();
|
||||
$error[] = phpbb::$user->lang['INST_ERR_DB_CONNECT'] . '<br />' . (($db_error['message']) ? $db_error['message'] : phpbb::$user->lang['INST_ERR_DB_NO_ERROR']);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
// Likely matches for an existing phpBB installation
|
||||
if (!$prefix_may_exist)
|
||||
{
|
||||
// Likely matches for an existing phpBB installation
|
||||
if (!$prefix_may_exist)
|
||||
$temp_prefix = strtolower($table_prefix);
|
||||
$table_ary = array($temp_prefix . 'attachments', $temp_prefix . 'config', $temp_prefix . 'sessions', $temp_prefix . 'topics', $temp_prefix . 'users');
|
||||
|
||||
$tables = get_tables($db);
|
||||
$tables = array_map('strtolower', $tables);
|
||||
$table_intersect = array_intersect($tables, $table_ary);
|
||||
|
||||
if (sizeof($table_intersect))
|
||||
{
|
||||
$temp_prefix = strtolower($table_prefix);
|
||||
$table_ary = array($temp_prefix . 'attachments', $temp_prefix . 'config', $temp_prefix . 'sessions', $temp_prefix . 'topics', $temp_prefix . 'users');
|
||||
|
||||
$tables = get_tables($db);
|
||||
$tables = array_map('strtolower', $tables);
|
||||
$table_intersect = array_intersect($tables, $table_ary);
|
||||
|
||||
if (sizeof($table_intersect))
|
||||
{
|
||||
$error[] = phpbb::$user->lang['INST_ERR_PREFIX'];
|
||||
}
|
||||
$error[] = phpbb::$user->lang['INST_ERR_PREFIX'];
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure that the user has selected a sensible DBAL for the DBMS actually installed
|
||||
switch ($dbms_details['DRIVER'])
|
||||
{
|
||||
case 'mysql':
|
||||
if (version_compare($db->sql_server_info(true), '4.1.3', '<'))
|
||||
// Make sure that the user has selected a sensible DBAL for the DBMS actually installed
|
||||
switch ($dbms_details['DRIVER'])
|
||||
{
|
||||
case 'mysql':
|
||||
if (version_compare($db->sql_server_info(true), '4.1.3', '<'))
|
||||
{
|
||||
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_MYSQL'];
|
||||
}
|
||||
break;
|
||||
|
||||
case 'mysqli':
|
||||
if (version_compare($db->sql_server_info(true), '4.1.3', '<'))
|
||||
{
|
||||
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_MYSQLI'];
|
||||
}
|
||||
break;
|
||||
|
||||
case 'sqlite':
|
||||
if (version_compare($db->sql_server_info(true), '2.8.2', '<'))
|
||||
{
|
||||
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_SQLITE'];
|
||||
}
|
||||
break;
|
||||
|
||||
case 'firebird':
|
||||
// check the version of FB, use some hackery if we can't get access to the server info
|
||||
if ($db->service_handle !== false && strtolower($dbuser) == 'sysdba')
|
||||
{
|
||||
$val = @ibase_server_info($db->service_handle, IBASE_SVC_SERVER_VERSION);
|
||||
preg_match('#V([\d.]+)#', $val, $match);
|
||||
if ($match[1] < 2)
|
||||
{
|
||||
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_MYSQL'];
|
||||
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD'];
|
||||
}
|
||||
break;
|
||||
$db_info = @ibase_db_info($db->service_handle, $dbname, IBASE_STS_HDR_PAGES);
|
||||
|
||||
case 'mysqli':
|
||||
if (version_compare($db->sql_server_info(true), '4.1.3', '<'))
|
||||
preg_match('/^\\s*Page size\\s*(\\d+)/m', $db_info, $regs);
|
||||
$page_size = intval($regs[1]);
|
||||
if ($page_size < 8192)
|
||||
{
|
||||
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_MYSQLI'];
|
||||
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD_PS'];
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT *
|
||||
FROM RDB$FUNCTIONS
|
||||
WHERE RDB$SYSTEM_FLAG IS NULL
|
||||
AND RDB$FUNCTION_NAME = 'CHAR_LENGTH'";
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
case 'sqlite':
|
||||
if (version_compare($db->sql_server_info(true), '2.8.2', '<'))
|
||||
// if its a UDF, its too old
|
||||
if ($row)
|
||||
{
|
||||
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_SQLITE'];
|
||||
}
|
||||
break;
|
||||
|
||||
case 'firebird':
|
||||
// check the version of FB, use some hackery if we can't get access to the server info
|
||||
if ($db->service_handle !== false && strtolower($dbuser) == 'sysdba')
|
||||
{
|
||||
$val = @ibase_server_info($db->service_handle, IBASE_SVC_SERVER_VERSION);
|
||||
preg_match('#V([\d.]+)#', $val, $match);
|
||||
if ($match[1] < 2)
|
||||
{
|
||||
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD'];
|
||||
}
|
||||
$db_info = @ibase_db_info($db->service_handle, $dbname, IBASE_STS_HDR_PAGES);
|
||||
|
||||
preg_match('/^\\s*Page size\\s*(\\d+)/m', $db_info, $regs);
|
||||
$page_size = intval($regs[1]);
|
||||
if ($page_size < 8192)
|
||||
{
|
||||
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD_PS'];
|
||||
}
|
||||
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT *
|
||||
FROM RDB$FUNCTIONS
|
||||
WHERE RDB$SYSTEM_FLAG IS NULL
|
||||
AND RDB$FUNCTION_NAME = 'CHAR_LENGTH'";
|
||||
$sql = "SELECT FIRST 0 char_length('')
|
||||
FROM RDB\$DATABASE";
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// if its a UDF, its too old
|
||||
if ($row)
|
||||
if (!$result) // This can only fail if char_length is not defined
|
||||
{
|
||||
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT FIRST 0 char_length('')
|
||||
FROM RDB\$DATABASE";
|
||||
$result = $db->sql_query($sql);
|
||||
if (!$result) // This can only fail if char_length is not defined
|
||||
{
|
||||
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
// Setup the stuff for our random table
|
||||
$char_array = array_merge(range('A', 'Z'), range('0', '9'));
|
||||
$char_len = mt_rand(7, 9);
|
||||
$char_array_len = sizeof($char_array) - 1;
|
||||
|
||||
$final = '';
|
||||
|
||||
for ($i = 0; $i < $char_len; $i++)
|
||||
{
|
||||
$final .= $char_array[mt_rand(0, $char_array_len)];
|
||||
}
|
||||
|
||||
// Create some random table
|
||||
$sql = 'CREATE TABLE ' . $final . " (
|
||||
FIELD1 VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
|
||||
FIELD2 INTEGER DEFAULT 0 NOT NULL);";
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Create an index that should fail if the page size is less than 8192
|
||||
$sql = 'CREATE INDEX ' . $final . ' ON ' . $final . '(FIELD1, FIELD2);';
|
||||
$db->sql_query($sql);
|
||||
|
||||
if (ibase_errmsg() !== false)
|
||||
{
|
||||
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD_PS'];
|
||||
}
|
||||
|
||||
// Kill the old table
|
||||
$db->sql_query('DROP TABLE ' . $final . ';');
|
||||
|
||||
unset($final);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
if ($unicode_check)
|
||||
{
|
||||
$sql = "SELECT *
|
||||
FROM NLS_DATABASE_PARAMETERS
|
||||
WHERE PARAMETER = 'NLS_RDBMS_VERSION'
|
||||
OR PARAMETER = 'NLS_CHARACTERSET'";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$stats[$row['parameter']] = $row['value'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (version_compare($stats['NLS_RDBMS_VERSION'], '9.2', '<'))
|
||||
{
|
||||
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_ORACLE'];
|
||||
}
|
||||
|
||||
if ($stats['NLS_CHARACTERSET'] !== 'AL32UTF8')
|
||||
{
|
||||
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_ORACLE_NLS'];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'postgres':
|
||||
if ($unicode_check)
|
||||
// Setup the stuff for our random table
|
||||
$char_array = array_merge(range('A', 'Z'), range('0', '9'));
|
||||
$char_len = mt_rand(7, 9);
|
||||
$char_array_len = sizeof($char_array) - 1;
|
||||
|
||||
$final = '';
|
||||
|
||||
for ($i = 0; $i < $char_len; $i++)
|
||||
{
|
||||
$sql = "SHOW server_encoding;";
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if ($row['server_encoding'] !== 'UNICODE' && $row['server_encoding'] !== 'UTF8')
|
||||
{
|
||||
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_POSTGRES'];
|
||||
}
|
||||
$final .= $char_array[mt_rand(0, $char_array_len)];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Create some random table
|
||||
$sql = 'CREATE TABLE ' . $final . " (
|
||||
FIELD1 VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
|
||||
FIELD2 INTEGER DEFAULT 0 NOT NULL);";
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Create an index that should fail if the page size is less than 8192
|
||||
$sql = 'CREATE INDEX ' . $final . ' ON ' . $final . '(FIELD1, FIELD2);';
|
||||
$db->sql_query($sql);
|
||||
|
||||
if (ibase_errmsg() !== false)
|
||||
{
|
||||
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD_PS'];
|
||||
}
|
||||
|
||||
// Kill the old table
|
||||
$db->sql_query('DROP TABLE ' . $final . ';');
|
||||
|
||||
unset($final);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
$sql = "SELECT *
|
||||
FROM NLS_DATABASE_PARAMETERS
|
||||
WHERE PARAMETER = 'NLS_RDBMS_VERSION'
|
||||
OR PARAMETER = 'NLS_CHARACTERSET'";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$stats[$row['parameter']] = $row['value'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (version_compare($stats['NLS_RDBMS_VERSION'], '9.2', '<'))
|
||||
{
|
||||
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_ORACLE'];
|
||||
}
|
||||
|
||||
if ($stats['NLS_CHARACTERSET'] !== 'AL32UTF8')
|
||||
{
|
||||
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_ORACLE_NLS'];
|
||||
}
|
||||
break;
|
||||
|
||||
case 'postgres':
|
||||
$sql = "SHOW server_encoding;";
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if ($row['server_encoding'] !== 'UNICODE' && $row['server_encoding'] !== 'UTF8')
|
||||
{
|
||||
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_POSTGRES'];
|
||||
}
|
||||
break;
|
||||
|
||||
case 'mssql_odbc':
|
||||
/**
|
||||
* @todo check odbc.defaultlrl (min 128K) and odbc.defaultbinmode (1)
|
||||
*/
|
||||
break;
|
||||
}
|
||||
|
||||
if ($error_connect && (!isset($error) || !sizeof($error)))
|
||||
if (sizeof($error))
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
@@ -792,28 +792,13 @@ class p_master
|
||||
*/
|
||||
function display($page_title, $display_online_list = true)
|
||||
{
|
||||
// Generate the page
|
||||
if (defined('IN_ADMIN') && isset(phpbb::$user->data['session_admin']) && phpbb::$user->data['session_admin'])
|
||||
{
|
||||
adm_page_header($page_title);
|
||||
}
|
||||
else
|
||||
{
|
||||
page_header($page_title, $display_online_list);
|
||||
}
|
||||
page_header($page_title, $display_online_list);
|
||||
|
||||
phpbb::$template->set_filenames(array(
|
||||
'body' => $this->get_tpl_name())
|
||||
);
|
||||
|
||||
if (defined('IN_ADMIN') && isset(phpbb::$user->data['session_admin']) && phpbb::$user->data['session_admin'])
|
||||
{
|
||||
adm_page_footer();
|
||||
}
|
||||
else
|
||||
{
|
||||
page_footer();
|
||||
}
|
||||
page_footer();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user