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