<?
/** 
* @package	uForum 
* @file		admin/forum_info.php
* @version	$Id$ 
* @copyright	2009(c) PioDer <pioder@wp.pl>
* @link 	http://pioder.gim2przemysl.int.pl/
* @license	GNU GPL v3
**/
define('IN_uF', true);
//include files
include('./../config.php');
include('./../includes/constants.php');
include('./../includes/class_db.php');
include('./../includes/class_error.php');
//connect to database
DataBase::db_connect();
include('./../includes/sessions.php');
include('./../includes/class_user.php');
include('./../common.php');
include('./../includes/admin/class_main.php');
include('./../includes/class_forum.php');
include('./../lngs/'.Admin_Over::DefaultLang().'/admin.php');
sess_del_invalid($_SESSION['uid']);	
sess_register($_SESSION['uid']);
sess_delete_old();
if (User::UserInformation($_SESSION['uid'],'rank')!=2)
{
	admin_message_forum($lng['yournotadmin'],'../index.php');
}

//check script version...
$errno = 0;
$errstr = '';
$version = '';
if ($open = @fsockopen('pioder.gim2przemysl.int.pl', 80, $errno, $errstr, 10))
{
	@fputs($open, "GET /updates.php?app=dsf HTTP/1.1\r\n");
	@fputs($open, "HOST: pioder.gim2przemysl.int.pl\r\n");
	@fputs($open, "Connection: close\r\n\r\n");
	$get_info = false;
	while (!@feof($open))
	{
		if ($get_info)
		{
			$version .= @fread($open, 1024);
		}
		else
		{
			if (@fgets($open, 1024) == "\r\n")
			{
				$get_info = true;
			}
		}
	}
	@fclose($open);
	if ($version==VERSION)
	{
	  	$result = $lng['noupdates'];
	}
	else
	{
	  	$result = $lng['updatenow'];
	}
}
else
{
	echo '
	<table width="'.TABLES_WIDTH.'" class="maintable" align="center">
		<tr>
			<td class="fstandard">
				<font color="red"><b>Could not connect to script server. Server is unavailable.</b></font>
			</td>
		</tr>
	</table>';
	$result = $lng['noupdates'];
}
unset($addr,$open, $version, $get_info, $errstr, $errno);
//add skin variables
$skin = array(
'dsf_pa'=>$lng['dsf_pa'],
'index'=>$lng['index'],
'gotoforum'=>$lng['go_to_forum'],
'scriptstat'=>$lng['scriptstat'],
'scriptoptions'=>$lng['scriptconfig'],
'admin_forums'=>$lng['admin_forums'],
'admin_groups'=>$lng['admin_groups'],
'admin_users'=>$lng['admin_users'],
'admin_banlist'=>$lng['admin_banlist'],
'main_beam'=>$lng['pa_mainpage'],
'L.forum_stats'=>$lng['forum_stats'],
'L.install_date'=>$lng['forum_installed'],
'L.topics'=>$lng['topics'],
'L.posts'=>$lng['posts'],
'L.script_version'=>$lng['scriptversion'],
'L.updates'=>$lng['updates'],
'install_date'=>date('d-m-Y, G:i',$forum_config['date_install']),
'topics'=>Admin_Over::TotalTopics(),
'posts'=>Admin_Over::TotalPosts(),
'updates'=>$result,
'L.welcome_pa'=>$lng['pa_welcome']
);
//do it!
Admin_Over::GenerateHeader();
include('./template/index_body.tpl');
include('./template/overall_footer.tpl');
?>