Skip to content
Newer
Older
100644 134 lines (114 sloc) 2.95 KB
0c99ade @Kilandor Work on New Web Installer system
Kilandor authored
1 <?php
2 /**
7f439c8 @trustmaster Next step in modularization.
trustmaster authored
3 * Install script
0c99ade @Kilandor Work on New Web Installer system
Kilandor authored
4 *
5 * @package Cotonti
507a789 @trustmaster 2010 -> 2011, 0.7.0 -> 0.9.0
trustmaster authored
6 * @version 0.9.0
c3d20b2 @trustmaster Applied #810
trustmaster authored
7 * @author Cotonti Team
8 * @copyright Copyright (c) Cotonti Team 2008-2012
0c99ade @Kilandor Work on New Web Installer system
Kilandor authored
9 * @license BSD
10 */
11
7f439c8 @trustmaster Next step in modularization.
trustmaster authored
12 // Environment setup
38fbf45 @trustmaster Global prefix change #522: sed_ => cot_
trustmaster authored
13 define('COT_CODE', TRUE);
14 define('COT_INSTALL', TRUE);
15 //define('COT_ADMIN', TRUE);
1b73a52 @trustmaster Changed $location to $env['location'] to avoid conflicts. Added suppo…
trustmaster authored
16 $env['location'] = 'install';
4aeb8fe @trustmaster Roll back to the old urls by default and module loaders in the root. …
trustmaster authored
17 $env['ext'] = 'install';
0c99ade @Kilandor Work on New Web Installer system
Kilandor authored
18
2ddbd36 @trustmaster Automatic updater implemetation.
trustmaster authored
19 if (file_exists('./datas/config.php'))
0c99ade @Kilandor Work on New Web Installer system
Kilandor authored
20 {
2ddbd36 @trustmaster Automatic updater implemetation.
trustmaster authored
21 require_once './datas/config.php';
0c99ade @Kilandor Work on New Web Installer system
Kilandor authored
22 }
23 else
24 {
2ddbd36 @trustmaster Automatic updater implemetation.
trustmaster authored
25 require_once './datas/config-sample.php';
0c99ade @Kilandor Work on New Web Installer system
Kilandor authored
26 }
a6e6ba6 @trustmaster Modularization Stage 1: directory structure change
trustmaster authored
27
28 if (empty($cfg['modules_dir']))
29 {
30 $cfg['modules_dir'] = './modules';
31 }
32 if (empty($cfg['lang_dir']))
33 {
34 $cfg['lang_dir'] = './lang';
35 }
36
06367ff @trustmaster Better error reporting control. Replaced some constants with $cfg ent…
trustmaster authored
37 // Force config options
38 $cfg['display_errors'] = true;
39 $cfg['debug_mode'] = true;
f9b4d08 @trustmaster Genoa => Siena upgrade script now working. Use for testing purpose on…
trustmaster authored
40 $cfg['customfuncs'] = false;
41 $cfg['cache'] = false;
5ed303a @trustmaster Fixed bugs and added more checks in install/update
trustmaster authored
42 $cfg['xtpl_cache'] = false;
f9b4d08 @trustmaster Genoa => Siena upgrade script now working. Use for testing purpose on…
trustmaster authored
43
80dbd4c @Dayver Some style fix (not fully completed)
Dayver authored
44 require_once $cfg['system_dir'].'/functions.php';
4e8b038 loads cotemplate before common
esclkm authored
45 require_once $cfg['system_dir'] . '/cotemplate.php';
794782c @trustmaster A massive improvement in depenedencies mechanism
trustmaster authored
46 require_once 'system/debug.php';
47
f9b4d08 @trustmaster Genoa => Siena upgrade script now working. Use for testing purpose on…
trustmaster authored
48
49 if (isset($cfg['new_install']) && $cfg['new_install'])
0c99ade @Kilandor Work on New Web Installer system
Kilandor authored
50 {
6d0a944 @trustmaster DB and installer fixes
trustmaster authored
51 require_once $cfg['system_dir'].'/database.php';
76408cb @trustmaster Installer fixes and complete modular updater
trustmaster authored
52
53 // A Few basics from common.php
54 if (version_compare(PHP_VERSION, '6.0.0', '<='))
0c99ade @Kilandor Work on New Web Installer system
Kilandor authored
55 {
76408cb @trustmaster Installer fixes and complete modular updater
trustmaster authored
56 if (get_magic_quotes_gpc())
0c99ade @Kilandor Work on New Web Installer system
Kilandor authored
57 {
38fbf45 @trustmaster Global prefix change #522: sed_ => cot_
trustmaster authored
58 function cot_disable_mqgpc(&$value, $key)
76408cb @trustmaster Installer fixes and complete modular updater
trustmaster authored
59 {
60 $value = stripslashes($value);
61 }
62 $gpc = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
38fbf45 @trustmaster Global prefix change #522: sed_ => cot_
trustmaster authored
63 array_walk_recursive($gpc, 'cot_disable_mqgpc');
0c99ade @Kilandor Work on New Web Installer system
Kilandor authored
64 }
65 }
76408cb @trustmaster Installer fixes and complete modular updater
trustmaster authored
66 define('MQGPC', FALSE);
67 error_reporting(E_ALL ^ E_NOTICE);
0c99ade @Kilandor Work on New Web Installer system
Kilandor authored
68
76408cb @trustmaster Installer fixes and complete modular updater
trustmaster authored
69 session_start();
3f7c3ff @trustmaster #521: step-by-step installer, new installer skin, not yet completed (…
trustmaster authored
70
76408cb @trustmaster Installer fixes and complete modular updater
trustmaster authored
71 // Installer language selection support
72 if (empty($_SESSION['cot_inst_lang']))
73 {
38fbf45 @trustmaster Global prefix change #522: sed_ => cot_
trustmaster authored
74 $lang = cot_import('lang', 'P', 'ALP');
76408cb @trustmaster Installer fixes and complete modular updater
trustmaster authored
75 if (empty($lang))
76 {
77 $lang = 'en';
78 }
79 }
80 else
3f7c3ff @trustmaster #521: step-by-step installer, new installer skin, not yet completed (…
trustmaster authored
81 {
76408cb @trustmaster Installer fixes and complete modular updater
trustmaster authored
82 $lang = $_SESSION['cot_inst_lang'];
3f7c3ff @trustmaster #521: step-by-step installer, new installer skin, not yet completed (…
trustmaster authored
83 }
76408cb @trustmaster Installer fixes and complete modular updater
trustmaster authored
84
38fbf45 @trustmaster Global prefix change #522: sed_ => cot_
trustmaster authored
85 require_once cot_langfile('main', 'core');
76408cb @trustmaster Installer fixes and complete modular updater
trustmaster authored
86 require_once $cfg['system_dir'] . '/resources.php';
3f7c3ff @trustmaster #521: step-by-step installer, new installer skin, not yet completed (…
trustmaster authored
87 }
88 else
89 {
f9b4d08 @trustmaster Genoa => Siena upgrade script now working. Use for testing purpose on…
trustmaster authored
90 $branch = 'siena';
91 $prev_branch = 'genoa';
92
93 require_once $cfg['system_dir'].'/database.php';
94
0c25145 @trustmaster Added custom MySQL port support for issue #716
trustmaster authored
95 $dbc_port = empty($cfg['mysqlport']) ? '' : ';port='.$cfg['mysqlport'];
96 $db = new CotDB('mysql:host='.$cfg['mysqlhost'].$dbc_port.';dbname='.$cfg['mysqldb'], $cfg['mysqluser'], $cfg['mysqlpassword']);
f9b4d08 @trustmaster Genoa => Siena upgrade script now working. Use for testing purpose on…
trustmaster authored
97
98 $sql_install = @$db->query("SHOW TABLES LIKE '$db_updates'");
99
100 if ($sql_install->rowCount() != 1)
101 {
102 define('COT_UPGRADE', true);
103 $cfg['defaulttheme'] = 'nemesis';
104 $cfg['defaultscheme'] = 'default';
105 }
76408cb @trustmaster Installer fixes and complete modular updater
trustmaster authored
106 require_once $cfg['system_dir'].'/common.php';
3f7c3ff @trustmaster #521: step-by-step installer, new installer skin, not yet completed (…
trustmaster authored
107 }
108
b61f266 @trustmaster cot_require has been rolled back to require_once and similar function…
trustmaster authored
109 require_once cot_incfile('forms');
110 require_once cot_incfile('extensions');
111 require_once cot_langfile('install', 'module');
112 require_once cot_langfile('users', 'core');
113 require_once cot_langfile('admin', 'core');
76408cb @trustmaster Installer fixes and complete modular updater
trustmaster authored
114
b61f266 @trustmaster cot_require has been rolled back to require_once and similar function…
trustmaster authored
115 require_once cot_incfile('install', 'module', 'resources');
0c99ade @Kilandor Work on New Web Installer system
Kilandor authored
116
76408cb @trustmaster Installer fixes and complete modular updater
trustmaster authored
117 // Various Generic Vars needed to operate as Normal
118 $theme = $cfg['defaulttheme'];
3ba2e41 @trustmaster #481: Renamed "themes" to "color schemes" and "skins" to "themes".
trustmaster authored
119 $scheme = $cfg['defaultscheme'];
76408cb @trustmaster Installer fixes and complete modular updater
trustmaster authored
120 $out['meta_lastmod'] = gmdate('D, d M Y H:i:s');
121 $file['config'] = './datas/config.php';
122 $file['config_sample'] = './datas/config-sample.php';
123 $file['sql'] = './setup/install.sql';
124
7f439c8 @trustmaster Next step in modularization.
trustmaster authored
125 if (!$cfg['new_install'])
2ddbd36 @trustmaster Automatic updater implemetation.
trustmaster authored
126 {
b61f266 @trustmaster cot_require has been rolled back to require_once and similar function…
trustmaster authored
127 include cot_incfile('install', 'module', 'update');
2ddbd36 @trustmaster Automatic updater implemetation.
trustmaster authored
128 }
129 else
130 {
b61f266 @trustmaster cot_require has been rolled back to require_once and similar function…
trustmaster authored
131 include cot_incfile('install', 'module', 'install');
2ddbd36 @trustmaster Automatic updater implemetation.
trustmaster authored
132 }
80dbd4c @Dayver Some style fix (not fully completed)
Dayver authored
133
0c99ade @Kilandor Work on New Web Installer system
Kilandor authored
134 ?>
Something went wrong with that request. Please try again.