Version 3.3.4

This commit is contained in:
Neo committed 2025-12-19 00:35:52 -08:00
1 parent 78706903a2
commit fb6b5baabc
2206 files changed
+409828 -382984

No files matched your search

@@ -1,87 +1,87 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* Grab attachments and return via AJAX (AJAX)
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://hatynka.in
* @version $Revision: 8644 $
*/
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
*
* @param object ipsRegistry reference
* @return @e 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'] );
}
$classToLoad = IPSLib::loadActionOverloader( IPSLib::getAppDir('forums') . '/modules_public/forums/attach.php', 'public_forums_forums_attach' );
$attach = new $classToLoad( $this->registry );
$attach->makeRegistryShortcuts( $this->registry );
$attachHTML = $attach->getAttachments( $topic );
if ( !$attachHTML )
{
$this->returnJsonError( $this->lang->words['ajax_nohtml_return'] );
}
else
{
$this->returnHtml( $attachHTML );
}
}
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* Grab attachments and return via AJAX (AJAX)
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Revision: 10914 $
*/
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
*
* @param object ipsRegistry reference
* @return @e 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'] );
}
$classToLoad = IPSLib::loadActionOverloader( IPSLib::getAppDir('forums') . '/modules_public/forums/attach.php', 'public_forums_forums_attach' );
$attach = new $classToLoad( $this->registry );
$attach->makeRegistryShortcuts( $this->registry );
$attachHTML = $attach->getAttachments( $topic );
if ( !$attachHTML )
{
$this->returnJsonError( $this->lang->words['ajax_nohtml_return'] );
}
else
{
$this->returnHtml( $attachHTML );
}
}
}
@@ -3,11 +3,11 @@
* @file defaultSection.php Define the default section for the 'ajax' module
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: This is NULLED!
* $License: http://www.invisionpower.com/company/standards.php#license$
* $Author: ips_terabyte $
* @since 14th May 2003
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
* @version v3.2.3
* @version v3.3.4
* $Revision: 8655 $
*/
@@ -1,77 +1,77 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* Ourputs emoticon list via AJAX (AJAX)
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://hatynka.in
* @version $Rev: 8644 $
*
*/
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
*
* @param object ipsRegistry reference
* @return @e 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'], "&quot;" ) )
{
$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 ) );
}
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* Ourputs emoticon list via AJAX (AJAX)
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 10914 $
*
*/
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
*
* @param object ipsRegistry reference
* @return @e 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'], "&quot;" ) )
{
$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 ) );
}
}
@@ -1,105 +1,105 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* Fetch topics and other data from the forum
* Last Updated: $Date: 2011-09-14 20:13:56 -0400 (Wed, 14 Sep 2011) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://hatynka.in
* @version $Revision: 9491 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_forums_ajax_forums extends ipsAjaxCommand
{
/**
* Main class entry point
*
* @param object ipsRegistry reference
* @return @e void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
switch( $this->request['do'] )
{
default:
case 'getTopics':
$this->_getTopics();
break;
case 'markRead':
$this->_markRead();
break;
}
}
/**
* Mark topic as read
*/
protected function _markRead()
{
$fid = intval( $this->request['fid'] );
$this->registry->getClass('classItemMarking')->markRead( array( 'forumID' => $fid ) );
$this->returnJsonArray( array( 'status' => 'ok' ) );
}
/**
* Get topics from a forum
*
* @return @e void [Outputs to screen]
*/
protected function _getTopics()
{
//-----------------------------------------
// Reset input
//-----------------------------------------
$_GET['showforum'] = intval($_GET['f']);
ipsRegistry::$request['showforum'] = intval(ipsRegistry::$request['f']);
if ( $_GET['showforum'] < 1 )
{
$this->returnJsonArray( array( 'error' => 'incorrect_f' ) );
}
//-----------------------------------------
// Get the forum controller
//-----------------------------------------
$classToLoad = IPSLib::loadActionOverloader( IPSLib::getAppDir( 'forums' ) . '/modules_public/forums/forums.php', 'public_forums_forums_forums' );
$forums = new $classToLoad();
$forums->makeRegistryShortcuts( $this->registry );
$forums->initForums();
$forums->buildPermissions();
$data = $forums->renderForum();
$html = '';
if( is_array( $data['topic_data'] ) && count( $data['topic_data'] ) )
{
foreach( $data['topic_data'] as $idx => $tdata )
{
$html .= $this->registry->output->getTemplate('forum')->topic( $tdata, $data['other_data']['forum_data'], $data['other_data'], 1 );
}
}
$html = $this->cleanOutput( $this->parseAndCleanHooks( $html ) );
$pages = $this->parseAndCleanHooks( $data['other_data']['forum_data']['SHOW_PAGES'] );
$this->returnJsonArray( array( 'topics' => $html, 'pages' => $pages, 'hasMore' => $data['other_data']['hasMore'] ) );
}
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* Fetch topics and other data from the forum
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Revision: 10914 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_forums_ajax_forums extends ipsAjaxCommand
{
/**
* Main class entry point
*
* @param object ipsRegistry reference
* @return @e void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
switch( $this->request['do'] )
{
default:
case 'getTopics':
$this->_getTopics();
break;
case 'markRead':
$this->_markRead();
break;
}
}
/**
* Mark topic as read
*/
protected function _markRead()
{
$fid = intval( $this->request['fid'] );
$this->registry->getClass('classItemMarking')->markRead( array( 'forumID' => $fid ) );
$this->returnJsonArray( array( 'status' => 'ok' ) );
}
/**
* Get topics from a forum
*
* @return @e void [Outputs to screen]
*/
protected function _getTopics()
{
//-----------------------------------------
// Reset input
//-----------------------------------------
$_GET['showforum'] = intval($_GET['f']);
ipsRegistry::$request['showforum'] = intval(ipsRegistry::$request['f']);
if ( $_GET['showforum'] < 1 )
{
$this->returnJsonArray( array( 'error' => 'incorrect_f' ) );
}
//-----------------------------------------
// Get the forum controller
//-----------------------------------------
$classToLoad = IPSLib::loadActionOverloader( IPSLib::getAppDir( 'forums' ) . '/modules_public/forums/forums.php', 'public_forums_forums_forums' );
$forums = new $classToLoad();
$forums->makeRegistryShortcuts( $this->registry );
$forums->initForums();
$forums->buildPermissions();
$data = $forums->renderForum();
$html = '';
if( is_array( $data['topic_data'] ) && count( $data['topic_data'] ) )
{
foreach( $data['topic_data'] as $idx => $tdata )
{
$html .= $this->registry->output->getTemplate('forum')->topic( $tdata, $data['other_data']['forum_data'], $data['other_data'], 1 );
}
}
$html = $this->cleanOutput( $this->parseAndCleanHooks( $html ) );
$pages = $this->parseAndCleanHooks( $data['other_data']['forum_data']['SHOW_PAGES'] );
$this->returnJsonArray( array( 'topics' => $html, 'pages' => $pages, 'hasMore' => $data['other_data']['hasMore'] ) );
}
}
@@ -1,10 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -1,106 +1,106 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* Ajax Functions For Topics
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://hatynka.in
* @version $Revision: 8644 $
*
*/
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
*
* @param object ipsRegistry reference
* @return @e 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
*
* @return @e 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') );
}
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* Ajax Functions For Topics
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Revision: 10914 $
*
*/
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
*
* @param object ipsRegistry reference
* @return @e 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
*
* @return @e 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') );
}
}
@@ -1,67 +1,67 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* Retrieve who posted stats
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://hatynka.in
* @version $Revision: 8644 $
*/
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
*
* @param object ipsRegistry reference
* @return @e void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
switch( $this->request['do'] )
{
case 'who':
$this->_whoPosted();
break;
}
}
/**
* Retrieve posters in a given topic
*
* @return @e void [Outputs to screen]
*/
protected function _whoPosted()
{
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_stats' ), 'forums' );
$classToLoad = IPSLib::loadActionOverloader( IPSLib::getAppDir('forums') . '/modules_public/extras/stats.php', 'public_forums_extras_stats' );
$stats = new $classToLoad( $this->registry );
$stats->makeRegistryShortcuts( $this->registry );
$output = $stats->whoPosted( true );
if ( !$output )
{
$this->returnJsonError( $this->lang->words['ajax_nohtml_return'] );
}
else
{
$this->returnHtml( $output );
}
}
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* Retrieve who posted stats
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Revision: 10914 $
*/
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
*
* @param object ipsRegistry reference
* @return @e void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
switch( $this->request['do'] )
{
case 'who':
$this->_whoPosted();
break;
}
}
/**
* Retrieve posters in a given topic
*
* @return @e void [Outputs to screen]
*/
protected function _whoPosted()
{
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_stats' ), 'forums' );
$classToLoad = IPSLib::loadActionOverloader( IPSLib::getAppDir('forums') . '/modules_public/extras/stats.php', 'public_forums_extras_stats' );
$stats = new $classToLoad( $this->registry );
$stats->makeRegistryShortcuts( $this->registry );
$output = $stats->whoPosted( true );
if ( !$output )
{
$this->returnJsonError( $this->lang->words['ajax_nohtml_return'] );
}
else
{
$this->returnHtml( $output );
}
}
}
File diff suppressed because it is too large. Load diff
@@ -1,49 +1,52 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* Board Rules
* Last Updated: $Date: 2011-08-18 17:50:15 -0400 (Thu, 18 Aug 2011) $
* </pre>
*
* @author $Author $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://hatynka.in
* @since 20th February 2002
* @version $Rev: 9399 $
*/
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
{
/**
* Class entry point
*
* @param object Registry reference
* @return @e 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_smilies = 1;
IPSText::getTextClass( 'bbcode' )->parse_html = 1;
IPSText::getTextClass( 'bbcode' )->parse_nl2br = 1;
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
IPSText::getTextClass( 'bbcode' )->parsing_section = 'global';
$this->registry->output->addNavigation( $this->settings['gl_title'], '' );
$this->registry->output->setTitle( $this->settings['gl_title'] . ' - ' . ipsRegistry::$settings['board_name'] );
$this->registry->output->addContent( $this->registry->output->getTemplate('emails')->boardRules( $this->settings['gl_title'], IPSText::getTextClass( 'bbcode' )->preDisplayParse( $row['conf_value'] ) ) );
$this->registry->output->sendOutput();
}
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* Board Rules
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* </pre>
*
* @author $Author $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @since 20th February 2002
* @version $Rev: 10914 $
*/
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
{
/**
* Class entry point
*
* @param object Registry reference
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
/* Load editor stuff */
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite' );
$editor = new $classToLoad();
/* Get board rule (not cached) */
$row = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_sys_conf_settings', 'where' => "conf_key='gl_guidelines'" ) );
$editor->setAllowHtml( true );
$row['conf_value'] = $editor->switchContent( $row['conf_value'], 0 );
$this->registry->output->addNavigation( $this->settings['gl_title'], '' );
$this->registry->output->setTitle( $this->settings['gl_title'] . ' - ' . ipsRegistry::$settings['board_name'] );
$this->registry->output->addContent( $this->registry->output->getTemplate('emails')->boardRules( $this->settings['gl_title'], IPSText::getTextClass( 'bbcode' )->preDisplayParse( $row['conf_value'] ) ) );
$this->registry->output->sendOutput();
}
}
@@ -3,11 +3,11 @@
* @file defaultSection.php Define the default section for the 'extras' module
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: This is NULLED!
* $License: http://www.invisionpower.com/company/standards.php#license$
* $Author: ips_terabyte $
* @since 20th February 2002
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
* @version v3.2.3
* @version v3.3.4
* $Revision: 8655 $
*/
@@ -1,267 +1,267 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* Forward a topic to someone
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://hatynka.in
* @since 20th February 2002
* @version $Revision: 8644 $
*
*/
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
*
* @var string
*/
public $output;
/**
* Forum information
*
* @var array Array of forum details
*/
protected $forum = array();
/**
* Topic information
*
* @var array Array of topic details
*/
protected $topic = array();
protected $page = array();
/**
* Class entry point
*
* @param object Registry reference
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Grab skin and lang stuff
//-----------------------------------------
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_emails' ), 'core' );
/* Via URL and topic title? */
if ( $this->request['url'] AND $this->request['title'] )
{
$this->page['url'] = IPSText::parseCleanValue( IPSText::base64_decode_urlSafe( $this->request['url'] ) );
$this->page['title'] = IPSText::parseCleanValue( urldecode( $this->request['title'] ) );
}
else
{
//-----------------------------------------
// 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'] );
}
/* last check */
if ( ! $this->topic['tid'] AND ! $this->page['url'] )
{
$this->registry->output->showError( 'forward_no_tid', 10323.2 );
}
/* Ok, I lied. Is this share entry enabled? */
$cache = ipsRegistry::cache()->getCache('sharelinks');
if ( ! is_array( $cache['email'] ) OR ! $cache['email']['share_enabled'] )
{
$this->registry->output->showError( 'forward_turned_off', 103240 );
}
//-----------------------------------------
// What to do?
//-----------------------------------------
if ( $this->request['do'] == '01' )
{
$this->_sendEmail();
}
else
{
$this->_showForm();
}
}
/**
* Forward the page (sends the email)
*
* @return @e void [Outputs to screen/redirects]
*/
protected function _sendEmail()
{
//-----------------------------------------
// Check
//-----------------------------------------
if ( $this->request['k'] != $this->member->form_hash )
{
$this->registry->getClass('output')->showError( 'no_permission', 2029, null, null, 403 );
}
/* Check the CAPTCHA */
if ( $this->settings['bot_antispam_type'] != 'none' )
{
if ( $this->registry->getClass('class_captcha')->validate() !== TRUE )
{
return $this->_showForm('err_reg_code');
}
}
$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->page['url'] );
}
/**
* Show the form to forward the page
*
* @return @e void [Outputs to screen/redirects]
*/
protected function _showForm( $msg='' )
{
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_email_content' ), 'core' );
if ( $this->topic['tid'] )
{
$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'] );
$subject = $this->topic['title'];
}
else
{
$this->lang->words['send_text'] = str_replace( "<#THE LINK#>" , $this->page['url'] , $this->lang->words['send_text'] );
$this->lang->words['send_text'] = str_replace( "<#USER NAME#>", $this->memberData['members_display_name'], $this->lang->words['send_text'] );
$subject = $this->page['title'];
}
/* CAPTCHA */
if( $this->settings['bot_antispam_type'] != 'none' )
{
$captchaHTML = $this->registry->getClass('class_captcha')->getTemplate();
}
$this->output = $this->registry->getClass('output')->getTemplate('emails')->forward_form( $subject, $this->lang->words['send_text'], '', $captchaHTML, $msg );
if ( $this->topic['tid'] )
{
$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'] . ' - ' . ipsRegistry::$settings['board_name'] );
}
else
{
$this->registry->output->addNavigation( $this->lang->words['title'], '' );
$this->registry->output->setTitle( $this->lang->words['title'] . ' - ' . ipsRegistry::$settings['board_name'] );
}
$this->registry->output->addContent( $this->output );
$this->registry->output->sendOutput();
}
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* Forward a topic to someone
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @since 20th February 2002
* @version $Revision: 10914 $
*
*/
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
*
* @var string
*/
public $output;
/**
* Forum information
*
* @var array Array of forum details
*/
protected $forum = array();
/**
* Topic information
*
* @var array Array of topic details
*/
protected $topic = array();
protected $page = array();
/**
* Class entry point
*
* @param object Registry reference
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Grab skin and lang stuff
//-----------------------------------------
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_emails' ), 'core' );
/* Via URL and topic title? */
if ( $this->request['url'] AND $this->request['title'] )
{
$this->page['url'] = IPSText::parseCleanValue( IPSText::base64_decode_urlSafe( $this->request['url'] ) );
$this->page['title'] = IPSText::parseCleanValue( urldecode( $this->request['title'] ) );
}
else
{
//-----------------------------------------
// 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'] );
}
/* last check */
if ( ! $this->topic['tid'] AND ! $this->page['url'] )
{
$this->registry->output->showError( 'forward_no_tid', 10323.2 );
}
/* Ok, I lied. Is this share entry enabled? */
$cache = ipsRegistry::cache()->getCache('sharelinks');
if ( ! is_array( $cache['email'] ) OR ! $cache['email']['share_enabled'] )
{
$this->registry->output->showError( 'forward_turned_off', 103240 );
}
//-----------------------------------------
// What to do?
//-----------------------------------------
if ( $this->request['do'] == '01' )
{
$this->_sendEmail();
}
else
{
$this->_showForm();
}
}
/**
* Forward the page (sends the email)
*
* @return @e void [Outputs to screen/redirects]
*/
protected function _sendEmail()
{
//-----------------------------------------
// Check
//-----------------------------------------
if ( $this->request['k'] != $this->member->form_hash )
{
$this->registry->getClass('output')->showError( 'no_permission', 2029, null, null, 403 );
}
/* Check the CAPTCHA */
if ( $this->settings['bot_antispam_type'] != 'none' )
{
if ( $this->registry->getClass('class_captcha')->validate() !== TRUE )
{
return $this->_showForm('err_reg_code');
}
}
$lang_to_use = '';
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->page['url'] );
}
/**
* Show the form to forward the page
*
* @return @e void [Outputs to screen/redirects]
*/
protected function _showForm( $msg='' )
{
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_email_content' ), 'core' );
if ( $this->topic['tid'] )
{
$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'] );
$subject = $this->topic['title'];
}
else
{
$this->lang->words['send_text'] = str_replace( "<#THE LINK#>" , $this->page['url'] , $this->lang->words['send_text'] );
$this->lang->words['send_text'] = str_replace( "<#USER NAME#>", $this->memberData['members_display_name'], $this->lang->words['send_text'] );
$subject = $this->page['title'];
}
/* CAPTCHA */
if( $this->settings['bot_antispam_type'] != 'none' )
{
$captchaHTML = $this->registry->getClass('class_captcha')->getTemplate();
}
$this->output = $this->registry->getClass('output')->getTemplate('emails')->forward_form( $subject, $this->lang->words['send_text'], '', $captchaHTML, $msg );
if ( $this->topic['tid'] )
{
$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'] . ' - ' . ipsRegistry::$settings['board_name'] );
}
else
{
$this->registry->output->addNavigation( $this->lang->words['title'], '' );
$this->registry->output->setTitle( $this->lang->words['title'] . ' - ' . ipsRegistry::$settings['board_name'] );
}
$this->registry->output->addContent( $this->output );
$this->registry->output->sendOutput();
}
}
@@ -1,10 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -1,182 +1,182 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* Emoticon and BBCode Legends
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://hatynka.in
* @version $Rev: 8644 $
*
*/
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
*
* @var string
*/
public $output = "";
/**
* Class entry point
*
* @param object Registry reference
* @return @e 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 . ' - ' . ipsRegistry::$settings['board_name'] );
$this->registry->getClass('output')->popUpWindow( $this->output );
}
/**
* Displays the emoticon list popup
*
* @return @e 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'], "&quot;" ) )
{
$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
*
* @return @e 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 );
}
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* Emoticon and BBCode Legends
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* </pre>
*
* @author $Author $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 10914 $
*
*/
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
*
* @var string
*/
public $output = "";
/**
* Class entry point
*
* @param object Registry reference
* @return @e 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 . ' - ' . ipsRegistry::$settings['board_name'] );
$this->registry->getClass('output')->popUpWindow( $this->output );
}
/**
* Displays the emoticon list popup
*
* @return @e 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']."'", 'order' => 'emo_position asc' ) );
$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'], "&quot;" ) )
{
$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
*
* @return @e 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 );
}
}
@@ -1,202 +1,202 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* Add rating fallback
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://hatynka.in
* @since 20th February 2002
* @version $Revision: 8644 $
*
*/
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
*
* @var array
*/
public $forum = array();
/**
* Topic data
*
* @var array
*/
public $topic = array();
/**
* Class entry point
*
* @param object Registry reference
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
/* Security Check */
if ( $this->request['secure_key'] != $this->member->form_hash )
{
$this->registry->output->showError( 'usercp_forums_bad_key', 102999, null, null, 403 );
}
//-----------------------------------------
// INIT
//-----------------------------------------
$topic_id = intval($this->request['t']);
$rating_id = intval($this->request['rating']);
$this->registry->class_localization->loadLanguageFile( array( 'public_topic' ) );
//-----------------------------------------
// Get data
//-----------------------------------------
if ( ! $topic_id )
{
$this->registry->output->showError( 'topics_no_tid', 10346, null, null, 404 );
}
$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, null, null, 404 );
}
if ( ! $this->topic['tid'] )
{
$this->registry->output->showError( 'topics_no_tid', 10347, null, null, 404 );
}
//-----------------------------------------
// Locked topic?
//-----------------------------------------
if ( $this->topic['state'] != 'open' )
{
$this->registry->output->showError( 'topic_rate_locked', 10348, null, null, 403 );
}
if ( ! $this->registry->class_forums->canQueuePosts($this->forum['id']) )
{
if ( $this->topic['approved'] != 1 )
{
$this->registry->output->showError( 'topic_not_approved', 103151, null, null, 403 );
}
}
$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, null, null, 403 );
}
//-----------------------------------------
// 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']}&amp;st=" . $this->request['st'], $this->topic['title_seo'], 'showtopic' );
}
else
{
$this->registry->output->redirectScreen( $this->lang->words['topic_rated_already'] , $this->settings['base_url'] . "showtopic={$this->topic['tid']}&amp;st=" . $this->request['st'], $this->topic['title_seo'], 'showtopic' );
}
}
//-----------------------------------------
// 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']}&amp;st=" . $this->request['st'], $this->topic['title_seo'], 'showtopic' );
}
}
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* Add rating fallback
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @since 20th February 2002
* @version $Revision: 10914 $
*
*/
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
*
* @var array
*/
public $forum = array();
/**
* Topic data
*
* @var array
*/
public $topic = array();
/**
* Class entry point
*
* @param object Registry reference
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
/* Security Check */
if ( $this->request['secure_key'] != $this->member->form_hash )
{
$this->registry->output->showError( 'usercp_forums_bad_key', 102999, null, null, 403 );
}
//-----------------------------------------
// INIT
//-----------------------------------------
$topic_id = intval($this->request['t']);
$rating_id = intval($this->request['rating']);
$this->registry->class_localization->loadLanguageFile( array( 'public_topic' ) );
//-----------------------------------------
// Get data
//-----------------------------------------
if ( ! $topic_id )
{
$this->registry->output->showError( 'topics_no_tid', 10346, null, null, 404 );
}
$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, null, null, 404 );
}
if ( ! $this->topic['tid'] )
{
$this->registry->output->showError( 'topics_no_tid', 10347, null, null, 404 );
}
//-----------------------------------------
// Locked topic?
//-----------------------------------------
if ( $this->topic['state'] != 'open' )
{
$this->registry->output->showError( 'topic_rate_locked', 10348, null, null, 403 );
}
if ( ! $this->registry->class_forums->canQueuePosts($this->forum['id']) )
{
if ( $this->topic['approved'] != 1 )
{
$this->registry->output->showError( 'topic_not_approved', 103151, null, null, 403 );
}
}
$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, null, null, 403 );
}
//-----------------------------------------
// 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']}&amp;st=" . $this->request['st'], $this->topic['title_seo'], 'showtopic' );
}
else
{
$this->registry->output->redirectScreen( $this->lang->words['topic_rated_already'] , $this->settings['base_url'] . "showtopic={$this->topic['tid']}&amp;st=" . $this->request['st'], $this->topic['title_seo'], 'showtopic' );
}
}
//-----------------------------------------
// 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']}&amp;st=" . $this->request['st'], $this->topic['title_seo'], 'showtopic' );
}
}
File diff suppressed because it is too large. Load diff
@@ -1,84 +1,84 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* Silly toggle function(?s{0,})
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://hatynka.in
* @since 20th February 2002
* @version $Revision: 8644 $
*
*/
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
*
* @param object Registry reference
* @return @e 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
*
* @return @e void
* @see The Dark Knight (it was an awesome movie)
*/
public function _toggleSidePanel()
{
/* Security Check */
if ( $this->request['secure_key'] != $this->member->form_hash )
{
$this->registry->output->showError( 'usercp_forums_bad_key', 102998, null, null, 403 );
}
$current = IPSCookie::get('hide_sidebar');
$new = $current ? 0 : 1;
IPSCookie::set( 'hide_sidebar', $new );
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'act=idx', 'false' );
}
}
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* Silly toggle function(?s{0,})
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @since 20th February 2002
* @version $Revision: 10914 $
*
*/
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
*
* @param object Registry reference
* @return @e 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
*
* @return @e void
* @see The Dark Knight (it was an awesome movie)
*/
public function _toggleSidePanel()
{
/* Security Check */
if ( $this->request['secure_key'] != $this->member->form_hash )
{
$this->registry->output->showError( 'usercp_forums_bad_key', 102998, null, null, 403 );
}
$current = IPSCookie::get('hide_sidebar');
$new = $current ? 0 : 1;
IPSCookie::set( 'hide_sidebar', $new );
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'act=idx', 'false' );
}
}
@@ -1,372 +1,373 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* Poll voting
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://hatynka.in
* @since 20th February 2002
* @version $Revision: 8644 $
*
*/
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
*
* @var array
*/
public $topic = array();
/**
* Class entry point
*
* @param object Registry reference
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
/* Security Check */
if ( $this->request['secure_key'] != $this->member->form_hash )
{
$this->registry->output->showError( 'topic_cannot_vote', 103148, null, null, 403 );
}
//-----------------------------------------
// INIT
//-----------------------------------------
if( !intval( $this->memberData['g_vote_polls'] ) )
{
$this->registry->output->showError( 'topic_cannot_vote', 10349, null, null, 403 );
}
$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, null, null, 404 );
}
//-----------------------------------------
// 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',
'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, null, null, 404 );
}
//-----------------------------------------
// Locked topic?
//-----------------------------------------
if ( $this->topic['state'] != 'open' )
{
$this->registry->output->showError( 'topic_vote_locked', 10352, true, null, 403 );
}
//-----------------------------------------
// 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, null, null, 403 );
}
//-----------------------------------------
// What we doing?
//-----------------------------------------
switch( $this->request['do'] )
{
default:
case 'add':
$this->topicAddVoteToPoll();
break;
case 'delete':
$this->topicDeletePollVotes();
break;
}
}
/**
* Add vote to poll
*
* @return @e 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']}&amp;st=" . $this->request['st'], $this->topic['title_seo'], 'showtopic' );
}
/**
* Remove votes
*
* @return @e 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, null, null, 403 );
}
//-----------------------------------------
// 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']}&amp;st=" . $this->request['st'], $this->topic['title_seo'], 'showtopic' );
}
//-----------------------------------------
// 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']}&amp;st=" . $this->request['st'], $this->topic['title_seo'], 'showtopic' );
}
}
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* Poll voting
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @since 20th February 2002
* @version $Revision: 10914 $
*
*/
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
*
* @var array
*/
public $topic = array();
/**
* Class entry point
*
* @param object Registry reference
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
/* Security Check */
if ( $this->request['secure_key'] != $this->member->form_hash )
{
$this->registry->output->showError( 'topic_cannot_vote', 103148, null, null, 403 );
}
//-----------------------------------------
// INIT
//-----------------------------------------
if( !intval( $this->memberData['g_vote_polls'] ) )
{
$this->registry->output->showError( 'topic_cannot_vote', 10349, null, null, 403 );
}
$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, null, null, 404 );
}
//-----------------------------------------
// 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',
'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, null, null, 404 );
}
//-----------------------------------------
// Locked topic?
//-----------------------------------------
if ( $this->topic['state'] != 'open' )
{
$this->registry->output->showError( 'topic_vote_locked', 10352, true, null, 403 );
}
//-----------------------------------------
// 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, null, null, 403 );
}
//-----------------------------------------
// What we doing?
//-----------------------------------------
switch( $this->request['do'] )
{
default:
case 'add':
$this->topicAddVoteToPoll();
break;
case 'delete':
$this->topicDeletePollVotes();
break;
}
}
/**
* Add vote to poll
*
* @return @e 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_real_post'] = $this->topic['last_real_post'] ? $this->topic['last_real_post'] : $this->topic['last_post'];
$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'], 'last_real_post' => $this->topic['last_real_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']}&amp;st=" . $this->request['st'], $this->topic['title_seo'], 'showtopic' );
}
/**
* Remove votes
*
* @return @e 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, null, null, 403 );
}
//-----------------------------------------
// 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']}&amp;st=" . $this->request['st'], $this->topic['title_seo'], 'showtopic' );
}
//-----------------------------------------
// 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']}&amp;st=" . $this->request['st'], $this->topic['title_seo'], 'showtopic' );
}
}
@@ -1,279 +1,298 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* Announcement View
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://hatynka.in
* @version $Rev: 8644 $
*/
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
*
* @param object Registry reference
* @return @e 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, null, null, 404 );
}
$this->registry->getClass( 'class_localization')->loadLanguageFile( array( 'public_topic' ) );
//-----------------------------------------
// Get the announcement
//-----------------------------------------
$_post_joins = 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'
),
);
/* Add custom fields join? */
if( $this->settings['custom_profile_topic'] == 1 )
{
$_post_joins[] = array(
'select' => 'pc.*',
'from' => array( 'pfields_content' => 'pc' ),
'where' => 'pc.member_id=m.member_id',
'type' => 'left'
);
}
$announce = $this->DB->buildAndFetch( array( 'select' => 'a.*',
'from' => array( 'announcements' => 'a' ),
'where' => 'a.announce_id=' . $announceID,
'add_join' => $_post_joins
) );
if ( ! $announce['announce_id'] or ! $announce['announce_forum'] )
{
$this->registry->getClass('output')->showError( 'announcement_id_missing', 10328, null, null, 404 );
}
//-----------------------------------------
// 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, null, 403 );
}
if( ! $announce['announce_active'] AND ! $this->memberData['g_is_supmod'] )
{
$this->registry->getClass('output')->showError( 'announcement_no_perms', 2036, true, null, 403 );
}
//-----------------------------------------
// 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_html_enabled'] ? $announce['announce_nlbr_enabled'] : 1;
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
IPSText::getTextClass( 'bbcode' )->parsing_section = 'announcements';
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $announce['member_group_id'];
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( $announce['announce_title'] . ' - ' . $this->settings['board_name'] );
$this->registry->getClass('output')->addContent( $template );
$this->registry->getClass('output')->sendOutput();
}
/**
* Hides announcements that have passed their expire date
*
* @return @e 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
*
* @author Matt Mecham
* @return @e 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'] <= mktime( 12, 0, 0 ) )
{
$start_ok = 1;
}
if ( ! $r['announce_end'] )
{
$end_ok = 1;
}
else if ( $r['announce_end'] >= mktime( 12, 0, 0 ) )
{
$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_seo_title' => IPSText::makeSeoTitle( $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 ) );
}
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* Announcement View
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 10914 $
*/
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
*
* @param object Registry reference
* @return @e 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, null, null, 404 );
}
$this->registry->getClass( 'class_localization')->loadLanguageFile( array( 'public_topic' ) );
//-----------------------------------------
// Get the announcement
//-----------------------------------------
$_post_joins = 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'
),
);
/* Add custom fields join? */
if( $this->settings['custom_profile_topic'] == 1 )
{
$_post_joins[] = array(
'select' => 'pc.*',
'from' => array( 'pfields_content' => 'pc' ),
'where' => 'pc.member_id=m.member_id',
'type' => 'left'
);
}
$announce = $this->DB->buildAndFetch( array( 'select' => 'a.*',
'from' => array( 'announcements' => 'a' ),
'where' => 'a.announce_id=' . $announceID,
'add_join' => $_post_joins
) );
if ( ! $announce['announce_id'] or ! $announce['announce_forum'] )
{
$this->registry->getClass('output')->showError( 'announcement_id_missing', 10328, null, null, 404 );
}
//-----------------------------------------
// 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, null, 403 );
}
if( ! $announce['announce_active'] AND ! $this->memberData['g_is_supmod'] )
{
$this->registry->getClass('output')->showError( 'announcement_no_perms', 2036, true, null, 403 );
}
//-----------------------------------------
// 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_html_enabled'] ? $announce['announce_nlbr_enabled'] : 1;
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
IPSText::getTextClass( 'bbcode' )->parsing_section = 'announcements';
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $announce['member_group_id'];
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] );
}
//-----------------------------------------
// Have we got an SEO title?
//-----------------------------------------
if ( $announce['announce_seo_title'] == '' )
{
$announce['announce_seo_title'] = IPSText::makeSeoTitle( $announce['announce_title'] );
$this->DB->update( 'announcements', array( 'announce_seo_title' => $announce['announce_seo_title'] ), "announce_id={$announceID}" );
}
//-----------------------------------------
// Output
//-----------------------------------------
$this->registry->getClass('output')->setTitle( $announce['announce_title'] . ' - ' . $this->settings['board_name'] );
$this->registry->getClass('output')->addContent( $template );
$this->registry->getClass('output')->sendOutput();
}
/**
* Hides announcements that have passed their expire date
*
* @return @e 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
*
* @author Matt Mecham
* @return @e 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' ) )
) );
$outer = $this->DB->execute();
while ( $r = $this->DB->fetch($outer) )
{
/* Fix missing seo titles */
if ( $r['announce_seo_title'] == '' )
{
$r['announce_seo_title'] = IPSText::makeSeoTitle( $r['announce_title'] );
$this->DB->update( 'announcements', array( 'announce_seo_title' => $r['announce_seo_title'] ), "announce_id={$r['announce_id']}" );
}
$start_ok = 0;
$end_ok = 0;
if ( ! $r['announce_active'] )
{
continue;
}
if ( ! $r['announce_start'] )
{
$start_ok = 1;
}
else if ( $r['announce_start'] <= mktime( 12, 0, 0 ) )
{
$start_ok = 1;
}
if ( ! $r['announce_end'] )
{
$end_ok = 1;
}
else if ( $r['announce_end'] >= mktime( 12, 0, 0 ) )
{
$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_seo_title' => $r['announce_seo_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->registry->cache()->setCache( 'announcements', $cache, array( 'array' => 1, 'donow' => 1 ) );
}
}
@@ -1,170 +1,170 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* View Topic Attachments
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://hatynka.in
* @version $Rev: 8644 $
*/
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
*
* @param object Registry reference
* @return @e 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, null, null, 404 );
}
/* 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, null, null, 404 );
}
/* 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, null, 403 );
}
/* Build the attachment display */
$this->registry->getClass('output')->addContent( $this->getAttachments( $topic ) );
/* Set the title */
$this->registry->getClass('output')->setTitle($topic['title'] .' -> ' . $this->lang->words['attach_page_title'] . ' - ' . ipsRegistry::$settings['board_name']);
/* 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
*
* @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 ' . $this->registry->class_forums->fetchPostHiddenQuery( array( 'visible' ), 'p.' ) : '';
$_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&amp;module=forums&amp;section=attach&amp;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;
}
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* View Topic Attachments
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 10914 $
*/
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
*
* @param object Registry reference
* @return @e 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, null, null, 404 );
}
/* 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, null, null, 404 );
}
/* 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, null, 403 );
}
/* Build the attachment display */
$this->registry->getClass('output')->addContent( $this->getAttachments( $topic ) );
/* Set the title */
$this->registry->getClass('output')->setTitle($topic['title'] .' -> ' . $this->lang->words['attach_page_title'] . ' - ' . ipsRegistry::$settings['board_name']);
/* 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
*
* @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 ' . $this->registry->class_forums->fetchPostHiddenQuery( array( 'visible' ), 'p.' ) : '';
$_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&amp;module=forums&amp;section=attach&amp;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;
}
}
@@ -1,496 +1,486 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* Board Index View
* Last Updated: $Date: 2011-09-08 18:01:45 -0400 (Thu, 08 Sep 2011) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://hatynka.in
* @version $Rev: 9470 $
*/
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
*
* @param object Registry reference
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$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 sidebar hooks */
$show_sidebar = false;
if( is_array( $this->caches['hooks']['templateHooks']['skin_boards'] ) )
{
foreach( $this->caches['hooks']['templateHooks']['skin_boards'] as $c => $hook )
{
if( $hook['id'] == 'side_blocks' && $hook['skinFunction'] == 'boardIndexTemplate' )
{
$show_sidebar = true;
break;
}
}
}
//-----------------------------------------
// Show the template
//-----------------------------------------
$stats_info = $this->getTotalTextString();
$active = 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
) );
/* Output */
$template = $this->registry->getClass('output')->getTemplate('boards')->boardIndexTemplate(
$this->registry->getClass('class_localization')->getDate( $this->memberData['last_visit'], 'LONG' ),
$active,
$cat_data,
$show_sidebar );
//-----------------------------------------
// Meta tags
//-----------------------------------------
if( $this->settings['seo_index_md'] )
{
$this->registry->output->addMetaTag( 'description', $this->settings['seo_index_md'], false );
}
if( $this->settings['seo_index_mk'] )
{
$this->registry->output->addMetaTag( 'keywords', $this->settings['seo_index_mk'], false );
}
$this->registry->output->addCanonicalTag( "act=idx", 'public', 'false' );
//-----------------------------------------
// Set ad codes
//-----------------------------------------
if( $this->registry->getClass('IPSAdCode')->userCanViewAds() )
{
$this->registry->getClass('IPSAdCode')->setGlobalCode( 'header', 'ad_code_board_index_header' );
$this->registry->getClass('IPSAdCode')->setGlobalCode( 'footer', 'ad_code_board_index_footer' );
}
//-----------------------------------------
// Print as normal
//-----------------------------------------
$this->registry->getClass('output')->setTitle( $this->settings['seo_index_title'] ? $this->settings['seo_index_title'] : $this->settings['board_name'] );
$this->registry->getClass('output')->addContent( $template );
$this->registry->getClass('output')->sendOutput();
}
/**
* Builds an array of category data for output
*
* @return array
*/
public function processAllCategories()
{
//-----------------------------------------
// Init
//-----------------------------------------
$return_cat_data = array();
$root = array();
$parent = array();
$member_ids = 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( $temp_cat_data[ $forum_data['id'] ]['last_poster_id'] )
{
$member_ids[ $forum_data['id'] ] = $temp_cat_data[ $forum_data['id'] ]['last_poster_id'];
}
}
}
if ( count( $temp_cat_data ) )
{
$return_cat_data[] = array( 'cat_data' => $cat_data,
'forum_data' => $temp_cat_data );
}
$temp_cat_data = array();
}
}
}
if( count($member_ids) )
{
$_members = IPSMember::load( array_unique($member_ids), 'members,profile_portal' );
foreach( $member_ids as $forumId => $memberId )
{
$_member = $_members[ $memberId ];
if( $_member['member_id'] )
{
$_member = IPSMember::buildDisplayData( $_member );
foreach( $return_cat_data as $k => $_type )
{
foreach( $_type as $__type => $obj )
{
if( $__type == 'forum_data' )
{
foreach( $obj as $fid => $fdata )
{
if( $fid != $forumId )
{
continue;
}
$return_cat_data[ $k ][ $__type ][ $fid ] = array_merge( $_member, $fdata );
break 3;
}
}
}
}
}
}
}
return $return_cat_data;
}
/**
* Returns an array of active users
*
* @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')->getDate( $result['running_time'], 'TINY' );
//-----------------------------------------
// 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'] ] )
{
$active['NAMES'][] = IPSMember::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'] = IPSMember::makeNameFormatted( $result['member_name'], $result['member_group'] );
if ( $result['login_type'] )
{
if ( $this->memberData['g_access_cp'] )
{
$active['NAMES'][] = "<a href='" . $this->registry->getClass('output')->buildSEOUrl( "showuser={$result['member_id']}", 'public', $result['seo_name'], 'showuser' ) . "' title='$last_date'>{$result['member_name']}</a>*";
$active['ANON']++;
}
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 an array of board stats
*
* @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'], 'DATE' );
$stats_output['most_online'] = $this->registry->getClass('class_localization')->formatNumber($stats['most_count']);
$this->lang->words['most_online'] = str_replace( "<#NUM#>" , $stats_output['most_online'] , $this->lang->words['most_online'] );
$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;
}
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* Board Index View
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 10914 $
*/
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
*
* @param object Registry reference
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$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 sidebar hooks */
$show_sidebar = false;
if( is_array( $this->caches['hooks']['templateHooks']['skin_boards'] ) )
{
foreach( $this->caches['hooks']['templateHooks']['skin_boards'] as $c => $hook )
{
if( $hook['id'] == 'side_blocks' && $hook['skinFunction'] == 'boardIndexTemplate' )
{
$show_sidebar = true;
break;
}
}
}
//-----------------------------------------
// Show the template
//-----------------------------------------
$stats_info = $this->getTotalTextString();
$active = 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 ) );
/* Output */
$template = $this->registry->getClass('output')->getTemplate('boards')->boardIndexTemplate( $this->registry->getClass('class_localization')->getDate( $this->memberData['last_visit'], 'LONG' ),
$active,
$cat_data,
$show_sidebar );
//-----------------------------------------
// Meta tags
//-----------------------------------------
if( $this->settings['seo_index_md'] )
{
$this->registry->output->addMetaTag( 'description', $this->settings['seo_index_md'], false );
}
if( $this->settings['seo_index_mk'] )
{
$this->registry->output->addMetaTag( 'keywords', $this->settings['seo_index_mk'], false );
}
$this->registry->output->addCanonicalTag( "act=idx", 'public', 'false' );
//-----------------------------------------
// Set ad codes
//-----------------------------------------
if( $this->registry->getClass('IPSAdCode')->userCanViewAds() )
{
$this->registry->getClass('IPSAdCode')->setGlobalCode( 'header', 'ad_code_board_index_header' );
$this->registry->getClass('IPSAdCode')->setGlobalCode( 'footer', 'ad_code_board_index_footer' );
}
//-----------------------------------------
// Print as normal
//-----------------------------------------
$this->registry->getClass('output')->setTitle( $this->settings['seo_index_title'] ? $this->settings['seo_index_title'] : $this->settings['board_name'] );
$this->registry->getClass('output')->addContent( $template );
$this->registry->getClass('output')->sendOutput();
}
/**
* Builds an array of category data for output
*
* @return array
*/
public function processAllCategories()
{
//-----------------------------------------
// Init
//-----------------------------------------
$return_cat_data = array();
$root = array();
$parent = array();
$member_ids = 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( $temp_cat_data[ $forum_data['id'] ]['last_poster_id'] )
{
$member_ids[ $forum_data['id'] ] = $temp_cat_data[ $forum_data['id'] ]['last_poster_id'];
}
}
}
if ( count( $temp_cat_data ) )
{
$return_cat_data[] = array( 'cat_data' => $cat_data,
'forum_data' => $temp_cat_data );
}
$temp_cat_data = array();
}
}
}
if( count($member_ids) )
{
$_members = IPSMember::load( array_unique($member_ids), 'members,profile_portal' );
foreach( $member_ids as $forumId => $memberId )
{
$_member = $_members[ $memberId ];
if( $_member['member_id'] )
{
$_member = IPSMember::buildDisplayData( $_member );
foreach( $return_cat_data as $k => $_type )
{
foreach( $_type as $__type => $obj )
{
if( $__type == 'forum_data' )
{
foreach( $obj as $fid => $fdata )
{
if( $fid != $forumId )
{
continue;
}
$return_cat_data[ $k ][ $__type ][ $fid ] = array_merge( $_member, $fdata );
break 3;
}
}
}
}
}
}
}
return $return_cat_data;
}
/**
* Returns an array of active users
*
* @return array
*/
public function getActiveUserDetails()
{
$active = array( 'TOTAL' => 0 ,
'NAMES' => array(),
'GUESTS' => 0 ,
'MEMBERS' => 0 ,
'ANON' => 0 ,
);
if ( $this->settings['show_active'] && $this->memberData['gbw_view_online_lists'] )
{
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' => IPSMember::isLoggedInAnon($this->memberData),
'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')->getDate( $result['running_time'], 'TINY' );
//-----------------------------------------
// 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'] ] )
{
$active['NAMES'][] = IPSMember::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'] = IPSMember::makeNameFormatted( $result['member_name'], $result['member_group'] );
/* Reset login type in case the board/group setting got changed */
$result['login_type'] = IPSMember::isLoggedInAnon( array( 'login_anonymous' => $result['login_type'] ), $result['member_group'] );
if ( $result['login_type'] )
{
if ( $this->memberData['g_access_cp'] || ( $this->memberData['member_id'] == $result['member_id'] ) )
{
$active['NAMES'][] = IPSMember::makeProfileLink( $result['member_name'], $result['member_id'], $result['seo_name'], '', $last_date ) . "*";
$active['ANON']++;
}
else
{
$active['ANON']++;
}
}
else
{
$active['MEMBERS']++;
$active['NAMES'][] = IPSMember::makeProfileLink( $result['member_name'], $result['member_id'], $result['seo_name'], '', $last_date );
}
}
}
}
$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 an array of board stats
*
* @return string Stats string
*/
public function getTotalTextString()
{
/* INIT */
$stats_output = array();
if ( $this->settings['show_totals'] )
{
$stats = $this->cache->getCache('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( empty($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'], 'DATE' );
$stats_output['most_online'] = $this->registry->getClass('class_localization')->formatNumber( $stats['most_count'] );
$this->lang->words['most_online'] = str_replace( "<#NUM#>" , $stats_output['most_online'] , $this->lang->words['most_online'] );
$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;
}
}
@@ -3,11 +3,11 @@
* @file defaultSection.php Define the default section for the 'forums' module
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: This is NULLED!
* $License: http://www.invisionpower.com/company/standards.php#license$
* $Author: ips_terabyte $
* @since 14th May 2003
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
* @version v3.2.3
* @version v3.3.4
* $Revision: 8655 $
*/
@@ -1,127 +1,128 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* Bounces a user to the right post
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://hatynka.in
* @version $Rev: 8644 $
* @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
*
* @param object Registry reference
* @return @e 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, null, null, 404 );
}
//-----------------------------------------
// Get topic...
//-----------------------------------------
$post = $this->DB->buildAndFetch( array( 'select' => 'p.*',
'from' => array( 'posts' => 'p' ),
'where' => 'p.pid=' . $pid,
'add_join' => array(
array(
'select' => 't.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, null, null, 404 );
}
$sort_field = ($this->settings['post_order_column'] == 'pid') ? 'pid' : 'post_date';
$sort_value = $sort_field == 'pid' ? $pid : $post['post_date'];
$query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery('visible');
/* Can we deal with hidden posts? */
if ( $this->registry->class_forums->canQueuePosts( $this->topic['forum_id'] ) )
{
if ( $this->permissions['softDeleteSee'] )
{
/* See queued and soft deleted */
$query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array( 'approved', 'sdeleted', 'hidden' ) );
}
else
{
/* Otherwise, see queued and approved */
$query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array( 'visible', 'hidden' ) );
}
}
else
{
/* We cannot see hidden posts */
if ( $this->permissions['softDeleteSee'] )
{
/* See queued and soft deleted */
$query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array('approved', 'sdeleted') );
}
}
$cposts = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as posts', 'from' => 'posts', 'where' => "topic_id={$post['topic_id']} AND {$sort_field} <=" . intval( $sort_value ) . $query ) );
if ( (($cposts['posts']) % $this->settings['display_max_posts']) == 0 )
{
$pages = ($cposts['posts']) / $this->settings['display_max_posts'];
}
else
{
$number = ( ($cposts['posts']) / $this->settings['display_max_posts'] );
$pages = ceil( $number);
}
$st = ($pages - 1) * $this->settings['display_max_posts'];
$hl = $this->request['hl'] ? '&hl=' . trim( $this->request['hl'] ) : '';
$url = $this->registry->output->buildSEOUrl( "showtopic=" . $post['topic_id'] . "&st={$st}&p={$pid}" . $hl . "&#entry" . $pid, 'public', $post['title_seo'], 'showtopic' );
$this->registry->getClass('output')->silentRedirect( $url );
}
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* Bounces a user to the right post
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 10914 $
* @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
*
* @param object Registry reference
* @return @e 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, null, null, 404 );
}
//-----------------------------------------
// Get topic...
//-----------------------------------------
$post = $this->DB->buildAndFetch( array( 'select' => 'p.*',
'from' => array( 'posts' => 'p' ),
'where' => 'p.pid=' . $pid,
'add_join' => array( array( 'select' => 't.*',
'from' => array( 'topics' => 't' ),
'where' => 't.tid=p.topic_id',
'type' => 'left' ) ) ) );
if ( ! $post['topic_id'] )
{
$this->registry->getClass('output')->showError( 'findpost_missing_topic', 10332, null, null, 404 );
}
/* Check permission */
if ( ! $this->registry->getClass('class_forums')->forumsCheckAccess( $post['forum_id'], 0, 'topic', $post, TRUE ) )
{
$this->registry->getClass('output')->showError( 'findpost_missing_topic', 10332.1, null, null, 404 );
}
$sort_field = ($this->settings['post_order_column'] == 'pid') ? 'pid' : 'post_date';
$sort_value = $sort_field == 'pid' ? $pid : $post['post_date'];
$query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery('visible');
/* Can we deal with hidden posts? */
if ( $this->registry->class_forums->canQueuePosts( $post['forum_id'] ) )
{
if ( $this->permissions['softDeleteSee'] )
{
/* See queued and soft deleted */
$query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array( 'approved', 'sdeleted', 'hidden' ) );
}
else
{
/* Otherwise, see queued and approved */
$query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array( 'visible', 'hidden' ) );
}
}
else
{
/* We cannot see hidden posts */
if ( $this->permissions['softDeleteSee'] )
{
/* See queued and soft deleted */
$query = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery( array('approved', 'sdeleted') );
}
}
$cposts = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as posts', 'from' => 'posts', 'where' => "topic_id={$post['topic_id']} AND {$sort_field} <=" . intval( $sort_value ) . $query ) );
if ( (($cposts['posts']) % $this->settings['display_max_posts']) == 0 )
{
$pages = ($cposts['posts']) / $this->settings['display_max_posts'];
}
else
{
$number = ( ($cposts['posts']) / $this->settings['display_max_posts'] );
$pages = ceil( $number);
}
$st = ($pages - 1) * $this->settings['display_max_posts'];
$hl = $this->request['hl'] ? '&hl=' . trim( $this->request['hl'] ) : '';
$url = $this->registry->output->buildSEOUrl( "showtopic=" . $post['topic_id'] . "&st={$st}&p={$pid}" . $hl . "&#entry" . $pid, 'public', $post['title_seo'], 'showtopic' );
$this->registry->getClass('output')->silentRedirect( $url );
}
}
File diff suppressed because it is too large. Load diff
@@ -1,10 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -1,163 +1,163 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* Forums -> Mark As Read command class
* Last Updated: $Date: 2011-07-14 03:36:38 -0400 (Thu, 14 Jul 2011) $
* </pre>
*
* @author Matt Mecham
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://hatynka.in
* @since Tuesday 1st March 2005 (11:52)
* @version $Rev: 9230 $
*
*/
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
*
* @param object ipsRegistry reference
* @return @e 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();
break;
case 'app':
return $this->markBoardAsRead( trim( $this->request['markApp'] ) );
break;
}
}
/**
* Mark all forums and topics as read
*
* @return @e void
*/
public function markBoardAsRead( $app=null )
{
//-----------------------------------------
// Check
//-----------------------------------------
if ( $this->request['k'] != $this->member->form_hash )
{
$this->registry->getClass('output')->showError( 'no_permission', 20312, null, null, 403 );
}
/* Turn off instant updates and write back tmp markers in destructor */
$this->registry->classItemMarking->disableInstantSave();
//-----------------------------------------
// Reset board markers
//-----------------------------------------
# Bug fix 21223 - reset all markers with one cookie save
$this->registry->classItemMarking->markAppAsRead( $app );
if( $app && !in_array( $app, array('core','forums') ) )
{
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'app=' . $app, 'false' );
}
else
{
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] );
}
}
/**
* Marks the specified forum as read
*
* @return @e 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.8, null, null, 404 );
}
/* 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' );
}
}
}
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* Forums -> Mark As Read command class
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* </pre>
*
* @author Matt Mecham
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @since Tuesday 1st March 2005 (11:52)
* @version $Rev: 10914 $
*
*/
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
*
* @param object ipsRegistry reference
* @return @e 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();
break;
case 'app':
return $this->markBoardAsRead( trim( $this->request['markApp'] ) );
break;
}
}
/**
* Mark all forums and topics as read
*
* @return @e void
*/
public function markBoardAsRead( $app=null )
{
//-----------------------------------------
// Check
//-----------------------------------------
if ( $this->request['k'] != $this->member->form_hash )
{
$this->registry->getClass('output')->showError( 'no_permission', 20312, null, null, 403 );
}
/* Turn off instant updates and write back tmp markers in destructor */
$this->registry->classItemMarking->disableInstantSave();
//-----------------------------------------
// Reset board markers
//-----------------------------------------
# Bug fix 21223 - reset all markers with one cookie save
$this->registry->classItemMarking->markAppAsRead( $app );
if( $app && !in_array( $app, array('core','forums') ) )
{
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'app=' . $app, 'false' );
}
else
{
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] );
}
}
/**
* Marks the specified forum as read
*
* @return @e 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.8, null, null, 404 );
}
/* 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' );
}
}
}
@@ -1,133 +1,137 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* Show forum rules
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://hatynka.in
* @version $Rev: 8644 $
*/
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
*
* @var array
*/
protected $forum = array();
/**
* Class entry point
*
* @param object Registry reference
* @return @e 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, null, null, 404 );
}
//-----------------------------------------
// Is it a redirect forum?
//-----------------------------------------
if( !empty( $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, null, null, 403 );
}
$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'];
$rules['fseo'] = $this->forum['name_seo'];
IPSText::getTextClass( 'bbcode' )->parse_smilies = 1;
IPSText::getTextClass( 'bbcode' )->parse_html = 1;
IPSText::getTextClass( 'bbcode' )->parse_nl2br = 1;
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
IPSText::getTextClass( 'bbcode' )->parsing_section = 'rules';
$rules['body'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $rules['body'] );
$this->output .= $this->registry->getClass('output')->getTemplate('forum')->show_rules($rules);
$this->registry->output->setTitle( $this->forum['name'] . ' - ' . ipsRegistry::$settings['board_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, null, null, 404 );
}
}
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* Show forum rules
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 10914 $
*/
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
*
* @var array
*/
protected $forum = array();
/**
* Class entry point
*
* @param object Registry reference
* @return @e 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, null, null, 404 );
}
//-----------------------------------------
// Is it a redirect forum?
//-----------------------------------------
if( !empty( $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, null, null, 403 );
}
$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'];
$rules['fseo'] = $this->forum['name_seo'];
IPSText::getTextClass( 'bbcode' )->parse_smilies = 1;
IPSText::getTextClass( 'bbcode' )->parse_html = 1;
IPSText::getTextClass( 'bbcode' )->parse_nl2br = 1;
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
IPSText::getTextClass( 'bbcode' )->parsing_section = 'rules';
$rules['body'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $rules['body'] );
/* @link http://community.invisionpower.com/tracker/issue-37441-forum-rules/ */
$rules['body'] = str_replace( "<span rel='lightbox'>", "<span>", $rules['body'] );
$rules['body'] = str_replace( "class='bbc_img'", "", $rules['body'] );
$this->output .= $this->registry->getClass('output')->getTemplate('forum')->show_rules($rules);
$this->registry->output->setTitle( $this->forum['name'] . ' - ' . ipsRegistry::$settings['board_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, null, null, 404 );
}
}
}
File diff suppressed because it is too large. Load diff
@@ -1,10 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -3,11 +3,11 @@
* @file defaultSection.php Define the default section for the 'moderate' module
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: This is NULLED!
* $License: http://www.invisionpower.com/company/standards.php#license$
* $Author: ips_terabyte $
* @since 14th May 2003
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
* @version v3.2.3
* @version v3.3.4
* $Revision: 8655 $
*/
@@ -1,10 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -2,18 +2,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* IP.Board v3.3.4
* Moderator actions
* Last Updated: $Date: 2011-10-11 11:50:01 -0400 (Tue, 11 Oct 2011) $
* Last Updated: $Date: 2012-07-03 11:43:57 -0400 (Tue, 03 Jul 2012) $
* </pre>
*
* @author $Author: bfarber $
* @author $Author: AndyMillne $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://hatynka.in
* @version $Revision: 9597 $
* @link http://www.invisionpower.com
* @version $Revision: 11027 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -115,7 +115,7 @@ class public_forums_moderate_moderate extends ipsCommand
// Convert the code ID's into something
// use mere mortals can understand....
//-----------------------------------------
switch ( $this->request['do'] )
{
case '02':
@@ -160,7 +160,9 @@ class public_forums_moderate_moderate extends ipsCommand
case 'sundelete':
$this->_softDeleteTopicToggle(false);
break;
case 'deleteArchivedTopic':
$this->_deleteArchivedTopic();
break;
//-----------------------------------------
// Unsubscribe
//-----------------------------------------
@@ -219,15 +221,12 @@ class public_forums_moderate_moderate extends ipsCommand
// Add. topic view func.
//-----------------------------------------
case 'topic_approve':
case 'topic_restore':
$this->_topicApproveAlter('approve');
break;
case 'topic_unapprove':
$this->_topicApproveAlter('unapprove');
break;
case 'topic_restore':
$this->_topicApproveAlter('approve');
break;
/* New options for 3.1 */
case 'p_approve':
@@ -249,6 +248,10 @@ class public_forums_moderate_moderate extends ipsCommand
$this->_postsManage('hdelete_delete');
break;
case 'unArchiveTopic':
$this->_topicUnarchive();
break;
default:
$this->_showError();
break;
@@ -260,6 +263,29 @@ class public_forums_moderate_moderate extends ipsCommand
$this->registry->getClass('output')->sendOutput();
}
/**
* Flag a topic as unarchive.
* A tragically boring and mundane function written on a misty Monday morning
*/
protected function _topicUnarchive()
{
if ( ! $this->memberData['g_access_cp'] )
{
$this->_showError( 'moderate_no_permission', 103119.2, 403 );
}
/* Load up archive class */
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/archive/restore.php', 'classes_archive_restore' );
$archiveRestore = new $classToLoad();
$archiveRestore->setApp('forums');
$archiveRestore->setManualUnarchive( $this->topic['tid'] );
/* Back to topic, then? */
$this->registry->output->silentRedirect( $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . '&st=' . intval( $this->request['st'] ), $this->topic['title_seo'], "showtopic" );
}
/**
* A simple wrapper function for multimethods
*
@@ -357,12 +383,16 @@ class public_forums_moderate_moderate extends ipsCommand
}
/**
* Permanently remove a hard deleted post
* Permanently remove a hard deleted post. Only available via Mod CP as of 3.3.
*
* @return @e void
*/
protected function _multiRemoveHardDeletedPost()
{
$this->_resetModerator( $this->topic['forum_id'] );
$this->_genericPermissionCheck( 'delete_post' );
$_titles = array();
$this->DB->build( array(
@@ -394,12 +424,16 @@ class public_forums_moderate_moderate extends ipsCommand
}
/**
* Restore a hard deleted post
* Restore a hard deleted post. Only available via Mod CP as of 3.3.
*
* @return @e void
*/
protected function _multiRestoreHardDeletedPost()
{
$this->_resetModerator( $this->topic['forum_id'] );
$this->_genericPermissionCheck( 'delete_post' );
$this->DB->update( 'posts', array( 'queued' => 0 ), 'pid IN(' . implode( ',', $this->pids ) . ')' );
/* Remove any soft delete logs */
@@ -430,7 +464,7 @@ class public_forums_moderate_moderate extends ipsCommand
$this->cache->rebuildCache( 'stats', 'global' );
$this->modLibrary->addModerateLog( "", "", "", implode( ',', $this->pids ), sprintf( $this->lang->words['multi_post_restore'], $this->pids ) );
$this->modLibrary->addModerateLog( "", "", "", implode( ',', $this->pids ), sprintf( $this->lang->words['multi_post_restore'], implode( ',', $this->pids ) ) );
}
/**
@@ -521,41 +555,8 @@ class public_forums_moderate_moderate extends ipsCommand
$this->DB->update( 'topics', array( 'approved' => $approve_int ), 'tid=' . $this->topic['tid'] );
if( $approve_int )
if ( $approve_int )
{
$_queued = $this->registry->class_forums->fetchPostHiddenQuery( array( 'visible' ), 'p.' );
$this->DB->build( array(
'select' => 'p.*',
'from' => array( 'posts' => 'p' ),
'order' => 'pid ASC',
'where' => $_queued . ' AND p.topic_id=' . $this->topic['tid'],
'add_join' => array(
array(
'select' => 't.title, t.forum_id, t.topic_firstpost',
'from' => array( 'topics' => 't' ),
'where' => 'p.topic_id=t.tid',
'type' => 'left'
)
)
) );
$q = $this->DB->execute();
while( $r = $this->DB->fetch( $q ) )
{
/* The first post needs some different data */
if( $r['topic_firstpost'] == $r['pid'] )
{
$pid = 0;
$title = $r['title'];
}
else
{
$pid = serialize( array( 'pid' => $r['pid'], 'title' => $r['title'] ) );
$title = '';
}
}
$this->modLibrary->clearModQueueTable( 'topic', $this->topic['tid'], true );
/* Likes */
@@ -564,10 +565,7 @@ class public_forums_moderate_moderate extends ipsCommand
$_like->toggleVisibility( $this->topic['tid'], true );
/* Tagging */
if ( $this->registry->tags->isEnabled() )
{
$this->registry->tags->updateVisibilityByMetaId( $this->topic['tid'], 1 );
}
$this->registry->tags->updateVisibilityByMetaId( $this->topic['tid'], 1 );
/* Remove any soft delete logs if we are 'restoring' */
if( $this->request['do'] == 'topic_restore' )
@@ -667,9 +665,12 @@ class public_forums_moderate_moderate extends ipsCommand
protected function _multiPostModify()
{
$this->pids = $this->_getIds( 'selectedpids', 'selectedpidsJS' );
if ( count( $this->pids ) )
{
/* Set pids back for templates */
$this->request['selectedpids'] = $this->pids;
switch ( $this->request['tact'] )
{
case 'approve':
@@ -811,8 +812,8 @@ class public_forums_moderate_moderate extends ipsCommand
$this->output .= $this->registry->getClass('output')->getTemplate('mod')->movePostForm( $this->forum, $this->topic, $posts, $error );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "{$this->settings['_base_url']}showforum={$this->forum['id']}" );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "{$this->settings['_base_url']}showtopic={$this->topic['tid']}" );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "showforum={$this->forum['id']}", $this->forum['name_seo'], 'showforum' );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "showtopic={$this->topic['tid']}", $this->topic['title_seo'], 'showtopic' );
$this->registry->getClass('output')->setTitle( $this->lang->words['cmp_title'].": ".$this->topic['title'] . ' - ' . ipsRegistry::$settings['board_name']);
$this->registry->output->addContent( $this->output );
$this->registry->getClass('output')->sendOutput();
@@ -1080,11 +1081,44 @@ class public_forums_moderate_moderate extends ipsCommand
$this->_showError( 'mod_no_posts_to_del', 10376.2 );
}
foreach( $this->pids as $p )
if ( empty( $this->topic ) )
{
if ( $this->topic['topic_firstpost'] == $p )
{
$this->_showError( 'mod_delete_first_post', 10376 );
$_pid = IPSLib::cleanIntArray( $this->pids );
if ( count($_pid) > 0 )
{
$_pid = " IN(" . implode( ",", $_pid ) . ")";
}
else
{
$this->_showError( 'mod_no_posts_to_del', 10376.3 );
}
$this->DB->build( array(
'select' => 'p.pid',
'from' => array( 'posts' => 'p' ),
'add_join' => array( array(
'select' => 't.topic_firstpost',
'from' => array( 'topics' => 't' ),
'where' => 't.tid=p.topic_id',
) ),
'where' => 'pid' . $_pid ) );
$this->DB->execute();
while( $_r = $this->DB->fetch() )
{
if ( $_r['topic_firstpost'] == $_r['pid'] )
{
$this->_showError( 'mod_delete_first_post', '10376-A' );
}
}
}
else
{
foreach( $this->pids as $p )
{
if ( $this->topic['topic_firstpost'] == $p )
{
$this->_showError( 'mod_delete_first_post', 10376 );
}
}
}
@@ -1110,13 +1144,13 @@ class public_forums_moderate_moderate extends ipsCommand
{
$this->_showError( 'mod_no_tid', 10377, 404 );
}
//-----------------------------------------
// Show the form
//-----------------------------------------
if ( $this->request['checked'] != 1 )
{
{
$jump_html = $this->registry->getClass('class_forums')->buildForumJump(0,1,1);
$posts = array();
@@ -1158,14 +1192,17 @@ class public_forums_moderate_moderate extends ipsCommand
$posts[] = $row;
}
/* Pass back for templates */
$this->request['selectedpids'] = $this->pids;
//-----------------------------------------
// print my bottom, er, the bottom
//-----------------------------------------
$this->output .= $this->registry->getClass('output')->getTemplate('mod')->splitPostForm( $this->forum, $this->topic, $posts, $jump_html );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "{$this->settings['_base_url']}showforum={$this->forum['id']}" );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "{$this->settings['_base_url']}showtopic={$this->topic['tid']}" );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "showforum={$this->forum['id']}", $this->forum['name_seo'], 'showforum' );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "showtopic={$this->topic['tid']}", $this->topic['title_seo'], 'showtopic' );
$this->registry->getClass('output')->setTitle( $this->lang->words['st_top'].": ".$this->topic['title'] . ' - ' . ipsRegistry::$settings['board_name']);
$this->registry->output->addContent( $this->output );
$this->registry->getClass('output')->sendOutput();
@@ -1288,6 +1325,25 @@ class public_forums_moderate_moderate extends ipsCommand
// Complete a new dummy topic
//-----------------------------------------
if( $this->settings['etfilter_shout'] )
{
if( function_exists('mb_convert_case') )
{
if( in_array( strtolower( $this->settings['gb_char_set'] ), array_map( 'strtolower', mb_list_encodings() ) ) )
{
$this->request['title'] = mb_convert_case( $this->request['title'], MB_CASE_TITLE, $this->settings['gb_char_set'] );
}
else
{
$this->request['title'] = ucwords( strtolower( $this->request['title'] ) );
}
}
else
{
$this->request['title'] = ucwords( strtolower( $this->request['title'] ) );
}
}
$this->DB->insert( 'topics', array(
'title' => $this->request['title'],
'state' => 'open',
@@ -1298,7 +1354,6 @@ class public_forums_moderate_moderate extends ipsCommand
'last_poster_id' => 0,
'last_poster_name' => 0,
'last_post' => time(),
'icon_id' => 0,
'author_mode' => 1,
'poll_state' => 0,
'last_vote' => 0,
@@ -1352,7 +1407,10 @@ class public_forums_moderate_moderate extends ipsCommand
/* Run moderation sync */
$this->modLibrary->runModSync( 'topicSplit', $pids, $topic['tid'], $new_topic_id );
/* link http://community.invisionpower.com/tracker/issue-37361-when-splitting-topic-404/ */
$this->request['st'] = 0;
$this->_addModeratorLog( $this->lang->words['acp_split_topic'] . " '{$topic['title']}'" );
}
}
@@ -1461,7 +1519,7 @@ class public_forums_moderate_moderate extends ipsCommand
if ( $this->topic['tid'] )
{
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "{$this->settings['_base_url']}showtopic={$this->topic['tid']}" );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "showtopic={$this->topic['tid']}", $this->topic['title_seo'], 'showtopic' );
}
$this->registry->getClass('output')->addNavigation( $this->lang->words['cm_title'], '' );
@@ -1477,7 +1535,7 @@ class public_forums_moderate_moderate extends ipsCommand
$this->request['postdate'] = intval($this->request['postdate']);
if ( !$this->request['selectedpids'] or !$this->request['postdate'] or !$this->request['Post'] )
if ( empty($this->request['selectedpids']) || empty($this->request['postdate']) || empty($this->request['Post']) )
{
$this->_showError( 'mod_merge_posts', 10384 );
}
@@ -1679,7 +1737,7 @@ class public_forums_moderate_moderate extends ipsCommand
/* Show splash page */
$this->output .= $this->registry->getClass('output')->getTemplate('mod')->softDeleteSplashPosts( $this->forum, $this->topic, $this->pids, $canHardDelete );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "{$this->settings['_base_url']}showforum={$this->forum['id']}" );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "showforum={$this->forum['id']}", $this->forum['name_seo'], 'showforum' );
$this->registry->getClass('output')->setTitle( sprintf( $this->lang->words['mm_delete_top_posts'], count($this->pids) ) . ' - ' . ipsRegistry::$settings['board_name']);
$this->registry->output->addContent( $this->output );
@@ -1834,6 +1892,55 @@ class public_forums_moderate_moderate extends ipsCommand
$this->registry->output->redirectScreen( $this->lang->words['p_deleted'], $this->settings['base_url'] . "showforum=" . $this->forum['id'] . '&st=' . intval( $this->request['st'] ), $this->forum['name_seo'], 'showforum' );
}
/**
* Perma-Delete an archived topic
*
* @return @e void [Outputs to screen]
*/
protected function _deleteArchivedTopic()
{
$this->_resetModerator( $this->topic['forum_id'] );
if( !$this->_genericPermissionCheck( 'delete_topic', '', true ) )
{
if ( $this->topic['starter_id'] != $this->memberData['member_id'] OR !$this->memberData['g_delete_own_topics'] )
{
$this->_showError( 'mod_no_delete_topic', 10386, 403 );
}
}
$pids = array();
/* Restore topic first */
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/archive/restore.php', 'classes_archive_restore' );
$this->archiveRestore = new $classToLoad();
$this->archiveRestore->setApp('forums');
/* Get pids */
$this->DB->build( array( 'select' => 'archive_id',
'from' => 'forums_archive_posts',
'where' => 'archive_topic_id=' . intval( $this->topic['tid'] ) ) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
{
$pids[] = $row['archive_id'];
}
if ( count( $pids ) )
{
/* Restore ... */
$this->archiveRestore->restore( $pids );
$this->DB->update( 'topics', array( 'topic_archive_status' => $this->registry->class_forums->fetchTopicArchiveFlag( 'exclude' ) ), 'tid=' . $this->topic['tid'] );
}
/* ... now delete */
return $this->_deleteTopicPermanent();
}
/**
* Delete a topic (confirmation screen)
*
@@ -1864,9 +1971,9 @@ class public_forums_moderate_moderate extends ipsCommand
$this->output = $this->registry->getClass('output')->getTemplate('mod')->deleteTopicForm( $this->forum, $this->topic );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "{$this->settings['_base_url']}showforum={$this->forum['id']}" );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "{$this->settings['_base_url']}showtopic={$this->topic['tid']}" );
$this->registry->getClass('output')->setTitle( $this->lang->words['t_delete'].": ".$this->topic['title'] . ' - ' . ipsRegistry::$settings['board_name']);
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "showforum={$this->forum['id']}", $this->forum['name_seo'], 'showforum' );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "showtopic={$this->topic['tid']}", $this->topic['title_seo'], 'showtopic' );
$this->registry->getClass('output')->setTitle( $this->lang->words['t_delete'] . ": " . $this->topic['title'] . ' - ' . ipsRegistry::$settings['board_name']);
}
}
@@ -1877,9 +1984,9 @@ class public_forums_moderate_moderate extends ipsCommand
*/
protected function _topicHistory()
{
if ( !$this->memberData['g_access_cp'] )
if ( ! $this->memberData['g_access_cp'] )
{
$this->_showError( $error, 103119.5 );
$this->_showError( 'no_permission', 103119.5 );
}
//-----------------------------------------
@@ -1920,7 +2027,7 @@ class public_forums_moderate_moderate extends ipsCommand
'where' => 'l.topic_id=' . $this->topic['tid'],
'order' => 'l.ctime DESC',
'add_join' => array( array(
'select' => 'm.members_seo_name',
'select' => 'm.member_group_id, m.members_display_name, m.members_seo_name',
'from' => array( 'members' => 'm' ),
'where' => 'l.member_id=m.member_id',
'type' => 'left'
@@ -1931,6 +2038,9 @@ class public_forums_moderate_moderate extends ipsCommand
while ( $row = $this->DB->fetch() )
{
/* No member name? */
$row['members_display_name'] = empty($row['members_display_name']) ? $row['member_name'] : $row['members_display_name'];
$mod_logs[] = $row;
}
@@ -1938,10 +2048,10 @@ class public_forums_moderate_moderate extends ipsCommand
foreach( $this->registry->class_forums->forumsBreadcrumbNav( $this->topic['forum_id'] ) as $_nav )
{
$this->registry->getClass('output')->addNavigation( $_nav[0], $_nav[1] );
$this->registry->getClass('output')->addNavigation( $_nav[0], $_nav[1], $_nav[2], $_nav[3] );
}
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "{$this->settings['_base_url']}showtopic={$this->topic['tid']}" );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "showtopic={$this->topic['tid']}", $this->topic['title_seo'], 'showtopic' );
$this->registry->getClass('output')->setTitle( $this->topic['title'] . ' - ' . ipsRegistry::$settings['board_name']);
}
@@ -1975,10 +2085,10 @@ class public_forums_moderate_moderate extends ipsCommand
foreach( $this->registry->class_forums->forumsBreadcrumbNav( $this->topic['forum_id'] ) as $_nav )
{
$this->registry->getClass('output')->addNavigation( $_nav[0], $_nav[1] );
$this->registry->getClass('output')->addNavigation( $_nav[0], $_nav[1], $_nav[2], $_nav[3] );
}
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "{$this->settings['_base_url']}showtopic={$this->topic['tid']}" );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "showtopic={$this->topic['tid']}", $this->topic['title_seo'], 'showtopic' );
$this->registry->getClass('output')->setTitle( $this->lang->words['ts_title']." &gt; ".$this->topic['title'] . ' - ' . ipsRegistry::$settings['board_name']);
}
@@ -2015,9 +2125,9 @@ class public_forums_moderate_moderate extends ipsCommand
$this->output .= $this->registry->getClass('output')->getTemplate('mod')->mergeTopicsForm( $this->forum, $this->topic );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "{$this->settings['_base_url']}showforum={$this->forum['id']}" );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "{$this->settings['_base_url']}showtopic={$this->topic['tid']}" );
$this->registry->getClass('output')->setTitle( $this->lang->words['mt_top']." ".$this->topic['title'] . ' - ' . ipsRegistry::$settings['board_name']);
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "showforum={$this->forum['id']}", $this->forum['name_seo'], 'showforum' );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "showtopic={$this->topic['tid']}", $this->topic['title_seo'], 'showtopic' );
$this->registry->getClass('output')->setTitle( $this->lang->words['mt_top'] . " " . $this->topic['title'] . ' - ' . ipsRegistry::$settings['board_name']);
}
/**
@@ -2133,10 +2243,10 @@ class public_forums_moderate_moderate extends ipsCommand
if ( $old_topic_poll['pid'] and !$main_topic_poll['pid'] )
{
// Make that poll the poll for the master topic
$this->DB->update( 'polls', array( 'tid' => $this->topic['tid'] ), "tid={$old_topic_poll}" );
$this->DB->update( 'polls', array( 'tid' => $this->topic['tid'] ), "tid={$old_topic_poll['tid']}" );
// Make the votes for that now
$this->DB->update( 'voters', array( 'tid' => $this->topic['tid'] ), "tid={$old_topic_poll}" );
$this->DB->update( 'voters', array( 'tid' => $this->topic['tid'] ), "tid={$old_topic_poll['tid']}" );
// Let the master topic know that it has a poll now
$this->DB->update( 'topics', array( 'poll_state' => 1 ), "tid={$this->topic['tid']}" );
@@ -2171,8 +2281,8 @@ class public_forums_moderate_moderate extends ipsCommand
{
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'public_topic' ) );
$this->output .= $this->registry->getClass('output')->getTemplate('mod')->mergeMultiplePolls( array( $main_topic_poll, $old_topic_poll ), ",{$main_topic_poll['tid']},{$old_topic_poll['tid']}" );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "{$this->settings['_base_url']}showforum={$this->forum['id']}" );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "{$this->settings['_base_url']}showtopic={$this->topic['tid']}" );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "showforum={$this->forum['id']}", $this->forum['name_seo'], 'showforum' );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "showtopic={$this->topic['tid']}", $this->topic['title_seo'], 'showtopic' );
$this->registry->getClass('output')->setTitle( $this->lang->words['mt_top']." ".$this->topic['title'] . ' - ' . ipsRegistry::$settings['board_name']);
return false;
}
@@ -2209,6 +2319,10 @@ class public_forums_moderate_moderate extends ipsCommand
$this->registry->tags->moveTagsByMetaId( $old_topic['tid'], $this->topic['tid'] );
// Resync to remove duplicate tags - see bug report 34475
$tags = $this->registry->tags->getTagsByMetaId( $this->topic['tid'] );
$this->registry->tags->replace( $tags['tags'], array( 'meta_id' => $this->topic['tid'] ) );
//-----------------------------------------
// Update the newly merged topic
//-----------------------------------------
@@ -2319,7 +2433,7 @@ class public_forums_moderate_moderate extends ipsCommand
{
$this->registry->output->addNavigation( $_nav[0], $_nav[1], $_nav[2], $_nav[3] );
}
$this->registry->output->addNavigation( $this->topic['title'], "{$this->settings['_base_url']}showtopic={$this->topic['tid']}", $this->topic['title_seo'], 'showtopic' );
$this->registry->output->addNavigation( $this->topic['title'], "showtopic={$this->topic['tid']}", $this->topic['title_seo'], 'showtopic' );
$this->registry->getClass('output')->setTitle( $this->lang->words['t_move'].": ".$this->topic['title'] . ' - ' . ipsRegistry::$settings['board_name']);
}
@@ -2479,7 +2593,7 @@ class public_forums_moderate_moderate extends ipsCommand
}
}
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "{$this->settings['_base_url']}showtopic={$this->topic['tid']}" );
$this->registry->getClass('output')->addNavigation( $this->topic['title'], "showtopic={$this->topic['tid']}", $this->topic['title_seo'], 'showtopic' );
$this->registry->getClass('output')->setTitle( $this->lang->words['t_edit'].": ".$this->topic['title'] . ' - ' . ipsRegistry::$settings['board_name']);
}
@@ -2505,6 +2619,25 @@ class public_forums_moderate_moderate extends ipsCommand
$this->request['TopicTitle'] = $_postClass->cleanTopicTitle( $this->request['TopicTitle'] );
$this->request['TopicTitle'] = trim( IPSText::getTextClass( 'bbcode' )->stripBadWords( $this->request['TopicTitle'] ) );
if( $this->settings['etfilter_shout'] )
{
if( function_exists('mb_convert_case') )
{
if( in_array( strtolower( $this->settings['gb_char_set'] ), array_map( 'strtolower', mb_list_encodings() ) ) )
{
$this->request['TopicTitle'] = mb_convert_case( $this->request['TopicTitle'], MB_CASE_TITLE, $this->settings['gb_char_set'] );
}
else
{
$this->request['TopicTitle'] = ucwords( strtolower( $this->request['TopicTitle'] ) );
}
}
else
{
$this->request['TopicTitle'] = ucwords( strtolower( $this->request['TopicTitle'] ) );
}
}
$this->request['TopicDesc'] = trim( IPSText::getTextClass( 'bbcode' )->stripBadWords( $this->request['TopicDesc'] ) );
$this->request['TopicDesc'] = IPSText::mbsubstr( $this->request['TopicDesc'], 0, 70 );
@@ -2589,7 +2722,7 @@ class public_forums_moderate_moderate extends ipsCommand
$moveto = intval($this->request['df']);
$date = 0;
$ignore_pin = intval( $this->request['ignore_pin'] );
if( $dateline )
{
$date = time() - $dateline*60*60*24;
@@ -2619,31 +2752,13 @@ class public_forums_moderate_moderate extends ipsCommand
}
//-----------------------------------------
// Check for an attempt to move into a subwrap forum
// Done?
//-----------------------------------------
$f = $this->registry->class_forums->allForums[ $moveto ];
if ( $f['sub_can_post'] != 1 )
{
$this->_showError( 'mod_forum_no_posts', 103102 );
}
$num_rows = 0;
if( $this->modLibrary->topicMove( $tid_array, $source, $moveto ) )
{
$num_rows = count($tid_array);
}
$this->_addModeratorLog( $this->lang->words['acp_mass_moved'] );
//-----------------------------------------
// Show results or refresh..
//-----------------------------------------
if ( ! $num_rows )
if ( empty( $tid_array ) )
{
$this->_addModeratorLog( $this->lang->words['acp_mass_moved'] );
//-----------------------------------------
// Update forum deletion
//-----------------------------------------
@@ -2664,17 +2779,36 @@ class public_forums_moderate_moderate extends ipsCommand
$this->request[ 'check'] = 0 ;
$this->_pruneStart( $this->registry->getClass('output')->getTemplate('mod')->simplePage( $this->lang->words['cp_results'], $this->lang->words['cp_result_move'] . ($max) ) );
}
else
{
$link = "app=forums&amp;module=moderate&amp;section=moderate&amp;f={$this->forum['id']}&amp;do=prune_move&amp;df=" . $this->request['df'] . "&amp;pergo={$pergo}&amp;current={$maxdone}&amp;max={$max}";
$link .= "&amp;starter={$starter}&amp;state={$state}&amp;posts={$posts}&amp;dateline={$dateline}&amp;ignore_pin={$ignore_pin}";
$link .= "&amp;auth_key=".$this->member->form_hash;
$done = $current + $num_rows;
$text = sprintf( $this->lang->words['cp_batch_done'], $done, $max - $done );
$this->registry->output->redirectScreen( $text, $this->settings['base_url'] . $link );
return;
}
//-----------------------------------------
// Check for an attempt to move into a subwrap forum
//-----------------------------------------
$f = $this->registry->class_forums->allForums[ $moveto ];
if ( $f['sub_can_post'] != 1 )
{
$this->_showError( 'mod_forum_no_posts', 103102 );
}
$this->modLibrary->topicMove( $tid_array, $source, $moveto );
//-----------------------------------------
// Refresh..
//-----------------------------------------
$num_rows = count($tid_array);
$link = "app=forums&amp;module=moderate&amp;section=moderate&amp;f={$this->forum['id']}&amp;do=prune_move&amp;df=" . $this->request['df'] . "&amp;pergo={$pergo}&amp;current={$maxdone}&amp;max={$max}";
$link .= "&amp;starter={$starter}&amp;state={$state}&amp;posts={$posts}&amp;dateline={$dateline}&amp;ignore_pin={$ignore_pin}";
$link .= "&amp;auth_key=".$this->member->form_hash;
$done = $current + $num_rows;
$text = sprintf( $this->lang->words['cp_batch_done'], $done, $max - $done );
$this->registry->output->redirectScreen( $text, $this->settings['base_url'] . $link );
}
/**
@@ -3096,7 +3230,7 @@ class public_forums_moderate_moderate extends ipsCommand
/* Show splash page */
$this->output .= $this->registry->getClass('output')->getTemplate('mod')->softDeleteSplash( $this->forum, $this->tids, $canHardDelete );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "{$this->settings['_base_url']}showforum={$this->forum['id']}" );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "showforum={$this->forum['id']}", $this->forum['name_seo'], 'showforum' );
$this->registry->getClass('output')->setTitle( sprintf( $this->lang->words['mm_delete_top'], count($this->tids) ) . ' - ' . ipsRegistry::$settings['board_name']);
$this->registry->output->addContent( $this->output );
@@ -3183,9 +3317,7 @@ class public_forums_moderate_moderate extends ipsCommand
$polls = array();
/* Who has a poll? */
$pollForFirstTopic = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'polls', 'where' => "tid={$first_topic['tid']}" ) );
$this->DB->build( array( 'select' => '*', 'from' => 'polls', 'where' => $this->DB->buildWherePermission( $merge_ids, 'tid', FALSE ) ) );
$this->DB->build( array( 'select' => '*', 'from' => 'polls', 'where' => "tid={$main_topic_id} OR tid IN(" . implode( ',', $merge_ids ) . ")" ) );
$this->DB->execute();
while ( $row = $this->DB->fetch() )
@@ -3194,53 +3326,48 @@ class public_forums_moderate_moderate extends ipsCommand
}
/* We have one poll */
if ( !$pollForFirstTopic['pid'] and count( $polls ) == 1 )
if ( count($polls) == 1 )
{
// Make that poll the poll for the master topic
$this->DB->update( 'polls', array( 'tid' => $main_topic_id ), $this->DB->buildWherePermission( $merge_ids, 'tid', FALSE ) );
// Make the votes for that now
$this->DB->update( 'voters', array( 'tid' => $main_topic_id ), $this->DB->buildWherePermission( $merge_ids, 'tid', FALSE ) );
// Let the master topic know that it has a poll now
$this->DB->update( 'topics', array( 'poll_state' => 1 ), "tid={$main_topic_id}" );
/* Update the poll ONLY if it's not our main one */
if ( empty($polls[ $main_topic_id ]) )
{
$this->DB->update( 'polls', array( 'tid' => $main_topic_id ), "tid IN(" . implode( ',', $merge_ids ) . ")" );
$this->DB->update( 'voters', array( 'tid' => $main_topic_id ), "tid IN(" . implode( ',', $merge_ids ) . ")" );
$this->DB->update( 'topics', array( 'poll_state' => 1 ), "tid={$main_topic_id}" );
}
}
/* There's more than one poll to deal with */
else if( $pollForFirstTopic['pid'] OR count($polls) )
elseif (count($polls) > 1 )
{
// Have we selected one?
if ( $this->request['chosenpolltid'] )
$chosenTid = intval( $this->request['chosenpolltid'] );
if ( $chosenTid )
{
$chosenTid = intval( $this->request['chosenpolltid'] );
/* Chosen one is not from the main topic? */
if ( $chosenTid != $main_topic_id )
{
$this->DB->delete( 'polls', "tid={$main_topic_id}" );
$this->DB->delete( 'voters', "tid={$main_topic_id}" );
// Update poll status here if the chosen poll is not from the main topic otherwise there's no need to.. right? ;P
$this->DB->update( 'topics', array( 'poll_state' => 1 ), "tid={$main_topic_id}" );
}
// Remove the non chosen ones
$this->DB->delete( 'polls', "tid={$main_topic_id}" );
$this->DB->delete( 'polls', $this->DB->buildWherePermission( $merge_ids, 'tid', FALSE ) . " AND tid <> {$chosenTid}" );
$this->DB->delete( 'voters', "tid={$main_topic_id}" );
$this->DB->delete( 'voters', $this->DB->buildWherePermission( $merge_ids, 'tid', FALSE ) . " AND tid <> {$chosenTid}" );
$this->DB->delete( 'polls', "tid IN(" . implode( ',', $merge_ids ) . ")" . " AND tid <> {$chosenTid}" );
$this->DB->delete( 'voters', "tid IN(" . implode( ',', $merge_ids ) . ")" . " AND tid <> {$chosenTid}" );
// Make the chosen poll the poll for the master topic
$this->DB->update( 'polls', array( 'tid' => $main_topic_id ), "tid={$chosenTid}" );
// Make the votes for that now
// Update the master topic
$this->DB->update( 'polls', array( 'tid' => $main_topic_id ), "tid={$chosenTid}" );
$this->DB->update( 'voters', array( 'tid' => $main_topic_id ), "tid={$chosenTid}" );
// Let the master topic know that it has a poll now
$this->DB->update( 'topics', array( 'poll_state' => 1 ), "tid={$main_topic_id}" );
}
// No? Well ask them which one to keep
else
{
if ( $pollForFirstTopic['tid'] )
{
array_unshift( $polls, $pollForFirstTopic );
}
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'public_topic' ) );
$this->output .= $this->registry->getClass('output')->getTemplate('mod')->mergeMultiplePolls( $polls, $this->request['selectedtids'] );
$this->registry->getClass('output')->addNavigation( 'foo', 'bar' );
return false;
}
}
@@ -3279,7 +3406,7 @@ class public_forums_moderate_moderate extends ipsCommand
//-----------------------------------------
$this->modLibrary->rebuildTopic( $main_topic_id );
$this->registry->class_forums->allForums[ $this->forum['id'] ]['_update_deletion'] = 1;
$this->modLibrary->forumRecount( $this->forum['id'] );
$this->cache->rebuildCache( 'stats', 'global' );
@@ -3287,6 +3414,9 @@ class public_forums_moderate_moderate extends ipsCommand
/* Tags */
$this->registry->tags->moveTagsByMetaId( $tids, $main_topic_id );
/* Make read */
$this->registry->getClass('classItemMarking')->markRead( array( 'forumID' => $first_topic['forum_id'], 'itemID' => $main_topic_id, 'markDate' => time(), 'containerLastActivityDate' => $this->registry->class_forums->allForums[ $first_topic['forum_id'] ]['last_post'] ) );
/* Run Sync */
foreach ( $merge_ids as $mid )
{
@@ -3488,7 +3618,7 @@ class public_forums_moderate_moderate extends ipsCommand
if( $this->forum['name'] )
{
$this->registry->getClass('output')->addNavigation( $this->forum['name'], $this->settings['base_url'] . "showforum={$this->forum['id']}" );
$this->registry->getClass('output')->addNavigation( $this->forum['name'], "showforum={$this->forum['id']}", $this->forum['name_seo'], 'showforum' );
}
else
{
@@ -1,342 +1,350 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.2.3
* Moderator actions
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: ips_terabyte $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license This is NULLED!
* @package IP.Board
* @subpackage Forums
* @link http://hatynka.in
* @version $Revision: 8644 $
*
*/
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
*
* @var string
*/
public $output;
/**
* Moderator function library
*
* @var object
*/
protected $modLibrary;
/**
* Moderator information
*
* @var array Array of moderator details
*/
protected $moderator = array();
/**
* Forum information
*
* @var array Array of forum details
*/
protected $forum = array();
/**
* Topic information
*
* @var array Array of topic details
*/
protected $topic = array();
/**
* Topic id
*
* @var integer Topic id
*/
protected $topic_id = 0;
/**
* Forum id
*
* @var integer Forum id
*/
protected $forum_id = 0;
/**
* Multimod id
*
* @var integer Multimod id
*/
protected $mm_id = 0;
/**
* Multimod data
*
* @var array Multimod data
*/
protected $mm_data = array();
/**
* Class entry point
*
* @param object Registry reference
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Load modules...
//-----------------------------------------
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_mod' ) );
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/sources/classes/moderate.php', 'moderatorLibrary', 'forums' );
$this->modLibrary = new $classToLoad( $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, null, null, 404 );
}
//-----------------------------------------
// 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, null, null, 404 );
}
//-----------------------------------------
// Error out if we can not find the forum
//-----------------------------------------
if ( !$this->forum['id'] )
{
$this->registry->output->showError( 'multimod_no_topic', 103123, null, null, 404 );
}
//-----------------------------------------
// 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, null, null, 403 );
}
//-----------------------------------------
// 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, null, null, 403 );
}
$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'] )
{
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'] );
$this->cache->rebuildCache( 'stats', 'global' );
//-----------------------------------------
// 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'], 'showforum' );
}
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* Moderator actions
* Last Updated: $Date: 2012-06-13 12:05:06 -0400 (Wed, 13 Jun 2012) $
* </pre>
*
* @author $Author: AndyMillne $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Revision: 10916 $
*
*/
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
*
* @var string
*/
public $output;
/**
* Moderator function library
*
* @var object
*/
protected $modLibrary;
/**
* Moderator information
*
* @var array Array of moderator details
*/
protected $moderator = array();
/**
* Forum information
*
* @var array Array of forum details
*/
protected $forum = array();
/**
* Topic information
*
* @var array Array of topic details
*/
protected $topic = array();
/**
* Topic id
*
* @var integer Topic id
*/
protected $topic_id = 0;
/**
* Forum id
*
* @var integer Forum id
*/
protected $forum_id = 0;
/**
* Multimod id
*
* @var integer Multimod id
*/
protected $mm_id = 0;
/**
* Multimod data
*
* @var array Multimod data
*/
protected $mm_data = array();
/**
* Class entry point
*
* @param object Registry reference
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Load modules...
//-----------------------------------------
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_mod' ) );
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/sources/classes/moderate.php', 'moderatorLibrary', 'forums' );
$this->modLibrary = new $classToLoad( $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, null, null, 404 );
}
//-----------------------------------------
// 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, null, null, 404 );
}
//-----------------------------------------
// Error out if we can not find the forum
//-----------------------------------------
if ( !$this->forum['id'] )
{
$this->registry->output->showError( 'multimod_no_topic', 103123, null, null, 404 );
}
//-----------------------------------------
// Are we a moderator?
//-----------------------------------------
if ( $this->memberData['member_id'] && ! $this->memberData['g_is_supmod'] )
{
/**
* @link http://community.invisionpower.com/tracker/issue-37736-multi-moderationsecondary-group-permissions/
*/
$this->moderator = empty($this->memberData['forumsModeratorData'][ $this->forum['id'] ]) ? array() : $this->memberData['forumsModeratorData'][ $this->forum['id'] ];
/*$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, null, null, 403 );
}
//-----------------------------------------
// 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, null, null, 403 );
}
$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();
/* Bug #36869: Approving a topic doesn't increment user post count */
$this->modLibrary->clearModQueueTable( 'topic', $this->topic['tid'], true );
}
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( IPSText::UNhtmlspecialchars( $this->mm_data['topic_title_st'] ) . $title . IPSText::UNhtmlspecialchars( $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'] )
{
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(
$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'] );
$this->cache->rebuildCache( 'stats', 'global' );
//-----------------------------------------
// 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'], 'showforum' );
}
}
@@ -3,11 +3,11 @@
* @file defaultSection.php Define the default section for the 'post' module
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: This is NULLED!
* $License: http://www.invisionpower.com/company/standards.php#license$
* $Author: ips_terabyte $
* @since 14th May 2003
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
* @version v3.2.3
* @version v3.3.4
* $Revision: 8655 $
*/
@@ -1,10 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
File diff suppressed because it is too large. Load diff