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 Acronym Model
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 10 Sept 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Advertisements Model
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 30 Sept 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core;
@@ -67,31 +66,12 @@ class _Advertisement extends \IPS\Patterns\ActiveRecord
if( static::$advertisements === NULL )
{
static::$advertisements = array();
if( !isset( \IPS\Data\Cache::i()->advertisements ) OR \IPS\Data\Cache::i()->advertisements === NULL )
{
$ads = array();
foreach( \IPS\Db::i()->select( '*' ,'core_advertisements', array( "ad_active=1 AND ad_start < ? AND ( ad_end=0 OR ad_end > ? )", time(), time() ) ) as $row )
{
foreach ( explode( ',', $row['ad_location'] ) as $_location )
{
$ads[ $_location ][ $row['ad_id'] ] = $row;
}
}
\IPS\Data\Cache::i()->advertisements = $ads;
}
else
foreach( \IPS\Db::i()->select( '*' ,'core_advertisements', array( "ad_active=1 AND ad_start < ? AND ( ad_end=0 OR ad_end > ? )", time(), time() ) ) as $row )
{
$ads = \IPS\Data\Cache::i()->advertisements;
}
foreach( $ads as $loc => $rows )
{
foreach ( $rows as $row )
foreach ( explode( ',', $row['ad_location'] ) as $_location )
{
static::$advertisements[ $loc ][] = static::constructFromData( $row );
static::$advertisements[ $_location ][] = static::constructFromData( $row );
}
}
}
@@ -103,7 +83,6 @@ class _Advertisement extends \IPS\Patterns\ActiveRecord
{
if ( $ad->exempt != '*' )
{
$groupsToHideFrom = array_diff( array_keys(\IPS\Member\Group::groups()), json_decode( $ad->exempt, TRUE ) );
if ( \IPS\Member::loggedIn()->inGroup( $groupsToHideFrom ) )
@@ -231,16 +210,20 @@ class _Advertisement extends \IPS\Patterns\ActiveRecord
}
/**
* Save Changed Columns
* Get additional settings
*
* @return void
* @return array
*/
public function save()
public function get__additional_settings()
{
parent::save();
unset( \IPS\Data\Cache::i()->advertisements );
if( !isset( $this->_data['_additional_settings'] ) )
{
$this->_data['_additional_settings'] = $this->_data['additional_settings'] ? json_decode( $this->_data['additional_settings'], TRUE ) : array();
}
return $this->_data['_additional_settings'];
}
/**
* Get the file system storage extension
*
@@ -284,8 +267,7 @@ class _Advertisement extends \IPS\Patterns\ActiveRecord
/* Delete */
parent::delete();
/* Empty the cache */
unset( \IPS\Data\Cache::i()->advertisements );
/* Make sure we still have active ads */
if ( !\IPS\Db::i()->select( 'COUNT(*)', 'core_advertisements', 'ad_active=1' )->first() )
{
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => 0 ), array( 'conf_key=?', 'ads_exist' ) );
@@ -303,7 +285,6 @@ class _Advertisement extends \IPS\Patterns\ActiveRecord
if( count( static::$advertisementIds ) )
{
\IPS\Db::i()->update( 'core_advertisements', "ad_impressions=ad_impressions+1", "ad_id IN(" . implode( ',', static::$advertisementIds ) . ")" );
unset( \IPS\Data\Cache::i()->advertisements );
}
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Announcement model
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 22 Aug 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\Announcements;
@@ -323,10 +322,11 @@ class _Announcement extends \IPS\Content\Item
* @param string $action The action
* @param \IPS\Member|NULL $member The member doing the action (NULL for currently logged in member)
* @param string|NULL $reason Reason (for hides)
* @param bool $immediately Delete immediately
* @return void
* @throws \OutOfRangeException|\InvalidArgumentException|\RuntimeException
*/
public function modAction( $action, \IPS\Member $member = NULL, $reason = NULL )
public function modAction( $action, \IPS\Member $member = NULL, $reason = NULL, $immediately = FALSE )
{
if( static::modPermission( $action, $member ) )
{
@@ -355,7 +355,7 @@ class _Announcement extends \IPS\Content\Item
}
}
return parent::modAction( $action, $member, $reason );
return parent::modAction( $action, $member, $reason, $immediately );
}
/**
@@ -1,12 +1,11 @@
<?php
/**
* @brief Bulkmail central library
* @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 Jun 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\BulkMail;
@@ -165,10 +164,11 @@ class _Bulkmailer extends \IPS\Patterns\ActiveRecord
$where[] = array( "core_members.allow_admin_mails=1" );
$where[] = array( "core_members.temp_ban=0" );
$where[] = array( "core_members.email!=''" );
$where[] = array( '( ! ' . \IPS\Db::i()->bitwiseWhere( \IPS\Member::$bitOptions['members_bitoptions'], 'bw_is_spammer' ) . ' )' );
foreach ( \IPS\Application::allExtensions( 'core', 'MemberFilter', FALSE, 'core' ) as $key => $extension )
{
if( method_exists( $extension, 'getQueryWhereClause' ) )
if( method_exists( $extension, 'getQueryWhereClause' ) AND $extension->availableIn( 'bulkmail' ) )
{
/* Grab our fields and add to the form */
if( !empty( $this->_options[ $key ] ) )
@@ -194,7 +194,7 @@ class _Bulkmailer extends \IPS\Patterns\ActiveRecord
/* Run callbacks */
foreach ( \IPS\Application::allExtensions( 'core', 'MemberFilter', FALSE, 'core' ) as $key => $extension )
{
if( method_exists( $extension, 'queryCallback' ) )
if( method_exists( $extension, 'queryCallback' ) AND $extension->availableIn( 'bulkmail' ) )
{
/* Grab our fields and add to the form */
if( !empty( $this->_options[ $key ] ) )
@@ -242,6 +242,7 @@ class _Bulkmailer extends \IPS\Patterns\ActiveRecord
$tags['{member_id}'] = $member->member_id;
$tags['{member_email}'] = $member->email;
$tags['{member_name}'] = $member->name;
$tags['{member_url}'] = $member->url();
$tags['{member_joined}'] = $member->joined->localeDate();
$tags['{member_last_visit}'] = \IPS\DateTime::ts( $member->last_visit )->localeDate();
$tags['{member_posts}'] = $member->member_posts;
@@ -277,6 +278,7 @@ class _Bulkmailer extends \IPS\Patterns\ActiveRecord
$tags = array(
'{member_id}' => \IPS\Member::loggedIn()->language()->addToStack('bmtag_member_id'),
'{member_name}' => \IPS\Member::loggedIn()->language()->addToStack('bmtag_member_name'),
'{member_url}' => \IPS\Member::loggedIn()->language()->addToStack('bmtag_member_profileurl'),
'{member_joined}' => \IPS\Member::loggedIn()->language()->addToStack('bmtag_member_joined'),
'{member_last_visit}' => \IPS\Member::loggedIn()->language()->addToStack('bmtag_member_last_visit'),
'{member_posts}' => \IPS\Member::loggedIn()->language()->addToStack('bmtag_member_posts'),
@@ -0,0 +1,272 @@
<?php
/**
* @brief Deletion Log Model
* @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 Nov 2016
*/
namespace IPS\core;
/* 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;
}
/**
* Deletion Log Model
*/
class _DeletionLog extends \IPS\Patterns\ActiveRecord
{
/**
* @brief Database Table
*/
public static $databaseTable = 'core_deletion_log';
/**
* @brief Database Prefix
*/
public static $databasePrefix = 'dellog_';
/**
* @brief Multiton Store
*/
protected static $multitons;
/**
* @brief [ActiveRecord] ID Database Column
*/
public static $databaseColumnId = 'id';
/**
* @brief [ActiveRecord] Multiton Map
*/
protected static $multitonMap = array();
/**
* Set Default Values
*
* @return void
*/
public function setDefaultValues()
{
$this->deleted_date = \IPS\DateTime::create();
}
/**
* Set deleted date
*
* @param \IPS\DateTime A DateTime object
* @return void
*/
public function set_deleted_date( \IPS\DateTime $time )
{
$this->_data['deleted_date'] = $time->getTimestamp();
}
/**
* Get deleted date
*
* @return \IPS\DateTime
*/
public function get_deleted_date()
{
return \IPS\DateTime::ts( $this->_data['deleted_date'] );
}
/**
* Set Deleted By
*
* @param \IPS\Member The member
* @return void
*/
public function set_deleted_by( \IPS\Member $member )
{
$this->_data['deleted_by'] = $member->member_id;
$this->_data['deleted_by_name'] = $member->real_name;
$this->_data['deleted_by_seo_name'] = $member->members_seo_name;
}
/**
* @brief Deleted By Cache
*/
protected $_deletedBy = NULL;
/**
* Get Deleted By
*
* @return \IPS\Member
*/
public function get__deleted_by()
{
if ( $this->_deletedBy === NULL )
{
$this->_deletedBy = \IPS\Member::load( $this->_data['deleted_by'] );
}
return $this->_deletedBy;
}
/**
* Get Permissions
*
* @return array|string
*/
public function get_content_permissions()
{
if ( $this->_data['content_permissions'] == '*' )
{
return $this->_data['content_permissions'];
}
$perms = explode( ',', $this->_data['content_permissions'] );
$return = array( 'members' => array(), 'groups' => array() );
foreach( $perms AS $perm )
{
if ( \substr( $perm, 0, 1 ) == 'm' )
{
$return['members'][] = str_replace( 'm', '', $perm );
}
else
{
$return['groups'][] = $perm;
}
}
return $return;
}
/**
* Get the date the content will be permanently removed on
*
* @return \IPS\DateTime
*/
public function get_deletion_date()
{
return $this->deleted_date->add( new \DateInterval( 'P' . \IPS\Settings::i()->dellog_retention_period . 'D' ) );
}
/**
* Set Content and Member
*
* @param \IPS\Content The content being deleted.
* @param \IPS\Member|NULL The member performing the deletion, or NULL for the currently logged in member
* @return void
* @note Convenience ftw
*/
public function setContentAndMember( \IPS\Content $content, \IPS\Member $member = NULL )
{
$member = $member ?: \IPS\Member::loggedIn();
$idField = $content::$databaseColumnId;
$item = $content;
if ( $content instanceof \IPS\Content\Comment )
{
$item = $content->item();
}
/* Content Data */
$this->content_class = get_class( $content );
$this->content_id = $content->$idField;
$this->content_title = $item->mapped('title');
$this->content_seo_title = \IPS\Http\Url\Friendly::seoTitle( $item->mapped('title') );
$this->content_permissions = $item->searchIndexPermissions();
/* Member Data */
$this->deleted_by = $member;
}
/**
* Save
*
* @return void
*/
public function save()
{
if ( !$this->id )
{
$contentClass = $this->content_class;
$content = $contentClass::load( $this->content_id );
if( $content instanceof \IPS\Content\Searchable )
{
\IPS\Content\Search\Index::i()->removeFromSearchIndex( $content );
}
}
parent::save();
}
/**
* Load and check perms
*
* @param int ID
* @return static
* @throws
* @li \OutOfRangeException
*/
public static function loadAndCheckPerms( $id )
{
$obj = parent::load( $id );
if ( !$obj->canView() )
{
throw new \OutOfRangeException;
}
return $obj;
}
/**
* Can View
*
* @param \IPS\Member|NULL The member, or NULL for currently logged in
* @return bool
*/
public function canView( \IPS\Member $member = NULL )
{
$member = $member ?: \IPS\Member::loggedIn();
if ( !is_array( $this->content_permissions ) AND $this->content_permissions == '*' )
{
return TRUE;
}
if ( in_array( $member->member_id, $this->content_permissions['members'] ) )
{
return TRUE;
}
if ( $member->inGroup( $this->content_permissions['groups'] ) )
{
return TRUE;
}
return FALSE;
}
/**
* URL
*
* @param string|NULL "action" parameter or NULL to go to the content
* @return \IPS\Http\Url
*/
public function url( $action=NULL )
{
if ( $action === NULL )
{
$class = $this->content_class;
$item = $class::load( $this->content_id );
return $item->url()->setQueryString( 'showDeleted', 1 );
}
else
{
return \IPS\Http\Url::internal( "app=core&module=modcp&controller=modcp&tab=deleted", 'front', 'modcp_deleted' )->setQueryString( array( 'id' => $this->id, 'action' => $action ) );
}
}
}
@@ -0,0 +1,118 @@
<?php
/**
* @brief Deletion Log Table
* @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 Nov 2016
*/
namespace IPS\core\DeletionLog;
/* 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;
}
/**
* Deletion Log Table
*/
class _Table extends \IPS\Helpers\Table\Table
{
/**
* @brief Title
*/
public $title = 'modcp_deleted';
/**
* Constructor
*
* @param \IPS\Http\Url Base URL
* @return void
*/
public function __construct( \IPS\Http\Url $url=NULL )
{
/* Init */
parent::__construct( $url );
}
/**
* Get rows
*
* @param array $advancedSearchValues Values from the advanced search form
* @return array
*/
public function getRows( $advancedSearchValues=NULL )
{
$this->sortBy = in_array( $this->sortBy, $this->sortOptions ) ? $this->sortBy : 'dellog_deleted_date';
$sortBy = $this->sortBy . ' ' . ( \strtolower( $this->sortDirection ) == 'asc' ? 'asc' : 'desc' );
/* Where Clause */
$where = array();
$where[] = array( "(dellog_content_permissions=? OR " . \IPS\Db::i()->findInSet( 'dellog_content_permissions', \IPS\Member::loggedIn()->groups ) . " OR " . \IPS\Db::i()->findInSet( 'dellog_content_permissions', array( 'm' . \IPS\Member::loggedIn()->member_id ) ) . ")", '*' );
if ( $advancedSearchValues )
{
if ( isset( $advancedSearchValues['dellog_content_class'] ) AND $advancedSearchValues['dellog_content_class'] != 'all' )
{
$where[] = array( "dellog_content_class=?", $advancedSearchValues['dellog_content_class'] );
}
if ( isset( $advancedSearchValues['dellog_deleted_by'] ) )
{
$where[] = array( "dellog_deleted_by=?", $advancedSearchValues['dellog_deleted_by']->member_id );
}
}
$count = \IPS\Db::i()->select( 'COUNT(*)', 'core_deletion_log', $where )->first();
$this->pages = ceil( $count / $this->limit );
$it = new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_deletion_log', $where, $sortBy, array( ( $this->limit * ( $this->page - 1 ) ), $this->limit ) ), 'IPS\core\DeletionLog' );
$return = array();
foreach( iterator_to_array( $it ) AS $row )
{
$return[ $row->id ] = $row;
}
return $return;
}
/**
* Return the table headers
*
* @param array|NULL $advancedSearchValues Advanced search values
* @return array
*/
public function getHeaders( $advancedSearchValues )
{
return array();
}
/**
* Multimod Actions
*
* @return array
*/
public function multimodActions()
{
return array(
'restore',
'restore_as_hidden',
'delete'
);
}
/**
* Can Moderate
*
* @return bool
*/
public function canModerate( $action=NULL )
{
return TRUE;
}
}
+4 -5
View File
@@ -1,12 +1,11 @@
<?php
/**
* @brief Digest Class
* @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 May 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\Digest;
+4 -5
View File
@@ -1,13 +1,12 @@
<?php
/**
* @brief Table Builder for followed 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
* @subpackage Gallery
* @since 16 Apr 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\Followed;
@@ -0,0 +1,142 @@
<?php
/**
* @brief Key/Value input class for social profile links
* @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 Feb 2017
*/
namespace IPS\core\Form;
/* 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;
}
/**
* Key/Value input class for social profile links
*/
class _SocialProfiles extends \IPS\Helpers\Form\KeyValue
{
/**
* @brief Default Options
* @see \IPS\Helpers\Form\Date::$defaultOptions
* @code
$defaultOptions = array(
'start' => array( ... ),
'end' => array( ... ),
);
* @endcode
*/
protected $defaultOptions = array(
'key' => array(
),
'value' => array(
),
);
/**
* @brief Key Object
*/
public $keyField = NULL;
/**
* @brief Value Object
*/
public $valueField = NULL;
/**
* Constructor
* Creates the two date objects
*
* @see \IPS\Helpers\Form\Abstract::__construct
* @return void
*/
public function __construct( $name, $defaultValue=NULL, $required=FALSE, $options=array() )
{
$options = array_merge( $this->defaultOptions, $options );
$options = $this->addSocialNetworks( $options );
call_user_func_array( 'parent::__construct', func_get_args() );
$this->keyField = new \IPS\Helpers\Form\Url( "{$name}[key]", isset( $defaultValue['key'] ) ? $defaultValue['key'] : NULL, FALSE, isset( $options['key'] ) ? $options['key'] : array() );
$this->valueField = new \IPS\Helpers\Form\Select( "{$name}[value]", isset( $defaultValue['value'] ) ? $defaultValue['value'] : NULL, FALSE, isset( $options['value'] ) ? $options['value'] : array() );
}
/**
* Add social networks to the options array
*
* @note Abstracted so third parties can extend as needed
* @param array $options Options array
* @return array
*/
protected function addSocialNetworks( $options )
{
$options['value']['options'] = array(
'facebook' => "siteprofilelink_facebook",
'twitter' => "siteprofilelink_twitter",
'youtube' => "siteprofilelink_youtube",
'google-plus' => "siteprofilelink_googleplus",
'deviantart' => "siteprofilelink_deviantart",
'etsy' => "siteprofilelink_etsy",
'flickr' => "siteprofilelink_flickr",
'foursquare' => "siteprofilelink_foursquare",
'github' => "siteprofilelink_github",
'instagram' => "siteprofilelink_instagram",
'pinterest' => "siteprofilelink_pinterest",
'linkedin' => "siteprofilelink_linkedin",
'slack' => "siteprofilelink_slack",
'xing' => "siteprofilelink_xing",
'weibo' => "siteprofilelink_weibo",
'vk' => "siteprofilelink_vk",
);
return $options;
}
/**
* Format Value
*
* @return array
*/
public function formatValue()
{
return array(
'key' => $this->keyField->formatValue(),
'value' => $this->valueField->formatValue()
);
}
/**
* Get HTML
*
* @return string
*/
public function html()
{
return \IPS\Theme::i()->getTemplate( 'forms', 'core', 'admin' )->socialProfiles( $this->keyField->html(), $this->valueField->html() );
}
/**
* Validate
*
* @throws \InvalidArgumentException
* @throws \LengthException
* @return TRUE
*/
public function validate()
{
$this->keyField->validate();
$this->valueField->validate();
if( $this->customValidationCode !== NULL )
{
call_user_func( $this->customValidationCode, $this->value );
}
}
}
@@ -1,13 +1,12 @@
<?php
/**
* @brief Front Navigation Handler
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Core
* @since 30 Jun 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core;
@@ -30,6 +29,11 @@ class _FrontNavigation
*/
protected static $instance = NULL;
/**
* @brief This is a hacky flag to indicate if active page is a club area so we know which tab to highlight in the menu
*/
public static $clubTabActive = FALSE;
/**
* @brief Store root objects for re-use later
*/
@@ -78,11 +82,6 @@ class _FrontNavigation
}
}
}
elseif ( !$noStore )
{
static::buildDefaultFrontNavigation();
return static::frontNavigation();
}
if ( $noStore )
{
return $frontNavigation;
@@ -267,12 +266,15 @@ class _FrontNavigation
foreach ( $frontNavigation[0] as $item )
{
$class = 'IPS\\' . $item['app'] . '\extensions\core\FrontNavigation\\' . $item['extension'];
$object = new $class( json_decode( $item['config'], TRUE ), $item['id'], $item['permissions'] );
if ( !$this->activePrimaryNavBar )
if ( class_exists( $class ) )
{
$this->activePrimaryNavBar = $item['id'];
$object = new $class( json_decode( $item['config'], TRUE ), $item['id'], $item['permissions'] );
if ( !$this->activePrimaryNavBar )
{
$this->activePrimaryNavBar = $item['id'];
}
$this->roots[ $item['id'] ] = $object;
}
$this->roots[ $item['id'] ] = $object;
}
}
@@ -1,13 +1,12 @@
<?php
/**
* @brief Abstract Front Navigation 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 Core
* @since 30 Jun 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\FrontNavigation;
+4 -5
View File
@@ -1,12 +1,11 @@
<?php
/**
* @brief Ignore Record
* @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 Aug 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Personal Conversation Model
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 5 Jul 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\Messenger;
@@ -222,7 +221,7 @@ class _Conversation extends \IPS\Content\Item
{
if ( !$m instanceof \IPS\Member OR !static::memberCanReceiveNewMessage( $m, \IPS\Member::loggedIn() ) )
{
throw new \InvalidArgumentException( \IPS\Member::loggedIn()->language()->addToStack('meesnger_err_bad_recipient', FALSE, array( 'sprintf' => array( $m->name ) ) ) );
throw new \InvalidArgumentException( \IPS\Member::loggedIn()->language()->addToStack('meesnger_err_bad_recipient', FALSE, array( 'sprintf' => array( $m ) ) ) );
}
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Personal Conversation Message Model
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 8 Jul 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\Messenger;
@@ -146,7 +145,7 @@ class _Message extends \IPS\Content\Comment implements \IPS\Content\ReportCenter
\IPS\Db::i()->update( 'core_message_topic_user_map', array( 'map_has_unread' => 0, 'map_last_topic_reply' => time(), 'map_read_time' => time() ), array( 'map_topic_id=? AND map_user_id=?', $this->item()->id, $this->author()->member_id ) );
$notification = new \IPS\Notification( \IPS\Application::load('core'), 'new_private_message', $this->item(), array( $this ) );
$messengerModule = \IPS\Application\Module::get( 'core', 'messaging' );
$messengerModule = \IPS\Application\Module::get( 'core', 'messaging', 'front' );
foreach ( $this->item()->maps() as $map )
{
@@ -177,10 +176,11 @@ class _Message extends \IPS\Content\Comment implements \IPS\Content\ReportCenter
/**
* Move Comment to another item
*
* @param \IPS\Content\Item $item The item to move this comment too.
* @param \IPS\Content\Item $item The item to move this comment to
* @param bool $skip Skip rebuilding new/old content item data (used for multimod where we can do it in one go after)
* @return void
*/
public function move( \IPS\Content\Item $item )
public function move( \IPS\Content\Item $item, $skip=FALSE )
{
/* Make sure all active participants in the old conversation are in the new one */
$activeParticipants = array_keys( array_filter( $this->item()->maps( TRUE ), function ( $map ) {
@@ -1,12 +1,11 @@
<?php
/**
* @brief Profanity Model
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 10 Nov 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core;
@@ -379,59 +378,70 @@ class _Profanity extends \IPS\Patterns\ActiveRecord implements \JsonSerializable
$urls[] = "https://" . parse_url( \IPS\Settings::i()->base_url, PHP_URL_HOST ) . "/*";
}
try
if ( $urls )
{
/* Load the content so we can look for URL's */
$dom = new \IPS\Xml\DOMDocument;
$dom->loadHTML( $content );
/* Gather up all URL's */
$tags = $dom->getElementsByTagName('a');
$good = NULL;
foreach( $tags AS $tag )
try
{
if ( $tag->hasAttribute( 'href' ) and !$tag->hasAttribute( 'data-mentionid' ) )
/* Load the content so we can look for URL's */
$dom = new \IPS\Xml\DOMDocument;
$dom->loadHTML( $content );
/* Gather up all URL's */
$selector = new \DOMXPath($dom);
$tags = $selector->query('//img | //a');
$good = NULL;
foreach( $tags AS $tag )
{
if ( \IPS\Settings::i()->ipb_url_filter_option == 'none' )
if ( ( $tag->hasAttribute( 'href' ) and !$tag->hasAttribute( 'data-mentionid' ) ) OR $tag->hasAttribute( 'src' ) )
{
return TRUE;
}
foreach( $urls AS $url )
{
$url = preg_quote( $url, '/' );
$url = str_replace( '\*', "(.+?)", $url );
if ( \IPS\Settings::i()->ipb_url_filter_option == 'black' )
if ( \IPS\Settings::i()->ipb_url_filter_option == 'none' )
{
if ( preg_match( '/' . $url . '/i', $tag->getAttribute( 'href' ) ) )
{
return TRUE;
}
return TRUE;
}
else if ( \IPS\Settings::i()->ipb_url_filter_option == 'white' )
$urlToCheck = $tag->hasAttribute( 'href' ) ? $tag->getAttribute( 'href' ) : $tag->getAttribute( 'src' );
foreach( $urls AS $url )
{
if ( is_null( $good ) AND !preg_match( '/' . $url . '/i', $tag->getAttribute( 'href' ) ) )
/* Make sure we're not doing something weird like storing a blank URL */
if ( $url )
{
$good = FALSE;
break 2;
}
else
{
$good = TRUE;
break 2;
$url = preg_quote( $url, '/' );
$url = str_replace( '\*', "(.*?)", $url );
if ( \IPS\Settings::i()->ipb_url_filter_option == 'black' )
{
if ( preg_match( '/' . $url . '/i', $urlToCheck ) )
{
return TRUE;
}
}
else if ( \IPS\Settings::i()->ipb_url_filter_option == 'white' )
{
/* @note http:// is hard-coded here as we're simply validating that the URL is on the same domain, so the protocol doesn't matter for the base_url replacement */
if ( is_null( $good ) AND !preg_match( '/' . $url . '/i', str_replace( '<___base_url___>', 'http://' . parse_url( \IPS\Settings::i()->base_url, PHP_URL_HOST ), $urlToCheck ), $matches ) )
{
$good = FALSE;
break 2;
}
else
{
$good = TRUE;
break 2;
}
}
}
}
}
}
if ( $good === FALSE AND \IPS\Settings::i()->ipb_url_filter_option == 'white' )
{
return TRUE;
}
}
if ( $good === FALSE AND \IPS\Settings::i()->ipb_url_filter_option == 'white' )
{
return TRUE;
}
catch( \Exception $e ) { }
}
catch( \Exception $e ) { }
return FALSE;
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief API output for custom fields
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 4 Mar 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\ProfileFields\Api;
@@ -1,12 +1,11 @@
<?php
/**
* @brief API output for custom fields 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 4 Mar 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\ProfileFields\Api;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Custom Profile Field Node
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 11 Apr 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\ProfileFields;
@@ -162,8 +161,12 @@ class _Field extends \IPS\CustomField
{
foreach ( $fields as $row )
{
if ( ( $row['pf_admin_only'] and $location !== static::STAFF ) or ( $location === static::REG and !$row['pf_show_on_reg'] ) or ( $location === static::PROFILE and !$row['pf_member_edit'] ) or ( $location === static::SEARCH and ( !$row['pf_search_type'] or $row['pf_member_hide'] ) ) )
if (
( $row['pf_admin_only'] and $location !== static::STAFF ) or
( $location === static::PROFILE and !$row['pf_member_edit'] ) or
( $location === static::SEARCH and ( !$row['pf_search_type'] or $row['pf_member_hide'] ) ) or
( $location === static::REG and !$row['pf_show_on_reg'] )
)
{
continue;
}
@@ -182,7 +185,6 @@ class _Field extends \IPS\CustomField
if ( $location === static::STAFF )
{
/* @link https://community.invisionpower.com/4bugtrack/active-reports/required-profile-fields-shouldnt-be-required-for-admins-r8058/ */
$row['pf_not_null'] = 0;
}
@@ -263,10 +265,25 @@ class _Field extends \IPS\CustomField
public function form( &$form )
{
parent::form( $form );
$form->add( new \IPS\Helpers\Form\TextArea( 'pf_format', $this->id ? $this->format : '', FALSE, array( 'placeholder' => "<strong>{title}:</strong> {content}" ), NULL, NULL, NULL, 'pf_format' ) );
$form->addheader( 'pfield_permissions' );
$form->add( new \IPS\Helpers\Form\YesNo( 'pf_admin_only', $this->id ? !$this->admin_only : TRUE, FALSE, array( 'togglesOn' => array( 'pf_show_on_reg', 'pf_member_edit', 'pf_member_hide' ) ) ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'pf_show_on_reg', $this->id ? $this->show_on_reg : TRUE, FALSE, array(), NULL, NULL, NULL, 'pf_show_on_reg' ) );
if ( \IPS\Settings::i()->quick_register )
{
/* Quick register is enabled, so do not allow required to be set */
if ( isset( $form->elements['']['pf_not_null'] ) )
{
unset( $form->elements['']['pf_not_null'] );
}
}
else
{
/* Quick register is off, so show normal 'reg' field */
$form->add( new \IPS\Helpers\Form\YesNo( 'pf_show_on_reg', $this->id ? $this->show_on_reg : TRUE, FALSE, array(), NULL, NULL, NULL, 'pf_show_on_reg' ) );
}
$form->add( new \IPS\Helpers\Form\YesNo( 'pf_member_edit', $this->id ? $this->member_edit : TRUE, FALSE, array(), NULL, NULL, NULL, 'pf_member_edit' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'pf_member_hide', $this->id ? !$this->member_hide : TRUE, FALSE, array(), NULL, NULL, NULL, 'pf_member_hide' ) );
}
@@ -288,11 +305,6 @@ class _Field extends \IPS\CustomField
{
$values['pf_member_hide'] = $values['pf_member_hide'] ? FALSE : TRUE;
}
if( isset( $values['pf_show_on_reg'] ) )
{
$values['pf_show_on_reg'] = $values['pf_show_on_reg'] ? TRUE : FALSE;
}
if( array_key_exists( 'pf_search_type', $values ) )
{
@@ -303,7 +315,7 @@ class _Field extends \IPS\CustomField
{
$values['pf_format'] = '';
}
return parent::formatFormValues( $values );
}
@@ -339,6 +351,14 @@ class _Field extends \IPS\CustomField
parent::delete();
\IPS\Db::i()->dropColumn( 'core_pfields_content', "field_{$this->id}" );
unset( \IPS\Data\Store::i()->profileFields );
if ( isset( static::$multitons[ $this->id ] ) )
{
unset( static::$multitons[ $this->id ] );
}
/* Do we need to do stuff with profile steps? */
\IPS\Member\ProfileStep::resync();
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Custom Profile Field Group Node
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 10 Apr 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\ProfileFields;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Facebook Profile Sync
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 13 Jun 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\ProfileSync;
@@ -159,20 +158,21 @@ class _Facebook extends ProfileSyncAbstract
* @return \IPS\core\Statuses\Status|null
*/
public function status()
{
{
try
{
$response = \IPS\Http\Url::external( "https://graph.facebook.com/{$this->member->fb_uid}/feed" )->setQueryString( 'access_token', $this->member->fb_token )->request()->get()->decodeJson();
if ( !empty( $response['data'] ) )
{
$statusData = array_shift( $response['data'] );
if( isset( $statusData['message'] ) )
foreach( $response['data'] as $statusData )
{
$status = \IPS\core\Statuses\Status::createItem( $this->member, $this->member->ip_address, new \IPS\DateTime( $statusData['created_time'] ) );
$status->content = $this->_parseStatusText( nl2br( $statusData['message'], FALSE ) );
return $status;
if( isset( $statusData['message'] ) and ! isset( $statusData['story'] ) )
{
$status = \IPS\core\Statuses\Status::createItem( $this->member, $this->member->ip_address, new \IPS\DateTime( $statusData['created_time'] ) );
$status->content = $this->_parseStatusText( nl2br( $statusData['message'], FALSE ) );
return $status;
}
}
}
}
@@ -194,4 +194,15 @@ class _Facebook extends ProfileSyncAbstract
$this->member->fb_token = NULL;
$this->member->save();
}
/**
* Get where clause to determine whether a member account is linked to this service
*
* @param bool $invert Returns clause for members not linked
* @return array|FALSE
*/
public static function memberFilterLinkedWhere( $invert=FALSE )
{
return $invert ? array( 'fb_uid=?', 0 ) : array( 'fb_uid!=?', 0 );
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Google Profile Sync
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 13 Jun 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\ProfileSync;
@@ -208,4 +207,15 @@ class _Google extends ProfileSyncAbstract
{
return \IPS\Http\Url::external( 'https://www.googleapis.com/plus/v1/' . $uri )->request()->setHeaders( array( 'Authorization' => "Bearer {$this->authToken}" ) )->get()->decodeJson();
}
/**
* Get where clause to determine whether a member account is linked to this service
*
* @param bool $invert Returns clause for members not linked
* @return array|FALSE
*/
public static function memberFilterLinkedWhere( $invert=FALSE )
{
return $invert ? array( '( google_id IS NULL or google_id = 0 )' ) : array( 'google_id > 0' );
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief LinkedIn Profile Sync
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 13 Jun 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\ProfileSync;
@@ -116,4 +115,15 @@ class _Linkedin extends ProfileSyncAbstract
$this->member->linkedin_token = NULL;
$this->member->save();
}
/**
* Get where clause to determine whether a member account is linked to this service
*
* @param bool $invert Returns clause for members not linked
* @return array|FALSE
*/
public static function memberFilterLinkedWhere( $invert=FALSE )
{
return $invert ? array( '( linkedin_id IS NULL or linkedin_id = 0 )' ) : array( 'linkedin_id > 0' );
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Microsoft Profile Sync
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 13 Jun 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\ProfileSync;
@@ -132,4 +131,15 @@ class _Microsoft extends ProfileSyncAbstract
$this->member->live_token = NULL;
$this->member->save();
}
/**
* Get where clause to determine whether a member account is linked to this service
*
* @param bool $invert Returns clause for members not linked
* @return array|FALSE
*/
public static function memberFilterLinkedWhere( $invert=FALSE )
{
return $invert ? array( '( live_id IS NULL OR live_id = 0 )' ) : array( 'live_id > 0' );
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Profile Sync Abstract Class
* @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 Jun 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\ProfileSync;
@@ -345,4 +344,15 @@ abstract class _ProfileSyncAbstract
/* Return */
return $value;
}
/**
* Get where clause to determine whether a member account is linked to this service
*
* @param bool $invert Returns clause for members not linked
* @return array|FALSE
*/
public static function memberFilterLinkedWhere( $invert=FALSE )
{
return FALSE;
}
}
@@ -1,10 +1,10 @@
<?php
/**
* @brief Twitter Profile Sync
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 13 Jun 2013
* @version SVN_VERSION_NUMBER
*/
@@ -192,4 +192,15 @@ class _Twitter extends ProfileSyncAbstract
return NULL;
}
/**
* Get where clause to determine whether a member account is linked to this service
*
* @param bool $invert Returns clause for members not linked
* @return array|FALSE
*/
public static function memberFilterLinkedWhere( $invert=FALSE )
{
return $invert ? array( '( twitter_id IS NULL or twitter_id = 0 )' ) : array( 'twitter_id > 0' );
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,124 @@
<?php
/**
* @brief Promote Table Helper showing internally 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 22 Feb 2017
*/
namespace IPS\core\Promote;
/* 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;
}
/**
* Promote Table Helper showing internally promoted items
*/
class _PublicTable extends \IPS\Helpers\Table\Table
{
/**
* @brief Sort options
*/
public $sortOptions = array( 'promote_sent' );
/**
* @brief Rows
*/
protected static $rows = null;
/**
* @brief WHERE clause
*/
protected $where = array();
/**
* Constructor
*
* @param \IPS\Http\Url Base URL
* @return void
*/
public function __construct( \IPS\Http\Url $url=NULL )
{
/* Init */
parent::__construct( $url );
$this->tableTemplate = array( \IPS\Theme::i()->getTemplate( 'promote', 'core', 'front' ), 'promotePublicTable' );
$this->rowsTemplate = array( \IPS\Theme::i()->getTemplate( 'promote', 'core', 'front' ), 'promotePublicTableRows' );
}
/**
* Set member
*
* @param \IPS\Member $member The member to filter by
* @return void
*/
public function setMember( \IPS\Member $member )
{
$this->where[] = array( 'member=?', $member->member_id );
}
/**
* Get rows
*
* @param array $advancedSearchValues Values from the advanced search form
* @return array
*/
public function getRows( $advancedSearchValues=NULL )
{
if ( static::$rows === NULL )
{
/* Check sortBy */
$this->sortBy = in_array( $this->sortBy, $this->sortOptions ) ? $this->sortBy : 'promote_sent';
/* What are we sorting by? */
$sortBy = $this->sortBy . ' ' . ( mb_strtolower( $this->sortDirection ) == 'asc' ? 'asc' : 'desc' );
/* Specify filter in where clause */
$where = isset( $this->where ) ? is_array( $this->where ) ? $this->where : array( $this->where ) : array();
if ( $this->filter and isset( $this->filters[ $this->filter ] ) )
{
$where[] = is_array( $this->filters[ $this->filter ] ) ? $this->filters[ $this->filter ] : array( $this->filters[ $this->filter ] );
}
$where[] = array( 'promote_internal=1 and promote_sent > 0' );
/* Get Count */
$count = \IPS\Db::i()->select( 'COUNT(*) as cnt', 'core_social_promote', $where )->first();
$this->pages = ceil( $count / $this->limit );
/* Get results */
$it = \IPS\Db::i()->select( '*', 'core_social_promote', $where, $sortBy, array( ( $this->limit * ( $this->page - 1 ) ), $this->limit ) );
$rows = iterator_to_array( $it );
foreach( $rows as $index => $row )
{
try
{
static::$rows[ $index ] = \IPS\core\Promote::constructFromData( $row );
}
catch ( \Exception $e ) { }
}
}
/* Return */
return static::$rows;
}
/**
* Return the table headers
*
* @param array|NULL $advancedSearchValues Advanced search values
* @return array
*/
public function getHeaders( $advancedSearchValues )
{
return array();
}
}
+122
View File
@@ -0,0 +1,122 @@
<?php
/**
* @brief Promotions Table Helper
* @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 Feb 2017
*/
namespace IPS\core\Promote;
/* 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;
}
/**
* Promote Table Helper
*/
class _Table extends \IPS\Helpers\Table\Table
{
/**
* @brief Sort options
*/
public $sortOptions = array( 'promote_scheduled' );
/**
* @brief Rows
*/
protected static $rows = null;
/**
* @brief WHERE clause
*/
protected $where = array();
/**
* Constructor
*
* @param \IPS\Http\Url Base URL
* @return void
*/
public function __construct( \IPS\Http\Url $url=NULL )
{
/* Init */
parent::__construct( $url );
$this->tableTemplate = array( \IPS\Theme::i()->getTemplate( 'promote', 'core', 'front' ), 'promoteTable' );
$this->rowsTemplate = array( \IPS\Theme::i()->getTemplate( 'promote', 'core', 'front' ), 'promoteTableRows' );
}
/**
* Set member
*
* @param \IPS\Member $member The member to filter by
* @return void
*/
public function setMember( \IPS\Member $member )
{
$this->where[] = array( 'member=?', $member->member_id );
}
/**
* Get rows
*
* @param array $advancedSearchValues Values from the advanced search form
* @return array
*/
public function getRows( $advancedSearchValues=NULL )
{
if ( static::$rows === NULL )
{
/* Check sortBy */
$this->sortBy = in_array( $this->sortBy, $this->sortOptions ) ? $this->sortBy : 'promote_scheduled';
/* What are we sorting by? */
$sortBy = $this->sortBy . ' ' . ( mb_strtolower( $this->sortDirection ) == 'asc' ? 'asc' : 'desc' );
/* Specify filter in where clause */
$where = isset( $this->where ) ? is_array( $this->where ) ? $this->where : array( $this->where ) : array();
if ( $this->filter and isset( $this->filters[ $this->filter ] ) )
{
$where[] = is_array( $this->filters[ $this->filter ] ) ? $this->filters[ $this->filter ] : array( $this->filters[ $this->filter ] );
}
/* Get Count */
$count = \IPS\Db::i()->select( 'COUNT(*) as cnt', 'core_social_promote', $where )->first();
$this->pages = ceil( $count / $this->limit );
/* Get results */
$it = \IPS\Db::i()->select( '*', 'core_social_promote', $where, $sortBy, array( ( $this->limit * ( $this->page - 1 ) ), $this->limit ) );
$rows = iterator_to_array( $it );
foreach( $rows as $index => $row )
{
try
{
static::$rows[ $index ] = \IPS\core\Promote::constructFromData( $row );
}
catch ( \Exception $e ) { }
}
}
/* Return */
return static::$rows;
}
/**
* Return the table headers
*
* @param array|NULL $advancedSearchValues Advanced search values
* @return array
*/
public function getHeaders( $advancedSearchValues )
{
return array();
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Report Comment Model
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 15 Jul 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\Reports;
+7 -7
View File
@@ -1,12 +1,11 @@
<?php
/**
* @brief Report Index Model
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 15 Jul 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\Reports;
@@ -313,10 +312,11 @@ class _Report extends \IPS\Content\Item implements \IPS\Content\ReadMarkers
* @param string $action The action
* @param \IPS\Member|NULL $member The member doing the action (NULL for currently logged in member)
* @param string|NULL $reason Reason (for hides)
* @param bool $immediately Delete immediately
* @return void
* @throws \OutOfRangeException|\InvalidArgumentException|\RuntimeException
*/
public function modAction( $action, \IPS\Member $member = NULL, $reason = NULL )
public function modAction( $action, \IPS\Member $member = NULL, $reason = NULL, $immediately = FALSE )
{
if ( mb_substr( $action, 0, -1 ) === 'report_status_' )
{
@@ -325,7 +325,7 @@ class _Report extends \IPS\Content\Item implements \IPS\Content\ReadMarkers
}
else
{
return parent::modAction( $action, $member, $reason );
return parent::modAction( $action, $member, $reason, $immediately );
}
}
+16 -5
View File
@@ -1,12 +1,11 @@
<?php
/**
* @brief RSS Exports
* @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 1 Jul 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core;
@@ -315,6 +314,18 @@ class _Rss extends \IPS\Node\Model
parent::postSaveForm( $values );
}
/**
* [ActiveRecord] Delete Record
*
* @return void
*/
public function delete()
{
parent::delete();
unset( \IPS\Data\Store::i()->rssFeeds );
}
/**
* Get Configuration
+25 -7
View File
@@ -1,12 +1,11 @@
<?php
/**
* @brief Installer
* @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 3 Apr 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\Setup;
@@ -113,7 +112,6 @@ class _Install
'message' => \IPS\Member::loggedIn()->language()->addToStack( 'requirements_mb_fail' ),
);
}
/* Extensions */
foreach ( array(
@@ -150,6 +148,12 @@ class _Install
}
}
}
/* Recommend GD freetype */
if( extension_loaded('gd') AND !function_exists( 'imagettfbbox' ) )
{
$return['advice'][] = \IPS\Member::loggedIn()->language()->addToStack( 'requirements_missing_imagettfbbox' );
}
/* Memory Limit */
$_memoryLimit = @ini_get('memory_limit');
@@ -639,6 +643,7 @@ class _Install
{
\IPS\Settings::i()->member_group = 4;
$member = new \IPS\Member;
$member->pp_photo_type = '';
$member->name = $this->adminName;
$member->email = $this->adminEmail;
$member->ip_address = \IPS\Request::i()->ipAddress();
@@ -872,7 +877,7 @@ class _Install
\IPS\Log::log( $e, 'install_error' );
}
/* Insert default emoticons */
/* Insert default emoticons and reaction */
if( $app == 'core' )
{
$setId = md5( uniqid() );
@@ -903,6 +908,19 @@ class _Install
{
\IPS\Db::i()->insert( 'core_emoticons', $inserts );
}
$position = 0;
foreach( array( 'like', 'thanks', 'haha', 'confused', 'sad' ) AS $reaction )
{
$fileObj = \IPS\File::create( 'core_Reaction', "react_{$reaction}.png", file_get_contents( \IPS\ROOT_PATH . '/' . \IPS\CP_DIRECTORY . "/install/reaction/react_{$reaction}.png" ), 'reactions', FALSE, NULL, FALSE );
$id = \IPS\Db::i()->insert( 'core_reactions', array(
'reaction_value' => ( in_array( $reaction, array( 'confused', 'sad' ) ) ) ? 0 : 1,
'reaction_icon' => (string) $fileObj,
'reaction_position' => ++$position,
'reaction_enabled' => 1,
) );
\IPS\Lang::saveCustom( 'core', 'reaction_title_' . $id, ucwords( $reaction ) );
}
}
} );
}
+6 -11
View File
@@ -1,12 +1,11 @@
<?php
/**
* @brief Upgrader
* @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 May 2014
* @version SVN_VERSION_NUMBER
* @todo MAKE DATABASE CHECK RUN BEFORE EVERYTHING ELSE
*/
@@ -36,10 +35,11 @@ class _Upgrade
/* MySQL Requirements */
$return = array_merge_recursive( $return, static::mysqlRequirements( ) );
$writeablesKey = \IPS\Member::loggedIn()->language()->addToStack('requirements_file_system');
/* Writeables */
if( \IPS\Db::i()->checkForTable('core_file_storage') )
{
$writeablesKey = \IPS\Member::loggedIn()->language()->addToStack('requirements_file_system');
$fileSystemItems = array();
foreach ( \IPS\Application::allExtensions( 'core', 'FileStorage', FALSE ) as $k => $v )
@@ -417,11 +417,6 @@ class _Upgrade
$fetched = array( 'count' => $fetched['count'] );
}
if( isset( \IPS\Request::i()->mr_continue ) AND \IPS\Request::i()->mr_continue )
{
$fetched = array( 'count' => $fetched['count'] );
}
$extra['lastSqlId'] = $_SESSION['lastJsonIndex'];
\IPS\Log::debug( (int) $fetched['count'] . ' queries run, last ID ' . $_SESSION['lastJsonIndex'], 'upgrade' );
@@ -1,12 +1,11 @@
<?php
/**
* @brief Share Links Node
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 12 Jun 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\ShareLinks;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Staff Directory Group Node
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 18 Sep 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\StaffDirectory;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Staff Directory User Node
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 18 Sep 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\StaffDirectory;
+28 -11
View File
@@ -1,12 +1,11 @@
<?php
/**
* @brief Status Update Reply Model
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 10 Feb 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\Statuses;
@@ -21,8 +20,10 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* Status Update Reply
*/
class _Reply extends \IPS\Content\Comment implements \IPS\Content\ReportCenter, \IPS\Content\Hideable, \IPS\Content\Reputation
class _Reply extends \IPS\Content\Comment implements \IPS\Content\ReportCenter, \IPS\Content\Hideable
{
use \IPS\Content\Reactable;
/**
* @brief Application
*/
@@ -80,11 +81,6 @@ class _Reply extends \IPS\Content\Comment implements \IPS\Content\ReportCenter,
*/
public static $formLangPrefix = 'status_';
/**
* @brief Reputation Type
*/
public static $reputationType = 'status_reply_id';
/**
* @brief [Content\Comment] Comment Template
*/
@@ -166,6 +162,17 @@ class _Reply extends \IPS\Content\Comment implements \IPS\Content\ReportCenter,
$notification->send();
}
/**
* Can edit?
*
* @param \IPS\Member|NULL $member The member to check for (NULL for currently logged in member)
* @return bool
*/
public function canEdit( $member=NULL )
{
return FALSE;
}
/**
* Can delete?
@@ -206,4 +213,14 @@ class _Reply extends \IPS\Content\Comment implements \IPS\Content\ReportCenter,
{
return FALSE;
}
/**
* Reaction Type
*
* @return string
*/
public static function reactionType()
{
return 'status_reply_id';
}
}
+38 -14
View File
@@ -1,12 +1,11 @@
<?php
/**
* @brief Status Update Model
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 10 Feb 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\Statuses;
@@ -21,8 +20,10 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* Status Update Model
*/
class _Status extends \IPS\Content\Item implements \IPS\Content\ReportCenter, \IPS\Content\Reputation, \IPS\Content\Lockable, \IPS\Content\Hideable, \IPS\Content\Searchable, \IPS\Content\Shareable
class _Status extends \IPS\Content\Item implements \IPS\Content\ReportCenter, \IPS\Content\Lockable, \IPS\Content\Hideable, \IPS\Content\Searchable, \IPS\Content\Shareable
{
use \IPS\Content\Reactable;
/* !\IPS\Patterns\ActiveRecord */
/**
@@ -144,11 +145,6 @@ class _Status extends \IPS\Content\Item implements \IPS\Content\ReportCenter, \I
public static $firstCommentRequired = FALSE;
/**
* @brief Reputation Type
*/
public static $reputationType = 'status_id';
/**
* @brief [Content] Key for hide reasons
*/
public static $hideLogKey = 'status_status';
@@ -276,6 +272,12 @@ class _Status extends \IPS\Content\Item implements \IPS\Content\ReportCenter, \I
return FALSE;
}
/* And not restricted */
if ( $member->members_bitoptions['bw_no_status_update'] or $member->group['gbw_no_status_update'] )
{
return FALSE;
}
return TRUE;
}
@@ -531,7 +533,18 @@ class _Status extends \IPS\Content\Item implements \IPS\Content\ReportCenter, \I
{
return ( $member->moderateNewContent() or \IPS\Settings::i()->profile_comment_approval );
}
/**
* Can edit?
*
* @param \IPS\Member|NULL $member The member to check for (NULL for currently logged in member)
* @return bool
*/
public function canEdit( $member=NULL )
{
return FALSE;
}
/**
* Can delete?
*
@@ -686,13 +699,14 @@ class _Status extends \IPS\Content\Item implements \IPS\Content\ReportCenter, \I
* @param bool $asItem Displaying results as items?
* @param bool $canIgnoreComments Can ignore comments in the result stream? Activity stream can, but search results cannot.
* @param array $template Optional custom template
* @param array $reactions Reaction Data
* @return string
*/
public static function searchResult( array $indexData, array $authorData, array $itemData, array $containerData = NULL, array $reputationData, $reviewRating, $iPostedIn, $view, $asItem, $canIgnoreComments=FALSE, $template=NULL )
public static function searchResult( array $indexData, array $authorData, array $itemData, array $containerData = NULL, array $reputationData, $reviewRating, $iPostedIn, $view, $asItem, $canIgnoreComments=FALSE, $template=NULL, $reactions=array() )
{
if ( $template !== NULL )
{
return parent::searchResult( $indexData, $authorData, $itemData, $containerData, $reputationData, $reviewRating, $iPostedIn, $view, $asItem, $canIgnoreComments, $template );
return parent::searchResult( $indexData, $authorData, $itemData, $containerData, $reputationData, $reviewRating, $iPostedIn, $view, $asItem, $canIgnoreComments, $template, $reactions );
}
$status = static::constructFromData( $itemData );
@@ -726,4 +740,14 @@ class _Status extends \IPS\Content\Item implements \IPS\Content\ReportCenter, \I
{
$className::publish( html_entity_decode( trim( strip_tags( $this->content ) ), ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8' ) );
}
/**
* Reaction Type
*
* @return string
*/
public static function reactionType()
{
return 'status_id';
}
}
+179 -18
View File
@@ -1,12 +1,11 @@
<?php
/**
* @brief Content Discovery Stream
* @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 1 Jul 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core;
@@ -339,7 +338,7 @@ class _Stream extends \IPS\Node\Model
*
* @param \IPS\Helpers\Form $form The form
* @param string $titleType 'Text' or 'Translatable
* @pram bool $titleRequired Is the title field required?
* @param bool $titleRequired Is the title field required?
* @return void
*/
public function form( &$form, $titleType='Translatable', $titleRequired=TRUE )
@@ -360,12 +359,13 @@ class _Stream extends \IPS\Node\Model
/* All content or specific content? */
$form->add( new \IPS\Helpers\Form\Radio( 'stream_classes_type', $this->classes ? 1 : 0, TRUE, array(
'options' => array( 0 => 'stream_classes_type_all', 1 => 'stream_classes_type_custom' ),
'toggles' => array( 1 => array( 'stream_classes' ) )
'toggles' => array( 0 => array( 'stream_club_select' ), 1 => array( 'stream_classes' ) )
) ) );
/* Work out all the different classes */
$classes = array();
$classToggles = array();
foreach ( \IPS\Content::routedClasses( TRUE, FALSE, TRUE ) as $class )
{
$classes[ $class ] = $class::$title . '_pl';
@@ -374,10 +374,65 @@ class _Stream extends \IPS\Node\Model
$classToggles[ $class ][] = 'stream_containers_' . $class::$title;
}
}
$containers = json_decode( $this->containers );
/* Add the fields for them */
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'stream_classes', $this->classes ? explode( ',', $this->classes ) : array(), NULL, array( 'options' => $classes, 'toggles' => $classToggles ), NULL, NULL, NULL, 'stream_classes' ) );
if ( \IPS\Dispatcher::i()->controllerLocation === 'admin' )
{
/* Nodes */
foreach ( $classToggles as $class => $id )
{
if ( isset( $class::$containerNodeClass ) )
{
$nodeClass = $class::$containerNodeClass;
$value = isset( $containers->$class ) ? $containers->$class : 0;
$field = new \IPS\Helpers\Form\Node( 'stream_containers_' . $class::$title, $value, FALSE, array( 'class' => $nodeClass, 'multiple' => TRUE, 'zeroVal' => 'all', 'permissionCheck' => $nodeClass::searchableNodesPermission(), 'forceOwner' => FALSE ), NULL, NULL, NULL, 'stream_containers_' . $class::$title );
$field->label = \IPS\Member::loggedIn()->language()->addToStack( $nodeClass::$nodeTitle );
$form->add( $field );
}
}
}
/* Clubs */
$clubs = \IPS\Member\Club::clubs( NULL, NULL, 'name', FALSE, array(), \IPS\Settings::i()->clubs_require_approval ? array( 'approved=1' ) : NULL );
if ( count( $clubs ) )
{
$clubOptions = array();
foreach ( $clubs as $club )
{
$clubOptions[ "c{$club->id}" ] = $club->name;
}
switch ( $this->clubs )
{
case NULL:
$clubSelect = 'all';
break;
case '0':
$clubSelect = 'none';
break;
default:
$clubSelect = 'select';
break;
}
$form->add( new \IPS\Helpers\Form\Radio( 'stream_club_select', $clubSelect, TRUE, array(
'options' => array(
'all' => 'stream_club_select_all',
'none' => 'stream_club_select_none',
'select' => 'stream_club_select_select',
),
'toggles' => array(
'select' => array( 'stream_club_filter' )
)
), NULL, NULL, NULL, 'stream_club_select' ) );
$form->add( new \IPS\Helpers\Form\Select( 'stream_club_filter', explode( ',', $this->clubs ), FALSE, array( 'options' => $clubOptions, 'parse' => 'none', 'multiple' => TRUE, 'noDefault' => TRUE ), NULL, NULL, NULL, 'stream_club_filter' ) );
}
/* Tags */
if ( \IPS\Settings::i()->tags_enabled )
{
@@ -531,6 +586,39 @@ class _Stream extends \IPS\Node\Model
}
unset( $values['stream_classes_type'] );
/* Clubs */
if ( isset( $values['stream_club_select'] ) and ( !isset( $values['stream_classes_type'] ) or $values['stream_classes_type'] == 0 ) )
{
switch ( $values['stream_club_select'] )
{
case 'all':
$values['stream_clubs'] = NULL;
break;
case 'none':
$values['stream_clubs'] = 0;
break;
case 'select':
if ( $values['stream_club_filter'] )
{
$values['stream_clubs'] = is_array( $values['stream_club_filter'] ) ? implode( ',', $values['stream_club_filter'] ) : $values['stream_club_filter'];
}
else
{
$values['stream_clubs'] = 0;
}
break;
}
}
else
{
$values['stream_clubs'] = NULL;
}
unset( $values['stream_club_select'] );
unset( $values['stream_club_filter'] );
/* And tags */
if ( isset( $values['stream_tags'] ) )
{
@@ -697,6 +785,35 @@ class _Stream extends \IPS\Node\Model
$terms = array();
if ( $this->clubs === '0' )
{
$terms[] = \IPS\Member::loggedIn()->language()->addToStack('stream_blurb_no_clubs');
}
elseif ( $this->clubs )
{
$clubs = array();
foreach ( explode( ',', $this->clubs ) as $clubId )
{
try
{
$club = \IPS\Member\Club::load( ltrim( $clubId, 'c' ) );
if ( $club->canRead( \IPS\Member::loggedIn() ) )
{
$clubs[] = $club->name;
}
}
catch ( \Exception $e ) { }
}
if ( count( $clubs ) )
{
$terms[] = \IPS\Member::loggedIn()->language()->addToStack( 'stream_blurb_in_clubs', FALSE, array( 'sprintf' => array( \IPS\Member::loggedIn()->language()->formatList( $clubs ) ) ) );
}
else
{
$terms[] = \IPS\Member::loggedIn()->language()->addToStack('stream_blurb_no_clubs');
}
}
if ( $this->tags )
{
$terms[] = \IPS\Member::loggedIn()->language()->addToStack( 'stream_includes_tags', FALSE, array( 'sprintf' => array( \IPS\Member::loggedIn()->language()->formatList( array_map( function( $val ){
@@ -818,9 +935,26 @@ class _Stream extends \IPS\Node\Model
'stream_date_type' => $this->date_type,
'stream_classes' => NULL,
'stream_unread_links' => $this->unread_links,
'containers' => static::containersToUrl( $this->containers )
'containers' => static::containersToUrl( $this->containers ),
);
/* Clubs */
switch ( $this->clubs )
{
case NULL:
$config['stream_club_select'] = 'all';
$config['stream_club_filter'] = '';
break;
case '0':
$config['stream_club_select'] = 'none';
$config['stream_club_filter'] = '0';
break;
default:
$config['stream_club_select'] = 'select';
$config['stream_club_filter'] = $this->clubs;
break;
}
/* Follows */
$followedTypes = explode( ',', $this->followed_types );
$config['stream_followed_types'] = array();
@@ -929,8 +1063,10 @@ class _Stream extends \IPS\Node\Model
$query = \IPS\Content\Search\Query::init( $member );
/* Content Filters */
$filters = array();
$allowedContainers = $this->containers ? json_decode( $this->containers, TRUE ) : array();
$filters = array();
$allowedContainers = $this->containers ? json_decode( $this->containers, TRUE ) : array();
$classesChecked = array();
if ( $this->classes )
{
/* Translate how we store this into the format needed for filterByContent */
@@ -958,7 +1094,7 @@ class _Stream extends \IPS\Node\Model
if ( ! $this->include_comments or ( isset( $options['items'] ) and !isset( $options['comments'] ) and in_array( 'IPS\Content\Item', class_parents( $class ) ) and $class::$firstCommentRequired ) )
{
/* items with no comments are flagged as being the last comment */
$filter = \IPS\Content\Search\ContentFilter::init( $class, TRUE, TRUE, isset( $options['reviews'] ) )->onlyLastComment();
$filter = \IPS\Content\Search\ContentFilter::init( $class, TRUE, TRUE, TRUE )->onlyLastComment();
}
else
{
@@ -973,9 +1109,10 @@ class _Stream extends \IPS\Node\Model
/* Add to the array */
$filters[] = $filter;
$classesChecked[] = $class;
}
}
elseif ( !$this->include_comments )
else
{
foreach ( \IPS\Application::allExtensions( 'core', 'ContentRouter', FALSE ) as $object )
{
@@ -983,17 +1120,38 @@ class _Stream extends \IPS\Node\Model
{
if ( in_array( 'IPS\Content\Item', class_parents( $class ) ) )
{
$filters[] = \IPS\Content\Search\ContentFilter::init( $class, TRUE, TRUE, FALSE )->onlyLastComment();
if( !$this->include_comments )
{
$filters[] = \IPS\Content\Search\ContentFilter::init( $class, TRUE, TRUE, TRUE )->onlyLastComment();
}
$classesChecked[] = $class;
}
}
}
}
/* Give content item classes a chance to inspect and manipulate filters */
foreach( $classesChecked as $itemClass )
{
$itemClass::searchEngineFiltering( $filters, $query );
}
if ( count( $filters ) )
{
$query->filterByContent( $filters );
}
/* Clubs */
if ( $this->clubs === '0' )
{
$query->filterByClub( NULL );
}
elseif ( $this->clubs )
{
$query->filterByClub( array_map( function( $val ) { return ltrim( $val, 'c' ); }, explode( ',', $this->clubs ) ) );
}
/* Ownership */
switch ( $this->ownership )
{
@@ -1023,16 +1181,19 @@ class _Stream extends \IPS\Node\Model
$query->filterByFollowed( in_array( 'containers', $followTypes ), in_array( 'items', $followTypes ), in_array( 'members', $followTypes ) );
}
/* If we are showing all items (not grouping on last comment, then we need to filter by creation date */
$filterDateMethod = ( $this->include_comments ) ? 'filterByCreateDate' : 'filterByLastUpdatedDate';
/* Date */
switch ( $this->date_type )
{
case 'last_visit':
$query->filterByLastUpdatedDate( \IPS\DateTime::ts( \IPS\Member::loggedIn()->last_visit ) );
$query->$filterDateMethod( \IPS\DateTime::ts( \IPS\Member::loggedIn()->last_visit ) );
break;
case 'relative':
$query->filterByLastUpdatedDate( \IPS\DateTime::create()->sub( new \DateInterval( 'P' . intval( $this->date_relative_days ) . 'D' ) ) );
$query->$filterDateMethod( \IPS\DateTime::create()->sub( new \DateInterval( 'P' . intval( $this->date_relative_days ) . 'D' ) ) );
case 'custom':
$query->filterByLastUpdatedDate( $this->date_start ? \IPS\DateTime::ts( $this->date_start ) : NULL, $this->date_end ? \IPS\DateTime::ts( $this->date_end ) : NULL );
$query->$filterDateMethod( $this->date_start ? \IPS\DateTime::ts( $this->date_start ) : NULL, $this->date_end ? \IPS\DateTime::ts( $this->date_end ) : NULL );
break;
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief Warning Reason Node
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 23 Apr 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\Warnings;
@@ -1,12 +1,11 @@
<?php
/**
* @brief Warning Model
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 23 Jul 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\Warnings;
@@ -546,6 +545,7 @@ class _Warning extends \IPS\Content\Item
}
$member->members_bitoptions['unacknowledged_warnings'] = (bool) \IPS\Settings::i()->warnings_acknowledge;
$member->save();
$member->logHistory( 'core', 'warning', array( 'wid' => $this->id ) );
parent::processAfterCreate( $comment, $values );
}