11 $ini = parse_ini_file(
'../fw_headers/install.ini',
true);
12 error_reporting(E_ERROR | E_PARSE);
13 foreach($ini[
'bootstrap_paths'][
'require'] as $val)
19 $inc->install($ini[
'extensions'][
'ignored']);
20 $paths = $inc->installerPath();
22 foreach($paths as $val)
37 $seo->title($afterBootUp[0]->info[
'FWK'].
' - '.$ini[
'installer'][
'name']);
38 $seo->owner($ini[
'installer'][
'author']);
39 $seo->bootstrapDefs();
42 $PHPversion=explode(
".",phpversion());
43 if(($_GET[
'install']==$ini[
'installer'][
'initialize'])&&((floatval($PHPversion[0].
'.'.$PHPversion[1]))>=floatval($ini[
'installer'][
'minimalphp'])))
45 chmod(
"../fw_headers/", 0777);
46 if((($_POST[
'host']!=
"")&&($_POST[
'user']!=
"")&&($_POST[
'name']!=
"")&&($_POST[
'pass']!=
""))||((defined(
'DB_USER'))&&(defined(
'DB_NAME'))&&(defined(
'DB_PASS'))&&(defined(
'DB_HOST'))))
48 $hash = md5($_SERVER[
'SERVER_NAME'].$_SERVER[
'SERVER_ADDR'].$_POST[
'host'].$_POST[
'user'].$_POST[
'type']);
49 $file =
new fileSystem($ini[
'new_file_paths'][
'mysqlconfig']);
52 .---------------------------------------------------------------------------.
53 | Software: '.$afterBootUp[0]->info[
'NME'].
' SQL Config |
54 | Version: '.$afterBootUp[0]->info[
'VSN'].
' |
56 | ------------------------------------------------------------------------- |
57 | Author: Bc. Peter Horváth (original founder) |
58 | Copyright (c) 2011-'.date(
"Y").
', Bc. Peter Horváth. All Rights Reserved. |
59 | ------------------------------------------------------------------------- |
60 | License: Distributed under the General Public License (GPL) |
61 | http://www.gnu.org/licenses/gpl-3.0.html |
62 | This program is distributed in the hope that it will be useful - WITHOUT |
63 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
64 | FITNESS FOR A PARTICULAR PURPOSE. |
65 ´---------------------------------------------------------------------------´
70 const host = "'.(isset($_POST[
'host'])?$_POST[
'host']:DB_HOST).
'";
71 const name = "'.(isset($_POST[
'name'])?$_POST[
'name']:DB_NAME).
'";
72 const user = "'.(isset($_POST[
'user'])?$_POST[
'user']:DB_USER).
'";
73 const pass = "'.(isset($_POST[
'pass'])?$_POST[
'pass']:DB_PASS).
'";
74 const type = "'.(isset($_POST[
'type'])?$_POST[
'type']:
"sams").
'";
75 const hash = "'.$hash.
'";
76 const cache= "'.(isset($_POST[
'cache'])?$_POST[
'cache']:
"0").
'";
78 //depecrated variables
80 $DBHost = database::host;
82 $DBUser = database::user;
83 $DBName = database::name;
84 $DBPass = database::pass;
86 $DBType = database::type;
88 define("SENCILLO_CONFIG",database::hash);
90 $QUICKCACHE_ON = database::cache;
94 if(!file_exists($ini[
'new_file_paths'][
'yourcode']))
96 $file =
new fileSystem($ini[
'new_file_paths'][
'yourcode']);
101 $seo->title($core->coreSencillo->info["FWK"]." - Example page");
102 $seo->owner("'.$_POST[
'user-new-name'].
', '.$_POST[
'user-new-mail'].
'");
103 $seo->bootstrapDefs();
106 $translate = new translate("translate.json","en");
107 require_once("./fw_templates/system/welcome.default.screen.php");
110 $file =
new fileSystem($ini[
'new_file_paths'][
'firststart']);
111 $json = json_encode(array(
'time'=>date(
"H:i:s"),
112 'date'=>date(
"Y-m-d"),
113 'email'=>$_POST[
'user-new-mail'],
114 'PHP' =>phpversion(),
115 'SYSTEM'=>$afterBootUp[0]->info[
'FWK'],
120 if(!defined(
'DB_USER'))
122 foreach($ini[
'htaccess'][
'cache'] as $key=>$val)
124 $expiresbytype.=
'ExpiresByType '.$val.
' "access plus '.$ini[
'htaccess'][
'cache_size'].
' '.$ini[
'htaccess'][
'cache_unit'].
'"'.PHP_EOL;
126 if($ini[
'htaccess'][
'protocol']==
"http")
128 $protocolinhtaccess=
'# HTTPS to HTTP
129 <IfModule mod_rewrite.c>
130 RewriteCond %{SERVER_PORT} ^443$
131 RewriteCond %{HTTPS} =on
132 RewriteRule ^(.*)$ http://'.$_SERVER[
'SERVER_NAME'].
'/$1 [L,R=301]
137 $protocolinhtaccess=
'# HTTP to HTTPS
138 <IfModule mod_rewrite.c>
139 RewriteCond %{SERVER_PORT} !^443$
140 RewriteCond %{HTTPS} off
141 RewriteRule ^(.*)$ https://'.$_SERVER[
'SERVER_NAME'].
'/$1 [R=301,L]
144 $file =
new fileSystem($ini[
'new_file_paths'][
'htaccess']);
145 $file->write(
'# Create with '.$afterBootUp[0]->info[
'FWK'].
'.
153 <IfModule mod_expires.c>
158 '.$protocolinhtaccess.
'
161 <IfModule mod_rewrite.c>
167 <IfModule mod_rewrite.c>
168 RewriteCond %{REQUEST_FILENAME} !-f
169 RewriteCond %{REQUEST_FILENAME} !-d
170 RewriteCond %{REQUEST_FILENAME} !-l
171 RewriteRule ^(.*)$ index.php?p=$1 [L,QSA]
174 # '.$_SERVER[
'SERVER_NAME'].
' -> www.'.$_SERVER[
'SERVER_NAME'].
'
175 <IfModule mod_rewrite.c>
176 RewriteCond %{HTTP_HOST} !^'.$_SERVER[
'SERVER_NAME'].
'$ [NC]
177 RewriteRule ^(.*)$ http://'.$_SERVER[
'SERVER_NAME'].
'/$1 [L,R=301]
181 chmod(
"../fw_core/", 0700);
182 chmod(
"../fw_cache/", 0700);
183 chmod(
"../fw_headers/", 0700);
184 chmod(
"../fw_modules/", 0700);
185 chmod(
"../fw_libraries/", 0700);
186 chmod(
"../fw_script/", 0700);
188 foreach($ini[
'bootstrap_middle_paths'][
'require'] as $val)
190 require_once(
"$val");
193 if(!defined(
'DB_USER'))
196 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
198 $mysql->write($delinsql);
200 SET time_zone = "'.$ini[
'sql_driver_config'][
'timezone'].
'";
202 $mysql->write($delinsql);
205 CREATE TABLE IF NOT EXISTS `console` (
206 `id` bigint(20) NOT NULL AUTO_INCREMENT,
207 `time` datetime NOT NULL,
208 `title` varchar(25) NOT NULL,
209 `data` varchar(255) NOT NULL,
211 ) ENGINE=MEMORY DEFAULT CHARSET=utf8 MAX_ROWS='.$ini[
'sql_driver_config'][
'consolesize'].
' AUTO_INCREMENT=0;
213 $mysql->write($delinsql);
216 CREATE TABLE IF NOT EXISTS `country` (
217 `id` varchar(2) COLLATE utf8_unicode_ci NOT NULL,
218 `id2` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL,
219 `name` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
221 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
223 $mysql->write($delinsql);
228 CREATE TABLE IF NOT EXISTS `login` (
229 `id` bigint(20) NOT NULL AUTO_INCREMENT,
230 `userid` bigint(20) NOT NULL,
231 `sessionid` longtext NOT NULL,
232 `expiration` int(11) NOT NULL,
233 `perm` int(11) NOT NULL,
235 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=0;
237 $mysql->write($delinsql);
240 CREATE TABLE sencillo_cache (
241 CACHEKEY varchar(255) NOT NULL,
242 CACHEEXPIRATION int(11) NOT NULL,
246 PRIMARY KEY (CACHEKEY)
249 $mysql->write($delinsql);
252 CREATE TABLE IF NOT EXISTS `virtual_system_config` (
253 `id` int(11) NOT NULL AUTO_INCREMENT,
254 `function` varchar(25) NOT NULL,
255 `command` varchar(25) NOT NULL,
256 `commander` int(11) NOT NULL,
258 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=0 ;
260 $mysql->write($delinsql);
267 foreach($clist as $key=>$val)
275 $mysql->insert($delinsql);
278 if(!defined(
'DB_USER'))
281 'virtual_system_config'=>array(
283 'function'=>
'superuser',
284 'command'=>$_POST[
'user-new-name'],
287 $mysql->insert($delinsql);
290 'virtual_system_config'=>array(
292 'function'=>
'superpass',
293 'command'=>md5($_POST[
'user-new-pass']),
296 $mysql->insert($delinsql);
299 'virtual_system_config'=>array(
301 'function'=>
'supermail',
302 'command'=>$_POST[
'user-new-mail'],
305 $mysql->insert($delinsql);
308 'virtual_system_config'=>array(
310 'function'=>
'systemhash',
314 $mysql->insert($delinsql);
317 'virtual_system_config'=>array(
319 'function'=>
'servername',
320 'command'=>$_SERVER[
'SERVER_NAME'],
323 $mysql->insert($delinsql);
326 'virtual_system_config'=>array(
328 'function'=>
'htaccess_config',
329 'command'=>
'default',
332 $mysql->insert($delinsql);
337 'virtual_system_config'=>array(
339 'function'=>
'htaccess_config',
343 $mysql->insert($delinsql);
348 'virtual_system_config'=>array(
350 'function'=>
'phpversion',
351 'command'=>phpversion(),
354 $mysql->insert($delinsql);
357 $dir =
'../fw_libraries';
358 $scan = array_diff(scandir($dir),array(
'..',
'.'));
359 $json = json_encode($scan);
361 foreach($scan as $key=>$val)
364 'virtual_system_config'=>array(
366 'function'=>
"lib:$key",
370 $mysql->insert($delinsql);
375 'virtual_system_config'=>array(
377 'function'=>
"lib_count",
378 'command'=>
sizeof($scan),
381 $mysql->insert($delinsql);
387 'sign'=>
"'first_use'",
389 'login'=>
"'".$_POST[
'user-new-name'].
"'",
390 'pass'=>
"'".md5($_POST[
'user-new-pass']).
"'",
391 'email'=>
"'".$_POST[
'user-new-mail'].
"'",
395 'ip'=>
"'".$_SERVER[
'REMOTE_ADDR'].
"'",
396 'agent'=>
"'".$_SERVER[
'HTTP_USER_AGENT'].
"'",
397 'date'=>
'DATE(NOW())',
398 'time'=>
'TIME(NOW())',
400 $mysql->insert($delinsql,
false);
403 foreach($ini[
'bootstrap_end_paths'][
'require'] as $val)
405 require_once(
"$val");