Version 3.2.3

This commit is contained in:
Neo committed 2025-12-19 00:34:03 -08:00
1 parent ae5c01cc78
commit 78706903a2
2641 files changed
+228363 -201264

No files matched your search

@@ -2,18 +2,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Global Search
* Last Updated: $Date: 2010-02-19 01:29:54 +0000 (Fri, 19 Feb 2010) $
* Last Updated: $Date: 2011-08-08 07:05:57 -0400 (Mon, 08 Aug 2011) $
* </pre>
*
* @author $Author: josh $
* @author $Author: mmecham $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @subpackage Core
* @link http://www.invisionpower.com
* @version $Rev: 5855 $
* @link http://hatynka.in
* @version $Rev: 9376 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -61,7 +61,7 @@ class search_engine
*
* @access public
* @param object ipsRegistry $registry
* @return void
* @return @e void
*/
public function __construct( ipsRegistry $registry )
{
@@ -77,13 +77,13 @@ class search_engine
$this->caches =& $this->registry->cache()->fetchCaches();
/* Do we have the sphinxes? */
if( ! file_exists( 'sphinxapi.php' ) )
if( ! is_file( 'sphinxapi.php' ) )
{
$registry->output->showError( 'sphinx_api_missing', 10182 );
}
/* Load Sphinx */
require( 'sphinxapi.php' );
require( 'sphinxapi.php' );/*noLibHook*/
$this->sphinxClient = new SphinxClient();
$this->sphinxClient->SetServer( $this->settings['search_sphinx_server'], intval( $this->settings['search_sphinx_port'] ) );
@@ -117,13 +117,14 @@ class search_engine
*/
public function viewNewContent()
{
$app = IPSSearchRegistry::get('in.search_app');
$lastActive = IPSLib::fetchHighestNumber( array( intval( $this->memberData['_cache']['gb_mark__' . $app] ), intval( $this->memberData['last_visit'] ) ) );
$app = IPSSearchRegistry::get('in.search_app');
$seconds = IPSSearchRegistry::get('in.period_in_seconds');
IPSSearchRegistry::set('in.search_sort_by' , 'date' );
IPSSearchRegistry::set('in.search_sort_order', 'desc' );
$this->setDateRange( $lastActive, time() );
/* Set time stamp */
$this->setDateRange( intval( time() - $seconds ), time() );
/* Force title search only */
IPSSearchRegistry::set('opt.searchTitleOnly', true);
@@ -145,7 +146,6 @@ class search_engine
IPSSearchRegistry::set('in.search_sort_by' , 'date' );
IPSSearchRegistry::set('in.search_sort_order', 'desc' );
IPSSearchRegistry::set('opt.searchTitleOnly', IPSSearchRegistry::get('in.view_by_title') );
IPSSearchRegistry::set('display.onlyTitles' , IPSSearchRegistry::get('in.view_by_title') );
IPSSearchRegistry::set('opt.noPostPreview' , IPSSearchRegistry::get('in.view_by_title') );
/* Set the member_id */
@@ -162,23 +162,6 @@ class search_engine
return $this->search();
}
/**
* Perform the search
* Populates $this->_count and $this->_results
*
* @access public
* @return nothin'
*/
public function viewActiveContent()
{
$seconds = IPSSearchRegistry::get('in.period_in_seconds');
/* Set time stamp */
$this->setDateRange( time() - $seconds, time() );
return $this->search();
}
/**
* Can handle boolean searching
*
@@ -209,10 +192,10 @@ class search_engine
$search_term = IPSText::mbstrtolower( $search_term );
/* Check for disallowed search terms */
while( preg_match_all( "/(?:^|\s+)(img|quote|code|html|javascript|a href|color|span|div|border|style)(?:\s+|$)/", $search_term, $removed_search_terms ) )
while( preg_match_all( '/(?:^|\s+)(img|quote|code|html|javascript|a href|color|span|div|border|style)(?:\s+|$)/', $search_term, $removed_search_terms ) )
{
$removedTerms[] = $removed_search_terms[0][0];
$search_term = preg_replace( "/(^|\s+)(?:img|quote|code|html|javascript|a href|color|span|div|border|style)(\s+|$)/", str_replace( " ", " ", "$1$2" ), $search_term );
$search_term = preg_replace( '/(^|\s+)(?:img|quote|code|html|javascript|a href|color|span|div|border|style)(\s+|$)/', str_replace( " ", " ", "$1$2" ), $search_term );
}
/* Remove some formatting */
@@ -221,11 +204,11 @@ class search_engine
$search_term = str_replace( array( '\\', '/' ), '', $search_term );
/* Sphinx chars are not allowed */
$search_term = str_replace( array( '.', ')', '(', '!', '@', '[', ']' ), '', $search_term );
$search_term = str_replace( array( '.', ')', '(', '!', '@', '[', ']', '-', '~', '^' ), '', $search_term );
if ( $andor == 'or' )
{
$search_term = preg_replace( "/\s+(?!-|~)/", " | ", $search_term );
$search_term = preg_replace( '/\s+/', " | ", $search_term );
}
return array( 'search_term' => $search_term, 'removed' => $removedTerms );
@@ -237,10 +220,12 @@ class search_engine
* @access public
* @param int $begin Start timestamp
* @param int [$end] End timestamp
* @return void
* @return @e void
*/
public function setDateRange( $begin, $end=0 )
{
$begin = ( $begin < 1000000000 ) ? 1000000000 : $begin;
$this->search_begin_timestamp = $begin;
$this->search_end_timestamp = $end;
}
@@ -251,7 +236,7 @@ class search_engine
* @access public
* @param string $column sql table column for this condition
* @return string column
* @return void
* @return @e void
*/
public function remapColumn( $column )
{
@@ -266,7 +251,7 @@ class search_engine
* @param string $operator Operation to perform for this condition, ex: =, <>, IN, NOT IN
* @param mixed $value Value to check with
* @param string $comp Comparison type
* @return void
* @return @e void
*/
public function setCondition( $column, $operator, $value, $comp='AND' )
{
@@ -316,7 +301,7 @@ class search_engine
* @param array $conditions Array of conditions, each element has 3 keys: column, operator, value, see the setCondition function for information on each
* @param string $inner_comp Comparison operator to use inside the chain
* @param string $outer_comp Comparison operator to use outside the chain
* @return void
* @return @e void
*/
public function setMultiConditions( $conditions, $inner_comp='OR', $outer_comp='AND' )
{
@@ -328,7 +313,7 @@ class search_engine
* Checks and logs any errors
*
* @access public
* @return void
* @return @e void
*/
public function logSphinxWarnings()
{