-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.php
1981 lines (1487 loc) · 85 KB
/
install.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
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/***
*
* Symphony web publishing system
*
* Copyright 2004–2006 Twenty One Degrees Pty. Ltd.
*
* @version 1.7
* @licence https://github.com/symphonycms/symphony-1.7/blob/master/LICENCE
*
***/
##Show PHP Info
if(isset($_REQUEST['info'])){
phpinfo();
exit();
}
@error_reporting(E_ALL ^ E_NOTICE);
@ini_set("allow_call_time_pass_reference", 1);
define('kVERSION', '1.7.01');
define('kBUILD', '1701');
define('kSUPPORT_SERVER', 'http://status.symphony21.com');
define('kINSTALL_ASSET_LOCATION', kSUPPORT_SERVER . '/install/assets/4.0');
## Need these for using particular Symphony files.
define('__SYMPHONY_MINIMAL_BOOT__', true);
## Include the existing Symphony configuration. If it exists
## this will be an update, instead of installation.
if(is_file('manifest/config.php')){
require_once('manifest/config.php');
require_once('symphony/lib/core/class.configuration.php');
if(isset($settings) && is_array($settings)){
$SymphonyConfiguration =& new Configuration(true);
$SymphonyConfiguration->setArray($settings);
$build = $SymphonyConfiguration->get('build', 'symphony');
define('kCURRENT_BUILD', $build);
define('kCURRENT_VERSION', $build{0} . '.' . $build{1} . ($build{2} != 0 || $build{3} != 0 ? '.' . $build{2} . $build{3} : ''));
if($build < kBUILD) define('__IS_UPDATE__', true);
else define('__ALREADY_UP_TO_DATE__', true);
}
}
## 1.6.02 or lower
elseif(is_file('conf/config.php')){
require_once('conf/config.php');
require_once('symphony/lib/core/class.configuration.php');
if(isset($settings) && is_array($settings)){
$SymphonyConfiguration =& new Configuration(true);
$SymphonyConfiguration->setArray($settings);
$build = $SymphonyConfiguration->get('build', 'symphony');
define('kCURRENT_BUILD', $build);
define('kCURRENT_VERSION', $build{0} . '.' . $build{1} . ($build{2} != 0 || $build{3} != 0 ? '.' . $build{2} . $build{3} : ''));
if($build < kBUILD) define('__IS_UPDATE__', true);
}
}
## If its not an update, we need to set a couple of important constants.
if(!defined('__IS_UPDATE__')){
define('__IN_SYMPHONY__', true);
define('CRLF', "\r\n");
}
## Include some parts of the Symphony engine
require_once('symphony/lib/boot/class.object.php');
require_once('symphony/lib/core/class.mysql.php');
require_once('symphony/lib/core/class.xmlelement.php');
require_once('symphony/lib/core/class.general.php');
require_once('symphony/lib/core/class.log.php');
header('Expires: Mon, 12 Dec 1982 06:14:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-cache, must-revalidate, max-age=0');
header('Pragma: no-cache');
$clean_path = $_SERVER["HTTP_HOST"] . dirname($_SERVER["PHP_SELF"]);
$clean_path = rtrim($clean_path, '/\\');
$clean_path = preg_replace('/\/{2,}/i', '/', $clean_path);
define('_INSTALL_DOMAIN_', $clean_path);
define('_INSTALL_URL_', 'http://' . $clean_path);
define('CRLF', "\r\n");
define('SYM_LOG_NOTICE', 0);
define('SYM_LOG_WARNING', 1);
define('SYM_LOG_ERROR', 2);
define('SYM_LOG_ALL', 3);
define('BAD_BROWSER', 0);
define('MISSING_MYSQL', 3);
define('MISSING_ZLIB', 5);
define('MISSING_XSL', 6);
define('MISSING_XML', 7);
define('MISSING_PHP', 8);
define('MISSING_MOD_REWRITE', 9);
$header = '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title><!-- TITLE --></title>
<link rel="stylesheet" type="text/css" href="'.kINSTALL_ASSET_LOCATION.'/main.css"/>
<script type="text/javascript" src="'.kINSTALL_ASSET_LOCATION.'/main.js"></script>
</head>' . CRLF;
define('kHEADER', $header);
$footer = '
</html>';
define('kFOOTER', $footer);
function installResult(&$Page, &$install_log, $start){
if(!defined("_INSTALL_ERRORS_")){
$install_log->writeToLog("============================================", true);
$install_log->writeToLog("INSTALLATION COMPLETED: Execution Time - ".max(1, time() - $start)." sec (" . date("d.m.y H:i:s") . ")", true);
$install_log->writeToLog("============================================" . CRLF . CRLF . CRLF, true);
}else{
$install_log->pushToLog(_INSTALL_ERRORS_, SYM_LOG_ERROR, true);
$install_log->writeToLog("============================================", true);
$install_log->writeToLog("INSTALLATION ABORTED: Execution Time - ".max(1, time() - $start)." sec (" . date("d.m.y H:i:s") . ")", true);
$install_log->writeToLog("============================================" . CRLF . CRLF . CRLF, true);
$Page->setPage('failure');
}
}
function writeConfig($dest, $conf, $mode){
$string = "<?php\n";
foreach($conf['define'] as $key => $val) {
$string .= "define('". $key ."', '". addslashes($val) ."');\n";
}
$string .= '$settings = array();' . "\n\n";
foreach($conf['settings'] as $set => $array) {
foreach($array as $key => $val) {
$string .= '$'."settings['".$set."']['".$key."'] = '".addslashes($val)."';\n";
}
}
foreach($conf['require'] as $val) {
$string .= "require_once('". addslashes($val) . "');\n";
}
$string .= "?>\n";
return GeneralExtended::writeFile($dest . "/config.php", $string, $mode);
}
function fireSql(&$db, $data, &$error, $compatibility='NORMAL'){
$compatibility = strtoupper($compatibility);
if($compatibility == 'HIGH'){
$data = str_replace('ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci', '', $data);
$data = str_replace('collate utf8_unicode_ci', '', $data);
}
## Silently attempt to change the storage engine. This prevents INNOdb errors.
$db->query('SET storage_engine=MYISAM', $e);
$queries = preg_split('/;[\\r\\n]+/', $data, -1, PREG_SPLIT_NO_EMPTY);
if(is_array($queries) && !empty($queries)){
foreach($queries as $sql) {
if(trim($sql) != "") $result = $db->query($sql, $error);
if(!$result) return false;
}
}
return true;
}
function getTableSchema(){
return "
CREATE TABLE `tbl_authors` (
`id` int(11) unsigned NOT NULL auto_increment,
`username` varchar(20) collate utf8_unicode_ci NOT NULL default '',
`password` varchar(32) collate utf8_unicode_ci NOT NULL default '',
`firstname` varchar(100) collate utf8_unicode_ci default NULL,
`lastname` varchar(100) collate utf8_unicode_ci default NULL,
`email` varchar(255) collate utf8_unicode_ci default NULL,
`last_refresh` datetime default '0000-00-00 00:00:00',
`last_session` datetime default '0000-00-00 00:00:00',
`superuser` enum('0','1') collate utf8_unicode_ci NOT NULL default '0',
`textformat` varchar(50) collate utf8_unicode_ci default NULL,
`owner` enum('0','1') collate utf8_unicode_ci NOT NULL default '0',
`allow_sections` text collate utf8_unicode_ci,
`auth_token_active` enum('yes','no') collate utf8_unicode_ci NOT NULL default 'no',
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `tbl_cache` (
`id` int(11) unsigned NOT NULL auto_increment,
`hash` varchar(32) collate utf8_unicode_ci NOT NULL default '',
`section` varchar(255) collate utf8_unicode_ci NOT NULL default '',
`creation` int(14) NOT NULL default '0',
`data` longtext collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
KEY `section` (`section`),
KEY `creation` (`creation`),
KEY `hash` (`hash`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `tbl_campfire` (
`id` varchar(32) collate utf8_unicode_ci NOT NULL default '',
`owner` varchar(255) collate utf8_unicode_ci NOT NULL default '',
`name` varchar(255) collate utf8_unicode_ci NOT NULL default '',
`status` enum('enabled','disabled') collate utf8_unicode_ci NOT NULL default 'enabled',
`version` double unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `owner` (`owner`),
KEY `handle` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `tbl_campfire2delegates` (
`id` int(11) unsigned NOT NULL auto_increment,
`campfire_id` varchar(32) collate utf8_unicode_ci NOT NULL default '',
`page` varchar(255) collate utf8_unicode_ci NOT NULL default '',
`delegate` varchar(255) collate utf8_unicode_ci NOT NULL default '',
`callback` varchar(255) collate utf8_unicode_ci NOT NULL default '',
PRIMARY KEY (`id`),
KEY `campfire_id` (`campfire_id`),
KEY `page` (`page`),
KEY `delegate` (`delegate`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `tbl_comments` (
`id` int(11) unsigned NOT NULL auto_increment,
`entry_id` int(11) NOT NULL default '0',
`author_id` int(11) unsigned default NULL,
`author_name` varchar(128) collate utf8_unicode_ci NOT NULL default '',
`author_email` varchar(255) collate utf8_unicode_ci default NULL,
`author_url` varchar(255) collate utf8_unicode_ci default NULL,
`body` text collate utf8_unicode_ci NOT NULL,
`spam` enum('yes','no') collate utf8_unicode_ci NOT NULL default 'no',
PRIMARY KEY (`id`),
KEY `entry_id` (`entry_id`),
KEY `author_id` (`author_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `tbl_customfields` (
`id` int(11) unsigned NOT NULL auto_increment,
`name` varchar(255) collate utf8_unicode_ci NOT NULL default '',
`handle` varchar(50) collate utf8_unicode_ci NOT NULL default '',
`description` varchar(255) collate utf8_unicode_ci default NULL,
`type` enum('checkbox','textarea','input','select','list','multiselect','upload','foreign') collate utf8_unicode_ci NOT NULL default 'input',
`parent_section` int(11) NOT NULL default '0',
`format` enum('0','1') collate utf8_unicode_ci NOT NULL default '1',
`required` enum('yes','no') collate utf8_unicode_ci NOT NULL default 'yes',
`validator` varchar(50) collate utf8_unicode_ci default NULL,
`validation_rule` varchar(255) collate utf8_unicode_ci default NULL,
`default_state` enum('checked','unchecked','na') collate utf8_unicode_ci NOT NULL default 'na',
`destination_folder` varchar(255) collate utf8_unicode_ci default NULL,
`size` int(5) default '25',
`sortorder` int(11) NOT NULL default '1',
`location` enum('main','sidebar','drawer') collate utf8_unicode_ci NOT NULL default 'main',
`foreign_section` int(11) default NULL,
`foreign_select_multiple` enum('yes','no') collate utf8_unicode_ci NOT NULL default 'no',
PRIMARY KEY (`id`),
KEY `foreign_section` (`foreign_section`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `tbl_customfields_selectoptions` (
`field_id` int(11) NOT NULL default '0',
`values` text collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`field_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `tbl_entries` (
`id` int(11) unsigned NOT NULL auto_increment,
`author_id` int(11) NOT NULL default '0',
`publish_date` datetime NOT NULL default '0000-00-00 00:00:00',
`publish_date_gmt` datetime NOT NULL default '0000-00-00 00:00:00',
`type` int(11) default NULL,
`formatter` varchar(255) collate utf8_unicode_ci default NULL,
`valid_xml` enum('yes','no') collate utf8_unicode_ci NOT NULL default 'yes',
PRIMARY KEY (`id`),
KEY `author_id` (`author_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `tbl_entries2customfields` (
`id` int(11) unsigned NOT NULL auto_increment,
`entry_id` int(11) NOT NULL default '0',
`field_id` int(11) NOT NULL default '0',
`handle` varchar(255) collate utf8_unicode_ci default '',
`value` text collate utf8_unicode_ci,
`value_raw` text collate utf8_unicode_ci,
PRIMARY KEY (`id`),
KEY `field_id` (`field_id`),
KEY `handle` (`handle`),
KEY `entry_id` (`entry_id`),
FULLTEXT KEY `value` (`value`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `tbl_entries2customfields_list` (
`id` int(11) unsigned NOT NULL auto_increment,
`entry_id` int(11) unsigned NOT NULL default '0',
`field_id` int(11) unsigned NOT NULL default '0',
`value` varchar(255) collate utf8_unicode_ci NOT NULL default '',
`value_raw` varchar(255) collate utf8_unicode_ci NOT NULL default '',
`handle` varchar(255) collate utf8_unicode_ci NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `tbl_entries2customfields_upload` (
`id` int(11) unsigned NOT NULL auto_increment,
`entry_id` int(11) unsigned NOT NULL default '0',
`field_id` int(11) unsigned NOT NULL default '0',
`file` varchar(255) collate utf8_unicode_ci NOT NULL default '',
`type` varchar(255) collate utf8_unicode_ci NOT NULL default '',
`size` int(11) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `entry_id` (`entry_id`,`field_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `tbl_entries2sections` (
`entry_id` int(11) NOT NULL default '0',
`section_id` int(11) NOT NULL default '1',
PRIMARY KEY (`entry_id`),
KEY `section_id` (`section_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `tbl_forgotpass` (
`author_id` int(11) NOT NULL default '0',
`token` varchar(32) collate utf8_unicode_ci NOT NULL default '',
PRIMARY KEY (`author_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `tbl_masters` (
`id` int(11) unsigned NOT NULL auto_increment,
`name` varchar(255) collate utf8_unicode_ci NOT NULL default '',
`events` text collate utf8_unicode_ci,
`data_sources` text collate utf8_unicode_ci,
PRIMARY KEY (`id`),
UNIQUE KEY `filename` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `tbl_metadata` (
`id` int(11) unsigned NOT NULL auto_increment,
`relation_id` int(11) NOT NULL default '0',
`class` varchar(50) collate utf8_unicode_ci NOT NULL default '',
`creation_date` datetime NOT NULL default '0000-00-00 00:00:00',
`creation_date_gmt` datetime NOT NULL default '0000-00-00 00:00:00',
`modified_date` datetime default NULL,
`modified_date_gmt` datetime default NULL,
`creator_ip` varchar(16) collate utf8_unicode_ci NOT NULL default '',
`modifier_ip` varchar(16) collate utf8_unicode_ci default NULL,
`modifier_id` int(11) default NULL,
`referrer` varchar(255) collate utf8_unicode_ci default NULL,
PRIMARY KEY (`id`),
KEY `relation_id` (`relation_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `tbl_pages` (
`id` int(11) unsigned NOT NULL auto_increment,
`parent` int(11) default NULL,
`title` varchar(255) collate utf8_unicode_ci NOT NULL default '',
`handle` varchar(255) collate utf8_unicode_ci default NULL,
`master` varchar(50) collate utf8_unicode_ci default NULL,
`url_schema` varchar(255) collate utf8_unicode_ci default '',
`data_sources` text collate utf8_unicode_ci,
`events` text collate utf8_unicode_ci,
`show_in_nav` enum('yes','no') collate utf8_unicode_ci NOT NULL default 'yes',
`sortorder` int(11) NOT NULL default '0',
`cache_refresh_rate` int(5) unsigned NOT NULL default '60',
`full_caching` enum('yes','no') collate utf8_unicode_ci NOT NULL default 'no',
`type` varchar(255) collate utf8_unicode_ci NOT NULL default 'other',
PRIMARY KEY (`id`),
UNIQUE KEY `handle` (`handle`),
KEY `parent` (`parent`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `tbl_sections` (
`id` int(11) unsigned NOT NULL auto_increment,
`handle` varchar(255) collate utf8_unicode_ci NOT NULL default '',
`name` varchar(255) collate utf8_unicode_ci NOT NULL default '',
`commenting` enum('on','off') collate utf8_unicode_ci NOT NULL default 'on',
`primary_field` int(11) NOT NULL default '0',
`calendar_show` enum('show','hide') collate utf8_unicode_ci NOT NULL default 'show',
`author_column` enum('show','hide') collate utf8_unicode_ci NOT NULL default 'show',
`date_column` enum('show','hide') collate utf8_unicode_ci NOT NULL default 'show',
`sortorder` int(11) NOT NULL default '0',
`entry_order` varchar(7) collate utf8_unicode_ci NOT NULL default 'date',
PRIMARY KEY (`id`),
UNIQUE KEY `handle` (`handle`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `tbl_sections_visible_columns` (
`field_id` int(11) NOT NULL default '0',
`section_id` int(11) NOT NULL default '0',
UNIQUE KEY `field_id` (`field_id`),
KEY `section_id` (`section_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `tbl_utilities` (
`id` int(11) unsigned NOT NULL auto_increment,
`name` varchar(255) collate utf8_unicode_ci NOT NULL default '',
`handle` varchar(255) collate utf8_unicode_ci NOT NULL default '',
`description` longtext collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
UNIQUE KEY `handle` (`handle`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `tbl_utilities2datasources` (
`id` int(11) unsigned NOT NULL auto_increment,
`utility_id` int(11) unsigned NOT NULL default '0',
`data_source` varchar(255) collate utf8_unicode_ci default NULL,
PRIMARY KEY (`id`),
KEY `utility_id` (`utility_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `tbl_utilities2events` (
`id` int(11) unsigned NOT NULL auto_increment,
`utility_id` int(11) unsigned NOT NULL default '0',
`event` varchar(255) collate utf8_unicode_ci default NULL,
PRIMARY KEY (`id`),
KEY `utility_id` (`utility_id`,`event`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
";
}
function getDefaultTableData(){
return "
INSERT INTO `tbl_entries` VALUES (1, 1, '2006-09-19 22:17:00', '2006-09-19 12:17:00', NULL, 'simplehtml', 'yes');
INSERT INTO `tbl_entries` VALUES (3, 1, '2007-03-22 09:00:00', '2007-03-21 23:00:00', NULL, 'simplehtml', 'yes');
INSERT INTO `tbl_entries` VALUES (4, 1, '2006-09-19 14:26:00', '2006-09-19 04:26:00', NULL, 'simplehtml', 'yes');
INSERT INTO `tbl_entries` VALUES (5, 1, '2006-09-21 14:31:00', '2006-09-21 04:31:00', NULL, 'simplehtml', 'yes');
INSERT INTO `tbl_entries2customfields` VALUES (1, 1, 57, 'check-out-the-symphony-showcase-for-ideas-and-insp', '<p>Check out the Symphony <a href=\"http://overture21.com/wiki/community/showcase\">showcase</a> for ideas and inspiration, or add your own site.</p>', 'Check out the Symphony <a href="http://overture21.com/wiki/community/showcase">showcase</a> for ideas and inspiration, or add your own site.');
INSERT INTO `tbl_entries2customfields` VALUES (7, 3, 4, 'welcome-to-symphony', '<p>Welcome to Symphony!</p>', 'Welcome to Symphony!');
INSERT INTO `tbl_entries2customfields` VALUES (8, 3, 1, 'if-youre-reading-this-then-symphony-has-been-succ', '<p>If you''re reading this, then Symphony has been successfully installed on your server and is running smoothly. I''m sure you''d like to take some time to explore the system and see what Symphony has to offer, but if you don''t want to dive in too quickly, allow me a moment to introduce you to Symphony.</p>', 'If you''re reading this, then Symphony has been successfully installed on your server and is running smoothly. I''m sure you''d like to take some time to explore the system and see what Symphony has to offer, but if you don''t want to dive in too quickly, allow me a moment to introduce you to Symphony.');
INSERT INTO `tbl_entries2customfields` VALUES (9, 3, 2, 'right-now-youre-viewing-the-default-theme-which', '<p>Right now, you''re viewing the default theme, which was designed and built by <a href=\"http://www.chaoticpattern.com/\">Allen</a>. If you''re new to XSLT, we highly recommend that you take a look under the hood and see how the theme works. Try making some changes and adding your own personal touch as an exercise before tackling projects on your own.</p>\n<p>You can <a href=\"/symphony/\">login to the Symphony admin</a> with the username and password you set up during installation. All your login and author details can be changed as you wish. You can add new authors and administrators to your website, and choose which sections they can publish to.</p>\n<p><a href=\"http://overture21.com/\">Overture</a> is Symphony''s resource website, with articles, tutorials and a flourishing community of Symphony developers. For the nitty-gritty on the finer points of using Symphony, the <a href=\"http://overture21.com/wiki/\">wiki</a> houses a growing collection of resources and documentation. If you have any questions or find any bugs in Symphony, please head over to the <a href=\"http://overture21.com/forum/\">Overture forum</a> since we''re often around to help out.</p>\n<p>From all the Symphony team, we hope you have fun using Symphony!</p>', 'Right now, you''re viewing the default theme, which was designed and built by <a href="http://www.chaoticpattern.com/">Allen</a>. If you''re new to XSLT, we highly recommend that you take a look under the hood and see how the theme works. Try making some changes and adding your own personal touch as an exercise before tackling projects on your own.\r\n\r\nYou can <a href="/symphony/">login to the Symphony admin</a> with the username and password you set up during installation. All your login and author details can be changed as you wish. You can add new authors and administrators to your website, and choose which sections they can publish to.\r\n\r\n<a href="http://overture21.com/">Overture</a> is Symphony''s resource website, with articles, tutorials and a flourishing community of Symphony developers. For the nitty-gritty on the finer points of using Symphony, the <a href="http://overture21.com/wiki/">wiki</a> houses a growing collection of resources and documentation. If you have any questions or find any bugs in Symphony, please head over to the <a href="http://overture21.com/forum/">Overture forum</a> since we''re often around to help out.\r\n\r\nFrom all the Symphony team, we hope you have fun using Symphony!');
INSERT INTO `tbl_entries2customfields` VALUES (10, 3, 63, NULL, NULL, NULL);
INSERT INTO `tbl_entries2customfields` VALUES (11, 3, 11, 'yes', '<p>yes</p>', 'yes');
INSERT INTO `tbl_entries2customfields` VALUES (13, 4, 57, 'you-can-use-your-symphony-account-username-and-pas', '<p>You can use your Symphony account username and password to sign in to Overture''s <a href=\"http://overture21.com/forum/\">forum</a> and <a href=\"http://overture21.com/wiki/\">wiki</a>.</p>', 'You can use your Symphony account username and password to sign in to Overture''s <a href="http://overture21.com/forum/">forum</a> and <a href="http://overture21.com/wiki/">wiki</a>.');
INSERT INTO `tbl_entries2customfields` VALUES (14, 5, 57, 'while-your-website-is-in-maintenance-mode-you-can', '<p>While your website is in maintenance mode, you can append ?debug to the end of a page''s URL to view its XML and XSLT.</p>', 'While your website is in maintenance mode, you can append ?debug to the end of a page''s URL to view its XML and XSLT.');
INSERT INTO `tbl_entries2customfields` VALUES (15, 3, 65, NULL, NULL, NULL);
INSERT INTO `tbl_entries2customfields_list` VALUES (34, 3, 65, '<p>Life</p>', 'Life', 'life');
INSERT INTO `tbl_entries2customfields_list` VALUES (35, 3, 65, '<p>Applications</p>', 'Applications', 'applications');
INSERT INTO `tbl_entries2sections` VALUES (1, 2);
INSERT INTO `tbl_entries2sections` VALUES (3, 1);
INSERT INTO `tbl_entries2sections` VALUES (4, 2);
INSERT INTO `tbl_entries2sections` VALUES (5, 2);
INSERT INTO `tbl_metadata` VALUES (37, 1, 'entry', '2006-09-20 22:17:59', '2006-09-20 12:17:59', '2006-10-16 16:55:56', '2006-10-16 06:55:56', '127.0.0.1', '127.0.0.1', 1, 'http://www.yoursite.com');
INSERT INTO `tbl_metadata` VALUES (41, 3, 'entry', '2006-09-20 22:46:05', '2006-09-20 12:46:05', '2007-03-22 17:44:42', '2007-03-22 07:44:42', '127.0.0.1', '127.0.0.1', 1, 'http://www.yoursite.com');
INSERT INTO `tbl_metadata` VALUES (43, 4, 'entry', '2006-09-21 14:26:11', '2006-09-21 04:26:11', '2006-09-21 14:26:51', '2006-09-21 04:26:51', '127.0.0.1', '127.0.0.1', 1, 'http://www.yoursite.com');
INSERT INTO `tbl_metadata` VALUES (44, 5, 'entry', '2006-09-21 14:31:25', '2006-09-21 04:31:25', '2006-09-21 15:59:07', '2006-09-21 05:59:07', '127.0.0.1', '127.0.0.1', 1, 'http://www.yoursite.com');
";
}
function fetchSymphonyConfig(){
global $SymphonyConfiguration;
return $SymphonyConfiguration;
}
function fetchLastDBError(&$db){
$errors = $db->debug();
if(empty($errors) or !is_array($errors))
return NULL;
$e = end($errors);
return $e['num'] . ': ' . $e['msg'] . ' in query ' . $e['query'];
}
Class GeneralExtended extends General{
function realiseDirectory($path, $mode){
if(!empty($path)){
if(@file_exists($path) && !@is_dir($path)){
return false;
}elseif(!@is_dir($path)){
@mkdir($path);
$oldmask = @umask(0);
@chmod($path, @intval($mode, 8));
@umask($oldmask);
}
}
return true;
}
function redirect ($url){
$url = str_replace("Location:", "", $url); //Just make sure.
if(headers_sent($filename, $line)){
print "<h1>Error: Cannot redirect to <a href=\"$url\">$url</a></h1><p>Output has already started in $filename on line $line</p>";
exit();
}
header('Expires: Mon, 12 Dec 1982 06:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-cache, must-revalidate, max-age=0');
header('Pragma: no-cache');
header("Location: $url");
exit();
}
function repeatStr($str, $xx){
if($xx < 0) $xx = 0;
$xx = ceil($xx);
$result = NULL;
for($ii = 0; $ii < $xx; $ii++)
$result .= $str;
return $result;
}
function checkRequirement($item, $type, $expected){
switch($type){
case "func":
$test = function_exists($item);
if($test != $expected) return false;
break;
case "setting":
$test = ini_get($item);
if(strtolower($test) != strtolower($expected)) return false;
break;
case "ext":
foreach(explode(":", $item) as $ext){
$test = extension_loaded($ext);
if($test == $expected) return true;
}
return false;
break;
case "version":
if(version_compare($item, $expected, ">=") != 1) return false;
break;
case "permission":
if(!is_writable($item)) return false;
break;
case "remote":
$result = curler($item);
if(strpos(strtolower($result), "error") !== false) return false;
break;
}
return true;
}
}
Class SymphonyLog extends Log{
function SymphonyLog($path){
$this->setLogPath($path);
if(@file_exists($this->getLogPath())){
$this->open();
}else{
$this->open("OVERRIDE");
$this->writeToLog("Symphony Installer Log", true);
$this->writeToLog("Opened: ". date("d.m.Y G:i:s"), true);
$this->writeToLog("Version: ". kVERSION, true);
$this->writeToLog("Domain: "._INSTALL_URL_, true);
$this->writeToLog("--------------------------------------------", true);
}
}
}
Class Action{
function requirements(&$Page){
$missing = array();
if(!GeneralExtended::checkRequirement(phpversion(), "version", "4.3")){
$Page->log->pushToLog("Requirement - PHP Version is not correct. ".phpversion()." detected." , SYM_LOG_ERROR, true);
$missing[] = MISSING_PHP;
}
if(!GeneralExtended::checkRequirement('mysql_connect', "func", true)){
$Page->log->pushToLog("Requirement - MySQL extension not present" , SYM_LOG_ERROR, true);
$missing[] = MISSING_MYSQL;
}
elseif(!GeneralExtended::checkRequirement(mysql_get_client_info(), "version", '3.23')){
$Page->log->pushToLog("Requirement - MySQL Version is not correct. ".mysql_get_client_info()." detected." , SYM_LOG_ERROR, true);
$missing[] = MISSING_MYSQL;
}
if(!GeneralExtended::checkRequirement("zlib", "ext", true)){
$Page->log->pushToLog("Requirement - ZLib extension not present" , SYM_LOG_ERROR, true);
$missing[] = MISSING_ZLIB;
}
if(!GeneralExtended::checkRequirement("xml:libxml", "ext", true)){
$Page->log->pushToLog("Requirement - No XML extension present" , SYM_LOG_ERROR, true);
$missing[] = MISSING_XML;
}
if(!GeneralExtended::checkRequirement("xsl:xslt", "ext", true) && !GeneralExtended::checkRequirement("domxml_xslt_stylesheet", "func", true)) {
$Page->log->pushToLog("Requirement - No XSL extension present" , SYM_LOG_ERROR, true);
$missing[] = MISSING_XSL;
}
$Page->missing = $missing;
return;
}
function update1700(&$Page){
$config = fetchSymphonyConfig();
$install_log = $Page->log;
$start = time();
$install_log->writeToLog(CRLF . '============================================', true);
$install_log->writeToLog('UPDATE PROCESS STARTED (' . date("d.m.y H:i:s") . ')', true);
$install_log->writeToLog('============================================', true);
$config->set('build', '1701', 'symphony');
$config->set('useragent', 'Symphony/1701', 'general');
$config->set('acct_server', kSUPPORT_SERVER, 'symphony');
$string = '<?php' . CRLF
. "define('DOCROOT','".DOCROOT."');" . CRLF
. "define('DOMAIN','". str_replace("http://", "", _INSTALL_DOMAIN_) . "');" . CRLF . CRLF
. '$settings = array();' . CRLF;
$string .= $config->create("php");
$string .= CRLF . "require_once(DOCROOT . '/symphony/lib/boot/bundle.php');" . CRLF . '?>';
$install_log->pushToLog("WRITING: Updates to Configuration File", SYM_LOG_NOTICE, true, true);
if(!GeneralExtended::writeFile(DOCROOT . '/manifest/config.php', $string, $config->get("write_mode", "file"))){
define("_INSTALL_ERRORS_", "Could not write config file. Check permission on /manifest.");
$install_log->pushToLog("ERROR: Writing Configuration File Failed", SYM_LOG_ERROR, true, true);
installResult($Page, $install_log, $start);
return;
}
if(!defined('_INSTALL_ERRORS_')){
$install_log->pushToLog("Installation Process Completed In ".max(1, time() - $start)." sec", SYM_LOG_NOTICE, true);
installResult($Page, $install_log, $start);
GeneralExtended::redirect('http://' . rtrim(str_replace('http://', '', _INSTALL_DOMAIN_), '/') . '/symphony/');
}
return;
}
function update1602(&$Page){
$config = fetchSymphonyConfig();
$install_log = $Page->log;
$start = time();
$install_log->writeToLog(CRLF . '============================================', true);
$install_log->writeToLog('UPDATE PROCESS STARTED (' . date("d.m.y H:i:s") . ')', true);
$install_log->writeToLog('============================================', true);
## Create Manifest directory structure
#
$install_log->pushToLog("WRITING: Creating 'manifest' folder (/manifest)", SYM_LOG_NOTICE, true, true);
if(!GeneralExtended::realiseDirectory(DOCROOT . '/manifest', $config->get("write_mode", "directory"))){
define("_INSTALL_ERRORS_", "Could not create 'manifest' directory. Check permission on the root folder.");
$install_log->pushToLog("ERROR: Creation of 'manifest' folder failed.", SYM_LOG_ERROR, true, true);
installResult($Page, $install_log, $start);
return;
}
$install_log->pushToLog("WRITING: Creating 'logs' folder (/manifest/logs)", SYM_LOG_NOTICE, true, true);
if(!GeneralExtended::realiseDirectory(DOCROOT . '/manifest/logs', $config->get("write_mode", "directory"))){
define("_INSTALL_ERRORS_", "Could not create 'logs' directory. Check permission on /manifest.");
$install_log->pushToLog("ERROR: Creation of 'logs' folder failed.", SYM_LOG_ERROR, true, true);
installResult($Page, $install_log, $start);
return;
}
$install_log->pushToLog("WRITING: Creating 'cache' folder (/manifest/cache)", SYM_LOG_NOTICE, true, true);
if(!GeneralExtended::realiseDirectory(DOCROOT . '/manifest/cache', $config->get("write_mode", "directory"))){
define("_INSTALL_ERRORS_", "Could not create 'cache' directory. Check permission on /manifest.");
$install_log->pushToLog("ERROR: Creation of 'cache' folder failed.", SYM_LOG_ERROR, true, true);
installResult($Page, $install_log, $start);
return;
}
$install_log->pushToLog("WRITING: Creating 'tmp' folder (/manifest/tmp)", SYM_LOG_NOTICE, true, true);
if(!GeneralExtended::realiseDirectory(DOCROOT . '/manifest/tmp', $config->get("write_mode", "directory"))){
define("_INSTALL_ERRORS_", "Could not create 'tmp' directory. Check permission on /manifest.");
$install_log->pushToLog("ERROR: Creation of 'tmp' folder failed.", SYM_LOG_ERROR, true, true);
installResult($Page, $install_log, $start);
return;
}
## Update the config
$config->set('build', '1701', 'symphony');
$config->set('useragent', 'Symphony/1701', 'general');
$config->set('exclude-parameter-declarations', 'off', 'xsl');
$config->set('cookie_prefix', 'sym_', 'symphony');
$config->set('acct_server', kSUPPORT_SERVER, 'symphony');
if(!defined('DOMAIN')){
$clean_path = $_SERVER["HTTP_HOST"] . dirname($_SERVER["PHP_SELF"]);
$clean_path = rtrim($clean_path, '/\\');
$clean_path = preg_replace('/\/{2,}/i', '/', $clean_path);
define('DOMAIN', $clean_path);
}
$string = '<?php' . CRLF
. "define('DOCROOT','".DOCROOT."');" . CRLF
. "define('DOMAIN','". str_replace("http://", "", _INSTALL_DOMAIN_) . "');" . CRLF . CRLF
. '$settings = array();' . CRLF;
$string .= $config->create("php");
$string .= CRLF . "require_once(DOCROOT . '/symphony/lib/boot/bundle.php');" . CRLF . '?>';
$install_log->pushToLog("WRITING: Updates to Configuration File", SYM_LOG_NOTICE, true, true);
if(!GeneralExtended::writeFile(DOCROOT . '/manifest/config.php', $string, $config->get("write_mode", "file"))){
define("_INSTALL_ERRORS_", "Could not write config file. Check permission on /manifest.");
$install_log->pushToLog("ERROR: Writing Configuration File Failed", SYM_LOG_ERROR, true, true);
installResult($Page, $install_log, $start);
return;
}
$install_log->pushToLog("MYSQL: Establishing Connection...", SYM_LOG_NOTICE, true, false);
if(!$db = new MySQL($config->get("database"))){
define("_INSTALL_ERRORS_", "There was a problem while trying to establish a connection to the MySQL server. Please check your settings.");
$install_log->pushToLog("Failed", SYM_LOG_NOTICE,true, true, true);
installResult($Page, $install_log, $start);
return;
}else{
$install_log->pushToLog("Done", SYM_LOG_NOTICE,true, true, true);
}
## Make some updates to the tables
$install_log->pushToLog("MYSQL: Executing Table Update Queries (1 of 4)...", SYM_LOG_NOTICE, true, false);
if(!$db->query('ALTER TABLE `tbl_comments` ADD `author_id` INT(11) UNSIGNED NULL AFTER `entry_id`')){
define('_INSTALL_ERRORS_', 'There was an error while trying to execute query. MySQL returned: ' . fetchLastDBError($db));
$install_log->pushToLog("Failed", SYM_LOG_NOTICE,true, true, true);
installResult($Page, $install_log, $start);
return;
}else{
$install_log->pushToLog("Done", SYM_LOG_NOTICE,true, true, true);
}
$install_log->pushToLog("MYSQL: Executing Table Update Queries (2 of 4)...", SYM_LOG_NOTICE, true, false);
if(!$db->query('ALTER TABLE `tbl_comments` ADD INDEX (`author_id`)')){
define('_INSTALL_ERRORS_', 'There was an error while trying to execute query. MySQL returned: ' . fetchLastDBError($db));
$install_log->pushToLog("Failed", SYM_LOG_NOTICE,true, true, true);
installResult($Page, $install_log, $start);
return;
}else{
$install_log->pushToLog("Done", SYM_LOG_NOTICE,true, true, true);
}
$install_log->pushToLog("MYSQL: Executing Table Update Queries (3 of 4)...", SYM_LOG_NOTICE, true, false);
if(!$db->query("ALTER TABLE `tbl_customfields` CHANGE `type` `type` ENUM('checkbox', 'textarea', 'input', 'select', 'list', 'multiselect', 'upload', 'foreign') DEFAULT 'input' NOT NULL")){
define('_INSTALL_ERRORS_', 'There was an error while trying to execute query. MySQL returned: ' . fetchLastDBError($db));
$install_log->pushToLog("Failed", SYM_LOG_NOTICE,true, true, true);
installResult($Page, $install_log, $start);
return;
}else{
$install_log->pushToLog("Done", SYM_LOG_NOTICE,true, true, true);
}
$install_log->pushToLog("MYSQL: Executing Table Update Queries (4 of 4)...", SYM_LOG_NOTICE, true, false);
if(!$db->query("ALTER TABLE `tbl_campfire` ADD `version` FLOAT(32) UNSIGNED NOT NULL;")){
define('_INSTALL_ERRORS_', 'There was an error while trying to execute query. MySQL returned: ' . fetchLastDBError($db));
$install_log->pushToLog("Failed", SYM_LOG_NOTICE,true, true, true);
installResult($Page, $install_log, $start);
return;
}else{
$install_log->pushToLog("Done", SYM_LOG_NOTICE,true, true, true);
}
if(!defined('_INSTALL_ERRORS_')){
$install_log->pushToLog("Installation Process Completed In ".max(1, time() - $start)." sec", SYM_LOG_NOTICE, true);
installResult($Page, $install_log, $start);
GeneralExtended::redirect('http://' . rtrim(str_replace('http://', '', _INSTALL_DOMAIN_), '/') . '/symphony/');
}
return;
}
function install(&$Page, $fields){
$db = new MySQL;
$db->connect($fields['database']['host'],
$fields['database']['username'],
$fields['database']['password'],
$fields['database']['port']);
if($db->isConnected())
$tables = $db->fetch("SHOW TABLES FROM `".$fields['database']['name']."` LIKE '".mysql_escape_string($fields['database']['prefix'])."%'");
## Invalid path
if(!@is_dir(rtrim($fields['docroot'], '/') . '/symphony')){
$Page->log->pushToLog("Configuration - Bad Document Root Specified: " . $fields['docroot'], SYM_LOG_NOTICE, true);
define("kENVIRONMENT_WARNING", true);
if(!defined("ERROR")) define("ERROR", 'no-symphony-dir');
}
## Existing .htaccess
elseif(is_file(rtrim($fields['docroot'], '/') . '/.htaccess')){
$Page->log->pushToLog("Configuration - Existing '.htaccess' file found: " . $fields['docroot'] . '/.htaccess', SYM_LOG_NOTICE, true);
define("kENVIRONMENT_WARNING", true);
if(!defined("ERROR")) define("ERROR", 'existing-htaccess');
}
## Cannot write to workspace
elseif(is_dir(rtrim($fields['docroot'], '/') . '/workspace') && !is_writable(rtrim($fields['docroot'], '/') . '/workspace')){
$Page->log->pushToLog("Configuration - Workspace folder not writable: " . $fields['docroot'] . '/workspace', SYM_LOG_NOTICE, true);
define("kENVIRONMENT_WARNING", true);
if(!defined("ERROR")) define("ERROR", 'no-write-permission-workspace');
}
## Cannot write to root folder.
elseif(!is_writable(rtrim($fields['docroot'], '/'))){
$Page->log->pushToLog("Configuration - Root folder not writable: " . $fields['docroot'], SYM_LOG_NOTICE, true);
define("kENVIRONMENT_WARNING", true);
if(!defined("ERROR")) define("ERROR", 'no-write-permission-root');
}
## Failed to establish database connection
elseif(!$db->isConnected()){
$Page->log->pushToLog("Configuration - Could not establish database connection", SYM_LOG_NOTICE, true);
define("kDATABASE_CONNECTION_WARNING", true);
if(!defined("ERROR")) define("ERROR", 'no-database-connection');
}
## Failed to select database
elseif(!$db->select($fields['database']['name'])){
$Page->log->pushToLog("Configuration - Database '".$fields['database']['name']."' Not Found", SYM_LOG_NOTICE, true);
define("kDATABASE_CONNECTION_WARNING", true);
if(!defined("ERROR")) define("ERROR", 'no-database-connection');
}
## Failed to establish connection
elseif(is_array($tables) && !empty($tables)){
$Page->log->pushToLog("Configuration - Database table prefix clash with '".$fields['database']['name']."'", SYM_LOG_NOTICE, true);
define("kDATABASE_PREFIX_WARNING", true);
if(!defined("ERROR")) define("ERROR", 'database-table-clash');
}
## Username Not Entered
elseif(trim($fields['user']['username']) == ''){
$Page->log->pushToLog("Configuration - No username entered.", SYM_LOG_NOTICE, true);
define("kUSER_USERNAME_WARNING", true);
if(!defined("ERROR")) define("ERROR", 'user-no-username');
}
## Password Not Entered
elseif(trim($fields['user']['password']) == ''){
$Page->log->pushToLog("Configuration - No password entered.", SYM_LOG_NOTICE, true);
define("kUSER_PASSWORD_WARNING", true);
if(!defined("ERROR")) define("ERROR", 'user-no-password');
}
## Password mismatch
elseif($fields['user']['password'] != $fields['user']['confirm-password']){
$Page->log->pushToLog("Configuration - Passwords did not match.", SYM_LOG_NOTICE, true);
define("kUSER_PASSWORD_WARNING", true);
if(!defined("ERROR")) define("ERROR", 'user-password-mismatch');
}
## No Name entered
elseif(trim($fields['user']['firstname']) == '' || trim($fields['user']['lastname']) == ''){
$Page->log->pushToLog("Configuration - Did not enter First and Last names.", SYM_LOG_NOTICE, true);
define("kUSER_NAME_WARNING", true);
if(!defined("ERROR")) define("ERROR", 'user-no-name');
}
## Invalid Email
elseif(!ereg('^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$', $fields['user']['email'])){
$Page->log->pushToLog("Configuration - Invalid email address supplied.", SYM_LOG_NOTICE, true);
define("kUSER_EMAIL_WARNING", true);
if(!defined("ERROR")) define("ERROR", 'user-invalid-email');
}
## Otherwise there are no error, proceed with installation
else{
$config = $fields;
$kDOCROOT = rtrim($config['docroot'], '/');
$database = array_map("trim", $fields['database']);
if(!isset($database['host']) || $database['host'] == "") $database['host'] = "localhost";
if(!isset($database['port']) || $database['port'] == "") $database['port'] = "3306";
if(!isset($database['prefix']) || $database['prefix'] == "") $database['prefix'] = "sym_";
$install_log = $Page->log;
$start = time();
$install_log->writeToLog(CRLF . '============================================', true);
$install_log->writeToLog('INSTALLATION PROCESS STARTED (' . date("d.m.y H:i:s") . ')', true);
$install_log->writeToLog('============================================', true);
$db = new MySQL;
$install_log->pushToLog("MYSQL: Establishing Connection...", SYM_LOG_NOTICE, true, false);