Version 3.4.5

This commit is contained in:
Neo committed 2025-12-19 00:38:12 -08:00
1 parent fb6b5baabc
commit e4478369d8
1360 files changed
+228921 -179445

No files matched your search

@@ -2,9 +2,9 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Grab attachments and return via AJAX (AJAX)
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
@@ -13,7 +13,7 @@
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Revision: 10914 $
* @version $Revision: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -7,7 +7,7 @@
* $Author: ips_terabyte $
* @since 14th May 2003
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
* @version v3.3.4
* @version v3.4.5
* $Revision: 8655 $
*/
@@ -2,9 +2,9 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Ourputs emoticon list via AJAX (AJAX)
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
@@ -13,7 +13,7 @@
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 10914 $
* @version $Rev: 10721 $
*
*/
@@ -2,9 +2,9 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Fetch topics and other data from the forum
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $Date: 2012-08-28 17:56:22 -0400 (Tue, 28 Aug 2012) $
* </pre>
*
* @author $Author: bfarber $
@@ -13,7 +13,7 @@
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Revision: 10914 $
* @version $Revision: 11296 $
*
*/
@@ -96,10 +96,7 @@ class public_forums_ajax_forums extends ipsAjaxCommand
$html .= $this->registry->output->getTemplate('forum')->topic( $tdata, $data['other_data']['forum_data'], $data['other_data'], 1 );
}
}
$html = $this->cleanOutput( $this->parseAndCleanHooks( $html ) );
$pages = $this->parseAndCleanHooks( $data['other_data']['forum_data']['SHOW_PAGES'] );
$this->returnJsonArray( array( 'topics' => $html, 'pages' => $pages, 'hasMore' => $data['other_data']['hasMore'] ) );
$this->returnJsonArray( array( 'topics' => $html, 'pages' => $data['other_data']['forum_data']['SHOW_PAGES'], 'hasMore' => $data['other_data']['hasMore'] ), true );
}
}
@@ -3,9 +3,9 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Ajax Functions For Topics
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
@@ -14,7 +14,7 @@
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Revision: 10914 $
* @version $Revision: 10721 $
*
*/
@@ -2,9 +2,9 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Retrieve who posted stats
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
@@ -13,7 +13,7 @@
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Revision: 10914 $
* @version $Revision: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,153 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.4.5
* QA system methods (Matt mecham)
* Last Updated: $Date: 2012-08-28 22:56:22 +0100 (Tue, 28 Aug 2012) $
* </pre>
*
* @author $Author: matt $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @since 20th February 2002
* @version $Revision: 11296 $
*
*/
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 public_forums_extras_answer extends ipsCommand
{
private $_topicData = array();
private $_postData = array();
private $_forumData = array();
/**
* Class entry point
*
* @param object Registry reference
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
/* Security Check */
if ( $this->request['auth_key'] != $this->member->form_hash )
{
$this->registry->output->showError( 'no_permission', 'extra_answer_001', null, null, 403 );
}
/* Init */
if ( ! $this->registry->isClassLoaded('topics') )
{
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . "/sources/classes/topics.php", 'app_forums_classes_topics', 'forums' );
$this->registry->setClass( 'topics', new $classToLoad( $this->registry ) );
}
/* Language file */
$this->registry->class_localization->loadLanguageFile( array( 'public_topic' ) );
/* Get data */
$tid = intval( $this->request['t'] );
$pid = intval( $this->request['pid'] );
/* Quick check */
if ( ! $tid || ! $pid )
{
$this->registry->output->showError( 'no_permission', 'extra_answer_002', null, null, 404 );
}
/* Get topic */
$this->_topicData = $this->registry->topics->getTopicById( $tid );
$this->_postData = $this->registry->topics->getPostById( $pid );
$this->_forumData = $this->registry->class_forums->getForumById( $this->_topicData['forum_id'] );
/* Another check */
if ( ! $this->_topicData['tid'] || ! $this->_postData['pid'] )
{
$this->registry->output->showError( 'no_permission', 'extra_answer_003', null, null, 404 );
}
/* We being silly? */
if ( $this->_postData['topic_id'] != $tid )
{
$this->registry->output->showError( 'no_permission', 'extra_answer_004', null, null, 403 );
}
/* Have permission to see this topic? */
if ( ! $this->registry->topics->canView( $this->_topicData ) )
{
$this->registry->output->showError( 'no_permission', 'extra_answer_005', null, null, 403 );
}
/* Locked? */
if ( ! $this->memberData['g_is_supmod'] )
{
if ( $this->_topicData['state'] != 'open' )
{
$this->registry->output->showError( 'topic_locked', 'extra_answer_006', true, null, 403 );
}
}
/* What to do? */
switch( $this->request['do'] )
{
default:
case 'answer':
$this->_answer();
break;
case 'unanswer':
$this->_unanswer();
break;
}
}
/**
* Mark post as answered
*
* @return @e void
*/
protected function _unanswer()
{
/* Mark as read */
try
{
$this->registry->topics->unAnswerTopicSingle( $this->_postData, $this->_topicData );
}
catch( Exception $ex )
{
$this->registry->output->showError( 'no_permission', 'extra_answer_unanswer_001', null, null, 403 );
}
$this->registry->output->silentRedirect( $this->settings['base_url'] . "showtopic=".$this->_topicData['tid'] . "&view=findpost&p=" . $this->_postData['pid'] );
}
/**
* Mark post as answered
*
* @return @e void
*/
protected function _answer()
{
/* Mark as read */
try
{
$this->registry->topics->answerTopicSingle( $this->_postData, $this->_topicData );
}
catch( Exception $ex )
{
$this->registry->output->showError( 'no_permission', 'extra_answer_answer_001', null, null, 403 );
}
$this->registry->output->silentRedirect( $this->settings['base_url'] . "showtopic=".$this->_topicData['tid'] . "&view=findpost&p=" . $this->_postData['pid'] );
}
}
@@ -2,9 +2,9 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Board Rules
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $Date: 2012-10-10 17:49:08 -0400 (Wed, 10 Oct 2012) $
* </pre>
*
* @author $Author $
@@ -14,7 +14,7 @@
* @subpackage Forums
* @link http://www.invisionpower.com
* @since 20th February 2002
* @version $Rev: 10914 $
* @version $Rev: 11440 $
*/
if ( ! defined( 'IN_IPB' ) )
{
@@ -31,19 +31,17 @@ class public_forums_extras_boardrules extends ipsCommand
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
/* Load editor stuff */
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite' );
$editor = new $classToLoad();
{
/* Get board rule (not cached) */
$row = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_sys_conf_settings', 'where' => "conf_key='gl_guidelines'" ) );
$editor->setAllowHtml( true );
IPSText::getTextClass( 'bbcode' )->parse_smilies = 1;
IPSText::getTextClass( 'bbcode' )->parse_html = 1;
IPSText::getTextClass( 'bbcode' )->parse_nl2br = 1;
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
$row['conf_value'] = $editor->switchContent( $row['conf_value'], 0 );
$row['conf_value'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( ( $row['conf_value'] ) ? $row['conf_value'] : $row['conf_default'] );
$this->registry->output->addNavigation( $this->settings['gl_title'], '' );
$this->registry->output->setTitle( $this->settings['gl_title'] . ' - ' . ipsRegistry::$settings['board_name'] );
$this->registry->output->addContent( $this->registry->output->getTemplate('emails')->boardRules( $this->settings['gl_title'], IPSText::getTextClass( 'bbcode' )->preDisplayParse( $row['conf_value'] ) ) );
@@ -7,7 +7,7 @@
* $Author: ips_terabyte $
* @since 20th February 2002
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
* @version v3.3.4
* @version v3.4.5
* $Revision: 8655 $
*/
@@ -3,19 +3,19 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Forward a topic to someone
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $Date: 2013-04-15 17:26:30 -0400 (Mon, 15 Apr 2013) $
* </pre>
*
* @author $Author: bfarber $
* @author $Author: AndyMillne $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @since 20th February 2002
* @version $Revision: 10914 $
* @version $Revision: 12179 $
*
*/
@@ -58,6 +58,20 @@ class public_forums_extras_forward extends ipsCommand
*/
public function doExecute( ipsRegistry $registry )
{
/* Disabled? */
if ( ! $this->settings['sl_enable'] )
{
$this->registry->output->showError( 'forward_turned_off', 103240.1 );
}
/* Permission Check */
$cache = isset( $this->caches['sharelinks'] ) ? $this->caches['sharelinks'] : ipsRegistry::cache()->getCache('sharelinks');
if ( $cache[ 'email' ]['share_groups'] != '*' and !IPSMember::isInGroup( $this->memberData, explode( ',', $cache[ 'email' ]['share_groups'] ) ) )
{
$this->registry->output->showError( 'forward_turned_off', 103240.2 );
}
//-----------------------------------------
// Grab skin and lang stuff
//-----------------------------------------
@@ -2,9 +2,9 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Emoticon and BBCode Legends
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $Date: 2013-03-26 09:06:10 -0400 (Tue, 26 Mar 2013) $
* </pre>
*
* @author $Author $
@@ -13,7 +13,7 @@
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 10914 $
* @version $Rev: 12122 $
*
*/
@@ -161,8 +161,20 @@ class public_forums_extras_legends extends ipsCommand
}
$before = htmlspecialchars( $row['bbcode_example'] );
$t = IPSText::getTextClass( 'bbcode' )->preDisplayParse( IPSText::getTextClass( 'bbcode' )->preDbParse( $before ) );
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser' );
$parser = new $classToLoad();
/* Set up some settings */
$parser->set( array( 'memberData' => $this->memberData,
'parseBBCode' => true,
'parseHtml' => false,
'parseEmoticons' => true ) );
/* img is hardcoded as the new style format was never available in the php bbcode parser and is handled via js library now */
$t = ( $row['bbcode_tag'] == 'img' ) ? "<img src='http://www.google.com/intl/en_ALL/images/logo.gif' />" : $t = $parser->display( $before );
$before = preg_replace( "#(\[".$row['bbcode_tag']."(?:[^\]]+)?\])#is", $this->registry->output->getTemplate('legends')->wrap_tag("\\1"), $before );
$before = preg_replace( "#(\[/".$row['bbcode_tag']."\])#is" , $this->registry->output->getTemplate('legends')->wrap_tag("\\1"), $before );
@@ -3,19 +3,19 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Add rating fallback
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $Date: 2013-03-19 10:12:37 -0400 (Tue, 19 Mar 2013) $
* </pre>
*
* @author $Author: bfarber $
* @author $Author: mmecham $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @since 20th February 2002
* @version $Revision: 10914 $
* @version $Revision: 12086 $
*
*/
@@ -137,9 +137,9 @@ class public_forums_extras_rating extends ipsCommand
$rating_id = 5;
}
if( $rating_id < 0 )
if( $rating_id < 1 )
{
$rating_id = 0;
$rating_id = 1;
}
//-----------------------------------------
@@ -3,19 +3,19 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Member stats functions
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $Date: 2012-11-08 12:08:29 -0500 (Thu, 08 Nov 2012) $
* </pre>
*
* @author $Author: bfarber $
* @author $Author: AndyMillne $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @since 20th February 2002
* @version $Revision: 10914 $
* @version $Revision: 11578 $
*
*/
@@ -367,125 +367,128 @@ class public_forums_extras_stats extends ipsCommand
/* Get a count */
$count = $this->DB->buildAndFetch( array( 'select' => 'count(*) as dracula', 'from' => array( 'members' => 'm' ), 'where' => implode( ' OR ', $whereClause ) ) );
/* Sort out pagination */
$pagination = $this->registry->output->generatePagination( array( 'totalItems' => $count['dracula'],
'itemsPerPage' => $perpage,
'currentStartValue' => $st,
'baseUrl' => "app=forums&module=extras&section=stats&do=leaders" ) );
/* Fetch the ones we want */
$this->DB->build( array(
'select' => 'm.*, m.member_id as my_member_id',
'from' => array( 'members' => 'm' ),
'add_join' => array(
array(
'select' => 'pp.*',
'from' => array( 'profile_portal' => 'pp' ),
'where' => 'pp.pp_member_id=m.member_id',
'type' => 'left',
if ( $count['dracula'] )
{
/* Sort out pagination */
$pagination = $this->registry->output->generatePagination( array( 'totalItems' => $count['dracula'],
'itemsPerPage' => $perpage,
'currentStartValue' => $st,
'baseUrl' => "app=forums&module=extras&section=stats&do=leaders" ) );
/* Fetch the ones we want */
$this->DB->build( array(
'select' => 'm.*, m.member_id as my_member_id',
'from' => array( 'members' => 'm' ),
'add_join' => array(
array(
'select' => 'pp.*',
'from' => array( 'profile_portal' => 'pp' ),
'where' => 'pp.pp_member_id=m.member_id',
'type' => 'left',
),
array(
'select' => 'pf.*',
'from' => array( 'pfields_content' => 'pf' ),
'where' => 'pf.member_id=m.member_id',
'type' => 'left',
),
),
array(
'select' => 'pf.*',
'from' => array( 'pfields_content' => 'pf' ),
'where' => 'pf.member_id=m.member_id',
'type' => 'left',
),
),
'where' => implode( ' OR ', $whereClause ),
'order' => 'm.members_display_name',
'limit' => array( $st, $perpage )
) );
$e = $this->DB->execute();
while( $r = $this->DB->fetch( $e ) )
{
/* Reset member ID just in case.. */
$r['member_id'] = $r['my_member_id'];
$members[ $r['member_id'] ] = IPSMember::buildDisplayData( $r );
}
/* Now fetch session data */
$this->DB->build( array( 'select' => '*',
'from' => 'sessions',
'where' => 'member_id IN (' . implode( ',', array_keys( $members ) ) . ')' ) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
if( ! $r['id'] or IPSMember::isLoggedInAnon( $members[ $r['member_id'] ] ) )
{
$location_info[ $r['member_id'] ] = '';
}
else
{
$location_info[ $r['member_id'] ] = IPSMember::getLocation( $r );
}
}
//-----------------------------------------
// Display
//-----------------------------------------
foreach( $members as $k => $member )
{
$forums = isset( $member_ids[ $member['member_id'] ] ) ? $member_ids[ $member['member_id'] ] : array();
if ( $forums == '*' )
{
$forums = $this->lang->words['leader_all_forums'];
}
else
{
$forums = array();
'where' => implode( ' OR ', $whereClause ),
'order' => 'm.members_display_name',
'limit' => array( $st, $perpage )
) );
foreach ( $group_ids as $gid => $fs )
$e = $this->DB->execute();
while( $r = $this->DB->fetch( $e ) )
{
/* Reset member ID just in case.. */
$r['member_id'] = $r['my_member_id'];
$members[ $r['member_id'] ] = IPSMember::buildDisplayData( $r );
}
/* Now fetch session data */
$this->DB->build( array( 'select' => '*',
'from' => 'sessions',
'where' => 'member_id IN (' . implode( ',', array_keys( $members ) ) . ')' ) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
if( ! $r['id'] or IPSMember::isLoggedInAnon( $members[ $r['member_id'] ] ) )
{
if ( IPSMember::isInGroup( $member, $gid ) )
$location_info[ $r['member_id'] ] = '';
}
else
{
$location_info[ $r['member_id'] ] = IPSMember::getLocation( $r );
}
}
//-----------------------------------------
// Display
//-----------------------------------------
foreach( $members as $k => $member )
{
$forums = isset( $member_ids[ $member['member_id'] ] ) ? $member_ids[ $member['member_id'] ] : array();
if ( $forums == '*' )
{
$forums = $this->lang->words['leader_all_forums'];
}
else
{
$forums = array();
foreach ( $group_ids as $gid => $fs )
{
if ( $fs == '*' )
if ( IPSMember::isInGroup( $member, $gid ) )
{
$forums = $this->lang->words['leader_all_forums'];
break;
}
else
{
foreach ( $fs as $f_id => $f_name )
if ( $fs == '*' )
{
if ( ! isset( $forums[ $f_id ] ) && $this->registry->getClass('class_forums')->forumsCheckAccess( $f_id, 0, 'forum', array(), true ) )
$forums = $this->lang->words['leader_all_forums'];
break;
}
else
{
foreach ( $fs as $f_id => $f_name )
{
$forums[ $f_id ] = $f_name;
if ( ! isset( $forums[ $f_id ] ) && $this->registry->getClass('class_forums')->forumsCheckAccess( $f_id, 0, 'forum', array(), true ) )
{
$forums[ $f_id ] = $f_name;
}
}
}
}
}
/* Now merge in member specific */
if ( ! is_string( $forums ) && ! empty( $forumsMembers[ $member['member_id'] ] ) )
{
foreach( $forumsMembers[ $member['member_id'] ] as $f_id => $f_name )
{
if ( ! isset( $forums[ $f_id ] ) && $this->registry->getClass('class_forums')->forumsCheckAccess( $f_id, 0, 'forum', array(), true ) )
{
$forums[ $f_id ] = $f_name;
}
}
}
}
/* Now merge in member specific */
if ( ! is_string( $forums ) && ! empty( $forumsMembers[ $member['member_id'] ] ) )
/* Do not list if the user cannot see the forums this mod is a mod of - Bug report 36929 */
if ( empty( $forums ) )
{
foreach( $forumsMembers[ $member['member_id'] ] as $f_id => $f_name )
{
if ( ! isset( $forums[ $f_id ] ) && $this->registry->getClass('class_forums')->forumsCheckAccess( $f_id, 0, 'forum', array(), true ) )
{
$forums[ $f_id ] = $f_name;
}
}
unset( $members[ $k ] );
continue;
}
$members[ $k ]['forums'] = $forums;
$members[ $k ]['online_extra'] = isset( $location_info[ $k ]['online_extra'] ) ? $location_info[ $k ]['online_extra'] : '';
$members[ $k ]['last_active'] = ( $members[ $k ]['member_id'] == $this->memberData['member_id'] ) ? IPS_UNIX_TIME_NOW : ( ( $members[ $k ]['online_extra'] ) ? $members[ $k ]['last_activity'] : $members[ $k ]['last_visit'] );
}
/* Do not list if the user cannot see the forums this mod is a mod of - Bug report 36929 */
if ( empty( $forums ) )
{
unset( $members[ $k ] );
continue;
}
$members[ $k ]['forums'] = $forums;
$members[ $k ]['online_extra'] = isset( $location_info[ $k ]['online_extra'] ) ? $location_info[ $k ]['online_extra'] : '';
$members[ $k ]['last_active'] = ( $members[ $k ]['member_id'] == $this->memberData['member_id'] ) ? IPS_UNIX_TIME_NOW : ( ( $members[ $k ]['online_extra'] ) ? $members[ $k ]['last_activity'] : $members[ $k ]['last_visit'] );
}
}
@@ -562,6 +565,8 @@ class public_forums_extras_stats extends ipsCommand
$this->DB->build( array('select' => 'post_author_id, COUNT(post_id) as tpost',
'from' => 'forums_recent_posts',
'where' => "post_date > {$time_low} AND post_forum_id IN(" . implode( ',', $fiddyCent ) . ')',
'order' => 'tpost DESC',
'limit' => array( 0, 20 ),
'group' => 'post_author_id' ) );
$this->DB->execute();
@@ -608,8 +613,6 @@ class public_forums_extras_stats extends ipsCommand
uasort( $rows, create_function( '$a,$b', 'return $a[\'today_pct\']<$b[\'today_pct\'];' ) );
$rows = array_slice( $rows, 0, 20 );
$this->output .= $this->registry->getClass('output')->getTemplate('stats')->top_posters( $rows );
$this->registry->output->setTitle( $this->lang->words['top_poster_title'] . ' - ' . ipsRegistry::$settings['board_name'] );
@@ -3,9 +3,9 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Silly toggle function(?s{0,})
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
@@ -15,7 +15,7 @@
* @subpackage Forums
* @link http://www.invisionpower.com
* @since 20th February 2002
* @version $Revision: 10914 $
* @version $Revision: 10721 $
*
*/
@@ -3,19 +3,19 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Poll voting
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $Date: 2012-11-06 04:19:50 -0500 (Tue, 06 Nov 2012) $
* </pre>
*
* @author $Author: bfarber $
* @author $Author: mmecham $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @since 20th February 2002
* @version $Revision: 10914 $
* @version $Revision: 11558 $
*
*/
@@ -215,7 +215,7 @@ class public_forums_extras_vote extends ipsCommand
// Unparse the choices
//-----------------------------------------
$poll_answers = unserialize( stripslashes( $this->topic['choices'] ) );
$poll_answers = IPSLib::safeUnserialize( stripslashes( $this->topic['choices'] ) );
reset($poll_answers);
//-----------------------------------------
@@ -280,7 +280,7 @@ class public_forums_extras_vote extends ipsCommand
{
$this->topic['last_vote'] = time();
$this->DB->update( 'topics', array( 'last_vote' => $this->topic['last_vote'], 'last_post' => $this->topic['last_post'] ), 'tid=' . $this->topic['tid'] );
$this->DB->update( 'topics', array( 'last_vote' => $this->topic['last_vote'] ), 'tid=' . $this->topic['tid'] );
}
}
else
@@ -342,8 +342,8 @@ class public_forums_extras_vote extends ipsCommand
// Remove our votes
//-----------------------------------------
$myVotes = unserialize( $voter['member_choices'] );
$pollData = unserialize( stripslashes( $this->topic['choices'] ) );
$myVotes = IPSLib::safeUnserialize( $voter['member_choices'] );
$pollData = IPSLib::safeUnserialize( stripslashes( $this->topic['choices'] ) );
if ( is_array( $myVotes ) AND is_array( $pollData ) )
{
@@ -3,9 +3,9 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Announcement View
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
@@ -14,7 +14,7 @@
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 10914 $
* @version $Rev: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -3,9 +3,9 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* View Topic Attachments
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $Author: bfarber $
@@ -14,7 +14,7 @@
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 10914 $
* @version $Rev: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -2,9 +2,9 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Board Index View
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $Date: 2013-05-15 22:23:38 -0400 (Wed, 15 May 2013) $
* </pre>
*
* @author $Author: bfarber $
@@ -13,7 +13,7 @@
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 10914 $
* @version $Rev: 12254 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -303,9 +303,19 @@ class public_forums_forums_boards extends ipsCommand
'member_group' => $this->memberData['member_group_id'] ) );
}
$this->DB->build( array('select' => 'id, member_id, member_name, seo_name, login_type, running_time, member_group, uagent_type',
'from' => 'sessions',
'where' => "running_time > {$time}" ) );
$this->DB->build( array('select' => 's.id, s.member_id, s.member_name, s.seo_name, s.login_type, s.running_time, s.member_group, s.uagent_type',
'from' => array( 'sessions' => 's' ),
'where' => "running_time > {$time}",
'add_join' => array(
array(
'select' => 'm.member_banned',
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id=s.member_id',
'type' => 'left',
)
)
) );
$this->DB->execute();
//-----------------------------------------
@@ -327,8 +337,15 @@ class public_forums_forums_boards extends ipsCommand
$cached = array();
foreach ( $rows as $result )
{
$last_date = $this->registry->getClass('class_localization')->getDate( $result['running_time'], 'TINY' );
{
//-----------------------------------------
// Skip Banned
//-----------------------------------------
if ( $result['member_banned'] )
{
continue;
}
//-----------------------------------------
// Bot?
@@ -389,7 +406,7 @@ class public_forums_forums_boards extends ipsCommand
{
if ( $this->memberData['g_access_cp'] || ( $this->memberData['member_id'] == $result['member_id'] ) )
{
$active['NAMES'][] = IPSMember::makeProfileLink( $result['member_name'], $result['member_id'], $result['seo_name'], '', $last_date ) . "*";
$active['NAMES'][] = IPSMember::makeProfileLink( $result['member_name'], $result['member_id'], $result['seo_name'] ) . "*";
$active['ANON']++;
}
else
@@ -400,7 +417,7 @@ class public_forums_forums_boards extends ipsCommand
else
{
$active['MEMBERS']++;
$active['NAMES'][] = IPSMember::makeProfileLink( $result['member_name'], $result['member_id'], $result['seo_name'], '', $last_date );
$active['NAMES'][] = IPSMember::makeProfileLink( $result['member_name'], $result['member_id'], $result['seo_name'] );
}
}
}
@@ -7,7 +7,7 @@
* $Author: ips_terabyte $
* @since 14th May 2003
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
* @version v3.3.4
* @version v3.4.5
* $Revision: 8655 $
*/
@@ -3,9 +3,9 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Bounces a user to the right post
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $Date: 2013-05-08 12:08:00 -0400 (Wed, 08 May 2013) $
* </pre>
*
* @author $Author: bfarber $
@@ -14,7 +14,7 @@
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 10914 $
* @version $Rev: 12237 $
* @since 14th April 2004
*
* | > Interesting Fact: I've had iTunes playing every Radiohead tune
@@ -47,82 +47,65 @@ class public_forums_forums_findpost extends ipsCommand
// will do that for us. Woohoop
//-----------------------------------------
$pid = intval($this->request['pid']);
if ( ! $pid )
$pid = intval( str_replace( 'post', '', $this->request['pid'] ) );
if ( ! $pid && ! $this->request['t'])
{
$this->registry->getClass('output')->showError( 'findpost_missing_pid', 10331, null, null, 404 );
}
//-----------------------------------------
// Get topic...
//-----------------------------------------
$post = $this->DB->buildAndFetch( array( 'select' => 'p.*',
'from' => array( 'posts' => 'p' ),
'where' => 'p.pid=' . $pid,
'add_join' => array( array( 'select' => 't.*',
'from' => array( 'topics' => 't' ),
'where' => 't.tid=p.topic_id',
'type' => 'left' ) ) ) );
if ( ! $post['topic_id'] )
/* Init */
if ( ! $this->registry->isClassLoaded('topics') )
{
$this->registry->getClass('output')->showError( 'findpost_missing_topic', 10332, null, null, 404 );
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . "/sources/classes/topics.php", 'app_forums_classes_topics', 'forums' );
$this->registry->setClass( 'topics', new $classToLoad( $this->registry ) );
}
//-----------------------------------------
// Get post...
// @link http://community.invisionpower.com/resources/bugs.html/_/ip-board/old-findpostphp-methods-not-accounting-for-view-perms-r42027
// We have to get all posts and then verify if we can see them from here in order to account for moderator permissions properly
//-----------------------------------------
$post = $this->registry->topics->getPostById( $pid, true, array( 'postType' => array( 'visible', 'sdelete', 'hidden' ) ) );
if ( ! $post['pid'] OR
( !$this->registry->getClass('class_forums')->canSeeSoftDeletedPosts( $post['forum_id'] ) && $this->registry->getClass('class_forums')->fetchHiddenType( $post ) == 'sdelete' ) OR
( $this->registry->getClass('class_forums')->canQueuePosts( $post['forum_id'] ) && $this->registry->getClass('class_forums')->fetchHiddenType( $post ) == 'hidden' )
)
{
/* Could not get the post (could be hidden, could be deleted, could be stolen by ninja aliens) */
if ( $this->request['t'] )
{
$topic = $this->registry->topics->getTopicById( $this->request['t'] );
if ( $topic['tid'] )
{
/* Got access? */
if ( $this->registry->getClass('class_forums')->forumsCheckAccess( $topic['forum_id'], 0, 'topic', $topic, TRUE ) )
{
/* Redirect to page 1 of this topic */
$url = $this->registry->output->buildSEOUrl( "showtopic=" . $topic['tid'], 'public', $topic['title_seo'], 'showtopic' );
$this->registry->getClass('output')->silentRedirect( $url, false, 302 );
}
}
}
/* Nah, just dump it 'den */
$this->registry->getClass('output')->showError( 'findpost_missing_topic', 10332, null, null, 404 );
}
/* Check permission */
if ( ! $this->registry->getClass('class_forums')->forumsCheckAccess( $post['forum_id'], 0, 'topic', $post, TRUE ) )
{
$this->registry->getClass('output')->showError( 'findpost_missing_topic', 10332.1, null, null, 404 );
$this->registry->getClass('output')->showError( 'findpost_missing_topic', 10332.1, null, null, 403 );
}
$pageUrlParam = '&page=' . $this->registry->getClass('topics')->postToPage( $post );
$sort_field = ($this->settings['post_order_column'] == 'pid') ? 'pid' : 'post_date';
$sort_value = $sort_field == 'pid' ? $pid : $post['post_date'];
$url = $this->registry->output->buildSEOUrl( "showtopic=" . $post['topic_id'] . "{$pageUrlParam}" . "&#entry" . $pid, 'public', $post['title_seo'], 'showtopic' );
$query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery('visible');
/* Can we deal with hidden posts? */
if ( $this->registry->class_forums->canQueuePosts( $post['forum_id'] ) )
{
if ( $this->permissions['softDeleteSee'] )
{
/* See queued and soft deleted */
$query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array( 'approved', 'sdeleted', 'hidden' ) );
}
else
{
/* Otherwise, see queued and approved */
$query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array( 'visible', 'hidden' ) );
}
}
else
{
/* We cannot see hidden posts */
if ( $this->permissions['softDeleteSee'] )
{
/* See queued and soft deleted */
$query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array('approved', 'sdeleted') );
}
}
$cposts = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as posts', 'from' => 'posts', 'where' => "topic_id={$post['topic_id']} AND {$sort_field} <=" . intval( $sort_value ) . $query ) );
if ( (($cposts['posts']) % $this->settings['display_max_posts']) == 0 )
{
$pages = ($cposts['posts']) / $this->settings['display_max_posts'];
}
else
{
$number = ( ($cposts['posts']) / $this->settings['display_max_posts'] );
$pages = ceil( $number);
}
$st = ($pages - 1) * $this->settings['display_max_posts'];
$hl = $this->request['hl'] ? '&hl=' . trim( $this->request['hl'] ) : '';
$url = $this->registry->output->buildSEOUrl( "showtopic=" . $post['topic_id'] . "&st={$st}&p={$pid}" . $hl . "&#entry" . $pid, 'public', $post['title_seo'], 'showtopic' );
$this->registry->getClass('output')->silentRedirect( $url );
$this->registry->getClass('output')->silentRedirect( $url, false, 302 );
}
}
@@ -2,9 +2,9 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Forum Viewing
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $Date: 2013-05-06 14:16:05 -0400 (Mon, 06 May 2013) $
* </pre>
*
* @author $Author: bfarber $
@@ -13,7 +13,7 @@
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 10914 $
* @version $Rev: 12229 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -168,11 +168,17 @@ class public_forums_forums_forums extends ipsCommand
if( $this->forum['show_rules'] == 2)
{
IPSText::getTextClass( 'bbcode' )->parsing_section = 'rules';
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $this->memberData['member_group_id'];
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $this->memberData['mgroup_others'];
/* Load parser */
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser' );
$parser = new $classToLoad();
$this->forum['rules_text'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $this->forum['rules_text'] );
$parser->set( array( 'memberData' => array( 'member_group_id' => $this->settings['admin_group'] ),
'parseBBCode' => true,
'parseArea' => 'rules',
'parseHtml' => true,
'parseEmoticons' => true ) );
$this->forum['rules_text'] = $parser->display( $this->forum['rules_text'] );
/* @link http://community.invisionpower.com/tracker/issue-37441-forum-rules/ */
$this->forum['rules_text'] = str_replace( "<span rel='lightbox'>", "<span>", $this->forum['rules_text'] );
@@ -261,7 +267,7 @@ class public_forums_forums_forums extends ipsCommand
// st will always be defined across pages
//-----------------------------------------
if( !array_key_exists( 'st', $this->request ) AND !array_key_exists( 'prune_day', $this->request ) )
if( !array_key_exists( 'page', $this->request ) AND !array_key_exists( 'prune_day', $this->request ) )
{
IPSCookie::set('modtids', ',', 0);
$this->request['selectedtids'] = '';
@@ -484,7 +490,7 @@ class public_forums_forums_forums extends ipsCommand
// INIT
//-----------------------------------------
$this->request['st'] = $this->request['changefilters'] ? 0 : ( isset($this->request['st']) ? intval($this->request['st']) : 0 );
$this->request['page'] = $this->request['changefilters'] ? 0 : ( isset($this->request['page']) ? intval($this->request['page']) : 0 );
$announce_data = array();
$topic_data = array();
$other_data = array();
@@ -572,8 +578,8 @@ class public_forums_forums_forums extends ipsCommand
// Read topics
//-----------------------------------------
$First = intval($this->request['st']);
$First = $this->registry->class_forums->pageToSt( intval($this->request['page']) );
//-----------------------------------------
// Sort options
//-----------------------------------------
@@ -640,14 +646,14 @@ class public_forums_forums_forums extends ipsCommand
$Prune = $prune_value < 100 ? (time() - ($prune_value * 60 * 60 * 24)) : ( ( $prune_value == 200 AND $this->memberData['member_id'] ) ? $this->memberData['last_visit'] : 0 );
$sort_keys = array( 'last_post' => 'sort_by_date',
'last_poster_name' => 'sort_by_last_poster',
'title' => 'sort_by_topic',
'starter_name' => 'sort_by_poster',
'start_date' => 'sort_by_start',
'topic_hasattach' => 'sort_by_attach',
'posts' => 'sort_by_replies',
'views' => 'sort_by_views',
$sort_keys = array( 'last_post' => 'sort_by_date',
'last_poster_name' => 'sort_by_last_poster',
'title' => 'sort_by_topic',
'starter_name' => 'sort_by_poster',
'start_date' => 'sort_by_start',
'topic_hasattach' => 'sort_by_attach',
'posts' => 'sort_by_replies',
'views' => 'sort_by_views',
);
@@ -687,7 +693,7 @@ class public_forums_forums_forums extends ipsCommand
// check for any form funny business by wanna-be hackers
//-----------------------------------------
if( ( ! isset( $filter_keys[$topicfilter] ) ) or ( ! isset( $sort_keys[$sort_key] ) ) or ( ! isset( $prune_by_day[$prune_value] ) ) or ( ! isset( $sort_by_keys[$sort_by] ) ) )
if( ( ! isset( $filter_keys[$topicfilter] ) ) or ( ! isset( $sort_keys[$sort_key] ) ) or ( ! isset( $prune_by_day[$prune_value] ) ) or ( ! isset( $sort_by_keys[ strtoupper($sort_by) ] ) ) )
{
$this->registry->getClass('output')->showError( 'forums_bad_filter', 10339 );
}
@@ -740,6 +746,19 @@ class public_forums_forums_forums extends ipsCommand
$add_query_array[] = "t.starter_id='".$this->memberData['member_id']."'";
}
/* Answered / unanswered */
if ( isset( $this->request['answered'] ) && $this->registry->class_forums->answerTopicsEnabled( $this->forum['id'] ) )
{
if ( $this->request['answered'] == 'true' )
{
$add_query_array[] = 't.topic_answered_pid != 0';
}
else if ( $this->request['answered'] == 'false' )
{
$add_query_array[] = 't.topic_answered_pid = 0';
}
}
$_SQL_EXTRA = '';
$_SQL_APPROVED = '';
$_SQL_AGE_PRUNE = '';
@@ -748,55 +767,60 @@ class public_forums_forums_forums extends ipsCommand
{
$_SQL_EXTRA = ' AND '. implode( ' AND ', $add_query_array );
}
//-----------------------------------------
// Moderator?
//-----------------------------------------
$this->request['modfilter'] = isset( $this->request['modfilter'] ) ? $this->request['modfilter'] : '';
$modFilter = '';
if ( $this->memberData['is_mod'] )
{
{
if ( $this->request['modfilter'] == 'unapproved' )
{
$_SQL_APPROVED = ' AND (' . $this->registry->class_forums->fetchTopicHiddenQuery(array('hidden'), 't.') . ' OR t.topic_queuedposts )';
$modFilter = $this->registry->class_forums->fetchTopicHiddenQuery(array('hidden'), 't.') . ' OR t.topic_queuedposts';
}
elseif ( $this->permissions['TopicSoftDeleteSee'] )
{
if ( $this->request['modfilter'] == 'hidden' )
{
$_SQL_APPROVED = ' AND (' . $this->registry->class_forums->fetchTopicHiddenQuery(array('sdeleted'), 't.') . ' OR t.topic_deleted_posts )';
$modFilter = $this->registry->class_forums->fetchTopicHiddenQuery(array('sdeleted'), 't.') . ' OR t.topic_deleted_posts';
}
else
{
$_SQL_APPROVED = ' AND ' . $this->registry->class_forums->fetchTopicHiddenQuery(array('visible', 'hidden', 'sdeleted'), 't.');
$modFilter = $this->registry->class_forums->fetchTopicHiddenQuery(array('visible', 'hidden', 'sdeleted'), 't.');
}
}
else
{
$_SQL_APPROVED = ' AND ' . $this->registry->class_forums->fetchTopicHiddenQuery(array('visible', 'hidden'), 't.');
$modFilter = $this->registry->class_forums->fetchTopicHiddenQuery(array('visible', 'hidden'), 't.');
}
}
else
{
if ( $this->permissions['TopicSoftDeleteSee'] )
{
$_SQL_APPROVED = ' AND ' . $this->registry->class_forums->fetchTopicHiddenQuery(array('visible', 'sdeleted'), 't.');
$modFilter = $this->registry->class_forums->fetchTopicHiddenQuery(array('visible', 'sdeleted'), 't.');
}
else
{
$_SQL_APPROVED = ' AND ' . $this->registry->class_forums->fetchTopicHiddenQuery(array('visible'), 't.');
$modFilter = $this->registry->class_forums->fetchTopicHiddenQuery(array('visible'), 't.');
}
}
if ( $Prune )
if ( $modFilter )
{
$_SQL_APPROVED = ' AND (' . $modFilter . ')';
}
if ( $Prune )
{
if ( $prune_value == 200 )
{
/* Just new content, don't show pinned, please */
if( $this->memberData['is_mod'] AND $this->request['modfilter'] )
if( $modFilter )
{
$_SQL_AGE_PRUNE = " AND (t.last_post > {$Prune} OR t.approved=0)";
$_SQL_AGE_PRUNE = " AND (t.last_post > {$Prune} AND ( {$modFilter} ) )";
}
else
{
@@ -805,9 +829,9 @@ class public_forums_forums_forums extends ipsCommand
}
else
{
if( $this->memberData['is_mod'] AND $this->request['modfilter'] )
if( $modFilter )
{
$_SQL_AGE_PRUNE = " AND (t.pinned=1 or t.last_post > {$Prune} OR t.approved=0)";
$_SQL_AGE_PRUNE = " AND (t.pinned=1 or t.last_post > {$Prune} AND ( {$modFilter} ) )";
}
else
{
@@ -861,16 +885,22 @@ class public_forums_forums_forums extends ipsCommand
// Generate the forum page span links
//-----------------------------------------
$_extraStuff = '';
$_extraStuff = '';
if( $this->request['modfilter'] )
if ( $this->request['modfilter'] )
{
$_extraStuff .= "&amp;modfilter=" . $this->request['modfilter'];
$_extraStuff .= "&amp;modfilter=" . $this->request['modfilter'];
}
if ( isset( $this->request['answered'] ) && $this->registry->class_forums->answerTopicsEnabled( $this->forum['id'] ) )
{
$_extraStuff .= "&amp;answered=" . $this->request['answered'];
}
$this->forum['SHOW_PAGES'] = $this->registry->getClass('output')->generatePagination( array( 'totalItems' => $total_possible['max'],
'itemsPerPage' => $this->settings['display_max_topics'],
'currentStartValue' => $this->request['st'],
'currentStartValue' => intval( $this->request['page'] ),
'isPagesMode' => true,
'seoTitle' => $this->forum['name_seo'],
'disableSinglePage' => false,
'baseUrl' => "showforum=".$this->forum['id']."&amp;prune_day={$prune_value}&amp;sort_by={$sort_by}&amp;sort_key={$sort_key_chk}&amp;topicfilter={$topicfilter}{$_extraStuff}" ) );
@@ -880,7 +910,7 @@ class public_forums_forums_forums extends ipsCommand
//-----------------------------------------
$other_data = array( 'forum_data' => $this->forum,
'hasMore' => ( $this->request['st'] + $this->settings['display_max_topics'] > $total_possible['max'] ) ? false : true,
'hasMore' => ( $this->registry->class_forums->pageToSt( $this->request['page'] ) + $this->settings['display_max_topics'] > $total_possible['max'] ) ? false : true,
'can_edit_topics' => $this->can_edit_topics,
'can_open_topics' => $this->can_open_topics,
'can_close_topics' => $this->can_close_topics,
@@ -900,6 +930,8 @@ class public_forums_forums_forums extends ipsCommand
// Cut off?
//-----------------------------------------
$modAll = ( $this->memberData['g_is_supmod'] or ( isset( $this->memberData['forumsModeratorData'][ $this->forum['id'] ] ) and ( $this->memberData['forumsModeratorData'][ $this->forum['id'] ]['delete_topic'] or $this->memberData['forumsModeratorData'][ $this->forum['id'] ]['move_topic'] or $this->memberData['forumsModeratorData'][ $this->forum['id'] ]['split_merge'] ) ) );
$parse_dots = 1;
if( $topicfilter == 'ireplied' )
@@ -938,11 +970,37 @@ class public_forums_forums_forums extends ipsCommand
'limit' => array( intval($First), $this->settings['display_max_topics'] ),
'add_join' => ( $this->settings['tags_enabled'] AND !$this->forum['bw_disable_tagging'] ) ? array( $this->registry->tags->getCacheJoin( array( 'meta_id_field' => 't.tid' ) ) ) : array()
) );
$this->DB->execute();
}
while( $t = $this->DB->fetch() )
{
/* Should we display the moderate checkbox for this post? */
$t['moddable'] = FALSE;
if
(
$modAll
or
(
isset( $this->memberData['forumsModeratorData'][ $this->forum['id'] ] )
and
(
( $t['pinned'] == 0 and $this->memberData['forumsModeratorData'][ $this->forum['id'] ]['pin_topic'] )
or
( $t['pinned'] == 1 and $this->memberData['forumsModeratorData'][ $this->forum['id'] ]['unpin_topic'] )
or
( $t['state'] == 'open' and $this->memberData['forumsModeratorData'][ $this->forum['id'] ]['close_topic'] )
or
( $t['state'] == 'closed' and $this->memberData['forumsModeratorData'][ $this->forum['id'] ]['open_topic'] )
)
)
)
{
$t['moddable'] = TRUE;
}
/* Add to array */
$topic_array[ $t['tid'] ] = $t;
$topic_ids[ $t['tid'] ] = $t['tid'];
@@ -956,7 +1014,7 @@ class public_forums_forums_forums extends ipsCommand
$member_ids[ $t['starter_id'] ] = $t['starter_id'];
}
}
ksort( $topic_ids );
//-----------------------------------------
@@ -967,7 +1025,7 @@ class public_forums_forums_forums extends ipsCommand
{
$_queued = $this->registry->class_forums->fetchPostHiddenQuery( array( 'visible' ), '' );
$this->DB->build( array( 'select' => 'author_id, topic_id',
$this->DB->build( array( 'select' => $this->DB->buildDistinct( 'topic_id' ),
'from' => 'posts',
'where' => $_queued . ' AND author_id=' . $this->memberData['member_id'] . ' AND topic_id IN(' . implode( ',', $topic_ids ) . ')' ) );
@@ -977,7 +1035,7 @@ class public_forums_forums_forums extends ipsCommand
{
if ( is_array( $topic_array[ $p['topic_id'] ] ) )
{
$topic_array[ $p['topic_id'] ]['author_id'] = $p['author_id'];
$topic_array[ $p['topic_id'] ]['author_id'] = $this->memberData['member_id'];
}
}
}
@@ -3,9 +3,9 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Forums -> Mark As Read command class
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $Date: 2013-01-29 18:38:34 -0500 (Tue, 29 Jan 2013) $
* </pre>
*
* @author Matt Mecham
@@ -15,7 +15,7 @@
* @subpackage Forums
* @link http://www.invisionpower.com
* @since Tuesday 1st March 2005 (11:52)
* @version $Rev: 10914 $
* @version $Rev: 11914 $
*
*/
@@ -49,7 +49,7 @@ class public_forums_forums_markasread extends ipsCommand
return $this->markBoardAsRead();
break;
case 'app':
return $this->markBoardAsRead( trim( $this->request['markApp'] ) );
return $this->markBoardAsRead( is_string( $this->request['markApp'] ) ? trim( $this->request['markApp'] ) : "" );
break;
}
}
@@ -80,7 +80,7 @@ class public_forums_forums_markasread extends ipsCommand
# Bug fix 21223 - reset all markers with one cookie save
$this->registry->classItemMarking->markAppAsRead( $app );
if( $app && !in_array( $app, array('core','forums') ) )
if( $app && $app != 'core' )
{
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'app=' . $app, 'false' );
}
@@ -3,18 +3,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Show forum rules
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $Date: 2012-12-13 08:29:08 -0500 (Thu, 13 Dec 2012) $
* </pre>
*
* @author $Author: bfarber $
* @author $Author: AndyMillne $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 10914 $
* @version $Rev: 11713 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -110,13 +110,18 @@ class public_forums_forums_rules extends ipsCommand
$rules['body'] = $tmp['rules_text'];
$rules['fid'] = $this->forum['id'];
$rules['fseo'] = $this->forum['name_seo'];
IPSText::getTextClass( 'bbcode' )->parse_smilies = 1;
IPSText::getTextClass( 'bbcode' )->parse_html = 1;
IPSText::getTextClass( 'bbcode' )->parse_nl2br = 1;
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
IPSText::getTextClass( 'bbcode' )->parsing_section = 'rules';
$rules['body'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $rules['body'] );
/* Load parser */
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser' );
$parser = new $classToLoad();
$parser->set( array( 'memberData' => array( 'member_group_id' => $this->settings['admin_group'] ),
'parseBBCode' => true,
'parseArea' => 'rules',
'parseHtml' => true,
'parseEmoticons' => true ) );
$rules['body'] = $parser->display( $rules['body'] );
/* @link http://community.invisionpower.com/tracker/issue-37441-forum-rules/ */
$rules['body'] = str_replace( "<span rel='lightbox'>", "<span>", $rules['body'] );
@@ -2,9 +2,9 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Topic View
* Last Updated: $Date: 2012-07-02 16:40:12 -0400 (Mon, 02 Jul 2012) $
* Last Updated: $Date: 2013-05-02 11:20:01 -0400 (Thu, 02 May 2013) $
* </pre>
*
* @author $Author: AndyMillne $
@@ -13,7 +13,7 @@
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 11021 $
* @version $Rev: 12213 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -97,6 +97,12 @@ class public_forums_forums_topics extends ipsCommand
*/
protected $_maxPostDate = 0;
/**
* Parser object
*
*/
protected $_textParser = '';
/**
* Mod actions
*
@@ -166,13 +172,19 @@ class public_forums_forums_topics extends ipsCommand
$topicData = $this->registry->getClass('topics')->getTopicData();
$forumData = $this->forumClass->getForumById( $topicData['forum_id'] );
/* VigLink */
if ( !$forumData['viglink'] )
{
$this->settings['viglink_enabled'] = FALSE;
}
/* Rating */
$this->can_rate = $this->memberData['member_id'] ? intval( $this->memberData['g_topic_rate_setting'] ) : 0;
/* Set up topic */
$topicData = $this->topicSetUp( $topicData );
/* Specific view? */
$this->_doViewCheck();
@@ -187,12 +199,12 @@ class public_forums_forums_topics extends ipsCommand
$this->archiveReader->setApp('forums');
$postData = $this->archiveReader->get( array( 'parentData' => $topicData,
'goNative' => true,
'offset' => intval( $this->request['st'] ),
'limit' => intval( $this->settings['display_max_posts'] ),
'sortKey' => $this->settings['post_order_column'],
'sortOrder' => $this->settings['post_order_sort'] ) );
$postData = $this->archiveReader->get( array( 'parentData' => $topicData,
'goNative' => true,
'offset' => intval( $this->registry->getClass('topics')->pageToSt( $this->request['page'] ) ),
'limit' => intval( $this->settings['display_max_posts'] ),
'sortKey' => $this->settings['post_order_column'],
'sortOrder' => $this->settings['post_order_sort'] ) );
}
else
{
@@ -208,6 +220,15 @@ class public_forums_forums_topics extends ipsCommand
}
}
/* Do we have a P parameter, and if so, is it actually in this set of results? */
if ( ! $this->request['view'] && ( $this->request['p'] && ! in_array( $this->request['p'], array_keys( $postData ) ) ) )
{
/* Go find it */
$this->request['view'] = 'findpost';
$this->_doViewCheck();
/* Exits above */
}
unset( $this->cached_members );
/* Status? */
@@ -251,6 +272,12 @@ class public_forums_forums_topics extends ipsCommand
}
}
/* add meta update time */
if ( $this->_maxPostDate )
{
$this->registry->output->addMetaTag( 'og:updated_time', $this->_maxPostDate, false );
}
/* Set has unread flag */
$forumData['_hasUnreadTopics'] = $this->registry->getClass('class_forums')->getHasUnread( $forumData['id'] );
@@ -268,22 +295,23 @@ class public_forums_forums_topics extends ipsCommand
$poll_data = ( $topicData['poll_state'] ) ? $this->_generatePollOutput() : array( 'html' => '', 'poll' => '' );
$displayData = array( 'fast_reply' => $this->_getFastReplyData(),
'multi_mod' => $this->registry->getClass('topics')->getMultiModerationData(),
'reply_button' => $this->_getReplyButtonData(),
'active_users' => $this->_getActiveUserData(),
'mod_links' => ( $this->registry->getClass('topics')->isArchived( $topicData ) ) ? '' : $this->_generateModerationPanel(),
'follow_data' => ( $this->registry->getClass('topics')->isArchived( $topicData ) or $topicData['_isDeleted'] ) ? '' : $this->_like->render( 'summary', $topicData['tid'] ),
'same_tagged' => ( $this->registry->getClass('topics')->isArchived( $topicData ) ) ? '' : $this->_getSameTaggedData(),
'poll_data' => $poll_data,
'load_editor_js' => ( $this->_getFastReplyData() && $topicData['_isDeleted'] ) ? true : false,
'smilies' => '' );
$displayData = array( 'fast_reply' => $this->_getFastReplyData(),
'multi_mod' => $this->registry->getClass('topics')->getMultiModerationData(),
'reply_button' => $this->_getReplyButtonData(),
'active_users' => $this->_getActiveUserData(),
'mod_links' => ( $this->registry->getClass('topics')->isArchived( $topicData ) ) ? '' : $this->_generateModerationPanel(),
'follow_data' => ( $this->registry->getClass('topics')->isArchived( $topicData ) or $topicData['_isDeleted'] ) ? '' : $this->_like->render( 'summary', $topicData['tid'] ),
'same_tagged' => ( $this->registry->getClass('topics')->isArchived( $topicData ) ) ? '' : $this->_getSameTaggedData(),
'poll_data' => $poll_data,
'load_editor_js' => ( $this->_getFastReplyData() && $topicData['_isDeleted'] ) ? true : false,
'smilies' => '',
'best_answer_post_data' => $this->_getBestAnswerFeature( $postData, $topicData ) );
//-----------------------------------------
// If we can edit, but not reply, load JS still
//-----------------------------------------
if( !$displayData['fast_reply'] AND $this->_canEditAPost )
if( !( $displayData['fast_reply'] and $displayData['reply_button']['url'] ) AND $this->_canEditAPost )
{
$displayData['load_editor_js'] = true;
@@ -291,7 +319,7 @@ class public_forums_forums_topics extends ipsCommand
$editor = new $classToLoad();
$displayData['smilies'] = $editor->fetchEmoticons();
}
$postData = $this->_parseAttachments( $postData );
/* Rules */
@@ -305,10 +333,7 @@ class public_forums_forums_topics extends ipsCommand
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $this->memberData['member_group_id'];
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $this->memberData['mgroup_others'];
if( ! $forumData['rules_raw_html'] )
{
$forumData['rules_text'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $forumData['rules_text'] );
}
$forumData['rules_text'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $forumData['rules_text'] );
}
/* Got soft delete pids? */
@@ -336,7 +361,12 @@ class public_forums_forums_topics extends ipsCommand
$reports = new $classToLoad( $this->registry );
$topicData['_canReport'] = $reports->canReport( 'post' );
/* No likey no lighty */
require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
$_like = classes_like::bootstrap( 'forums','topics' );
$topicData['_isLiked'] = ( $this->memberData['member_id'] ) ? $_like->isLiked( $topicData['tid'], $this->memberData['member_id'] ) : false;
$template = $this->registry->output->getTemplate('topic')->topicViewTemplate( $forumData, $topicData, $postData, $displayData );
//-----------------------------------------
@@ -364,14 +394,14 @@ class public_forums_forums_topics extends ipsCommand
if ( $this->_firstPostContent )
{
/* Strip tags on title to ensure multi-mod added code isn't displayed */
$this->registry->output->addMetaTag( 'keywords', strip_tags( $topicData['title'] ) . ' ' . str_replace( "\n", " ", str_replace( "\r", "", strip_tags( $this->_firstPostContent ) ) ), TRUE );
$this->registry->output->addMetaTag( 'keywords', strip_tags( trim( $topicData['title'] ) . ' ' . str_replace( "\n", " ", str_replace( "\r", "", strip_tags( $this->_firstPostContent ) ) ) ), TRUE );
}
$pageData = $this->registry->output->getPaginationProcessedData();
$pageMeta = ( $pageData['pages'] > 1 ) ? sprintf( $this->lang->words['topic_meta_pages'], $pageData['current_page'], $pageData['pages'] ) .' ' : '';
# Trim to 155 chars based on Dan's recommendation
$this->registry->output->addMetaTag( 'description', $pageMeta . sprintf( $this->lang->words['topic_meta_description'], strip_tags( $topicData['title'] ), $forumData['name'], str_replace( "\r", "", $this->_firstPostContent ) ), FALSE );
$this->registry->output->addMetaTag( 'description', trim( $pageMeta . sprintf( $this->lang->words['topic_meta_description'], strip_tags( $topicData['title'] ), $forumData['name'], str_replace( "\r", "", $this->_firstPostContent ) ) ), FALSE );
/* Set Ad code for the board index */
if( $this->registry->getClass('IPSAdCode')->userCanViewAds() )
@@ -415,7 +445,7 @@ class public_forums_forums_topics extends ipsCommand
{
$this->_firstPostContent = $parsed['post']['post'];
}
else if( $this->request['st'] AND ! $this->_firstPostContent )
else if( $this->request['page'] AND ! $this->_firstPostContent )
{
$this->_firstPostContent = $parsed['post']['post'];
}
@@ -452,7 +482,7 @@ class public_forums_forums_topics extends ipsCommand
/* Post number */
$this->post_count++;
$parsed['post']['post_count'] = intval($this->request['st']) + $this->post_count;
$parsed['post']['post_count'] = ( $this->request['page'] > 1 ) ? ( intval($this->request['page'] - 1) * $this->settings['display_max_posts'] ) + $this->post_count : $this->post_count;
if ( $parsed['post']['_isDeleted'] )
{
@@ -540,7 +570,7 @@ class public_forums_forums_topics extends ipsCommand
$st = (ceil(($topicData['posts']/$this->settings['display_max_posts'])) - $pages) * $this->settings['display_max_posts'];
}
$stUrlParam = ( $st ) ? "&st={$st}" : '';
$stUrlParam = ( $st ) ? '&page=' . $this->registry->getClass('topics')->stToPage( $st ) : '';
$this->registry->output->silentRedirect( $this->settings['base_url']."showtopic=".$topicData['tid'].$stUrlParam.$pid, $topicData['title_seo'], 302, 'showtopic' );
}
@@ -629,7 +659,7 @@ class public_forums_forums_topics extends ipsCommand
$post = $this->DB->fetch();
$stUrlParam = ( $st ) ? "&st={$st}" : '';
$stUrlParam = ( $st ) ? '&page=' . $this->registry->getClass('topics')->stToPage( $st ) : '';
$this->registry->output->silentRedirect($this->settings['base_url']."showtopic=".$topicData['tid']. $stUrlParam ."#entry".$post['pid'], $topicData['title_seo'], 302, 'showtopic' );
}
@@ -811,16 +841,16 @@ class public_forums_forums_topics extends ipsCommand
}
/* Member choices */
if ( $poll['poll_view_voters'] AND $voter['member_choices'] AND $this->settings['poll_allow_public'] )
if ( $voter['member_choices'] AND ( ( $poll['poll_view_voters'] AND $this->settings['poll_allow_public'] ) OR $voter['member_id'] == $this->memberData['member_id'] ) )
{
$_choices = unserialize( $voter['member_choices'] );
$_choices = IPSLib::safeUnserialize( $voter['member_choices'] );
if ( is_array( $_choices ) AND count( $_choices ) )
{
$memberData = array( 'member_id' => $voter['member_id'],
'members_seo_name' => $voter['members_seo_name'],
'members_display_name' => $voter['members_display_name'],
'members_colored_name' => str_replace( '"', '\"', IPSMember::makeNameFormatted( $voter['members_display_name'], $voter['member_group_id'] ) ),
'members_seo_name' => ( $voter['member_id'] == $this->memberData['member_id'] ) ? $this->memberData['members_seo_name'] : $voter['members_seo_name'],
'members_display_name' => ( $voter['member_id'] == $this->memberData['member_id'] ) ? $this->memberData['members_display_name'] : $voter['members_display_name'],
'members_colored_name' => str_replace( '"', '\"', ( $voter['member_id'] == $this->memberData['member_id'] ) ? IPSMember::makeNameFormatted( $this->memberData['members_display_name'], $this->memberData['member_group_id'] ) : IPSMember::makeNameFormatted( $voter['members_display_name'], $voter['member_group_id'] ) ),
'_last' => 0 );
foreach( $_choices as $_questionID => $data )
@@ -833,7 +863,7 @@ class public_forums_forums_topics extends ipsCommand
}
}
}
//-----------------------------------------
// Already Voted
//-----------------------------------------
@@ -891,11 +921,11 @@ class public_forums_forums_topics extends ipsCommand
// Parse it
//-----------------------------------------
$poll_answers = unserialize(stripslashes($poll['choices']));
$poll_answers = IPSLib::safeUnserialize(stripslashes($poll['choices']));
if( !is_array($poll_answers) OR !count($poll_answers) )
{
$poll_answers = unserialize( preg_replace( '!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", stripslashes( $poll['choices'] ) ) );
$poll_answers = IPSLib::safeUnserialize( preg_replace( '!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", stripslashes( $poll['choices'] ) ) );
}
if( !is_array($poll_answers) OR !count($poll_answers) )
{
@@ -946,7 +976,17 @@ class public_forums_forums_topics extends ipsCommand
continue;
}
$choice = IPSText::getTextClass( 'bbcode' )->parsePollTags($choice);
if ( stristr( $choice, '[img' ) || stristr( $choice, '[url' ) || stristr( $text, '[sharedmedia' ) )
{
if ( ! is_object( $this->_textParser ) )
{
/* Load parser */
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser' );
$this->_textParser = new $classToLoad();
}
$choice = $this->_textParser->parsePollTags( $choice );
}
if ( $showResults )
{
@@ -955,7 +995,7 @@ class public_forums_forums_topics extends ipsCommand
$width = $percent > 0 ? intval($percent * 2) : 0;
/* Voters */
if ( $poll['poll_view_voters'] AND $memberChoices[ $id ][ $choice_id ] )
if ( $memberChoices[ $id ][ $choice_id ] )
{
$voters = $memberChoices[ $id ][ $choice_id ];
$_tmp = $voters;
@@ -979,7 +1019,7 @@ class public_forums_forums_topics extends ipsCommand
}
}
}
$_editPoll = $this->registry->getClass('topics')->canEditPost( array( 'member_id' => $topicData['starter_id'], 'post_date' => $topicData['start_date'] ) );
$html = $this->registry->output->getTemplate('topic')->pollDisplay( $poll, $topicData, $forumData, $pollData, $showResults, $_editPoll );
@@ -1064,7 +1104,7 @@ class public_forums_forums_topics extends ipsCommand
{
$this->topic = $this->DB->fetch();
$this->registry->output->silentRedirect( $this->settings['base_url']."showtopic=".$topicData['tid'], $topicData['title_seo'], true, 'showtopic' );
$this->registry->output->silentRedirect( $this->settings['base_url']."showtopic=".$topicData['tid'], $topicData['title_seo'], 302, 'showtopic' );
}
else
{
@@ -1091,7 +1131,7 @@ class public_forums_forums_topics extends ipsCommand
{
$this->topic = $this->DB->fetch();
$this->registry->output->silentRedirect( $this->settings['base_url']."showtopic=".$topicData['tid'], $topicData['title_seo'], true, 'showtopic' );
$this->registry->output->silentRedirect( $this->settings['base_url']."showtopic=".$topicData['tid'], $topicData['title_seo'], 302, 'showtopic' );
}
else
{
@@ -1112,86 +1152,86 @@ class public_forums_forums_topics extends ipsCommand
}
else if ($this->request['view'] == 'findpost')
{
//-----------------------------------------
// Find a post
//-----------------------------------------
// Find a post
//-----------------------------------------
$pid = intval($this->request['p']);
$query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery('visible');
/* Can we deal with hidden posts? */
if ( $this->registry->class_forums->canQueuePosts( $topicData['forum_id'] ) )
{
if ( $permissionData['softDeleteSee'] )
{
/* See queued and soft deleted */
$query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array( 'approved', 'sdeleted', 'hidden' ) );
}
else
{
/* Otherwise, see queued and approved */
$query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array( 'visible', 'hidden' ) );
}
$search_hl = '';
if ( ! empty( $this->request['hl'] ) )
{
$search_hl .= "&amp;hl=" . urlencode( $this->request['hl'] );
}
/* Can we deal with hidden posts? */
$_perms = array( 'visible' );
if ( $this->registry->getClass('class_forums')->canSeeSoftDeletedPosts( false ) )
{
$_perms[] = 'sdelete';
}
if ( $this->registry->getClass('class_forums')->canQueuePosts( false ) )
{
$_perms[] = 'hidden';
}
if ( $this->registry->getClass('topics')->isArchived( $topicData ) && $this->registry->class_forums->fetchArchiveTopicType( $topicData ) != 'working' )
{
$cposts['posts'] = $this->archiveReader->getPostCount( $topicData['tid'], $_perms );
}
else
{
/* We cannot see hidden posts */
if ( $permissionData['softDeleteSee'] )
{
/* See queued and soft deleted */
$query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array('approved', 'sdeleted') );
}
}
if ( $pid > 0 )
{
$sort_value = $pid;
$sort_field = ($this->settings['post_order_column'] == 'pid') ? 'pid' : 'post_date';
$query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery('visible');
if($sort_field == 'post_date')
{
$date = $this->DB->buildAndFetch( array( 'select' => 'post_date', 'from' => 'posts', 'where' => 'pid=' . $pid ) );
$sort_value = $date['post_date'];
}
$this->DB->build( array( 'select' => 'COUNT(*) as posts', 'from' => 'posts', 'where' => "topic_id={$topicData['tid']} AND {$sort_field} <=" . intval( $sort_value ) . $query ) );
$this->DB->execute();
$query = $this->registry->class_forums->fetchPostHiddenQuery( $_perms );
$cposts = $this->DB->fetch();
if ( (($cposts['posts']) % $this->settings['display_max_posts']) == 0 )
if ( $pid > 0 )
{
$pages = ($cposts['posts']) / $this->settings['display_max_posts'];
$sort_value = $pid;
$sort_field = ($this->settings['post_order_column'] == 'pid') ? 'pid' : 'post_date';
if($sort_field == 'post_date')
{
$date = $this->DB->buildAndFetch( array( 'select' => 'post_date', 'from' => 'posts', 'where' => 'pid=' . $pid ) );
$sort_value = $date['post_date'];
}
$this->DB->build( array( 'select' => 'COUNT(*) as posts', 'from' => 'posts', 'where' => "topic_id={$topicData['tid']} AND {$sort_field} <=" . intval( $sort_value ) . ' AND ' . $query ) );
$this->DB->execute();
$cposts = $this->DB->fetch();
}
else
{
$number = ( ($cposts['posts']) / $this->settings['display_max_posts'] );
$pages = ceil($number);
$this->returnLastPost();
}
$st = ($pages - 1) * $this->settings['display_max_posts'];
if( $this->settings['post_order_sort'] == 'desc' )
{
$st = (ceil(($topicData['posts']/$this->settings['display_max_posts'])) - $pages) * $this->settings['display_max_posts'];
}
$search_hl = '';
if( !empty( $this->request['hl'] ) )
{
$search_hl .= "&amp;hl={$this->request['hl']}";
}
$stUrlParam = ( $st ) ? "&st={$st}" : '';
$this->registry->output->silentRedirect( $this->settings['base_url']."showtopic=".$topicData['tid']."{$stUrlParam}{$search_hl}"."#entry".$pid, $topicData['title_seo'], 302, 'showtopic' );
}
else
{
$this->returnLastPost();
}
if ( (($cposts['posts']) % $this->settings['display_max_posts']) == 0 )
{
$pages = ($cposts['posts']) / $this->settings['display_max_posts'];
}
else
{
$number = ( ($cposts['posts']) / $this->settings['display_max_posts'] );
$pages = ceil($number);
}
$st = ($pages - 1) * $this->settings['display_max_posts'];
if( $this->settings['post_order_sort'] == 'desc' )
{
$st = (ceil(($topicData['posts']/$this->settings['display_max_posts'])) - $pages) * $this->settings['display_max_posts'];
}
$stUrlParam = ( $st ) ? '&page=' . $this->registry->getClass('topics')->stToPage( $st ) : '';
$this->registry->output->silentRedirect( $this->settings['base_url']."showtopic=".$topicData['tid']."{$stUrlParam}{$search_hl}"."#entry".$pid, $topicData['title_seo'], 302, 'showtopic' );
}
}
}
@@ -1225,7 +1265,7 @@ class public_forums_forums_topics extends ipsCommand
}
/* Limit to 5 unique topics */
if ( count( $results ) )
if ( is_array( $results ) AND count( $results ) )
{
$_tmp = $results;
$results = array();
@@ -1241,18 +1281,24 @@ class public_forums_forums_topics extends ipsCommand
continue;
}
if( $_data['starter_id'] )
if ( ! $this->registry->permissions->check( 'view', $this->registry->class_forums->forum_by_id[ $_data['forum_id'] ] ) )
{
$loadIds[ $_data['starter_id'] ] = $_data['starter_id'];
continue;
}
$results[ $_data['tid'] ] = $_data;
if ( ! $this->registry->class_forums->forumsCheckAccess( $_data['forum_id'], 0, 'forum', array(), true ) )
{
continue;
}
if( $_data['starter_id'] ) {
$loadIds[ $_data['starter_id'] ] = $_data['starter_id']; }
$results[ $_data['tid'] ] = $_data;
/* Alreay got our 5 results? */
if ( count( $results ) == 5 )
{
break;
}
break; }
}
}
@@ -1319,7 +1365,7 @@ class public_forums_forums_topics extends ipsCommand
/* Hang on, can we post? */
if ( $this->memberData['member_id'] )
{
if ( $this->memberData['unacknowledged_warnings'] )
if ( $this->memberData['unacknowledged_warnings'] AND !$this->memberData['restrict_post'] )
{
//return false;
}
@@ -1564,10 +1610,10 @@ class public_forums_forums_topics extends ipsCommand
$topicData = $this->registry->getClass('topics')->getTopicData();
$forumData = $this->forumClass->getForumById( $topicData['forum_id'] );
$permissionData = $this->registry->getClass('topics')->getPermissionData();
$first = intval($this->request['st']) >=0 ? intval($this->request['st']) : 0;
$first = $this->registry->getClass('topics')->pageToSt( $this->request['page'] );
/* Default - just see all visible posts */
$queued_query_bit = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( 'visible', 'p.' );
$queued_query_bit = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( 'visible', '' );
/* Can we deal with hidden posts? */
if ( $this->registry->class_forums->canQueuePosts($topicData['forum_id']) )
@@ -1575,18 +1621,18 @@ class public_forums_forums_topics extends ipsCommand
if ( $permissionData['softDeleteSee'] )
{
/* See queued and soft deleted */
$queued_query_bit = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array( 'visible', 'hidden', 'sdeleted' ), 'p.' );
$queued_query_bit = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array( 'visible', 'hidden', 'sdeleted' ), '' );
}
else
{
/* Otherwise, see queued and approved */
$queued_query_bit = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array( 'visible', 'hidden' ), 'p.' );
$queued_query_bit = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array( 'visible', 'hidden' ), '' );
}
/* Specifically requesting to see queued posts only */
if ( $this->request['modfilter'] AND $this->request['modfilter'] == 'invisible_posts' )
{
$queued_query_bit = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( 'hidden', 'p.' );
$queued_query_bit = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( 'hidden', '' );
}
}
else
@@ -1595,14 +1641,14 @@ class public_forums_forums_topics extends ipsCommand
if ( $permissionData['softDeleteSee'] )
{
/* See queued and soft deleted */
$queued_query_bit = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array('approved', 'sdeleted'), 'p.' );
$queued_query_bit = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array('approved', 'sdeleted'), '' );
}
}
/* Did we specifically want to see soft deleted posts? */
if ( $this->request['modfilter'] == 'deleted_posts' AND $permissionData['softDeleteSee'] )
{
$queued_query_bit = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( 'sdeleted', 'p.' );
$queued_query_bit = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( 'sdeleted', '' );
}
/* Data Hook Location */
@@ -1615,14 +1661,25 @@ class public_forums_forums_topics extends ipsCommand
$_extraMember = ( is_array($dataHook['members']) && count($dataHook['members']) ) ? ',m.'.implode(',m.', $dataHook['members']) : '';
$_post_joins = array( array( 'select' => 'm.member_id as mid,m.name,m.member_group_id,m.email,m.joined,m.posts, m.last_visit, m.last_activity,m.login_anonymous,m.title as member_title, m.warn_level, m.warn_lastwarn, m.members_display_name, m.members_seo_name, m.member_banned, m.has_gallery, m.has_blog, m.members_bitoptions,m.mgroup_others'.$_extraMember,
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id=p.author_id',
'type' => 'left' ),
array( 'select' => 'pp.*',
'from' => array( 'profile_portal' => 'pp' ),
'where' => 'm.member_id=pp.pp_member_id',
'type' => 'left' ) );
$_post_joins = array(
array(
'select' => '',
'from' => array( 'posts' => 'p' ),
'where' => 'p.pid=z.pid'
),
array(
'select' => 'm.member_id as mid,m.name,m.member_group_id,m.email,m.joined,m.posts, m.last_visit, m.last_activity,m.login_anonymous,m.title as member_title, m.warn_level, m.warn_lastwarn, m.members_display_name, m.members_seo_name, m.member_banned, m.has_gallery, m.has_blog, m.members_bitoptions,m.mgroup_others'.$_extraMember,
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id=p.author_id',
'type' => 'left'
),
array(
'select' => 'pp.*',
'from' => array( 'profile_portal' => 'pp' ),
'where' => 'm.member_id=pp.pp_member_id',
'type' => 'left'
)
);
/* Warn system enabled? */
if( $this->settings['warn_on'] == 1 )
@@ -1687,17 +1744,35 @@ class public_forums_forums_topics extends ipsCommand
//-----------------------------------------
// Get posts
// See http://community.invisionpower.com/resources/bugs.html/_/ip-board/big-topics-i-mean-big-topics-r36577 for an explanation why this a bit odd
//-----------------------------------------
$this->DB->build( array( 'select' => 'p.*',
'from' => array( 'posts' => 'p' ),
'where' => 'p.topic_id='.$topicData['tid']. $queued_query_bit,
'order' => 'p.'.$this->settings['post_order_column'].' '.$this->settings['post_order_sort'],
'limit' => array( $first, $this->settings['display_max_posts'] ),
'add_join' => $_post_joins ) );
$oq = $this->DB->execute();
$this->DB->build( array(
'select' => 'p.*',
'from' => array( '( ****FROM**** )' => 'z' ),
'add_join' => $_post_joins
) );
$query = $this->DB->fetchSqlString();
$this->DB->flushQuery();
$this->DB->build( array(
'select' => 'pid, post_date',
'from' => 'posts',
'where' => 'topic_id='.$topicData['tid']. $queued_query_bit,
'order' => $this->settings['post_order_column'].' '.$this->settings['post_order_sort'],
'limit' => array( $first, $this->settings['display_max_posts'] )
) );
$query = str_replace( '****FROM****', $this->DB->fetchSqlString(), $query ) . " ORDER BY z." . $this->settings['post_order_column'] . " " . $this->settings['post_order_sort'];
$query = str_replace( $this->settings['sql_tbl_prefix'] . '(', '(', $query );
$this->DB->flushQuery();
$this->DB->allow_sub_select = TRUE;
$oq = $this->DB->query( $query );
if ( ! $this->DB->getTotalRows() )
{
if ( $first >= $this->settings['display_max_posts'] )
@@ -1726,8 +1801,9 @@ class public_forums_forums_topics extends ipsCommand
$this->DB->update( 'topics', array( 'posts' => $pcount['pcount'] ), "tid=".$topicData['tid'] );
}
$this->registry->output->silentRedirect($this->settings['base_url']."showtopic={$topicData['tid']}&view=getlastpost");
// This is now handled in app_class_forums::incorrectPageCallback to redirect to correct post */
//$this->registry->output->silentRedirect($this->settings['base_url']."showtopic={$topicData['tid']}&view=getlastpost");
}
}
@@ -1741,12 +1817,38 @@ class public_forums_forums_topics extends ipsCommand
// Format and print out the topic list
//-----------------------------------------
$modAll = ( $this->memberData['g_is_supmod'] or ( isset( $this->memberData['forumsModeratorData'][ $forumData['id'] ] ) and ( $this->memberData['forumsModeratorData'][ $forumData['id'] ]['delete_post'] or $this->memberData['forumsModeratorData'][ $forumData['id'] ]['split_move'] ) ) );
$this->registry->getClass('topics')->setTopicData('adCodeSet' , false );
$this->registry->getClass('topics')->setTopicData('ignoredUsers', $ignored_users );
$posts = array();
$this->DB->allow_sub_select = TRUE;
while ( $row = $this->DB->fetch( $oq ) )
{
/* Should we display the moderate checkbox for this post? */
$row['moddable'] = FALSE;
if
(
$modAll
or
(
isset( $this->memberData['forumsModeratorData'][ $forumData['id'] ] )
and
(
( $row['approved'] == 0 and $this->memberData['forumsModeratorData'][ $forumData['id'] ]['post_q'] )
or
( $row['queued'] == 2 and $this->memberData['forumsModeratorData'][ $forumData['id'] ]['bw_mod_un_soft_delete'] )
or
( $row['queued'] == 0 and $this->memberData['forumsModeratorData'][ $forumData['id'] ]['bw_mod_soft_delete'] )
)
)
)
{
$row['moddable'] = TRUE;
}
/* Add to array */
$row['member_id'] = $row['mid'];
$posts[ $row['pid'] ] = $row;
}
@@ -1755,6 +1857,44 @@ class public_forums_forums_topics extends ipsCommand
return $posts;
}
/**
* Returns the data for the best answer
* @param array $postData
*/
protected function _getBestAnswerFeature( array $postData, $topicData )
{
if ( $this->registry->class_forums->answerTopicsEnabled( $topicData['forum_id'] ) !== true )
{
return false;
}
if ( empty( $topicData['topic_answered_pid'] ) )
{
return false;
}
if ( in_array( $topicData['topic_answered_pid'], array_keys( $postData ) ) )
{
$postData[ $topicData['topic_answered_pid'] ]['post']['post'] = IPSText::stripAttachTag( $postData[ $topicData['topic_answered_pid'] ]['post']['post'] );
return $postData[ $topicData['topic_answered_pid'] ];
}
else
{
$result = $this->registry->topics->parsePost( $this->registry->topics->getPostById( $topicData['topic_answered_pid'] ) );
/* Hasn't been deleted has it? */
if ( ! $result['post']['pid'] )
{
$result = array();
}
$result[ $topicData['topic_answered_pid'] ]['post']['post'] = IPSText::stripAttachTag( $result[ $topicData['topic_answered_pid'] ]['post']['post'] );
return $result;
}
}
/**
* Topic set up ya'll
*
@@ -1778,7 +1918,7 @@ class public_forums_forums_topics extends ipsCommand
//-----------------------------------------
$this->request['start'] = ! empty( $this->request['start'] ) ? intval( $this->request['start'] ) : '';
$this->request['st'] = ! empty( $this->request['st'] ) ? intval( $this->request['st'] ) : '';
$this->request['page'] = ! empty( $this->request['page'] ) ? intval( $this->request['page'] ) : '';
$this->settings['post_order_column'] = ( $this->settings['post_order_column'] != 'post_date' ) ? 'pid' : 'post_date';
$this->settings['post_order_sort'] = ( $this->settings['post_order_sort'] != 'desc' ) ? 'asc' : 'desc';
@@ -1816,7 +1956,7 @@ class public_forums_forums_topics extends ipsCommand
}
$this->settings['_base_url'] = $this->settings['base_url'];
$this->first = intval( $this->request['st'] ) > 0 ? intval( $this->request['st'] ) : 0;
$this->first = $this->registry->getClass('topics')->pageToSt( $this->request['page'] );
$this->request['view'] = ! empty( $this->request['view'] ) ? $this->request['view'] : NULL ;
//-----------------------------------------
@@ -2014,12 +2154,12 @@ class public_forums_forums_topics extends ipsCommand
}
$topicData['SHOW_PAGES']
= $this->registry->output->generatePagination( array(
'totalItems' => ($topicData['posts']+1),
= $this->registry->output->generatePagination( array( 'totalItems' => ($topicData['posts']+1),
'itemsPerPage' => $this->settings['display_max_posts'],
'currentStartValue' => $this->first,
'currentPage' => intval( $this->request['page'] ),
'seoTitle' => $topicData['title_seo'],
'realTitle' => $topicData['title'],
'isPagesMode' => true,
'seoTemplate' => 'showtopic',
'baseUrl' => "showtopic=".$topicData['tid'].$hl ) );
@@ -2041,10 +2181,10 @@ class public_forums_forums_topics extends ipsCommand
//-----------------------------------------
// Multi PIDS?
//-----------------------------------------
$this->request['selectedpids'] = ! empty( $this->request['selectedpids'] ) ? $this->request['selectedpids'] : IPSCookie::get('modpids');
$this->request['selectedpidcount'] = 0 ;
IPSCookie::set('modpids', '', 0);
IPSDebug::setMemoryDebugFlag( "TOPIC: topics.php::topicSetUp", $_before );
@@ -7,7 +7,7 @@
* $Author: ips_terabyte $
* @since 14th May 2003
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
* @version v3.3.4
* @version v3.4.5
* $Revision: 8655 $
*/
@@ -2,18 +2,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Moderator actions
* Last Updated: $Date: 2012-07-03 11:43:57 -0400 (Tue, 03 Jul 2012) $
* Last Updated: $Date: 2013-05-01 17:35:09 -0400 (Wed, 01 May 2013) $
* </pre>
*
* @author $Author: AndyMillne $
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Revision: 11027 $
* @version $Revision: 12211 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -113,7 +113,7 @@ class public_forums_moderate_moderate extends ipsCommand
//-----------------------------------------
// Convert the code ID's into something
// use mere mortals can understand....
// us mere mortals can understand....
//-----------------------------------------
switch ( $this->request['do'] )
@@ -283,7 +283,7 @@ class public_forums_moderate_moderate extends ipsCommand
$archiveRestore->setManualUnarchive( $this->topic['tid'] );
/* Back to topic, then? */
$this->registry->output->silentRedirect( $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . '&st=' . intval( $this->request['st'] ), $this->topic['title_seo'], "showtopic" );
$this->registry->output->silentRedirect( $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . '&page=' . intval( $this->request['page'] ), $this->topic['title_seo'], "showtopic" );
}
/**
@@ -374,7 +374,7 @@ class public_forums_moderate_moderate extends ipsCommand
}
/* Done */
$this->registry->output->redirectScreen( $this->lang->words['cp_redirect_posts'], $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . '&amp;st=' . intval($this->request['st']), $this->topic['title_seo'], 'showtopic' );
$this->registry->output->redirectScreen( $this->lang->words['cp_redirect_posts'], $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . '&amp;page=' . intval( $this->request['page'] ), $this->topic['title_seo'], 'showtopic' );
}
}
@@ -529,7 +529,7 @@ class public_forums_moderate_moderate extends ipsCommand
/* Done */
$url = "showforum=" . $this->forum['id'];
$url = ( $this->request['st'] ) ? "showforum=" . $this->forum['id'] . '&amp;st=' . $this->request['st'] : $url;
$url = ( $this->request['st'] ) ? "showforum=" . $this->forum['id'] . '&amp;page=' . $this->request['page'] : $url;
$this->registry->output->redirectScreen( $this->lang->words['cp_redirect_topics'], $this->settings['base_url'] . $url, $this->forum['name_seo'], 'showforum' );
}
@@ -588,8 +588,15 @@ class public_forums_moderate_moderate extends ipsCommand
$this->registry->output->redirectScreen( $this->lang->words['redirect_modified'], $this->settings['base_url'] . "app=core&amp;module=modcp&amp;fromapp=forums&amp;tab=" . $_bits[1] . 'topics' );
}
}
$this->registry->output->redirectScreen( $this->lang->words['redirect_modified'], $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . "&amp;st=" . intval($this->request['st']), $this->topic['title_seo'], 'showtopic' );
$url = "showtopic=".$this->topic['tid']."&amp;page=".intval($this->request['page']);
if( $this->request['from'] == 'forum' )
{
$url = "showforum=".$this->topic['forum_id']."&amp;page=".intval($this->request['page']);
}
$this->registry->output->redirectScreen( $this->lang->words['redirect_modified'], $this->settings['base_url'] . $url, $this->request['from'] == 'forum' ? $this->forum['name_seo'] : $this->topic['title_seo'], $this->request['from'] == 'forum' ? 'showforum' : 'showtopic' );
}
/**
@@ -633,11 +640,11 @@ class public_forums_moderate_moderate extends ipsCommand
$words = $this->lang->words['p_unpinned'];
}
$url = "showtopic=".$this->topic['tid']."&amp;st=".intval($this->request['st']);
$url = "showtopic=".$this->topic['tid']."&amp;page=".intval($this->request['page']);
if( $this->request['from'] == 'forum' )
{
$url = "showforum=".$this->topic['forum_id']."&amp;st=".intval($this->request['st']);
$url = "showforum=".$this->topic['forum_id']."&amp;page=".intval($this->request['page']);
}
$this->registry->output->redirectScreen( $words, $this->settings['base_url'] . $url, $this->request['from'] == 'forum' ? $this->forum['name_seo'] : $this->topic['title_seo'], $this->request['from'] == 'forum' ? 'showforum' : 'showtopic' );
@@ -733,16 +740,35 @@ class public_forums_moderate_moderate extends ipsCommand
{
if ( $this->request['nr'] )
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . "findpost=" . $this->request['pid'] );
$this->registry->output->silentRedirect( $this->settings['base_url'] . "findpost=" . $this->request['pid'] . '&amp;t=' . $this->request['t'] );
}
else
{
$this->registry->output->redirectScreen( $this->lang->words['cp_redirect_posts'], $this->settings['base_url'] . "findpost=" . $this->request['pid'] );
$this->registry->output->redirectScreen( $this->lang->words['cp_redirect_posts'], $this->settings['base_url'] . "findpost=" . $this->request['pid'] . '&amp;t=' . $this->request['t'] );
}
}
else if ( $this->request['postdate'] )
{
if ( $this->request['nr'] )
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . "findpost=" . $this->request['postdate'] . '&amp;t=' . $this->request['t'] );
}
else
{
$this->registry->output->redirectScreen( $this->lang->words['cp_redirect_posts'], $this->settings['base_url'] . "findpost=" . $this->request['postdate'] . '&amp;t=' . $this->request['t'] );
}
}
else if ( $this->topic['tid'] )
{
$this->registry->output->redirectScreen( $this->lang->words['cp_redirect_posts'], $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . '&amp;st=' . intval($this->request['st']), $this->topic['title_seo'], 'showtopic' );
{
try
{
$this->registry->getClass('topics')->autoPopulate( null, false );
}
catch( Exception $e )
{
$this->registry->output->redirectScreen( $this->lang->words['cp_redirect_posts'], $this->settings['base_url'] . "showforum=" . $this->topic['forum_id'], $this->forum['name_seo'], "showforum" );
}
$this->registry->output->redirectScreen( $this->lang->words['cp_redirect_posts'], $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . '&amp;page=' . intval($this->request['page']), $this->topic['title_seo'], 'showtopic' );
}
}
@@ -788,7 +814,8 @@ class public_forums_moderate_moderate extends ipsCommand
while( $row = $this->DB->fetch( $post_query ) )
{
$row['post'] = IPSText::truncate( $row['post'], 800 );
// This causes HTML to get cut off sometimes
//$row['post'] = IPSText::truncate( $row['post'], 800 );
$row['date'] = ipsRegistry::getClass( 'class_localization')->getDate( $row['post_date'], 'LONG' );
/* Parse the post */
@@ -844,6 +871,12 @@ class public_forums_moderate_moderate extends ipsCommand
$this->_multiMovePost( $this->lang->words['cmp_notopic'] );
}
if( in_array( $move_to_topic['topic_archive_status'], array( $this->registry->class_forums->fetchTopicArchiveFlag( 'working' ), $this->registry->class_forums->fetchTopicArchiveFlag( 'archived' ), $this->registry->class_forums->fetchTopicArchiveFlag( 'restore' ) ) ) )
{
$this->request[ 'checked'] = 0 ;
$this->_multiMovePost( $this->lang->words['cmp_archived_topic'] );
}
$affected_ids = count( $this->pids );
//-----------------------------------------
@@ -1316,7 +1349,7 @@ class public_forums_moderate_moderate extends ipsCommand
if( $first_post['queued'] )
{
$topic_approved = 0;
$topic_approved = ( $first_post['queued'] == ipsRegistry::getClass('class_forums')->fetchPostHiddenFlag( 'hidden' ) ) ? ipsRegistry::getClass('class_forums')->fetchTopicHiddenFlag( 'queued' ) : ipsRegistry::getClass('class_forums')->fetchTopicHiddenFlag( 'sdeleted' );
$this->DB->update( 'posts', array( 'queued' => 0 ), 'pid=' . $first_post['pid'] );
}
@@ -1329,7 +1362,7 @@ class public_forums_moderate_moderate extends ipsCommand
{
if( function_exists('mb_convert_case') )
{
if( in_array( strtolower( $this->settings['gb_char_set'] ), array_map( 'strtolower', mb_list_encodings() ) ) )
if( in_array( mb_strtolower( $this->settings['gb_char_set'] ), array_map( 'mb_strtolower', mb_list_encodings() ) ) )
{
$this->request['title'] = mb_convert_case( $this->request['title'], MB_CASE_TITLE, $this->settings['gb_char_set'] );
}
@@ -1364,6 +1397,14 @@ class public_forums_moderate_moderate extends ipsCommand
) );
$new_topic_id = $this->DB->getInsertId();
//-----------------------------------------
// Add to delete log if we've hidden the new topic
//-----------------------------------------
if ( $topic_approved == ipsRegistry::getClass('class_forums')->fetchTopicHiddenFlag( 'sdeleted' ) ) {
IPSDeleteLog::addEntry( $new_topic_id, 'topic', '', $this->memberData );
}
//-----------------------------------------
// Move the posts
@@ -1425,7 +1466,7 @@ class public_forums_moderate_moderate extends ipsCommand
{
$this->_resetModerator( $this->topic['forum_id'] );
$this->_genericPermissionCheck( 'delete_post' );
$this->_genericPermissionCheck( 'split_merge' );
if ( count( $this->pids ) < 2 )
{
@@ -1688,6 +1729,15 @@ class public_forums_moderate_moderate extends ipsCommand
$this->DB->delete( 'posts', 'pid IN(' . implode( ",", $post_to_delete ) . ')' );
IPSDeleteLog::removeEntries( $post_to_delete, 'post', TRUE );
/* Handle Rep */
$this->DB->delete( 'reputation_cache' , "app='forums' AND type='pid' AND type_id IN(" . implode( ",", $post_to_delete ) . ")" );
$this->DB->delete( 'reputation_index' , "app='forums' AND type='pid' AND type_id IN(" . implode( ",", $post_to_delete ) . ")" );
foreach( $post_to_delete as $post )
{
$this->DB->delete( 'reputation_totals', "rt_key=MD5('forums;pid;" . $post . "') AND rt_type_id=" . $post );
}
}
foreach( $topics as $t )
@@ -1766,7 +1816,7 @@ class public_forums_moderate_moderate extends ipsCommand
$this->_addModeratorLog( $this->lang->words['acp_locked_topic'] );
$this->registry->output->redirectScreen( $this->lang->words['p_closed'], $this->settings['base_url'] . "showforum=".$this->forum['id'] . ( $this->request['_from'] == 'forum' ? '&st=' . intval( $this->request['st'] ) : '' ), $this->forum['name_seo'], "showforum" );
$this->registry->output->redirectScreen( $this->lang->words['p_closed'], $this->settings['base_url'] . "showforum=".$this->forum['id'] . ( $this->request['_from'] == 'forum' ? '&page=' . intval( $this->request['page'] ) : '' ), $this->forum['name_seo'], "showforum" );
}
/**
@@ -1797,7 +1847,7 @@ class public_forums_moderate_moderate extends ipsCommand
$this->modLibrary->topicToggleSoftDelete( array( $this->topic['tid'] ), $delete, $reason );
$this->registry->output->redirectScreen( $this->lang->words[ $lang ], $this->settings['base_url'] . "showforum=" . $this->forum['id'] . '&st=' . intval( $this->request['st'] ), $this->forum['name_seo'], 'showforum' );
$this->registry->output->redirectScreen( $this->lang->words[ $lang ], $this->settings['base_url'] . "showforum=" . $this->forum['id'] . '&page=' . intval( $this->request['page'] ), $this->forum['name_seo'], 'showforum' );
}
/**
@@ -1843,7 +1893,7 @@ class public_forums_moderate_moderate extends ipsCommand
}
}
$this->registry->output->redirectScreen( $this->lang->words['p_deleted'], $this->settings['base_url'] . "showforum=" . $this->forum['id'] . '&st=' . intval( $this->request['st'] ), $this->forum['name_seo'], 'showforum' );
$this->registry->output->redirectScreen( $this->lang->words['p_deleted'], $this->settings['base_url'] . "showforum=" . $this->forum['id'], $this->forum['name_seo'], 'showforum' );
}
/**
@@ -1889,7 +1939,7 @@ class public_forums_moderate_moderate extends ipsCommand
}
}
$this->registry->output->redirectScreen( $this->lang->words['p_deleted'], $this->settings['base_url'] . "showforum=" . $this->forum['id'] . '&st=' . intval( $this->request['st'] ), $this->forum['name_seo'], 'showforum' );
$this->registry->output->redirectScreen( $this->lang->words['p_deleted'], $this->settings['base_url'] . "showforum=" . $this->forum['id'] . '&page=' . intval( $this->request['page'] ), $this->forum['name_seo'], 'showforum' );
}
/**
@@ -2109,7 +2159,7 @@ class public_forums_moderate_moderate extends ipsCommand
$_like = classes_like::bootstrap( 'forums', 'topics' );
$_like->remove( $this->topic['tid'] );
$this->registry->output->redirectScreen( $this->lang->words['ts_redirect'], $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . "&amp;st=" . intval($this->request['st']), $this->topic['title_seo'], 'showtopic' );
$this->registry->output->redirectScreen( $this->lang->words['ts_redirect'], $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . "&amp;page=" . intval($this->request['page']), $this->topic['title_seo'], 'showtopic' );
}
/**
@@ -2306,23 +2356,19 @@ class public_forums_moderate_moderate extends ipsCommand
$this->DB->update( 'attachments', array( 'attach_parent_id' => $this->topic['tid'] ), "attach_rel_module='post' AND attach_parent_id=" . $old_topic['tid'] );
//-----------------------------------------
// Get like class
// Update followers
//-----------------------------------------
require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
$_like = classes_like::bootstrap( 'forums', 'topics' );
$_like->remove( $old_topic['tid'] );
$_like = classes_like::bootstrap( 'forums', 'topics' );
$_like->merge( $old_topic['tid'], $this->topic['tid'] );
//-----------------------------------------
// Tags
//-----------------------------------------
$this->registry->tags->moveTagsByMetaId( $old_topic['tid'], $this->topic['tid'] );
// Resync to remove duplicate tags - see bug report 34475
$tags = $this->registry->tags->getTagsByMetaId( $this->topic['tid'] );
$this->registry->tags->replace( $tags['tags'], array( 'meta_id' => $this->topic['tid'] ) );
//-----------------------------------------
// Update the newly merged topic
//-----------------------------------------
@@ -2566,8 +2612,27 @@ class public_forums_moderate_moderate extends ipsCommand
$this->registry->output->redirectScreen( $this->lang->words['post_deleted'], $this->settings['base_url'] . "app=core&amp;module=modcp&amp;fromapp=forums&amp;tab=" . $_bits[1] . 'posts' );
}
}
//-----------------------------------------
// Where are we going?
//-----------------------------------------
$this->registry->output->redirectScreen( $this->lang->words['post_deleted'], $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . "&amp;st=" . intval($this->request['st']), $this->topic['title_seo'], 'showtopic' );
$posts = $this->registry->getClass('topics')->getPosts( array( 'topicId' => $this->topic['tid'],
'limit' => 1,
'skipForumCheck' => true,
'dateIsLess' => $post['post_date'],
'onlyViewable' => true,
'onlyVisible' => true,
'notIgnored' => true,
'parse' => false,
'getCount' => false,
'sortField' => 'date',
'sortOrder' => 'desc' ) );
$redirectPost = array_keys($posts);
$redirectPage = $this->registry->getClass('topics')->postToPage( $redirectPost[0] );
$this->registry->output->redirectScreen( $this->lang->words['post_deleted'], $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . "&amp;page=" . intval($redirectPage) . '#entry' . $redirectPost[0], $this->topic['title_seo'], 'showtopic' );
}
/**
@@ -2620,23 +2685,23 @@ class public_forums_moderate_moderate extends ipsCommand
$this->request['TopicTitle'] = $_postClass->cleanTopicTitle( $this->request['TopicTitle'] );
$this->request['TopicTitle'] = trim( IPSText::getTextClass( 'bbcode' )->stripBadWords( $this->request['TopicTitle'] ) );
if( $this->settings['etfilter_shout'] )
{
if( function_exists('mb_convert_case') )
{
if( in_array( strtolower( $this->settings['gb_char_set'] ), array_map( 'strtolower', mb_list_encodings() ) ) )
{
$this->request['TopicTitle'] = mb_convert_case( $this->request['TopicTitle'], MB_CASE_TITLE, $this->settings['gb_char_set'] );
}
else
{
$this->request['TopicTitle'] = ucwords( strtolower( $this->request['TopicTitle'] ) );
}
}
else
{
$this->request['TopicTitle'] = ucwords( strtolower( $this->request['TopicTitle'] ) );
}
if( $this->settings['etfilter_shout'] )
{
if( function_exists('mb_convert_case') )
{
if( in_array( strtolower( $this->settings['gb_char_set'] ), array_map( 'strtolower', mb_list_encodings() ) ) )
{
$this->request['TopicTitle'] = mb_convert_case( $this->request['TopicTitle'], MB_CASE_TITLE, $this->settings['gb_char_set'] );
}
else
{
$this->request['TopicTitle'] = ucwords( strtolower( $this->request['TopicTitle'] ) );
}
}
else
{
$this->request['TopicTitle'] = ucwords( strtolower( $this->request['TopicTitle'] ) );
}
}
$this->request['TopicDesc'] = trim( IPSText::getTextClass( 'bbcode' )->stripBadWords( $this->request['TopicDesc'] ) );
@@ -2679,7 +2744,7 @@ class public_forums_moderate_moderate extends ipsCommand
$this->_addModeratorLog( $this->lang->words['acp_opened_topic'] );
$_st = '&st=' . intval( $this->request['st'] );
$_st = '&page=' . intval( $this->request['page'] );
if( $this->request['_fromTopic'] )
{
@@ -3189,7 +3254,7 @@ class public_forums_moderate_moderate extends ipsCommand
else if ( $this->forum['id'] )
{
$url = "showforum=" . $this->forum['id'];
$url = ( $this->request['st'] ) ? "showforum=" . $this->forum['id'] . '&amp;st=' . $this->request['st'] : $url;
$url = ( $this->request['st'] ) ? "showforum=" . $this->forum['id'] . '&amp;page=' . $this->request['page'] : $url;
if ( $this->request['nr'] )
{
@@ -3382,18 +3447,31 @@ class public_forums_moderate_moderate extends ipsCommand
$this->DB->update( 'posts', array( 'queued' => 1 ), 'topic_id IN (' . implode( ",", $unapproved ) . ")" );
}
$this->DB->update( 'posts', array( 'topic_id' => $main_topic_id ), 'topic_id IN (' . implode( ",", $merge_ids ) . ")" );
$this->DB->update( 'posts', array( 'topic_id' => $main_topic_id, 'new_topic' => 0 ), 'topic_id IN (' . implode( ",", $merge_ids ) . ")" );
$this->DB->update( 'topics', array( 'views' => $newViews ), 'tid=' . $main_topic_id );
/* @Link http://community.invisionpower.com/resources/bugs.html/_/ip-board/merging-topics-does-not-update-attach-parent-id-for-attachments-r41886 */
$this->DB->update( 'attachments', array( 'attach_parent_id' => $main_topic_id ), 'attach_parent_id IN(' . implode( ",", $merge_ids ) . ") AND attach_rel_module='post'" );
$this->DB->delete( 'voters', "tid IN (" . implode( ",", $merge_ids ) . ")" );
$this->DB->delete( 'topics', "tid IN (" . implode( ",", $merge_ids ) . ")" );
/* Bug #38221: Set the new first post in topic */
$first_post = $this->DB->buildAndFetch( array( 'select' => 'pid', 'from' => 'posts', 'where' => "topic_id={$main_topic_id}", 'order' => "pid ASC", 'limit' => array(0,1) ) );
$this->DB->update( 'posts', array( 'new_topic' => 1 ), 'pid = ' . $first_post['pid'] );
//-----------------------------------------
// Get like class
// Update followers
//-----------------------------------------
require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
$_like = classes_like::bootstrap( 'forums', 'topics' );
$_like->remove( $merge_ids );
$_like = classes_like::bootstrap( 'forums', 'topics' );
foreach ( $merge_ids as $mid )
{
$_like->merge( $mid, $main_topic_id );
}
//-----------------------------------------
// Remove from delete log
@@ -3414,9 +3492,6 @@ class public_forums_moderate_moderate extends ipsCommand
/* Tags */
$this->registry->tags->moveTagsByMetaId( $tids, $main_topic_id );
/* Make read */
$this->registry->getClass('classItemMarking')->markRead( array( 'forumID' => $first_topic['forum_id'], 'itemID' => $main_topic_id, 'markDate' => time(), 'containerLastActivityDate' => $this->registry->class_forums->allForums[ $first_topic['forum_id'] ]['last_post'] ) );
/* Run Sync */
foreach ( $merge_ids as $mid )
{
@@ -3860,6 +3935,14 @@ class public_forums_moderate_moderate extends ipsCommand
) ),
"tid IN(" . implode( ',', $this->tids ) . ")", false, true
);
//-----------------------------------------
// Rebuild topic for SEO title
//-----------------------------------------
foreach( $this->tids as $tid )
{
$this->modLibrary->rebuildTopic( $tid );
}
}
//-----------------------------------------
@@ -3,9 +3,9 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Moderator actions
* Last Updated: $Date: 2012-06-13 12:05:06 -0400 (Wed, 13 Jun 2012) $
* Last Updated: $Date: 2013-01-17 15:51:17 -0500 (Thu, 17 Jan 2013) $
* </pre>
*
* @author $Author: AndyMillne $
@@ -14,7 +14,7 @@
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Revision: 10916 $
* @version $Revision: 11859 $
*
*/
@@ -284,9 +284,9 @@ class public_forums_moderate_multimod extends ipsCommand
IPSText::getTextClass('bbcode')->parse_html = 1;
IPSText::getTextClass('bbcode')->parse_nl2br = 1;
IPSText::getTextClass('bbcode')->parsing_section = 'topics';
$this->modLibrary->topicAddReply(
$this->mm_data['topic_reply_content']
IPSText::getTextClass('bbcode')->preDbParse( str_replace( array( "\n", "\r" ), '', nl2br( $this->mm_data['topic_reply_content'] ) ) )
, array( 0 => array( $this->topic['tid'], $this->forum['id'] ) )
, $this->mm_data['topic_reply_postcount']
);
@@ -7,7 +7,7 @@
* $Author: ips_terabyte $
* @since 14th May 2003
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
* @version v3.3.4
* @version v3.4.5
* $Revision: 8655 $
*/
@@ -2,19 +2,19 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Posting
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $Date: 2013-01-29 18:38:34 -0500 (Tue, 29 Jan 2013) $
* </pre>
* File Created By: Matt Mecham
*
* @author $Author: bfarber $
* @author $Author: AndyMillne $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 10914 $
* @version $Rev: 11914 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -66,7 +66,7 @@ class public_forums_post_post extends ipsCommand
// Make sure our input doCode element is legal.
//-----------------------------------------
if ( ! isset( $doCodes[ $do ] ) )
if ( ! is_string( $do ) || ! isset( $doCodes[ $do ] ) )
{
$this->registry->getClass('output')->showError( 'posting_bad_action', 103125 );
}
@@ -257,40 +257,15 @@ class public_forums_post_post extends ipsCommand
{
ipsRegistry::getClass('output')->silentRedirect( "{$this->settings['base_url']}t={$topic['tid']}&amp;f={$topic['forum_id']}&amp;auth_key={$this->memberData['form_hash']}&amp;app=forums&amp;module=moderate&amp;section=moderate&amp;do=02" );
}
/* Bug #40789 This is no longer required since findpost additions in 3.4
else if ( $this->settings['post_order_sort'] == 'desc' )
{
ipsRegistry::getClass('output')->silentRedirect( $this->settings['base_url']."showtopic=" . $this->_postClass->getTopicID() . "&#entry" . $this->_postClass->getPostID(), $topic['title_seo'] );
}
*/
else
{
$permissions['softDelete'] = $this->registry->getClass('class_forums')->canSoftDeletePosts( $topic['forum_id'], $topic );
$permissions['softDeleteSee'] = $this->registry->getClass('class_forums')->canSeeSoftDeletedPosts( $topic['forum_id'] );
$posts = $topic['posts'] + 1;
if( $this->moderator['post_q'] OR $this->memberData['g_is_supmod'] )
{
$posts += $topic['topic_queuedposts'];
}
if ( $permissions['softDelete'] AND $permissions['softDeleteSee'] )
{
$posts += $topic['topic_deleted_posts'];
}
if( ( $posts % $this->settings['display_max_posts'] ) == 0 )
{
$page = ( ($posts) / $this->settings['display_max_posts'] );
}
else
{
$page = ( ($posts) / $this->settings['display_max_posts'] );
$page = ceil($page) - 1;
}
$page = $page * $this->settings['display_max_posts'];
ipsRegistry::getClass('output')->silentRedirect( $this->settings['base_url']."showtopic={$topic['tid']}&st=$page&gopid={$post['pid']}&#entry{$post['pid']}", $topic['title_seo'] );
ipsRegistry::getClass('output')->silentRedirect( $this->settings['base_url']."showtopic={$topic['tid']}&amp;p={$post['pid']}", $topic['title_seo'] );
}
}
catch( Exception $error )
@@ -349,7 +324,7 @@ class public_forums_post_post extends ipsCommand
}
# Redirect
ipsRegistry::getClass('output')->redirectScreen( $this->lang->words['post_edited'], $this->settings['base_url'] . "showtopic={$topic['tid']}&st=" . $this->request['st'] . "#entry{$post['pid']}", $topic['title_seo'] );
ipsRegistry::getClass('output')->redirectScreen( $this->lang->words['post_edited'], $this->settings['base_url'] . "showtopic={$topic['tid']}&st=" . $this->request['st'] . "&p={$post['pid']}", $topic['title_seo'] );
}
catch( Exception $error )