git-svn-id: https://svn.pioder.pl/uf-svn/uF@18 72ec579a-5ced-4fa4-82f3-afba5d98df2fmaster
| @ -1,72 +0,0 @@ | |||||
| <?php | |||||
| /** | |||||
| * @package uForum | |||||
| * @file includes/class_error.php | |||||
| * @version $Id$ | |||||
| * @copyright 2009(c) PioDer <pioder@wp.pl> | |||||
| * @link http://pioder.gim2przemysl.int.pl/ | |||||
| * @license GNU GPL v3 | |||||
| **/ | |||||
| if ( !defined('IN_uF') ) | |||||
| { | |||||
| die('Hacking attempt'); | |||||
| } | |||||
| function message_die($type, $msm, $sql) | |||||
| { | |||||
| $msg =''; | |||||
| $msg = ' | |||||
| <body bgcolor=""> | |||||
| <table align="left" border="1" style="border-collapse: collapse; border-color: grey" width="500"> | |||||
| <tr> | |||||
| <td bgcolor="" align="left"> | |||||
| <font face="Verdana" style="font-size: 18pt; font-weight: bold" color="red">DSF v'.VERSION.' - '; | |||||
| $msg .= ($type='CRITICAL') ? 'CRITICAL ERROR' : 'GENERAL ERROR' ; | |||||
| $msg .= '</font> | |||||
| </td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td bgcolor="#FEC876" align="center"> | |||||
| <font face="Verdana" style="font-size: 13pt; font-weight: bold">'; | |||||
| $msg = $msg.$msm.' | |||||
| </font> | |||||
| </td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td align="left" bgcolor="white">'; | |||||
| if ($sql !='') | |||||
| { | |||||
| $msg = $msg.'<font face="Verdana" style="font-size: 11pt"><i>'.$sql.'</i></font>'; | |||||
| } | |||||
| $msg = $msg.'</td></tr><tr><td bgcolor="white"><center><font face="Verdana" style="font-size: 10pt">Problems? Questions? Visit: | |||||
| <a href="http://pioder.gim2przemysl.int.pl/forum/" target="_blank">http://pioder.gim2przemysl.int.pl/forum</a></font></td></tr></table></center></body>'; | |||||
| die($msg); | |||||
| } | |||||
| function message_forum($text, $url, $interval = 1.8) | |||||
| { | |||||
| global $lng; | |||||
| global $forum_config; | |||||
| $skin = array( | |||||
| 'url' => $url, | |||||
| 'msg' => $text, | |||||
| 'queries' => '', | |||||
| 'pa_link' => '', | |||||
| ); | |||||
| $skin = array_push_associative($skin,Over::generate_header($lng['message_forum'], '> '.$lng['message_forum'])); | |||||
| die( | |||||
| include('./skins/'.Over::ViewSkinName().'/message_body.tpl') | |||||
| ); | |||||
| } | |||||
| function admin_message_forum($text, $url) | |||||
| { | |||||
| $skin = array( | |||||
| 'url'=>$url, | |||||
| 'msg'=>$text, | |||||
| ); | |||||
| $skin['queries'] = ''; | |||||
| $skin['pa_link'] = ''; | |||||
| die( | |||||
| include('./../skins/'.Admin_Over::ViewSkinName().'/admin/message_body.tpl') | |||||
| ); | |||||
| } | |||||
| ?> | |||||
| @ -1,136 +0,0 @@ | |||||
| <?php | |||||
| /** | |||||
| * @package uForum | |||||
| * @file includes/class_forum.php | |||||
| * @version $Id$ | |||||
| * @copyright 2009(c) PioDer <pioder@wp.pl> | |||||
| * @link http://pioder.gim2przemysl.int.pl/ | |||||
| * @license GNU GPL v3 | |||||
| **/ | |||||
| if ( !defined('IN_uF') ) | |||||
| { | |||||
| die('Hacking attempt'); | |||||
| } | |||||
| class Forum | |||||
| { | |||||
| function AddForums($tid) | |||||
| { | |||||
| global $forum_config; | |||||
| $forum = Topic::TopicInformation($tid,'f_id'); | |||||
| $all=''; | |||||
| $query = DataBase::sql_query("SELECT `name`, `f_id` FROM `".FORUMS_TABLE."` ORDER BY `f_id`",'GENERAL','Could not obtain forum information'); | |||||
| while($t = @mysql_fetch_array($query)) | |||||
| { | |||||
| if ($t['f_id']==$forum) | |||||
| { | |||||
| $all .= '<option value="'.$t['f_id'].'" selected="selected">'.$t['name'].'</option>'."\n"; | |||||
| } | |||||
| else | |||||
| { | |||||
| $all .= '<option value="'.$t['f_id'].'">'.$t['name'].'</option>'."\n"; | |||||
| } | |||||
| } | |||||
| return $all; | |||||
| unset($t, $all); | |||||
| } | |||||
| function PostsInForum($forum_name) | |||||
| { | |||||
| $sql = "SELECT count(*) as `p_id` FROM ".POSTS_TABLE." WHERE f_id='$forum_name'"; | |||||
| $query = DataBase::sql_query($sql,'GENERAL','Could not obtain posts information.'); | |||||
| $result = mysql_fetch_array($query); | |||||
| return $result['p_id']; | |||||
| } | |||||
| function LastPost($posts, $forum) | |||||
| { | |||||
| global $lng; | |||||
| global $user; | |||||
| global $last_post; | |||||
| global $userdata; | |||||
| global $forum_config; | |||||
| if ($posts==0) { return '<p align="center" class="fstandard">'.$lng['nopost'].'</p>';} | |||||
| else | |||||
| { | |||||
| $id = $last_post[$forum]['tp_id']; | |||||
| $topic = $last_post[$forum]['t_id']; | |||||
| $userid = $last_post[$forum]['u_id']; | |||||
| $un = $last_post[$forum]['user_nick']; | |||||
| $rank = $last_post[$forum]['user_rank']; | |||||
| switch($rank) | |||||
| { | |||||
| case '0': | |||||
| { | |||||
| $user_color_name = $un; | |||||
| break; | |||||
| } | |||||
| case '1': | |||||
| { | |||||
| $user_color_name = '<font color="'.$forum_config['color_mod'].'"><b>'.$un.'</b></font>'; | |||||
| break; | |||||
| } | |||||
| case '2': | |||||
| { | |||||
| $user_color_name = '<font color="'.$forum_config['color_admin'].'"><b>'.$un.'</b></font>'; | |||||
| break; | |||||
| } | |||||
| } | |||||
| if ($_SESSION['uid']>0) | |||||
| { | |||||
| $limiter = $userdata['limit_tpid']; | |||||
| } | |||||
| else | |||||
| { | |||||
| $limiter = $forum_config['limit_tpid']; | |||||
| } | |||||
| $count = ceil($id / $limiter); | |||||
| if ($count >1) | |||||
| { | |||||
| $page= '&page='.$count; | |||||
| } | |||||
| else | |||||
| { | |||||
| $page=''; | |||||
| } | |||||
| return '<p align="center"><span class="fverysmall"><b>'.Over::GenerateTime($last_post[$forum]['time']).'</b><br></span> <a href="topic.php?t='.$topic.$page.'#p'.$id.'" class="fverysmall"><b>'.$lng['topic'].' #'.$topic.'</b></a><a class="fsmall">: </a><a href="user.php?id='.$userid.'" class="fverysmall">'.$user_color_name.'</a></p>'; | |||||
| } | |||||
| } | |||||
| function LastPostImg($postsinforum) | |||||
| { | |||||
| global $last_post; | |||||
| global $i; | |||||
| global $forum; | |||||
| global $default_skin; | |||||
| $time = time()-129600; | |||||
| if ($_SESSION['uid']>0) | |||||
| { | |||||
| if ($postsinforum>0) | |||||
| { | |||||
| if ($last_post[$forum[$i]['f_id']]['time']>$time) | |||||
| { | |||||
| return 'folder_new_posts'; | |||||
| } | |||||
| else | |||||
| { | |||||
| return 'folder_no_new_posts'; | |||||
| } | |||||
| } | |||||
| else | |||||
| { | |||||
| return 'folder_no_new_posts'; | |||||
| } | |||||
| } | |||||
| else | |||||
| { | |||||
| return 'folder_no_new_posts'; | |||||
| } | |||||
| } | |||||
| function ForumInformation($fid, $inf) | |||||
| { | |||||
| $sql = "SELECT `f_id`, `$inf` FROM ".FORUMS_TABLE." WHERE f_id='$fid';"; | |||||
| $query = DataBase::sql_query($sql,'GENERAL','Could not obtain forum information.'); | |||||
| $result = mysql_fetch_array($query); | |||||
| $result = $result[$inf]; | |||||
| return $result; | |||||
| } | |||||
| } | |||||
| ?> | |||||
| @ -1,96 +0,0 @@ | |||||
| <?php | |||||
| /** | |||||
| * @package uForum | |||||
| * @file includes/class_mod.php | |||||
| * @version $Id$ | |||||
| * @copyright 2009(c) PioDer <pioder@wp.pl> | |||||
| * @link http://pioder.gim2przemysl.int.pl/ | |||||
| * @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'); | |||||
| } | |||||
| } | |||||
| ?> | |||||
| @ -1,116 +0,0 @@ | |||||
| <?php | |||||
| /** | |||||
| * @package uForum | |||||
| * @file includes/class_posting.php | |||||
| * @version $Id$ | |||||
| * @copyright 2009(c) PioDer <pioder@wp.pl> | |||||
| * @link http://pioder.gim2przemysl.int.pl/ | |||||
| * @license GNU GPL v3 | |||||
| **/ | |||||
| if ( !defined('IN_uF') ) | |||||
| { | |||||
| die('Hacking attempt'); | |||||
| } | |||||
| class Post | |||||
| { | |||||
| function NewPost($tid, $post, $uid) | |||||
| { | |||||
| #read last post | |||||
| $last = DataBase::new_id(POSTS_TABLE); | |||||
| #read last post in topic | |||||
| $sql = "SELECT * FROM ".POSTS_TABLE." WHERE t_id='$tid' ORDER BY tp_id DESC LIMIT 1;"; | |||||
| $query = DataBase::sql_query($sql,'GENERAL','Could not last post information.'); | |||||
| $result = mysql_fetch_array($query); | |||||
| $forum = $result['f_id'];//forum id | |||||
| $moderate = Forum::ForumInformation($forum,'moderate'); | |||||
| $tpid = $result['tp_id'];//post in topic id | |||||
| $tpid = $tpid+1; | |||||
| # | |||||
| $time = time(); | |||||
| #add new post | |||||
| $sql = "INSERT INTO `".POSTS_TABLE."` VALUES ('$last','$tid', '$uid', '$post', '".$_SERVER['HTTP_USER_AGENT']."', '$time', '$tpid', '$forum','$moderate','".$_SERVER['REMOTE_ADDR']."')"; | |||||
| $query = DataBase::sql_query($sql,'GENERAL','Could not add new post.'); | |||||
| $result=User::UserInformation($uid,'posts'); | |||||
| $result = $result+1; | |||||
| $sql="UPDATE ".TOPICS_TABLE." SET lastpost_time='$time' WHERE t_id='$tid' "; | |||||
| $query = DataBase::sql_query($sql,'GENERAL','Could not update user information.'); | |||||
| $sql="UPDATE ".USERS_TABLE." SET posts='$result' WHERE u_id='$uid' "; | |||||
| $query = DataBase::sql_query($sql,'GENERAL','Could not update user information.'); | |||||
| return $tpid; | |||||
| } | |||||
| function EditPost($postid, $text) | |||||
| { | |||||
| $sql = "UPDATE `".POSTS_TABLE."` SET text='$text' WHERE `p_id`='$postid';"; | |||||
| $query = DataBase::sql_query($sql,'GENERAL','Could not edit post.'); | |||||
| } | |||||
| function NewTopic($posttext, $ntopic, $forum, $uid, $sticky) | |||||
| { | |||||
| //Select last topic | |||||
| $moderate = Forum::ForumInformation($forum,'moderate'); | |||||
| $time = time(); | |||||
| $lastt=DataBase::new_id(TOPICS_TABLE); | |||||
| $sql = "INSERT INTO ".TOPICS_TABLE." VALUES ('$lastt', '$forum', '0', '$sticky', '$ntopic', '$uid','$time')"; | |||||
| $query = DataBase::sql_query($sql,'GENERAL','Could not add new topic'); | |||||
| //add post | |||||
| //select last post | |||||
| $last = DataBase::new_id(POSTS_TABLE); | |||||
| //add post | |||||
| $sql = "INSERT INTO ".POSTS_TABLE." VALUES ('$last','$lastt', '$uid', '$posttext','".$_SERVER['HTTP_USER_AGENT']."', '$time', '1', '$forum', '$moderate','".$_SERVER['REMOTE_ADDR']."');"; | |||||
| $query = DataBase::sql_query($sql,'GENERAL','Could not add new post.'); | |||||
| $sql = "SELECT * FROM ".USERS_TABLE." WHERE u_id='$uid';"; | |||||
| $query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information.'); | |||||
| $result = mysql_fetch_array($query); | |||||
| $result = $result['posts']; | |||||
| $result = $result+1; | |||||
| $sql = "UPDATE ".USERS_TABLE." SET posts='$result' WHERE u_id='$uid' "; | |||||
| $query = DataBase::sql_query($sql,'GENERAL','Could not update user information.'); | |||||
| return $lastt; | |||||
| } | |||||
| function SmilesShow() | |||||
| { | |||||
| $text =''; | |||||
| $result=''; | |||||
| $sql = "SELECT * FROM ".SMILES_TABLE.""; | |||||
| $query = DataBase::sql_query($sql,'GENERAL','Cold not obtain smiles information.'); | |||||
| $i = 1; | |||||
| while($smile = mysql_fetch_array($query)) | |||||
| { | |||||
| $action = "insertSmile('".$smile['url']."','".$smile['smile']."')"; | |||||
| $mouse = "this.style.cursor='hand';"; | |||||
| $text = "\n".'<img src="'.$smile['url'].'" onmouseover="'.$mouse.'" onclick="'.$action.'" alt="'.$smile['smile'].'"> '."\n"; | |||||
| $result = $result.$text; | |||||
| if ($i%5==0) | |||||
| { | |||||
| $i = 1; | |||||
| $result=$result.'<br>'; | |||||
| } | |||||
| else | |||||
| { | |||||
| $i +=1; | |||||
| } | |||||
| } | |||||
| return $result; | |||||
| } | |||||
| function SmilesReplace($text) | |||||
| { | |||||
| $sql = "SELECT * FROM ".SMILES_TABLE.""; | |||||
| $query = DataBase::sql_query($sql,'GENERAL','Could not obtain emoticons information.'); | |||||
| $i = 1; | |||||
| while($result = mysql_fetch_array($query)) | |||||
| { | |||||
| $smile[$i]['smile'] = $result['smile']; | |||||
| $smile[$i]['url'] = $result['url']; | |||||
| $i +=1; | |||||
| } | |||||
| $smile = (!isset($smile)) ? array() : $smile; | |||||
| $i = 1; | |||||
| for($i=1;$i<=count($smile);$i++) | |||||
| { | |||||
| $text = str_replace(' '.$smile[$i]['smile'],'<img src="'.$smile[$i]['url'].'" alt="'.$smile[$i]['smile'].'">', $text); | |||||
| $text = str_replace(' '.$smile[$i]['smile'],'<img src="'.$smile[$i]['url'].'" alt="'.$smile[$i]['smile'].'">', $text); | |||||
| } | |||||
| return $text; | |||||
| } | |||||
| } | |||||
| ?> | |||||
| @ -1,197 +0,0 @@ | |||||
| <?php | |||||
| /** | |||||
| * @package uForum | |||||
| * @file includes/class_topic.php | |||||
| * @version $Id$ | |||||
| * @copyright 2009(c) PioDer <pioder@wp.pl> | |||||
| * @link http://pioder.gim2przemysl.int.pl/ | |||||
| * @license GNU GPL v3 | |||||
| **/ | |||||
| if ( !defined('IN_uF') ) | |||||
| { | |||||
| die('Hacking attempt'); | |||||
| } | |||||
| class Topic | |||||
| { | |||||
| function LastPostInTopic($topic) | |||||
| { | |||||
| global $lng; | |||||
| global $lastpost; | |||||
| global $forum_config; | |||||
| global $userdata; | |||||
| $id = $lastpost[$topic]['tp_id']; | |||||
| $userid = $lastpost[$topic]['u_id']; | |||||
| $un = $lastpost[$topic]['user_nick']; | |||||
| $rank = $lastpost[$topic]['user_rank']; | |||||
| switch($rank) | |||||
| { | |||||
| case '0': | |||||
| { | |||||
| $user_color_name = $un; | |||||
| break; | |||||
| } | |||||
| case '1': | |||||
| { | |||||
| $user_color_name = '<font color="'.$forum_config['color_mod'].'"><b>'.$un.'</b></font>'; | |||||
| break; | |||||
| } | |||||
| case '2': | |||||
| { | |||||
| $user_color_name = '<font color="'.$forum_config['color_admin'].'"><b>'.$un.'</b></font>'; | |||||
| break; | |||||
| } | |||||
| } | |||||
| if ($_SESSION['uid']>0) | |||||
| { | |||||
| $limiter = $userdata['limit_tpid']; | |||||
| } | |||||
| else | |||||
| { | |||||
| $limiter = $forum_config['limit_tpid']; | |||||
| } | |||||
| $count = ceil($id / $limiter); | |||||
| if ($count >1) | |||||
| { | |||||
| $page= '&page='.$count; | |||||
| } | |||||
| else | |||||
| { | |||||
| $page=''; | |||||
| } | |||||
| return '<p align="center"><span class="fverysmall"><b>'.Over::GenerateTime($lastpost[$topic]['time']).'</b><br></span> <a href="topic.php?t='.$topic.$page.'#p'.$id.'" class="fverysmall"><b>Post #'.$id.'</b></a><a class="fsmall">: </a><a href="user.php?id='.$userid.'" class="fverysmall">'.$user_color_name.'</a></p>'; | |||||
| } | |||||
| function LastPostImg() | |||||
| { | |||||
| global $lastpost; | |||||
| global $record; | |||||
| global $default_skin; | |||||
| $time = time()-129600; | |||||
| if ($_SESSION['uid']>0) | |||||
| { | |||||
| if ($lastpost[$record['t_id']]['time']>$time) | |||||
| { | |||||
| return 'folder_new_posts'; | |||||
| } | |||||
| else | |||||
| { | |||||
| return 'folder_no_new_posts'; | |||||
| } | |||||
| } | |||||
| else | |||||
| { | |||||
| return 'folder_no_new_posts'; | |||||
| } | |||||
| } | |||||
| function TopicAuthor($uid) | |||||
| { | |||||
| global $record; | |||||
| global $forum_config; | |||||
| $rank = $record['rank']; | |||||
| $nick = $record['nick']; | |||||
| switch($rank) | |||||
| { | |||||
| case '0': | |||||
| { | |||||
| $user_color_name = $nick; | |||||
| break; | |||||
| } | |||||
| case '1': | |||||
| { | |||||
| $user_color_name = '<font color="'.$forum_config['color_mod'].'"><b>'.$nick.'</b></font>'; | |||||
| break; | |||||
| } | |||||
| case '2': | |||||
| { | |||||
| $user_color_name = '<font color="'.$forum_config['color_admin'].'"><b>'.$nick.'</b></font>'; | |||||
| break; | |||||
| } | |||||
| } | |||||
| return '<a href="user.php?id='.$uid.'" class="fstandard">'.$user_color_name.'</a>'; | |||||
| } | |||||
| function TopicInformation($tid, $mode) | |||||
| { | |||||
| $sql = "SELECT * FROM ".TOPICS_TABLE." WHERE t_id='$tid';"; | |||||
| $query = DataBase::sql_query($sql,'GENERAL','Could not obtain topic information'); | |||||
| $result = mysql_fetch_array($query); | |||||
| $result = $result[$mode]; | |||||
| return $result; | |||||
| } | |||||
| function PostInformation($pid, $mode) | |||||
| { | |||||
| $sql = "SELECT * FROM ".POSTS_TABLE." WHERE p_id='$pid';"; | |||||
| $query = DataBase::sql_query($sql,'GENERAL','Could not obtain topic information'); | |||||
| $result = mysql_fetch_array($query); | |||||
| $result = $result[$mode]; | |||||
| return $result; | |||||
| } | |||||
| function PostText($text,$postmoderate, $pid) | |||||
| { | |||||
| global $forum; | |||||
| global $lng; | |||||
| $text = stripslashes($text); | |||||
| $text = Topic::TagsReplace($text); | |||||
| if($forum['moderate']==1) | |||||
| { | |||||
| if ($postmoderate==1) | |||||
| { | |||||
| if ($_SESSION['uid']>0) | |||||
| { | |||||
| if (RANK>0) | |||||
| { | |||||
| return '<span class="fstandard"><b>'.$lng['moderated_post_text'].': </b></span><br>'.Topic::TagsReplace('[quote]'.$text.'[/quote]').'<br><a href="moderate.php?action=accept&id='.$pid.'"><span class="fstandard" style="color: red"><b>'.$lng['visible_of_post'].'</b></span></a>'; | |||||
| } | |||||
| else | |||||
| { | |||||
| return '<span class="fstandard"><b><i>'.$lng['post_moderated'].'</i></b></span>'; | |||||
| } | |||||
| } | |||||
| else | |||||
| { | |||||
| return '<span class="fstandard"><b><i>'.$lng['post_moderated'].'</i></b></span>'; | |||||
| } | |||||
| } | |||||
| else | |||||
| { | |||||
| return $text; | |||||
| } | |||||
| } | |||||
| else | |||||
| { | |||||
| return $text; | |||||
| } | |||||
| } | |||||
| function UserName($nick, $rank) | |||||
| { | |||||
| global $forum_config; | |||||
| switch($rank) | |||||
| { | |||||
| case '0': | |||||
| { | |||||
| return $nick; | |||||
| break; | |||||
| } | |||||
| case '1': | |||||
| { | |||||
| return '<font color="'.$forum_config['color_mod'].'"><b>'.$nick.'</b></font>'; | |||||
| break; | |||||
| } | |||||
| case '2': | |||||
| { | |||||
| return '<font color="'.$forum_config['color_admin'].'"><b>'.$nick.'</b></font>'; | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
| function TagsReplace($text) | |||||
| { | |||||
| global $lng; | |||||
| //quote | |||||
| $text = preg_replace("#\[quote\](.*?)\[/quote]#si", "<table class=\"maintable\" width=\"450\"><tr><td bgcolor=\"silver\"><span class=\"fsmall\"><b>".$lng['quote2'].":</b></span></td></tr><tr><td bgcolor=\"lightgrey\"><span class=\"textquote\">\\1</span></td></tr></table>", $text); | |||||
| //code | |||||
| $text = preg_replace("#\[code\](.*?)\[/code]#si", "<table class=\"maintable\" width=\"450\"><tr><td bgcolor=\"lightgreen\"><font face=\"Verdana\" style=\"font-size: 8pt\" color=\"green\"><b>Code:</b></font></td></tr><tr><td bgcolor=\"#D4FFAA\"><span class=\"textquote\">\\1</span></td></tr></table>", $text); | |||||
| return $text; | |||||
| } | |||||
| } | |||||
| ?> | |||||
| @ -1,208 +0,0 @@ | |||||
| <?php | |||||
| /** | |||||
| * @package uForum | |||||
| * @file includes/class_user.php | |||||
| * @version $Id$ | |||||
| * @copyright 2009(c) PioDer <pioder@wp.pl> | |||||
| * @link http://pioder.gim2przemysl.int.pl/ | |||||
| * @license GNU GPL v3 | |||||
| **/ | |||||
| if ( !defined('IN_uF') ) | |||||
| { | |||||
| die('Hacking attempt'); | |||||
| } | |||||
| class User | |||||
| { | |||||
| function LastUser() | |||||
| { | |||||
| global $lastuser; | |||||
| $usr = $lastuser['nick']; | |||||
| $uid = $lastuser['u_id']; | |||||
| return '<a href="user.php?id='.$uid.'" class="fstandard">'.$usr.'</a>'; | |||||
| } | |||||
| function UserInformation($uid, $inf) | |||||
| { | |||||
| $sql = "SELECT `$inf` FROM ".USERS_TABLE." WHERE u_id='$uid';"; | |||||
| $query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information.'); | |||||
| $result = mysql_fetch_array($query); | |||||
| $result = $result[$inf]; | |||||
| return $result; | |||||
| } | |||||
| function UserIdByNick($nick) | |||||
| { | |||||
| $sql = "SELECT * FROM `".USERS_TABLE."` WHERE `nick`='$nick';"; | |||||
| $result = mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain user information.')); | |||||
| $result = $result['u_id']; | |||||
| /*if ($result=='') | |||||
| { | |||||
| message_forum('nick failed','admin_groups.php'); | |||||
| }*/ | |||||
| return $result; | |||||
| } | |||||
| function AddToGroup($uid, $gid) | |||||
| { | |||||
| $last= DataBase::new_id(USERS_GROUP_TABLE); | |||||
| $sql = "INSERT INTO `".USERS_GROUP_TABLE."` VALUES ('$last','$uid', '$gid')"; | |||||
| DataBase::sql_query($sql,'GENERAL','Could not add user to group.'); | |||||
| } | |||||
| function DeleteFromGroup($uid, $gid) | |||||
| { | |||||
| $sql = "DELETE FROM `".USERS_GROUP_TABLE."` WHERE `u_id`='$uid' AND `g_id`='$gid'"; | |||||
| DataBase::sql_query($sql,'GENERAL','Could not delete user for group.'); | |||||
| } | |||||
| function LogedAs($sid, $uid) | |||||
| { | |||||
| global $lng; | |||||
| global $userdata; | |||||
| if ($uid>0) | |||||
| { | |||||
| $nick = $userdata['nick']; | |||||
| return(''.$lng['youareloggedas'].' <a href="user.php?id='.$uid.'" class="fstandard"><b>'.$nick.'</b></a>'); | |||||
| } | |||||
| else | |||||
| { | |||||
| return($lng['youarenotlogd']); | |||||
| } | |||||
| } | |||||
| function PostWithForum($posts) | |||||
| { | |||||
| $result2 = Over::TotalPosts(); | |||||
| if($result2>0) | |||||
| { | |||||
| $result3 = ($posts/$result2*100); | |||||
| $result3 = round($result3,2); | |||||
| return($result3); | |||||
| } | |||||
| else | |||||
| { | |||||
| return(0); | |||||
| } | |||||
| } | |||||
| function LastRegVisit($uid, $mode) | |||||
| { | |||||
| global $lng; | |||||
| $result = User::UserInformation($uid,$mode); | |||||
| if ($result=='0') | |||||
| { | |||||
| return($lng['never']); | |||||
| } | |||||
| else | |||||
| { | |||||
| $date = date('d-m-Y, G:i',$result); | |||||
| return($date); | |||||
| } | |||||
| } | |||||
| function UserRank($rank) | |||||
| { | |||||
| global $lng; | |||||
| global $forum_config; | |||||
| switch($rank) | |||||
| { | |||||
| case '0': {$result=$lng['user']; break; } | |||||
| case '1': {$result='<font color="'.$forum_config['color_mod'].'"><b>'.$lng['mod'].'</b></font>'; break; } | |||||
| case '2': {$result='<font color="'.$forum_config['color_admin'].'"><b>'.$lng['admin'].'</b></font>'; break; } | |||||
| } | |||||
| return($result); | |||||
| } | |||||
| function RankAdminMod($uid) | |||||
| { | |||||
| if ($uid>0) | |||||
| { | |||||
| $sql = "SELECT * FROM ".USERS_TABLE." WHERE u_id='$uid'"; | |||||
| $query = DataBase::sql_query($sql,'GENERAL','Could not obtain user`s rank information.'); | |||||
| $result = mysql_fetch_array($query); | |||||
| $rank = $result['rank']; | |||||
| if (($rank=='1') or ($rank=='2')) | |||||
| { | |||||
| return '1'; | |||||
| } | |||||
| else | |||||
| { | |||||
| return '0'; | |||||
| } | |||||
| } | |||||
| else | |||||
| { | |||||
| return '0'; | |||||
| } | |||||
| } | |||||
| function UpdateProfile($uid, $gg, $email, $interests, $sig, $avatar, $allow_qr, $allow_email, $allow_gg, $skin, $lang, $limit_tpid, $limit_ftid, $limit_users, $allow_shoutbox) | |||||
| { | |||||
| $sql ="UPDATE `".USERS_TABLE."` SET | |||||
| `gg` = '$gg', | |||||
| `email` = '$email', | |||||
| `allow_gg` = '$allow_gg', | |||||
| `allow_email` = '$allow_email', | |||||
| `allow_qr` = '$allow_qr', | |||||
| `interests` = '$interests', | |||||
| `sig` = '$sig', | |||||
| `avatar` = '$avatar', | |||||
| `skin`='$skin', | |||||
| `lang`='$lang', | |||||
| `limit_tpid` = '$limit_tpid', | |||||
| `limit_ftid` = '$limit_ftid', | |||||
| `view_shoutbox` = '$allow_shoutbox', | |||||
| `limit_users` = '$limit_users' | |||||
| WHERE `u_id` ='$uid' LIMIT 1 ;"; | |||||
| DataBase::sql_query($sql,'CRITICAL','Could not update user information'); | |||||
| } | |||||
| function UpdateAdminPools($uid, $posts, $rank, $active, $nick) | |||||
| { | |||||
| $sql ="UPDATE `".USERS_TABLE."` SET | |||||
| `posts` = '$posts', | |||||
| `rank` = '$rank', | |||||
| `active` = '$active' | |||||
| WHERE `u_id` ='$uid' LIMIT 1 ;"; | |||||
| DataBase::sql_query($sql,'CRITICAL','Could not update user information'); | |||||
| } | |||||
| function UpdatePassword($uid, $pass) | |||||
| { | |||||
| $sql ="UPDATE `".USERS_TABLE."` SET | |||||
| `pass` = '$pass' | |||||
| WHERE `u_id` ='$uid' LIMIT 1 ;"; | |||||
| DataBase::sql_query($sql,'CRITICAL','Could not update user information'); | |||||
| } | |||||
| function CreateProfile($nick, $pass, $email, $gg, $allow_gg, $allow_email, $allow_qr, $sig, $av, $interests) | |||||
| { | |||||
| global $forum_config; | |||||
| $last = DataBase::new_id(USERS_TABLE); | |||||
| $time = time(); | |||||
| $sql = "INSERT INTO ".USERS_TABLE." VALUES | |||||
| ('$last', '$nick', '$pass', '$email', '0', '$time', '0', '$gg', '$allow_gg', '$allow_email', '$allow_qr', '".$forum_config['view_shoutbox']."', '".$forum_config['defaultskin']."', '".$forum_config['defaultlang']."','".$forum_config['limit_tpid']."', '".$forum_config['limit_ftid']."', '".$forum_config['limit_users']."', '$sig', '$av', '1','0','$interests');"; | |||||
| DataBase::sql_query($sql,'CRITICAL','Could not create new user'); | |||||
| } | |||||
| function UserMsgs() | |||||
| { | |||||
| $uid = $_SESSION['uid']; | |||||
| if($uid>0) | |||||
| { | |||||
| $sql = "SELECT count(*) as `m_id` FROM ".PM_INBOX_TABLE." WHERE `u_id`='$uid' AND `read`='0'"; | |||||
| $result = mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain amounts PM of User.')); | |||||
| $result = $result['m_id']; | |||||
| if ($result>0) | |||||
| { | |||||
| return '<font color="red">'.$result.'</font>'; | |||||
| } | |||||
| else | |||||
| { | |||||
| return $result; | |||||
| } | |||||
| } | |||||
| } | |||||
| function UserAddWarn($uid, $value, $motive) | |||||
| { | |||||
| $sql = "INSERT INTO `".WARNINGS_TABLE."` ( `w_id` , `u_id` , `value` , `motive` ) VALUES('','$uid','$value','$motive');"; | |||||
| DataBase::sql_query($sql,'GENERAL','Could not add new warn.'); | |||||
| if (User::UserLevelWarns($uid)==100) | |||||
| { | |||||
| $ban_ip = '0.0.0.0'; | |||||
| $ban_uid = $uid; | |||||
| $ban_motive = $lng['warns_ban']; | |||||
| $sql = "INSERT INTO ".BANLIST_TABLE." VALUES ('', '$ban_uid', '$ban_ip', '$ban_motive')"; | |||||
| DataBase::sql_query($sql,'GENERAL','Could not update add ban.'); | |||||
| } | |||||
| } | |||||
| } | |||||
| ?> | |||||