Version 3.0.5

This commit is contained in:
Neo committed 2025-12-19 00:31:03 -08:00
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,129 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Member form manipulation
* 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 Members
* @link http://www.iinvisionpower.com
* @since 1st march 2002
* @version $Revision: 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 admin_member_form__members implements admin_member_form
{
/**
* Tab name
* This can be left blank and the application title will
* be used
*
* @access public
* @var string Tab name
*/
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() )
{
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'admin_members' ), 'members' );
$array = array();
if( ipsRegistry::getClass('class_permissions')->checkPermission( 'membertools_delete_pms', 'members', 'members' ) )
{
$array[] = array( 'img' => '',
'url' => 'section=tools&amp;module=members&amp;do=deleteMessages',
'title' => ipsRegistry::getClass('class_localization')->words['form_deletepms'] );
}
if( ipsRegistry::getClass('class_permissions')->checkPermission( 'membertools_ip', 'members', 'members' ) )
{
$array[] = array( 'img' => '',
'url' => 'section=tools&amp;module=members&amp;do=show_all_ips',
'title' => ipsRegistry::getClass('class_localization')->words['form_showallips'] );
}
if( ipsRegistry::getClass('class_permissions')->checkPermission( 'member_suspend', 'members', 'members' ) )
{
if( $member['temp_ban'] )
{
$array[] = array( 'img' => '',
'url' => 'section=members&amp;module=members&amp;do=unsuspend',
'title' => ipsRegistry::getClass('class_localization')->words['form_unsuspendmem'] );
}
else
{
$array[] = array( 'img' => '',
'url' => 'section=members&amp;module=members&amp;do=banmember',
'title' => ipsRegistry::getClass('class_localization')->words['form_suspendmem'] );
}
}
if( ipsRegistry::getClass('class_permissions')->checkPermission( 'members_merge', 'members', 'members' ) )
{
$array[] = array( 'img' => '',
'url' => 'section=tools&amp;module=members&amp;do=merge',
'title' => ipsRegistry::getClass('class_localization')->words['form_mergemember'] );
}
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,141 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Core extensions
* Last Updated: $Date: 2009-11-10 18:07:22 -0500 (Tue, 10 Nov 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 Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Rev: 5345 $
*
*/
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 publicSessions__members
{
/**
* 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 );
if( ipsRegistry::$request['id'] AND ipsRegistry::$request['section'] == 'view' AND ipsRegistry::$request['module'] == 'profile' )
{
$array['location_1_type'] = 'profile';
$array['location_1_id'] = ipsRegistry::$request['id'];
}
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();
$profiles = array();
$names = array();
//-----------------------------------------
// Extract the topic/forum data
//-----------------------------------------
foreach( $rows as $row )
{
if( $row['current_appcomponent'] != 'members' OR !$row['current_module'] )
{
continue;
}
if( $row['current_module'] == 'profile' )
{
$profiles[] = $row['location_1_id'];
}
}
if( count($profiles) )
{
ipsRegistry::DB()->build( array( 'select' => 'member_id, members_display_name, members_seo_name', 'from' => 'members', 'where' => 'member_id IN(' . implode( ',', $profiles ) . ')' ) );
$pr = ipsRegistry::DB()->execute();
while( $r = ipsRegistry::DB()->fetch($pr) )
{
$names[ $r['member_id'] ] = array( 'members_display_name' => $r['members_display_name'], 'members_seo_name' => $r['members_seo_name'] );
}
}
foreach( $rows as $row )
{
if( $row['current_appcomponent'] == 'members' )
{
if( $row['current_module'] == 'online' )
{
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['WHERE_online'];
}
if( $row['current_module'] == 'list' )
{
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['WHERE_members'];
}
if( $row['current_module'] == 'messaging' )
{
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['WHERE_msg'];
}
if( $row['current_module'] == 'profile' )
{
if ( isset( $names[ $row['location_1_id'] ] ) )
{
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['WHERE_profile'];
$row['where_line_more'] = $names[ $row['location_1_id'] ]['members_display_name'];
$row['where_link'] = 'showuser=' . $row['location_1_id'];
$row['_whereLinkSeo'] = ipsRegistry::getClass('output')->buildSEOUrl( $row['where_link'], 'public', $names[ $row['location_1_id'] ]['members_seo_name'], 'showuser' );
}
}
}
$final[ $row['id'] ] = $row;
}
return $final;
}
}
@@ -0,0 +1,72 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Core variables extension 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 Members
* @link http://www.iinvisionpower.com
* @since 1st march 2002
* @version $Revision: 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();
}
$_LOAD = array();
# PERSONAL MESSAGES
if( ( isset( $_GET['module'] ) && $_GET['module'] == 'messaging' ) )
{
$_LOAD['ranks'] = 1;
$_LOAD['profilefields'] = 1;
$_LOAD['badwords'] = 1;
$_LOAD['bbcode'] = 1;
$_LOAD['emoticons'] = 1;
$_LOAD['reputation_levels'] = 1;
$_LOAD['moderators'] = 1;
}
# MEMBER LIST
if( ( isset( $_GET['section'] ) && $_GET['section'] == 'view' ) && ( isset( $_GET['module'] ) && $_GET['module'] == 'list' ) )
{
$_LOAD['ranks'] = 1;
$_LOAD['profilefields'] = 1;
$_LOAD['reputation_levels'] = 1;
}
# ONLINE LIST
if( isset( $_GET['module'] ) && $_GET['module'] == 'online' )
{
$_LOAD['ranks'] = 1;
$_LOAD['profilefields'] = 1;
$_LOAD['reputation_levels'] = 1;
$_LOAD['moderators'] = 1; // This is need for forums application - as there are usually people browsing topics,
// we should load this on the assumption it'll be needed anyways
}
# PROFILE
if ( ( isset( $_GET['showuser'] ) && $_GET['showuser'] ) OR $_GET['module'] == 'profile' AND $_GET['section'] == 'view' )
{
$_LOAD['ranks'] = 1;
$_LOAD['profilefields'] = 1;
$_LOAD['badwords'] = 1;
$_LOAD['bbcode'] = 1;
$_LOAD['emoticons'] = 1;
$_LOAD['reputation_levels'] = 1;
$_LOAD['moderators'] = 1;
}
/* Never, ever remove or re-order these options!!
* Feel free to add, though. :) */
$_BITWISE = array();
@@ -0,0 +1,37 @@
<?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 Members
* @link http://www.iinvisionpower.com
* @since 27th January 2004
* @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();
}
/*
* 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(
'signatures' => ipsRegistry::getClass('class_localization')->words['ctype__signatures'],
'aboutme' => ipsRegistry::getClass('class_localization')->words['ctype__aboutme'],
'pms' => ipsRegistry::getClass('class_localization')->words['ctype__pms'],
'warn' => ipsRegistry::getClass('class_localization')->words['ctype__warn'],
);
@@ -0,0 +1,46 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.1
* 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 Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Rev: 4136 $
*
*/
/**
* 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(
'showuser' => array( 'app' => 'members',
'allowRedirect' => 1,
'out' => array( '#showuser=(.+?)(&|$)#i', 'user/$1/$2' ),
'in' => array( 'regex' => "#/user/(\d+)/#i",
'matches' => array( array( 'showuser', '$1' ) ) ) ),
);
@@ -0,0 +1,139 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* RSS output plugin :: posts
* Last Updated: $Date: 2009-01-05 22:21:54 +0000 (Mon, 05 Jan 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 Forums
* @link http://www.iinvisionpower.com
* @since 6/24/2008
* @version $Revision: 3572 $
*/
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 furlRedirect_members
{
/**
* Key type: Type of action (topic/forum)
*
* @access private
* @var string
*/
private $_type = '';
/**
* Key ID
*
* @access private
* @var int
*/
private $_id = 0;
/**
* Constructor
*
*/
function __construct( ipsRegistry $registry )
{
$this->registry = $registry;
$this->DB = $registry->DB();
$this->settings =& $registry->fetchSettings();
}
/**
* Set the key ID
* @example furlRedirect_forums::setKey( 'topic', 12 );
*
* @access public
* @param string Type
* @param mixed Value
*/
public function setKey( $name, $value )
{
$this->_type = $name;
$this->_id = $value;
}
/**
* Set up the key by URI
*
* @access public
* @param string URI (example: index.php?showtopic=5&view=getlastpost)
* @return void
*/
public function setKeyByUri( $uri )
{
$uri = str_replace( '&amp;', '&', $uri );
if ( strstr( $uri, '?' ) )
{
list( $_chaff, $uri ) = explode( '?', $uri );
}
foreach( explode( '&', $uri ) as $bits )
{
list( $k, $v ) = explode( '=', $bits );
if ( $k )
{
if ( $k == 'showuser' )
{
$this->setKey( 'user', intval( $v ) );
return TRUE;
}
}
}
return FALSE;
}
/**
* Return the SEO title
*
* @access public
* @return string The SEO friendly name
*/
public function fetchSeoTitle()
{
switch ( $this->_type )
{
default:
return FALSE;
break;
case 'user':
return $this->_fetchSeoTitle_user();
break;
}
}
/**
* Return the SEO title for a user
*
* @access public
* @return string The SEO friendly name
*/
public function _fetchSeoTitle_user()
{
$member = IPSMember::load( intval( $this->_id ), 'core' );
if ( $member['member_id'] )
{
if ( IPB_USE_ONLY_ID_FURL ) return $member['member_id'];
return ( $member['members_seo_name'] ) ? $member['members_seo_name'] : IPSText::makeSeoTitle( $member['members_display_name'] );
}
return FALSE;
}
}
@@ -0,0 +1,53 @@
<?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 Members
* @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(
'showuser' => array( 'app' => 'members',
'allowRedirect' => 1,
'out' => array( '#showuser=(.+?)((?:&|&amp;)f=(.+?))?(&|$)#i', 'user/$1-#{__title__}/$2$4' ),
'in' => array( 'regex' => "#/user/(\d+?)-#i",
'matches' => array( array( 'showuser', '$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 @@
<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,75 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Portal plugin: online users
* 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 Members
* @link http://www.iinvisionpower.com
* @since 1st march 2002
* @version $Revision: 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();
}
/**
* This file must be named {file_name_minus_php}-cfg.php
*
* Please see each variable for more information
* $PORTAL_CONFIG is OK for each file, do not change
* this array name.
*/
$PORTAL_CONFIG = array();
/**
* Main plug in title
*
*/
$PORTAL_CONFIG['pc_title'] = 'Онлайн пользователи';
/**
* Plug in mini description
*
*/
$PORTAL_CONFIG['pc_desc'] = "Блок онлайн пользователей";
/**
* Keyword for settings. This is the keyword
* entered into ibf_conf_settings_titles -> conf_title_keyword
* Can be left blank.
* PLEASE stick to the naming convention when entering a setting
* keyword: portal_{file_name_minus_php} This will prevent
* other keyword clashes. Likewise, when creating settings, choose
* NOT to cache them (they will be loaded at run time) and always
* prefix with {file_name_minus_php}_setting_key - for example
* If you had a setting called "export_forums" then please name it
* "recent_topics_export_forums". This will be available in
* $this->settings['recent_topics_export_forums'] in the
* main module.
*/
$PORTAL_CONFIG['pc_settings_keyword'] = "";
/**
* Exportable tags key must be in the naming format of:
* {file_name_minus_php}-tag. The value *MUST* be the function
* which it corresponds to. For example:
* 'recent_topics_last_x' => 'recent_topics_last_x'
* The portal will look for function 'recent_topics_last_x' in
* module "sources/portal_plugins/recent_topics.php" when it parses
* the tag <!--::recent_topics_last_x::-->
*
* @param array[ TAG ] = array( FUNCTION NAME, DESCRIPTION );
*/
$PORTAL_CONFIG['pc_exportable_tags']['online_users_show'] = array( 'online_users_show', 'Shows the online users' );
@@ -0,0 +1,61 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Portal plugin: online users
* Last Updated: $Date: 2009-02-04 15:03:36 -0500 (Wed, 04 Feb 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 Members
* @link http://www.iinvisionpower.com
* @since 1st march 2002
* @version $Revision: 3887 $
*
*/
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();
}
class ppi_online_users extends public_portal_portal_portal
{
/**
* Initialize module
*
* @access public
* @return void
*/
public function init()
{
}
/**
* Show the online users
*
* @access public
* @return string HTML content to replace tag with
*/
public function online_users_show()
{
//-----------------------------------------
// Get the users from the DB
//-----------------------------------------
require_once( IPSLib::getAppDir( 'forums', 'forums' ) . '/boards.php' );
$boards = new public_forums_forums_boards();
$boards->makeRegistryShortcuts( $this->registry );
$active = $boards->getActiveUserDetails();
$active['visitors'] = $active['GUESTS'] + $active['ANON'];
$active['members'] = $active['MEMBERS'];
return $this->registry->getClass('output')->getTemplate('portal')->onlineUsers( $active );
}
}
@@ -0,0 +1,69 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Format member 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 Members
* @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 membersSearchDisplay 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 )
{
$search_row['misc'] = unserialize( $search_row['misc'] );
return ipsRegistry::getClass( 'output' )->getTemplate( 'search' )->memberSearchResult( $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 '';
}
/**
* Build filter SQL data
*
* @access public
* @param array
* @return array
*/
public function buildFilterSQL( $data )
{
return array();
}
}
@@ -0,0 +1,425 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Basic Member Search
* Last Updated: $Date: 2009-01-12 16:56:39 -0500 (Mon, 12 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 Members
* @link http://www.iinvisionpower.com
* @version $Rev: 3640 $
*/
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 searchMembersPlugin 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='' )
{
if( $group_by )
{
$group_by = 'm.' . $group_by;
}
/* User prefs */
$order_dir = ( $sort_order == 'asc' ) ? 'asc' : 'desc';
/* Do the search */
$this->DB->build( array(
'select' => "m.*",
'from' => array( 'members' => 'm' ),
'where' => $this->_buildWhereStatement( $search_term, $content_title_only ),
'limit' => $limit_clause,
'group' => $group_by,
'order' => "m.member_id " . $order_dir, //"m.joined DESC", - m.member_id uses Primary key and avoids filesort
'add_join' => array(
array(
'select' => 'p.*',
'from' => array( 'profile_portal' => 'p' ),
'where' => "p.pp_member_id=m.member_id",
'type' => 'left',
),
array(
'from' => array( 'profile_friends' => 'friend' ),
'where' => 'friend.friends_member_id=m.member_id AND friend.friends_friend_id=' . $this->memberData['member_id'],
'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 )
{
/* Query the count */
$this->DB->build( array(
'select' => 'COUNT(*) as total_results',
'from' => array( 'members' => 'm' ),
'where' => $this->_buildWhereStatement( $search_term, $content_title_only ),
'group' => $group_by,
'add_join' => array(
array(
'from' => array( 'profile_portal' => 'p' ),
'where' => "p.pp_member_id=m.member_id",
'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' )
{
if( $column == 'app' OR $column == 'type_id' )
{
return;
}
/* Build the condition based on operator */
switch( strtoupper( $operator ) )
{
case 'IN':
case 'NOT IN':
$this->whereConditions[$comp][] = "m.{$column} {$operator} ( {$value} )";
break;
default:
$this->whereConditions[$comp][] = "m.{$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' )
{
/* Loop through the conditions to build the statement */
$_temp = array();
foreach( $conditions as $r )
{
/* REMAP */
if( $r['column'] == 'type_id' )
{
continue;
}
if( $r['column'] == 'app' )
{
continue;
}
switch( strtoupper( $r['operator'] ) )
{
case 'IN':
case 'NOT IN':
$_temp[] = "m.{$r['column']} {$r['operator']} ( {$r['value']} )";
break;
default:
$_temp[] = "m.{$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->setDateRange( intval( $this->memberData['last_visit'] ), time() );
}
/**
* 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[] = "m.members_l_display_name LIKE '%" . mb_strtolower( $search_term ) . "%'";
}
else
{
$where_clause[] = "m.members_l_display_name LIKE '%" . mb_strtolower( $search_term ) . "%' OR p.pp_bio_content LIKE '%{$search_term}%' OR p.signature LIKE '%{$search_term}%' OR p.pp_about_me 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'] ) . ' )';
}
/* Date Restrict */
if( $this->search_begin_timestamp && $this->search_end_timestamp )
{
$where_clause[] = $this->DB->buildBetween( "m.joined", $this->search_begin_timestamp, $this->search_end_timestamp );
}
else
{
if( $this->search_begin_timestamp )
{
$where_clause[] = "m.joined > {$this->search_begin_timestamp}";
}
if( $this->search_end_timestamp )
{
$where_clause[] = "m.joined < {$this->search_end_timestamp}";
}
}
/* 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'] = 'members';
$r['content'] = $r['signature'] . ' ' . $r['bio'] . ' ' . $r['pp_about_me'];
$r['content_title'] = $r['members_display_name'];
$r['updated'] = time();
$r['type_2'] = 'profile_view';
$r['type_id_2'] = $r['member_id'];
$r['misc'] = serialize( array(
'pp_bio_content' => $r['pp_bio_content'],
'pp_thumb_photo' => $r['pp_thumb_photo'],
'pp_thumb_width' => $r['pp_thumb_width'],
'pp_thumb_height' => $r['pp_thumb_height']
) );
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' => "m.*",
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id IN( ' . implode( ',', $ids ) . ')',
'order' => 'm.member_id DESC', //'m.joined DESC',
'add_join' => array(
array(
'select' => 'p.*',
'from' => array( 'profile_portal' => 'p' ),
'where' => "p.pp_member_id=m.member_id",
'type' => 'left',
)
)
) );
return $this->DB->execute();
}
/**
* Gets the name of the field this search index uses for dates.... >_<
*
* @return string
**/
public function getDateField()
{
return 'joined';
}
/**
* Gets field names for other conditions
*
* @param string Column
* @return string
**/
public function getConditionField( $column )
{
switch( $column )
{
case 'member_id':
return 'search_id';
break;
}
return $column;
}
}
@@ -0,0 +1,92 @@
<?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 Members
* @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
############################## --- MEMBERS --- ##############################
source members_search_main : ipb_source_config
{
# Set our forum PID counter
sql_query_pre = REPLACE INTO <!--SPHINX_DB_PREFIX-->cache_store VALUES( 'sphinx_members_counter', (SELECT max(member_id) FROM <!--SPHINX_DB_PREFIX-->members), '', 0, UNIX_TIMESTAMP() )
# Query posts for the main source
sql_query = SELECT m.member_id, m.member_id as search_id, m.member_group_id, m.email, m.joined, m.members_display_name, m.name, \
REPLACE( pi.perm_view, '*', 0 ) as perm_view, \
CASE WHEN pi.authorized_users IS NULL THEN 0 ELSE pi.authorized_users END AS authorized_users, \
CASE WHEN pi.friend_only=0 THEN 0 ELSE m.member_id END AS friend_only, \
CASE WHEN pi.owner_only=0 THEN 0 ELSE m.member_id END AS owner_only \
FROM <!--SPHINX_DB_PREFIX-->members m \
LEFT JOIN <!--SPHINX_DB_PREFIX-->permission_index pi ON ( pi.perm_type_id=1 AND pi.perm_type='profile_view' ) \
WHERE m.member_id <= ( SELECT cs_value FROM <!--SPHINX_DB_PREFIX-->cache_store WHERE cs_key='sphinx_members_counter' )
# Fields
sql_attr_uint = search_id
sql_attr_uint = friend_only
sql_attr_uint = owner_only
sql_attr_timestamp = joined
sql_attr_multi = uint perm_view from field
sql_attr_multi = uint authorized_users from field
sql_ranged_throttle = 0
}
source members_search_delta : members_search_main
{
# Override the base sql_query_pre
sql_query_pre =
# Query posts for the main source
sql_query = SELECT m.member_id, m.member_id as search_id, m.member_group_id, m.email, m.joined, m.members_display_name, m.name, \
REPLACE( pi.perm_view, '*', 0 ) as perm_view, \
CASE WHEN pi.authorized_users IS NULL THEN 0 ELSE pi.authorized_users END AS authorized_users, \
CASE WHEN pi.friend_only=0 THEN 0 ELSE m.member_id END AS friend_only, \
CASE WHEN pi.owner_only=0 THEN 0 ELSE m.member_id END AS owner_only \
FROM <!--SPHINX_DB_PREFIX-->members m \
LEFT JOIN <!--SPHINX_DB_PREFIX-->permission_index pi ON ( pi.perm_type_id=1 AND pi.perm_type='profile_view' ) \
WHERE m.member_id > ( SELECT cs_value FROM <!--SPHINX_DB_PREFIX-->cache_store WHERE cs_key='sphinx_members_counter' )
}
index members_search_main
{
source = members_search_main
path = <!--SPHINX_BASE_PATH-->/members_search_main
docinfo = extern
mlock = 0
morphology = none
min_word_len = 2
charset_type = sbcs
html_strip = 0
}
index members_search_delta : members_search_main
{
source = members_search_delta
path = <!--SPHINX_BASE_PATH-->/members_search_delta
}
EOF;
File diff suppressed because it is too large. Load diff