# HG changeset patch # User Dan # Date 1200509749 18000 # Node ID 87e08a6e4fec6b7ba8205968c7022298fbbc36b2 # Parent 299a90e28abcc4299b5f6e9fe68eb700ea9d94c7 Welcome to the new Enano installer. Much distance still to be covered but the basics are there. diff -r 299a90e28abc -r 87e08a6e4fec images/about-powered-pgsql.png Binary file images/about-powered-pgsql.png has changed diff -r 299a90e28abc -r 87e08a6e4fec images/enano-artwork/README --- a/images/enano-artwork/README Thu Jan 03 18:39:19 2008 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -The images in this directory are copyright (C) 2007 Dan Fuhry. Except -as permitted by applicable law, they may not be used in any way other -than to promote the unmodified Enano CMS. You also may not modify and -then distribute the images in this directory, or distribute them sep- -arately from the Enano packages. The goal here is to establish a uni- -que identity for Enano through the use of a logo, and that identity -would be confused if this logo is used for unofficial Enano distros. - diff -r 299a90e28abc -r 87e08a6e4fec images/enano-artwork/installer-greeting-blue.png Binary file images/enano-artwork/installer-greeting-blue.png has changed diff -r 299a90e28abc -r 87e08a6e4fec images/enano-artwork/installer-greeting-green.png Binary file images/enano-artwork/installer-greeting-green.png has changed diff -r 299a90e28abc -r 87e08a6e4fec includes/clientside/static/editor.js --- a/includes/clientside/static/editor.js Thu Jan 03 18:39:19 2008 -0500 +++ b/includes/clientside/static/editor.js Wed Jan 16 13:55:49 2008 -0500 @@ -33,7 +33,7 @@ { if ( typeof(tinyMCE) == 'object' ) { - if ( !KILL_SWITCH ) + if ( !KILL_SWITCH && !DISABLE_MCE ) { tinyMCE.init(enano_tinymce_options); } diff -r 299a90e28abc -r 87e08a6e4fec includes/clientside/static/enano-lib-basic.js --- a/includes/clientside/static/enano-lib-basic.js Thu Jan 03 18:39:19 2008 -0500 +++ b/includes/clientside/static/enano-lib-basic.js Wed Jan 16 13:55:49 2008 -0500 @@ -63,6 +63,11 @@ // dummy tinyMCE object var tinyMCE = new Object(); +if ( typeof(DISABLE_MCE) == undefined ) +{ + var DISABLE_MCE = false; +} + // Obsolete JSON kill switch function disableJSONExts() { }; @@ -251,7 +256,7 @@ } var head = document.getElementsByTagName('head')[0]; -if ( !KILL_SWITCH ) +if ( !KILL_SWITCH && !DISABLE_MCE ) { var script = document.createElement('script'); script.type="text/javascript"; diff -r 299a90e28abc -r 87e08a6e4fec includes/clientside/static/misc.js --- a/includes/clientside/static/misc.js Thu Jan 03 18:39:19 2008 -0500 +++ b/includes/clientside/static/misc.js Wed Jan 16 13:55:49 2008 -0500 @@ -565,32 +565,8 @@ disableJSONExts(); - // - // Encryption test - // + var auth_enabled = aes_self_test(); - var str = ''; - for(i=0;i&\?\'"%\n\r/]+$', ''); + return ( username.match(regex) ) ? true : false; +} + +/** * Equivalent of PHP's time() * @return int */ diff -r 299a90e28abc -r 87e08a6e4fec includes/clientside/static/rijndael.js --- a/includes/clientside/static/rijndael.js Thu Jan 03 18:39:19 2008 -0500 +++ b/includes/clientside/static/rijndael.js Wed Jan 16 13:55:49 2008 -0500 @@ -577,3 +577,34 @@ return result; } +function aes_self_test() +{ + // + // Encryption test + // + + var str = ''; + for(i=0;iContinue'); + die('Session cookie cleared. Continue'); break; } } @@ -209,7 +203,7 @@ $db->free_result(); // Now that we have the config, check the Enano version. -if ( enano_version(false, true) != $version ) +if ( enano_version(false, true) != $version && !defined('IN_ENANO_UPGRADE') ) { grinding_halt('Version mismatch', '

It seems that the Enano release we\'re trying to run ('.$version.') is different from the version specified in your database ('.enano_version().'). Perhaps you need to upgrade?

'); } @@ -283,7 +277,6 @@ table_prefix.'privmsgs', table_prefix.'sidebar', table_prefix.'hits', - table_prefix.'search_index', table_prefix.'groups', table_prefix.'group_members', table_prefix.'acl', @@ -350,7 +343,10 @@ // All checks passed! Start the main components up. $session->start(); - // This is where plugins will want to add pages from 1.1.x on out. You can still add pages at base_classes_initted but the titles won't be localized. + // This is where plugins will want to add pages from 1.1.x on out. You can still add + // pages at base_classes_initted but the titles won't be localized. This is because + // the session manager has to be started before localization will work in the user's + // preferred language. $code = $plugins->setHook('session_started'); foreach ( $code as $cmd ) { diff -r 299a90e28abc -r 87e08a6e4fec includes/constants.php --- a/includes/constants.php Thu Jan 03 18:39:19 2008 -0500 +++ b/includes/constants.php Wed Jan 16 13:55:49 2008 -0500 @@ -137,6 +137,8 @@ // define('AES_BLOCKSIZE', AES_BITS); // } +// You probably don't want to change the block size because it will cause the Javascript test vectors to fail. Changing it doesn't +// significantly increase encryption strength either. define('AES_BLOCKSIZE', 128); /* diff -r 299a90e28abc -r 87e08a6e4fec includes/dbal.php --- a/includes/dbal.php Thu Jan 03 18:39:19 2008 -0500 +++ b/includes/dbal.php Wed Jan 16 13:55:49 2008 -0500 @@ -163,14 +163,14 @@ define('scriptPath', $sp); define('contentPath', "$sp/index.php?title="); } - $loc = scriptPath . '/install.php'; + $loc = scriptPath . '/install/index.php'; define('IN_ENANO_INSTALL', 1); $GLOBALS['lang'] = new Language('eng'); global $lang; - $lang->load_file('./language/english/enano.json'); + $lang->load_file('./language/english/core.json'); $lang->load_file('./language/english/install.json'); // header("Location: $loc"); - redirect($loc, 'Enano not installed', 'We can\'t seem to find an Enano installation (valid config file). You will be transferred to the installation wizard momentarily...', 3); + redirect($loc, 'Enano not installed', 'We can\'t seem to find an Enano installation (valid config file). You will be transferred to the installation wizard momentarily...', 0); exit; } } @@ -179,10 +179,14 @@ unset($dbuser); unset($dbpasswd); // Security - if ( !$this->_conn ) + if ( !$this->_conn && !$manual_credentials ) { grinding_halt('Enano is having a problem', '

Error: couldn\'t connect to MySQL.
'.mysql_error().'

'); } + else if ( !$this->_conn && $manual_credentials ) + { + return false; + } // Reset some variables $this->query_backtrace = array(); @@ -677,14 +681,7 @@ function sql_error() { - if ( $this->_conn ) - { - return mysql_error(); - } - else - { - return array(); - } + return mysql_error(); } function sql_escape_string($t) { @@ -865,7 +862,7 @@ } function get_error($t = '') { - header('HTTP/1.1 500 Internal Server Error'); + @header('HTTP/1.1 500 Internal Server Error'); $bt = $this->sql_backtrace(); $e = htmlspecialchars(pg_last_error()); if($e=='') $e='<none>'; @@ -933,10 +930,14 @@ unset($dbuser); unset($dbpasswd); // Security - if ( !$this->_conn ) + if ( !$this->_conn && !$manual_credentials ) { grinding_halt('Enano is having a problem', '

Error: couldn\'t connect to PostgreSQL.
'.pg_last_error().'

'); } + else if ( !$this->_conn && $manual_credentials ) + { + return false; + } // Reset some variables $this->query_backtrace = array(); @@ -1425,11 +1426,11 @@ { if ( $this->_conn ) { - return mysql_error(); + return pg_last_error(); } else { - return array(); + return ( defined('IN_ENANO_INSTALL') ) ? $GLOBALS["lang"]->get('dbpgsql_msg_err_auth') : 'Access to the database was denied. Ensure that your database exists and that your username and password are correct.'; } } function sql_escape_string($t) diff -r 299a90e28abc -r 87e08a6e4fec includes/lang.php --- a/includes/lang.php Thu Jan 03 18:39:19 2008 -0500 +++ b/includes/lang.php Wed Jan 16 13:55:49 2008 -0500 @@ -185,7 +185,16 @@ global $db, $session, $paths, $template, $plugins; // Common objects if ( !file_exists($file) ) - $db->_die('lang.php - requested JSON file doesn\'t exist'); + { + if ( defined('IN_ENANO_INSTALL') ) + { + die('lang.php - requested JSON file (' . htmlspecialchars($file) . ') doesn\'t exist'); + } + else + { + $db->_die('lang.php - requested JSON file doesn\'t exist'); + } + } $contents = trim(@file_get_contents($file)); if ( empty($contents) ) @@ -206,7 +215,29 @@ } else { - $langdata = enano_json_decode($contents); + // Correct syntax to be nice to the json parser + + // eliminate comments + $contents = preg_replace(array( + // eliminate single line comments in '// ...' form + '#^\s*//(.+)$#m', + // eliminate multi-line comments in '/* ... */' form, at start of string + '#^\s*/\*(.+)\*/#Us', + // eliminate multi-line comments in '/* ... */' form, at end of string + '#/\*(.+)\*/\s*$#Us' + ), '', $contents); + + $contents = preg_replace('/([,\{\[])([\s]*?)([a-z0-9_]+)([\s]*?):/', '\\1\\2"\\3" :', $contents); + + try + { + $langdata = enano_json_decode($contents); + } + catch(Zend_Json_Exception $e) + { + $db->_die('lang.php - Exception caught by JSON parser

' . htmlspecialchars(print_r($e, true)) . '

'); + exit; + } if ( !is_array($langdata) ) $db->_die('lang.php - invalid language file'); diff -r 299a90e28abc -r 87e08a6e4fec includes/rijndael.php --- a/includes/rijndael.php Thu Jan 03 18:39:19 2008 -0500 +++ b/includes/rijndael.php Wed Jan 16 13:55:49 2008 -0500 @@ -126,7 +126,7 @@ $this->debug = $debug; } - function singleton($key_size, $block_size) + public static function singleton($key_size, $block_size) { global $_aes_objcache; if ( isset($_aes_objcache["$key_size,$block_size"]) ) diff -r 299a90e28abc -r 87e08a6e4fec install.php --- a/install.php Thu Jan 03 18:39:19 2008 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2470 +0,0 @@ -The Enano installer has found a Enano installation in this directory. You MUST delete config.php if you want to re-install Enano.

If you wish to upgrade an older Enano installation to this version, please use the upgrade script.

'); - exit; -} - -define('IN_ENANO_INSTALL', 'true'); - -define('ENANO_VERSION', '1.1.1'); -define('ENANO_CODE_NAME', 'Germination'); -// In beta versions, define ENANO_BETA_VERSION here - -// This is required to make installation work right -define("ENANO_ALLOW_LOAD_NOLANG", 1); - -if(!defined('scriptPath')) { - $sp = dirname($_SERVER['REQUEST_URI']); - if($sp == '/' || $sp == '\\') $sp = ''; - define('scriptPath', $sp); -} - -if(!defined('contentPath')) { - $sp = dirname($_SERVER['REQUEST_URI']); - if($sp == '/' || $sp == '\\') $sp = ''; - define('contentPath', $sp); -} -global $_starttime, $this_page, $sideinfo; -$_starttime = microtime(true); - -global $db; - -// Determine directory (special case for development servers) -if ( strpos(__FILE__, '/repo/') && file_exists('.enanodev') ) -{ - $filename = str_replace('/repo/', '/', __FILE__); -} -else -{ - $filename = __FILE__; -} - -define('ENANO_ROOT', dirname($filename)); - -function is_page($p) -{ - return true; -} - -function microtime_float() -{ - list($usec, $sec) = explode(" ", microtime()); - return ((float)$usec + (float)$sec); -} - -require('includes/wikiformat.php'); -require('includes/constants.php'); -require('includes/rijndael.php'); -require('includes/functions.php'); -require('includes/dbal.php'); -require('includes/lang.php'); -require('includes/json.php'); - -// Initialize language support -$lang = new Language('eng'); -$lang->load_file('./language/english/install.json'); - -strip_magic_quotes_gpc(); - -// -// INSTALLER LIBRARY -// - -$neutral_color = 'C'; - -function run_installer_stage($stage_id, $stage_name, $function, $failure_explanation, $allow_skip = true) -{ - static $resumed = false; - static $resume_stack = array(); - - if ( empty($resume_stack) && isset($_POST['resume_stack']) && preg_match('/[a-z_]+((\|[a-z_]+)+)/', $_POST['resume_stack']) ) - { - $resume_stack = explode('|', $_POST['resume_stack']); - } - - $already_run = false; - if ( in_array($stage_id, $resume_stack) ) - { - $already_run = true; - } - - if ( !$resumed ) - { - if ( !isset($_GET['stage']) ) - $resumed = true; - if ( isset($_GET['stage']) && $_GET['stage'] == $stage_id ) - { - $resumed = true; - } - } - if ( !$resumed && $allow_skip ) - { - echo_stage_success($stage_id, $stage_name); - return false; - } - if ( !function_exists($function) ) - die('libenanoinstall: CRITICAL: function "' . $function . '" for ' . $stage_id . ' doesn\'t exist'); - $result = @call_user_func($function, false, $already_run); - if ( $result ) - { - echo_stage_success($stage_id, $stage_name); - $resume_stack[] = $stage_id; - return true; - } - else - { - echo_stage_failure($stage_id, $stage_name, $failure_explanation, $resume_stack); - return false; - } -} - -function start_install_table() -{ - echo '' . "\n"; - ob_start(); -} - -function close_install_table() -{ - echo '
' . "\n\n"; - ob_end_flush(); -} - -function echo_stage_success($stage_id, $stage_name) -{ - global $neutral_color; - $neutral_color = ( $neutral_color == 'A' ) ? 'C' : 'A'; - echo '' . htmlspecialchars($stage_name) . 'Done' . "\n"; - ob_flush(); -} - -function echo_stage_failure($stage_id, $stage_name, $failure_explanation, $resume_stack) -{ - global $neutral_color; - global $lang; - - $neutral_color = ( $neutral_color == 'A' ) ? 'C' : 'A'; - echo '' . htmlspecialchars($stage_name) . 'Failed' . "\n"; - ob_flush(); - close_install_table(); - $post_data = ''; - $mysql_error = mysql_error(); - foreach ( $_POST as $key => $value ) - { - // FIXME: These should really also be sanitized for double quotes - $value = htmlspecialchars($value); - $key = htmlspecialchars($key); - $post_data .= " \n"; - } - echo '
- ' . $post_data . ' - -

' . $lang->get('meta_msg_err_stagefailed_title') . '

-

' . $failure_explanation . '

- ' . ( !empty($mysql_error) ? "

" . $lang->get('meta_msg_err_stagefailed_mysqlerror') . " $mysql_error

" : '' ) . ' -

' . $lang->get('meta_msg_err_stagefailed_body') . '

-

-
'; - global $template, $template_bak; - if ( is_object($template_bak) ) - $template_bak->footer(); - else - $template->footer(); - exit; -} - -// -// INSTALLER STAGES -// - -function stg_mysql_connect($act_get = false) -{ - global $db; - $db = new mysql(); - - static $conn = false; - if ( $act_get ) - return $conn; - - $db_user =& $_POST['db_user']; - $db_pass =& $_POST['db_pass']; - $db_name =& $_POST['db_name']; - - if ( !preg_match('/^[a-z0-9_-]+$/', $db_name) ) - { - $db_name = htmlspecialchars($db_name); - die("

SECURITY: malformed database name \"$db_name\"

"); - } - - // First, try to connect using the normal credentials - $conn = @mysql_connect($_POST['db_host'], $_POST['db_user'], $_POST['db_pass']); - if ( !$conn ) - { - // Connection failed. Do we have the root username and password? - if ( !empty($_POST['db_root_user']) && !empty($_POST['db_root_pass']) ) - { - $conn_root = @mysql_connect($_POST['db_host'], $_POST['db_root_user'], $_POST['db_root_pass']); - if ( !$conn_root ) - { - // Couldn't connect using either set of credentials. Bail out. - return false; - } - unset($db_user, $db_pass); - $db_user = mysql_real_escape_string($_POST['db_user']); - $db_pass = mysql_real_escape_string($_POST['db_pass']); - // Create the user account - $q = @mysql_query("GRANT ALL PRIVILEGES ON test.* TO '{$db_user}'@'localhost' IDENTIFIED BY '$db_pass' WITH GRANT OPTION;", $conn_root); - if ( !$q ) - { - return false; - } - // Revoke privileges from test, we don't need them - $q = @mysql_query("REVOKE ALL PRIVILEGES ON test.* FROM '{$db_user}'@'localhost';", $conn_root); - if ( !$q ) - { - return false; - } - if ( $_POST['db_host'] != 'localhost' && $_POST['db_host'] != '127.0.0.1' && $_POST['db_host'] != '::1' ) - { - // If not connecting to a server running on localhost, allow from any host - // this is safer than trying to detect the hostname of the webserver, but less secure - $q = @mysql_query("GRANT ALL PRIVILEGES ON test.* TO '{$db_user}'@'%' IDENTIFIED BY '$db_pass' WITH GRANT OPTION;", $conn_root); - if ( !$q ) - { - return false; - } - // Revoke privileges from test, we don't need them - $q = @mysql_query("REVOKE ALL PRIVILEGES ON test.* FROM '{$db_user}'@'%';", $conn_root); - if ( !$q ) - { - return false; - } - } - mysql_close($conn_root); - $conn = @mysql_connect($_POST['db_host'], $_POST['db_user'], $_POST['db_pass']); - if ( !$conn ) - { - // This should honestly never happen. - return false; - } - } - } - $q = @mysql_query("USE `$db_name`;", $conn); - if ( !$q ) - { - // access denied to the database; try the whole root schenanegan again - if ( !empty($_POST['db_root_user']) && !empty($_POST['db_root_pass']) ) - { - $conn_root = @mysql_connect($_POST['db_host'], $_POST['db_root_user'], $_POST['db_root_pass']); - if ( !$conn_root ) - { - // Couldn't connect as root; bail out - return false; - } - // create the database, if it doesn't exist - $q = @mysql_query("CREATE DATABASE IF NOT EXISTS `$db_name`;", $conn_root); - if ( !$q ) - { - // this really should never fail, so don't give any tolerance to it - return false; - } - unset($db_user, $db_pass); - $db_user = mysql_real_escape_string($_POST['db_user']); - $db_pass = mysql_real_escape_string($_POST['db_pass']); - // we're in with root rights; grant access to the database - $q = @mysql_query("GRANT ALL PRIVILEGES ON `$db_name`.* TO '{$db_user}'@'localhost';", $conn_root); - if ( !$q ) - { - return false; - } - if ( $_POST['db_host'] != 'localhost' && $_POST['db_host'] != '127.0.0.1' && $_POST['db_host'] != '::1' ) - { - $q = @mysql_query("GRANT ALL PRIVILEGES ON `$db_name`.* TO '{$db_user}'@'%';", $conn_root); - if ( !$q ) - { - return false; - } - } - mysql_close($conn_root); - // grant tables have hopefully been flushed, kill and reconnect our regular user connection - mysql_close($conn); - $conn = @mysql_connect($_POST['db_host'], $_POST['db_user'], $_POST['db_pass']); - if ( !$conn ) - { - return false; - } - } - else - { - return false; - } - // try again - $q = @mysql_query("USE `$db_name`;", $conn); - if ( !$q ) - { - // really failed this time; bail out - return false; - } - } - // initialize DBAL - $db->connect(true, $_POST['db_host'], $db_user, $db_pass, $db_name); - // connected and database exists - return true; -} - -function stg_pgsql_connect($act_get = false) -{ - global $db; - $db = new postgresql(); - - static $conn = false; - if ( $act_get ) - return $conn; - - $db_user =& $_POST['db_user']; - $db_pass =& $_POST['db_pass']; - $db_name =& $_POST['db_name']; - - if ( !preg_match('/^[a-z0-9_-]+$/', $db_name) ) - { - $db_name = htmlspecialchars($db_name); - die("

SECURITY: malformed database name \"$db_name\"

"); - } - - // First, try to connect using the normal credentials - $conn = @pg_connect("host={$_POST['db_host']} port=5432 user={$_POST['db_user']} password={$_POST['db_pass']}"); - if ( !$conn ) - { - // Connection failed. Do we have the root username and password? - if ( !empty($_POST['db_root_user']) && !empty($_POST['db_root_pass']) ) - { - $conn_root = @pg_connect("host={$_POST['db_host']} port=5432 user={$_POST['db_root_user']} password={$_POST['db_root_pass']}"); - if ( !$conn_root ) - { - // Couldn't connect using either set of credentials. Bail out. - return false; - } - unset($db_user, $db_pass); - $db_user = pg_escape_string($_POST['db_user']); - $db_pass = pg_escape_string($_POST['db_pass']); - // Create the user account - $q = @pg_query("CREATE ROLE '$db_user' WITH NOSUPERUSER UNENCRYPTED PASSWORD '$db_pass';", $conn_root); - if ( !$q ) - { - return false; - } - pg_close($conn_root); - $conn = @pg_connect("host={$_POST['db_host']} port=5432 user={$_POST['db_user']} password={$_POST['db_pass']}"); - if ( !$conn ) - { - // This should honestly never happen. - return false; - } - } - } - if ( !$q ) - { - // access denied to the database; try the whole root schenanegan again - if ( !empty($_POST['db_root_user']) && !empty($_POST['db_root_pass']) ) - { - $conn_root = @pg_connect("host={$_POST['db_host']} port=5432 user={$_POST['db_root_user']} password={$_POST['db_root_pass']}"); - if ( !$conn_root ) - { - // Couldn't connect as root; bail out - return false; - } - unset($db_user, $db_pass); - $db_user = pg_escape_string($_POST['db_user']); - $db_pass = pg_escape_string($_POST['db_pass']); - // create the database, if it doesn't exist - $q = @mysql_query("CREATE DATABASE $db_name WITH OWNER $db_user;", $conn_root); - if ( !$q ) - { - // this really should never fail, so don't give any tolerance to it - return false; - } - // Setting the owner to $db_user should grant all the rights we need - pg_close($conn_root); - // grant tables have hopefully been flushed, kill and reconnect our regular user connection - pg_close($conn); - $conn = @pg_connect("host={$_POST['db_host']} port=5432 user={$_POST['db_user']} password={$_POST['db_pass']}"); - if ( !$conn ) - { - return false; - } - } - else - { - return false; - } - // try again - $q = @mysql_query("USE `$db_name`;", $conn); - if ( !$q ) - { - // really failed this time; bail out - return false; - } - } - // initialize DBAL - $db->connect(true, $_POST['db_host'], $db_user, $db_pass, $db_name); - // connected and database exists - return true; -} - -function stg_drop_tables() -{ - global $db; - // Our list of tables included in Enano - $tables = Array( 'categories', 'comments', 'config', 'logs', 'page_text', 'session_keys', 'pages', 'users', 'users_extra', 'themes', 'buddies', 'banlist', 'files', 'privmsgs', 'sidebar', 'hits', 'search_index', 'groups', 'group_members', 'acl', 'tags', 'page_groups', 'page_group_members' ); - - // Drop each table individually; if it fails, it probably means we're trying to drop a - // table that didn't exist in the Enano version we're deleting the database for. - foreach ( $tables as $table ) - { - // Remember that table_prefix is sanitized. - $table = "{$_POST['table_prefix']}$table"; - $db->sql_query("DROP TABLE $table;", $conn); - } - return true; -} - -function stg_decrypt_admin_pass($act_get = false) -{ - static $decrypted_pass = false; - if ( $act_get ) - return $decrypted_pass; - - $aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE); - - if ( !empty($_POST['crypt_data']) ) - { - require('config.new.php'); - if ( !isset($cryptkey) ) - { - return false; - } - define('_INSTRESUME_AES_KEYBACKUP', $key); - $key = hexdecode($cryptkey); - - $decrypted_pass = $aes->decrypt($_POST['crypt_data'], $key, ENC_HEX); - - } - else - { - $decrypted_pass = $_POST['admin_pass']; - } - if ( empty($decrypted_pass) ) - return false; - return true; -} - -function stg_generate_aes_key($act_get = false) -{ - static $key = false; - if ( $act_get ) - return $key; - - $aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE); - $key = $aes->gen_readymade_key(); - return true; -} - -function stg_parse_schema($act_get = false) -{ - static $schema; - if ( $act_get ) - return $schema; - - global $db; - - $admin_pass = stg_decrypt_admin_pass(true); - $key = stg_generate_aes_key(true); - $aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE); - $key = $aes->hextostring($key); - $admin_pass = $aes->encrypt($admin_pass, $key, ENC_HEX); - - $cacheonoff = is_writable(ENANO_ROOT.'/cache/') ? '1' : '0'; - - $admin_user = $_POST['admin_user']; - $admin_user = str_replace('_', ' ', $admin_user); - $admin_user = $db->escape($admin_user); - - switch ( $_POST['db_driver'] ) - { - case 'mysql': - $schema_file = 'schema.sql'; - break; - case 'postgresql': - $schema_file = 'schema-pg.sql'; - break; - } - - if ( !isset($schema_file) ) - die('insanity'); - - $schema = file_get_contents($schema_file); - $schema = str_replace('{{SITE_NAME}}', $db->escape($_POST['sitename'] ), $schema); - $schema = str_replace('{{SITE_DESC}}', $db->escape($_POST['sitedesc'] ), $schema); - $schema = str_replace('{{COPYRIGHT}}', $db->escape($_POST['copyright'] ), $schema); - $schema = str_replace('{{ADMIN_USER}}', $admin_user , $schema); - $schema = str_replace('{{ADMIN_PASS}}', $db->escape($admin_pass ), $schema); - $schema = str_replace('{{ADMIN_EMAIL}}', $db->escape($_POST['admin_email']), $schema); - $schema = str_replace('{{ENABLE_CACHE}}', $db->escape($cacheonoff ), $schema); - $schema = str_replace('{{REAL_NAME}}', '', $schema); - $schema = str_replace('{{TABLE_PREFIX}}', $_POST['table_prefix'], $schema); - $schema = str_replace('{{VERSION}}', ENANO_VERSION, $schema); - $schema = str_replace('{{ADMIN_EMBED_PHP}}', $_POST['admin_embed_php'], $schema); - // Not anymore!! :-D - // $schema = str_replace('{{BETA_VERSION}}', ENANO_BETA_VERSION, $schema); - - if(isset($_POST['wiki_mode'])) - { - $schema = str_replace('{{WIKI_MODE}}', '1', $schema); - } - else - { - $schema = str_replace('{{WIKI_MODE}}', '0', $schema); - } - - // Build an array of queries - $schema = explode("\n", $schema); - - foreach ( $schema as $i => $sql ) - { - $query =& $schema[$i]; - $t = trim($query); - if ( empty($t) || preg_match('/^(\#|--)/i', $t) ) - { - unset($schema[$i]); - unset($query); - } - } - - $schema = array_values($schema); - $schema = implode("\n", $schema); - $schema = explode(";\n", $schema); - - foreach ( $schema as $i => $sql ) - { - $query =& $schema[$i]; - if ( substr($query, ( strlen($query) - 1 ), 1 ) != ';' ) - { - $query .= ';'; - } - } - - return true; -} - -function stg_install($_unused, $already_run) -{ - // This one's pretty easy. - $conn = stg_mysql_connect(true); - if ( !is_resource($conn) ) - return false; - $schema = stg_parse_schema(true); - if ( !is_array($schema) ) - return false; - - // If we're resuming installation, the encryption key was regenerated. - // This means we'll have to update the encrypted password in the database. - if ( $already_run ) - { - $admin_pass = stg_decrypt_admin_pass(true); - $key = stg_generate_aes_key(true); - $aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE); - $key = $aes->hextostring($key); - $admin_pass = $aes->encrypt($admin_pass, $key, ENC_HEX); - $admin_user = mysql_real_escape_string($_POST['admin_user']); - $admin_user = str_replace('_', ' ', $admin_user); - - $q = @mysql_query("UPDATE {$_POST['table_prefix']}users SET password='$admin_pass' WHERE username='$admin_user';"); - if ( !$q ) - { - echo '

MySQL return: ' . mysql_error() . '

'; - return false; - } - - return true; - } - - // OK, do the loop, baby!!! - foreach($schema as $q) - { - $r = mysql_query($q, $conn); - if ( !$r ) - { - echo '

MySQL return: ' . mysql_error() . '

'; - return false; - } - } - - return true; -} - -function stg_write_config() -{ - $privkey = stg_generate_aes_key(true); - - switch($_POST['urlscheme']) - { - case "ugly": - default: - $cp = scriptPath.'/index.php?title='; - break; - case "short": - $cp = scriptPath.'/index.php/'; - break; - case "tiny": - $cp = scriptPath.'/'; - break; - } - - if ( $_POST['urlscheme'] == 'tiny' ) - { - $contents = '# Begin Enano rules -RewriteEngine on -RewriteCond %{REQUEST_FILENAME} !-d -RewriteCond %{REQUEST_FILENAME} !-f -RewriteRule ^(.+) '.scriptPath.'/index.php?title=$1 [L,QSA] -RewriteRule \.(php|html|gif|jpg|png|css|js)$ - [L] -# End Enano rules -'; - if ( file_exists('./.htaccess') ) - $ht = fopen(ENANO_ROOT.'/.htaccess', 'a+'); - else - $ht = fopen(ENANO_ROOT.'/.htaccess.new', 'w'); - if ( !$ht ) - return false; - fwrite($ht, $contents); - fclose($ht); - } - - $config_file = ''; - - $cf_handle = fopen(ENANO_ROOT.'/config.new.php', 'w'); - if ( !$cf_handle ) - return false; - fwrite($cf_handle, $config_file); - - fclose($cf_handle); - - return true; -} - -function _stg_rename_config_revert() -{ - if ( file_exists('./config.php') ) - { - @rename('./config.php', './config.new.php'); - } - - $handle = @fopen('./config.php.new', 'w'); - if ( !$handle ) - return false; - $contents = ''; - fwrite($handle, $contents); - fclose($handle); - return true; -} - -function stg_build_index() -{ - global $db, $session, $paths, $template, $plugins; // Common objects; - if ( $paths->rebuild_search_index() ) - return true; - return false; -} - -function stg_rename_config() -{ - if ( !@rename('./config.new.php', './config.php') ) - { - echo '

Can\'t rename config.php

'; - _stg_rename_config_revert(); - return false; - } - - if ( $_POST['urlscheme'] == 'tiny' && !file_exists('./.htaccess') ) - { - if ( !@rename('./.htaccess.new', './.htaccess') ) - { - echo '

Can\'t rename .htaccess

'; - _stg_rename_config_revert(); - return false; - } - } - return true; -} - -function stg_start_api_success() -{ - return true; -} - -function stg_start_api_failure() -{ - return false; -} - -function stg_import_language() -{ - global $db, $session, $paths, $template, $plugins; // Common objects - - $lang_file = ENANO_ROOT . "/language/english/enano.json"; - install_language("eng", "English", "English", $lang_file); - - return true; -} - -function stg_init_logs() -{ - global $db, $session, $paths, $template, $plugins; // Common objects - - $q = $db->sql_query('INSERT INTO ' . table_prefix . 'logs(log_type,action,time_id,date_string,author,page_text,edit_summary) VALUES(\'security\', \'install_enano\', ' . time() . ', \'' . enano_date('d M Y h:i a') . '\', \'' . mysql_real_escape_string($_POST['admin_user']) . '\', \'' . mysql_real_escape_string(ENANO_VERSION) . '\', \'' . mysql_real_escape_string($_SERVER['REMOTE_ADDR']) . '\');'); - if ( !$q ) - { - echo '

MySQL return: ' . mysql_error() . '

'; - return false; - } - - if ( !$session->get_permissions('clear_logs') ) - { - echo '

$session: denied clear_logs

'; - return false; - } - - PageUtils::flushlogs('Main_Page', 'Article'); - - return true; -} - -//die('Key size: ' . AES_BITS . '
Block size: ' . AES_BLOCKSIZE); - -if(!function_exists('wikiFormat')) -{ - function wikiFormat($message, $filter_links = true) - { - $wiki = & Text_Wiki::singleton('Mediawiki'); - $wiki->setRenderConf('Xhtml', 'code', 'css_filename', 'codefilename'); - $wiki->setRenderConf('Xhtml', 'wikilink', 'view_url', contentPath); - $result = $wiki->transform($message, 'Xhtml'); - - // HTML fixes - $result = preg_replace('#([\s]*?)<\/tr>#is', '', $result); - $result = preg_replace('#

([\s]*?)<\/p>#is', '', $result); - $result = preg_replace('#
([\s]*?)$descTest passed"; - } elseif(!$val && $warn) { - if($cv) $color='FFFFCC'; else $color='FFFFAA'; - echo "$desc
$extended_descTest passed with warning"; - $warned = true; - } else { - if($cv) $color='FFCCCC'; else $color='FFAAAA'; - echo "$desc
$extended_descTest failed"; - $failed = true; - } -} -function is_apache() { $r = strstr($_SERVER['SERVER_SOFTWARE'], 'Apache') ? true : false; return $r; } - -function show_license($fb = false) -{ - global $lang; - ?> -

- -

get('license_info_unstable_title'); ?>

-

get('license_info_unstable_body'); ?>

- -

get('license_section_gpl_heading'); ?>

- lang_code != 'eng' ): ?> -

get('license_gpl_blurb_inenglish'); ?>

- - - Because I could never find the Create a Page button in PHP-Nuke.

'; - echo '

' . str_replace('http://enanocms.org/', 'http://www.2robots.com/2003/10/15/web-portals-suck/', $template->fading_button) . '

'; - echo '

It\'s not a portal, my friends.

'; - } - ?> -
- get('pophelp_admin_embed_php_title'); - $content = $lang->get('pophelp_admin_embed_php_body'); - break; - case 'url_schemes': - $title = $lang->get('pophelp_url_schemes_title'); - $content = $lang->get('pophelp_url_schemes_body'); - break; - default: - $title = 'Invalid topic'; - $content = 'Invalid help topic.'; - break; - } - $close_window = $lang->get('pophelp_btn_close_window'); - echo << - - - Enano installation quick help • {$title} - - - - -

{$title}

- {$content} -

- {$close_window} -

- - -EOF; - exit; - break; - case 'langjs': - header('Content-type: text/javascript'); - $lang_js = enano_json_encode($lang->strings); - // use EEOF here because jEdit misinterprets "typ'eof'" - echo <<load_theme('stpatty', 'shamrock', false); - -$modestrings = Array( - 'welcome' => $lang->get('welcome_modetitle'), - 'license' => $lang->get('license_modetitle'), - 'sysreqs' => $lang->get('sysreqs_modetitle'), - 'database' => $lang->get('database_modetitle'), - 'database_mysql'=> $lang->get('database_mysql_modetitle'), - 'database_pgsql'=> $lang->get('database_pgsql_modetitle'), - 'website' => $lang->get('website_modetitle'), - 'login' => $lang->get('login_modetitle'), - 'confirm' => $lang->get('confirm_modetitle'), - 'install' => $lang->get('install_modetitle'), - 'finish' => $lang->get('finish_modetitle'), - '_hiddenstages' => '...', // all stages below this line are hidden - 'showlicense' => $lang->get('license_modetitle') - ); - -$sideinfo = ''; -$vars = $template->extract_vars('elements.tpl'); -$p = $template->makeParserText($vars['sidebar_button']); -$hidden = false; -foreach ( $modestrings as $id => $str ) -{ - if ( $_GET['mode'] == $id ) - { - $flags = 'style="font-weight: bold; text-decoration: underline;"'; - $this_page = $str; - } - else - { - $flags = ''; - } - if ( $id == '_hiddenstages' ) - $hidden = true; - if ( !$hidden ) - { - $p->assign_vars(Array( - 'HREF' => '#', - 'FLAGS' => $flags . ' onclick="return false;"', - 'TEXT' => $str - )); - $sideinfo .= $p->run(); - } -} - -$template->init_vars(); - -if(isset($_GET['mode']) && $_GET['mode'] == 'css') -{ - header('Content-type: text/css'); - echo $template->get_css(); - exit; -} - -if ( defined('ENANO_IS_STABLE') ) - $branch = 'stable'; -else if ( defined('ENANO_IS_UNSTABLE') ) - $branch = 'unstable'; -else -{ - $version = explode('.', ENANO_VERSION); - if ( !isset($version[1]) ) - // unknown branch, really - $branch = 'unstable'; - else - { - $version[1] = intval($version[1]); - if ( $version[1] % 2 == 1 ) - $branch = 'unstable'; - else - $branch = 'stable'; - } -} - -$template->header(); - -switch($_GET['mode']) -{ - default: - case 'welcome': - ?> -
- [ Enano CMS Project logo ] -

get('welcome_heading'); ?>

-

- get("welcome_branch_$branch"); - - $v_string = sprintf('%s %s – %s', $lang->get('welcome_version'), ENANO_VERSION, $branch_l); - echo $v_string; - ?> -

- '; - echo $lang->get('welcome_aka', array( - 'codename' => strtolower(ENANO_CODE_NAME) - )); - echo '

'; - } - ?> -
- -
-
- -

get('license_heading'); ?>

-

get('license_blurb_thankyou'); ?>

-

get('license_blurb_pleaseread'); ?>

- - - -

get('sysreqs_heading'); ?>

-

get('sysreqs_blurb'); ?>

- - get('sysreqs_req_php'), $lang->get('sysreqs_req_desc_php') ); - run_test('return version_compare(\'5.2.0\', PHP_VERSION, \'<\');', $lang->get('sysreqs_req_php5'), $lang->get('sysreqs_req_desc_php5'), true); - run_test('return function_exists(\'mysql_connect\');', $lang->get('sysreqs_req_mysql'), $lang->get('sysreqs_req_desc_mysql') ); - run_test('return function_exists(\'pg_connect\');', 'PostgreSQL extension for PHP', 'It seems that your PHP installation does not have the PostgreSQL extension enabled. Because of this, you won\'t be able to use the PostgreSQL database driver. This is OK in the majority of cases. If you want to use PostgreSQL support, you\'ll need to either compile the PHP extension for Postgres or install the extension with your distribution\'s package manager. Windows administrators will need enable php_pgsql.dll in their php.ini.', true); - run_test('return @ini_get(\'file_uploads\');', $lang->get('sysreqs_req_uploads'), $lang->get('sysreqs_req_desc_uploads') ); - run_test('return is_apache();', $lang->get('sysreqs_req_apache'), $lang->get('sysreqs_req_desc_apache'), true); - run_test('return is_writable(ENANO_ROOT.\'/config.new.php\');', $lang->get('sysreqs_req_config'), $lang->get('sysreqs_req_desc_config') ); - run_test('return file_exists(\'/usr/bin/convert\');', $lang->get('sysreqs_req_magick'), $lang->get('sysreqs_req_desc_magick'), true); - run_test('return is_writable(ENANO_ROOT.\'/cache/\');', $lang->get('sysreqs_req_cachewriteable'), $lang->get('sysreqs_req_desc_cachewriteable'), true); - run_test('return is_writable(ENANO_ROOT.\'/files/\');', $lang->get('sysreqs_req_fileswriteable'), $lang->get('sysreqs_req_desc_fileswriteable'), true); - if ( !function_exists('mysql_connect') && !function_exists('pg_connect') ) - { - run_test('return false;', 'No database drivers are available.', 'You need to have at least one database driver working to install Enano. See the warnings on MySQL and PostgreSQL above for more information on installing these database drivers.', false); - } - echo '
'; - if(!$failed) - { - ?> - - - '; - run_test('return false;', $lang->get('sysreqs_summary_fail_title'), $lang->get('sysreqs_summary_fail_body')); - echo '
'; - } - } - ?> - Choose a database driver'; - echo '

The next step is to choose the database driver that Enano will use. In most cases this is MySQL, but there are certain - advantages to PostgreSQL, which is made available only experimentally.

'; - if ( @file_exists('/etc/enano-is-virt-appliance') ) - { - echo '

You\'re using the Enano virtual appliance.
Unless you configured the appliance manually, PostgreSQL support is not available. In 99% of cases you\'ll want to click MySQL below.

'; - } - - $mysql_disable_reason = ''; - $pgsql_disable_reason = ''; - $mysql_disable = ''; - $pgsql_disable = ''; - if ( !function_exists('mysql_connect') ) - { - $mysql_disable = ' disabled="disabled"'; - $mysql_disable_reason = 'You don\'t have the MySQL PHP extension installed.'; - } - if ( !function_exists('pg_connect') ) - { - $pgsql_disable = ' disabled="disabled"'; - $pgsql_disable_reason = 'You don\'t have the PostgreSQL PHP extensnion installed.'; - } - if ( function_exists('pg_connect') && version_compare(PHP_VERSION, '5.0.0', '<') ) - { - $pgsql_disable = ' disabled="disabled"'; - $pgsql_disable_reason = 'You need to have at least PHP 5 to use the PostgreSQL database driver.'; - } - - echo '
'; - ?> - - - - > - MySQL
- Click this button to use MySQL as the database backend for your site. Most web hosts support MySQL, and if you have - administrative access to your MySQL server, you can create a new database and user during this installation process if you - haven't done so already. -
$mysql_disable_reason"; - } - ?> - -
- - - > - PostgreSQL
- Click this button to use PostgreSQL as the database backend for your site. While not as widely supported, PostgreSQL has more - liberal licensing conditions and when properly configured is faster than MySQL. Some plugins may not work with the PostgreSQL - driver. -
$pgsql_disable_reason"; - } - ?> - -
-
- /> -
- /> -
- '; - break; - case "database_mysql": - ?> - -

get('database_blurb_needdb'); ?>

-

get('database_blurb_howtomysql'); ?>

- - ' . $lang->get('database_vm_login_info', array( 'host' => 'localhost', 'user' => 'enano', 'pass' => 'clurichaun', 'name' => 'enano_www1' )) . ' -

'; - } - ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

get('database_table_title'); ?>

-
- get('database_field_hostname_title'); ?> -
get('database_field_hostname_body'); ?> -
-
- - - Good/bad icon -
- get('database_field_dbname_title'); ?>
- get('database_field_dbname_body'); ?>
- -
- - - Good/bad icon -
- get('database_field_dbauth_title'); ?>
- get('database_field_dbauth_body'); ?>
- -
- - - Good/bad icon -
- -
-

get('database_heading_optionalinfo'); ?>

-
- get('database_field_tableprefix_title'); ?>
- get('database_field_tableprefix_body'); ?> -
- - - Good/bad icon -
- get('database_field_rootauth_title'); ?>
- get('database_field_rootauth_body'); ?>
- -
- - - Good/bad icon -
- -
- get('database_field_mysqlversion_title'); ?> - - get('database_field_mysqlversion_blurb_willbechecked'); ?> - - Good/bad icon -
- get('database_field_droptables_title'); ?>
- get('database_field_droptables_body'); ?> -
- -
- -
- - - -

get('database_blurb_needdb'); ?>

-

get('database_blurb_howtomysql'); ?>

- - ' . $lang->get('database_vm_login_info', array( 'host' => 'localhost', 'user' => 'enano', 'pass' => 'clurichaun', 'name' => 'enano_www1' )) . ' -

'; - } - ?> - - - - - - - - - - - - - - - -

Database information

Database hostname
This is the hostname (or sometimes the IP address) of your Postgres server. In many cases, this is "localhost".
Good/bad icon
Database name
The name of the actual database. If you don't already have a database, you can create one here, if you have the username and password of a PostgreSQL superuser.
Good/bad icon
Database login
These fields should be the username and password for a role that has permission to create and alter tables, select data, insert data, update data, and delete data. You may or may not choose to allow dropping tables.
Good/bad icon

Optional information

Table prefix
The value that you enter here will be added to the beginning of the name of each Enano table. You may use lowercase letters (a-z), numbers (0-9), and underscores (_).
Good/bad icon
Database administrative login
If the Postgres database or role that you entered above does not exist yet, you can create them here, assuming that you have the login information for a PostgreSQL superuser. Leave these fields blank unless you need to use them.
Good/bad icon
PostgreSQL versionPostgreSQL version information will
be checked when you click "Test
Connection". You need to have at
least PostgreSQL 8.2.0 to install Enano.
Good/bad icon
Delete existing tables?
If this option is checked, all the tables that will be used by Enano will be dropped (deleted) before the schema is executed. Do NOT use this option unless specifically instructed to.
- -
- restart the installation.'; - $template->footer(); - exit; - } - unset($_POST['_cont']); - ?> - -
- '."\n"; - } - ?> -

get('website_header_blurb'); ?>

- - - - - - - - - - - - - - - - - - - - - - - - - -
- get('website_field_name_title'); ?>
- get('website_field_name_body'); ?> -
- - - Good/bad icon -
- get('website_field_desc_title'); ?>
- get('website_field_desc_body'); ?> -
- - - Good/bad icon -
- get('website_field_copyright_title'); ?>
- get('website_field_copyright_body'); ?> -
- - - Good/bad icon -
- get('website_field_wikimode_title'); ?>
- get('website_field_wikimode_body'); ?> -
- - -   -
- get('website_field_urlscheme_title'); ?>
- get('website_field_urlscheme_body'); ?> -
- name="urlscheme" value="ugly" id="ugly" />
- name="urlscheme" value="short" id="short" />
-
- get('website_field_urlscheme_helplink'); ?> -
- -
- restart the installation.'; - $template->footer(); - exit; - } - unset($_POST['_cont']); - require('config.new.php'); - $aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE); - if ( isset($crypto_key) ) - { - $cryptkey = $crypto_key; - } - if(!isset($cryptkey) || ( isset($cryptkey) && strlen($cryptkey) != AES_BITS / 4) ) - { - $cryptkey = $aes->gen_readymade_key(); - $handle = @fopen(ENANO_ROOT.'/config.new.php', 'w'); - if(!$handle) - { - echo '

ERROR: Despite my repeated attempts to verify that the configuration file can be written, I was indeed prevented from opening it for writing. Maybe you\'re still on crack Windows?

'; - $template->footer(); - exit; - } - fwrite($handle, ''); - fclose($handle); - } - // Sorry for the ugly hack, but this f***s up jEdit badly. - echo ' - - '; - ?> -
- '."\n"; - } - ?> -

get('login_header_blurb'); ?>

- - - - - - - - - - - - - - - - - - - - - - - - - - -
get('login_field_username_title'); ?>
get('login_field_username_body'); ?>
Good/bad icon
get('login_field_password_title'); ?>Good/bad icon
get('login_field_password_confirm'); ?>
get('login_field_email_title'); ?>Good/bad icon
- get('login_field_allowphp_title'); ?>
- - - get('login_field_allowphp_body', - array( - 'important_notes' => '' . $lang->get('login_field_allowphp_isi') . '' - ) - ); - ?> - - -
-    - -
get('login_aes_blurb'); ?>
- -
- - - -
- - restart the installation.'; - $template->footer(); - exit; - } - unset($_POST['_cont']); - ?> -
- '."\n"; - } - ?> -

get('confirm_header_blurb_title'); ?>

-

get('confirm_header_blurb_body'); ?>

-
    -
  • get('confirm_lbl_db_host'); ?>
  • -
  • get('confirm_lbl_db_name'); ?>
  • -
  • get('confirm_lbl_db_user'); ?>
  • -
  • get('confirm_lbl_db_pass'); ?>
  • -
  • get('confirm_lbl_sitename'); ?>
  • -
  • get('confirm_lbl_sitedesc'); ?>
  • -
  • get('confirm_lbl_adminuser'); ?>
  • -
  • get('confirm_lbl_aesbits'); ?> get('confirm_lbl_aes_strength', array( 'aes_bits' => AES_BITS )); ?>
    get('confirm_lbl_aes_change'); ?>
  • -
- -
- restart the installation.'; - $template->footer(); - exit; - } - if ( !in_array($_POST['db_driver'], array('mysql', 'postgresql')) ) - { - echo 'Invalid database driver.'; - $template->footer(); - exit; - } - switch($_POST['urlscheme']) - { - case "ugly": - default: - $cp = scriptPath.'/index.php?title='; - break; - case "short": - $cp = scriptPath.'/index.php/'; - break; - case "tiny": - $cp = scriptPath.'/'; - break; - } - function err($t) { global $template; echo $t; $template->footer(); exit; } - - // $stages = array('connect', 'decrypt', 'genkey', 'parse', 'sql', 'writeconfig', 'renameconfig', 'startapi', 'initlogs'); - - if ( !preg_match('/^[a-z0-9_-]*$/', $_POST['table_prefix']) ) - err('Hacking attempt was detected in table_prefix.'); - - start_install_table(); - - // Are we just trying to auto-rename the config files? If so, skip everything else - if ( !isset($_GET['stage']) || ( isset($_GET['stage']) && $_GET['stage'] != 'renameconfig' ) ) - { - // The stages connect, decrypt, genkey, and parse are preprocessing and don't do any actual data modification. - // Thus, they need to be run on each retry, e.g. never skipped. - run_installer_stage('connect', $lang->get('install_stg_connect_title'), 'stg_mysql_connect', $lang->get('install_stg_connect_body'), false); - if ( isset($_POST['drop_tables']) ) - { - // Are we supposed to drop any existing tables? If so, do it now - run_installer_stage('drop', $lang->get('install_stg_drop_title'), 'stg_drop_tables', 'This step never returns failure'); - } - run_installer_stage('decrypt', $lang->get('install_stg_decrypt_title'), 'stg_decrypt_admin_pass', $lang->get('install_stg_decrypt_body'), false); - run_installer_stage('genkey', $lang->get('install_stg_genkey_title', array( 'aes_bits' => AES_BITS )), 'stg_generate_aes_key', $lang->get('install_stg_genkey_body'), false); - run_installer_stage('parse', $lang->get('install_stg_parse_title'), 'stg_parse_schema', $lang->get('install_stg_parse_body'), false); - run_installer_stage('sql', $lang->get('install_stg_sql_title'), 'stg_install', $lang->get('install_stg_sql_body'), false); - run_installer_stage('writeconfig', $lang->get('install_stg_writeconfig_title'), 'stg_write_config', $lang->get('install_stg_writeconfig_body')); - - // Mainstream installation complete - Enano should be usable now - // The stage of starting the API is special because it has to be called out of function context. - // To alleviate this, we have two functions, one that returns success and one that returns failure - // If the Enano API load is successful, the success function is called to report the action to the user - // If unsuccessful, the failure report is sent - - $template_bak = $template; - - $_GET['title'] = 'Main_Page'; - require('includes/common.php'); - - if ( is_object($db) && is_object($session) ) - { - run_installer_stage('startapi', $lang->get('install_stg_startapi_title'), 'stg_start_api_success', '...', false); - } - else - { - run_installer_stage('startapi', $lang->get('install_stg_startapi_title'), 'stg_start_api_failure', $lang->get('install_stg_startapi_body'), false); - } - - // We need to be logged in (with admin rights) before logs can be flushed - $admin_password = stg_decrypt_admin_pass(true); - $session->login_without_crypto($_POST['admin_user'], $admin_password, false); - - // Now that login cookies are set, initialize the session manager and ACLs - $session->start(); - $paths->init(); - - run_installer_stage('importlang', $lang->get('install_stg_importlang_title'), 'stg_import_language', $lang->get('install_stg_importlang_body')); - run_installer_stage('initlogs', $lang->get('install_stg_initlogs_title'), 'stg_init_logs', $lang->get('install_stg_initlogs_body')); - - run_installer_stage('buildindex', $lang->get('install_stg_buildindex_title'), 'stg_build_index', $lang->get('install_stg_buildindex_body')); - - /* - * HACKERS: - * If you're making a custom distribution of Enano, put all your custom plugin-related code here. - * You have access to the full Enano API as well as being logged in with complete admin rights. - * Don't do anything horrendously fancy here, unless you add a new stage (or more than one) and - * have the progress printed out properly. - */ - - } // check for stage == renameconfig - else - { - // If we did skip the main installer routine, set $template_bak to make the reversal later work properly - $template_bak = $template; - } - - // Final step is to rename the config file - // In early revisions of 1.0.2, this step was performed prior to the initialization of the Enano API. It was decided to move - // this stage to the end because it will fail more often than any other stage, thus making alternate routes imperative. If this - // stage fails, then no big deal, we'll just have the user rename the files manually and then let them see the pretty success message. - run_installer_stage('renameconfig', $lang->get('install_stg_rename_title'), 'stg_rename_config', $lang->get('install_stg_rename_body')); - - close_install_table(); - - unset($template); - $template =& $template_bak; - - echo '

' . $lang->get('install_msg_complete_title') . '

'; - echo '

' . $lang->get('install_msg_complete_body', array('finish_link' => 'install.php?mode=finish')) . '

'; - - // echo ''; - - break; - case "finish": - echo '

' . $lang->get('finish_msg_congratulations') . '

- ' . $lang->get('finish_body') . ' -

' . $lang->get('finish_link_mainpage', array('mainpage_link' => 'index.php')) . '

'; - break; - // this stage is never shown during the installation, but is provided for legal purposes - case "showlicense": - show_license(true); - break; -} -$template->footer(); - -?> diff -r 299a90e28abc -r 87e08a6e4fec install/.htaccess --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/.htaccess Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,8 @@ +# Used for testing mod_rewrite. + +RewriteEngine on + +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule (.*) install.php?do=modrewrite_test&str=$1 + diff -r 299a90e28abc -r 87e08a6e4fec install/images/balancer.png Binary file install/images/balancer.png has changed diff -r 299a90e28abc -r 87e08a6e4fec install/images/css/installer.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/images/css/installer.css Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,231 @@ +/* + * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between + * Version 1.1.1 + * Copyright (C) 2006-2007 Dan Fuhry + * Installation package + * installer.css - visual styling rules for the installer + * + * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + */ + +body { + font-family: DejaVu Sans, Arial, Helvetica, sans-serif; + font-size: 9pt; + margin: 0; + padding: 0; +} + +div#header { + margin: 0px auto; + width: 800px; + padding: 10px 0; +} + +div#step { + float: right; + font-size: 12pt; + color: #D84308; + line-height: 48px; + background-image: url(../icons/install.png); + background-position: right center; + background-repeat: no-repeat; + padding-right: 56px; + margin: 10px 0 0 0; +} + +div.stages-holder { + color: #ffffff; + background-color: #2f527a; + width: 100%; +} + +ul.stages { + margin: 0; + line-height: 24px; + font-size: 8pt; + padding: 0; +} +ul.stages-fixed { + /* + width: 840px; + */ + display: table; + margin: 0 auto; +} +li.stage { + list-style-type: none; + float: left; + text-align: center; + padding: 3px 20px 3px 20px; +} +li.stage-active { + font-weight: bold; + padding: 1px 20px 5px 20px; + background-image: url(../marker.gif); + background-position: center bottom; + background-repeat: no-repeat; + background-color: #5f82aa; +} +div#enano-fill { + background-image: url(../substages.png); + background-repeat: repeat-x; +} +div#enano-body { + width: 780px; + padding: 10px; + margin: 0 auto; +} +div#enano-body a { + color: #003366; + text-decoration: underline; +} +div#enano-body a:hover { + color: #0055AA; +} +div#copyright { + border-top: 1px dotted #003399; + font-size: 6pt; + padding: 10px; + background-image: url(../substages.png); + background-repeat: repeat-x; + width: 70%; + margin: 20px auto 0 auto; + text-align: center; + color: #808080; +} +td.balancer { + width: 21px; + background-image: url(../balancer.png); + background-position: center center; + background-repeat: no-repeat; +} +ul.icons { + margin: 0; + padding: 0; + list-style-type: none; + display: table; +} +ul.icons li:first-child { + border-top-color: #FFFFFF; +} +ul.icons li { + /* Invisible border to prevent size-switching later */ + border: 1px solid #FFFFFF; + border-top-color: #F0F0F0; + margin: 0 0 -2px 0; + padding: 0; + display: block; +} +ul.icons li:hover { + border-color: #D0D0D0; + -moz-border-radius: 5px; +} +a.icon { + display: block; + font-size: 18pt; + line-height: 48px; + padding: 10px 20px 10px 68px; + background-position: 10px center; + background-repeat: no-repeat; + color: #002266; + text-decoration: none !important; +} +a.icon:hover { + cursor: pointer; + color: #002266 !important; + background-color: #F0F0F0; +} +a.icon-disabled { + color: #808080 !important; + opacity: 0.7; + filter: alpha(opacity=70); +} +a.icon-disabled:hover { + color: #808080 !important; + background-color: #FCFCFC; + border-color: #F8F8F8; +} +a.icon small, a.icon-disabled small { + display: block; + font-size: 8pt; + line-height: normal; + margin-top: -10px; +} +a.readme { + background-image: url(../icons/readme.png); +} +a.install { + background-image: url(../icons/install.png); +} +a.install-disabled { + background-image: url(../icons/install-disabled.png); +} +a.upgrade { + background-image: url(../icons/upgrade.png); +} +a.upgrade-disabled { + background-image: url(../icons/upgrade-disabled.png); +} + +.scroller { + padding: 10px; + border: 1px dotted #002266; + background-color: #F0F0F0; + max-height: 500px; + clip: rect(0px, auto, auto, 0px); + overflow: auto; +} + +div#installnotice { + margin: 5% 0 0 0; +} + +table#installmenu { + margin: 0 auto 5% auto; +} +span.fieldtip_js { + display: block; + background-color: #F0F0FF; + padding: 10px; + border: 1px solid #245687; + position: absolute; +} + +/* Inputs, form controls */ + +input[type ^="button"], button { + background-color: #F8F8FB; + color: #202020; + border-color: #B0B0B8 #D0D0D8 #D0D0D8 #B0B0B8; + border-width: 1px; + border-style: solid; +} +input[type ^="submit"] { + background-color: #4F729A; + color: #FFFFFF; + border-width: 1px; + border-style: solid; + border-color: #1F426A #7FA2CA #7FA2CA #1F426A; +} +input[type ^="submit"]:hover, input[type ^="submit"]:focus { + background-color: #5f82aa; +} +input[type ^="text"], input[type ^="password"] { + color: #202020; + background-color: #F0F0F4; + border: 1px solid #D6D6E9; +} +input[type ^="text"]:hover, input[type ^="password"]:hover { + color: #202020; + background-color: #F4F4F8; + border: 1px solid #D6D6E9; +} +input[type ^="text"]:focus, input[type ^="password"]:focus { + color: #202020; + background-color: #FFFFFF; + border: 1px solid #D6D6E9; +} diff -r 299a90e28abc -r 87e08a6e4fec install/images/enano-artwork/README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/images/enano-artwork/README Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,8 @@ +The images in this directory are copyright (C) 2007 Dan Fuhry. Except +as permitted by applicable law, they may not be used in any way other +than to promote the unmodified Enano CMS. You also may not modify and +then distribute the images in this directory, or distribute them sep- +arately from the Enano packages. The goal here is to establish a uni- +que identity for Enano through the use of a logo, and that identity +would be confused if this logo is used for unofficial Enano distros. + diff -r 299a90e28abc -r 87e08a6e4fec install/images/enano-artwork/installer-greeting.png Binary file install/images/enano-artwork/installer-greeting.png has changed diff -r 299a90e28abc -r 87e08a6e4fec install/images/enano-artwork/installer-header-blue.png Binary file install/images/enano-artwork/installer-header-blue.png has changed diff -r 299a90e28abc -r 87e08a6e4fec install/images/icons/install-disabled.png Binary file install/images/icons/install-disabled.png has changed diff -r 299a90e28abc -r 87e08a6e4fec install/images/icons/install.png Binary file install/images/icons/install.png has changed diff -r 299a90e28abc -r 87e08a6e4fec install/images/icons/readme.png Binary file install/images/icons/readme.png has changed diff -r 299a90e28abc -r 87e08a6e4fec install/images/icons/src/README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/images/icons/src/README Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,3 @@ +These icons are from the Flygo icon set, which is based on icons from the Tango +Desktop Project. They are released under the GNU General Public License. + diff -r 299a90e28abc -r 87e08a6e4fec install/images/icons/src/accessories-text-editor.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/images/icons/src/accessories-text-editor.svg Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,916 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Lapo Calamandrei + + + + Text editor + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 299a90e28abc -r 87e08a6e4fec install/images/icons/src/system-installer.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/images/icons/src/system-installer.svg Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,495 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + System - Installer + + + jakub Steiner + + + http://jimmac.musichall.cz + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 299a90e28abc -r 87e08a6e4fec install/images/icons/src/system-software-update.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/images/icons/src/system-software-update.svg Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,1378 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Software Update + + + Jakub Steiner + + + + + + + + + http://jimmac.musichall.cz + + + network update + software + synchronize + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 299a90e28abc -r 87e08a6e4fec install/images/icons/upgrade-disabled.png Binary file install/images/icons/upgrade-disabled.png has changed diff -r 299a90e28abc -r 87e08a6e4fec install/images/icons/upgrade.png Binary file install/images/icons/upgrade.png has changed diff -r 299a90e28abc -r 87e08a6e4fec install/images/marker.gif Binary file install/images/marker.gif has changed diff -r 299a90e28abc -r 87e08a6e4fec install/images/substages.png Binary file install/images/substages.png has changed diff -r 299a90e28abc -r 87e08a6e4fec install/includes/common.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/includes/common.php Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,130 @@ + '1.1.1', + 'type' => 'alpha' + // If type is set to "rc", "beta", or "alpha", optionally another version number can be issued with the key 'sub': + // 'sub' => '3' will produce Enano 1.1.1a3 / Enano 1.1.1 alpha 3 +); + +// Determine Enano root directory + +$enano_root = dirname(dirname(dirname(__FILE__))); +if ( preg_match('#/repo$#', $enano_root) && file_exists("$enano_root/../.enanodev") ) +{ + $enano_root = preg_replace('#/repo$#', '', $enano_root); +} + +define('ENANO_ROOT', $enano_root); + +chdir(ENANO_ROOT); + +// Determine our scriptPath +if ( isset($_SERVER['REQUEST_URI']) ) +{ + // Use reverse-matching to determine where the REQUEST_URI overlaps the Enano root. + $requri = $_SERVER['REQUEST_URI']; + if ( isset($_SERVER['PATH_INFO']) && !preg_match('/index\.php$/', $_SERVER['PATH_INFO']) ) + { + $requri = preg_replace(';' . preg_quote($_SERVER['PATH_INFO']) . '$;', '', $requri); + } + if ( !preg_match('/\.php$/', $requri) ) + { + // user requested http://foo/enano as opposed to http://foo/enano/index.php + $requri .= '/index.php'; + } + $sp = dirname($_SERVER['REQUEST_URI']); + if ( $sp == '/' || $sp == '\\' ) + { + $sp = ''; + } + $sp = preg_replace('#/install$#', '', $sp); + define('scriptPath', $sp); +} + +// is Enano already installed? +@include(ENANO_ROOT . '/config.php'); +if ( defined('ENANO_INSTALLED') && defined('ENANO_DANGEROUS') ) +{ + $title = 'Installation locked'; + require('includes/common.php'); + $template->header(); + echo '

The installer has detected that an installation of Enano already exists on your server. You MUST delete config.php if you wish to reinstall Enano.

'; + $template->footer(); + exit(); +} + +function microtime_float() +{ + list($usec, $sec) = explode(" ", microtime()); + return ((float)$usec + (float)$sec); +} + +define('IN_ENANO_INSTALL', 1); + +require(ENANO_ROOT . '/install/includes/ui.php'); +require(ENANO_ROOT . '/includes/functions.php'); +require(ENANO_ROOT . '/includes/json.php'); +require(ENANO_ROOT . '/includes/constants.php'); +require(ENANO_ROOT . '/includes/rijndael.php'); +// If we have at least PHP 5, load json2 +if ( version_compare(PHP_VERSION, '5.0.0', '>=') ) +{ + require(ENANO_ROOT . '/includes/json2.php'); +} + +// Build a list of available languages +$dir = @opendir( ENANO_ROOT . '/language' ); +if ( !$dir ) + die('CRITICAL: could not open language directory'); + +$languages = array(); +// Use the old PHP4-compatible JSON decoder +$json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); + +while ( $dh = @readdir($dir) ) +{ + if ( $dh == '.' || $dh == '..' ) + continue; + if ( file_exists( ENANO_ROOT . "/language/$dh/meta.json" ) ) + { + // Found a language directory, determine metadata + $meta = @file_get_contents( ENANO_ROOT . "/language/$dh/meta.json" ); + if ( empty($meta) ) + // Could not read metadata file, continue silently + continue; + $meta = $json->decode($meta); + if ( isset($meta['lang_name_english']) && isset($meta['lang_name_native']) && isset($meta['lang_code']) ) + { + $languages[$meta['lang_code']] = array( + 'name' => $meta['lang_name_native'], + 'dir' => $dh + ); + } + } +} + +if ( count($languages) < 1 ) +{ + die('CRITICAL: No languages are available'); +} + +// List of available DB drivers +$supported_drivers = array('mysql', 'postgresql'); + +?> diff -r 299a90e28abc -r 87e08a6e4fec install/includes/js/formutils.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/includes/js/formutils.js Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,169 @@ +/** + * Images used for form field validation + * @var string img_bad: Shown on field validation failure + * @var string img_good: Shown on field validation success + * @var string img_neu: Shown when a field's value matches known good regexp but still needs testing (e.g. DB info) + */ + +var img_bad = '../images/bad.gif'; +var img_good = '../images/good.gif'; +var img_neu = '../images/unknown.gif'; + +/** + * Highlights the background of the next-up tag. + * @param object Form field + */ + +function set_focus(item) +{ + var hint_id = ( item.type == 'radio' ) ? 'hint_' + item.name + '_' + item.value : 'hint_' + item.name; + if ( document.getElementById(hint_id) ) + { + var el = document.getElementById(hint_id); + el.style.zIndex = String(getHighestZ() + 2); + domObjChangeOpac(0, el); + el.style.display = 'block'; + domOpacity(el, 0, 100, 400); + } + item = getParentTR(item); + if ( item.tagName == 'TR' ) + { + item.style.backgroundColor = '#FFFFE0'; + } +} + +/** + * Clears the background of the next-up tag. + * @param object Form field + */ + +function clear_focus(item) +{ + var hint_id = ( item.type == 'radio' ) ? 'hint_' + item.name + '_' + item.value : 'hint_' + item.name; + if ( document.getElementById(hint_id) ) + { + var el = document.getElementById(hint_id); + // el.style.display = 'none'; + domOpacity(el, 100, 0, 200); + setTimeout(function() + { + el.style.display = 'none'; + }, 250); + } + item = getParentTR(item); + if ( item.tagName == 'TR' ) + { + if ( IE ) + { + item.style.backgroundColor = 'transparent'; + } + else + { + item.style.backgroundColor = null; + } + } +} + +function getParentTR(item) +{ + var tagName = item.tagName; + while ( tagName != 'TR' && tagName != null ) + { + item = item.parentNode; + tagName = item.tagName; + } + if ( tagName == 'TR' && item.className != 'nohighlight' ) + { + return item; + } + return null; +} + +function init_hint(input, hint) +{ + hint.className = 'fieldtip_js'; + setTimeout(function() + { + if ( input.type == 'radio' ) + { + var tr = getParentTR(input).parentNode.parentNode.parentNode; + var span_width = $(tr).Width() - 24; + } + else + { + var span_width = $(input).Width() - 24; + } + var span_top = $(input).Top() + $(input).Height(); + var span_left = $(input).Left(); + hint.style.top = span_top + 'px'; + hint.style.left = span_left + 'px'; + hint.style.width = span_width + 'px'; + hint.style.display = 'none'; + }, 100); +} + +var set_inputs_to_highlight = function() +{ + var inputs = document.getElementsByTagName('input'); + for ( var i = 0; i < inputs.length; i++ ) + { + // Highlighting + var tr = getParentTR(inputs[i]); + if ( tr ) + { + inputs[i].onfocus = function() + { + set_focus(this); + } + inputs[i].onblur = function() + { + clear_focus(this); + } + } + // Hints + var hint_id = ( inputs[i].type == 'radio' ) ? 'hint_' + inputs[i].name + '_' + inputs[i].value : 'hint_' + inputs[i].name; + if ( document.getElementById(hint_id) ) + { + var el = document.getElementById(hint_id); + if ( el.tagName == 'SPAN' ) + { + init_hint(inputs[i], el); + } + } + } +} + +addOnloadHook(set_inputs_to_highlight); + +function install_set_ajax_loading() +{ + var base = document.getElementById('enano-body'); + var hider = document.createElement('div'); + hider.style.position = 'absolute'; + hider.style.backgroundColor = '#FFFFFF'; + hider.style.top = $(base).Top() + 'px'; + hider.style.left = $(base).Left() + 'px'; + hider.style.width = $(base).Width() + 'px'; + hider.style.height = $(base).Height() + 'px'; + hider.style.backgroundPosition = 'center center'; + hider.style.backgroundImage = 'url(../images/loading-big.gif)'; + hider.style.backgroundRepeat = 'no-repeat'; + hider.id = 'ajax_loader'; + domObjChangeOpac(0, hider); + var body = document.getElementsByTagName('body')[0]; + body.appendChild(hider); + opacity('ajax_loader', 0, 70, 750); +} + +function install_unset_ajax_loading() +{ + if ( document.getElementById('ajax_loader') ) + { + opacity('ajax_loader', 70, 0, 750); + setTimeout(function() + { + var body = document.getElementsByTagName('body')[0]; + body.removeChild(document.getElementById('ajax_loader')); + }, 1000); + } +} diff -r 299a90e28abc -r 87e08a6e4fec install/includes/libenanoinstall.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/includes/libenanoinstall.php Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,116 @@ +' . "\n"; +} + +function close_install_table() +{ + echo '' . "\n\n"; + flush(); +} + +function echo_stage_success($stage_id, $stage_name) +{ + global $neutral_color; + $neutral_color = ( $neutral_color == 'A' ) ? 'C' : 'A'; + echo '' . htmlspecialchars($stage_name) . 'Done' . "\n"; + flush(); +} + +function echo_stage_failure($stage_id, $stage_name, $failure_explanation, $resume_stack) +{ + global $neutral_color; + global $lang; + + $neutral_color = ( $neutral_color == 'A' ) ? 'C' : 'A'; + echo '' . htmlspecialchars($stage_name) . 'Failed' . "\n"; + flush(); + close_install_table(); + $post_data = ''; + $mysql_error = mysql_error(); + foreach ( $_POST as $key => $value ) + { + // FIXME: These should really also be sanitized for double quotes + $value = htmlspecialchars($value); + $key = htmlspecialchars($key); + $post_data .= " \n"; + } + echo '
+ ' . $post_data . ' + +

' . $lang->get('meta_msg_err_stagefailed_title') . '

+

' . $failure_explanation . '

+ ' . ( !empty($mysql_error) ? "

" . $lang->get('meta_msg_err_stagefailed_mysqlerror') . " $mysql_error

" : '' ) . ' +

' . $lang->get('meta_msg_err_stagefailed_body') . '

+

+
'; + global $ui; + $ui->show_footer(); + exit; +} + +?> diff -r 299a90e28abc -r 87e08a6e4fec install/includes/payloads/common.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/includes/payloads/common.php Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,152 @@ +sql_query('SELECT config_value FROM ' . table_prefix . 'config WHERE config_name=\'install_aes_key\';'); + if ( !$q ) + $db->_die(); + if ( $db->numrows() < 1 ) + return false; + list($aes_key) = $db->fetchrow_num(); + $aes_key = $aes->hextostring($aes_key); + + $pass = $aes->decrypt($_POST['crypt_data'], $aes_key, ENC_HEX); + if ( !$pass ) + return false; + + return $pass; // Will be true if the password isn't crapped +} + +function stg_make_private_key() +{ + global $db; + static $site_key = false; + + if ( $site_key ) + return $site_key; + + // Is there already a key cached in the database? + $q = $db->sql_query('SELECT config_value FROM ' . table_prefix . 'config WHERE config_name=\'site_aes_key\';'); + if ( !$q ) + $db->_die(); + + if ( $db->numrows() > 0 ) + { + list($site_key) = $db->fetchrow_num(); + $db->free_result(); + return $site_key; + } + + $aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE); + // This will use /dev/urandom if possible + $site_key = $aes->gen_readymade_key(); + + // Stash it in the database, don't check for errors though because we can always regenerate it + $db->sql_query('INSERT INTO ' . table_prefix . 'config ( config_name, config_value ) VALUES ( \'site_aes_key\', \'' . $site_key . '\' );'); + + return $site_key; +} + +function stg_load_schema() +{ + global $db, $dbdriver, $installer_version; + static $sql_parser = false; + + if ( is_object($sql_parser) ) + return $sql_parser->parse(); + + $aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE); + + $site_key = stg_make_private_key(); + $site_key = $aes->hextostring($site_key); + $admin_pass_clean = stg_password_decode(); + $admin_pass = $aes->encrypt($admin_pass_clean, $site_key, ENC_HEX); + + unset($admin_pass_clean); // Security + + try + { + $sql_parser = new SQL_Parser( ENANO_ROOT . "/install/schemas/{$dbdriver}_stage2.sql" ); + } + catch ( Exception $e ) + { + echo "
$e
"; + return false; + } + + $vars = array( + 'TABLE_PREFIX' => $_POST['table_prefix'], + 'SITE_NAME' => $db->escape($_POST['site_name']), + 'SITE_DESC' => $db->escape($_POST['site_desc']), + 'COPYRIGHT' => $db->escape($_POST['copyright']), + // FIXME: update form + 'WIKI_MODE' => ( isset($_POST['wiki_mode']) ? '1' : '0' ), + 'ENABLE_CACHE' => ( is_writable( ENANO_ROOT . '/cache/' ) ? '1' : '0' ), + 'VERSION' => $installer_version['version'], + 'ADMIN_USER' => $db->escape($_POST['username']), + 'ADMIN_PASS' => $admin_pass, + 'ADMIN_EMAIL' => $db->escape($_POST['email']), + 'REAL_NAME' => '', // This has always been stubbed. + 'ADMIN_EMBED_PHP' => strval(AUTH_DISALLOW), + 'UNIX_TIME' => strval(time()) + ); + + $sql_parser->assign_vars($vars); + return $sql_parser->parse(); +} + +function stg_deliver_payload() +{ + global $db; + $schema = stg_load_schema(); + foreach ( $schema as $sql ) + { + if ( !$db->sql_query($sql) ) + { + echo $db->get_error(); + return false; + } + } + return true; +} + diff -r 299a90e28abc -r 87e08a6e4fec install/includes/payloads/mysql.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/includes/payloads/mysql.php Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,21 @@ +sql_string = $sql; + } + else + { + if ( file_exists($sql) ) + { + $this->sql_string = @file_get_contents($sql); + if ( empty($this->sql_string) ) + { + throw new Exception('SQL file is blank or permissions are bad'); + } + } + else + { + throw new Exception('SQL file doesn\'t exist'); + } + } + $this->sql_array = false; + $this->tpl_strings = array(); + } + + /** + * Sets template variables. + * @param array Associative array of template variables to assign + */ + + public function assign_vars($vars) + { + if ( !is_array($vars) ) + return false; + $this->tpl_strings = array_merge($this->tpl_strings, $vars); + } + + /** + * Internal function to parse the SQL. + * @access private + */ + + private function parse_sql() + { + $this->sql_array = $this->sql_string; + foreach ( $this->tpl_strings as $key => $value ) + { + $this->sql_array = str_replace("{{{$key}}}", $value, $this->sql_array); + } + + // Build an array of queries + $this->sql_array = explode("\n", $this->sql_array); + + foreach ( $this->sql_array as $i => $sql ) + { + $query =& $this->sql_array[$i]; + $t = trim($query); + if ( empty($t) || preg_match('/^(\#|--)/i', $t) ) + { + unset($this->sql_array[$i]); + unset($query); + } + } + unset($query); + + $this->sql_array = array_values($this->sql_array); + $this->sql_array = implode("\n", $this->sql_array); + $this->sql_array = explode(";\n", $this->sql_array); + + foreach ( $this->sql_array as $i => $sql ) + { + $query =& $this->sql_array[$i]; + if ( substr($query, ( strlen($query) - 1 ), 1 ) != ';' ) + { + $query .= ';'; + } + } + unset($query); + } + + /** + * Returns the parsed array of SQL queries. + * @param bool Optional. Defaults to false. If true, a parse is performed even if it already happened. + * @return array + */ + + public function parse($force_reparse = false) + { + if ( !$this->sql_array || $force_reparse ) + $this->parse_sql(); + return $this->sql_array; + } +} + +?> diff -r 299a90e28abc -r 87e08a6e4fec install/includes/stages/confirm.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/includes/stages/confirm.php Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,44 @@ +show_header(); +?> +

Enano is ready to install.

+

Almost there! You've entered all the information we need for now. Click Continue to install the Enano database.

+

A note on AES encryption: + Enano is currently configured to use -bit AES encryption. While the default value of 192 bits is perfectly acceptable for most sites, those in need of extreme security will want to change this value to 256 bits (the maximum available strength). If you need to change the cipher strength, please edit the file includes/constants.php and then restart this installation. Do not click Continue below until you redo the installation process up until this point, or you will experience severe problems with logging into your site. +

+
&$value ) + { + if ( !preg_match('/^[a-z0-9_]+$/', $key) ) + die('You idiot hacker...'); + if ( $key == '_cont' ) + continue; + $value_clean = str_replace(array('\\', '"', '<', '>'), array('\\\\', '\\"', '<', '>'), $value); + echo "\n "; + } +?> + +
+ +
+
diff -r 299a90e28abc -r 87e08a6e4fec install/includes/stages/database.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/includes/stages/database.php Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,110 @@ +' . $lang->get('database_driver_heading') . ''; +echo '

' . $lang->get('database_driver_intro') . '

'; +if ( @file_exists('/etc/enano-is-virt-appliance') ) +{ + echo '

' . $lang->get('database_driver_msg_virt_appliance') . '

'; +} + +$mysql_disable_reason = ''; +$pgsql_disable_reason = ''; +$mysql_disable = ''; +$pgsql_disable = ''; +if ( !function_exists('mysql_connect') ) +{ + $mysql_disable = ' disabled="disabled"'; + $mysql_disable_reason = $lang->get('database_driver_err_no_mysql'); +} +if ( !function_exists('pg_connect') ) +{ + $pgsql_disable = ' disabled="disabled"'; + $pgsql_disable_reason = $lang->get('database_driver_err_no_pgsql'); +} + +echo '
'; +echo ''; +?> + + + + > + get('database_driver_mysql'); ?>
+ get('database_driver_mysql_intro'); ?> +
$mysql_disable_reason"; + } + ?> + +
+ + + > + get('database_driver_pgsql'); ?>
+ get('database_driver_pgsql_intro'); ?> +
$pgsql_disable_reason"; + } + ?> + +
+
+ + /> + + + +
+ + /> + + + +
+ + + + '; +} + +echo '
'; diff -r 299a90e28abc -r 87e08a6e4fec install/includes/stages/database_mysql.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/includes/stages/database_mysql.php Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,508 @@ + false, + 'host_good' => true, + 'creating_user' => false, + 'db_exist' => false, + 'creating_db' => false, + 'creating_db_grant' => false, + 'root_fail' => false, + 'version' => array( + 'version' => 'unknown', + 'good' => 'indeterminate' + ), + 'last_error' => '' + ); + + if ( !isset($_POST['info']) ) + die(); + + $info = $_POST['info']; + + // From here on out will be JSON responses + header('Content-type: application/json'); + + try + { + $info = @enano_json_decode($info); + } + catch ( Zend_Json_Exception $e ) + { + die(enano_json_encode(array( + 'mode' => 'error', + 'error' => 'Exception in JSON decoder' + ))); + } + + // Try to connect as the normal user + $test = @mysql_connect($info['db_host'], $info['db_user'], $info['db_pass']); + if ( !$test ) + { + $return['creating_user'] = true; + $return['last_error'] = mysql_error(); + if ( strstr( $return['last_error'], 'Lost connection' ) || strstr( $return['last_error'], 'Unknown MySQL server host' ) ) + { + $return['host_good'] = false; + } + // Doing that failed. If we have root credentials, test those + if ( !empty($info['db_root_user']) && !empty($info['db_root_pass']) ) + { + // Log in with root rights and if that works, tell 'em we'll reset the password or create + // the account if it doesn't exist already. This is done with GRANT ALL PRIVILEGES ON enano_db.* + // etc etc, a little hackish but known to work with MySQL >= 4.1. + $test_root = @mysql_connect($info['db_host'], $info['db_root_user'], $info['db_root_pass']); + if ( $test_root ) + { + // We logged in with root rights, assume that we have appropriate permissions. + // If not, well, the installation will fail. Tough on the user, but creating + // test databases/users is too risky. + + // Does the database exist? + $q = @mysql_query('USE `' . mysql_real_escape_string($info['db_name']) . '`;', $test_root); + if ( !$q ) + { + // Nope, we'll have to create it + $return['creating_db'] = true; + $return['last_error'] = mysql_error(); + } + + $version = mysql_get_server_info($test_root); + $return['version'] = array( + 'version' => $version, + 'good' => version_compare($version, '4.0.17', '>=') + ); + + $return['can_install'] = ( $return['version']['good'] ) ? true : false; + } + else + { + // Well that helped. Root credentials are bad. + $return['creating_db'] = true; + $return['root_fail'] = true; + } + } + else + { + // No root credentials, fail out + $return['root_fail'] = true; + } + } + else + { + // We're connected; do we have permission to use the database? + $have_database = false; + $q = @mysql_query('USE `' . mysql_real_escape_string($info['db_name']) . '`;', $test); + if ( $q ) + { + // Permissions are good and we're all connected. Perform version check... + $version = mysql_get_server_info($test); + $return['version'] = array( + 'version' => $version, + 'good' => version_compare($version, '4.0.17', '>=') + ); + + $return['can_install'] = ( $return['version']['good'] ) ? true : false; + } + else + { + $return['last_error'] = mysql_error(); + $return['creating_db'] = true; + + // We don't have permission to use the database or it doesn't exist. + // See if we have a root login to work with, if not then fail + if ( !empty($info['db_root_user']) && !empty($info['db_root_pass']) ) + { + // Log in with root rights and if that works, tell 'em we'll create the database. + $test_root = @mysql_connect($info['db_host'], $info['db_root_user'], $info['db_root_pass']); + if ( $test_root ) + { + // We logged in with root rights, assume that we have appropriate permissions. + // If not, well, the installation will fail. Tough on the user, but creating + // test databases/users is too risky. + + // See if the database already exists + $dbname = mysql_real_escape_string($info['db_name']); + $q = @mysql_query("SHOW DATABASES LIKE '$dbname';", $test_root); + if ( $q ) + { + if ( mysql_num_rows($q) > 0 ) + { + $return['creating_db'] = false; + $return['creating_db_grant'] = true; + } + @mysql_free_result($q); + } + + $version = mysql_get_server_info($test); + $return['version'] = array( + 'version' => $version, + 'good' => version_compare($version, '4.0.17', '>=') + ); + + $return['can_install'] = ( $return['version']['good'] ) ? true : false; + } + else + { + // Well that helped. Root credentials are bad. + $return['creating_db'] = true; + $return['root_fail'] = true; + } + } + // No root credentials, fail out + } + } + + if ( isset($test) && @is_resource($test) ) + @mysql_close($test); + + if ( isset($test_root) && @is_resource($test_root) ) + @mysql_close($test_root); + + echo enano_json_encode($return); + + exit(); +} + +$ui->add_header(''); +$ui->show_header(); + +?> + +
+ MySQL logo +
+ +

get('dbmysql_blurb_needdb'); ?>

+

get('dbmysql_blurb_howtomysql'); ?>

+ + ' . $lang->get('database_vm_login_info', array( 'host' => 'localhost', 'user' => 'enano', 'pass' => 'clurichaun', 'name' => 'enano_www1' )) . ' +

'; +} +?> + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

get('dbmysql_table_title'); ?>

+
+ get('dbmysql_field_hostname_title'); ?> +
get('dbmysql_field_hostname_body'); ?> +
+
+ + + Good/bad icon +
+ get('dbmysql_field_dbname_title'); ?>
+ get('dbmysql_field_dbname_body'); ?>
+ +
+ + + Good/bad icon +
+ get('dbmysql_field_dbauth_title'); ?>
+ get('dbmysql_field_dbauth_body'); ?>
+ +
+
+
+ +
+ Good/bad icon +
+

get('database_heading_optionalinfo'); ?>

+
+ get('dbmysql_field_tableprefix_title'); ?>
+ get('dbmysql_field_tableprefix_body'); ?> +
+ + + Good/bad icon +
+ get('dbmysql_field_rootauth_title'); ?>
+ get('dbmysql_field_rootauth_body'); ?>
+ +
+
+
+ +
+ Good/bad icon +
+ get('dbmysql_field_mysqlversion_title'); ?> + + get('dbmysql_field_mysqlversion_blurb_willbechecked'); ?> + + Good/bad icon +
+ get('dbmysql_field_droptables_title'); ?>
+ get('dbmysql_field_droptables_body'); ?> +
+ +
+ +
+
+ + + + + + +
+ + +

+ get('meta_lbl_before_continue'); ?>
+ • get('database_objective_test'); ?>
+ • get('database_objective_uncrypt'); ?> +

+
+ +
+ + + diff -r 299a90e28abc -r 87e08a6e4fec install/includes/stages/database_post.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/includes/stages/database_post.php Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,168 @@ +connect(true, $db_host, $db_user, $db_pass, $db_name); + +$ui->show_header(); + +if ( $result ) +{ + // We're good, write out a config file + $ch = @fopen( ENANO_ROOT . '/config.new.php', 'w' ); + if ( !$ch ) + { + ?> +
+

Configuration file generation failed.

+

Couldn't open the configuration file to write out database settings. Check your file permissions.

+

+ +

+
+ That table prefix isn\'t going to work.

'; + return true; + } + fwrite($ch, " +

Can't load schema file

+

The SQL schema file couldn't be loaded.

+ $e"; ?> + sql_query('SELECT config_name, config_value FROM ' . $db_prefix . 'config LIMIT 1;'); + if ( !$q ) + { + $sql_parser->assign_vars(array( + 'TABLE_PREFIX' => $db_prefix + )); + $sql = $sql_parser->parse(); + foreach ( $sql as $q ) + { + if ( !$dbal->sql_query($q) ) + { + ?> +
+ + +

Database operation failed

+

The installer couldn't create one of the tables used for installation.

+

Error description: + sql_error(); + ?> +

+

+ +

+
+ free_result(); + if ( !$dbal->sql_query('DELETE FROM ' . $db_prefix . 'config WHERE config_name = \'install_aes_key\';') ) + { + $dbal->_die('install database_post.php trying to remove old AES installer key'); + } + } + $dbal->close(); + ?> +
+ + +

Connection successful

+

The database has been contacted and initial tables created successfully. Redirecting...

+

Click if you're not redirected within 2 seconds

+
+ + +
+ + +

Database connection failed

+

The installer couldn't connect to the database because something went wrong while the connection attempt was being made. Please press your browser's back button and correct your database information.

+

Error description: + sql_error(); + ?> +

+

+ +

+
+ false, + 'host_good' => true, + 'creating_user' => false, + 'db_exist' => false, + 'creating_db' => false, + 'creating_db_grant' => false, + 'root_fail' => false, + 'version' => array( + 'version' => 'unknown', + 'good' => 'indeterminate' + ), + 'last_error' => '' + ); + + if ( !isset($_POST['info']) ) + die(); + + $info = $_POST['info']; + + // From here on out will be JSON responses + header('Content-type: application/json'); + + try + { + $info = @enano_json_decode($info); + } + catch ( Zend_Json_Exception $e ) + { + die(enano_json_encode(array( + 'mode' => 'error', + 'error' => 'Exception in JSON decoder' + ))); + } + + // Try to connect as the normal user + // generate connection string + $conn_string = "dbname = '" . addslashes($info['db_name']) . "' port = '5432' host = '" . addslashes($info['db_host']) . "' " . + "user= '" . addslashes($info['db_user']) . "' password = '" . addslashes($info['db_pass']) . "'"; + $test = @pg_connect($conn_string); + if ( !$test ) + { + // Connection as normal user failed. PgSQL doesn't give us an error string so + // just try to connect as root. If even that fails, exit with an error + $return['creating_user'] = true; + if ( !empty($info['db_root_user']) && !empty($info['db_root_pass']) ) + { + $conn_string_root = "dbname = '" . addslashes($info['db_name']) . "' port = '5432' host = '" . addslashes($info['db_host']) . "' " . + "user= '" . addslashes($info['db_root_user']) . "' password = '" . addslashes($info['db_root_pass']) . "'"; + // Attempt connection as root + $test_root = @pg_connect($conn_string_root); + if ( !$test_root ) + { + $return['root_fail'] = true; + } + else + { + $return['can_install'] = true; + } + } + } + else + { + $return['can_install'] = true; + } + + $did_version_check = false; + + if ( isset($test) && @is_resource($test) ) + { + $server_info = @pg_version($test); + if ( isset($server_info['server']) ) + { + $did_version_check = true; + $return['version'] = array( + 'version' => $server_info['server'], + 'good' => ( version_compare($server_info['server'], '8.2.5', '>=') ) + ); + } + @pg_close($test); + } + + if ( isset($test_root) && @is_resource($test_root) ) + { + $server_info = @pg_version($test_root); + if ( isset($server_info['server']) ) + { + $did_version_check = true; + $return['version'] = array( + 'version' => $server_info['server'], + 'good' => ( version_compare($server_info['server'], '8.2.5', '>=') ) + ); + } + @pg_close($test_root); + } + + if ( !$did_version_check ) + { + $return['version'] = array( + 'version' => 'indeterminate', + 'good' => false + ); + } + else + { + if ( !$return['version']['good'] ) + { + $return['can_install'] = false; + } + } + + echo enano_json_encode($return); + + exit(); +} + +$ui->add_header(''); +$ui->show_header(); + +?> + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

get('dbpgsql_table_title'); ?>

+
+ get('dbpgsql_field_hostname_title'); ?> +
get('dbpgsql_field_hostname_body'); ?> +
+
+ + + Good/bad icon +
+ get('dbpgsql_field_dbname_title'); ?>
+ get('dbpgsql_field_dbname_body'); ?>
+ +
+ + + Good/bad icon +
+ get('dbpgsql_field_dbauth_title'); ?>
+ get('dbpgsql_field_dbauth_body'); ?>
+ +
+
+
+ +
+ Good/bad icon +
+

get('database_heading_optionalinfo'); ?>

+
+ get('dbpgsql_field_tableprefix_title'); ?>
+ get('dbpgsql_field_tableprefix_body'); ?> +
+ + + Good/bad icon +
+ get('dbpgsql_field_rootauth_title'); ?>
+ get('dbpgsql_field_rootauth_body'); ?>
+ +
+
+
+ +
+ Good/bad icon +
+ get('dbpgsql_field_pgsqlversion_title'); ?> + + get('dbpgsql_field_pgsqlversion_blurb_willbechecked'); ?> + + Good/bad icon +
+ get('dbpgsql_field_droptables_title'); ?>
+ get('dbpgsql_field_droptables_body'); ?> +
+ +
+ +
+
+ + + + + + +
+ + +

+ get('meta_lbl_before_continue'); ?>
+ • get('database_objective_test'); ?>
+ • get('database_objective_uncrypt'); ?> +

+
+ +
+ + + diff -r 299a90e28abc -r 87e08a6e4fec install/includes/stages/install.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/includes/stages/install.php Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,97 @@ +show_header(); + echo '

Installation error

+

ERROR: That database driver is not supported.

'; + return true; +} + +$db = new $dbdriver(); +$result = $db->connect(true, $dbhost, $dbuser, $dbpasswd, $dbname); +if ( !$result ) +{ + $ui->show_header(); + // FIXME: l10n + ?> +
+ + +

Database connection failed

+

The installer couldn't connect to the database because something went wrong while the connection attempt was being made. Please press your browser's back button and correct your database information.

+

Error description: + sql_error(); + ?> +

+

+ +

+
+ show_header(); +flush(); + +?> +

Installing Enano

+

Please wait while Enano creates its database and initial content on your server.

+ +

Installation progress

+ +close(); + diff -r 299a90e28abc -r 87e08a6e4fec install/includes/stages/license.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/includes/stages/license.php Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,100 @@ + +
+ +

get('license_info_unstable_title'); ?>

+

get('license_info_unstable_body'); ?>

+ +

get('license_section_gpl_heading'); ?>

+ lang_code != 'eng' ): ?> +

get('license_gpl_blurb_inenglish'); ?>

+ + + Because I could never find the Create a Page button in PHP-Nuke.

'; + echo '

' . str_replace('http://enanocms.org/', 'http://www.2robots.com/2003/10/15/web-portals-suck/', $template->fading_button) . '

'; + echo '

It\'s not a portal, my friends.

'; + } + ?> +
+ setRenderConf('Xhtml', 'code', 'css_filename', 'codefilename'); + $wiki->setRenderConf('Xhtml', 'wikilink', 'view_url', contentPath); + $result = $wiki->transform($message, 'Xhtml'); + + // HTML fixes + $result = preg_replace('#([\s]*?)<\/tr>#is', '', $result); + $result = preg_replace('#

([\s]*?)<\/p>#is', '', $result); + $result = preg_replace('#
([\s]*?) +

get('license_heading'); ?>

+

get('license_blurb_thankyou'); ?>

+

get('license_blurb_pleaseread'); ?>

+ + + diff -r 299a90e28abc -r 87e08a6e4fec install/includes/stages/login.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/includes/stages/login.php Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,228 @@ +connect(true, $dbhost, $dbuser, $dbpasswd, $dbname); +if ( !$result ) + die('DB privileges were revoked'); + +// Is the key in the database? +$q = $db->sql_query('SELECT config_value FROM ' . table_prefix . 'config WHERE config_name = \'install_aes_key\';'); +if ( !$q ) + $db->_die(); +if ( $db->numrows() > 0 ) +{ + list($install_aes_key) = $db->fetchrow_num(); +} +else +{ + $aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE); + $install_aes_key = $aes->gen_readymade_key(); + + if ( ! $db->sql_query('INSERT INTO ' . table_prefix . 'config ( config_name, config_value ) VALUES ( \'install_aes_key\', \'' . $install_aes_key .'\' ); ') ) + $db->_die(); +} +$db->free_result($q); + +$ui->add_header(''); +$ui->show_header(); + +// FIXME: l10n +?> +

Administration account

+

Now it's time to create the account you'll use to administer your site. The e-mail address you enter here will also be used for the global contact address; you can change this after installation is finished if need be.

+

Do not forget the information you enter here. Otherwise you will be unable to administer your site.

+ + + +
&$value ) + { + if ( !preg_match('/^[a-z0-9_]+$/', $key) ) + die('You idiot hacker...'); + if ( $key == '_cont' ) + continue; + $value_clean = str_replace(array('\\', '"', '<', '>'), array('\\\\', '\\"', '<', '>'), $value); + echo "\n "; + } + + $https = ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ); + $scriptpath_full = 'http' . ( $https ? 's' : '' ) . '://' . $_SERVER['HTTP_HOST'] . scriptPath . '/'; + ?> + + + + + + + + + + + + + + + + + + + + + + + + +
+ Username + + + + Good/bad icon +
+ Password
+ This will be encrypted with AES before it's sent to the server. +
+
+
+
+
+ (confirm) +
+ Good/bad icon +
+ E-mail + + + + Good/bad icon +
+ +
+ +
+
diff -r 299a90e28abc -r 87e08a6e4fec install/includes/stages/sysreqs.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/includes/stages/sysreqs.php Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,147 @@ +$descTest passed"; + } elseif(!$val && $warn) { + if($cv) $color='FFFFCC'; else $color='FFFFAA'; + echo "$desc
$extended_descTest passed with warning"; + $warned = true; + } else { + if($cv) $color='FFCCCC'; else $color='FFAAAA'; + echo "$desc
$extended_descTest failed"; + $failed = true; + } +} +function is_apache() +{ + $r = strstr($_SERVER['SERVER_SOFTWARE'], 'Apache') ? true : false; + return $r; +} + +function config_write_test() +{ + if ( !is_writable(ENANO_ROOT.'/config.new.php') ) + return false; + // We need to actually _open_ the file to make sure it can be written, because sometimes this fails even when is_writable() returns + // true on Windows/IIS servers. Don't ask me why. + $h = @fopen( ENANO_ROOT . '/config.new.php', 'a+' ); + if ( !$h ) + return false; + fclose($h); + return true; +} + +?> +

get('sysreqs_heading'); ?>

+

get('sysreqs_blurb'); ?>

+ + + +get('sysreqs_req_php5'), $lang->get('sysreqs_req_desc_php5'), true); +run_test('return function_exists(\'mysql_connect\');', $lang->get('sysreqs_req_mysql'), $lang->get('sysreqs_req_desc_mysql') ); +run_test('return function_exists(\'pg_connect\');', $lang->get('sysreqs_req_postgres'), $lang->get('sysreqs_req_desc_postgres'), true); +run_test('return @ini_get(\'file_uploads\');', $lang->get('sysreqs_req_uploads'), $lang->get('sysreqs_req_desc_uploads') ); +run_test('return is_apache();', $lang->get('sysreqs_req_apache'), $lang->get('sysreqs_req_desc_apache'), true); +run_test('return config_write_test();', $lang->get('sysreqs_req_config'), $lang->get('sysreqs_req_desc_config') ); +run_test('return file_exists(\'/usr/bin/convert\');', $lang->get('sysreqs_req_magick'), $lang->get('sysreqs_req_desc_magick'), true); +run_test('return is_writable(ENANO_ROOT.\'/cache/\');', $lang->get('sysreqs_req_cachewriteable'), $lang->get('sysreqs_req_desc_cachewriteable'), true); +run_test('return is_writable(ENANO_ROOT.\'/files/\');', $lang->get('sysreqs_req_fileswriteable'), $lang->get('sysreqs_req_desc_fileswriteable'), true); +if ( !function_exists('mysql_connect') && !function_exists('pg_connect') ) +{ + // FIXME: l10n + run_test('return false;', 'No database drivers are available.', 'You need to have at least one database driver working to install Enano. See the warnings on MySQL and PostgreSQL above for more information on installing these database drivers.', false); +} +echo '
'; +echo '
'; +if(!$failed) +{ + ?> + + +'; + run_test('return false;', $lang->get('sysreqs_summary_fail_title'), $lang->get('sysreqs_summary_fail_body')); + echo '
'; + } +} + +?> diff -r 299a90e28abc -r 87e08a6e4fec install/includes/stages/website.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/includes/stages/website.php Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,258 @@ +add_header(''); +$ui->show_header(); + +?> + + + +
&$value ) + { + if ( !preg_match('/^[a-z0-9_]+$/', $key) ) + die('You idiot hacker...'); + if ( $key == '_cont' ) + continue; + $value_clean = str_replace(array('\\', '"', '<', '>'), array('\\\\', '\\"', '<', '>'), $value); + echo "\n "; + } + + $https = ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ); + $scriptpath_full = 'http' . ( $https ? 's' : '' ) . '://' . $_SERVER['HTTP_HOST'] . scriptPath . '/'; + ?> + + + + + + + + + + + + + + + + + + + + + + + +
+ Pick a name
+ Now for the fun part - it's time to name your website. Try to pick something that doesn't include any special characters, since this can make project-page URLs look botched. +
+ +
+ Enter a short description
+ Here you should enter a very short description of your site. Sometimes this is a slogan or, depending on the theme you've chosen, a set of keywords that can go into a META description tag. +
+ +
+ Copyright info
+ The text you enter here will be shown at the bottom of most pages. Typically this is where a copyright notice would go. Keep it short and sweet; you can use internal links to link to project pages you'll create later. +
+ +
+ URL formatting
+ This lets you choose how URLs within your site will be formatted. If the setting you pick doesn't work, you can change it by editing config.php after installation. +
+ + + + + + +
+ + + + +

Compatible with all servers. This is the default option and should be used unless you're sure that one of the other options below.

+

Example:

+
+
+ + + + + + +
+ + + + +

This eliminates the "?title=" portion of your URL, and instead uses a slash. This is occasionally more friendly to search engines.

+

Example:

+
+
+ + + + + + +
+ + + + +

Using this option, you can completely eliminate the "index.php" from URLs. This is the most friendly option to search engines and looks very professional, but requires support for URL rewriting on your server. If you're running Apache and have the right permissions, Enano can configure this automatically. Otherwise, you'll need to configure your server manually and have a knowledge of regular expressions for this option to work.

+

Example:

+
+
+ +

+ Auto-detect the best formatting scheme +

+ +
+ +
+ +
+ +
+ +
+ diff -r 299a90e28abc -r 87e08a6e4fec install/includes/ui.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/includes/ui.php Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,243 @@ + section + * @var array Will be implode()'ed + */ + + var $additional_headers = array(); + + /** + * Constructor. + * @param string The name displayed in the tag + * @param bool If true, the simplified header format is displayed. + */ + + function __construct($app_name, $simple_header) + { + $this->stages = array( + 'main' => array(), + 'hide' => array() + ); + $this->app_name = $app_name; + $this->simple = ( $simple_header ) ? true : false; + } + + /** + * Adds more text to the HTML header. + * @param string + */ + + function add_header($html) + { + $this->additional_headers[] = $html; + } + + /** + * Adds a stage to the installer. + * @param string Title of the stage, should be already put through $lang->get() + * @param bool If true, the stage is shown among possible stages at the top of the window. If false, acts as a hidden stage + * @return string Unique identifier for stage, used later on set_visible_stage() + */ + + function add_stage($stage, $visible = true) + { + $key = ( $visible ) ? 'main' : 'hide'; + $guid = md5(microtime() . mt_rand()); + $this->stages[$key][$guid] = $stage; + if ( empty($this->current_stage) ) + $this->current_stage = $guid; + return $guid; + } + + /** + * Resets the active stage of installation. This is for the UI only; it doesn't actually change how the backend works. + * @param string GUID of stage, returned from add_stage() + * @return bool true on success, false if stage GUID not found + */ + + function set_visible_stage($guid) + { + foreach ( $this->stages['main'] as $key => $stage_name ) + { + if ( $key == $guid ) + { + $this->current_stage = $guid; + return true; + } + } + foreach ( $this->stages['hide'] as $key => $stage_name ) + { + if ( $key == $guid ) + { + $this->current_stage = $guid; + return true; + } + } + return false; + } + + /** + * Outputs the HTML headers and start of the <body>, including stage indicator + */ + + function show_header() + { + // Determine the name of the current stage + $stage_name = false; + + if ( isset($this->stages['main'][$this->current_stage]) ) + $stage_name = $this->stages['main'][$this->current_stage]; + else if ( isset($this->stages['hide'][$this->current_stage]) ) + $stage_name = $this->stages['hide'][$this->current_stage]; + else + // Can't determine name of stage + return false; + + $this->app_name = htmlspecialchars($this->app_name); + $stage_name = htmlspecialchars($stage_name); + + global $lang; + if ( is_object($lang) && isset($GLOBALS['lang_uri']) ) + { + $lang_uri = sprintf($GLOBALS['lang_uri'], $lang->lang_code); + $this->add_header('<script type="text/javascript" src="' . $lang_uri . '"></script>'); + } + + $additional_headers = implode("\n ", $this->additional_headers); + $title = addslashes(str_replace(' ', '_', $stage_name)); + $js_dynamic = '<script type="text/javascript"> + var title="' . $title . '"; + var scriptPath="'.scriptPath.'"; + var ENANO_SID=""; + var AES_BITS='.AES_BITS.'; + var AES_BLOCKSIZE=' . AES_BLOCKSIZE . '; + var pagepass=\'\'; + var ENANO_LANG_ID = 1; + var DISABLE_MCE = true; + </script>'; + + echo <<<EOF +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <title>{$stage_name} • {$this->app_name} + + + + $js_dynamic + + $additional_headers + + +
+ +EOF; + if ( !$this->simple ) + { + $step = ( !empty($this->step) ) ? '
' . htmlspecialchars($this->step) . '
' : ''; + echo << + $step + Enano logo +
+ +EOF; + } + $stages_class = ( $this->simple ) ? 'stages' : 'stages stages-fixed'; + echo << +
    + +EOF; + foreach ( $this->stages['main'] as $guid => $stage ) + { + $class = ( $guid == $this->current_stage ) ? 'stage stage-active' : 'stage'; + $stage = htmlspecialchars($stage); + echo "
  • $stage
  • \n "; + } + echo "
\n
\n \n"; + echo "
\n "; + echo "
\n "; + } + + /** + * Displays the page footer. + */ + + function show_footer() + { + echo << + Enano and its various components, related documentation, and artwork are copyright © 2006-2008 Dan Fuhry.
+ This program is Free Software; see the file "GPL" included with this package for details. +
+
+ + + + +EOF; + } + +} + +?> diff -r 299a90e28abc -r 87e08a6e4fec install/index.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/index.php Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,129 @@ +__construct('Enano installation', true); +} +$ui->add_stage('Welcome', true); +$ui->add_stage('Installation', true); +$ui->add_stage('Upgrade', true); +$ui->add_stage('Readme', true); + +$ui->show_header(); + +if ( defined('ENANO_INSTALLED') ) +{ + // Is Enano installed? If so, load the config and check version info + define('IN_ENANO_UPGRADE', 'true'); + // common.php above calls chdir() to the ENANO_ROOT, so this loads the full Enano API. + require('includes/common.php'); +} + +?> + +
+ +
+ Enano hasn't been installed yet!
+ You'll need to install the Enano database before you can use your site. To get started, click the Install button below. +
+ +
+ A configuration file (config.php) exists but doesn't set the ENANO_INSTALLED constant.
+

Didn't expect to see this message? + It's possible that your configuration file has become corrupted and no longer sets information that Enano needs to connect + to the database. You should have a look at your config.php by downloading it with FTP or viewing it over SSH. + If the file appears to have been tampered with, please contact the Enano team + for support immediately.

+

Most importantly, if you suspect a security breach, you should contact the Enano team + via e-mail. If you have the capability to use PGP encryption, you should do + so; our public key is available here.

+
+ +
+ + + + + + +
+ + Enano CMS + + + +
+ +show_footer(); + +?> diff -r 299a90e28abc -r 87e08a6e4fec install/install.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/install.php Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,275 @@ +load_file(ENANO_ROOT . '/language/' . $language_dir . '/install.json'); + $lang_uri = 'install.php?do=lang_js&language=%s'; + + // Init UI + $ui = new Enano_Installer_UI($lang->get('meta_site_name'), false); + + // Add stages + foreach ( $stages as $stage ) + { + $stage_ids[$stage] = $ui->add_stage($lang->get("{$stage}_modetitle"), true); + } + + // Determine stage + if ( isset($_REQUEST['stage']) && isset($stage_ids[$_REQUEST['stage']]) ) + { + $ui->set_visible_stage($stage_ids[$_REQUEST['stage']]); + $stage = $_REQUEST['stage']; + } + else + { + $stage = 'license'; + } + + $stage_num = array_search($stage, $stages); + if ( $stage_num ) + { + $stage_num++; + $ui->step = $lang->get('meta_step', array('step' => $stage_num, 'title' => $lang->get("{$stage}_modetitle_long"))); + } +} +else +{ + $ui = new Enano_Installer_UI('Enano installation', false); + + if ( version_compare(PHP_VERSION, '5.0.0', '<') ) + { + $ui->__construct('Enano installation', false); + } + + $ui->step = 'Step 1: Choose language'; + + $stage = 'language'; + $stage_ids['language'] = $ui->add_stage('Language', true); + $stage_ids['license'] = $ui->add_stage('License', true); + $stage_ids['sysreqs'] = $ui->add_stage('Requirements', true); + $stage_ids['database'] = $ui->add_stage('Database', true); + $stage_ids['website'] = $ui->add_stage('Site info', true); + $stage_ids['login'] = $ui->add_stage('Admin login', true); + $stage_ids['confirm'] = $ui->add_stage('Review', true); + $stage_ids['install'] = $ui->add_stage('Install', true); + $stage_ids['finish'] = $ui->add_stage('Finish', true); +} + +// If we don't have PHP 5, show a friendly error message and bail out +if ( version_compare(PHP_VERSION, '5.0.0', '<') || isset($_GET['debug_warn_php4']) ) +{ + $ui->set_visible_stage( + $ui->add_stage('PHP compatibility notice', false) + ); + $ui->step = ''; + $ui->show_header(); + + // This isn't localized because all localization code is dependent on + // PHP 5 (loading lang.php will throw a parser error under PHP4). This + // one message probably doesn't need to be localized anyway. + + ?> +

+ Your server doesn't have support for PHP 5. +

+

+ PHP 5 is the latest version of the language on which Enano was built. Its many new features have been available since early 2004, yet + many web hosts have not migrated to it because of the work involved. In 2007, Zend Corporation announced that support for the aging + PHP 4.x would be discontinued at the end of the year. An initiative called GoPHP5 was started to + encourage web hosts to migrate to PHP 5. +

+

+ Because of the industry's decision to not support PHP 4 any longer, the Enano team decided that it was time to begin using the powerful + features of PHP 5 at the expense of PHP 4 compatibility. Therefore, this version of Enano cannot be installed on your server until it + is upgraded to at least PHP 5.0.0, and preferably the latest available version. + +

+

+ If you need to use Enano but can't upgrade your PHP because you're on a shared or reseller hosting service, you can use the + 1.0.x series of Enano on your site. While the Enano team attempts to make this + older series work on PHP 4, official support is not provided for installations of Enano on PHP 4. +

+ show_footer(); + exit(); +} + +if ( isset($_SERVER['PATH_INFO']) && !isset($_GET['str']) && isset($_GET['do']) ) +{ + $_GET['str'] = substr($_SERVER['PATH_INFO'], 1); +} + +if ( isset($_GET['do']) ) +{ + switch ( $_GET['do'] ) + { + case 'lang_js': + if ( !isset($_GET['language']) ) + die(); + $lang_id = $_GET['language']; + header('Content-type: text/javascript'); + if ( !isset($languages[$lang_id]) ) + { + die('// Bad language ID'); + } + $language_dir = $languages[$lang_id]['dir']; + + // Include language lib and additional PHP5-only JSON functions + require_once( ENANO_ROOT . '/includes/json2.php' ); + require_once( ENANO_ROOT . '/includes/lang.php' ); + + // Initialize language support + $lang = new Language($lang_id); + $lang->load_file(ENANO_ROOT . '/language/' . $language_dir . '/install.json'); + $lang->load_file(ENANO_ROOT . '/language/' . $language_dir . '/core.json'); + + $time_now = microtime_float(); + $test = "if ( typeof(enano_lang) != 'object' ) +{ + var enano_lang = new Object(); + var enano_lang_code = new Object(); +} + +enano_lang[{$lang->lang_id}] = " . enano_json_encode($lang->strings) . "; +enano_lang_code[{$lang->lang_id}] = '{$lang->lang_code}';"; + $time_total = round(microtime_float() - $time_now, 4); + echo "// Generated in $time_total seconds\n"; + echo $test; + + exit(); + case 'modrewrite_test': + // Include language lib and additional PHP5-only JSON functions + require_once( ENANO_ROOT . '/includes/json2.php' ); + + if ( isset($_GET['str']) && in_array($_GET['str'], array('standard', 'shortened', 'rewrite')) ) + { + echo 'good_' . $_GET['str']; + } + else + { + echo 'bad'; + } + exit(); + } +} + +switch ( $stage ) +{ + default: + $ui->show_header(); + echo '

Invalid stage.

'; + break; + case 'language': + $ui->show_header(); + ?> +

Welcome to Enano.

+

Bienvenido a Enano / + Wilkommen in Enano / + Bienvenue à Enano / + Benvenuti a Enano / + 欢迎 Enano / + Enano へようこそ。 +

+

+ Please select a language: / + Por favor, seleccione un idioma: / + Bitte wählen Sie eine Sprache: / + S’il vous plaît choisir une langue: / + Selezionare una lingua: / + 请选择一种语言: / + 言語を選択してください:

+
+ + +
+ show_header(); + require( ENANO_ROOT . '/includes/wikiformat.php' ); + require( ENANO_ROOT . '/install/includes/stages/license.php' ); + break; + case 'sysreqs': + $ui->show_header(); + require( ENANO_ROOT . '/install/includes/stages/sysreqs.php' ); + break; + case 'database': + if ( isset($_POST['driver']) && in_array($_POST['driver'], $supported_drivers) ) + { + // This is SAFE! It's validated against the array in in_array() above. + $driver = $_POST['driver']; + require( ENANO_ROOT . "/install/includes/stages/database_{$driver}.php" ); + } + else + { + $ui->show_header(); + // No driver selected - give the DB drive selection page + require( ENANO_ROOT . '/install/includes/stages/database.php' ); + } + break; + case 'website': + require( ENANO_ROOT . '/install/includes/stages/website.php' ); + break; + case 'login': + require( ENANO_ROOT . '/install/includes/stages/login.php' ); + break; + case 'confirm': + require( ENANO_ROOT . '/install/includes/stages/confirm.php' ); + break; + case 'install': + require( ENANO_ROOT . '/install/includes/stages/install.php' ); + break; +} + +$ui->show_footer(); + +?> diff -r 299a90e28abc -r 87e08a6e4fec install/readme.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/readme.php Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,41 @@ +add_stage('Readme and important information', true); + +$ui->set_visible_stage($stg_readme); + +$ui->show_header(); + +?> +

Readme

+

This document contains important information you'll want to know before you install Enano. For installation instructions, please + see the Enano installation guide. Return to welcome menu »

+
+show_footer(); + +?> diff -r 299a90e28abc -r 87e08a6e4fec install/schemas/mysql_stage1.sql --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/schemas/mysql_stage1.sql Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,17 @@ +-- Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between +-- Version 1.0.2 (Coblynau) +-- Copyright (C) 2006-2007 Dan Fuhry + +-- This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +-- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied +-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + +-- mysql_stage1.sql - MySQL installation schema, early stage + +CREATE TABLE {{TABLE_PREFIX}}config( + config_name varchar(63), + config_value text +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + diff -r 299a90e28abc -r 87e08a6e4fec install/schemas/mysql_stage2.sql --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/schemas/mysql_stage2.sql Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,343 @@ +-- Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between +-- Version 1.0.2 (Coblynau) +-- Copyright (C) 2006-2007 Dan Fuhry + +-- This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +-- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied +-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + +-- mysql_stage2.sql - MySQL installation schema, main payload + +CREATE TABLE {{TABLE_PREFIX}}categories( + page_id varchar(64), + namespace varchar(64), + category_id varchar(64) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + +CREATE TABLE {{TABLE_PREFIX}}comments( + comment_id int(12) NOT NULL auto_increment, + page_id text, + namespace text, + subject text, + comment_data text, + name text, + approved tinyint(1) default 1, + user_id mediumint(8) NOT NULL DEFAULT -1, + time int(12) NOT NULL DEFAULT 0, + PRIMARY KEY ( comment_id ) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + +CREATE TABLE {{TABLE_PREFIX}}logs( + log_type varchar(16), + action varchar(16), + time_id int(12) NOT NULL default '0', + date_string varchar(63), + page_id text, + namespace text, + page_text text, + char_tag varchar(40), + author varchar(63), + edit_summary text, + minor_edit tinyint(1) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + +CREATE TABLE {{TABLE_PREFIX}}page_text( + page_id varchar(255), + namespace varchar(16) NOT NULL default 'Article', + page_text text, + char_tag varchar(63), + FULLTEXT KEY {{TABLE_PREFIX}}page_search_idx (page_id, namespace, page_text) +) ENGINE = MYISAM CHARACTER SET `utf8`; + +CREATE TABLE {{TABLE_PREFIX}}pages( + page_order int(8), + name varchar(255), + urlname varchar(255), + namespace varchar(16) NOT NULL default 'Article', + special tinyint(1) default '0', + visible tinyint(1) default '1', + comments_on tinyint(1) default '1', + protected tinyint(1) NOT NULL DEFAULT 0, + wiki_mode tinyint(1) NOT NULL DEFAULT 2, + delvotes int(10) NOT NULL default 0, + password varchar(40) NOT NULL DEFAULT '', + delvote_ips text DEFAULT NULL +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + +CREATE TABLE {{TABLE_PREFIX}}session_keys( + session_key varchar(32), + salt varchar(32), + user_id mediumint(8), + auth_level tinyint(1) NOT NULL default '0', + source_ip varchar(10) default '0x7f000001', + time bigint(15) default '0' +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + +CREATE TABLE {{TABLE_PREFIX}}themes( + theme_id varchar(63), + theme_name text, + theme_order smallint(5) NOT NULL default '1', + default_style varchar(63) NOT NULL DEFAULT '', + enabled tinyint(1) NOT NULL default '1' +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + +CREATE TABLE {{TABLE_PREFIX}}users( + user_id mediumint(8) NOT NULL auto_increment, + username text, + password varchar(255), + email text, + real_name text, + user_level tinyint(1) NOT NULL default 2, + theme varchar(64) NOT NULL default 'bleu.css', + style varchar(64) NOT NULL default 'default', + signature text, + reg_time int(11) NOT NULL DEFAULT 0, + account_active tinyint(1) NOT NULL DEFAULT 0, + activation_key varchar(40) NOT NULL DEFAULT 0, + old_encryption tinyint(1) NOT NULL DEFAULT 0, + temp_password text, + temp_password_time int(12) NOT NULL DEFAULT 0, + user_coppa tinyint(1) NOT NULL DEFAULT 0, + user_lang smallint(5) NOT NULL, + user_has_avatar tinyint(1) NOT NULL, + avatar_type ENUM('jpg', 'png', 'gif') NOT NULL, + PRIMARY KEY (user_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + +CREATE TABLE {{TABLE_PREFIX}}users_extra( + user_id mediumint(8) NOT NULL, + user_aim varchar(63), + user_yahoo varchar(63), + user_msn varchar(255), + user_xmpp varchar(255), + user_homepage text, + user_location text, + user_job text, + user_hobbies text, + email_public tinyint(1) NOT NULL DEFAULT 0, + PRIMARY KEY ( user_id ) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + +CREATE TABLE {{TABLE_PREFIX}}banlist( + ban_id mediumint(8) NOT NULL auto_increment, + ban_type tinyint(1), + ban_value varchar(64), + is_regex tinyint(1) DEFAULT 0, + reason text, + PRIMARY KEY ( ban_id ) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + +CREATE TABLE {{TABLE_PREFIX}}files( + file_id int(12) NOT NULL auto_increment, + time_id int(12) NOT NULL, + page_id varchar(63) NOT NULL, + filename varchar(127) default NULL, + size bigint(15) NOT NULL, + mimetype varchar(63) default NULL, + file_extension varchar(8) default NULL, + file_key varchar(32) NOT NULL, + PRIMARY KEY (file_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + +CREATE TABLE {{TABLE_PREFIX}}buddies( + buddy_id int(15) NOT NULL auto_increment, + user_id mediumint(8), + buddy_user_id mediumint(8), + is_friend tinyint(1) NOT NULL default '1', + PRIMARY KEY (buddy_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + +CREATE TABLE {{TABLE_PREFIX}}privmsgs( + message_id int(15) NOT NULL auto_increment, + message_from varchar(63), + message_to varchar(255), + date int(12), + subject varchar(63), + message_text text, + folder_name varchar(63), + message_read tinyint(1) NOT NULL DEFAULT 0, + PRIMARY KEY (message_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + +CREATE TABLE {{TABLE_PREFIX}}sidebar( + item_id smallint(3) NOT NULL auto_increment, + item_order smallint(3) NOT NULL DEFAULT 0, + item_enabled tinyint(1) NOT NULL DEFAULT 1, + sidebar_id smallint(3) NOT NULL DEFAULT 1, + block_name varchar(63) NOT NULL, + block_type tinyint(1) NOT NULL DEFAULT 0, + block_content text, + PRIMARY KEY ( item_id ) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + +CREATE TABLE {{TABLE_PREFIX}}hits( + hit_id bigint(20) NOT NULL auto_increment, + username varchar(63) NOT NULL, + time int(12) NOT NULL DEFAULT 0, + page_id varchar(63), + namespace varchar(63), + PRIMARY KEY ( hit_id ) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + +CREATE TABLE {{TABLE_PREFIX}}search_index( + word varchar(64) NOT NULL, + page_names text, + PRIMARY KEY ( word ) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + +CREATE TABLE {{TABLE_PREFIX}}groups( + group_id mediumint(5) UNSIGNED NOT NULL auto_increment, + group_name varchar(64), + group_type tinyint(1) NOT NULL DEFAULT 1, + PRIMARY KEY ( group_id ), + system_group tinyint(1) NOT NULL DEFAULT 0 +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + +CREATE TABLE {{TABLE_PREFIX}}group_members( + member_id int(12) UNSIGNED NOT NULL auto_increment, + group_id mediumint(5) UNSIGNED NOT NULL, + user_id int(12) NOT NULL, + is_mod tinyint(1) NOT NULL DEFAULT 0, + pending tinyint(1) NOT NULL DEFAULT 0, + PRIMARY KEY ( member_id ) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + +CREATE TABLE {{TABLE_PREFIX}}acl( + rule_id int(12) UNSIGNED NOT NULL auto_increment, + target_type tinyint(1) UNSIGNED NOT NULL, + target_id int(12) UNSIGNED NOT NULL, + page_id varchar(255), + namespace varchar(24), + rules text, + PRIMARY KEY ( rule_id ) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + +-- Added in 1.0.1 + +CREATE TABLE {{TABLE_PREFIX}}page_groups( + pg_id mediumint(8) NOT NULL auto_increment, + pg_type tinyint(2) NOT NULL DEFAULT 1, + pg_name varchar(255) NOT NULL DEFAULT '', + pg_target varchar(255) DEFAULT NULL, + PRIMARY KEY ( pg_id ) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + +-- Added in 1.0.1 + +CREATE TABLE {{TABLE_PREFIX}}page_group_members( + pg_member_id int(12) NOT NULL auto_increment, + pg_id mediumint(8) NOT NULL, + page_id varchar(63) NOT NULL, + namespace varchar(63) NOT NULL DEFAULT 'Article', + PRIMARY KEY ( pg_member_id ) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + +-- Added in 1.0.1 + +CREATE TABLE {{TABLE_PREFIX}}tags( + tag_id int(12) NOT NULL auto_increment, + tag_name varchar(63) NOT NULL DEFAULT 'bla', + page_id varchar(255) NOT NULL, + namespace varchar(255) NOT NULL, + user mediumint(8) NOT NULL DEFAULT 1, + PRIMARY KEY ( tag_id ) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + +-- Added in 1.1.1 + +CREATE TABLE {{TABLE_PREFIX}}lockout( + id int(12) NOT NULL auto_increment, + ipaddr varchar(40) NOT NULL, + action ENUM('credential', 'level') NOT NULL DEFAULT 'credential', + timestamp int(12) NOT NULL DEFAULT 0, + PRIMARY KEY ( id ) +) CHARACTER SET `utf8`; + +-- Added in 1.1.1 + +CREATE TABLE {{TABLE_PREFIX}}language( + lang_id smallint(5) NOT NULL auto_increment, + lang_code varchar(16) NOT NULL, + lang_name_default varchar(64) NOT NULL, + lang_name_native varchar(64) NOT NULL, + last_changed int(12) NOT NULL DEFAULT 0, + PRIMARY KEY ( lang_id ) +) CHARACTER SET `utf8`; + +-- Added in 1.1.1 + +CREATE TABLE {{TABLE_PREFIX}}language_strings( + string_id bigint(15) NOT NULL auto_increment, + lang_id smallint(5) NOT NULL, + string_category varchar(32) NOT NULL, + string_name varchar(64) NOT NULL, + string_content longtext NOT NULL, + PRIMARY KEY ( string_id ) +); + +DELETE FROM {{TABLE_PREFIX}}config; + +INSERT INTO {{TABLE_PREFIX}}config(config_name, config_value) VALUES + ('site_name', '{{SITE_NAME}}'), + ('main_page', 'Main_Page'), + ('site_desc', '{{SITE_DESC}}'), + ('wiki_mode', '{{WIKI_MODE}}'), + ('wiki_edit_notice', '0'), + ('sflogo_enabled', '0'), + ('sflogo_groupid', ''), + ('sflogo_type', '1'), + ('w3c_vh32', '0'), + ('w3c_vh40', '0'), + ('w3c_vh401', '0'), + ('w3c_vxhtml10', '0'), + ('w3c_vxhtml11', '0'), + ('w3c_vcss', '0'), + ('approve_comments', '0'), + ('enable_comments', '1'), + ('plugin_SpecialAdmin.php', '1'), + ('plugin_SpecialPageFuncs.php', '1'), + ('plugin_SpecialUserFuncs.php', '1'), + ('plugin_SpecialCSS.php', '1'), + ('copyright_notice', '{{COPYRIGHT}}'), + ('wiki_edit_notice_text', '== Why can I edit this page? ==\n\nEveryone can edit almost any page in this website. This concept is called a wiki. It gives everyone the opportunity to make a change for the best. While some spam and vandalism may occur, it is believed that most contributions will be legitimate and helpful.\n\nFor security purposes, a history of all page edits is kept, and administrators are able to restore vandalized or spammed pages with just a few clicks.'), + ('cache_thumbs', '{{ENABLE_CACHE}}'), + ('max_file_size', '256000'),('enano_version', '{{VERSION}}'),( 'allowed_mime_types', 'cbf:len=185;crc=55fb6f14;data=0[1],1[4],0[3],1[1],0[22],1[1],0[16],1[3],0[16],1[1],0[1],1[2],0[6],1[1],0[1],1[1],0[4],1[2],0[3],1[1],0[48],1[2],0[2],1[1],0[4],1[1],0[37]|end' ), + ('contact_email', '{{ADMIN_EMAIL}}'), + ('powered_btn', '1'); + +INSERT INTO {{TABLE_PREFIX}}page_text(page_id, namespace, page_text, char_tag) VALUES + ('Main_Page', 'Article', '=== Enano has been successfully installed and is working. ===\n\nIf you can see this message, it means that you\'ve finished the Enano setup process and are ready to start building your website. Congratulations!\n\nTo edit this front page, click the Log In button to the left, enter the credentials you provided during the installation, and click the Edit This Page button that appears on the blue toolbar just above this text. You can also [http://docs.enanocms.org/Help:2.4 learn more] about editing pages.\n\nTo create more pages, use the Create a Page button to the left. If you enabled wiki mode, you don\'t have to log in first, however your IP address will be shown in the page history.\n\nVisit the [http://docs.enanocms.org/Help:Contents Enano documentation project website] to learn more about administering your site effectively and keeping things secure.\n\n\'\'\'NOTE:\'\'\' You have just installed an unstable version of Enano. This release is completely unsupported and may contain security issues or serious usability bugs. You should not use this release on a production website. The Enano team will not provide any type of support at all for this experimental release.', ''); + +INSERT INTO {{TABLE_PREFIX}}pages(page_order, name, urlname, namespace, special, visible, comments_on, protected, delvotes, delvote_ips) VALUES + (NULL, 'Main Page', 'Main_Page', 'Article', 0, 1, 1, 1, 0, ''); + +INSERT INTO {{TABLE_PREFIX}}themes(theme_id, theme_name, theme_order, default_style, enabled) VALUES + ('oxygen', 'Oxygen', 1, 'bleu.css', 1), + ('stpatty', 'St. Patty', 2, 'shamrock.css', 1); + +INSERT INTO {{TABLE_PREFIX}}users(user_id, username, password, email, real_name, user_level, theme, style, signature, reg_time, account_active) VALUES + (1, 'Anonymous', 'invalid-pass-hash', 'anonspam@enanocms.org', 'None', 1, 'oxygen', 'bleu', '', 0, 0), + (2, '{{ADMIN_USER}}', '{{ADMIN_PASS}}', '{{ADMIN_EMAIL}}', '{{REAL_NAME}}', 9, 'oxygen', 'bleu', '', UNIX_TIMESTAMP(), 1); + +INSERT INTO {{TABLE_PREFIX}}users_extra(user_id) VALUES + (2); + +INSERT INTO {{TABLE_PREFIX}}groups(group_id,group_name,group_type,system_group) VALUES(1, 'Everyone', 3, 1), + (2,'Administrators',3,1), + (3,'Moderators',3,1); + +INSERT INTO {{TABLE_PREFIX}}group_members(group_id,user_id,is_mod) VALUES(2, 2, 1); + +INSERT INTO {{TABLE_PREFIX}}acl(target_type,target_id,page_id,namespace,rules) VALUES + (1,2,NULL,NULL,'read=4;post_comments=4;edit_comments=4;edit_page=4;view_source=4;mod_comments=4;history_view=4;history_rollback=4;history_rollback_extra=4;protect=4;rename=4;clear_logs=4;vote_delete=4;vote_reset=4;delete_page=4;tag_create=4;tag_delete_own=4;tag_delete_other=4;set_wiki_mode=4;password_set=4;password_reset=4;mod_misc=4;edit_cat=4;even_when_protected=4;upload_files=4;upload_new_version=4;create_page=4;php_in_pages={{ADMIN_EMBED_PHP}};edit_acl=4;'), + (1,3,NULL,NULL,'read=4;post_comments=4;edit_comments=4;edit_page=4;view_source=4;mod_comments=4;history_view=4;history_rollback=4;history_rollback_extra=4;protect=4;rename=3;clear_logs=2;vote_delete=4;vote_reset=4;delete_page=4;set_wiki_mode=2;password_set=2;password_reset=2;mod_misc=2;edit_cat=4;even_when_protected=4;upload_files=2;upload_new_version=3;create_page=3;php_in_pages=2;edit_acl=2;'); + +INSERT INTO {{TABLE_PREFIX}}sidebar(item_id, item_order, sidebar_id, block_name, block_type, block_content) VALUES + (1, 1, 1, '{lang:sidebar_title_navigation}', 1, '[[Main_Page|{lang:sidebar_btn_home}]]'), + (2, 2, 1, '{lang:sidebar_title_tools}', 1, '[[$NS_SPECIAL$CreatePage|{lang:sidebar_btn_createpage}]]\n[[$NS_SPECIAL$UploadFile|{lang:sidebar_btn_uploadfile}]]\n[[$NS_SPECIAL$SpecialPages|{lang:sidebar_btn_specialpages}]]\n{if auth_admin}\n$ADMIN_LINK$\n[[$NS_SPECIAL$EditSidebar|{lang:sidebar_btn_editsidebar}]]\n{/if}'), + (3, 3, 1, '$USERNAME$', 1, '[[$NS_USER$$USERNAME$|{lang:sidebar_btn_userpage}]]\n[[$NS_SPECIAL$Contributions/$USERNAME$|{lang:sidebar_btn_mycontribs}]]\n{if user_logged_in}\n[[$NS_SPECIAL$Preferences|{lang:sidebar_btn_preferences}]]\n[[$NS_SPECIAL$PrivateMessages|{lang:sidebar_btn_privatemessages}]]\n[[$NS_SPECIAL$Usergroups|{lang:sidebar_btn_groupcp}]]\n$THEME_LINK$\n{/if}\n{if user_logged_in}\n$LOGOUT_LINK$\n{else}\n[[$NS_SPECIAL$Register|{lang:sidebar_btn_register}]]\n$LOGIN_LINK$\n[[$NS_SPECIAL$Login/$NS_SPECIAL$PrivateMessages|{lang:sidebar_btn_privatemessages}]]\n{/if}'), + (4, 4, 1, '{lang:sidebar_title_search}', 1, '

$INPUT_AUTH$

'), + (5, 2, 2, '{lang:sidebar_title_links}', 4, 'Links'); + diff -r 299a90e28abc -r 87e08a6e4fec install/schemas/postgresql_stage1.sql --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/schemas/postgresql_stage1.sql Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,17 @@ +-- Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between +-- Version 1.0.2 (Coblynau) +-- Copyright (C) 2006-2007 Dan Fuhry + +-- This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +-- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied +-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + +-- mysql_stage1.sql - MySQL installation schema, early stage + +CREATE TABLE {{TABLE_PREFIX}}config( + config_name varchar(63), + config_value text +); + diff -r 299a90e28abc -r 87e08a6e4fec install/schemas/postgresql_stage2.sql --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install/schemas/postgresql_stage2.sql Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,337 @@ +-- Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between +-- Version 1.0.2 (Coblynau) +-- Copyright (C) 2006-2007 Dan Fuhry + +-- This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +-- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied +-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + +-- mysql_stage2.sql - MySQL installation schema, main payload + +CREATE TABLE {{TABLE_PREFIX}}categories( + page_id varchar(64), + namespace varchar(64), + category_id varchar(64) +); + +CREATE TABLE {{TABLE_PREFIX}}comments( + comment_id SERIAL, + page_id text, + namespace text, + subject text, + comment_data text, + name text, + approved smallint default 1, + user_id int NOT NULL DEFAULT -1, + time int NOT NULL DEFAULT 0, + PRIMARY KEY ( comment_id ) +); + +CREATE TABLE {{TABLE_PREFIX}}logs( + log_type varchar(16), + action varchar(16), + time_id int NOT NULL default '0', + date_string varchar(63), + page_id text, + namespace text, + page_text text, + char_tag varchar(40), + author varchar(63), + edit_summary text, + minor_edit smallint +); + +CREATE TABLE {{TABLE_PREFIX}}page_text( + page_id varchar(255), + namespace varchar(16) NOT NULL default 'Article', + page_text text, + char_tag varchar(63) +); + +CREATE TABLE {{TABLE_PREFIX}}pages( + page_order int, + name varchar(255), + urlname varchar(255), + namespace varchar(16) NOT NULL default 'Article', + special smallint default '0', + visible smallint default '1', + comments_on smallint default '1', + protected smallint NOT NULL DEFAULT 0, + wiki_mode smallint NOT NULL DEFAULT 2, + delvotes int NOT NULL default 0, + password varchar(40) NOT NULL DEFAULT '', + delvote_ips text DEFAULT NULL +); + +CREATE TABLE {{TABLE_PREFIX}}session_keys( + session_key varchar(32), + salt varchar(32), + user_id int, + auth_level smallint NOT NULL default '0', + source_ip varchar(10) default '0x7f000001', + time bigint default '0' +); + +CREATE TABLE {{TABLE_PREFIX}}themes( + theme_id varchar(63), + theme_name text, + theme_order smallint NOT NULL default '1', + default_style varchar(63) NOT NULL DEFAULT '', + enabled smallint NOT NULL default '1' +); + +CREATE TABLE {{TABLE_PREFIX}}users( + user_id SERIAL, + username text, + password varchar(255), + email text, + real_name text, + user_level smallint NOT NULL default 2, + theme varchar(64) NOT NULL default 'bleu.css', + style varchar(64) NOT NULL default 'default', + signature text, + reg_time int NOT NULL DEFAULT 0, + account_active smallint NOT NULL DEFAULT 0, + activation_key varchar(40) NOT NULL DEFAULT 0, + old_encryption smallint NOT NULL DEFAULT 0, + temp_password text, + temp_password_time int NOT NULL DEFAULT 0, + user_coppa smallint NOT NULL DEFAULT 0, + PRIMARY KEY (user_id) +); + +CREATE TABLE {{TABLE_PREFIX}}users_extra( + user_id int NOT NULL, + user_aim varchar(63), + user_yahoo varchar(63), + user_msn varchar(255), + user_xmpp varchar(255), + user_homepage text, + user_location text, + user_job text, + user_hobbies text, + email_public smallint NOT NULL DEFAULT 0, + PRIMARY KEY ( user_id ) +); + +CREATE TABLE {{TABLE_PREFIX}}banlist( + ban_id SERIAL, + ban_type smallint, + ban_value varchar(64), + is_regex smallint DEFAULT 0, + reason text, + PRIMARY KEY ( ban_id ) +); + +CREATE TABLE {{TABLE_PREFIX}}files( + file_id SERIAL, + time_id int NOT NULL, + page_id varchar(63) NOT NULL, + filename varchar(127) default NULL, + size bigint NOT NULL, + mimetype varchar(63) default NULL, + file_extension varchar(8) default NULL, + file_key varchar(32) NOT NULL, + PRIMARY KEY (file_id) +); + +CREATE TABLE {{TABLE_PREFIX}}buddies( + buddy_id SERIAL, + user_id int, + buddy_user_id int, + is_friend smallint NOT NULL default '1', + PRIMARY KEY (buddy_id) +); + +CREATE TABLE {{TABLE_PREFIX}}privmsgs( + message_id SERIAL, + message_from varchar(63), + message_to varchar(255), + date int, + subject varchar(63), + message_text text, + folder_name varchar(63), + message_read smallint NOT NULL DEFAULT 0, + PRIMARY KEY (message_id) +); + +CREATE TABLE {{TABLE_PREFIX}}sidebar( + item_id SERIAL, + item_order smallint NOT NULL DEFAULT 0, + item_enabled smallint NOT NULL DEFAULT 1, + sidebar_id smallint NOT NULL DEFAULT 1, + block_name varchar(63) NOT NULL, + block_type smallint NOT NULL DEFAULT 0, + block_content text, + PRIMARY KEY ( item_id ) +); + +CREATE TABLE {{TABLE_PREFIX}}hits( + hit_id SERIAL, + username varchar(63) NOT NULL, + time int NOT NULL DEFAULT 0, + page_id varchar(63), + namespace varchar(63), + PRIMARY KEY ( hit_id ) +); + +CREATE TABLE {{TABLE_PREFIX}}search_index( + word varchar(64) NOT NULL, + page_names text, + PRIMARY KEY ( word ) +); + +CREATE TABLE {{TABLE_PREFIX}}groups( + group_id SERIAL, + group_name varchar(64), + group_type smallint NOT NULL DEFAULT 1, + PRIMARY KEY ( group_id ), + system_group smallint NOT NULL DEFAULT 0 +); + +CREATE TABLE {{TABLE_PREFIX}}group_members( + member_id SERIAL, + group_id int NOT NULL, + user_id int NOT NULL, + is_mod smallint NOT NULL DEFAULT 0, + pending smallint NOT NULL DEFAULT 0, + PRIMARY KEY ( member_id ) +); + +CREATE TABLE {{TABLE_PREFIX}}acl( + rule_id SERIAL, + target_type smallint NOT NULL, + target_id int NOT NULL, + page_id varchar(255), + namespace varchar(24), + rules text, + PRIMARY KEY ( rule_id ) +); + +-- Added in 1.0.1 + +CREATE TABLE {{TABLE_PREFIX}}page_groups( + pg_id SERIAL, + pg_type smallint NOT NULL DEFAULT 1, + pg_name varchar(255) NOT NULL DEFAULT '', + pg_target varchar(255) DEFAULT NULL, + PRIMARY KEY ( pg_id ) +); + +-- Added in 1.0.1 + +CREATE TABLE {{TABLE_PREFIX}}page_group_members( + pg_member_id SERIAL, + pg_id int NOT NULL, + page_id varchar(63) NOT NULL, + namespace varchar(63) NOT NULL DEFAULT 'Article', + PRIMARY KEY ( pg_member_id ) +); + +-- Added in 1.0.1 + +CREATE TABLE {{TABLE_PREFIX}}tags( + tag_id SERIAL, + tag_name varchar(63) NOT NULL DEFAULT 'bla', + page_id varchar(255) NOT NULL, + namespace varchar(255) NOT NULL, + user_id int NOT NULL DEFAULT 1, + PRIMARY KEY ( tag_id ) +); + +-- Added in 1.1.1 + +CREATE TABLE {{TABLE_PREFIX}}lockout( + id SERIAL, + ipaddr varchar(40) NOT NULL, + action varchar(20) NOT NULL DEFAULT 'credential', + timestamp int NOT NULL DEFAULT 0, + CHECK ( action IN ('credential', 'level') ) +); + +-- Added in 1.1.1 + +CREATE TABLE {{TABLE_PREFIX}}language( + lang_id SERIAL, + lang_code varchar(16) NOT NULL, + lang_name_default varchar(64) NOT NULL, + lang_name_native varchar(64) NOT NULL, + last_changed int NOT NULL DEFAULT 0 +); + +-- Added in 1.1.1 + +CREATE TABLE {{TABLE_PREFIX}}language_strings( + string_id SERIAL, + lang_id int NOT NULL, + string_category varchar(32) NOT NULL, + string_name varchar(64) NOT NULL, + string_content text NOT NULL +); + +DELETE FROM {{TABLE_PREFIX}}config; + +INSERT INTO {{TABLE_PREFIX}}config(config_name, config_value) VALUES + ('site_name', '{{SITE_NAME}}'), + ('main_page', 'Main_Page'), + ('site_desc', '{{SITE_DESC}}'), + ('wiki_mode', '{{WIKI_MODE}}'), + ('wiki_edit_notice', '0'), + ('sflogo_enabled', '0'), + ('sflogo_groupid', ''), + ('sflogo_type', '1'), + ('w3c_vh32', '0'), + ('w3c_vh40', '0'), + ('w3c_vh401', '0'), + ('w3c_vxhtml10', '0'), + ('w3c_vxhtml11', '0'), + ('w3c_vcss', '0'), + ('approve_comments', '0'), + ('enable_comments', '1'), + ('plugin_SpecialAdmin.php', '1'), + ('plugin_SpecialPageFuncs.php', '1'), + ('plugin_SpecialUserFuncs.php', '1'), + ('plugin_SpecialCSS.php', '1'), + ('copyright_notice', '{{COPYRIGHT}}'), + ('wiki_edit_notice_text', '== Why can I edit this page? ==\n\nEveryone can edit almost any page in this website. This concept is called a wiki. It gives everyone the opportunity to make a change for the best. While some spam and vandalism may occur, it is believed that most contributions will be legitimate and helpful.\n\nFor security purposes, a history of all page edits is kept, and administrators are able to restore vandalized or spammed pages with just a few clicks.'), + ('cache_thumbs', '{{ENABLE_CACHE}}'), + ('max_file_size', '256000'),('enano_version', '{{VERSION}}'),( 'allowed_mime_types', 'cbf:len=185;crc=55fb6f14;data=0[1],1[4],0[3],1[1],0[22],1[1],0[16],1[3],0[16],1[1],0[1],1[2],0[6],1[1],0[1],1[1],0[4],1[2],0[3],1[1],0[48],1[2],0[2],1[1],0[4],1[1],0[37]|end' ), + ('contact_email', '{{ADMIN_EMAIL}}'), + ('powered_btn', '1'); + +INSERT INTO {{TABLE_PREFIX}}page_text(page_id, namespace, page_text, char_tag) VALUES + ('Main_Page', 'Article', '=== Enano has been successfully installed and is working. ===\n\nIf you can see this message, it means that you\'ve finished the Enano setup process and are ready to start building your website. Congratulations!\n\nTo edit this front page, click the Log In button to the left, enter the credentials you provided during the installation, and click the Edit This Page button that appears on the blue toolbar just above this text. You can also [http://docs.enanocms.org/Help:2.4 learn more] about editing pages.\n\nTo create more pages, use the Create a Page button to the left. If you enabled wiki mode, you don\'t have to log in first, however your IP address will be shown in the page history.\n\nVisit the [http://docs.enanocms.org/Help:Contents Enano documentation project website] to learn more about administering your site effectively and keeping things secure.\n\n\'\'\'NOTE:\'\'\' You\'ve just installed an unstable version of Enano. This release is completely unsupported and may contain security issues or serious usability bugs. You should not use this release on a production website. The Enano team will not provide any type of support at all for this experimental release.', ''); + +INSERT INTO {{TABLE_PREFIX}}pages(page_order, name, urlname, namespace, special, visible, comments_on, protected, delvotes, delvote_ips) VALUES + (NULL, 'Main Page', 'Main_Page', 'Article', 0, 1, 1, 1, 0, ''); + +INSERT INTO {{TABLE_PREFIX}}themes(theme_id, theme_name, theme_order, default_style, enabled) VALUES + ('oxygen', 'Oxygen', 1, 'bleu.css', 1), + ('stpatty', 'St. Patty', 2, 'shamrock.css', 1); + +INSERT INTO {{TABLE_PREFIX}}users(user_id, username, password, email, real_name, user_level, theme, style, signature, reg_time, account_active) VALUES + (1, 'Anonymous', 'invalid-pass-hash', 'anonspam@enanocms.org', 'None', 1, 'oxygen', 'bleu', '', 0, 0), + (2, '{{ADMIN_USER}}', '{{ADMIN_PASS}}', '{{ADMIN_EMAIL}}', '{{REAL_NAME}}', 9, 'oxygen', 'bleu', '', {{UNIX_TIME}}, 1); + +INSERT INTO {{TABLE_PREFIX}}users_extra(user_id) VALUES + (2); + +INSERT INTO {{TABLE_PREFIX}}groups(group_id,group_name,group_type,system_group) VALUES(1, 'Everyone', 3, 1), + (2,'Administrators',3,1), + (3,'Moderators',3,1); + +INSERT INTO {{TABLE_PREFIX}}group_members(group_id,user_id,is_mod) VALUES(2, 2, 1); + +INSERT INTO {{TABLE_PREFIX}}acl(target_type,target_id,page_id,namespace,rules) VALUES + (1,2,NULL,NULL,'read=4;post_comments=4;edit_comments=4;edit_page=4;view_source=4;mod_comments=4;history_view=4;history_rollback=4;history_rollback_extra=4;protect=4;rename=4;clear_logs=4;vote_delete=4;vote_reset=4;delete_page=4;tag_create=4;tag_delete_own=4;tag_delete_other=4;set_wiki_mode=4;password_set=4;password_reset=4;mod_misc=4;edit_cat=4;even_when_protected=4;upload_files=4;upload_new_version=4;create_page=4;php_in_pages={{ADMIN_EMBED_PHP}};edit_acl=4;'), + (1,3,NULL,NULL,'read=4;post_comments=4;edit_comments=4;edit_page=4;view_source=4;mod_comments=4;history_view=4;history_rollback=4;history_rollback_extra=4;protect=4;rename=3;clear_logs=2;vote_delete=4;vote_reset=4;delete_page=4;set_wiki_mode=2;password_set=2;password_reset=2;mod_misc=2;edit_cat=4;even_when_protected=4;upload_files=2;upload_new_version=3;create_page=3;php_in_pages=2;edit_acl=2;'); + +INSERT INTO {{TABLE_PREFIX}}sidebar(item_id, item_order, sidebar_id, block_name, block_type, block_content) VALUES + (1, 1, 1, '{lang:sidebar_title_navigation}', 1, '[[Main_Page|{lang:sidebar_btn_home}]]'), + (2, 2, 1, '{lang:sidebar_title_tools}', 1, '[[$NS_SPECIAL$CreatePage|{lang:sidebar_btn_createpage}]]\n[[$NS_SPECIAL$UploadFile|{lang:sidebar_btn_uploadfile}]]\n[[$NS_SPECIAL$SpecialPages|{lang:sidebar_btn_specialpages}]]\n{if auth_admin}\n$ADMIN_LINK$\n[[$NS_SPECIAL$EditSidebar|{lang:sidebar_btn_editsidebar}]]\n{/if}'), + (3, 3, 1, '$USERNAME$', 1, '[[$NS_USER$$USERNAME$|{lang:sidebar_btn_userpage}]]\n[[$NS_SPECIAL$Contributions/$USERNAME$|{lang:sidebar_btn_mycontribs}]]\n{if user_logged_in}\n[[$NS_SPECIAL$Preferences|{lang:sidebar_btn_preferences}]]\n[[$NS_SPECIAL$PrivateMessages|{lang:sidebar_btn_privatemessages}]]\n[[$NS_SPECIAL$Usergroups|{lang:sidebar_btn_groupcp}]]\n$THEME_LINK$\n{/if}\n{if user_logged_in}\n$LOGOUT_LINK$\n{else}\n[[$NS_SPECIAL$Register|{lang:sidebar_btn_register}]]\n$LOGIN_LINK$\n[[$NS_SPECIAL$Login/$NS_SPECIAL$PrivateMessages|{lang:sidebar_btn_privatemessages}]]\n{/if}'), + (4, 4, 1, '{lang:sidebar_title_search}', 1, '

$INPUT_AUTH$

'), + (5, 2, 2, '{lang:sidebar_title_links}', 4, 'Links'); + diff -r 299a90e28abc -r 87e08a6e4fec language/english/admin.json --- a/language/english/admin.json Thu Jan 03 18:39:19 2008 -0500 +++ b/language/english/admin.json Wed Jan 16 13:55:49 2008 -0500 @@ -218,6 +218,11 @@ field_activate_user: 'User', field_activate_admin: 'Admin', + // Section: terms of use (TOU) + heading_tou: 'Registration agreement/Terms of Use', + field_tou: 'Registration agreement', + field_tou_hint: 'The text you enter here will be displayed to users upon any attempt to create an account on this site.', + // Section: account lockouts heading_lockout: 'Account lockouts', lockout_intro: 'Configure Enano to prevent or restrict logins for a specified period of time if a user enters an incorrect password a specific number of times.', diff -r 299a90e28abc -r 87e08a6e4fec language/english/install.json --- a/language/english/install.json Thu Jan 03 18:39:19 2008 -0500 +++ b/language/english/install.json Wed Jan 16 13:55:49 2008 -0500 @@ -15,7 +15,7 @@ var enano_lang_install = { categories: [ - 'meta', 'welcome', 'license', 'sysreqs', 'database', 'website', 'login', 'confirm', 'install', 'finish', 'pophelp', + 'meta', 'language', 'welcome', 'license', 'sysreqs', 'database', 'dbmysql', 'dbpgsql', 'website', 'login', 'confirm', 'install', 'finish', 'pophelp', ], strings: { meta: { @@ -26,6 +26,7 @@ btn_article: 'installation page', btn_continue: 'Continue', lbl_before_continue: 'Before continuing:', + step: 'Step %step%: %title%', msg_err_verification: 'One or more of the form fields is incorrect. Please correct any information in the form that has an "X" next to it.', @@ -34,6 +35,9 @@ msg_err_stagefailed_mysqlerror: 'The error returned from MySQL was:', btn_retry_installation: 'Retry installation', }, + language: { + modetitle: 'Language', + }, welcome: { modetitle: 'Welcome', heading: 'Welcome to Enano', @@ -44,7 +48,8 @@ btn_start: 'Start installation', }, license: { - modetitle: 'License agreement', + modetitle: 'License', + modetitle_long: 'License agreement', heading: 'Welcome to the Enano installer.', blurb_thankyou: 'Thank you for choosing Enano as your CMS. You\'ve selected the finest in design, the strongest in security, and the latest in Web 2.0 toys. Trust us, you\'ll like it.', blurb_pleaseread: 'To get started, please read and accept the following license agreement. You\'ve probably seen it before.', @@ -57,11 +62,13 @@ gpl_blurb_inenglish: 'You may view a copy of the GNU General Public License in English in the file GPL-EN included with this package.', }, sysreqs: { - modetitle: 'Server requirements', + modetitle: 'Requirements', + modetitle_long: 'Server requirements', heading: 'Checking your server', blurb: 'Enano has several requirements that must be met before it can be installed. If all is good then note any warnings and click Continue below.', req_php: 'PHP Version >=4.3.0', req_php5: 'PHP 5.2.0 or later', + req_postgres: 'PostgreSQL extension for PHP', req_mysql: 'MySQL extension for PHP', req_uploads: 'File upload support', req_apache: 'Apache HTTP Server', @@ -72,6 +79,7 @@ req_desc_php: 'It seems that the version of PHP that your server is running is too old to support Enano properly. If this is your server, please upgrade to the most recent version of PHP, remembering to use the --with-mysql configure option if you compile it yourself. If this is not your server, please contact your webhost and ask them if it would be possible to upgrade PHP. If this is not possible, you will need to switch to a different webhost in order to use Enano.', req_desc_php5: 'Your server does not have support for PHP 5.2.0. While you may continue installing Enano, please be warned that as of December 31, 2007, all support for Enano on PHP 4 servers is discontinued. If you have at least PHP 5.0.0, support will still be available, but there are many security problems in PHP versions under 5.2.0 that Enano cannot effectively prevent.', + req_desc_postgres: 'It seems that your PHP installation does not have the PostgreSQL extension enabled. Because of this, you won\'t be able to use the PostgreSQL database driver. This is OK in the majority of cases. If you want to use PostgreSQL support, you\'ll need to either compile the PHP extension for Postgres or install the extension with your distribution\'s package manager. Windows administrators will need enable php_pgsql.dll in their php.ini.', req_desc_mysql: 'It seems that your PHP installation does not have the MySQL extension enabled. If this is your own server, you may need to just enable the "libmysql.so" extension in php.ini. If you do not have the MySQL extension installed, you will need to either use your distribution\'s package manager to install it, or you will have to compile PHP from source. If you compile PHP from source, please remember to use the "--with-mysql" configure option, and you will have to have the MySQL development files installed (they usually are). If this is not your server, please contact your hosting company and ask them to install the PHP MySQL extension.', req_desc_uploads: 'It seems that your server does not support uploading files. Enano *requires* this functionality in order to work properly. Please ask your server administrator to set the "file_uploads" option in php.ini to "On".', req_desc_apache: 'Apparently your server is running a web server other than Apache. Enano will work nontheless, but there are some known bugs with non-Apache servers, and the "fancy" URLs will not work properly. The "Standard URLs" option will be set on the website configuration page, only change it if you are absolutely certain that your server is running Apache.', @@ -92,9 +100,24 @@ objective_scalebacks: 'Review the list above to ensure that you are satisfied with any of Enano\'s workarounds for your server. If you need a particular feature and that feature is listed as disabled above, you should take the opportunity now to correct the problem.' }, database: { - modetitle: 'Database information', + modetitle: 'Database', + modetitle_long: 'Database information', heading_optionalinfo: 'Optional information', + driver_heading: 'Choose a database driver', + driver_intro: 'The next step is to choose the database driver that Enano will use. In most cases this is MySQL, but there are certain advantages to PostgreSQL, which is made available only experimentally.', + driver_msg_virt_appliance: 'You\'re using the Enano virtual appliance.
Unless you configured the appliance manually, PostgreSQL support is not available. In 99% of cases you\'ll want to click MySQL below.', + driver_err_no_mysql: 'You don\'t have the MySQL PHP extension installed.', + driver_err_no_pgsql: 'You don\'t have the PostgreSQL PHP extensnion installed.', + driver_mysql: 'MySQL', + driver_mysql_intro: 'Click this button to use MySQL as the database backend for your site. Most web hosts support MySQL, and if you have administrative access to your MySQL server, you can create a new database and user during this installation process if you haven\'t done so already.', + driver_pgsql: 'PostgreSQL', + driver_pgsql_intro: 'Click this button to use PostgreSQL as the database backend for your site. While not as widely supported, PostgreSQL has more liberal licensing conditions and when properly configured is faster than MySQL. Some plugins may not work with the PostgreSQL driver.', + + objective_test: 'Check your MySQL connection using the "Test Connection" button.', + objective_uncrypt: 'Be aware that your database information will be transmitted unencrypted several times.', + }, + dbmysql: { msg_err_mysql_connect: 'Error: The database server "%db_host%" couldn\'t be contacted.
%mysql_error%', msg_err_mysql_auth: 'Error: Access to MySQL under the specified credentials was denied.
%mysql_error%', msg_err_mysql_dbperm: 'Error: Access to the specified database using those login credentials was denied.
%mysql_error%', @@ -106,6 +129,7 @@ msg_warn_mysql_version: 'The MySQL version that your server is running could not be determined.', msg_info_mysql_good: 'Your version of MySQL meets Enano requirements.', + msg_test_success: 'All checks passed! You can use this database configuration with Enano.', blurb_needdb: 'Now we need some information that will allow Enano to contact your database server. Enano uses MySQL as a data storage backend, and we need to have access to a MySQL server in order to continue.', blurb_howtomysql: 'If you do not have access to a MySQL server, and you are using your own server, you can download MySQL for free from MySQL.com. Please note that, like Enano, MySQL is licensed under the GNU GPL. If you need to modify MySQL and then distribute your modifications, you must either distribute them under the terms of the GPL or purchase a proprietary license.', @@ -131,12 +155,45 @@ field_droptables_lbl: 'Drop existing tables', btn_testconnection: 'Test connection', + }, + dbpgsql: { + msg_err_connect: 'There was a problem connecting to PostgreSQL. Please check your connection information above.', + msg_err_version: 'Error: Your version of PostgreSQL (%pg_version%) is older than 8.2.5. Enano cannot be installed.', - objective_test: 'Check your MySQL connection using the "Test Connection" button.', - objective_uncrypt: 'Be aware that your database information will be transmitted unencrypted several times.', + msg_warn_pg_version: 'The PostgreSQL version that your server is running could not be determined.', + msg_err_auth: 'Access to the database was denied. Ensure that your database exists and that your username and password are correct.', + + msg_info_version_good: 'Your version of PostgreSQL meets Enano requirements.', + msg_test_success: 'All checks passed! You can use this database configuration with Enano.', + + blurb_needdb: 'Now we need some information that will allow Enano to contact your database server. Enano uses PostgreSQL as a data storage backend, and we need to have access to a PostgreSQL server in order to continue.', + blurb_howtomysql: 'If you do not have access to a PostgreSQL server, and you are using your own server, you can download PostgreSQL for free from PostgreSQL.com. Please note that, like Enano, PostgreSQL is licensed under the GNU GPL. If you need to modify PostgreSQL and then distribute your modifications, you must either distribute them under the terms of the GPL or purchase a proprietary license.', + + vm_login_info: 'PostgreSQL login information for this virtual appliance:

Database hostname: %host%
Database login: username "%user%", password: "%pass%" (without quotes)
Database name: %name%', + + table_title: 'Database information', + + field_hostname_title: 'Database hostname', + field_hostname_body: 'This is the hostname (or sometimes the IP address) of your PostgreSQL server. In many cases, this is "localhost".', + field_dbname_title: 'Database name', + field_dbname_body: 'The name of the actual database. If you don\'t already have a database, you can create one here, if you have the username and password of a PostgreSQL user with administrative rights.', + field_dbauth_title: 'Database login', + field_dbauth_body: 'These fields should be the username and password of a user with "select", "insert", "update", "delete", "create table", and "replace" privileges for your database.', + field_tableprefix_title: 'Table prefix', + field_tableprefix_body: 'The value that you enter here will be added to the beginning of the name of each Enano table. You may use lowercase letters (a-z), numbers (0-9), and underscores (_).', + field_rootauth_title: 'Database administrative login', + field_rootauth_body: 'If the PostgreSQL database or username that you entered above does not exist yet, you can create them here, assuming that you have the login information for an administrative user (such as root). Leave these fields blank unless you need to use them.', + field_pgsqlversion_title: 'PostgreSQL version', + field_pgsqlversion_blurb_willbechecked: 'PostgreSQL version information will be checked when you click "Test Connection".', + field_droptables_title: 'Delete existing tables?', + field_droptables_body: 'If this option is checked, all the tables that will be used by Enano will be dropped (deleted) before the schema is executed. Do NOT use this option unless specifically instructed to.', + field_droptables_lbl: 'Drop existing tables', + + btn_testconnection: 'Test connection', }, website: { - modetitle: 'Website configuration', + modetitle: 'Site info', + modetitle_long: 'Website information', header_blurb: 'The next step is to enter some information about your website. You can always change this information later, using the administration panel.', field_name_title: 'Website name', @@ -158,8 +215,9 @@ objective_verify: 'Verify that your site information is correct. Again, all of the above settings can be changed from the administration panel.', }, login: { - modetitle: 'Administration login', + modetitle: 'Admin login', header_blurb: 'Next, enter your desired username and password. The account you create here will be used to administer your site.', + modetitle_long: 'Administration login', field_username_title: 'Administration username', field_username_body: 'The administration username you will use to log into your site.
This cannot be "anonymous" or in the form of an IP address.', @@ -177,7 +235,8 @@ objective_remember: 'Remember the username and password you enter here! You will not be able to administer your site without the information you enter on this page.', }, confirm: { - modetitle: 'Confirm installation', + modetitle: 'Review', + modetitle_long: 'Confirm installation', header_blurb_title: 'Enano is ready to install.', header_blurb_body: 'The wizard has finished collecting information and is ready to install the database schema. Please review the information below, and then click the button below to install the database.', @@ -197,7 +256,8 @@ btn_install_enano: 'Install Enano!', }, install: { - modetitle: 'Database installation', + modetitle: 'Install', + modetitle_long: 'Database installation', stg_connect_title: 'Connect to MySQL', stg_connect_body: 'MySQL denied our attempt to connect to the database. This is most likely because your login information was incorrect. You will most likely need to restart the installation.', @@ -229,7 +289,8 @@ msg_complete_body: 'Review any warnings above, and then click here to finish the installation.', }, finish: { - modetitle: 'Installation complete', + modetitle: 'Finish', + modetitle_long: 'Complete installation', msg_congratulations: 'Congratulations!', body: '

You have finished installing Enano on this server.

Now what?

diff -r 299a90e28abc -r 87e08a6e4fec language/english/meta.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/language/english/meta.json Wed Jan 16 13:55:49 2008 -0500 @@ -0,0 +1,6 @@ +{ + // Language metadata + lang_name_english: 'English', + lang_name_native: 'English', + lang_code: 'eng' +} diff -r 299a90e28abc -r 87e08a6e4fec language/english/user.json --- a/language/english/user.json Thu Jan 03 18:39:19 2008 -0500 +++ b/language/english/user.json Wed Jan 16 13:55:49 2008 -0500 @@ -98,6 +98,7 @@ reg_err_alert_password_tooshort: 'Your password must be 6 characters or greater in length.', reg_err_alert_password_nomatch: 'The passwords you entered do not match.', reg_err_missing_key: 'Couldn\'t look up public encryption key', + reg_err_accept_tou: 'Please read and accept the Terms of Use before creating your account.', reg_msg_greatercontrol: 'A user account enables you to have greater control over your browsing experience.', reg_msg_table_title: 'Create a user account', @@ -112,6 +113,7 @@ reg_msg_realname_optional: 'Giving your real name is totally optional. If you choose to provide your real name, it will be used to provide attribution for any edits or contributions you may make to this site.', reg_msg_captcha_pleaseenter: 'Please enter the code shown in the image to the right into the text box. The code is case-insensitive and the numeral zero is never used. This process helps to ensure that this registration is not being performed by an automated bot. If the image to the right is illegible, you can generate a new image.', reg_msg_captcha_blind: 'If you are visually impaired or otherwise cannot read the text shown to the right, please contact the site management and they will create an account for you.', + reg_msg_please_read_tou:'Please read and agree to the following terms before registering. By continuing to create an account you agree to be legally bound by the terms below.', reg_msg_success_title: 'Registration successful', reg_msg_success_body: 'Thank you for registering, your user account has been created.', reg_msg_success_activ_none: 'You may now log in with the username and password that you created.', @@ -127,6 +129,9 @@ reg_lbl_field_realname: 'Real name:', reg_lbl_field_captcha: 'Visual confirmation', reg_lbl_field_captcha_code: 'Code:', + reg_lbl_field_tou: 'I agree to abide by the terms and conditions stated above', + + reg_btn_create_account: 'Create my account', reg_coppa_title: 'Before you can register, please tell us your age.', reg_coppa_link_atleast13: 'I was born on or before %yo13_date% and am at least 13 years of age', diff -r 299a90e28abc -r 87e08a6e4fec plugins/SpecialAdmin.php --- a/plugins/SpecialAdmin.php Thu Jan 03 18:39:19 2008 -0500 +++ b/plugins/SpecialAdmin.php Wed Jan 16 13:55:49 2008 -0500 @@ -266,6 +266,8 @@ setConfig('pw_strength_minimum', $strength); } + setConfig('register_tou', RenderMan::preprocess_text($_POST['register_tou'], true, false)); + // Account lockout policy if ( preg_match('/^[0-9]+$/', $_POST['lockout_threshold']) ) setConfig('lockout_threshold', $_POST['lockout_threshold']); @@ -517,6 +519,27 @@ + + + + + get('acpgc_heading_tou'); ?> + + + + + + get('acpgc_field_tou'); ?>
+ get('acpgc_field_tou_hint'); ?> + + + tinymce_textarea('register_tou', $terms, 10, 40); + ?> + + + get('acpgc_heading_lockout'); ?> diff -r 299a90e28abc -r 87e08a6e4fec plugins/SpecialUserFuncs.php --- a/plugins/SpecialUserFuncs.php Thu Jan 03 18:39:19 2008 -0500 +++ b/plugins/SpecialUserFuncs.php Wed Jan 16 13:55:49 2008 -0500 @@ -502,6 +502,8 @@ $email = ''; $realname = ''; + $terms = getConfig('register_tou'); + if(getConfig('account_activation') == 'disable' && ( ( $session->user_level >= USER_LEVEL_ADMIN && !isset($_GET['IWannaPlayToo']) ) || $session->user_level < USER_LEVEL_ADMIN || !$session->user_logged_in )) { $s = ($session->user_level >= USER_LEVEL_ADMIN) ? '

' . $lang->get('user_reg_err_disabled_body_adminblurb', array( 'reg_link' => makeUrl($paths->page, 'IWannaPlayToo&coppa=no', true) )) . '

' : ''; @@ -527,6 +529,10 @@ { $s = 'Invalid COPPA input'; } + else if ( !empty($terms) && !isset($_POST['tou_agreed']) ) + { + $s = $lang->get('user_reg_err_accept_tou'); + } else { $coppa = ( isset($_POST['coppa']) && $_POST['coppa'] == 'yes' ); @@ -723,10 +729,44 @@ + + + + + + + get('user_reg_msg_please_read_tou'); + ?> + + + + + +
+ +
+

+ +

+ + + + + - + diff -r 299a90e28abc -r 87e08a6e4fec upgrade.php --- a/upgrade.php Thu Jan 03 18:39:19 2008 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,811 +0,0 @@ - Array('1.0b2'), - '1.0b2' => Array('1.0b3'), - '1.0b3' => Array('1.0b4'), - '1.0b4' => Array('1.0RC1'), - '1.0RC1' => Array('1.0RC2'), - '1.0RC2' => Array('1.0RC3'), - '1.0RC3' => Array('1.0'), - '1.0' => Array('1.0.1'), - '1.0.1' => Array('1.0.1.1'), - '1.0.1.1' => Array('1.0.2b1'), - '1.0.2b1' => Array('1.0.2'), - '1.0.2' => Array('Stable1.0ToUnstable1.1'), - 'Stable1.0ToUnstable1.1' => Array('1.1.1') - ); -$this_version = '1.1.1'; -$func_list = Array( - '1.0' => Array('u_1_0_1_update_del_votes'), - '1.0b4' => Array('u_1_0_RC1_update_user_ids', 'u_1_0_RC1_add_admins_to_group', 'u_1_0_RC1_alter_files_table', 'u_1_0_RC1_destroy_session_cookie', 'u_1_0_RC1_set_contact_email', 'u_1_0_RC1_update_page_text'), // , - // '1.0RC2' => Array('u_1_0_populate_userpage_comments') - '1.0RC3' => Array('u_1_0_RC3_make_users_extra'), - '1.0.2b1' => Array('u_1_0_2_nuke_template_cache', 'u_1_0_2_rebuild_search_index') - ); - -if(!isset($_GET['mode'])) -{ - $_GET['mode'] = 'login'; -} - -function err($t) -{ - global $template; - echo $t; - $template->footer(); - exit; -} - -require(ENANO_ROOT.'/includes/template.php'); - -// Initialize the session manager -require(ENANO_ROOT.'/includes/functions.php'); -require(ENANO_ROOT.'/includes/dbal.php'); -require(ENANO_ROOT.'/includes/paths.php'); -require(ENANO_ROOT.'/includes/sessions.php'); -require(ENANO_ROOT.'/includes/plugins.php'); -require(ENANO_ROOT.'/includes/rijndael.php'); -require(ENANO_ROOT.'/includes/render.php'); -require(ENANO_ROOT.'/includes/search.php'); -$db = new mysql(); -$db->connect(); - -$plugins = new pluginLoader(); - -if(!defined('ENANO_CONFIG_FETCHED')) -{ - // Select and fetch the site configuration - $e = $db->sql_query('SELECT config_name, config_value FROM '.table_prefix.'config;'); - if ( !$e ) - { - $db->_die('Some critical configuration information could not be selected.'); - } - else - { - define('ENANO_CONFIG_FETCHED', ''); // Used in die_semicritical to figure out whether to call getConfig() or not - } - - $enano_config = Array(); - while($r = $db->fetchrow()) - { - $enano_config[$r['config_name']] = $r['config_value']; - } - $db->free_result(); -} - -$v = enano_version(); -if(in_array($v, Array(false, '', '1.0b3', '1.0b4'))) -{ - $ul_admin = 2; - $ul_mod = 1; - $ul_member = 0; - $ul_guest = -1; -} -else -{ - $ul_admin = USER_LEVEL_ADMIN; - $ul_mod = USER_LEVEL_MOD; - $ul_member = USER_LEVEL_MEMBER; - $ul_guest = USER_LEVEL_GUEST; -} - -$_GET['title'] = 'unset'; - -$session = new sessionManager(); -$paths = new pathManager(); -$session->start(); - -$template = new template_nodb(); -$template->load_theme('oxygen', 'bleu', false); - -$modestrings = Array( - 'login' => 'Administrative login', - 'welcome' => 'Welcome', - 'setversion' => 'Select Enano version', - 'confirm' => 'Confirm upgrade', - 'upgrade' => 'Database installation', - 'finish' => 'Upgrade complete' - ); - -$sideinfo = ''; -$vars = $template->extract_vars('elements.tpl'); -$p = $template->makeParserText($vars['sidebar_button']); -foreach ( $modestrings as $id => $str ) -{ - if ( $_GET['mode'] == $id ) - { - $flags = 'style="font-weight: bold; text-decoration: underline;"'; - $this_page = $str; - } - else - { - $flags = ''; - } - $p->assign_vars(Array( - 'HREF' => '#', - 'FLAGS' => $flags . ' onclick="return false;"', - 'TEXT' => $str - )); - $sideinfo .= $p->run(); -} - -$template->init_vars(); - -function upg_assign_vars($schema) -{ - $schema = str_replace('{{SITE_NAME}}', mysql_real_escape_string(getConfig('site_name')), $schema); - $schema = str_replace('{{SITE_DESC}}', mysql_real_escape_string(getConfig('site_desc')), $schema); - $schema = str_replace('{{COPYRIGHT}}', mysql_real_escape_string(getConfig('copyright_notice')), $schema); - $schema = str_replace('{{TABLE_PREFIX}}', table_prefix, $schema); - if(getConfig('wiki_mode')=='1') $schema = str_replace('{{WIKI_MODE}}', '1', $schema); - else $schema = str_replace('{{WIKI_MODE}}', '0', $schema); - return $schema; -} - -/* Version-specific functions */ - -function u_1_0_RC1_update_user_ids() -{ - global $db; - // First, make sure this hasn't already been done - $q = $db->sql_query('SELECT username FROM '.table_prefix.'users WHERE user_id=1;'); - if ( !$q ) - $db->_die(); - $row = $db->fetchrow(); - if ( $row['username'] == 'Anonymous' ) - return true; - // Find the first unused user ID - $used = Array(); - $q = $db->sql_query('SELECT user_id FROM '.table_prefix.'users;'); - if ( !$q ) - $db->_die(); - $notfirst = false; - while ( $row = $db->fetchrow() ) - { - $i = intval($row['user_id']); - $used[$i] = true; - if ( !isset($used[$i - 1]) && $notfirst ) - { - $id = $i - 1; - break; - } - $notfirst = true; - } - if ( !isset($id) ) - $id = $i + 1; - if ( $id == 0 ) - $id = 2; - $db->free_result(); - - $q = $db->sql_query('UPDATE '.table_prefix.'users SET user_id=' . $id . ' WHERE user_id=1;'); - if(!$q) - $db->_die(); - $q = $db->sql_query('UPDATE '.table_prefix.'users SET user_id=1 WHERE user_id=-1 AND username=\'Anonymous\';'); - if(!$q) - $db->_die(); - -} - -function u_1_0_RC1_add_admins_to_group() -{ - global $db; - $q = $db->sql_query('SELECT user_id FROM '.table_prefix.'users WHERE user_level=' . USER_LEVEL_ADMIN . ';'); - if ( !$q ) - $db->_die(); - $base = 'INSERT INTO '.table_prefix.'group_members(group_id,user_id) VALUES'; - $blocks = Array(); - while ( $row = $db->fetchrow($q) ) - { - $blocks[] = '(2,' . $row['user_id'] . ')'; - } - $blocks = implode(',', $blocks); - $sql = $base . $blocks . ';'; - if(!$db->sql_query($sql)) - $db->_die(); -} - -function u_1_0_RC1_alter_files_table() -{ - global $db; - if(!is_dir(ENANO_ROOT.'/files')) - @mkdir(ENANO_ROOT . '/files'); - if(!is_dir(ENANO_ROOT.'/files')) - die('ERROR: Couldn\'t create files directory'); - $q = $db->sql_unbuffered_query('SELECT * FROM '.table_prefix.'files;', $db->_conn); - if(!$q) $db->_die(); - while ( $row = $db->fetchrow() ) - { - $file_data = base64_decode($row['data']); - $path = ENANO_ROOT . '/files/' . md5( $row['filename'] . '_' . $file_data ) . '_' . $row['time_id'] . $row['file_extension']; - @unlink($path); - $handle = @fopen($path, 'w'); - if(!$handle) - die('fopen failed'); - fwrite($handle, $file_data); - fclose($handle); - - } - - $q = $db->sql_query('ALTER TABLE '.table_prefix.'files DROP PRIMARY KEY, ADD COLUMN file_id int(12) NOT NULL auto_increment FIRST, ADD PRIMARY KEY (file_id), ADD COLUMN file_key varchar(32) NOT NULL;'); - if(!$q) $db->_die(); - - $list = Array(); - $q = $db->sql_unbuffered_query('SELECT * FROM '.table_prefix.'files;', $db->_conn); - if(!$q) $db->_die(); - while ( $row = $db->fetchrow($q) ) - { - $file_data = base64_decode($row['data']); - $key = md5( $row['filename'] . '_' . $file_data ); - $list[] = 'UPDATE '.table_prefix.'files SET file_key=\'' . $key . '\' WHERE file_id=' . $row['file_id'] . ';'; - } - - foreach ( $list as $sql ) - { - if(!$db->sql_query($sql)) $db->_die(); - } - - if(!$db->sql_query('ALTER TABLE '.table_prefix.'files DROP data')) $db->_die(); - -} - -function u_1_0_RC1_destroy_session_cookie() -{ - unset($_COOKIE['sid']); - setcookie('sid', '', time()-3600*24, scriptPath); - setcookie('sid', '', time()-3600*24, scriptPath.'/'); -} - -function u_1_0_RC1_set_contact_email() -{ - global $db; - $q = $db->sql_query('SELECT email FROM '.table_prefix.'users WHERE user_level='.USER_LEVEL_ADMIN.' ORDER BY user_level ASC LIMIT 1;'); - if(!$q) - $db->_die(); - $row = $db->fetchrow(); - setConfig('contact_email', $row['email']); -} - -function u_1_0_RC1_update_page_text() -{ - global $db; - $q = $db->sql_unbuffered_query('SELECT page_id,namespace,page_text,char_tag FROM '.table_prefix.'page_text'); - if (!$q) - $db->_die(); - - $qs = array(); - - while ( $row = $db->fetchrow($q) ) - { - $row['page_text'] = str_replace(Array( - "{QUOT:{$row['char_tag']}}", - "{APOS:{$row['char_tag']}}", - "{SLASH:{$row['char_tag']}}" - ), Array( - '"', "'", '\\' - ), $row['page_text']); - $qs[] = 'UPDATE '.table_prefix.'page_text SET page_text=\'' . mysql_real_escape_string($row['page_text']) . '\' - WHERE page_id=\'' . mysql_real_escape_string($row['page_id']) . '\' AND - namespace=\'' . mysql_real_escape_string($row['namespace']) . '\';'; - } - - foreach($qs as $query) - { - if(!$db->sql_query($query)) - $db->_die(); - } -} - -function u_1_0_1_update_del_votes() -{ - global $db; - $q = $db->sql_query('SELECT urlname, namespace, delvote_ips FROM '.table_prefix.'pages;'); - if ( !$q ) - $db->_die(); - - while ( $row = $db->fetchrow($q) ) - { - $ips = strval($row['delvote_ips']); - if ( is_array( @unserialize($ips) ) ) - continue; - $ips = explode('|', $ips); - $new = array( - 'ip' => array(), - 'u' => array() - ); - $i = 0; - $prev = ''; - $prev_is_ip = false; - foreach ( $ips as $ip ) - { - $i++; - $current_is_ip = is_valid_ip($ip); - if ( $current_is_ip && $prev_is_ip ) - { - $i++; - $new['u'][] = $prev; - } - if ( $current_is_ip ) - { - $new['ip'][] = $ip; - } - else - { - $new['u'][] = $ip; - } - $prev = $ip; - $prev_is_ip = $current_is_ip; - } - if ( $i % 2 == 1 && $prev_is_ip ) - { - $new['u'][] = $ip; - } - $new = serialize($new); - $e = $db->sql_query('UPDATE '.table_prefix.'pages SET delvote_ips=\'' . $db->escape($new) . '\' WHERE urlname=\'' . $db->escape($row['urlname']) . '\' AND namespace=\'' . $db->escape($row['namespace']) . '\';'); - if ( !$e ) - $db->_die(); - } - $db->free_result($q); -} - -function u_1_0_RC3_make_users_extra() -{ - global $db; - $q = $db->sql_query('SELECT user_id FROM '.table_prefix.'users WHERE user_id > 0;'); - if ( !$q ) - $db->_die(); - - $ids = array(); - while ( $row = $db->fetchrow() ) - { - $ids[] = intval($row['user_id']); - } - - $ids = '(' . implode('),(', $ids) . ')'; - if ( $ids == '' ) - return false; - $sql = "INSERT INTO " . table_prefix . "users_extra(user_id) VALUES$ids;"; - - if ( !$db->sql_query($sql) ) - $db->_die(); -} - -function u_1_0_2_nuke_template_cache() -{ - $dir = @opendir(ENANO_ROOT . '/cache'); - if ( !$dir ) - { - return false; - } - while ( ($fname = @readdir($dir)) ) - { - if ( preg_match('/\.tpl\.php$/', $fname) ) - { - unlink( ENANO_ROOT . '/cache/' . $fname ); - } - } -} - -function u_1_0_2_rebuild_search_index() -{ - global $paths; - @set_time_limit(0); - $paths->rebuild_search_index(); -} - -switch($_GET['mode']) -{ - case "login": - if ( $session->user_logged_in && $session->user_level < $ul_admin ) - { - $template->header(); - echo '

Your user account does not have permission to perform an upgrade of Enano. Return to the index page.

'; - $template->footer(); - exit; - } - if($session->user_logged_in && $session->user_level >= $ul_admin) - { - if(isset($_POST['login'])) - { - $result = $session->login_without_crypto($_POST['username'], $_POST['password'], false, $ul_admin); - if($session->sid_super) - { - header('Location: upgrade.php?mode=welcome&auth='.$session->sid_super); - exit; - } - } - $template->header(); - ?> -
- - - - - '; - } - ?> - - - - - - - - -
You must re-authenticate to perform this upgrade.

Login failed: '. $result['error'] . '

Username:
Password:
-
-
- login_without_crypto($_POST['username'], $_POST['password'], false, $ul_member); - if($result == 'success') - { - header('Location: upgrade.php'); - exit; - } - } - $template->header(); - ?> -
- - - - - '; - } - ?> - - - - - - - - -
Please log in to continue with this upgrade.

Login failed. Bad password?

Username:
Password:
-
-
- sid_super) { $template->header(); echo '

No admin session found! Please restart the upgrade.

'; $template->footer(); exit; } - - // Just show a simple welcome page to display version information - $template->header(); - require('config.php'); - - ?> - -
- [ Enano CMS Project logo ] -

Welcome to the Enano upgrade wizard

- You are about to upgrade to a NIGHTLY BUILD of Enano.
Nightly builds CANNOT be re-upgraded to the final release. They may also contain serious flaws, security problems, or extraneous debugging information. Continuing this process on a production site is NOT recommended.
'; - } - ?> - -
-

You are about to upgrade Enano to version . Before you continue, please ensure that:

-
    -
  • You have completely backed up your database ()
  • -
  • You have backed up the entire Enano directory ()
  • -
  • You have reviewed the release notes for this version, and you
    are comfortable with any known bugs or issues
  • -
  • If you've configured Enano to work using a MySQL user with restricted
    privileges, you need to enable ALTER, CREATE TABLE, and CREATE INDEX privileges
    for this upgrade to work.
  • -
-
-
-
- -
-
- - sid_super) { $template->header(); echo '

No admin session found! Please restart the upgrade.

'; $template->footer(); exit; } - $v = ( function_exists('enano_version') ) ? enano_version() : ''; - if(!in_array($v, $valid_versions) && $v != '') - { - $template->header(); - ?> -

Your version of Enano () can't be upgraded to this version ().

- header(); - echo "
"; - ?> -

Sorry, we couldn't detect which version of Enano you're running on your server. Please select which version of Enano you have below, and make absolutely sure that you're correct.

-

-

- -

- `; - break; - } - else - { - header('Location: upgrade.php?mode=confirm&auth='.$session->sid_super); - } - break; - case "confirm": - $enano_version = ( isset($_POST['version']) ) ? $_POST['version'] : enano_version(); - - $template->header(); - if(!$session->sid_super) { echo '

No admin session found! Please restart the upgrade.

'; $template->footer(); exit; } - ?> - - - - - - - - -

Are you sure you want to perform this upgrade?

You can still cancel the upgrade process now. If
the upgrade fails, you will need to roll back
any actions made using manual SQL queries.

Please clear your browser cache or
shift-reload after the upgrade.

If you fail to do so, some page elements may
be broken.

- - -
-
- header(); - if(!$session->sid_super) { echo '

No admin session found! Please restart the upgrade.

'; $template->footer(); exit; } - if(!isset($_POST['enano_version'])) { echo '

Can\'t find the version information on the POST query, are you trying to do this upgrade directly? Please restart the upgrade.

'; break; } - $enano_version = $_POST['enano_version']; - echo '

Preparing for schema execution...'; - // Build an array of queries - $schema = file_get_contents('upgrade.sql'); - - // Strip out and process version blocks - preg_match_all('#---BEGIN ([0-9A-z\.\-]*?)---'."\n".'((.*?)'."\n)?".'---END \\1---#is', $schema, $matches); - - $from_list =& $matches[1]; - $query_list =& $matches[3]; - - foreach($matches[0] as $m) - { - $schema = str_replace($m, '', $schema); - } - $schema = explode("\n", $schema); - foreach($schema as $k => $q) - { - if(substr($q, 0, 2) == '--' || $q == '') - { - unset($schema[$k]); - //die('

'.htmlspecialchars(print_r($schema, true)).'
'); - } - else - { - $schema[$k] = upg_assign_vars($schema[$k]); - } - } - - foreach($query_list as $k => $q) - { - $query_list[$k] = explode("\n", $query_list[$k]); - foreach($query_list[$k] as $i => $s) - { - $tq =& $query_list[$k][$i]; - if(substr($s, 0, 2) == '--' || $s == '') - { - unset($query_list[$k][$i]); - //die('
'.htmlspecialchars(print_r($schema, true)).'
'); - } - else - { - $query_list[$k][$i] = upg_assign_vars($query_list[$k][$i]); - } - } - $query_list[$k] = array_values($query_list[$k]); - } - - $assoc_list = Array(); - - foreach($from_list as $i => $v) - { - $assoc_list[$v] = $query_list[$i]; - } - - $schema = array_values($schema); - - $deps_resolved = false; - $installing_versions = Array($enano_version); - - while(true) - { - $v = array_keys($deps_list); - foreach($v as $i => $ver) - { - if(in_array($ver, $installing_versions)) - { - // $ver is on the list of versions to be installed. Add its dependencies to the list of versions to install. - foreach($deps_list[$ver] as $dep) - { - if(!in_array($dep, $installing_versions)) - { - $installing_versions[] = $dep; - } - } - } - if($i == count($deps_list) - 1) - { - break 2; - } - } - } - - foreach($installing_versions as $this_ver) - { - $schema = array_merge($schema, $assoc_list[$this_ver]); - } - - // Time for some proper SQL syntax! - // Also check queries for so-called injection attempts to make - // sure that it doesn't fail during the upgrade process and - // leave the user with a half-upgraded database - foreach($schema as $s => $q) - { - if(substr($q, strlen($q)-1, 1) != ';') - { - $schema[$s] .= ';'; - } - if ( !$db->check_query($schema[$s]) ) - { - // Uh-oh, the check failed, bail out - // The DBAL runs sanity checks on all queries for safety, - // so if the check fails in mid-upgrade we are in deep - // dodo doo-doo. - echo 'Query failed sanity check, this should never happen and is a bug.

Query was:

'.$schema[$s].'
'; - break 2; - } - } - - $schema = array_values($schema); - - // Used extensively for debugging - // echo '
'.htmlspecialchars(print_r($schema, true)).'
'; - // break; - - echo 'done!
Executing upgrade schema...'; - - // OK, do the loop, baby!!! - foreach($schema as $q) - { - if ( substr($q, 0, 1) == '@' ) - { - // if the first character is @, don't fail on error - $db->sql_query(substr($q, 1)); - } - else - { - if ( !$db->sql_query($q) ) - { - echo $db->get_error(); - break 2; - } - } - } - - // Call any custom functions - foreach ( $installing_versions as $ver ) - { - if ( isset($func_list[$ver]) ) - { - foreach($func_list[$ver] as $function) - { - @call_user_func($function); - } - } - } - - // Log the upgrade - $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,author,page_text,edit_summary) VALUES(\'security\', \'upgrade_enano\', ' . time() . ', \'' . enano_date('d M Y h:i a') . '\', \'' . mysql_real_escape_string($session->username) . '\', \'' . mysql_real_escape_string($this_version) . '\', \'' . mysql_real_escape_string($_SERVER['REMOTE_ADDR']) . '\');'); - - echo 'done!

'; - echo '

You will be redirected shortly. If you aren\'t redirected, click here.

- '; - break; -} -$template->footer(); - -?>