Added files - test
git-svn-id: https://svn.pioder.pl/uf-svn/uF@11 72ec579a-5ced-4fa4-82f3-afba5d98df2f
This commit is contained in:
38
includes/admin/class_forum.php
Normal file
38
includes/admin/class_forum.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Dynamic Script Forum
|
||||
* @file includes/admin/class_forum.php
|
||||
* @version 1.0.x, 17-05-2007, 19:59
|
||||
* @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 Admin_Forum
|
||||
{
|
||||
function AddCats($fid)
|
||||
{
|
||||
global $forum_config;
|
||||
$cat = Forum::ForumInformation($fid,'c_id');
|
||||
$all='';
|
||||
$query = DataBase::sql_query("SELECT `name`, `c_id` FROM `".CATS_TABLE."`",'GENERAL','Could not obtain category information');
|
||||
while($t = @mysql_fetch_array($query))
|
||||
{
|
||||
|
||||
if ($t['c_id']==$cat)
|
||||
{
|
||||
$all .= '<option value="'.$t['c_id'].'" selected="selected">'.$t['name'].'</option>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$all .= '<option value="'.$t['c_id'].'">'.$t['name'].'</option>'."\n";
|
||||
}
|
||||
}
|
||||
return $all;
|
||||
unset($t, $all);
|
||||
}
|
||||
}
|
||||
?>
|
||||
160
includes/admin/class_main.php
Normal file
160
includes/admin/class_main.php
Normal file
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Dynamic Script Forum
|
||||
* @file includes/admin/class_main.php
|
||||
* @version 1.0.x, 17-03-2007, 19:59
|
||||
* @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 Admin_Over
|
||||
{
|
||||
function AddPages()
|
||||
{
|
||||
global $count;
|
||||
global $page;
|
||||
$content = '';
|
||||
for ($i=1;$i<=$count;$i++)
|
||||
{
|
||||
if ($i==$page)
|
||||
{
|
||||
$content .= '<option value="'.$i.'" selected="selected">'.$i.'</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$content .= '<option value="'.$i.'">'.$i.'</option>';
|
||||
}
|
||||
}
|
||||
return $content;
|
||||
unset($content);
|
||||
}
|
||||
function AddSkins()
|
||||
{
|
||||
global $forum_config;
|
||||
global $default_skin;
|
||||
$all='';
|
||||
$query = DataBase::sql_query("SELECT `name`, `s_id` FROM `".SKINS_TABLE."`",'GENERAL','Could not obtain skins information');
|
||||
while($t = @mysql_fetch_array($query))
|
||||
{
|
||||
|
||||
if ($t['name']==$default_skin)
|
||||
{
|
||||
$all .= '<option value="'.$t['s_id'].'" selected="selected">'.$t['name'].'</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$all .= '<option value="'.$t['s_id'].'">'.$t['name'].'</option>';
|
||||
}
|
||||
}
|
||||
return $all;
|
||||
unset($t, $all);
|
||||
}
|
||||
function AddPages2($page)//for edit profile, not used in limit!
|
||||
{
|
||||
$content = '';
|
||||
for ($i=1;$i<=50;$i++)
|
||||
{
|
||||
if ($i==$page)
|
||||
{
|
||||
$content .= '<option value="'.$i.'" selected="selected">'.$i.'</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$content .= '<option value="'.$i.'">'.$i.'</option>';
|
||||
}
|
||||
}
|
||||
return $content;
|
||||
unset($content);
|
||||
}
|
||||
function AddLangs()
|
||||
{
|
||||
global $forum_config;
|
||||
global $default_lang;
|
||||
$result='';
|
||||
$rep=opendir('./../lngs');
|
||||
$bAuMoinsUnRepertoire = false;
|
||||
while ($file = readdir($rep))
|
||||
{
|
||||
if($file != '..' && $file !='.' && $file !='')
|
||||
{
|
||||
if (is_dir('./../lngs/'.$file)){
|
||||
$bAuMoinsUnRepertoire = true;
|
||||
if ($file==$default_lang)
|
||||
{
|
||||
$result .='<option value="'.$file.'" selected="selected">'.$file.'</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$result .='<option value="'.$file.'">'.$file.'</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
unset($rep, $bAuMoinsUnRepertoire, $file, $result);
|
||||
}
|
||||
function ViewSkinName()
|
||||
{
|
||||
global $forum_config;
|
||||
if ($_SESSION['uid']>0)
|
||||
{
|
||||
$result = User::UserInformation($_SESSION['uid'],'skin');
|
||||
$sql = "SELECT * FROM `".SKINS_TABLE."` WHERE `s_id`='$result'";
|
||||
$result = mysql_fetch_array(DataBase::sql_query($sql,'CRITICAL','Could not obtain skin information.'));
|
||||
return $result['name'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $forum_config['defaultskin'];
|
||||
$sql = "SELECT * FROM `".SKINS_TABLE."` WHERE `s_id`='$result'";
|
||||
$result = mysql_fetch_array(DataBase::sql_query($sql,'CRITICAL','Could not obtain skin information.'));
|
||||
return $result['name'];
|
||||
}
|
||||
}
|
||||
function DefaultLang()
|
||||
{
|
||||
global $forum_config;
|
||||
if ($_SESSION['uid']>0)
|
||||
{
|
||||
return User::UserInformation($_SESSION['uid'],'lang');
|
||||
}
|
||||
else
|
||||
{
|
||||
return $forum_config['defaultlang'];
|
||||
}
|
||||
}
|
||||
function TotalTopics()
|
||||
{
|
||||
$sql = "SELECT `t_id` FROM ".TOPICS_TABLE.";";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain total posts information');
|
||||
$result = mysql_num_rows($query);
|
||||
return($result);
|
||||
}
|
||||
function TotalPosts()
|
||||
{
|
||||
$sql = "SELECT `p_id` FROM ".POSTS_TABLE.";";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain total posts information');
|
||||
$result = mysql_num_rows($query);
|
||||
return($result);
|
||||
}
|
||||
function GenerateHeader()
|
||||
{
|
||||
global $default_skin;
|
||||
global $lng;
|
||||
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<link rel="shortcut icon" href="skins/'.$default_skin.'/images/favicon.ico">
|
||||
<link rel="favicon" href="template/images/favicon.ico">
|
||||
<link rel="stylesheet" href="template/skin.css" type="text/css">
|
||||
<title>DSF Administration</title>
|
||||
</head>
|
||||
<body class="body">
|
||||
<div align="center"><span class="pa_h1">'.$lng['uf_pa'].'</span></div>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
15
includes/admin/index.html
Normal file
15
includes/admin/index.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<title>Untitled</title>
|
||||
<meta http-equiv="refresh" content="0; url=../../index.php" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>
|
||||
|
||||
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
83
includes/cache/cache_forums.php
vendored
Normal file
83
includes/cache/cache_forums.php
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Dynamic Script Forum
|
||||
* @file includes/cache/cache_forums.php
|
||||
* @version 1.0.x, 02-12-2007, 14:00
|
||||
* @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');
|
||||
}
|
||||
//cache forums and posts - version v1.0 Alpha 2---------------------------------
|
||||
$default_skin = Over::ViewSkinName();
|
||||
$sql = "SELECT `name`,`lock` FROM ".FORUMS_TABLE." WHERE `f_id`='$fid' LIMIT 1";
|
||||
$result = @mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain forum information'));
|
||||
if ($result['name']=='')
|
||||
{
|
||||
message_forum($lng['no_forum'],'index.php');
|
||||
}
|
||||
$forum = array(
|
||||
'name'=>$result['name'],
|
||||
'lock'=>$result['lock']
|
||||
);
|
||||
$sql = "SELECT COUNT(*) as `p_id`, `t_id` FROM ".POSTS_TABLE." GROUP BY `t_id`";
|
||||
$query = DataBase::sql_query($sql,'GENERAL', 'Could not obtain amout of posts in forum');
|
||||
while($result = @mysql_fetch_array($query))
|
||||
{
|
||||
$count_topic[$result['t_id']]=$result['p_id'];
|
||||
}
|
||||
$sql = "SELECT ".POSTS_TABLE.".*, ".USERS_TABLE.".* FROM ".POSTS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".USERS_TABLE.".u_id = ".POSTS_TABLE.".u_id WHERE `f_id`='$fid' ORDER BY `ptime`";
|
||||
$query = DataBase::sql_query($sql,'GENERAL', 'Could not obtain amout of posts in forum');
|
||||
while($result = @mysql_fetch_array($query))
|
||||
{
|
||||
$lastpost[$result['t_id']]['tp_id']=$result['tp_id'];
|
||||
$lastpost[$result['t_id']]['u_id']=$result['u_id'];
|
||||
$lastpost[$result['t_id']]['time']=$result['ptime'];
|
||||
$lastpost[$result['t_id']]['user_nick']=$result['nick'];
|
||||
$lastpost[$result['t_id']]['user_rank']=$result['rank'];
|
||||
}
|
||||
//
|
||||
//generate output pages
|
||||
//
|
||||
if ($_SESSION['uid']>0)
|
||||
{
|
||||
$limiter = $userdata['limit_ftid'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$limiter = $forum_config['limit_ftid'];
|
||||
}
|
||||
if (isset($_GET['page'])&&($_GET['page']!=1))
|
||||
{
|
||||
if (!is_numeric($_GET['page']))
|
||||
{
|
||||
die('Hacking attempt');
|
||||
}
|
||||
$value = ($_GET['page']-1)*$limiter;
|
||||
$limit = 'LIMIT '.$value . ', '.$limiter;
|
||||
$page = $_GET['page'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$limit = 'LIMIT 0, '.$limiter;
|
||||
$page=1;
|
||||
}
|
||||
$count = @mysql_fetch_array(DataBase::sql_query("SELECT COUNT(`t_id`) as `t_id`
|
||||
FROM ".TOPICS_TABLE." WHERE `f_id`='$fid'",'GENERAL','Could not obtain count amout of topics'));
|
||||
$count = $count['t_id'];
|
||||
$count = ceil($count / $limiter);
|
||||
if ($count==0)
|
||||
{
|
||||
$count +=1;
|
||||
}
|
||||
if(isset($_GET['page']) && ($_GET['page']>$count))
|
||||
{
|
||||
message_forum($lng['invalidpage'],'index.php');
|
||||
}
|
||||
//
|
||||
//end generating pages
|
||||
//
|
||||
?>
|
||||
48
includes/cache/cache_index.php
vendored
Normal file
48
includes/cache/cache_index.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Dynamic Script Forum
|
||||
* @file includes/cache/cache_index.php
|
||||
* @version 1.0.x, 10-04-2007, 17:04
|
||||
* @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');
|
||||
}
|
||||
//
|
||||
//cache forums and posts - version v1.0 Alpha 2---------------------------------
|
||||
//
|
||||
//lastpost in forum cache
|
||||
$sql = "SELECT ".POSTS_TABLE.".*, ".USERS_TABLE.".* FROM ".POSTS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".POSTS_TABLE.".u_id = ".USERS_TABLE.".u_id GROUP BY `f_id`, `ptime` ORDER BY `ptime`";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain last post in topic', true);
|
||||
$post_count = @mysql_num_rows($query);
|
||||
while($result = @mysql_fetch_array($query))
|
||||
{
|
||||
$last_post[$result['f_id']]['tp_id'] = $result['tp_id'];
|
||||
$last_post[$result['f_id']]['u_id'] = $result['u_id'];
|
||||
$last_post[$result['f_id']]['t_id'] = $result['t_id'];
|
||||
$last_post[$result['f_id']]['time'] = $result['ptime'];
|
||||
$last_post[$result['f_id']]['user_rank'] = $result['rank'];
|
||||
$last_post[$result['f_id']]['user_nick'] = $result['nick'];
|
||||
}
|
||||
//cache forums --don't modify!!!
|
||||
$cache_id=1;
|
||||
$sql = "SELECT ".FORUMS_TABLE.".*, COUNT(".POSTS_TABLE.".p_id) as amout, ".POSTS_TABLE.".f_id AS count FROM ".FORUMS_TABLE." LEFT JOIN ".POSTS_TABLE." ON ".FORUMS_TABLE.".f_id= ".POSTS_TABLE.".f_id GROUP BY `f_id` ORDER BY `c_id`, `sort`";
|
||||
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain forum information.');
|
||||
while($result = @mysql_fetch_array($query))
|
||||
{
|
||||
$forum[$cache_id]['f_id'] = $result['f_id'];
|
||||
$forum[$cache_id]['name'] = $result['name'];
|
||||
$forum[$cache_id]['desc'] = $result['desc'];
|
||||
$forum[$cache_id]['c_id'] = $result['c_id'];
|
||||
$forum[$cache_id]['sort'] = $result['sort'];
|
||||
$count_forum[$result['f_id']] = $result['amout'];
|
||||
$cache_id+=1;
|
||||
}
|
||||
$sql = "SELECT `u_id`,`nick`, `regdate` AS count FROM ".USERS_TABLE." ORDER BY `regdate` DESC";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain amout of count users information');
|
||||
$lastuser = @mysql_fetch_array($query);
|
||||
$count_users = @mysql_num_rows($query) -1;
|
||||
?>
|
||||
95
includes/cache/cache_topic.php
vendored
Normal file
95
includes/cache/cache_topic.php
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Dynamic Script Forum
|
||||
* @file includes/cache/cache_topic.php
|
||||
* @version 1.0.x, 02-12-2007, 14:16
|
||||
* @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');
|
||||
}
|
||||
//||topic.php script cache ------------------------------------------------------------------------------
|
||||
$sql = "SELECT ".TOPICS_TABLE.".*, ".TOPICS_TABLE.".name AS topic_name, ".TOPICS_TABLE.".lock AS topic_lock, ".FORUMS_TABLE.".* FROM ".TOPICS_TABLE." LEFT JOIN ".FORUMS_TABLE." ON ".TOPICS_TABLE.".f_id = ".FORUMS_TABLE.".f_id WHERE `t_id`='$tid' LIMIT 1";
|
||||
$result = @mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain forum information'));
|
||||
if ($result['t_id']=='')
|
||||
{
|
||||
message_forum($lng['no_topic'], 'index.php');
|
||||
}
|
||||
$topic['name']=$result['topic_name'];
|
||||
$topic['lock']=$result['topic_lock'];
|
||||
$topic['sticky']=$result['sticky'];
|
||||
$topic['f_id']=$result['f_id'];
|
||||
$fid = $topic['f_id'];
|
||||
$forum['name']=$result['name'];
|
||||
$forum['lock']=$result['lock'];
|
||||
$forum['moderate']=$result['moderate'];
|
||||
|
||||
|
||||
$sql = "SELECT `u_id`,`value` FROM `".WARNINGS_TABLE."`";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user warns information');
|
||||
$result = mysql_num_rows($query);
|
||||
while ($result = @mysql_fetch_array($query))
|
||||
{
|
||||
if(!isset($user_warnlevel[$result['u_id']]))
|
||||
{
|
||||
$user_warnlevel[$result['u_id']]=0;
|
||||
}
|
||||
if ($result['value']=='-')
|
||||
{
|
||||
$user_warnlevel[$result['u_id']] -=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$user_warnlevel[$result['u_id']] +=1;
|
||||
}
|
||||
}
|
||||
|
||||
//check online for user
|
||||
$sql = "SELECT `s_id`, `u_id`, `time` FROM ".SESSIONS_TABLE." WHERE time+1250>".time();
|
||||
$query = DataBase::sql_query($sql, 'GENERAL', 'Could not read user active.');
|
||||
while($result = @mysql_fetch_array($query))
|
||||
{
|
||||
$user[$result['u_id']]['online']='1';
|
||||
}
|
||||
unset($sql, $query, $result);
|
||||
//
|
||||
//generate output pages
|
||||
//
|
||||
if ($_SESSION['uid']>0)
|
||||
{
|
||||
$limiter = $userdata['limit_tpid'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$limiter = $forum_config['limit_tpid'];
|
||||
}
|
||||
if (isset($_GET['page'])&&($_GET['page']!=1))
|
||||
{
|
||||
if (!is_numeric($_GET['page']))
|
||||
{
|
||||
die('Hacking attempt');
|
||||
}
|
||||
$value = ($_GET['page']-1)*$limiter;
|
||||
$limit = 'LIMIT '.$value . ', '.$limiter;
|
||||
$page = $_GET['page'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$limit = 'LIMIT 0, '.$limiter;
|
||||
$page=1;
|
||||
}
|
||||
$count = @mysql_fetch_array(DataBase::sql_query("SELECT COUNT(`p_id`) as `p_id`
|
||||
FROM ".POSTS_TABLE." WHERE `t_id`='$tid'",'GENERAL','Could not obtain count amout of posts'));
|
||||
$count = $count['p_id'];
|
||||
$count = ceil($count / $limiter);
|
||||
if(isset($_GET['page']) && ($_GET['page']>$count))
|
||||
{
|
||||
message_forum($lng['invalidpage'],'index.php');
|
||||
}
|
||||
//
|
||||
//end generating pages
|
||||
//
|
||||
?>
|
||||
15
includes/cache/index.html
vendored
Normal file
15
includes/cache/index.html
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<title>Untitled</title>
|
||||
<meta http-equiv="refresh" content="0; url=../../index.php" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>
|
||||
|
||||
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
65
includes/class_db.php
Normal file
65
includes/class_db.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Dynamic Script Forum
|
||||
* @file includes/class_db.php
|
||||
* @version 1.0.x, 23-08-2008, 17:48
|
||||
* @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 DataBase
|
||||
{
|
||||
function db_connect()
|
||||
{
|
||||
$connect = mysql_pconnect(DB_HOST, DB_USER, DB_PASS) or message_die('CRITICAL',' Could not connect to database server.',mysql_error());
|
||||
mysql_query("SET NAMES 'utf8'",$connect);
|
||||
mysql_select_db(DB_NAME, $connect) or message_die('CRITICAL',' Could not connect to database.',mysql_error());
|
||||
}
|
||||
function sql_query($sql, $type, $msg, $no_count = false)
|
||||
{
|
||||
if (isset($_COOKIE['queries']))
|
||||
{
|
||||
$no_count = false;
|
||||
if(!$no_count)
|
||||
{
|
||||
$_COOKIE['queries'] = $_COOKIE['queries']+1;
|
||||
}
|
||||
}
|
||||
//echo '<span class="fsmall">'.$sql.'<br></span>'; //for optymalization ONLY!!!!!!!!!!!!!!
|
||||
$query = mysql_query($sql) or message_die($type, $msg, mysql_error());
|
||||
return $query;
|
||||
}
|
||||
function new_id($table)
|
||||
{
|
||||
//check table id
|
||||
switch($table)
|
||||
{
|
||||
case BANLIST_TABLE: { $id = 'b_id'; break; }
|
||||
case CATS_TABLE: { $id = 'c_id'; break; }
|
||||
case CENSORLIST_TABLE: { $id = 'w_id'; break; }
|
||||
case FORUMS_TABLE: { $id = 'f_id'; break; }
|
||||
case GROUPS_TABLE: { $id = 'g_id'; break; }
|
||||
case PM_INBOX_TABLE: { $id = 'm_id'; break; }
|
||||
case PM_SENTBOX_TABLE: { $id = 'm_id'; break; }
|
||||
case POSTS_TABLE: { $id = 'p_id'; break; }
|
||||
case TOPICS_TABLE: { $id = 't_id'; break; }
|
||||
case SESSIONS_TABLE: { $id = 's_id'; break; }
|
||||
case SKINS_TABLE: { $id = 's_id'; break; }
|
||||
case SMILES_TABLE: { $id = 's_id'; break; }
|
||||
case USERS_TABLE: { $id = 'u_id'; break; }
|
||||
case USERS_GROUP_TABLE: { $id = 'id'; break; }
|
||||
case WARNINGS_TABLE: { $id = 'w_id'; break; }
|
||||
}
|
||||
$sql = "SELECT `$id` FROM $table ORDER BY `$id` DESC LIMIT 1";
|
||||
$return_id = mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Error with obtain last id.<br> File: class_db.php, Line: '.__LINE__));
|
||||
$return_id = $return_id[$id];
|
||||
$return_id = $return_id+1;
|
||||
return $return_id;
|
||||
unset($table, $return_id, $id, $sql);
|
||||
}
|
||||
}
|
||||
?>
|
||||
80
includes/class_email.php
Normal file
80
includes/class_email.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Dynamic Script Forum
|
||||
* @file includes/class_email.php
|
||||
* @version 1.0.x, 02-07-2007, 16:56
|
||||
* @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 Email
|
||||
{
|
||||
function SendEmail($email, $title, $content)
|
||||
{
|
||||
global $forum_config;
|
||||
$email_headers = "MIME-Version: 1.0\r\n";
|
||||
$email_headers .= "Content-type: text/html; charset=iso-8859-2\r\n";
|
||||
$email_headers .= "From: ".$forum_config['forumname']." \n";
|
||||
$email_date = date('d-m-Y, G:i',time());
|
||||
$email_content = '
|
||||
<html>
|
||||
<head>
|
||||
<title>'.$title.'</title>
|
||||
</head>
|
||||
<body>
|
||||
'.$content.'<br>
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
|
||||
<font face="Verdana" style="font-size:10pt">
|
||||
Message generated automatic by DSF v'.VERSION.'. <b>('.$email_date.')</b></font>
|
||||
</body>
|
||||
</html>';
|
||||
if ( !mail($email, $title, $email_content, $email_headers ))
|
||||
{
|
||||
message_die('GENERAL','Could not send email from: '.$email.'. sorry :(','');
|
||||
}
|
||||
}
|
||||
function SendRegisterEmail()
|
||||
{
|
||||
global $forum_config;
|
||||
global $original_pass;
|
||||
global $lng;
|
||||
$email_content = $lng['email_newpasswd_msg'];
|
||||
$email_content = str_replace('%forum%',$forum_config['forumname'],$email_content);
|
||||
$email_content = str_replace('%url_f%',$forum_config['forumpatch'],$email_content);
|
||||
$email_content = str_replace('%ip%',$_SERVER['REMOTE_ADDR'],$email_content);
|
||||
$email_content = str_replace('%forum%',$forum_config['forumname'],$email_content);
|
||||
$email_content = str_replace('%login%',$_POST['nick'],$email_content);
|
||||
$email_content = str_replace('%pass%',$original_pass,$email_content);
|
||||
Email::SendEmail($_POST['email'],$lng['email_welcome'].$forum_config['forumname'],$email_content);
|
||||
|
||||
}
|
||||
function SendForgotPassEmail($newpass)
|
||||
{
|
||||
global $forum_config;
|
||||
global $original_pass;
|
||||
global $lng;
|
||||
global $uid;
|
||||
$email_content = $lng['email_register_msg'];
|
||||
$email_content = str_replace('%forum%',$forum_config['forumname'],$email_content);
|
||||
$email_content = str_replace('%url_f%',$forum_config['forumpatch'],$email_content);
|
||||
$email_content = str_replace('%ip%',$_SERVER['REMOTE_ADDR'],$email_content);
|
||||
$email_content = str_replace('%forum%',$forum_config['forumname'],$email_content);
|
||||
$email_content = str_replace('%login%',$_POST['username'],$email_content);
|
||||
$email_content = str_replace('%pass%',$newpass,$email_content);
|
||||
Email::SendEmail(User::UserInformation($uid,'email'),$lng['email_sent_forget_pass'].$forum_config['forumname'],$email_content);
|
||||
}
|
||||
function SendMassEmail($title,$content)
|
||||
{
|
||||
$sql = "SELECT `email`,`u_id` FROM ".USERS_TABLE." WHERE `u_id`>0";
|
||||
$query = DataBase::sql_query($sql,'CRITICAL','Could not read users table');
|
||||
while($item = @mysql_fetch_array($query))
|
||||
{
|
||||
Email::SendEmail($item['email'], $title, $content);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
72
includes/class_error.php
Normal file
72
includes/class_error.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Dynamic Script Forum
|
||||
* @file includes/class_error.php
|
||||
* @version 1.0.x, 05-07-2008, 13:50
|
||||
* @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');
|
||||
}
|
||||
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')
|
||||
);
|
||||
}
|
||||
?>
|
||||
136
includes/class_forum.php
Normal file
136
includes/class_forum.php
Normal file
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Dynamic Script Forum
|
||||
* @file includes/class_forum.php
|
||||
* @version 1.0.x, 29-01-2007, 12:02
|
||||
* @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 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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
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');
|
||||
}
|
||||
}
|
||||
?>
|
||||
328
includes/class_overall.php
Normal file
328
includes/class_overall.php
Normal file
@@ -0,0 +1,328 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Dynamic Script Forum
|
||||
* @file includes/class_overall.php
|
||||
* @version 1.0.x, 27-01-2007, 11:33
|
||||
* @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 Over
|
||||
{
|
||||
function set_counter()
|
||||
{
|
||||
global $forum_config;
|
||||
if (!isset($_COOKIE['forum_visited']))
|
||||
{
|
||||
setcookie('forum_visited','1');
|
||||
$visit_count = $forum_config['forum_counter'] +1;
|
||||
DataBase::sql_query("UPDATE `".CONFIG_TABLE."` SET `value`='$visit_count' WHERE `name`='forum_counter'",'GENERAL','Could not update forum counter');
|
||||
}
|
||||
else
|
||||
{
|
||||
$visit_count = $forum_config['forum_counter'];
|
||||
}
|
||||
return $visit_count;
|
||||
}
|
||||
function generate_header($title, $navigator)
|
||||
{
|
||||
global $lng;
|
||||
global $forum_config;
|
||||
$skin = array(
|
||||
'forumname' => $forum_config['forumname'],
|
||||
'forumdesc' => $forum_config['forumdesc'],
|
||||
'users' => $lng['lusers'],
|
||||
'pm' => $lng['lpm'],
|
||||
'register' => $lng['lregister'],
|
||||
'search' => $lng['lsearch'],
|
||||
'eprofile' => $lng['leprofile'],
|
||||
'groups' => $lng['lgroups'],
|
||||
'keywords' => $forum_config['meta_keywords'],
|
||||
'description' => $forum_config['meta_description'],
|
||||
'mainpage' => $title,
|
||||
'lmainpage' => $navigator,
|
||||
'lactual_time'=>$lng['lactualtime'],
|
||||
'modelogin' => ($_SESSION['uid']>0) ? 'logout' : 'login',
|
||||
'llogin' => ($_SESSION['uid']>0) ? $lng['lunlogin'] : $lng['llogin']
|
||||
);
|
||||
return $skin;
|
||||
}
|
||||
function user_agent($agent)
|
||||
{
|
||||
global $lng;
|
||||
/*This original function is in phpBB 1.12.5 modified by Przemo*/
|
||||
/*Modified by PioDer: added new browsers and systems and other replaces*/
|
||||
$agent_tst = ' ' . strtolower($agent);
|
||||
$system = $browser = '';
|
||||
if (
|
||||
strpos($agent_tst, 'windows') ||
|
||||
strpos($agent_tst, 'win9') ||
|
||||
strpos($agent_tst, 'win32') ||
|
||||
strpos($agent_tst, 'nt 5.') ||
|
||||
strpos($agent_tst, 'nt 4') )
|
||||
{
|
||||
$system = ( strpos($agent_tst, 'windows 9') || strpos($agent_tst, 'nt 4') || strpos($agent_tst, 'windows') || strpos($agent_tst, 'win32') ) ? 'windows_98_nt_2000' : $system;
|
||||
$system = ( strpos($agent_tst, 'nt 5.') || strpos($agent_tst, 'nt 6.') || strpos($agent_tst, 'nt 7.') || strpos($agent_tst, 'nt 8.') ) ? 'windows_xp_2003' : $system;
|
||||
$system = (strpos($agent_tst, 'nt 5.0')) ? 'windows_98_nt_2000' : $system;
|
||||
$system = (strpos($agent_tst, 'nt 6.0')) ? 'windows_vista' : $system;
|
||||
}
|
||||
else
|
||||
{
|
||||
$system = (strpos($agent_tst, 'linux')) ? 'linux' : $system;
|
||||
$system = (strpos($agent_tst, 'suse')) ? 'linux_suse' : $system;
|
||||
$system = (strpos($agent_tst, 'knoppix')) ? 'linux_knoppix' : $system;
|
||||
$system = (strpos($agent_tst, 'turbolinux')) ? 'linux_turbolinux' : $system;
|
||||
$system = (strpos($agent_tst, 'slackware')) ? 'linux_slackware' : $system;
|
||||
$system = (strpos($agent_tst, 'gentoo')) ? 'linux_gentoo' : $system;
|
||||
$system = (strpos($agent_tst, 'lycoris')) ? 'linux_lycoris' : $system;
|
||||
$system = (strpos($agent_tst, 'debian')) ? 'linux_debian' : $system;
|
||||
$system = (strpos($agent_tst, 'redhat')) ? 'linux_redhat' : $system;
|
||||
$system = (strpos($agent_tst, 'archlinux')) ? 'linux_arch' : $system;
|
||||
$system = (strpos($agent_tst, 'ubuntu')) ? 'linux_ubuntu' : $system;
|
||||
$system = (strpos($agent_tst, 'cdlinux')) ? 'linux_cdlinux' : $system;
|
||||
$system = (strpos($agent_tst, 'mandriva')) ? 'linux_mandriva' : $system;
|
||||
$system = (strpos($agent_tst, 'kateos')) ? 'linux_kateos' : $system;
|
||||
$system = (strpos($agent_tst, 'bsd')) ? 'linux_freebsd' : $system;
|
||||
}
|
||||
if ( $system == '')
|
||||
{
|
||||
$system = (strpos($agent_tst, 'mac')) ? 'macos' : $system;
|
||||
$system = (strpos($agent_tst, 'aix')) ? 'aix' : $system;
|
||||
$system = (strpos($agent_tst, 'lindows')) ? 'lindows' : $system;
|
||||
$system = (strpos($agent_tst, 'amiga')) ? 'amiga' : $system;
|
||||
$system = (strpos($agent_tst, 'athe')) ? 'athe' : $system;
|
||||
$system = (strpos($agent_tst, 'beos')) ? 'beos' : $system;
|
||||
$system = (strpos($agent_tst, 'zeta')) ? 'beos' : $system;
|
||||
$system = (strpos($agent_tst, 'BlueEyed')) ? 'beos' : $system;
|
||||
$system = (strpos($agent_tst, 'nextstep')) ? 'nextstep' : $system;
|
||||
$system = (strpos($agent_tst, 'warp')) ? 'warp' : $system;
|
||||
$system = (strpos($agent_tst, 'qnx')) ? 'qnx' : $system;
|
||||
$system = (strpos($agent_tst, 'risc')) ? 'risc' : $system;
|
||||
$system = (strpos($agent_tst, 'solaris')) ? 'solaris' : $system;
|
||||
$system = (strpos($agent_tst, 'unix')) ? 'unix' : $system;
|
||||
$system = (strpos($agent_tst, 'macos')) ? 'macos' : $system;
|
||||
$system = (strpos($agent_tst, 'mac os')) ? 'macos' : $system;
|
||||
$system = (strpos($agent_tst, 'symbian')) ? 'symbian' : $system;
|
||||
$system = ($system == '' && strpos($agent_tst, 'win9') || strpos($agent_tst, 'win3') || strpos($agent_tst, 'windows') ) ? 'windows_98_nt_2000' : $system;
|
||||
}
|
||||
$browser = (strpos($agent_tst, 'mozilla')) ? 'mozilla' : $browser;
|
||||
$browser = (strpos($agent_tst, 'msie')) ? 'ie' : $browser;
|
||||
$browser = (strpos($agent_tst, 'msie 7')) ? 'ie7' : $browser;
|
||||
$browser = (strpos($agent_tst, 'netscape')) ? 'netscape' : $browser;
|
||||
$browser = (strpos($agent_tst, 'opera')) ? 'opera' : $browser;
|
||||
$browser = (strpos($agent_tst, 'konqueror')) ? 'konqueror' : $browser;
|
||||
$browser = (strpos($agent_tst, 'galeon')) ? 'galeon' : $browser;
|
||||
$browser = (strpos($agent_tst, 'firefox')) ? 'firefox' : $browser;
|
||||
$browser = (strpos($agent_tst, 'netsprint')) ? 'netsprint' : $browser;
|
||||
$browser = (strpos($agent_tst, 'firebird')) ? 'firebird' : $browser;
|
||||
$browser = (strpos($agent_tst, 'links')) ? 'links' : $browser;
|
||||
$browser = (strpos($agent_tst, 'dillo')) ? 'dillo' : $browser;
|
||||
$browser = (strpos($agent_tst, 'omniweb')) ? 'omniweb' : $browser;
|
||||
$browser = (strpos($agent_tst, 'avant')) ? 'avant' : $browser;
|
||||
$browser = (strpos($agent_tst, 'myie2')) ? 'myie2' : $browser;
|
||||
$browser = (strpos($agent_tst, 'seamonkey')) ? 'seamonkey' : $browser;
|
||||
$browser = (strpos($agent_tst, 'maxthon')) ? 'maxthon' : $browser;
|
||||
|
||||
$browser = ($browser == '') ? 'unknown' : $browser;
|
||||
$system = ($system == '') ? 'unknown' : $system;
|
||||
|
||||
return array('icon_' . $system . '.gif', 'icon_' . $browser . '.gif', ($system=='unknown') ? $lng['unknown'] : $system, ($browser=='unknown') ? $lng['unknown'] : $browser);
|
||||
}
|
||||
function GenerateTime($request_time)
|
||||
{
|
||||
global $lng;
|
||||
if (date('d-m-Y',$request_time)== date('d-m-Y',time()))
|
||||
{
|
||||
$date = $lng['today'].', '.date('G:i', $request_time);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((date('d',$request_time))== (date('d',time())-1) && (date('m-Y',$request_time)== date('m-Y',time())))
|
||||
{
|
||||
$date = $lng['yesterday'].', '.date('G:i', $request_time);
|
||||
}
|
||||
else
|
||||
{
|
||||
$date = date('d-m-Y, G:i',$request_time);
|
||||
}
|
||||
}
|
||||
return $date;
|
||||
}
|
||||
function AddPages()
|
||||
{
|
||||
global $count;
|
||||
global $page;
|
||||
$content = '';
|
||||
for ($i=1;$i<=$count;$i++)
|
||||
{
|
||||
if ($i==$page)
|
||||
{
|
||||
$content .= '<option value="'.$i.'" selected="selected">'.$i.'</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$content .= '<option value="'.$i.'">'.$i.'</option>';
|
||||
}
|
||||
}
|
||||
return $content;
|
||||
unset($content);
|
||||
}
|
||||
function AddPages2($page)//for edit profile, not used in limit!
|
||||
{
|
||||
$content = '';
|
||||
for ($i=1;$i<=50;$i++)
|
||||
{
|
||||
if ($i==$page)
|
||||
{
|
||||
$content .= '<option value="'.$i.'" selected="selected">'.$i.'</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$content .= '<option value="'.$i.'">'.$i.'</option>';
|
||||
}
|
||||
}
|
||||
return $content;
|
||||
unset($content);
|
||||
}
|
||||
function AddSkins()
|
||||
{
|
||||
global $forum_config;
|
||||
global $default_skin;
|
||||
$all='';
|
||||
$query = DataBase::sql_query("SELECT `name`, `s_id` FROM `".SKINS_TABLE."`",'GENERAL','Could not obtain skins information');
|
||||
while($t = @mysql_fetch_array($query))
|
||||
{
|
||||
|
||||
if ($t['name']==$default_skin)
|
||||
{
|
||||
$all .= '<option value="'.$t['s_id'].'" selected="selected">'.$t['name'].'</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$all .= '<option value="'.$t['s_id'].'">'.$t['name'].'</option>';
|
||||
}
|
||||
}
|
||||
return $all;
|
||||
unset($t, $all);
|
||||
}
|
||||
function AddLangs()
|
||||
{
|
||||
global $forum_config;
|
||||
global $default_lang;
|
||||
$result='';
|
||||
$rep=opendir('./lngs');
|
||||
$browseruMoinsUnRepertoire = false;
|
||||
while ($file = readdir($rep))
|
||||
{
|
||||
if($file != '..' && $file !='.' && $file !='')
|
||||
{
|
||||
if (is_dir('./lngs/'.$file)){
|
||||
$browseruMoinsUnRepertoire = true;
|
||||
if ($file==$default_lang)
|
||||
{
|
||||
$result .='<option value="'.$file.'" selected="selected">'.$file.'</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$result .='<option value="'.$file.'">'.$file.'</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
unset($rep, $browseruMoinsUnRepertoire, $file, $result);
|
||||
}
|
||||
function TimeGeneration()
|
||||
{
|
||||
list($usec, $sec ) = explode(" ",microtime());
|
||||
return ((float)$usec + (float)$sec);
|
||||
}
|
||||
function IfModGroup($guid)
|
||||
{
|
||||
global $lng;
|
||||
$uid = $_SESSION['uid'];
|
||||
if ($guid==$uid)
|
||||
{
|
||||
return'
|
||||
<tr>
|
||||
<td class="fitem">
|
||||
<span class="fstandard">'.$lng['addusrtogrp'].':</span><input type="text" name="nick" style="widtfh:100px; height:15px" value="'.$_POST['nick'].'">
|
||||
</td>
|
||||
<td class="fitem">
|
||||
<span class="fstandard">'.$lng['delusrforgrp'].':</span><input type="text" name="delnick" style="widtfh:100px; height:15px" value="'.$_POST['nick'].'">
|
||||
</td>
|
||||
<td class="fitem">
|
||||
<input type="submit" class="fbutton" value="'.$lng['lgo'].'">
|
||||
</tr>
|
||||
';
|
||||
}
|
||||
}
|
||||
function TotalPosts()
|
||||
{
|
||||
$sql = "SELECT count(*) as `p_id` FROM ".POSTS_TABLE."";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain total posts information');
|
||||
$result = mysql_fetch_array($query);
|
||||
$result = $result['p_id'];
|
||||
return($result);
|
||||
}
|
||||
function DefaultLang()
|
||||
{
|
||||
global $forum_config;
|
||||
global $userdata;
|
||||
if ($_SESSION['uid']>0)
|
||||
{
|
||||
//$sql = "SELECT `u_id`, `lang` FROM ".USERS_TABLE." WHERE `u_id`='".$_SESSION['uid']."' LIMIT 1";
|
||||
//$result = @mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain user information'));
|
||||
return $userdata['lang'];
|
||||
}
|
||||
else
|
||||
{
|
||||
return $forum_config['defaultlang'];
|
||||
}
|
||||
}
|
||||
function ShowQueries($start, $stop)
|
||||
{
|
||||
global $forum_config;
|
||||
global $lng;
|
||||
if ($forum_config['show_time_generation'])
|
||||
{
|
||||
$result = $stop - $start;
|
||||
$result = round($result,3);
|
||||
if (extension_loaded('xdebug'))
|
||||
{
|
||||
return $lng['script_generated'].$result.' '.$lng['seconds'].'. SQL: '.$_COOKIE['queries'].'.<br>
|
||||
Wersja Xdebug: '.phpversion('xdebug').', Użycie pamięci: '.round((xdebug_memory_usage()/1024),2).'KB.';
|
||||
}
|
||||
else
|
||||
{
|
||||
return $lng['script_generated'].$result.' '.$lng['seconds'].'. SQL: '.$_COOKIE['queries'].'.';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
function ViewSkinName()
|
||||
{
|
||||
|
||||
global $forum_config;
|
||||
global $userdata;
|
||||
if ($_SESSION['uid']>0)
|
||||
{
|
||||
$result = $userdata['skin'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $forum_config['defaultskin'];
|
||||
}
|
||||
$sql = "SELECT * FROM `".SKINS_TABLE."` WHERE `s_id`='$result'";
|
||||
$result = mysql_fetch_array(DataBase::sql_query($sql,'CRITICAL','Could not obtain skin information.'));
|
||||
return $result['name'];
|
||||
}
|
||||
}
|
||||
?>
|
||||
116
includes/class_posting.php
Normal file
116
includes/class_posting.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Dynamic Script Forum
|
||||
* @file includes/class_posting.php
|
||||
* @version 1.0.x, 30-07-2007, 16: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 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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
51
includes/class_shoutbox.php
Normal file
51
includes/class_shoutbox.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Dynamic Script Forum
|
||||
* @file includes/class_shoutbox.php
|
||||
* @version 1.0.x, 27-08-2007, 17:02
|
||||
* @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 ShoutBox
|
||||
{
|
||||
function new_message($message,$uid)
|
||||
{
|
||||
$time = time();
|
||||
$sql = "INSERT INTO ".SHOUTBOX_TABLE." VALUES ('', '$uid', '$message','$time')";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not add shoutbox message.');
|
||||
}
|
||||
function read_messages($limit)
|
||||
{
|
||||
$sb_content = '';
|
||||
$rank_mod = ($_SESSION['uid']>0) ? User::UserInformation($_SESSION['uid'],'rank') : 0;
|
||||
global $user;
|
||||
global $default_skin;
|
||||
$sql = "SELECT * FROM ".SHOUTBOX_TABLE." ORDER BY `time` LIMIT $limit";
|
||||
$query = DataBase::sql_query($sql,'CRITICAL', 'Could not read shoutbox table');
|
||||
while($sb_msg = @mysql_fetch_array($query))
|
||||
{
|
||||
$del_edit_msg = ($rank_mod>0) ? '<a href="shoutbox.php?mode=
|
||||
delete&id='.$sb_msg.'" class="fsmall">x</a> <a href="
|
||||
shoutbox.php?mode=edit&id='.$sb_msg.'" class="fsmall">e</a>' : ' ';
|
||||
$sb_content .= '<tr><td>'.$del_edit_msg.'<span class="fsmall">
|
||||
<a href="user.php?id='.$b_msg['u_id'].'" class="fsmall">'
|
||||
.Topic::UserName($user[$sb_msg['u_id']]['nick'],$user[$sb_msg['u_id']]['rank']).
|
||||
'</a> <span class="fsmall">['.date('d-m, G:i',$sb_msg['time']).']:
|
||||
'.$sb_msg['msg_content'].'</span></td></tr>';
|
||||
}
|
||||
return $sb_content;
|
||||
|
||||
}
|
||||
function del_old_msgs($limiter)
|
||||
{
|
||||
$sql = "DELETE FROM ".SHOUTBOX_TABLE." WHERE `time`+$limiter<'".time()."'";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not delete old messages in shoutbox');
|
||||
unset($sql);
|
||||
}
|
||||
}
|
||||
?>
|
||||
197
includes/class_topic.php
Normal file
197
includes/class_topic.php
Normal file
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Dynamic Script Forum
|
||||
* @file includes/class_topic.php
|
||||
* @version 1.0.x, 10-02-2007, 16:44
|
||||
* @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 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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
208
includes/class_user.php
Normal file
208
includes/class_user.php
Normal file
@@ -0,0 +1,208 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Dynamic Script Forum
|
||||
* @file includes/class_user.php
|
||||
* @version 1.0.x, 07-02-2007, 17:59
|
||||
* @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 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.');
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
79
includes/classes/class_pms.php
Normal file
79
includes/classes/class_pms.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Dynamic Script Forum
|
||||
* @file includes/classes/class_pms.php
|
||||
* @version 1.0.x, 22-02-2007, 20:57
|
||||
* @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 Pms
|
||||
{
|
||||
function UserName($uid)
|
||||
{
|
||||
global $user;
|
||||
global $forum_config;
|
||||
$nick = $user[$uid]['nick'];
|
||||
$rank = $user[$uid]['rank'];
|
||||
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 SendMessage($text, $name, $nick)
|
||||
{
|
||||
//general variables
|
||||
$u_n_id = $_SESSION['uid'];
|
||||
$uid = User::UserIdByNick($nick);
|
||||
//For work!
|
||||
NewMessage::AddToInbox($text, $name, $u_n_id, $uid);
|
||||
NewMessage::AddToSentbox($text, $name, $u_n_id, $uid);
|
||||
}
|
||||
function DeleteMsgUser($mid)
|
||||
{
|
||||
$sql = "DELETE FROM `".PM_INBOX_TABLE."` WHERE `m_id`='$mid'";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not delete message in inbox');
|
||||
}
|
||||
function DeleteMsgAuthor($mid)
|
||||
{
|
||||
$sql = "DELETE FROM `".PM_SENTBOX_TABLE."` WHERE `m_id`='$mid'";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not delete message in sentbox');
|
||||
}
|
||||
}
|
||||
|
||||
class NewMessage
|
||||
{
|
||||
function AddToInbox($text, $name, $unid, $uid)
|
||||
{
|
||||
$last = DataBase::new_id(PM_INBOX_TABLE);
|
||||
$time = time();
|
||||
$sql = "INSERT INTO `".PM_INBOX_TABLE."` VALUES ('$last', '$uid', '$name', '$text', '$time', '$unid','0')";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not add new message at inbox');
|
||||
}
|
||||
function AddToSentbox($text, $name, $unid, $uid)
|
||||
{
|
||||
$last=DataBase::new_id(PM_SENTBOX_TABLE);
|
||||
$time = time();
|
||||
$sql = "INSERT INTO `".PM_SENTBOX_TABLE."` VALUES ('$last', '$uid', '$name', '$text', '$time', '$unid')";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not add new message at inbox');
|
||||
}
|
||||
}
|
||||
?>
|
||||
193
includes/classes/secure.php
Normal file
193
includes/classes/secure.php
Normal file
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Dynamic Script Forum
|
||||
* @file includes/classes/secure.php
|
||||
* @version 1.0.x, 07-04-2008, 20:43
|
||||
* @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 Secure
|
||||
{
|
||||
function forum_exists($fid)
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT * 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['f_id'];
|
||||
if ($result=='')
|
||||
{
|
||||
message_forum($lng['no_forum'],'index.php');
|
||||
}
|
||||
}
|
||||
function UseCensorList($text)
|
||||
{
|
||||
global $forum_config;
|
||||
if ($forum_config['use_censorlist'])
|
||||
{
|
||||
$sql = "SELECT * FROM ".CENSORLIST_TABLE.";";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain censorlist information.');
|
||||
while($word = mysql_fetch_array($query))
|
||||
{
|
||||
$text = str_replace($word['word'],'[censored]', $text);
|
||||
}
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
function generate_code()
|
||||
{
|
||||
$number = array(
|
||||
1 => 1,
|
||||
2 => 2,
|
||||
3 => 4,
|
||||
4 => 6,
|
||||
5 => 10,
|
||||
6 => 20,
|
||||
7 => 30,
|
||||
8 => 40,
|
||||
9 => 50,
|
||||
10 => 60,
|
||||
11 => 70,
|
||||
12 => 80,
|
||||
13 => 90,
|
||||
14 => 100
|
||||
);
|
||||
$first_id = rand(1,14);
|
||||
$second_id = rand(1,14);
|
||||
$first_num = $number[$first_id];
|
||||
$second_num = $number[$second_id];
|
||||
return array($first_num, $second_num, ($first_num + $second_num));
|
||||
}
|
||||
|
||||
function message_u_exists($mid)
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT * FROM ".PM_INBOX_TABLE." WHERE m_id='$mid'";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information.');
|
||||
$result = mysql_fetch_array($query);
|
||||
$result = $result['m_id'];
|
||||
if ($result=='')
|
||||
{
|
||||
message_forum($lng['no_message'],'pms.php');
|
||||
}
|
||||
}
|
||||
function message_author_loged($mid)
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT * FROM ".PM_SENTBOX_TABLE." WHERE m_id='$mid'";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information.');
|
||||
$result = mysql_fetch_array($query);
|
||||
$result = $result['u_n_id'];
|
||||
if ($result!=$_SESSION['uid'])
|
||||
{
|
||||
message_forum($lng['merror_1'],'index.php');
|
||||
}
|
||||
}
|
||||
function message_user_loged($mid)
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT * FROM ".PM_INBOX_TABLE." WHERE m_id='$mid'";
|
||||
$result = mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain user information.'));
|
||||
$result = $result['u_id'];
|
||||
if ($result!=$_SESSION['uid'])
|
||||
{
|
||||
message_forum($lng['merror_2'],'index.php');
|
||||
}
|
||||
}
|
||||
function message_a_exists($mid)
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT * FROM ".PM_SENTBOX_TABLE." WHERE m_id='$mid'";
|
||||
$result = mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain user information.'));
|
||||
$result = $result['m_id'];
|
||||
if ($result=='')
|
||||
{
|
||||
message_forum($lng['no_message'],'index.php');
|
||||
}
|
||||
}
|
||||
function topic_exists($tid)
|
||||
{
|
||||
global $lng;
|
||||
$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['t_id'];
|
||||
if ($result=='')
|
||||
{
|
||||
message_forum($lng['no_topic'],'index.php');
|
||||
}
|
||||
}
|
||||
function post_exists($pid)
|
||||
{
|
||||
global $lng;
|
||||
$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['p_id'];
|
||||
if ($result=='')
|
||||
{
|
||||
message_forum($lng['no_post'],'pms.php');
|
||||
}
|
||||
}
|
||||
function user_exists($uid)
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT * FROM ".USERS_TABLE." WHERE u_id='$uid'";
|
||||
$result = mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain user information.'));
|
||||
$result = $result['u_id'];
|
||||
if (($result=='') or ($result=='-1'))
|
||||
{
|
||||
message_forum($lng['no_user'],'index.php');
|
||||
}
|
||||
}
|
||||
function group_exists($gid)
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT `g_id` FROM `".GROUPS_TABLE."` WHERE g_id='$gid'";
|
||||
$result = mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain group information.'));
|
||||
$result = $result['g_id'];
|
||||
if ($result=='')
|
||||
{
|
||||
message_forum($lng['no_group'],'groups.php');
|
||||
}
|
||||
}
|
||||
function TagsReplace($text)
|
||||
{
|
||||
$text = strip_tags($text,ALLOWED_TAGS);
|
||||
$text = str_replace('?>', '?>', $text);
|
||||
$text = str_replace('<?', '<?', $text);
|
||||
$text = str_replace('javascript:', '', $text);
|
||||
$text = Secure::UseCensorlist($text);
|
||||
$text = Post::SmilesReplace($text);
|
||||
return $text;
|
||||
}
|
||||
function TopicLocked($tid)
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT `f_id`,`lock` FROM `".TOPICS_TABLE."` WHERE `t_id`='$tid'";
|
||||
$result = mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain topic information'));
|
||||
$fid = $result['f_id'];
|
||||
$sql2 = "SELECT `lock` FROM `".FORUMS_TABLE."` WHERE `f_id`='$fid'";
|
||||
$result2 = mysql_fetch_array(DataBase::sql_query($sql2,'GENERAL','Could not obtain forum information'));
|
||||
if (($result['lock']=='1') or ($result2['lock']=='1'))
|
||||
{
|
||||
message_forum($lng['no_posting_topic_locked'],'topic.php?t='.$tid);
|
||||
}
|
||||
}
|
||||
function ForumLocked($fid)
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT `lock` FROM `".FORUMS_TABLE."` WHERE `f_id`='$fid'";
|
||||
$result = mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain forum information'));
|
||||
if ($result['lock']=='1')
|
||||
{
|
||||
message_forum($lng['no_posting_forum_locked'],'forum.php?f='.$fid);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
68
includes/constants.php
Normal file
68
includes/constants.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Dynamic Script Forum
|
||||
* @file constans.php
|
||||
* @version 1.0.x, 16-04-2007, 14:35
|
||||
* @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');
|
||||
}
|
||||
|
||||
//sessions constants
|
||||
define('SESSION_LIFETIME',129600);
|
||||
define('SESS_NAME','uf_auth');
|
||||
//maximum filesize of avatar
|
||||
define('AV_CATALOG','images/avatars/');
|
||||
//posting allowed tags HTML
|
||||
|
||||
define('ALLOWED_TAGS','<strong><em><u><s><span><font><div><img><a><font><p><sub><sup><hr><br><li><ol><ul><h1><h2><h3><h4><h5><h6>');
|
||||
//tables
|
||||
define('BANLIST_TABLE',DB_PREFIX.'banlist');
|
||||
define('CATS_TABLE',DB_PREFIX.'categories');
|
||||
define('CENSORLIST_TABLE',DB_PREFIX.'censorlist');
|
||||
define('CONFIG_TABLE',DB_PREFIX.'config');
|
||||
define('FORUMS_TABLE',DB_PREFIX.'forums');
|
||||
define('GROUPS_TABLE',DB_PREFIX.'groups');
|
||||
define('PM_INBOX_TABLE',DB_PREFIX.'msg_inbox');
|
||||
define('PM_SENTBOX_TABLE',DB_PREFIX.'msg_sentbox');
|
||||
define('POSTS_TABLE',DB_PREFIX.'posts');
|
||||
define('SESSIONS_TABLE',DB_PREFIX.'sessions');
|
||||
define('SHOUTBOX_TABLE',DB_PREFIX.'shoutbox');
|
||||
define('SKINS_TABLE',DB_PREFIX.'skins');
|
||||
define('SMILES_TABLE',DB_PREFIX.'smiles');
|
||||
define('USERS_TABLE',DB_PREFIX.'users');
|
||||
define('USERS_GROUP_TABLE',DB_PREFIX.'users_group');
|
||||
define('TOPICS_TABLE',DB_PREFIX.'topics');
|
||||
define('WARNINGS_TABLE',DB_PREFIX.'warns');
|
||||
|
||||
//footer forum text
|
||||
define('FOOTER_TEXT','<span class="copyright" >Powered by <b>µForum</b></span><span class="copyright"> © 2007-2009 </span><a href="http://pioder.gim2przemysl.int.pl/dsf.html" class="copyright" target="_blank"><b>PioDer</b></a>');
|
||||
//hash for password
|
||||
define('PASSWD_HASH','bJVhVFCthvhVhKBU6GUbhUBU6VI7BiU6fV7G76Kbug6FU67VsaVYat5FJUHssaYVY5fV5GUHI76uKYTjYKKTatastYKYTYKg6ds7IRdsagI565JTrJ4NFGagGKLULygaTJHgfYDRZagGHJ65KL7iryikuuyriMYIYYUyugFTDeRnLKJNuyTDTRsERy78IJOhHCTDYjomLKBJDF5THNNBjyFCDYekjnKBUYgIHnUIbyuG6UyHNKJjnKHVut6FBYlH987g6GIUBbg76V5NNLUBH76BKLBi76FVtjN76Gi77ggYVCx3 R4SGhfGLHIH64XFGBUNLJOgfvc4Y3ScvmljmOBVc4klJKNIuBGVY6 MbvhGCRGgJLjKFHrYYJnKJGFHTfJJjnLK');
|
||||
|
||||
function array_push_associative(&$arr)
|
||||
{
|
||||
$ret = '';
|
||||
$args = func_get_args();
|
||||
foreach ($args as $arg)
|
||||
{
|
||||
if (is_array($arg))
|
||||
{
|
||||
foreach ($arg as $key => $value)
|
||||
{
|
||||
$arr[$key] = $value;
|
||||
$ret++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$arr[$arg] = "";
|
||||
}
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
?>
|
||||
15
includes/index.html
Normal file
15
includes/index.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<title>Untitled</title>
|
||||
<meta http-equiv="refresh" content="0; url=../index.php" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>
|
||||
|
||||
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
55
includes/pms/pms_delete.php
Normal file
55
includes/pms/pms_delete.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
if (isset($_GET['user']))
|
||||
{
|
||||
switch($_GET['user'])
|
||||
{
|
||||
case 'user':
|
||||
{
|
||||
if (isset($_GET['m']))
|
||||
{
|
||||
Secure::message_u_exists(intval($_GET['m']));
|
||||
Secure::message_user_loged(intval($_GET['m']));
|
||||
Pms::DeleteMsgUser(intval($_GET['m']));
|
||||
$stop = Over::TimeGeneration();
|
||||
message_forum($lng['pm_is_deleted'],'pms.php');
|
||||
}
|
||||
else
|
||||
{
|
||||
$stop = Over::TimeGeneration();
|
||||
message_forum($lng['invalidmode'],'pms.php');
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'author':
|
||||
{
|
||||
if (isset($_GET['m']))
|
||||
{
|
||||
Secure::message_a_exists(intval($_GET['m']));
|
||||
Secure::message_author_loged(intval($_GET['m']));
|
||||
Pms::DeleteMsgAuthor(intval($_GET['m']));
|
||||
$stop = Over::TimeGeneration();
|
||||
message_forum($lng['pm_is_deleted'],'pms.php?mode=folder&submode=sentbox');
|
||||
}
|
||||
else
|
||||
{
|
||||
$stop = Over::TimeGeneration();
|
||||
message_forum($lng['invalidmode'],'pms.php');
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
$stop = Over::TimeGeneration();
|
||||
message_forum($lng['invalidmode'],'pms.php');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$stop = Over::TimeGeneration();
|
||||
message_forum($lng['invalidmode'],'pms.php');
|
||||
}
|
||||
|
||||
?>
|
||||
94
includes/pms/pms_folder.php
Normal file
94
includes/pms/pms_folder.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
//
|
||||
//private messsages cache - v1.0 Alpha 2
|
||||
//
|
||||
$sql = "SELECT `u_id`,`nick`,`rank` FROM `".USERS_TABLE."`";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain forums information');
|
||||
$user['count']= mysql_num_rows($query);
|
||||
|
||||
while($result = mysql_fetch_array($query))
|
||||
{
|
||||
$user[$result['u_id']]['u_id']=$result['u_id'];
|
||||
$user[$result['u_id']]['nick']=$result['nick'];
|
||||
$user[$result['u_id']]['rank']=$result['rank'];
|
||||
}
|
||||
|
||||
$folder = ($_GET['submode']=='sentbox') ? '<a href="pms.php?mode=folder&submode=sentbox" class="navigator">'.$lng['sentbox'].'</a>' : '<a href="pms.php?mode=folder&submode=inbox" class="navigator">'.$lng['inbox'].'</a>';
|
||||
//add skin variables
|
||||
$skin = array(
|
||||
'lang'=>Over::DefaultLang(),
|
||||
'lname'=>$lng['message_name'],
|
||||
'lauthor'=>$lng['user'],
|
||||
'lmdate'=>$lng['date']
|
||||
);
|
||||
|
||||
$skin = array_push_associative($skin,Over::generate_header($lng['lpm'].': '.(($_GET['submode']=='sentbox') ? $lng['sentbox'] : $lng['inbox']), '</a> > <a href="pms.php" class="navigator">'.$lng['lpm'].'</a> > '.$folder));
|
||||
//do it!
|
||||
include('./skins/'.$default_skin.'/overall_header.tpl');
|
||||
include('./skins/'.$default_skin.'/msgs_is_body.tpl');
|
||||
|
||||
$uid = $_SESSION['uid'];
|
||||
if (!isset($_GET['submode']))
|
||||
{
|
||||
message_forum($lng['invalidmode'],'pms.php');
|
||||
}
|
||||
switch($_GET['submode'])
|
||||
{
|
||||
case 'sentbox':
|
||||
{
|
||||
$sql = "SELECT * FROM ".PM_SENTBOX_TABLE." WHERE `u_n_id`='$uid'";
|
||||
break;
|
||||
}
|
||||
case 'inbox':
|
||||
{
|
||||
$sql = "SELECT * FROM ".PM_INBOX_TABLE." WHERE `u_id`='$uid'";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
message_forum($lng['invalidmode'],'pms.php');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain messages information');
|
||||
$count = mysql_num_rows($query);
|
||||
|
||||
if ($count==0)
|
||||
{
|
||||
$skin['nomsgs']='<tr><td width="750" colspan="4" height="19" class="fitem"><p class="fstandard" align="center">'.$lng['no_elements'].'!</p></td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
while($item=mysql_fetch_array($query))
|
||||
{
|
||||
$skin=array(
|
||||
'mid'=>$item['m_id'],
|
||||
'name'=>$item['name'],
|
||||
'author'=>Pms::UserName($item['u_id']),
|
||||
'nuid'=>$item['u_n_id'],
|
||||
'date'=> date('d-m-Y, G:i',$item['time']),
|
||||
'mode'=> ($_GET['submode']=='inbox') ? 'user' : 'author'
|
||||
);
|
||||
|
||||
include('./skins/'.$default_skin.'/msgs_is_item_body.tpl');
|
||||
}
|
||||
$skin['nomsgs'] = '';
|
||||
}
|
||||
//do it!
|
||||
include('./skins/'.$default_skin.'/msgs_is_end_body.tpl');
|
||||
if(RANK=='2')
|
||||
{
|
||||
$skin['pa_link']='<a href="admin/index.php" class="fsmall"><b>'.$lng['pa_link'].'</b></a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$skin['pa_link']='';
|
||||
}
|
||||
|
||||
$stop = Over::TimeGeneration();
|
||||
$skin['queries'] = Over::ShowQueries($start, $stop);
|
||||
|
||||
include('./skins/'.$default_skin.'/overall_footer.tpl');
|
||||
?>
|
||||
121
includes/pms/pms_view.php
Normal file
121
includes/pms/pms_view.php
Normal file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
//smiles cache
|
||||
$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;
|
||||
}
|
||||
$mid = intval($_GET['id']);
|
||||
if (!isset($_GET['submode']))
|
||||
{
|
||||
message_forum($lng['invalidmode'],'pms.php');
|
||||
}
|
||||
switch($_GET['submode'])
|
||||
{
|
||||
case 'author':
|
||||
{
|
||||
$sql = "SELECT * FROM ".PM_SENTBOX_TABLE." WHERE m_id='$mid'";
|
||||
break;
|
||||
}
|
||||
case 'user':
|
||||
{
|
||||
$sql = "SELECT * FROM ".PM_INBOX_TABLE." WHERE m_id='$mid'";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
message_forum($lng['invalidmode'],'pms.php');
|
||||
break;
|
||||
}
|
||||
}
|
||||
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain messages information');
|
||||
$result = mysql_fetch_array($query);
|
||||
//if message exist....
|
||||
if ($result['m_id']=='')
|
||||
{
|
||||
message_forum($lng['no_message'],'pms.php');
|
||||
}
|
||||
switch($_GET['submode'])
|
||||
{
|
||||
case 'user':
|
||||
{
|
||||
//if message user loged....
|
||||
if ($result['u_id']!=$_SESSION['uid'])
|
||||
{
|
||||
message_forum($lng['merror_2'],'index.php');
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'author':
|
||||
{
|
||||
//if message author loged....
|
||||
if ($result['u_n_id']!=$_SESSION['uid'])
|
||||
{
|
||||
message_forum($lng['merror_2'],'index.php');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($_GET['submode']=='user')
|
||||
{
|
||||
DataBase::sql_query("UPDATE ".PM_INBOX_TABLE." SET `read`='1' WHERE `m_id`='$mid'", 'GENERAL', 'Could not update message.');
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM ".USERS_TABLE." WHERE `u_id`='".$result['u_n_id']."'";
|
||||
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information');
|
||||
$user = @mysql_fetch_array($query);
|
||||
|
||||
$folder = ($_GET['submode']=='author') ? '<a href="pms.php?mode=folder&submode=sentbox" class="navigator">'.$lng['sentbox'].'</a>' : '<a href="pms.php?mode=folder&submode=inbox" class="navigator">'.$lng['inbox'].'</a>';
|
||||
|
||||
//add skin variables
|
||||
$skin = array(
|
||||
'lang'=>Over::DefaultLang(),
|
||||
'lname'=>$lng['message'],
|
||||
'u_id'=>$result['u_n_id'],
|
||||
'username'=>Topic::UserName($user['nick'], $user['rank']),
|
||||
'userrank'=>User::UserRank($user['rank']),
|
||||
'delete'=>'<a href="javascript:confirm_action(\''.$lng['c_delete_pm'].'\',\'pms.php?mode=delete&user='.$_GET['submode'].'&m='.$mid.'\')"><img src="skins/'.$default_skin.'/images/delete_small.gif" alt="del"></a>',
|
||||
'avatar'=>($user['avatar']!='') ? '<img src="'.$user['avatar'].'" alt="av">' : '<br><br><br><br>',
|
||||
'msgtext'=>Topic::PostText($result['message'],0,0),
|
||||
'sig'=> ($user['sig']!='') ? '<br>------------------------<br>'.$user['sig'] : '',
|
||||
'posts'=>$user['posts'],
|
||||
'regdate'=>date('d-m-Y',$user['regdate']),
|
||||
'lastvisit'=>date('d-m-Y',$user['lastvisit']),
|
||||
|
||||
//labels
|
||||
'lrank'=>$lng['lurank2'],
|
||||
'llastvisit'=>$lng['lulastvisit'],
|
||||
'lregdate'=>$lng['regdate2'],
|
||||
'lposts'=>$lng['posts'],
|
||||
'lno'=>$lng['no.'],
|
||||
'lpinfo'=>$lng['postinfo']
|
||||
);
|
||||
|
||||
$skin = array_push_associative($skin,Over::generate_header($lng['show_message'].': '.$result['name'], '</a> > '.$folder.' >
|
||||
<a href="pms.php?mode=view&submode='.$_GET['submode'].'&id='.
|
||||
$result['m_id'].'" class="navigator">'.$lng['show_message']
|
||||
.': '.$result['name']));
|
||||
|
||||
//do it!
|
||||
include('./skins/'.$default_skin.'/overall_header.tpl');
|
||||
include('./skins/'.$default_skin.'/msgs_msg_body.tpl');
|
||||
if(RANK=='2')
|
||||
{
|
||||
$skin['pa_link']='<a href="admin/index.php" class="fsmall"><b>'.$lng['pa_link'].'</b></a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$skin['pa_link']='';
|
||||
}
|
||||
$stop = Over::TimeGeneration();
|
||||
$skin['queries'] = Over::ShowQueries($start, $stop);
|
||||
include('./skins/'.$default_skin.'/overall_footer.tpl');
|
||||
break;
|
||||
|
||||
?>
|
||||
83
includes/pms/pms_write.php
Normal file
83
includes/pms/pms_write.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
$msg ='';
|
||||
|
||||
if ((isset($_POST['textedit'])) and (isset($_POST['nmsg'])) and (isset($_POST['username'])))
|
||||
{
|
||||
if (($_POST['textedit'] != '') and ($_POST['nmsg']!='') and ($_POST['username']!='') and (strlen($_POST['textedit'])>10) and (strlen($_POST['nmsg'])>5))
|
||||
{
|
||||
$nick = strip_tags($_POST['username']);
|
||||
$sql = "SELECT * FROM `".USERS_TABLE."` WHERE `nick`='$nick'";
|
||||
$result = mysql_fetch_array(DataBase::sql_query($sql, 'CRITICAL','Could not obtain user information.'));
|
||||
if ($result['u_id']!='')
|
||||
{
|
||||
$_POST['textedit'] = Secure::TagsReplace($_POST['textedit']);
|
||||
$_POST['nmsg'] = strip_tags($_POST['nmsg']);
|
||||
Pms::SendMessage($_POST['textedit'],$_POST['nmsg'], $_POST['username']);
|
||||
message_forum($lng['post_is_saved'],'pms.php');
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = $lng['no_user'];
|
||||
$msg = './skins/'.$default_skin.'/post_error_body.tpl';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = $lng['perror_1'];
|
||||
$msg = './skins/'.$default_skin.'/post_error_body.tpl';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($_GET['id']))
|
||||
{
|
||||
Secure::user_exists(intval($_GET['id']));
|
||||
$_POST['username'] = User::UserInformation(intval($_GET['id']), 'nick');
|
||||
}
|
||||
else
|
||||
{
|
||||
$_POST['username'] = '';
|
||||
}
|
||||
$_POST['nmsg']='';
|
||||
$_POST['textedit']='';
|
||||
}
|
||||
//add skin variables
|
||||
$skin = array(
|
||||
'smiles'=>Post::SmilesShow(),
|
||||
//labels
|
||||
'luser'=>$lng['user'],
|
||||
'lsmiles'=>$lng['smiles'],
|
||||
'lmsgname'=>$lng['msgname'],
|
||||
'lmsg'=>$lng['message'],
|
||||
'lsave'=>$lng['save'],
|
||||
'lreset'=>$lng['reset'],
|
||||
'lwritemsg'=>$lng['write_pm'],
|
||||
'action'=>$_SERVER['REQUEST_URI']
|
||||
);
|
||||
|
||||
$skin = array_push_associative($skin, Over::generate_header($lng['lpm'].': '.$lng['write_pm'], '</a>><a href="pms.php" class="navigator">'.$lng['lpm'].'</a> > <a href="'.$_SERVER['REQUEST_URI'].'" class="navigator">'.$lng['write_pm']));
|
||||
|
||||
if ($msg=='')
|
||||
{
|
||||
$msg='./skins/'.$default_skin.'/blank.tpl';
|
||||
}
|
||||
|
||||
//do it!
|
||||
include('./skins/'.$default_skin.'/overall_header.tpl');
|
||||
include('./skins/'.$default_skin.'/msgs_new_body.tpl');
|
||||
|
||||
if(RANK=='2')
|
||||
{
|
||||
$skin['pa_link']='<a href="admin/index.php" class="fsmall"><b>'.$lng['pa_link'].'</b></a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$skin['pa_link']='';
|
||||
}
|
||||
|
||||
$stop = Over::TimeGeneration();
|
||||
$skin['queries'] = Over::ShowQueries($start, $stop);
|
||||
include('./skins/'.$default_skin.'/overall_footer.tpl');
|
||||
|
||||
?>
|
||||
128
includes/sessions.php
Normal file
128
includes/sessions.php
Normal file
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Dynamic Script Forum
|
||||
* @file includes/sessions.php
|
||||
* @version 1.0.x, 30-07-2007, 11:41
|
||||
* @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');
|
||||
}
|
||||
|
||||
//set global sessions options
|
||||
ini_set('session.cookie_lifetime',SESSION_LIFETIME);
|
||||
ini_set('session.name',SESS_NAME); //1,5 day
|
||||
if ((isset($_COOKIE[SESS_NAME])) && (empty($_SESSION['uid'])))
|
||||
{
|
||||
session_id($_COOKIE[SESS_NAME]);
|
||||
}
|
||||
session_start(); //starting session
|
||||
|
||||
//check, for empty session values and set
|
||||
if (empty($_SESSION['uid']))
|
||||
{
|
||||
$_SESSION['uid']='0';
|
||||
}
|
||||
if (empty($_SESSION['login_on']))
|
||||
{
|
||||
$_SESSION['login_on']='0';
|
||||
}
|
||||
if (empty($_SESSION['sessionid']))
|
||||
{
|
||||
$_SESSION['sessionid']='0';
|
||||
}
|
||||
if (empty($_COOKIE['queries']))
|
||||
{
|
||||
$_COOKIE['queries']=0;
|
||||
setcookie('queries','0',time()+31104000);
|
||||
}
|
||||
if($_COOKIE['queries']>0)
|
||||
{
|
||||
setcookie('queries','0',time()+31104000);
|
||||
$_COOKIE['uid']='0';
|
||||
}
|
||||
function sess_register($uid)
|
||||
{
|
||||
if ($uid>0)
|
||||
{
|
||||
sess_delete($uid);
|
||||
$time = time();
|
||||
$sql = "INSERT INTO ".SESSIONS_TABLE." VALUES ('', '".$_COOKIE[SESS_NAME]."','$uid','$time')";
|
||||
$result = @mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not add new session.',true));
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
function sess_delete_old()
|
||||
{
|
||||
$time = time();
|
||||
$sql = "DELETE FROM ".SESSIONS_TABLE." WHERE time+129600<$time;";
|
||||
DataBase::sql_query($sql, 'GENERAL','Could not delete session',true);
|
||||
}
|
||||
function sess_del_invalid()
|
||||
{
|
||||
if ($_SESSION['uid']>0)
|
||||
{
|
||||
$sql = "SELECT `session_id`, `u_id` FROM ".SESSIONS_TABLE." WHERE `u_id`='".$_SESSION['uid']."'";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain session information',true);
|
||||
$result = mysql_fetch_array($query);
|
||||
$result = $result['session_id'];
|
||||
if ($_COOKIE[SESS_NAME]!=$result)
|
||||
{
|
||||
$_SESSION['sessionid'] = '0';
|
||||
$_SESSION['uid'] = '0';
|
||||
}
|
||||
}
|
||||
}
|
||||
function sess_delete($uid)
|
||||
{
|
||||
$time = time();
|
||||
$sql = "DELETE FROM ".SESSIONS_TABLE." WHERE u_id='$uid'";
|
||||
$result = @mysql_fetch_array(DataBase::sql_query($sql, 'GENERAL','Could not delete session',true));
|
||||
$_SESSION['sessionid']='0';
|
||||
return $result['count'];
|
||||
}
|
||||
function sess_view()
|
||||
{
|
||||
global $lng;
|
||||
global $user;
|
||||
global $forum_config;
|
||||
$name = '';
|
||||
$time = time();
|
||||
$sql = "SELECT ".SESSIONS_TABLE.".*, ".USERS_TABLE.".*, ".SESSIONS_TABLE.".u_id AS u_id FROM ".SESSIONS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".SESSIONS_TABLE.".u_id = ".USERS_TABLE.".u_id WHERE time+1250>$time;";
|
||||
$query = DataBase::sql_query($sql, 'GENERAL','Could not obtain sessions information.');
|
||||
if (@mysql_num_rows($query)>0)
|
||||
{
|
||||
while($result = @mysql_fetch_array($query))
|
||||
{
|
||||
$uid = $result['u_id'];
|
||||
switch($result['rank'])
|
||||
{
|
||||
case '0':
|
||||
{
|
||||
$user_color_name = $result['nick'];
|
||||
break;
|
||||
}
|
||||
case '1':
|
||||
{
|
||||
$user_color_name = '<font color="'.$forum_config['color_mod'].'"><b>'.$result['nick'].'</b></font>';
|
||||
break;
|
||||
}
|
||||
case '2':
|
||||
{
|
||||
$user_color_name = '<font color="'.$forum_config['color_admin'].'"><b>'.$result['nick'].'</b></font>';
|
||||
break;
|
||||
}
|
||||
}
|
||||
$name .= '<a href="user.php?id='.$uid.'" class="fstandard">'.$user_color_name.'</a>, ';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$name = '<span class="userlink">'.$lng['empty'].'</span>';
|
||||
}
|
||||
return array($name, @mysql_num_rows($query));
|
||||
}
|
||||
?>
|
||||
110
includes/sql_parse.php
Normal file
110
includes/sql_parse.php
Normal file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Dynamic Script Forum
|
||||
* @file includes/sql_parse.php
|
||||
* @version 1.0.x, 10-02-2007, 16:44
|
||||
* @copyright 2008(c) PioDer <pioder@wp.pl>
|
||||
* @link http://pioder.gim2przemysl.int.pl/dsf.html
|
||||
* @license GNU GPL v3
|
||||
* @note Originally, phpMyAdmin function
|
||||
**/
|
||||
function remove_comments(&$output)
|
||||
{
|
||||
$lines = explode("\n", $output);
|
||||
$output = "";
|
||||
$linecount = count($lines);
|
||||
$in_comment = false;
|
||||
for($i = 0; $i < $linecount; $i++)
|
||||
{
|
||||
if( preg_match("/^\/\*/", preg_quote($lines[$i])) )
|
||||
{
|
||||
$in_comment = true;
|
||||
}
|
||||
if( !$in_comment )
|
||||
{
|
||||
$output .= $lines[$i] . "\n";
|
||||
}
|
||||
if( preg_match("/\*\/$/", preg_quote($lines[$i])) )
|
||||
{
|
||||
$in_comment = false;
|
||||
}
|
||||
}
|
||||
unset($lines);
|
||||
return $output;
|
||||
}
|
||||
|
||||
function remove_remarks($sql)
|
||||
{
|
||||
$lines = explode("\n", $sql);
|
||||
$sql = "";
|
||||
$linecount = count($lines);
|
||||
$output = "";
|
||||
for ($i = 0; $i < $linecount; $i++)
|
||||
{
|
||||
if (($i != ($linecount - 1)) || (strlen($lines[$i]) > 0))
|
||||
{
|
||||
if ($lines[$i][0] != "#")
|
||||
{
|
||||
$output .= $lines[$i] . "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$output .= "\n";
|
||||
}
|
||||
$lines[$i] = "";
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
function split_sql_file($sql)
|
||||
{
|
||||
$delimiter = ';';
|
||||
$tokens = explode($delimiter, $sql);
|
||||
$sql = "";
|
||||
$output = array();
|
||||
$matches = array();
|
||||
$token_count = count($tokens);
|
||||
for ($i = 0; $i < $token_count; $i++)
|
||||
{
|
||||
if (($i != ($token_count - 1)) || (strlen($tokens[$i] > 0)))
|
||||
{
|
||||
$total_quotes = preg_match_all("/'/", $tokens[$i], $matches);
|
||||
$escaped_quotes = preg_match_all("/(?<!\\\\)(\\\\\\\\)*\\\\'/", $tokens[$i], $matches);
|
||||
$unescaped_quotes = $total_quotes - $escaped_quotes;
|
||||
if (($unescaped_quotes % 2) == 0)
|
||||
{
|
||||
$output[] = $tokens[$i];
|
||||
$tokens[$i] = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
$temp = $tokens[$i] . $delimiter;
|
||||
$tokens[$i] = "";
|
||||
$complete_stmt = false;
|
||||
for ($j = $i + 1; (!$complete_stmt && ($j < $token_count)); $j++)
|
||||
{
|
||||
$total_quotes = preg_match_all("/'/", $tokens[$j], $matches);
|
||||
$escaped_quotes = preg_match_all("/(?<!\\\\)(\\\\\\\\)*\\\\'/", $tokens[$j], $matches);
|
||||
$unescaped_quotes = $total_quotes - $escaped_quotes;
|
||||
if (($unescaped_quotes % 2) == 1)
|
||||
{
|
||||
$output[] = $temp . $tokens[$j];
|
||||
$tokens[$j] = "";
|
||||
$temp = "";
|
||||
$complete_stmt = true;
|
||||
$i = $j;
|
||||
}
|
||||
else
|
||||
{
|
||||
$temp .= $tokens[$j] . $delimiter;
|
||||
$tokens[$j] = "";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user