Image to Post - View
This commit is contained in:
parent
e7b109a7f2
commit
769fbecbb0
@ -5,10 +5,10 @@ class ViewImageInfo extends ExtensionInfo
|
||||
public const KEY = "view";
|
||||
|
||||
public $key = self::KEY;
|
||||
public $name = "Image Viewer";
|
||||
public $name = "Post Viewer";
|
||||
public $url = self::SHIMMIE_URL;
|
||||
public $authors = self::SHISH_AUTHOR;
|
||||
public $description = "Allows users to see uploaded images";
|
||||
public $description = "Allows users to see uploaded posts";
|
||||
public $core = true;
|
||||
public $visibility = self::VISIBLE_HIDDEN;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ class ViewImage extends Extension
|
||||
|
||||
$image = Image::by_id($image_id);
|
||||
if (is_null($image)) {
|
||||
$this->theme->display_error(404, "Image not found", "Image $image_id could not be found");
|
||||
$this->theme->display_error(404, "Post not found", "Post $image_id could not be found");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ class ViewImage extends Extension
|
||||
}
|
||||
|
||||
if (is_null($image)) {
|
||||
$this->theme->display_error(404, "Image not found", "No more images");
|
||||
$this->theme->display_error(404, "Post not found", "No more posts");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ class ViewImage extends Extension
|
||||
// who follows up every request to '/post/view/123' with
|
||||
// '/post/view/12300000000000Image 123: tags' which spams the
|
||||
// database log with 'integer out of range'
|
||||
$this->theme->display_error(404, "Image not found", "Invalid image ID");
|
||||
$this->theme->display_error(404, "Post not found", "Invalid post ID");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ class ViewImage extends Extension
|
||||
if (!is_null($image)) {
|
||||
send_event(new DisplayingImageEvent($image));
|
||||
} else {
|
||||
$this->theme->display_error(404, "Image not found", "No image in the database has the ID #$image_id");
|
||||
$this->theme->display_error(404, "Post not found", "No post in the database has the ID #$image_id");
|
||||
}
|
||||
} elseif ($event->page_matches("post/set")) {
|
||||
if (!isset($_POST['image_id'])) {
|
||||
@ -79,7 +79,7 @@ class ViewImage extends Extension
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(make_link("post/view/$image_id", url_escape(@$_POST['query'])));
|
||||
} else {
|
||||
$this->theme->display_error(403, "Image Locked", "An admin has locked this image");
|
||||
$this->theme->display_error(403, "Post Locked", "An admin has locked this post");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ class ViewImageTest extends ShimmiePHPUnitTestCase
|
||||
$image_id_1 = $this->post_image("tests/pbx_screenshot.jpg", "test");
|
||||
|
||||
$this->get_page("post/view/$image_id_1");
|
||||
$this->assert_title("Image $image_id_1: test");
|
||||
$this->assert_title("Post $image_id_1: test");
|
||||
}
|
||||
|
||||
public function testViewInfo()
|
||||
@ -65,9 +65,9 @@ class ViewImageTest extends ShimmiePHPUnitTestCase
|
||||
$idp1 = $image_id_1 + 1;
|
||||
|
||||
$this->get_page("post/view/$idp1");
|
||||
$this->assert_title('Image not found');
|
||||
$this->assert_title('Post not found');
|
||||
|
||||
$this->get_page('post/view/-1');
|
||||
$this->assert_title('Image not found');
|
||||
$this->assert_title('Post not found');
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ class ViewImageTheme extends Themelet
|
||||
public function display_page(Image $image, $editor_parts)
|
||||
{
|
||||
global $page;
|
||||
$page->set_title("Image {$image->id}: ".$image->get_tag_list());
|
||||
$page->set_title("Post {$image->id}: ".$image->get_tag_list());
|
||||
$page->set_heading(html_escape($image->get_tag_list()));
|
||||
$page->add_block(new Block("Navigation", $this->build_navigation($image), "left", 0));
|
||||
$page->add_block(new Block(null, $this->build_info($image, $editor_parts), "main", 20));
|
||||
@ -34,7 +34,7 @@ class ViewImageTheme extends Themelet
|
||||
public function display_admin_block(Page $page, $parts)
|
||||
{
|
||||
if (count($parts) > 0) {
|
||||
$page->add_block(new Block("Image Controls", join("<br>", $parts), "left", 50));
|
||||
$page->add_block(new Block("Post Controls", join("<br>", $parts), "left", 50));
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ class ViewImageTheme extends Themelet
|
||||
global $user;
|
||||
|
||||
if (count($editor_parts) == 0) {
|
||||
return ($image->is_locked() ? "<br>[Image Locked]" : "");
|
||||
return ($image->is_locked() ? "<br>[Post Locked]" : "");
|
||||
}
|
||||
|
||||
$html = make_form(make_link("post/set"))."
|
||||
|
Loading…
x
Reference in New Issue
Block a user