<?php $TIME_START=microtime(true); require_once("config.inc.php"); require_once("config.common.inc.php"); require_once("config.locals.inc.php"); require_once("config.db.inc.php"); chdir('..'); require_once("includes/phptools/common.inc.php"); require_once("includes/phptools/datetime.inc.php"); require_once('includes/phptools/ip_db.inc.php'); require_once("includes/phptools/startsession.inc.php"); require_once("includes/phptools/maps.common.inc.php"); require_once("includes/phptools/routines.inc.php"); require_once("includes/DTEv2/template.driver.inc.php"); require_once("includes/cache.inc.php"); require_once('includes/textreplace.inc.php'); require_once("includes/routines.inc.php"); require_once("includes/phptools/tasks.inc.php"); require_once("includes/phptools/theme.inc.php"); require_once("includes/paging.inc.php"); require_once('includes/sendmail.inc.php'); require_once('includes/returnurl.inc.php'); $Config=new LoginConfig(); initialize_config($Config); set_local_configurations($Config); initialize_db_config($Config); if (!TGET('NOSESSION')) { start_session_with_adjustments($Config); if (set_return_point()) return; } $CMD=GET("cmd"); if (!$CMD) $CMD="home"; require_once("initadjust.php"); require_once("includes/db.inc.php"); $dataset=array(); $CMD_TMPL_NAME=$CMD; require_once("commonpre.inc.php"); $OUTPUT_AVAILABLE=false; $TEXT_OUTPUT=false; $SCRIPT_TIME_START=null; $SCRIPT_TIME_END=null; $COMMAND_TEMPLATE=null; $NO_TEXT_REPLACE=false; $OUTPUT_POST_FILTER=array(); if (strpbrk($CMD,"\\/@:&|")===false) { $CMD_TMPL_SUFFIX=".tmpl.htm"; $TMPL_PARAM=""; $COMMAND_SCRIPT="commands/".$CMD.".php"; $LANGUAGE_FILES=array(); if (file_exists($COMMAND_SCRIPT)) { try { include($COMMAND_SCRIPT); $OUTPUT_AVAILABLE=true; } catch (Exception $e) { if ($DBConn->connected()) $DBConn->rollback(); $errstr=$e->getMessage()."\n".$e->getTraceAsString(); try { if ($Config->ErrorReportMail) { $mailbody=$errstr."\n"; $mailbody.='Last SQL: '.$DBConn->last_sql."\n"; $mailbody.='$_SERVER='.print_r($_SERVER,true)."\n"; $mailbody.='$_SESSION='.print_r($_SESSION,true)."\n"; $mailbody.='$_GET'.print_r($_GET,true)."\n"; $mailbody.='$_POST'.print_r($_POST,true)."\n"; sendmail($Config->MailerAddress,$Config->ErrorReportMail,"Auto error report from ".$Config->SERVER_DOMAIN,$mailbody); } include "errorpage.php"; } catch (Exception $e) { trigger_error($errstr,E_USER_ERROR); } exit; } } $CMD_TIME_END=$TIME_END=microtime(true); if ($CMD_TMPL_NAME) { $LANGUAGE_FILES=array_merge(LanguageFiles(),$LANGUAGE_FILES); if (!$COMMAND_TEMPLATE) $COMMAND_TEMPLATE=deduce_theme_path($CMD_TMPL_NAME.$CMD_TMPL_SUFFIX); if (file_exists($COMMAND_TEMPLATE)) { require_once("commonpost.inc.php"); $LOADER=new TemplateLoader($dataset); $LOADER->Cache_File_Owner=getmyuid(); foreach ($LANGUAGE_FILES as $lf) if (file_exists($lf)) $LOADER->addLabelFiles($lf); $cachepath=compute_user_path(compere_id_requested(),$Config->CachePrefix,'/'); $DRIVER=$LOADER->load($COMMAND_TEMPLATE,$cachepath,language_requested().$TMPL_PARAM); ob_start(); $DRIVER->output(); foreach ($OUTPUT_POST_FILTER as $opf_name) call_user_func($opf_name); $TIME_END=microtime(true); ob_end_flush(); $OUTPUT_AVAILABLE=true; $TEXT_OUTPUT=true; } } } if (!$OUTPUT_AVAILABLE) { header("HTTP/1.1 404 Not Found"); } else if ($TEXT_OUTPUT) { if ($Config->DisplayExecutionTime) { echo '<!-- Script Execution Time = '.($SCRIPT_TIME_END-$SCRIPT_TIME_START).'s -->'; echo '<!-- Command Execution Time = '.($CMD_TIME_END-$TIME_START).'s -->'; echo '<!-- Total Execution Time = '.($TIME_END-$TIME_START).'s -->'; echo '<!-- '.$_SERVER['SERVER_ADDR'].' -->'; echo "\n"; } } require('base/enduptasks.php'); ?>