Image to Post - private

This commit is contained in:
Matthew Barbour 2020-10-26 10:17:47 -05:00
parent 9d7b0db3d3
commit 5371669e54
3 changed files with 9 additions and 9 deletions

View file

@ -5,7 +5,7 @@ class PrivateImageInfo extends ExtensionInfo
public const KEY = "private_image";
public $key = self::KEY;
public $name = "Private Image";
public $name = "Private Post";
public $authors = ["Matthew Barbour"=>"matthew@darkholme.net"];
public $license = self::LICENSE_WTFPL;
public $description = "Allows users to mark images as private, which prevents other users from seeing them.";

View file

@ -49,11 +49,11 @@ class PrivateImage extends Extension
$image_id = isset($_POST['image_id']) ? $_POST['image_id'] : null;
}
if (empty($image_id)) {
throw new SCoreException("Can not make image private: No valid Image ID given.");
throw new SCoreException("Can not make image private: No valid Post ID given.");
}
$image = Image::by_id($image_id);
if ($image==null) {
throw new SCoreException("Image not found.");
throw new SCoreException("Post not found.");
}
if ($image->owner_id!=$user->can(Permissions::SET_OTHERS_PRIVATE_IMAGES)) {
throw new SCoreException("Cannot set another user's image to private.");
@ -71,11 +71,11 @@ class PrivateImage extends Extension
$image_id = isset($_POST['image_id']) ? $_POST['image_id'] : null;
}
if (empty($image_id)) {
throw new SCoreException("Can not make image public: No valid Image ID given.");
throw new SCoreException("Can not make image public: No valid Post ID given.");
}
$image = Image::by_id($image_id);
if ($image==null) {
throw new SCoreException("Image not found.");
throw new SCoreException("Post not found.");
}
if ($image->owner_id!=$user->can(Permissions::SET_OTHERS_PRIVATE_IMAGES)) {
throw new SCoreException("Cannot set another user's image to private.");
@ -182,7 +182,7 @@ class PrivateImage extends Extension
{
if ($event->key===HelpPages::SEARCH) {
$block = new Block();
$block->header = "Private Images";
$block->header = "Private Posts";
$block->body = $this->theme->get_help_html();
$event->add_block($block);
}

View file

@ -27,14 +27,14 @@ class PrivateImageTheme extends Themelet
public function get_help_html()
{
return '<p>Search for images that are private/public.</p>
return '<p>Search for posts that are private/public.</p>
<div class="command_example">
<pre>private:yes</pre>
<p>Returns images that are private, restricted to yourself if you are not an admin.</p>
<p>Returns posts that are private, restricted to yourself if you are not an admin.</p>
</div>
<div class="command_example">
<pre>private:no</pre>
<p>Returns images that are public.</p>
<p>Returns posts that are public.</p>
</div>
';
}