global management
This commit is contained in:
parent
c6cf4fa339
commit
e2b6f2c2dd
5 changed files with 18 additions and 12 deletions
|
@ -4,6 +4,8 @@
|
||||||
* actually do anything as far as the app is concerned
|
* 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/sys_config.inc.php";
|
||||||
require_once "core/util.inc.php";
|
require_once "core/util.inc.php";
|
||||||
require_once "lib/context.php";
|
require_once "lib/context.php";
|
||||||
|
@ -23,6 +25,8 @@ foreach($files as $filename) {
|
||||||
require_once $filename;
|
require_once $filename;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
unset($files);
|
||||||
|
unset($filename);
|
||||||
ctx_log_endok();
|
ctx_log_endok();
|
||||||
|
|
||||||
// connect to the database
|
// connect to the database
|
||||||
|
@ -36,6 +40,7 @@ ctx_log_start("Loading themelets");
|
||||||
foreach(_get_themelet_files(get_theme()) as $themelet) {
|
foreach(_get_themelet_files(get_theme()) as $themelet) {
|
||||||
require_once $themelet;
|
require_once $themelet;
|
||||||
}
|
}
|
||||||
|
unset($themelet);
|
||||||
$page = class_exists("CustomPage") ? new CustomPage() : new Page();
|
$page = class_exists("CustomPage") ? new CustomPage() : new Page();
|
||||||
ctx_log_endok();
|
ctx_log_endok();
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
* Classes *
|
* Classes *
|
||||||
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
$tag_n = 0; // temp hack
|
|
||||||
$_flexihash = null;
|
$_flexihash = null;
|
||||||
$_fh_last_opts = null;
|
$_fh_last_opts = null;
|
||||||
$order_sql = null; // this feels ugly
|
$order_sql = null; // this feels ugly
|
||||||
|
@ -40,6 +39,8 @@ require_once "lib/flexihash.php";
|
||||||
* other supported upload type.
|
* other supported upload type.
|
||||||
*/
|
*/
|
||||||
class Image {
|
class Image {
|
||||||
|
private static $tag_n = 0; // temp hack
|
||||||
|
|
||||||
/** @var null|int */
|
/** @var null|int */
|
||||||
public $id = null;
|
public $id = null;
|
||||||
|
|
||||||
|
@ -967,13 +968,10 @@ class Image {
|
||||||
$sql = "0";
|
$sql = "0";
|
||||||
$terms = array();
|
$terms = array();
|
||||||
foreach($tag_querylets as $tq) {
|
foreach($tag_querylets as $tq) {
|
||||||
global $tag_n;
|
|
||||||
$sign = $tq->positive ? "+" : "-";
|
$sign = $tq->positive ? "+" : "-";
|
||||||
//$sql .= " $sign (tag LIKE :tag$tag_n)";
|
$sql .= ' '.$sign.' (tag LIKE :tag'.Image::$tag_n.')';
|
||||||
$sql .= ' '.$sign.' (tag LIKE :tag'.$tag_n.')';
|
$terms['tag'.Image::$tag_n] = $tq->tag;
|
||||||
//$terms["tag$tag_n"] = $tq->tag;
|
Image::$tag_n++;
|
||||||
$terms['tag'.$tag_n] = $tq->tag;
|
|
||||||
$tag_n++;
|
|
||||||
|
|
||||||
if($sign === "+") $positive_tag_count++;
|
if($sign === "+") $positive_tag_count++;
|
||||||
else $negative_tag_count++;
|
else $negative_tag_count++;
|
||||||
|
@ -1084,7 +1082,7 @@ class Image {
|
||||||
WHERE 1=0
|
WHERE 1=0
|
||||||
");
|
");
|
||||||
}
|
}
|
||||||
$tag_n = 0;
|
Image::$tag_n = 0;
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @global UserClass[] $_user_classes
|
* @global UserClass[] $_user_classes
|
||||||
*/
|
*/
|
||||||
|
global $_user_classes;
|
||||||
$_user_classes = array();
|
$_user_classes = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1052,7 +1052,6 @@ function findHeader ($headers, $name) {
|
||||||
return $header;
|
return $header;
|
||||||
}
|
}
|
||||||
|
|
||||||
$_included = array();
|
|
||||||
/**
|
/**
|
||||||
* Get the active contents of a .php file
|
* Get the active contents of a .php file
|
||||||
*
|
*
|
||||||
|
@ -1060,13 +1059,13 @@ $_included = array();
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
function manual_include($fname) {
|
function manual_include($fname) {
|
||||||
global $_included;
|
static $included = array();
|
||||||
|
|
||||||
if(!file_exists($fname)) return null;
|
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";
|
print "$fname\n";
|
||||||
|
|
||||||
|
@ -1380,6 +1379,7 @@ function path_to_tags($path) {
|
||||||
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
/** @private */
|
/** @private */
|
||||||
|
global $_event_listeners;
|
||||||
$_event_listeners = array();
|
$_event_listeners = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1401,6 +1401,7 @@ function add_event_listener(Extension $extension, $pos=50, $events=array()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @private */
|
/** @private */
|
||||||
|
global $_event_count;
|
||||||
$_event_count = 0;
|
$_event_count = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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])));
|
print(file_get_contents(warehouse_path($matches[1], $matches[2])));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
unset($matches);
|
||||||
|
|
||||||
// use the default handler (serve static files, interpret php files)
|
// use the default handler (serve static files, interpret php files)
|
||||||
if(preg_match('/\.(?:png|jpg|jpeg|gif|css|js|php)(\?.*)?$/', $_SERVER["REQUEST_URI"])) {
|
if(preg_match('/\.(?:png|jpg|jpeg|gif|css|js|php)(\?.*)?$/', $_SERVER["REQUEST_URI"])) {
|
||||||
|
|
Reference in a new issue