Version 4.2.0

This commit is contained in:
Neo committed 2025-12-19 05:44:59 -08:00
1 parent 0dc2aee5ed
commit 96997ddd8e
2074 files changed
+125454 -55780

No files matched your search

@@ -1,13 +1,12 @@
<?php
/**
* @brief Browse the gallery
* @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
* @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 04 Mar 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\gallery\modules\front\gallery;
@@ -22,7 +21,7 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* Browse the gallery
*/
class _browse extends \IPS\Dispatcher\Controller
class _browse extends \IPS\Content\Controller
{
/**
* [Content\Controller] Class
@@ -38,7 +37,8 @@ class _browse extends \IPS\Dispatcher\Controller
{
if( isset( \IPS\Request::i()->album ) )
{
static::$contentModel = 'IPS\gallery\Album';
\IPS\Request::i()->id = \IPS\Request::i()->album;
static::$contentModel = ( isset( \IPS\Request::i()->do ) ) ? 'IPS\gallery\Album\Item' : 'IPS\gallery\Album';
}
/* Gallery uses caption for title */
@@ -182,13 +182,14 @@ class _browse extends \IPS\Dispatcher\Controller
$albums->classes = array( 'ipsDataList_large' );
$albums = ( $category->hasAlbums() ) ? (string) $albums : NULL;
}
\IPS\Output::i()->breadcrumb = array();
\IPS\Output::i()->breadcrumb['module'] = array( \IPS\Http\Url::internal( 'app=gallery&module=gallery&controller=browse', 'front', 'gallery' ), \IPS\Dispatcher::i()->module->_title );
if( !count( \IPS\gallery\Image::getItemsWithPermission( array( array( 'image_category_id=? AND image_album_id=?', $category->_id, 0 ) ) ) ) )
{
$table = ( $category->childrenCount() or $albums ) ? '' : \IPS\Theme::i()->getTemplate( 'browse' )->noImages( $category );
\IPS\Output::i()->breadcrumb = array();
\IPS\Output::i()->breadcrumb['module'] = array( \IPS\Http\Url::internal( 'app=gallery&module=gallery&controller=browse', 'front', 'gallery' ), \IPS\Dispatcher::i()->module->_title );
$parents = iterator_to_array( $category->parents() );
if ( count( $parents ) )
{
@@ -220,6 +221,20 @@ class _browse extends \IPS\Dispatcher\Controller
}
}
if ( $club = $category->club() )
{
\IPS\core\FrontNavigation::$clubTabActive = TRUE;
\IPS\Output::i()->breadcrumb = array();
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( 'app=core&module=clubs&controller=directory', 'front', 'clubs_list' ), \IPS\Member::loggedIn()->language()->addToStack('module__core_clubs') );
\IPS\Output::i()->breadcrumb[] = array( $club->url(), $club->name );
\IPS\Output::i()->breadcrumb[] = array( $category->url(), $category->_title );
if ( \IPS\Settings::i()->clubs_header == 'sidebar' )
{
\IPS\Output::i()->sidebar['contextual'] = \IPS\Theme::i()->getTemplate( 'clubs', 'core' )->header( $club, $category, 'sidebar' );
}
}
\IPS\Output::i()->contextualSearchOptions[ \IPS\Member::loggedIn()->language()->addToStack( 'search_contextual_item_categories' ) ] = array( 'type' => 'gallery_image', 'nodes' => $category->_id );
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'browse' )->category( $category, $albums, (string) $table );
}
@@ -265,28 +280,74 @@ class _browse extends \IPS\Dispatcher\Controller
unset( $table->sortOptions['rating'] );
}
}
/* Load the item */
$asItem = $album->asItem();
/* Sort out comments and reviews */
$tabs = $asItem->commentReviewTabs();
$_tabs = array_keys( $tabs );
$tab = isset( \IPS\Request::i()->tab ) ? \IPS\Request::i()->tab : array_shift( $_tabs );
$activeTabContents = $asItem->commentReviews( $tab );
if ( count( $tabs ) > 1 )
{
$commentsAndReviews = count( $tabs ) ? \IPS\Theme::i()->getTemplate( 'global', 'core' )->tabs( $tabs, $tab, $activeTabContents, $album->url(), 'tab', FALSE, TRUE ) : NULL;
}
else
{
$commentsAndReviews = $activeTabContents;
}
/* Fetching comments/reviews */
if( \IPS\Request::i()->isAjax() )
{
\IPS\Output::i()->output = $activeTabContents;
return;
}
/* Online User Location */
$permissions = $album->category()->permissions();
\IPS\Session::i()->setLocation( $album->url(), explode( ",", $permissions['perm_view'] ), 'loc_gallery_viewing_album', array( $album->_title => FALSE ) );
/* Output */
\IPS\Output::i()->title = $album->_title;
\IPS\Output::i()->breadcrumb = array();
\IPS\Output::i()->breadcrumb['module'] = array( \IPS\Http\Url::internal( 'app=gallery&module=gallery&controller=browse', 'front', 'gallery' ), \IPS\Dispatcher::i()->module->_title );
$parents = iterator_to_array( $album->category()->parents() );
if ( count( $parents ) )
\IPS\Output::i()->breadcrumb = array();
if ( $club = $album->category()->club() )
{
foreach( $parents AS $parent )
\IPS\core\FrontNavigation::$clubTabActive = TRUE;
\IPS\Output::i()->breadcrumb = array();
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( 'app=core&module=clubs&controller=directory', 'front', 'clubs_list' ), \IPS\Member::loggedIn()->language()->addToStack('module__core_clubs') );
\IPS\Output::i()->breadcrumb[] = array( $club->url(), $club->name );
\IPS\Output::i()->breadcrumb[] = array( $album->category()->url(), $album->category()->_title );
if ( \IPS\Settings::i()->clubs_header == 'sidebar' )
{
\IPS\Output::i()->breadcrumb[] = array( $parent->url(), $parent->_title );
\IPS\Output::i()->sidebar['contextual'] = \IPS\Theme::i()->getTemplate( 'clubs', 'core' )->header( $club, $album->category(), 'sidebar' );
}
}
else
{
\IPS\Output::i()->breadcrumb['module'] = array( \IPS\Http\Url::internal( 'app=gallery&module=gallery&controller=browse', 'front', 'gallery' ), \IPS\Dispatcher::i()->module->_title );
$parents = iterator_to_array( $album->category()->parents() );
if ( count( $parents ) )
{
foreach( $parents AS $parent )
{
\IPS\Output::i()->breadcrumb[] = array( $parent->url(), $parent->_title );
}
}
\IPS\Output::i()->breadcrumb[] = array( $album->category()->url(), $album->category()->_title );
}
if( $album->coverPhoto('medium') )
{
\IPS\Output::i()->metaTags['og:image'] = $album->coverPhoto('medium');
}
\IPS\Output::i()->breadcrumb[] = array( $album->category()->url(), $album->category()->_title );
\IPS\Output::i()->breadcrumb[] = array( NULL, $album->_title );
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'browse' )->album( $album, (string) $table );
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'browse' )->album( $album, (string) $table, $commentsAndReviews );
}
/**
@@ -1,13 +1,12 @@
<?php
/**
* @brief Store and retrieve image notes
* @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
* @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 21 Mar 2014
* @version SVN_VERSION_NUMBER
* @note This is available via javascript-only by the nature of the feature in question.
* @note This is a custom callback script for the jQuery-Notes plugin
* @link <a href='http://jquery-notes.rydygel.de/'>http://jquery-notes.rydygel.de/</a>
@@ -1,13 +1,12 @@
<?php
/**
* @brief Gallery Submission
* @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
* @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 04 Mar 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\gallery\modules\front\gallery;
@@ -34,24 +33,55 @@ class _submit extends \IPS\Dispatcher\Controller
/* Permission check */
\IPS\gallery\Image::canCreate( \IPS\Member::loggedIn(), NULL, TRUE );
/* Init */
$url = \IPS\Http\Url::internal( 'app=gallery&module=gallery&controller=submit', 'front', 'gallery_submit' );
$steps = array(
'choose_album' => array( $this, '_stepAlbum' ),
'upload_images' => array( $this, '_stepUploadImages' ),
'image_information' => array( $this, '_stepAddInfo' ),
'process' => array( $this, '_stepProcess' )
);
$club = NULL;
/* Initial data? */
$initialData = array();
if ( isset( \IPS\Request::i()->category ) )
{
$initialData['category'] = \IPS\Request::i()->category;
try
{
$category = \IPS\gallery\Category::loadAndCheckPerms( \IPS\Request::i()->category );
$url = $url->setQueryString( 'category', $category->_id );
$initialData['category'] = $category->_id;;
if ( $club = $category->club() )
{
$initialData['album'] = NULL;
if ( !\IPS\Member::loggedIn()->group['g_create_albums'] or !$category->allow_albums )
{
unset( $steps['choose_album'] );
}
\IPS\core\FrontNavigation::$clubTabActive = TRUE;
\IPS\Output::i()->breadcrumb = array();
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( 'app=core&module=clubs&controller=directory', 'front', 'clubs_list' ), \IPS\Member::loggedIn()->language()->addToStack('module__core_clubs') );
\IPS\Output::i()->breadcrumb[] = array( $club->url(), $club->name );
\IPS\Output::i()->breadcrumb[] = array( $category->url(), $category->_title );
if ( \IPS\Settings::i()->clubs_header == 'sidebar' )
{
\IPS\Output::i()->sidebar['contextual'] = \IPS\Theme::i()->getTemplate( 'clubs', 'core' )->header( $club, $category, 'sidebar' );
}
}
}
catch ( \OutOfRangeException $e ) {}
}
if ( isset( \IPS\Request::i()->album ) )
{
$initialData['album'] = \IPS\Request::i()->album;
}
/* Build wizard */
$wizard = new \IPS\Helpers\Wizard( array(
'choose_album' => array( $this, '_stepAlbum' ),
'upload_images' => array( $this, '_stepUploadImages' ),
'image_information' => array( $this, '_stepAddInfo' ),
'process' => array( $this, '_stepProcess' )
), \IPS\Http\Url::internal( 'app=gallery&module=gallery&controller=submit', 'front', 'gallery_submit' ), TRUE, $initialData );
$wizard = new \IPS\Helpers\Wizard( $steps, $url, TRUE, $initialData, FALSE, array( 'category', 'chosenCategory' ) );
$wizard->template = array( \IPS\Theme::i()->getTemplate( 'submit' ), 'wizardWrapper' );
/* Images have to be moderated? */
@@ -59,15 +89,21 @@ class _submit extends \IPS\Dispatcher\Controller
{
$wizard = \IPS\Theme::i()->getTemplate( 'forms', 'core' )->modQueueMessage( \IPS\Member::loggedIn()->warnings( 5, NULL, 'mq' ), \IPS\Member::loggedIn()->mod_posts ) . $wizard;
}
/* Club header */
if ( $club and !\IPS\Request::i()->isAjax() )
{
$wizard = \IPS\Theme::i()->getTemplate( 'clubs', 'core' )->header( $club, $category ) . $wizard;
}
/* Set online user location */
\IPS\Session::i()->setLocation( \IPS\Http\Url::internal( 'app=gallery&module=gallery&controller=submit', 'front', 'gallery_submit' ), array(), 'loc_gallery_adding_image' );
/* Output */
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'submit.css' ) );
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'submit.css' ), \IPS\Theme::i()->css( 'gallery.css' ) );
if ( \IPS\Theme::i()->settings['responsive'] )
{
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'submit_responsive.css', 'gallery', 'front' ) );
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'submit_responsive.css', 'gallery', 'front' ), \IPS\Theme::i()->css( 'gallery_responsive.css', 'gallery', 'front' ) );
}
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_submit.js', 'gallery' ) );
\IPS\Output::i()->sidebar['enabled'] = FALSE;
@@ -206,7 +242,6 @@ class _submit extends \IPS\Dispatcher\Controller
return $output;
}
}
}
/**
@@ -237,9 +272,14 @@ class _submit extends \IPS\Dispatcher\Controller
}
/* Init form */
$form = new \IPS\Helpers\Form( 'upload_images', 'continue', \IPS\Http\Url::internal( 'app=gallery&module=gallery&controller=submit&_step=upload_images', 'front', 'gallery_submit' ) );
$url = \IPS\Http\Url::internal( 'app=gallery&module=gallery&controller=submit&_step=upload_images', 'front', 'gallery_submit' );
if ( isset( \IPS\Request::i()->category ) )
{
$url = $url->setQueryString( 'category', \IPS\Request::i()->category );
}
$form = new \IPS\Helpers\Form( 'upload_images', 'continue', $url );
$form->class = 'ipsForm_vertical';
/* Get any existing */
$currentValue = array();
if ( isset( $data['images'] ) )
@@ -391,6 +431,7 @@ class _submit extends \IPS\Dispatcher\Controller
$image->done = ( isset( $existing[ $url ] ) and $existing[ $url ]['upload_data'] );
$image->movie = !in_array( mb_strtolower( mb_substr( $image->filename, ( mb_strrpos( $image->filename, '.' ) + 1 ) ) ), \IPS\Image::$imageExtensions );
$image->tempId = isset( $existing[ $url ] ) ? $existing[ $url ]['upload_unique_id'] : 0;
$image->originalFilename = isset( $existing[ $url ] ) ? $existing[ $url ]['upload_file_name'] : $image->originalFilename;
$images[] = $image;
}
}
@@ -550,12 +591,33 @@ class _submit extends \IPS\Dispatcher\Controller
}
/* Get the form which applies to all images - submitting this is 'finishing' */
$allImagesForm = new \IPS\Helpers\Form( 'all_images_form', 'submit', \IPS\Http\Url::internal( 'app=gallery&module=gallery&controller=submit&_step=image_information', 'front', 'gallery_submit' ) );
$url = \IPS\Http\Url::internal( 'app=gallery&module=gallery&controller=submit&_step=image_information', 'front', 'gallery_submit' );
if ( isset( \IPS\Request::i()->category ) )
{
$url = $url->setQueryString( 'category', \IPS\Request::i()->category );
}
$allImagesForm = new \IPS\Helpers\Form( 'all_images_form', 'submit', $url );
$allImagesForm->add( new \IPS\Helpers\Form\TextArea( 'image_credit_info', NULL, FALSE ) );
$allImagesForm->add( new \IPS\Helpers\Form\Text( 'image_copyright', NULL, FALSE, array( 'maxLength' => 255 ) ) );
$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( $values = $allImagesForm->values( TRUE ) )
{
/* Are we copying image details? */
if( isset( \IPS\Request::i()->copyImageDetails ) AND \IPS\Request::i()->copyImageDetails == 1 )
{
/* Grab the first details we can find */
try
{
$details = \IPS\Db::i()->select( 'upload_data', 'gallery_images_uploads', array( 'upload_data IS NOT NULL AND upload_session=?', session_id() ) )->first();
\IPS\Db::i()->update( 'gallery_images_uploads', array( 'upload_data' => $details ), array( 'upload_data IS NULL AND upload_session=?', session_id() ) );
}
catch( \UnderflowException $e ){}
}
else
{
$data['copyImageDetails'] = ( isset( $data['copyImageDetails'] ) ) ? $data['copyImageDetails'] : false;
}
return array_merge( $data, $values );
}
@@ -573,12 +635,18 @@ class _submit extends \IPS\Dispatcher\Controller
*/
protected function _editImageForm( $images, $currentlyEditing, $category )
{
if( $currentlyEditing === NULL ){
if( $currentlyEditing === NULL )
{
$currentlyEditing = 0;
}
/* Initate form */
$form = new \IPS\Helpers\Form( 'image_information_' . $currentlyEditing, 'continue_next_image', \IPS\Http\Url::internal( 'app=gallery&module=gallery&controller=submit&_step=image_information', 'front', 'gallery_submit' ) );
$url = \IPS\Http\Url::internal( 'app=gallery&module=gallery&controller=submit&_step=image_information', 'front', 'gallery_submit' );
if ( isset( \IPS\Request::i()->category ) )
{
$url = $url->setQueryString( 'category', \IPS\Request::i()->category );
}
$form = new \IPS\Helpers\Form( 'image_information_' . $currentlyEditing, 'continue_next_image', $url );
$form->hiddenValues['edit'] = $currentlyEditing;
$form->class = 'ipsForm_vertical';
@@ -659,14 +727,19 @@ class _submit extends \IPS\Dispatcher\Controller
}
/* Process */
$multiRedirect = (string) new \IPS\Helpers\MultipleRedirect( \IPS\Http\Url::internal( "app=gallery&module=gallery&controller=submit&_step=process", 'front', 'gallery_submit' ),
$url = \IPS\Http\Url::internal( 'app=gallery&module=gallery&controller=submit&_step=process', 'front', 'gallery_submit' );
if ( isset( \IPS\Request::i()->category ) )
{
$url = $url->setQueryString( 'category', \IPS\Request::i()->category );
}
$multiRedirect = (string) new \IPS\Helpers\MultipleRedirect( $url,
/* Function to process each image */
function( $offset ) use ( $data, $category, $album )
{
$offset = intval( $offset );
$existing = \IPS\Db::i()->select( '*', 'gallery_images_uploads', array( 'upload_session=?', session_id() ), 'upload_location', array( 0, 1 ) )->setKeyField( 'upload_location' );
$existing = \IPS\Db::i()->select( '*', 'gallery_images_uploads', array( 'upload_session=?', session_id() ), 'upload_unique_id', array( 0, 1 ) )->setKeyField( 'upload_location' );
foreach( $existing as $location => $file )
{
/* Start with the basic data */
@@ -695,6 +768,9 @@ class _submit extends \IPS\Dispatcher\Controller
{
$values['image_title'] = $file['upload_file_name'];
}
/* In case we used the quick tag and copied details */
$values['image_title'] = str_replace( '%n', $offset + 1, $values['image_title'] );
/* Create image */
if ( ( !isset( $values['image_copyright'] ) or !$values['image_copyright'] ) and $data['image_copyright'] )
@@ -709,6 +785,7 @@ class _submit extends \IPS\Dispatcher\Controller
{
$values['image_auto_follow'] = TRUE;
}
$image = \IPS\gallery\Image::createFromForm( $values, $category, FALSE );
$image->markRead();
@@ -1,13 +1,12 @@
<?php
/**
* @brief View image
* @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
* @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 04 Mar 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\gallery\modules\front\gallery;
@@ -51,7 +50,7 @@ class _view extends \IPS\Content\Controller
if ( !$this->image->canView( \IPS\Member::loggedIn() ) )
{
\IPS\Output::i()->error( $this->image->container()->errorMessage(), '2G188/1', 403, '' );
}
}
}
catch ( \OutOfRangeException $e )
{
@@ -176,14 +175,12 @@ class _view extends \IPS\Content\Controller
{
if( \IPS\IN_DEV )
{
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'videojs/video.dev.js', 'gallery', 'interface' ) );
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'videojs/video.js', 'gallery', 'interface' ) );
}
else
{
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'videojs/video.js', 'gallery', 'interface' ) );
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'videojs/video.min.js', 'gallery', 'interface' ) );
}
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'videojs/videojs-loadswf.js', 'gallery', 'interface' ) );
}
/* Store bandwidth log */
@@ -223,6 +220,103 @@ class _view extends \IPS\Content\Controller
) );
}
/* Add JSON-ld */
\IPS\Output::i()->jsonLd['gallery'] = array(
'@context' => "http://schema.org",
'@type' => $this->image->media ? "VideoObject" : "VisualArtwork",
'@id' => (string) $this->image->url(),
'url' => (string) $this->image->url(),
'name' => htmlspecialchars( $this->image->mapped('title'), ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ),
'description' => strip_tags( $this->image->truncated() ),
'dateCreated' => \IPS\DateTime::ts( $this->image->date )->format( \IPS\DateTime::ISO8601 ),
'fileFormat' => $this->image->file_type,
'keywords' => $this->image->tags(),
'author' => array(
'@type' => 'Person',
'name' => htmlspecialchars( \IPS\Member::load( $this->image->member_id )->name, ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ),
'url' => (string) \IPS\Member::load( $this->image->member_id )->url(),
'image' => \IPS\Member::load( $this->image->member_id )->get_photo()
),
'interactionStatistic' => array(
array(
'@type' => 'InteractionCounter',
'interactionType' => "http://schema.org/ViewAction",
'userInteractionCount' => $this->image->views
)
)
);
if ( $this->image->container()->allow_comments AND $this->image->directContainer()->allow_comments )
{
\IPS\Output::i()->jsonLd['gallery']['interactionStatistic'][] = array(
'@type' => 'InteractionCounter',
'interactionType' => "http://schema.org/CommentAction",
'userInteractionCount' => $this->image->mapped('num_comments')
);
\IPS\Output::i()->jsonLd['gallery']['commentCount'] = $this->image->mapped('num_comments');
}
if ( $this->image->container()->allow_reviews AND $this->image->directContainer()->allow_reviews )
{
\IPS\Output::i()->jsonLd['gallery']['interactionStatistic'][] = array(
'@type' => 'InteractionCounter',
'interactionType' => "http://schema.org/ReviewAction",
'userInteractionCount' => $this->image->mapped('num_reviews')
);
\IPS\Output::i()->jsonLd['gallery']['aggregateRating'] = array(
'@type' => 'AggregateRating',
'ratingValue' => $this->image->averageReviewRating(),
'reviewCount' => $this->image->reviews,
'bestRating' => \IPS\Settings::i()->reviews_rating_out_of
);
}
if( $this->image->media )
{
if( $this->image->medium_file_name )
{
\IPS\Output::i()->jsonLd['gallery']['thumbnail'] = (string) \IPS\File::get( 'gallery_Images', $this->image->medium_file_name )->url;
\IPS\Output::i()->jsonLd['gallery']['thumbnailUrl'] = (string) \IPS\File::get( 'gallery_Images', $this->image->medium_file_name )->url;
}
\IPS\Output::i()->jsonLd['gallery']['contentSize'] = (string) \IPS\File::get( 'gallery_Images', $this->image->original_file_name )->filesize();
\IPS\Output::i()->jsonLd['gallery']['contentSize'] = htmlspecialchars( $this->image->mapped('title'), ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE );
}
else
{
$mediumFile = \IPS\File::get( 'gallery_Images', $this->image->medium_file_name );
$dimensions = $mediumFile->getImageDimensions();
\IPS\Output::i()->jsonLd['gallery']['artMedium'] = 'Digital';
\IPS\Output::i()->jsonLd['gallery']['width'] = $dimensions[0];
\IPS\Output::i()->jsonLd['gallery']['height'] = $dimensions[1];
\IPS\Output::i()->jsonLd['gallery']['image'] = array(
'@type' => 'ImageObject',
'url' => (string) $mediumFile->url,
'caption' => htmlspecialchars( $this->image->mapped('title'), ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ),
'thumbnail' => (string) \IPS\File::get( 'gallery_Images', $this->image->thumb_file_name )->url,
'width' => $dimensions[0],
'height' => $dimensions[1],
);
if( count( $this->image->metadata ) )
{
\IPS\Output::i()->jsonLd['gallery']['image']['exifData'] = array();
foreach( $this->image->metadata as $k => $v )
{
\IPS\Output::i()->jsonLd['gallery']['image']['exifData'][] = array(
'@type' => 'PropertyValue',
'name' => $k,
'value' => $v
);
}
}
\IPS\Output::i()->jsonLd['gallery']['thumbnailUrl'] = (string) \IPS\File::get( 'gallery_Images', $this->image->thumb_file_name )->url;
}
/* Display */
if( isset( \IPS\Request::i()->imageSize ) )
{
@@ -259,6 +353,40 @@ class _view extends \IPS\Content\Controller
}
}
/**
* Download the full size image
*
* @return void
*/
protected function download()
{
try
{
/* Get file and data */
$size = ( isset( \IPS\Request::i()->imageSize ) AND \IPS\Request::i()->imageSize AND \IPS\Request::i()->imageSize != 'large' ) ? \IPS\Request::i()->imageSize . "_file_name" : "masked_file_name";
$file = \IPS\File::get( 'gallery_Images', $this->image->$size );
$headers = array_merge( \IPS\Output::getCacheHeaders( time(), 360 ), array( "Content-Disposition" => \IPS\Output::getContentDisposition( 'download', $file->originalFilename ), "X-Content-Type-Options" => "nosniff" ) );
/* Send headers and print file */
\IPS\Output::i()->sendStatusCodeHeader( 200 );
\IPS\Output::i()->sendHeader( "Content-type: " . \IPS\File::getMimeType( $file->originalFilename ) . ";charset=UTF-8" );
foreach( $headers as $key => $header )
{
\IPS\Output::i()->sendHeader( $key . ': ' . $header );
}
\IPS\Output::i()->sendHeader( "Content-Length: " . $file->filesize() );
$file->printFile();
exit;
}
catch ( \UnderflowException $e )
{
\IPS\Output::i()->sendOutput( '', 404 );
}
}
/**
* View all of the metadata for this image
*
@@ -269,7 +397,7 @@ class _view extends \IPS\Content\Controller
/* Set navigation and title */
$this->_setBreadcrumbAndTitle( $this->image );
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('gallery_metadata');
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'gallery_metadata', FALSE, array( 'sprintf' => $this->image->caption ) );
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'view' )->metadata( $this->image );
}
@@ -340,11 +468,11 @@ class _view extends \IPS\Content\Controller
/* Determine angle to rotate */
if( \IPS\Request::i()->direction == 'right' )
{
$angle = 270;
$angle = 90;
}
else
{
$angle = 90;
$angle = 270;
}
/* Rotate the image and rebuild thumbnails */
@@ -488,7 +616,7 @@ class _view extends \IPS\Content\Controller
$form->add( $field );
}
}
$form->add( new \IPS\Helpers\Form\Node( 'move_to_category', NULL, NULL, array( 'class' => 'IPS\\gallery\\Category', 'permissionCheck' => 'add' ), function( $val ) {
$form->add( new \IPS\Helpers\Form\Node( 'move_to_category', NULL, NULL, array( 'clubs' => true, 'class' => 'IPS\\gallery\\Category', 'permissionCheck' => 'add' ), function( $val ) {
if ( !$val and isset( \IPS\Request::i()->move_to ) and \IPS\Request::i()->move_to == 'category' )
{
throw new \DomainException('form_required');
@@ -569,9 +697,25 @@ class _view extends \IPS\Content\Controller
try
{
$container = $this->image->container();
foreach ( $container->parents() as $parent )
if ( $club = $container->club() )
{
\IPS\Output::i()->breadcrumb[] = array( $parent->url(), $parent->_title );
\IPS\core\FrontNavigation::$clubTabActive = TRUE;
\IPS\Output::i()->breadcrumb = array();
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( 'app=core&module=clubs&controller=directory', 'front', 'clubs_list' ), \IPS\Member::loggedIn()->language()->addToStack('module__core_clubs') );
\IPS\Output::i()->breadcrumb[] = array( $club->url(), $club->name );
if ( \IPS\Settings::i()->clubs_header == 'sidebar' )
{
\IPS\Output::i()->sidebar['contextual'] = \IPS\Theme::i()->getTemplate( 'clubs', 'core' )->header( $club, $container, 'sidebar' );
}
}
else
{
foreach ( $container->parents() as $parent )
{
\IPS\Output::i()->breadcrumb[] = array( $parent->url(), $parent->_title );
}
}
\IPS\Output::i()->breadcrumb[] = array( $container->url(), $container->_title );
}