diff --git a/admin_users.php b/admin_users.php
index 14bc496..9552d17 100644
--- a/admin_users.php
+++ b/admin_users.php
@@ -123,9 +123,9 @@ if (isset($_GET['ip_stats']))
if (isset($_GET['show_users']))
{
- $ip = $_GET['show_users'];
+ $ip = trim($_GET['show_users']);
- if (!@preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $ip) && !@preg_match('/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/', $ip))
+ if (!@preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/', $ip) && !@preg_match('/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/', $ip))
message($lang_admin_users['Bad IP message']);
// Fetch user count
diff --git a/db_update.php b/db_update.php
index 234ec87..c15e9b1 100644
--- a/db_update.php
+++ b/db_update.php
@@ -7,7 +7,7 @@
*/
// The FluxBB version this script updates to
-define('UPDATE_TO', '1.4.0');
+define('UPDATE_TO', '1.4.1');
define('UPDATE_TO_DB_REVISION', 7);
define('UPDATE_TO_SI_REVISION', 1);
@@ -19,10 +19,17 @@ define('MIN_PGSQL_VERSION', '7.0.0');
define('PUN_SEARCH_MIN_WORD', 3);
define('PUN_SEARCH_MAX_WORD', 20);
+// The MySQL connection character set that was used for FluxBB 1.2 - in 99% of cases this should be detected automatically,
+// but can be overridden using the below constant if required.
+//define('FORUM_DEFAULT_CHARSET', 'latin1');
+
// The number of items to process per page view (lower this if the update script times out during UTF-8 conversion)
define('PER_PAGE', 300);
+// Don't set to UTF-8 until after we've found out what the default character set is
+define('FORUM_NO_SET_NAMES', 1);
+
// Make sure we are running at least MIN_PHP_VERSION
if (!function_exists('version_compare') || version_compare(PHP_VERSION, MIN_PHP_VERSION, '<'))
exit('You are running PHP version '.PHP_VERSION.'. FluxBB '.UPDATE_TO.' requires at least PHP '.MIN_PHP_VERSION.' to run properly. You must upgrade your PHP installation before you can continue.');
@@ -95,6 +102,12 @@ if (!defined('FORUM_CACHE_DIR'))
// Load DB abstraction layer and try to connect
require PUN_ROOT.'include/dblayer/common_db.php';
+// Check what the default character set is - since 1.2 didn't specify any we will use whatever the default was (usually latin1)
+$old_connection_charset = defined('FORUM_DEFAULT_CHARSET') ? FORUM_DEFAULT_CHARSET : $db->get_names();
+
+// Set the connection to UTF-8 now
+$db->set_names('utf8');
+
// Check current version
$result = $db->query('SELECT conf_value FROM '.$db->prefix.'config WHERE conf_name=\'o_cur_version\'') or error('Unable to fetch version info.', __FILE__, __LINE__, $db->error());
$cur_version = $db->result($result);
@@ -318,7 +331,7 @@ function alter_table_utf8($table)
//
function convert_table_utf8($table, $callback, $old_charset, $key = null, $start_at = null)
{
- global $mysql, $db;
+ global $mysql, $db, $old_connection_charset;
$finished = true;
$end_at = 0;
@@ -337,8 +350,8 @@ function convert_table_utf8($table, $callback, $old_charset, $key = null, $start
alter_table_utf8($table.'_utf8');
}
- // Change to latin1 mode so MySQL doesn't attempt to perform conversion on the data from the old table
- $db->set_names('latin1');
+ // Change to the old character set so MySQL doesn't attempt to perform conversion on the data from the old table
+ $db->set_names($old_connection_charset);
// Move & Convert everything
$result = $db->query('SELECT * FROM '.$table.($start_at === null ? '' : ' WHERE '.$key.'>'.$start_at).' ORDER BY '.$key.' ASC'.($start_at === null ? '' : ' LIMIT '.PER_PAGE), false) or error('Unable to select from old table', __FILE__, __LINE__, $db->error());
@@ -1402,6 +1415,14 @@ else
// And the parser revision number
$db->query('UPDATE '.$db->prefix.'config SET conf_value = \''.UPDATE_TO_PARSER_REVISION.'\' WHERE conf_name = \'o_parser_revision\'') or error('Unable to update parser revision number', __FILE__, __LINE__, $db->error());
+ // Check the default language still exists!
+ if (!file_exists(PUN_ROOT.'lang/'.$pun_config['o_default_lang'].'/common.php'))
+ $db->query('UPDATE '.$db->prefix.'config SET conf_value = \'English\' WHERE conf_name = \'o_default_lang\'') or error('Unable to update default language', __FILE__, __LINE__, $db->error());
+
+ // Check the default style still exists!
+ if (!file_exists(PUN_ROOT.'style/'.$pun_config['o_default_style'].'.css'))
+ $db->query('UPDATE '.$db->prefix.'config SET conf_value = \'Air\' WHERE conf_name = \'o_default_style\'') or error('Unable to update default style', __FILE__, __LINE__, $db->error());
+
// This feels like a good time to synchronize the forums
$result = $db->query('SELECT id FROM '.$db->prefix.'forums') or error('Unable to fetch forum IDs', __FILE__, __LINE__, $db->error());
@@ -1454,4 +1475,4 @@ $db->end_transaction();
$db->close();
if ($query_str != '')
- exit('
JavaScript seems to be disabled.
Click here to continue .');
+ exit('
JavaScript seems to be disabled. Click here to continue . ');
diff --git a/delete.php b/delete.php
index ebeda07..f810b53 100644
--- a/delete.php
+++ b/delete.php
@@ -19,7 +19,7 @@ if ($id < 1)
message($lang_common['Bad request']);
// Fetch some info about the post, the topic and the forum
-$result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.id AS tid, t.subject, t.posted, t.first_post_id, t.closed, p.poster, p.poster_id, p.message, p.hide_smilies FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
+$result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.id AS tid, t.subject, t.first_post_id, t.closed, p.posted, p.poster, p.poster_id, p.message, p.hide_smilies FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result))
message($lang_common['Bad request']);
diff --git a/include/common.php b/include/common.php
index 1ad999b..93351c0 100644
--- a/include/common.php
+++ b/include/common.php
@@ -10,7 +10,7 @@ if (!defined('PUN_ROOT'))
exit('The constant PUN_ROOT must be defined and point to a valid FluxBB installation root directory.');
// Define the version and database revision that this code was written for
-define('FORUM_VERSION', '1.4.0');
+define('FORUM_VERSION', '1.4.1');
define('FORUM_DB_REVISION', 7);
define('FORUM_SI_REVISION', 1);
diff --git a/include/common_admin.php b/include/common_admin.php
index 7a5603d..acf0b4c 100644
--- a/include/common_admin.php
+++ b/include/common_admin.php
@@ -44,8 +44,8 @@ function generate_admin_menu($page = '')
>
>
>
-
>
-
>
+
>
+
>
>
>
>
diff --git a/include/dblayer/mysql.php b/include/dblayer/mysql.php
index c595da4..26fdbf6 100644
--- a/include/dblayer/mysql.php
+++ b/include/dblayer/mysql.php
@@ -179,11 +179,19 @@ class DBLayer
return false;
}
+ function get_names()
+ {
+ $result = $this->query('SHOW VARIABLES LIKE \'character_set_connection\'');
+ return $this->result($result, 0, 1);
+ }
+
+
function set_names($names)
{
return $this->query('SET NAMES \''.$this->escape($names).'\'');
}
+
function get_version()
{
$result = $this->query('SELECT VERSION()');
@@ -194,6 +202,7 @@ class DBLayer
);
}
+
function table_exists($table_name, $no_prefix = false)
{
$result = $this->query('SHOW TABLES LIKE \''.($no_prefix ? '' : $this->prefix).$this->escape($table_name).'\'');
diff --git a/include/dblayer/mysql_innodb.php b/include/dblayer/mysql_innodb.php
index b78c63c..c1f9467 100644
--- a/include/dblayer/mysql_innodb.php
+++ b/include/dblayer/mysql_innodb.php
@@ -193,6 +193,13 @@ class DBLayer
}
+ function get_names()
+ {
+ $result = $this->query('SHOW VARIABLES LIKE \'character_set_connection\'');
+ return $this->result($result, 0, 1);
+ }
+
+
function set_names($names)
{
return $this->query('SET NAMES \''.$this->escape($names).'\'');
diff --git a/include/dblayer/mysqli.php b/include/dblayer/mysqli.php
index 9b81bdd..72a1e3b 100644
--- a/include/dblayer/mysqli.php
+++ b/include/dblayer/mysqli.php
@@ -94,10 +94,13 @@ class DBLayer
{
if ($query_id)
{
- if ($row)
- @mysqli_data_seek($query_id, $row);
+ if ($row !== 0 && @mysqli_data_seek($query_id, $row) === false)
+ return false;
$cur_row = @mysqli_fetch_row($query_id);
+ if ($cur_row === false)
+ return false;
+
return $cur_row[$col];
}
else
@@ -182,6 +185,14 @@ class DBLayer
return false;
}
+
+ function get_names()
+ {
+ $result = $this->query('SHOW VARIABLES LIKE \'character_set_connection\'');
+ return $this->result($result, 0, 1);
+ }
+
+
function set_names($names)
{
return $this->query('SET NAMES \''.$this->escape($names).'\'');
diff --git a/include/dblayer/mysqli_innodb.php b/include/dblayer/mysqli_innodb.php
index 2b591cd..b8ab5e1 100644
--- a/include/dblayer/mysqli_innodb.php
+++ b/include/dblayer/mysqli_innodb.php
@@ -107,10 +107,13 @@ class DBLayer
{
if ($query_id)
{
- if ($row)
- @mysqli_data_seek($query_id, $row);
+ if ($row !== 0 && @mysqli_data_seek($query_id, $row) === false)
+ return false;
$cur_row = @mysqli_fetch_row($query_id);
+ if ($cur_row === false)
+ return false;
+
return $cur_row[$col];
}
else
@@ -196,6 +199,13 @@ class DBLayer
}
+ function get_names()
+ {
+ $result = $this->query('SHOW VARIABLES LIKE \'character_set_connection\'');
+ return $this->result($result, 0, 1);
+ }
+
+
function set_names($names)
{
return $this->query('SET NAMES \''.$this->escape($names).'\'');
diff --git a/include/dblayer/pgsql.php b/include/dblayer/pgsql.php
index 05d8cf0..65c3ba9 100644
--- a/include/dblayer/pgsql.php
+++ b/include/dblayer/pgsql.php
@@ -255,6 +255,14 @@ class DBLayer
return false;
}
+
+ function get_names()
+ {
+ $result = $this->query('SHOW client_encoding');
+ return strtolower($this->result($result)); // MySQL returns lowercase so lets be consistent
+ }
+
+
function set_names($names)
{
return $this->query('SET NAMES \''.$this->escape($names).'\'');
diff --git a/include/dblayer/sqlite.php b/include/dblayer/sqlite.php
index 49ffeb8..d337a8c 100644
--- a/include/dblayer/sqlite.php
+++ b/include/dblayer/sqlite.php
@@ -127,10 +127,13 @@ class DBLayer
{
if ($query_id)
{
- if ($row != 0)
- @sqlite_seek($query_id, $row);
+ if ($row !== 0 && @sqlite_seek($query_id, $row) === false)
+ return false;
$cur_row = @sqlite_current($query_id);
+ if ($cur_row === false)
+ return false;
+
return $cur_row[$col];
}
else
@@ -241,9 +244,16 @@ class DBLayer
return false;
}
+
+ function get_names()
+ {
+ return '';
+ }
+
+
function set_names($names)
{
- return;
+ return true;
}
diff --git a/include/functions.php b/include/functions.php
index 054e1ed..ce0f64d 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -741,7 +741,7 @@ function censor_words($text)
for ($i = 0; $i < $num_words; ++$i)
{
list($search_for[$i], $replace_with[$i]) = $db->fetch_row($result);
- $search_for[$i] = '/\b('.str_replace('\*', '\w*?', preg_quote($search_for[$i], '/')).')\b/i';
+ $search_for[$i] = '/(?<=\W)('.str_replace('\*', '\w*?', preg_quote($search_for[$i], '/')).')(?=\W)/i';
}
}
@@ -1667,8 +1667,6 @@ function forum_list_plugins($is_admin)
}
$d->close();
- natcasesort($plugins);
-
return $plugins;
}
diff --git a/include/search_idx.php b/include/search_idx.php
index d43f5ea..e9292a4 100644
--- a/include/search_idx.php
+++ b/include/search_idx.php
@@ -48,7 +48,7 @@ define('PUN_CJK_HANGUL_REGEX', '['.
function split_words($text, $idx)
{
// Remove BBCode
- $text = preg_replace('/\[\/?(b|u|i|h|colou?r|quote|code|img|url|email|list)(?:\=[^\]]*)?\]/', ' ', $text);
+ $text = preg_replace('/\[\/?(b|u|s|ins|del|em|i|h|colou?r|quote|code|img|url|email|list)(?:\=[^\]]*)?\]/', ' ', $text);
// Remove any apostrophes or dashes which aren't part of words
$text = substr(preg_replace('/((?<=\W)[\'\-]|[\'\-](?=\W))/', '', ' '.$text.' '), 1, -1);
diff --git a/install.php b/install.php
index 602a6ba..eb86759 100644
--- a/install.php
+++ b/install.php
@@ -7,7 +7,7 @@
*/
// The FluxBB version this script installs
-define('FORUM_VERSION', '1.4.0');
+define('FORUM_VERSION', '1.4.1');
define('FORUM_DB_REVISION', 7);
define('FORUM_SI_REVISION', 1);
diff --git a/lang/English/admin_censoring.php b/lang/English/admin_censoring.php
index f112ba1..9d49495 100644
--- a/lang/English/admin_censoring.php
+++ b/lang/English/admin_censoring.php
@@ -10,7 +10,9 @@ $lang_admin_censoring = array(
'Word removed redirect' => 'Censor word removed. Redirecting …',
'Censoring head' => 'Censoring',
'Add word subhead' => 'Add word',
-'Add word info' => 'Enter a word that you want to censor and the replacement text for this word. Wildcards are accepted (i.e. *some* would match somewhere and lonesome). Censor words also affect usernames. New users will not be able to register with usernames containing any censored words. The search is case insensitive.
Censor words must be enabled in %s for this to have any effect. ',
+'Add word info' => 'Enter a word that you want to censor and the replacement text for this word. Wildcards are accepted (i.e. *some* would match somewhere and lonesome). Censor words also affect usernames. New users will not be able to register with usernames containing any censored words. The search is case insensitive.',
+'Censoring enabled' => '
Censoring is enabled in %s. ',
+'Censoring disabled' => '
Censoring is disabled in %s. ',
'Censored word label' => 'Censored word',
'Replacement label' => 'Replacement word(s)',
'Action label' => 'Action',
diff --git a/lang/English/admin_prune.php b/lang/English/admin_prune.php
index b7f9030..532a74f 100644
--- a/lang/English/admin_prune.php
+++ b/lang/English/admin_prune.php
@@ -11,7 +11,7 @@ $lang_admin_prune = array(
'Days old label' => 'Days old',
'Days old help' => 'The number of days "old" a topic must be to be pruned. E.g. if you were to enter 30, every topic that didn\'t contain a post dated less than 30 days old would be deleted.',
'Prune sticky label' => 'Prune sticky topics',
-'Prune sticky help' => 'When enabled sticky topics will also be pruned.',
+'Prune sticky help' => 'When enabled, sticky topics will also be pruned.',
'Prune from label' => 'Prune from forum',
'All forums' => 'All forums',
'Prune from help' => 'The forum from which you want to prune posts.',
diff --git a/lang/English/admin_ranks.php b/lang/English/admin_ranks.php
index 7dca408..de53834 100644
--- a/lang/English/admin_ranks.php
+++ b/lang/English/admin_ranks.php
@@ -11,7 +11,9 @@ $lang_admin_ranks = array(
'Rank removed redirect' => 'Rank removed. Redirecting …',
'Ranks head' => 'Ranks',
'Add rank subhead' => 'Add rank',
-'Add rank info' => 'Enter a rank and the minimum number of posts a user must have made to attain the rank. Different ranks cannot have the same value for minimum posts. If a title is set for a user, the title will be displayed instead of any rank.
User ranks must be enabled in %s for this to have any effect .',
+'Add rank info' => 'Enter a rank and the minimum number of posts a user must have made to attain the rank. Different ranks cannot have the same value for minimum posts. If a title is set for a user, the title will be displayed instead of any rank.',
+'Ranks enabled' => '
User ranks is enabled in %s. ',
+'Ranks disabled' => '
User ranks is disabled in %s. ',
'Rank title label' => 'Rank title',
'Minimum posts label' => 'Minimum posts',
'Actions label' => 'Actions',
diff --git a/lang/English/prof_reg.php b/lang/English/prof_reg.php
index 9a69b41..1cbbec6 100644
--- a/lang/English/prof_reg.php
+++ b/lang/English/prof_reg.php
@@ -31,10 +31,8 @@ $lang_prof_reg = array(
'Pass not match' => 'Passwords do not match.',
'Banned email' => 'The email address you entered is banned in this forum. Please choose another email address.',
'Dupe email' => 'Someone else is already registered with that email address. Please choose another email address.',
-'Sig too long' => 'Signatures cannot be longer than',
-'characters' => 'characters',
-'Sig too many lines' => 'Signatures cannot have more than',
-'lines' => 'lines',
+'Sig too long' => 'Signatures cannot be longer than %1$s characters. Please reduce your signature by %2$s characters.',
+'Sig too many lines' => 'Signatures cannot have more than %s lines.',
'Bad ICQ' => 'You entered an invalid ICQ UIN. Please go back and correct.',
'UTC-12:00' => '(UTC-12:00) International Date Line West',
diff --git a/lang/English/profile.php b/lang/English/profile.php
index ef6a98c..69c993c 100644
--- a/lang/English/profile.php
+++ b/lang/English/profile.php
@@ -69,9 +69,6 @@ $lang_profile = array(
// Profile display stuff
'Users profile' => '%s\'s profile',
-'Unknown' => '(Unknown)', // This is displayed when a user hasn't filled out profile field (e.g. Location)
-'Private' => '(Private)', // This is displayed when a user does not want to receive emails
-'No avatar' => '(No avatar)',
'Username info' => 'Username: %s',
'Email info' => 'Email: %s',
'Posts info' => 'Posts: %s',
diff --git a/plugins/AMP_Example.php b/plugins/AMP_Example.php
index 7f5d9d6..2f8b0ef 100644
--- a/plugins/AMP_Example.php
+++ b/plugins/AMP_Example.php
@@ -55,7 +55,7 @@
if (!defined('PUN'))
exit;
-// Load the admin_bans.php language file
+// Load the admin_plugin_example.php language file
require PUN_ROOT.'lang/'.$admin_language.'/admin_plugin_example.php';
// Tell admin_loader.php that this is indeed a plugin and that it is loaded
diff --git a/post.php b/post.php
index b255172..0264a4d 100644
--- a/post.php
+++ b/post.php
@@ -39,7 +39,7 @@ if ($cur_posting['redirect_url'] != '')
$mods_array = ($cur_posting['moderators'] != '') ? unserialize($cur_posting['moderators']) : array();
$is_admmod = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && array_key_exists($pun_user['username'], $mods_array))) ? true : false;
-if ($pun_config['o_censoring'] == '1')
+if ($tid && $pun_config['o_censoring'] == '1')
$cur_posting['subject'] = censor_words($cur_posting['subject']);
// Do we have permission to post?
diff --git a/profile.php b/profile.php
index aeba999..53110d9 100644
--- a/profile.php
+++ b/profile.php
@@ -774,9 +774,9 @@ else if (isset($_POST['form_sent']))
// Validate signature
if (pun_strlen($form['signature']) > $pun_config['p_sig_length'])
- message($lang_prof_reg['Sig too long'].' '.$pun_config['p_sig_length'].' '.$lang_prof_reg['characters'].'.');
+ message(sprintf($lang_prof_reg['Sig too long'], $pun_config['p_sig_length'], pun_strlen($form['signature']) - $pun_config['p_sig_length']));
else if (substr_count($form['signature'], "\n") > ($pun_config['p_sig_lines']-1))
- message($lang_prof_reg['Sig too many lines'].' '.$pun_config['p_sig_lines'].' '.$lang_prof_reg['lines'].'.');
+ message(sprintf($lang_prof_reg['Sig too many lines'], $pun_config['p_sig_lines']));
else if ($form['signature'] && $pun_config['p_sig_all_caps'] == '0' && is_all_uppercase($form['signature']) && !$pun_user['is_admmod'])
$form['signature'] = utf8_ucwords(utf8_strtolower($form['signature']));
@@ -934,39 +934,120 @@ if ($pun_user['id'] != $id &&
($pun_user['g_moderator'] == '1' && $pun_user['g_mod_edit_users'] == '0') ||
($pun_user['g_moderator'] == '1' && $user['g_moderator'] == '1')))
{
+ $user_personal = array();
+
+ $user_personal[] = '
'.$lang_common['Username'].' ';
+ $user_personal[] = '
'.pun_htmlspecialchars($user['username']).' ';
+
+ $user_title_field = get_title($user);
+ $user_personal[] = '
'.$lang_common['Title'].' ';
+ $user_personal[] = '
'.(($pun_config['o_censoring'] == '1') ? censor_words($user_title_field) : $user_title_field).' ';
+
+ if ($user['realname'] != '')
+ {
+ $user_personal[] = '
'.$lang_profile['Realname'].' ';
+ $user_personal[] = '
'.pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['realname']) : $user['realname']).' ';
+ }
+
+ if ($user['location'] != '')
+ {
+ $user_personal[] = '
'.$lang_profile['Location'].' ';
+ $user_personal[] = '
'.pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['location']) : $user['location']).' ';
+ }
+
+ if ($user['url'] != '')
+ {
+ $user['url'] = pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['url']) : $user['url']);
+ $user_personal[] = '
'.$lang_profile['Website'].' ';
+ $user_personal[] = '
'.$user['url'].' ';
+ }
+
if ($user['email_setting'] == '0' && !$pun_user['is_guest'] && $pun_user['g_send_email'] == '1')
- $email_field = '
'.$user['email'].' ';
+ $email_field = '
'.$user['email'].' ';
else if ($user['email_setting'] == '1' && !$pun_user['is_guest'] && $pun_user['g_send_email'] == '1')
- $email_field = '
'.$lang_common['Send email'].' ';
+ $email_field = '
'.$lang_common['Send email'].' ';
else
- $email_field = $lang_profile['Private'];
+ $email_field = '';
+ if ($email_field != '')
+ {
+ $user_personal[] = '
'.$lang_common['Email'].' ';
+ $user_personal[] = '
'.$email_field.' ';
+ }
- $user_title_field = get_title($user);
+ $user_messaging = array();
- if ($user['url'] != '')
+ if ($user['jabber'] != '')
{
- $user['url'] = pun_htmlspecialchars($user['url']);
+ $user_messaging[] = '
'.$lang_profile['Jabber'].' ';
+ $user_messaging[] = '
'.pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['jabber']) : $user['jabber']).' ';
+ }
- if ($pun_config['o_censoring'] == '1')
- $user['url'] = censor_words($user['url']);
+ if ($user['icq'] != '')
+ {
+ $user_messaging[] = '
'.$lang_profile['ICQ'].' ';
+ $user_messaging[] = '
'.$user['icq'].' ';
+ }
- $url = '
'.$user['url'].' ';
+ if ($user['msn'] != '')
+ {
+ $user_messaging[] = '
'.$lang_profile['MSN'].' ';
+ $user_messaging[] = '
'.pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['msn']) : $user['msn']).' ';
}
- else
- $url = $lang_profile['Unknown'];
+
+ if ($user['aim'] != '')
+ {
+ $user_messaging[] = '
'.$lang_profile['AOL IM'].' ';
+ $user_messaging[] = '
'.pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['aim']) : $user['aim']).' ';
+ }
+
+ if ($user['yahoo'] != '')
+ {
+ $user_messaging[] = '
'.$lang_profile['Yahoo'].' ';
+ $user_messaging[] = '
'.pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['yahoo']) : $user['yahoo']).' ';
+ }
+
+ $user_personality = array();
if ($pun_config['o_avatars'] == '1')
{
$avatar_field = generate_avatar_markup($id);
- if ($avatar_field == '')
- $avatar_field = $lang_profile['No avatar'];
+ if ($avatar_field != '')
+ {
+ $user_personality[] = '
'.$lang_profile['Avatar'].' ';
+ $user_personality[] = '
'.$avatar_field.' ';
+ }
}
+ if ($pun_config['o_signatures'] == '1')
+ {
+ if (isset($parsed_signature))
+ {
+ $user_personality[] = '
'.$lang_profile['Signature'].' ';
+ $user_personality[] = '
'.$parsed_signature.'
';
+ }
+ }
+
+ $user_activity = array();
+
$posts_field = '';
if ($pun_config['o_show_post_count'] == '1' || $pun_user['is_admmod'])
$posts_field = forum_number_format($user['num_posts']);
- if ($pun_user['g_search'] == '1')
+ if ($pun_user['g_search'] == '1' && $user['num_posts'] > 0)
$posts_field .= (($posts_field != '') ? ' - ' : '').'
'.$lang_profile['Show posts'].' ';
+ if ($posts_field != '')
+ {
+ $user_activity[] = '
'.$lang_common['Posts'].' ';
+ $user_activity[] = '
'.$posts_field.' ';
+ }
+
+ if ($user['num_posts'] > 0)
+ {
+ $user_activity[] = '
'.$lang_common['Last post'].' ';
+ $user_activity[] = '
'.$last_post.' ';
+ }
+
+ $user_activity[] = '
'.$lang_common['Registered'].' ';
+ $user_activity[] = '
'.format_time($user['registered'], true).' ';
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), sprintf($lang_profile['Users profile'], pun_htmlspecialchars($user['username'])));
define('PUN_ALLOW_INDEX', 1);
@@ -983,53 +1064,30 @@ if ($pun_user['id'] != $id &&
-
-
-
-
-
-
-
-
-
-
-
-
+
-