348
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 1
<?php
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 2
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 3
/*
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 4
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
1081
745200a9cc2a
Fixed some upgrade bugs; added support for choosing one's own date/time formats; rebrand as 1.1.7
Dan
diff
changeset
+ − 5
* Copyright (C) 2006-2009 Dan Fuhry
348
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 6
* Installation package
349
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 7
* payload.php - Installer payload (the installation logic)
348
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 8
*
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 9
* This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 10
* as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 11
*
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 12
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 13
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 14
*/
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 15
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 16
if ( !defined('IN_ENANO_INSTALL') )
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 17
die();
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 18
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 19
return true;
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 20
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 21
function stg_sim_good()
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 22
{
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 23
return true;
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 24
}
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 25
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 26
function stg_sim_bad()
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 27
{
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 28
return true;
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 29
}
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 30
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 31
function stg_password_decode()
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 32
{
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 33
global $db;
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 34
static $pass = false;
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 35
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 36
if ( $pass )
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 37
return $pass;
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 38
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 39
if ( !isset($_POST['crypt_data']) && !empty($_POST['password']) && $_POST['password'] === $_POST['password_confirm'] )
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 40
$pass = $_POST['password'];
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 41
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 42
$aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE);
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 43
// retrieve encryption key
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 44
$q = $db->sql_query('SELECT config_value FROM ' . table_prefix . 'config WHERE config_name=\'install_aes_key\';');
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 45
if ( !$q )
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 46
$db->_die();
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 47
if ( $db->numrows() < 1 )
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 48
return false;
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 49
list($aes_key) = $db->fetchrow_num();
616
e311f5e6f904
Got the installer working. Fixed a few bugs including a nasty-to-debug issue where the lang_id was being hardcoded during installation, resulting in strings being inserted with the wrong lang_id causing an infinfinite loop with fetch() throwing a "no strings" error and using template (which calls fetch()) to complain
Dan
diff
changeset
+ − 50
$aes_key = hexdecode($aes_key);
348
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 51
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 52
$pass = $aes->decrypt($_POST['crypt_data'], $aes_key, ENC_HEX);
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 53
if ( !$pass )
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 54
return false;
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 55
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 56
return $pass; // Will be true if the password isn't crapped
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 57
}
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 58
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 59
function stg_make_private_key()
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 60
{
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 61
global $db;
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 62
static $site_key = false;
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 63
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 64
if ( $site_key )
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 65
return $site_key;
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 66
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 67
// Is there already a key cached in the database?
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 68
$q = $db->sql_query('SELECT config_value FROM ' . table_prefix . 'config WHERE config_name=\'site_aes_key\';');
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 69
if ( !$q )
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 70
$db->_die();
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 71
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 72
if ( $db->numrows() > 0 )
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 73
{
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 74
list($site_key) = $db->fetchrow_num();
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 75
$db->free_result();
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 76
return $site_key;
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 77
}
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 78
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 79
$aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE);
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 80
// This will use /dev/urandom if possible
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 81
$site_key = $aes->gen_readymade_key();
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 82
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 83
// Stash it in the database, don't check for errors though because we can always regenerate it
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 84
$db->sql_query('INSERT INTO ' . table_prefix . 'config ( config_name, config_value ) VALUES ( \'site_aes_key\', \'' . $site_key . '\' );');
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 85
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 86
return $site_key;
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 87
}
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 88
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 89
function stg_load_schema()
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 90
{
351
+ − 91
global $db, $dbdriver, $installer_version, $lang_id, $languages;
348
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 92
static $sql_parser = false;
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 93
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 94
if ( is_object($sql_parser) )
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 95
return $sql_parser->parse();
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 96
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 97
$aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE);
801
eb8b23f11744
Two big commits in one day I know, but redid password storage to use HMAC-SHA1. Consolidated much AES processing to three core methods in session that should handle everything automagically. Installation works; upgrades should. Rebranded as 1.1.6.
Dan
diff
changeset
+ − 98
$hmac_secret = hexencode(AESCrypt::randkey(20), '', '');
348
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 99
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 100
$site_key = stg_make_private_key();
616
e311f5e6f904
Got the installer working. Fixed a few bugs including a nasty-to-debug issue where the lang_id was being hardcoded during installation, resulting in strings being inserted with the wrong lang_id causing an infinfinite loop with fetch() throwing a "no strings" error and using template (which calls fetch()) to complain
Dan
diff
changeset
+ − 101
$site_key = hexdecode($site_key);
348
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 102
$admin_pass_clean = stg_password_decode();
801
eb8b23f11744
Two big commits in one day I know, but redid password storage to use HMAC-SHA1. Consolidated much AES processing to three core methods in session that should handle everything automagically. Installation works; upgrades should. Rebranded as 1.1.6.
Dan
diff
changeset
+ − 103
$admin_pass = hmac_sha1($admin_pass_clean, $hmac_secret);
348
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 104
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 105
unset($admin_pass_clean); // Security
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 106
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 107
try
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 108
{
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 109
$sql_parser = new SQL_Parser( ENANO_ROOT . "/install/schemas/{$dbdriver}_stage2.sql" );
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 110
}
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 111
catch ( Exception $e )
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 112
{
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 113
echo "<pre>$e</pre>";
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 114
return false;
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 115
}
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 116
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 117
$vars = array(
383
1030864dc319
Fixed SYSMSG tag in templates causing problems; commented out ENANO_DEBUG; fixed bad table prefix in installer payload logic
Dan
diff
changeset
+ − 118
'TABLE_PREFIX' => table_prefix,
348
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 119
'SITE_NAME' => $db->escape($_POST['site_name']),
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 120
'SITE_DESC' => $db->escape($_POST['site_desc']),
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 121
'COPYRIGHT' => $db->escape($_POST['copyright']),
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 122
// FIXME: update form
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 123
'WIKI_MODE' => ( isset($_POST['wiki_mode']) ? '1' : '0' ),
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 124
'ENABLE_CACHE' => ( is_writable( ENANO_ROOT . '/cache/' ) ? '1' : '0' ),
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 125
'VERSION' => $installer_version['version'],
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 126
'ADMIN_USER' => $db->escape($_POST['username']),
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 127
'ADMIN_PASS' => $admin_pass,
801
eb8b23f11744
Two big commits in one day I know, but redid password storage to use HMAC-SHA1. Consolidated much AES processing to three core methods in session that should handle everything automagically. Installation works; upgrades should. Rebranded as 1.1.6.
Dan
diff
changeset
+ − 128
'ADMIN_PASS_SALT' => $hmac_secret,
348
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 129
'ADMIN_EMAIL' => $db->escape($_POST['email']),
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 130
'REAL_NAME' => '', // This has always been stubbed.
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 131
'ADMIN_EMBED_PHP' => strval(AUTH_DISALLOW),
351
+ − 132
'UNIX_TIME' => strval(time()),
359
+ − 133
'IP_ADDRESS' => $db->escape($_SERVER['REMOTE_ADDR'])
348
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 134
);
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 135
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 136
$sql_parser->assign_vars($vars);
861
+ − 137
return true;
348
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 138
}
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 139
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 140
function stg_deliver_payload()
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 141
{
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 142
global $db;
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 143
$schema = stg_load_schema();
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 144
foreach ( $schema as $sql )
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 145
{
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 146
if ( !$db->sql_query($sql) )
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 147
{
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 148
echo $db->get_error();
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 149
return false;
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 150
}
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 151
}
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 152
return true;
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 153
}
87e08a6e4fec
Welcome to the new Enano installer. Much distance still to be covered but the basics are there.
Dan
parents:
diff
changeset
+ − 154
349
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 155
function stg_write_config()
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 156
{
857
f3a5a276208c
Added support for alternate port numbers on database servers. Also in install-cli, merged in new sysreqs functionality.
Dan
diff
changeset
+ − 157
global $dbhost, $dbuser, $dbpasswd, $dbname, $dbdriver, $dbport;
349
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 158
$db_data = array(
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 159
'host' => str_replace("'", "\\'", $dbhost),
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 160
'user' => str_replace("'", "\\'", $dbuser),
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 161
'pass' => str_replace("'", "\\'", $dbpasswd),
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 162
'name' => str_replace("'", "\\'", $dbname),
857
f3a5a276208c
Added support for alternate port numbers on database servers. Also in install-cli, merged in new sysreqs functionality.
Dan
diff
changeset
+ − 163
'port' => intval($dbport),
349
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 164
'tp' => table_prefix,
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 165
'drv' => $dbdriver
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 166
);
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 167
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 168
// Retrieves the existing key
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 169
$site_key = stg_make_private_key();
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 170
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 171
// Determine contentPath
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 172
switch ( @$_POST['url_scheme'] )
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 173
{
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 174
case 'standard':
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 175
default:
386
+ − 176
$sp_append = '/index.php?title=';
349
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 177
break;
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 178
case 'shortened':
386
+ − 179
$sp_append = '/index.php/';
349
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 180
break;
876
+ − 181
case 'tiny':
+ − 182
$sp_append = '/?/';
+ − 183
break;
349
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 184
case 'rewrite':
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 185
$sp_append = '/';
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 186
break;
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 187
}
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 188
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 189
$scriptpath = scriptPath;
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 190
$contentpath = $scriptpath . $sp_append;
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 191
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 192
$config_file = <<<EOF
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 193
<?php
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 194
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 195
/**
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 196
* Enano site configuration
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 197
* NOTE ON EDITING: You should almost never need to change anything in this
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 198
* file. The only exceptions are when your DB password/other info is changed
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 199
* or if you are moving your Enano installation to another directory.
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 200
*/
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 201
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 202
//
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 203
// DATABASE INFO
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 204
//
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 205
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 206
// Database type to use, currently mysql and postgresql are supported
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 207
\$dbdriver = '{$db_data['drv']}';
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 208
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 209
// Hostname of your database server, probably localhost
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 210
\$dbhost = '{$db_data['host']}';
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 211
857
f3a5a276208c
Added support for alternate port numbers on database servers. Also in install-cli, merged in new sysreqs functionality.
Dan
diff
changeset
+ − 212
// Port number for database server, probably 3306 (MySQL) or 5432 (PostgreSQL)
f3a5a276208c
Added support for alternate port numbers on database servers. Also in install-cli, merged in new sysreqs functionality.
Dan
diff
changeset
+ − 213
\$dbport = '{$db_data['port']}';
f3a5a276208c
Added support for alternate port numbers on database servers. Also in install-cli, merged in new sysreqs functionality.
Dan
diff
changeset
+ − 214
349
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 215
// Username used to connect to the database
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 216
\$dbuser = '{$db_data['user']}';
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 217
// Database password
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 218
\$dbpasswd = '{$db_data['pass']}';
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 219
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 220
// Name of the database
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 221
\$dbname = '{$db_data['name']}';
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 222
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 223
//
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 224
// CONSTANTS
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 225
//
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 226
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 227
// if they're already defined, no use re-defining them
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 228
if ( !defined('ENANO_CONSTANTS') )
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 229
{
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 230
// The prefix for the tables in the database. Useful for holding more than
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 231
// one Enano installation in the same database.
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 232
define('table_prefix', '{$db_data['tp']}');
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 233
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 234
// The path to Enano's files on your server, from the document root. If
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 235
// Enano is installed in your document root this will be blank; installing
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 236
// Enano in /enano/ will result in "/enano" here, etc.
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 237
define('scriptPath', '$scriptpath');
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 238
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 239
// The authoritative prefix for pages. This should be very literal: to
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 240
// generate a URL on the site, the format is basically
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 241
// contentPath . \$page_name. This is based off of scriptPath and the URL
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 242
// scheme selected during installation. Pattern:
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 243
//
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 244
// * Standard URLs: scriptPath . '/index.php?title='
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 245
// * Shortened URLs: scriptPath . '/index.php/'
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 246
// * mod_rewrite: scriptPath . '/'
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 247
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 248
define('contentPath', '$contentpath');
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 249
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 250
// Tell the Enano API that we're installed and that this file is complete
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 251
define('ENANO_INSTALLED', 'You bet!');
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 252
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 253
define('ENANO_CONSTANTS', '');
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 254
}
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 255
1164
1cd9e6df6f27
Installer: cleaned up CSS header; updated comments in config.php to not say that passwords are stored with AES (as they are now stored with HMAC-SHA1)
Dan
diff
changeset
+ − 256
// The AES encryption key used for encrypting various bits of information,
1cd9e6df6f27
Installer: cleaned up CSS header; updated comments in config.php to not say that passwords are stored with AES (as they are now stored with HMAC-SHA1)
Dan
diff
changeset
+ − 257
// such as cookies, that should not be editable by users. Read about
1cd9e6df6f27
Installer: cleaned up CSS header; updated comments in config.php to not say that passwords are stored with AES (as they are now stored with HMAC-SHA1)
Dan
diff
changeset
+ − 258
// Enano's security model at:
349
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 259
// http://docs.enanocms.org/Help:Appendix_B
1164
1cd9e6df6f27
Installer: cleaned up CSS header; updated comments in config.php to not say that passwords are stored with AES (as they are now stored with HMAC-SHA1)
Dan
diff
changeset
+ − 260
// This key was at one point used for passwords as well, but this is no
1cd9e6df6f27
Installer: cleaned up CSS header; updated comments in config.php to not say that passwords are stored with AES (as they are now stored with HMAC-SHA1)
Dan
diff
changeset
+ − 261
// longer true.
349
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 262
\$crypto_key = '$site_key';
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 263
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 264
EOF;
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 265
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 266
// Write config file
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 267
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 268
$ch = @fopen ( ENANO_ROOT . '/config.new.php', 'w' );
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 269
if ( !$ch )
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 270
return false;
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 271
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 272
fwrite($ch, $config_file);
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 273
fclose($ch);
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 274
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 275
// If we are using mod_rewrite, also append any existing .htaccess
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 276
if ( @$_POST['url_scheme'] === 'rewrite' )
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 277
{
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 278
$hh = @fopen ( ENANO_ROOT . '/.htaccess.new', 'w' );
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 279
if ( !$hh )
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 280
return false;
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 281
$hhc = <<<EOF
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 282
#
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 283
# START ENANO RULES
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 284
#
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 285
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 286
# Enable mod_rewrite
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 287
RewriteEngine on
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 288
819
7ef806a90d44
Installer: add RewriteBase to .htaccess to work properly under aliased Apache setups (generated 404s in QA)
Dan
diff
changeset
+ − 289
# Required under some aliased setups
1116
+ − 290
RewriteBase {$scriptpath}/
819
7ef806a90d44
Installer: add RewriteBase to .htaccess to work properly under aliased Apache setups (generated 404s in QA)
Dan
diff
changeset
+ − 291
349
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 292
# Don't rewrite if the user requested a real directory or file
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 293
RewriteCond %{REQUEST_FILENAME} !-f
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 294
RewriteCond %{REQUEST_FILENAME} !-d
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 295
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 296
# Main rule - short and sweet
351
+ − 297
RewriteRule (.*) index.php?title=\$1 [L,QSA]
349
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 298
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 299
EOF;
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 300
fwrite($hh, $hhc);
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 301
fclose($hh);
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 302
}
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 303
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 304
return true;
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 305
}
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 306
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 307
function stg_language_setup()
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 308
{
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 309
global $languages, $db;
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 310
global $lang_id;
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 311
$lang_info =& $languages[$lang_id];
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 312
if ( !is_array($lang_info) )
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 313
return false;
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 314
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 315
// Install the language
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 316
// ($lang_code, $lang_name_neutral, $lang_name_local, $lang_file = false)
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 317
$result = install_language($lang_id, $lang_info['name_eng'], $lang_info['name'], ENANO_ROOT . "/language/{$lang_info['dir']}/core.json");
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 318
if ( !$result )
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 319
return false;
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 320
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 321
$lang_local = new Language($lang_id);
616
e311f5e6f904
Got the installer working. Fixed a few bugs including a nasty-to-debug issue where the lang_id was being hardcoded during installation, resulting in strings being inserted with the wrong lang_id causing an infinfinite loop with fetch() throwing a "no strings" error and using template (which calls fetch()) to complain
Dan
diff
changeset
+ − 322
349
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 323
$lang_local->import( ENANO_ROOT . "/language/{$lang_info['dir']}/user.json" );
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 324
$lang_local->import( ENANO_ROOT . "/language/{$lang_info['dir']}/tools.json" );
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 325
$lang_local->import( ENANO_ROOT . "/language/{$lang_info['dir']}/admin.json" );
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 326
385
+ − 327
$q = $db->sql_query('SELECT lang_id FROM ' . table_prefix . 'language ORDER BY lang_id DESC LIMIT 1;');
+ − 328
if ( !$q )
+ − 329
$db->_die();
+ − 330
+ − 331
list($lang_id_int) = $db->fetchrow_num();
+ − 332
$db->free_result();
+ − 333
setConfig('default_language', $lang_id_int);
+ − 334
349
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 335
return true;
fdaf9070566c
More progress on the installer. At this point it can install and import the language, but does not rename config files. Still much work to be done, most notably localization and creation of MySQL users and databases.
Dan
diff
changeset
+ − 336
}
351
+ − 337
924
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 338
function stg_add_content()
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 339
{
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 340
global $db, $session, $paths, $template, $plugins; // Common objects
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 341
global $cache;
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 342
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 343
global $languages;
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 344
global $lang_id;
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 345
$lang_info =& $languages[$lang_id];
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 346
if ( !is_array($lang_info) )
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 347
return false;
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 348
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 349
if ( $_POST['default_content_type'] === 'tutorial' )
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 350
{
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 351
$dir = ENANO_ROOT . "/language/{$lang_info['dir']}/install/default-tutorial";
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 352
}
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 353
else
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 354
{
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 355
$dir = ENANO_ROOT . "/language/{$lang_info['dir']}/install/default-blank";
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 356
}
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 357
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 358
if ( !$dr = @opendir($dir) )
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 359
return false;
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 360
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 361
while ( $dh = @readdir($dr) )
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 362
{
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 363
if ( !preg_match('/\.txt$/', $dh) )
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 364
continue;
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 365
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 366
$page_contents = @file_get_contents("$dir/$dh");
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 367
if ( empty($page_contents) )
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 368
return false;
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 369
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 370
$page_name = preg_replace('/\.txt$/', '', $dh);
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 371
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 372
if ( !install_primitive_page_creator($page_name, 'Article', $page_contents) )
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 373
return false;
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 374
}
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 375
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 376
closedir($dr);
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 377
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 378
$cache->purge('page_meta');
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 379
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 380
return true;
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 381
}
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 382
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 383
function install_primitive_page_creator($page_id, $namespace, $content)
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 384
{
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 385
global $db, $session, $paths, $template, $plugins; // Common objects
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 386
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 387
$page_title = $db->escape(str_replace('_', ' ', dirtify_page_id($page_id)));
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 388
$author = $db->escape($_POST['username']);
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 389
$page_id = $db->escape($page_id);
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 390
$namespace = $db->escape($namespace);
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 391
// yes, we do probably want strip_all_php ON.
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 392
$content = RenderMan::preprocess_text($content, true, true);
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 393
$now = time();
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 394
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 395
// query 1: logs
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 396
$q = $db->sql_query('INSERT INTO ' . table_prefix . "logs(time_id, date_string, log_type, action, page_id, namespace, author, page_text) VALUES\n"
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 397
. " ( $now, 'DEPRECATED', 'page', 'edit', '$page_id', '$namespace', '$author', '$content');");
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 398
if ( !$q )
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 399
{
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 400
echo $db->get_error();
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 401
return false;
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 402
}
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 403
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 404
// query 2: page_text
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 405
$q = $db->sql_query('INSERT INTO ' . table_prefix . "page_text(page_id, namespace, page_text) VALUES\n"
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 406
. " ( '$page_id', '$namespace', '$content');");
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 407
if ( !$q )
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 408
{
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 409
echo $db->get_error();
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 410
return false;
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 411
}
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 412
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 413
// query 3: pages
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 414
$q = $db->sql_query('INSERT INTO ' . table_prefix . "pages(page_order, name, urlname, namespace, special, visible, comments_on, protected, delvotes, delvote_ips) VALUES\n"
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 415
. " (NULL, '$page_title', '$page_id', '$namespace', 0, 1, 1, 1, 0, '');");
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 416
if ( !$q )
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 417
{
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 418
echo $db->get_error();
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 419
return false;
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 420
}
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 421
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 422
return true;
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 423
}
142a29b583f9
Installer default content is now modular, and can pivot between starting with a blank site and installing a tutorial site.
Dan
diff
changeset
+ − 424
351
+ − 425
function stg_init_logs()
+ − 426
{
+ − 427
global $db, $session, $paths, $template, $plugins; // Common objects
+ − 428
global $installer_version;
+ − 429
1175
1e2c9819ede3
Logs: Fully integrated an author_uid column. Logs are now linked by user ID instead of just username, so they survive username changes better. Database is changed. Fixes issue 6.
Dan
diff
changeset
+ − 430
$q = $db->sql_query('INSERT INTO ' . table_prefix . 'logs(log_type,action,time_id,date_string,author,author_uid,page_text,edit_summary) VALUES(\'security\', \'install_enano\', ' . time() . ', \'' . enano_date(ED_DATE | ED_TIME) . '\', \'' . $db->escape($_POST['username']) . '\', 2, \'' . $db->escape(enano_version()) . '\', \'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\');');
351
+ − 431
if ( !$q )
+ − 432
{
+ − 433
echo '<p><tt>MySQL return: ' . $db->sql_error() . '</tt></p>';
+ − 434
return false;
+ − 435
}
+ − 436
+ − 437
return true;
+ − 438
}
+ − 439
352
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 440
function stg_aes_cleanup()
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 441
{
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 442
global $db, $session, $paths, $template, $plugins; // Common objects
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 443
$q = $db->sql_query('DELETE FROM ' . table_prefix . 'config WHERE config_name = \'install_aes_key\' OR config_name = \'site_aes_key\';');
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 444
if ( !$q )
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 445
$db->_die();
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 446
return true;
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 447
}
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 448
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 449
function _stg_rename_config_revert()
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 450
{
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 451
if ( file_exists('./config.php') )
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 452
{
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 453
@rename('./config.php', './config.new.php');
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 454
}
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 455
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 456
$handle = @fopen('./config.php.new', 'w');
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 457
if ( !$handle )
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 458
return false;
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 459
$contents = '<?php $cryptkey = \'' . _INSTRESUME_AES_KEYBACKUP . '\'; ?>';
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 460
fwrite($handle, $contents);
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 461
fclose($handle);
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 462
return true;
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 463
}
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 464
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 465
function stg_build_index()
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 466
{
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 467
global $db, $session, $paths, $template, $plugins; // Common objects
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 468
if ( $paths->rebuild_search_index() )
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 469
return true;
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 470
return false;
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 471
}
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 472
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 473
function stg_rename_config()
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 474
{
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 475
if ( !@rename(ENANO_ROOT . '/config.new.php', ENANO_ROOT . '/config.php') )
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 476
{
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 477
echo '<p>Can\'t rename config.php</p>';
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 478
_stg_rename_config_revert();
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 479
return false;
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 480
}
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 481
984
+ − 482
if ( @filesize(ENANO_ROOT . '/.htaccess.new') > 1 )
352
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 483
{
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 484
// rename/possibly concatenate .htaccess.new
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 485
$htaccess_base = '';
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 486
if ( file_exists(ENANO_ROOT . '/.htaccess') )
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 487
$htaccess_base .= @file_get_contents(ENANO_ROOT . '/.htaccess');
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 488
if ( strlen($htaccess_base) > 0 && !preg_match("/\n$/", $htaccess_base) )
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 489
$htaccess_base .= "\n\n";
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 490
$htaccess_base .= @file_get_contents(ENANO_ROOT . '/.htaccess.new');
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 491
if ( file_exists(ENANO_ROOT . '/.htaccess') )
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 492
{
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 493
$hh = @fopen(ENANO_ROOT . '/.htaccess', 'w');
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 494
if ( !$hh )
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 495
return false;
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 496
fwrite($hh, $htaccess_base);
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 497
fclose($hh);
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 498
@unlink(ENANO_ROOT . '/.htaccess.new');
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 499
return true;
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 500
}
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 501
else
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 502
{
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 503
return @rename(ENANO_ROOT . '/.htaccess.new', ENANO_ROOT . '/.htaccess');
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 504
}
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 505
}
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 506
else
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 507
{
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 508
@unlink(ENANO_ROOT . '/.htaccess.new');
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 509
}
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 510
return true;
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 511
}
9d7225c0db6d
Enano's new installable installer, alpha 1. No upgrade and (in some parts) very little localization.
Dan
diff
changeset
+ − 512
626
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 513
/**
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 514
* UPGRADE STAGES
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 515
*/
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 516
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 517
function stg_lang_import()
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 518
{
832
7152ca0a0ce9
Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
diff
changeset
+ − 519
global $db, $languages, $do_langimport;
626
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 520
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 521
define('IN_ENANO_UPGRADE_POST', 1);
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 522
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 523
//
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 524
// IMPORT NEW STRINGS
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 525
//
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 526
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 527
// for each installed language, look for the json files in the filesystem and if they're ok, import new strings from them
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 528
$q = $db->sql_query('SELECT lang_id, lang_code FROM ' . table_prefix . "language;");
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 529
if ( !$q )
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 530
$db->_die();
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 531
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 532
while ( $row = $db->fetchrow($q) )
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 533
{
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 534
if ( isset($languages[$row['lang_code']]) )
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 535
{
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 536
// found a language and it's good on the filesystem; load it and call a reimport
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 537
$lang_local = new Language($row['lang_id']);
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 538
// call fetch to make sure we're up to date
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 539
$lang_local->fetch();
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 540
// import
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 541
foreach ( array('core', 'admin', 'user', 'tools') as $language_file )
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 542
{
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 543
// generate full path
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 544
$language_file = ENANO_ROOT . "/language/{$languages[$row['lang_code']]['dir']}/$language_file.json";
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 545
// setting the second parameter to bool(true) causes it to skip existing strings
832
7152ca0a0ce9
Major redesign of rendering pipeline that separates pages saved with MCE from pages saved with the plaintext editor (full description in long commit message)
Dan
diff
changeset
+ − 546
if ( !$lang_local->import($language_file, ( !$do_langimport )) )
626
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 547
// on failure, report failure to libenanoinstall
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 548
return false;
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 549
}
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 550
// unload this lang_local object to save memory
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 551
unset($lang_local);
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 552
}
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 553
}
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 554
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 555
return true;
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 556
}
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 557
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 558
function stg_flush_cache()
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 559
{
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 560
return purge_all_caches();
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 561
}
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 562
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 563
function stg_set_version()
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 564
{
627
+ − 565
global $db, $session, $paths, $template, $plugins; // Common objects
626
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 566
// log the upgrade
1175
1e2c9819ede3
Logs: Fully integrated an author_uid column. Logs are now linked by user ID instead of just username, so they survive username changes better. Database is changed. Fixes issue 6.
Dan
diff
changeset
+ − 567
$q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,author,author_uid,page_text,edit_summary) VALUES'
1e2c9819ede3
Logs: Fully integrated an author_uid column. Logs are now linked by user ID instead of just username, so they survive username changes better. Database is changed. Fixes issue 6.
Dan
diff
changeset
+ − 568
. '(\'security\', \'upgrade_enano\', ' . time() . ', \'[DEPRECATED]\', \'' . $db->escape($session->username) . '\', ' . $session->user_id . ', \'' . $db->escape(installer_enano_version()) . '\', \'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\');');
626
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 569
if ( !$q )
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 570
{
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 571
$db->_die();
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 572
return false;
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 573
}
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 574
setConfig('enano_version', installer_enano_version());
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 575
return true;
be0e904eec17
Refined upgrade process a bit. Uses libenanoinstall (incomplete), and post stage added to flush caches and import new strings
Dan
diff
changeset
+ − 576
}