Version 3.2.3
This commit is contained in:
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
|
||||
* Moderator actions
|
||||
* 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' ) )
|
||||
@@ -37,34 +37,6 @@ class digestLibrary
|
||||
* @var string topic|forum
|
||||
*/
|
||||
public $digest_type = 'topic';
|
||||
|
||||
/**
|
||||
* Midnight time
|
||||
*
|
||||
* @var integer Timestamp
|
||||
*/
|
||||
public $midnight = 0;
|
||||
|
||||
/**
|
||||
* Last week timestamp
|
||||
*
|
||||
* @var integer Timestamp
|
||||
*/
|
||||
public $last_week = 0;
|
||||
|
||||
/**
|
||||
* Yesterday timestamp
|
||||
*
|
||||
* @var integer Timestamp
|
||||
*/
|
||||
public $last_day = 0;
|
||||
|
||||
/**
|
||||
* Last time timestamp
|
||||
*
|
||||
* @var integer Timestamp
|
||||
*/
|
||||
public $last_time = 0;
|
||||
|
||||
/**#@+
|
||||
* Registry Object Shortcuts
|
||||
@@ -86,7 +58,7 @@ class digestLibrary
|
||||
* Constructor
|
||||
*
|
||||
* @param object Registry reference
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry )
|
||||
{
|
||||
@@ -110,387 +82,51 @@ class digestLibrary
|
||||
$this->registry->class_forums->forumsInit();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get midnight (GMT - roughly)
|
||||
//-----------------------------------------
|
||||
|
||||
$this->midnight = mktime( 0, 0 );
|
||||
|
||||
//-----------------------------------------
|
||||
// Midnight today minus a weeks worth of secs
|
||||
//-----------------------------------------
|
||||
|
||||
$this->last_week = $this->midnight - 604800;
|
||||
|
||||
//-----------------------------------------
|
||||
// Midnight today minus a day worth of secs
|
||||
//-----------------------------------------
|
||||
|
||||
$this->last_day = $this->midnight - 86400;
|
||||
|
||||
//-----------------------------------------
|
||||
// Get some lang bits
|
||||
//-----------------------------------------
|
||||
|
||||
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'public_emails' ), 'core' );
|
||||
/* Load language files */
|
||||
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'public_emails', 'public_email_content' ), 'core' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the digest
|
||||
*
|
||||
* @return void
|
||||
* @param string Frequency (daily/weekly)
|
||||
* @param string Type (topic/forum)
|
||||
* @return @e void
|
||||
*/
|
||||
public function runDigest()
|
||||
public function runDigest( $frequency='daily', $type='topic' )
|
||||
{
|
||||
$this->last_time = $this->digest_time == 'daily' ? $this->last_day : $this->last_week;
|
||||
|
||||
if ( $this->digest_type == 'topic' )
|
||||
if ( $type == 'topic' )
|
||||
{
|
||||
$this->_sendTopicDigest();
|
||||
$this->_sendTopicDigest( $frequency );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_sendForumDigest();
|
||||
$this->_sendForumDigest( $frequency );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the digest
|
||||
*
|
||||
* @return void
|
||||
* @param string Frequency (daily/weekly)
|
||||
* @return @e void
|
||||
*/
|
||||
private function _sendTopicDigest()
|
||||
protected function _sendTopicDigest( $frequency )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Notifications library
|
||||
//-----------------------------------------
|
||||
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications' );
|
||||
$notifyLibrary = new $classToLoad( $this->registry );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get all posts / topics
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array( 'select' => 'tr.trid, tr.topic_id, tr.member_id as trmid',
|
||||
'from' => array( 'tracker' => 'tr' ),
|
||||
'where' => "tr.topic_track_type='{$this->digest_time}' AND t.approved=1 AND t.last_post > {$this->last_time}",
|
||||
'add_join' => array(
|
||||
array( 'select' => 'm.member_group_id, m.mgroup_others, m.org_perm_id, m.members_display_name, m.email, m.posts, m.member_id, m.email_full, m.language, m.last_activity',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=tr.member_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
array( 'select' => 't.*',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.tid=tr.topic_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
) ) );
|
||||
$topic_query = $this->DB->execute();
|
||||
|
||||
//-----------------------------------------
|
||||
// Now, loop print and send to subscribers
|
||||
//-----------------------------------------
|
||||
|
||||
$main_output = "";
|
||||
$count = 0;
|
||||
$cached = array();
|
||||
$subject = $this->digest_time == 'daily' ? 'digest_topic_daily' : 'digest_topic_weekly';
|
||||
$trids = array();
|
||||
|
||||
while( $t = $this->DB->fetch( $topic_query ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Can access forum/topic?
|
||||
//-----------------------------------------
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
|
||||
$_like = classes_like::bootstrap( 'forums','topics' );
|
||||
|
||||
if( !$this->registry->getClass('class_forums')->checkEmailAccess($t) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Topic approved or is a mod?
|
||||
//-----------------------------------------
|
||||
|
||||
if( !$this->registry->getClass('class_forums')->checkEmailApproved($t) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Build email
|
||||
//-----------------------------------------
|
||||
|
||||
$main_output = "";
|
||||
$others_posted = 0;
|
||||
|
||||
if ( ! $cached[ $t['tid'] ] )
|
||||
{
|
||||
$topic_title = $t['title'];
|
||||
$forum_name = ipsRegistry::getClass('class_forums')->allForums[ $t['forum_id'] ]['name'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Get posts...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'posts',
|
||||
'where' => "topic_id={$t['tid']} AND queued=0 AND post_date > {$this->last_time}",
|
||||
'order' => 'post_date' ) );
|
||||
|
||||
$post_query = $this->DB->execute();
|
||||
|
||||
$post_output = "";
|
||||
|
||||
while( $p = $this->DB->fetch( $post_query ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Do we have other posters?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $t['trmid'] != $p['author_id'] )
|
||||
{
|
||||
$others_posted = 1;
|
||||
}
|
||||
|
||||
$post_author = $p['author_name'];
|
||||
$post_date = ipsRegistry::getClass( 'class_localization')->getDate( $p['post_date'], 'SHORT' );
|
||||
$post_content = $p['post'];
|
||||
|
||||
$post_output .= "<br />-------------------------------------------<br />"
|
||||
. "{$post_author} -- {$post_date}<br />{$post_content}<br /><br />";
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Skip if there is no content...
|
||||
//-----------------------------------------
|
||||
|
||||
if( !$post_output )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Process
|
||||
//-----------------------------------------
|
||||
|
||||
$main_output .= $this->lang->words['topic_langbit'] . ": {$topic_title} (" . $this->lang->words['forum_langbit'] . ": {$forum_name})<br />"
|
||||
. $this->registry->getClass('output')->buildSEOUrl( $this->settings['board_url'] . '/index.php?showtopic=' . $t['tid'], 'none', $t['title_seo'], 'showtopic' ) . "<br />"
|
||||
. "=====================================<br />"
|
||||
. $post_output
|
||||
. "<br />=====================================<br />";
|
||||
|
||||
$cached[ $t['tid'] ] = $main_output;
|
||||
}
|
||||
else
|
||||
{
|
||||
$others_posted = 1;
|
||||
$main_output = $cached[ $t['tid'] ];
|
||||
}
|
||||
|
||||
if ( $others_posted )
|
||||
{
|
||||
$trids[ $t['trid'] ] = intval( $t['trid'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Send notification...
|
||||
//-----------------------------------------
|
||||
|
||||
IPSText::getTextClass('email')->getTemplate( $subject, $t['language'] );
|
||||
|
||||
IPSText::getTextClass( 'email' )->buildMessage( array(
|
||||
'TOPIC_ID' => $t['tid'],
|
||||
'FORUM_ID' => $t['forum_id'],
|
||||
'TITLE' => $topic_title,
|
||||
'NAME' => $t['members_display_name'],
|
||||
'CONTENT' => $main_output,
|
||||
) );
|
||||
|
||||
$notifyLibrary->setMember( $t );
|
||||
$notifyLibrary->setFrom( array() );
|
||||
$notifyLibrary->setNotificationKey( 'new_reply' );
|
||||
$notifyLibrary->setNotificationText( IPSText::getTextClass('email')->message );
|
||||
$notifyLibrary->setNotificationTitle( IPSText::getTextClass('email')->subject );
|
||||
|
||||
try
|
||||
{
|
||||
$notifyLibrary->sendNotification();
|
||||
}
|
||||
catch( Exception $e ){}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Update sent time */
|
||||
if ( count( $trids ) )
|
||||
{
|
||||
$this->DB->update( 'tracker', array( 'last_sent' => time() ), 'trid IN (' . implode( ',', $trids ) . ')' );
|
||||
}
|
||||
$_like->sendDigestNotifications( ( $frequency == 'daily' ) ? 'daily' : 'weekly' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the digest
|
||||
*
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
private function _sendForumDigest()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Notifications library
|
||||
//-----------------------------------------
|
||||
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications' );
|
||||
$notifyLibrary = new $classToLoad( $this->registry );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get all posts / topics
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array( 'select' => 'ft.*',
|
||||
'from' => array( 'forum_tracker' => 'ft' ),
|
||||
'where' => "ft.forum_track_type='{$this->digest_time}'",
|
||||
'add_join' => array(
|
||||
array( 'select' => 'm.members_display_name, m.member_group_id, m.mgroup_others, m.org_perm_id, m.member_id, m.email, m.language, m.posts',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=ft.member_id',
|
||||
'type' => 'left'
|
||||
)
|
||||
) ) );
|
||||
$forum_query = $this->DB->execute();
|
||||
|
||||
//-----------------------------------------
|
||||
// Now, loop print and send to subscribers
|
||||
//-----------------------------------------
|
||||
|
||||
$main_output = "";
|
||||
$count = 0;
|
||||
$cached = array();
|
||||
$subject = $this->digest_time == 'daily' ? 'digest_forum_daily' : 'digest_forum_weekly';
|
||||
$frids = array();
|
||||
|
||||
while( $t = $this->DB->fetch( $forum_query ) )
|
||||
{
|
||||
$main_output = "";
|
||||
$others_posted = 0;
|
||||
protected function _sendForumDigest( $frequency )
|
||||
{
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
|
||||
$_like = classes_like::bootstrap( 'forums', 'forums' );
|
||||
|
||||
$forum_name = ipsRegistry::getClass('class_forums')->allForums[ $t['forum_id'] ]['name'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Get topics...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'topics',
|
||||
'where' => "forum_id={$t['forum_id']} AND last_post > {$this->last_time}",
|
||||
) );
|
||||
$topic_query = $this->DB->execute();
|
||||
|
||||
$post_output = "";
|
||||
|
||||
while( $p = $this->DB->fetch( $topic_query ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Check access
|
||||
//-----------------------------------------
|
||||
|
||||
if( !$this->registry->getClass('class_forums')->checkEmailAccess( array_merge($t,$p) ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Topic approved or is a mod?
|
||||
//-----------------------------------------
|
||||
|
||||
if( !$this->registry->getClass('class_forums')->checkEmailApproved( array_merge($t,$p) ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$post = $this->DB->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'posts',
|
||||
'where' => 'topic_id=' . $p['tid'],
|
||||
'order' => 'post_date DESC',
|
||||
'limit' => array( 1 )
|
||||
) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Do we have other posters?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $t['member_id'] != $post['author_id'] )
|
||||
{
|
||||
$others_posted = 1;
|
||||
}
|
||||
|
||||
$post_author = $post['author_name'];
|
||||
$post_date = ipsRegistry::getClass('class_localization')->getDate( $post['post_date'], 'SHORT' );
|
||||
$post_content = $post['post'];
|
||||
$topic_title = $p['title'];
|
||||
|
||||
$post_output .= "<br />-------------------------------------------<br />"
|
||||
. $this->lang->words['topic_langbit'] . ": {$topic_title} ({$post_author} -- {$post_date})<br />"
|
||||
. $this->registry->getClass('output')->buildSEOUrl( $this->settings['board_url'] . '/index.php?showtopic=' . $p['tid'], 'none', $p['title_seo'], 'showtopic' )
|
||||
. "<br />............................................<br />"
|
||||
. "{$post_content}<br /><br />";
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Skip if there is no content...
|
||||
//-----------------------------------------
|
||||
|
||||
if( $post_output == '' )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Process
|
||||
//-----------------------------------------
|
||||
|
||||
$main_output = $this->lang->words['forum_langbit'] . ": {$forum_name}<br />"
|
||||
. "=====================================<br />"
|
||||
. $post_output
|
||||
. "<br />=====================================<br />";
|
||||
|
||||
if ( $others_posted )
|
||||
{
|
||||
$frids[ $t['frid'] ] = intval( $t['frid'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Send notification...
|
||||
//-----------------------------------------
|
||||
|
||||
IPSText::getTextClass('email')->getTemplate( $subject, $t['language'] );
|
||||
|
||||
IPSText::getTextClass( 'email' )->buildMessage( array(
|
||||
'FORUM_ID' => $t['forum_id'],
|
||||
'FORUM_NAME' => $forum_name,
|
||||
'NAME' => $t['members_display_name'],
|
||||
'CONTENT' => $main_output,
|
||||
) );
|
||||
|
||||
$notifyLibrary->setMember( $t );
|
||||
$notifyLibrary->setFrom( array() );
|
||||
$notifyLibrary->setNotificationKey( 'new_topic' );
|
||||
$notifyLibrary->setNotificationText( IPSText::getTextClass('email')->message );
|
||||
$notifyLibrary->setNotificationTitle( IPSText::getTextClass('email')->subject );
|
||||
|
||||
try
|
||||
{
|
||||
$notifyLibrary->sendNotification();
|
||||
}
|
||||
catch( Exception $e ){}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Update sent time */
|
||||
if ( count( $frids ) )
|
||||
{
|
||||
$this->DB->update( 'forum_tracker', array( 'last_sent' => time() ), 'frid IN (' . implode( ',', $frids ) . ')' );
|
||||
}
|
||||
$_like->sendDigestNotifications( ( $frequency == 'daily' ) ? 'daily' : 'weekly' );
|
||||
}
|
||||
}
|
||||
+81
-141
@@ -1,35 +1,35 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.2.3
|
||||
* Admin forum functions library
|
||||
* 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 This is NULLED!
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://hatynka.in
|
||||
* @since 26th January 2004
|
||||
* @version $Rev: 8644 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* Admin forum functions library
|
||||
* Last Updated: $Date: 2010-05-20 17:04:12 -0400 (Thu, 20 May 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 26th January 2004
|
||||
* @version $Rev: 6344 $
|
||||
*
|
||||
*/
|
||||
class admin_forum_functions extends class_forums
|
||||
{
|
||||
/**
|
||||
* HTML object
|
||||
*
|
||||
* @access public
|
||||
* @var object
|
||||
*/
|
||||
public $html;
|
||||
@@ -37,7 +37,6 @@ class admin_forum_functions extends class_forums
|
||||
/**
|
||||
* Type
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = "";
|
||||
@@ -45,23 +44,13 @@ class admin_forum_functions extends class_forums
|
||||
/**
|
||||
* How many printed
|
||||
*
|
||||
* @access public
|
||||
* @var integer
|
||||
*/
|
||||
public $printed = 0;
|
||||
|
||||
/**
|
||||
* Whether to show all or not
|
||||
*
|
||||
* @access public
|
||||
* @var boolean
|
||||
*/
|
||||
public $show_all = false;
|
||||
|
||||
|
||||
/**
|
||||
* Cached skin id -> names
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $skins = array();
|
||||
@@ -69,7 +58,6 @@ class admin_forum_functions extends class_forums
|
||||
/**
|
||||
* Need descriptions
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $need_desc = array();
|
||||
@@ -77,12 +65,11 @@ class admin_forum_functions extends class_forums
|
||||
/**
|
||||
* Build forum children
|
||||
*
|
||||
* @access public
|
||||
* @param integer $root_id
|
||||
* @param string $temp_html
|
||||
* @param string $depth_guide
|
||||
* @return string
|
||||
**/
|
||||
*/
|
||||
public function forumBuildChildren( $root_id, $temp_html="", $depth_guide="" )
|
||||
{
|
||||
if ( isset( $this->forum_cache[ $root_id ] ) AND is_array( $this->forum_cache[ $root_id ] ) )
|
||||
@@ -107,11 +94,10 @@ class admin_forum_functions extends class_forums
|
||||
/**
|
||||
* Build forum
|
||||
*
|
||||
* @access public
|
||||
* @param integer $r
|
||||
* @param string $depth_guide
|
||||
* @return string
|
||||
**/
|
||||
*/
|
||||
public function renderForum( $r, $depth_guide="" )
|
||||
{
|
||||
//-----------------------------------------
|
||||
@@ -132,54 +118,49 @@ class admin_forum_functions extends class_forums
|
||||
//-----------------------------------------
|
||||
// Show main forums...
|
||||
//-----------------------------------------
|
||||
|
||||
$children = $this->forumsGetChildren( $r['id'] );
|
||||
|
||||
if ( ! $this->show_all )
|
||||
$sub = array();
|
||||
$subforums = "";
|
||||
$count = 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Build sub-forums link
|
||||
//-----------------------------------------
|
||||
|
||||
if ( count($children) )
|
||||
{
|
||||
$children = $this->forumsGetChildren( $r['id'] );
|
||||
$r['name'] = "<a href='{$this->settings['base_url']}f={$r['id']}'>" . $r['name'] . "</a>";
|
||||
|
||||
$sub = array();
|
||||
$subforums = "";
|
||||
$count = 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Build sub-forums link
|
||||
//-----------------------------------------
|
||||
|
||||
if ( count($children) )
|
||||
foreach ( $children as $cid )
|
||||
{
|
||||
$r['name'] = "<a href='{$this->settings['base_url']}f={$r['id']}'>" . $r['name'] . "</a>";
|
||||
$count++;
|
||||
|
||||
foreach ( $children as $cid )
|
||||
$cfid = $cid;
|
||||
|
||||
if ( $count == count( $children ) )
|
||||
{
|
||||
$count++;
|
||||
//-----------------------------------------
|
||||
// Last subforum, link to parent
|
||||
// forum...
|
||||
//-----------------------------------------
|
||||
|
||||
$cfid = $cid;
|
||||
|
||||
if ( $count == count( $children ) )
|
||||
if ( !isset($children[ $count - 2 ]) OR ! $cfid = $children[ $count - 2 ] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Last subforum, link to parent
|
||||
// forum...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( !isset($children[ $count - 2 ]) OR ! $cfid = $children[ $count - 2 ] )
|
||||
{
|
||||
$cfid = $r['id'];
|
||||
}
|
||||
$cfid = $r['id'];
|
||||
}
|
||||
|
||||
$sub[] = "<a href='{$this->settings['base_url']}f={$this->forum_by_id[$cid]['parent_id']}'>".$this->forum_by_id[$cid]['name']."</a>";
|
||||
}
|
||||
|
||||
$sub[] = "<a href='{$this->settings['base_url']}f={$this->forum_by_id[$cid]['parent_id']}'>".$this->forum_by_id[$cid]['name']."</a>";
|
||||
}
|
||||
|
||||
if ( count( $sub ) )
|
||||
{
|
||||
$subforums = '<fieldset style="margin-top:4px"><legend>' . $this->lang->words['acp_subforum_legend'] . '</legend>' . implode( ", ", $sub ) . '</fieldset>';
|
||||
}
|
||||
|
||||
//$desc = "{$r['description']}{$subforums}";
|
||||
}
|
||||
|
||||
if ( count( $sub ) )
|
||||
{
|
||||
$subforums = '<fieldset class="subforums"><legend>' . $this->lang->words['acp_subforum_legend'] . '</legend>' . implode( ", ", $sub ) . '</fieldset>';
|
||||
}
|
||||
|
||||
$desc = "{$r['description']}{$subforums}";
|
||||
|
||||
//-----------------------------------------
|
||||
@@ -187,6 +168,7 @@ class admin_forum_functions extends class_forums
|
||||
//-----------------------------------------
|
||||
|
||||
$r['_modstring'] = "";
|
||||
$r['_mods'] = array();
|
||||
|
||||
foreach( $this->moderators as $data )
|
||||
{
|
||||
@@ -195,7 +177,7 @@ class admin_forum_functions extends class_forums
|
||||
foreach( $forum_ids as $forum_id )
|
||||
{
|
||||
if ( $forum_id == $r['id'] )
|
||||
{
|
||||
{
|
||||
if ($data['is_group'] == 1)
|
||||
{
|
||||
$data['_fullname'] = $this->lang->words['fc_group_prefix'] . $data['group_name'];
|
||||
@@ -206,17 +188,23 @@ class admin_forum_functions extends class_forums
|
||||
}
|
||||
|
||||
$data['randId'] = substr( str_replace( array( ' ', '.' ), '', uniqid( microtime(), true ) ), 0, 10 );
|
||||
$data['forum_id'] = $forum_id;
|
||||
|
||||
$r['_modstring'] .= $this->html->renderModeratorEntry( $data, $forum_id );
|
||||
$r['_mods'][] = $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( count( $r['_mods'] ) )
|
||||
{
|
||||
$r['_modstring'] = $this->html->renderModeratorEntry( $r['_mods'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Print
|
||||
//-----------------------------------------
|
||||
|
||||
$this->skins[$r['skin_id']] = ( isset($this->skins[ $r['skin_id'] ] ) AND $this->skins[ $r['skin_id'] ] ) ? $this->skins[ $r['skin_id'] ] : '';
|
||||
$this->skins[$r['skin_id']] = !empty($this->skins[ $r['skin_id'] ] ) ? $this->skins[ $r['skin_id'] ] : '';
|
||||
|
||||
return $this->html->renderForumRow( $desc, $r, $depth_guide, $this->skins[ $r['skin_id'] ] );
|
||||
}
|
||||
@@ -225,35 +213,30 @@ class admin_forum_functions extends class_forums
|
||||
/**
|
||||
* Show Category
|
||||
*
|
||||
* @access public
|
||||
* @param string $content
|
||||
* @param array $r
|
||||
* @param bool $show_buttons
|
||||
* @return void
|
||||
**/
|
||||
public function forumShowCat( $content, $r, $show_buttons=1 )
|
||||
* @return @e void
|
||||
*/
|
||||
public function forumShowCat( $content, $r )
|
||||
{
|
||||
$this->printed++;
|
||||
|
||||
$no_root = count( $this->forum_cache['root'] );
|
||||
|
||||
$this->registry->output->html .= $this->html->forumWrapper( $content, $r, $show_buttons );
|
||||
$this->registry->output->html .= $this->html->forumWrapper( $content, $r );
|
||||
}
|
||||
|
||||
/**
|
||||
* List all forums
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
* @return @e void
|
||||
*/
|
||||
public function forumsListForums()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$this->show_all = intval( $this->request['showall'] );
|
||||
|
||||
|
||||
if ( ! $this->html )
|
||||
{
|
||||
$this->html = $this->registry->output->loadTemplate( 'cp_skin_forums' );
|
||||
@@ -271,52 +254,14 @@ class admin_forum_functions extends class_forums
|
||||
}
|
||||
}
|
||||
|
||||
$temp_html = "";
|
||||
$fid = intval( $this->request['f'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Show all forums
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->show_all )
|
||||
{
|
||||
foreach( $this->forum_cache['root'] as $forum_data )
|
||||
{
|
||||
$cat_data = $forum_data;
|
||||
$depth_guide = "";
|
||||
$temp_html = "";
|
||||
|
||||
if ( isset($this->forum_cache[ $forum_data['id'] ]) AND is_array( $this->forum_cache[ $forum_data['id'] ] ) )
|
||||
{
|
||||
foreach( $this->forum_cache[ $forum_data['id'] ] as $forum_data )
|
||||
{
|
||||
if ( $this->settings['forum_cache_minimum'] AND $this->settings['forum_cache_minimum'] )
|
||||
{
|
||||
$forum_data['description'] = "<!--DESCRIPTION:{$forum_data['id']}-->";
|
||||
$this->need_desc[] = $forum_data['id'];
|
||||
}
|
||||
|
||||
$temp_html .= $this->renderForum( $forum_data, $depth_guide );
|
||||
$temp_html = "";
|
||||
$fid = intval( $this->request['f'] );
|
||||
|
||||
$temp_html = $this->forumBuildChildren( $forum_data['id'], $temp_html, '<span style="color:gray">|</span>'.$depth_guide . $this->depth_guide );
|
||||
}
|
||||
}
|
||||
|
||||
if( !$temp_html )
|
||||
{
|
||||
$temp_html = $this->html->renderNoForums( $cat_data['id'] );
|
||||
}
|
||||
|
||||
$this->registry->output->html .= $this->forumShowCat( $temp_html, $cat_data );
|
||||
unset($temp_html);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Show root forums
|
||||
//-----------------------------------------
|
||||
|
||||
else if ( ! $fid )
|
||||
if ( ! $fid )
|
||||
{
|
||||
$seen_count = 0;
|
||||
$total_items = 0;
|
||||
@@ -360,10 +305,9 @@ class admin_forum_functions extends class_forums
|
||||
|
||||
else
|
||||
{
|
||||
$cat_data = array();
|
||||
$depth_guide = "";
|
||||
|
||||
|
||||
$cat_data = array();
|
||||
$depth_guide = "";
|
||||
|
||||
if ( is_array( $this->forum_cache[ $fid ] ) )
|
||||
{
|
||||
$cat_data = $this->forum_by_id[ $fid ];
|
||||
@@ -409,15 +353,14 @@ class admin_forum_functions extends class_forums
|
||||
/**
|
||||
* Build Forum Jump
|
||||
*
|
||||
* @access public
|
||||
* @param bool $restrict
|
||||
* @return array
|
||||
**/
|
||||
*/
|
||||
public function adForumsForumList( $restrict=0 )
|
||||
{
|
||||
if ( $restrict != 1 )
|
||||
{
|
||||
//$jump_array[] = array( '-1', 'Make Root (Category)' );
|
||||
$jump_array[] = array( '-1', 'Make Root (Category)' );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -447,13 +390,12 @@ class admin_forum_functions extends class_forums
|
||||
/**
|
||||
* Build Forum List Helper
|
||||
*
|
||||
* @access private
|
||||
* @param integer $root_id
|
||||
* @param array $jump_array
|
||||
* @param string $depth_guide
|
||||
* @return array
|
||||
**/
|
||||
private function forumsForumListInternal( $root_id, $jump_array=array(), $depth_guide="" )
|
||||
*/
|
||||
protected function forumsForumListInternal( $root_id, $jump_array=array(), $depth_guide="" )
|
||||
{
|
||||
if( isset($this->forum_cache[ $root_id ] ) AND is_array( $this->forum_cache[ $root_id ] ) )
|
||||
{
|
||||
@@ -471,9 +413,8 @@ class admin_forum_functions extends class_forums
|
||||
/**
|
||||
* Build Forum Data
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
**/
|
||||
*/
|
||||
public function adForumsForumData()
|
||||
{
|
||||
foreach( $this->forum_cache['root'] as $forum_data )
|
||||
@@ -504,12 +445,11 @@ class admin_forum_functions extends class_forums
|
||||
/**
|
||||
* Build Forum Data Helper
|
||||
*
|
||||
* @access public
|
||||
* @param integer $root_id
|
||||
* @param array $jump_array
|
||||
* @param string $depth_guide
|
||||
* @return array
|
||||
**/
|
||||
*/
|
||||
public function forumsForumDataInternal( $root_id, $jump_array=array(), $depth_guide="" )
|
||||
{
|
||||
if ( isset( $this->forum_cache[ $root_id ]) AND is_array( $this->forum_cache[ $root_id ] ) )
|
||||
|
||||
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>
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.2.3
|
||||
* Forum hook gateway
|
||||
* Owner: Matt "Oh Lord, why did I get assigned this?" Mecham
|
||||
* Last Updated: $Date: 2011-08-08 04:56:34 -0400 (Mon, 08 Aug 2011) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: mmecham $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license This is NULLED!
|
||||
* @package IP.Board
|
||||
* @link http://hatynka.in
|
||||
* @since 9th March 2005 11:03
|
||||
* @version $Revision: 9375 $
|
||||
*/
|
||||
class forums_hookGateway
|
||||
{
|
||||
/**
|
||||
* Registry Object Shortcuts
|
||||
*
|
||||
* @var $registry
|
||||
* @var $DB
|
||||
* @var $settings
|
||||
* @var $request
|
||||
* @var $lang
|
||||
* @var $member
|
||||
* @var $memberData
|
||||
* @var $cache
|
||||
* @var $caches
|
||||
*/
|
||||
protected $registry;
|
||||
protected $DB;
|
||||
protected $settings;
|
||||
protected $request;
|
||||
protected $lang;
|
||||
protected $member;
|
||||
protected $memberData;
|
||||
protected $cache;
|
||||
protected $caches;
|
||||
|
||||
/**
|
||||
* Method constructor
|
||||
*
|
||||
* @param object Registry Object
|
||||
* @return @e void
|
||||
*/
|
||||
function __construct( ipsRegistry $registry )
|
||||
{
|
||||
/* Make registry objects */
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->lang = $this->registry->getClass('class_localization');
|
||||
$this->member = $this->registry->member();
|
||||
$this->memberData =& $this->registry->member()->fetchMemberData();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows board index popular tags
|
||||
*
|
||||
*/
|
||||
public function tags()
|
||||
{
|
||||
$classToLoad = IPSLib::loadActionOverloader( IPS_ROOT_PATH . 'sources/classes/tags/cloud.php', 'classes_tags_cloud' );
|
||||
$cloud = new $classToLoad();
|
||||
|
||||
$cloud->setSkinGroup('boards');
|
||||
$cloud->setSkinTemplate('hookTagCloud');
|
||||
|
||||
return $cloud->render( $cloud->getCloudData( array('limit' => 50 ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head><title>IP.Board - Bulletin Board System</title></head>
|
||||
<body>
|
||||
<h1>403: IP.Board -> Forbidden</h1>
|
||||
<hr>
|
||||
You have reached this page in error, please use your back button to return to the forum.
|
||||
<hr>
|
||||
<a href="http://www.invisionpower.com">IP.Board</a>
|
||||
</body>
|
||||
</html>
|
||||
@@ -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
File diff suppressed because it is too large.
Load diff
@@ -2,19 +2,19 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* IP.Board v3.2.3
|
||||
* Posting display formatting methods
|
||||
* Last Updated: $Date: 2010-10-20 09:03:17 -0400 (Wed, 20 Oct 2010) $
|
||||
* Last Updated: $Date: 2011-09-29 22:09:09 -0400 (Thu, 29 Sep 2011) $
|
||||
* </pre>
|
||||
* File Created By: Matt Mecham
|
||||
*
|
||||
* @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 $Revision: 7003 $
|
||||
* @link http://hatynka.in
|
||||
* @version $Revision: 9570 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
@@ -28,7 +28,6 @@ class classPostForms extends classPost
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void
|
||||
*/
|
||||
@@ -42,7 +41,6 @@ class classPostForms extends classPost
|
||||
/**
|
||||
* Magic __call method
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void
|
||||
*/
|
||||
@@ -54,7 +52,6 @@ class classPostForms extends classPost
|
||||
/**
|
||||
* Displays the ajax edit box
|
||||
*
|
||||
* @access public
|
||||
* @return string HTML
|
||||
*/
|
||||
public function displayAjaxEditForm()
|
||||
@@ -85,10 +82,24 @@ class classPostForms extends classPost
|
||||
throw new Exception( $e );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Form specific...
|
||||
//-----------------------------------------
|
||||
|
||||
try
|
||||
{
|
||||
$topic = $this->editSetUp();
|
||||
}
|
||||
catch( Exception $error )
|
||||
{
|
||||
throw new Exception( $error->getMessage() );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Appending a reason for the edit?
|
||||
//-----------------------------------------
|
||||
|
||||
$extraData['showAppendEdit'] = 0;
|
||||
|
||||
if ( $this->getAuthor('g_append_edit') )
|
||||
@@ -113,19 +124,6 @@ class classPostForms extends classPost
|
||||
$extraData['showReason'] = 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Form specific...
|
||||
//-----------------------------------------
|
||||
|
||||
try
|
||||
{
|
||||
$topic = $this->editSetUp();
|
||||
}
|
||||
catch( Exception $error )
|
||||
{
|
||||
throw new Exception( $error->getMessage() );
|
||||
}
|
||||
|
||||
/* Reset reason for edit */
|
||||
$extraData['reasonForEdit'] = $this->request['post_edit_reason'] ? $this->request['post_edit_reason'] : $this->_originalPost['post_edit_reason'];
|
||||
$extraData['append_edit'] = $this->request['append_edit'] ? $this->request['append_edit'] : $this->_originalPost['append_edit'];
|
||||
@@ -138,12 +136,8 @@ class classPostForms extends classPost
|
||||
|
||||
$post = $this->compilePostData();
|
||||
$postContent = $this->getPostContentPreFormatted() ? $this->getPostContentPreFormatted() : $this->getPostContent();
|
||||
$postContent = $this->_afterPostCompile( $postContent, 'edit' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Hmmmmm....
|
||||
//-----------------------------------------
|
||||
|
||||
$postContent = IPSText::getTextClass('editor')->unProcessRawPost( $this->_afterPostCompile( $postContent, 'edit' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Do we have any posting errors?
|
||||
@@ -153,6 +147,23 @@ class classPostForms extends classPost
|
||||
{
|
||||
$errors = isset($this->lang->words[ $this->_postErrors ]) ? $this->lang->words[ $this->_postErrors ] : $this->_postErrors;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Do we need to tell browser to load the JS?
|
||||
//-----------------------------------------
|
||||
|
||||
$extraData['_loadJs'] = false;
|
||||
$extraData['smilies'] = null;
|
||||
|
||||
if (
|
||||
( $this->registry->permissions->check( 'reply', $this->getForumData() ) != TRUE )
|
||||
or ( $this->getTopicData('state') == 'closed' AND !$this->memberData['g_post_closed'] )
|
||||
//or ( $this->getTopicData('_ppd_ok') === FALSE )
|
||||
or ( $this->getTopicData('poll_only') ) )
|
||||
{
|
||||
$extraData['_loadJs'] = true;
|
||||
$extraData['smilies'] = $this->editor->fetchEmoticons();
|
||||
}
|
||||
|
||||
$html = $this->registry->getClass('output')->getTemplate('editors')->ajaxEditBox( $postContent, $this->getPostID(), $errors, $extraData );
|
||||
|
||||
@@ -162,7 +173,6 @@ class classPostForms extends classPost
|
||||
/**
|
||||
* Show the reply form
|
||||
*
|
||||
* @access protected
|
||||
* @param string Type of form (new/reply/add)
|
||||
* @param array Array of extra data
|
||||
* @return void [Passes data to classOutput]
|
||||
@@ -173,12 +183,13 @@ class classPostForms extends classPost
|
||||
// Set up
|
||||
//-----------------------------------------
|
||||
|
||||
$output = '';
|
||||
$titleText = '';
|
||||
$buttonText = '';
|
||||
$doCode = '';
|
||||
$topText = '';
|
||||
$checkFunc = '';
|
||||
$output = '';
|
||||
$titleText = '';
|
||||
$buttonText = '';
|
||||
$doCode = '';
|
||||
$topText = '';
|
||||
$checkFunc = '';
|
||||
$autoSaveKey = '';
|
||||
|
||||
//-----------------------------------------
|
||||
// Work out function type
|
||||
@@ -236,28 +247,79 @@ class classPostForms extends classPost
|
||||
//-----------------------------------------
|
||||
// Work out elements
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
switch( $formType )
|
||||
{
|
||||
default:
|
||||
case 'reply':
|
||||
$doCode = 'reply_post_do';
|
||||
$titleText = $this->lang->words['top_txt_reply'] . ' ' . $topic['title'];
|
||||
$buttonText = $this->lang->words['submit_reply'];
|
||||
$topText = $this->lang->words['replying_in'] . ' ' . $topic['title'];
|
||||
$doCode = 'reply_post_do';
|
||||
$titleText = $this->lang->words['top_txt_reply'] . ' ' . $topic['title'];
|
||||
$buttonText = $this->lang->words['submit_reply'];
|
||||
$topText = $this->lang->words['replying_in'] . ' ' . $topic['title'];
|
||||
$autoSaveKey = 'reply-' . intval( $this->request['t'] );
|
||||
break;
|
||||
case 'new':
|
||||
$doCode = 'new_post_do';
|
||||
$titleText = $this->lang->words['top_txt_new'] . $this->getForumData('name');
|
||||
$buttonText = $this->lang->words['submit_new'];
|
||||
$topText = $this->lang->words['posting_new_topic'];
|
||||
$doCode = 'new_post_do';
|
||||
$titleText = $this->lang->words['top_txt_new'] . $this->getForumData('name');
|
||||
$buttonText = $this->lang->words['submit_new'];
|
||||
$topText = $this->lang->words['posting_new_topic'];
|
||||
$autoSaveKey = 'new-' . intval( $this->request['f'] );
|
||||
$tagBox = '';
|
||||
|
||||
$where = array( 'meta_parent_id' => intval( $this->request['f'] ),
|
||||
'member_id' => $this->memberData['member_id'],
|
||||
'existing_tags' => explode( ',', IPSText::cleanPermString( $_REQUEST['ipsTags'] ) ) );
|
||||
|
||||
if ( $this->registry->tags->can( 'add', $where ) )
|
||||
{
|
||||
$tagBox = $this->registry->tags->render('entryBox', $where);
|
||||
}
|
||||
break;
|
||||
case 'edit':
|
||||
$doCode = 'edit_post_do';
|
||||
$titleText = $this->lang->words['top_txt_edit'] . ' ' . $topic['title'];
|
||||
$buttonText = $this->lang->words['submit_edit'];
|
||||
$topText = $this->lang->words['editing_post'] . ' ' . $topic['title'];
|
||||
$doCode = 'edit_post_do';
|
||||
$titleText = $this->lang->words['top_txt_edit'] . ' ' . $topic['title'];
|
||||
$buttonText = $this->lang->words['submit_edit'];
|
||||
$topText = $this->lang->words['editing_post'] . ' ' . $topic['title'];
|
||||
$autoSaveKey = 'edit-' . intval( $this->request['p'] );
|
||||
|
||||
$where = array( 'meta_id' => $topic['tid'],
|
||||
'meta_parent_id' => intval( $this->request['f'] ),
|
||||
'member_id' => $this->memberData['member_id'] );
|
||||
|
||||
if( $_REQUEST['ipsTags'] )
|
||||
{
|
||||
$where['existing_tags'] = explode( ',', IPSText::cleanPermString( $_REQUEST['ipsTags'] ) );
|
||||
}
|
||||
|
||||
if ( $this->registry->tags->can( 'edit', $where ) && ( $this->request['p'] == $topic['topic_firstpost'] ) )
|
||||
{
|
||||
$tagBox = $this->registry->tags->render('entryBox', $where);
|
||||
}
|
||||
|
||||
/* Are we following? */
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
|
||||
$_like = classes_like::bootstrap( 'forums','topics' );
|
||||
$_likes = $_like->isLiked( $this->getTopicData('tid'), $this->getAuthor('member_id') );
|
||||
|
||||
//-----------------------------------------
|
||||
// Appending a reason for the edit?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->getAuthor('g_append_edit') )
|
||||
{
|
||||
$extraData['showEditOptions'] = 1;
|
||||
|
||||
if ( !empty( $this->_originalPost['append_edit'] ) )
|
||||
{
|
||||
$extraData['checked'] = "checked";
|
||||
}
|
||||
}
|
||||
|
||||
if ( !empty( $this->moderator['edit_post'] ) OR $this->getAuthor('g_is_supmod') )
|
||||
{
|
||||
$extraData['showReason'] = 1;
|
||||
}
|
||||
|
||||
/* Reset reason for edit */
|
||||
$extraData['reasonForEdit'] = $this->request['post_edit_reason'] ? $this->request['post_edit_reason'] : $this->_originalPost['post_edit_reason'];
|
||||
|
||||
@@ -265,7 +327,7 @@ class classPostForms extends classPost
|
||||
$this->setSettings( array( 'enableSignature' => $this->_originalPost['use_sig'],
|
||||
'enableEmoticons' => $this->_originalPost['use_emo'],
|
||||
'post_htmlstatus' => $this->_originalPost['post_htmlstate'],
|
||||
'enableTracker' => ( (intval($this->request['enabletrack']) != 0) OR $this->getIsPreview() !== TRUE ) ? 1 : 0 ) );
|
||||
'enableTracker' => ( intval($this->request['enabletrack']) != 0 ? 1 : ( $_likes ? 1 : 0 ) ) ) );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -285,27 +347,18 @@ class classPostForms extends classPost
|
||||
//-----------------------------------------
|
||||
// Compile the poll
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
$this->poll_questions = $this->compilePollData();
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Are we quoting posts?
|
||||
//-----------------------------------------
|
||||
|
||||
$postContent = $this->_checkMultiQuote( $postContent );
|
||||
|
||||
//-----------------------------------------
|
||||
// RTE? Convert RIGHT tags that QUOTE would
|
||||
// have put there
|
||||
// Commented out 14/7/08 - _afterPostCompile handles this for edit, and should
|
||||
// also handle for any other type if they need it...
|
||||
//-----------------------------------------
|
||||
/* Set content in editor */
|
||||
$this->editor->setContent( $postContent );
|
||||
|
||||
/*if ( IPSText::getTextClass('editor')->method == 'rte' )
|
||||
{
|
||||
$postContent = IPSText::getTextClass('bbcode')->convertForRTE( $postContent );
|
||||
}*/
|
||||
|
||||
//-----------------------------------------
|
||||
// Do we have any posting errors?
|
||||
//-----------------------------------------
|
||||
@@ -350,7 +403,7 @@ class classPostForms extends classPost
|
||||
$class_attach->attach_post_key = $this->post_key;
|
||||
$class_attach->init();
|
||||
$class_attach->getUploadFormSettings();
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// START TABLE
|
||||
//-----------------------------------------
|
||||
@@ -358,10 +411,9 @@ class classPostForms extends classPost
|
||||
$output .= $this->registry->getClass('output')->getTemplate('post')->postFormTemplate( array( 'title' => $titleText,
|
||||
'captchaHTML' => $this->_generateGuestCaptchaHTML(),
|
||||
'checkBoxes' => $this->_generateCheckBoxes( $formType, isset( $topic['tid'] ) ? $topic['tid'] : 0, $this->getForumData('id') ),
|
||||
'editor' => IPSText::getTextClass('editor')->showEditor( $postContent, 'Post' ),
|
||||
'editor' => $this->editor->show( 'Post', array( 'autoSaveKey' => $autoSaveKey, 'height' => 350 ) ),
|
||||
'buttonText' => $buttonText,
|
||||
'uploadForm' => ( $this->can_upload ) ? $this->registry->getClass('output')->getTemplate('post')->uploadForm( $this->post_key, 'post', $class_attach->attach_stats, $this->getPostID(), $this->getForumData('id') ) : "",
|
||||
'postIconSelected' => $this->_generatePostIcons( $post['icon_id'] ),
|
||||
'topicSummary' => $this->_generateTopicSummary( $topic['tid'] ),
|
||||
'formType' => $formType,
|
||||
'extraData' => $extraData,
|
||||
@@ -369,10 +421,10 @@ class classPostForms extends classPost
|
||||
'pollBoxHTML' => $this->_generatePollBox( $formType ),
|
||||
'canEditTitle' => $this->edit_title,
|
||||
'topicTitle' => $this->_topicTitle ? $this->_topicTitle : $topic['title'],
|
||||
'topicDesc' => $this->_topicDescription ? $this->_topicDescription : $topic['description'],
|
||||
'seoTopic' => $topic['title_seo'],
|
||||
'seoForum' => $this->getForumData('name_seo'),
|
||||
'statusMsg' => $_statusMsg
|
||||
'statusMsg' => $_statusMsg,
|
||||
'tagBox' => $tagBox
|
||||
),
|
||||
array( 'doCode' => $doCode,
|
||||
'p' => $this->getPostID(),
|
||||
@@ -397,7 +449,7 @@ class classPostForms extends classPost
|
||||
|
||||
$this->nav = $this->registry->getClass('class_forums')->forumsBreadcrumbNav( $this->getForumData('id') );
|
||||
|
||||
if ( isset($topic['tid']) AND $topic['tid'] )
|
||||
if ( !empty($topic['tid']) )
|
||||
{
|
||||
$this->nav[] = array( $topic['title'], "showtopic={$topic['tid']}", $topic['title_seo'], 'showtopic' );
|
||||
}
|
||||
@@ -417,7 +469,6 @@ class classPostForms extends classPost
|
||||
/**
|
||||
* Show the edit form
|
||||
*
|
||||
* @access public
|
||||
* @return string HTML to show
|
||||
*/
|
||||
public function showEditForm()
|
||||
@@ -434,25 +485,6 @@ class classPostForms extends classPost
|
||||
$_moderator = $this->getAuthor('forumsModeratorData');
|
||||
$this->moderator = $_moderator[ $this->getForumID() ];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Appending a reason for the edit?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->getAuthor('g_append_edit') )
|
||||
{
|
||||
$extraData['showEditOptions'] = 1;
|
||||
|
||||
if ( isset( $this->_originalPost['append_edit'] ) && $this->_originalPost['append_edit'] )
|
||||
{
|
||||
$extraData['checked'] = "checked";
|
||||
}
|
||||
}
|
||||
|
||||
if ( ( isset( $this->moderator['edit_post'] ) && $this->moderator['edit_post'] ) OR $this->getAuthor('g_is_supmod') )
|
||||
{
|
||||
$extraData['showReason'] = 1;
|
||||
}
|
||||
|
||||
$this->_displayForm( 'edit', $extraData );
|
||||
}
|
||||
@@ -460,7 +492,6 @@ class classPostForms extends classPost
|
||||
/**
|
||||
* Show the reply form
|
||||
*
|
||||
* @access public
|
||||
* @return string HTML to show
|
||||
*/
|
||||
public function showReplyForm()
|
||||
@@ -471,7 +502,6 @@ class classPostForms extends classPost
|
||||
/**
|
||||
* Show the topic form
|
||||
*
|
||||
* @access public
|
||||
* @return string HTML to show
|
||||
*/
|
||||
public function showTopicForm()
|
||||
@@ -484,7 +514,6 @@ class classPostForms extends classPost
|
||||
*
|
||||
* @param string Post content
|
||||
* @param string Form type (new/edit/reply)
|
||||
* @access protected
|
||||
* @author MattMecham
|
||||
*/
|
||||
protected function _afterPostCompile( $postContent, $formType )
|
||||
@@ -497,97 +526,9 @@ class classPostForms extends classPost
|
||||
// Unconvert the saved post if required
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! isset($_POST['Post']) )
|
||||
if ( isset($_POST['Post']) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// If we're using RTE, then just clean up html
|
||||
//-----------------------------------------
|
||||
|
||||
if ( IPSText::getTextClass('editor')->method == 'rte' )
|
||||
{
|
||||
IPSText::getTextClass('bbcode')->parse_wordwrap = 0;
|
||||
IPSText::getTextClass('bbcode')->parse_html = 0;
|
||||
|
||||
$postContent = IPSText::getTextClass('bbcode')->convertForRTE( $postContent );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_originalPost['post_htmlstate'] = isset($this->_originalPost['post_htmlstate']) ? $this->_originalPost['post_htmlstate'] : 0;
|
||||
IPSText::getTextClass('bbcode')->parse_html = intval($this->_originalPost['post_htmlstate']) AND $this->getForumData('use_html') AND $this->getAuthor('g_dohtml') ? 1 : 0;
|
||||
IPSText::getTextClass('bbcode')->parse_nl2br = (isset($this->_originalPost['post_htmlstate']) AND $this->_originalPost['post_htmlstate'] == 2) ? 1 : 0;
|
||||
IPSText::getTextClass('bbcode')->parse_smilies = intval($this->_originalPost['use_emo']);
|
||||
IPSText::getTextClass('bbcode')->parse_bbcode = $this->getForumData('use_ibc');
|
||||
IPSText::getTextClass('bbcode')->parsing_section = 'topics';
|
||||
|
||||
if ( IPSText::getTextClass('bbcode')->parse_html )
|
||||
{
|
||||
if ( ! IPSText::getTextClass('bbcode')->parse_nl2br )
|
||||
{
|
||||
$postContent = str_replace( '<br />', "", $postContent );
|
||||
$postContent = str_replace( '<br>' , "", $postContent );
|
||||
}
|
||||
}
|
||||
|
||||
$postContent = IPSText::getTextClass('bbcode')->preEditParse( $postContent );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( IPSText::getTextClass('editor')->method != 'rte' && $this->request['_from'] != 'quickedit' )
|
||||
{
|
||||
$_POST['Post'] = str_replace( '&', '&', $_POST['Post'] );
|
||||
$_POST['Post'] = str_replace( '&#092;', '\', $_POST['Post'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Coming from quick edit, need to fix the
|
||||
// HTML entities - we could even check
|
||||
// request['_from'] == 'quickedit' here if need be
|
||||
//-----------------------------------------
|
||||
|
||||
$_POST['Post'] = str_replace( '&', '&', $_POST['Post'] );
|
||||
|
||||
}
|
||||
|
||||
$postContent = IPSText::stripslashes( $_POST['Post'] );
|
||||
//print nl2br(htmlspecialchars($postContent));exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Need to unparse if we're showing the form again
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->getIsPreview() === true OR $this->_postErrors )
|
||||
{
|
||||
if ( IPSText::getTextClass('editor')->method == 'rte' )
|
||||
{
|
||||
IPSText::getTextClass('bbcode')->bypass_badwords = true;
|
||||
|
||||
$postContent = IPSText::getTextClass('bbcode')->convertForRTE( $postContent );
|
||||
}
|
||||
else
|
||||
{
|
||||
IPSText::getTextClass('bbcode')->parse_html = intval($_POST['post_htmlstate']) AND $this->getForumData('use_html') AND $this->getAuthor('g_dohtml') ? 1 : 0;
|
||||
IPSText::getTextClass('bbcode')->parse_nl2br = (isset($_POST['post_htmlstate']) AND $_POST['post_htmlstate'] == 2) ? 1 : 0;
|
||||
IPSText::getTextClass('bbcode')->parse_smilies = intval($_POST['use_emo']);
|
||||
IPSText::getTextClass('bbcode')->parse_bbcode = $this->getForumData('use_ibc');
|
||||
IPSText::getTextClass('bbcode')->bypass_badwords = true; // don't do the changeouts to the text that will be in the form
|
||||
IPSText::getTextClass('bbcode')->parsing_section = 'topics';
|
||||
|
||||
if ( ! IPSText::getTextClass('bbcode')->parse_html )
|
||||
{
|
||||
if ( IPSText::getTextClass('bbcode')->parse_nl2br )
|
||||
{
|
||||
$postContent = str_replace( '<br />', "", $postContent );
|
||||
$postContent = str_replace( '<br>' , "", $postContent );
|
||||
}
|
||||
}
|
||||
|
||||
$postContent = IPSText::getTextClass('bbcode')->preEditParse( $postContent );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -599,7 +540,6 @@ class classPostForms extends classPost
|
||||
*
|
||||
* @param int Topic ID
|
||||
* @return string HTML elements
|
||||
* @access protected
|
||||
* @author MattMecham
|
||||
*/
|
||||
protected function _generateTopicSummary( $topicID )
|
||||
@@ -626,14 +566,30 @@ class classPostForms extends classPost
|
||||
return;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Set ignored users
|
||||
//-----------------------------------------
|
||||
|
||||
$ignored_users = array();
|
||||
|
||||
foreach( $this->member->ignored_users as $_i )
|
||||
{
|
||||
if( $_i['ignore_topics'] )
|
||||
{
|
||||
$ignored_users[] = $_i['ignore_ignore_id'];
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the posts
|
||||
// This section will probably change at some point
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
$_queued = $this->registry->class_forums->fetchPostHiddenQuery( array( 'visible' ), 'p.' );
|
||||
|
||||
$this->DB->build( array( 'select' => 'p.*',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'p.topic_id=' . $topicID . ' AND p.queued=0',
|
||||
'where' => 'p.topic_id=' . $topicID . ' AND ' . $_queued,
|
||||
'order' => 'pid DESC',
|
||||
'limit' => array( 0, 10 ),
|
||||
'add_join' => array(
|
||||
@@ -675,13 +631,19 @@ class classPostForms extends classPost
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $row['member_group_id'];
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $row['mgroup_others'];
|
||||
|
||||
$row['post'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $row['post'] );
|
||||
$row['post'] = IPSText::truncate( IPSText::getTextClass( 'bbcode' )->preDisplayParse( $row['post'] ), 1000 );
|
||||
|
||||
//-----------------------------------------
|
||||
// View image...
|
||||
//-----------------------------------------
|
||||
/* Bit crude */
|
||||
$od = substr_count( $row['post'], '<div' );
|
||||
$cd = substr_count( $row['post'], '</div>' );
|
||||
|
||||
$row['post'] = IPSText::getTextClass( 'bbcode' )->memberViewImages( $row['post'] );
|
||||
if ( $od > $cd )
|
||||
{
|
||||
for( $i = 0 ; $i < $od ; $i++ )
|
||||
{
|
||||
$row['post'] .= "</div>";
|
||||
}
|
||||
}
|
||||
|
||||
$posts[ $row['pid'] ] = $row;
|
||||
|
||||
@@ -689,9 +651,9 @@ class classPostForms extends classPost
|
||||
// Are we giving this bloke a good ignoring?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->getAuthor('ignored_users') )
|
||||
if ( count($ignored_users) )
|
||||
{
|
||||
if ( in_array( $row['author_id'], $this->getAuthor('ignored_users') ) and $this->request['qpid'] != $row['pid'] )
|
||||
if ( in_array( $row['author_id'], $ignored_users ) and $this->request['qpid'] != $row['pid'] )
|
||||
{
|
||||
if ( ! strstr( $this->settings['cannot_ignore_groups'], ','.$row['member_group_id'].',' ) )
|
||||
{
|
||||
@@ -741,7 +703,6 @@ class classPostForms extends classPost
|
||||
/**
|
||||
* Generates checkboxes
|
||||
*
|
||||
* @access protected
|
||||
* @param string Type of form
|
||||
* @param int Topic ID
|
||||
* @param int Forum ID
|
||||
@@ -772,7 +733,7 @@ class classPostForms extends classPost
|
||||
$return['emo'] = "";
|
||||
}
|
||||
|
||||
if ( $this->registry->class_forums->forum_by_id[ $forumID ]['use_html'] and $group_cache[ $this->getAuthor('member_group_id') ]['g_dohtml'] )
|
||||
if ( $this->registry->class_forums->forum_by_id[ $forumID ]['use_html'] and $this->getAuthor('g_dohtml') )
|
||||
{
|
||||
$options_array[ $this->getSettings('post_htmlstatus') ] = ' selected="selected"';
|
||||
|
||||
@@ -783,12 +744,15 @@ class classPostForms extends classPost
|
||||
{
|
||||
if ( $topicID and $this->getAuthor('member_id') )
|
||||
{
|
||||
$this->DB->build( array( 'select' => 'trid',
|
||||
'from' => 'tracker',
|
||||
'where' => "topic_id=" . $topicID . " AND member_id=".$this->getAuthor('member_id') ) );
|
||||
$this->DB->execute();
|
||||
//-----------------------------------------
|
||||
// Like class
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->DB->getTotalRows() )
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
|
||||
$_like = classes_like::bootstrap( 'forums', 'topics' );
|
||||
$_track = $_like->isLiked( $topicID, $this->getAuthor('member_id') );
|
||||
|
||||
if ( $_track )
|
||||
{
|
||||
$return['tra'] = '-tracking-';
|
||||
}
|
||||
@@ -801,7 +765,6 @@ class classPostForms extends classPost
|
||||
/**
|
||||
* Generates mod options dropdown
|
||||
*
|
||||
* @access protected
|
||||
* @param array Topic data
|
||||
* @param string Type of form (new/edit/reply)
|
||||
* @return string HTML of dropdown box
|
||||
@@ -951,9 +914,9 @@ class classPostForms extends classPost
|
||||
|
||||
if( $this->_originalPost['new_topic'] )
|
||||
{
|
||||
if ( !isset($mytimes['open_date']) OR !$mytimes['open_date'] )
|
||||
if ( empty($mytimes['open_date']) )
|
||||
{
|
||||
if ( isset($topic['topic_open_time']) AND $topic['topic_open_time'] )
|
||||
if ( !empty($topic['topic_open_time']) )
|
||||
{
|
||||
# Bug 23258 - add on TZ as we take this off when saving time
|
||||
$date = IPSTime::unixstamp_to_human( $topic['topic_open_time'] + $this->registry->class_localization->getTimeOffset() );
|
||||
@@ -962,9 +925,9 @@ class classPostForms extends classPost
|
||||
}
|
||||
}
|
||||
|
||||
if ( !isset($mytimes['close_date']) OR !$mytimes['close_date'] )
|
||||
if ( empty($mytimes['close_date']) )
|
||||
{
|
||||
if ( isset($topic['topic_close_time']) AND $topic['topic_close_time'] )
|
||||
if ( !empty($topic['topic_close_time']) )
|
||||
{
|
||||
# Bug 23258 - add on TZ as we take this off when saving time
|
||||
$date = IPSTime::unixstamp_to_human( $topic['topic_close_time'] + $this->registry->class_localization->getTimeOffset() );
|
||||
@@ -988,36 +951,10 @@ class classPostForms extends classPost
|
||||
'canSetCloseTime' => $this->can_set_close_time,
|
||||
'myTimes' => $mytimes );
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the post icons
|
||||
*
|
||||
* @access protected
|
||||
* @param string Chosen post icon (optional)
|
||||
* @return string HTML
|
||||
*/
|
||||
protected function _generatePostIcons( $post_icon="" )
|
||||
{
|
||||
$postIcons = array();
|
||||
$post_icon = ( $post_icon ) ? $post_icon : intval($this->request['iconid']);
|
||||
|
||||
if ( isset( $post_icon ) )
|
||||
{
|
||||
$postIcons[ $post_icon ] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We use a key incase we use keys for post icons */
|
||||
$postIcons['0'] = 1;
|
||||
}
|
||||
|
||||
return $postIcons;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates the captcha if required
|
||||
*
|
||||
* @access protected
|
||||
* @return string Captcha IMG id
|
||||
*/
|
||||
protected function _generateGuestCaptchaHTML()
|
||||
@@ -1036,7 +973,6 @@ class classPostForms extends classPost
|
||||
* @param string Form type (new/edit/reply)
|
||||
* @return string HTML
|
||||
* @author MattMecham
|
||||
* @access protected
|
||||
*/
|
||||
protected function _generatePollBox( $formType )
|
||||
{
|
||||
@@ -1054,8 +990,13 @@ class classPostForms extends classPost
|
||||
$show_open = 0;
|
||||
$is_mod = 0;
|
||||
$poll_votes = array();
|
||||
$poll_only = array();
|
||||
$poll_multi = array();
|
||||
$poll_only = 0;
|
||||
$poll_multi = array();
|
||||
|
||||
if( $this->settings['ipb_poll_only'] AND ipsRegistry::$request['poll_only'] AND ipsRegistry::$request['poll_only'] == 1 )
|
||||
{
|
||||
$poll_only = 1;
|
||||
}
|
||||
|
||||
if ( isset($_POST['question']) AND is_array( $_POST['question'] ) and count( $_POST['question'] ) )
|
||||
{
|
||||
@@ -1093,13 +1034,6 @@ class classPostForms extends classPost
|
||||
$poll_votes[ $id ] = $vote;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$poll_only = 0;
|
||||
|
||||
if( $this->settings['ipb_poll_only'] AND ipsRegistry::$request['poll_only'] AND ipsRegistry::$request['poll_only'] == 1 )
|
||||
{
|
||||
$poll_only = 1;
|
||||
}
|
||||
|
||||
if ( $formType == 'edit' AND ( ! isset($_POST['question']) OR ! is_array( $_POST['question'] ) OR ! count( $_POST['question'] ) ) )
|
||||
@@ -1109,7 +1043,17 @@ class classPostForms extends classPost
|
||||
//-----------------------------------------
|
||||
|
||||
$this->poll_data = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'polls', 'where' => "tid=".$this->getTopicID() ) );
|
||||
$this->poll_answers = $this->poll_data['choices'] ? unserialize(stripslashes($this->poll_data['choices'])) : array();
|
||||
|
||||
$this->poll_answers = unserialize(stripslashes($this->poll_data['choices']));
|
||||
|
||||
if( !is_array($this->poll_answers) OR !count($this->poll_answers) )
|
||||
{
|
||||
$this->poll_answers = unserialize( preg_replace( '!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", stripslashes( $this->poll_data['choices'] ) ) );
|
||||
}
|
||||
if ( !is_array($this->poll_answers) OR !count($this->poll_answers) )
|
||||
{
|
||||
$this->poll_answers = array();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Lezz go
|
||||
@@ -1127,7 +1071,7 @@ class classPostForms extends classPost
|
||||
|
||||
foreach( $data['choice'] as $choice_id => $text )
|
||||
{
|
||||
$poll_choices[ $question_id . '_' . $choice_id ] = $text;
|
||||
$poll_choices[ $question_id . '_' . $choice_id ] = stripslashes( $text );
|
||||
$poll_votes[ $question_id . '_' . $choice_id ] = intval($data['votes'][ $choice_id ]);
|
||||
}
|
||||
}
|
||||
@@ -1136,7 +1080,7 @@ class classPostForms extends classPost
|
||||
|
||||
if ( $this->settings['ipb_poll_only'] AND $this->poll_data['poll_only'] == 1 )
|
||||
{
|
||||
$poll_only = "checked='checked'";
|
||||
$poll_only = 1;
|
||||
}
|
||||
|
||||
$poll_view_voters = $this->poll_data['poll_view_voters'];
|
||||
@@ -1149,7 +1093,22 @@ class classPostForms extends classPost
|
||||
$poll_view_voters = $this->request['poll_view_voters'];
|
||||
}
|
||||
|
||||
return $this->registry->getClass('output')->getTemplate('post')->pollBox( $this->max_poll_questions, $this->max_poll_choices_per_question, IPSText::simpleJsonEncode( $poll_questions ), IPSText::simpleJsonEncode( $poll_choices ), IPSText::simpleJsonEncode( $poll_votes ), $show_open, $poll_question, $is_mod, json_encode( $poll_multi ), $poll_only, $poll_view_voters, intval( $this->poll_data['votes'] ) );
|
||||
return $this->registry->getClass('output')->getTemplate('post')->pollBox( array(
|
||||
'max_poll_questions' => $this->max_poll_questions,
|
||||
'max_poll_choices' => $this->max_poll_choices_per_question,
|
||||
'poll_questions' => IPSText::simpleJsonEncode( $poll_questions ),
|
||||
'poll_choices' => IPSText::simpleJsonEncode( $poll_choices ),
|
||||
'poll_votes' => IPSText::simpleJsonEncode( $poll_votes ),
|
||||
'show_open' => $show_open,
|
||||
'poll_question' => $poll_question,
|
||||
'is_mod' => $is_mod,
|
||||
'poll_multi' => json_encode( $poll_multi ),
|
||||
'poll_only' => $poll_only,
|
||||
'poll_view_voters' => $poll_view_voters,
|
||||
'poll_total_votes' => intval( $this->poll_data['votes'] ),
|
||||
'poll_data' => $this->poll_data,
|
||||
'poll_answers' => $this->poll_answers
|
||||
) );
|
||||
}
|
||||
|
||||
return '';
|
||||
@@ -1161,20 +1120,19 @@ class classPostForms extends classPost
|
||||
* @param string Post Content
|
||||
* @param string MD5 post key for attachments
|
||||
* @return string HTML
|
||||
* @access protected
|
||||
* @author Matt Mecham
|
||||
*/
|
||||
protected function _generatePostPreview( $postContent="", $post_key='' )
|
||||
{
|
||||
$this->registry->class_localization->loadLanguageFile( array( 'public_topic' ) );
|
||||
|
||||
IPSText::getTextClass('bbcode')->parse_html = (intval($this->request['post_htmlstatus']) AND $this->getForumData('use_html') AND $this->getAuthor('g_dohtml')) ? 1 : 0;
|
||||
IPSText::getTextClass('bbcode')->parse_nl2br = $this->request['post_htmlstatus'] == 2 ? 1 : 0;
|
||||
IPSText::getTextClass('bbcode')->parse_smilies = intval($this->getSettings('enableEmoticons'));
|
||||
IPSText::getTextClass('bbcode')->parse_bbcode = $this->getForumData('use_ibc');
|
||||
IPSText::getTextClass('bbcode')->parsing_section = 'topics';
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $this->memberData['member_group_id'];
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $this->memberData['mgroup_others'];
|
||||
IPSText::getTextClass('bbcode')->parse_html = (intval($this->request['post_htmlstatus']) AND $this->getForumData('use_html') AND $this->getAuthor('g_dohtml')) ? 1 : 0;
|
||||
IPSText::getTextClass('bbcode')->parse_nl2br = $this->request['post_htmlstatus'] == 2 ? 1 : 0;
|
||||
IPSText::getTextClass('bbcode')->parse_smilies = intval($this->getSettings('enableEmoticons'));
|
||||
IPSText::getTextClass('bbcode')->parse_bbcode = $this->getForumData('use_ibc');
|
||||
IPSText::getTextClass('bbcode')->parsing_section = 'topics';
|
||||
IPSText::getTextClass('bbcode')->parsing_mgroup = $this->memberData['member_group_id'];
|
||||
IPSText::getTextClass('bbcode' )->parsing_mgroup_others = $this->memberData['mgroup_others'];
|
||||
|
||||
# Make sure we have the pre-display look
|
||||
$postContent = IPSText::getTextClass('bbcode')->preDisplayParse( $postContent );
|
||||
|
||||
@@ -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>
|
||||
@@ -1,617 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* Threaded mode functions
|
||||
* Last Updated: $Date: 2010-10-19 08:45:58 -0400 (Tue, 19 Oct 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: ips_terabyte $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Revision: 6994 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class threadedModeLibrary
|
||||
{
|
||||
/**
|
||||
* Topics library
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
public $topics;
|
||||
|
||||
/**
|
||||
* Structured post ids
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $structured_pids = array();
|
||||
|
||||
/**
|
||||
* Post cache
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $post_cache = array();
|
||||
|
||||
/**
|
||||
* Used post ids
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $used_post_ids = array();
|
||||
|
||||
/**
|
||||
* Threaded posts
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $_threaded_posts = array();
|
||||
|
||||
/**
|
||||
* Last id we've seen
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $last_id = 0;
|
||||
|
||||
/**#@+
|
||||
* Registry Object Shortcuts
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $registry;
|
||||
protected $DB;
|
||||
protected $settings;
|
||||
protected $request;
|
||||
protected $lang;
|
||||
protected $member;
|
||||
protected $memberData;
|
||||
protected $cache;
|
||||
protected $caches;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param object Registry reference
|
||||
* @param object Reference to topics lib
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry, $topics )
|
||||
{
|
||||
/* Make objects */
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->lang = $this->registry->getClass('class_localization');
|
||||
$this->member = $this->registry->member();
|
||||
$this->memberData =& $this->registry->member()->fetchMemberData();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
|
||||
$this->topics =& $topics;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Threaded Topic Data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function _getTopicDataThreaded()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Grab the posts we'll need
|
||||
//-----------------------------------------
|
||||
|
||||
$pc_join = array();
|
||||
|
||||
$first = intval( $this->request['start'] );
|
||||
$last = $this->settings['threaded_per_page'] ? $this->settings['threaded_per_page'] : 250;
|
||||
|
||||
//-----------------------------------------
|
||||
// GET meh pids
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $first > 0 )
|
||||
{
|
||||
// we're on a page, make sure init val is there
|
||||
|
||||
$this->topics->pids[0] = $this->topics->topic['topic_firstpost'];
|
||||
$this->structured_pids[ 0 ][] = $this->topics->topic['topic_firstpost'];
|
||||
}
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => 'pid, post_parent',
|
||||
'from' => 'posts',
|
||||
'where' => 'topic_id=' . $this->topics->topic['tid'] . ' and queued != 1',
|
||||
'order' => 'pid',
|
||||
'limit' => array( $first, $last )
|
||||
) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
while( $p = $this->DB->fetch() )
|
||||
{
|
||||
$this->topics->pids[] = $p['pid'];
|
||||
|
||||
// Force to be children of 'root' post
|
||||
|
||||
if ( ! $p['post_parent'] and $p['pid'] != $this->topics->topic['topic_firstpost'] )
|
||||
{
|
||||
$p['post_parent'] = $this->topics->topic['topic_firstpost'];
|
||||
}
|
||||
|
||||
$this->structured_pids[ $p['post_parent'] ][] = $p['pid'];
|
||||
}
|
||||
|
||||
/* Ignored Users */
|
||||
$ignored_users = array();
|
||||
|
||||
foreach( $this->member->ignored_users as $_i )
|
||||
{
|
||||
if( $_i['ignore_topics'] )
|
||||
{
|
||||
$ignored_users[] = $_i['ignore_ignore_id'];
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get post bodah
|
||||
//-----------------------------------------
|
||||
|
||||
if ( count( $this->topics->pids ) )
|
||||
{
|
||||
$this->DB->build( array(
|
||||
'select' => 'pid, post, author_id, author_name, post_date, post_title, post_parent, topic_id, icon_id',
|
||||
'from' => 'posts',
|
||||
'where' => 'pid IN(' . implode( ',', $this->topics->pids ) . ')',
|
||||
'order' => 'pid',
|
||||
) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
while( $p = $this->DB->fetch() )
|
||||
{
|
||||
if ( ! $p['post_parent'] and $p['pid'] != $this->topics->topic['topic_firstpost'] )
|
||||
{
|
||||
$p['post_parent'] = $this->topics->topic['topic_firstpost'];
|
||||
}
|
||||
|
||||
$this->post_cache[ $p['pid'] ] = $p;
|
||||
|
||||
$this->last_id = $p['pid'];
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Force root in cache
|
||||
//-----------------------------------------
|
||||
|
||||
$this->post_cache[0] = array( 'id' => 1 );
|
||||
|
||||
$this->post_cache[ $this->topics->topic['topic_firstpost'] ]['post_title'] = $this->topics->topic['title'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Are we viewing Posts?
|
||||
//-----------------------------------------
|
||||
|
||||
$post_id = intval( $this->request['pid'] );
|
||||
|
||||
if ( $post_id && ! in_array( $post_id, $this->topics->pids ) )
|
||||
{
|
||||
$this->registry->output->showError( 'topics_post_not_in_topic', 10358, true, null, 404 );
|
||||
}
|
||||
|
||||
$postid_array = array( 1 => $post_id );
|
||||
|
||||
if ( $post_id and $post_id != $this->topics->topic['topic_firstpost'] )
|
||||
{
|
||||
$parents = $this->_threadedPostGetParents( $post_id );
|
||||
|
||||
if ( count($parents) )
|
||||
{
|
||||
foreach( $parents as $pid )
|
||||
{
|
||||
if ( $pid != $this->topics->topic['topic_firstpost'] )
|
||||
{
|
||||
$postid_array[] = $pid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Data Hook Location */
|
||||
$dataHook = array( 'members' => array(), 'postJoins' => array() );
|
||||
IPSLib::doDataHooks( $dataHook , 'topicViewQuery' );
|
||||
|
||||
/* Join Queries */
|
||||
$_extraMember = ( is_array($dataHook['members']) && count($dataHook['members']) ) ? ',m.'.implode(',m.', $dataHook['members']) : '';
|
||||
|
||||
$_post_joins = array(
|
||||
array(
|
||||
'select' => 'm.member_id as mid,m.name,m.member_group_id,m.email,m.joined,m.posts, m.last_visit, m.last_activity,m.login_anonymous,m.title,m.hide_email, m.warn_level, m.warn_lastwarn, m.members_display_name, m.members_seo_name, m.has_gallery, m.has_blog, m.members_bitoptions,m.mgroup_others'.$_extraMember,
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=p.author_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
array(
|
||||
'select' => 'pp.*',
|
||||
'from' => array( 'profile_portal' => 'pp' ),
|
||||
'where' => 'm.member_id=pp.pp_member_id',
|
||||
'type' => 'left'
|
||||
)
|
||||
);
|
||||
|
||||
/* Add data hook joins */
|
||||
if ( is_array($dataHook['postJoins']) && count($dataHook['postJoins']) )
|
||||
{
|
||||
$_post_joins = array_merge( $_post_joins, $dataHook['postJoins'] );
|
||||
}
|
||||
|
||||
/* Reputation system enabled? */
|
||||
if( $this->settings['reputation_enabled'] )
|
||||
{
|
||||
/* Add the join to figure out if the user has already rated the post */
|
||||
$_post_joins[] = $this->registry->repCache->getUserHasRatedJoin( 'pid', 'p.pid', 'forums' );
|
||||
|
||||
/* Add the join to figure out the total ratings for each post */
|
||||
if( $this->settings['reputation_show_content'] )
|
||||
{
|
||||
$_post_joins[] = $this->registry->repCache->getTotalRatingJoin( 'pid', 'p.pid', 'forums' );
|
||||
}
|
||||
}
|
||||
|
||||
/* Cache? */
|
||||
if ( IPSContentCache::isEnabled() )
|
||||
{
|
||||
if ( IPSContentCache::fetchSettingValue('post') )
|
||||
{
|
||||
$_post_joins[] = IPSContentCache::join( 'post', 'p.pid' );
|
||||
}
|
||||
|
||||
if ( IPSContentCache::fetchSettingValue('sig') )
|
||||
{
|
||||
$_post_joins[] = IPSContentCache::join( 'sig' , 'm.member_id', 'ccb', 'left', 'ccb.cache_content as cache_content_sig, ccb.cache_updated as cache_updated_sig' );
|
||||
}
|
||||
}
|
||||
|
||||
if( $this->settings['custom_profile_topic'] == 1 )
|
||||
{
|
||||
$_post_joins[] = array(
|
||||
'select' => 'pc.*',
|
||||
'from' => array( 'pfields_content' => 'pc' ),
|
||||
'where' => 'pc.member_id=p.author_id',
|
||||
'type' => 'left'
|
||||
);
|
||||
}
|
||||
|
||||
if( count( $postid_array ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get root post and children of clicked
|
||||
//-----------------------------------------
|
||||
|
||||
$this->used_post_ids = ',' . implode( ",", $postid_array ) . ',';
|
||||
|
||||
$postid_array[0] = $this->topics->topic['topic_firstpost'];
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => 'p.*',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => "p.pid IN(" . implode( ',', $postid_array ) . ")",
|
||||
'order' => 'pid asc',
|
||||
'add_join' => $_post_joins
|
||||
) );
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Just get root
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => 'p.*',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => "p.pid=" . $this->topics->topic['topic_firstpost'],
|
||||
'order' => 'pid asc',
|
||||
'add_join' => $_post_joins
|
||||
) );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Attachment PIDS
|
||||
//-----------------------------------------
|
||||
|
||||
$this->topics->attach_pids = $postid_array;
|
||||
|
||||
//-----------------------------------------
|
||||
// Render the original post
|
||||
//-----------------------------------------
|
||||
|
||||
$outer = $this->DB->execute();
|
||||
|
||||
//-----------------------------------------
|
||||
// Format and print out the topic list
|
||||
//-----------------------------------------
|
||||
|
||||
$post_data = array();
|
||||
$num_rows = $this->DB->getTotalRows( $outer );
|
||||
|
||||
while ( $row = $this->DB->fetch( $outer ) )
|
||||
{
|
||||
/* That 1 line fix below took 1 hour, joy :D */
|
||||
$row['member_id'] = $row['mid'];
|
||||
$row['g_access_cp'] = $this->caches['group_cache'][ $row['member_group_id'] ]['g_access_cp'];
|
||||
|
||||
$return = $this->topics->parsePostRow( $row );
|
||||
|
||||
$poster = $return['poster'];
|
||||
$row = $return['row'];
|
||||
|
||||
/* Reputation */
|
||||
if( $this->settings['reputation_enabled'] )
|
||||
{
|
||||
$row['pp_reputation_points'] = $row['pp_reputation_points'] ? $row['pp_reputation_points'] : 0;
|
||||
$row['has_given_rep'] = $row['has_given_rep'] ? $row['has_given_rep'] : 0;
|
||||
$row['rep_points'] = $row['rep_points'] ? $row['rep_points'] : 0;
|
||||
}
|
||||
|
||||
$post_data[ $row['pid'] ] = array( 'post' => $row, 'author' => $poster );
|
||||
|
||||
//-----------------------------------------
|
||||
// Are we giving this bloke a good ignoring?
|
||||
//-----------------------------------------
|
||||
if( isset( $ignored_users ) && is_array( $ignored_users ) && count( $ignored_users ) )
|
||||
{
|
||||
if( in_array( $poster['member_id'], $ignored_users ) )
|
||||
{
|
||||
if ( ! strstr( $this->settings['cannot_ignore_groups'], ','.$poster['member_group_id'].',' ) )
|
||||
{
|
||||
$post_data[ $row['pid'] ]['post']['_ignored'] = 1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $this->printed and $num_rows > 1 )
|
||||
{
|
||||
$post_data[ $row['pid'] ]['post']['_end_first_post'] = 1;
|
||||
$this->printed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Sort out pagination
|
||||
//-----------------------------------------
|
||||
|
||||
$total_replies = $this->topics->topic['posts'];
|
||||
$show_replies = count( $this->structured_pids ) - 1;
|
||||
|
||||
$this->topics->topic['SHOW_PAGES'] = '';
|
||||
$this->topics->topic['threaded_pages'] = $this->registry->output->generatePagination( array(
|
||||
'totalItems' => $total_replies,
|
||||
'itemsPerPage' => $last,
|
||||
'currentStartValue' => $this->request['start'],
|
||||
'baseUrl' => "showtopic=" . $this->topics->topic['tid'],
|
||||
'startValueKey' => 'start',
|
||||
'seoTemplate' => 'showtopic',
|
||||
'seoTitle' => $this->topics->topic['title_seo']
|
||||
) );
|
||||
|
||||
//-----------------------------------------
|
||||
// START GETTING THE OUTLINE LIST
|
||||
//-----------------------------------------
|
||||
|
||||
$this->_threaded_posts[ 0 ]['child'] = $this->_threadedLoopGetChildren();
|
||||
$this->topics->topic['_threaded_posts'] = $this->_buildThreadedOutput( $this->_threaded_posts[ 0 ] );
|
||||
|
||||
return $post_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Actually builds the HTML for threaded view
|
||||
*
|
||||
* @param array $root The root we're iterating
|
||||
* @param string $html The current HTML in this loop
|
||||
* @return string HTML
|
||||
*/
|
||||
public function _buildThreadedOutput( $root, $html='' )
|
||||
{
|
||||
$child = '';
|
||||
|
||||
if( is_array( $root['child'] ) )
|
||||
{
|
||||
if( count( $root['child'] ) )
|
||||
{
|
||||
foreach( $root['child'] as $pid => $post )
|
||||
{
|
||||
$child .= $this->_buildThreadedOutput( $post );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$html .= $this->registry->output->getTemplate('topic')->build_threaded( $root, $child, $this->topics->topic );
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render kiddies
|
||||
*
|
||||
* @param integer $root_id
|
||||
* @param array $posts
|
||||
* @param integer $dguide
|
||||
* @return array
|
||||
*/
|
||||
public function _threadedLoopGetChildren($root_id=0, $posts=array() ,$dguide=-1)
|
||||
{
|
||||
$dguide++;
|
||||
|
||||
if ( isset( $this->structured_pids[ $root_id ] ) && is_array( $this->structured_pids[ $root_id ] ) )
|
||||
{
|
||||
if ( count( $this->structured_pids[ $root_id ] ) )
|
||||
{
|
||||
foreach( $this->structured_pids[ $root_id ] as $pid )
|
||||
{
|
||||
$posts[ $pid ] = $this->_threadedRenderListRow( $this->post_cache[ $pid ], $dguide );
|
||||
$posts[$pid]['child'] = $this->_threadedLoopGetChildren( $pid, isset( $posts[ $root_id ] ) ? $posts[ $root_id ] : array(), $dguide );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $posts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an array of output for used in threaded view
|
||||
*
|
||||
* @param array $post
|
||||
* @param integer $depth
|
||||
* @return array
|
||||
*/
|
||||
public function _threadedRenderListRow( $post, $depth )
|
||||
{
|
||||
$post['depthguide'] = "";
|
||||
|
||||
$this->settings[ 'post_showtext_notitle'] = 1 ;
|
||||
|
||||
for( $i = 1 ; $i < $depth; $i++ )
|
||||
{
|
||||
$post['depthguide'] .= $this->depth_guide[ $i ];
|
||||
}
|
||||
|
||||
// Last child?
|
||||
|
||||
if ( $depth > 0 )
|
||||
{
|
||||
$last_id = count($this->structured_pids[ $post['post_parent'] ]) - 1;
|
||||
|
||||
if ( $this->structured_pids[ $post['post_parent'] ][$last_id] == $post['pid'] )
|
||||
{
|
||||
$this->depth_guide[ $depth ] = '<img src="'.$this->settings['img_url'].'/spacer.gif" alt="" width="20" height="16">';
|
||||
$post['depthguide'] .= "<img src='".$this->settings['img_url']."/to_post_no_children.gif' alt='-' />";
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->depth_guide[ $depth ] = '<img src="'.$this->settings['img_url'].'/to_down_pipe.gif" alt="|" />';
|
||||
$post['depthguide'] .= "<img src='".$this->settings['img_url']."/to_post_with_children.gif' alt='-' />";
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $post['post_title'] )
|
||||
{
|
||||
if ( $this->settings['post_showtext_notitle'] )
|
||||
{
|
||||
$post_text = IPSText::getTextClass( 'bbcode' )->stripAllTags( strip_tags( IPSText::br2nl( $post['post'] ) ) );
|
||||
|
||||
if ( IPSText::mbstrlen($post_text) > 50 )
|
||||
{
|
||||
$post['post_title'] = IPSText::truncate( $post_text, 50 ).'...';
|
||||
}
|
||||
else
|
||||
{
|
||||
$post['post_title'] = $post_text;
|
||||
}
|
||||
|
||||
if ( ! trim($post['post_title']) )
|
||||
{
|
||||
$post['post_title'] = $this->lang->words['post_title_re'] . $this->topics->topic['title'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$post['post_title'] = $this->lang->words['post_title_re'] . $this->topics->topic['title'];
|
||||
}
|
||||
}
|
||||
|
||||
$post['linked_name'] = IPSLib::makeProfileLink( $post['author_name'], $post['author_id'] );
|
||||
|
||||
$post['formatted_date'] = $this->registry->class_localization->getDate( $post['post_date'], 'LONG' );
|
||||
|
||||
$post['new_post'] = 't_threaded_read';
|
||||
|
||||
if ( $post['post_date'] > $this->topics->last_read_tid )
|
||||
{
|
||||
$post['new_post'] = 't_threaded_read';
|
||||
}
|
||||
|
||||
if ( strstr( $this->used_post_ids, ','.$post['pid'].',' ) )
|
||||
{
|
||||
$post['_show_highlight'] = 1;
|
||||
}
|
||||
|
||||
return $post;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get parents
|
||||
*
|
||||
* @param integer $root_id
|
||||
* @param array $ids
|
||||
* @return array
|
||||
*/
|
||||
private function _threadedPostGetParents($root_id, $ids=array())
|
||||
{
|
||||
if( in_array( $root_id, $ids ) )
|
||||
{
|
||||
$cnt = 0;
|
||||
|
||||
foreach( $ids as $id )
|
||||
{
|
||||
if( $id == $root_id )
|
||||
{
|
||||
$cnt++;
|
||||
|
||||
if( $cnt > 1 )
|
||||
{
|
||||
return $ids;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $this->post_cache[ $root_id ]['post_parent'] )
|
||||
{
|
||||
$ids[] = $this->post_cache[ $root_id ]['post_parent'];
|
||||
|
||||
$ids = $this->_threadedPostGetParents( $this->post_cache[ $root_id ]['post_parent'], $ids );
|
||||
}
|
||||
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get children
|
||||
*
|
||||
* @param integer $root_id
|
||||
* @param array $ids
|
||||
* @return array
|
||||
*/
|
||||
private function _threadedPostGetChildren($root_id, $ids=array())
|
||||
{
|
||||
if ( is_array($this->structured_pids[ $root_id ]) )
|
||||
{
|
||||
foreach( $this->structured_pids[ $root_id ] as $pid )
|
||||
{
|
||||
$ids[] = $pid;
|
||||
|
||||
$ids = $this->_threadedPostGetChildren( $pid, $ids );
|
||||
}
|
||||
}
|
||||
|
||||
return $ids;
|
||||
}
|
||||
}
|
||||
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>
|
||||
Reference in new issue
Block a user