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

159 lines
4.0 KiB

<?php
/**
* @package uForum
* @file includes/admin/class_main.php
* @version $Id$
* @copyright 2009(c) PioDer <[email protected]>
* @link http://pioder.gim2przemysl.int.pl/
* @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 = DataBase::fetch($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='';
$cat=opendir('./../lngs');
$notempty = false;
while ($file = readdir($cat))
{
if($file != '..' && $file !='.' && $file !='')
{
if (is_dir('./../lngs/'.$file)){
$notempty = true;
if ($file==$default_lang)
{
$result .='<option value="'.$file.'" selected="selected">'.$file.'</option>';
}
else
{
$result .='<option value="'.$file.'">'.$file.'</option>';
}
}
}
}
return $result;
unset($cat, $notempty, $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 = DataBase::fetch(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 = DataBase::fetch(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 = DataBase::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 = DataBase::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">';
}
}
?>