function htmlpath($relative_path)
{
$realpath = realpath($relative_path);
$htmlpath = str_replace($_SERVER['DOCUMENT_ROOT'], '', $realpath);
return $htmlpath;
}
function gdVersion($user_ver = 0)
{
if (! extension_loaded('gd')) {
return;
}
static $gd_ver = 0;
// Just accept the specified setting if it's 1.
if ($user_ver == 1) {
$gd_ver = 1;
return 1;
}
// Use the static variable if function was called previously.
if ($user_ver != 2 && $gd_ver > 0) {
return $gd_ver;
}
// Use the gd_info() function if possible.
if (function_exists('gd_info')) {
$ver_info = gd_info();
preg_match('/\d/', $ver_info['GD Version'], $match);
$gd_ver = $match[0];
return $match[0];
}
// If phpinfo() is disabled use a specified / fail-safe choice...
if (preg_match('/phpinfo/', ini_get('disable_functions'))) {
if ($user_ver == 2) {
$gd_ver = 2;
return 2;
} else {
$gd_ver = 1;
return 1;
}
}
// ...otherwise use phpinfo().
ob_start();
phpinfo(8);
$info = ob_get_contents();
ob_end_clean();
$info = stristr($info, 'gd version');
preg_match('/\d/', $info, $match);
$gd_ver = $match[0];
return $match[0];
} // End gdVersion()
/* *********************************check server configuration *****************************************************/
$ivo = "";
$ivf = "";
$sc = "";
$gdv = gdVersion();
$val1 = ini_get("safe_mode");
$val2 = ini_get("short_open_tag");
$val3 = ini_get("file_uploads");
$val4 = ini_get("open_basedir");
/*
$openbasedircheck = "0" ;
if ((!empty($val4) || $val4 == 1) and (!empty($val3) || $val3 == 1)) {
if ($_POST["submittest"] == "Upload") {
$uploadpath = substr($_FILES['testupload']['tmp_name'], 0, strlen($_FILES['testupload']['tmp_name']) - strlen(basename($_FILES['testupload']['tmp_name']))-1);
$uploadpatharray = explode("/", $uploadpath);
$openbasedirarray = explode(":", $val4);
$existflag = 0;
$checkitem = "";
for($i = 1;$i < count($uploadpatharray);$i++) {
$checkitem = $checkitem . "/" . $uploadpatharray[$i];
if (! in_array($checkitem, $openbasedirarray) and ! in_array($checkitem . "/", $openbasedirarray)) {;
} else {
$existflag = 1;
break;
}
}
if ($existflag == 1) {
$openbasedircheck = "1";
} else {
$errormessageforopenbasedir = "
" . $ivf . "Please add '$uploadpath' in openbase directory entry of your configuration file.[contact your hosting provider]";
}
$_SESSION['sess_openbasedircheck'] = $openbasedircheck;
}
} else {
$_SESSION['sess_openbasedircheck'] = "1";
}
*/
$gdvsupport = true;
$errmess_gdsupport = "";
if ($gdv) {
$gdvsupportarray = gd_info();
$z = 0;
foreach($gdvsupportarray as $key => $value) {
if ($z == 3 or $z == 10) {;
} else {
if ($gdvsupportarray[$key]) {;
} else {
$gdvsupport = false;
$errmess_gdsupport .= $key . " required,";
}
}
$z++;
}
}
$curlsupport = true;
if (!function_exists('curl_version')) {
$curlsupport = false;
}
if ((! empty($val1) || $val1 == 1) or (empty($val2) || $val2 != 1) or (empty($val3) || $val3 != 1) or ! $gdv or !$gdvsupport or !$curlsupport or $_SESSION['sess_openbasedircheck'] != '1') {
$serverconfiguration = "FAILURE";
} else {
$serverconfiguration = "OK";
}
/***********Server configuration check ends here*****************/
?>
Server Configuration OK!!
Preinstall Check ";
echo " ";
echo "Checking PHP Version... " . $ivo . PHP_VERSION . $sc . " ";
if (version_compare(PHP_VERSION, "5.0") >= 0) echo $ivo . "(ok)" . $sc;
else {
echo $ivf . "(5.0 or higher required)" . $sc;
$fatal = true;
}
echo " ";
echo "Checking System Information... " . $ivo . PHP_OS . $sc . " ";
echo "Checking PHP Server API... " . $ivo . php_sapi_name() . $sc . " ";
//$curlversion = curl_version();
echo "Checking Path to 'php.ini'... " . $ivo . PHP_CONFIG_FILE_PATH . $sc . " ";;
echo $ivo . (($curlsupport) ? "$curlversion" : " $ivf This program requires Curl extension. Please recompile your PHP with Curl Support.") . $sc;
echo "";
/*echo "Checking Curl Version... " . $ivo . curl_version() . " (ok)". $sc." ";
if ($errmess_gdsupport != "") {
echo "Checking PHP GD extension... ";
echo $ivo . (($gdv) ? "On" : " $ivf This program requires PHP GD extension. Please recompile your PHP with GD Support.") . $sc;
echo " ";
} */
echo "Checking currently installed GD library ... ";
echo $ivo . (($gdvsupport) ? "On" : " $ivf $errmess_gdsupport.") . $sc;
echo " ";
/*echo "Checking safe_mode... ";
echo ((!empty($val1) || $val1 == 1) ? $ivf . "On-Please turn off safe_mode in the php.ini" : $ivo . "Off") . $sc;
echo " ";
echo "Checking short_tags... ";
echo ((!empty($val2) || $val2 == 1) ?$ivo . "On" : $ivf . "Off-Please turn on short_tags in the php.ini") . $sc;
echo " ";
*/
echo "Checking file_uploads...";
echo ((!empty($val3) || $val3 == 1) ? $ivo . "On" : $ivf . "Off - Please turn on file_uplaods in the php.ini file") . $sc;
echo " ";
echo "Checking open base directory...";
echo (( (!empty($val4) || $val4 == 1) and $openbasedircheck != "1") ? $ivf . "On - $ivf Please upload a test file " : $ivo . "Off ") . $sc . " ";
if ((! empty($val1) || $val1 == 1) or (empty($val2) || $val2 != 1) or (empty($val3) || $val3 != 1) or ! $gdv /*or $openbasedircheck != '1'*/) {
echo "";
if ((!empty($val4) || $val4 == 1) and (!empty($val3) || $val3 == 1)) {
if ($_POST["submittest"] == "Upload") {
echo $errormessageforopenbasedir;
$_SESSION['sess_openbasedircheck'] = $openbasedircheck;
}
if ($openbasedircheck != "1") {
?>
";
}
?>
" . $ivf . "Fatal errors detected. Please correct the above red items and reload.