Location: PHPKode > projects > Fusion Board > v_1-0-0/admin/admin.inc.class.php
<?php
/**********************************************************************/
/*                 Powered By Fusion Board V 1.0.0
/**********************************************************************/
/* Author:               Keven Brochu
/* Copyright:            © 2004 - KevBrok, The Dynamic Fusion Team
/* Web:                  http://www.dynamic-fusion.net
/* E-mail:               hide@address.com
/* Begin:                14 Feb 2005 00:04 GMT
/* Last Update:          ---
/* Fusion Board Version: 1.0.0
/* File Version:         1.0.0
/**********************************************************************/
/* Visit Dynamic-Fusion website for details, updates, support and more.
/**********************************************************************/
/* admin/admin.php
/* Administrator's control panel Index
/**********************************************************************/

if ( !defined( 'FILE_ACCESS' ) ) exit;

define( 'IN_ADMIN', TRUE );

require ( ROOT_PATH . 'classes/sql/admin_queries/' . $sql_infos[ 'class' ] . '.class'  . EXT );
require ( ROOT_PATH . 'admin/classes/functions.class' . EXT );
$A_QUERIES   = new sql_admin_queries;
$A_FUNCTIONS = new admin_functions;

class admin
{
	/*
	* Define some vars
	*/	
	var $content;
	var $admin_sessid;
	var $admin_logged_in = FALSE;
	var $admin_is_root   = FALSE;
	
	/*
	* Init
	*/
	function admin()
	{	
		global $SESSION, $SQL, $A_QUERIES;
		
		/*
		* Delete old Admin sessions
		*/
		$SQL -> query( $A_QUERIES -> delete_expired_sessions );
		
		/*
		* Set some useful vars
		*/
		$SESSION -> infos[ 'admin_vars' ] = array();
		$SESSION -> infos[ 'admin_vars' ][ 'sessid' ] = 0;
		
		$this -> content = '';
		$this -> admin_sessid = 0;
		
		/*
		* Start the page...
		*/
		$this -> check_global_perms();
		$this -> get_admin_page();
		
		return TRUE;
	}
	
	
	/*
	* Check global perms (If the user is logged in, check ip, etc)
	*/
	function check_global_perms()
	{
		global $FUNCTIONS, $SESSION, $config;
		
		/*
		* No-session IP ? No admin.. exit right now.
		*/
		if ( strpos( ',' . $config[ 'NO_SESSION_IP' ] . ',', ',' . $SESSION -> infos[ 'user_ip' ] . ',' ) !== FALSE )
		{
			$SQL -> close();
			exit;
		}
		
		$cooksid = ( $FUNCTIONS -> get_cookie( 'asid' ) !== FALSE && preg_match( '#^([a-zA-Z0-9]){60}$#s', $FUNCTIONS -> get_cookie( 'asid' ) ) ) ?
			TRUE : FALSE;

		$SESSION -> infos[ 'admin_vars' ][ 'use_url' ] = ( !$cook && isset( $_GET[ 'asid' ] ) && !is_array( $_GET[ 'asid' ] ) && preg_match( '#^([a-zA-Z0-9]){60}$#s', $_GET[ 'asid' ] ) ) ?
			TRUE : FALSE;
		
		/*
		* Get admin session ID
		*/
		$sessid = ( ( $cooksid ) ?
			htmlspecialchars( $FUNCTIONS -> get_cookie( 'asid' ) ) :
				( ( $SESSION -> infos[ 'admin_vars' ][ 'use_url' ] ) ?
					htmlspecialchars( $_GET[ 'asid' ] ) : 0 ) );
		
		if ( $SQL -> query( $A_QUERIES -> get_admin_infos( $sessid, $SESSION -> infos[ 'user_ip' ] ) ) )
		{
			$SESSION -> infos[ 'admin_vars' ] = $SQL -> fetch_array();
			$this -> admin_sessid = $SESSION -> infos[ 'admin_vars' ][ 'sess_id' ];
		}
		else
		{
			/*
			* Show the log in page...
			*/
			$this -> admin_sessid    = 0;
			$this -> admin_logged_in = FALSE;
			$this -> admin_is_root   = FALSE;
			
			$this -> show_login_page();
		}
	}
	
	
	function show_login_page()
	{
		
	}
	
	
	/*
	* Global HTML elements...
	*/
	function get_header()
	{
		global $A_FUNCTIONS, $lang_read_dir, $lang_charset, $alang, $config;
		
		$root_path = ROOT_PATH;
		
		$content = <<<HTML
<?xml version="1.0" encoding="iso-8859-1"?>
<!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" xml:lang="en" dir="$lang_read_dir">
  <head>
    <meta http-equiv="content-type" content="application/xhtml+xml; charset=$lang_charset" />
    <title>{$config['BOARD_NAME']} :: {$alang['admin_title']}</title>
    <link rel="Start" title="{$A_FUNCTIONS->sessurl()}" href="{$alang['admin_title']}" />
    <link href="{$root_path}admin_style.css" rel="stylesheet" type="text/css" />
  </head>    
  <body>
    <div id="body">
      <div id="header">
        <a href="{$A_FUNCTIONS->sessurl()}" title="{$config['BOARD_NAME']} - {$alang['admin_title']}"><img src="{$root_path}img/logo.jpg" width="243" height="114" alt="Fusion Board" /></a>
      </div>
      <div id="userinfos">
        <div class="userinfos_txt"></div>
      </div>
      <div class="head_menu">
        <div id="menu">
          
        </div>
      </div>
      <div class="left">
        <h4>Catégorie Fusion</h4>
        <div class="h5">
		  <a href="#">Nouveautés</a>
        </div>
        <div class="h6">
          <div class="h6_list">
            <ul>
              <li><a href="#">Fusion Board v1.2 Alpha !!</a></li>
              <li><a href="#">Fusion Portail v1.7 !!</a></li>
              <li><a href="#">Fusion Chat v2</a></li>
              <li><a href="#">Mod de recherche</a></li>
              <li><a href="#">Mod d'espace membres</a></li>
              <li><a href="#">MINIcode v3.0</a></li>
            </ul>
          </div>
        </div>
        <div class="h5">
          <a href="#">Articles</a>
        </div>
      </div>
      <div id="right">
HTML;
		$this -> content = $content . $this -> content;
		
		return TRUE;
	}
}

$admin = new admin();
echo $admin -> output();

$SQL -> close();
exit;
?>
Return current item: Fusion Board