remove more old comments

This commit is contained in:
Shish 2019-11-03 16:22:59 +00:00
parent b568933f45
commit ac5546c6ef
11 changed files with 31 additions and 85 deletions

View file

@ -74,8 +74,7 @@ if (is_readable("data/config/shimmie.conf.php")) {
do_install();
// utilities {{{
// TODO: Can some of these be pushed into "core/???.inc.php" ?
// TODO: Can some of these be pushed into "core/???.inc.php" ?
function check_gd_version(): int
{
@ -99,10 +98,9 @@ function check_im_version(): int
return (empty($convert_check) ? 0 : 1);
}
// }}}
function do_install()
{ // {{{
{
if (file_exists("data/config/auto_install.conf.php")) {
require_once "data/config/auto_install.conf.php";
} elseif (@$_POST["database_type"] == DatabaseDriver::SQLITE) {
@ -118,10 +116,10 @@ function do_install()
define("CACHE_DSN", null);
define("DATABASE_KA", true);
install_process();
} // }}}
}
function ask_questions()
{ // {{{
{
$warnings = [];
$errors = [];
@ -232,21 +230,21 @@ function ask_questions()
</div>
</div>
EOD;
} // }}}
}
/**
* This is where the install really takes place.
*/
function install_process()
{ // {{{
{
build_dirs();
create_tables();
insert_defaults();
write_config();
} // }}}
}
function create_tables()
{ // {{{
{
try {
$db = new Database();
@ -331,10 +329,10 @@ EOD;
} catch (Exception $e) {
handle_db_errors(false, "An unknown error occurred while trying to insert data into the database.", $e->getMessage(), 4);
}
} // }}}
}
function insert_defaults()
{ // {{{
{
try {
$db = new Database();
@ -350,10 +348,10 @@ function insert_defaults()
} catch (Exception $e) {
handle_db_errors(false, "An unknown error occurred while trying to insert data into the database.", $e->getMessage(), 6);
}
} // }}}
}
function build_dirs()
{ // {{{
{
$data_exists = file_exists("data") || mkdir("data");
$data_writable = is_writable("data") || chmod("data", 0755);
@ -373,10 +371,10 @@ function build_dirs()
";
exit(7);
}
} // }}}
}
function write_config()
{ // {{{
{
$file_content = '<' . '?php' . "\n" .
"define('DATABASE_DSN', '".DATABASE_DSN."');\n" .
'?' . '>';
@ -417,7 +415,7 @@ EOD;
EOD;
}
echo "\n";
} // }}}
}
function handle_db_errors(bool $isPDO, string $errorMessage1, string $errorMessage2, int $exitCode)
{

View file

@ -367,7 +367,6 @@ class CommentList extends Extension
}
}
// page building {{{
private function build_page(int $current_page)
{
global $cache, $database, $user;
@ -417,9 +416,7 @@ class CommentList extends Extension
$this->theme->display_comment_list($images, $current_page, $total_pages, $user->can(Permissions::CREATE_COMMENT));
}
// }}}
// get comments {{{
/**
* #return Comment[]
*/
@ -488,9 +485,7 @@ class CommentList extends Extension
ORDER BY comments.id ASC
", ["image_id"=>$image_id]);
}
// }}}
// add / remove / edit comments {{{
private function is_comment_limit_hit(): bool
{
global $config, $database;
@ -651,5 +646,4 @@ class CommentList extends Extension
throw new CommentPostingException("Akismet thinks that your comment is spam. Try rewriting the comment, or logging in.");
}
}
// }}}
}

View file

@ -159,8 +159,6 @@ class ImageIO extends Extension
$event->panel->add_block($sb);
}
// add image {{{
private function add_image(ImageAdditionEvent $event)
{
global $user, $database, $config;
@ -237,9 +235,7 @@ class ImageIO extends Extension
log_warning("add_image", "Error while running update_image_media_properties: ".$e->getMessage());
}
}
// }}} end add
// fetch image {{{
private function send_file(int $image_id, string $type)
{
global $config;
@ -298,9 +294,7 @@ class ImageIO extends Extension
));
}
}
// }}} end fetch
// replace image {{{
private function replace_image(int $id, Image $image)
{
global $database;
@ -362,5 +356,4 @@ class ImageIO extends Extension
log_info("image", "Replaced Image #{$id} with ({$image->hash})");
}
// }}} end replace
} // end of class ImageIO
}

View file

@ -1,6 +1,5 @@
<?php
// RemoveImageHashBanEvent {{{
class RemoveImageHashBanEvent extends Event
{
public $hash;
@ -10,8 +9,7 @@ class RemoveImageHashBanEvent extends Event
$this->hash = $hash;
}
}
// }}}
// AddImageHashBanEvent {{{
class AddImageHashBanEvent extends Event
{
public $hash;
@ -23,7 +21,7 @@ class AddImageHashBanEvent extends Event
$this->reason = $reason;
}
}
// }}}
class ImageBan extends Extension
{
public function onInitExt(InitExtEvent $event)

View file

@ -1,6 +1,5 @@
<?php
// RemoveIPBanEvent {{{
class RemoveIPBanEvent extends Event
{
public $id;
@ -10,8 +9,7 @@ class RemoveIPBanEvent extends Event
$this->id = $id;
}
}
// }}}
// AddIPBanEvent {{{
class AddIPBanEvent extends Event
{
public $ip;
@ -25,7 +23,6 @@ class AddIPBanEvent extends Event
$this->end = trim($end);
}
}
// }}}
class IPBan extends Extension
{
@ -131,7 +128,6 @@ class IPBan extends Extension
}
}
// installer {{{
protected function install()
{
global $database;
@ -209,8 +205,7 @@ class IPBan extends Extension
$config->set_int("ext_ipban_version", 8);
}
}
// }}}
// deal with banned person {{{
private function check_ip_ban()
{
$remote = $_SERVER['REMOTE_ADDR'];
@ -266,8 +261,7 @@ class IPBan extends Extension
log_error("ipban", "block($remote) called but no bans matched");
exit;
}
// }}}
// database {{{
private function get_bans()
{
global $database;
@ -328,5 +322,4 @@ class IPBan extends Extension
$cache->set("ip_bans_sorted", $sorted, 600);
return $sorted;
}
// }}}
}

View file

@ -2,8 +2,7 @@
include_once "config.php";
/* ConfigSaveEvent {{{
*
/*
* Sent when the setup screen's 'set' button has been
* activated; new config options are in $_POST
*/
@ -17,9 +16,8 @@ class ConfigSaveEvent extends Event
$this->config = $config;
}
}
// }}}
/* SetupBuildingEvent {{{
*
/*
* Sent when the setup page is ready to be added to
*/
class SetupBuildingEvent extends Event
@ -32,10 +30,7 @@ class SetupBuildingEvent extends Event
$this->panel = $panel;
}
}
// }}}
/* SetupPanel {{{
*
*/
class SetupPanel
{
/** @var SetupBlock[] */
@ -46,10 +41,7 @@ class SetupPanel
$this->blocks[] = $block;
}
}
// }}}
/* SetupBlock {{{
*
*/
class SetupBlock extends Block
{
/** @var string */
@ -57,8 +49,6 @@ class SetupBlock extends Block
/** @var string */
public $body;
public function __construct(string $title)
{
$this->header = $title;
@ -134,8 +124,6 @@ class SetupBlock extends Block
$this->end_table_header_cell();
}
private function format_option(string $name, $html, ?string $label, bool $table_row)
{
if ($table_row) {
@ -274,7 +262,6 @@ class SetupBlock extends Block
$this->format_option($name, $html, $label, $table_row);
}
}
// }}}
class Setup extends Extension
{

View file

@ -159,8 +159,7 @@ class TagList extends Extension
$sb->end_table();
$event->panel->add_block($sb);
}
// }}}
// misc {{{
private function tag_link(string $tag): string
{
$u_tag = url_escape($tag);
@ -253,8 +252,6 @@ class TagList extends Extension
return $html;
}
// }}}
// maps {{{
private function build_navigation(): string
{
@ -453,8 +450,7 @@ class TagList extends Extension
return $html;
}
// }}}
// blocks {{{
private function add_related_block(Page $page, Image $image): void
{
global $database, $config;
@ -653,7 +649,4 @@ class TagList extends Extension
return $related_tags;
}
}
// }}}
}

View file

@ -291,8 +291,6 @@ class Upload extends Extension
return $tags;
}
// do things {{{
/**
* Returns a descriptive error message for the specified PHP error code.
*
@ -475,5 +473,4 @@ class Upload extends Extension
return $ok;
}
// }}}
}

View file

@ -339,8 +339,7 @@ class UserPage extends Extension
$this->theme->display_user_block($page, $user, $ubbe->parts);
}
}
// }}}
// Things done *with* the user {{{
private function page_login($name, $pass)
{
global $config, $page;
@ -490,8 +489,7 @@ class UserPage extends Extension
'/'
);
}
//}}}
// Things done *to* the user {{{
private function user_can_edit_user(User $a, User $b): bool
{
if ($a->is_anonymous()) {
@ -581,8 +579,7 @@ class UserPage extends Extension
$this->redirect_to_user($duser);
}
}
// }}}
// ips {{{
private function count_upload_ips(User $duser): array
{
global $database;
@ -683,5 +680,4 @@ class UserPage extends Extension
$page->set_redirect(make_link("post/list"));
}
}
// }}}
}

View file

@ -339,7 +339,6 @@ class UserPageTheme extends Themelet
}
return $html;
}
// }}}
public function get_help_html()
{

View file

@ -265,7 +265,6 @@ class Wiki extends Extension
return new WikiPage($row);
}
// php-diff {{{
/**
Diff implemented in pure php, written from scratch.
Copyright (C) 2003 Daniel Unterberger <diff.phpnet@holomind.de>
@ -502,5 +501,4 @@ class Wiki extends Extension
throw new Exception("stat needs to be =, + or -");
}
}
// }}}
}