Version 4.1.19

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

No files matched your search

+45 -18
View File
@@ -2,9 +2,9 @@
/**
* @brief activeUsers Widget
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 19 Nov 2013
* @version SVN_VERSION_NUMBER
*/
@@ -50,11 +50,31 @@ class _activeUsers extends \IPS\Widget
{
return "";
}
$members = array();
$memberCount = 0;
/* Build WHERE clause */
$parts = parse_url( (string) \IPS\Request::i()->url() );
$url = $parts['scheme'] . "://" . $parts['host'] . $parts['path'];
if ( \IPS\Settings::i()->htaccess_mod_rewrite )
{
$url = $parts['scheme'] . "://" . $parts['host'] . $parts['path'];
}
else
{
$url = $parts['scheme'] . "://" . $parts['host'] . $parts['path'] . ( isset( $parts['query'] ) ? '?' . $parts['query'] : '' );
}
$notInMyName = array();
foreach( \IPS\Member\Group::groups() as $group )
{
if ( $group->g_hide_online_list )
{
$notInMyName[] = $group->g_id;
}
}
$where = array(
array( 'core_sessions.login_type=' . \IPS\Session\Front::LOGIN_TYPE_MEMBER ),
array( 'core_sessions.current_appcomponent=?', \IPS\Dispatcher::i()->application->directory ),
@@ -62,8 +82,7 @@ class _activeUsers extends \IPS\Widget
array( 'core_sessions.current_controller=?', \IPS\Dispatcher::i()->controller ),
array( 'core_sessions.running_time>' . \IPS\DateTime::create()->sub( new \DateInterval( 'PT30M' ) )->getTimeStamp() ),
array( 'core_sessions.location_url IS NOT NULL AND location_url LIKE ?', "{$url}%" ),
array( 'core_sessions.member_id IS NOT NULL' ),
array( 'core_groups.g_hide_online_list=0' )
array( 'core_sessions.member_id IS NOT NULL' )
);
if( \IPS\Request::i()->id )
@@ -71,19 +90,26 @@ class _activeUsers extends \IPS\Widget
$where[] = array( 'core_sessions.current_id = ?', \IPS\Request::i()->id );
}
/* Get members */
if ( $this->orientation === 'vertical' )
if ( count( $notInMyName ) )
{
$members = \IPS\Db::i()->select( 'core_sessions.member_id,core_sessions.member_name,core_sessions.seo_name,core_sessions.member_group', 'core_sessions', $where, 'core_sessions.running_time DESC', 60, NULL, NULL, \IPS\Db::SELECT_SQL_CALC_FOUND_ROWS )->join( 'core_members', 'core_members.member_id=core_sessions.member_id' )->join( 'core_groups', 'core_members.member_group_id=core_groups.g_id' )->setKeyField( 'member_id' );
$memberCount = $members->count( TRUE );
$where[] = array( \IPS\Db::i()->in( 'core_sessions.member_group', $notInMyName, TRUE ) );
}
else
foreach( \IPS\Db::i()->select( 'core_sessions.member_id,core_sessions.member_name,core_sessions.seo_name,core_sessions.member_group,core_sessions.login_type', 'core_sessions', $where, 'core_sessions.running_time DESC' ) as $row )
{
$members = \IPS\Db::i()->select( 'core_sessions.member_id,core_sessions.member_name,core_sessions.seo_name,core_sessions.member_group', 'core_sessions', $where, 'core_sessions.running_time DESC' )->join( 'core_members', 'core_members.member_id=core_sessions.member_id' )->join( 'core_groups', 'core_members.member_group_id=core_groups.g_id' )->setKeyField( 'member_id' );
$memberCount = $members->count();
if( $row['login_type'] == \IPS\Session\Front::LOGIN_TYPE_MEMBER and $row['member_id'] != \IPS\Member::loggedIn()->member_id and $row['member_name'] )
{
$members[ $row['member_id'] ] = $row;
}
}
$memberCount = count( $members );
/* If it's on the sidebar (rather than at the bottom), we want to limit it to 60 so we don't take too much space */
if ( $this->orientation === 'vertical' and count( $members ) >= 60 )
{
$members = array_slice( $members, 0, 60 );
}
$members = iterator_to_array( $members );
if( \IPS\Member::loggedIn()->member_id )
{
@@ -93,13 +119,14 @@ class _activeUsers extends \IPS\Widget
{
$memberCount++;
}
$members[ \IPS\Member::loggedIn()->member_id ] = array(
$members = array_merge( array( \IPS\Member::loggedIn()->member_id => array(
'member_id' => \IPS\Member::loggedIn()->member_id,
'member_name' => \IPS\Member::loggedIn()->name,
'seo_name' => \IPS\Member::loggedIn()->members_seo_name,
'member_group' => \IPS\Member::loggedIn()->member_group_id
);
) ), $members );
}
}
+13 -3
View File
@@ -2,9 +2,9 @@
/**
* @brief Announcements Widget
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 19 Nov 2013
* @version SVN_VERSION_NUMBER
*/
@@ -38,6 +38,11 @@ class _announcements extends \IPS\Widget
*/
public $plugin = '';
/**
* @brief Prevent caching for this block
*/
public $neverCache = TRUE;
/**
* Specify widget configuration
*
@@ -53,7 +58,6 @@ class _announcements extends \IPS\Widget
$form->add( new \IPS\Helpers\Form\Number( 'toshow', isset( $this->configuration['toshow'] ) ? $this->configuration['toshow'] : 5, TRUE ) );
$form->add( new \IPS\Helpers\Form\Select( 'sort_by', isset( $this->configuration['sort_by'] ) ? $this->configuration['sort_by'] : 'asc', TRUE, array( 'options' => array( 'asc' => 'ascending', 'desc' => 'descending' ) ) ) );
return $form;
}
@@ -64,11 +68,17 @@ class _announcements extends \IPS\Widget
*/
public function render()
{
if ( !\IPS\Settings::i()->announcements_exist )
{
return '';
}
$announcements = array();
$where = array();
$where[] = array( 'announce_active=?', 1 );
$where[] = array( 'announce_start<? AND ( announce_end=0 OR announce_end>? )', time(), time() );
$where[] = array( '(' . \IPS\Db::i()->findInSet( 'announce_permissions', \IPS\Member::loggedIn()->groups ) . ' OR ' . 'announce_permissions=? )', '*' );
$clauses = array();
$params = array();
+13 -4
View File
@@ -2,9 +2,9 @@
/**
* @brief Members Widget
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 10 July 2015
* @version SVN_VERSION_NUMBER
*/
@@ -63,6 +63,8 @@ class _members extends \IPS\Widget\StaticCache
NULL,
'widget_member_groups'
) );
$form->add( new \IPS\Helpers\Form\Checkbox( 'widget_member_secondary_groups', isset( $this->configuration['widget_member_secondary_groups'] ) ? $this->configuration['widget_member_secondary_groups'] : FALSE, FALSE ) );
$form->add( new \IPS\Helpers\Form\Number( 'widget_member_posts', isset( $this->configuration['widget_member_posts'] ) ? $this->configuration['widget_member_posts'] : 0, FALSE ) );
$form->add( new \IPS\Helpers\Form\Number( 'widget_member_rep' , isset( $this->configuration['widget_member_rep'] ) ? $this->configuration['widget_member_rep'] : 0, FALSE ) );
@@ -124,7 +126,14 @@ class _members extends \IPS\Widget\StaticCache
if ( ! empty( $this->configuration['widget_member_groups'] ) AND $this->configuration['widget_member_groups'] !== '*' )
{
$where[] = array( \IPS\Db::i()->in( 'member_group_id', $this->configuration['widget_member_groups'] ) );
$groupWhere = \IPS\Db::i()->in( 'member_group_id', $this->configuration['widget_member_groups'] );
if ( ! empty( $this->configuration['widget_member_secondary_groups'] ) )
{
$groupWhere .= ' OR ' . \IPS\Db::i()->findInSet( 'mgroup_others', $this->configuration['widget_member_groups'] );
}
$where[] = array( '(' . $groupWhere . ')' );
}
if ( ! empty( $this->configuration['widget_member_posts'] ) )
@@ -148,7 +157,7 @@ class _members extends \IPS\Widget\StaticCache
$mon = $time->format('n');
$mday = $time->format('j');
$year = $time->format('Y');
$where[] = array( 'bday_month=?', $time->mon );
$where[] = array( 'bday_month=?', $mon );
if ( $mon == 2 AND $mday == 28 AND ! ( gmdate( 'L', $year ) ) )
{
@@ -2,9 +2,9 @@
/**
* @brief recentStatusUpdates Widget
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 04 Jun 2014
* @version SVN_VERSION_NUMBER
*/
@@ -72,7 +72,9 @@ class _recentStatusUpdates extends \IPS\Widget\PermissionCache
{
return '';
}
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_core.js', 'core' ) );
$statuses = new \IPS\Patterns\ActiveRecordIterator(
\IPS\Db::i()->select(
'*',
+5 -3
View File
@@ -2,9 +2,9 @@
/**
* @brief Related Content Widget
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 28 Apr 2014
* @version SVN_VERSION_NUMBER
* @note This widget is designed to be enabled on a page that displays a content item (e.g. a topic) to show related content based on tags
@@ -69,7 +69,9 @@ class _relatedContent extends \IPS\Widget
return '';
}
$related = \IPS\Dispatcher::i()->dispatcherController->getSimilarContent();
$limit = isset ( $this->configuration['toshow'] ) ? $this->configuration['toshow'] : 5;
$related = \IPS\Dispatcher::i()->dispatcherController->getSimilarContent( $limit );
if( $related === NULL or !count( $related ) )
{
+15 -14
View File
@@ -2,9 +2,9 @@
/**
* @brief Stats Widget
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 21 Nov 2013
* @version SVN_VERSION_NUMBER
*/
@@ -88,12 +88,16 @@ class _stats extends \IPS\Widget\StaticCache
{
$stats = array();
$mostOnline = json_decode( \IPS\Settings::i()->most_online, TRUE );
/* fetch only successful registered members ; if this needs to be changed, please review the other areas where we have the name<>? AND email<>? condition */
$where = array( 'name<>? AND email<>?', '', '' );
/* Member count */
$stats['member_count'] = \IPS\Db::i()->select( 'COUNT(*)', 'core_members', array( 'name<>? AND email<>?', '', '' ) )->first();
$stats['member_count'] = \IPS\Db::i()->select( 'COUNT(*)', 'core_members', $where )->first();
/* Most online */
$count = \IPS\Db::i()->select( 'COUNT(*)', 'core_sessions', array( 'login_type<>? and running_time > ?', \IPS\Session\Front::LOGIN_TYPE_SPIDER, \IPS\DateTime::create()->sub( new \DateInterval( 'PT30M' ) )->getTimeStamp() ) )->first();
$select = \IPS\Db::i()->select( 'COUNT(*)', 'core_sessions', array( 'login_type<>? and running_time > ?', \IPS\Session\Front::LOGIN_TYPE_SPIDER, \IPS\DateTime::create()->sub( new \DateInterval( 'PT30M' ) )->getTimeStamp() ), NULL, NULL, 'member_id', NULL, \IPS\Db::SELECT_SQL_CALC_FOUND_ROWS );
$count = $select->count(TRUE);
if( $count > $mostOnline['count'] )
{
$mostOnline = array( 'count' => $count, 'time' => time() );
@@ -104,7 +108,7 @@ class _stats extends \IPS\Widget\StaticCache
/* Last Registered Member */
$exclude = array();
$where = array( 'name IS NOT NULL AND name != \'\' AND temp_ban != -1' );
$where = array( array( "name IS NOT NULL AND name != '' AND temp_ban != -1 AND email != ''" ) );
foreach( \IPS\Member\Group::groups() as $id => $group )
{
if ( $group->g_hide_online_list )
@@ -114,17 +118,14 @@ class _stats extends \IPS\Widget\StaticCache
}
if ( count( $exclude ) )
{
$where[] = '( ! ( ' . \IPS\Db::i()->in( 'member_group_id', $exclude ) . ' ) )';
$where[] = array( '( ! ( ' . \IPS\Db::i()->in( 'member_group_id', $exclude ) . ' ) )' );
}
$where[] = '( ! ' . \IPS\Db::i()->bitwiseWhere( \IPS\Member::$bitOptions['members_bitoptions'], 'bw_is_spammer' ) . ' )';
$where[] = 'core_validating.new_reg IS NULL';
$where[] = array( '( ! ' . \IPS\Db::i()->bitwiseWhere( \IPS\Member::$bitOptions['members_bitoptions'], 'bw_is_spammer' ) . ' )' );
$where[] = array( 'member_id NOT IN(?)', \IPS\Db::i()->select( 'member_id', 'core_validating', array( 'new_reg=1' ) ) );
try
{
$stats['last_registered'] = \IPS\Member::constructFromData(
\IPS\Db::i()->select( 'core_members.*, core_validating.new_reg', 'core_members', array( implode( ' AND ', $where ) ), 'core_members.member_id DESC', array( 0, 1 ) )->join(
'core_validating',
"core_validating.member_id=core_members.member_id"
)->first() );
$stats['last_registered'] = \IPS\Member::constructFromData( \IPS\Db::i()->select( 'core_members.*', 'core_members', $where, 'core_members.member_id DESC', array( 0, 1 ) )->first() );
}
catch( \UnderflowException $ex )
{
@@ -2,9 +2,9 @@
/**
* @brief topContributors Widget
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 02 Jul 2014
* @version SVN_VERSION_NUMBER
*/
+58 -26
View File
@@ -2,9 +2,9 @@
/**
* @brief whosOnline Widget
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 28 Jul 2014
* @version SVN_VERSION_NUMBER
*/
@@ -50,51 +50,83 @@ class _whosOnline extends \IPS\Widget
{
return "";
}
$where = array(
array( 'core_sessions.running_time>' . \IPS\DateTime::create()->sub( new \DateInterval( 'PT30M' ) )->getTimeStamp() ),
array( 'core_groups.g_hide_online_list=0' )
);
/* Init */
$members = array();
$memberCount = 0;
$guests = 0;
$anonymous = 0;
foreach( \IPS\Db::i()->select( 'core_sessions.member_id,core_sessions.member_name,core_sessions.seo_name,core_sessions.member_group,core_sessions.login_type', 'core_sessions', $where, 'core_sessions.running_time DESC', $this->orientation === 'horizontal' ? NULL : 60 )->join( 'core_groups', 'core_sessions.member_group=core_groups.g_id' ) as $row )
$notInMyName = array();
foreach( \IPS\Member\Group::groups() as $group )
{
if ( $group->g_hide_online_list )
{
$notInMyName[] = $group->g_id;
}
}
/* Query */
$where = array(
array( 'core_sessions.running_time>?', \IPS\DateTime::create()->sub( new \DateInterval( 'PT30M' ) )->getTimeStamp() ),
array( "core_sessions.login_type!=?", \IPS\Session\Front::LOGIN_TYPE_SPIDER )
);
if ( count( $notInMyName ) )
{
$where[] = array( \IPS\Db::i()->in( 'core_sessions.member_group', $notInMyName, TRUE ) );
}
foreach( \IPS\Db::i()->select( 'core_sessions.member_id,core_sessions.member_name,core_sessions.seo_name,core_sessions.member_group,core_sessions.login_type', 'core_sessions', $where, 'core_sessions.running_time DESC' ) as $row )
{
switch ( $row['login_type'] )
{
/* Not-anonymous Member */
case \IPS\Session\Front::LOGIN_TYPE_MEMBER:
$members[ $row['member_id'] ] = $row;
if ( $row['member_id'] != \IPS\Member::loggedIn()->member_id ) // We add them manually to make sure they go at the top of the list
{
if ( $row['member_name'] )
{
$members[ $row['member_id'] ] = $row;
}
else
{
$guests += 1;
}
}
break;
/* Anonymous member */
case \IPS\Session\Front::LOGIN_TYPE_ANONYMOUS:
$anonymous += 1;
break;
/* Guest */
case \IPS\Session\Front::LOGIN_TYPE_GUEST:
case \IPS\Session\Front::LOGIN_TYPE_INCOMPLETE:
$guests += 1;
break;
}
}
$memberCount = count( $members );
if( \IPS\Member::loggedIn()->member_id )
/* If it's on the sidebar (rather than at the bottom), we want to limit it to 60 so we don't take too much space */
if ( $this->orientation === 'vertical' and count( $members ) >= 60 )
{
if( !\IPS\Member::loggedIn()->group['g_hide_online_list'] )
{
if( !isset( $members[ \IPS\Member::loggedIn()->member_id ] ) )
{
$memberCount++;
}
$members[ \IPS\Member::loggedIn()->member_id ] = array(
'member_id' => \IPS\Member::loggedIn()->member_id,
'member_name' => \IPS\Member::loggedIn()->name,
'seo_name' => \IPS\Member::loggedIn()->members_seo_name,
'member_group' => \IPS\Member::loggedIn()->member_group_id
);
}
$members = array_slice( $members, 0, 60 );
}
/* Add ourselves at the top of the list */
if( \IPS\Member::loggedIn()->member_id and !\IPS\Member::loggedIn()->group['g_hide_online_list'] )
{
$memberCount++;
$members = array_merge( array( \IPS\Member::loggedIn()->member_id => array(
'member_id' => \IPS\Member::loggedIn()->member_id,
'member_name' => \IPS\Member::loggedIn()->name,
'seo_name' => \IPS\Member::loggedIn()->members_seo_name,
'member_group' => \IPS\Member::loggedIn()->member_group_id
) ), $members );
}
/* Display */