aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorLudovic Arnaud <ludovic_arnaud@users.sourceforge.net>2003-04-09 22:17:55 +0000
committerLudovic Arnaud <ludovic_arnaud@users.sourceforge.net>2003-04-09 22:17:55 +0000
commitc17e275080d8b1834016d80687ccd5a4ecc674a7 (patch)
treec5715eac921d5fb50feb3155d3589b99c3f0d5a2 /phpBB/includes
parente5e9fd9cbacaec04f0df45c0c05a3944c3d47e74 (diff)
downloadforums-c17e275080d8b1834016d80687ccd5a4ecc674a7.tar
forums-c17e275080d8b1834016d80687ccd5a4ecc674a7.tar.gz
forums-c17e275080d8b1834016d80687ccd5a4ecc674a7.tar.bz2
forums-c17e275080d8b1834016d80687ccd5a4ecc674a7.tar.xz
forums-c17e275080d8b1834016d80687ccd5a4ecc674a7.zip
Weekly update: MCP templates. Forms renamed to 'main', added mcp_jumpbox.html for easy jumping and mcp_foruminfo.html.
Not too happy with HTML though =" templates\subSilver\mcp_forum.html templates\subSilver\mcp_foruminfo.html templates\subSilver\mcp_front.html templates\subSilver\mcp_header.html templates\subSilver\mcp_jumpbox.html templates\subSilver\mcp_move.html templates\subSilver\mcp_post.html templates\subSilver\mcp_viewip.html templates\subSilver\mcp_viewlogs.html git-svn-id: file:///svn/phpbb/trunk@3800 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/functions_admin.php4
-rw-r--r--phpBB/includes/functions_posting.php4
-rw-r--r--phpBB/includes/message_parser.php216
-rw-r--r--phpBB/includes/session.php33
4 files changed, 229 insertions, 28 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 017f965907..1b85242572 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -96,6 +96,7 @@ function get_forum_list($acl_list = 'f_list', $id_only = TRUE, $postable_only =
{
$forum_rows[] = $row;
}
+ $db->sql_freeresult();
}
$rowset = array();
@@ -110,7 +111,6 @@ function get_forum_list($acl_list = 'f_list', $id_only = TRUE, $postable_only =
$rowset[] = ($id_only) ? $row['forum_id'] : $row;
}
}
- $db->sql_freeresult();
return $rowset;
}
@@ -1506,6 +1506,8 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
if (count($topic_id_list))
{
+ $topic_id_list = array_unique($topic_id_list);
+
// This query is not really needed if move_topics() updates the forum_id field, altough it's also used to determine if the topic still exists in the database
$sql = 'SELECT topic_id, forum_id
FROM ' . TOPICS_TABLE . '
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index cddd1a0dda..0955bf677d 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -193,7 +193,7 @@ function topic_review($topic_id, $is_inline_review = false)
$forum_id = intval($row['forum_id']);
$topic_title = $row['topic_title'];
- if (!$auth->acl_get('f_read', $forum_id))
+ if (!$auth->acl_gets('f_read', 'm_', 'a_', $forum_id))
{
trigger_error($user->lang['SORRY_AUTH_READ']);
}
@@ -251,7 +251,7 @@ function topic_review($topic_id, $is_inline_review = false)
}
$template->assign_block_vars('postrow', array(
- 'MINI_POST_IMG' => $user->img('icon_post', $user->lang['POST']),
+ 'MINI_POST_IMG' => $user->img('goto_post', $user->lang['POST']),
'POSTER_NAME' => $poster,
'POST_DATE' => $user->format_date($row['post_time']),
'POST_SUBJECT' => $post_subject,
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index e18abd6ce1..a8a077f6b3 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -23,14 +23,17 @@
// and parses it for attachments, html, bbcode and smilies
class parse_message
{
- var $bbcode_tpl = null;
var $message_mode = 0; // MSG_POST/MSG_PM
+ var $bbcode_tpl = null;
+ var $bbcode_uid = '';
+ var $bbcode_bitfield = 0;
+ var $bbcode_array = array();
function parse_message($message_type)
{
$this->message_mode = $message_type;
}
-
+
function parse(&$message, $html, $bbcode, $uid, $url, $smilies)
{
global $config, $db, $user;
@@ -81,7 +84,10 @@ class parse_message
}
$warn_msg .= (($warn_msg != '') ? '<br />' : '') . $this->html($message, $html);
- $warn_msg .= (($warn_msg != '') ? '<br />' : '') . $this->bbcode($message, $bbcode, $uid);
+ if ($bbcode)
+ {
+ //$warn_msg .= (($warn_msg != '') ? '<br />' : '') . $this->bbcode(&$message);
+ }
$warn_msg .= (($warn_msg != '') ? '<br />' : '') . $this->emoticons($message, $smilies);
$warn_msg .= (($warn_msg != '') ? '<br />' : '') . $this->magic_url($message, $url);
@@ -109,10 +115,210 @@ class parse_message
return;
}
- function bbcode(&$message, $bbcode, $uid)
+ //
+ // bbcode()
+ //
+ function bbcode(&$message)
{
- global $config;
+ $bbcode_bitfield = str_repeat('0', 32);
+ $this->bbcode_uid = substr(md5(time()), 0, BBCODE_UID_LEN);
+ $this->bbcode_init();
+
+ foreach ($this->bbcode_array as $offset => $row)
+ {
+ $parse = FALSE;
+ foreach ($row as $regex => $replacement)
+ {
+ $size = strlen($message);
+ $message = preg_replace($regex, $replacement, $message);
+ if ($size != strlen($message))
+ {
+ $parse = TRUE;
+ }
+ $bbcode_bitfield{$offset} = ($parse) ? '1' : '0';
+ }
+ }
+ $this->bbcode_bitfield = bindec(strrev($bbcode_bitfield));
+ }
+
+ function bbcode_init()
+ {
+ if (!empty($this->bbcode_array))
+ {
+ return;
+ }
+
+ // always encode the [code] tag first
+ $this->bbcode_array = array(
+ 8 => array('#\[code\](.+\[/code\])#ise' => '$this->bbcode_code("\1")'),
+ 10 => array('#\[email(=.*?)?\](.*?)\[/email\]#ise' => '$this->validate_email("\1", "\2")'),
+ 9 => array('#\[list(=[a-z|0-1]+)?\].*\[/list\]#ise' => '$this->bbcode_list("\0")'),
+ 7 => array('#\[u\](.*?)\[/u\]#is' => '<!-- u --><span style="text-decoration: underline">\1</span><!-- u -->'),
+ 6 => array('!\[color=(#[0-9A-F]{6}|[a-z\-]+)\](.*?)\[/color\]!is' => '<!-- c --><span style="color: \1">\2</span><!-- c -->'),
+ 5 => array('#\[size=([\-\+]?[1-2]?[0-9])\](.*?)\[/size\]#is' => '<!-- z --><span style="font-size: \1px">\2</span><!-- z -->'),
+ 4 => array('#\[img\](https?://)([a-z0-9\-\.,\?!%\*_:;~\\&$@/=\+]+)\[/img\]#i'
+ => '[img:' . $this->bbcode_uid . ']\1\2[/img:' . $this->bbcode_uid . ']'),
+ 3 => array('#\[url=?(.*?)?\](.*?)\[/url\]#ise' => '$this->validate_url("\1", "\2")'),
+ 2 => array('#\[i\](.*?)\[/i\]#is' => '<!-- i --><span style="font-style: italic">\1</span><!-- i -->'),
+ 1 => array('#\[b\](.*?)\[/b\]#is' => '<!-- b --><span style="font-weight: bold">\1</span><!-- b -->'),
+ 0 => array('#\[quote(=".*?")?\](.*?)\[/quote\]#is' => '[quote:' . $this->bbcode_uid . '\1]\2[/quote:' . $this->bbcode_uid . ']')
+ );
+
+ /*
+ global $db;
+ $result = $db->sql_query('SELECT bbcode_id, first_pass_regexp, first_pass_replacement FROM ' . BBCODES_TABLE);
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $this->bbcode_array[$row['bbcode_id']] = array($row['first_pass_regexp'] => $row['first_pass_replacement']);
+ }
+ */
+ }
+
+ // bbcode_code()
+ function bbcode_code($in)
+ {
+ $str_from = array('<', '>', '"', ':', '[', ']', '(', ')', '{', '}', '.', '@');
+ $str_to = array('&lt;', '&gt;', '&quot;', '&#58;', '&#91;', '&#93;', '&#40;', '&#41;', '&#123;', '&#125;', '&#46;', '&#64;');
+
+ $in = stripslashes($in);
+ $out = '';
+
+ do
+ {
+// echo "<font color='blue'>$in</font><hr>";
+
+ $pos = strpos($in, '[/code]') + 7;
+ $buffer = substr($in, 0, $pos);
+ $in = substr($in, $pos);
+
+ while ($in)
+ {
+ $pos = strpos($in, '[/code]') + 7;
+ $sub_buffer = substr($in, 0, $pos);
+
+ if (preg_match('#\[code\]#i', $sub_buffer))
+ {
+ break;
+ }
+ else
+ {
+ $in = substr($in, $pos);
+ $buffer .= $sub_buffer;
+ }
+ }
+
+ $buffer = substr($buffer, 0, -7);
+ $out .= '[code:' . $this->bbcode_uid . ']' . str_replace($str_from, $str_to, $buffer) . '[/code:' . $this->bbcode_uid . ']';
+
+ $pos = strpos($in, '[code]');
+ if ($pos !== FALSE)
+ {
+ $out .= substr($in, 0, $pos);
+ $in = substr($in, $pos + 6);
+ }
+ }
+ while ($in);
+
+ return $out;
+ }
+
+ //
+ // bbcode_list()
+ //
+ function bbcode_list($in)
+ {
+ $tok = ']';
+ $out = '[';
+ $in = stripslashes($in);
+ $in = substr($in, 1);
+ $close_tags = array();
+
+ do
+ {
+ $pos = strlen($in);
+ for ($i = 0; $i < strlen($tok); ++$i)
+ {
+ $tmp_pos = strpos($in, $tok{$i});
+ if ($tmp_pos !== FALSE && $tmp_pos < $pos)
+ {
+ $pos = $tmp_pos;
+ }
+ }
+
+ $buffer = substr($in, 0, $pos);
+ $tok = $in{$pos};
+ $in = substr($in, $pos + 1);
+
+ //echo "<b>$pos</b> $buffer <font color='red'>$tok</font> <font color='blue'>$in</font> <font color='orange'>$out</font>\n";
+ if ($tok == ']')
+ {
+ if ($buffer == '/list' && count($close_tags))
+ {
+ $tag = array_pop($close_tags);
+ $out .= $tag;
+ $tok = '[';
+ }
+ elseif (preg_match('/list(=?(?:[0-9]|[a-z]|))/i', $buffer, $m))
+ {
+ array_push($close_tags, (($m[1]) ? '/list:o:' . $this->bbcode_uid . ']' : '/list:u:' . $this->bbcode_uid . ']'));
+ $out .= $buffer . ':' . $this->bbcode_uid . ']';
+ $tok = '[';
+ }
+ else
+ {
+ if ($buffer == '*' && count($close_tags))
+ {
+ $buffer = '*:' . $this->bbcode_uid;
+ }
+
+ $out .= $buffer . $tok;
+ $tok = '[]';
+ }
+ }
+ else
+ {
+ $out .= $buffer . $tok;
+ $tok = ($tok == '[') ? ']' : '[]';
+ }
+ }
+ while ($in);
+
+ // Close tags left = some tags still open
+ if (count($close_tags))
+ {
+ $out .= '[' . implode('[', $close_tags);
+ }
+
+ return $out;
+ }
+
+ //
+ // TODO: validate_email() and validate_url()
+ //
+ function validate_email($var1, $var2)
+ {
+ $retval = '[email' . $var1 . ':' . $this->bbcode_uid . ']' . $var2 . '[/email:' . $this->bbcode_uid . ']';
+ return $retval;
+ }
+
+ function validate_url($var1, $var2)
+ {
+ $url = (empty($var1)) ? stripslashes($var2) : stripslashes($var1);
+
+ //
+ // Put validation regexps here
+ //
+ $valid = FALSE;
+ if (preg_match('!^http://!i', $url))
+ {
+ $valid = TRUE;
+ }
+ if ($valid)
+ {
+ return (empty($var1)) ? '[url:' . $this->bbcode_uid . ']' . $url . '[/url:' . $this->bbcode_uid . ']' : "[url=$url:" . $this->bbcode_uid . ']' . $var2 . '[/url:' . $this->bbcode_uid . ']';
+ }
+ return '[url' . $var1 . ']' . $var2 . '[/url]';
}
// Replace magic urls of form http://xxx.xxx., www.xxx. and xxx@xxx.xxx.
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index 102ecd46b6..50af672441 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -181,15 +181,16 @@ class session
$autologin = '';
$this->data['user_id'] = $user_id = ANONYMOUS;
}
-
+
+ // Is user banned? Are they excluded?
if (!$this->data['user_founder'])
{
$banned = false;
- $sql = 'SELECT ban_ip, ban_userid, ban_email, ban_exclude, ban_give_reason, ban_end
- FROM ' . BANLIST_TABLE . '
- WHERE ban_end >= ' . time() . '
- OR ban_end = 0';
+ $sql = "SELECT ban_ip, ban_userid, ban_email, ban_exclude
+ FROM " . BANLIST_TABLE . "
+ WHERE ban_end >= $current_time
+ OR ban_end = 0";
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
@@ -217,17 +218,10 @@ class session
if ($banned)
{
- // Initiate environment ... since it won't be set at this stage
- $this->setup();
-
- // Determine which message to output
- $till_date = (!empty($row['ban_end'])) ? $this->format_date($row['ban_end']) : '';
- $message = (!empty($row['ban_end'])) ? 'BOARD_BAN_TIME' : 'BOARD_BAN_PERM';
-
- $message = sprintf($this->lang[$message], $till_date, '<a href="mailto:' . $config['board_contact'] . '">', '</a>');
- // More internal HTML ... :D
- $message .= (!empty($row['ban_show_reason'])) ? '<br /><br />' . sprintf($this->lang['BOARD_BAN_REASON'], $row['ban_show_reason']) : '';
- trigger_error($message);
+ // TODO
+ // Note that at present this doesn't surround the administrator
+ // text with an appropriate URL
+ trigger_error('BOARD_BANNED');
}
}
@@ -396,7 +390,7 @@ class user extends session
$this->lang_path = $phpbb_root_path . 'language/' . $this->lang_name . '/';
$this->date_format = $config['default_dateformat'];
$this->timezone = $config['board_timezone'] * 3600;
- $this->dst = $config['board_dst'] * 3600;
+ $this->dst = 0;
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
{
@@ -515,8 +509,6 @@ class auth
{
global $db, $cache;
- $this->founder = ($userdata['user_founder']) ? true : false;
-
if (!($this->acl_options = $cache->get('acl_options')))
{
$sql = "SELECT auth_value, is_global, is_local
@@ -571,6 +563,7 @@ class auth
// Look up an option
function acl_get($opt, $f = 0)
{
+ return TRUE;
static $cache;
if (!isset($cache[$f][$opt]))
@@ -585,7 +578,7 @@ class auth
}
}
- return ($this->founder) ? true : $cache[$f][$opt];
+ return $cache[$f][$opt];
}
function acl_gets()