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,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' );
}
}