private static function rewrite($settings) { if (mod_rewrite() or is_apache() and $settings['metadata']['rewrite']) { $htaccess = Braces::compile(APP . 'storage/htaccess.distro', array('base' => $settings['metadata']['site_path'], 'index' => is_cgi() ? 'index.php?/$1' : 'index.php/$1')); if (isset($htaccess) and is_writable($filepath = PATH . '.htaccess')) { file_put_contents($filepath, $htaccess); } else { Session::put('htaccess', $htaccess); } } }
if ($maj == 5 && $min >= 3) { return true; } elseif ($maj > 5) { return true; } else { return false; } } if (isset($_POST['calibre_dir'])) { $calibre_dir = $_POST['calibre_dir']; $cd = check_calibre($calibre_dir); } else { $calibre_dir = null; $cd = null; } $srv = $_SERVER['SERVER_SOFTWARE']; $is_a = is_apache($srv); if ($is_a) { $mre = mod_rewrite_enabled(); } else { $mre = false; } $gdv = get_gd_version(); if ($gdv >= 2) { $gde = true; } else { $gde = false; } $template = $twig->loadTemplate('installcheck.html'); echo $template->render(array('page' => array('rot' => '', 'version' => '1.3.3'), 'is_a' => $is_a, 'srv' => $srv, 'mre' => $mre, 'calibre_dir' => $calibre_dir, 'cd' => $cd, 'htaccess' => file_exists('./.htaccess'), 'hsql' => has_sqlite(), 'hgd2' => $gde, 'hgd2v' => $gdv, 'dwrit' => fw('./data'), 'intl' => extension_loaded('intl'), 'mcrypt' => extension_loaded('mcrypt'), 'mwrit' => fw('./data/data.db'), 'opd' => ini_get('open_basedir'), 'php' => check_php(), 'phpv' => phpversion())); #echo phpinfo();
function mod_rewrite() { if (is_apache() and function_exists('apache_get_modules')) { return in_array('mod_rewrite', apache_get_modules()); } return getenv('HTTP_MOD_REWRITE') ? true : false; }
} ?> <div class="form-group"> <div class="row"> <label class="col-xs-4 control-label" style="padding-top:4px">Clean URL's</label> <div class="col-xs-8"> <?php if (mod_rewrite()) { ?> <p>Looks like you are running apache with <code>mod_rewrite</code> enabled.<br> The installer will create the .htaccess for you.</p> <?php } elseif (is_apache()) { ?> <p>Looks like you are running apache, but <code>mod_rewrite</code> is not enabled.</p> <p><input id="rewrite" name="rewrite" type="checkbox" value="1"> Create the .htaccess file for me anyway.</p> <?php } elseif (is_cgi()) { ?> <p>Looks like you are running <code>PHP</code> as a fastcgi process.<br> You will have to setup your own url rewriting.</p> <?php