diff --git a/core/_bootstrap.inc.php b/core/_bootstrap.inc.php index 5659665c..4ee5fda6 100644 --- a/core/_bootstrap.inc.php +++ b/core/_bootstrap.inc.php @@ -4,6 +4,8 @@ * actually do anything as far as the app is concerned */ +global $config, $database, $user, $page; + require_once "core/sys_config.inc.php"; require_once "core/util.inc.php"; require_once "lib/context.php"; @@ -23,6 +25,8 @@ foreach($files as $filename) { require_once $filename; } } +unset($files); +unset($filename); ctx_log_endok(); // connect to the database @@ -36,6 +40,7 @@ ctx_log_start("Loading themelets"); foreach(_get_themelet_files(get_theme()) as $themelet) { require_once $themelet; } +unset($themelet); $page = class_exists("CustomPage") ? new CustomPage() : new Page(); ctx_log_endok(); diff --git a/core/imageboard.pack.php b/core/imageboard.pack.php index a88461bb..f4153f9a 100644 --- a/core/imageboard.pack.php +++ b/core/imageboard.pack.php @@ -23,7 +23,6 @@ * Classes * \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -$tag_n = 0; // temp hack $_flexihash = null; $_fh_last_opts = null; $order_sql = null; // this feels ugly @@ -40,6 +39,8 @@ require_once "lib/flexihash.php"; * other supported upload type. */ class Image { + private static $tag_n = 0; // temp hack + /** @var null|int */ public $id = null; @@ -967,13 +968,10 @@ class Image { $sql = "0"; $terms = array(); foreach($tag_querylets as $tq) { - global $tag_n; $sign = $tq->positive ? "+" : "-"; - //$sql .= " $sign (tag LIKE :tag$tag_n)"; - $sql .= ' '.$sign.' (tag LIKE :tag'.$tag_n.')'; - //$terms["tag$tag_n"] = $tq->tag; - $terms['tag'.$tag_n] = $tq->tag; - $tag_n++; + $sql .= ' '.$sign.' (tag LIKE :tag'.Image::$tag_n.')'; + $terms['tag'.Image::$tag_n] = $tq->tag; + Image::$tag_n++; if($sign === "+") $positive_tag_count++; else $negative_tag_count++; @@ -1084,7 +1082,7 @@ class Image { WHERE 1=0 "); } - $tag_n = 0; + Image::$tag_n = 0; return $query; } } diff --git a/core/userclass.class.php b/core/userclass.class.php index 45ddb1fe..68d2c097 100644 --- a/core/userclass.class.php +++ b/core/userclass.class.php @@ -2,6 +2,7 @@ /** * @global UserClass[] $_user_classes */ +global $_user_classes; $_user_classes = array(); /** diff --git a/core/util.inc.php b/core/util.inc.php index ac2ef5a5..e9a7bf5b 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -1052,7 +1052,6 @@ function findHeader ($headers, $name) { return $header; } -$_included = array(); /** * Get the active contents of a .php file * @@ -1060,13 +1059,13 @@ $_included = array(); * @return string|null */ function manual_include($fname) { - global $_included; + static $included = array(); if(!file_exists($fname)) return null; - if(in_array($fname, $_included)) return null; + if(in_array($fname, $included)) return null; - $_included[] = $fname; + $included[] = $fname; print "$fname\n"; @@ -1380,6 +1379,7 @@ function path_to_tags($path) { \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /** @private */ +global $_event_listeners; $_event_listeners = array(); /** @@ -1401,6 +1401,7 @@ function add_event_listener(Extension $extension, $pos=50, $events=array()) { } /** @private */ +global $_event_count; $_event_count = 0; /** diff --git a/tests/router.php b/tests/router.php index e42dfaa5..6c00377b 100644 --- a/tests/router.php +++ b/tests/router.php @@ -9,6 +9,7 @@ if(preg_match('/\/_(images|thumbs)\/([0-9a-f]{32}).*$/', $_SERVER["REQUEST_URI"] print(file_get_contents(warehouse_path($matches[1], $matches[2]))); return true; } +unset($matches); // use the default handler (serve static files, interpret php files) if(preg_match('/\.(?:png|jpg|jpeg|gif|css|js|php)(\?.*)?$/', $_SERVER["REQUEST_URI"])) {