mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-06 23:55:26 +02:00
Beginnings of the forum managament code (no functionality yet). Also a bit of a fix to view topic so it dosan't screw up when HTML is turned off. Still needs work, HTML works in [quote] tags... havn't tracked it down yet. Nate should look at it!
git-svn-id: file:///svn/phpbb/trunk@792 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
1d2382ccc0
commit
981b7056bb
@ -52,7 +52,161 @@ else if( $userdata['user_level'] != ADMIN )
|
||||
message_die(GENERAL_MESSAGE, $lang['Not_admin']);
|
||||
}
|
||||
|
||||
print "Got past the \$setmodules check<br>\n";
|
||||
print "Requested action was: $mode<br>\n";
|
||||
include('page_header_admin.'.$phpEx);
|
||||
|
||||
$mode = ($HTTP_GET_VARS['mode']) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
|
||||
|
||||
switch($mode)
|
||||
{
|
||||
case 'manage':
|
||||
|
||||
$template->set_filenames(array(
|
||||
"body" => "admin/admin_forum_manage.tpl")
|
||||
);
|
||||
$template->assign_vars(array("S_MANAGE_ACTION" => append_sid("admin_forums.$phpEx"),
|
||||
"L_FORUM" => $lang['Forum'],
|
||||
"L_MODERATOR" => $lang['Moderator'],
|
||||
"L_ORDER" => $lang['Order'],
|
||||
"POST_FORUM_URL" => POST_FORUM_URL,
|
||||
"L_REMOVE" => $lang['Remove'],
|
||||
"L_EDIT" => $lang['Edit'],
|
||||
"L_LOCK" => $lang['Lock'],
|
||||
"L_UPDATE_ORDER" => $lang['Update_order'],
|
||||
"L_ACTION" => $lang['Action']));
|
||||
|
||||
$sql = "SELECT c.cat_id, c.cat_title, c.cat_order
|
||||
FROM " . CATEGORIES_TABLE . " c, " . FORUMS_TABLE . " f
|
||||
WHERE f.cat_id = c.cat_id
|
||||
GROUP BY c.cat_id, c.cat_title, c.cat_order
|
||||
ORDER BY c.cat_order";
|
||||
|
||||
if(!$q_categories = $db->sql_query($sql))
|
||||
{
|
||||
message_die(GENERAL_ERROR, "Could not query categories list", "", __LINE__, __FILE__, $sql);
|
||||
}
|
||||
|
||||
if($total_categories = $db->sql_numrows($q_categories))
|
||||
{
|
||||
$category_rows = $db->sql_fetchrowset($q_categories);
|
||||
|
||||
$sql = "SELECT f.forum_id, f.forum_name, f.forum_desc, f.cat_id, f.forum_order
|
||||
FROM " . FORUMS_TABLE . " f
|
||||
ORDER BY f.cat_id, f.forum_order";
|
||||
|
||||
if(!$q_forums = $db->sql_query($sql))
|
||||
{
|
||||
message_die(GENERAL_ERROR, "Could not query forums information", "", __LINE__, __FILE__, $sql);
|
||||
}
|
||||
if( !$total_forums = $db->sql_numrows($q_forums) )
|
||||
{
|
||||
message_die(GENERAL_MESSAGE, $lang['No_forums']);
|
||||
}
|
||||
$forum_rows = $db->sql_fetchrowset($q_forums);
|
||||
|
||||
//
|
||||
// Obtain list of moderators of each forum
|
||||
//
|
||||
$sql = "SELECT aa.forum_id, g.group_name, g.group_id, g.group_single_user, u.user_id, u.username
|
||||
FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g, " . USERS_TABLE . " u
|
||||
WHERE aa.auth_mod = " . TRUE . "
|
||||
AND ug.group_id = aa.group_id
|
||||
AND g.group_id = aa.group_id
|
||||
AND u.user_id = ug.user_id
|
||||
ORDER BY aa.forum_id, g.group_id, u.user_id";
|
||||
|
||||
if(!$q_forum_mods = $db->sql_query($sql))
|
||||
{
|
||||
message_die(GENERAL_ERROR, "Could not query forum moderator information", "", __LINE__, __FILE__, $sql);
|
||||
}
|
||||
$forum_mods_list = $db->sql_fetchrowset($q_forum_mods);
|
||||
|
||||
for($i = 0; $i < count($forum_mods_list); $i++)
|
||||
{
|
||||
if($forum_mods_list[$i]['group_single_user'] || !$forum_mods_list[$i]['group_id'])
|
||||
{
|
||||
$forum_mods_single_user[$forum_mods_list[$i]['forum_id']][] = 1;
|
||||
|
||||
$forum_mods_name[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['username'];
|
||||
$forum_mods_id[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['user_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$forum_mods_single_user[$forum_mods_list[$i]['forum_id']][] = 0;
|
||||
|
||||
$forum_mods_name[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['group_name'];
|
||||
$forum_mods_id[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['group_id'];
|
||||
}
|
||||
}
|
||||
|
||||
for($i = 0; $i < $total_categories; $i++)
|
||||
{
|
||||
$cat_id = $category_rows[$i]['cat_id'];
|
||||
$count = 0;
|
||||
|
||||
for($j = 0; $j < $total_forums; $j++)
|
||||
{
|
||||
$forum_id = $forum_rows[$j]['forum_id'];
|
||||
|
||||
if($forum_rows[$j]['cat_id'] == $cat_id )
|
||||
{
|
||||
if(!$gen_cat[$cat_id])
|
||||
{
|
||||
$template->assign_block_vars("catrow", array(
|
||||
"CAT_DESC" => stripslashes($category_rows[$i]['cat_title']))
|
||||
);
|
||||
$gen_cat[$cat_id] = 1;
|
||||
}
|
||||
|
||||
$mod_count = 0;
|
||||
$moderators_links = "";
|
||||
for($mods = 0; $mods < count($forum_mods_name[$forum_id]); $mods++)
|
||||
{
|
||||
if( !strstr($moderators_links, $forum_mods_name[$forum_id][$mods]) )
|
||||
{
|
||||
if($mods > 0)
|
||||
{
|
||||
$moderators_links .= ", ";
|
||||
}
|
||||
|
||||
if( !($mod_count % 2) && $mod_count != 0 )
|
||||
{
|
||||
$moderators_links .= "<br />";
|
||||
}
|
||||
|
||||
if( $forum_mods_single_user[$forum_id][$mods])
|
||||
{
|
||||
$moderators_links .= "<a href=\"" . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $forum_mods_id[$forum_id][$mods]) . "\">" . $forum_mods_name[$forum_id][$mods] . "</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$moderators_links .= "<a href=\"" . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $forum_mods_id[$forum_id][$mods]) . "\">" . $forum_mods_name[$forum_id][$mods] . "</a>";
|
||||
}
|
||||
|
||||
$mod_count++;
|
||||
}
|
||||
}
|
||||
if($moderators_links == "")
|
||||
{
|
||||
$moderators_links = " ";
|
||||
}
|
||||
|
||||
$template->assign_block_vars("catrow.forumrow", array(
|
||||
"FORUM_NAME" => stripslashes($forum_rows[$j]['forum_name']),
|
||||
"FORUM_DESC" => stripslashes($forum_rows[$j]['forum_desc']),
|
||||
"MODERATORS" => $moderators_links,
|
||||
"FORUM_ID" => $forum_id,
|
||||
"FORUM_ORDER" => $forum_rows[$j]['forum_order'],
|
||||
"U_VIEWFORUM" => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"))
|
||||
);
|
||||
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
} // for ... categories
|
||||
}
|
||||
$template->pparse("body");
|
||||
break;
|
||||
|
||||
}
|
||||
include('page_footer_admin.'.$phpEx);
|
||||
?>
|
@ -363,6 +363,8 @@ function bbencode_first_pass_pda($text, $uid, $open_tag, $close_tag, $close_tag_
|
||||
*/
|
||||
function bbencode_second_pass_code($text, $uid)
|
||||
{
|
||||
// If HTML is turned on we undo any HTML special chars that were created by the viewtopic code.
|
||||
$text = undo_htmlspecialchars($text);
|
||||
|
||||
$code_start_html = '<TABLE BORDER="0" ALIGN="CENTER" WIDTH="85%"><TR><TD><font size="-1">Code:</font><HR></TD></TR><TR><TD><FONT SIZE="-1"><PRE>';
|
||||
$code_end_html = '</PRE></FONT></TD></TR><TR><TD><HR></TD></TR></TABLE>';
|
||||
|
@ -762,6 +762,11 @@ $lang['Ban_update_sucessful'] = "The banlist has been updated sucessfully";
|
||||
// Configuration
|
||||
$lang['Config_updated'] = "Forum Configuration Updated Sucessfully";
|
||||
|
||||
// Forum Management
|
||||
$lang['Remove'] = "Remove";
|
||||
$lang['Action'] = "Action";
|
||||
$lang['Update_order'] = "Update Order";
|
||||
|
||||
//
|
||||
// End
|
||||
// -------------------------------------------------
|
||||
|
@ -508,9 +508,9 @@ for($i = 0; $i < $total_posts; $i++)
|
||||
{
|
||||
if($user_sig != "")
|
||||
{
|
||||
$user_sig = strip_tags($user_sig);
|
||||
$user_sig = htmlspecialchars($user_sig);
|
||||
}
|
||||
$message = strip_tags($message);
|
||||
$message = htmlspecialchars($message);
|
||||
}
|
||||
|
||||
if($board_config['allow_bbcode'])
|
||||
@ -525,6 +525,8 @@ for($i = 0; $i < $total_posts; $i++)
|
||||
$message = bbencode_second_pass($message, $bbcode_uid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$message = make_clickable($message);
|
||||
$message = str_replace("\n", "<br />", $message);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user