Guest User

Untitled

a guest
Feb 19th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.90 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * Initialize Document Parsing
  5.  * -----------------------------
  6.  */
  7.  
  8. // get start time
  9. $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $tstart = $mtime;
  10.  
  11. // harden it
  12. require_once(dirname(__FILE__).'/manager/includes/protect.inc.php');
  13.  
  14. // set some settings, and address some IE issues
  15. @ini_set('url_rewriter.tags', '');
  16. @ini_set('session.use_trans_sid', 0);
  17. @ini_set('session.use_only_cookies',1);
  18. session_cache_limiter('');
  19. header('P3P: CP="NOI NID ADMa OUR IND UNI COM NAV"'); // header for weird cookie stuff. Blame IE.
  20. header('Cache-Control: private, must-revalidate');
  21. ob_start();
  22. error_reporting(E_ALL & ~E_NOTICE);
  23.  
  24. /**
  25.  *  Filename: index.php
  26.  *  Function: This file loads and executes the parser. *
  27.  */
  28.  
  29. define("IN_ETOMITE_PARSER", "true"); // provides compatibility with etomite 0.6 and maybe later versions
  30. define("IN_PARSER_MODE", "true");
  31. define("IN_MANAGER_MODE", "false");
  32.  
  33. if (!defined('MODX_API_MODE')) {
  34.     define('MODX_API_MODE', false);
  35. }
  36.  
  37. // initialize the variables prior to grabbing the config file
  38. $database_type = '';
  39. $database_server = '';
  40. $database_user = '';
  41. $database_password = '';
  42. $dbase = '';
  43. $table_prefix = '';
  44. $base_url = '';
  45. $base_path = '';
  46.  
  47. // get the required includes
  48. if($database_user=="") {
  49.     $rt = @include_once(dirname(__FILE__).'/manager/includes/config.inc.php');
  50.     // Be sure config.inc.php is there and that it contains some important values
  51.     if(!$rt || !$database_type || !$database_server || !$database_user || !$dbase) {
  52.     echo "
  53. <style type=\"text/css\">
  54. *{margin:0;padding:0}
  55. body{margin:50px;background:#eee;}
  56. .install{padding:10px;border:5px solid #f22;background:#f99;margin:0 auto;font:120%/1em serif;text-align:center;}
  57. p{ margin:20px 0; }
  58. a{font-size:200%;color:#f22;text-decoration:underline;margin-top: 30px;padding: 5px;}
  59. </style>
  60. <div class=\"install\">
  61. <p>MODx is not currently installed or the configuration file cannot be found.</p>
  62. <p>Do you want to <a href=\"install/index.php\">install now</a>?</p>
  63. </div>";
  64.         exit;
  65.     }
  66. }
  67.  
  68. // start session
  69. startCMSSession();
  70.  
  71. // initiate a new document parser
  72. include_once(MODX_MANAGER_PATH.'/includes/document.parser.class.inc.php');
  73. $modx = new DocumentParser;
  74. $etomite = &$modx; // for backward compatibility
  75.  
  76. // set some parser options
  77. $modx->minParserPasses = 1; // min number of parser recursive loops or passes
  78. $modx->maxParserPasses = 10; // max number of parser recursive loops or passes
  79. $modx->dumpSQL = false;
  80. $modx->dumpSnippets = false; // feed the parser the execution start time
  81. $modx->tstart = $tstart;
  82.  
  83. // Debugging mode:
  84. $modx->stopOnNotice = false;
  85.  
  86. // Don't show PHP errors to the public
  87. if(!isset($_SESSION['mgrValidated']) || !$_SESSION['mgrValidated']) {
  88.     @ini_set("display_errors","0");
  89. }
  90.  
  91. // execute the parser if index.php was not included
  92. if (!MODX_API_MODE) {
  93.     $modx->executeParser();
  94. }
  95. ?>
Add Comment
Please, Sign In to add comment