Version 4.3.6

This commit is contained in:
Neo committed 2025-12-19 05:49:12 -08:00
1 parent fe1acf984a
commit 1a0c7fd3c2
609 files changed
+14707 -5726

No files matched your search

+11
View File
@@ -145,4 +145,15 @@ class _Application extends \IPS\Application
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'gallery_responsive.css', 'gallery', 'front' ) );
}
}
/**
* Get any settings that are uploads
*
* @return array
*/
public function uploadSettings()
{
/* Apps can overload this */
return array( 'gallery_watermark_path' );
}
}
+16 -15
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<javascript app="gallery">
<file javascript_app="gallery" javascript_location="front" javascript_path="controllers/browse" javascript_name="ips.browse.lightbox.js" javascript_type="controller" javascript_version="103005" javascript_position="1000200"><![CDATA[/**
<file javascript_app="gallery" javascript_location="front" javascript_path="controllers/browse" javascript_name="ips.browse.lightbox.js" javascript_type="controller" javascript_version="103038" javascript_position="1000200"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -57,8 +57,9 @@
}
if( state.data.controller != 'gallery.front.view.image' ){
if( state.data.controller != 'gallery.front.browse.imageLightbox' || ( _.isUndefined( state.data.initialLaunch ) || state.data.initialLaunch != true ) ) {
if( state.data.controller == 'gallery.front.browse.imageLightbox' && ( _.isUndefined( state.data.initialLaunch ) || state.data.initialLaunch != true ) ) {
this.closeLightboxNextStateChange = false;
Debug.log( state.data );
this.closeLightbox();
}
return;
@@ -72,7 +73,7 @@
}
// If the image ID we are loading is already on the page, we didn't switch to a different page yet
if( this.scope.find( 'div[data-imageId="' + state.data.imageID + '"]' ).length ){
if( $('[data-role="tableRows"] div[data-imageId="' + state.data.imageID + '"]' ).length ){
return;
}
@@ -192,7 +193,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="gallery" javascript_location="front" javascript_path="controllers/browse" javascript_name="ips.browse.list.js" javascript_type="controller" javascript_version="103005" javascript_position="1000200">/**
<file javascript_app="gallery" javascript_location="front" javascript_path="controllers/browse" javascript_name="ips.browse.list.js" javascript_type="controller" javascript_version="103038" javascript_position="1000200">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -240,7 +241,7 @@
}
});
}(jQuery, _));</file>
<file javascript_app="gallery" javascript_location="admin" javascript_path="controllers/settings" javascript_name="ips.settings.settings.js" javascript_type="controller" javascript_version="103005" javascript_position="1000050">/**
<file javascript_app="gallery" javascript_location="admin" javascript_path="controllers/settings" javascript_name="ips.settings.settings.js" javascript_type="controller" javascript_version="103038" javascript_position="1000050">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -297,7 +298,7 @@
});
}(jQuery, _));</file>
<file javascript_app="gallery" javascript_location="front" javascript_path="controllers/submit" javascript_name="ips.submit.chooseCategory.js" javascript_type="controller" javascript_version="103005" javascript_position="1000100"><![CDATA[/**
<file javascript_app="gallery" javascript_location="front" javascript_path="controllers/submit" javascript_name="ips.submit.chooseCategory.js" javascript_type="controller" javascript_version="103038" javascript_position="1000100"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -491,7 +492,7 @@
});
}(jQuery, _));]]></file>
<file javascript_app="gallery" javascript_location="front" javascript_path="controllers/submit" javascript_name="ips.submit.existingAlbums.js" javascript_type="controller" javascript_version="103005" javascript_position="1000100"><![CDATA[/**
<file javascript_app="gallery" javascript_location="front" javascript_path="controllers/submit" javascript_name="ips.submit.existingAlbums.js" javascript_type="controller" javascript_version="103038" javascript_position="1000100"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -538,7 +539,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="gallery" javascript_location="front" javascript_path="controllers/submit" javascript_name="ips.submit.uploadImages.js" javascript_type="controller" javascript_version="103005" javascript_position="1000100"><![CDATA[/**
<file javascript_app="gallery" javascript_location="front" javascript_path="controllers/submit" javascript_name="ips.submit.uploadImages.js" javascript_type="controller" javascript_version="103038" javascript_position="1000100"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -669,7 +670,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="gallery" javascript_location="front" javascript_path="controllers/submit" javascript_name="ips.submit.wrapper.js" javascript_type="controller" javascript_version="103005" javascript_position="1000100"><![CDATA[/**
<file javascript_app="gallery" javascript_location="front" javascript_path="controllers/submit" javascript_name="ips.submit.wrapper.js" javascript_type="controller" javascript_version="103038" javascript_position="1000100"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -1362,7 +1363,7 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="gallery" javascript_location="front" javascript_path="controllers/view" javascript_name="ips.view.image.js" javascript_type="controller" javascript_version="103005" javascript_position="1000150"><![CDATA[/**
<file javascript_app="gallery" javascript_location="front" javascript_path="controllers/view" javascript_name="ips.view.image.js" javascript_type="controller" javascript_version="103038" javascript_position="1000150"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -2084,7 +2085,7 @@ console.dir(imageSize);
}
});
}(jQuery, _));]]></file>
<file javascript_app="gallery" javascript_location="front" javascript_path="controllers/view" javascript_name="ips.view.note.js" javascript_type="controller" javascript_version="103005" javascript_position="1000150"><![CDATA[/**
<file javascript_app="gallery" javascript_location="front" javascript_path="controllers/view" javascript_name="ips.view.note.js" javascript_type="controller" javascript_version="103038" javascript_position="1000150"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -2514,7 +2515,7 @@ console.dir(imageSize);
}
});
}(jQuery, _));]]></file>
<file javascript_app="gallery" javascript_location="front" javascript_path="controllers/view" javascript_name="ips.view.notes.js" javascript_type="controller" javascript_version="103005" javascript_position="1000150"><![CDATA[/**
<file javascript_app="gallery" javascript_location="front" javascript_path="controllers/view" javascript_name="ips.view.notes.js" javascript_type="controller" javascript_version="103038" javascript_position="1000150"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
@@ -2597,7 +2598,7 @@ console.dir(imageSize);
}
});
}(jQuery, _));]]></file>
<file javascript_app="gallery" javascript_location="front" javascript_path="templates" javascript_name="ips.templates.browse.js" javascript_type="template" javascript_version="103005" javascript_position="1000050"><![CDATA[ips.templates.set('gallery.patchwork.indexItem', " \
<file javascript_app="gallery" javascript_location="front" javascript_path="templates" javascript_name="ips.templates.browse.js" javascript_type="template" javascript_version="103038" javascript_position="1000050"><![CDATA[ips.templates.set('gallery.patchwork.indexItem', " \
{{#showThumb}}\
<span class='cGalleryPatchwork_item' style='width: {{dims.width}}px; height: {{dims.height}}px; margin: {{dims.margin}}px {{dims.marginRight}}px {{dims.margin}}px {{dims.marginLeft}}px'>\
{{/showThumb}}\
@@ -2675,7 +2676,7 @@ ips.templates.set('gallery.lightbox.wrapper', " \
<div class='cLightboxBack'></div>\
</div>\
");]]></file>
<file javascript_app="gallery" javascript_location="front" javascript_path="templates" javascript_name="ips.templates.submit.js" javascript_type="template" javascript_version="103005" javascript_position="1000050"><![CDATA[ips.templates.set('gallery.submit.imageItem', " \
<file javascript_app="gallery" javascript_location="front" javascript_path="templates" javascript_name="ips.templates.submit.js" javascript_type="template" javascript_version="103038" javascript_position="1000050"><![CDATA[ips.templates.set('gallery.submit.imageItem', " \
<div class='ipsAttach ipsImageAttach ipsPad_half ipsAreaBackground_light {{#done}}ipsAttach_done{{/done}}' id='{{id}}' data-role='file' data-fileid='{{id}}' data-fullsizeurl='{{imagesrc}}' data-thumbnailurl='{{thumbnail}}' data-isImage='1'>\
<ul class='ipsList_inline ipsImageAttach_controls'>\
<li data-role='insert' {{#insertable}}style='display: none'{{/insertable}}><a href='#' data-action='insertFile' class='ipsAttach_selection' data-ipsTooltip title='{{#lang}}insertIntoPost{{/lang}}'><i class='fa fa-plus'></i></a></li>\
@@ -2702,7 +2703,7 @@ ips.templates.set('gallery.lightbox.wrapper', " \
ips.templates.set('gallery.submit.imageItemWrapper', " \
<div class='cGallerySubmit_fileList'>{{{content}}}</div>\
");]]></file>
<file javascript_app="gallery" javascript_location="front" javascript_path="templates" javascript_name="ips.templates.view.js" javascript_type="template" javascript_version="103005" javascript_position="1000050"><![CDATA[ips.templates.set('gallery.notes.wrapper', " \
<file javascript_app="gallery" javascript_location="front" javascript_path="templates" javascript_name="ips.templates.view.js" javascript_type="template" javascript_version="103038" javascript_position="1000050"><![CDATA[ips.templates.set('gallery.notes.wrapper', " \
<div class='cGalleryNote' data-controller='gallery.front.view.note' data-noteID='{{id}}' data-note=\"{{note}}\" {{#editable}}data-editable{{/editable}} data-posLeft='{{left}}' data-posTop='{{top}}' data-dimWidth='{{width}}' data-dimHeight='{{height}}'>\
<div class='cGalleryNote_border'></div>\
<div class='cGalleryNote_note' style='display: none'>\
+2 -2
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<language>
<app key="gallery" version="103005">
<app key="gallery" version="103038">
<word key="__app_gallery" js="0">Gallery</word>
<word key="frontnavigation_gallery" js="0">Gallery</word>
<word key="gallery_title" js="0">Gallery</word>
@@ -60,7 +60,6 @@
<word key="g_create_albums_fo_desc" js="0">Restricted access albums are albums that only the creator and designated users can view</word>
<word key="g_album_limit" js="0">Maximum number of albums</word>
<word key="g_img_album_limit" js="0">Maximum number of images per album</word>
<word key="g_delete_own_albums" js="0">Can delete own albums?</word>
<word key="gallery_restrictions" js="0">Usage Restrictions</word>
<word key="g_movies" js="0">Can upload movies?</word>
<word key="g_movie_size" js="0">Maximum size of movies</word>
@@ -258,6 +257,7 @@
<word key="gaverage_filesize" js="0">Average Filesize</word>
<word key="number_of_views" js="0">Number of Views *</word>
<word key="gallery_bandwidth_used" js="0">Bandwidth Used *</word>
<word key="bandwidth_use_gallery" js="0">Bandwidth Use</word>
<word key="images_stat_of_total" js="0">%s (%d%% of total)</word>
<word key="images_stat_of_total_link" js="0">%s (%d%% of total) %s</word>
<word key="images_stat_average" js="0">%s (average for all users: %s)</word>
+16 -16
View File
@@ -37,9 +37,9 @@
"comment": "",
"decimals": null,
"default": "0",
"length": 10,
"length": 20,
"name": "album_owner_id",
"type": "INT",
"type": "BIGINT",
"unsigned": false,
"values": [],
"zerofill": false
@@ -1588,18 +1588,18 @@
"zerofill": false
},
"image_description": {
"allow_null": true,
"auto_increment": false,
"binary": false,
"comment": "",
"decimals": null,
"default": null,
"length": 0,
"name": "image_description",
"type": "TEXT",
"unsigned": false,
"type": "MEDIUMTEXT",
"length": 0,
"decimals": null,
"values": [],
"zerofill": false
"allow_null": true,
"default": null,
"comment": "",
"unsigned": false,
"zerofill": false,
"auto_increment": false,
"binary": false
},
"image_masked_file_name": {
"allow_null": true,
@@ -2826,9 +2826,9 @@
"comment": "",
"decimals": null,
"default": "0",
"length": 11,
"length": 20,
"name": "comment_author_id",
"type": "INT",
"type": "BIGINT",
"unsigned": false,
"values": [],
"zerofill": false
@@ -3039,9 +3039,9 @@
"comment": "",
"decimals": null,
"default": "0",
"length": 10,
"length": 20,
"name": "review_author",
"type": "INT",
"type": "BIGINT",
"unsigned": false,
"values": [],
"zerofill": false
+14 -14
View File
@@ -546,7 +546,7 @@
<ul class='ipsList_inline ipsType_left cGalleryCat_info'>
<li>{{if $category->lastImage() !== NULL}}<i class='fa fa-clock-o'></i> {datetime="$category->lastImage()->date"}{{endif}}</li>
{{if $category->allow_comments}}
<li class='ipsPos_right' data-ipsTooltip title='{lang="cat_comment_count" pluralize="$category->_comments"}'><i class='fa fa-comment'></i> {$category->_comments}</li>
<li class='ipsPos_right' data-ipsTooltip title='{lang="cat_comment_count" pluralize="$category->_commentsForDisplay"}'><i class='fa fa-comment'></i> {$category->_commentsForDisplay}</li>
{{endif}}
{{if $category->allow_albums}}
<li class='ipsPos_right' data-ipsTooltip title='{lang="cat_album_count" pluralize="$category->public_albums"}'><i class='fa fa-th-large'></i> {$category->public_albums}</li>
@@ -1051,9 +1051,9 @@
{{if $k === 'total_disk_spaceg'}}
{filesize="$v"}
{{elseif $k === 'largest_image'}}
<a href='{$v->url()}' target='_blank'>{$v->caption}</a> <span class="ipsType_light">({filesize="$v->file_size"})</span>
<a href='{$v->url()}' target='_blank' rel='noopener'>{$v->caption}</a> <span class="ipsType_light">({filesize="$v->file_size"})</span>
{{elseif $k === 'most_viewed_image'}}
<a href='{$v->url()}' target='_blank'>{$v->caption}</a> <span class="ipsType_light">({lang="num_views_with_number" pluralize="$v->views"})</span>
<a href='{$v->url()}' target='_blank' rel='noopener'>{$v->caption}</a> <span class="ipsType_light">({lang="num_views_with_number" pluralize="$v->views"})</span>
{{else}}
{$v}
{{endif}}
@@ -1545,7 +1545,7 @@
{{if $albumNode->coverPhoto('small')}}
<div class='ipsRichEmbed_masthead ipsRichEmbed_mastheadBg cGalleryEmbed ipsType_center'>
<a href='{$albumNode->url()}' style='background-image: url( "{backgroundimage="$albumNode->coverPhoto('small')"}" )'>
<img src='{$albumNode->coverPhoto('small')}' class='ipsHide' alt="{$album->name}">
<img src='{$albumNode->coverPhoto('small')}' class='ipsHide' alt="{$albumItem->name}">
</a>
</div>
{{endif}}
@@ -1773,7 +1773,7 @@
{{endif}}
</div>
</div>]]></template>
<template template_group="global" template_name="link" template_data="$image" template_location="global" template_app="gallery"><![CDATA[<div class='ipsContained ipsType_break'><a href="{$image->url()}" class="ipsType_blendLinks" target="_blank">{$image->caption}</a></div>]]></template>
<template template_group="global" template_name="link" template_data="$image" template_location="global" template_app="gallery"><![CDATA[<div class='ipsContained ipsType_break'><a href="{$image->url()}" class="ipsType_blendLinks" target="_blank" rel='noopener'>{$image->caption}</a></div>]]></template>
<template template_group="global" template_name="manageFollowNodeRow" template_data="$table, $headers, $rows" template_location="front" template_app="gallery"><![CDATA[{{foreach $rows as $row}}
{{$contentItemClass = $row::$contentItemClass;}}
<li class="ipsDataItem {{if $contentItemClass::containerUnread( $row )}}ipsDataItem_unread{{endif}} {{if method_exists( $row, 'tableClass' ) && $row->tableClass()}}ipsDataItem_{$row->tableClass()}{{endif}}" data-controller='core.front.system.manageFollowed' data-followID='{$row->_followData['follow_area']}-{$row->_followData['follow_rel_id']}'>
@@ -1803,8 +1803,8 @@
{{if $row->_items}}
<li>{lang="node_content_items" pluralize="$row->_items"}</li>
{{endif}}
{{if $row->_comments}}
<li>{lang="node_content_comments" pluralize="$row->_comments"}</li>
{{if $row->_commentsForDisplay}}
<li>{lang="node_content_comments" pluralize="$row->_commentsForDisplay"}</li>
{{endif}}
{{if $row->_reviews}}
<li>{lang="node_content_reviews" pluralize="$row->_reviews"}</li>
@@ -2205,7 +2205,7 @@
{{endif}}]]></template>
<template template_group="global" template_name="searchResultCommentSnippet" template_data="$indexData, $itemData, $image, $url, $reviewRating, $condensed" template_location="front" template_app="gallery"><![CDATA[{{if $condensed}}
{{if $image}}
<span class='ipsThumb_bg ipsThumb_small ipsPos_left' style='background-image: url("{backgroundimage="$image"}")'>
<span class='ipsThumb_bg ipsThumb_small ipsPos_left' style='background-image: url("{backgroundimage="(string) \IPS\File::get( 'gallery_Images', $image )->url"}")'>
<img src='{file="$image" extension="gallery_Images"}' alt="{$itemData['image_caption']}" class="">
</span>
{{else}}
@@ -2281,7 +2281,7 @@
]]></template>
<template template_group="stats" template_name="bandwidthButton" template_data="$member" template_location="admin" template_app="gallery"><![CDATA[
&nbsp;&nbsp;<a href="{url="app=core&module=members&controller=members&do=editBlock&block=IPS\\gallery\\extensions\\core\\MemberACPProfileContentTab\\Gallery&id={$member->member_id}"}" data-ipsDialog data-ipsDialog-title="{lang="bandwidth_use"}">({lang="bandwidth_use"})</a>]]></template>
&nbsp;&nbsp;<a href="{url="app=core&module=members&controller=members&do=editBlock&block=IPS\\gallery\\extensions\\core\\MemberACPProfileContentTab\\Gallery&id={$member->member_id}"}" data-ipsDialog data-ipsDialog-title="{lang="bandwidth_use_gallery"}">({lang="bandwidth_use_gallery"})</a>]]></template>
<template template_group="stats" template_name="graphs" template_data="$graph" template_location="admin" template_app="gallery"><![CDATA[{$graph|raw}
<div class="ipsPad_half ipsAreaBackground">
{lang="gallery_graph_disclaimer"}
@@ -2314,7 +2314,7 @@
{{endif}}
<tr>
<td>{template="userPhoto" app="core" group="global" params="$member"} {$member->name}</td>
<td><a href='{$member->url()->setQueryString( array( 'do' => 'content', 'type' => 'gallery_image' ) )}' target='_blank'>{$row['images']}</a></td>
<td><a href='{$member->url()->setQueryString( array( 'do' => 'content', 'type' => 'gallery_image' ) )}' target='_blank' rel='noopener'>{$row['images']}</a></td>
</tr>
{{endforeach}}
</tbody>
@@ -2929,7 +2929,7 @@
<a href='{$image->url()}' title='{lang="view_in_lightbox"}' class='ipsButton ipsButton_narrow ipsButton_link ipsButton_verySmall ipsButton_veryLight' data-ipsTooltip data-imageLightbox><i class='fa fa-expand'></i></a>
</li>
<li>
<a href='{file="$image->masked_file_name" extension="gallery_Images"}' title='{lang="view_fullsize_image"}' class='ipsButton ipsButton_narrow ipsButton_link ipsButton_verySmall ipsButton_veryLight' data-ipsTooltip target='_blank'><i class='fa fa-external-link'></i></a>
<a href='{file="$image->masked_file_name" extension="gallery_Images"}' title='{lang="view_fullsize_image"}' class='ipsButton ipsButton_narrow ipsButton_link ipsButton_verySmall ipsButton_veryLight' data-ipsTooltip target='_blank' rel='noopener'><i class='fa fa-external-link'></i></a>
</li>
</ul>
</div>
@@ -3404,7 +3404,7 @@
</li>
{{if !$image->media }}
<li>
<a href='{file="$image->masked_file_name" extension="gallery_Images"}' title='{lang="view_fullsize_image"}' class='ipsButton ipsButton_narrow ipsButton_link ipsButton_verySmall ipsButton_veryLight' data-ipsTooltip target='_blank' data-role="toggleFullscreen"></a>
<a href='{file="$image->masked_file_name" extension="gallery_Images"}' title='{lang="view_fullsize_image"}' class='ipsButton ipsButton_narrow ipsButton_link ipsButton_verySmall ipsButton_veryLight' data-ipsTooltip target='_blank' rel='noopener' data-role="toggleFullscreen"></a>
</li>
{{endif}}
</ul>
@@ -5182,8 +5182,8 @@ html[dir="rtl"] ul.cGallerySearchAlbumThumbs.ipsList_inline {
}
.cGalleryLightbox_info {
width: 425px;
min-width: 425px;
width: 445px;
min-width: 445px;
background: #fff;
overflow: auto;
}
+35 -1
View File
@@ -244,9 +244,43 @@
"102046": "4.2.7",
"102047": "4.2.8",
"102048": "4.2.8",
"102049": "4.2.9",
"103000": "4.3.0 Beta 1",
"103002": "4.3.0 Beta 2",
"103003": "4.3.0 Beta 3",
"103004": "4.3.0 Beta 4",
"103005": "4.3.0"
"103005": "4.3.0",
"103006": "4.3.1",
"103007": "4.3.1",
"103008": "4.3.1",
"103009": "4.3.2",
"103010": "4.3.2",
"103011": "4.3.3",
"103012": "4.3.3",
"103013": "4.3.3",
"103014": "4.3.3",
"103015": "4.3.3",
"103016": "4.3.3",
"103017": "4.3.3",
"103018": "4.3.3",
"103019": "4.3.3",
"103020": "4.3.3",
"103021": "4.3.4",
"103022": "4.3.4",
"103023": "4.3.4",
"103024": "4.3.4",
"103025": "4.3.4",
"103026": "4.3.5 Beta 1",
"103027": "4.3.5 Beta 2",
"103028": "4.3.5",
"103029": "4.3.5",
"103030": "4.3.5",
"103031": "4.3.5",
"103032": "4.3.5",
"103033": "4.3.6 Beta 1",
"103034": "4.3.6 Beta 2",
"103035": "4.3.6",
"103036": "4.3.6",
"103037": "4.3.6",
"103038": "4.3.6"
}
@@ -49,14 +49,15 @@ class _Albums
/**
* Permission check for attachments
*
* @param \IPS\Member $member The member
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param \IPS\Member $member The member
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param array $attachment The attachment data
* @param bool $viewOnly If true, just check if the user can see the attachment rather than download it
* @return bool
*/
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment )
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment, $viewOnly=FALSE )
{
try
{
@@ -49,14 +49,15 @@ class _Categories
/**
* Permission check for attachments
*
* @param \IPS\Member $member The member
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param \IPS\Member $member The member
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param array $attachment The attachment data
* @param bool $viewOnly If true, just check if the user can see the attachment rather than download it
* @return bool
*/
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment )
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment, $viewOnly=FALSE )
{
try
{
@@ -49,14 +49,15 @@ class _Images
/**
* Permission check for attachments
*
* @param \IPS\Member $member The member
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param \IPS\Member $member The member
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param array $attachment The attachment data
* @param bool $viewOnly If true, just check if the user can see the attachment rather than download it
* @return bool
*/
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment )
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment, $viewOnly=FALSE )
{
try
{
@@ -70,7 +70,7 @@ class _Images
foreach ( \IPS\Db::i()->select( '*', 'gallery_images', $where, 'image_date DESC', array( ( $page - 1 ) * $limit, $limit ) ) as $row )
{
$image = \IPS\gallery\Image::load( $row['image_id'] );
$obj = \IPS\File::get( 'gallery_Images', $row['image_original_file_name'] );
$obj = \IPS\File::get( 'gallery_Images', $image->masked_file_name );
$obj->contextInfo = $image->caption;
$return[ (string) $image->url() ] = $obj;
}
@@ -35,12 +35,11 @@ class _Gallery
if( $group->g_id != \IPS\Settings::i()->guest_group )
{
$form->addHeader( 'gallery_album_permissions' );
$form->add( new \IPS\Helpers\Form\YesNo( 'g_create_albums', $group->g_create_albums, FALSE, array( 'togglesOn' => array( 'g_create_albums_private', 'g_create_albums_fo', 'g_delete_own_albums', 'g_album_limit', 'g_img_album_limit' ) ) ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'g_create_albums', $group->g_create_albums, FALSE, array( 'togglesOn' => array( 'g_create_albums_private', 'g_create_albums_fo', 'g_album_limit', 'g_img_album_limit' ) ) ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'g_create_albums_private', $group->g_create_albums_private, FALSE, array(), NULL, NULL, NULL, 'g_create_albums_private' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'g_create_albums_fo', $group->g_create_albums_fo, FALSE, array(), NULL, NULL, NULL, 'g_create_albums_fo' ) );
$form->add( new \IPS\Helpers\Form\Number( 'g_album_limit', $group->g_album_limit, FALSE, array( 'unlimited' => 0 ), NULL, NULL, NULL, 'g_album_limit' ) );
$form->add( new \IPS\Helpers\Form\Number( 'g_img_album_limit', $group->g_img_album_limit, FALSE, array( 'unlimited' => 0 ), NULL, NULL, NULL, 'g_img_album_limit' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'g_delete_own_albums', $group->g_delete_own_albums, FALSE, array(), NULL, NULL, NULL, 'g_delete_own_albums' ) );
}
$form->addHeader( 'gallery_restrictions' );
@@ -69,7 +68,6 @@ class _Gallery
$group->g_create_albums_fo = $values['g_create_albums_fo'];
$group->g_album_limit = $values['g_album_limit'];
$group->g_img_album_limit = $values['g_img_album_limit'];
$group->g_delete_own_albums = $values['g_delete_own_albums'];
}
$group->g_movies = $values['g_movies'];
@@ -37,7 +37,7 @@ class _Album
'exclude' => array(),
'lessIsMore' => array(),
'neg1IsBest' => array(),
'zeroIsBest' => array( 'g_album_limit', 'g_img_album_limit', 'g_max_upload', 'g_max_transfer', 'g_max_views' ),
'zeroIsBest' => array( 'g_album_limit', 'g_img_album_limit', 'g_max_upload', 'g_max_transfer', 'g_max_views', 'g_movie_size' ),
);
}
}
@@ -79,7 +79,7 @@ class _Gallery extends \IPS\core\MemberACPProfile\Block
$bandwidthChart = new \IPS\Helpers\Chart\Database( \IPS\Http\Url::internal( "app=core&module=members&controller=members&do=editBlock&block=IPS\\gallery\\extensions\\core\\MemberACPProfileContentTab\\Gallery&id={$this->member->member_id}&chart=downloads&_graph=1" ), 'gallery_bandwidth', 'bdate', '', array( 'vAxis' => array( 'title' => \IPS\Member::loggedIn()->language()->addToStack( 'filesize_raw_k' ) ) ), 'LineChart', 'daily' );
$bandwidthChart->groupBy = 'bdate';
$bandwidthChart->where[] = array( 'member_id=?', $this->member->member_id );
$bandwidthChart->addSeries( \IPS\Member::loggedIn()->language()->addToStack('bandwidth_use'), 'number', 'ROUND((SUM(bsize)/1024),2)', FALSE );
$bandwidthChart->addSeries( \IPS\Member::loggedIn()->language()->addToStack('bandwidth_use_gallery'), 'number', 'ROUND((SUM(bsize)/1024),2)', FALSE );
return ( \IPS\Request::i()->isAjax() and isset( \IPS\Request::i()->_graph ) ) ? (string) $bandwidthChart : \IPS\Theme::i()->getTemplate( 'stats', 'gallery' )->graphs( (string) $bandwidthChart );
}
}
@@ -70,13 +70,13 @@ class _Album
* Get where clause to add to the member retrieval database query
*
* @param mixed $data The array returned from the save() method
* @return string|array|NULL Where clause
* @return array|NULL Where clause - must be a single array( "clause", ...binds )
*/
public function getQueryWhereClause( $data )
{
if( isset( $data['has_album'] ) )
{
return ( $data['has_album'] == 'yes' ) ? array( array( "gallery_albums.album_id IS NOT NULL" ) ) : array( array( "gallery_albums.album_id IS NULL" ) );
return ( $data['has_album'] == 'yes' ) ? array( "gallery_albums.album_id IS NOT NULL" ) : array( "gallery_albums.album_id IS NULL" );
}
return NULL;
@@ -1,3 +1,32 @@
<?php
/**
* @brief Member Form Extension
* @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 23 Mar 2017
*/
// Removed
namespace IPS\gallery\extensions\core\MemberForm;
/* 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;
}
class _Images
{
/**
* @deprecated
*
* @return bool
*/
final public function deprecated()
{
return TRUE;
}
}
@@ -33,7 +33,7 @@ class _CleanUpGalleryImages
{
try
{
$data['count'] = \IPS\Db::i()->select( 'COUNT(*)', 'gallery_images' )->first();
$data['count'] = \IPS\Db::i()->select( 'COUNT(*)', 'gallery_images', array( 'image_media=?', 0 ) )->first();
}
catch( \Exception $ex )
{
@@ -66,7 +66,7 @@ class _CleanUpGalleryImages
}
$last = NULL;
foreach( \IPS\Db::i()->select( '*', 'gallery_images', NULL, 'image_id ASC', array( $offset, 100 ) ) as $image )
foreach( \IPS\Db::i()->select( '*', 'gallery_images', array( 'image_media=?', 0 ), 'image_id ASC', array( $offset, 100 ) ) as $image )
{
$data['did']++;
@@ -85,8 +85,19 @@ class _CleanUpGalleryImages
$update = array( 'image_data' => json_encode( $sizes ) );
/* If we have a medium but no large image, or a thumb but no small image, adapt as appropriate */
/* If we have a medium but no large image, or a thumb but no small image, adapt as appropriate. Also if one image is mapped for
multiple columns be sure we don't remove it if we still need it. */
$keepMedium = FALSE;
if( $image['image_medium_file_name'] == $image['image_masked_file_name'] )
{
$keepMedium = TRUE;
}
$keepThumb = FALSE;
if( $image['image_thumb_file_name'] == $image['image_masked_file_name'] )
{
$keepThumb = TRUE;
}
if( !$image['image_masked_file_name'] AND $image['image_medium_file_name'] )
{
$image['image_masked_file_name'] = $image['image_medium_file_name'];
@@ -94,7 +105,6 @@ class _CleanUpGalleryImages
$keepMedium = TRUE;
}
$keepThumb = FALSE;
if( !$image['image_small_file_name'] AND $image['image_thumb_file_name'] )
{
$image['image_small_file_name'] = $image['image_thumb_file_name'];
@@ -76,7 +76,6 @@ class _Follow
$directContainer = ( !is_null( $data['album_id'] ) ) ? \IPS\gallery\Album::load( $data['album_id'] ) : \IPS\gallery\Category::load( $data['category_id'] );
$title = $directContainer->_title;
return array( 'text' => \IPS\Member::loggedIn()->language()->addToStack('backgroundQueue_follow', FALSE, array( 'htmlsprintf' => array( "<a href='{$directContainer->url()}' target='_blank'>{$title}</a>" ) ) ), 'complete' => $complete );
return array( 'text' => \IPS\Member::loggedIn()->language()->addToStack('backgroundQueue_follow', FALSE, array( 'htmlsprintf' => array( \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->basicUrl( $directContainer->url(), TRUE, $directContainer->_title, FALSE ) ) ) ), 'complete' => $complete );
}
}
@@ -89,8 +89,6 @@ class _RebuildGalleryImages
if( $last === NULL )
{
\IPS\Session::i()->log( 'acplogs__gallery_rebuilt' );
throw new \IPS\Task\Queue\OutOfRangeException;
}
@@ -45,7 +45,7 @@ class _Images
*/
public function getFilenames()
{
$count = \IPS\gallery\Image::getItemsWithPermission( array( 'image_media=?', 0 ), NULL, 10, 'read', \IPS\Content\Hideable::FILTER_AUTOMATIC, 0, NULL, FALSE, FALSE, FALSE, TRUE );
$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 );
@@ -77,7 +77,12 @@ class _Images
$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;
if ( ! $totalLimit )
{
return NULL;
}
if ( $totalLimit > -1 and ( $offset + $limit ) > $totalLimit )
{
$limit = $totalLimit - $offset;
@@ -136,7 +141,7 @@ class _Images
/* Image sitemap data */
$data['image:image'] = array(
'image:loc' => (string) \IPS\File::get( 'gallery_Images', $item->masked_file_name )->url,
'image:loc' => (string) \IPS\File::get( 'gallery_Images', $item->masked_file_name )->url->setScheme( ( mb_substr( \IPS\Settings::i()->base_url, 0, 5 ) === 'https' ) ? 'https' : 'http' ),
'image:caption' => $item->mapped('title'),
'image:title' => $item->mapped('title')
);
@@ -45,7 +45,7 @@ class _Videos
*/
public function getFilenames()
{
$count = \IPS\gallery\Image::getItemsWithPermission( array( 'image_media=?', 1 ), NULL, 10, 'read', \IPS\Content\Hideable::FILTER_AUTOMATIC, 0, NULL, FALSE, FALSE, FALSE, TRUE );
$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 );
@@ -77,7 +77,12 @@ class _Videos
$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;
if ( ! $totalLimit )
{
return NULL;
}
if ( $totalLimit > -1 and ( $offset + $limit ) > $totalLimit )
{
$limit = $totalLimit - $offset;
@@ -136,7 +141,7 @@ class _Videos
/* Video sitemap data */
$data['video:video'] = array(
'video:content_loc' => (string) \IPS\File::get( 'gallery_Images', $item->original_file_name )->url,
'video:content_loc' => (string) \IPS\File::get( 'gallery_Images', $item->original_file_name )->url->setScheme( ( mb_substr( \IPS\Settings::i()->base_url, 0, 5 ) === 'https' ) ? 'https' : 'http' ),
'video:description' => $item->mapped('content'),
'video:title' => $item->mapped('title'),
'video:rating' => $item->mapped('rating_average'),
@@ -149,7 +154,7 @@ class _Videos
if( $item->masked_file_name )
{
$data['video:video']['video:thumbnail_loc'] = (string) \IPS\File::get( 'gallery_Images', $item->masked_file_name )->url;
$data['video:video']['video:thumbnail_loc'] = (string) \IPS\File::get( 'gallery_Images', $item->masked_file_name )->url->setScheme( ( mb_substr( \IPS\Settings::i()->base_url, 0, 5 ) === 'https' ) ? 'https' : 'http' );
}
$priority = ( $item->sitemapPriority() ?: ( intval( isset( $settings["sitemap_{$class::$title}_priority"] ) ? $settings["sitemap_{$class::$title}_priority"] : \IPS\core\extensions\core\Sitemap\Content::RECOMMENDED_ITEM_PRIORITY ) ) );
@@ -359,6 +359,8 @@ class _browse extends \IPS\Content\Controller
\IPS\Output::i()->metaTags['og:image'] = $album->coverPhoto('masked');
}
\IPS\Output::i()->metaTags['og:title'] = $album->_title;
$albumItem = $album->asItem();
\IPS\core\Facebook\Pixel::i()->PageView = array(
'item_id' => $album->id,
@@ -498,6 +500,7 @@ class _browse extends \IPS\Content\Controller
}
/* Display form */
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'edit_album' );
\IPS\Output::i()->output = $form->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'forms', 'core' ) ), 'popupTemplate' ) );
}
@@ -608,9 +611,10 @@ class _browse extends \IPS\Content\Controller
}
/* And then redirect */
if( isset( $moveTo ) )
if( isset( $moveData['moveTo'] ) )
{
\IPS\Output::i()->redirect( $moveTo->url() );
$target = $moveData['moveToClass']::load($moveData['moveTo']);
\IPS\Output::i()->redirect( $target->url() );
}
else
{
@@ -118,7 +118,7 @@ class _submit extends \IPS\Dispatcher\Controller
$tagsField = $tagsField->html();
$imageTagsField->name = $imageTagsField->name . '_DEFAULT';
$imageTagsField = $imageTagsField->html();
$imageTagsField = $imageTagsField->html();
}
\IPS\Member::loggedIn()->language()->parseOutputForDisplay( $tagsField );
@@ -447,6 +447,7 @@ class _submit extends \IPS\Dispatcher\Controller
$tagsFieldName = $tagsField->name . '_' . $imageId;
$tagsField->name = $tagsFieldName;
$tagsPrefix = NULL;
$tagsValue = NULL;
foreach( $imagesData as $_imageData )
{
@@ -461,20 +462,20 @@ class _submit extends \IPS\Dispatcher\Controller
}
}
if( !isset( $tagsValue ) )
if( !$tagsValue )
{
$tagsValue = \IPS\Request::i()->tags_all;
$tagsPrefix = \IPS\Request::i()->prefix_all;
}
$form->add( $tagsField );
$checkboxInput = $tagsFieldName . '_freechoice_prefix';
$prefixinput = $tagsFieldName . '_prefix';
\IPS\Request::i()->$tagsFieldName = ( is_array( $tagsValue ) ) ? implode( "\n", $tagsValue ) : $tagsValue;
\IPS\Request::i()->$checkboxInput = 1;
\IPS\Request::i()->$prefixinput = $tagsPrefix;
$form->add( $tagsField );
}
}
}
@@ -580,7 +581,7 @@ class _submit extends \IPS\Dispatcher\Controller
if( !isset( $imageData['image_credit'] ) OR !$imageData['image_credit'] )
{
$imageData['image_credit'] = $values['credit_all'];
$imageData['image_credit_info'] = $values['credit_all'];
}
if( !isset( $imageData['image_tags'] ) OR !$imageData['image_tags'] )
@@ -693,6 +694,8 @@ class _submit extends \IPS\Dispatcher\Controller
/* Fix thumbnail reference if this is a video */
if( isset( $values['image_thumbnail'] ) )
{
$thumbnailReset = FALSE;
foreach( $values as $key => $value )
{
if( mb_strpos( $key, 'image_thumbnail_existing' ) === 0 )
@@ -702,15 +705,18 @@ class _submit extends \IPS\Dispatcher\Controller
$thumb = \IPS\Db::i()->select( '*', 'core_files_temp', array( 'id=?', $value ) )->first();
$values['image_thumbnail'] = $thumb['contents'];
$thumbnailReset = TRUE;
\IPS\Db::i()->delete( 'core_files_temp', array( 'id=?', $value ) );
break;
}
catch( \UnderflowException $e )
{
unset( $values['image_thumbnail'] );
}
catch( \UnderflowException $e ){}
}
}
if( !$thumbnailReset )
{
unset( $values['image_thumbnail'] );
}
}
/* If GPS is supported but the admin did not specify whether to show the map or not, then default to showing it */
@@ -232,12 +232,15 @@ class _view extends \IPS\Content\Controller
'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->averageReviewRating() )
{
\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 )
@@ -74,21 +74,6 @@
}
]
},
"6": {
"method": "addColumn",
"params": [
"core_groups",
{
"name": "g_delete_own_albums",
"type": "TINYINT",
"length": 1,
"null": false,
"default": 0,
"comment": "Can delete own albums?",
"unsigned": true
}
]
},
"7": {
"method": "addColumn",
"params": [
@@ -0,0 +1,12 @@
{
"1": {
"method": "delete",
"params": [
"core_sys_lang_words",
[
"word_key=?",
"gallery_use_square_thumbnails_desc"
]
]
}
}
@@ -0,0 +1,26 @@
{
"1": {
"method": "update",
"params": [
"gallery_categories",
{
"category_sort_options": "album_last_img_date"
},
[
"category_sort_options IS NULL"
]
]
},
"2": {
"method": "update",
"params": [
"gallery_categories",
{
"category_sort_options_img": "updated"
},
[
"category_sort_options_img IS NULL"
]
]
}
}
@@ -0,0 +1,96 @@
<?php
/**
* @brief 4.3.4 Upgrade Code
* @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 24 May 2018
*/
namespace IPS\gallery\setup\upg_103021;
/* 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;
}
/**
* 4.3.4 Upgrade Code
*/
class _Upgrade
{
/**
* Get rid of the duplicate setting
*
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
*/
public function step1()
{
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_groups' ), 'IPS\Member\Group' ) as $group )
{
if( $group->g_delete_own_albums AND $group->g_delete_own_posts != 1 )
{
$classes = explode( ',', $group->g_delete_own_posts );
if( !in_array( 'IPS\gallery\Album\Item', $classes ) )
{
$classes[] = 'IPS\gallery\Album\Item';
\IPS\Db::i()->update( 'core_groups', array( 'g_delete_own_posts' => implode( ',', $classes ) ), array( 'g_id=?', $group->g_id ) );
}
}
elseif( !$group->g_delete_own_albums AND $group->g_delete_own_posts == 1 )
{
$contentClasses = array( 'IPS\core\Messenger\Conversation' );
foreach ( \IPS\Application::allExtensions( 'core', 'ContentRouter', $group, NULL, NULL, FALSE ) as $extension )
{
/* It's possible when upgrading from 3.x that the modules table isn't populated, some extensions (clubs)
* Will throw an exception in this situation
*/
try
{
$class = new $extension;
}
catch( \OutOfRangeException $e )
{
continue;
}
foreach ( $class->classes as $class )
{
if ( isset( $class::$databaseColumnMap['author'] ) AND $class != 'IPS\gallery\Album\Item' )
{
$contentClasses[] = $class;
}
}
}
\IPS\Db::i()->update( 'core_groups', array( 'g_delete_own_posts' => implode( ',', $contentClasses ) ), array( 'g_id=?', $group->g_id ) );
}
elseif( !$group->g_delete_own_albums AND $group->g_delete_own_posts != 1 AND in_array( 'IPS\gallery\Album\Item', explode( ',', $group->g_delete_own_posts ) ) )
{
$classes = array_filter( explode( ',', $group->g_delete_own_posts ), function( $className ) {
return $className != 'IPS\gallery\Album\Item';
} );
\IPS\Db::i()->update( 'core_groups', array( 'g_delete_own_posts' => implode( ',', $classes ) ), array( 'g_id=?', $group->g_id ) );
}
}
\IPS\Db::i()->dropColumn( 'core_groups', 'g_delete_own_albums' );
return TRUE;
}
/**
* Custom title for this step
*
* @return string
*/
public function step1CustomTitle()
{
return "Removing duplicate setting";
}
}
@@ -0,0 +1,23 @@
{
"1": {
"method": "changeColumn",
"params": [
"gallery_images",
"image_description",
{
"name": "image_description",
"type": "MEDIUMTEXT",
"length": 0,
"decimals": null,
"values": [],
"allow_null": true,
"default": null,
"comment": "",
"unsigned": false,
"zerofill": false,
"auto_increment": false,
"binary": false
}
]
}
}
@@ -0,0 +1,14 @@
{
"1": {
"method": "update",
"params": [
"gallery_albums",
{
"album_sort_options": "updated"
},
[
"album_sort_options IS NULL"
]
]
}
}
@@ -0,0 +1,13 @@
{
"1": {
"method": "update",
"params": [
"gallery_images",
"image_last_comment=image_date",
[
"image_last_comment=?",
0
]
]
}
}
+124 -87
View File
@@ -144,44 +144,15 @@ class _Album extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\
{
$obj = parent::loadAndCheckPerms( $id );
$member = $member ?: \IPS\Member::loggedIn();
if ( !$obj->can( $perm ) )
{
throw new \OutOfRangeException;
}
if ( $obj->type == static::AUTH_TYPE_DELETED )
{
throw new \OutOfRangeException;
}
/* If we don't have edit permission in the category, check album restrictions */
if( !\IPS\gallery\Image::modPermission( 'edit', NULL, $obj->category() ) )
if ( !$obj->can( $perm ) )
{
/* Throw exception if this is a private album we can't access */
if( $obj->type == static::AUTH_TYPE_PRIVATE AND $obj->owner() != $member )
{
throw new \OutOfRangeException;
}
/* Throw exception if this is a restricted album we can't access */
if( $obj->type == static::AUTH_TYPE_RESTRICTED AND $obj->owner() != $member )
{
/* This will throw an exception if the row does not exist... but we need it to throw an OutOfRangeException */
try
{
if( !$member->member_id )
{
throw new \OutOfRangeException;
}
$member = \IPS\Db::i()->select( '*', 'core_sys_social_group_members', array( 'group_id=? AND member_id=?', $obj->allowed_access, $member->member_id ) )->first();
}
catch( \UnderflowException $e )
{
throw new \OutOfRangeException;
}
}
throw new \OutOfRangeException;
}
return $obj;
@@ -342,6 +313,16 @@ class _Album extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\
return $this->count_comments;
}
/**
* [Node] Get number of content comments (for display)
*
* @return int
*/
protected function get__commentsForDisplay()
{
return $this->_comments;
}
/**
* [Node] Get number of content reviews
*
@@ -539,7 +520,7 @@ class _Album extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\
if( \IPS\Member::loggedIn()->group['g_create_albums_fo'] )
{
$return[] = new \IPS\Helpers\Form\SocialGroup( 'album_allowed_access', $album ? $album->allowed_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_allowed_access' );
$return[] = new \IPS\Helpers\Form\SocialGroup( 'album_allowed_access', $album ? (int) $album->allowed_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_allowed_access' );
}
$submitTypes = array(
@@ -567,7 +548,7 @@ class _Album extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\
$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' );
$return[] = new \IPS\Helpers\Form\SocialGroup( 'album_submit_access_members', ( $album AND $album->submit_type == static::AUTH_SUBMIT_MEMBERS ) ? $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' );
$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\Select( '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' );
@@ -922,7 +903,7 @@ class _Album extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\
$this->_items = \IPS\Db::i()->select( 'COUNT(*) as total', 'gallery_images', array( 'image_album_id=? AND image_approved=1', $this->id ), NULL, NULL, NULL, NULL, \IPS\Db::SELECT_FROM_WRITE_SERVER )->first();
$this->_unapprovedItems = \IPS\Db::i()->select( 'COUNT(*) as total', 'gallery_images', array( 'image_album_id=? AND image_approved=0', $this->id ), NULL, NULL, NULL, NULL, \IPS\Db::SELECT_FROM_WRITE_SERVER )->first();
$this->_comments = \IPS\Db::i()->select( 'COUNT(*) as total', 'gallery_comments', array( 'gallery_images.image_album_id=? AND comment_approved=1', $this->id ), NULL, NULL, NULL, NULL, \IPS\Db::SELECT_FROM_WRITE_SERVER )->join( 'gallery_images', 'image_id=comment_img_id' )->first();
$this->_comments = \IPS\Db::i()->select( 'COUNT(*) as total', 'gallery_comments', array( 'gallery_images.image_album_id=? AND comment_approved=1 AND gallery_images.image_approved=1', $this->id ), NULL, NULL, NULL, NULL, \IPS\Db::SELECT_FROM_WRITE_SERVER )->join( 'gallery_images', 'image_id=comment_img_id' )->first();
$this->_unapprovedComments = \IPS\Db::i()->select( 'COUNT(*) as total', 'gallery_comments', array( 'gallery_images.image_album_id=? AND comment_approved=0', $this->id ), NULL, NULL, NULL, NULL, \IPS\Db::SELECT_FROM_WRITE_SERVER )->join( 'gallery_images', 'image_id=comment_img_id' )->first();
$this->_reviews = \IPS\Db::i()->select( 'COUNT(*) as total', 'gallery_reviews', array( 'gallery_images.image_album_id=? AND review_approved=1', $this->id ), NULL, NULL, NULL, NULL, \IPS\Db::SELECT_FROM_WRITE_SERVER )->join( 'gallery_images', 'image_id=review_image_id' )->first();
@@ -1218,11 +1199,6 @@ class _Album extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\
return TRUE;
}
if( $this->owner_id == \IPS\Member::loggedIn()->member_id AND \IPS\Member::loggedIn()->group['g_delete_own_albums'] )
{
return TRUE;
}
return $this->asItem()->canDelete();
}
@@ -1243,68 +1219,129 @@ class _Album extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\
/* Figure out member */
$member = $member ?: \IPS\Member::loggedIn();
/* If we are checking 'add' permission, verify if we can add */
if( $permission == 'add' )
/* Are we looking at a member? */
if( $member instanceof \IPS\Member )
{
/* First check we can submit to this album based on the "Submissions" setting */
switch ( $this->submit_type )
/* If we don't have edit permission in the category, check album restrictions */
if( !\IPS\gallery\Image::modPermission( 'edit', $member, $this->category() ) )
{
/* Owner */
case static::AUTH_SUBMIT_OWNER:
if ( $this->owner_id != $member->member_id )
/* Deny access if the album is private and we aren't the owner */
if( $this->type == static::AUTH_TYPE_PRIVATE AND $this->owner() != $member )
{
return FALSE;
}
/* If this is a restricted album, check that we're "on the list" */
if( $this->type == static::AUTH_TYPE_RESTRICTED AND $this->owner() != $member )
{
try
{
if( !$member->member_id )
{
return FALSE;
}
\IPS\Db::i()->select( '*', 'core_sys_social_group_members', array( 'group_id=? AND member_id=?', $this->allowed_access, $member->member_id ) )->first();
}
catch( \UnderflowException $e )
{
return FALSE;
}
break;
/* Chosen groups */
case static::AUTH_SUBMIT_GROUPS:
if ( !$member->inGroup( explode( ',', $this->submit_access ) ) )
{
return FALSE;
}
break;
/* Chosen members */
case static::AUTH_SUBMIT_MEMBERS:
if ( !in_array( $this->submit_access, $member->socialGroups() ) )
{
return FALSE;
}
break;
/* Club */
case static::AUTH_SUBMIT_CLUB:
if ( $club = $this->category()->club() and !in_array( $club->id, $member->clubs() ) )
{
return FALSE;
}
break;
}
}
/* Verify if we can add any more files to this album */
if( \IPS\Member::loggedIn()->group['g_img_album_limit'] AND \IPS\Member::loggedIn()->group['g_img_album_limit'] - ( $this->count_imgs + $this->count_imgs_hidden ) < 1 )
/* If we are checking 'add' permission, verify if we can add */
if( $permission == 'add' )
{
return FALSE;
/* First check we can submit to this album based on the "Submissions" setting */
switch ( $this->submit_type )
{
/* Owner */
case static::AUTH_SUBMIT_OWNER:
if ( $this->owner_id != $member->member_id )
{
return FALSE;
}
break;
/* Chosen groups */
case static::AUTH_SUBMIT_GROUPS:
if ( !$member->inGroup( explode( ',', $this->submit_access ) ) )
{
return FALSE;
}
break;
/* Chosen members */
case static::AUTH_SUBMIT_MEMBERS:
if ( !in_array( $this->submit_access, $member->socialGroups() ) AND $this->owner_id != $member->member_id )
{
return FALSE;
}
break;
/* Club */
case static::AUTH_SUBMIT_CLUB:
if ( $club = $this->category()->club() and !in_array( $club->id, $member->clubs() ) )
{
return FALSE;
}
break;
}
/* Verify if we can add any more files to this album */
if( $member->group['g_img_album_limit'] AND $member->group['g_img_album_limit'] - ( $this->count_imgs + $this->count_imgs_hidden ) < 1 )
{
return FALSE;
}
}
/* Albums can be hidden, so make sure to test permissions */
if( $asItem->hidden() )
{
if( !$asItem->canView( $member ) )
{
return FALSE;
}
$methodToCheck = "can" . \ucwords( $permission );
if( method_exists( $asItem, $methodToCheck ) )
{
return $asItem->$methodToCheck( $member );
}
else
{
return $asItem->can( $permission, $member );
}
}
}
/* Albums can be hidden, so make sure to test permissions */
if( $asItem->hidden() )
/* Or are we looking at a group? */
else
{
if( !$asItem->canView( $member ) )
if( $permission == 'add' )
{
return FALSE;
/* Verify if the group is in the submit list */
if( $this->submit_type == static::AUTH_SUBMIT_GROUPS AND !in_array( $member->g_id, explode( ',', $this->submit_access ) ) )
{
return FALSE;
}
/* Verify if we can add any more files to this album */
if( $member->g_img_album_limit AND $member->g_img_album_limit - ( $this->count_imgs + $this->count_imgs_hidden ) < 1 )
{
return FALSE;
}
}
$methodToCheck = "can" . \ucwords( $permission );
/* Albums can be hidden, so make sure to test permissions */
if( $asItem->hidden() )
{
if( !$asItem->can( 'view', $member ) )
{
return FALSE;
}
if( method_exists( $asItem, $methodToCheck ) )
{
return $asItem->$methodToCheck( $member );
}
else
{
return $asItem->can( $permission, $member );
}
}
+15 -1
View File
@@ -309,7 +309,7 @@ class _Item extends \IPS\Content\Item implements
$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() ) . ')';
$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() ) )
@@ -660,4 +660,18 @@ class _Item extends \IPS\Content\Item implements
return count( $images ) ? $images : NULL;
}
/**
* Delete Record
*
* @return void
*/
public function delete()
{
parent::delete();
/* Recount category info */
$this->container()->resetCommentCounts();
$this->container()->save();
}
}
@@ -174,11 +174,21 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
*/
protected function get__comments()
{
$comments = $this->count_comments;
return (int) $this->count_comments;
}
/**
* [Node] Get number of content comments (including children)
*
* @return int
*/
protected function get__commentsForDisplay()
{
$comments = $this->_comments;
foreach( $this->children() as $child )
{
$comments += $child->count_comments;
$comments += $child->_comments;
}
return $comments;
@@ -796,6 +806,17 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
return parent::deleteOrMoveFormSubmit( $values );
}
/**
* Set Default Values
*
* @return void
*/
public function setDefaultValues()
{
$this->sort_options = 'album_last_img_date';
$this->sort_options_img = 'updated';
}
/**
* Get template for node tables
*
@@ -900,6 +921,19 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
$form->add( new \IPS\Helpers\Form\YesNo( 'category_allow_albums', $this->id ? $this->allow_albums : TRUE ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'category_allow_comments', $this->id ? $this->allow_comments : TRUE ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'category_allow_reviews', $this->id ? $this->allow_reviews : FALSE ) );
$sortoptions = array(
'album_last_img_date' => 'sort_updated',
'album_last_comment' => 'sort_last_comment',
'album_rating_aggregate' => 'sort_rating',
'album_comments' => 'sort_num_comments',
'album_reviews' => 'sort_num_reviews',
'album_name' => 'sort_album_name',
'album_count_comments' => 'sort_album_count_comments',
'album_count_imgs' => 'sort_album_count_imgs'
);
$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' ) );
}
/**
@@ -914,6 +948,8 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
$this->allow_albums = $values['category_allow_albums'];
$this->allow_comments = $values['category_allow_comments'];
$this->allow_reviews = $values['category_allow_reviews'];
$this->sort_options = $values['category_sort_options'];
$this->sort_options_img = $values['category_sort_options_img'];
$this->can_tag = TRUE;
$this->tag_prefixes = TRUE;
+27 -15
View File
@@ -646,7 +646,8 @@ class _Image extends \IPS\Content\Item implements
{
if( $filter->itemClass == 'IPS\\gallery\\Image' )
{
$filter->containerClasses = array( 'IPS\\gallery\\Category' );
/* container class can be category or album */
$filter->containerClasses = array( 'IPS\\gallery\\Category', 'IPS\\gallery\\Album' );
}
}
}
@@ -855,9 +856,9 @@ class _Image extends \IPS\Content\Item implements
}
/**
* @brief Images on same date
* @brief Images that match the current one based on the current sort
*/
protected $imagesSameDate = NULL;
protected $imagesSameSort = NULL;
/**
* Get the next or previous 5 images in the container
@@ -874,37 +875,42 @@ class _Image extends \IPS\Content\Item implements
if( $this->album_id )
{
$where[] = array( 'image_album_id=?', $this->album_id );
$sortBy = static::$databaseColumnMap[ $this->directContainer()->_sortBy ];
}
else
{
$where[] = array( 'image_category_id=?', $this->category_id );
$where[] = array( 'image_album_id=?', 0 );
$sortBy = static::$databaseColumnMap[ $this->directContainer()->sort_options_img ?: 'updated' ];
}
$where['id'] = array( 'image_id<>?', $this->id );
$column = $this->getDateColumn();
if( $this->imagesSameDate === NULL )
if( $sortBy == 'caption' )
{
$where['date'] = array( static::$databasePrefix . $column . '= ?', $this->$column );
$this->imagesSameDate = \IPS\Db::i()->select( 'COUNT(*)', 'gallery_images', $where )->first();
$direction = ( $direction == 'ASC' ) ? 'DESC' : 'ASC';
$dir = ( $dir == '>' ) ? '<' : '>';
}
if( !$this->imagesSameDate )
if( $this->imagesSameSort === NULL )
{
$where['date'] = array( static::$databasePrefix . $column . " {$dir}= ?", $this->$column );
return iterator_to_array( \IPS\gallery\Image::getItemsWithPermission( $where, static::$databasePrefix . $column . ' ' . $direction, $count ) );
$where['date'] = array( static::$databasePrefix . $sortBy . '= ?', $this->$sortBy );
$this->imagesSameSort = \IPS\Db::i()->select( 'COUNT(*)', 'gallery_images', $where )->first();
}
if( !$this->imagesSameSort )
{
$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 ) );
}
else
{
$where['date'] = array( static::$databasePrefix . $column . '= ?', $this->$column );
unset( $where['id'] );
$results = array();
$seen = FALSE;
foreach( \IPS\gallery\Image::getItemsWithPermission( $where, static::$databasePrefix . $column . ' ' . $direction, NULL ) as $image )
foreach( \IPS\gallery\Image::getItemsWithPermission( $where, static::$databasePrefix . $sortBy . ' ' . $direction . ', image_id ' . $direction, NULL ) as $image )
{
if( !$seen )
{
@@ -926,8 +932,8 @@ class _Image extends \IPS\Content\Item implements
if( count( $results ) < $count )
{
$where['date'] = array( static::$databasePrefix . $column . " {$dir} ?", $this->$column );
$results = array_merge( $results, iterator_to_array( \IPS\gallery\Image::getItemsWithPermission( $where, static::$databasePrefix . $column . ' ' . $direction, $count - count( $results ) ) ) );
$where['date'] = array( static::$databasePrefix . $sortBy . " {$dir} ?", $this->$sortBy );
$results = array_merge( $results, iterator_to_array( \IPS\gallery\Image::getItemsWithPermission( $where, static::$databasePrefix . $sortBy . ' ' . $direction, $count - count( $results ) ) ) );
}
return $results;
@@ -1371,6 +1377,12 @@ class _Image extends \IPS\Content\Item implements
*/
public function deleteThumbnails()
{
/* We don't delete thumbnails for videos */
if( $this->media )
{
return;
}
foreach( array( 'masked_file_name', 'small_file_name' ) as $size )
{
if( isset( $this->_data[ $size ] ) AND $this->$size AND $this->$size != $this->original_file_name )
+13 -17
View File
@@ -50,6 +50,19 @@ class _Table extends \IPS\Helpers\Table\Content
return parent::__construct( $class, $baseUrl, $where, $container, $includeHidden, $permCheck, $honorPinned );
}
/**
* Get rows
*
* @param array $advancedSearchValues Values from the advanced search form
* @return array
*/
public function getRows( $advancedSearchValues )
{
$this->sortOptions['title'] = $this->sortOptions['title'] . ' ASC, image_id ';
return parent::getRows( $advancedSearchValues );
}
/**
* Build the form to move images
*
@@ -225,21 +238,4 @@ class _Table extends \IPS\Helpers\Table\Content
}
return;
}
/**
* Return the sort direction to use for links
*
* @note Abstracted so other table helper instances can adjust as needed
* @param string $column Sort by string
* @return string [asc|desc]
*/
public function getSortDirection( $column )
{
if( $column == 'image_caption' )
{
return 'asc';
}
return 'desc';
}
}
+1
View File
@@ -56,6 +56,7 @@ class _albums extends \IPS\Content\Widget
public function init()
{
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'widgets.css', 'gallery', 'front' ) );
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'gallery.css', 'gallery', 'front' ) );
parent::init();
}
}