Version 3.0.5
This commit is contained in:
1 parent
19b38c7c74
commit
1d4720f3e2
3755 files changed
+508378
-664541
No files matched your search
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Member property updater (AJAX)
|
||||
* Last Updated: $Date: 2009-08-20 18:20:40 -0400 (Thu, 20 Aug 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 1st march 2002
|
||||
* @version $Revision: 5035 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_member_form__core implements admin_member_form
|
||||
{
|
||||
/**
|
||||
* Tab name
|
||||
* This can be left blank and the application title will
|
||||
* be used
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $tab_name = "";
|
||||
|
||||
|
||||
/**
|
||||
* Returns sidebar links for this tab
|
||||
* You may return an empty array or FALSE to not have
|
||||
* any links show in the sidebar for this block.
|
||||
*
|
||||
* The links must have 'section=xxxxx&module=xxxxx[&do=xxxxxx]'. The rest of the URL
|
||||
* is added automatically.
|
||||
*
|
||||
* The image must be a full URL or blank to use a default image.
|
||||
*
|
||||
* Use the format:
|
||||
* $array[] = array( 'img' => '', 'url' => '', 'title' => '' );
|
||||
*
|
||||
* @access public
|
||||
* @author Matt Mecham
|
||||
* @param array Member data
|
||||
* @return array Array of links
|
||||
*/
|
||||
public function getSidebarLinks( $member=array() )
|
||||
{
|
||||
$array = array();
|
||||
|
||||
if( $member['failed_login_count'] )
|
||||
{
|
||||
$array[] = array( 'img' => '',
|
||||
'url' => "app=members&module=members&section=tools&do=do_locked&auth_key=".ipsRegistry::member()->form_hash."&mid_{$member['member_id']}=1&type=unlock",
|
||||
'title' => "Сбросить" );
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns content for the page.
|
||||
*
|
||||
* @access public
|
||||
* @author Matt Mecham
|
||||
* @param array Member data
|
||||
* @return array Array of tabs, content
|
||||
*/
|
||||
public function getDisplayContent( $member=array() )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the entries for saving and return
|
||||
*
|
||||
* @access public
|
||||
* @author Brandon Farber
|
||||
* @return array Multi-dimensional array (core, extendedProfile) for saving
|
||||
*/
|
||||
public function getForSave()
|
||||
{
|
||||
return array( 'core' => array(), 'extendedProfile' => array() );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Core Sessions
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 4948 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Main loader class
|
||||
*/
|
||||
class publicSessions__core
|
||||
{
|
||||
/**
|
||||
* Return session variables for this application
|
||||
*
|
||||
* current_appcomponent, current_module and current_section are automatically
|
||||
* stored. This function allows you to add specific variables in.
|
||||
*
|
||||
* @access public
|
||||
* @author Matt Mecham
|
||||
* @return array
|
||||
*/
|
||||
public function getSessionVariables()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$array = array( 'location_1_type' => '',
|
||||
'location_1_id' => 0,
|
||||
'location_2_type' => '',
|
||||
'location_2_id' => 0 );
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse/format the online list data for the records
|
||||
*
|
||||
* @access public
|
||||
* @author Brandon Farber
|
||||
* @param array Online list rows to check against
|
||||
* @return array Online list rows parsed
|
||||
*/
|
||||
public function parseOnlineEntries( $rows )
|
||||
{
|
||||
if( !is_array($rows) OR !count($rows) )
|
||||
{
|
||||
return $rows;
|
||||
}
|
||||
|
||||
$final = array();
|
||||
|
||||
foreach( $rows as $row )
|
||||
{
|
||||
if( $row['current_appcomponent'] == 'core' )
|
||||
{
|
||||
if( $row['current_module'] == 'global' )
|
||||
{
|
||||
if( $row['current_section'] == 'login' )
|
||||
{
|
||||
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['WHERE_login'];
|
||||
}
|
||||
}
|
||||
else if( $row['current_module'] == 'search' )
|
||||
{
|
||||
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['WHERE_search'];
|
||||
}
|
||||
else if( $row['current_module'] == 'reports' )
|
||||
{
|
||||
$rcCache = ipsRegistry::cache()->getCache('report_cache');
|
||||
|
||||
if( is_array( $rcCache ) )
|
||||
{
|
||||
if( $rcCache['group_access'][ ipsRegistry::member()->getProperty('member_group_id') ] == true )
|
||||
{
|
||||
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['WHERE_reports'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$final[ $row['id'] ] = $row;
|
||||
}
|
||||
|
||||
return $final;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Core registered caches, redirect resets and bitwise settings
|
||||
* Last Updated: $Date: 2009-11-25 17:27:38 -0500 (Wed, 25 Nov 2009) $
|
||||
*
|
||||
* @author $Author: josh $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 5477 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Which caches to load by default
|
||||
*/
|
||||
$_LOAD = array();
|
||||
|
||||
if ( $_GET['module'] == 'search' )
|
||||
{
|
||||
$_LOAD['ranks'] = 1;
|
||||
$_LOAD['bbcode'] = 1;
|
||||
$_LOAD['emoticons'] = 1;
|
||||
$_LOAD['reputation_levels'] = 1;
|
||||
}
|
||||
|
||||
if ( $_GET['module'] == 'reports' )
|
||||
{
|
||||
$_LOAD['ranks'] = 1;
|
||||
$_LOAD['bbcode'] = 1;
|
||||
$_LOAD['emoticons'] = 1;
|
||||
}
|
||||
|
||||
if( $_GET['module'] == 'usercp' )
|
||||
{
|
||||
$_LOAD['ranks'] = 1;
|
||||
$_LOAD['reputation_levels'] = 1;
|
||||
$_LOAD['emoticons'] = 1;
|
||||
}
|
||||
|
||||
|
||||
/* Never, ever remove or re-order these options!!
|
||||
* Feel free to add, though. :) */
|
||||
|
||||
$_BITWISE = array();
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* BBCode Management : Determines if bbcode can be used in this section
|
||||
* Last Updated: $LastChangedDate: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 4948 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/*
|
||||
* An array of key => value pairs
|
||||
* When going to parse, the key should be passed to the editor
|
||||
* to determine which bbcodes should be parsed in the section
|
||||
*
|
||||
*/
|
||||
$BBCODE = array(
|
||||
'reports' => ipsRegistry::getClass('class_localization')->words['ctype__reports'],
|
||||
);
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Sets up SEO templates
|
||||
* Last Updated: $Date: 2009-03-04 15:08:31 +0000 (Wed, 04 Mar 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 4136 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* SEO templates
|
||||
*
|
||||
* 'allowRedirect' is a flag to tell IP.Board whether to check the incoming link and if not formatted correctly, redirect the correct one
|
||||
*
|
||||
* OUT FORMAT REGEX:
|
||||
* First array element is a regex to run to see if we've a match for the URL
|
||||
* The second array element is the template to use the results of the parenthesis capture
|
||||
*
|
||||
* Special variable #{__title__} is replaced with the $title data passed to output->formatUrl( $url, $title)
|
||||
*
|
||||
* IMPORTANT: Remember that when these regex are used, the output has not been fully parsed so you will get:
|
||||
* showuser={$data['member_id']} NOT showuser=1 so do not try and match numerics only!
|
||||
*
|
||||
* IN FORMAT REGEX
|
||||
*
|
||||
* This allows the registry to piece back together a URL based on the template regex
|
||||
* So, for example: "/user/(\d+?)/", 'matches' => array( array( 'showuser' => '$1' ) )tells IP.Board to populate 'showuser' with the result
|
||||
* of the parenthesis capture #1
|
||||
*/
|
||||
$_SEOTEMPLATES = array(
|
||||
|
||||
'section=register' => array( 'app' => 'core',
|
||||
'allowRedirect' => 0,
|
||||
'out' => array( '#app=core(&|&)module=global(&|&)section=register(&|&|$)#i', 'register/$3' ),
|
||||
'in' => array( 'regex' => "#/register/?(.+?)?$#i",
|
||||
'matches' => array( array( 'app', 'core' ), array( 'module', 'global' ), array( 'section', 'register' ) ) ) ),
|
||||
|
||||
'section=rss' => array( 'app' => 'core',
|
||||
'allowRedirect' => 0,
|
||||
'out' => array( '#app=core(&|&)module=global(&|&)section=rss(&|&)type=(\w+?)$#i', 'rss/$4/' ),
|
||||
'in' => array( 'regex' => "#/rss/(\w+?)/$#i",
|
||||
'matches' => array( array( 'app', 'core' ), array( 'module', 'global' ), array( 'section', 'rss' ), array( 'type', '$1' ) ) ) ),
|
||||
|
||||
'section=rss2' => array( 'app' => 'core',
|
||||
'allowRedirect' => 0,
|
||||
'out' => array( '#app=core(&|&)module=global(&|&)section=rss(&|&)type=(\w+?)(&|&)id=(\d+?)$#i', 'rss/$4/$6-#{__title__}/' ),
|
||||
'in' => array( 'regex' => "#/rss/(\w+?)/(\d+?)-#i",
|
||||
'matches' => array( array( 'app', 'core' ), array( 'module', 'global' ), array( 'section', 'rss' ), array( 'type', '$1' ), array( 'id', '$2' ) ) ) ),
|
||||
|
||||
#http://81.98.113.31/invisionboard3/index.php?app=core&module=global§ion=rss&type=forums&id=1
|
||||
);
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* RSS output plugin :: report center
|
||||
* Last Updated: $Date: 2009-03-12 13:47:14 -0400 (Thu, 12 Mar 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 6/24/2008
|
||||
* @version $Revision: 4206 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class rss_output_core
|
||||
{
|
||||
/**
|
||||
* Expiration date
|
||||
*
|
||||
* @access private
|
||||
* @var integer Expiration timestamp
|
||||
*/
|
||||
private $expires = 0;
|
||||
|
||||
/**
|
||||
* Grab the RSS links
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getRssLinks()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// As this is member specific, hardcoded
|
||||
// into output library
|
||||
//-----------------------------------------
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Grab the RSS document content and return it
|
||||
*
|
||||
* @access public
|
||||
* @return string RSS document
|
||||
*/
|
||||
public function returnRSSDocument()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$member_id = intval( ipsRegistry::$request['member_id'] );
|
||||
$secure_key = IPSText::md5Clean( ipsRegistry::$request['rss_key'] );
|
||||
$rss_data = array();
|
||||
$to_print = '';
|
||||
|
||||
if( $secure_key and $member_id )
|
||||
{
|
||||
if( $member_id == ipsRegistry::member()->getProperty('member_id') )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get RSS export
|
||||
//-----------------------------------------
|
||||
|
||||
$rss_data = ipsRegistry::DB()->buildAndFetch( array( 'select' => 'rss_cache',
|
||||
'from' => 'rc_modpref',
|
||||
'where' => "mem_id=" . $member_id . " AND rss_key='" . $secure_key . "'" ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Got one?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $rss_data['rss_cache'] )
|
||||
{
|
||||
return $rss_data['rss_cache'];
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Create a dummy one
|
||||
//-----------------------------------------
|
||||
|
||||
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'public_reports' ), 'core' );
|
||||
|
||||
require_once( IPS_KERNEL_PATH . 'classRss.php' );
|
||||
$rss = new classRss();
|
||||
$channel_id = $rss->createNewChannel( array( 'title' => ipsRegistry::getClass('class_localization')->words['rss_feed_title'],
|
||||
'link' => ipsRegistry::$settings['board_url'],
|
||||
'description' => ipsRegistry::getClass('class_localization')->words['reports_rss_desc'],
|
||||
'pubDate' => $rss->formatDate( time() )
|
||||
) );
|
||||
$rss->createRssDocument();
|
||||
|
||||
return $rss->rss_document;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Grab the RSS document expiration timestamp
|
||||
*
|
||||
* @access public
|
||||
* @return integer Expiration timestamp
|
||||
*/
|
||||
public function grabExpiryDate()
|
||||
{
|
||||
return time() + 3600;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Formats help file search results
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $author$
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 4948 $
|
||||
**/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class coreSearchDisplay implements iSearchDisplay
|
||||
{
|
||||
/**
|
||||
* The search plugin for this app
|
||||
*
|
||||
* @access public
|
||||
* @var object
|
||||
*/
|
||||
public $search_plugin;
|
||||
|
||||
/**
|
||||
* Formats the member search result for display
|
||||
*
|
||||
* @access public
|
||||
* @param array $search_row Array of data from search_index
|
||||
* @return string Formatted content, ready for display
|
||||
**/
|
||||
public function formatContent( $search_row )
|
||||
{
|
||||
return ipsRegistry::getClass( 'output' )->getTemplate( 'search' )->helpSearchResult( $search_row, $this->search_plugin->onlyTitles );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retuns the html for displaying the member filter on the advanced search page
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
**/
|
||||
public function getFilterHTML()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifies the SQL query
|
||||
*
|
||||
* @access public
|
||||
* @param array
|
||||
* @return array
|
||||
**/
|
||||
public function buildFilterSQL( $data )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,387 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Basic Help Files Search
|
||||
* Last Updated: $Date: 2009-01-09 15:37:32 -0500 (Fri, 09 Jan 2009) $
|
||||
*
|
||||
* @author $Author: josh $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 3627 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class searchCorePlugin implements iSearchIndexPlugin
|
||||
{
|
||||
/**
|
||||
* Database object
|
||||
*
|
||||
* @access private
|
||||
* @var object
|
||||
*/
|
||||
private $DB;
|
||||
|
||||
/**
|
||||
* Date range restriction start
|
||||
*
|
||||
* @access private
|
||||
* @var integer
|
||||
*/
|
||||
private $search_begin_timestamp = 0;
|
||||
|
||||
/**
|
||||
* Date range restriction end
|
||||
*
|
||||
* @access private
|
||||
* @var integer
|
||||
*/
|
||||
private $search_end_timestamp = 0;
|
||||
|
||||
/**
|
||||
* Array of conditions for this search
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private $whereConditions = array();
|
||||
|
||||
/**
|
||||
* Remoe self from search results
|
||||
*
|
||||
* @access public
|
||||
* @var boolean
|
||||
*/
|
||||
public $removeSelf = false;
|
||||
|
||||
/**
|
||||
* Only display title
|
||||
*
|
||||
* @access public
|
||||
* @var boolean
|
||||
*/
|
||||
public $onlyTitles = false;
|
||||
|
||||
/**
|
||||
* Setup registry objects
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry $registry
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry )
|
||||
{
|
||||
$this->DB = $registry->DB();
|
||||
$this->member = $registry->member();
|
||||
$this->memberData =& $registry->member()->fetchMemberData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs search and returns an array of results
|
||||
*
|
||||
* @access public
|
||||
* @param string $search_term
|
||||
* @param array $limit_clause The erray should be array( begin, end )
|
||||
* @param string $sort_by Column to sort by
|
||||
* @param string $group_by Column to group by
|
||||
* @param bool $content_title_only Only search title records
|
||||
* @return array
|
||||
*/
|
||||
public function getSearchResults( $search_term, $limit_clause, $sort_by, $group_by='', $content_title_only=false, $sort_order='' )
|
||||
{
|
||||
/* User prefs */
|
||||
$order_dir = ( $sort_order == 'asc' ) ? 'asc' : 'desc';
|
||||
|
||||
/* Group By */
|
||||
if( $group_by )
|
||||
{
|
||||
$group_by = 'h.' . $group_by;
|
||||
}
|
||||
|
||||
/* Do the search */
|
||||
$this->DB->build( array(
|
||||
'select' => "h.*",
|
||||
'from' => array( 'faq' => 'h' ),
|
||||
'where' => $this->_buildWhereStatement( $search_term, $content_title_only ),
|
||||
'limit' => $limit_clause,
|
||||
'order' => 'h.id ' . $order_dir,
|
||||
'group' => $group_by,
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 'i.*',
|
||||
'from' => array( 'permission_index' => 'i' ),
|
||||
'where' => "i.perm_type='help' AND i.perm_type_id=1",
|
||||
'type' => 'left',
|
||||
),
|
||||
)
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
/* Build result array */
|
||||
$rows = array();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
/* Reassign stuff to match the search_index */
|
||||
$rows[] = $this->formatFieldsForIndex( $r );
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs live search and returns an array of results
|
||||
* NOT AVAILABLE IN BASIC SEARCH
|
||||
*
|
||||
* @access public
|
||||
* @param string $search_term
|
||||
* @return array
|
||||
*/
|
||||
public function getLiveSearchResults( $search_term )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the total number of results the search will return
|
||||
*
|
||||
* @access public
|
||||
* @param string $search_term Search term
|
||||
* @param string $group_by Column to group by
|
||||
* @param bool $content_title_only Only search title records
|
||||
* @return integer
|
||||
*/
|
||||
public function getSearchCount( $search_term, $group_by='', $content_title_only=false )
|
||||
{
|
||||
/* Group By */
|
||||
if( $group_by )
|
||||
{
|
||||
$group_by = 'h.' . $group_by;
|
||||
}
|
||||
|
||||
/* Query the count */
|
||||
$this->DB->build( array(
|
||||
'select' => 'COUNT(*) as total_results',
|
||||
'from' => array( 'faq' => 'h' ),
|
||||
'where' => $this->_buildWhereStatement( $search_term, $content_title_only ),
|
||||
'group' => $group_by,
|
||||
'add_join' => array(
|
||||
array(
|
||||
'from' => array( 'permission_index' => 'i' ),
|
||||
'where' => "i.perm_type='help' AND i.perm_type_id=1",
|
||||
'type' => 'left',
|
||||
),
|
||||
)
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
$search = $this->DB->fetch();
|
||||
|
||||
/* Return the count */
|
||||
return $search['total_results'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Restrict the date range that the search is performed on
|
||||
*
|
||||
* @access public
|
||||
* @param int $begin Start timestamp
|
||||
* @param int [$end] End timestamp
|
||||
* @return void
|
||||
*/
|
||||
public function setDateRange( $begin, $end=0 )
|
||||
{
|
||||
$this->search_begin_timestamp = $begin;
|
||||
$this->search_end_timestamp = $end;
|
||||
}
|
||||
|
||||
/**
|
||||
* mySQL function for adding special search conditions
|
||||
*
|
||||
* @access public
|
||||
* @param string $column sql table column for this condition
|
||||
* @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
|
||||
*/
|
||||
public function setCondition( $column, $operator, $value, $comp='AND' )
|
||||
{
|
||||
/* Remap */
|
||||
return;
|
||||
|
||||
/* Build the condition based on operator */
|
||||
switch( strtoupper( $operator ) )
|
||||
{
|
||||
case 'IN':
|
||||
case 'NOT IN':
|
||||
$this->whereConditions[$comp][] = "h.{$column} {$operator} ( {$value} )";
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->whereConditions[$comp][] = "h.{$column} {$operator} {$value}";
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows you to specify multiple conditions that are chained together
|
||||
*
|
||||
* @access public
|
||||
* @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
|
||||
*/
|
||||
public function setMultiConditions( $conditions, $inner_comp='OR', $outer_comp='AND' )
|
||||
{
|
||||
return;
|
||||
|
||||
/* Loop through the conditions to build the statement */
|
||||
$_temp = array();
|
||||
|
||||
foreach( $conditions as $r )
|
||||
{
|
||||
switch( strtoupper( $r['operator'] ) )
|
||||
{
|
||||
case 'IN':
|
||||
case 'NOT IN':
|
||||
$_temp[] = "h.{$r['column']} {$r['operator']} ( {$r['value']} )";
|
||||
break;
|
||||
|
||||
default:
|
||||
$_temp[] = "h.{$r['column']} {$r['operator']} {$r['value']}";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->whereConditions[$outer_comp][] = '( ' . implode( $_temp, ' ' . $inner_comp . ' ' ) . ' ) ';
|
||||
}
|
||||
|
||||
/**
|
||||
* Set search conditions for "View unread content"
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function setUnreadConditions()
|
||||
{
|
||||
$this->removeSelf = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the where portion of a search string
|
||||
*
|
||||
* @access private
|
||||
* @param string $search_term The string to use in the search
|
||||
* @param bool $content_title_only Search only title records
|
||||
* @return string
|
||||
**/
|
||||
private function _buildWhereStatement( $search_term, $content_title_only=false )
|
||||
{
|
||||
/* INI */
|
||||
$where_clause = array();
|
||||
|
||||
if( $search_term )
|
||||
{
|
||||
if( $content_title_only )
|
||||
{
|
||||
$where_clause[] = "h.title LIKE '%{$search_term}%'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$where_clause[] = "h.title LIKE '%{$search_term}%' OR h.text LIKE '%{$search_term}%' OR h.description LIKE '%{$search_term}%'";
|
||||
}
|
||||
}
|
||||
|
||||
/* Add in AND where conditions */
|
||||
if( isset( $this->whereConditions['AND'] ) && count( $this->whereConditions['AND'] ) )
|
||||
{
|
||||
$where_clause = array_merge( $where_clause, $this->whereConditions['AND'] );
|
||||
}
|
||||
|
||||
/* ADD in OR where conditions */
|
||||
if( isset( $this->whereConditions['OR'] ) && count( $this->whereConditions['OR'] ) )
|
||||
{
|
||||
$where_clause[] = '( ' . implode( ' OR ', $this->whereConditions['OR'] ) . ' )';
|
||||
}
|
||||
|
||||
/* Permissions */
|
||||
$where_clause[] = $this->DB->buildRegexp( "i.perm_view", $this->member->perm_id_array );
|
||||
|
||||
/* Build and return the string */
|
||||
return implode( " AND ", $where_clause );
|
||||
}
|
||||
|
||||
/**
|
||||
* Reassigns fields in a way the index exepcts
|
||||
*
|
||||
* @param array $r
|
||||
* @return array
|
||||
**/
|
||||
public function formatFieldsForIndex( $r )
|
||||
{
|
||||
$r['app'] = 'core';
|
||||
$r['content'] = $r['title'];
|
||||
$r['content_title'] = $r['description'];
|
||||
$r['updated'] = time();
|
||||
$r['type_2'] = 'help';
|
||||
$r['type_id_2'] = $r['id'];
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function grabs the actual results for display
|
||||
*
|
||||
* @param array $ids
|
||||
* @return query result
|
||||
**/
|
||||
public function getResultsForSphinx( $ids )
|
||||
{
|
||||
$this->DB->build( array(
|
||||
'select' => "h.*",
|
||||
'from' => array( 'faq' => 'h' ),
|
||||
'where' => 'h.id IN( ' . implode( ',', $ids ) . ')',
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 'i.*',
|
||||
'from' => array( 'permission_index' => 'i' ),
|
||||
'where' => "i.perm_type='help' AND i.perm_type_id=1",
|
||||
'type' => 'left',
|
||||
),
|
||||
)
|
||||
) );
|
||||
return $this->DB->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of the field this search index uses for dates.... >_<
|
||||
*
|
||||
* @return string
|
||||
**/
|
||||
public function getDateField()
|
||||
{
|
||||
return 'search_id';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets field names for other conditions
|
||||
*
|
||||
* @param string Column
|
||||
* @return string
|
||||
**/
|
||||
public function getConditionField( $column )
|
||||
{
|
||||
return $column;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Sphinx template file
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Core
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 4948 $
|
||||
* @since 3.0.0
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
$appSphinxTemplate = <<<EOF
|
||||
|
||||
############################### --- CORE --- ################################
|
||||
|
||||
source core_search_main : ipb_source_config
|
||||
{
|
||||
# Set our forum PID counter
|
||||
sql_query_pre = REPLACE INTO <!--SPHINX_DB_PREFIX-->cache_store VALUES( 'sphinx_core_counter', (SELECT max(id) FROM <!--SPHINX_DB_PREFIX-->faq), '', 0, UNIX_TIMESTAMP() )
|
||||
|
||||
# Query posts for the main source
|
||||
sql_query = SELECT f.*, f.id as search_id, \
|
||||
REPLACE( pi.perm_view, '*', 0 ) as perm_view \
|
||||
FROM <!--SPHINX_DB_PREFIX-->faq f \
|
||||
LEFT JOIN <!--SPHINX_DB_PREFIX-->permission_index pi ON ( pi.perm_type_id=1 AND pi.perm_type='help' ) \
|
||||
WHERE f.id <= ( SELECT cs_value FROM <!--SPHINX_DB_PREFIX-->cache_store WHERE cs_key='sphinx_core_counter' )
|
||||
|
||||
# Fields
|
||||
sql_attr_uint = search_id
|
||||
|
||||
sql_ranged_throttle = 0
|
||||
}
|
||||
|
||||
source core_search_delta : core_search_main
|
||||
{
|
||||
# Override the base sql_query_pre
|
||||
sql_query_pre =
|
||||
|
||||
# Query posts for the main source
|
||||
sql_query = SELECT f.*, f.id as search_id, \
|
||||
REPLACE( pi.perm_view, '*', 0 ) as perm_view \
|
||||
FROM <!--SPHINX_DB_PREFIX-->faq f \
|
||||
LEFT JOIN <!--SPHINX_DB_PREFIX-->permission_index pi ON ( pi.perm_type_id=1 AND pi.perm_type='help' ) \
|
||||
WHERE f.id > ( SELECT cs_value FROM <!--SPHINX_DB_PREFIX-->cache_store WHERE cs_key='sphinx_core_counter' )
|
||||
|
||||
# Fields
|
||||
sql_attr_uint = search_id
|
||||
|
||||
sql_ranged_throttle = 0
|
||||
}
|
||||
|
||||
index core_search_main
|
||||
{
|
||||
source = core_search_main
|
||||
path = <!--SPHINX_BASE_PATH-->/core_search_main
|
||||
|
||||
docinfo = extern
|
||||
mlock = 0
|
||||
morphology = none
|
||||
min_word_len = 2
|
||||
charset_type = sbcs
|
||||
html_strip = 0
|
||||
}
|
||||
|
||||
index core_search_delta : core_search_main
|
||||
{
|
||||
source = core_search_delta
|
||||
path = <!--SPHINX_BASE_PATH-->/core_search_delta
|
||||
}
|
||||
|
||||
|
||||
EOF;
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user