remove a bunch of dead variables and things

This commit is contained in:
Shish 2019-10-02 11:23:57 +01:00
parent e08cdb1638
commit 30698fefdc
45 changed files with 51 additions and 111 deletions

1
.gitignore vendored
View file

@ -55,7 +55,6 @@ Icon
*.un~ *.un~
Session.vim Session.vim
.netrwhist .netrwhist
*~
### PhpStorm ### ### PhpStorm ###

View file

@ -99,16 +99,6 @@ function check_im_version(): int
return (empty($convert_check) ? 0 : 1); return (empty($convert_check) ? 0 : 1);
} }
function eok($name, $value)
{
echo "<br>$name ... ";
if ($value) {
echo "<span style='color: green'>ok</span>\n";
} else {
echo "<span style='color: green'>failed</span>\n";
}
}
// }}} // }}}
function do_install() function do_install()

View file

@ -127,7 +127,7 @@ class RedisCache implements CacheEngine
public function delete(string $key) public function delete(string $key)
{ {
$this->redis->delete($key); $this->redis->del($key);
} }
} }

View file

@ -13,7 +13,6 @@ class Image
public const IMAGE_DIR = "images"; public const IMAGE_DIR = "images";
public const THUMBNAIL_DIR = "thumbs"; public const THUMBNAIL_DIR = "thumbs";
private static $tag_n = 0; // temp hack
public static $order_sql = null; // this feels ugly public static $order_sql = null; // this feels ugly
/** @var null|int */ /** @var null|int */
@ -875,8 +874,6 @@ class Image
*/ */
private static function build_search_querylet(array $tag_conditions, array $img_conditions): Querylet private static function build_search_querylet(array $tag_conditions, array $img_conditions): Querylet
{ {
global $database;
$positive_tag_count = 0; $positive_tag_count = 0;
$negative_tag_count = 0; $negative_tag_count = 0;
foreach ($tag_conditions as $tq) { foreach ($tag_conditions as $tq) {
@ -989,7 +986,6 @@ class Image
} }
} }
$sql = "";
assert($positive_tag_id_array || $positive_wildcard_id_array || $negative_tag_id_array, @$_GET['q']); assert($positive_tag_id_array || $positive_wildcard_id_array || $negative_tag_id_array, @$_GET['q']);
if (!empty($positive_tag_id_array) || !empty($positive_wildcard_id_array)) { if (!empty($positive_tag_id_array) || !empty($positive_wildcard_id_array)) {
$inner_joins = []; $inner_joins = [];

View file

@ -281,7 +281,6 @@ const MIME_TYPE_MAP = [
'mpg' => 'video/mpeg', 'mpg' => 'video/mpeg',
'mpeg' => 'video/mpeg', 'mpeg' => 'video/mpeg',
'mov' => 'video/quicktime', 'mov' => 'video/quicktime',
'flv' => 'video/x-flv',
'php' => 'text/x-php', 'php' => 'text/x-php',
'mp4' => 'video/mp4', 'mp4' => 'video/mp4',
'ogv' => 'video/ogg', 'ogv' => 'video/ogg',

View file

@ -54,7 +54,7 @@ class BulkActions extends Extension
{ {
public function onPostListBuilding(PostListBuildingEvent $event) public function onPostListBuilding(PostListBuildingEvent $event)
{ {
global $config, $page, $user; global $page, $user;
if ($user->is_logged_in()) { if ($user->is_logged_in()) {
$babbe = new BulkActionBlockBuildingEvent(); $babbe = new BulkActionBlockBuildingEvent();

View file

@ -4,8 +4,6 @@ class BulkActionsTheme extends Themelet
{ {
public function display_selector(Page $page, array $actions, string $query) public function display_selector(Page $page, array $actions, string $query)
{ {
global $user;
$body = "<input type='hidden' name='bulk_selected_ids' id='bulk_selected_ids' /> $body = "<input type='hidden' name='bulk_selected_ids' id='bulk_selected_ids' />
<input id='bulk_selector_activate' type='button' onclick='activate_bulk_selector();' value='Activate (M)anual Select' accesskey='m'/> <input id='bulk_selector_activate' type='button' onclick='activate_bulk_selector();' value='Activate (M)anual Select' accesskey='m'/>
<div id='bulk_selector_controls' style='display: none;'> <div id='bulk_selector_controls' style='display: none;'>

View file

@ -263,7 +263,7 @@ class CommentList extends Extension
public function onPostListBuilding(PostListBuildingEvent $event) public function onPostListBuilding(PostListBuildingEvent $event)
{ {
global $cache, $config, $database; global $cache, $config;
$cc = $config->get_int("comment_count"); $cc = $config->get_int("comment_count");
if ($cc > 0) { if ($cc > 0) {
$recent = $cache->get("recent_comments"); $recent = $cache->get("recent_comments");

View file

@ -323,8 +323,6 @@ class CronUploader extends Extension
private function move_uploaded($path, $filename, $output_subdir, $corrupt = false) private function move_uploaded($path, $filename, $output_subdir, $corrupt = false)
{ {
global $config;
// Create // Create
$newDir = $this->root_dir; $newDir = $this->root_dir;

View file

@ -242,7 +242,7 @@ class DanbooruApi extends Extension
*/ */
private function api_add_post() private function api_add_post()
{ {
global $user, $config, $page; global $user, $page;
$danboorup_kludge = 1; // danboorup for firefox makes broken links out of location: /path $danboorup_kludge = 1; // danboorup for firefox makes broken links out of location: /path
// Check first if a login was supplied, if it wasn't check if the user is logged in via cookie // Check first if a login was supplied, if it wasn't check if the user is logged in via cookie

View file

@ -122,7 +122,6 @@ class ExtManager extends Extension
$extras = []; $extras = [];
foreach (ExtensionInfo::get_all_keys() as $key) { foreach (ExtensionInfo::get_all_keys() as $key) {
$matches = [];
if (!in_array($key, $core) && isset($settings["ext_$key"])) { if (!in_array($key, $core) && isset($settings["ext_$key"])) {
$extras[] = $key; $extras[] = $key;
} }

View file

@ -42,7 +42,7 @@ class Featured extends Extension
public function onPostListBuilding(PostListBuildingEvent $event) public function onPostListBuilding(PostListBuildingEvent $event)
{ {
global $cache, $config, $database, $page, $user; global $cache, $config, $page, $user;
$fid = $config->get_int("featured_id"); $fid = $config->get_int("featured_id");
if ($fid > 0) { if ($fid > 0) {
$image = $cache->get("featured_image_object:$fid"); $image = $cache->get("featured_image_object:$fid");

View file

@ -96,7 +96,7 @@ class Forum extends Extension
break; break;
case "view": case "view":
$threadID = int_escape($event->get_arg(1)); $threadID = int_escape($event->get_arg(1));
$pageNumber = int_escape($event->get_arg(2)); // $pageNumber = int_escape($event->get_arg(2));
list($errors) = $this->sanity_check_viewed_thread($threadID); list($errors) = $this->sanity_check_viewed_thread($threadID);
if ($errors!=null) { if ($errors!=null) {

View file

@ -5,7 +5,7 @@ class Handle404 extends Extension
{ {
public function onPageRequest(PageRequestEvent $event) public function onPageRequest(PageRequestEvent $event)
{ {
global $config, $page; global $page;
// hax. // hax.
if ($page->mode == PageMode::PAGE && (!isset($page->blocks) || $this->count_main($page->blocks) == 0)) { if ($page->mode == PageMode::PAGE && (!isset($page->blocks) || $this->count_main($page->blocks) == 0)) {
$h_pagename = html_escape(implode('/', $event->args)); $h_pagename = html_escape(implode('/', $event->args));

View file

@ -23,8 +23,6 @@ class FlashFileHandler extends DataHandlerExtension
protected function create_thumb(string $hash, string $type): bool protected function create_thumb(string $hash, string $type): bool
{ {
global $config;
if (!Media::create_thumbnail_ffmpeg($hash)) { if (!Media::create_thumbnail_ffmpeg($hash)) {
copy("ext/handle_flash/thumb.jpg", warehouse_path(Image::THUMBNAIL_DIR, $hash)); copy("ext/handle_flash/thumb.jpg", warehouse_path(Image::THUMBNAIL_DIR, $hash));
} }

View file

@ -115,8 +115,6 @@ class VideoFileHandler extends DataHandlerExtension
$image->ext = "ogv"; $image->ext = "ogv";
break; break;
case "video/flv": case "video/flv":
$image->ext = "flv";
break;
case "video/x-flv": case "video/x-flv":
$image->ext = "flv"; $image->ext = "flv";
break; break;

View file

@ -35,7 +35,7 @@ class HelpPages extends Extension
public function onPageRequest(PageRequestEvent $event) public function onPageRequest(PageRequestEvent $event)
{ {
global $page, $user; global $page;
if ($event->page_matches("help")) { if ($event->page_matches("help")) {
$e = new HelpPageListBuildingEvent(); $e = new HelpPageListBuildingEvent();
@ -79,7 +79,6 @@ class HelpPages extends Extension
public function onUserBlockBuilding(UserBlockBuildingEvent $event) public function onUserBlockBuilding(UserBlockBuildingEvent $event)
{ {
global $user;
$event->add_link("Help", make_link("help")); $event->add_link("Help", make_link("help"));
} }

View file

@ -81,7 +81,7 @@ class ImageIO extends Extension
public function onImageAdminBlockBuilding(ImageAdminBlockBuildingEvent $event) public function onImageAdminBlockBuilding(ImageAdminBlockBuildingEvent $event)
{ {
global $user; global $user;
if ($user->can(Permissions::DELETE_IMAGE)) { if ($user->can(Permissions::DELETE_IMAGE)) {
$event->add_part($this->theme->get_deleter_html($event->image->id)); $event->add_part($this->theme->get_deleter_html($event->image->id));
} }
@ -113,7 +113,7 @@ class ImageIO extends Extension
throw new UploadException($e->error); throw new UploadException($e->error);
} }
} }
public function onUserPageBuilding(UserPageBuildingEvent $event) public function onUserPageBuilding(UserPageBuildingEvent $event)
{ {
$u_id = url_escape($event->display_user->id); $u_id = url_escape($event->display_user->id);
@ -126,8 +126,6 @@ class ImageIO extends Extension
public function onSetupBuilding(SetupBuildingEvent $event) public function onSetupBuilding(SetupBuildingEvent $event)
{ {
global $config;
$sb = new SetupBlock("Image Options"); $sb = new SetupBlock("Image Options");
$sb->position = 30; $sb->position = 30;
// advanced only // advanced only
@ -141,9 +139,6 @@ class ImageIO extends Extension
$event->panel->add_block($sb); $event->panel->add_block($sb);
$sb = new SetupBlock("Thumbnailing"); $sb = new SetupBlock("Thumbnailing");
$sb->add_choice_option(ImageConfig::THUMB_ENGINE, self::THUMBNAIL_ENGINES, "Engine: "); $sb->add_choice_option(ImageConfig::THUMB_ENGINE, self::THUMBNAIL_ENGINES, "Engine: ");
$sb->add_label("<br>"); $sb->add_label("<br>");
@ -161,7 +156,6 @@ class ImageIO extends Extension
$sb->add_int_option(ImageConfig::THUMB_SCALING); $sb->add_int_option(ImageConfig::THUMB_SCALING);
$sb->add_label("%"); $sb->add_label("%");
$event->panel->add_block($sb); $event->panel->add_block($sb);
} }
@ -286,7 +280,7 @@ class ImageIO extends Extension
} }
$page->set_file($file); $page->set_file($file);
if ($config->get_int(ImageConfig::EXPIRES)) { if ($config->get_int(ImageConfig::EXPIRES)) {
$expires = date(DATE_RFC1123, time() + $config->get_int(ImageConfig::EXPIRES)); $expires = date(DATE_RFC1123, time() + $config->get_int(ImageConfig::EXPIRES));
} else { } else {
@ -313,7 +307,7 @@ class ImageIO extends Extension
/* Check to make sure the image exists. */ /* Check to make sure the image exists. */
$existing = Image::by_id($id); $existing = Image::by_id($id);
if (is_null($existing)) { if (is_null($existing)) {
throw new ImageReplaceException("Image to replace does not exist!"); throw new ImageReplaceException("Image to replace does not exist!");
} }

View file

@ -251,7 +251,7 @@ class Media extends Extension
public function onPageRequest(PageRequestEvent $event) public function onPageRequest(PageRequestEvent $event)
{ {
global $database, $page, $user; global $page, $user;
if ($event->page_matches("media_rescan/") && $user->can(Permissions::RESCAN_MEDIA) && isset($_POST['image_id'])) { if ($event->page_matches("media_rescan/") && $user->can(Permissions::RESCAN_MEDIA) && isset($_POST['image_id'])) {
$image = Image::by_id(int_escape($_POST['image_id'])); $image = Image::by_id(int_escape($_POST['image_id']));

View file

@ -4,7 +4,7 @@ class MediaTheme extends Themelet
{ {
public function display_form(array $types) public function display_form(array $types)
{ {
global $page, $database; global $page;
$html = "Use this to force scanning for media properties."; $html = "Use this to force scanning for media properties.";
$html .= make_form(make_link("admin/media_rescan")); $html .= make_form(make_link("admin/media_rescan"));

View file

@ -49,7 +49,7 @@ class Oekaki extends Extension
if (isset($_FILES["picture"])) { if (isset($_FILES["picture"])) {
header('Content-type: text/plain'); header('Content-type: text/plain');
$file = $_FILES['picture']['name']; //$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(); $uploadname = $_SERVER['REMOTE_ADDR'] . "." . time();
$uploadfile = data_path('oekaki_unclaimed/'.$uploadname); $uploadfile = data_path('oekaki_unclaimed/'.$uploadname);

View file

@ -589,17 +589,7 @@ class OuroborosAPI extends Extension
); );
break; break;
case 'count': case 'count':
$tag_data = $database->get_all( default:
"
SELECT id, tag, count
FROM tags
WHERE count >= :tags_min
ORDER BY count DESC, tag ASC LIMIT :start, :max_items
",
['tags_min' => $config->get_int(TagListConfig::TAGS_MIN), 'start' => $start, 'max_items' => $limit]
);
break;
case 'date':
$tag_data = $database->get_all( $tag_data = $database->get_all(
" "
SELECT id, tag, count SELECT id, tag, count

View file

@ -153,7 +153,7 @@ class Pools extends Extension
public function onPageRequest(PageRequestEvent $event) public function onPageRequest(PageRequestEvent $event)
{ {
global $page, $user, $database; global $page, $user;
if ($event->page_matches("pool")) { if ($event->page_matches("pool")) {
$pool_id = 0; $pool_id = 0;
@ -428,7 +428,7 @@ class Pools extends Extension
public function onBulkActionBlockBuilding(BulkActionBlockBuildingEvent $event) public function onBulkActionBlockBuilding(BulkActionBlockBuildingEvent $event)
{ {
global $user, $database; global $database;
$pools = $database->get_all("SELECT * FROM pools ORDER BY title "); $pools = $database->get_all("SELECT * FROM pools ORDER BY title ");

View file

@ -12,7 +12,7 @@ class PostTitles extends Extension
public function onInitExt(InitExtEvent $event) public function onInitExt(InitExtEvent $event)
{ {
global $config, $database; global $config;
$config->set_default_bool(PostTitlesConfig::DEFAULT_TO_FILENAME, false); $config->set_default_bool(PostTitlesConfig::DEFAULT_TO_FILENAME, false);
$config->set_default_bool(PostTitlesConfig::SHOW_IN_WINDOW_TITLE, false); $config->set_default_bool(PostTitlesConfig::SHOW_IN_WINDOW_TITLE, false);

View file

@ -128,7 +128,7 @@ class Ratings extends Extension
public function onInitExt(InitExtEvent $event) public function onInitExt(InitExtEvent $event)
{ {
global $user, $config, $_shm_user_classes, $_shm_ratings; global $config, $_shm_user_classes, $_shm_ratings;
if ($config->get_int(RatingsConfig::VERSION) < 4) { if ($config->get_int(RatingsConfig::VERSION) < 4) {
$this->install(); $this->install();
@ -149,7 +149,7 @@ class Ratings extends Extension
public function onUserOptionsBuilding(UserOptionsBuildingEvent $event) public function onUserOptionsBuilding(UserOptionsBuildingEvent $event)
{ {
global $user, $user_config; global $user;
$event->add__html( $event->add__html(
$this->theme->get_user_options( $this->theme->get_user_options(
@ -162,7 +162,7 @@ class Ratings extends Extension
public function onSetupBuilding(SetupBuildingEvent $event) public function onSetupBuilding(SetupBuildingEvent $event)
{ {
global $config, $_shm_user_classes, $_shm_ratings; global $_shm_user_classes;
$ratings = self::get_sorted_ratings(); $ratings = self::get_sorted_ratings();
@ -238,8 +238,6 @@ class Ratings extends Extension
public function onHelpPageBuilding(HelpPageBuildingEvent $event) public function onHelpPageBuilding(HelpPageBuildingEvent $event)
{ {
global $user;
if ($event->key===HelpPages::SEARCH) { if ($event->key===HelpPages::SEARCH) {
$block = new Block(); $block = new Block();
$block->header = "Ratings"; $block->header = "Ratings";
@ -507,7 +505,7 @@ class Ratings extends Extension
*/ */
private function can_rate(): bool private function can_rate(): bool
{ {
global $config, $user; global $user;
if ($user->can("edit_image_rating")) { if ($user->can("edit_image_rating")) {
return true; return true;
} }

View file

@ -26,7 +26,7 @@ class RatingsTheme extends Themelet
public function display_form(array $current_ratings, array $available_ratings) public function display_form(array $current_ratings, array $available_ratings)
{ {
global $page, $database; global $page;
$html = make_form(make_link("admin/update_ratings"))."<table class='form'><tr> $html = make_form(make_link("admin/update_ratings"))."<table class='form'><tr>
<th>Change</th><td><select name='rating_old' required='required'><option></option>"; <th>Change</th><td><select name='rating_old' required='required'><option></option>";
@ -66,8 +66,6 @@ class RatingsTheme extends Themelet
public function get_selection_rater_html(array $selected_options, bool $multiple = false, array $available_options = null) public function get_selection_rater_html(array $selected_options, bool $multiple = false, array $available_options = null)
{ {
global $_shm_ratings;
$output = "<select name='rating".($multiple ? "[]' multiple='multiple'" : "' ")." >"; $output = "<select name='rating".($multiple ? "[]' multiple='multiple'" : "' ")." >";
$options = Ratings::get_sorted_ratings(); $options = Ratings::get_sorted_ratings();
@ -111,7 +109,7 @@ class RatingsTheme extends Themelet
$output .= "</table>"; $output .= "</table>";
return $output; return $output;
} }
public function get_user_options(User $user, array $selected_ratings, array $available_ratings): string public function get_user_options(User $user, array $selected_ratings, array $available_ratings): string
{ {
$html = " $html = "

View file

@ -14,7 +14,7 @@ class RegenThumb extends Extension
public function onPageRequest(PageRequestEvent $event) public function onPageRequest(PageRequestEvent $event)
{ {
global $database, $page, $user; global $page, $user;
if ($event->page_matches("regen_thumb/one") && $user->can(Permissions::DELETE_IMAGE) && isset($_POST['image_id'])) { if ($event->page_matches("regen_thumb/one") && $user->can(Permissions::DELETE_IMAGE) && isset($_POST['image_id'])) {
$image = Image::by_id(int_escape($_POST['image_id'])); $image = Image::by_id(int_escape($_POST['image_id']));
@ -93,8 +93,6 @@ class RegenThumb extends Extension
public function onAdminAction(AdminActionEvent $event) public function onAdminAction(AdminActionEvent $event)
{ {
global $database;
switch ($event->action) { switch ($event->action) {
case "regen_thumbs": case "regen_thumbs":
$event->redirect = true; $event->redirect = true;

View file

@ -171,7 +171,7 @@ class ResizeImage extends Extension
/* ----------------------------- */ /* ----------------------------- */
private function resize_image(Image $image_obj, int $width, int $height) private function resize_image(Image $image_obj, int $width, int $height)
{ {
global $database, $config; global $config;
if (($height <= 0) && ($width <= 0)) { if (($height <= 0) && ($width <= 0)) {
throw new ImageResizeException("Invalid options for height and width. ($width x $height)"); throw new ImageResizeException("Invalid options for height and width. ($width x $height)");

View file

@ -99,8 +99,6 @@ class RotateImage extends Extension
/* ----------------------------- */ /* ----------------------------- */
private function rotate_image(int $image_id, int $deg) private function rotate_image(int $image_id, int $deg)
{ {
global $database;
if (($deg <= -360) || ($deg >= 360)) { if (($deg <= -360) || ($deg >= 360)) {
throw new ImageRotateException("Invalid options for rotation angle. ($deg)"); throw new ImageRotateException("Invalid options for rotation angle. ($deg)");
} }
@ -177,7 +175,6 @@ class RotateImage extends Extension
} }
/* Output to the same format as the original image */ /* Output to the same format as the original image */
$result = false;
switch ($info[2]) { switch ($info[2]) {
case IMAGETYPE_GIF: $result = imagegif($image_rotated, $tmp_filename); break; case IMAGETYPE_GIF: $result = imagegif($image_rotated, $tmp_filename); break;
case IMAGETYPE_JPEG: $result = imagejpeg($image_rotated, $tmp_filename); break; case IMAGETYPE_JPEG: $result = imagejpeg($image_rotated, $tmp_filename); break;

View file

@ -76,7 +76,7 @@ class RSSImages extends Extension
private function thumb(Image $image): string private function thumb(Image $image): string
{ {
global $cache, $database; global $cache;
$cached = $cache->get("rss-thumb:{$image->id}"); $cached = $cache->get("rss-thumb:{$image->id}");
if ($cached) { if ($cached) {

View file

@ -138,8 +138,6 @@ class SetupBlock extends Block
private function format_option(string $name, $html, ?string $label, bool $table_row) private function format_option(string $name, $html, ?string $label, bool $table_row)
{ {
global $config;
if ($table_row) { if ($table_row) {
$this->start_table_row(); $this->start_table_row();
} }

View file

@ -4,7 +4,7 @@ class System extends Extension
{ {
public function onPageRequest(PageRequestEvent $event) public function onPageRequest(PageRequestEvent $event)
{ {
global $page, $user; global $page;
if ($event->page_matches("system")) { if ($event->page_matches("system")) {
$e = new PageSubNavBuildingEvent("system"); $e = new PageSubNavBuildingEvent("system");

View file

@ -189,7 +189,6 @@ class TagList extends Extension
$results = $cache->get("tag_list_omitted_tags:".$tags_config); $results = $cache->get("tag_list_omitted_tags:".$tags_config);
if ($results==null) { if ($results==null) {
$results = [];
$tags = explode(" ", $tags_config); $tags = explode(" ", $tags_config);
if (empty($tags)) { if (empty($tags)) {
@ -572,7 +571,7 @@ class TagList extends Extension
*/ */
private function add_refine_block(Page $page, array $search) private function add_refine_block(Page $page, array $search)
{ {
global $database, $config; global $config;
if (count($search) > 5) { if (count($search) > 5) {
return; return;

View file

@ -100,7 +100,7 @@ class TranscodeImage extends Extension
public function onDataUpload(DataUploadEvent $event) public function onDataUpload(DataUploadEvent $event)
{ {
global $config, $page; global $config;
if ($config->get_bool(TranscodeConfig::UPLOAD) == true) { if ($config->get_bool(TranscodeConfig::UPLOAD) == true) {
$ext = strtolower($event->type); $ext = strtolower($event->type);
@ -196,7 +196,7 @@ class TranscodeImage extends Extension
$database->commit(); $database->commit();
$total++; $total++;
} catch (Exception $e) { } catch (Exception $e) {
log_error("transcode", "Error while bulk transcode on item $id to $format: ".$e->getMessage()); log_error("transcode", "Error while bulk transcode on item {$image->id} to $format: ".$e->getMessage());
try { try {
$database->rollback(); $database->rollback();
} catch (Exception $e) { } catch (Exception $e) {
@ -291,6 +291,8 @@ class TranscodeImage extends Extension
return $this->transcode_image_gd($source_name, $source_format, $target_format); return $this->transcode_image_gd($source_name, $source_format, $target_format);
case "convert": case "convert":
return $this->transcode_image_convert($source_name, $source_format, $target_format); return $this->transcode_image_convert($source_name, $source_format, $target_format);
default:
throw new ImageTranscodeException("No engine specified");
} }
} }

View file

@ -7,8 +7,6 @@ class TranscodeImageTheme extends Themelet
*/ */
public function get_transcode_html(Image $image, array $options) public function get_transcode_html(Image $image, array $options)
{ {
global $config;
$html = " $html = "
".make_form( ".make_form(
make_link("transcode/{$image->id}"), make_link("transcode/{$image->id}"),
@ -23,10 +21,10 @@ class TranscodeImageTheme extends Themelet
<br><input id='transcodebutton' type='submit' value='Transcode'> <br><input id='transcodebutton' type='submit' value='Transcode'>
</form> </form>
"; ";
return $html; return $html;
} }
public function get_transcode_picker_html(array $options) public function get_transcode_picker_html(array $options)
{ {
$html = "<select id='transcode_format' name='transcode_format' required='required' >"; $html = "<select id='transcode_format' name='transcode_format' required='required' >";

View file

@ -115,7 +115,7 @@ class Trash extends Extension
} }
public function onImageAdminBlockBuilding(ImageAdminBlockBuildingEvent $event) public function onImageAdminBlockBuilding(ImageAdminBlockBuildingEvent $event)
{ {
global $config, $database, $user; global $user;
if ($event->image->trash===true && $user->can(Permissions::VIEW_TRASH)) { if ($event->image->trash===true && $user->can(Permissions::VIEW_TRASH)) {
$event->add_part($this->theme->get_image_admin_html($event->image->id)); $event->add_part($this->theme->get_image_admin_html($event->image->id));
} }

View file

@ -343,8 +343,7 @@ class UserPage extends Extension
// Things done *with* the user {{{ // Things done *with* the user {{{
private function page_login($name, $pass) private function page_login($name, $pass)
{ {
global $config, $user, $page; global $config, $page;
if (empty($name) || empty($pass)) { if (empty($name) || empty($pass)) {
$this->theme->display_error(400, "Error", "Username or password left blank"); $this->theme->display_error(400, "Error", "Username or password left blank");

View file

@ -234,7 +234,7 @@ class UserPageTheme extends Themelet
public function display_user_page(User $duser, $stats) public function display_user_page(User $duser, $stats)
{ {
global $page, $user; global $page;
assert(is_array($stats)); assert(is_array($stats));
$stats[] = 'User ID: '.$duser->id; $stats[] = 'User ID: '.$duser->id;
@ -249,7 +249,7 @@ class UserPageTheme extends Themelet
global $config, $user; global $config, $user;
$html = ""; $html = "";
if ($duser->id != $config->get_int('anon_id')) { //justa fool-admin protection so they dont mess around with anon users. if ($duser->id != $config->get_int('anon_id')) { //justa fool-admin protection so they dont mess around with anon users.
if ($user->can(Permissions::EDIT_USER_NAME)) { if ($user->can(Permissions::EDIT_USER_NAME)) {
$html .= " $html .= "
<p>".make_form(make_link("user_admin/change_name"))." <p>".make_form(make_link("user_admin/change_name"))."

View file

@ -46,7 +46,7 @@ class Layout
{ {
public function display_page(Page $page, array $nav_links, array $sub_links) public function display_page(Page $page, array $nav_links, array $sub_links)
{ {
global $config, $user; global $config;
$theme_name = $config->get_string(SetupConfig::THEME); $theme_name = $config->get_string(SetupConfig::THEME);
//$base_href = $config->get_string('base_href'); //$base_href = $config->get_string('base_href');
@ -174,7 +174,7 @@ $header_html
</html> </html>
EOD; EOD;
} }
/** /**
* #param string[] $pages_matched * #param string[] $pages_matched
*/ */

View file

@ -8,7 +8,7 @@ class CustomExtManagerTheme extends ExtManagerTheme
parent::display_table($page, $extensions, $editable); parent::display_table($page, $extensions, $editable);
} }
public function display_doc(Page $page, ExtensionManagerInfo $info) public function display_doc(Page $page, ExtensionInfo $info)
{ {
$page->disable_left(); $page->disable_left();
parent::display_doc($page, $info); parent::display_doc($page, $info);

View file

@ -46,7 +46,7 @@ class Layout
{ {
public function display_page($page, array $nav_links, array $sub_links) public function display_page($page, array $nav_links, array $sub_links)
{ {
global $config, $user; global $config;
//$theme_name = $config->get_string(SetupConfig::THEME); //$theme_name = $config->get_string(SetupConfig::THEME);
//$base_href = $config->get_string('base_href'); //$base_href = $config->get_string('base_href');

View file

@ -9,8 +9,7 @@ class Layout
*/ */
public function display_page(Page $page, array $nav_links) public function display_page(Page $page, array $nav_links)
{ {
global $config; //global $config;
//$theme_name = $config->get_string(SetupConfig::THEME, 'default'); //$theme_name = $config->get_string(SetupConfig::THEME, 'default');
//$data_href = get_base_href(); //$data_href = get_base_href();
$contact_link = contact_link(); $contact_link = contact_link();

View file

@ -11,7 +11,7 @@ class Layout
{ {
public function display_page(Page $page, array $nav_links, array $sub_links) public function display_page(Page $page, array $nav_links, array $sub_links)
{ {
global $config, $user; global $config;
$theme_name = $config->get_string(SetupConfig::THEME, 'lite'); $theme_name = $config->get_string(SetupConfig::THEME, 'lite');
$site_name = $config->get_string(SetupConfig::TITLE); $site_name = $config->get_string(SetupConfig::TITLE);
@ -30,7 +30,7 @@ class Layout
$custom_links .= $this->navlinks($nav_link->link, $nav_link->description, $nav_link->active); $custom_links .= $this->navlinks($nav_link->link, $nav_link->description, $nav_link->active);
} }
$menu .= "{$custom_links}</div>"; $menu .= "{$custom_links}</div>";
$left_block_html = ""; $left_block_html = "";
$main_block_html = ""; $main_block_html = "";
$sub_block_html = ""; $sub_block_html = "";

View file

@ -14,7 +14,7 @@ class Layout
$theme_name = $config->get_string(SetupConfig::THEME, 'material'); $theme_name = $config->get_string(SetupConfig::THEME, 'material');
$site_name = $config->get_string(SetupConfig::TITLE); $site_name = $config->get_string(SetupConfig::TITLE);
$data_href = get_base_href(); $data_href = get_base_href();
$main_page = $config->get_string(SetupConfig::MAIN_PAGE); // $main_page = $config->get_string(SetupConfig::MAIN_PAGE);
$contact_link = contact_link(); $contact_link = contact_link();
$site_link = make_link(); $site_link = make_link();
$header_html = $page->get_all_html_headers(); $header_html = $page->get_all_html_headers();
@ -26,7 +26,7 @@ class Layout
$drawer_block_html = ""; //use exampled in user.theme.php & view.theme.php $drawer_block_html = ""; //use exampled in user.theme.php & view.theme.php
$toolbar_block_html = ""; // not used at this point $toolbar_block_html = ""; // not used at this point
$subtoolbar_block_html = ""; // use exampled in user.theme.php $subtoolbar_block_html = ""; // use exampled in user.theme.php
$navigation = ""; // $navigation = "";
$h_search = " $h_search = "
<div class='mdl-textfield mdl-js-textfield mdl-textfield--expandable <div class='mdl-textfield mdl-js-textfield mdl-textfield--expandable
@ -201,13 +201,13 @@ EOD;
public function rework_navigation(Block $block) public function rework_navigation(Block $block)
{ {
$h = $block->header; // $h = $block->header;
$b = $block->body; $b = $block->body;
$i = $block->id; $i = $block->id;
$dom = new DomDocument(); $dom = new DomDocument();
$dom->loadHTML($b); $dom->loadHTML($b);
$output = []; // $output = [];
$html = "<section id='$i'>\n<nav class='mdl-navigation'>\n"; $html = "<section id='$i'>\n<nav class='mdl-navigation'>\n";
foreach ($dom->getElementsByTagName('a') as $item) { foreach ($dom->getElementsByTagName('a') as $item) {
$item->setAttribute('class', 'mdl-navigation__link'); $item->setAttribute('class', 'mdl-navigation__link');

View file

@ -22,13 +22,9 @@ class CustomViewImageTheme extends ViewImageTheme
protected function build_pin(Image $image) protected function build_pin(Image $image)
{ {
global $database;
if (isset($_GET['search'])) { if (isset($_GET['search'])) {
$search_terms = explode(' ', $_GET['search']);
$query = "search=".url_escape($_GET['search']); $query = "search=".url_escape($_GET['search']);
} else { } else {
$search_terms = [];
$query = null; $query = null;
} }