<?php

extension_check(array('curl', 'dom', 'gd', 'hash', 'iconv', 'mcrypt', 'pcre', 'pdo', 'pdo_mysql', 'simplexml'));
function extension_check($extensions)
{
    $fail = '';
    $pass = '';
    if (version_compare(phpversion(), '5.2.0', '<')) {
        $fail .= '<li>You need<strong> PHP 5.2.0</strong> (or greater)</li>';
    } else {
        $pass .= '<li>You have<strong> PHP 5.2.0</strong> (or greater)</li>';
    }
    if (!ini_get('safe_mode')) {
        $pass .= '<li>Safe Mode is <strong>off</strong></li>';
        preg_match('/[0-9]\\.[0-9]+\\.[0-9]+/', shell_exec('mysql -V'), $version);
        if (version_compare($version[0], '4.1.20', '<')) {
            $fail .= '<li>You need<strong> MySQL 4.1.20</strong> (or greater)</li>';
        } else {
            $pass .= '<li>You have<strong> MySQL 4.1.20</strong> (or greater)</li>';
        }
    } else {
        $fail .= '<li>Safe Mode is <strong>on</strong></li>';
    }
    foreach ($extensions as $extension) {
        if (!extension_loaded($extension)) {
            $fail .= '<li> You are missing the <strong>' . $extension . '</strong> extension</li>';
        } else {
            $pass .= '<li>You have the <strong>' . $extension . '</strong> extension</li>';
        }
    }
    if ($fail) {
Exemple #2
0
    print "<p class=\"center\">You need PHP 5.2.0 or later!</p>\n";
    HTMLFooter();
    die;
}
if (!db_check($supported_databases)) {
    print '<p class="center">No supported database detected! Please install one of the following' . ' database systems and enable the corresponding PHP extension:</p>';
    print '<ul>';
    foreach ($supported_databases as $database) {
        printf('    <li>%s</li>', $database[1]);
    }
    print '</ul>';
    HTMLFooter();
    die;
}
$missing = array();
if (!extension_check($enabled_extensions, $missing)) {
    print "<p class=\"center\">The following extensions are missing! Please enable the PHP extension:</p>\n";
    print "<ul>\n";
    foreach ($missing as $extension) {
        printf('    <li>ext/%s</li>', $extension);
    }
    print "</ul>\n";
    HTMLFooter();
    die;
}
if (!phpmyfaq_check()) {
    print '<p class="center">It seems you\'re already running a version of phpMyFAQ.<br />Please use the <a href="update.php">update script</a>.</p>';
    HTMLFooter();
    die;
}
$dirs = array('/attachments', '/config', '/data', '/pdf', '/xml');