Version 4.7.8
This commit is contained in:
1 parent
7b7404e741
commit
fd22d99e69
688 files changed
+19814
-10890
No files matched your search
@@ -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' );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user