<? /*
// File: index.php
// Purpose: Includes, Coordinate.
// Creation: 2001-10-29
// Author: Felix <hide@address.com>
*/
//explicitly set error level for people who have changed their php.ini defaults
error_reporting(E_ALL & ~E_NOTICE);
//
// Start Page Load Counter
$start_load = doubleval(ereg_replace('^0\.([0-9]*) ([0-9]*)$','\\2.\\1',microtime()));
//
// include configuration & functions file
if ($cfg['httpd_mode'] != 'webcp') {
$tmp = "config.inc.php";
include($tmp);
$tmp = "functions.inc.phps";
include($tmp);
}
//
// Shoot out NO-CACHE to proxies
send_header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
send_header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
send_header("Cache-Control: no-store, no-cache, must-revalidate");
send_header("Cache-Control: post-check=0, pre-check=0", false);
send_header("Pragma: no-cache");
// 'dynamic' GLOBAL vars declared.
GLOBAL $T, $userdata;
//
// Initialize certain general vars.
$T = '';
$userdata = '';
unset($personaldata);
unset($domaindata);
unset($resellerdata);
unset($error);
unset($notice);
//
// if $lang is set, load the language file right away (mainly for login sequence)
if (isset($lang)) {
$lang = str_replace("/","",$lang);
if (file_exists("lang/".$lang.".phps"))
include("lang/".$lang.".phps");
else {
$lang = $cfg['defaultlang'];
include("lang/".$lang.".phps");
}
}
//
// Include Initialization sequence: connect to db, authenticate, set default vars
$rcode = include("passwd.init.inc.phps");
if ($rcode != 1) {
echo $rcode;
return;
}
//
// if $T (language file) was not set, load it right away
if (!is_array($T)) {
// always load english file to prevent missing fields in other langs.
if (file_exists("lang/english.phps") AND $lang != 'english')
include("lang/english.phps");
// load appropriate language file.
if (file_exists("lang/".$lang.".phps"))
include("lang/".$lang.".phps");
else {
echo 'index.php :: Invalid $lang';
return;
}
}
// If the bookmark action is triggered, save/reset it.
if ($bookmark == "true") {
// update database
mysql_query("UPDATE users SET favorites = '$cp:$url:$number:$user' WHERE username='".$userdata['username']."'");
// in case we are looking at user settings or user info, reset the data in memory
$personaldata['favorites'] = "$cp:$url:$number:$user";
// send a 'notice' to be echoed before the cp script
$notice = $T['Bookmarked'];
}
elseif ($bookmark == "reset" AND $personaldata['username']) {
// update database
mysql_query("UPDATE users SET favorites = '' WHERE username='".$personaldata['username']."'");
// Unset previous favorites in memory
$personaldata['favorites'] = "";
// send a 'notice' to be echoed before the cp script
$notice = $T['Bookmark reset'];
}
//
// include {TAGS} parser module
$rcode = include("parser.inc.phps");
if ($rcode != 1) {
echo $rcode;
return;
}
//
// Dump to the browser
// If we had a {MAIN PAGE} (i.e not a frame), explode the skin to include the web://cp script
if (strstr($newskin,"{MAIN PAGE}")) {
// echo head of skin
$newskin = explode("{MAIN PAGE}",$newskin);
echo $newskin[0];
// Echo notices from the backend (bookmark done)
if ($notice){
echo "<br><div align='center'>".$notice."</div>\n";
}
// include & display cp script
include($cp."/".$url.".phps");
// include skin tail
$newskin = $newskin[1];
}
// Stop load timer and echo the result with the skin (MUST BE AT THE END OF THE PAGE)
$load_time = round(ereg_replace('^0\.([0-9]*) ([0-9]*)$','\\2.\\1',microtime()) - $start_load,3);
echo str_replace("{LOAD TIME}",$load_time,$newskin);
// DEBUG Dump
if (isset($dump)) {
echo '<pre>';
if ($dump == 'env') {
echo "\$HTTP_POST_VARS:\n";
print_r($HTTP_POST_VARS);
echo "\n\n\$HTTP_GET_VARS:\n";
print_r($HTTP_GET_VARS);
echo "\n\n\$data:\n";
print_r($data);
}
echo '</pre>';
}
// THE END
return;
?>