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 Search
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 18 Apr 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\core\modules\front\search;
@@ -209,6 +208,23 @@ class _search extends \IPS\Dispatcher\Controller
$where[] = \IPS\Db::i()->in( 'core_members.member_group_id', $groups );
}
}
else
{
$exclude = array();
/* Groups not specified but we still want to omit non searchable groups */
foreach( \IPS\Member\Group::groups() as $group )
{
if ( $group->g_bitoptions['gbw_hide_group'] )
{
$exclude[] = $group->g_id;
}
}
if ( count( $exclude ) )
{
$where[] = \IPS\Db::i()->in( 'core_members.member_group_id', $exclude, TRUE );
}
}
/* Figure out member custom field filters */
foreach ( \IPS\core\ProfileFields\Field::fields( array(), \IPS\core\ProfileFields\Field::SEARCH ) as $group => $fields )
@@ -412,6 +428,34 @@ class _search extends \IPS\Dispatcher\Controller
}
}
/* Filter by club */
if ( isset( \IPS\Request::i()->club ) )
{
$clubIds = array();
$clubNames = array();
foreach ( explode( ',', \IPS\Request::i()->club ) as $clubId )
{
try
{
$club = \IPS\Member\Club::load( ltrim( $clubId, 'c' ) );
if ( $club->canRead() )
{
$clubIds[] = $club->id;
$clubNames[] = $club->name;
}
}
catch ( \OutOfRangeException $e ) { }
}
if ( count( $clubIds ) )
{
$query->filterByClub( $clubIds );
$baseUrl = $baseUrl->setQueryString( 'club', \IPS\Request::i()->club );
$titleConditions[] = \IPS\Member::loggedIn()->language()->addToStack( 'search_blurb_club', FALSE, array( 'sprintf' => array( \IPS\Member::loggedIn()->language()->formatList( $clubNames, \IPS\Member::loggedIn()->language()->get('or_list_format') ) ) ) );
}
}
/* Set time cutoffs */
foreach ( array( 'start' => 'filterByCreateDate', 'updated' => 'filterByLastUpdatedDate' ) as $k => $method )
{
@@ -649,7 +693,7 @@ class _search extends \IPS\Dispatcher\Controller
$contentTypes = $this->_contentTypes();
$contentToggles = array();
$typeFields = array();
$typeFieldToggles = array('' => array() );
$typeFieldToggles = array('' => array( 'club' ) );
$haveCommentClass = FALSE;
$haveReplyClass = FALSE;
$haveReviewClass = FALSE;
@@ -730,6 +774,19 @@ class _search extends \IPS\Dispatcher\Controller
/* Author */
$form->add( new \IPS\Helpers\Form\Member( 'author', NULL, FALSE, array(), NULL, NULL, NULL, 'author' ), NULL, 'search_tab_content' );
/* Club */
$clubs = \IPS\Member\Club::clubs( \IPS\Member::loggedIn(), NULL, 'name', TRUE );
if ( count( $clubs ) )
{
$clubOptions = array();
foreach ( $clubs as $club )
{
$clubOptions[ "c{$club->id}" ] = $club->name;
}
$form->add( new \IPS\Helpers\Form\Select( 'club', NULL, FALSE, array( 'options' => $clubOptions, 'parse' => 'normal', 'multiple' => TRUE, 'noDefault' => TRUE, 'class' => 'ipsContained' ), NULL, NULL, NULL, 'club' ), NULL, 'search_tab_content' );
}
/* Dates */
$form->add( new \IPS\Helpers\Form\Select( 'startDate', ( isset( \IPS\Request::i()->start_before ) or ( isset( \IPS\Request::i()->start_after ) and is_numeric( \IPS\Request::i()->start_after ) ) ) ? 'custom' : \IPS\Request::i()->start_after, FALSE, array( 'options' => $dateOptions, 'toggles' => array( 'custom' => array( 'elCustomDate_startDate' ) ) ), NULL, NULL, NULL, 'startDate' ), NULL, 'search_tab_content' );
$form->add( new \IPS\Helpers\Form\DateRange( 'startDateCustom', array( 'start' => ( isset( \IPS\Request::i()->start_after ) and is_numeric( \IPS\Request::i()->start_after ) ) ? \IPS\DateTime::ts( \IPS\Request::i()->start_after ) : NULL, 'end' => isset( \IPS\Request::i()->start_before ) ? \IPS\DateTime::ts( \IPS\Request::i()->start_before ) : NULL ) ), NULL, 'search_tab_content' );
@@ -746,7 +803,7 @@ class _search extends \IPS\Dispatcher\Controller
if ( isset( $class::$containerNodeClass ) )
{
$nodeClass = $class::$containerNodeClass;
$field = new \IPS\Helpers\Form\Node( $k . '_node', ( isset( \IPS\Request::i()->nodes ) ) ? \IPS\Request::i()->nodes : NULL, FALSE, array( 'class' => $nodeClass, 'multiple' => TRUE, 'permissionCheck' => $nodeClass::searchableNodesPermission(), 'forceOwner' => FALSE ), NULL, NULL, NULL, $k . '_node' );
$field = new \IPS\Helpers\Form\Node( $k . '_node', ( isset( \IPS\Request::i()->nodes ) ) ? \IPS\Request::i()->nodes : NULL, FALSE, array( 'class' => $nodeClass, 'multiple' => TRUE, 'permissionCheck' => $nodeClass::searchableNodesPermission(), 'forceOwner' => FALSE, 'clubs' => \IPS\IPS::classUsesTrait( $nodeClass, 'IPS\Content\ClubContainer' ) ), NULL, NULL, NULL, $k . '_node' );
$field->label = \IPS\Member::loggedIn()->language()->addToStack( $nodeClass::$nodeTitle );
$form->add( $field, NULL, 'search_tab_nodes' );
}
@@ -893,6 +950,10 @@ class _search extends \IPS\Dispatcher\Controller
{
$url = $url->setQueryString( 'author', $values['author']->name );
}
if ( isset( $values['club'] ) and $values['club'] )
{
$url = $url->setQueryString( 'club', $values['club'] );
}
if ( isset( $values['group'] ) and $values['group'] )
{