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,106 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Group property updater (Forums)
* 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 Forums
* @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 admin_group_form__forums implements admin_group_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 content for the page.
*
* @access public
* @author Brandon Farber
* @param array Group data
* @param integer Number of tabs used so far
* @return array Array of tabs, content
*/
public function getDisplayContent( $group=array(), $tabsUsed = 2 )
{
//-----------------------------------------
// Load skin
//-----------------------------------------
$this->html = ipsRegistry::getClass('output')->loadTemplate('cp_skin_group_form', 'forums');
//-----------------------------------------
// Load lang
//-----------------------------------------
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'admin_forums' ), 'forums' );
//-----------------------------------------
// Show...
//-----------------------------------------
return array( 'tabs' => $this->html->acp_group_form_tabs( $group, ( $tabsUsed + 1 ) ), 'content' => $this->html->acp_group_form_main( $group, ( $tabsUsed + 1 ) ), 'tabsUsed' => 1 );
}
/**
* Process the entries for saving and return
*
* @access public
* @author Brandon Farber
* @return array Array of keys => values for saving
*/
public function getForSave()
{
$return = array(
'g_other_topics' =>ipsRegistry::$request['g_other_topics'],
'g_post_new_topics' =>ipsRegistry::$request['g_post_new_topics'],
'g_reply_own_topics' =>ipsRegistry::$request['g_reply_own_topics'],
'g_reply_other_topics' =>ipsRegistry::$request['g_reply_other_topics'],
'g_edit_posts' =>ipsRegistry::$request['g_edit_posts'],
'g_edit_cutoff' =>ipsRegistry::$request['g_edit_cutoff'],
'g_delete_own_posts' =>ipsRegistry::$request['g_delete_own_posts'],
'g_open_close_posts' =>ipsRegistry::$request['g_open_close_posts'],
'g_delete_own_topics' =>ipsRegistry::$request['g_delete_own_topics'],
'g_post_polls' =>ipsRegistry::$request['g_post_polls'],
'g_vote_polls' =>ipsRegistry::$request['g_vote_polls'],
'g_can_remove' =>ipsRegistry::$request['g_can_remove'] ? intval(ipsRegistry::$request['g_can_remove'] ) : 0,
'g_append_edit' =>ipsRegistry::$request['g_append_edit'],
'g_avoid_q' =>ipsRegistry::$request['g_avoid_q'],
'g_avoid_flood' =>ipsRegistry::$request['g_avoid_flood'],
'g_post_closed' =>ipsRegistry::$request['g_post_closed'],
'g_edit_topic' =>ipsRegistry::$request['g_edit_topic'],
'g_topic_rate_setting' => intval(ipsRegistry::$request['g_topic_rate_setting']),
'g_mod_preview' => ipsRegistry::$request['g_mod_preview'],
'g_mod_post_unit' => intval( ipsRegistry::$request['g_mod_post_unit'] ),
'g_ppd_unit' => intval( ipsRegistry::$request['g_ppd_unit'] ),
'g_ppd_limit' => intval( ipsRegistry::$request['g_ppd_limit'] ),
);
return $return;
}
}
@@ -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,138 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Member property updater (AJAX)
* Last Updated: $Date: 2009-12-01 17:42:17 -0500 (Tue, 01 Dec 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 Forums
* @link http://www.iinvisionpower.com
* @version $Revision: 5501 $
*
*/
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__forums 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() )
{
//-----------------------------------------
// Load lang
//-----------------------------------------
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'admin_forums' ), 'forums' );
$array = array();
$array[] = array( 'img' => '',
'url' => 'section=tools&amp;module=tools&amp;do=deleteposts',
'title' => ipsRegistry::getClass('class_localization')->words['m_deltitle'] );
$array[] = array( 'img' => '',
'url' => 'section=tools&amp;module=tools&amp;do=deletesubscriptions',
'title' => ipsRegistry::getClass('class_localization')->words['m_delsubs'] );
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() )
{
//-----------------------------------------
// Load skin
//-----------------------------------------
$this->html = ipsRegistry::getClass('output')->loadTemplate('cp_skin_member_form', 'forums');
//-----------------------------------------
// Load lang
//-----------------------------------------
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'admin_forums' ), 'forums' );
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'admin_member_form' ), 'forums' );
//-----------------------------------------
// Get member data
//-----------------------------------------
// $member = IPSMember::load( $member['member_id'], 'extendedProfile' );
$member['_avatar'] = str_replace( '<img ', '<img id="MF__avatar" ', IPSMember::buildAvatar( $member ) );
//-----------------------------------------
// Show...
//-----------------------------------------
return array( 'tabs' => $this->html->acp_member_form_tabs( $member ), 'content' => $this->html->acp_member_form_main( $member ) );
}
/**
* 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() );
$return['core']['posts'] = intval(ipsRegistry::$request['posts']);
$return['core']['view_avs'] = intval(ipsRegistry::$request['view_avs']);
$return['core']['view_img'] = intval(ipsRegistry::$request['view_img']);
$return['core']['restrict_post'] = ipsRegistry::$request['post_indef'] ? 1 : ( ipsRegistry::$request['post_timespan'] > 0 ? IPSMember::processBanEntry( array( 'timespan' => intval(ipsRegistry::$request['post_timespan']), 'unit' => ipsRegistry::$request['post_units'] ) ) : '' );
$return['core']['mod_posts'] = ipsRegistry::$request['mod_indef'] ? 1 : ( ipsRegistry::$request['mod_timespan'] > 0 ? IPSMember::processBanEntry( array( 'timespan' => intval(ipsRegistry::$request['mod_timespan']), 'unit' => ipsRegistry::$request['mod_units'] ) ) : '' );
$return['core']['org_perm_id'] = ipsRegistry::$request['org_perm_id'] ? ',' . implode( ",", ipsRegistry::$request['org_perm_id'] ) . ',' : '';
return $return;
}
}
@@ -0,0 +1,636 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Forum permissions mappings
*
* @author $author$
* @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
* @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();
}
$_PERM_CONFIG = array( 'Forum' );
class forumsPermMappingForum
{
/**
* Mapping of keys to columns
*
* @access private
* @var array
*/
private $mapping = array(
'view' => 'perm_view',
'read' => 'perm_2',
'reply' => 'perm_3',
'start' => 'perm_4',
'upload' => 'perm_5',
'download' => 'perm_6'
);
/**
* Mapping of keys to names
*
* @access private
* @var array
*/
private $perm_names = array(
'view' => 'Show Forum',
'read' => 'Read Topics',
'reply' => 'Reply Topics',
'start' => 'Start Topics',
'upload' => 'Upload',
'download' => 'Download',
);
/**
* Mapping of keys to background colors for the form
*
* @access private
* @var array
*/
private $perm_colors = array(
'view' => '#fff0f2',
'read' => '#effff6',
'reply' => '#edfaff',
'start' => '#f0f1ff',
'upload' => '#fffaee',
'download' => '#ffeef9',
);
/**
* Method to pull the key/column mapping
*
* @access public
* @return array
*/
public function getMapping()
{
return $this->mapping;
}
/**
* Method to pull the key/name mapping
*
* @access public
* @return array
*/
public function getPermNames()
{
return $this->perm_names;
}
/**
* Method to pull the key/color mapping
*
* @access public
* @return array
*/
public function getPermColors()
{
return $this->perm_colors;
}
/**
* Retrieve the permission items
*
* @access public
* @return array
*/
public function getPermItems()
{
require_once( IPSLib::getAppDir( 'forums' ) . '/sources/classes/forums/class_forums.php' );
require_once( IPSLib::getAppDir( 'forums' ) . '/sources/classes/forums/admin_forum_functions.php' );
$forumfunc = new admin_forum_functions( ipsRegistry::instance() );
$forumfunc->forumsInit();
$forum_data = $forumfunc->adForumsForumData();
$_return_arr = array();
foreach( $forum_data as $r )
{
$return_arr[$r['id']] = array(
'title' => $r['depthed_name'],
'perm_view' => $r['perm_view'],
'perm_2' => $r['perm_2'],
'perm_3' => $r['perm_3'],
'perm_4' => $r['perm_4'],
'perm_5' => $r['perm_5'],
'perm_6' => $r['perm_6'],
'perm_7' => $r['perm_7'],
'restrict' => $r['parent_id'] == 'root' ? 'perm_view' : '',
);
}
return $return_arr;
}
}
/**
* Invision Power Services
* IP.Board v3.0.5
* Item Marking
* 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 Forums
* @link http://www.iinvisionpower.com
* @version $Rev: 4948 $
*
*/
class itemMarking__forums
{
/**
* Field Convert Data Remap Array
*
* This is where you can map your app_key_# numbers to application savvy fields
*
* @access private
* @var array
*/
private $_convertData = array( 'forumID' => 'item_app_key_1' );
/**#@+
* Registry Object Shortcuts
*
* @access protected
* @var object
*/
protected $registry;
protected $DB;
protected $settings;
protected $request;
protected $lang;
protected $member;
protected $cache;
/**#@-*/
/**
* I'm a constructor, twisted constructor
*
* @access public
* @param object ipsRegistry reference
* @return void
*/
public function __construct( ipsRegistry $registry )
{
/* Make objects */
$this->registry = $registry;
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->lang = $this->registry->getClass('class_localization');
$this->member = $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
}
/**
* Convert Data
* Takes an array of app specific data and remaps it to the DB table fields
*
* @access public
* @param array
* @return array
*/
public function convertData( $data )
{
$_data = array();
foreach( $data as $k => $v )
{
if ( isset($this->_convertData[$k]) )
{
# Make sure we use intval here as all 'forum' app fields
# are integers.
$_data[ $this->_convertData[ $k ] ] = intval( $v );
}
else
{
$_data[ $k ] = $v;
}
}
return $_data;
}
/**
* Fetch unread count
*
* Grab the number of items truly unread
* This is called upon by 'markRead' when the number of items
* left hits zero (or less).
*
*
* @access public
* @param array Array of data
* @param array Array of read itemIDs
* @param int Last global reset
* @return integer Last unread count
*/
public function fetchUnreadCount( $data, $readItems, $lastReset )
{
$count = 0;
$lastItem = 0;
$approved = $this->memberData['is_mod'] ? ' AND approved IN (0,1) ' : ' AND approved=1 ';
$readItems = is_array( $readItems ) ? $readItems : array( 0 );
if ( $data['forumID'] )
{
$_count = $this->DB->buildAndFetch( array(
'select' => 'COUNT(*) as cnt, MIN(last_post) as lastItem',
'from' => 'topics',
'where' => "forum_id=" . intval( $data['forumID'] ) . " {$approved} AND tid NOT IN(".implode(",",array_keys($readItems)).") AND last_post > ".intval($lastReset) . " AND state != 'link'"
) );
$count = intval( $_count['cnt'] );
$lastItem = intval( $_count['lastItem'] );
}
return array( 'count' => $count,
'lastItem' => $lastItem );
}
}
/**
* Invision Power Services
* IP.Board v3.0.5
* Fetch Skin
* 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 Forums
* @link http://www.iinvisionpower.com
* @version $Rev: 4948 $
*
*/
class fetchSkin__forums
{
/**#@+
* Registry Object Shortcuts
*
* @access protected
* @var object
*/
protected $registry;
protected $DB;
protected $settings;
protected $request;
protected $lang;
protected $member;
protected $cache;
/**#@-*/
/**
* I'm a constructor, twisted constructor
*
* @access public
* @param object ipsRegistry reference
* @return void
*/
public function __construct( ipsRegistry $registry )
{
/* Make objects */
$this->registry = $registry;
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->lang = $this->registry->getClass('class_localization');
$this->member = $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
/* Check for class_forums */
if( ipsRegistry::isClassLoaded('class_forums') !== TRUE )
{
require_once( IPSLib::getAppDir( 'forums' ) . "/sources/classes/forums/class_forums.php" );
$this->registry->setClass( 'class_forums', new class_forums( $registry ) );
$this->registry->class_forums->forumsInit();
}
}
/**
* Returns a skin ID or FALSE
*
* @access public
* @author Matt Mecham
* @return mixed INT or FALSE if no skin found / required
*/
public function fetchSkin()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$useSkinID = FALSE;
$_keys = array_keys( $_REQUEST );
//-----------------------------------------
// OK, viewing a forum or WHAT?
//-----------------------------------------
if ( count( array_intersect( array( 'showtopic', 'showforum' ), $_keys ) ) OR ( $this->request['module'] == 'post' ) )
{
$cache = $this->registry->class_forums->forum_by_id;
$eff = intval( $this->request['f'] );
//-----------------------------------------
// Do we have a skin for a particular forum?
//-----------------------------------------
if ( $eff )
{
if ( isset( $cache[ $eff ]['skin_id'] ) && $cache[ $eff ]['skin_id'] )
{
$useSkinID = $cache[ $eff ]['skin_id'];
}
}
}
return $useSkinID;
}
}
/**
* Invision Power Services
* IP.Board v3.0.5
* Library: Handle public session data
* 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 Forums
* @link http://www.iinvisionpower.com
* @since 12th March 2002
* @version $Revision: 4948 $
*
*/
class publicSessions__forums
{
/**
* 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 );
//-----------------------------------------
// FORUM
//-----------------------------------------
if ( ipsRegistry::$request['module'] == 'forums' AND ( isset( ipsRegistry::$request['f'] ) AND ipsRegistry::$request['f'] ) )
{
$array = array(
'location_2_type' => 'forum',
'location_2_id' => intval(ipsRegistry::$request['f']) );
}
//-----------------------------------------
// TOPIC
//-----------------------------------------
else if ( ipsRegistry::$request['module'] == 'forums' AND ipsRegistry::$request['section'] == 'topics' AND ( isset( ipsRegistry::$request['t'] ) AND ipsRegistry::$request['t'] ) )
{
$array = array(
'location_1_type' => 'topic',
'location_1_id' => intval(ipsRegistry::$request['t']),
'location_2_type' => 'forum',
'location_2_id' => intval(ipsRegistry::$request['f']) );
}
//-----------------------------------------
// POST
//-----------------------------------------
else if ( ipsRegistry::$request['module'] == 'post' AND ( isset( ipsRegistry::$request['f'] ) AND ipsRegistry::$request['f'] ) )
{
$array = array(
'location_1_type' => 'topic',
'location_1_id' => intval(ipsRegistry::$request['t']),
'location_2_type' => 'forum',
'location_2_id' => intval(ipsRegistry::$request['f']) );
}
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;
}
//-----------------------------------------
// Init
//-----------------------------------------
$forums_raw = array();
$forums = array();
$topics_raw = array();
$topics = array();
$posts_raw = array();
$posts = array();
$final = array();
//-----------------------------------------
// Extract the topic/forum data
//-----------------------------------------
foreach( $rows as $row )
{
if( $row['current_appcomponent'] != 'forums' OR !$row['current_module'] )
{
continue;
}
if( $row['current_section'] == 'forums' )
{
$forums_raw[ $row['location_2_id'] ] = '';
}
else if( $row['current_section'] == 'topics' )
{
$topics_raw[ $row['location_1_id'] ] = $row['location_1_id'];
}
else if( $row['current_section'] == 'post' )
{
$forums_raw[ $row['location_2_id'] ] = '';
$topics_raw[ $row['location_1_id'] ] = $row['location_1_id'];
}
}
//-----------------------------------------
// Get the forums, if you dare
//-----------------------------------------
if( !class_exists('app_class_forums') OR !ipsRegistry::getClass('class_forums') )
{
require_once( IPSLib::getAppDir( 'forums' ) . '/app_class_forums.php' );
$app_class_forums = new app_class_forums( ipsRegistry::instance() );
if( count($forums_raw) )
{
foreach( ipsRegistry::getClass('class_forums')->forum_by_id as $fid => $forum )
{
if( isset($forums_raw[$fid]) )
{
if( ipsRegistry::getClass( 'permissions' )->check( 'view', $forum ) !== false )
{
$forums[ $fid ] = $forum['name'];
}
}
}
}
}
//-----------------------------------------
// Get the topics, if you care
//-----------------------------------------
if( count($topics_raw) )
{
ipsRegistry::DB()->build( array( 'select' => 't.tid, t.title, t.forum_id',
'from' => array( 'topics' => 't' ),
'where' => 't.approved=1 AND t.tid IN(' . implode( ',', $topics_raw ) . ') AND ' . ipsRegistry::getClass('permissions')->buildPermQuery('p'),
'add_join' => array(
array(
'from' => array( 'permission_index' => 'p' ),
'where' => "p.perm_type_id=t.forum_id AND p.app='forums' AND p.perm_type='forum'",
'type' => 'left',
),
)
) );
$tr = ipsRegistry::DB()->execute();
while( $r = ipsRegistry::DB()->fetch($tr) )
{
if( count( ipsRegistry::getClass('class_forums')->forum_by_id[ $r['forum_id'] ] ) )
{
if( ipsRegistry::getClass( 'permissions' )->check( 'read', ipsRegistry::getClass('class_forums')->forum_by_id[ $r['forum_id'] ] ) !== false )
{
$topics[ $r['tid'] ] = $r['title'];
}
}
}
}
//-----------------------------------------
// Put humpty dumpty together again
//-----------------------------------------
foreach( $rows as $row )
{
if( $row['current_appcomponent'] != 'forums' )
{
$final[ $row['id'] ] = $row;
continue;
}
if( !$row['current_module'] )
{
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['board_index'];
$final[ $row['id'] ] = $row;
continue;
}
if( $row['current_section'] == 'forums' )
{
if( isset($forums[ $row['location_2_id'] ]) )
{
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['WHERE_sf'];
$row['where_line_more'] = $forums[ $row['location_2_id'] ];
$row['where_link'] = 'showforum=' . $row['location_2_id'];
$row['_whereLinkSeo'] = ipsRegistry::getClass('output')->formatUrl( ipsRegistry::getClass('output')->buildUrl( "showforum=".$row['location_2_id'], 'public' ), IPSText::makeSeoTitle( $forums[ $row['location_2_id'] ] ), 'showforum' );
}
}
else if( $row['current_section'] == 'topics' )
{
if( isset($topics[ $row['location_1_id'] ]) )
{
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['WHERE_st'];
$row['where_line_more'] = $topics[ $row['location_1_id'] ];
$row['where_link'] = 'showtopic=' . $row['location_1_id'];
$row['_whereLinkSeo'] = ipsRegistry::getClass('output')->formatUrl( ipsRegistry::getClass('output')->buildUrl( "showtopic=".$row['location_1_id'], 'public' ), IPSText::makeSeoTitle( $topics[ $row['location_1_id'] ] ), 'showtopic' );
}
}
else if( $row['current_section'] == 'post' )
{
if( $row['location_1_id'] )
{
if( isset($topics[ $row['location_1_id'] ]) )
{
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['WHERE_postrep'];
$row['where_line_more'] = $topics[ $row['location_1_id'] ];
$row['where_link'] = 'showtopic=' . $row['location_1_id'];
$row['_whereLinkSeo'] = ipsRegistry::getClass('output')->formatUrl( ipsRegistry::getClass('output')->buildUrl( "showtopic=".$row['location_1_id'], 'public' ), IPSText::makeSeoTitle( $topics[ $row['location_1_id'] ] ), 'showtopic' );
}
}
else if( $row['location_2_id'] )
{
if( isset($forums[ $row['location_2_id'] ]) )
{
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['WHERE_postnew'];
$row['where_line_more'] = $forums[ $row['location_2_id'] ];
$row['where_link'] = 'showforum=' . $row['location_2_id'];
$row['_whereLinkSeo'] = ipsRegistry::getClass('output')->formatUrl( ipsRegistry::getClass('output')->buildUrl( "showforum=".$row['location_2_id'], 'public' ), IPSText::makeSeoTitle( $forums[ $row['location_2_id'] ] ), 'showforum' );
}
}
}
$final[ $row['id'] ] = $row;
}
return $final;
}
}
@@ -0,0 +1,127 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Core variables extensions
* Defines the reset array, which caches to load, how to recache those caches, and the bitwise array
* Last Updated: $Date: 2009-12-07 21:57:46 -0500 (Mon, 07 Dec 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 Forums
* @link http://www.iinvisionpower.com
* @version $Rev: 5529 $
**/
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();
}
$_RESET = array();
# ALL
if ( ( isset( $_REQUEST['CODE'] ) AND $_REQUEST['CODE'] ) or ( isset( $_REQUEST['code'] ) AND $_REQUEST['code'] ) )
{
$_RESET['do'] = ( $_REQUEST['CODE'] ) ? $_REQUEST['CODE'] : $_REQUEST['code'];
}
//-----------------------------------------
// Extension File: Registered Caches
//-----------------------------------------
$_LOAD = array();
# BOARD INDEX
if ( ( ! $_GET['section'] AND ! $_GET['module'] ) OR ( $_GET['module'] == 'forums' AND $_GET['section'] == 'boards' ) )
{
$_LOAD['chatting'] = 1;
$_LOAD['birthdays'] = 1;
$_LOAD['calendar'] = 1;
$_LOAD['calendars'] = 1;
$_LOAD['ranks'] = 1;
$_LOAD['reputation_levels'] = 1;
}
# TOPIC
if ( isset( $_GET['showtopic'] ) OR $_GET['module'] == 'forums' AND $_GET['section'] == 'topics' )
{
$_LOAD['badwords'] = 1;
$_LOAD['emoticons'] = 1;
$_LOAD['bbcode'] = 1;
$_LOAD['multimod'] = 1;
$_LOAD['ranks'] = 1;
$_LOAD['profilefields'] = 1;
$_LOAD['reputation_levels'] = 1;
}
# Forum
if ( isset( $_GET['showforum'] ) OR $_GET['module'] == 'forums' AND $_GET['section'] == 'forums' )
{
$_LOAD['ranks'] = 1;
$_LOAD['reputation_levels'] = 1;
// Needed for forum rules...
$_LOAD['badwords'] = 1;
$_LOAD['emoticons'] = 1;
$_LOAD['bbcode'] = 1;
}
# POST
if ( $_GET['module'] == 'post' )
{
$_LOAD['badwords'] = 1;
$_LOAD['bbcode'] = 1;
$_LOAD['emoticons'] = 1;
$_LOAD['ranks'] = 1;
$_LOAD['reputation_levels'] = 1;
}
$CACHE['attachtypes'] = array(
'array' => 1,
'allow_unload' => 0,
'default_load' => 1,
'recache_file' => IPSLib::getAppDir( 'forums' ) . '/modules_admin/attachments/types.php',
'recache_class' => 'admin_forums_attachments_types',
'recache_function' => 'attachmentTypeCacheRebuild'
);
$CACHE['multimod'] = array(
'array' => 1,
'allow_unload' => 0,
'default_load' => 1,
'recache_file' => IPSLib::getAppDir( 'forums' ) . '/modules_admin/forums/multimods.php',
'recache_class' => 'admin_forums_forums_multimods',
'recache_function' => 'multiModerationRebuildCache'
);
$CACHE['moderators'] = array(
'array' => 1,
'allow_unload' => 0,
'default_load' => 1,
'recache_file' => IPSLib::getAppDir( 'forums' ) . '/modules_admin/forums/moderator.php',
'recache_class' => 'admin_forums_forums_moderator',
'recache_function' => 'rebuildModeratorCache'
);
$CACHE['announcements'] = array(
'array' => 1,
'allow_unload' => 0,
'default_load' => 1,
'recache_file' => IPSLib::getAppDir( 'forums' ) . '/modules_public/forums/announcements.php',
'recache_class' => 'public_forums_forums_announcements',
'recache_function' => 'announceRecache'
);
//-----------------------------------------
// Bitwise Options
//-----------------------------------------
$_BITWISE = array( 'moderators' => array( 'bw_flag_spammers' ) );
@@ -0,0 +1,35 @@
<?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 Forums
* @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();
}
/*
* 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(
'topics' => ipsRegistry::getClass('class_localization')->words['ctype__topics'],
'announcement' => ipsRegistry::getClass('class_localization')->words['ctype__announcement'],
'rules' => ipsRegistry::getClass('class_localization')->words['ctype__rules'],
);
@@ -0,0 +1,65 @@
<?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 Forums
* @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(
'showannouncement' => array( 'app' => 'forums',
'allowRedirect' => 1,
'out' => array( '#showannouncement=(.+?)((?:&|&amp;)f=(.+?))?(&|$)#i', 'forum-$3/announcement-$1/$4' ),
'in' => array( 'regex' => "#/forum-(\d+?)?/announcement-(\d+)/#i",
'matches' => array( array( 'showannouncement', '$2' ), array( 'f', '$1' ) ) ) ),
'showforum' => array( 'app' => 'forums',
'allowRedirect' => 1,
'out' => array( '#showforum=(.+?)(&|$)#i', 'forum/$1/$2' ),
'in' => array( 'regex' => "#/forum/(\d+)/#i",
'matches' => array( array( 'showforum', '$1' ) ) ) ),
'showtopic' => array( 'app' => 'forums',
'allowRedirect' => 1,
'out' => array( '#showtopic=(.+?)(&|$)#i', 'topic/$1/$2' ),
'in' => array( 'regex' => "#/topic/(\d+)/#i",
'matches' => array( array( 'showtopic', '$1' ) ) ) ),
'act=idx' => array( 'app' => 'forums',
'allowRedirect' => 0,
'out' => array( '#act=idx(&|$)#i', 'index' ),
'in' => array( 'regex' => "#/index$#i",
'matches' => array( array( 'act', 'idx' ) ) ) ),
);
@@ -0,0 +1,181 @@
<?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_forums
{
/**
* 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 == 'showtopic' )
{
$this->setKey( 'topic', intval( $v ) );
return TRUE;
}
else if ( $k == 'showforum' )
{
$this->setKey( 'forum', 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 'topic':
return $this->_fetchSeoTitle_topic();
break;
case 'forum':
return $this->_fetchSeoTitle_forum();
break;
}
}
/**
* Return the SEO title for a topic
*
* @access public
* @return string The SEO friendly name
*/
public function _fetchSeoTitle_topic()
{
$topic = $this->DB->buildAndFetch( array( 'select' => 'tid, title_seo, title, forum_id',
'from' => 'topics',
'where' => 'tid=' . intval( $this->_id ) ) );
if ( $topic['tid'] )
{
/* Check permission */
if ( ! $this->registry->getClass('class_forums')->forumsCheckAccess( $topic['forum_id'], 0, 'topic', $topic, TRUE ) )
{
return FALSE;
}
if ( IPB_USE_ONLY_ID_FURL ) return $topic['tid'];
return ( $topic['title_seo'] ) ? $topic['title_seo'] : IPSText::makeSeoTitle( $topic['title'] );
}
return FALSE;
}
/**
* Return the SEO title for a topic
*
* @access public
* @return string The SEO friendly name
*/
public function _fetchSeoTitle_forum()
{
$forum = $this->DB->buildAndFetch( array( 'select' => 'id, name_seo, name',
'from' => 'forums',
'where' => 'id=' . intval( $this->_id ) ) );
if ( $forum['id'] )
{
/* Check permission */
if ( ! $this->registry->getClass('class_forums')->forumsCheckAccess( $forum['id'], 0, 'forum', array(), TRUE ) )
{
return FALSE;
}
return ( $forum['name_seo'] ) ? $forum['name_seo'] : IPSText::makeSeoTitle( $forum['name'] );
}
return FALSE;
}
}
@@ -0,0 +1,71 @@
<?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 Forums
* @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(
'showannouncement' => array( 'app' => 'forums',
'allowRedirect' => 1,
'out' => array( '#showannouncement=(.+?)((?:&|&amp;)f=(.+?))?(&|$)#i', 'forum-$3/announcement-$1-#{__title__}/$4' ),
'in' => array( 'regex' => "#/forum-(\d+?)?/announcement-(\d+?)-#i",
'matches' => array( array( 'showannouncement', '$2' ), array( 'f', '$1' ) ) ) ),
'showforum' => array( 'app' => 'forums',
'allowRedirect' => 1,
'out' => array( '#showforum=(.+?)(&|$)#i', 'forum/$1-#{__title__}/$2' ),
'in' => array( 'regex' => "#/forum/(\d+?)-#i",
'matches' => array( array( 'showforum', '$1' ) ) ) ),
'showtopic' => array( 'app' => 'forums',
'allowRedirect' => 1,
'out' => array( '#showtopic=(.+?)(&|$)#i', 'topic/$1-#{__title__}/$2' ),
'in' => array( 'regex' => "#/topic/(\d+?)-#i",
'matches' => array( array( 'showtopic', '$1' ) ) ) ),
'act=idx' => array( 'app' => 'forums',
'allowRedirect' => 0,
'out' => array( '#act=idx(&|$)#i', 'index$1' ),
'in' => array( 'regex' => "#/index(/|$)#i",
'matches' => array( array( 'act', 'idx' ) ) ) ),
);
@@ -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,203 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Forum permissions mappings
*
* @author $author$
* @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
* @version $Rev: 4429 $
**/
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();
}
/**
* Member Synchronization extensions
*
* @author $author$
* @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
* @version $Rev: 4429 $
**/
class forumsMemberSync
{
/**
* Registry reference
*
* @access public
* @var object
*/
public $registry;
/**
* CONSTRUCTOR
*
* @access public
* @return void
**/
public function __construct()
{
$this->registry = ipsRegistry::instance();
}
/**
* This method is run when a member is flagged as a spammer
*
* @access public
* @param array $member Array of member data
* @return void
**/
public function onSetAsSpammer( $member )
{
}
/**
* This method is run when a member is un-flagged as a spammer
*
* @access public
* @param array $member Array of member data
* @return void
**/
public function onUnSetAsSpammer( $member )
{
}
/**
* This method is run when a new account is created
*
* @access public
* @param array $member Array of member data
* @return void
**/
public function onCreateAccount( $member )
{
}
/**
* This method is run when the register form is displayed to a user
*
* @access public
* @return void
**/
public function onRegisterForm()
{
}
/**
* This method is ren when a user successfully logs in
*
* @access public
* @param array $member Array of member data
* @return void
**/
public function onLogin( $member )
{
}
/**
* This method is called after a member account has been removed
*
* @access public
* @param string $ids SQL IN() clause
* @return void
**/
public function onDelete( $mids )
{
}
/**
* This method is called after a member's account has been merged into another member's account
*
* @access public
* @param array $member Member account being kept
* @param array $member2 Member account being removed
* @return void
**/
public function onMerge( $member, $member2 )
{
}
/**
* This method is run after a users email address is successfully changed
*
* @param integer $id Member ID
* @param string $new_email New email address
* @return void
**/
public function onEmailChange( $id, $new_email )
{
}
/**
* This method is run after a users password is successfully changed
*
* @access public
* @param integer $id Member ID
* @param string $new_plain_text_pass The new password
* @return void
**/
public function onPassChange( $id, $new_plain_text_pass )
{
}
/**
* This method is run after a users profile is successfully updated
* $member will contain EITHER 'member_id' OR 'email' depending on what data was passed to
* IPSMember::save().
*
* @access public
* @param array $member Array of values that were changed
* @return void
**/
public function onProfileUpdate( $member )
{
}
/**
* This method is run after a users group is successfully changed
*
* @access public
* @param integer $id Member ID
* @param integer $new_group New Group ID
* @return void
**/
public function onGroupChange( $id, $new_group )
{
}
/**
* This method is run after a users display name is successfully changed
*
* @access public
* @param integer $id Member ID
* @param string $new_name New display name
* @return void
**/
public function onNameChange( $id, $new_name )
{
}
}
@@ -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,67 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Portal plugin: poll
* 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 Forums
* @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();
}
$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'] = "portal_poll";
/**
* 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']['poll_show_poll'] = array( 'poll_show_poll', 'Shows the request poll' );
@@ -0,0 +1,118 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Portal plugin: poll
* Last Updated: $Date: 2009-06-16 08:17:58 -0400 (Tue, 16 Jun 2009) $
*
* @author $Author: matt $
* @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 1st march 2002
* @version $Revision: 4778 $
*
*/
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_poll extends public_portal_portal_portal
{
/**
* Initialize module
*
* @access public
* @return void
*/
public function init()
{
}
/**
* Display a poll
*
* @access public
* @return string HTML content to replace tag with
*/
public function poll_show_poll()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$extra = "";
$sql = "";
$check = 0;
//-----------------------------------------
// Got a poll?
//-----------------------------------------
if ( ! $this->settings['poll_poll_url'] )
{
return;
}
//-----------------------------------------
// Get the topic ID of the entered URL
//-----------------------------------------
/* Friendly URL */
if( $this->settings['use_friendly_urls'] )
{
preg_match( "#/topic/(\d+)(.*?)/#", $this->settings['poll_poll_url'], $match );
$tid = intval( trim( $match[1] ) );
}
/* Normal URL */
else
{
preg_match( "/(\?|&amp;)(t|showtopic)=(\d+)($|&amp;)/", $this->settings['poll_poll_url'], $match );
$tid = intval( trim( $match[3] ) );
}
if ( !$tid )
{
return;
}
//-----------------------------------------
// Get topic...
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_boards', 'public_topic' ), 'forums' );
$this->registry->class_localization->loadLanguageFile( array( 'public_editors' ), 'core' );
require_once( IPSLib::getAppDir( 'forums' ) . "/sources/classes/forums/class_forums.php" );
$this->registry->setClass( 'class_forums', new class_forums( $this->registry ) );
$this->registry->getClass('class_forums')->strip_invisible = 1;
$this->registry->getClass('class_forums')->forumsInit();
require_once( IPSLib::getAppDir( 'forums', 'forums' ) . '/topics.php' );
$topic = new public_forums_forums_topics();
$topic->makeRegistryShortcuts( $this->registry );
$topic->topic = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'topics', 'where' => "tid=" . $tid ) );
$topic->forum = ipsRegistry::getClass('class_forums')->forum_by_id[ $topic->topic['forum_id'] ];
$this->request['f'] = $topic->forum['id'] ;
$this->request['t'] = $tid ;
if ( $topic->topic['poll_state'] )
{
return $this->registry->getClass('output')->getTemplate('portal')->pollWrapper( $topic->_generatePollOutput(), $tid );
}
else
{
return;
}
}
}
@@ -0,0 +1,68 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Portal plugin: recent topics
* 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 Forums
* @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();
}
$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'] = "portal_recent_topics";
/**
* 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']['recent_topics_last_x'] = array( 'recent_topics_last_x' , 'Shows the last X topics with full post from the selected forums' );
$PORTAL_CONFIG['pc_exportable_tags']['recent_topics_discussions_last_x'] = array( 'recent_topics_discussions_last_x', 'Shows the last X topic titles from ALL viewable forums' );
@@ -0,0 +1,450 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Portal plugin: recent topics
* Last Updated: $Date: 2009-12-07 21:57:46 -0500 (Mon, 07 Dec 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 1st march 2002
* @version $Revision: 5529 $
*
*/
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_recent_topics extends public_portal_portal_portal
{
/**
* Initialize module
*
* @access public
* @return void
*/
public function init()
{
$this->settings['csite_article_date'] = $this->settings['csite_article_date'] ? $this->settings['csite_article_date'] : '%c';
}
/**
* Show the recently started topic titles
*
* @access public
* @return string HTML content to replace tag with
*/
public function recent_topics_discussions_last_x()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$results = array();
$limit = $this->settings['recent_topics_discuss_number'] ? $this->settings['recent_topics_discuss_number'] : 5;
$where_clause = array();
/* Loop through the forums and build a list of forums we're allowed access to */
$forumIdsOk = array();
foreach( $this->registry->class_forums->forum_by_id as $id => $data )
{
/* Can we read? */
if ( ! $this->registry->permissions->check( 'read', $data ) )
{
continue;
}
/* Can read, but is it password protected, etc? */
if ( ! $this->registry->class_forums->forumsCheckAccess( $id, 0, 'forum', array(), true ) )
{
continue;
}
if ( ! $data['can_view_others'] )
{
continue;
}
if ( $data['min_posts_view'] > $this->memberData['posts'] )
{
continue;
}
$forumIdsOk[] = $id;
}
if ( count( $forumIdsOk) )
{
/* Add allowed forums */
$where_clause[] = "t.forum_id IN (" . implode( ",", $forumIdsOk ) . ")";
$this->DB->build( array( 'select' => 't.tid, t.title, t.posts, t.start_date as post_date, t.views, t.title_seo, t.starter_name',
'from' => array( 'topics' => 't' ),
'where' => "t.approved=1 and t.state != 'closed' and (t.state != 'link') " . ( count($where_clause) ? ' AND ' . implode( ' AND ', $where_clause ) : '' ),
'order' => 't.tid DESC',
'limit' => array( 0, $limit ),
'add_join' => array(
array(
'from' => array( 'forums' => 'f' ),
'where' => "f.id=t.forum_id",
'type' => 'left',
),
array(
'select' => 'm.member_id, m.members_display_name, m.members_seo_name',
'from' => array( 'members' => 'm' ),
'where' => "m.member_id=t.starter_id",
'type' => 'left',
),
)
) );
$outer = $this->DB->execute();
while ( $row = $this->DB->fetch($outer) )
{
$row['title_display'] = IPSText::truncate( $row['title'], 30 );
$row['date'] = $this->registry->class_localization->getDate( $row['post_date'], "manual{{$this->settings['csite_article_date']}}" );
if( !$row['member_id'] )
{
$row['members_display_name'] = $this->settings['guest_name_pre'] . $row['starter_name'] . $this->settings['guest_name_suf'];
}
$results[] = $row;
}
}
return $this->registry->getClass('output')->getTemplate('portal')->latestPosts( $results );
}
/**
* Show the "news" articles
*
* @access public
* @return string HTML content to replace tag with
*/
public function recent_topics_last_x()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$attach_pids = array();
$attach_posts = array();
$forums = array();
$rows = array();
$output = array();
$where_clause = array();
$limit = $this->settings['recent_topics_article_max'] ? $this->settings['recent_topics_article_max'] : 5;
$posts = intval($this->memberData['posts']);
//-----------------------------------------
// Grab articles new/recent in 1 bad ass query
//-----------------------------------------
foreach( explode( ',', $this->settings['recent_topics_article_forum'] ) as $forum_id )
{
if( !$forum_id )
{
continue;
}
$forums[] = intval($forum_id);
}
if( !count($forums) )
{
return;
}
/* Loop through the forums and build a list of forums we're allowed access to */
$forumIdsOk = array();
foreach( $this->registry->class_forums->forum_by_id as $id => $data )
{
/* Allowing this forum? */
if ( ! in_array( $id, $forums, $id ) )
{
continue;
}
/* Can we read? */
if ( ! $this->registry->permissions->check( 'read', $data ) )
{
continue;
}
/* Can read, but is it password protected, etc? */
if ( ! $this->registry->class_forums->forumsCheckAccess( $id, 0, 'forum', array(), true ) )
{
continue;
}
if ( ! $data['can_view_others'] )
{
continue;
}
if ( $data['min_posts_view'] > $posts )
{
continue;
}
$forumIdsOk[] = $id;
}
if( !count($forumIdsOk) )
{
return '';
}
/* Add allowed forums */
$where_clause[] = "t.forum_id IN (" . implode( ",", $forumIdsOk ) . ")";
//-----------------------------------------
// Will we need to parse attachments?
//-----------------------------------------
$parseAttachments = false;
//-----------------------------------------
// Run query
//-----------------------------------------
$pinned = array();
$unpinned = array();
$all = array();
$data = array();
$count = 0;
if( !$this->settings['portal_exclude_pinned'] )
{
/* Fetch all pinned topics to avoid filesort */
$this->DB->build( array( 'select' => 't.tid, t.start_date',
'from' => 'topics t',
'where' => "t.pinned=1 AND t.approved=1 AND t.state != 'link'" . ( count($where_clause) ? ' AND ' . implode( ' AND ', $where_clause ) : '' ),
//'order' => 't.tid DESC',
'limit' => array ( $limit ) ) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
{
$pinned[ $row['start_date'] ] = $row['tid'];
$all[ $row['start_date'] ] = $row['tid'];
}
}
/* Still need more? */
if ( count( $pinned ) < $limit )
{
$pinnedWhere = $this->settings['portal_exclude_pinned'] ? "" : "t.pinned=0 AND ";
$this->DB->build( array( 'select' => 't.tid, t.start_date',
'from' => 'topics t',
'where' => $pinnedWhere . "t.approved=1 AND t.state != 'link'" . ( count($where_clause) ? ' AND ' . implode( ' AND ', $where_clause ) : '' ),
'order' => 'tid DESC',
'limit' => array ( $limit - count( $pinned ) ) ) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
{
$unpinned[ $row['start_date'] ] = $row['tid'];
$all[ $row['start_date'] ] = $row['tid'];
}
}
/* got anything? */
if ( ! count( $all ) )
{
return;
}
$this->DB->build( array(
'select' => 't.*',
'from' => array( 'topics' => 't' ),
'where' => "t.tid IN (" . implode( ",", array_values( $all ) ) . ")",
'add_join' => array(
array(
'select' => 'p.*',
'from' => array( 'posts' => 'p' ),
'where' => 'p.pid=t.topic_firstpost',
'type' => 'left'
),
array(
'select' => 'f.use_html',
'from' => array( 'forums' => 'f' ),
'where' => "f.id=t.forum_id",
'type' => 'left',
),
array(
'select' => 'm.member_id, m.members_display_name, m.member_group_id, m.members_seo_name, m.mgroup_others, m.login_anonymous, m.last_visit, m.last_activity',
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id=p.author_id',
'type' => 'left'
),
array(
'select' => 'pp.*',
'from' => array( 'profile_portal' => 'pp' ),
'where' => 'pp.pp_member_id=m.member_id',
'type' => 'left'
),
)
) );
$outer = $this->DB->execute();
//-----------------------------------------
// Loop through..
//-----------------------------------------
while( $row = $this->DB->fetch($outer) )
{
$data[ $row['tid'] ] = $row;
}
krsort( $unpinned );
krsort( $pinned );
foreach( $unpinned as $date => $tid )
{
if ( count( $pinned ) < $limit )
{
$pinned[ $date ] = $tid;
}
else
{
break;
}
$count++;
}
/* Now put it altogether */
foreach( $pinned as $date => $tid )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$entry = $data[ $tid ];
$bottom_string = "";
$read_more = "";
$top_string = "";
$got_these_attach = 0;
if( $entry['topic_hasattach'] )
{
$parseAttachments = true;
}
//-----------------------------------------
// Parse the post
//-----------------------------------------
IPSText::getTextClass( 'bbcode' )->parse_smilies = $entry['use_emo'];
IPSText::getTextClass( 'bbcode' )->parse_html = ( $entry['use_html'] and $entry['post_htmlstate'] ) ? 1 : 0;
IPSText::getTextClass( 'bbcode' )->parse_nl2br = $entry['post_htmlstate'] == 2 ? 1 : 0;
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
IPSText::getTextClass( 'bbcode' )->parsing_section = 'topics';
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $entry['member_group_id'];
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $entry['mgroup_others'];
$entry['post'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $entry['post'] );
//-----------------------------------------
// BASIC INFO
//-----------------------------------------
$real_posts = $entry['posts'];
$entry['posts'] = ipsRegistry::getClass('class_localization')->formatNumber(intval($entry['posts']));
if( !$entry['author_id'] )
{
$entry['members_display_name'] = $this->settings['guest_name_pre'] . $entry['author_name'] . $this->settings['guest_name_suf'];
$entry['member_id'] = 0;
}
else
{
$entry = IPSMember::buildDisplayData( $entry );
}
//-----------------------------------------
// Get Date
//-----------------------------------------
$entry['date'] = $this->registry->class_localization->getDate( $entry['post_date'], "manual{" . $this->settings['csite_article_date'] . "}" );
//-----------------------------------------
// Attachments?
//-----------------------------------------
if( $entry['pid'] )
{
$attach_pids[ $entry['pid'] ] = $entry['pid'];
}
//-----------------------------------------
// Avatar
//-----------------------------------------
$entry['avatar'] = IPSMember::buildAvatar( $entry );
if ( IPSMember::checkPermissions('download', $entry['forum_id'] ) === FALSE )
{
$this->settings[ 'show_img_upload'] = 0 ;
}
//-----------------------------------------
// View image...
//-----------------------------------------
$entry['post'] = IPSText::getTextClass( 'bbcode' )->memberViewImages( $entry['post'] );
$rows[] = $entry;
}
$output = $this->registry->getClass('output')->getTemplate('portal')->articles( $rows );
//-----------------------------------------
// Process Attachments
//-----------------------------------------
if ( $parseAttachments AND count( $attach_pids ) )
{
if ( ! is_object( $this->class_attach ) )
{
//-----------------------------------------
// Grab render attach class
//-----------------------------------------
require_once( IPSLib::getAppDir( 'core' ) . '/sources/classes/attach/class_attach.php' );
$this->class_attach = new class_attach( $this->registry );
$this->class_attach->attach_post_key = '';
ipsRegistry::getClass( 'class_localization' )->loadLanguageFile( array( 'public_topic' ), 'forums' );
}
$this->class_attach->attach_post_key = '';
$this->class_attach->type = 'post';
$this->class_attach->init();
$output = $this->class_attach->renderAttachments( $output, $attach_pids );
$output = $output[0]['html'];
}
return $output;
}
}
@@ -0,0 +1,47 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Reputation configuration for application
* Last Updated: $Date: 2009-11-13 12:11:37 -0500 (Fri, 13 Nov 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 Forums
* @link http://www.iinvisionpower.com
* @version $Rev: 5402 $
**/
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();
}
$rep_author_config = array(
'pid' => array( 'column' => 'author_id', 'table' => 'posts' )
);
/*
* The following config items are for the log viewer in the ACP */
$rep_log_joins = array(
array(
'from' => array( 'posts' => 'p' ),
'where' => 'r.type="pid" AND r.type_id=p.pid and r.app="forums"',
'type' => 'left'
),
array(
'select' => 't.title as repContentTitle, t.tid as repContentID',
'from' => array( 'topics' => 't' ),
'where' => 'p.topic_id=t.tid',
'type' => 'left'
),
);
$rep_log_where = "p.author_id=%s";
$rep_log_link = 'findpost=%d';
@@ -0,0 +1,138 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* RSS output plugin :: posts
* Last Updated: $Date: 2009-07-09 03:49:55 -0400 (Thu, 09 Jul 2009) $
*
* @author $Author: matt $
* @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: 4857 $
*/
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_forums
{
/**
* Expiration date
*
* @access private
* @var integer Expiration timestamp
*/
private $expires = 0;
/**
* Grab the RSS links
*
* @access public
* @return array RSS links
*/
public function getRssLinks()
{
$return = array();
ipsRegistry::DB()->build( array( 'select' => 'rss_export_title, rss_export_id', 'from' => 'rss_export', 'where' => 'rss_export_enabled=1' ) );
ipsRegistry::DB()->execute();
while( $r = ipsRegistry::DB()->fetch() )
{
$return[] = array( 'title' => $r['rss_export_title'], 'url' => ipsRegistry::getClass('output')->formatUrl( ipsRegistry::$settings['board_url'] . "/index.php?app=core&amp;module=global&amp;section=rss&amp;type=forums&amp;id=" . $r['rss_export_id'], '%%' . $r['rss_export_title'] . '%%', 'section=rss2' ) );
}
return $return;
}
/**
* Grab the RSS document content and return it
*
* @access public
* @return string RSS document
*/
public function returnRSSDocument()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$rss_export_id = intval( ipsRegistry::$request['id'] );
$rss_data = array();
$to_print = '';
$this->expires = time();
//-----------------------------------------
// Get RSS export
//-----------------------------------------
$rss_data = ipsRegistry::DB()->buildAndFetch( array( 'select' => '*',
'from' => 'rss_export',
'where' => 'rss_export_id=' . $rss_export_id ) );
//-----------------------------------------
// Got one?
//-----------------------------------------
if ( $rss_data['rss_export_id'] AND $rss_data['rss_export_enabled'] )
{
//-----------------------------------------
// Correct expires time
//-----------------------------------------
$this->expires += $rss_data['rss_export_cache_time'] * 60;
//-----------------------------------------
// Need to recache?
//-----------------------------------------
$time_check = time() - ( $rss_data['rss_export_cache_time'] * 60 );
if ( ( ! $rss_data['rss_export_cache_content'] ) OR $time_check > $rss_data['rss_export_cache_last'] )
{
//-----------------------------------------
// Yes
//-----------------------------------------
define( 'IN_ACP', 1 );
require_once( IPSLib::getAppDir( 'forums' ) . '/app_class_forums.php' );
$app_class_forums = new app_class_forums( ipsRegistry::instance() );
require_once( IPSLib::getAppDir( 'forums' ) . '/modules_admin/rss/export.php' );
$rss_export = new admin_forums_rss_export();
$rss_export->makeRegistryShortcuts( ipsRegistry::instance() );
return $rss_export->rssExportRebuildCache( $rss_data['rss_export_id'], 0 );
}
else
{
//-----------------------------------------
// No
//-----------------------------------------
return $rss_data['rss_export_cache_content'];
}
}
}
/**
* Grab the RSS document expiration timestamp
*
* @access public
* @return integer Expiration timestamp
*/
public function grabExpiryDate()
{
return $this->expires ? $this->expires : time();
}
}
@@ -0,0 +1,399 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Formats forum search results
* Last Updated: $Date: 2009-10-29 08:54:35 -0400 (Thu, 29 Oct 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 Forums
* @link http://www.iinvisionpower.com
* @version $Rev: 5290 $
**/
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 forumsSearchDisplay implements iSearchDisplay
{
/**
* Last topic id completed
*
* @access private
* @var integer Topic id
*/
private $last_topic = 0;
/**
* The search plugin for this app
*
* @access public
* @var object
*/
public $search_plugin;
/**
* Formats the forum search result for display
*
* @access public
* @param array $search_row Array of data from search_index
* @param bool $isVnc Is from view new content
* @return mixed Formatted content, ready for display, or array containing a $sub section flag, and content
**/
public function formatContent( $search_row, $isVnc=false )
{
/* Get class forums, used for displaying forum names on results */
if( ipsRegistry::isClassLoaded('class_forums') !== TRUE )
{
require_once( IPSLib::getAppDir( 'forums' ) . "/sources/classes/forums/class_forums.php" );
ipsRegistry::setClass( 'class_forums', new class_forums( ipsRegistry::instance() ) );
ipsRegistry::getClass( 'class_forums' )->forumsInit();
}
/* Array */
$search_row = $this->_buildOutputArray( $search_row );
/* Indent */
$indent = ( $this->last_topic == $search_row['type_id_2'] );
$this->last_topic = $search_row['type_id_2'];
/* Various data */
$search_row['_last_post'] = $search_row['last_post'];
$search_row['_longTitle'] = $search_row['content_title'];
$search_row['_shortTitle'] = IPSText::truncate( $search_row['content_title'], 60 );
$search_row['last_poster'] = $search_row['last_poster_id'] ? IPSLib::makeProfileLink( $search_row['last_poster_name'], $search_row['last_poster_id'], $search_row['seo_last_name'] ) : ipsRegistry::$settings['guest_name_pre'] . $search_row['last_poster_name'] . ipsRegistry::$settings['guest_name_suf'];
$search_row['starter'] = $search_row['starter_id'] ? IPSLib::makeProfileLink( $search_row['starter_name'], $search_row['starter_id'], $search_row['seo_first_name'] ) : $this->settings['guest_name_pre'] . $search_row['starter_name'] . $this->settings['guest_name_suf'];
//$search_row['posts'] = ipsRegistry::getClass('class_localization')->formatNumber( intval($search_row['posts']) );
//$search_row['views'] = ipsRegistry::getClass('class_localization')->formatNumber( intval($search_row['views']) );
$search_row['last_post'] = ipsRegistry::getClass( 'class_localization')->getDate( $search_row['last_post'], 'SHORT' );
if ( isset( $search_row['post_date'] ) )
{
$search_row['_post_date'] = $search_row['post_date'];
$search_row['post_date'] = ipsRegistry::getClass( 'class_localization')->getDate( $search_row['post_date'], 'SHORT' );
}
if ( $this->memberData['is_mod'] )
{
$search_row['posts'] += intval($search_row['topic_queuedposts']);
}
if ($search_row['posts'])
{
if ( (($search_row['posts'] + 1) % ipsRegistry::$settings['display_max_posts']) == 0 )
{
$pages = ($search_row['posts'] + 1) / ipsRegistry::$settings['display_max_posts'];
}
else
{
$number = ( ($search_row['posts'] + 1) / ipsRegistry::$settings['display_max_posts'] );
$pages = ceil( $number);
}
}
if ( $pages > 1 )
{
for ( $i = 0 ; $i < $pages ; ++$i )
{
$real_no = $i * ipsRegistry::$settings['display_max_posts'];
$page_no = $i + 1;
if ( $page_no == 4 and $pages > 4 )
{
$search_row['pages'][] = array( 'last' => 1,
'st' => ($pages - 1) * ipsRegistry::$settings['display_max_posts'],
'page' => $pages );
break;
}
else
{
$search_row['pages'][] = array( 'last' => 0,
'st' => $real_no,
'page' => $page_no );
}
}
}
/* Format as a topic */
if( $search_row['type_2'] == 'topic' )
{
/* Forum Breadcrum */
$search_row['_forum_trail'] = ipsRegistry::getClass( 'class_forums' )->forumsBreadcrumbNav( $search_row['forum_id'] );
/* Is it read? We don't support last_vote in search. */
$is_read = ipsRegistry::getClass( 'classItemMarking' )->isRead( array( 'forumID' => $search_row['forum_id'], 'itemID' => $search_row['type_id_2'], 'itemLastUpdate' => $search_row['lastupdate'] ? $search_row['lastupdate'] : $search_row['updated'] ), 'forums' );
/* Has posted dot */
$show_dots = '';
if( ipsRegistry::$settings['show_user_posted'] )
{
if( ipsRegistry::member()->getProperty('member_id') && ( isset( $search_row['_topic_array'][$search_row['type_id_2']] ) && $search_row['_topic_array'][$search_row['type_id_2']] ) )
{
$show_dots = 1;
}
}
/* Icon */
$search_row['_icon'] = ipsRegistry::getClass( 'class_forums' )->fetchTopicFolderIcon( $search_row, $show_dots, $is_read );
$search_row['_isRead'] = $is_read;
/* Display type */
if ( $this->search_plugin->getShowAsForum() !== true )
{
return array( ipsRegistry::getClass( 'output' )->getTemplate( 'search' )->topicPostSearchResult( $search_row, $indent, ( $this->search_plugin->onlyTitles || $this->search_plugin->noPostPreview ) ? 1 : 0 ), $indent );
}
else
{
return array( ipsRegistry::getClass( 'output' )->getTemplate( 'search' )->topicPostSearchResultAsForum( $search_row, $indent, ( $this->search_plugin->onlyTitles || $this->search_plugin->noPostPreview ) ? 1 : 0 ), $indent );
}
}
/* Format as a forum */
else
{
return ipsRegistry::getClass( 'output' )->getTemplate( 'search' )->forumSearchResult( $search_row, ( $this->search_plugin->onlyTitles || $this->search_plugin->noPostPreview ) ? 1 : 0 );
}
}
/**
* Internal function, used to sort out the pid and title
*
* @access private
* @param array $r Array of data
* @return array Formatted data, ready for output
**/
private function _buildOutputArray( $r )
{
if( $r['misc'] )
{
$_data = unserialize( $r['misc'] );
$r['misc'] = isset( $_data['pid'] ) && $_data['pid'] ? $_data['pid'] : $r['misc'];
$r['content_title'] = isset( $_data['title'] ) && $_data['title'] ? $_data['title'] : $r['content_title'];
}
return $r;
}
/**
* Retuns the html for displaying the forum category filter on the advanced search page
*
* @access public
* @return string Filter HTML
**/
public function getFilterHTML()
{
/* Make sure class_forums is setup */
if( ipsRegistry::isClassLoaded('class_forums') !== TRUE )
{
require_once( IPSLib::getAppDir( 'forums' ) . "/sources/classes/forums/class_forums.php" );
ipsRegistry::setClass( 'class_forums', new class_forums( ipsRegistry::instance() ) );
ipsRegistry::getClass( 'class_forums' )->strip_invisible = 1;
ipsRegistry::getClass( 'class_forums' )->forumsInit();
}
return ipsRegistry::getClass( 'output' )->getTemplate( 'search' )->forumAdvancedSearchFilters( ipsRegistry::getClass( 'class_forums' )->buildForumJump( 0, 1 ) );
}
/**
* Returns an array used in the searchplugin's setCondition method
*
* @access public
* @param array $data Array of forums to view
* @return array Array with column, operator, and value keys, for use in the setCondition call
**/
public function buildFilterSQL( $data )
{
$return = array();
if( isset( $data ) && is_array( $data ) && count( $data ) )
{
/* Load class_forums so that we can search sub forums automatically */
if( ipsRegistry::isClassLoaded('class_forums') !== TRUE )
{
require_once( IPSLib::getAppDir( 'forums' ) . '/sources/classes/forums/class_forums.php' );
ipsRegistry::setClass( 'class_forums', new class_forums( ipsRegistry::instance() ) );
ipsRegistry::getClass( 'class_forums' )->forumsInit();
}
foreach( $data as $field => $_data )
{
/* FORUMS */
if ( $field == 'forums' && count( $data['forums'] ) )
{
/* Get a list of child ids */
foreach( $data['forums'] as $forum_id )
{
$children = ipsRegistry::getClass( 'class_forums' )->forumsGetChildren( $forum_id );
foreach( $children as $kid )
{
if( ! in_array( $kid, $data['forums'] ) )
{
$data['forums'][] = $kid;
}
}
}
# Handled in searchPlugin::buildWhereStatement
//$return[] = array( 'column' => 'type_id', 'operator' => 'IN', 'value' => implode( ',', $data['forums'] ) );
}
/* CONTENT ONLY */
if ( $field == 'noPreview' AND $data['noPreview'] == 1 )
{
$this->search_plugin->noPostPreview = true;
}
/* CONTENT ONLY */
if ( $field == 'contentOnly' AND $data['contentOnly'] == 1 )
{
$this->search_plugin->onlyPosts = true;
}
/* POST COUNT */
if ( $field == 'pCount' AND intval( $data['pCount'] ) > 0 )
{
$return[] = array( 'column' => 't.posts', 'operator' => '>=', 'value' => intval( $data['pCount'] ) );
}
/* TOPIC VIEWS */
if ( $field == 'pViews' AND intval( $data['pViews'] ) > 0 )
{
$return[] = array( 'column' => 't.views', 'operator' => '>=', 'value' => intval( $data['pViews'] ) );
}
}
return $return;
}
else
{
return '';
}
}
/**
* Modify the search query
*
* @access public
* @param array $query The current unmodified query
* @param bool [$count_only] Set to true if this is a count(*) query
* @return array Search query, modified by the plugin
**/
public function modifySearchQuery( $query, $count_only=false )
{
if( ipsRegistry::$settings['search_method'] == 'sphinx' )
{
$query->SetFilter( 'approved', array( 1 ) );
$query->SetFilter( 'queued' , array( 0 ) );
$query->SetFilter( 'password', array( 0 ) );
if( isset( ipsRegistry::$request['search_app_filters']['forums']['forums'] ) && is_array( ipsRegistry::$request['search_app_filters']['forums']['forums'] ) && count( ipsRegistry::$request['search_app_filters']['forums']['forums'] ) )
{
/* Load class_forums so that we can search sub forums automatically */
if( ipsRegistry::isClassLoaded('class_forums') !== TRUE )
{
require_once( IPSLib::getAppDir( 'forums' ) . '/sources/classes/forums/class_forums.php' );
ipsRegistry::setClass( 'class_forums', new class_forums( ipsRegistry::instance() ) );
ipsRegistry::getClass( 'class_forums' )->forumsInit();
}
$forum_ids = array();
/* Get a list of child ids */
foreach( ipsRegistry::$request['search_app_filters']['forums']['forums'] as $forum_id )
{
if( $forum_id )
{
$forum_ids[] = intval($forum_id);
//$children = ipsRegistry::getClass( 'class_forums' )->forumsGetChildren( $forum_id );
//foreach( $children as $kid )
//{
// if( ! in_array( $kid, ipsRegistry::$request['search_app_filters']['forums'] ) )
// {
// $forum_ids[] = $kid;
// }
//}
}
}
if( is_array($forum_ids) AND count($forum_ids) )
{
$query->SetFilter( 'forum_id', $forum_ids );
}
}
/* Limit by forum */
$type = ipsRegistry::$request['type'];
$type_id = intval( ipsRegistry::$request['type_id'] );
if( $type && $type_id )
{
$query->SetFilter( 'forum_id', array( $type_id ) );
}
/* Limit by topic */
$type_2 = ipsRegistry::$request['type_2'];
$type_id_2 = intval( ipsRegistry::$request['type_id_2'] );
if( $type_2 && $type_id_2 )
{
$query->SetFilter( 'tid', array( $type_id_2 ) );
}
}
else
{
return $query;
}
}
/**
* Run the search query.
* This allows us to set different indexes
*
* @access public
* @param object $sphinxClient The sphinx client reference
* @param string $search_term The search term
* @param bool $group_results Group posts by topic
* @return array Sphinx result array
**/
public function runSearchQuery( $sphinxClient, $search_term='', $group_results=false )
{
if( ipsRegistry::$settings['search_method'] == 'sphinx' )
{
if( ipsRegistry::$request['content_title_only'] == 1 )
{
return $sphinxClient->Query( $search_term, 'forums_search_topics_main,forums_search_topics_delta' );
}
else
{
if( $group_results )
{
$sphinxClient->SetGroupBy( 'tid', SPH_GROUPBY_ATTR, '@group DESC');
}
if( ipsRegistry::$request['f_content_only'] )
{
return $sphinxClient->Query( $search_term, 'forums_search_posts_main,forums_search_posts_delta' );
}
else
{
return $sphinxClient->Query( $search_term, 'forums_search_posts_main,forums_search_topics_main,forums_search_posts_delta,forums_search_topics_delta' );
}
}
}
else
{
return array();
}
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,171 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Sphinx template file
* Last Updated: $Date: 2009-08-12 18:07:52 -0400 (Wed, 12 Aug 2009) $
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Forums
* @link http://www.iinvisionpower.com
* @version $Rev: 5013 $
* @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
################################# --- FORUM --- ##############################
source forums_search_posts_main : ipb_source_config
{
# Set our forum PID counter
sql_query_pre = REPLACE INTO <!--SPHINX_DB_PREFIX-->cache_store VALUES( 'sphinx_forums_counter_posts', (SELECT max(pid) FROM <!--SPHINX_DB_PREFIX-->posts), '', 0, UNIX_TIMESTAMP() )
# Query posts for the main source
sql_query = SELECT p.pid, p.pid as search_id, p.author_id, p.post_date, p.post, p.topic_id, p.queued, \
t.tid, t.forum_id, t.approved, \
REPLACE( pi.perm_view, '*', 0 ) as perm_view, \
CASE WHEN pi.authorized_users IS NULL OR pi.authorized_users='' THEN 0 ELSE pi.authorized_users END AS authorized_users, \
CASE WHEN pi.friend_only=0 THEN 0 ELSE p.author_id END AS friend_only, \
CASE WHEN pi.owner_only=0 THEN 0 ELSE p.author_id END AS owner_only, \
CASE WHEN f.password <> '' THEN 1 ELSE 0 END AS password \
FROM <!--SPHINX_DB_PREFIX-->posts p \
LEFT JOIN <!--SPHINX_DB_PREFIX-->topics t ON ( p.topic_id=t.tid ) \
LEFT JOIN <!--SPHINX_DB_PREFIX-->forums f ON ( t.forum_id=f.id ) \
LEFT JOIN <!--SPHINX_DB_PREFIX-->permission_index pi ON ( pi.perm_type_id=t.forum_id AND pi.perm_type='forum' )
# Fields
sql_attr_bool = queued
sql_attr_bool = approved
sql_attr_uint = search_id
sql_attr_uint = friend_only
sql_attr_uint = forum_id
sql_attr_uint = owner_only
sql_attr_timestamp = post_date
sql_attr_multi = uint perm_view from field
sql_attr_multi = uint authorized_users from field
sql_attr_bool = password
sql_attr_uint = author_id
sql_attr_uint = tid
sql_ranged_throttle = 0
}
source forums_search_topics_main : ipb_source_config
{
# Set our forum PID counter
sql_query_pre = REPLACE INTO <!--SPHINX_DB_PREFIX-->cache_store VALUES( 'sphinx_forums_counter_topics', (SELECT max(tid) FROM <!--SPHINX_DB_PREFIX-->topics), '', 0, UNIX_TIMESTAMP() )
# Query posts for the main source
sql_query = SELECT t.tid, t.tid as search_id, t.forum_id, t.approved, t.title, t.last_post, t.last_poster_id as author_id, \
REPLACE( pi.perm_view, '*', 0 ) as perm_view, \
CASE WHEN pi.authorized_users IS NULL OR pi.authorized_users='' THEN 0 ELSE pi.authorized_users END AS authorized_users, \
CASE WHEN pi.friend_only=0 THEN 0 ELSE t.last_poster_id END AS friend_only, \
CASE WHEN pi.owner_only=0 THEN 0 ELSE t.last_poster_id END AS owner_only, \
CASE WHEN f.password <> '' THEN 1 ELSE 0 END AS password \
FROM <!--SPHINX_DB_PREFIX-->topics t \
LEFT JOIN <!--SPHINX_DB_PREFIX-->forums f ON ( t.forum_id=f.id ) \
LEFT JOIN <!--SPHINX_DB_PREFIX-->permission_index pi ON ( pi.perm_type_id=t.forum_id AND pi.perm_type='forum' )
# Fields
sql_attr_bool = approved
sql_attr_uint = search_id
sql_attr_uint = friend_only
sql_attr_uint = forum_id
sql_attr_uint = owner_only
sql_attr_timestamp = last_post
sql_attr_multi = uint perm_view from field
sql_attr_multi = uint authorized_users from field
sql_attr_bool = password
sql_attr_uint = author_id
sql_ranged_throttle = 0
}
source forums_search_posts_delta : forums_search_posts_main
{
# Override the base sql_query_pre
sql_query_pre =
# Query posts for the delta source
sql_query = SELECT p.pid, p.pid as search_id, p.author_id, p.post_date, p.post, p.topic_id, p.queued, \
t.tid, t.forum_id, t.approved, t.title, \
REPLACE( pi.perm_view, '*', 0 ) as perm_view, \
CASE WHEN pi.authorized_users IS NULL OR pi.authorized_users='' THEN 0 ELSE pi.authorized_users END AS authorized_users, \
CASE WHEN pi.friend_only=0 THEN 0 ELSE p.author_id END AS friend_only, \
CASE WHEN pi.owner_only=0 THEN 0 ELSE p.author_id END AS owner_only, \
CASE WHEN f.password <> '' THEN 1 ELSE 0 END AS password \
FROM <!--SPHINX_DB_PREFIX-->posts p \
LEFT JOIN <!--SPHINX_DB_PREFIX-->topics t ON ( p.topic_id=t.tid ) \
LEFT JOIN <!--SPHINX_DB_PREFIX-->forums f ON ( t.forum_id=f.id ) \
LEFT JOIN <!--SPHINX_DB_PREFIX-->permission_index pi ON ( pi.perm_type_id=t.forum_id AND pi.perm_type='forum' ) \
WHERE p.pid > ( SELECT cs_value FROM <!--SPHINX_DB_PREFIX-->cache_store WHERE cs_key='sphinx_forums_counter_posts' )
}
source forums_search_topics_delta : forums_search_topics_main
{
# Override the base sql_query_pre
sql_query_pre =
# Query posts for the delta source
sql_query = SELECT t.tid, t.tid as search_id, t.forum_id, t.approved, t.title, t.last_post, t.last_poster_id as author_id, \
REPLACE( pi.perm_view, '*', 0 ) as perm_view, \
CASE WHEN pi.authorized_users IS NULL OR pi.authorized_users='' THEN 0 ELSE pi.authorized_users END AS authorized_users, \
CASE WHEN pi.friend_only=0 THEN 0 ELSE t.last_poster_id END AS friend_only, \
CASE WHEN pi.owner_only=0 THEN 0 ELSE t.last_poster_id END AS owner_only, \
CASE WHEN f.password <> '' THEN 1 ELSE 0 END AS password \
FROM <!--SPHINX_DB_PREFIX-->topics t \
LEFT JOIN <!--SPHINX_DB_PREFIX-->forums f ON ( t.forum_id=f.id ) \
LEFT JOIN <!--SPHINX_DB_PREFIX-->permission_index pi ON ( pi.perm_type_id=t.forum_id AND pi.perm_type='forum' ) \
WHERE t.tid > ( SELECT cs_value FROM <!--SPHINX_DB_PREFIX-->cache_store WHERE cs_key='sphinx_forums_counter_topics' )
}
index forums_search_posts_main
{
source = forums_search_posts_main
path = <!--SPHINX_BASE_PATH-->/forums_search_posts_main
docinfo = extern
mlock = 0
morphology = none
min_word_len = 2
charset_type = sbcs
html_strip = 0
}
index forums_search_posts_delta : forums_search_posts_main
{
source = forums_search_posts_delta
path = <!--SPHINX_BASE_PATH-->/forums_search_posts_delta
}
index forums_search_topics_main
{
source = forums_search_topics_main
path = <!--SPHINX_BASE_PATH-->/forums_search_topics_main
docinfo = extern
mlock = 0
morphology = none
min_word_len = 2
charset_type = sbcs
html_strip = 0
}
index forums_search_topics_delta : forums_search_topics_main
{
source = forums_search_topics_delta
path = <!--SPHINX_BASE_PATH-->/forums_search_topics_delta
}
EOF;
File diff suppressed because it is too large. Load diff