init_admin();
$fcache = new cache($dir = ROOT_DIR . '/cache/forum');
$action = $_REQUEST['action'];
switch ($action)
{
// ********************************************************************************
// MAIN
// ********************************************************************************
case "":
$count_options = count($options);
for($i=0; $i<$count_options; $i++)
{
if($member_db[1] > $options[$i]['access'] AND $options[$i]['access'] != "all")
{
unset($options[$i]);
}
}
$forum_stats = array();
$row = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_forum_posts");
$forum_stats['posts'] = $row['count'];
$row = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_forum_topics");
$forum_stats['topics'] = $row['count'];
$forum_stats['licence'] = ($l_full) ? $f_lg['licence_trial'] : $f_lg['licence_full'];
$sum_size = $db->super_query("SELECT SUM(file_size) AS sum FROM " . PREFIX . "_forum_files");
$forum_stats['sum_size'] = mksize($sum_size['sum']);
if (!$forum_config['offline']) $forum_stats['line'] = $f_lg['forum_online'];
else $forum_stats['line'] = $f_lg['forum_offline'];
$forum_stats['cache'] = mksize($fcache->size());
$forum_mysql = $db->query("SHOW TABLE STATUS FROM `".DBNAME."`");
while ($row = $db->get_array($forum_mysql))
{
if (strpos($row['Name'], PREFIX."_forum_") !== false)
$forum_db_size += $row['Data_length'] + $row['Index_length'] ;
}
$db->free($forum_mysql);
$forum_stats['db_size'] = mksize($forum_db_size);
echo_top();
echo_title($f_lg['m_forum']);
echo "
";
foreach($options as $option)
{
if ($i > 1) {echo ""; $i=0;}
$i++;
echo " | ";
}
echo "
";
echo_bottom(w);
echo "";
echo_top(w); echo_title($f_lg['check_updates']); echo "
"; echo_bottom(w);
echo "
";
echo_top(w);
echo_title($f_lg['m_stats']);
echo_stats($forum_config, $forum_stats);
echo_bottom();
break;
// ********************************************************************************
// CATEGORY
// ********************************************************************************
case "category":
echo_top();
echo_title($f_lg['cat_new']);
echo_category('new');
echo_bottom();
break;
// ********************************************************************************
// CATEGORY ADD
// ********************************************************************************
case "category_add":
if ($name)
{
$result_posi = $db->super_query("SELECT * FROM " . PREFIX . "_forum_category ORDER BY posi DESC LIMIT 1");
$posi = $result_posi['posi'];
if (!$posi) $posi = '1'; else $posi = ($posi+1);
$name = $db->safesql($_POST['name']);
$db->query("INSERT INTO " . PREFIX . "_forum_category (cat_name, posi) values ('$name', '$posi')");
$fcache->delete('start_id');
$fcache->delete('cats_array');
msg("info",$f_lg['cat_ok_add1'], $f_lg['cat_ok_add2'], "?mod=forum");
}
else msg("error",$f_lg['error'],$f_lg['cat_err_name'], "?mod=forum&action=category");
break;
// ********************************************************************************
// CATEGORY EDIT
// ********************************************************************************
case "category_edit":
$row = $db->super_query("SELECT * FROM " . PREFIX . "_forum_category WHERE sid = '$sid'");
$name = stripslashes(preg_replace(array("'\"'", "'\''"), array(""", "'"),$row['cat_name']));
$sid = $row['sid'];
echo_top();
echo_title($f_lg['cat_edit']);
echo_category('edit', $name, $sid);
echo_bottom();
break;
// ********************************************************************************
// CATEGORY SAVE
// ********************************************************************************
case "category_save":
$name = $db->safesql($_POST['name']);
if (!$name)
{
msg("error",$f_lg['error'],$f_lg['cat_err_name'], "javascript:history.go(-1)");
}
$db->query("UPDATE " . PREFIX . "_forum_category SET cat_name = '$name' WHERE sid = '$sid'");
$fcache->delete('start_id');
$fcache->delete('cats_array');
msg("info",$f_lg['cat_ok_edit1'], $f_lg['cat_ok_edit2'], "?mod=forum&action=content");
break;
// ********************************************************************************
// CATEGORY DEL
// ********************************************************************************
case "category_del":
$category_result = $db->query("SELECT * FROM " . PREFIX . "_forum_forums WHERE main_id = '$sid'");
while ($myrow = $db->get_row($category_result))
{
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_topics WHERE forum_id = '$myrow[id]'");
while ($row = $db->get_row($result))
{
$db->query("DELETE FROM " . PREFIX . "_forum_posts WHERE topic_id = '$row[tid]'");
}
$db->query("DELETE FROM " . PREFIX . "_forum_topics WHERE forum_id = '$myrow[id]'");
$db->query("DELETE FROM " . PREFIX . "_forum_forums WHERE id = '$myrow[id]'");
// Удаление вложений вместе с категорией и всеми разделами категории
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_files WHERE forum_id = '" . $myrow['id'] . "'");
while ($row = $db->get_row($result)) {
if ($row['file_type'] == "file") {
unlink(UPLOAD_DIR."files/" . $row['onserver']);
} elseif ($row['file_type'] == "thumb") {
unlink(UPLOAD_DIR."thumbs/" . $row['onserver']);
unlink(UPLOAD_DIR."images/" . $row['onserver']);
} else {
unlink(UPLOAD_DIR."images/" . $row['onserver']);
}
}
$db->query("DELETE FROM " . PREFIX . "_forum_files WHERE forum_id = '" . $myrow['id'] . "'");
// конец удаления вложений вместе с темой
}
$db->query("DELETE FROM " . PREFIX . "_forum_category WHERE sid = '$sid'");
$fcache->delete('start_id');
$fcache->delete('cats_array');
$fcache->delete('forums_array');
$fcache->delete('sub_forums_array');
$fcache->delete('sub_parentid');
$fcache->clear();
header("Location: ?mod=forum&action=content");
break;
// ********************************************************************************
// CATEGORY SORT
// ********************************************************************************
case "category_sort":
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_category");
while ($row = $db->get_row($result))
{
$db->query("UPDATE " . PREFIX . "_forum_category SET posi = '".$cat_posi[$row['sid']]."' WHERE sid = '$row[sid]'");
}
$fcache->delete('start_id');
$fcache->delete('cats_array');
header("Location: ?mod=forum&action=content");
break;
// ********************************************************************************
// CATEGORY ACCESS for forums
// ********************************************************************************
case "access":
$access_forum = access_forum($user_group, '0');
echo_top();
echo_title($f_lg['access_for_f']);
echo "";
echo_bottom();
break;
// ********************************************************************************
// CATEGORY ACCESS for forums ADD
// ********************************************************************************
case "access_add":
if (!count($access_read)) {$access_read = array (); $access_read[] = '0';}
$access_read_mysql = $db->safesql(implode(':', $access_read));
if (!count($access_write)) {$access_write = array (); $access_write[] = '0';}
$access_write_mysql = $db->safesql(implode(':', $access_write));
if (!count($access_mod)) {$access_mod = array (); $access_mod[] = '0';}
$access_mod_mysql = $db->safesql(implode(':', $access_mod));
if (!count($access_topic)) {$access_topic = array (); $access_topic[] = '0';}
$access_topic_mysql = $db->safesql(implode(':', $access_topic));
if (!count($access_upload)) {$access_upload = array (); $access_upload[] = '0';}
$access_upload_mysql = $db->safesql(implode(':', $access_upload));
if (!count($access_download)) {$access_download = array (); $access_download[] = '0';}
$access_download_mysql = $db->safesql(implode(':', $access_download));
$db->query("UPDATE " . PREFIX . "_forum_forums SET access_read = '$access_read_mysql', access_write = '$access_write_mysql', access_mod = '$access_mod_mysql', access_topic = '$access_topic_mysql', access_upload = '$access_upload_mysql', access_download = '$access_download_mysql' WHERE main_id = '$sid'");
$fcache->delete('forums_array');
header("Location: ?mod=forum&action=content");
break;
// ********************************************************************************
// FORUM
// ********************************************************************************
case "forum":
echo_top();
echo_title($f_lg['forum_new']);
echo_forum('new', $sid);
echo_bottom();
break;
// ********************************************************************************
// FORUM ADD
// ********************************************************************************
case "forum_add":
$main_id = $db->safesql($_POST['main_id']);
$parentid = $db->safesql($_POST['parentid']);
if ($parentid){
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_forums WHERE main_id = '$main_id' and parentid = 0");
while ($row = $db->get_row($result))
{
if ($row['id'] == $parentid) $test_parentid = TRUE;
}
}
else $test_parentid = TRUE;
if ($_POST['name'] AND $test_parentid)
{
$result_position = $db->super_query("SELECT * FROM " . PREFIX . "_forum_forums WHERE main_id = '$main_id' ORDER BY position DESC LIMIT 1");
$position = $result_position['position'];
if (!$position) $position = '1'; else $position = ($position+1);
$name = $db->safesql($_POST['name']);
$description = $db->safesql($_POST['description']);
$password = $db->safesql($_POST['password']);
$rules_name = $db->safesql($_POST['rules_name']);
$icon = $db->safesql($_POST['icon']);
$postcount = intval($_POST['postcount']);
$fixpost = intval($_REQUEST['fixpost']);
$banner = $db->safesql($_POST['banner']);
$q_reply = intval($_POST['q_reply']);
$i_edit = intval($_POST['i_edit']);
include(SYSTEM_DIR.'/classes/parse.class.php');
$parse = new ParseFilter(Array(), Array(), 1, 1);
$rules = $db->safesql($parse->BB_Parse($parse->process($_POST['rules']), false));
// ACCESS //
if (!count($access_read)) {$access_read = array (); $access_read[] = '0';}
$access_read_mysql = $db->safesql(implode(':', $access_read));
if (!count($access_write)) {$access_write = array (); $access_write[] = '0';}
$access_write_mysql = $db->safesql(implode(':', $access_write));
if (!count($access_mod)) {$access_mod = array (); $access_mod[] = '0';}
$access_mod_mysql = $db->safesql(implode(':', $access_mod));
if (!count($access_topic)) {$access_topic = array (); $access_topic[] = '0';}
$access_topic_mysql = $db->safesql(implode(':', $access_topic));
if (!count($access_upload)) {$access_upload = array (); $access_upload[] = '0';}
$access_upload_mysql = $db->safesql(implode(':', $access_upload));
if (!count($access_download)) {$access_download = array (); $access_download[] = '0';}
$access_download_mysql = $db->safesql(implode(':', $access_download));
$db->query("INSERT INTO " . PREFIX . "_forum_forums (parentid, main_id, name, description, position, access_read, access_write, access_mod, access_topic, access_upload, access_download, password, rules_title, rules, icon, postcount, fixpost, banner, q_reply, i_edit) values ('$parentid', '$main_id', '$name', '$description', '$position', '$access_read_mysql', '$access_write_mysql', '$access_mod_mysql', '$access_topic_mysql', '$access_upload_mysql', '$access_download_mysql', '$password', '$rules_name', '$rules', '$icon', '$postcount', '$fixpost', '$banner', '$q_reply', '$i_edit')");
$fcache->delete('forums_array');
$fcache->delete('sub_forums_array');
$fcache->delete('sub_parentid');
$fcache->clear();
msg("info",$f_lg['forum_ok_add1'], $f_lg['forum_ok_add2'], "?mod=forum");
}
else msg("error",$f_lg['error'],$f_lg['forum_err_name'], "?mod=forum&action=forum");
break;
// ********************************************************************************
// FORUM EDIT
// ********************************************************************************
case "forum_edit":
echo_top();
echo_title($f_lg['forum_edit']);
echo_forum('edit', $id);
echo_bottom();
break;
// ********************************************************************************
// FORUM SAVE
// ********************************************************************************
case "forum_save":
$main_id = $db->safesql($_POST['main_id']);
$parentid = $db->safesql($_POST['parentid']);
if ($parentid){
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_forums WHERE main_id = '$main_id' and parentid = 0");
while ($row = $db->get_row($result))
{
if ($row['id'] == $parentid) $test_parentid = TRUE;
}
}
else $test_parentid = TRUE;
if ($_POST['name'] AND $test_parentid)
{
$name = $db->safesql($_POST['name']);
$description = $db->safesql($_POST['description']);
$password = $db->safesql($_POST['password']);
$rules_name = $db->safesql($_POST['rules_name']);
$banner = $db->safesql($_POST['banner']);
$q_reply = intval($_POST['q_reply']);
$i_edit = intval($_POST['i_edit']);
include(SYSTEM_DIR.'/classes/parse.class.php');
$parse = new ParseFilter(Array(), Array(), 1, 1);
$rules = $db->safesql($parse->BB_Parse($parse->process($_POST['rules']), false));
$icon = $db->safesql($_POST['icon']);
$postcount = intval($_POST['postcount']);
$fixpost = intval($_REQUEST['fixpost']);
// ACCESS //
if (!count($access_read)) {$access_read = array (); $access_read[] = '0';}
$access_read_mysql = $db->safesql(implode(':', $access_read));
if (!count($access_write)) {$access_write = array (); $access_write[] = '0';}
$access_write_mysql = $db->safesql(implode(':', $access_write));
if (!count($access_mod)) {$access_mod = array (); $access_mod[] = '0';}
$access_mod_mysql = $db->safesql(implode(':', $access_mod));
if (!count($access_topic)) {$access_topic = array (); $access_topic[] = '0';}
$access_topic_mysql = $db->safesql(implode(':', $access_topic));
if (!count($access_upload)) {$access_upload = array (); $access_upload[] = '0';}
$access_upload_mysql = $db->safesql(implode(':', $access_upload));
if (!count($access_download)) {$access_download = array (); $access_download[] = '0';}
$access_download_mysql = $db->safesql(implode(':', $access_download));
$db->query("UPDATE " . PREFIX . "_forum_forums SET parentid = '$parentid', main_id = '$main_id', name = '$name', description = '$description', access_read = '$access_read_mysql', access_write = '$access_write_mysql', access_mod = '$access_mod_mysql', access_topic = '$access_topic_mysql', access_upload = '$access_upload_mysql', access_download = '$access_download_mysql', password = '$password', rules_title = '$rules_name', rules = '$rules', icon= '$icon', postcount = '$postcount', fixpost = '$fixpost', banner = '$banner', q_reply = '$q_reply', i_edit = '$i_edit' WHERE id = '$id'");
$fcache->delete('forums_array');
$fcache->delete('sub_forums_array');
$fcache->delete('sub_parentid');
$fcache->clear();
msg("info",$f_lg['forum_ok_edit1'], $f_lg['forum_ok_edit2'], "?mod=forum&action=content");
}
else msg("error",$f_lg['error'],$f_lg['forum_err_name'], "?mod=forum&action=forum");
break;
// ********************************************************************************
// FORUM DEL
// ********************************************************************************
case "forum_del":
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_topics WHERE forum_id = '$id'");
while ($row = $db->get_row($result))
{
$db->query("DELETE FROM " . PREFIX . "_forum_posts WHERE topic_id = '$row[tid]'");
}
$db->query("DELETE FROM " . PREFIX . "_forum_topics WHERE forum_id = '$id'");
$db->query("DELETE FROM " . PREFIX . "_forum_forums WHERE id = '$id'");
// Удаление вложений вместе с разделом
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_files WHERE forum_id = '" . $id . "'");
while ($row = $db->get_row($result)) {
if ($row['file_type'] == "file") {
unlink(UPLOAD_DIR."files/" . $row['onserver']);
} elseif ($row['file_type'] == "thumb") {
unlink(UPLOAD_DIR."thumbs/" . $row['onserver']);
unlink(UPLOAD_DIR."images/" . $row['onserver']);
} else {
unlink(UPLOAD_DIR."images/" . $row['onserver']);
}
}
$db->query("DELETE FROM " . PREFIX . "_forum_files WHERE forum_id = '" . $id . "'");
// конец удаления вложений вместе с темой
$db->query("UPDATE " . PREFIX . "_forum_forums SET parentid = 0 WHERE parentid = '$id'");
$fcache->delete('forums_array');
$fcache->delete('sub_forums_array');
$fcache->delete('sub_parentid');
$fcache->clear();
header("Location: ?mod=forum&action=content");
break;
// ********************************************************************************
// FORUM SORT
// ********************************************************************************
case "forum_sort":
$in_cid = intval($_REQUEST['in_cid']);
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_forums WHERE main_id = $in_cid");
while ($row = $db->get_row($result))
{
$db->query("UPDATE " . PREFIX . "_forum_forums SET position = '".$cat_posi[$row['id']]."' WHERE id = '$row[id]'");
}
$fcache->delete('forums_array');
$fcache->delete('sub_forums_array');
$fcache->delete('sub_parentid');
$fcache->clear();
header("Location: ?mod=forum&action=content");
break;
// ********************************************************************************
// CONTENT
// ********************************************************************************
case "content":
echo_top();
$sub_forums = $db->query("SELECT * FROM ". PREFIX ."_forum_forums WHERE parentid ORDER by position");
while ($row = $db->get_row($get_sub_forums))
{
$sub_forum[$row['id']]['id'] = $row['id'];
$sub_forum[$row['id']]['parentid'] = $row['parentid'];
$sub_forum[$row['id']]['name'] = $row['name'];
}
$mod_forums = $db->query("SELECT mid, forum_id, member_name, member_id FROM ". PREFIX ."_forum_moderators");
while ($row = $db->get_row($mod_forums))
{
$moderators_array[$row['mid']]['mid'] = $row['mid'];
$moderators_array[$row['mid']]['forum_id'] = $row['forum_id'];
$moderators_array[$row['mid']]['member_name'] = $row['member_name'];
$moderators_array[$row['mid']]['member_id'] = $row['member_id'];
}
$result_posi = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_forum_category");
$result_posi = $result_posi['count'];
$content = $db->query("SELECT c.*, f.* FROM " . PREFIX . "_forum_category AS c LEFT OUTER JOIN ". PREFIX ."_forum_forums AS f ON f.main_id=c.sid AND f.parentid = 0 ORDER BY c.posi, f.position");
forum_menu();
echo "";
echo_bottom('action');
echo_bottom();
break;
// ********************************************************************************
// CONTENT -> FORUMS
// ********************************************************************************
case "content_forums":
$sub_forums = $db->query("SELECT id, parentid, name, description FROM ". PREFIX ."_forum_forums WHERE parentid ORDER by position");
$sub_forum = array();
while ($row = $db->get_row($get_sub_forums))
{
$sub_forum[$row['id']] = array ();
foreach ($row as $key => $value)
{
$sub_forum[$row['id']][$key] = $value;
}
}
$result_posi = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_forum_forums WHERE main_id = '$sid' AND parentid = 0");
$result_posi = $result_posi['count'];
$content = $db->query("SELECT * FROM " . PREFIX . "_forum_category LEFT JOIN ". PREFIX ."_forum_forums ON ". PREFIX ."_forum_category.sid=". PREFIX ."_forum_forums.main_id WHERE parentid = 0 AND main_id = '$sid' ORDER BY posi, position");
echo_top();
forum_menu();
echo "";
echo_bottom('action');
echo_bottom();
break;
// ********************************************************************************
// FORUM -> SUB FORUMS
// ********************************************************************************
case "content_sub_forums":
$forum_row = $db->super_query("SELECT * FROM ". PREFIX ."_forum_forums WHERE id = '$id'");
$sid = $forum_row['main_id'];
$sub_forums = $db->query("SELECT * FROM ". PREFIX ."_forum_forums WHERE parentid = '$id' ORDER by position");
$result_posi = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_forum_forums WHERE parentid = '$id'");
$result_posi = $result_posi['count'];
echo_top();
echo_top('content');
forum_menu();
echo "";
echo_bottom('action');
echo_bottom();
break;
// ********************************************************************************
// TOOLS
// ********************************************************************************
case "tools":
echo_top();
echo "";
echo_bottom('tools_save');
echo_bottom();
break;
// ********************************************************************************
// TOOLS SAVE
// ********************************************************************************
case "tools_save":
if (!count($search_captcha)) {$search_captcha = array (); $search_captcha[] = '0';}
$save_con[search_captcha] = $db->safesql(implode(':', $search_captcha));
if (!count($topic_captcha)) {$topic_captcha = array (); $topic_captcha[] = '0';}
$save_con[topic_captcha] = $db->safesql(implode(':', $topic_captcha));
if (!count($post_captcha)) {$post_captcha = array (); $post_captcha[] = '0';}
$save_con[post_captcha] = $db->safesql(implode(':', $post_captcha));
if (!count($tools_upload)) {$tools_upload = array (); $tools_upload[] = '0';}
$save_con[tools_upload] = $db->safesql(implode(':', $tools_upload));
if (!count($tools_poll)) {$tools_poll = array (); $tools_poll[] = '0';}
$save_con[tools_poll] = $db->safesql(implode(':', $tools_poll));
$find[] = "'\r'";
$replace[] = "";
$find[] = "'\n'";
$replace[] = "";
$save_con = $save_con + $forum_config;
$handler = fopen(SYSTEM_DIR.'/data/forum_config.php', "w");
fwrite($handler, " $value)
{
$value=trim(stripslashes ($value));
$value=htmlspecialchars ($value, ENT_QUOTES);
$value = preg_replace($find,$replace,$value);
fwrite($handler, "'{$name}' => \"{$value}\",\n\n");
}
fwrite($handler, ");\n\n?>");
fclose($handler);
msg("info", $f_lg['t_f_save'], "$f_lg[t_f_save1]
$f_lg[db_prev]");
break;
// ********************************************************************************
// RANK
// ********************************************************************************
case "rank":
$result = $db->query("SELECT * FROM " . PREFIX . "_forum_titles");
echo_top();
echo_title($f_lg['titles_main']);
echo_rank_style ();
echo "
{$f_lg['titles_name']} |
{$f_lg['titles_pots']} |
{$f_lg['titles_pips']} |
{$f_lg['titles_action']} |
";
while ($row = $db->get_row($result))
{
$t_action = "[{$f_lg['label_edit']}]"." [{$f_lg['label_del']}]";
$rating = $row['pips'] * 17;
$rank_image = "";
echo "
{$row['title']} |
{$row['posts']} |
{$rank_image} |
{$t_action} |
|
";
}
echo "
";
echo_bottom('w');
echo_top('w');
echo_title($f_lg['titles_uadd']);
echo "";
echo_bottom('w');
echo_top('w');
echo_title($f_lg['titles_add']);
echo_rank('new');
echo_bottom();
break;
case "rank_add":
if ($t_name)
{
$db->query("INSERT INTO " . PREFIX . "_forum_titles (posts, title, pips) values ('$t_posts', '$t_name', '$t_pips')");
$fcache->delete('rank_array');
header("Location: ?mod=forum&action=rank");
}
break;
case "rank_edit":
echo_top();
echo_title($f_lg['titles_edit']);
echo_rank('edit', $id);
echo_bottom();
break;
case "rank_save":
if ($t_name and $id)
{
$db->query("UPDATE " . PREFIX . "_forum_titles SET title = '$t_name', posts = '$t_posts', pips = '$t_pips' WHERE id = '$id'");
$fcache->delete('rank_array');
header("Location: ?mod=forum&action=rank");
}
break;
case "rank_del":
$db->query("DELETE FROM " . PREFIX . "_forum_titles WHERE id = '$id' LIMIT 1");
$fcache->delete('rank_array');
header("Location: ?mod=forum&action=rank");
break;
case "rank_user":
$user_pips = intval($user_pips);
$db->query("SELECT * FROM " . USERPREFIX . "_users where name = '$user_name'");
if ($db->num_rows())
{
$db->query("UPDATE " . PREFIX . "_users SET forum_rank = '$user_rank', forum_pips = '$user_pips' WHERE name = '$user_name'");
header("Location: ?mod=forum&action=rank");
} else
{
msg("info",$f_lg['error'], $f_lg['titles_error_name'], "javascript:history.go(-1)");
}
break;
// ********************************************************************************
// NEW MODERATOR
// ********************************************************************************
case "moderator_new":
if ($user_found)
{
$user_found = $db->super_query("SELECT * FROM " . USERPREFIX . "_users WHERE name = '$user_found'");
$uid = $user_found['user_id'];
}
if ($user_found['name'])
{
echo_top();
echo_title($f_lg['mod_config_set']);
echo "";
echo_bottom();
}
else
{
echo_top();
echo_title($f_lg['mod_search_user']);
echo "";
echo_bottom();
}
break;
case "moderator_add":
$user_found = $db->super_query("SELECT * FROM " . USERPREFIX . "_users WHERE user_id = '$uid'");
if ($user_found['user_id'] and $fid)
{
$row = $db->super_query("SELECT * FROM " . PREFIX . "_forum_moderators WHERE member_id = '$uid' and forum_id = '$fid'");
$moderator_id = $row['mid'];
if (!$moderator_id)
{
$db->query("INSERT INTO " . PREFIX . "_forum_moderators (member_id, member_name, forum_id) values ('$uid', '$user_found[name]', '$fid')");
$moderator_id = $db->insert_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 mid = '$moderator_id'");
$new_row = $db->query("SELECT mid, member_id FROM " . PREFIX . "_forum_moderators WHERE forum_id = '$fid'");
while ($row = $db->get_row($new_row))
{
$update_uid[$row['member_id']] = $row['member_id'];
}
$update_uid = implode(':', $update_uid);
$db->query("UPDATE " . PREFIX . "_forum_forums SET moderators = '$update_uid' WHERE id = '$fid'");
$fcache->delete('forum_moderators');
$fcache->delete('forums_array');
msg("info",$f_lg['mod_add'], $f_lg['mod_add2'], "?mod=forum&action=content");
}
break;
case "moderator_edit":
if (intval($id))
{
$row = $db->super_query("SELECT * FROM " . PREFIX . "_forum_moderators WHERE mid = '$id'");
$moderator_edit = true;
echo_top();
echo_title($f_lg['mod_config_set']);
echo "";
echo_bottom();
}
break;
case "moderator_save":
if ($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]' WHERE mid = '$id'");
$fcache->delete('forum_moderators');
msg("info",$f_lg['mod_edit_ok'], $f_lg['mod_edit_ok2'], "?mod=forum&action=content");
}
break;
case "moderator_del":
if ($id)
{
$row = $db->super_query("SELECT * FROM " . PREFIX . "_forum_moderators WHERE mid = '$id'");
$fid = $row['forum_id'];
if ($row['member_id'])
{
$db->query("DELETE FROM " . PREFIX . "_forum_moderators WHERE mid = '$id'");
$row_forum = $db->super_query("SELECT moderators FROM " . PREFIX . "_forum_forums WHERE id = '$fid'");
$new_row = $db->query("SELECT mid, member_id FROM " . PREFIX . "_forum_moderators WHERE forum_id = '$fid'");
while ($row = $db->get_row($new_row))
{
$update_uid[$row['member_id']] = $row['member_id'];
}
$update_uid = implode(':', $update_uid);
$db->query("UPDATE " . PREFIX . "_forum_forums SET moderators = '$update_uid' WHERE id = '$fid'");
$fcache->delete('forum_moderators');
$fcache->delete('forums_array');
header("Location: ?mod=forum&action=content");
}
}
break;
// ********************************************************************************
// HELP
// ********************************************************************************
case "help":
echoheader("", "");
echo_top('about');
echo_title("DLE Forum Version 2.4 Build 1");
$licence_file = @file_get_contents(SYSTEM_DIR.'/forum/sources/components/licence.odf');
echo "".urldecode($licence_file)."
";
echo_bottom('about');
echo_top('authors');
echo_title("Developers");
echo "";
echo "
Author & Developer: Vadim Shestakov [ShVad]
";
echo "
";
echo "
WebMoney: R164056126473 Z217028877385 E194208009125 U374273141801
Copyright 2008 © DLE Files Group. All rights reserved.";
echo "
";
echo_bottom('authors');
echofooter();
break;
// ********************************************************************************
// EMAIL
// ********************************************************************************
case "email":
require_once SYSTEM_DIR.'/inc/forum/email.php';
break;
// ********************************************************************************
// USER GROUP
// ********************************************************************************
case "usergroup":
require_once SYSTEM_DIR.'/inc/forum/usergroup.php';
break;
// ********************************************************************************
// SERVICE
// ********************************************************************************
case "service":
require_once SYSTEM_DIR.'/inc/forum/service.php';
break;
// ********************************************************************************
// CLEAR CACHE
// ********************************************************************************
case "clear":
$fcache->delete();
$fcache->clear();
header("Location: ?mod=forum");
break;
}
?>