Version 4.1.19

This commit is contained in:
Neo committed 2025-12-19 05:38:56 -08:00
1 parent 28bd025b35
commit 2bd5025018
2674 files changed
+233518 -77766

No files matched your search

@@ -2,9 +2,9 @@
/**
* @brief Announcements Extension : Download Categories
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Downloads
* @since 28 Apr 2014
* @version SVN_VERSION_NUMBER
@@ -2,9 +2,9 @@
/**
* @brief Content Router extension: Downloads
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Downloads
* @since 02 Dec 2013
* @version SVN_VERSION_NUMBER
@@ -22,7 +22,7 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* @brief Content Router extension: Downloads
*/
class _Downloads
class _Files
{
/**
* @brief Content Item Classes
@@ -2,9 +2,9 @@
/**
* @brief Create Menu Extension
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Downloads
* @since 8 Oct 2013
* @version SVN_VERSION_NUMBER
@@ -2,9 +2,9 @@
/**
* @brief Dashboard extension: Overview
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Downloads
* @since 13 Dec 2013
* @version SVN_VERSION_NUMBER
@@ -2,9 +2,10 @@
/**
* @brief Editor Extension: Category descriptions
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Downloads
* @since 27 Sep 2013
* @version SVN_VERSION_NUMBER
*/
@@ -45,7 +46,7 @@ class _Categories
{
return NULL;
}
/**
* Permission check for attachments
*
@@ -53,9 +54,10 @@ class _Categories
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param array $attachment The attachment data
* @return bool
*/
public function attachmentPermissionCheck( $member, $id1, $id2, $id3 )
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment )
{
try
{
@@ -2,9 +2,9 @@
/**
* @brief Editor Extension: File descriptions
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Downloads
* @since 8 Oct 2013
* @version SVN_VERSION_NUMBER
@@ -46,7 +46,7 @@ class _Downloads
{
return NULL;
}
/**
* Permission check for attachments
*
@@ -54,9 +54,10 @@ class _Downloads
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param array $attachment The attachment data
* @return bool
*/
public function attachmentPermissionCheck( $member, $id1, $id2, $id3 )
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment )
{
try
{
@@ -2,10 +2,10 @@
/**
* @brief Editor Media: Files
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage
* @package IPS Community Suite
* @subpackage Downloads
* @since 26 Dec 2013
* @version SVN_VERSION_NUMBER
*/
@@ -72,7 +72,8 @@ class _Files
{
$file = \IPS\downloads\File::load( $row['record_file_id'] );
$obj = \IPS\File::get( 'downloads_Files', $row['record_location'] );
$obj->contextInfo = \IPS\Theme::i()->getTemplate( 'global', 'downloads', 'global' )->link( $file );
$obj->contextInfo = $file->name;
$obj->screenshot = $file->primary_screenshot;
$obj->originalFilename = $row['record_realname'];
$return[ (string) $file->url()->setQueryString( array( 'do' => 'download', 'r' => $row['record_id'] ) ) ] = $obj;
}
@@ -2,10 +2,10 @@
/**
* @brief File Storage Extension: FileField
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage
* @package IPS Community Suite
* @subpackage Downloads
* @since 29 Aug 2014
* @version SVN_VERSION_NUMBER
*/
@@ -63,7 +63,7 @@ class _FileField
try
{
$file = \IPS\File::get( $oldCinfiguration ?: 'core_FileField', $cfield[ 'field_' . $field['cf_id'] ] )->move( $storageConfiguration );
$file = \IPS\File::get( $oldConfiguration ?: 'core_FileField', $cfield[ 'field_' . $field['cf_id'] ] )->move( $storageConfiguration );
if ( (string) $file != $cfield[ 'field_' . $field['cf_id'] ] )
{
@@ -2,9 +2,9 @@
/**
* @brief File Storage Extension: Files
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Downloads
* @since 08 Oct 2013
* @version SVN_VERSION_NUMBER
@@ -24,6 +24,11 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class _Files
{
/**
* Some file storage engines have the facility to upload private files that need specially signed URLs to download to prevent public access of protected files.
*/
public static $isPrivate = true;
/**
* Count stored files
*
@@ -2,9 +2,9 @@
/**
* @brief File Storage Extension: Screenshots
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Downloads
* @since 08 Oct 2013
* @version SVN_VERSION_NUMBER
@@ -2,9 +2,9 @@
/**
* @brief Front Navigation Extension: Downloads
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Downloads
* @since 8 Oct 2013
* @version SVN_VERSION_NUMBER
@@ -35,13 +35,13 @@ class _Downloads extends \IPS\core\FrontNavigation\FrontNavigationAbstract
}
/**
* Can access?
* Can the currently logged in user access the content this item links to?
*
* @return bool
*/
public function canView()
public function canAccessContent()
{
return parent::canView() and \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'downloads', 'downloads' ) );
return \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'downloads', 'downloads' ) );
}
/**
@@ -2,10 +2,10 @@
/**
* @brief Admin CP Group Form
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage
* @package IPS Community Suite
* @subpackage Downloads
* @since 19 Nov 2013
* @version SVN_VERSION_NUMBER
*/
@@ -2,10 +2,10 @@
/**
* @brief Group Limits
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage
* @package IPS Community Suite
* @subpackage Downloads
* @since 21 Nov 2013
* @version SVN_VERSION_NUMBER
*/
@@ -35,9 +35,9 @@ class _Downloads
{
return array (
'exclude' => array(),
'lessIsMore' => array( 'idm_throttling', 'idm_wait_period' ),
'lessIsMore' => array( 'idm_wait_period' ),
'neg1IsBest' => array(),
'zeroIsBest' => array(),
'zeroIsBest' => array( 'idm_throttling' ),
'callback' => array( 'idm_restrictions' => function( $a, $b, $k )
{
// Decode
@@ -78,6 +78,12 @@ class _Downloads
// Higher is better
foreach ( array( 'daily_bw', 'weekly_bw', 'monthly_bw', 'daily_dl', 'weekly_dl', 'monthly_dl' ) as $k )
{
if( $a[ $k ] == 0 OR $b[ $k ] == 0 )
{
$return[ $k ] = 0;
continue;
}
$return[ $k ] = ( $a[ $k ] > $b[ $k ] ) ? $a[ $k ] : $b[ $k ];
}
@@ -2,10 +2,10 @@
/**
* @brief IP Address Lookup extension
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage
* @package IPS Community Suite
* @subpackage Downloads
* @since 30 Dec 2013
* @version SVN_VERSION_NUMBER
*/
@@ -24,6 +24,28 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class _DownloadLog
{
/**
* Supported in the ACP IP address lookup tool?
*
* @return bool
* @note If the method does not exist in an extension, the result is presumed to be TRUE
*/
public function supportedInAcp()
{
return TRUE;
}
/**
* Supported in the ModCP IP address lookup tool?
*
* @return bool
* @note If the method does not exist in an extension, the result is presumed to be TRUE
*/
public function supportedInModCp()
{
return TRUE;
}
/**
* Find Records by IP
*
@@ -36,16 +58,16 @@ class _DownloadLog
/* Return count */
if ( $baseUrl === NULL )
{
return \IPS\Db::i()->select( 'COUNT(*)', 'downloads_downloads', array( "dip LIKE CONCAT( ?, '%' )", $ip ) )->first();
return \IPS\Db::i()->select( 'COUNT(*)', 'downloads_downloads', array( "dip LIKE ?", $ip ) )->first();
}
/* Init Table */
$table = new \IPS\Helpers\Table\Db( 'downloads_downloads', $baseUrl, array( "dip LIKE CONCAT( ?, '%' )", $ip ) );
$table = new \IPS\Helpers\Table\Db( 'downloads_downloads', $baseUrl, array( "dip LIKE ?", $ip ) );
$table->tableTemplate = array( \IPS\Theme::i()->getTemplate( 'tables', 'core', 'admin' ), 'table' );
$table->rowsTemplate = array( \IPS\Theme::i()->getTemplate( 'tables', 'core', 'admin' ), 'rows' );
$table->include = array( 'dfid', 'dtime', 'dsize', 'dua', 'dmid' );
$table->include = array( 'dfid', 'dtime', 'dsize', 'dua', 'dmid', 'dip' );
$table->sortBy = $table->sortBy ?: 'dtime';
/* Parsers */
@@ -2,10 +2,10 @@
/**
* @brief ACP Live Search Extension
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage
* @package IPS Community Suite
* @subpackage Downloads
* @since 07 Feb 2014
* @version SVN_VERSION_NUMBER
*/
@@ -74,4 +74,14 @@ class _downloads
return $results;
}
/**
* Is default for current page?
*
* @return bool
*/
public function isDefault()
{
return \IPS\Dispatcher::i()->application->directory == 'downloads';
}
}
@@ -2,10 +2,10 @@
/**
* @brief Admin CP Member Form
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage
* @package IPS Community Suite
* @subpackage Downloads
* @since 13 Dec 2013
* @version SVN_VERSION_NUMBER
*/
@@ -2,10 +2,10 @@
/**
* @brief Member Sync
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage
* @package IPS Community Suite
* @subpackage Downloads
* @since 26 Dec 2013
* @version SVN_VERSION_NUMBER
*/
@@ -2,10 +2,10 @@
/**
* @brief Notification Options
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage
* @package IPS Community Suite
* @subpackage Downloads
* @since 11 Dec 2014
* @version SVN_VERSION_NUMBER
*/
@@ -44,12 +44,12 @@ class _Files
* @return array
* @code
return array(
'title' => "Mark has replied to A Topic", // The notification title
'url' => new \IPS\Http\Url( ... ), // The URL the notification should link to
'content' => "Lorem ipsum dolar sit", // [Optional] Any appropriate content. Do not format this like an email where the text
// explains what the notification is about - just include any appropriate content.
// For example, if the notification is about a post, set this as the body of the post.
'author' => \IPS\Member::load( 1 ), // [Optional] The user whose photo should be displayed for this notification
'title' => "Mark has replied to A Topic", // The notification title
'url' => \IPS\Http\Url\Friendly::internal( ... ), // The URL the notification should link to
'content' => "Lorem ipsum dolar sit", // [Optional] Any appropriate content. Do not format this like an email where the text
// explains what the notification is about - just include any appropriate content.
// For example, if the notification is about a post, set this as the body of the post.
'author' => \IPS\Member::load( 1 ), // [Optional] The user whose photo should be displayed for this notification
);
* @endcode
*/
@@ -2,10 +2,10 @@
/**
* @brief Permissions
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage
* @package IPS Community Suite
* @subpackage Downloads
* @since 16 Apr 2014
* @version SVN_VERSION_NUMBER
*/
@@ -2,10 +2,10 @@
/**
* @brief Background Task
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage
* @package IPS Community Suite
* @subpackage Downloads
* @since 23 Sep 2014
* @version SVN_VERSION_NUMBER
*/
@@ -27,16 +27,23 @@ class _Follow
/**
* Run Background Task
*
* @param mixed $data Data as it was passed to \IPS\Task::queue()
* @param int $offset Offset
* @return int|null New offset or NULL if complete
* @throws \OutOfRangeException Indicates offset doesn't exist and thus task is complete
* @param mixed $data Data as it was passed to \IPS\Task::queue()
* @param int $offset Offset
* @return int New offset
* @throws \IPS\Task\Queue\OutOfRangeException Indicates offset doesn't exist and thus task is complete
*/
public function run( $data, $offset )
{
$category = \IPS\downloads\Category::load( $data['category_id'] );
$member = \IPS\Member::load( $data['member_id'] );
return \IPS\downloads\File::_sendNotificationsBatch( $category, $member, $offset );
$newOffset = \IPS\downloads\File::_sendNotificationsBatch( $category, $member, $offset );
if( $newOffset === NULL )
{
throw new \IPS\Task\Queue\OutOfRangeException;
}
return $newOffset;
}
/**
@@ -44,14 +51,14 @@ class _Follow
*
* @param mixed $data Data as it was passed to \IPS\Task::queue()
* @param int $offset Offset
* @return array( 'text' => 'Doing something...', 'complete' => 50 ) Text explaning task and percentage complete
* @return array( 'text' => 'Doing something...', 'complete' => 50 ) Text explaining task and percentage complete
* @throws \OutOfRangeException Indicates offset doesn't exist and thus task is complete
*/
public function getProgress( $data, $offset )
{
$numberOfFollowers = \IPS\downloads\File::_notificationRecipients()->count( TRUE );
$numberOfFollowers = \IPS\downloads\File::_notificationRecipients( \IPS\downloads\Category::load( $data['category_id'] ) )->count( TRUE );
if ( $numberofFollowers )
if ( $numberOfFollowers )
{
$complete = round( 100 / $numberOfFollowers * $offset, 2 );
}