sibtracker/system/inc/forum/usergroup.php

162 lines
4.8 KiB
PHP
Raw Permalink Normal View History

2019-05-18 13:46:03 +08:00
<?php
if(!defined('DATALIFEENGINE')){die("Hacking attempt!");}
$subaction = $_REQUEST['subaction'];
// ********************************************************************************
// Get User Groups
// ********************************************************************************
$user_group = array ();
$db->query("SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC");
while ($row = $db->get_row())
{
$user_group[$row['id']] = array ();
foreach ($row as $key => $value)
{
$user_group[$row['id']][$key] = $value;
}
}
$db->free();
switch ($subaction)
{
case "":
$db->query("SELECT user_group, count(*) as count FROM " . USERPREFIX . "_users GROUP BY user_group");
while($row = $db->get_row())
{
$count_list[$row['user_group']] = $row['count'];
}
$db->free();
foreach ($user_group as $group)
{
$count = intval ($count_list[$group['id']]);
$entries .= "
<tr>
<td height=22 class=\"list\">&nbsp;&nbsp;<b>{$group['id']}</b></td>
<td class=\"list\">{$group['group_name']}</td>
<td class=\"list\" align=\"center\">$count</td>
<td class=\"list\" align=\"center\"><a onClick=\"return dropdownmenu(this, event, MenuBuild('".$group['id']."'), '150px')\" href=\"#\"><img src=\"system/skins/images/browser_action.gif\" border=\"0\"></a></td>
</tr>
<tr><td background=\"system/skins/images/mline.gif\" height=1 colspan=4></td></tr>";
}
echo_top();
echo <<<HTML
<script language="javascript" type="text/javascript">
<!--
function MenuBuild( m_id ){
var menu=new Array()
menu[0]='<a href="?mod=forum&action=usergroup&subaction=edit&id=' + m_id + '" >{$f_lg['group_sel1']}</a>';
if (m_id > 5) {
menu[1]='<a href="?mod=usergroup&action=del&id=' + m_id + '" >{$f_lg['group_sel2']}</a>';
}
else {
menu[1]='<a href="#" onclick="return false;"><font color="black">{$f_lg['group_sel3']}</font></a>';
}
return menu;
}
//-->
</script>
HTML;
echo_title($f_lg['group_list']);
echo "<table width=\"100%\">
<tr>
<td width=50>&nbsp;&nbsp;ID</td>
<td>{$f_lg['group_name']}</td>
<td width=100 align=\"center\">{$f_lg['group_users']}</td>
<td width=70 align=\"center\">&nbsp;</td>
</tr>
<tr><td colspan=\"4\"><div class=\"hr_line\"></div></td></tr>";
echo $entries."</table>";
echo_bottom();
break;
case "edit":
if ($id)
{
$row = $db->super_query("SELECT * FROM " . PREFIX . "_forum_moderators WHERE group_id = '$id'");
echo_top();
echo_title ($f_lg['group_moderation']." ".$user_group[$id]['group_name']);
echo "<form action=\"{$PHP_SELF}?mod=forum&action=usergroup&subaction=doedit&id={$id}\" method=\"post\">";
echo "<table width=\"100%\">";
showRadio($f_lg['mod_edit_topic'], $f_lg[''], "edit_topic", $row);
showRadio($f_lg['mod_del_topic'], $f_lg[''], "delete_topic", $row);
showRadio($f_lg['mod_edit_post'], $f_lg[''], "edit_post", $row);
showRadio($f_lg['mod_del_post'], $f_lg[''], "delete_post", $row);
showRadio($f_lg['mod_open_topic'], $f_lg[''], "open_topic", $row);
showRadio($f_lg['mod_close_topic'], $f_lg[''], "close_topic", $row);
showRadio($f_lg['mod_move_topic'], $f_lg[''], "move_topic", $row);
showRadio($f_lg['mod_fixed_topic'], $f_lg[''], "pin_topic", $row);
showRadio($f_lg['mod_defixed_topic'], $f_lg[''], "unpin_topic", $row);
showRadio($f_lg['mod_multi_moderation'], $f_lg[''], "mass_prune", $row);
showRadio($f_lg['mod_combining_post'], $f_lg[''], "combining_post", $row);
showRadio($f_lg['mod_move_post'], $f_lg[''], "move_post", $row);
echo "</table>";
echo_bottom('bottom');
echo_top('top');
echo "<input type=\"submit\" class=\"buttons\" value=\"{$f_lg['button_save']}\"></form>";
echo_bottom();
}
break;
case "doedit":
if ($id)
{
$m_group = $db->super_query("SELECT group_id FROM " . PREFIX . "_forum_moderators WHERE group_id = '$id'");
if (!$m_group['group_id'])
{
$db->query("INSERT INTO " . PREFIX . "_forum_moderators (group_id) values ('$id')");
}
$db->query("UPDATE " . PREFIX . "_forum_moderators SET edit_post = '$save[edit_post]', delete_topic = '$save[delete_topic]', edit_topic = '$save[edit_topic]', edit_post = '$save[edit_post]', delete_post = '$save[delete_post]', open_topic = '$save[open_topic]', close_topic = '$save[close_topic]', delete_post = '$save[delete_post]', move_topic = '$save[move_topic]', pin_topic = '$save[pin_topic]', delete_topic = '$save[delete_topic]', unpin_topic = '$save[unpin_topic]', mass_prune = '$save[mass_prune]', combining_post = '$save[combining_post]', move_post = '$save[move_post]' WHERE group_id = '$id'");
}
$fcache->delete('forum_moderators.php');
msg("info",$f_lg['group_edit_ok'], $f_lg['group_edit_ok2'], "?mod=forum");
break;
}
?>