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
|
@ -272,7 +272,7 @@ if (isset($_REQUEST['bansubmit']))
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO " . BANLIST_TABLE . " ($type, ban_start, ban_end, ban_exclude, ban_reason)
|
$sql = "INSERT INTO " . BANLIST_TABLE . " ($type, ban_start, ban_end, ban_exclude, ban_reason)
|
||||||
VALUES $sql";
|
VALUES $sql";
|
||||||
$result = $db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$ban_exclude)
|
if (!$ban_exclude)
|
||||||
|
|
|
@ -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']; ?> <input type="radio" name="board_email_form" value="0" <?php echo $board_email_form_no; ?> /> <?php echo $user->lang['DISABLED']; ?></td>
|
<td class="row2"><input type="radio" name="board_email_form" value="1" <?php echo $board_email_form_yes; ?> /> <?php echo $user->lang['ENABLED']; ?> <input type="radio" name="board_email_form" value="0" <?php echo $board_email_form_no; ?> /> <?php echo $user->lang['DISABLED']; ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<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>
|
<td class="row2"><input type="text" size="25" maxlength="100" name="board_email" value="<?php echo $new['board_email']; ?>" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<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="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>
|
<td class="row2"><textarea name="board_email_sig" rows="5" cols="30"><?php echo $new['board_email_sig']; ?></textarea></td>
|
||||||
</tr>
|
</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>
|
<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="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']; ?> <input type="radio" name="smtp_delivery" value="0" <?php echo $smtp_no; ?> /> <?php echo $user->lang['NO']; ?></td>
|
<td class="row2"><input type="radio" name="smtp_delivery" value="1" <?php echo $smtp_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="smtp_delivery" value="0" <?php echo $smtp_no; ?> /> <?php echo $user->lang['NO']; ?></td>
|
||||||
|
|
|
@ -46,7 +46,7 @@ require('pagestart.' . $phpEx);
|
||||||
$mode = (isset($_REQUEST['mode'])) ? htmlspecialchars($_REQUEST['mode']) : '';
|
$mode = (isset($_REQUEST['mode'])) ? htmlspecialchars($_REQUEST['mode']) : '';
|
||||||
$submode = (isset($_REQUEST['submode'])) ? htmlspecialchars($_REQUEST['submode']) : '';
|
$submode = (isset($_REQUEST['submode'])) ? htmlspecialchars($_REQUEST['submode']) : '';
|
||||||
$which_mode = (!empty($submode) && $submode != $mode) ? $submode : $mode;
|
$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) : '';
|
$submit = (sizeof($submit)) ? substr($submit[0], strpos($submit[0], '_') + 1) : '';
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ if (isset($_POST['doprune']))
|
||||||
// NOTE: this query will conceal all forum names, even those the user isn't authed for
|
// NOTE: this query will conceal all forum names, even those the user isn't authed for
|
||||||
$sql = 'SELECT forum_id, forum_name
|
$sql = 'SELECT forum_id, forum_name
|
||||||
FROM ' . FORUMS_TABLE . '
|
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';
|
ORDER BY left_id ASC';
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
|
|
@ -28,22 +28,10 @@ if (!$auth->acl_get('a_styles'))
|
||||||
trigger_error($user->lang['No_admin']);
|
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'];
|
$mode = (isset($_GET['mode'])) ? $_GET['mode'] : $_POST['mode'];
|
||||||
|
|
||||||
|
|
||||||
switch ($mode)
|
switch ($mode)
|
||||||
{
|
{
|
||||||
case 'editimageset':
|
case 'editimageset':
|
||||||
|
@ -157,7 +145,7 @@ switch ($mode)
|
||||||
{
|
{
|
||||||
$str = "<?php\n" . $template->compile(stripslashes($_POST['decompile'])) . "\n?".">";
|
$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);
|
fwrite ($fp, $str);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
|
@ -169,14 +157,32 @@ switch ($mode)
|
||||||
}
|
}
|
||||||
else if (!empty($tplname) && isset($_POST['tpl_name']))
|
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))
|
while (!feof($fp))
|
||||||
{
|
{
|
||||||
$str .= fread($fp, 4096);
|
$str .= fread($fp, 4096);
|
||||||
}
|
}
|
||||||
@fclose($fp);
|
@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
|
else
|
||||||
{
|
{
|
||||||
|
@ -195,10 +201,10 @@ switch ($mode)
|
||||||
$tplroot_options = get_templates($tplroot);
|
$tplroot_options = get_templates($tplroot);
|
||||||
|
|
||||||
$tplname_options = '';
|
$tplname_options = '';
|
||||||
$dp = @opendir($phpbb_root_path . 'templates/cache/' . $tplroot . '/');
|
$dp = @opendir($phpbb_root_path . 'cache/templates/' . $tplroot . '/');
|
||||||
while ($file = readdir($dp))
|
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, '.'));
|
$tpl = substr($file, 0, strpos($file, '.'));
|
||||||
$selected = ($tplname == $tpl) ? ' selected="selected"' : '';
|
$selected = ($tplname == $tpl) ? ' selected="selected"' : '';
|
||||||
|
|
|
@ -114,7 +114,7 @@ page_header($l_title);
|
||||||
if ($mode == 'mod')
|
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">
|
<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">
|
<table class="bg" width="100%" cellpadding="4" cellspacing="1" border="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="cat" colspan="5" height="28" align="center"><span class="gensmall"><?php echo $user->lang['DISPLAY_LOG']; ?>: <?php echo $s_limit_days; ?> <?php echo $user->lang['SORT_BY']; ?> <?php echo $s_sort_key; ?> <?php echo $s_sort_dir; ?> <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']; ?>: <?php echo $s_limit_days; ?> <?php echo $user->lang['SORT_BY']; ?>: <?php echo $s_sort_key; ?> <?php echo $s_sort_dir; ?> <input class="liteoption" type="submit" value="<?php echo $user->lang['GO']; ?>" name="sort" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="15%" height="25" nowrap="nowrap"><?php echo $user->lang['USERNAME']; ?></th>
|
<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">
|
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
|
||||||
<tr>
|
<tr>
|
||||||
<td align="left" valign="top"> <span class="nav"><?php echo on_page($log_count, $config['topics_per_page'], $start); ?></span></td>
|
<td align="left" valign="top"> <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'))
|
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> <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> <br /><br /><?php
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$pagination = generate_pagination("admin_viewlogs.$phpEx$SID&mode=$mode&sort_days=$sort_days&sort_key=$sort_key&sort_dir=$sort_dir", $log_count, $config['topics_per_page'], $start);
|
echo generate_pagination("admin_viewlogs.$phpEx$SID&mode=$mode&st=$sort_days&sk=$sort_key&sd=$sort_dir", $log_count, $config['topics_per_page'], $start); ?></span></td>
|
||||||
|
|
||||||
?><span class="nav"><?php echo $pagination; ?></span></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</table></form>
|
</table></form>
|
||||||
|
|
||||||
|
|
BIN
phpBB/adm/images/icon_folder_link.gif
Normal file
After Width: | Height: | Size: 714 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 705 B |
|
@ -411,7 +411,7 @@ elseif (isset($_GET['pane']) && $_GET['pane'] == 'right')
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$dbsize = $user->lang['Not_available'];
|
$dbsize = $user->lang['NOT_AVAILABLE'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_int($dbsize))
|
if (is_int($dbsize))
|
||||||
|
|
|
@ -114,6 +114,11 @@ function page_footer($copyright_html = true)
|
||||||
// Close our DB connection.
|
// Close our DB connection.
|
||||||
$db->sql_close();
|
$db->sql_close();
|
||||||
|
|
||||||
|
if (!empty($cache))
|
||||||
|
{
|
||||||
|
$cache->unload();
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
@ -126,7 +131,7 @@ function page_footer($copyright_html = true)
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div align="center"><span class="copyright">Powered by phpBB <?php echo $config['version']; ?> © 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']; ?> © 2002 <a href="http://www.phpbb.com/" target="_phpbb">phpBB Group</a></div>
|
||||||
|
|
||||||
<br clear="all" />
|
<br clear="all" />
|
||||||
|
|
||||||
|
@ -136,11 +141,6 @@ function page_footer($copyright_html = true)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($cache))
|
|
||||||
{
|
|
||||||
$cache->unload();
|
|
||||||
}
|
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,35 +49,21 @@ p {
|
||||||
*/
|
*/
|
||||||
a:link, a:active, a:visited {
|
a:link, a:active, a:visited {
|
||||||
color: #006699;
|
color: #006699;
|
||||||
}
|
|
||||||
a.gen, a.genmed, a.gensmall {
|
|
||||||
color: #006699;
|
|
||||||
text-decoration: none;
|
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 {
|
a:hover {
|
||||||
color: #DD6900;
|
color: #DD6900;
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a.nav {
|
||||||
|
color: #006699;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
a.nav:hover {
|
a.nav:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
a.copyright:hover {
|
|
||||||
color: #DD6900;
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Non-tag specific
|
Non-tag specific
|
||||||
|
@ -95,6 +81,9 @@ a.copyright:hover {
|
||||||
color: black;
|
color: black;
|
||||||
font: bold 11px;
|
font: bold 11px;
|
||||||
}
|
}
|
||||||
|
.forumlink {
|
||||||
|
font: bold 120% Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
}
|
||||||
.name {
|
.name {
|
||||||
color: black;
|
color: black;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
|
|
|
@ -88,6 +88,9 @@ define('GROUP_SPECIAL', 3);
|
||||||
define('GROUP_FREE', 4);
|
define('GROUP_FREE', 4);
|
||||||
|
|
||||||
// Forum/Topic states
|
// Forum/Topic states
|
||||||
|
define('FORUM_CAT', 0);
|
||||||
|
define('FORUM_POST', 1);
|
||||||
|
define('FORUM_LINK', 2);
|
||||||
define('ITEM_UNLOCKED', 0);
|
define('ITEM_UNLOCKED', 0);
|
||||||
define('ITEM_LOCKED', 1);
|
define('ITEM_LOCKED', 1);
|
||||||
define('ITEM_MOVED', 2);
|
define('ITEM_MOVED', 2);
|
||||||
|
|
BIN
phpBB/imagesets/subSilver/folder_link_big.gif
Normal file
After Width: | Height: | Size: 714 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 705 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 688 B |
|
@ -116,13 +116,13 @@ function generate_forum_nav(&$forum_data)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('navlinks', array(
|
$template->assign_block_vars('navlinks', array(
|
||||||
'FORUM_NAME' => $parent_name,
|
'FORUM_NAME' => $parent_name,
|
||||||
'U_VIEW_FORUM' => 'viewforum.' . $phpEx . $SID . '&f=' . $parent_forum_id)
|
'U_VIEW_FORUM' => "viewforum.$phpEx$SID&f=$parent_forum_id")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_block_vars('navlinks', array(
|
$template->assign_block_vars('navlinks', array(
|
||||||
'FORUM_NAME' => $forum_data['forum_name'],
|
'FORUM_NAME' => $forum_data['forum_name'],
|
||||||
'U_VIEW_FORUM' => 'viewforum.' . $phpEx . $SID . '&f=' . $forum_data['forum_id'])
|
'U_VIEW_FORUM' => "viewforum.$phpEx$SID&f=" . $forum_data['forum_id'])
|
||||||
);
|
);
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
|
@ -224,7 +224,7 @@ function gen_forum_rules($mode, &$forum_id)
|
||||||
return;
|
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;
|
global $user;
|
||||||
|
|
||||||
|
@ -254,6 +254,8 @@ function gen_sort_selects(&$limit_days, &$sort_by_text, &$sort_days, &$sort_key,
|
||||||
}
|
}
|
||||||
$s_sort_dir .= '</select>';
|
$s_sort_dir .= '</select>';
|
||||||
|
|
||||||
|
$u_sort_param = "st=$sort_days&sk=$sort_key&sd=$sort_dir";
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,7 +264,7 @@ function make_jumpbox($action, $forum_id = false, $select_all = false)
|
||||||
global $auth, $template, $user, $db, $nav_links, $phpEx, $SID;
|
global $auth, $template, $user, $db, $nav_links, $phpEx, $SID;
|
||||||
|
|
||||||
$boxstring = '';
|
$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 . '
|
FROM ' . FORUMS_TABLE . '
|
||||||
ORDER BY left_id ASC';
|
ORDER BY left_id ASC';
|
||||||
$result = $db->sql_query($sql, 600);
|
$result = $db->sql_query($sql, 600);
|
||||||
|
@ -271,7 +273,7 @@ function make_jumpbox($action, $forum_id = false, $select_all = false)
|
||||||
$padding = $forum_list = $holding = '';
|
$padding = $forum_list = $holding = '';
|
||||||
while ($row = $db->sql_fetchrow($result))
|
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
|
// Non-postable forum with no subforums, don't display
|
||||||
continue;
|
continue;
|
||||||
|
@ -447,10 +449,7 @@ function watch_topic_forum($mode, &$s_watching, &$s_watching_img, $user_id, $mat
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_vars(array(
|
meta_refresh(3, "view$mode.$phpEx$SID&$u_url=$match_id&start=$start");
|
||||||
'META' => '<meta http-equiv="refresh" content="3;url=' . "view$mode.$phpEx$SID&" . $u_url . "=$match_id&start=$start" . '">')
|
|
||||||
);
|
|
||||||
|
|
||||||
$message = $user->lang['NOT_WATCHING_' . strtoupper($mode)] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . "view$mode.$phpEx$SID&" . $u_url . "=$match_id&start=$start" . '">', '</a>');
|
$message = $user->lang['NOT_WATCHING_' . strtoupper($mode)] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . "view$mode.$phpEx$SID&" . $u_url . "=$match_id&start=$start" . '">', '</a>');
|
||||||
trigger_error($message);
|
trigger_error($message);
|
||||||
}
|
}
|
||||||
|
@ -481,10 +480,7 @@ function watch_topic_forum($mode, &$s_watching, &$s_watching_img, $user_id, $mat
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_vars(array(
|
meta_refresh(3, "view$mode.$phpEx$SID&$u_url=$match_id&start=$start");
|
||||||
'META' => '<meta http-equiv="refresh" content="3;url=' . "view$mode.$phpEx$SID&" . $u_url . "=$match_id&start=$start" . '">')
|
|
||||||
);
|
|
||||||
|
|
||||||
$message = $user->lang['ARE_WATCHING_' . strtoupper($mode)] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . "view$mode.$phpEx$SID&" . $u_url . "=$match_id&start=$start" . '">', '</a>');
|
$message = $user->lang['ARE_WATCHING_' . strtoupper($mode)] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . "view$mode.$phpEx$SID&" . $u_url . "=$match_id&start=$start" . '">', '</a>');
|
||||||
trigger_error($message);
|
trigger_error($message);
|
||||||
}
|
}
|
||||||
|
@ -512,14 +508,14 @@ function watch_topic_forum($mode, &$s_watching, &$s_watching_img, $user_id, $mat
|
||||||
|
|
||||||
if ($can_watch)
|
if ($can_watch)
|
||||||
{
|
{
|
||||||
$s_watching = ($is_watching) ? '<a href="' . "view$mode." . $phpEx . $SID . '&' . $u_url . "=$match_id&unwatch=$mode&start=$start" . '">' . $user->lang['STOP_WATCHING_' . strtoupper($mode)] . '</a>' : '<a href="' . "view$mode." . $phpEx . $SID . '&' . $u_url . "=$match_id&watch=$mode&start=$start" . '">' . $user->lang['START_WATCHING_' . strtoupper($mode)] . '</a>';
|
$s_watching = ($is_watching) ? "<a href=\"view$mode.$phpEx$SID&$u_url=$match_id&unwatch=$mode&start=$start\">" . $user->lang['STOP_WATCHING_' . strtoupper($mode)] . '</a>' : "<a href=\"view$mode.$phpEx$SID&$u_url=$match_id&watch=$mode&start=$start\">" . $user->lang['START_WATCHING_' . strtoupper($mode)] . '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marks a topic or form as read
|
// 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;
|
global $config, $db, $user;
|
||||||
|
|
||||||
|
@ -530,7 +526,7 @@ function markread($mode, $forum_id = 0, $topic_id = 0, $post_id = 0)
|
||||||
|
|
||||||
// Default tracking type
|
// Default tracking type
|
||||||
$type = TRACK_NORMAL;
|
$type = TRACK_NORMAL;
|
||||||
$current_time = time();
|
$current_time = ($marktime) ? $marktime : time();
|
||||||
|
|
||||||
switch ($mode)
|
switch ($mode)
|
||||||
{
|
{
|
||||||
|
@ -857,7 +853,7 @@ function generate_board_url()
|
||||||
// Redirects the user to another page then exits the script nicely
|
// Redirects the user to another page then exits the script nicely
|
||||||
function redirect($url)
|
function redirect($url)
|
||||||
{
|
{
|
||||||
global $db, $cache, $config;
|
global $db, $cache, $config, $user;
|
||||||
|
|
||||||
if (isset($db))
|
if (isset($db))
|
||||||
{
|
{
|
||||||
|
@ -869,13 +865,14 @@ function redirect($url)
|
||||||
$cache->unload();
|
$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
|
// Redirect via an HTML form for PITA webservers
|
||||||
if (@preg_match('#Microsoft|WebSTAR|Xitami#', getenv('SERVER_SOFTWARE')))
|
if (@preg_match('#Microsoft|WebSTAR|Xitami#', getenv('SERVER_SOFTWARE')))
|
||||||
{
|
{
|
||||||
header('Refresh: 0; URL=' . $url);
|
header('Refresh: 0; URL=' . $url);
|
||||||
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="refresh" content="0; url=' . $url . '"><title>Redirect</title></head><body><div align="center">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;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1045,5 +1042,339 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
|
||||||
break;
|
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 . '&mode=logout';
|
||||||
|
$l_login_logout = sprintf($user->lang['LOGOUT_USER'], $user->data['username']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$u_login_logout = 'ucp.'.$phpEx . $SID . '&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&mode=viewprofile&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.'&mode=pm&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.'&mode=register',
|
||||||
|
'U_PROFILE' => 'ucp.'.$phpEx.$SID.'&mode=editprofile',
|
||||||
|
'U_MODCP' => 'mcp.'.$phpEx.$SID,
|
||||||
|
'U_FAQ' => 'faq.'.$phpEx.$SID,
|
||||||
|
'U_SEARCH_SELF' => 'search.'.$phpEx.$SID.'&search_id=egosearch',
|
||||||
|
'U_SEARCH_NEW' => 'search.'.$phpEx.$SID.'&search_id=newposts',
|
||||||
|
'U_SEARCH_UNANSWERED' => 'search.'.$phpEx.$SID.'&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']) . '&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;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -20,21 +20,20 @@
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
// Simple version of jumpbox, just lists authed forums
|
// Simple version of jumpbox, just lists authed forums
|
||||||
// This needs altering to allow for ignoring acl checks ... they aren't needed
|
function make_forum_select($select_id = false, $ignore_id = false, $ignore_acl = false, $ignore_nonpost = false, $ignore_emptycat = true)
|
||||||
// everywhere ...
|
|
||||||
function make_forum_select($select_id = false, $ignore_id = false, $ignore_acl = false)
|
|
||||||
{
|
{
|
||||||
global $db, $user, $auth;
|
global $db, $user, $auth;
|
||||||
|
|
||||||
$right = $cat_right = 0;
|
$right = $cat_right = 0;
|
||||||
$forum_list = $padding = $holding = '';
|
$forum_list = $padding = $holding = '';
|
||||||
|
|
||||||
$acl = ($ignore_acl) ? '' : 'f_list';
|
$acl = ($ignore_acl) ? '' : array('f_list', 'a_forum', 'a_forumadd', 'a_forumdel');
|
||||||
$rowset = get_forum_list($acl, FALSE, FALSE, TRUE);
|
$rowset = get_forum_list($acl, false, $ignore_nonpost, true);
|
||||||
|
|
||||||
foreach ($rowset as $row)
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -57,15 +56,16 @@ function make_forum_select($select_id = false, $ignore_id = false, $ignore_acl =
|
||||||
$holding = '';
|
$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']);
|
$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
|
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 = '';
|
$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
|
// This query is identical to the jumpbox one
|
||||||
$expire_time = ($no_cache) ? 0 : 120;
|
$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 . '
|
FROM ' . FORUMS_TABLE . '
|
||||||
ORDER BY left_id ASC';
|
ORDER BY left_id ASC';
|
||||||
$result = $db->sql_query($sql, $expire_time);
|
$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();
|
$rowset = array();
|
||||||
foreach ($forum_rows as $row)
|
foreach ($forum_rows as $row)
|
||||||
{
|
{
|
||||||
if ($postable_only && !$row['forum_postable'])
|
if ($postable_only && $row['forum_type'] == FORUM_CAT)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -122,49 +122,45 @@ function move_topics($topic_ids, $forum_id, $auto_sync = TRUE)
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
$forum_ids = array($forum_id);
|
$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)
|
if ($auto_sync)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT DISTINCT forum_id
|
$sql = 'SELECT DISTINCT forum_id
|
||||||
FROM ' . TOPICS_TABLE . '
|
FROM ' . TOPICS_TABLE . '
|
||||||
WHERE topic_id ' . $where_sql;
|
WHERE topic_id ' . $sql_where;
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$forum_ids[] = $row['forum_id'];
|
$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);
|
sync('forum', 'forum_id', $forum_ids, TRUE);
|
||||||
|
unset($forum_ids);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function move_posts($post_ids, $topic_id, $auto_sync = TRUE)
|
function move_posts($post_ids, $topic_id, $auto_sync = TRUE)
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
if (!is_array($post_ids))
|
if (!is_array($post_ids))
|
||||||
{
|
{
|
||||||
$post_ids = 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 . '
|
FROM ' . POSTS_TABLE . '
|
||||||
WHERE post_id IN (' . implode(', ', $post_ids) . ')';
|
WHERE post_id IN (' . implode(', ', $post_ids) . ')';
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$forum_ids[] = $row['forum_id'];
|
$forum_ids[] = $row['forum_id'];
|
||||||
$topic_ids[] = $row['topic_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);
|
$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 . '
|
$sql = 'UPDATE ' . POSTS_TABLE . '
|
||||||
SET forum_id = ' . $row['forum_id'] . ", topic_id = $topic_id
|
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);
|
$where_ids = array_unique($where_ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!count($where_ids))
|
if (!count($where_ids))
|
||||||
{
|
{
|
||||||
return array('topics' => 0, 'posts' => '0');
|
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)
|
'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
|
$sql = 'SELECT topic_id, forum_id
|
||||||
FROM ' . TOPICS_TABLE . "
|
FROM ' . TOPICS_TABLE . "
|
||||||
WHERE $where_type " . ((!is_array($where_ids)) ? "= $where_ids" : 'IN (' . implode(', ', $where_ids) . ')');
|
WHERE $where_type " . ((!is_array($where_ids)) ? "= $where_ids" : 'IN (' . implode(', ', $where_ids) . ')');
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$forum_ids[] = $row['forum_id'];
|
$forum_ids[] = $row['forum_id'];
|
||||||
|
@ -247,17 +250,25 @@ function delete_topics($where_type, $where_ids, $auto_sync = TRUE)
|
||||||
return $return;
|
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_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);
|
$table_ary = array(TOPICS_TRACK_TABLE, POLL_VOTES_TABLE, POLL_OPTIONS_TABLE, TOPICS_WATCH_TABLE, TOPICS_TABLE);
|
||||||
$db->sql_query('DELETE FROM ' . POLL_OPTIONS_TABLE . ' WHERE topic_id' . $where_sql);
|
foreach ($table_ary as $table)
|
||||||
$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);
|
$sql = "DELETE FROM $table
|
||||||
$db->sql_query('DELETE FROM ' . TOPICS_TABLE . ' WHERE topic_id' . $where_sql);
|
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');
|
$db->sql_transaction('commit');
|
||||||
|
|
||||||
if ($auto_sync)
|
if ($auto_sync)
|
||||||
|
@ -266,6 +277,23 @@ function delete_topics($where_type, $where_ids, $auto_sync = TRUE)
|
||||||
sync('topic_reported', $where_type, $where_ids);
|
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;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,13 +329,19 @@ function delete_posts($where_type, $where_ids, $auto_sync = TRUE)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$where_sql = ' WHERE post_id IN (' . implode(', ', $post_ids) . ')';
|
$sql_where = implode(', ', $post_ids);
|
||||||
|
|
||||||
$db->sql_transaction('begin');
|
$db->sql_transaction('begin');
|
||||||
$db->sql_query('DELETE FROM ' . POSTS_TABLE . $where_sql);
|
|
||||||
$db->sql_query('DELETE FROM ' . RATINGS_TABLE . $where_sql);
|
$table_ary = array(POSTS_TABLE, RATINGS_TABLE, REPORTS_TABLE, SEARCH_MATCH_TABLE);
|
||||||
$db->sql_query('DELETE FROM ' . REPORTS_TABLE . $where_sql);
|
foreach ($table_ary as $table)
|
||||||
$db->sql_query('DELETE FROM ' . SEARCH_MATCH_TABLE . $where_sql);
|
{
|
||||||
|
$sql = "DELETE FROM $table
|
||||||
|
WHERE post_id IN ($sql_where)";
|
||||||
|
$db->sql_query($sql);
|
||||||
|
}
|
||||||
|
unset($table_ary);
|
||||||
|
|
||||||
$db->sql_transaction('commit');
|
$db->sql_transaction('commit');
|
||||||
|
|
||||||
delete_attachment($post_ids);
|
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);
|
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);
|
return count($post_ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// All-encompasing sync function
|
||||||
//
|
//
|
||||||
// Usage:
|
// Usage:
|
||||||
// sync('topic', 'topic_id', 123); <= resynch topic #123
|
// sync('topic', 'topic_id', 123); <= resynch topic #123
|
||||||
// sync('topic', 'forum_id', array(2, 3)); <= resynch topics from forum #2 and #3
|
// sync('topic', 'forum_id', array(2, 3)); <= resynch topics from forum #2 and #3
|
||||||
// sync('topic'); <= resynch all topics
|
// sync('topic'); <= resynch all topics
|
||||||
//
|
|
||||||
function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE, $sync_extra = FALSE)
|
function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE, $sync_extra = FALSE)
|
||||||
{
|
{
|
||||||
global $db, $dbms;
|
global $db;
|
||||||
|
|
||||||
if (is_array($where_ids))
|
if (is_array($where_ids))
|
||||||
{
|
{
|
||||||
|
@ -351,13 +402,13 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$where_sql = 'WHERE ' . $mode{0} . ".$where_type IN (" . implode(', ', $where_ids) . ')';
|
$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
|
else
|
||||||
{
|
{
|
||||||
$where_sql = "WHERE t.$where_type IN (" . implode(', ', $where_ids) . ')';
|
$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)
|
switch ($mode)
|
||||||
|
@ -370,7 +421,6 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$topic_ids = $approved_unapproved_ids = array();
|
$topic_ids = $approved_unapproved_ids = array();
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$approved_unapproved_ids[] = $row['topic_id'];
|
$approved_unapproved_ids[] = $row['topic_id'];
|
||||||
|
@ -391,16 +441,21 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
|
||||||
case 'post_attachment':
|
case 'post_attachment':
|
||||||
$post_ids = array();
|
$post_ids = array();
|
||||||
|
|
||||||
switch ($dbms)
|
switch (SQL_LAYER)
|
||||||
{
|
{
|
||||||
|
case 'oracle':
|
||||||
|
//TODO
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$sql = 'SELECT t.post_id, t.post_attachment, COUNT(a.attachment_id) AS attachments
|
$sql = 'SELECT t.post_id, t.post_attachment, COUNT(a.attachment_id) AS attachments
|
||||||
FROM ' . POSTS_TABLE . ' t
|
FROM ' . POSTS_TABLE . ' t
|
||||||
LEFT JOIN ' . ATTACHMENTS_TABLE . " a ON t.post_id = a.post_id
|
LEFT JOIN ' . ATTACHMENTS_TABLE . " a ON t.post_id = a.post_id
|
||||||
$where_sql
|
$where_sql
|
||||||
GROUP BY t.post_id";
|
GROUP BY t.post_id";
|
||||||
|
}
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
if (($row['post_attachment'] && !$row['attachments']) || ($row['attachments'] && !$row['post_attachment']))
|
if (($row['post_attachment'] && !$row['attachments']) || ($row['attachments'] && !$row['post_attachment']))
|
||||||
|
@ -408,7 +463,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
|
||||||
$post_ids[] = $row['post_id'];
|
$post_ids[] = $row['post_id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
if (!count($post_ids))
|
if (!count($post_ids))
|
||||||
{
|
{
|
||||||
|
@ -422,10 +477,13 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'topic_attachment':
|
case 'topic_attachment':
|
||||||
$topic_ids = array();
|
|
||||||
|
|
||||||
switch ($dbms)
|
switch (SQL_LAYER)
|
||||||
{
|
{
|
||||||
|
case 'oracle':
|
||||||
|
//TODO
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$sql = 'SELECT t.topic_id, t.topic_attachment, COUNT(a.attachment_id) AS attachments
|
$sql = 'SELECT t.topic_id, t.topic_attachment, COUNT(a.attachment_id) AS attachments
|
||||||
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p
|
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p
|
||||||
|
@ -434,8 +492,10 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
|
||||||
AND ((t.topic_attachment = 1 AND attachments = 0)
|
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";
|
GROUP BY t.topic_id";
|
||||||
|
}
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
$topic_ids = array();
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
if (($row['topic_attachment'] && !$row['attachments'])
|
if (($row['topic_attachment'] && !$row['attachments'])
|
||||||
|
@ -444,7 +504,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
|
||||||
$topic_ids[] = $row['topic_id'];
|
$topic_ids[] = $row['topic_id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
if (count($topic_ids))
|
if (count($topic_ids))
|
||||||
{
|
{
|
||||||
|
@ -462,6 +522,13 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
|
||||||
|
|
||||||
if ($sync_extra)
|
if ($sync_extra)
|
||||||
{
|
{
|
||||||
|
switch (SQL_LAYER)
|
||||||
|
{
|
||||||
|
case 'oracle':
|
||||||
|
//TODO
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
// NOTE: untested
|
// NOTE: untested
|
||||||
$sql = 'SELECT p.post_id
|
$sql = 'SELECT p.post_id
|
||||||
FROM ' . POSTS_TABLE . ' t
|
FROM ' . POSTS_TABLE . ' t
|
||||||
|
@ -470,32 +537,45 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
|
||||||
AND ((t.post_reported = 1 AND r.post_id IS NULL)
|
AND ((t.post_reported = 1 AND r.post_id IS NULL)
|
||||||
OR (t.post_reported = 0 AND r.post_id > 0))
|
OR (t.post_reported = 0 AND r.post_id > 0))
|
||||||
GROUP p.post_id";
|
GROUP p.post_id";
|
||||||
|
}
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
while ($row = $db->sql_fetchrow($result))
|
|
||||||
|
if ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
do
|
||||||
{
|
{
|
||||||
$post_ids[] = $row['post_id'];
|
$post_ids[] = $row['post_id'];
|
||||||
}
|
}
|
||||||
$db->sql_freeresult();
|
while ($row = $db->sql_fetchrow($result));
|
||||||
|
|
||||||
if (count($post_ids))
|
|
||||||
{
|
|
||||||
$sql = 'UPDATE ' . POSTS_TABLE . '
|
$sql = 'UPDATE ' . POSTS_TABLE . '
|
||||||
SET post_reported = 1 - post_reported
|
SET post_reported = 1 - post_reported
|
||||||
WHERE post_id IN (' . implode(', ', $post_ids) . ')';
|
WHERE post_id IN (' . implode(', ', $post_ids) . ')';
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
unset($post_ids);
|
unset($post_ids);
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (SQL_LAYER)
|
||||||
|
{
|
||||||
|
case 'oracle':
|
||||||
|
//TODO
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
// NOTE: untested
|
// NOTE: untested
|
||||||
$sql = 'SELECT t.topic_id, t.topic_reported, p.post_reported
|
$sql = 'SELECT t.topic_id, t.topic_reported, p.post_reported
|
||||||
FROM ' . TOPICS_TABLE . ' t
|
FROM ' . TOPICS_TABLE . ' t
|
||||||
LEFT JOIN ' . POSTS_TABLE . " p ON p.topic_id = t.topic_id
|
LEFT JOIN ' . POSTS_TABLE . " p ON p.topic_id = t.topic_id
|
||||||
$where_sql
|
$where_sql
|
||||||
GROUP BY p.topic_id, p.post_reported";
|
GROUP BY p.topic_id, p.post_reported";
|
||||||
|
}
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
if ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
do
|
||||||
{
|
{
|
||||||
if (!isset($topic_data[$row['topic_id']]))
|
if (!isset($topic_data[$row['topic_id']]))
|
||||||
{
|
{
|
||||||
|
@ -509,6 +589,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
|
||||||
$topic_data[$row['topic_id']]['post_reported'] |= $row['post_reported'];
|
$topic_data[$row['topic_id']]['post_reported'] |= $row['post_reported'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
while ($row = $db->sql_fetchrow($result));
|
||||||
|
|
||||||
foreach ($topic_data as $topic_id => $row)
|
foreach ($topic_data as $topic_id => $row)
|
||||||
{
|
{
|
||||||
|
@ -518,35 +599,38 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($topic_ids))
|
|
||||||
{
|
|
||||||
$sql = 'UPDATE ' . TOPICS_TABLE . '
|
$sql = 'UPDATE ' . TOPICS_TABLE . '
|
||||||
SET topic_reported = 1 - topic_reported
|
SET topic_reported = 1 - topic_reported
|
||||||
WHERE topic_id IN (' . implode(', ', $topic_ids) . ')';
|
WHERE topic_id IN (' . implode(', ', $topic_ids) . ')';
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
unset($topic_ids);
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'forum':
|
case 'forum':
|
||||||
if ($resync_parents)
|
if ($resync_parents)
|
||||||
{
|
{
|
||||||
$forum_ids = array();
|
|
||||||
|
|
||||||
$sql = 'SELECT f2.forum_id
|
$sql = 'SELECT f2.forum_id
|
||||||
FROM ' . FORUMS_TABLE . ' f, ' . FORUMS_TABLE . " f2
|
FROM ' . FORUMS_TABLE . ' f, ' . FORUMS_TABLE . " f2
|
||||||
$where_sql_and f.left_id BETWEEN f2.left_id AND f2.right_id";
|
$where_sql_and f.left_id BETWEEN f2.left_id AND f2.right_id";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
while ($row = $db->sql_fetchrow($result))
|
|
||||||
|
if ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$forum_ids = array();
|
||||||
|
do
|
||||||
{
|
{
|
||||||
$forum_ids[] = $row['forum_id'];
|
$forum_ids[] = $row['forum_id'];
|
||||||
}
|
}
|
||||||
|
while ($row = $db->sql_fetchrow($result));
|
||||||
|
|
||||||
if (count($forum_ids))
|
|
||||||
{
|
|
||||||
sync('forum', 'forum_id', $forum_ids, FALSE);
|
sync('forum', 'forum_id', $forum_ids, FALSE);
|
||||||
|
unset($forum_ids);
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -555,12 +639,16 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
|
||||||
$sql = 'SELECT f.*, f2.forum_id AS id
|
$sql = 'SELECT f.*, f2.forum_id AS id
|
||||||
FROM ' . FORUMS_TABLE . ' f, ' . FORUMS_TABLE . " f2
|
FROM ' . FORUMS_TABLE . ' f, ' . FORUMS_TABLE . " f2
|
||||||
$where_sql_and f2.left_id BETWEEN f.left_id AND f.right_id";
|
$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();
|
$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))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
|
if ($row['forum_type'] == FORUM_LINK)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$forum_ids[$row['id']] = $row['id'];
|
$forum_ids[$row['id']] = $row['id'];
|
||||||
if (!isset($subforum_list[$row['forum_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'];
|
$topic_count_real[$row['forum_id']] += $row['forum_topics'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row['topic_approved'])
|
if ($row['topic_approved'])
|
||||||
{
|
{
|
||||||
$topic_count[$row['forum_id']] = $row['forum_topics'];
|
$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'] += $topic_count[$subforum_id];
|
||||||
$forum_data[$forum_id]['topics_real'] += $topic_count_real[$subforum_id];
|
$forum_data[$forum_id]['topics_real'] += $topic_count_real[$subforum_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($post_count[$subforum_id]))
|
if (isset($post_count[$subforum_id]))
|
||||||
{
|
{
|
||||||
$forum_data[$forum_id]['posts'] += $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'];
|
$post_ids[] = $data['last_post_id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($post_ids))
|
if (count($post_ids))
|
||||||
{
|
{
|
||||||
$sql = 'SELECT p.post_id, p.poster_id, u.username, p.post_time
|
$sql = 'SELECT p.post_id, p.poster_id, u.username, p.post_time
|
||||||
|
@ -682,25 +773,11 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
|
||||||
{
|
{
|
||||||
if (preg_match('#name$#', $fieldname))
|
if (preg_match('#name$#', $fieldname))
|
||||||
{
|
{
|
||||||
if (isset($row[$fieldname]))
|
$sql['forum_' . $fieldname] = (isset($row[$fieldname])) ? (string) $row[$fieldname] : '';
|
||||||
{
|
|
||||||
$sql['forum_' . $fieldname] = (string) $row[$fieldname];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql['forum_' . $fieldname] = '';
|
$sql['forum_' . $fieldname] = (isset($row[$fieldname])) ? (int) $row[$fieldname] : 0;
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (isset($row[$fieldname]))
|
|
||||||
{
|
|
||||||
$sql['forum_' . $fieldname] = (int) $row[$fieldname];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$sql['forum_' . $fieldname] = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -719,8 +796,8 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
|
||||||
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
|
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
|
||||||
$where_sql_and p.topic_id = t.topic_id
|
$where_sql_and p.topic_id = t.topic_id
|
||||||
GROUP BY p.topic_id, p.post_approved";
|
GROUP BY p.topic_id, p.post_approved";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$row['total_posts'] = intval($row['total_posts']);
|
$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 (!count($topic_ids))
|
||||||
{
|
{
|
||||||
// If we get there, topic ids were invalid or topics did not contain any posts
|
// If we get there, topic ids were invalid or topics did not contain any posts
|
||||||
|
|
||||||
delete_topics($where_type, $where_ids);
|
delete_topics($where_type, $where_ids);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -830,10 +906,9 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
|
||||||
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
|
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
|
||||||
WHERE p.post_id IN (' . implode(', ', $post_ids) . ')
|
WHERE p.post_id IN (' . implode(', ', $post_ids) . ')
|
||||||
AND u.user_id = p.poster_id';
|
AND u.user_id = p.poster_id';
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$post_ids = array();
|
$post_ids = array();
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
if ($row['post_id'] == $topic_data[$row['topic_id']]['first_post_id'])
|
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
|
// This routine assumes that post_reported values are correct
|
||||||
// if they are not, use sync('reported') instead
|
// if they are not, use sync('reported') instead
|
||||||
$fieldnames[] = 'reported';
|
|
||||||
$sql = 'SELECT t.topic_id, p.post_id
|
$sql = 'SELECT t.topic_id, p.post_id
|
||||||
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
|
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
|
||||||
$where_sql_and p.topic_id = t.topic_id
|
$where_sql_and p.topic_id = t.topic_id
|
||||||
AND p.post_reported = 1
|
AND p.post_reported = 1
|
||||||
GROUP t.topic_id";
|
GROUP t.topic_id";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
$fieldnames[] = 'reported';
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$topic_data[$row['topic_id']]['reported'] = 1;
|
$topic_data[$row['topic_id']]['reported'] = 1;
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
// This routine assumes that post_attachment values are correct
|
// This routine assumes that post_attachment values are correct
|
||||||
// if they are not, use sync('post_attachment') instead
|
// if they are not, use sync('post_attachment') instead
|
||||||
$fieldnames[] = 'attachment';
|
|
||||||
$sql = 'SELECT t.topic_id, p.post_id
|
$sql = 'SELECT t.topic_id, p.post_id
|
||||||
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
|
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
|
||||||
$where_sql_and p.topic_id = t.topic_id
|
$where_sql_and p.topic_id = t.topic_id
|
||||||
AND p.post_attachment = 1
|
AND p.post_attachment = 1
|
||||||
GROUP t.topic_id";
|
GROUP t.topic_id";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
$fieldnames[] = 'attachment';
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$topic_data[$row['topic_id']]['attachment'] = 1;
|
$topic_data[$row['topic_id']]['attachment'] = 1;
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($topic_data as $topic_id => $row)
|
foreach ($topic_data as $topic_id => $row)
|
||||||
|
@ -948,15 +1025,19 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
|
||||||
GROUP BY f.forum_id';
|
GROUP BY f.forum_id';
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
if ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
$forum_ids = array();
|
$forum_ids = array();
|
||||||
while ($row = $db->sql_fetchrow($result))
|
do
|
||||||
{
|
{
|
||||||
$forum_ids[] = $row['forum_id'];
|
$forum_ids[] = $row['forum_id'];
|
||||||
}
|
}
|
||||||
if (count($forum_ids))
|
while ($row = $db->sql_fetchrow($result));
|
||||||
{
|
|
||||||
sync('forum', 'forum_id', $forum_ids, FALSE);
|
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);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$p_result = delete_topics('topic_id', $topic_list, $auto_sync);
|
return delete_topics('topic_id', $topic_list, $auto_sync);
|
||||||
return $p_result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function auto_prune(), this function now relies on passed vars
|
// Function auto_prune(), this function now relies on passed vars
|
||||||
|
@ -1036,7 +1116,7 @@ function remove_comments(&$output)
|
||||||
$in_comment = false;
|
$in_comment = false;
|
||||||
for($i = 0; $i < $linecount; $i++)
|
for($i = 0; $i < $linecount; $i++)
|
||||||
{
|
{
|
||||||
if (preg_match('/^\/\*/', preg_quote($lines[$i])))
|
if (preg_match('#^\/\*#', preg_quote($lines[$i])))
|
||||||
{
|
{
|
||||||
$in_comment = true;
|
$in_comment = true;
|
||||||
}
|
}
|
||||||
|
@ -1046,7 +1126,7 @@ function remove_comments(&$output)
|
||||||
$output .= $lines[$i] . "\n";
|
$output .= $lines[$i] . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('/\*\/$/', preg_quote($lines[$i])))
|
if (preg_match('#\*\/$#', preg_quote($lines[$i])))
|
||||||
{
|
{
|
||||||
$in_comment = false;
|
$in_comment = false;
|
||||||
}
|
}
|
||||||
|
@ -1103,10 +1183,10 @@ function split_sql_file($sql, $delimiter)
|
||||||
if ($i != $token_count - 1 || strlen($tokens[$i] > 0))
|
if ($i != $token_count - 1 || strlen($tokens[$i] > 0))
|
||||||
{
|
{
|
||||||
// This is the total number of single quotes in the token.
|
// 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,
|
// Counts single quotes that are preceded by an odd number of backslashes,
|
||||||
// which means they're escaped quotes.
|
// 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;
|
$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++)
|
for ($j = $i + 1; (!$complete_stmt && ($j < $token_count)); $j++)
|
||||||
{
|
{
|
||||||
// This is the total number of single quotes in the token.
|
// 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,
|
// Counts single quotes that are preceded by an odd number of backslashes,
|
||||||
// which means they're escaped quotes.
|
// 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;
|
$unescaped_quotes = $total_quotes - $escaped_quotes;
|
||||||
|
|
||||||
|
@ -1170,10 +1250,8 @@ function split_sql_file($sql, $delimiter)
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cache moderators, called whenever permissions are
|
// Cache moderators, called whenever permissions are changed via admin_permissions. Changes of username
|
||||||
// changed via admin_permissions. Changes of username
|
// and group names must be carried through for the moderators table
|
||||||
// and group names must be carried through for the
|
|
||||||
// moderators table
|
|
||||||
function cache_moderators()
|
function cache_moderators()
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
|
@ -81,7 +81,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
|
||||||
unset($right_id);
|
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
|
// Non-postable forum with no subforums: don't display
|
||||||
continue;
|
continue;
|
||||||
|
@ -103,7 +103,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
|
||||||
$forum_rows[$forum_id] = $row;
|
$forum_rows[$forum_id] = $row;
|
||||||
$forum_ids[] = $forum_id;
|
$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;
|
$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'];
|
$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]['display'] = ($row['display_on_index']) ? true : false;;
|
||||||
$subforums[$parent_id]['name'][$forum_id] = $row['forum_name'];
|
$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]))
|
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['parent_id'] == $root_id)
|
||||||
{
|
{
|
||||||
if (!$row['forum_postable'])
|
if ($row['forum_type'] == FORUM_CAT)
|
||||||
{
|
{
|
||||||
$hold = $row;
|
$hold = $row;
|
||||||
continue;
|
continue;
|
||||||
|
@ -243,7 +262,16 @@ function display_forums($root_data = '', $display_moderators = TRUE)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
switch ($row['forum_type'])
|
||||||
|
{
|
||||||
|
case FORUM_POST:
|
||||||
$folder_image = ($forum_unread[$forum_id]) ? 'forum_new' : 'forum';
|
$folder_image = ($forum_unread[$forum_id]) ? 'forum_new' : 'forum';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FORUM_LINK:
|
||||||
|
$folder_image = 'forum_link';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$subforums_list = '';
|
$subforums_list = '';
|
||||||
$l_subforums = '';
|
$l_subforums = '';
|
||||||
|
@ -286,8 +314,12 @@ function display_forums($root_data = '', $display_moderators = TRUE)
|
||||||
$moderators_list = implode(', ', $forum_moderators[$forum_id]);
|
$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(
|
$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'],
|
'FORUM_IMG' => $row['forum_image'],
|
||||||
'LAST_POST_IMG' => $user->img('icon_post_latest', 'VIEW_LATEST_POST'),
|
'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_FOLDER_IMG' => $user->img($folder_image, $folder_alt),
|
||||||
'FORUM_NAME' => $row['forum_name'],
|
'FORUM_NAME' => $row['forum_name'],
|
||||||
'FORUM_DESC' => $row['forum_desc'],
|
'FORUM_DESC' => $row['forum_desc'],
|
||||||
'POSTS' => $row['forum_posts'],
|
$l_post_click_count => $post_click_count,
|
||||||
'TOPICS' => $row['forum_topics'],
|
'TOPICS' => $row['forum_topics'],
|
||||||
'LAST_POST_TIME' => $last_post_time,
|
'LAST_POST_TIME' => $last_post_time,
|
||||||
'LAST_POSTER' => $last_poster,
|
'LAST_POSTER' => $last_poster,
|
||||||
|
@ -308,12 +340,12 @@ function display_forums($root_data = '', $display_moderators = TRUE)
|
||||||
|
|
||||||
'U_LAST_POSTER' => $last_poster_url,
|
'U_LAST_POSTER' => $last_poster_url,
|
||||||
'U_LAST_POST' => $last_post_url,
|
'U_LAST_POST' => $last_post_url,
|
||||||
'U_VIEWFORUM' => 'viewforum.' . $phpEx . $SID . '&f=' . $row['forum_id'])
|
'U_VIEWFORUM' => ($row['forum_type'] != FORUM_LINK || $row['forum_link_track']) ? 'viewforum.' . $phpEx . $SID . '&f=' . $row['forum_id'] : $row['forum_link'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$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'])
|
'L_SUBFORUM' => ($visible_forums == 1) ? $user->lang['SUBFORUM'] : $user->lang['SUBFORUMS'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -438,6 +438,10 @@ class userdata extends user
|
||||||
{
|
{
|
||||||
global $db, $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);
|
$username = $db->sql_escape($username);
|
||||||
|
|
||||||
$sql = "SELECT username
|
$sql = "SELECT username
|
||||||
|
@ -500,7 +504,7 @@ class userdata extends user
|
||||||
|
|
||||||
if ($email != '')
|
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
|
$sql = "SELECT ban_email
|
||||||
FROM " . BANLIST_TABLE;
|
FROM " . BANLIST_TABLE;
|
||||||
|
|
|
@ -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]);
|
return array_unique($split_entries[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -824,6 +825,7 @@ class fulltext_search
|
||||||
WHERE m.post_id = " . intval($post_id) . "
|
WHERE m.post_id = " . intval($post_id) . "
|
||||||
AND w.word_id = m.word_id";
|
AND w.word_id = m.word_id";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$cur_words = array();
|
$cur_words = array();
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
|
@ -908,25 +910,33 @@ class fulltext_search
|
||||||
{
|
{
|
||||||
$title_match = ($word_in == 'title') ? 1 : 0;
|
$title_match = ($word_in == 'title') ? 1 : 0;
|
||||||
|
|
||||||
$sql = '';
|
|
||||||
if (sizeof($word_ary))
|
if (sizeof($word_ary))
|
||||||
{
|
{
|
||||||
|
$sql_in = array();
|
||||||
foreach ($word_ary as $word)
|
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);
|
$db->sql_query($sql);
|
||||||
|
unset($sql_in);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($words['add'] as $word_in => $word_ary)
|
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))
|
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);
|
$db->sql_query($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -957,58 +967,66 @@ class fulltext_search
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove common (> 60% of posts ) words
|
// 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);
|
$row = $db->sql_fetchrow($result);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
if ($row['total_posts'] >= 100)
|
if ($row['total_posts'] >= 100)
|
||||||
{
|
{
|
||||||
$sql = "SELECT word_id
|
$sql = 'SELECT word_id
|
||||||
FROM " . SEARCH_MATCH_TABLE . "
|
FROM ' . SEARCH_MATCH_TABLE . '
|
||||||
GROUP BY word_id
|
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))
|
|
||||||
{
|
|
||||||
$in_sql .= (( $in_sql != '') ? ', ' : '') . $row['word_id'];
|
|
||||||
}
|
|
||||||
$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
|
|
||||||
AND m.word_id IS NULL
|
|
||||||
GROUP BY m.word_id";
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
if ($row = $db->sql_fetchrow($result))
|
if ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$in_sql = '';
|
$sql_in = array();
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
$in_sql .= ', ' . $row['word_id'];
|
$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);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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
|
||||||
|
AND m.word_id IS NULL
|
||||||
|
GROUP BY m.word_id';
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
if ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$sql_in = array();
|
||||||
|
do
|
||||||
|
{
|
||||||
|
$sql_in[] = $row['word_id'];
|
||||||
}
|
}
|
||||||
while ($row = $db->sql_fetchrow($result));
|
while ($row = $db->sql_fetchrow($result));
|
||||||
|
|
||||||
$sql = 'DELETE FROM ' . SEARCH_WORD_TABLE . '
|
$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);
|
$db->sql_query($sql);
|
||||||
|
unset($sql_in);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,11 +37,6 @@
|
||||||
to this source
|
to this source
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Changes for 2.2:
|
|
||||||
//
|
|
||||||
// * Allow use of Smarty plug-ins?
|
|
||||||
// * Reduce number of methods and variables
|
|
||||||
|
|
||||||
class Template
|
class Template
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -27,11 +27,12 @@ include($phpbb_root_path . 'common.'.$phpEx);
|
||||||
// Get posted/get info
|
// Get posted/get info
|
||||||
$mark_read = (isset($_REQUEST['mark'])) ? $_REQUEST['mark'] : '';
|
$mark_read = (isset($_REQUEST['mark'])) ? $_REQUEST['mark'] : '';
|
||||||
|
|
||||||
|
|
||||||
// Start session management
|
// Start session management
|
||||||
$user->start();
|
$user->start();
|
||||||
$user->setup();
|
$user->setup();
|
||||||
$auth->acl($user->data);
|
$auth->acl($user->data);
|
||||||
// End session management
|
|
||||||
|
|
||||||
// Handle marking posts
|
// Handle marking posts
|
||||||
if ($mark_read == 'forums')
|
if ($mark_read == 'forums')
|
||||||
|
@ -130,9 +131,13 @@ $template->assign_vars(array(
|
||||||
$page_title = $user->lang['Index'];
|
$page_title = $user->lang['Index'];
|
||||||
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
|
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
|
||||||
|
|
||||||
|
//page_header($user->lang['INDEX']);
|
||||||
|
|
||||||
$template->set_filenames(array(
|
$template->set_filenames(array(
|
||||||
'body' => 'index_body.html'
|
'body' => 'index_body.html')
|
||||||
));
|
);
|
||||||
|
|
||||||
|
//page_footer();
|
||||||
|
|
||||||
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
|
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
|
||||||
|
|
||||||
|
|
|
@ -206,11 +206,13 @@ CREATE TABLE phpbb_forums (
|
||||||
forum_parents text,
|
forum_parents text,
|
||||||
forum_name varchar(150) NOT NULL,
|
forum_name varchar(150) NOT NULL,
|
||||||
forum_desc text,
|
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_password varchar(32) DEFAULT '' NOT NULL,
|
||||||
forum_style tinyint(4) UNSIGNED,
|
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_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_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||||
forum_topics 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,
|
forum_topics_real mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||||
|
|
|
@ -83,6 +83,11 @@ $lang = array_merge($lang, array(
|
||||||
'RANKS' => 'Ranks',
|
'RANKS' => 'Ranks',
|
||||||
'PRUNE_USERS' => 'Prune users',
|
'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',
|
'ADMINISTRATORS' => 'Administrators',
|
||||||
|
|
||||||
'LOOK_UP_FORUM' => 'Select a Forum',
|
'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 />» %s ',
|
'LOG_BAN_USER' => '<b>Banned User</b> for reason %s<br />» %s ',
|
||||||
'LOG_BAN_IP' => '<b>Banned ip</b> for reason %s<br />» %s',
|
'LOG_BAN_IP' => '<b>Banned ip</b> for reason %s<br />» %s',
|
||||||
'LOG_BAN_EMAIL' => '<b>Banned email</b> for reason %s<br />» %s',
|
'LOG_BAN_EMAIL' => '<b>Banned email</b> for reason %s<br />» %s',
|
||||||
|
|
||||||
'LOG_UNBAN_USER' => '<b>Unbanned user</b><br />» %s',
|
'LOG_UNBAN_USER' => '<b>Unbanned user</b><br />» %s',
|
||||||
'LOG_UNBAN_IP' => '<b>Unbanned ip</b><br />» %s',
|
'LOG_UNBAN_IP' => '<b>Unbanned ip</b><br />» %s',
|
||||||
'LOG_UNBAN_EMAIL' => '<b>Unbanned email</b><br />» %s',
|
'LOG_UNBAN_EMAIL' => '<b>Unbanned email</b><br />» %s',
|
||||||
|
@ -124,13 +128,17 @@ $lang = array_merge($lang, array(
|
||||||
'LOG_EMAIL_CONFIG' => '<b>Altered email settings</b>',
|
'LOG_EMAIL_CONFIG' => '<b>Altered email settings</b>',
|
||||||
'LOG_AVATAR_CONFIG' => '<b>Altered avatar settings</b>',
|
'LOG_AVATAR_CONFIG' => '<b>Altered avatar settings</b>',
|
||||||
'LOG_AUTH_CONFIG' => '<b>Altered authentication settings</b>',
|
'LOG_AUTH_CONFIG' => '<b>Altered authentication settings</b>',
|
||||||
|
|
||||||
'LOG_ATTACH_CONFIG' => '<b>Altered attachment settings</b>',
|
'LOG_ATTACH_CONFIG' => '<b>Altered attachment settings</b>',
|
||||||
|
|
||||||
'log_prune_user_deac' => '<b>Users Deactivated</b><br />%s',
|
'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_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_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_RESYNC_STATS' => '<b>Post, topic and user stats reset</b>',
|
||||||
'LOG_RESET_DATE' => '<b>Board start date reset</b>',
|
'LOG_RESET_DATE' => '<b>Board start date reset</b>',
|
||||||
'LOG_RESET_ONLINE' => '<b>Most users online reset</b>',
|
'LOG_RESET_ONLINE' => '<b>Most users online reset</b>',
|
||||||
|
|
||||||
'LOG_ACL_MOD_DEL' => '<b>Removed Moderators</b> from %s<br />» %s',
|
'LOG_ACL_MOD_DEL' => '<b>Removed Moderators</b> from %s<br />» %s',
|
||||||
'LOG_ACL_MOD_ADD' => '<b>Added or edited Moderators</b> from %s<br />» %s',
|
'LOG_ACL_MOD_ADD' => '<b>Added or edited Moderators</b> from %s<br />» %s',
|
||||||
'LOG_ACL_SUPERMOD_DEL' => '<b>Removed Super Moderators</b><br />» %s',
|
'LOG_ACL_SUPERMOD_DEL' => '<b>Removed Super Moderators</b><br />» %s',
|
||||||
|
@ -148,10 +156,19 @@ $lang = array_merge($lang, array(
|
||||||
'LOG_ATTACH_EXTGROUP_ADD' => '<b>Added or edited extension group</b><br />» %s',
|
'LOG_ATTACH_EXTGROUP_ADD' => '<b>Added or edited extension group</b><br />» %s',
|
||||||
'LOG_ATTACH_EXTGROUP_DEL' => '<b>Removed extension group</b><br />» %s',
|
'LOG_ATTACH_EXTGROUP_DEL' => '<b>Removed extension group</b><br />» %s',
|
||||||
|
|
||||||
'RUN_HOW' => 'When to run',
|
'LOG_FORUM_ADD' => '<b>Created new forum</b><br />» %s',
|
||||||
'RUN_AS_NOW'=> 'Run now',
|
'LOG_FORUM_MOVE_UP' => '<b>Moved forum</b> %s <b>above</b> %s',
|
||||||
'RUN_AS_EVT'=> 'Run as Event',
|
'LOG_FORUM_MOVE_DOWN' => '<b>Moved forum</b> %s <b>below</b> %s',
|
||||||
'RUN_AS_CRN'=> 'Run as Cron',
|
'LOG_FORUM_EDIT' => '<b>Edited forum details</b><br />» %s',
|
||||||
|
'LOG_FORUM_SYNC' => '<b>Re-synchronised forum</b><br />» %s',
|
||||||
|
'LOG_FORUM_DEL_POSTS' => '<b>Deleted forum and its messages</b><br />» %s',
|
||||||
|
'LOG_FORUM_DEL_FORUMS' => '<b>Deleted forum and its subforums</b><br />» %s',
|
||||||
|
'LOG_FORUM_DEL_POSTS_MOVE_FORUMS' => '<b>Deleted forum and its messages, moved subforums</b> to %s<br />» %s',
|
||||||
|
'LOG_FORUM_DEL_MOVE_POSTS_FORUMS' => '<b>Deleted forum and its subforums, moved messages</b> to %s<br />» %s',
|
||||||
|
'LOG_FORUM_DEL_MOVE_POSTS' => '<b>Deleted forum and moved posts </b> to %s<br />» %s',
|
||||||
|
'LOG_FORUM_DEL_MOVE_FORUMS' => '<b>Deleted forum and moved subforums</b> to %s<br />» %s',
|
||||||
|
'LOG_FORUM_DEL_POSTS_FORUMS'=> '<b>Deleted forum, its messages and subforums</b><br />» %s',
|
||||||
|
'LOG_FORUM_DEL_MOVE_POSTS_MOVE_FORUMS' => '<b>Deleted forum, moved posts</b> to %s <b>and subforums</b> to %s<br />» %s',
|
||||||
|
|
||||||
|
|
||||||
'WELCOME_PHPBB' => 'Welcome to phpBB',
|
'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.',
|
'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' => 'Users send email via board',
|
||||||
'BOARD_EMAIL_FORM_EXPLAIN' => 'This function keeps email addresses completely private.',
|
'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' => 'Email Signature',
|
||||||
'EMAIL_SIG_EXPLAIN' => 'This text will be attached to all emails the board sends',
|
'EMAIL_SIG_EXPLAIN' => 'This text will be attached to all emails the board sends.',
|
||||||
'CONTACT_EMAIL' => 'Abuse email address',
|
'CONTACT_EMAIL' => 'Contact email address',
|
||||||
'CONTACT_EMAIL_EXPLAIN' => 'This address will be used whenever a specific contact point is needed, e.g. spam, failures, etc.',
|
'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' => '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_SERVER' => 'SMTP Server Address',
|
||||||
'SMTP_PORT' => 'SMTP Server Port',
|
'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' => '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' => '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.',
|
'BOARD_SETTINGS_EXPLAIN' => 'Here you can determine the basic operation of your board, from the site name through user registration to private messaging.',
|
||||||
|
@ -582,55 +600,70 @@ $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.',
|
'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',
|
'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_category' => 'Edit category',
|
'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.',
|
||||||
'Create_forum' => 'Create new forum',
|
'FORUM_DELETE' => 'Delete Forum',
|
||||||
'Remove' => 'Remove',
|
'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.',
|
||||||
'Config_updated' => 'Forum configuration updated successfully',
|
|
||||||
|
'EDIT_FORUM' => 'Edit forum',
|
||||||
|
'CREATE_FORUM' => 'Create new forum',
|
||||||
|
'REMOVE' => 'Remove',
|
||||||
'EDIT' => 'Edit',
|
'EDIT' => 'Edit',
|
||||||
'MOVE_UP' => 'Move up',
|
'MOVE_UP' => 'Move up',
|
||||||
'MOVE_DOWN' => 'Move down',
|
'MOVE_DOWN' => 'Move down',
|
||||||
'Resync' => 'Sync',
|
'RESYNC' => 'Sync',
|
||||||
'Category_name' => 'Category name',
|
'UPDATE' => 'Update',
|
||||||
|
|
||||||
|
'FORUM_SETTINGS' => 'Forum Settings',
|
||||||
|
'FORUM_GENERAL' => 'General Forum Settings',
|
||||||
'FORUM_TYPE' => 'Forum Type',
|
'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_STATUS' => 'Forum Status',
|
||||||
'FORUM_STYLE' => 'Forum Style',
|
'FORUM_STYLE' => 'Forum Style',
|
||||||
'FORUM_IMAGE' => 'Forum Image',
|
'FORUM_IMAGE' => 'Forum Image',
|
||||||
'Parent' => 'Parent',
|
'FORUM_IMAGE_EXPLAIN'=> 'Location, relative to the phpBB root directory, of an image to associate with this forum.',
|
||||||
'No_parent' => 'No parent',
|
'FORUM_PARENT' => 'Parent Forum',
|
||||||
'Locked' => 'Locked',
|
'NO_PARENT' => 'No Parent',
|
||||||
'Unlocked' => 'Unlocked',
|
'LOCKED' => 'Locked',
|
||||||
'General_settings' => 'General settings',
|
'UNLOCKED' => 'Unlocked',
|
||||||
'Forum_settings' => 'Forum settings',
|
'ENABLE_TOPIC_ICONS'=> 'Enable Topic Icons',
|
||||||
'IS_POSTABLE' => 'Can Post',
|
'LIST_INDEX' => 'List Forum On Index',
|
||||||
'NOT_POSTABLE' => 'Cannot Post',
|
'LIST_INDEX_EXPLAIN'=> 'Displays a link to this forum under the root parent forum on the index.',
|
||||||
'ENABLE_TOPIC_ICONS' => 'Enable topic icons',
|
'FORUM_AUTO_PRUNE' => 'Enable Auto-Pruning',
|
||||||
'DISABLE_POST_COUNT' => 'Disable user post count incrementing',
|
'FORUM_AUTO_PRUNE_EXPLAIN' => 'Prunes the forum of topics, set the frequency/age parameters below.',
|
||||||
'FORUM_MODERATED' => 'Enable moderation queue',
|
'AUTO_PRUNE_FREQ' => 'Auto-prune Frequency',
|
||||||
'Display_on_index' => 'Display link to forum on index',
|
'AUTO_PRUNE_FREQ_EXPLAIN' => 'Time in days between pruning events.',
|
||||||
'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',
|
'AUTO_PRUNE_DAYS' => 'Auto-prune Post Age',
|
||||||
'Forum_general' => 'General Forum Settings',
|
'AUTO_PRUNE_DAYS_EXPLAIN' => 'Number of days since last post after which topic is removed.',
|
||||||
'Forum_name' => 'Forum name',
|
'FORUM_TOPICS_PAGE' => 'Topics Per Page',
|
||||||
'Forum_desc' => 'Description',
|
'FORUM_TOPICS_PAGE_EXPLAIN' => 'If non-zero this value will override the default topics per page setting.',
|
||||||
'Forum_pruning' => 'Auto-pruning',
|
'FORUM_PASSWORD' => 'Forum Password',
|
||||||
'prune_freq' => 'Check for topic age every',
|
'FORUM_PASSWORD_EXPLAIN' => 'Defines a password for this forum, use the permission system in preference.',
|
||||||
'prune_days' => 'Remove topics that have not been posted to in',
|
'FORUM_PASSWORD_CONFIRM' => 'Confirm Forum Password',
|
||||||
'SET_NON_POSTABLE' => 'Set this forum as non-postable and',
|
'FORUM_PASSWORD_CONFIRM_EXPLAIN' => 'Only needs to be set if a forum password is entered.',
|
||||||
'Forum_delete' => 'Delete Forum',
|
|
||||||
|
|
||||||
'UPDATE' => 'Update',
|
'MOVE_POSTS_TO' => 'Move posts',
|
||||||
|
'MOVE_SUBFORUMS_TO' => 'Move subforums',
|
||||||
|
'DELETE_ALL_POSTS' => 'Delete posts',
|
||||||
|
'DELETE_SUBFORUMS' => 'Delete subforums and posts',
|
||||||
|
|
||||||
'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.',
|
'NO_DESTINATION_FORUM' => 'You have not specified a forum to move content to',
|
||||||
'Move_and_Delete' => 'Move and Delete',
|
'FORUM_PASSWORD_MISMATCH' => 'The passwords you entered did not match.',
|
||||||
'Move_posts_to' => 'Move posts to',
|
'FORUM_NAME_EMPTY' => 'You must enter a name for this forum.',
|
||||||
'Move_subforums_to' => 'Move subforums to',
|
'FORUM_DATA_NEGATIVE' => 'Pruning parameters cannot be negative.',
|
||||||
'Delete_all_posts' => 'Delete all posts',
|
'FORUM_UPDATED' => 'Forum informations updated successfully.',
|
||||||
'Delete_subforums' => 'Delete subforums and associated posts',
|
'REDIRECT_ACL' => 'To set permissions for this forum click %sHERE%s.',
|
||||||
'No_destination_forum' => 'You have not specified a forum to move content to',
|
'FORUM_DELETED' => 'Forum successfully deleted',
|
||||||
'FORUM_UPDATED' => 'Forum informations updated successfully',
|
|
||||||
'Forum_deleted' => 'Forum successfully deleted',
|
|
||||||
'Click_return_forumadmin' => 'Click %sHere%s to return to Forum Administration',
|
|
||||||
|
|
||||||
|
|
||||||
'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.',
|
||||||
|
|
|
@ -115,11 +115,10 @@ $lang = array(
|
||||||
'RETURN_MCP' => 'Click %sHere%s to return to the Moderator Control Panel',
|
'RETURN_MCP' => 'Click %sHere%s to return to the Moderator Control Panel',
|
||||||
'RETURN_GROUP' => 'Click %sHere%s to return to the Group Control Panel',
|
'RETURN_GROUP' => 'Click %sHere%s to return to the Group Control Panel',
|
||||||
'VIEW_MESSAGE' => 'Click %sHere%s to view your message',
|
'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_DISABLE' => 'Sorry but this board is currently unavailable',
|
||||||
'BOARD_UNAVAILABLE' => 'Sorry but the board is temporarily unavailable, please try again in a few minutes',
|
'BOARD_UNAVAILABLE' => 'Sorry but the board is temporarily unavailable, please try again in a few minutes',
|
||||||
'BOARD_BAN_TIME' => 'You have been banned from this board until <b>%1$s</b>.<br /><br />Please contact the %2$sBoard Administrator%3$s for more information.',
|
'BOARD_BAN_TIME' => 'You have been banned from this board until <b>%1$s</b>.<br /><br />Please contact the %2$sBoard Administrator%3$s for more information.',
|
||||||
|
@ -214,9 +213,10 @@ $lang = array(
|
||||||
|
|
||||||
|
|
||||||
'LIST_USER' => '1 User',
|
'LIST_USER' => '1 User',
|
||||||
'LIST_USERS' => '%d Users',
|
'LIST_USERS'=> '%d Users',
|
||||||
|
|
||||||
|
|
||||||
|
'REDIRECTS' => 'Total redirects',
|
||||||
'LOGIN' => 'Login',
|
'LOGIN' => 'Login',
|
||||||
'TERMS_USE' => 'Terms of Use',
|
'TERMS_USE' => 'Terms of Use',
|
||||||
'PRIVACY' => 'Privacy Policy',
|
'PRIVACY' => 'Privacy Policy',
|
||||||
|
@ -273,7 +273,7 @@ $lang = array(
|
||||||
'NO_FORUM' => 'The forum you selected does not exist',
|
'NO_FORUM' => 'The forum you selected does not exist',
|
||||||
'NO_TOPICS' => 'There are no topics or posts in this forum.',
|
'NO_TOPICS' => 'There are no topics or posts in this forum.',
|
||||||
'NO_TOPIC' => 'The requested topic does not exist.',
|
'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_POST' => 'The requested post does not exist.',
|
||||||
'NO_USER' => 'The requested user does not exist.',
|
'NO_USER' => 'The requested user does not exist.',
|
||||||
'NO_GROUP' => 'The requested usergroup does not exist.',
|
'NO_GROUP' => 'The requested usergroup does not exist.',
|
||||||
|
@ -295,7 +295,7 @@ $lang = array(
|
||||||
'EMAIL_TOPIC' => 'Email to friend',
|
'EMAIL_TOPIC' => 'Email to friend',
|
||||||
'VIEW_NEXT_TOPIC' => 'View next topic',
|
'VIEW_NEXT_TOPIC' => 'View next topic',
|
||||||
'VIEW_PREVIOUS_TOPIC' => 'View previous 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_NEWER_TOPICS' => 'There are no newer topics in this forum',
|
||||||
'NO_OLDER_TOPICS' => 'There are no older topics in this forum',
|
'NO_OLDER_TOPICS' => 'There are no older topics in this forum',
|
||||||
|
|
|
@ -49,15 +49,14 @@ include($phpbb_root_path . 'extension.inc');
|
||||||
include($phpbb_root_path . 'common.'.$phpEx);
|
include($phpbb_root_path . 'common.'.$phpEx);
|
||||||
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
|
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
|
||||||
|
|
||||||
|
|
||||||
// Start session management
|
// Start session management
|
||||||
$user->start();
|
$user->start();
|
||||||
$user->setup();
|
$user->setup();
|
||||||
$auth->acl($user->data);
|
$auth->acl($user->data);
|
||||||
// End session management
|
|
||||||
|
|
||||||
//
|
|
||||||
// Obtain initial var settings
|
// Obtain initial var settings
|
||||||
//
|
|
||||||
$forum_id = (isset($_REQUEST['f'])) ? max(0, intval($_REQUEST['f'])) : 0;
|
$forum_id = (isset($_REQUEST['f'])) ? max(0, intval($_REQUEST['f'])) : 0;
|
||||||
$topic_id = (!empty($_REQUEST['t'])) ? intval($_REQUEST['t']) : 0;
|
$topic_id = (!empty($_REQUEST['t'])) ? intval($_REQUEST['t']) : 0;
|
||||||
$post_id = (!empty($_REQUEST['p'])) ? intval($_REQUEST['p']) : 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'] : '';
|
$action = (!empty($_GET['action'])) ? $_GET['action'] : '';
|
||||||
$quickmod = (!empty($_REQUEST['quickmod'])) ? TRUE : FALSE;
|
$quickmod = (!empty($_REQUEST['quickmod'])) ? TRUE : FALSE;
|
||||||
|
|
||||||
//
|
|
||||||
// Check if user did or did not confirm
|
// Check if user did or did not confirm
|
||||||
// If they did not, forward them to the last page they were on
|
// If they did not, forward them to the last page they were on
|
||||||
//
|
|
||||||
if (isset($_POST['cancel']))
|
if (isset($_POST['cancel']))
|
||||||
{
|
{
|
||||||
$redirect = '';
|
$redirect = '';
|
||||||
|
@ -196,7 +194,7 @@ switch ($mode)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'viewlogs':
|
case 'viewlogs':
|
||||||
$acl_src = array('m_', 'a_general');
|
$acl_src = array('m_', 'a_');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'fork':
|
case 'fork':
|
||||||
|
@ -206,12 +204,17 @@ switch ($mode)
|
||||||
// Check destination forum or topic if applicable
|
// Check destination forum or topic if applicable
|
||||||
if ($to_topic_id > 0)
|
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))
|
if (!$row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['Topic_not_exist'] . $return_mode);
|
trigger_error($user->lang['Topic_not_exist'] . $return_mode);
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
if (!isset($topic_data[$to_topic_id]))
|
if (!isset($topic_data[$to_topic_id]))
|
||||||
{
|
{
|
||||||
$topic_data[$to_topic_id] = $row;
|
$topic_data[$to_topic_id] = $row;
|
||||||
|
@ -224,12 +227,16 @@ if ($to_forum_id > 0)
|
||||||
{
|
{
|
||||||
if (!isset($forum_data[$to_forum_id]))
|
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))
|
if (!$row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['FORUM_NOT_EXIST'] . $return_mode);
|
trigger_error($user->lang['FORUM_NOT_EXIST'] . $return_mode);
|
||||||
}
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$forum_data[$to_forum_id] = $row;
|
$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"
|
// Using isset() rather than !empty() because of the jumpbox having f="0" for "All forums"
|
||||||
list($void, $forum_id) = each($forum_id_list);
|
list($void, $forum_id) = each($forum_id_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$topic_id && count($topic_id_list) == 1)
|
if (!$topic_id && count($topic_id_list) == 1)
|
||||||
{
|
{
|
||||||
list($void, $topic_id) = each($topic_id_list);
|
list($void, $topic_id) = each($topic_id_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$post_id && count($post_id_list) == 1)
|
if (!$post_id && count($post_id_list) == 1)
|
||||||
{
|
{
|
||||||
list($void, $post_id) = each($post_id_list);
|
list($void, $post_id) = each($post_id_list);
|
||||||
|
@ -409,7 +418,7 @@ $tabs[] = array(
|
||||||
'url' => $mcp_url . '&mode=viewlogs'
|
'url' => $mcp_url . '&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(
|
$tabs[] = array(
|
||||||
'mode' => 'forum_view',
|
'mode' => 'forum_view',
|
||||||
|
@ -455,7 +464,7 @@ if (!$mode)
|
||||||
{
|
{
|
||||||
$mode = 'topic_view';
|
$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';
|
$mode = 'forum_view';
|
||||||
}
|
}
|
||||||
|
@ -493,8 +502,8 @@ foreach ($tabs as $tab)
|
||||||
$template->assign_block_vars('tab', array(
|
$template->assign_block_vars('tab', array(
|
||||||
'S_IS_SELECTED' => ($tab['mode'] == $mode) ? TRUE : FALSE,
|
'S_IS_SELECTED' => ($tab['mode'] == $mode) ? TRUE : FALSE,
|
||||||
'NAME' => $tab['title'],
|
'NAME' => $tab['title'],
|
||||||
'U_LINK' => $tab['url']
|
'U_LINK' => $tab['url'])
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -611,7 +620,7 @@ switch ($mode)
|
||||||
}
|
}
|
||||||
else
|
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);
|
trigger_error($user->lang['FORUM_NOT_POSTABLE'] . $return_mcp);
|
||||||
}
|
}
|
||||||
|
@ -760,7 +769,7 @@ switch ($mode)
|
||||||
}
|
}
|
||||||
else
|
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);
|
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&f=$forum_id\">", '</a>');
|
|
||||||
$return_topic = sprintf($user->lang['RETURN_TOPIC'], "<a href=\"viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&start=$start\">", '</a>');
|
|
||||||
|
|
||||||
$template->assign_vars(array(
|
|
||||||
'META' => "<meta http-equiv=\"refresh\" content=\"3;url=viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&start=$start\">"
|
|
||||||
));
|
|
||||||
|
|
||||||
add_log('mod', $forum_id, $topic_id, 'logm_' . $mode);
|
add_log('mod', $forum_id, $topic_id, 'logm_' . $mode);
|
||||||
|
|
||||||
trigger_error($user->lang['TOPIC_TYPE_CHANGED'] . '<br /><br />' . $return_topic . '<br /><br />' . $return_forum);
|
meta_refresh(3, "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&start=$start");
|
||||||
|
|
||||||
|
$message = $user->lang['TOPIC_TYPE_CHANGED'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], "<a href=\"viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&start=$start\">", '</a>') . '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], "<a href=\"viewforum.$phpEx$SID&f=$forum_id\">", '</a>');
|
||||||
|
trigger_error($message);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'disapprove':
|
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&f=$forum_id";
|
$redirect_page = "mcp.$phpEx$SID&f=$forum_id";
|
||||||
$l_redirect = sprintf($user->lang['RETURN_MCP'], '<a href="mcp.' . $phpEx . $SID . '&f=' . $forum_id . '">', '</a>');
|
$l_redirect = sprintf($user->lang['RETURN_MCP'], "<a href=\"mcp.$phpEx$SID&f=$forum_id\">", '</a>');
|
||||||
|
|
||||||
if (!count($post_id_list))
|
if (!count($post_id_list))
|
||||||
{
|
{
|
||||||
|
@ -897,6 +902,7 @@ switch ($mode)
|
||||||
$post_ids[] = $p_id;
|
$post_ids[] = $p_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($post_id_list as $p_id)
|
foreach ($post_id_list as $p_id)
|
||||||
{
|
{
|
||||||
if (!in_array($topic_ids, $post_data[$p_id]['topic_id']))
|
if (!in_array($topic_ids, $post_data[$p_id]['topic_id']))
|
||||||
|
@ -904,21 +910,21 @@ switch ($mode)
|
||||||
$post_ids[] = $p_id;
|
$post_ids[] = $p_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($topic_ids))
|
if (count($topic_ids))
|
||||||
{
|
{
|
||||||
delete_topics('topic_id', $topic_ids);
|
delete_topics('topic_id', $topic_ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($post_ids))
|
if (count($post_ids))
|
||||||
{
|
{
|
||||||
delete_posts('post_id', $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
|
// 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'];
|
$msg = (count($post_id_list) == 1) ? $user->lang['POST_REMOVED'] : $user->lang['POSTS_REMOVED'];
|
||||||
trigger_error($msg . '<br /><br />' . $l_redirect);
|
trigger_error($msg . '<br /><br />' . $l_redirect);
|
||||||
}
|
}
|
||||||
|
@ -938,8 +944,8 @@ switch ($mode)
|
||||||
'MESSAGE_TEXT' => (count($post_id_list) == 1) ? $user->lang['CONFIRM_DELETE_POST'] : $user->lang['CONFIRM_DELETE_POSTS'],
|
'MESSAGE_TEXT' => (count($post_id_list) == 1) ? $user->lang['CONFIRM_DELETE_POST'] : $user->lang['CONFIRM_DELETE_POSTS'],
|
||||||
|
|
||||||
'S_CONFIRM_ACTION' => "mcp.$phpEx$SID&mode=disapprove",
|
'S_CONFIRM_ACTION' => "mcp.$phpEx$SID&mode=disapprove",
|
||||||
'S_HIDDEN_FIELDS' => $hidden_fields
|
'S_HIDDEN_FIELDS' => $hidden_fields)
|
||||||
));
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'approve':
|
case 'approve':
|
||||||
|
@ -979,7 +985,7 @@ switch ($mode)
|
||||||
|
|
||||||
add_log('mod', $forum_id, $post_data[$post_id]['topic_id'], $logm_mode, $post_id);
|
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;
|
$forum_data[$post_data[$post_id]['forum_id']]['enable_post_count'] = 1;
|
||||||
if ($forum_data[$post_data[$post_id]['forum_id']]['enable_post_count'])
|
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);
|
$resync_count[$post_count] = array($user_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($resync_count as $post_count => $user_list)
|
foreach ($resync_count as $post_count => $user_list)
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE ' . USERS_TABLE . "
|
$sql = 'UPDATE ' . USERS_TABLE . "
|
||||||
|
@ -1580,7 +1587,7 @@ switch ($mode)
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['SELECT_DESTINATION_FORUM'] . $return_split);
|
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);
|
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;
|
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 . '
|
FROM ' . FORUMS_TABLE . '
|
||||||
ORDER BY left_id ASC';
|
ORDER BY left_id ASC';
|
||||||
$result = $db->sql_query($sql, 120);
|
$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 = '';
|
$padding = $forum_list = $holding = '';
|
||||||
while ($row = $db->sql_fetchrow($result))
|
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
|
// Non-postable forum with no subforums, don't display
|
||||||
continue;
|
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
|
// if the user does not have permissions to list this forum skip
|
||||||
continue;
|
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;
|
$row['forum_id'] = -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ $topic_validate = false;
|
||||||
$post_validate = false;
|
$post_validate = false;
|
||||||
|
|
||||||
// Easier validation
|
// 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');
|
$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');
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ if ($sql != '')
|
||||||
// Get Attachment Data
|
// Get Attachment Data
|
||||||
$message_parser->attachment_data = (isset($_POST['attachment_data'])) ? $_POST['attachment_data'] : array();
|
$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.*
|
$sql = 'SELECT d.*
|
||||||
FROM ' . ATTACHMENTS_TABLE . ' a, ' . ATTACHMENTS_DESC_TABLE . ' d
|
FROM ' . ATTACHMENTS_TABLE . ' a, ' . ATTACHMENTS_DESC_TABLE . ' d
|
||||||
|
@ -252,7 +252,7 @@ if ($sql != '')
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($poster_id == ANONYMOUS) || (!$poster_id))
|
if ($poster_id == ANONYMOUS || !$poster_id)
|
||||||
{
|
{
|
||||||
$username = ($post_validate) ? trim($post_username) : '';
|
$username = ($post_validate) ? trim($post_username) : '';
|
||||||
}
|
}
|
||||||
|
@ -304,32 +304,32 @@ $perm = array(
|
||||||
'f_save' => $auth->acl_get('f_save', $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)]);
|
trigger_error($user->lang['USER_CANNOT_' . strtoupper($mode)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Forum/Topic locked?
|
// 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';
|
$message = ($forum_status == ITEM_LOCKED) ? 'FORUM_LOCKED' : 'TOPIC_LOCKED';
|
||||||
trigger_error($user->lang[$message]);
|
trigger_error($user->lang[$message]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can we edit this post?
|
// 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']);
|
trigger_error($user->lang['CANNOT_EDIT_TIME']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do we want to edit our post ?
|
// 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']);
|
trigger_error($user->lang['USER_CANNOT_EDIT']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is edit posting locked ?
|
// 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']);
|
trigger_error($user->lang['CANNOT_EDIT_POST_LOCKED']);
|
||||||
}
|
}
|
||||||
|
@ -340,7 +340,7 @@ if ($mode == 'edit')
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete triggered ?
|
// 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 ?
|
// Do we need to confirm ?
|
||||||
if ($confirm)
|
if ($confirm)
|
||||||
|
@ -374,7 +374,8 @@ 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';
|
$forum_update_sql .= 'forum_topics = forum_topics - 1, forum_topics_real = forum_topics_real - 1';
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: delete common words... maybe just call search_tidy ?
|
// 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);
|
// $search->del_words($post_id);
|
||||||
|
|
||||||
// Sync last post informations
|
// Sync last post informations
|
||||||
|
@ -399,11 +400,11 @@ if ( ($mode == 'delete') && ((($poster_id == $user->data['user_id']) && ($user->
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
// If Post is first post, but not the only post... make next post the topic starter one. ;)
|
// 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_sql = array(
|
||||||
'topic_first_post_id' => intval($row['post_id']),
|
'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_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'])
|
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 . '&f=' . $forum_id . '">';
|
$meta_info = '<meta http-equiv="refresh" content="5; url=viewforum.' . $phpEx . $SID . '&f=' . $forum_id . '">';
|
||||||
|
|
||||||
$message = $user->lang['DELETED'];
|
$message = $user->lang['DELETED'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$meta_info = '<meta http-equiv="refresh" content="5; url=viewtopic.' . $phpEx . $SID . '&f=' . $forum_id . '&t=' . $topic_id . '&p=' . $post_data['next_post_id'] . '#' . $post_data['next_post_id'] . '">';
|
$meta_info = '<meta http-equiv="refresh" content="5; url=viewtopic.' . $phpEx . $SID . '&f=' . $forum_id . '&t=' . $topic_id . '&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 . '&f=' . $forum_id . '&t=' . $topic_id . '&p=' . $post_data['next_post_id'] . '#' . $post_data['next_post_id'] . '">', '</a>');
|
$message = $user->lang['DELETED'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="viewtopic.' . $phpEx . $SID . '&f=' . $forum_id . '&t=' . $topic_id . '&p=' . $post_data['next_post_id'] . '#' . $post_data['next_post_id'] . '">', '</a>');
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_vars(array(
|
meta_refresh(4, $meta_info);
|
||||||
'META' => $meta_info)
|
|
||||||
);
|
|
||||||
|
|
||||||
$message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="viewforum.' . $phpEx . $SID . '&f=' . $forum_id . '">', '</a>');
|
$message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="viewforum.' . $phpEx . $SID . '&f=' . $forum_id . '">', '</a>');
|
||||||
|
|
||||||
trigger_error($message);
|
trigger_error($message);
|
||||||
|
@ -485,12 +485,12 @@ if ( ($mode == 'delete') && ((($poster_id == $user->data['user_id']) && ($user->
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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']);
|
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']);
|
trigger_error($user->lang['CANNOT_DELETE_REPLIED']);
|
||||||
}
|
}
|
||||||
|
@ -500,7 +500,7 @@ if ($mode == 'delete')
|
||||||
trigger_error('USER_CANNOT_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;
|
$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']))) : '';
|
$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;
|
$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
|
// Delete Poll
|
||||||
$sql = "DELETE FROM " . POLL_OPTIONS_TABLE . "
|
$sql = "DELETE FROM " . POLL_OPTIONS_TABLE . "
|
||||||
|
@ -553,7 +553,9 @@ if (($submit) || ($preview) || ($refresh))
|
||||||
'poll_max_options' => 0
|
'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);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
$poll_title = '';
|
$poll_title = '';
|
||||||
|
@ -575,7 +577,7 @@ if (($submit) || ($preview) || ($refresh))
|
||||||
// If replying/quoting and last post id has changed
|
// If replying/quoting and last post id has changed
|
||||||
// give user option of continuing submit or return to post
|
// give user option of continuing submit or return to post
|
||||||
// notify and show user the post made between his request and the final submit
|
// 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(
|
$template->assign_vars(array(
|
||||||
'S_POST_REVIEW' => true)
|
'S_POST_REVIEW' => true)
|
||||||
|
@ -662,7 +664,7 @@ if (($submit) || ($preview) || ($refresh))
|
||||||
$err_msg .= ((!empty($err_msg)) ? '<br />' : '') . $result;
|
$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
|
// Flood check
|
||||||
$where_sql = ($user->data['user_id'] == ANONYMOUS) ? "poster_ip = '$user->ip'" : 'poster_id = ' . $user->data['user_id'];
|
$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
|
// 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'];
|
$err_msg .= ((!empty($err_msg)) ? '<br />' : '') . $user->lang['EMPTY_SUBJECT'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,17 @@
|
||||||
<td class="cat" colspan="2" 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"> </td>
|
<td class="rowpic" colspan="3" align="right"> </td>
|
||||||
</tr>
|
</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 -->
|
<!-- ELSE -->
|
||||||
<tr>
|
<tr>
|
||||||
<td class="row1" width="50" height="50" align="center" valign="middle">{forumrow.FORUM_FOLDER_IMG}</td>
|
<td class="row1" width="50" height="50" align="center" valign="middle">{forumrow.FORUM_FOLDER_IMG}</td>
|
||||||
|
|
|
@ -29,7 +29,7 @@ function checkForm()
|
||||||
alert('{L_EMPTY_MESSAGE}');
|
alert('{L_EMPTY_MESSAGE}');
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
bbstyle(-1);
|
// document.post.post.disabled = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,19 @@
|
||||||
<!-- BEGIN forumrow -->
|
<!-- BEGIN forumrow -->
|
||||||
<!-- IF forumrow.S_IS_CAT -->
|
<!-- IF forumrow.S_IS_CAT -->
|
||||||
<tr>
|
<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"> </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>
|
</tr>
|
||||||
<!-- ELSE -->
|
<!-- ELSE -->
|
||||||
<tr>
|
<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>
|
</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.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"><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>
|
</tr>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<!-- END forumrow -->
|
<!-- END forumrow -->
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<td class="cat" colspan="2" height="28"><table width="100%" cellspacing="0" cellpadding="0" border="0">
|
<td class="cat" colspan="2" height="28"><table width="100%" cellspacing="0" cellpadding="0" border="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td><span class="nav"> <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><span class="nav"> <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> </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> </span></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table></td>
|
</table></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -89,23 +89,47 @@ else
|
||||||
}
|
}
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
if (!$forum_data = $db->sql_fetchrow($result))
|
if (!($forum_data = $db->sql_fetchrow($result)))
|
||||||
{
|
{
|
||||||
trigger_error('NO_FORUM');
|
trigger_error('NO_FORUM');
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$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.
|
// Configure style, language, etc.
|
||||||
$user->setup(false, $forum_data['forum_style']);
|
$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
|
// Permissions check
|
||||||
if (!$auth->acl_gets('f_read', $forum_id))
|
if (!$auth->acl_gets('f_read', $forum_id))
|
||||||
{
|
{
|
||||||
if ($user->data['user_id'] != ANONYMOUS)
|
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']);
|
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
|
// Output forum listing if it is postable
|
||||||
if ($forum_data['forum_postable'])
|
if ($forum_data['forum_type'] == FORUM_POST)
|
||||||
{
|
{
|
||||||
// Handle marking posts
|
// Handle marking posts
|
||||||
if ($mark_read == 'topics')
|
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');
|
$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
|
// Basic pagewide vars
|
||||||
$post_alt = (intval($forum_data['forum_status']) == ITEM_LOCKED) ? 'FORUM_LOCKED' : 'POST_NEW_TOPIC';
|
$post_alt = (intval($forum_data['forum_status']) == ITEM_LOCKED) ? 'FORUM_LOCKED' : 'POST_NEW_TOPIC';
|
||||||
|
|
||||||
|
@ -266,6 +297,7 @@ if ($forum_data['forum_postable'])
|
||||||
$total_topics = 0;
|
$total_topics = 0;
|
||||||
$row_ary = array();
|
$row_ary = array();
|
||||||
|
|
||||||
|
// TODO - Oracle support
|
||||||
$sql_approved = ($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1';
|
$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_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' : '';
|
$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');
|
$folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS');
|
||||||
|
|
||||||
|
|
||||||
|
// Posted image?
|
||||||
if (!empty($row['mark_type']))
|
if (!empty($row['mark_type']))
|
||||||
{
|
{
|
||||||
$folder_img .= '_posted';
|
$folder_img .= '_posted';
|
||||||
|
@ -466,7 +499,7 @@ if ($forum_data['forum_postable'])
|
||||||
'S_ROW_COUNT' => $i,
|
'S_ROW_COUNT' => $i,
|
||||||
'S_TOPIC_TYPE_SWITCH' => ($s_type_switch == $s_type_switch_test) ? -1 : $s_type_switch_test,
|
'S_TOPIC_TYPE_SWITCH' => ($s_type_switch == $s_type_switch_test) ? -1 : $s_type_switch_test,
|
||||||
'S_TOPIC_TYPE' => $row['topic_type'],
|
'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_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,
|
'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
|
// Mozilla navigation links
|
||||||
$nav_links['up'] = array(
|
$nav_links['up'] = array(
|
||||||
'url' => 'index.' . $phpEx . $SID,
|
'url' => 'index.' . $phpEx . $SID,
|
||||||
'title' => sprintf($user->lang['FORUM_INDEX'], $config['sitename'])
|
'title' => sprintf($user->lang['FORUM_INDEX'], $config['sitename'])
|
||||||
);
|
);
|
||||||
|
*/
|
||||||
|
|
||||||
// Dump out the page header and load viewforum template
|
// Dump out the page header and load viewforum template
|
||||||
$page_title = $user->lang['VIEW_FORUM'] . ' - ' . $forum_data['forum_name'];
|
$page_title = $user->lang['VIEW_FORUM'] . ' - ' . $forum_data['forum_name'];
|
||||||
|
|
|
@ -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_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');
|
$sort_by_sql = array('a' => 'u.username', 't' => 'p.post_id', 's' => 'p.post_subject');
|
||||||
|
|
||||||
$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);
|
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
|
// Obtain correct post count and ordering SQL if user has
|
||||||
// requested anything different
|
// 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>' : '';
|
$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.
|
// If we've got a hightlight set pass it on to pagination.
|
||||||
$pagination_url = "viewtopic.$phpEx$SID&t=$topic_id&st=$sort_days&sk=$sort_key&sd=$sort_dir" . (($highlight_match) ? "&hilit=$highlight" : '');
|
$pagination_url = "viewtopic.$phpEx$SID&t=$topic_id&" . (($highlight_match) ? "&hilit=$highlight" : '');
|
||||||
$pagination = generate_pagination($pagination_url, $total_posts, $config['posts_per_page'], $start);
|
$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,
|
'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),
|
'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),
|
'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 . "&f=$forum_id&t=$topic_id&start=$start&st=$sort_days&sk=$sort_key&sd=$sort_dir&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 . "&f=$forum_id&t=$topic_id&start=$start&$u_sort_param&posts_per_page=" . $config['posts_per_page'] . '">', '</a>') : '',
|
||||||
'MODERATORS' => (sizeof($forum_moderators[$forum_id])) ? implode(', ', $forum_moderators[$forum_id]) : '',
|
'MODERATORS' => (sizeof($forum_moderators[$forum_id])) ? implode(', ', $forum_moderators[$forum_id]) : '',
|
||||||
|
|
||||||
'POST_IMG' => $post_img,
|
'POST_IMG' => $post_img,
|
||||||
|
@ -430,12 +430,12 @@ $template->assign_vars(array(
|
||||||
|
|
||||||
'U_TOPIC' => $server_path . "viewtopic.$phpEx?f=$forum_id&t=$topic_id",
|
'U_TOPIC' => $server_path . "viewtopic.$phpEx?f=$forum_id&t=$topic_id",
|
||||||
'U_FORUM' => $server_path,
|
'U_FORUM' => $server_path,
|
||||||
|
'U_VIEW_UNREAD_POST' => "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&view=unread",
|
||||||
'U_VIEW_TOPIC' => "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&start=$start&st=$sort_days&sk=$sort_key&sd=$sort_dir&hilit=$highlight",
|
'U_VIEW_TOPIC' => "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&start=$start&$u_sort_param&hilit=$highlight",
|
||||||
'U_VIEW_FORUM' => $view_forum_url,
|
'U_VIEW_FORUM' => $view_forum_url,
|
||||||
'U_VIEW_OLDER_TOPIC' => $view_prev_topic_url,
|
'U_VIEW_OLDER_TOPIC' => $view_prev_topic_url,
|
||||||
'U_VIEW_NEWER_TOPIC' => $view_next_topic_url,
|
'U_VIEW_NEWER_TOPIC' => $view_next_topic_url,
|
||||||
'U_PRINT_TOPIC' => "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&st=$sort_days&sk=$sort_key&sd=$sort_dir&view=print",
|
'U_PRINT_TOPIC' => "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&$u_sort_param&view=print",
|
||||||
'U_EMAIL_TOPIC' => "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&view=email",
|
'U_EMAIL_TOPIC' => "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id&view=email",
|
||||||
|
|
||||||
'U_POST_NEW_TOPIC' => $new_topic_url,
|
'U_POST_NEW_TOPIC' => $new_topic_url,
|
||||||
|
@ -577,10 +577,13 @@ if (!empty($poll_start))
|
||||||
'S_CAN_VOTE' => $s_can_vote,
|
'S_CAN_VOTE' => $s_can_vote,
|
||||||
'S_DISPLAY_RESULTS' => $s_display_results,
|
'S_DISPLAY_RESULTS' => $s_display_results,
|
||||||
'S_IS_MULTI_CHOICE' => ($poll_max_options > 1) ? true : false,
|
'S_IS_MULTI_CHOICE' => ($poll_max_options > 1) ? true : false,
|
||||||
'S_POLL_ACTION' => "viewtopic.$phpEx$SID&t=$topic_id&sk=$sort_key&sd=$sort_dir",
|
'S_POLL_ACTION' => "viewtopic.$phpEx$SID&t=$topic_id&$u_sort_param",
|
||||||
|
|
||||||
'U_VIEW_RESULTS' => "viewtopic.$phpEx$SID&t=$topic_id&st=$sort_days&sk=$sort_key&sd=$sort_dir&vote=viewresult")
|
'U_VIEW_RESULTS' => "viewtopic.$phpEx$SID&t=$topic_id&$u_sort_param&vote=viewresult")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
unset($poll_info);
|
||||||
|
unset($voted_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -814,6 +817,10 @@ while ($row = $db->sql_fetchrow($result));
|
||||||
$db->sql_freeresult($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
|
// Pull attachment data
|
||||||
if (count($attach_list))
|
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_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>';
|
$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&mode=edit&f=" . $row['forum_id'] . "&p=" . $row['post_id'];
|
$temp_url = "posting.$phpEx$SID&mode=edit&f=" . $row['forum_id'] . "&p=" . $row['post_id'];
|
||||||
$edit_img = '<a href="' . $temp_url . '">' . $user->img('btn_edit', $user->lang['EDIT_DELETE_POST']) . '</a>';
|
$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
|
// If we allow users to disable display of emoticons
|
||||||
// we'll need an appropriate check and preg_replace here
|
// 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)
|
// Highlight active words (primarily for search)
|
||||||
|
@ -1157,6 +1164,7 @@ foreach ($rowset as $key => $row)
|
||||||
|
|
||||||
$template->assign_block_vars('postrow.attachment', array(
|
$template->assign_block_vars('postrow.attachment', array(
|
||||||
'IS_DENIED' => true,
|
'IS_DENIED' => true,
|
||||||
|
|
||||||
'L_DENIED' => sprintf($user->lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension']))
|
'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
|
// 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):
|
// Section between BEGIN and END with (Without the // of course):
|
||||||
// $img_source = $phpbb_root_path . 'download.' . $phpEx . $SID . '&id=' . $attachment['attach_id'];
|
// $img_source = $phpbb_root_path . 'download.' . $phpEx . $SID . '&id=' . $attachment['attach_id'];
|
||||||
//
|
|
||||||
// BEGIN
|
|
||||||
if (!empty($config['ftp_upload']) && trim($config['upload_dir']) == '')
|
if (!empty($config['ftp_upload']) && trim($config['upload_dir']) == '')
|
||||||
{
|
{
|
||||||
$img_source = $phpbb_root_path . 'download.' . $phpEx . $SID . '&id=' . $attachment['attach_id'];
|
$img_source = $phpbb_root_path . "download.$phpEx$SID&id=" . $attachment['attach_id'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$img_source = $filename;
|
$img_source = $filename;
|
||||||
$update_count[] = $attachment['attach_id'];
|
$update_count[] = $attachment['attach_id'];
|
||||||
}
|
}
|
||||||
// END
|
|
||||||
|
|
||||||
$l_downloaded_viewed = $user->lang['VIEWED'];
|
$l_downloaded_viewed = $user->lang['VIEWED'];
|
||||||
$download_link = $img_source;
|
$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
|
// 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):
|
// Section between BEGIN and END with (Without the // of course):
|
||||||
// $thumb_source = $phpbb_root_path . 'download.' . $phpEx . $SID . '&id=' . $attachment['attach_id'] . '&thumb=1';
|
// $thumb_source = $phpbb_root_path . 'download.' . $phpEx . $SID . '&id=' . $attachment['attach_id'] . '&thumb=1';
|
||||||
//
|
|
||||||
// BEGIN
|
|
||||||
if (!empty($config['allow_ftp_upload']) && trim($config['upload_dir']) == '')
|
if (!empty($config['allow_ftp_upload']) && trim($config['upload_dir']) == '')
|
||||||
{
|
{
|
||||||
$thumb_source = $phpbb_root_path . 'download.' . $phpEx . $SID . '&id=' . $attachment['attach_id'] . '&thumb=1';
|
$thumb_source = $phpbb_root_path . "download.$phpEx$SID&id=" . $attachment['attach_id'] . '&thumb=1';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$thumb_source = $thumbnail_filename;
|
$thumb_source = $thumbnail_filename;
|
||||||
}
|
}
|
||||||
// END
|
|
||||||
|
|
||||||
$l_downloaded_viewed = $user->lang['VIEWED'];
|
$l_downloaded_viewed = $user->lang['VIEWED'];
|
||||||
$download_link = $phpbb_root_path . 'download.' . $phpEx . $SID . '&id=' . $attachment['attach_id'];
|
$download_link = $phpbb_root_path . "download.$phpEx$SID&id=" . $attachment['attach_id'];
|
||||||
|
|
||||||
$additional_array = array(
|
$additional_array = array(
|
||||||
'IMG_THUMB_SRC' => $thumb_source
|
'IMG_THUMB_SRC' => $thumb_source // should be THUMB_IMG or similar
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1250,10 +1252,7 @@ foreach ($rowset as $key => $row)
|
||||||
$download_link = $filename;
|
$download_link = $filename;
|
||||||
|
|
||||||
// Viewed/Heared File ... update the download count (download.php is not called here)
|
// 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;
|
break;
|
||||||
|
|
||||||
case RM_CAT:
|
case RM_CAT:
|
||||||
|
@ -1262,15 +1261,12 @@ foreach ($rowset as $key => $row)
|
||||||
$download_link = $filename;
|
$download_link = $filename;
|
||||||
|
|
||||||
$additional_array = array(
|
$additional_array = array(
|
||||||
'FORUM_URL' => generate_board_url(),
|
'FORUM_URL' => generate_board_url(), // should be U_FORUM or similar
|
||||||
'ATTACH_ID' => $attachment['attach_id']
|
'ATTACH_ID' => $attachment['attach_id']
|
||||||
);
|
);
|
||||||
|
|
||||||
// Viewed/Heared File ... update the download count (download.php is not called here)
|
// 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;
|
break;
|
||||||
/*
|
/*
|
||||||
case SWF_CAT:
|
case SWF_CAT:
|
||||||
|
@ -1329,26 +1325,29 @@ unset($rowset);
|
||||||
unset($user_cache);
|
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']))
|
if (!preg_match("#&t=$topic_id#", $user->data['session_page']))
|
||||||
{
|
{
|
||||||
$sql = "UPDATE " . TOPICS_TABLE . "
|
$sql = "UPDATE " . TOPICS_TABLE . "
|
||||||
SET topic_views = topic_views + 1
|
SET topic_views = topic_views + 1
|
||||||
WHERE topic_id = $topic_id";
|
WHERE topic_id = $topic_id";
|
||||||
$db->sql_query($sql);
|
$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
|
// Mozilla navigation bar
|
||||||
|
/*
|
||||||
$nav_links['prev'] = array(
|
$nav_links['prev'] = array(
|
||||||
'url' => $view_prev_topic_url,
|
'url' => $view_prev_topic_url,
|
||||||
'title' => $user->lang['View_previous_topic']
|
'title' => $user->lang['View_previous_topic']
|
||||||
|
@ -1361,10 +1360,10 @@ $nav_links['up'] = array(
|
||||||
'url' => $view_forum_url,
|
'url' => $view_forum_url,
|
||||||
'title' => $forum_name
|
'title' => $forum_name
|
||||||
);
|
);
|
||||||
|
*/
|
||||||
|
|
||||||
// Mark topics read
|
// 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
|
// Change encoding if appropriate
|
||||||
|
@ -1375,7 +1374,7 @@ if ($force_encoding != '')
|
||||||
|
|
||||||
|
|
||||||
// Output the page
|
// 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);
|
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
|
||||||
|
|
||||||
$template->set_filenames(array(
|
$template->set_filenames(array(
|
||||||
|
|