function Check_Env_OK()
{
    $error = "";
    if (!(version_compare(PHP_VERSION, '5.3.0') >= 0)) {
        $error .= "ERROR: PHP version 5.3.0 or greater is required.<BR>You are running PHP " . PHP_VERSION . ".<BR>";
    }
    if (!is__writeable("config/")) {
        $error .= "ERROR: Your /config/ directory is not writeable.<BR><BR>Unix/Linux: CHMOD the directory and its contents to 777.<BR><BR>Windows: Right click the /config/ folder, go to the Security tab, and Edit the permissions, allowing the appropriate account to modify the folder.<BR>If you are using IIS, it will be 'IIS_IUSRS'.<BR><BR>Note: It may take a few minutes for the changes to take effect.";
    } else {
        if (!is__writeable("config/config_database.php")) {
            $error .= "ERROR: The config file /config/config_database.php is not writeable.<BR>";
        }
        if (!is__writeable("config/config_settings.php")) {
            $error .= "ERROR: The config file /config/config_settings.php is not writeable.<BR>";
        }
    }
    $php_config_timezone = ini_get('date.timezone');
    if (empty($php_config_timezone)) {
        $error .= "ERROR: Your timezone has not been configured in your PHP.ini file<BR>(Yours is located in " . $_SERVER['PHPRC'] . ")<BR><BR>List of <a href='http://us2.php.net/manual/en/timezones.php'>supported timezones</a>.<BR>";
    }
    return $error;
}
define('WARN_DOWNLOAD_DIRECTORY_NOT_READABLE', 'true');
/**
 * should a message be displayed if system detects version problem with the database
 */
define('WARN_DATABASE_VERSION_PROBLEM', 'true');
// check if the installer directory exists, and warn of its existence
if (WARN_INSTALL_EXISTENCE == 'true') {
    $check_path = realpath(dirname(basename($PHP_SELF)) . '/zc_install');
    if (is_dir($check_path)) {
        $messageStack->add('header', sprintf(WARNING_INSTALL_DIRECTORY_EXISTS, $check_path == '' ? '..../zc_install' : $check_path), 'warning');
    }
}
// check if the configure.php file is writeable
if (WARN_CONFIG_WRITEABLE == 'true') {
    $check_path = realpath(dirname(basename($PHP_SELF)) . '/includes/configure.php');
    if (file_exists($check_path) && is__writeable($check_path)) {
        $messageStack->add('header', sprintf(WARNING_CONFIG_FILE_WRITEABLE, $check_path == '' ? '..../includes/configure.php' : $check_path), 'warning');
    }
}
// check if the session folder is writeable
if (WARN_SESSION_DIRECTORY_NOT_WRITEABLE == 'true') {
    if (STORE_SESSIONS == '') {
        if (!is_dir(zen_session_save_path())) {
            $messageStack->add('header', WARNING_SESSION_DIRECTORY_NON_EXISTENT, 'warning');
        } elseif (!is_writeable(zen_session_save_path())) {
            $messageStack->add('header', WARNING_SESSION_DIRECTORY_NOT_WRITEABLE, 'warning');
        }
    }
}
// check if the sql cache folder is writeable
if (WARN_SQL_CACHE_DIRECTORY_NOT_WRITEABLE == 'true' && strtolower(SQL_CACHE_METHOD) == 'file') {
Exemple #3
0
         $writable_dir_cache_value = $wrm_install_lang['no'];
     }
     if ($phpversion < 401) {
         $phpversion_bgcolor = "red";
     } else {
         $phpversion_bgcolor = "green";
     }
     $gd = get_mysql_version_from_phpinfo();
     if ($gd < "4.1.0") {
         $mysqlversion_bgcolor = "red";
     } else {
         $mysqlversion_bgcolor = "green";
     }
     // NOTE: BE CAREFUL WITH IS__WRITEABLE, that is NOT the built in is_writeable function. (See Double Underscore)
     if (is_file($wrm_config_file)) {
         if (!is__writeable($wrm_config_file)) {
             $writeable_config_bgcolor = "red";
             $writeable_config_value = $wrm_install_lang['no'];
         } else {
             $writeable_config_bgcolor = "green";
             $writeable_config_value = $wrm_install_lang['yes'];
         }
     } else {
         $writeable_config_bgcolor = "green";
         $writeable_config_value = $wrm_install_lang['yes'];
     }
     include_once "includes/page_header.php";
     $smarty->assign(array("form_action" => $filename_install . "step=2", "headtitle" => $wrm_install_lang['headtitle'], "property" => $wrm_install_lang['step0_property'], "required" => $wrm_install_lang['step0_required'], "exist" => $wrm_install_lang['step0_exist'], "system_requirements" => $wrm_install_lang['step0_system_requirements'], "phpversion_text" => $wrm_install_lang['step0_phpversion_text'], "phpversion_value" => phpversion(), "phpversion_bgcolor" => $phpversion_bgcolor, "mysqlversion_text" => $wrm_install_lang['step0_mysqlversion'], "mysqlversion_value" => $gd, "mysqlversion_bgcolor" => $mysqlversion_bgcolor, "nonactive" => $wrm_install_lang['step0_nonactive'], "writeable_config_text" => $wrm_install_lang['step0_writeable_config'], "writeable_config_value" => $writeable_config_value, "yes" => $wrm_install_lang['yes'], "writeable_config_bgcolor" => $writeable_config_bgcolor, "writable_dir_cache_text" => $wrm_install_lang['writable_dir_cache_text'], "writable_dir_cache_bgcolor" => $writable_dir_cache_bgcolor, "writable_dir_cache_value" => $writable_dir_cache_value, "php_variables_text" => $wrm_install_lang['php_variables'], "SERVER_SERVER_SOFTWARE_text" => '_SERVER["SERVER_SOFTWARE"]', "SERVER_SERVER_SOFTWARE_value" => $_SERVER["SERVER_SOFTWARE"], "SERVER_DOCUMENT_ROOT_text" => '_SERVER["DOCUMENT_ROOT"]', "SERVER_DOCUMENT_ROOT_value" => $_SERVER["DOCUMENT_ROOT"], "SERVER_SERVER_NAME_text" => '_SERVER["SERVER_NAME"]', "SERVER_SERVER_NAME_value" => $_SERVER["SERVER_NAME"], "SERVER_HTTP_ACCEPT_CHARSET_text" => '_SERVER["HTTP_ACCEPT_CHARSET"]', "SERVER_HTTP_ACCEPT_CHARSET_value" => $_SERVER["HTTP_ACCEPT_CHARSET"], "classlang_type_values" => $files, "classlang_type_selected" => $lang, "select_lang" => $wrm_install_lang['select_lang'], "bd_submit" => $wrm_install_lang['bd_submit']));
     $smarty->display("step1.tpl.html");
     include_once "includes/page_footer.php";
 } else {
if (is__writeable("config/config_database.php")) {
    ?>
          <span class="success">OK</span>
          <?php 
} else {
    ?>
          <span class="error">FAIL</span>
          <?php 
}
?>
</td>
      </tr>
      <tr>
        <th scope="row">Writeable /config/config_settings.php</th>
        <td><?php 
if (is__writeable("config/config_settings.php")) {
    ?>
          <span class="success">OK</span>
          <?php 
} else {
    ?>
          <span class="error">FAIL</span>
          <?php 
}
?>
</td>
      </tr>
      <tr>
        <th scope="row">&nbsp;</th>
        <td>&nbsp;</td>
      </tr>
function is__writeable($path)
{
    clearstatcache(true, $path);
    if ($path[strlen($path) - 1] == '/') {
        return is__writeable($path . uniqid(mt_rand()) . '.tmp');
    }
    if (file_exists($path)) {
        if (!($f = @fopen($path, 'r+'))) {
            return false;
        }
        fclose($f);
        return true;
    }
    if (!($f = @fopen($path, 'w'))) {
        return false;
    }
    fclose($f);
    unlink($path);
    return true;
}