phpstorm tidying
This commit is contained in:
parent
6c304420a6
commit
35a4f385b3
66 changed files with 82 additions and 98 deletions
|
@ -83,6 +83,7 @@ class BaseThemelet {
|
|||
* @param string $query
|
||||
* @param int $page_number
|
||||
* @param int $total_pages
|
||||
* @param bool $show_random
|
||||
*/
|
||||
public function display_paginator(Page $page, $base, $query, $page_number, $total_pages, $show_random = FALSE) {
|
||||
if($total_pages == 0) $total_pages = 1;
|
||||
|
@ -127,6 +128,7 @@ class BaseThemelet {
|
|||
* @param int $total_pages
|
||||
* @param string $base_url
|
||||
* @param string $query
|
||||
* @param bool $show_random
|
||||
* @return string
|
||||
*/
|
||||
private function build_paginator($current_page, $total_pages, $base_url, $query, $show_random) {
|
||||
|
|
|
@ -561,6 +561,7 @@ class Image {
|
|||
* Set the tags for this image.
|
||||
*
|
||||
* @param string[] $tags
|
||||
* @throws Exception
|
||||
*/
|
||||
public function set_tags($tags) {
|
||||
assert('is_array($tags) && count($tags) > 0', var_export($tags, true));
|
||||
|
@ -918,6 +919,8 @@ class Image {
|
|||
/**
|
||||
* this function exists because mysql is a turd, see the docs for
|
||||
* build_accurate_search_querylet() for a full explanation
|
||||
*
|
||||
* @param array $terms
|
||||
*/
|
||||
private static function build_ugly_search_querylet($terms) {
|
||||
global $database;
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
* define("SPEED_HAX", true);
|
||||
*
|
||||
*/
|
||||
|
||||
/** @private */
|
||||
function _d($name, $value) {if(!defined($name)) define($name, $value);}
|
||||
_d("DATABASE_DSN", null); // string PDO database connection details
|
||||
_d("DATABASE_KA", true); // string Keep database connection alive
|
||||
|
|
|
@ -204,6 +204,7 @@ class User {
|
|||
|
||||
/**
|
||||
* @param string $name
|
||||
* @throws Exception
|
||||
*/
|
||||
public function set_name(/*string*/ $name) {
|
||||
global $database;
|
||||
|
|
|
@ -51,8 +51,6 @@ class UserClass {
|
|||
* @throws SCoreException
|
||||
*/
|
||||
public function can(/*string*/ $ability) {
|
||||
global $config;
|
||||
|
||||
if(array_key_exists($ability, $this->abilities)) {
|
||||
$val = $this->abilities[$ability];
|
||||
return $val;
|
||||
|
|
|
@ -629,7 +629,6 @@ function is_https_enabled() {
|
|||
* from the "Amazon S3 PHP class" which is Copyright (c) 2008, Donovan Schönknecht
|
||||
* and released under the 'Simplified BSD License'.
|
||||
*
|
||||
* @internal Used to get mime types
|
||||
* @param string &$file File path
|
||||
* @param string $ext
|
||||
* @param bool $list
|
||||
|
@ -1180,6 +1179,8 @@ function ip_in_range($IP, $CIDR) {
|
|||
*
|
||||
* from a patch by Christian Walde; only intended for use in the
|
||||
* "extension manager" extension, but it seems to fit better here
|
||||
*
|
||||
* @param string $f
|
||||
*/
|
||||
function deltree($f) {
|
||||
//Because Windows (I know, bad excuse)
|
||||
|
@ -1223,6 +1224,9 @@ function deltree($f) {
|
|||
* Copy an entire file hierarchy
|
||||
*
|
||||
* from a comment on http://uk.php.net/copy
|
||||
*
|
||||
* @param string $source
|
||||
* @param string $target
|
||||
*/
|
||||
function full_copy($source, $target) {
|
||||
if(is_dir($source)) {
|
||||
|
|
|
@ -119,7 +119,7 @@ class AdminPage extends Extension {
|
|||
}
|
||||
|
||||
private function delete_by_query() {
|
||||
global $page, $user;
|
||||
global $page;
|
||||
$query = $_POST['query'];
|
||||
$reason = @$_POST['reason'];
|
||||
assert(strlen($query) > 1);
|
||||
|
|
|
@ -20,7 +20,7 @@ class AdminPageTheme extends Themelet {
|
|||
*/
|
||||
protected function button(/*string*/ $name, /*string*/ $action, /*boolean*/ $protected=false) {
|
||||
$c_protected = $protected ? " protected" : "";
|
||||
$html = make_form(make_link("admin/$action"), "POST", false, null, null, "admin$c_protected");
|
||||
$html = make_form(make_link("admin/$action"), "POST", false, "admin$c_protected");
|
||||
if($protected) {
|
||||
$html .= "<input type='submit' id='$action' value='$name' disabled='disabled'>";
|
||||
$html .= "<input type='checkbox' onclick='$(\"#$action\").attr(\"disabled\", !$(this).is(\":checked\"))'>";
|
||||
|
|
|
@ -67,8 +67,8 @@ class UploadS3 extends Extension {
|
|||
if(!empty($bucket)) {
|
||||
log_debug("amazon_s3", "Deleting Image #".$event->image->id." from S3");
|
||||
$s3 = new S3($access, $secret);
|
||||
$s3->deleteObject($bucket, "images/"+$event->image->hash);
|
||||
$s3->deleteObject($bucket, "thumbs/"+$event->image->hash);
|
||||
$s3->deleteObject($bucket, "images/" . $event->image->hash);
|
||||
$s3->deleteObject($bucket, "thumbs/" . $event->image->hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -673,7 +673,7 @@ class Artists extends Extension {
|
|||
$this->save_existing_member($membersIDsAsArray[$i], $membersAsArray[$i], $userID);
|
||||
else
|
||||
// if we already updated all, save new ones
|
||||
$this->save_new_member($artistID, $membersAsArray[$i], "", $userID);
|
||||
$this->save_new_member($artistID, $membersAsArray[$i], $userID);
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
@ -839,7 +839,7 @@ class Artists extends Extension {
|
|||
$membersArray = explode(" ", $members);
|
||||
foreach ($membersArray as $member)
|
||||
if (!$this->member_exists($artistID, $member))
|
||||
$this->save_new_member($artistID, $member, "", $userID);
|
||||
$this->save_new_member($artistID, $member, $userID);
|
||||
}
|
||||
|
||||
if (strlen($urls))
|
||||
|
@ -1132,7 +1132,6 @@ class Artists extends Extension {
|
|||
return;
|
||||
|
||||
$aliasArray = explode(" ", $aliases);
|
||||
global $database;
|
||||
foreach ($aliasArray as $alias)
|
||||
if (!$this->alias_exists($artistID, $alias))
|
||||
$this->save_new_alias($artistID, $alias, $userID);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
class BlocksTheme extends Themelet {
|
||||
public function display_blocks($blocks) {
|
||||
global $page, $user;
|
||||
global $page;
|
||||
|
||||
$html = "<table class='form' style='width: 100%;'>";
|
||||
foreach($blocks as $block) {
|
||||
|
|
|
@ -44,7 +44,6 @@ class Blotter extends Extension {
|
|||
}
|
||||
|
||||
public function onSetupBuilding(SetupBuildingEvent $event) {
|
||||
global $config;
|
||||
$sb = new SetupBlock("Blotter");
|
||||
$sb->add_int_option("blotter_recent", "<br />Number of recent entries to display: ");
|
||||
$sb->add_text_option("blotter_color", "<br />Color of important updates: (ABCDEF format) ");
|
||||
|
|
|
@ -21,7 +21,7 @@ class BulkAddCSVTheme extends Themelet {
|
|||
* csv file
|
||||
*/
|
||||
public function display_admin_block() {
|
||||
global $page, $user;
|
||||
global $page;
|
||||
$html = "
|
||||
Add images from a csv. Images will be tagged and have their
|
||||
source and rating set (if \"Image Ratings\" is enabled)
|
||||
|
|
|
@ -286,8 +286,6 @@ class CommentList extends Extension {
|
|||
}
|
||||
|
||||
public function onSearchTermParse(SearchTermParseEvent $event) {
|
||||
global $database;
|
||||
|
||||
$matches = array();
|
||||
|
||||
if(preg_match("/^comments([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+)$/i", $event->term, $matches)) {
|
||||
|
@ -447,7 +445,7 @@ class CommentList extends Extension {
|
|||
|
||||
// add / remove / edit comments {{{
|
||||
private function is_comment_limit_hit() {
|
||||
global $user, $config, $database;
|
||||
global $config, $database;
|
||||
|
||||
// sqlite fails at intervals
|
||||
if($database->get_driver_name() === "sqlite") return false;
|
||||
|
@ -562,7 +560,7 @@ class CommentList extends Extension {
|
|||
* @throws CommentPostingException
|
||||
*/
|
||||
private function add_comment_wrapper(/*int*/ $image_id, User $user, /*string*/ $comment) {
|
||||
global $database, $config, $page;
|
||||
global $database, $page;
|
||||
|
||||
if(!$user->can("bypass_comment_checks")) {
|
||||
// will raise an exception if anything is wrong
|
||||
|
|
|
@ -61,7 +61,7 @@ class CronUploader extends Extension {
|
|||
}
|
||||
|
||||
private function display_documentation() {
|
||||
global $config, $page;
|
||||
global $page;
|
||||
$this->set_dir(); // Determines path to cron_uploader_dir
|
||||
|
||||
|
||||
|
@ -151,7 +151,6 @@ class CronUploader extends Extension {
|
|||
}
|
||||
|
||||
public function onSetupBuilding(SetupBuildingEvent $event) {
|
||||
global $config;
|
||||
$this->set_dir();
|
||||
|
||||
$cron_url = make_http(make_link("/cron_upload/" . $this->upload_key));
|
||||
|
@ -344,7 +343,7 @@ class CronUploader extends Extension {
|
|||
|
||||
foreach ( glob ( "$base/$subdir/*" ) as $fullpath ) {
|
||||
$fullpath = str_replace ( "//", "/", $fullpath );
|
||||
$shortpath = str_replace ( $base, "", $fullpath );
|
||||
//$shortpath = str_replace ( $base, "", $fullpath );
|
||||
|
||||
if (is_link ( $fullpath )) {
|
||||
// ignore
|
||||
|
|
|
@ -15,10 +15,8 @@
|
|||
* You can also add your website name as prefix or suffix to the title of each page on your website.
|
||||
*/
|
||||
class custom_html_headers extends Extension {
|
||||
# Adds setup block for custom <head> content
|
||||
# Adds setup block for custom <head> content
|
||||
public function onSetupBuilding(SetupBuildingEvent $event) {
|
||||
global $config;
|
||||
|
||||
$sb = new SetupBlock("Custom HTML Headers");
|
||||
|
||||
// custom headers
|
||||
|
|
|
@ -411,7 +411,6 @@ class DanbooruApi extends Extension {
|
|||
private function authenticate_user()
|
||||
{
|
||||
global $config;
|
||||
global $database;
|
||||
global $user;
|
||||
|
||||
if(isset($_REQUEST['login']) && isset($_REQUEST['password']))
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
class DowntimeTheme extends Themelet {
|
||||
/**
|
||||
* Show the admin that downtime mode is enabled
|
||||
*
|
||||
* @param Page $page
|
||||
*/
|
||||
public function display_notification(Page $page) {
|
||||
$page->add_block(new Block("Downtime",
|
||||
|
@ -11,6 +13,8 @@ class DowntimeTheme extends Themelet {
|
|||
|
||||
/**
|
||||
* Display $message and exit
|
||||
*
|
||||
* @param string $message
|
||||
*/
|
||||
public function display_message(/*string*/ $message) {
|
||||
global $config, $user;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
class ExtManagerTheme extends Themelet {
|
||||
public function display_table(Page $page, /*array*/ $extensions, /*bool*/ $editable) {
|
||||
global $user;
|
||||
$h_en = $editable ? "<th>Enabled</th>" : "";
|
||||
$html = "
|
||||
".make_form(make_link("ext_manager/set"))."
|
||||
|
|
|
@ -133,7 +133,6 @@ class Favorites extends Extension {
|
|||
$event->add_querylet(new Querylet("images.id IN (SELECT id FROM images WHERE favorites $cmp $favorites)"));
|
||||
}
|
||||
else if(preg_match("/^favorited_by[=|:](.*)$/i", $event->term, $matches)) {
|
||||
global $database;
|
||||
$user = User::by_name($matches[1]);
|
||||
if(!is_null($user)) {
|
||||
$user_id = $user->id;
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
class FavoritesTheme extends Themelet {
|
||||
public function get_voter_html(Image $image, $is_favorited) {
|
||||
global $page, $user;
|
||||
|
||||
$i_image_id = int_escape($image->id);
|
||||
$name = $is_favorited ? "unset" : "set";
|
||||
$label = $is_favorited ? "Un-Favorite" : "Favorite";
|
||||
|
|
|
@ -71,7 +71,7 @@ class Forum extends Extension {
|
|||
}
|
||||
|
||||
public function onUserPageBuilding(UserPageBuildingEvent $event) {
|
||||
global $page, $user, $database;
|
||||
global $database;
|
||||
|
||||
$threads_count = $database->get_one("SELECT COUNT(*) FROM forum_threads WHERE user_id=?", array($event->display_user->id));
|
||||
$posts_count = $database->get_one("SELECT COUNT(*) FROM forum_posts WHERE user_id=?", array($event->display_user->id));
|
||||
|
@ -250,7 +250,6 @@ class Forum extends Extension {
|
|||
}
|
||||
private function sanity_check_viewed_thread($threadID)
|
||||
{
|
||||
global $database;
|
||||
$errors = null;
|
||||
if (!$this->threadExists($threadID))
|
||||
{
|
||||
|
@ -298,7 +297,7 @@ class Forum extends Extension {
|
|||
|
||||
private function show_posts($event, $showAdminOptions = false)
|
||||
{
|
||||
global $config, $database, $user;
|
||||
global $config, $database;
|
||||
$threadID = $event->get_arg(1);
|
||||
$pageNumber = $event->get_arg(2);
|
||||
$postsPerPage = $config->get_int('forumPostsPerPage', 15);
|
||||
|
|
|
@ -23,7 +23,6 @@ class SVGFileHandler extends Extension {
|
|||
}
|
||||
|
||||
public function onThumbnailGeneration(ThumbnailGenerationEvent $event) {
|
||||
global $config;
|
||||
if($this->supported_ext($event->type)) {
|
||||
$hash = $event->hash;
|
||||
|
||||
|
@ -39,7 +38,7 @@ class SVGFileHandler extends Extension {
|
|||
}
|
||||
|
||||
public function onPageRequest(PageRequestEvent $event) {
|
||||
global $config, $database, $page;
|
||||
global $page;
|
||||
if($event->page_matches("get_svg")) {
|
||||
$id = int_escape($event->get_arg(0));
|
||||
$image = Image::by_id($id);
|
||||
|
@ -66,8 +65,6 @@ class SVGFileHandler extends Extension {
|
|||
* @return Image
|
||||
*/
|
||||
private function create_image_from_data($filename, $metadata) {
|
||||
global $config;
|
||||
|
||||
$image = new Image();
|
||||
|
||||
$msp = new MiniSVGParser($filename);
|
||||
|
|
|
@ -13,7 +13,6 @@ class Holiday extends Extension {
|
|||
}
|
||||
|
||||
public function onSetupBuilding(SetupBuildingEvent $event) {
|
||||
global $config;
|
||||
$sb = new SetupBlock("Holiday Theme");
|
||||
$sb->add_bool_option("holiday_aprilfools", "Enable April Fools");
|
||||
$event->panel->add_block($sb);
|
||||
|
|
|
@ -46,7 +46,6 @@ class Home extends Extension {
|
|||
|
||||
private function get_body() {
|
||||
// returns just the contents of the body
|
||||
global $database;
|
||||
global $config;
|
||||
$base_href = get_base_href();
|
||||
$sitename = $config->get_string('title');
|
||||
|
|
|
@ -217,7 +217,7 @@ class ImageIO extends Extension {
|
|||
}
|
||||
|
||||
public function onImageAdminBlockBuilding(ImageAdminBlockBuildingEvent $event) {
|
||||
global $user, $config;
|
||||
global $user;
|
||||
|
||||
if($user->can("delete_image")) {
|
||||
$event->add_part($this->theme->get_deleter_html($event->image->id));
|
||||
|
@ -310,7 +310,7 @@ class ImageIO extends Extension {
|
|||
* @throws ImageAdditionException
|
||||
*/
|
||||
private function add_image(Image $image) {
|
||||
global $page, $user, $database, $config;
|
||||
global $user, $database, $config;
|
||||
|
||||
/*
|
||||
* Validate things
|
||||
|
|
|
@ -8,8 +8,6 @@ class ImageIOTheme extends Themelet {
|
|||
* @return string
|
||||
*/
|
||||
public function get_deleter_html(/*int*/ $image_id) {
|
||||
global $config;
|
||||
|
||||
$html = "
|
||||
".make_form(make_link("image/delete"))."
|
||||
<input type='hidden' name='image_id' value='$image_id' />
|
||||
|
|
|
@ -53,7 +53,7 @@ class ImageBan extends Extension {
|
|||
}
|
||||
|
||||
public function onPageRequest(PageRequestEvent $event) {
|
||||
global $config, $database, $page, $user;
|
||||
global $database, $page, $user;
|
||||
|
||||
if($event->page_matches("image_hash_ban")) {
|
||||
if($user->can("ban_image")) {
|
||||
|
|
|
@ -235,7 +235,7 @@ class Index extends Extension {
|
|||
}
|
||||
|
||||
public function onPageRequest(PageRequestEvent $event) {
|
||||
global $config, $database, $page, $user;
|
||||
global $database, $page;
|
||||
if($event->page_matches("post/list")) {
|
||||
if(isset($_GET['search'])) {
|
||||
$search = url_escape(Tag::implode(Tag::resolve_aliases(Tag::explode($_GET['search'], false))));
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
$(function() {
|
||||
var blocked_tags = ($.cookie("ui-blocked-tags") || "").split(" ");
|
||||
var needs_refresh = false;
|
||||
for(i=0; i<blocked_tags.length; i++) {
|
||||
for(var i=0; i<blocked_tags.length; i++) {
|
||||
var tag = blocked_tags[i];
|
||||
if(tag) {
|
||||
$(".shm-thumb[data-tags~='"+tag+"']").hide();
|
||||
|
|
|
@ -48,7 +48,7 @@ class IPBan extends Extension {
|
|||
|
||||
public function onPageRequest(PageRequestEvent $event) {
|
||||
if($event->page_matches("ip_ban")) {
|
||||
global $config, $database, $page, $user;
|
||||
global $page, $user;
|
||||
if($user->can("ban_ip")) {
|
||||
if($event->get_arg(0) == "add" && $user->check_auth_token()) {
|
||||
if(isset($_POST['ip']) && isset($_POST['reason']) && isset($_POST['end'])) {
|
||||
|
|
|
@ -53,4 +53,3 @@ class LogLogstash extends Extension {
|
|||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -220,7 +220,6 @@ class Notes extends Extension {
|
|||
$event->add_querylet(new Querylet("images.id IN (SELECT id FROM images WHERE notes $cmp $notes)"));
|
||||
}
|
||||
else if(preg_match("/^notes_by[=|:](.*)$/i", $event->term, $matches)) {
|
||||
global $database;
|
||||
$user = User::by_name($matches[1]);
|
||||
if(!is_null($user)) {
|
||||
$user_id = $user->id;
|
||||
|
@ -323,7 +322,7 @@ class Notes extends Extension {
|
|||
$noteY1 = int_escape($_POST["note_y1"]);
|
||||
$noteHeight = int_escape($_POST["note_height"]);
|
||||
$noteWidth = int_escape($_POST["note_width"]);
|
||||
$noteText = mysql_real_escape_string(html_escape($_POST["note_text"]));
|
||||
$noteText = sql_escape(html_escape($_POST["note_text"]));
|
||||
|
||||
// validate parameters
|
||||
if (is_null($imageID) || !is_numeric($imageID) ||
|
||||
|
|
|
@ -29,14 +29,14 @@ class NumericScore extends Extension {
|
|||
}
|
||||
|
||||
public function onDisplayingImage(DisplayingImageEvent $event) {
|
||||
global $user, $page;
|
||||
global $user;
|
||||
if(!$user->is_anonymous()) {
|
||||
$this->theme->get_voter($event->image);
|
||||
}
|
||||
}
|
||||
|
||||
public function onUserPageBuilding(UserPageBuildingEvent $event) {
|
||||
global $page, $user;
|
||||
global $user;
|
||||
if($user->can("edit_other_vote")) {
|
||||
$this->theme->get_nuller($event->display_user);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ class Oekaki extends Extension {
|
|||
header('Content-type: text/plain');
|
||||
|
||||
$file = $_FILES['picture']['name'];
|
||||
$ext = (strpos($file, '.') === FALSE) ? '' : substr($file, strrpos($file, '.'));
|
||||
//$ext = (strpos($file, '.') === FALSE) ? '' : substr($file, strrpos($file, '.'));
|
||||
$uploadname = $_SERVER['REMOTE_ADDR'] . "." . time();
|
||||
$uploadfile = data_path('oekaki_unclaimed/'.$uploadname);
|
||||
|
||||
|
|
|
@ -399,7 +399,7 @@ class OuroborosAPI extends Extension
|
|||
|
||||
public function onPageRequest(PageRequestEvent $event)
|
||||
{
|
||||
global $database, $page, $config, $user;
|
||||
global $page, $user;
|
||||
|
||||
if (preg_match("%\.(xml|json)$%", implode('/', $event->args), $matches) === 1) {
|
||||
$this->event = $event;
|
||||
|
@ -489,7 +489,7 @@ class OuroborosAPI extends Extension
|
|||
*/
|
||||
protected function postCreate(OuroborosPost $post, $md5 = '')
|
||||
{
|
||||
global $page, $config, $user;
|
||||
global $config;
|
||||
$handler = $config->get_string("upload_collision_handler");
|
||||
if (!empty($md5) && !($handler == 'merge')) {
|
||||
$img = Image::by_hash($md5);
|
||||
|
|
|
@ -61,7 +61,6 @@ class PoolsTheme extends Themelet {
|
|||
* @param int $totalPages
|
||||
*/
|
||||
public function list_pools(Page $page, /*array*/ $pools, /*int*/ $pageNumber, /*int*/ $totalPages) {
|
||||
global $user;
|
||||
$html = '
|
||||
<table id="poolsList" class="zebra">
|
||||
<thead><tr>
|
||||
|
@ -168,7 +167,7 @@ class PoolsTheme extends Themelet {
|
|||
* @param int $totalPages
|
||||
*/
|
||||
public function view_pool(/*array*/ $pools, /*array*/ $images, /*int*/ $pageNumber, /*int*/ $totalPages) {
|
||||
global $user, $page;
|
||||
global $page;
|
||||
|
||||
$this->display_top($pools, "Pool: ".html_escape($pools[0]['title']));
|
||||
|
||||
|
@ -294,8 +293,6 @@ class PoolsTheme extends Themelet {
|
|||
* @param array $images
|
||||
*/
|
||||
public function edit_order(Page $page, /*array*/ $pools, /*array*/ $images) {
|
||||
global $user;
|
||||
|
||||
$this->display_top($pools, "Sorting Pool");
|
||||
|
||||
$pool_images = "\n<form action='".make_link("pool/order")."' method='POST' name='checks'>";
|
||||
|
@ -329,8 +326,6 @@ class PoolsTheme extends Themelet {
|
|||
* @param array $images
|
||||
*/
|
||||
public function edit_pool(Page $page, /*array*/ $pools, /*array*/ $images) {
|
||||
global $user;
|
||||
|
||||
/* EDIT POOL DESCRIPTION */
|
||||
$desc_html = "
|
||||
".make_form(make_link("pool/edit_description"))."
|
||||
|
|
|
@ -25,7 +25,6 @@ class RandomImage extends Extension {
|
|||
global $page;
|
||||
|
||||
if($event->page_matches("random_image")) {
|
||||
$action = '';
|
||||
if($event->count_args() == 1) {
|
||||
$action = $event->get_arg(0);
|
||||
$search_terms = array();
|
||||
|
|
|
@ -108,14 +108,14 @@ class ReportImage extends Extension {
|
|||
}
|
||||
|
||||
public function onUserPageBuilding(UserPageBuildingEvent $event) {
|
||||
global $page, $user;
|
||||
global $user;
|
||||
if($user->can("view_image_report")) {
|
||||
$this->theme->get_nuller($event->display_user);
|
||||
}
|
||||
}
|
||||
|
||||
public function onDisplayingImage(DisplayingImageEvent $event) {
|
||||
global $user, $page;
|
||||
global $user;
|
||||
if($user->can('create_image_report')) {
|
||||
$reps = $this->get_reporters($event->image);
|
||||
$this->theme->display_image_banner($event->image, $reps);
|
||||
|
|
|
@ -164,7 +164,7 @@ class ResizeImage extends Extension {
|
|||
* @throws ImageResizeException
|
||||
*/
|
||||
private function resize_image(Image $image_obj, /*int*/ $width, /*int*/ $height) {
|
||||
global $config, $user, $page, $database;
|
||||
global $database;
|
||||
|
||||
if ( ($height <= 0) && ($width <= 0) ) {
|
||||
throw new ImageResizeException("Invalid options for height and width. ($width x $height)");
|
||||
|
|
|
@ -5,7 +5,7 @@ class ResizeImageTheme extends Themelet {
|
|||
* Display a link to resize an image
|
||||
*/
|
||||
public function get_resize_html(Image $image) {
|
||||
global $user, $config;
|
||||
global $config;
|
||||
|
||||
$default_width = $config->get_int('resize_default_width');
|
||||
$default_height = $config->get_int('resize_default_height');
|
||||
|
|
|
@ -114,7 +114,7 @@ class RotateImage extends Extension {
|
|||
* @throws ImageRotateException
|
||||
*/
|
||||
private function rotate_image(/*int*/ $image_id, /*int*/ $deg) {
|
||||
global $config, $user, $page, $database;
|
||||
global $database;
|
||||
|
||||
if ( ($deg <= -360) || ($deg >= 360) ) {
|
||||
throw new ImageRotateException("Invalid options for rotation angle. ($deg)");
|
||||
|
|
|
@ -279,7 +279,7 @@ class Setup extends Extension {
|
|||
out_span.innerHTML = '(testing...)';
|
||||
|
||||
$(document).ready(function() {
|
||||
http_request = getHTTPObject();
|
||||
var http_request = getHTTPObject();
|
||||
http_request.open('GET', '$test_url', false);
|
||||
http_request.send(null);
|
||||
|
||||
|
|
|
@ -13,8 +13,6 @@ class SetupTheme extends Themelet {
|
|||
* The page should wrap all the options in a form which links to setup_save
|
||||
*/
|
||||
public function display_page(Page $page, SetupPanel $panel) {
|
||||
global $user;
|
||||
|
||||
usort($panel->blocks, "blockcmp");
|
||||
|
||||
/*
|
||||
|
@ -40,8 +38,6 @@ class SetupTheme extends Themelet {
|
|||
}
|
||||
|
||||
public function display_advanced(Page $page, $options) {
|
||||
global $user;
|
||||
|
||||
$h_rows = "";
|
||||
ksort($options);
|
||||
foreach($options as $name => $value) {
|
||||
|
|
|
@ -24,7 +24,7 @@ class Source_History extends Extension {
|
|||
}
|
||||
|
||||
public function onPageRequest(PageRequestEvent $event) {
|
||||
global $config, $page, $user;
|
||||
global $page, $user;
|
||||
|
||||
if($event->page_matches("source_history/revert")) {
|
||||
// this is a request to revert to a previous version of the source
|
||||
|
|
|
@ -19,7 +19,7 @@ class StatsDInterface extends Extension {
|
|||
public static $stats = array();
|
||||
|
||||
private function _stats($type) {
|
||||
global $config, $_shm_event_count, $database, $_shm_load_start;
|
||||
global $_shm_event_count, $database, $_shm_load_start;
|
||||
$time = microtime(true) - $_shm_load_start;
|
||||
StatsDInterface::$stats["shimmie.$type.hits"] = "1|c";
|
||||
StatsDInterface::$stats["shimmie.$type.time"] = "$time|ms";
|
||||
|
|
|
@ -47,7 +47,7 @@ class TagCategories extends Extension {
|
|||
}
|
||||
|
||||
public function onPageRequest(PageRequestEvent $event) {
|
||||
global $page, $database, $user;
|
||||
global $page, $user;
|
||||
|
||||
if($event->page_matches("tags/categories")) {
|
||||
if($user->is_admin()) {
|
||||
|
|
|
@ -100,4 +100,3 @@ class TagCategoriesTheme extends Themelet {
|
|||
$page->add_block(new Block("Editing", $html, "main", 10));
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -115,7 +115,7 @@ class TagListTheme extends Themelet {
|
|||
|
||||
foreach($tag_infos as $row) {
|
||||
$split = $this->return_tag($row, $tag_category_dict);
|
||||
$category = $split[0];
|
||||
//$category = $split[0];
|
||||
$tag_html = $split[1];
|
||||
$main_html .= $tag_html . '<br />';
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ class TagListTheme extends Themelet {
|
|||
|
||||
foreach($tag_infos as $row) {
|
||||
$split = self::return_tag($row, $tag_category_dict);
|
||||
$category = $split[0];
|
||||
//$category = $split[0];
|
||||
$tag_html = $split[1];
|
||||
$main_html .= $tag_html . '<br />';
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ class TagListTheme extends Themelet {
|
|||
|
||||
foreach($tag_infos as $row) {
|
||||
$split = self::return_tag($row, $tag_category_dict);
|
||||
$category = $split[0];
|
||||
//$category = $split[0];
|
||||
$tag_html = $split[1];
|
||||
$main_html .= $tag_html . '<br />';
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
class Tagger extends Extension {
|
||||
public function onDisplayingImage(DisplayingImageEvent $event) {
|
||||
global $page, $config, $user;
|
||||
global $page, $user;
|
||||
|
||||
if($user->can("edit_image_tag") && ($event->image->is_locked() || $user->can("edit_image_lock"))) {
|
||||
$this->theme->build_tagger($page,$event);
|
||||
|
@ -58,7 +58,7 @@ class TaggerXML extends Extension {
|
|||
}
|
||||
|
||||
private function match_tag_list ($s) {
|
||||
global $database, $config, $event;
|
||||
global $database, $config;
|
||||
|
||||
$max_rows = $config->get_int("ext_tagger_tag_max",30);
|
||||
$limit_rows = $config->get_int("ext_tagger_limit",30);
|
||||
|
@ -67,7 +67,7 @@ class TaggerXML extends Extension {
|
|||
|
||||
// Match
|
||||
$p = strlen($s) == 1? " ":"\_";
|
||||
$sq = "%".$p.mysql_real_escape_string($s)."%";
|
||||
$sq = "%".$p.sql_escape($s)."%";
|
||||
$match = "concat(?,tag) LIKE ?";
|
||||
array_push($values,$p,$sq);
|
||||
// Exclude
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
class taggerTheme extends Themelet {
|
||||
public function build_tagger (Page $page, $event) {
|
||||
global $config;
|
||||
// Initialization code
|
||||
$base_href = get_base_href();
|
||||
// TODO: AJAX test and fallback.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
class TipsTheme extends Themelet {
|
||||
public function manageTips($url, $images) {
|
||||
global $page, $user;
|
||||
global $page;
|
||||
$select = "<select name='image'><option value=''>- Select Image -</option>";
|
||||
|
||||
foreach($images as $image){
|
||||
|
|
|
@ -28,7 +28,7 @@ class Update extends Extension {
|
|||
}
|
||||
|
||||
public function onPageRequest(PageRequestEvent $event) {
|
||||
global $config, $user, $page;
|
||||
global $user, $page;
|
||||
if($user->is_admin() && isset($_GET['sha'])){
|
||||
if($event->page_matches("update/download")){
|
||||
$ok = $this->download_shimmie();
|
||||
|
@ -77,7 +77,7 @@ class Update extends Extension {
|
|||
* @return bool
|
||||
*/
|
||||
private function update_shimmie() {
|
||||
global $config, $page;
|
||||
global $config;
|
||||
|
||||
$commitSHA = $_GET['sha'];
|
||||
|
||||
|
|
|
@ -292,7 +292,7 @@ class Upload extends Extension {
|
|||
* @return bool TRUE on upload successful.
|
||||
*/
|
||||
private function try_upload($file, $tags, $source, $replace='') {
|
||||
global $page, $config, $user;
|
||||
global $page;
|
||||
|
||||
if(empty($source)) $source = null;
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ class UploadTheme extends Themelet {
|
|||
$max_kb = to_shorthand_int($max_size);
|
||||
|
||||
$image = Image::by_id($image_id);
|
||||
$thumbnail = $this->build_thumb_html($image, null);
|
||||
$thumbnail = $this->build_thumb_html($image);
|
||||
|
||||
$html = "
|
||||
<p>Replacing Image ID ".$image_id."<br>Please note: You will have to refresh the image page, or empty your browser cache.</p>"
|
||||
|
|
|
@ -433,11 +433,9 @@ class UserPage extends Extension {
|
|||
*/
|
||||
private function check_user_creation(UserCreationEvent $event)
|
||||
{
|
||||
global $database;
|
||||
|
||||
$name = $event->username;
|
||||
$pass = $event->password;
|
||||
$email = $event->email;
|
||||
//$pass = $event->password;
|
||||
//$email = $event->email;
|
||||
|
||||
if(strlen($name) < 1) {
|
||||
throw new UserCreationException("Username must be at least 1 character");
|
||||
|
|
|
@ -161,7 +161,7 @@ class UserPageTheme extends Themelet {
|
|||
}
|
||||
|
||||
protected function build_options(User $duser) {
|
||||
global $config, $database, $user;
|
||||
global $config, $user;
|
||||
$html = "";
|
||||
if($duser->id != $config->get_int('anon_id')){ //justa fool-admin protection so they dont mess around with anon users.
|
||||
|
||||
|
|
|
@ -29,8 +29,6 @@ class ViewImageTheme extends Themelet {
|
|||
|
||||
|
||||
protected function build_pin(Image $image) {
|
||||
global $database;
|
||||
|
||||
if(isset($_GET['search'])) {
|
||||
$search_terms = explode(' ', $_GET['search']);
|
||||
$query = "search=".url_escape($_GET['search']);
|
||||
|
|
|
@ -106,7 +106,7 @@ class Wiki extends Extension {
|
|||
}
|
||||
|
||||
public function onPageRequest(PageRequestEvent $event) {
|
||||
global $config, $page, $user;
|
||||
global $page, $user;
|
||||
if($event->page_matches("wiki")) {
|
||||
if(is_null($event->get_arg(0)) || strlen(trim($event->get_arg(0))) === 0) {
|
||||
$title = "Index";
|
||||
|
|
|
@ -6,6 +6,7 @@ class Themelet extends BaseThemelet {
|
|||
* @param string $query
|
||||
* @param int $page_number
|
||||
* @param int $total_pages
|
||||
* @param bool $show_random
|
||||
*/
|
||||
public function display_paginator(Page $page, $base, $query, $page_number, $total_pages, $show_random = FALSE) {
|
||||
if($total_pages == 0) $total_pages = 1;
|
||||
|
|
|
@ -4,7 +4,7 @@ class CustomAdminPageTheme extends AdminPageTheme {
|
|||
public function display_page() {
|
||||
global $page;
|
||||
$page->disable_left();
|
||||
parent::display_page($page);
|
||||
parent::display_page();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ class Themelet extends BaseThemelet {
|
|||
* @param string $query
|
||||
* @param int $page_number
|
||||
* @param int $total_pages
|
||||
* @param bool $show_random
|
||||
*/
|
||||
public function display_paginator(Page $page, $base, $query, $page_number, $total_pages, $show_random = FALSE) {
|
||||
if($total_pages == 0) $total_pages = 1;
|
||||
|
|
|
@ -5,12 +5,14 @@
|
|||
class Layout {
|
||||
/**
|
||||
* turns the Page into HTML
|
||||
*
|
||||
* @param Page $page
|
||||
*/
|
||||
public function display_page(Page $page) {
|
||||
global $config;
|
||||
|
||||
$theme_name = $config->get_string('theme', 'default');
|
||||
$data_href = get_base_href();
|
||||
//$theme_name = $config->get_string('theme', 'default');
|
||||
//$data_href = get_base_href();
|
||||
$contact_link = $config->get_string('contact_link');
|
||||
|
||||
$header_html = "";
|
||||
|
|
|
@ -9,7 +9,7 @@ class Themelet extends BaseThemelet {
|
|||
* @param string $query
|
||||
* @param int $page_number
|
||||
* @param int $total_pages
|
||||
* @param int $position
|
||||
* @param bool $show_random
|
||||
*/
|
||||
public function display_paginator(Page $page, $base, $query, $page_number, $total_pages, $show_random = FALSE) {
|
||||
if($total_pages == 0) $total_pages = 1;
|
||||
|
|
|
@ -27,6 +27,7 @@ class Themelet extends BaseThemelet {
|
|||
* @param string $query
|
||||
* @param int $page_number
|
||||
* @param int $total_pages
|
||||
* @param bool $show_random
|
||||
*/
|
||||
public function display_paginator(Page $page, $base, $query, $page_number, $total_pages, $show_random = FALSE) {
|
||||
if($total_pages == 0) $total_pages = 1;
|
||||
|
@ -69,6 +70,7 @@ class Themelet extends BaseThemelet {
|
|||
* @param int $total_pages
|
||||
* @param string $base_url
|
||||
* @param string $query
|
||||
* @param bool $show_random
|
||||
* @return string
|
||||
*/
|
||||
public function litetheme_build_paginator($current_page, $total_pages, $base_url, $query, $show_random) {
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
class Layout {
|
||||
/**
|
||||
* turns the Page into HTML
|
||||
*
|
||||
* @param Page $page
|
||||
*/
|
||||
public function display_page(Page $page) {
|
||||
global $config;
|
||||
|
|
Reference in a new issue