Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
Giraffaman committed Apr 12, 2024
1 parent 83ee29d commit 9d76288
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ext/post_tags/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ public function onPageRequest(PageRequestEvent $event): void
$page->set_redirect(make_link("admin"));
}
}

public function make_logentry($data) {
if (is_array($data)) {
$data = implode(',', $data);
}
return "<script>console.log('Debug: " . $data . "' );</script>";
}


public function onCliGen(CliGenEvent $event): void
{
Expand Down Expand Up @@ -171,8 +179,14 @@ public function onTagSet(TagSetEvent $event): void
global $user;
if ($user->can(Permissions::EDIT_IMAGE_TAG) && (!$event->image->is_locked() || $user->can(Permissions::EDIT_IMAGE_LOCK))) {
$event->image->set_tags($event->new_tags);
foreach($event->new_tags as $ent) {
$this->make_logentry("post-tags: ".$ent." is a tag.");
}
}
foreach ($event->metatags as $tag) {
foreach($event->metatags as $emt) {
$this->make_logentry("post-tags: ".$emt." is a meta-tag!");
}
send_event(new TagTermParseEvent($tag, $event->image->id));
}
}
Expand Down
2 changes: 2 additions & 0 deletions ext/rating/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,14 @@ public function onTagTermParse(TagTermParseEvent $event): void

if (count($matches) > 2 && in_array($matches[2], self::UNRATED_KEYWORDS)) {
$ratings = "?";
$this->make_logentry("ratings: don't know what rating ".$event->term." is.");
}

$ratings = array_intersect(str_split($ratings), Ratings::get_user_class_privs($user));
$rating = $ratings[0];
$image = Image::by_id_ex($event->image_id);
send_event(new RatingSetEvent($image, $rating));
$this->make_logentry("ratings: ".$event->term." is rating ".$rating);
}
}

Expand Down

0 comments on commit 9d76288

Please sign in to comment.