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.
 
 
 
 
 
 

171 lines
4.3 KiB

<?php
/**
* @package uForum
* @file moderate.php
* @version $Id$
* @copyright 2009(c) PioDer <[email protected]>
* @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/db.php');
include('./includes/errors.php');
//connect to database
DataBase::db_connect();
include('./includes/sessions.php');
include('./includes/classes/class_user.php');
include('./common.php');
include('./includes/misc_functions.php');
include('./includes/classes/secure.php');
include('./includes/classes/class_mod.php');
include('./includes/classes/class_forum.php');
include('./includes/classes/class_topic.php');
include('./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);
$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);
}
$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'];
Mod::MoveTopic($tid,$fid);
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_associative($skin, GenerateHeader($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 = TimeGeneration();
$skin['queries'] = 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 = 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;
}
}
?>