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

+5 -6
View File
@@ -1,12 +1,11 @@
<?php
/**
* @brief activeUsers Widget
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 19 Nov 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\widgets;
@@ -55,7 +54,7 @@ class _activeUsers extends \IPS\Widget
$memberCount = 0;
/* Build WHERE clause */
$parts = parse_url( (string) \IPS\Request::i()->url() );
$parts = parse_url( (string) \IPS\Request::i()->url()->stripQueryString( array( 'page' ) ) );
if ( \IPS\Settings::i()->htaccess_mod_rewrite )
{
+4 -5
View File
@@ -1,12 +1,11 @@
<?php
/**
* @brief Announcements Widget
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 19 Nov 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\widgets;
+181
View File
@@ -0,0 +1,181 @@
<?php
/**
* @brief Clubs Widget
* @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 24 Apr 2017
*/
namespace IPS\core\widgets;
/* 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;
}
/**
* Clubs Widget
*/
class _clubs extends \IPS\Widget
{
/**
* @brief Widget Key
*/
public $key = 'clubs';
/**
* @brief App
*/
public $app = 'core';
/**
* @brief Plugin
*/
public $plugin = '';
/**
* Specify widget configuration
*
* @param null|\IPS\Helpers\Form $form Form object
* @return null|\IPS\Helpers\Form
*/
public function configuration( &$form=null )
{
if ( $form === null )
{
$form = new \IPS\Helpers\Form;
}
$form->add( new \IPS\Helpers\Form\Translatable( 'widget_feed_title', isset( $this->configuration['language_key'] ) ? NULL : \IPS\Member::loggedIn()->language()->addToStack( 'my_clubs' ), FALSE, array( 'app' => 'core', 'key' => ( isset( $this->configuration['language_key'] ) ? $this->configuration['language_key'] : NULL ) ) ) );
$form->add( new \IPS\Helpers\Form\Radio( 'club_filter_type', isset( $this->configuration['club_filter_type'] ) ? $this->configuration['club_filter_type'] : 'mine', TRUE, array( 'options' => array(
'mine' => 'user_clubs',
'all' => 'all_clubs',
) ) ) );
$fields = \IPS\Member\Club\CustomField::roots();
foreach ( $fields as $field )
{
if ( $field->filterable )
{
switch ( $field->type )
{
case 'Checkbox':
case 'YesNo':
$input = new \IPS\Helpers\Form\CheckboxSet( 'field_' . $field->id, isset( $this->configuration['filters'][ $field->id ] ) ? $this->configuration['filters'][ $field->id ] : array( 1, 0 ), FALSE, array( 'options' => array(
1 => 'yes',
0 => 'no',
) ) );
$input->label = $field->_title;
$form->add( $input );
break;
case 'CheckboxSet':
case 'Radio':
case 'Select':
$options = json_decode( $field->extra, TRUE );
$input = new \IPS\Helpers\Form\CheckboxSet( 'field_' . $field->id, isset( $this->configuration['filters'][ $field->id ] ) ? $this->configuration['filters'][ $field->id ] : array_keys( $options ), FALSE, array( 'options' => $options ) );
$input->label = $field->_title;
$form->add( $input );
break;
}
}
}
$form->add( new \IPS\Helpers\Form\Radio( 'sort_by', isset( $this->configuration['sort_by'] ) ? $this->configuration['sort_by'] : 'last_activity', TRUE, array( 'options' => array(
'last_activity' => 'clubs_sort_last_activity',
'members' => 'clubs_sort_members',
'content' => 'clubs_sort_content',
'created' => 'clubs_sort_created',
) ) ) );
$form->add( new \IPS\Helpers\Form\Number( 'number_to_show', isset( $this->configuration['number_to_show'] ) ? $this->configuration['number_to_show'] : 10, TRUE ) );
return $form;
}
/**
* Ran before saving widget configuration
*
* @param array $values Values from form
* @return array
*/
public function preConfig( $values )
{
if ( !isset( $this->configuration['language_key'] ) )
{
$this->configuration['language_key'] = 'widget_title_' . md5( uniqid() );
}
$values['language_key'] = $this->configuration['language_key'];
\IPS\Lang::saveCustom( 'core', $this->configuration['language_key'], $values['widget_feed_title'] );
unset( $values['widget_feed_title'] );
$fields = \IPS\Member\Club\CustomField::roots();
foreach ( $fields as $field )
{
if ( $field->filterable )
{
switch ( $field->type )
{
case 'Checkbox':
case 'YesNo':
if ( count( $values[ 'field_' . $field->id ] ) === 1 )
{
$values['filters'][ $field->id ] = array_pop( $values[ 'field_' . $field->id ] );
}
unset( $values[ 'field_' . $field->id ] );
break;
case 'CheckboxSet':
case 'Radio':
case 'Select':
$options = json_decode( $field->extra, TRUE );
if ( count( $values[ 'field_' . $field->id ] ) > 0 and count( $values[ 'field_' . $field->id ] ) < count( $options ) )
{
$values['filters'][ $field->id ] = array();
foreach ( $values[ 'field_' . $field->id ] as $v )
{
$values['filters'][ $field->id ][] = $options[ $v ];
}
}
unset( $values[ 'field_' . $field->id ] );
break;
}
}
}
return $values;
}
/**
* Render a widget
*
* @return string
*/
public function render()
{
if ( \IPS\Settings::i()->clubs and \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'clubs', 'front' ) ) )
{
$clubs = \IPS\Member\Club::clubs(
\IPS\Member::loggedIn(),
isset( $this->configuration['number_to_show'] ) ? $this->configuration['number_to_show'] : 10,
isset( $this->configuration['sort_by'] ) ? $this->configuration['sort_by'] : 'last_activity',
!isset( $this->configuration['club_filter_type'] ) or $this->configuration['club_filter_type'] == 'mine',
isset( $this->configuration['filters'] ) ? $this->configuration['filters'] : array()
);
if ( count( $clubs ) )
{
return $this->output(
$clubs,
isset( $this->configuration['language_key'] ) ? \IPS\Member::loggedIn()->language()->addToStack( $this->configuration['language_key'], FALSE, array( 'escape' => TRUE ) ) : \IPS\Member::loggedIn()->language()->addToStack( 'my_clubs' ),
$this->orientation
);
}
}
return '';
}
}
+157
View File
@@ -0,0 +1,157 @@
<?php
/**
* @brief guestSignUp Widget
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 26 Mar 2017
*/
namespace IPS\core\widgets;
/* 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;
}
/**
* guestSignUp Widget
*/
class _guestSignUp extends \IPS\Widget\StaticCache
{
/**
* @brief Widget Key
*/
public $key = 'guestSignUp';
/**
* @brief App
*/
public $app = 'core';
/**
* @brief Plugin
*/
public $plugin = '';
/**
* @brief Cache Expiration
* @note We allow this cache to be valid for 60 seconds
*/
public $cacheExpiration = 60;
/**
* Constructor
*
* @param String $uniqueKey Unique key for this specific instance
* @param array $configuration Widget custom configuration
* @param null|string|array $access Array/JSON string of executable apps (core=sidebar only, content=IP.Content only, etc)
* @param null|string $orientation Orientation (top, bottom, right, left)
* @return void
*/
public function __construct( $uniqueKey, array $configuration, $access=null, $orientation=null )
{
parent::__construct($uniqueKey, $configuration, $access, $orientation);
$this->errorMessage = 'guest_signup_admin_message';
}
/**
* Specify widget configuration
*
* @param null|\IPS\Helpers\Form $form Form object
* @return null|\IPS\Helpers\Form
*/
public function configuration( &$form=null )
{
if ( $form === null )
{
$form = new \IPS\Helpers\Form;
}
$form->add( new \IPS\Helpers\Form\Translatable( 'block_guestsignup_title', NULL, TRUE, array( 'app'=>'core', 'key' =>'widget_guestsignup_title' ) ) );
$form->add( new \IPS\Helpers\Form\Translatable( 'block_guestsignup_message', NULL, TRUE, array(
'app' => 'core',
'key' => 'widget_guestsignup_text',
'editor' => array(
'app' => 'core',
'key' => 'GuestSignupWidget',
'autoSaveKey' => 'widget-' . $this->uniqueKey,
'attachIds' => isset( $this->configuration['content'] ) ? array( 0, 0, 'widget_guestsignup_text' ) : NULL
),
) ) );
return $form;
}
/**
* Before the widget is removed, we can do some clean up
*
* @return void
*/
public function delete()
{
\IPS\Lang::deleteCustom( 'core', 'widget_guestsignup_title' );
\IPS\Lang::deleteCustom( 'core', 'widget_guestsignup_text' );
foreach( \IPS\Db::i()->select( '*', 'core_attachments_map', array( array( 'location_key=?', 'core_GuestSignupWidget' ) ) ) as $map )
{
try
{
$attachment = \IPS\Db::i()->select( '*', 'core_attachments', array( 'attach_id=?', $map['attachment_id'] ) )->first();
\IPS\Db::i()->delete( 'core_attachments_map', array( array( 'attachment_id=?', $attachment['attach_id'] ) ) );
\IPS\Db::i()->delete( 'core_attachments', array( 'attach_id=?', $attachment['attach_id'] ) );
\IPS\File::get( 'core_Attachment', $attachment['attach_location'] )->delete();
if ( $attachment['attach_thumb_location'] )
{
\IPS\File::get( 'core_Attachment', $attachment['attach_thumb_location'] )->delete();
}
}
catch ( \Exception $e ) { }
}
}
/**
* Ran before saving widget configuration
*
* @param array $values Values from form
* @return array
*/
public function preConfig( $values )
{
\IPS\File::claimAttachments( 'widget-' . $this->uniqueKey, 0, 0, 'widget_guestsignup_text' );
\IPS\Lang::saveCustom( 'core', 'widget_guestsignup_text', $values[ 'block_guestsignup_message' ] );
\IPS\Lang::saveCustom( 'core', 'widget_guestsignup_title', $values[ 'block_guestsignup_title' ] );
return $values;
}
/**
* Render a widget
*
* @return string
*/
public function render()
{
/* Show this only to guests */
if ( \IPS\Member::loggedIn()->member_id )
{
return '';
}
else
{
$title = \IPS\Member::loggedIn()->language()->addToStack( 'widget_guestsignup_title' );
$text = \IPS\Member::loggedIn()->language()->addToStack( 'widget_guestsignup_text' );
if ( !\IPS\Member::loggedIn()->language()->checkKeyExists( 'widget_guestsignup_title' ) )
{
return '';
}
$login = new \IPS\Login( \IPS\Http\Url::internal( 'app=core&module=system&controller=login', 'front', 'login', NULL, \IPS\Settings::i()->logins_over_https ) );
return $this->output( $login, $title, $text );
}
}
}
+4 -5
View File
@@ -1,12 +1,11 @@
<?php
/**
* @brief Members Widget
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 10 July 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\widgets;
+92
View File
@@ -0,0 +1,92 @@
<?php
/**
* @brief Promoted Content Widget
* @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 March 2017
*/
namespace IPS\core\widgets;
/* 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;
}
/**
* Promoted Content Widget
*/
class _promoted extends \IPS\Widget\PermissionCache
{
/**
* @brief Widget Key
*/
public $key = 'promoted';
/**
* @brief App
*/
public $app = 'core';
/**
* @brief Plugin
*/
public $plugin = '';
/**
* Initialize widget
*
* @return null
*/
public function init()
{
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'styles/promote.css', 'core' ) );
if ( \IPS\Theme::i()->settings['responsive'] )
{
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'styles/promote_responsive.css', 'core' ) );
}
parent::init();
}
/**
* Specify widget configuration
*
* @param null|\IPS\Helpers\Form $form Form object
* @return \IPS\Helpers\Form
*/
public function configuration( &$form=null )
{
if ( $form === null )
{
$form = new \IPS\Helpers\Form;
}
$form->add( new \IPS\Helpers\Form\Number( 'toshow', isset( $this->configuration['toshow'] ) ? $this->configuration['toshow'] : 5, TRUE ) );
return $form;
}
/**
* Render a widget
*
* @return string
*/
public function render()
{
$limit = isset ( $this->configuration['toshow'] ) ? $this->configuration['toshow'] : 5;
$stream = \IPS\core\Promote::internalStream( $limit );
if ( ! count( $stream ) )
{
return '';
}
return $this->output( $stream );
}
}
@@ -1,12 +1,11 @@
<?php
/**
* @brief recentStatusUpdates Widget
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 04 Jun 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\widgets;
+4 -5
View File
@@ -1,12 +1,11 @@
<?php
/**
* @brief Related Content Widget
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @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
*/
+4 -5
View File
@@ -1,12 +1,11 @@
<?php
/**
* @brief Stats Widget
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 21 Nov 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\widgets;
@@ -1,12 +1,11 @@
<?php
/**
* @brief topContributors Widget
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 02 Jul 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\widgets;
+4 -5
View File
@@ -1,12 +1,11 @@
<?php
/**
* @brief whosOnline Widget
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 28 Jul 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\widgets;