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

+3 -3
View File
@@ -1,9 +1,9 @@
<?php
/**
* @brief Downloads Application Class
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2013 Invision Power Services, Inc.
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @package Invision Community
* @subpackage Downloads
* @since 27 Sep 2013
* @version
+155
View File
@@ -0,0 +1,155 @@
<?php
/**
* @brief Download categories API
* @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 Downloads
* @since 3 Apr 2017
*/
namespace IPS\downloads\api;
/* 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;
}
/**
* @brief Calendars API
*/
class _categories extends \IPS\Node\Api\NodeController
{
/**
* Class
*/
protected $class = 'IPS\downloads\Category';
/**
* GET /downloads/category
* Get list of calendars
*
* @return \IPS\Api\PaginatedResponse<IPS\calendar\Calendar>
*/
public function GETindex()
{
/* Return */
return $this->_list();
}
/**
* GET /downloads/category/{id}
* Get specific category
*
* @param int $id ID Number
*
* @return \IPS\Api\PaginatedResponse<IPS\downloads\Category>
*/
public function GETitem( $id )
{
/* Return */
return $this->_view( $id );
}
/**
* POST /downloads/category
* Create a category
*
* @apiparam int|null parent The ID number of the parent the category should be created in. NULL for root.
* @apiparam int moderation Files must be approved?
* @apiparam int moderation_edits New versions must be re-approved?
* @apiparam int allowss Allow screenshots?
* @apiparam int reqss Require screenshots?
* @apiparam int comments Allow comments?
* @apiparam int comments_moderation Comments must be approved?
* @apiparam int reviews Allow reviews?
* @apiparam int reviews_mod Reviews must be approved?
* @apiparam int reviews_download Files must be downloaded before a review can be left?
*
* @return \IPS\downloads\Category
*/
public function POSTindex()
{
return $this->_create();
}
/**
* POST /downloads/category/{id}
* Edit a category
*
* @apiparam int|null parent The ID number of the parent the category should be created in. NULL for root.
* @apiparam int moderation Files must be approved?
* @apiparam int moderation_edits New versions must be re-approved?
* @apiparam int allowss Allow screenshots?
* @apiparam int reqss Require screenshots?
* @apiparam int comments Allow comments?
* @apiparam int comments_moderation Comments must be approved?
* @apiparam int reviews Allow reviews?
* @apiparam int reviews_mod Reviews must be approved?
* @apiparam int reviews_download Files must be downloaded before a review can be left?
*
* @return \IPS\downloads\Category
*/
public function POSTitem( $id )
{
$class = static::$class;
$category = $class::load( $id );
$category = $this->_createOrUpdate( $category );
return $category;
}
/**
* DELETE /downloads/category/{id}
* Delete a category
*
* @param int $id ID Number
* @return void
*/
public function DELETEitem( $id )
{
return $this->_delete( $id );
}
/**
* Create or update node
*
* @param \IPS\node\Model $node The node
* @return \IPS\node\Model
*/
protected function _createOrUpdate( \IPS\node\Model $category )
{
if ( !\IPS\Request::i()->title )
{
throw new \IPS\Api\Exception( 'NO_TITLE', '', 400 );
}
foreach ( array( 'title' => "downloads_category_{$category->id}", 'description' => "downloads_category_{$category->id}_desc" ) as $fieldKey => $langKey )
{
if ( isset( \IPS\Request::i()->$fieldKey ) )
{
\IPS\Lang::saveCustom( 'downloads', $langKey, \IPS\Request::i()->$fieldKey );
if ( $fieldKey === 'title' )
{
$category->name_furl = \IPS\Http\Url\Friendly::seoTitle( \IPS\Request::i()->$fieldKey );
}
}
}
$category->parent = (int) \IPS\Request::i()->parent?: 0;
foreach ( array( 'moderation', 'moderation_edits', 'allowss', 'reqss', 'comments', 'comment_moderation', 'reviews', 'reviews_mod', 'reviews_download' ) as $k )
{
if ( isset( \IPS\Request::i()->$k ) )
{
$category->bitoptions[ $k ] = \IPS\Request::i()->$k;
}
}
return parent::_createOrUpdate( $category );
}
}
+4 -5
View File
@@ -1,13 +1,12 @@
<?php
/**
* @brief Downloads File Comments API
* @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 Downloads
* @since 10 Dec 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\api;
+4 -5
View File
@@ -1,13 +1,12 @@
<?php
/**
* @brief Downloads Files API
* @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 Downloads
* @since 8 Dec 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\api;
+4 -5
View File
@@ -1,13 +1,12 @@
<?php
/**
* @brief Downloads File Reviews API
* @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 Downloads
* @since 10 Dec 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\api;
@@ -5,7 +5,8 @@
"categories_add": "categories_add",
"categories_edit": "categories_edit",
"categories_permissions": "categories_permissions",
"categories_delete": "categories_delete",
"categories_permissions": "categories_permissions",
"categories_massManageContent": "categories_massManageContent",
"categories_recount_downloads": "categories_recount_downloads"
},
"fields": {
+87 -51
View File
@@ -1,4 +1,55 @@
{
"app=core&module=members&controller=groups&searchResult=4_idm_add_paid": {
"lang_key": "idm_add_paid",
"restriction": "groups_manage",
"keywords": [
"charge for files",
"paid downloads",
"paid files",
"submit paid download",
"submit paid files"
]
},
"app=core&module=members&controller=groups&searchResult=4_idm_bulk_submit": {
"lang_key": "idm_bulk_submit",
"restriction": "groups_manage",
"keywords": [
"files",
"multiple files",
"multiple files permisison",
"several files submit",
"submit",
"submit multiple files"
]
},
"app=core&module=members&controller=groups&searchResult=4_idm_linked_files": {
"lang_key": "idm_linked_files",
"restriction": "groups_manage",
"keywords": [
"downloads upload via URL",
"file via URL",
"submit file URL",
"submit file via URL",
"upload file via URL"
]
},
"app=core&module=members&controller=groups&searchResult=4_idm_view_downloads": {
"lang_key": "idm_view_downloads",
"restriction": "groups_manage",
"keywords": [
"downloaded files",
"files",
"view who downloaded"
]
},
"app=core&module=members&controller=members&searchResult=form_idm_block_submissions": {
"lang_key": "idm_block_submissions",
"restriction": null,
"keywords": [
"Files",
"Submit"
]
},
"app=downloads&module=downloads&controller=categories": {
"lang_key": "menu__downloads_downloads_categories",
"restriction": "categories_manage",
@@ -664,6 +715,35 @@
"rss export"
]
},
"app=downloads&module=downloads&controller=settings&searchResult=form_idm_show_featured": {
"lang_key": "idm_show_featured",
"restriction": "settings_manage",
"keywords": [
"featured"
]
},
"app=downloads&module=downloads&controller=settings&searchResult=form_idm_show_highest_rated": {
"lang_key": "idm_show_highest_rated",
"restriction": "settings_manage",
"keywords": [
"highest rated"
]
},
"app=downloads&module=downloads&controller=settings&searchResult=form_idm_show_most_downloaded": {
"lang_key": "idm_show_most_downloaded",
"restriction": "settings_manage",
"keywords": [
"most downloaded"
]
},
"app=downloads&module=downloads&controller=settings&searchResult=form_idm_show_newest": {
"lang_key": "idm_show_newest",
"restriction": "settings_manage",
"keywords": [
"new files",
"what's new"
]
},
"app=downloads&module=downloads&controller=settings&searchResult=form_idm_watermarkpath": {
"lang_key": "idm_watermarkpath",
"restriction": "settings_manage",
@@ -686,6 +766,13 @@
"commission"
]
},
"app=downloads&module=downloads&controller=settings&searchResult=idm_nexus_tax": {
"lang_key": "idm_nexus_tax",
"restriction": "settings_manage",
"keywords": [
"tax"
]
},
"app=downloads&module=downloads&controller=settings&searchResult=idm_nexus_transfee": {
"lang_key": "idm_nexus_transfee",
"restriction": "settings_manage",
@@ -716,56 +803,5 @@
"keywords": [
"top submitters"
]
},
"app=core&module=members&controller=groups&searchResult=4_idm_add_paid": {
"lang_key": "idm_add_paid",
"restriction": "groups_manage",
"keywords": [
"charge for files",
"paid downloads",
"paid files",
"submit paid download",
"submit paid files"
]
},
"app=core&module=members&controller=groups&searchResult=4_idm_bulk_submit": {
"lang_key": "idm_bulk_submit",
"restriction": "groups_manage",
"keywords": [
"files",
"multiple files",
"multiple files permisison",
"several files submit",
"submit",
"submit multiple files"
]
},
"app=core&module=members&controller=groups&searchResult=4_idm_linked_files": {
"lang_key": "idm_linked_files",
"restriction": "groups_manage",
"keywords": [
"downloads upload via URL",
"file via URL",
"submit file URL",
"submit file via URL",
"upload file via URL"
]
},
"app=core&module=members&controller=groups&searchResult=4_idm_view_downloads": {
"lang_key": "idm_view_downloads",
"restriction": "groups_manage",
"keywords": [
"downloaded files",
"files",
"view who downloaded"
]
},
"app=core&module=members&controller=members&searchResult=form_idm_block_submissions": {
"lang_key": "idm_block_submissions",
"restriction": null,
"keywords": [
"Files",
"Submit"
]
}
}
+15 -13
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<javascript app="downloads">
<file javascript_app="downloads" javascript_location="front" javascript_path="controllers/submit" javascript_name="ips.submit.linkedScreenshots.js" javascript_type="controller" javascript_version="101099" javascript_position="1000050">/**
* IPS Community Suite 4
* (c) 2013 Invision Power Services - http://www.invisionpower.com
<file javascript_app="downloads" javascript_location="front" javascript_path="controllers/submit" javascript_name="ips.submit.linkedScreenshots.js" javascript_type="controller" javascript_version="102002" javascript_position="1000050">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
* ips.submit.linkedScreenshots.js - Controller to handle linked screenshots
*
@@ -72,9 +72,9 @@
}
});
}(jQuery, _));</file>
<file javascript_app="downloads" javascript_location="front" javascript_path="controllers/submit" javascript_name="ips.submit.main.js" javascript_type="controller" javascript_version="101099" javascript_position="1000050"><![CDATA[/**
* IPS Community Suite 4
* (c) 2013 Invision Power Services - http://www.invisionpower.com
<file javascript_app="downloads" javascript_location="front" javascript_path="controllers/submit" javascript_name="ips.submit.main.js" javascript_type="controller" javascript_version="102002" javascript_position="1000050"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
* ips.submit.main.js - Submit controller
*
@@ -475,9 +475,9 @@
}
});
}(jQuery, _));]]></file>
<file javascript_app="downloads" javascript_location="front" javascript_path="controllers/view" javascript_name="ips.view.changeLog.js" javascript_type="controller" javascript_version="101099" javascript_position="1000100"><![CDATA[/**
* IPS Community Suite 4
* (c) 2013 Invision Power Services - http://www.invisionpower.com
<file javascript_app="downloads" javascript_location="front" javascript_path="controllers/view" javascript_name="ips.view.changeLog.js" javascript_type="controller" javascript_version="102002" javascript_position="1000100"><![CDATA[/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
* ips.view.changeLog.js - Changelog controller
*
@@ -596,9 +596,9 @@
});
}(jQuery, _));]]></file>
<file javascript_app="downloads" javascript_location="front" javascript_path="controllers/view" javascript_name="ips.view.download.js" javascript_type="controller" javascript_version="101099" javascript_position="1000100">/**
* IPS Community Suite 4
* (c) 2013 Invision Power Services - http://www.invisionpower.com
<file javascript_app="downloads" javascript_location="front" javascript_path="controllers/view" javascript_name="ips.view.download.js" javascript_type="controller" javascript_version="102002" javascript_position="1000100">/**
* Invision Community
* (c) Invision Power Services, Inc. - https://www.invisioncommunity.com
*
* ips.view.download.js - Download popup controller
*
@@ -717,7 +717,7 @@
});
}(jQuery, _));</file>
<file javascript_app="downloads" javascript_location="front" javascript_path="templates" javascript_name="ips.templates.submit.js" javascript_type="template" javascript_version="101099" javascript_position="1000150"><![CDATA[/* VIEW TEMPLATES */
<file javascript_app="downloads" javascript_location="front" javascript_path="templates" javascript_name="ips.templates.submit.js" javascript_type="template" javascript_version="102002" javascript_position="1000150"><![CDATA[/* VIEW TEMPLATES */
ips.templates.set('downloads.submit.screenshot', " \
<div class='ipsGrid_span3 ipsAttach ipsImageAttach ipsPad_half ipsAreaBackground_light' id='{{id}}' data-role='file' data-fileid='{{id}}' data-fullsizeurl='{{imagesrc}}' data-thumbnailurl='{{thumbnail}}' data-isImage='1'>\
<ul class='ipsList_inline ipsImageAttach_controls'>\
@@ -773,4 +773,6 @@ app.js</order>
<order app="global" path="/dev/js//library//jquery">jquery.js
jquery.history.js
jquery.transform.js</order>
<order app="global" path="/dev/js//library//linkify">linkify.min.js
linkify-jquery.min.js</order>
</javascript>
+26 -3
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<language>
<app key="downloads" version="101099">
<app key="downloads" version="102002">
<word key="__app_downloads" js="0">Downloads</word>
<word key="frontnavigation_downloads" js="0">Downloads</word>
<word key="__indefart_downloads_file_comment" js="0">a comment on a file</word>
@@ -17,6 +17,7 @@
<word key="downloads_file_container" js="0">category</word>
<word key="search_contextual_item_downloads_categories" js="0">This Category</word>
<word key="search_contextual_item_downloads_file" js="0">This File</word>
<word key="downloads_categories" js="0">Downloads Categories</word>
<word key="filestorage__downloads_Files" js="0">Downloads Files</word>
<word key="filestorage__downloads_Screenshots" js="0">Downloads Screenshots</word>
<word key="filestorage__downloads_FileField" js="0">Downloads Custom Fields</word>
@@ -104,6 +105,7 @@
<word key="cbitoptions_topic_delete" js="0">Delete topic if file is deleted?</word>
<word key="cbitoptions_topic_screenshot" js="0">Include screenshot in topic?</word>
<word key="node_no_parentd" js="0">No Parent</word>
<word key="view_all_files" js="0">View All Files</word>
<word key="modperms__core_Content_downloads_File" js="0">Downloads</word>
<word key="download_categories" js="0">Categories</word>
<word key="can_pin_downloads_file" js="0">Can pin files?</word>
@@ -111,6 +113,7 @@
<word key="can_feature_downloads_file" js="0">Can feature files?</word>
<word key="can_unfeature_downloads_file" js="0">Can unfeature files?</word>
<word key="can_move_downloads_file" js="0">Can move files?</word>
<word key="can_move_downloads_file_desc" js="0">Will be able to move files only between the categories they have permission to moderate, not to any other category.</word>
<word key="can_lock_downloads_file" js="0">Can lock files?</word>
<word key="can_unlock_downloads_file" js="0">Can unlock files?</word>
<word key="can_reply_to_locked_downloads_file" js="0">Can comment on locked files?</word>
@@ -129,6 +132,11 @@
<word key="can_unhide_downloads_file_review" js="0">Can unhide reviews?</word>
<word key="can_view_hidden_downloads_file_review" js="0">Can view hidden reviews?</word>
<word key="can_delete_downloads_file_review" js="0">Can delete reviews?</word>
<word key="can_feature_comments_downloads_file" js="0">Can recommend comments on a file?</word>
<word key="can_unfeature_comments_downloads_file" js="0">Can remove comment recommendations on a file?</word>
<word key="can_add_item_message_downloads_file" js="0">Can add messages to files?</word>
<word key="can_edit_item_message_downloads_file" js="0">Can edit messages on files?</word>
<word key="can_delete_item_message_downloads_file" js="0">Can delete messages on files?</word>
<word key="menu__downloads_downloads_fields" js="0">Extra Fields</word>
<word key="r__fields" js="0">Extra Fields</word>
<word key="r__fields_manage" js="0">Can view extra fields?</word>
@@ -183,6 +191,7 @@
<word key="idm_import_files" js="0">Can import files from the filesystem?</word>
<word key="idm_import_files_desc" js="0">When enabled, users will be able to import files located on your server. You should only enable this for staff groups where all the users are trusted.</word>
<word key="idm_bulk_submit" js="0">Can submit multiple files at once?</word>
<word key="idm_screenshot_for" js="0">Screenshot for %s</word>
<word key="rss_offline" js="0">This RSS feed is disabled</word>
<word key="rss_offline_admin" js="0">The IP.Downloads option &quot;Enable Latest Files RSS feed&quot; is currently disabled. Toggle this option to yes in the admin control panel to enable the latest files RSS feed.</word>
<word key="submit_a_file" js="0">Submit a file</word>
@@ -198,6 +207,7 @@
<word key="dl_get_support_title" js="0">Get support for this download</word>
<word key="file_information" js="0">File Information</word>
<word key="url_files" js="0">Linked Files</word>
<word key="url_files_no_perm" js="0">This file has a linked file, but you are no longer permitted to edit it. Please contact an administrator if you need to change it.</word>
<word key="import_files" js="0">Import Files</word>
<word key="screenshots" js="0">Screenshots</word>
<word key="screenshots_ct" js="0">{# [1:Screenshot][?:Screenshots]}</word>
@@ -401,7 +411,7 @@
<word key="downloadS_stat_average_of_total" js="0">%d% of total; average for all users: %d</word>
<word key="download_stats_disclaimer" js="0">* This statistic comes from the download log which may be disabled on a per-category basis or set to be pruned periodically.</word>
<word key="download_graph_disclaimer" js="0">This data comes from the download log which may be disabled on a per-category basis or set to be pruned periodically.</word>
<word key="menu__downloads_stats_downloads" js="0">Download Statistics</word>
<word key="menu__downloads_stats_downloads" js="0">Downloads</word>
<word key="menu__downloads_stats_downloaders" js="0">Top Downloaders</word>
<word key="menu__downloads_stats_submitters" js="0">Top Submitters</word>
<word key="r__downloads" js="0">Download Statistics</word>
@@ -426,11 +436,14 @@
<word key="loc_downloads_adding_file" js="0">Adding a file</word>
<word key="loc_downloads_browsing" js="0">Viewing Downloads</word>
<word key="acp_search_title_downloads_Downloads" js="0">Downloads Categories</word>
<word key="downloads_categories_pagetitle" js="0">Downloads Categories</word>
<word key="task__logCleanup" js="0">Prunes the download log.</word>
<word key="task__tempFileCleanup" js="0">Removes temporary file uploads.</word>
<word key="digest_area_downloads_category" js="0">Files</word>
<word key="digest_area_downloads_file" js="0">File</word>
<word key="x_created_file_in" js="0">%s uploaded a file to %s</word>
<word key="x_commented_file" js="0">%s commented on a file</word>
<word key="x_reviewed_file" js="0">%s reviewed a file</word>
<word key="paid_file_settings" js="0">Paid Files Settings</word>
<word key="idm_nexus_on" js="0">Enable Paid Files?</word>
<word key="idm_nexus_on_desc" js="0"><![CDATA[If enabled, users who have permission will be able to submit files which must be paid for in order to download.<br>You can control which groups can submit paid files from the <a href='{internal.app=core&module=members&controller=groups}'>Groups</a> page.<br>When someone purchases a paid file, the money will be added to the file submitter's account credit. You can control how users can withdraw account credit from the <a href='{internal.app=nexus&module=payments&controller=payouts&do=settings}'>Withdrawals</a> page.]]></word>
@@ -476,7 +489,7 @@
<word key="email_new_file_version_guest" js="0">%s (Guest) has uploaded a new version of %s,</word>
<word key="mailsub__downloads_notification_new_file_version" js="0"><![CDATA[{$content->author()->name|raw} has uploaded a new version of {$content->mapped("title")|raw}]]></word>
<word key="notification__new_file_version" js="0">%s uploaded a new version of %s</word>
<word key="emailtpl_notification_new_file_version" js="0">New File Version Notification</word>
<word key="emailtpl_notification_new_file_version" js="0">New file version notification</word>
<word key="block_downloadsCommentFeed" js="0">Download Comments</word>
<word key="block_downloadsCommentFeed_desc" js="0">Display a feed of comments</word>
<word key="block_downloadsReviewFeed" js="0">Download Reviews</word>
@@ -484,6 +497,16 @@
<word key="__api_downloads_files" js="0">Files</word>
<word key="__api_downloads_comments" js="0">Comments</word>
<word key="__api_downloads_reviews" js="0">Reviews</word>
<word key="__api_downloads_categories" js="0">Categories</word>
<word key="idm_landing_page" js="0">Downloads Index Page</word>
<word key="idm_show_featured" js="0">Show &quot;Featured Downloads&quot; box</word>
<word key="idm_featured_count" js="0">Number of features files to show</word>
<word key="idm_show_newest" js="0">Show &quot;What's New&quot; box</word>
<word key="idm_newest_categories" js="0">Categories</word>
<word key="idm_show_highest_rated" js="0">Show &quot;Highest Rated&quot; box</word>
<word key="idm_show_most_downloaded" js="0">Show &quot;Most Downloaded&quot; box</word>
<word key="idm_highest_rated_categories" js="0">Categories</word>
<word key="idm_show_most_downloaded_categories" js="0">Categories</word>
<word key="makePrimaryScreenshot" js="1">Make this the primary screenshot</word>
<word key="removeScreenshot" js="1">Remove this screenshot</word>
</app>
+42
View File
@@ -309,6 +309,20 @@
"unsigned": true,
"values": [],
"zerofill": false
},
"cclub_id": {
"name": "cclub_id",
"type": "BIGINT",
"length": 20,
"decimals": null,
"values": null,
"allow_null": true,
"default": null,
"comment": "The club ID if this category belongs to a club, or NULL",
"unsigned": true,
"zerofill": false,
"auto_increment": false,
"binary": false
}
},
"indexes": {
@@ -528,6 +542,20 @@
"zerofill": false,
"auto_increment": false,
"binary": false
},
"cf_allow_attachments": {
"name": "cf_allow_attachments",
"type": "TINYINT",
"length": 1,
"decimals": null,
"values": null,
"allow_null": false,
"default": "1",
"comment": "",
"unsigned": true,
"zerofill": false,
"auto_increment": false,
"binary": false
}
},
"indexes": {
@@ -1171,6 +1199,20 @@
"zerofill": false,
"auto_increment": false,
"binary": false
},
"file_meta_data": {
"name": "file_meta_data",
"type": "BIT",
"length": 1,
"decimals": null,
"values": null,
"allow_null": false,
"default": "0",
"comment": "",
"unsigned": false,
"zerofill": false,
"auto_increment": false,
"binary": false
}
},
"indexes": {
+32
View File
@@ -3,14 +3,46 @@
"key": "idm_antileech",
"default": "1"
},
{
"key": "idm_featured_count",
"default": "4"
},
{
"key": "idm_highest_rated_categories",
"default": "0"
},
{
"key": "idm_link_blacklist",
"default": ""
},
{
"key": "idm_newest_categories",
"default": "0"
},
{
"key": "idm_rss",
"default": "1"
},
{
"key": "idm_show_featured",
"default": "1"
},
{
"key": "idm_show_highest_rated",
"default": "1"
},
{
"key": "idm_show_most_downloaded",
"default": "1"
},
{
"key": "idm_show_most_downloaded_categories",
"default": "0"
},
{
"key": "idm_show_newest",
"default": "1"
},
{
"key": "idm_watermarkpath",
"default": ""
File diff suppressed because it is too large. Load diff
+22 -1
View File
@@ -171,5 +171,26 @@
"101096": "4.1.19.2",
"101097": "4.1.19.2",
"101098": "4.1.19.3",
"101099": "4.1.19.4"
"101099": "4.1.19.4",
"101100": "4.2.0 Beta 1",
"101101": "4.2.0 Beta 1",
"101102": "4.2.0 Beta 1",
"101103": "4.2.0 Beta 1",
"101104": "4.2.0 Beta 2",
"101105": "4.2.0 Beta 3",
"101106": "4.2.0 Beta 3a",
"101107": "4.2.0 Beta 4",
"101108": "4.2.0 Beta 4",
"101109": "4.2.0 Beta 5",
"101110": "4.2.0 Beta 5a",
"101111": "4.2.0 Beta 6",
"101112": "4.2.0 Beta 6a",
"101113": "4.2.0 Beta 6a",
"101114": "4.2.0 Beta 7",
"101115": "4.2.0 Beta 7a",
"101116": "4.2.0 Beta 8",
"101117": "4.2.0 Beta 8",
"102000": "4.2.0",
"102001": "4.2.0",
"102002": "4.2.0"
}
@@ -1,13 +1,12 @@
<?php
/**
* @brief Announcements Extension : Download Categories
* @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 Downloads
* @since 28 Apr 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\extensions\core\Announcements;
@@ -0,0 +1,41 @@
<?php
/**
* @brief Content Router extension: Downloads
* @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 Downloads
* @since 26 Jun 2017
*/
namespace IPS\downloads\extensions\core\ContentRouter;
/* 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;
}
/**
* @brief Content Router extension: Downloads
*/
class _Downloads
{
/**
* @brief Content Item Classes
*/
public $classes = array();
/**
* Constructor
*
* @param \IPS\Member|IPS\Member\Group|NULL $memberOrGroup If checking access, the member/group to check for, or NULL to not check access
* @return void
*/
public function __construct( $memberOrGroup = NULL )
{
}
}
@@ -1,13 +1,12 @@
<?php
/**
* @brief Content Router extension: Downloads
* @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 Downloads
* @since 02 Dec 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\extensions\core\ContentRouter;
@@ -32,10 +31,10 @@ class _Files
/**
* Constructor
*
* @param \IPS\Member|NULL $member If checking access, the member to check for, or NULL to not check access
* @param \IPS\Member|IPS\Member\Group|NULL $member If checking access, the member/group to check for, or NULL to not check access
* @return void
*/
public function __construct( \IPS\Member $member = NULL )
public function __construct( $member = NULL )
{
if ( $member === NULL or $member->canAccessModule( \IPS\Application\Module::get( 'downloads', 'downloads', 'front' ) ) )
{
@@ -1,13 +1,12 @@
<?php
/**
* @brief Create Menu Extension
* @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 Downloads
* @since 8 Oct 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\extensions\core\CreateMenu;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Dashboard extension: Overview
* @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 Downloads
* @since 13 Dec 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\extensions\core\Dashboard;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Editor Extension: Category descriptions
* @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 Downloads
* @since 27 Sep 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\extensions\core\EditorLocations;
@@ -110,6 +109,27 @@ class _Categories
return $this->performRebuild( $offset, $max, array( 'IPS\Text\LegacyParser', 'parseStatic' ) );
}
/**
* @brief Store image proxy status ( true = enabled )
*/
protected $_imageProxyStatus = null;
/**
* Rebuild content to add or remove image proxy
*
* @param int|null $offset Offset to start from
* @param int|null $max Maximum to parse
* @param bool $status Enable/Disable Image Proxy
* @return int Number completed
* @note This method is optional and will only be called if it exists
*/
public function rebuildImageProxy( $offset, $max, $status=TRUE )
{
$this->_imageProxyStatus = $status;
return $this->performRebuild( $offset, $max, 'parseImageProxy' );
}
/**
* Perform rebuild - abstracted as the call for rebuildContent() and rebuildAttachmentImages() is nearly identical
*
@@ -129,7 +149,14 @@ class _Categories
try
{
$rebuilt = call_user_func( $callback, $word['word_custom'] );
if( $callback == 'parseImageProxy' )
{
$rebuilt = \IPS\Text\Parser::parseImageProxy( $word['word_custom'], $this->_imageProxyStatus );
}
else
{
$rebuilt = call_user_func( $callback, $word['word_custom'] );
}
}
catch( \InvalidArgumentException $e )
{
@@ -1,13 +1,12 @@
<?php
/**
* @brief Editor Extension: File descriptions
* @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 Downloads
* @since 8 Oct 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\extensions\core\EditorLocations;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Editor Media: Files
* @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 Downloads
* @since 26 Dec 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\extensions\core\EditorMedia;
@@ -1,13 +1,12 @@
<?php
/**
* @brief File Storage Extension: FileField
* @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 Downloads
* @since 29 Aug 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\extensions\core\FileStorage;
@@ -104,7 +103,7 @@ class _FileField
/**
* Check if a file is valid
*
* @param \IPS\Http\Url $file The file to check
* @param string $file The file path to check
* @return bool
*/
public function isValidFile( $file )
@@ -1,13 +1,12 @@
<?php
/**
* @brief File Storage Extension: Files
* @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 Downloads
* @since 08 Oct 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\extensions\core\FileStorage;
@@ -86,7 +85,7 @@ class _Files
/**
* Check if a file is valid
*
* @param \IPS\Http\Url $file The file to check
* @param string $file The file path to check
* @return bool
*/
public function isValidFile( $file )
@@ -1,13 +1,12 @@
<?php
/**
* @brief File Storage Extension: Screenshots
* @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 Downloads
* @since 08 Oct 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\extensions\core\FileStorage;
@@ -84,7 +83,7 @@ class _Screenshots
\IPS\Db::i()->update( 'downloads_files_records', array( 'record_location' => $new ), array( 'record_id=?', $record['record_id'] ) );
}
if ( $record['record_thumb'] and $new = \IPS\File::repairUrl( $record['record_thumb'] ) )
if ( $record['record_thumb'] and $new = \IPS\File::repairUrl( $record['record_thumb'] ) )
{
\IPS\Db::i()->update( 'downloads_files_records', array( 'record_thumb' => $new ), array( 'record_id=?', $record['record_id'] ) );
}
@@ -93,7 +92,7 @@ class _Screenshots
/**
* Check if a file is valid
*
* @param \IPS\Http\Url $file The file to check
* @param string $file The file path to check
* @return bool
*/
public function isValidFile( $file )
@@ -125,6 +124,24 @@ class _Screenshots
\IPS\File::get( 'downloads_Screenshots', $screenshot['record_location'] )->delete();
}
catch( \Exception $e ){}
if( $screenshot['record_thumb'] )
{
try
{
\IPS\File::get( 'downloads_Screenshots', $screenshot['record_thumb'] )->delete();
}
catch( \Exception $e ){}
}
if( $screenshot['record_no_watermark'] )
{
try
{
\IPS\File::get( 'downloads_Screenshots', $screenshot['record_no_watermark'] )->delete();
}
catch( \Exception $e ){}
}
}
}
}
@@ -1,13 +1,12 @@
<?php
/**
* @brief Front Navigation Extension: Downloads
* @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 Downloads
* @since 8 Oct 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\extensions\core\FrontNavigation;
@@ -71,6 +70,6 @@ class _Downloads extends \IPS\core\FrontNavigation\FrontNavigationAbstract
*/
public function active()
{
return \IPS\Dispatcher::i()->application->directory === 'downloads';
return !\IPS\core\FrontNavigation::$clubTabActive and \IPS\Dispatcher::i()->application->directory === 'downloads';
}
}
@@ -1,13 +1,12 @@
<?php
/**
* @brief Admin CP Group Form
* @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 Downloads
* @since 19 Nov 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\extensions\core\GroupForm;
@@ -38,10 +37,13 @@ class _Downloads
$form->addHeader( 'file_management' );
$form->add( new \IPS\Helpers\Form\YesNo( 'idm_view_downloads', $group->idm_view_downloads ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'idm_view_approvers', $group->idm_view_approvers ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'idm_bypass_revision', $group->idm_bypass_revision ) );
if( $group->g_id != \IPS\Settings::i()->guest_group )
{
$form->add( new \IPS\Helpers\Form\YesNo( 'idm_bypass_revision', $group->idm_bypass_revision ) );
}
$form->addHeader( 'submission_permissions' );
if ( \IPS\Application::appIsEnabled( 'nexus' ) )
if ( \IPS\Application::appIsEnabled( 'nexus' ) and $group->g_id != \IPS\Settings::i()->guest_group )
{
if ( \IPS\Settings::i()->idm_nexus_on )
{
@@ -93,7 +95,10 @@ class _Downloads
public function save( $values, &$group )
{
$group->idm_view_approvers = $values['idm_view_approvers'];
$group->idm_bypass_revision = $values['idm_bypass_revision'];
if( $group->g_id != \IPS\Settings::i()->guest_group )
{
$group->idm_bypass_revision = $values['idm_bypass_revision'];
}
$group->idm_view_downloads = $values['idm_view_downloads'];
$group->idm_throttling = $values['idm_throttling'];
$group->idm_wait_period = $values['idm_wait_period'];
@@ -103,7 +108,10 @@ class _Downloads
if ( \IPS\Application::appIsEnabled( 'nexus' ) and \IPS\Settings::i()->idm_nexus_on )
{
$group->idm_add_paid = $values['idm_add_paid'];
if( $group->g_id != \IPS\Settings::i()->guest_group )
{
$group->idm_add_paid = $values['idm_add_paid'];
}
$group->idm_bypass_paid = $values['idm_bypass_paid'];
}
@@ -1,13 +1,12 @@
<?php
/**
* @brief Group Limits
* @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 Downloads
* @since 21 Nov 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\extensions\core\GroupLimits;
@@ -1,13 +1,12 @@
<?php
/**
* @brief IP Address Lookup extension
* @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 Downloads
* @since 30 Dec 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\extensions\core\IpAddresses;
@@ -1,13 +1,12 @@
<?php
/**
* @brief ACP Live Search Extension
* @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 Downloads
* @since 07 Feb 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\extensions\core\LiveSearch;
@@ -56,7 +55,7 @@ class _downloads
$categories = \IPS\Db::i()->select(
"*",
'downloads_categories',
array( "word_custom LIKE CONCAT( '%', ?, '%' ) AND lang_id=?", $searchTerm, \IPS\Member::loggedIn()->language()->id ),
array( "cclub_id IS NULL AND word_custom LIKE CONCAT( '%', ?, '%' ) AND lang_id=?", $searchTerm, \IPS\Member::loggedIn()->language()->id ),
NULL,
NULL
)->join(
@@ -1,13 +1,12 @@
<?php
/**
* @brief Admin CP Member Form
* @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 Downloads
* @since 13 Dec 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\extensions\core\MemberForm;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Member Sync
* @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 Downloads
* @since 26 Dec 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\extensions\core\MemberSync;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Notification Options
* @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 Downloads
* @since 11 Dec 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\extensions\core\Notifications;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Permissions
* @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 Downloads
* @since 16 Apr 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\extensions\core\Permissions;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Background Task
* @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 Downloads
* @since 23 Sep 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\extensions\core\Queue;
@@ -1,13 +1,12 @@
<?php
/**
* @brief File
* @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 Downloads
* @since 05 Aug 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\extensions\nexus\Item;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Downloads screenshot handler
* @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 Downloads
* @since 4 Dec 2014
* @version SVN_VERSION_NUMBER
*/
require_once str_replace( 'applications/downloads/interface/legacy/screenshot.php', '', str_replace( '\\', '/', __FILE__ ) ) . 'init.php';
@@ -1,13 +1,12 @@
<?php
/**
* @brief Categories
* @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 Downloads
* @since 27 Sep 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\modules\admin\downloads;
@@ -1,13 +1,12 @@
<?php
/**
* @brief fields
* @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 Downloads
* @since 03 Oct 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\modules\admin\downloads;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Settings
* @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 Downloads
* @since 09 Oct 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\modules\admin\downloads;
@@ -32,25 +31,19 @@ class _settings extends \IPS\Dispatcher\Controller
protected function manage()
{
\IPS\Dispatcher::i()->checkAcpPermission( 'settings_manage' );
$form = $this->getForm();
if ( $values = $form->values( TRUE ) )
{
/* We can't store '' for idm_nexus_display as it will fall back to the default */
if ( ! $values['idm_nexus_display'] )
{
$values['idm_nexus_display'] = 'none';
}
$form->saveAsSettings( $values );
$this->saveSettingsForm( $form, $values );
/* Clear guest page caches */
\IPS\Data\Cache::i()->clearAll();
\IPS\Session::i()->log( 'acplogs__downloads_settings' );
}
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('settings');
\IPS\Output::i()->output = $form;
}
@@ -64,13 +57,40 @@ class _settings extends \IPS\Dispatcher\Controller
protected function getForm()
{
$form = new \IPS\Helpers\Form;
$form->addTab('basic_settings');
$form->addTab( 'idm_landing_page' );
$form->addHeader( 'featured_downloads' );
$form->add( new \IPS\Helpers\Form\YesNo( 'idm_show_featured', \IPS\Settings::i()->idm_show_featured, FALSE, array( 'togglesOn' => array( 'idm_featured_count' ) ) ) );
$form->add( new \IPS\Helpers\Form\Number( 'idm_featured_count', \IPS\Settings::i()->idm_featured_count, FALSE, array(), NULL, NULL, NULL, 'idm_featured_count' ) );
$form->addHeader('browse_whats_new');
$form->add( new \IPS\Helpers\Form\YesNo( 'idm_show_newest', \IPS\Settings::i()->idm_show_newest, FALSE, array('togglesOn' => array( 'idm_newest_categories') ) ) );
$form->add( new \IPS\Helpers\Form\Node( 'idm_newest_categories', ( \IPS\Settings::i()->idm_newest_categories AND \IPS\Settings::i()->idm_newest_categories != 0 ) ? explode( ',', \IPS\Settings::i()->idm_newest_categories ) : 0, FALSE, array(
'class' => 'IPS\downloads\Category',
'zeroVal' => 'any',
'multiple' => TRUE ), NULL, NULL, NULL, 'idm_newest_categories') );
$form->addHeader('browse_highest_rated');
$form->add( new \IPS\Helpers\Form\YesNo( 'idm_show_highest_rated', \IPS\Settings::i()->idm_show_highest_rated, FALSE, array( 'togglesOn' => array( 'idm_highest_rated_categories' ) ) ) );
$form->add( new \IPS\Helpers\Form\Node( 'idm_highest_rated_categories', ( \IPS\Settings::i()->idm_highest_rated_categories AND \IPS\Settings::i()->idm_highest_rated_categories != 0 ) ? explode( ',', \IPS\Settings::i()->idm_highest_rated_categories ) : 0, FALSE, array(
'class' => 'IPS\downloads\Category',
'zeroVal' => 'any',
'multiple' => TRUE ), NULL, NULL, NULL, 'idm_highest_rated_categories') );
$form->addHeader('browse_most_downloaded');
$form->add( new \IPS\Helpers\Form\YesNo( 'idm_show_most_downloaded', \IPS\Settings::i()->idm_show_most_downloaded, FALSE, array( 'togglesOn' => array( 'idm_show_most_downloaded_categories' ) ) ) );
$form->add( new \IPS\Helpers\Form\Node( 'idm_show_most_downloaded_categories', ( \IPS\Settings::i()->idm_show_most_downloaded_categories AND \IPS\Settings::i()->idm_show_most_downloaded_categories != 0 ) ? explode( ',', \IPS\Settings::i()->idm_show_most_downloaded_categories ) : 0, FALSE, array(
'class' => 'IPS\downloads\Category',
'zeroVal' => 'any',
'multiple' => TRUE ), NULL, NULL, NULL, 'idm_show_most_downloaded_categories') );
$form->addTab( 'basic_settings' );
$form->add( new \IPS\Helpers\Form\Upload( 'idm_watermarkpath', \IPS\Settings::i()->idm_watermarkpath ? \IPS\File::get( 'core_Theme', \IPS\Settings::i()->idm_watermarkpath ) : NULL, FALSE, array( 'image' => TRUE, 'storageExtension' => 'core_Theme' ) ) );
$form->add( new \IPS\Helpers\Form\Stack( 'idm_link_blacklist', explode( ',', \IPS\Settings::i()->idm_link_blacklist ), FALSE, array( 'placeholder' => 'example.com' ) ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'idm_antileech', \IPS\Settings::i()->idm_antileech ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'idm_rss', \IPS\Settings::i()->idm_rss ) );
if ( \IPS\Application::appIsEnabled( 'nexus' ) )
{
$form->addTab( 'paid_file_settings' );
@@ -84,7 +104,24 @@ class _settings extends \IPS\Dispatcher\Controller
return $form;
}
/**
* Save the settings form
*
* @param \IPS\Helpers\Form $form The Form Object
* @param array $values Values
*/
protected function saveSettingsForm( \IPS\Helpers\Form $form, array $values )
{
/* We can't store '' for idm_nexus_display as it will fall back to the default */
if ( ! $values['idm_nexus_display'] )
{
$values['idm_nexus_display'] = 'none';
}
$form->saveAsSettings( $values );
}
/**
* Rebuild Watermarks
*
@@ -94,7 +131,7 @@ class _settings extends \IPS\Dispatcher\Controller
{
$perGo = 1;
$watermark = \IPS\Settings::i()->idm_watermarkpath ? \IPS\Image::create( \IPS\File::get( 'core_Theme', \IPS\Settings::i()->idm_watermarkpath )->contents() ) : NULL;
\IPS\Output::i()->output = new \IPS\Helpers\MultipleRedirect( \IPS\Http\Url::internal( 'app=downloads&module=downloads&controller=settings&do=rebuildWatermarks' ), function( $doneSoFar ) use( $watermark, $perGo )
{
$doneSoFar = intval( $doneSoFar );
@@ -104,13 +141,13 @@ class _settings extends \IPS\Dispatcher\Controller
{
$where[] = array( 'record_no_watermark<>?', '' );
}
$select = \IPS\Db::i()->select( '*', 'downloads_files_records', $where, 'record_id', array( $doneSoFar, $perGo ), NULL, NULL, \IPS\Db::SELECT_SQL_CALC_FOUND_ROWS );
if ( !$select->count() )
{
return NULL;
}
foreach ( $select as $row )
{
try
@@ -118,13 +155,13 @@ class _settings extends \IPS\Dispatcher\Controller
if ( $row['record_no_watermark'] )
{
$original = \IPS\File::get( 'downloads_Screenshots', $row['record_no_watermark'] );
try
{
\IPS\File::get( 'downloads_Screenshots', $row['record_location'] )->delete();
}
catch ( \Exception $e ) { }
if ( !$watermark )
{
\IPS\Db::i()->update( 'downloads_files_records', array(
@@ -132,7 +169,7 @@ class _settings extends \IPS\Dispatcher\Controller
'record_thumb' => (string) $original->thumbnail( 'downloads_Screenshots' ),
'record_no_watermark' => NULL
), array( 'record_id=?', $row['record_id'] ) );
continue;
}
}
@@ -140,12 +177,12 @@ class _settings extends \IPS\Dispatcher\Controller
{
$original = \IPS\File::get( 'downloads_Screenshots', $row['record_location'] );
}
$image = \IPS\Image::create( $original->contents() );
$image->watermark( $watermark );
$newFile = \IPS\File::create( 'downloads_Screenshots', $original->originalFilename, $image );
\IPS\Db::i()->update( 'downloads_files_records', array(
'record_location' => (string) $newFile,
'record_thumb' => (string) $newFile->thumbnail( 'downloads_Screenshots' ),
@@ -154,10 +191,10 @@ class _settings extends \IPS\Dispatcher\Controller
}
catch ( \Exception $e ) {}
}
$doneSoFar += $perGo;
return array( $doneSoFar, \IPS\Member::loggedIn()->language()->addToStack('rebuilding'), 100 / $select->count( TRUE ) * $doneSoFar );
return array( $doneSoFar, \IPS\Member::loggedIn()->language()->addToStack('rebuilding'), 100 / $select->count( TRUE ) * $doneSoFar );
}, function()
{
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=downloads&module=downloads&controller=settings' ), 'completed' );
@@ -1,13 +1,12 @@
<?php
/**
* @brief Top Downloaders
* @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 Downloads
* @since 17 Dec 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\modules\admin\stats;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Downloads Statistics
* @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 Downloads
* @since 16 Dec 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\modules\admin\stats;
@@ -42,10 +41,16 @@ class _downloads extends \IPS\Dispatcher\Controller
*/
protected function manage()
{
$chart = new \IPS\Helpers\Chart\Dynamic( \IPS\Http\Url::internal( "app=downloads&module=stats&controller=downloads" ), 'downloads_downloads', 'dtime', '', array(), 'ColumnChart', 'monthly', array( 'start' => 0, 'end' => 0 ), array( 'dmid', 'dfid', 'dtime', 'dsize', 'dua', 'dip' ) );
$chart = new \IPS\Helpers\Chart\Database( \IPS\Http\Url::internal( "app=downloads&module=stats&controller=downloads" ), 'downloads_downloads', 'dtime', '', array(
'backgroundColor' => '#ffffff',
'colors' => array( '#10967e', '#ea7963', '#de6470', '#6b9dde', '#b09be4', '#eec766', '#9fc973', '#e291bf', '#55c1a6', '#5fb9da' ),
'hAxis' => array( 'gridlines' => array( 'color' => '#f5f5f5' ) ),
'lineWidth' => 1,
'areaOpacity' => 0.4,
), 'AreaChart', 'monthly', array( 'start' => 0, 'end' => 0 ), array( 'dmid', 'dfid', 'dtime', 'dsize', 'dua', 'dip' ) );
$chart->addSeries( \IPS\Member::loggedIn()->language()->addToStack('downloads'), 'number', 'COUNT(*)', FALSE );
$chart->availableTypes = array( 'LineChart', 'ColumnChart', 'BarChart' );
$chart->availableTypes = array( 'AreaChart', 'ColumnChart', 'BarChart' );
$chart->tableParsers = array(
'dmid' => function( $val )
@@ -1,13 +1,12 @@
<?php
/**
* @brief Member Stats
* @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 Downloads
* @since 13 Dec 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\modules\admin\stats;
@@ -87,9 +86,15 @@ class _member extends \IPS\Dispatcher\Controller
break;
case 'downloads':
$downloadsChart = new \IPS\Helpers\Chart\Dynamic( \IPS\Http\Url::internal( "app=downloads&module=stats&controller=member&do=downloads&id={$member->member_id}&tab=downloads&_graph=1" ), 'downloads_downloads', 'dtime', '', array(), 'ColumnChart', 'monthly', array( 'start' => 0, 'end' => 0 ), array( 'dfid', 'dtime', 'dsize', 'dua', 'dip' ) );
$downloadsChart = new \IPS\Helpers\Chart\Database( \IPS\Http\Url::internal( "app=downloads&module=stats&controller=member&do=downloads&id={$member->member_id}&tab=downloads&_graph=1" ), 'downloads_downloads', 'dtime', '', array(
'backgroundColor' => '#ffffff',
'colors' => array( '#10967e', '#ea7963', '#de6470', '#6b9dde', '#b09be4', '#eec766', '#9fc973', '#e291bf', '#55c1a6', '#5fb9da' ),
'hAxis' => array( 'gridlines' => array( 'color' => '#f5f5f5' ) ),
'lineWidth' => 1,
'areaOpacity' => 0.4
), 'ColumnChart', 'monthly', array( 'start' => 0, 'end' => 0 ), array( 'dfid', 'dtime', 'dsize', 'dua', 'dip' ) );
$downloadsChart->where[] = array( 'dmid=?', $member->member_id );
$downloadsChart->availableTypes = array( 'LineChart', 'ColumnChart', 'BarChart', 'Table' );
$downloadsChart->availableTypes = array( 'AreaChart', 'ColumnChart', 'BarChart', 'Table' );
$downloadsChart->tableParsers = array(
'dfid' => function( $val )
{
@@ -126,7 +131,14 @@ class _member extends \IPS\Dispatcher\Controller
break;
case 'bandwidth_use':
$bandwidthChart = new \IPS\Helpers\Chart\Dynamic( \IPS\Http\Url::internal( "app=downloads&module=stats&controller=member&do=downloads&id={$member->member_id}&tab=bandwidth_use&_graph=1" ), 'downloads_downloads', 'dtime', '', array( 'vAxis' => array( 'title' => '(' . \IPS\Member::loggedIn()->language()->addToStack( 'filesize_raw_k' ) . ')' ) ) );
$bandwidthChart = new \IPS\Helpers\Chart\Database( \IPS\Http\Url::internal( "app=downloads&module=stats&controller=member&do=downloads&id={$member->member_id}&tab=bandwidth_use&_graph=1" ), 'downloads_downloads', 'dtime', '', array(
'vAxis' => array( 'title' => '(' . \IPS\Member::loggedIn()->language()->addToStack( 'filesize_raw_k' ) . ')' ),
'backgroundColor' => '#ffffff',
'colors' => array( '#10967e', '#ea7963', '#de6470', '#6b9dde', '#b09be4', '#eec766', '#9fc973', '#e291bf', '#55c1a6', '#5fb9da' ),
'hAxis' => array( 'gridlines' => array( 'color' => '#f5f5f5' ) ),
'lineWidth' => 1,
'areaOpacity' => 0.4
) );
$bandwidthChart->where[] = array( 'dmid=?', $member->member_id );
$bandwidthChart->addSeries( \IPS\Member::loggedIn()->language()->addToStack('bandwidth_use'), 'number', 'ROUND((SUM(dsize)/1024),2)', FALSE );
$activeTabContents = ( \IPS\Request::i()->isAjax() and isset( \IPS\Request::i()->_graph ) ) ? (string) $bandwidthChart : \IPS\Theme::i()->getTemplate( 'stats' )->graphs( (string) $bandwidthChart );
@@ -1,13 +1,12 @@
<?php
/**
* @brief Top Submitters
* @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 Downloads
* @since 17 Dec 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\modules\admin\stats;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Browse Files Controller
* @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 Downloads
* @since 08 Oct 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\modules\front\downloads;
@@ -67,10 +66,40 @@ class _browse extends \IPS\Dispatcher\Controller
}
/* Get stuff */
$featured = iterator_to_array( \IPS\downloads\File::featured( 4, '_rand' ) );
$new = \IPS\downloads\File::getItemsWithPermission( array(), NULL, 14 );
$highestRated = \IPS\downloads\File::getItemsWithPermission( array( array( 'file_rating > ?', 0 ) ), 'file_rating DESC, file_reviews DESC', 14 );
$mostDownloaded = \IPS\downloads\File::getItemsWithPermission( array( array( 'file_downloads > ?', 0 ) ), 'file_downloads DESC', 14 );
$featured = (\IPS\Settings::i()->idm_show_featured) ? iterator_to_array(\IPS\downloads\File::featured(\IPS\Settings::i()->idm_featured_count, '_rand')) : array();
if ( \IPS\Settings::i()->idm_newest_categories )
{
$newestWhere = array( array( 'downloads_categories.copen=1 and ' . \IPS\Db::i()->in('file_cat', explode( ',', \IPS\Settings::i()->idm_newest_categories ) ) ) );
}
else
{
$newestWhere = array( array( 'downloads_categories.copen=1' ) );
}
$new = ( \IPS\Settings::i()->idm_show_newest) ? \IPS\downloads\File::getItemsWithPermission( $newestWhere, NULL, 14, 'read', \IPS\Content\Hideable::FILTER_AUTOMATIC, 0, NULL, TRUE ) : array();
if (\IPS\Settings::i()->idm_highest_rated_categories )
{
$highestWhere = array( array( 'downloads_categories.copen=1 and ' . \IPS\Db::i()->in('file_cat', explode( ',', \IPS\Settings::i()->idm_highest_rated_categories ) ) ) );
}
else
{
$highestWhere = array( array( 'downloads_categories.copen=1' ) );
}
$highestWhere[] = array( 'file_rating > ?', 0 );
$highestRated = ( \IPS\Settings::i()->idm_show_highest_rated ) ? \IPS\downloads\File::getItemsWithPermission( $highestWhere, 'file_rating DESC, file_reviews DESC', 14, 'read', \IPS\Content\Hideable::FILTER_AUTOMATIC, 0, NULL, TRUE ) : array();
if (\IPS\Settings::i()->idm_show_most_downloaded_categories )
{
$mostDownloadedWhere = array( array( 'downloads_categories.copen=1 and ' . \IPS\Db::i()->in('file_cat', explode( ',', \IPS\Settings::i()->idm_show_most_downloaded_categories ) ) ) );
}
else
{
$mostDownloadedWhere = array( array( 'downloads_categories.copen=1' ) );
}
$mostDownloadedWhere[] = array( 'downloads_categories.copen=1 and file_downloads > ?', 0 );
$mostDownloaded = ( \IPS\Settings::i()->idm_show_most_downloaded ) ? \IPS\downloads\File::getItemsWithPermission( $mostDownloadedWhere, 'file_downloads DESC', 14, 'read', \IPS\Content\Hideable::FILTER_AUTOMATIC, 0, NULL, TRUE ) : array();
/* Online User Location */
\IPS\Session::i()->setLocation( \IPS\Http\Url::internal( 'app=downloads', 'front', 'downloads' ), array(), 'loc_downloads_browsing' );
@@ -89,16 +118,34 @@ class _browse extends \IPS\Dispatcher\Controller
*/
protected function _category( $category )
{
\IPS\Output::i()->sidebar['contextual'] = '';
$_count = \IPS\downloads\File::getItemsWithPermission( array( array( \IPS\downloads\File::$databasePrefix . \IPS\downloads\File::$databaseColumnMap['container'] . '=?', $category->_id ) ), NULL, 1, 'read', \IPS\Content\Hideable::FILTER_AUTOMATIC, 0, NULL, FALSE, FALSE, FALSE, TRUE );
if( !$_count )
{
/* Set breadcrumb */
foreach ( $category->parents() as $parent )
if ( $club = $category->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 );
\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' );
}
}
else
{
foreach ( $category->parents() as $parent )
{
\IPS\Output::i()->breadcrumb[] = array( $parent->url(), $parent->_title );
}
\IPS\Output::i()->breadcrumb[] = array( NULL, $category->_title );
}
\IPS\Output::i()->breadcrumb[] = array( NULL, $category->_title );
/* Show a 'no files' template if there's nothing to display */
$table = \IPS\Theme::i()->getTemplate( 'browse' )->noFiles( $category );
@@ -110,6 +157,17 @@ class _browse extends \IPS\Dispatcher\Controller
$table->classes = array( 'ipsDataList_large' );
$table->sortOptions = array_merge( $table->sortOptions, array( 'file_downloads' => 'file_downloads' ) );
if ( !$category->bitoptions['reviews_download'] )
{
unset( $table->sortOptions['num_reviews'] );
}
if ( !$category->bitoptions['comments'] )
{
unset( $table->sortOptions['last_comment'] );
unset( $table->sortOptions['num_comments'] );
}
if ( $table->sortBy === 'file_name' )
{
$table->sortDirection = 'asc';
@@ -133,7 +191,7 @@ class _browse extends \IPS\Dispatcher\Controller
\IPS\Output::i()->title = $category->_title;
\IPS\Output::i()->contextualSearchOptions[ \IPS\Member::loggedIn()->language()->addToStack( 'search_contextual_item_downloads_categories' ) ] = array( 'type' => 'downloads_file', 'nodes' => $category->_id );
\IPS\Output::i()->sidebar['contextual'] = \IPS\Theme::i()->getTemplate( 'browse' )->indexSidebar( \IPS\downloads\Category::canOnAny('add'), $category );
\IPS\Output::i()->sidebar['contextual'] .= \IPS\Theme::i()->getTemplate( 'browse' )->indexSidebar( \IPS\downloads\Category::canOnAny('add'), $category );
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'browse' )->category( $category, (string) $table );
}
@@ -147,7 +205,7 @@ class _browse extends \IPS\Dispatcher\Controller
/* Online User Location */
\IPS\Session::i()->setLocation( \IPS\Http\Url::internal( 'app=downloads&module=downloads&controller=browse&do=categories', 'front', 'downloads_categories' ), array(), 'loc_downloads_browsing_categories' );
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('__app_downloads');
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('downloads_categories_pagetitle');
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'browse' )->categories();
}
@@ -1,13 +1,12 @@
<?php
/**
* @brief Submit File Controller
* @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 Downloads
* @since 08 Oct 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\modules\front\downloads;
@@ -35,8 +34,6 @@ class _submit extends \IPS\Dispatcher\Controller
\IPS\downloads\File::canCreate( \IPS\Member::loggedIn(), NULL, TRUE );
\IPS\Output::i()->sidebar['enabled'] = FALSE;
parent::execute();
}
@@ -343,6 +340,24 @@ class _submit extends \IPS\Dispatcher\Controller
\IPS\File::get( $file['record_type'] === 'upload' ? 'downloads_Files' : 'downloads_Screenshots', $location )->delete();
}
catch ( \Exception $e ) { }
if( $file['record_thumb'] )
{
try
{
\IPS\File::get( 'downloads_Screenshots', $file['record_thumb'] )->delete();
}
catch ( \Exception $e ) { }
}
if( $file['record_no_watermark'] )
{
try
{
\IPS\File::get( 'downloads_Screenshots', $file['record_no_watermark'] )->delete();
}
catch ( \Exception $e ) { }
}
\IPS\Db::i()->delete( 'downloads_files_records', array( 'record_id=?', $file['record_id'] ) );
}
@@ -592,6 +607,29 @@ 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;
}
\IPS\Output::i()->output = $wizard;
if ( isset( \IPS\Request::i()->category ) )
{
try
{
$category = \IPS\downloads\Category::loadAndCheckPerms( \IPS\Request::i()->category );
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' );
}
}
}
catch ( \OutOfRangeException $e ) { }
}
\IPS\Output::i()->breadcrumb[] = array( NULL, \IPS\Member::loggedIn()->language()->addToStack( 'submit_a_file' ) );
}
}
@@ -1,13 +1,12 @@
<?php
/**
* @brief View File Controller
* @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 Downloads
* @since 10 Oct 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\modules\front\downloads;
@@ -40,8 +39,7 @@ class _view extends \IPS\Content\Controller
{
$this->file = \IPS\downloads\File::load( \IPS\Request::i()->id );
/* Downloading does not check 'view' permission, as there is a separate download permission already.
@see https://invisionpower.com/4bugtrack/archived-reports/4092-cant-download-files-when-files-disallowed-to-view-by-any-group-r6975/ */
/* Downloading does not check 'view' permission, as there is a separate download permission already */
if ( !$this->file->canView( \IPS\Member::loggedIn() ) and \IPS\Request::i()->do != 'download' )
{
\IPS\Output::i()->error( $this->file->container()->message('npv') ?: 'node_error', '2D161/2', 403, '' );
@@ -119,7 +117,119 @@ class _view extends \IPS\Content\Controller
}
}
}
/* Add JSON-ld */
\IPS\Output::i()->jsonLd['download'] = array(
'@context' => "http://schema.org",
'@type' => "SoftwareApplication",
'url' => (string) $this->file->url(),
'name' => htmlspecialchars( $this->file->mapped('title'), ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ),
'description' => strip_tags( $this->file->truncated() ),
'applicationCategory' => $this->file->container()->_title,
'downloadUrl' => (string) $this->file->url( 'download' ),
'dateCreated' => \IPS\DateTime::ts( $this->file->submitted )->format( \IPS\DateTime::ISO8601 ),
'fileSize' => \IPS\Output\Plugin\Filesize::humanReadableFilesize( $this->file->filesize() ),
'softwareVersion' => htmlspecialchars( $this->file->version, ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ),
'author' => array(
'@type' => 'Person',
'name' => htmlspecialchars( \IPS\Member::load( $this->file->submitter )->name, ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ),
'url' => (string) \IPS\Member::load( $this->file->submitter )->url(),
'image' => \IPS\Member::load( $this->file->submitter )->get_photo()
),
'interactionStatistic' => array(
array(
'@type' => 'InteractionCounter',
'interactionType' => "http://schema.org/ViewAction",
'userInteractionCount' => $this->file->views
),
array(
'@type' => 'InteractionCounter',
'interactionType' => "http://schema.org/DownloadAction",
'userInteractionCount' => $this->file->downloads
)
)
);
if( $this->file->updated != $this->file->submitted )
{
\IPS\Output::i()->jsonLd['download']['dateModified'] = \IPS\DateTime::ts( $this->file->updated )->format( \IPS\DateTime::ISO8601 );
}
if( $this->file->container()->bitoptions['reviews'] )
{
\IPS\Output::i()->jsonLd['download']['aggregateRating'] = array(
'@type' => 'AggregateRating',
'ratingValue' => $this->file->averageReviewRating(),
'reviewCount' => $this->file->reviews,
'bestRating' => \IPS\Settings::i()->reviews_rating_out_of
);
}
if( $this->file->screenshots()->getInnerIterator()->count( true ) )
{
\IPS\Output::i()->jsonLd['download']['screenshot'] = array();
$thumbnails = iterator_to_array( $this->file->screenshots( 1 ) );
foreach( $this->file->screenshots() as $id => $screenshot )
{
\IPS\Output::i()->jsonLd['download']['screenshot'][] = array(
'@type' => 'ImageObject',
'url' => (string) $screenshot->url,
'thumbnail' => array(
'@type' => 'ImageObject',
'url' => (string) $thumbnails[ $id ]->url
)
);
}
}
if( $versionData['b_changelog'] )
{
\IPS\Output::i()->jsonLd['download']['releaseNotes'] = $versionData['b_changelog'];
}
if( $this->file->topic() )
{
\IPS\Output::i()->jsonLd['download']['sameAs'] = (string) $this->file->topic()->url();
}
if( $this->file->isPaid() )
{
\IPS\Output::i()->jsonLd['download']['potentialAction'] = array(
'@type' => 'BuyAction',
'target' => (string) $this->file->url( 'buy' ),
);
\IPS\Output::i()->jsonLd['download']['offers'] = array(
'@type' => 'Offer',
'url' => (string) $this->file->url( 'buy' ),
'price' => $this->file->price(),
'priceCurrency' => \IPS\nexus\Customer::loggedIn()->defaultCurrency(),
'availability' => "http://schema.org/InStock"
);
}
if( $this->file->container()->bitoptions['comments'] )
{
\IPS\Output::i()->jsonLd['download']['interactionStatistic'][] = array(
'@type' => 'InteractionCounter',
'interactionType' => "http://schema.org/CommentAction",
'userInteractionCount' => $this->file->mapped('num_comments')
);
\IPS\Output::i()->jsonLd['download']['commentCount'] = $this->file->mapped('num_comments');
}
if( $this->file->container()->bitoptions['reviews'] )
{
\IPS\Output::i()->jsonLd['download']['interactionStatistic'][] = array(
'@type' => 'InteractionCounter',
'interactionType' => "http://schema.org/ReviewAction",
'userInteractionCount' => $this->file->mapped('num_reviews')
);
}
/* Display */
\IPS\Output::i()->sidebar['sticky'] = TRUE;
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'view' )->view( $this->file, $commentsAndReviews, $versionData, $previousVersions, $this->file->nextItem(), $this->file->prevItem(), $cfields );
@@ -355,7 +465,7 @@ class _view extends \IPS\Content\Controller
'dmid' => (int) \IPS\Member::loggedIn()->member_id,
'dsize' => $data['record_size'],
'dua' => \IPS\Session::i()->userAgent->useragent,
'dbrowsers' => \IPS\Session::i()->userAgent->useragentKey,
'dbrowsers' => \IPS\Session::i()->userAgent->browser,
'dos' => ''
) );
}
@@ -671,9 +781,15 @@ class _view extends \IPS\Content\Controller
$form->addHeader( 'upload_files' );
$form->add( new \IPS\Helpers\Form\Upload( 'files', iterator_to_array( $this->file->files( NULL, FALSE ) ), ( !\IPS\Member::loggedIn()->group['idm_linked_files'] and !\IPS\Member::loggedIn()->group['idm_import_files'] ), array( 'storageExtension' => 'downloads_Files', 'allowedFileTypes' => $category->types, 'maxFileSize' => $category->maxfile ? ( $category->maxfile / 1024 ) : NULL, 'multiple' => TRUE, 'retainDeleted' => TRUE ) ) );
$linkedFiles = iterator_to_array( \IPS\Db::i()->select( 'record_location', 'downloads_files_records', array( 'record_file_id=? AND record_type=? AND record_backup=0', $this->file->id, 'link' ) ) );
if ( \IPS\Member::loggedIn()->group['idm_linked_files'] )
{
$form->add( new \IPS\Helpers\Form\Stack( 'url_files', iterator_to_array( \IPS\Db::i()->select( 'record_location', 'downloads_files_records', array( 'record_file_id=? AND record_type=? AND record_backup=0', $this->file->id, 'link' ) ) ), FALSE, array( 'stackFieldType' => 'Url' ), array( 'IPS\downloads\File', 'blacklistCheck' ) ) );
$form->add( new \IPS\Helpers\Form\Stack( 'url_files', $linkedFiles, FALSE, array( 'stackFieldType' => 'Url' ), array( 'IPS\downloads\File', 'blacklistCheck' ) ) );
}
else if ( count( $linkedFiles ) > 0 )
{
$form->addMessage( 'url_files_no_perm' );
}
if ( \IPS\Member::loggedIn()->group['idm_import_files'] )
@@ -851,6 +967,7 @@ class _view extends \IPS\Content\Controller
else
{
$noWatermark = NULL;
$watermarked = FALSE;
if ( \IPS\Settings::i()->idm_watermarkpath )
{
try
@@ -860,15 +977,31 @@ class _view extends \IPS\Content\Controller
$image = \IPS\Image::create( $file->contents() );
$image->watermark( $watermark );
$file = \IPS\File::create( 'downloads_Screenshots', $file->originalFilename, $image );
$watermarked = TRUE;
}
catch ( \Exception $e ) { }
}
/**
* We only need to generate a new thumbnail if we are using watermarking.
* If we are not, then we can simply use the previous thumbnail, if this existed previously, rather than generating a new one every time we upload a new version, which is unnecessary extra processing as well as disk usage.
* If we are, then it is impossible to know if the watermark has since changed, so we need to go ahead and do it anyway.
*/
$existing = NULL;
if ( $watermarked !== TRUE )
{
try
{
$existing = \IPS\Db::i()->select( '*', 'downloads_files_records', array( "record_location=? AND record_file_id=?", (string) $file, $this->file->id ) )->first();
}
catch( \UnderflowException $e ) {}
}
\IPS\Db::i()->insert( 'downloads_files_records', array(
'record_file_id' => $this->file->id,
'record_type' => 'ssupload',
'record_location' => (string) $file,
'record_thumb' => (string) $file->thumbnail( 'downloads_Screenshots' ),
'record_thumb' => ( $watermarked OR !$existing ) ? (string) $file->thumbnail( 'downloads_Screenshots' ) : $existing['record_thumb'],
'record_realname' => $file->originalFilename,
'record_size' => $file->filesize(),
'record_time' => time(),
@@ -1,13 +1,12 @@
<?php
/**
* @brief 4.0.0 Upgrade Code
* @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 Downloads
* @since 30 Oct 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\setup\upg_100002;
@@ -1,13 +1,12 @@
<?php
/**
* @brief 4.0.0 Alpha 1 Upgrade Code
* @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 Downloads
* @since 25 Mar 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\setup\upg_100005;
@@ -1,13 +1,12 @@
<?php
/**
* @brief 4.0.0 RC 1 Upgrade Code
* @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 Downloads
* @since 3 Feb 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\setup\upg_100011;
@@ -1,13 +1,12 @@
<?php
/**
* @brief 4.0.0 RC 1 Upgrade Code
* @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 Downloads
* @since 5 Feb 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\setup\upg_100012;
@@ -1,13 +1,12 @@
<?php
/**
* @brief 4.0.0 RC 1 Upgrade Code
* @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 Downloads
* @since 9 Feb 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\setup\upg_100013;
@@ -1,13 +1,12 @@
<?php
/**
* @brief 4.0.0 Upgrade Code
* @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 Downloads
* @since 15 Jan 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\setup\upg_100015;
@@ -1,13 +1,12 @@
<?php
/**
* @brief 4.0.0 RC 5 Upgrade Code
* @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 Downloads
* @since 5 May 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\setup\upg_100018;
@@ -1,13 +1,12 @@
<?php
/**
* @brief 4.0.5 Upgrade Code
* @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 Downloads
* @since 5 May 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\setup\upg_100028;
@@ -1,13 +1,12 @@
<?php
/**
* @brief 4.0.9 Upgrade Code
* @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 Downloads
* @since 19 Jun 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\setup\upg_100035;
@@ -1,13 +1,12 @@
<?php
/**
* @brief 4.0.13 Upgrade Code
* @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 Downloads
* @since 31 Jul 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\setup\upg_100044;
@@ -1,13 +1,12 @@
<?php
/**
* @brief 4.1.0 Beta 1 Upgrade Code
* @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 Downloads
* @since 23 Sep 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\setup\upg_101000;
@@ -1,12 +1,11 @@
<?php
/**
* @brief 4.1.8 Upgrade Code
* @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
* @since 11 Jan 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\setup\upg_101024;
@@ -20,7 +20,7 @@
}
]
},
{
"2": {
"method": "changeColumn",
"params": [
"downloads_files",
@@ -1,13 +1,12 @@
<?php
/**
* @brief 4.1.17 Beta 1 Upgrade Code
* @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 Downloads
* @since 15 Nov 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\setup\upg_101071;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Upgrader: Custom Post Upgrade Message
* @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
* @since 28 Nov 2016
* @version SVN_VERSION_NUMBER
*/
$path = \IPS\ROOT_PATH . '/applications/downloads/extensions/core/ContentRouter/downloads.php';
@@ -1,13 +1,12 @@
<?php
/**
* @brief 4.1.18.1 Upgrade Code
* @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 Downloads
* @since 20 Jan 2017
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\setup\upg_101088;
@@ -0,0 +1,69 @@
{
"1": {
"method": "addColumn",
"params": [
"downloads_categories",
{
"name": "cclub_id",
"type": "BIGINT",
"length": 20,
"decimals": null,
"values": null,
"allow_null": true,
"default": null,
"comment": "The club ID if this category belongs to a club, or NULL",
"unsigned": true,
"zerofill": false,
"auto_increment": false,
"binary": false
}
]
},
"2": {
"method": "addColumn",
"params": [
"downloads_files",
{
"name": "file_meta_data",
"type": "BIT",
"length": 1,
"decimals": null,
"values": null,
"allow_null": false,
"default": "0",
"comment": "",
"unsigned": false,
"zerofill": false,
"auto_increment": false,
"binary": false
}
]
},
"3": {
"method": "update",
"params": [
"downloads_files_records",
"record_location=TRIM(LEADING '\/' FROM record_location), record_thumb=TRIM(LEADING '\/' FROM record_thumb), record_no_watermark=TRIM(LEADING '\/' FROM record_no_watermark)"
]
},
"4": {
"method": "addColumn",
"params": [
"downloads_cfields",
{
"name": "cf_allow_attachments",
"type": "TINYINT",
"length": 1,
"decimals": null,
"values": null,
"allow_null": false,
"default": "1",
"comment": "",
"unsigned": true,
"zerofill": false,
"auto_increment": false,
"binary": false
}
]
}
}
@@ -1,13 +1,12 @@
<?php
/**
* @brief 4.0.0 Upgrade Code
* @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 Downloads
* @since 24 Oct 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\setup\upg_23000;
@@ -1,13 +1,12 @@
<?php
/**
* @brief 4.0.0 Upgrade Code
* @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 Downloads
* @since 19 Nov 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\setup\upg_40000;
@@ -320,6 +319,81 @@ class _Upgrade
{
return "Fixing watermark configuration";
}
/**
* Set a default primary screenshot for each file
*
* @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 step5()
{
$perCycle = 500;
$did = 0;
$limit = intval( \IPS\Request::i()->extra );
/* Try to prevent timeouts to the extent possible */
$cutOff = \IPS\core\Setup\Upgrade::determineCutoff();
foreach( \IPS\Db::i()->select( '*', 'downloads_files', null, 'file_id ASC', array( $limit, $perCycle ) ) as $file )
{
if ( $cutOff !== NULL AND time() >= $cutOff )
{
return ( $limit + $did );
}
$did++;
/* Try to get the default screenshot if one is set */
try
{
$defaultScreenshot = \IPS\Db::i()->select( 'record_id', 'downloads_files_records', array( "record_file_id=? AND record_type IN('sslink','ssupload') AND record_default=?", $file['file_id'], 1 ) )->first();
\IPS\Db::i()->update( 'downloads_files', array( 'file_primary_screenshot' => $defaultScreenshot ), array( 'file_id=?', $file['file_id'] ) );
}
catch( \UnderflowException $e )
{
/* Get the first screenshot for the file and set the primary screenshot flag */
try
{
$firstScreenshot = \IPS\Db::i()->select( 'record_id', 'downloads_files_records', array( "record_file_id=? AND record_type IN('sslink','ssupload')", $file['file_id'] ), 'record_id ASC', array( 0, 1 ) )->first();
\IPS\Db::i()->update( 'downloads_files', array( 'file_primary_screenshot' => $firstScreenshot ), array( 'file_id=?', $file['file_id'] ) );
}
catch( \UnderflowException $e )
{
continue;
}
}
}
if ( $did )
{
return ( $limit + $did );
}
else
{
unset( $_SESSION['_step5Count_40000_downloads'] );
return true;
}
}
/**
* Custom title for this step
*
* @return string
*/
public function step5CustomTitle()
{
$limit = isset( \IPS\Request::i()->extra ) ? \IPS\Request::i()->extra : 0;
if ( !isset( $_SESSION['_step5Count_40000_downloads'] ) )
{
$_SESSION['_step5Count_40000_downloads'] = \IPS\Db::i()->select( 'COUNT(*)', 'downloads_files' )->first();
}
return "Updating default screenshots (Updated so far: " . ( ( $limit > $_SESSION['_step5Count_40000_downloads'] ) ? $_SESSION['_step5Count_40000_downloads'] : $limit ) . ' out of ' . $_SESSION['_step5Count_40000_downloads'] . ")";
}
/**
* Finish - This is run after all apps have been upgraded
@@ -1,13 +1,12 @@
<?php
/**
* @brief Category Node
* @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 Downloads
* @since 27 Sep 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads;
@@ -24,6 +23,8 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
{
use \IPS\Content\ClubContainer;
/**
* @brief [ActiveRecord] Multiton Store
*/
@@ -205,6 +206,9 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
{
\IPS\Content\Search\Index::i()->massUpdate( static::$contentItemClass, $this->_id, NULL, '' );
}
/* Trash widgets so files in this category are not viewable in widgets */
\IPS\Widget::deleteCaches( NULL, 'downloads' );
}
/**
@@ -722,4 +726,56 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
\IPS\Lang::saveCustom( 'downloads', $langKey, iterator_to_array( \IPS\Db::i()->select( 'word_custom, lang_id', 'core_sys_lang_words', array( 'word_key=?', $oldLangKey ) )->setKeyField( 'lang_id' )->setValueField('word_custom') ) );
}
}
/* !Clubs */
/**
* Get acp language string
*
* @return string
*/
public static function clubAcpTitle()
{
return 'downloads_categories';
}
/**
* Set form for creating a node of this type in a club
*
* @param \IPS\Helpers\Form $form Form object
* @return void
*/
public function clubForm( \IPS\Helpers\Form $form )
{
$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 ) ) );
$form->add( new \IPS\Helpers\Form\Editor( 'club_node_description', $this->_id ? \IPS\Member::loggedIn()->language()->get( static::$titleLangPrefix . $this->_id . '_desc' ) : NULL, FALSE, array( 'app' => 'downloads', 'key' => 'Categories', 'autoSaveKey' => ( $this->id ? "downloads-cat-{$this->id}" : "downloads-new-cat" ), 'attachIds' => $this->id ? array( $this->id, NULL, 'description' ) : NULL, 'minimize' => 'cdesc_placeholder' ) ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'cbitoptions_comments', $this->id ? $this->bitoptions['comments'] : TRUE, FALSE, array(), NULL, NULL, NULL, 'cbitoptions_comments' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'cbitoptions_reviews', $this->id ? $this->bitoptions['reviews'] : TRUE, FALSE, array( 'togglesOn' => array( 'cbitoptions_reviews_download' ) ) ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'cbitoptions_allowss', $this->id ? $this->bitoptions['allowss'] : TRUE, FALSE, array( 'togglesOn' => array( 'cbitoptions_reqss', 'cmaxss', 'cmaxdims' ) ), NULL, NULL, NULL, 'cbitoptions_allowss' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'cbitoptions_reqss', $this->bitoptions['reqss'], FALSE, array(), NULL, NULL, NULL, 'cbitoptions_reqss' ) );
$form->add( new \IPS\Helpers\Form\Text( 'ctypes', $this->id ? $this->_data['types'] : NULL, FALSE, array( 'autocomplete' => array( 'unique' => 'true' ), 'nullLang' => 'any_extensions' ), NULL, NULL, NULL, 'ctypes' ) );
}
/**
* Class-specific routine when saving club form
*
* @param \IPS\Member\Club $club The club
* @param array $values Values
* @return void
*/
public function _saveClubForm( \IPS\Member\Club $club, $values )
{
foreach ( array( 'allowss', 'reqss', 'comments', 'reviews' ) as $k )
{
$this->bitoptions[ $k ] = $values[ 'cbitoptions_' . $k ];
}
$this->types = implode( ',', $values['ctypes'] );
if ( $values['club_node_name'] )
{
$this->name_furl = \IPS\Http\Url\Friendly::seoTitle( $values['club_node_name'] );
}
}
}
@@ -1,13 +1,12 @@
<?php
/**
* @brief Field Model
* @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 Downloads
* @since 3 Oct 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads;
@@ -133,8 +132,10 @@ class _Field extends \IPS\CustomField
unset( $values['cf_topic'] );
}
$values['search_type'] = ( $values['pf_search_type'] === NULL ) ? '' : $values['pf_search_type'];
$values['search_type'] = ( $values['pf_search_type'] === NULL ) ? '' : $values['pf_search_type'];
$values['allow_attachments'] = $values['pf_allow_attachments'];
unset( $values['pf_search_type'] );
unset( $values['pf_allow_attachments'] );
return parent::formatFormValues( $values );
}
+29 -11
View File
@@ -1,13 +1,12 @@
<?php
/**
* @brief File Comment Model
* @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 Downloads
* @since 11 Oct 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\File;
@@ -22,8 +21,10 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* File Comment Model
*/
class _Comment extends \IPS\Content\Comment implements \IPS\Content\EditHistory, \IPS\Content\ReportCenter, \IPS\Content\Hideable, \IPS\Content\Reputation, \IPS\Content\Searchable, \IPS\Content\Embeddable
class _Comment extends \IPS\Content\Comment implements \IPS\Content\EditHistory, \IPS\Content\ReportCenter, \IPS\Content\Hideable, \IPS\Content\Searchable, \IPS\Content\Embeddable, \IPS\Content\Shareable
{
use \IPS\Content\Reactable;
/**
* @brief [ActiveRecord] Multiton Store
*/
@@ -75,11 +76,6 @@ class _Comment extends \IPS\Content\Comment implements \IPS\Content\EditHistory,
*/
public static $icon = 'download';
/**
* @brief Reputation Type
*/
public static $reputationType = 'comment_id';
/**
* @brief [Content] Key for hide reasons
*/
@@ -119,4 +115,26 @@ class _Comment extends \IPS\Content\Comment implements \IPS\Content\EditHistory,
return \IPS\Theme::i()->getTemplate( 'global', 'downloads', 'front' )->searchResultCommentSnippet( $indexData, $screenshot, $url, $reviewRating, $view == 'condensed' );
}
/**
* Reaction Type
*
* @return string
*/
public static function reactionType()
{
return 'comment_id';
}
/**
* Get content for embed
*
* @param array $params Additional parameters to add to URL
* @return string
*/
public function embedContent( $params )
{
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'embed.css', 'downloads', 'front' ) );
return \IPS\Theme::i()->getTemplate( 'global', 'downloads' )->embedFileComment( $this, $this->item(), $this->url()->setQueryString( $params ) );
}
}
+188 -40
View File
@@ -1,13 +1,12 @@
<?php
/**
* @brief File Model
* @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 Downloads
* @since 8 Oct 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads;
@@ -25,7 +24,6 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
class _File extends \IPS\Content\Item implements
\IPS\Content\Permissions,
\IPS\Content\Tags,
\IPS\Content\Reputation,
\IPS\Content\Followable,
\IPS\Content\ReportCenter,
\IPS\Content\ReadMarkers,
@@ -33,8 +31,11 @@ class _File extends \IPS\Content\Item implements
\IPS\Content\Hideable, \IPS\Content\Featurable, \IPS\Content\Pinnable, \IPS\Content\Lockable,
\IPS\Content\Shareable,
\IPS\Content\Searchable,
\IPS\Content\Embeddable
\IPS\Content\Embeddable,
\IPS\Content\MetaData
{
use \IPS\Content\Reactable;
/**
* @brief Application
*/
@@ -101,7 +102,8 @@ class _File extends \IPS\Content\Item implements
'pinned' => 'pinned',
'featured' => 'featured',
'locked' => 'locked',
'ip_address' => 'ipaddress'
'ip_address' => 'ipaddress',
'meta_data' => 'meta_data'
);
/**
@@ -119,11 +121,6 @@ class _File extends \IPS\Content\Item implements
*/
public static $formLangPrefix = 'file_';
/**
* @brief Reputation Type
*/
public static $reputationType = 'file_id';
/**
* @brief [Content] Key for hide reasons
*/
@@ -498,14 +495,6 @@ class _File extends \IPS\Content\Item implements
/**
* Get screenshots
*
* This is probably my favourite method so far in IPS4. It will prepare a query,
* but not execute it until you begin to iterate. It will cache the results so
* even if you iterate more than once, the query is only ran once. And as it
* iterates, it will automatically create \IPS\File objects out of the values.
* It is programatic beauty.
* And if you change one character, I will cut off your fingers.
* - Mark
*
* @param int $type 0 = Normal, 1 = Thumbnails, 2 = No watermark
* @param bool $includeLinks If true, will include linked files
* @param int|NULL $version If provided, will get the file records for a specific previous version (downloads_filebackup.b_id)
@@ -570,7 +559,33 @@ class _File extends \IPS\Content\Item implements
$this->$property = $iterator;
return $this->$property;
}
/**
* Returns the content images
*
* @param int|null $limit Number of attachments to fetch, or NULL for all
*
* @return array|NULL If array, then array( 'core_Attachment' => 'month_x/foo.gif', ... );
* @throws \BadMethodCallException
*/
public function contentImages( $limit = NULL )
{
$images = array();
$count = 0;
foreach( $this->screenshots() as $image )
{
if ( $count == $limit )
{
break;
}
$images[] = array( 'downloads_Screenshots' => (string) $image);
$count++;
}
return count( $images ) ? $images : NULL;
}
/*
* @brief Cached primary screenshot
*/
@@ -676,7 +691,7 @@ class _File extends \IPS\Content\Item implements
if( $topic === TRUE AND $this->_fieldData === NULL )
{
$this->_fieldData = iterator_to_array( \IPS\Db::i()->select( 'cf_id,cf_format', 'downloads_cfields', array( 'cf_topic=?', 1 ) )->setKeyField( 'cf_id' )->setValueField( 'cf_format' ) );
$this->_fieldData = iterator_to_array( \IPS\Db::i()->select( '*', 'downloads_cfields', array( 'cf_topic=?', 1 ) )->setKeyField( 'cf_id' ) );
}
try
@@ -688,21 +703,25 @@ class _File extends \IPS\Content\Item implements
foreach ( $this->_customFields as $k => $v )
{
$fieldId = str_replace( 'field_', '', $k );
/* If we're getting fields for the topic we need to skip any that are set to not be included */
if( $topic === TRUE and !isset( $this->_fieldData[ str_replace( 'field_', '', $k ) ] ) )
if( $topic === TRUE and !isset( $this->_fieldData[ $fieldId ] ) )
{
continue;
}
if ( array_key_exists( str_replace( 'field_', '', $k ), $fields ) )
if ( array_key_exists( $fieldId, $fields ) )
{
if( $topic === TRUE )
{
if( isset( $this->_fieldData[ str_replace( 'field_', '', $k ) ] ) )
$thisField = \IPS\downloads\Field::constructFromData( $this->_fieldData[ $fieldId ] );
if( isset( $this->_fieldData[ $fieldId ] ) )
{
$v = str_replace( '{content}', htmlspecialchars( $v, \IPS\HTMLENTITIES, 'UTF-8', FALSE ), $this->_fieldData[ str_replace( 'field_', '', $k ) ] );
$v = str_replace( '{content}', htmlspecialchars( $v, \IPS\HTMLENTITIES, 'UTF-8', FALSE ), $thisField->displayValue( $v ) );
$v = str_replace( '{member_id}', \IPS\Member::loggedIn()->member_id, $v );
$v = str_replace( '{title}', \IPS\Member::loggedIn()->language()->addToStack( 'downloads_field_' . str_replace( 'field_', '', $k ) ), $v );
$v = str_replace( '{title}', \IPS\Member::loggedIn()->language()->addToStack( 'downloads_field_' . $fieldId ), $v );
}
else
{
@@ -729,11 +748,11 @@ class _File extends \IPS\Content\Item implements
$tabs = array();
if ( $this->container()->bitoptions['reviews'] )
{
$tabs['reviews'] = \IPS\Member::loggedIn()->language()->pluralize( \IPS\Member::loggedIn()->language()->get( 'file_review_count' ), array( $this->mapped('num_reviews') ) );
$tabs['reviews'] = \IPS\Member::loggedIn()->language()->addToStack( 'file_review_count', TRUE, array( 'pluralize' => array( $this->mapped('num_reviews') ) ) );
}
if ( $this->container()->bitoptions['comments'] )
{
$tabs['comments'] = \IPS\Member::loggedIn()->language()->pluralize( \IPS\Member::loggedIn()->language()->get( 'file_comment_count' ), array( $this->mapped('num_comments') ) );
$tabs['comments'] = \IPS\Member::loggedIn()->language()->addToStack( 'file_comment_count', TRUE, array( 'pluralize' => array( $this->mapped('num_comments') ) ) );
}
return $tabs;
@@ -1453,6 +1472,22 @@ class _File extends \IPS\Content\Item implements
parent::processAfterCreate( $comment, $values );
}
/**
* Log for deletion later
*
* \IPS\Member|NULL $member The member or NULL for currently logged in
* @return void
*/
public function logDelete( $member = NULL )
{
parent::logDelete( $member );
if ( $topic = $this->topic() and $this->container()->bitoptions['topic_delete'] )
{
$topic->logDelete( $member );
}
}
/**
* Delete Record
@@ -1499,6 +1534,15 @@ class _File extends \IPS\Content\Item implements
}
catch ( \Exception $e ) { }
}
foreach ( new \IPS\File\Iterator( \IPS\Db::i()->select( 'record_no_watermark', 'downloads_files_records', array( 'record_file_id=? AND record_type=? AND record_no_watermark IS NOT NULL', $this->id, 'ssupload' ) ), 'downloads_Screenshots' ) as $file )
{
try
{
$file->delete();
}
catch ( \Exception $e ) { }
}
\IPS\Db::i()->delete( 'downloads_ccontent', array( 'file_id=?', $this->id ) );
\IPS\Db::i()->delete( 'downloads_downloads', array( 'dfid=?', $this->id ) );
@@ -1538,27 +1582,43 @@ class _File extends \IPS\Content\Item implements
}
}
}
/**
* Are comments supported by this class?
*
* @param \IPS\Member\NULL $member The member to check for or NULL fto not check permission
* @return int
* @param \IPS\Member|NULL $member The member to check for or NULL to not check permission
* @param \IPS\Node\Model|NULL $container The container to check in, or NULL for any container
* @return bool
*/
public static function supportsComments( \IPS\Member $member = NULL )
{
return parent::supportsComments() and ( !$member or \IPS\downloads\Category::countWhere( 'read', $member, array( 'cbitoptions & 4' ) ) );
public static function supportsComments( \IPS\Member $member = NULL, \IPS\Node\Model $container = NULL )
{
if( $container !== NULL )
{
return parent::supportsComments() and $container->bitoptions['comments'] AND ( !$member or $container->can( 'read', $member ) );
}
else
{
return parent::supportsComments() and ( !$member or \IPS\downloads\Category::countWhere( 'read', $member, array( 'cbitoptions & 4' ) ) );
}
}
/**
* Are reviews supported by this class?
*
* @param \IPS\Member\NULL $member The member to check for or NULL to not check permission
* @return int
* @param \IPS\Member|NULL $member The member to check for or NULL to not check permission
* @param \IPS\Node\Model|NULL $container The container to check in, or NULL for any container
* @return bool
*/
public static function supportsReviews( \IPS\Member $member = NULL )
public static function supportsReviews( \IPS\Member $member = NULL, \IPS\Node\Model $container = NULL )
{
return parent::supportsReviews() and ( !$member or \IPS\downloads\Category::countWhere( 'read', $member, array( 'cbitoptions & 256' ) ) );
if( $container !== NULL )
{
return parent::supportsReviews() and $container->bitoptions['reviews'] AND ( !$member or $container->can( 'read', $member ) );
}
else
{
return parent::supportsReviews() and ( !$member or \IPS\downloads\Category::countWhere( 'read', $member, array( 'cbitoptions & 256' ) ) );
}
}
/**
@@ -1603,6 +1663,27 @@ class _File extends \IPS\Content\Item implements
$file = \IPS\File::get( $file['record_type'] == 'upload' ? 'downloads_Files' : 'downloads_Screenshots', $file['record_location'] )->delete();
}
catch ( \Exception $e ) { }
if( $file['record_type'] == 'ssupload' )
{
if( $file['record_thumb'] )
{
try
{
$file = \IPS\File::get( 'downloads_Screenshots', $file['record_thumb'] )->delete();
}
catch ( \Exception $e ) { }
}
if( $file['record_no_watermark'] )
{
try
{
$file = \IPS\File::get( 'downloads_Screenshots', $file['record_no_watermark'] )->delete();
}
catch ( \Exception $e ) { }
}
}
}
\IPS\Db::i()->delete( 'downloads_files_records', \IPS\Db::i()->in( 'record_id', explode( ',', $backUp['b_records'] ) ) );
@@ -1966,6 +2047,21 @@ class _File extends \IPS\Content\Item implements
parent::processAfterEdit( $values );
}
/**
* Callback to execute when tags are edited
*
* @return void
*/
protected function processAfterTagUpdate()
{
parent::processAfterTagUpdate();
if ( \IPS\Application::appIsEnabled('forums') and $this->topic() )
{
$this->syncTopic();
}
}
/**
* Move
@@ -2166,6 +2262,18 @@ class _File extends \IPS\Content\Item implements
return $this->primary_screenshot_thumb ? \IPS\File::get( 'downloads_Screenshots', $this->primary_screenshot_thumb ) : NULL;
}
/**
* Get content for embed
*
* @param array $params Additional parameters to add to URL
* @return string
*/
public function embedContent( $params )
{
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'embed.css', 'downloads', 'front' ) );
return \IPS\Theme::i()->getTemplate( 'global', 'downloads' )->embedFile( $this, $this->url()->setQueryString( $params ), $this->embedImage() );
}
/**
* Get snippet HTML for search result display
*
@@ -2246,7 +2354,7 @@ class _File extends \IPS\Content\Item implements
public function apiOutput( $backup=NULL )
{
return array(
'id' => $this->tid,
'id' => $this->id,
'title' => $backup ? $backup['b_filetitle'] : $this->name,
'category' => $this->container()->apiOutput(),
'author' => $this->author()->apiOutput(),
@@ -2296,4 +2404,44 @@ class _File extends \IPS\Content\Item implements
return NULL;
}
/* !Reactions */
/**
* Reaction Type
*
* @return string
*/
public static function reactionType()
{
return 'file_id';
}
/**
* Supported Meta Data Types
*
* @return array
*/
public static function supportedMetaDataTypes()
{
return array( 'core_FeaturedComments', 'core_ContentMessages' );
}
/**
* Give a content item the opportunity to filter similar content
*
* @note Intentionally blank but can be overridden by child classes
* @return array|NULL
*/
public function similarContentFilter()
{
if( $this->topicid )
{
return array(
array( '!(tag_meta_app=? and tag_meta_area=? and tag_meta_id=?)', 'forums', 'forums', $this->topicid )
);
}
return NULL;
}
}
@@ -1,13 +1,12 @@
<?php
/**
* @brief File Record Model
* @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 Downloads
* @since 9 Dec 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\File;
+29 -11
View File
@@ -1,13 +1,12 @@
<?php
/**
* @brief File Review Model
* @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 Downloads
* @since 4 Nov 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\File;
@@ -22,8 +21,10 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* File Review Model
*/
class _Review extends \IPS\Content\Review implements \IPS\Content\EditHistory, \IPS\Content\ReportCenter, \IPS\Content\Hideable, \IPS\Content\Reputation, \IPS\Content\Searchable, \IPS\Content\Embeddable
class _Review extends \IPS\Content\Review implements \IPS\Content\EditHistory, \IPS\Content\ReportCenter, \IPS\Content\Hideable, \IPS\Content\Searchable, \IPS\Content\Embeddable
{
use \IPS\Content\Reactable;
/**
* @brief [ActiveRecord] Multiton Store
*/
@@ -79,11 +80,6 @@ class _Review extends \IPS\Content\Review implements \IPS\Content\EditHistory, \
*/
public static $icon = 'download';
/**
* @brief Reputation Type
*/
public static $reputationType = 'review_id';
/**
* @brief [Content] Key for hide reasons
*/
@@ -117,4 +113,26 @@ class _Review extends \IPS\Content\Review implements \IPS\Content\EditHistory, \
{
return \IPS\downloads\File\Comment::searchResultSnippet( $indexData, $authorData, $itemData, $containerData, $reputationData, $reviewRating, $view );
}
/**
* Reaction type
*
* @return string
*/
public static function reactionType()
{
return 'review_id';
}
/**
* Get content for embed
*
* @param array $params Additional parameters to add to URL
* @return string
*/
public function embedContent( $params )
{
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'embed.css', 'downloads', 'front' ) );
return \IPS\Theme::i()->getTemplate( 'global', 'downloads' )->embedFileReview( $this, $this->item(), $this->url()->setQueryString( $params ) );
}
}
@@ -1,13 +1,12 @@
<?php
/**
* @brief Form helper class for linked screenshots
* @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 Downloads
* @since 13 Nov 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\Form;
+4 -5
View File
@@ -1,13 +1,12 @@
<?php
/**
* @brief Log Cleanup Task
* @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 Downloads
* @since 15 Nov 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\tasks;
@@ -1,13 +1,12 @@
<?php
/**
* @brief tempFileCleanup Task
* @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 Downloads
* @since 10 Oct 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\tasks;
@@ -44,6 +43,24 @@ class _tempFileCleanup extends \IPS\Task
\IPS\File::get( $file['record_type'] === 'upload' ? 'downloads_Files' : 'downloads_Screenshots', $file['record_location'] )->delete();
}
catch ( \Exception $e ) { }
if( $file['record_thumb'] )
{
try
{
\IPS\File::get( 'downloads_Screenshots', $file['record_thumb'] )->delete();
}
catch ( \Exception $e ) { }
}
if( $file['record_no_watermark'] )
{
try
{
\IPS\File::get( 'downloads_Screenshots', $file['record_no_watermark'] )->delete();
}
catch ( \Exception $e ) { }
}
}
\IPS\Db::i()->delete( 'downloads_files_records', array( 'record_file_id=0 AND record_time<?', \IPS\DateTime::create()->sub( new \DateInterval( 'P1D' ) )->getTimestamp() ) );
@@ -1,13 +1,12 @@
<?php
/**
* @brief downloadStats Widget
* @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 Downloads
* @since 09 Jan 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\widgets;
@@ -58,11 +57,8 @@ class _downloadStats extends \IPS\Widget\PermissionCache
*/
public function render()
{
$stats = array();
$stats['totalFiles'] = \IPS\Db::i()->select( 'COUNT(*)', 'downloads_files' )->first();
$stats = \IPS\Db::i()->select( 'COUNT(*) AS totalFiles, SUM(file_comments) AS totalComments, SUM(file_reviews) AS totalReviews', 'downloads_files', array( "file_open=?", 1 ) )->first();
$stats['totalAuthors'] = \IPS\Db::i()->select( 'COUNT(DISTINCT file_submitter)', 'downloads_files' )->first();
$stats['totalComments'] = \IPS\Db::i()->select( 'COUNT(*)', 'downloads_comments' )->first();
$stats['totalReviews'] = \IPS\Db::i()->select( 'COUNT(*)', 'downloads_reviews' )->first();
$latestFile = NULL;
foreach ( \IPS\downloads\File::getItemsWithPermission( array(), NULL, 1 ) as $latestFile )
@@ -1,13 +1,12 @@
<?php
/**
* @brief downloadsCommentFeed Widget
* @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 Downloads
* @since 13 Jul 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\widgets;
@@ -1,13 +1,12 @@
<?php
/**
* @brief downloadsReviewFeed Widget
* @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 Downloads
* @since 13 Jul 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\widgets;
+4 -5
View File
@@ -1,13 +1,12 @@
<?php
/**
* @brief Files Feed Widget
* @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 Downloads
* @since 22 Jun 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\widgets;
@@ -1,13 +1,12 @@
<?php
/**
* @brief topDownloads Widget
* @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 Downloads
* @since 09 Jan 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\widgets;
@@ -1,13 +1,12 @@
<?php
/**
* @brief topSubmitters Widget
* @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 Downloads
* @since 09 Jan 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\downloads\widgets;
@@ -85,7 +84,7 @@ class _topSubmitters extends \IPS\Widget\PermissionCache
}
/* Get the submitters ordered by their rating */
$where = array( array( 'file_submitter != ? and file_rating > ?', 0, 0 ) );
$where = array( array( 'file_submitter != ? and file_rating > ? AND file_open = 1', 0, 0 ) );
if ( $interval )
{
$where[] = $intervalWhere;