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

@@ -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 ) )
{