send_event(T) -> T
This commit is contained in:
parent
8492ae9ea4
commit
689b2b13af
38 changed files with 77 additions and 154 deletions
30
composer.lock
generated
30
composer.lock
generated
|
@ -614,12 +614,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/shish/gqla.git",
|
||||
"reference": "6b30c17214389013314cc3441e0db766fee8119c"
|
||||
"reference": "3b9d2973c0587f10f3b57990585fbdb7588ce54f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/shish/gqla/zipball/6b30c17214389013314cc3441e0db766fee8119c",
|
||||
"reference": "6b30c17214389013314cc3441e0db766fee8119c",
|
||||
"url": "https://api.github.com/repos/shish/gqla/zipball/3b9d2973c0587f10f3b57990585fbdb7588ce54f",
|
||||
"reference": "3b9d2973c0587f10f3b57990585fbdb7588ce54f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -659,7 +659,7 @@
|
|||
"issues": "https://github.com/shish/gqla/issues",
|
||||
"source": "https://github.com/shish/gqla/tree/main"
|
||||
},
|
||||
"time": "2023-02-04T12:47:18+00:00"
|
||||
"time": "2023-02-04T20:10:44+00:00"
|
||||
},
|
||||
{
|
||||
"name": "shish/microcrud",
|
||||
|
@ -770,16 +770,16 @@
|
|||
},
|
||||
{
|
||||
"name": "webonyx/graphql-php",
|
||||
"version": "v15.0.3",
|
||||
"version": "v15.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/webonyx/graphql-php.git",
|
||||
"reference": "bfa78b44a93c00ebc9a1bc92497bc170a0e3b656"
|
||||
"reference": "c58c08f3e2d6c43a8e0bb4bcc61ecb2a3e4f85df"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/webonyx/graphql-php/zipball/bfa78b44a93c00ebc9a1bc92497bc170a0e3b656",
|
||||
"reference": "bfa78b44a93c00ebc9a1bc92497bc170a0e3b656",
|
||||
"url": "https://api.github.com/repos/webonyx/graphql-php/zipball/c58c08f3e2d6c43a8e0bb4bcc61ecb2a3e4f85df",
|
||||
"reference": "c58c08f3e2d6c43a8e0bb4bcc61ecb2a3e4f85df",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -828,7 +828,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/webonyx/graphql-php/issues",
|
||||
"source": "https://github.com/webonyx/graphql-php/tree/v15.0.3"
|
||||
"source": "https://github.com/webonyx/graphql-php/tree/v15.1.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -836,7 +836,7 @@
|
|||
"type": "open_collective"
|
||||
}
|
||||
],
|
||||
"time": "2023-02-02T21:59:56+00:00"
|
||||
"time": "2023-02-04T15:00:26+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
|
@ -2657,12 +2657,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "8072151d4782529eca00770db6dccbb49ce4cdb1"
|
||||
"reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8072151d4782529eca00770db6dccbb49ce4cdb1",
|
||||
"reference": "8072151d4782529eca00770db6dccbb49ce4cdb1",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e7b1615e3e887d6c719121c6d4a44b0ab9645555",
|
||||
"reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2735,7 +2735,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6"
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -2751,7 +2751,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-02-04T08:53:49+00:00"
|
||||
"time": "2023-02-04T13:37:15+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/cache",
|
||||
|
|
|
@ -503,9 +503,7 @@ class Image
|
|||
#[Field(name: "nice_name")]
|
||||
public function get_nice_image_name(): string
|
||||
{
|
||||
$plte = new ParseLinkTemplateEvent('$id - $tags.$ext', $this);
|
||||
send_event($plte);
|
||||
return $plte->text;
|
||||
return send_event(new ParseLinkTemplateEvent('$id - $tags.$ext', $this))->text;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -550,9 +548,7 @@ class Image
|
|||
public function get_tooltip(): string
|
||||
{
|
||||
global $config;
|
||||
$plte = new ParseLinkTemplateEvent($config->get_string(ImageConfig::TIP), $this);
|
||||
send_event($plte);
|
||||
return $plte->text;
|
||||
return send_event(new ParseLinkTemplateEvent($config->get_string(ImageConfig::TIP), $this))->text;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -563,9 +559,7 @@ class Image
|
|||
public function get_info(): string
|
||||
{
|
||||
global $config;
|
||||
$plte = new ParseLinkTemplateEvent($config->get_string(ImageConfig::INFO), $this);
|
||||
send_event($plte);
|
||||
return $plte->text;
|
||||
return send_event(new ParseLinkTemplateEvent($config->get_string(ImageConfig::INFO), $this))->text;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -53,9 +53,7 @@ function add_image(string $tmpname, string $filename, string $tags): int
|
|||
$metadata['tags'] = Tag::explode($tags);
|
||||
$metadata['source'] = null;
|
||||
|
||||
$due = new DataUploadEvent($tmpname, $metadata);
|
||||
send_event($due);
|
||||
|
||||
$due = send_event(new DataUploadEvent($tmpname, $metadata));
|
||||
return $due->image_id;
|
||||
}
|
||||
|
||||
|
|
|
@ -207,8 +207,7 @@ function get_session_ip(Config $config): string
|
|||
*/
|
||||
function format_text(string $string): string
|
||||
{
|
||||
$event = new TextFormattingEvent($string);
|
||||
send_event($event);
|
||||
$event = send_event(new TextFormattingEvent($string));
|
||||
return $event->formatted;
|
||||
}
|
||||
|
||||
|
|
|
@ -259,8 +259,7 @@ class AutoTagger extends Extension
|
|||
foreach ($image_ids as $image_id) {
|
||||
$image_id = (int) $image_id;
|
||||
$image = Image::by_id($image_id);
|
||||
$event = new TagSetEvent($image, $image->get_tag_array());
|
||||
send_event($event);
|
||||
send_event(new TagSetEvent($image, $image->get_tag_array()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,8 +126,7 @@ class BulkImportExport extends DataHandlerExtension
|
|||
foreach ($event->items as $image) {
|
||||
$img_loc = warehouse_path(Image::IMAGE_DIR, $image->hash, false);
|
||||
|
||||
$export_event = new BulkExportEvent($image);
|
||||
send_event($export_event);
|
||||
$export_event = send_event(new BulkExportEvent($image));
|
||||
$data = $export_event->fields;
|
||||
$data["hash"] = $image->hash;
|
||||
$data["tags"] = $image->get_tag_array();
|
||||
|
|
|
@ -221,8 +221,7 @@ class CommentList extends Extension
|
|||
if (isset($_POST['image_id']) && isset($_POST['comment'])) {
|
||||
try {
|
||||
$i_iid = int_escape($_POST['image_id']);
|
||||
$cpe = new CommentPostingEvent(int_escape($_POST['image_id']), $user, $_POST['comment']);
|
||||
send_event($cpe);
|
||||
send_event(new CommentPostingEvent(int_escape($_POST['image_id']), $user, $_POST['comment']));
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("post/view/$i_iid", null, "comment_on_$i_iid"));
|
||||
} catch (CommentPostingException $ex) {
|
||||
|
|
|
@ -198,8 +198,7 @@ class CommentListTheme extends Themelet
|
|||
{
|
||||
global $config, $user;
|
||||
|
||||
$tfe = new TextFormattingEvent($comment->comment);
|
||||
send_event($tfe);
|
||||
$tfe = send_event(new TextFormattingEvent($comment->comment));
|
||||
|
||||
$i_uid = $comment->owner_id;
|
||||
$h_name = html_escape($comment->owner_name);
|
||||
|
|
|
@ -481,8 +481,7 @@ class CronUploader extends Extension
|
|||
}
|
||||
$metadata ['tags'] = $tagArray;
|
||||
$metadata ['source'] = null;
|
||||
$event = new DataUploadEvent($tmpname, $metadata);
|
||||
send_event($event);
|
||||
$event = send_event(new DataUploadEvent($tmpname, $metadata));
|
||||
|
||||
// Generate info message
|
||||
if ($event->image_id == -1) {
|
||||
|
|
|
@ -106,10 +106,7 @@ class ForumTheme extends Themelet
|
|||
$current_post++;
|
||||
$message = $post["message"];
|
||||
|
||||
$tfe = new TextFormattingEvent($message);
|
||||
send_event($tfe);
|
||||
$message = $tfe->formatted;
|
||||
|
||||
$message = send_event(new TextFormattingEvent($message))->formatted;
|
||||
$message = str_replace('\n\r', '<br>', $message);
|
||||
$message = str_replace('\r\n', '<br>', $message);
|
||||
$message = str_replace('\n', '<br>', $message);
|
||||
|
|
|
@ -44,9 +44,7 @@ class HelpPages extends Extension
|
|||
private function get_pages(): array
|
||||
{
|
||||
if ($this->pages==null) {
|
||||
$e = new HelpPageListBuildingEvent();
|
||||
send_event($e);
|
||||
$this->pages = $e->pages;
|
||||
$this->pages = send_event(new HelpPageListBuildingEvent())->pages;
|
||||
}
|
||||
return $this->pages;
|
||||
}
|
||||
|
@ -74,8 +72,7 @@ class HelpPages extends Extension
|
|||
|
||||
$this->theme->display_help_page($title);
|
||||
|
||||
$hpbe = new HelpPageBuildingEvent($name);
|
||||
send_event($hpbe);
|
||||
$hpbe = send_event(new HelpPageBuildingEvent($name));
|
||||
asort($hpbe->blocks);
|
||||
|
||||
foreach ($hpbe->blocks as $key=>$value) {
|
||||
|
|
|
@ -114,8 +114,7 @@ class Index extends Extension
|
|||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link('post/view/'.$images[0]->id));
|
||||
} else {
|
||||
$plbe = new PostListBuildingEvent($search_terms);
|
||||
send_event($plbe);
|
||||
$plbe = send_event(new PostListBuildingEvent($search_terms));
|
||||
|
||||
$this->theme->set_page($page_number, $total_pages, $search_terms);
|
||||
$this->theme->display_page($page, $images);
|
||||
|
|
|
@ -122,8 +122,7 @@ and of course start organising your images :-)
|
|||
// only show first line of wiki
|
||||
$short_wiki_description = explode("\n", $wikiPage->body, 2)[0];
|
||||
|
||||
$tfe = new TextFormattingEvent($short_wiki_description);
|
||||
send_event($tfe);
|
||||
$tfe = send_event(new TextFormattingEvent($short_wiki_description));
|
||||
$short_wiki_description = $tfe->formatted;
|
||||
}
|
||||
$wikiLink = make_link("wiki/$st");
|
||||
|
|
|
@ -305,7 +305,7 @@ class Notes extends Extension
|
|||
];
|
||||
|
||||
// validate parameters
|
||||
if (array_search(null, $note)|| strlen($note['noteText']) == 0) {
|
||||
if (empty($note['note'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -171,10 +171,7 @@ class OuroborosPost extends _SafeOuroborosImage
|
|||
$this->is_note_locked = $post['is_note_locked'];
|
||||
}
|
||||
if (array_key_exists('parent_id', $post)) {
|
||||
$this->parent_id = filter_var(
|
||||
$post['parent_id'],
|
||||
FILTER_SANITIZE_NUMBER_INT
|
||||
);
|
||||
$this->parent_id = int_escape($post['parent_id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -386,8 +383,7 @@ class OuroborosAPI extends Extension
|
|||
}
|
||||
$meta['extension'] = pathinfo($meta['filename'], PATHINFO_EXTENSION);
|
||||
try {
|
||||
$upload = new DataUploadEvent($meta['file'], $meta);
|
||||
send_event($upload);
|
||||
send_event(new DataUploadEvent($meta['file'], $meta));
|
||||
$image = Image::by_hash($meta['hash']);
|
||||
if (!is_null($image)) {
|
||||
$this->sendResponse(200, make_link('post/view/' . $image->id), true);
|
||||
|
|
|
@ -236,14 +236,12 @@ class Pools extends Extension
|
|||
case "create": // ADD _POST
|
||||
try {
|
||||
$title = $_POST["title"];
|
||||
$event = new PoolCreationEvent(
|
||||
$event = send_event(new PoolCreationEvent(
|
||||
$title,
|
||||
$user,
|
||||
bool_escape($_POST["public"]),
|
||||
$_POST["description"]
|
||||
);
|
||||
|
||||
send_event($event);
|
||||
));
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("pool/view/" . $event->new_id));
|
||||
} catch (PoolCreationException $e) {
|
||||
|
@ -588,8 +586,7 @@ class Pools extends Extension
|
|||
return;
|
||||
}
|
||||
$new_pool_title = $_POST['bulk_pool_new'];
|
||||
$pce = new PoolCreationEvent($new_pool_title);
|
||||
send_event($pce);
|
||||
$pce = send_event(new PoolCreationEvent($new_pool_title));
|
||||
send_event(new PoolAddPostsEvent($pce->new_id, iterator_map_to_array("Shimmie2\_image_to_id", $event->items)));
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -144,8 +144,7 @@ class PoolsTheme extends Themelet
|
|||
$this->sidebar_options($page, $pool, $check_all);
|
||||
}
|
||||
}
|
||||
$tfe = new TextFormattingEvent($pool->description);
|
||||
send_event($tfe);
|
||||
$tfe = send_event(new TextFormattingEvent($pool->description));
|
||||
$page->add_block(new Block(html_escape($pool->title), $tfe->formatted, "main", 10));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -295,8 +295,7 @@ class Ratings extends Extension
|
|||
$ratings = array_intersect(str_split($ratings), Ratings::get_user_class_privs($user));
|
||||
$rating = $ratings[0];
|
||||
$image = Image::by_id($event->image_id);
|
||||
$re = new RatingSetEvent($image, $rating);
|
||||
send_event($re);
|
||||
send_event(new RatingSetEvent($image, $rating));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,7 @@ class RegenThumb extends Extension
|
|||
public function regenerate_thumbnail(Image $image, bool $force = true): bool
|
||||
{
|
||||
global $cache;
|
||||
$event = new ThumbnailGenerationEvent($image->hash, $image->get_mime(), $force);
|
||||
send_event($event);
|
||||
$event = send_event(new ThumbnailGenerationEvent($image->hash, $image->get_mime(), $force));
|
||||
$cache->delete("thumb-block:{$image->id}");
|
||||
return $event->generated;
|
||||
}
|
||||
|
@ -126,8 +125,7 @@ class RegenThumb extends Extension
|
|||
continue;
|
||||
}
|
||||
}
|
||||
$event = new ThumbnailGenerationEvent($image["hash"], $image["mime"], $force);
|
||||
send_event($event);
|
||||
$event = send_event(new ThumbnailGenerationEvent($image["hash"], $image["mime"], $force));
|
||||
if ($event->generated) {
|
||||
$i++;
|
||||
}
|
||||
|
|
|
@ -21,8 +21,7 @@ class ReportImageTheme extends Themelet
|
|||
$reporter_name = html_escape($report['reporter_name']);
|
||||
$userlink = "<a href='".make_link("user/$reporter_name")."'>$reporter_name</a>";
|
||||
|
||||
$iabbe = new ImageAdminBlockBuildingEvent($image, $user, "report");
|
||||
send_event($iabbe);
|
||||
$iabbe = send_event(new ImageAdminBlockBuildingEvent($image, $user, "report"));
|
||||
ksort($iabbe->parts);
|
||||
$actions = join("<br>", $iabbe->parts);
|
||||
|
||||
|
|
|
@ -192,15 +192,14 @@ class ResizeImage extends Extension
|
|||
throw new ImageResizeException("Unable to save temporary image file.");
|
||||
}
|
||||
|
||||
$mre = new MediaResizeEvent(
|
||||
send_event(new MediaResizeEvent(
|
||||
$config->get_string(ResizeConfig::ENGINE),
|
||||
$event->path,
|
||||
$event->mime,
|
||||
$tmp_filename,
|
||||
$new_width,
|
||||
$new_height
|
||||
);
|
||||
send_event($mre);
|
||||
));
|
||||
|
||||
if ($event->file_modified===true&&$event->path!=$event->image->get_image_filename()) {
|
||||
// This means that we're dealing with a temp file that will need cleaned up
|
||||
|
|
|
@ -11,8 +11,7 @@ class System extends Extension
|
|||
global $page;
|
||||
|
||||
if ($event->page_matches("system")) {
|
||||
$e = new PageSubNavBuildingEvent("system");
|
||||
send_event($e);
|
||||
$e = send_event(new PageSubNavBuildingEvent("system"));
|
||||
usort($e->links, "Shimmie2\sort_nav_links");
|
||||
$link = $e->links[0]->link;
|
||||
|
||||
|
|
|
@ -74,8 +74,7 @@ class TagSetEvent extends Event
|
|||
continue;
|
||||
}
|
||||
|
||||
$ttpe = new TagTermCheckEvent($tag);
|
||||
send_event($ttpe);
|
||||
$ttpe = send_event(new TagTermCheckEvent($tag));
|
||||
|
||||
//seperate tags from metatags
|
||||
if (!$ttpe->metatag) {
|
||||
|
|
|
@ -72,7 +72,7 @@ class TaggerXML extends Extension
|
|||
$count = ["max"=>$count];
|
||||
} else {
|
||||
$q_from = "FROM `tags`";
|
||||
$count = null;
|
||||
$count = [];
|
||||
}
|
||||
|
||||
$tags = $database->execute(
|
||||
|
@ -97,33 +97,26 @@ class TaggerXML extends Extension
|
|||
return $this->list_to_xml($tags, "image", (string)$image_id);
|
||||
}
|
||||
|
||||
private function list_to_xml(\FFSPHP\PDOStatement $tags, string $type, string $query, ?array$misc=null): string
|
||||
private function list_to_xml(\FFSPHP\PDOStatement $tags, string $type, string $query, ?array $misc=[]): string
|
||||
{
|
||||
// @phpstan-ignore-next-line
|
||||
$r = $tags->_numOfRows;
|
||||
|
||||
$s_misc = "";
|
||||
$props = [
|
||||
"id"=>$type,
|
||||
"query"=>$query,
|
||||
// @phpstan-ignore-next-line
|
||||
"rows"=>$tags->_numOfRows
|
||||
];
|
||||
if (!is_null($misc)) {
|
||||
foreach ($misc as $attr => $val) {
|
||||
$s_misc .= " ".$attr."=\"".$val."\"";
|
||||
$props[$attr] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
$result = "<list id=\"$type\" query=\"$query\" rows=\"$r\"{$s_misc}>";
|
||||
$list = new \MicroHTML\HTMLElement("list", [$props]);
|
||||
foreach ($tags as $tag) {
|
||||
$result .= $this->tag_to_xml($tag);
|
||||
$list->appendChild(new \MicroHTML\HTMLElement("tag", [["id"=>$tag["id"], "count"=>$tag["count"]], $tag["tag"]]));
|
||||
}
|
||||
return $result."</list>";
|
||||
}
|
||||
|
||||
private function tag_to_xml(\PDORow $tag): string
|
||||
{
|
||||
return
|
||||
"<tag ".
|
||||
"id=\"".$tag['id']."\" ".
|
||||
"count=\"".$tag['count']."\">".
|
||||
html_escape($tag['tag']).
|
||||
"</tag>";
|
||||
return (string)($list);
|
||||
}
|
||||
|
||||
private function count(string $query, $values)
|
||||
|
|
|
@ -116,8 +116,7 @@ class UserPage extends Extension
|
|||
} elseif ($event->get_arg(0) == "create") {
|
||||
$this->page_create();
|
||||
} elseif ($event->get_arg(0) == "create_other") {
|
||||
$uce = new UserCreationEvent($_POST['name'], $_POST['pass1'], $_POST['email'], false);
|
||||
send_event($uce);
|
||||
send_event(new UserCreationEvent($_POST['name'], $_POST['pass1'], $_POST['email'], false));
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("admin"));
|
||||
$page->flash("Created new user");
|
||||
|
@ -180,8 +179,7 @@ class UserPage extends Extension
|
|||
"You aren't logged in. First do that, then you can see your stats."
|
||||
);
|
||||
} elseif (!is_null($display_user) && ($display_user->id != $config->get_int("anon_id"))) {
|
||||
$e = new UserPageBuildingEvent($display_user);
|
||||
send_event($e);
|
||||
$e = send_event(new UserPageBuildingEvent($display_user));
|
||||
$this->display_stats($e);
|
||||
} else {
|
||||
$this->theme->display_error(
|
||||
|
@ -248,15 +246,13 @@ class UserPage extends Extension
|
|||
if ($user->id == $event->display_user->id || $user->can("edit_user_info")) {
|
||||
$user_config = UserConfig::get_for_user($event->display_user->id);
|
||||
|
||||
$uobe = new UserOperationsBuildingEvent($event->display_user, $user_config);
|
||||
send_event($uobe);
|
||||
$uobe = send_event(new UserOperationsBuildingEvent($event->display_user, $user_config));
|
||||
$page->add_block(new Block("Operations", $this->theme->build_operations($event->display_user, $uobe), "main", 60));
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->id == $event->display_user->id) {
|
||||
$ubbe = new UserBlockBuildingEvent();
|
||||
send_event($ubbe);
|
||||
$ubbe = send_event(new UserBlockBuildingEvent());
|
||||
ksort($ubbe->parts);
|
||||
$this->theme->display_user_links($page, $user, $ubbe->parts);
|
||||
}
|
||||
|
@ -423,8 +419,7 @@ class UserPage extends Extension
|
|||
if ($user->is_anonymous()) {
|
||||
$this->theme->display_login_block($page);
|
||||
} else {
|
||||
$ubbe = new UserBlockBuildingEvent();
|
||||
send_event($ubbe);
|
||||
$ubbe = send_event(new UserBlockBuildingEvent());
|
||||
ksort($ubbe->parts);
|
||||
$this->theme->display_user_block($page, $user, $ubbe->parts);
|
||||
}
|
||||
|
@ -508,8 +503,7 @@ class UserPage extends Extension
|
|||
throw new UserCreationException("Error in captcha");
|
||||
}
|
||||
|
||||
$uce = new UserCreationEvent($_POST['name'], $_POST['pass1'], $_POST['email'], true);
|
||||
send_event($uce);
|
||||
$uce = send_event(new UserCreationEvent($_POST['name'], $_POST['pass1'], $_POST['email'], true));
|
||||
$this->set_login_cookie($uce->username);
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("user"));
|
||||
|
|
|
@ -67,8 +67,7 @@ class UserPageTheme extends Themelet
|
|||
$tac = $config->get_string("login_tac", "");
|
||||
|
||||
if ($config->get_bool("login_tac_bbcode")) {
|
||||
$tfe = new TextFormattingEvent($tac);
|
||||
send_event($tfe);
|
||||
$tfe = send_event(new TextFormattingEvent($tac));
|
||||
$tac = $tfe->formatted;
|
||||
}
|
||||
|
||||
|
|
|
@ -138,16 +138,7 @@ class UserConfig extends Extension
|
|||
$this->theme->display_permission_denied();
|
||||
} else {
|
||||
if ($event->count_args() == 0) {
|
||||
$display_user = ($event->count_args() == 0) ? $user : User::by_name($event->get_arg(0));
|
||||
|
||||
if ($user->id!=$display_user->id && !$user->can(Permissions::CHANGE_OTHER_USER_SETTING)) {
|
||||
$this->theme->display_permission_denied();
|
||||
return;
|
||||
}
|
||||
|
||||
$uobe = new UserOptionsBuildingEvent($display_user, new SetupPanel($user_config));
|
||||
send_event($uobe);
|
||||
|
||||
$uobe = send_event(new UserOptionsBuildingEvent($user, new SetupPanel($user_config)));
|
||||
$this->theme->display_user_config_page($page, $uobe->user, $uobe->panel);
|
||||
} elseif ($event->get_arg(0) == "save" && $user->check_auth_token()) {
|
||||
$input = validate_input([
|
||||
|
|
|
@ -37,8 +37,6 @@ class VarnishPurger extends Extension
|
|||
throw new SCoreException('PURGE ' . $url . ' unsuccessful (HTTP '. $httpCode . ')');
|
||||
}
|
||||
curl_close($ch);
|
||||
assert(!is_null($result) && !is_null($httpCode));
|
||||
//return $result;
|
||||
}
|
||||
|
||||
public function onCommentPosting(CommentPostingEvent $event)
|
||||
|
|
|
@ -101,13 +101,11 @@ class ViewImage extends Extension
|
|||
|
||||
$this->theme->display_meta_headers($image);
|
||||
|
||||
$iibbe = new ImageInfoBoxBuildingEvent($image, $user);
|
||||
send_event($iibbe);
|
||||
$iibbe = send_event(new ImageInfoBoxBuildingEvent($image, $user));
|
||||
ksort($iibbe->parts);
|
||||
$this->theme->display_page($image, $iibbe->parts);
|
||||
|
||||
$iabbe = new ImageAdminBlockBuildingEvent($image, $user, "view");
|
||||
send_event($iabbe);
|
||||
$iabbe = send_event(new ImageAdminBlockBuildingEvent($image, $user, "view"));
|
||||
ksort($iabbe->parts);
|
||||
$this->theme->display_admin_block($page, $iabbe->parts);
|
||||
}
|
||||
|
|
|
@ -21,8 +21,7 @@ class WikiTheme extends Themelet
|
|||
$nav_page->body = "";
|
||||
}
|
||||
|
||||
$tfe = new TextFormattingEvent($nav_page->body);
|
||||
send_event($tfe);
|
||||
$tfe = send_event(new TextFormattingEvent($nav_page->body));
|
||||
|
||||
// only the admin can edit the sidebar
|
||||
if ($user->can(Permissions::WIKI_ADMIN)) {
|
||||
|
|
|
@ -247,13 +247,12 @@ abstract class ShimmiePHPUnitTestCase extends TestCase
|
|||
// post things
|
||||
protected function post_image(string $filename, string $tags): int
|
||||
{
|
||||
$dae = new DataUploadEvent($filename, [
|
||||
$dae = send_event(new DataUploadEvent($filename, [
|
||||
"filename" => $filename,
|
||||
"extension" => pathinfo($filename, PATHINFO_EXTENSION),
|
||||
"tags" => Tag::explode($tags),
|
||||
"source" => null,
|
||||
]);
|
||||
send_event($dae);
|
||||
]));
|
||||
// if($dae->image_id == -1) throw new \Exception("Upload failed :(");
|
||||
return $dae->image_id;
|
||||
}
|
||||
|
@ -262,8 +261,7 @@ abstract class ShimmiePHPUnitTestCase extends TestCase
|
|||
{
|
||||
$img = Image::by_id($image_id);
|
||||
if ($img) {
|
||||
$ide = new ImageDeletionEvent($img, true);
|
||||
send_event($ide);
|
||||
send_event(new ImageDeletionEvent($img, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,5 +6,4 @@ parameters:
|
|||
- ../tests
|
||||
- ../themes/default
|
||||
ignoreErrors:
|
||||
- '#Attribute class GQLA\\#'
|
||||
- '#Access to an undefined property Shimmie2\\Image::\$#'
|
||||
|
|
|
@ -95,8 +95,7 @@ class CustomCommentListTheme extends CommentListTheme
|
|||
{
|
||||
global $user;
|
||||
|
||||
$tfe = new TextFormattingEvent($comment->comment);
|
||||
send_event($tfe);
|
||||
$tfe = send_event(new TextFormattingEvent($comment->comment));
|
||||
|
||||
//$i_uid = $comment->owner_id;
|
||||
$h_name = html_escape($comment->owner_name);
|
||||
|
|
|
@ -62,9 +62,7 @@ class CustomUserPageTheme extends UserPageTheme
|
|||
global $config;
|
||||
$tac = $config->get_string("login_tac", "");
|
||||
|
||||
$tfe = new TextFormattingEvent($tac);
|
||||
send_event($tfe);
|
||||
$tac = $tfe->formatted;
|
||||
$tac = send_event(new TextFormattingEvent($tac))->formatted;
|
||||
|
||||
$reca = "<tr><td colspan='2'>".captcha_get_html()."</td></tr>";
|
||||
|
||||
|
|
|
@ -96,8 +96,7 @@ class CustomCommentListTheme extends CommentListTheme
|
|||
{
|
||||
global $user;
|
||||
|
||||
$tfe = new TextFormattingEvent($comment->comment);
|
||||
send_event($tfe);
|
||||
$tfe = send_event(new TextFormattingEvent($comment->comment));
|
||||
|
||||
//$i_uid = $comment->owner_id;
|
||||
$h_name = html_escape($comment->owner_name);
|
||||
|
|
|
@ -62,9 +62,7 @@ class CustomUserPageTheme extends UserPageTheme
|
|||
global $config;
|
||||
$tac = $config->get_string("login_tac", "");
|
||||
|
||||
$tfe = new TextFormattingEvent($tac);
|
||||
send_event($tfe);
|
||||
$tac = $tfe->formatted;
|
||||
$tac = send_event(new TextFormattingEvent($tac))->formatted;
|
||||
|
||||
$reca = "<tr><td colspan='2'>".captcha_get_html()."</td></tr>";
|
||||
|
||||
|
|
|
@ -69,8 +69,7 @@ class CustomCommentListTheme extends CommentListTheme
|
|||
$inner_id = $this->inner_id; // because custom themes can't add params, because PHP
|
||||
global $user;
|
||||
|
||||
$tfe = new TextFormattingEvent($comment->comment);
|
||||
send_event($tfe);
|
||||
$tfe = send_event(new TextFormattingEvent($comment->comment));
|
||||
|
||||
//$i_uid = $comment->owner_id;
|
||||
$h_name = html_escape($comment->owner_name);
|
||||
|
|
|
@ -64,9 +64,7 @@ class CustomUserPageTheme extends UserPageTheme
|
|||
$tac = $config->get_string("login_tac", "");
|
||||
|
||||
if ($config->get_bool("login_tac_bbcode")) {
|
||||
$tfe = new TextFormattingEvent($tac);
|
||||
send_event($tfe);
|
||||
$tac = $tfe->formatted;
|
||||
$tac = send_event(new TextFormattingEvent($tac))->formatted;
|
||||
}
|
||||
|
||||
$form = SHM_SIMPLE_FORM(
|
||||
|
|
Reference in a new issue