Various updates, forum links, "improve" forum management, cleanups, blah blah, note the schema changes, note also that forum management may misbehave ... reports on wrong doings are welcome ... seem to be having problems with some mcp functions under apache/win32

git-svn-id: file:///svn/phpbb/trunk@3961 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2003-05-02 15:50:11 +00:00
parent 9def7a65e3
commit c6888eb18e
35 changed files with 2054 additions and 1253 deletions

View file

@ -272,7 +272,7 @@ if (isset($_REQUEST['bansubmit']))
{
$sql = "INSERT INTO " . BANLIST_TABLE . " ($type, ban_start, ban_end, ban_exclude, ban_reason)
VALUES $sql";
$result = $db->sql_query($sql);
$db->sql_query($sql);
}
if (!$ban_exclude)

View file

@ -439,17 +439,17 @@ switch ($mode)
<td class="row2"><input type="radio" name="board_email_form" value="1" <?php echo $board_email_form_yes; ?> /> <?php echo $user->lang['ENABLED']; ?>&nbsp;&nbsp;<input type="radio" name="board_email_form" value="0" <?php echo $board_email_form_no; ?> /> <?php echo $user->lang['DISABLED']; ?></td>
</tr>
<tr>
<td class="row1" width="50%"><?php echo $user->lang['ADMIN_EMAIL']; ?>: </td>
<td class="row1" width="50%"><?php echo $user->lang['CONTACT_EMAIL']; ?>: <br /><span class="gensmall"><?php echo $user->lang['CONTACT_EMAIL_EXPLAIN']; ?></span></td>
<td class="row2"><input type="text" size="25" maxlength="100" name="board_contact" value="<?php echo $new['board_contact']; ?>" /></td>
</tr>
<tr>
<td class="row1" width="50%"><?php echo $user->lang['ADMIN_EMAIL']; ?>: <br /><span class="gensmall"><?php echo $user->lang['ADMIN_EMAIL_EXPLAIN']; ?></span></td>
<td class="row2"><input type="text" size="25" maxlength="100" name="board_email" value="<?php echo $new['board_email']; ?>" /></td>
</tr>
<tr>
<td class="row1"><?php echo $user->lang['EMAIL_SIG']; ?>: <br /><span class="gensmall"><?php echo $user->lang['EMAIL_SIG_EXPLAIN']; ?></span></td>
<td class="row2"><textarea name="board_email_sig" rows="5" cols="30"><?php echo $new['board_email_sig']; ?></textarea></td>
</tr>
<tr>
<td class="row1" width="50%"><?php echo $user->lang['CONTACT_EMAIL']; ?>: <br /><span class="gensmall"><?php echo $user->lang['CONTACT_EMAIL_EXPLAIN']; ?></span></td>
<td class="row2"><input type="text" size="25" maxlength="100" name="board_contact" value="<?php echo $new['board_contact']; ?>" /></td>
</tr>
<tr>
<td class="row1"><?php echo $user->lang['USE_SMTP']; ?>: <br /><span class="gensmall"><?php echo $user->lang['USE_SMTP_EXPLAIN']; ?></span></td>
<td class="row2"><input type="radio" name="smtp_delivery" value="1" <?php echo $smtp_yes; ?> /> <?php echo $user->lang['YES']; ?>&nbsp;&nbsp;<input type="radio" name="smtp_delivery" value="0" <?php echo $smtp_no; ?> /> <?php echo $user->lang['NO']; ?></td>

File diff suppressed because it is too large Load diff

View file

@ -46,7 +46,7 @@ require('pagestart.' . $phpEx);
$mode = (isset($_REQUEST['mode'])) ? htmlspecialchars($_REQUEST['mode']) : '';
$submode = (isset($_REQUEST['submode'])) ? htmlspecialchars($_REQUEST['submode']) : '';
$which_mode = (!empty($submode) && $submode != $mode) ? $submode : $mode;
$submit = array_values(preg_grep('#^submit_(.*)$#i', array_keys($_POST)));
$submit = array_values(preg_grep('#^submit_(.*)$#i', array_keys($_REQUEST)));
$submit = (sizeof($submit)) ? substr($submit[0], strpos($submit[0], '_') + 1) : '';

View file

@ -74,7 +74,7 @@ if (isset($_POST['doprune']))
// NOTE: this query will conceal all forum names, even those the user isn't authed for
$sql = 'SELECT forum_id, forum_name
FROM ' . FORUMS_TABLE . '
WHERE forum_postable = 1' . (($forum_id) ? ' AND forum_id = ' . $forum_id : '') . '
WHERE forum_type = ' . FORUM_POST . ' ' . (($forum_id) ? ' AND forum_id = ' . $forum_id : '') . '
ORDER BY left_id ASC';
$result = $db->sql_query($sql);

View file

@ -28,22 +28,10 @@ if (!$auth->acl_get('a_styles'))
trigger_error($user->lang['No_admin']);
}
/*
$dp = opendir($phpbb_root_path . 'templates/cache/');
while ($file = readdir($dp))
{
if (!is_file($phpbb_root_path . 'templates/cache/' . $file) && !is_link($phpbb_root_path . 'templates/cache/' . $file) && $file != '.' && $file != '..')
{
$selected = ($tplroot == $file) ? ' selected="selected"' : '';
$tplroot_options .= '<option name="' . $file . '"' . $selected . '>' . $file . '</option>';
}
}
closedir($dp);
*/
//
$mode = (isset($_GET['mode'])) ? $_GET['mode'] : $_POST['mode'];
switch ($mode)
{
case 'editimageset':
@ -157,7 +145,7 @@ switch ($mode)
{
$str = "<?php\n" . $template->compile(stripslashes($_POST['decompile'])) . "\n?".">";
$fp = fopen($phpbb_root_path . 'templates/cache/' . $tplroot . '/' . $tplname . '.html.' . $phpEx, 'w+');
$fp = fopen($phpbb_root_path . 'cache/templates/' . $tplroot . '/' . $tplname . '.html.' . $phpEx, 'w+');
fwrite ($fp, $str);
fclose($fp);
@ -169,14 +157,32 @@ switch ($mode)
}
else if (!empty($tplname) && isset($_POST['tpl_name']))
{
$fp = fopen($phpbb_root_path . 'templates/cache/' . $tplroot . '/' . $tplname . '.html.' . $phpEx, 'r');
$fp = fopen($phpbb_root_path . 'cache/templates/' . $tplroot . '/' . $tplname . '.html.' . $phpEx, 'r');
while (!feof($fp))
{
$str .= fread($fp, 4096);
}
@fclose($fp);
$template->decompile($str);
$match_preg = array(
'#\$this\->_tpl_include\(\'(.*?)\'\);#',
'#echo \$this->_tpldata\[\'\.\'\]\[0\]\[\'(.*?)\'\];#',
'#echo \(\(isset\(\$this\->_tpldata\[\'\.\'\]\[0\]\[\'(.*?)\'\]\)\).*?;#',
'#if \(.*?\[\'\.\'\]\[0\]\[\'(.*?)\'\]\) \{ #',
'#\$_(.*?)_count.*?;if \(.*?\)\{#',
);
$replace_preg = array(
'<!-- INCLUDE $1 -->',
'{$1}',
'{$1}',
'<!-- IF \1 -->',
'<!-- BEGIN \1 -->',
);
$str = preg_replace($match_preg, $replace_preg, $str);
$str = str_replace('<?php ', '', $str);
$str = str_replace(' ?>', '', $str);
}
else
{
@ -195,10 +201,10 @@ switch ($mode)
$tplroot_options = get_templates($tplroot);
$tplname_options = '';
$dp = @opendir($phpbb_root_path . 'templates/cache/' . $tplroot . '/');
$dp = @opendir($phpbb_root_path . 'cache/templates/' . $tplroot . '/');
while ($file = readdir($dp))
{
if (strstr($file, '.html.' . $phpEx) && is_file($phpbb_root_path . 'templates/cache/' . $tplroot . '/' . $file))
if (strstr($file, '.html.' . $phpEx) && is_file($phpbb_root_path . 'cache/templates/' . $tplroot . '/' . $file))
{
$tpl = substr($file, 0, strpos($file, '.'));
$selected = ($tplname == $tpl) ? ' selected="selected"' : '';

View file

@ -114,7 +114,7 @@ page_header($l_title);
if ($mode == 'mod')
{
$forum_box = '<option value="0">' . $user->lang['ALL_FORUMS'] . '</option>' . make_forum_select($forum_id, false, false);
$forum_box = '<option value="0">' . $user->lang['ALL_FORUMS'] . '</option>' . make_forum_select($forum_id);
?>
<table width="100%" cellpadding="1" cellspacing="1" border="0">
@ -130,7 +130,7 @@ if ($mode == 'mod')
<table class="bg" width="100%" cellpadding="4" cellspacing="1" border="0">
<tr>
<td class="cat" colspan="5" height="28" align="center"><span class="gensmall"><?php echo $user->lang['DISPLAY_LOG']; ?>: &nbsp;<?php echo $s_limit_days; ?>&nbsp;<?php echo $user->lang['SORT_BY']; ?> <?php echo $s_sort_key; ?> <?php echo $s_sort_dir; ?>&nbsp;<input class="liteoption" type="submit" value="<?php echo $user->lang['GO']; ?>" name="sort" /></span></td>
<td class="cat" colspan="5" height="28" align="center"><?php echo $user->lang['DISPLAY_LOG']; ?>: &nbsp;<?php echo $s_limit_days; ?>&nbsp;<?php echo $user->lang['SORT_BY']; ?>: <?php echo $s_sort_key; ?> <?php echo $s_sort_dir; ?>&nbsp;<input class="liteoption" type="submit" value="<?php echo $user->lang['GO']; ?>" name="sort" /></td>
</tr>
<tr>
<th width="15%" height="25" nowrap="nowrap"><?php echo $user->lang['USERNAME']; ?></th>
@ -193,19 +193,17 @@ else
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr>
<td align="left" valign="top">&nbsp;<span class="nav"><?php echo on_page($log_count, $config['topics_per_page'], $start); ?></span></td>
<td align="right" valign="top" nowrap="nowrap"><?php
<td align="right" valign="top" nowrap="nowrap"><span class="nav"><?php
if ($auth->acl_get('a_clearlogs'))
{
?><b><span class="gensmall"><a href="javascript:marklist(true);" class="gensmall"><?php echo $user->lang['MARK_ALL']; ?></a> :: <a href="javascript:marklist(false);" class="gensmall"><?php echo $user->lang['UNMARK_ALL']; ?></a></span></b>&nbsp;<br /><br /><?php
?><b><a href="javascript:marklist(true);"><?php echo $user->lang['MARK_ALL']; ?></a> :: <a href="javascript:marklist(false);"><?php echo $user->lang['UNMARK_ALL']; ?></a></b>&nbsp;<br /><br /><?php
}
$pagination = generate_pagination("admin_viewlogs.$phpEx$SID&amp;mode=$mode&amp;sort_days=$sort_days&amp;sort_key=$sort_key&amp;sort_dir=$sort_dir", $log_count, $config['topics_per_page'], $start);
?><span class="nav"><?php echo $pagination; ?></span></td>
echo generate_pagination("admin_viewlogs.$phpEx$SID&amp;mode=$mode&amp;st=$sort_days&amp;sk=$sort_key&amp;sd=$sort_dir", $log_count, $config['topics_per_page'], $start); ?></span></td>
</tr>
</table></form>

Binary file not shown.

After

Width:  |  Height:  |  Size: 714 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 705 B

View file

@ -411,7 +411,7 @@ elseif (isset($_GET['pane']) && $_GET['pane'] == 'right')
}
else
{
$dbsize = $user->lang['Not_available'];
$dbsize = $user->lang['NOT_AVAILABLE'];
}
if (is_int($dbsize))

View file

@ -114,6 +114,11 @@ function page_footer($copyright_html = true)
// Close our DB connection.
$db->sql_close();
if (!empty($cache))
{
$cache->unload();
}
?>
</td>
@ -126,7 +131,7 @@ function page_footer($copyright_html = true)
?>
<div align="center"><span class="copyright">Powered by phpBB <?php echo $config['version']; ?> &copy; 2002 <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB Group</a></span></div>
<div class="copyright" align="center">Powered by phpBB <?php echo $config['version']; ?> &copy; 2002 <a href="http://www.phpbb.com/" target="_phpbb">phpBB Group</a></div>
<br clear="all" />
@ -136,11 +141,6 @@ function page_footer($copyright_html = true)
}
if (!empty($cache))
{
$cache->unload();
}
exit;
}

View file

@ -49,35 +49,21 @@ p {
*/
a:link, a:active, a:visited {
color: #006699;
}
a.gen, a.genmed, a.gensmall {
color: #006699;
text-decoration: none;
}
a.nav {
color: #006699;
text-decoration: none;
}
a.copyright {
color: #444444;
text-decoration: none;
}
a.gen:hover, a.genmed:hover, a.gensmall:hover {
color: #DD6900;
text-decoration: underline;
}
a:hover {
color: #DD6900;
text-decoration: underline;
}
a.nav {
color: #006699;
text-decoration: none;
}
a.nav:hover {
text-decoration: underline;
}
a.copyright:hover {
color: #DD6900;
text-decoration: underline;
}
/*
Non-tag specific
@ -95,6 +81,9 @@ a.copyright:hover {
color: black;
font: bold 11px;
}
.forumlink {
font: bold 120% Verdana, Arial, Helvetica, sans-serif;
}
.name {
color: black;
font-size: 11px;

View file

@ -88,6 +88,9 @@ define('GROUP_SPECIAL', 3);
define('GROUP_FREE', 4);
// Forum/Topic states
define('FORUM_CAT', 0);
define('FORUM_POST', 1);
define('FORUM_LINK', 2);
define('ITEM_UNLOCKED', 0);
define('ITEM_LOCKED', 1);
define('ITEM_MOVED', 2);

Binary file not shown.

After

Width:  |  Height:  |  Size: 714 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 705 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 688 B

View file

@ -116,13 +116,13 @@ function generate_forum_nav(&$forum_data)
{
$template->assign_block_vars('navlinks', array(
'FORUM_NAME' => $parent_name,
'U_VIEW_FORUM' => 'viewforum.' . $phpEx . $SID . '&amp;f=' . $parent_forum_id)
'U_VIEW_FORUM' => "viewforum.$phpEx$SID&amp;f=$parent_forum_id")
);
}
$template->assign_block_vars('navlinks', array(
'FORUM_NAME' => $forum_data['forum_name'],
'U_VIEW_FORUM' => 'viewforum.' . $phpEx . $SID . '&amp;f=' . $forum_data['forum_id'])
'U_VIEW_FORUM' => "viewforum.$phpEx$SID&amp;f=" . $forum_data['forum_id'])
);
$template->assign_vars(array(
@ -224,7 +224,7 @@ function gen_forum_rules($mode, &$forum_id)
return;
}
function gen_sort_selects(&$limit_days, &$sort_by_text, &$sort_days, &$sort_key, &$sort_dir, &$s_limit_days, &$s_sort_key, &$s_sort_dir)
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)
{
global $user;
@ -254,6 +254,8 @@ function gen_sort_selects(&$limit_days, &$sort_by_text, &$sort_days, &$sort_key,
}
$s_sort_dir .= '</select>';
$u_sort_param = "st=$sort_days&amp;sk=$sort_key&amp;sd=$sort_dir";
return;
}
@ -262,7 +264,7 @@ function make_jumpbox($action, $forum_id = false, $select_all = false)
global $auth, $template, $user, $db, $nav_links, $phpEx, $SID;
$boxstring = '';
$sql = 'SELECT forum_id, forum_name, forum_postable, left_id, right_id
$sql = 'SELECT forum_id, forum_name, forum_type, left_id, right_id
FROM ' . FORUMS_TABLE . '
ORDER BY left_id ASC';
$result = $db->sql_query($sql, 600);
@ -271,7 +273,7 @@ function make_jumpbox($action, $forum_id = false, $select_all = false)
$padding = $forum_list = $holding = '';
while ($row = $db->sql_fetchrow($result))
{
if (!$row['forum_postable'] && ($row['left_id'] + 1 == $row['right_id']))
if ($row['forum_type'] == FORUM_CAT && ($row['left_id'] + 1 == $row['right_id']))
{
// Non-postable forum with no subforums, don't display
continue;
@ -447,10 +449,7 @@ function watch_topic_forum($mode, &$s_watching, &$s_watching_img, $user_id, $mat
$db->sql_query($sql);
}
$template->assign_vars(array(
'META' => '<meta http-equiv="refresh" content="3;url=' . "view$mode.$phpEx$SID&amp;" . $u_url . "=$match_id&amp;start=$start" . '">')
);
meta_refresh(3, "view$mode.$phpEx$SID&amp;$u_url=$match_id&amp;start=$start");
$message = $user->lang['NOT_WATCHING_' . strtoupper($mode)] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . "view$mode.$phpEx$SID&amp;" . $u_url . "=$match_id&amp;start=$start" . '">', '</a>');
trigger_error($message);
}
@ -481,10 +480,7 @@ function watch_topic_forum($mode, &$s_watching, &$s_watching_img, $user_id, $mat
$db->sql_query($sql);
}
$template->assign_vars(array(
'META' => '<meta http-equiv="refresh" content="3;url=' . "view$mode.$phpEx$SID&amp;" . $u_url . "=$match_id&amp;start=$start" . '">')
);
meta_refresh(3, "view$mode.$phpEx$SID&amp;$u_url=$match_id&amp;start=$start");
$message = $user->lang['ARE_WATCHING_' . strtoupper($mode)] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . "view$mode.$phpEx$SID&amp;" . $u_url . "=$match_id&amp;start=$start" . '">', '</a>');
trigger_error($message);
}
@ -512,14 +508,14 @@ function watch_topic_forum($mode, &$s_watching, &$s_watching_img, $user_id, $mat
if ($can_watch)
{
$s_watching = ($is_watching) ? '<a href="' . "view$mode." . $phpEx . $SID . '&amp;' . $u_url . "=$match_id&amp;unwatch=$mode&amp;start=$start" . '">' . $user->lang['STOP_WATCHING_' . strtoupper($mode)] . '</a>' : '<a href="' . "view$mode." . $phpEx . $SID . '&amp;' . $u_url . "=$match_id&amp;watch=$mode&amp;start=$start" . '">' . $user->lang['START_WATCHING_' . strtoupper($mode)] . '</a>';
$s_watching = ($is_watching) ? "<a href=\"view$mode.$phpEx$SID&amp;$u_url=$match_id&amp;unwatch=$mode&amp;start=$start\">" . $user->lang['STOP_WATCHING_' . strtoupper($mode)] . '</a>' : "<a href=\"view$mode.$phpEx$SID&amp;$u_url=$match_id&amp;watch=$mode&amp;start=$start\">" . $user->lang['START_WATCHING_' . strtoupper($mode)] . '</a>';
}
return;
}
// Marks a topic or form as read
function markread($mode, $forum_id = 0, $topic_id = 0, $post_id = 0)
function markread($mode, $forum_id = 0, $topic_id = 0, $marktime = false)
{
global $config, $db, $user;
@ -530,7 +526,7 @@ function markread($mode, $forum_id = 0, $topic_id = 0, $post_id = 0)
// Default tracking type
$type = TRACK_NORMAL;
$current_time = time();
$current_time = ($marktime) ? $marktime : time();
switch ($mode)
{
@ -857,7 +853,7 @@ function generate_board_url()
// Redirects the user to another page then exits the script nicely
function redirect($url)
{
global $db, $cache, $config;
global $db, $cache, $config, $user;
if (isset($db))
{
@ -869,13 +865,14 @@ function redirect($url)
$cache->unload();
}
$url = generate_board_url() . preg_replace('#^/?(.*?)/?$#', '/\1', trim($url));
// Local redirect? If not, prepend the boards url
$url = (!strstr($url, '://')) ? (generate_board_url() . preg_replace('#^/?(.*?)/?$#', '/\1', trim($url))) : $url;
// Redirect via an HTML form for PITA webservers
if (@preg_match('#Microsoft|WebSTAR|Xitami#', getenv('SERVER_SOFTWARE')))
{
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">If your browser does not support meta redirection please click <a href="' . $url . '">HERE</a> to be redirected</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;
}
@ -1045,5 +1042,339 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
break;
}
}
/*
//
function page_header($page_title = '')
{
global $db, $config, $template, $user, $auth, $cache;
define('HEADER_INC', TRUE);
// gzip_compression
if ($config['gzip_compress'])
{
if (extension_loaded('zlib') && !headers_sent())
{
ob_start('ob_gzhandler');
}
}
// Generate logged in/logged out status
if ($user->data['user_id'] != ANONYMOUS)
{
$u_login_logout = 'ucp.'.$phpEx. $SID . '&amp;mode=logout';
$l_login_logout = sprintf($user->lang['LOGOUT_USER'], $user->data['username']);
}
else
{
$u_login_logout = 'ucp.'.$phpEx . $SID . '&amp;mode=login';
$l_login_logout = $user->lang['LOGIN'];
}
// Last visit date/time
$s_last_visit = ($user->data['user_id'] != ANONYMOUS) ? $user->format_date($user->data['session_last_visit']) : '';
// Get users online list ... if required
$l_online_users = $online_userlist = $l_online_record = '';
if (!empty($config['load_online']) && !empty($config['load_online_time']))
{
$userlist_ary = $userlist_visible = array();
$logged_visible_online = $logged_hidden_online = $guests_online = 0;
$prev_user_id = 0;
$prev_user_ip = $reading_sql = '';
if (!empty($_REQUEST['f']))
{
$reading_sql = "AND s.session_page LIKE '%f=" . intval($_REQUEST['f']) . "%'";
}
$sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, u.user_colour, s.session_ip, s.session_allow_viewonline
FROM " . USERS_TABLE . " u, " . SESSIONS_TABLE ." s
WHERE s.session_time >= " . (time() - (intval($config['load_online_time']) * 60)) . "
$reading_sql
AND u.user_id = s.session_user_id
ORDER BY u.username ASC, s.session_ip ASC";
$result = $db->sql_query($sql, false);
while ($row = $db->sql_fetchrow($result))
{
// User is logged in and therefor not a guest
if ($row['user_id'] != ANONYMOUS)
{
// Skip multiple sessions for one user
if ($row['user_id'] != $prev_user_id)
{
if ($row['user_colour'])
{
$row['username'] = '<b style="color:#' . $row['user_colour'] . '">' . $row['username'] . '</b>';
}
if ($row['user_allow_viewonline'] && $row['session_allow_viewonline'])
{
$user_online_link = $row['username'];
$logged_visible_online++;
}
else
{
$user_online_link = '<i>' . $row['username'] . '</i>';
$logged_hidden_online++;
}
if ($row['user_allow_viewonline'] || $auth->acl_get('u_viewonline'))
{
$user_online_link = '<a href="' . "memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['user_id'] . '">' . $user_online_link . '</a>';
$online_userlist .= ($online_userlist != '') ? ', ' . $user_online_link : $user_online_link;
}
}
$prev_user_id = $row['user_id'];
}
else
{
// Skip multiple sessions for one user
if ($row['session_ip'] != $prev_session_ip)
{
$guests_online++;
}
}
$prev_session_ip = $row['session_ip'];
}
if ($online_userlist == '')
{
$online_userlist = $user->lang['NONE'];
}
if (empty($_REQUEST['f']))
{
$online_userlist = $user->lang['Registered_users'] . ' ' . $online_userlist;
}
else
{
$l_online = ($guests_online == 1) ? $user->lang['Browsing_forum_guest'] : $user->lang['Browsing_forum_guests'];
$online_userlist = sprintf($l_online, $online_userlist, $guests_online);
}
$total_online_users = $logged_visible_online + $logged_hidden_online + $guests_online;
if ($total_online_users > $config['record_online_users'])
{
set_config('record_online_users', $total_online_users, TRUE);
set_config('record_online_date', time(), TRUE);
}
// Build online listing
$vars_online = array(
'ONLINE'=> array('total_online_users', 'l_t_user_s'),
'REG' => array('logged_visible_online', 'l_r_user_s'),
'HIDDEN'=> array('logged_hidden_online', 'l_h_user_s'),
'GUEST' => array('guests_online', 'l_g_user_s')
);
foreach ($vars_online as $l_prefix => $var_ary)
{
switch ($$var_ary[0])
{
case 0:
$$var_ary[1] = $user->lang[$l_prefix . '_USERS_ZERO_TOTAL'];
break;
case 1:
$$var_ary[1] = $user->lang[$l_prefix . '_USER_TOTAL'];
break;
default:
$$var_ary[1] = $user->lang[$l_prefix . '_USERS_TOTAL'];
break;
}
}
unset($vars_online);
$l_online_users = sprintf($l_t_user_s, $total_online_users);
$l_online_users .= sprintf($l_r_user_s, $logged_visible_online);
$l_online_users .= sprintf($l_h_user_s, $logged_hidden_online);
$l_online_users .= sprintf($l_g_user_s, $guests_online);
$l_online_record = sprintf($user->lang['RECORD_ONLINE_USERS'], $config['record_online_users'], $user->format_date($config['record_online_date']));
$l_online_time = ($config['load_online_time'] == 1) ? 'VIEW_ONLINE_TIME' : 'VIEW_ONLINE_TIMES';
$l_online_time = sprintf($user->lang[$l_online_time], $config['load_online_time']);
}
// Obtain number of new private messages if user is logged in
if ($user->data['user_id'] != ANONYMOUS)
{
if ($user->data['user_new_privmsg'])
{
$l_message_new = ($user->data['user_new_privmsg'] == 1) ? $user->lang['New_pm'] : $user->lang['New_pms'];
$l_privmsgs_text = sprintf($l_message_new, $user->data['user_new_privmsg']);
if ($user->data['user_last_privmsg'] > $user->data['session_last_visit'])
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_last_privmsg = " . $user->data['session_last_visit'] . "
WHERE user_id = " . $user->data['user_id'];
$db->sql_query($sql);
$s_privmsg_new = 1;
}
else
{
$s_privmsg_new = 0;
}
}
else
{
$l_privmsgs_text = $user->lang['No_new_pm'];
$s_privmsg_new = 0;
}
if ($user->data['user_unread_privmsg'])
{
$l_message_unread = ($user->data['user_unread_privmsg'] == 1) ? $user->lang['Unread_pm'] : $user->lang['Unread_pms'];
$l_privmsgs_text_unread = sprintf($l_message_unread, $user->data['user_unread_privmsg']);
}
else
{
$l_privmsgs_text_unread = $user->lang['No_unread_pm'];
}
}
// Generate HTML required for Mozilla Navigation bar
$nav_links_html = '';
*
$nav_link_proto = '<link rel="%s" href="%s" title="%s" />' . "\n";
foreach ($nav_links as $nav_item => $nav_array)
{
if (!empty($nav_array['url']))
{
$nav_links_html .= sprintf($nav_link_proto, $nav_item, $nav_array['url'], $nav_array['title']);
}
else
{
// We have a nested array, used for items like <link rel='chapter'> that can occur more than once.
foreach ($nav_array as $key => $nested_array)
{
$nav_links_html .= sprintf($nav_link_proto, $nav_item, $nested_array['url'], $nested_array['title']);
}
}
}
*
// Which timezone?
$tz = ($user->data['user_id'] != ANONYMOUS) ? strval(doubleval($user->data['user_timezone'])) : strval(doubleval($config['board_timezone']));
// The following assigns all _common_ variables that may be used at any point
// in a template.
$template->assign_vars(array(
'SITENAME' => $config['sitename'],
'SITE_DESCRIPTION' => $config['site_desc'],
'PAGE_TITLE' => $page_title,
'LAST_VISIT_DATE' => sprintf($user->lang['YOU_LAST_VISIT'], $s_last_visit),
'CURRENT_TIME' => sprintf($user->lang['CURRENT_TIME'], $user->format_date(time())),
'TOTAL_USERS_ONLINE' => $l_online_users,
'LOGGED_IN_USER_LIST' => $online_userlist,
'RECORD_USERS' => $l_online_record,
'PRIVATE_MESSAGE_INFO' => $l_privmsgs_text,
'PRIVATE_MESSAGE_NEW_FLAG' => $s_privmsg_new,
'PRIVATE_MESSAGE_INFO_UNREAD' => $l_privmsgs_text_unread,
'L_LOGIN_LOGOUT' => $l_login_logout,
'L_INDEX' => $user->lang['FORUM_INDEX'],
'L_ONLINE_EXPLAIN' => $l_online_time,
'U_PRIVATEMSGS' => 'ucp.'.$phpEx.$SID.'&amp;mode=pm&amp;folder=inbox',
'U_MEMBERLIST' => 'memberlist.'.$phpEx.$SID,
'U_VIEWONLINE' => 'viewonline.'.$phpEx.$SID,
'U_MEMBERSLIST' => 'memberlist.'.$phpEx.$SID,
'U_GROUP_CP' => 'groupcp.'.$phpEx.$SID,
'U_LOGIN_LOGOUT'=> $u_login_logout,
'U_INDEX' => 'index.'.$phpEx.$SID,
'U_SEARCH' => 'search.'.$phpEx.$SID,
'U_REGISTER' => 'ucp.'.$phpEx.$SID.'&amp;mode=register',
'U_PROFILE' => 'ucp.'.$phpEx.$SID.'&amp;mode=editprofile',
'U_MODCP' => 'mcp.'.$phpEx.$SID,
'U_FAQ' => 'faq.'.$phpEx.$SID,
'U_SEARCH_SELF' => 'search.'.$phpEx.$SID.'&amp;search_id=egosearch',
'U_SEARCH_NEW' => 'search.'.$phpEx.$SID.'&amp;search_id=newposts',
'U_SEARCH_UNANSWERED' => 'search.'.$phpEx.$SID.'&amp;search_id=unanswered',
'S_USER_LOGGED_IN' => ($user->data['user_id'] != ANONYMOUS) ? true : false,
'S_USER_PM_POPUP' => (!empty($user->data['user_popup_pm'])) ? true : false,
'S_USER_BROWSER' => $user->data['session_browser'],
'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'],
'S_CONTENT_ENCODING' => $user->lang['ENCODING'],
'S_CONTENT_DIR_LEFT' => $user->lang['LEFT'],
'S_CONTENT_DIR_RIGHT' => $user->lang['RIGHT'],
'S_TIMEZONE' => ($user->data['user_dst'] || ($user->data['user_id'] == ANONYMOUS && $config['board_dst'])) ? sprintf($user->lang['ALL_TIMES'], $user->lang[$tz], $user->lang['tz']['dst']) : sprintf($user->lang['ALL_TIMES'], $user->lang[$tz], ''),
'S_DISPLAY_ONLINE_LIST' => (!empty($config['load_online'])) ? 1 : 0,
'S_DISPLAY_SEARCH' => (!empty($config['load_search'])) ? 1 : 0,
'S_DISPLAY_PM' => (empty($config['privmsg_disable'])) ? 1 : 0,
'S_DISPLAY_MEMBERLIST' => (isset($auth)) ? $auth->acl_get('u_viewprofile') : 0,
'T_STYLESHEET_DATA' => $user->theme['css_data'],
'T_STYLESHEET_LINK' => 'templates/' . $user->theme['css_external'],
'NAV_LINKS' => $nav_links_html)
);
if ($config['send_encoding'])
{
header ('Content-type: text/html; charset: ' . $user->lang['ENCODING']);
}
header ('Cache-Control: private, no-cache="set-cookie", pre-check=0, post-check=0');
header ('Expires: 0');
header ('Pragma: no-cache');
return;
}
//
function page_footer()
{
global $db, $config, $template, $user, $auth, $cache, $starttime;
// Close our DB connection.
$db->sql_close();
// Unload cache
if (!empty($cache))
{
$cache->unload();
}
// Output page creation time
if (defined('DEBUG'))
{
$mtime = explode(' ', microtime());
$totaltime = $mtime[0] + $mtime[1] - $starttime;
if (!empty($_REQUEST['explain']) && $auth->acl_get('a_'))
{
echo $db->sql_report;
echo "<pre><b>Page generated in $totaltime seconds with " . $db->num_queries . " queries,\nspending " . $db->sql_time . ' doing SQL queries and ' . ($totaltime - $db->sql_time) . ' doing PHP things.</b></pre>';
exit;
}
$debug_output = sprintf('<br /><br />[ Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . ( ( $config['gzip_compress'] ) ? 'On' : 'Off' ) . ' | Load : ' . (($user->load) ? $user->load : 'N/A'), $totaltime);
if ($auth->acl_get('a_'))
{
$debug_output .= ' | <a href="' . htmlspecialchars($_SERVER['REQUEST_URI']) . '&amp;explain=1">Explain</a>';
}
$debug_output .= ' ]';
}
$template->assign_vars(array(
'PHPBB_VERSION' => $config['version'],
'ADMIN_LINK' => ($auth->acl_get('a_')) ? sprintf($user->lang['ACP'], '<a href="' . "adm/index.$phpEx?sid=" . $user->data['session_id'] . '">', '</a>') . '<br /><br />' : '',
'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '')
);
$template->display('body');
exit;
}
*/
?>

View file

@ -20,21 +20,20 @@
***************************************************************************/
// Simple version of jumpbox, just lists authed forums
// This needs altering to allow for ignoring acl checks ... they aren't needed
// everywhere ...
function make_forum_select($select_id = false, $ignore_id = false, $ignore_acl = false)
function make_forum_select($select_id = false, $ignore_id = false, $ignore_acl = false, $ignore_nonpost = false, $ignore_emptycat = true)
{
global $db, $user, $auth;
$right = $cat_right = 0;
$forum_list = $padding = $holding = '';
$acl = ($ignore_acl) ? '' : 'f_list';
$rowset = get_forum_list($acl, FALSE, FALSE, TRUE);
$acl = ($ignore_acl) ? '' : array('f_list', 'a_forum', 'a_forumadd', 'a_forumdel');
$rowset = get_forum_list($acl, false, $ignore_nonpost, true);
foreach ($rowset as $row)
{
if ($row['forum_id'] == $ignore_id)
if ((is_array($ignore_id) && in_array($row['forum_id'], $ignore_id)) ||
$row['forum_id'] == $ignore_id)
{
continue;
}
@ -57,15 +56,16 @@ function make_forum_select($select_id = false, $ignore_id = false, $ignore_acl =
$holding = '';
}
if ($row['right_id'] - $row['left_id'] > 1)
if ($row['right_id'] - $row['left_id'] > 1 && $ignore_emptycat)
{
$cat_right = max($cat_right, $row['right_id']);
$holding .= '<option class="sep" value="' . $row['forum_id'] . '"' . $selected . '>' . $padding . '+ ' . $row['forum_name'] . '</option>';
$holding .= '<option value="' . $row['forum_id'] . '"' . $selected . '>' . $padding . '+ ' . $row['forum_name'] . '</option>';
}
else
{
$forum_list .= $holding . '<option value="' . $row['forum_id'] . '"' . $selected . '>' . $padding . '- ' . $row['forum_name'] . '</option>';
$sep = ($row['right_id'] - $row['left_id'] > 1) ? '+ ' : '- ';
$forum_list .= $holding . '<option value="' . $row['forum_id'] . '"' . $selected . '>' . $padding . $sep . $row['forum_name'] . '</option>';
$holding = '';
}
}
@ -88,7 +88,7 @@ function get_forum_list($acl_list = 'f_list', $id_only = TRUE, $postable_only =
{
// This query is identical to the jumpbox one
$expire_time = ($no_cache) ? 0 : 120;
$sql = 'SELECT forum_id, forum_name, forum_postable, left_id, right_id
$sql = 'SELECT forum_id, forum_name, forum_type, left_id, right_id
FROM ' . FORUMS_TABLE . '
ORDER BY left_id ASC';
$result = $db->sql_query($sql, $expire_time);
@ -102,7 +102,7 @@ function get_forum_list($acl_list = 'f_list', $id_only = TRUE, $postable_only =
$rowset = array();
foreach ($forum_rows as $row)
{
if ($postable_only && !$row['forum_postable'])
if ($postable_only && $row['forum_type'] == FORUM_CAT)
{
continue;
}
@ -122,49 +122,45 @@ function move_topics($topic_ids, $forum_id, $auto_sync = TRUE)
global $db;
$forum_ids = array($forum_id);
$where_sql = (is_array($topic_ids)) ? 'IN (' . implode(', ', $topic_ids) . ')' : '= ' . $topic_ids;
$sql_where = (is_array($topic_ids)) ? 'IN (' . implode(', ', $topic_ids) . ')' : '= ' . $topic_ids;
$sql = 'DELETE FROM ' . TOPICS_TABLE . "
WHERE topic_moved_id $sql_where
AND forum_id = " . $forum_id;
$db->sql_query($sql);
$table_ary = array(TOPICS_TABLE, POSTS_TABLE, LOG_MOD_TABLE);
foreach ($table_ary as $table)
{
$sql = "UPDATE $table
SET forum_id = $forum_id
WHERE topic_id " . $sql_where;
$db->sql_query($sql);
}
unset($table_ary);
if ($auto_sync)
{
$sql = 'SELECT DISTINCT forum_id
FROM ' . TOPICS_TABLE . '
WHERE topic_id ' . $where_sql;
WHERE topic_id ' . $sql_where;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$forum_ids[] = $row['forum_id'];
}
}
$db->sql_freeresult($result);
$sql = 'DELETE FROM ' . TOPICS_TABLE . "
WHERE topic_moved_id $where_sql
AND forum_id = " . $forum_id;
$db->sql_query($sql);
$sql = 'UPDATE ' . TOPICS_TABLE . "
SET forum_id = $forum_id
WHERE topic_id " . $where_sql;
$db->sql_query($sql);
$sql = 'UPDATE ' . POSTS_TABLE . "
SET forum_id = $forum_id
WHERE topic_id " . $where_sql;
$db->sql_query($sql);
$sql = 'UPDATE ' . LOG_MOD_TABLE . "
SET forum_id = $forum_id
WHERE topic_id " . $where_sql;
$db->sql_query($sql);
if ($auto_sync)
{
sync('forum', 'forum_id', $forum_ids, TRUE);
unset($forum_ids);
}
}
function move_posts($post_ids, $topic_id, $auto_sync = TRUE)
{
global $db;
if (!is_array($post_ids))
{
$post_ids = array($post_ids);
@ -179,19 +175,25 @@ function move_posts($post_ids, $topic_id, $auto_sync = TRUE)
FROM ' . POSTS_TABLE . '
WHERE post_id IN (' . implode(', ', $post_ids) . ')';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$forum_ids[] = $row['forum_id'];
$topic_ids[] = $row['topic_id'];
}
$db->sql_freeresult($result);
}
$sql = 'SELECT * FROM ' . TOPICS_TABLE . ' WHERE topic_id = ' . $topic_id;
$sql = 'SELECT *
FROM ' . TOPICS_TABLE . '
WHERE topic_id = ' . $topic_id;
$result = $db->sql_query($sql);
if (!$row = $db->sql_fetchrow($result))
if (!($row = $db->sql_fetchrow($result)))
{
trigger_error('Topic_post_not_exist');
trigger_error('NO_TOPIC');
}
$db->sql_freeresult($result);
$sql = 'UPDATE ' . POSTS_TABLE . '
SET forum_id = ' . $row['forum_id'] . ", topic_id = $topic_id
@ -217,6 +219,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = TRUE)
{
$where_ids = array_unique($where_ids);
}
if (!count($where_ids))
{
return array('topics' => 0, 'posts' => '0');
@ -226,13 +229,13 @@ function delete_topics($where_type, $where_ids, $auto_sync = TRUE)
'posts' => delete_posts($where_type, $where_ids, FALSE)
);
$where_sql = "WHERE $where_type " . ((!is_array($where_ids)) ? "= $where_ids" : 'IN (' . implode(', ', $where_ids) . ')');
//???? $where_sql = "WHERE $where_type " . ((!is_array($where_ids)) ? "= $where_ids" : 'IN (' . implode(', ', $where_ids) . ')');
$sql = 'SELECT topic_id, forum_id
FROM ' . TOPICS_TABLE . "
WHERE $where_type " . ((!is_array($where_ids)) ? "= $where_ids" : 'IN (' . implode(', ', $where_ids) . ')');
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$forum_ids[] = $row['forum_id'];
@ -247,17 +250,25 @@ function delete_topics($where_type, $where_ids, $auto_sync = TRUE)
return $return;
}
// TODO: clean up topics cache if any, last read marking, probably some other stuff too
// TODO: probably some other stuff too
$where_sql = ' IN (' . implode(', ', $topic_ids) . ')';
$sql_where = ' IN (' . implode(', ', $topic_ids) . ')';
$db->sql_transaction('begin');
$db->sql_query('DELETE FROM ' . LASTREAD_TABLE . ' WHERE topic_id' . $where_sql);
$db->sql_query('DELETE FROM ' . POLL_VOTES_TABLE . ' WHERE topic_id' . $where_sql);
$db->sql_query('DELETE FROM ' . POLL_OPTIONS_TABLE . ' WHERE topic_id' . $where_sql);
$db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE topic_id' . $where_sql);
$db->sql_query('DELETE FROM ' . TOPICS_TABLE . ' WHERE topic_moved_id' . $where_sql);
$db->sql_query('DELETE FROM ' . TOPICS_TABLE . ' WHERE topic_id' . $where_sql);
$table_ary = array(TOPICS_TRACK_TABLE, POLL_VOTES_TABLE, POLL_OPTIONS_TABLE, TOPICS_WATCH_TABLE, TOPICS_TABLE);
foreach ($table_ary as $table)
{
$sql = "DELETE FROM $table
WHERE topic_id $sql_where";
$db->sql_query($sql);
}
unset($table_ary);
$sql = 'DELETE FROM ' . TOPICS_TABLE . '
WHERE topic_moved_id' . $sql_where;
$db->sql_query($sql);
$db->sql_transaction('commit');
if ($auto_sync)
@ -266,6 +277,23 @@ function delete_topics($where_type, $where_ids, $auto_sync = TRUE)
sync('topic_reported', $where_type, $where_ids);
}
// Optimize/vacuum tables
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$table_ary = array(TOPICS_TRACK_TABLE, POLL_VOTES_TABLE, POLL_OPTIONS_TABLE, TOPICS_WATCH_TABLE, TOPICS_TABLE);
$sql = 'OPTIMIZE TABLE ' . implode(', ', $table_ary);
$db->sql_query($sql);
unset($table_ary);
break;
case 'postgresql':
$db->sql_query('VACUUM');
break;
}
return $return;
}
@ -301,13 +329,19 @@ function delete_posts($where_type, $where_ids, $auto_sync = TRUE)
return false;
}
$where_sql = ' WHERE post_id IN (' . implode(', ', $post_ids) . ')';
$sql_where = implode(', ', $post_ids);
$db->sql_transaction('begin');
$db->sql_query('DELETE FROM ' . POSTS_TABLE . $where_sql);
$db->sql_query('DELETE FROM ' . RATINGS_TABLE . $where_sql);
$db->sql_query('DELETE FROM ' . REPORTS_TABLE . $where_sql);
$db->sql_query('DELETE FROM ' . SEARCH_MATCH_TABLE . $where_sql);
$table_ary = array(POSTS_TABLE, RATINGS_TABLE, REPORTS_TABLE, SEARCH_MATCH_TABLE);
foreach ($table_ary as $table)
{
$sql = "DELETE FROM $table
WHERE post_id IN ($sql_where)";
$db->sql_query($sql);
}
unset($table_ary);
$db->sql_transaction('commit');
delete_attachment($post_ids);
@ -319,18 +353,35 @@ function delete_posts($where_type, $where_ids, $auto_sync = TRUE)
sync('forum', 'forum_id', $forum_ids, TRUE);
}
// Optimize/vacuum tables
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$table_ary = array(POSTS_TABLE, RATINGS_TABLE, REPORTS_TABLE, SEARCH_MATCH_TABLE);
$sql = 'OPTIMIZE TABLE ' . implode(', ', $table_ary);
$db->sql_query($sql);
unset($table_ary);
break;
case 'postgresql':
$db->sql_query('VACUUM');
break;
}
return count($post_ids);
}
// All-encompasing sync function
//
// Usage:
// sync('topic', 'topic_id', 123); <= resynch topic #123
// sync('topic', 'forum_id', array(2, 3)); <= resynch topics from forum #2 and #3
// sync('topic'); <= resynch all topics
//
function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE, $sync_extra = FALSE)
{
global $db, $dbms;
global $db;
if (is_array($where_ids))
{
@ -351,13 +402,13 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
else
{
$where_sql = 'WHERE ' . $mode{0} . ".$where_type IN (" . implode(', ', $where_ids) . ')';
$where_sql_and = $where_sql . "\n\tAND";
$where_sql_and = $where_sql . ' AND';
}
}
else
{
$where_sql = "WHERE t.$where_type IN (" . implode(', ', $where_ids) . ')';
$where_sql_and = $where_sql . "\n\tAND";
$where_sql_and = $where_sql . ' AND';
}
switch ($mode)
@ -370,7 +421,6 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
$result = $db->sql_query($sql);
$topic_ids = $approved_unapproved_ids = array();
while ($row = $db->sql_fetchrow($result))
{
$approved_unapproved_ids[] = $row['topic_id'];
@ -386,29 +436,34 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
SET topic_approved = 1 - topic_approved
WHERE topic_id IN (' . implode(', ', $approved_unapproved_ids) . ')';
$db->sql_query($sql);
break;
break;
case 'post_attachment':
$post_ids = array();
switch ($dbms)
switch (SQL_LAYER)
{
case 'oracle':
//TODO
break;
default:
$sql = 'SELECT t.post_id, t.post_attachment, COUNT(a.attachment_id) AS attachments
FROM ' . POSTS_TABLE . ' t
LEFT JOIN ' . ATTACHMENTS_TABLE . " a ON t.post_id = a.post_id
$where_sql
GROUP BY t.post_id";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
if (($row['post_attachment'] && !$row['attachments']) || ($row['attachments'] && !$row['post_attachment']))
{
$post_ids[] = $row['post_id'];
}
}
}
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
if (($row['post_attachment'] && !$row['attachments']) || ($row['attachments'] && !$row['post_attachment']))
{
$post_ids[] = $row['post_id'];
}
}
$db->sql_freeresult($result);
if (!count($post_ids))
{
@ -419,32 +474,37 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
SET post_attachment = 1 - post_attachment
WHERE post_id IN (' . implode(', ', $post_ids) . ')';
$db->sql_query($sql);
break;
break;
case 'topic_attachment':
$topic_ids = array();
switch ($dbms)
switch (SQL_LAYER)
{
case 'oracle':
//TODO
break;
default:
$sql = 'SELECT t.topic_id, t.topic_attachment, COUNT(a.attachment_id) AS attachments
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p
LEFT JOIN ' . ATTACHMENTS_TABLE . " a ON p.post_id = a.post_id
$where_sql_and t.topic_id = p.topic_id
AND ((t.topic_attachment = 1 AND attachments = 0)
OR (t.topic_attachment = 0 AND attachments > 0))
OR (t.topic_attachment = 0 AND attachments > 0))
GROUP BY t.topic_id";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
if (($row['topic_attachment'] && !$row['attachments'])
|| ($row['attachments'] && !$row['topic_attachment']))
{
$topic_ids[] = $row['topic_id'];
}
}
}
$result = $db->sql_query($sql);
$topic_ids = array();
while ($row = $db->sql_fetchrow($result))
{
if (($row['topic_attachment'] && !$row['attachments'])
|| ($row['attachments'] && !$row['topic_attachment']))
{
$topic_ids[] = $row['topic_id'];
}
}
$db->sql_freeresult($result);
if (count($topic_ids))
{
@ -455,98 +515,122 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
SET topic_attachment = 1 - topic_attachment
WHERE topic_id IN (' . implode(', ', $topic_ids) . ')';
$db->sql_query($sql);
break;
break;
case 'reported':
$topic_data = $topic_ids = $post_ids = array();
if ($sync_extra)
{
// NOTE: untested
$sql = 'SELECT p.post_id
FROM ' . POSTS_TABLE . ' t
LEFT JOIN ' . REPORTS_TABLE . " r ON r.post_id = t.post_id
$where_sql
AND ((t.post_reported = 1 AND r.post_id IS NULL)
OR (t.post_reported = 0 AND r.post_id > 0))
GROUP p.post_id";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
switch (SQL_LAYER)
{
$post_ids[] = $row['post_id'];
}
$db->sql_freeresult();
case 'oracle':
//TODO
break;
if (count($post_ids))
default:
// NOTE: untested
$sql = 'SELECT p.post_id
FROM ' . POSTS_TABLE . ' t
LEFT JOIN ' . REPORTS_TABLE . " r ON r.post_id = t.post_id
$where_sql
AND ((t.post_reported = 1 AND r.post_id IS NULL)
OR (t.post_reported = 0 AND r.post_id > 0))
GROUP p.post_id";
}
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{
do
{
$post_ids[] = $row['post_id'];
}
while ($row = $db->sql_fetchrow($result));
$sql = 'UPDATE ' . POSTS_TABLE . '
SET post_reported = 1 - post_reported
WHERE post_id IN (' . implode(', ', $post_ids) . ')';
$db->sql_query($sql);
unset($post_ids);
}
$db->sql_freeresult();
}
// NOTE: untested
$sql = 'SELECT t.topic_id, t.topic_reported, p.post_reported
FROM ' . TOPICS_TABLE . ' t
LEFT JOIN ' . POSTS_TABLE . " p ON p.topic_id = t.topic_id
$where_sql
GROUP BY p.topic_id, p.post_reported";
switch (SQL_LAYER)
{
case 'oracle':
//TODO
break;
default:
// NOTE: untested
$sql = 'SELECT t.topic_id, t.topic_reported, p.post_reported
FROM ' . TOPICS_TABLE . ' t
LEFT JOIN ' . POSTS_TABLE . " p ON p.topic_id = t.topic_id
$where_sql
GROUP BY p.topic_id, p.post_reported";
}
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
if ($row = $db->sql_fetchrow($result))
{
if (!isset($topic_data[$row['topic_id']]))
do
{
$topic_data[$row['topic_id']] = array(
'topic_reported' => $row['topic_reported'],
'post_reported' => $row['post_reported']
);
if (!isset($topic_data[$row['topic_id']]))
{
$topic_data[$row['topic_id']] = array(
'topic_reported' => $row['topic_reported'],
'post_reported' => $row['post_reported']
);
}
else
{
$topic_data[$row['topic_id']]['post_reported'] |= $row['post_reported'];
}
}
else
{
$topic_data[$row['topic_id']]['post_reported'] |= $row['post_reported'];
}
}
while ($row = $db->sql_fetchrow($result));
foreach ($topic_data as $topic_id => $row)
{
if ($row['post_reported'] != $row['topic_reported'])
foreach ($topic_data as $topic_id => $row)
{
$topic_ids[] = $topic_id;
if ($row['post_reported'] != $row['topic_reported'])
{
$topic_ids[] = $topic_id;
}
}
}
if (count($topic_ids))
{
$sql = 'UPDATE ' . TOPICS_TABLE . '
SET topic_reported = 1 - topic_reported
WHERE topic_id IN (' . implode(', ', $topic_ids) . ')';
$db->sql_query($sql);
unset($topic_ids);
}
$db->sql_freeresult($result);
return;
break;
break;
case 'forum':
if ($resync_parents)
{
$forum_ids = array();
$sql = 'SELECT f2.forum_id
FROM ' . FORUMS_TABLE . ' f, ' . FORUMS_TABLE . " f2
$where_sql_and f.left_id BETWEEN f2.left_id AND f2.right_id";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$forum_ids[] = $row['forum_id'];
}
if (count($forum_ids))
if ($row = $db->sql_fetchrow($result))
{
$forum_ids = array();
do
{
$forum_ids[] = $row['forum_id'];
}
while ($row = $db->sql_fetchrow($result));
sync('forum', 'forum_id', $forum_ids, FALSE);
unset($forum_ids);
}
$db->sql_freeresult($result);
return;
}
@ -555,12 +639,16 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
$sql = 'SELECT f.*, f2.forum_id AS id
FROM ' . FORUMS_TABLE . ' f, ' . FORUMS_TABLE . " f2
$where_sql_and f2.left_id BETWEEN f.left_id AND f.right_id";
$result = $db->sql_query($sql);
$forum_data = $forum_ids = $post_ids = $subforum_list = $post_count = $last_post_id = $post_info = $topic_count = $topic_count_real = array();
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
if ($row['forum_type'] == FORUM_LINK)
{
continue;
}
$forum_ids[$row['id']] = $row['id'];
if (!isset($subforum_list[$row['forum_id']]))
{
@ -596,6 +684,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
{
$topic_count_real[$row['forum_id']] += $row['forum_topics'];
}
if ($row['topic_approved'])
{
$topic_count[$row['forum_id']] = $row['forum_topics'];
@ -624,6 +713,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
$forum_data[$forum_id]['topics'] += $topic_count[$subforum_id];
$forum_data[$forum_id]['topics_real'] += $topic_count_real[$subforum_id];
}
if (isset($post_count[$subforum_id]))
{
$forum_data[$forum_id]['posts'] += $post_count[$subforum_id];
@ -640,6 +730,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
$post_ids[] = $data['last_post_id'];
}
}
if (count($post_ids))
{
$sql = 'SELECT p.post_id, p.poster_id, u.username, p.post_time
@ -682,35 +773,21 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
{
if (preg_match('#name$#', $fieldname))
{
if (isset($row[$fieldname]))
{
$sql['forum_' . $fieldname] = (string) $row[$fieldname];
}
else
{
$sql['forum_' . $fieldname] = '';
}
$sql['forum_' . $fieldname] = (isset($row[$fieldname])) ? (string) $row[$fieldname] : '';
}
else
{
if (isset($row[$fieldname]))
{
$sql['forum_' . $fieldname] = (int) $row[$fieldname];
}
else
{
$sql['forum_' . $fieldname] = 0;
}
$sql['forum_' . $fieldname] = (isset($row[$fieldname])) ? (int) $row[$fieldname] : 0;
}
}
$sql = 'UPDATE ' . FORUMS_TABLE . '
$sql = 'UPDATE ' . FORUMS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql) . '
WHERE forum_id = ' . $forum_id;
$db->sql_query($sql);
}
}
break;
break;
case 'topic':
$topic_data = $topic_ids = $post_ids = $approved_unapproved_ids = $resync_forums = array();
@ -719,8 +796,8 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
$where_sql_and p.topic_id = t.topic_id
GROUP BY p.topic_id, p.post_approved";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$row['total_posts'] = intval($row['total_posts']);
@ -766,7 +843,6 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
if (!count($topic_ids))
{
// If we get there, topic ids were invalid or topics did not contain any posts
delete_topics($where_type, $where_ids);
return;
}
@ -830,10 +906,9 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
WHERE p.post_id IN (' . implode(', ', $post_ids) . ')
AND u.user_id = p.poster_id';
$result = $db->sql_query($sql);
$post_ids = array();
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
if ($row['post_id'] == $topic_data[$row['topic_id']]['first_post_id'])
@ -874,33 +949,35 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
{
// This routine assumes that post_reported values are correct
// if they are not, use sync('reported') instead
$fieldnames[] = 'reported';
$sql = 'SELECT t.topic_id, p.post_id
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
$where_sql_and p.topic_id = t.topic_id
AND p.post_reported = 1
GROUP t.topic_id";
$result = $db->sql_query($sql);
$fieldnames[] = 'reported';
while ($row = $db->sql_fetchrow($result))
{
$topic_data[$row['topic_id']]['reported'] = 1;
}
$db->sql_freeresult($result);
// This routine assumes that post_attachment values are correct
// if they are not, use sync('post_attachment') instead
$fieldnames[] = 'attachment';
$sql = 'SELECT t.topic_id, p.post_id
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
$where_sql_and p.topic_id = t.topic_id
AND p.post_attachment = 1
GROUP t.topic_id";
$result = $db->sql_query($sql);
$fieldnames[] = 'attachment';
while ($row = $db->sql_fetchrow($result))
{
$topic_data[$row['topic_id']]['attachment'] = 1;
}
$db->sql_freeresult($result);
}
foreach ($topic_data as $topic_id => $row)
@ -929,8 +1006,8 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
// NOTE: should shadow topics be updated as well?
$sql = 'UPDATE ' . TOPICS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql) . '
WHERE topic_id = ' . $topic_id;
SET ' . $db->sql_build_array('UPDATE', $sql) . '
WHERE topic_id = ' . $topic_id;
$db->sql_query($sql);
$resync_forums[] = $row['forum_id'];
@ -948,17 +1025,21 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
GROUP BY f.forum_id';
$result = $db->sql_query($sql);
$forum_ids = array();
while ($row = $db->sql_fetchrow($result))
{
$forum_ids[] = $row['forum_id'];
}
if (count($forum_ids))
if ($row = $db->sql_fetchrow($result))
{
$forum_ids = array();
do
{
$forum_ids[] = $row['forum_id'];
}
while ($row = $db->sql_fetchrow($result));
sync('forum', 'forum_id', $forum_ids, FALSE);
unset($forum_ids);
}
$db->sql_freeresult($result);
}
break;
break;
}
}
@ -1003,8 +1084,7 @@ function prune($forum_id, $prune_date = '', $auto_sync = TRUE)
}
$db->sql_freeresult($result);
$p_result = delete_topics('topic_id', $topic_list, $auto_sync);
return $p_result;
return delete_topics('topic_id', $topic_list, $auto_sync);
}
// Function auto_prune(), this function now relies on passed vars
@ -1036,7 +1116,7 @@ function remove_comments(&$output)
$in_comment = false;
for($i = 0; $i < $linecount; $i++)
{
if (preg_match('/^\/\*/', preg_quote($lines[$i])))
if (preg_match('#^\/\*#', preg_quote($lines[$i])))
{
$in_comment = true;
}
@ -1046,7 +1126,7 @@ function remove_comments(&$output)
$output .= $lines[$i] . "\n";
}
if (preg_match('/\*\/$/', preg_quote($lines[$i])))
if (preg_match('#\*\/$#', preg_quote($lines[$i])))
{
$in_comment = false;
}
@ -1103,10 +1183,10 @@ function split_sql_file($sql, $delimiter)
if ($i != $token_count - 1 || strlen($tokens[$i] > 0))
{
// This is the total number of single quotes in the token.
$total_quotes = preg_match_all("/'/", $tokens[$i], $matches);
$total_quotes = preg_match_all("#'#", $tokens[$i], $matches);
// Counts single quotes that are preceded by an odd number of backslashes,
// which means they're escaped quotes.
$escaped_quotes = preg_match_all("/(?<!\\\\)(\\\\\\\\)*\\\\'/", $tokens[$i], $matches);
$escaped_quotes = preg_match_all("#(?<!\\\\)(\\\\\\\\)*\\\\'#", $tokens[$i], $matches);
$unescaped_quotes = $total_quotes - $escaped_quotes;
@ -1132,10 +1212,10 @@ function split_sql_file($sql, $delimiter)
for ($j = $i + 1; (!$complete_stmt && ($j < $token_count)); $j++)
{
// This is the total number of single quotes in the token.
$total_quotes = preg_match_all("/'/", $tokens[$j], $matches);
$total_quotes = preg_match_all("#'#", $tokens[$j], $matches);
// Counts single quotes that are preceded by an odd number of backslashes,
// which means they're escaped quotes.
$escaped_quotes = preg_match_all("/(?<!\\\\)(\\\\\\\\)*\\\\'/", $tokens[$j], $matches);
$escaped_quotes = preg_match_all("#(?<!\\\\)(\\\\\\\\)*\\\\'#", $tokens[$j], $matches);
$unescaped_quotes = $total_quotes - $escaped_quotes;
@ -1170,10 +1250,8 @@ function split_sql_file($sql, $delimiter)
return $output;
}
// Cache moderators, called whenever permissions are
// changed via admin_permissions. Changes of username
// and group names must be carried through for the
// moderators table
// Cache moderators, called whenever permissions are changed via admin_permissions. Changes of username
// and group names must be carried through for the moderators table
function cache_moderators()
{
global $db;

View file

@ -81,7 +81,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
unset($right_id);
}
if (!$row['forum_postable'] && ($row['left_id'] + 1 == $row['right_id']))
if ($row['forum_type'] == FORUM_CAT && ($row['left_id'] + 1 == $row['right_id']))
{
// Non-postable forum with no subforums: don't display
continue;
@ -103,7 +103,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
$forum_rows[$forum_id] = $row;
$forum_ids[] = $forum_id;
if (!$row['forum_postable'] && $row['parent_id'] == $root_data['forum_id'])
if ($row['forum_type'] == FORUM_CAT && $row['parent_id'] == $root_data['forum_id'])
{
$branch_root_id = $forum_id;
}
@ -122,11 +122,30 @@ function display_forums($root_data = '', $display_moderators = TRUE)
$forum_rows[$forum_id]['forum_id_last_post'] = $row['forum_id'];
}
}
elseif ($row['forum_postable'])
elseif ($row['forum_type'] != FORUM_CAT)
{
$subforums[$parent_id]['display'] = ($row['display_on_index']) ? true : false;;
$subforums[$parent_id]['name'][$forum_id] = $row['forum_name'];
// Include subforum topic/post counts in parent counts
$forum_rows[$parent_id]['forum_topics'] += $row['forum_topics'];
$forum_rows[$parent_id]['forum_posts'] += $row['forum_posts'];
// Show most recent last post info on parent if we're a subforum
if (isset($forum_rows[$parent_id]) && $row['forum_last_post_time'] > $forum_rows[$parent_id]['forum_last_post_time'])
{
$forum_rows[$parent_id]['forum_last_post_id'] = $row['forum_last_post_id'];
$forum_rows[$parent_id]['forum_last_post_time'] = $row['forum_last_post_time'];
$forum_rows[$parent_id]['forum_last_poster_id'] = $row['forum_last_poster_id'];
$forum_rows[$parent_id]['forum_last_poster_name'] = $row['forum_last_poster_name'];
$forum_rows[$parent_id]['forum_id_last_post'] = $row['forum_id'];
}
else
{
$forum_rows[$forum_id]['forum_id_last_post'] = $row['forum_id'];
}
}
/*
if (!empty($forum_unread[$forum_id]))
{
@ -186,7 +205,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
{
if ($row['parent_id'] == $root_id)
{
if (!$row['forum_postable'])
if ($row['forum_type'] == FORUM_CAT)
{
$hold = $row;
continue;
@ -243,7 +262,16 @@ function display_forums($root_data = '', $display_moderators = TRUE)
}
else
{
$folder_image = ($forum_unread[$forum_id]) ? 'forum_new' : 'forum';
switch ($row['forum_type'])
{
case FORUM_POST:
$folder_image = ($forum_unread[$forum_id]) ? 'forum_new' : 'forum';
break;
case FORUM_LINK:
$folder_image = 'forum_link';
break;
}
$subforums_list = '';
$l_subforums = '';
@ -286,8 +314,12 @@ function display_forums($root_data = '', $display_moderators = TRUE)
$moderators_list = implode(', ', $forum_moderators[$forum_id]);
}
$l_post_click_count = ($row['forum_type'] == FORUM_LINK) ? 'CLICKS' : 'POSTS';
$post_click_count = ($row['forum_type'] != FORUM_LINK || $row['forum_link_track']) ? $row['forum_posts'] : '';
$template->assign_block_vars('forumrow', array(
'S_IS_CAT' => FALSE,
'S_IS_CAT' => false,
'S_IS_LINK' => ($row['forum_type'] != FORUM_LINK) ? false : true,
'FORUM_IMG' => $row['forum_image'],
'LAST_POST_IMG' => $user->img('icon_post_latest', 'VIEW_LATEST_POST'),
@ -295,7 +327,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
'FORUM_FOLDER_IMG' => $user->img($folder_image, $folder_alt),
'FORUM_NAME' => $row['forum_name'],
'FORUM_DESC' => $row['forum_desc'],
'POSTS' => $row['forum_posts'],
$l_post_click_count => $post_click_count,
'TOPICS' => $row['forum_topics'],
'LAST_POST_TIME' => $last_post_time,
'LAST_POSTER' => $last_poster,
@ -305,15 +337,15 @@ function display_forums($root_data = '', $display_moderators = TRUE)
'L_SUBFORUM_STR' => $l_subforums,
'L_MODERATOR_STR' => $l_moderator,
'L_FORUM_FOLDER_ALT'=> $folder_alt,
'U_LAST_POSTER' => $last_poster_url,
'U_LAST_POST' => $last_post_url,
'U_VIEWFORUM' => 'viewforum.' . $phpEx . $SID . '&amp;f=' . $row['forum_id'])
'U_VIEWFORUM' => ($row['forum_type'] != FORUM_LINK || $row['forum_link_track']) ? 'viewforum.' . $phpEx . $SID . '&amp;f=' . $row['forum_id'] : $row['forum_link'])
);
}
$template->assign_vars(array(
'S_HAS_SUBFORUM' => ($visible_forums) ? TRUE : FALSE,
'S_HAS_SUBFORUM' => ($visible_forums) ? true : false,
'L_SUBFORUM' => ($visible_forums == 1) ? $user->lang['SUBFORUM'] : $user->lang['SUBFORUMS'])
);
}

View file

@ -438,8 +438,12 @@ class userdata extends user
{
global $db, $user;
// Clean up username ... convert any entities into normal
// text, remove excess spaces, then escape it
$username = strtr(trim($username), array_flip(get_html_translation_table(HTML_ENTITIES)));
$username = preg_replace('#[\s]{2,}#', '', $username);
$username = $db->sql_escape($username);
$sql = "SELECT username
FROM " . USERS_TABLE . "
WHERE LOWER(username) = '" . strtolower($username) . "'";
@ -500,7 +504,7 @@ class userdata extends user
if ($email != '')
{
if (preg_match('/^[a-z0-9\.\-_\+]+@[a-z0-9\-_]+\.([a-z0-9\-_]+\.)*?[a-z]+$/is', $email))
if (preg_match('#^[a-z0-9\.\-_\+]+@[a-z0-9\-_]+\.([a-z0-9\-_]+\.)*?[a-z]+$#is', $email))
{
$sql = "SELECT ban_email
FROM " . BANLIST_TABLE;

View file

@ -794,7 +794,8 @@ class fulltext_search
}
}
preg_match_all('/\b([\w]+)\b/', $text, $split_entries);
preg_match_all('#\b([\w]+)\b#', $text, $split_entries);
return array_unique($split_entries[1]);
}
@ -824,6 +825,7 @@ class fulltext_search
WHERE m.post_id = " . intval($post_id) . "
AND w.word_id = m.word_id";
$result = $db->sql_query($sql);
$cur_words = array();
while ($row = $db->sql_fetchrow($result))
{
@ -908,25 +910,33 @@ class fulltext_search
{
$title_match = ($word_in == 'title') ? 1 : 0;
$sql = '';
if (sizeof($word_ary))
{
$sql_in = array();
foreach ($word_ary as $word)
{
$sql .= (($sql != '') ? ', ' : '') . $cur_words[$word_in][$word];
$sql_in[] = $cur_words[$word_in][$word];
}
$sql = "DELETE FROM " . SEARCH_MATCH_TABLE . " WHERE word_id IN ($sql) AND post_id = " . intval($post_id) . " AND title_match = $title_match";
$sql = 'DELETE FROM ' . SEARCH_MATCH_TABLE . '
WHERE word_id IN (' . implode(', ', $sql_in) . ')
AND post_id = ' . intval($post_id) . "
AND title_match = $title_match";
$db->sql_query($sql);
unset($sql_in);
}
}
foreach ($words['add'] as $word_in => $word_ary)
{
$title_match = ( $word_in == 'title' ) ? 1 : 0;
$title_match = ($word_in == 'title') ? 1 : 0;
if (sizeof($word_ary))
{
$sql = "INSERT INTO " . SEARCH_MATCH_TABLE . " (post_id, word_id, title_match) SELECT $post_id, word_id, $title_match FROM " . SEARCH_WORD_TABLE . " WHERE word_text IN (" . implode(', ', preg_replace('#^(.*)$#', '\'\1\'', $word_ary)) . ")";
$sql = 'INSERT INTO ' . SEARCH_MATCH_TABLE . " (post_id, word_id, title_match)
SELECT $post_id, word_id, $title_match
FROM " . SEARCH_WORD_TABLE . '
WHERE word_text IN (' . implode(', ', preg_replace('#^(.*)$#', '\'\1\'', $word_ary)) . ')';
$db->sql_query($sql);
}
}
@ -957,58 +967,66 @@ class fulltext_search
}
// Remove common (> 60% of posts ) words
$result = $db->sql_query("SELECT SUM(forum_posts) AS total_posts FROM " . FORUMS_TABLE);
$sql = "SELECT SUM(forum_posts) AS total_posts
FROM " . FORUMS_TABLE;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if ($row['total_posts'] >= 100)
{
$sql = "SELECT word_id
FROM " . SEARCH_MATCH_TABLE . "
$sql = 'SELECT word_id
FROM ' . SEARCH_MATCH_TABLE . '
GROUP BY word_id
HAVING COUNT(word_id) > " . floor($row['total_posts'] * 0.6);
HAVING COUNT(word_id) > ' . floor($row['total_posts'] * 0.6);
$result = $db->sql_query($sql);
$in_sql = '';
while ($row = $db->sql_fetchrow($result))
if ($row = $db->sql_fetchrow($result))
{
$in_sql .= (( $in_sql != '') ? ', ' : '') . $row['word_id'];
$sql_in = array();
do
{
$sql_in[] = $row['word_id'];
}
while ($row = $db->sql_fetchrow($result));
$sql_in = implode(', ', $sql_in);
$sql = 'UPDATE ' . SEARCH_WORD_TABLE . "
SET word_common = 1
WHERE word_id IN ($sql_in)";
$db->sql_query($sql);
$sql = 'DELETE FROM ' . SEARCH_MATCH_TABLE . "
WHERE word_id IN ($sql_in)";
$db->sql_query($sql);
unset($sql_in);
}
$db->sql_freeresult($result);
if ($in_sql)
{
$sql = "UPDATE " . SEARCH_WORD_TABLE . "
SET word_common = " . TRUE . "
WHERE word_id IN ($in_sql)";
$db->sql_query($sql);
$sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "
WHERE word_id IN ($in_sql)";
$db->sql_query($sql);
}
}
// Remove words with no matches ... this is a potentially nasty query
$sql = "SELECT w.word_id
FROM ( " . SEARCH_WORD_TABLE . " w
LEFT JOIN " . SEARCH_MATCH_TABLE . " m ON w.word_id = m.word_id
$sql = 'SELECT w.word_id
FROM ( ' . SEARCH_WORD_TABLE . ' w
LEFT JOIN ' . SEARCH_MATCH_TABLE . ' m ON w.word_id = m.word_id
AND m.word_id IS NULL
GROUP BY m.word_id";
GROUP BY m.word_id';
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{
$in_sql = '';
$sql_in = array();
do
{
$in_sql .= ', ' . $row['word_id'];
$sql_in[] = $row['word_id'];
}
while ($row = $db->sql_fetchrow($result));
$sql = 'DELETE FROM ' . SEARCH_WORD_TABLE . '
WHERE word_id IN (' . substr($in_sql, 2) . ')';
WHERE word_id IN (' . implode(', ', $sql_in) . ')';
$db->sql_query($sql);
unset($sql_in);
}
$db->sql_freeresult($result);
}

View file

@ -37,11 +37,6 @@
to this source
*/
// Changes for 2.2:
//
// * Allow use of Smarty plug-ins?
// * Reduce number of methods and variables
class Template
{

View file

@ -27,11 +27,12 @@ include($phpbb_root_path . 'common.'.$phpEx);
// Get posted/get info
$mark_read = (isset($_REQUEST['mark'])) ? $_REQUEST['mark'] : '';
// Start session management
$user->start();
$user->setup();
$auth->acl($user->data);
// End session management
// Handle marking posts
if ($mark_read == 'forums')
@ -130,9 +131,13 @@ $template->assign_vars(array(
$page_title = $user->lang['Index'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
//page_header($user->lang['INDEX']);
$template->set_filenames(array(
'body' => 'index_body.html'
));
'body' => 'index_body.html')
);
//page_footer();
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

File diff suppressed because one or more lines are too long

View file

@ -206,11 +206,13 @@ CREATE TABLE phpbb_forums (
forum_parents text,
forum_name varchar(150) NOT NULL,
forum_desc text,
forum_link varchar(200) DEFAULT '' NOT NULL,
forum_link_track tinyint(1) DEFAULT '0' NOT NULL,
forum_password varchar(32) DEFAULT '' NOT NULL,
forum_style tinyint(4) UNSIGNED,
forum_image varchar(50),
forum_image varchar(50) DEFAULT '' NOT NULL,
forum_type tinyint(4) DEFAULT '0' NOT NULL,
forum_status tinyint(4) DEFAULT '0' NOT NULL,
forum_postable tinyint(4) DEFAULT '0' NOT NULL,
forum_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_topics mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_topics_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,

View file

@ -83,6 +83,11 @@ $lang = array_merge($lang, array(
'RANKS' => 'Ranks',
'PRUNE_USERS' => 'Prune users',
'RUN_HOW' => 'When to run',
'RUN_AS_NOW'=> 'Run now',
'RUN_AS_EVT'=> 'Run as Event',
'RUN_AS_CRN'=> 'Run as Cron',
'ADMINISTRATORS' => 'Administrators',
'LOOK_UP_FORUM' => 'Select a Forum',
@ -112,7 +117,6 @@ $lang = array_merge($lang, array(
'LOG_BAN_USER' => '<b>Banned User</b> for reason %s<br />&#187; %s ',
'LOG_BAN_IP' => '<b>Banned ip</b> for reason %s<br />&#187; %s',
'LOG_BAN_EMAIL' => '<b>Banned email</b> for reason %s<br />&#187; %s',
'LOG_UNBAN_USER' => '<b>Unbanned user</b><br />&#187; %s',
'LOG_UNBAN_IP' => '<b>Unbanned ip</b><br />&#187; %s',
'LOG_UNBAN_EMAIL' => '<b>Unbanned email</b><br />&#187; %s',
@ -124,13 +128,17 @@ $lang = array_merge($lang, array(
'LOG_EMAIL_CONFIG' => '<b>Altered email settings</b>',
'LOG_AVATAR_CONFIG' => '<b>Altered avatar settings</b>',
'LOG_AUTH_CONFIG' => '<b>Altered authentication settings</b>',
'LOG_ATTACH_CONFIG' => '<b>Altered attachment settings</b>',
'log_prune_user_deac' => '<b>Users Deactivated</b><br />%s',
'log_prune_user_del_del'=> '<b>Users Pruned and Posts Deleted</b><br />%s',
'log_prune_user_del_anon'=> '<b>Users Pruned and Posts Retained</b><br />%s',
'LOG_RESYNC_STATS' => '<b>Post, topic and user stats reset</b>',
'LOG_RESET_DATE' => '<b>Board start date reset</b>',
'LOG_RESET_ONLINE' => '<b>Most users online reset</b>',
'LOG_ACL_MOD_DEL' => '<b>Removed Moderators</b> from %s<br />&#187; %s',
'LOG_ACL_MOD_ADD' => '<b>Added or edited Moderators</b> from %s<br />&#187; %s',
'LOG_ACL_SUPERMOD_DEL' => '<b>Removed Super Moderators</b><br />&#187; %s',
@ -148,10 +156,19 @@ $lang = array_merge($lang, array(
'LOG_ATTACH_EXTGROUP_ADD' => '<b>Added or edited extension group</b><br />&#187; %s',
'LOG_ATTACH_EXTGROUP_DEL' => '<b>Removed extension group</b><br />&#187; %s',
'RUN_HOW' => 'When to run',
'RUN_AS_NOW'=> 'Run now',
'RUN_AS_EVT'=> 'Run as Event',
'RUN_AS_CRN'=> 'Run as Cron',
'LOG_FORUM_ADD' => '<b>Created new forum</b><br />&#187; %s',
'LOG_FORUM_MOVE_UP' => '<b>Moved forum</b> %s <b>above</b> %s',
'LOG_FORUM_MOVE_DOWN' => '<b>Moved forum</b> %s <b>below</b> %s',
'LOG_FORUM_EDIT' => '<b>Edited forum details</b><br />&#187; %s',
'LOG_FORUM_SYNC' => '<b>Re-synchronised forum</b><br />&#187; %s',
'LOG_FORUM_DEL_POSTS' => '<b>Deleted forum and its messages</b><br />&#187; %s',
'LOG_FORUM_DEL_FORUMS' => '<b>Deleted forum and its subforums</b><br />&#187; %s',
'LOG_FORUM_DEL_POSTS_MOVE_FORUMS' => '<b>Deleted forum and its messages, moved subforums</b> to %s<br />&#187; %s',
'LOG_FORUM_DEL_MOVE_POSTS_FORUMS' => '<b>Deleted forum and its subforums, moved messages</b> to %s<br />&#187; %s',
'LOG_FORUM_DEL_MOVE_POSTS' => '<b>Deleted forum and moved posts </b> to %s<br />&#187; %s',
'LOG_FORUM_DEL_MOVE_FORUMS' => '<b>Deleted forum and moved subforums</b> to %s<br />&#187; %s',
'LOG_FORUM_DEL_POSTS_FORUMS'=> '<b>Deleted forum, its messages and subforums</b><br />&#187; %s',
'LOG_FORUM_DEL_MOVE_POSTS_MOVE_FORUMS' => '<b>Deleted forum, moved posts</b> to %s <b>and subforums</b> to %s<br />&#187; %s',
'WELCOME_PHPBB' => 'Welcome to phpBB',
@ -487,20 +504,21 @@ $lang = array_merge($lang, array(
'ENABLE_EMAIL_EXPLAIN' => 'If this is set to disabled no emails will be sent by the board at all.',
'BOARD_EMAIL_FORM' => 'Users send email via board',
'BOARD_EMAIL_FORM_EXPLAIN' => 'This function keeps email addresses completely private.',
'ADMIN_EMAIL' => 'Admin Email Address',
'ADMIN_EMAIL' => 'Return Email Address',
'ADMIN_EMAIL_EXPLAIN' => 'This will be used as the return address on all emails.',
'EMAIL_SIG' => 'Email Signature',
'EMAIL_SIG_EXPLAIN' => 'This text will be attached to all emails the board sends',
'CONTACT_EMAIL' => 'Abuse email address',
'CONTACT_EMAIL_EXPLAIN' => 'This address will be used whenever a specific contact point is needed, e.g. spam, failures, etc.',
'EMAIL_SIG_EXPLAIN' => 'This text will be attached to all emails the board sends.',
'CONTACT_EMAIL' => 'Contact email address',
'CONTACT_EMAIL_EXPLAIN' => 'This address will be used whenever a specific contact point is needed, e.g. spam, error output, etc.',
'USE_SMTP' => 'Use SMTP Server for email',
'USE_SMTP_EXPLAIN' => 'Say yes if you want or have to send email via a named server instead of the local mail function',
'USE_SMTP_EXPLAIN' => 'Say yes if you want or have to send email via a named server instead of the local mail function.',
'SMTP_SERVER' => 'SMTP Server Address',
'SMTP_PORT' => 'SMTP Server Port',
'SMTP_PORT_EXPLAIN' => 'Only change this if you know your SMTP server is on a different port',
'SMTP_PORT_EXPLAIN' => 'Only change this if you know your SMTP server is on a different port.',
'SMTP_USERNAME' => 'SMTP Username',
'SMTP_USERNAME_EXPLAIN' => 'Only enter a username if your smtp server requires it',
'SMTP_USERNAME_EXPLAIN' => 'Only enter a username if your smtp server requires it.',
'SMTP_PASSWORD' => 'SMTP Password',
'SMTP_PASSWORD_EXPLAIN' => 'Only enter a password if your smtp server requires it',
'SMTP_PASSWORD_EXPLAIN' => 'Only enter a password if your smtp server requires it.',
'BOARD_SETTINGS_EXPLAIN' => 'Here you can determine the basic operation of your board, from the site name through user registration to private messaging.',
@ -582,100 +600,115 @@ $lang = array_merge($lang, array(
'PHP_INFO_EXPLAIN' => 'This page lists information on the version of PHP installed on this server. It includes details of loaded modules, available variables and default settings. This information may be useful when diagnosing problems. Please be aware that some hosting companies will limit what information is displayed here for security reasons. You are advised to not give out any details on this page except when asked by support or other Team Member on the support forums.',
'Forum_admin_explain' => 'In phpBB 2.2 there are no categories, everything is forum based. Each forum can have an unlimited number of sub-forums and you can determine whether each may be posted to or not (i.e. whether it acts like an old category). Here you can add, edit, delete, lock, unlock individual forums as well as set certain additional controls. If your posts and topics have got out of sync you can also resynchronise a forum.',
'Edit_forum' => 'Edit forum',
'Edit_category' => 'Edit category',
'Create_forum' => 'Create new forum',
'Remove' => 'Remove',
'Config_updated' => 'Forum configuration updated successfully',
'EDIT' => 'Edit',
'MOVE_UP' => 'Move up',
'MOVE_DOWN' => 'Move down',
'Resync' => 'Sync',
'Category_name' => 'Category name',
'FORUM_TYPE' => 'Forum Type',
'FORUM_STATUS' => 'Forum Status',
'FORUM_STYLE' => 'Forum Style',
'FORUM_IMAGE' => 'Forum Image',
'Parent' => 'Parent',
'No_parent' => 'No parent',
'Locked' => 'Locked',
'Unlocked' => 'Unlocked',
'General_settings' => 'General settings',
'Forum_settings' => 'Forum settings',
'IS_POSTABLE' => 'Can Post',
'NOT_POSTABLE' => 'Cannot Post',
'ENABLE_TOPIC_ICONS' => 'Enable topic icons',
'DISABLE_POST_COUNT' => 'Disable user post count incrementing',
'FORUM_MODERATED' => 'Enable moderation queue',
'Display_on_index' => 'Display link to forum on index',
'Forum_edit_delete_explain' => 'The form below will allow you to customize all the general board options. For User and Forum configurations use the related links on the left hand side',
'Forum_general' => 'General Forum Settings',
'Forum_name' => 'Forum name',
'Forum_desc' => 'Description',
'Forum_pruning' => 'Auto-pruning',
'prune_freq' => 'Check for topic age every',
'prune_days' => 'Remove topics that have not been posted to in',
'SET_NON_POSTABLE' => 'Set this forum as non-postable and',
'Forum_delete' => 'Delete Forum',
'UPDATE' => 'Update',
'FORUM_ADMIN_EXPLAIN' => 'In phpBB 2.2 there are no categories, everything is forum based. Each forum can have an unlimited number of sub-forums and you can determine whether each may be posted to or not (i.e. whether it acts like an old category). Here you can add, edit, delete, lock, unlock individual forums as well as set certain additional controls. If your posts and topics have got out of sync you can also resynchronise a forum.',
'FORUM_EDIT_EXPLAIN' => 'The form below will allow you to customise this forum. Please note that moderation and post count controls are set via forum permissions for each user or usergroup.',
'FORUM_DELETE' => 'Delete Forum',
'FORUM_DELETE_EXPLAIN' => 'The form below will allow you to delete a forum and decide where you want to put all topics (or forums) it contained.',
'Forum_delete_explain' => 'The form below will allow you to delete a forum and decide where you want to put all topics (or forums) it contained.',
'Move_and_Delete' => 'Move and Delete',
'Move_posts_to' => 'Move posts to',
'Move_subforums_to' => 'Move subforums to',
'Delete_all_posts' => 'Delete all posts',
'Delete_subforums' => 'Delete subforums and associated posts',
'No_destination_forum' => 'You have not specified a forum to move content to',
'FORUM_UPDATED' => 'Forum informations updated successfully',
'Forum_deleted' => 'Forum successfully deleted',
'Click_return_forumadmin' => 'Click %sHere%s to return to Forum Administration',
'EDIT_FORUM' => 'Edit forum',
'CREATE_FORUM' => 'Create new forum',
'REMOVE' => 'Remove',
'EDIT' => 'Edit',
'MOVE_UP' => 'Move up',
'MOVE_DOWN' => 'Move down',
'RESYNC' => 'Sync',
'UPDATE' => 'Update',
'FORUM_SETTINGS' => 'Forum Settings',
'FORUM_GENERAL' => 'General Forum Settings',
'FORUM_TYPE' => 'Forum Type',
'TYPE_FORUM' => 'Forum',
'TYPE_CAT' => 'Category',
'TYPE_LINK' => 'Link',
'FORUM_NAME' => 'Forum Name',
'FORUM_DESC' => 'Description',
'FORUM_DESC_EXPLAIN'=> 'Any markup entered here will displayed as is.',
'FORUM_LINK' => 'Forum Link',
'FORUM_LINK_EXPLAIN'=> 'Full URL to location clicking this forum will take the user.',
'FORUM_LINK_TRACK' => 'Track Link Redirects',
'FORUM_LINK_TRACK_EXPLAIN' => 'Records the number of times a forum link was clicked.',
'FORUM_STATUS' => 'Forum Status',
'FORUM_STYLE' => 'Forum Style',
'FORUM_IMAGE' => 'Forum Image',
'FORUM_IMAGE_EXPLAIN'=> 'Location, relative to the phpBB root directory, of an image to associate with this forum.',
'FORUM_PARENT' => 'Parent Forum',
'NO_PARENT' => 'No Parent',
'LOCKED' => 'Locked',
'UNLOCKED' => 'Unlocked',
'ENABLE_TOPIC_ICONS'=> 'Enable Topic Icons',
'LIST_INDEX' => 'List Forum On Index',
'LIST_INDEX_EXPLAIN'=> 'Displays a link to this forum under the root parent forum on the index.',
'FORUM_AUTO_PRUNE' => 'Enable Auto-Pruning',
'FORUM_AUTO_PRUNE_EXPLAIN' => 'Prunes the forum of topics, set the frequency/age parameters below.',
'AUTO_PRUNE_FREQ' => 'Auto-prune Frequency',
'AUTO_PRUNE_FREQ_EXPLAIN' => 'Time in days between pruning events.',
'AUTO_PRUNE_DAYS' => 'Auto-prune Post Age',
'AUTO_PRUNE_DAYS_EXPLAIN' => 'Number of days since last post after which topic is removed.',
'FORUM_TOPICS_PAGE' => 'Topics Per Page',
'FORUM_TOPICS_PAGE_EXPLAIN' => 'If non-zero this value will override the default topics per page setting.',
'FORUM_PASSWORD' => 'Forum Password',
'FORUM_PASSWORD_EXPLAIN' => 'Defines a password for this forum, use the permission system in preference.',
'FORUM_PASSWORD_CONFIRM' => 'Confirm Forum Password',
'FORUM_PASSWORD_CONFIRM_EXPLAIN' => 'Only needs to be set if a forum password is entered.',
'MOVE_POSTS_TO' => 'Move posts',
'MOVE_SUBFORUMS_TO' => 'Move subforums',
'DELETE_ALL_POSTS' => 'Delete posts',
'DELETE_SUBFORUMS' => 'Delete subforums and posts',
'NO_DESTINATION_FORUM' => 'You have not specified a forum to move content to',
'FORUM_PASSWORD_MISMATCH' => 'The passwords you entered did not match.',
'FORUM_NAME_EMPTY' => 'You must enter a name for this forum.',
'FORUM_DATA_NEGATIVE' => 'Pruning parameters cannot be negative.',
'FORUM_UPDATED' => 'Forum informations updated successfully.',
'REDIRECT_ACL' => 'To set permissions for this forum click %sHERE%s.',
'FORUM_DELETED' => 'Forum successfully deleted',
'ICONS_EXPLAIN' => 'From this page you can add, remove and edit the icons users may add to their topics or posts. These icons are generally displayed next to topic titles on the forum listing, or the post subjects in topic listings. You can also install and create new packages of icons.',
'ICONS_EXPLAIN' => 'From this page you can add, remove and edit the icons users may add to their topics or posts. These icons are generally displayed next to topic titles on the forum listing, or the post subjects in topic listings. You can also install and create new packages of icons.',
'SMILE_EXPLAIN' => 'Smilies or emoticons are typically small, sometimes animated images used to convey an emotion or feeling. From this page you can add, remove and edit the emoticons users can use in their posts and private messages. You can also install and create new packages of smilies.',
'IMPORT_SMILE' => 'Install smilies pak',
'EXPORT_SMILE' => 'Create smilies pak',
'IMPORT_ICONS' => 'Install icons pak',
'EXPORT_ICONS' => 'Create icons pak',
'ADD_SMILE' => 'Add smilie',
'ADD_ICONS' => 'Add icon',
'IMPORT_SMILE' => 'Install smilies pak',
'EXPORT_SMILE' => 'Create smilies pak',
'IMPORT_ICONS' => 'Install icons pak',
'EXPORT_ICONS' => 'Create icons pak',
'ADD_SMILE' => 'Add smilie',
'ADD_ICONS' => 'Add icon',
'SMILE_NOT_DISPLAYED' => 'The following smilies are not displayed on the posting page',
'ICONS_NOT_DISPLAYED' => 'The following icons are not displayed on the posting page',
'EMOTION' => 'Emotion',
'REORDER' => 'Reorder',
'EMOTION' => 'Emotion',
'REORDER' => 'Reorder',
'DISPLAY_ON_POSTING' => 'Display on posting',
'FIRST' => 'First',
'AFTER_SMILE' => 'After %s',
'AFTER_ICONS' => 'After %s',
'SMILE_CONFIG' => 'Smilie configuration',
'SMILE_CODE' => 'Smilie code',
'SMILE_URL' => 'Smilie image file',
'SMILE_HEIGHT' => 'Smilie height',
'SMILE_WIDTH' => 'Smilie width',
'SMILE_ORDER' => 'Smilie order',
'FIRST' => 'First',
'AFTER_SMILE' => 'After %s',
'AFTER_ICONS' => 'After %s',
'SMILE_CONFIG' => 'Smilie configuration',
'SMILE_CODE' => 'Smilie code',
'SMILE_URL' => 'Smilie image file',
'SMILE_HEIGHT' => 'Smilie height',
'SMILE_WIDTH' => 'Smilie width',
'SMILE_ORDER' => 'Smilie order',
'SMILE_EMOTION' => 'Emotion',
'SMILE_ADD' => 'Add a new Smilie',
'SMILE_EDIT' => 'Edit Smilie',
'ICONS_CONFIG' => 'Icon configuration',
'ICONS_URL' => 'Icon image file',
'ICONS_HEIGHT' => 'Icon height',
'ICONS_WIDTH' => 'Icon width',
'ICONS_ORDER' => 'Icon order',
'ICONS_ADD' => 'Add a new Icon',
'ICONS_EDIT' => 'Edit Icon',
'SMILE_ADD' => 'Add a new Smilie',
'SMILE_EDIT' => 'Edit Smilie',
'ICONS_CONFIG' => 'Icon configuration',
'ICONS_URL' => 'Icon image file',
'ICONS_HEIGHT' => 'Icon height',
'ICONS_WIDTH' => 'Icon width',
'ICONS_ORDER' => 'Icon order',
'ICONS_ADD' => 'Add a new Icon',
'ICONS_EDIT' => 'Edit Icon',
'EXPORT_SMILE_EXPLAIN' => 'To create a package of your currently installed smilies, click %sHERE%s to download the emoticons.pak file. Once downloaded create a zip or tgz file containing all of your smilies plus this .pak configuration file.',
'EXPORT_ICONS_EXPLAIN' => 'To create a package of your currently installed icons, click %sHERE%s to download the icons package file. Once downloaded create a zip or tgz file containing all of your icons plus this .pak configuration file.',
'NO_SMILE_EXPORT' => 'You have no smilies with which to create a package.',
'NO_ICONS_EXPORT' => 'You have no icons with which to create a package.',
'WRONG_PAK_TYPE' => 'The specified package does not contain the appropriate data.',
'SELECT_PACKAGE' => 'Select a package file',
'DELETE_ALL' => 'Delete all',
'KEEP_ALL' => 'Keep all',
'REPLACE_MATCHES' => 'Replace matches',
'NO_SMILE_PAK' => 'No smilie packages found.',
'CURRENT_SMILE' => 'Current smilies',
'NO_SMILE_EXPORT' => 'You have no smilies with which to create a package.',
'NO_ICONS_EXPORT' => 'You have no icons with which to create a package.',
'WRONG_PAK_TYPE' => 'The specified package does not contain the appropriate data.',
'SELECT_PACKAGE' => 'Select a package file',
'DELETE_ALL' => 'Delete all',
'KEEP_ALL' => 'Keep all',
'REPLACE_MATCHES' => 'Replace matches',
'NO_SMILE_PAK' => 'No smilie packages found.',
'CURRENT_SMILE' => 'Current smilies',
'SMILE_IMPORT_SUCCESS' => 'The smilies pack was imported successfully',
'NO_ICONS_PAK' => 'No icon packages found.',
'CURRENT_ICONS' => 'Current icons',

View file

@ -115,10 +115,9 @@ $lang = array(
'RETURN_MCP' => 'Click %sHere%s to return to the Moderator Control Panel',
'RETURN_GROUP' => 'Click %sHere%s to return to the Group Control Panel',
'VIEW_MESSAGE' => 'Click %sHere%s to view your message',
'URL_REDIRECT' => 'If your browser does not support meta redirection please click %sHERE%s to be redirected.',
'INFORMATION' => 'Information',
'INFORMATION' => 'Information',
'BOARD_DISABLE' => 'Sorry but this board is currently unavailable',
'BOARD_UNAVAILABLE' => 'Sorry but the board is temporarily unavailable, please try again in a few minutes',
@ -197,14 +196,14 @@ $lang = array(
'Registered_user_total' => 'We have <b>%d</b> registered user',
'Newest_user' => 'The newest registered user is <b>%s%s%s</b>',
'NO_NEW_POSTS' => 'No new posts',
'NEW_POSTS' => 'New posts',
'NEW_POST' => 'New post',
'NO_NEW_POSTS_HOT' => 'No new posts [ Popular ]',
'NEW_POSTS_HOT' => 'New posts [ Popular ]',
'NO_NEW_POSTS' => 'No new posts',
'NEW_POSTS' => 'New posts',
'NEW_POST' => 'New post',
'NO_NEW_POSTS_HOT' => 'No new posts [ Popular ]',
'NEW_POSTS_HOT' => 'New posts [ Popular ]',
'NO_NEW_POSTS_LOCKED' => 'No new posts [ Locked ]',
'NEW_POSTS_LOCKED' => 'New posts [ Locked ]',
'FORUM_LOCKED' => 'Forum Locked',
'NEW_POSTS_LOCKED' => 'New posts [ Locked ]',
'FORUM_LOCKED' => 'Forum Locked',
'POST_STICKY' => 'Sticky',
'POST_ANNOUNCEMENT' => 'Announcement',
@ -214,9 +213,10 @@ $lang = array(
'LIST_USER' => '1 User',
'LIST_USERS' => '%d Users',
'LIST_USERS'=> '%d Users',
'REDIRECTS' => 'Total redirects',
'LOGIN' => 'Login',
'TERMS_USE' => 'Terms of Use',
'PRIVACY' => 'Privacy Policy',
@ -273,7 +273,7 @@ $lang = array(
'NO_FORUM' => 'The forum you selected does not exist',
'NO_TOPICS' => 'There are no topics or posts in this forum.',
'NO_TOPIC' => 'The requested topic does not exist.',
'NO_POSTS' => 'No Posts were found.',
'NO_POSTS' => 'No Posts',
'NO_POST' => 'The requested post does not exist.',
'NO_USER' => 'The requested user does not exist.',
'NO_GROUP' => 'The requested usergroup does not exist.',
@ -295,7 +295,7 @@ $lang = array(
'EMAIL_TOPIC' => 'Email to friend',
'VIEW_NEXT_TOPIC' => 'View next topic',
'VIEW_PREVIOUS_TOPIC' => 'View previous topic',
'VIEW_UNREAD_POST' => 'View first unread topic',
'VIEW_UNREAD_POST' => 'View first unread post',
'NO_NEWER_TOPICS' => 'There are no newer topics in this forum',
'NO_OLDER_TOPICS' => 'There are no older topics in this forum',

View file

@ -49,15 +49,14 @@ include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
// Start session management
$user->start();
$user->setup();
$auth->acl($user->data);
// End session management
//
// Obtain initial var settings
//
$forum_id = (isset($_REQUEST['f'])) ? max(0, intval($_REQUEST['f'])) : 0;
$topic_id = (!empty($_REQUEST['t'])) ? intval($_REQUEST['t']) : 0;
$post_id = (!empty($_REQUEST['p'])) ? intval($_REQUEST['p']) : 0;
@ -75,10 +74,9 @@ $mode = (!empty($_REQUEST['mode'])) ? $_REQUEST['mode'] : '';
$action = (!empty($_GET['action'])) ? $_GET['action'] : '';
$quickmod = (!empty($_REQUEST['quickmod'])) ? TRUE : FALSE;
//
// Check if user did or did not confirm
// If they did not, forward them to the last page they were on
//
if (isset($_POST['cancel']))
{
$redirect = '';
@ -161,17 +159,17 @@ switch ($mode)
case 'make_global':
case 'make_announce':
$acl_src = 'f_announce';
break;
break;
case 'make_sticky':
$acl_src = 'f_sticky';
break;
break;
case 'approve':
case 'unapprove':
case 'disapprove':
$acl_src = 'm_approve';
break;
break;
case 'split':
case 'split_all':
@ -180,7 +178,7 @@ switch ($mode)
$acl_trg = 'f_post';
$return_mode = '<br /><br />' . sprintf($user->lang['RETURN_MCP'], '<a href="mcp.' . $phpEx . $SID . '&amp;mode=split&amp;t=' . $topic_id . $url_extra . '&subject=' . htmlspecialchars($subject) . '">', '</a>');
break;
break;
case 'merge':
case 'merge_posts':
@ -188,16 +186,16 @@ switch ($mode)
$acl_trg = 'm_merge';
$return_mode = '<br /><br />' . sprintf($user->lang['RETURN_MCP'], '<a href="mcp.' . $phpEx . $SID . '&amp;mode=merge&amp;t=' . $topic_id . $url_extra . '">', '</a>');
break;
break;
case 'move':
$acl_src = 'm_move';
$acl_trg = 'f_post';
break;
break;
case 'viewlogs':
$acl_src = array('m_', 'a_general');
break;
$acl_src = array('m_', 'a_');
break;
case 'fork':
$acl_trg = 'f_post';
@ -206,12 +204,17 @@ switch ($mode)
// Check destination forum or topic if applicable
if ($to_topic_id > 0)
{
$result = $db->sql_query('SELECT * FROM ' . TOPICS_TABLE . ' WHERE topic_id = ' . $to_topic_id);
$sql = 'SELECT *
FROM ' . TOPICS_TABLE . '
WHERE topic_id = ' . $to_topic_id;
$result = $db->sql_query($sql);
if (!$row = $db->sql_fetchrow($result))
{
trigger_error($user->lang['Topic_not_exist'] . $return_mode);
}
$db->sql_freeresult($result);
if (!isset($topic_data[$to_topic_id]))
{
$topic_data[$to_topic_id] = $row;
@ -224,12 +227,16 @@ if ($to_forum_id > 0)
{
if (!isset($forum_data[$to_forum_id]))
{
$result = $db->sql_query('SELECT * FROM ' . FORUMS_TABLE . ' WHERE forum_id = ' . $to_forum_id);
$sql = 'SELECT *
FROM ' . FORUMS_TABLE . '
WHERE forum_id = ' . $to_forum_id;
$result = $db->sql_query($sql);
if (!$row = $db->sql_fetchrow($result))
{
trigger_error($user->lang['FORUM_NOT_EXIST'] . $return_mode);
}
$db->sql_freeresult($result);
$forum_data[$to_forum_id] = $row;
}
@ -333,10 +340,12 @@ if (count($forum_id_list))
// Using isset() rather than !empty() because of the jumpbox having f="0" for "All forums"
list($void, $forum_id) = each($forum_id_list);
}
if (!$topic_id && count($topic_id_list) == 1)
{
list($void, $topic_id) = each($topic_id_list);
}
if (!$post_id && count($post_id_list) == 1)
{
list($void, $post_id) = each($post_id_list);
@ -409,7 +418,7 @@ $tabs[] = array(
'url' => $mcp_url . '&amp;mode=viewlogs'
);
if ($forum_id && $forum_data[$forum_id]['forum_postable'] && $auth->acl_get('m_', $forum_id))
if ($forum_id && $forum_data[$forum_id]['forum_type'] == FORUM_POST && $auth->acl_get('m_', $forum_id))
{
$tabs[] = array(
'mode' => 'forum_view',
@ -455,7 +464,7 @@ if (!$mode)
{
$mode = 'topic_view';
}
elseif ($forum_id && $forum_data[$forum_id]['forum_postable'])
elseif ($forum_id && $forum_data[$forum_id]['forum_type'] == FORUM_POST)
{
$mode = 'forum_view';
}
@ -493,8 +502,8 @@ foreach ($tabs as $tab)
$template->assign_block_vars('tab', array(
'S_IS_SELECTED' => ($tab['mode'] == $mode) ? TRUE : FALSE,
'NAME' => $tab['title'],
'U_LINK' => $tab['url']
));
'U_LINK' => $tab['url'])
);
}
//
@ -611,7 +620,7 @@ switch ($mode)
}
else
{
if (!$forum_data[$to_forum_id]['forum_postable'])
if ($forum_data[$to_forum_id]['forum_type'] == FORUM_CAT)
{
trigger_error($user->lang['FORUM_NOT_POSTABLE'] . $return_mcp);
}
@ -760,7 +769,7 @@ switch ($mode)
}
else
{
if (!$forum_data[$to_forum_id]['forum_postable'])
if ($forum_data[$to_forum_id]['forum_type'] == FORUM_CAT)
{
trigger_error($user->lang['FORUM_NOT_POSTABLE'] . $return_mcp);
}
@ -861,22 +870,18 @@ switch ($mode)
}
}
$return_forum = sprintf($user->lang['RETURN_FORUM'], "<a href=\"viewforum.$phpEx$SID&amp;f=$forum_id\">", '</a>');
$return_topic = sprintf($user->lang['RETURN_TOPIC'], "<a href=\"viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id&amp;start=$start\">", '</a>');
$template->assign_vars(array(
'META' => "<meta http-equiv=\"refresh\" content=\"3;url=viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id&amp;start=$start\">"
));
add_log('mod', $forum_id, $topic_id, 'logm_' . $mode);
trigger_error($user->lang['TOPIC_TYPE_CHANGED'] . '<br /><br />' . $return_topic . '<br /><br />' . $return_forum);
break;
meta_refresh(3, "viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id&amp;start=$start");
$message = $user->lang['TOPIC_TYPE_CHANGED'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], "<a href=\"viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id&amp;start=$start\">", '</a>') . '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], "<a href=\"viewforum.$phpEx$SID&amp;f=$forum_id\">", '</a>');
trigger_error($message);
break;
case 'disapprove':
// NOTE: what happens if the user disapproves the first post of the topic? Answer: the topic is deleted
// NOTE: what happens if the user disapproves the first post of the topic? Answer: the topic is deleted
$redirect_page = "mcp.$phpEx$SID&amp;f=$forum_id";
$l_redirect = sprintf($user->lang['RETURN_MCP'], '<a href="mcp.' . $phpEx . $SID . '&amp;f=' . $forum_id . '">', '</a>');
$l_redirect = sprintf($user->lang['RETURN_MCP'], "<a href=\"mcp.$phpEx$SID&amp;f=$forum_id\">", '</a>');
if (!count($post_id_list))
{
@ -897,6 +902,7 @@ switch ($mode)
$post_ids[] = $p_id;
}
}
foreach ($post_id_list as $p_id)
{
if (!in_array($topic_ids, $post_data[$p_id]['topic_id']))
@ -904,21 +910,21 @@ switch ($mode)
$post_ids[] = $p_id;
}
}
if (count($topic_ids))
{
delete_topics('topic_id', $topic_ids);
}
if (count($post_ids))
{
delete_posts('post_id', $post_ids);
}
$template->assign_vars(array(
'META' => '<meta http-equiv="refresh" content="3;url=' . $redirect_page . '">')
);
// TODO: warn the user when post is disapproved
meta_refresh(3, $redirect_page);
$msg = (count($post_id_list) == 1) ? $user->lang['POST_REMOVED'] : $user->lang['POSTS_REMOVED'];
trigger_error($msg . '<br /><br />' . $l_redirect);
}
@ -934,13 +940,13 @@ switch ($mode)
mcp_header('confirm_body.html');
$template->assign_vars(array(
'MESSAGE_TITLE' => $user->lang['CONFIRM'],
'MESSAGE_TEXT' => (count($post_id_list) == 1) ? $user->lang['CONFIRM_DELETE_POST'] : $user->lang['CONFIRM_DELETE_POSTS'],
'MESSAGE_TITLE' => $user->lang['CONFIRM'],
'MESSAGE_TEXT' => (count($post_id_list) == 1) ? $user->lang['CONFIRM_DELETE_POST'] : $user->lang['CONFIRM_DELETE_POSTS'],
'S_CONFIRM_ACTION' => "mcp.$phpEx$SID&amp;mode=disapprove",
'S_HIDDEN_FIELDS' => $hidden_fields
));
break;
'S_CONFIRM_ACTION' => "mcp.$phpEx$SID&amp;mode=disapprove",
'S_HIDDEN_FIELDS' => $hidden_fields)
);
break;
case 'approve':
case 'unapprove':
@ -979,7 +985,7 @@ switch ($mode)
add_log('mod', $forum_id, $post_data[$post_id]['topic_id'], $logm_mode, $post_id);
//NOTE: hey, who removed the enable_post_count field?! lol ^ ^
//NOTE: hey, who removed the enable_post_count field?! lol ^ ^
$forum_data[$post_data[$post_id]['forum_id']]['enable_post_count'] = 1;
if ($forum_data[$post_data[$post_id]['forum_id']]['enable_post_count'])
{
@ -1042,6 +1048,7 @@ switch ($mode)
$resync_count[$post_count] = array($user_id);
}
}
foreach ($resync_count as $post_count => $user_list)
{
$sql = 'UPDATE ' . USERS_TABLE . "
@ -1580,7 +1587,7 @@ switch ($mode)
{
trigger_error($user->lang['SELECT_DESTINATION_FORUM'] . $return_split);
}
if (!$forum_data[$to_forum_id]['forum_postable'])
if ($forum_data[$to_forum_id]['forum_type'] == FORUM_CAT)
{
trigger_error($user->lang['FORUM_NOT_POSTABLE'] . $return_split);
}
@ -2013,7 +2020,7 @@ function mcp_jumpbox($action, $acl_list = 'f_list', $forum_id = false, $enable_s
{
global $auth, $template, $user, $db, $nav_links, $phpEx, $SID;
$sql = 'SELECT forum_id, forum_name, forum_postable, left_id, right_id
$sql = 'SELECT forum_id, forum_name, forum_type, left_id, right_id
FROM ' . FORUMS_TABLE . '
ORDER BY left_id ASC';
$result = $db->sql_query($sql, 120);
@ -2022,18 +2029,18 @@ function mcp_jumpbox($action, $acl_list = 'f_list', $forum_id = false, $enable_s
$padding = $forum_list = $holding = '';
while ($row = $db->sql_fetchrow($result))
{
if (!$row['forum_postable'] && ($row['left_id'] + 1 == $row['right_id']))
if ($row['forum_type'] == FORUM_CAT && ($row['left_id'] + 1 == $row['right_id']))
{
// Non-postable forum with no subforums, don't display
continue;
}
if (!$auth->acl_gets('f_list', $row['forum_id']))
if (!$auth->acl_get('f_list', $row['forum_id']))
{
// if the user does not have permissions to list this forum skip
continue;
}
if (!$row['forum_postable'] || !$auth->acl_gets($acl_list, $row['forum_id']))
if ($row['forum_type'] == FORUM_CAT || !$auth->acl_gets($acl_list, $row['forum_id']))
{
$row['forum_id'] = -1;
}

View file

@ -77,7 +77,7 @@ $topic_validate = false;
$post_validate = false;
// Easier validation
$forum_fields = array('forum_name' => 's', 'parent_id' => 'i', 'forum_parents' => 's', 'forum_status' => 'i', 'forum_postable' => 'i', 'enable_icons' => 'i');
$forum_fields = array('forum_name' => 's', 'parent_id' => 'i', 'forum_parents' => 's', 'forum_status' => 'i', 'forum_type' => 'i', 'enable_icons' => 'i');
$topic_fields = array('topic_status' => 'i', 'topic_first_post_id' => 'i', 'topic_last_post_id' => 'i', 'topic_type' => 'i', 'topic_title' => 's', 'poll_last_vote' => 'i', 'poll_start' => 'i', 'poll_title' => 's', 'poll_max_options' => 'i', 'poll_length' => 'i');
@ -237,8 +237,8 @@ if ($sql != '')
// Get Attachment Data
$message_parser->attachment_data = (isset($_POST['attachment_data'])) ? $_POST['attachment_data'] : array();
if (($post_attachment) && (!$submit) && (!$refresh) && (!$preview) && ($mode == 'edit'))
if ($post_attachment && !$submit && !$refresh && !$preview && $mode == 'edit')
{
$sql = 'SELECT d.*
FROM ' . ATTACHMENTS_TABLE . ' a, ' . ATTACHMENTS_DESC_TABLE . ' d
@ -252,7 +252,7 @@ if ($sql != '')
$db->sql_freeresult($result);
}
if (($poster_id == ANONYMOUS) || (!$poster_id))
if ($poster_id == ANONYMOUS || !$poster_id)
{
$username = ($post_validate) ? trim($post_username) : '';
}
@ -289,47 +289,47 @@ if ($mode != 'post' && $user->data['user_id'] != ANONYMOUS)
// Collect general Permissions to be used within the complete page
$perm = array(
'm_lock' => $auth->acl_get('m_lock', $forum_id),
'm_edit' => $auth->acl_get('m_edit', $forum_id),
'm_delete' => $auth->acl_get('m_delete', $forum_id),
'm_lock' => $auth->acl_get('m_lock', $forum_id),
'm_edit' => $auth->acl_get('m_edit', $forum_id),
'm_delete' => $auth->acl_get('m_delete', $forum_id),
'u_delete' => $auth->acl_get('f_delete', $forum_id),
'u_delete' => $auth->acl_get('f_delete', $forum_id),
'f_attach' => $auth->acl_get('f_attach', $forum_id),
'f_news' => $auth->acl_get('f_news', $forum_id),
'f_announce' => $auth->acl_get('f_announce', $forum_id),
'f_sticky' => $auth->acl_get('f_sticky', $forum_id),
'f_attach' => $auth->acl_get('f_attach', $forum_id),
'f_news' => $auth->acl_get('f_news', $forum_id),
'f_announce' => $auth->acl_get('f_announce', $forum_id),
'f_sticky' => $auth->acl_get('f_sticky', $forum_id),
'f_ignoreflood' => $auth->acl_get('f_ignoreflood', $forum_id),
'f_sigs' => $auth->acl_get('f_sigs', $forum_id),
'f_save' => $auth->acl_get('f_save', $forum_id)
'f_sigs' => $auth->acl_get('f_sigs', $forum_id),
'f_save' => $auth->acl_get('f_save', $forum_id)
);
if ( (!$auth->acl_get('f_' . $mode, $forum_id)) && ($forum_postable) )
if (!$auth->acl_get('f_' . $mode, $forum_id) && $forum_type == FORUM_POST)
{
trigger_error($user->lang['USER_CANNOT_' . strtoupper($mode)]);
}
// Forum/Topic locked?
if ( ($forum_status == ITEM_LOCKED || $topic_status == ITEM_LOCKED) && !$perm['m_edit'])
if (($forum_status == ITEM_LOCKED || $topic_status == ITEM_LOCKED) && !$perm['m_edit'])
{
$message = ($forum_status == ITEM_LOCKED) ? 'FORUM_LOCKED' : 'TOPIC_LOCKED';
trigger_error($user->lang[$message]);
}
// Can we edit this post?
if ( ($mode == 'edit' || $mode == 'delete') && !empty($config['edit_time']) && $post_time < time() - intval($config['edit_time']) && !$perm['m_edit'])
if (($mode == 'edit' || $mode == 'delete') && !$perm['m_edit'] && $config['edit_time'] && $post_time > time() - $config['edit_time'])
{
trigger_error($user->lang['CANNOT_EDIT_TIME']);
}
// Do we want to edit our post ?
if ( ($mode == 'edit') && (!$perm['m_edit']) && ($user->data['user_id'] != $poster_id))
if ($mode == 'edit' && !$perm['m_edit'] && $user->data['user_id'] != $poster_id)
{
trigger_error($user->lang['USER_CANNOT_EDIT']);
}
// Is edit posting locked ?
if ( ($mode == 'edit') && ($post_edit_locked) && (!$auth->acl_gets('m_', 'a_', $forum_id)) )
if ($mode == 'edit' && $post_edit_locked && !$auth->acl_get('m_', $forum_id))
{
trigger_error($user->lang['CANNOT_EDIT_POST_LOCKED']);
}
@ -340,7 +340,7 @@ if ($mode == 'edit')
}
// Delete triggered ?
if ( ($mode == 'delete') && ((($poster_id == $user->data['user_id']) && ($user->data['user_id'] != ANONYMOUS) && ($perm['u_delete']) && ($post_id == $topic_last_post_id)) || ($perm['m_delete'])) )
if ($mode == 'delete' && (($poster_id == $user->data['user_id'] && $user->data['user_id'] != ANONYMOUS && $perm['u_delete'] && $post_id == $topic_last_post_id) || $perm['m_delete']))
{
// Do we need to confirm ?
if ($confirm)
@ -374,8 +374,9 @@ if ( ($mode == 'delete') && ((($poster_id == $user->data['user_id']) && ($user->
$forum_update_sql .= 'forum_topics = forum_topics - 1, forum_topics_real = forum_topics_real - 1';
}
// TODO: delete common words... maybe just call search_tidy ?
// $search->del_words($post_id);
// TODO: delete common words... maybe just call search_tidy ? <- No, search tidy is intensive and should be
// called irregularly (at present).
// $search->del_words($post_id);
// Sync last post informations
$db->sql_transaction();
@ -399,11 +400,11 @@ if ( ($mode == 'delete') && ((($poster_id == $user->data['user_id']) && ($user->
$db->sql_freeresult($result);
// If Post is first post, but not the only post... make next post the topic starter one. ;)
if (($post_data['topic_first_post_id'] != $post_data['topic_last_post_id']) && ($post_id == $post_data['topic_first_post_id']))
if ($post_data['topic_first_post_id'] != $post_data['topic_last_post_id'] && $post_id == $post_data['topic_first_post_id'])
{
$topic_sql = array(
'topic_first_post_id' => intval($row['post_id']),
'topic_first_poster_name' => ( intval($row['poster_id']) == ANONYMOUS) ? trim($row['post_username']) : trim($row['username'])
'topic_first_post_id' => intval($row['post_id']),
'topic_first_poster_name' => ($row['poster_id'] == ANONYMOUS) ? trim($row['post_username']) : trim($row['username'])
);
}
@ -446,18 +447,17 @@ if ( ($mode == 'delete') && ((($poster_id == $user->data['user_id']) && ($user->
if ($post_data['topic_first_post_id'] == $post_data['topic_last_post_id'])
{
$meta_info = '<meta http-equiv="refresh" content="5; url=viewforum.' . $phpEx . $SID . '&amp;f=' . $forum_id . '">';
$message = $user->lang['DELETED'];
}
else
{
$meta_info = '<meta http-equiv="refresh" content="5; url=viewtopic.' . $phpEx . $SID . '&amp;f=' . $forum_id . '&amp;t=' . $topic_id . '&amp;p=' . $post_data['next_post_id'] . '#' . $post_data['next_post_id'] . '">';
$message = $user->lang['DELETED'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="viewtopic.' . $phpEx . $SID . '&amp;f=' . $forum_id . '&amp;t=' . $topic_id . '&amp;p=' . $post_data['next_post_id'] . '#' . $post_data['next_post_id'] . '">', '</a>');
}
$template->assign_vars(array(
'META' => $meta_info)
);
meta_refresh(4, $meta_info);
$message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="viewforum.' . $phpEx . $SID . '&amp;f=' . $forum_id . '">', '</a>');
trigger_error($message);
@ -474,23 +474,23 @@ if ( ($mode == 'delete') && ((($poster_id == $user->data['user_id']) && ($user->
);
$template->assign_vars(array(
'MESSAGE_TITLE' => $user->lang['DELETE_MESSAGE'],
'MESSAGE_TEXT' => $user->lang['CONFIRM_DELETE'],
'MESSAGE_TITLE' => $user->lang['DELETE_MESSAGE'],
'MESSAGE_TEXT' => $user->lang['CONFIRM_DELETE'],
'S_CONFIRM_ACTION' => $phpbb_root_path . 'posting.' . $phpEx . $SID,
'S_HIDDEN_FIELDS' => $s_hidden_fields)
'S_CONFIRM_ACTION' => $phpbb_root_path . 'posting.' . $phpEx . $SID,
'S_HIDDEN_FIELDS' => $s_hidden_fields)
);
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
}
}
if ( ($mode == 'delete') && ( ($poster_id != $user->data['user_id']) && (!$perm['u_delete'])) )
if ($mode == 'delete' && $poster_id != $user->data['user_id'] && !$perm['u_delete'])
{
trigger_error($user->lang['DELETE_OWN_POSTS']);
}
if ( ($mode == 'delete') && ( ($poster_id == $user->data['user_id']) && ($perm['u_delete'])) && ($post_id != $topic_last_post_id))
if ($mode == 'delete' && $poster_id == $user->data['user_id'] && $perm['u_delete'] && $post_id != $topic_last_post_id)
{
trigger_error($user->lang['CANNOT_DELETE_REPLIED']);
}
@ -500,7 +500,7 @@ if ($mode == 'delete')
trigger_error('USER_CANNOT_DELETE');
}
if (($submit) || ($preview) || ($refresh))
if ($submit || $preview || $refresh)
{
$topic_cur_post_id = (isset($_POST['topic_cur_post_id'])) ? intval($_POST['topic_cur_post_id']) : false;
$subject = (!empty($_POST['subject'])) ? trim(htmlspecialchars(strip_tags($_POST['subject']))) : '';
@ -534,7 +534,7 @@ if (($submit) || ($preview) || ($refresh))
$poll_delete = (isset($_POST['poll_delete'])) ? true : false;
if ( ($poll_delete) && ($mode == 'edit' && !empty($poll_options) && ((empty($poll_last_vote) && $poster_id == $user->data['user_id'] && $perm['u_delete']) || $perm['m_delete'])) )
if ($poll_delete && (($mode == 'edit' && !empty($poll_options) && empty($poll_last_vote) && $poster_id == $user->data['user_id'] && $perm['u_delete']) || $perm['m_delete']))
{
// Delete Poll
$sql = "DELETE FROM " . POLL_OPTIONS_TABLE . "
@ -553,7 +553,9 @@ if (($submit) || ($preview) || ($refresh))
'poll_max_options' => 0
);
$sql = 'UPDATE ' . TOPICS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $topic_sql) . ' WHERE topic_id = ' . $topic_id;
$sql = 'UPDATE ' . TOPICS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $topic_sql) . '
WHERE topic_id = ' . $topic_id;
$db->sql_query($sql);
$poll_title = '';
@ -575,7 +577,7 @@ if (($submit) || ($preview) || ($refresh))
// If replying/quoting and last post id has changed
// give user option of continuing submit or return to post
// notify and show user the post made between his request and the final submit
if ( ($mode == 'reply' || $mode == 'quote') && ($topic_cur_post_id != $topic_last_post_id) )
if (($mode == 'reply' || $mode == 'quote') && $topic_cur_post_id != $topic_last_post_id)
{
$template->assign_vars(array(
'S_POST_REVIEW' => true)
@ -662,7 +664,7 @@ if (($submit) || ($preview) || ($refresh))
$err_msg .= ((!empty($err_msg)) ? '<br />' : '') . $result;
}
if (($mode != 'edit') && (!$preview) && (!$refresh) && (!$perm['f_ignoreflood']))
if ($mode != 'edit' && !$preview && !$refresh && !$perm['f_ignoreflood'])
{
// Flood check
$where_sql = ($user->data['user_id'] == ANONYMOUS) ? "poster_ip = '$user->ip'" : 'poster_id = ' . $user->data['user_id'];
@ -693,7 +695,7 @@ if (($submit) || ($preview) || ($refresh))
}
// Parse subject
if ( ($subject == '') && ($mode == 'post' || ($mode == 'edit' && $topic_first_post_id == $post_id)))
if ($subject == '' && ($mode == 'post' || ($mode == 'edit' && $topic_first_post_id == $post_id)))
{
$err_msg .= ((!empty($err_msg)) ? '<br />' : '') . $user->lang['EMPTY_SUBJECT'];
}

View file

@ -24,10 +24,21 @@
<td class="cat" colspan="2" height="28"><a class="cattitle" href="{forumrow.U_VIEWFORUM}">{forumrow.FORUM_NAME}</a></td>
<td class="rowpic" colspan="3" align="right">&nbsp;</td>
</tr>
<!-- ELSEIF forumrow.S_IS_LINK -->
<tr>
<td class="row1" width="50" height="50" align="center" valign="middle">{forumrow.FORUM_FOLDER_IMG}</td>
<td class="row1" height="50"><a class="forumlink" href="{forumrow.U_VIEWFORUM}">{forumrow.FORUM_NAME}</a><br />
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td><span class="gensmall">{forumrow.FORUM_DESC}</span></td>
</tr>
</table></td>
<td class="row2" colspan="3" align="center" valign="middle" height="50"><!-- IF forumrow.CLICKS neq '' --><span class="gensmall">{L_REDIRECTS}: {forumrow.CLICKS}</span><!-- ENDIF --></td>
</tr>
<!-- ELSE -->
<tr>
<td class="row1" width="50" height="50" align="center" valign="middle">{forumrow.FORUM_FOLDER_IMG}</td>
<td class="row1" width="100%" height="50" valign="top"><a class="forumlink" href="{forumrow.U_VIEWFORUM}">{forumrow.FORUM_NAME}</a><br />
<td class="row1" width="100%" height="50" valign="top"><a class="forumlink" href="{forumrow.U_VIEWFORUM}">{forumrow.FORUM_NAME}</a><br />
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td><span class="gensmall">{forumrow.FORUM_DESC}</span></td>

View file

@ -29,7 +29,7 @@ function checkForm()
alert('{L_EMPTY_MESSAGE}');
return false;
} else {
bbstyle(-1);
// document.post.post.disabled = true;
return true;
}
}

View file

@ -8,7 +8,19 @@
<!-- BEGIN forumrow -->
<!-- IF forumrow.S_IS_CAT -->
<tr>
<td class="cat" colspan="5" height="28"><a class="cattitle" href="{forumrow.U_VIEWFORUM}">{forumrow.FORUM_NAME}</a></td>
<td class="cat" colspan="2" height="28"><a class="cattitle" href="{forumrow.U_VIEWFORUM}">{forumrow.FORUM_NAME}</a></td>
<td class="rowpic" colspan="3" align="right">&nbsp;</td>
</tr>
<!-- ELSEIF forumrow.S_IS_LINK -->
<tr>
<td class="row1" width="50" height="50" align="center" valign="middle">{forumrow.FORUM_FOLDER_IMG}</td>
<td class="row1" height="50"><a class="forumlink" href="{forumrow.U_VIEWFORUM}">{forumrow.FORUM_NAME}</a><br />
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td><span class="gensmall">{forumrow.FORUM_DESC}</span></td>
</tr>
</table></td>
<td class="row2" colspan="3" align="center" valign="middle" height="50"><!-- IF forumrow.CLICKS neq '' --><span class="gensmall">{L_REDIRECTS}: {forumrow.CLICKS}</span><!-- ENDIF --></td>
</tr>
<!-- ELSE -->
<tr>
@ -21,7 +33,7 @@
</table><span class="gensmall"><!-- IF forumrow.MODERATORS --><b>{forumrow.L_MODERATOR_STR}:</b> {forumrow.MODERATORS}<br /><!-- ENDIF --><!-- IF forumrow.SUBFORUMS --><br /><b>{forumrow.L_SUBFORUM_STR}</b> {forumrow.SUBFORUMS}<!-- ENDIF --></span></td>
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{forumrow.TOPICS}</span></td>
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{forumrow.POSTS}</span></td>
<td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"><!-- IF forumrow.LAST_POST_TIME --><span class="gensmall">{forumrow.LAST_POST_TIME}<br /><!-- IF forumrow.U_LAST_POSTER --><a href="{forumrow.U_LAST_POSTER}">{forumrow.LAST_POSTER}</a><!-- ELSE -->{forumrow.LAST_POSTER}<!-- ENDIF --> <a href="{forumrow.U_LAST_POST}">{forumrow.LAST_POST_IMG}</a></span><!-- ELSE -->{L_NO_POSTS}<!-- ENDIF --></td>
<td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"><span class="gensmall"><!-- IF forumrow.LAST_POST_TIME -->{forumrow.LAST_POST_TIME}<br /><!-- IF forumrow.U_LAST_POSTER --><a href="{forumrow.U_LAST_POSTER}">{forumrow.LAST_POSTER}</a><!-- ELSE -->{forumrow.LAST_POSTER}<!-- ENDIF --> <a href="{forumrow.U_LAST_POST}">{forumrow.LAST_POST_IMG}</a><!-- ELSE -->{L_NO_POSTS}<!-- ENDIF --></span></td>
</tr>
<!-- ENDIF -->
<!-- END forumrow -->

View file

@ -23,7 +23,7 @@
<td class="cat" colspan="2" height="28"><table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td><span class="nav">&nbsp;<a href="{U_PRINT_TOPIC}" title="{L_PRINT_TOPIC}">{L_PRINT_TOPIC}</a> :: <a href="{U_EMAIL_TOPIC}" title="{L_EMAIL_TOPIC}">{L_EMAIL_TOPIC}</a></span></td>
<td align="right"><span class="nav"><a href="{U_VIEW_OLDER_TOPIC}">{L_VIEW_PREVIOUS_TOPIC}</a> :: <a href="{U_VIEW_NEWER_TOPIC}">{L_VIEW_NEXT_TOPIC}</a>&nbsp;</span></td>
<td align="right"><span class="nav"><a href="{U_VIEW_UNREAD_POST}">{L_VIEW_UNREAD_POST}</a> :: <a href="{U_VIEW_OLDER_TOPIC}">{L_VIEW_PREVIOUS_TOPIC}</a> :: <a href="{U_VIEW_NEWER_TOPIC}">{L_VIEW_NEXT_TOPIC}</a>&nbsp;</span></td>
</tr>
</table></td>
</tr>

View file

@ -89,23 +89,47 @@ else
}
$result = $db->sql_query($sql);
if (!$forum_data = $db->sql_fetchrow($result))
if (!($forum_data = $db->sql_fetchrow($result)))
{
trigger_error('NO_FORUM');
}
$db->sql_freeresult($result);
// Is this forum a link? ... User got here either because the
// number of clicks is being tracked or they guessed the id
if ($forum_data['forum_link'])
{
// Does it have click tracking enabled?
if ($forum_data['forum_link_track'])
{
$sql = 'UPDATE ' . FORUMS_TABLE . '
SET forum_posts = forum_posts + 1';
$db->sql_query($sql);
}
redirect($forum_data['forum_link']);
}
// Configure style, language, etc.
$user->setup(false, $forum_data['forum_style']);
// Does a password exist for this forum? If so do the necessary
if ($forum_data['forum_password'])
{
}
// Permissions check
if (!$auth->acl_gets('f_read', $forum_id))
{
if ($user->data['user_id'] != ANONYMOUS)
{
trigger_error('SORRY_AUTH_READ');
trigger_error($user->lang['SORRY_AUTH_READ']);
}
login_box(preg_replace('#.*?([a-z]+?\.' . $phpEx . '.*?)$#i', '\1', htmlspecialchars($_SERVER['REQUEST_URI'])), '', $user->lang['LOGIN_VIEWFORUM']);
@ -132,7 +156,7 @@ else
// Output forum listing if it is postable
if ($forum_data['forum_postable'])
if ($forum_data['forum_type'] == FORUM_POST)
{
// Handle marking posts
if ($mark_read == 'topics')
@ -215,6 +239,13 @@ if ($forum_data['forum_postable'])
$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
// Is a forum specific topic count required?
if ($forum_data['forum_topics_per_page'])
{
$config['topics_per_page'] = $forum_data['forum_topics_per_page'];
}
// Basic pagewide vars
$post_alt = (intval($forum_data['forum_status']) == ITEM_LOCKED) ? 'FORUM_LOCKED' : 'POST_NEW_TOPIC';
@ -242,10 +273,10 @@ if ($forum_data['forum_postable'])
'L_NO_TOPICS' => ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->lang['POST_FORUM_LOCKED'] : $user->lang['NO_TOPICS'],
'S_IS_POSTABLE' => TRUE,
'S_SELECT_SORT_DIR' => $s_sort_dir,
'S_SELECT_SORT_KEY' => $s_sort_key,
'S_SELECT_SORT_DAYS' => $s_limit_days,
'S_IS_POSTABLE' => TRUE,
'S_SELECT_SORT_DIR' => $s_sort_dir,
'S_SELECT_SORT_KEY' => $s_sort_key,
'S_SELECT_SORT_DAYS' => $s_limit_days,
'S_TOPIC_ICONS' => ($forum_data['enable_icons']) ? true : false,
'S_WATCH_FORUM' => $s_watching_forum,
'S_FORUM_ACTION' => "viewforum.$phpExx$SIDx&amp;f=$forum_id&amp;start=$start",
@ -266,6 +297,7 @@ if ($forum_data['forum_postable'])
$total_topics = 0;
$row_ary = array();
// TODO - Oracle support
$sql_approved = ($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1';
$sql_tracking = (($config['load_db_lastread'] || $config['load_db_track']) && $user->data['user_id'] != ANONYMOUS) ? 'LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id'] . ')' : '';
$sql_select = (($config['load_db_lastread'] || $config['load_db_track']) && $user->data['user_id'] != ANONYMOUS) ? ', tt.mark_type, tt.mark_time' : '';
@ -378,6 +410,7 @@ if ($forum_data['forum_postable'])
$folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS');
// Posted image?
if (!empty($row['mark_type']))
{
$folder_img .= '_posted';
@ -466,7 +499,7 @@ if ($forum_data['forum_postable'])
'S_ROW_COUNT' => $i,
'S_TOPIC_TYPE_SWITCH' => ($s_type_switch == $s_type_switch_test) ? -1 : $s_type_switch_test,
'S_TOPIC_TYPE' => $row['topic_type'],
'S_USER_POSTED' => ($row['lastread_type'] == LASTREAD_POSTED) ? true : false,
'S_USER_POSTED' => (!empty($row['mark_type'])) ? true : false,
'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_gets('m_', $forum_id)) ? TRUE : FALSE,
'S_TOPIC_UNAPPROVED' => (!$row['topic_approved'] && $auth->acl_gets('m_approve', $forum_id)) ? TRUE : FALSE,
@ -514,13 +547,13 @@ if ($forum_data['forum_postable'])
}
}
/*
// Mozilla navigation links
$nav_links['up'] = array(
'url' => 'index.' . $phpEx . $SID,
'title' => sprintf($user->lang['FORUM_INDEX'], $config['sitename'])
);
*/
// Dump out the page header and load viewforum template
$page_title = $user->lang['VIEW_FORUM'] . ' - ' . $forum_data['forum_name'];

View file

@ -241,8 +241,8 @@ $limit_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7
$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']);
$sort_by_sql = array('a' => 'u.username', 't' => 'p.post_id', 's' => 'p.post_subject');
$s_limit_days = $s_sort_key = $s_sort_dir = '';
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir);
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
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);
// Obtain correct post count and ordering SQL if user has
// requested anything different
@ -356,7 +356,7 @@ $topic_mod .= ($auth->acl_get('f_announce', $forum_id) && ($topic_type != POST_A
$topic_mod .= ($auth->acl_get('m_', $forum_id)) ? '<option value="viewlogs">' . $user->lang['VIEW_TOPIC_LOGS'] . '</option>' : '';
// If we've got a hightlight set pass it on to pagination.
$pagination_url = "viewtopic.$phpEx$SID&amp;t=$topic_id&amp;st=$sort_days&amp;sk=$sort_key&amp;sd=$sort_dir" . (($highlight_match) ? "&amp;hilit=$highlight" : '');
$pagination_url = "viewtopic.$phpEx$SID&amp;t=$topic_id&amp;" . (($highlight_match) ? "&amp;hilit=$highlight" : '');
$pagination = generate_pagination($pagination_url, $total_posts, $config['posts_per_page'], $start);
@ -406,7 +406,7 @@ $template->assign_vars(array(
'PAGINATION' => (isset($_GET['view']) && $_GET['view'] == 'print') ? '' : $pagination,
'PAGE_NUMBER' => (isset($_GET['view']) && $_GET['view'] == 'print') ? '' : on_page($total_posts, $config['posts_per_page'], $start),
'TOTAL_POSTS' => ($total_posts == 1) ? $user->lang['VIEW_TOPIC_POST'] : sprintf($user->lang['VIEW_TOPIC_POSTS'], $total_posts),
'MCP' => ($auth->acl_get('m_', $forum_id)) ? sprintf($user->lang['MCP'], "<a href=\"mcp.$phpEx?sid=" . $user->session_id . "&amp;f=$forum_id&amp;t=$topic_id&amp;start=$start&amp;st=$sort_days&amp;sk=$sort_key&amp;sd=$sort_dir&amp;posts_per_page=" . $config['posts_per_page'] . '">', '</a>') : '',
'MCP' => ($auth->acl_get('m_', $forum_id)) ? sprintf($user->lang['MCP'], "<a href=\"mcp.$phpEx?sid=" . $user->session_id . "&amp;f=$forum_id&amp;t=$topic_id&amp;start=$start&amp;$u_sort_param&amp;posts_per_page=" . $config['posts_per_page'] . '">', '</a>') : '',
'MODERATORS' => (sizeof($forum_moderators[$forum_id])) ? implode(', ', $forum_moderators[$forum_id]) : '',
'POST_IMG' => $post_img,
@ -430,12 +430,12 @@ $template->assign_vars(array(
'U_TOPIC' => $server_path . "viewtopic.$phpEx?f=$forum_id&amp;t=$topic_id",
'U_FORUM' => $server_path,
'U_VIEW_TOPIC' => "viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id&amp;start=$start&amp;st=$sort_days&amp;sk=$sort_key&amp;sd=$sort_dir&amp;hilit=$highlight",
'U_VIEW_UNREAD_POST' => "viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id&amp;view=unread",
'U_VIEW_TOPIC' => "viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id&amp;start=$start&amp;$u_sort_param&amp;hilit=$highlight",
'U_VIEW_FORUM' => $view_forum_url,
'U_VIEW_OLDER_TOPIC' => $view_prev_topic_url,
'U_VIEW_NEWER_TOPIC' => $view_next_topic_url,
'U_PRINT_TOPIC' => "viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id&amp;st=$sort_days&amp;sk=$sort_key&amp;sd=$sort_dir&amp;view=print",
'U_PRINT_TOPIC' => "viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id&amp;$u_sort_param&amp;view=print",
'U_EMAIL_TOPIC' => "viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id&amp;view=email",
'U_POST_NEW_TOPIC' => $new_topic_url,
@ -577,10 +577,13 @@ if (!empty($poll_start))
'S_CAN_VOTE' => $s_can_vote,
'S_DISPLAY_RESULTS' => $s_display_results,
'S_IS_MULTI_CHOICE' => ($poll_max_options > 1) ? true : false,
'S_POLL_ACTION' => "viewtopic.$phpEx$SID&amp;t=$topic_id&amp;sk=$sort_key&amp;sd=$sort_dir",
'S_POLL_ACTION' => "viewtopic.$phpEx$SID&amp;t=$topic_id&amp;$u_sort_param",
'U_VIEW_RESULTS' => "viewtopic.$phpEx$SID&amp;t=$topic_id&amp;st=$sort_days&amp;sk=$sort_key&amp;sd=$sort_dir&amp;vote=viewresult")
'U_VIEW_RESULTS' => "viewtopic.$phpEx$SID&amp;t=$topic_id&amp;$u_sort_param&amp;vote=viewresult")
);
unset($poll_info);
unset($voted_id);
}
@ -814,6 +817,10 @@ while ($row = $db->sql_fetchrow($result));
$db->sql_freeresult($result);
// Store the last post time for this page ... for use in marking
$last_post_time = $row['post_time'];
// Pull attachment data
if (count($attach_list))
{
@ -944,7 +951,7 @@ foreach ($rowset as $key => $row)
$quote_img = '<a href="' . $temp_url . '">' . $user->img('btn_quote', $user->lang['REPLY_WITH_QUOTE']) . '</a>';
$quote = '<a href="' . $temp_url . '">' . $user->lang['REPLY_WITH_QUOTE'] . '</a>';
if (($user->data['user_id'] == $poster_id && $auth->acl_get('f_edit', $forum_id)) || $auth->acl_get('m_edit', $forum_id))
if (($user->data['user_id'] == $poster_id && $auth->acl_get('f_edit', $forum_id) && ($post_time > time() - $config['edit_time'] || !$config['edit_time'])) || $auth->acl_get('m_edit', $forum_id))
{
$temp_url = "posting.$phpEx$SID&amp;mode=edit&amp;f=" . $row['forum_id'] . "&amp;p=" . $row['post_id'];
$edit_img = '<a href="' . $temp_url . '">' . $user->img('btn_edit', $user->lang['EDIT_DELETE_POST']) . '</a>';
@ -1005,7 +1012,7 @@ foreach ($rowset as $key => $row)
// If we allow users to disable display of emoticons
// we'll need an appropriate check and preg_replace here
$message = (empty($row['enable_smilies']) || empty($config['allow_smilies'])) ? preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $message) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $config['smilies_path'], $message);
$message = (empty($config['allow_smilies'])) ? preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $message) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $config['smilies_path'], $message);
// Highlight active words (primarily for search)
@ -1156,8 +1163,9 @@ foreach ($rowset as $key => $row)
$denied = true;
$template->assign_block_vars('postrow.attachment', array(
'IS_DENIED' => true,
'L_DENIED' => sprintf($user->lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension']))
'IS_DENIED' => true,
'L_DENIED' => sprintf($user->lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension']))
);
}
@ -1202,18 +1210,15 @@ foreach ($rowset as $key => $row)
// NOTE: If you want to use the download.php everytime an image is displayed inlined, replace the
// Section between BEGIN and END with (Without the // of course):
// $img_source = $phpbb_root_path . 'download.' . $phpEx . $SID . '&amp;id=' . $attachment['attach_id'];
//
// BEGIN
if (!empty($config['ftp_upload']) && trim($config['upload_dir']) == '')
{
$img_source = $phpbb_root_path . 'download.' . $phpEx . $SID . '&amp;id=' . $attachment['attach_id'];
$img_source = $phpbb_root_path . "download.$phpEx$SID&amp;id=" . $attachment['attach_id'];
}
else
{
$img_source = $filename;
$update_count[] = $attachment['attach_id'];
}
// END
$l_downloaded_viewed = $user->lang['VIEWED'];
$download_link = $img_source;
@ -1224,23 +1229,20 @@ foreach ($rowset as $key => $row)
// NOTE: If you want to use the download.php everytime an thumnmail is displayed inlined, replace the
// Section between BEGIN and END with (Without the // of course):
// $thumb_source = $phpbb_root_path . 'download.' . $phpEx . $SID . '&amp;id=' . $attachment['attach_id'] . '&amp;thumb=1';
//
// BEGIN
if (!empty($config['allow_ftp_upload']) && trim($config['upload_dir']) == '')
{
$thumb_source = $phpbb_root_path . 'download.' . $phpEx . $SID . '&amp;id=' . $attachment['attach_id'] . '&thumb=1';
$thumb_source = $phpbb_root_path . "download.$phpEx$SID&amp;id=" . $attachment['attach_id'] . '&thumb=1';
}
else
{
$thumb_source = $thumbnail_filename;
}
// END
$l_downloaded_viewed = $user->lang['VIEWED'];
$download_link = $phpbb_root_path . 'download.' . $phpEx . $SID . '&amp;id=' . $attachment['attach_id'];
$download_link = $phpbb_root_path . "download.$phpEx$SID&amp;id=" . $attachment['attach_id'];
$additional_array = array(
'IMG_THUMB_SRC' => $thumb_source
'IMG_THUMB_SRC' => $thumb_source // should be THUMB_IMG or similar
);
break;
@ -1250,10 +1252,7 @@ foreach ($rowset as $key => $row)
$download_link = $filename;
// Viewed/Heared File ... update the download count (download.php is not called here)
if (!preg_match("#&t=$topic_id#", $user->data['session_page']))
{
$update_count[] = $attachment['attach_id'];
}
$update_count[] = $attachment['attach_id'];
break;
case RM_CAT:
@ -1262,15 +1261,12 @@ foreach ($rowset as $key => $row)
$download_link = $filename;
$additional_array = array(
'FORUM_URL' => generate_board_url(),
'FORUM_URL' => generate_board_url(), // should be U_FORUM or similar
'ATTACH_ID' => $attachment['attach_id']
);
// Viewed/Heared File ... update the download count (download.php is not called here)
if (!preg_match("#&t=$topic_id#", $user->data['session_page']))
{
$update_count[] = $attachment['attach_id'];
}
$update_count[] = $attachment['attach_id'];
break;
/*
case SWF_CAT:
@ -1329,26 +1325,29 @@ unset($rowset);
unset($user_cache);
// Udate the attachment download counts
if (count($update_count))
{
$sql = "UPDATE " . ATTACHMENTS_DESC_TABLE . "
SET download_count = download_count + 1
WHERE attach_id IN (" . implode(', ', array_unique($update_count)) . ")";
$db->sql_query($sql);
}
// Update the topic view counter, excepted when the user was already reading it
// Update topic view and if necessary attachment view counters ... but only
// if this is the first 'page view'
if (!preg_match("#&t=$topic_id#", $user->data['session_page']))
{
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_views = topic_views + 1
WHERE topic_id = $topic_id";
$db->sql_query($sql);
// Update the attachment download counts
if (count($update_count))
{
$sql = "UPDATE " . ATTACHMENTS_DESC_TABLE . "
SET download_count = download_count + 1
WHERE attach_id IN (" . implode(', ', array_unique($update_count)) . ")";
$db->sql_query($sql);
}
}
// Mozilla navigation bar
/*
$nav_links['prev'] = array(
'url' => $view_prev_topic_url,
'title' => $user->lang['View_previous_topic']
@ -1361,10 +1360,10 @@ $nav_links['up'] = array(
'url' => $view_forum_url,
'title' => $forum_name
);
*/
// Mark topics read
markread('topic', $forum_id, $topic_id, $topic_data['topic_last_post_id']);
markread('topic', $forum_id, $topic_id, $last_post_time);
// Change encoding if appropriate
@ -1375,7 +1374,7 @@ if ($force_encoding != '')
// Output the page
$page_title = $user->lang['View_topic'] .' - ' . $topic_title;
$page_title = $user->lang['VIEW_TOPIC'] .' - ' . $topic_title;
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(