#66 install php version check

#16 install rewrite module usable check
#48 htmlspecialchars function params add
This commit is contained in:
akasima 2013-11-18 16:54:17 +09:00 committed by bnu
parent 51b6b21cf2
commit 736f382b27
93 changed files with 240 additions and 215 deletions

View file

@ -329,9 +329,8 @@ class installController extends install
{
// Check each item
$checklist = array();
// 0. check your version of php (5.2.4 upper)
$checkPHPVersion = phpversion();
if(version_compare($checkPHPVersion, '5.2.4') == -1) $checklist['php_version'] = false;
// 0. check your version of php (5.2.4 or higher)
if(version_compare(PHP_VERSION, '5.2.4') == -1) $checklist['php_version'] = false;
else $checklist['php_version'] = true;
// 1. Check permission
if(is_writable('./')||is_writable('./files')) $checklist['permission'] = true;
@ -358,11 +357,50 @@ class installController extends install
// Save the checked result to the Context
Context::set('checklist', $checklist);
Context::set('install_enable', $install_enable);
Context::set('phpversion', $checkPHPVersion);
Context::set('phpversion', PHP_VERSION);
return $install_enable;
}
/**
* check this server can use rewrite module
* make a file to files/config and check url approach by ".htaccess" rules
*
* @return bool
*/
function checkRewriteUsable() {
$checkString = "isApproached";
$checkFilePath = 'files/config/tmpRewriteCheck.txt';
FileHandler::writeFile(_XE_PATH_.$checkFilePath, trim($checkString));
$hostname = $_SERVER['SERVER_NAME'];
$port = $_SERVER['SERVER_PORT'];
$query = "/JUST/CHECK/REWRITE/" . $checkFilePath;
$fp = @fsockopen($hostname, $port, $errno, $errstr);
if(!$fp) return false;
fputs($fp, "GET {$query} HTTP/1.0\r\n");
fputs($fp, "Host: {$hostname}\r\n\r\n");
$buff = '';
while(!feof($fp)) {
$str = fgets($fp, 1024);
if(trim($str)=='') $start = true;
if($start) $buff .= $str;
}
fclose($fp);
$ret = trim($buff);
FileHandler::removeFile(_XE_PATH_.$checkFilePath);
if( $ret == $checkString )
return true;
else
return false;
}
/**
* @brief Create files and subdirectories
* Local evironment setting before installation by using DB information

View file

@ -63,7 +63,8 @@ class installView extends install
*/
function dispInstallCheckEnv()
{
$useRewrite = $this->useRewriteModule() ? 'Y' : 'N';
$oInstallController = &getController('install');
$useRewrite = $oInstallController->checkRewriteUsable() ? 'Y' : 'N';
$_SESSION['use_rewrite'] = $useRewrite;
Context::set('use_rewrite', $useRewrite);

View file

@ -15,10 +15,8 @@
<p>
<i class="x_icon-ok-sign x_icon-white"></i>
<strong>XE {__XE_VERSION__}</strong> {$lang->install_condition_enable}
&rsaquo;
<a href="#details" data-toggle style="text-decoration:underline">{$lang->install_details}</a>
</p>
<ul id="details" style="display:none;outline:none">
<ul id="details">
<li loop="$checklist => $key,$val">
<strong>{$lang->install_checklist_title[$key]}<block cond="$key == 'php_version'">(Ver. {$phpversion})</block></strong>
:
@ -26,7 +24,7 @@
</li>
</ul>
</div>
<div cond="$use_rewrite == 'N'">
<div cond="$use_rewrite == 'N' && $checklist['permission'] == true">
<p>
<i class="x_icon-ok-sign x_icon-white"></i>
{$lang->disable_rewrite}
@ -43,15 +41,3 @@
</div>
</div>
<include target="footer.html" />
<script>
jQuery(function($){
$('a[href="#details"]').click(function(){
var $this = $(this);
if($($this.attr('href')).is(':hidden')){
$this.text('{$lang->install_simply}');
}else{
$this.text('{$lang->install_details}');
}
});
});
</script>