Hmm, interesting. My index.php file contains nothing that looks like that.
<?php
/*
*************************************************************************
MODx Content Management System and PHP Application Framework
Managed and maintained by Raymond Irving, Ryan Thrash and the
MODx community
*************************************************************************
MODx is an opensource PHP/MySQL content management system and content
management framework that is flexible, adaptable, supports XHTML/CSS
layouts, and works with most web browsers, including Safari.
MODx is distributed under the GNU General Public License
*************************************************************************
MODx CMS and Application Framework ("MODx")
Copyright 2005 and forever thereafter by Raymond Irving & Ryan Thrash.
All rights reserved.
This file and all related or dependant files distributed with this filie
are considered as a whole to make up MODx.
MODx is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
MODx is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with MODx (located in "/assets/docs/"); if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
For more information on MODx please visit http://modxcms.com/
**************************************************************************
Originally based on Etomite by Alex Butter
**************************************************************************
*/
/**
* Filename: manager/index.php
* Function: This file is the main root file for MODx. It is
* only file that will be directly requested, and
* depending on the request, will branch different
* content
*/
// get start time
$mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $tstart = $mtime;
define("IN_MANAGER_MODE", "true"); // we use this to make sure files are accessed through
// the manager instead of seperately.
// harden it
require_once('./includes/protect.inc.php');
// send anti caching headers
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
// set error reporting
error_reporting(E_ALL & ~E_NOTICE);
// check PHP version. MODx is compatible with php 4 (4.1.0 up), extra/ improved features are planned for 5
$php_ver_comp = version_compare(phpversion(), "4.1.0");
// -1 if left is less, 0 if equal, +1 if left is higher
if($php_ver_comp < 0) {
echo "Wrong php version! You're using PHP version '".phpversion()."', and MODx only works on 4.1.0 or higher."; // $_lang['php_version_check'];
exit;
}
// set some runtime options
$incPath = str_replace("\\","/",dirname(__FILE__)."/includes/"); // Mod by Raymond
if(version_compare(phpversion(), "4.3.0")>=0) {
set_include_path($incPath); // this now works, above code did not?
} else {
ini_set("include_path", $incPath); // include path the old way
}
@set_magic_quotes_runtime(0);
// include_once the magic_quotes_gpc workaround
include_once "quotes_stripper.inc.php";
// include the html_entity_decode fake function :)
if (!function_exists('html_entity_decode')) {
function html_entity_decode ($string, $opt = ENT_COMPAT) {
$trans_tbl = get_html_translation_table (HTML_ENTITIES);
$trans_tbl = array_flip ($trans_tbl);
if ($opt & 1) {
$trans_tbl["'"] = "'";
}
if (!($opt & 2)) {
unset($trans_tbl["""]);
}
return strtr ($string, $trans_tbl);
}
}
if (!defined("ENT_COMPAT")) define("ENT_COMPAT", 2);
if (!defined("ENT_NOQUOTES")) define("ENT_NOQUOTES", 0);
if (!defined("ENT_QUOTES")) define("ENT_QUOTES", 3);
// set the document_root :|
if(!isset($_SERVER["DOCUMENT_ROOT"]) || empty($_SERVER["DOCUMENT_ROOT"])) {
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PATH_INFO"], "", ereg_replace("[\][\]", "/", $_SERVER["PATH_TRANSLATED"]))."/";
}
define("IN_ETOMITE_SYSTEM", "true"); // for backward compatibility with 0.6
// include_once config file
$config_filename = "./includes/config.inc.php";
if (!file_exists($config_filename)) {
echo "<h3>Unable to load configuration settings</h3>";
echo "Please run the MODx <a href='../install'>install utility</a>";
exit;
}
// include the database configuration file
include_once "config.inc.php";
// initiate the content manager class
include_once "document.parser.class.inc.php";
$modx = new DocumentParser;
$modx->loadExtension("ManagerAPI");
$modx->getSettings();
$etomite = &$modx; // for backward compatibility
// connect to the database
if(@!$modxDBConn = mysql_connect($database_server, $database_user, $database_password)) {
die("<h2>Failed to create the database connection!</h2>. Please run the MODx <a href='../install'>install utility</a>");
} else {
mysql_select_db(str_replace('`', '', $dbase));
@mysql_query("{$database_connection_method} {$database_connection_charset}");
}
// get the settings from the database
include_once "settings.inc.php";
// send the charset header
header('Content-Type: text/html; charset='.$modx_charset);
// include version info
include_once "version.inc.php";
// accesscontrol.php checks to see if the user is logged in. If not, a log in form is shown
include_once "accesscontrol.inc.php";
// double check the session
if(!isset($_SESSION['mgrValidated'])){
echo "Not Logged In!";
exit;
}
// get the user settings from the database
include_once "user_settings.inc.php";
//echo $manager_direction;
//echo $modx->config['manager_direction'];
// include_once the language file
if(!isset($manager_language)) {
$manager_language = "english"; // if not set, get the english language file.
}
$_lang = array();
include_once "lang/english.inc.php";
$length_eng_lang = count($_lang);
if($manager_language!="english" && file_exists(MODX_MANAGER_PATH."includes/lang/".$manager_language.".inc.php")) {
include_once "lang/".$manager_language.".inc.php";
}
// include_once the style variables file
if(isset($manager_theme) && !isset($_style)) {
$_style = array();
include_once "media/style/".$manager_theme."/style.php";
}
// check if user is allowed to access manager interface
if(isset($allow_manager_access) && $allow_manager_access==0) {
include_once "manager.lockout.inc.php";
}
// include_once the error handler
include_once "error.class.inc.php";
$e = new errorHandler;
// Initialize System Alert Message Queque
if (!isset($_SESSION['SystemAlertMsgQueque'])) $_SESSION['SystemAlertMsgQueque'] = array();
$SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque'];
// first we check to see if this is a frameset request
if(!isset($_POST['a']) && !isset($_GET['a']) && ($e->getError()==0) && !isset($_POST['updateMsgCount'])) {
// this looks to be a top-level frameset request, so let's serve up a frameset
include_once "frames/1.php";
exit;
}
// OK, let's retrieve the action directive from the request
if(isset($_GET['a']) && isset($_POST['a'])) {
$e->setError(100);
$e->dumpError();
// set $e to a corresponding errorcode
// we know that if an error occurs here, something's wrong,
// so we dump the error, thereby stopping the script.
} else {
$action=$_REQUEST['a'];
}
if (isset($_POST['updateMsgCount']) && $modx->hasPermission('messages')) {
include_once 'messageCount.inc.php';
}
// save page to manager object
$modx->manager->action = $action;
// attempt to foil some simple types of CSRF attacks
if (isset($modx->config['validate_referer']) && $modx->config['validate_referer']) {
if (isset($_SERVER['HTTP_REFERER'])) {
$referer = $_SERVER['HTTP_REFERER'];
if (!empty($referer)) {
if (!eregi(MODX_SITE_URL, $referer)) {
echo "A possible CSRF attempt was detected from referer: {$referer}.";
exit();
}
} else {
echo "A possible CSRF attempt was detected. No referer was provided by the client.";
exit();
}
} else {
echo "A possible CSRF attempt was detected. No referer was provided by the server.";
exit();
}
}
// invoke OnManagerPageInit event
$modx->invokeEvent("OnManagerPageInit", array("action" => $action));
// Now we decide what to do according to the action request. This is a BIG list :)
switch ($action) {
/********************************************************************/
/* frame management - show the requested frame */
/********************************************************************/
case "1" :
// get the requested frame
$frame = preg_replace('/[^a-z0-9]/i','',$_REQUEST['f']);
if($frame>9) {
$enable_debug=false; // this is to stop the debug thingy being attached to the framesets
}
include_once "frames/".$frame.".php";
break;
/********************************************************************/
/* show the homepage */
/********************************************************************/
case "2" :
// get the home page
include_once "header.inc.php";
include_once "actions/welcome.static.php";
include_once "footer.inc.php";
break;
/********************************************************************/
/* document data */
/********************************************************************/
case "3" :
// get the page to show document's data
include_once "header.inc.php";
include_once "actions/document_data.static.php";
include_once "footer.inc.php";
break;
/********************************************************************/
/* content management */
/********************************************************************/
case "85" :
// get the mutate page for adding a folder
include_once "header.inc.php";
include_once "actions/mutate_content.dynamic.php";
include_once "footer.inc.php";
break;
case "27" :
// get the mutate page for changing content
include_once "header.inc.php";
include_once "actions/mutate_content.dynamic.php";
include_once "footer.inc.php";
break;
case "4" :
// get the mutate page for adding content
include_once "header.inc.php";
include_once "actions/mutate_content.dynamic.php";
include_once "footer.inc.php";
break;
case "5" :
// get the save processor
include_once "processors/save_content.processor.php";
break;
case "6" :
// get the delete processor
include_once "processors/delete_content.processor.php";
break;
case "63" :
// get the undelete processor
include_once "processors/undelete_content.processor.php";
break;
case "51" :
// get the move action
include_once "header.inc.php";
include_once "actions/move_document.dynamic.php";
include_once "footer.inc.php";
break;
case "52" :
// get the move document processor
include_once "processors/move_document.processor.php";
break;
case "61" :
// get the processor for publishing content
include_once "processors/publish_content.processor.php";
break;
case "62" :
// get the processor for publishing content
include_once "processors/unpublish_content.processor.php";
break;
/********************************************************************/
/* show the wait page - gives the tree time to refresh (hopefully) */
/********************************************************************/
case "7" :
// get the wait page (so the tree can reload)
include_once "header.inc.php";
include_once "actions/wait.static.php";
include_once "footer.inc.php";
break;
/********************************************************************/
/* let the user log out */
/********************************************************************/
case "8" :
// get the logout processor
include_once "processors/logout.processor.php";
break;
/********************************************************************/
/* user management */
/********************************************************************/
case "87" :
// get the new web user page
include_once "header.inc.php";
include_once "actions/mutate_web_user.dynamic.php";
include_once "footer.inc.php";
break;
case "88" :
// get the edit web user page
include_once "header.inc.php";
include_once "actions/mutate_web_user.dynamic.php";
include_once "footer.inc.php";
break;
case "89" :
// get the save web user processor
include_once "processors/save_web_user.processor.php";
break;
case "90" :
// get the delete web user page
include_once "processors/delete_web_user.processor.php";
break;
case "11" :
// get the new user page
include_once "header.inc.php";
include_once "actions/mutate_user.dynamic.php";
include_once "footer.inc.php";
break;
case "12" :
// get the edit user page
include_once "header.inc.php";
include_once "actions/mutate_user.dynamic.php";
include_once "footer.inc.php";
break;
case "32" :
// get the save user processor
include_once "processors/save_user.processor.php";
break;
case "28" :
// get the change password page
include_once "header.inc.php";
include_once "actions/mutate_password.dynamic.php";
include_once "footer.inc.php";
break;
case "34" :
// get the save new password page
include_once "processors/save_password.processor.php";
break;
case "33" :
// get the delete user page
include_once "processors/delete_user.processor.php";
break;
/********************************************************************/
/* role management */
/********************************************************************/
case "38" :
// get the new role page
include_once "header.inc.php";
include_once "actions/mutate_role.dynamic.php";
include_once "footer.inc.php";
break;
case "35" :
// get the edit role page
include_once "header.inc.php";
include_once "actions/mutate_role.dynamic.php";
include_once "footer.inc.php";
break;
case "36" :
// get the save role page
include_once "processors/save_role.processor.php";
break;
case "37" :
// get the delete role page
include_once "processors/delete_role.processor.php";
break;
/********************************************************************/
/* template management */
/********************************************************************/
case "16" :
// get the edit template action
include_once "header.inc.php";
include_once "actions/mutate_templates.dynamic.php";
include_once "footer.inc.php";
break;
case "19" :
// get the new template action
include_once "header.inc.php";
include_once "actions/mutate_templates.dynamic.php";
include_once "footer.inc.php";
break;
case "20" :
// get the save processor
include_once "processors/save_template.processor.php";
break;
case "21" :
// get the delete processor
include_once "processors/delete_template.processor.php";
break;
case "96" :
// get the duplicate template processor
include_once "processors/duplicate_template.processor.php";
break;