Version 4.7.8

This commit is contained in:
Neo committed 2025-12-19 16:10:42 -08:00
1 parent 7b7404e741
commit fd22d99e69
688 files changed
+19814 -10890

No files matched your search

@@ -0,0 +1,39 @@
<?php
/**
* @brief GraphQL: Gallery mutations
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @since 18 January 2023
* @version SVN_VERSION_NUMBER
*/
namespace IPS\gallery\api\GraphQL;
use GraphQL\Type\Definition\ObjectType;
use IPS\Api\GraphQL\Types;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* Gallery mutations GraphQL API
*/
abstract class _Mutation
{
/**
* Get the supported query types in this app
*
* @return array
*/
public static function mutations(): array
{
return [
];
}
}
@@ -33,7 +33,7 @@ class _Image
/*
* Query arguments
*/
public function args()
public function args(): array
{
return array(
'id' => TypeRegistry::nonNull( TypeRegistry::id() )
@@ -60,18 +60,18 @@ class _Image
{
try
{
$topic = \IPS\gallery\Image::loadAndCheckPerms( $args['id'] );
$image = \IPS\gallery\Image::loadAndCheckPerms( $args['id'] );
}
catch ( \OutOfRangeException $e )
{
throw new \IPS\Api\GraphQL\SafeException( 'NO_IMAGE', '1F294/2', 400 );
}
if( !$topic->can('read') )
if( !$image->can('read') )
{
throw new \IPS\Api\GraphQL\SafeException( 'INVALID_ID', '2F294/9', 403 );
}
return $topic;
return $image;
}
}
@@ -27,11 +27,40 @@ if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class _TypeRegistry
{
protected static $album;
protected static $albumComment;
protected static $albumItem;
protected static $image;
protected static $imageComment;
/**
* Returns the album instance
*
* @var \IPS\gallery\api\GraphQL\Types\AlbumType
*/
protected static $album;
/**
* Returns the album comment instance
*
* @var \IPS\gallery\api\GraphQL\Types\AlbumCommentType
*/
protected static $albumComment;
/**
* Returns the album item instance
*
* @var \IPS\gallery\api\GraphQL\Types\AlbumItemType
*/
protected static $albumItem;
/**
* Returns the image instance
*
* @var \IPS\gallery\api\GraphQL\Types\ImageType
*/
protected static $image;
/**
* Returns the Image comment instance
*
* @var \IPS\gallery\api\GraphQL\Types\ImageCommentType
*/
protected static $imageComment;
/**
* Constructor
@@ -44,7 +73,7 @@ class _TypeRegistry
/**
* @return ImageType
*/
public static function album()
public static function album() : \IPS\gallery\api\GraphQL\Types\AlbumType
{
return self::$album ?: (self::$album = new \IPS\gallery\api\GraphQL\Types\AlbumType());
}
@@ -52,7 +81,7 @@ class _TypeRegistry
/**
* @return AlbumCommentType
*/
public static function albumComment()
public static function albumComment() : \IPS\gallery\api\GraphQL\Types\AlbumCommentType
{
return self::$albumComment ?: (self::$albumComment = new \IPS\gallery\api\GraphQL\Types\AlbumCommentType());
}
@@ -60,7 +89,7 @@ class _TypeRegistry
/**
* @return AlbumCommentType
*/
public static function albumItem()
public static function albumItem() : \IPS\gallery\api\GraphQL\Types\AlbumItemType
{
return self::$albumItem ?: (self::$albumItem = new \IPS\gallery\api\GraphQL\Types\AlbumItemType());
}
@@ -68,7 +97,7 @@ class _TypeRegistry
/**
* @return ImageType
*/
public static function image()
public static function image() : \IPS\gallery\api\GraphQL\Types\ImageType
{
return self::$image ?: (self::$image = new \IPS\gallery\api\GraphQL\Types\ImageType());
}
@@ -76,7 +105,7 @@ class _TypeRegistry
/**
* @return ImageCommentType
*/
public static function imageComment()
public static function imageComment() : \IPS\gallery\api\GraphQL\Types\ImageCommentType
{
return self::$imageComment ?: (self::$imageComment = new \IPS\gallery\api\GraphQL\Types\ImageCommentType());
}
@@ -176,13 +176,6 @@ class _ImageType extends \IPS\Content\Api\GraphQL\ItemType
]
);
// Duplicate fields that have different names in topics
/*$topicFields['forum'] = $defaultFields['container'];
$topicFields['posts'] = $defaultFields['comments'];
$topicFields['postCount'] = $defaultFields['commentCount'];
$topicFields['lastPostAuthor'] = $defaultFields['lastCommentAuthor'];
$topicFields['lastPostDate'] = $defaultFields['lastCommentDate'];*/
// Remove duplicated fields
unset( $defaultFields['poll'] );
unset( $defaultFields['hasPoll'] );
+1
View File
@@ -33,6 +33,7 @@ class _images extends \IPS\Content\Api\ItemController
* Get list of images
*
* @note For requests using an OAuth Access Token for a particular member, only images the authorized user can view will be included
* @apiparam string ids Comma-delimited list of image IDs
* @apiparam string categories Comma-delimited list of category IDs (will also include images in albums in those categories)
* @apiparam string albums Comma-delimited list of album IDs
* @apiparam string authors Comma-delimited list of member IDs - if provided, only images started by those members are returned
+1
View File
@@ -9,6 +9,7 @@
<setting key="gallery_detailed_bandwidth"><![CDATA[{"key":"gallery_detailed_bandwidth","default":"1","report":"full"}]]></setting>
<setting key="gallery_large_dims"><![CDATA[{"key":"gallery_large_dims","default":"1600x1200","report":"full"}]]></setting>
<setting key="gallery_maps_default"><![CDATA[{"key":"gallery_maps_default","default":"0","report":"full"}]]></setting>
<setting key="gallery_nsfw"><![CDATA[{"key":"gallery_nsfw","default":"0","report":"bool"}]]></setting>
<setting key="gallery_rss_enabled"><![CDATA[{"key":"gallery_rss_enabled","default":"1","report":"full"}]]></setting>
<setting key="gallery_small_dims"><![CDATA[{"key":"gallery_small_dims","default":"600x600","report":"full"}]]></setting>
<setting key="gallery_use_square_thumbnails"><![CDATA[{"key":"gallery_use_square_thumbnails","default":"0","report":"full"}]]></setting>
+38 -37
View File
@@ -1,67 +1,68 @@
{
"core": {
"AdvertisementLocations": {
"ImageLightbox": "IPS\\gallery\\extensions\\core\\AdvertisementLocations\\ImageLightbox"
"MemberACPProfileContentTab": {
"Gallery": "IPS\\gallery\\extensions\\core\\MemberACPProfileContentTab\\Gallery"
},
"ContentRouter": {
"gallery": "IPS\\gallery\\extensions\\core\\ContentRouter\\gallery"
},
"LiveSearch": {
"Categories": "IPS\\gallery\\extensions\\core\\LiveSearch\\Categories"
},
"FileStorage": {
"Images": "IPS\\gallery\\extensions\\core\\FileStorage\\Images"
},
"Sitemap": {
"Videos": "IPS\\gallery\\extensions\\core\\Sitemap\\Videos",
"Images": "IPS\\gallery\\extensions\\core\\Sitemap\\Images"
},
"GroupForm": {
"Gallery": "IPS\\gallery\\extensions\\core\\GroupForm\\Gallery"
},
"EditorLocations": {
"Gallery": "IPS\\gallery\\extensions\\core\\EditorLocations\\Gallery",
"Albums": "IPS\\gallery\\extensions\\core\\EditorLocations\\Albums",
"Categories": "IPS\\gallery\\extensions\\core\\EditorLocations\\Categories",
"Images": "IPS\\gallery\\extensions\\core\\EditorLocations\\Images"
},
"Permissions": {
"Permissions": "IPS\\gallery\\extensions\\core\\Permissions\\Permissions"
},
"CreateMenu": {
"gallery": "IPS\\gallery\\extensions\\core\\CreateMenu\\gallery"
},
"Dashboard": {
"Overview": "IPS\\gallery\\extensions\\core\\Dashboard\\Overview"
},
"EditorLocations": {
"Albums": "IPS\\gallery\\extensions\\core\\EditorLocations\\Albums",
"Categories": "IPS\\gallery\\extensions\\core\\EditorLocations\\Categories",
"Gallery": "IPS\\gallery\\extensions\\core\\EditorLocations\\Gallery",
"Images": "IPS\\gallery\\extensions\\core\\EditorLocations\\Images"
"MemberRestrictions": {
"Gallery": "IPS\\gallery\\extensions\\core\\MemberRestrictions\\Gallery"
},
"Profile": {
"gallery": "IPS\\gallery\\extensions\\core\\Profile\\gallery",
"galleryImages": "IPS\\gallery\\extensions\\core\\Profile\\galleryImages"
},
"EditorMedia": {
"Images": "IPS\\gallery\\extensions\\core\\EditorMedia\\Images"
},
"FileStorage": {
"Images": "IPS\\gallery\\extensions\\core\\FileStorage\\Images"
},
"FrontNavigation": {
"Gallery": "IPS\\gallery\\extensions\\core\\FrontNavigation\\Gallery"
},
"GroupForm": {
"Gallery": "IPS\\gallery\\extensions\\core\\GroupForm\\Gallery"
},
"GroupLimits": {
"Album": "IPS\\gallery\\extensions\\core\\GroupLimits\\Album"
},
"LiveSearch": {
"Categories": "IPS\\gallery\\extensions\\core\\LiveSearch\\Categories"
},
"MemberACPProfileContentTab": {
"Gallery": "IPS\\gallery\\extensions\\core\\MemberACPProfileContentTab\\Gallery"
"Queue": {
"CleanUpGalleryImages": "IPS\\gallery\\extensions\\core\\Queue\\CleanUpGalleryImages",
"RebuildGalleryImages": "IPS\\gallery\\extensions\\core\\Queue\\RebuildGalleryImages",
"Follow": "IPS\\gallery\\extensions\\core\\Queue\\Follow"
},
"MemberFilter": {
"Album": "IPS\\gallery\\extensions\\core\\MemberFilter\\Album"
},
"MemberRestrictions": {
"Gallery": "IPS\\gallery\\extensions\\core\\MemberRestrictions\\Gallery"
"FrontNavigation": {
"Gallery": "IPS\\gallery\\extensions\\core\\FrontNavigation\\Gallery"
},
"MemberSync": {
"Gallery": "IPS\\gallery\\extensions\\core\\MemberSync\\Gallery"
},
"Permissions": {
"Permissions": "IPS\\gallery\\extensions\\core\\Permissions\\Permissions"
},
"Profile": {
"gallery": "IPS\\gallery\\extensions\\core\\Profile\\gallery"
},
"Queue": {
"CleanUpGalleryImages": "IPS\\gallery\\extensions\\core\\Queue\\CleanUpGalleryImages",
"Follow": "IPS\\gallery\\extensions\\core\\Queue\\Follow",
"RebuildGalleryImages": "IPS\\gallery\\extensions\\core\\Queue\\RebuildGalleryImages"
},
"Sitemap": {
"Images": "IPS\\gallery\\extensions\\core\\Sitemap\\Images",
"Videos": "IPS\\gallery\\extensions\\core\\Sitemap\\Videos"
"AdvertisementLocations": {
"ImageLightbox": "IPS\\gallery\\extensions\\core\\AdvertisementLocations\\ImageLightbox"
}
}
}
File diff suppressed because it is too large. Load diff
+23 -2
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<language>
<app key="gallery" version="107601">
<app key="gallery" version="107643">
<word key="__app_gallery" js="0">Gallery</word>
<word key="frontnavigation_gallery" js="0">Gallery</word>
<word key="gallery_title" js="0">Gallery</word>
@@ -384,7 +384,7 @@
<word key="find_users_images" js="0">View %s's images</word>
<word key="change_author" js="0">Change Author</word>
<word key="change_author_ititle" js="0">Change the member who owns this image</word>
<word key="gallery_metadata" js="0">Photo Information for %s</word>
<word key="gallery_metadata" js="0">Photo Information</word>
<word key="gallery_no_metadata" js="0">No extra image data</word>
<word key="view_all_photo_info" js="0">View all photo EXIF information</word>
<word key="view_photo_info" js="0">View photo EXIF information</word>
@@ -455,6 +455,7 @@
<word key="image_review_count" js="0">{# [1:review][?:reviews]}</word>
<word key="image_comment_count" js="0">{# [1:comment][?:comments]}</word>
<word key="from_the_album" js="0">From the album: </word>
<word key="from_the_category" js="0">From the category: </word>
<word key="album_created_by" js="0">Album created by</word>
<word key="album_everything_seen" js="0">You've seen everything in this album</word>
<word key="album_new_content" js="0">This album has unseen content</word>
@@ -521,6 +522,7 @@
<word key="profile_gallery_album" js="0">Albums</word>
<word key="gallery_category_id" js="0">Category</word>
<word key="profile_gallery_gallery" js="0">Albums</word>
<word key="profile_gallery_galleryImages" js="0">Images</word>
<word key="choose_album" js="0">Choose Album</word>
<word key="choose_category" js="0">Choose Category</word>
<word key="upload_images" js="0">Upload Images</word>
@@ -842,6 +844,24 @@
<word key="sitemap_gallery_Images" js="0">Gallery Images</word>
<word key="sitemap_gallery_Videos" js="0">Gallery Videos</word>
<word key="webhook_galleryAlbum_create" js="0">Fired when an album is created</word>
<word key="gallery_overview" js="0">Overview</word>
<word key="gallery_view_categories" js="0">View Categories</word>
<word key="gallery_recently_commented_images" js="0">Recently Commented Images</word>
<word key="gallery_view_all_categories" js="0">View all categories</word>
<word key="gallery_recently_updated_albums" js="0">Recently Updated Albums</word>
<word key="gallery_nsfw" js="0">Enable NSFW?</word>
<word key="gallery_nsfw_desc" js="0">Images can be set as not safe for work (NSFW) and will appear blurred unless the member opts in to viewing them.</word>
<word key="gallery_image_is_nsfw" js="0">This image is NSFW</word>
<word key="gallery_nsfw_view_anyway" js="0">View anyway</word>
<word key="nsfw_set_all" js="0">Set NSFW on all</word>
<word key="nsfw_enable_all" js="0">Mark all images as not safe for work</word>
<word key="image_nsfw" js="0">Not safe for work?</word>
<word key="set_gallery_image_nsfw_on" js="0">Set as NSFW off</word>
<word key="set_gallery_image_nsfw_off" js="0">Set as NSFW on</word>
<word key="gallery_album_num_comments_uc" js="0">{# [1:Album Comment][?:Album Comments]}</word>
<word key="gallery_album_num_comments_lc" js="0">{# [1:album comment][?:album comments]}</word>
<word key="gallery_album_num_reviews_uc" js="0">{# [1:Album Review][?:Album Reviews]}</word>
<word key="gallery_album_num_reviews_lc" js="0">{# [1:album review][?:album reviews]}</word>
<word key="delete_note" js="1">Delete note</word>
<word key="save_note" js="1">Save</word>
<word key="saving_note" js="1">Saving...</word>
@@ -868,5 +888,6 @@
<word key="chooseAlbum" js="1">Choose Album</word>
<word key="imageUploadErrors" js="1">{# [1:image][?:images]} had errors</word>
<word key="imageUploadErrorsDesc" js="1">Correct the errors on the marked {!# [1:image][?:images]} and submit again.</word>
<word key="js_gallery_album_num_comments_uc" js="1">{# [1:Album Comment][?:Album Comments]}</word>
</app>
</language>
+55 -6
View File
@@ -2258,6 +2258,30 @@
"comment": "",
"unsigned": true,
"auto_increment": false
},
"image_labels": {
"name": "image_labels",
"type": "TEXT",
"length": null,
"decimals": null,
"values": null,
"allow_null": true,
"default": null,
"comment": "",
"unsigned": false,
"auto_increment": false
},
"image_nsfw": {
"name": "image_nsfw",
"type": "TINYINT",
"length": 1,
"decimals": null,
"values": null,
"allow_null": false,
"default": 0,
"comment": "",
"unsigned": true,
"auto_increment": false
}
},
"indexes": {
@@ -2410,26 +2434,52 @@
"image_comments": {
"type": "key",
"name": "image_comments",
"columns": [
"image_category_id",
"image_approved",
"image_comments"
],
"length": [
null,
null,
null
],
"columns": [
"image_category_id",
"image_approved",
"image_comments"
]
},
"image_comments_unapproved": {
"type": "key",
"name": "image_comments_unapproved",
"length": [
null,
null,
null
],
"columns": [
"image_category_id",
"image_approved",
"image_unapproved_comments"
]
},
"caption": {
"type": "key",
"name": "caption",
"length": [
250
],
"columns": [
"image_caption"
]
},
"udate": {
"type": "key",
"name": "udate",
"columns": [
"image_category_id",
"image_album_id",
"image_approved",
"image_updated"
],
"length": [
null,
null,
null,
null
@@ -2438,7 +2488,6 @@
},
"collation": "utf8mb4_unicode_ci",
"engine": "InnoDB",
"comment": "",
"reporting": "count"
},
"gallery_images_uploads": {
+5
View File
@@ -19,6 +19,11 @@
"default": "0",
"report": "full"
},
{
"key": "gallery_nsfw",
"default": "0",
"report": "bool"
},
{
"key": "gallery_rss_enabled",
"default": "1",
File diff suppressed because it is too large. Load diff
+15 -1
View File
@@ -534,5 +534,19 @@
"107504": "4.7.5",
"107505": "4.7.5",
"107600": "4.7.6 Beta 1",
"107601": "4.7.6"
"107601": "4.7.6",
"107602": "4.7.6",
"107620": "4.7.7 Beta 1",
"107621": "4.7.7 Beta 2",
"107622": "4.7.7 Beta 2",
"107623": "4.7.7 Beta 3",
"107624": "4.7.7 Beta 4",
"107625": "4.7.7",
"107626": "4.7.7",
"107627": "4.7.7",
"107628": "4.7.7",
"107640": "4.7.8 Beta 1",
"107641": "4.7.8 Beta 2",
"107642": "4.7.8 Beta 3",
"107643": "4.7.8"
}
@@ -74,9 +74,11 @@ class _Gallery
}
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js('front_browse.js', 'gallery' ) );
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js('front_global.js', 'gallery' ) );
\IPS\gallery\Application::outputCss();
$table = new \IPS\gallery\Image\Table( $className, $url, $where );
$table = new \IPS\gallery\Image\Table( $className, $url, $where, NULL, FALSE );
$table->tableTemplate = array( \IPS\Theme::i()->getTemplate( 'browse', 'gallery' ), 'imageTable' );
/* Get rows template */
@@ -26,7 +26,7 @@ class _gallery
/**
* Member
*/
protected $member;
protected \IPS\Member $member;
/**
* Constructor
@@ -44,7 +44,7 @@ class _gallery
*
* @return bool
*/
public function showTab()
public function showTab(): bool
{
$where = array( array( 'album_owner_id=?', $this->member->member_id ) );
@@ -71,7 +71,7 @@ class _gallery
*
* @return string
*/
public function render()
public function render(): string
{
\IPS\gallery\Application::outputCss();
@@ -0,0 +1,67 @@
<?php
/**
* @brief Profile extension: galleryImages
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Gallery
* @since 03 Nov 2022
*/
namespace IPS\gallery\extensions\core\Profile;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* @brief Profile extension: galleryImages
*/
class _galleryImages
{
/**
* Member
*/
protected \IPS\Member $member;
/**
* Constructor
*
* @param \IPS\Member $member Member whose profile we are viewing
* @return void
*/
public function __construct( \IPS\Member $member )
{
$this->member = $member;
}
/**
* Is there content to display?
*
* @return bool
*/
public function showTab(): bool
{
return TRUE;
}
/**
* Display
*
* @return string
*/
public function render(): string
{
$table ="";
foreach ( \IPS\Application::load( 'gallery' )->extensions( 'core', 'ContentRouter' ) as $ext )
{
$table = $ext->customTableHelper( 'IPS\gallery\Image', $this->member->url()->setQueryString( 'tab', 'node_gallery_galleryImages'), array( array( 'image_member_id=? and image_album_id=0', $this->member->member_id ) ) );
}
return (string) $table;
}
}
@@ -57,7 +57,7 @@ class _Images
$count = \IPS\gallery\Image::getItemsWithPermission( array( 'image_media=?', 0 ), NULL, 10, 'read', \IPS\Content\Hideable::FILTER_AUTOMATIC, 0, new \IPS\Member, FALSE, FALSE, FALSE, TRUE );
$files = array();
$count = ceil( $count / \IPS\Sitemap::MAX_PER_FILE );
$count = ceil( $count / \IPS\SITEMAP_MAX_PER_FILE );
for( $i=1; $i <= $count; $i++ )
{
@@ -84,8 +84,8 @@ class _Images
$exploded = explode( '_', $filename );
$block = (int) array_pop( $exploded );
$totalLimit = ( isset( $settings["sitemap_{$class::$title}_count"] ) AND $settings["sitemap_{$class::$title}_count"] ) ? $settings["sitemap_{$class::$title}_count"] : \IPS\core\extensions\core\Sitemap\Content::RECOMMENDED_ITEM_LIMIT;
$offset = ( $block - 1 ) * \IPS\Sitemap::MAX_PER_FILE;
$limit = \IPS\Sitemap::MAX_PER_FILE;
$offset = ( $block - 1 ) * \IPS\SITEMAP_MAX_PER_FILE;
$limit = \IPS\SITEMAP_MAX_PER_FILE;
if ( ! $totalLimit )
{
@@ -57,7 +57,7 @@ class _Videos
$count = \IPS\gallery\Image::getItemsWithPermission( array( 'image_media=?', 1 ), NULL, 10, 'read', \IPS\Content\Hideable::FILTER_AUTOMATIC, 0, new \IPS\Member, FALSE, FALSE, FALSE, TRUE );
$files = array();
$count = ceil( $count / \IPS\Sitemap::MAX_PER_FILE );
$count = ceil( $count / \IPS\SITEMAP_MAX_PER_FILE );
for( $i=1; $i <= $count; $i++ )
{
@@ -84,8 +84,8 @@ class _Videos
$exploded = explode( '_', $filename );
$block = (int) array_pop( $exploded );
$totalLimit = ( isset( $settings["sitemap_{$class::$title}_count"] ) AND $settings["sitemap_{$class::$title}_count"] ) ? $settings["sitemap_{$class::$title}_count"] : \IPS\core\extensions\core\Sitemap\Content::RECOMMENDED_ITEM_LIMIT;
$offset = ( $block - 1 ) * \IPS\Sitemap::MAX_PER_FILE;
$limit = \IPS\Sitemap::MAX_PER_FILE;
$offset = ( $block - 1 ) * \IPS\SITEMAP_MAX_PER_FILE;
$limit = \IPS\SITEMAP_MAX_PER_FILE;
if ( ! $totalLimit )
{
@@ -86,6 +86,9 @@ class _settings extends \IPS\Dispatcher\Controller
$form->add( new \IPS\Helpers\Form\YesNo( 'gallery_maps_default', \IPS\Settings::i()->gallery_maps_default ) );
}
$form->add( new \IPS\Helpers\Form\YesNo( 'gallery_nsfw', \IPS\Settings::i()->gallery_nsfw ) );
if ( $values = $form->values() )
{
$form->saveAsSettings( array(
@@ -98,7 +101,8 @@ class _settings extends \IPS\Dispatcher\Controller
'gallery_rss_enabled' => $values['gallery_rss_enabled'],
'gallery_watermark_images' => implode( ',', $values['gallery_watermark_images'] ),
'gallery_use_watermarks' => $values['gallery_use_watermarks'],
'gallery_maps_default' => $values['gallery_maps_default'] ?? 0
'gallery_maps_default' => $values['gallery_maps_default'] ?? 0,
'gallery_nsfw' => $values['gallery_nsfw']
) );
\IPS\Session::i()->log( 'acplogs__gallery_settings' );
@@ -45,6 +45,8 @@ class _browse extends \IPS\Content\Controller
\IPS\Member::loggedIn()->language()->words[ "sort_title" ] = \IPS\Member::loggedIn()->language()->addToStack( "album_sort_caption", FALSE );
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js('front_browse.js', 'gallery' ) );
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js('front_global.js', 'gallery' ) );
\IPS\gallery\Application::outputCss();
parent::execute();
}
@@ -194,14 +196,24 @@ class _browse extends \IPS\Content\Controller
{
/* Get stuff */
$featured = iterator_to_array( \IPS\gallery\Image::featured( 20, NULL ) );
$new = iterator_to_array( \IPS\gallery\Image::getItemsWithPermission( \IPS\gallery\Image::clubImageExclusion(), NULL, 30, 'read', \IPS\Content\Hideable::FILTER_AUTOMATIC, 0, NULL, !\IPS\Settings::i()->club_nodes_in_apps ) );
/* If there aren't any featured images grab some recent instead */
if( !\count( $featured ) )
{
$featured = \IPS\gallery\Image::getItemsWithPermission( \IPS\gallery\Image::clubImageExclusion(), 'image_updated DESC', 5, 'view' );
}
$new = iterator_to_array( \IPS\gallery\Image::getItemsWithPermission( \IPS\gallery\Image::clubImageExclusion(), NULL, 16, 'read', \IPS\Content\Hideable::FILTER_AUTOMATIC, 0, NULL, !\IPS\Settings::i()->club_nodes_in_apps ) );
$recentlyUpdatedAlbums = \IPS\gallery\Album\Item::getItemsWithPermission( \IPS\gallery\Album\Item::clubAlbumExclusion(), 'album_last_img_date DESC', 4, 'view' );
$commentWhere = \IPS\gallery\Image::clubImageExclusion();
$commentWhere[] = array( 'image_comments > 0' );
$recentComments = \IPS\gallery\Image::getItemsWithPermission( $commentWhere, 'image_last_comment DESC', 10, 'read', \IPS\Content\Hideable::FILTER_PUBLIC_ONLY, 0, NULL, !\IPS\Settings::i()->club_nodes_in_apps );
/* Online User Location */
\IPS\Session::i()->setLocation( \IPS\Http\Url::internal( 'app=gallery', 'front', 'gallery' ), array(), 'loc_gallery_browsing' );
/* Display */
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('gallery_title');
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'browse' )->index( $featured, $new );
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'browse' )->index( $featured, $new, $recentlyUpdatedAlbums, $recentComments );
}
/**
@@ -284,6 +296,11 @@ class _browse extends \IPS\Content\Controller
unset( $table->sortOptions['last_comments'] );
}
if( !$category->allow_reviews )
{
unset( $table->sortOptions['num_reviews'] );
}
if( !$category->allow_rating )
{
unset( $table->sortOptions['rating'] );
@@ -345,6 +362,11 @@ class _browse extends \IPS\Content\Controller
unset( $table->sortOptions['last_comments'] );
}
if( !$album->allow_reviews )
{
unset( $table->sortOptions['num_reviews'] );
}
if( !$album->allow_rating )
{
unset( $table->sortOptions['rating'] );
@@ -156,6 +156,11 @@ class _submit extends \IPS\Dispatcher\Controller
$allImagesForm->add( new \IPS\Helpers\Form\YesNo( 'image_auto_follow', (bool) \IPS\Member::loggedIn()->auto_follow['content'], FALSE, array(), NULL, NULL, \IPS\Member::loggedIn()->language()->addToStack( 'image_auto_follow_suffix' ) ) );
}
if( \IPS\Settings::i()->gallery_nsfw )
{
$allImagesForm->add( new \IPS\Helpers\Form\YesNo( 'image_nsfw', FALSE, FALSE, array(), NULL, NULL, \IPS\Member::loggedIn()->language()->addToStack( 'image_nsfw_suffix' ) ) );
}
/* Tags */
if ( \is_array( $container ) AND isset( $container['category'] ) AND $container['category'] AND \IPS\gallery\Image::canTag( NULL, $container['category'] ) )
{
@@ -412,7 +417,13 @@ class _submit extends \IPS\Dispatcher\Controller
{
$maxNumberOfImages = \IPS\Member::loggedIn()->group['g_img_album_limit'] - ( $album->count_imgs + $album->count_imgs_hidden );
}
/* Limit uploads to what we know we can process on this server */
if( $maxVars = @ini_get( 'max_input_vars') )
{
$maxNumberOfImages = round( ( $maxVars / 2 ) - 10, 0 );
}
/* Init form */
$form = new \IPS\Helpers\Form( 'upload_images', 'continue', $url );
$form->class = 'ipsForm_vertical';
@@ -425,6 +436,11 @@ class _submit extends \IPS\Dispatcher\Controller
$form->add( new \IPS\Helpers\Form\TextArea( 'images_order', NULL, FALSE ) );
$form->add( new \IPS\Helpers\Form\TextArea( 'images_info', NULL, FALSE ) );
if( \IPS\Settings::i()->gallery_nsfw )
{
$form->add( new \IPS\Helpers\Form\Number( 'nsfw_all', NULL, FALSE ) );
}
if( \IPS\Member::loggedIn()->member_id )
{
$form->add( new \IPS\Helpers\Form\Number( 'images_autofollow_all', 1, FALSE ) );
@@ -668,12 +684,20 @@ class _submit extends \IPS\Dispatcher\Controller
$imageData['image_auto_follow'] = $values['images_autofollow_all'];
}
if( \IPS\Settings::i()->gallery_nsfw and !isset( $imageData['image_nsfw'] ) )
{
$imageData['image_nsfw'] = $values['nsfw_all'];
}
/* Fix descriptions */
$imageData['image_description'] = ( isset( $imageData['image_textarea'] ) AND $imageData['image_textarea'] ) ? $imageData['image_textarea'] : ( ( isset( $imageData['image_description'] ) ) ? $imageData['image_description'] : '' );
/* Will we need to moderate this? */
$imageData['requires_moderation'] = $image->requiresModeration;
/* Image scanner labels */
$imageData['labels'] = $image->labels;
if ( !isset( $existing[ (string) $image ] ) )
{
$inserts[] = array(
@@ -869,6 +893,13 @@ class _submit extends \IPS\Dispatcher\Controller
\IPS\Request::i()->$checkboxInput = $values[ $name ];
}
elseif( $name == 'image_nsfw' )
{
$checkboxInput = $name . '_checkbox';
\IPS\Request::i()->$checkboxInput = $values[$checkboxInput] ?? $values[$name];
\IPS\Request::i()->$name = $values[$checkboxInput] ?? $values[$name];
}
unset( $values[ $name ] );
}
@@ -129,8 +129,9 @@ class _view extends \IPS\Content\Controller
}
}
\IPS\Output::i()->linkTags[] = array(
'rel' => 'preload',
/* Prioritize the main image */
\IPS\Output::i()->linkTags[] = array(
'rel' => 'preload',
'href' => (string) \IPS\File::get( 'gallery_Images', $this->image->masked_file_name )->url,
'as' => $this->image->media ? 'video' : 'image',
'type' => $this->image->file_type
@@ -300,8 +301,8 @@ class _view extends \IPS\Content\Controller
{
$return = array(
'title' => htmlspecialchars( $this->image->mapped('title'), ENT_DISALLOWED | ENT_QUOTES, 'UTF-8', FALSE ),
'image' => \IPS\Request::i()->lightbox ? \IPS\Theme::i()->getTemplate( 'view' )->imageLightboxFrame( $this->image ) : \IPS\Theme::i()->getTemplate( 'view' )->imageFrame( $this->image ),
'info' => \IPS\Request::i()->lightbox ? \IPS\Theme::i()->getTemplate( 'view' )->imageLightboxInfo( $this->image, $commentsAndReviews ) : \IPS\Theme::i()->getTemplate( 'view' )->imageInfo( $this->image )
'image' => \IPS\Theme::i()->getTemplate( 'view' )->imageFrame( $this->image ),
'info' => \IPS\Theme::i()->getTemplate( 'view' )->imageInfo( $this->image )
);
if( $this->image->directContainer()->allow_comments )
@@ -327,17 +328,9 @@ class _view extends \IPS\Content\Controller
{
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_view.js', 'gallery' ) );
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js('front_browse.js', 'gallery' ) );
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js('front_global.js', 'gallery' ) );
if( \IPS\Request::i()->lightbox )
{
\IPS\Output::i()->sidebar['enabled'] = FALSE;
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'view' )->imageLightbox( $this->image, $commentsAndReviews );
return;
}
else
{
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'view' )->image( $this->image, $commentsAndReviews );
}
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'view' )->image( $this->image, $commentsAndReviews );
}
}
@@ -664,22 +657,36 @@ class _view extends \IPS\Content\Controller
/**
* Get the next image
*
* @return void
* @param bool $return (bool) Return image object or redirect?
* @return \IPS\gallery\Image|void
*/
protected function next()
protected function next( bool $return=FALSE )
{
$image = $this->image->nextItem() ? $this->image->nextItem() : $this->image->fetchFirstOrLast('first');
if ( $return )
{
return $image;
}
$this->redirectToUrl( $image );
}
/**
* Get the previous image
*
* @return void
* @param bool $return (bool) Return image object or redirect?
* @return \IPS\gallery\Image|void
*/
protected function previous()
protected function previous( bool $return=FALSE )
{
$image = $this->image->prevItem() ? $this->image->prevItem() : $this->image->fetchFirstOrLast('last');
if ( $return )
{
return $image;
}
$this->redirectToUrl( $image );
}
@@ -818,4 +825,27 @@ class _view extends \IPS\Content\Controller
\IPS\Output::i()->redirect( $this->image->directContainer()->url() );
}
}
/**
* Toggle not safe for work
*
* @return void
*/
public function toggleNSFW()
{
/* Permission check */
if ( !\IPS\Settings::i()->gallery_nsfw or !$this->image->canEdit() )
{
\IPS\Output::i()->error( 'no_module_permission', '1G188/F', 403, '' );
}
\IPS\Session::i()->csrfCheck();
/* Update profile photo */
$this->image->nsfw = !$this->image->nsfw;
$this->image->save();
/* Redirect back to image */
\IPS\Output::i()->redirect( $this->image->url(), $this->image->nsfw ? 'set_gallery_image_nsfw_off' : 'set_gallery_image_nsfw_on' );
}
}
@@ -0,0 +1,23 @@
{
"id": 107602,
"name": "4.7.6",
"steps": {
"queries": false,
"lang": false,
"theme": false,
"themeSettings": false,
"javascript": false,
"emailTemplates": false,
"hooks": false,
"acpSearchKeywords": false,
"settings": false,
"tasks": false,
"modules": false,
"widgets": false,
"customOptions": false,
"customRoutines": false
},
"forceMainUpgrader": false,
"forceManualDownloadNoCiC": false,
"forceManualDownloadCiC": false
}
@@ -0,0 +1,23 @@
{
"id": 107620,
"name": "4.7.7 Beta 1",
"steps": {
"queries": true,
"lang": true,
"theme": true,
"themeSettings": false,
"javascript": true,
"emailTemplates": false,
"hooks": false,
"acpSearchKeywords": false,
"settings": true,
"tasks": false,
"modules": false,
"widgets": false,
"customOptions": false,
"customRoutines": false
},
"forceMainUpgrader": true,
"forceManualDownloadNoCiC": false,
"forceManualDownloadCiC": false
}
@@ -0,0 +1,25 @@
{
"files": {
"added": [
"gallery\/front\/controllers\/browse\/ips.browse.carousel.js",
"gallery\/front\/controllers\/global\/ips.global.nsfw.js"
],
"edited": [
"gallery\/front\/controllers\/browse\/ips.browse.list.js",
"gallery\/front\/controllers\/submit\/ips.submit.wrapper.js",
"gallery\/front\/controllers\/view\/ips.view.image.js",
"gallery\/front\/controllers\/view\/ips.view.note.js",
"gallery\/front\/templates\/ips.templates.browse.js"
],
"removed": [
"gallery\/front\/controllers\/browse\/ips.browse.lightbox.js"
]
},
"orders": {
"added": [],
"edited": [
"global\/\/dev\/js\/\/library\/"
],
"removed": []
}
}
@@ -0,0 +1,37 @@
{
"normal": {
"added": [
"from_the_category",
"profile_gallery_galleryImages",
"gallery_overview",
"gallery_view_categories",
"gallery_recently_commented_images",
"gallery_view_all_categories",
"gallery_recently_updated_albums",
"gallery_nsfw",
"gallery_nsfw_desc",
"gallery_image_is_nsfw",
"gallery_nsfw_view_anyway",
"nsfw_set_all",
"nsfw_enable_all",
"image_nsfw",
"set_gallery_image_nsfw_on",
"set_gallery_image_nsfw_off",
"gallery_album_num_comments_uc",
"gallery_album_num_comments_lc",
"gallery_album_num_reviews_uc",
"gallery_album_num_reviews_lc"
],
"edited": [
"gallery_metadata"
],
"removed": []
},
"js": {
"added": [
"js_gallery_album_num_comments_uc"
],
"edited": [],
"removed": []
}
}
@@ -0,0 +1,38 @@
{
"1": {
"method": "addColumn",
"params": [
"gallery_images",
{
"name": "image_labels",
"type": "TEXT",
"length": null,
"decimals": null,
"values": null,
"allow_null": true,
"default": null,
"comment": "",
"unsigned": false,
"auto_increment": false
}
]
},
"2": {
"method": "addColumn",
"params": [
"gallery_images",
{
"name": "image_nsfw",
"type": "TINYINT",
"length": null,
"decimals": null,
"values": null,
"allow_null": false,
"default": 0,
"comment": "",
"unsigned": true,
"auto_increment": false
}
]
}
}
@@ -0,0 +1,7 @@
{
"added": [
"gallery_nsfw"
],
"edited": [],
"removed": []
}
@@ -0,0 +1,65 @@
{
"html": {
"added": [
"front\/global\/nsfwOverlay"
],
"edited": [
"front\/browse\/album",
"front\/browse\/albumComments",
"front\/browse\/albums",
"front\/browse\/categories",
"front\/browse\/category",
"front\/browse\/categoryButtons",
"front\/browse\/categoryGrid",
"front\/browse\/categoryRow",
"front\/browse\/imageTable",
"front\/browse\/index",
"front\/browse\/miniAlbum",
"front\/browse\/tableRowsLarge",
"front\/browse\/tableRowsRows",
"front\/browse\/tableRowsThumbs",
"front\/global\/embedAlbumComment",
"front\/global\/embedAlbumReview",
"front\/global\/embedAlbums",
"front\/global\/embedImage",
"front\/global\/embedImageComment",
"front\/global\/embedImageReview",
"front\/global\/manageFollowNodeRow",
"front\/global\/searchResultAlbumCommentSnippet",
"front\/global\/searchResultAlbumSnippet",
"front\/global\/searchResultCommentSnippet",
"front\/global\/searchResultImageSnippet",
"front\/submit\/uploadImages",
"front\/submit\/wrapper",
"front\/view\/image",
"front\/view\/imageFrame",
"front\/view\/imageInfo",
"front\/view\/metadata",
"front\/widgets\/albums",
"front\/widgets\/imageFeed",
"front\/widgets\/imageRow",
"front\/widgets\/latestImage",
"front\/widgets\/recentComments",
"front\/widgets\/recentImageReviews"
],
"removed": []
},
"css": {
"added": [],
"edited": [
"front\/embed.css",
"front\/gallery_responsive.css",
"front\/gallery.css",
"front\/global.css",
"front\/submit_responsive.css",
"front\/submit.css",
"front\/widgets.css"
],
"removed": []
},
"resources": {
"added": [],
"edited": [],
"removed": []
}
}
@@ -0,0 +1,23 @@
{
"id": 107621,
"name": "4.7.7 Beta 2",
"steps": {
"queries": false,
"lang": false,
"theme": false,
"themeSettings": false,
"javascript": false,
"emailTemplates": false,
"hooks": false,
"acpSearchKeywords": false,
"settings": false,
"tasks": false,
"modules": false,
"widgets": false,
"customOptions": false,
"customRoutines": false
},
"forceMainUpgrader": false,
"forceManualDownloadNoCiC": false,
"forceManualDownloadCiC": false
}
@@ -0,0 +1,23 @@
{
"id": 107622,
"name": "4.7.7 Beta 2",
"steps": {
"queries": false,
"lang": false,
"theme": false,
"themeSettings": false,
"javascript": false,
"emailTemplates": false,
"hooks": false,
"acpSearchKeywords": false,
"settings": false,
"tasks": false,
"modules": false,
"widgets": false,
"customOptions": false,
"customRoutines": false
},
"forceMainUpgrader": false,
"forceManualDownloadNoCiC": false,
"forceManualDownloadCiC": false
}
@@ -0,0 +1,23 @@
{
"id": 107623,
"name": "4.7.7 Beta 3",
"steps": {
"queries": false,
"lang": false,
"theme": true,
"themeSettings": false,
"javascript": false,
"emailTemplates": false,
"hooks": false,
"acpSearchKeywords": false,
"settings": false,
"tasks": false,
"modules": false,
"widgets": false,
"customOptions": false,
"customRoutines": false
},
"forceMainUpgrader": false,
"forceManualDownloadNoCiC": false,
"forceManualDownloadCiC": false
}
@@ -0,0 +1,20 @@
{
"html": {
"added": [],
"edited": [
"front\/browse\/index",
"front\/browse\/tableRowsThumbs"
],
"removed": []
},
"css": {
"added": [],
"edited": [],
"removed": []
},
"resources": {
"added": [],
"edited": [],
"removed": []
}
}
@@ -0,0 +1,23 @@
{
"id": 107624,
"name": "4.7.7 Beta 4",
"steps": {
"queries": true,
"lang": false,
"theme": true,
"themeSettings": false,
"javascript": false,
"emailTemplates": false,
"hooks": false,
"acpSearchKeywords": false,
"settings": false,
"tasks": false,
"modules": false,
"widgets": false,
"customOptions": false,
"customRoutines": false
},
"forceMainUpgrader": false,
"forceManualDownloadNoCiC": false,
"forceManualDownloadCiC": false
}
@@ -0,0 +1,18 @@
{
"1": {
"method": "addIndex",
"params": [
"gallery_images",
{
"type": "key",
"name": "caption",
"columns": [
"image_caption"
],
"length": [
250
]
}
]
}
}
@@ -0,0 +1,26 @@
{
"html": {
"added": [],
"edited": [
"front\/browse\/albums",
"front\/browse\/categoryGrid",
"front\/browse\/categoryRow",
"front\/browse\/index",
"front\/browse\/miniAlbum",
"front\/browse\/tableRowsThumbs",
"front\/global\/searchResultAlbumSnippet",
"front\/view\/image"
],
"removed": []
},
"css": {
"added": [],
"edited": [],
"removed": []
},
"resources": {
"added": [],
"edited": [],
"removed": []
}
}
@@ -0,0 +1,23 @@
{
"id": 107625,
"name": "4.7.7",
"steps": {
"queries": false,
"lang": false,
"theme": false,
"themeSettings": false,
"javascript": false,
"emailTemplates": false,
"hooks": false,
"acpSearchKeywords": false,
"settings": false,
"tasks": false,
"modules": false,
"widgets": false,
"customOptions": false,
"customRoutines": false
},
"forceMainUpgrader": false,
"forceManualDownloadNoCiC": false,
"forceManualDownloadCiC": false
}
@@ -0,0 +1,23 @@
{
"id": 107626,
"name": "4.7.7",
"steps": {
"queries": false,
"lang": false,
"theme": true,
"themeSettings": false,
"javascript": false,
"emailTemplates": false,
"hooks": false,
"acpSearchKeywords": false,
"settings": false,
"tasks": false,
"modules": false,
"widgets": false,
"customOptions": false,
"customRoutines": false
},
"forceMainUpgrader": false,
"forceManualDownloadNoCiC": false,
"forceManualDownloadCiC": false
}
@@ -0,0 +1,20 @@
{
"html": {
"added": [],
"edited": [
"front\/browse\/categoryGrid",
"front\/browse\/categoryRow"
],
"removed": []
},
"css": {
"added": [],
"edited": [],
"removed": []
},
"resources": {
"added": [],
"edited": [],
"removed": []
}
}
@@ -0,0 +1,23 @@
{
"id": 107627,
"name": "4.7.7",
"steps": {
"queries": false,
"lang": false,
"theme": false,
"themeSettings": false,
"javascript": false,
"emailTemplates": false,
"hooks": false,
"acpSearchKeywords": false,
"settings": false,
"tasks": false,
"modules": false,
"widgets": false,
"customOptions": false,
"customRoutines": false
},
"forceMainUpgrader": false,
"forceManualDownloadNoCiC": false,
"forceManualDownloadCiC": false
}
@@ -0,0 +1,23 @@
{
"id": 107628,
"name": "4.7.7",
"steps": {
"queries": false,
"lang": false,
"theme": false,
"themeSettings": false,
"javascript": false,
"emailTemplates": false,
"hooks": false,
"acpSearchKeywords": false,
"settings": false,
"tasks": false,
"modules": false,
"widgets": false,
"customOptions": false,
"customRoutines": false
},
"forceMainUpgrader": false,
"forceManualDownloadNoCiC": false,
"forceManualDownloadCiC": false
}
@@ -0,0 +1,23 @@
{
"id": 107640,
"name": "4.7.8 Beta 1",
"steps": {
"queries": true,
"lang": false,
"theme": true,
"themeSettings": false,
"javascript": false,
"emailTemplates": false,
"hooks": false,
"acpSearchKeywords": false,
"settings": false,
"tasks": false,
"modules": false,
"widgets": false,
"customOptions": false,
"customRoutines": false
},
"forceMainUpgrader": false,
"forceManualDownloadNoCiC": false,
"forceManualDownloadCiC": false
}
@@ -0,0 +1,40 @@
{
"1": {
"method": "addIndex",
"params": [
"gallery_images",
{
"type": "key",
"name": "caption",
"columns": [
"image_caption"
],
"length": [
250
]
}
]
},
"2": {
"method": "addIndex",
"params": [
"gallery_images",
{
"type": "key",
"name": "udate",
"columns": [
"image_category_id",
"image_album_id",
"image_approved",
"image_updated"
],
"length": [
null,
null,
null,
null
]
}
]
}
}
@@ -0,0 +1,35 @@
{
"html": {
"added": [],
"edited": [
"front\/browse\/album",
"front\/browse\/albums",
"front\/browse\/categories",
"front\/browse\/index",
"front\/browse\/miniAlbum",
"front\/browse\/tableRowsLarge",
"front\/browse\/tableRowsRows",
"front\/browse\/tableRowsThumbs",
"front\/global\/searchResultAlbumSnippet",
"front\/global\/searchResultCommentSnippet",
"front\/view\/image",
"front\/view\/imageInfo",
"front\/view\/imageLightboxFrame",
"front\/widgets\/galleryStats",
"front\/widgets\/latestImage",
"front\/widgets\/recentComments",
"front\/widgets\/recentImageReviews"
],
"removed": []
},
"css": {
"added": [],
"edited": [],
"removed": []
},
"resources": {
"added": [],
"edited": [],
"removed": []
}
}
@@ -0,0 +1,23 @@
{
"id": 107641,
"name": "4.7.8 Beta 2",
"steps": {
"queries": false,
"lang": false,
"theme": false,
"themeSettings": false,
"javascript": false,
"emailTemplates": false,
"hooks": false,
"acpSearchKeywords": false,
"settings": false,
"tasks": false,
"modules": false,
"widgets": false,
"customOptions": false,
"customRoutines": false
},
"forceMainUpgrader": false,
"forceManualDownloadNoCiC": false,
"forceManualDownloadCiC": false
}
@@ -0,0 +1,23 @@
{
"id": 107642,
"name": "4.7.8 Beta 3",
"steps": {
"queries": false,
"lang": false,
"theme": false,
"themeSettings": false,
"javascript": false,
"emailTemplates": false,
"hooks": false,
"acpSearchKeywords": false,
"settings": false,
"tasks": false,
"modules": false,
"widgets": false,
"customOptions": false,
"customRoutines": false
},
"forceMainUpgrader": false,
"forceManualDownloadNoCiC": false,
"forceManualDownloadCiC": false
}
@@ -0,0 +1,23 @@
{
"id": 107643,
"name": "4.7.8",
"steps": {
"queries": false,
"lang": false,
"theme": false,
"themeSettings": false,
"javascript": false,
"emailTemplates": false,
"hooks": false,
"acpSearchKeywords": false,
"settings": false,
"tasks": false,
"modules": false,
"widgets": false,
"customOptions": false,
"customRoutines": false
},
"forceMainUpgrader": false,
"forceManualDownloadNoCiC": false,
"forceManualDownloadCiC": false
}
+75 -29
View File
@@ -80,6 +80,18 @@ class _Album extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\
*/
public static $contentItemClass = 'IPS\gallery\Image';
/* These are required to be declared here as well as the asItem class for embeds.
/**
* @brief Review Class
*/
public static $reviewClass = 'IPS\gallery\Album\Review';
/**
* @brief Comment Class
*/
public static $commentClass = 'IPS\gallery\Album\Comment';
/**
* @brief [Node] If the node can be "owned", the owner "type" (typically "member" or "group") and the associated database column
*/
@@ -473,13 +485,28 @@ class _Album extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\
*/
public static function formFields( \IPS\gallery\Album $album = NULL, $forOther = FALSE, $required = TRUE )
{
/* Save my sanity here.... load the category if we have one */
$category = NULL;
if( $album AND $album->category_id )
{
$category = $album->category();
}
elseif( !$album AND ( isset( \IPS\Request::i()->chosenCategory ) or isset( \IPS\Request::i()->category ) ) )
{
try
{
$category = \IPS\gallery\Category::load( (int)\IPS\Request::i()->chosenCategory ?: \IPS\Request::i()->category );
}
catch( \OutOfRangeException $e ){}
}
$return = array();
$return[] = new \IPS\Helpers\Form\Text( 'album_name', $album ? $album->name : '', $required ?: NULL );
$return[] = new \IPS\Helpers\Form\Editor( 'album_description', $album ? $album->description : '', FALSE, array( 'app' => 'gallery', 'key' => 'Albums', 'autoSaveKey' => ( $album ? "gallery_album_{$album->id}_desc" : "gallery-new-album" ), 'attachIds' => $album ? array( $album->id, NULL, 'description' ) : NULL ) );
$return[] = new \IPS\Helpers\Form\Node( 'album_category', ( $album and $album->category_id ) ? \IPS\gallery\Category::load( $album->category_id ) : NULL, $required ?: NULL, array(
$return[] = new \IPS\Helpers\Form\Node( 'album_category', $category ? $category->id : NULL, $required ?: NULL, array(
'class' => 'IPS\gallery\Category',
'disabled' => false,
'permissionCheck' => function( $node )
@@ -541,19 +568,9 @@ class _Album extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\
);
/* Is the category in a club */
if( $album AND $album->category_id )
if( $category !== NULL AND $club = $category->club() )
{
if( $album->category()->club() )
{
$submitTypes[ static::AUTH_SUBMIT_CLUB ] = 'album_submittype_club';
}
}
elseif( !$album AND ( isset( \IPS\Request::i()->chosenCategory ) or isset( \IPS\Request::i()->category ) ) )
{
if( \IPS\gallery\Category::load( (int) \IPS\Request::i()->chosenCategory ?: \IPS\Request::i()->category )->club() )
{
$submitTypes[ static::AUTH_SUBMIT_CLUB ] = 'album_submittype_club';
}
$submitTypes[ static::AUTH_SUBMIT_CLUB ] = 'album_submittype_club';
}
$return[] = new \IPS\Helpers\Form\Radio( 'album_submit_type', ( $album and $album->submit_type ) ? $album->submit_type : static::AUTH_SUBMIT_OWNER, FALSE, array( 'options' => $submitTypes, 'toggles' => array( static::AUTH_SUBMIT_MEMBERS => array( 'album_submit_access_members' ), static::AUTH_SUBMIT_GROUPS => array( 'album_submit_access_groups' ) ) ), NULL, NULL, NULL, 'album_submit_type' );
@@ -561,25 +578,25 @@ class _Album extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\
$return[] = new \IPS\Helpers\Form\SocialGroup( 'album_submit_access_members', ( $album AND $album->submit_type == static::AUTH_SUBMIT_MEMBERS ) ? (int) $album->submit_access : NULL, FALSE, array( 'owner' => $album ? \IPS\Member::load( $album->owner_id ) : ( \IPS\Request::i()->album_owner ? \IPS\Member::load( \IPS\Request::i()->album_owner, 'name' ) : \IPS\Member::loggedIn() ) ), NULL, NULL, NULL, 'album_submit_access_members' );
$groups = array_combine( array_keys( \IPS\Member\Group::groups( TRUE, FALSE ) ), array_map( function( $_group ) { return (string) $_group; }, \IPS\Member\Group::groups( TRUE, FALSE ) ) );
$return[] = new \IPS\Helpers\Form\CheckboxSet( 'album_submit_access_groups', ( $album and $album->submit_type == static::AUTH_SUBMIT_GROUPS ) ? explode( ',', $album->submit_access ) : NULL, FALSE, array( 'options' => $groups, 'multiple' => true ), NULL, NULL, NULL, 'album_submit_access_groups' );
$return[] = new \IPS\Helpers\Form\Select( 'album_sort_options', ( $album and $album->sort_options ) ? $album->sort_options : 'updated', FALSE, array( 'options' => array( 'updated' => 'sort_updated', 'last_comment' => 'sort_last_comment', 'title' => 'album_sort_caption', 'rating' => 'sort_rating', 'date' => 'sort_date', 'num_comments' => 'sort_num_comments', 'num_reviews' => 'sort_num_reviews', 'views' => 'sort_views' ) ), NULL, NULL, NULL, 'album_sort_options' );
$return[] = new \IPS\Helpers\Form\Select( 'album_sort_options', ( ( $album and $album->sort_options ) ? $album->sort_options : ( ( $category AND $category->sort_options_img ) ? $category->sort_options_img : 'updated' ) ), FALSE, array( 'options' => array( 'updated' => 'sort_updated', 'last_comment' => 'sort_last_comment', 'title' => 'album_sort_caption', 'rating' => 'sort_rating', 'date' => 'sort_date', 'num_comments' => 'sort_num_comments', 'num_reviews' => 'sort_num_reviews', 'views' => 'sort_views' ) ), NULL, NULL, NULL, 'album_sort_options' );
$return[] = new \IPS\Helpers\Form\YesNo( 'album_allow_rating', $album ? $album->allow_rating : TRUE, FALSE );
if( ( ( $album and $album->category_id ) and ( \IPS\gallery\Category::load( $album->category_id )->allow_comments ) ) or ( ( isset( \IPS\Request::i()->chosenCategory ) or isset( \IPS\Request::i()->category ) ) and \IPS\gallery\Category::load( (int) \IPS\Request::i()->chosenCategory ?: \IPS\Request::i()->category )->allow_comments ) )
if( $category AND $category->allow_comments )
{
$return[] = new \IPS\Helpers\Form\YesNo('album_allow_comments', $album ? $album->allow_comments : TRUE, FALSE);
}
if( ( ( $album and $album->category_id ) and ( \IPS\gallery\Category::load( $album->category_id )->allow_reviews ) ) or ( ( isset( \IPS\Request::i()->chosenCategory ) or isset( \IPS\Request::i()->category ) ) and \IPS\gallery\Category::load( (int) \IPS\Request::i()->chosenCategory ?: \IPS\Request::i()->category )->allow_reviews ) )
if( $category AND $category->allow_reviews )
{
$return[] = new \IPS\Helpers\Form\YesNo('album_allow_reviews', $album ? $album->allow_reviews : TRUE, FALSE);
}
if( ( ( $album and $album->category_id ) and ( \IPS\gallery\Category::load( $album->category_id )->allow_comments ) ) or ( ( isset( \IPS\Request::i()->chosenCategory ) or isset( \IPS\Request::i()->category ) ) and \IPS\gallery\Category::load( (int) \IPS\Request::i()->chosenCategory ?: \IPS\Request::i()->category )->allow_comments ) )
if( $category AND $category->allow_comments )
{
$return[] = new \IPS\Helpers\Form\YesNo('album_use_comments', $album ? $album->use_comments : TRUE, FALSE );
}
if( ( ( $album and $album->category_id ) and ( \IPS\gallery\Category::load( $album->category_id )->allow_reviews ) ) or ( ( isset( \IPS\Request::i()->chosenCategory ) or isset( \IPS\Request::i()->category ) ) and \IPS\gallery\Category::load( (int) \IPS\Request::i()->chosenCategory ?: \IPS\Request::i()->category )->allow_reviews ) )
if( $category AND $category->allow_reviews )
{
$return[] = new \IPS\Helpers\Form\YesNo('album_use_reviews', $album ? $album->use_reviews : TRUE, FALSE );
}
@@ -1160,16 +1177,7 @@ class _Album extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\
{
if( $this->coverPhoto === NULL )
{
try
{
$this->coverPhoto = \IPS\gallery\Image::load( $this->cover_img_id );
}
catch( \OutOfRangeException $e )
{
/* Cover photo isn't valid, reset album automatically */
$this->cover_img_id = 0;
$this->save();
}
$this->coverPhoto = $this->coverPhotoObject();
}
if( $this->coverPhoto !== NULL )
@@ -1186,6 +1194,44 @@ class _Album extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\
return NULL;
}
/**
* Retrieve a cover photo object
*
* @return \IPS\gallery\Image|null
*/
public function coverPhotoObject()
{
/* If we have an explicit cover photo set, make sure it's valid and load/cache it */
if( $this->cover_img_id )
{
if( $this->coverPhoto === NULL )
{
try
{
$this->coverPhoto = \IPS\gallery\Image::load( $this->cover_img_id );
}
catch( \OutOfRangeException $e )
{
/* Cover photo isn't valid, reset album automatically */
$this->cover_img_id = 0;
$this->save();
}
}
}
if( $this->coverPhoto !== NULL )
{
return $this->coverPhoto;
}
if( $lastImage = $this->lastImage() AND !$lastImage->media )
{
return $lastImage;
}
return NULL;
}
/**
* Load record based on a URL
*
@@ -699,4 +699,24 @@ class _Item extends \IPS\Content\Item implements
return $lastMod;
}
/**
* Return query WHERE clause to use for getItemsWithPermission when excluding club content
*
* @return array
*/
public static function clubAlbumExclusion(): array
{
if( \IPS\Settings::i()->club_nodes_in_apps )
{
return array();
}
else
{
return array( array(
'gallery_albums.album_category_id NOT IN(?)',
\IPS\Db::i()->select( 'node_id', 'core_clubs_node_map', array( 'node_class=?', 'IPS\gallery\Category' ) )
) );
}
}
}
@@ -698,6 +698,35 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
$property = $size . "_file_name";
/* If we have an explicit cover photo set, make sure it's valid and load/cache it */
if( $this->cover_img_id )
{
if( $this->coverPhoto === NULL )
{
$this->coverPhoto = $this->coverPhotoObject();
}
}
if( $this->coverPhoto !== NULL )
{
return (string) \IPS\File::get( 'gallery_Images', $this->coverPhoto->$property )->url;
}
if( $lastImage = $this->lastImage() )
{
return (string) \IPS\File::get( 'gallery_Images', $lastImage->$property )->url;
}
return NULL;
}
/**
* Retrieve a cover photo object
*
* @return \IPS\gallery\Image|null
*/
public function coverPhotoObject()
{
/* If we have an explicit cover photo set, make sure it's valid and load/cache it */
if( $this->cover_img_id )
{
@@ -706,6 +735,11 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
try
{
$this->coverPhoto = \IPS\gallery\Image::load( $this->cover_img_id );
if( $this->coverPhoto !== NULL )
{
return $this->coverPhoto;
}
}
catch( \OutOfRangeException $e )
{
@@ -714,16 +748,11 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
$this->save();
}
}
if( $this->coverPhoto !== NULL )
{
return (string) \IPS\File::get( 'gallery_Images', $this->coverPhoto->$property )->url;
}
}
if( $lastImage = $this->lastImage() )
{
return (string) \IPS\File::get( 'gallery_Images', $lastImage->$property )->url;
return $lastImage;
}
return NULL;
@@ -970,7 +999,7 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
if( $club->type == 'closed' )
{
$form->add( new \IPS\Helpers\Form\YesNo( 'club_node_public', $this->id ? $this->isPublic() : FALSE ) );
$form->add( new \IPS\Helpers\Form\Radio( 'club_node_public', $this->id ? $this->isPublic() : 0, TRUE, array( 'options' => array( '0' => 'club_node_public_no', '1' => 'club_node_public_view', '2' => 'club_node_public_participate' ) ) ) );
}
}
@@ -91,11 +91,6 @@ class _Comment extends \IPS\Content\Comment implements \IPS\Content\EditHistory,
* @brief [Content] Key for hide reasons
*/
public static $hideLogKey = 'gallery-images';
/**
* @brief Whether to track the sentiment scores in cloud_sentiment_scores for this content
*/
public $trackSentimentScore = true;
/**
* Get items with permission check
+86 -9
View File
@@ -149,6 +149,7 @@ class _Image extends \IPS\Content\Item implements
$return[] = 'image_small_file_name';
$return[] = 'image_album_id';
$return[] = 'image_copyright';
$return[] = 'image_nsfw';
return $return;
}
@@ -938,6 +939,11 @@ class _Image extends \IPS\Content\Item implements
$sortBy = static::$databaseColumnMap[ $this->directContainer()->sort_options_img ?: 'updated' ];
}
if( $sortBy == 'caption' )
{
$direction = ( $direction == 'ASC' ) ? 'DESC' : 'ASC';
}
foreach( \IPS\gallery\Image::getItemsWithPermission( $where, static::$databasePrefix . $sortBy . ' ' . $direction . ', image_id ' . $direction, 1 ) as $image )
{
return $image;
@@ -970,16 +976,34 @@ class _Image extends \IPS\Content\Item implements
$sortBy = static::$databaseColumnMap[ $this->directContainer()->sort_options_img ?: 'updated' ];
}
$where['id'] = array( 'image_id' . $dir . '?', $this->id );
if( $sortBy == 'caption' )
$where['id'] = array( 'image_id<>?', $this->id );
if( in_array( $sortBy, array( 'caption', 'rating' ) ) )
{
$direction = ( $direction == 'ASC' ) ? 'DESC' : 'ASC';
$dir = ( $dir == '>' ) ? '<' : '>';
if( $sortBy == 'caption' )
{
$direction = ( $direction == 'ASC' ) ? 'DESC' : 'ASC';
$dir = ( $dir == '>' ) ? '<' : '>';
}
/* We need to sort on a unique value */
$sortValue = $this->$sortBy . $this->updated;
$sortBy = 'CONCAT(image_' . $sortBy . ',image_updated)';
}
elseif( in_array( $sortBy, array( 'date', 'updated' ) ) )
{
/* We need to sort on a unique value */
$sortValue = $this->$sortBy . $this->id;
$sortBy = 'CONCAT(image_' . $sortBy . ',image_id)';
}
else
{
$sortValue = $this->$sortBy;
$sortBy = static::$databasePrefix . $sortBy;
}
$where['date'] = array( static::$databasePrefix . $sortBy . " {$dir}= ?", $this->$sortBy );
return iterator_to_array( \IPS\gallery\Image::getItemsWithPermission( $where, static::$databasePrefix . $sortBy . ' ' . $direction . ', image_id ' . $direction, $count ) );
$where['date'] = array( $sortBy . " {$dir}= ?", $sortValue );
return iterator_to_array( \IPS\gallery\Image::getItemsWithPermission( $where, $sortBy . ' ' . $direction . ', image_id ' . $direction, $count ) );
}
/**
@@ -1158,6 +1182,11 @@ class _Image extends \IPS\Content\Item implements
$return['credit_info'] = new \IPS\Helpers\Form\TextArea( 'image_credit_info', $item ? $item->credit_info : NULL, FALSE );
$return['copyright'] = new \IPS\Helpers\Form\Text( 'image_copyright', $item ? $item->copyright : NULL, FALSE, array( 'maxLength' => 255 ) );
if( \IPS\Settings::i()->gallery_nsfw )
{
$return['nsfw'] = new \IPS\Helpers\Form\YesNo( 'image_nsfw', $item ? $item->nsfw : FALSE );
}
/* If we are editing, return the appropriate fields */
if( $item )
{
@@ -1245,6 +1274,11 @@ class _Image extends \IPS\Content\Item implements
{
$this->credit_info = $values['image_credit_info'];
}
if ( isset( $values['image_nsfw'] ) )
{
$this->nsfw = $values['image_nsfw'];
}
/* If we are editing and have a movie, update it */
if( isset( $values['mediaLocation'] ) )
@@ -1252,6 +1286,11 @@ class _Image extends \IPS\Content\Item implements
$values['imageLocation'] = $values['mediaLocation'];
}
if ( isset( $values['labels'] ) )
{
$this->labels = $values['labels'];
}
/* Get the file... */
$file = NULL;
if( isset( $values['imageLocation'] ) AND $values['imageLocation'] )
@@ -1757,6 +1796,7 @@ class _Image extends \IPS\Content\Item implements
* @apiresponse bool pinned Image is pinned
* @apiresponse string url URL
* @apiresponse float rating Average Rating
* @apiresponse bool nsfw Not safe for work
*/
public function apiOutput( \IPS\Member $authorizedMember = NULL )
{
@@ -1790,6 +1830,7 @@ class _Image extends \IPS\Content\Item implements
'pinned' => (bool) $this->mapped('pinned'),
'url' => (string) $this->url(),
'rating' => $this->averageRating(),
'nsfw' => $this->nsfw
);
}
@@ -2010,7 +2051,9 @@ class _Image extends \IPS\Content\Item implements
*/
public function canSetAsAlbumCover( $member=NULL )
{
if( ( $this->album_id AND $this->canEdit() ) OR static::modPermission( 'edit', $member, $this->container() ) )
$member = $member ?: \IPS\Member::loggedIn();
/* Allow album owners to always change the album cover */
if( ( $this->album_id AND $album = \IPS\gallery\Album::load( $this->album_id ) AND $member->member_id AND $album->owner_id == $member->member_id ) OR static::modPermission( 'edit', $member, $this->container() ) )
{
return TRUE;
}
@@ -2433,7 +2476,7 @@ class _Image extends \IPS\Content\Item implements
*
* @return array
*/
public static function clubImageExclusion()
public static function clubImageExclusion(): array
{
if( \IPS\Settings::i()->club_nodes_in_apps )
{
@@ -2447,4 +2490,38 @@ class _Image extends \IPS\Content\Item implements
) );
}
}
/**
* Returns the labels from image scanner for search
*
* @return array|NULL
* @throws \BadMethodCallException
*/
public function imageLabelsForSearch()
{
$return = [];
$labels = $this->labels ? json_decode( $this->labels, TRUE ) : array();
if( $labels and \count( $labels ) )
{
foreach( $labels as $label )
{
$return[] = $label['Name'];
}
}
return $return;
}
/**
* Is the image NSFW?
*
* @param \IPS\Member\NULL $member The member (NULL for currently logged in member)
* @return bool
*/
public function nsfw()
{
return (bool) $this->nsfw;
}
}
@@ -96,11 +96,6 @@ class _Review extends \IPS\Content\Review implements \IPS\Content\EditHistory, \
*/
public static $hideLogKey = 'gallery-image-review';
/**
* @brief Whether to track the sentiment scores in cloud_sentiment_scores for this content
*/
public $trackSentimentScore = true;
/**
* Get URL for doing stuff
*
@@ -59,6 +59,7 @@ class _imageFeed extends \IPS\Content\Widget
}
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js('front_browse.js', 'gallery' ) );
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js('front_global.js', 'gallery' ) );
parent::init();
}