* @link http://www.pioder.pl/ * @license see LICENSE.txt **/ define('IN_uF',true); require('./../config.php'); require('./../includes/constants.php'); require('./../includes/errors.php'); require('./../includes/db.php'); require('./functions_add.php'); require('./../admin/check_script_data.php'); if (ini_get('short_open_tag')==0) { die('Please enable short_open_tag in PHP configuration. Aborted!'); } if(get_magic_quotes_gpc()) { die('Please disable magic_quotes_gpc in PHP configuration. Aborted!'); } if(ini_get('register_globals')) { die('Please disable register_globals in PHP configuration. Aborted!'); } $count =0; for($i=0; $i'; switch($_GET['page']) { case 'step1': { if (isset($_POST['lang'])) { setcookie('lang',$_POST['lang'], $_SERVER['REQUEST_TIME']+360000000); header('Location: index.php?page=step2'); } else { echo $header.' Select a language:
'; } break; } case 'step2': { if (isset($_POST['accept'])) { header('Location: index.php?page=step3'); } else { echo $header.' '.$lng['licence'].' '; } break; } case 'step3': { if (isset($_POST['next'])) { header('Location: index.php?page=step4'); } else { $bad = 0; if (!@is_writable($folders[0])) { $bad =+1; } if (!@is_writable($folders[1])) { $bad =+1; } if (!@is_writable($folders[2])) { $bad =+1; } if (phpversion()<'4.3.10') { $bad=+1; } if (mysql_get_client_info()<'4.1') { $bad =+1; } if ($count>1) { $bad =+1; } echo $header; $skin=array( 'L.name'=>$lng['name'], 'L.value'=>$lng['value'], 'L.php_version'=>$lng['php_version'], 'PHP.version'=>phpversion(), 'PHP.value' => (phpversion()>='5.0.7') ? 'OK' : ' Error - No OK', 'mySQL.version'=>mysql_get_client_info(), 'L.mySQL_version'=>$lng['mysql_version'], 'mySQL.value'=>(mysql_get_client_info()>='4.1') ? 'OK' : ' Error - No OK', 'L.cat_name'=>$lng['catalog'], 'cat1.name'=> $folders[0], 'cat1.value'=> (@is_writable($folders[0])) ? ''.$lng['is_writable'].' - OK' : ''.$lng['not_writable'].' Error - No OK', 'cat2.name'=> $folders[1], 'cat2.value'=> (@is_writable($folders[1])) ? ''.$lng['is_writable'].' - OK' : ''.$lng['not_writable'].' Error - No OK', 'cat3.name'=> $folders[2], 'cat3.value'=> (@is_writable($folders[2])) ? ''.$lng['is_writable'].' - OK' : ''.$lng['not_writable'].' Error - No OK', 'successfully' => ($count <1) ? ''.$lng['files_is_good'].' ('.count($script_files).')' : ''.$lng['files_not_good'].' ('.$count.')' ); require('./tpls/install_check_script.tpl'); for($i=0; $i$lng['actual_sum'], 'sum_actual'=>$actual, 'L.invalid_md5sum'=>$lng['invalid_md5sum'].' ('.substr($script_files[$i], strrpos($script_files[$i], '/') + 1, strlen($script_files[$i])).')' ); require('./tpls/invalidfile_body.tpl'); } } echo ''; if ($bad>0) { echo '
'; echo ''.$lng['click_next'].''; } else { echo ''; } echo ''; } break; } case 'step4': { if (isset($_POST['mysql_host'],$_POST['database'],$_POST['mysql_prefix'],$_POST['mysql_user'],$_POST['mysql_pass'])) { $open = @fopen('../config.php','a+'); $config_file = @fread($open,@filesize('../config.php')); $config_file = str_replace('%host%',strip_tags($_POST['mysql_host']),$config_file); $config_file = str_replace('%user%',strip_tags($_POST['mysql_user']),$config_file); $config_file = str_replace('%pass%',strip_tags($_POST['mysql_pass']),$config_file); $config_file = str_replace('%dbname%',strip_tags($_POST['database']),$config_file); $config_file = str_replace('%dbprefix%',strip_tags($_POST['mysql_prefix']),$config_file); $connect = @mysql_connect($_POST['mysql_host'],$_POST['mysql_user'],$_POST['mysql_pass']) or message_die(GENERAL,'Could not connect to database server. Error with installation!',@mysql_error()); @fwrite(@fopen('../config.php','w'),$config_file) or message_die(GENERAL,'Could not write config file. Error with installation!',''); @mysql_query("SET NAMES 'utf8'",$connect); @mysql_select_db($_POST['database'],$connect) or message_die(GENERAL,'Could not connect to database. Error with installation!',@mysql_error()); require('./../includes/sql_parse.php'); $sql = @fread(@fopen('uf_tables.sql','r'),@filesize('uf_tables.sql')); $sql = preg_replace('/uf_/', $_POST['mysql_prefix'], $sql); $sql = remove_remarks($sql); $sql = split_sql_file($sql); for ($i=0;$i$lng['mysql_host'], 'L.mysql_user'=>$lng['mysql_user'], 'L.database'=>$lng['db_name'], 'L.mysql_pass'=>$lng['mysql_pass'], 'L.mysql_prefix'=>$lng['mysql_prefix'], 'L.submit'=>$lng['start_install'], ); require('./tpls/install_step4.tpl'); break; } case 'step5': { echo $header.''.$lng['install_complete'].''; break; } case 'step6': { DataBase::db_connect(); if (isset($_POST['user_name'],$_POST['password'],$_POST['retype_password'],$_POST['email'])) { if ($_POST['password']==$_POST['retype_password']) { if (ereg("^.+@.+\..+$", $_POST['email'])) { $sql = "UPDATE `".USERS_TABLE."` SET `nick`='".htmlspecialchars($_POST['user_name'])."', `pass`='".md5(htmlspecialchars($_POST['password']))."', `email`='".htmlspecialchars($_POST['email'])."', `lang`= '".$_COOKIE['lang']."', `regdate`='".$_SERVER['REQUEST_TIME']."', `lastvisit`='".$_SERVER['REQUEST_TIME']."' WHERE `u_id`='1';"; DataBase::sql_query($sql,CRITICAL,'Could not update user. Error with install script!'); $sql = "UPDATE `".POSTS_TABLE."` SET `ptime`='".$_SERVER['REQUEST_TIME']."' WHERE `p_id`='1'"; DataBase::sql_query($sql,CRITICAL,'Could not update post. Error with install script!'); $sql = "UPDATE `".TOPICS_TABLE."` SET `lastpost_time`='".$_SERVER['REQUEST_TIME']."' WHERE `t_id`='1'"; DataBase::sql_query($sql,CRITICAL,'Could not update topic. Error with install script!'); header('Location: index.php?page=step7'); } else { alert($lng['invalid_email']); } } else { alert($lng['invalid_passwords']); } } else { if (!isset($_POST['user_name'])) { $_POST['user_name'] = ''; } if (!isset($_POST['email'])) { $_POST['email'] = ''; } $_POST['password'] = ''; $_POST['retype_password'] = ''; } echo $header; $skin = array( 'L.user_name'=>$lng['user_name'], 'L.password'=>$lng['password'], 'L.retype_password'=>$lng['retype_password'], 'L.email'=>$lng['email'], 'L.submit'=>$lng['save'] ); require('./tpls/install_step6.tpl'); break; } case 'step7': { $open = @fopen('../config.php','a+'); $config_file = @fread($open,@filesize('../config.php')); $config_file = str_replace('false','true',$config_file); @fwrite(@fopen('../config.php','w'),$config_file) or message_die(GENERAL,'Could not write config file. Error with installation!',''); echo $header.''.$lng['info_2'].''; break; } } ?>