Version 3.1.4
This commit is contained in:
1 parent
1d4720f3e2
commit
ae5c01cc78
2563 files changed
+283048
-240689
No files matched your search
@@ -1,106 +1,107 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* Group property updater (Forums)
|
||||
* Last Updated: $Date: 2010-09-29 20:23:38 -0400 (Wed, 29 Sep 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 6925 $
|
||||
*
|
||||
*/
|
||||
|
||||
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_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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1 +1,10 @@
|
||||
<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>␍
|
||||
<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>
|
||||
@@ -1,138 +1,140 @@
|
||||
<?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&module=tools&do=deleteposts',
|
||||
'title' => ipsRegistry::getClass('class_localization')->words['m_deltitle'] );
|
||||
|
||||
$array[] = array( 'img' => '',
|
||||
'url' => 'section=tools&module=tools&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;
|
||||
}
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* Member property updater (AJAX)
|
||||
* Last Updated: $Date: 2010-03-22 22:39:27 -0400 (Mon, 22 Mar 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: josh $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Revision: 5986 $
|
||||
*
|
||||
*/
|
||||
|
||||
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&module=tools&do=deleteposts',
|
||||
'title' => ipsRegistry::getClass('class_localization')->words['m_deltitle'] );
|
||||
|
||||
$array[] = array( 'img' => '',
|
||||
'url' => 'section=tools&module=tools&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(), $tabsUsed=5 )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// 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, ( $tabsUsed + 1 ) ), 'content' => $this->html->acp_member_form_main( $member, ( $tabsUsed + 1 ) ), 'tabsUsed' => 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* 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,10 @@
|
||||
<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,691 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* IP.Board post attachments plugin
|
||||
* Last Updated: $Date: 2010-10-20 09:03:17 -0400 (Wed, 20 Oct 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: ips_terabyte $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Core
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 6/24/2008
|
||||
* @version $Revision: 7003 $
|
||||
*/
|
||||
|
||||
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 plugin_post extends class_attach
|
||||
{
|
||||
/**
|
||||
* Module type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $module = 'post';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param object ipsRegistry reference
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry )
|
||||
{
|
||||
parent::__construct( $registry );
|
||||
|
||||
/* Load and init forums */
|
||||
if( ipsRegistry::isClassLoaded('class_forums') !== TRUE )
|
||||
{
|
||||
try
|
||||
{
|
||||
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums' );
|
||||
$this->registry->setClass( 'class_forums', new $classToLoad( $registry ) );
|
||||
}
|
||||
catch( Exception $error )
|
||||
{
|
||||
IPS_exception_error( $error );
|
||||
}
|
||||
|
||||
$this->registry->getClass('class_forums')->strip_invisible = 1;
|
||||
$this->registry->getClass('class_forums')->forumsInit();
|
||||
|
||||
$this->memberData = IPSMember::setUpModerator( $this->memberData );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the attachment and checks for download / show perms
|
||||
*
|
||||
* @param integer Attachment id
|
||||
* @return array Attachment data
|
||||
*/
|
||||
public function getAttachmentData( $attach_id )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$_ok = 0;
|
||||
|
||||
if( ! $attach_id )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Grab 'em
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => 'a.*',
|
||||
'from' => array( 'attachments' => 'a' ),
|
||||
'where' => "a.attach_rel_module='{$this->module}' AND a.attach_id={$attach_id}",
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 'p.pid, p.topic_id, p.queued',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => "p.pid=a.attach_rel_id",
|
||||
'type' => 'left'
|
||||
),
|
||||
array(
|
||||
'select' => 't.forum_id',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => "t.tid=p.topic_id",
|
||||
'type' => 'left'
|
||||
)
|
||||
)
|
||||
) );
|
||||
|
||||
$attach_sql = $this->DB->execute();
|
||||
|
||||
$attach = $this->DB->fetch( $attach_sql );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check..
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! isset( $attach['pid'] ) OR empty( $attach['pid'] ) )
|
||||
{
|
||||
if( $attach['attach_member_id'] != $this->memberData['member_id'] )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Queued post?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $attach['queued'] )
|
||||
{
|
||||
if ( ! ipsRegistry::getClass('class_forums')->canQueuePosts( $attach['forum_id'] ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// TheWalrus inspired fix for previewing
|
||||
// the post and clicking the attachment...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $attach['attach_rel_id'] == 0 AND $attach['attach_member_id'] == $this->memberData['member_id'] )
|
||||
{
|
||||
$_ok = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! ipsRegistry::getClass('class_forums')->forum_by_id[ $attach['forum_id'] ] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// TheWalrus inspired fix for previewing
|
||||
// the post and clicking the attachment...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $attach['attach_rel_id'] == 0 AND $attach['attach_member_id'] == $this->memberData['member_id'] )
|
||||
{
|
||||
# We're ok.
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if ( IPSMember::checkPermissions('read', $attach['forum_id']) === FALSE )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( IPSMember::checkPermissions('download', $attach['forum_id']) === FALSE )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Still here?
|
||||
//-----------------------------------------
|
||||
|
||||
$_ok = 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Ok?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $_ok )
|
||||
{
|
||||
return $attach;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the attachment and make sure its OK to display
|
||||
*
|
||||
* @param array Array of ids
|
||||
* @param array Array of relationship ids
|
||||
* @return array Attachment data
|
||||
*/
|
||||
public function renderAttachment( $attach_ids, $rel_ids=array(), $attach_post_key=0 )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$rows = array();
|
||||
$query_bits = array();
|
||||
$query = '';
|
||||
$match = 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( is_array( $attach_ids ) AND count( $attach_ids ) )
|
||||
{
|
||||
$query_bits[] = "attach_id IN (" . implode( ",", $attach_ids ) .")";
|
||||
}
|
||||
|
||||
if ( is_array( $rel_ids ) and count( $rel_ids ) )
|
||||
{
|
||||
$rel_ids = array_map( 'intval', $rel_ids );
|
||||
// We need to reset the array - this query bit will return everything we need, but
|
||||
// if we "OR" join the above query bit with this one, it causes bigger mysql loads
|
||||
$query_bits = array();
|
||||
$query_bits[] = "attach_rel_id IN (" . implode( ",", $rel_ids ) . ")";
|
||||
//$query = " OR attach_rel_id IN (-1," . implode( ",", $rel_ids ) . ")";
|
||||
$match = 1;
|
||||
}
|
||||
|
||||
if ( $attach_post_key )
|
||||
{
|
||||
$query_bits[] = "attach_post_key='".$this->DB->addSlashes( $attach_post_key )."'";
|
||||
//$query .= " OR attach_post_key='".$this->DB->addSlashes( $attach_post_key )."'";
|
||||
$match = 2;
|
||||
}
|
||||
|
||||
if( !count($query_bits) )
|
||||
{
|
||||
$query = "attach_id IN (-1)";
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = implode( " OR ", $query_bits );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Grab 'em
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'attachments', 'where' => "attach_rel_module='{$this->module}' AND ( {$query} )" ) );
|
||||
$attach_sql = $this->DB->execute();
|
||||
|
||||
//-----------------------------------------
|
||||
// Loop through and filter off naughty ids
|
||||
//-----------------------------------------
|
||||
|
||||
while( $db_row = $this->DB->fetch( $attach_sql ) )
|
||||
{
|
||||
$_ok = 1;
|
||||
|
||||
if ( $match == 1 )
|
||||
{
|
||||
if ( ! in_array( $db_row['attach_rel_id'], $rel_ids ) )
|
||||
{
|
||||
$_ok = 0;
|
||||
}
|
||||
}
|
||||
else if ( $match == 2 )
|
||||
{
|
||||
if ( $db_row['attach_post_key'] != $attach_post_key )
|
||||
{
|
||||
$_ok = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Ok?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $_ok )
|
||||
{
|
||||
$rows[ $db_row['attach_id'] ] = $db_row;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Return
|
||||
//-----------------------------------------
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recounts number of attachments for the articles row
|
||||
*
|
||||
* @param string Post key
|
||||
* @param integer Related ID
|
||||
* @param array Arguments for query
|
||||
* @return array Returns count of items found
|
||||
*/
|
||||
public function postUploadProcess( $post_key, $rel_id, $args=array() )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$cnt = array( 'cnt' => 0 );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check..
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $post_key )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
$this->DB->build( array( "select" => 'COUNT(*) as cnt', 'from' => 'attachments', 'where' => "attach_post_key='{$post_key}'" ) );
|
||||
$this->DB->execute();
|
||||
|
||||
$cnt = $this->DB->fetch();
|
||||
|
||||
if ( $cnt['cnt'] )
|
||||
{
|
||||
$this->DB->update( 'topics', "topic_hasattach=topic_hasattach+" . $cnt['cnt'], "tid=" . intval( $args['topic_id'] ), false, true );
|
||||
}
|
||||
|
||||
return array( 'count' => $cnt['cnt'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Recounts number of attachments for the articles row
|
||||
*
|
||||
* @param array Attachment data
|
||||
* @return boolean
|
||||
*/
|
||||
public function attachmentRemovalCleanup( $attachment )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $attachment['attach_id'] )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => 'p.pid',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'p.pid='. intval( $attachment['attach_rel_id'] ),
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 't.forum_id, t.tid',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.tid=p.topic_id',
|
||||
'type' => 'inner'
|
||||
)
|
||||
)
|
||||
) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
$topic = $this->DB->fetch();
|
||||
|
||||
if ( isset( $topic['tid'] ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// GET PIDS
|
||||
//-----------------------------------------
|
||||
|
||||
$pids = array();
|
||||
$count = 0;
|
||||
|
||||
$this->DB->build( array( 'select' => 'pid', 'from' => 'posts', 'where' => "topic_id={$topic['tid']}" ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $p = $this->DB->fetch() )
|
||||
{
|
||||
$pids[] = $p['pid'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// GET ATTACHMENT COUNT
|
||||
//-----------------------------------------
|
||||
|
||||
if ( count( $pids ) )
|
||||
{
|
||||
$this->DB->build( array(
|
||||
'select' => 'count(*) as cnt',
|
||||
'from' => 'attachments',
|
||||
'where' => "attach_rel_module='post' AND attach_rel_id IN(" . implode( ',', $pids ) . ")") );
|
||||
$this->DB->execute();
|
||||
|
||||
$cnt = $this->DB->fetch();
|
||||
|
||||
$count = intval( $cnt['cnt'] );
|
||||
}
|
||||
|
||||
$this->DB->update( 'topics', array( 'topic_hasattach' => $count ), "tid=".$topic['tid'] );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if you have permission for bulk attachment removal
|
||||
* Returns TRUE or FALSE
|
||||
* IT really does
|
||||
*
|
||||
* @param array Ids to check against
|
||||
* @return boolean
|
||||
*/
|
||||
public function canBulkRemove( $attach_rel_ids=array() )
|
||||
{
|
||||
return $this->memberData['g_is_supmod'] ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if you can remove this attachment
|
||||
* Returns TRUE or FALSE
|
||||
* IT really does
|
||||
*
|
||||
* @param array Attachment data
|
||||
* @return boolean
|
||||
*/
|
||||
public function canRemove( $attachment )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$ok_to_remove = FALSE;
|
||||
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $attachment['attach_id'] )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Allowed to remove?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->memberData['member_id'] == $attachment['attach_member_id'] )
|
||||
{
|
||||
$ok_to_remove = TRUE;
|
||||
}
|
||||
else if ( $this->memberData['g_is_supmod'] )
|
||||
{
|
||||
$ok_to_remove = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Moderstor? Get forum ID
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->memberData['forumsModeratorData'] )
|
||||
{
|
||||
$_moderator = $this->memberData['forumsModeratorData'];
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => 'p.pid',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'p.pid='. intval( $attachment['attach_rel_id'] ),
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 't.forum_id, t.tid',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.tid=p.topic_id',
|
||||
'type' => 'inner'
|
||||
)
|
||||
)
|
||||
) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
$topic = $this->DB->fetch();
|
||||
|
||||
if ( isset( $topic['forum_id'] ) )
|
||||
{
|
||||
if ( isset($_moderator[ $topic['forum_id'] ]['edit_post']) and $_moderator[ $topic['forum_id'] ]['edit_post'] )
|
||||
{
|
||||
$ok_to_remove = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $ok_to_remove;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of the allowed upload sizes in bytes.
|
||||
* Return 'space_allowed' as -1 to not allow uploads.
|
||||
* Return 'space_allowed' as 0 to allow unlimited uploads
|
||||
* Return 'max_single_upload' as 0 to not set a limit
|
||||
*
|
||||
* @param string MD5 post key
|
||||
* @param id Member ID
|
||||
* @return array [ 'space_used', 'space_left', 'space_allowed', 'max_single_upload' ]
|
||||
*/
|
||||
public function getSpaceAllowance( $post_key='', $member_id='' )
|
||||
{
|
||||
$max_php_size = IPSLib::getMaxPostSize();
|
||||
$member_id = intval( $member_id ? $member_id : $this->memberData['member_id'] );
|
||||
$forum_id = intval( ipsRegistry::$request['forum_id'] ? ipsRegistry::$request['forum_id'] : ipsRegistry::$request['f'] );
|
||||
$space_left = 0;
|
||||
$space_used = 0;
|
||||
$space_allowed = 0;
|
||||
$max_single_upload = 0;
|
||||
$space_calculated = 0;
|
||||
|
||||
if ( $post_key )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Check to make sure we're not attempting
|
||||
// to upload to another's post...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $this->memberData['g_is_supmod'] AND !$this->memberData['is_mod'] )
|
||||
{
|
||||
$post = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'posts', 'where' => "post_key='{$post_key}'" ) );
|
||||
|
||||
if ( $post['post_key'] AND ( $post['author_id'] != $member_id ) )
|
||||
{
|
||||
$space_allowed = -1;
|
||||
$space_calculated = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Generate total space allowed
|
||||
//-----------------------------------------
|
||||
|
||||
$total_space_allowed = ( $this->memberData['g_attach_per_post'] ? $this->memberData['g_attach_per_post'] : $this->memberData['g_attach_max'] ) * 1024;
|
||||
|
||||
//-----------------------------------------
|
||||
// Allowed to attach?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $member_id OR ! $forum_id )
|
||||
{
|
||||
$space_allowed = -1;
|
||||
}
|
||||
if ( IPSMember::checkPermissions('upload', $forum_id ) !== TRUE )
|
||||
{
|
||||
$space_allowed = -1;
|
||||
}
|
||||
else if ( ! $space_calculated )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Generate space allowed figure
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->memberData['g_attach_per_post'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Per post limit...
|
||||
//-----------------------------------------
|
||||
|
||||
$_space_used = $this->DB->buildAndFetch( array(
|
||||
'select' => 'SUM(attach_filesize) as figure',
|
||||
'from' => 'attachments',
|
||||
'where' => "attach_post_key='{$post_key}'"
|
||||
) );
|
||||
|
||||
$space_used = intval( $_space_used['figure'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Global limit...
|
||||
//-----------------------------------------
|
||||
|
||||
$_space_used = $this->DB->buildAndFetch( array(
|
||||
'select' => 'SUM(attach_filesize) as figure',
|
||||
'from' => 'attachments',
|
||||
'where' => "attach_member_id={$member_id} AND attach_rel_module IN( 'post', 'msg' )"
|
||||
) );
|
||||
|
||||
$space_used = intval( $_space_used['figure'] );
|
||||
}
|
||||
|
||||
if ( $this->memberData['g_attach_max'] > 0 )
|
||||
{
|
||||
if ( $this->memberData['g_attach_per_post'] )
|
||||
{
|
||||
$_g_space_used = $this->DB->buildAndFetch( array(
|
||||
'select' => 'SUM(attach_filesize) as figure',
|
||||
'from' => 'attachments',
|
||||
'where' => "attach_member_id={$member_id} AND attach_rel_module IN( 'post', 'msg' )"
|
||||
) );
|
||||
|
||||
$g_space_used = intval( $_g_space_used['figure'] );
|
||||
|
||||
if( intval( ( $this->memberData['g_attach_max'] * 1024 ) - $g_space_used ) < 0 )
|
||||
{
|
||||
$space_used = $g_space_used;
|
||||
$total_space_allowed = $this->memberData['g_attach_max'] * 1024;
|
||||
|
||||
$space_allowed = ( $this->memberData['g_attach_max'] * 1024 ) - $space_used;
|
||||
$space_allowed = $space_allowed < 0 ? -1 : $space_allowed;
|
||||
}
|
||||
else
|
||||
{
|
||||
$space_allowed = ( $this->memberData['g_attach_per_post'] * 1024 ) - $space_used;
|
||||
$space_allowed = $space_allowed < 0 ? -1 : $space_allowed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$space_allowed = ( $this->memberData['g_attach_max'] * 1024 ) - $space_used;
|
||||
$space_allowed = $space_allowed < 0 ? -1 : $space_allowed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $this->memberData['g_attach_per_post'] )
|
||||
{
|
||||
$space_allowed = ( $this->memberData['g_attach_per_post'] * 1024 ) - $space_used;
|
||||
$space_allowed = $space_allowed < 0 ? -1 : $space_allowed;
|
||||
}
|
||||
else
|
||||
{
|
||||
# Unlimited
|
||||
$space_allowed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Generate space left figure
|
||||
//-----------------------------------------
|
||||
|
||||
$space_left = $space_allowed ? $space_allowed : 0;
|
||||
$space_left = ($space_left < 0) ? -1 : $space_left;
|
||||
|
||||
//-----------------------------------------
|
||||
// Generate max upload size
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $max_single_upload )
|
||||
{
|
||||
if ( $space_left > 0 AND $space_left < $max_php_size )
|
||||
{
|
||||
$max_single_upload = $space_left;
|
||||
}
|
||||
else if ( $max_php_size )
|
||||
{
|
||||
$max_single_upload = $max_php_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IPSDebug::fireBug( 'info', array( 'Space left: ' . $space_left ) );
|
||||
IPSDebug::fireBug( 'info', array( 'Max PHP size: ' . $max_php_size ) );
|
||||
IPSDebug::fireBug( 'info', array( 'Max single file size: ' . $max_single_upload ) );
|
||||
|
||||
$return = array( 'space_used' => $space_used, 'space_left' => $space_left, 'space_allowed' => $space_allowed, 'max_single_upload' => $max_single_upload, 'total_space_allowed' => $total_space_allowed );
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of settings:
|
||||
* 'siu_thumb' = Allow thumbnail creation?
|
||||
* 'siu_height' = Height of the generated thumbnail in pixels
|
||||
* 'siu_width' = Width of the generated thumbnail in pixels
|
||||
* 'upload_dir' = Base upload directory (must be a full path)
|
||||
*
|
||||
* You can omit any of these settings and IPB will use the default
|
||||
* settings (which are the ones entered into the ACP for post thumbnails)
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getSettings()
|
||||
{
|
||||
$this->mysettings = array();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,19 +1,21 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* IP.Board v3.1.4
|
||||
* 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) $
|
||||
* Last Updated: $Date: 2010-09-15 19:24:12 -0400 (Wed, 15 Sep 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $author$
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 5529 $
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 6882 $
|
||||
**/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
@@ -37,7 +39,7 @@ if ( ( isset( $_REQUEST['CODE'] ) AND $_REQUEST['CODE'] ) or ( isset( $_REQUEST[
|
||||
$_LOAD = array();
|
||||
|
||||
# BOARD INDEX
|
||||
if ( ( ! $_GET['section'] AND ! $_GET['module'] ) OR ( $_GET['module'] == 'forums' AND $_GET['section'] == 'boards' ) )
|
||||
if ( ( ( !isset($_GET['section']) OR ! $_GET['section'] ) AND ( !isset($_GET['module']) OR ! $_GET['module'] ) ) OR ( $_GET['module'] == 'forums' AND $_GET['section'] == 'boards' ) )
|
||||
{
|
||||
$_LOAD['chatting'] = 1;
|
||||
$_LOAD['birthdays'] = 1;
|
||||
@@ -48,7 +50,7 @@ if ( ( ! $_GET['section'] AND ! $_GET['module'] ) OR ( $_GET['module'] == 'forum
|
||||
}
|
||||
|
||||
# TOPIC
|
||||
if ( isset( $_GET['showtopic'] ) OR $_GET['module'] == 'forums' AND $_GET['section'] == 'topics' )
|
||||
if ( isset( $_GET['showtopic'] ) OR ( isset($_GET['module']) AND isset($_GET['section']) AND $_GET['module'] == 'forums' AND $_GET['section'] == 'topics' ) )
|
||||
{
|
||||
$_LOAD['badwords'] = 1;
|
||||
$_LOAD['emoticons'] = 1;
|
||||
@@ -57,10 +59,11 @@ if ( isset( $_GET['showtopic'] ) OR $_GET['module'] == 'forums' AND $_GET['secti
|
||||
$_LOAD['ranks'] = 1;
|
||||
$_LOAD['profilefields'] = 1;
|
||||
$_LOAD['reputation_levels'] = 1;
|
||||
$_LOAD['sharelinks'] = 1;
|
||||
}
|
||||
|
||||
# Forum
|
||||
if ( isset( $_GET['showforum'] ) OR $_GET['module'] == 'forums' AND $_GET['section'] == 'forums' )
|
||||
if ( isset( $_GET['showforum'] ) OR ( isset($_GET['module']) AND isset($_GET['section']) AND $_GET['module'] == 'forums' AND $_GET['section'] == 'forums' ) )
|
||||
{
|
||||
$_LOAD['ranks'] = 1;
|
||||
$_LOAD['reputation_levels'] = 1;
|
||||
@@ -71,8 +74,8 @@ if ( isset( $_GET['showforum'] ) OR $_GET['module'] == 'forums' AND $_GET['secti
|
||||
$_LOAD['bbcode'] = 1;
|
||||
}
|
||||
|
||||
# POST
|
||||
if ( $_GET['module'] == 'post' )
|
||||
# POST and RULES
|
||||
if ( isset($_GET['module']) AND ( $_GET['module'] == 'post' OR $_GET['module'] == 'extras' ) )
|
||||
{
|
||||
$_LOAD['badwords'] = 1;
|
||||
$_LOAD['bbcode'] = 1;
|
||||
@@ -81,6 +84,15 @@ if ( $_GET['module'] == 'post' )
|
||||
$_LOAD['reputation_levels'] = 1;
|
||||
}
|
||||
|
||||
# ANNOUNCEMENT
|
||||
if ( isset( $_GET['showannouncement'] ) OR ( isset($_GET['module']) AND isset($_GET['section']) AND $_GET['module'] == 'forums' AND $_GET['section'] == 'announcements' ) )
|
||||
{
|
||||
$_LOAD['badwords'] = 1;
|
||||
$_LOAD['bbcode'] = 1;
|
||||
$_LOAD['emoticons'] = 1;
|
||||
$_LOAD['ranks'] = 1;
|
||||
$_LOAD['reputation_levels'] = 1;
|
||||
}
|
||||
|
||||
$CACHE['attachtypes'] = array(
|
||||
'array' => 1,
|
||||
@@ -124,4 +136,12 @@ $CACHE['announcements'] = array(
|
||||
// Bitwise Options
|
||||
//-----------------------------------------
|
||||
|
||||
$_BITWISE = array( 'moderators' => array( 'bw_flag_spammers' ) );
|
||||
$_BITWISE = array( 'moderators' => array( 'bw_flag_spammers',
|
||||
'bw_mod_soft_delete',
|
||||
'bw_mod_un_soft_delete',
|
||||
'bw_mod_soft_delete_see',
|
||||
'bw_mod_soft_delete_topic',
|
||||
'bw_mod_un_soft_delete_topic',
|
||||
'bw_mod_soft_delete_topic_see',
|
||||
'bw_mod_soft_delete_reason',
|
||||
'bw_mod_soft_delete_see_post' ) );
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* Define data hook locations (Forums)
|
||||
* Last Updated: $Date: 2010-10-21 09:25:51 -0400 (Thu, 21 Oct 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: ips_terabyte $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Core
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 7009 $
|
||||
*/
|
||||
|
||||
$dataHookLocations = array(
|
||||
|
||||
/* POSTING LIBRARY DATA LOCATIONS */
|
||||
array( 'postAddReply', 'Add Reply' ),
|
||||
array( 'postAddReplyPoll','Add Reply: Poll' ),
|
||||
array( 'postAutoMerge', 'Add Reply: Auto merge with previous post' ),
|
||||
array( 'postAddReplyTopicUpdate', 'Add Reply: Topic Data' ),
|
||||
array( 'postAddTopic', 'New Topic: Topic Data' ),
|
||||
array( 'postFirstPost', 'New Topic: First Post' ),
|
||||
array( 'postAddTopicPoll', 'New Topic: Poll' ),
|
||||
array( 'editPostAddPoll', 'Edit Post: Added Poll' ),
|
||||
array( 'editPostUpdatePoll', 'Edit Post: Updated Poll' ),
|
||||
array( 'editPostUpdateTopicTitle', 'Edit Post: Update Topic Title'),
|
||||
array( 'editPostData', 'Edit Post: Post Data' ),
|
||||
array( 'updateForumLastPostData', 'Forum last post update data' ),
|
||||
array( 'incrementUsersPostCount', 'Increment users post count' ),
|
||||
|
||||
/* OUTPUT ARRAYS */
|
||||
array( 'boardIndexCategories', 'Board Index Output: Categories' ),
|
||||
array( 'boardIndexOnlineUsers', 'Board Index Output: Active users' ),
|
||||
array( 'forumViewData', 'Forum View Output' ),
|
||||
array( 'topicViewQuery', 'Topic View Query: Members Table and Joins' ),
|
||||
array( 'topicViewPostData', 'Topic View Output: Posts Data' ),
|
||||
array( 'topicViewForumData', 'Topic View Output: Forum Data' ),
|
||||
array( 'topicViewTopicData', 'Topic View Output: Topic Data' ),
|
||||
array( 'topicViewDisplayData', 'Topic View Output: Other Data' ),
|
||||
|
||||
);
|
||||
@@ -1,35 +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 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'],
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* BBCode Management : Determines if bbcode can be used in this section
|
||||
* Last Updated: $LastChangedDate: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 5713 $
|
||||
*
|
||||
*/
|
||||
|
||||
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'],
|
||||
);
|
||||
@@ -7,10 +7,10 @@
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 4136 $
|
||||
*
|
||||
@@ -41,19 +41,19 @@ $_SEOTEMPLATES = array(
|
||||
'showannouncement' => array( 'app' => 'forums',
|
||||
'allowRedirect' => 1,
|
||||
'out' => array( '#showannouncement=(.+?)((?:&|&)f=(.+?))?(&|$)#i', 'forum-$3/announcement-$1/$4' ),
|
||||
'in' => array( 'regex' => "#/forum-(\d+?)?/announcement-(\d+)/#i",
|
||||
'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",
|
||||
'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",
|
||||
'in' => array( 'regex' => "#/topic/(\d+)/?#i",
|
||||
'matches' => array( array( 'showtopic', '$1' ) ) ) ),
|
||||
|
||||
'act=idx' => array( 'app' => 'forums',
|
||||
|
||||
@@ -1,181 +1,214 @@
|
||||
<?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( '&', '&', $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;
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* RSS output plugin :: posts
|
||||
* Last Updated: $Date: 2010-07-10 01:01:06 -0400 (Sat, 10 Jul 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 6/24/2008
|
||||
* @version $Revision: 6628 $
|
||||
*/
|
||||
|
||||
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();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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( '&', '&', $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;
|
||||
}
|
||||
else if( $k == 'showannouncement' )
|
||||
{
|
||||
$this->setKey( 'announcement', 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;
|
||||
case 'announcement':
|
||||
return $this->_fetchSeoTitle_announcement();
|
||||
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 forum
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the SEO title for an announcement
|
||||
*
|
||||
* @access public
|
||||
* @return string The SEO friendly name
|
||||
*/
|
||||
public function _fetchSeoTitle_announcement()
|
||||
{
|
||||
//$announce = $this->DB->buildAndFetch( array( 'select' => 'announce_id, announce_title',
|
||||
// 'from' => 'announcements',
|
||||
// 'where' => 'announce_id=' . intval( $this->_id ) ) );
|
||||
$announce = $this->caches['announcements'][ intval( $this->_id ) ];
|
||||
|
||||
if ( $announce['announce_id'] )
|
||||
{
|
||||
return $announce['announce_seo_title'] ? $announce['announce_seo_title'] : IPSText::makeSeoTitle( $announce['announce_title'] );
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* IP.Board v3.1.4
|
||||
* Sets up SEO templates
|
||||
* Last Updated: $Date: 2009-03-04 15:08:31 +0000 (Wed, 04 Mar 2009) $
|
||||
* Last Updated: $Date: 2010-10-27 14:13:29 -0400 (Wed, 27 Oct 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @author $Author: mmecham $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 4136 $
|
||||
* @version $Rev: 7057 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -47,25 +49,25 @@ $_SEOTEMPLATES = array(
|
||||
'showannouncement' => array( 'app' => 'forums',
|
||||
'allowRedirect' => 1,
|
||||
'out' => array( '#showannouncement=(.+?)((?:&|&)f=(.+?))?(&|$)#i', 'forum-$3/announcement-$1-#{__title__}/$4' ),
|
||||
'in' => array( 'regex' => "#/forum-(\d+?)?/announcement-(\d+?)-#i",
|
||||
'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",
|
||||
'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",
|
||||
'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",
|
||||
'in' => array( 'regex' => '#^/index(/|$|\?)#i',
|
||||
'matches' => array( array( 'act', 'idx' ) ) ) ),
|
||||
);
|
||||
|
||||
@@ -1 +1,10 @@
|
||||
<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>␍
|
||||
<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>
|
||||
@@ -1,203 +1,220 @@
|
||||
<?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 )
|
||||
{
|
||||
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* Forum permissions mappings
|
||||
* Last Updated: $Date: 2010-04-26 14:40:44 -0400 (Mon, 26 Apr 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $author$
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 6179 $
|
||||
**/
|
||||
|
||||
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.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 6179 $
|
||||
**/
|
||||
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
|
||||
* @param string $old_email Old email address
|
||||
* @return void
|
||||
**/
|
||||
public function onEmailChange( $id, $new_email, $old_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
|
||||
* @param integer $old_group Old Group ID
|
||||
* @return void
|
||||
**/
|
||||
public function onGroupChange( $id, $new_group, $old_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 )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is run when a user logs out
|
||||
*
|
||||
* @access public
|
||||
* @param array $member Array of member data
|
||||
* @return void
|
||||
**/
|
||||
public function onLogOut( $member )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* Define the core notification types
|
||||
* Last Updated: $Date: 2010-04-08 16:37:04 -0400 (Thu, 08 Apr 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 6088 $
|
||||
*
|
||||
*/
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification types
|
||||
*/
|
||||
|
||||
class forums_notifications
|
||||
{
|
||||
public function getConfiguration()
|
||||
{
|
||||
/**
|
||||
* Notification types - Needs to be a method so when require_once is used, $_NOTIFY isn't empty
|
||||
*/
|
||||
$_NOTIFY = array(
|
||||
array( 'key' => 'new_topic', 'default' => array( 'email' ), 'disabled' => array(), 'icon' => 'notify_newtopic' ),
|
||||
array( 'key' => 'new_reply', 'default' => array( 'email' ), 'disabled' => array(), 'icon' => 'notify_newreply' ),
|
||||
array( 'key' => 'post_quoted', 'default' => array(), 'disabled' => array(), 'icon' => 'notify_quoted' ),
|
||||
// This is defined in ACP forum settings as an email, so it's not mapped to a specific member
|
||||
//array( 'key' => 'new_topic_queue', 'default' => array( 'email' ), 'disabled' => array() ),
|
||||
);
|
||||
return $_NOTIFY;
|
||||
}
|
||||
}
|
||||
@@ -1 +1,10 @@
|
||||
<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>␍
|
||||
<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>
|
||||
@@ -1,19 +1,21 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* IP.Board v3.1.4
|
||||
* Portal plugin: poll
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
* Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 1st march 2002
|
||||
* @version $Revision: 4948 $
|
||||
* @version $Revision: 5713 $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* IP.Board v3.1.4
|
||||
* Portal plugin: poll
|
||||
* Last Updated: $Date: 2009-06-16 08:17:58 -0400 (Tue, 16 Jun 2009) $
|
||||
* Last Updated: $Date: 2010-10-22 06:13:38 -0400 (Fri, 22 Oct 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: matt $
|
||||
* @author $Author: ips_terabyte $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 1st march 2002
|
||||
* @version $Revision: 4778 $
|
||||
*
|
||||
* @version $Revision: 7016 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
@@ -28,7 +28,6 @@ class ppi_poll extends public_portal_portal_portal
|
||||
/**
|
||||
* Initialize module
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
@@ -38,8 +37,8 @@ class ppi_poll extends public_portal_portal_portal
|
||||
/**
|
||||
* Display a poll
|
||||
*
|
||||
* @access public
|
||||
* @return string HTML content to replace tag with
|
||||
* @todo We need to update the code below to load the furlTemplates file and check against it, then add a fallback on the normal url as a default.
|
||||
*/
|
||||
public function poll_show_poll()
|
||||
{
|
||||
@@ -89,14 +88,17 @@ class ppi_poll extends public_portal_portal_portal
|
||||
$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 ) );
|
||||
if( !$this->registry->isClassLoaded('class_forums') )
|
||||
{
|
||||
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums' );
|
||||
$this->registry->setClass( 'class_forums', new $classToLoad( $this->registry ) );
|
||||
|
||||
$this->registry->getClass('class_forums')->strip_invisible = 1;
|
||||
$this->registry->getClass('class_forums')->forumsInit();
|
||||
}
|
||||
|
||||
$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();
|
||||
$classToLoad = IPSLib::loadActionOverloader( IPSLib::getAppDir( 'forums', 'forums' ) . '/topics.php', 'public_forums_forums_topics', 'forums' );
|
||||
$topic = new $classToLoad();
|
||||
$topic->makeRegistryShortcuts( $this->registry );
|
||||
|
||||
$topic->topic = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'topics', 'where' => "tid=" . $tid ) );
|
||||
@@ -114,5 +116,4 @@ class ppi_poll extends public_portal_portal_portal
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,21 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* IP.Board v3.1.4
|
||||
* Portal plugin: recent topics
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
* Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 1st march 2002
|
||||
* @version $Revision: 4948 $
|
||||
* @version $Revision: 5713 $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* IP.Board v3.1.4
|
||||
* Portal plugin: recent topics
|
||||
* Last Updated: $Date: 2009-12-07 21:57:46 -0500 (Mon, 07 Dec 2009) $
|
||||
* Last Updated: $Date: 2010-11-04 13:30:54 -0400 (Thu, 04 Nov 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @author $Author: ips_terabyte $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 1st march 2002
|
||||
* @version $Revision: 5529 $
|
||||
*
|
||||
* @version $Revision: 7093 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
@@ -28,7 +28,6 @@ class ppi_recent_topics extends public_portal_portal_portal
|
||||
/**
|
||||
* Initialize module
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
@@ -39,7 +38,6 @@ class ppi_recent_topics extends public_portal_portal_portal
|
||||
/**
|
||||
* Show the recently started topic titles
|
||||
*
|
||||
* @access public
|
||||
* @return string HTML content to replace tag with
|
||||
*/
|
||||
public function recent_topics_discussions_last_x()
|
||||
@@ -50,86 +48,15 @@ class ppi_recent_topics extends public_portal_portal_portal
|
||||
$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;
|
||||
}
|
||||
$results = $this->registry->class_forums->hooks_recentTopics( $limit, false );
|
||||
|
||||
/* 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 );
|
||||
return count($results) ? $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()
|
||||
@@ -172,7 +99,7 @@ class ppi_recent_topics extends public_portal_portal_portal
|
||||
foreach( $this->registry->class_forums->forum_by_id as $id => $data )
|
||||
{
|
||||
/* Allowing this forum? */
|
||||
if ( ! in_array( $id, $forums, $id ) )
|
||||
if ( ! in_array( $id, $forums ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -231,7 +158,7 @@ class ppi_recent_topics extends public_portal_portal_portal
|
||||
/* 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 ) : '' ),
|
||||
'where' => "t.pinned=1 AND t.approved=1 AND t.state != 'link' AND " . implode( ' AND ', $where_clause ),
|
||||
//'order' => 't.tid DESC',
|
||||
'limit' => array ( $limit ) ) );
|
||||
|
||||
@@ -252,7 +179,7 @@ class ppi_recent_topics extends public_portal_portal_portal
|
||||
|
||||
$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 ) : '' ),
|
||||
'where' => $pinnedWhere . "t.approved=1 AND t.state != 'link' AND " . implode( ' AND ', $where_clause ),
|
||||
'order' => 'tid DESC',
|
||||
'limit' => array ( $limit - count( $pinned ) ) ) );
|
||||
|
||||
@@ -428,11 +355,11 @@ class ppi_recent_topics extends public_portal_portal_portal
|
||||
//-----------------------------------------
|
||||
// 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 = '';
|
||||
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'core' ) . '/sources/classes/attach/class_attach.php', 'class_attach' );
|
||||
$this->class_attach = new $classToLoad( $this->registry );
|
||||
|
||||
$this->class_attach->attach_post_key = '';
|
||||
|
||||
ipsRegistry::getClass( 'class_localization' )->loadLanguageFile( array( 'public_topic' ), 'forums' );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<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,50 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* Config for posts plugin
|
||||
* Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Members
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Revision: 5713 $
|
||||
*
|
||||
*/
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
* Plug in name (Default tab name)
|
||||
*/
|
||||
$CONFIG['plugin_name'] = 'Replies';
|
||||
|
||||
/**
|
||||
* Language string for the tab
|
||||
*/
|
||||
$CONFIG['plugin_lang_bit'] = 'pp_tab_posts';
|
||||
|
||||
/**
|
||||
* Plug in key (must be the same as the main {file}.php name
|
||||
*/
|
||||
$CONFIG['plugin_key'] = 'posts';
|
||||
|
||||
/**
|
||||
* Show tab?
|
||||
*/
|
||||
$CONFIG['plugin_enabled'] = 1;
|
||||
|
||||
/**
|
||||
* Order
|
||||
*/
|
||||
$CONFIG['plugin_order'] = 4;
|
||||
@@ -0,0 +1,212 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* Profile Plugin Library
|
||||
* Last Updated: $Date: 2010-10-23 08:40:34 -0400 (Sat, 23 Oct 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: ips_terabyte $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Members
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Revision: 7023 $
|
||||
*/
|
||||
|
||||
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 profile_posts extends profile_plugin_parent
|
||||
{
|
||||
/**
|
||||
* Attachment object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $attach;
|
||||
|
||||
/**
|
||||
* Feturn HTML block
|
||||
*
|
||||
* @param array Member information
|
||||
* @return string HTML block
|
||||
*/
|
||||
public function return_html_block( $member=array() )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$content = '';
|
||||
$last_x = 5;
|
||||
$forumIdsOk = array( 0 => 0 );
|
||||
$date_cut = '';
|
||||
|
||||
//-----------------------------------------
|
||||
// Got a member?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! is_array( $member ) OR ! count( $member ) )
|
||||
{
|
||||
return $this->registry->getClass('output')->getTemplate('profile')->tabNoContent( 'err_no_posts_to_show' );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Some words
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->class_localization->loadLanguageFile( array( 'public_topic' ), 'forums' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Can view other member's topics?
|
||||
//-----------------------------------------
|
||||
|
||||
if( !$this->memberData['g_other_topics'] AND $this->memberData['member_id'] != $member['member_id'] )
|
||||
{
|
||||
return $this->registry->getClass('output')->getTemplate('profile')->tabNoContent( 'err_no_posts_to_show' );
|
||||
}
|
||||
|
||||
$pids = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// And limit by post count...
|
||||
//-----------------------------------------
|
||||
|
||||
$posts = intval($this->memberData['posts']);
|
||||
|
||||
//-----------------------------------------
|
||||
// Will we need to parse attachments?
|
||||
//-----------------------------------------
|
||||
|
||||
$parseAttachments = false;
|
||||
|
||||
/* Get list of good forum IDs */
|
||||
$forumIdsOk = $this->registry->class_forums->fetchSearchableForumIds();
|
||||
|
||||
/* Set up joins */
|
||||
$_post_joins = array( array(
|
||||
'select' => 't.*',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.tid=p.topic_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
array(
|
||||
'select' => 'm.member_group_id, m.mgroup_others',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=p.author_id',
|
||||
'type' => 'left'
|
||||
) );
|
||||
|
||||
/* Cache? */
|
||||
if ( IPSContentCache::isEnabled() )
|
||||
{
|
||||
if ( IPSContentCache::fetchSettingValue('post') )
|
||||
{
|
||||
$_post_joins[] = IPSContentCache::join( 'post', 'p.pid' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $this->settings['search_ucontent_days'] )
|
||||
{
|
||||
$date_cut = ( $this->memberData['last_post'] ? $this->memberData['last_post'] : time() ) - 86400 * intval( $this->settings['search_ucontent_days'] );
|
||||
$date_cut = ' AND p.post_date > ' . $date_cut;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get last X posts
|
||||
//-----------------------------------------
|
||||
|
||||
if( is_array($forumIdsOk) AND count($forumIdsOk) )
|
||||
{
|
||||
$this->DB->build( array(
|
||||
'select' => 'p.*',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => "p.queued=0 AND t.approved=1 AND p.author_id={$member['member_id']} AND p.new_topic=0 AND t.forum_id IN (" . implode( ",", $forumIdsOk ) . ") " . $date_cut,
|
||||
'order' => 'p.post_date DESC',
|
||||
'limit' => array( 0, $last_x ),
|
||||
'add_join' => $_post_joins
|
||||
) );
|
||||
|
||||
$o = $this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch( $o ) )
|
||||
{
|
||||
$pids[ $row['pid'] ] = $row['pid'];
|
||||
|
||||
if( $row['topic_hasattach'] )
|
||||
{
|
||||
$parseAttachments = true;
|
||||
}
|
||||
|
||||
if ( ! $row['cache_content'] )
|
||||
{
|
||||
IPSText::getTextClass( 'bbcode' )->parse_smilies = $row['use_emo'];
|
||||
IPSText::getTextClass( 'bbcode' )->parse_html = ( $row['use_html'] and $this->memberData['g_dohtml'] and $row['post_htmlstate'] ) ? 1 : 0;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_nl2br = $row['post_htmlstate'] == 2 ? 1 : 0;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_section = 'topics';
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $row['member_group_id'];
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $row['mgroup_others'];
|
||||
|
||||
$row['post'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $row['post'] );
|
||||
|
||||
IPSContentCache::update( $row['pid'], 'post', $row['post'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$row['post'] = $row['cache_content'];
|
||||
}
|
||||
|
||||
$row['post'] = IPSLib::memberViewImages( $row['post'] );
|
||||
|
||||
$row['_post_date'] = ipsRegistry::getClass( 'class_localization')->getDate( $row['post_date'], 'SHORT' );
|
||||
$row['_raw_date'] = $row['post_date'];
|
||||
$row['_date_array'] = IPSTime::date_getgmdate( $row['post_date'] + ipsRegistry::getClass( 'class_localization')->getTimeOffset() );
|
||||
|
||||
$row['post'] .= "\n<!--IBF.ATTACHMENT_". $row['pid']. "-->";
|
||||
|
||||
$content .= $this->registry->getClass('output')->getTemplate('profile')->tabSingleColumn( $row, $this->lang->words['profile_read_topic'], $this->settings['base_url'].'app=forums&module=forums&section=findpost&pid='.$row['pid'], $this->lang->words['profile_in_topic'] . $row['title'] );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Attachments (but only if necessary)
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $parseAttachments AND !is_object( $this->class_attach ) )
|
||||
{
|
||||
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'core' ) . '/sources/classes/attach/class_attach.php', 'class_attach' );
|
||||
$this->class_attach = new $classToLoad( $this->registry );
|
||||
|
||||
$this->class_attach->type = 'post';
|
||||
$this->class_attach->init();
|
||||
|
||||
if ( IPSMember::checkPermissions('download') === false )
|
||||
{
|
||||
$this->settings['show_img_upload'] = 0;
|
||||
}
|
||||
|
||||
$content = $this->class_attach->renderAttachments( $content, $pids );
|
||||
$content = $content[0]['html'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Macros...
|
||||
//-----------------------------------------
|
||||
|
||||
$content = $this->registry->output->replaceMacros( $content );
|
||||
|
||||
//-----------------------------------------
|
||||
// Return content..
|
||||
//-----------------------------------------
|
||||
|
||||
return $content ? $this->registry->getClass('output')->getTemplate('profile')->tabPosts( $content ) : $this->registry->getClass('output')->getTemplate('profile')->tabNoContent( 'err_no_posts_to_show' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* Config for topics plugin
|
||||
* Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Members
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Revision: 5713 $
|
||||
*
|
||||
*/
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
* Plug in name (Default tab name)
|
||||
*/
|
||||
$CONFIG['plugin_name'] = 'Topics';
|
||||
|
||||
/**
|
||||
* Language string for the tab
|
||||
*/
|
||||
$CONFIG['plugin_lang_bit'] = 'pp_tab_topics';
|
||||
|
||||
/**
|
||||
* Plug in key (must be the same as the main {file}.php name
|
||||
*/
|
||||
$CONFIG['plugin_key'] = 'topics';
|
||||
|
||||
/**
|
||||
* Show tab?
|
||||
*/
|
||||
$CONFIG['plugin_enabled'] = 1;
|
||||
|
||||
/**
|
||||
* Order
|
||||
*/
|
||||
$CONFIG['plugin_order'] = 3;
|
||||
@@ -0,0 +1,215 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* Profile Plugin Library
|
||||
* Last Updated: $Date: 2010-10-20 09:03:17 -0400 (Wed, 20 Oct 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: ips_terabyte $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Members
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Revision: 7003 $
|
||||
*/
|
||||
|
||||
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 profile_topics extends profile_plugin_parent
|
||||
{
|
||||
/**
|
||||
* Attachment object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $attach;
|
||||
|
||||
/**
|
||||
* Return HTML block
|
||||
*
|
||||
* @param array Member information
|
||||
* @return string HTML block
|
||||
*/
|
||||
public function return_html_block( $member=array() )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$content = '';
|
||||
$last_x = 5;
|
||||
$forum_ids = array();
|
||||
$date_cut = '';
|
||||
//-----------------------------------------
|
||||
// Got a member?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! is_array( $member ) OR ! count( $member ) )
|
||||
{
|
||||
return $this->registry->getClass('output')->getTemplate('profile')->tabNoContent( 'err_no_posts_to_show' );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Some words
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->class_localization->loadLanguageFile( array( 'public_topic' ), 'forums' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Can view other member's topics?
|
||||
//-----------------------------------------
|
||||
|
||||
if( !$this->memberData['g_other_topics'] AND $this->memberData['member_id'] != $member['member_id'] )
|
||||
{
|
||||
return $this->registry->getClass('output')->getTemplate('profile')->tabNoContent( 'err_no_posts_to_show' );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// And limit by post count...
|
||||
//-----------------------------------------
|
||||
|
||||
$posts = intval($this->memberData['posts']);
|
||||
|
||||
//-----------------------------------------
|
||||
// Will we need to parse attachments?
|
||||
//-----------------------------------------
|
||||
|
||||
$parseAttachments = false;
|
||||
|
||||
/* Get list of good forum IDs */
|
||||
$forumIdsOk = $this->registry->class_forums->fetchSearchableForumIds();
|
||||
|
||||
/* Set up joins */
|
||||
$_post_joins = array( array(
|
||||
'select' => 'p.*',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 't.topic_firstpost=p.pid',
|
||||
'type' => 'left'
|
||||
),
|
||||
array(
|
||||
'select' => 'm.member_group_id, m.mgroup_others',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=p.author_id',
|
||||
'type' => 'left'
|
||||
) );
|
||||
|
||||
/* Cache? */
|
||||
if ( IPSContentCache::isEnabled() )
|
||||
{
|
||||
if ( IPSContentCache::fetchSettingValue('post') )
|
||||
{
|
||||
$_post_joins[] = IPSContentCache::join( 'post', 'p.pid' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $this->settings['search_ucontent_days'] )
|
||||
{
|
||||
$date_cut = ( $this->memberData['last_post'] ? $this->memberData['last_post'] : time() ) - 86400 * intval( $this->settings['search_ucontent_days'] );
|
||||
$date_cut = ' AND t.start_date > ' . $date_cut;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get last X posts
|
||||
//-----------------------------------------
|
||||
|
||||
if( is_array($forumIdsOk) AND count($forumIdsOk) )
|
||||
{
|
||||
$this->DB->build( array( 'select' => 't.*',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => "t.starter_id={$member['member_id']} AND t.approved=1 AND t.forum_id IN (" . implode( ",", $forumIdsOk ) . ") " . $date_cut,
|
||||
'order' => 't.start_date DESC',
|
||||
'limit' => array( 0, $last_x ),
|
||||
'add_join' => $_post_joins ) );
|
||||
$o = $this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch( $o ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Ghost topics... BOO
|
||||
//-----------------------------------------
|
||||
|
||||
if( !$row['pid'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$pids[ $row['pid'] ] = $row['pid'];
|
||||
|
||||
if( $row['topic_hasattach'] )
|
||||
{
|
||||
$parseAttachments = true;
|
||||
}
|
||||
|
||||
if ( ! $row['cache_content'] )
|
||||
{
|
||||
IPSText::getTextClass( 'bbcode' )->parse_smilies = $row['use_emo'];
|
||||
IPSText::getTextClass( 'bbcode' )->parse_html = ( $row['use_html'] and $this->memberData['g_dohtml'] and $row['post_htmlstate'] ) ? 1 : 0;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_nl2br = $row['post_htmlstate'] == 2 ? 1 : 0;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_section = 'topics';
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $row['member_group_id'];
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $row['mgroup_others'];
|
||||
|
||||
$row['post'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $row['post'] );
|
||||
|
||||
IPSContentCache::update( $row['pid'], 'post', $row['post'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$row['post'] = $row['cache_content'];
|
||||
}
|
||||
|
||||
$row['post'] = IPSLib::memberViewImages( $row['post'] );
|
||||
|
||||
$row['_post_date'] = ipsRegistry::getClass( 'class_localization')->getDate( $row['post_date'], 'SHORT' );
|
||||
$row['_raw_date'] = $row['post_date'];
|
||||
$row['_date_array'] = IPSTime::date_getgmdate( $row['post_date'] + ipsRegistry::getClass( 'class_localization')->getTimeOffset() );
|
||||
|
||||
$row['post'] .= "\n<!--IBF.ATTACHMENT_". $row['pid']. "-->";
|
||||
|
||||
$content .= $this->registry->getClass('output')->getTemplate('profile')->tabSingleColumn( $row, $this->lang->words['profile_read_topic'], $this->settings['base_url'].'app=forums&module=forums&section=findpost&pid='.$row['pid'], $row['title'] );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Attachments (but only if necessary)
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $parseAttachments AND !is_object( $this->class_attach ) )
|
||||
{
|
||||
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'core' ) . '/sources/classes/attach/class_attach.php', 'class_attach' );
|
||||
$this->class_attach = new $classToLoad( $this->registry );
|
||||
|
||||
$this->class_attach->type = 'post';
|
||||
$this->class_attach->init();
|
||||
|
||||
if ( IPSMember::checkPermissions('download') === false )
|
||||
{
|
||||
$this->settings['show_img_upload'] = 0;
|
||||
}
|
||||
|
||||
$content = $this->class_attach->renderAttachments( $content, $pids );
|
||||
$content = $content[0]['html'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Macros...
|
||||
//-----------------------------------------
|
||||
|
||||
$content = $this->registry->output->replaceMacros( $content );
|
||||
|
||||
//-----------------------------------------
|
||||
// Return content..
|
||||
//-----------------------------------------
|
||||
|
||||
return $content ? $this->registry->getClass('output')->getTemplate('profile')->tabTopics( $content ) : $this->registry->getClass('output')->getTemplate('profile')->tabNoContent( 'err_no_posts_to_show' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<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,484 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* Report Center :: Posts plugin
|
||||
* Last Updated: $LastChangedDate: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @author Based on original "Report Center" by Luke Scott
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 5713 $
|
||||
*/
|
||||
|
||||
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 post_plugin
|
||||
{
|
||||
/**#@+
|
||||
* Registry objects
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $registry;
|
||||
protected $DB;
|
||||
protected $settings;
|
||||
protected $request;
|
||||
protected $lang;
|
||||
protected $member;
|
||||
protected $memberData;
|
||||
protected $cache;
|
||||
protected $caches;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Holds extra data for the plugin
|
||||
*
|
||||
* @var array Data specific to the plugin
|
||||
*/
|
||||
public $_extra;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param object Registry object
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Make object
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->member = $this->registry->member();
|
||||
$this->memberData =& $this->registry->member()->fetchMemberData();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
$this->lang = $this->registry->class_localization;
|
||||
|
||||
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/app_class_forums.php', 'app_class_forums', 'forums' );
|
||||
$app_class_forums = new $classToLoad( $this->registry );
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the form for extra data in the ACP
|
||||
*
|
||||
* @param array Plugin data
|
||||
* @param object HTML object
|
||||
* @return string HTML to add to the form
|
||||
*/
|
||||
public function displayAdminForm( $plugin_data, &$html )
|
||||
{
|
||||
return $html->addRow( $this->lang->words['r_supermod'],
|
||||
sprintf( $this->lang->words['r_supermod_info'], $this->settings['_base_url'] ),
|
||||
$this->registry->output->formYesNo('report_supermod', (!isset( $plugin_data['report_supermod'] )) ? 1 : $plugin_data['report_supermod'] )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the plugin's form fields for saving
|
||||
*
|
||||
* @param array Plugin data for save
|
||||
* @return string Error message
|
||||
*/
|
||||
public function processAdminForm( &$save_data_array )
|
||||
{
|
||||
$save_data_array['report_supermod'] = intval($this->request['report_supermod']);
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Update timestamp for report
|
||||
*
|
||||
* @param array New reports
|
||||
* @param array New members cache
|
||||
* @return boolean
|
||||
*/
|
||||
public function updateReportsTimestamp( $new_reports, &$new_members_cache )
|
||||
{
|
||||
$nmc =& $new_members_cache['report_temp']['post_marker'];
|
||||
|
||||
foreach( $new_reports as $report )
|
||||
{
|
||||
if( $report['is_new'] == 1 || $report['is_active'] == 1 )
|
||||
{
|
||||
$nmc['forum'][ $report['exdat1'] ]['info'] = array( 'id' => $report['id'], 'title' => $report['title'], 'com_id' => $report['com_id'] );
|
||||
$nmc['topic'][ $report['exdat2'] ]['info'] = array( 'id' => $report['id'], 'title' => $report['title'], 'com_id' => $report['com_id'] );
|
||||
$nmc['post'][ $report['exdat3'] ]['info'] = array( 'id' => $report['id'], 'title' => $report['title'], 'com_id' => $report['com_id'] );
|
||||
}
|
||||
if( $report['is_new'] == 1 )
|
||||
{
|
||||
$nmc['forum'][ $report['exdat1'] ]['gfx'] = 1;
|
||||
$nmc['topic'][ $report['exdat2'] ]['gfx'] = 1;
|
||||
$nmc['post'][ $report['exdat3'] ]['gfx'] = 1;
|
||||
}
|
||||
elseif( $report['is_active'] == 1 )
|
||||
{
|
||||
$nmc['forum'][ $report['exdat1'] ]['gfx'] = 2;
|
||||
$nmc['topic'][ $report['exdat2'] ]['gfx'] = 2;
|
||||
$nmc['post'][ $report['exdat3'] ]['gfx'] = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get report permissions
|
||||
*
|
||||
* @param string Type of perms to check
|
||||
* @param array Permissions data
|
||||
* @param array group ids
|
||||
* @param string Special permissions
|
||||
* @return boolean
|
||||
*/
|
||||
public function getReportPermissions( $check, $com_dat, $group_ids, &$to_return )
|
||||
{
|
||||
if( ( $this->memberData['g_is_supmod'] == 1 && ( ! isset($this->_extra['report_supermod']) || $this->_extra['report_supermod'] == 1 ) ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! is_array( $this->caches['moderators'] ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$forum_ids = array();
|
||||
|
||||
foreach( $this->caches['moderators'] as $mod )
|
||||
{
|
||||
if( $mod['member_id'] == $this->memberData['member_id'] )
|
||||
{
|
||||
$these_forums = explode( ',', IPSText::cleanPermString( $mod['forum_id'] ) );
|
||||
|
||||
foreach( $these_forums as $forum_id )
|
||||
{
|
||||
$forum_ids['exdat1'][] = $forum_id;
|
||||
}
|
||||
}
|
||||
elseif( $mod['is_group'] == 1 && in_array( $mod['group_id'], $group_ids ) == true )
|
||||
{
|
||||
$these_forums = explode( ',', IPSText::cleanPermString( $mod['forum_id'] ) );
|
||||
|
||||
foreach( $these_forums as $forum_id )
|
||||
{
|
||||
$forum_ids['exdat1'][] = $forum_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( count( $forum_ids ) > 0 )
|
||||
{
|
||||
$to_return = $forum_ids;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the report form for this module
|
||||
*
|
||||
* @param array Application data
|
||||
* @return string HTML form information
|
||||
*/
|
||||
public function reportForm( $com_dat )
|
||||
{
|
||||
$this->lang->words['report_basic_title'] = $this->lang->words['report_post_title'];
|
||||
$this->lang->words['report_basic_url_title'] = $this->lang->words['report_post_url_title'];
|
||||
$this->lang->words['report_basic_enter'] = $this->lang->words['report_post_enter'];
|
||||
|
||||
$this->registry->output->setTitle( $this->lang->words['report_basic_title'] );
|
||||
$this->registry->output->addNavigation( $this->lang->words['report_basic_title'], '' );
|
||||
|
||||
$topic_id = intval($this->request['tid']);
|
||||
$this->_checkAccess( $topic_id );
|
||||
|
||||
$extra_data = array(
|
||||
'topic_id' => intval($topic_id),
|
||||
'post_id' => intval($this->request['pid']),
|
||||
'forum_id' => intval($this->topic['forum_id']),
|
||||
);
|
||||
|
||||
$url = $this->registry->output->buildSEOUrl( "showtopic={$extra_data['topic_id']}&view=findpost&p={$extra_data['post_id']}", 'public', $this->topic['title_seo'], 'showtopic' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Title, URL Extra Data (Array)
|
||||
//-----------------------------------------
|
||||
|
||||
return $this->registry->getClass('reportLibrary')->showReportForm( $this->topic['title'], $url, $extra_data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get section and link
|
||||
*
|
||||
* @param array Report data
|
||||
* @return array Section/link
|
||||
*/
|
||||
public function giveSectionLinkTitle( $report_row )
|
||||
{
|
||||
return array(
|
||||
'title' => $this->registry->class_forums->forum_by_id[ $report_row['exdat1'] ]['name'],
|
||||
'url' => '/index.php?showforum=' . $report_row['exdat1'],
|
||||
'seo_title' => $this->registry->class_forums->forum_by_id[ $report_row['exdat1'] ]['name_seo'],
|
||||
'seo_template' => 'showforum',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process a report and save the data appropriate
|
||||
*
|
||||
* @param array Report data
|
||||
* @return array Data from saving the report
|
||||
*/
|
||||
public function processReport( $com_dat )
|
||||
{
|
||||
$topic_id = intval($this->request['topic_id']);
|
||||
$post_id = intval($this->request['post_id']);
|
||||
$forum_id = intval($this->request['forum_id']);
|
||||
|
||||
if( ! $topic_id || ! $post_id )
|
||||
{
|
||||
$this->registry->output->showError( 'reports_missing_tidpid', 10168 );
|
||||
}
|
||||
|
||||
$uid = md5( 'topic_' . $topic_id . '_' . $post_id . '_' . $forum_id . '_' . $com_dat['com_id'] );
|
||||
|
||||
$url = 'showtopic=' . intval($topic_id) . '&view=findpost&p=' . intval($post_id);
|
||||
$save_url = str_replace( '&', '&', $url);
|
||||
|
||||
$status = array();
|
||||
|
||||
$this->DB->build( array( 'select' => 'status, is_new, is_complete',
|
||||
'from' => 'rc_status',
|
||||
'where' => "is_new=1 OR is_complete=1",
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
if( $row['is_new'] == 1 )
|
||||
{
|
||||
$status['new'] = $row['status'];
|
||||
}
|
||||
elseif( $row['is_complete'] == 1 )
|
||||
{
|
||||
$status['complete'] = $row['status'];
|
||||
}
|
||||
}
|
||||
|
||||
$data = $this->DB->buildAndFetch( array(
|
||||
'select' => 'p.post',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'p.pid=' . $post_id,
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 't.title_seo',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.tid=p.topic_id',
|
||||
'type' => 'left',
|
||||
),
|
||||
array(
|
||||
'select' => 'mem.member_id, mem.members_display_name',
|
||||
'from' => array( 'members' => 'mem' ),
|
||||
'where' => 'mem.member_id=p.author_id',
|
||||
'type' => 'left',
|
||||
),
|
||||
)
|
||||
) );
|
||||
|
||||
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_html = 0;
|
||||
IPSText::getTextClass('bbcode')->parse_emoticons = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_nl2br = 0;
|
||||
IPSText::getTextClass('bbcode')->parsing_section = 'global';
|
||||
|
||||
$message = "[quote name='" . IPSText::getTextClass('bbcode')->makeQuoteSafe( $data['members_display_name'] ) . "']";
|
||||
$message .= IPSText::getTextClass('bbcode')->preEditParse( $data['post'] );
|
||||
$message .= "[/quote]\n\n";
|
||||
$message .= $this->request['message'];
|
||||
|
||||
$this->DB->build( array( 'select' => 'id', 'from' => 'rc_reports_index', 'where' => "uid='{$uid}'" ) );
|
||||
$this->DB->execute();
|
||||
|
||||
if( $this->DB->getTotalRows() == 0 )
|
||||
{
|
||||
$this->_checkAccess( $topic_id );
|
||||
|
||||
$built_report_main = array(
|
||||
'uid' => $uid,
|
||||
'title' => $this->topic['title'],
|
||||
'status' => $status['new'],
|
||||
'url' => '/index.php?' . $save_url,
|
||||
'seoname' => $data['title_seo'],
|
||||
'seotemplate' => 'showtopic',
|
||||
'rc_class' => $com_dat['com_id'],
|
||||
'updated_by' => $this->memberData['member_id'],
|
||||
'date_updated' => time(),
|
||||
'date_created' => time(),
|
||||
'exdat1' => $forum_id,
|
||||
'exdat2' => $topic_id,
|
||||
'exdat3' => $post_id,
|
||||
);
|
||||
|
||||
$this->DB->insert( 'rc_reports_index', $built_report_main );
|
||||
$rid = $this->DB->getInsertId();
|
||||
}
|
||||
else
|
||||
{
|
||||
$the_report = $this->DB->fetch();
|
||||
$rid = $the_report['id'];
|
||||
$this->DB->update( 'rc_reports_index', array( 'date_updated' => time(), 'status' => $status['new'], 'seoname' => $data['title_seo'], 'seotemplate' => 'showtopic' ), "id='{$rid}'" );
|
||||
}
|
||||
|
||||
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_html = 0;
|
||||
IPSText::getTextClass('bbcode')->parse_emoticons = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_nl2br = 1;
|
||||
IPSText::getTextClass('bbcode')->parsing_section = 'reports';
|
||||
|
||||
$build_report = array(
|
||||
'rid' => $rid,
|
||||
'report' => IPSText::getTextClass('bbcode')->preDbParse( $message ),
|
||||
'report_by' => $this->memberData['member_id'],
|
||||
'date_reported' => time(),
|
||||
);
|
||||
$this->DB->insert( 'rc_reports', $build_report );
|
||||
|
||||
$reports = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as total', 'from' => 'rc_reports', 'where' => "rid='{$rid}'" ) );
|
||||
|
||||
$this->DB->update( 'rc_reports_index', array( 'num_reports' => $reports['total'] ), "id='{$rid}'" );
|
||||
|
||||
$return_data = array(
|
||||
'REDIRECT_URL' => $url,
|
||||
'FORUM_ID' => $forum_id,
|
||||
'REPORT_INDEX' => $rid,
|
||||
'SAVED_URL' => '/index.php?' . $save_url,
|
||||
'REPORT' => $build_report['report'],
|
||||
'SEOTITLE' => $data['title_seo'],
|
||||
'TEMPLATE' => 'showtopic',
|
||||
);
|
||||
|
||||
return $return_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Where to send user after report is submitted
|
||||
*
|
||||
* @param array Report data
|
||||
* @return void
|
||||
*/
|
||||
public function reportRedirect( $report_data )
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['report_sending'], $this->settings['base_url'] . $report_data['REDIRECT_URL'], $report_data['SEOTITLE'], $report_data['TEMPLATE'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve list of users to send notifications to
|
||||
*
|
||||
* @param string Group ids
|
||||
* @param array Report data
|
||||
* @return array Array of users to PM/Email
|
||||
*/
|
||||
public function getNotificationList( $group_ids, $report_data )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Build where for secondary member groups
|
||||
//-----------------------------------------
|
||||
|
||||
$secondaryWhere = array();
|
||||
|
||||
if( is_array($group_ids) AND count($group_ids) )
|
||||
{
|
||||
foreach( $group_ids as $group_id )
|
||||
{
|
||||
$secondaryWhere[] = "m.mgroup_others LIKE '%,{$group_id},%'";
|
||||
}
|
||||
}
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => 'noti.*',
|
||||
'from' => array( 'rc_modpref' => 'noti' ),
|
||||
'where' => "(m.member_group_id IN(" . $group_ids . ") " . ( count($secondaryWhere) ? "OR " . implode( ' OR ', $secondaryWhere ) : '' ) . ") AND (g.g_is_supmod=1 OR g.g_access_cp=1 OR moderator.forum_id LIKE '%,{$report_data['FORUM_ID']},%')",
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 'm.member_id as real_member_id, m.members_display_name as name, m.language, m.members_disable_pm, m.email, m.member_group_id',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=noti.mem_id',
|
||||
),
|
||||
array(
|
||||
'select' => 'moderator.member_id, moderator.group_id',
|
||||
'from' => array( 'moderators' => 'moderator' ),
|
||||
'where' => 'moderator.member_id=m.member_id OR moderator.group_id=m.member_group_id',
|
||||
),
|
||||
array(
|
||||
'from' => array( 'groups' => 'g' ),
|
||||
'where' => 'g.g_id=m.member_group_id',
|
||||
'type' => 'left',
|
||||
),
|
||||
)
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
$notify = array();
|
||||
|
||||
if ( $this->DB->getTotalRows() )
|
||||
{
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
$r['member_id'] = $r['real_member_id'];
|
||||
|
||||
$notify[ $r['member_id'] ] = $r;
|
||||
}
|
||||
}
|
||||
|
||||
return $notify;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check access to report the topic
|
||||
*
|
||||
* @param integer Topic id
|
||||
* @return void
|
||||
*/
|
||||
private function _checkAccess( $tid )
|
||||
{
|
||||
if ( ! $this->memberData['member_id'] )
|
||||
{
|
||||
$this->registry->output->showError( 'reports_must_be_member', 10169 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Needs silly a. alias to keep oracle
|
||||
// happy
|
||||
//-----------------------------------------
|
||||
|
||||
$this->topic = $this->DB->buildAndFetch( array( 'select' => 'a.*,a.title as topic_title', 'from' => 'topics a', 'where' => "a.tid=" . $tid ) );
|
||||
|
||||
if( ipsRegistry::isClassLoaded('class_forums') !== TRUE )
|
||||
{
|
||||
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums' );
|
||||
$this->registry->setClass( 'class_forums', new $classToLoad( $this->registry ) );
|
||||
$this->registry->getClass('class_forums')->forumsInit();
|
||||
}
|
||||
|
||||
$this->registry->getClass('class_forums')->forumsCheckAccess( $this->topic['forum_id'], 0, 'topic', $this->topic );
|
||||
}
|
||||
}
|
||||
@@ -1,47 +1,49 @@
|
||||
<?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";
|
||||
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* Reputation configuration for application
|
||||
* Last Updated: $Date: 2010-10-21 07:08:38 -0400 (Thu, 21 Oct 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $author$
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 7007 $
|
||||
*/
|
||||
|
||||
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';
|
||||
@@ -1,138 +1,135 @@
|
||||
<?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&module=global&section=rss&type=forums&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();
|
||||
}
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* RSS output plugin :: posts
|
||||
* Last Updated: $Date: 2010-10-20 09:03:17 -0400 (Wed, 20 Oct 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: ips_terabyte $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 6/24/2008
|
||||
* @version $Revision: 7003 $
|
||||
*/
|
||||
|
||||
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
|
||||
*
|
||||
* @var integer Expiration timestamp
|
||||
*/
|
||||
private $expires = 0;
|
||||
|
||||
/**
|
||||
* Grab the RSS links
|
||||
*
|
||||
* @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&module=global&section=rss&type=forums&id=" . $r['rss_export_id'], '%%' . $r['rss_export_title'] . '%%', 'section=rss2' ) );
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Grab the RSS document content and return it
|
||||
*
|
||||
* @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 );
|
||||
|
||||
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/app_class_forums.php', 'app_class_forums', 'forums' );
|
||||
$app_class_forums = new $classToLoad( ipsRegistry::instance() );
|
||||
|
||||
$classToLoad = IPSLib::loadActionOverloader( IPSLib::getAppDir( 'forums' ) . '/modules_admin/rss/export.php', 'admin_forums_rss_export' );
|
||||
$rss_export = new $classToLoad();
|
||||
$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
|
||||
*
|
||||
* @return integer Expiration timestamp
|
||||
*/
|
||||
public function grabExpiryDate()
|
||||
{
|
||||
return $this->expires ? $this->expires : time();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* Config file
|
||||
* Last Updated: $Date: 2010-02-19 01:29:54 +0000 (Fri, 19 Feb 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $author$
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 5855 $
|
||||
**/
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
/* Can search with this app */
|
||||
$CONFIG['can_search'] = 1;
|
||||
|
||||
/* Can view new content with this app */
|
||||
$CONFIG['can_viewNewContent'] = 1;
|
||||
|
||||
/* Can fetch active content with this app */
|
||||
$CONFIG['can_activeContent'] = 1;
|
||||
|
||||
/* Can fetch user generated content */
|
||||
$CONFIG['can_userContent'] = 1;
|
||||
@@ -0,0 +1,10 @@
|
||||
<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,732 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* Basic Forum Search
|
||||
* Last Updated: $Date: 2010-02-23 12:38:11 +0000 (Tue, 23 Feb 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: matt $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 5861 $
|
||||
*/
|
||||
|
||||
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 search_engine_forums extends search_engine
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry )
|
||||
{
|
||||
/* Hard limit */
|
||||
IPSSearchRegistry::set('set.hardLimit', ( ipsRegistry::$settings['search_hardlimit'] ) ? ipsRegistry::$settings['search_hardlimit'] : 200 );
|
||||
|
||||
/* Get class forums, used for displaying forum names on results */
|
||||
if ( ipsRegistry::isClassLoaded('class_forums') !== TRUE )
|
||||
{
|
||||
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums' );
|
||||
ipsRegistry::setClass( 'class_forums', new $classToLoad( ipsRegistry::instance() ) );
|
||||
ipsRegistry::getClass('class_forums')->forumsInit();
|
||||
}
|
||||
|
||||
parent::__construct( $registry );
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a search.
|
||||
* Returns an array of a total count (total number of matches)
|
||||
* and an array of IDs ( 0 => 1203, 1 => 928, 2 => 2938 ).. matching the required number based on pagination. The ids returned would be based on the filters and type of search
|
||||
*
|
||||
* So if we had 1000 replies, and we are on page 2 of 25 per page, we'd return 25 items offset by 25
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function search()
|
||||
{
|
||||
$start = intval( IPSSearchRegistry::get('in.start') );
|
||||
$perPage = IPSSearchRegistry::get('opt.search_per_page');
|
||||
$sort_by = IPSSearchRegistry::get('in.search_sort_by');
|
||||
$sort_order = IPSSearchRegistry::get('in.search_sort_order');
|
||||
$search_term = IPSSearchRegistry::get('in.clean_search_term');
|
||||
$content_title_only = IPSSearchRegistry::get('opt.searchTitleOnly');
|
||||
$post_search_only = IPSSearchRegistry::get('opt.onlySearchPosts');
|
||||
$search_ids = array();
|
||||
$groupby = false;
|
||||
$cType = IPSSearchRegistry::get('contextual.type');
|
||||
$cId = IPSSearchRegistry::get('contextual.id' );
|
||||
|
||||
/* Contextual search */
|
||||
if ( $cType == 'topic' )
|
||||
{
|
||||
$content_title_only = false;
|
||||
$post_search_only = true;
|
||||
|
||||
IPSSearchRegistry::set('opt.searchTitleOnly', false);
|
||||
IPSSearchRegistry::set('opt.onlySearchPosts', true);
|
||||
IPSSearchRegistry::set('display.onlyTitles', false);
|
||||
IPSSearchRegistry::set('opt.noPostPreview', false);
|
||||
}
|
||||
|
||||
/* Permissions */
|
||||
$permissions['TopicSoftDeleteSee'] = $this->registry->getClass('class_forums')->canSeeSoftDeletedTopics( 0 );
|
||||
$permissions['canQueue'] = $this->registry->getClass('class_forums')->canQueuePosts( 0 );
|
||||
$permissions['PostSoftDeleteSee'] = $this->registry->getClass('class_forums')->canSeeSoftDeletedPosts( 0 );
|
||||
$permissions['SoftDeleteReason'] = $this->registry->getClass('class_forums')->canSeeSoftDeleteReason( 0 );
|
||||
$permissions['SoftDeleteContent'] = $this->registry->getClass('class_forums')->canSeeSoftDeleteContent( 0 );
|
||||
|
||||
/* Sorting */
|
||||
switch( $sort_by )
|
||||
{
|
||||
default:
|
||||
case 'date':
|
||||
$sortKey = 'last_post';
|
||||
$sortKeyPost = 'post_date';
|
||||
break;
|
||||
case 'title':
|
||||
$sortKeyPost = $sortKey = 'tordinal';
|
||||
break;
|
||||
case 'posts':
|
||||
$sortKeyPost = $sortKey = 'posts';
|
||||
break;
|
||||
case 'views':
|
||||
$sortKeyPost = $sortKey = 'views';
|
||||
break;
|
||||
}
|
||||
|
||||
/* Limit Results */
|
||||
$this->sphinxClient->SetLimits( intval($start), intval($perPage) );
|
||||
|
||||
/* Loop through the forums and build a list of forums we're allowed access to */
|
||||
$forumIdsOk = array();
|
||||
$forumIdsBad = array();
|
||||
|
||||
if ( ! empty( ipsRegistry::$request['search_app_filters']['forums']['forums'] ) AND count( ipsRegistry::$request['search_app_filters']['forums']['forums'] ) )
|
||||
{
|
||||
foreach( ipsRegistry::$request['search_app_filters']['forums']['forums'] as $forum_id )
|
||||
{
|
||||
if( $forum_id )
|
||||
{
|
||||
$data = $this->registry->class_forums->forum_by_id[ $forum_id ];
|
||||
|
||||
/* Check for sub forums */
|
||||
$children = ipsRegistry::getClass( 'class_forums' )->forumsGetChildren( $forum_id );
|
||||
|
||||
foreach( $children as $kid )
|
||||
{
|
||||
if( ! in_array( $kid, ipsRegistry::$request['search_app_filters']['forums']['forums'] ) )
|
||||
{
|
||||
if( ! $this->registry->permissions->check( 'read', $this->registry->class_forums->forum_by_id[ $kid ] ) )
|
||||
{
|
||||
$forumIdsBad[] = $kid;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Can read, but is it password protected, etc? */
|
||||
if ( ! $this->registry->class_forums->forumsCheckAccess( $kid, 0, 'forum', array(), true ) )
|
||||
{
|
||||
$forumIdsBad[] = $kid;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! $this->registry->class_forums->forum_by_id[ $kid ]['sub_can_post'] OR ! $this->registry->class_forums->forum_by_id[ $kid ]['can_view_others'] )
|
||||
{
|
||||
$forumIdsBad[] = $kid;
|
||||
continue;
|
||||
}
|
||||
|
||||
$forumIdsOk[] = $kid;
|
||||
}
|
||||
}
|
||||
|
||||
/* Can we read? */
|
||||
if ( ! $this->registry->permissions->check( 'view', $data ) )
|
||||
{
|
||||
$forumIdsBad[] = $forum_id;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Can read, but is it password protected, etc? */
|
||||
if ( ! $this->registry->class_forums->forumsCheckAccess( $forum_id, 0, 'forum', array(), true ) )
|
||||
{
|
||||
$forumIdsBad[] = $forum_id;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! $data['sub_can_post'] OR ! $data['can_view_others'] AND !$this->memberData['g_access_cp'] )
|
||||
{
|
||||
$forumIdsBad[] = $forum_id;
|
||||
continue;
|
||||
}
|
||||
|
||||
$forumIdsOk[] = $forum_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! count($forumIdsOk) )
|
||||
{
|
||||
$allowTrashCan = ( $cType == 'forum' ) ? true : false;
|
||||
|
||||
/* Get list of good forum IDs */
|
||||
$forumIdsOk = $this->registry->class_forums->fetchSearchableForumIds( null, array(), $allowTrashCan );
|
||||
}
|
||||
|
||||
/* Add allowed forums */
|
||||
$forumIdsOk = ( count( $forumIdsOk ) ) ? $forumIdsOk : array( 0 => 0 );
|
||||
|
||||
/* Contextual */
|
||||
if ( $cType == 'forum' AND $cId AND in_array( $cId, $forumIdsOk ) )
|
||||
{
|
||||
$this->sphinxClient->SetFilter( 'forum_id', array( $cId ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->sphinxClient->SetFilter( 'forum_id', $forumIdsOk );
|
||||
}
|
||||
|
||||
/* Topic contextual */
|
||||
if ( $cType == 'topic' AND $cId )
|
||||
{
|
||||
$this->sphinxClient->SetFilter( 'tid', array( $cId ) );
|
||||
}
|
||||
|
||||
/* Exclude some items */
|
||||
if ( ! $content_title_only )
|
||||
{
|
||||
if ( $permissions['SoftDeleteContent'] AND $permissions['PostSoftDeleteSee'] AND $permissions['canQueue'] )
|
||||
{
|
||||
$this->sphinxClient->SetFilter( 'queued', array( 0,1,2 ) );
|
||||
}
|
||||
else if ( $permissions['SoftDeleteContent'] AND $permissions['PostSoftDeleteSee'] )
|
||||
{
|
||||
$this->sphinxClient->SetFilter( 'queued', array( 0,2 ) );
|
||||
}
|
||||
else if ( $permissions['canQueue'] )
|
||||
{
|
||||
$this->sphinxClient->SetFilter( 'queued', array( 0,1 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->sphinxClient->SetFilter( 'queued', array( 0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $permissions['SoftDeleteContent'] AND $permissions['TopicSoftDeleteSee'] AND $permissions['canQueue'] )
|
||||
{
|
||||
$this->sphinxClient->SetFilter( 'approved' , array( 0,1 ) );
|
||||
$this->sphinxClient->SetFilter( 'soft_deleted', array( 0,1 ) );
|
||||
}
|
||||
else if ( $permissions['SoftDeleteContent'] AND $permissions['TopicSoftDeleteSee'] )
|
||||
{
|
||||
$this->sphinxClient->SetFilter( 'approved', array( 1 ) );
|
||||
$this->sphinxClient->SetFilter( 'soft_deleted', array( 0,1 ) );
|
||||
}
|
||||
else if ( $permissions['canQueue'] )
|
||||
{
|
||||
$this->sphinxClient->SetFilter( 'soft_deleted', array( 0 ) );
|
||||
$this->sphinxClient->SetFilter( 'approved', array( 0,1 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->sphinxClient->SetFilter( 'soft_deleted', array( 0 ) );
|
||||
$this->sphinxClient->SetFilter( 'approved', array( 1 ) );
|
||||
}
|
||||
|
||||
|
||||
/* Additional filters */
|
||||
if ( IPSSearchRegistry::get('opt.pCount') )
|
||||
{
|
||||
$this->sphinxClient->SetFilterRange( 'posts', intval( IPSSearchRegistry::get('opt.pCount') ), 1500000000 );
|
||||
}
|
||||
|
||||
if ( IPSSearchRegistry::get('opt.pViews') )
|
||||
{
|
||||
$this->sphinxClient->SetFilterRange( 'views', intval( IPSSearchRegistry::get('opt.pViews') ), 1500000000 );
|
||||
}
|
||||
|
||||
/* Date limit */
|
||||
if ( $this->search_begin_timestamp )
|
||||
{
|
||||
if ( ! $this->search_end_timestamp )
|
||||
{
|
||||
$this->search_end_timestamp = time() + 100;
|
||||
}
|
||||
|
||||
if ( $content_title_only )
|
||||
{
|
||||
$this->sphinxClient->SetFilterRange( 'start_date', $this->search_begin_timestamp, $this->search_end_timestamp );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->sphinxClient->SetFilterRange( 'post_date', $this->search_begin_timestamp, $this->search_end_timestamp );
|
||||
}
|
||||
}
|
||||
|
||||
if ( IPSSearchRegistry::get('opt.noPostPreview') OR IPSSearchRegistry::get('display.onlyTitles') )
|
||||
{
|
||||
$groupby = true;
|
||||
}
|
||||
|
||||
if ( $content_title_only )
|
||||
{
|
||||
if ( $sort_order == 'asc' )
|
||||
{
|
||||
$this->sphinxClient->SetSortMode( SPH_SORT_ATTR_ASC, $sortKey );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->sphinxClient->SetSortMode( SPH_SORT_ATTR_DESC, $sortKey );
|
||||
}
|
||||
|
||||
if ( $groupby )
|
||||
{
|
||||
$this->sphinxClient->SetGroupBy( 'last_post_group', SPH_GROUPBY_ATTR, '@group ' . $sort_order );
|
||||
}
|
||||
|
||||
$_s = ( $search_term ) ? '@title ' . $search_term : '';
|
||||
|
||||
$result = $this->sphinxClient->Query( $_s, 'forums_search_posts_main,forums_search_posts_delta' );
|
||||
|
||||
$this->logSphinxWarnings();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $groupby )
|
||||
{
|
||||
$this->sphinxClient->SetGroupBy( 'last_post_group', SPH_GROUPBY_ATTR, '@group DESC');
|
||||
}
|
||||
|
||||
if ( $sort_order == 'asc' )
|
||||
{
|
||||
$this->sphinxClient->SetSortMode( SPH_SORT_ATTR_ASC, $sortKeyPost );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->sphinxClient->SetSortMode( SPH_SORT_ATTR_DESC, $sortKeyPost );
|
||||
}
|
||||
|
||||
if ( $post_search_only )
|
||||
{
|
||||
$_s = ( $search_term ) ? '@post ' . $search_term : '';
|
||||
$result = $this->sphinxClient->Query( $_s, 'forums_search_posts_main,forums_search_posts_delta' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$_s = ( $search_term AND strstr( $search_term, '"' ) ) ? '@post ' . $search_term . ' | @title ' . $search_term : ( $search_term ? '@(post,title) ' . $search_term : '' );
|
||||
$result = $this->sphinxClient->Query( $_s, 'forums_search_posts_main,forums_search_posts_delta' );
|
||||
}
|
||||
|
||||
$this->logSphinxWarnings();
|
||||
}
|
||||
|
||||
if ( is_array( $result['matches'] ) && count( $result['matches'] ) )
|
||||
{
|
||||
foreach( $result['matches'] as $res )
|
||||
{
|
||||
$search_ids[] = ( $content_title_only ) ? $res['attrs']['tid'] : $res['attrs']['search_id'];
|
||||
}
|
||||
}
|
||||
|
||||
/* Return it */
|
||||
return array( 'count' => intval( $result['total_found'] ) > 1000 ? 1000 : $result['total_found'], 'resultSet' => $search_ids );
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform the search
|
||||
* Populates $this->_count and $this->_results
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function viewUserContent( $member )
|
||||
{
|
||||
/* Ensure we limit by date */
|
||||
$this->settings['search_ucontent_days'] = ( $this->settings['search_ucontent_days'] ) ? $this->settings['search_ucontent_days'] : 365;
|
||||
|
||||
/* Bit of init */
|
||||
$time = time() - ( 86400 * intval( $this->settings['search_ucontent_days'] ) );
|
||||
|
||||
switch( IPSSearchRegistry::get('in.userMode') )
|
||||
{
|
||||
default:
|
||||
case 'all':
|
||||
IPSSearchRegistry::set('opt.searchTitleOnly', false );
|
||||
IPSSearchRegistry::set('display.onlyTitles' , true );
|
||||
IPSSearchRegistry::set('opt.noPostPreview' , false );
|
||||
break;
|
||||
case 'title':
|
||||
IPSSearchRegistry::set('opt.searchTitleOnly', true );
|
||||
IPSSearchRegistry::set('display.onlyTitles' , true );
|
||||
IPSSearchRegistry::set('opt.noPostPreview' , false );
|
||||
break;
|
||||
case 'content':
|
||||
IPSSearchRegistry::set('opt.searchTitleOnly', false );
|
||||
IPSSearchRegistry::set('display.onlyTitles' , false );
|
||||
IPSSearchRegistry::set('opt.noPostPreview' , false );
|
||||
break;
|
||||
}
|
||||
|
||||
/* Init */
|
||||
$start = IPSSearchRegistry::get('in.start');
|
||||
$perPage = IPSSearchRegistry::get('opt.search_per_page');
|
||||
|
||||
IPSSearchRegistry::set('in.search_sort_by' , 'date' );
|
||||
IPSSearchRegistry::set('in.search_sort_order', 'desc' );
|
||||
|
||||
/* Limit Results */
|
||||
$this->sphinxClient->SetLimits( intval($start), intval($perPage) );
|
||||
|
||||
/* Get list of good forum IDs */
|
||||
$forumIdsOk = $this->registry->class_forums->fetchSearchableForumIds( $this->memberData['member_id'] );
|
||||
|
||||
$this->sphinxClient->SetFilter( 'forum_id', $forumIdsOk );
|
||||
|
||||
/* what we doing? */
|
||||
if ( IPSSearchRegistry::get('in.userMode') != 'title' )
|
||||
{
|
||||
$this->sphinxClient->SetFilter( 'author_id', array( intval( $member['member_id'] ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->sphinxClient->SetFilter( 'starter_id', array( intval( $member['member_id'] ) ) );
|
||||
}
|
||||
|
||||
if ( $this->settings['search_ucontent_days'] )
|
||||
{
|
||||
$this->sphinxClient->SetFilterRange( 'post_date', $time, time() );
|
||||
}
|
||||
|
||||
/* Set up perms */
|
||||
$permissions['TopicSoftDeleteSee'] = $this->registry->getClass('class_forums')->canSeeSoftDeletedTopics( 0 );
|
||||
$permissions['canQueue'] = $this->registry->getClass('class_forums')->canQueuePosts( 0 );
|
||||
$permissions['PostSoftDeleteSee'] = $this->registry->getClass('class_forums')->canSeeSoftDeletedPosts( 0 );
|
||||
$permissions['SoftDeleteReason'] = $this->registry->getClass('class_forums')->canSeeSoftDeleteReason( 0 );
|
||||
$permissions['SoftDeleteContent'] = $this->registry->getClass('class_forums')->canSeeSoftDeleteContent( 0 );
|
||||
|
||||
/* Exclude some items */
|
||||
if ( IPSSearchRegistry::get('in.userMode') != 'title' )
|
||||
{
|
||||
if ( $permissions['SoftDeleteContent'] AND $permissions['PostSoftDeleteSee'] AND $permissions['canQueue'] )
|
||||
{
|
||||
$this->sphinxClient->SetFilter( 'queued', array( 0,1,2 ) );
|
||||
}
|
||||
else if ( $permissions['SoftDeleteContent'] AND $permissions['PostSoftDeleteSee'] )
|
||||
{
|
||||
$this->sphinxClient->SetFilter( 'queued', array( 0,2 ) );
|
||||
}
|
||||
else if ( $permissions['canQueue'] )
|
||||
{
|
||||
$this->sphinxClient->SetFilter( 'queued', array( 0,1 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->sphinxClient->SetFilter( 'queued', array( 0 ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $permissions['SoftDeleteContent'] AND $permissions['TopicSoftDeleteSee'] AND $permissions['canQueue'] )
|
||||
{
|
||||
$this->sphinxClient->SetFilter( 'approved' , array( 0,1 ) );
|
||||
$this->sphinxClient->SetFilter( 'soft_deleted', array( 0,1 ) );
|
||||
}
|
||||
else if ( $permissions['SoftDeleteContent'] AND $permissions['TopicSoftDeleteSee'] )
|
||||
{
|
||||
$this->sphinxClient->SetFilter( 'approved', array( 0 ) );
|
||||
$this->sphinxClient->SetFilter( 'soft_deleted', array( 0,1 ) );
|
||||
}
|
||||
else if ( $permissions['canQueue'] )
|
||||
{
|
||||
$this->sphinxClient->SetFilter( 'soft_deleted', array( 0 ) );
|
||||
$this->sphinxClient->SetFilter( 'approved', array( 0,1 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->sphinxClient->SetFilter( 'soft_deleted', array( 0 ) );
|
||||
$this->sphinxClient->SetFilter( 'approved', array( 1 ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( IPSSearchRegistry::get('in.userMode') == 'title' )
|
||||
{
|
||||
$this->sphinxClient->SetGroupDistinct ( "tid" );
|
||||
$this->sphinxClient->SetGroupBy( 'tid', SPH_GROUPBY_ATTR, '@group DESC' );
|
||||
|
||||
$this->sphinxClient->SetSortMode( SPH_SORT_ATTR_DESC, 'last_post' );
|
||||
|
||||
$result = $this->sphinxClient->Query( '', 'forums_search_posts_main,forums_search_posts_delta' );
|
||||
|
||||
$this->logSphinxWarnings();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( IPSSearchRegistry::get('in.userMode') == 'content' )
|
||||
{
|
||||
$this->sphinxClient->SetSortMode( SPH_SORT_ATTR_DESC, 'post_date' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->sphinxClient->SetSortMode( SPH_SORT_ATTR_DESC, 'post_date' );
|
||||
$this->sphinxClient->SetGroupBy( 'last_post_group', SPH_GROUPBY_ATTR, '@group desc' );
|
||||
}
|
||||
|
||||
$result = $this->sphinxClient->Query( '', 'forums_search_posts_main,forums_search_posts_delta' );
|
||||
|
||||
$this->logSphinxWarnings();
|
||||
}
|
||||
|
||||
if ( is_array( $result['matches'] ) && count( $result['matches'] ) )
|
||||
{
|
||||
foreach( $result['matches'] as $res )
|
||||
{
|
||||
$search_ids[] = ( IPSSearchRegistry::get('opt.searchTitleOnly') ) ? $res['attrs']['tid'] : $res['attrs']['search_id'];
|
||||
}
|
||||
}
|
||||
|
||||
return array( 'count' => intval( $result['total_found'] ) > 1000 ? 1000 : $result['total_found'], 'resultSet' => $search_ids );
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform the viewNewContent search
|
||||
* Forum Version
|
||||
* Populates $this->_count and $this->_results
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function viewNewContent()
|
||||
{
|
||||
$tids = $this->registry->getClass('classItemMarking')->fetchCookieData( 'forums', 'items' );
|
||||
$oldStamp = $this->registry->getClass('classItemMarking')->fetchOldestUnreadTimestamp( array(), 'forums' );
|
||||
$check = IPS_UNIX_TIME_NOW - ( 86400 * 90 );
|
||||
$forumIdsOk = array();
|
||||
|
||||
/* Loop through the forums and build a list of forums we're allowed access to */
|
||||
$bvnp = explode( ',', $this->settings['vnp_block_forums'] );
|
||||
|
||||
IPSSearchRegistry::set('in.search_sort_by' , 'date' );
|
||||
IPSSearchRegistry::set('in.search_sort_order', 'desc' );
|
||||
IPSSearchRegistry::set('opt.searchTitleOnly' , true );
|
||||
IPSSearchRegistry::set('display.onlyTitles' , true );
|
||||
IPSSearchRegistry::set('opt.noPostPreview' , true );
|
||||
|
||||
/* Get list of good forum IDs */
|
||||
$_forumIdsOk = $this->registry->class_forums->fetchSearchableForumIds( $this->memberData['member_id'], $bvnp );
|
||||
|
||||
if ( ! $this->memberData['bw_vnc_type'] )
|
||||
{
|
||||
$oldStamp = IPSLib::fetchHighestNumber( array( intval( $this->memberData['_cache']['gb_mark__forums'] ), intval( $this->memberData['last_visit'] ) ) );
|
||||
$tids = array();
|
||||
|
||||
$forumIdsOk = $_forumIdsOk;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach( $_forumIdsOk as $id )
|
||||
{
|
||||
$lMarked = $this->registry->getClass('classItemMarking')->fetchTimeLastMarked( array( 'forumID' => $id ), 'forums' );
|
||||
$fData = $this->registry->getClass('class_forums')->forumsFetchData( $id );
|
||||
|
||||
if ( $fData['last_post'] > $lMarked )
|
||||
{
|
||||
/* Add to tids */
|
||||
$_tids = $this->registry->getClass('classItemMarking')->fetchReadIds( array( 'forumID' => $id ), 'forums', false );
|
||||
|
||||
if ( is_array( $_tids ) )
|
||||
{
|
||||
foreach( $_tids as $k => $v )
|
||||
{
|
||||
$tids[ $k ] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
$forumIdsOk[ $id ] = $id;
|
||||
}
|
||||
}
|
||||
|
||||
if ( intval( $this->memberData['_cache']['gb_mark__forums'] ) > 0 )
|
||||
{
|
||||
$oldStamp = $this->memberData['_cache']['gb_mark__forums'];
|
||||
}
|
||||
|
||||
/* Finalize times */
|
||||
if ( ! $oldStamp OR $oldStamp == IPS_UNIX_TIME_NOW )
|
||||
{
|
||||
$oldStamp = intval( $this->memberData['last_visit'] );
|
||||
}
|
||||
|
||||
/* Older than 3 months.. then limit */
|
||||
if ( $oldStamp < $check )
|
||||
{
|
||||
$oldStamp = $check;
|
||||
}
|
||||
|
||||
/* If no forums, we're done */
|
||||
if ( ! count( $forumIdsOk ) )
|
||||
{
|
||||
/* Return it */
|
||||
return array( 'count' => 0, 'resultSet' => array() );
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the timestamps */
|
||||
$this->sphinxClient->SetFilterRange( 'last_post', $oldStamp, time() );
|
||||
$this->setDateRange( 0, 0 );
|
||||
|
||||
/* Force it into filter so that search can pick it up */
|
||||
ipsRegistry::$request['search_app_filters']['forums']['forums'] = $forumIdsOk;
|
||||
|
||||
/* Try and limit the TIDS */
|
||||
if ( is_array( $tids ) AND count( $tids ) )
|
||||
{
|
||||
if ( count( $tids ) > 300 )
|
||||
{
|
||||
/* Sort by last read date */
|
||||
arsort( $tids, SORT_NUMERIC );
|
||||
$tids = array_slice( $tids, 0, 300 );
|
||||
}
|
||||
|
||||
$this->DB->build( array( 'select' => 'tid, last_post',
|
||||
'from' => 'topics',
|
||||
'where' => "tid IN (" . implode( ",", array_keys( $tids ) ) . ')' ) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
/* Posted in since last read? */
|
||||
if ( $row['last_post'] > $tids[ $row['tid'] ] )
|
||||
{
|
||||
unset( $tids[ $row['tid'] ] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( count( $tids ) )
|
||||
{
|
||||
$tids = array_keys( $tids );
|
||||
}
|
||||
}
|
||||
|
||||
/* Set read tids */
|
||||
if ( count( $tids ) )
|
||||
{
|
||||
$this->sphinxClient->SetFilter( 'tid', $tids, TRUE );
|
||||
}
|
||||
|
||||
/* Set up some vars */
|
||||
IPSSearchRegistry::set('set.resultCutToDate', $oldStamp );
|
||||
|
||||
return $this->search();
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform the search
|
||||
* Populates $this->_count and $this->_results
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function viewActiveContent()
|
||||
{
|
||||
$seconds = IPSSearchRegistry::get('in.period_in_seconds');
|
||||
|
||||
/* Loop through the forums and build a list of forums we're allowed access to */
|
||||
$bvnp = explode( ',', $this->settings['vnp_block_forums'] );
|
||||
|
||||
IPSSearchRegistry::set('in.search_sort_by' , 'date' );
|
||||
IPSSearchRegistry::set('in.search_sort_order', 'desc' );
|
||||
IPSSearchRegistry::set('opt.searchTitleOnly' , true );
|
||||
IPSSearchRegistry::set('display.onlyTitles' , true );
|
||||
IPSSearchRegistry::set('opt.noPostPreview' , true );
|
||||
|
||||
/* Get list of good forum IDs */
|
||||
$forumIdsOk = $this->registry->class_forums->fetchSearchableForumIds( $this->memberData['member_id'], $bvnp );
|
||||
|
||||
/* Force it into filter so that search can pick it up */
|
||||
ipsRegistry::$request['search_app_filters']['forums']['forums'] = $forumIdsOk;
|
||||
|
||||
/* Set the timestamps */
|
||||
$this->sphinxClient->SetFilterRange( 'last_post', intval( time() - $seconds ), time() );
|
||||
$this->setDateRange( 0, 0 );
|
||||
|
||||
return $this->search();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remap standard columns (Apps can override )
|
||||
*
|
||||
* @param string $column sql table column for this condition
|
||||
* @return string column
|
||||
* @return void
|
||||
*/
|
||||
public function remapColumn( $column )
|
||||
{
|
||||
$column = $column == 'member_id' ? ( IPSSearchRegistry::get('opt.searchTitleOnly') ? 'starter_id' : 'author_id' ) : $column;
|
||||
$column = $column == 'content_title' ? 'title' : $column;
|
||||
$column = $column == 'type_id' ? 'forum_id' : $column;
|
||||
|
||||
return $column;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array used in the searchplugin's setCondition method
|
||||
*
|
||||
* @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 )
|
||||
{
|
||||
/* INIT */
|
||||
$return = array();
|
||||
|
||||
/* Set up some defaults */
|
||||
IPSSearchRegistry::set( 'opt.noPostPreview' , true );
|
||||
IPSSearchRegistry::set( 'opt.onlySearchPosts', false );
|
||||
|
||||
if( isset( $data ) && is_array( $data ) && count( $data ) )
|
||||
{
|
||||
foreach( $data as $field => $_data )
|
||||
{
|
||||
/* CONTENT ONLY */
|
||||
if ( $field == 'noPreview' AND $_data['noPreview'] == 0 )
|
||||
{
|
||||
IPSSearchRegistry::set( 'opt.noPostPreview', false );
|
||||
}
|
||||
|
||||
/* CONTENT ONLY */
|
||||
if ( $field == 'contentOnly' AND $_data['contentOnly'] == 1 )
|
||||
{
|
||||
IPSSearchRegistry::set( 'opt.onlySearchPosts', true );
|
||||
}
|
||||
|
||||
/* POST COUNT */
|
||||
if ( $field == 'pCount' AND intval( $_data['pCount'] ) > 0 )
|
||||
{
|
||||
IPSSearchRegistry::set( 'opt.pCount', intval( $_data['pCount'] ) );
|
||||
}
|
||||
|
||||
/* TOPIC VIEWS */
|
||||
if ( $field == 'pViews' AND intval( $_data ) > 0 )
|
||||
{
|
||||
IPSSearchRegistry::set( 'opt.pViews', intval( $_data['pViews'] ) );
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* Returns HTML for the form (optional class, not required)
|
||||
* Last Updated: $Date: 2010-02-19 01:29:54 +0000 (Fri, 19 Feb 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $author$
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 5855 $
|
||||
*/
|
||||
|
||||
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 search_form_forums
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
/* Make object */
|
||||
$this->registry = ipsRegistry::instance();
|
||||
$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();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return sort drop down
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function fetchSortDropDown()
|
||||
{
|
||||
$array = array( 'date' => $this->lang->words['s_search_type_0'],
|
||||
'title' => $this->lang->words['forum_sort_title'],
|
||||
'posts' => $this->lang->words['forum_sort_posts'],
|
||||
'views' => $this->lang->words['forum_sort_views'] );
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retuns the html for displaying the forum category filter on the advanced search page
|
||||
*
|
||||
* @return string Filter HTML
|
||||
*/
|
||||
public function getHtml()
|
||||
{
|
||||
/* Make sure class_forums is setup */
|
||||
if( ipsRegistry::isClassLoaded('class_forums') !== TRUE )
|
||||
{
|
||||
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums' );
|
||||
ipsRegistry::setClass( 'class_forums', new $classToLoad( ipsRegistry::instance() ) );
|
||||
}
|
||||
|
||||
ipsRegistry::getClass('class_forums')->strip_invisible = 1;
|
||||
ipsRegistry::getClass('class_forums')->forumsInit();
|
||||
|
||||
return array( 'title' => ipsRegistry::$applications['forums']['app_public_title'], 'html' => ipsRegistry::getClass( 'output' )->getTemplate( 'search' )->forumAdvancedSearchFilters( ipsRegistry::getClass( 'class_forums' )->buildForumJump( 0, 1 ) ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,563 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* Formats forum search results
|
||||
* Last Updated: $Date: 2010-02-19 01:29:54 +0000 (Fri, 19 Feb 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $author$
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 5855 $
|
||||
*/
|
||||
|
||||
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 search_format_forums extends search_format
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry )
|
||||
{
|
||||
/* Get class forums, used for displaying forum names on results */
|
||||
if ( ipsRegistry::isClassLoaded('class_forums') !== TRUE )
|
||||
{
|
||||
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums' );
|
||||
ipsRegistry::setClass( 'class_forums', new $classToLoad( ipsRegistry::instance() ) );
|
||||
ipsRegistry::getClass('class_forums')->forumsInit();
|
||||
}
|
||||
|
||||
parent::__construct( $registry );
|
||||
|
||||
/* Set up wrapper */
|
||||
$this->templates = array( 'group' => 'search', 'template' => 'searchResultsAsForum' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse search results
|
||||
*
|
||||
* @param array $r Search result
|
||||
* @return array $html Blocks of HTML
|
||||
*/
|
||||
public function parseAndFetchHtmlBlocks( $rows )
|
||||
{
|
||||
/* Forum stuff */
|
||||
$sub = false;
|
||||
$isVnc = false;
|
||||
$search_term = IPSSearchRegistry::get('in.clean_search_term');
|
||||
$onlyPosts = IPSSearchRegistry::get('opt.onlySearchPosts');
|
||||
$onlyTitles = IPSSearchRegistry::get('display.onlyTitles');
|
||||
$noPostPreview = IPSSearchRegistry::get('opt.noPostPreview');
|
||||
$results = array();
|
||||
$attachPids = array();
|
||||
$results = array();
|
||||
|
||||
/* loop and process */
|
||||
foreach( $rows as $id => $data )
|
||||
{
|
||||
/* Reset */
|
||||
$pages = 0;
|
||||
|
||||
/* Set up forum */
|
||||
$forum = $this->registry->getClass('class_forums')->forum_by_id[ $data['forum_id'] ];
|
||||
|
||||
$this->last_topic = $data['tid'];
|
||||
|
||||
/* Various data */
|
||||
$data['_last_post'] = $data['last_post'];
|
||||
$data['_longTitle'] = $data['content_title'];
|
||||
$data['_shortTitle'] = IPSText::truncate( $data['content_title'], 60 );
|
||||
$data['last_poster'] = $data['last_poster_id'] ? IPSLib::makeProfileLink( $data['last_poster_name'], $data['last_poster_id'], $data['seo_last_name'] ) : $this->settings['guest_name_pre'] . $data['last_poster_name'] . $this->settings['guest_name_suf'];
|
||||
$data['starter'] = $data['starter_id'] ? IPSLib::makeProfileLink( $data['starter_name'], $data['starter_id'], $data['seo_first_name'] ) : $this->settings['guest_name_pre'] . $data['starter_name'] . $this->settings['guest_name_suf'];
|
||||
$data['last_post'] = $this->registry->getClass( 'class_localization')->getDate( $data['last_post'], 'SHORT' );
|
||||
|
||||
if ( isset( $data['post_date'] ) )
|
||||
{
|
||||
$data['_post_date'] = $data['post_date'];
|
||||
$data['post_date'] = $this->registry->getClass( 'class_localization')->getDate( $data['post_date'], 'SHORT' );
|
||||
}
|
||||
|
||||
if ( $this->memberData['is_mod'] )
|
||||
{
|
||||
$data['posts'] += intval($data['topic_queuedposts']);
|
||||
}
|
||||
|
||||
if ( $data['posts'])
|
||||
{
|
||||
if ( (($data['posts'] + 1) % $this->settings['display_max_posts']) == 0 )
|
||||
{
|
||||
$pages = ($data['posts'] + 1) / $this->settings['display_max_posts'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$number = ( ($data['posts'] + 1) / $this->settings['display_max_posts'] );
|
||||
$pages = ceil( $number);
|
||||
}
|
||||
}
|
||||
|
||||
if ( $pages > 1 )
|
||||
{
|
||||
for ( $i = 0 ; $i < $pages ; ++$i )
|
||||
{
|
||||
$real_no = $i * $this->settings['display_max_posts'];
|
||||
$page_no = $i + 1;
|
||||
|
||||
if ( $page_no == 4 and $pages > 4 )
|
||||
{
|
||||
$data['pages'][] = array( 'last' => 1,
|
||||
'st' => ($pages - 1) * $this->settings['display_max_posts'],
|
||||
'page' => $pages );
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['pages'][] = array( 'last' => 0,
|
||||
'st' => $real_no,
|
||||
'page' => $page_no );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* For-matt some stuffs */
|
||||
if ( ! $data['cache_content'] )
|
||||
{
|
||||
IPSText::getTextClass( 'bbcode' )->parse_smilies = $data['use_emo'];
|
||||
IPSText::getTextClass( 'bbcode' )->parse_html = ( $forum['use_html'] and $this->caches['group_cache'][ $data['member_group_id'] ]['g_dohtml'] and $data['post_htmlstate'] ) ? 1 : 0;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_nl2br = $data['post_htmlstate'] == 2 ? 1 : 0;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_bbcode = $forum['use_ibc'];
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_section = 'topics';
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $data['member_group_id'];
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $data['mgroup_others'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['post'] = '<!--cached-' . gmdate( 'r', $data['cache_updated'] ) . '-->' . $data['cache_content'];
|
||||
}
|
||||
|
||||
$data['post'] = IPSText::searchHighlight( IPSText::getTextClass( 'bbcode' )->preDisplayParse( $data['post'] ), $search_term );
|
||||
|
||||
/* Has attachments */
|
||||
if ( $data['topic_hasattach'] )
|
||||
{
|
||||
$attachPids[ $data['pid'] ] = $data['post'];
|
||||
}
|
||||
|
||||
$rows[ $id ] = $data;
|
||||
}
|
||||
|
||||
/* Attachments */
|
||||
if ( count( $attachPids ) )
|
||||
{
|
||||
/* Load attachments class */
|
||||
if ( ! is_object( $this->class_attach ) )
|
||||
{
|
||||
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'core' ) . '/sources/classes/attach/class_attach.php', 'class_attach' );
|
||||
$this->class_attach = new $classToLoad( $this->registry );
|
||||
$this->class_attach->type = 'post';
|
||||
$this->class_attach->init();
|
||||
}
|
||||
|
||||
$attachHTML = $this->class_attach->renderAttachments( array( $data['pid'] => $data['post'] ), array_keys( $attachPids ) );
|
||||
|
||||
/* Now parse back in the rendered posts */
|
||||
if( is_array($attachHTML) AND count($attachHTML) )
|
||||
{
|
||||
foreach( $attachHTML as $id => $_data )
|
||||
{
|
||||
/* Get rid of any lingering attachment tags */
|
||||
if ( stristr( $_data['html'], "[attachment=" ) )
|
||||
{
|
||||
$_data['html'] = IPSText::stripAttachTag( $_data['html'] );
|
||||
}
|
||||
|
||||
$rows[ $id ]['post'] = $_data['html'];
|
||||
$rows[ $id ]['attachmentHtml'] = $_data['attachmentHtml'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Go through and build HTML */
|
||||
foreach( $rows as $id => $data )
|
||||
{
|
||||
/* Format content */
|
||||
list( $html, $sub ) = $this->formatContent( $data );
|
||||
|
||||
$results[ $id ] = array( 'html' => $html, 'app' => $data['app'], 'type' => $data['type'], 'sub' => $sub );
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the forum search result for display
|
||||
*
|
||||
* @param array $search_row Array of data
|
||||
* @return mixed Formatted content, ready for display, or array containing a $sub section flag, and content
|
||||
*/
|
||||
public function formatContent( $data )
|
||||
{
|
||||
$onlyPosts = IPSSearchRegistry::get('opt.onlySearchPosts');
|
||||
$onlyTitles = IPSSearchRegistry::get('display.onlyTitles');
|
||||
$noPostPreview = IPSSearchRegistry::get('opt.noPostPreview');
|
||||
|
||||
/* Forum Breadcrum */
|
||||
$data['_forum_trail'] = $this->registry->getClass( 'class_forums' )->forumsBreadcrumbNav( $data['forum_id'] );
|
||||
|
||||
/* Is it read? We don't support last_vote in search. */
|
||||
$is_read = $this->registry->getClass( 'classItemMarking' )->isRead( array( 'forumID' => $data['forum_id'], 'itemID' => $data['tid'], 'itemLastUpdate' => $data['lastupdate'] ? $data['lastupdate'] : $data['updated'] ), 'forums' );
|
||||
|
||||
/* Has posted dot */
|
||||
$show_dots = ( $this->settings['show_user_posted'] AND $this->memberData['member_id'] AND $data['_hasPosted'] ) ? 1 : 0;
|
||||
|
||||
/* Icon */
|
||||
$data['_icon'] = $this->registry->getClass( 'class_forums' )->fetchTopicFolderIcon( $data, $show_dots, $is_read );
|
||||
$data['_isRead'] = $is_read;
|
||||
|
||||
/* Display type */
|
||||
return array( $this->registry->getClass( 'output' )->getTemplate( 'search' )->topicPostSearchResultAsForum( $data, ( $onlyTitles || $noPostPreview ) ? 1 : 0 ), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats / grabs extra data for results
|
||||
* Takes an array of IDS (can be IDs from anything) and returns an array of expanded data.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function processResults( $ids )
|
||||
{
|
||||
/* INIT */
|
||||
$sort_by = IPSSearchRegistry::get('in.search_sort_by');
|
||||
$sort_order = IPSSearchRegistry::get('in.search_sort_order');
|
||||
$search_term = IPSSearchRegistry::get('in.clean_search_term');
|
||||
$content_title_only = IPSSearchRegistry::get('opt.searchTitleOnly');
|
||||
$onlyPosts = IPSSearchRegistry::get('opt.onlySearchPosts');
|
||||
$order_dir = ( $sort_order == 'asc' ) ? 'asc' : 'desc';
|
||||
$_post_joins = array();
|
||||
$members = array();
|
||||
$results = array();
|
||||
$topicIds = array();
|
||||
$dots = array();
|
||||
$sortKey = '';
|
||||
$sortType = '';
|
||||
$_sdTids = array();
|
||||
$_sdPids = array();
|
||||
|
||||
/* Set up some basic permissions */
|
||||
$permissions['PostSoftDeleteSee'] = $this->registry->getClass('class_forums')->canSeeSoftDeletedPosts( 0 );
|
||||
$permissions['TopicSoftDeleteSee'] = $this->registry->getClass('class_forums')->canSeeSoftDeletedTopics( 0 );
|
||||
$permissions['canQueue'] = $this->registry->getClass('class_forums')->canQueuePosts( 0 );
|
||||
$permissions['SoftDeleteReason'] = $this->registry->getClass('class_forums')->canSeeSoftDeleteReason( 0 );
|
||||
$permissions['SoftDeleteContent'] = $this->registry->getClass('class_forums')->canSeeSoftDeleteContent( 0 );
|
||||
$permissions['PostSoftDeleteRestore'] = $this->registry->getClass('class_forums')->can_Un_SoftDeletePosts( 0 );
|
||||
$permissions['TopicSoftDeleteRestore'] = $this->registry->getClass('class_forums')->can_Un_SoftDeleteTopics( 0 );
|
||||
|
||||
/* Got some? */
|
||||
if ( count( $ids ) )
|
||||
{
|
||||
/* Cache? */
|
||||
if ( IPSContentCache::isEnabled() )
|
||||
{
|
||||
if ( IPSContentCache::fetchSettingValue('post') )
|
||||
{
|
||||
$_post_joins[] = IPSContentCache::join( 'post', 'p.pid' );
|
||||
}
|
||||
|
||||
if ( IPSContentCache::fetchSettingValue('sig') )
|
||||
{
|
||||
$_post_joins[] = IPSContentCache::join( 'sig' , 'p.author_id', 'ccb', 'left', 'ccb.cache_content as cache_content_sig, ccb.cache_updated as cache_updated_sig' );
|
||||
}
|
||||
}
|
||||
|
||||
/* Sorting */
|
||||
switch( $sort_by )
|
||||
{
|
||||
default:
|
||||
case 'date':
|
||||
$sortKey = ( $content_title_only ) ? 'last_post' : 'post_date';
|
||||
$sortType = 'numerical';
|
||||
break;
|
||||
case 'title':
|
||||
$sortKey = 'title';
|
||||
$sortType = 'string';
|
||||
break;
|
||||
case 'posts':
|
||||
$sortKey = 'posts';
|
||||
$sortType = 'numerical';
|
||||
break;
|
||||
case 'views':
|
||||
$sortKey = 'views';
|
||||
$sortType = 'numerical';
|
||||
break;
|
||||
}
|
||||
|
||||
/* Set vars */
|
||||
IPSSearch::$ask = $sortKey;
|
||||
IPSSearch::$aso = strtolower( $order_dir );
|
||||
IPSSearch::$ast = $sortType;
|
||||
|
||||
/* If we are search in titles only, then the ID array will be TIDs */
|
||||
if( $content_title_only )
|
||||
{
|
||||
$k = 'tid';
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => "t.*",
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.tid IN( ' . implode( ',', $ids ) . ')',
|
||||
'add_join' => array_merge( array( array( 'select' => 'p.*',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'p.pid=t.topic_firstpost',
|
||||
'type' => 'left' ),
|
||||
array( 'select' => 'm.member_id, m.members_display_name, m.members_seo_name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=p.author_id',
|
||||
'type' => 'left' ) ), $_post_joins ) ) );
|
||||
}
|
||||
/* Otherwise, it's PIDs */
|
||||
else
|
||||
{
|
||||
$k = 'pid';
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => "p.*",
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'p.pid IN( ' . implode( ',', $ids ) . ')',
|
||||
'add_join' => array_merge( array( array( 'select' => 't.*',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.tid=p.topic_id',
|
||||
'type' => 'left' ),
|
||||
array( 'select' => 'm.member_id, m.members_display_name, m.members_seo_name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=p.author_id',
|
||||
'type' => 'left' ) ), $_post_joins ) ) );
|
||||
|
||||
}
|
||||
|
||||
/* Grab data */
|
||||
$this->DB->execute();
|
||||
|
||||
/* Grab the results */
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
$_rows[ $row[ $k ] ] = $row;
|
||||
}
|
||||
|
||||
/* Sort */
|
||||
if ( count( $_rows ) )
|
||||
{
|
||||
usort( $_rows, array("IPSSearch", "usort") );
|
||||
|
||||
foreach( $_rows as $id => $row )
|
||||
{
|
||||
/* Prevent member from stepping on it */
|
||||
$row['topic_title'] = $row['title'];
|
||||
|
||||
/* Got author but no member data? */
|
||||
if ( ! empty( $row['author_id'] ) )
|
||||
{
|
||||
$members[ $row['author_id'] ] = $row['author_id'];
|
||||
}
|
||||
|
||||
/* Topic ids? */
|
||||
if ( ! empty( $row['topic_id'] ) )
|
||||
{
|
||||
$topicIds[ $row['topic_id'] ] = $row['topic_id'];
|
||||
}
|
||||
|
||||
/* If we're using sphinx, check forum permissions again as the 15 minute delta rebuild could expose a moved topic before deltas rebuild.
|
||||
We don't need to do this for SQL search as the results are delivered live and lets face it, we can do without the load */
|
||||
if ( $this->settings['search_method'] != 'traditional' )
|
||||
{
|
||||
/* Can we read? */
|
||||
if ( ! $this->registry->permissions->check( 'view', $this->registry->class_forums->forum_by_id[ $row['forum_id'] ] ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Can read, but is it password protected, etc? */
|
||||
if ( ! $this->registry->class_forums->forumsCheckAccess( $row['forum_id'], 0, 'forum', array(), true ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$row['cleanSearchTerm'] = urlencode($search_term);
|
||||
$row['topicPrefix'] = $row['pinned'] ? $this->registry->getClass('output')->getTemplate('forum')->topicPrefixWrap( $this->settings['pre_pinned'] ) : '';
|
||||
|
||||
$row['_isVisible'] = ( $this->registry->getClass('class_forums')->fetchHiddenTopicType( $row ) == 'visible' ) ? true : false;
|
||||
$row['_isHidden'] = ( $this->registry->getClass('class_forums')->fetchHiddenTopicType( $row ) == 'hidden' ) ? true : false;
|
||||
$row['_isDeleted'] = ( $this->registry->getClass('class_forums')->fetchHiddenTopicType( $row ) == 'sdelete' ) ? true : false;
|
||||
|
||||
$row['_p_isVisible'] = ( $this->registry->getClass('class_forums')->fetchHiddenType( $row ) == 'visible' ) ? true : false;
|
||||
$row['_p_isHidden'] = ( $this->registry->getClass('class_forums')->fetchHiddenType( $row ) == 'hidden' ) ? true : false;
|
||||
$row['_p_isDeleted'] = ( $this->registry->getClass('class_forums')->fetchHiddenType( $row ) == 'sdelete' ) ? true : false;
|
||||
|
||||
/* Hidden and we do not have permission? */
|
||||
if ( $row['_isHidden'] AND ! $permissions['canQueue'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Is the topic deleted? If so, then the first post will appear as such */
|
||||
if ( $row['_isDeleted'] AND $permissions['TopicSoftDeleteSee'] )
|
||||
{
|
||||
$row['_p_isDeleted'] = true;
|
||||
$_sdPids[ $row['pid'] ] = $row['pid'];
|
||||
}
|
||||
|
||||
/* Collect TIDS of soft deleted topics */
|
||||
if ( $row['_isDeleted'] )
|
||||
{
|
||||
if ( $permissions['TopicSoftDeleteSee'] )
|
||||
{
|
||||
$_sdTids[ $row['tid'] ] = $row['tid'];
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* Collect TIDS of soft deleted topics */
|
||||
if ( $row['_p_isDeleted'] )
|
||||
{
|
||||
if ( $permissions['PostSoftDeleteSee'] )
|
||||
{
|
||||
$_sdPids[ $row['pid'] ] = $row['pid'];
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$results[ $row['pid'] ] = $this->genericizeResults( $row );
|
||||
}
|
||||
}
|
||||
|
||||
/* Need to load members? */
|
||||
if ( count( $members ) )
|
||||
{
|
||||
$mems = IPSMember::load( $members, 'all' );
|
||||
|
||||
foreach( $results as $id => $r )
|
||||
{
|
||||
if ( ! empty( $r['author_id'] ) AND isset( $mems[ $r['author_id'] ] ) )
|
||||
{
|
||||
$mems[ $r['author_id'] ]['m_posts'] = $mems[ $r['author_id'] ]['posts'];
|
||||
//unset( $mems[ $r['author_id'] ]['posts'] );
|
||||
unset( $mems[ $r['author_id'] ]['last_post'] );
|
||||
|
||||
if ( isset( $r['cache_content_sig'] ) )
|
||||
{
|
||||
$mems[ $r['author_id'] ]['cache_content'] = $r['cache_content_sig'];
|
||||
$mems[ $r['author_id'] ]['cache_updated'] = $r['cache_updated_sig'];
|
||||
}
|
||||
|
||||
$_mem = IPSMember::buildDisplayData( $mems[ $r['author_id'] ], array( 'signature' => 1 ) );
|
||||
|
||||
unset( $_mem['cache_content'], $_mem['cache_updated'] );
|
||||
|
||||
$results[ $id ]['_realPosts'] = $results[ $id ]['posts'];
|
||||
$results[ $id ] = array_merge( $results[ $id ], $_mem );
|
||||
$results[ $id ]['posts'] = $results[ $id ]['_realPosts'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Generate 'dot' folder icon */
|
||||
if ( $this->settings['show_user_posted'] AND count( $topicIds ) )
|
||||
{
|
||||
$this->DB->build( array( 'select' => 'author_id, topic_id',
|
||||
'from' => 'posts',
|
||||
'where' => 'queued=0 AND author_id=' . $this->memberData['member_id'] . ' AND topic_id IN(' . implode( ',', $topicIds ) . ')' ) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
while( $p = $this->DB->fetch() )
|
||||
{
|
||||
$dots[ $p['topic_id'] ] = 1;
|
||||
}
|
||||
|
||||
/* Merge into results */
|
||||
foreach( $results as $id => $r )
|
||||
{
|
||||
if ( isset( $dots[ $r['topic_id'] ] ) )
|
||||
{
|
||||
$results[ $id ]['_hasPosted'] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Got any deleted items */
|
||||
if ( count( $_sdTids ) )
|
||||
{
|
||||
$sData = IPSDeleteLog::fetchEntries( $_sdTids, 'topic', false );
|
||||
|
||||
if ( count( $sData ) )
|
||||
{
|
||||
foreach( $results as $id => $data )
|
||||
{
|
||||
if ( isset( $_sdTids[ $data['tid'] ] ) )
|
||||
{
|
||||
$results[ $id ]['sData'] = $sData[ $data['tid'] ];
|
||||
$results[ $id ]['permissions'] = $permissions;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Got any deleted items */
|
||||
if ( count( $_sdPids ) )
|
||||
{
|
||||
$sData = IPSDeleteLog::fetchEntries( $_sdPids, 'post', false );
|
||||
|
||||
if ( count( $sData ) )
|
||||
{
|
||||
foreach( $results as $id => $data )
|
||||
{
|
||||
if ( isset( $_sdPids[ $data['pid'] ] ) AND ! isset( $results[ $id ]['sData']) )
|
||||
{
|
||||
$results[ $id ]['sData'] = $sData[ $data['pid'] ];
|
||||
$results[ $id ]['permissions'] = $permissions;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reassigns fields in a generic way for results output
|
||||
*
|
||||
* @param array $r
|
||||
* @return array
|
||||
*/
|
||||
public function genericizeResults( $r )
|
||||
{
|
||||
$r['app'] = 'forums';
|
||||
$r['content'] = $r['post'];
|
||||
$r['content_title'] = $r['title'];
|
||||
$r['updated'] = $r['post_date'];
|
||||
$r['lastupdate'] = $r['last_post'];
|
||||
$r['type_2'] = 'topic';
|
||||
$r['type_id_2'] = $r['tid'];
|
||||
$r['misc'] = $r['pid'];
|
||||
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<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>
|
||||
@@ -1,399 +0,0 @@
|
||||
<?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
@@ -1,171 +1,104 @@
|
||||
<?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;
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* Sphinx template file
|
||||
* Last Updated: $Date: 2010-10-28 12:07:41 -0400 (Thu, 28 Oct 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: mmecham $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 7063 $
|
||||
* @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.title, t.title as tordinal, t.views, t.posts, t.forum_id, t.last_post, t.state, t.start_date, t.starter_id, t.last_poster_id, t.topic_firstpost, \
|
||||
CASE WHEN t.approved = -1 THEN 1 ELSE 0 END AS soft_deleted, \
|
||||
CASE WHEN t.approved = -1 THEN 0 ELSE t.approved END AS approved, \
|
||||
CONCAT(t.last_post, '.', t.tid ) as last_post_group \
|
||||
FROM <!--SPHINX_DB_PREFIX-->posts p \
|
||||
LEFT JOIN <!--SPHINX_DB_PREFIX-->topics t ON ( p.topic_id=t.tid )
|
||||
|
||||
# Fields
|
||||
sql_attr_uint = queued
|
||||
sql_attr_uint = approved
|
||||
sql_attr_uint = soft_deleted
|
||||
sql_attr_uint = search_id
|
||||
sql_attr_uint = forum_id
|
||||
sql_attr_timestamp = post_date
|
||||
sql_attr_timestamp = last_post
|
||||
sql_attr_timestamp = start_date
|
||||
sql_attr_uint = author_id
|
||||
sql_attr_uint = starter_id
|
||||
sql_attr_uint = tid
|
||||
sql_attr_uint = posts
|
||||
sql_attr_uint = views
|
||||
sql_attr_str2ordinal = tordinal
|
||||
sql_attr_str2ordinal = last_post_group
|
||||
|
||||
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.title, t.title as tordinal, t.views, t.posts, t.forum_id, t.last_post, t.state, t.start_date, t.starter_id, t.last_poster_id, t.topic_firstpost, \
|
||||
CASE WHEN t.approved = -1 THEN 1 ELSE 0 END AS soft_deleted, \
|
||||
CASE WHEN t.approved = -1 THEN 0 ELSE t.approved END AS approved, \
|
||||
CONCAT(t.last_post, '.', t.tid ) as last_post_group \
|
||||
FROM <!--SPHINX_DB_PREFIX-->posts p \
|
||||
LEFT JOIN <!--SPHINX_DB_PREFIX-->topics t ON ( p.topic_id=t.tid ) \
|
||||
WHERE p.pid > ( SELECT cs_value FROM <!--SPHINX_DB_PREFIX-->cache_store WHERE cs_key='sphinx_forums_counter_posts' )
|
||||
}
|
||||
|
||||
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
|
||||
#infix_fields = post, title
|
||||
#min_infix_len = 3
|
||||
#enable_star = 1
|
||||
}
|
||||
|
||||
index forums_search_posts_delta : forums_search_posts_main
|
||||
{
|
||||
source = forums_search_posts_delta
|
||||
path = <!--SPHINX_BASE_PATH-->/forums_search_posts_delta
|
||||
}
|
||||
|
||||
|
||||
EOF;
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user