16 require_once(
'./packages/core/core.php' );
17 require_once(
'./include/php/startup.php' );
19 @unlink(
'./packages/cache/data/cache' );
20 @unlink(
'./packages/cache/data/table' );
35 $Page = $CachedFS->file_get_contents(
"./install/res/templates/install_template_1.tpl" );
56 if( $Silent ===
false )
59 $Page = $CachedFS->file_get_contents(
"./install/res/templates/install_template_2.tpl" );
60 $Page = str_replace(
'{error_message}' ,
'An error occured while database connection' , $Page );
64 $PlaceHolders = array(
'{host}' ,
'{database}' ,
'{prefix}' ,
'{user}' ,
'{password}' );
66 $Security->get_gp(
'host' ,
'string' ,
'' ) , $Security->get_gp(
'database' ,
'string' ,
'' ) ,
67 $Security->get_gp(
'prefix' ,
'string' ,
'' ) , $Security->get_gp(
'user' ,
'string' ,
'' ) ,
68 $Security->get_gp(
'password' ,
'string' ,
'' )
70 $Page = str_replace( $PlaceHolders , $Data , $Page );
111 function handle_step_2( $Host , $Database , $Prefix , $User , $Password , $Silent =
false )
113 $DatabaseAlgorithms =
get_package(
'database::database_algorithms' ,
'last' , __FILE__ );
115 $CachedFS->file_put_contents(
116 "packages/_core_data/conf/cf_mysql_database" ,
"$Host#$User#$Password#$Database#$Prefix"
119 if( $DatabaseAlgorithms->try_connect() )
121 $DBScript = file_get_contents(
'./install/sql/data.sql' ,
'cleaned' );
122 $DBScript = str_replace(
'{prefix}' , $Prefix , $DBScript );
123 $DatabaseAlgorithms->execute_query_set( $DBScript );
124 if( $Silent ===
false )
126 header(
'Location: ./install.php?page=3' );
149 $Page = $CachedFS->file_get_contents(
"./install/res/templates/install_template_2.tpl" );
151 $Needles = array(
'{host}' ,
'{user}' ,
'{password}' ,
'{database}' ,
'{prefix}' ,
'{error_message}' );
153 $Config = $CachedFS->file_get_contents(
"packages/_core_data/conf/cf_mysql_database" );
154 $Replacements = array_merge( explode(
'#' , $Config ) , array(
'' ) );
156 print( str_replace( $Needles , $Replacements , $Page ) );
178 if( $Security->get_gp(
'setup_db' ) )
181 $Security->get_gp(
'host' ,
'string' ,
'' ) , $Security->get_gp(
'database' ,
'string' ,
'' ) ,
182 $Security->get_gp(
'prefix' ,
'string' ,
'' ) , $Security->get_gp(
'user' ,
'string' ,
'' ) ,
183 $Security->get_gp(
'password' ,
'string' ,
'' ) , $Silent
212 $HttpHost = rtrim( $HttpHost ,
'/\\' );
213 $HtAccess = file_get_contents(
'./install/res/templates/tpl.htaccess' );
214 $HtAccess = str_replace(
'{http_host}' , $HttpHost , $HtAccess );
215 file_put_contents(
'.htaccess' , $HtAccess );
218 './packages/_core_data/conf/cf_settings' ,
"HTTP_HOST=$HttpHost\r\nGZIP_TRAFFIC=false"
221 if( $Silent ===
false )
223 header(
'Location: ./install.php?page=4' );
251 if( $HttpHost ===
false )
253 if( $Silent ===
false )
255 $Page = $CachedFS->file_get_contents(
"./install/res/templates/install_template_3.tpl" );
258 rtrim(
'http://'.$_SERVER[
'SERVER_NAME' ].dirname( $_SERVER[
'REQUEST_URI' ] ) ,
'/\\' ) ,
284 $Page = $CachedFS->file_get_contents(
"./install/res/templates/install_template_4.tpl" );
310 $Page = $Security->get_gp(
'page' ,
'integer' , 1 );
319 install_step_3( $Security->get_gp(
'http_root' ,
'string' ,
false ) , false );
340 if( isset( $_GET[
'auto_install' ] ) ===
true )
342 $DBS = file_get_contents(
'./install/conf/cf_db_settings' );
343 $DBS = explode(
'#' , $DBS );
345 install_step_2( $DBS[ 0 ] , $DBS[ 1 ] , $DBS[ 2 ] , $DBS[ 3 ] , $DBS[ 4 ] ,
true );
347 $HttpHost = rtrim(
'http://'.$_SERVER[
'SERVER_NAME' ].dirname( $_SERVER[
'REQUEST_URI' ] ) ,
'/\\' );
355 catch( Exception $e )