mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
- BBCode bugs
- PostgreSQL now gives us database info (if you are running 8.1 or have the dbsize contrib module installed) git-svn-id: file:///svn/phpbb/trunk@6042 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
6bbeda9450
commit
4613de6f87
4 changed files with 98 additions and 46 deletions
|
@ -466,6 +466,7 @@ class bbcode
|
||||||
// when using the /e modifier, preg_replace slashes double-quotes but does not
|
// when using the /e modifier, preg_replace slashes double-quotes but does not
|
||||||
// seem to slash anything else
|
// seem to slash anything else
|
||||||
$quote = str_replace('\"', '"', $quote);
|
$quote = str_replace('\"', '"', $quote);
|
||||||
|
$username = str_replace('\"', '"', $username);
|
||||||
|
|
||||||
// remove newline at the beginning
|
// remove newline at the beginning
|
||||||
if ($quote{0} == "\n")
|
if ($quote{0} == "\n")
|
||||||
|
|
|
@ -1844,15 +1844,15 @@ function make_clickable($text, $server_url = false)
|
||||||
// Be sure to not let the matches cross over. ;)
|
// Be sure to not let the matches cross over. ;)
|
||||||
|
|
||||||
// relative urls for this board
|
// relative urls for this board
|
||||||
$magic_url_match[] = '#(^|[\n \]]|\()(' . preg_quote($server_url, '#') . ')/(([^[ \t\n\r<"\'\)&]+|&(?!lt;))*)#i';
|
$magic_url_match[] = '#(^|[\n \]]|\()(' . preg_quote($server_url, '#') . ')/(([^[ \t\n\r<"\'\)&]+|&(?!lt;|quot;))*)#i';
|
||||||
$magic_url_replace[] = '$1<!-- l --><a href="$2/$3">$3</a><!-- l -->';
|
$magic_url_replace[] = '$1<!-- l --><a href="$2/$3">$3</a><!-- l -->';
|
||||||
|
|
||||||
// matches a xxxx://aaaaa.bbb.cccc. ...
|
// matches a xxxx://aaaaa.bbb.cccc. ...
|
||||||
$magic_url_match[] = '#(^|[\n \]]|\()([\w]+:/{2}.*?([^[ \t\n\r<"\'\)&]+|&(?!lt;))*)#ie';
|
$magic_url_match[] = '#(^|[\n \]]|\()([\w]+:/{2}.*?([^[ \t\n\r<"\'\)&]+|&(?!lt;|quot;))*)#ie';
|
||||||
$magic_url_replace[] = "'\$1<!-- m --><a href=\"\$2\" target=\"_blank\">' . ((strlen('\$2') > 55) ? substr(str_replace('&', '&', '\$2'), 0, 39) . ' ... ' . substr(str_replace('&', '&', '\$2'), -10) : '\$2') . '</a><!-- m -->'";
|
$magic_url_replace[] = "'\$1<!-- m --><a href=\"\$2\" target=\"_blank\">' . ((strlen('\$2') > 55) ? substr(str_replace('&', '&', '\$2'), 0, 39) . ' ... ' . substr(str_replace('&', '&', '\$2'), -10) : '\$2') . '</a><!-- m -->'";
|
||||||
|
|
||||||
// matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing
|
// matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing
|
||||||
$magic_url_match[] = '#(^|[\n \]]|\()(w{3}\.[\w\-]+\.[\w\-.\~]+(?:[^[ \t\n\r<"\'\)&]+|&(?!lt;))*)#ie';
|
$magic_url_match[] = '#(^|[\n \]]|\()(w{3}\.[\w\-]+\.[\w\-.\~]+(?:[^[ \t\n\r<"\'\)&]+|&(?!lt;|quot;))*)#ie';
|
||||||
$magic_url_replace[] = "'\$1<!-- w --><a href=\"http://\$2\" target=\"_blank\">' . ((strlen('\$2') > 55) ? substr(str_replace('&', '&', '\$2'), 0, 39) . ' ... ' . substr(str_replace('&', '&', '\$2'), -10) : '\$2') . '</a><!-- w -->'";
|
$magic_url_replace[] = "'\$1<!-- w --><a href=\"http://\$2\" target=\"_blank\">' . ((strlen('\$2') > 55) ? substr(str_replace('&', '&', '\$2'), 0, 39) . ' ... ' . substr(str_replace('&', '&', '\$2'), -10) : '\$2') . '</a><!-- w -->'";
|
||||||
|
|
||||||
// matches an email@domain type address at the start of a line, or after a space or after what might be a BBCode.
|
// matches an email@domain type address at the start of a line, or after a space or after what might be a BBCode.
|
||||||
|
@ -1895,7 +1895,14 @@ function smiley_text($text, $force_option = false)
|
||||||
{
|
{
|
||||||
global $config, $user, $phpbb_root_path;
|
global $config, $user, $phpbb_root_path;
|
||||||
|
|
||||||
return ($force_option || !$config['allow_smilies'] || !$user->optionget('viewsmilies')) ? preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $text) : str_replace('<img src="{SMILIES_PATH}', '<img src="' . $phpbb_root_path . $config['smilies_path'], $text);
|
if ($force_option || !$config['allow_smilies'] || !$user->optionget('viewsmilies'))
|
||||||
|
{
|
||||||
|
return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $text);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return str_replace('<img src="{SMILIES_PATH}', '<img src="' . $phpbb_root_path . $config['smilies_path'], $text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2266,8 +2266,12 @@ function get_database_size()
|
||||||
global $db, $user, $table_prefix;
|
global $db, $user, $table_prefix;
|
||||||
|
|
||||||
// This code is heavily influenced by a similar routine in phpMyAdmin 2.2.0
|
// This code is heavily influenced by a similar routine in phpMyAdmin 2.2.0
|
||||||
if (preg_match('#^mysql#', SQL_LAYER))
|
switch (SQL_LAYER)
|
||||||
{
|
{
|
||||||
|
case 'mysql':
|
||||||
|
case 'mysql4':
|
||||||
|
case 'mysqli':
|
||||||
|
|
||||||
$sql = 'SELECT VERSION() AS mysql_version';
|
$sql = 'SELECT VERSION() AS mysql_version';
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$row = $db->sql_fetchrow($result);
|
$row = $db->sql_fetchrow($result);
|
||||||
|
@ -2281,8 +2285,8 @@ function get_database_size()
|
||||||
{
|
{
|
||||||
$db_name = (preg_match('#^(?:3\.23\.(?:[6-9]|[1-9]{2}))|[45]\.#', $version)) ? "`{$db->dbname}`" : $db->dbname;
|
$db_name = (preg_match('#^(?:3\.23\.(?:[6-9]|[1-9]{2}))|[45]\.#', $version)) ? "`{$db->dbname}`" : $db->dbname;
|
||||||
|
|
||||||
$sql = "SHOW TABLE STATUS
|
$sql = 'SHOW TABLE STATUS
|
||||||
FROM " . $db_name;
|
FROM ' . $db_name;
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$dbsize = 0;
|
$dbsize = 0;
|
||||||
|
@ -2314,20 +2318,60 @@ function get_database_size()
|
||||||
{
|
{
|
||||||
$dbsize = $user->lang['NOT_AVAILABLE'];
|
$dbsize = $user->lang['NOT_AVAILABLE'];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (preg_match('#^mssql#', SQL_LAYER))
|
break;
|
||||||
{
|
|
||||||
|
case 'mssql':
|
||||||
|
case 'mssql_odbc':
|
||||||
|
|
||||||
$sql = 'SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize
|
$sql = 'SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize
|
||||||
FROM sysfiles';
|
FROM sysfiles';
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$dbsize = ($row = $db->sql_fetchrow($result)) ? intval($row['dbsize']) : $user->lang['NOT_AVAILABLE'];
|
$dbsize = ($row = $db->sql_fetchrow($result)) ? intval($row['dbsize']) : $user->lang['NOT_AVAILABLE'];
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'postgres':
|
||||||
|
|
||||||
|
$sql = "SELECT proname
|
||||||
|
FROM pg_proc
|
||||||
|
WHERE proname = 'pg_database_size'";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
$row = $db->sql_fetchrow($result);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if ($row['proname'] == 'pg_database_size')
|
||||||
|
{
|
||||||
|
|
||||||
|
$sql = "SELECT oid
|
||||||
|
FROM pg_database
|
||||||
|
WHERE datname = '" . $db->dbname . "'";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
$row = $db->sql_fetchrow($result);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
$oid = $row['oid'];
|
||||||
|
|
||||||
|
$sql = 'SELECT pg_database_size(' . $oid . ') as size';
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
$row = $db->sql_fetchrow($result);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
$dbsize = $row['size'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$dbsize = $user->lang['NOT_AVAILABLE'];
|
$dbsize = $user->lang['NOT_AVAILABLE'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
|
||||||
|
$dbsize = $user->lang['NOT_AVAILABLE'];
|
||||||
|
}
|
||||||
|
|
||||||
if (is_int($dbsize))
|
if (is_int($dbsize))
|
||||||
{
|
{
|
||||||
$dbsize = ($dbsize >= 1048576) ? sprintf('%.2f ' . $user->lang['MB'], ($dbsize / 1048576)) : (($dbsize >= 1024) ? sprintf('%.2f ' . $user->lang['KB'], ($dbsize / 1024)) : sprintf('%.2f ' . $user->lang['BYTES'], $dbsize));
|
$dbsize = ($dbsize >= 1048576) ? sprintf('%.2f ' . $user->lang['MB'], ($dbsize / 1048576)) : (($dbsize >= 1024) ? sprintf('%.2f ' . $user->lang['KB'], ($dbsize / 1024)) : sprintf('%.2f ' . $user->lang['BYTES'], $dbsize));
|
||||||
|
|
|
@ -31,7 +31,7 @@ if (empty($lang) || !is_array($lang))
|
||||||
// BBCodes
|
// BBCodes
|
||||||
// Note to translators: you can translate everything but what's between { and }
|
// Note to translators: you can translate everything but what's between { and }
|
||||||
$lang = array_merge($lang, array(
|
$lang = array_merge($lang, array(
|
||||||
'ACP_BBCODES_EXPLAIN' => 'BBCode is a special implementation of HTML offering greater control over what and how something is displayed. Additionnally, you can save users from typing sometimes very long HTML code by providing them a single BBCode as replacement. From this page you can add, remove and edit custom BBCodes',
|
'ACP_BBCODES_EXPLAIN' => 'BBCode is a special implementation of HTML offering greater control over what and how something is displayed. From this page you can add, remove and edit custom BBCodes',
|
||||||
'ADD_BBCODE' => 'Add a new BBCode',
|
'ADD_BBCODE' => 'Add a new BBCode',
|
||||||
|
|
||||||
'BBCODE_ADDED' => 'BBCode added successfully',
|
'BBCODE_ADDED' => 'BBCode added successfully',
|
||||||
|
|
Loading…
Add table
Reference in a new issue