Version 4.6.0
This commit is contained in:
1 parent
f79dcf067a
commit
517a5e1f70
2036 files changed
+110041
-26162
No files matched your search
@@ -163,7 +163,7 @@ class _categories extends \IPS\Node\Controller
|
||||
$itemDeletionWhere = $node->massMoveorDeleteWhere( $data );
|
||||
$itemDeletionWhere[] = array( 'image_album_id=?', 0 );
|
||||
|
||||
return \IPS\Theme::i()->getTemplate( 'global', 'gallery' )->nodeMoveDeleteContent( $this->url->setQueryString( array( 'do' => 'massManageContent', 'id' => $node->_id ) ), \IPS\Member::loggedIn()->language()->addToStack( $contentItemClass::$title . '_pl_lc' ), $node->getContentItems( NULL, NULL, $itemDeletionWhere, TRUE ), isset( $data['moveTo'] ) ? $data['moveToClass']::load( $data['moveTo'] ) : NULL, $albumCount, isset( $data['moveToAlbums'] ) ? $data['moveToClassAlbums']::load( $data['moveToAlbums'] ) : NULL );
|
||||
return \IPS\Theme::i()->getTemplate( 'global', 'gallery' )->nodeMoveDeleteContent( $this->url->setQueryString( array( 'do' => 'massManageContent', 'id' => $node->_id ) )->csrf(), \IPS\Member::loggedIn()->language()->addToStack( $contentItemClass::$title . '_pl_lc' ), $node->getContentItems( NULL, NULL, $itemDeletionWhere, TRUE ), isset( $data['moveTo'] ) ? $data['moveToClass']::load( $data['moveTo'] ) : NULL, $albumCount, isset( $data['moveToAlbums'] ) ? $data['moveToClassAlbums']::load( $data['moveToAlbums'] ) : NULL );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,7 +76,7 @@ class _settings extends \IPS\Dispatcher\Controller
|
||||
|
||||
$form->addHeader( 'gallery_bandwidth' );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'gallery_detailed_bandwidth', \IPS\Settings::i()->gallery_detailed_bandwidth ) );
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'gallery_bandwidth_period', \IPS\Settings::i()->gallery_bandwidth_period, FALSE, array( 'unlimited' => -1 ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Interval( 'gallery_bandwidth_period', \IPS\Settings::i()->gallery_bandwidth_period, FALSE, array( 'valueAs' => \IPS\Helpers\Form\Interval::HOURS, 'min' => NULL, 'unlimited' => -1 ), NULL, NULL, NULL, 'easypost_delivery_adjustment' ) );
|
||||
|
||||
$form->addHeader( 'gallery_options' );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'gallery_rss_enabled', \IPS\Settings::i()->gallery_rss_enabled ) );
|
||||
@@ -98,6 +98,7 @@ 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']
|
||||
) );
|
||||
\IPS\Session::i()->log( 'acplogs__gallery_settings' );
|
||||
|
||||
|
||||
@@ -27,6 +27,11 @@ class _bandwidth extends \IPS\Dispatcher\Controller
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* @brief Allow MySQL RW separation for efficiency
|
||||
*/
|
||||
public static $allowRWSeparation = TRUE;
|
||||
|
||||
/**
|
||||
* Execute
|
||||
|
||||
@@ -30,6 +30,11 @@ class _diskspace extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* @brief Allow MySQL RW separation for efficiency
|
||||
*/
|
||||
public static $allowRWSeparation = TRUE;
|
||||
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
|
||||
@@ -27,6 +27,11 @@ class _member extends \IPS\Dispatcher\Controller
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* @brief Allow MySQL RW separation for efficiency
|
||||
*/
|
||||
public static $allowRWSeparation = TRUE;
|
||||
|
||||
/**
|
||||
* Images
|
||||
|
||||
@@ -154,6 +154,37 @@ class _browse extends \IPS\Content\Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unset the cover photo
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function unsetCoverPhoto()
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
if( \IPS\Request::i()->category )
|
||||
{
|
||||
$container = \IPS\gallery\Category::loadAndCheckPerms( \IPS\Request::i()->category, 'view' );
|
||||
}
|
||||
elseif( \IPS\Request::i()->album )
|
||||
{
|
||||
$container = \IPS\gallery\Album::loadAndCheckPerms( \IPS\Request::i()->album, 'view' );
|
||||
}
|
||||
|
||||
if( \IPS\gallery\Image::modPermission( 'edit', \IPS\Member::loggedIn(), $container ) )
|
||||
{
|
||||
$container->cover_img_id = 0;
|
||||
$container->save();
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->error( 'gallery_unset_cover_error', '2G189/E', 403, '' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( $container->url(), 'gallery_cover_photo_isunset' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Show Index
|
||||
*
|
||||
@@ -163,7 +194,7 @@ 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\Settings::i()->club_nodes_in_apps ? array() : array( array( 'category_club_id IS NULL' ) ) ), NULL, 30, 'read', \IPS\Content\Hideable::FILTER_AUTOMATIC, 0, NULL, !\IPS\Settings::i()->club_nodes_in_apps ) );
|
||||
$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 ) );
|
||||
|
||||
/* Online User Location */
|
||||
\IPS\Session::i()->setLocation( \IPS\Http\Url::internal( 'app=gallery', 'front', 'gallery' ), array(), 'loc_gallery_browsing' );
|
||||
|
||||
@@ -229,7 +229,7 @@ class _submit extends \IPS\Dispatcher\Controller
|
||||
/* If it's an album, make sure we grab the current category */
|
||||
try
|
||||
{
|
||||
$category = \IPS\gallery\Category::load( $album->category_id );
|
||||
$category = \IPS\gallery\Category::loadAndCheckPerms( $album->category_id, 'add' );
|
||||
}
|
||||
catch ( \OutOfRangeException $e ) { }
|
||||
}
|
||||
@@ -261,19 +261,11 @@ class _submit extends \IPS\Dispatcher\Controller
|
||||
'url' => $url,
|
||||
'class' => 'IPS\gallery\Category',
|
||||
'permissionCheck' => function( $node ){
|
||||
// If we don't have permission to add to this node, return FALSE
|
||||
if( !$node->can('add') )
|
||||
if( $node->can('add') and ( $node->allow_albums != 2 or \IPS\Member::loggedIn()->group['g_create_albums'] or \IPS\gallery\Album::loadForSubmit( $node ) ) )
|
||||
{
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Otherwise, if the node *requires* albums but we don't have permission to create albums, also return FALSE
|
||||
if( !\IPS\Member::loggedIn()->group['g_create_albums'] AND $node->allow_albums == 2 )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
},
|
||||
'clubs' => \IPS\Settings::i()->club_nodes_in_apps
|
||||
) ) );
|
||||
@@ -384,8 +376,12 @@ class _submit extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* If there's nothing we can do, we can just continue */
|
||||
if ( !$canCreateAlbum )
|
||||
if ( !$canCreateAlbum and !$albumsInCategory )
|
||||
{
|
||||
if ( $category->allow_albums == 2 )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error_no_perm', '2G376/2', 403, '' );
|
||||
}
|
||||
return array( 'category' => $category, 'album' => NULL, 'guest_email' => isset( \IPS\Request::i()->guest_email ) ? \IPS\Request::i()->guest_email : NULL );
|
||||
}
|
||||
/* Otherwise, ask the user what they want to do */
|
||||
@@ -447,25 +443,33 @@ class _submit extends \IPS\Dispatcher\Controller
|
||||
$options['maxFiles'] = $maxNumberOfImages;
|
||||
}
|
||||
|
||||
$unlimitedMaxSize = TRUE;
|
||||
|
||||
if ( \IPS\Member::loggedIn()->group['g_max_upload'] )
|
||||
{
|
||||
$maxFileSizes['image'] = \IPS\Member::loggedIn()->group['g_max_upload'] / 1024;
|
||||
$unlimitedMaxSize = FALSE;
|
||||
}
|
||||
if ( \IPS\Member::loggedIn()->group['g_movies'] )
|
||||
{
|
||||
$options['image'] = NULL;
|
||||
$options['allowedFileTypes'] = array_merge( \IPS\Image::$imageExtensions, array( 'flv', 'f4v', 'wmv', 'mpg', 'mpeg', 'mp4', 'mkv', 'm4a', 'm4v', '3gp', 'mov', 'avi', 'webm', 'ogg', 'ogv' ) );
|
||||
$options['allowedFileTypes'] = array_merge( \IPS\Image::supportedExtensions(), array( 'flv', 'f4v', 'wmv', 'mpg', 'mpeg', 'mp4', 'mkv', 'm4a', 'm4v', '3gp', 'mov', 'avi', 'webm', 'ogg', 'ogv' ) );
|
||||
if ( \IPS\Member::loggedIn()->group['g_movie_size'] )
|
||||
{
|
||||
$maxFileSizes['movie'] = \IPS\Member::loggedIn()->group['g_movie_size'] / 1024;
|
||||
$unlimitedMaxSize = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$unlimitedMaxSize = TRUE;
|
||||
}
|
||||
}
|
||||
if ( \count( $maxFileSizes ) )
|
||||
if ( \count( $maxFileSizes ) AND !$unlimitedMaxSize )
|
||||
{
|
||||
$options['maxFileSize'] = max( $maxFileSizes );
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Upload( 'images', array(), TRUE, $options, function( $val ) use ( $maxNumberOfImages, $maxFileSizes ) {
|
||||
$uploader = new \IPS\Helpers\Form\Upload( 'images', array(), TRUE, $options, function( $val ) use ( $maxNumberOfImages, $maxFileSizes ) {
|
||||
if ( $maxNumberOfImages !== NULL and \count( $val ) > $maxNumberOfImages )
|
||||
{
|
||||
if ( $maxNumberOfImages < 1 )
|
||||
@@ -481,21 +485,24 @@ class _submit extends \IPS\Dispatcher\Controller
|
||||
foreach ( $val as $file )
|
||||
{
|
||||
$ext = mb_substr( $file->filename, ( mb_strrpos( $file->filename, '.' ) + 1 ) );
|
||||
if ( \in_array( mb_strtolower( $ext ), \IPS\Image::$imageExtensions ) )
|
||||
if ( \in_array( mb_strtolower( $ext ), \IPS\Image::supportedExtensions() ) )
|
||||
{
|
||||
/* The size was saved as kb, then divided by 1024 above to figure out how many MB to allow. So now we have '2' for 2MB for instance, so we need
|
||||
to multiply that by 1024*1024 in order to get the byte size again */
|
||||
if ( \count( $maxFileSizes ) == 2 and $file->filesize() > ( $maxFileSizes['image'] * 1048576 ) )
|
||||
if ( isset( $maxFileSizes['image'] ) and $file->filesize() > ( $maxFileSizes['image'] * 1048576 ) )
|
||||
{
|
||||
throw new \DomainException( \IPS\Member::loggedIn()->language()->addToStack( 'upload_image_too_big', FALSE, array( 'sprintf' => array( \IPS\Output\Plugin\Filesize::humanReadableFilesize( $maxFileSizes['image'] * 1048576 ) ) ) ) );
|
||||
}
|
||||
}
|
||||
elseif ( \count( $maxFileSizes ) == 2 and $file->filesize() > ( $maxFileSizes['movie'] * 1048576 ) )
|
||||
elseif ( isset( $maxFileSizes['movie'] ) and $file->filesize() > ( $maxFileSizes['movie'] * 1048576 ) )
|
||||
{
|
||||
throw new \DomainException( \IPS\Member::loggedIn()->language()->addToStack( 'upload_movie_too_big', FALSE, array( 'sprintf' => array( \IPS\Output\Plugin\Filesize::humanReadableFilesize( $maxFileSizes['movie'] * 1048576 ) ) ) ) );
|
||||
}
|
||||
}
|
||||
} ) );
|
||||
} );
|
||||
|
||||
$uploader->template = array( \IPS\Theme::i()->getTemplate( 'forms', 'gallery', 'front' ), 'imageUpload' );
|
||||
$form->add( $uploader );
|
||||
|
||||
/* Add tag fields so we can validate it */
|
||||
if( isset( \IPS\Request::i()->images_info ) AND \IPS\gallery\Image::canTag( NULL, $category ) )
|
||||
@@ -696,7 +703,7 @@ class _submit extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* Get the total number of images now as it will decrease each cycle moving forward */
|
||||
$totalImages = \IPS\Db::i()->select( 'count(*)', 'gallery_images_uploads', array( 'upload_session=?', session_id() ) )->first();
|
||||
$totalImages = \IPS\Db::i()->select( 'count(*)', 'gallery_images_uploads', array( 'upload_session=?', session_id() ), NULL, NULL, NULL, NULL, \IPS\Db::SELECT_FROM_WRITE_SERVER )->first();
|
||||
|
||||
$url = $url->setQueryString( 'totalImages', $totalImages );
|
||||
if ( isset( $data['guest_email'] ) )
|
||||
@@ -726,12 +733,13 @@ class _submit extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$offset = \intval( $offset );
|
||||
|
||||
$existing = \IPS\Db::i()->select( '*', 'gallery_images_uploads', array( 'upload_session=?', session_id() ), 'upload_order ASC', array( 0, 1 ) )->setKeyField( 'upload_location' );
|
||||
$existing = \IPS\Db::i()->select( '*', 'gallery_images_uploads', array( 'upload_session=?', session_id() ), 'upload_order ASC', array( 0, 1 ), NULL, NULL, \IPS\Db::SELECT_FROM_WRITE_SERVER )->setKeyField( 'upload_location' );
|
||||
|
||||
/* Get category and album data */
|
||||
$data = $this->chooseContainerForm( $url );
|
||||
|
||||
foreach( $existing as $location => $file )
|
||||
{
|
||||
/* Get category and album data */
|
||||
$data = $this->chooseContainerForm( $url );
|
||||
|
||||
/* Start with the basic data */
|
||||
$values = array(
|
||||
@@ -874,7 +882,18 @@ class _submit extends \IPS\Dispatcher\Controller
|
||||
\IPS\Db::i()->delete( 'gallery_images_uploads', array( 'upload_unique_id=?', $file['upload_unique_id'] ) );
|
||||
|
||||
/* Go to next */
|
||||
return array( ++$offset, \IPS\Member::loggedIn()->language()->addToStack('processing'), 100 / ( \IPS\Request::i()->totalImages ?: $offset ) * $offset );
|
||||
return array( ++$offset, \IPS\Member::loggedIn()->language()->addToStack('processing'), number_format( 100 / ( \IPS\Request::i()->totalImages ?: $offset ) * $offset, 2 ) );
|
||||
}
|
||||
|
||||
/* Update last image info */
|
||||
$data['category']->setLastImage();
|
||||
$data['category']->save();
|
||||
|
||||
/* And Album */
|
||||
if( $data['album'] )
|
||||
{
|
||||
$data['album']->setLastImage();
|
||||
$data['album']->save();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -889,7 +908,7 @@ class _submit extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
elseif ( \IPS\Request::i()->totalImages === 1 )
|
||||
{
|
||||
/* If we are only sending one image, send a normal notification */
|
||||
/* If we are only sending one image, send a normal notification and award points */
|
||||
$image = \IPS\gallery\Image::constructFromData( \IPS\Db::i()->select( '*', 'gallery_images', NULL, 'image_id DESC', 1 )->first() );
|
||||
if ( !$image->hidden() )
|
||||
{
|
||||
@@ -899,7 +918,8 @@ class _submit extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$image->sendUnapprovedNotification();
|
||||
}
|
||||
|
||||
|
||||
/* Then redirect */
|
||||
\IPS\Output::i()->redirect( $image->url() );
|
||||
}
|
||||
else
|
||||
|
||||
@@ -200,7 +200,7 @@ class _view extends \IPS\Content\Controller
|
||||
'author' => array(
|
||||
'@type' => 'Person',
|
||||
'name' => \IPS\Member::load( $this->image->member_id )->name,
|
||||
'image' => \IPS\Member::load( $this->image->member_id )->get_photo()
|
||||
'image' => \IPS\Member::load( $this->image->member_id )->get_photo( TRUE, TRUE )
|
||||
),
|
||||
'interactionStatistic' => array(
|
||||
array(
|
||||
@@ -359,7 +359,11 @@ class _view extends \IPS\Content\Controller
|
||||
case \IPS\gallery\Image::DOWNLOAD_ORIGINAL_WATERMARKED:
|
||||
/* We need to watermark the original image on the fly in this case */
|
||||
$file = \IPS\File::get( 'gallery_Images', $this->image->original_file_name );
|
||||
$image = $this->image->createImageFile( $file, NULL );
|
||||
|
||||
if( $file->isImage() )
|
||||
{
|
||||
$image = $this->image->createImageFile( $file, NULL );
|
||||
}
|
||||
break;
|
||||
|
||||
case \IPS\gallery\Image::DOWNLOAD_ORIGINAL_RAW:
|
||||
@@ -426,7 +430,7 @@ class _view extends \IPS\Content\Controller
|
||||
|
||||
/* We also want to update the views */
|
||||
$countUpdated = false;
|
||||
if ( \IPS\REDIS_ENABLED and \IPS\CACHE_METHOD == 'Redis' and \IPS\CACHE_CONFIG )
|
||||
if ( \IPS\REDIS_ENABLED and \IPS\CACHE_METHOD == 'Redis' and ( \IPS\CACHE_CONFIG or \IPS\REDIS_CONFIG ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user