- a bunch of updates, most of them bbcode related

git-svn-id: file:///svn/phpbb/trunk@5023 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2004-11-06 14:22:04 +00:00
parent 836771cfb8
commit 541a049725
13 changed files with 137 additions and 89 deletions

View file

@ -71,20 +71,23 @@ class bbcode
${$type}['search'][] = str_replace('$uid', $this->bbcode_uid, $search); ${$type}['search'][] = str_replace('$uid', $this->bbcode_uid, $search);
${$type}['replace'][] = $replace; ${$type}['replace'][] = $replace;
} }
if (sizeof($str['search']))
{
$message = str_replace($str['search'], $str['replace'], $message);
$str = array('search' => array(), 'replace' => array());
}
if (sizeof($preg['search']))
{
$message = preg_replace($preg['search'], $preg['replace'], $message);
$preg = array('search' => array(), 'replace' => array());
}
} }
} }
} }
} }
if (count($str['search']))
{
$message = str_replace($str['search'], $str['replace'], $message);
}
if (count($preg['search']))
{
$message = preg_replace($preg['search'], $preg['replace'], $message);
}
// Remove the uid from tags that have not been transformed into HTML // Remove the uid from tags that have not been transformed into HTML
$message = str_replace(':' . $this->bbcode_uid, '', $message); $message = str_replace(':' . $this->bbcode_uid, '', $message);
} }
@ -223,6 +226,11 @@ class bbcode
break; break;
case 9: case 9:
$this->bbcode_cache[$bbcode_id] = array( $this->bbcode_cache[$bbcode_id] = array(
'preg' => array(
'#(\[\/?(list|\*):[mou]?:?$uid\])[\n]{1}#' => "\$1",
'#(\[list=([^\[]+):$uid\])[\n]{1}#' => "\$1",
'#\[list=([^\[]+):$uid\]#e' => "\$this->bbcode_list('\$1')",
),
'str' => array( 'str' => array(
'[list:$uid]' => $this->bbcode_tpl('ulist_open_default', $bbcode_id), '[list:$uid]' => $this->bbcode_tpl('ulist_open_default', $bbcode_id),
'[/list:u:$uid]' => $this->bbcode_tpl('ulist_close', $bbcode_id), '[/list:u:$uid]' => $this->bbcode_tpl('ulist_close', $bbcode_id),
@ -231,9 +239,6 @@ class bbcode
'[/*:$uid]' => $this->bbcode_tpl('listitem_close', $bbcode_id), '[/*:$uid]' => $this->bbcode_tpl('listitem_close', $bbcode_id),
'[/*:m:$uid]' => $this->bbcode_tpl('listitem_close', $bbcode_id) '[/*:m:$uid]' => $this->bbcode_tpl('listitem_close', $bbcode_id)
), ),
'preg' => array(
'#\[list=([^\[]+):$uid\]#e' => "\$this->bbcode_list('\$1')",
)
); );
break; break;
case 10: case 10:
@ -442,7 +447,7 @@ class bbcode
{ {
$tpl = 'olist_open'; $tpl = 'olist_open';
$type = 'arabic-numbers'; $type = 'arabic-numbers';
$start = intval($chr); $start = intval($type);
} }
else else
{ {

View file

@ -359,7 +359,7 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list
continue; continue;
} }
if ($acl_list && !$auth->acl_get($acl_list, $row['forum_id'])) if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id']))
{ {
continue; continue;
} }
@ -606,7 +606,7 @@ function markread($mode, $forum_id = 0, $topic_id = 0, $marktime = false)
} }
// Default tracking type // Default tracking type
$type = TRACK_NORMAL; // $type = TRACK_NORMAL;
$current_time = ($marktime) ? $marktime : time(); $current_time = ($marktime) ? $marktime : time();
$topic_id = (int) $topic_id; $topic_id = (int) $topic_id;
@ -698,12 +698,14 @@ function markread($mode, $forum_id = 0, $topic_id = 0, $marktime = false)
if ($config['load_db_lastread'] || ($config['load_db_track'] && $type == TRACK_POSTED)) if ($config['load_db_lastread'] || ($config['load_db_track'] && $type == TRACK_POSTED))
{ {
$sql = 'UPDATE ' . TOPICS_TRACK_TABLE . " $sql = 'UPDATE ' . TOPICS_TRACK_TABLE . "
SET mark_type = $type, mark_time = $current_time SET mark_time = $current_time
WHERE topic_id = $topic_id WHERE topic_id = $topic_id
AND user_id = " . $user->data['user_id'] . " AND user_id = " . $user->data['user_id'] . "
AND mark_time < $current_time"; AND mark_time < $current_time";
if (!$db->sql_query($sql) || !$db->sql_affectedrows()) if (!$db->sql_query($sql) || !$db->sql_affectedrows())
{ {
$type = (!isset($type)) ? TRACK_NORMAL : $type;
$db->sql_return_on_error(true); $db->sql_return_on_error(true);
$sql = 'INSERT INTO ' . TOPICS_TRACK_TABLE . ' (user_id, topic_id, mark_type, mark_time) $sql = 'INSERT INTO ' . TOPICS_TRACK_TABLE . ' (user_id, topic_id, mark_type, mark_time)
@ -1017,6 +1019,7 @@ function redirect($url)
{ {
header('Refresh: 0; URL=' . $url); header('Refresh: 0; URL=' . $url);
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="refresh" content="0; url=' . $url . '"><title>Redirect</title></head><body><div align="center">' . sprintf($user->lang['URL_REDIRECT'], '<a href="' . $url . '">', '</a>') . '</div></body></html>'; echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="refresh" content="0; url=' . $url . '"><title>Redirect</title></head><body><div align="center">' . sprintf($user->lang['URL_REDIRECT'], '<a href="' . $url . '">', '</a>') . '</div></body></html>';
exit; exit;
} }

View file

@ -1663,8 +1663,6 @@ function cache_moderators()
} }
} }
} }
$cache->destroy(MODERATOR_TABLE);
} }
// Logging functions // Logging functions

View file

@ -13,13 +13,12 @@
class messenger class messenger
{ {
var $msg, $subject, $extra_headers, $encoding; var $vars, $msg, $extra_headers, $replyto, $from, $subject, $necoding;
var $to_address, $cc_address, $bcc_address, $reply_to, $from; var $addresses = array();
var $queue, $jabber;
var $mail_priority = MAIL_NORMAL_PRIORITY; var $mail_priority = MAIL_NORMAL_PRIORITY;
var $tpl_msg = array();
var $use_queue = true; var $use_queue = true;
var $tpl_msg = array();
function messenger($use_queue = true) function messenger($use_queue = true)
{ {
@ -33,13 +32,14 @@ class messenger
} }
$this->use_queue = $use_queue; $this->use_queue = $use_queue;
$this->subject = '';
} }
// Resets all the data (address, template file, etc etc) to default // Resets all the data (address, template file, etc etc) to default
function reset() function reset()
{ {
$this->addresses = array(); $this->addresses = array();
$this->vars = $this->msg = $this->extra_headers = $this->replyto = $this->from = ''; $this->vars = $this->msg = $this->extra_headers = $this->replyto = $this->from = $this->encoding = '';
$this->mail_priority = MAIL_NORMAL_PRIORITY; $this->mail_priority = MAIL_NORMAL_PRIORITY;
} }
@ -261,6 +261,11 @@ class messenger
// Build to, cc and bcc strings // Build to, cc and bcc strings
foreach ($this->addresses as $type => $address_ary) foreach ($this->addresses as $type => $address_ary)
{ {
if ($type == 'im')
{
continue;
}
foreach ($address_ary as $which_ary) foreach ($address_ary as $which_ary)
{ {
$$type .= (($$type != '') ? ', ' : '') . (($which_ary['name'] != '') ? '"' . mail_encode($which_ary['name'], $this->encoding) . '" <' . $which_ary['email'] . '>' : $which_ary['email']); $$type .= (($$type != '') ? ', ' : '') . (($which_ary['name'] != '') ? '"' . mail_encode($which_ary['name'], $this->encoding) . '" <' . $which_ary['email'] . '>' : $which_ary['email']);

View file

@ -1001,7 +1001,7 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
$msg_list_ary = array(); $msg_list_ary = array();
foreach ($msg_users as $row) foreach ($msg_users as $row)
{ {
$pos = sizeof($msg_list_ary[$row['template']]); $pos = (!isset($msg_list_ary[$row['template']])) ? 0 : sizeof($msg_list_ary[$row['template']]);
$msg_list_ary[$row['template']][$pos]['method'] = $row['method']; $msg_list_ary[$row['template']][$pos]['method'] = $row['method'];
$msg_list_ary[$row['template']][$pos]['email'] = $row['user_email']; $msg_list_ary[$row['template']][$pos]['email'] = $row['user_email'];
@ -1050,7 +1050,7 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
// Handle the DB updates // Handle the DB updates
$db->sql_transaction(); $db->sql_transaction();
if (sizeof($update_notification['topic'])) if (isset($update_notification['topic']) && sizeof($update_notification['topic']))
{ {
$db->sql_query('UPDATE ' . TOPICS_WATCH_TABLE . " $db->sql_query('UPDATE ' . TOPICS_WATCH_TABLE . "
SET notify_status = 1 SET notify_status = 1
@ -1058,7 +1058,7 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
AND user_id IN (" . implode(', ', $update_notification['topic']) . ")"); AND user_id IN (" . implode(', ', $update_notification['topic']) . ")");
} }
if (sizeof($update_notification['forum'])) if (isset($update_notification['forum']) && sizeof($update_notification['forum']))
{ {
$db->sql_query('UPDATE ' . FORUMS_WATCH_TABLE . " $db->sql_query('UPDATE ' . FORUMS_WATCH_TABLE . "
SET notify_status = 1 SET notify_status = 1
@ -1067,14 +1067,14 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
} }
// Now delete the user_ids not authorized to receive notifications on this topic/forum // Now delete the user_ids not authorized to receive notifications on this topic/forum
if (sizeof($delete_ids['topic'])) if (isset($delete_ids['topic']) && sizeof($delete_ids['topic']))
{ {
$db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . " $db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . "
WHERE topic_id = $topic_id WHERE topic_id = $topic_id
AND user_id IN (" . implode(', ', $delete_ids['topic']) . ")"); AND user_id IN (" . implode(', ', $delete_ids['topic']) . ")");
} }
if (sizeof($delete_ids['forum'])) if (isset($delete_ids['forum']) && sizeof($delete_ids['forum']))
{ {
$db->sql_query('DELETE FROM ' . FORUMS_WATCH_TABLE . " $db->sql_query('DELETE FROM ' . FORUMS_WATCH_TABLE . "
WHERE forum_id = $forum_id WHERE forum_id = $forum_id
@ -1082,7 +1082,6 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
} }
$db->sql_transaction('commit'); $db->sql_transaction('commit');
} }
?> ?>

View file

@ -915,7 +915,7 @@ function avatar_remote($data, &$error)
return false; return false;
} }
return array(AVATAR_REMOTE, $remotelink, $width, $height); return array(AVATAR_REMOTE, $data['remotelink'], $width, $height);
} }
function avatar_upload($data, &$error) function avatar_upload($data, &$error)

View file

@ -379,8 +379,8 @@ function change_topic_type($mode, $topic_ids)
// Move Topic // Move Topic
function mcp_move_topic($topic_ids) function mcp_move_topic($topic_ids)
{ {
global $auth, $user, $db, $SID, $phpEx, $phpbb_root_path, $template; global $auth, $user, $db, $template;
global $_POST, $_REQUEST; global $SID, $phpEx, $phpbb_root_path;
if (!($forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', 'm_move'))) if (!($forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', 'm_move')))
{ {
@ -481,10 +481,10 @@ function mcp_move_topic($topic_ids)
); );
$db->sql_query('INSERT INTO ' . TOPICS_TABLE . $db->sql_build_array('INSERT', $shadow)); $db->sql_query('INSERT INTO ' . TOPICS_TABLE . $db->sql_build_array('INSERT', $shadow));
$next_id = $db->sql_nextid();
// $next_id = $db->sql_nextid();
// Mark Shadow topic read // Mark Shadow topic read
markread('topic', $row['forum_id'], $next_id); // markread('topic', $row['forum_id'], $next_id);
} }
} }
unset($topic_data); unset($topic_data);
@ -693,8 +693,8 @@ function mcp_delete_post($post_ids)
// Fork Topic // Fork Topic
function mcp_fork_topic($topic_ids) function mcp_fork_topic($topic_ids)
{ {
global $auth, $user, $db, $SID, $phpEx, $phpbb_root_path, $template, $config; global $auth, $user, $db, $template, $config;
global $_POST, $_REQUEST; global $SID, $phpEx, $phpbb_root_path;
if (!($forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', 'm_'))) if (!($forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', 'm_')))
{ {

View file

@ -306,7 +306,7 @@ class mcp_queue extends module
function approve_post($post_id_list) function approve_post($post_id_list)
{ {
global $db, $template, $user, $config; global $db, $template, $user, $config;
global $_REQUEST, $phpEx, $phpbb_root_path, $SID; global $phpEx, $phpbb_root_path, $SID;
if (!($forum_id = check_ids($post_id_list, POSTS_TABLE, 'post_id', 'm_approve'))) if (!($forum_id = check_ids($post_id_list, POSTS_TABLE, 'post_id', 'm_approve')))
{ {
@ -527,7 +527,7 @@ function approve_post($post_id_list)
function disapprove_post($post_id_list) function disapprove_post($post_id_list)
{ {
global $db, $template, $user, $config; global $db, $template, $user, $config;
global $_REQUEST, $_POST, $phpEx, $phpbb_root_path, $SID; global $phpEx, $phpbb_root_path, $SID;
if (!($forum_id = check_ids($post_id_list, POSTS_TABLE, 'post_id', 'm_approve'))) if (!($forum_id = check_ids($post_id_list, POSTS_TABLE, 'post_id', 'm_approve')))
{ {
@ -718,7 +718,7 @@ function disapprove_post($post_id_list)
'ADDITIONAL_MSG' => $additional_msg) 'ADDITIONAL_MSG' => $additional_msg)
); );
confirm_box(false, 'APPROVE_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html'); confirm_box(false, 'DISAPPROVE_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html');
} }
$redirect = request_var('redirect', "index.$phpEx$SID"); $redirect = request_var('redirect', "index.$phpEx$SID");

View file

@ -50,6 +50,7 @@ class bbcode_firstpass extends bbcode
{ {
var $message = ''; var $message = '';
var $warn_msg = array(); var $warn_msg = array();
var $parsed_items = array();
// Parse BBCode // Parse BBCode
function parse_bbcode() function parse_bbcode()
@ -109,15 +110,17 @@ class bbcode_firstpass extends bbcode
'b' => array('bbcode_id' => 1, 'regexp' => array('#\[b\](.*?)\[/b\]#is' => '[b:' . $this->bbcode_uid . ']$1[/b:' . $this->bbcode_uid . ']')), 'b' => array('bbcode_id' => 1, 'regexp' => array('#\[b\](.*?)\[/b\]#is' => '[b:' . $this->bbcode_uid . ']$1[/b:' . $this->bbcode_uid . ']')),
'i' => array('bbcode_id' => 2, 'regexp' => array('#\[i\](.*?)\[/i\]#is' => '[i:' . $this->bbcode_uid . ']$1[/i:' . $this->bbcode_uid . ']')), 'i' => array('bbcode_id' => 2, 'regexp' => array('#\[i\](.*?)\[/i\]#is' => '[i:' . $this->bbcode_uid . ']$1[/i:' . $this->bbcode_uid . ']')),
'url' => array('bbcode_id' => 3, 'regexp' => array('#\[url=?(.*?)?\](.*?)\[/url\]#ise' => "\$this->validate_url('\$1', '\$2')")), 'url' => array('bbcode_id' => 3, 'regexp' => array('#\[url=?(.*?)?\](.*?)\[/url\]#ise' => "\$this->validate_url('\$1', '\$2')")),
'img' => array('bbcode_id' => 4, 'regexp' => array('#\[img\](https?://)([a-z0-9\-\.,\?!%\*_:;~\\&$@/=\+]+)\[/img\]#i' => '[img:' . $this->bbcode_uid . ']$1$2[/img:' . $this->bbcode_uid . ']')), 'img' => array('bbcode_id' => 4, 'regexp' => array('#\[img\](https?://)([a-z0-9\-\.,\?!%\*_:;~\\&$@/=\+]+)\[/img\]#ie' => "\$this->bbcode_img('\$1\$2')")),
'size' => array('bbcode_id' => 5, 'regexp' => array('#\[size=([\-\+]?[1-2]?[0-9])\](.*?)\[/size\]#is' => '[size=$1:' . $this->bbcode_uid . ']$2[/size:' . $this->bbcode_uid . ']')), 'size' => array('bbcode_id' => 5, 'regexp' => array('#\[size=([\-\+]?[1-2]?[0-9])\](.*?)\[/size\]#is' => '[size=$1:' . $this->bbcode_uid . ']$2[/size:' . $this->bbcode_uid . ']')),
'color' => array('bbcode_id' => 6, 'regexp' => array('!\[color=(#[0-9A-F]{6}|[a-z\-]+)\](.*?)\[/color\]!is' => '[color=$1:' . $this->bbcode_uid . ']$2[/color:' . $this->bbcode_uid . ']')), 'color' => array('bbcode_id' => 6, 'regexp' => array('!\[color=(#[0-9A-F]{6}|[a-z\-]+)\](.*?)\[/color\]!is' => '[color=$1:' . $this->bbcode_uid . ']$2[/color:' . $this->bbcode_uid . ']')),
'u' => array('bbcode_id' => 7, 'regexp' => array('#\[u\](.*?)\[/u\]#is' => '[u:' . $this->bbcode_uid . ']$1[/u:' . $this->bbcode_uid . ']')), 'u' => array('bbcode_id' => 7, 'regexp' => array('#\[u\](.*?)\[/u\]#is' => '[u:' . $this->bbcode_uid . ']$1[/u:' . $this->bbcode_uid . ']')),
'list' => array('bbcode_id' => 9, 'regexp' => array('#\[list(=[a-z|0-9|(?:disc|circle|square))]+)?\].*\[/list\]#ise' => "\$this->bbcode_list('\$0')")), 'list' => array('bbcode_id' => 9, 'regexp' => array('#\[list(=[a-z|0-9|(?:disc|circle|square))]+)?\].*\[/list\]#ise' => "\$this->bbcode_list('\$0')")),
'email' => array('bbcode_id' => 10, 'regexp' => array('#\[email=?(.*?)?\](.*?)\[/email\]#ise' => "\$this->validate_email('\$1', '\$2')")), 'email' => array('bbcode_id' => 10, 'regexp' => array('#\[email=?(.*?)?\](.*?)\[/email\]#ise' => "\$this->validate_email('\$1', '\$2')")),
'flash' => array('bbcode_id' => 11, 'regexp' => array('#\[flash=([0-9]+),([0-9]+)\](.*?)\[/flash\]#i' => '[flash=$1,$2:' . $this->bbcode_uid . ']$3[/flash:' . $this->bbcode_uid . ']')) 'flash' => array('bbcode_id' => 11, 'regexp' => array('#\[flash=([0-9]+),([0-9]+)\](.*?)\[/flash\]#ie' => "\$this->bbcode_flash('\$1', '\$2', '\$3')"))
); );
$this->parsed_items = array('code' => 0, 'quote' => 0, 'attachment' => 0, 'url' => 0, 'email' => 0, 'img' => 0, 'flash' => 0);
if (!isset($rowset)) if (!isset($rowset))
{ {
global $db; global $db;
@ -142,9 +145,27 @@ class bbcode_firstpass extends bbcode
} }
} }
function bbcode_img($in)
{
$this->parsed_items['img']++;
$out = '[img:' . $this->bbcode_uid . ']' . $in . '[/img:' . $this->bbcode_uid . ']';
return $out;
}
function bbcode_flash($width, $height, $in)
{
$this->parsed_items['flash']++;
$out = '[flash=' . $width . ',' . $height . ':' . $this->bbcode_uid . ']' . $in . '[/flash:' . $this->bbcode_uid . ']';
return $out;
}
// Hardcode inline attachments [ia] // Hardcode inline attachments [ia]
function bbcode_attachment($stx, $in) function bbcode_attachment($stx, $in)
{ {
$this->parsed_items['attachment']++;
$out = '[attachment=' . $stx . ':' . $this->bbcode_uid . ']<!-- ia' . $stx . ' -->' . $in . '<!-- ia' . $stx . ' -->[/attachment:' . $this->bbcode_uid . ']'; $out = '[attachment=' . $stx . ':' . $this->bbcode_uid . ']<!-- ia' . $stx . ' -->' . $in . '<!-- ia' . $stx . ' -->[/attachment:' . $this->bbcode_uid . ']';
return $out; return $out;
} }
@ -152,12 +173,14 @@ class bbcode_firstpass extends bbcode
// Expects the argument to start right after the opening [code] tag and to end with [/code] // Expects the argument to start right after the opening [code] tag and to end with [/code]
function bbcode_code($stx, $in) function bbcode_code($stx, $in)
{ {
$this->parsed_items['code']++;
// 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
$in = str_replace("\r\n", "\n", str_replace('\"', '"', $in)); $in = str_replace("\r\n", "\n", str_replace('\"', '"', $in));
// We remove the hardcoded elements from the code block here because it is not used in code blocks // We remove the hardcoded elements from the code block here because it is not used in code blocks
// Having it here saves us one preg_replace per message containing a [code] blocks // Having it here saves us one preg_replace per message containing [code] blocks
$htm_match = array( $htm_match = array(
'#<!\-\- e \-\-><a href="mailto:(.*?)">.*?</a><!\-\- e \-\->#', '#<!\-\- e \-\-><a href="mailto:(.*?)">.*?</a><!\-\- e \-\->#',
'#<!\-\- m \-\-><a href="(.*?)" target="_blank">.*?</a><!\-\- m \-\->#', '#<!\-\- m \-\-><a href="(.*?)" target="_blank">.*?</a><!\-\- m \-\->#',
@ -424,6 +447,8 @@ class bbcode_firstpass extends bbcode
} }
elseif (preg_match('#^quote(?:=&quot;(.*?)&quot;)?$#is', $buffer, $m)) elseif (preg_match('#^quote(?:=&quot;(.*?)&quot;)?$#is', $buffer, $m))
{ {
$this->parsed_items['quote']++;
// the buffer holds a valid opening tag // the buffer holds a valid opening tag
if ($config['max_quote_depth'] && sizeof($close_tags) >= $config['max_quote_depth']) if ($config['max_quote_depth'] && sizeof($close_tags) >= $config['max_quote_depth'])
{ {
@ -531,6 +556,8 @@ class bbcode_firstpass extends bbcode
return '[email' . (($var1) ? "=$var1" : '') . ']' . $var2 . '[/email]'; return '[email' . (($var1) ? "=$var1" : '') . ']' . $var2 . '[/email]';
} }
$this->parsed_items['email']++;
if ($var1) if ($var1)
{ {
$retval = '[email=' . $email . ':' . $this->bbcode_uid . ']' . $txt . '[/email:' . $this->bbcode_uid . ']'; $retval = '[email=' . $email . ':' . $this->bbcode_uid . ']' . $txt . '[/email:' . $this->bbcode_uid . ']';
@ -562,6 +589,8 @@ class bbcode_firstpass extends bbcode
if ($valid) if ($valid)
{ {
$this->parsed_items['url']++;
if (!preg_match('#^[\w]+?://.*?#i', $url)) if (!preg_match('#^[\w]+?://.*?#i', $url))
{ {
$url = 'http://' . $url; $url = 'http://' . $url;
@ -604,10 +633,12 @@ class parse_message extends bbcode_firstpass
} }
// Parse Message : public // Parse Message : public
function parse($allow_html, $allow_bbcode, $allow_magic_url, $allow_smilies, $allow_img_bbcode = true, $allow_flash_bbcode = true, $allow_quote_bbcode = true, $update_this_message = true) function parse($allow_html, $allow_bbcode, $allow_magic_url, $allow_smilies, $allow_img_bbcode = true, $allow_flash_bbcode = true, $allow_quote_bbcode = true, $update_this_message = true, $mode = 'post')
{ {
global $config, $db, $user; global $config, $db, $user;
$mode = ($mode != 'post') ? 'sig' : 'post';
$this->allow_img_bbcode = $allow_img_bbcode; $this->allow_img_bbcode = $allow_img_bbcode;
$this->allow_flash_bbcode = $allow_flash_bbcode; $this->allow_flash_bbcode = $allow_flash_bbcode;
$this->allow_quote_bbcode = $allow_quote_bbcode; $this->allow_quote_bbcode = $allow_quote_bbcode;
@ -632,9 +663,11 @@ class parse_message extends bbcode_firstpass
$this->message = preg_replace($match, $replace, trim($this->message)); $this->message = preg_replace($match, $replace, trim($this->message));
// Message length check // Message length check
if (!strlen($this->message) || ($config['max_post_chars'] && strlen($this->message) > $config['max_post_chars'])) $msg_len = ($mode == 'post') ? strlen($this->message) : strlen(preg_replace('#\[\/?[a-z\*\+\-]+(=[\S]+)?\]#is', ' ', $this->message));
if (!$msg_len || ($config['max_' . $mode . '_chars'] && $msg_len > $config['max_' . $mode . '_chars']))
{ {
$this->warn_msg[] = (!strlen($this->message)) ? $user->lang['TOO_FEW_CHARS'] : $user->lang['TOO_MANY_CHARS']; $this->warn_msg[] = (!$msg_len) ? $user->lang['TOO_FEW_CHARS'] : $user->lang['TOO_MANY_CHARS'];
return $this->warn_msg; return $this->warn_msg;
} }
@ -647,13 +680,20 @@ class parse_message extends bbcode_firstpass
// Parse Emoticons // Parse Emoticons
if ($allow_smilies) if ($allow_smilies)
{ {
$this->emoticons($config['max_post_smilies']); $this->emoticons($config['max_' . $mode . '_smilies']);
} }
$num_urls = 0;
// Parse URL's // Parse URL's
if ($allow_magic_url) if ($allow_magic_url)
{ {
$this->magic_url((($config['cookie_secure']) ? 'https://' : 'http://'), $config['server_name'], $config['server_port'], $config['script_path']); $this->magic_url((($config['cookie_secure']) ? 'https://' : 'http://'), $config['server_name'], $config['server_port'], $config['script_path']);
if ($config['max_' . $mode . '_urls'])
{
$num_urls += preg_match_all('#\<!-- (l|m|w|e) --\>.*?\<!-- \1 --\>#', $this->message, $matches);
}
} }
// Parse BBCode // Parse BBCode
@ -669,6 +709,14 @@ class parse_message extends bbcode_firstpass
} }
} }
$this->parse_bbcode(); $this->parse_bbcode();
$num_urls += $this->parsed_items['url'];
}
// Check number of links
if ($config['max_' . $mode . '_urls'] && $num_urls > $config['max_' . $mode . '_urls'])
{
$this->warn_msg[] = sprintf($user->lang['TOO_MANY_URLS'], $config['max_' . $mode . '_urls']);
} }
if (!$update_this_message) if (!$update_this_message)
@ -843,7 +891,7 @@ class parse_message extends bbcode_firstpass
if ($num_matches !== false && $num_matches > $max_smilies) if ($num_matches !== false && $num_matches > $max_smilies)
{ {
$this->warn_msg[] = $user->lang['TOO_MANY_SMILIES']; $this->warn_msg[] = sprintf($user->lang['TOO_MANY_SMILIES'], $max_smilies);
return; return;
} }
} }
@ -1183,6 +1231,11 @@ class fulltext_search
$words = array(); $words = array();
if ($mode == 'edit') if ($mode == 'edit')
{ {
$words['add']['post'] = array();
$words['add']['title'] = array();
$words['del']['post'] = array();
$words['del']['title'] = array();
$sql = 'SELECT w.word_id, w.word_text, m.title_match $sql = 'SELECT w.word_id, w.word_text, m.title_match
FROM ' . SEARCH_WORD_TABLE . ' w, ' . SEARCH_MATCH_TABLE . " m FROM ' . SEARCH_WORD_TABLE . ' w, ' . SEARCH_MATCH_TABLE . " m
WHERE m.post_id = $post_id WHERE m.post_id = $post_id

View file

@ -367,45 +367,29 @@ class ucp_profile extends module
case 'signature': case 'signature':
include($phpbb_root_path . 'includes/functions_posting.'.$phpEx); if (!$auth->acl_get('u_sig'))
$var_ary = array(
'enable_html' => (bool) $config['allow_html'],
'enable_bbcode' => (bool) $config['allow_bbcode'],
'enable_smilies' => (bool) $config['allow_smilies'],
'enable_urls' => true,
'signature' => (string) $user->data['user_sig'],
);
foreach ($var_ary as $var => $default)
{ {
$$var = request_var($var, $default); trigger_error('NO_AUTH_SIGNATURE');
} }
$html_status = ($config['allow_html']) ? true : false; include($phpbb_root_path . 'includes/functions_posting.'.$phpEx);
$bbcode_status = ($config['allow_bbcode']) ? true : false;
$smilies_status = ($config['allow_smilies']) ? true : false;
// NOTE: allow_img and allow_flash do not exist in config table $enable_html = ($config['allow_sig_html']) ? request_var('enable_html', false) : false;
$img_status = ($config['allow_img']) ? true : false; $enable_bbcode = ($config['allow_sig_bbcode']) ? request_var('enable_bbcode', $user->optionget('bbcode')) : false;
$flash_status = ($config['allow_flash']) ? true : false; $enable_smilies = ($config['allow_sig_smilies']) ? request_var('enable_smilies', $user->optionget('smile')) : false;
$enable_urls = request_var('enable_urls', true);
$signature = request_var('signature', $user->data['user_sig']);
if ($submit || $preview) if ($submit || $preview)
{ {
include($phpbb_root_path . 'includes/message_parser.'.$phpEx); include($phpbb_root_path . 'includes/message_parser.'.$phpEx);
if (strlen($signature) > $config['max_sig_chars'])
{
$error[] = 'SIGNATURE_TOO_LONG';
}
if (!sizeof($error)) if (!sizeof($error))
{ {
$message_parser = new parse_message($signature); $message_parser = new parse_message($signature);
// Allowing Quote BBCode // Allowing Quote BBCode
$message_parser->parse($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, $img_status, $flash_status, true); $message_parser->parse($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, $config['allow_sig_img'], $config['allow_sig_flash'], true, true, 'sig');
if (sizeof($message_parser->warn_msg)) if (sizeof($message_parser->warn_msg))
{ {
@ -454,17 +438,17 @@ class ucp_profile extends module
'S_SMILIES_CHECKED' => (!$enable_smilies) ? 'checked="checked"' : '', 'S_SMILIES_CHECKED' => (!$enable_smilies) ? 'checked="checked"' : '',
'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? 'checked="checked"' : '', 'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? 'checked="checked"' : '',
'HTML_STATUS' => ($html_status) ? $user->lang['HTML_IS_ON'] : $user->lang['HTML_IS_OFF'], 'HTML_STATUS' => ($config['allow_sig_html']) ? $user->lang['HTML_IS_ON'] : $user->lang['HTML_IS_OFF'],
'BBCODE_STATUS' => ($bbcode_status) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . "faq.$phpEx$SID&amp;mode=bbcode" . '" target="_phpbbcode">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . "faq.$phpEx$SID&amp;mode=bbcode" . '" target="_phpbbcode">', '</a>'), 'BBCODE_STATUS' => ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . "faq.$phpEx$SID&amp;mode=bbcode" . '" target="_phpbbcode">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . "faq.$phpEx$SID&amp;mode=bbcode" . '" target="_phpbbcode">', '</a>'),
'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], 'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
'IMG_STATUS' => ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'IMG_STATUS' => ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
'FLASH_STATUS' => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], 'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']), 'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']),
'S_HTML_ALLOWED' => $config['allow_html'], 'S_HTML_ALLOWED' => $config['allow_sig_html'],
'S_BBCODE_ALLOWED' => $config['allow_bbcode'], 'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'],
'S_SMILIES_ALLOWED' => $config['allow_smilies'],) 'S_SMILIES_ALLOWED' => $config['allow_sig_smilies'],)
); );
break; break;

View file

@ -37,7 +37,7 @@
</tr> </tr>
<!-- IF S_USER_LOGGED_IN --> <!-- IF S_USER_LOGGED_IN -->
<tr> <tr>
<td class="genmed" align="center">[ <a href="{U_ADD_FRIEND}">{L_ADD_FRIEND}</a> ]</td> <td class="genmed" align="center">[ <a href="{U_ADD_FRIEND}">{L_ADD_FRIEND}</a> | <a href="{U_ADD_FOE}">{L_ADD_FOE}</a> ]</td>
</tr> </tr>
<!-- ENDIF --> <!-- ENDIF -->
</table></td> </table></td>

View file

@ -45,6 +45,7 @@ function jumpto()
document.location.href = base_url.replace('&amp;', '&') + '&start=' + ((page - 1) * perpage); document.location.href = base_url.replace('&amp;', '&') + '&start=' + ((page - 1) * perpage);
} }
} }
//--> //-->
</script> </script>
</head> </head>

View file

@ -47,7 +47,7 @@ function marklist(form_name, status)
<!-- IF ERROR --> <!-- IF ERROR -->
<tr> <tr>
<td class="row3" colspan="2" align="center"><span class="error">{ERROR}</span></td> <td class="row3" colspan="2" align="center"><span class="genmed error">{ERROR}</span></td>
</tr> </tr>
<!-- ENDIF --> <!-- ENDIF -->
@ -80,17 +80,17 @@ function marklist(form_name, status)
</table></td> </table></td>
</tr> </tr>
<tr> <tr>
<td colspan="9"><input class="helpline" type="text" name="helpbox" size="45" maxlength="100" value="{L_STYLES_TIP}" /></td> <td colspan="9"><input class="helpline" type="text" name="helpbox" size="45" maxlength="100" style="width:100%" value="{L_STYLES_TIP}" /></td>
</tr> </tr>
<tr> <tr>
<td colspan="9"><textarea class="post" name="signature" rows="6" cols="60" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);">{SIGNATURE}</textarea></td> <td colspan="9"><textarea class="post" name="signature" rows="10" cols="70" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);">{SIGNATURE}</textarea></td>
</tr> </tr>
<tr> <tr>
<td colspan="9"><table cellspacing="0" cellpadding="0" border="0"> <td colspan="9"><table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr> <tr>
<td bgcolor="black"><script language="javascript" type="text/javascript"><!-- <td bgcolor="black"><script language="javascript" type="text/javascript"><!--
colorPalette('h', 14, 5) colorPalette('h', 17, 5)
//--></script></td> //--></script></td>
</tr> </tr>