fix a bunch of lints
This commit is contained in:
parent
294f5845b1
commit
2396ae2ef9
34 changed files with 67 additions and 88 deletions
|
@ -25,6 +25,7 @@
|
||||||
"require" : {
|
"require" : {
|
||||||
"php" : ">=7.1",
|
"php" : ">=7.1",
|
||||||
"ext-pdo": "*",
|
"ext-pdo": "*",
|
||||||
|
"ext-json": "*",
|
||||||
|
|
||||||
"flexihash/flexihash" : "^2.0.0",
|
"flexihash/flexihash" : "^2.0.0",
|
||||||
"ifixit/php-akismet" : "1.*",
|
"ifixit/php-akismet" : "1.*",
|
||||||
|
@ -38,7 +39,7 @@
|
||||||
"bower-asset/tablesorter" : "dev-master",
|
"bower-asset/tablesorter" : "dev-master",
|
||||||
"bower-asset/mediaelement" : "2.21.1",
|
"bower-asset/mediaelement" : "2.21.1",
|
||||||
"bower-asset/js-cookie" : "2.1.1"
|
"bower-asset/js-cookie" : "2.1.1"
|
||||||
},
|
},
|
||||||
|
|
||||||
"require-dev" : {
|
"require-dev" : {
|
||||||
"phpunit/phpunit" : "6.*"
|
"phpunit/phpunit" : "6.*"
|
||||||
|
|
|
@ -76,7 +76,7 @@ class BaseThemelet
|
||||||
"</a>\n";
|
"</a>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function display_paginator(Page $page, string $base, string $query=null, int $page_number, int $total_pages, bool $show_random = false)
|
public function display_paginator(Page $page, string $base, ?string $query, int $page_number, int $total_pages, bool $show_random = false)
|
||||||
{
|
{
|
||||||
if ($total_pages == 0) {
|
if ($total_pages == 0) {
|
||||||
$total_pages = 1;
|
$total_pages = 1;
|
||||||
|
@ -85,13 +85,13 @@ class BaseThemelet
|
||||||
$page->add_block(new Block(null, $body, "main", 90, "paginator"));
|
$page->add_block(new Block(null, $body, "main", 90, "paginator"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function gen_page_link(string $base_url, string $query=null, string $page, string $name): string
|
private function gen_page_link(string $base_url, ?string $query, string $page, string $name): string
|
||||||
{
|
{
|
||||||
$link = make_link($base_url.'/'.$page, $query);
|
$link = make_link($base_url.'/'.$page, $query);
|
||||||
return '<a href="'.$link.'">'.$name.'</a>';
|
return '<a href="'.$link.'">'.$name.'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
private function gen_page_link_block(string $base_url, string $query=null, string $page, int $current_page, string $name): string
|
private function gen_page_link_block(string $base_url, ?string $query, string $page, int $current_page, string $name): string
|
||||||
{
|
{
|
||||||
$paginator = "";
|
$paginator = "";
|
||||||
if ($page == $current_page) {
|
if ($page == $current_page) {
|
||||||
|
@ -104,7 +104,7 @@ class BaseThemelet
|
||||||
return $paginator;
|
return $paginator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function build_paginator(int $current_page, int $total_pages, string $base_url, string $query=null, bool $show_random): string
|
private function build_paginator(int $current_page, int $total_pages, string $base_url, ?string $query, bool $show_random): string
|
||||||
{
|
{
|
||||||
$next = $current_page + 1;
|
$next = $current_page + 1;
|
||||||
$prev = $current_page - 1;
|
$prev = $current_page - 1;
|
||||||
|
|
|
@ -22,7 +22,7 @@ class NoCache implements CacheEngine
|
||||||
|
|
||||||
class MemcacheCache implements CacheEngine
|
class MemcacheCache implements CacheEngine
|
||||||
{
|
{
|
||||||
/** @var \Memcache|null */
|
/** @var ?Memcache */
|
||||||
public $memcache=null;
|
public $memcache=null;
|
||||||
|
|
||||||
public function __construct(string $args)
|
public function __construct(string $args)
|
||||||
|
@ -50,7 +50,7 @@ class MemcacheCache implements CacheEngine
|
||||||
|
|
||||||
class MemcachedCache implements CacheEngine
|
class MemcachedCache implements CacheEngine
|
||||||
{
|
{
|
||||||
/** @var \Memcached|null */
|
/** @var ?Memcached */
|
||||||
public $memcache=null;
|
public $memcache=null;
|
||||||
|
|
||||||
public function __construct(string $args)
|
public function __construct(string $args)
|
||||||
|
@ -169,6 +169,7 @@ class Cache
|
||||||
public function __construct(?string $dsn)
|
public function __construct(?string $dsn)
|
||||||
{
|
{
|
||||||
$matches = [];
|
$matches = [];
|
||||||
|
$c = null;
|
||||||
if ($dsn && preg_match("#(.*)://(.*)#", $dsn, $matches)) {
|
if ($dsn && preg_match("#(.*)://(.*)#", $dsn, $matches)) {
|
||||||
if ($matches[1] == "memcache") {
|
if ($matches[1] == "memcache") {
|
||||||
$c = new MemcacheCache($matches[2]);
|
$c = new MemcacheCache($matches[2]);
|
||||||
|
|
|
@ -350,7 +350,7 @@ class MockDatabase extends Database
|
||||||
private $query_id = 0;
|
private $query_id = 0;
|
||||||
/** @var array */
|
/** @var array */
|
||||||
private $responses = [];
|
private $responses = [];
|
||||||
/** @var \NoCache|null */
|
/** @var ?NoCache */
|
||||||
public $cache = null;
|
public $cache = null;
|
||||||
|
|
||||||
public function __construct(array $responses = [])
|
public function __construct(array $responses = [])
|
||||||
|
|
|
@ -37,7 +37,7 @@ class ImageAdditionException extends SCoreException
|
||||||
*/
|
*/
|
||||||
class ImageDeletionEvent extends Event
|
class ImageDeletionEvent extends Event
|
||||||
{
|
{
|
||||||
/** @var \Image */
|
/** @var Image */
|
||||||
public $image;
|
public $image;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -59,7 +59,7 @@ class ImageReplaceEvent extends Event
|
||||||
{
|
{
|
||||||
/** @var int */
|
/** @var int */
|
||||||
public $id;
|
public $id;
|
||||||
/** @var \Image */
|
/** @var Image */
|
||||||
public $image;
|
public $image;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -123,7 +123,7 @@ class ParseLinkTemplateEvent extends Event
|
||||||
public $link;
|
public $link;
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public $original;
|
public $original;
|
||||||
/** @var \Image */
|
/** @var Image */
|
||||||
public $image;
|
public $image;
|
||||||
|
|
||||||
public function __construct(string $link, Image $image)
|
public function __construct(string $link, Image $image)
|
||||||
|
|
|
@ -45,7 +45,7 @@ class TagQuerylet
|
||||||
|
|
||||||
class ImgQuerylet
|
class ImgQuerylet
|
||||||
{
|
{
|
||||||
/** @var \Querylet */
|
/** @var Querylet */
|
||||||
public $qlet;
|
public $qlet;
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
public $positive;
|
public $positive;
|
||||||
|
|
|
@ -12,12 +12,12 @@ class UserClass
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var null|string
|
* @var ?string
|
||||||
*/
|
*/
|
||||||
public $name = null;
|
public $name = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \UserClass|null
|
* @var ?UserClass
|
||||||
*/
|
*/
|
||||||
public $parent = null;
|
public $parent = null;
|
||||||
|
|
||||||
|
|
|
@ -216,7 +216,7 @@ function transload(string $url, string $mfile): ?array
|
||||||
$s_mfile = escapeshellarg($mfile);
|
$s_mfile = escapeshellarg($mfile);
|
||||||
system("wget --no-check-certificate $s_url --output-document=$s_mfile");
|
system("wget --no-check-certificate $s_url --output-document=$s_mfile");
|
||||||
|
|
||||||
return file_exists($mfile);
|
return file_exists($mfile) ? ["ok"=>"true"] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($config->get_string("transload_engine") === "fopen") {
|
if ($config->get_string("transload_engine") === "fopen") {
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
*/
|
*/
|
||||||
class AdminBuildingEvent extends Event
|
class AdminBuildingEvent extends Event
|
||||||
{
|
{
|
||||||
/** @var \Page */
|
/** @var Page */
|
||||||
public $page;
|
public $page;
|
||||||
|
|
||||||
public function __construct(Page $page)
|
public function __construct(Page $page)
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
*/
|
*/
|
||||||
class AuthorSetEvent extends Event
|
class AuthorSetEvent extends Event
|
||||||
{
|
{
|
||||||
/** @var \Image */
|
/** @var Image */
|
||||||
public $image;
|
public $image;
|
||||||
/** @var \User */
|
/** @var User */
|
||||||
public $user;
|
public $user;
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public $author;
|
public $author;
|
||||||
|
|
|
@ -15,7 +15,7 @@ class ArtistsTheme extends Themelet
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sidebar_options(string $mode, ?int $artistID=null, $is_admin=false): bool
|
public function sidebar_options(string $mode, ?int $artistID=null, $is_admin=false): void
|
||||||
{
|
{
|
||||||
global $page, $user;
|
global $page, $user;
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class CommentPostingEvent extends Event
|
||||||
{
|
{
|
||||||
/** @var int */
|
/** @var int */
|
||||||
public $image_id;
|
public $image_id;
|
||||||
/** @var \User */
|
/** @var User */
|
||||||
public $user;
|
public $user;
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public $comment;
|
public $comment;
|
||||||
|
|
|
@ -1,23 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
class CommentListTheme extends Themelet
|
class CommentListTheme extends Themelet
|
||||||
{
|
{
|
||||||
private $comments_shown = 0;
|
|
||||||
private $show_anon_id = false;
|
private $show_anon_id = false;
|
||||||
private $anon_id = 1;
|
private $anon_id = 1;
|
||||||
private $anon_cid = 0;
|
|
||||||
private $anon_map = [];
|
private $anon_map = [];
|
||||||
private $ct = null;
|
|
||||||
|
|
||||||
private function get_anon_colour($ip)
|
|
||||||
{
|
|
||||||
if (is_null($this->ct)) {
|
|
||||||
$this->ct = hsl_rainbow();
|
|
||||||
}
|
|
||||||
if (!array_key_exists($ip, $this->anon_map)) {
|
|
||||||
$this->anon_map[$ip] = $this->ct[$this->anon_cid++ % count($this->ct)];
|
|
||||||
}
|
|
||||||
return $this->anon_map[$ip];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display a page with a list of images, and for each image, the image's comments.
|
* Display a page with a list of images, and for each image, the image's comments.
|
||||||
|
|
|
@ -340,7 +340,7 @@ class CronUploader extends Extension
|
||||||
$img->set_tags(Tag::explode($tags));
|
$img->set_tags(Tag::explode($tags));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function generate_image_queue($base = "", $subdir = "")
|
private function generate_image_queue(string $base = "", string $subdir = ""): void
|
||||||
{
|
{
|
||||||
if ($base == "") {
|
if ($base == "") {
|
||||||
$base = $this->root_dir . "/queue";
|
$base = $this->root_dir . "/queue";
|
||||||
|
@ -348,7 +348,7 @@ class CronUploader extends Extension
|
||||||
|
|
||||||
if (! is_dir($base)) {
|
if (! is_dir($base)) {
|
||||||
$this->add_upload_info("Image Queue Directory could not be found at \"$base\".");
|
$this->add_upload_info("Image Queue Directory could not be found at \"$base\".");
|
||||||
return [];
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (glob("$base/$subdir/*") as $fullpath) {
|
foreach (glob("$base/$subdir/*") as $fullpath) {
|
||||||
|
|
|
@ -17,7 +17,7 @@ class FavoriteSetEvent extends Event
|
||||||
{
|
{
|
||||||
/** @var int */
|
/** @var int */
|
||||||
public $image_id;
|
public $image_id;
|
||||||
/** @var \User */
|
/** @var User */
|
||||||
public $user;
|
public $user;
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
public $do_set;
|
public $do_set;
|
||||||
|
|
|
@ -136,15 +136,6 @@ class PixelFileHandler extends DataHandlerExtension
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
// epeg thumber {{{
|
|
||||||
private function make_thumb_epeg(string $inname, string $outname): bool
|
|
||||||
{
|
|
||||||
global $config;
|
|
||||||
$w = $config->get_int("thumb_width");
|
|
||||||
exec("epeg $inname -c 'Created by EPEG' --max $w $outname");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// }}}
|
|
||||||
// GD thumber {{{
|
// GD thumber {{{
|
||||||
private function make_thumb_gd(string $inname, string $outname): bool
|
private function make_thumb_gd(string $inname, string $outname): bool
|
||||||
{
|
{
|
||||||
|
|
|
@ -164,7 +164,7 @@ class SearchTermParseEvent extends Event
|
||||||
public $term = null;
|
public $term = null;
|
||||||
/** @var string[] */
|
/** @var string[] */
|
||||||
public $context = [];
|
public $context = [];
|
||||||
/** @var \Querylet[] */
|
/** @var Querylet[] */
|
||||||
public $querylets = [];
|
public $querylets = [];
|
||||||
|
|
||||||
public function __construct(string $term=null, array $context=[])
|
public function __construct(string $term=null, array $context=[])
|
||||||
|
|
|
@ -120,7 +120,7 @@ class PoolsTheme extends Themelet
|
||||||
$page->add_block(new Block("Create Pool", $create_html, "main", 20));
|
$page->add_block(new Block("Create Pool", $create_html, "main", 20));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function display_top(array $pools=null, string $heading, bool $check_all=false)
|
private function display_top(?array $pools, string $heading, bool $check_all=false)
|
||||||
{
|
{
|
||||||
global $page, $user;
|
global $page, $user;
|
||||||
|
|
||||||
|
@ -361,7 +361,9 @@ class PoolsTheme extends Themelet
|
||||||
$prefix = "+";
|
$prefix = "+";
|
||||||
} elseif ($history['action'] == 0) {
|
} elseif ($history['action'] == 0) {
|
||||||
$prefix = "-";
|
$prefix = "-";
|
||||||
}
|
} else {
|
||||||
|
throw new Exception("history['action'] not in {0, 1}");
|
||||||
|
}
|
||||||
|
|
||||||
$images = trim($history['images']);
|
$images = trim($history['images']);
|
||||||
$images = explode(" ", $images);
|
$images = explode(" ", $images);
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
class RatingSetEvent extends Event
|
class RatingSetEvent extends Event
|
||||||
{
|
{
|
||||||
/** @var \Image */
|
/** @var Image */
|
||||||
public $image;
|
public $image;
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public $rating;
|
public $rating;
|
||||||
|
|
|
@ -123,10 +123,8 @@ class Rule34 extends Extension
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aae->redirect) {
|
$page->set_mode("redirect");
|
||||||
$page->set_mode("redirect");
|
$page->set_redirect(make_link("admin"));
|
||||||
$page->set_redirect(make_link("admin"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
class Rule34Theme extends Themelet
|
class Rule34Theme extends Themelet
|
||||||
{
|
{
|
||||||
public function show_comic_changer(User $duser, bool $current_state): string
|
public function show_comic_changer(User $duser, bool $current_state): void
|
||||||
{
|
{
|
||||||
global $page;
|
global $page;
|
||||||
$checked = $current_state ? 'checked="checked"' : '';
|
$checked = $current_state ? 'checked="checked"' : '';
|
||||||
|
@ -15,7 +15,7 @@ class Rule34Theme extends Themelet
|
||||||
$page->add_block(new Block("Rule34 Comic Options", $html));
|
$page->add_block(new Block("Rule34 Comic Options", $html));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function display_bans(Page $page, $bans)
|
public function display_bans(Page $page, array $bans)
|
||||||
{
|
{
|
||||||
global $database, $user;
|
global $database, $user;
|
||||||
$h_bans = "";
|
$h_bans = "";
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*/
|
*/
|
||||||
class ConfigSaveEvent extends Event
|
class ConfigSaveEvent extends Event
|
||||||
{
|
{
|
||||||
/** @var \Config */
|
/** @var Config */
|
||||||
public $config;
|
public $config;
|
||||||
|
|
||||||
public function __construct(Config $config)
|
public function __construct(Config $config)
|
||||||
|
@ -28,7 +28,7 @@ class ConfigSaveEvent extends Event
|
||||||
*/
|
*/
|
||||||
class SetupBuildingEvent extends Event
|
class SetupBuildingEvent extends Event
|
||||||
{
|
{
|
||||||
/** @var \SetupPanel */
|
/** @var SetupPanel */
|
||||||
public $panel;
|
public $panel;
|
||||||
|
|
||||||
public function __construct(SetupPanel $panel)
|
public function __construct(SetupPanel $panel)
|
||||||
|
@ -42,7 +42,7 @@ class SetupBuildingEvent extends Event
|
||||||
*/
|
*/
|
||||||
class SetupPanel
|
class SetupPanel
|
||||||
{
|
{
|
||||||
/** @var \SetupBlock[] */
|
/** @var SetupBlock[] */
|
||||||
public $blocks = [];
|
public $blocks = [];
|
||||||
|
|
||||||
public function add_block(SetupBlock $block)
|
public function add_block(SetupBlock $block)
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
|
|
||||||
class TagCategoriesTheme extends Themelet
|
class TagCategoriesTheme extends Themelet
|
||||||
{
|
{
|
||||||
private $heading = "";
|
|
||||||
private $list = "";
|
|
||||||
|
|
||||||
public function show_tag_categories($page, $tc_dict)
|
public function show_tag_categories($page, $tc_dict)
|
||||||
{
|
{
|
||||||
$tc_block_index = 0;
|
$tc_block_index = 0;
|
||||||
|
|
|
@ -48,9 +48,9 @@
|
||||||
*/
|
*/
|
||||||
class OwnerSetEvent extends Event
|
class OwnerSetEvent extends Event
|
||||||
{
|
{
|
||||||
/** @var \Image */
|
/** @var Image */
|
||||||
public $image;
|
public $image;
|
||||||
/** @var \User */
|
/** @var User */
|
||||||
public $owner;
|
public $owner;
|
||||||
|
|
||||||
public function __construct(Image $image, User $owner)
|
public function __construct(Image $image, User $owner)
|
||||||
|
@ -63,7 +63,7 @@ class OwnerSetEvent extends Event
|
||||||
|
|
||||||
class SourceSetEvent extends Event
|
class SourceSetEvent extends Event
|
||||||
{
|
{
|
||||||
/** @var \Image */
|
/** @var Image */
|
||||||
public $image;
|
public $image;
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public $source;
|
public $source;
|
||||||
|
@ -78,7 +78,7 @@ class SourceSetEvent extends Event
|
||||||
|
|
||||||
class TagSetEvent extends Event
|
class TagSetEvent extends Event
|
||||||
{
|
{
|
||||||
/** @var \Image */
|
/** @var Image */
|
||||||
public $image;
|
public $image;
|
||||||
public $tags;
|
public $tags;
|
||||||
public $metatags;
|
public $metatags;
|
||||||
|
@ -116,7 +116,7 @@ class TagSetEvent extends Event
|
||||||
|
|
||||||
class LockSetEvent extends Event
|
class LockSetEvent extends Event
|
||||||
{
|
{
|
||||||
/** @var \Image */
|
/** @var Image */
|
||||||
public $image;
|
public $image;
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
public $locked;
|
public $locked;
|
||||||
|
|
|
@ -140,7 +140,7 @@ class TaggerXML extends Extension
|
||||||
return $result."</list>";
|
return $result."</list>";
|
||||||
}
|
}
|
||||||
|
|
||||||
private function tag_to_xml(string $tag): string
|
private function tag_to_xml(PDORow $tag): string
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
"<tag ".
|
"<tag ".
|
||||||
|
|
|
@ -21,7 +21,7 @@ class UserBlockBuildingEvent extends Event
|
||||||
|
|
||||||
class UserPageBuildingEvent extends Event
|
class UserPageBuildingEvent extends Event
|
||||||
{
|
{
|
||||||
/** @var \User */
|
/** @var User */
|
||||||
public $display_user;
|
public $display_user;
|
||||||
/** @var array */
|
/** @var array */
|
||||||
public $stats = [];
|
public $stats = [];
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
class DisplayingImageEvent extends Event
|
class DisplayingImageEvent extends Event
|
||||||
{
|
{
|
||||||
/** @var \Image */
|
/** @var Image */
|
||||||
public $image;
|
public $image;
|
||||||
|
|
||||||
public function __construct(Image $image)
|
public function __construct(Image $image)
|
||||||
|
@ -34,9 +34,9 @@ class ImageInfoBoxBuildingEvent extends Event
|
||||||
{
|
{
|
||||||
/** @var array */
|
/** @var array */
|
||||||
public $parts = [];
|
public $parts = [];
|
||||||
/** @var \Image */
|
/** @var Image */
|
||||||
public $image;
|
public $image;
|
||||||
/** @var \User */
|
/** @var User */
|
||||||
public $user;
|
public $user;
|
||||||
|
|
||||||
public function __construct(Image $image, User $user)
|
public function __construct(Image $image, User $user)
|
||||||
|
@ -56,7 +56,7 @@ class ImageInfoBoxBuildingEvent extends Event
|
||||||
|
|
||||||
class ImageInfoSetEvent extends Event
|
class ImageInfoSetEvent extends Event
|
||||||
{
|
{
|
||||||
/** @var \Image */
|
/** @var Image */
|
||||||
public $image;
|
public $image;
|
||||||
|
|
||||||
public function __construct(Image $image)
|
public function __construct(Image $image)
|
||||||
|
@ -69,9 +69,9 @@ class ImageAdminBlockBuildingEvent extends Event
|
||||||
{
|
{
|
||||||
/** @var string[] */
|
/** @var string[] */
|
||||||
public $parts = [];
|
public $parts = [];
|
||||||
/** @var \Image|null */
|
/** @var ?Image */
|
||||||
public $image = null;
|
public $image = null;
|
||||||
/** @var null|\User */
|
/** @var ?User */
|
||||||
public $user = null;
|
public $user = null;
|
||||||
|
|
||||||
public function __construct(Image $image, User $user)
|
public function __construct(Image $image, User $user)
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
|
|
||||||
class WikiUpdateEvent extends Event
|
class WikiUpdateEvent extends Event
|
||||||
{
|
{
|
||||||
/** @var \User */
|
/** @var User */
|
||||||
public $user;
|
public $user;
|
||||||
/** @var \WikiPage */
|
/** @var WikiPage */
|
||||||
public $wikipage;
|
public $wikipage;
|
||||||
|
|
||||||
public function __construct(User $user, WikiPage $wikipage)
|
public function __construct(User $user, WikiPage $wikipage)
|
||||||
|
@ -490,6 +490,9 @@ class Wiki extends Extension
|
||||||
//return $nr1. " : $nr2 : - <font color='red' >".htmlentities( $value ) ."</font><br>";
|
//return $nr1. " : $nr2 : - <font color='red' >".htmlentities( $value ) ."</font><br>";
|
||||||
return "--- $value\n";
|
return "--- $value\n";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new Exception("stat needs to be =, + or -");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
|
@ -53,7 +53,7 @@ class CustomIndexTheme extends IndexTheme
|
||||||
return $h_search;
|
return $h_search;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function build_table(array $images, string $query): string
|
protected function build_table(array $images, ?string $query): string
|
||||||
{
|
{
|
||||||
$h_query = html_escape($query);
|
$h_query = html_escape($query);
|
||||||
$table = "<div class='shm-image-list' data-query='$h_query'>";
|
$table = "<div class='shm-image-list' data-query='$h_query'>";
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
class CustomCommentListTheme extends CommentListTheme
|
class CustomCommentListTheme extends CommentListTheme
|
||||||
{
|
{
|
||||||
public function display_comment_list($images, $page_number, $total_pages, $can_post)
|
public function display_comment_list(array $images, int $page_number, int $total_pages, bool $can_post)
|
||||||
{
|
{
|
||||||
global $config, $page, $user;
|
global $config, $page, $user;
|
||||||
|
|
||||||
|
@ -82,13 +82,13 @@ class CustomCommentListTheme extends CommentListTheme
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function display_recent_comments($comments)
|
public function display_recent_comments(array $comments)
|
||||||
{
|
{
|
||||||
// no recent comments in this theme
|
// no recent comments in this theme
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function comment_to_html(Comment $comment, $trim=false)
|
protected function comment_to_html(Comment $comment, bool $trim=false): string
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ class CustomIndexTheme extends IndexTheme
|
||||||
/**
|
/**
|
||||||
* #param Image[] $images
|
* #param Image[] $images
|
||||||
*/
|
*/
|
||||||
protected function build_table(array $images, string $query): string
|
protected function build_table(array $images, ?string $query): string
|
||||||
{
|
{
|
||||||
$h_query = html_escape($query);
|
$h_query = html_escape($query);
|
||||||
$table = "<div class='shm-image-list' data-query='$h_query'>";
|
$table = "<div class='shm-image-list' data-query='$h_query'>";
|
||||||
|
|
|
@ -4,7 +4,7 @@ class CustomCommentListTheme extends CommentListTheme
|
||||||
{
|
{
|
||||||
public $inner_id = 0;
|
public $inner_id = 0;
|
||||||
|
|
||||||
public function display_comment_list($images, $page_number, $total_pages, $can_post)
|
public function display_comment_list(array $images, int $page_number, int $total_pages, bool $can_post)
|
||||||
{
|
{
|
||||||
global $config, $page;
|
global $config, $page;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ class CustomCommentListTheme extends CommentListTheme
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function display_recent_comments($comments)
|
public function display_recent_comments(array $comments)
|
||||||
{
|
{
|
||||||
// sidebar fails in this theme
|
// sidebar fails in this theme
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ class CustomCommentListTheme extends CommentListTheme
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function comment_to_html(Comment $comment, $trim=false)
|
protected function comment_to_html(Comment $comment, bool $trim=false): string
|
||||||
{
|
{
|
||||||
$inner_id = $this->inner_id; // because custom themes can't add params, because PHP
|
$inner_id = $this->inner_id; // because custom themes can't add params, because PHP
|
||||||
global $user;
|
global $user;
|
||||||
|
|
|
@ -5,7 +5,7 @@ class Themelet extends BaseThemelet
|
||||||
/**
|
/**
|
||||||
* Add a generic paginator.
|
* Add a generic paginator.
|
||||||
*/
|
*/
|
||||||
public function display_paginator(Page $page, string $base, string $query, int $page_number, int $total_pages, bool $show_random = false)
|
public function display_paginator(Page $page, string $base, ?string $query, int $page_number, int $total_pages, bool $show_random = false)
|
||||||
{
|
{
|
||||||
if ($total_pages == 0) {
|
if ($total_pages == 0) {
|
||||||
$total_pages = 1;
|
$total_pages = 1;
|
||||||
|
|
|
@ -18,7 +18,7 @@ class Themelet extends BaseThemelet
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function display_paginator(Page $page, string $base, string $query, int $page_number, int $total_pages, bool $show_random = false)
|
public function display_paginator(Page $page, string $base, ?string $query, int $page_number, int $total_pages, bool $show_random = false)
|
||||||
{
|
{
|
||||||
if ($total_pages == 0) {
|
if ($total_pages == 0) {
|
||||||
$total_pages = 1;
|
$total_pages = 1;
|
||||||
|
@ -27,7 +27,7 @@ class Themelet extends BaseThemelet
|
||||||
$page->add_block(new Block(null, $body, "main", 90));
|
$page->add_block(new Block(null, $body, "main", 90));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function litetheme_gen_page_link(string $base_url, string $query, string $page, string $name, ?string $link_class=null): string
|
public function litetheme_gen_page_link(string $base_url, ?string $query, string $page, string $name, ?string $link_class=null): string
|
||||||
{
|
{
|
||||||
$link = make_link("$base_url/$page", $query);
|
$link = make_link("$base_url/$page", $query);
|
||||||
return "<a class='$link_class' href='$link'>$name</a>";
|
return "<a class='$link_class' href='$link'>$name</a>";
|
||||||
|
|
Reference in a new issue