示例#1
0
 * @link http://www.subrion.org/
 *
 ******************************************************************************/
define('IA_VER', '402');
$iaOutput->layout()->title = 'Installation Wizard';
$iaOutput->steps = array('check' => 'Pre-Installation Check', 'license' => 'Subrion License', 'configuration' => 'Configuration', 'finish' => 'Script Installation', 'plugins' => 'Plugins Installation');
$error = false;
$message = '';
$builtinPlugins = array('kcaptcha', 'fancybox', 'personal_blog', 'elfinder');
switch ($step) {
    case 'check':
        $checks = array('server' => array());
        $sections = array('server' => array('title' => 'Server Configuration', 'desc' => 'If any of these items are highlighted in red then please take actions to correct them. Failure to do so could lead to your installation not functioning correctly.'), 'recommended' => array('title' => 'Recommended Settings', 'desc' => 'These settings are recommended for PHP in order to ensure full compatibility with Subrion CMS. However, Subrion CMS will still operate if your settings do not quite match the recommended.'), 'directory' => array('title' => 'Directory & File Permissions', 'desc' => 'In order for Subrion CMS to function correctly it needs to be able to access or write to certain files or directories. If you see "Unwritable" you need to change the permissions on the file or directory to allow Subrion CMS to write to it.'));
        $checks['server']['mysql_version'] = array('required' => function_exists('mysqli_connect'), 'class' => true, 'name' => 'Mysql version', 'value' => function_exists('mysqli_connect') ? '<td class="success">' . substr(mysqli_get_client_info(), 0, false === ($pos = strpos(mysqli_get_client_info(), '-')) ? 10 : $pos) . '</td>' : '<td class="danger">MySQL 5.x or upper required</td>');
        $checks['server']['php_version'] = array('required' => version_compare('5.0', PHP_VERSION, '<'), 'class' => true, 'name' => 'PHP version', 'value' => version_compare('5.0', PHP_VERSION, '<') ? '<td class="success">' . PHP_VERSION . '</td>' : '<td class="danger">PHP version is not compatible. PHP 5.x needed. (Current version ' . PHP_VERSION . ')</td>');
        $checks['server']['remote'] = array('name' => 'Remote files access support', 'value' => iaHelper::hasAccessToRemote() ? '<td class="success">Available</td>' : '<td class="danger">Unavailable (highly recommended to enable "CURL" extension or "allow_url_fopen")</td>');
        $checks['server']['xml'] = array('name' => 'XML support', 'value' => extension_loaded('xml') ? '<td class="success">Available</td>' : '<td class="danger">Unavailable (recommended)</td>');
        $checks['server']['mysql_support'] = array('name' => 'MySQL support (MySQLi)', 'value' => function_exists('mysqli_connect') ? '<td class="success">Available</td>' : '<td class="danger">Unavailable (required)</td>');
        $checks['server']['gd'] = array('name' => 'GD extension', 'value' => extension_loaded('gd') ? '<td class="success">Available</td>' : '<td class="danger">Unavailable (highly recommended)</td>');
        $checks['server']['mbstring'] = array('name' => 'Mbstring extension', 'value' => extension_loaded('mbstring') ? '<td class="success">Available</td>' : '<td class="danger">Unavailable (not required) </td>');
        $recommendedSettings = array(array('File Uploads', 'file_uploads', 'ON'), array('Magic Quotes GPC', 'magic_quotes_gpc', 'OFF'), array('Register Globals', 'register_globals', 'OFF'));
        foreach ($recommendedSettings as $item) {
            $checks['recommended'][$item[1]] = array('name' => $item[0] . ':</td><td>' . $item[2] . '', 'value' => (iaHelper::getIniSetting($item[1]) == $item[2] ? '<td class="success">' : '<td class="danger">') . iaHelper::getIniSetting($item[1]) . '</td>');
        }
        $directory = array(array('tmp' . IA_DS, '', true), array('uploads' . IA_DS, '', true), array('backup' . IA_DS, ' (optional)', false), array('plugins' . IA_DS, ' (optional)', false), array('includes' . IA_DS . 'config.inc.php', ' (optional)', false));
        foreach ($directory as $item) {
            $text = '';
            $isWritable = false;
            if (file_exists(IA_HOME . $item[0])) {
                $text = is_writable(IA_HOME . $item[0]) ? '<td class="success">Writable</td>' : '<td class="' . (empty($item[1]) ? 'danger' : 'optional') . '">Unwritable ' . $item[1] . '</td>';
                $isWritable = is_writable(IA_HOME . $item[0]);
示例#2
0
    $step = 'check';
    return false;
}
switch ($step) {
    case 'check':
        $patchVersion = trim($_SERVER['REQUEST_URI'], '/');
        $patchVersion = explode('/', $patchVersion);
        $patchVersion = end($patchVersion);
        if (!preg_match('#\\d{1}\\.\\d{1}\\.\\d{1}#', $patchVersion)) {
            if (!isset($_SESSION['upgrade_to']) && empty($_SESSION['upgrade_to'])) {
                $iaOutput->errorCode = 'version';
            }
        } else {
            $_SESSION['upgrade_to'] = $patchVersion;
        }
        if (!iaHelper::hasAccessToRemote()) {
            $iaOutput->errorCode = 'remote';
        }
        if (isset($_SESSION['upgrade_to'])) {
            $iaOutput->version = $_SESSION['upgrade_to'];
        }
        break;
    case 'download':
        $patchUrl = 'http://tools.subrion.org/get/patch/%s/%s/';
        $patchUrl = sprintf($patchUrl, IA_VERSION, $_SESSION['upgrade_to']);
        $patchFileContent = iaHelper::getRemoteContent($patchUrl);
        if ($patchFileContent !== false) {
            $file = fopen(IA_HOME . 'tmp' . IA_DS . 'patch.iap', 'wb');
            fwrite($file, $patchFileContent);
            fclose($file);
            $iaOutput->size = strlen($patchFileContent);