includes/common.php
author Dan
Wed, 21 Nov 2007 21:03:48 -0500
changeset 279 8acd77a6c19d
parent 271 f088805540ae
parent 272 e0ec986c0af3
child 304 e2cb5f1432c8
permissions -rw-r--r--
Merging in updates and improvements from stable
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     1
<?php
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     2
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     3
/*
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     4
 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
166
d53cc29308f4 Rebrand as 1.1.1; everything should now be bumped to "unstable" status
Dan
parents: 155
diff changeset
     5
 * Version 1.1.1
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     6
 * Copyright (C) 2006-2007 Dan Fuhry
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     7
 *
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     8
 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
     9
 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    10
 *
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    11
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    12
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    13
 */
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    14
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    15
if(isset($_REQUEST['GLOBALS']))
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    16
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    17
  ?>
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    18
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>Hacking Attempt</title><meta http-equiv="Content-type" content="text/html; charset=utf-8" /></head><style type="text/css">body{background-color:#000;color:#CCC;font-family:trebuchet ms,sans-serif;font-size:9pt;}a{color:#FFF;}</style><body><p>Hacking attempt using <a href="http://www.hardened-php.net/index.76.html">PHP $GLOBALS overwrite vulnerability</a> detected, reported to admin</p><p>You're worse than this guy! Unless you are this guy...</p><p id="billp"><img alt=" " src="about:blank" id="billi" /></p><script type="text/javascript">// <![CDATA[
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    19
  window.onload=function(){counter();setInterval('counter();', 1000);};var text=false;var cnt=10;function counter(){if(!text){text=document.createElement('span');text.id='billc';text.innerHTML=cnt;text.style.fontSize='96pt';text.style.color='#FF0000';p=document.getElementById('billp');p.appendChild(text);}else{if(cnt==1){document.getElementById('billi').src='http://upload.wikimedia.org/wikipedia/commons/7/7f/Bill_Gates_2004_cr.jpg';document.getElementById('billc').innerHTML='';return;}cnt--;document.getElementById('billc').innerHTML=cnt+' ';}}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    20
  // ]]>
12
c96a9b56f16c Fixed problems with installer and config file (chdir and error-connecting-to-MySQL issues)
Dan
parents: 10
diff changeset
    21
  </script><p><span style="color:black;">You been f***ed by Enano | valid XHTML 1.1</span></p></body></html>
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    22
  <?php
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    23
  exit;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    24
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    25
166
d53cc29308f4 Rebrand as 1.1.1; everything should now be bumped to "unstable" status
Dan
parents: 155
diff changeset
    26
$version = '1.1.1';
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    27
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    28
function microtime_float()
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    29
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    30
  list($usec, $sec) = explode(" ", microtime());
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    31
  return ((float)$usec + (float)$sec);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    32
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    33
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    34
global $_starttime;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    35
$_starttime = microtime_float();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    36
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    37
error_reporting(E_ALL);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    38
2
0931d60f5bdb Adding compatibility patch for Enano dev servers to common.php
dan@scribus.fuhry.local.fuhry.local
parents: 1
diff changeset
    39
// Determine directory (special case for development servers)
12
c96a9b56f16c Fixed problems with installer and config file (chdir and error-connecting-to-MySQL issues)
Dan
parents: 10
diff changeset
    40
if ( strpos(__FILE__, '/repo/') && ( file_exists('.enanodev') || file_exists('../.enanodev') ) )
2
0931d60f5bdb Adding compatibility patch for Enano dev servers to common.php
dan@scribus.fuhry.local.fuhry.local
parents: 1
diff changeset
    41
{
3
2b2084ca1e60 Final commit for initial branch
dan@scribus.fuhry.local.fuhry.local
parents: 2
diff changeset
    42
  $filename = str_replace('/repo/', '/', __FILE__);
2
0931d60f5bdb Adding compatibility patch for Enano dev servers to common.php
dan@scribus.fuhry.local.fuhry.local
parents: 1
diff changeset
    43
}
0931d60f5bdb Adding compatibility patch for Enano dev servers to common.php
dan@scribus.fuhry.local.fuhry.local
parents: 1
diff changeset
    44
else
0931d60f5bdb Adding compatibility patch for Enano dev servers to common.php
dan@scribus.fuhry.local.fuhry.local
parents: 1
diff changeset
    45
{
0931d60f5bdb Adding compatibility patch for Enano dev servers to common.php
dan@scribus.fuhry.local.fuhry.local
parents: 1
diff changeset
    46
  $filename = __FILE__;
0931d60f5bdb Adding compatibility patch for Enano dev servers to common.php
dan@scribus.fuhry.local.fuhry.local
parents: 1
diff changeset
    47
}
0931d60f5bdb Adding compatibility patch for Enano dev servers to common.php
dan@scribus.fuhry.local.fuhry.local
parents: 1
diff changeset
    48
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    49
if(!defined('ENANO_ROOT')) // ENANO_ROOT is sometimes defined by plugins like AjIM that need the constant before the Enano API is initialized
2
0931d60f5bdb Adding compatibility patch for Enano dev servers to common.php
dan@scribus.fuhry.local.fuhry.local
parents: 1
diff changeset
    50
  define('ENANO_ROOT', dirname(dirname($filename)));
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    51
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    52
if(defined('ENANO_DEBUG') && version_compare(PHP_VERSION, '5.0.0') < 0)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    53
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    54
  die(__FILE__.':'.__LINE__.': The debugConsole requires PHP 5.x.x or greater. Please comment out the ENANO_DEBUG constant in your index.php.');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    55
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    56
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    57
if(defined('ENANO_DEBUG'))
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    58
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    59
  require_once(ENANO_ROOT.'/includes/debugger/debugConsole.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    60
} else {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    61
  function dc_here($m)     { return false; }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    62
  function dc_dump($a, $g) { return false; }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    63
  function dc_watch($n)    { return false; }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    64
  function dc_start_timer($u) { return false; }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    65
  function dc_stop_timer($m) { return false; }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    66
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    67
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    68
if ( file_exists( ENANO_ROOT . '/_nightly.php') )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    69
  require(ENANO_ROOT.'/_nightly.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    70
191
3dbe848431b0 Added a cron framework. Currently tasks will not be run; will implement into templates in next commit
Dan
parents: 155
diff changeset
    71
// List of scheduled tasks
3dbe848431b0 Added a cron framework. Currently tasks will not be run; will implement into templates in next commit
Dan
parents: 155
diff changeset
    72
$cron_tasks = array();
3dbe848431b0 Added a cron framework. Currently tasks will not be run; will implement into templates in next commit
Dan
parents: 155
diff changeset
    73
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    74
// Start including files. LOTS of files. Yeah!
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    75
require_once(ENANO_ROOT.'/includes/constants.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    76
dc_here('Enano CMS '.$version.' (dev) - debug window<br />Powered by debugConsole');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    77
dc_here('common: including files');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    78
require_once(ENANO_ROOT.'/includes/functions.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    79
require_once(ENANO_ROOT.'/includes/dbal.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    80
require_once(ENANO_ROOT.'/includes/paths.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    81
require_once(ENANO_ROOT.'/includes/sessions.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    82
require_once(ENANO_ROOT.'/includes/template.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    83
require_once(ENANO_ROOT.'/includes/plugins.php');
205
c4542792db2b Localization low-level framework added
Dan
parents: 193
diff changeset
    84
require_once(ENANO_ROOT.'/includes/lang.php');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    85
require_once(ENANO_ROOT.'/includes/comment.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    86
require_once(ENANO_ROOT.'/includes/wikiformat.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    87
require_once(ENANO_ROOT.'/includes/diff.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    88
require_once(ENANO_ROOT.'/includes/render.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    89
require_once(ENANO_ROOT.'/includes/stats.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    90
require_once(ENANO_ROOT.'/includes/pageutils.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    91
require_once(ENANO_ROOT.'/includes/js-compressor.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    92
require_once(ENANO_ROOT.'/includes/rijndael.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    93
require_once(ENANO_ROOT.'/includes/email.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    94
require_once(ENANO_ROOT.'/includes/search.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    95
require_once(ENANO_ROOT.'/includes/json.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    96
require_once(ENANO_ROOT.'/includes/wikiengine/Tables.php');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    97
require_once(ENANO_ROOT.'/includes/pageprocess.php');
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 76
diff changeset
    98
require_once(ENANO_ROOT.'/includes/tagcloud.php');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
    99
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   100
strip_magic_quotes_gpc();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   101
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   102
// Enano has five parts: the database abstraction layer (DBAL), the session manager, the path/URL manager, the template engine, and the plugin manager.
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   103
// Each part has its own class and a global var; nearly all Enano functions are handled by one of these five components.
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   104
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   105
global $db, $session, $paths, $template, $plugins; // Common objects
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   106
global $enano_config; // A global used to cache config information without making loads of queries ;-)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   107
                      // In addition, $enano_config is used to fetch config information if die_semicritical() is called.
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   108
                      
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   109
global $email;
209
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   110
global $lang;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   111
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   112
if(!isset($_SERVER['HTTP_HOST'])) grinding_halt('Cannot get hostname', '<p>Your web browser did not provide the HTTP Host: field. This site requires a modern browser that supports the HTTP 1.1 standard.</p>');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   113
                     
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   114
$db = new mysql();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   115
dc_here('common: calling $db->connect();');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   116
$db->connect(); // Redirects to install.php if an installation is not detected
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   117
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   118
if(strstr(contentPath, '?')) $sep = '&';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   119
else $sep = '?';
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   120
define('urlSeparator', $sep);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   121
unset($sep); // save 10 bytes of memory...
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   122
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   123
// See if any diagnostic actions have been requested
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   124
if ( isset($_GET['do']) && $_GET['do'] == 'diag' && isset($_GET['sub']) )
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   125
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   126
  switch($_GET['sub'])
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   127
  {
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   128
    case 'cookie_destroy':
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   129
      unset($_COOKIE['sid']);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   130
      setcookie('sid', '', time()-3600*24, scriptPath);
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   131
      setcookie('sid', '', time()-3600*24, scriptPath.'/');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   132
      die('Session cookie cleared. <a href="'.$_SERVER['PHP_SELF'].'">Continue</a>');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   133
      break;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   134
  }
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   135
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   136
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   137
// Select and fetch the site configuration
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   138
dc_here('common: selecting global config data');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   139
$e = $db->sql_query('SELECT config_name, config_value FROM '.table_prefix.'config;');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   140
if(!$e) $db->_die('Some critical configuration information could not be selected.');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   141
else define('ENANO_CONFIG_FETCHED', ''); // Used in die_semicritical to figure out whether to call getConfig() or not
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   142
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   143
dc_here('common: fetching $enano_config');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   144
$enano_config = Array();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   145
while($r = $db->fetchrow())
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   146
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   147
  $enano_config[$r['config_name']] = $r['config_value'];
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   148
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   149
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   150
$db->free_result();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   151
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   152
if(enano_version(false, true) != $version)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   153
{
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   154
  grinding_halt('Version mismatch', '<p>It seems that the Enano release we\'re trying to run ('.$version.') is different from the version specified in your database ('.enano_version().'). Perhaps you need to <a href="'.scriptPath.'/upgrade.php">upgrade</a>?</p>');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   155
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   156
99
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   157
//
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   158
// Low level maintenance
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   159
//
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   160
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   161
// If the AES key size has been changed, bail out and fast
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   162
if ( !getConfig('aes_key_size') )
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   163
{
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   164
  setConfig('aes_key_size', AES_BITS);
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   165
}
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   166
else if ( $ks = getConfig('aes_key_size') )
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   167
{
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   168
  if ( intval($ks) != AES_BITS )
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   169
  {
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   170
    grinding_halt('AES key size changed', '<p>Enano has detected that the AES key size in constants.php has been changed. This change cannot be performed after installation, otherwise the private key would have to be re-generated and all passwords would have to be re-encrypted.</p><p>Please change the key size back to ' . $ks . ' bits and reload this page.</p>');
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   171
  }
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   172
}
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   173
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   174
// Same for AES block size
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   175
if ( !getConfig('aes_block_size') )
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   176
{
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   177
  setConfig('aes_block_size', AES_BLOCKSIZE);
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   178
}
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   179
else if ( $ks = getConfig('aes_block_size') )
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   180
{
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   181
  if ( intval($ks) != AES_BLOCKSIZE )
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   182
  {
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   183
    grinding_halt('AES block size changed', '<p>Enano has detected that the AES block size in constants.php has been changed. This change cannot be performed after installation, otherwise all passwords would have to be re-encrypted.</p><p>Please change the block size back to ' . $ks . ' bits and reload this page.</p>');
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   184
  }
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   185
}
2332ebd75f61 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters
Dan
parents: 80
diff changeset
   186
209
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   187
// Is there no default language?
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   188
if ( getConfig('lang_default') === false )
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   189
{
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   190
  $q = $db->sql_query('SELECT lang_id FROM '.table_prefix.'language LIMIT 1;');
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   191
  if ( !$q )
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   192
    $db->_die('common.php - setting default language');
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   193
  if ( $db->numrows() < 1 && !defined('ENANO_ALLOW_LOAD_NOLANG') )
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   194
  {
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   195
    grinding_halt('No languages', '<p>There are no languages installed on this site.</p>
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   196
        <p>If you are the website administrator, you may install a language by writing and executing a simple PHP script to install it:</p>
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   197
        <pre>
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   198
&lt;?php
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   199
define("ENANO_ALLOW_LOAD_NOLANG", 1);
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   200
$_GET["title"] = "langinstall";
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   201
require("includes/common.php");
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   202
install_language("eng", "English", "English", ENANO_ROOT . "/language/english/enano.json");</pre>');
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   203
  }
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   204
  $row = $db->fetchrow();
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   205
  setConfig('default_language', $row['lang_id']);
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   206
}
8a00247d1dee Login page mostly localized
Dan
parents: 205
diff changeset
   207
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   208
// Our list of tables included in Enano
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   209
$system_table_list = Array(
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   210
    table_prefix.'categories',
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   211
    table_prefix.'comments',
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   212
    table_prefix.'config',
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   213
    table_prefix.'logs',
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   214
    table_prefix.'page_text',
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   215
    table_prefix.'session_keys',
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   216
    table_prefix.'pages',
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   217
    table_prefix.'users',
10
2f530ad04f1b Added option in installer to not let admins embed PHP
Dan
parents: 3
diff changeset
   218
    table_prefix.'users_extra',
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   219
    table_prefix.'themes',
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   220
    table_prefix.'buddies',
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   221
    table_prefix.'banlist',
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   222
    table_prefix.'files',
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   223
    table_prefix.'privmsgs',
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   224
    table_prefix.'sidebar',
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   225
    table_prefix.'hits',
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   226
    table_prefix.'search_index',
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   227
    table_prefix.'groups',
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   228
    table_prefix.'group_members',
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   229
    table_prefix.'acl',
76
608dee512bf0 Work started on page tags, still aways to go, but syncing to Nighthawk
Dan
parents: 73
diff changeset
   230
    table_prefix.'page_groups',
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 76
diff changeset
   231
    table_prefix.'page_group_members',
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 76
diff changeset
   232
    table_prefix.'tags'
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   233
  );
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   234
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   235
dc_here('common: initializing base classes');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   236
$plugins = new pluginLoader();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   237
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   238
// So where does the majority of Enano get executed? How about the next nine lines of code :)
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   239
dc_here('common: ok, we\'re set up, starting mainstream execution');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   240
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   241
$plugins->loadAll();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   242
dc_here('common: loading plugins');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   243
  global $plugins;
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   244
  foreach($plugins->load_list as $f) { include_once $f; } // Can't be in object context when this is done
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   245
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   246
$session = new sessionManager();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   247
$paths = new pathManager();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   248
$template = new template();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   249
$email = new EmailEncryptor();
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   250
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   251
define('ENANO_BASE_CLASSES_INITIALIZED', '');
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   252
32
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   253
if ( !defined('IN_ENANO_INSTALL') )
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   254
{
32
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   255
  $code = $plugins->setHook('base_classes_initted');
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   256
  foreach ( $code as $cmd )
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   257
  {
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   258
    eval($cmd);
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   259
  }
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   260
    
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   261
  $p = RenderMan::strToPageId($paths->get_pageid_from_url());
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   262
  if( ( $p[1] == 'Admin' || $p[1] == 'Special' ) && function_exists('page_'.$p[1].'_'.$p[0].'_preloader'))
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   263
  {
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   264
    @call_user_func('page_'.$p[1].'_'.$p[0].'_preloader');
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   265
  }
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   266
  
270
5bcdee999015 Major fixes to the ban system - large IP match lists don't slow down the server miserably anymore.
Dan
parents: 195
diff changeset
   267
  // One quick security check...
5bcdee999015 Major fixes to the ban system - large IP match lists don't slow down the server miserably anymore.
Dan
parents: 195
diff changeset
   268
  if ( !is_valid_ip($_SERVER['REMOTE_ADDR']) )
5bcdee999015 Major fixes to the ban system - large IP match lists don't slow down the server miserably anymore.
Dan
parents: 195
diff changeset
   269
  {
5bcdee999015 Major fixes to the ban system - large IP match lists don't slow down the server miserably anymore.
Dan
parents: 195
diff changeset
   270
    die('SECURITY: spoofed IP address');
5bcdee999015 Major fixes to the ban system - large IP match lists don't slow down the server miserably anymore.
Dan
parents: 195
diff changeset
   271
  }
5bcdee999015 Major fixes to the ban system - large IP match lists don't slow down the server miserably anymore.
Dan
parents: 195
diff changeset
   272
  
32
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   273
  $session->start();
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   274
  $paths->init();
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   275
  
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   276
  define('ENANO_MAINSTREAM', '');
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   277
  
32
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   278
  // If the site is disabled, bail out, unless we're trying to log in or administer the site
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   279
  if(getConfig('site_disabled') == '1' && $session->user_level < USER_LEVEL_ADMIN)
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   280
  {
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   281
    if ( $paths->namespace == 'Admin' || ( $paths->namespace == 'Special' && ( $paths->cpage['urlname_nons'] == 'CSS' || $paths->cpage['urlname_nons'] == 'Administration' || $paths->cpage['urlname_nons'] == 'Login' ) ) )
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   282
    {
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   283
      // do nothing; allow execution to continue
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   284
    }
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   285
    else
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   286
    {
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   287
      if(!$n = getConfig('site_disabled_notice')) 
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   288
      {
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   289
        $n = 'The administrator has disabled the site. Please check back later.';
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   290
      }
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   291
      
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   292
      $text = RenderMan::render($n) . '
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   293
      <div class="info-box">
144
380e55865f86 Improved response time for username autofill; fix JS login box in Safari (bug surfaced only after 1.0.1)
Dan
parents: 142
diff changeset
   294
        If you have an administrative account, you may <a href="'.makeUrlNS('Special', 'Login').'">log in</a> to the site.
32
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   295
      </div>';
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   296
      $paths->wiki_mode = 0;
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   297
      die_semicritical('Site disabled', $text);
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   298
    }
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   299
  }
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   300
  else if(getConfig('site_disabled') == '1' && $session->user_level >= USER_LEVEL_ADMIN)
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   301
  {
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   302
    $template->site_disabled = true;
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   303
  }
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   304
  
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   305
  $code = $plugins->setHook('session_started');
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   306
  foreach ( $code as $cmd )
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   307
  {
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   308
    eval($cmd);
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   309
  }
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   310
  
4d87aad3c4c0 Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents: 30
diff changeset
   311
  if(isset($_GET['noheaders'])) $template->no_headers = true;
1
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   312
}
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   313
fe660c52c48f Adding /includes
dan@scribus.fuhry.local.fuhry.local
parents:
diff changeset
   314
?>