new php-cs-fixer, new opinions about what is today's preferred format...
This commit is contained in:
parent
ebc78f8996
commit
4ff93c63c3
25 changed files with 659 additions and 979 deletions
|
@ -53,7 +53,7 @@
|
|||
|
||||
"require-dev" : {
|
||||
"phpunit/phpunit" : "^9.0",
|
||||
"friendsofphp/php-cs-fixer" : "^3.4"
|
||||
"friendsofphp/php-cs-fixer" : "^3.12"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-memcache": "memcache caching",
|
||||
|
|
976
composer.lock
generated
976
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -522,14 +522,15 @@ function parse_shorthand_int(string $limit): int
|
|||
switch (strtolower($m[2])) {
|
||||
/** @noinspection PhpMissingBreakStatementInspection */
|
||||
case 't': $value *= 1024; // fall through
|
||||
/** @noinspection PhpMissingBreakStatementInspection */
|
||||
/** @noinspection PhpMissingBreakStatementInspection */
|
||||
// no break
|
||||
case 'g': $value *= 1024; // fall through
|
||||
/** @noinspection PhpMissingBreakStatementInspection */
|
||||
/** @noinspection PhpMissingBreakStatementInspection */
|
||||
// no break
|
||||
case 'm': $value *= 1024; // fall through
|
||||
// no break
|
||||
case 'k': $value *= 1024; break;
|
||||
case 'k': $value *= 1024;
|
||||
break;
|
||||
default: $value = -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
use MicroHTML\HTMLElement;
|
||||
|
||||
use function MicroHTML\emptyHTML;
|
||||
use function MicroHTML\rawHTML;
|
||||
use function MicroHTML\FORM;
|
||||
|
|
|
@ -163,256 +163,256 @@ class Artists extends Extension
|
|||
switch ($event->get_arg(0)) {
|
||||
//*************ARTIST SECTION**************
|
||||
case "list":
|
||||
{
|
||||
$this->get_listing($page, $event);
|
||||
$this->theme->sidebar_options("neutral");
|
||||
break;
|
||||
}
|
||||
{
|
||||
$this->get_listing($page, $event);
|
||||
$this->theme->sidebar_options("neutral");
|
||||
break;
|
||||
}
|
||||
case "new":
|
||||
{
|
||||
if (!$user->is_anonymous()) {
|
||||
$this->theme->new_artist_composer();
|
||||
} else {
|
||||
$this->theme->display_error(401, "Error", "You must be registered and logged in to create a new artist.");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "new_artist":
|
||||
{
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/new"));
|
||||
break;
|
||||
}
|
||||
case "create":
|
||||
{
|
||||
if (!$user->is_anonymous()) {
|
||||
$newArtistID = $this->add_artist();
|
||||
if ($newArtistID == -1) {
|
||||
$this->theme->display_error(400, "Error", "Error when entering artist data.");
|
||||
{
|
||||
if (!$user->is_anonymous()) {
|
||||
$this->theme->new_artist_composer();
|
||||
} else {
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/view/".$newArtistID));
|
||||
$this->theme->display_error(401, "Error", "You must be registered and logged in to create a new artist.");
|
||||
}
|
||||
} else {
|
||||
$this->theme->display_error(401, "Error", "You must be registered and logged in to create a new artist.");
|
||||
break;
|
||||
}
|
||||
case "new_artist":
|
||||
{
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/new"));
|
||||
break;
|
||||
}
|
||||
case "create":
|
||||
{
|
||||
if (!$user->is_anonymous()) {
|
||||
$newArtistID = $this->add_artist();
|
||||
if ($newArtistID == -1) {
|
||||
$this->theme->display_error(400, "Error", "Error when entering artist data.");
|
||||
} else {
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/view/".$newArtistID));
|
||||
}
|
||||
} else {
|
||||
$this->theme->display_error(401, "Error", "You must be registered and logged in to create a new artist.");
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case "view":
|
||||
{
|
||||
$artistID = int_escape($event->get_arg(1));
|
||||
$artist = $this->get_artist($artistID);
|
||||
$aliases = $this->get_alias($artist['id']);
|
||||
$members = $this->get_members($artist['id']);
|
||||
$urls = $this->get_urls($artist['id']);
|
||||
{
|
||||
$artistID = int_escape($event->get_arg(1));
|
||||
$artist = $this->get_artist($artistID);
|
||||
$aliases = $this->get_alias($artist['id']);
|
||||
$members = $this->get_members($artist['id']);
|
||||
$urls = $this->get_urls($artist['id']);
|
||||
|
||||
$userIsLogged = !$user->is_anonymous();
|
||||
$userIsAdmin = $user->can(Permissions::ARTISTS_ADMIN);
|
||||
$userIsLogged = !$user->is_anonymous();
|
||||
$userIsAdmin = $user->can(Permissions::ARTISTS_ADMIN);
|
||||
|
||||
$images = Image::find_images(0, 4, Tag::explode($artist['name']));
|
||||
$images = Image::find_images(0, 4, Tag::explode($artist['name']));
|
||||
|
||||
$this->theme->show_artist($artist, $aliases, $members, $urls, $images, $userIsLogged, $userIsAdmin);
|
||||
/*
|
||||
if ($userIsLogged) {
|
||||
$this->theme->show_new_alias_composer($artistID);
|
||||
$this->theme->show_new_member_composer($artistID);
|
||||
$this->theme->show_new_url_composer($artistID);
|
||||
$this->theme->show_artist($artist, $aliases, $members, $urls, $images, $userIsLogged, $userIsAdmin);
|
||||
/*
|
||||
if ($userIsLogged) {
|
||||
$this->theme->show_new_alias_composer($artistID);
|
||||
$this->theme->show_new_member_composer($artistID);
|
||||
$this->theme->show_new_url_composer($artistID);
|
||||
}
|
||||
*/
|
||||
|
||||
$this->theme->sidebar_options("editor", $artistID, $userIsAdmin);
|
||||
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
$this->theme->sidebar_options("editor", $artistID, $userIsAdmin);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case "edit":
|
||||
{
|
||||
$artistID = int_escape($event->get_arg(1));
|
||||
$artist = $this->get_artist($artistID);
|
||||
$aliases = $this->get_alias($artistID);
|
||||
$members = $this->get_members($artistID);
|
||||
$urls = $this->get_urls($artistID);
|
||||
{
|
||||
$artistID = int_escape($event->get_arg(1));
|
||||
$artist = $this->get_artist($artistID);
|
||||
$aliases = $this->get_alias($artistID);
|
||||
$members = $this->get_members($artistID);
|
||||
$urls = $this->get_urls($artistID);
|
||||
|
||||
if (!$user->is_anonymous()) {
|
||||
$this->theme->show_artist_editor($artist, $aliases, $members, $urls);
|
||||
if (!$user->is_anonymous()) {
|
||||
$this->theme->show_artist_editor($artist, $aliases, $members, $urls);
|
||||
|
||||
$userIsAdmin = $user->can(Permissions::ARTISTS_ADMIN);
|
||||
$this->theme->sidebar_options("editor", $artistID, $userIsAdmin);
|
||||
} else {
|
||||
$this->theme->display_error(401, "Error", "You must be registered and logged in to edit an artist.");
|
||||
$userIsAdmin = $user->can(Permissions::ARTISTS_ADMIN);
|
||||
$this->theme->sidebar_options("editor", $artistID, $userIsAdmin);
|
||||
} else {
|
||||
$this->theme->display_error(401, "Error", "You must be registered and logged in to edit an artist.");
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "edit_artist":
|
||||
{
|
||||
$artistID = $_POST['artist_id'];
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/edit/".$artistID));
|
||||
break;
|
||||
}
|
||||
{
|
||||
$artistID = $_POST['artist_id'];
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/edit/".$artistID));
|
||||
break;
|
||||
}
|
||||
case "edited":
|
||||
{
|
||||
$artistID = int_escape($_POST['id']);
|
||||
$this->update_artist();
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/view/".$artistID));
|
||||
break;
|
||||
}
|
||||
{
|
||||
$artistID = int_escape($_POST['id']);
|
||||
$this->update_artist();
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/view/".$artistID));
|
||||
break;
|
||||
}
|
||||
case "nuke_artist":
|
||||
{
|
||||
$artistID = $_POST['artist_id'];
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/nuke/".$artistID));
|
||||
break;
|
||||
}
|
||||
{
|
||||
$artistID = $_POST['artist_id'];
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/nuke/".$artistID));
|
||||
break;
|
||||
}
|
||||
case "nuke":
|
||||
{
|
||||
$artistID = int_escape($event->get_arg(1));
|
||||
$this->delete_artist($artistID); // this will delete the artist, its alias, its urls and its members
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/list"));
|
||||
break;
|
||||
}
|
||||
{
|
||||
$artistID = int_escape($event->get_arg(1));
|
||||
$this->delete_artist($artistID); // this will delete the artist, its alias, its urls and its members
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/list"));
|
||||
break;
|
||||
}
|
||||
case "add_alias":
|
||||
{
|
||||
$artistID = $_POST['artist_id'];
|
||||
$this->theme->show_new_alias_composer($artistID);
|
||||
break;
|
||||
}
|
||||
{
|
||||
$artistID = $_POST['artist_id'];
|
||||
$this->theme->show_new_alias_composer($artistID);
|
||||
break;
|
||||
}
|
||||
case "add_member":
|
||||
{
|
||||
$artistID = $_POST['artist_id'];
|
||||
$this->theme->show_new_member_composer($artistID);
|
||||
break;
|
||||
}
|
||||
{
|
||||
$artistID = $_POST['artist_id'];
|
||||
$this->theme->show_new_member_composer($artistID);
|
||||
break;
|
||||
}
|
||||
case "add_url":
|
||||
{
|
||||
$artistID = $_POST['artist_id'];
|
||||
$this->theme->show_new_url_composer($artistID);
|
||||
break;
|
||||
}
|
||||
//***********ALIAS SECTION ***********************
|
||||
{
|
||||
$artistID = $_POST['artist_id'];
|
||||
$this->theme->show_new_url_composer($artistID);
|
||||
break;
|
||||
}
|
||||
//***********ALIAS SECTION ***********************
|
||||
case "alias":
|
||||
{
|
||||
switch ($event->get_arg(1)) {
|
||||
case "add":
|
||||
{
|
||||
$artistID = $_POST['artistID'];
|
||||
$this->add_alias();
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/view/".$artistID));
|
||||
break;
|
||||
}
|
||||
case "delete":
|
||||
{
|
||||
$aliasID = int_escape($event->get_arg(2));
|
||||
$artistID = $this->get_artistID_by_aliasID($aliasID);
|
||||
$this->delete_alias($aliasID);
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/view/".$artistID));
|
||||
break;
|
||||
}
|
||||
case "edit":
|
||||
{
|
||||
$aliasID = int_escape($event->get_arg(2));
|
||||
$alias = $this->get_alias_by_id($aliasID);
|
||||
$this->theme->show_alias_editor($alias);
|
||||
break;
|
||||
}
|
||||
case "edited":
|
||||
{
|
||||
$this->update_alias();
|
||||
$aliasID = int_escape($_POST['aliasID']);
|
||||
$artistID = $this->get_artistID_by_aliasID($aliasID);
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/view/".$artistID));
|
||||
break;
|
||||
{
|
||||
switch ($event->get_arg(1)) {
|
||||
case "add":
|
||||
{
|
||||
$artistID = $_POST['artistID'];
|
||||
$this->add_alias();
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/view/".$artistID));
|
||||
break;
|
||||
}
|
||||
case "delete":
|
||||
{
|
||||
$aliasID = int_escape($event->get_arg(2));
|
||||
$artistID = $this->get_artistID_by_aliasID($aliasID);
|
||||
$this->delete_alias($aliasID);
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/view/".$artistID));
|
||||
break;
|
||||
}
|
||||
case "edit":
|
||||
{
|
||||
$aliasID = int_escape($event->get_arg(2));
|
||||
$alias = $this->get_alias_by_id($aliasID);
|
||||
$this->theme->show_alias_editor($alias);
|
||||
break;
|
||||
}
|
||||
case "edited":
|
||||
{
|
||||
$this->update_alias();
|
||||
$aliasID = int_escape($_POST['aliasID']);
|
||||
$artistID = $this->get_artistID_by_aliasID($aliasID);
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/view/".$artistID));
|
||||
break;
|
||||
}
|
||||
}
|
||||
break; // case: alias
|
||||
}
|
||||
break; // case: alias
|
||||
}
|
||||
|
||||
//**************** URLS SECTION **********************
|
||||
//**************** URLS SECTION **********************
|
||||
case "url":
|
||||
{
|
||||
switch ($event->get_arg(1)) {
|
||||
case "add":
|
||||
{
|
||||
$artistID = $_POST['artistID'];
|
||||
$this->add_urls();
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/view/".$artistID));
|
||||
break;
|
||||
}
|
||||
case "delete":
|
||||
{
|
||||
$urlID = int_escape($event->get_arg(2));
|
||||
$artistID = $this->get_artistID_by_urlID($urlID);
|
||||
$this->delete_url($urlID);
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/view/".$artistID));
|
||||
break;
|
||||
}
|
||||
case "edit":
|
||||
{
|
||||
$urlID = int_escape($event->get_arg(2));
|
||||
$url = $this->get_url_by_id($urlID);
|
||||
$this->theme->show_url_editor($url);
|
||||
break;
|
||||
}
|
||||
case "edited":
|
||||
{
|
||||
$this->update_url();
|
||||
$urlID = int_escape($_POST['urlID']);
|
||||
$artistID = $this->get_artistID_by_urlID($urlID);
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/view/".$artistID));
|
||||
break;
|
||||
{
|
||||
switch ($event->get_arg(1)) {
|
||||
case "add":
|
||||
{
|
||||
$artistID = $_POST['artistID'];
|
||||
$this->add_urls();
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/view/".$artistID));
|
||||
break;
|
||||
}
|
||||
case "delete":
|
||||
{
|
||||
$urlID = int_escape($event->get_arg(2));
|
||||
$artistID = $this->get_artistID_by_urlID($urlID);
|
||||
$this->delete_url($urlID);
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/view/".$artistID));
|
||||
break;
|
||||
}
|
||||
case "edit":
|
||||
{
|
||||
$urlID = int_escape($event->get_arg(2));
|
||||
$url = $this->get_url_by_id($urlID);
|
||||
$this->theme->show_url_editor($url);
|
||||
break;
|
||||
}
|
||||
case "edited":
|
||||
{
|
||||
$this->update_url();
|
||||
$urlID = int_escape($_POST['urlID']);
|
||||
$artistID = $this->get_artistID_by_urlID($urlID);
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/view/".$artistID));
|
||||
break;
|
||||
}
|
||||
}
|
||||
break; // case: urls
|
||||
}
|
||||
break; // case: urls
|
||||
}
|
||||
//******************* MEMBERS SECTION *********************
|
||||
//******************* MEMBERS SECTION *********************
|
||||
case "member":
|
||||
{
|
||||
switch ($event->get_arg(1)) {
|
||||
case "add":
|
||||
{
|
||||
$artistID = $_POST['artistID'];
|
||||
$this->add_members();
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/view/".$artistID));
|
||||
break;
|
||||
}
|
||||
case "delete":
|
||||
{
|
||||
$memberID = int_escape($event->get_arg(2));
|
||||
$artistID = $this->get_artistID_by_memberID($memberID);
|
||||
$this->delete_member($memberID);
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/view/".$artistID));
|
||||
break;
|
||||
}
|
||||
case "edit":
|
||||
{
|
||||
$memberID = int_escape($event->get_arg(2));
|
||||
$member = $this->get_member_by_id($memberID);
|
||||
$this->theme->show_member_editor($member);
|
||||
break;
|
||||
}
|
||||
case "edited":
|
||||
{
|
||||
$this->update_member();
|
||||
$memberID = int_escape($_POST['memberID']);
|
||||
$artistID = $this->get_artistID_by_memberID($memberID);
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/view/".$artistID));
|
||||
break;
|
||||
{
|
||||
switch ($event->get_arg(1)) {
|
||||
case "add":
|
||||
{
|
||||
$artistID = $_POST['artistID'];
|
||||
$this->add_members();
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/view/".$artistID));
|
||||
break;
|
||||
}
|
||||
case "delete":
|
||||
{
|
||||
$memberID = int_escape($event->get_arg(2));
|
||||
$artistID = $this->get_artistID_by_memberID($memberID);
|
||||
$this->delete_member($memberID);
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/view/".$artistID));
|
||||
break;
|
||||
}
|
||||
case "edit":
|
||||
{
|
||||
$memberID = int_escape($event->get_arg(2));
|
||||
$member = $this->get_member_by_id($memberID);
|
||||
$this->theme->show_member_editor($member);
|
||||
break;
|
||||
}
|
||||
case "edited":
|
||||
{
|
||||
$this->update_member();
|
||||
$memberID = int_escape($_POST['memberID']);
|
||||
$artistID = $this->get_artistID_by_memberID($memberID);
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("artist/view/".$artistID));
|
||||
break;
|
||||
}
|
||||
}
|
||||
break; //case: members
|
||||
}
|
||||
break; //case: members
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -210,23 +210,23 @@ class AutoTagger extends Extension
|
|||
private function add_auto_tag(string $tag, string $additional_tags)
|
||||
{
|
||||
global $database;
|
||||
$existing_tags = $database->get_one("SELECT additional_tags FROM auto_tag WHERE LOWER(tag)=LOWER(:tag)", ["tag"=>$tag]);
|
||||
if (!is_null($existing_tags)) {
|
||||
// Auto Tags already exist, so we will append new tags to the existing one
|
||||
$tag = Tag::sanitize($tag);
|
||||
$existing_tags = $database->get_one("SELECT additional_tags FROM auto_tag WHERE LOWER(tag)=LOWER(:tag)", ["tag"=>$tag]);
|
||||
if (!is_null($existing_tags)) {
|
||||
// Auto Tags already exist, so we will append new tags to the existing one
|
||||
$tag = Tag::sanitize($tag);
|
||||
$additional_tags = Tag::explode($additional_tags);
|
||||
$existing_tags = Tag::explode($existing_tags);
|
||||
foreach ($additional_tags as $t) {
|
||||
if (!in_array(strtolower($t), $existing_tags)) {
|
||||
array_push($existing_tags, strtolower($t));
|
||||
}
|
||||
}
|
||||
|
||||
$database->execute(
|
||||
$existing_tags = Tag::explode($existing_tags);
|
||||
foreach ($additional_tags as $t) {
|
||||
if (!in_array(strtolower($t), $existing_tags)) {
|
||||
array_push($existing_tags, strtolower($t));
|
||||
}
|
||||
}
|
||||
|
||||
$database->execute(
|
||||
"UPDATE auto_tag set additional_tags=:existing_tags where tag=:tag",
|
||||
["tag"=>$tag, "existing_tags"=>Tag::implode($existing_tags)]
|
||||
);
|
||||
log_info(
|
||||
log_info(
|
||||
AutoTaggerInfo::KEY,
|
||||
"Updated auto-tag for {$tag} -> {".implode(" ", $additional_tags)."}"
|
||||
);
|
||||
|
@ -244,8 +244,8 @@ class AutoTagger extends Extension
|
|||
"Added auto-tag for {$tag} -> {".implode(" ", $additional_tags)."}"
|
||||
);
|
||||
}
|
||||
// Now we apply it to existing items
|
||||
$this->apply_new_auto_tag($tag);
|
||||
// Now we apply it to existing items
|
||||
$this->apply_new_auto_tag($tag);
|
||||
}
|
||||
|
||||
private function update_auto_tag(string $tag, string $additional_tags): bool
|
||||
|
|
|
@ -171,11 +171,16 @@ class CommentList extends Extension
|
|||
{
|
||||
if ($event->page_matches("comment")) {
|
||||
switch ($event->get_arg(0)) {
|
||||
case "add": $this->onPageRequest_add(); break;
|
||||
case "delete": $this->onPageRequest_delete($event); break;
|
||||
case "bulk_delete": $this->onPageRequest_bulk_delete(); break;
|
||||
case "list": $this->onPageRequest_list($event); break;
|
||||
case "beta-search": $this->onPageRequest_beta_search($event); break;
|
||||
case "add": $this->onPageRequest_add();
|
||||
break;
|
||||
case "delete": $this->onPageRequest_delete($event);
|
||||
break;
|
||||
case "bulk_delete": $this->onPageRequest_bulk_delete();
|
||||
break;
|
||||
case "list": $this->onPageRequest_list($event);
|
||||
break;
|
||||
case "beta-search": $this->onPageRequest_beta_search($event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
use MicroHTML\HTMLElement;
|
||||
|
||||
use function MicroHTML\INPUT;
|
||||
|
||||
class FavoritesTheme extends Themelet
|
||||
|
|
|
@ -8,6 +8,7 @@ use MicroCRUD\Column;
|
|||
use MicroCRUD\DateTimeColumn;
|
||||
use MicroCRUD\TextColumn;
|
||||
use MicroCRUD\Table;
|
||||
|
||||
use function MicroHTML\A;
|
||||
use function MicroHTML\SPAN;
|
||||
use function MicroHTML\emptyHTML;
|
||||
|
@ -161,11 +162,16 @@ class MessageColumn extends Column
|
|||
{
|
||||
$c = "#000";
|
||||
switch ($row['priority']) {
|
||||
case SCORE_LOG_DEBUG: $c = "#999"; break;
|
||||
case SCORE_LOG_INFO: $c = "#000"; break;
|
||||
case SCORE_LOG_WARNING: $c = "#800"; break;
|
||||
case SCORE_LOG_ERROR: $c = "#C00"; break;
|
||||
case SCORE_LOG_CRITICAL: $c = "#F00"; break;
|
||||
case SCORE_LOG_DEBUG: $c = "#999";
|
||||
break;
|
||||
case SCORE_LOG_INFO: $c = "#000";
|
||||
break;
|
||||
case SCORE_LOG_WARNING: $c = "#800";
|
||||
break;
|
||||
case SCORE_LOG_ERROR: $c = "#C00";
|
||||
break;
|
||||
case SCORE_LOG_CRITICAL: $c = "#F00";
|
||||
break;
|
||||
}
|
||||
return SPAN(["style"=>"color: $c"], rawHTML($this->scan_entities($row[$this->name])));
|
||||
}
|
||||
|
|
|
@ -790,8 +790,7 @@ class Media extends Extension
|
|||
|
||||
imagedestroy($image_resized);
|
||||
$image_resized = $new_image;
|
||||
break;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
switch ($output_mime) {
|
||||
|
|
|
@ -247,7 +247,7 @@ class MimeType
|
|||
case FileExtension::PPM:
|
||||
$output = MimeType::PPM;
|
||||
break;
|
||||
// TODO: There is no uniquely defined Mime type for the cursor format. Need to figure this out.
|
||||
// TODO: There is no uniquely defined Mime type for the cursor format. Need to figure this out.
|
||||
// case FileExtension::CUR:
|
||||
// $output = MimeType::CUR;
|
||||
// break;
|
||||
|
|
|
@ -325,37 +325,35 @@ class Pools extends Extension
|
|||
}
|
||||
}
|
||||
break;
|
||||
case "reverse":
|
||||
if ($this->have_permission($user, $pool)) {
|
||||
$result = $database->execute(
|
||||
"SELECT image_id FROM pool_images WHERE pool_id=:pid ORDER BY image_order DESC",
|
||||
["pid" => $pool_id]
|
||||
);
|
||||
$image_order = 1;
|
||||
try {
|
||||
$database->begin_transaction();
|
||||
while ($row = $result->fetch()) {
|
||||
$database->execute(
|
||||
"
|
||||
case "reverse":
|
||||
if ($this->have_permission($user, $pool)) {
|
||||
$result = $database->execute(
|
||||
"SELECT image_id FROM pool_images WHERE pool_id=:pid ORDER BY image_order DESC",
|
||||
["pid" => $pool_id]
|
||||
);
|
||||
$image_order = 1;
|
||||
try {
|
||||
$database->begin_transaction();
|
||||
while ($row = $result->fetch()) {
|
||||
$database->execute(
|
||||
"
|
||||
UPDATE pool_images
|
||||
SET image_order=:ord
|
||||
WHERE pool_id = :pid AND image_id = :iid",
|
||||
["ord" => $image_order, "pid" => $pool_id, "iid" => (int)$row['image_id']]
|
||||
);
|
||||
$image_order = $image_order + 1;
|
||||
}
|
||||
$database->commit();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$database->rollback();
|
||||
}
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("pool/view/" . $pool_id));
|
||||
}
|
||||
else {
|
||||
$this->theme->display_error(403, "Permission Denied", "You do not have permission to access this page");
|
||||
}
|
||||
break;
|
||||
["ord" => $image_order, "pid" => $pool_id, "iid" => (int)$row['image_id']]
|
||||
);
|
||||
$image_order = $image_order + 1;
|
||||
}
|
||||
$database->commit();
|
||||
} catch (Exception $e) {
|
||||
$database->rollback();
|
||||
}
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("pool/view/" . $pool_id));
|
||||
} else {
|
||||
$this->theme->display_error(403, "Permission Denied", "You do not have permission to access this page");
|
||||
}
|
||||
break;
|
||||
case "import":
|
||||
if ($this->have_permission($user, $pool)) {
|
||||
$images = Image::find_images(
|
||||
|
@ -522,7 +520,6 @@ class Pools extends Extension
|
|||
$poolID = str_replace("_", " ", $matches[1]);
|
||||
$event->add_querylet(new Querylet("images.id IN (SELECT DISTINCT image_id FROM pool_images WHERE pool_id = $poolID)"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function onTagTermCheck(TagTermCheckEvent $event)
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @global ImageRating[] $_shm_ratings
|
||||
*/
|
||||
/**
|
||||
* @global ImageRating[] $_shm_ratings
|
||||
*/
|
||||
global $_shm_ratings;
|
||||
$_shm_ratings = [];
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ class RegenThumb extends Extension
|
|||
global $page;
|
||||
switch ($event->action) {
|
||||
case "regen_thumbs":
|
||||
$event->redirect = true;
|
||||
$event->redirect = true;
|
||||
$force = false;
|
||||
if (isset($_POST["regen_thumb_force"])&&$_POST["regen_thumb_force"]=="true") {
|
||||
$force=true;
|
||||
|
|
|
@ -134,10 +134,8 @@ class ResizeImage extends Extension
|
|||
if (is_null($image)) {
|
||||
$this->theme->display_error(404, "Post not found", "No image in the database has the ID #$image_id");
|
||||
} else {
|
||||
|
||||
/* Check if options were given to resize an image. */
|
||||
if (isset($_POST['resize_width']) || isset($_POST['resize_height'])) {
|
||||
|
||||
/* get options */
|
||||
|
||||
$width = $height = 0;
|
||||
|
|
|
@ -65,10 +65,8 @@ class RotateImage extends Extension
|
|||
if (is_null($image)) {
|
||||
$this->theme->display_error(404, "Post not found", "No image in the database has the ID #$image_id");
|
||||
} else {
|
||||
|
||||
/* Check if options were given to rotate an image. */
|
||||
if (isset($_POST['rotate_deg'])) {
|
||||
|
||||
/* get options */
|
||||
|
||||
$deg = 0;
|
||||
|
@ -153,13 +151,18 @@ class RotateImage extends Extension
|
|||
|
||||
/* Output to the same format as the original image */
|
||||
switch ($info[2]) {
|
||||
case IMAGETYPE_GIF: $result = imagegif($image_rotated, $tmp_filename); break;
|
||||
case IMAGETYPE_JPEG: $result = imagejpeg($image_rotated, $tmp_filename); break;
|
||||
case IMAGETYPE_PNG: $result = imagepng($image_rotated, $tmp_filename, 9); break;
|
||||
case IMAGETYPE_WEBP: $result = imagewebp($image_rotated, $tmp_filename); break;
|
||||
case IMAGETYPE_BMP: $result = imagebmp($image_rotated, $tmp_filename, true); break;
|
||||
default:
|
||||
throw new ImageRotateException("Unsupported image type.");
|
||||
case IMAGETYPE_GIF: $result = imagegif($image_rotated, $tmp_filename);
|
||||
break;
|
||||
case IMAGETYPE_JPEG: $result = imagejpeg($image_rotated, $tmp_filename);
|
||||
break;
|
||||
case IMAGETYPE_PNG: $result = imagepng($image_rotated, $tmp_filename, 9);
|
||||
break;
|
||||
case IMAGETYPE_WEBP: $result = imagewebp($image_rotated, $tmp_filename);
|
||||
break;
|
||||
case IMAGETYPE_BMP: $result = imagebmp($image_rotated, $tmp_filename, true);
|
||||
break;
|
||||
default:
|
||||
throw new ImageRotateException("Unsupported image type.");
|
||||
}
|
||||
|
||||
if ($result===false) {
|
||||
|
|
|
@ -396,10 +396,14 @@ class Setup extends Extension
|
|||
$type = $_POST["_type_$name"];
|
||||
$value = isset($_POST["_config_$name"]) ? $_POST["_config_$name"] : null;
|
||||
switch ($type) {
|
||||
case "string": $config->set_string($name, $value); break;
|
||||
case "int": $config->set_int($name, parse_shorthand_int((string)$value)); break;
|
||||
case "bool": $config->set_bool($name, bool_escape($value)); break;
|
||||
case "array": $config->set_array($name, $value); break;
|
||||
case "string": $config->set_string($name, $value);
|
||||
break;
|
||||
case "int": $config->set_int($name, parse_shorthand_int((string)$value));
|
||||
break;
|
||||
case "bool": $config->set_bool($name, bool_escape($value));
|
||||
break;
|
||||
case "array": $config->set_array($name, $value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ class TagEditCloud extends Extension
|
|||
["tag_min1" => $tags_min, "tag_min2" => $tags_min, "limit" => $max_count, "relevant_tags"=>$relevant_tags]
|
||||
);
|
||||
break;
|
||||
/** @noinspection PhpMissingBreakStatementInspection */
|
||||
/** @noinspection PhpMissingBreakStatementInspection */
|
||||
case 'c':
|
||||
if (Extension::is_enabled(TagCategoriesInfo::KEY)) {
|
||||
$tag_data = $database->get_all(
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
require_once "config.php";
|
||||
/*
|
||||
* This is used by the image transcoding code when there is an error while transcoding
|
||||
*/
|
||||
/*
|
||||
* This is used by the image transcoding code when there is an error while transcoding
|
||||
*/
|
||||
class ImageTranscodeException extends SCoreException
|
||||
{
|
||||
}
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
require_once "config.php";
|
||||
/*
|
||||
* This is used by the image transcoding code when there is an error while transcoding
|
||||
*/
|
||||
/*
|
||||
* This is used by the image transcoding code when there is an error while transcoding
|
||||
*/
|
||||
class VideoTranscodeException extends SCoreException
|
||||
{
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
use MicroHTML\HTMLElement;
|
||||
|
||||
use function MicroHTML\TABLE;
|
||||
use function MicroHTML\TR;
|
||||
use function MicroHTML\TD;
|
||||
|
|
|
@ -11,6 +11,7 @@ use MicroCRUD\IntegerColumn;
|
|||
use MicroCRUD\TextColumn;
|
||||
use MicroCRUD\DateColumn;
|
||||
use MicroCRUD\Table;
|
||||
|
||||
use function MicroHTML\A;
|
||||
|
||||
class UserNameColumn extends TextColumn
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
use MicroHTML\HTMLElement;
|
||||
|
||||
use function MicroHTML\emptyHTML;
|
||||
use function MicroHTML\rawHTML;
|
||||
use function MicroHTML\TABLE;
|
||||
|
|
|
@ -490,14 +490,14 @@ class Wiki extends Extension
|
|||
$out = "";
|
||||
|
||||
while (
|
||||
$c1 < $max1 # have next line in left
|
||||
and
|
||||
$c2 < $max2 # have next line in right
|
||||
and
|
||||
($stop++) < 1000 # don-t have more then 1000 ( loop-stopper )
|
||||
and
|
||||
$outcount < 20 # output count is less then 20
|
||||
) {
|
||||
$c1 < $max1 # have next line in left
|
||||
and
|
||||
$c2 < $max2 # have next line in right
|
||||
and
|
||||
($stop++) < 1000 # don-t have more then 1000 ( loop-stopper )
|
||||
and
|
||||
$outcount < 20 # output count is less then 20
|
||||
) {
|
||||
/**
|
||||
* is the trimmed line of the current left and current right line
|
||||
* the same ? then this is a hit (no difference)
|
||||
|
@ -544,15 +544,14 @@ class Wiki extends Extension
|
|||
|
||||
#fast search in on both sides for next match.
|
||||
while (
|
||||
$found == 0 # search until we find a pair
|
||||
and
|
||||
($c1 + $s1 <= $max1) # and we are inside of the left lines
|
||||
and
|
||||
($c2 + $s2 <= $max2) # and we are inside of the right lines
|
||||
and
|
||||
$fstop++ < 10 # and the distance is lower than 10 lines
|
||||
) {
|
||||
|
||||
$found == 0 # search until we find a pair
|
||||
and
|
||||
($c1 + $s1 <= $max1) # and we are inside of the left lines
|
||||
and
|
||||
($c2 + $s2 <= $max2) # and we are inside of the right lines
|
||||
and
|
||||
$fstop++ < 10 # and the distance is lower than 10 lines
|
||||
) {
|
||||
/**
|
||||
* test the left side for a hit
|
||||
*
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use MicroHTML\HTMLElement;
|
||||
|
||||
use function MicroHTML\A;
|
||||
|
||||
class CustomUploadTheme extends UploadTheme
|
||||
|
|
Reference in a new issue