includes/common_cli.php
author Dan
Mon, 13 Apr 2009 17:28:24 -0400
changeset 908 44302dd20d62
parent 812 68060328e9c6
child 945 c19242d13a49
permissions -rw-r--r--
Memberlist now shows rank instead of user level in "Title" column. (thanks mm3)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
500
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
     1
<?php
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
     2
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
     3
/*
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
     4
 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
801
eb8b23f11744 Two big commits in one day I know, but redid password storage to use HMAC-SHA1. Consolidated much AES processing to three core methods in session that should handle everything automagically. Installation works; upgrades should. Rebranded as 1.1.6.
Dan
parents: 695
diff changeset
     5
 * Version 1.1.6 (Caoineag beta 1)
536
218a627eb53e Rebrand as 1.1.4 (Caoineag alpha 4)
Dan
parents: 500
diff changeset
     6
 * Copyright (C) 2006-2008 Dan Fuhry
500
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
     7
 *
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
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
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
     9
 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    10
 *
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    11
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    12
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    13
 */
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    14
 
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    15
/**
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    16
 * The main loader script that initializes everything about Enano in the proper order. This is only loaded
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    17
 * if PHP is running via CLI.
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    18
 * @package Enano
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    19
 * @subpackage Core
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    20
 * @copyright See header block
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    21
 */
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    22
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    23
//
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    24
// MAIN API INITIALIZATION
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    25
//
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    26
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    27
// Note to important functions and the template class that we're running via CLI
812
68060328e9c6 Added CLI installer. Supports interactive, command-line, and internal-call installation. Fixed a few bugs related to anti-SQL injection parser and plugin installation.
Dan
parents: 801
diff changeset
    28
@define('ENANO_CLI', 1);
500
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    29
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    30
// The first thing we need to do is start the database connection. At this point, for all we know, Enano might not
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    31
// even be installed. If this connection attempt fails and it's because of a missing or corrupt config file, the
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    32
// user will be redirected (intelligently) to install.php.
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    33
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    34
$config_file = ( defined('IN_ENANO_INSTALL') ) ? '/config.new.php' : '/config.php';
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    35
@include(ENANO_ROOT . $config_file);
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    36
unset($dbuser, $dbpasswd);
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    37
if ( !isset($dbdriver) )
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    38
  $dbdriver = 'mysql';
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    39
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    40
$db = new $dbdriver();
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    41
$db->connect();
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    42
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    43
profiler_log('Database connected');
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    44
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    45
// The URL separator is the character appended to contentPath + url_title type strings.
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    46
// If the contentPath has a ? in it, this should be an ampersand; else, it should be a
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    47
// question mark.
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    48
$sep = ( strstr(contentPath, '?') ) ? '&' : '?';
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    49
define('urlSeparator', $sep);
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    50
unset($sep); // save 10 bytes of memory...
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    51
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    52
// Select and fetch the site configuration
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    53
$e = $db->sql_query('SELECT config_name, config_value FROM '.table_prefix.'config;');
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    54
if ( !$e )
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    55
{
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    56
  $db->_die('Some critical configuration information could not be selected.');
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    57
}
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    58
// Used in die_semicritical to figure out whether to call getConfig() or not
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    59
define('ENANO_CONFIG_FETCHED', '');
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    60
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    61
// Initialize and fetch the site configuration array, which is used to cache the config
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    62
$enano_config = Array();
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    63
while($r = $db->fetchrow())
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    64
{
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    65
  $enano_config[$r['config_name']] = $r['config_value'];
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    66
}
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    67
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    68
$db->free_result();
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    69
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    70
profiler_log('Config fetched');
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    71
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    72
// Now that we have the config, check the Enano version.
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    73
if ( enano_version(false, true) != $version && !defined('IN_ENANO_UPGRADE') )
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    74
{
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    75
  grinding_halt('Version mismatch', 'Trying to run Enano version '.$version.' on database version '.enano_version().', you might need to upgrade.');
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    76
}
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    77
650
e45183014778 Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
parents: 612
diff changeset
    78
// Set our CDN path
666
402adf8ea719 Made cdnPath define conditionally; fixed common_cli not properly loading plugins
Dan
parents: 650
diff changeset
    79
if ( !defined('cdnPath') )
402adf8ea719 Made cdnPath define conditionally; fixed common_cli not properly loading plugins
Dan
parents: 650
diff changeset
    80
  define('cdnPath', getConfig('cdn_path', scriptPath));
650
e45183014778 Added CDN support: a URL to a CDN can now be specified and Enano will load all images, CSS, and javascript (except TinyMCE) from that server
Dan
parents: 612
diff changeset
    81
500
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    82
//
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    83
// Low level maintenance
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    84
//
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    85
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    86
// If the AES key size has been changed, bail out and fast
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    87
if ( !getConfig('aes_key_size') )
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    88
{
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    89
  setConfig('aes_key_size', AES_BITS);
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    90
}
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    91
else if ( $ks = getConfig('aes_key_size') )
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    92
{
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    93
  if ( intval($ks) != AES_BITS )
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    94
  {
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    95
    grinding_halt('AES key size changed', '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.' . "\n\n" . 'Please change the key size back to ' . $ks . ' bits and rerun this script.');
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    96
  }
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    97
}
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    98
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
    99
// Same for AES block size
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   100
if ( !getConfig('aes_block_size') )
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   101
{
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   102
  setConfig('aes_block_size', AES_BLOCKSIZE);
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   103
}
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   104
else if ( $ks = getConfig('aes_block_size') )
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   105
{
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   106
  if ( intval($ks) != AES_BLOCKSIZE )
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   107
  {
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   108
    grinding_halt('AES block size changed', "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.\n\nPlease change the block size back to $ks bits and rerun this script.");
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   109
  }
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   110
}
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   111
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   112
// Is there no default language?
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   113
if ( getConfig('default_language') === false && !defined('IN_ENANO_MIGRATION') )
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   114
{
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   115
  $q = $db->sql_query('SELECT lang_id FROM '.table_prefix.'language LIMIT 1;');
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   116
  if ( !$q )
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   117
    $db->_die('common.php - setting default language');
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   118
  if ( $db->numrows() < 1 && !defined('ENANO_ALLOW_LOAD_NOLANG') )
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   119
  {
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   120
    grinding_halt('No languages', 'No languages are installed on the site, load from web interface for instructions on how to fix this.');
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   121
  }
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   122
  $row = $db->fetchrow();
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   123
  setConfig('default_language', $row['lang_id']);
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   124
}
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   125
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   126
profiler_log('Ran checks');
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   127
612
3e73e4996d64 Made CLI version of common load cache manager properly
Dan
parents: 541
diff changeset
   128
// Init cache
3e73e4996d64 Made CLI version of common load cache manager properly
Dan
parents: 541
diff changeset
   129
$cache = new CacheManager();
3e73e4996d64 Made CLI version of common load cache manager properly
Dan
parents: 541
diff changeset
   130
500
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   131
// Load plugin manager
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   132
$plugins = new pluginLoader();
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   133
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   134
//
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   135
// Mainstream API boot-up
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   136
//
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   137
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   138
// Obtain list of plugins
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   139
$plugins->loadAll();
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   140
666
402adf8ea719 Made cdnPath define conditionally; fixed common_cli not properly loading plugins
Dan
parents: 650
diff changeset
   141
profiler_log('Fetched plugin list');
402adf8ea719 Made cdnPath define conditionally; fixed common_cli not properly loading plugins
Dan
parents: 650
diff changeset
   142
500
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   143
global $plugins;
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   144
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   145
// Load plugins from common because we can't give plugins full abilities in object context
695
6bd7215c718b Added ENANO_NO_PLUGINS optional switch to common_cli.
Dan
parents: 685
diff changeset
   146
if ( !defined('ENANO_NO_PLUGINS') )
500
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   147
{
695
6bd7215c718b Added ENANO_NO_PLUGINS optional switch to common_cli.
Dan
parents: 685
diff changeset
   148
  foreach ( $plugins->load_list as $f )
6bd7215c718b Added ENANO_NO_PLUGINS optional switch to common_cli.
Dan
parents: 685
diff changeset
   149
  {
6bd7215c718b Added ENANO_NO_PLUGINS optional switch to common_cli.
Dan
parents: 685
diff changeset
   150
    if ( file_exists(ENANO_ROOT . '/plugins/' . $f) )
6bd7215c718b Added ENANO_NO_PLUGINS optional switch to common_cli.
Dan
parents: 685
diff changeset
   151
      include_once ENANO_ROOT . '/plugins/' . $f;
6bd7215c718b Added ENANO_NO_PLUGINS optional switch to common_cli.
Dan
parents: 685
diff changeset
   152
  }
500
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   153
}
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   154
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   155
profiler_log('Loaded plugins');
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   156
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   157
// Three fifths of the Enano API gets the breath of life right here.
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   158
$session = new sessionManager();
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   159
$paths = new pathManager();
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   160
$template = new template();
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   161
$email = new EmailEncryptor();
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   162
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   163
profiler_log('Instanciated important singletons');
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   164
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   165
// We've got the five main objects - flick on the switch so if a problem occurs, we can have a "friendly" UI
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   166
define('ENANO_BASE_CLASSES_INITIALIZED', '');
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   167
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   168
// From here on out, none of this functionality is needed during the installer stage.
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   169
// Once $paths->init() is called, we could be redirected to the main page, so we don't want
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   170
// that if the installer's running. Don't just go and define IN_ENANO_INSTALL from your
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   171
// script though, because that will make the DBAL look in the wrong place for the config file.
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   172
if ( !defined('IN_ENANO_INSTALL') )
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   173
{
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   174
  // And here you have it, the de facto way to place a hook. Plugins can place hooks and hook
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   175
  // into other plugins. You just never know.
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   176
  $code = $plugins->setHook('base_classes_initted');
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   177
  foreach ( $code as $cmd )
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   178
  {
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   179
    eval($cmd);
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   180
  }
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   181
  
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   182
  profiler_log('Finished base_classes_initted hook');
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   183
  
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   184
  // For special and administration pages, sometimes there is a "preloader" function that must be run
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   185
  // before the session manager and/or path manager get the init signal. Call it here.  
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   186
  $p = RenderMan::strToPageId($paths->get_pageid_from_url());
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   187
  if( ( $p[1] == 'Admin' || $p[1] == 'Special' ) && function_exists('page_'.$p[1].'_'.$p[0].'_preloader'))
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   188
  {
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   189
    @call_user_func('page_'.$p[1].'_'.$p[0].'_preloader');
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   190
  }
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   191
  
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   192
  profiler_log('Checked for preloader');
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   193
  
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   194
  // One quick security check...
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   195
  if ( isset($_SERVER['REMOTE_ADDR']) )
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   196
  {
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   197
    grinding_halt('REMOTE_ADDR detected', 'Detected a REMOTE_ADDR, this should not happen in CLI mode.');
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   198
  }
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   199
  $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   200
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   201
  // All checks passed! Start the main components up.  
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   202
  $session->start();
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   203
  
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   204
  // This is where plugins will want to add pages from 1.1.x on out. You can still add
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   205
  // pages at base_classes_initted but the titles won't be localized. This is because
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   206
  // the session manager has to be started before localization will work in the user's
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   207
  // preferred language.
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   208
  $code = $plugins->setHook('session_started');
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   209
  foreach ( $code as $cmd )
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   210
  {
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   211
    eval($cmd);
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   212
  }
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   213
  
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   214
  profiler_log('Ran session_started hook');
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   215
  
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   216
  $paths->init();
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   217
  
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   218
  // We're ready for whatever life throws us now.
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   219
  define('ENANO_MAINSTREAM', '');
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   220
  
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   221
  // If the site is disabled, bail out, unless we're trying to log in or administer the site
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   222
  if(getConfig('site_disabled') == '1' && $session->user_level < USER_LEVEL_ADMIN)
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   223
  {
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   224
    if ( $paths->namespace == 'Admin' || ( $paths->namespace == 'Special' && ( $paths->page_id == 'CSS' || $paths->page_id == 'Administration' || $paths->page_id == 'Login' ) ) )
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   225
    {
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   226
      // do nothing; allow execution to continue
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   227
    }
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   228
    else
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   229
    {
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   230
      if(!$n = getConfig('site_disabled_notice')) 
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   231
      {
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   232
        $n = 'The administrator has disabled the site. Please check back later.';
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   233
      }
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   234
      
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   235
      $text = RenderMan::render($n) . '
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   236
      <div class="info-box">
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   237
        If you have an administrative account, you may <a href="'.makeUrlNS('Special', 'Login').'">log in</a> to the site.
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   238
      </div>';
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   239
      $paths->wiki_mode = 0;
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   240
      die_semicritical('Site disabled', $text);
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   241
    }
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   242
  }
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   243
  else if ( getConfig('site_disabled') == '1' && $session->user_level >= USER_LEVEL_ADMIN )
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   244
  {
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   245
    // If the site is disabled but the user has admin rights, allow browsing
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   246
    // and stuff, but display the orange box notifying the admin.
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   247
    $template->site_disabled = true;
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   248
  }
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   249
  
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   250
  // At this point all of Enano is fully initialized and running and you're ready to do whatever you want.
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   251
  $code = $plugins->setHook('common_post');
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   252
  foreach ( $code as $cmd )
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   253
  {
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   254
    eval($cmd);
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   255
  }
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   256
  
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   257
  profiler_log('Ran disabled-site checks and common_post');
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   258
  
541
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   259
  load_rank_data();
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   260
  
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   261
  profiler_log('Loaded user rank data');
acb7e23b6ffa Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents: 536
diff changeset
   262
  
500
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   263
  if ( isset($_GET['noheaders']) )
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   264
    $template->no_headers = true;
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   265
}
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   266
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   267
profiler_log('common finished');
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   268
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   269
// That's the end. Enano should be loaded now :-)
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   270
455277559782 Added basic CLI support for the Enano API. Loads automatically, just include common.php as normal. REVISION 500!!! :-D
Dan
parents:
diff changeset
   271
?>