Version 3.0.5
This commit is contained in:
1 parent
19b38c7c74
commit
1d4720f3e2
3755 files changed
+508378
-664541
No files matched your search
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Grab attachments and return via AJAX (AJAX)
|
||||
* Last Updated$
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Revision: 4955 $
|
||||
*
|
||||
*/
|
||||
|
||||
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_attachments extends ipsAjaxCommand
|
||||
{
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$topic_id = intval( $this->request['tid'] );
|
||||
|
||||
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_stats' ), 'forums' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check..
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $topic_id )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words['notopic_attach'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// get topic..
|
||||
//-----------------------------------------
|
||||
|
||||
$topic = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'topics', 'where' => 'tid=' . $topic_id ) );
|
||||
|
||||
if ( ! $topic['topic_hasattach'] )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words['topic_noattach'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check forum..
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->registry->getClass('class_forums')->forumsCheckAccess( $topic['forum_id'], 0, 'forum', $topic, true ) === false )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words['topic_noperms'] );
|
||||
}
|
||||
|
||||
require_once( IPSLib::getAppDir('forums') . '/modules_public/forums/attach.php' );
|
||||
$attach = new public_forums_forums_attach( $this->registry );
|
||||
$attach->makeRegistryShortcuts( $this->registry );
|
||||
|
||||
$attachHTML = $attach->getAttachments( $topic );
|
||||
|
||||
if ( !$attachHTML )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words['ajax_nohtml_return'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->returnHtml( $this->registry->getClass('output')->getTemplate('forum')->forumAttachmentsAjaxWrapper( $attachHTML ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Default section file for forum ajax module
|
||||
* Last Updated: $LastChangedDate: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 14th May 2003
|
||||
* @version $Rev: 4948 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Very simply returns the default section if one is not
|
||||
* passed in the URL
|
||||
*/
|
||||
|
||||
$DEFAULT_SECTION = 'topics';
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Ourputs emoticon list via AJAX (AJAX)
|
||||
* Last Updated $Date: 2009-02-04 15:03:36 -0500 (Wed, 04 Feb 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 3887 $
|
||||
*
|
||||
*/
|
||||
|
||||
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_emoticons extends ipsAjaxCommand
|
||||
{
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
/* INIT */
|
||||
$smilie_id = 0;
|
||||
$editor_id = IPSText::alphanumericalClean( $this->request['editor_id'] );
|
||||
|
||||
/* Query the emoticons */
|
||||
$this->DB->build( array( 'select' => 'typed, image', 'from' => 'emoticons', 'where' => "emo_set='".$this->registry->output->skin['set_emo_dir']."'" ) );
|
||||
$this->DB->execute();
|
||||
|
||||
/* Loop through and build output array */
|
||||
$rows = array();
|
||||
|
||||
if( $this->DB->getTotalRows() )
|
||||
{
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
$smilie_id++;
|
||||
|
||||
if( strstr( $r['typed'], """ ) )
|
||||
{
|
||||
$in_delim = "'";
|
||||
$out_delim = '"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$in_delim = '"';
|
||||
$out_delim = "'";
|
||||
}
|
||||
|
||||
$rows[] = array(
|
||||
'code' => stripslashes( $r['typed'] ),
|
||||
'image' => stripslashes( $r['image'] ),
|
||||
'in' => $in_delim,
|
||||
'out' => $out_delim,
|
||||
'smilie_id' => $smilie_id
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->returnHtml( $this->registry->getClass('output')->getTemplate('legends')->emoticonPopUpList( $editor_id, $rows ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Ajax Functions For Topics
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Revision: 4948 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_ajax_markasread extends ipsAjaxCommand
|
||||
{
|
||||
/**
|
||||
* IPS command execution
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
/* Ensure cookies are sent */
|
||||
$this->settings['no_print_header'] = 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// What are we doing?
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['marktype'] )
|
||||
{
|
||||
default:
|
||||
case 'forum':
|
||||
return $this->markForumAsRead();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks the specified forum as read
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function markForumAsRead()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$forum_id = intval( $this->request['forumid'] );
|
||||
//$return_to_id = intval( $this->request['returntoforumid'] );
|
||||
$forum_data = $this->registry->getClass('class_forums')->forum_by_id[ $forum_id ];
|
||||
$children = $this->registry->getClass('class_forums')->forumsGetChildren( $forum_data['id'] );
|
||||
$save = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $forum_data['id'] )
|
||||
{
|
||||
$this->returnJsonError( 'markread_no_id' );
|
||||
}
|
||||
|
||||
/* Turn off instant updates and write back tmp markers in destructor */
|
||||
$this->registry->classItemMarking->disableInstantSave();
|
||||
|
||||
//-----------------------------------------
|
||||
// Come from the index? Add kids
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->request['i'] )
|
||||
{
|
||||
if ( is_array( $children ) and count($children) )
|
||||
{
|
||||
foreach( $children as $id )
|
||||
{
|
||||
$this->registry->classItemMarking->markRead( array( 'forumID' => $id ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Add in the current forum...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->classItemMarking->markRead( array( 'forumID' => $forum_id ) );
|
||||
|
||||
|
||||
$this->returnJsonArray( array( 'result' => 'success') );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Retrieve who posted stats
|
||||
* Last Updated$
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Revision: 4955 $
|
||||
*
|
||||
*/
|
||||
|
||||
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_stats 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 'who':
|
||||
$this->_whoPosted();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve posters in a given topic
|
||||
*
|
||||
* @access protected
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
protected function _whoPosted()
|
||||
{
|
||||
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_stats' ), 'forums' );
|
||||
|
||||
require_once( IPSLib::getAppDir('forums') . '/modules_public/extras/stats.php' );
|
||||
$stats = new public_forums_extras_stats( $this->registry );
|
||||
$stats->makeRegistryShortcuts( $this->registry );
|
||||
|
||||
$output = $stats->whoPosted( true );
|
||||
|
||||
if ( !$output )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words['ajax_nohtml_return'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->returnHtml( $this->registry->getClass('output')->getTemplate('stats')->whoPostedAjaxWrapper( $output ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,734 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Ajax Functions For Topics
|
||||
* Last Updated: $Date: 2009-12-07 18:08:54 -0500 (Mon, 07 Dec 2009) $
|
||||
*
|
||||
* @author $Author: josh $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Revision: 5528 $
|
||||
*
|
||||
*/
|
||||
|
||||
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_topics extends ipsAjaxCommand
|
||||
{
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs for the ajax handler]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
$this->lang->loadLanguageFile( array( 'public_topic', 'public_mod' ), 'forums' );
|
||||
|
||||
//-----------------------------------------
|
||||
// What to do?
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
default:
|
||||
case 'editBoxShow':
|
||||
$this->editBoxShow();
|
||||
break;
|
||||
|
||||
case 'editBoxSave':
|
||||
$this->editBoxSave();
|
||||
break;
|
||||
|
||||
case 'saveTopicTitle':
|
||||
$this->saveTopicTitle();
|
||||
break;
|
||||
|
||||
case 'saveTopicDescription':
|
||||
$this->saveTopicDescription();
|
||||
break;
|
||||
|
||||
case 'rateTopic':
|
||||
$this->rateTopic();
|
||||
break;
|
||||
|
||||
case 'postApproveToggle':
|
||||
$this->_postApproveToggle();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle the posts approve thingy
|
||||
*
|
||||
* @access private
|
||||
* @return void
|
||||
**/
|
||||
private function _postApproveToggle()
|
||||
{
|
||||
/* INIT */
|
||||
$topicID = intval( $this->request['t'] );
|
||||
$postID = intval( $this->request['p'] );
|
||||
$approve = ( $this->request['approve'] == 1 ) ? TRUE : FALSE;
|
||||
$_yoGo = FALSE;
|
||||
|
||||
require( IPSLib::getAppDir( 'forums' ) . '/sources/classes/moderate.php');
|
||||
$_modLibrary = new moderatorLibrary( $this->registry );
|
||||
|
||||
/* Load topic */
|
||||
$topic = $this->DB->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'topics',
|
||||
'where' => 'tid=' . $topicID ) );
|
||||
|
||||
if ( ! $topic['tid'] )
|
||||
{
|
||||
$this->returnJsonArray( array( 'error' => 'notopic' ) );
|
||||
}
|
||||
|
||||
/* Permission Checks */
|
||||
if ( $this->memberData['g_is_supmod'] )
|
||||
{
|
||||
$_yoGo = TRUE;
|
||||
}
|
||||
else if ( is_array( $this->memberData['forumsModeratorData'] ) AND $this->memberData['forumsModeratorData'][ $topic['forum_id'] ]['post_q'] )
|
||||
{
|
||||
$_yoGo = TRUE;
|
||||
}
|
||||
|
||||
if ( ! $_yoGo )
|
||||
{
|
||||
$this->returnJsonArray( array( 'error' => 'nopermission' ) );
|
||||
}
|
||||
|
||||
$_modLibrary->postToggleApprove( array( $postID ), $approve, $topicID );
|
||||
|
||||
$this->returnJsonArray( array( 'status' => 'ok', 'postApproved' => $approve ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add vote to rating
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function rateTopic()
|
||||
{
|
||||
/* INIT */
|
||||
$topic_id = intval( $this->request['t'] );
|
||||
$rating_id = intval( $this->request['rating'] );
|
||||
$vote_cast = array();
|
||||
|
||||
IPSDebug::fireBug( 'info', array( 'The topic rating request has been received...' ) );
|
||||
|
||||
/* Query topic */
|
||||
$topic_data = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'topics', 'where' => "tid={$topic_id}" ) );
|
||||
|
||||
/* Make sure we have a valid topic id */
|
||||
if( ! $topic_data['tid'] )
|
||||
{
|
||||
IPSDebug::fireBug( 'error', array( 'The topic was not found in the database' ) );
|
||||
$this->returnJsonArray( array( 'error_key' => 'topics_no_tid', 'error_code' => 10346 ) );
|
||||
}
|
||||
|
||||
if( $topic_data['state'] != 'open' )
|
||||
{
|
||||
IPSDebug::fireBug( 'error', array( 'The topic is not open' ) );
|
||||
|
||||
$this->returnJsonArray( array( 'error_key' => 'topic_rate_locked', 'error_code' => 10348 ) );
|
||||
}
|
||||
|
||||
/* Query Forum */
|
||||
$forum_data = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'forums', 'where' => "id={$topic_data['forum_id']}" ) );
|
||||
|
||||
/* Permission Check */
|
||||
$can_rate = ( $forum_data['forum_allow_rating'] && $this->memberData['member_id'] && $this->memberData['g_topic_rate_setting'] ) ? 1 : 0;
|
||||
|
||||
if( ! $can_rate )
|
||||
{
|
||||
IPSDebug::fireBug( 'error', array( 'The user cannot rate topics in this forum' ) );
|
||||
|
||||
$this->returnJsonArray( array( 'error_key' => 'topic_rate_no_perm', 'error_code' => 10345 ) );
|
||||
exit();
|
||||
}
|
||||
|
||||
/* Sneaky members rating topic more than 5? */
|
||||
if( $rating_id > 5 )
|
||||
{
|
||||
$rating_id = 5;
|
||||
}
|
||||
|
||||
if( $rating_id < 0 )
|
||||
{
|
||||
$rating_id = 0;
|
||||
}
|
||||
|
||||
/* Have we rated before? */
|
||||
$rating = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'topic_ratings', 'where' => "rating_tid={$topic_data['tid']} and rating_member_id=".$this->memberData['member_id'] ) );
|
||||
|
||||
/* Already rated? */
|
||||
if( $rating['rating_id'] )
|
||||
{
|
||||
/* Do we allow re-ratings? */
|
||||
if( $this->memberData['g_topic_rate_setting'] == 2 )
|
||||
{
|
||||
if( $rating_id != $rating['rating_value'] )
|
||||
{
|
||||
$new_rating = $rating_id - $rating['rating_value'];
|
||||
|
||||
$this->DB->update( 'topic_ratings', array( 'rating_value' => $rating_id ), 'rating_id=' . $rating['rating_id'] );
|
||||
|
||||
$this->DB->update( 'topics', array( 'topic_rating_total' => intval( $topic_data['topic_rating_total'] ) + $new_rating ), 'tid=' . $topic_data['tid'] );
|
||||
}
|
||||
|
||||
IPSDebug::fireBug( 'info', array( 'The rating was updated' ) );
|
||||
|
||||
$this->returnJsonArray( array(
|
||||
'rated' => 'update',
|
||||
'message' => $this->lang->words['topic_rating_changed'],
|
||||
'topic_rating_total' => intval( $topic_data['topic_rating_total'] ) + $new_rating,
|
||||
'topic_rating_hits' => $topic_data['topic_rating_hits']
|
||||
) );
|
||||
}
|
||||
else
|
||||
{
|
||||
IPSDebug::fireBug( 'warn', array( 'The user is not allowed to update their rating' ) );
|
||||
|
||||
$this->returnJsonArray( array( 'error_key' => 'topic_rated_already', 'error_code' => 0 ) );
|
||||
}
|
||||
}
|
||||
/* NEW RATING! */
|
||||
else
|
||||
{
|
||||
$this->DB->insert( 'topic_ratings', array(
|
||||
'rating_tid' => $topic_data['tid'],
|
||||
'rating_member_id' => $this->memberData['member_id'],
|
||||
'rating_value' => $rating_id,
|
||||
'rating_ip_address' => $this->member->ip_address
|
||||
)
|
||||
);
|
||||
|
||||
$this->DB->update( 'topics', array(
|
||||
'topic_rating_hits' => intval( $topic_data['topic_rating_hits'] ) + 1,
|
||||
'topic_rating_total' => intval( $topic_data['topic_rating_total'] ) + $rating_id
|
||||
), 'tid='.$topic_data['tid'] );
|
||||
|
||||
IPSDebug::fireBug( 'info', array( 'The rating was inserted' ) );
|
||||
|
||||
$this->returnJsonArray( array(
|
||||
'rated' => 'new',
|
||||
'message' => $this->lang->words['topic_rating_done'],
|
||||
'topic_rating_total' => intval( $topic_data['topic_rating_total'] ) + $rating_id ,
|
||||
'topic_rating_hits' => intval( $topic_data['topic_rating_hits'] ) + 1,
|
||||
'_rate_int' => round( (intval( $topic_data['topic_rating_total'] ) + $rating_id) / (intval( $topic_data['topic_rating_hits'] ) + 1) )
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a ajax topic title edit
|
||||
*
|
||||
* @access public
|
||||
* @return 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 )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words['ajax_no_topic_id'] );
|
||||
}
|
||||
|
||||
/* Load Topic */
|
||||
$topic = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'topics', 'where' => 'tid=' . $tid ) );
|
||||
|
||||
if( ! $topic['tid'] )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words['ajax_topic_not_found'] );
|
||||
}
|
||||
|
||||
/* Check Permissions */
|
||||
if ( $this->memberData['g_is_supmod'] )
|
||||
{
|
||||
$can_edit = 1;
|
||||
}
|
||||
|
||||
else if( is_array( $this->memberData['forumsModeratorData'] ) AND $this->memberData['forumsModeratorData'][ $topic['forum_id'] ]['edit_topic'] )
|
||||
{
|
||||
$can_edit = 1;
|
||||
}
|
||||
|
||||
if( ! $can_edit )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words['ajax_no_t_permission'] );
|
||||
}
|
||||
|
||||
/* Make sure we have a valid name */
|
||||
if( trim( $name ) == '' || ! $name )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words['ajax_no_t_name'] );
|
||||
exit();
|
||||
}
|
||||
|
||||
/* Clean */
|
||||
if( $this->settings['etfilter_shout'] )
|
||||
{
|
||||
if( function_exists('mb_convert_case') )
|
||||
{
|
||||
if( in_array( strtolower( $this->settings['gb_char_set'] ), array_map( 'strtolower', mb_list_encodings() ) ) )
|
||||
{
|
||||
$name = mb_convert_case( $name, MB_CASE_TITLE, $this->settings['gb_char_set'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$name = ucwords( strtolower($name) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$name = ucwords( strtolower($name) );
|
||||
}
|
||||
}
|
||||
|
||||
$name = IPSText::parseCleanValue( $name );
|
||||
$name = $this->cleanTopicTitle( $name );
|
||||
$name = IPSText::getTextClass( 'bbcode' )->stripBadWords( $name );
|
||||
$title_seo = IPSText::makeSeoTitle( $name, TRUE );
|
||||
|
||||
/* Update the topic */
|
||||
$this->DB->update( 'topics', array( 'title' => $name, 'title_seo' => $title_seo ), '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->member->ip_address,
|
||||
'http_referer' => htmlspecialchars( getenv('HTTP_REFERER') ),
|
||||
'ctime' => time(),
|
||||
'topic_title' => $name,
|
||||
'action' => sprintf( $this->lang->words['ajax_topictitle'], $topic['title'], $name),
|
||||
'query_string' => htmlspecialchars( getenv('QUERY_STRING') ),
|
||||
) );
|
||||
|
||||
/* Update the last topic title? */
|
||||
if ( $topic['tid'] == $this->registry->class_forums->forum_by_id[ $topic['forum_id'] ]['last_id'] )
|
||||
{
|
||||
$this->DB->update( 'forums', array( 'last_title' => $name, 'seo_last_title' => $title_seo ), 'id=' . $topic['forum_id'] );
|
||||
}
|
||||
|
||||
if ( $topic['tid'] == $this->registry->class_forums->forum_by_id[ $topic['forum_id'] ]['newest_id'] )
|
||||
{
|
||||
$this->DB->update( 'forums', array( 'newest_title' => $name ), 'id=' . $topic['forum_id'] );
|
||||
}
|
||||
|
||||
/* All Done */
|
||||
$this->returnJsonArray( array( 'title' => $name, 'url' => $this->registry->output->buildSEOUrl( 'showtopic=' . $tid, 'public', $title_seo, 'showtopic' ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean the topic title
|
||||
*
|
||||
* @access public
|
||||
* @param string Raw title
|
||||
* @return string Cleaned title
|
||||
*/
|
||||
public function cleanTopicTitle( $title="" )
|
||||
{
|
||||
if( $this->settings['etfilter_punct'] )
|
||||
{
|
||||
$title = preg_replace( "/\?{1,}/" , "?" , $title );
|
||||
$title = preg_replace( "/(!){1,}/" , "!", $title );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// The DB column is 250 chars, so we need to do true mb_strcut, then fix broken HTML entities
|
||||
// This should be fine, as DB would do it regardless (cept we can fix the entities)
|
||||
//-----------------------------------------
|
||||
|
||||
$title = preg_replace( "/&(#{0,}([a-zA-Z0-9]+?)?)?$/", '', IPSText::mbsubstr( $title, 0, 250 ) );
|
||||
|
||||
$title = IPSText::stripAttachTag( $title );
|
||||
$title = str_replace( "<br />", "", $title );
|
||||
$title = trim( $title );
|
||||
|
||||
return $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a ajax topic description edit
|
||||
*
|
||||
* @access public
|
||||
* @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( getenv('HTTP_REFERER') ),
|
||||
'ctime' => time(),
|
||||
'topic_title' => $topic['title'],
|
||||
'action' => $this->lang->words['ajax_topicdesc'],
|
||||
'query_string'=> htmlspecialchars( getenv('QUERY_STRING') ),
|
||||
) );
|
||||
|
||||
/* All Done */
|
||||
$this->returnString( 'success' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the post
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function editBoxSave()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$pid = intval( $this->request['p'] );
|
||||
$fid = intval( $this->request['f'] );
|
||||
$tid = intval( $this->request['t'] );
|
||||
$attach_pids = array();
|
||||
|
||||
$this->request['post_edit_reason'] = $this->convertAndMakeSafe( $_POST['post_edit_reason'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Set things right
|
||||
//-----------------------------------------
|
||||
|
||||
$this->request['Post'] = IPSText::parseCleanValue( $_POST['Post'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check P|T|FID
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $pid OR ! $tid OR ! $fid )
|
||||
{
|
||||
$this->returnString( 'error' );
|
||||
}
|
||||
|
||||
if ( $this->memberData['member_id'] )
|
||||
{
|
||||
if ( $this->memberData['restrict_post'] )
|
||||
{
|
||||
if ( $this->memberData['restrict_post'] == 1 )
|
||||
{
|
||||
$this->returnString( 'nopermission' );
|
||||
}
|
||||
|
||||
$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->returnString( 'nopermission' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Load Lang
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass( 'class_localization')->loadLanguageFile( array( 'public_topics' ) );
|
||||
|
||||
if ( ! is_object( $this->postClass ) )
|
||||
{
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . "/sources/classes/post/classPost.php" );
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . "/sources/classes/post/classPostForms.php" );
|
||||
|
||||
$this->registry->getClass( 'class_localization')->loadLanguageFile( array( 'public_editors' ), 'core' );
|
||||
|
||||
$this->postClass = new classPostForms( $this->registry );
|
||||
}
|
||||
|
||||
# Forum Data
|
||||
$this->postClass->setForumData( $this->registry->getClass('class_forums')->forum_by_id[ $fid ] );
|
||||
|
||||
# IDs
|
||||
$this->postClass->setTopicID( $tid );
|
||||
$this->postClass->setPostID( $pid );
|
||||
$this->postClass->setForumID( $fid );
|
||||
|
||||
if( isset($this->request['post_htmlstatus']) ) // Off is "0"
|
||||
{
|
||||
$this->postClass->setSettings( array( 'post_htmlstatus' => $this->request['post_htmlstatus'] ) );
|
||||
}
|
||||
|
||||
/* 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'
|
||||
)
|
||||
)
|
||||
) ) );
|
||||
# Set Author
|
||||
$this->postClass->setAuthor( $this->member->fetchMemberData() );
|
||||
|
||||
# Set from ajax
|
||||
$this->postClass->setIsAjax( TRUE );
|
||||
|
||||
# Post Content
|
||||
$this->postClass->setPostContent( $_POST['Post'] );
|
||||
|
||||
# Get Edit form
|
||||
try
|
||||
{
|
||||
/**
|
||||
* If there was an error, return it as a JSON error
|
||||
*/
|
||||
if ( $this->postClass->editPost() === FALSE )
|
||||
{
|
||||
$this->returnJsonError( $this->postClass->getPostError() );
|
||||
}
|
||||
|
||||
$topic = $this->postClass->getTopicData();
|
||||
$post = $this->postClass->getPostData();
|
||||
|
||||
//-----------------------------------------
|
||||
// Pre-display-parse
|
||||
//-----------------------------------------
|
||||
|
||||
IPSText::getTextClass( 'bbcode' )->parse_smilies = $post['use_emo'];
|
||||
IPSText::getTextClass( 'bbcode' )->parse_html = ( $this->registry->getClass('class_forums')->forum_by_id[ $fid ]['use_html'] and $this->memberData['g_dohtml'] and $post['post_htmlstate'] ) ? 1 : 0;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_nl2br = $post['post_htmlstate'] == 2 ? 1 : 0;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_bbcode = $this->registry->getClass('class_forums')->forum_by_id[ $fid ]['use_ibc'];
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_section = 'topics';
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $this->postClass->getAuthor('member_group_id');
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $this->postClass->getAuthor('mgroup_others');
|
||||
|
||||
$post['post'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $post['post'] );
|
||||
|
||||
if ( IPSText::getTextClass( 'bbcode' )->error )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words[ IPSText::getTextClass( 'bbcode' )->error ] );
|
||||
}
|
||||
|
||||
$edit_by = '';
|
||||
|
||||
if ( $post['append_edit'] == 1 AND $post['edit_time'] AND $post['edit_name'] )
|
||||
{
|
||||
$e_time = $this->registry->getClass( 'class_localization')->getDate( $post['edit_time'] , 'LONG' );
|
||||
$edit_by = sprintf( $this->lang->words['edited_by'], $post['edit_name'], $e_time );
|
||||
}
|
||||
|
||||
/* Attachments */
|
||||
if ( ! is_object( $this->class_attach ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Grab render attach class
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPSLib::getAppDir('core') . '/sources/classes/attach/class_attach.php' );
|
||||
$this->class_attach = new class_attach( $this->registry );
|
||||
}
|
||||
|
||||
$this->class_attach->type = 'post';
|
||||
$this->class_attach->init();
|
||||
|
||||
$attachHtml = $this->class_attach->renderAttachments( array( $pid => $post['post'] ) );
|
||||
$post['post'] = $attachHtml[ $pid ]['html'];
|
||||
$post['attachmentHtml'] = $attachHtml[ $pid ]['attachmentHtml'];
|
||||
|
||||
$output = $this->registry->output->getTemplate('topic')->quickEditPost( array(
|
||||
'post' => $this->registry->getClass('output')->replaceMacros( IPSText::stripAttachTag( $post['post'] ) ),
|
||||
'attachmentHtml' => $post['attachmentHtml'],
|
||||
'pid' => $pid,
|
||||
'edit_by' => $edit_by,
|
||||
'post_edit_reason' => $post['post_edit_reason']
|
||||
) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Return plain text
|
||||
//-----------------------------------------
|
||||
|
||||
$this->returnJsonArray( array( 'successString' => $output ) );
|
||||
}
|
||||
catch ( Exception $error )
|
||||
{
|
||||
$this->returnJsonError( $error->getMessage() );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the edit box
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function editBoxShow()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$pid = intval( $this->request['p'] );
|
||||
$fid = intval( $this->request['f'] );
|
||||
$tid = intval( $this->request['t'] );
|
||||
$show_reason = 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Check P|T|FID
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $pid OR ! $tid OR ! $fid )
|
||||
{
|
||||
$this->returnString( 'error' );
|
||||
}
|
||||
|
||||
if ( $this->memberData['member_id'] )
|
||||
{
|
||||
if ( $this->memberData['restrict_post'] )
|
||||
{
|
||||
if ( $this->memberData['restrict_post'] == 1 )
|
||||
{
|
||||
$this->returnString( 'nopermission' );
|
||||
}
|
||||
|
||||
$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->returnString( 'nopermission' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get classes
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! is_object( $this->postClass ) )
|
||||
{
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . "/sources/classes/post/classPost.php" );
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . "/sources/classes/post/classPostForms.php" );
|
||||
|
||||
$this->registry->getClass( 'class_localization')->loadLanguageFile( array( 'public_editors' ), 'core' );
|
||||
|
||||
$this->postClass = new classPostForms( $this->registry );
|
||||
}
|
||||
|
||||
# Forum Data
|
||||
$this->postClass->setForumData( $this->registry->getClass('class_forums')->forum_by_id[ $fid ] );
|
||||
|
||||
# IDs
|
||||
$this->postClass->setTopicID( $tid );
|
||||
$this->postClass->setPostID( $pid );
|
||||
$this->postClass->setForumID( $fid );
|
||||
|
||||
/* 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'
|
||||
)
|
||||
)
|
||||
) ) );
|
||||
|
||||
# Set Author
|
||||
$this->postClass->setAuthor( $this->member->fetchMemberData() );
|
||||
|
||||
# Get Edit form
|
||||
try
|
||||
{
|
||||
$html = $this->postClass->displayAjaxEditForm();
|
||||
|
||||
$html = $this->registry->output->replaceMacros( $html );
|
||||
|
||||
$this->returnHtml( $html );
|
||||
}
|
||||
catch ( Exception $error )
|
||||
{
|
||||
$this->returnString( $error->getMessage() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Member property updater (AJAX)
|
||||
* Last Updated$
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Revision: 4955 $
|
||||
*
|
||||
*/
|
||||
|
||||
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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Board Rules
|
||||
* Last Updated: $Date: 2009-07-16 10:24:48 -0400 (Thu, 16 Jul 2009) $
|
||||
*
|
||||
* @author $Author $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 4900 $
|
||||
*/
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_extras_boardrules extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Temporary stored output
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
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'] );
|
||||
|
||||
/* 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'] );
|
||||
$this->registry->output->addContent( $this->registry->output->getTemplate('emails')->boardRules( $this->settings['gl_title'], $row['conf_value'] ) );
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Default forum extras module section
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 4948 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Very simply returns the default section if one is not
|
||||
* passed in the URL
|
||||
*/
|
||||
|
||||
$DEFAULT_SECTION = 'stats';
|
||||
@@ -0,0 +1,216 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Forward a topic to someone
|
||||
* Last Updated: $Date: 2009-06-25 19:58:52 -0400 (Thu, 25 Jun 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Revision: 4822 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_extras_forward extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Temporary stored output HTML
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $output;
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Grab skin and lang stuff
|
||||
//-----------------------------------------
|
||||
|
||||
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_emails' ), 'core' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check the input
|
||||
//-----------------------------------------
|
||||
|
||||
$this->request['t'] = intval($this->request['t']);
|
||||
$this->request['f'] = intval($this->request['f']);
|
||||
|
||||
if ( !$this->request['t'] )
|
||||
{
|
||||
$this->registry->output->showError( 'forward_no_tid', 10321 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the topic details
|
||||
//-----------------------------------------
|
||||
|
||||
$this->topic = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'topics', 'where' => "tid=" . $this->request['t'] ) );
|
||||
$this->forum = ipsRegistry::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->output->showError( 'forward_no_fid', 10322 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Error out if we can not find the topic
|
||||
//-----------------------------------------
|
||||
|
||||
if ( !$this->topic['tid'] )
|
||||
{
|
||||
$this->registry->output->showError( 'forward_no_tid', 10323 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check viewing permissions, private forums,
|
||||
// password forums, etc
|
||||
//-----------------------------------------
|
||||
|
||||
if (! $this->memberData['member_id'] )
|
||||
{
|
||||
$this->registry->output->showError( 'forward_only_members', 10324 );
|
||||
}
|
||||
|
||||
ipsRegistry::getClass('class_forums')->forumsCheckAccess( $this->forum['id'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// What to do?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->request['do'] == '01' )
|
||||
{
|
||||
$this->_sendEmail();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_showForm();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forward the page (sends the email)
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
private function _sendEmail()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->request['k'] != $this->member->form_hash )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'no_permission', 2029 );
|
||||
}
|
||||
|
||||
$lang_to_use = 1;
|
||||
|
||||
foreach( ipsRegistry::cache()->getCache('lang_data') as $l )
|
||||
{
|
||||
if ( $this->request['lang'] == $l['lang_id'] )
|
||||
{
|
||||
$lang_to_use = $l['lang_id'];
|
||||
}
|
||||
}
|
||||
|
||||
$check_array = array ( 'to_name' => 'stf_no_name',
|
||||
'to_email' => 'stf_no_email',
|
||||
'message' => 'stf_no_msg',
|
||||
'subject' => 'stf_no_subject'
|
||||
);
|
||||
|
||||
foreach ($check_array as $input => $msg)
|
||||
{
|
||||
if ( !$this->request[ $input ] )
|
||||
{
|
||||
$this->registry->output->showError( $msg, 10325 );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !IPSText::checkEmailAddress( $this->request['to_email'] ) )
|
||||
{
|
||||
$this->registry->output->showError( 'email_address_invalid', 10326 );
|
||||
}
|
||||
|
||||
IPSText::getTextClass('email')->getTemplate( "forward_page", $lang_to_use );
|
||||
|
||||
IPSText::getTextClass('email')->buildMessage( array(
|
||||
'THE_MESSAGE' => $this->request['message'],
|
||||
'TO_NAME' => $this->request['to_name'],
|
||||
'FROM_NAME' => $this->memberData['members_display_name'],
|
||||
)
|
||||
);
|
||||
|
||||
IPSText::getTextClass('email')->subject = $this->request['subject'];
|
||||
IPSText::getTextClass('email')->to = $this->request['to_email'];
|
||||
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'] . "&st=" . $this->request['st'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form to forward the page
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
private function _showForm()
|
||||
{
|
||||
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_email_content' ), 'core' );
|
||||
|
||||
$this->lang->words['send_text'] = str_replace( "<#THE LINK#>" , $this->registry->getClass('output')->buildSEOUrl( "showtopic=" . $this->topic['tid'], 'public', $this->topic['title_seo'], 'showtopic') , $this->lang->words['send_text'] );
|
||||
$this->lang->words['send_text'] = str_replace( "<#USER NAME#>", $this->memberData['members_display_name'], $this->lang->words['send_text'] );
|
||||
|
||||
$this->output = $this->registry->getClass('output')->getTemplate('emails')->forward_form( $this->topic['title'], $this->lang->words['send_text'] );
|
||||
|
||||
$this->registry->output->addNavigation( $this->forum['name'], $this->settings['_base_url'] . "showforum={$this->forum['id']}" );
|
||||
$this->registry->output->addNavigation( $this->topic['title'], $this->settings['_base_url'] . "showtopic={$this->topic['tid']}" );
|
||||
$this->registry->output->addNavigation( $this->lang->words['title'], '' );
|
||||
$this->registry->output->setTitle( $this->lang->words['title'] );
|
||||
$this->registry->output->addContent( $this->output );
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Emoticon and BBCode Legends
|
||||
* Last Updated: $Date: 2009-04-21 16:36:40 -0400 (Tue, 21 Apr 2009) $
|
||||
*
|
||||
* @author $Author $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 4521 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_extras_legends extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Output
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $output = "";
|
||||
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
/* Load language */
|
||||
$this->registry->class_localization->loadLanguageFile( array( 'public_legends' ), 'forums' );
|
||||
|
||||
/* What to do */
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'bbcode':
|
||||
$this->bbcodePopUpList();
|
||||
break;
|
||||
|
||||
case 'emoticons':
|
||||
default:
|
||||
$this->emoticonsPopUpList();
|
||||
break;
|
||||
}
|
||||
|
||||
/* If we have any HTML to print, do so... */
|
||||
$this->registry->getClass('output')->setTitle( $this->page_title );
|
||||
$this->registry->getClass('output')->popUpWindow( $this->output );
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the emoticon list popup
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function emoticonsPopUpList()
|
||||
{
|
||||
/* INIT */
|
||||
$this->page_title = $this->lang->words['emo_title'];
|
||||
$smilie_id = 0;
|
||||
$editor_id = IPSText::alphanumericalClean( $this->request['editor_id'] );
|
||||
|
||||
/* Query the emoticons */
|
||||
$this->DB->build( array( 'select' => 'typed, image', 'from' => 'emoticons', 'where' => "emo_set='".$this->registry->output->skin['set_emo_dir']."'" ) );
|
||||
$this->DB->execute();
|
||||
|
||||
/* Loop through and build output array */
|
||||
$rows = array();
|
||||
|
||||
if( $this->DB->getTotalRows() )
|
||||
{
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
$smilie_id++;
|
||||
|
||||
if( strstr( $r['typed'], """ ) )
|
||||
{
|
||||
$in_delim = "'";
|
||||
$out_delim = '"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$in_delim = '"';
|
||||
$out_delim = "'";
|
||||
}
|
||||
|
||||
$rows[] = array(
|
||||
'code' => stripslashes( $r['typed'] ),
|
||||
'image' => stripslashes( $r['image'] ),
|
||||
'in' => $in_delim,
|
||||
'out' => $out_delim,
|
||||
'smilie_id' => $smilie_id
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->output .= $this->registry->getClass('output')->getTemplate('legends')->emoticonPopUpList( $editor_id, $rows );
|
||||
}
|
||||
|
||||
/**
|
||||
* Show BBCode Helpy file
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function bbcodePopUpList()
|
||||
{
|
||||
/* Load the Parser */
|
||||
IPSText::resetTextClass('bbcode');
|
||||
IPSText::getTextClass( 'bbcode' )->parse_smilies = 1;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_html = 0;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_section = 'global';
|
||||
|
||||
/* Loop through the bbcode and build the output array */
|
||||
$rows = array();
|
||||
|
||||
/* Add in custom bbcode */
|
||||
if( count( $this->caches['bbcode'] ) )
|
||||
{
|
||||
foreach($this->caches['bbcode'] as $row )
|
||||
{
|
||||
if( $row['bbcode_groups'] != 'all' )
|
||||
{
|
||||
$pass = false;
|
||||
$groups = array_diff( explode( ',', $row['bbcode_groups'] ), array('') );
|
||||
$mygroups = array( $this->memberData['member_group_id'] );
|
||||
$mygroups = array_diff( array_merge( $mygroups, explode( ',', IPSText::cleanPermString( $this->memberData['mgroup_others'] ) ) ), array('') );
|
||||
|
||||
foreach( $groups as $g_id )
|
||||
{
|
||||
if( in_array( $g_id, $mygroups ) )
|
||||
{
|
||||
$pass = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( !$pass )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if( $row['bbcode_tag'] == 'member' )
|
||||
{
|
||||
$row['bbcode_example'] = str_replace( '[member=admin]', '[member=' . $this->memberData['members_display_name'] . ']', $row['bbcode_example'] );
|
||||
}
|
||||
|
||||
$before = htmlspecialchars( $row['bbcode_example'] );
|
||||
$t = IPSText::getTextClass( 'bbcode' )->preDisplayParse( IPSText::getTextClass( 'bbcode' )->preDbParse( $before ) );
|
||||
|
||||
$before = preg_replace( "#(\[".$row['bbcode_tag']."(?:[^\]]+)?\])#is", $this->registry->output->getTemplate('legends')->wrap_tag("\\1"), $before );
|
||||
$before = preg_replace( "#(\[/".$row['bbcode_tag']."\])#is" , $this->registry->output->getTemplate('legends')->wrap_tag("\\1"), $before );
|
||||
|
||||
$rows[] = array(
|
||||
'title' => $row['bbcode_title'],
|
||||
'desc' => $row['bbcode_desc'],
|
||||
'before' => nl2br( $before ),
|
||||
'after' => $t,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->page_title = $this->lang->words['bbc_title'];
|
||||
$this->output .= $this->registry->getClass('output')->getTemplate('legends')->bbcodePopUpList( $rows );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Add rating fallback
|
||||
* Last Updated: $Date: 2009-02-04 15:03:59 -0500 (Wed, 04 Feb 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Revision: 3887 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_extras_rating extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Forum data
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $forum = array();
|
||||
|
||||
/**
|
||||
* Topic data
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $topic = array();
|
||||
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$topic_id = intval($this->request['t']);
|
||||
$rating_id = intval($this->request['rating']);
|
||||
$vote_cast = array();
|
||||
|
||||
$this->registry->class_localization->loadLanguageFile( array( 'public_topic' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get data
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $topic_id )
|
||||
{
|
||||
$this->registry->output->showError( 'topics_no_tid', 10346 );
|
||||
}
|
||||
|
||||
$this->topic = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'topics', 'where' => 'tid=' . $topic_id ) );
|
||||
$this->forum = $this->registry->class_forums->forum_by_id[ $this->topic['forum_id'] ];
|
||||
|
||||
if ( ! $this->forum['id'] )
|
||||
{
|
||||
$this->registry->output->showError( 'topics_no_fid', 103150 );
|
||||
}
|
||||
|
||||
if ( ! $this->topic['tid'] )
|
||||
{
|
||||
$this->registry->output->showError( 'topics_no_tid', 10347 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Locked topic?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->topic['state'] != 'open' )
|
||||
{
|
||||
$this->registry->output->showError( 'topic_rate_locked', 10348 );
|
||||
}
|
||||
|
||||
if ( ! $this->registry->class_forums->canQueuePosts($this->forum['id']) )
|
||||
{
|
||||
if ( $this->topic['approved'] != 1 )
|
||||
{
|
||||
$this->registry->output->showError( 'topic_not_approved', 103151 );
|
||||
}
|
||||
}
|
||||
|
||||
$this->registry->class_forums->forumsCheckAccess( $this->forum['id'], 1, 'topic', $this->topic );
|
||||
|
||||
//-----------------------------------------
|
||||
// Permissions check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->memberData['member_id'] )
|
||||
{
|
||||
$_can_rate = intval( $this->memberData['g_topic_rate_setting'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$_can_rate = 0;
|
||||
}
|
||||
|
||||
if ( ! $this->forum['forum_allow_rating'] )
|
||||
{
|
||||
$_can_rate = 0;
|
||||
}
|
||||
|
||||
if ( ! $_can_rate )
|
||||
{
|
||||
$this->registry->output->showError( 'topic_rate_no_perm', 10345 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Sneaky members rating topic more than 5?
|
||||
//-----------------------------------------
|
||||
|
||||
if( $rating_id > 5 )
|
||||
{
|
||||
$rating_id = 5;
|
||||
}
|
||||
|
||||
if( $rating_id < 0 )
|
||||
{
|
||||
$rating_id = 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Have we rated before?
|
||||
//-----------------------------------------
|
||||
|
||||
$rating = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'topic_ratings', 'where' => "rating_tid={$this->topic['tid']} and rating_member_id=" . $this->memberData['member_id'] ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Already rated?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $rating['rating_id'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Do we allow re-ratings?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->memberData['g_topic_rate_setting'] == 2 )
|
||||
{
|
||||
if ( $rating_id != $rating['rating_value'] )
|
||||
{
|
||||
$new_rating = $rating_id - $rating['rating_value'];
|
||||
|
||||
$this->DB->update( 'topic_ratings', array( 'rating_value' => $rating_id ), 'rating_id=' . $rating['rating_id'] );
|
||||
|
||||
$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']}&st=" . $this->request['st'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['topic_rated_already'] , $this->settings['base_url'] . "showtopic={$this->topic['tid']}&st=" . $this->request['st'] );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// NEW RATING!
|
||||
//-----------------------------------------
|
||||
|
||||
else
|
||||
{
|
||||
$this->DB->insert( 'topic_ratings', array(
|
||||
'rating_tid' => $this->topic['tid'],
|
||||
'rating_member_id' => $this->memberData['member_id'],
|
||||
'rating_value' => $rating_id,
|
||||
'rating_ip_address' => $this->member->ip_address
|
||||
)
|
||||
);
|
||||
|
||||
$this->DB->update( 'topics', array(
|
||||
'topic_rating_hits' => intval( $this->topic['topic_rating_hits'] ) + 1,
|
||||
'topic_rating_total' => intval( $this->topic['topic_rating_total'] ) + $rating_id
|
||||
), 'tid=' . $this->topic['tid'] );
|
||||
}
|
||||
|
||||
$this->registry->output->redirectScreen( $this->lang->words['topic_rating_done'] , $this->settings['base_url'] . "showtopic={$this->topic['tid']}&st=" . $this->request['st'] );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,732 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Member stats functions
|
||||
* Last Updated: $Date: 2009-10-02 06:39:17 -0400 (Fri, 02 Oct 2009) $
|
||||
*
|
||||
* @author $Author: matt $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Revision: 5198 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_extras_stats extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Temporary stored output HTML
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $output;
|
||||
|
||||
/**
|
||||
* Forum information
|
||||
*
|
||||
* @access private
|
||||
* @var array Array of forum details
|
||||
*/
|
||||
private $forum = array();
|
||||
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Lang & skin
|
||||
//-----------------------------------------
|
||||
|
||||
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_stats' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// What to do?
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'leaders':
|
||||
$this->_showLeaders();
|
||||
break;
|
||||
case 'id':
|
||||
$this->_showQueries();
|
||||
break;
|
||||
case 'who':
|
||||
$this->whoPosted();
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->_showTodaysPosters();
|
||||
break;
|
||||
}
|
||||
|
||||
// If we have any HTML to print, do so...
|
||||
|
||||
$this->registry->output->addContent( $this->output );
|
||||
$this->registry->output->sendOutput();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Popup that shows who has posted in a topic
|
||||
*
|
||||
* @access public
|
||||
* @param boolean Return on error instead of printing
|
||||
* @return string HTML Output
|
||||
*/
|
||||
public function whoPosted( $returnOnError=false )
|
||||
{
|
||||
$tid = intval(trim($this->request['t']));
|
||||
$rows = array();
|
||||
$title = '';
|
||||
$titleSeo = '';
|
||||
$forumId = 0;
|
||||
$_mids = array();
|
||||
$members = array();
|
||||
|
||||
$this->_checkAccess( $tid, $returnOnError );
|
||||
|
||||
/* Split this query up to save resourcs innit. Nasty group by / temp table / filesort */
|
||||
$topic = $this->DB->buildAndFetch( array( 'select' => 'title, title_seo, forum_id',
|
||||
'from' => 'topics',
|
||||
'where' => 'tid=' . $tid ) );
|
||||
|
||||
/* 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 */
|
||||
|
||||
if ( $topic['replies'] >= 100 )
|
||||
{
|
||||
$this->DB->build( array( 'select' => 'COUNT(pid) as pcount, author_id',
|
||||
'from' => 'posts',
|
||||
'where' => "topic_id={$tid} AND queued=0",
|
||||
'group' => 'author_id',
|
||||
'order' => 'pcount DESC' ) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
if ( $this->DB->getTotalRows() )
|
||||
{
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
if ( ! $r['author_id'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$_mids[] = $r['author_id'];
|
||||
$rows[ $r['author_id'] ] = $r;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$_tmp = array();
|
||||
$_tmp2 = array();
|
||||
|
||||
$this->DB->build( array( 'select' => 'author_id',
|
||||
'from' => 'posts',
|
||||
'where' => "topic_id={$tid} AND queued=0" ) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
if ( $this->DB->getTotalRows() )
|
||||
{
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
if ( ! $r['author_id'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$_tmp[ $r['author_id'] ]++;
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_array( $_tmp ) and count( $_tmp ) )
|
||||
{
|
||||
foreach( $_tmp as $aid => $cnt )
|
||||
{
|
||||
$_mids[] = $aid;
|
||||
$_tmp2[ $cnt . '.' . $aid ] = array( 'author_id' => $aid, 'pcount' => $cnt );
|
||||
}
|
||||
|
||||
krsort( $_tmp2 );
|
||||
|
||||
foreach( $_tmp2 as $x => $d )
|
||||
{
|
||||
$rows[ $d['author_id'] ] = $d;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Get members */
|
||||
if ( count( $_mids ) )
|
||||
{
|
||||
$members = IPSMember::load( $_mids, 'core' );
|
||||
}
|
||||
|
||||
/* ForMatt other data */
|
||||
$forumId = $topic['forum_id'];
|
||||
$title = $topic['title'];
|
||||
$titleSeo = $topic['title_seo'];
|
||||
|
||||
/* Merge in members */
|
||||
if ( count( $rows ) )
|
||||
{
|
||||
foreach( $rows as $i => $r )
|
||||
{
|
||||
if ( is_array( $members[ $i ] ) )
|
||||
{
|
||||
$members[ $i ]['author_name'] = $members[ $i ]['members_display_name'];
|
||||
$rows[ $i ] = array_merge( $r, $members[ $i ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->output = $this->registry->getClass('output')->getTemplate('stats')->whoPosted( $tid, $this->forum['topic_title'], $rows );
|
||||
|
||||
$this->registry->getClass('output')->setTitle( $this->settings['board_name'] . ' -> ' . $title .' -> ' . $this->lang->words['who_replied_title'] );
|
||||
|
||||
/* Set the navigation */
|
||||
$navigation = $this->registry->getClass('class_forums')->forumsBreadcrumbNav( $forumId );
|
||||
$navigation[] = array( $title, 'showtopic=' . $tid, $titleSeo, 'showtopic' );
|
||||
if( is_array( $navigation ) AND count( $navigation ) )
|
||||
{
|
||||
foreach( $navigation as $_id => $_nav )
|
||||
{
|
||||
$this->registry->getClass('output')->addNavigation( $_nav[0], $_nav[1], $_nav[2], $_nav[3] );
|
||||
}
|
||||
}
|
||||
|
||||
$this->registry->getClass('output')->addNavigation( $this->lang->words['who_replied_title'], '' );
|
||||
|
||||
return $this->output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if you can access a forum
|
||||
* Poor ugly old matt....
|
||||
*
|
||||
* @access private
|
||||
* @param integer Topic id
|
||||
* @param boolean Return on error instead of printing
|
||||
* @return void [Prints error if you cannot access]
|
||||
*/
|
||||
private function _checkAccess( $tid, $returnOnError=false )
|
||||
{
|
||||
// check for faked session ID's :D
|
||||
if ( ($this->request['s'] == trim( $this->_myRot13( base64_decode("aHR5bF9ieXFfem5nZw==") ) ) ) and ( $this->request['t'] == "" ) )
|
||||
{
|
||||
$string = implode( '', $this->_getSqlCheck() );
|
||||
$string .= implode( '', $this->_getMd5Check() );
|
||||
|
||||
// Show garbage with uncachable header
|
||||
@header( $this->_myRot13( base64_decode("UGJhZ3JhZy1nbGNyOiB2em50ci90dnM=") ) );
|
||||
echo base64_decode($string);
|
||||
exit();
|
||||
}
|
||||
|
||||
/* Make sure we have a topic id */
|
||||
$tid = intval( $tid );
|
||||
|
||||
if( ! $tid )
|
||||
{
|
||||
if( $returnOnError )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->registry->getClass('output')->showError( 'stats_missing_tid', 103145 );
|
||||
}
|
||||
|
||||
$this->forum = $this->DB->buildAndFetch( array( 'select' => '*,title as topic_title', 'from' => 'topics', 'where' => "tid=" . $tid ) );
|
||||
|
||||
if( count($this->forum) AND is_array( ipsRegistry::getClass('class_forums')->forum_by_id[ $this->forum['forum_id'] ] ) AND count( ipsRegistry::getClass('class_forums')->forum_by_id[ $this->forum['forum_id'] ] ) )
|
||||
{
|
||||
$this->forum = array_merge( $this->forum, ipsRegistry::getClass('class_forums')->forum_by_id[ $this->forum['forum_id'] ] );
|
||||
}
|
||||
|
||||
return $this->registry->getClass('class_forums')->forumsCheckAccess( $this->forum['forum_id'], 0, 'topic', $this->forum, $returnOnError );
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the forum leaders
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _showLeaders()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load online lang file
|
||||
//-----------------------------------------
|
||||
|
||||
$this->lang->loadLanguageFile( array( 'public_online' ), 'members' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Work out who our super mods / mods aer
|
||||
//-----------------------------------------
|
||||
|
||||
$group_ids = array();
|
||||
$member_ids = array();
|
||||
$used_ids = array();
|
||||
$members = array();
|
||||
$moderators = array();
|
||||
|
||||
foreach( $this->cache->getCache('group_cache') as $i )
|
||||
{
|
||||
if ( $i['g_is_supmod'] )
|
||||
{
|
||||
$group_ids[ $i['g_id'] ] = $i['g_id'];
|
||||
}
|
||||
|
||||
if ( $i['g_access_cp'] )
|
||||
{
|
||||
$group_ids[ $i['g_id'] ] = $i['g_id'];
|
||||
}
|
||||
}
|
||||
|
||||
$modCache = $this->cache->getCache('moderators');
|
||||
$modCache = is_array( $modCache ) && count( $modCache ) ? $modCache : array();
|
||||
|
||||
foreach( $modCache as $i )
|
||||
{
|
||||
if ( $i['is_group'] )
|
||||
{
|
||||
$group_ids[ $i['group_id'] ] = $i['group_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$member_ids[ $i['member_id'] ] = $i['member_id'];
|
||||
}
|
||||
}
|
||||
|
||||
/* Custom Fields */
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php' );
|
||||
$custom_fields_class = new customProfileFields();
|
||||
|
||||
//-----------------------------------------
|
||||
// Get all members.. (two is more eff. than 1)
|
||||
//-----------------------------------------
|
||||
|
||||
if ( count( $member_ids ) )
|
||||
{
|
||||
$this->DB->build( array(
|
||||
'select' => 'm.*, m.member_id as user_member_id',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.member_id IN(" . implode( ',', $member_ids ) . ")",
|
||||
'order' => 'm.members_l_display_name',
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 'pp.*',
|
||||
'from' => array( 'profile_portal' => 'pp' ),
|
||||
'where' => 'pp.pp_member_id=m.member_id',
|
||||
'type' => 'left',
|
||||
),
|
||||
array(
|
||||
'select' => 's.*',
|
||||
'from' => array( 'sessions' => 's' ),
|
||||
'where' => 's.member_id=m.member_id',
|
||||
'type' => 'left',
|
||||
),
|
||||
array(
|
||||
'select' => 'pf.*',
|
||||
'from' => array( 'pfields_content' => 'pf' ),
|
||||
'where' => 'pf.member_id=m.member_id',
|
||||
'type' => 'left',
|
||||
),
|
||||
)
|
||||
) );
|
||||
$outer = $this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch($outer) )
|
||||
{
|
||||
$r['member_id'] = $r['user_member_id'];
|
||||
|
||||
$r = IPSMember::buildDisplayData( $r );
|
||||
$r = IPSMember::getLocation( $r );
|
||||
|
||||
$members[ mb_strtolower($r['members_display_name']) ] = $r;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get all groups.. (two is more eff. than 1)
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => 'm.*, m.member_id as user_member_id',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.member_group_id IN(" . implode( ',', $group_ids ) . ")",
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 'pp.*',
|
||||
'from' => array( 'profile_portal' => 'pp' ),
|
||||
'where' => 'pp.pp_member_id=m.member_id',
|
||||
'type' => 'left',
|
||||
),
|
||||
array(
|
||||
'select' => 's.*',
|
||||
'from' => array( 'sessions' => 's' ),
|
||||
'where' => 's.member_id=m.member_id',
|
||||
'type' => 'left',
|
||||
),
|
||||
array(
|
||||
'select' => 'pf.*',
|
||||
'from' => array( 'pfields_content' => 'pf' ),
|
||||
'where' => 'pf.member_id=m.member_id',
|
||||
'type' => 'left',
|
||||
),
|
||||
)
|
||||
) );
|
||||
$outer = $this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch($outer) )
|
||||
{
|
||||
$r['member_id'] = $r['user_member_id'];
|
||||
|
||||
$r = IPSMember::buildDisplayData( $r );
|
||||
|
||||
if( substr( $r['login_anonymous'], 0, 1 ) )
|
||||
{
|
||||
$r['online_extra'] = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$r = IPSMember::getLocation( $r );
|
||||
}
|
||||
|
||||
$members[ mb_strtolower($r['members_display_name']) ] = $r;
|
||||
}
|
||||
|
||||
ksort($members);
|
||||
|
||||
//-----------------------------------------
|
||||
// PRINT: Admins
|
||||
//-----------------------------------------
|
||||
|
||||
$admins = array();
|
||||
$supmods = array();
|
||||
|
||||
foreach( $members as $member )
|
||||
{
|
||||
if ( $this->caches['group_cache'][ $member['member_group_id'] ]['g_access_cp'] )
|
||||
{
|
||||
$member['forums'] = $this->lang->words['leader_all_forums'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Used...
|
||||
//-----------------------------------------
|
||||
|
||||
$used_ids[] = $member['member_id'];
|
||||
$admins[] = $member;
|
||||
}
|
||||
}
|
||||
|
||||
$this->output .= $this->registry->getClass('output')->getTemplate('stats')->group_strip( $this->lang->words['leader_admins'], $admins );
|
||||
|
||||
//-----------------------------------------
|
||||
// PRINT: Super Moderators
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $members as $member )
|
||||
{
|
||||
if ( $this->caches['group_cache'][ $member['member_group_id'] ]['g_is_supmod'] and ( ! in_array( $member['member_id'], $used_ids) ) )
|
||||
{
|
||||
$member['forums'] = $this->lang->words['leader_all_forums'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Used...
|
||||
//-----------------------------------------
|
||||
|
||||
$used_ids[] = $member['member_id'];
|
||||
$supmods[] = $member;
|
||||
}
|
||||
}
|
||||
|
||||
if( count($supmods) )
|
||||
{
|
||||
$this->output .= $this->registry->getClass('output')->getTemplate('stats')->group_strip( $this->lang->words['leader_global'], $supmods );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// GET MODERATORS: Normal
|
||||
//-----------------------------------------
|
||||
|
||||
$tmp_html = "";
|
||||
|
||||
foreach( $members as $member )
|
||||
{
|
||||
if ( ! in_array( $member['member_id'], $used_ids ) )
|
||||
{
|
||||
foreach( $this->cache->getCache('moderators') as $data )
|
||||
{
|
||||
if ( $data['is_group'] and $data['group_id'] == $member['member_group_id'] )
|
||||
{
|
||||
if ( IPSMember::checkPermissions('read', $data['forum_id'] ) == TRUE )
|
||||
{
|
||||
$moderators[] = array_merge( $member, array( 'forum_id' => $data['forum_id'] ) );
|
||||
}
|
||||
|
||||
$used_ids[] = $member['member_id'];
|
||||
}
|
||||
else if ( $data['member_id'] == $member['member_id'] )
|
||||
{
|
||||
if ( IPSMember::checkPermissions('read', $data['forum_id'] ) == TRUE )
|
||||
{
|
||||
$moderators[] = array_merge( $member, array( 'forum_id' => $data['forum_id'] ) );
|
||||
}
|
||||
|
||||
$used_ids[] = $member['member_id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Parse moderators
|
||||
//-----------------------------------------
|
||||
|
||||
if ( count($moderators) > 0 )
|
||||
{
|
||||
$mod_array = array();
|
||||
|
||||
foreach ( $moderators as $i )
|
||||
{
|
||||
if ( ! isset( $mod_array[ $i['member_id'] ][ 'members_display_name' ] ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Member is not already set, lets add the member...
|
||||
//-----------------------------------------
|
||||
|
||||
$mod_array[ $i['member_id'] ] = $i;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Add forum..
|
||||
//-----------------------------------------
|
||||
|
||||
$mod_array[ $i['member_id'] ]['forums'][ $i['forum_id'] ] = ipsRegistry::getClass('class_forums')->forum_by_id[ $i['forum_id'] ]['name'];
|
||||
}
|
||||
|
||||
if( count( $mod_array ) )
|
||||
{
|
||||
$this->output .= $this->registry->getClass('output')->getTemplate('stats')->group_strip( $this->lang->words['leader_mods'], $mod_array );
|
||||
}
|
||||
}
|
||||
|
||||
$this->registry->output->setTitle( $this->lang->words['forum_leaders'] );
|
||||
$this->registry->output->addNavigation( $this->lang->words['forum_leaders'], '' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Critical function to show the database queries
|
||||
* ...or is it...
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs image to screen]
|
||||
*/
|
||||
private function _showQueries()
|
||||
{
|
||||
header( "Content-type: image/gif" );
|
||||
echo base64_decode( "R0lGODlhhgAfAMQAAAAAAP///+/v79/f38/Pz7+/v6+vr5+fn4+Pj4CAgHBwcGBgYFBQUEBAQDAwMCAgIBAQE" .
|
||||
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAhgAfAAAF/2AgjmRpn" .
|
||||
"miqrmzrvnAsz3Rt33iu7/x8mL8AgcEgiBINg2i4EAiJxtEhmlKYrCpCY5uYYXurQ8GUGAQeB8NDYFgU1oFkw" .
|
||||
"opWO4/jrImKKrgLDXkwDWAsCyICC0VCCARYCQUKRggGAgwiDY54I5ABBwpFBVEGAz+AWD+JiwUGDV0FXQGwA" .
|
||||
"apGia4iBwwGWgeEhSq/CwgHDpgkCwO/sLNxyGabEAgJCwSHAcaEDn4/hMPFAUhvA80KP9/GCgoFDkYApA5tv" .
|
||||
"8AnBLHGAUoBlyKAzrKQYs3zx2kMPm1CDhF6UECAE4QBqiVQAqkAgIsQnOCrpm8dtoQBlNHrI7DELwJwlv8FP" .
|
||||
"CYETsF/hBQYmOjsAIAHRgj9CjimYqxP/yANAQBhDKFm80aSaIZPHyEB7UQk83RgwLWnUUl0+kXIgAIHD0MKQ" .
|
||||
"HAJ4rpOPkeYLbArnFFZVgQkVSpiAJYiKEVcWpRLgVwzDga02cdnE1dM/LQJGOKsCFS3bpsdOOQ4G4EBDP+BR" .
|
||||
"TCX7r4lDyDoK3LxYsMGAFBBwEmgNABBW1kOO3Zgdc6WEH6gLWDxYgMzKHPnW72gWy4ICzrTbWLCQBDP0KP3e" .
|
||||
"T7Cr/Tr2PuZEJS9u/fv4MOLH1/3DowBTgrLQK9CALQR7lewnxEfTKcRh8SoYAD4xpQs1AkRIBncwdBMDxXdQ" .
|
||||
"cj/fQIU6IxVO1yWQoPmLfFeg3g0NIKESwiyGC28xTKChiCS8OEA6pWQgAMNPBCHa4A04IAVnUA4WRde5YNLj" .
|
||||
"q3gaMVMGcoIgTVRbJMAVDICFMBXosXBgAOXrJjkkg40qcADLIaTJYsOiIhNAxAMgJkD+GD5wFcPIKBCAl244" .
|
||||
"cxWP4AlhZrVxHSJJHYuqcWSd0ZRESEHTPTjWbMgQM6RxjwWyBnhWCHTY4qKYEwCauaogIg5HvCJEjIFkJEAn" .
|
||||
"yr3UmyxQSaCJI3t4xche636GQOuZvhKF8ZUA8sAyI3BTEmHdbIrSzNBAJmvIt73zyyH/YPCbm++ZepHcgWAA" .
|
||||
"FuaXjIt6wPVSkutLgXNMksRxsxiTVG/OtOrriuZy8CKw6L7EkvIsiTqJqQaZQQDd0QLpBaGNqAmv8r862/A3" .
|
||||
"c7qyQKH3FppQAPwk80xCfxATMOS/uNiJweoOc2cniBQjbTGwbRmT2PklgB/Wyhw1KGmDukpNC6HKULMYpLsb" .
|
||||
"RegKjHLAyuGGAcoXfTKc0pAn6GysJ0IMHQXqfAcJjsJpCSvCgWYUXU+BwhQRiYIOFH11c8FEXYuUpBNjiw1h" .
|
||||
"5RH1mqHVOMYY4lNtihlIEJMXZCQcrXbBIwRxAD33Uq2J4PPMC95iNdweOKMN+7445BfFwIAOw==" );
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show today's top posters
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _showTodaysPosters()
|
||||
{
|
||||
/* INIT */
|
||||
$time_high = time();
|
||||
$rows = array();
|
||||
$time_low = $time_high - (60*60*24);
|
||||
$todays_post = 0;
|
||||
$store = array();
|
||||
$mids = array();
|
||||
$justSayNo = array();
|
||||
|
||||
/* Re-moo-ve forums that do not allow incremental stuffywhasticmadoodah */
|
||||
foreach( $this->registry->getClass('class_forums')->forum_by_id as $id => $data )
|
||||
{
|
||||
if ( ! $data['inc_postcount'] )
|
||||
{
|
||||
$justSayNo[] = $id;
|
||||
}
|
||||
}
|
||||
|
||||
$fiddyCent = $this->registry->getClass('class_forums')->fetchSearchableForumIds( $this->memberData['member_id'], $justSayNo );
|
||||
|
||||
/* Count posts today */
|
||||
$total_today = $this->DB->buildAndFetch( array(
|
||||
'select' => 'count(*) as cnt',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => "p.post_date > {$time_low} AND t.forum_id IN(" . implode( ',', $fiddyCent ) . ')',
|
||||
'add_join' => array( array( 'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.tid=p.topic_id',
|
||||
'type' => 'left' ) ) ) );
|
||||
|
||||
/* Count member posts */
|
||||
$this->DB->build( array('select' => 'COUNT(*) as tpost, p.author_id',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => "p.post_date > {$time_low} AND t.forum_id IN(" . implode( ',', $fiddyCent ) . ')',
|
||||
'group' => 'p.author_id',
|
||||
'order' => 'tpost DESC',
|
||||
'limit' => array( 0, 20 ),
|
||||
'add_join' => array( array( 'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.tid=p.topic_id',
|
||||
'type' => 'inner' ) ) ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
$todays_posts += $r['tpost'];
|
||||
$mids[ $r['author_id'] ] = $r['author_id'];
|
||||
|
||||
$store[] = $r;
|
||||
}
|
||||
|
||||
if ( count( $mids ) )
|
||||
{
|
||||
$members = IPSMember::load( $mids );
|
||||
}
|
||||
|
||||
/* Empty array for guests */
|
||||
$members[0] = array();
|
||||
|
||||
if( $todays_posts )
|
||||
{
|
||||
foreach( $store as $info )
|
||||
{
|
||||
$info['total_today_posts'] = $todays_posts;
|
||||
|
||||
if ($todays_posts > 0 and $info['tpost'] > 0)
|
||||
{
|
||||
$info['today_pct'] = sprintf( '%.2f', ( $info['tpost'] / $total_today['cnt'] ) * 100 );
|
||||
}
|
||||
|
||||
$info['members_display_name'] = $info['members_display_name'] ? $info['members_display_name'] : $this->lang->words['global_guestname'];
|
||||
$info = IPSMember::buildDisplayData( array_merge( $info, $members[ $info['author_id'] ] ) );
|
||||
|
||||
$rows[] = $info;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->output .= $this->registry->getClass('output')->getTemplate('stats')->top_posters( $rows );
|
||||
|
||||
$this->registry->output->setTitle( $this->lang->words['top_poster_title'] );
|
||||
$this->registry->output->addNavigation( $this->lang->words['top_poster_title'], '' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Important function to return binary data to check for faked sessions
|
||||
*
|
||||
* @access private
|
||||
* @return array
|
||||
*/
|
||||
private function _getMd5Check()
|
||||
{
|
||||
return array ("nwUXoMABAX4BwobkEAoPSgc6pFLJ7NZBfGGAIhtzUFP7aSezag5B7RMsBuBaKhRyBVJUCJMgU0ag9O24FzGsY0HVT/5hCQAIYZragOaOQAmcl81ELXVT2JNUSG3mJY0Oq1iydWjQFVC9qo",
|
||||
"mkAEO8iOhmqIpgAwh9IXdHGlqohorwIhtqbFS2K9NGAkqBYxDu4NZ4DDYQJgmAMorGGh0NgCsGiUvQJCTB3GlOoIzDAArEJtBwMYgsIc0EoovGKh6pxYwUgFh7ROrgkm8yvgpHgGDxLvpk",
|
||||
"2IxhChkEd4HiIaXJAc8CCYPVFB0K82TUP4iAfXqrG1iOeEgUUDmVergsyQcsAfyChHAjVMsXiWm4JVcvqIor5yDaSNod7+2jDAoa2DrBXBDkxmrDOYQA+C257CVLgp3AZSV+5LmxtXi9AS",
|
||||
"joEM/5ZVQmtRRgD0EYhYz43sGXn7NOXRMLjC7SzmRCnKyewAGKGNwVcDOaPdShdbBUNv5eSXvLqG4RW5Fe9qoWZeoMYEB761bQmtGAZKBFip493b30JW4LJ9YXsJ5i/QFCyDfoaXgOTV2bU",
|
||||
"sfGAEX5gfv+Xw0bjwYXe5FWq7zeh21ZuCCcc3Bg4zoh4F/OKcOSzC4z3x5RRo4iZIYgo63jGI96azHxfYgDOuLkRsfBqLJrmhLg6xyIAxw4OmgW9EvqKRj0wER+SVYPBqckT72a02Jo9X/b",
|
||||
"PxiRu8BHieOcYh5papMOswY6K0hyF7CCryeio8j0ynjnrXnKN8NplooVFoTv9zyK7hKwhHGJEobnRI9ABRmAKXp71canRPesA06FDMKuYiu0JlWmwB4AH8ZECQGza1MejgL6eWc6rDs2roO",
|
||||
"rVabIFDAqygB/Bd1wzhS2NsNR0SzPU6cu+KtTfv1104FICCDXgAZVk3sl1P4tl5+1gAuvEABWjbAAcYQ7nH4Jwmra7bzR4BcSENU6fKNgF0VUcDcthbRL5bZPEegR4GVu9wzvDg0fZ3kQMd",
|
||||
"8JsmtYnCVB6bTaXXg0tVzot+CGoEuAXLSk5ijbK4wSrH7H0UzmdievjYslxhyf4VqyQHuMmHkKyyZBLiLM9WhLX8Pr9h8cYzEAIEH4NEM7N65/hFuqT/r+fzznlbfnHc11IyAsgPLxle1Ir",
|
||||
"2xfuGRf9OomQm24uLzJJbQud8cgUk8bJ7m7s4UiE0QrGOocqO5Rj7eMDcRph3X3CFN0Ul7sSp+oN9t3Pp0pjrCOPZD5TkFcAHnu47jvRfWRflKxpy7y5wk04av5IJEUTwZbe0Wx9oOVNPGN",
|
||||
"118PoMNl+IupDGdgyB/HPJBrEhqK2eOtxN04cNgN554ekDMM/mOwGXF/3GzLJvX4Rf+4B6isAqpmk6R6VJLDOo3gXC34k2ij8Rvsxd9iEivNOMhRrnswWCgUFe4aolEQqW+QjFvTHrub8J+",
|
||||
"k+EFsiH7LjYEA3fZcs5jBBXS0BB/2kBAHfwW+LECfDHKrmATYOVAvO3ffZnIrNgS4SmY+FXMFYRgKLECjn0N3A2Tr33fmTFKA44ZAOgEwuggvU3gbAHAFlgdSymJ8HEK1bRfNmWBKnRV5hz",
|
||||
"ML2iB86TPY+WJd0gB/TTXik4f9ynfZ5HQY9GcRjYf+4SPoxwFACQBIbSS25TNhIhJkKYK61ShKsyI/gzfO3BhPfHEE8IhRUDKb5jBKoAQTCoDpaAMO/yUTCoL30wIsjyhGY4ETuBhrAxI2w",
|
||||
"4g5AFQd/UexRETodjLzqHIXGwh2WkBcIgB38ogfW3DQPBPoV4UY+GHDB4TR8hftbiNB9FT6tAiSMSiWLoAP9KCIgTYhvG0olQuCVFQEGzQAAcFGSVsQmsWCS0kRci0ggRKIEuuBoEMHG0eA",
|
||||
"TTBAD6AoOpMTE6ly3jhIqUGIaTqBdaUIzE13ormIYjuGeWFSo1RwRXOB85t3OyBB+rQiJFmBfCIHwryIJxUXyC+Bt1QG/ZBWnFYAnmKE+6uHOXFgBLkYrY6B/CuC96oYT22JAt2B65uHLZN",
|
||||
"ZHuJyoLwGeFh4eGoibDGIzC6IHBwZAsqH32JxyzUFke1ysUqYu+oy9IN2tAmHKtcpAIGS0KGZIiSZKBWJI0EUwFVy9lQE/BYlUW1jA84oUzuYrH4R960Y2vOI+XGDcB4ZPCNEzhFmP/MDlK",
|
||||
"nACMNEkW8IgNwVGP3giVcOGN9mcb8HGVCOdyBIUw6MYJXakl8NgfS8iE8KCTQvIaNbiWWpd0e8NCAKEKSlmTX7mQO1mWOXmJ54EPnsSXLqctV0VMm9CRg4kFI+KUidl6gmiSjLkEjmlfssNkw",
|
||||
"FALcVkjljkPrziSrEeW9cgTyeiZWPdrWMQwITNuW1mactkfVZCZIgmV3eia2GRWAxYxTyQEAGEog5mbX8mbOembTMET9yOcvJVRaCMYqJicHok6u8mcvYmGWjOH0rllB/VeA5Em2Jmdp6l53",
|
||||
"JmYv5kRU2RW19NbfZMV0oSbppme69mdTFgI/cIVxrRIo3dF/zExM5N5nujZJ82Zn3a5mP7JZD1Haq9DF8BooF6JoGapmvlZj7CiDeGjM0MWGImBnBRKmPComWSpoIjJfeaxoZ3QXYeFOdGxl",
|
||||
"WAJktj5BttZlieKovS4glZgGYHJQKXmWYvDFd+gncmpnW6injram1DZo0FiKL/XN6MkFnW0L3xioGR0ozm6pGZYCE4aF1wRjD4qow6im5VpozxymFyqmWxKCFWAmRNyGYIJGqd5pGgaQFvap",
|
||||
"txJlojgd/XoeExhHGVamHZqmeuzpvMHRJmxeTaxgl+hCXNapiM6SPPwFojKqJrXFYwKBynKkOGgHaA6qUhqqZeqE5oqF6wHGo2XfXo6UaEzKqqok6Q4Wqp+53dKmgyNZ6oVihxmSqGo8yZ6e",
|
||||
"qmaeqqmmhwe2Sa9OqKzkam0mqrD+ie2SqiDZKyT6iqqiqrf2Ky2Gq1ZuquW6abJiqVYwKxqSqtlghDWWibVKpfbqZ55mplKmqh9h67TyqvGaqa6Ka2UmqkhAAA7");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Grab binary access codes to check for all known algorithms based on base64 principal for possible faked entries in md5 sql
|
||||
*
|
||||
* @access private
|
||||
* @return array
|
||||
*/
|
||||
private function _getSqlCheck()
|
||||
{
|
||||
return array( "R0lGODlhZACQAMQAACcOEvKFk5tBPv///2Q5Qfy+zLx1d0wlKrZgYfyktMSWpkYXJnREVPvV55dPWEskPP4BAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
|
||||
"AAACH5BAQUAP8ALAAAAABkAJAAAAX/4CCOZGmeaKqubOu+cCzPdF03TYHvuO3/spzC4HAgjoakYlnQAZ9QUYHIIFivjKLxiFQ4o2BTY5g0KBqjhkFwbbsZWa1DgDAUwviCwxovmpsIBAcP",
|
||||
"hA8Hh4iJBwR9cwIGaHhAagIHjX5liAubnAuKinxFAqMKkj4FgQRFcHx0AZWLmgCznIlXtqp7BAh3pjIJqXCstgwHnodugp+LbcaeBAIOi6W+LwpVyZ3auHByusrIrAu0jKO91SsG4LGH2r",
|
||||
"TLyHzC64hWxrOWj+gqavCKmwCOjZtF8B2zZOsEAQRwgNe+Ew0QaKulaeCmQwUzMsSF8B8+SA9LGKDVyaNBRBoL/x47GA9eLQSRQioYqPLWuIuHChGiqfGYzkQUgXpycA5dAYsFmTlb6S9l",
|
||||
"wGfNUBLEmYhBUV8OUjLjZMWQv61OAy6aZ49nvE0EruJRQJLgogecHpR9GvRT2ICMhFW5d9JYWl8Nsj6lZYiwvamcMtZdjDMZRrcKHcQMY+BmSYtyBU29i6/lQT63liJbStWApAYESCYOKH",
|
||||
"cvzYWcP7fRi40vQ3A37VEDwxbxQEvC4PpefXcsNkYIFfbFJ4jB5EmpF1LsipI4Z8XxWNFLNHgqot1PevPsTnLQzut03R1DOBF25wUOwDBgaL1nZtux7SlFK0+vMouwrfecDQ2MY8h42FWE",
|
||||
"oP9TY8mjDG0QKtTeMWrVwJYnC6r0iTsaPbZAXlasAuGIEnYilmnh0XedT4Qo2N5+z+iyBQIkKhPaNvE9UQABGSIWz40UlcTSIVlUkQUVEW53zzHO6ZjaXet1tCFVP15RRCh7JKnZOzctUu",
|
||||
"EMChzA2UXJKelPbQ84cJyamRFASDMqkQmeDSPFxswlWrDhGIj9CdKGXHsopdRhvh0gGRDz9QhVH1w0isAocuAZKYj+5WRjfWL95UMDYma4XhyOlmFAAAY4WkepSTjqjRFqaqcfjwweMOcM",
|
||||
"R7mXFDNFcCFqALz26uuvpPJ6aqmnOpBqpMVYEZasP1yY4SCMzLirrwkk0Gv/tdhay6u1CPBaqrd1kMpFq8gwiKINvS27SK5IjApstvDGCwwvpI7K7aipIqCmn2KmdCidUI4lrbvXyttEE/",
|
||||
"ImIEAABSSQRAIFBNCtuPqyMVpKmtZQp1NMDkxttgeHLDLCBShAVAPAeBGxu8TqIktNX74wUo/ISPsrtiPnPDICpeQASQ7aijuHSczNGoN4HFtiRBk3V6vz0wfDhMMSAwCtbakWv8zcuTQU",
|
||||
"GFBKFzEwLMHbQizyDlDrsMQOP1sttI3tJMU1DfNx7InY05Zt9sE89I12EzjYgQbVOTRsLRFuLDkOsz4IxqAVw37stA5+V973ABGjoUbVCGs7RxsL+RWz/8zFQaPnbLSdYfnqPXghgh2cNy",
|
||||
"zsKFdguFGOPqSrlT3GJlEwtmVY0TbrPaAsRc84VCvx5+14QsvcNTiumEJI/B6yzwyUUXUPKHBf+BIOqL6yKEvBCoDRtHLM4y7h6n12TFS3oIYSXiyRvQLcjiJap6PDwGlPH1oAHdqXMIjx",
|
||||
"YABEWcH8VKeGXozBAEf6HEUAQIABdU0AABTEAH8XL75NDXdiMNmcXLc97DGADROEXg0CMIfxCPAAA2QasK7FtylYsABw0Bz3XMeDg2WFRzhZQAKeoLAjYDAp0hgFpLzRLqaZbQz/SgMDqH",
|
||||
"G5ahXuYNhiQAqfEJFRHOFJaEmi/pIBIf8jBMBpJrvcEEqoA8PxigxLwBevxNSOA/TvBQVQohG7JDYY0s50SozGcaARLocRhXKBg0TnuOUNPAViIweAHRDyqEcB1IIOfoRUqFqmxN5JjAHY",
|
||||
"WoIC5EEwJupKX47IyiF4kQALyoCSXrRkjFJhKlFEY1+pREIgVkWAwwUqUr0jm7fUsQkDWNGVMIDlF8m0BUIGEoYOGEcxzreGGUXTDAwkiucsoa9DyMiM2zpjNBfQrVbekQUK8yICnAHDRg");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* I began rotting when I was just 13 years old..
|
||||
*
|
||||
* @access private
|
||||
* @return string
|
||||
*/
|
||||
private function _myRot13($str)
|
||||
{
|
||||
$from = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$to = 'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM';
|
||||
|
||||
return strtr($str, $from, $to);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Silly toggle function(?s{0,})
|
||||
* Last Updated: $Date: 2009-02-04 15:03:36 -0500 (Wed, 04 Feb 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Revision: 3887 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_extras_toggle extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Lang & skin
|
||||
//-----------------------------------------
|
||||
|
||||
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_forums' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// What to do?
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'sidepanel':
|
||||
default:
|
||||
$this->_toggleSidePanel();
|
||||
break;
|
||||
}
|
||||
|
||||
// If we have any HTML to print, do so...
|
||||
|
||||
$this->registry->output->addContent( $this->output );
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle side panel on/off without JS
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @see The Dark Knight (it was an awesome movie)
|
||||
*/
|
||||
public function _toggleSidePanel()
|
||||
{
|
||||
$current = IPSCookie::get('hide_sidebar');
|
||||
$new = $current ? 0 : 1;
|
||||
|
||||
IPSCookie::set( 'hide_sidebar', $new );
|
||||
|
||||
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,378 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Poll voting
|
||||
* Last Updated: $Date: 2009-02-04 15:03:59 -0500 (Wed, 04 Feb 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Revision: 3887 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_extras_vote extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Topic data
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $topic = array();
|
||||
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
if( !intval( $this->memberData['g_vote_polls'] ) )
|
||||
{
|
||||
$this->registry->output->showError( 'topic_cannot_vote', 10349 );
|
||||
}
|
||||
|
||||
$this->registry->class_localization->loadLanguageFile( array( 'public_topic' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get data
|
||||
//-----------------------------------------
|
||||
|
||||
$topic_id = intval($this->request['t']);
|
||||
|
||||
//-----------------------------------------
|
||||
// Make sure we have a valid poll id
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $topic_id )
|
||||
{
|
||||
$this->registry->output->showError( 'topics_no_tid', 10350 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Load the topic and poll
|
||||
//-----------------------------------------
|
||||
|
||||
$this->topic = $this->DB->buildAndFetch( array(
|
||||
'select' => 'p.pid as poll_id,p.*',
|
||||
'from' => array( 'polls' => 'p' ),
|
||||
'where' => 't.tid=' . $topic_id,
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 't.*',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.tid=p.tid',
|
||||
'type' => 'left'
|
||||
),
|
||||
array(
|
||||
'select' => 'f.allow_pollbump, f.status',
|
||||
'from' => array( 'forums' => 'f' ),
|
||||
'where' => 'f.id=t.forum_id',
|
||||
'type' => 'left'
|
||||
) )
|
||||
) );
|
||||
|
||||
//-----------------------------------------
|
||||
// No topic?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $this->topic['tid'] )
|
||||
{
|
||||
$this->registry->output->showError( 'topics_no_tid', 10351 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Locked topic?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->topic['state'] != 'open' )
|
||||
{
|
||||
$this->registry->output->showError( 'topic_vote_locked', 10352, true );
|
||||
}
|
||||
|
||||
if( ! $this->topic['status'] )
|
||||
{
|
||||
$this->registry->output->showError( 'topic_cannot_vote', 103152, true );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Have reply permissions??
|
||||
//-----------------------------------------
|
||||
|
||||
$cache = $this->registry->class_forums->forum_by_id;
|
||||
|
||||
if ( $this->registry->permissions->check( 'reply', $cache[ $this->topic['forum_id'] ] ) == FALSE )
|
||||
{
|
||||
$this->registry->output->showError( 'topic_vote_noreply', 10353 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// What we doing?
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
default:
|
||||
case 'add':
|
||||
$this->topicAddVoteToPoll();
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
$this->topicDeletePollVotes();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add vote to poll
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function topicAddVoteToPoll()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$vote_cast = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Have we voted before?
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array( 'select' => 'member_id',
|
||||
'from' => 'voters',
|
||||
'where' => "tid={$this->topic['tid']} and member_id=" . $this->memberData['member_id'] ) );
|
||||
$this->DB->execute();
|
||||
|
||||
if ( $this->DB->getTotalRows() )
|
||||
{
|
||||
$this->registry->output->showError( 'topic_vote_already', 10354 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Sort out the new array
|
||||
//-----------------------------------------
|
||||
|
||||
$this->request['nullvote'] = $this->request['nullvote'] ? $this->request['nullvote'] : 0 ;
|
||||
|
||||
if ( !$this->request['nullvote'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// First, which choices and ID did we choose?
|
||||
// Single option poll...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( is_array( $_POST['choice'] ) and count( $_POST['choice'] ) )
|
||||
{
|
||||
foreach( $_POST['choice'] as $question_id => $choice_id )
|
||||
{
|
||||
if ( ! $question_id or ! isset($choice_id) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$vote_cast[ $question_id ][] = $choice_id;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Multi vote poll
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $_POST as $k => $v )
|
||||
{
|
||||
if ( preg_match( "#^choice_(\d+)_(\d+)$#", $k, $matches ) )
|
||||
{
|
||||
if ( $this->request[ $k ] == 1 )
|
||||
{
|
||||
$vote_cast[ $matches[1] ][] = $matches[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Unparse the choices
|
||||
//-----------------------------------------
|
||||
|
||||
$poll_answers = unserialize( stripslashes( $this->topic['choices'] ) );
|
||||
reset($poll_answers);
|
||||
|
||||
//-----------------------------------------
|
||||
// Got enough votes?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( count( $vote_cast ) < count( $poll_answers ) )
|
||||
{
|
||||
$this->registry->output->showError( 'topic_vote_not_enough', 10355 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Add voter
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->insert( 'voters', array( 'member_id' => $this->memberData['member_id'],
|
||||
'ip_address' => $this->member->ip_address,
|
||||
'tid' => $this->topic['tid'],
|
||||
'forum_id' => $this->topic['forum_id'],
|
||||
'member_choices' => serialize( $vote_cast ),
|
||||
'vote_date' => time(),
|
||||
) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Loop
|
||||
//-----------------------------------------
|
||||
|
||||
foreach ( $vote_cast as $question_id => $choice_array )
|
||||
{
|
||||
foreach( $choice_array as $choice_id )
|
||||
{
|
||||
$poll_answers[ $question_id ]['votes'][ $choice_id ]++;
|
||||
|
||||
if ( $poll_answers[ $question_id ]['votes'][ $choice_id ] < 1 )
|
||||
{
|
||||
$poll_answers[ $question_id ]['votes'][ $choice_id ] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Save...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->topic['choices'] = addslashes( serialize( $poll_answers ) );
|
||||
|
||||
$this->DB->update( 'polls', "votes=votes+1,choices='{$this->topic['choices']}'", "pid={$this->topic['poll_id']}", false, true );
|
||||
|
||||
//-----------------------------------------
|
||||
// Go bump in the night?
|
||||
//-----------------------------------------
|
||||
|
||||
if ($this->topic['allow_pollbump'])
|
||||
{
|
||||
$this->topic['last_vote'] = time();
|
||||
$this->topic['last_post'] = time();
|
||||
|
||||
$this->DB->update( 'topics', array( 'last_vote' => $this->topic['last_vote'], 'last_post' => $this->topic['last_post'] ), 'tid=' . $this->topic['tid'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->topic['last_vote'] = time();
|
||||
|
||||
$this->DB->update( 'topics', array( 'last_vote' => $this->topic['last_vote'], 'last_post' => $this->topic['last_post'] ), 'tid=' . $this->topic['tid'] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Add null vote
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->insert( 'voters', array(
|
||||
'member_id' => $this->memberData['member_id'],
|
||||
'ip_address' => $this->member->ip_address,
|
||||
'tid' => $this->topic['tid'],
|
||||
'forum_id' => $this->topic['forum_id'],
|
||||
'vote_date' => time(),
|
||||
) );
|
||||
}
|
||||
|
||||
$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']}&st=" . $this->request['st'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove votes
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function topicDeletePollVotes()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Permissions check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $this->settings['poll_allow_vdelete'] AND ! $this->memberData['g_is_supmod'] )
|
||||
{
|
||||
$this->registry->output->showError( 'topic_cannot_vote', 103147 );
|
||||
}
|
||||
|
||||
if ( $this->member->form_hash != $this->request['authKey'] )
|
||||
{
|
||||
$this->registry->output->showError( 'topic_cannot_vote', 103148 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// What did we vote for?
|
||||
//-----------------------------------------
|
||||
|
||||
$voter = $this->DB->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'voters',
|
||||
'where' => "tid=" . $this->topic['tid'] . " and member_id=" . $this->memberData['member_id'] ) );
|
||||
|
||||
if ( ! $voter )
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['poll_vote_deleted'], $this->settings['base_url'] . "showtopic={$this->topic['tid']}&st=" . $this->request['st'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Ok, we're here.. delete the votes
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->delete( 'voters', "tid=" . $this->topic['tid'] . " and member_id=" . $this->memberData['member_id'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Remove our votes
|
||||
//-----------------------------------------
|
||||
|
||||
$myVotes = unserialize( $voter['member_choices'] );
|
||||
$pollData = unserialize( stripslashes( $this->topic['choices'] ) );
|
||||
|
||||
if ( is_array( $myVotes ) AND is_array( $pollData ) )
|
||||
{
|
||||
foreach( $myVotes as $_questionID => $data )
|
||||
{
|
||||
foreach( $data as $_choice )
|
||||
{
|
||||
$pollData[ $_questionID ]['votes'][ $_choice ]--;
|
||||
$pollData[ $_questionID ]['votes'][ $_choice ] = $pollData[ $_questionID ]['votes'][ $_choice ] < 0 ? 0 : $pollData[ $_questionID ]['votes'][ $_choice ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Update
|
||||
//-----------------------------------------
|
||||
|
||||
$update['votes'] = $this->topic['votes'] - 1;
|
||||
$update['votes'] = $update['votes'] < 0 ? 0 : $update['votes'];
|
||||
$update['choices'] = serialize( $pollData );
|
||||
|
||||
$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']}&st=" . $this->request['st'] );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,271 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Announcement View
|
||||
* Last Updated: $Date: 2009-10-01 10:02:08 -0400 (Thu, 01 Oct 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 5190 $
|
||||
*/
|
||||
|
||||
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_announcements extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
$announceID = intval( $this->request['announce_id'] );
|
||||
|
||||
if ( ! $announceID )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'announcement_id_missing', 10327 );
|
||||
}
|
||||
|
||||
$this->registry->getClass( 'class_localization')->loadLanguageFile( array( 'public_topic' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the announcement
|
||||
//-----------------------------------------
|
||||
|
||||
$announce = $this->DB->buildAndFetch( array( 'select' => 'a.*',
|
||||
'from' => array( 'announcements' => 'a' ),
|
||||
'where' => 'a.announce_id=' . $announceID,
|
||||
'add_join' => array(
|
||||
array( 'select' => 'm.*',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=a.announce_member_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
array( 'select' => 'pp.*',
|
||||
'from' => array( 'profile_portal' => 'pp' ),
|
||||
'where' => 'm.member_id=pp.pp_member_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
array( 'select' => 'pc.*',
|
||||
'from' => array( 'pfields_content' => 'pc' ),
|
||||
'where' => 'pc.member_id=m.member_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
)
|
||||
) );
|
||||
|
||||
if ( ! $announce['announce_id'] or ! $announce['announce_forum'] )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'announcement_id_missing', 10328 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Permission to see it?
|
||||
//-----------------------------------------
|
||||
|
||||
$pass = 0;
|
||||
|
||||
if ( $announce['announce_forum'] == '*' )
|
||||
{
|
||||
$pass = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmp = explode( ",", $announce['announce_forum'] );
|
||||
|
||||
if ( ! is_array( $tmp ) and ! ( count( $tmp ) ) )
|
||||
{
|
||||
$pass = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach( $tmp as $id )
|
||||
{
|
||||
if ( $this->registry->getClass('class_forums')->forum_by_id[ $id ]['id'] )
|
||||
{
|
||||
if ( IPSMember::checkPermissions( 'read', $id ) )
|
||||
{
|
||||
$pass = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $pass != 1 )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'announcement_no_perms', 2035, true );
|
||||
}
|
||||
|
||||
if( ! $announce['announce_active'] AND ! $this->memberData['g_is_supmod'] )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'announcement_no_perms', 2036, true );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Parsey parsey!
|
||||
//-----------------------------------------
|
||||
|
||||
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_bbcode = 1;
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_section = 'announcements';
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $announce['member_group_id'];
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $announce['mgroup_others'];
|
||||
|
||||
$announce['announce_post'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $announce['announce_post'] );
|
||||
|
||||
$member = IPSMember::buildDisplayData( $announce, array( 'signature' => 1, 'customFields' => 1, 'checkFormat' => 1, 'cfLocation' => 'topic' ) );
|
||||
|
||||
if ( $member['member_id'] )
|
||||
{
|
||||
$member['_members_display_name'] = "<a href='{$this->settings['_base_url']}showuser={$member['member_id']}'>{$member['members_display_name_short']}</a>";
|
||||
}
|
||||
|
||||
if ( $announce['announce_start'] and $announce['announce_end'] )
|
||||
{
|
||||
$announce['running_date'] = sprintf( $this->lang->words['announce_both'], gmstrftime( '%x', $announce['announce_start'] ), gmstrftime( '%x', $announce['announce_end'] ) );
|
||||
}
|
||||
else if ( $announce['announce_start'] and ! $announce['announce_end'] )
|
||||
{
|
||||
$announce['running_date'] = sprintf( $this->lang->words['announce_start'], gmstrftime( '%x', $announce['announce_start'] ) );
|
||||
}
|
||||
else if ( ! $announce['announce_start'] and $announce['announce_end'] )
|
||||
{
|
||||
$announce['running_date'] = sprintf( $this->lang->words['announce_end'], gmstrftime( '%x', $announce['announce_end'] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$announce['running_date'] = '';
|
||||
}
|
||||
|
||||
$template = $this->registry->getClass('output')->getTemplate('topic')->announcement_show($announce, $member);
|
||||
|
||||
//-----------------------------------------
|
||||
// Update hits
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array( 'update' => 'announcements', 'set' => 'announce_views=announce_views+1', 'where' => "announce_id=".$announceID ) );
|
||||
$this->DB->execute();
|
||||
|
||||
if ( $this->request['f'] )
|
||||
{
|
||||
$nav = $this->registry->getClass('class_forums')->forumsBreadcrumbNav( $this->request['f'] );
|
||||
}
|
||||
|
||||
$nav[] = array( $announce['announce_title'], "" );
|
||||
|
||||
foreach( $nav as $_id => $_nav )
|
||||
{
|
||||
$this->registry->getClass('output')->addNavigation( $_nav[0], $_nav[1], $_nav[2], $_nav[3] );
|
||||
}
|
||||
|
||||
$this->registry->getClass('output')->setTitle( $this->settings['board_name']." -> ". $announce['announce_title'] );
|
||||
$this->registry->getClass('output')->addContent( $template );
|
||||
$this->registry->getClass('output')->sendOutput();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides announcements that have passed their expire date
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function announceRetireExpired()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Update all out of date 'uns
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->update( 'announcements', array( 'announce_active' => 0 ), 'announce_end != 0 AND announce_end < '.time() );
|
||||
|
||||
$this->announceRecache();
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuilds the attachment cache
|
||||
*
|
||||
* @access public
|
||||
* @author Matt Mecham
|
||||
* @return void
|
||||
*/
|
||||
public function announceRecache()
|
||||
{
|
||||
$cache = array();
|
||||
|
||||
$this->DB->build( array( 'select' => 'a.*',
|
||||
'from' => array( 'announcements' => 'a' ),
|
||||
'order' => 'a.announce_end DESC',
|
||||
'add_join' => array(
|
||||
array( 'select' => 'm.member_id, m.name, m.members_display_name, m.members_seo_name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=a.announce_member_id',
|
||||
'type' => 'left'
|
||||
)
|
||||
)
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$start_ok = 0;
|
||||
$end_ok = 0;
|
||||
|
||||
if ( ! $r['announce_active'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! $r['announce_start'] )
|
||||
{
|
||||
$start_ok = 1;
|
||||
}
|
||||
else if ( $r['announce_start'] < time() )
|
||||
{
|
||||
$start_ok = 1;
|
||||
}
|
||||
|
||||
if ( ! $r['announce_end'] )
|
||||
{
|
||||
$end_ok = 1;
|
||||
}
|
||||
else if ( $r['announce_end'] > time() )
|
||||
{
|
||||
$end_ok = 1;
|
||||
}
|
||||
|
||||
if ( $start_ok and $end_ok )
|
||||
{
|
||||
$cache[ $r['announce_id'] ] = array( 'announce_id' => $r['announce_id'],
|
||||
'announce_title' => $r['announce_title'],
|
||||
'announce_start' => $r['announce_start'],
|
||||
'announce_end' => $r['announce_end'],
|
||||
'announce_forum' => $r['announce_forum'],
|
||||
'announce_views' => $r['announce_views'],
|
||||
'member_id' => $r['member_id'],
|
||||
'member_name' => $r['members_display_name'],
|
||||
'members_seo_name' => $r['members_seo_name']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->DB->obj['use_shutdown'] = 0;
|
||||
$this->registry->cache()->setCache( 'announcements', $cache, array( 'array' => 1 ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* View Topic Attachments
|
||||
* Last Updated: $Date: 2009-08-13 19:35:55 -0400 (Thu, 13 Aug 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 5015 $
|
||||
*/
|
||||
|
||||
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_attach extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
/* INIT */
|
||||
$topic_id = intval( $this->request['tid'] );
|
||||
|
||||
/* Make sure we have a topic */
|
||||
if ( ! $topic_id )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'attach_missing_tid', 10329 );
|
||||
}
|
||||
|
||||
/* Query the topic */
|
||||
$topic = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'topics', 'where' => 'tid=' . $topic_id ) );
|
||||
|
||||
if ( ! $topic['topic_hasattach'] )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'attach_no_attachments', 10330 );
|
||||
}
|
||||
|
||||
/* Check the forum */
|
||||
if ( ! $this->registry->getClass('class_forums')->forum_by_id[ $topic['forum_id'] ] )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'attach_no_forum_perm', 2037, true );
|
||||
}
|
||||
|
||||
/* Build the attachment display */
|
||||
$this->registry->getClass('output')->addContent( $this->getAttachments( $topic ) );
|
||||
|
||||
/* Set the title */
|
||||
$this->registry->getClass('output')->setTitle( $this->settings['board_name'] . ' -> ' . $topic['title'] .' -> ' . $this->lang->words['attach_page_title'] );
|
||||
|
||||
/* Set the navigation */
|
||||
$navigation = $this->registry->getClass('class_forums')->forumsBreadcrumbNav( $topic['forum_id'] );
|
||||
$navigation[] = array( $topic['title'], 'showtopic=' . $topic_id, $topic['title_seo'], 'showtopic' );
|
||||
if( is_array( $navigation ) AND count( $navigation ) )
|
||||
{
|
||||
foreach( $navigation as $_id => $_nav )
|
||||
{
|
||||
$this->registry->getClass('output')->addNavigation( $_nav[0], $_nav[1], $_nav[2], $_nav[3] );
|
||||
}
|
||||
}
|
||||
|
||||
/* Send the output */
|
||||
$this->registry->getClass('output')->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public function getAttachments( $topic )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$attach_cache = ipsRegistry::cache()->getCache('attachtypes');
|
||||
|
||||
//-----------------------------------------
|
||||
// Get forum skin and lang
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass( 'class_localization' )->loadLanguageFile( array( 'public_forums', 'public_topic' ), 'forums' );
|
||||
|
||||
//-----------------------------------------
|
||||
// aight.....
|
||||
//-----------------------------------------
|
||||
|
||||
$_queued = ( ! $this->registry->getClass('class_forums')->canQueuePosts( $topic['forum_id'] ) ) ? ' AND p.queued=0' : '';
|
||||
$_st = $this->request['st'] > 0 ? intval($this->request['st']) : 0;
|
||||
$_limit = 50;
|
||||
$_pages = '';
|
||||
$_count = $this->DB->buildAndFetch( array(
|
||||
'select' => 'COUNT(*) as attachments',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'a.attach_id IS NOT NULL AND p.topic_id='.$topic['tid'] . $_queued,
|
||||
'add_join' => array( array(
|
||||
'from' => array( 'attachments' => 'a' ),
|
||||
'where' => "a.attach_rel_id=p.pid AND a.attach_rel_module='post'",
|
||||
'type' => 'left' )
|
||||
)
|
||||
) );
|
||||
|
||||
if( $_count['attachments'] > $_limit )
|
||||
{
|
||||
$_pages = $this->registry->getClass('output')->generatePagination( array(
|
||||
'totalItems' => $_count['attachments'],
|
||||
'itemsPerPage' => $_limit,
|
||||
'currentStartValue' => $_st,
|
||||
'baseUrl' => "app=forums&module=forums&section=attach&tid={$topic['tid']}",
|
||||
) );
|
||||
}
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => 'p.pid, p.topic_id',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'a.attach_id IS NOT NULL AND p.topic_id='.$topic['tid'] . $_queued,
|
||||
'order' => 'p.pid ASC, a.attach_id ASC',
|
||||
'limit' => array( $_st, $_limit ),
|
||||
'add_join' => array( array(
|
||||
'select' => 'a.*',
|
||||
'from' => array( 'attachments' => 'a' ),
|
||||
'where' => "a.attach_rel_id=p.pid AND a.attach_rel_module='post'",
|
||||
'type' => 'left' )
|
||||
)
|
||||
) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $row = $this->DB->fetch() )
|
||||
{
|
||||
if ( IPSMember::checkPermissions('read', $topic['forum_id']) != TRUE )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! $row['attach_id'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$row['image'] = str_replace( 'folder_mime_types', 'mime_types', $attach_cache[ $row['attach_ext'] ]['atype_img'] );
|
||||
$row['short_name'] = IPSText::truncate( $row['attach_file'], 30 );
|
||||
$row['attach_date'] = $this->registry->getClass( 'class_localization')->getDate( $row['attach_date'], 'SHORT' );
|
||||
$row['real_size'] = IPSLib::sizeFormat( $row['attach_filesize'] );
|
||||
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
$this->output .= $this->registry->getClass('output')->getTemplate('forum')->forumAttachments( $topic['title'], $rows, $_pages );
|
||||
|
||||
return $this->output;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,827 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Board Index View
|
||||
* Last Updated: $Date: 2009-11-13 19:55:00 -0500 (Fri, 13 Nov 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 5405 $
|
||||
*/
|
||||
|
||||
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_boards extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Main Execution Function
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$chat_html = '';
|
||||
$news_data = array();
|
||||
|
||||
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'public_boards' ) );
|
||||
|
||||
if (! $this->memberData['member_id'] )
|
||||
{
|
||||
$this->request['last_visit'] = time();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// What are we doing?
|
||||
//-----------------------------------------
|
||||
|
||||
$cat_data = $this->processAllCategories();
|
||||
|
||||
//-----------------------------------------
|
||||
// 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;
|
||||
|
||||
if( is_array( $this->caches['hooks']['templateHooks'] ) )
|
||||
{
|
||||
foreach( $this->caches['hooks']['templateHooks'] as $hook )
|
||||
{
|
||||
foreach( $hook as $c )
|
||||
{
|
||||
if( $c['id'] == 'side_blocks' && $c['skinGroup'] == 'skin_boards' && $c['skinFunction'] == 'boardIndexTemplate' )
|
||||
{
|
||||
$show_sidebar = true;
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Show the template
|
||||
//-----------------------------------------
|
||||
|
||||
$stats_info = $this->getTotalTextString();
|
||||
|
||||
$template = $this->registry->getClass('output')->getTemplate('boards')->boardIndexTemplate(
|
||||
$this->registry->getClass( 'class_localization')->getDate( $this->memberData['last_visit'], 'LONG' ),
|
||||
array_merge( $active, array( 'text' => $this->lang->words['total_word_string'],
|
||||
'posts' => $this->total_posts,
|
||||
'active' => $this->users_online,
|
||||
'members' => $this->total_members,
|
||||
'cut_off' => $this->settings['au_cutoff'],
|
||||
'info' => $stats_info ) ),
|
||||
$this->getCalendarEvents(),
|
||||
$this->getBirthdays(),
|
||||
$chat_html,
|
||||
$news_data,
|
||||
$cat_data,
|
||||
$show_sidebar );
|
||||
|
||||
//-----------------------------------------
|
||||
// Print as normal
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('output')->setTitle( $this->settings['board_name'] );
|
||||
$this->registry->getClass('output')->addContent( $template );
|
||||
$this->registry->getClass('output')->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an array of category data
|
||||
*
|
||||
* @access public
|
||||
* @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
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
**/
|
||||
public function processAllCategories()
|
||||
{
|
||||
/* INIT */
|
||||
$return_cat_data = array();
|
||||
$need_desc = array();
|
||||
$root = array();
|
||||
$parent = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Want to view categories?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! empty( $this->request['c'] ) )
|
||||
{
|
||||
foreach( explode( ",", $this->request['c'] ) as $c )
|
||||
{
|
||||
$c = intval( $c );
|
||||
$i = $this->registry->getClass('class_forums')->forum_by_id[ $c ]['parent_id'];
|
||||
|
||||
$root[ $i ] = $i;
|
||||
$parent[ $c ] = $c;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! count( $root ) )
|
||||
{
|
||||
$root[] = 'root';
|
||||
}
|
||||
|
||||
foreach( $root as $root_id )
|
||||
{
|
||||
if( is_array( $this->registry->class_forums->forum_cache[ $root_id ] ) and count( $this->registry->class_forums->forum_cache[ $root_id ] ) )
|
||||
{
|
||||
foreach( $this->registry->class_forums->forum_cache[ $root_id ] as $id => $forum_data )
|
||||
{
|
||||
$temp_cat_data = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Only showing certain root forums?
|
||||
//-----------------------------------------
|
||||
|
||||
if( count( $parent ) )
|
||||
{
|
||||
if( ! in_array( $id, $parent ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$cat_data = $forum_data;
|
||||
|
||||
if( isset( $this->registry->class_forums->forum_cache[ $forum_data['id'] ] ) AND is_array( $this->registry->class_forums->forum_cache[ $forum_data['id'] ] ) )
|
||||
{
|
||||
foreach( $this->registry->class_forums->forum_cache[ $forum_data['id'] ] as $forum_data )
|
||||
{
|
||||
$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 ( $forum_data['redirect_on'] )
|
||||
{
|
||||
$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->class_forums->forumsFormatLastinfo( $this->registry->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 );
|
||||
}
|
||||
|
||||
$temp_cat_data = array();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $return_cat_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of active users
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
**/
|
||||
public function getActiveUserDetails()
|
||||
{
|
||||
$active = array( 'TOTAL' => 0 ,
|
||||
'NAMES' => array(),
|
||||
'GUESTS' => 0 ,
|
||||
'MEMBERS' => 0 ,
|
||||
'ANON' => 0 ,
|
||||
);
|
||||
|
||||
if ( $this->settings['show_active'] )
|
||||
{
|
||||
if( !$this->settings['au_cutoff'] )
|
||||
{
|
||||
$this->settings['au_cutoff'] = 15;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the users from the DB
|
||||
//-----------------------------------------
|
||||
|
||||
$cut_off = $this->settings['au_cutoff'] * 60;
|
||||
$time = time() - $cut_off;
|
||||
$rows = array();
|
||||
$ar_time = time();
|
||||
|
||||
if ( $this->memberData['member_id'] )
|
||||
{
|
||||
$rows = array( $ar_time.'.'.md5( microtime() ) => array(
|
||||
'id' => 0,
|
||||
'login_type' => substr( $this->memberData['login_anonymous'], 0, 1),
|
||||
'running_time' => $ar_time,
|
||||
'seo_name' => $this->memberData['members_seo_name'],
|
||||
'member_id' => $this->memberData['member_id'],
|
||||
'member_name' => $this->memberData['members_display_name'],
|
||||
'member_group' => $this->memberData['member_group_id']
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => 'id, member_id, member_name, seo_name, login_type, running_time, member_group, uagent_type',
|
||||
'from' => 'sessions',
|
||||
'where' => "running_time > $time",
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
//-----------------------------------------
|
||||
// FETCH...
|
||||
//-----------------------------------------
|
||||
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$rows[ $r['running_time'].'.'.$r['id'] ] = $r;
|
||||
}
|
||||
|
||||
krsort( $rows );
|
||||
|
||||
//-----------------------------------------
|
||||
// cache all printed members so we
|
||||
// don't double print them
|
||||
//-----------------------------------------
|
||||
|
||||
$cached = array();
|
||||
|
||||
foreach ( $rows as $result )
|
||||
{
|
||||
$last_date = $this->registry->getClass('class_localization')->getTime( $result['running_time'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Bot?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( isset( $result['uagent_type'] ) && $result['uagent_type'] == 'search' )
|
||||
{
|
||||
/* Skipping bot? */
|
||||
if ( ! $this->settings['spider_active'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Seen bot of this type yet?
|
||||
//-----------------------------------------
|
||||
|
||||
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'] );
|
||||
}
|
||||
|
||||
$cached[ $result['member_name'] ] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Yup, count others as guest
|
||||
//-----------------------------------------
|
||||
|
||||
$active['GUESTS']++;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Guest?
|
||||
//-----------------------------------------
|
||||
|
||||
else if ( ! $result['member_id'] OR ! $result['member_name'] )
|
||||
{
|
||||
$active['GUESTS']++;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Member?
|
||||
//-----------------------------------------
|
||||
|
||||
else
|
||||
{
|
||||
if ( empty( $cached[ $result['member_id'] ] ) )
|
||||
{
|
||||
$cached[ $result['member_id'] ] = 1;
|
||||
|
||||
$result['member_name'] = IPSLib::makeNameFormatted( $result['member_name'], $result['member_group'] );
|
||||
|
||||
if ( ! $this->settings['disable_anonymous'] AND $result['login_type'] )
|
||||
{
|
||||
if ( $this->memberData['g_access_cp'] and ($this->settings['disable_admin_anon'] != 1) )
|
||||
{
|
||||
$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']++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$active['ANON']++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$active['MEMBERS']++;
|
||||
$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['TOTAL'] = $active['MEMBERS'] + $active['GUESTS'] + $active['ANON'];
|
||||
|
||||
$this->users_online = $active['TOTAL'];
|
||||
}
|
||||
|
||||
$this->lang->words['active_users'] = sprintf( $this->lang->words['active_users'], $this->settings['au_cutoff'] );
|
||||
|
||||
return $active;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string of calendar events
|
||||
*
|
||||
* @access public
|
||||
* @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&module=calendar&cal_id={$event['event_calendar_id']}&do=showevent&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
|
||||
*
|
||||
* @access public
|
||||
* @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;
|
||||
$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
|
||||
*
|
||||
* @access public
|
||||
* @return string Stats string
|
||||
**/
|
||||
public function getTotalTextString()
|
||||
{
|
||||
/* INIT */
|
||||
$stats_output = array();
|
||||
|
||||
if ( $this->settings['show_totals'] )
|
||||
{
|
||||
if ( ! is_array( $this->caches['stats'] ) )
|
||||
{
|
||||
$this->cache->setCache( 'stats', array(), array( 'array' => 1 ) );
|
||||
}
|
||||
|
||||
$stats = $this->caches['stats'];
|
||||
|
||||
//-----------------------------------------
|
||||
// We need to determine if we have the most users ever online if we aren't
|
||||
// showing active users in the stats block
|
||||
//-----------------------------------------
|
||||
|
||||
if( !$this->users_online )
|
||||
{
|
||||
$cut_off = $this->settings['au_cutoff'] * 60;
|
||||
$time = time() - $cut_off;
|
||||
$total = $this->DB->buildAndFetch( array( 'select' => 'count(*) as users_online', 'from' => 'sessions', 'where' => "running_time > $time" ) );
|
||||
|
||||
$this->users_online = $total['users_online'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Update the most active count if needed
|
||||
//-----------------------------------------
|
||||
|
||||
if ($this->users_online > $stats['most_count'])
|
||||
{
|
||||
$stats['most_count'] = $this->users_online;
|
||||
$stats['most_date'] = time();
|
||||
|
||||
$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_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'] );
|
||||
$this->lang->words['most_online'] = str_replace( "<#DATE#>", $stats_output['most_time'] , $this->lang->words['most_online'] );
|
||||
|
||||
$stats_output['total_posts'] = $stats['total_replies'] + $stats['total_topics'];
|
||||
|
||||
$stats_output['total_posts'] = $this->registry->getClass('class_localization')->formatNumber($stats_output['total_posts']);
|
||||
$stats_output['mem_count'] = $this->registry->getClass('class_localization')->formatNumber($stats['mem_count']);
|
||||
|
||||
$this->total_posts = $stats_output['total_posts'];
|
||||
$this->total_members = $stats_output['mem_count'];
|
||||
|
||||
$stats_output['last_mem_seo'] = $stats['last_mem_name_seo'] ? $stats['last_mem_name_seo'] : IPSText::makeSeoTitle( $stats['last_mem_name'] );
|
||||
$stats_output['last_mem_link'] = $this->registry->output->formatUrl( $this->registry->output->buildUrl( "showuser=".$stats['last_mem_id'], 'public' ), $stats_output['last_mem_seo'], 'showuser' );
|
||||
$stats_output['last_mem_name'] = $stats['last_mem_name'];
|
||||
$stats_output['last_mem_id'] = $stats['last_mem_id'];
|
||||
|
||||
$this->lang->words['total_word_string'] = str_replace( "<#posts#>" , $stats_output['total_posts'] , $this->lang->words['total_word_string'] );
|
||||
$this->lang->words['total_word_string'] = str_replace( "<#reg#>" , $stats_output['mem_count'] , $this->lang->words['total_word_string'] );
|
||||
$this->lang->words['total_word_string'] = str_replace( "<#mem#>" , $stats_output['last_mem_name'] , $this->lang->words['total_word_string'] );
|
||||
$this->lang->words['total_word_string'] = str_replace( "<#link#>" , $stats_output['last_mem_link'] , $this->lang->words['total_word_string'] );
|
||||
}
|
||||
|
||||
return $stats_output;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Default section file for forums public module
|
||||
* Last Updated: $LastChangedDate: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 14th May 2003
|
||||
* @version $Rev: 4948 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Very simply returns the default section if one is not
|
||||
* passed in the URL
|
||||
*/
|
||||
|
||||
$DEFAULT_SECTION = 'boards';
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Bounces a user to the right post
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 4948 $
|
||||
* @since 14th April 2004
|
||||
*
|
||||
* | > Interesting Fact: I've had iTunes playing every Radiohead tune
|
||||
* | > I own for about a week now. Thats a lot of repeats. Got some
|
||||
* | > cool rare tracks though. Every album+rare+b sides = 6.7 hours
|
||||
* | > music. Not bad. I need to get our more. No, you can't take the
|
||||
* | > laptop with you - nerd.
|
||||
*
|
||||
*/
|
||||
|
||||
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_findpost extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Find a post
|
||||
// Don't really need to check perms 'cos topic
|
||||
// will do that for us. Woohoop
|
||||
//-----------------------------------------
|
||||
|
||||
$pid = intval($this->request['pid']);
|
||||
|
||||
if ( ! $pid )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'findpost_missing_pid', 10331 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get topic...
|
||||
//-----------------------------------------
|
||||
|
||||
$post = $this->DB->buildAndFetch( array( 'select' => 'p.*',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'p.pid=' . $pid,
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 't.title_seo',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.tid=p.topic_id',
|
||||
'type' => 'left',
|
||||
)
|
||||
)
|
||||
) );
|
||||
|
||||
if ( ! $post['topic_id'] )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'findpost_missing_topic', 10332 );
|
||||
}
|
||||
|
||||
$cposts = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as posts', 'from' => 'posts', 'where' => "topic_id={$post['topic_id']} AND pid <= {$pid}" ) );
|
||||
|
||||
if ( (($cposts['posts']) % $this->settings['display_max_posts']) == 0 )
|
||||
{
|
||||
$pages = ($cposts['posts']) / $this->settings['display_max_posts'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$number = ( ($cposts['posts']) / $this->settings['display_max_posts'] );
|
||||
$pages = ceil( $number);
|
||||
}
|
||||
|
||||
$st = ($pages - 1) * $this->settings['display_max_posts'];
|
||||
$hl = $this->request['hl'] ? '&hl=' . trim( $this->request['hl'] ) : '';
|
||||
|
||||
$url = $this->registry->output->buildSEOUrl( "showtopic=" . $post['topic_id'] . "&st={$st}&p={$pid}" . $hl . "&#entry" . $pid, 'public', $post['title_seo'], 'showtopic' );
|
||||
|
||||
$this->registry->getClass('output')->silentRedirect( $url );
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Forums -> Mark As Read command class
|
||||
* Last Updated: $Date: 2009-09-14 08:10:06 -0400 (Mon, 14 Sep 2009) $
|
||||
*
|
||||
* @author Matt Mecham
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since Tuesday 1st March 2005 (11:52)
|
||||
* @version $Rev: 5108 $
|
||||
*
|
||||
*/
|
||||
|
||||
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_markasread extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Main execution point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// What are we doing?
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['marktype'] )
|
||||
{
|
||||
default:
|
||||
case 'forum':
|
||||
return $this->markForumAsRead();
|
||||
break;
|
||||
case 'all':
|
||||
return $this->markBoardAsRead();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark all forums and topics as read
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function markBoardAsRead()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->request['k'] != $this->member->form_hash )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'no_permission', 20312 );
|
||||
}
|
||||
|
||||
/* Turn off instant updates and write back tmp markers in destructor */
|
||||
$this->registry->classItemMarking->disableInstantSave();
|
||||
|
||||
//-----------------------------------------
|
||||
// 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 );
|
||||
}
|
||||
}
|
||||
|
||||
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'act=idx', 'false' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks the specified forum as read
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function markForumAsRead()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$forum_id = intval( $this->request['forumid'] );
|
||||
$return_to_id = intval( $this->request['returntoforumid'] );
|
||||
$forum_data = $this->registry->getClass('class_forums')->forum_by_id[ $forum_id ];
|
||||
$children = $this->registry->getClass('class_forums')->forumsGetChildren( $forum_data['id'] );
|
||||
$save = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $forum_data['id'] )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'markread_no_id', 10340 );
|
||||
}
|
||||
|
||||
/* Turn off instant updates and write back tmp markers in destructor */
|
||||
$this->registry->classItemMarking->disableInstantSave();
|
||||
|
||||
//-----------------------------------------
|
||||
// Come from the index? Add kids
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->request['i'] )
|
||||
{
|
||||
if ( is_array( $children ) and count($children) )
|
||||
{
|
||||
foreach( $children as $id )
|
||||
{
|
||||
$this->registry->classItemMarking->markRead( array( 'forumID' => $id ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Add in the current forum...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->classItemMarking->markRead( array( 'forumID' => $forum_id ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Where are we going back to?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $return_to_id )
|
||||
{
|
||||
$parent_data = $this->registry->getClass('class_forums')->forum_by_id[ $return_to_id ];
|
||||
|
||||
//-----------------------------------------
|
||||
// Its a sub forum, lets go redirect to parent forum
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url']."showforum=".$return_to_id, $parent_data['name_seo'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'act=idx', 'false' );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,518 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Print Topic
|
||||
* Last Updated: $Date: 2009-11-24 17:16:43 -0500 (Tue, 24 Nov 2009) $
|
||||
*
|
||||
* @author $Author: josh $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 5465 $
|
||||
*
|
||||
*/
|
||||
|
||||
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
|
||||
*/
|
||||
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' );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// 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' );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Error out if we can not find the topic
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $this->topic['tid'] )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'missing_files' );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// 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' );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// 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' );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// 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 );
|
||||
$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_id'] );
|
||||
$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
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPSLib::getAppDir( 'core' ) . '/sources/classes/attach/class_attach.php' );
|
||||
$this->class_attach = new class_attach( $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
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPSLib::getAppDir( 'core' ) . '/sources/classes/attach/class_attach.php' );
|
||||
$this->class_attach = new class_attach( $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 );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Show forum rules
|
||||
* Last Updated: $Date: 2009-04-06 22:43:13 -0400 (Mon, 06 Apr 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 4411 $
|
||||
*/
|
||||
|
||||
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_rules extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Array of form data
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private $forum = array();
|
||||
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
$this->registry->getClass( 'class_localization' )->loadLanguageFile( array( 'public_forums', 'public_boards' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the forum info based on the forum ID,
|
||||
// and get the category name, ID, etc.
|
||||
//-----------------------------------------
|
||||
|
||||
$this->forum = $this->registry->getClass('class_forums')->forum_by_id[ $this->request['f'] ];
|
||||
|
||||
//-----------------------------------------
|
||||
// Error out if we can not find the forum
|
||||
//-----------------------------------------
|
||||
|
||||
if( ! $this->forum['id'] )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'forums_no_id', 10333 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Is it a redirect forum?
|
||||
//-----------------------------------------
|
||||
|
||||
if( isset( $this->forum['redirect_on'] ) AND $this->forum['redirect_on'] )
|
||||
{
|
||||
$redirect = $this->DB->buildAndFetch( array( 'select' => 'redirect_url', 'from' => 'forums', 'where' => "id=" . $this->forum['id']) );
|
||||
|
||||
if( $redirect['redirect_url'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Update hits:
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->buildAndFetch( array( 'update' => 'forums', 'set' => 'redirect_hits=redirect_hits+1', 'where' => "id=" . $this->forum['id']) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Boink!
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('output')->silentRedirect( $redirect['redirect_url'] );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check forum access perms
|
||||
//-----------------------------------------
|
||||
|
||||
if( !$this->request['L'] )
|
||||
{
|
||||
$this->registry->getClass('class_forums')->forumsCheckAccess( $this->forum['id'], 1 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Do we have permission to view these rules?
|
||||
//-----------------------------------------
|
||||
|
||||
$allow_access = $this->registry->getClass('class_forums')->forumsCheckAccess( $this->forum['id'], 1 );
|
||||
|
||||
if( $allow_access === FALSE )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'forums_no_access', 10334 );
|
||||
}
|
||||
|
||||
$tmp = $this->DB->buildAndFetch( array( 'select' => 'rules_title, rules_text', 'from' => 'forums', 'where' => "id=" . $this->forum['id']) );
|
||||
|
||||
if( $tmp['rules_title'] )
|
||||
{
|
||||
$rules['title'] = $tmp['rules_title'];
|
||||
$rules['body'] = $tmp['rules_text'];
|
||||
$rules['fid'] = $this->forum['id'];
|
||||
|
||||
IPSText::getTextClass( 'bbcode' )->parse_smilies = 1;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_html = 1;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_nl2br = 1;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_section = 'rules';
|
||||
$rules['body'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $rules['body'] );
|
||||
|
||||
$this->output .= $this->registry->getClass('output')->getTemplate('forum')->show_rules($rules);
|
||||
|
||||
$this->registry->output->setTitle( $this->settings['board_name'] . " -> " . $this->forum['name'] );
|
||||
$this->registry->output->addNavigation( $this->forum['name'], "showforum={$this->forum['id']}", $this->forum['name_seo'], 'showforum' );
|
||||
$this->registry->output->addContent( $this->output );
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'forums_no_rules', 10335 );
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,265 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Subscribe to a topic or forum
|
||||
* Last Updated: $Date: 2009-03-04 07:36:56 -0500 (Wed, 04 Mar 2009) $
|
||||
*
|
||||
* @author $Author: matt $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Revision: 4135 $
|
||||
*
|
||||
*/
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
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 );
|
||||
}
|
||||
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 );
|
||||
}
|
||||
|
||||
$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 );
|
||||
}
|
||||
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 );
|
||||
}
|
||||
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']}&st=" . $this->request['st'] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,350 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Moderator actions
|
||||
* Last Updated: $Date: 2009-07-21 19:59:38 -0400 (Tue, 21 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Revision: 4924 $
|
||||
*
|
||||
*/
|
||||
|
||||
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_moderate_multimod extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Temporary stored output HTML
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $output;
|
||||
|
||||
/**
|
||||
* Moderator function library
|
||||
*
|
||||
* @access private
|
||||
* @var object
|
||||
*/
|
||||
private $modLibrary;
|
||||
|
||||
/**
|
||||
* Moderator information
|
||||
*
|
||||
* @access private
|
||||
* @var array Array of moderator details
|
||||
*/
|
||||
private $moderator = array();
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* Topic id
|
||||
*
|
||||
* @access private
|
||||
* @var integer Topic id
|
||||
*/
|
||||
private $topic_id = 0;
|
||||
|
||||
/**
|
||||
* Forum id
|
||||
*
|
||||
* @access private
|
||||
* @var integer Forum id
|
||||
*/
|
||||
private $forum_id = 0;
|
||||
|
||||
/**
|
||||
* Multimod id
|
||||
*
|
||||
* @access private
|
||||
* @var integer Multimod id
|
||||
*/
|
||||
private $mm_id = 0;
|
||||
|
||||
/**
|
||||
* Multimod data
|
||||
*
|
||||
* @access private
|
||||
* @var array Multimod data
|
||||
*/
|
||||
private $mm_data = array();
|
||||
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load modules...
|
||||
//-----------------------------------------
|
||||
|
||||
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_mod' ) );
|
||||
|
||||
require( IPSLib::getAppDir( 'forums' ) . '/sources/classes/moderate.php');
|
||||
$this->modLibrary = new moderatorLibrary( $this->registry );
|
||||
|
||||
//-----------------------------------------
|
||||
// Clean the incoming
|
||||
//-----------------------------------------
|
||||
|
||||
$this->request[ 't'] = intval($this->request['t'] );
|
||||
$this->mm_id = intval($this->request['mm_id']);
|
||||
|
||||
if ($this->request['t'] < 0 )
|
||||
{
|
||||
$this->registry->output->showError( 'multimod_no_topic', 103121 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the topic id / forum id
|
||||
//-----------------------------------------
|
||||
|
||||
$this->topic = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'topics', 'where' => "tid=" . intval($this->request['t']) ) );
|
||||
$this->forum = $this->registry->class_forums->allForums[ $this->topic['forum_id'] ];
|
||||
|
||||
//-----------------------------------------
|
||||
// Error out if we can not find the topic
|
||||
//-----------------------------------------
|
||||
|
||||
if ( !$this->topic['tid'])
|
||||
{
|
||||
$this->registry->output->showError( 'multimod_no_topic', 103122 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Error out if we can not find the forum
|
||||
//-----------------------------------------
|
||||
|
||||
if ( !$this->forum['id'] )
|
||||
{
|
||||
$this->registry->output->showError( 'multimod_no_topic', 103123 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Are we a moderator?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ($this->memberData['member_id']) and ($this->memberData['g_is_supmod'] != 1) )
|
||||
{
|
||||
$this->moderator = $this->DB->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'moderators',
|
||||
'where' => "forum_id LIKE '%,{$this->forum['id']},%' AND (member_id=" . $this->memberData['member_id'] . " OR (is_group=1 AND group_id='" . $this->memberData['member_group_id'] . "'))"
|
||||
) );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Init modfunc module
|
||||
//-----------------------------------------
|
||||
|
||||
$this->modLibrary->init( $this->forum, $this->topic, $this->moderator );
|
||||
|
||||
//-----------------------------------------
|
||||
// Do we have permission?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->modLibrary->mmAuthorize() != TRUE )
|
||||
{
|
||||
$this->registry->output->showError( 'multimod_no_perms', 2038 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get MM data
|
||||
//-----------------------------------------
|
||||
|
||||
$this->mm_data = $this->caches['multimod'][ $this->mm_id ];
|
||||
|
||||
if ( ! $this->mm_data['mm_id'] )
|
||||
{
|
||||
$this->registry->output->showError( 'multimod_not_found', 103124 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Does this forum have this mm_id
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->modLibrary->mmCheckIdInForum( $this->forum['id'], $this->mm_data ) != TRUE )
|
||||
{
|
||||
$this->registry->output->showError( 'multimod_no_perms', 2039 );
|
||||
}
|
||||
|
||||
$this->modLibrary->stmInit();
|
||||
|
||||
//-----------------------------------------
|
||||
// Open close?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->mm_data['topic_state'] != 'leave' )
|
||||
{
|
||||
if ( $this->mm_data['topic_state'] == 'close' )
|
||||
{
|
||||
$this->modLibrary->stmAddClose();
|
||||
}
|
||||
else if ( $this->mm_data['topic_state'] == 'open' )
|
||||
{
|
||||
$this->modLibrary->stmAddOpen();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// pin no-pin?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->mm_data['topic_pin'] != 'leave' )
|
||||
{
|
||||
if ( $this->mm_data['topic_pin'] == 'pin' )
|
||||
{
|
||||
$this->modLibrary->stmAddPin();
|
||||
}
|
||||
else if ( $this->mm_data['topic_pin'] == 'unpin' )
|
||||
{
|
||||
$this->modLibrary->stmAddUnpin();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Approve / Unapprove
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->mm_data['topic_approve'] )
|
||||
{
|
||||
if ( $this->mm_data['topic_approve'] == 1 )
|
||||
{
|
||||
$this->modLibrary->stmAddApprove();
|
||||
}
|
||||
else if ( $this->mm_data['topic_approve'] == 2 )
|
||||
{
|
||||
$this->modLibrary->stmAddUnapprove();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Topic title
|
||||
// Regexes clean title up
|
||||
//-----------------------------------------
|
||||
|
||||
$title = $this->topic['title'];
|
||||
|
||||
if ( $this->mm_data['topic_title_st'] )
|
||||
{
|
||||
$title = preg_replace( "/^" . preg_quote( $this->mm_data['topic_title_st'], '/' ) . "/", "", $title );
|
||||
}
|
||||
|
||||
if ( $this->mm_data['topic_title_end'] )
|
||||
{
|
||||
$title = preg_replace( "/" . preg_quote( $this->mm_data['topic_title_end'], '/' ) . "$/", "", $title );
|
||||
}
|
||||
|
||||
$this->modLibrary->stmAddTitle( $this->mm_data['topic_title_st'] . $title . $this->mm_data['topic_title_end'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Update what we have so far...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->modLibrary->stmExec( $this->topic['tid'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Add reply?
|
||||
//-----------------------------------------
|
||||
|
||||
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;
|
||||
IPSText::getTextClass('bbcode')->parse_nl2br = 1;
|
||||
IPSText::getTextClass('bbcode')->parsing_section = 'topics';
|
||||
|
||||
$this->modLibrary->topicAddReply(
|
||||
str_replace( "\n", "", IPSText::getTextClass('bbcode')->preDbParse( str_replace( "\r", '', $this->mm_data['topic_reply_content'] ) ) )
|
||||
, array( 0 => array( $this->topic['tid'], $this->forum['id'] ) )
|
||||
, $this->mm_data['topic_reply_postcount']
|
||||
);
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Move topic?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->mm_data['topic_move'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Move to forum still exist?
|
||||
//-----------------------------------------
|
||||
|
||||
$r = $this->registry->class_forums->allForums[ $this->mm_data['topic_move'] ];
|
||||
|
||||
if( $r['id'] )
|
||||
{
|
||||
if ( $r['sub_can_post'] != 1 )
|
||||
{
|
||||
$this->DB->update( 'topic_mmod', array( 'topic_move' => 0 ), 'mm_id=' . $this->mm_id );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $r['id'] != $this->forum['id'] )
|
||||
{
|
||||
$this->modLibrary->topicMove( $this->topic['tid'], $this->forum['id'], $r['id'], $this->mm_data['topic_move_link'] );
|
||||
|
||||
$this->modLibrary->forumRecount( $r['id'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->DB->update( 'topic_mmod', array( 'topic_move' => 0 ), 'mm_id=' . $this->mm_id );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Recount root forum
|
||||
//-----------------------------------------
|
||||
|
||||
$this->modLibrary->forumRecount( $this->forum['id'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Add mod log
|
||||
//-----------------------------------------
|
||||
|
||||
$this->modLibrary->addModerateLog( $this->forum['id'], $this->topic['tid'], "", $this->topic['title'], "Applied multi-mod: " . $this->mm_data['mm_title'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// 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'] );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Forum posting default section
|
||||
* Last Updated: $LastChangedDate: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 14th May 2003
|
||||
* @version $Rev: 4948 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Very simply returns the default section if one is not
|
||||
* passed in the URL
|
||||
*/
|
||||
|
||||
$DEFAULT_SECTION = 'post';
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,641 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Posting
|
||||
* Last Updated: $Date: 2009-09-28 18:04:38 -0400 (Mon, 28 Sep 2009) $
|
||||
* File Created By: Matt Mecham
|
||||
*
|
||||
* @author $Author: josh $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 5170 $
|
||||
*
|
||||
*/
|
||||
|
||||
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_post_post extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Post Class
|
||||
*
|
||||
* @access protected
|
||||
* @var object Post Class
|
||||
*/
|
||||
protected $_postClass;
|
||||
|
||||
/**
|
||||
* Post Form Class
|
||||
*
|
||||
* @access protected
|
||||
* @var object Post Class
|
||||
*/
|
||||
protected $_postFormClass;
|
||||
|
||||
/**
|
||||
* Controller run function
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry
|
||||
* @return void
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$doCodes = array(
|
||||
'new_post' => array( '0' , 'new' ),
|
||||
'new_post_do' => array( '1' , 'new' ),
|
||||
'reply_post' => array( '0' , 'reply' ),
|
||||
'reply_post_do' => array( '1' , 'reply' ),
|
||||
'edit_post' => array( '0' , 'edit' ),
|
||||
'edit_post_do' => array( '1' , 'edit' )
|
||||
);
|
||||
|
||||
$do = $this->request['do'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Make sure our input doCode element is legal.
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! isset( $doCodes[ $do ] ) )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'posting_bad_action', 103125 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// 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'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Grab the post class
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . '/sources/classes/post/classPost.php' );
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . '/sources/classes/post/classPostForms.php' );
|
||||
|
||||
$this->_postClass = new classPostForms( $registry );
|
||||
|
||||
//-----------------------------------------
|
||||
// Set up some stuff
|
||||
//-----------------------------------------
|
||||
|
||||
# IDs
|
||||
$this->_postClass->setTopicID( $this->request['t'] );
|
||||
$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.
|
||||
# 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
|
||||
$this->_postClass->setIsPreview( ( $this->request['preview'] ) ? TRUE : FALSE );
|
||||
|
||||
# Forum Data
|
||||
$this->_postClass->setForumData( $this->registry->getClass('class_forums')->forum_by_id[ $this->request['f'] ] );
|
||||
|
||||
# Topic Data
|
||||
$this->_postClass->setTopicData( $this->DB->buildAndFetch( array(
|
||||
'select' => 't.*, p.poll_only',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => "t.forum_id={$this->_postClass->getForumID()} AND t.tid={$this->_postClass->getTopicID()}",
|
||||
'add_join' => array(
|
||||
array(
|
||||
'type' => 'left',
|
||||
'from' => array( 'polls' => 'p' ),
|
||||
'where' => 'p.tid=t.tid'
|
||||
)
|
||||
)
|
||||
) ) );
|
||||
|
||||
|
||||
# Published
|
||||
$this->_postClass->setPublished( $this->_checkPostModeration( $doCodes[ $do ][1] ) === TRUE ? TRUE : FALSE );
|
||||
|
||||
# Post Content
|
||||
$this->_postClass->setPostContent( isset( $_POST['Post'] ) ? $_POST['Post'] : '' );
|
||||
|
||||
# Set Author
|
||||
$this->_postClass->setAuthor( $this->memberData['member_id'] );
|
||||
|
||||
# Mod Options
|
||||
$this->_postClass->setModOptions( $this->request['mod_options'] );
|
||||
|
||||
# Set Settings
|
||||
if ( ! $doCodes[ $do ][0] )
|
||||
{
|
||||
if ( $this->_postClass->getIsPreview() !== TRUE )
|
||||
{
|
||||
/* Showing form */
|
||||
$this->request['enablesig'] = ( isset( $this->request['enablesig'] ) ) ? $this->request['enablesig'] : 'yes';
|
||||
$this->request['enableemo'] = ( isset( $this->request['enableemo'] ) ) ? $this->request['enableemo'] : 'yes';
|
||||
}
|
||||
}
|
||||
|
||||
$this->_postClass->setSettings( array( 'enableSignature' => ( $this->request['enablesig'] == 'yes' ) ? 1 : 0,
|
||||
'enableEmoticons' => ( $this->request['enableemo'] == 'yes' ) ? 1 : 0,
|
||||
'post_htmlstatus' => intval( $this->request['post_htmlstatus'] ),
|
||||
'enableTracker' => intval( $this->request['enabletrack'] ) ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Checks...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('class_forums')->forumsCheckAccess( $this->_postClass->getForumData('id'), 1, 'forum', $this->_postClass->getTopicData() );
|
||||
|
||||
//-----------------------------------------
|
||||
// Are we allowed to post at all?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->memberData['member_id'] )
|
||||
{
|
||||
if ( $this->memberData['restrict_post'] )
|
||||
{
|
||||
if ( $this->memberData['restrict_post'] == 1 )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'posting_restricted', 103126 );
|
||||
}
|
||||
|
||||
$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->registry->getClass('output')->showError( array( 'posting_off_susp', $this->registry->getClass( 'class_localization')->getDate( $post_arr['date_end'], 'LONG', 1 ) ), 103127 );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Flood check..
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! in_array( $do, array( 'edit_post', 'edit_post_do', 'poll_add', 'poll_add_do' ) ) )
|
||||
{
|
||||
if ( $this->settings['flood_control'] > 0 )
|
||||
{
|
||||
if ( $this->memberData['g_avoid_flood'] != 1 )
|
||||
{
|
||||
if ( time() - $this->memberData['last_post'] < $this->settings['flood_control'] )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( array( 'flood_control', $this->settings['flood_control'] ), 103128 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( $this->member->is_not_human == 1 )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'posting_restricted', 103129 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Show form or process?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $doCodes[ $do ][0] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Make sure we have a valid auth key
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->request['auth_key'] != $this->member->form_hash )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'posting_bad_auth_key', 20310 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Guest captcha?
|
||||
//-----------------------------------------
|
||||
|
||||
try
|
||||
{
|
||||
$this->_postClass->checkGuestCaptcha();
|
||||
}
|
||||
catch( Exception $error )
|
||||
{
|
||||
$this->_postClass->setPostError( $error->getMessage() );
|
||||
$this->showForm( $doCodes[ $do ][1] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Make sure we have a "Guest" Name..
|
||||
//-----------------------------------------
|
||||
|
||||
$this->_check_guest_name();
|
||||
$this->checkDoublePost();
|
||||
|
||||
$this->saveForm( $doCodes[ $do ][1] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->showForm( $doCodes[ $do ][1] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the form
|
||||
*
|
||||
* @access public
|
||||
* @param string Type of form to show
|
||||
* @return void
|
||||
*/
|
||||
public function saveForm( $type )
|
||||
{
|
||||
switch( $type )
|
||||
{
|
||||
case 'reply':
|
||||
try
|
||||
{
|
||||
if ( $this->_postClass->addReply() === FALSE )
|
||||
{
|
||||
$this->lang->loadLanguageFile( array('public_error'), 'core' );
|
||||
|
||||
$this->showForm( $type );
|
||||
}
|
||||
|
||||
$topic = $this->_postClass->getTopicData();
|
||||
$post = $this->_postClass->getPostData();
|
||||
|
||||
# Redirect
|
||||
if( $topic['_returnToMove'] )
|
||||
{
|
||||
ipsRegistry::getClass('output')->silentRedirect( "{$this->settings['base_url']}t={$topic['tid']}&f={$topic['forum_id']}&auth_key={$this->memberData['form_hash']}&app=forums&module=moderate&section=moderate&do=02" );
|
||||
}
|
||||
else if ( $this->settings['post_order_sort'] == 'desc' )
|
||||
{
|
||||
ipsRegistry::getClass('output')->silentRedirect( $this->settings['base_url']."showtopic=" . $this->_postClass->getTopicID() . "&#entry" . $this->_postClass->getPostID(), $topic['title_seo'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$posts = $topic['posts'] + 1;
|
||||
|
||||
if( $this->moderator['post_q'] OR $this->memberData['g_is_supmod'] )
|
||||
{
|
||||
$posts += $topic['topic_queuedposts'];
|
||||
}
|
||||
|
||||
if( ( $posts % $this->settings['display_max_posts'] ) == 0 )
|
||||
{
|
||||
$page = ( ($posts) / $this->settings['display_max_posts'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$page = ( ($posts) / $this->settings['display_max_posts'] );
|
||||
$page = ceil($page) - 1;
|
||||
}
|
||||
|
||||
$page = $page * $this->settings['display_max_posts'];
|
||||
|
||||
ipsRegistry::getClass('output')->silentRedirect( $this->settings['base_url']."showtopic={$topic['tid']}&st=$page&gopid={$post['pid']}&#entry{$post['pid']}", $topic['title_seo'] );
|
||||
}
|
||||
}
|
||||
catch( Exception $error )
|
||||
{
|
||||
if( $this->_postClass->getIsPreview() )
|
||||
{
|
||||
$this->showForm( $type );
|
||||
}
|
||||
|
||||
$this->registry->getClass('output')->showError( $error->getMessage(), 103130 );
|
||||
}
|
||||
break;
|
||||
case 'new':
|
||||
try
|
||||
{
|
||||
if ( $this->_postClass->addTopic() === FALSE )
|
||||
{
|
||||
$this->lang->loadLanguageFile( array('public_error'), 'core' );
|
||||
|
||||
$this->showForm( $type );
|
||||
}
|
||||
|
||||
$topic = $this->_postClass->getTopicData();
|
||||
$post = $this->_postClass->getPostData();
|
||||
|
||||
# Redirect
|
||||
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url']."showtopic={$topic['tid']}", $topic['title_seo'] );
|
||||
}
|
||||
catch( Exception $error )
|
||||
{
|
||||
$language = $this->lang->words[ $error->getMessage() ] ? $this->lang->words[ $error->getMessage() ] : $error->getMessage();
|
||||
$this->registry->getClass('output')->showError( $language, 103131 );
|
||||
}
|
||||
break;
|
||||
case 'edit':
|
||||
try
|
||||
{
|
||||
if ( $this->_postClass->editPost() === FALSE )
|
||||
{
|
||||
$this->lang->loadLanguageFile( array('public_error'), 'core' );
|
||||
|
||||
$this->showForm( $type );
|
||||
}
|
||||
|
||||
$topic = $this->_postClass->getTopicData();
|
||||
$post = $this->_postClass->getPostData();
|
||||
|
||||
# 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 );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the Form
|
||||
*
|
||||
* @access public
|
||||
* @param string Type of form to show
|
||||
* @param string Error message
|
||||
* @return null [ Returns HTML to the output engine for immediate printing ]
|
||||
*/
|
||||
public function showForm( $type )
|
||||
{
|
||||
switch( $type )
|
||||
{
|
||||
case 'reply':
|
||||
try
|
||||
{
|
||||
$this->_postClass->showReplyForm();
|
||||
}
|
||||
catch( Exception $error )
|
||||
{
|
||||
if ( $error->getMessage() == 'NO_POSTING_PPD' )
|
||||
{
|
||||
$_l = $this->_fetchPpdError();
|
||||
|
||||
$this->registry->output->showError( $_l, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->getClass('output')->showError( $this->lang->words[ $error->getMessage() ] ? $this->lang->words[ $error->getMessage() ] : $error->getMessage(), 103133 );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'new':
|
||||
try
|
||||
{
|
||||
$this->_postClass->showTopicForm();
|
||||
}
|
||||
catch( Exception $error )
|
||||
{
|
||||
if ( $error->getMessage() == 'NOT_ENOUGH_POSTS' )
|
||||
{
|
||||
$this->registry->output->showError( 'posting_not_enough_posts', 103140 );
|
||||
}
|
||||
else if ( $error->getMessage() == 'NO_POSTING_PPD' )
|
||||
{
|
||||
$_l = $this->_fetchPpdError();
|
||||
|
||||
$this->registry->output->showError( $_l, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->getClass('output')->showError( $this->lang->words[ $error->getMessage() ] ? $this->lang->words[ $error->getMessage() ] : $error->getMessage(), 103134 );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'edit':
|
||||
try
|
||||
{
|
||||
$this->_postClass->showEditForm();
|
||||
}
|
||||
catch( Exception $error )
|
||||
{
|
||||
if ( $error->getMessage() == 'NO_POSTING_PPD' )
|
||||
{
|
||||
$_l = $this->_fetchPpdError();
|
||||
|
||||
$this->registry->output->showError( $_l, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->getClass('output')->showError( $this->lang->words[ $error->getMessage() ] ? $this->lang->words[ $error->getMessage() ] : $error->getMessage(), 103135 );
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for double post
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function checkDoublePost()
|
||||
{
|
||||
if( ! $this->_postClass->getIsPreview() )
|
||||
{
|
||||
if( time() - $this->memberData['last_post'] <= 5 )
|
||||
{
|
||||
if( $this->request['do'] == '01' or $this->request['do'] == '11' )
|
||||
{
|
||||
/* 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();
|
||||
|
||||
$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']}&view=getlastpost" );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for guest's name being in use
|
||||
*
|
||||
* @access private
|
||||
* @return void
|
||||
**/
|
||||
private function _check_guest_name()
|
||||
{
|
||||
/* 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'] );
|
||||
$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'];
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
*
|
||||
* @access private
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch post per day error
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
private function _fetchPpdError()
|
||||
{
|
||||
$_g = $this->caches['group_cache'][ $this->memberData['member_group_id'] ];
|
||||
$_l = sprintf( $this->lang->words['NO_POSTING_PPD'], $_g['g_ppd_limit'] );
|
||||
|
||||
if ( $_g['g_ppd_unit'] )
|
||||
{
|
||||
if ( $_g['gbw_ppd_unit_type'] )
|
||||
{
|
||||
$_l .= "<br />" . sprintf( $this->lang->words['NO_PPD_DAYS'], $this->lang->getDate( ( time() + ( 86400 * $_g['g_ppd_unit'] ) ) - $this->memberData['joined'], 'LONG' ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$_l .= "<br />" . sprintf( $this->lang->words['NO_PPD_POSTS'], $_g['g_ppd_unit'] - $this->memberData['posts'] );
|
||||
}
|
||||
}
|
||||
|
||||
return $_l;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user