Added files - test
git-svn-id: https://svn.pioder.pl/uf-svn/uF@11 72ec579a-5ced-4fa4-82f3-afba5d98df2f
This commit is contained in:
96
includes/class_mod.php
Normal file
96
includes/class_mod.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Dynamic Script Forum
|
||||
* @file includes/class_mod.php
|
||||
* @version 1.0.x, 11-02-2007, 20:23
|
||||
* @copyright 2008(c) PioDer <pioder@wp.pl>
|
||||
* @link http://pioder.gim2przemysl.int.pl/dsf.html
|
||||
* @license GNU GPL v3
|
||||
**/
|
||||
if ( !defined('IN_uF') )
|
||||
{
|
||||
die('Hacking attempt');
|
||||
}
|
||||
class Mod
|
||||
{
|
||||
function MoveTopic($tid, $fid)
|
||||
{
|
||||
$sql = "UPDATE `".TOPICS_TABLE."` SET `f_id`='$fid' WHERE `t_id`='$tid'";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not update topic');
|
||||
$sql = "UPDATE `".POSTS_TABLE."` SET `f_id`='$fid' WHERE `t_id`='$tid'";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not update post');
|
||||
}
|
||||
function TopicLocked($tid)
|
||||
{
|
||||
global $default_skin;
|
||||
global $default_lang;
|
||||
$lock = Topic::TopicInformation($tid,'lock');
|
||||
if ($lock=='1')
|
||||
{
|
||||
return '<a href="moderate.php?action=unlock&id='.$tid.'"><img border="0" src="skins/'.$default_skin.'/images/unlock.gif" width="20" height="20" alt="unlock">';
|
||||
}
|
||||
else
|
||||
{
|
||||
return '<a href="moderate.php?action=lock&id='.$tid.'"><img border="0" src="skins/'.$default_skin.'/images/lock.gif" width="20" height="20" alt="lock"></a>';
|
||||
}
|
||||
}
|
||||
function DeleteTopic($topicid)
|
||||
{
|
||||
$sql="SELECT * FROM ".POSTS_TABLE." WHERE `t_id`='$topicid'";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain post information');
|
||||
while($item = @mysql_fetch_array($query))
|
||||
{
|
||||
$uid = Topic::PostInformation($item['p_id'],'u_id');
|
||||
$posts = User::UserInformation($uid,'posts');
|
||||
$posts = $posts -1;
|
||||
$sql = "UPDATE `".USERS_TABLE."` SET `posts`='$posts' WHERE `u_id`='$uid'";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not update user amout of posts');
|
||||
}
|
||||
$sql = "DELETE FROM ".POSTS_TABLE." WHERE t_id='$topicid';";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not delete topic posts.');
|
||||
$sql = "DELETE FROM ".TOPICS_TABLE." WHERE t_id='$topicid';";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not delete topic posts.');
|
||||
}
|
||||
function LockTopic($topicid)
|
||||
{
|
||||
$sql = "UPDATE `".TOPICS_TABLE."` SET `lock` = '1' WHERE `t_id` =$topicid;";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not lock topic.');
|
||||
}
|
||||
function StickTopic($topicid, $mode)
|
||||
{
|
||||
$sql = "UPDATE `".TOPICS_TABLE."` SET `sticky` = '$mode' WHERE `t_id` =$topicid;";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not stick topic.');
|
||||
}
|
||||
function UnlockTopic($topicid)
|
||||
{
|
||||
$sql = "UPDATE `".TOPICS_TABLE."` SET `lock` = '0' WHERE `t_id` =$topicid;";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not unlock topic.');
|
||||
}
|
||||
function DeletePost($postid)
|
||||
{
|
||||
$uid = Topic::PostInformation($postid,'u_id');
|
||||
$tid = Topic::PostInformation($postid,'t_id');
|
||||
$posts = User::UserInformation($uid,'posts');
|
||||
$posts = $posts -1;
|
||||
$sql = "UPDATE `".USERS_TABLE."` SET `posts`='$posts' WHERE `u_id`='$uid'";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not update user amout of posts');
|
||||
$sql2 = "DELETE FROM ".POSTS_TABLE." WHERE p_id='$postid';";
|
||||
DataBase::sql_query($sql2,'GENERAL','Could not delete post.');
|
||||
$sql = "SELECT * FROM ".POSTS_TABLE." WHERE p_id>'$postid' AND `t_id`='$tid';";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain post information.');
|
||||
while($item=mysql_fetch_array($query))
|
||||
{
|
||||
$number = $item['tp_id'];
|
||||
$number = $number-1;
|
||||
$number2 = $item['p_id'];
|
||||
$sql3 = "UPDATE `".POSTS_TABLE."` SET `tp_id` = '$number' WHERE `p_id` =$number2;";
|
||||
DataBase::sql_query($sql3,'GENERAL','Could not update post.');
|
||||
}
|
||||
}
|
||||
function AcceptPost($postid)
|
||||
{
|
||||
$sql = "UPDATE `".POSTS_TABLE."` SET `moderated`='0' WHERE `p_id`='$postid'";
|
||||
DataBase::sql_query($sql, 'GENERAL', 'Could not accept post');
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user