remove more old comments
This commit is contained in:
parent
b568933f45
commit
ac5546c6ef
@ -74,7 +74,6 @@ if (is_readable("data/config/shimmie.conf.php")) {
|
|||||||
|
|
||||||
do_install();
|
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
|
function check_gd_version(): int
|
||||||
@ -99,10 +98,9 @@ function check_im_version(): int
|
|||||||
|
|
||||||
return (empty($convert_check) ? 0 : 1);
|
return (empty($convert_check) ? 0 : 1);
|
||||||
}
|
}
|
||||||
// }}}
|
|
||||||
|
|
||||||
function do_install()
|
function do_install()
|
||||||
{ // {{{
|
{
|
||||||
if (file_exists("data/config/auto_install.conf.php")) {
|
if (file_exists("data/config/auto_install.conf.php")) {
|
||||||
require_once "data/config/auto_install.conf.php";
|
require_once "data/config/auto_install.conf.php";
|
||||||
} elseif (@$_POST["database_type"] == DatabaseDriver::SQLITE) {
|
} elseif (@$_POST["database_type"] == DatabaseDriver::SQLITE) {
|
||||||
@ -118,10 +116,10 @@ function do_install()
|
|||||||
define("CACHE_DSN", null);
|
define("CACHE_DSN", null);
|
||||||
define("DATABASE_KA", true);
|
define("DATABASE_KA", true);
|
||||||
install_process();
|
install_process();
|
||||||
} // }}}
|
}
|
||||||
|
|
||||||
function ask_questions()
|
function ask_questions()
|
||||||
{ // {{{
|
{
|
||||||
$warnings = [];
|
$warnings = [];
|
||||||
$errors = [];
|
$errors = [];
|
||||||
|
|
||||||
@ -232,21 +230,21 @@ function ask_questions()
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
EOD;
|
EOD;
|
||||||
} // }}}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is where the install really takes place.
|
* This is where the install really takes place.
|
||||||
*/
|
*/
|
||||||
function install_process()
|
function install_process()
|
||||||
{ // {{{
|
{
|
||||||
build_dirs();
|
build_dirs();
|
||||||
create_tables();
|
create_tables();
|
||||||
insert_defaults();
|
insert_defaults();
|
||||||
write_config();
|
write_config();
|
||||||
} // }}}
|
}
|
||||||
|
|
||||||
function create_tables()
|
function create_tables()
|
||||||
{ // {{{
|
{
|
||||||
try {
|
try {
|
||||||
$db = new Database();
|
$db = new Database();
|
||||||
|
|
||||||
@ -331,10 +329,10 @@ EOD;
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
handle_db_errors(false, "An unknown error occurred while trying to insert data into the database.", $e->getMessage(), 4);
|
handle_db_errors(false, "An unknown error occurred while trying to insert data into the database.", $e->getMessage(), 4);
|
||||||
}
|
}
|
||||||
} // }}}
|
}
|
||||||
|
|
||||||
function insert_defaults()
|
function insert_defaults()
|
||||||
{ // {{{
|
{
|
||||||
try {
|
try {
|
||||||
$db = new Database();
|
$db = new Database();
|
||||||
|
|
||||||
@ -350,10 +348,10 @@ function insert_defaults()
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
handle_db_errors(false, "An unknown error occurred while trying to insert data into the database.", $e->getMessage(), 6);
|
handle_db_errors(false, "An unknown error occurred while trying to insert data into the database.", $e->getMessage(), 6);
|
||||||
}
|
}
|
||||||
} // }}}
|
}
|
||||||
|
|
||||||
function build_dirs()
|
function build_dirs()
|
||||||
{ // {{{
|
{
|
||||||
$data_exists = file_exists("data") || mkdir("data");
|
$data_exists = file_exists("data") || mkdir("data");
|
||||||
$data_writable = is_writable("data") || chmod("data", 0755);
|
$data_writable = is_writable("data") || chmod("data", 0755);
|
||||||
|
|
||||||
@ -373,10 +371,10 @@ function build_dirs()
|
|||||||
";
|
";
|
||||||
exit(7);
|
exit(7);
|
||||||
}
|
}
|
||||||
} // }}}
|
}
|
||||||
|
|
||||||
function write_config()
|
function write_config()
|
||||||
{ // {{{
|
{
|
||||||
$file_content = '<' . '?php' . "\n" .
|
$file_content = '<' . '?php' . "\n" .
|
||||||
"define('DATABASE_DSN', '".DATABASE_DSN."');\n" .
|
"define('DATABASE_DSN', '".DATABASE_DSN."');\n" .
|
||||||
'?' . '>';
|
'?' . '>';
|
||||||
@ -417,7 +415,7 @@ EOD;
|
|||||||
EOD;
|
EOD;
|
||||||
}
|
}
|
||||||
echo "\n";
|
echo "\n";
|
||||||
} // }}}
|
}
|
||||||
|
|
||||||
function handle_db_errors(bool $isPDO, string $errorMessage1, string $errorMessage2, int $exitCode)
|
function handle_db_errors(bool $isPDO, string $errorMessage1, string $errorMessage2, int $exitCode)
|
||||||
{
|
{
|
||||||
|
@ -367,7 +367,6 @@ class CommentList extends Extension
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// page building {{{
|
|
||||||
private function build_page(int $current_page)
|
private function build_page(int $current_page)
|
||||||
{
|
{
|
||||||
global $cache, $database, $user;
|
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));
|
$this->theme->display_comment_list($images, $current_page, $total_pages, $user->can(Permissions::CREATE_COMMENT));
|
||||||
}
|
}
|
||||||
// }}}
|
|
||||||
|
|
||||||
// get comments {{{
|
|
||||||
/**
|
/**
|
||||||
* #return Comment[]
|
* #return Comment[]
|
||||||
*/
|
*/
|
||||||
@ -488,9 +485,7 @@ class CommentList extends Extension
|
|||||||
ORDER BY comments.id ASC
|
ORDER BY comments.id ASC
|
||||||
", ["image_id"=>$image_id]);
|
", ["image_id"=>$image_id]);
|
||||||
}
|
}
|
||||||
// }}}
|
|
||||||
|
|
||||||
// add / remove / edit comments {{{
|
|
||||||
private function is_comment_limit_hit(): bool
|
private function is_comment_limit_hit(): bool
|
||||||
{
|
{
|
||||||
global $config, $database;
|
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.");
|
throw new CommentPostingException("Akismet thinks that your comment is spam. Try rewriting the comment, or logging in.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }}}
|
|
||||||
}
|
}
|
||||||
|
@ -159,8 +159,6 @@ class ImageIO extends Extension
|
|||||||
$event->panel->add_block($sb);
|
$event->panel->add_block($sb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// add image {{{
|
|
||||||
private function add_image(ImageAdditionEvent $event)
|
private function add_image(ImageAdditionEvent $event)
|
||||||
{
|
{
|
||||||
global $user, $database, $config;
|
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());
|
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)
|
private function send_file(int $image_id, string $type)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
@ -298,9 +294,7 @@ class ImageIO extends Extension
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }}} end fetch
|
|
||||||
|
|
||||||
// replace image {{{
|
|
||||||
private function replace_image(int $id, Image $image)
|
private function replace_image(int $id, Image $image)
|
||||||
{
|
{
|
||||||
global $database;
|
global $database;
|
||||||
@ -362,5 +356,4 @@ class ImageIO extends Extension
|
|||||||
|
|
||||||
log_info("image", "Replaced Image #{$id} with ({$image->hash})");
|
log_info("image", "Replaced Image #{$id} with ({$image->hash})");
|
||||||
}
|
}
|
||||||
// }}} end replace
|
}
|
||||||
} // end of class ImageIO
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// RemoveImageHashBanEvent {{{
|
|
||||||
class RemoveImageHashBanEvent extends Event
|
class RemoveImageHashBanEvent extends Event
|
||||||
{
|
{
|
||||||
public $hash;
|
public $hash;
|
||||||
@ -10,8 +9,7 @@ class RemoveImageHashBanEvent extends Event
|
|||||||
$this->hash = $hash;
|
$this->hash = $hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }}}
|
|
||||||
// AddImageHashBanEvent {{{
|
|
||||||
class AddImageHashBanEvent extends Event
|
class AddImageHashBanEvent extends Event
|
||||||
{
|
{
|
||||||
public $hash;
|
public $hash;
|
||||||
@ -23,7 +21,7 @@ class AddImageHashBanEvent extends Event
|
|||||||
$this->reason = $reason;
|
$this->reason = $reason;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }}}
|
|
||||||
class ImageBan extends Extension
|
class ImageBan extends Extension
|
||||||
{
|
{
|
||||||
public function onInitExt(InitExtEvent $event)
|
public function onInitExt(InitExtEvent $event)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// RemoveIPBanEvent {{{
|
|
||||||
class RemoveIPBanEvent extends Event
|
class RemoveIPBanEvent extends Event
|
||||||
{
|
{
|
||||||
public $id;
|
public $id;
|
||||||
@ -10,8 +9,7 @@ class RemoveIPBanEvent extends Event
|
|||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }}}
|
|
||||||
// AddIPBanEvent {{{
|
|
||||||
class AddIPBanEvent extends Event
|
class AddIPBanEvent extends Event
|
||||||
{
|
{
|
||||||
public $ip;
|
public $ip;
|
||||||
@ -25,7 +23,6 @@ class AddIPBanEvent extends Event
|
|||||||
$this->end = trim($end);
|
$this->end = trim($end);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }}}
|
|
||||||
|
|
||||||
class IPBan extends Extension
|
class IPBan extends Extension
|
||||||
{
|
{
|
||||||
@ -131,7 +128,6 @@ class IPBan extends Extension
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// installer {{{
|
|
||||||
protected function install()
|
protected function install()
|
||||||
{
|
{
|
||||||
global $database;
|
global $database;
|
||||||
@ -209,8 +205,7 @@ class IPBan extends Extension
|
|||||||
$config->set_int("ext_ipban_version", 8);
|
$config->set_int("ext_ipban_version", 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }}}
|
|
||||||
// deal with banned person {{{
|
|
||||||
private function check_ip_ban()
|
private function check_ip_ban()
|
||||||
{
|
{
|
||||||
$remote = $_SERVER['REMOTE_ADDR'];
|
$remote = $_SERVER['REMOTE_ADDR'];
|
||||||
@ -266,8 +261,7 @@ class IPBan extends Extension
|
|||||||
log_error("ipban", "block($remote) called but no bans matched");
|
log_error("ipban", "block($remote) called but no bans matched");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
// }}}
|
|
||||||
// database {{{
|
|
||||||
private function get_bans()
|
private function get_bans()
|
||||||
{
|
{
|
||||||
global $database;
|
global $database;
|
||||||
@ -328,5 +322,4 @@ class IPBan extends Extension
|
|||||||
$cache->set("ip_bans_sorted", $sorted, 600);
|
$cache->set("ip_bans_sorted", $sorted, 600);
|
||||||
return $sorted;
|
return $sorted;
|
||||||
}
|
}
|
||||||
// }}}
|
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
include_once "config.php";
|
include_once "config.php";
|
||||||
|
|
||||||
/* ConfigSaveEvent {{{
|
/*
|
||||||
*
|
|
||||||
* Sent when the setup screen's 'set' button has been
|
* Sent when the setup screen's 'set' button has been
|
||||||
* activated; new config options are in $_POST
|
* activated; new config options are in $_POST
|
||||||
*/
|
*/
|
||||||
@ -17,9 +16,8 @@ class ConfigSaveEvent extends Event
|
|||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }}}
|
|
||||||
/* SetupBuildingEvent {{{
|
/*
|
||||||
*
|
|
||||||
* Sent when the setup page is ready to be added to
|
* Sent when the setup page is ready to be added to
|
||||||
*/
|
*/
|
||||||
class SetupBuildingEvent extends Event
|
class SetupBuildingEvent extends Event
|
||||||
@ -32,10 +30,7 @@ class SetupBuildingEvent extends Event
|
|||||||
$this->panel = $panel;
|
$this->panel = $panel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }}}
|
|
||||||
/* SetupPanel {{{
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class SetupPanel
|
class SetupPanel
|
||||||
{
|
{
|
||||||
/** @var SetupBlock[] */
|
/** @var SetupBlock[] */
|
||||||
@ -46,10 +41,7 @@ class SetupPanel
|
|||||||
$this->blocks[] = $block;
|
$this->blocks[] = $block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }}}
|
|
||||||
/* SetupBlock {{{
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class SetupBlock extends Block
|
class SetupBlock extends Block
|
||||||
{
|
{
|
||||||
/** @var string */
|
/** @var string */
|
||||||
@ -57,8 +49,6 @@ class SetupBlock extends Block
|
|||||||
/** @var string */
|
/** @var string */
|
||||||
public $body;
|
public $body;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function __construct(string $title)
|
public function __construct(string $title)
|
||||||
{
|
{
|
||||||
$this->header = $title;
|
$this->header = $title;
|
||||||
@ -134,8 +124,6 @@ class SetupBlock extends Block
|
|||||||
$this->end_table_header_cell();
|
$this->end_table_header_cell();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private function format_option(string $name, $html, ?string $label, bool $table_row)
|
private function format_option(string $name, $html, ?string $label, bool $table_row)
|
||||||
{
|
{
|
||||||
if ($table_row) {
|
if ($table_row) {
|
||||||
@ -274,7 +262,6 @@ class SetupBlock extends Block
|
|||||||
$this->format_option($name, $html, $label, $table_row);
|
$this->format_option($name, $html, $label, $table_row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }}}
|
|
||||||
|
|
||||||
class Setup extends Extension
|
class Setup extends Extension
|
||||||
{
|
{
|
||||||
|
@ -159,8 +159,7 @@ class TagList extends Extension
|
|||||||
$sb->end_table();
|
$sb->end_table();
|
||||||
$event->panel->add_block($sb);
|
$event->panel->add_block($sb);
|
||||||
}
|
}
|
||||||
// }}}
|
|
||||||
// misc {{{
|
|
||||||
private function tag_link(string $tag): string
|
private function tag_link(string $tag): string
|
||||||
{
|
{
|
||||||
$u_tag = url_escape($tag);
|
$u_tag = url_escape($tag);
|
||||||
@ -253,8 +252,6 @@ class TagList extends Extension
|
|||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
// }}}
|
|
||||||
// maps {{{
|
|
||||||
|
|
||||||
private function build_navigation(): string
|
private function build_navigation(): string
|
||||||
{
|
{
|
||||||
@ -453,8 +450,7 @@ class TagList extends Extension
|
|||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
// }}}
|
|
||||||
// blocks {{{
|
|
||||||
private function add_related_block(Page $page, Image $image): void
|
private function add_related_block(Page $page, Image $image): void
|
||||||
{
|
{
|
||||||
global $database, $config;
|
global $database, $config;
|
||||||
@ -653,7 +649,4 @@ class TagList extends Extension
|
|||||||
return $related_tags;
|
return $related_tags;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// }}}
|
|
||||||
}
|
}
|
||||||
|
@ -291,8 +291,6 @@ class Upload extends Extension
|
|||||||
return $tags;
|
return $tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
// do things {{{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a descriptive error message for the specified PHP error code.
|
* Returns a descriptive error message for the specified PHP error code.
|
||||||
*
|
*
|
||||||
@ -475,5 +473,4 @@ class Upload extends Extension
|
|||||||
|
|
||||||
return $ok;
|
return $ok;
|
||||||
}
|
}
|
||||||
// }}}
|
|
||||||
}
|
}
|
||||||
|
@ -339,8 +339,7 @@ class UserPage extends Extension
|
|||||||
$this->theme->display_user_block($page, $user, $ubbe->parts);
|
$this->theme->display_user_block($page, $user, $ubbe->parts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }}}
|
|
||||||
// Things done *with* the user {{{
|
|
||||||
private function page_login($name, $pass)
|
private function page_login($name, $pass)
|
||||||
{
|
{
|
||||||
global $config, $page;
|
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
|
private function user_can_edit_user(User $a, User $b): bool
|
||||||
{
|
{
|
||||||
if ($a->is_anonymous()) {
|
if ($a->is_anonymous()) {
|
||||||
@ -581,8 +579,7 @@ class UserPage extends Extension
|
|||||||
$this->redirect_to_user($duser);
|
$this->redirect_to_user($duser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }}}
|
|
||||||
// ips {{{
|
|
||||||
private function count_upload_ips(User $duser): array
|
private function count_upload_ips(User $duser): array
|
||||||
{
|
{
|
||||||
global $database;
|
global $database;
|
||||||
@ -683,5 +680,4 @@ class UserPage extends Extension
|
|||||||
$page->set_redirect(make_link("post/list"));
|
$page->set_redirect(make_link("post/list"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }}}
|
|
||||||
}
|
}
|
||||||
|
@ -339,7 +339,6 @@ class UserPageTheme extends Themelet
|
|||||||
}
|
}
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
// }}}
|
|
||||||
|
|
||||||
public function get_help_html()
|
public function get_help_html()
|
||||||
{
|
{
|
||||||
|
@ -265,7 +265,6 @@ class Wiki extends Extension
|
|||||||
return new WikiPage($row);
|
return new WikiPage($row);
|
||||||
}
|
}
|
||||||
|
|
||||||
// php-diff {{{
|
|
||||||
/**
|
/**
|
||||||
Diff implemented in pure php, written from scratch.
|
Diff implemented in pure php, written from scratch.
|
||||||
Copyright (C) 2003 Daniel Unterberger <diff.phpnet@holomind.de>
|
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 -");
|
throw new Exception("stat needs to be =, + or -");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }}}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user