<?php $TIME_START=microtime(true); require_once("config.inc.php"); require_once("config.common.inc.php"); require_once("config.locals.inc.php"); 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/redirect.inc.php"); require_once('includes/phptools/routines.inc.php'); require_once("includes/phptools/cache.inc.php"); require_once('includes/phptools/textreplace.inc.php'); require_once("includes/DTEv2/template.driver.inc.php"); require_once("includes/plugins.inc.php"); require_once("includes/routines.inc.php"); require_once("includes/message.inc.php"); require_once("includes/phptools/tasks.inc.php"); require_once("includes/phptools/theme.inc.php"); require_once('includes/rewrite.inc.php'); require_once("includes/paging.inc.php"); require_once('includes/sendmail.inc.php'); $Config=new ReservConfig(); initialize_config($Config); set_local_configurations($Config); $REMOTE_IS_SEARCHENGINE=remote_is_searchengine(); if (!TGET('NOSESSION') && !$REMOTE_IS_SEARCHENGINE) start_session_with_adjustments($Config); require_once("initadjust.php"); require_once("includes/db.inc.php"); $dataset=array(); $CMD=GET("cmd"); if (!$CMD) $CMD="home"; $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; $DEPEND_ON_TEMPLATES=array(); $DEPEND_ON_FILES=array(); $NO_TEXT_REPLACE=false; $OUTPUT_POST_FILTER=array(); if (strpbrk($CMD,"\\/@:&|")===false) { populate_plugins(); $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; } } call_plugins_addscript(); $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); foreach ($LANGUAGE_FILES as $lf) if (file_exists($lf)) $LOADER->addLabelFiles($lf); $cachepath=compute_user_path(compere_id_requested(),$Config->CachePrefix,'/'); foreach ($DEPEND_ON_TEMPLATES as $dot) array_push($DEPEND_ON_FILES,deduce_theme_path($dot.$CMD_TMPL_SUFFIX)); $DRIVER=$LOADER->load($COMMAND_TEMPLATE,$cachepath,language_requested().$TMPL_PARAM,$DEPEND_ON_FILES); 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"); echo $CMD; } 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('enduptasks.php'); ?>