|
|
- <?php
- /**
- * @package uForum
- * @file moderate.php
- * @version $Id$
- * @copyright 2009(c) PioDer <pioder@wp.pl>
- * @link http://pioder.gim2przemysl.int.pl/
- * @license GNU GPL v3
- **/
- define('IN_uF', true);
- //include files
- include('./config.php');
- include('./includes/constants.php');
- include('./includes/class_db.php');
- include('./includes/class_error.php');
- //connect to database
- DataBase::db_connect();
- include('./includes/sessions.php');
- include('./includes/class_user.php');
- include('./common.php');
- include('./includes/class_overall.php');
- include('./includes/classes/secure.php');
- include('./includes/class_mod.php');
- include('./includes/class_forum.php');
- include('./includes/class_topic.php');
- include('./lngs/'.Over::DefaultLang().'/main.php');
- $start = Over::TimeGeneration();
- sess_del_invalid($_SESSION['uid']);
- sess_register($_SESSION['uid']);
- sess_delete_old();
- if ($_SESSION['uid']>0)
- {
- if (RANK==0)
- {
- $stop = Over::TimeGeneration();
- message_forum($lng['is_no_mod'],'index.php');
- }
- }
- else
- {
- message_forum($lng['youarenotlogd'],'login.php?mode=login');
- }
- switch(trim($_GET['action']))
- {
- case 'delete':
- {
- $tid = intval($_GET['id']);
- Secure::topic_exists($tid);
- $fid = Topic::TopicInformation($tid,'f_id');
- Mod::DeleteTopic($tid);
- $stop = Over::TimeGeneration();
- message_forum($lng['tdeleted'], 'forum.php?f='.$fid);
- break;
- }
- case 'lock':
- {
- $tid = intval($_GET['id']);
- Secure::topic_exists($tid);
- Mod::LockTopic($tid);
- $stop = Over::TimeGeneration();
- message_forum($lng['tlocked'], 'topic.php?t='.$tid);
- break;
- }
- case 'unlock':
- {
- $tid = intval($_GET['id']);
- Secure::topic_exists($tid);
- Mod::UnlockTopic($tid);
- $stop = Over::TimeGeneration();
- message_forum($lng['tunlocked'], 'topic.php?t='.$tid);
- break;
- }
- case 'postdelete':
- {
- $pid = intval($_GET['id']);
- Secure::post_exists($pid);
- $tid = Topic::PostInformation($pid,'t_id');
- $tpid = Topic::PostInformation($pid,'tp_id');
- if ($tpid >1)
- {
- Mod::DeletePost($pid);
- }
- $stop = Over::TimeGeneration();
- message_forum($lng['pdeleted'],'topic.php?t='.$tid);
- break;
- }
- case 'stick':
- {
- $tid = intval($_GET['id']);
- Secure::topic_exists($tid);
- Mod::StickTopic($tid,'1');
- $stop = Over::TimeGeneration();
- message_forum($lng['tstuck'], 'topic.php?t='.$tid);
- break;
- }
- case 'unstick':
- {
- $tid = intval($_GET['id']);
- Secure::topic_exists($tid);
- Mod::StickTopic($tid,'0');
- $stop = Over::TimeGeneration();
- message_forum($lng['tunstuck'], 'topic.php?t='.$tid);
- break;
- }
- case 'move':
- {
- $tid = intval($_GET['id']);
- Secure::topic_exists($tid);
- if (isset($_POST['forum_id']))
- {
- $fid = $_POST['forum_id'];
- Mod::MoveTopic($tid,$fid);
- message_forum($lng['topic_moved'],'topic.php?t='.$tid);
- }
- else
- {
- $start = Over::TimeGeneration();
- $default_skin = Over::ViewSkinName();
- //add skin variables
- $skin = array(
- 't' => $tid,
- 'L.select_forum' => $lng['select_forum'],
- 'L.save' => $lng['save'],
- 'L.reset' => $lng['reset'],
- 'OPTIONS.select_forum' => Forum::AddForums($tid)
- );
- $skin = array_push_associative($skin, Over::generate_header($lng['move_topic'].': '.Topic::TopicInformation($tid,'name'),'</a><a href="moderate.php?action=move&id='.$tid.'" class="navigator">'
- .$lng['move_topic'].': </a><a href="topic.php?t='.$tid.'" class="navigator">'
- .Topic::TopicInformation($tid,'name')));
- if ($_SESSION['uid']>0)
- {
- if(RANK=='2')
- {
- $skin['pa_link']='<a href="admin/index.php" class="fsmall"><b>'.$lng['pa_link'].'</b></a>';
- }
- else
- {
- $skin['pa_link']='';
- }
- }
- else
- {
- $skin['pa_link']='';
- }
- $stop = Over::TimeGeneration();
- $skin['queries'] = Over::ShowQueries($start, $stop);
- //do it!
- include('./skins/'.$default_skin.'/overall_header.tpl');
- include('./skins/'.$default_skin.'/move_topic_body.tpl');
- include('./skins/'.$default_skin.'/overall_footer.tpl');
- }
- break;
- }
- case 'accept':
- {
- $pid = intval($_GET['id']);
- Secure::post_exists($pid);
- Mod::AcceptPost($pid);
- $stop = Over::TimeGeneration();
- $tid = Topic::PostInformation($pid,'t_id');
- message_forum($lng['post_accepted'], 'topic.php?t='.$tid);
- break;
- }
- default:
- {
- $stop = Over::TimeGeneration();
- message_forum($lng['invalidmode'],'index.php');
- break;
- }
- }
- ?>
|