Version 3.2.3

This commit is contained in:
Neo committed 2025-12-19 00:34:03 -08:00
1 parent ae5c01cc78
commit 78706903a2
2641 files changed
+228363 -201264

No files matched your search

@@ -2,18 +2,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Grab attachments and return via AJAX (AJAX)
* Last Updated: $Date: 2010-10-20 09:03:17 -0400 (Wed, 20 Oct 2010) $
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Revision: 7003 $
* @link http://hatynka.in
* @version $Revision: 8644 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -28,7 +28,7 @@ class public_forums_ajax_attachments extends ipsAjaxCommand
* Class entry point
*
* @param object ipsRegistry reference
* @return void [Outputs to screen]
* @return @e void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
@@ -81,7 +81,7 @@ class public_forums_ajax_attachments extends ipsAjaxCommand
}
else
{
$this->returnHtml( $this->registry->getClass('output')->getTemplate('forum')->forumAttachmentsAjaxWrapper( $attachHTML ) );
$this->returnHtml( $attachHTML );
}
}
}
@@ -1,31 +1,14 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* Default section file for forum ajax module
* Last Updated: $LastChangedDate: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @file defaultSection.php Define the default section for the 'ajax' module
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: This is NULLED!
* $Author: ips_terabyte $
* @since 14th May 2003
* @version $Rev: 5713 $
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
* @version v3.2.3
* $Revision: 8655 $
*/
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();
}
/**
* Very simply returns the default section if one is not
* passed in the URL
*/
$DEFAULT_SECTION = 'topics';
@@ -2,18 +2,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Ourputs emoticon list via AJAX (AJAX)
* Last Updated: $Date: 2010-04-15 15:46:26 -0400 (Thu, 15 Apr 2010) $
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: bfarber $
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 6133 $
* @link http://hatynka.in
* @version $Rev: 8644 $
*
*/
@@ -28,9 +28,8 @@ class public_forums_ajax_emoticons extends ipsAjaxCommand
/**
* Class entry point
*
* @access public
* @param object ipsRegistry reference
* @return void [Outputs to screen]
* @return @e void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
@@ -0,0 +1,105 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* Fetch topics and other data from the forum
* Last Updated: $Date: 2011-09-14 20:13:56 -0400 (Wed, 14 Sep 2011) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://hatynka.in
* @version $Revision: 9491 $
*
*/
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_ajax_forums extends ipsAjaxCommand
{
/**
* Main class entry point
*
* @param object ipsRegistry reference
* @return @e void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
switch( $this->request['do'] )
{
default:
case 'getTopics':
$this->_getTopics();
break;
case 'markRead':
$this->_markRead();
break;
}
}
/**
* Mark topic as read
*/
protected function _markRead()
{
$fid = intval( $this->request['fid'] );
$this->registry->getClass('classItemMarking')->markRead( array( 'forumID' => $fid ) );
$this->returnJsonArray( array( 'status' => 'ok' ) );
}
/**
* Get topics from a forum
*
* @return @e void [Outputs to screen]
*/
protected function _getTopics()
{
//-----------------------------------------
// Reset input
//-----------------------------------------
$_GET['showforum'] = intval($_GET['f']);
ipsRegistry::$request['showforum'] = intval(ipsRegistry::$request['f']);
if ( $_GET['showforum'] < 1 )
{
$this->returnJsonArray( array( 'error' => 'incorrect_f' ) );
}
//-----------------------------------------
// Get the forum controller
//-----------------------------------------
$classToLoad = IPSLib::loadActionOverloader( IPSLib::getAppDir( 'forums' ) . '/modules_public/forums/forums.php', 'public_forums_forums_forums' );
$forums = new $classToLoad();
$forums->makeRegistryShortcuts( $this->registry );
$forums->initForums();
$forums->buildPermissions();
$data = $forums->renderForum();
$html = '';
if( is_array( $data['topic_data'] ) && count( $data['topic_data'] ) )
{
foreach( $data['topic_data'] as $idx => $tdata )
{
$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'] ) );
}
}
@@ -5,6 +5,6 @@
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionboard.com/">IP.Board</a>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -3,18 +3,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Ajax Functions For Topics
* Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: bfarber $
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Revision: 5713 $
* @link http://hatynka.in
* @version $Revision: 8644 $
*
*/
@@ -29,9 +29,8 @@ class public_forums_ajax_markasread extends ipsAjaxCommand
/**
* IPS command execution
*
* @access public
* @param object ipsRegistry reference
* @return void
* @return @e void
*/
public function doExecute( ipsRegistry $registry )
{
@@ -54,9 +53,8 @@ class public_forums_ajax_markasread extends ipsAjaxCommand
/**
* Marks the specified forum as read
*
* @access public
* @return void
**/
* @return @e void
*/
public function markForumAsRead()
{
//-----------------------------------------
@@ -2,18 +2,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Retrieve who posted stats
* Last Updated: $Date: 2010-10-20 09:03:17 -0400 (Wed, 20 Oct 2010) $
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Revision: 7003 $
* @link http://hatynka.in
* @version $Revision: 8644 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -28,7 +28,7 @@ class public_forums_ajax_stats extends ipsAjaxCommand
* Main class entry point
*
* @param object ipsRegistry reference
* @return void [Outputs to screen]
* @return @e void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
@@ -43,7 +43,7 @@ class public_forums_ajax_stats extends ipsAjaxCommand
/**
* Retrieve posters in a given topic
*
* @return void [Outputs to screen]
* @return @e void [Outputs to screen]
*/
protected function _whoPosted()
{
@@ -61,7 +61,7 @@ class public_forums_ajax_stats extends ipsAjaxCommand
}
else
{
$this->returnHtml( $this->registry->getClass('output')->getTemplate('stats')->whoPostedAjaxWrapper( $output ) );
$this->returnHtml( $output );
}
}
}
@@ -2,18 +2,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Ajax Functions For Topics
* Last Updated: $Date: 2010-10-20 09:03:17 -0400 (Wed, 20 Oct 2010) $
* Last Updated: $Date: 2011-09-26 10:20:55 -0400 (Mon, 26 Sep 2011) $
* </pre>
*
* @author $Author: ips_terabyte $
* @author $Author: mmecham $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Revision: 7003 $
* @link http://hatynka.in
* @version $Revision: 9547 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -28,10 +28,17 @@ class public_forums_ajax_topics extends ipsAjaxCommand
* Class entry point
*
* @param object Registry reference
* @return void [Outputs for the ajax handler]
* @return @e void [Outputs for the ajax handler]
*/
public function doExecute( ipsRegistry $registry )
{
/* Load topic class */
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 ) );
}
$this->lang->loadLanguageFile( array( 'public_topic', 'public_mod' ), 'forums' );
//-----------------------------------------
@@ -52,10 +59,6 @@ class public_forums_ajax_topics extends ipsAjaxCommand
case 'saveTopicTitle':
$this->saveTopicTitle();
break;
case 'saveTopicDescription':
$this->saveTopicDescription();
break;
case 'rateTopic':
$this->rateTopic();
@@ -68,68 +71,574 @@ class public_forums_ajax_topics extends ipsAjaxCommand
case 'preview':
$this->_topicPreview();
break;
case 'reply':
$this->_reply();
break;
case 'reputation':
$this->reputation();
case 'quote':
case 'mqquote':
$this->_quote();
break;
case 'pollForReplies':
$this->_pollForReplies();
break;
case 'getNewPosts':
$this->_getNewPosts();
break;
case 'markRead':
$this->_markRead();
break;
case 'sigCloseMenu':
$this->_sigCloseMenu();
break;
case 'ignoreSig':
$this->_ignoreSig();
break;
}
}
/**
* Displays reputation popup
*
* @return void
*/
protected function reputation()
protected function _ignoreSig()
{
if ( !$this->memberData['gbw_view_reps'] )
$memberId = trim( $this->request['memberId'] );
$memberId = ( is_numeric( $memberId ) ) ? $memberId : 'all';
/* Whut */
if ( $memberId == 'all' )
{
$this->returnJsonError('no_permission');
IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'view_sigs' => 0 ) ) );
}
else
{
/* Insert or update? */
$ignored = IPSMember::fetchIgnoredUsers( $this->memberData );
if ( ! empty( $ignored[ $memberId ] ) )
{
/* Update */
$this->DB->update( 'ignored_users', array( 'ignore_signatures' => 1 ), 'ignore_owner_id=' . $this->memberData['member_id'] . ' AND ignore_ignore_id=' . $memberId );
}
else
{
$this->DB->insert( 'ignored_users', array( 'ignore_owner_id' => $this->memberData['member_id'],
'ignore_ignore_id' => $memberId,
'ignore_messages' => 0,
'ignore_topics' => 0,
'ignore_signatures' => 1 ) );
}
/* Rebuild cache */
IPSMember::rebuildIgnoredUsersCache( $this->memberData );
}
$this->returnJsonArray( array( 'status' => 'ok' ) );
}
$postID = intval( $this->request['post'] );
protected function _sigCloseMenu()
{
$pid = intval( $this->request['pid'] );
/* Get data */
$reps = array();
$this->DB->build( array(
'select' => 'member_id, rep_rating',
'from' => 'reputation_index',
'where' => "app='forums' AND type='pid' AND type_id='{$postID}'",
'order' => 'rep_date',
) );
$q = $this->DB->execute();
while ( $r = $this->DB->fetch( $q ) )
/* Fetch post */
$post = $this->registry->getClass('topics')->getPostById( $pid );
$this->registry->getClass('topics')->setTopicData( $post );
if ( $this->registry->getClass('topics')->canView() )
{
$r['member'] = IPSMember::load( $r['member_id'] );
$reps[] = $r;
return $this->returnHtml( $this->registry->output->getTemplate('topic')->ajaxSigCloseMenu( $post ) );
}
else
{
$this->returnJsonError( 'nopermission' );
}
}
protected function _markRead()
{
$tid = intval( $this->request['tid'] );
return $this->returnHtml( $this->registry->output->getTemplate('topic')->reputationPopup( $reps ) );
/* Get latest post */
$post = $this->registry->getClass('topics')->getPosts( array( 'topicId' => $tid, 'sortField' => 'pid', 'sortOrder' => 'desc', 'offset' => 0, 'limit' => 1 ) );
$post = array_pop( $post );
$forum = $this->registry->class_forums->getForumById( $post['forum_id'] );
$this->registry->getClass('classItemMarking')->markRead( array( 'forumID' => $post['forum_id'], 'itemID' => $tid, 'markDate' => $post['post_date'], 'containerLastActivityDate' => $forum['last_post'] ) );
$this->returnJsonArray( array( 'status' => 'ok' ) );
}
/**
* Polls for replies innit
*/
protected function _pollForReplies()
{
$topicId = intval( $this->request['t'] );
$topPid = intval( $this->request['pid'] );
/* Can we view this topic? */
$this->registry->getClass('topics')->setTopicData( $topicId );
/* Can we view? */
if ( $this->registry->getClass('topics')->canView() !== true )
{
$this->returnJsonArray( array( 'count' => 0 ) );
}
/* Get posts */
$posts = $this->_getPosts( $topicId, $topPid, $this->registry->getClass('topics')->getTopicData('forum_id') );
/* Got anything sailor? */
if ( ! count( $posts ) )
{
$this->returnJsonArray( array( 'count' => 0 ) );
}
else
{
$this->returnJsonArray( array( 'count' => count( $posts ), 'data' => $posts ) );
}
}
/**
* Fetches the new posts to insert into the live page ...
*/
protected function _getNewPosts()
{
$topicId = intval( $this->request['t'] );
$topPid = intval( $this->request['pid'] );
/* Can we view this topic? */
$this->registry->getClass('topics')->setTopicData( $topicId );
/* Can we view? */
if ( $this->registry->getClass('topics')->canView() !== true )
{
$this->returnHtml( '' );
}
/* Get posts */
$posts = $this->_getPosts( $topicId, $topPid, $this->registry->getClass('topics')->getTopicData('forum_id') );
/* Got anything sailor? */
if ( ! count( $posts ) )
{
$this->returnHtml( '' );
}
else
{
$html = '';
foreach( $posts as $pid => $data )
{
$html .= $this->registry->output->getTemplate('topic')->post( $data, array(), $this->registry->getClass('topics')->getTopicData() );
}
$this->returnHtml( $html );
}
}
/**
* Fetches posts
* @param INT Topic ID
* @param INT Top PID
* @param INT Forum ID
*/
protected function _getPosts( $topicId, $topPid, $forumId )
{
IPSDebug::fireBug( 'info', array( 'Retrieving posts for topic id ' . $topicId . ' where pid is greater than ' . $topPid ) );
/* Reset viewing member id - can be set to someone else by post class (e.g. in the sendOutQuoteNotifications() method) */
$this->registry->getClass('topics')->setMemberData( $this->memberData );
/* Get posts */
$posts = $this->registry->getClass('topics')->getPosts( array( 'topicId' => $topicId,
'pidIsGreater' => $topPid,
'onlyViewable' => true,
'onlyVisible' => true,
'parse' => true,
'forumId' => $forumId,
'limit' => 50,
'sortKey' => 'date',
'sortOrder' => 'asc' ) );
if ( count( $posts ) )
{
/* Fetch post count ID */
$this->registry->getClass('topics')->getPosts( array( 'topicId' => $topicId,
'pidIsLess' => $topPid,
'onlyViewable' => true,
'onlyVisible' => true,
'parse' => false,
'getCount' => true,
'forumId' => $forumId,
'limit' => 50,
'sortKey' => 'date',
'sortOrder' => 'asc' ) );
$count = $this->registry->getClass('topics')->getPostsCount();
$count++;
foreach( $posts as $id => $data )
{
$posts[ $id ]['post']['post_count'] = ++$count;
}
}
/* Parse attachments */
$topic = $this->registry->getClass('topics')->getTopicData();
if( $topic['topic_hasattach'] )
{
//-----------------------------------------
// INIT. Yes it is
//-----------------------------------------
$postHTML = array();
//-----------------------------------------
// Separate out post content
//-----------------------------------------
foreach( $posts as $id => $post )
{
$postHTML[ $id ] = $post['post']['post'];
}
//-----------------------------------------
// Grab render attach class
//-----------------------------------------
if ( ! is_object( $this->class_attach ) )
{
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'core' ) . '/sources/classes/attach/class_attach.php', 'class_attach' );
$this->class_attach = new $classToLoad( $this->registry );
}
//-----------------------------------------
// Not got permission to view downloads?
//-----------------------------------------
if ( $this->registry->permissions->check( 'download', $this->registry->class_forums->forum_by_id[ $topic['forum_id'] ] ) === FALSE )
{
$this->settings['show_img_upload'] = 0;
}
//-----------------------------------------
// Continue...
//-----------------------------------------
$this->class_attach->type = 'post';
$this->class_attach->init();
$attachHTML = $this->class_attach->renderAttachments( $postHTML, array_keys( $posts ) );
/* Now parse back in the rendered posts */
if( is_array($attachHTML) AND count($attachHTML) )
{
foreach( $attachHTML as $id => $data )
{
/* Get rid of any lingering attachment tags */
if ( stristr( $data['html'], "[attachment=" ) )
{
$data['html'] = IPSText::stripAttachTag( $data['html'] );
}
$posts[ $id ]['post']['post'] = $data['html'];
$posts[ $id ]['post']['attachmentHtml'] = $data['attachmentHtml'];
}
}
}
return $posts;
}
/**
* Fetches data to quote
*
* @return @e void
*/
protected function _quote()
{
/* Init */
$tid = intval( $this->request['t'] );
$pid = intval( $this->request['p'] );
$pids = explode( ',', IPSText::cleanPermString( $this->request['pids'] ) );
$posts = array();
$_post = '';
/* Load editor stuff */
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite' );
$this->editor = new $classToLoad();
/* Set up topic */
if( $pid )
{
$posts[] = $this->registry->getClass('topics')->getPostById( $pid );
}
else
{
foreach( $pids as $pid )
{
$posts[] = $this->registry->getClass('topics')->getPostById( $pid );
}
}
/* Permission ids */
$perm_id = $this->memberData['org_perm_id'] ? $this->memberData['org_perm_id'] : $this->memberData['g_perm_id'];
$perm_array = explode( ",", $perm_id );
/* Naughty boy chex */
foreach( $posts as $post )
{
/* Set up data */
$this->registry->getClass('topics')->setTopicData( $post );
if ( $this->registry->getClass('topics')->canView() !== true )
{
$this->returnJsonError( 'nopermission' );
}
if ( $this->registry->permissions->check( 'read', $this->registry->class_forums->getForumById( $post['forum_id'] ), $perm_array ) !== TRUE )
{
$this->returnJsonError( 'nopermission' );
}
/* Post visible? */
if ( $this->registry->getClass('class_forums')->fetchHiddenType( $post ) != 'visible' )
{
$this->returnJsonError( 'nopermission' );
}
/* Phew that was a toughy wasn't it? */
if ( $this->settings['strip_quotes'] )
{
$post['post'] = IPSText::getTextClass( 'bbcode' )->stripQuotes( $post['post'] );
}
/* Strip shared media in quotes */
$post['post'] = IPSText::getTextClass( 'bbcode' )->stripSharedMedia( $post['post'] );
/* We don't use makeQuoteSafe() here because the result is returned via AJAX and inserted as text into the editor. + shows as &#043; as a result if we do */
$_quoted = preg_replace( '/(<br\s*\/?>\s*)+$/', "<br />", "<br />" . rtrim($post['post']) . "<br />" );
$_post .= "[quote name='" . ( $post['members_display_name'] ? $post['members_display_name'] : $post['author_name'] ) . "' timestamp='" . $post['post_date'] . "' post='" . $post['pid'] . "']{$_quoted}[/quote]<br />";
}
$this->editor->setContent( $_post, 'topics' );
$this->returnHtml( $this->editor->getContent() );
}
/**
* Saves the post
*
* @return @e void
*/
protected function _reply()
{
/* Init */
$fid = intval( $this->request['f'] );
$tid = intval( $this->request['t'] );
$topPid = intval( $this->request['pid'] );
/* Basic checks */
if ( ! $tid )
{
$this->returnJsonError( $this->lang->words['ajax_reply_noperm'] );
}
if ( $this->memberData['member_id'] )
{
if ( $this->memberData['restrict_post'] )
{
if ( $this->memberData['restrict_post'] == 1 )
{
$this->returnJsonError( $this->lang->words['ajax_reply_noperm'] );
}
$post_arr = IPSMember::processBanEntry( $this->memberData['restrict_post'] );
if ( time() >= $post_arr['date_end'] )
{
//-----------------------------------------
// Update this member's profile
//-----------------------------------------
IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'restrict_post' => 0 ) ) );
}
else
{
$this->returnJsonError( $this->lang->words['ajax_reply_noperm'] );
}
}
}
/* Load lang and classes */
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'public_topics' ) );
if ( ! is_object( $this->postClass ) )
{
require_once( IPSLib::getAppDir( 'forums' ) . '/sources/classes/post/classPost.php' );/*noLibHook*/
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/sources/classes/post/classPostForms.php', 'classPostForms', 'forums' );
$this->postClass = new $classToLoad( $this->registry );
}
/* Fetch topic data */
$topicData = $this->registry->getClass('topics')->getTopicById( $tid );
if ( ! $this->registry->getClass('topics')->canView( $topicData ) )
{
$this->returnJsonError( $this->lang->words['ajax_reply_noperm'] );
}
/* Duplicate posts */
if ( time() - $this->memberData['last_post'] <= 4 )
{
$_lastPost = $this->DB->buildAndFetch( array( 'select' => 'topic_id',
'from' => 'posts',
'where' => 'author_id=' . $this->memberData['member_id'],
'order' => 'post_date DESC',
'limit' => array( 0, 1 ) ) );
/* We made a reply within the last 4 seconds to this topic.. */
if ( $_lastPost['topic_id'] == $tid )
{
$this->returnJsonError( $this->lang->words['topic_duplicate_post'] );
}
}
/* Set post class data */
$this->postClass->setForumData( $this->registry->getClass('class_forums')->getForumById( $topicData['forum_id'] ) );
$this->postClass->setTopicID( $tid );
$this->postClass->setForumID( $fid );
$this->postClass->setSettings( array( 'enableSignature' => 1,
'enableEmoticons' => 1,
'post_htmlstatus' => 0,
'enableTracker' => 0 ) );
/* Topic Data */
$this->postClass->setTopicData( $topicData );
$this->postClass->setAuthor( $this->member->fetchMemberData() );
$this->postClass->setIsAjax( TRUE );
$this->postClass->setPublished( 'reply' );
$this->postClass->setPostContent( $_POST['Post'] );
/* POST */
try
{
/**
* If there was an error, return it as a JSON error
*/
if ( $this->postClass->addReply() === FALSE )
{
$this->returnJsonError( $this->postClass->getPostError() );
}
/* If it requires preview, return a message */
if( $this->postClass->getPublished() === false )
{
$this->returnJsonArray( array( 'success' => 1, 'message' => $this->lang->words['thanks_need_preview'] ) );
}
IPSDebug::fireBug( 'info', array( 'The post was successfully saved...' ) );
$topic = $this->postClass->getTopicData();
$post = $this->postClass->getPostData();
/* If we are merging, back up one */
if( $post['pid'] == $topPid )
{
$topPid--;
}
/* Mark topic as read */
$this->registry->getClass('classItemMarking')->markRead( array( 'forumID' => $topic['forum_id'], 'itemID' => $topic['tid'] ) );
/* Can we report? */
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir('core') . '/sources/classes/reportLibrary.php', 'reportLibrary', 'core' );
$reports = new $classToLoad( $this->registry );
/* Can we view this topic? */
$this->registry->getClass('topics')->setTopicData( $topic );
$topic = $this->registry->getClass('topics')->getTopicData();
$topic['_canReport'] = $reports->canReport( 'post' );
/* Get posts */
$posts = $this->_getPosts( $tid, $topPid, $this->registry->getClass('topics')->getTopicData('forum_id') );
IPSDebug::fireBug( 'info', array( 'Found ' . count($posts) . ' posts...' ) );
/* Got anything sailor? */
if ( ! count( $posts ) )
{
$this->returnHtml( '' );
}
else
{
$html = '';
$lastpid = 0;
foreach( $posts as $pid => $data )
{
$html .= $this->registry->output->getTemplate('topic')->post( $data, array(), $topic, $this->postClass->getForumData() );
$lastpid = $pid;
}
if( count($posts) == 1 )
{
$this->returnJsonArray( array( 'success' => 1, 'post' => $html, 'postid' => $lastpid ), true );
}
else
{
$this->returnHtml( $html );
}
}
}
catch ( Exception $error )
{
$this->returnJsonError( $error->getMessage() );
}
}
/**
* Displays a topic preview
*
* @return void
* @return @e void
*/
protected function _topicPreview()
{
/* INIT */
$tid = intval( $this->request['tid'] );
$pid = intval( $this->request['pid'] );
$sTerm = trim( $this->request['searchTerm'] );
$topic = array();
$posts = array();
$query = '';
$tid = intval( $this->request['tid'] );
$pid = intval( $this->request['pid'] );
$sTerm = trim( $this->request['searchTerm'] );
$topic = array();
$posts = array();
$permissions = array();
$query = '';
/* Topic visibility */
$_perms = array( 'visible' );
if ( $this->registry->getClass('class_forums')->canSeeSoftDeletedTopics( false ) )
{
$_perms[] = 'sdelete';
}
if ( $this->registry->getClass('class_forums')->canQueuePosts( false ) )
{
$_perms[] = 'hidden';
}
/* Grab topic data and first post */
$topic = $this->DB->buildAndFetch( array( 'select' => 't.*, t.title as topic_title, t.posts as topic_posts, t.last_post as topic_last_post',
'from' => array( 'topics' => 't' ),
'where' => 't.tid=' . $tid,
'where' => $this->registry->class_forums->fetchTopicHiddenQuery( $_perms, 't.' ) . ' AND t.tid=' . $tid,
'add_join' => array( array( 'select' => 'p.*',
'from' => array( 'posts' => 'p' ),
'where' => 'p.pid=topic_firstpost',
'where' => 'p.pid=t.topic_firstpost',
'type' => 'left' ),
array( 'select' => 'm.*',
'from' => array( 'members' => 'm' ),
@@ -148,7 +657,8 @@ class public_forums_ajax_topics extends ipsAjaxCommand
/* Permission check */
if ( $this->registry->class_forums->forumsCheckAccess( $topic['forum_id'], 0, 'topic', $topic, true ) !== true )
{
return $this->returnHtml( $this->registry->output->getTemplate('global_other')->ajaxPopUpNoPermission() );
return $this->returnString( 'no_permission' );
//return $this->returnHtml( $this->registry->output->getTemplate('global_other')->ajaxPopUpNoPermission() );
}
/* Build permissions */
@@ -228,6 +738,9 @@ class public_forums_ajax_topics extends ipsAjaxCommand
while( $r = $this->DB->fetch() )
{
$r['tid'] = $topic['tid'];
$r['title_seo'] = $topic['title_seo'];
if ( $r['pid'] == $count['max'] )
{
$posts['last'] = $r;
@@ -278,15 +791,26 @@ class public_forums_ajax_topics extends ipsAjaxCommand
{
$data = IPSMember::buildDisplayData( $data );
IPSText::getTextClass( 'bbcode' )->parse_smilies = $data['use_emo'];
IPSText::getTextClass( 'bbcode' )->parse_html = ( $this->registry->class_forums->forum_by_id[ $topic['forum_id'] ]['use_html'] and $this->caches['group_cache'][ $data['member_group_id'] ]['g_dohtml'] and $data['post_htmlstate'] ) ? 1 : 0;
IPSText::getTextClass( 'bbcode' )->parse_nl2br = $data['post_htmlstate'] == 2 ? 1 : 0;
IPSText::getTextClass( 'bbcode' )->parse_bbcode = $this->registry->class_forums->forum_by_id[ $topic['forum_id'] ]['use_ibc'];
IPSText::getTextClass( 'bbcode' )->parsing_section = 'topics';
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $data['member_group_id'];
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $data['mgroup_others'];
$data['post'] = IPSText::getTextClass( 'bbcode' )->stripQuotes( $data['post'] );
$data['post'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $data['post'] );
/* Search term? */
if ( $k == 'search' AND $pid AND $sTerm )
{
$data['post'] = IPSText::truncateTextAroundPhrase( IPSText::getTextClass( 'bbcode' )->stripAllTags( str_replace( '<br />', ' ', $data['post'] ) ), $sTerm );
$data['post'] = IPSText::truncateTextAroundPhrase( IPSText::getTextClass( 'bbcode' )->stripAllTags( str_replace( '<br />', ' ', strip_tags( $data['post'], '<br>' ) ) ), $sTerm );
$data['post'] = IPSText::searchHighlight( $data['post'], $sTerm );
}
else
{
$data['post'] = IPSText::truncate( IPSText::getTextClass( 'bbcode' )->stripAllTags( $data['post'] ), 500 );
$data['post'] = IPSText::truncate( IPSText::getTextClass( 'bbcode' )->stripAllTags( strip_tags( $data['post'], '<br>' ) ), 500 );
}
$data['_isVisible'] = ( $this->registry->getClass('class_forums')->fetchHiddenType( $data ) == 'visible' ) ? true : false;
@@ -304,7 +828,7 @@ class public_forums_ajax_topics extends ipsAjaxCommand
/**
* Toggle the posts approve thingy
*
* @return void
* @return @e void
*/
protected function _postApproveToggle()
{
@@ -350,7 +874,7 @@ class public_forums_ajax_topics extends ipsAjaxCommand
/**
* Add vote to rating
*
* @return void
* @return @e void
*/
public function rateTopic()
{
@@ -468,18 +992,14 @@ class public_forums_ajax_topics extends ipsAjaxCommand
/**
* Saves a ajax topic title edit
*
* @return void
* @return @e void
*/
public function saveTopicTitle()
{
/* INIT */
IPSDebug::fireBug( 'info', array( 'Initial name: ' . $_POST['name'] ) );
$name = $_POST['name'];
IPSDebug::fireBug( 'info', array( 'after convert and make safe: ' . $name ) );
$tid = intval( $this->request['tid'] );
$can_edit = 0;
IPSDebug::fireBug( 'info', array( 'The topic title after converting is: ' . $name ) );
/* Check ID */
if( ! $tid )
@@ -600,74 +1120,12 @@ class public_forums_ajax_topics extends ipsAjaxCommand
$title = trim( $title );
return $title;
}
/**
* Saves a ajax topic description edit
*
* @return void
*/
public function saveTopicDescription()
{
/* INIT */
$description = $this->convertAndMakeSafe( $this->request['description'], TRUE );
$tid = intval( $this->request['tid'] );
$can_edit = 0;
/* Check ID */
if( ! $tid )
{
$this->returnString( $this->lang->words['ajax_no_topic_id'] );
}
/* Load Topic */
$topic = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'topics', 'where' => 'tid=' . $tid ) );
if( ! $topic['tid'] )
{
$this->returnString( $this->lang->words['ajax_topic_not_found'] );
}
/* Check Permissions */
if ( $this->memberData['g_is_supmod'] )
{
$can_edit = 1;
}
if( $this->memberData['forumsModeratorData'][ $topic['forum_id'] ]['edit_topic'] )
{
$can_edit = 1;
}
if( ! $can_edit )
{
$this->class_ajax->returnString( $this->lang->words['ajax_no_t_permission'] );
}
/* Update the description */
$this->DB->update( 'topics', array( 'description' => $description ), 'tid=' . $tid );
$this->DB->insert( 'moderator_logs', array(
'forum_id' => intval( $topic['forum_id'] ),
'topic_id' => $tid,
'member_id' => $this->memberData['member_id'],
'member_name' => $this->memberData['members_display_name'],
'ip_address' => $this->input['IP_ADDRESS'],
'http_referer'=> htmlspecialchars( my_getenv('HTTP_REFERER') ),
'ctime' => time(),
'topic_title' => $topic['title'],
'action' => $this->lang->words['ajax_topicdesc'],
'query_string'=> htmlspecialchars( my_getenv('QUERY_STRING') ),
) );
/* All Done */
$this->returnString( 'success' );
}
/**
* Saves the post
*
* @return void
* @return @e void
*/
public function editBoxSave()
{
@@ -731,7 +1189,7 @@ class public_forums_ajax_topics extends ipsAjaxCommand
if ( ! is_object( $this->postClass ) )
{
require_once( IPSLib::getAppDir( 'forums' ) . '/sources/classes/post/classPost.php' );
require_once( IPSLib::getAppDir( 'forums' ) . '/sources/classes/post/classPost.php' );/*noLibHook*/
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/sources/classes/post/classPostForms.php', 'classPostForms', 'forums' );
$this->postClass = new $classToLoad( $this->registry );
@@ -744,8 +1202,9 @@ class public_forums_ajax_topics extends ipsAjaxCommand
$this->postClass->setTopicID( $tid );
$this->postClass->setPostID( $pid );
$this->postClass->setForumID( $fid );
$this->postClass->setPublished( 'reply' );
if( isset($this->request['post_htmlstatus']) ) // Off is "0"
if( isset($this->request['post_htmlstatus']) ) // Off is "0"
{
$this->postClass->setSettings( array( 'post_htmlstatus' => $this->request['post_htmlstatus'] ) );
}
@@ -854,7 +1313,7 @@ class public_forums_ajax_topics extends ipsAjaxCommand
/**
* Shows the edit box
*
* @return void
* @return @e void
*/
public function editBoxShow()
{
@@ -910,32 +1369,19 @@ class public_forums_ajax_topics extends ipsAjaxCommand
{
$this->registry->getClass( 'class_localization')->loadLanguageFile( array( 'public_editors' ), 'core' );
require_once( IPSLib::getAppDir( 'forums' ) . "/sources/classes/post/classPost.php" );
require_once( IPSLib::getAppDir( 'forums' ) . "/sources/classes/post/classPost.php" );/*noLibHook*/
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/sources/classes/post/classPostForms.php', 'classPostForms', 'forums' );
$this->postClass = new $classToLoad( $this->registry );
}
# Forum Data
$this->postClass->setForumData( $this->registry->getClass('class_forums')->forum_by_id[ $fid ] );
# IDs
/* Set post class data */
$this->postClass->setForumData( $this->registry->getClass('class_forums')->getForumById( $fid ) );
$this->postClass->setTopicID( $tid );
$this->postClass->setPostID( $pid );
$this->postClass->setForumID( $fid );
$this->postClass->setPostID( $pid );
/* Topic Data */
$this->postClass->setTopicData( $this->DB->buildAndFetch( array(
'select' => 't.*, p.poll_only',
'from' => array( 'topics' => 't' ),
'where' => "t.forum_id={$fid} AND t.tid={$tid}",
'add_join' => array(
array(
'type' => 'left',
'from' => array( 'polls' => 'p' ),
'where' => 'p.tid=t.tid'
)
)
) ) );
$this->postClass->setTopicData( $this->registry->getClass('topics')->getTopicById( $tid ) );
# Set Author
$this->postClass->setAuthor( $this->member->fetchMemberData() );
@@ -1,69 +0,0 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* Member property updater (AJAX)
* Last Updated: $Date: 2010-04-15 15:46:26 -0400 (Thu, 15 Apr 2010) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Revision: 6133 $
*
*/
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_ajax_usercp extends ipsAjaxCommand
{
/**
* Main class entry point
*
* @access public
* @param object ipsRegistry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
switch( $this->request['do'] )
{
case 'get_avatar_images':
$this->_getAvatarImages();
break;
}
}
/**
* Get avatar images in a directory
*
* @access protected
* @return void [Outputs to screen]
*/
protected function _getAvatarImages()
{
$dir = urldecode( $this->request['cat'] );
$images = IPSMember::getFunction()->getHostedAvatarsFromCategory( $dir );
if ( $images === FALSE )
{
$this->returnJsonError( $this->lang->words['ajax_avatar_dir'] );
exit();
}
else
{
$output = $this->registry->getClass('output')->getTemplate('ucp')->forumsInlineAvatarImages( $images, $dir );
$this->returnHtml( $output );
}
}
}
@@ -2,19 +2,19 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Board Rules
* Last Updated: $Date: 2010-06-10 06:36:42 -0400 (Thu, 10 Jun 2010) $
* Last Updated: $Date: 2011-08-18 17:50:15 -0400 (Thu, 18 Aug 2011) $
* </pre>
*
* @author $Author $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @link http://hatynka.in
* @since 20th February 2002
* @version $Rev: 6502 $
* @version $Rev: 9399 $
*/
if ( ! defined( 'IN_IPB' ) )
{
@@ -25,44 +25,25 @@ if ( ! defined( 'IN_IPB' ) )
class public_forums_extras_boardrules extends ipsCommand
{
/**
* Temporary stored output
* Class entry point
*
* @access public
* @var string
* @param object Registry reference
* @return @e void [Outputs to screen/redirects]
*/
public $output = "";
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
/* Get board rule (not cached) */
$row = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_sys_conf_settings', 'where' => "conf_key='gl_guidelines'" ) );
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
IPSText::getTextClass('bbcode')->parse_html = 1;
IPSText::getTextClass('bbcode')->parse_nl2br = 1;
IPSText::getTextClass('bbcode')->parse_emoticons = 1;
IPSText::getTextClass('bbcode')->parsing_section = 'global';
$row['conf_value'] = IPSText::getTextClass('bbcode')->preDbParse( $row['conf_value'] );
$row['conf_value'] = IPSText::getTextClass('bbcode')->preDisplayParse( $row['conf_value'] );
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 = 'global';
/* Hacky fix for bug #15632 */
//$row['conf_value'] = str_replace( '<ul><br />' , '<ul>', $row['conf_value'] );
//$row['conf_value'] = str_replace( '<ul' , '<ul class="bbc"', $row['conf_value'] );
//$row['conf_value'] = str_replace( '</li><br />' , '</li>', $row['conf_value'] );
//$row['conf_value'] = str_replace( '</ul><br />' , '</ul>', $row['conf_value'] );
//$row['conf_value'] = preg_replace( '#<li([^\n]*)<br />#', '<li$1', $row['conf_value'] );
$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'], $row['conf_value'] ) );
$this->registry->output->addContent( $this->registry->output->getTemplate('emails')->boardRules( $this->settings['gl_title'], IPSText::getTextClass( 'bbcode' )->preDisplayParse( $row['conf_value'] ) ) );
$this->registry->output->sendOutput();
}
}
@@ -1,31 +1,14 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* Default forum extras module section
* Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
* </pre>
*
* @author $Author $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @file defaultSection.php Define the default section for the 'extras' module
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: This is NULLED!
* $Author: ips_terabyte $
* @since 20th February 2002
* @version $Rev: 5713 $
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
* @version v3.2.3
* $Revision: 8655 $
*/
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();
}
/**
* Very simply returns the default section if one is not
* passed in the URL
*/
$DEFAULT_SECTION = 'stats';
@@ -3,19 +3,19 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Forward a topic to someone
* Last Updated: $Date: 2010-10-14 06:42:56 -0400 (Thu, 14 Oct 2010) $
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: mmecham $
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @link http://hatynka.in
* @since 20th February 2002
* @version $Revision: 6975 $
* @version $Revision: 8644 $
*
*/
@@ -30,7 +30,6 @@ class public_forums_extras_forward extends ipsCommand
/**
* Temporary stored output HTML
*
* @access public
* @var string
*/
public $output;
@@ -38,27 +37,24 @@ class public_forums_extras_forward extends ipsCommand
/**
* Forum information
*
* @access private
* @var array Array of forum details
*/
private $forum = array();
protected $forum = array();
/**
* Topic information
*
* @access private
* @var array Array of topic details
*/
private $topic = array();
protected $topic = array();
private $page = array();
protected $page = array();
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
@@ -157,10 +153,9 @@ class public_forums_extras_forward extends ipsCommand
/**
* Forward the page (sends the email)
*
* @access private
* @return void [Outputs to screen/redirects]
* @return @e void [Outputs to screen/redirects]
*/
private function _sendEmail()
protected function _sendEmail()
{
//-----------------------------------------
// Check
@@ -220,16 +215,15 @@ class public_forums_extras_forward extends ipsCommand
IPSText::getTextClass('email')->from = $this->memberData['email'];
IPSText::getTextClass('email')->sendMail();
$this->registry->output->redirectScreen( $this->lang->words['redirect'], $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . "&amp;st=" . $this->request['st'] );
$this->registry->output->redirectScreen( $this->lang->words['redirect'], $this->page['url'] );
}
/**
* Show the form to forward the page
*
* @access private
* @return void [Outputs to screen/redirects]
* @return @e void [Outputs to screen/redirects]
*/
private function _showForm( $msg='' )
protected function _showForm( $msg='' )
{
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_email_content' ), 'core' );
@@ -270,5 +264,4 @@ class public_forums_extras_forward extends ipsCommand
$this->registry->output->addContent( $this->output );
$this->registry->output->sendOutput();
}
}
@@ -5,6 +5,6 @@
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionboard.com/">IP.Board</a>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -2,18 +2,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Emoticon and BBCode Legends
* Last Updated: $Date: 2010-06-10 06:36:42 -0400 (Thu, 10 Jun 2010) $
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 6502 $
* @link http://hatynka.in
* @version $Rev: 8644 $
*
*/
@@ -28,7 +28,6 @@ class public_forums_extras_legends extends ipsCommand
/**
* Output
*
* @access public
* @var string
*/
public $output = "";
@@ -36,9 +35,8 @@ class public_forums_extras_legends extends ipsCommand
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
@@ -66,9 +64,8 @@ class public_forums_extras_legends extends ipsCommand
/**
* Displays the emoticon list popup
*
* @access public
* @return void
**/
* @return @e void
*/
public function emoticonsPopUpList()
{
/* INIT */
@@ -117,9 +114,8 @@ class public_forums_extras_legends extends ipsCommand
/**
* Show BBCode Helpy file
*
* @access public
* @return void
**/
* @return @e void
*/
public function bbcodePopUpList()
{
/* Load the Parser */
@@ -3,19 +3,19 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Add rating fallback
* Last Updated: $Date: 2010-05-07 19:47:39 -0400 (Fri, 07 May 2010) $
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: bfarber $
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @link http://hatynka.in
* @since 20th February 2002
* @version $Revision: 6250 $
* @version $Revision: 8644 $
*
*/
@@ -30,7 +30,6 @@ class public_forums_extras_rating extends ipsCommand
/**
* Forum data
*
* @access public
* @var array
*/
public $forum = array();
@@ -38,7 +37,6 @@ class public_forums_extras_rating extends ipsCommand
/**
* Topic data
*
* @access public
* @var array
*/
public $topic = array();
@@ -46,9 +44,8 @@ class public_forums_extras_rating extends ipsCommand
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
@@ -64,7 +61,6 @@ class public_forums_extras_rating extends ipsCommand
$topic_id = intval($this->request['t']);
$rating_id = intval($this->request['rating']);
$vote_cast = array();
$this->registry->class_localization->loadLanguageFile( array( 'public_topic' ) );
@@ -173,11 +169,11 @@ class public_forums_extras_rating extends ipsCommand
$this->DB->update( 'topics', array( 'topic_rating_total' => intval($this->topic['topic_rating_total']) + $new_rating ), 'tid=' . $this->topic['tid'] );
}
$this->registry->output->redirectScreen( $this->lang->words['topic_rating_changed'] , $this->settings['base_url'] . "showtopic={$this->topic['tid']}&amp;st=" . $this->request['st'] );
$this->registry->output->redirectScreen( $this->lang->words['topic_rating_changed'] , $this->settings['base_url'] . "showtopic={$this->topic['tid']}&amp;st=" . $this->request['st'], $this->topic['title_seo'], 'showtopic' );
}
else
{
$this->registry->output->redirectScreen( $this->lang->words['topic_rated_already'] , $this->settings['base_url'] . "showtopic={$this->topic['tid']}&amp;st=" . $this->request['st'] );
$this->registry->output->redirectScreen( $this->lang->words['topic_rated_already'] , $this->settings['base_url'] . "showtopic={$this->topic['tid']}&amp;st=" . $this->request['st'], $this->topic['title_seo'], 'showtopic' );
}
}
@@ -201,6 +197,6 @@ class public_forums_extras_rating extends ipsCommand
), 'tid=' . $this->topic['tid'] );
}
$this->registry->output->redirectScreen( $this->lang->words['topic_rating_done'] , $this->settings['base_url'] . "showtopic={$this->topic['tid']}&amp;st=" . $this->request['st'] );
$this->registry->output->redirectScreen( $this->lang->words['topic_rating_done'] , $this->settings['base_url'] . "showtopic={$this->topic['tid']}&amp;st=" . $this->request['st'], $this->topic['title_seo'], 'showtopic' );
}
}
@@ -3,19 +3,19 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Member stats functions
* Last Updated: $Date: 2010-10-18 17:06:14 -0400 (Mon, 18 Oct 2010) $
* Last Updated: $Date: 2011-05-12 17:45:20 -0400 (Thu, 12 May 2011) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @link http://hatynka.in
* @since 20th February 2002
* @version $Revision: 6991 $
* @version $Revision: 8752 $
*
*/
@@ -45,7 +45,7 @@ class public_forums_extras_stats extends ipsCommand
* Class entry point
*
* @param object Registry reference
* @return void [Outputs to screen/redirects]
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
@@ -108,12 +108,14 @@ class public_forums_extras_stats extends ipsCommand
/* Ok, so the group by causes a temp table then filesort which can be slow but alternative is to loop over all
posts and sort in PHP which could be slower when hundreds of replies so we get a bit smart about it */
$_queued = $this->registry->class_forums->fetchPostHiddenQuery( array( 'visible' ), '' );
if ( $topic['posts'] >= 100 )
{
$this->DB->build( array( 'select' => 'COUNT(pid) as pcount, author_id',
'from' => 'posts',
'where' => "topic_id={$tid} AND queued=0",
'where' => "topic_id={$tid} AND " . $_queued,
'group' => 'author_id',
'order' => 'pcount DESC' ) );
@@ -137,10 +139,10 @@ class public_forums_extras_stats extends ipsCommand
{
$_tmp = array();
$_tmp2 = array();
$this->DB->build( array( 'select' => 'author_id',
'from' => 'posts',
'where' => "topic_id={$tid} AND queued=0" ) );
'where' => "topic_id={$tid} AND " . $_queued ) );
$this->DB->execute();
@@ -202,7 +204,7 @@ class public_forums_extras_stats extends ipsCommand
// Guests
//-----------------------------------------
$guests = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as guest_posts', 'from' => 'posts', 'where' => "topic_id={$tid} AND queued=0 AND author_id=0" ) );
$guests = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as guest_posts', 'from' => 'posts', 'where' => "topic_id={$tid} AND {$_queued} AND author_id=0" ) );
if( $guests['guest_posts'] )
{
@@ -235,7 +237,7 @@ class public_forums_extras_stats extends ipsCommand
*
* @param integer Topic id
* @param boolean Return on error instead of printing
* @return void [Prints error if you cannot access]
* @return @e void [Prints error if you cannot access]
*/
protected function _checkAccess( $tid, $returnOnError=false )
{
@@ -277,7 +279,7 @@ class public_forums_extras_stats extends ipsCommand
/**
* Show the forum leaders
*
* @return void [Outputs to screen]
* @return @e void [Outputs to screen]
*/
protected function _showLeaders()
{
@@ -319,7 +321,7 @@ class public_forums_extras_stats extends ipsCommand
{
$group_ids[ $i['group_id'] ] = $i['group_id'];
}
else
else if( $i['member_id'] )
{
$member_ids[ $i['member_id'] ] = $i['member_id'];
}
@@ -509,7 +511,7 @@ class public_forums_extras_stats extends ipsCommand
}
}
}
else if( array_key_exists( $member['member_id'], $moderators ) && ( ($data['is_group'] and $data['group_id'] == $member['member_group_id']) || $data['member_id'] == $member['member_id'] ) )
else if( isset( $moderators[ $member['member_id'] ] ) && ( ($data['is_group'] and $data['group_id'] == $member['member_group_id']) || $data['member_id'] == $member['member_id'] ) )
{
$moderators[ $member['member_id'] ]['forums'][ $data['forum_id'] ] = $data['forum_id'];
}
@@ -555,7 +557,7 @@ class public_forums_extras_stats extends ipsCommand
* Critical function to show the database queries
* ...or is it...
*
* @return void [Outputs image to screen]
* @return @e void [Outputs image to screen]
*/
private function _showQueries()
{
@@ -584,7 +586,7 @@ class public_forums_extras_stats extends ipsCommand
/**
* Show today's top posters
*
* @return void [Outputs to screen]
* @return @e void [Outputs to screen]
*/
protected function _showTodaysPosters()
{
@@ -3,19 +3,19 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Silly toggle function(?s{0,})
* Last Updated: $Date: 2010-06-08 20:53:45 -0400 (Tue, 08 Jun 2010) $
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: bfarber $
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @link http://hatynka.in
* @since 20th February 2002
* @version $Revision: 6485 $
* @version $Revision: 8644 $
*
*/
@@ -30,9 +30,8 @@ class public_forums_extras_toggle extends ipsCommand
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
@@ -63,8 +62,7 @@ class public_forums_extras_toggle extends ipsCommand
/**
* Toggle side panel on/off without JS
*
* @access public
* @return void
* @return @e void
* @see The Dark Knight (it was an awesome movie)
*/
public function _toggleSidePanel()
@@ -3,19 +3,19 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Poll voting
* Last Updated: $Date: 2010-05-07 19:47:39 -0400 (Fri, 07 May 2010) $
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: bfarber $
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @link http://hatynka.in
* @since 20th February 2002
* @version $Revision: 6250 $
* @version $Revision: 8644 $
*
*/
@@ -30,7 +30,6 @@ class public_forums_extras_vote extends ipsCommand
/**
* Topic data
*
* @access public
* @var array
*/
public $topic = array();
@@ -38,9 +37,8 @@ class public_forums_extras_vote extends ipsCommand
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
@@ -92,7 +90,7 @@ class public_forums_extras_vote extends ipsCommand
'type' => 'left'
),
array(
'select' => 'f.allow_pollbump, f.status',
'select' => 'f.allow_pollbump',
'from' => array( 'forums' => 'f' ),
'where' => 'f.id=t.forum_id',
'type' => 'left'
@@ -117,11 +115,6 @@ class public_forums_extras_vote extends ipsCommand
$this->registry->output->showError( 'topic_vote_locked', 10352, true, null, 403 );
}
if( ! $this->topic['status'] )
{
$this->registry->output->showError( 'topic_cannot_vote', 103152, true, null, 403 );
}
//-----------------------------------------
// Have reply permissions??
//-----------------------------------------
@@ -153,9 +146,8 @@ class public_forums_extras_vote extends ipsCommand
/**
* Add vote to poll
*
* @access public
* @return void
**/
* @return @e void
*/
public function topicAddVoteToPoll()
{
//-----------------------------------------
@@ -307,14 +299,13 @@ class public_forums_extras_vote extends ipsCommand
$lang = $this->request['nullvote'] ? $this->lang->words['poll_viewing_results'] : $this->lang->words['poll_vote_added'];
$this->registry->output->redirectScreen( $lang , $this->settings['base_url'] . "showtopic={$this->topic['tid']}&amp;st=" . $this->request['st'] );
$this->registry->output->redirectScreen( $lang , $this->settings['base_url'] . "showtopic={$this->topic['tid']}&amp;st=" . $this->request['st'], $this->topic['title_seo'], 'showtopic' );
}
/**
* Remove votes
*
* @access public
* @return void
* @return @e void
*/
public function topicDeletePollVotes()
{
@@ -337,7 +328,7 @@ class public_forums_extras_vote extends ipsCommand
if ( ! $voter )
{
$this->registry->output->redirectScreen( $this->lang->words['poll_vote_deleted'], $this->settings['base_url'] . "showtopic={$this->topic['tid']}&amp;st=" . $this->request['st'] );
$this->registry->output->redirectScreen( $this->lang->words['poll_vote_deleted'], $this->settings['base_url'] . "showtopic={$this->topic['tid']}&amp;st=" . $this->request['st'], $this->topic['title_seo'], 'showtopic' );
}
//-----------------------------------------
@@ -376,6 +367,6 @@ class public_forums_extras_vote extends ipsCommand
$this->DB->update( 'polls', $update, "tid=" . $this->topic['tid'] );
/* done */
$this->registry->output->redirectScreen( $this->lang->words['poll_vote_deleted'], $this->settings['base_url'] . "showtopic={$this->topic['tid']}&amp;st=" . $this->request['st'] );
$this->registry->output->redirectScreen( $this->lang->words['poll_vote_deleted'], $this->settings['base_url'] . "showtopic={$this->topic['tid']}&amp;st=" . $this->request['st'], $this->topic['title_seo'], 'showtopic' );
}
}
@@ -3,18 +3,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Announcement View
* Last Updated: $Date: 2010-07-10 01:01:06 -0400 (Sat, 10 Jul 2010) $
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: bfarber $
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 6628 $
* @link http://hatynka.in
* @version $Rev: 8644 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -28,9 +28,8 @@ class public_forums_forums_announcements extends ipsCommand
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
@@ -132,7 +131,7 @@ class public_forums_forums_announcements extends ipsCommand
IPSText::getTextClass( 'bbcode' )->parse_smilies = 1;
IPSText::getTextClass( 'bbcode' )->parse_html = $announce['announce_html_enabled'] ? 1 : 0;
IPSText::getTextClass( 'bbcode' )->parse_nl2br = $announce['announce_nlbr_enabled'];
IPSText::getTextClass( 'bbcode' )->parse_nl2br = $announce['announce_html_enabled'] ? $announce['announce_nlbr_enabled'] : 1;
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
IPSText::getTextClass( 'bbcode' )->parsing_section = 'announcements';
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $announce['member_group_id'];
@@ -194,9 +193,8 @@ class public_forums_forums_announcements extends ipsCommand
/**
* Hides announcements that have passed their expire date
*
* @access public
* @return void
**/
* @return @e void
*/
public function announceRetireExpired()
{
//-----------------------------------------
@@ -211,9 +209,8 @@ class public_forums_forums_announcements extends ipsCommand
/**
* Rebuilds the attachment cache
*
* @access public
* @author Matt Mecham
* @return void
* @return @e void
*/
public function announceRecache()
{
@@ -3,18 +3,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* View Topic Attachments
* Last Updated: $Date: 2010-06-10 06:36:42 -0400 (Thu, 10 Jun 2010) $
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: danc $
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 6502 $
* @link http://hatynka.in
* @version $Rev: 8644 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -28,9 +28,8 @@ class public_forums_forums_attach extends ipsCommand
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
@@ -82,7 +81,6 @@ class public_forums_forums_attach extends ipsCommand
* Get the actual output.
* This is abstracted so that the AJAX routine can load and execute this function
*
* @access public
* @param array Topic and attachment data
* @return string HTML output
*/
@@ -104,7 +102,7 @@ class public_forums_forums_attach extends ipsCommand
// aight.....
//-----------------------------------------
$_queued = ( ! $this->registry->getClass('class_forums')->canQueuePosts( $topic['forum_id'] ) ) ? ' AND p.queued=0' : '';
$_queued = ( ! $this->registry->getClass('class_forums')->canQueuePosts( $topic['forum_id'] ) ) ? ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array( 'visible' ), 'p.' ) : '';
$_st = $this->request['st'] > 0 ? intval($this->request['st']) : 0;
$_limit = 50;
$_pages = '';
@@ -2,18 +2,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Board Index View
* Last Updated: $Date: 2010-10-12 13:04:59 -0400 (Tue, 12 Oct 2010) $
* Last Updated: $Date: 2011-09-08 18:01:45 -0400 (Thu, 08 Sep 2011) $
* </pre>
*
* @author $Author: ips_terabyte $
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 6964 $
* @link http://hatynka.in
* @version $Rev: 9470 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -28,7 +28,7 @@ class public_forums_forums_boards extends ipsCommand
* Main Execution Function
*
* @param object Registry reference
* @return void [Outputs to screen/redirects]
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
@@ -36,9 +36,6 @@ class public_forums_forums_boards extends ipsCommand
// INIT
//-----------------------------------------
$chat_html = '';
$news_data = array();
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'public_boards' ) );
if (! $this->memberData['member_id'] )
@@ -52,29 +49,12 @@ class public_forums_forums_boards extends ipsCommand
$cat_data = $this->processAllCategories();
/* Data Hook Location */
IPSLib::doDataHooks( $cat_data, 'boardIndexCategories' );
//-----------------------------------------
// Add in show online users
//-----------------------------------------
$active = $this->getActiveUserDetails();
//-----------------------------------------
// Check for news forum.
//-----------------------------------------
if ( isset( $this->registry->getClass('class_forums')->forum_by_id[ $this->settings['news_forum_id'] ]['newest_id']) AND $this->registry->getClass('class_forums')->forum_by_id[ $this->settings['news_forum_id'] ]['newest_id'] AND $this->settings['index_news_link'] )
{
$news_data = array(
'forum_id' => $this->settings['news_forum_id'],
'title' => stripslashes($this->registry->getClass('class_forums')->forum_by_id[ $this->settings['news_forum_id'] ]['newest_title']),
'seo_title' => IPSText::makeSeoTitle( $this->registry->getClass('class_forums')->forum_by_id[ $this->settings['news_forum_id'] ]['newest_title'] ),
'id' => $this->registry->getClass('class_forums')->forum_by_id[ $this->settings['news_forum_id'] ]['newest_id']
);
}
/* Check for sidebar hooks */
$show_sidebar = false;
@@ -105,23 +85,17 @@ class public_forums_forums_boards extends ipsCommand
'info' => $stats_info
) );
/* Data Hook Location */
IPSLib::doDataHooks( $active, 'boardIndexOnlineUsers' );
/* Output */
$template = $this->registry->getClass('output')->getTemplate('boards')->boardIndexTemplate(
$this->registry->getClass( 'class_localization')->getDate( $this->memberData['last_visit'], 'LONG' ),
$this->registry->getClass('class_localization')->getDate( $this->memberData['last_visit'], 'LONG' ),
$active,
$this->getCalendarEvents(),
$this->getBirthdays(),
$chat_html,
$news_data,
$cat_data,
$show_sidebar );
//-----------------------------------------
// Meta tags
//-----------------------------------------
if( $this->settings['seo_index_md'] )
{
$this->registry->output->addMetaTag( 'description', $this->settings['seo_index_md'], false );
@@ -134,7 +108,10 @@ class public_forums_forums_boards extends ipsCommand
$this->registry->output->addCanonicalTag( "act=idx", 'public', 'false' );
/* Set Ad code for the board index */
//-----------------------------------------
// Set ad codes
//-----------------------------------------
if( $this->registry->getClass('IPSAdCode')->userCanViewAds() )
{
$this->registry->getClass('IPSAdCode')->setGlobalCode( 'header', 'ad_code_board_index_header' );
@@ -150,65 +127,6 @@ class public_forums_forums_boards extends ipsCommand
$this->registry->getClass('output')->sendOutput();
}
/**
* Builds an array of category data
*
* @param integer $fid ID of the forum to get sub forums for
* @return array
*/
public function showSubForums( $fid )
{
/* INIT */
$temp_html = "";
$sub_output = "";
$return_cat_data = array();
$temp_cat_data = array();
if ( isset( $this->registry->getClass('class_forums')->forum_cache[ $fid ] ) AND is_array( $this->registry->getClass('class_forums')->forum_cache[ $fid ] ) )
{
$cat_data = $this->registry->getClass('class_forums')->forum_by_id[ $fid ];
foreach( $this->registry->getClass('class_forums')->forum_cache[ $fid ] as $forum_data )
{
$forum_data['_queued_img'] = isset($forum_data['_queued_img'] ) ? $forum_data['_queued_img'] : '';
$forum_data['_queued_info'] = isset($forum_data['_queued_info'] ) ? $forum_data['_queued_info'] : '';
$forum_data['show_subforums'] = isset($forum_data['show_subforums'] ) ? $forum_data['show_subforums'] : '';
$forum_data['last_unread'] = isset($forum_data['last_unread'] ) ? $forum_data['last_unread'] : '';
//-----------------------------------------
// Get all subforum stats
// and calculate
//-----------------------------------------
if ( $this->settings['forum_cache_minimum'] AND $this->settings['forum_cache_minimum'] )
{
$forum_data['description'] = "<!--DESCRIPTION:{$forum_data['id']}-->";
$need_desc[] = $forum_data['id'];
}
if ( $forum_data['redirect_on'] )
{
$forum_data['redirect_hits'] = $this->registry->getClass('class_localization')->formatNumber( $forum_data['redirect_hits'] );
$forum_data['redirect_target'] = isset($forum_data['redirect_target']) ? $forum_data['redirect_target'] : '_parent';
$temp_cat_data[ $forum_data['id'] ] = $forum_data;
}
else
{
$temp_cat_data[ $forum_data['id'] ] = $this->registry->getClass('class_forums')->forumsFormatLastinfo( $this->registry->getClass('class_forums')->forumsCalcChildren( $forum_data['id'], $forum_data ) );
}
}
}
if ( count( $temp_cat_data ) )
{
$return_cat_data[] = array( 'cat_data' => $cat_data,
'forum_data' => $temp_cat_data );
}
return $return_cat_data;
}
/**
* Builds an array of category data for output
*
@@ -216,11 +134,14 @@ class public_forums_forums_boards extends ipsCommand
*/
public function processAllCategories()
{
/* INIT */
$return_cat_data = array();
$need_desc = array();
$root = array();
$parent = array();
//-----------------------------------------
// Init
//-----------------------------------------
$return_cat_data = array();
$root = array();
$parent = array();
$member_ids = array();
//-----------------------------------------
// Want to view categories?
@@ -287,10 +208,14 @@ class public_forums_forums_boards extends ipsCommand
{
$temp_cat_data[ $forum_data['id'] ] = $this->registry->class_forums->forumsFormatLastinfo( $this->registry->class_forums->forumsCalcChildren( $forum_data['id'], $forum_data ) );
}
if( $temp_cat_data[ $forum_data['id'] ]['last_poster_id'] )
{
$member_ids[ $forum_data['id'] ] = $temp_cat_data[ $forum_data['id'] ]['last_poster_id'];
}
}
}
if ( count( $temp_cat_data ) )
{
$return_cat_data[] = array( 'cat_data' => $cat_data,
@@ -302,6 +227,41 @@ class public_forums_forums_boards extends ipsCommand
}
}
if( count($member_ids) )
{
$_members = IPSMember::load( array_unique($member_ids), 'members,profile_portal' );
foreach( $member_ids as $forumId => $memberId )
{
$_member = $_members[ $memberId ];
if( $_member['member_id'] )
{
$_member = IPSMember::buildDisplayData( $_member );
foreach( $return_cat_data as $k => $_type )
{
foreach( $_type as $__type => $obj )
{
if( $__type == 'forum_data' )
{
foreach( $obj as $fid => $fdata )
{
if( $fid != $forumId )
{
continue;
}
$return_cat_data[ $k ][ $__type ][ $fid ] = array_merge( $_member, $fdata );
break 3;
}
}
}
}
}
}
}
return $return_cat_data;
}
@@ -350,9 +310,9 @@ class public_forums_forums_boards extends ipsCommand
}
$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",
'select' => 'id, member_id, member_name, seo_name, login_type, running_time, member_group, uagent_type',
'from' => 'sessions',
'where' => "running_time > {$time}",
) );
$this->DB->execute();
@@ -396,18 +356,7 @@ class public_forums_forums_boards extends ipsCommand
if ( ! $cached[ $result['member_name'] ] )
{
if ( $this->settings['spider_anon'] )
{
if ( $this->memberData['g_access_cp'] )
{
$active['NAMES'][] = IPSLib::makeNameFormatted( $result['member_name'], $result['member_group'] );
}
}
else
{
$active['NAMES'][] = IPSLib::makeNameFormatted( $result['member_name'], $result['member_group'] );
}
$active['NAMES'][] = IPSMember::makeNameFormatted( $result['member_name'], $result['member_group'] );
$cached[ $result['member_name'] ] = 1;
}
else
@@ -439,11 +388,11 @@ class public_forums_forums_boards extends ipsCommand
{
$cached[ $result['member_id'] ] = 1;
$result['member_name'] = IPSLib::makeNameFormatted( $result['member_name'], $result['member_group'] );
$result['member_name'] = IPSMember::makeNameFormatted( $result['member_name'], $result['member_group'] );
if ( $result['login_type'] )
{
if ( $this->memberData['g_access_cp'] and ($this->settings['disable_admin_anon'] != 1) )
if ( $this->memberData['g_access_cp'] )
{
$active['NAMES'][] = "<a href='" . $this->registry->getClass('output')->buildSEOUrl( "showuser={$result['member_id']}", 'public', $result['seo_name'], 'showuser' ) . "' title='$last_date'>{$result['member_name']}</a>*";
$active['ANON']++;
@@ -468,312 +417,9 @@ class public_forums_forums_boards extends ipsCommand
}
$this->lang->words['active_users'] = sprintf( $this->lang->words['active_users'], $this->settings['au_cutoff'] );
return $active;
}
/**
* Returns a string of calendar events
*
* @return mixed HTML string, or false
*/
public function getCalendarEvents()
{
//-----------------------------------------
// Are we viewing the calendar?
//-----------------------------------------
if( $this->settings['show_calendar'] AND IPSLib::appIsInstalled('calendar') )
{
/* Get the current day, month, and year */
$a = explode( ',', gmdate( 'Y,n,j,G,i,s', time() + $this->registry->class_localization->getTimeOffset() ) );
$day = $a[2];
$month = $a[1];
$year = $a[0];
/* Check the calendar limit */
$this->settings['calendar_limit'] = intval( $this->settings['calendar_limit'] ) < 2 ? 1 : intval( $this->settings['calendar_limit'] );
$our_unix = gmmktime( 0, 0, 0, $month, $day, $year);
$max_date = $our_unix + ($this->settings['calendar_limit'] * 86400);
$events = array();
$show_events = array();
if( $this->memberData['org_perm_id'] )
{
$member_permission_groups = explode( ",", IPSText::cleanPermString( $this->memberData['org_perm_id'] ) );
}
else
{
$cache = $this->caches['group_cache'];
$member_permission_groups = explode( ",", IPSText::cleanPermString( $this->memberData['g_perm_id'] ) );
if( $this->memberData['mgroup_others'] )
{
$this->memberData['mgroup_others'] = IPSText::cleanPermString($this->memberData['mgroup_others']);
$mgroup_others = explode( ",", $this->memberData['mgroup_others'] );
if( count($mgroup_others) )
{
foreach( $mgroup_others as $member_group_id )
{
if( $member_group_id )
{
$member_permission_groups = array_merge( $member_permission_groups, explode( ",", IPSText::cleanPermString( $cache[$member_group_id]['g_perm_id'] ) ) );
}
}
}
}
}
if( is_array( $this->caches['calendar'] ) AND count( $this->caches['calendar'] ) )
{
foreach( $this->caches['calendar'] as $u )
{
$set_offset = 0;
if( $u['event_timeset'] && !($u['event_recurring'] == 0 AND $u['event_unix_to']) )
{
$set_offset = $this->memberData['time_offset'] ? $this->memberData['time_offset'] * 3600 : 0;
}
$u['_unix_from'] = $u['event_unix_from'] - $set_offset;
$u['_unix_to'] = $u['event_unix_to'] - $set_offset;
//-----------------------------------------
// Private?
//-----------------------------------------
if ( $u['event_private'] == 1 and $this->memberData['member_id'] != $u['event_member_id'] )
{
continue;
}
//-----------------------------------------
// Got perms?
//-----------------------------------------
if( $u['event_perms'] != "*" )
{
$event_perms = explode( ",", IPSText::cleanPermString( $u['event_perms'] ) );
$check = 0;
if( count($event_perms) )
{
foreach( $event_perms as $mgroup_perm )
{
if( in_array( $mgroup_perm, $member_permission_groups ) )
{
$check = 1;
}
}
}
if( !$check )
{
continue;
}
}
//-----------------------------------------
// Got calendar perms?
//-----------------------------------------
if( $u['_perm_read'] != "*" )
{
$read_perms = explode( ",", IPSText::cleanPermString( $u['_perm_read'] ) );
$check = 0;
if( count( $read_perms ) )
{
foreach( $read_perms as $mgroup_perm )
{
if( in_array( $mgroup_perm, $member_permission_groups ) )
{
$check = 1;
}
}
}
if( !$check )
{
continue;
}
}
//-----------------------------------------
// In range?
//-----------------------------------------
if ( $u['event_recurring'] == 0 AND ( ( $u['event_unix_to'] >= $our_unix AND $u['event_unix_from'] <= $max_date )
OR ( $u['event_unix_to'] == 0 AND $u['event_unix_from'] >= $our_unix AND $u['event_unix_from'] <= $max_date ) ) )
{
$u['event_activetime'] = $u['_unix_from'];
$events[ str_pad( $u['event_unix_from'].$u['event_id'], 15, "0" ) ] = $u;
}
elseif( $u['event_recurring'] > 0 )
{
$cust_range_s = $u['event_unix_from'];
while( $cust_range_s < $u['event_unix_to'])
{
if( $cust_range_s >= $our_unix AND $cust_range_s <= $max_date )
{
/* Special case for months, to take into account different numbers of days */
if ( $u['event_recurring'] == "2" )
{
$u['event_activetime'] = gmmktime( 1, 1, 1, gmdate( 'n', $cust_range_s ), gmdate( 'j', $u['event_unix_from'] ), gmdate( 'Y', $cust_range_s ) );
}
else
{
$u['event_activetime'] = $cust_range_s;
}
$events[ str_pad( $cust_range_s.$u['event_id'], 15, "0" ) ] = $u;
}
if( $u['event_recurring'] == "1" )
{
$cust_range_s += 604800;
}
elseif ( $u['event_recurring'] == "2" )
{
$cust_range_s += 2628000;
}
else
{
$cust_range_s += 31536000;
}
}
}
}
}
//-----------------------------------------
// Print...
//-----------------------------------------
ksort($events);
foreach( $events as $event )
{
//-----------------------------------------
// Recurring?
//-----------------------------------------
$c_time = '';
$c_time = gmstrftime( '%x', $event['event_activetime'] );
$url = $this->registry->output->buildSEOUrl( "app=calendar&amp;module=calendar&amp;cal_id={$event['event_calendar_id']}&amp;do=showevent&amp;event_id={$event['event_id']}", 'public', $event['event_title'], 'event' );
$show_events[] = "<a href='{$url}' title='$c_time'>".$event['event_title']."</a>";
}
$this->lang->words['calender_f_title'] = sprintf( $this->lang->words['calender_f_title'], $this->settings['calendar_limit'] );
if ( count($show_events) > 0 )
{
$event_string = $show_events; // Change in 3.0 by rikki: Just pass the array for the template to deal with
}
else
{
if ( ! $this->settings['autohide_calendar'] )
{
$event_string = $this->lang->words['no_calendar_events'];
}
}
return $event_string;
}
else
{
return FALSE;
}
}
/**
* Returns an array of birthday information
*
* @return mixed Array of birthday information, or false
*/
public function getBirthdays()
{
if ($this->settings['show_birthdays'] or $this->settings['show_calendar'] )
{
$a = explode( ',', gmdate( 'Y,n,j,G,i,s', time() + $this->registry->getClass( 'class_localization')->getTimeOffset() ) );
$day = $a[2];
$month = $a[1];
$year = $a[0];
$birthstring = "";
$count = 0;
$lang = '';
$users = array();
if ( $this->settings['show_birthdays'] )
{
if ( is_array($this->caches['birthdays']) AND count( $this->caches['birthdays'] ) )
{
foreach( $this->caches['birthdays'] as $u )
{
if ( $u['bday_day'] == $day and $u['bday_month'] == $month )
{
$users[] = $u;
}
else if( $day == 28 && $month == 2 && !date("L") )
{
if ( $u['bday_day'] == "29" and $u['bday_month'] == $month )
{
$users[] = $u;
}
}
}
}
//-----------------------------------------
// Spin and print...
//-----------------------------------------
foreach ( $users as $user )
{
/* Age */
$pyear = 0;
if( $user['bday_year'] && $user['bday_year'] > 0 )
{
$pyear = $year - $user['bday_year'];
}
$birthstring[] = $this->registry->getClass('output')->getTemplate('boards')->birthday( $user, $pyear );
$count++;
}
//-----------------------------------------
// Fix up string...
//-----------------------------------------
$lang = $this->lang->words['no_birth_users'];
if ($count > 0)
{
$lang = ($count > 1) ? $this->lang->words['birth_users'] : $this->lang->words['birth_user'];
}
else
{
return FALSE;
}
}
return array( 'count' => $count, 'lang' => $lang, 'users' => $birthstring );
}
else
{
return FALSE;
}
}
/**
* Returns an array of board stats
@@ -820,7 +466,7 @@ class public_forums_forums_boards extends ipsCommand
$this->cache->setCache( 'stats', $stats, array( 'array' => 1 ) );
}
$stats_output['most_time'] = $this->registry->getClass( 'class_localization')->getDate( $stats['most_date'], 'LONG' );
$stats_output['most_time'] = $this->registry->getClass( 'class_localization')->getDate( $stats['most_date'], 'DATE' );
$stats_output['most_online'] = $this->registry->getClass('class_localization')->formatNumber($stats['most_count']);
$this->lang->words['most_online'] = str_replace( "<#NUM#>" , $stats_output['most_online'] , $this->lang->words['most_online'] );
@@ -1,31 +1,14 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* Default section file for forums public module
* Last Updated: $LastChangedDate: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @file defaultSection.php Define the default section for the 'forums' module
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: This is NULLED!
* $Author: ips_terabyte $
* @since 14th May 2003
* @version $Rev: 5713 $
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
* @version v3.2.3
* $Revision: 8655 $
*/
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();
}
/**
* Very simply returns the default section if one is not
* passed in the URL
*/
$DEFAULT_SECTION = 'boards';
@@ -3,18 +3,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Bounces a user to the right post
* Last Updated: $Date: 2010-07-12 18:26:09 -0400 (Mon, 12 Jul 2010) $
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: bfarber $
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 6635 $
* @link http://hatynka.in
* @version $Rev: 8644 $
* @since 14th April 2004
*
* | > Interesting Fact: I've had iTunes playing every Radiohead tune
@@ -36,9 +36,8 @@ class public_forums_forums_findpost extends ipsCommand
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [redirects]
* @return @e void [redirects]
*/
public function doExecute( ipsRegistry $registry )
{
@@ -76,6 +75,9 @@ class public_forums_forums_findpost extends ipsCommand
{
$this->registry->getClass('output')->showError( 'findpost_missing_topic', 10332, null, null, 404 );
}
$sort_field = ($this->settings['post_order_column'] == 'pid') ? 'pid' : 'post_date';
$sort_value = $sort_field == 'pid' ? $pid : $post['post_date'];
$query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery('visible');
@@ -85,7 +87,7 @@ class public_forums_forums_findpost extends ipsCommand
if ( $this->permissions['softDeleteSee'] )
{
/* See queued and soft deleted */
$query = '';
$query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array( 'approved', 'sdeleted', 'hidden' ) );
}
else
{
@@ -103,7 +105,7 @@ class public_forums_forums_findpost extends ipsCommand
}
}
$cposts = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as posts', 'from' => 'posts', 'where' => "topic_id={$post['topic_id']} AND pid <= {$pid}{$query}" ) );
$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 )
{
File diff suppressed because it is too large. Load diff
@@ -5,6 +5,6 @@
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionboard.com/">IP.Board</a>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -3,19 +3,19 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Forums -> Mark As Read command class
* Last Updated: $Date: 2010-04-06 07:02:13 -0400 (Tue, 06 Apr 2010) $
* Last Updated: $Date: 2011-07-14 03:36:38 -0400 (Thu, 14 Jul 2011) $
* </pre>
*
* @author Matt Mecham
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @link http://hatynka.in
* @since Tuesday 1st March 2005 (11:52)
* @version $Rev: 6069 $
* @version $Rev: 9230 $
*
*/
@@ -30,9 +30,8 @@ class public_forums_forums_markasread extends ipsCommand
/**
* Main execution point
*
* @access public
* @param object ipsRegistry reference
* @return void
* @return @e void
*/
public function doExecute( ipsRegistry $registry )
{
@@ -48,16 +47,19 @@ class public_forums_forums_markasread extends ipsCommand
break;
case 'all':
return $this->markBoardAsRead();
break;
case 'app':
return $this->markBoardAsRead( trim( $this->request['markApp'] ) );
break;
}
}
/**
* Mark all forums and topics as read
*
* @access public
* @return void
* @return @e void
*/
public function markBoardAsRead()
public function markBoardAsRead( $app=null )
{
//-----------------------------------------
// Check
@@ -74,27 +76,25 @@ class public_forums_forums_markasread extends ipsCommand
//-----------------------------------------
// Reset board markers
//-----------------------------------------
/*foreach( ipsRegistry::$applications as $app_dir => $data )
{
if ( isset( $data['app_enabled'] ) AND $data['app_enabled'] )
{
$this->registry->classItemMarking->markAppAsRead( $app_dir );
}
}*/
# Bug fix 21223 - reset all markers with one cookie save
$this->registry->classItemMarking->markAppAsRead();
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'act=idx', 'false' );
# Bug fix 21223 - reset all markers with one cookie save
$this->registry->classItemMarking->markAppAsRead( $app );
if( $app && !in_array( $app, array('core','forums') ) )
{
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'app=' . $app, 'false' );
}
else
{
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] );
}
}
/**
* Marks the specified forum as read
*
* @access public
* @return void
**/
* @return @e void
*/
public function markForumAsRead()
{
//-----------------------------------------
@@ -113,7 +113,7 @@ class public_forums_forums_markasread extends ipsCommand
if ( ! $forum_data['id'] )
{
$this->registry->getClass('output')->showError( 'markread_no_id', 10340, null, null, 404 );
$this->registry->getClass('output')->showError( 'markread_no_id', 10340.8, null, null, 404 );
}
/* Turn off instant updates and write back tmp markers in destructor */
@@ -1,521 +0,0 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* Print Topic
* Last Updated: $Date: 2010-06-10 06:36:42 -0400 (Thu, 10 Jun 2010) $
* </pre>
*
* @author $Author: danc $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @since 20th February 2002
* @version $Rev: 6502 $
*
*/
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_forums_printtopic extends ipsCommand
{
/**
* Temporary output
*
* @access private
* @var string
*/
private $output = "";
/**
* Forum data
*
* @access private
* @var array
*/
private $forum = array();
/**
* Topic data
*
* @access private
* @var array
*/
private $topic = array();
private $attach_pids;
/**
* Main execution function
*
* @access public
* @param object Registry Object
* @return void
* @todo Need error codes
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$_moderator = $this->memberData['forumsModeratorData'];
//-----------------------------------------
// Compile the language file
//-----------------------------------------
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'public_printpage' ) );
//-----------------------------------------
// Check the input
//-----------------------------------------
$this->request['t'] = intval($this->request['t'] );
$this->request['f'] = intval($this->request['f'] );
if ( ! $this->request['t'] or ! $this->request['f'] )
{
$this->registry->getClass('output')->showError( 'missing_files', 0, null, null, 404 );
}
//-----------------------------------------
// Get the forum info based on the
// forum ID, get the category name, ID,
// and get the topic details
//-----------------------------------------
$this->topic = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'topics', 'where' => "tid=" . $this->request['t'] ) );
$this->forum = $this->registry->getClass('class_forums')->forum_by_id[ $this->topic['forum_id'] ];
//-----------------------------------------
// Error out if we can not find the forum
//-----------------------------------------
if ( ! $this->forum['id'] )
{
$this->registry->getClass('output')->showError( 'missing_files', 0, null, null, 404 );
}
//-----------------------------------------
// Error out if we can not find the topic
//-----------------------------------------
if ( ! $this->topic['tid'] )
{
$this->registry->getClass('output')->showError( 'missing_files', 0, null, null, 404 );
}
//-----------------------------------------
// Check viewing permissions, private forums,
// password forums, etc
//-----------------------------------------
if ( ( ! $this->topic['pinned'] ) and ( ! $this->memberData['g_other_topics'] ) )
{
$this->registry->getClass('output')->showError( 'no_view_topic', 0, null, null, 403 );
}
//-----------------------------------------
// Check access
//-----------------------------------------
$this->registry->getClass('class_forums')->forumsCheckAccess( $this->forum['id'], 1, 'topic' );
if ( ! $this->topic['approved'] AND !( $this->memberData['g_is_supmod'] OR $_moderator[ $this->topic['forum_id'] ]['topic_q'] ) )
{
$this->registry->getClass('output')->showError( 'no_view_topic', 0, null, null, 403 );
}
//-----------------------------------------
// Main logic engine
//-----------------------------------------
if ($this->request['client'] == 'choose')
{
$this->page_title = $this->topic['title'];
$this->nav = array( array( $this->forum['name'], "showforum={$this->forum['id']}" ),
array( $this->topic['title'], "showtopic={$this->topic['tid']}" )
);
$this->output = $this->registry->getClass('output')->getTemplate('printpage')->choose_form($this->forum['id'], $this->topic['tid'], $this->topic['title']);
$this->registry->getClass('output')->setTitle( $this->page_title . ' - ' . ipsRegistry::$settings['board_name'] );
$this->registry->getClass('output')->addContent( $this->output );
if( is_array( $this->nav ) AND count( $this->nav ) )
{
foreach( $this->nav as $_id => $_nav )
{
$this->registry->getClass('output')->addNavigation( $_nav[0], $_nav[1] );
}
}
$this->registry->getClass('output')->sendOutput();
exit();
}
else
{
$header = 'text/html';
$ext = '.html';
switch ($this->request['client'])
{
case 'printer':
$header = 'text/html';
$ext = '.html';
break;
case 'html':
$header = 'unknown/unknown';
$ext = '.html';
break;
default:
$header = 'application/msword';
$ext = '.doc';
}
}
$title = substr( str_replace( " ", "_" , preg_replace( "/&(lt|gt|quot|#124|#036|#33|#39);/", "", $this->topic['title'] ) ), 0, 100);
@header( "Content-type: {$header};charset=" . IPS_DOC_CHAR_SET );
if ( $this->request['client'] != 'printer' )
{
@header("Content-Disposition: attachment; filename=$title".$ext);
}
print $this->getPosts();
exit;
}
/**
* Gets the posts to be printed/downloaded
*
* @access protected
* @return string
**/
protected function getPosts()
{
//-----------------------------------------
// Render the page top
//-----------------------------------------
$posts_html = $this->registry->getClass('output')->getTemplate('printpage')->pp_header( $this->forum['name'], $this->topic['title'], $this->topic['starter_name'] , $this->forum['id'], $this->topic['tid'] );
$max_posts = 300;
$attach_pids = array();
$this->DB->build( array(
'select' => 'p.*',
'from' => array( 'posts' => 'p' ),
'where' => "p.topic_id={$this->topic['tid']} and p.queued=0",
'order' => 'p.pid',
'limit' => array( 0, $max_posts ),
'add_join' => array(
array(
'select' => 'm.members_display_name',
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id=p.author_id',
'type' => 'left'
)
)
) );
$this->DB->execute();
//-----------------------------------------
// Loop through to pick out the correct member IDs.
// and push the post info into an array - maybe in the future
// we can add page spans, or maybe save to a PDF file?
//-----------------------------------------
$the_posts = array();
$mem_ids = array();
$member_array = array();
$cached_members = array();
$pids = array();
while ( $i = $this->DB->fetch() )
{
$the_posts[ $i['pid' ]] = $i;
$this->attach_pids[] = $i['pid'];
if ( $i['author_id'] )
{
$mem_ids[ $i['author_id'] ] = $i['author_id'];
}
}
$the_posts = $this->_parseAttachments( $the_posts, $this->attach_pids );
//-----------------------------------------
// Get the member profiles needed for this topic
//-----------------------------------------
if ( count( $mem_ids ) )
{
$this->DB->build( array(
'select' => 'm.*',
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id IN ('.implode( ',', $mem_ids ).')',
'add_join' => array(
array(
'select' => 'g.*',
'from' => array( 'groups' => 'g' ),
'where' => 'g.g_id=m.member_group_id',
'type' => 'left'
)
)
) );
$this->DB->execute();
while( $m = $this->DB->fetch() )
{
$member_array[ $m['member_id'] ] = $m;
}
}
//-----------------------------------------
// Format and print out the topic list
//-----------------------------------------
foreach( $the_posts as $row )
{
$poster = array();
//-----------------------------------------
// Get the member info. We parse the data and cache it.
// It's likely that the same member posts several times in
// one page, so it's not efficient to keep parsing the same
// data
//-----------------------------------------
if( $row['author_id'] != 0 )
{
//-----------------------------------------
// Is it in the hash?
//-----------------------------------------
if ( isset($cached_members[ $row['author_id'] ]) )
{
//-----------------------------------------
// Ok, it's already cached, read from it
//-----------------------------------------
$poster = $cached_members[ $row['author_id'] ];
$row['name_css'] = 'normalname';
}
else
{
//-----------------------------------------
// Ok, it's NOT in the cache, is it a member thats
// not been deleted?
//-----------------------------------------
if ($member_array[ $row['author_id'] ])
{
$row['name_css'] = 'normalname';
$poster = $member_array[ $row['author_id'] ];
//-----------------------------------------
// Add it to the cached list
//-----------------------------------------
$cached_members[ $row['author_id'] ] = $poster;
}
else
{
//-----------------------------------------
// It's probably a deleted member, so treat them as a guest
//-----------------------------------------
$poster = IPSMember::setUpGuest( $row['author_name'] );
$row['name_css'] = 'unreg';
}
}
}
else
{
//-----------------------------------------
// It's definately a guest...
//-----------------------------------------
$poster = IPSMember::setUpGuest( $row['author_name'] );
$row['name_css'] = 'unreg';
}
//-----------------------------------------
$row['post'] = preg_replace( "/<!--EDIT\|(.+?)\|(.+?)-->/", "", $row['post'] );
//-----------------------------------------
$row['post_date'] = $this->registry->getClass( 'class_localization')->getDate( $row['post_date'], 'LONG', 1 );
//-----------------------------------------
// Quoted attachments?
//-----------------------------------------
$attach_pids[ $row['pid'] ] = $row['pid'];
$row['post'] = $this->parseMessage( $row['post'], $row );
//-----------------------------------------
// Parse HTML tag on the fly
//-----------------------------------------
$posts_html .= $this->registry->getClass('output')->getTemplate('printpage')->pp_postentry( $poster, $row );
}
if ( count( $attach_pids ) )
{
if ( ! is_object( $this->class_attach ) )
{
//-----------------------------------------
// Grab render attach class
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'core' ) . '/sources/classes/attach/class_attach.php', 'class_attach' );
$this->class_attach = new $classToLoad( $this->registry );
$this->class_attach->type = 'post';
$this->class_attach->init();
}
$posts_html = $this->class_attach->renderAttachments( $posts_html, $attach_pids );
$posts_html = $posts_html[0]['html'];
}
//-----------------------------------------
// Print the footer
//-----------------------------------------
$posts_html .= $this->registry->getClass('output')->getTemplate('printpage')->pp_end();
//-----------------------------------------
// Macros
//-----------------------------------------
$posts_html = $this->registry->getClass('output')->replaceMacros( $posts_html );
//-----------------------------------------
// CSS
//-----------------------------------------
$this->registry->getClass('output')->skin['_usecsscache'] = 0;
return $posts_html;
}
/**
* Parse attachments
*
* @access public
* @param array Array of post data
* @return string HTML parsed by attachment class
*/
public function _parseAttachments( $postData )
{
//-----------------------------------------
// INIT. Yes it is
//-----------------------------------------
$postHTML = array();
//-----------------------------------------
// Separate out post content
//-----------------------------------------
foreach( $postData as $id => $post )
{
$postHTML[ $id ] = $post['post'];
}
//-----------------------------------------
// ATTACHMENTS!!!
//-----------------------------------------
if ( $this->topic['topic_hasattach'] )
{
if ( ! is_object( $this->class_attach ) )
{
//-----------------------------------------
// Grab render attach class
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'core' ) . '/sources/classes/attach/class_attach.php', 'class_attach' );
$this->class_attach = new $classToLoad( $this->registry );
}
//-----------------------------------------
// Not got permission to view downloads?
//-----------------------------------------
if ( $this->registry->permissions->check( 'download', $this->registry->class_forums->forum_by_id[ $this->topic['forum_id'] ] ) === FALSE )
{
$this->settings['show_img_upload'] = 0 ;
}
//-----------------------------------------
// Continue...
//-----------------------------------------
$this->class_attach->type = 'post';
$this->class_attach->init();
# attach_pids is generated in the func_topic_xxxxx files
$attachHTML = $this->class_attach->renderAttachments( $postHTML, $this->attach_pids );
}
/* Now parse back in the rendered posts */
if( is_array($attachHTML) AND count($attachHTML) )
{
foreach( $attachHTML as $id => $data )
{
/* Get rid of any lingering attachment tags */
if ( stristr( $data['html'], "[attachment=" ) )
{
$data['html'] = IPSText::stripAttachTag( $data['html'] );
}
$postData[ $id ]['post'] = $data['html'];
$postData[ $id ]['attachmentHtml'] = $data['attachmentHtml'];
}
}
return $postData;
}
/**
* Parses Posts
*
* @access protected
* @param string $message Text
* @param array $row Formatting params
* @return string
**/
protected function parseMessage( $message="", $row=array() )
{
IPSText::getTextClass( 'bbcode' )->parse_smilies = $row['use_emo'];
IPSText::getTextClass( 'bbcode' )->parse_html = ( $this->forum['use_html'] and $this->caches['group_cache'][ $row['member_group_id'] ]['g_dohtml'] and $row['post_htmlstate'] ) ? 1 : 0;
IPSText::getTextClass( 'bbcode' )->parse_nl2br = $row['post_htmlstate'] == 2 ? 1 : 0;
IPSText::getTextClass( 'bbcode' )->parse_bbcode = $this->forum['use_ibc'];
IPSText::getTextClass( 'bbcode' )->parsing_section = 'topics';
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $row['member_group_id'];
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $row['mgroup_others'];
return IPSText::getTextClass( 'bbcode' )->preDisplayParse( $message );
}
}
@@ -3,18 +3,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Show forum rules
* Last Updated: $Date: 2010-10-05 21:26:08 -0400 (Tue, 05 Oct 2010) $
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: bfarber $
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 6945 $
* @link http://hatynka.in
* @version $Rev: 8644 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -28,17 +28,15 @@ class public_forums_forums_rules extends ipsCommand
/**
* Array of form data
*
* @access private
* @var array
*/
private $forum = array();
protected $forum = array();
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
@@ -64,7 +62,7 @@ class public_forums_forums_rules extends ipsCommand
// Is it a redirect forum?
//-----------------------------------------
if( isset( $this->forum['redirect_on'] ) AND $this->forum['redirect_on'] )
if( !empty( $this->forum['redirect_on'] ) )
{
$redirect = $this->DB->buildAndFetch( array( 'select' => 'redirect_url', 'from' => 'forums', 'where' => "id=" . $this->forum['id']) );
File diff suppressed because it is too large. Load diff
@@ -1,267 +0,0 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* Subscribe to a topic or forum
* Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @since 20th February 2002
* @version $Revision: 5713 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_forums_forums_tracker extends ipsCommand
{
/**
* Forum information
*
* @access private
* @var array Array of forum details
*/
private $forum = array();
/**
* Topic information
*
* @access private
* @var array Array of topic details
*/
private $topic = array();
/**
* Subscription type
*
* @access private
* @var string topic or forum
*/
private $type = 'topic';
/**
* Subscription method
*
* @access private
* @var string delayed, immediate, none, daily, weekly
*/
private $method = 'delayed';
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @param boolean Return instead of showing topic subscribed page
* @return mixed [Outputs to screen/redirects, or returns if $is_sub is true]
*/
public function doExecute( ipsRegistry $registry, $is_sub = false )
{
if( !$this->request['t'] )
{
$this->registry->output->showError( 'tracker_no_tid', 10361, null, null, 404 );
}
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_emails' ), 'core' );
//-----------------------------------------
// Check the input
//-----------------------------------------
if ( $this->request['type'] == 'forum' )
{
$this->type = 'forum';
}
//-----------------------------------------
// Method..
//-----------------------------------------
switch ( $this->request['method'] )
{
case 'delayed':
default:
$this->method = 'delayed';
break;
case 'immediate':
$this->method = 'immediate';
break;
case 'none':
$this->method = 'none';
break;
case 'daily':
$this->method = 'daily';
break;
case 'weekly':
$this->method = 'weekly';
break;
}
$this->request['t'] = intval($this->request['t']);
$this->request['f'] = intval($this->request['f']);
//-----------------------------------------
// Error out if we can not find the forum
//-----------------------------------------
if ( ! ipsRegistry::getClass('class_forums')->forum_by_id[ $this->request['f'] ] )
{
if ( $is_sub == false )
{
$this->registry->output->showError( 'tracker_no_fid', 10362, null, null, 404 );
}
else
{
return false;
}
}
//-----------------------------------------
// Get the information based on ID
//-----------------------------------------
if ( $this->type == 'forum' )
{
$this->forum = ipsRegistry::getClass('class_forums')->forum_by_id[ $this->request['f'] ];
}
else
{
$this->topic = $this->DB->buildAndFetch( array( 'select' => 'tid, forum_id, starter_id', 'from' => 'topics', 'where' => 'tid=' . $this->request['t'] ) );
if( !is_array($this->topic) OR !count($this->topic) )
{
$this->registry->output->showError( 'tracker_no_tid', 10363, null, null, 404 );
}
$this->forum = ipsRegistry::getClass('class_forums')->forum_by_id[ $this->request['f'] ];
}
//-----------------------------------------
// Error out if we can not find the topic
//-----------------------------------------
if ( $this->type != 'forum' )
{
if ( ! $this->topic['tid'] )
{
if ( $is_sub == false )
{
$this->registry->output->showError( 'tracker_no_fid', 10364, null, null, 404 );
}
else
{
return false;
}
}
}
//-----------------------------------------
// Check viewing permissions, private forums,
// password forums, etc
//-----------------------------------------
if ( !$this->memberData['member_id'] )
{
if ( $is_sub == false )
{
$this->registry->output->showError( 'tracker_only_members', 10365, null, null, 403 );
}
else
{
return false;
}
}
if( $is_sub )
{
$this->registry->getClass('class_forums')->forumsCheckAccess( $this->forum['id'], 0, $this->type, $this->topic, true );
}
else
{
$this->registry->getClass('class_forums')->forumsCheckAccess( $this->forum['id'], 0, $this->type, $this->topic );
}
//-----------------------------------------
// Have we already subscribed?
//-----------------------------------------
if ( $this->type == 'forum' )
{
$this->DB->build( array( 'select' => 'frid',
'from' => 'forum_tracker',
'where' => "forum_id='" . $this->forum['id'] . "' AND member_id=" . $this->memberData['member_id'] ) );
$this->DB->execute();
}
else
{
$this->DB->build( array( 'select' => 'trid',
'from' => 'tracker',
'where' => "topic_id='" . $this->topic['tid'] . "' AND member_id=" . $this->memberData['member_id'] ) );
$this->DB->execute();
}
if ( $this->DB->getTotalRows() )
{
if ( $is_sub == false )
{
$this->registry->output->showError( 'tracker_already_track', 10366 );
}
else
{
return false;
}
}
//-----------------------------------------
// Add it to the DB
//-----------------------------------------
if ($this->type == 'forum')
{
$this->DB->insert( 'forum_tracker', array (
'member_id' => $this->memberData['member_id'],
'forum_id' => $this->request['f'],
'start_date' => time(),
'forum_track_type' => $this->method,
) );
}
else
{
$this->DB->insert( 'tracker', array (
'member_id' => $this->memberData['member_id'],
'topic_id' => $this->topic['tid'],
'start_date' => time(),
'topic_track_type' => $this->method,
) );
}
if ( $is_sub == false )
{
if ( $this->type == 'forum' )
{
$this->registry->output->redirectScreen( $this->lang->words['sub_added'], $this->settings['base_url'] . "showforum={$this->topic['id']}" );
}
else
{
$this->registry->output->redirectScreen( $this->lang->words['sub_added'], $this->settings['base_url'] . "showtopic={$this->topic['tid']}&amp;st=" . $this->request['st'] );
}
}
else
{
return true;
}
}
}
@@ -5,6 +5,6 @@
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionboard.com/">IP.Board</a>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,14 @@
<?php
/**
* @file defaultSection.php Define the default section for the 'moderate' module
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: This is NULLED!
* $Author: ips_terabyte $
* @since 14th May 2003
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
* @version v3.2.3
* $Revision: 8655 $
*/
$DEFAULT_SECTION = 'moderate';
@@ -5,6 +5,6 @@
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionboard.com/">IP.Board</a>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
File diff suppressed because it is too large. Load diff
@@ -3,18 +3,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Moderator actions
* Last Updated: $Date: 2010-07-01 18:13:46 -0400 (Thu, 01 Jul 2010) $
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: bfarber $
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Revision: 6596 $
* @link http://hatynka.in
* @version $Revision: 8644 $
*
*/
@@ -29,7 +29,6 @@ class public_forums_moderate_multimod extends ipsCommand
/**
* Temporary stored output HTML
*
* @access public
* @var string
*/
public $output;
@@ -37,73 +36,64 @@ class public_forums_moderate_multimod extends ipsCommand
/**
* Moderator function library
*
* @access private
* @var object
*/
private $modLibrary;
protected $modLibrary;
/**
* Moderator information
*
* @access private
* @var array Array of moderator details
*/
private $moderator = array();
protected $moderator = array();
/**
* Forum information
*
* @access private
* @var array Array of forum details
*/
private $forum = array();
protected $forum = array();
/**
* Topic information
*
* @access private
* @var array Array of topic details
*/
private $topic = array();
protected $topic = array();
/**
* Topic id
*
* @access private
* @var integer Topic id
*/
private $topic_id = 0;
protected $topic_id = 0;
/**
* Forum id
*
* @access private
* @var integer Forum id
*/
private $forum_id = 0;
protected $forum_id = 0;
/**
* Multimod id
*
* @access private
* @var integer Multimod id
*/
private $mm_id = 0;
protected $mm_id = 0;
/**
* Multimod data
*
* @access private
* @var array Multimod data
*/
private $mm_data = array();
protected $mm_data = array();
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
@@ -281,8 +271,6 @@ class public_forums_moderate_multimod extends ipsCommand
if ( $this->mm_data['topic_reply'] and $this->mm_data['topic_reply_content'] )
{
$this->modLibrary->auto_update = FALSE; // Turn off auto forum re-synch, we'll manually do it at the end
IPSText::getTextClass('bbcode')->parse_smilies = 1;
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
IPSText::getTextClass('bbcode')->parse_html = 1;
@@ -336,6 +324,8 @@ class public_forums_moderate_multimod extends ipsCommand
$this->modLibrary->forumRecount( $this->forum['id'] );
$this->cache->rebuildCache( 'stats', 'global' );
//-----------------------------------------
// Add mod log
//-----------------------------------------
@@ -346,7 +336,7 @@ class public_forums_moderate_multimod extends ipsCommand
// Redirect back with nice fluffy message
//-----------------------------------------
$this->registry->output->redirectScreen( sprintf($this->lang->words['mm_applied'], $this->mm_data['mm_title'] ), $this->settings['base_url'] . "showforum=" . $this->forum['id'], $this->forum['name_seo'] );
$this->registry->output->redirectScreen( sprintf($this->lang->words['mm_applied'], $this->mm_data['mm_title'] ), $this->settings['base_url'] . "showforum=" . $this->forum['id'], $this->forum['name_seo'], 'showforum' );
}
}
@@ -1,31 +1,14 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* Forum posting default section
* Last Updated: $LastChangedDate: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @file defaultSection.php Define the default section for the 'post' module
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: This is NULLED!
* $Author: ips_terabyte $
* @since 14th May 2003
* @version $Rev: 5713 $
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
* @version v3.2.3
* $Revision: 8655 $
*/
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();
}
/**
* Very simply returns the default section if one is not
* passed in the URL
*/
$DEFAULT_SECTION = 'post';
@@ -5,6 +5,6 @@
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionboard.com/">IP.Board</a>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -2,19 +2,19 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Posting
* Last Updated: $Date: 2010-10-20 09:03:17 -0400 (Wed, 20 Oct 2010) $
* Last Updated: $Date: 2011-09-16 07:16:26 -0400 (Fri, 16 Sep 2011) $
* </pre>
* File Created By: Matt Mecham
*
* @author $Author: ips_terabyte $
* @author $Author: mmecham $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 7003 $
* @link http://hatynka.in
* @version $Rev: 9496 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -43,7 +43,7 @@ class public_forums_post_post extends ipsCommand
* Controller run function
*
* @param object Registry
* @return void
* @return @e void
*/
public function doExecute( ipsRegistry $registry )
{
@@ -75,16 +75,16 @@ class public_forums_post_post extends ipsCommand
// Check the input
//-----------------------------------------
$this->request[ 't' ] = intval($this->request['t'] );
$this->request[ 'p' ] = intval($this->request['p'] );
$this->request[ 'f' ] = intval($this->request['f'] );
$this->request[ 'st'] = intval($this->request['st'] );
$this->request[ 't' ] = intval($this->request['t']);
$this->request[ 'p' ] = intval($this->request['p']);
$this->request[ 'f' ] = intval($this->request['f']);
$this->request[ 'st'] = intval($this->request['st']);
//-----------------------------------------
// Grab the post class
//-----------------------------------------
require_once( IPSLib::getAppDir( 'forums' ) . '/sources/classes/post/classPost.php' );
require_once( IPSLib::getAppDir( 'forums' ) . '/sources/classes/post/classPost.php' );/*noLibHook*/
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/sources/classes/post/classPostForms.php', 'classPostForms', 'forums' );
$this->_postClass = new $classToLoad( $registry );
@@ -97,13 +97,12 @@ class public_forums_post_post extends ipsCommand
$this->_postClass->setPostID( $this->request['p'] );
$this->_postClass->setForumID( $this->request['f'] );
# Topic Title and description - use _POST as it is cleaned in the function.
# Topic Title use _POST as it is cleaned in the function.
# We wrap this because the title may not be set when showing a form and would
# throw a length error
if ( $_POST['TopicTitle'] )
{
$this->_postClass->setTopicTitle( $_POST['TopicTitle'] );
$this->_postClass->setTopicDescription( $_POST['TopicDesc'] );
}
# Is Preview Mode
@@ -128,7 +127,7 @@ class public_forums_post_post extends ipsCommand
# Published
$this->_postClass->setPublished( $this->_checkPostModeration( $doCodes[ $do ][1] ) === TRUE ? TRUE : FALSE );
$this->_postClass->setPublished( $doCodes[ $do ][1] );
# Post Content
$this->_postClass->setPostContent( isset( $_POST['Post'] ) ? $_POST['Post'] : '' );
@@ -200,7 +199,7 @@ class public_forums_post_post extends ipsCommand
{
if ( $this->memberData['g_avoid_flood'] != 1 )
{
if ( time() - $this->memberData['last_post'] < $this->settings['flood_control'] )
if ( ( time() - $this->memberData['last_post'] < $this->settings['flood_control'] ) OR time() < $this->memberData['last_post'] )
{
$this->registry->getClass('output')->showError( array( 'flood_control', $this->settings['flood_control'] ), 103128, null, null, 403 );
}
@@ -246,7 +245,7 @@ class public_forums_post_post extends ipsCommand
// Make sure we have a "Guest" Name..
//-----------------------------------------
$this->_check_guest_name();
$this->_fixGuestName();
$this->checkDoublePost();
$this->saveForm( $doCodes[ $do ][1] );
@@ -261,7 +260,7 @@ class public_forums_post_post extends ipsCommand
* Save the form
*
* @param string Type of form to show
* @return void
* @return @e void
*/
public function saveForm( $type )
{
@@ -328,7 +327,7 @@ class public_forums_post_post extends ipsCommand
$this->showForm( $type );
}
$this->registry->getClass('output')->showError( $error->getMessage(), 103130 );
$this->registry->getClass('output')->showError( $error->getMessage(), 103130, null, null, 403 );
}
break;
case 'new':
@@ -350,7 +349,7 @@ class public_forums_post_post extends ipsCommand
catch( Exception $error )
{
$language = $this->lang->words[ $error->getMessage() ] ? $this->lang->words[ $error->getMessage() ] : $error->getMessage();
$this->registry->getClass('output')->showError( $language, 103131 );
$this->registry->getClass('output')->showError( $language, 103131, null, null, 403 );
}
break;
case 'edit':
@@ -366,13 +365,23 @@ class public_forums_post_post extends ipsCommand
$topic = $this->_postClass->getTopicData();
$post = $this->_postClass->getPostData();
if( $this->request['return'] )
{
$_bits = explode( ':', $this->request['return'] );
if( count($_bits) AND $_bits[0] == 'modcp' )
{
$this->registry->output->redirectScreen( $this->lang->words['post_edited'], $this->settings['base_url'] . "app=core&amp;module=modcp&amp;fromapp=forums&amp;tab=" . $_bits[1] . 'posts' );
}
}
# 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'] );
}
catch( Exception $error )
{
$this->registry->getClass('output')->showError( $error->getMessage(), 103132 );
$this->registry->getClass('output')->showError( $error->getMessage(), 103132, null, null, 403 );
}
break;
}
@@ -404,7 +413,7 @@ class public_forums_post_post extends ipsCommand
}
else
{
$this->registry->getClass('output')->showError( $this->lang->words[ $error->getMessage() ] ? $this->lang->words[ $error->getMessage() ] : $error->getMessage(), 103133 );
$this->registry->getClass('output')->showError( $this->lang->words[ $error->getMessage() ] ? $this->lang->words[ $error->getMessage() ] : $error->getMessage(), 103133, null, null, 403 );
}
}
break;
@@ -427,7 +436,7 @@ class public_forums_post_post extends ipsCommand
}
else
{
$this->registry->getClass('output')->showError( $this->lang->words[ $error->getMessage() ] ? $this->lang->words[ $error->getMessage() ] : $error->getMessage(), 103134 );
$this->registry->getClass('output')->showError( $this->lang->words[ $error->getMessage() ] ? $this->lang->words[ $error->getMessage() ] : $error->getMessage(), 103134, null, null, 403 );
}
}
break;
@@ -446,7 +455,7 @@ class public_forums_post_post extends ipsCommand
}
else
{
$this->registry->getClass('output')->showError( $this->lang->words[ $error->getMessage() ] ? $this->lang->words[ $error->getMessage() ] : $error->getMessage(), 103135 );
$this->registry->getClass('output')->showError( $this->lang->words[ $error->getMessage() ] ? $this->lang->words[ $error->getMessage() ] : $error->getMessage(), 103135, null, null, 403 );
}
}
break;
@@ -460,34 +469,38 @@ class public_forums_post_post extends ipsCommand
*/
public function checkDoublePost()
{
if( ! $this->_postClass->getIsPreview() )
if ( ! $this->_postClass->getIsPreview() )
{
if( time() - $this->memberData['last_post'] <= 5 )
if ( time() - $this->memberData['last_post'] <= 4 )
{
if( $this->request['do'] == '01' or $this->request['do'] == '11' )
if ( $this->request['do'] == 'new_post_do' )
{
/* Redirect to the newest topic in the forum */
$forum = $this->_postClass->getForumData();
$this->DB->build( array(
'select' => 'tid',
'from' => 'topics',
'where' => "forum_id='" . $forum['id'] . "' AND approved=1",
'order' => 'last_post DESC',
'limit' => array( 0, 1 )
) );
$this->DB->execute();
$topic = $this->DB->fetch();
$topic = $this->DB->buildAndFetch( array(
'select' => 'tid',
'from' => 'topics',
'where' => "forum_id='" . $forum['id'] . "' AND " . $this->registry->getClass('class_forums')->fetchTopicHiddenQuery( array( 'visible' ), '' ),
'order' => 'last_post DESC',
'limit' => array( 0, 1 )
) );
$this->registry->getClass('output')->silentRedirect( "{$this->settings['base_url']}showtopic={$topic['tid']}" );
exit();
}
else
{
/* It's a reply, so simply show the topic... */
$this->registry->getClass('output')->silentRedirect( "{$this->settings['base_url']}showtopic={$this->request['t']}&amp;view=getlastpost" );
exit();
/* Verify if last post was made to this same topic
@link http://community.invisionpower.com/tracker/issue-25712-replying-to-two-topics-at-same-time-causing-only-one-post-to-actually-make-it-into-the-database */
$_lastPost = $this->DB->buildAndFetch( array( 'select' => 'topic_id', 'from' => 'posts', 'where' => 'author_id=' . $this->memberData['member_id'], 'order' => 'post_date DESC', 'limit' => array( 0, 1 ) ) );
/* We made a reply within the last 4 seconds to this topic.. */
if( $_lastPost['topic_id'] == $this->request['t'] )
{
$this->registry->getClass('output')->silentRedirect( "{$this->settings['base_url']}showtopic={$this->request['t']}&amp;view=getlastpost" );
exit();
}
}
}
}
@@ -496,15 +509,10 @@ class public_forums_post_post extends ipsCommand
/**
* Check for guest's name being in use
*
* @return void
* @deprecated As far as I can see this function is not used anywhere, we should remove it for 3.2
* @return @e void
*/
private function _check_guest_name()
protected function _fixGuestName()
{
/* is this even used anymore?
I disabled it 'cos it was adding the prefix and suffix twice when using a 'found' name
-- Matt */
if ( ! $this->memberData['member_id'] )
{
$this->request['UserName'] = trim( $this->request['UserName'] );
@@ -514,103 +522,6 @@ class public_forums_post_post extends ipsCommand
$this->request['UserName'] = IPSText::mbstrlen( $this->request['UserName'] ) > $this->settings['max_user_name_length'] ? $this->lang->words['global_guestname'] : $this->request['UserName'];
}
return;
/*if( ! $this->memberData['member_id'] )
{
$this->request['UserName'] = trim( $this->request['UserName'] );
$this->request['UserName'] = str_replace( '<br />', '', $this->request['UserName'] );
$this->request['UserName'] = $this->request['UserName'] ? $this->request['UserName'] : $this->lang->words['global_guestname'] ;
$this->request['UserName'] = IPSText::mbstrlen( $this->request['UserName'] ) > $this->settings['max_user_name_length'] ? $this->lang->words['global_guestname'] : $this->request['UserName'];
if ($this->request['UserName'] != $this->lang->words['global_guestname'])
{
$this->DB->build( array(
'select' => 'member_id, name, members_display_name, members_created_remote, email, member_group_id, member_login_key, ip_address, login_anonymous',
'from' => 'members',
'where' => 'members_l_username=\'' . trim( strtolower( $this->request['UserName'] ) ) . '\''
) );
$this->DB->execute();
if ( $this->DB->getTotalRows() )
{
$this->request['UserName'] = $this->settings['guest_name_pre'] . $this->request['UserName'] . $this->settings['guest_name_suf'] ;
}
}
}*/
}
/**
* Checks to see if this member is forced to have their posts
* moderated
*
* @param string Type of post (new, reply, edit, poll)
* @return boolean Whether to PUBLISH this topic or not
*/
private function _checkPostModeration( $type )
{
/* Does this member have mod_posts enabled? */
if ( $this->memberData['mod_posts'] )
{
/* Mod Queue Forever */
if ( $this->memberData['mod_posts'] == 1 )
{
return FALSE;
}
else
{
/* Do we need to remove the mod queue for this user? */
$mod_arr = IPSMember::processBanEntry( $this->memberData['mod_posts'] );
/* Yes, they are ok now */
if ( time() >= $mod_arr['date_end'] )
{
IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'mod_posts' => 0 ) ) );
}
/* Nope, still don't want to see them */
else
{
return FALSE;
}
}
}
/* Group can bypass mod queue */
if( $this->memberData['g_avoid_q'] )
{
return TRUE;
}
/* Is the member's group moderated? */
if ( $this->_postClass->checkGroupIsPostModerated( $this->memberData ) === TRUE )
{
return FALSE;
}
/* Check to see if this forum has moderation enabled */
$forum = $this->_postClass->getForumData();
switch( intval( $forum['preview_posts'] ) )
{
default:
case 0:
return TRUE;
break;
case 1:
return FALSE;
break;
case 2:
return ( $type == 'new' ) ? FALSE : TRUE;
break;
case 3:
return ( $type == 'reply' ) ? FALSE : TRUE;
break;
}
/* Our post can be seen! */
return TRUE;
}
/**
@@ -618,7 +529,7 @@ class public_forums_post_post extends ipsCommand
*
* @return string
*/
private function _fetchPpdError()
protected function _fetchPpdError()
{
$_g = $this->caches['group_cache'][ $this->memberData['member_group_id'] ];
$_l = sprintf( $this->lang->words['NO_POSTING_PPD'], $_g['g_ppd_limit'] );