A lightweight forum engine written in PHP. Repository is now obsolete and read-only. http://www.pioder.pl/uforum.html
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

161 lines
4.2 KiB

<?php
/**
* @package uForum
* @file moderate.php
* @version $Id$
* @copyright 2007-2010 (c) PioDer <[email protected]>
* @link http://www.pioder.pl/
* @license see LICENSE.txt
**/
define('IN_uF', true);
//include files
require('./config.php');
require('./includes/constants.php');
require('./includes/db.php');
require('./includes/errors.php');
//connect to database
DataBase::db_connect();
require('./includes/sessions.php');
require('./includes/classes/class_user.php');
require('./common.php');
require('./includes/misc_functions.php');
require('./includes/classes/secure.php');
require('./includes/classes/class_mod.php');
require('./includes/classes/class_forum.php');
require('./includes/classes/class_topic.php');
require('./lngs/'.DefaultLang().'/main.php');
$start = TimeGeneration();
SessDelInvalid();
SessRegister();
SessDeleteOld();
if ($_SESSION['uid']>0)
{
if (RANK==0)
{
$stop = 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);
TriggerStats($fid, 1);
$stop = TimeGeneration();
message_forum($lng['tdeleted'], 'forum.php?f='.$fid);
break;
}
case 'lock':
{
$tid = intval($_GET['id']);
Secure::topic_exists($tid);
Mod::LockTopic($tid);
$stop = TimeGeneration();
message_forum($lng['tlocked'], 'topic.php?t='.$tid);
break;
}
case 'unlock':
{
$tid = intval($_GET['id']);
Secure::topic_exists($tid);
Mod::UnlockTopic($tid);
$stop = 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);
TriggerStats($tid, 2);
}
$stop = 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 = 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 = 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'];
$f_id = Topic::TopicInformation($tid, 'f_id');
Mod::MoveTopic($tid,$fid);
TriggerStats($fid, 1);
TriggerStats($f_id, 1);
message_forum($lng['topic_moved'],'topic.php?t='.$tid);
}
else
{
$start = TimeGeneration();
$default_skin = 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_assoc($skin, GenerateHeader($lng['move_topic'].': '.Topic::TopicInformation($tid,'name'), '<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')));
$stop = TimeGeneration();
$skin['queries'] = ShowQueries($start, $stop);
//do it!
require('./skins/'.$default_skin.'/overall_header.tpl');
require('./skins/'.$default_skin.'/move_topic_body.tpl');
require('./skins/'.$default_skin.'/overall_footer.tpl');
}
break;
}
case 'accept':
{
$pid = intval($_GET['id']);
Secure::post_exists($pid);
Mod::AcceptPost($pid);
$stop = TimeGeneration();
$tid = Topic::PostInformation($pid,'t_id');
message_forum($lng['post_accepted'], 'topic.php?t='.$tid);
break;
}
default:
{
$stop = TimeGeneration();
message_forum($lng['invalidmode'],'index.php');
break;
}
}
?>