Several optimization changes including getting rid of a few eval()s. Added placeholder functions for the theme manager, which should be working now
--- a/includes/clientside/static/enano-lib-basic.js Thu Jun 26 21:36:32 2008 -0400
+++ b/includes/clientside/static/enano-lib-basic.js Mon Jun 30 17:20:02 2008 -0400
@@ -460,7 +460,10 @@
enlighten: 'fadefilter.js',
autofill_onload: 'autofill.js',
password_score: 'pwstrength.js',
- password_score_field: 'pwstrength.js'
+ password_score_field: 'pwstrength.js',
+ ajaxEditTheme: 'theme-manager.js',
+ ajaxToggleSystemThemes: 'theme-manager.js',
+ ajaxInstallTheme: 'theme-manager.js',
};
var placeholder_instances = {};
--- a/includes/common.php Thu Jun 26 21:36:32 2008 -0400
+++ b/includes/common.php Mon Jun 30 17:20:02 2008 -0400
@@ -328,6 +328,8 @@
// Obtain list of plugins
$plugins->loadAll();
+profiler_log('Fetched plugin list');
+
global $plugins;
// Load plugins from common because we can't give plugins full abilities in object context
--- a/includes/lang.php Thu Jun 26 21:36:32 2008 -0400
+++ b/includes/lang.php Mon Jun 30 17:20:02 2008 -0400
@@ -168,16 +168,11 @@
{
global $db, $session, $paths, $template, $plugins; // Common objects
- // We're using eval() here because it makes handling scope easier.
-
if ( !file_exists($file) )
$db->_die('lang.php - requested cache file doesn\'t exist');
- $contents = file_get_contents($file);
- $contents = preg_replace('/([\s]*)<\?php/', '', $contents);
-
- @eval($contents);
-
+ @include($file);
+
if ( !isset($lang_cache) || ( isset($lang_cache) && !is_array($lang_cache) ) )
$db->_die('lang.php - the cache file is invalid (didn\'t set $lang_cache as an array)');
@@ -576,7 +571,7 @@
* @return string
*/
- function var_export_string($val)
+ static function var_export_string($val)
{
ob_start();
var_export($val);
@@ -635,6 +630,7 @@
{
return $string_id;
}
+ profiler_log('Language(' . $this->lang_code . '): refetching due to missing string: ' . $string_id);
$this->fetch();
if ( isset($this->strings[$category]) && isset($this->strings[$category][$string_name]) )
{
--- a/includes/paths.php Thu Jun 26 21:36:32 2008 -0400
+++ b/includes/paths.php Mon Jun 30 17:20:02 2008 -0400
@@ -398,9 +398,10 @@
{
eval($cmd);
}
-
+
+ profiler_log('Paths and CMS core initted');
$session->init_permissions();
- profiler_log('Paths and CMS core initted');
+ profiler_log('Default ACL set retrieved');
}
function add_page($flags)
@@ -415,7 +416,7 @@
$flags['name'] = $lang->get($flags['name']);
}
- $pages_len = sizeof($this->pages)/2;
+ $pages_len = sizeof($this->pages) / 2;
$this->pages[$pages_len] = $flags;
$this->pages[$flags['urlname']] =& $this->pages[$pages_len];
}
--- a/includes/plugins.php Thu Jun 26 21:36:32 2008 -0400
+++ b/includes/plugins.php Mon Jun 30 17:20:02 2008 -0400
@@ -64,6 +64,7 @@
function loadAll()
{
global $db, $session, $paths, $template, $plugins; // Common objects
+ $GLOBALS['plugins_cache'] = array();
// if we're in an upgrade, just skip this step
if ( defined('IN_ENANO_UPGRADE') )
@@ -251,15 +252,28 @@
* Reads all plugins in the filesystem and cross-references them with the database, providing a very complete summary of plugins
* on the site.
* @param array If specified, will restrict scanned files to this list. Defaults to null, which means all PHP files will be scanned.
+ * @param bool If true, allows using cached information. Defaults to true.
* @return array
*/
- function get_plugin_list($restrict = null)
+ function get_plugin_list($restrict = null, $use_cache = true)
{
global $db, $session, $paths, $template, $plugins; // Common objects
// Scan all plugins
$plugin_list = array();
+ $ta = 0;
+ // won't load twice (failsafe automatic skip)
+ $this->load_plugins_cache();
+ if ( $use_cache )
+ {
+ global $plugins_cache;
+ }
+ else
+ {
+ // blank array - effectively skips importing the cache
+ $plugins_cache = array();
+ }
if ( $dirh = @opendir( ENANO_ROOT . '/plugins' ) )
{
@@ -272,57 +286,69 @@
if ( !in_array($dh, $restrict) )
continue;
+ // it's a PHP file, attempt to read metadata
$fullpath = ENANO_ROOT . "/plugins/$dh";
- // it's a PHP file, attempt to read metadata
- // pass 1: try to read a !info block
- $blockdata = $this->parse_plugin_blocks($fullpath, 'info');
- if ( empty($blockdata) )
+ // first can we use cached info?
+ if ( isset($plugins_cache[$dh]) && $plugins_cache[$dh]['file md5'] === $this->md5_header($fullpath) )
{
- // no !info block, check for old header
- $fh = @fopen($fullpath, 'r');
- if ( !$fh )
- // can't read, bail out
- continue;
- $plugin_data = array();
- for ( $i = 0; $i < 8; $i++ )
- {
- $plugin_data[] = @fgets($fh, 8096);
- }
- // close our file handle
- fclose($fh);
- // is the header correct?
- if ( trim($plugin_data[0]) != '<?php' || trim($plugin_data[1]) != '/*' )
- {
- // nope. get out.
- continue;
- }
- // parse all the variables
- $plugin_meta = array();
- for ( $i = 2; $i <= 7; $i++ )
- {
- if ( !preg_match('/^([A-z0-9 ]+?): (.+?)$/', trim($plugin_data[$i]), $match) )
- continue 2;
- $plugin_meta[ strtolower($match[1]) ] = $match[2];
- }
+ $plugin_meta = $plugins_cache[$dh];
}
else
{
- // parse JSON block
- $plugin_data =& $blockdata[0]['value'];
- $plugin_data = enano_clean_json(enano_trim_json($plugin_data));
- try
+ // the cache is out of date if we reached here -- regenerate
+ if ( $use_cache )
+ $this->generate_plugins_cache();
+
+ // pass 1: try to read a !info block
+ $blockdata = $this->parse_plugin_blocks($fullpath, 'info');
+ if ( empty($blockdata) )
{
- $plugin_meta_uc = enano_json_decode($plugin_data);
+ // no !info block, check for old header
+ $fh = @fopen($fullpath, 'r');
+ if ( !$fh )
+ // can't read, bail out
+ continue;
+ $plugin_data = array();
+ for ( $i = 0; $i < 8; $i++ )
+ {
+ $plugin_data[] = @fgets($fh, 8096);
+ }
+ // close our file handle
+ fclose($fh);
+ // is the header correct?
+ if ( trim($plugin_data[0]) != '<?php' || trim($plugin_data[1]) != '/*' )
+ {
+ // nope. get out.
+ continue;
+ }
+ // parse all the variables
+ $plugin_meta = array();
+ for ( $i = 2; $i <= 7; $i++ )
+ {
+ if ( !preg_match('/^([A-z0-9 ]+?): (.+?)$/', trim($plugin_data[$i]), $match) )
+ continue 2;
+ $plugin_meta[ strtolower($match[1]) ] = $match[2];
+ }
}
- catch ( Exception $e )
+ else
{
- continue;
- }
- // convert all the keys to lowercase
- $plugin_meta = array();
- foreach ( $plugin_meta_uc as $key => $value )
- {
- $plugin_meta[ strtolower($key) ] = $value;
+ // parse JSON block
+ $plugin_data =& $blockdata[0]['value'];
+ $plugin_data = enano_clean_json(enano_trim_json($plugin_data));
+ try
+ {
+ $plugin_meta_uc = enano_json_decode($plugin_data);
+ }
+ catch ( Exception $e )
+ {
+ continue;
+ }
+ // convert all the keys to lowercase
+ $plugin_meta = array();
+ foreach ( $plugin_meta_uc as $key => $value )
+ {
+ $plugin_meta[ strtolower($key) ] = $value;
+ }
}
}
if ( !isset($plugin_meta) || !is_array(@$plugin_meta) )
@@ -382,6 +408,92 @@
}
/**
+ * Attempts to cache plugin information in a file to speed fetching.
+ */
+
+ function generate_plugins_cache()
+ {
+ if ( getConfig('cache_thumbs') != '1' )
+ return;
+
+ // fetch the most current info
+ $plugin_info = $this->get_plugin_list(null, false);
+ foreach ( $plugin_info as $plugin => &$info )
+ {
+ $info['file md5'] = $this->md5_header(ENANO_ROOT . "/plugins/$plugin");
+ }
+
+ $this->update_plugins_cache($plugin_info);
+ $GLOBALS['plugins_cache'] = $plugin_info;
+ @define('ENANO_PLUGINS_CACHE_LOADED', true);
+ }
+
+ /**
+ * Writes an information array to the cache file.
+ * @param array
+ * @access private
+ */
+
+ function update_plugins_cache($plugin_info)
+ {
+ $plugin_info = Language::var_export_string($plugin_info);
+
+ $file = ENANO_ROOT . '/cache/cache_plugins.php';
+ $fh = @fopen($file, 'w');
+ if ( !$fh )
+ // can't open for writing
+ return false;
+
+ $contents = <<<EOF
+<?php
+/**
+ * Cache of plugin files. Automatically generated, any modifications will soon be lost
+ */
+
+@define('ENANO_PLUGINS_CACHE_LOADED', true);
+\$GLOBALS['plugins_cache'] = $plugin_info;
+
+EOF;
+ fwrite($fh, $contents);
+ fclose($fh);
+ }
+
+ /**
+ * Loads the plugins cache if any.
+ */
+
+ function load_plugins_cache()
+ {
+ if ( file_exists(ENANO_ROOT . '/cache/cache_plugins.php') && !defined('ENANO_PLUGINS_CACHE_LOADED') )
+ {
+ require(ENANO_ROOT . '/cache/cache_plugins.php');
+ }
+ }
+
+ /**
+ * Calculates the MD5 sum of the first 10 lines of a file. Useful for caching plugin header information.
+ * @param string File
+ * @return string
+ */
+
+ function md5_header($file)
+ {
+ $fh = @fopen($file, 'r');
+ if ( !$fh )
+ return false;
+ $i = 0;
+ $h = '';
+ while ( $i < 10 )
+ {
+ $line = fgets($fh, 8096);
+ $h .= $line . "\n";
+ $i++;
+ }
+ fclose($fh);
+ return md5($h);
+ }
+
+ /**
* Installs a plugin.
* @param string Filename of plugin.
* @param array The list of plugins as output by pluginLoader::get_plugin_list(). If not passed, the function is called, possibly wasting time.
--- a/includes/sessions.php Thu Jun 26 21:36:32 2008 -0400
+++ b/includes/sessions.php Mon Jun 30 17:20:02 2008 -0400
@@ -419,9 +419,9 @@
if($this->started) return;
$this->started = true;
$user = false;
- if(isset($_COOKIE['sid']))
+ if ( isset($_COOKIE['sid']) )
{
- if($this->compat)
+ if ( $this->compat )
{
$userdata = $this->compat_validate_session($_COOKIE['sid']);
}
@@ -429,7 +429,7 @@
{
$userdata = $this->validate_session($_COOKIE['sid']);
}
- if(is_array($userdata))
+ if ( is_array($userdata) )
{
$data = RenderMan::strToPageID($paths->get_pageid_from_url());
@@ -598,6 +598,7 @@
{
die('No group info');
}
+ profiler_log('Fetched group memberships');
}
// make sure we aren't banned
@@ -615,7 +616,7 @@
// setup theme ACLs
$template->process_theme_acls();
- profiler_log('Sessions started');
+ profiler_log('Sessions started. Banlist and theme ACLs initialized');
}
# Logins
@@ -1280,6 +1281,7 @@
}
$keyhash = md5($key);
$salt = $db->escape($keydata[3]);
+ profiler_log("SessionManager: checking session: " . sha1($key) . ": decrypted session key to $decrypted_key");
// using a normal call to $db->sql_query to avoid failing on errors here
$query = $db->sql_query('SELECT u.user_id AS uid,u.username,u.password,u.email,u.real_name,u.user_level,u.theme,u.style,u.signature,' . "\n"
. ' u.reg_time,u.account_active,u.activation_key,u.user_lang,u.user_title,k.source_ip,k.time,k.auth_level,COUNT(p.message_id) AS num_pms,' . "\n"
@@ -1311,6 +1313,7 @@
return false;
}
$row = $db->fetchrow();
+ profiler_log("SessionManager: checking session: " . sha1($key) . ": selected and fetched results");
$row['user_id'] =& $row['uid'];
$ip = $_SERVER['REMOTE_ADDR'];
if($row['auth_level'] > $row['user_level'])
--- a/includes/template.php Thu Jun 26 21:36:32 2008 -0400
+++ b/includes/template.php Mon Jun 30 17:20:02 2008 -0400
@@ -362,8 +362,6 @@
global $email;
global $lang;
- profiler_log("template: starting var init");
-
if(!$this->theme || !$this->style)
{
$this->load_theme();
@@ -413,6 +411,8 @@
return true;
}
+ profiler_log("template: starting var init");
+
$this->initted_to_page_id = $local_page_id;
$this->initted_to_namespace = $local_namespace;
$this->initted_to_theme = array(
@@ -562,6 +562,12 @@
}
$ns =& $this->namespace_string;
+ //
+ // PAGE TOOLBAR (on-page controls/actions)
+ //
+
+ profiler_log('template: var init: finished initial setup, starting toolbar');
+
// Initialize the toolbar
$tb = '';
@@ -938,16 +944,34 @@
$tb .= $button->run();
}
+ //
+ // OTHER SWITCHES
+ //
+
+ profiler_log('template: var init: finshed toolbar, starting other switches');
+
$is_opera = (isset($_SERVER['HTTP_USER_AGENT']) && strstr($_SERVER['HTTP_USER_AGENT'], 'Opera')) ? true : false;
$this->tpl_bool = Array(
- 'auth_admin'=>$session->user_level >= USER_LEVEL_ADMIN ? true : false,
- 'user_logged_in'=>$session->user_logged_in,
- 'opera'=>$is_opera,
+ 'auth_admin' => $session->user_level >= USER_LEVEL_ADMIN ? true : false,
+ 'user_logged_in' => $session->user_logged_in,
+ 'opera' => $is_opera,
);
- if($session->sid_super) { $ash = '&auth='.$session->sid_super; $asq = "?auth=".$session->sid_super; $asa = "&auth=".$session->sid_super; $as2 = htmlspecialchars(urlSeparator).'auth='.$session->sid_super; }
- else { $asq=''; $asa=''; $as2 = ''; $ash = ''; }
+ if ( $session->sid_super )
+ {
+ $ash = '&auth=' . $session->sid_super;
+ $asq = "?auth=" . $session->sid_super;
+ $asa = "&auth=" . $session->sid_super;
+ $as2 = htmlspecialchars(urlSeparator) . 'auth='.$session->sid_super;
+ }
+ else
+ {
+ $asq = '';
+ $asa = '';
+ $as2 = '';
+ $ash = '';
+ }
$code = $plugins->setHook('compile_template');
foreach ( $code as $cmd )
@@ -956,25 +980,25 @@
}
// Some additional sidebar processing
- if($this->sidebar_extra != '') {
+ if ( $this->sidebar_extra != '' )
+ {
$se = $this->sidebar_extra;
$parser = $this->makeParserText($tplvars['sidebar_section_raw']);
- $parser->assign_vars(Array('TITLE'=>'Links','CONTENT'=>$se));
+ $parser->assign_vars(array(
+ 'TITLE' => 'Links', // FIXME: l10n
+ 'CONTENT' => $se
+ ));
+
$this->sidebar_extra = $parser->run();
}
- $this->sidebar_extra = $this->sidebar_extra.$this->sidebar_widgets;
+ $this->sidebar_extra = $this->sidebar_extra . $this->sidebar_widgets;
$this->tpl_bool['fixed_menus'] = false;
- /* if($this->sidebar_extra == '') $this->tpl_bool['right_sidebar'] = false;
- else */ $this->tpl_bool['right_sidebar'] = true;
-
+ $this->tpl_bool['right_sidebar'] = true;
$this->tpl_bool['auth_rename'] = ( $local_page_exists && $session->check_acl_scope('rename', $local_namespace) && ( $perms->get_permissions('rename') && ( $paths->page_protected && $perms->get_permissions('even_when_protected') || !$paths->page_protected ) ));
-
$this->tpl_bool['enable_uploads'] = ( getConfig('enable_uploads') == '1' && $session->get_permissions('upload_files') ) ? true : false;
-
$this->tpl_bool['stupid_mode'] = false;
-
$this->tpl_bool['in_admin'] = ( ( $local_page_id == 'Administration' && $local_namespace == 'Special' ) || $local_namespace == 'Admin' );
$p = ( isset($_GET['printable']) ) ? '/printable' : '';
@@ -1019,6 +1043,8 @@
$admin_link = $parser->run();
+ profiler_log('template: var init: finished sidebar/misc processing, starting dynamic vars and finalization');
+
$SID = ($session->sid_super) ? $session->sid_super : '';
$urlname_clean = str_replace('\'', '\\\'', str_replace('\\', '\\\\', dirtify_page_id($local_fullpage)));
@@ -1084,6 +1110,8 @@
$js_dynamic .= "namespace_list['{$k}'] = '$c';";
}
$js_dynamic .= "\n //]]>\n </script>";
+
+ profiler_log('template: var init: finished JS dynamic vars and assigning final var set');
$tpl_strings = Array(
'PAGE_NAME'=>htmlspecialchars($local_cdata['name']),
@@ -1126,17 +1154,26 @@
$this->assign_vars($tpl_strings, true);
+ //
+ // COMPILE THE SIDEBAR
+ //
+
+ // This is done after the big assign_vars() so that sidebar code has access to the newly assigned variables
+
+ profiler_log('template: var init: finished final var set, executing and applying sidebar templates');
+
list($this->tpl_strings['SIDEBAR_LEFT'], $this->tpl_strings['SIDEBAR_RIGHT'], $min) = $this->fetch_sidebar();
$this->tpl_bool['sidebar_left'] = ( $this->tpl_strings['SIDEBAR_LEFT'] != $min) ? true : false;
$this->tpl_bool['sidebar_right'] = ( $this->tpl_strings['SIDEBAR_RIGHT'] != $min) ? true : false;
$this->tpl_bool['right_sidebar'] = $this->tpl_bool['sidebar_right']; // backward compatibility
- // and finally one that needs to be symlinked...
+ // and finally one string value that needs to be symlinked...
if ( !isset($this->tpl_strings['ADDITIONAL_HEADERS']) )
{
$this->tpl_strings['ADDITIONAL_HEADERS'] =& $this->additional_headers;
}
+ // done!
$code = $plugins->setHook('template_var_init_end');
foreach ( $code as $cmd )
{
@@ -2133,10 +2170,9 @@
*/
// This is a workaround for what seems like a PCRE bug
- while ( ( profiler_log("[template] compiler matchout start") || true ) && preg_match_all($regexp, $text, $matches) )
+ while ( preg_match_all($regexp, $text, $matches) )
{
- profiler_log("[template] compiler core loop start");
for ( $i = 0; $i < count($matches[0]); $i++ )
{
$start_tag =& $matches[1][$i];
@@ -2197,8 +2233,6 @@
}
}
- profiler_log("[template] compiler core loop end");
-
// For debugging ;-)
// die("<pre><?php\n" . htmlspecialchars($text."\n\n".print_r($matches,true)) . "\n\n?></pre>");
@@ -2233,8 +2267,6 @@
// echo('<pre>' . htmlspecialchars($text) . '</pre>');
- profiler_log("[template] compiler subst end");
-
return $text;
}
--- a/install/install.php Thu Jun 26 21:36:32 2008 -0400
+++ b/install/install.php Mon Jun 30 17:20:02 2008 -0400
@@ -18,7 +18,7 @@
define('IN_ENANO', 1);
// DEFINE THIS BEFORE RELEASE!
-// define('ENANO_DANGEROUS', 1);
+define('ENANO_DANGEROUS', 1);
require_once('includes/common.php');
@ini_set('display_errors', 'on');
--- a/language/english/tools.json Thu Jun 26 21:36:32 2008 -0400
+++ b/language/english/tools.json Mon Jun 30 17:20:02 2008 -0400
@@ -39,6 +39,7 @@
log_out: 'Log out',
register: 'Register',
preferences: 'Edit Profile',
+ autofill: 'Javascript suggestion servlet',
contributions: 'User contributions',
change_theme: 'Change my preferred theme',
activate_account: 'Activate user account',
--- a/plugins/PrivateMessages.php Thu Jun 26 21:36:32 2008 -0400
+++ b/plugins/PrivateMessages.php Mon Jun 30 17:20:02 2008 -0400
@@ -24,15 +24,18 @@
global $db, $session, $paths, $template, $plugins; // Common objects
-$plugins->attachHook('session_started', '
+$plugins->attachHook('session_started', 'PrivateMessages_paths_init();');
+
+function PrivateMessages_paths_init()
+{
global $paths;
- $paths->add_page(Array(
- \'name\'=>\'specialpage_private_messages\',
- \'urlname\'=>\'PrivateMessages\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
- ');
+ $paths->add_page(Array(
+ 'name'=>'specialpage_private_messages',
+ 'urlname'=>'PrivateMessages',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+}
function page_Special_PrivateMessages()
{
--- a/plugins/SpecialAdmin.php Thu Jun 26 21:36:32 2008 -0400
+++ b/plugins/SpecialAdmin.php Mon Jun 30 17:20:02 2008 -0400
@@ -24,34 +24,49 @@
global $db, $session, $paths, $template, $plugins; // Common objects
-$plugins->attachHook('session_started', '
+$plugins->attachHook('session_started', 'SpecialAdmin_paths_init();');
+
+function SpecialAdmin_paths_init()
+{
global $paths;
- $paths->add_page(Array(
- \'name\'=>\'specialpage_administration\',
- \'urlname\'=>\'Administration\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
-
- $paths->add_page(Array(
- \'name\'=>\'specialpage_manage_sidebar\',
- \'urlname\'=>\'EditSidebar\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
- ');
+ $paths->add_page(Array(
+ 'name'=>'specialpage_administration',
+ 'urlname'=>'Administration',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+
+ $paths->add_page(Array(
+ 'name'=>'specialpage_manage_sidebar',
+ 'urlname'=>'EditSidebar',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+}
+
+$plugins->attachHook('common_post', 'SpecialAdmin_include();');
-// Admin pages that were too enormous to be in this file were split off into the plugins/admin/ directory in 1.0.1
-require(ENANO_ROOT . '/plugins/admin/PageManager.php');
-require(ENANO_ROOT . '/plugins/admin/PageEditor.php');
-require(ENANO_ROOT . '/plugins/admin/PageGroups.php');
-require(ENANO_ROOT . '/plugins/admin/GroupManager.php');
-require(ENANO_ROOT . '/plugins/admin/SecurityLog.php');
-require(ENANO_ROOT . '/plugins/admin/UserManager.php');
-require(ENANO_ROOT . '/plugins/admin/UserRanks.php');
-require(ENANO_ROOT . '/plugins/admin/LangManager.php');
-require(ENANO_ROOT . '/plugins/admin/ThemeManager.php');
-require(ENANO_ROOT . '/plugins/admin/PluginManager.php');
+function SpecialAdmin_include()
+{
+ global $paths;
+
+ // Admin pages that were too enormous to be in this file were split off into the plugins/admin/ directory in 1.0.1.
+ // Only load these files if we're looking to load the admin panel
+ list($pid, $ns) = RenderMan::strToPageID($paths->get_pageid_from_url());
+ if ( $ns == 'Admin' )
+ {
+ require(ENANO_ROOT . '/plugins/admin/PageManager.php');
+ require(ENANO_ROOT . '/plugins/admin/PageEditor.php');
+ require(ENANO_ROOT . '/plugins/admin/PageGroups.php');
+ require(ENANO_ROOT . '/plugins/admin/GroupManager.php');
+ require(ENANO_ROOT . '/plugins/admin/SecurityLog.php');
+ require(ENANO_ROOT . '/plugins/admin/UserManager.php');
+ require(ENANO_ROOT . '/plugins/admin/UserRanks.php');
+ require(ENANO_ROOT . '/plugins/admin/LangManager.php');
+ require(ENANO_ROOT . '/plugins/admin/ThemeManager.php');
+ require(ENANO_ROOT . '/plugins/admin/PluginManager.php');
+ }
+}
// For convenience and nothing more.
function acp_start_form()
--- a/plugins/SpecialCSS.php Thu Jun 26 21:36:32 2008 -0400
+++ b/plugins/SpecialCSS.php Mon Jun 30 17:20:02 2008 -0400
@@ -24,24 +24,31 @@
global $db, $session, $paths, $template, $plugins; // Common objects
-$plugins->attachHook('session_started', '
+$plugins->attachHook('session_started', 'SpecialCSS_paths_init();');
+
+function SpecialCSS_paths_init()
+{
global $paths;
- $paths->add_page(Array(
- \'name\'=>\'specialpage_css\',
- \'urlname\'=>\'CSS\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>0,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
- ');
+ $paths->add_page(Array(
+ 'name'=>'specialpage_css',
+ 'urlname'=>'CSS',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>0,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+}
// function names are IMPORTANT!!! The name pattern is: page_<namespace ID>_<page URLname, without namespace>
-function page_Special_CSS() {
+function page_Special_CSS()
+{
global $db, $session, $paths, $template, $plugins; // Common objects
header('Content-type: text/css');
- if(isset($_GET['printable']) || $paths->getParam(0) == 'printable') {
+ if ( isset($_GET['printable']) || $paths->getParam(0) == 'printable' )
+ {
echo $template->get_css('_printable.css');
- } else {
+ }
+ else
+ {
echo $template->get_css();
}
}
--- a/plugins/SpecialGroups.php Thu Jun 26 21:36:32 2008 -0400
+++ b/plugins/SpecialGroups.php Mon Jun 30 17:20:02 2008 -0400
@@ -22,15 +22,18 @@
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
*/
-$plugins->attachHook('session_started', '
+$plugins->attachHook('session_started', 'SpecialGroups_paths_init();');
+
+function SpecialGroups_paths_init()
+{
global $paths;
- $paths->add_page(Array(
- \'name\'=>\'specialpage_groupcp\',
- \'urlname\'=>\'Usergroups\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
- ');
+ $paths->add_page(Array(
+ 'name'=>'specialpage_groupcp',
+ 'urlname'=>'Usergroups',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+}
function page_Special_Usergroups()
{
--- a/plugins/SpecialPageFuncs.php Thu Jun 26 21:36:32 2008 -0400
+++ b/plugins/SpecialPageFuncs.php Mon Jun 30 17:20:02 2008 -0400
@@ -24,57 +24,60 @@
global $db, $session, $paths, $template, $plugins; // Common objects
-$plugins->attachHook('session_started', '
+$plugins->attachHook('session_started', 'SpecialPageFuncs_paths_init();');
+
+function SpecialPageFuncs_paths_init()
+{
global $paths;
- $paths->add_page(Array(
- \'name\'=>\'specialpage_create_page\',
- \'urlname\'=>\'CreatePage\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
-
- $paths->add_page(Array(
- \'name\'=>\'specialpage_all_pages\',
- \'urlname\'=>\'AllPages\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
-
- $paths->add_page(Array(
- \'name\'=>\'specialpage_special_pages\',
- \'urlname\'=>\'SpecialPages\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
-
- $paths->add_page(Array(
- \'name\'=>\'specialpage_about_enano\',
- \'urlname\'=>\'About_Enano\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
-
- $paths->add_page(Array(
- \'name\'=>\'specialpage_gnu_gpl\',
- \'urlname\'=>\'GNU_General_Public_License\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
-
- $paths->add_page(Array(
- \'name\'=>\'specialpage_tag_cloud\',
- \'urlname\'=>\'TagCloud\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
-
- $paths->add_page(Array(
- \'name\'=>\'specialpage_autofill\',
- \'urlname\'=>\'Autofill\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
- ');
+ $paths->add_page(Array(
+ 'name'=>'specialpage_create_page',
+ 'urlname'=>'CreatePage',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+
+ $paths->add_page(Array(
+ 'name'=>'specialpage_all_pages',
+ 'urlname'=>'AllPages',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+
+ $paths->add_page(Array(
+ 'name'=>'specialpage_special_pages',
+ 'urlname'=>'SpecialPages',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+
+ $paths->add_page(Array(
+ 'name'=>'specialpage_about_enano',
+ 'urlname'=>'About_Enano',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+
+ $paths->add_page(Array(
+ 'name'=>'specialpage_gnu_gpl',
+ 'urlname'=>'GNU_General_Public_License',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+
+ $paths->add_page(Array(
+ 'name'=>'specialpage_tag_cloud',
+ 'urlname'=>'TagCloud',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+
+ $paths->add_page(Array(
+ 'name'=>'specialpage_autofill',
+ 'urlname'=>'Autofill',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+}
// function names are IMPORTANT!!! The name pattern is: page_<namespace ID>_<page URLname, without namespace>
--- a/plugins/SpecialRecentChanges.php Thu Jun 26 21:36:32 2008 -0400
+++ b/plugins/SpecialRecentChanges.php Mon Jun 30 17:20:02 2008 -0400
@@ -24,15 +24,18 @@
global $db, $session, $paths, $template, $plugins; // Common objects
-$plugins->attachHook('session_started', '
+$plugins->attachHook('session_started', 'SpecialRecentChanges_paths_init();');
+
+function SpecialRecentChanges_paths_init()
+{
global $paths;
- $paths->add_page(Array(
- \'name\'=>\'specialpage_recent_changes\',
- \'urlname\'=>\'RecentChanges\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
- ');
+ $paths->add_page(Array(
+ 'name'=>'specialpage_recent_changes',
+ 'urlname'=>'RecentChanges',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+}
function page_Special_RecentChanges()
{
--- a/plugins/SpecialSearch.php Thu Jun 26 21:36:32 2008 -0400
+++ b/plugins/SpecialSearch.php Mon Jun 30 17:20:02 2008 -0400
@@ -22,22 +22,25 @@
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
*/
-$plugins->attachHook('session_started', '
+$plugins->attachHook('session_started', 'SpecialSearch_paths_init();');
+
+function SpecialSearch_paths_init()
+{
global $paths;
- $paths->add_page(Array(
- \'name\'=>\'specialpage_search_rebuild\',
- \'urlname\'=>\'SearchRebuild\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
-
- $paths->add_page(Array(
- \'name\'=>\'specialpage_search\',
- \'urlname\'=>\'Search\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
- ');
+ $paths->add_page(Array(
+ 'name'=>'specialpage_search_rebuild',
+ 'urlname'=>'SearchRebuild',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+
+ $paths->add_page(Array(
+ 'name'=>'specialpage_search',
+ 'urlname'=>'Search',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+}
function page_Special_SearchRebuild()
{
--- a/plugins/SpecialUpdownload.php Thu Jun 26 21:36:32 2008 -0400
+++ b/plugins/SpecialUpdownload.php Mon Jun 30 17:20:02 2008 -0400
@@ -25,22 +25,25 @@
global $db, $session, $paths, $template, $plugins; // Common objects
-$plugins->attachHook('session_started', '
+$plugins->attachHook('session_started', 'SpecialUpDownload_paths_init();');
+
+function SpecialUpDownload_paths_init()
+{
global $paths;
- $paths->add_page(Array(
- \'name\'=>\'specialpage_upload_file\',
- \'urlname\'=>\'UploadFile\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
-
- $paths->add_page(Array(
- \'name\'=>\'specialpage_download_file\',
- \'urlname\'=>\'DownloadFile\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
- ');
+ $paths->add_page(Array(
+ 'name'=>'specialpage_upload_file',
+ 'urlname'=>'UploadFile',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+
+ $paths->add_page(Array(
+ 'name'=>'specialpage_download_file',
+ 'urlname'=>'DownloadFile',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+}
function page_Special_UploadFile()
{
--- a/plugins/SpecialUserFuncs.php Thu Jun 26 21:36:32 2008 -0400
+++ b/plugins/SpecialUserFuncs.php Mon Jun 30 17:20:02 2008 -0400
@@ -24,90 +24,92 @@
global $db, $session, $paths, $template, $plugins; // Common objects
-$plugins->attachHook('session_started', '
+$plugins->attachHook('session_started', 'SpecialUserFuncs_paths_init();');
+
+function SpecialUserFuncs_paths_init()
+{
global $paths;
- $paths->add_page(Array(
- \'name\'=>\'specialpage_log_in\',
- \'urlname\'=>\'Login\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
- $paths->add_page(Array(
- \'name\'=>\'specialpage_log_out\',
- \'urlname\'=>\'Logout\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
- $paths->add_page(Array(
- \'name\'=>\'specialpage_register\',
- \'urlname\'=>\'Register\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
- $paths->add_page(Array(
- \'name\'=>\'specialpage_preferences\',
- \'urlname\'=>\'Preferences\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
-
- $paths->add_page(Array(
- \'name\'=>\'specialpage_contributions\',
- \'urlname\'=>\'Contributions\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
-
- $paths->add_page(Array(
- \'name\'=>\'specialpage_change_theme\',
- \'urlname\'=>\'ChangeStyle\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
+ $paths->add_page(Array(
+ 'name'=>'specialpage_log_in',
+ 'urlname'=>'Login',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+ $paths->add_page(Array(
+ 'name'=>'specialpage_log_out',
+ 'urlname'=>'Logout',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+ $paths->add_page(Array(
+ 'name'=>'specialpage_register',
+ 'urlname'=>'Register',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+ $paths->add_page(Array(
+ 'name'=>'specialpage_preferences',
+ 'urlname'=>'Preferences',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+
+ $paths->add_page(Array(
+ 'name'=>'specialpage_contributions',
+ 'urlname'=>'Contributions',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+
+ $paths->add_page(Array(
+ 'name'=>'specialpage_change_theme',
+ 'urlname'=>'ChangeStyle',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+
+ $paths->add_page(Array(
+ 'name'=>'specialpage_activate_account',
+ 'urlname'=>'ActivateAccount',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+
+ $paths->add_page(Array(
+ 'name'=>'specialpage_captcha',
+ 'urlname'=>'Captcha',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+
+ $paths->add_page(Array(
+ 'name'=>'specialpage_password_reset',
+ 'urlname'=>'PasswordReset',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+
+ $paths->add_page(Array(
+ 'name'=>'specialpage_member_list',
+ 'urlname'=>'Memberlist',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
- $paths->add_page(Array(
- \'name\'=>\'specialpage_activate_account\',
- \'urlname\'=>\'ActivateAccount\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
-
- $paths->add_page(Array(
- \'name\'=>\'specialpage_captcha\',
- \'urlname\'=>\'Captcha\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
-
- $paths->add_page(Array(
- \'name\'=>\'specialpage_password_reset\',
- \'urlname\'=>\'PasswordReset\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
+ $paths->add_page(Array(
+ 'name'=>'specialpage_language_export',
+ 'urlname'=>'LangExportJSON',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>0,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
- $paths->add_page(Array(
- \'name\'=>\'specialpage_member_list\',
- \'urlname\'=>\'Memberlist\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
-
- $paths->add_page(Array(
- \'name\'=>\'specialpage_language_export\',
- \'urlname\'=>\'LangExportJSON\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>0,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
-
- $paths->add_page(Array(
- \'name\'=>\'specialpage_avatar\',
- \'urlname\'=>\'Avatar\',
- \'namespace\'=>\'Special\',
- \'special\'=>0,\'visible\'=>0,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
- ));
-
- ');
+ $paths->add_page(Array(
+ 'name'=>'specialpage_avatar',
+ 'urlname'=>'Avatar',
+ 'namespace'=>'Special',
+ 'special'=>0,'visible'=>0,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
+ ));
+}
// function names are IMPORTANT!!! The name pattern is: page_<namespace ID>_<page URLname, without namespace>