0
+ − 1
<?php
+ − 2
+ − 3
/*
+ − 4
* Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
166
+ − 5
* Version 1.1.1
0
+ − 6
* upgrade.php - upgrade script
+ − 7
* Copyright (C) 2006-2007 Dan Fuhry
+ − 8
*
+ − 9
* This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
+ − 10
* as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+ − 11
*
+ − 12
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ − 13
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ − 14
*/
+ − 15
289
2b60c89dc27f
Fixed a few major bugs with the upgrade script and the config file not getting loaded properly due to IN_ENANO_INSTALL
Dan
diff
changeset
+ − 16
define('IN_ENANO_INSTALL', 'true');
2b60c89dc27f
Fixed a few major bugs with the upgrade script and the config file not getting loaded properly due to IN_ENANO_INSTALL
Dan
diff
changeset
+ − 17
define('IN_ENANO_UPGRADE', 'true');
0
+ − 18
+ − 19
if(!defined('scriptPath')) {
+ − 20
$sp = dirname($_SERVER['REQUEST_URI']);
+ − 21
if($sp == '/' || $sp == '\\') $sp = '';
+ − 22
define('scriptPath', $sp);
+ − 23
}
+ − 24
+ − 25
if(!defined('contentPath')) {
+ − 26
$sp = dirname($_SERVER['REQUEST_URI']);
+ − 27
if($sp == '/' || $sp == '\\') $sp = '';
+ − 28
define('contentPath', $sp);
+ − 29
}
+ − 30
289
2b60c89dc27f
Fixed a few major bugs with the upgrade script and the config file not getting loaded properly due to IN_ENANO_INSTALL
Dan
diff
changeset
+ − 31
global $this_page, $sideinfo;
2b60c89dc27f
Fixed a few major bugs with the upgrade script and the config file not getting loaded properly due to IN_ENANO_INSTALL
Dan
diff
changeset
+ − 32
2b60c89dc27f
Fixed a few major bugs with the upgrade script and the config file not getting loaded properly due to IN_ENANO_INSTALL
Dan
diff
changeset
+ − 33
function microtime_float()
2b60c89dc27f
Fixed a few major bugs with the upgrade script and the config file not getting loaded properly due to IN_ENANO_INSTALL
Dan
diff
changeset
+ − 34
{
2b60c89dc27f
Fixed a few major bugs with the upgrade script and the config file not getting loaded properly due to IN_ENANO_INSTALL
Dan
diff
changeset
+ − 35
list($usec, $sec) = explode(" ", microtime());
2b60c89dc27f
Fixed a few major bugs with the upgrade script and the config file not getting loaded properly due to IN_ENANO_INSTALL
Dan
diff
changeset
+ − 36
return ((float)$usec + (float)$sec);
2b60c89dc27f
Fixed a few major bugs with the upgrade script and the config file not getting loaded properly due to IN_ENANO_INSTALL
Dan
diff
changeset
+ − 37
}
2b60c89dc27f
Fixed a few major bugs with the upgrade script and the config file not getting loaded properly due to IN_ENANO_INSTALL
Dan
diff
changeset
+ − 38
2b60c89dc27f
Fixed a few major bugs with the upgrade script and the config file not getting loaded properly due to IN_ENANO_INSTALL
Dan
diff
changeset
+ − 39
global $_starttime;
2b60c89dc27f
Fixed a few major bugs with the upgrade script and the config file not getting loaded properly due to IN_ENANO_INSTALL
Dan
diff
changeset
+ − 40
$_starttime = microtime_float();
0
+ − 41
21
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 42
// Determine directory (special case for development servers)
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 43
if ( strpos(__FILE__, '/repo/') && file_exists('.enanodev') )
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 44
{
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 45
$filename = str_replace('/repo/', '/', __FILE__);
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 46
}
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 47
else
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 48
{
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 49
$filename = __FILE__;
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 50
}
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 51
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 52
define('ENANO_ROOT', dirname($filename));
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 53
0
+ − 54
require(ENANO_ROOT.'/includes/constants.php');
+ − 55
+ − 56
if(defined('ENANO_DEBUG'))
+ − 57
{
+ − 58
require_once(ENANO_ROOT.'/includes/debugger/debugConsole.php');
+ − 59
}
+ − 60
else
+ − 61
{
+ − 62
function dc_here($m) { return false; }
+ − 63
function dc_dump($a, $g) { return false; }
+ − 64
function dc_watch($n) { return false; }
+ − 65
function dc_start_timer($u) { return false; }
+ − 66
function dc_stop_timer($m) { return false; }
+ − 67
}
+ − 68
+ − 69
// SCRIPT CONFIGURATION
+ − 70
// Everything related to versions goes here!
+ − 71
+ − 72
// Valid versions to upgrade from
177
+ − 73
$valid_versions = Array('1.0b1', '1.0b2', '1.0b3', '1.0b4', '1.0RC1', '1.0RC2', '1.0RC3', '1.0', '1.0.1', '1.0.1.1', '1.0.2b1', '1.0.2', 'Stable1.0ToUnstable1.1');
0
+ − 74
+ − 75
// Basically a list of dependencies, which should be resolved automatically
21
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 76
// If, for example, upgrading from 1.0b1 to 1.0RC1 requires one extra query that would not
0
+ − 77
// normally be required (for whatever reason) then you would add a custom version number to the array under key '1.0b1'.
+ − 78
$deps_list = Array(
+ − 79
'1.0b1' => Array('1.0b2'),
+ − 80
'1.0b2' => Array('1.0b3'),
+ − 81
'1.0b3' => Array('1.0b4'),
+ − 82
'1.0b4' => Array('1.0RC1'),
21
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 83
'1.0RC1' => Array('1.0RC2'),
73
0a74676a2f2f
Made the move to Loch Ness, and got some basic page grouping functionality working. TODO: fix some UI issues in Javascript ACL editor and change non-JS ACL editor to work with page groups too
Dan
diff
changeset
+ − 84
'1.0RC2' => Array('1.0RC3'),
129
0b5244001799
Rebranded as 1.0.1.1; fixed category page drawing bug; updated link to GPL in the about page to the GPLv2
Dan
diff
changeset
+ − 85
'1.0RC3' => Array('1.0'),
142
ca9118d9c0f2
Rebrand as 1.0.2 (Coblynau); internal links are now parsed by RenderMan::parse_internal_links()
Dan
diff
changeset
+ − 86
'1.0' => Array('1.0.1'),
149
+ − 87
'1.0.1' => Array('1.0.1.1'),
177
+ − 88
'1.0.1.1' => Array('1.0.2b1'),
+ − 89
'1.0.2b1' => Array('Stable1.0ToUnstable1.1'),
+ − 90
'Stable1.0ToUnstable1.1' => Array('1.1.1')
0
+ − 91
);
177
+ − 92
$this_version = '1.1.1';
0
+ − 93
$func_list = Array(
112
+ − 94
'1.0' => Array('u_1_0_1_update_del_votes'),
31
+ − 95
'1.0b4' => Array('u_1_0_RC1_update_user_ids', 'u_1_0_RC1_add_admins_to_group', 'u_1_0_RC1_alter_files_table', 'u_1_0_RC1_destroy_session_cookie', 'u_1_0_RC1_set_contact_email', 'u_1_0_RC1_update_page_text'), // ,
16
+ − 96
// '1.0RC2' => Array('u_1_0_populate_userpage_comments')
290
1201c9412cb6
The template-cache incompatibility bug has finally been isolated, so a function to clear the template cache was added into the upgrade script for 1.0.2
Dan
diff
changeset
+ − 97
'1.0RC3' => Array('u_1_0_RC3_make_users_extra'),
297
ee1fc84f12a8
SECURITY: Tighten default allowed file types; make sure search index rebuild is performed on upgrade
Dan
diff
changeset
+ − 98
'1.0.2b1' => Array('u_1_0_2_nuke_template_cache', 'u_1_0_2_rebuild_search_index')
0
+ − 99
);
+ − 100
+ − 101
if(!isset($_GET['mode']))
+ − 102
{
+ − 103
$_GET['mode'] = 'login';
+ − 104
}
+ − 105
+ − 106
function err($t)
+ − 107
{
+ − 108
global $template;
+ − 109
echo $t;
+ − 110
$template->footer();
+ − 111
exit;
+ − 112
}
+ − 113
+ − 114
require(ENANO_ROOT.'/includes/template.php');
+ − 115
+ − 116
// Initialize the session manager
+ − 117
require(ENANO_ROOT.'/includes/functions.php');
+ − 118
require(ENANO_ROOT.'/includes/dbal.php');
+ − 119
require(ENANO_ROOT.'/includes/paths.php');
+ − 120
require(ENANO_ROOT.'/includes/sessions.php');
+ − 121
require(ENANO_ROOT.'/includes/plugins.php');
+ − 122
require(ENANO_ROOT.'/includes/rijndael.php');
+ − 123
require(ENANO_ROOT.'/includes/render.php');
306
+ − 124
require(ENANO_ROOT.'/includes/search.php');
0
+ − 125
$db = new mysql();
+ − 126
$db->connect();
+ − 127
+ − 128
$plugins = new pluginLoader();
+ − 129
+ − 130
if(!defined('ENANO_CONFIG_FETCHED'))
+ − 131
{
+ − 132
// Select and fetch the site configuration
+ − 133
$e = $db->sql_query('SELECT config_name, config_value FROM '.table_prefix.'config;');
+ − 134
if ( !$e )
+ − 135
{
+ − 136
$db->_die('Some critical configuration information could not be selected.');
+ − 137
}
+ − 138
else
+ − 139
{
+ − 140
define('ENANO_CONFIG_FETCHED', ''); // Used in die_semicritical to figure out whether to call getConfig() or not
+ − 141
}
+ − 142
+ − 143
$enano_config = Array();
+ − 144
while($r = $db->fetchrow())
+ − 145
{
+ − 146
$enano_config[$r['config_name']] = $r['config_value'];
+ − 147
}
+ − 148
$db->free_result();
+ − 149
}
+ − 150
+ − 151
$v = enano_version();
+ − 152
if(in_array($v, Array(false, '', '1.0b3', '1.0b4')))
+ − 153
{
+ − 154
$ul_admin = 2;
+ − 155
$ul_mod = 1;
+ − 156
$ul_member = 0;
+ − 157
$ul_guest = -1;
+ − 158
}
+ − 159
else
+ − 160
{
+ − 161
$ul_admin = USER_LEVEL_ADMIN;
+ − 162
$ul_mod = USER_LEVEL_MOD;
+ − 163
$ul_member = USER_LEVEL_MEMBER;
+ − 164
$ul_guest = USER_LEVEL_GUEST;
+ − 165
}
+ − 166
+ − 167
$_GET['title'] = 'unset';
+ − 168
+ − 169
$session = new sessionManager();
+ − 170
$paths = new pathManager();
+ − 171
$session->start();
+ − 172
+ − 173
$template = new template_nodb();
+ − 174
$template->load_theme('oxygen', 'bleu', false);
+ − 175
+ − 176
$modestrings = Array(
+ − 177
'login' => 'Administrative login',
+ − 178
'welcome' => 'Welcome',
+ − 179
'setversion' => 'Select Enano version',
+ − 180
'confirm' => 'Confirm upgrade',
+ − 181
'upgrade' => 'Database installation',
+ − 182
'finish' => 'Upgrade complete'
+ − 183
);
+ − 184
+ − 185
$sideinfo = '';
+ − 186
$vars = $template->extract_vars('elements.tpl');
+ − 187
$p = $template->makeParserText($vars['sidebar_button']);
+ − 188
foreach ( $modestrings as $id => $str )
+ − 189
{
+ − 190
if ( $_GET['mode'] == $id )
+ − 191
{
+ − 192
$flags = 'style="font-weight: bold; text-decoration: underline;"';
+ − 193
$this_page = $str;
+ − 194
}
+ − 195
else
+ − 196
{
+ − 197
$flags = '';
+ − 198
}
+ − 199
$p->assign_vars(Array(
+ − 200
'HREF' => '#',
+ − 201
'FLAGS' => $flags . ' onclick="return false;"',
+ − 202
'TEXT' => $str
+ − 203
));
+ − 204
$sideinfo .= $p->run();
+ − 205
}
+ − 206
+ − 207
$template->init_vars();
+ − 208
+ − 209
function upg_assign_vars($schema)
+ − 210
{
+ − 211
$schema = str_replace('{{SITE_NAME}}', mysql_real_escape_string(getConfig('site_name')), $schema);
+ − 212
$schema = str_replace('{{SITE_DESC}}', mysql_real_escape_string(getConfig('site_desc')), $schema);
+ − 213
$schema = str_replace('{{COPYRIGHT}}', mysql_real_escape_string(getConfig('copyright_notice')), $schema);
+ − 214
$schema = str_replace('{{TABLE_PREFIX}}', table_prefix, $schema);
+ − 215
if(getConfig('wiki_mode')=='1') $schema = str_replace('{{WIKI_MODE}}', '1', $schema);
+ − 216
else $schema = str_replace('{{WIKI_MODE}}', '0', $schema);
+ − 217
return $schema;
+ − 218
}
+ − 219
+ − 220
/* Version-specific functions */
+ − 221
+ − 222
function u_1_0_RC1_update_user_ids()
+ − 223
{
+ − 224
global $db;
+ − 225
// First, make sure this hasn't already been done
+ − 226
$q = $db->sql_query('SELECT username FROM '.table_prefix.'users WHERE user_id=1;');
+ − 227
if ( !$q )
+ − 228
$db->_die();
+ − 229
$row = $db->fetchrow();
+ − 230
if ( $row['username'] == 'Anonymous' )
+ − 231
return true;
+ − 232
// Find the first unused user ID
+ − 233
$used = Array();
95
1dac77b46f07
Changed style of copyright in St. Patty; first attempt at fixing some upgrade issues from beta 3 or so
dan
diff
changeset
+ − 234
$q = $db->sql_query('SELECT user_id FROM '.table_prefix.'users;');
0
+ − 235
if ( !$q )
+ − 236
$db->_die();
95
1dac77b46f07
Changed style of copyright in St. Patty; first attempt at fixing some upgrade issues from beta 3 or so
dan
diff
changeset
+ − 237
$notfirst = false;
0
+ − 238
while ( $row = $db->fetchrow() )
+ − 239
{
+ − 240
$i = intval($row['user_id']);
+ − 241
$used[$i] = true;
95
1dac77b46f07
Changed style of copyright in St. Patty; first attempt at fixing some upgrade issues from beta 3 or so
dan
diff
changeset
+ − 242
if ( !isset($used[$i - 1]) && $notfirst )
0
+ − 243
{
+ − 244
$id = $i - 1;
+ − 245
break;
+ − 246
}
95
1dac77b46f07
Changed style of copyright in St. Patty; first attempt at fixing some upgrade issues from beta 3 or so
dan
diff
changeset
+ − 247
$notfirst = true;
0
+ − 248
}
+ − 249
if ( !isset($id) )
+ − 250
$id = $i + 1;
95
1dac77b46f07
Changed style of copyright in St. Patty; first attempt at fixing some upgrade issues from beta 3 or so
dan
diff
changeset
+ − 251
if ( $id == 0 )
1dac77b46f07
Changed style of copyright in St. Patty; first attempt at fixing some upgrade issues from beta 3 or so
dan
diff
changeset
+ − 252
$id = 2;
0
+ − 253
$db->free_result();
+ − 254
+ − 255
$q = $db->sql_query('UPDATE '.table_prefix.'users SET user_id=' . $id . ' WHERE user_id=1;');
+ − 256
if(!$q)
+ − 257
$db->_die();
+ − 258
$q = $db->sql_query('UPDATE '.table_prefix.'users SET user_id=1 WHERE user_id=-1 AND username=\'Anonymous\';');
+ − 259
if(!$q)
+ − 260
$db->_die();
+ − 261
+ − 262
}
+ − 263
+ − 264
function u_1_0_RC1_add_admins_to_group()
+ − 265
{
+ − 266
global $db;
+ − 267
$q = $db->sql_query('SELECT user_id FROM '.table_prefix.'users WHERE user_level=' . USER_LEVEL_ADMIN . ';');
+ − 268
if ( !$q )
+ − 269
$db->_die();
+ − 270
$base = 'INSERT INTO '.table_prefix.'group_members(group_id,user_id) VALUES';
+ − 271
$blocks = Array();
+ − 272
while ( $row = $db->fetchrow($q) )
+ − 273
{
+ − 274
$blocks[] = '(2,' . $row['user_id'] . ')';
+ − 275
}
+ − 276
$blocks = implode(',', $blocks);
+ − 277
$sql = $base . $blocks . ';';
+ − 278
if(!$db->sql_query($sql))
+ − 279
$db->_die();
+ − 280
}
+ − 281
+ − 282
function u_1_0_RC1_alter_files_table()
+ − 283
{
+ − 284
global $db;
+ − 285
if(!is_dir(ENANO_ROOT.'/files'))
+ − 286
@mkdir(ENANO_ROOT . '/files');
+ − 287
if(!is_dir(ENANO_ROOT.'/files'))
+ − 288
die('ERROR: Couldn\'t create files directory');
+ − 289
$q = $db->sql_unbuffered_query('SELECT * FROM '.table_prefix.'files;', $db->_conn);
+ − 290
if(!$q) $db->_die();
+ − 291
while ( $row = $db->fetchrow() )
+ − 292
{
+ − 293
$file_data = base64_decode($row['data']);
+ − 294
$path = ENANO_ROOT . '/files/' . md5( $row['filename'] . '_' . $file_data ) . '_' . $row['time_id'] . $row['file_extension'];
+ − 295
@unlink($path);
+ − 296
$handle = @fopen($path, 'w');
+ − 297
if(!$handle)
+ − 298
die('fopen failed');
+ − 299
fwrite($handle, $file_data);
+ − 300
fclose($handle);
+ − 301
+ − 302
}
+ − 303
+ − 304
$q = $db->sql_query('ALTER TABLE '.table_prefix.'files DROP PRIMARY KEY, ADD COLUMN file_id int(12) NOT NULL auto_increment FIRST, ADD PRIMARY KEY (file_id), ADD COLUMN file_key varchar(32) NOT NULL;');
+ − 305
if(!$q) $db->_die();
+ − 306
+ − 307
$list = Array();
+ − 308
$q = $db->sql_unbuffered_query('SELECT * FROM '.table_prefix.'files;', $db->_conn);
+ − 309
if(!$q) $db->_die();
+ − 310
while ( $row = $db->fetchrow($q) )
+ − 311
{
+ − 312
$file_data = base64_decode($row['data']);
+ − 313
$key = md5( $row['filename'] . '_' . $file_data );
+ − 314
$list[] = 'UPDATE '.table_prefix.'files SET file_key=\'' . $key . '\' WHERE file_id=' . $row['file_id'] . ';';
+ − 315
}
+ − 316
+ − 317
foreach ( $list as $sql )
+ − 318
{
+ − 319
if(!$db->sql_query($sql)) $db->_die();
+ − 320
}
+ − 321
+ − 322
if(!$db->sql_query('ALTER TABLE '.table_prefix.'files DROP data')) $db->_die();
+ − 323
+ − 324
}
+ − 325
+ − 326
function u_1_0_RC1_destroy_session_cookie()
+ − 327
{
+ − 328
unset($_COOKIE['sid']);
+ − 329
setcookie('sid', '', time()-3600*24, scriptPath);
+ − 330
setcookie('sid', '', time()-3600*24, scriptPath.'/');
+ − 331
}
+ − 332
+ − 333
function u_1_0_RC1_set_contact_email()
+ − 334
{
+ − 335
global $db;
+ − 336
$q = $db->sql_query('SELECT email FROM '.table_prefix.'users WHERE user_level='.USER_LEVEL_ADMIN.' ORDER BY user_level ASC LIMIT 1;');
+ − 337
if(!$q)
+ − 338
$db->_die();
+ − 339
$row = $db->fetchrow();
+ − 340
setConfig('contact_email', $row['email']);
+ − 341
}
+ − 342
+ − 343
function u_1_0_RC1_update_page_text()
+ − 344
{
+ − 345
global $db;
+ − 346
$q = $db->sql_unbuffered_query('SELECT page_id,namespace,page_text,char_tag FROM '.table_prefix.'page_text');
+ − 347
if (!$q)
+ − 348
$db->_die();
+ − 349
+ − 350
$qs = array();
+ − 351
+ − 352
while ( $row = $db->fetchrow($q) )
+ − 353
{
+ − 354
$row['page_text'] = str_replace(Array(
+ − 355
"{QUOT:{$row['char_tag']}}",
+ − 356
"{APOS:{$row['char_tag']}}",
+ − 357
"{SLASH:{$row['char_tag']}}"
+ − 358
), Array(
+ − 359
'"', "'", '\\'
+ − 360
), $row['page_text']);
+ − 361
$qs[] = 'UPDATE '.table_prefix.'page_text SET page_text=\'' . mysql_real_escape_string($row['page_text']) . '\'
+ − 362
WHERE page_id=\'' . mysql_real_escape_string($row['page_id']) . '\' AND
+ − 363
namespace=\'' . mysql_real_escape_string($row['namespace']) . '\';';
+ − 364
}
+ − 365
+ − 366
foreach($qs as $query)
+ − 367
{
+ − 368
if(!$db->sql_query($query))
+ − 369
$db->_die();
+ − 370
}
+ − 371
}
+ − 372
112
+ − 373
function u_1_0_1_update_del_votes()
0
+ − 374
{
+ − 375
global $db;
112
+ − 376
$q = $db->sql_query('SELECT urlname, namespace, delvote_ips FROM '.table_prefix.'pages;');
0
+ − 377
if ( !$q )
+ − 378
$db->_die();
+ − 379
112
+ − 380
while ( $row = $db->fetchrow($q) )
0
+ − 381
{
112
+ − 382
$ips = strval($row['delvote_ips']);
+ − 383
if ( is_array( @unserialize($ips) ) )
+ − 384
continue;
+ − 385
$ips = explode('|', $ips);
+ − 386
$new = array(
+ − 387
'ip' => array(),
+ − 388
'u' => array()
+ − 389
);
+ − 390
$i = 0;
+ − 391
$prev = '';
+ − 392
$prev_is_ip = false;
+ − 393
foreach ( $ips as $ip )
+ − 394
{
+ − 395
$i++;
+ − 396
$current_is_ip = is_valid_ip($ip);
+ − 397
if ( $current_is_ip && $prev_is_ip )
+ − 398
{
113
+ − 399
$i++;
112
+ − 400
$new['u'][] = $prev;
+ − 401
}
+ − 402
if ( $current_is_ip )
+ − 403
{
+ − 404
$new['ip'][] = $ip;
+ − 405
}
+ − 406
else
+ − 407
{
+ − 408
$new['u'][] = $ip;
+ − 409
}
+ − 410
$prev = $ip;
+ − 411
$prev_is_ip = $current_is_ip;
+ − 412
}
113
+ − 413
if ( $i % 2 == 1 && $prev_is_ip )
+ − 414
{
+ − 415
$new['u'][] = $ip;
+ − 416
}
112
+ − 417
$new = serialize($new);
+ − 418
$e = $db->sql_query('UPDATE '.table_prefix.'pages SET delvote_ips=\'' . $db->escape($new) . '\' WHERE urlname=\'' . $db->escape($row['urlname']) . '\' AND namespace=\'' . $db->escape($row['namespace']) . '\';');
+ − 419
if ( !$e )
+ − 420
$db->_die();
0
+ − 421
}
112
+ − 422
$db->free_result($q);
0
+ − 423
}
+ − 424
31
+ − 425
function u_1_0_RC3_make_users_extra()
+ − 426
{
+ − 427
global $db;
95
1dac77b46f07
Changed style of copyright in St. Patty; first attempt at fixing some upgrade issues from beta 3 or so
dan
diff
changeset
+ − 428
$q = $db->sql_query('SELECT user_id FROM '.table_prefix.'users WHERE user_id > 0;');
31
+ − 429
if ( !$q )
+ − 430
$db->_die();
+ − 431
+ − 432
$ids = array();
+ − 433
while ( $row = $db->fetchrow() )
+ − 434
{
+ − 435
$ids[] = intval($row['user_id']);
+ − 436
}
+ − 437
+ − 438
$ids = '(' . implode('),(', $ids) . ')';
95
1dac77b46f07
Changed style of copyright in St. Patty; first attempt at fixing some upgrade issues from beta 3 or so
dan
diff
changeset
+ − 439
if ( $ids == '' )
1dac77b46f07
Changed style of copyright in St. Patty; first attempt at fixing some upgrade issues from beta 3 or so
dan
diff
changeset
+ − 440
return false;
31
+ − 441
$sql = "INSERT INTO " . table_prefix . "users_extra(user_id) VALUES$ids;";
+ − 442
+ − 443
if ( !$db->sql_query($sql) )
+ − 444
$db->_die();
+ − 445
}
+ − 446
290
1201c9412cb6
The template-cache incompatibility bug has finally been isolated, so a function to clear the template cache was added into the upgrade script for 1.0.2
Dan
diff
changeset
+ − 447
function u_1_0_2_nuke_template_cache()
1201c9412cb6
The template-cache incompatibility bug has finally been isolated, so a function to clear the template cache was added into the upgrade script for 1.0.2
Dan
diff
changeset
+ − 448
{
1201c9412cb6
The template-cache incompatibility bug has finally been isolated, so a function to clear the template cache was added into the upgrade script for 1.0.2
Dan
diff
changeset
+ − 449
$dir = @opendir(ENANO_ROOT . '/cache');
1201c9412cb6
The template-cache incompatibility bug has finally been isolated, so a function to clear the template cache was added into the upgrade script for 1.0.2
Dan
diff
changeset
+ − 450
if ( !$dir )
1201c9412cb6
The template-cache incompatibility bug has finally been isolated, so a function to clear the template cache was added into the upgrade script for 1.0.2
Dan
diff
changeset
+ − 451
{
1201c9412cb6
The template-cache incompatibility bug has finally been isolated, so a function to clear the template cache was added into the upgrade script for 1.0.2
Dan
diff
changeset
+ − 452
return false;
1201c9412cb6
The template-cache incompatibility bug has finally been isolated, so a function to clear the template cache was added into the upgrade script for 1.0.2
Dan
diff
changeset
+ − 453
}
1201c9412cb6
The template-cache incompatibility bug has finally been isolated, so a function to clear the template cache was added into the upgrade script for 1.0.2
Dan
diff
changeset
+ − 454
while ( ($fname = @readdir($dir)) )
1201c9412cb6
The template-cache incompatibility bug has finally been isolated, so a function to clear the template cache was added into the upgrade script for 1.0.2
Dan
diff
changeset
+ − 455
{
1201c9412cb6
The template-cache incompatibility bug has finally been isolated, so a function to clear the template cache was added into the upgrade script for 1.0.2
Dan
diff
changeset
+ − 456
if ( preg_match('/\.tpl\.php$/', $fname) )
1201c9412cb6
The template-cache incompatibility bug has finally been isolated, so a function to clear the template cache was added into the upgrade script for 1.0.2
Dan
diff
changeset
+ − 457
{
1201c9412cb6
The template-cache incompatibility bug has finally been isolated, so a function to clear the template cache was added into the upgrade script for 1.0.2
Dan
diff
changeset
+ − 458
unlink( ENANO_ROOT . '/cache/' . $fname );
1201c9412cb6
The template-cache incompatibility bug has finally been isolated, so a function to clear the template cache was added into the upgrade script for 1.0.2
Dan
diff
changeset
+ − 459
}
1201c9412cb6
The template-cache incompatibility bug has finally been isolated, so a function to clear the template cache was added into the upgrade script for 1.0.2
Dan
diff
changeset
+ − 460
}
1201c9412cb6
The template-cache incompatibility bug has finally been isolated, so a function to clear the template cache was added into the upgrade script for 1.0.2
Dan
diff
changeset
+ − 461
}
1201c9412cb6
The template-cache incompatibility bug has finally been isolated, so a function to clear the template cache was added into the upgrade script for 1.0.2
Dan
diff
changeset
+ − 462
297
ee1fc84f12a8
SECURITY: Tighten default allowed file types; make sure search index rebuild is performed on upgrade
Dan
diff
changeset
+ − 463
function u_1_0_2_rebuild_search_index()
ee1fc84f12a8
SECURITY: Tighten default allowed file types; make sure search index rebuild is performed on upgrade
Dan
diff
changeset
+ − 464
{
ee1fc84f12a8
SECURITY: Tighten default allowed file types; make sure search index rebuild is performed on upgrade
Dan
diff
changeset
+ − 465
global $paths;
ee1fc84f12a8
SECURITY: Tighten default allowed file types; make sure search index rebuild is performed on upgrade
Dan
diff
changeset
+ − 466
@set_time_limit(0);
ee1fc84f12a8
SECURITY: Tighten default allowed file types; make sure search index rebuild is performed on upgrade
Dan
diff
changeset
+ − 467
$paths->rebuild_search_index();
ee1fc84f12a8
SECURITY: Tighten default allowed file types; make sure search index rebuild is performed on upgrade
Dan
diff
changeset
+ − 468
}
ee1fc84f12a8
SECURITY: Tighten default allowed file types; make sure search index rebuild is performed on upgrade
Dan
diff
changeset
+ − 469
0
+ − 470
switch($_GET['mode'])
+ − 471
{
+ − 472
case "login":
110
+ − 473
if ( $session->user_logged_in && $session->user_level < $ul_admin )
+ − 474
{
+ − 475
$template->header();
+ − 476
echo '<p>Your user account does not have permission to perform an upgrade of Enano. Return to the <a href="index.php">index page</a>.</p>';
+ − 477
$template->footer();
+ − 478
exit;
+ − 479
}
0
+ − 480
if($session->user_logged_in && $session->user_level >= $ul_admin)
+ − 481
{
+ − 482
if(isset($_POST['login']))
+ − 483
{
181
06bdbdfec160
Upgrade UI should work now (upgrades still don't work); do not pull this revision as there is a security hole in the lockout system pending a fix
Dan
diff
changeset
+ − 484
$result = $session->login_without_crypto($_POST['username'], $_POST['password'], false, $ul_admin);
0
+ − 485
if($session->sid_super)
+ − 486
{
+ − 487
header('Location: upgrade.php?mode=welcome&auth='.$session->sid_super);
+ − 488
exit;
+ − 489
}
+ − 490
}
+ − 491
$template->header();
+ − 492
?>
+ − 493
<form action="upgrade.php?mode=login" method="post">
+ − 494
<table border="0" style="margin-left: auto; margin-right: auto; margin-top: 5px;" cellspacing="1" cellpadding="4">
+ − 495
<tr>
+ − 496
<th colspan="2">You must re-authenticate to perform this upgrade.</th>
+ − 497
</tr>
+ − 498
<?php
+ − 499
if(isset($_POST['login']))
+ − 500
{
181
06bdbdfec160
Upgrade UI should work now (upgrades still don't work); do not pull this revision as there is a security hole in the lockout system pending a fix
Dan
diff
changeset
+ − 501
echo '<tr><td colspan="2"><p style="color: red;">Login failed: '. $result['error'] . '</p></td></tr>';
0
+ − 502
}
+ − 503
?>
+ − 504
<tr>
+ − 505
<td>Username:</td><td><input type="text" name="username" size="30" /></td>
+ − 506
</tr>
+ − 507
<tr>
+ − 508
<td>Password:</td><td><input type="password" name="password" size="30" /></td>
+ − 509
</tr>
+ − 510
<tr>
+ − 511
<td colspan="2" style="text-align: center;"><input type="submit" name="login" value="Log in" />
+ − 512
</tr>
+ − 513
</table>
+ − 514
</form>
+ − 515
<?php
+ − 516
}
+ − 517
else
+ − 518
{
+ − 519
if(isset($_POST['login']))
+ − 520
{
+ − 521
$result = $session->login_without_crypto($_POST['username'], $_POST['password'], false, $ul_member);
+ − 522
if($result == 'success')
+ − 523
{
+ − 524
header('Location: upgrade.php');
+ − 525
exit;
+ − 526
}
+ − 527
}
+ − 528
$template->header();
+ − 529
?>
+ − 530
<form action="upgrade.php?mode=login" method="post">
+ − 531
<table border="0" style="margin-left: auto; margin-right: auto; margin-top: 5px;" cellspacing="1" cellpadding="4">
+ − 532
<tr>
+ − 533
<th colspan="2">Please log in to continue with this upgrade.</th>
+ − 534
</tr>
+ − 535
<?php
+ − 536
if(isset($_POST['login']))
+ − 537
{
+ − 538
echo '<tr><td colspan="2"><p style="color: red;">Login failed. Bad password?</p></td></tr>';
+ − 539
}
+ − 540
?>
+ − 541
<tr>
+ − 542
<td>Username:</td><td><input type="text" name="username" size="30" /></td>
+ − 543
</tr>
+ − 544
<tr>
+ − 545
<td>Password:</td><td><input type="password" name="password" size="30" /></td>
+ − 546
</tr>
+ − 547
<tr>
+ − 548
<td colspan="2" style="text-align: center;"><input type="submit" name="login" value="Log in" />
+ − 549
</tr>
+ − 550
</table>
+ − 551
</form>
+ − 552
<?php
+ − 553
}
+ − 554
break;
+ − 555
case "welcome":
+ − 556
if(!$session->sid_super) { $template->header(); echo '<p>No admin session found! Please <a href="upgrade.php">restart the upgrade</a>.</p>'; $template->footer(); exit; }
+ − 557
+ − 558
// Just show a simple welcome page to display version information
+ − 559
$template->header();
+ − 560
require('config.php');
+ − 561
+ − 562
?>
+ − 563
+ − 564
<div style="text-align: center; margin-top: 10px;">
+ − 565
<img alt="[ Enano CMS Project logo ]" src="images/enano-artwork/installer-greeting-blue.png" style="display: block; margin: 0 auto; padding-left: 134px;" />
+ − 566
<h2>Welcome to the Enano upgrade wizard</h2>
+ − 567
<?php
+ − 568
if ( file_exists('./_nightly.php') )
+ − 569
{
+ − 570
echo '<div class="warning-box" style="text-align: left; margin: 10px auto; display: table; width: 60%;"><b>You are about to upgrade to a NIGHTLY BUILD of Enano.</b><br />Nightly builds CANNOT be re-upgraded to the final release. They may also contain serious flaws, security problems, or extraneous debugging information. Continuing this process on a production site is NOT recommended.</div>';
+ − 571
}
+ − 572
?>
+ − 573
</div>
+ − 574
<div style="display: table; margin: 0 auto;">
+ − 575
<p>You are about to upgrade Enano to version <b><?php echo $this_version; ?></b>. Before you continue, please ensure that:</p>
+ − 576
<ul>
+ − 577
<li>You have completely backed up your database (<b><?php echo "$dbhost:$dbname"; ?></b>)</li>
+ − 578
<li>You have backed up the entire Enano directory (<b><?php echo ENANO_ROOT; ?></b>)</li>
+ − 579
<li>You have reviewed the release notes for this version, and you<br />are comfortable with any known bugs or issues</li>
91
+ − 580
<li>If you've configured Enano to work using a MySQL user with restricted<br />privileges, you need to enable ALTER, CREATE TABLE, and CREATE INDEX privileges<br />for this upgrade to work.</li>
0
+ − 581
</ul>
+ − 582
</div>
+ − 583
<div style="text-align: center; margin-top: 10px;">
+ − 584
<form action="upgrade.php?mode=setversion&auth=<?php echo $session->sid_super; ?>" method="post">
+ − 585
<input type="submit" value="Continue with upgrade" />
+ − 586
</form>
+ − 587
</div>
+ − 588
+ − 589
<?php
+ − 590
+ − 591
break;
+ − 592
case "setversion":
+ − 593
if(!$session->sid_super) { $template->header(); echo '<p>No admin session found! Please <a href="upgrade.php">restart the upgrade</a>.</p>'; $template->footer(); exit; }
+ − 594
$v = ( function_exists('enano_version') ) ? enano_version() : '';
+ − 595
if(!in_array($v, $valid_versions) && $v != '')
+ − 596
{
+ − 597
$template->header();
+ − 598
?>
+ − 599
<p>Your version of Enano (<?php echo $v; ?>) can't be upgraded to this version (<?php echo $this_version; ?>).</p>
+ − 600
<?php
+ − 601
break;
21
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 602
}
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 603
else if($v == '')
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 604
{
0
+ − 605
// OK, we don't know which version he's running. So we'll cheat ;-)
+ − 606
$template->header();
+ − 607
echo "<form action='upgrade.php?mode=confirm&auth={$session->sid_super}' method='post'>";
+ − 608
?>
+ − 609
<p>Sorry, we couldn't detect which version of Enano you're running on your server. Please select which version of Enano you have below, and make absolutely sure that you're correct.</p>
+ − 610
<p><select name="version"><?php
+ − 611
foreach($valid_versions as $c)
+ − 612
{
+ − 613
echo "<option value='{$c}'>{$c}</option>";
+ − 614
}
+ − 615
?></select></p>
+ − 616
<p>
+ − 617
<input type="submit" value="Continue" />
+ − 618
</p>
+ − 619
<?php
+ − 620
echo `</form>`;
+ − 621
break;
21
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 622
}
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 623
else
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 624
{
0
+ − 625
header('Location: upgrade.php?mode=confirm&auth='.$session->sid_super);
+ − 626
}
+ − 627
break;
+ − 628
case "confirm":
+ − 629
$enano_version = ( isset($_POST['version']) ) ? $_POST['version'] : enano_version();
+ − 630
+ − 631
$template->header();
+ − 632
if(!$session->sid_super) { echo '<p>No admin session found! Please <a href="upgrade.php">restart the upgrade</a>.</p>'; $template->footer(); exit; }
+ − 633
?>
+ − 634
<form action="upgrade.php?mode=upgrade&auth=<?php echo $session->sid_super; ?>" method="post">
+ − 635
<table border="0" style="margin-left: auto; margin-right: auto; margin-top: 5px;" cellspacing="1" cellpadding="4">
+ − 636
<tr>
+ − 637
<td colspan="2"><p><b>Are you sure you want to perform this upgrade?</b></p><p>You can still cancel the upgrade process now. If<br />the upgrade fails, you will need to roll back<br />any actions made using manual SQL queries.</p><p><b>Please clear your browser cache or<br />shift-reload after the upgrade.</b><br />If you fail to do so, some page elements may<br />be broken.</td>
+ − 638
</tr>
+ − 639
<tr>
+ − 640
<td colspan="2" style="text-align: center;">
+ − 641
<input type="hidden" name="enano_version" value="<?php echo $enano_version; ?>" />
+ − 642
<input type="submit" name="doit" value="Upgrade Enano!" />
+ − 643
</td>
+ − 644
</tr>
+ − 645
</table>
+ − 646
</form>
+ − 647
<?php
+ − 648
break;
+ − 649
case "upgrade":
+ − 650
$template->header();
+ − 651
if(!$session->sid_super) { echo '<p>No admin session found! Please <a href="upgrade.php">restart the upgrade</a>.</p>'; $template->footer(); exit; }
+ − 652
if(!isset($_POST['enano_version'])) { echo '<p>Can\'t find the version information on the POST query, are you trying to do this upgrade directly? Please <a href="upgrade.php">restart the upgrade</a>.</p>'; break; }
+ − 653
$enano_version = $_POST['enano_version'];
+ − 654
echo '<p>Preparing for schema execution...';
+ − 655
// Build an array of queries
+ − 656
$schema = file_get_contents('upgrade.sql');
+ − 657
+ − 658
// Strip out and process version blocks
149
+ − 659
preg_match_all('#---BEGIN ([0-9A-z\.\-]*?)---'."\n".'((.*?)'."\n)?".'---END \\1---#is', $schema, $matches);
0
+ − 660
+ − 661
$from_list =& $matches[1];
149
+ − 662
$query_list =& $matches[3];
0
+ − 663
+ − 664
foreach($matches[0] as $m)
+ − 665
{
+ − 666
$schema = str_replace($m, '', $schema);
+ − 667
}
+ − 668
$schema = explode("\n", $schema);
+ − 669
foreach($schema as $k => $q)
+ − 670
{
+ − 671
if(substr($q, 0, 2) == '--' || $q == '')
+ − 672
{
+ − 673
unset($schema[$k]);
+ − 674
//die('<pre>'.htmlspecialchars(print_r($schema, true)).'</pre>');
+ − 675
}
+ − 676
else
+ − 677
{
+ − 678
$schema[$k] = upg_assign_vars($schema[$k]);
+ − 679
}
+ − 680
}
+ − 681
+ − 682
foreach($query_list as $k => $q)
+ − 683
{
+ − 684
$query_list[$k] = explode("\n", $query_list[$k]);
+ − 685
foreach($query_list[$k] as $i => $s)
+ − 686
{
+ − 687
$tq =& $query_list[$k][$i];
+ − 688
if(substr($s, 0, 2) == '--' || $s == '')
+ − 689
{
+ − 690
unset($query_list[$k][$i]);
+ − 691
//die('<pre>'.htmlspecialchars(print_r($schema, true)).'</pre>');
+ − 692
}
+ − 693
else
+ − 694
{
+ − 695
$query_list[$k][$i] = upg_assign_vars($query_list[$k][$i]);
+ − 696
}
+ − 697
}
+ − 698
$query_list[$k] = array_values($query_list[$k]);
+ − 699
}
+ − 700
+ − 701
$assoc_list = Array();
+ − 702
+ − 703
foreach($from_list as $i => $v)
+ − 704
{
+ − 705
$assoc_list[$v] = $query_list[$i];
+ − 706
}
+ − 707
+ − 708
$schema = array_values($schema);
+ − 709
+ − 710
$deps_resolved = false;
+ − 711
$installing_versions = Array($enano_version);
+ − 712
+ − 713
while(true)
+ − 714
{
+ − 715
$v = array_keys($deps_list);
+ − 716
foreach($v as $i => $ver)
+ − 717
{
+ − 718
if(in_array($ver, $installing_versions))
+ − 719
{
+ − 720
// $ver is on the list of versions to be installed. Add its dependencies to the list of versions to install.
+ − 721
foreach($deps_list[$ver] as $dep)
+ − 722
{
+ − 723
if(!in_array($dep, $installing_versions))
+ − 724
{
+ − 725
$installing_versions[] = $dep;
+ − 726
}
+ − 727
}
+ − 728
}
+ − 729
if($i == count($deps_list) - 1)
+ − 730
{
+ − 731
break 2;
+ − 732
}
+ − 733
}
+ − 734
}
+ − 735
+ − 736
foreach($installing_versions as $this_ver)
+ − 737
{
+ − 738
$schema = array_merge($schema, $assoc_list[$this_ver]);
+ − 739
}
+ − 740
+ − 741
// Time for some proper SQL syntax!
+ − 742
// Also check queries for so-called injection attempts to make
+ − 743
// sure that it doesn't fail during the upgrade process and
+ − 744
// leave the user with a half-upgraded database
+ − 745
foreach($schema as $s => $q)
+ − 746
{
+ − 747
if(substr($q, strlen($q)-1, 1) != ';')
+ − 748
{
+ − 749
$schema[$s] .= ';';
+ − 750
}
+ − 751
if ( !$db->check_query($schema[$s]) )
+ − 752
{
+ − 753
// Uh-oh, the check failed, bail out
+ − 754
// The DBAL runs sanity checks on all queries for safety,
+ − 755
// so if the check fails in mid-upgrade we are in deep
+ − 756
// dodo doo-doo.
+ − 757
echo 'Query failed sanity check, this should never happen and is a bug.</p><p>Query was:</p><pre>'.$schema[$s].'</pre>';
+ − 758
break 2;
+ − 759
}
+ − 760
}
+ − 761
+ − 762
$schema = array_values($schema);
+ − 763
+ − 764
// Used extensively for debugging
+ − 765
// echo '<pre>'.htmlspecialchars(print_r($schema, true)).'</pre>';
+ − 766
// break;
+ − 767
+ − 768
echo 'done!<br />Executing upgrade schema...';
+ − 769
+ − 770
// OK, do the loop, baby!!!
+ − 771
foreach($schema as $q)
+ − 772
{
272
e0ec986c0af3
Searching sucks, and Enano's search algorithm was complete bullcrap. So I rewrote it. No, it does not use Google search technology. Like they have a patent for using the Arial font on search result pages anyway.
Dan
diff
changeset
+ − 773
if ( substr($q, 0, 1) == '@' )
0
+ − 774
{
272
e0ec986c0af3
Searching sucks, and Enano's search algorithm was complete bullcrap. So I rewrote it. No, it does not use Google search technology. Like they have a patent for using the Arial font on search result pages anyway.
Dan
diff
changeset
+ − 775
// if the first character is @, don't fail on error
e0ec986c0af3
Searching sucks, and Enano's search algorithm was complete bullcrap. So I rewrote it. No, it does not use Google search technology. Like they have a patent for using the Arial font on search result pages anyway.
Dan
diff
changeset
+ − 776
$db->sql_query(substr($q, 1));
e0ec986c0af3
Searching sucks, and Enano's search algorithm was complete bullcrap. So I rewrote it. No, it does not use Google search technology. Like they have a patent for using the Arial font on search result pages anyway.
Dan
diff
changeset
+ − 777
}
e0ec986c0af3
Searching sucks, and Enano's search algorithm was complete bullcrap. So I rewrote it. No, it does not use Google search technology. Like they have a patent for using the Arial font on search result pages anyway.
Dan
diff
changeset
+ − 778
else
e0ec986c0af3
Searching sucks, and Enano's search algorithm was complete bullcrap. So I rewrote it. No, it does not use Google search technology. Like they have a patent for using the Arial font on search result pages anyway.
Dan
diff
changeset
+ − 779
{
e0ec986c0af3
Searching sucks, and Enano's search algorithm was complete bullcrap. So I rewrote it. No, it does not use Google search technology. Like they have a patent for using the Arial font on search result pages anyway.
Dan
diff
changeset
+ − 780
if ( !$db->sql_query($q) )
e0ec986c0af3
Searching sucks, and Enano's search algorithm was complete bullcrap. So I rewrote it. No, it does not use Google search technology. Like they have a patent for using the Arial font on search result pages anyway.
Dan
diff
changeset
+ − 781
{
e0ec986c0af3
Searching sucks, and Enano's search algorithm was complete bullcrap. So I rewrote it. No, it does not use Google search technology. Like they have a patent for using the Arial font on search result pages anyway.
Dan
diff
changeset
+ − 782
echo $db->get_error();
e0ec986c0af3
Searching sucks, and Enano's search algorithm was complete bullcrap. So I rewrote it. No, it does not use Google search technology. Like they have a patent for using the Arial font on search result pages anyway.
Dan
diff
changeset
+ − 783
break 2;
e0ec986c0af3
Searching sucks, and Enano's search algorithm was complete bullcrap. So I rewrote it. No, it does not use Google search technology. Like they have a patent for using the Arial font on search result pages anyway.
Dan
diff
changeset
+ − 784
}
0
+ − 785
}
+ − 786
}
+ − 787
+ − 788
// Call any custom functions
+ − 789
foreach ( $installing_versions as $ver )
+ − 790
{
+ − 791
if ( isset($func_list[$ver]) )
+ − 792
{
+ − 793
foreach($func_list[$ver] as $function)
+ − 794
{
+ − 795
@call_user_func($function);
+ − 796
}
+ − 797
}
+ − 798
}
+ − 799
74
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
diff
changeset
+ − 800
// Log the upgrade
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
diff
changeset
+ − 801
$q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,author,page_text,edit_summary) VALUES(\'security\', \'upgrade_enano\', ' . time() . ', \'' . date('d M Y h:i a') . '\', \'' . mysql_real_escape_string($session->username) . '\', \'' . mysql_real_escape_string($this_version) . '\', \'' . mysql_real_escape_string($_SERVER['REMOTE_ADDR']) . '\');');
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
diff
changeset
+ − 802
0
+ − 803
echo 'done!</p>';
+ − 804
echo '<p>You will be redirected shortly. If you aren\'t redirected, <a href="index.php">click here</a>.</p>
+ − 805
<script type="text/javascript">setTimeout("window.location=\'index.php\'", 2000)</script>';
+ − 806
break;
+ − 807
}
+ − 808
$template->footer();
+ − 809
+ − 810
?>