forked from nconf/nconf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UPDATE.php_
828 lines (720 loc) · 30.2 KB
/
UPDATE.php_
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
<?php
###
### WELCOME TO NConf, configuration files are located here : config/..
###
#
# CONFIG
#
if ( !file_exists('config/nconf.php') ){
$nconfdir = dirname( $_SERVER["SCRIPT_FILENAME"] );
require_once('config.orig/authentication.php');
require_once('include/functions.php');
require_once('include/includeAllClasses.php');
require_once('config.orig/nconf.php');
require_once 'include/head.php';
// here it will fail if update is not possible (when nconf is not already installed)
}else{
require_once('main.php');
}
#
# Step handling
#
if ( !isset($_POST["step"]) ){
$step = 0;
}else{
$step = $_POST["step"];
if (isset($_POST["submit"]) AND $_POST["submit"] == "Back"){
# Back button pressed
$step = $step - 1;
}elseif(isset($_POST["submit"]) AND $_POST["submit"] == "Next"){
# increase step for next form
$step++;
}else{
#refreshing, no step modification
}
}
#
# DB creation / handling
#
if (isset($_POST["db_status"])){
$db_check = $_POST["db_status"];
}elseif (!empty($_GET["from"]) AND $_GET["from"] == "install" ){
# coming from install when user already has an nconf installation
$db_check = "connect";
$step = 1;
}else{
$db_check = FALSE;
}
unset($_POST["db_status"]);
if ( ($step == 2 AND $_POST["submit"] != "Back") AND !($db_check == "ok") ){
# run again the Database part
$step = 1;
}
# migrate handling
if (!empty($_POST["submit"]) AND $_POST["submit"] == "Convert" ){
# do noting, the migrate scripts will do something
$migrate = TRUE;
$db_check = "upgrade";
}
# define installation/configuration
$_SESSION["install"] = TRUE;
require_once 'include/head.php';
###
### Functions for install
###
#
# Function which generates the html output (table rows)
#
function check_session_value($name){
if ( isset($_SESSION["update_data"]) ){
if (is_array($_SESSION["update_data"]) ){
foreach ($_SESSION["update_data"] as $step){
if ( array_key_exists($name, $step) ){
return $step[$name];
}
}
}
}
# if not in session, load data from config, else use default values
if ( defined($name) ){
return constant($name);
}
return FALSE;
}
function table_row_text($title, $value, $description, $type = "text", $attention = 0, $disabled = 0, $check_input = 0){
$cache_value = check_session_value($title);
if ($cache_value) $value = $cache_value;
$row = '
<tr>
<td width=150>'.$title.'</td>
<td width=270>';
$row .= '<input type="'.$type.'" name="'.$title.'" maxlength=50 value="'.$value.'"';
if ($disabled == 1) $row .= ' disabled="disabled" ';
if ($check_input == 1) $row .= ' onchange="check_input()" onkeyup="check_input()"';
$row .= '>';
$row .= '</td><td width=20 class="attention">';
if ($attention == 1) $row .= "*";
$row .= '</td><td>';
if (!empty($description)) $row .= $description;
$row .= '</td></tr>';
return $row;
}
function table_row_select($title, $values, $selected, $description, $attention = 0, $check_input = 0){
$cache_value = check_session_value($title);
if ($cache_value) $selected = $cache_value;
$row = '
<tr>
<td width=150>'.$title.'</td>
<td width=270>';
$row .= '<select name="'.$title.'"';
if ($check_input == 1) $row .= ' onchange="check_input()"';
$row .= '>';
foreach ($values as $name => $value){
$row .= '<option value="'.$value.'"';
if ($value == $selected) $row .= ' selected';
$row .= '>'.$name.'</option>';
}
$row .= '</select>';
$row .= '</td><td width=20 class="attention">';
if ($attention == 1) $row .= "*";
$row .= '</td><td>';
if (!empty($description)) $row .= $description;
$row .= '</td></tr>';
return $row;
}
function table_row_description($title, $description, $display = ""){
$row = "";
if (!empty($title)){
$row = '
<tr id="'.$title.'_titel" name="'.$title.'" style="display:'.$display.'">
<td colspan=3><h2>'.$title.'</h2></td>
</tr>';
}
if (!empty($description)){
$row .= '<tr id="'.$title.'_desc" name="'.$title.'" style="display:'.$display.'">
<td colspan=3>'.$description.'<br><br></td>
</tr>
';
}
return $row;
}
function table_row_check($title, $status){
if ($status === TRUE){
$row = '
<tr>
<td><b>'.$title.'</b></td>
<td class="status_ok">OK</td>
<td></td>
</tr>';
}elseif ($status == "UNKNOWN"){
$row = '
<tr>
<td><b>'.$title.'</b></td>
<td class="status_unknown">UNKNOWN</td>
<td></td>
</tr>';
}elseif ($status === FALSE OR $status == 'ATTENTION'){
$status = ($status === FALSE) ? 'FAILED' : $status;
$row = '
<tr>
<td><b>'.$title.'</b></td>
<td class="status_failed">'.$status.'</td>
<td></td>
</tr>';
}else{
$row = '
<tr class="ui-widget-header header">
<td><b>'.$title.'</b></td>
<td class="status_failed">FAILED</td>
<td>
<a href="javascript:swap_visible(\''.$title.'\')">
<img src="img/icon_expand.gif" id="swap_icon_'.$title.'" >
show errorcode
</a>
</td>
</tr>
<tr id="'.$title.'" style="display:none" class="ui-widget-content">
<td colspan=3 class="ui-nconf-content">'.$status.'</td>
</tr>';
}
return $row;
}
function write_config($file, $replacers, $special = ''){
global $error;
global $info;
foreach($replacers as $replacer){
if ( check_session_value($replacer) === FALSE){
message($error, "Not all necessary config variables are present. ($replacer)");
return FALSE;
}
}
# read the config file
$lines = file($file);
if ($lines === FALSE){
message($error, "The config file ($file) could not be read.");
return FALSE;
}
# try to open config file writable, else readable
if (is_writable($file)) {
$fh = fopen($file, "w");
}else{
$fh = fopen($file, "r");
message($error, "read only");
}
if ($fh === FALSE){
message($error, "The config file ($file) could not be opened.");
return FALSE;
}else{
$new_config = '';
$log = '';
# go thru each line
foreach ($lines as $line){
$mark_line = 0;
# ignore comments
if ( !preg_match( '/^#/', $line) ){
# find the replacer (the constant)
foreach ($replacers as $replacer){
if ($special == "password_file"){
if ( preg_match( '/^admin/', $line) ){
$line = "admin::".check_session_value($replacer)."::admin::Administrator::\n";
$mark_line = 1;
}
}else{
if ( preg_match( '/^define\(["\']'.$replacer.'["\']/', $line) ){
$line = "define('$replacer', '".check_session_value($replacer)."');\n";
$mark_line = 1;
}
}
}
}
# mark the new lines
if ($mark_line){
$log .= "<b>".htmlspecialchars($line)."</b><br>";
}else{
$log .= htmlspecialchars($line)."<br>";
}
# add line to config var
$new_config .= $line;
}
#write to file
if ( fwrite($fh, $new_config) == FALSE){
# could not write to file, put out config code on page
message($info, "The config directory and all its content must be writable for your webserver user", "overwrite");
message($error, "Could not write config file ($file), please change the <b>bold lines</b> manually or remotely upload the file into the config directory");
return $log;
}else{
# write file success
return TRUE;
}
fclose($fh);
}
}
# For creating/importing the database
function parse_mysql_dump($url){
$result = FALSE;
$file_content = file($url);
$query = "";
foreach($file_content as $sql_line){
if(trim($sql_line) != "" && strpos($sql_line, "--") === false){
$query .= $sql_line;
// TODO: check compatibility of regex
// This regex does not work on xampp:
// if(preg_match("/;[\040]*\$/", $sql_line)){
// - why is there a backslash bevore $
// - [\040] seems not work on xampp (windows) installation
if(preg_match('/;[\s]*$/', $sql_line)){
$result = mysql_query($query);
if (!$result) return $result;
$query = "";
}
}
}
return $result;
}
function upgrade_mysql($file){
$update = parse_mysql_dump($file);
return $update;
}
function print_file($file){
$file_content = @file_get_contents($file);
if ($file_content !== FALSE){
echo '<pre class="editor_field">'.$file_content.'</pre>';
return TRUE;
}else{
return FALSE;
}
}
# upgrade file handling
function upgrade_files($installed_version, $dir, $file_regex, $action, $special = ''){
# read the directory
$dirs = getDirectoryTree($dir);
$success = TRUE;
# update each separate version
do {
# reset next version
if ( isset($next_update_version) ){
$installed_version = $next_update_version;
unset($next_update_version);
}
# read the destination version
foreach($dirs as $update_folder){
if( preg_match('/^(.*)_to_(.*)$/', $update_folder, $matches) ){
$from_version = $matches[1];
$to_version = $matches[2];
# has actual version a upgrade directory ?
if($installed_version == $from_version
OR ( $special == 'last_readme' AND $installed_version == $to_version )
){
if (empty($_SESSION["base_version"]) ){
NConf_DEBUG::set($installed_version, 'DEBUG', "Saving current installed base version for later reference");
$_SESSION["base_version"] = $installed_version;
}
# or if no update just display the last README file
if (empty($special)){
$next_update_version = $to_version;
}
$files = getFiles($dir.'/'.$update_folder);
NConf_DEBUG::set($files, 'DEBUG', "files");
# prepare pre & after update
if ($special == 'upgrade'){
# check if file exists
if ( in_array('pre_db_update_extension.php', $files) ){
$pre_DB_update_script = $dir.'/'.$update_folder.'/pre_db_update_extension.php';
}
if ( in_array('after_db_update_extension.php', $files) ){
$after_DB_update_script = $dir.'/'.$update_folder.'/after_db_update_extension.php';
}
}
# Migration before db update
if ( !empty($pre_DB_update_script) AND is_readable($pre_DB_update_script)) {
echo '</table>
<table width="400">';
echo table_row_check('Found script to run before update!', 'ATTENTION' );
require_once($pre_DB_update_script);
if (!$pre_status){
return "stopped";
}
}
# normal update process
foreach($files as $update_file){
if( preg_match($file_regex, $update_file) ){
if (($special == "load_extension") AND is_readable($dir.'/'.$update_folder.'/'.$update_file)){
include($dir.'/'.$update_folder.'/'.$update_file);
}elseif (is_callable($action)){
$update = $action($dir.'/'.$update_folder.'/'.$update_file);
echo table_row_check('Executing '.$update_file, $update );
if (!$update){
$success = FALSE;
}
}
}
}
# after update migrations
if (!empty($after_DB_update_script) AND is_readable($after_DB_update_script)) {
echo '</table>
<table width="400">';
echo table_row_check('Found migration possibility to run after update!', 'ATTENTION' );
require_once($after_DB_update_script);
break;
}
}
}
}
} while ( !empty($next_update_version) );
return $success;
}
# checks if update conflicts with user classes / attributes
$conflict_classes = array();
$conflict_attributes = array();
function db_conflict_check($file){
global $conflict_classes;
global $conflict_attributes;
$success = TRUE;
$ini_array = parse_ini_file($file, FALSE);
if ( !empty($ini_array) ){
# attributes
foreach ($ini_array AS $class => $entries){
if ( is_array($entries) ){
# many attributes on a class defined
foreach ($entries AS $attribute){
if ($attribute == 1){
# class
$query = 'SELECT id_class FROM ConfigClasses WHERE config_class="'.$class.'"';
if ( db_handler($query, "num_rows", "Check update conflict on class: '$class'") > 0){
array_push($conflict_classes, $class);
$success = FALSE;
}
}else{
# attribute
$query = 'SELECT id_attr
FROM ConfigAttrs
WHERE attr_name="'.$attribute.'"
AND fk_id_class=(SELECT id_class FROM ConfigClasses WHERE config_class="'.$class.'")';
if ( db_handler($query, "num_rows", "Check update conflict with attribute '$attribute.' on class '$class'") > 0){
array_push($conflict_attributes, "$class: $attribute");
$success = FALSE;
}
}
}
} // array
} // loop entries
} // ini file/array
return $success;
}
function db_conflict_feedback(){
global $conflict_classes;
global $conflict_attributes;
$feedback = '';
# class conflict
if ( !empty($conflict_classes) ){
$feedback .= NConf_HTML::text('classes:', FALSE, 'b');
$feedback .= '<ul>';
foreach ($conflict_classes AS $class){
$feedback .= '<li>'.$class.'</li>';
}
$feedback .= '</ul>';
}
# attribute conflict
if( !empty($conflict_attributes) ){
$feedback .= NConf_HTML::text('attributes:', FALSE, 'b');
$feedback .= '<ul>';
foreach ($conflict_attributes AS $attributes){
if ( is_array($attributes) ){
foreach ($attributes AS $attribute){
$feedback .= '<li>'.$attribute.'</li>';
}
}else{
$feedback .= '<li>'.$attributes.'</li>';
}
}
$feedback .= '</ul>';
return $feedback;
}else{
# no conflict
return FALSE;
}
}
#
# Session handling
#
foreach ($_POST as $key => $value){
#do not save the submit button
if ( $key == "submit" OR $key == "step" OR !isset($_POST["step"]) ) continue;
$_SESSION["update_data"][$_POST["step"]][$key] = $value;
}
echo '<form name="install" action="UPDATE.php" method="post">';
echo '<input type=hidden name="step" value="'.$step.'">';
# Begin table
echo '<table width="100%" border=0>';
#
# Install Steps
#
if ($step == 0){
# some checks
function find_SQL_Version() {
$output = shell_exec('mysql -V');
if ( !$output ){
# could not execute
return "UNKNOWN";
}
preg_match('/Distrib ([0-9]+[\.0-9]*)/i', $output, $version);
if ( !empty($version[1]) ){
return $version[1];
}else{
return FALSE;
}
}
function find_PERL_Version() {
$output = shell_exec('perl -v');
NConf_DEBUG::set($output, 'DEBUG', "Perl version check");
if ( !$output ){
# could not execute
return "UNKNOWN";
}
preg_match('/v([0-9]+[\.0-9]*)/i', $output, $version);
if ( !empty($version[1]) ){
return $version[1];
}else{
return FALSE;
}
}
# html content
echo table_row_description("Welcome to NConf update ".VERSION_NUMBER, 'This will update NConf to version "'.VERSION_NUMBER.'"<br>The pre-update check will test your system for NConf.');
echo '</table>';
###
# WARN if update is not stable version
if ( constant("VERSION_NOT_FINAL_WARNING") !== ''){
echo NConf_HTML::limit_space(
NConf_HTML::show_error('Attention', VERSION_NOT_FINAL_WARNING)
, 'style="width: 500px;"'
);
}
# shorter table for this step
echo '<table width="240">';
echo table_row_description("Requirements", '');
echo table_row_check('PHP 5.0 (or higher) -> '.phpversion(), version_compare(phpversion(), '5.0', '>=') );
# mysql version check
$mysql_status = find_SQL_Version();
if ($mysql_status == "UNKNOWN"){
echo table_row_check('MySQL 5.0.2 (or higher)', "UNKNOWN");
}else{
echo table_row_check('MySQL 5.0.2 (or higher) -> '.$mysql_status, version_compare($mysql_status, '5.0.2', '>=') );
}
# php-mysql support
$mysql_status = function_exists('mysql_connect');
if (!$mysql_status) message ($error, 'Could not find function "mysql_connect()"<br>You must configure PHP with mysql support.');
echo table_row_check('PHP-MySQL support', $mysql_status);
$perl_status = find_PERL_Version();
if ($perl_status == "UNKNOWN"){
echo table_row_check('Perl 5.6 (or higher)', "UNKNOWN");
}else{
echo table_row_check('Perl 5.6 (or higher) -> '.$perl_status, version_compare($perl_status, '5.6', '>=') );
}
}elseif ($step == 1){
echo table_row_description("MySQL database configuration", 'Please enter the DB information for NConf installation.');
echo table_row_text("DBHOST", "localhost", "DB server");
echo table_row_text("DBNAME", "database_name", "DB name");
echo table_row_text("DBUSER", "user_name", "DB user name");
echo table_row_text("DBPASS", "password", "DB user password", "password");
echo '<tr><td><br></td></tr>';
# shorter table for this step
echo '</table>';
# say that next step is the connect db part
echo '<input type=hidden name="db_status" value="connect">';
echo '<table width="200">';
if ($db_check !== FALSE ){
echo table_row_description('Checks', '');
if (function_exists('mysql_connect')){
$dbh = @mysql_connect(check_session_value("DBHOST"),check_session_value("DBUSER"),check_session_value("DBPASS"));
if (!$dbh){
# unfortunately mysql_error wont give information about last error here
message($error, 'Could not connect: ' . mysql_error());
# php >= 5.2.0 provides additional phperror which could give more information about the last mysql error
if ( function_exists('error_get_last') ){
$php_error = error_get_last();
message($error, $php_error["message"]);
}
}
}else{
$dbh = FALSE;
message($error, '<b>mysql_connect</b> not found, you must install PHP with mysql support!');
}
if (!$dbh){
echo table_row_check('Connect to DB', FALSE );
$msg_error = NConf_DEBUG::show_debug('ERROR');
echo table_row_description('', "<br>$msg_error");
}else{
echo table_row_check('connect to mysql', TRUE );
$db_selected = @mysql_select_db(check_session_value("DBNAME"));
if ($db_selected ){
# DB selected, try to create tables
echo table_row_check('access database', TRUE );
$installed_version = FALSE;
# newest version is :
$newest_version = VERSION_NUMBER;
###
# check installed version
###
# get version directories
$dirs = getDirectoryTree('UPDATE');
$update_conflict = FALSE;
$conflict_feedback = '';
if ( empty($dirs) ){
echo table_row_check('check versions in UPDATE directory', FALSE );
}else{
foreach($dirs as $update_folder){
include('UPDATE/'.$update_folder.'/version_check.php');
}
}
# check conflicts before updating
$conflict_check = upgrade_files($installed_version, 'UPDATE', '/\.ini$/', 'db_conflict_check');
if ($installed_version){
echo table_row_check('DB version detected: '.$installed_version, TRUE );
if ( version_compare($installed_version, $newest_version, '>=') ){
# check if some updates were done, or if just no update is necessary
if ( empty($_SESSION["base_version"]) ){
$message = "<br>No update necessary";
}else{
$message = "<br>Update finished";
}
echo table_row_description($message, '<input type=hidden name="db_status" value="ok"><input type=hidden name="old_version" value="'.$installed_version.'">');
}elseif($db_check == "upgrade" OR $db_check == "upgrade_pass_migrate"){
echo table_row_check('update conflict check', $conflict_check );
echo '</table>
<input type=hidden name="old_version" value="'.$installed_version.'">
<table width="300">';
echo table_row_description('<br>Update in progress...', '');
}else{
if (!empty($migrate) ){
# ignore update, migration script should do some stuff
}elseif ($conflict_check == TRUE){
# ok
echo table_row_check('update conflict check', TRUE );
echo table_row_description('<br>Please proceed to update', '<input type=hidden name="db_status" value="upgrade">');
}else{
# version check correct, but update conflict detected
$feedback = db_conflict_feedback();
echo table_row_check('update conflict check', FALSE );
# close check table
echo '</table>';
echo '<table width="100%">';
# there will be a db conflict when proceeding
echo table_row_description('<br>Conflict detected', 'Setup has detected a possible conflict within the data schema of the NConf application.<br>The following classes / attributes already seem to exist in the database:');
echo NConf_HTML::table_row_text( $feedback );
echo table_row_description('', 'Adding your own classes / attributes to the schema can lead to unexpected behavour of NConf!
<br>Are you sure you wish to proceed with the update? Some of your data could be lost!');
echo NConf_HTML::table_row_text('<input type="hidden" name="db_status" value="upgrade">');
}
}
?>
<script type="text/javascript">
<!--
disable('DBHOST');
disable('DBNAME');
disable('DBUSER');
disable('DBPASS');
//-->
</script>
<?php
# upgrade process
if ($db_check == "upgrade" OR $db_check == "upgrade_pass_migrate"){
# update DB with sql files
$success = upgrade_files($installed_version, 'UPDATE', '/\.sql$/', 'upgrade_mysql', $db_check);
NConf_DEBUG::set($success, 'DEBUG', "upgrade_files feedback");
if ($success === "stopped"){
# if status = stopped, the next button should proceed without migrating data
echo table_row_description('', '<input type=hidden name="db_status" value="upgrade_pass_migrate">');
}else{
# DB version is up to date, go to next step
if ( VERSION_NUMBER == $installed_version ){
echo table_row_description('', '<input type=hidden name="db_status" value="ok">');
}else{
echo table_row_description('', '<input type=hidden name="db_status" value="upgrade">');
}
}
} // end of upgrade
# Check for perl scripts to give user a choice to run.
# These could be scripts for helping migrate data
# The logic of these extensions is handled by them self
# This feature is not yet complete, because we do not need it until now...
//upgrade_files($installed_version, 'UPDATE', '/extension\.php$/', '', 'load_extension');
}else{
echo table_row_check('lookup NConf DB version', FALSE );
echo '</table><table width="500">';
echo table_row_description("<br><br>NConf version could not be determined.", 'Please enter the correct data to connect to the existing NConf DB.<br>For first-time installation of NConf use the <b><a href="INSTALL.php">INSTALL</a></b> function.');
}
}else{
# failed to select db
echo table_row_check('access database', FALSE );
echo '</table><table width="450">';
echo table_row_description("Wrong information", 'Please enter the correct data to connect to the existing NConf DB.
<br>For first-time installation of NConf use the <b><a href="INSTALL.php">INSTALL</a></b> function.');
}
}
}
}elseif ($step == 2){
if ( empty($_SESSION["base_version"]) ){
echo table_row_description("No database update found / no update required", "Please carefully examine the following release notes for additional update instructions.");
echo '</table>';
# display the last README
$update = upgrade_files(VERSION_NUMBER, 'UPDATE', '/^README$/', 'print_file', 'last_readme');
}else{
echo table_row_description("Please carefully examine the following release notes for additional update instructions.", '');
echo '</table>';
$update = upgrade_files($_SESSION["base_version"], 'UPDATE', '/^README$/', 'print_file');
}
}elseif ($step == 3){
echo table_row_description("Update complete", 'Please delete the following files and directories to continue:<br>
<br>- INSTALL
<br>- INSTALL.php
<br>- UPDATE
<br>- UPDATE.php');
session_unset();
}
# End table
echo '</table>';
$save_error = FALSE;
echo '<table>
<tr><td>
<div id="buttons">';
if ( $step != 1 ){ echo '<br>'; }
if ( $step == 1
AND (
isset($conflict_check) AND ($conflict_check == FALSE)
AND ($db_check != "upgrade" )
)
){ echo '<a href="index.php"><input type="button" value="Cancel"></a> '; }
if ( $step == 4 AND $save_error === TRUE ){
echo '<input type="Submit" value="Retry" name="submit" align="middle"> ';
}elseif($step == 3 AND $save_error === FALSE ){
# saved, go to index page
echo '<input type="button" value="Finish" name="submit" align="middle" onclick="location.href=\'index.php\'"> ';
}
if ($step != 3){
echo '<input type="Submit" value="Next" name="submit" align="middle"> ';
}
/*
if ($step != 0 AND !($step == 4 AND $save_error === FALSE)){
echo '<input type="Submit" value="Back" name="submit" align="middle"> ';
}*/
echo'
<!--<input type="Reset" value="Reset">-->
</div>
</td></tr>
</table>
';
echo '</form>';
#
# Load footer
#
require_once 'include/foot.php';
/* DEBUG HELP
echo '<div align="left"><pre>';
var_dump($_SESSION["install_data"]);
echo '</pre></div>';
*/
###
### Finish
### anything is loaded until here
###
?>