Location: PHPKode > projects > Jarida > jarida_1.0/admin/header.php
<?php

//Initialization....

require_once('../include/config.php');
require_once('../include/common.php');



switch ($db_type)
{
 case 'mysql':
   require_once('../classes/class.db.cnx.mysql.php');
   $db = new dbCnxMysql($db_host, $db_user, $db_pass, $db_name);
   break;
 case 'sqlite':
   require_once('../classes/class.db.cnx.sqlite.php');
   $db_file = "../include/" . $db_file;
   $db = new dbCnxSqlite($db_file);
   break;
}


//Initialize the Database
if(!$db->initialize())
{
  echo $db->getError();
}

require_once('../classes/Entry.php');
require_once('../classes/Comment.php');
require_once('../classes/Smilie.php');
require_once('../classes/Article.php');
require_once('../classes/ArticleComment.php');
require_once('../classes/Censor.php');
require_once('../classes/Photo.php');
require_once('../classes/PhotoComment.php');
require_once('../classes/Link.php');


//Get Configuration values and initialize the config array
//////////////////////////////////////////////////////////
$query = "SELECT config_name, config_value FROM tblConfig";

$result = $db->doQuery($query);

$config = array();
while($row = $result->getArray())
{
  $config[$row[0]] = $row[1];
}


//Initialize the language files
////////////////////////////////////
switch ($config['language'])
{
 case 'swahili':
   require_once('../language/swahili.php');
   break;
 case 'english':
   require_once('../language/english.php');
   break;
}


//Initialize the Smarty templating system
require_once('../classes/smarty/Smarty.class.php');

$template = new Smarty;

$template->template_dir = '../templates/';
$template->compile_dir = '../templates';
$template->cache_dir = '../templates';
$template->config_dir = '../templates';

$template->assign('theme', $config['theme']);
$template->assign('config', $config);
$template->assign('lang', $lang);

$template->assign('page_title', $page_title);

//Simple Authentication
///////////////////////////////////////////////
session_start();
$pass = isset($_POST['pass']) ? MD5($_POST['pass']) : $_SESSION['pass'];

$auth = authenticate($pass, $db);

if(!$auth)
{
  if(!eregi('login.php',$_SERVER['SCRIPT_NAME']))
    {
      header("Location: ./login.php");
    }
}
else
{
  $_SESSION['pass'] = $pass;
}


//Lets display the template
$template->display($config['theme'].'/admin/header.tpl');

?>
Return current item: Jarida