Version 4.2.0

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

No files matched your search

@@ -1,12 +1,11 @@
<?php
/**
* @brief Build CKEditor for release
* @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 19 Apr 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\Build;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Build CodeMirror for release
* @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 21 Nov 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\Build;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Community Enhancements: IPS GeoIP Service
* @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 19 Apr 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\CommunityEnhancements;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Community Enhancement: Google Maps
* @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 19 Apr 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\CommunityEnhancements;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Community Enhancements: SendGrid integration
* @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 17 October 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\CommunityEnhancements;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Community Enhancements: Spam Monitoring Service
* @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 17 Apr 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\CommunityEnhancements;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Community Enhancements: Sparkpost integration
* @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 29 March 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\CommunityEnhancements;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Community Enhancements: Viglink integration
* @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 20 June 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\CommunityEnhancements;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Contact Us 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}
* @since 29 Sep 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\ContactUs;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Contact Us 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}
* @since 29 Sep 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\ContactUs;
@@ -0,0 +1,44 @@
<?php
/**
* @brief Content Router extension: Clubs
* @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 26 Apr 2017
*/
namespace IPS\core\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: Clubs
*/
class _Clubs
{
/**
* @brief Content Item Classes
*/
public $classes = array();
/**
* Constructor
*
* @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( $memberOrGroup = NULL )
{
if ( $memberOrGroup === NULL or $memberOrGroup->canAccessModule( \IPS\Application\Module::get( 'core', 'clubs', 'front' ) ) )
{
$this->embeddableContent[] = 'IPS\Member\Club';
}
}
}
@@ -1,13 +1,12 @@
<?php
/**
* @brief Content Router extension: Status
* @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 Core
* @since 24 Feb 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\ContentRouter;
@@ -32,10 +31,10 @@ class _Status
/**
* 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 ( \IPS\Settings::i()->profile_comments and ( $member === NULL or $member->canAccessModule( \IPS\Application\Module::get( 'core', 'status', 'front' ) ) ) )
{
@@ -1,12 +1,11 @@
<?php
/**
* @brief Create Menu Extension : Announcement
* @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 23 Jun 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\CreateMenu;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Create Menu Extension : Status
* @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 21 Sep 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\CreateMenu;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Dashboard extension: Admin notes
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 23 Jul 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\Dashboard;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Dashboard extension: Users Awaiting Validation
* @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 13 Aug 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\Dashboard;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Dashboard extension: Background Queue Progress
* @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 27 May 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\Dashboard;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Dashboard extension: Failed Admin Logins
* @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 13 Aug 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\Dashboard;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Dashboard extension: Show a notice if there are failed IPS Connect communications
* @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 03 Dec 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\Dashboard;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Dashboard extension: Latest News
* @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 13 Aug 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\Dashboard;
@@ -30,7 +29,7 @@ class _LatestNews
*/
public function canView()
{
return TRUE;
return FALSE;
}
/**
@@ -40,21 +39,7 @@ class _LatestNews
*/
public function getBlock()
{
$ipsNews = ( isset( \IPS\Data\Store::i()->ips_news ) ) ? json_decode( \IPS\Data\Store::i()->ips_news, TRUE ) : array();
if( empty( $ipsNews ) or $ipsNews['time'] < ( time() - 43200 ) )
{
try
{
$this->refreshNews();
$ipsNews = ( isset( \IPS\Data\Store::i()->ips_news ) ) ? json_decode( \IPS\Data\Store::i()->ips_news, TRUE ) : array();
}
catch ( \IPS\Http\Exception $e ) {}
catch( \IPS\Http\Request\Exception $e ) {}
catch( \RuntimeException $e ) {}
}
return \IPS\Theme::i()->getTemplate( 'dashboard' )->ipsNews( isset( $ipsNews['content'] ) ? $ipsNews['content'] : NULL );
return NULL;
}
/**
@@ -65,9 +50,6 @@ class _LatestNews
*/
protected function refreshNews()
{
\IPS\Data\Store::i()->ips_news = json_encode( array(
'content' => \IPS\Http\Url::ips( 'news' )->request()->get()->decodeJson(),
'time' => time()
) );
return NULL;
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Dashboard extension: Current online admins
* @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 14 Jul 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\Dashboard;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Dashboard extension: Online Users
* @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 23 Jul 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\Dashboard;
@@ -73,6 +72,13 @@ class _OnlineUsers
}
/* Output */
return \IPS\Theme::i()->getTemplate( 'dashboard' )->onlineUsers( $online, $chart->render( 'PieChart', array( 'backgroundColor' => '#fafafa', 'chartArea' => array( 'width' =>"90%", 'height' => "90%" ) ) ) );
return \IPS\Theme::i()->getTemplate( 'dashboard' )->onlineUsers( $online, $chart->render( 'PieChart', array(
'backgroundColor' => '#ffffff',
'colors' => array( '#cc535f', '#d8624b', '#598acd', '#9a84d2', '#e4b555', '#8cb65e', '#44af94', '#4da5c8', '#acb2bb', '#676d76' ),
'chartArea' => array(
'width' =>"90%",
'height' => "90%"
)
) ) );
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Dashboard extension: Registrations
* @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 23 Jul 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\Dashboard;
@@ -108,8 +107,12 @@ class _Registrations
/* Output */
return \IPS\Theme::i()->getTemplate( 'dashboard' )->registrations( $chart->render( 'ColumnChart', array(
'legend' => array( 'position' => 'none' ),
'backgroundColor' => '#fafafa',
'areaOpacity' => 0.4,
'lineWidth' => 1,
'backgroundColor' => '#ffffff',
'colors' => array( '#10967e' ),
'vAxis' => array( 'ticks' => $ticks ),
'hAxis' => array( 'gridlines' => array( 'color' => '#f5f5f5' ) ),
) ) );
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Editor Extension: Admin CP Settings, etc.
* @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 2 Aug 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\EditorLocations;
@@ -37,7 +36,7 @@ class _Admin
return FALSE;
}
return TRUE;
return NULL;
}
/**
@@ -147,6 +146,27 @@ class _Admin
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
*
@@ -165,7 +185,14 @@ class _Admin
{
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 )
{
@@ -188,7 +215,14 @@ class _Admin
/* Site offline message setting */
try
{
$newMessage = call_user_func( $callback, \IPS\Settings::i()->site_offline_message );
if( $callback == 'parseImageProxy' )
{
$newMessage = \IPS\Text\Parser::parseImageProxy( \IPS\Settings::i()->site_offline_message, $this->_imageProxyStatus );
}
else
{
$newMessage = call_user_func( $callback, \IPS\Settings::i()->site_offline_message );
}
}
catch( \InvalidArgumentException $e )
{
@@ -213,7 +247,14 @@ class _Admin
{
try
{
$rebuilt = call_user_func( $callback, $application['app_disabled_message'] );
if( $callback == 'parseImageProxy' )
{
$rebuilt = \IPS\Text\Parser::parseImageProxy( $application['app_disabled_message'], $this->_imageProxyStatus );
}
else
{
$rebuilt = call_user_func( $callback, $application['app_disabled_message'] );
}
}
catch( \InvalidArgumentException $e )
{
@@ -240,7 +281,14 @@ class _Admin
{
try
{
$rebuilt = call_user_func( $callback, $mmod['topic_reply_content'] );
if( $callback == 'parseImageProxy' )
{
$rebuilt = \IPS\Text\Parser::parseImageProxy( $mmod['topic_reply_content'], $this->_imageProxyStatus );
}
else
{
$rebuilt = call_user_func( $callback, $mmod['topic_reply_content'] );
}
}
catch( \InvalidArgumentException $e )
{
@@ -272,7 +320,15 @@ class _Admin
/* Update */
try
{
$rebuilt = call_user_func( $callback, $mail['mail_content'] );
if( $callback == 'parseImageProxy' )
{
$rebuilt = \IPS\Text\Parser::parseImageProxy( $mail['mail_content'], $this->_imageProxyStatus );
}
else
{
$rebuilt = call_user_func( $callback, $mail['mail_content'] );
}
}
catch( \InvalidArgumentException $e )
{
@@ -1,12 +1,11 @@
<?php
/**
* @brief Editor Extension: Announcements
* @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 08 Dec 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\EditorLocations;
@@ -32,7 +31,7 @@ class _Announcement
*/
public function canUseHtml( $member, $field )
{
return TRUE;
return NULL;
}
/**
@@ -102,6 +101,28 @@ class _Announcement
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
*
@@ -121,7 +142,14 @@ class _Announcement
/* Update */
try
{
$rebuilt = call_user_func( $callback, $announcement['announce_content'], \IPS\Member::load( $announcement['announce_member_id'] ), FALSE, 'core_Announcement' );
if( $callback == 'parseImageProxy' )
{
$rebuilt = \IPS\Text\Parser::parseImageProxy( $announcement['announce_content'], $this->_imageProxyStatus );
}
else
{
$rebuilt = call_user_func( $callback, $announcement['announce_content'], \IPS\Member::load( $announcement['announce_member_id'] ), FALSE, 'core_Announcement' );
}
}
catch( \InvalidArgumentException $e )
{
@@ -0,0 +1,228 @@
<?php
/**
* @brief Editor Extension: Clubs
* @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 03 Mar 2017
*/
namespace IPS\core\extensions\core\EditorLocations;
/* 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;
}
/**
* Editor Extension: Clubs
*/
class _Clubs
{
/**
* Can we use HTML in this editor?
*
* @param \IPS\Member $member The member
* @return bool|null NULL will cause the default value (based on the member's permissions) to be used, and is recommended in most cases. A boolean value will override that.
*/
public function canUseHtml( $member )
{
return NULL;
}
/**
* Can we use attachments in this editor?
*
* @param \IPS\Member $member The member
* @param \IPS\Helpers\Form\Editor $field The editor field
* @return bool|null NULL will cause the default value (based on the member's permissions) to be used, and is recommended in most cases. A boolean value will override that.
*/
public function canAttach( $member, $field )
{
return NULL;
}
/**
* Permission check for attachments
*
* @param \IPS\Member $member The member
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param array $attachment The attachment data
* @return bool
*/
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment )
{
try
{
$club = \IPS\Member\Club::load( $id1 );
return $club->canView( $member );
}
catch ( \OutOfRangeException $e )
{
return FALSE;
}
}
/**
* Attachment lookup
*
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @return \IPS\Http\Url|\IPS\Content|\IPS\Node\Model
* @throws \LogicException
*/
public function attachmentLookup( $id1, $id2, $id3 )
{
return \IPS\Member\Club::load( $id1 )->url();
}
/**
* Rebuild attachment images in non-content item areas
*
* @param int|null $offset Offset to start from
* @param int|null $max Maximum to parse
* @return int Number completed
* @note This method is optional and will only be called if it exists
*/
public function rebuildAttachmentImages( $offset, $max )
{
return $this->performRebuild( $offset, $max, array( 'IPS\Text\Parser', 'rebuildAttachmentUrls' ) );
}
/**
* Rebuild content post-upgrade
*
* @param int|null $offset Offset to start from
* @param int|null $max Maximum to parse
* @return int Number completed
* @note This method is optional and will only be called if it exists
*/
public function rebuildContent( $offset, $max )
{
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
*
* @param int|null $offset Offset to start from
* @param int|null $max Maximum to parse
* @param callable $callback Method to call to rebuild content
* @return int Number completed
*/
protected function performRebuild( $offset, $max, $callback )
{
$did = 0;
/* Get editor fields */
$editorFields = array();
foreach( \IPS\Db::i()->select( '*', 'core_clubs_fields', "f_type='Editor'" ) as $field )
{
$editorFields[] = 'field_' . $field['f_id'];
}
if( !count( $editorFields ) )
{
return $did;
}
/* Now update the content */
foreach( \IPS\Db::i()->select( '*', 'core_clubs_fieldvalues', implode( " IS NOT NULL OR ", $editorFields ) . " IS NOT NULL", 'club_id ASC', array( $offset, $max ) ) as $clubFieldValues )
{
$did++;
/* Update */
$toUpdate = array();
foreach( $editorFields as $fieldId )
{
try
{
if( $callback == 'parseImageProxy' )
{
$rebuilt = \IPS\Text\Parser::parseImageProxy( $clubFieldValues[ $fieldId ], $this->_imageProxyStatus );
}
else
{
$rebuilt = call_user_func( $callback, $clubFieldValues[ $fieldId ] );
}
}
catch( \InvalidArgumentException $e )
{
if( $callback[1] == 'parseStatic' AND $e->getcode() == 103014 )
{
$rebuilt = preg_replace( "#\[/?([^\]]+?)\]#", '', $clubFieldValues[ $fieldId ] );
}
else
{
throw $e;
}
}
if( $rebuilt )
{
$toUpdate[ $fieldId ] = $rebuilt;
}
}
if( count( $toUpdate ) )
{
\IPS\Db::i()->update( 'core_clubs_fieldvalues', $toUpdate, array( 'club_id=?', $clubFieldValues['member_id'] ) );
}
}
return $did;
}
/**
* Total content count to be used in progress indicator
*
* @return int Total Count
*/
public function contentCount()
{
/* Get editor fields */
$editorFields = array();
foreach( \IPS\Db::i()->select( '*', 'core_clubs_fields', "f_type='Editor'" ) as $field )
{
$editorFields[] = 'field_' . $field['f_id'];
}
if( !count( $editorFields ) )
{
return 0;
}
return \IPS\Db::i()->select( 'COUNT(*) as count', 'core_clubs_fieldvalues', implode( " IS NOT NULL OR ", $editorFields ) . " IS NOT NULL" )->first();
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Editor Extension: Contact 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
* @since 12 Nov 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\EditorLocations;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Editor Extension: CustomField
* @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 25 Apr 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\EditorLocations;
@@ -33,16 +32,21 @@ class _CustomField
{
return NULL;
}
/**
* Can we use attachments in this editor?
*
* @param \IPS\Member $member The member
* @param \IPS\Helpers\Form\Editor $field The editor field
* @param \IPS\Member $member The member
* @param \IPS\Helpers\Form\Editor $editor The editor instance
* @return bool|null NULL will cause the default value (based on the member's permissions) to be used, and is recommended in most cases. A boolean value will override that.
*/
public function canAttach( $member, $field )
public function canAttach( $member, $editor )
{
if( !$editor->options['allowAttachments'] )
{
return FALSE;
}
return NULL;
}
@@ -100,6 +104,27 @@ class _CustomField
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
*
@@ -139,7 +164,11 @@ class _CustomField
{
try
{
if( $callback[1] == 'rebuildAttachmentUrls' )
if( $callback == 'parseImageProxy' )
{
$rebuilt = \IPS\Text\Parser::parseImageProxy( $member[ $fieldId ], $this->_imageProxyStatus );
}
elseif( $callback[1] == 'rebuildAttachmentUrls' )
{
$rebuilt = \IPS\Text\Parser::rebuildAttachmentUrls( $member[ $fieldId ], \IPS\Member::load( $member['member_id'] ) );
}
@@ -0,0 +1,48 @@
<?php
/**
* @brief Editor Extension: GuestSignupWidget
* @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 27 Mar 2017
*/
namespace IPS\core\extensions\core\EditorLocations;
/* 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;
}
/**
* Editor Extension: GuestSignupWidget
*/
class _GuestSignupWidget
{
/**
* Can we use HTML in this editor?
*
* @param \IPS\Member $member The member
* @return bool|null NULL will cause the default value (based on the member's permissions) to be used, and is recommended in most cases. A boolean value will override that.
*/
public function canUseHtml( $member )
{
return NULL;
}
/**
* Can we use attachments in this editor?
*
* @param \IPS\Member $member The member
* @param \IPS\Helpers\Form\Editor $field The editor field
* @return bool|null NULL will cause the default value (based on the member's permissions) to be used, and is recommended in most cases. A boolean value will override that.
*/
public function canAttach( $member, $field )
{
return NULL;
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Editor Extension: Status Reply
* @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 10 Feb 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\EditorLocations;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Editor Extension: Messenger
* @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 05 Jul 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\EditorLocations;
@@ -0,0 +1,92 @@
<?php
/**
* @brief Editor Extension: Meta
* @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 27 Jan 2017
*/
namespace IPS\core\extensions\core\EditorLocations;
/* 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;
}
/**
* Editor Extension: Meta
*/
class _Meta
{
/**
* Can we use HTML in this editor?
*
* @param \IPS\Member $member The member
* @return bool|null NULL will cause the default value (based on the member's permissions) to be used, and is recommended in most cases. A boolean value will override that.
*/
public function canUseHtml( $member )
{
return NULL;
}
/**
* Can we use attachments in this editor?
*
* @param \IPS\Member $member The member
* @param \IPS\Helpers\Form\Editor $field The editor field
* @return bool|null NULL will cause the default value (based on the member's permissions) to be used, and is recommended in most cases. A boolean value will override that.
*/
public function canAttach( $member, $field )
{
return NULL;
}
/**
* Permission check for attachments
*
* @param \IPS\Member $member The member
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param array $attachment The attachment data
* @return bool
*/
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment )
{
$data = \IPS\Db::i()->select( '*', 'core_content_meta', array( "meta_id=? AND meta_type=?", $id1, $id3 ) )->first();
$item = $data['meta_class']::load( $data['meta_item_id'] );
if ( $item->container() )
{
if ( $item->container()->can( 'attachments', $member ) )
{
return $item->canView( $member );
}
}
else
{
return $item->canView( $member );
}
}
/**
* Attachment lookup
*
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @return \IPS\Http\Url|\IPS\Content|\IPS\Node\Model
* @throws \LogicException
*/
public function attachmentLookup( $id1, $id2, $id3 )
{
$data = \IPS\Db::i()->select( '*', 'core_content_meta', array( "meta_id=? AND meta_type=?", $id1, $id3 ) )->first();
return $data['meta_class']::load( $data['meta_item_id'] );
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Editor Extension: Mod CP
* @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 17 Jul 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\EditorLocations;
@@ -110,6 +109,27 @@ class _Modcp
return $this->performRebuild( $offset, $max, array( 'IPS\Text\Parser', 'rebuildAttachmentUrls' ) );
}
/**
* @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
*
@@ -133,7 +153,11 @@ class _Modcp
{
try
{
if( $callback[1] == 'rebuildAttachmentUrls' )
if( $callback == 'parseImageProxy' )
{
$update[ $k ] = \IPS\Text\Parser::parseImageProxy( $log[ $k ], $this->_imageProxyStatus );
}
elseif( $callback[1] == 'rebuildAttachmentUrls' )
{
$update[ $k ] = \IPS\Text\Parser::rebuildAttachmentUrls( $log[ $k ], \IPS\Member::load( $log['wl_moderator'] ) );
}
@@ -0,0 +1,63 @@
<?php
/**
* @brief Editor Extension: ProfileSteps
* @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 05 Apr 2017
*/
namespace IPS\core\extensions\core\EditorLocations;
/* 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;
}
/**
* Editor Extension: ProfileSteps
*/
class _ProfileSteps
{
/**
* Can we use HTML in this editor?
*
* @param \IPS\Member $member The member
* @return bool|null NULL will cause the default value (based on the member's permissions) to be used, and is recommended in most cases. A boolean value will override that.
*/
public function canUseHtml( $member )
{
return NULL;
}
/**
* Can we use attachments in this editor?
*
* @param \IPS\Member $member The member
* @param \IPS\Helpers\Form\Editor $field The editor field
* @return bool|null NULL will cause the default value (based on the member's permissions) to be used, and is recommended in most cases. A boolean value will override that.
*/
public function canAttach( $member, $field )
{
return FALSE;
}
/**
* Permission check for attachments
*
* @param \IPS\Member $member The member
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param array $attachment The attachment data
* @return bool
*/
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment )
{
return FALSE;
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Editor Extension: Reports
* @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 15 Jul 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\EditorLocations;
@@ -100,6 +99,27 @@ class _Reports
return $this->performRebuild( $offset, $max, array( 'IPS\Text\Parser', 'rebuildAttachmentUrls' ) );
}
/**
* @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
*
@@ -120,7 +140,11 @@ class _Reports
try
{
if( $callback[1] == 'rebuildAttachmentUrls' )
if( $callback == 'parseImageProxy' )
{
$update['report'] = \IPS\Text\Parser::parseImageProxy( $report['report'], $this->_imageProxyStatus );
}
elseif( $callback[1] == 'rebuildAttachmentUrls' )
{
$update['report'] = \IPS\Text\Parser::rebuildAttachmentUrls( $report['report'], \IPS\Member::load( $report['report_by'] ) );
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Editor Extension: Share Links
* @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 17 Jul 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\EditorLocations;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Editor Extension: Signatures
* @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 07 Jun 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\EditorLocations;
@@ -101,6 +100,27 @@ class _Signatures
return $this->performRebuild( $offset, $max, '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,6 +149,10 @@ class _Signatures
{
$rebuilt = \IPS\Text\LegacyParser::parseStatic( $member['signature'], \IPS\Member::load( $member['member_id'] ), FALSE, 'core_Signatures', $member['member_id'] );
}
elseif( $callback == 'parseImageProxy' )
{
$rebuilt = \IPS\Text\Parser::parseImageProxy( $member['signature'], $this->_imageProxyStatus );
}
}
catch( \InvalidArgumentException $e )
{
@@ -1,12 +1,11 @@
<?php
/**
* @brief Editor Extension: Staff directory
* @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 18 Sep 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\EditorLocations;
@@ -101,6 +100,27 @@ class _Staffdirectory
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
*
@@ -120,7 +140,14 @@ class _Staffdirectory
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,12 +1,11 @@
<?php
/**
* @brief Editor Media: Attachment
* @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 {date}
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\EditorMedia;
@@ -1,12 +1,11 @@
<?php
/**
* @brief File Storage Extension: Advertisements
* @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 23 Sep 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\FileStorage;
@@ -90,8 +89,6 @@ class _Advertisements
{
\IPS\Db::i()->update( 'core_advertisements', array( 'ad_images' => json_encode( $files ) ), array( 'ad_id=?', $advertisement['ad_id'] ) );
}
unset( \IPS\Data\Cache::i()->advertisements );
}
/**
@@ -131,7 +128,7 @@ class _Advertisements
/**
* 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,12 +1,11 @@
<?php
/**
* @brief File Storage Extension: Attachment
* @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 23 Sep 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\FileStorage;
@@ -72,7 +71,7 @@ class _Attachment
/**
* 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 )
@@ -0,0 +1,155 @@
<?php
/**
* @brief File Storage Extension: Clubs
* @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 01 Mar 2017
*/
namespace IPS\core\extensions\core\FileStorage;
/* 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;
}
/**
* File Storage Extension: Clubs
*/
class _Clubs
{
/**
* Count stored files
*
* @return int
*/
public function count()
{
return \IPS\Db::i()->select( 'COUNT(*)', 'core_clubs', 'profile_photo IS NOT NULL' )->first() + \IPS\Db::i()->select( 'COUNT(*)', 'core_clubs', 'cover_photo IS NOT NULL' )->first();
}
/**
* Move stored files
*
* @param int $offset This will be sent starting with 0, increasing to get all files stored by this extension
* @param int $storageConfiguration New storage configuration ID
* @param int|NULL $oldConfiguration Old storage configuration ID
* @throws \UnderflowException When file record doesn't exist. Indicating there are no more files to move
* @return void|int An offset integer to use on the next cycle, or nothing
*/
public function move( $offset, $storageConfiguration, $oldConfiguration=NULL )
{
$club = \IPS\Db::i()->select( '*', 'core_clubs', array( 'id > ?', $offset ), 'id', array( 0, 1 ) )->first();
try
{
$update = array();
foreach ( array( 'profile_photo', 'cover_photo' ) as $photoKey )
{
$file = \IPS\File::get( $oldConfiguration ?: 'core_Clubs', $club[ $photoKey ] )->move( $storageConfiguration );
if ( (string) $file != $club[ $photoKey ] )
{
$update[ $photoKey ] = (string) $file;
}
}
if ( count( $update ) )
{
\IPS\Db::i()->update( 'core_clubs', $update, array( 'id=?', $club['id'] ) );
}
}
catch( \Exception $e )
{
/* Any issues are logged and the \IPS\Db::i()->update not run as the exception is thrown */
}
return $club['id'];
}
/**
* Check if a file is valid
*
* @param string $file The file path to check
* @return bool
*/
public function isValidFile( $file )
{
try
{
$club = \IPS\Db::i()->select( '*', 'core_clubs', array( 'profile_photo=? OR cover_photo=?', (string) $file, (string) $file ) )->first();
return TRUE;
}
catch ( \UnderflowException $e )
{
return FALSE;
}
}
/**
* Delete all stored files
*
* @return void
*/
public function delete()
{
foreach( \IPS\Db::i()->select( '*', 'core_clubs', 'profile_photo IS NOT NULL or cover_photo IS NOT NULL' ) as $club )
{
foreach ( array( 'profile_photo', 'cover_photo' ) as $photoKey )
{
if ( $club[ $photoKey ] )
{
try
{
\IPS\File::get( 'core_Clubs', $club[ $photoKey ] )->delete();
}
catch( \Exception $e ){}
}
}
}
}
/**
* Fix all URLs
*
* @param int $offset This will be sent starting with 0, increasing to get all files stored by this extension
* @return void
*/
public function fixUrls( $offset )
{
$club = \IPS\Db::i()->select( '*', 'core_clubs', array( 'id > ?', $offset ), 'id', array( 0, 1 ) )->first();
try
{
$fixed = array();
foreach( array( 'profile_photo', 'cover_photo' ) as $photoKey )
{
if ( $club[ $photoKey ] )
{
if ( $new = \IPS\File::repairUrl( $club[ $photoKey ] ) )
{
$fixed[ $location ] = $new;
}
}
}
if ( count( $fixed ) )
{
\IPS\Db::i()->update( 'core_clubs', $fixed, array( 'id=?', $club['id'] ) );
}
}
catch( \Exception $e )
{
/* Any issues are logged and the \IPS\Db::i()->update not run as the exception is thrown */
}
return $club['id'];
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief File Storage Extension: Emoticons
* @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 23 Sep 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\FileStorage;
@@ -103,7 +102,7 @@ class _Emoticons
/**
* 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,12 +1,11 @@
<?php
/**
* @brief File Storage Extension: Image proxy cache
* @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 7 Nov 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\FileStorage;
@@ -64,7 +63,7 @@ class _Imageproxycache
/**
* 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,12 +1,11 @@
<?php
/**
* @brief File Storage Extension: Profile
* @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 23 Sep 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\FileStorage;
@@ -112,7 +111,7 @@ class _Profile
/**
* 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,12 +1,11 @@
<?php
/**
* @brief File Storage Extension: ProfileField
* @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 29 Aug 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\FileStorage;
@@ -109,7 +108,7 @@ class _ProfileField
/**
* 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 )
@@ -0,0 +1,135 @@
<?php
/**
* @brief File Storage Extension: Promote
* @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 10 Feb 2017
*/
namespace IPS\core\extensions\core\FileStorage;
/* 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;
}
/**
* File Storage Extension: Promote
*/
class _Promote
{
/**
* Count stored files
*
* @return int
*/
public function count()
{
return \IPS\Db::i()->select( 'MAX(promote_id)', 'core_social_promote', array( "promote_media != '[]'" ) )->first();
}
/**
* Move stored files
*
* @param int $offset This will be sent starting with 0, increasing to get all files stored by this extension
* @param int $storageConfiguration New storage configuration ID
* @param int|NULL $oldConfiguration Old storage configuration ID
* @throws \UnderflowException When file record doesn't exist. Indicating there are no more files to move
* @return void|int An offset integer to use on the next cycle, or nothing
*/
public function move( $offset, $storageConfiguration, $oldConfiguration=NULL )
{
$data = \IPS\Db::i()->select( '*', 'core_social_promote', array( "promote_media != '[]' and promote_id >?", $offset ), 'promote_id', array( 0, 1 ) )->first();
$update = array();
foreach( json_decode( $data['promote_media'], TRUE ) as $location )
{
if ( $location )
{
try
{
\IPS\File::get( $oldConfiguration ?: 'core_Profile', $location )->move( $storageConfiguration );
}
catch( \Exception $e )
{
/* Any issues are logged */
}
}
}
return $data['promote_id'];
}
/**
* Fix all URLs
*
* @param int $offset This will be sent starting with 0, increasing to get all files stored by this extension
* @return void
*/
public function fixUrls( $offset )
{
$data = \IPS\Db::i()->select( '*', 'core_social_promote', array( "promote_media!=?", '[]' ), 'promote_id', array( 0, 1 ) )->first();
$fixed = array();
foreach( json_decode( $data['promote_media'], TRUE ) as $location )
{
if ( $new = \IPS\File::repairUrl( $location ) )
{
$fixed[] = $location;
}
}
if ( count( $fixed ) )
{
\IPS\Db::i()->update( 'core_social_promote', array( 'promote_media' => json_encode( $fixed ), array( 'promote_id=?', $data['promote_id'] ) ) );
}
return $data['promote_id'];
}
/**
* Check if a file is valid
*
* @param string $file The file path to check
* @return bool
*/
public function isValidFile( $file )
{
foreach( \IPS\Db::i()->select( '*', 'core_social_promote', array( "promote_media!=?", '[]' ), 'promote_id' ) as $data )
{
foreach( json_decode( $data['promote_media'], TRUE ) as $location )
{
if ( (string) $file === $location )
{
return TRUE;
}
}
}
return FALSE;
}
/**
* Delete all stored files
*
* @return void
*/
public function delete()
{
foreach( \IPS\Db::i()->select( '*', 'core_social_promote', array( "promote_media!=?", '[]' ), 'promote_id' ) as $data )
{
foreach( json_decode( $data['promote_media'], TRUE ) as $location )
{
try
{
\IPS\File::get( 'core_Promote', $location )->delete();
}
catch( \Exception $e ){}
}
}
}
}
@@ -0,0 +1,83 @@
<?php
/**
* @brief File Storage Extension: Reaction
* @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 17 Feb 2017
*/
namespace IPS\core\extensions\core\FileStorage;
/* 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;
}
/**
* File Storage Extension: Reaction
*/
class _Reaction
{
/**
* Count stored files
*
* @return int
*/
public function count()
{
return \IPS\Db::i()->select( 'COUNT(*)', 'core_reactions' )->first();
}
/**
* Move stored files
*
* @param int $offset This will be sent starting with 0, increasing to get all files stored by this extension
* @param int $storageConfiguration New storage configuration ID
* @param int|NULL $oldConfiguration Old storage configuration ID
* @throws \UnderflowException When file record doesn't exist. Indicating there are no more files to move
* @return void|int An offset integer to use on the next cycle, or nothing
*/
public function move( $offset, $storageConfiguration, $oldConfiguration=NULL )
{
$reaction = \IPS\Db::i()->select( '*', 'core_reactions', array(), 'reaction_id', array( $offset, 1 ) )->first();
\IPS\File::get( $oldConfiguration ?: 'core_Reaction', $reaction['reaction_icon'] )->move( $storageConfiguration );
}
/**
* Check if a file is valid
*
* @param string $file The file path to check
* @return bool
*/
public function isValidFile( $file )
{
try
{
\IPS\Db::i()->select( '*', 'core_reactions', array( "reaction_icon=?", $file ) )->first();
return TRUE;
}
catch( \UunderflowException $e )
{
return FALSE;
}
}
/**
* Delete all stored files
*
* @return void
*/
public function delete()
{
foreach( \IPS\Db::i()->select( '*', 'core_reactions' ) AS $row )
{
\IPS\File::get( 'core_Reaction', $row['reaction_icon'] )->delete();
}
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief File Storage Extension: Theme
* @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 23 Sep 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\FileStorage;
@@ -46,7 +45,7 @@ class _Theme
*/
public function count()
{
return 3; // While this isn't the number of files, it's the number of steps this will take to move them, which is all it's used for
return 5; // While this isn't the number of files, it's the number of steps this will take to move them, which is all it's used for
}
/**
@@ -149,13 +148,58 @@ class _Theme
}
}
/* Trash JS */
\IPS\Output::clearJsFiles();
/* All done */
return TRUE;
case 4:
/* Move custom theme settings (uploads) */
$uploads = \IPS\Db::i()->select( 'core_theme_settings_values.sv_value, core_theme_settings_values.sv_id', 'core_theme_settings_fields', array( 'sc_type=?', 'Upload' ) )
->join( 'core_theme_settings_values', 'core_theme_settings_fields.sc_id=core_theme_settings_values.sv_id' );
foreach( $uploads as $field )
{
try
{
\IPS\Db::i()->update( 'core_theme_settings_values', array( 'sv_value' => \IPS\File::get( $oldConfiguration ?: 'core_Theme', $field['sv_value'] )->move( $storageConfiguration ) ), array( 'sv_id=?', $field['sv_id'] ) );
}
catch( \Exception $e )
{
/* Any issues are logged */
}
}
/* Trash old JS */
try
{
\IPS\File::getClass( $oldConfiguration ?: 'core_Theme' )->deleteContainer( 'javascript_global' );
} catch( \Exception $e ) { }
foreach( \IPS\Application::applications() as $key => $data )
{
try
{
\IPS\File::getClass( $oldConfiguration ?: 'core_Theme' )->deleteContainer( 'javascript_' . $key );
} catch( \Exception $e ) { }
}
/* Trash this JS */
\IPS\Output::clearJsFiles();
/* Trash CSS and images */
foreach( \IPS\Theme::themes() as $id => $theme )
{
/* Remove files, but don't fail if we can't */
try
{
\IPS\File::getClass( $oldConfiguration ?: 'core_Theme' )->deleteContainer( 'set_resources_' . $theme->id );
\IPS\File::getClass( $oldConfiguration ?: 'core_Theme' )->deleteContainer( 'css_built_' . $theme->id );
}
catch( \Exception $e ){}
}
/* Trash new CSS and images */
\IPS\Theme::clearFiles( \IPS\Theme::TEMPLATES + \IPS\Theme::CSS + \IPS\Theme::IMAGES );
/* All done */
throw new \UnderflowException;
default:
@@ -278,7 +322,7 @@ class _Theme
/**
* 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,12 +1,11 @@
<?php
/**
* @brief Front Navigation Extension: All Activity
* @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 30 Jun 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\FrontNavigation;
@@ -0,0 +1,98 @@
<?php
/**
* @brief Front Navigation Extension: Clubs
* @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 13 Feb 2017
*/
namespace IPS\core\extensions\core\FrontNavigation;
/* 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;
}
/**
* Front Navigation Extension: Clubs
*/
class _Clubs extends \IPS\core\FrontNavigation\FrontNavigationAbstract
{
/**
* Get Type Title which will display in the AdminCP Menu Manager
*
* @return string
*/
public static function typeTitle()
{
return \IPS\Member::loggedIn()->language()->addToStack('module__core_clubs');
}
/**
* Can this item be used at all?
* For example, if this will link to a particular feature which has been diabled, it should
* not be available, even if the user has permission
*
* @return bool
*/
public static function isEnabled()
{
return \IPS\Settings::i()->clubs;
}
/**
* Can the currently logged in user access the content this item links to?
*
* @return bool
*/
public function canAccessContent()
{
return \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'online' ) );
}
/**
* Get Title
*
* @return string
*/
public function title()
{
return \IPS\Member::loggedIn()->language()->addToStack('module__core_clubs');
}
/**
* Get Link
*
* @return \IPS\Http\Url
*/
public function link()
{
return \IPS\Http\Url::internal( 'app=core&module=clubs&controller=directory', 'front', 'clubs_list' );
}
/**
* Is Active?
*
* @return bool
*/
public function active()
{
return \IPS\core\FrontNavigation::$clubTabActive or ( \IPS\Dispatcher::i()->application->directory === 'core' and \IPS\Dispatcher::i()->module->key === 'clubs' );
}
/**
* Children
*
* @param bool $noStore If true, will skip datastore and get from DB (used for ACP preview)
* @return array
*/
public function children( $noStore=FALSE )
{
return NULL;
}
}
@@ -1,13 +1,12 @@
<?php
/**
* @brief Front Navigation Extension: Custom Item
* @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 Core
* @since 21 Jan 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\FrontNavigation;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Front Navigation Extension: Guidelines
* @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 30 Jun 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\FrontNavigation;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Front Navigation Extension: Leaderboard
* @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 8th Nov 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\FrontNavigation;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Front Navigation Extension: Dropdown Menu
* @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 Core
* @since 30 Jun 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\FrontNavigation;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Front Navigation Extension: Menu Button
* @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 Core
* @since 22 Jul 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\FrontNavigation;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Front Navigation Extension: Menu Header
* @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 Core
* @since 22 Jul 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\FrontNavigation;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Front Navigation Extension: Menu Separator
* @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 Core
* @since 22 Jul 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\FrontNavigation;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Front Navigation Extension: Online Users
* @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 30 Jun 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\FrontNavigation;
@@ -0,0 +1,74 @@
<?php
/**
* @brief Front Navigation Extension: Promoted Items
* @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 14th March 2016
*/
namespace IPS\core\extensions\core\FrontNavigation;
/* 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;
}
/**
* Front Navigation Extension: Promoted Items
*/
class _Promoted extends \IPS\core\FrontNavigation\FrontNavigationAbstract
{
/**
* Get Type Title which will display in the AdminCP Menu Manager
*
* @return string
*/
public static function typeTitle()
{
return \IPS\Member::loggedIn()->language()->addToStack('promoted_items_title');
}
/**
* Can the currently logged in user access the content this item links to?
*
* @return bool
*/
public function canAccessContent()
{
return \IPS\Settings::i()->promote_community_enabled;
}
/**
* Get Title
*
* @return string
*/
public function title()
{
return \IPS\Member::loggedIn()->language()->addToStack('promoted_items_title');
}
/**
* Get Link
*
* @return \IPS\Http\Url
*/
public function link()
{
return \IPS\Http\Url::internal( 'app=core&module=promote&controller=ourpicks', 'front', 'promote_show' );
}
/**
* Is Active?
*
* @return bool
*/
public function active()
{
return \IPS\Dispatcher::i()->application->directory === 'core' and \IPS\Dispatcher::i()->module->key === 'promote' and \IPS\Dispatcher::i()->controller === 'ourpicks';
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Front Navigation Extension: Search
* @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 30 Jun 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\FrontNavigation;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Front Navigation Extension: Staff Directory
* @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 30 Jun 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\FrontNavigation;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Front Navigation Extension: Your Activity Streams
* @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 30 Jun 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\FrontNavigation;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Front Navigation Extension: Custom Item
* @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 Core
* @since 21 Jan 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\FrontNavigation;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Group Form: Core: Content
* @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 25 Mar 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\GroupForm;
@@ -32,6 +31,15 @@ class _Content
*/
public function process( &$form, $group )
{
$contentClasses = array();
foreach ( \IPS\Application::allExtensions( 'core', 'ContentRouter', $group ) as $class )
{
foreach ( $class->classes as $class )
{
$contentClasses[ $class ] = $class::$title . '_pl';
}
}
/* Uploading */
if ( \IPS\Settings::i()->attach_allowed_types != 'none' )
{
@@ -42,7 +50,10 @@ class _Content
$form->add( new \IPS\Helpers\Form\Number( 'g_attach_max', $group->g_attach_max, FALSE, array( 'unlimited' => -1 ), NULL, NULL, \IPS\Member::loggedIn()->language()->addToStack( 'filesize_raw_k' ), 'g_attach_max' ) );
}
$form->add( new \IPS\Helpers\Form\Number( 'g_attach_per_post', $group->g_attach_per_post, FALSE, array( 'unlimited' => 0 ), NULL, NULL, \IPS\Member::loggedIn()->language()->addToStack( 'filesize_raw_k' ), 'g_attach_per_post' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'gbw_delete_attachments', $group->g_bitoptions['gbw_delete_attachments'], FALSE, array(), NULL, NULL, NULL, 'gbw_delete_attachments' ) );
if( $group->g_id != \IPS\Settings::i()->guest_group )
{
$form->add( new \IPS\Helpers\Form\YesNo( 'gbw_delete_attachments', $group->g_bitoptions['gbw_delete_attachments'], FALSE, array(), NULL, NULL, NULL, 'gbw_delete_attachments' ) );
}
}
/* Polls */
@@ -51,6 +62,7 @@ class _Content
$form->addHeader( 'polls' );
$form->add( new \IPS\Helpers\Form\YesNo( 'g_post_polls', $group->g_post_polls ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'g_vote_polls', $group->g_vote_polls ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'g_close_polls', $group->g_close_polls ) );
}
/* Viewing */
@@ -79,7 +91,10 @@ class _Content
if( $group->g_id != \IPS\Settings::i()->guest_group )
{
$form->addHeader( 'group_editing' );
$form->add( new \IPS\Helpers\Form\YesNo( 'g_edit_posts', $group->g_edit_posts, FALSE, array( 'togglesOn' => array( 'g_edit_cutoff', 'g_append_edit' ) ) ) );
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'g_edit_posts', !$group->g_edit_posts ? 0 : ( $group->g_edit_posts == '1' ? '1' : explode( ',', $group->g_edit_posts ) ), FALSE, array(
'options' => $contentClasses,
'unlimited' => '1'
) ) );
$form->add( new \IPS\Helpers\Form\Number( 'g_edit_cutoff', $group->g_edit_cutoff, FALSE, array( 'unlimited' => 0 ), NULL, \IPS\Member::loggedIn()->language()->addToStack('g_edit_cutoff_prefix'), \IPS\Member::loggedIn()->language()->addToStack('g_edit_cutoff_suffix'), 'g_edit_cutoff' ) );
if ( \IPS\Settings::i()->edit_log )
{
@@ -91,8 +106,16 @@ class _Content
if( $group->g_id != \IPS\Settings::i()->guest_group )
{
$form->addHeader( 'group_deleting' );
$form->add( new \IPS\Helpers\Form\YesNo( 'gbw_soft_delete_own', $group->g_id ? ( $group->g_bitoptions['gbw_soft_delete_own'] ) : FALSE ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'g_delete_own_posts', $group->g_delete_own_posts ) );
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'g_hide_own_posts', !$group->g_hide_own_posts ? 0 : ( $group->g_hide_own_posts == '1' ? '1' : explode( ',', $group->g_hide_own_posts ) ), FALSE, array(
'options' => array_filter( $contentClasses, function( $class ) {
return in_array( 'IPS\Content\Hideable', class_implements( $class ) );
}, ARRAY_FILTER_USE_KEY ),
'unlimited' => '1'
) ) );
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'g_delete_own_posts', !$group->g_delete_own_posts ? 0 : ( $group->g_delete_own_posts == '1' ? '1' : explode( ',', $group->g_delete_own_posts ) ), FALSE, array(
'options' => $contentClasses,
'unlimited' => '1'
) ) );
}
/* Content Limits */
@@ -111,10 +134,20 @@ class _Content
if( $group->g_id != \IPS\Settings::i()->guest_group )
{
$form->add( new \IPS\Helpers\Form\YesNo( 'gbw_lock_unlock_own', $group->g_bitoptions['gbw_lock_unlock_own'] ) );
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'g_lock_unlock_own', !$group->g_lock_unlock_own ? 0 : ( $group->g_lock_unlock_own == '1' ? '1' : explode( ',', $group->g_lock_unlock_own ) ), FALSE, array(
'options' => array_filter( $contentClasses, function( $class ) {
return in_array( 'IPS\Content\Lockable', class_implements( $class ) );
}, ARRAY_FILTER_USE_KEY ),
'unlimited' => '1'
) ) );
}
$form->add( new \IPS\Helpers\Form\YesNo( 'gbw_no_report', !$group->g_bitoptions['gbw_no_report'] ) );
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'g_can_report', !$group->g_can_report ? 0 : ( $group->g_can_report == '1' ? '1' : explode( ',', $group->g_can_report ) ), FALSE, array(
'options' => array_filter( $contentClasses, function( $class ) {
return in_array( 'IPS\Content\ReportCenter', class_implements( $class ) );
}, ARRAY_FILTER_USE_KEY ),
'unlimited' => '1'
) ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'g_avoid_flood', $group->g_avoid_flood ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'g_avoid_q', $group->g_avoid_q, FALSE, array( 'togglesOff' => array( 'g_mod_preview' ), 'toggleValue' => FALSE ) ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'g_mod_preview', $group->g_mod_preview, FALSE, array( 'togglesOn' => array( 'g_mod_post_unit' ) ), NULL, NULL, NULL, 'g_mod_preview' ) );
@@ -123,6 +156,13 @@ class _Content
return \IPS\Theme::i()->getTemplate( 'members' )->moderationLimits( $element->name, $element->value );
} ), NULL, NULL, NULL, 'g_mod_post_unit' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'g_bypass_badwords', $group->g_bypass_badwords ) );
/* Promotion */
if( $group->g_id != \IPS\Settings::i()->guest_group )
{
$form->addHeader( 'group_social_promotion' );
$form->add( new \IPS\Helpers\Form\YesNo( 'gbw_promote', $group->g_bitoptions['gbw_promote'] ) );
};
}
/**
@@ -147,6 +187,7 @@ class _Content
{
$group->g_post_polls = $values['g_post_polls'];
$group->g_vote_polls = $values['g_vote_polls'];
$group->g_close_polls = $values['g_close_polls'];
}
/* Ratings */
@@ -176,8 +217,9 @@ class _Content
/* Bitwise */
$values['gbw_disable_tagging'] = \IPS\Settings::i()->tags_enabled ? !$values['gbw_disable_tagging'] : $group->g_bitoptions['gbw_disable_tagging'];
$values['gbw_disable_prefixes'] = ( \IPS\Settings::i()->tags_enabled AND \IPS\Settings::i()->tags_can_prefix ) ? !$values['gbw_disable_prefixes'] : $group->g_bitoptions['gbw_disable_prefixes'];
$values['gbw_no_report'] = !$values['gbw_no_report'];
$bwKeys = array( 'gbw_disable_tagging', 'gbw_disable_prefixes', 'gbw_soft_delete_own', 'gbw_no_report', 'gbw_delete_attachments', 'gbw_post_highlight', 'gbw_lock_unlock_own' );
$bwKeys = array( 'gbw_disable_tagging', 'gbw_disable_prefixes', 'gbw_delete_attachments', 'gbw_post_highlight', 'gbw_promote' );
foreach ( $bwKeys as $k )
{
if ( isset( $values[ $k ] ) )
@@ -195,7 +237,7 @@ class _Content
{
$values['g_attach_max'] = -1;
}
$keys = array( 'g_attach_max', 'g_attach_per_post', 'g_edit_posts', 'g_edit_cutoff', 'g_append_edit', 'g_delete_own_posts', 'g_avoid_flood', 'g_avoid_q', 'g_mod_preview', 'g_bypass_badwords' );
$keys = array( 'g_attach_max', 'g_attach_per_post', 'g_edit_cutoff', 'g_append_edit', 'g_avoid_flood', 'g_avoid_q', 'g_mod_preview', 'g_bypass_badwords' );
foreach ( $keys as $k )
{
if ( isset( $values[ $k ] ) )
@@ -203,5 +245,19 @@ class _Content
$group->$k = $values[ $k ];
}
}
foreach ( array( 'g_edit_posts', 'g_hide_own_posts', 'g_delete_own_posts', 'g_lock_unlock_own', 'g_can_report' ) as $k )
{
if ( isset( $values[ $k ] ) )
{
if ( is_array( $values[ $k ] ) and count( $values[ $k ] ) )
{
$group->$k = implode( ',', $values[ $k ] );
}
else
{
$group->$k = intval( $values[ $k ] );
}
}
}
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Group Form: Core
* @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 25 Mar 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\GroupForm;
@@ -86,26 +85,10 @@ class _GroupSettings
}
) ) );
/* Promotion */
$form->add( new \IPS\Helpers\Form\Custom( 'group_promotion', array_merge( array( explode( '&', $group->g_promotion ?: '-1&-1' ) ), array( $group->g_promotion_type ) ), FALSE, array(
'getHtml' => function( $element )
{
return \IPS\Theme::i()->getTemplate( 'members' )->groupPromotion( $element->name, $element->value, \IPS\Member\Group::groups( TRUE, FALSE ) );
},
'formatValue' => function( $element )
{
$value = $element->value;
if ( !isset( $value[0][1] ) )
{
$value[0][1] = -1;
}
if ( !isset( $value[1] ) )
{
$value[1] = 0;
}
return $value;
}
), NULL, NULL, NULL, 'group_promotion' ) );
if ( $group->g_id != \IPS\Settings::i()->guest_group )
{
$form->add( new \IPS\Helpers\Form\YesNo( 'g_promote_exclude', $group->g_id ? !$group->g_promote_exclude : FALSE, FALSE ) );
}
/* Can access site? */
$form->addHeader( 'permissions' );
@@ -124,7 +107,17 @@ class _GroupSettings
/* Usernames */
if( $group->g_id != \IPS\Settings::i()->guest_group )
{
$form->add( new \IPS\Helpers\Form\Custom( 'group_username', array( $group->g_dname_changes, $group->g_displayname_unit, $group->g_bitoptions['gbw_displayname_unit_type'], $group->g_dname_date ?: 1, 'canchange' => (bool) $group->g_dname_changes ), FALSE, array(
$defaultValues = array(
$group->g_dname_changes,
$group->g_displayname_unit,
$group->g_bitoptions['gbw_displayname_unit_type'],
$group->g_dname_date ?: 1,
'canchange' => (bool) $group->g_dname_changes,
'unlimited' => ( $group->g_dname_changes == -1 AND !$group->g_dname_date ),
'always' => ( !$group->g_dname_changes AND !$group->g_bitoptions['gbw_displayname_unit_type'] ),
);
$form->add( new \IPS\Helpers\Form\Custom( 'group_username', $defaultValues, FALSE, array(
'getHtml' => function( $element )
{
return \IPS\Theme::i()->getTemplate( 'members' )->usernameChanges( $element->name, $element->value );
@@ -132,13 +125,13 @@ class _GroupSettings
'formatValue' => function( $element )
{
$value = $element->value;
if ( !isset( $value['canchange'] ) )
if ( !isset( $value['canchange'] ) OR !$value['canchange'] )
{
$value[0] = 0;
}
if ( isset( $value['unlimited'] ) )
if ( isset( $value['unlimited'] ) AND $value['unlimited'] )
{
$value[0] = -1;
$value[3] = 0;
@@ -148,12 +141,12 @@ class _GroupSettings
$value[0] = 0;
}
if ( isset( $value['always'] ) )
if ( isset( $value['always'] ) AND $value['always'] )
{
$value[1] = 0;
$value[2] = 0;
}
return $value;
}
), NULL, NULL, NULL, 'group_username' ) );
@@ -176,7 +169,11 @@ class _GroupSettings
}
$form->add( new \IPS\Helpers\Form\YesNo( 'gbw_hide_group', !$group->g_bitoptions['gbw_hide_group'], FALSE, array(), NULL, NULL, NULL, 'gbw_hide_group' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'can_be_ignored', $group->g_id ? ( !$group->g_bitoptions['gbw_cannot_be_ignored'] ) : TRUE, FALSE, array(), NULL, NULL, NULL, 'gbw_cannot_be_ignored' ) );
if ( \IPS\Settings::i()->ignore_system_on )
{
$form->add( new \IPS\Helpers\Form\YesNo( 'can_be_ignored', $group->g_id ? ( !$group->g_bitoptions['gbw_cannot_be_ignored'] ) : TRUE, FALSE, array(), NULL, NULL, NULL, 'gbw_cannot_be_ignored' ) );
}
/* Signatures */
if( \IPS\Settings::i()->signatures_enabled AND $group->g_id != \IPS\Settings::i()->guest_group )
@@ -231,25 +228,20 @@ class _GroupSettings
/* Prefix/Suffix */
$group->prefix = $values['g_prefixsuffix']['prefix'];
$group->suffix = $values['g_prefixsuffix']['suffix'];
/* Promotion */
if ( isset( $values['group_promotion'] ) )
/* Group promotion */
if ( isset( $values['g_promote_exclude'] ) )
{
$group->g_promotion = implode( '&', $values['group_promotion'][0] );
$group->g_promotion_type = $values['group_promotion'][1];
}
else
{
$group->g_promotion = '-1&-1';
$group->g_promote_exclude = !$values['g_promote_exclude'];
}
/* Username changes */
if( $group->g_id != \IPS\Settings::i()->guest_group )
{
$group->g_dname_changes = isset( $values['group_username']['canchange'] ) ? $values['group_username'][0] : 0;
$group->g_displayname_unit = isset( $values['group_username']['canchange'] ) ? (int) $values['group_username'][1] : 0;
$group->g_dname_changes = ( isset( $values['group_username']['canchange'] ) and $values['group_username']['canchange'] ) ? $values['group_username'][0] : 0;
$group->g_displayname_unit = ( isset( $values['group_username']['canchange'] ) ) ? (int) $values['group_username'][1] : 0;
$group->g_bitoptions['gbw_displayname_unit_type'] = $values['group_username'][2];
$group->g_dname_date = isset( $values['group_username']['canchange'] ) ? $values['group_username'][3] : 1;
$group->g_dname_date = ( isset( $values['group_username']['canchange'] ) ) ? $values['group_username'][3] : 1;
}
/* Signatures */
@@ -278,7 +270,7 @@ class _GroupSettings
/* Other */
$group->g_view_board = $values['g_view_board'];
$group->g_dohtml = $values['g_dohtml'];
$group->g_dohtml = isset( $values['g_dohtml'] ) ? $values['g_dohtml'] : FALSE;
if ( isset( $values['g_search_flood'] ) )
{
$group->g_search_flood = $values['g_search_flood'];
@@ -294,6 +286,9 @@ class _GroupSettings
}
$group->g_access_offline = $values['g_access_offline'];
$group->g_bitoptions['gbw_cannot_be_ignored'] = !$values['can_be_ignored'];
if ( isset( $values['can_be_ignored'] ) )
{
$group->g_bitoptions['gbw_cannot_be_ignored'] = !$values['can_be_ignored'];
}
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Group Form: Core: Social
* @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 25 Mar 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\GroupForm;
@@ -32,18 +31,18 @@ class _Social
*/
public function process( &$form, $group )
{
if( $group->g_id != \IPS\Settings::i()->guest_group )
/* Profiles */
if ( $group->canAccessModule( \IPS\Application\Module::get( 'core', 'members', 'front' ) ) )
{
/* Profiles */
if ( $group->canAccessModule( \IPS\Application\Module::get( 'core', 'members', 'front' ) ) )
$form->addHeader( 'group_profiles' );
if ( $group->g_id != \IPS\Settings::i()->guest_group )
{
$form->addHeader( 'group_profiles' );
$form->add( new \IPS\Helpers\Form\YesNo( 'g_edit_profile', $group->g_id ? $group->g_edit_profile : 1, FALSE, array( 'togglesOn' => array( 'gbw_allow_upload_bgimage', 'g_photo_max_vars_size', 'g_photo_max_vars_wh', 'g_upload_animated_photos' ) ) ) );
$photos = ( $group->g_id ? explode( ':', $group->g_photo_max_vars ) : array( 50, 150, 150 ) );
$form->add( new \IPS\Helpers\Form\Number( 'g_photo_max_vars_size', $photos[0], FALSE, array( 'unlimited' => 0, 'unlimitedLang' => 'g_photo_max_vars_none', 'unlimitedToggleOn' => FALSE, 'unlimitedToggles' => array( 'g_photo_max_vars_wh', 'g_upload_animated_photos' ) ), NULL, NULL, 'kB', 'g_photo_max_vars_size' ) );
$form->add( new \IPS\Helpers\Form\Number( 'g_photo_max_vars_wh', $photos[1], FALSE, array(), NULL, NULL, 'px', 'g_photo_max_vars_wh' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'g_upload_animated_photos', $group->g_id ? $group->g_upload_animated_photos : TRUE, FALSE, array(), NULL, NULL, NULL, 'g_upload_animated_photos' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'gbw_allow_upload_bgimage', $group->g_id ? ( $group->g_bitoptions['gbw_allow_upload_bgimage'] ) : TRUE, FALSE, array( 'togglesOn' => array( 'g_max_bgimg_upload' ) ), NULL, NULL, NULL, 'gbw_allow_upload_bgimage' ) );
$form->add( new \IPS\Helpers\Form\Number( 'g_max_bgimg_upload', $group->g_id ? $group->g_max_bgimg_upload : -1, FALSE, array( 'unlimited' => -1 ), function( $value ) {
if( !$value )
@@ -51,23 +50,48 @@ class _Social
throw new \InvalidArgumentException('form_required');
}
}, NULL, 'kB', 'g_max_bgimg_upload' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'g_view_displaynamehistory' , $group->g_view_displaynamehistory, FALSE ) );
}
/* Personal Conversations */
if ( $group->canAccessModule( \IPS\Application\Module::get( 'core', 'messaging', 'front' ) ) )
$form->add( new \IPS\Helpers\Form\YesNo( 'g_view_displaynamehistory' , $group->g_view_displaynamehistory, FALSE ) );
}
/* Personal Conversations */
if ( $group->g_id != \IPS\Settings::i()->guest_group and $group->canAccessModule( \IPS\Application\Module::get( 'core', 'messaging', 'front' ) ) )
{
$form->addHeader( 'personal_conversations' );
$form->add( new \IPS\Helpers\Form\Number( 'g_pm_perday', $group->g_pm_perday, FALSE, array( 'unlimited' => -1, 'min' => 0 ), NULL, NULL, NULL, 'g_pm_perday' ) );
$form->add( new \IPS\Helpers\Form\Number( 'g_pm_flood_mins', $group->g_pm_flood_mins, FALSE, array( 'unlimited' => -1, 'min' => 0 ), NULL, NULL, NULL, 'g_pm_flood_mins' ) );
$form->add( new \IPS\Helpers\Form\Number( 'g_max_mass_pm', $group->g_max_mass_pm, FALSE, array( 'unlimited' => -1, 'max' => 500, 'min' => 0 ), NULL, NULL, NULL, 'g_max_mass_pm' ) );
$form->add( new \IPS\Helpers\Form\Number( 'g_max_messages', $group->g_max_messages, FALSE, array( 'unlimited' => -1, 'min' => 0 ), NULL, NULL, NULL, 'g_max_messages' ) );
if ( \IPS\Settings::i()->attach_allowed_types != 'none' )
{
$form->addHeader( 'personal_conversations' );
$form->add( new \IPS\Helpers\Form\Number( 'g_pm_perday', $group->g_pm_perday, FALSE, array( 'unlimited' => -1, 'min' => 0 ), NULL, NULL, NULL, 'g_pm_perday' ) );
$form->add( new \IPS\Helpers\Form\Number( 'g_pm_flood_mins', $group->g_pm_flood_mins, FALSE, array( 'unlimited' => -1, 'min' => 0 ), NULL, NULL, NULL, 'g_pm_flood_mins' ) );
$form->add( new \IPS\Helpers\Form\Number( 'g_max_mass_pm', $group->g_max_mass_pm, FALSE, array( 'unlimited' => -1, 'max' => 500, 'min' => 0 ), NULL, NULL, NULL, 'g_max_mass_pm' ) );
$form->add( new \IPS\Helpers\Form\Number( 'g_max_messages', $group->g_max_messages, FALSE, array( 'unlimited' => -1, 'min' => 0 ), NULL, NULL, NULL, 'g_max_messages' ) );
if ( \IPS\Settings::i()->attach_allowed_types != 'none' )
{
$form->add( new \IPS\Helpers\Form\YesNo( 'g_can_msg_attach', $group->g_can_msg_attach, FALSE, array(), NULL, NULL, NULL, 'g_can_msg_attach' ) );
}
$form->add( new \IPS\Helpers\Form\YesNo( 'gbw_pm_override_inbox_full', $group->g_id ? ( $group->g_bitoptions['gbw_pm_override_inbox_full'] ) : TRUE ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'g_can_msg_attach', $group->g_can_msg_attach, FALSE, array(), NULL, NULL, NULL, 'g_can_msg_attach' ) );
}
$form->add( new \IPS\Helpers\Form\YesNo( 'gbw_pm_override_inbox_full', $group->g_id ? ( $group->g_bitoptions['gbw_pm_override_inbox_full'] ) : TRUE ) );
}
/* Column does not have a default value, so for a new group we have to explicitly set something */
$group->g_club_allowed_nodes = $group->g_club_allowed_nodes ?: '';
/* Clubs */
if ( \IPS\Settings::i()->clubs and $group->g_id != \IPS\Settings::i()->guest_group and $group->canAccessModule( \IPS\Application\Module::get( 'core', 'clubs', 'front' ) ) )
{
$form->addHeader( 'module__core_clubs' );
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'g_create_clubs', explode( ',', $group->g_create_clubs ), FALSE, array(
'options' => array(
\IPS\Member\Club::TYPE_PUBLIC => 'club_type_public',
\IPS\Member\Club::TYPE_OPEN => 'club_type_open',
\IPS\Member\Club::TYPE_CLOSED => 'club_type_closed',
\IPS\Member\Club::TYPE_PRIVATE => 'club_type_private',
),
), NULL, NULL, NULL, 'g_create_clubs' ) );
$availableClubNodes = array();
foreach ( \IPS\Member\Club::availableNodeTypes() as $class )
{
$availableClubNodes[ $class ] = $class::clubAcpTitle();
}
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'g_club_allowed_nodes', $group->g_club_allowed_nodes == '*' ? array_keys( $availableClubNodes ) : explode( ',', $group->g_club_allowed_nodes ), FALSE, array( 'options' => $availableClubNodes ), NULL, NULL, NULL, 'g_club_allowed_nodes' ) );
}
/* Reputation */
@@ -77,14 +101,7 @@ class _Social
if( $group->g_id != \IPS\Settings::i()->guest_group )
{
if ( in_array( \IPS\Settings::i()->reputation_point_types, array( 'like', 'both', 'positive' ) ) )
{
$form->add( new \IPS\Helpers\Form\Number( 'g_rep_max_positive', $group->g_rep_max_positive, FALSE, array( 'unlimited' => 999, ), NULL, NULL, \IPS\Member::loggedIn()->language()->addToStack('points_per_day') ) );
}
if ( in_array( \IPS\Settings::i()->reputation_point_types , array( 'both', 'negative' ) ) )
{
$form->add( new \IPS\Helpers\Form\Number( 'g_rep_max_negative', $group->g_rep_max_negative, FALSE, array( 'unlimited' => 999, ), NULL, NULL, \IPS\Member::loggedIn()->language()->addToStack('points_per_day') ) );
}
$form->add( new \IPS\Helpers\Form\Number( 'g_rep_max_positive', $group->g_rep_max_positive, FALSE, array( 'unlimited' => -1, ), NULL, NULL, \IPS\Member::loggedIn()->language()->addToStack('per_day') ) );
}
$form->add( new \IPS\Helpers\Form\YesNo( 'gbw_view_reps', $group->g_id ? ( $group->g_bitoptions['gbw_view_reps'] ) : TRUE ) );
@@ -132,7 +149,7 @@ class _Social
/* Photos */
$group->g_photo_max_vars = implode( ':', array( $values['g_photo_max_vars_size'], $values['g_photo_max_vars_wh'], $values['g_photo_max_vars_wh'] ) );
}
/* Status updates */
if ( $group->canAccessModule( \IPS\Application\Module::load( 'members', 'sys_module_key', array( 'sys_module_application=? AND sys_module_area=?', 'core', 'front' ) ) ) )
{
@@ -153,6 +170,13 @@ class _Social
$bwKeys[] = 'gbw_pm_override_inbox_full';
$keys = array_merge( $keys, array( 'g_pm_perday', 'g_pm_flood_mins', 'g_max_mass_pm', 'g_max_messages', 'g_can_msg_attach', 'g_max_notifications' ) );
}
/* Clubs */
if ( \IPS\Settings::i()->clubs and $group->canAccessModule( \IPS\Application\Module::get( 'core', 'clubs', 'front' ) ) )
{
$group->g_create_clubs = implode( ',', $values['g_create_clubs'] );
$group->g_club_allowed_nodes = ( count( $values['g_club_allowed_nodes'] ) === count( \IPS\Member\Club::availableNodeTypes() ) ) ? '*' : implode( ',', $values['g_club_allowed_nodes'] );
}
}
/* Reputation */
@@ -162,22 +186,7 @@ class _Social
if( $group->g_id != \IPS\Settings::i()->guest_group )
{
switch ( \IPS\Settings::i()->reputation_point_types )
{
case 'like':
case 'positive':
$keys[] = 'g_rep_max_positive';
break;
case 'both':
$keys[] = 'g_rep_max_positive';
$keys[] = 'g_rep_max_negative';
break;
case 'negative':
$keys[] = 'g_rep_max_negative';
break;
}
$keys[] = 'g_rep_max_positive';
}
}
@@ -1,12 +1,11 @@
<?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
* @since 07 Nov 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\GroupLimits;
@@ -33,222 +32,325 @@ class _GroupLimits
*/
public function getLimits()
{
return array (
'exclude' => array( 'g_id', 'g_icon', 'prefix', 'suffix', 'g_promotion', 'g_bitoptions' ),
'lessIsMore' => array( 'g_search_flood', 'g_pm_flood_mins' ),
'neg1IsBest' => array( 'g_attach_max', 'g_max_bgimg_upload', 'g_max_messages', 'g_pm_perday', 'g_pm_flood_mins', 'g_max_mass_pm' ),
'zeroIsBest' => array( 'g_edit_cutoff', 'g_displayname_unit', 'g_sig_unit', 'g_mod_preview', 'g_ppd_limit', 'g_ppd_unit', 'gbw_no_status_update', 'g_max_bgimg_upload', 'gbw_disable_prefixes', 'gbw_disable_tagging', 'g_attach_per_post' ),
'callback' => array(
'g_signature_limits' => function( $a, $b, $k )
{
/* No limits should win out */
if( !$a[ $k ] )
{
return null;
}
/* We have limits */
if( $b[ $k ] )
{
$values = explode( ':', $b[ $k ] );
$_cur = explode( ':', $a[ $k ] );
$_new = array();
return array(
'exclude' => array( 'g_id', 'g_icon', 'prefix', 'suffix', 'g_promotion', 'g_bitoptions' ),
'lessIsMore' => array( 'g_search_flood', 'g_pm_flood_mins' ),
'neg1IsBest' => array( 'g_attach_max', 'g_max_bgimg_upload', 'g_max_messages', 'g_pm_perday', 'g_pm_flood_mins', 'g_max_mass_pm', 'g_rep_max_positive' ),
'zeroIsBest' => array( 'g_edit_cutoff', 'g_displayname_unit', 'g_sig_unit', 'g_mod_preview', 'g_ppd_limit', 'g_ppd_unit', 'gbw_no_status_update', 'g_max_bgimg_upload', 'gbw_disable_prefixes', 'gbw_disable_tagging', 'g_attach_per_post' ),
'callback' => array(
'g_signature_limits' => array( $this, '_signatureLimits' ),
'g_photo_max_vars' => array( $this, '_photoVars' ),
'g_dname_date' => array( $this, '_displayNameDate' ),
'g_dname_changes' => array( $this, '_displayNameChanges' ),
'gbw_mod_post_unit_type' => array( $this, '_modPostUnitType' ),
'g_mod_post_unit' => array( $this, '_modPostUnit' ),
'g_edit_posts' => array( $this, '_perAppSettings' ),
'g_hide_own_posts' => array( $this, '_perAppSettings' ),
'g_delete_own_posts' => array( $this, '_perAppSettings' ),
'g_lock_unlock_own' => array( $this, '_perAppSettings' ),
'g_can_report' => array( $this, '_perAppSettings' ),
)
);
}
/**
* Per-App Settings
*
* @param array $a Group A's values
* @param array $b Group B's values
* @param string $k The key we want to get the combined value for
* @param array $member Member data
* @return mixed
*/
public function _perAppSettings( $a, $b, $k, $member )
{
if ( $a[ $k ] == 1 or $b[ $k ] == 1 )
{
return 1;
}
if ( $a[ $k ] and $b[ $k ] )
{
return implode( ',', array_unique( array_merge( explode( ',', $a[ $k ] ), explode( ',', $b[ $k ] ) ) ) );
}
elseif ( $a[ $k ] )
{
return $a[ $k ];
}
elseif ( $b[ $k ] )
{
return $b[ $k ];
}
return 0;
}
/**
* Signature Limits
*
* @param array $a Group A's values
* @param array $b Group B's values
* @param string $k The key we want to get the combined value for
* @param array $member Member data
* @return mixed
*/
public function _signatureLimits( $a, $b, $k, $member )
{
/* No limits should win out */
if( !$a[ $k ] )
{
return null;
}
/* We have limits */
if( $b[ $k ] )
{
$values = explode( ':', $b[ $k ] );
$_cur = explode( ':', $a[ $k ] );
$_new = array();
/* If the group can't use signatures, ignore any limits saved for the group */
if( $_cur[0] )
{
return $b[ $k ];
}
/* If the group can't use signatures, ignore any limits saved for the group */
if( $_cur[0] )
{
return $b[ $k ];
}
if( $values[0] )
{
return $a[ $k ];
}
if( $values[0] )
{
return $a[ $k ];
}
foreach( $values as $index => $value )
{
if( $_cur[ $index ] == "" or $values[ $index ] == "" )
{
$_new[ $index ] = NULL;
}
/* If signatures are currently disabled but aren't in the group we are checking, signatures should not be disabled (1=disabled, 0=enabled) */
elseif ( $index == 0 and $_cur[ $index ] > $values[ $index ] )
{
$_new[ $index ] = $values[ $index ];
}
/* If signatures are currently enabled but aren't in the group we are checking, signatures should not be disabled */
elseif ( $index == 0 and $_cur[ $index ] < $values[ $index ] )
{
foreach( $values as $index => $value )
{
if( $_cur[ $index ] == "" or $values[ $index ] == "" )
{
$_new[ $index ] = NULL;
}
/* If signatures are currently disabled but aren't in the group we are checking, signatures should not be disabled (1=disabled, 0=enabled) */
elseif ( $index == 0 and $_cur[ $index ] > $values[ $index ] )
{
$_new[ $index ] = $values[ $index ];
}
/* If signatures are currently enabled but aren't in the group we are checking, signatures should not be disabled */
elseif ( $index == 0 and $_cur[ $index ] < $values[ $index ] )
{
$_new[ $index ] = $_cur[ $index ];
}
else if( $_cur[ $index ] > $values[ $index ] )
{
$_new[ $index ] = $_cur[ $index ];
}
else
{
$_new[ $index ] = $values[ $index ];
}
}
ksort($_new);
return implode( ':', $_new );
}
else
{
/* Set no limits */
return NULL;
}
},
'g_photo_max_vars' => function ( $a, $b, $k )
{
/* No limits should win out */
if( !$a[ $k ] )
{
return NULL;
}
/* We have limits */
if( $b[ $k ] )
{
$values = explode( ':', $b[ $k ] );
$_cur = explode( ':', $a[ $k ] );
$_new = array();
foreach( $values as $index => $value )
{
if( !$_cur[ $index ] or !$values[ $index ] )
{
$_new[ $index ] = NULL;
}
else if( $_cur[ $index ] > $values[ $index ] )
{
$_new[ $index ] = $_cur[ $index ];
}
else
{
$_new[ $index ] = $values[ $index ];
}
}
ksort($_new);
return implode( ':', $_new );
}
else
{
/* Set no limits */
return NULL;
}
},
'g_dname_date' => function( $a )
{
/* This is handled by g_dname_changes below */
return $a['g_dname_date'];
},
'g_dname_changes' => function( $a, $b, $k )
{
$changes = $b[ $k ];
$timeFrame = $a['g_dname_date'];
$_new[ $index ] = $_cur[ $index ];
}
else if( $_cur[ $index ] > $values[ $index ] )
{
$_new[ $index ] = $_cur[ $index ];
}
else
{
$_new[ $index ] = $values[ $index ];
}
}
ksort($_new);
return implode( ':', $_new );
}
else
{
/* Set no limits */
return NULL;
}
}
/**
* Photo Settings
*
* @param array $a Group A's values
* @param array $b Group B's values
* @param string $k The key we want to get the combined value for
* @param array $member Member data
* @return mixed
*/
public function _photoVars( $a, $b, $k, $member )
{
/* No limits should win out */
if( !$a[ $k ] )
{
return NULL;
}
/* We have limits */
if( $b[ $k ] )
{
$values = explode( ':', $b[ $k ] );
$_cur = explode( ':', $a[ $k ] );
$_new = array();
foreach( $values as $index => $value )
{
if( !$_cur[ $index ] or !$values[ $index ] )
{
$_new[ $index ] = NULL;
}
else if( $_cur[ $index ] > $values[ $index ] )
{
$_new[ $index ] = $_cur[ $index ];
}
else
{
$_new[ $index ] = $values[ $index ];
}
}
ksort($_new);
return implode( ':', $_new );
}
else
{
/* Set no limits */
return NULL;
}
}
/**
* Display Name Date
*
* @param array $a Group A's values
* @param array $b Group B's values
* @param string $k The key we want to get the combined value for
* @param array $member Member data
* @return mixed
*/
public function _displayNameDate( $a, $b, $k, $member )
{
/* This is handled by g_dname_changes below */
return $a['g_dname_date'];
}
/**
* Display Name Changes
*
* @param array $a Group A's values
* @param array $b Group B's values
* @param string $k The key we want to get the combined value for
* @param array $member Member data
* @return mixed
*/
public function _displayNameChanges( $a, $b, $k, $member )
{
$changes = $b[ $k ];
$timeFrame = $a['g_dname_date'];
if( $changes == -1 OR $a[ $k ] == -1 )
{
return array(
'g_dname_date' => 0,
'g_dname_changes' => -1
);
}
if( $changes == -1 OR $a[ $k ] == -1 )
{
return array(
'g_dname_date' => 0,
'g_dname_changes' => -1
);
}
/* No time frame restriction */
if( !$timeFrame )
{
/* This group allows more changes */
if( $changes > $a[ $k ] )
{
return array(
'g_dname_date' => 0,
'g_dname_changes' => $changes
);
}
/* Existing data is date restricted */
else if( $a['g_dname_date'] )
{
if( $a[ $k ] )
{
$_compare = round( $a['g_dname_date'] / $a[ $k ] );
if( $_compare > $changes )
{
return array(
'g_dname_date' => 0,
'g_dname_changes' => $changes
);
}
}
}
}
/* Time frame restriction */
else if( $changes )
{
$_compare = round( $timeFrame / $changes );
/* Existing has no time frame restriction */
if( !$a['g_dname_date'] AND $a[ $k ] )
{
if( $_compare < $a[ $k ] )
{
return array(
'g_dname_date' => $timeFrame,
'g_dname_changes' => $changes
);
}
}
else if( !$a['g_dname_date'] )
{
return array(
'g_dname_date' => $timeFrame,
'g_dname_changes' => $changes
);
}
else if( $a['g_dname_date'] AND $a[ $k ] )
{
$_oldCompare = $a['g_dname_date'] / $a[ $k ];
if( $_compare < $_oldCompare )
{
return array(
'g_dname_date' => $timeFrame,
'g_dname_changes' => $changes
);
}
}
}
},
'gbw_mod_post_unit_type' => function( $a )
{
/* This is handled by g_mod_post_unit below */
return $a['gbw_mod_post_unit_type'];
},
'g_mod_post_unit' => function( $a, $b, $k, $member )
{
/* Have we met the current requirements? */
if ( ( !$a['gbw_mod_post_unit_type'] and $a['g_mod_post_unit'] >= $member['member_posts'] ) or ( $a['gbw_mod_post_unit_type'] and time() >= ( $member['joined'] + ( $a['g_mod_post_unit'] * 3600 ) ) ) )
{
/* Yes - so let's stick with this */
return $a['g_mod_post_unit'];
}
else
{
/* No - go with the new group */
return array(
'g_mod_post_unit' => $b[ $k ],
'gbw_mod_post_unit_type' => $b['gbw_mod_post_unit_type']
);
}
}
)
/* No time frame restriction */
if( !$timeFrame )
{
/* This group allows more changes */
if( $changes > $a[ $k ] )
{
return array(
'g_dname_date' => 0,
'g_dname_changes' => $changes
);
}
/* Existing data is date restricted */
else if( $a['g_dname_date'] )
{
if( $a[ $k ] )
{
$_compare = round( $a['g_dname_date'] / $a[ $k ] );
if( $_compare > $changes )
{
return array(
'g_dname_date' => 0,
'g_dname_changes' => $changes
);
}
}
}
}
/* Time frame restriction */
else if( $changes )
{
$_compare = round( $timeFrame / $changes );
/* Existing has no time frame restriction */
if( !$a['g_dname_date'] AND $a[ $k ] )
{
if( $_compare < $a[ $k ] )
{
return array(
'g_dname_date' => $timeFrame,
'g_dname_changes' => $changes
);
}
}
else if( !$a['g_dname_date'] )
{
return array(
'g_dname_date' => $timeFrame,
'g_dname_changes' => $changes
);
}
else if( $a['g_dname_date'] AND $a[ $k ] )
{
$_oldCompare = $a['g_dname_date'] / $a[ $k ];
if( $_compare < $_oldCompare )
{
return array(
'g_dname_date' => $timeFrame,
'g_dname_changes' => $changes
);
}
}
}
}
/**
* gbw_mod_post_unit_type
*
* @param array $a Group A's values
* @param array $b Group B's values
* @param string $k The key we want to get the combined value for
* @param array $member Member data
* @return mixed
*/
public function _modPostUnitType( $a, $b, $k, $member )
{
/* This is handled by g_mod_post_unit below */
return $a['gbw_mod_post_unit_type'];
}
/**
* g_mod_post_unit
*
* @param array $a Group A's values
* @param array $b Group B's values
* @param string $k The key we want to get the combined value for
* @param array $member Member data
* @return mixed
*/
public function _modPostUnit( $a, $b, $k, $member )
{
/* Have we met the current requirements? */
if ( ( !$a['gbw_mod_post_unit_type'] and $a['g_mod_post_unit'] >= $member['member_posts'] ) or ( $a['gbw_mod_post_unit_type'] and time() >= ( $member['joined'] + ( $a['g_mod_post_unit'] * 3600 ) ) ) )
{
/* Yes - so let's stick with this */
return $a['g_mod_post_unit'];
}
else
{
/* No - go with the new group */
return array(
'g_mod_post_unit' => $b[ $k ],
'gbw_mod_post_unit_type' => $b['gbw_mod_post_unit_type']
);
}
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief IP Address Lookup: Admin Login Logs
* @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 Oct 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\IpAddresses;
@@ -1,12 +1,11 @@
<?php
/**
* @brief IP Address Lookup: Admin Logs
* @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 Oct 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\IpAddresses;
@@ -1,12 +1,11 @@
<?php
/**
* @brief IP Address Lookup: Content Classes
* @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 26 Dec 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\IpAddresses;
@@ -1,12 +1,11 @@
<?php
/**
* @brief IP Address Lookup: Display name changes
* @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 12 Oct 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\IpAddresses;
@@ -31,7 +30,7 @@ class _Dnames
*/
public function supportedInAcp()
{
return TRUE;
return FALSE;
}
/**
@@ -57,36 +56,24 @@ class _Dnames
/* Return count */
if ( $baseUrl === NULL )
{
return \IPS\Db::i()->select( 'COUNT(*)', 'core_dnames_change', array( "dname_ip_address LIKE ?", $ip ) )->first();
return \IPS\Db::i()->select( 'COUNT(*)', 'core_member_history', array( "log_type=? AND log_ip_address LIKE ?", 'display_name', $ip ) )->first();
}
/* Init Table */
$table = new \IPS\Helpers\Table\Db( 'core_dnames_change', $baseUrl, array( "dname_ip_address LIKE ?", $ip ) );
$table = new \IPS\Member\History( $baseUrl, array( array( 'log_app=? AND log_type=? AND log_ip_address LIKE ?', 'core', 'display_name', $ip ) ) );
/* Columns we need */
$table->include = array( 'dname_member_id', 'dname_previous', 'dname_current', 'dname_date', 'dname_ip_address' );
$table->mainColumn = 'dname_date';
$table->include = array( 'log_member', 'log_data', 'log_date', 'log_ip_address' );
$table->mainColumn = 'log_date';
$table->tableTemplate = array( \IPS\Theme::i()->getTemplate( 'tables', 'core', 'admin' ), 'table' );
$table->rowsTemplate = array( \IPS\Theme::i()->getTemplate( 'tables', 'core', 'admin' ), 'rows' );
$table->filters = NULL;
/* Default sort options */
$table->sortBy = $table->sortBy ?: 'dname_date';
$table->sortBy = $table->sortBy ?: 'log_date';
$table->sortDirection = $table->sortDirection ?: 'desc';
/* Custom parsers */
$table->parsers = array(
'dname_member_id' => function( $val, $row )
{
$member = \IPS\Member::load( $val );
return \IPS\Theme::i()->getTemplate( 'global', 'core' )->userPhoto( $member, 'tiny' ) . ' ' . $member->link();
},
'dname_date' => function( $val, $row )
{
return \IPS\DateTime::ts( $val );
},
);
/* Return */
return (string) $table;
}
@@ -110,6 +97,6 @@ class _Dnames
*/
public function findByMember( $member )
{
return \IPS\Db::i()->select( "dname_ip_address AS ip, COUNT(*) AS count, MIN(dname_date) AS first, MAX(dname_date) AS last", 'core_dnames_change', array( 'dname_member_id=?', $member->member_id ), NULL, NULL, 'dname_ip_address' )->setKeyField( 'ip' );
return \IPS\Db::i()->select( "log_ip_address AS ip, COUNT(*) AS count, MIN(log_date) AS first, MAX(log_date) AS last", 'core_member_history', array( 'log_type=? AND log_member=?', 'display_name', $member->member_id ), NULL, NULL, 'log_ip_address' )->setKeyField( 'ip' );
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief IP Address Lookup: Error Logs
* @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 12 Oct 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\IpAddresses;
@@ -0,0 +1,126 @@
<?php
/**
* @brief IP Address Lookup: Logins
* @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 23 Feb 2017
*/
namespace IPS\core\extensions\core\IpAddresses;
/* 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;
}
/**
* IP Address Lookup: Logins
*/
class _Logins
{
/**
* 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 FALSE;
}
/**
* Find Records by IP
*
* @param string $ip The IP Address
* @param \IPS\Http\Url $baseUrl URL table will be displayed on or NULL to return a count
* @return \IPS\Helpers\Table|int|null
*/
public function findByIp( $ip, \IPS\Http\Url $baseUrl = NULL )
{
/* Return count */
if ( $baseUrl === NULL )
{
return \IPS\Db::i()->select( 'COUNT(*)', 'core_members_known_ip_addresses', array( "ip_address LIKE ?", $ip ) )->first();
}
/* Init Table */
$table = new \IPS\Helpers\Table\Db( 'core_members_known_ip_addresses', $baseUrl, array( array( 'ip_address LIKE ?', $ip ) ) );
$table->joins[] = array( 'select' => 'user_agent', 'from' => 'core_members_known_devices', 'where' => 'core_members_known_devices.device_key=core_members_known_ip_addresses.device_key' );
$table->langPrefix = 'device_table_';
$table->include = array( 'user_agent', 'member_id', 'login_handler', 'last_seen' );
$table->sortBy = $table->sortBy ?: 'last_seen';
$table->parsers = array(
'user_agent' => function( $val, $row ) {
return (string) \IPS\Http\UserAgent::parse( $val );
},
'member_id' => function( $val ) {
$member = \IPS\Member::load( $val );
if ( $member->member_id )
{
return \IPS\Theme::i()->getTemplate( 'global', 'core' )->userPhoto( $member, 'tiny' ) . \IPS\Theme::i()->getTemplate( 'global', 'core' )->userLink( $member, 'tiny' );
}
else
{
return \IPS\Member::loggedIn()->language()->addToStack('deleted_member');
}
},
'login_handler' => function( $val, $row ) {
return \IPS\Theme::i()->getTemplate('members')->deviceHandler( $val );
},
'last_seen' => function( $val ) {
return \IPS\DateTime::ts( $val );
},
);
$table->rowButtons = function( $row )
{
return array(
'view' => array(
'title' => 'view',
'icon' => 'search',
'link' => \IPS\Http\Url::internal( 'app=core&module=members&controller=devices&do=device' )->setQueryString( 'key', $row['device_key'] )->setQueryString( 'member', $row['member_id'] ),
),
);
};
/* Return */
return (string) $table;
}
/**
* Find IPs by Member
*
* @code
return array(
'::1' => array(
'ip' => '::1'// string (IP Address)
'count' => ... // int (number of times this member has used this IP)
'first' => ... // int (timestamp of first use)
'last' => ... // int (timestamp of most recent use)
),
...
);
* @endcode
* @param \IPS\Member $member The member
* @return array
*/
public function findByMember( $member )
{
return \IPS\Db::i()->select( "ip_address AS ip, COUNT(*) AS count, MIN(last_seen) AS first, MAX(last_seen) AS last", 'core_members_known_ip_addresses', array( 'member_id=?', $member->member_id ), NULL, NULL, 'ip_address' )->setKeyField( 'ip' );
}
}
@@ -0,0 +1,102 @@
<?php
/**
* @brief IP Address Lookup: Member history
* @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 23 Feb 2017
*/
namespace IPS\core\extensions\core\IpAddresses;
/* 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;
}
/**
* IP Address Lookup: Display name changes
*/
class _MemberHistory
{
/**
* 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 FALSE;
}
/**
* Find Records by IP
*
* @param string $ip The IP Address
* @param \IPS\Http\Url $baseUrl URL table will be displayed on or NULL to return a count
* @return \IPS\Helpers\Table|int|null
*/
public function findByIp( $ip, \IPS\Http\Url $baseUrl = NULL )
{
/* Return count */
if ( $baseUrl === NULL )
{
return \IPS\Db::i()->select( 'COUNT(*)', 'core_member_history', array( "log_ip_address LIKE ?", $ip ) )->first();
}
/* Init Table */
$table = new \IPS\Member\History( $baseUrl, array( array( 'log_ip_address LIKE ?', $ip ) ) );
/* Columns we need */
$table->include = array( 'log_member', 'log_data', 'log_date', 'log_ip_address' );
$table->mainColumn = 'log_date';
$table->tableTemplate = array( \IPS\Theme::i()->getTemplate( 'tables', 'core', 'admin' ), 'table' );
$table->rowsTemplate = array( \IPS\Theme::i()->getTemplate( 'tables', 'core', 'admin' ), 'rows' );
$table->filters = NULL;
/* Default sort options */
$table->sortBy = $table->sortBy ?: 'log_date';
$table->sortDirection = $table->sortDirection ?: 'desc';
/* Return */
return (string) $table;
}
/**
* Find IPs by Member
*
* @code
return array(
'::1' => array(
'ip' => '::1'// string (IP Address)
'count' => ... // int (number of times this member has used this IP)
'first' => ... // int (timestamp of first use)
'last' => ... // int (timestamp of most recent use)
),
...
);
* @endcode
* @param \IPS\Member $member The member
* @return array
*/
public function findByMember( $member )
{
return \IPS\Db::i()->select( "log_ip_address AS ip, COUNT(*) AS count, MIN(log_date) AS first, MAX(log_date) AS last", 'core_member_history', array( 'log_member=?', $member->member_id ), NULL, NULL, 'log_ip_address' )->setKeyField( 'ip' );
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief IP Address Lookup: Private Messages
* @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 Oct 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\IpAddresses;
@@ -1,12 +1,11 @@
<?php
/**
* @brief IP Address Lookup: Moderator Logs
* @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 Oct 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\IpAddresses;
@@ -1,12 +1,11 @@
<?php
/**
* @brief IP Address Lookup: Ratings
* @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 12 Oct 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\IpAddresses;
@@ -1,12 +1,11 @@
<?php
/**
* @brief IP Address Lookup: Registration
* @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 19 Apr 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\IpAddresses;
@@ -1,12 +1,11 @@
<?php
/**
* @brief IP Address Lookup: ReportComments
* @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 12 Oct 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\IpAddresses;
@@ -1,12 +1,11 @@
<?php
/**
* @brief IP Address Lookup: Reports
* @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 12 Oct 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\IpAddresses;
@@ -1,12 +1,11 @@
<?php
/**
* @brief IP Address Lookup: Spam Service Logs
* @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 12 Oct 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\IpAddresses;
@@ -1,12 +1,11 @@
<?php
/**
* @brief IP Address Lookup: Validations
* @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 12 Oct 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\IpAddresses;
@@ -1,12 +1,11 @@
<?php
/**
* @brief IP Address Lookup: Poll Votes
* @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 10 Mar 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\IpAddresses;
@@ -0,0 +1,81 @@
<?php
/**
* @brief ACP Live Search Extension
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 27 Apr 2017
*/
namespace IPS\core\extensions\core\LiveSearch;
/* 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 ACP Live Search Extension
*/
class _Clubs
{
/**
* Check we have access
*
* @return void
*/
public function hasAccess()
{
/* Check Permissions */
return \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'clubs', 'clubs_manage' );
}
/**
* Get the search results
*
* @param string Search Term
* @return array Array of results
*/
public function getResults( $searchTerm )
{
/* Init */
$results = array();
$searchTerm = mb_strtolower( $searchTerm );
/* Start with categories */
if( $this->hasAccess() )
{
/* Perform the search */
$clubs = \IPS\Db::i()->select(
"*",
'core_clubs',
array( "name LIKE CONCAT( '%', ?, '%' )", $searchTerm ),
NULL,
NULL
);
/* Format results */
foreach ( $clubs as $club )
{
$club = \IPS\Member\Club::constructFromData( $club );
$results[] = \IPS\Theme::i()->getTemplate( 'livesearch', 'core', 'admin' )->club( $club );
}
}
return $results;
}
/**
* Is default for current page?
*
* @return bool
*/
public function isDefault()
{
return \IPS\Dispatcher::i()->application->directory == 'core' and \IPS\Dispatcher::i()->module->key == 'clubs';
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief ACP Live Search Extension: Groups
* @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 30 Sept 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\LiveSearch;
@@ -1,12 +1,11 @@
<?php
/**
* @brief ACP Live Search Extension: Members
* @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 18 Sept 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\LiveSearch;
@@ -1,12 +1,11 @@
<?php
/**
* @brief ACP Live Search Extension: 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
* @since 18 Sept 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\LiveSearch;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Multi-Factor Authentication Area
* @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 04 Dec 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\MFAArea;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Multi-Factor Authentication Area
* @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 04 Dec 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\MFAArea;
@@ -0,0 +1,35 @@
<?php
/**
* @brief Multi-Factor Authentication Area
* @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 04 Dec 2016
*/
namespace IPS\core\extensions\core\MFAArea;
/* 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;
}
/**
* Multi-Factor Authentication Area
*/
class _AuthenticateFrontKnown
{
/**
* Is this area available and should show in the ACP configuration?
*
* @return bool
*/
public function isEnabled()
{
return TRUE;
}
}
@@ -0,0 +1,34 @@
<?php
/**
* @brief Multi-Factor Authentication Area
* @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 13 Mar 2017
*/
namespace IPS\core\extensions\core\MFAArea;
/* 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;
}
/**
* Multi-Factor Authentication Area
*/
class _DeviceManagement
{
/**
* Is this area available and should show in the ACP configuration?
*
* @return bool
*/
public function isEnabled()
{
return \IPS\Settings::i()->device_management;
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Multi-Factor Authentication Area
* @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 26 Aug 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\MFAArea;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Multi-Factor Authentication Area
* @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 26 Aug 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\MFAArea;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Multi-Factor Authentication Area
* @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 26 Aug 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\MFAArea;
@@ -0,0 +1,141 @@
<?php
/**
* @brief Member filter extension: Content Count
* @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 22 Mar 2017
*/
namespace IPS\core\extensions\core\MemberFilter;
/* 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 Member filter: Content Count
*/
class _Content
{
/**
* Determine if the filter is available in a given area
*
* @param string $area Area to check
* @return bool
*/
public function availableIn( $area )
{
return in_array( $area, array( 'bulkmail', 'group_promotions' ) );
}
/**
* Get Setting Field
*
* @param mixed $criteria Value returned from the save() method
* @return array Array of form elements
*/
public function getSettingField( $criteria )
{
return array(
new \IPS\Helpers\Form\Custom( 'mf_content_count', array( 0 => isset( $criteria['content_count_operator'] ) ? $criteria['content_count_operator'] : NULL, 1 => isset( $criteria['content_count_score'] ) ? $criteria['content_count_score'] : NULL ), FALSE, array(
'getHtml' => function( $element )
{
return \IPS\Theme::i()->getTemplate( 'forms', 'core' )->select( "{$element->name}[0]", $element->value[0], $element->required, array(
'any' => \IPS\Member::loggedIn()->language()->addToStack('any'),
'gt' => \IPS\Member::loggedIn()->language()->addToStack('gt'),
'lt' => \IPS\Member::loggedIn()->language()->addToStack('lt'),
'eq' => \IPS\Member::loggedIn()->language()->addToStack('exactly'),
),
FALSE,
NULL,
FALSE,
array(
'any' => array(),
'gt' => array( 'elNumber_' . $element->name . '-qty' ),
'lt' => array( 'elNumber_' . $element->name . '-qty' ),
'eq' => array( 'elNumber_' . $element->name . '-qty' ),
) )
. ' '
. \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->number( "{$element->name}[1]", $element->value[1], $element->required, NULL, FALSE, NULL, NULL, NULL, 0, NULL, FALSE, NULL, array(), array(), array(), $element->name . '-qty' );
}
) )
);
}
/**
* Save the filter data
*
* @param array $post Form values
* @return mixed False, or an array of data to use later when filtering the members
* @throws \LogicException
*/
public function save( $post )
{
return array( 'content_count_operator' => $post['mf_content_count'][0], 'content_count_score' => $post['mf_content_count'][1] );
}
/**
* Get where clause to add to the member retrieval database query
*
* @param mixed $data The array returned from the save() method
* @return string|array|NULL Where clause
*/
public function getQueryWhereClause( $data )
{
if ( isset( $data['content_count_operator'] ) and isset( $data['content_count_score'] ) )
{
switch ( $data['content_count_operator'] )
{
case 'gt':
return array( array( "member_posts>?", (int) $data['content_count_score'] ) );
break;
case 'lt':
return array( array( "member_posts<?", (int) $data['content_count_score'] ) );
break;
case 'eq':
return array( array( "member_posts=?", (int) $data['content_count_score'] ) );
break;
}
}
return NULL;
}
/**
* Determine if a member matches specified filters
*
* @note This is only necessary if availableIn() includes group_promotions
* @param \IPS\Member $member Member object to check
* @param array $filters Previously defined filters
* @return bool
*/
public function matches( \IPS\Member $member, $filters )
{
/* If we aren't filtering by this, then any member matches */
if( !isset( $filters['content_count_operator'] ) OR !isset( $filters['content_count_score'] ) )
{
return TRUE;
}
switch ( $filters['content_count_operator'] )
{
case 'gt':
return (bool) ( $member->member_posts > (int) $filters['content_count_score'] );
break;
case 'lt':
return (bool) ( $member->member_posts < (int) $filters['content_count_score'] );
break;
case 'eq':
return (bool) ( $member->member_posts == (int) $filters['content_count_score'] );
break;
}
/* If we are still here, then there wasn't an appropriate operator (maybe they selected 'any') so return true */
return TRUE;
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Member filter extension: member groups
* @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 20 June 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\MemberFilter;
@@ -23,6 +22,17 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class _Group
{
/**
* Determine if the filter is available in a given area
*
* @param string $area Area to check
* @return bool
*/
public function availableIn( $area )
{
return in_array( $area, array( 'bulkmail', 'group_promotions' ) );
}
/**
* Get Setting Field
*
@@ -31,10 +41,33 @@ class _Group
*/
public function getSettingField( $criteria )
{
/* Get our options */
$criteria['options'] = array_combine( array_keys( \IPS\Member\Group::groups( TRUE, FALSE ) ), array_map( function( $_group ) { return (string) $_group; }, \IPS\Member\Group::groups( TRUE, FALSE ) ) );
/* If all *available* options are selected, we want to choose 'all' for consistency on create vs edit */
$_options = array_keys( $criteria['options'] );
if( isset( $criteria['disabled_groups'] ) )
{
$_options = array_diff( $_options, $criteria['disabled_groups'] );
}
if( isset( $criteria['groups'] ) )
{
if( !count( array_diff($_options,explode( ',', $criteria['groups'] ) ) ) )
{
$criteria['groups'] = 'all';
}
}
return array(
new \IPS\Helpers\Form\Select( 'bmf_members_groups', isset( $criteria['groups'] ) ? explode( ',', $criteria['groups'] ) : 'all', FALSE,
array( 'options' => array_combine( array_keys( \IPS\Member\Group::groups( TRUE, FALSE ) ), array_map( function( $_group ) { return (string) $_group; }, \IPS\Member\Group::groups( TRUE, FALSE ) ) ), 'multiple' => true, 'unlimited' => 'all', 'unlimitedLang' => 'all_groups' ) ),
);
new \IPS\Helpers\Form\Select( 'bmf_members_groups', ( isset( $criteria['groups'] ) AND $criteria['groups'] != 'all' ) ? explode( ',', $criteria['groups'] ) : 'all', FALSE, array(
'options' => $criteria['options'],
'multiple' => TRUE,
'unlimited' => 'all',
'unlimitedLang' => 'all_groups'
) )
);
}
/**
@@ -71,8 +104,30 @@ class _Group
{
return "( member_group_id IN(" . $data['groups'] . ") OR " . implode( ' OR ', $_set ) . ' )';
}
return NULL;
}
return NULL;
}
/**
* Determine if a member matches specified filters
*
* @note This is only necessary if availableIn() includes group_promotions
* @param \IPS\Member $member Member object to check
* @param array $filters Previously defined filters
* @return bool
*/
public function matches( \IPS\Member $member, $filters )
{
/* If we aren't filtering by this, then any member matches */
if( !isset( $filters['groups'] ) OR !$filters['groups'] )
{
return TRUE;
}
$_groups = explode( ',', $filters['groups'] );
/* This intentionally checks secondary groups, as SQL filtering also checks secondary groups */
return (bool) count( array_intersect( $_groups, $member->groups ) );
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Member filter extension: member join date
* @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 20 June 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\MemberFilter;
@@ -23,6 +22,17 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class _Joined
{
/**
* Determine if the filter is available in a given area
*
* @param string $area Area to check
* @return bool
*/
public function availableIn( $area )
{
return in_array( $area, array( 'bulkmail', 'group_promotions' ) );
}
/**
* Get Setting Field
*
@@ -32,8 +42,15 @@ class _Joined
public function getSettingField( $criteria )
{
return array(
new \IPS\Helpers\Form\DateRange( 'bmf_members_joined', isset( $criteria['range'] ) ? $criteria['range'] : '', FALSE ),
);
new \IPS\Helpers\Form\Custom( 'bmf_members_joined', array( 0 => isset( $criteria['range'] ) ? $criteria['range'] : '', 1 => isset( $criteria['days'] ) ? $criteria['days'] : NULL ), FALSE, array(
'getHtml' => function( $element )
{
$dateRange = new \IPS\Helpers\Form\DateRange( "{$element->name}[0]", $element->value[0], FALSE );
return \IPS\Theme::i()->getTemplate( 'members', 'core', 'global' )->dateFilters( $dateRange, $element );
}
) )
);
}
/**
@@ -45,8 +62,15 @@ class _Joined
*/
public function save( $post )
{
/* Normalize objects to their array form. Bulk mailer stores options as a json array where as member export does not, so $data['range']['start'] is a DateTime object */
return ( empty($post['bmf_members_joined']) ) ? FALSE : array( 'range' => json_decode( json_encode( $post['bmf_members_joined'] ), TRUE ) );
if( isset( $post['bmf_members_joined'][2] ) AND $post['bmf_members_joined'][2] == 'days' )
{
return $post['bmf_members_joined'][1] ? array( 'days' => intval( $post['bmf_members_joined'][1] ) ) : FALSE;
}
else
{
/* Normalize objects to their array form. Bulk mailer stores options as a json array where as member export does not, so $data['range']['start'] is a DateTime object */
return ( empty($post['bmf_members_joined'][0]) ) ? FALSE : array( 'range' => json_decode( json_encode( $post['bmf_members_joined'][0] ), TRUE ) );
}
}
/**
@@ -59,12 +83,56 @@ class _Joined
{
if( !empty($data['range']) AND !empty($data['range']['end']) )
{
$start = ( $data['range']['start']['date'] ) ? strtotime( $data['range']['start']['date'] ) : 0;
$end = strtotime( $data['range']['end']['date'] );
$start = ( $data['range']['start']['date'] ) ? new \IPS\DateTime( $data['range']['start']['date'] ) : NULL;
$end = ( $data['range']['end']['date'] ) ? new \IPS\DateTime( $data['range']['end']['date'] ) : NULL;
return "core_members.joined BETWEEN {$start} AND {$end}";
if( $start and $end )
{
return "core_members.joined BETWEEN {$start->getTimestamp()} AND {$end->getTimestamp()}";
}
}
elseif( !empty($data['days']) )
{
$date = \IPS\DateTime::create()->sub( new \DateInterval( 'P' . $data['days'] . 'D' ) );
return "core_members.joined < {$date->getTimestamp()}";
}
return NULL;
}
/**
* Determine if a member matches specified filters
*
* @note This is only necessary if availableIn() includes group_promotions
* @param \IPS\Member $member Member object to check
* @param array $filters Previously defined filters
* @return bool
*/
public function matches( \IPS\Member $member, $filters )
{
/* If we aren't filtering by this, then any member matches */
if( ( !isset( $filters['range'] ) OR !$filters['range'] OR empty( $filters['range']['end'] ) ) AND ( !isset( $filters['days'] ) OR !$filters['days'] ) )
{
return TRUE;
}
/* \IPS\Member::get_joined() is defined and returns an \IPS\DateTime object already, so we don't need to use ts() here */
$joinedDate = $member->joined;
if( !empty( $filters['range'] ) AND !empty( $filters['range']['end'] ) )
{
$start = ( $filters['range']['start'] ) ? new \IPS\DateTime( $filters['range']['start'] ) : NULL;
$end = ( $filters['range']['end'] ) ? new \IPS\DateTime( $filters['range']['end'] ) : NULL;
if( $start and $end )
{
return (bool) ( $joinedDate->getTimestamp() > $start->getTimestamp() AND $joinedDate->getTimestamp() < $end->getTimestamp() );
}
}
elseif( !empty( $filters['days'] ) )
{
return (bool) ( $joinedDate->add( new \DateInterval( 'P' . $filters['days'] . 'D' ) )->getTimestamp() < time() );
}
}
}
@@ -0,0 +1,137 @@
<?php
/**
* @brief Member filter extension: member last post date
* @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 22 Mar 2017
*/
namespace IPS\core\extensions\core\MemberFilter;
/* 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 Member filter: Member last post date
*/
class _Lastpost
{
/**
* Determine if the filter is available in a given area
*
* @param string $area Area to check
* @return bool
*/
public function availableIn( $area )
{
return in_array( $area, array( 'bulkmail', 'group_promotions' ) );
}
/**
* Get Setting Field
*
* @param mixed $criteria Value returned from the save() method
* @return array Array of form elements
*/
public function getSettingField( $criteria )
{
return array(
new \IPS\Helpers\Form\Custom( 'mf_members_last_post', array( 0 => isset( $criteria['range'] ) ? $criteria['range'] : '', 1 => isset( $criteria['days'] ) ? $criteria['days'] : NULL ), FALSE, array(
'getHtml' => function( $element )
{
$dateRange = new \IPS\Helpers\Form\DateRange( "{$element->name}[0]", $element->value[0], FALSE );
return \IPS\Theme::i()->getTemplate( 'members', 'core', 'global' )->dateFilters( $dateRange, $element );
}
) )
);
}
/**
* Save the filter data
*
* @param array $post Form values
* @return mixed False, or an array of data to use later when filtering the members
* @throws \LogicException
*/
public function save( $post )
{
if( isset( $post['mf_members_last_post'][2] ) AND $post['mf_members_last_post'][2] == 'days' )
{
return $post['mf_members_last_post'][1] ? array( 'days' => intval( $post['mf_members_last_post'][1] ) ) : FALSE;
}
else
{
/* Normalize objects to their array form. Bulk mailer stores options as a json array where as member export does not, so $data['range']['start'] is a DateTime object */
return ( empty($post['mf_members_last_post'][0]) ) ? FALSE : array( 'range' => json_decode( json_encode( $post['mf_members_last_post'][0] ), TRUE ) );
}
}
/**
* Get where clause to add to the member retrieval database query
*
* @param mixed $data The array returned from the save() method
* @return string|array|NULL Where clause
*/
public function getQueryWhereClause( $data )
{
if( !empty($data['range']) AND !empty($data['range']['end']) )
{
$start = ( $data['range']['start']['date'] ) ? new \IPS\DateTime( $data['range']['start']['date'] ) : NULL;
$end = ( $data['range']['end']['date'] ) ? new \IPS\DateTime( $data['range']['end']['date'] ) : NULL;
if( $start and $end )
{
return "core_members.member_last_post BETWEEN {$start} AND {$end}";
}
}
elseif( !empty($data['days']) )
{
$date = \IPS\DateTime::create()->sub( new \DateInterval( 'P' . $data['days'] . 'D' ) );
return "core_members.member_last_post < {$date->getTimestamp()}";
}
return NULL;
}
/**
* Determine if a member matches specified filters
*
* @note This is only necessary if availableIn() includes group_promotions
* @param \IPS\Member $member Member object to check
* @param array $filters Previously defined filters
* @return bool
*/
public function matches( \IPS\Member $member, $filters )
{
/* If we aren't filtering by this, then any member matches */
if( ( !isset( $filters['range'] ) OR !$filters['range'] OR empty( $filters['range']['end'] ) ) AND ( !isset( $filters['days'] ) OR !$filters['days'] ) )
{
return TRUE;
}
$lastPost = \IPS\DateTime::ts( $member->member_last_post );
if( !empty( $filters['range'] ) AND !empty( $filters['range']['end'] ) )
{
$start = ( $filters['range']['start'] ) ? new \IPS\DateTime( $filters['range']['start'] ) : NULL;
$end = ( $filters['range']['end'] ) ? new \IPS\DateTime( $filters['range']['end'] ) : NULL;
if( $start and $end )
{
return (bool) ( $lastPost->getTimestamp() > $start->getTimestamp() AND $lastPost->getTimestamp() < $end->getTimestamp() );
}
}
elseif( !empty( $filters['days'] ) )
{
return (bool) ( $lastPost->add( new \DateInterval( 'P' . $filters['days'] . 'D' ) )->getTimestamp() < time() );
}
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Member filter extension: member last visit date
* @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 20 June 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\extensions\core\MemberFilter;
@@ -23,6 +22,17 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class _Lastvisit
{
/**
* Determine if the filter is available in a given area
*
* @param string $area Area to check
* @return bool
*/
public function availableIn( $area )
{
return in_array( $area, array( 'bulkmail', 'group_promotions' ) );
}
/**
* Get Setting Field
*
@@ -32,8 +42,15 @@ class _Lastvisit
public function getSettingField( $criteria )
{
return array(
new \IPS\Helpers\Form\DateRange( 'bmf_members_last_visit', isset( $criteria['range'] ) ? $criteria['range'] : '', FALSE ),
);
new \IPS\Helpers\Form\Custom( 'bmf_members_last_visit', array( 0 => isset( $criteria['range'] ) ? $criteria['range'] : '', 1 => isset( $criteria['days'] ) ? $criteria['days'] : NULL ), FALSE, array(
'getHtml' => function( $element )
{
$dateRange = new \IPS\Helpers\Form\DateRange( "{$element->name}[0]", $element->value[0], FALSE );
return \IPS\Theme::i()->getTemplate( 'members', 'core', 'global' )->dateFilters( $dateRange, $element );
}
) )
);
}
/**
@@ -45,8 +62,15 @@ class _Lastvisit
*/
public function save( $post )
{
/* Normalize objects to their array form. Bulk mailer stores options as a json array where as member export does not, so $data['range']['start'] is a DateTime object */
return ( empty($post['bmf_members_last_visit']) ) ? FALSE : array( 'range' => json_decode( json_encode( $post['bmf_members_last_visit'] ), TRUE ) );
if( isset( $post['bmf_members_last_visit'][2] ) AND $post['bmf_members_last_visit'][2] == 'days' )
{
return $post['bmf_members_last_visit'][1] ? array( 'days' => intval( $post['bmf_members_last_visit'][1] ) ) : FALSE;
}
else
{
/* Normalize objects to their array form. Bulk mailer stores options as a json array where as member export does not, so $data['range']['start'] is a DateTime object */
return ( empty($post['bmf_members_last_visit'][0]) ) ? FALSE : array( 'range' => json_decode( json_encode( $post['bmf_members_last_visit'][0] ), TRUE ) );
}
}
/**
@@ -59,12 +83,55 @@ class _Lastvisit
{
if( !empty($data['range']) AND !empty($data['range']['end']) )
{
$start = ( $data['range']['start']['date'] ) ? strtotime( $data['range']['start']['date'] ) : 0;
$end = strtotime( $data['range']['end']['date'] );
$start = ( $data['range']['start'] ) ? new \IPS\DateTime( $data['range']['start'] ) : NULL;
$end = ( $data['range']['end'] ) ? new \IPS\DateTime( $data['range']['end'] ) : NULL;
return "core_members.last_visit BETWEEN {$start} AND {$end}";
if( $start and $end )
{
return "core_members.last_visit BETWEEN {$start->getTimestamp()} AND {$end->getTimestamp()}";
}
}
elseif( !empty($data['days']) )
{
$date = \IPS\DateTime::create()->sub( new \DateInterval( 'P' . $data['days'] . 'D' ) );
return "core_members.last_visit < {$date->getTimestamp()}";
}
return NULL;
}
/**
* Determine if a member matches specified filters
*
* @note This is only necessary if availableIn() includes group_promotions
* @param \IPS\Member $member Member object to check
* @param array $filters Previously defined filters
* @return bool
*/
public function matches( \IPS\Member $member, $filters )
{
/* If we aren't filtering by this, then any member matches */
if( ( !isset( $filters['range'] ) OR !$filters['range'] OR empty( $filters['range']['end'] ) ) AND ( !isset( $filters['days'] ) OR !$filters['days'] ) )
{
return TRUE;
}
$lastVisit = \IPS\DateTime::ts( $member->last_visit );
if( !empty( $filters['range'] ) AND !empty( $filters['range']['end'] ) )
{
$start = ( $filters['range']['start'] ) ? new \IPS\DateTime( $filters['range']['start'] ) : NULL;
$end = ( $filters['range']['end'] ) ? new \IPS\DateTime( $filters['range']['end'] ) : NULL;
if( $start and $end )
{
return (bool) ( $lastVisit->getTimestamp() > $start->getTimestamp() AND $lastVisit->getTimestamp() < $end->getTimestamp() );
}
}
elseif( !empty( $filters['days'] ) )
{
return (bool) ( $lastVisit->add( new \DateInterval( 'P' . $filters['days'] . 'D' ) )->getTimestamp() < time() );
}
}
}
Loaded 100 of 2074 files, more files were not shown because too many files have changed in this diff. Show more