Version 4.7.0
This commit is contained in:
1 parent
517a5e1f70
commit
8ba7d43898
1933 files changed
+65613
-11332
No files matched your search
@@ -117,6 +117,11 @@ class _Item extends \IPS\Content\Item implements
|
||||
* @brief [Content] Key for hide reasons
|
||||
*/
|
||||
public static $hideLogKey = 'gallery-album';
|
||||
|
||||
/**
|
||||
* @brief Used for the datalayer
|
||||
*/
|
||||
public static $contentType = 'album_item';
|
||||
|
||||
/**
|
||||
* Get title
|
||||
@@ -279,29 +284,37 @@ class _Item extends \IPS\Content\Item implements
|
||||
* @param \IPS\gallery\Category $category Category we are submitted in
|
||||
* @return string
|
||||
*/
|
||||
public static function submitRestrictionWhere( $member, $category )
|
||||
public static function submitRestrictionWhere( $member, \IPS\gallery\Category $category ) : string
|
||||
{
|
||||
$member = $member ?: \IPS\Member::loggedIn();
|
||||
|
||||
/* For starters, allow us to submit to public albums and our own albums */
|
||||
$wheres = array(
|
||||
'(album_submit_type=' . \IPS\gallery\Album::AUTH_SUBMIT_OWNER . ' and album_owner_id=' . $member->member_id . ')',
|
||||
'(album_submit_type=' . \IPS\gallery\Album::AUTH_SUBMIT_PUBLIC . ')'
|
||||
);
|
||||
|
||||
/* Now allow us to submit to albums that allow group submissions */
|
||||
$wheres[] = '(album_submit_type=' . \IPS\gallery\Album::AUTH_SUBMIT_GROUPS . ' AND ' . \IPS\Db::i()->findInSet( 'album_submit_access', $member->groups ) . ')';
|
||||
|
||||
/* And where we as an individual member are allowed to submit */
|
||||
$wheres[] = '(album_submit_type=' . \IPS\gallery\Album::AUTH_SUBMIT_MEMBERS . ' AND (' . \IPS\Db::i()->findInSet( 'album_submit_access', $member->socialGroups() ) . ' OR album_owner_id=' . $member->member_id . ' ) )';
|
||||
|
||||
/* And finally, if we're in a club and we allow anyone in the club to submit, handle that */
|
||||
if( $category->club() AND \in_array( $category->club()->id, $member->clubs() ) )
|
||||
/* Guests can't create albums so we can skip all the member specific stuff */
|
||||
if( !$member->member_id )
|
||||
{
|
||||
$wheres[] = '(album_submit_type=' . \IPS\gallery\Album::AUTH_SUBMIT_CLUB . ')';
|
||||
return '(album_submit_type=' . \IPS\gallery\Album::AUTH_SUBMIT_PUBLIC . ')';
|
||||
}
|
||||
else
|
||||
{
|
||||
/* For starters, allow us to submit to public albums and our own albums */
|
||||
$wheres = array(
|
||||
'(album_submit_type=' . \IPS\gallery\Album::AUTH_SUBMIT_OWNER . ' and album_owner_id=' . $member->member_id . ')',
|
||||
'(album_submit_type=' . \IPS\gallery\Album::AUTH_SUBMIT_PUBLIC . ')'
|
||||
);
|
||||
|
||||
return '(album_owner_id=' . $member->member_id . ' OR ' . implode( ' OR ', $wheres ) . ')';
|
||||
/* Now allow us to submit to albums that allow group submissions */
|
||||
$wheres[] = '(album_submit_type=' . \IPS\gallery\Album::AUTH_SUBMIT_GROUPS . ' AND ' . \IPS\Db::i()->findInSet( 'album_submit_access', $member->groups ) . ')';
|
||||
|
||||
/* And where we as an individual member are allowed to submit */
|
||||
$wheres[] = '(album_submit_type=' . \IPS\gallery\Album::AUTH_SUBMIT_MEMBERS . ' AND (' . \IPS\Db::i()->findInSet( 'album_submit_access', $member->socialGroups() ) . ' OR album_owner_id=' . $member->member_id . ' ) )';
|
||||
|
||||
/* And finally, if we're in a club and we allow anyone in the club to submit, handle that */
|
||||
if( $category->club() AND \in_array( $category->club()->id, $member->clubs() ) )
|
||||
{
|
||||
$wheres[] = '(album_submit_type=' . \IPS\gallery\Album::AUTH_SUBMIT_CLUB . ')';
|
||||
}
|
||||
|
||||
return '(album_owner_id=' . $member->member_id . ' OR ' . implode( ' OR ', $wheres ) . ')';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -486,9 +499,10 @@ class _Item extends \IPS\Content\Item implements
|
||||
* @param array $articles Articles language strings
|
||||
* @param array $indexData Search index data
|
||||
* @param array $itemData Data about the item
|
||||
* @param bool $includeLinks Include links to member profile
|
||||
* @return string
|
||||
*/
|
||||
public static function searchResultSummaryLanguage( $authorData, $articles, $indexData, $itemData )
|
||||
public static function searchResultSummaryLanguage( $authorData, $articles, $indexData, $itemData, $includeLinks = TRUE )
|
||||
{
|
||||
if( !\in_array( 'IPS\Content\Comment', class_parents( $indexData['index_class'] ) ) )
|
||||
{
|
||||
@@ -647,7 +661,7 @@ class _Item extends \IPS\Content\Item implements
|
||||
$images[] = array( 'gallery_Images' => $image->masked_file_name );
|
||||
}
|
||||
|
||||
return \count( $images ) ? $images : NULL;
|
||||
return \count( $images ) ? \array_slice( $images, 0, $limit ) : NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -945,7 +945,7 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
* @param \IPS\Helpers\Form $form Form object
|
||||
* @return void
|
||||
*/
|
||||
public function clubForm( \IPS\Helpers\Form $form )
|
||||
public function clubForm( \IPS\Helpers\Form $form, \IPS\Member\Club $club )
|
||||
{
|
||||
$itemClass = static::$contentItemClass;
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'club_node_name', $this->_id ? $this->_title : \IPS\Member::loggedIn()->language()->addToStack( $itemClass::$title . '_pl' ), TRUE, array( 'maxLength' => 255 ) ) );
|
||||
@@ -967,6 +967,11 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
);
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'category_sort_options', $this->sort_options ?: 'updated', FALSE, array( 'options' => $sortoptions ), NULL, NULL, NULL, 'category_sort_options' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'category_sort_options_img', $this->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, 'category_sort_options_img' ) );
|
||||
|
||||
if( $club->type == 'closed' )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'club_node_public', $this->id ? $this->isPublic() : FALSE ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -997,4 +1002,10 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
\IPS\File::claimAttachments( 'gallery-new-cat', $this->id, NULL, 'description' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief The class of the ACP \IPS\Node\Controller that manages this node type
|
||||
*/
|
||||
protected static $acpController = "IPS\\gallery\\modules\\admin\\gallery\\categories";
|
||||
|
||||
}
|
||||
@@ -91,6 +91,11 @@ 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
|
||||
|
||||
@@ -634,7 +634,10 @@ class _Image extends \IPS\Content\Item implements
|
||||
public static function searchEngineFiltering( &$filters, &$query )
|
||||
{
|
||||
/* Make sure our CSS is output */
|
||||
\IPS\gallery\Application::outputCss();
|
||||
if( \IPS\Dispatcher::hasInstance() )
|
||||
{
|
||||
\IPS\gallery\Application::outputCss();
|
||||
}
|
||||
|
||||
/* Loop through and see if we are also including albums */
|
||||
$includingAlbums = FALSE;
|
||||
@@ -1181,6 +1184,7 @@ class _Image extends \IPS\Content\Item implements
|
||||
/* 'template' => "...", // This is the javascript template for the submission form */
|
||||
/* This has to be converted from kB to mB */
|
||||
'maxFileSize' => \IPS\Member::loggedIn()->group['g_max_upload'] ? ( \IPS\Member::loggedIn()->group['g_max_upload'] / 1024 ) : NULL,
|
||||
'canBeModerated' => TRUE
|
||||
) );
|
||||
}
|
||||
else
|
||||
@@ -1193,6 +1197,7 @@ class _Image extends \IPS\Content\Item implements
|
||||
/* 'template' => "...", // This is the javascript template for the submission form */
|
||||
/* This has to be converted from kB to mB */
|
||||
'maxFileSize' => \IPS\Member::loggedIn()->group['g_max_upload'] ? ( \IPS\Member::loggedIn()->group['g_max_upload'] / 1024 ) : NULL,
|
||||
'canBeModerated' => TRUE
|
||||
) );
|
||||
}
|
||||
}
|
||||
@@ -1224,6 +1229,8 @@ class _Image extends \IPS\Content\Item implements
|
||||
parent::processForm( $values );
|
||||
|
||||
/* Set a few details */
|
||||
$oldContent = NULL;
|
||||
$sendFilterNotifications = FALSE;
|
||||
if ( isset( $values['image_description'] ) )
|
||||
{
|
||||
if ( !$this->_new )
|
||||
@@ -1231,11 +1238,6 @@ class _Image extends \IPS\Content\Item implements
|
||||
$oldContent = $this->description;
|
||||
}
|
||||
$this->description = $values['image_description'];
|
||||
$sendFilterNotifications = $this->checkProfanityFilters( FALSE, $this->_new );
|
||||
if ( !$this->_new AND $sendFilterNotifications === FALSE )
|
||||
{
|
||||
$this->sendAfterEditNotifications( $oldContent );
|
||||
}
|
||||
}
|
||||
if ( isset( $values['image_copyright'] ) )
|
||||
{
|
||||
@@ -1253,9 +1255,14 @@ class _Image extends \IPS\Content\Item implements
|
||||
}
|
||||
|
||||
/* Get the file... */
|
||||
$file = NULL;
|
||||
if( isset( $values['imageLocation'] ) AND $values['imageLocation'] )
|
||||
{
|
||||
$file = \IPS\File::get( 'gallery_Images', $values['imageLocation'] );
|
||||
if ( isset( $values['imageRequiresModeration'] ) )
|
||||
{
|
||||
$file->requiresModeration = $values['imageRequiresModeration'];
|
||||
}
|
||||
$this->original_file_name = (string) $file;
|
||||
|
||||
/* Get some details about the file */
|
||||
@@ -1322,6 +1329,38 @@ class _Image extends \IPS\Content\Item implements
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Check profanity filters */
|
||||
$filesForImageScanner = [];
|
||||
if ( ( isset( $values['imageLocation'] ) AND $values['imageLocation'] AND ( $values['imageLocation'] instanceof \IPS\File ) ) )
|
||||
{
|
||||
$filesForImageScanner[] = $values['imageLocation'];
|
||||
}
|
||||
elseif ( $file )
|
||||
{
|
||||
$filesForImageScanner[] = $file;
|
||||
}
|
||||
if ( $this->media and isset( $values['image_thumbnail'] ) and $values['image_thumbnail'] )
|
||||
{
|
||||
if ( $values['image_thumbnail'] instanceof \IPS\File )
|
||||
{
|
||||
$filesForImageScanner[] = $values['image_thumbnail'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$thumbnail = \IPS\File::get( 'gallery_Images', $values['image_thumbnail'] );
|
||||
if ( isset( $values['image_thumbnail_requires_moderation'] ) and $values['image_thumbnail_requires_moderation'] )
|
||||
{
|
||||
$thumbnail->requiresModeration = TRUE;
|
||||
}
|
||||
$filesForImageScanner[] = $thumbnail;
|
||||
}
|
||||
}
|
||||
$sendFilterNotifications = $this->checkProfanityFilters( FALSE, !$this->_new, NULL, NULL, NULL, NULL, $filesForImageScanner );
|
||||
if ( !$this->_new AND $sendFilterNotifications === FALSE )
|
||||
{
|
||||
$this->sendAfterEditNotifications( $oldContent );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1447,8 +1486,8 @@ class _Image extends \IPS\Content\Item implements
|
||||
$thumbnailDimensions = array();
|
||||
$watermarks = explode( ',', \IPS\Settings::i()->gallery_watermark_images );
|
||||
|
||||
/* Create the various thumbnails */
|
||||
$largeImage = \IPS\File::create( 'gallery_Images', 'large.' . $file->originalFilename, $this->createImageFile( $file, explode( 'x', \IPS\Settings::i()->gallery_large_dims ), FALSE, \in_array( 'large', $watermarks ) ), $file->container );
|
||||
/* Create the various thumbnails - For animated gifs use the original image for the large version */
|
||||
$largeImage = $file->isAnimatedImage() ? $file : \IPS\File::create( 'gallery_Images', 'large.' . $file->originalFilename, $this->createImageFile( $file, explode( 'x', \IPS\Settings::i()->gallery_large_dims ), FALSE, \in_array( 'large', $watermarks ) ), $file->container );
|
||||
$this->masked_file_name = (string) $largeImage;
|
||||
|
||||
$thumbnailDimensions['large'] = $largeImage->getImageDimensions();
|
||||
@@ -2039,7 +2078,7 @@ class _Image extends \IPS\Content\Item implements
|
||||
}
|
||||
}
|
||||
|
||||
return array( '( gallery_images.image_album_id IS NULL OR gallery_images.image_album_id IN(?) )', \IPS\Db::i()->select( 'album_id', 'gallery_albums', $subQuery ) );
|
||||
return array( '( gallery_images.image_album_id=0 OR gallery_images.image_album_id IN( ' . \IPS\Db::i()->select( 'album_id', 'gallery_albums', $subQuery )->returnFullQuery() . ' ) )' );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2051,7 +2090,7 @@ class _Image extends \IPS\Content\Item implements
|
||||
* @param string|NULL $permissionKey A key which has a value in the permission map (either of the container or of this class) matching a column ID in core_permission_index or NULL to ignore permissions
|
||||
* @param mixed $includeHiddenItems Include hidden items? NULL to detect if currently logged in member has permission, -1 to return public content only, TRUE to return unapproved content and FALSE to only return unapproved content the viewing member submitted
|
||||
* @param int $queryFlags Select bitwise flags
|
||||
* @param \IPS\Member $member The member (NULL to use currently logged in member)
|
||||
* @param \IPS\Member|NULL $member The member (NULL to use currently logged in member)
|
||||
* @param bool $joinContainer If true, will join container data (set to TRUE if your $where clause depends on this data)
|
||||
* @param bool $joinComments If true, will join comment data (set to TRUE if your $where clause depends on this data)
|
||||
* @param bool $joinReviews If true, will join review data (set to TRUE if your $where clause depends on this data)
|
||||
@@ -2133,7 +2172,7 @@ class _Image extends \IPS\Content\Item implements
|
||||
*/
|
||||
public static function followWhere( &$joinContainer, &$joins )
|
||||
{
|
||||
return array_merge( parent::followWhere( $joinContainer, $joins ), array( static::getItemsWithPermissionWhere( array(), \IPS\Member::loggedIn(), $joins ) ) );
|
||||
return array_merge( parent::followWhere( $joinContainer, $joins ), static::getItemsWithPermissionWhere( array(), \IPS\Member::loggedIn(), $joins ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2343,7 +2382,7 @@ class _Image extends \IPS\Content\Item implements
|
||||
|
||||
$result[] = array( 'gallery_Images' => $this->masked_file_name );
|
||||
|
||||
return $result;
|
||||
return \array_slice( $result, 0, $limit );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2409,4 +2448,4 @@ class _Image extends \IPS\Content\Item implements
|
||||
) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,6 +96,11 @@ 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
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user