move some stuff from index.php to core/util, to make alternative bootstrappers easier (eg, cli)

git-svn-id: file:///home/shish/svn/shimmie2/trunk@887 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2008-06-08 15:04:57 +00:00
parent 2cbc4669ff
commit f0f9ee8b61
2 changed files with 31 additions and 21 deletions

View file

@ -117,6 +117,17 @@ function make_link($page=null, $query=null) {
* Misc *
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
function version_check() {
if(version_compare(PHP_VERSION, "5.0.0") == -1) {
print <<<EOD
Currently Shimmie 2 doesn't support versions of PHP lower than 5.0.0. Please
either upgrade your PHP, or tell Shish that PHP 4 support is a big deal for
you...
EOD;
exit;
}
}
function get_thumbnail_size($orig_width, $orig_height) {
global $config;
@ -418,6 +429,23 @@ function full_copy($source, $target) {
}
}
function stripslashes_r($arr) {
return is_array($arr) ? array_map('stripslashes_r', $arr) : stripslashes($arr);
}
function sanitise_environment() {
if(DEBUG) {
error_reporting(E_ALL);
assert_options(ASSERT_ACTIVE, 1);
assert_options(ASSERT_BAIL, 1);
}
if(get_magic_quotes_gpc()) {
$_GET = stripslashes_r($_GET);
$_POST = stripslashes_r($_POST);
$_COOKIE = stripslashes_r($_COOKIE);
}
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
* Event API *

View file

@ -3,29 +3,11 @@
define("DEBUG", true);
define("VERSION", 'trunk');
if(DEBUG) {
error_reporting(E_ALL);
assert_options(ASSERT_ACTIVE, 1);
assert_options(ASSERT_BAIL, 1);
}
require_once "core/util.inc.php";
if(version_compare(PHP_VERSION, "5.0.0") == -1) {
print <<<EOD
Currently Shimmie 2 doesn't support versions of PHP lower than 5.0.0. Please
either upgrade your PHP, or tell Shish that PHP 4 support is a big deal for
you...
EOD;
exit;
}
version_check();
sanitise_environment();
function stripslashes_r($arr) {
return is_array($arr) ? array_map('stripslashes_r', $arr) : stripslashes($arr);
}
if(get_magic_quotes_gpc()) {
$_GET = stripslashes_r($_GET);
$_POST = stripslashes_r($_POST);
$_COOKIE = stripslashes_r($_COOKIE);
}
// load base files