Version 3.0.5
This commit is contained in:
1 parent
19b38c7c74
commit
1d4720f3e2
3755 files changed
+508378
-664541
No files matched your search
@@ -0,0 +1,187 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Forums application initialization
|
||||
* Last Updated: $LastChangedDate: 2009-12-01 17:42:17 -0500 (Tue, 01 Dec 2009) $
|
||||
*
|
||||
* @author $Author: josh $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 14th May 2003
|
||||
* @version $Rev: 5501 $
|
||||
*/
|
||||
|
||||
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 app_class_forums
|
||||
{
|
||||
/**#@+
|
||||
* Registry Object Shortcuts
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $registry;
|
||||
protected $DB;
|
||||
protected $settings;
|
||||
protected $request;
|
||||
protected $lang;
|
||||
protected $member;
|
||||
protected $cache;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry )
|
||||
{
|
||||
/* Make object */
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
$this->lang = $this->registry->getClass('class_localization');
|
||||
$this->member = $this->registry->member();
|
||||
$this->memberData =& $this->registry->member()->fetchMemberData();
|
||||
|
||||
if ( IN_ACP )
|
||||
{
|
||||
try
|
||||
{
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . "/sources/classes/forums/class_forums.php" );
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . "/sources/classes/forums/admin_forum_functions.php" );
|
||||
|
||||
$this->registry->setClass( 'class_forums', new admin_forum_functions( $registry ) );
|
||||
$this->registry->getClass('class_forums')->strip_invisible = 0;
|
||||
}
|
||||
catch( Exception $error )
|
||||
{
|
||||
IPS_exception_error( $error );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . "/sources/classes/forums/class_forums.php" );
|
||||
$this->registry->setClass( 'class_forums', new class_forums( $registry ) );
|
||||
$this->registry->getClass('class_forums')->strip_invisible = 1;
|
||||
}
|
||||
catch( Exception $error )
|
||||
{
|
||||
IPS_exception_error( $error );
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------
|
||||
// Grab and cache the topic now as we need the 'f' attr for
|
||||
// the skins...
|
||||
//---------------------------------------------------
|
||||
|
||||
if ( isset( $_GET['showtopic'] ) AND $_GET['showtopic'] != '' )
|
||||
{
|
||||
$this->request['t'] = intval( $_GET['showtopic'] );
|
||||
|
||||
if ( $this->settings['cpu_watch_update'] AND $this->memberData['member_id'] )
|
||||
{
|
||||
$this->DB->build( array( 'select' => 't.*',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.tid=' . $this->request['t'],
|
||||
'add_join' => array( array( 'select' => 'w.trid as trackingTopic',
|
||||
'from' => array( 'tracker' => 'w' ),
|
||||
'where' => 'w.topic_id=t.tid AND w.member_id=' . $this->memberData['member_id'],
|
||||
'type' => 'left' ) ) ) );
|
||||
$this->DB->execute();
|
||||
|
||||
$topic = $this->DB->fetch();
|
||||
}
|
||||
else
|
||||
{
|
||||
$topic = $this->DB->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'topics',
|
||||
'where' => "tid=" . $this->request['t'],
|
||||
) );
|
||||
}
|
||||
|
||||
$this->registry->getClass('class_forums')->topic_cache = $topic;
|
||||
|
||||
$this->request['f'] = $topic['forum_id'];
|
||||
|
||||
/* Update query location */
|
||||
$this->member->sessionClass()->addQueryKey( 'location_2_id', ipsRegistry::$request['f'] );
|
||||
}
|
||||
|
||||
$this->registry->getClass('class_forums')->forumsInit();
|
||||
|
||||
//-----------------------------------------
|
||||
// Set up moderators
|
||||
//-----------------------------------------
|
||||
|
||||
$this->memberData = $this->registry->getClass('class_forums')->setUpModerator( $this->memberData );
|
||||
}
|
||||
|
||||
/**
|
||||
* Do some set up after ipsRegistry::init()
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function afterOutputInit()
|
||||
{
|
||||
if ( isset( $_GET['showtopic'] ) AND $_GET['showtopic'] != '' AND is_array( $this->registry->getClass('class_forums')->topic_cache ) )
|
||||
{
|
||||
$topic = $this->registry->getClass('class_forums')->topic_cache;
|
||||
|
||||
if ( IPB_USE_ONLY_ID_FURL )
|
||||
{
|
||||
$topic['title_seo'] = $topic['tid'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$topic['title_seo'] = ( $topic['title_seo'] ) ? $topic['title_seo'] : IPSText::makeSeoTitle( $topic['title'] );
|
||||
}
|
||||
|
||||
/* Check TOPIC permalink... */
|
||||
$this->registry->getClass('output')->checkPermalink( $topic['title_seo'] );
|
||||
|
||||
/* Add canonical tag */
|
||||
$this->registry->getClass('output')->addCanonicalTag( ( $this->request['st'] ) ? 'showtopic=' . $topic['tid'] . '&st=' . $this->request['st'] : 'showtopic=' . $topic['tid'], $topic['title_seo'], 'showtopic' );
|
||||
}
|
||||
else if ( isset( $_GET['showforum'] ) AND $_GET['showforum'] != '' )
|
||||
{
|
||||
$data = $this->registry->getClass('class_forums')->forumsFetchData( $_GET['showforum'] );
|
||||
|
||||
if ( IPB_USE_ONLY_ID_FURL )
|
||||
{
|
||||
$data['name_seo'] = $data['id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['name_seo'] = ( $data['name_seo'] ) ? $data['name_seo'] : IPSText::makeSeoTitle( $data['name'] );
|
||||
}
|
||||
|
||||
/* Check FORUM permalink... */
|
||||
$this->registry->getClass('output')->checkPermalink( $data['name_seo'] );
|
||||
|
||||
/* Add canonical tag */
|
||||
if( $data['id'] )
|
||||
{
|
||||
$this->registry->getClass('output')->addCanonicalTag( ( $this->request['st'] ) ? 'showforum=' . $data['id'] . '&st=' . $this->request['st'] : 'showforum=' . $data['id'], $data['name_seo'], 'showforum' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Group property updater (Forums)
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 4948 $
|
||||
*
|
||||
*/
|
||||
|
||||
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 admin_group_form__forums implements admin_group_form
|
||||
{
|
||||
/**
|
||||
* Tab name
|
||||
* This can be left blank and the application title will
|
||||
* be used
|
||||
*
|
||||
* @access public
|
||||
* @var string Tab name
|
||||
*/
|
||||
public $tab_name = "";
|
||||
|
||||
|
||||
/**
|
||||
* Returns content for the page.
|
||||
*
|
||||
* @access public
|
||||
* @author Brandon Farber
|
||||
* @param array Group data
|
||||
* @param integer Number of tabs used so far
|
||||
* @return array Array of tabs, content
|
||||
*/
|
||||
public function getDisplayContent( $group=array(), $tabsUsed = 2 )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load skin
|
||||
//-----------------------------------------
|
||||
|
||||
$this->html = ipsRegistry::getClass('output')->loadTemplate('cp_skin_group_form', 'forums');
|
||||
|
||||
//-----------------------------------------
|
||||
// Load lang
|
||||
//-----------------------------------------
|
||||
|
||||
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'admin_forums' ), 'forums' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Show...
|
||||
//-----------------------------------------
|
||||
|
||||
return array( 'tabs' => $this->html->acp_group_form_tabs( $group, ( $tabsUsed + 1 ) ), 'content' => $this->html->acp_group_form_main( $group, ( $tabsUsed + 1 ) ), 'tabsUsed' => 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the entries for saving and return
|
||||
*
|
||||
* @access public
|
||||
* @author Brandon Farber
|
||||
* @return array Array of keys => values for saving
|
||||
*/
|
||||
public function getForSave()
|
||||
{
|
||||
$return = array(
|
||||
'g_other_topics' =>ipsRegistry::$request['g_other_topics'],
|
||||
'g_post_new_topics' =>ipsRegistry::$request['g_post_new_topics'],
|
||||
'g_reply_own_topics' =>ipsRegistry::$request['g_reply_own_topics'],
|
||||
'g_reply_other_topics' =>ipsRegistry::$request['g_reply_other_topics'],
|
||||
'g_edit_posts' =>ipsRegistry::$request['g_edit_posts'],
|
||||
'g_edit_cutoff' =>ipsRegistry::$request['g_edit_cutoff'],
|
||||
'g_delete_own_posts' =>ipsRegistry::$request['g_delete_own_posts'],
|
||||
'g_open_close_posts' =>ipsRegistry::$request['g_open_close_posts'],
|
||||
'g_delete_own_topics' =>ipsRegistry::$request['g_delete_own_topics'],
|
||||
'g_post_polls' =>ipsRegistry::$request['g_post_polls'],
|
||||
'g_vote_polls' =>ipsRegistry::$request['g_vote_polls'],
|
||||
'g_can_remove' =>ipsRegistry::$request['g_can_remove'] ? intval(ipsRegistry::$request['g_can_remove'] ) : 0,
|
||||
'g_append_edit' =>ipsRegistry::$request['g_append_edit'],
|
||||
'g_avoid_q' =>ipsRegistry::$request['g_avoid_q'],
|
||||
'g_avoid_flood' =>ipsRegistry::$request['g_avoid_flood'],
|
||||
'g_post_closed' =>ipsRegistry::$request['g_post_closed'],
|
||||
'g_edit_topic' =>ipsRegistry::$request['g_edit_topic'],
|
||||
'g_topic_rate_setting' => intval(ipsRegistry::$request['g_topic_rate_setting']),
|
||||
'g_mod_preview' => ipsRegistry::$request['g_mod_preview'],
|
||||
'g_mod_post_unit' => intval( ipsRegistry::$request['g_mod_post_unit'] ),
|
||||
'g_ppd_unit' => intval( ipsRegistry::$request['g_ppd_unit'] ),
|
||||
'g_ppd_limit' => intval( ipsRegistry::$request['g_ppd_limit'] ),
|
||||
);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Member property updater (AJAX)
|
||||
* Last Updated: $Date: 2009-12-01 17:42:17 -0500 (Tue, 01 Dec 2009) $
|
||||
*
|
||||
* @author $Author: josh $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Revision: 5501 $
|
||||
*
|
||||
*/
|
||||
|
||||
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 admin_member_form__forums implements admin_member_form
|
||||
{
|
||||
/**
|
||||
* Tab name
|
||||
* This can be left blank and the application title will
|
||||
* be used
|
||||
*
|
||||
* @access public
|
||||
* @var string Tab name
|
||||
*/
|
||||
public $tab_name = "";
|
||||
|
||||
|
||||
/**
|
||||
* Returns sidebar links for this tab
|
||||
* You may return an empty array or FALSE to not have
|
||||
* any links show in the sidebar for this block.
|
||||
*
|
||||
* The links must have 'section=xxxxx&module=xxxxx[&do=xxxxxx]'. The rest of the URL
|
||||
* is added automatically.
|
||||
*
|
||||
* The image must be a full URL or blank to use a default image.
|
||||
*
|
||||
* Use the format:
|
||||
* $array[] = array( 'img' => '', 'url' => '', 'title' => '' );
|
||||
*
|
||||
* @access public
|
||||
* @author Matt Mecham
|
||||
* @param array Member data
|
||||
* @return array Array of links
|
||||
*/
|
||||
public function getSidebarLinks( $member=array() )
|
||||
{
|
||||
|
||||
//-----------------------------------------
|
||||
// Load lang
|
||||
//-----------------------------------------
|
||||
|
||||
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'admin_forums' ), 'forums' );
|
||||
|
||||
|
||||
$array = array();
|
||||
|
||||
$array[] = array( 'img' => '',
|
||||
'url' => 'section=tools&module=tools&do=deleteposts',
|
||||
'title' => ipsRegistry::getClass('class_localization')->words['m_deltitle'] );
|
||||
|
||||
$array[] = array( 'img' => '',
|
||||
'url' => 'section=tools&module=tools&do=deletesubscriptions',
|
||||
'title' => ipsRegistry::getClass('class_localization')->words['m_delsubs'] );
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns content for the page.
|
||||
*
|
||||
* @access public
|
||||
* @author Matt Mecham
|
||||
* @param array Member data
|
||||
* @return array Array of tabs, content
|
||||
*/
|
||||
public function getDisplayContent( $member=array() )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load skin
|
||||
//-----------------------------------------
|
||||
|
||||
$this->html = ipsRegistry::getClass('output')->loadTemplate('cp_skin_member_form', 'forums');
|
||||
|
||||
//-----------------------------------------
|
||||
// Load lang
|
||||
//-----------------------------------------
|
||||
|
||||
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'admin_forums' ), 'forums' );
|
||||
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'admin_member_form' ), 'forums' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get member data
|
||||
//-----------------------------------------
|
||||
|
||||
// $member = IPSMember::load( $member['member_id'], 'extendedProfile' );
|
||||
$member['_avatar'] = str_replace( '<img ', '<img id="MF__avatar" ', IPSMember::buildAvatar( $member ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Show...
|
||||
//-----------------------------------------
|
||||
|
||||
return array( 'tabs' => $this->html->acp_member_form_tabs( $member ), 'content' => $this->html->acp_member_form_main( $member ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the entries for saving and return
|
||||
*
|
||||
* @access public
|
||||
* @author Brandon Farber
|
||||
* @return array Multi-dimensional array (core, extendedProfile) for saving
|
||||
*/
|
||||
public function getForSave()
|
||||
{
|
||||
$return = array( 'core' => array(), 'extendedProfile' => array() );
|
||||
|
||||
$return['core']['posts'] = intval(ipsRegistry::$request['posts']);
|
||||
$return['core']['view_avs'] = intval(ipsRegistry::$request['view_avs']);
|
||||
$return['core']['view_img'] = intval(ipsRegistry::$request['view_img']);
|
||||
$return['core']['restrict_post'] = ipsRegistry::$request['post_indef'] ? 1 : ( ipsRegistry::$request['post_timespan'] > 0 ? IPSMember::processBanEntry( array( 'timespan' => intval(ipsRegistry::$request['post_timespan']), 'unit' => ipsRegistry::$request['post_units'] ) ) : '' );
|
||||
$return['core']['mod_posts'] = ipsRegistry::$request['mod_indef'] ? 1 : ( ipsRegistry::$request['mod_timespan'] > 0 ? IPSMember::processBanEntry( array( 'timespan' => intval(ipsRegistry::$request['mod_timespan']), 'unit' => ipsRegistry::$request['mod_units'] ) ) : '' );
|
||||
$return['core']['org_perm_id'] = ipsRegistry::$request['org_perm_id'] ? ',' . implode( ",", ipsRegistry::$request['org_perm_id'] ) . ',' : '';
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,636 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Forum permissions mappings
|
||||
*
|
||||
* @author $author$
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 4948 $
|
||||
**/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
$_PERM_CONFIG = array( 'Forum' );
|
||||
|
||||
class forumsPermMappingForum
|
||||
{
|
||||
/**
|
||||
* Mapping of keys to columns
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private $mapping = array(
|
||||
'view' => 'perm_view',
|
||||
'read' => 'perm_2',
|
||||
'reply' => 'perm_3',
|
||||
'start' => 'perm_4',
|
||||
'upload' => 'perm_5',
|
||||
'download' => 'perm_6'
|
||||
);
|
||||
|
||||
/**
|
||||
* Mapping of keys to names
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private $perm_names = array(
|
||||
'view' => 'Show Forum',
|
||||
'read' => 'Read Topics',
|
||||
'reply' => 'Reply Topics',
|
||||
'start' => 'Start Topics',
|
||||
'upload' => 'Upload',
|
||||
'download' => 'Download',
|
||||
);
|
||||
|
||||
/**
|
||||
* Mapping of keys to background colors for the form
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private $perm_colors = array(
|
||||
'view' => '#fff0f2',
|
||||
'read' => '#effff6',
|
||||
'reply' => '#edfaff',
|
||||
'start' => '#f0f1ff',
|
||||
'upload' => '#fffaee',
|
||||
'download' => '#ffeef9',
|
||||
);
|
||||
|
||||
/**
|
||||
* Method to pull the key/column mapping
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getMapping()
|
||||
{
|
||||
return $this->mapping;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to pull the key/name mapping
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getPermNames()
|
||||
{
|
||||
return $this->perm_names;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to pull the key/color mapping
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getPermColors()
|
||||
{
|
||||
return $this->perm_colors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the permission items
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getPermItems()
|
||||
{
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . '/sources/classes/forums/class_forums.php' );
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . '/sources/classes/forums/admin_forum_functions.php' );
|
||||
|
||||
$forumfunc = new admin_forum_functions( ipsRegistry::instance() );
|
||||
$forumfunc->forumsInit();
|
||||
|
||||
$forum_data = $forumfunc->adForumsForumData();
|
||||
|
||||
$_return_arr = array();
|
||||
foreach( $forum_data as $r )
|
||||
{
|
||||
$return_arr[$r['id']] = array(
|
||||
'title' => $r['depthed_name'],
|
||||
'perm_view' => $r['perm_view'],
|
||||
'perm_2' => $r['perm_2'],
|
||||
'perm_3' => $r['perm_3'],
|
||||
'perm_4' => $r['perm_4'],
|
||||
'perm_5' => $r['perm_5'],
|
||||
'perm_6' => $r['perm_6'],
|
||||
'perm_7' => $r['perm_7'],
|
||||
'restrict' => $r['parent_id'] == 'root' ? 'perm_view' : '',
|
||||
);
|
||||
}
|
||||
|
||||
return $return_arr;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Item Marking
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 4948 $
|
||||
*
|
||||
*/
|
||||
|
||||
class itemMarking__forums
|
||||
{
|
||||
/**
|
||||
* Field Convert Data Remap Array
|
||||
*
|
||||
* This is where you can map your app_key_# numbers to application savvy fields
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private $_convertData = array( 'forumID' => 'item_app_key_1' );
|
||||
|
||||
/**#@+
|
||||
* Registry Object Shortcuts
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $registry;
|
||||
protected $DB;
|
||||
protected $settings;
|
||||
protected $request;
|
||||
protected $lang;
|
||||
protected $member;
|
||||
protected $cache;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* I'm a constructor, twisted constructor
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry )
|
||||
{
|
||||
/* Make objects */
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->lang = $this->registry->getClass('class_localization');
|
||||
$this->member = $this->registry->member();
|
||||
$this->memberData =& $this->registry->member()->fetchMemberData();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Data
|
||||
* Takes an array of app specific data and remaps it to the DB table fields
|
||||
*
|
||||
* @access public
|
||||
* @param array
|
||||
* @return array
|
||||
*/
|
||||
public function convertData( $data )
|
||||
{
|
||||
$_data = array();
|
||||
|
||||
foreach( $data as $k => $v )
|
||||
{
|
||||
if ( isset($this->_convertData[$k]) )
|
||||
{
|
||||
# Make sure we use intval here as all 'forum' app fields
|
||||
# are integers.
|
||||
$_data[ $this->_convertData[ $k ] ] = intval( $v );
|
||||
}
|
||||
else
|
||||
{
|
||||
$_data[ $k ] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
return $_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch unread count
|
||||
*
|
||||
* Grab the number of items truly unread
|
||||
* This is called upon by 'markRead' when the number of items
|
||||
* left hits zero (or less).
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @param array Array of data
|
||||
* @param array Array of read itemIDs
|
||||
* @param int Last global reset
|
||||
* @return integer Last unread count
|
||||
*/
|
||||
public function fetchUnreadCount( $data, $readItems, $lastReset )
|
||||
{
|
||||
$count = 0;
|
||||
$lastItem = 0;
|
||||
$approved = $this->memberData['is_mod'] ? ' AND approved IN (0,1) ' : ' AND approved=1 ';
|
||||
$readItems = is_array( $readItems ) ? $readItems : array( 0 );
|
||||
|
||||
if ( $data['forumID'] )
|
||||
{
|
||||
$_count = $this->DB->buildAndFetch( array(
|
||||
'select' => 'COUNT(*) as cnt, MIN(last_post) as lastItem',
|
||||
'from' => 'topics',
|
||||
'where' => "forum_id=" . intval( $data['forumID'] ) . " {$approved} AND tid NOT IN(".implode(",",array_keys($readItems)).") AND last_post > ".intval($lastReset) . " AND state != 'link'"
|
||||
) );
|
||||
|
||||
$count = intval( $_count['cnt'] );
|
||||
$lastItem = intval( $_count['lastItem'] );
|
||||
}
|
||||
|
||||
return array( 'count' => $count,
|
||||
'lastItem' => $lastItem );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Fetch Skin
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 4948 $
|
||||
*
|
||||
*/
|
||||
|
||||
class fetchSkin__forums
|
||||
{
|
||||
/**#@+
|
||||
* Registry Object Shortcuts
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $registry;
|
||||
protected $DB;
|
||||
protected $settings;
|
||||
protected $request;
|
||||
protected $lang;
|
||||
protected $member;
|
||||
protected $cache;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* I'm a constructor, twisted constructor
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry )
|
||||
{
|
||||
/* Make objects */
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->lang = $this->registry->getClass('class_localization');
|
||||
$this->member = $this->registry->member();
|
||||
$this->memberData =& $this->registry->member()->fetchMemberData();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
|
||||
/* Check for class_forums */
|
||||
if( ipsRegistry::isClassLoaded('class_forums') !== TRUE )
|
||||
{
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . "/sources/classes/forums/class_forums.php" );
|
||||
$this->registry->setClass( 'class_forums', new class_forums( $registry ) );
|
||||
$this->registry->class_forums->forumsInit();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a skin ID or FALSE
|
||||
*
|
||||
* @access public
|
||||
* @author Matt Mecham
|
||||
* @return mixed INT or FALSE if no skin found / required
|
||||
*/
|
||||
public function fetchSkin()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$useSkinID = FALSE;
|
||||
$_keys = array_keys( $_REQUEST );
|
||||
|
||||
//-----------------------------------------
|
||||
// OK, viewing a forum or WHAT?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( count( array_intersect( array( 'showtopic', 'showforum' ), $_keys ) ) OR ( $this->request['module'] == 'post' ) )
|
||||
{
|
||||
$cache = $this->registry->class_forums->forum_by_id;
|
||||
$eff = intval( $this->request['f'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Do we have a skin for a particular forum?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $eff )
|
||||
{
|
||||
if ( isset( $cache[ $eff ]['skin_id'] ) && $cache[ $eff ]['skin_id'] )
|
||||
{
|
||||
$useSkinID = $cache[ $eff ]['skin_id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $useSkinID;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Library: Handle public session data
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 12th March 2002
|
||||
* @version $Revision: 4948 $
|
||||
*
|
||||
*/
|
||||
|
||||
class publicSessions__forums
|
||||
{
|
||||
/**
|
||||
* Return session variables for this application
|
||||
*
|
||||
* current_appcomponent, current_module and current_section are automatically
|
||||
* stored. This function allows you to add specific variables in.
|
||||
*
|
||||
* @access public
|
||||
* @author Matt Mecham
|
||||
* @return array
|
||||
*/
|
||||
public function getSessionVariables()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$array = array( 'location_1_type' => '',
|
||||
'location_1_id' => 0,
|
||||
'location_2_type' => '',
|
||||
'location_2_id' => 0 );
|
||||
|
||||
//-----------------------------------------
|
||||
// FORUM
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ipsRegistry::$request['module'] == 'forums' AND ( isset( ipsRegistry::$request['f'] ) AND ipsRegistry::$request['f'] ) )
|
||||
{
|
||||
$array = array(
|
||||
'location_2_type' => 'forum',
|
||||
'location_2_id' => intval(ipsRegistry::$request['f']) );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// TOPIC
|
||||
//-----------------------------------------
|
||||
|
||||
else if ( ipsRegistry::$request['module'] == 'forums' AND ipsRegistry::$request['section'] == 'topics' AND ( isset( ipsRegistry::$request['t'] ) AND ipsRegistry::$request['t'] ) )
|
||||
{
|
||||
$array = array(
|
||||
'location_1_type' => 'topic',
|
||||
'location_1_id' => intval(ipsRegistry::$request['t']),
|
||||
'location_2_type' => 'forum',
|
||||
'location_2_id' => intval(ipsRegistry::$request['f']) );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// POST
|
||||
//-----------------------------------------
|
||||
|
||||
else if ( ipsRegistry::$request['module'] == 'post' AND ( isset( ipsRegistry::$request['f'] ) AND ipsRegistry::$request['f'] ) )
|
||||
{
|
||||
$array = array(
|
||||
'location_1_type' => 'topic',
|
||||
'location_1_id' => intval(ipsRegistry::$request['t']),
|
||||
'location_2_type' => 'forum',
|
||||
'location_2_id' => intval(ipsRegistry::$request['f']) );
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parse/format the online list data for the records
|
||||
*
|
||||
* @access public
|
||||
* @author Brandon Farber
|
||||
* @param array Online list rows to check against
|
||||
* @return array Online list rows parsed
|
||||
*/
|
||||
public function parseOnlineEntries( $rows )
|
||||
{
|
||||
if( !is_array($rows) OR !count($rows) )
|
||||
{
|
||||
return $rows;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Init
|
||||
//-----------------------------------------
|
||||
|
||||
$forums_raw = array();
|
||||
$forums = array();
|
||||
$topics_raw = array();
|
||||
$topics = array();
|
||||
$posts_raw = array();
|
||||
$posts = array();
|
||||
$final = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Extract the topic/forum data
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $rows as $row )
|
||||
{
|
||||
if( $row['current_appcomponent'] != 'forums' OR !$row['current_module'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if( $row['current_section'] == 'forums' )
|
||||
{
|
||||
$forums_raw[ $row['location_2_id'] ] = '';
|
||||
}
|
||||
else if( $row['current_section'] == 'topics' )
|
||||
{
|
||||
$topics_raw[ $row['location_1_id'] ] = $row['location_1_id'];
|
||||
}
|
||||
else if( $row['current_section'] == 'post' )
|
||||
{
|
||||
$forums_raw[ $row['location_2_id'] ] = '';
|
||||
$topics_raw[ $row['location_1_id'] ] = $row['location_1_id'];
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the forums, if you dare
|
||||
//-----------------------------------------
|
||||
|
||||
if( !class_exists('app_class_forums') OR !ipsRegistry::getClass('class_forums') )
|
||||
{
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . '/app_class_forums.php' );
|
||||
$app_class_forums = new app_class_forums( ipsRegistry::instance() );
|
||||
|
||||
if( count($forums_raw) )
|
||||
{
|
||||
foreach( ipsRegistry::getClass('class_forums')->forum_by_id as $fid => $forum )
|
||||
{
|
||||
if( isset($forums_raw[$fid]) )
|
||||
{
|
||||
if( ipsRegistry::getClass( 'permissions' )->check( 'view', $forum ) !== false )
|
||||
{
|
||||
$forums[ $fid ] = $forum['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the topics, if you care
|
||||
//-----------------------------------------
|
||||
|
||||
if( count($topics_raw) )
|
||||
{
|
||||
ipsRegistry::DB()->build( array( 'select' => 't.tid, t.title, t.forum_id',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.approved=1 AND t.tid IN(' . implode( ',', $topics_raw ) . ') AND ' . ipsRegistry::getClass('permissions')->buildPermQuery('p'),
|
||||
'add_join' => array(
|
||||
array(
|
||||
'from' => array( 'permission_index' => 'p' ),
|
||||
'where' => "p.perm_type_id=t.forum_id AND p.app='forums' AND p.perm_type='forum'",
|
||||
'type' => 'left',
|
||||
),
|
||||
)
|
||||
) );
|
||||
$tr = ipsRegistry::DB()->execute();
|
||||
|
||||
while( $r = ipsRegistry::DB()->fetch($tr) )
|
||||
{
|
||||
if( count( ipsRegistry::getClass('class_forums')->forum_by_id[ $r['forum_id'] ] ) )
|
||||
{
|
||||
if( ipsRegistry::getClass( 'permissions' )->check( 'read', ipsRegistry::getClass('class_forums')->forum_by_id[ $r['forum_id'] ] ) !== false )
|
||||
{
|
||||
$topics[ $r['tid'] ] = $r['title'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Put humpty dumpty together again
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $rows as $row )
|
||||
{
|
||||
if( $row['current_appcomponent'] != 'forums' )
|
||||
{
|
||||
$final[ $row['id'] ] = $row;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if( !$row['current_module'] )
|
||||
{
|
||||
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['board_index'];
|
||||
$final[ $row['id'] ] = $row;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if( $row['current_section'] == 'forums' )
|
||||
{
|
||||
if( isset($forums[ $row['location_2_id'] ]) )
|
||||
{
|
||||
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['WHERE_sf'];
|
||||
$row['where_line_more'] = $forums[ $row['location_2_id'] ];
|
||||
$row['where_link'] = 'showforum=' . $row['location_2_id'];
|
||||
$row['_whereLinkSeo'] = ipsRegistry::getClass('output')->formatUrl( ipsRegistry::getClass('output')->buildUrl( "showforum=".$row['location_2_id'], 'public' ), IPSText::makeSeoTitle( $forums[ $row['location_2_id'] ] ), 'showforum' );
|
||||
}
|
||||
}
|
||||
else if( $row['current_section'] == 'topics' )
|
||||
{
|
||||
if( isset($topics[ $row['location_1_id'] ]) )
|
||||
{
|
||||
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['WHERE_st'];
|
||||
$row['where_line_more'] = $topics[ $row['location_1_id'] ];
|
||||
$row['where_link'] = 'showtopic=' . $row['location_1_id'];
|
||||
$row['_whereLinkSeo'] = ipsRegistry::getClass('output')->formatUrl( ipsRegistry::getClass('output')->buildUrl( "showtopic=".$row['location_1_id'], 'public' ), IPSText::makeSeoTitle( $topics[ $row['location_1_id'] ] ), 'showtopic' );
|
||||
}
|
||||
}
|
||||
else if( $row['current_section'] == 'post' )
|
||||
{
|
||||
if( $row['location_1_id'] )
|
||||
{
|
||||
if( isset($topics[ $row['location_1_id'] ]) )
|
||||
{
|
||||
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['WHERE_postrep'];
|
||||
$row['where_line_more'] = $topics[ $row['location_1_id'] ];
|
||||
$row['where_link'] = 'showtopic=' . $row['location_1_id'];
|
||||
$row['_whereLinkSeo'] = ipsRegistry::getClass('output')->formatUrl( ipsRegistry::getClass('output')->buildUrl( "showtopic=".$row['location_1_id'], 'public' ), IPSText::makeSeoTitle( $topics[ $row['location_1_id'] ] ), 'showtopic' );
|
||||
}
|
||||
}
|
||||
else if( $row['location_2_id'] )
|
||||
{
|
||||
if( isset($forums[ $row['location_2_id'] ]) )
|
||||
{
|
||||
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['WHERE_postnew'];
|
||||
$row['where_line_more'] = $forums[ $row['location_2_id'] ];
|
||||
$row['where_link'] = 'showforum=' . $row['location_2_id'];
|
||||
$row['_whereLinkSeo'] = ipsRegistry::getClass('output')->formatUrl( ipsRegistry::getClass('output')->buildUrl( "showforum=".$row['location_2_id'], 'public' ), IPSText::makeSeoTitle( $forums[ $row['location_2_id'] ] ), 'showforum' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$final[ $row['id'] ] = $row;
|
||||
}
|
||||
|
||||
return $final;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Core variables extensions
|
||||
* Defines the reset array, which caches to load, how to recache those caches, and the bitwise array
|
||||
* Last Updated: $Date: 2009-12-07 21:57:46 -0500 (Mon, 07 Dec 2009) $
|
||||
*
|
||||
* @author $author$
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 5529 $
|
||||
**/
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
$_RESET = array();
|
||||
|
||||
# ALL
|
||||
if ( ( isset( $_REQUEST['CODE'] ) AND $_REQUEST['CODE'] ) or ( isset( $_REQUEST['code'] ) AND $_REQUEST['code'] ) )
|
||||
{
|
||||
$_RESET['do'] = ( $_REQUEST['CODE'] ) ? $_REQUEST['CODE'] : $_REQUEST['code'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Extension File: Registered Caches
|
||||
//-----------------------------------------
|
||||
|
||||
$_LOAD = array();
|
||||
|
||||
# BOARD INDEX
|
||||
if ( ( ! $_GET['section'] AND ! $_GET['module'] ) OR ( $_GET['module'] == 'forums' AND $_GET['section'] == 'boards' ) )
|
||||
{
|
||||
$_LOAD['chatting'] = 1;
|
||||
$_LOAD['birthdays'] = 1;
|
||||
$_LOAD['calendar'] = 1;
|
||||
$_LOAD['calendars'] = 1;
|
||||
$_LOAD['ranks'] = 1;
|
||||
$_LOAD['reputation_levels'] = 1;
|
||||
}
|
||||
|
||||
# TOPIC
|
||||
if ( isset( $_GET['showtopic'] ) OR $_GET['module'] == 'forums' AND $_GET['section'] == 'topics' )
|
||||
{
|
||||
$_LOAD['badwords'] = 1;
|
||||
$_LOAD['emoticons'] = 1;
|
||||
$_LOAD['bbcode'] = 1;
|
||||
$_LOAD['multimod'] = 1;
|
||||
$_LOAD['ranks'] = 1;
|
||||
$_LOAD['profilefields'] = 1;
|
||||
$_LOAD['reputation_levels'] = 1;
|
||||
}
|
||||
|
||||
# Forum
|
||||
if ( isset( $_GET['showforum'] ) OR $_GET['module'] == 'forums' AND $_GET['section'] == 'forums' )
|
||||
{
|
||||
$_LOAD['ranks'] = 1;
|
||||
$_LOAD['reputation_levels'] = 1;
|
||||
|
||||
// Needed for forum rules...
|
||||
$_LOAD['badwords'] = 1;
|
||||
$_LOAD['emoticons'] = 1;
|
||||
$_LOAD['bbcode'] = 1;
|
||||
}
|
||||
|
||||
# POST
|
||||
if ( $_GET['module'] == 'post' )
|
||||
{
|
||||
$_LOAD['badwords'] = 1;
|
||||
$_LOAD['bbcode'] = 1;
|
||||
$_LOAD['emoticons'] = 1;
|
||||
$_LOAD['ranks'] = 1;
|
||||
$_LOAD['reputation_levels'] = 1;
|
||||
}
|
||||
|
||||
|
||||
$CACHE['attachtypes'] = array(
|
||||
'array' => 1,
|
||||
'allow_unload' => 0,
|
||||
'default_load' => 1,
|
||||
'recache_file' => IPSLib::getAppDir( 'forums' ) . '/modules_admin/attachments/types.php',
|
||||
'recache_class' => 'admin_forums_attachments_types',
|
||||
'recache_function' => 'attachmentTypeCacheRebuild'
|
||||
);
|
||||
|
||||
$CACHE['multimod'] = array(
|
||||
'array' => 1,
|
||||
'allow_unload' => 0,
|
||||
'default_load' => 1,
|
||||
'recache_file' => IPSLib::getAppDir( 'forums' ) . '/modules_admin/forums/multimods.php',
|
||||
'recache_class' => 'admin_forums_forums_multimods',
|
||||
'recache_function' => 'multiModerationRebuildCache'
|
||||
);
|
||||
|
||||
$CACHE['moderators'] = array(
|
||||
'array' => 1,
|
||||
'allow_unload' => 0,
|
||||
'default_load' => 1,
|
||||
'recache_file' => IPSLib::getAppDir( 'forums' ) . '/modules_admin/forums/moderator.php',
|
||||
'recache_class' => 'admin_forums_forums_moderator',
|
||||
'recache_function' => 'rebuildModeratorCache'
|
||||
);
|
||||
|
||||
|
||||
$CACHE['announcements'] = array(
|
||||
'array' => 1,
|
||||
'allow_unload' => 0,
|
||||
'default_load' => 1,
|
||||
'recache_file' => IPSLib::getAppDir( 'forums' ) . '/modules_public/forums/announcements.php',
|
||||
'recache_class' => 'public_forums_forums_announcements',
|
||||
'recache_function' => 'announceRecache'
|
||||
);
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Bitwise Options
|
||||
//-----------------------------------------
|
||||
|
||||
$_BITWISE = array( 'moderators' => array( 'bw_flag_spammers' ) );
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* BBCode Management : Determines if bbcode can be used in this section
|
||||
* Last Updated: $LastChangedDate: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 4948 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/*
|
||||
* An array of key => value pairs
|
||||
* When going to parse, the key should be passed to the editor
|
||||
* to determine which bbcodes should be parsed in the section
|
||||
*
|
||||
*/
|
||||
$BBCODE = array(
|
||||
'topics' => ipsRegistry::getClass('class_localization')->words['ctype__topics'],
|
||||
'announcement' => ipsRegistry::getClass('class_localization')->words['ctype__announcement'],
|
||||
'rules' => ipsRegistry::getClass('class_localization')->words['ctype__rules'],
|
||||
);
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.1
|
||||
* Sets up SEO templates
|
||||
* Last Updated: $Date: 2009-03-04 15:08:31 +0000 (Wed, 04 Mar 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 4136 $
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* SEO templates
|
||||
*
|
||||
* 'allowRedirect' is a flag to tell IP.Board whether to check the incoming link and if not formatted correctly, redirect the correct one
|
||||
*
|
||||
* OUT FORMAT REGEX:
|
||||
* First array element is a regex to run to see if we've a match for the URL
|
||||
* The second array element is the template to use the results of the parenthesis capture
|
||||
*
|
||||
* Special variable #{__title__} is replaced with the $title data passed to output->formatUrl( $url, $title)
|
||||
*
|
||||
* IMPORTANT: Remember that when these regex are used, the output has not been fully parsed so you will get:
|
||||
* showuser={$data['member_id']} NOT showuser=1 so do not try and match numerics only!
|
||||
*
|
||||
* IN FORMAT REGEX
|
||||
*
|
||||
* This allows the registry to piece back together a URL based on the template regex
|
||||
* So, for example: "/user/(\d+?)/", 'matches' => array( array( 'showuser' => '$1' ) )tells IP.Board to populate 'showuser' with the result
|
||||
* of the parenthesis capture #1
|
||||
*/
|
||||
$_SEOTEMPLATES = array(
|
||||
|
||||
'showannouncement' => array( 'app' => 'forums',
|
||||
'allowRedirect' => 1,
|
||||
'out' => array( '#showannouncement=(.+?)((?:&|&)f=(.+?))?(&|$)#i', 'forum-$3/announcement-$1/$4' ),
|
||||
'in' => array( 'regex' => "#/forum-(\d+?)?/announcement-(\d+)/#i",
|
||||
'matches' => array( array( 'showannouncement', '$2' ), array( 'f', '$1' ) ) ) ),
|
||||
|
||||
'showforum' => array( 'app' => 'forums',
|
||||
'allowRedirect' => 1,
|
||||
'out' => array( '#showforum=(.+?)(&|$)#i', 'forum/$1/$2' ),
|
||||
'in' => array( 'regex' => "#/forum/(\d+)/#i",
|
||||
'matches' => array( array( 'showforum', '$1' ) ) ) ),
|
||||
|
||||
'showtopic' => array( 'app' => 'forums',
|
||||
'allowRedirect' => 1,
|
||||
'out' => array( '#showtopic=(.+?)(&|$)#i', 'topic/$1/$2' ),
|
||||
'in' => array( 'regex' => "#/topic/(\d+)/#i",
|
||||
'matches' => array( array( 'showtopic', '$1' ) ) ) ),
|
||||
|
||||
'act=idx' => array( 'app' => 'forums',
|
||||
'allowRedirect' => 0,
|
||||
'out' => array( '#act=idx(&|$)#i', 'index' ),
|
||||
'in' => array( 'regex' => "#/index$#i",
|
||||
'matches' => array( array( 'act', 'idx' ) ) ) ),
|
||||
);
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* RSS output plugin :: posts
|
||||
* Last Updated: $Date: 2009-01-05 22:21:54 +0000 (Mon, 05 Jan 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 6/24/2008
|
||||
* @version $Revision: 3572 $
|
||||
*/
|
||||
|
||||
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 furlRedirect_forums
|
||||
{
|
||||
/**
|
||||
* Key type: Type of action (topic/forum)
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $_type = '';
|
||||
|
||||
/**
|
||||
* Key ID
|
||||
*
|
||||
* @access private
|
||||
* @var int
|
||||
*/
|
||||
private $_id = 0;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
*/
|
||||
function __construct( ipsRegistry $registry )
|
||||
{
|
||||
$this->registry = $registry;
|
||||
$this->DB = $registry->DB();
|
||||
$this->settings =& $registry->fetchSettings();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the key ID
|
||||
* @example furlRedirect_forums::setKey( 'topic', 12 );
|
||||
*
|
||||
* @access public
|
||||
* @param string Type
|
||||
* @param mixed Value
|
||||
*/
|
||||
public function setKey( $name, $value )
|
||||
{
|
||||
$this->_type = $name;
|
||||
$this->_id = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up the key by URI
|
||||
*
|
||||
* @access public
|
||||
* @param string URI (example: index.php?showtopic=5&view=getlastpost)
|
||||
* @return void
|
||||
*/
|
||||
public function setKeyByUri( $uri )
|
||||
{
|
||||
$uri = str_replace( '&', '&', $uri );
|
||||
|
||||
if ( strstr( $uri, '?' ) )
|
||||
{
|
||||
list( $_chaff, $uri ) = explode( '?', $uri );
|
||||
}
|
||||
|
||||
foreach( explode( '&', $uri ) as $bits )
|
||||
{
|
||||
list( $k, $v ) = explode( '=', $bits );
|
||||
|
||||
if ( $k )
|
||||
{
|
||||
if ( $k == 'showtopic' )
|
||||
{
|
||||
$this->setKey( 'topic', intval( $v ) );
|
||||
return TRUE;
|
||||
}
|
||||
else if ( $k == 'showforum' )
|
||||
{
|
||||
$this->setKey( 'forum', intval( $v ) );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the SEO title
|
||||
*
|
||||
* @access public
|
||||
* @return string The SEO friendly name
|
||||
*/
|
||||
public function fetchSeoTitle()
|
||||
{
|
||||
switch ( $this->_type )
|
||||
{
|
||||
default:
|
||||
return FALSE;
|
||||
break;
|
||||
case 'topic':
|
||||
return $this->_fetchSeoTitle_topic();
|
||||
break;
|
||||
case 'forum':
|
||||
return $this->_fetchSeoTitle_forum();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the SEO title for a topic
|
||||
*
|
||||
* @access public
|
||||
* @return string The SEO friendly name
|
||||
*/
|
||||
public function _fetchSeoTitle_topic()
|
||||
{
|
||||
$topic = $this->DB->buildAndFetch( array( 'select' => 'tid, title_seo, title, forum_id',
|
||||
'from' => 'topics',
|
||||
'where' => 'tid=' . intval( $this->_id ) ) );
|
||||
|
||||
if ( $topic['tid'] )
|
||||
{
|
||||
/* Check permission */
|
||||
if ( ! $this->registry->getClass('class_forums')->forumsCheckAccess( $topic['forum_id'], 0, 'topic', $topic, TRUE ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( IPB_USE_ONLY_ID_FURL ) return $topic['tid'];
|
||||
|
||||
return ( $topic['title_seo'] ) ? $topic['title_seo'] : IPSText::makeSeoTitle( $topic['title'] );
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the SEO title for a topic
|
||||
*
|
||||
* @access public
|
||||
* @return string The SEO friendly name
|
||||
*/
|
||||
public function _fetchSeoTitle_forum()
|
||||
{
|
||||
$forum = $this->DB->buildAndFetch( array( 'select' => 'id, name_seo, name',
|
||||
'from' => 'forums',
|
||||
'where' => 'id=' . intval( $this->_id ) ) );
|
||||
|
||||
if ( $forum['id'] )
|
||||
{
|
||||
/* Check permission */
|
||||
if ( ! $this->registry->getClass('class_forums')->forumsCheckAccess( $forum['id'], 0, 'forum', array(), TRUE ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return ( $forum['name_seo'] ) ? $forum['name_seo'] : IPSText::makeSeoTitle( $forum['name'] );
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Sets up SEO templates
|
||||
* Last Updated: $Date: 2009-03-04 15:08:31 +0000 (Wed, 04 Mar 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 4136 $
|
||||
*
|
||||
*/
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
* SEO templates
|
||||
*
|
||||
* 'allowRedirect' is a flag to tell IP.Board whether to check the incoming link and if not formatted correctly, redirect the correct one
|
||||
*
|
||||
* OUT FORMAT REGEX:
|
||||
* First array element is a regex to run to see if we've a match for the URL
|
||||
* The second array element is the template to use the results of the parenthesis capture
|
||||
*
|
||||
* Special variable #{__title__} is replaced with the $title data passed to output->formatUrl( $url, $title)
|
||||
*
|
||||
* IMPORTANT: Remember that when these regex are used, the output has not been fully parsed so you will get:
|
||||
* showuser={$data['member_id']} NOT showuser=1 so do not try and match numerics only!
|
||||
*
|
||||
* IN FORMAT REGEX
|
||||
*
|
||||
* This allows the registry to piece back together a URL based on the template regex
|
||||
* So, for example: "/user/(\d+?)/", 'matches' => array( array( 'showuser' => '$1' ) )tells IP.Board to populate 'showuser' with the result
|
||||
* of the parenthesis capture #1
|
||||
*/
|
||||
$_SEOTEMPLATES = array(
|
||||
|
||||
'showannouncement' => array( 'app' => 'forums',
|
||||
'allowRedirect' => 1,
|
||||
'out' => array( '#showannouncement=(.+?)((?:&|&)f=(.+?))?(&|$)#i', 'forum-$3/announcement-$1-#{__title__}/$4' ),
|
||||
'in' => array( 'regex' => "#/forum-(\d+?)?/announcement-(\d+?)-#i",
|
||||
'matches' => array( array( 'showannouncement', '$2' ), array( 'f', '$1' ) ) ) ),
|
||||
|
||||
'showforum' => array( 'app' => 'forums',
|
||||
'allowRedirect' => 1,
|
||||
'out' => array( '#showforum=(.+?)(&|$)#i', 'forum/$1-#{__title__}/$2' ),
|
||||
'in' => array( 'regex' => "#/forum/(\d+?)-#i",
|
||||
'matches' => array( array( 'showforum', '$1' ) ) ) ),
|
||||
|
||||
'showtopic' => array( 'app' => 'forums',
|
||||
'allowRedirect' => 1,
|
||||
'out' => array( '#showtopic=(.+?)(&|$)#i', 'topic/$1-#{__title__}/$2' ),
|
||||
'in' => array( 'regex' => "#/topic/(\d+?)-#i",
|
||||
'matches' => array( array( 'showtopic', '$1' ) ) ) ),
|
||||
|
||||
'act=idx' => array( 'app' => 'forums',
|
||||
'allowRedirect' => 0,
|
||||
'out' => array( '#act=idx(&|$)#i', 'index$1' ),
|
||||
'in' => array( 'regex' => "#/index(/|$)#i",
|
||||
'matches' => array( array( 'act', 'idx' ) ) ) ),
|
||||
);
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,203 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Forum permissions mappings
|
||||
*
|
||||
* @author $author$
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 4429 $
|
||||
**/
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
* Member Synchronization extensions
|
||||
*
|
||||
* @author $author$
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 4429 $
|
||||
**/
|
||||
class forumsMemberSync
|
||||
{
|
||||
/**
|
||||
* Registry reference
|
||||
*
|
||||
* @access public
|
||||
* @var object
|
||||
*/
|
||||
public $registry;
|
||||
|
||||
/**
|
||||
* CONSTRUCTOR
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function __construct()
|
||||
{
|
||||
$this->registry = ipsRegistry::instance();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is run when a member is flagged as a spammer
|
||||
*
|
||||
* @access public
|
||||
* @param array $member Array of member data
|
||||
* @return void
|
||||
**/
|
||||
public function onSetAsSpammer( $member )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is run when a member is un-flagged as a spammer
|
||||
*
|
||||
* @access public
|
||||
* @param array $member Array of member data
|
||||
* @return void
|
||||
**/
|
||||
public function onUnSetAsSpammer( $member )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is run when a new account is created
|
||||
*
|
||||
* @access public
|
||||
* @param array $member Array of member data
|
||||
* @return void
|
||||
**/
|
||||
public function onCreateAccount( $member )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is run when the register form is displayed to a user
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function onRegisterForm()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is ren when a user successfully logs in
|
||||
*
|
||||
* @access public
|
||||
* @param array $member Array of member data
|
||||
* @return void
|
||||
**/
|
||||
public function onLogin( $member )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called after a member account has been removed
|
||||
*
|
||||
* @access public
|
||||
* @param string $ids SQL IN() clause
|
||||
* @return void
|
||||
**/
|
||||
public function onDelete( $mids )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called after a member's account has been merged into another member's account
|
||||
*
|
||||
* @access public
|
||||
* @param array $member Member account being kept
|
||||
* @param array $member2 Member account being removed
|
||||
* @return void
|
||||
**/
|
||||
public function onMerge( $member, $member2 )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is run after a users email address is successfully changed
|
||||
*
|
||||
* @param integer $id Member ID
|
||||
* @param string $new_email New email address
|
||||
* @return void
|
||||
**/
|
||||
public function onEmailChange( $id, $new_email )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is run after a users password is successfully changed
|
||||
*
|
||||
* @access public
|
||||
* @param integer $id Member ID
|
||||
* @param string $new_plain_text_pass The new password
|
||||
* @return void
|
||||
**/
|
||||
public function onPassChange( $id, $new_plain_text_pass )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is run after a users profile is successfully updated
|
||||
* $member will contain EITHER 'member_id' OR 'email' depending on what data was passed to
|
||||
* IPSMember::save().
|
||||
*
|
||||
* @access public
|
||||
* @param array $member Array of values that were changed
|
||||
* @return void
|
||||
**/
|
||||
public function onProfileUpdate( $member )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is run after a users group is successfully changed
|
||||
*
|
||||
* @access public
|
||||
* @param integer $id Member ID
|
||||
* @param integer $new_group New Group ID
|
||||
* @return void
|
||||
**/
|
||||
public function onGroupChange( $id, $new_group )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is run after a users display name is successfully changed
|
||||
*
|
||||
* @access public
|
||||
* @param integer $id Member ID
|
||||
* @param string $new_name New display name
|
||||
* @return void
|
||||
**/
|
||||
public function onNameChange( $id, $new_name )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Portal plugin: poll
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 1st march 2002
|
||||
* @version $Revision: 4948 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
$PORTAL_CONFIG = array();
|
||||
|
||||
/**
|
||||
* Main plug in title
|
||||
*
|
||||
*/
|
||||
$PORTAL_CONFIG['pc_title'] = 'Опрос';
|
||||
|
||||
/**
|
||||
* Plug in mini description
|
||||
*
|
||||
*/
|
||||
$PORTAL_CONFIG['pc_desc'] = "Выводит блок опроса";
|
||||
|
||||
/**
|
||||
* Keyword for settings. This is the keyword
|
||||
* entered into ibf_conf_settings_titles -> conf_title_keyword
|
||||
* Can be left blank.
|
||||
* PLEASE stick to the naming convention when entering a setting
|
||||
* keyword: portal_{file_name_minus_php} This will prevent
|
||||
* other keyword clashes. Likewise, when creating settings, choose
|
||||
* NOT to cache them (they will be loaded at run time) and always
|
||||
* prefix with {file_name_minus_php}_setting_key - for example
|
||||
* If you had a setting called "export_forums" then please name it
|
||||
* "recent_topics_export_forums". This will be available in
|
||||
* $this->settings['recent_topics_export_forums'] in the
|
||||
* main module.
|
||||
*/
|
||||
$PORTAL_CONFIG['pc_settings_keyword'] = "portal_poll";
|
||||
|
||||
/**
|
||||
* Exportable tags key must be in the naming format of:
|
||||
* {file_name_minus_php}-tag. The value *MUST* be the function
|
||||
* which it corresponds to. For example:
|
||||
* 'recent_topics_last_x' => 'recent_topics_last_x'
|
||||
* The portal will look for function 'recent_topics_last_x' in
|
||||
* module "sources/portal_plugins/recent_topics.php" when it parses
|
||||
* the tag <!--::recent_topics_last_x::-->
|
||||
*
|
||||
* @param array[ TAG ] = array( FUNCTION NAME, DESCRIPTION );
|
||||
*/
|
||||
$PORTAL_CONFIG['pc_exportable_tags']['poll_show_poll'] = array( 'poll_show_poll', 'Shows the request poll' );
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Portal plugin: poll
|
||||
* Last Updated: $Date: 2009-06-16 08:17:58 -0400 (Tue, 16 Jun 2009) $
|
||||
*
|
||||
* @author $Author: matt $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 1st march 2002
|
||||
* @version $Revision: 4778 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class ppi_poll extends public_portal_portal_portal
|
||||
{
|
||||
/**
|
||||
* Initialize module
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a poll
|
||||
*
|
||||
* @access public
|
||||
* @return string HTML content to replace tag with
|
||||
*/
|
||||
public function poll_show_poll()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$extra = "";
|
||||
$sql = "";
|
||||
$check = 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Got a poll?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $this->settings['poll_poll_url'] )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the topic ID of the entered URL
|
||||
//-----------------------------------------
|
||||
|
||||
/* Friendly URL */
|
||||
if( $this->settings['use_friendly_urls'] )
|
||||
{
|
||||
preg_match( "#/topic/(\d+)(.*?)/#", $this->settings['poll_poll_url'], $match );
|
||||
$tid = intval( trim( $match[1] ) );
|
||||
}
|
||||
/* Normal URL */
|
||||
else
|
||||
{
|
||||
preg_match( "/(\?|&)(t|showtopic)=(\d+)($|&)/", $this->settings['poll_poll_url'], $match );
|
||||
$tid = intval( trim( $match[3] ) );
|
||||
}
|
||||
|
||||
if ( !$tid )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get topic...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->class_localization->loadLanguageFile( array( 'public_boards', 'public_topic' ), 'forums' );
|
||||
$this->registry->class_localization->loadLanguageFile( array( 'public_editors' ), 'core' );
|
||||
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . "/sources/classes/forums/class_forums.php" );
|
||||
$this->registry->setClass( 'class_forums', new class_forums( $this->registry ) );
|
||||
|
||||
$this->registry->getClass('class_forums')->strip_invisible = 1;
|
||||
$this->registry->getClass('class_forums')->forumsInit();
|
||||
|
||||
require_once( IPSLib::getAppDir( 'forums', 'forums' ) . '/topics.php' );
|
||||
$topic = new public_forums_forums_topics();
|
||||
$topic->makeRegistryShortcuts( $this->registry );
|
||||
|
||||
$topic->topic = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'topics', 'where' => "tid=" . $tid ) );
|
||||
$topic->forum = ipsRegistry::getClass('class_forums')->forum_by_id[ $topic->topic['forum_id'] ];
|
||||
|
||||
$this->request['f'] = $topic->forum['id'] ;
|
||||
$this->request['t'] = $tid ;
|
||||
|
||||
if ( $topic->topic['poll_state'] )
|
||||
{
|
||||
return $this->registry->getClass('output')->getTemplate('portal')->pollWrapper( $topic->_generatePollOutput(), $tid );
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Portal plugin: recent topics
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 1st march 2002
|
||||
* @version $Revision: 4948 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
$PORTAL_CONFIG = array();
|
||||
|
||||
/**
|
||||
* Main plug in title
|
||||
*
|
||||
*/
|
||||
$PORTAL_CONFIG['pc_title'] = 'Последние темы';
|
||||
|
||||
/**
|
||||
* Plug in mini description
|
||||
*
|
||||
*/
|
||||
$PORTAL_CONFIG['pc_desc'] = "Выводит блок последних тем";
|
||||
|
||||
/**
|
||||
* Keyword for settings. This is the keyword
|
||||
* entered into ibf_conf_settings_titles -> conf_title_keyword
|
||||
* Can be left blank.
|
||||
* PLEASE stick to the naming convention when entering a setting
|
||||
* keyword: portal_{file_name_minus_php} This will prevent
|
||||
* other keyword clashes. Likewise, when creating settings, choose
|
||||
* NOT to cache them (they will be loaded at run time) and always
|
||||
* prefix with {file_name_minus_php}_setting_key - for example
|
||||
* If you had a setting called "export_forums" then please name it
|
||||
* "recent_topics_export_forums". This will be available in
|
||||
* $this->settings['recent_topics_export_forums'] in the
|
||||
* main module.
|
||||
*/
|
||||
$PORTAL_CONFIG['pc_settings_keyword'] = "portal_recent_topics";
|
||||
|
||||
/**
|
||||
* Exportable tags key must be in the naming format of:
|
||||
* {file_name_minus_php}-tag. The value *MUST* be the function
|
||||
* which it corresponds to. For example:
|
||||
* 'recent_topics_last_x' => 'recent_topics_last_x'
|
||||
* The portal will look for function 'recent_topics_last_x' in
|
||||
* module "sources/portal_plugins/recent_topics.php" when it parses
|
||||
* the tag <!--::recent_topics_last_x::-->
|
||||
*
|
||||
* @param array[ TAG ] = array( FUNCTION NAME, DESCRIPTION );
|
||||
*/
|
||||
$PORTAL_CONFIG['pc_exportable_tags']['recent_topics_last_x'] = array( 'recent_topics_last_x' , 'Shows the last X topics with full post from the selected forums' );
|
||||
$PORTAL_CONFIG['pc_exportable_tags']['recent_topics_discussions_last_x'] = array( 'recent_topics_discussions_last_x', 'Shows the last X topic titles from ALL viewable forums' );
|
||||
@@ -0,0 +1,450 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Portal plugin: recent topics
|
||||
* Last Updated: $Date: 2009-12-07 21:57:46 -0500 (Mon, 07 Dec 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 1st march 2002
|
||||
* @version $Revision: 5529 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class ppi_recent_topics extends public_portal_portal_portal
|
||||
{
|
||||
/**
|
||||
* Initialize module
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$this->settings['csite_article_date'] = $this->settings['csite_article_date'] ? $this->settings['csite_article_date'] : '%c';
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the recently started topic titles
|
||||
*
|
||||
* @access public
|
||||
* @return string HTML content to replace tag with
|
||||
*/
|
||||
public function recent_topics_discussions_last_x()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
$results = array();
|
||||
$limit = $this->settings['recent_topics_discuss_number'] ? $this->settings['recent_topics_discuss_number'] : 5;
|
||||
|
||||
$where_clause = array();
|
||||
|
||||
/* Loop through the forums and build a list of forums we're allowed access to */
|
||||
$forumIdsOk = array();
|
||||
|
||||
foreach( $this->registry->class_forums->forum_by_id as $id => $data )
|
||||
{
|
||||
/* Can we read? */
|
||||
if ( ! $this->registry->permissions->check( 'read', $data ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Can read, but is it password protected, etc? */
|
||||
if ( ! $this->registry->class_forums->forumsCheckAccess( $id, 0, 'forum', array(), true ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! $data['can_view_others'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $data['min_posts_view'] > $this->memberData['posts'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$forumIdsOk[] = $id;
|
||||
}
|
||||
|
||||
if ( count( $forumIdsOk) )
|
||||
{
|
||||
/* Add allowed forums */
|
||||
$where_clause[] = "t.forum_id IN (" . implode( ",", $forumIdsOk ) . ")";
|
||||
|
||||
$this->DB->build( array( 'select' => 't.tid, t.title, t.posts, t.start_date as post_date, t.views, t.title_seo, t.starter_name',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => "t.approved=1 and t.state != 'closed' and (t.state != 'link') " . ( count($where_clause) ? ' AND ' . implode( ' AND ', $where_clause ) : '' ),
|
||||
'order' => 't.tid DESC',
|
||||
'limit' => array( 0, $limit ),
|
||||
'add_join' => array(
|
||||
array(
|
||||
'from' => array( 'forums' => 'f' ),
|
||||
'where' => "f.id=t.forum_id",
|
||||
'type' => 'left',
|
||||
),
|
||||
array(
|
||||
'select' => 'm.member_id, m.members_display_name, m.members_seo_name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.member_id=t.starter_id",
|
||||
'type' => 'left',
|
||||
),
|
||||
)
|
||||
) );
|
||||
$outer = $this->DB->execute();
|
||||
|
||||
while ( $row = $this->DB->fetch($outer) )
|
||||
{
|
||||
$row['title_display'] = IPSText::truncate( $row['title'], 30 );
|
||||
$row['date'] = $this->registry->class_localization->getDate( $row['post_date'], "manual{{$this->settings['csite_article_date']}}" );
|
||||
|
||||
if( !$row['member_id'] )
|
||||
{
|
||||
$row['members_display_name'] = $this->settings['guest_name_pre'] . $row['starter_name'] . $this->settings['guest_name_suf'];
|
||||
}
|
||||
|
||||
$results[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->registry->getClass('output')->getTemplate('portal')->latestPosts( $results );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show the "news" articles
|
||||
*
|
||||
* @access public
|
||||
* @return string HTML content to replace tag with
|
||||
*/
|
||||
public function recent_topics_last_x()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$attach_pids = array();
|
||||
$attach_posts = array();
|
||||
$forums = array();
|
||||
$rows = array();
|
||||
$output = array();
|
||||
$where_clause = array();
|
||||
$limit = $this->settings['recent_topics_article_max'] ? $this->settings['recent_topics_article_max'] : 5;
|
||||
$posts = intval($this->memberData['posts']);
|
||||
|
||||
//-----------------------------------------
|
||||
// Grab articles new/recent in 1 bad ass query
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( explode( ',', $this->settings['recent_topics_article_forum'] ) as $forum_id )
|
||||
{
|
||||
if( !$forum_id )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$forums[] = intval($forum_id);
|
||||
}
|
||||
|
||||
if( !count($forums) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Loop through the forums and build a list of forums we're allowed access to */
|
||||
$forumIdsOk = array();
|
||||
|
||||
foreach( $this->registry->class_forums->forum_by_id as $id => $data )
|
||||
{
|
||||
/* Allowing this forum? */
|
||||
if ( ! in_array( $id, $forums, $id ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Can we read? */
|
||||
if ( ! $this->registry->permissions->check( 'read', $data ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Can read, but is it password protected, etc? */
|
||||
if ( ! $this->registry->class_forums->forumsCheckAccess( $id, 0, 'forum', array(), true ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! $data['can_view_others'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $data['min_posts_view'] > $posts )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$forumIdsOk[] = $id;
|
||||
}
|
||||
|
||||
if( !count($forumIdsOk) )
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/* Add allowed forums */
|
||||
$where_clause[] = "t.forum_id IN (" . implode( ",", $forumIdsOk ) . ")";
|
||||
|
||||
//-----------------------------------------
|
||||
// Will we need to parse attachments?
|
||||
//-----------------------------------------
|
||||
|
||||
$parseAttachments = false;
|
||||
|
||||
//-----------------------------------------
|
||||
// Run query
|
||||
//-----------------------------------------
|
||||
|
||||
$pinned = array();
|
||||
$unpinned = array();
|
||||
$all = array();
|
||||
$data = array();
|
||||
$count = 0;
|
||||
|
||||
if( !$this->settings['portal_exclude_pinned'] )
|
||||
{
|
||||
/* Fetch all pinned topics to avoid filesort */
|
||||
$this->DB->build( array( 'select' => 't.tid, t.start_date',
|
||||
'from' => 'topics t',
|
||||
'where' => "t.pinned=1 AND t.approved=1 AND t.state != 'link'" . ( count($where_clause) ? ' AND ' . implode( ' AND ', $where_clause ) : '' ),
|
||||
//'order' => 't.tid DESC',
|
||||
'limit' => array ( $limit ) ) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
$pinned[ $row['start_date'] ] = $row['tid'];
|
||||
$all[ $row['start_date'] ] = $row['tid'];
|
||||
}
|
||||
}
|
||||
|
||||
/* Still need more? */
|
||||
|
||||
if ( count( $pinned ) < $limit )
|
||||
{
|
||||
$pinnedWhere = $this->settings['portal_exclude_pinned'] ? "" : "t.pinned=0 AND ";
|
||||
|
||||
$this->DB->build( array( 'select' => 't.tid, t.start_date',
|
||||
'from' => 'topics t',
|
||||
'where' => $pinnedWhere . "t.approved=1 AND t.state != 'link'" . ( count($where_clause) ? ' AND ' . implode( ' AND ', $where_clause ) : '' ),
|
||||
'order' => 'tid DESC',
|
||||
'limit' => array ( $limit - count( $pinned ) ) ) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
$unpinned[ $row['start_date'] ] = $row['tid'];
|
||||
$all[ $row['start_date'] ] = $row['tid'];
|
||||
}
|
||||
}
|
||||
|
||||
/* got anything? */
|
||||
if ( ! count( $all ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => 't.*',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => "t.tid IN (" . implode( ",", array_values( $all ) ) . ")",
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 'p.*',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'p.pid=t.topic_firstpost',
|
||||
'type' => 'left'
|
||||
),
|
||||
array(
|
||||
'select' => 'f.use_html',
|
||||
'from' => array( 'forums' => 'f' ),
|
||||
'where' => "f.id=t.forum_id",
|
||||
'type' => 'left',
|
||||
),
|
||||
array(
|
||||
'select' => 'm.member_id, m.members_display_name, m.member_group_id, m.members_seo_name, m.mgroup_others, m.login_anonymous, m.last_visit, m.last_activity',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=p.author_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
array(
|
||||
'select' => 'pp.*',
|
||||
'from' => array( 'profile_portal' => 'pp' ),
|
||||
'where' => 'pp.pp_member_id=m.member_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
|
||||
)
|
||||
) );
|
||||
|
||||
$outer = $this->DB->execute();
|
||||
|
||||
//-----------------------------------------
|
||||
// Loop through..
|
||||
//-----------------------------------------
|
||||
|
||||
while( $row = $this->DB->fetch($outer) )
|
||||
{
|
||||
$data[ $row['tid'] ] = $row;
|
||||
}
|
||||
|
||||
krsort( $unpinned );
|
||||
krsort( $pinned );
|
||||
|
||||
foreach( $unpinned as $date => $tid )
|
||||
{
|
||||
if ( count( $pinned ) < $limit )
|
||||
{
|
||||
$pinned[ $date ] = $tid;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
$count++;
|
||||
}
|
||||
|
||||
/* Now put it altogether */
|
||||
foreach( $pinned as $date => $tid )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$entry = $data[ $tid ];
|
||||
$bottom_string = "";
|
||||
$read_more = "";
|
||||
$top_string = "";
|
||||
$got_these_attach = 0;
|
||||
|
||||
if( $entry['topic_hasattach'] )
|
||||
{
|
||||
$parseAttachments = true;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Parse the post
|
||||
//-----------------------------------------
|
||||
|
||||
IPSText::getTextClass( 'bbcode' )->parse_smilies = $entry['use_emo'];
|
||||
IPSText::getTextClass( 'bbcode' )->parse_html = ( $entry['use_html'] and $entry['post_htmlstate'] ) ? 1 : 0;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_nl2br = $entry['post_htmlstate'] == 2 ? 1 : 0;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_section = 'topics';
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $entry['member_group_id'];
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $entry['mgroup_others'];
|
||||
$entry['post'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $entry['post'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// BASIC INFO
|
||||
//-----------------------------------------
|
||||
|
||||
$real_posts = $entry['posts'];
|
||||
$entry['posts'] = ipsRegistry::getClass('class_localization')->formatNumber(intval($entry['posts']));
|
||||
|
||||
if( !$entry['author_id'] )
|
||||
{
|
||||
$entry['members_display_name'] = $this->settings['guest_name_pre'] . $entry['author_name'] . $this->settings['guest_name_suf'];
|
||||
$entry['member_id'] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$entry = IPSMember::buildDisplayData( $entry );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get Date
|
||||
//-----------------------------------------
|
||||
|
||||
$entry['date'] = $this->registry->class_localization->getDate( $entry['post_date'], "manual{" . $this->settings['csite_article_date'] . "}" );
|
||||
|
||||
//-----------------------------------------
|
||||
// Attachments?
|
||||
//-----------------------------------------
|
||||
|
||||
if( $entry['pid'] )
|
||||
{
|
||||
$attach_pids[ $entry['pid'] ] = $entry['pid'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Avatar
|
||||
//-----------------------------------------
|
||||
|
||||
$entry['avatar'] = IPSMember::buildAvatar( $entry );
|
||||
|
||||
if ( IPSMember::checkPermissions('download', $entry['forum_id'] ) === FALSE )
|
||||
{
|
||||
$this->settings[ 'show_img_upload'] = 0 ;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// View image...
|
||||
//-----------------------------------------
|
||||
|
||||
$entry['post'] = IPSText::getTextClass( 'bbcode' )->memberViewImages( $entry['post'] );
|
||||
|
||||
$rows[] = $entry;
|
||||
}
|
||||
|
||||
$output = $this->registry->getClass('output')->getTemplate('portal')->articles( $rows );
|
||||
|
||||
//-----------------------------------------
|
||||
// Process Attachments
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $parseAttachments AND count( $attach_pids ) )
|
||||
{
|
||||
if ( ! is_object( $this->class_attach ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Grab render attach class
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPSLib::getAppDir( 'core' ) . '/sources/classes/attach/class_attach.php' );
|
||||
$this->class_attach = new class_attach( $this->registry );
|
||||
|
||||
$this->class_attach->attach_post_key = '';
|
||||
|
||||
ipsRegistry::getClass( 'class_localization' )->loadLanguageFile( array( 'public_topic' ), 'forums' );
|
||||
}
|
||||
|
||||
$this->class_attach->attach_post_key = '';
|
||||
$this->class_attach->type = 'post';
|
||||
$this->class_attach->init();
|
||||
|
||||
$output = $this->class_attach->renderAttachments( $output, $attach_pids );
|
||||
$output = $output[0]['html'];
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Reputation configuration for application
|
||||
* Last Updated: $Date: 2009-11-13 12:11:37 -0500 (Fri, 13 Nov 2009) $
|
||||
*
|
||||
* @author $author$
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 5402 $
|
||||
**/
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
$rep_author_config = array(
|
||||
'pid' => array( 'column' => 'author_id', 'table' => 'posts' )
|
||||
);
|
||||
|
||||
/*
|
||||
* The following config items are for the log viewer in the ACP */
|
||||
|
||||
$rep_log_joins = array(
|
||||
array(
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'r.type="pid" AND r.type_id=p.pid and r.app="forums"',
|
||||
'type' => 'left'
|
||||
),
|
||||
array(
|
||||
'select' => 't.title as repContentTitle, t.tid as repContentID',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 'p.topic_id=t.tid',
|
||||
'type' => 'left'
|
||||
),
|
||||
);
|
||||
|
||||
$rep_log_where = "p.author_id=%s";
|
||||
|
||||
$rep_log_link = 'findpost=%d';
|
||||
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* RSS output plugin :: posts
|
||||
* Last Updated: $Date: 2009-07-09 03:49:55 -0400 (Thu, 09 Jul 2009) $
|
||||
*
|
||||
* @author $Author: matt $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 6/24/2008
|
||||
* @version $Revision: 4857 $
|
||||
*/
|
||||
|
||||
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 rss_output_forums
|
||||
{
|
||||
/**
|
||||
* Expiration date
|
||||
*
|
||||
* @access private
|
||||
* @var integer Expiration timestamp
|
||||
*/
|
||||
private $expires = 0;
|
||||
|
||||
/**
|
||||
* Grab the RSS links
|
||||
*
|
||||
* @access public
|
||||
* @return array RSS links
|
||||
*/
|
||||
public function getRssLinks()
|
||||
{
|
||||
$return = array();
|
||||
|
||||
ipsRegistry::DB()->build( array( 'select' => 'rss_export_title, rss_export_id', 'from' => 'rss_export', 'where' => 'rss_export_enabled=1' ) );
|
||||
ipsRegistry::DB()->execute();
|
||||
|
||||
while( $r = ipsRegistry::DB()->fetch() )
|
||||
{
|
||||
$return[] = array( 'title' => $r['rss_export_title'], 'url' => ipsRegistry::getClass('output')->formatUrl( ipsRegistry::$settings['board_url'] . "/index.php?app=core&module=global&section=rss&type=forums&id=" . $r['rss_export_id'], '%%' . $r['rss_export_title'] . '%%', 'section=rss2' ) );
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Grab the RSS document content and return it
|
||||
*
|
||||
* @access public
|
||||
* @return string RSS document
|
||||
*/
|
||||
public function returnRSSDocument()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$rss_export_id = intval( ipsRegistry::$request['id'] );
|
||||
$rss_data = array();
|
||||
$to_print = '';
|
||||
$this->expires = time();
|
||||
|
||||
//-----------------------------------------
|
||||
// Get RSS export
|
||||
//-----------------------------------------
|
||||
|
||||
$rss_data = ipsRegistry::DB()->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'rss_export',
|
||||
'where' => 'rss_export_id=' . $rss_export_id ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Got one?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $rss_data['rss_export_id'] AND $rss_data['rss_export_enabled'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Correct expires time
|
||||
//-----------------------------------------
|
||||
|
||||
$this->expires += $rss_data['rss_export_cache_time'] * 60;
|
||||
|
||||
//-----------------------------------------
|
||||
// Need to recache?
|
||||
//-----------------------------------------
|
||||
|
||||
$time_check = time() - ( $rss_data['rss_export_cache_time'] * 60 );
|
||||
|
||||
if ( ( ! $rss_data['rss_export_cache_content'] ) OR $time_check > $rss_data['rss_export_cache_last'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Yes
|
||||
//-----------------------------------------
|
||||
|
||||
define( 'IN_ACP', 1 );
|
||||
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . '/app_class_forums.php' );
|
||||
$app_class_forums = new app_class_forums( ipsRegistry::instance() );
|
||||
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . '/modules_admin/rss/export.php' );
|
||||
$rss_export = new admin_forums_rss_export();
|
||||
$rss_export->makeRegistryShortcuts( ipsRegistry::instance() );
|
||||
|
||||
|
||||
return $rss_export->rssExportRebuildCache( $rss_data['rss_export_id'], 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// No
|
||||
//-----------------------------------------
|
||||
|
||||
return $rss_data['rss_export_cache_content'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Grab the RSS document expiration timestamp
|
||||
*
|
||||
* @access public
|
||||
* @return integer Expiration timestamp
|
||||
*/
|
||||
public function grabExpiryDate()
|
||||
{
|
||||
return $this->expires ? $this->expires : time();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,399 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Formats forum search results
|
||||
* Last Updated: $Date: 2009-10-29 08:54:35 -0400 (Thu, 29 Oct 2009) $
|
||||
*
|
||||
* @author $author$
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 5290 $
|
||||
**/
|
||||
|
||||
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 forumsSearchDisplay implements iSearchDisplay
|
||||
{
|
||||
/**
|
||||
* Last topic id completed
|
||||
*
|
||||
* @access private
|
||||
* @var integer Topic id
|
||||
*/
|
||||
private $last_topic = 0;
|
||||
|
||||
/**
|
||||
* The search plugin for this app
|
||||
*
|
||||
* @access public
|
||||
* @var object
|
||||
*/
|
||||
public $search_plugin;
|
||||
|
||||
|
||||
/**
|
||||
* Formats the forum search result for display
|
||||
*
|
||||
* @access public
|
||||
* @param array $search_row Array of data from search_index
|
||||
* @param bool $isVnc Is from view new content
|
||||
* @return mixed Formatted content, ready for display, or array containing a $sub section flag, and content
|
||||
**/
|
||||
public function formatContent( $search_row, $isVnc=false )
|
||||
{
|
||||
/* Get class forums, used for displaying forum names on results */
|
||||
if( ipsRegistry::isClassLoaded('class_forums') !== TRUE )
|
||||
{
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . "/sources/classes/forums/class_forums.php" );
|
||||
ipsRegistry::setClass( 'class_forums', new class_forums( ipsRegistry::instance() ) );
|
||||
ipsRegistry::getClass( 'class_forums' )->forumsInit();
|
||||
}
|
||||
|
||||
/* Array */
|
||||
$search_row = $this->_buildOutputArray( $search_row );
|
||||
|
||||
/* Indent */
|
||||
$indent = ( $this->last_topic == $search_row['type_id_2'] );
|
||||
|
||||
$this->last_topic = $search_row['type_id_2'];
|
||||
|
||||
/* Various data */
|
||||
$search_row['_last_post'] = $search_row['last_post'];
|
||||
$search_row['_longTitle'] = $search_row['content_title'];
|
||||
$search_row['_shortTitle'] = IPSText::truncate( $search_row['content_title'], 60 );
|
||||
$search_row['last_poster'] = $search_row['last_poster_id'] ? IPSLib::makeProfileLink( $search_row['last_poster_name'], $search_row['last_poster_id'], $search_row['seo_last_name'] ) : ipsRegistry::$settings['guest_name_pre'] . $search_row['last_poster_name'] . ipsRegistry::$settings['guest_name_suf'];
|
||||
$search_row['starter'] = $search_row['starter_id'] ? IPSLib::makeProfileLink( $search_row['starter_name'], $search_row['starter_id'], $search_row['seo_first_name'] ) : $this->settings['guest_name_pre'] . $search_row['starter_name'] . $this->settings['guest_name_suf'];
|
||||
//$search_row['posts'] = ipsRegistry::getClass('class_localization')->formatNumber( intval($search_row['posts']) );
|
||||
//$search_row['views'] = ipsRegistry::getClass('class_localization')->formatNumber( intval($search_row['views']) );
|
||||
$search_row['last_post'] = ipsRegistry::getClass( 'class_localization')->getDate( $search_row['last_post'], 'SHORT' );
|
||||
|
||||
if ( isset( $search_row['post_date'] ) )
|
||||
{
|
||||
$search_row['_post_date'] = $search_row['post_date'];
|
||||
$search_row['post_date'] = ipsRegistry::getClass( 'class_localization')->getDate( $search_row['post_date'], 'SHORT' );
|
||||
}
|
||||
|
||||
if ( $this->memberData['is_mod'] )
|
||||
{
|
||||
$search_row['posts'] += intval($search_row['topic_queuedposts']);
|
||||
}
|
||||
|
||||
if ($search_row['posts'])
|
||||
{
|
||||
if ( (($search_row['posts'] + 1) % ipsRegistry::$settings['display_max_posts']) == 0 )
|
||||
{
|
||||
$pages = ($search_row['posts'] + 1) / ipsRegistry::$settings['display_max_posts'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$number = ( ($search_row['posts'] + 1) / ipsRegistry::$settings['display_max_posts'] );
|
||||
$pages = ceil( $number);
|
||||
}
|
||||
}
|
||||
|
||||
if ( $pages > 1 )
|
||||
{
|
||||
for ( $i = 0 ; $i < $pages ; ++$i )
|
||||
{
|
||||
$real_no = $i * ipsRegistry::$settings['display_max_posts'];
|
||||
$page_no = $i + 1;
|
||||
|
||||
if ( $page_no == 4 and $pages > 4 )
|
||||
{
|
||||
$search_row['pages'][] = array( 'last' => 1,
|
||||
'st' => ($pages - 1) * ipsRegistry::$settings['display_max_posts'],
|
||||
'page' => $pages );
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
$search_row['pages'][] = array( 'last' => 0,
|
||||
'st' => $real_no,
|
||||
'page' => $page_no );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Format as a topic */
|
||||
if( $search_row['type_2'] == 'topic' )
|
||||
{
|
||||
/* Forum Breadcrum */
|
||||
$search_row['_forum_trail'] = ipsRegistry::getClass( 'class_forums' )->forumsBreadcrumbNav( $search_row['forum_id'] );
|
||||
|
||||
/* Is it read? We don't support last_vote in search. */
|
||||
$is_read = ipsRegistry::getClass( 'classItemMarking' )->isRead( array( 'forumID' => $search_row['forum_id'], 'itemID' => $search_row['type_id_2'], 'itemLastUpdate' => $search_row['lastupdate'] ? $search_row['lastupdate'] : $search_row['updated'] ), 'forums' );
|
||||
|
||||
/* Has posted dot */
|
||||
$show_dots = '';
|
||||
|
||||
if( ipsRegistry::$settings['show_user_posted'] )
|
||||
{
|
||||
if( ipsRegistry::member()->getProperty('member_id') && ( isset( $search_row['_topic_array'][$search_row['type_id_2']] ) && $search_row['_topic_array'][$search_row['type_id_2']] ) )
|
||||
{
|
||||
$show_dots = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Icon */
|
||||
$search_row['_icon'] = ipsRegistry::getClass( 'class_forums' )->fetchTopicFolderIcon( $search_row, $show_dots, $is_read );
|
||||
$search_row['_isRead'] = $is_read;
|
||||
|
||||
/* Display type */
|
||||
if ( $this->search_plugin->getShowAsForum() !== true )
|
||||
{
|
||||
return array( ipsRegistry::getClass( 'output' )->getTemplate( 'search' )->topicPostSearchResult( $search_row, $indent, ( $this->search_plugin->onlyTitles || $this->search_plugin->noPostPreview ) ? 1 : 0 ), $indent );
|
||||
}
|
||||
else
|
||||
{
|
||||
return array( ipsRegistry::getClass( 'output' )->getTemplate( 'search' )->topicPostSearchResultAsForum( $search_row, $indent, ( $this->search_plugin->onlyTitles || $this->search_plugin->noPostPreview ) ? 1 : 0 ), $indent );
|
||||
}
|
||||
}
|
||||
/* Format as a forum */
|
||||
else
|
||||
{
|
||||
return ipsRegistry::getClass( 'output' )->getTemplate( 'search' )->forumSearchResult( $search_row, ( $this->search_plugin->onlyTitles || $this->search_plugin->noPostPreview ) ? 1 : 0 );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal function, used to sort out the pid and title
|
||||
*
|
||||
* @access private
|
||||
* @param array $r Array of data
|
||||
* @return array Formatted data, ready for output
|
||||
**/
|
||||
private function _buildOutputArray( $r )
|
||||
{
|
||||
if( $r['misc'] )
|
||||
{
|
||||
$_data = unserialize( $r['misc'] );
|
||||
$r['misc'] = isset( $_data['pid'] ) && $_data['pid'] ? $_data['pid'] : $r['misc'];
|
||||
$r['content_title'] = isset( $_data['title'] ) && $_data['title'] ? $_data['title'] : $r['content_title'];
|
||||
}
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retuns the html for displaying the forum category filter on the advanced search page
|
||||
*
|
||||
* @access public
|
||||
* @return string Filter HTML
|
||||
**/
|
||||
public function getFilterHTML()
|
||||
{
|
||||
/* Make sure class_forums is setup */
|
||||
if( ipsRegistry::isClassLoaded('class_forums') !== TRUE )
|
||||
{
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . "/sources/classes/forums/class_forums.php" );
|
||||
ipsRegistry::setClass( 'class_forums', new class_forums( ipsRegistry::instance() ) );
|
||||
ipsRegistry::getClass( 'class_forums' )->strip_invisible = 1;
|
||||
ipsRegistry::getClass( 'class_forums' )->forumsInit();
|
||||
}
|
||||
|
||||
return ipsRegistry::getClass( 'output' )->getTemplate( 'search' )->forumAdvancedSearchFilters( ipsRegistry::getClass( 'class_forums' )->buildForumJump( 0, 1 ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array used in the searchplugin's setCondition method
|
||||
*
|
||||
* @access public
|
||||
* @param array $data Array of forums to view
|
||||
* @return array Array with column, operator, and value keys, for use in the setCondition call
|
||||
**/
|
||||
public function buildFilterSQL( $data )
|
||||
{
|
||||
$return = array();
|
||||
|
||||
if( isset( $data ) && is_array( $data ) && count( $data ) )
|
||||
{
|
||||
/* Load class_forums so that we can search sub forums automatically */
|
||||
if( ipsRegistry::isClassLoaded('class_forums') !== TRUE )
|
||||
{
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . '/sources/classes/forums/class_forums.php' );
|
||||
ipsRegistry::setClass( 'class_forums', new class_forums( ipsRegistry::instance() ) );
|
||||
ipsRegistry::getClass( 'class_forums' )->forumsInit();
|
||||
}
|
||||
|
||||
foreach( $data as $field => $_data )
|
||||
{
|
||||
/* FORUMS */
|
||||
if ( $field == 'forums' && count( $data['forums'] ) )
|
||||
{
|
||||
/* Get a list of child ids */
|
||||
foreach( $data['forums'] as $forum_id )
|
||||
{
|
||||
$children = ipsRegistry::getClass( 'class_forums' )->forumsGetChildren( $forum_id );
|
||||
|
||||
foreach( $children as $kid )
|
||||
{
|
||||
if( ! in_array( $kid, $data['forums'] ) )
|
||||
{
|
||||
$data['forums'][] = $kid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Handled in searchPlugin::buildWhereStatement
|
||||
//$return[] = array( 'column' => 'type_id', 'operator' => 'IN', 'value' => implode( ',', $data['forums'] ) );
|
||||
}
|
||||
|
||||
/* CONTENT ONLY */
|
||||
if ( $field == 'noPreview' AND $data['noPreview'] == 1 )
|
||||
{
|
||||
$this->search_plugin->noPostPreview = true;
|
||||
}
|
||||
|
||||
/* CONTENT ONLY */
|
||||
if ( $field == 'contentOnly' AND $data['contentOnly'] == 1 )
|
||||
{
|
||||
$this->search_plugin->onlyPosts = true;
|
||||
}
|
||||
|
||||
/* POST COUNT */
|
||||
if ( $field == 'pCount' AND intval( $data['pCount'] ) > 0 )
|
||||
{
|
||||
$return[] = array( 'column' => 't.posts', 'operator' => '>=', 'value' => intval( $data['pCount'] ) );
|
||||
}
|
||||
|
||||
/* TOPIC VIEWS */
|
||||
if ( $field == 'pViews' AND intval( $data['pViews'] ) > 0 )
|
||||
{
|
||||
$return[] = array( 'column' => 't.views', 'operator' => '>=', 'value' => intval( $data['pViews'] ) );
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify the search query
|
||||
*
|
||||
* @access public
|
||||
* @param array $query The current unmodified query
|
||||
* @param bool [$count_only] Set to true if this is a count(*) query
|
||||
* @return array Search query, modified by the plugin
|
||||
**/
|
||||
public function modifySearchQuery( $query, $count_only=false )
|
||||
{
|
||||
if( ipsRegistry::$settings['search_method'] == 'sphinx' )
|
||||
{
|
||||
$query->SetFilter( 'approved', array( 1 ) );
|
||||
$query->SetFilter( 'queued' , array( 0 ) );
|
||||
$query->SetFilter( 'password', array( 0 ) );
|
||||
|
||||
if( isset( ipsRegistry::$request['search_app_filters']['forums']['forums'] ) && is_array( ipsRegistry::$request['search_app_filters']['forums']['forums'] ) && count( ipsRegistry::$request['search_app_filters']['forums']['forums'] ) )
|
||||
{
|
||||
/* Load class_forums so that we can search sub forums automatically */
|
||||
if( ipsRegistry::isClassLoaded('class_forums') !== TRUE )
|
||||
{
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . '/sources/classes/forums/class_forums.php' );
|
||||
ipsRegistry::setClass( 'class_forums', new class_forums( ipsRegistry::instance() ) );
|
||||
ipsRegistry::getClass( 'class_forums' )->forumsInit();
|
||||
}
|
||||
|
||||
$forum_ids = array();
|
||||
|
||||
/* Get a list of child ids */
|
||||
foreach( ipsRegistry::$request['search_app_filters']['forums']['forums'] as $forum_id )
|
||||
{
|
||||
if( $forum_id )
|
||||
{
|
||||
$forum_ids[] = intval($forum_id);
|
||||
|
||||
//$children = ipsRegistry::getClass( 'class_forums' )->forumsGetChildren( $forum_id );
|
||||
|
||||
//foreach( $children as $kid )
|
||||
//{
|
||||
// if( ! in_array( $kid, ipsRegistry::$request['search_app_filters']['forums'] ) )
|
||||
// {
|
||||
// $forum_ids[] = $kid;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
if( is_array($forum_ids) AND count($forum_ids) )
|
||||
{
|
||||
$query->SetFilter( 'forum_id', $forum_ids );
|
||||
}
|
||||
}
|
||||
|
||||
/* Limit by forum */
|
||||
$type = ipsRegistry::$request['type'];
|
||||
$type_id = intval( ipsRegistry::$request['type_id'] );
|
||||
|
||||
if( $type && $type_id )
|
||||
{
|
||||
$query->SetFilter( 'forum_id', array( $type_id ) );
|
||||
}
|
||||
|
||||
/* Limit by topic */
|
||||
$type_2 = ipsRegistry::$request['type_2'];
|
||||
$type_id_2 = intval( ipsRegistry::$request['type_id_2'] );
|
||||
|
||||
if( $type_2 && $type_id_2 )
|
||||
{
|
||||
$query->SetFilter( 'tid', array( $type_id_2 ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the search query.
|
||||
* This allows us to set different indexes
|
||||
*
|
||||
* @access public
|
||||
* @param object $sphinxClient The sphinx client reference
|
||||
* @param string $search_term The search term
|
||||
* @param bool $group_results Group posts by topic
|
||||
* @return array Sphinx result array
|
||||
**/
|
||||
public function runSearchQuery( $sphinxClient, $search_term='', $group_results=false )
|
||||
{
|
||||
if( ipsRegistry::$settings['search_method'] == 'sphinx' )
|
||||
{
|
||||
if( ipsRegistry::$request['content_title_only'] == 1 )
|
||||
{
|
||||
return $sphinxClient->Query( $search_term, 'forums_search_topics_main,forums_search_topics_delta' );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( $group_results )
|
||||
{
|
||||
$sphinxClient->SetGroupBy( 'tid', SPH_GROUPBY_ATTR, '@group DESC');
|
||||
}
|
||||
|
||||
if( ipsRegistry::$request['f_content_only'] )
|
||||
{
|
||||
return $sphinxClient->Query( $search_term, 'forums_search_posts_main,forums_search_posts_delta' );
|
||||
}
|
||||
else
|
||||
{
|
||||
return $sphinxClient->Query( $search_term, 'forums_search_posts_main,forums_search_topics_main,forums_search_posts_delta,forums_search_topics_delta' );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,171 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Sphinx template file
|
||||
* Last Updated: $Date: 2009-08-12 18:07:52 -0400 (Wed, 12 Aug 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 5013 $
|
||||
* @since 3.0.0
|
||||
*
|
||||
*/
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
$appSphinxTemplate = <<<EOF
|
||||
|
||||
################################# --- FORUM --- ##############################
|
||||
source forums_search_posts_main : ipb_source_config
|
||||
{
|
||||
# Set our forum PID counter
|
||||
sql_query_pre = REPLACE INTO <!--SPHINX_DB_PREFIX-->cache_store VALUES( 'sphinx_forums_counter_posts', (SELECT max(pid) FROM <!--SPHINX_DB_PREFIX-->posts), '', 0, UNIX_TIMESTAMP() )
|
||||
|
||||
# Query posts for the main source
|
||||
sql_query = SELECT p.pid, p.pid as search_id, p.author_id, p.post_date, p.post, p.topic_id, p.queued, \
|
||||
t.tid, t.forum_id, t.approved, \
|
||||
REPLACE( pi.perm_view, '*', 0 ) as perm_view, \
|
||||
CASE WHEN pi.authorized_users IS NULL OR pi.authorized_users='' THEN 0 ELSE pi.authorized_users END AS authorized_users, \
|
||||
CASE WHEN pi.friend_only=0 THEN 0 ELSE p.author_id END AS friend_only, \
|
||||
CASE WHEN pi.owner_only=0 THEN 0 ELSE p.author_id END AS owner_only, \
|
||||
CASE WHEN f.password <> '' THEN 1 ELSE 0 END AS password \
|
||||
FROM <!--SPHINX_DB_PREFIX-->posts p \
|
||||
LEFT JOIN <!--SPHINX_DB_PREFIX-->topics t ON ( p.topic_id=t.tid ) \
|
||||
LEFT JOIN <!--SPHINX_DB_PREFIX-->forums f ON ( t.forum_id=f.id ) \
|
||||
LEFT JOIN <!--SPHINX_DB_PREFIX-->permission_index pi ON ( pi.perm_type_id=t.forum_id AND pi.perm_type='forum' )
|
||||
|
||||
# Fields
|
||||
sql_attr_bool = queued
|
||||
sql_attr_bool = approved
|
||||
sql_attr_uint = search_id
|
||||
sql_attr_uint = friend_only
|
||||
sql_attr_uint = forum_id
|
||||
sql_attr_uint = owner_only
|
||||
sql_attr_timestamp = post_date
|
||||
sql_attr_multi = uint perm_view from field
|
||||
sql_attr_multi = uint authorized_users from field
|
||||
sql_attr_bool = password
|
||||
sql_attr_uint = author_id
|
||||
sql_attr_uint = tid
|
||||
|
||||
sql_ranged_throttle = 0
|
||||
}
|
||||
|
||||
source forums_search_topics_main : ipb_source_config
|
||||
{
|
||||
# Set our forum PID counter
|
||||
sql_query_pre = REPLACE INTO <!--SPHINX_DB_PREFIX-->cache_store VALUES( 'sphinx_forums_counter_topics', (SELECT max(tid) FROM <!--SPHINX_DB_PREFIX-->topics), '', 0, UNIX_TIMESTAMP() )
|
||||
|
||||
# Query posts for the main source
|
||||
sql_query = SELECT t.tid, t.tid as search_id, t.forum_id, t.approved, t.title, t.last_post, t.last_poster_id as author_id, \
|
||||
REPLACE( pi.perm_view, '*', 0 ) as perm_view, \
|
||||
CASE WHEN pi.authorized_users IS NULL OR pi.authorized_users='' THEN 0 ELSE pi.authorized_users END AS authorized_users, \
|
||||
CASE WHEN pi.friend_only=0 THEN 0 ELSE t.last_poster_id END AS friend_only, \
|
||||
CASE WHEN pi.owner_only=0 THEN 0 ELSE t.last_poster_id END AS owner_only, \
|
||||
CASE WHEN f.password <> '' THEN 1 ELSE 0 END AS password \
|
||||
FROM <!--SPHINX_DB_PREFIX-->topics t \
|
||||
LEFT JOIN <!--SPHINX_DB_PREFIX-->forums f ON ( t.forum_id=f.id ) \
|
||||
LEFT JOIN <!--SPHINX_DB_PREFIX-->permission_index pi ON ( pi.perm_type_id=t.forum_id AND pi.perm_type='forum' )
|
||||
|
||||
# Fields
|
||||
sql_attr_bool = approved
|
||||
sql_attr_uint = search_id
|
||||
sql_attr_uint = friend_only
|
||||
sql_attr_uint = forum_id
|
||||
sql_attr_uint = owner_only
|
||||
sql_attr_timestamp = last_post
|
||||
sql_attr_multi = uint perm_view from field
|
||||
sql_attr_multi = uint authorized_users from field
|
||||
sql_attr_bool = password
|
||||
sql_attr_uint = author_id
|
||||
|
||||
sql_ranged_throttle = 0
|
||||
}
|
||||
|
||||
source forums_search_posts_delta : forums_search_posts_main
|
||||
{
|
||||
# Override the base sql_query_pre
|
||||
sql_query_pre =
|
||||
|
||||
# Query posts for the delta source
|
||||
sql_query = SELECT p.pid, p.pid as search_id, p.author_id, p.post_date, p.post, p.topic_id, p.queued, \
|
||||
t.tid, t.forum_id, t.approved, t.title, \
|
||||
REPLACE( pi.perm_view, '*', 0 ) as perm_view, \
|
||||
CASE WHEN pi.authorized_users IS NULL OR pi.authorized_users='' THEN 0 ELSE pi.authorized_users END AS authorized_users, \
|
||||
CASE WHEN pi.friend_only=0 THEN 0 ELSE p.author_id END AS friend_only, \
|
||||
CASE WHEN pi.owner_only=0 THEN 0 ELSE p.author_id END AS owner_only, \
|
||||
CASE WHEN f.password <> '' THEN 1 ELSE 0 END AS password \
|
||||
FROM <!--SPHINX_DB_PREFIX-->posts p \
|
||||
LEFT JOIN <!--SPHINX_DB_PREFIX-->topics t ON ( p.topic_id=t.tid ) \
|
||||
LEFT JOIN <!--SPHINX_DB_PREFIX-->forums f ON ( t.forum_id=f.id ) \
|
||||
LEFT JOIN <!--SPHINX_DB_PREFIX-->permission_index pi ON ( pi.perm_type_id=t.forum_id AND pi.perm_type='forum' ) \
|
||||
WHERE p.pid > ( SELECT cs_value FROM <!--SPHINX_DB_PREFIX-->cache_store WHERE cs_key='sphinx_forums_counter_posts' )
|
||||
}
|
||||
|
||||
source forums_search_topics_delta : forums_search_topics_main
|
||||
{
|
||||
# Override the base sql_query_pre
|
||||
sql_query_pre =
|
||||
|
||||
# Query posts for the delta source
|
||||
sql_query = SELECT t.tid, t.tid as search_id, t.forum_id, t.approved, t.title, t.last_post, t.last_poster_id as author_id, \
|
||||
REPLACE( pi.perm_view, '*', 0 ) as perm_view, \
|
||||
CASE WHEN pi.authorized_users IS NULL OR pi.authorized_users='' THEN 0 ELSE pi.authorized_users END AS authorized_users, \
|
||||
CASE WHEN pi.friend_only=0 THEN 0 ELSE t.last_poster_id END AS friend_only, \
|
||||
CASE WHEN pi.owner_only=0 THEN 0 ELSE t.last_poster_id END AS owner_only, \
|
||||
CASE WHEN f.password <> '' THEN 1 ELSE 0 END AS password \
|
||||
FROM <!--SPHINX_DB_PREFIX-->topics t \
|
||||
LEFT JOIN <!--SPHINX_DB_PREFIX-->forums f ON ( t.forum_id=f.id ) \
|
||||
LEFT JOIN <!--SPHINX_DB_PREFIX-->permission_index pi ON ( pi.perm_type_id=t.forum_id AND pi.perm_type='forum' ) \
|
||||
WHERE t.tid > ( SELECT cs_value FROM <!--SPHINX_DB_PREFIX-->cache_store WHERE cs_key='sphinx_forums_counter_topics' )
|
||||
}
|
||||
|
||||
index forums_search_posts_main
|
||||
{
|
||||
source = forums_search_posts_main
|
||||
path = <!--SPHINX_BASE_PATH-->/forums_search_posts_main
|
||||
|
||||
docinfo = extern
|
||||
mlock = 0
|
||||
morphology = none
|
||||
min_word_len = 2
|
||||
charset_type = sbcs
|
||||
html_strip = 0
|
||||
}
|
||||
|
||||
index forums_search_posts_delta : forums_search_posts_main
|
||||
{
|
||||
source = forums_search_posts_delta
|
||||
path = <!--SPHINX_BASE_PATH-->/forums_search_posts_delta
|
||||
}
|
||||
|
||||
index forums_search_topics_main
|
||||
{
|
||||
source = forums_search_topics_main
|
||||
path = <!--SPHINX_BASE_PATH-->/forums_search_topics_main
|
||||
|
||||
docinfo = extern
|
||||
mlock = 0
|
||||
morphology = none
|
||||
min_word_len = 2
|
||||
charset_type = sbcs
|
||||
html_strip = 0
|
||||
}
|
||||
|
||||
index forums_search_topics_delta : forums_search_topics_main
|
||||
{
|
||||
source = forums_search_topics_delta
|
||||
path = <!--SPHINX_BASE_PATH-->/forums_search_topics_delta
|
||||
}
|
||||
|
||||
|
||||
EOF;
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,73 @@
|
||||
/************************************************/
|
||||
/* IPB3 Javascript */
|
||||
/* -------------------------------------------- */
|
||||
/* acp.forums.js - Forum javascript */
|
||||
/* (c) IPS, Inc 2008 */
|
||||
/* -------------------------------------------- */
|
||||
/* Author: Brandon Farber */
|
||||
/************************************************/
|
||||
|
||||
ACPForums = {
|
||||
showModForm: 0,
|
||||
|
||||
/*------------------------------*/
|
||||
/* Constructor */
|
||||
init: function()
|
||||
{
|
||||
Debug.write("Initializing acp.forums.js");
|
||||
|
||||
document.observe("dom:loaded", function(){
|
||||
if( $('modUserName') )
|
||||
{
|
||||
ACPForums.autoComplete = new ipb.Autocomplete( $('modUserName'), { multibox: false, url: acp.autocompleteUrl, templates: { wrap: acp.autocompleteWrap, item: acp.autocompleteItem } } );
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
toggleModOptions: function()
|
||||
{
|
||||
$$('.moddiv').each( function(div){
|
||||
if( ACPForums.showModForm )
|
||||
{
|
||||
div.hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
div.show();
|
||||
}
|
||||
});
|
||||
|
||||
$( 'togglemod' ).innerHTML = ACPForums.showModForm ? ipb.lang['forums_showmod'] : ipb.lang['forums_hidemod'];
|
||||
ACPForums.showModForm = ACPForums.showModForm == 1 ? 0 : 1;
|
||||
return false;
|
||||
},
|
||||
|
||||
submitModForm: function()
|
||||
{
|
||||
var submitValue = '';
|
||||
|
||||
$$('input').each( function(cb){
|
||||
if( cb.type == 'checkbox' && cb.checked == true )
|
||||
{
|
||||
var mainname = cb.id.replace( /^(.+?)_.+?$/ , "$1" );
|
||||
var idname = cb.id.replace( /^(.+?)_(.+?)$/, "$2" );
|
||||
|
||||
if ( mainname == 'id' )
|
||||
{
|
||||
submitValue += ',' + idname;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('modforumids').value = submitValue;
|
||||
return true;
|
||||
},
|
||||
|
||||
convert: function()
|
||||
{
|
||||
$('convert').value = 1;
|
||||
$('adminform').submit();
|
||||
}
|
||||
};
|
||||
|
||||
ACPForums.init();
|
||||
@@ -0,0 +1,50 @@
|
||||
/************************************************/
|
||||
/* IPB3 Javascript */
|
||||
/* -------------------------------------------- */
|
||||
/* acp.rss.js - RSS Form javascript */
|
||||
/* (c) IPS, Inc 2008 */
|
||||
/* -------------------------------------------- */
|
||||
/* Author: Brandon Farber */
|
||||
/************************************************/
|
||||
|
||||
ACPRss = {
|
||||
|
||||
/*------------------------------*/
|
||||
/* Constructor */
|
||||
init: function()
|
||||
{
|
||||
Debug.write("Initializing acp.rss.js");
|
||||
|
||||
document.observe("dom:loaded", function(){
|
||||
if( $('rss_import_mid') )
|
||||
{
|
||||
ACPRss.autoComplete = new ipb.Autocomplete( $('rss_import_mid'), { multibox: false, url: acp.autocompleteUrl, templates: { wrap: acp.autocompleteWrap, item: acp.autocompleteItem } } );
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
showAuthBoxes: function()
|
||||
{
|
||||
var auth_req = $('rss_import_auth_userinfo');
|
||||
|
||||
if( !auth_req.visible() )
|
||||
{
|
||||
auth_req.show();
|
||||
}
|
||||
else
|
||||
{
|
||||
auth_req.hide();
|
||||
}
|
||||
},
|
||||
|
||||
validate: function()
|
||||
{
|
||||
formobj = $('rssimport_validate');
|
||||
formobj.value = "1";
|
||||
$('rssimport_form').submit();
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
ACPRss.init();
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,220 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Member property updater (AJAX)
|
||||
* Last Updated: $Date: 2009-08-18 16:46:02 -0400 (Tue, 18 Aug 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 1st march 2002
|
||||
* @version $Revision: 5027 $
|
||||
*
|
||||
*/
|
||||
|
||||
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 admin_forums_ajax_member_editform extends ipsAjaxCommand
|
||||
{
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load skin
|
||||
//-----------------------------------------
|
||||
|
||||
$this->html = ipsRegistry::getClass('output')->loadTemplate('cp_skin_member_form');
|
||||
|
||||
//-----------------------------------------
|
||||
// Load lang
|
||||
//-----------------------------------------
|
||||
|
||||
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'admin_forums' ) );
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'remove_avatar':
|
||||
$this->_removeAvatar();
|
||||
break;
|
||||
|
||||
case 'get_avatar_images':
|
||||
$this->_getAvatarImages();
|
||||
break;
|
||||
|
||||
case 'show':
|
||||
default:
|
||||
$this->show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get avatar images in a directory
|
||||
*
|
||||
* @access protected
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
protected function _getAvatarImages()
|
||||
{
|
||||
$dir = IPSText::alphanumericalClean( urldecode( $this->request['cat'] ), ' ' );
|
||||
$images = IPSMember::getFunction()->getHostedAvatarsFromCategory( $dir );
|
||||
|
||||
IPSDebug::fireBug( 'info', array( 'Directory: ' . $dir ) );
|
||||
|
||||
if ( $images === FALSE )
|
||||
{
|
||||
$this->returnJsonError($this->lang->words['m_nodir']);
|
||||
exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = $this->html->inline_avatar_images( $images );
|
||||
|
||||
$this->returnJsonArray( array('html' => $output) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove user's avatar
|
||||
*
|
||||
* @access protected
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
protected function _removeAvatar()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$member_id = intval( $this->request['member_id'] );
|
||||
|
||||
try
|
||||
{
|
||||
IPSMember::getFunction()->removeAvatar( $member_id );
|
||||
|
||||
$_string = <<<EOF
|
||||
{
|
||||
'success' : true,
|
||||
}
|
||||
|
||||
EOF;
|
||||
$this->returnString( $_string );
|
||||
}
|
||||
catch( Exception $error )
|
||||
{
|
||||
switch ( $error->getMessage() )
|
||||
{
|
||||
case 'NO_MEMBER_ID':
|
||||
$this->registry->output->showError( $this->lang->words['t_noid'], 1130 );
|
||||
break;
|
||||
case 'NO_PERMISSION':
|
||||
$this->registry->output->showError( $this->lang->words['t_permav'], 2130, true );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show the form
|
||||
*
|
||||
* @access protected
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
protected function show()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$name = trim( IPSText::alphanumericalClean( ipsRegistry::$request['name'] ) );
|
||||
$member_id = intval( ipsRegistry::$request['member_id'] );
|
||||
$output = '';
|
||||
|
||||
//-----------------------------------------
|
||||
// Get member data
|
||||
//-----------------------------------------
|
||||
|
||||
$member = IPSMember::load( $member_id, 'extendedProfile,customFields' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Got a member?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $member['member_id'] )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words['t_noid'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Return the form
|
||||
//-----------------------------------------
|
||||
|
||||
if ( method_exists( $this->html, $name ) )
|
||||
{
|
||||
$output = $this->html->$name( $member );
|
||||
}
|
||||
else
|
||||
{
|
||||
$save_to = '';
|
||||
$div_id = '';
|
||||
$form_field = '';
|
||||
$text = '';
|
||||
$description = '';
|
||||
$method = '';
|
||||
|
||||
|
||||
switch( $name )
|
||||
{
|
||||
/*case 'inline_warn_level':
|
||||
$method = 'inline_form_generic';
|
||||
$save_to = 'save_generic&field=warn_level';
|
||||
$div_id = 'warn_level';
|
||||
$form_field = ipsRegistry::getClass('output')->formInput( "generic__field", $member['warn_level'] );
|
||||
$text = "Member Warn Level";
|
||||
$description = "Make adjustments to the member's overall warn level. This does NOT add a warn log record - you should do so manually using the 'Add New Note' link if you wish to store a log of this adjustment";
|
||||
break;*/
|
||||
|
||||
case 'inline_avatar':
|
||||
if( !$this->registry->getClass('class_permissions')->checkPermission( 'member_photo', 'members', 'members' ) )
|
||||
{
|
||||
$this->returnJsonError($this->lang->words['m_nopermban']);
|
||||
}
|
||||
|
||||
$form = array();
|
||||
$form['avatar_url'] = ipsRegistry::getClass('output')->formInput( "avatar_url", $member['avatar_type'] == 'url' ? $member['avatar_location'] : '' );
|
||||
|
||||
$av_categories = array_merge( array( 0 => array( 0, $this->lang->words['m_selectcat'] ) ), IPSMember::getFunction()->getHostedAvatarCategories() );
|
||||
|
||||
$output = $this->html->inline_avatar_selector( $member, $av_categories );
|
||||
break;
|
||||
}
|
||||
|
||||
if ( ! $output AND $method AND method_exists( $html, $method ) )
|
||||
{
|
||||
$output = $html->$method( $member, $save_to, $div_id, $form_field, $text, $description );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Print...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->returnHtml( $output );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Default section for attachments module
|
||||
* Last Updated: $LastChangedDate: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 14th May 2003
|
||||
* @version $Rev: 4948 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Very simply returns the default section if one is not
|
||||
* passed in the URL
|
||||
*/
|
||||
|
||||
$DEFAULT_SECTION = 'types';
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,359 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Attachments: Search
|
||||
* Last Updated: $LastChangedDate: 2009-06-24 23:14:22 -0400 (Wed, 24 Jun 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since Mon 24th May 2004
|
||||
* @version $Rev: 4818 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_forums_attachments_search extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Skin object
|
||||
*
|
||||
* @access private
|
||||
* @var object Skin templates
|
||||
*/
|
||||
private $html;
|
||||
|
||||
/**
|
||||
* Shortcut for url
|
||||
*
|
||||
* @access private
|
||||
* @var string URL shortcut
|
||||
*/
|
||||
private $form_code;
|
||||
|
||||
/**
|
||||
* Shortcut for url (javascript)
|
||||
*
|
||||
* @access private
|
||||
* @var string JS URL shortcut
|
||||
*/
|
||||
private $form_code_js;
|
||||
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load HTML and language bits
|
||||
//-----------------------------------------
|
||||
$this->html = $this->registry->output->loadTemplate( 'cp_skin_attachments' );
|
||||
$this->lang->loadLanguageFile( array( 'admin_attachments' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Set up stuff
|
||||
//-----------------------------------------
|
||||
|
||||
$this->form_code = $this->html->form_code = 'module=attachments&section=search';
|
||||
$this->form_code_js = $this->html->form_code_js = 'module=attachments§ion=search';
|
||||
|
||||
//-----------------------------------------
|
||||
// StRT!
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'attach_search_complete':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'view_attachments' );
|
||||
$this->_searchResults();
|
||||
break;
|
||||
|
||||
case 'attach_bulk_remove':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'remove_attachments' );
|
||||
$this->_bulkRemoveAttachments();
|
||||
break;
|
||||
|
||||
case 'overview':
|
||||
case 'search':
|
||||
default:
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'view_attachments' );
|
||||
$this->_searchForm();
|
||||
break;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Bulk remove attachments
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _bulkRemoveAttachments()
|
||||
{
|
||||
foreach ( $_POST as $key => $value )
|
||||
{
|
||||
if ( preg_match( "/^attach_(\d+)$/", $key, $match ) )
|
||||
{
|
||||
if ( $this->request[ $match[0] ] )
|
||||
{
|
||||
$ids[] = $match[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ids = IPSLib::cleanIntArray( $ids );
|
||||
$attach_tid = array();
|
||||
|
||||
if ( count( $ids ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get attach details?
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => 'a.*',
|
||||
'from' => array( 'attachments' => 'a' ),
|
||||
'where' => "a.attach_rel_id > 0 AND a.attach_id IN(" . implode( ",", $ids ) . ")",
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 'p.pid, p.topic_id',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => "p.pid=a.attach_rel_id AND attach_rel_module='post'",
|
||||
'type' => 'left',
|
||||
),
|
||||
)
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $killmeh = $this->DB->fetch() )
|
||||
{
|
||||
if ( $killmeh['attach_location'] )
|
||||
{
|
||||
@unlink( $this->settings['upload_dir'] . "/" . $killmeh['attach_location'] );
|
||||
}
|
||||
|
||||
if ( $killmeh['attach_thumb_location'] )
|
||||
{
|
||||
@unlink( $this->settings['upload_dir'] . "/" . $killmeh['attach_thumb_location'] );
|
||||
}
|
||||
|
||||
$attach_tid[ $killmeh['topic_id'] ] = $killmeh['topic_id'];
|
||||
}
|
||||
|
||||
$this->DB->delete( 'attachments', "attach_id IN(" . implode( ",", $ids ) . ")" );
|
||||
|
||||
$this->registry->adminFunctions->saveAdminLog( sprintf( $this->lang->words['deleted_attachments'], implode( ",", $ids ) ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Recount topic upload marker
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPSLib::getAppDir('forums') . '/sources/classes/post/classPost.php' );
|
||||
|
||||
$postlib = new classPost( $this->registry );
|
||||
|
||||
foreach( $attach_tid as $tid )
|
||||
{
|
||||
if( $tid )
|
||||
{
|
||||
$postlib->recountTopicAttachments( $tid );
|
||||
}
|
||||
}
|
||||
|
||||
$this->registry->output->global_message = $this->lang->words['attachments_removed'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['noattach_to_remove'];
|
||||
}
|
||||
|
||||
if ( $this->request['return'] == 'stats' )
|
||||
{
|
||||
$this->registry->output->silentRedirectWithMessage( $this->settings['base_url'] . 'module=attachments§ion=stats' );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $_POST['url'] )
|
||||
{
|
||||
foreach( explode( '&', $_POST['url'] ) as $u )
|
||||
{
|
||||
list ( $k, $v ) = explode( '=', $u );
|
||||
|
||||
$this->request[ $k] = $v ;
|
||||
}
|
||||
}
|
||||
|
||||
$this->_searchResults();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Attachment search results
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _searchResults()
|
||||
{
|
||||
$show = intval($this->request['show']);
|
||||
$show = $show > 100 ? 100 : $show;
|
||||
|
||||
//-----------------------------------------
|
||||
// Build URL
|
||||
//-----------------------------------------
|
||||
|
||||
$url = "";
|
||||
$url_components = array( 'extension', 'filesize', 'filesize_gt', 'days', 'days_gt', 'hits', 'hits_gt', 'filename', 'authorname', 'onlyimage', 'orderby', 'sort', 'show' );
|
||||
|
||||
foreach( $url_components as $u )
|
||||
{
|
||||
$url .= $u . '=' . $this->request[ $u ] . '&';
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Build Query
|
||||
//-----------------------------------------
|
||||
|
||||
$queryfinal = "";
|
||||
$query = array();
|
||||
|
||||
if ( $this->request['extension'] )
|
||||
{
|
||||
$query[] = 'a.attach_ext="' . mb_strtolower( str_replace( ".", "", $this->request['extension'] ) ) . '"';
|
||||
}
|
||||
|
||||
if ( $this->request['filesize'] )
|
||||
{
|
||||
$gt = $this->request['filesize_gt'] == 'gt' ? '>=' : '<';
|
||||
|
||||
$query[] = "a.attach_filesize {$gt} " . intval( $this->request['filesize']*1024 );
|
||||
}
|
||||
|
||||
if ( $this->request['days'] )
|
||||
{
|
||||
$day_break = time() - intval( $this->request['days'] * 86400 );
|
||||
|
||||
$gt = $this->request['days_gt'] == 'lt' ? '>=' : '<';
|
||||
|
||||
$query[] = "a.attach_date {$gt} {$day_break}";
|
||||
}
|
||||
|
||||
if ( $this->request['hits'] )
|
||||
{
|
||||
$gt = $this->request['hits_gt'] == 'gt' ? '>=' : '<';
|
||||
|
||||
$query[] = "a.attach_hits {$gt} " . intval($this->request['hits']);
|
||||
}
|
||||
|
||||
if ( $this->request['filename'] )
|
||||
{
|
||||
$query[] = 'LOWER(a.attach_file) LIKE "%' . mb_strtolower( $this->request['filename'] ) . '%"';
|
||||
}
|
||||
|
||||
if ( $this->request['authorname'] )
|
||||
{
|
||||
$query[] = 'LOWER(p.author_name) LIKE "%' . mb_strtolower( $this->request['authorname'] ) . '%"';
|
||||
}
|
||||
|
||||
if ( $this->request['onlyimage'] )
|
||||
{
|
||||
$query[] = 'a.attach_is_image=1';
|
||||
}
|
||||
|
||||
if ( count($query) )
|
||||
{
|
||||
$queryfinal = 'AND '. implode( " AND ", $query );
|
||||
}
|
||||
|
||||
$rows = array();
|
||||
|
||||
$this->DB->build( array( 'select' => 'a.*',
|
||||
'from' => array( 'attachments' => 'a' ),
|
||||
'where' => "attach_rel_module='post'".$queryfinal,
|
||||
'add_join' => array(
|
||||
0 => array( 'select' => 'p.author_id, p.author_name, p.post_date',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'p.pid=a.attach_rel_id',
|
||||
'type' => 'left' ),
|
||||
1 => array( 'select' => 't.tid, t.forum_id, t.title',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 'p.topic_id=t.tid',
|
||||
'type' => 'left' ),
|
||||
2 => array( 'select' => 'm.members_display_name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=a.attach_member_id',
|
||||
'type' => 'left' )
|
||||
),
|
||||
'order' => "a.attach_" . $this->request['orderby'] . " " . $this->request['sort'],
|
||||
'limit' => array( 0, $show ) ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$r['stitle'] = $r['title'] ? "<a href='{$this->settings['board_url']}/index.php?showtopic={$r['tid']}&view=findpost&p={$r['attach_rel_id']}' title='{$r['title']}'>" . IPSText::truncate( $r['title'], 30 ) . "</a>" : $this->lang->words['attach_not_topic'];
|
||||
$r['attach_filesize'] = IPSLib::sizeFormat($r['attach_filesize']);
|
||||
$r['attach_date'] = ipsRegistry::getClass( 'class_localization')->getDate( $r['attach_date'], 'SHORT', 1 );
|
||||
|
||||
$rows[] = $r;
|
||||
}
|
||||
|
||||
$this->registry->output->html .= $this->html->attachmentSearchResults( $url, $rows );
|
||||
}
|
||||
|
||||
/**
|
||||
* Show attachment search form
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _searchForm()
|
||||
{
|
||||
$gt_array = array( 0 => array( 'gt', $this->lang->words['se_morethan'] ), 1 => array( 'lt', $this->lang->words['se_lessthan'] ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// FORM
|
||||
//-----------------------------------------
|
||||
|
||||
$form['extension'] = $this->registry->output->formSimpleInput( 'extension', isset($_POST['extension']) ? $_POST['extension'] : '', 10 );
|
||||
$form['filesize_gt'] = $this->registry->output->formDropdown( 'filesize_gt', $gt_array, isset($_POST['filesize_gt']) ? $_POST['filesize_gt'] : '' );
|
||||
$form['filesize'] = $this->registry->output->formSimpleInput( 'filesize', isset($_POST['filesize']) ? $_POST['filesize'] : '', 10 );
|
||||
$form['days_gt'] = $this->registry->output->formDropdown( 'days_gt', $gt_array, isset($_POST['days_gt']) ? $_POST['days_gt'] : '' );
|
||||
$form['days'] = $this->registry->output->formSimpleInput( 'days', isset($_POST['days']) ? $_POST['days'] : '', 10 );
|
||||
$form['hits_gt'] = $this->registry->output->formDropdown( 'hits_gt', $gt_array, isset($_POST['hits_gt']) ? $_POST['hits_gt'] : '' );
|
||||
$form['hits'] = $this->registry->output->formSimpleInput( 'hits', isset($_POST['hits']) ? $_POST['hits'] : '', 10 );
|
||||
$form['filename'] = $this->registry->output->formInput( 'filename', isset($_POST['filename']) ? $_POST['filename'] : '' );
|
||||
$form['authorname'] = $this->registry->output->formInput( 'authorname', isset($_POST['authorname']) ? $_POST['authorname'] : '' );
|
||||
$form['onlyimage'] = $this->registry->output->formYesNo( 'onlyimage', isset($_POST['onlyimage']) ? $_POST['onlyimage'] : '' );
|
||||
$form['orderby'] = $this->registry->output->formDropdown( 'orderby', array( 0 => array( 'date' , $this->lang->words['se_odate'] ),
|
||||
1 => array( 'hits' , $this->lang->words['se_oviews'] ),
|
||||
2 => array( 'filesize', $this->lang->words['se_osize'] ),
|
||||
3 => array( 'file' , $this->lang->words['se_oname'] ),
|
||||
), isset($_POST['orderby']) ? $_POST['orderby'] : '' );
|
||||
$form['sort'] = $this->registry->output->formDropdown( 'sort' , array( 0 => array( 'desc' , $this->lang->words['se_odsc'] ),
|
||||
1 => array( 'asc' , $this->lang->words['se_oasc'] ),
|
||||
), isset($_POST['sort']) ? $_POST['sort'] : '' );
|
||||
$form['show'] = $this->registry->output->formSimpleInput( 'show', isset($_POST['show']) ? $_POST['show'] : 25, 10 );
|
||||
|
||||
|
||||
$this->registry->output->html .= $this->html->attachmentSearchForm( $form );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,245 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Attachments: Stats
|
||||
* Last Updated: $LastChangedDate: 2009-11-09 08:04:23 -0500 (Mon, 09 Nov 2009) $
|
||||
*
|
||||
* @author $Author: matt $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since Mon 24th May 2004
|
||||
* @version $Rev: 5335 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_forums_attachments_stats extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Image directory
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $image_dir = '';
|
||||
|
||||
/**
|
||||
* HTML object
|
||||
*
|
||||
* @access private
|
||||
* @var object
|
||||
*/
|
||||
private $html;
|
||||
|
||||
/**
|
||||
* Main execution point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
/* Load Skin and Lang */
|
||||
$this->html = $this->registry->output->loadTemplate( 'cp_skin_attachments' );
|
||||
$this->html->form_code = 'module=attachments&section=stats&';
|
||||
$this->html->form_code_js = 'module=attachments&section=stats&';
|
||||
|
||||
$this->lang->loadLanguageFile( array( 'admin_attachments' ) );
|
||||
|
||||
/* Image Set */
|
||||
$this->image_dir = $this->registry->output->skin['set_image_dir'];
|
||||
|
||||
//-----------------------------------------
|
||||
// StRT!
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'overview':
|
||||
case 'stats':
|
||||
default:
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'stats_attachments' );
|
||||
$this->attachmentStatsOverview();
|
||||
break;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows attachment statistics
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function attachmentStatsOverview()
|
||||
{
|
||||
/* Get attachment Types */
|
||||
$cache['attachtypes'] = array();
|
||||
|
||||
$this->DB->build( array( 'select' => 'atype_extension,atype_mimetype,atype_post,atype_photo,atype_img', 'from' => 'attachments_type', 'where' => "atype_photo=1 OR atype_post=1" ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$cache['attachtypes'][ $r['atype_extension'] ] = $r;
|
||||
}
|
||||
|
||||
$stats = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count, sum(attach_filesize) as sum', 'from' => 'attachments', 'where' => 'attach_rel_module=\'post\'' ) );
|
||||
|
||||
/* Overall Stats */
|
||||
$overall_stats = array( 'total_attachments' => $this->registry->class_localization->formatNumber( $stats['count'] ), 'total_size' => IPSLib::sizeFormat( $stats['sum'] ) );
|
||||
|
||||
/* Last 5 Attachments */
|
||||
$this->DB->build( array(
|
||||
'select' => 'a.*',
|
||||
'from' => array( 'attachments' => 'a' ),
|
||||
'where' => "attach_rel_module='post'",
|
||||
'order' => "a.attach_date DESC",
|
||||
'limit' => array( 0, 5 ),
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 'p.author_id, p.author_name, p.post_date',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'p.pid=a.attach_rel_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
array(
|
||||
'select' => 't.tid, t.forum_id, t.title',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 'p.topic_id=t.tid',
|
||||
'type' => 'left'
|
||||
),
|
||||
array(
|
||||
'select' => 'm.members_display_name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=a.attach_member_id',
|
||||
'type' => 'left'
|
||||
)
|
||||
)
|
||||
) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
/* Loop through the last 5 */
|
||||
$last_5 = array();
|
||||
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
/* Format Fields */
|
||||
$r['stitle'] = $r['title'] ? "<a href='{$this->settings['board_url']}/index.php?showtopic={$r['tid']}&view=findpost&p={$r['attach_rel_id']}' title='{$r['title']}'>" . IPSText::truncate( $r['title'], 30 ) . "</a>" : $this->lang->words['attach_not_topic'];
|
||||
$r['_icon'] = $this->settings['mime_img'] . '/' . $cache['attachtypes'][ $r['attach_ext'] ]['atype_img'];
|
||||
$r['attach_filesize'] = IPSLib::sizeFormat( $r['attach_filesize'] );
|
||||
$r['post_date'] = $this->registry->class_localization->getDate( $r['attach_date'], 'SHORT', 1 );
|
||||
|
||||
/* Add to output array */
|
||||
$last_5[] = $r;
|
||||
}
|
||||
|
||||
/* Largest 5 Attachments */
|
||||
$this->DB->build( array(
|
||||
'select' => 'a.*',
|
||||
'from' => array( 'attachments' => 'a' ),
|
||||
'where' => "attach_rel_module='post'",
|
||||
'order' => "a.attach_filesize DESC",
|
||||
'limit' => array( 0, 5 ),
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 'p.author_id, p.author_name, p.post_date',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'p.pid=a.attach_rel_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
array(
|
||||
'select' => 't.tid, t.forum_id, t.title',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 'p.topic_id=t.tid',
|
||||
'type' => 'left'
|
||||
),
|
||||
array(
|
||||
'select' => 'm.members_display_name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=a.attach_member_id',
|
||||
'type' => 'left'
|
||||
)
|
||||
)
|
||||
) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
/* Loop through the last 5 */
|
||||
$largest_5 = array();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
/* Format Fields */
|
||||
$r['stitle'] = $r['title'] ? "<a href='{$this->settings['board_url']}/index.php?showtopic={$r['tid']}&view=findpost&p={$r['attach_rel_id']}' title='{$r['title']}'>" . IPSText::truncate( $r['title'], 30 ) . "</a>" : $this->lang->words['attach_not_topic'];
|
||||
$r['_icon'] = $this->settings['mime_img'] . '/' . $cache['attachtypes'][ $r['attach_ext'] ]['atype_img'];
|
||||
$r['attach_filesize'] = IPSLib::sizeFormat( $r['attach_filesize'] );
|
||||
$r['post_date'] = $this->registry->class_localization->getDate( $r['attach_date'], 'SHORT', 1 );
|
||||
|
||||
/* Add to output array */
|
||||
$largest_5[] = $r;
|
||||
}
|
||||
|
||||
/* 5 Most Viewed Downloads */
|
||||
$this->DB->build( array(
|
||||
'select' => 'a.*',
|
||||
'from' => array( 'attachments' => 'a' ),
|
||||
'where' => "attach_rel_module='post'",
|
||||
'order' => "a.attach_hits DESC",
|
||||
'limit' => array( 0, 5 ),
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 'p.author_id, p.author_name, p.post_date',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'p.pid=a.attach_rel_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
array(
|
||||
'select' => 't.tid, t.forum_id, t.title',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 'p.topic_id=t.tid',
|
||||
'type' => 'left'
|
||||
),
|
||||
array(
|
||||
'select' => 'm.members_display_name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=a.attach_member_id',
|
||||
'type' => 'left'
|
||||
)
|
||||
)
|
||||
) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
/* Loop through the last 5 */
|
||||
$most_viewed_5 = array();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
/* Format Fields */
|
||||
$r['stitle'] = $r['title'] ? "<a href='{$this->settings['board_url']}/index.php?showtopic={$r['tid']}&view=findpost&p={$r['attach_rel_id']}' title='{$r['title']}'>" . IPSText::truncate( $r['title'], 30 ) . "</a>" : $this->lang->words['attach_not_topic'];
|
||||
$r['_icon'] = $this->settings['mime_img'] . '/' . $cache['attachtypes'][ $r['attach_ext'] ]['atype_img'];
|
||||
$r['attach_filesize'] = IPSLib::sizeFormat( $r['attach_filesize'] );
|
||||
$r['post_date'] = $this->registry->class_localization->getDate( $r['attach_date'], 'SHORT', 1 );
|
||||
|
||||
/* Add to output array */
|
||||
$most_viewed_5[] = $r;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html .= $this->html->attachmentStats( $overall_stats, $last_5, $largest_5, $most_viewed_5 );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,453 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Attachments: Manage
|
||||
* Last Updated: $LastChangedDate: 2009-10-01 10:02:08 -0400 (Thu, 01 Oct 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since Mon 24th May 2004
|
||||
* @version $Rev: 5190 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_forums_attachments_types extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Image directory
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $image_dir = '';
|
||||
|
||||
/**
|
||||
* HTML object
|
||||
*
|
||||
* @access private
|
||||
* @var object
|
||||
*/
|
||||
private $html;
|
||||
|
||||
/**
|
||||
* Main execution point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
/* Load Skin and Lang */
|
||||
$this->html = $this->registry->output->loadTemplate( 'cp_skin_attachments' );
|
||||
$this->html->form_code = 'module=attachments&section=types&';
|
||||
$this->html->form_code_js = 'module=attachments&section=types&';
|
||||
|
||||
$this->lang->loadLanguageFile( array( 'admin_attachments' ) );
|
||||
|
||||
/* Image Set */
|
||||
$this->image_dir = $this->registry->output->skin['set_image_dir'];
|
||||
|
||||
//-----------------------------------------
|
||||
// StRT!
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'attach_add':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'mime_add' );
|
||||
$this->attachmentTypeForm('add');
|
||||
break;
|
||||
|
||||
case 'attach_doadd':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'mime_add' );
|
||||
$this->attachmentTypeSave('add');
|
||||
break;
|
||||
|
||||
case 'attach_edit':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'mime_edit' );
|
||||
$this->attachmentTypeForm('edit');
|
||||
break;
|
||||
|
||||
case 'attach_delete':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'mime_delete' );
|
||||
$this->attachmentTypeDelete();
|
||||
break;
|
||||
|
||||
case 'attach_doedit':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'mime_edit' );
|
||||
$this->attachmentTypeSave('edit');
|
||||
break;
|
||||
|
||||
case 'attach_export':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'mime_export' );
|
||||
$this->attachmentTypeExport();
|
||||
break;
|
||||
|
||||
case 'attach_import':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'mime_import' );
|
||||
$this->attachmentTypeImport();
|
||||
break;
|
||||
|
||||
case 'overview':
|
||||
default:
|
||||
$this->attachmentTypesOverview();
|
||||
break;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Imports attachment types from an xml document
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function attachmentTypeImport()
|
||||
{
|
||||
/* Get the XML Content */
|
||||
$content = $this->registry->adminFunctions->importXml( 'ipb_attachtypes.xml' );
|
||||
|
||||
/* Check to make sure we have content */
|
||||
if ( ! $content )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['ty_failed'];
|
||||
$this->attachmentTypesOverview();
|
||||
}
|
||||
|
||||
/* Get the XML class */
|
||||
require_once( IPS_KERNEL_PATH.'class_xml.php' );
|
||||
$xml = new class_xml();
|
||||
|
||||
/* Parse the XML document */
|
||||
$xml->xml_parse_document( $content );
|
||||
|
||||
/* Get a list of the types already installed */
|
||||
$types = array();
|
||||
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'attachments_type', 'order' => "atype_extension" ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$types[ $r['atype_extension'] ] = 1;
|
||||
}
|
||||
|
||||
/* Loop through the xml document and insert new types */
|
||||
foreach( $xml->xml_array['attachtypesexport']['attachtypesgroup']['attachtype'] as $entry )
|
||||
{
|
||||
/* Build the insert array */
|
||||
$insert_array = array( 'atype_extension' => $entry['atype_extension']['VALUE'],
|
||||
'atype_mimetype' => $entry['atype_mimetype']['VALUE'],
|
||||
'atype_post' => $entry['atype_post']['VALUE'],
|
||||
'atype_photo' => $entry['atype_photo']['VALUE'],
|
||||
'atype_img' => $entry['atype_img']['VALUE']
|
||||
);
|
||||
|
||||
/* Bypass if this type has already been added */
|
||||
if ( $types[ $entry['atype_extension']['VALUE'] ] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Insert the new type */
|
||||
if ( $entry['atype_extension']['VALUE'] and $entry['atype_mimetype']['VALUE'] )
|
||||
{
|
||||
$this->DB->insert( 'attachments_type', $insert_array );
|
||||
}
|
||||
}
|
||||
|
||||
/* Rebuild the cache and bounce */
|
||||
$this->attachmentTypeCacheRebuild();
|
||||
|
||||
$this->registry->output->global_message = $this->lang->words['ty_imported'];
|
||||
$this->attachmentTypesOverview();
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the attachment type xml export
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function attachmentTypeExport()
|
||||
{
|
||||
/* Get XML Class */
|
||||
require_once( IPS_KERNEL_PATH.'class_xml.php' );
|
||||
$xml = new class_xml();
|
||||
|
||||
/* Set the root of the XML document */
|
||||
$xml->xml_set_root( 'attachtypesexport' );
|
||||
|
||||
/* Add the attachment type group */
|
||||
$xml->xml_add_group( 'attachtypesgroup' );
|
||||
|
||||
/* Query the attachment Types */
|
||||
$this->DB->build( array(
|
||||
'select' => 'atype_extension,atype_mimetype,atype_post,atype_photo,atype_img',
|
||||
'from' => 'attachments_type',
|
||||
'order' => "atype_extension"
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
/* Loop through the types */
|
||||
$entry = array();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
/* INI */
|
||||
$content = array();
|
||||
|
||||
/* Build the tag */
|
||||
foreach ( $r as $k => $v )
|
||||
{
|
||||
$content[] = $xml->xml_build_simple_tag( $k, $v );
|
||||
}
|
||||
|
||||
/* Add to the entry */
|
||||
$entry[] = $xml->xml_build_entry( 'attachtype', $content );
|
||||
}
|
||||
|
||||
/* Add entries to the group and build the document */
|
||||
$xml->xml_add_entry_to_group( 'attachtypesgroup', $entry );
|
||||
$xml->xml_format_document();
|
||||
|
||||
/* Send for download */
|
||||
$this->registry->output->showDownload( $xml->xml_document, 'attachments.xml', "unknown/unknown", false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the specified attachment type
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function attachmentTypeDelete()
|
||||
{
|
||||
/* INI */
|
||||
$this->request[ 'id'] = intval( $this->request['id'] );
|
||||
|
||||
/* Delete the type */
|
||||
$this->DB->delete( 'attachments_type', "atype_id={$this->request['id']}" );
|
||||
|
||||
/* Build the cache and Bounce */
|
||||
$this->attachmentTypeCacheRebuild();
|
||||
|
||||
$this->registry->output->global_message = $this->lang->words['ty_deleted'];
|
||||
$this->attachmentTypesOverview();
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes the from for adding/editing attachments
|
||||
*
|
||||
* @access public
|
||||
* @param string $type Either add or edit
|
||||
* @return void
|
||||
**/
|
||||
public function attachmentTypeSave( $type='add' )
|
||||
{
|
||||
/* INI */
|
||||
$this->request['id'] = intval( $this->request['id'] );
|
||||
|
||||
/* Make sure the form was filled out */
|
||||
if ( ! $this->request['atype_extension'] or ! $this->request['atype_mimetype'] )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['ty_enterinfo'];
|
||||
$this->attachmentTypeForm( $type );
|
||||
return;
|
||||
}
|
||||
|
||||
/* Build the save array */
|
||||
$save_array = array( 'atype_extension' => str_replace( ".", "", $this->request['atype_extension'] ),
|
||||
'atype_mimetype' => $this->request['atype_mimetype'],
|
||||
'atype_post' => $this->request['atype_post'],
|
||||
'atype_photo' => $this->request['atype_photo'],
|
||||
'atype_img' => $this->request['atype_img']
|
||||
);
|
||||
|
||||
/* Add attachment type to the database */
|
||||
if ( $type == 'add' )
|
||||
{
|
||||
/* Check to see if this attachment type already exists */
|
||||
$attach = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'attachments_type', 'where' => "atype_extension='".$save_array['atype_extension']."'" ) );
|
||||
|
||||
if ( $attach['atype_id'] )
|
||||
{
|
||||
$this->registry->output->global_message = sprintf( $this->lang->words['ty_already'], $save_array['atype_extension'] );
|
||||
$this->attachmentTypeForm($type);
|
||||
}
|
||||
|
||||
/* Insert the attachment type */
|
||||
$this->DB->insert( 'attachments_type', $save_array );
|
||||
|
||||
/* Done Message */
|
||||
$this->registry->output->global_message = $this->lang->words['ty_added'];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Update the attachment type */
|
||||
$this->DB->update( 'attachments_type', $save_array, 'atype_id=' . $this->request['id'] );
|
||||
|
||||
/* Done Message */
|
||||
$this->registry->output->global_message = $this->lang->words['ty_edited'];
|
||||
}
|
||||
|
||||
/* Cache and Bounce */
|
||||
$this->attachmentTypeCacheRebuild();
|
||||
$this->attachmentTypesOverview();
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the form for adding/editing attachment types
|
||||
*
|
||||
* @access public
|
||||
* @param string $type Either add or edit
|
||||
* @return void
|
||||
**/
|
||||
public function attachmentTypeForm( $type='add' )
|
||||
{
|
||||
/* INI */
|
||||
$this->request[ 'id'] = $this->request['id'] ? intval( $this->request['id'] ) : 0;
|
||||
$this->request[ 'baseon'] = $this->request['baseon'] ? intval( $this->request['baseon'] ) : 0;
|
||||
|
||||
/* Navigation */
|
||||
$this->registry->output->nav[] = array( '', $this->lang->words['ty_addedit'] );
|
||||
|
||||
$baseon = '';
|
||||
|
||||
if( $type == 'add' )
|
||||
{
|
||||
/* Setup */
|
||||
$code = 'attach_doadd';
|
||||
$button = $this->lang->words['ty_addnew'];
|
||||
$id = 0;
|
||||
|
||||
/* Default Data */
|
||||
if( $this->request['baseon'] )
|
||||
{
|
||||
$attach = $this->DB->buildAndFetch( array(
|
||||
'select' => '*',
|
||||
'from' => 'attachments_type',
|
||||
'where' => 'atype_id=' . $this->request['baseon']
|
||||
) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$attach = array( 'atype_extension' => '',
|
||||
'atype_mimetype' => '',
|
||||
'atype_post' => '',
|
||||
'atype_photo' => '',
|
||||
'atype_img' => '' );
|
||||
}
|
||||
|
||||
/* Generate Based On Dropdown*/
|
||||
$dd = array();
|
||||
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'attachments_type', 'order' => 'atype_extension' ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
$dd[] = array( $r['atype_id'], $this->lang->words['ty_baseon'] . $r['atype_extension'] );
|
||||
}
|
||||
|
||||
$title = $button;
|
||||
$baseon = $this->html->attachmentTypeBaseOn( $this->registry->output->formDropdown( 'baseon', $dd ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Setup */
|
||||
$code = 'attach_doedit';
|
||||
$button = $this->lang->words['ty_edit'];
|
||||
$title = $button;
|
||||
$id = intval( $this->request['id'] );
|
||||
|
||||
/* Default Data */
|
||||
$attach = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'attachments_type', 'where' => 'atype_id='.ipsRegistry::$request['id'] ) );
|
||||
|
||||
/* Check for valid id */
|
||||
if ( ! $attach['atype_id'] )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['ty_noid'];
|
||||
$this->attachmentTypesOverview();
|
||||
}
|
||||
}
|
||||
|
||||
/* Form Elements */
|
||||
$form = array(
|
||||
'atype_extension' => $this->registry->output->formSimpleInput( 'atype_extension', ( isset( $this->request['atype_extension'] ) AND $this->request['atype_extension'] ) ? $this->request['atype_extension'] : $attach['atype_extension'], 10 ),
|
||||
'atype_mimetype' => $this->registry->output->formSimpleInput( 'atype_mimetype' , ( isset( $this->request['atype_mimetype'] ) AND $this->request['atype_mimetype'] ) ? $this->request['atype_mimetype'] : $attach['atype_mimetype'] , 40 ),
|
||||
'atype_post' => $this->registry->output->formYesNo( 'atype_post' , ( isset( $this->request['atype_post'] ) AND $this->request['atype_post'] ) ? $this->request['atype_post'] : $attach['atype_post'] ),
|
||||
'atype_photo' => $this->registry->output->formYesNo( 'atype_photo' , ( isset( $this->request['atype_photo'] ) AND $this->request['atype_photo'] ) ? $this->request['atype_photo'] : $attach['atype_photo'] ),
|
||||
'atype_img' => $this->registry->output->formSimpleInput( 'atype_img' , ( isset( $this->request['atype_img'] ) AND $this->request['atype_img'] ) ? $this->request['atype_img'] : $attach['atype_img'] , 40 ),
|
||||
);
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html .= $this->html->attachmentTypeForm( $title, $code, $id, $form, $button, $baseon );
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the attachment types that have been setup
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function attachmentTypesOverview()
|
||||
{
|
||||
/* Get the attachments */
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'attachments_type', 'order' => 'atype_extension' ) );
|
||||
$this->DB->execute();
|
||||
|
||||
/* Loop through the attachments */
|
||||
$attach_rows = array();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
$r['_imagedir'] = $this->image_dir;
|
||||
|
||||
$checked_img = "<img src='{$this->settings['skin_acp_url']}/_newimages/icons/tick.png' alt='Yes' />";
|
||||
$r['apost_checked'] = $r['atype_post'] ? $checked_img : ' ';
|
||||
$r['aphoto_checked'] = $r['atype_photo'] ? $checked_img : ' ';
|
||||
|
||||
$attach_rows[] = $r;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html .= $this->html->attachmentTypeOverview( $attach_rows );
|
||||
}
|
||||
|
||||
/*
|
||||
* Rebuilds the attachment type cache
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function attachmentTypeCacheRebuild()
|
||||
{
|
||||
$cache = array();
|
||||
|
||||
$this->DB->build( array( 'select' => 'atype_extension,atype_mimetype,atype_post,atype_photo,atype_img', 'from' => 'attachments_type', 'where' => "atype_photo=1 OR atype_post=1" ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$cache[ $r['atype_extension'] ] = $r;
|
||||
}
|
||||
|
||||
$this->cache->setCache( 'attachtypes', $cache, array( 'array' => 1, 'donow' => 0 ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<menu>
|
||||
<tabitems>
|
||||
<item>
|
||||
<title>Типы файлов</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Типы файлов</subitemtitle>
|
||||
<subsection>types</subsection>
|
||||
<subitemurl>do=overview</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
<item>
|
||||
<title>Статистика</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Статистика</subitemtitle>
|
||||
<subsection>stats</subsection>
|
||||
<subitemurl>do=overview</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
<item>
|
||||
<title>Поиск</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Поиск</subitemtitle>
|
||||
<subsection>search</subsection>
|
||||
<subitemurl>do=overview</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
</tabitems>
|
||||
</menu>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<permissions>
|
||||
<group>
|
||||
<grouptitle>Управление прикрепленными файлами</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>view_attachments</key>
|
||||
<string>Может просматривать и искать файлы?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>stats_attachments</key>
|
||||
<string>Может просматривать статистику?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>remove_attachments</key>
|
||||
<string>Может удалять?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
<group>
|
||||
<grouptitle>Управление типами прикрепляемых файлов</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>mime_add</key>
|
||||
<string>Может добавлять?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>mime_edit</key>
|
||||
<string>Может изменять?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>mime_delete</key>
|
||||
<string>Может удалять?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>mime_import</key>
|
||||
<string>Может импортировать типы?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>mime_export</key>
|
||||
<string>Может экспортировать типы?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
</permissions>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Default section setting
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since Tuesday 17th August 2004
|
||||
* @version $Revision: 4948 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Very simply returns the default section if one is not
|
||||
* passed in the URL
|
||||
*/
|
||||
|
||||
$DEFAULT_SECTION = 'forums';
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,697 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Forum moderator management
|
||||
* Last Updated: $Date: 2009-10-01 10:02:08 -0400 (Thu, 01 Oct 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since Tuesday 17th August 2004
|
||||
* @version $Revision: 5190 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_forums_forums_moderator extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Forum functions library
|
||||
*
|
||||
* @access public
|
||||
* @var object
|
||||
*/
|
||||
public $forumfunc;
|
||||
|
||||
/**
|
||||
* Skin methods library
|
||||
*
|
||||
* @access public
|
||||
* @var object
|
||||
*/
|
||||
public $html;
|
||||
|
||||
/**
|
||||
* Main execution point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
/* Admin forum functions */
|
||||
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . '/sources/classes/forums/admin_forum_functions.php' );
|
||||
|
||||
$this->forumfunc = new admin_forum_functions( $registry );
|
||||
|
||||
/* Skin and Lang */
|
||||
$this->html = $this->registry->output->loadTemplate( 'cp_skin_forums' );
|
||||
$this->html->form_code = 'module=forums&section=moderator&';
|
||||
$this->html->form_code_js = 'module=forums&section=moderator&';
|
||||
|
||||
$this->lang->loadLanguageFile( array( 'admin_forums' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'add':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'mods_add' );
|
||||
$this->moderatorAddPreform();
|
||||
break;
|
||||
|
||||
case 'add_final':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'mods_add' );
|
||||
$this->modForm('add');
|
||||
break;
|
||||
|
||||
case 'doadd':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'mods_add' );
|
||||
$this->addMod();
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'mods_edit' );
|
||||
$this->modForm('edit');
|
||||
break;
|
||||
|
||||
case 'doedit':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'mods_edit' );
|
||||
$this->doEdit();
|
||||
break;
|
||||
|
||||
case 'remove':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'mods_delete' );
|
||||
$this->delete();
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->registry->output->silentRedirect( $this->settings['_base_url'] . 'app=core&module=help&id=mod_mmod' );
|
||||
break;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Pass to CP output hander
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a moderator
|
||||
*
|
||||
* @access public
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
if ($this->request['mid'] == "")
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['mod_valid'], 11319 );
|
||||
}
|
||||
|
||||
$mod = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'moderators', 'where' => "mid=".intval($this->request['mid']) ) );
|
||||
|
||||
if ( $mod['is_group'] )
|
||||
{
|
||||
$name = $this->lang->words['mod_group'].$mod['group_name'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$getname = $this->DB->buildAndFetch( array( 'select' => 'members_display_name', 'from' => 'members', 'where' => 'member_id=' . $mod['member_id'] ) );
|
||||
|
||||
$name = $getname['members_display_name'];
|
||||
}
|
||||
|
||||
if( $this->request['fid'] == 'all' )
|
||||
{
|
||||
$this->DB->delete( 'moderators', "mid=".intval($this->request['mid']) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Delete *all* instances of this moderator
|
||||
//-----------------------------------------
|
||||
|
||||
if( $mod['is_group'] )
|
||||
{
|
||||
$this->DB->delete( 'moderators', "is_group=1 AND group_id=". $mod['group_id'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->DB->delete( 'moderators', "is_group=0 AND member_id=". $mod['member_id'] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$forumIds = explode( ',', IPSText::cleanPermString( $mod['forum_id'] ) );
|
||||
$newForums = array();
|
||||
|
||||
foreach( $forumIds as $aForumId )
|
||||
{
|
||||
if( $aForumId != $this->request['fid'] )
|
||||
{
|
||||
$newForums[] = $aForumId;
|
||||
}
|
||||
}
|
||||
|
||||
if( !count($newForums) )
|
||||
{
|
||||
$this->DB->delete( 'moderators', "mid=" . $mod['mid'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->DB->update( 'moderators', array( 'forum_id' => ',' . implode( ',', $newForums ) . ',' ), 'mid=' . $mod['mid'] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->rebuildModeratorCache();
|
||||
|
||||
ipsRegistry::getClass('adminFunctions')->saveAdminLog( sprintf($this->lang->words['mod_removedlog'], $name) );
|
||||
|
||||
$this->registry->output->global_message = $this->lang->words['mod_removed'];
|
||||
$this->registry->output->silentRedirectWithMessage( $this->settings['base_url'].'&app=forums&module=forums§ion=forums' );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Edit a moderator
|
||||
*
|
||||
* @access public
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doEdit()
|
||||
{
|
||||
if( $this->request['mid'] == "" )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['mod_valid'], 11321 );
|
||||
}
|
||||
|
||||
$forums = array();
|
||||
|
||||
foreach( $this->request['forums'] as $forum_id )
|
||||
{
|
||||
$forums[ $forum_id ] = $forum_id;
|
||||
}
|
||||
|
||||
$mod = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'moderators', 'where' => "mid=" . intval( $this->request['mid'] ) ) );
|
||||
|
||||
if( $mod['is_group'] )
|
||||
{
|
||||
foreach( $forums as $forum_id )
|
||||
{
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'moderators', 'where' => "forum_id LIKE '%,{$forum_id},%' and group_id=" . $mod['group_id'] . ' AND mid<>' . $mod['mid'] ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $f = $this->DB->fetch() )
|
||||
{
|
||||
$theseForums = explode( ',', IPSText::cleanPermString( $f['forum_id'] ) );
|
||||
|
||||
foreach( $theseForums as $thisForumId )
|
||||
{
|
||||
unset($forums[ $thisForumId ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach( $forums as $forum_id )
|
||||
{
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'moderators', 'where' => "forum_id LIKE '%,{$forum_id},%' and member_id=" . $mod['member_id'] . ' AND mid<>' . $mod['mid'] ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $f = $this->DB->fetch() )
|
||||
{
|
||||
$theseForums = explode( ',', IPSText::cleanPermString( $f['forum_id'] ) );
|
||||
|
||||
foreach( $theseForums as $thisForumId )
|
||||
{
|
||||
unset($forums[ $thisForumId ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Build Mr Hash
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->update( 'moderators', array(
|
||||
'forum_id' => ',' . implode( ',', $forums ) . ',',
|
||||
'edit_post' => intval( $this->request['edit_post'] ),
|
||||
'edit_topic' => intval( $this->request['edit_topic'] ),
|
||||
'delete_post' => intval( $this->request['delete_post'] ),
|
||||
'delete_topic' => intval( $this->request['delete_topic'] ),
|
||||
'view_ip' => intval( $this->request['view_ip'] ),
|
||||
'open_topic' => intval( $this->request['open_topic'] ),
|
||||
'close_topic' => intval( $this->request['close_topic'] ),
|
||||
'mass_move' => intval( $this->request['mass_move'] ),
|
||||
'mass_prune' => intval( $this->request['mass_prune'] ),
|
||||
'move_topic' => intval( $this->request['move_topic'] ),
|
||||
'pin_topic' => intval( $this->request['pin_topic'] ),
|
||||
'unpin_topic' => intval( $this->request['unpin_topic'] ),
|
||||
'post_q' => intval( $this->request['post_q'] ),
|
||||
'topic_q' => intval( $this->request['topic_q'] ),
|
||||
'allow_warn' => intval( $this->request['allow_warn'] ),
|
||||
'split_merge' => intval( $this->request['split_merge'] ),
|
||||
'edit_user' => intval( $this->request['edit_user'] ),
|
||||
'can_mm' => intval( $this->request['can_mm'] ),
|
||||
'mod_can_set_open_time' => intval( $this->request['mod_can_set_open_time'] ),
|
||||
'mod_can_set_close_time' => intval( $this->request['mod_can_set_close_time'] ),
|
||||
'mod_bitoptions' => IPSBWOptions::freeze( $this->request, 'moderators', 'forums' )
|
||||
), 'mid='.intval($this->request['mid']) );
|
||||
|
||||
$this->rebuildModeratorCache();
|
||||
|
||||
$this->registry->adminFunctions->saveAdminLog( sprintf( $this->lang->words['mod_editedlog'], $mod['member_name'] ) );
|
||||
|
||||
$this->registry->output->global_message = $this->lang->words['mod_edited'];
|
||||
$this->registry->output->silentRedirectWithMessage( $this->settings['base_url'].'module=forums§ion=forums' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a moderator
|
||||
*
|
||||
* @access public
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function addMod()
|
||||
{
|
||||
if( !is_array($this->request['forums']) OR !count($this->request['forums']) )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['mod_noforums'], 11320 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Build Mr Hash
|
||||
//-----------------------------------------
|
||||
|
||||
$mr_hash = array(
|
||||
'edit_post' => intval( $this->request['edit_post'] ),
|
||||
'edit_topic' => intval( $this->request['edit_topic'] ),
|
||||
'delete_post' => intval( $this->request['delete_post'] ),
|
||||
'delete_topic' => intval( $this->request['delete_topic'] ),
|
||||
'view_ip' => intval( $this->request['view_ip'] ),
|
||||
'open_topic' => intval( $this->request['open_topic'] ),
|
||||
'close_topic' => intval( $this->request['close_topic'] ),
|
||||
'mass_move' => intval( $this->request['mass_move'] ),
|
||||
'mass_prune' => intval( $this->request['mass_prune'] ),
|
||||
'move_topic' => intval( $this->request['move_topic'] ),
|
||||
'pin_topic' => intval( $this->request['pin_topic'] ),
|
||||
'unpin_topic' => intval( $this->request['unpin_topic'] ),
|
||||
'post_q' => intval( $this->request['post_q'] ),
|
||||
'topic_q' => intval( $this->request['topic_q'] ),
|
||||
'allow_warn' => intval( $this->request['allow_warn'] ),
|
||||
'split_merge' => intval( $this->request['split_merge'] ),
|
||||
'edit_user' => intval( $this->request['edit_user'] ),
|
||||
'can_mm' => intval( $this->request['can_mm'] ),
|
||||
'mod_can_set_open_time' => intval( $this->request['mod_can_set_open_time'] ),
|
||||
'mod_can_set_close_time' => intval( $this->request['mod_can_set_close_time'] ),
|
||||
'forum_id' => ',' . implode( ',', $this->request['forums'] ) . ',',
|
||||
'mod_bitoptions' => IPSBWOptions::freeze( $this->request, 'moderators', 'forums' )
|
||||
);
|
||||
|
||||
$forums = array();
|
||||
|
||||
foreach( $this->request['forums'] as $forum_id )
|
||||
{
|
||||
$forums[ $forum_id ] = $forum_id;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
if( $this->request['mod_type'] == 'group' )
|
||||
{
|
||||
if( $this->request['gid'] == "" )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['mod_gid'], 11322 );
|
||||
}
|
||||
|
||||
$this->DB->build( array( 'select' => 'g_id, g_title', 'from' => 'groups', 'where' => "g_id=" . intval( $this->request['gid'] ) ) );
|
||||
$this->DB->execute();
|
||||
|
||||
if ( ! $group = $this->DB->fetch() )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['mod_gid'], 11323 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Already using this group on this forum?
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $forums as $forum_id )
|
||||
{
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'moderators', 'where' => "forum_id LIKE '%,{$forum_id},%' and group_id=" . intval( $this->request['gid'] ) ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $f = $this->DB->fetch() )
|
||||
{
|
||||
$theseForums = explode( ',', IPSText::cleanPermString( $f['forum_id'] ) );
|
||||
|
||||
foreach( $theseForums as $thisForumId )
|
||||
{
|
||||
unset($forums[ $thisForumId ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$mr_hash['member_name'] = '-1';
|
||||
$mr_hash['member_id'] = '-1';
|
||||
$mr_hash['group_id'] = $group['g_id'];
|
||||
$mr_hash['group_name'] = $group['g_title'];
|
||||
$mr_hash['is_group'] = 1;
|
||||
|
||||
$ad_log = sprintf( $this->lang->words['mod_addedgroup'], $group['g_title'] );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if( $this->request['mem'] == "" )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['mod_nomember'], 11324 );
|
||||
}
|
||||
|
||||
$this->DB->build( array( 'select' => 'member_id, members_display_name', 'from' => 'members', 'where' => "member_id=" . intval( $this->request['mem'] ) ) );
|
||||
$this->DB->execute();
|
||||
|
||||
if ( ! $mem = $this->DB->fetch() )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['mod_memid'], 11325 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Already using this member on this forum?
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $forums as $forum_id )
|
||||
{
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'moderators', 'where' => "forum_id LIKE '%,{$forum_id},%' and member_id=" . intval( $this->request['mem'] ) ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $f = $this->DB->fetch() )
|
||||
{
|
||||
$theseForums = explode( ',', IPSText::cleanPermString( $f['forum_id'] ) );
|
||||
|
||||
foreach( $theseForums as $thisForumId )
|
||||
{
|
||||
unset($forums[ $thisForumId ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$mr_hash['member_name'] = $mem['members_display_name'];
|
||||
$mr_hash['member_id'] = $mem['member_id'];
|
||||
$mr_hash['is_group'] = 0;
|
||||
|
||||
$ad_log = sprintf( $this->lang->words['mod_addedmem'], $mem['members_display_name'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check for legal forums
|
||||
//-----------------------------------------
|
||||
|
||||
if( count( $forums ) == 0 )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['mod_nonewfor'], 11326 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Loopy loopy
|
||||
//-----------------------------------------
|
||||
|
||||
$mr_has['forum_id'] = ',' . implode( ',', $forums ) . ',';
|
||||
|
||||
$this->DB->force_data_type = array( 'member_name' => 'string' );
|
||||
|
||||
$this->DB->insert( 'moderators', $mr_hash );
|
||||
|
||||
$this->registry->adminFunctions->saveAdminLog($ad_log);
|
||||
|
||||
$this->rebuildModeratorCache();
|
||||
|
||||
$this->registry->output->global_message = $this->lang->words['mod_added'];
|
||||
$this->registry->output->silentRedirectWithMessage( $this->settings['base_url'].'&module=forums§ion=forums' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild moderator cache
|
||||
*
|
||||
* @access public
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function rebuildModeratorCache()
|
||||
{
|
||||
$new_cache = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Get dem moderators
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array( 'select' => 'moderator.*',
|
||||
'from' => array( 'moderators' => 'moderator' ),
|
||||
'add_join' => array( 0 => array( 'select' => 'm.members_display_name, m.members_seo_name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.member_id=moderator.member_id",
|
||||
'type' => 'left' ) ) ) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $i = $this->DB->fetch() )
|
||||
{
|
||||
$forums = explode( ',', IPSText::cleanPermString( $i['forum_id'] ) );
|
||||
|
||||
/* Unpack bitwise fields */
|
||||
$_tmp = IPSBWOptions::thaw( $i['mod_bitoptions'], 'moderators', 'forums' );
|
||||
|
||||
if ( count( $_tmp ) )
|
||||
{
|
||||
foreach( $_tmp as $k => $v )
|
||||
{
|
||||
$i[ $k ] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
foreach( $forums as $forum_id )
|
||||
{
|
||||
$i['forum_id'] = $forum_id;
|
||||
$new_cache[] = $i;
|
||||
}
|
||||
}
|
||||
|
||||
$this->cache->setCache( 'moderators', $new_cache, array( 'array' => 1, 'donow' => 0 ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the add/edit form
|
||||
*
|
||||
* @access public
|
||||
* @param string [add|edit]
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function modForm( $type='add' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$group = array();
|
||||
|
||||
if ( $type == 'add' )
|
||||
{
|
||||
/* Form Data */
|
||||
$mod_type = $this->request['group'] ? 'group' : 'name';
|
||||
$mod = array();
|
||||
$names = array();
|
||||
$forum_id = explode( ',', $this->request['fid'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Start proper
|
||||
//-----------------------------------------
|
||||
|
||||
$button = $this->lang->words['mod_addthis'];
|
||||
|
||||
$form_code = 'doadd';
|
||||
|
||||
if ( $this->request['group'] )
|
||||
{
|
||||
$this->DB->build( array( 'select' => 'g_id, g_title', 'from' => 'groups', 'where' => "g_id=" . intval( $this->request['group'] ) ) );
|
||||
$this->DB->execute();
|
||||
|
||||
if (! $group = $this->DB->fetch() )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['mod_nogroup'], 11327 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! $this->request['member_id'] )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['mod_memid'], 11328 );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->DB->build( array( 'select' => 'members_display_name, member_id', 'from' => 'members', 'where' => 'member_id=' . intval( $this->request['member_id'] ) ) );
|
||||
$this->DB->execute();
|
||||
|
||||
if ( ! $mem = $this->DB->fetch() )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['mod_memid'], 11329 );
|
||||
}
|
||||
|
||||
$member_id = $mem['member_id'];
|
||||
$member_name = $mem['members_display_name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Check the moderator */
|
||||
if ($this->request['mid'] == "")
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['mod_valid'], 11330 );
|
||||
}
|
||||
|
||||
/* Form bits */
|
||||
$button = $this->lang->words['mod_edithis'];
|
||||
$form_code = "doedit";
|
||||
|
||||
/* Moderator Info */
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'moderators', 'where' => "mid=" . intval( $this->request['mid'] ) ) );
|
||||
$this->DB->execute();
|
||||
|
||||
if ( ! $mod = $this->DB->fetch() )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['mod_mid'], 11331 );
|
||||
}
|
||||
|
||||
/* BW Options */
|
||||
$_tmp = IPSBWOptions::thaw( $mod['mod_bitoptions'], 'moderators', 'forums' );
|
||||
|
||||
if ( count( $_tmp ) )
|
||||
{
|
||||
foreach( $_tmp as $k => $v )
|
||||
{
|
||||
$mod[ $k ] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
/* Other */
|
||||
$forum_id = explode( ',', IPSText::cleanPermString( $mod['forum_id'] ) );
|
||||
$member_id = $mod['member_id'];
|
||||
$member_name = $mod['member_name'];
|
||||
$mod_type = $mod['is_group'] ? 'group' : 'name';
|
||||
}
|
||||
|
||||
/* Form Fields */
|
||||
$mod['edit_post'] = $this->registry->output->formYesNo( 'edit_post' , $mod['edit_post'] );
|
||||
$mod['edit_topic'] = $this->registry->output->formYesNo( 'edit_topic' , $mod['edit_topic'] );
|
||||
$mod['delete_post'] = $this->registry->output->formYesNo( 'delete_post' , $mod['delete_post'] );
|
||||
$mod['delete_topic'] = $this->registry->output->formYesNo( 'delete_topic' , $mod['delete_topic'] );
|
||||
$mod['view_ip'] = $this->registry->output->formYesNo( 'view_ip' , $mod['view_ip'] );
|
||||
$mod['open_topic'] = $this->registry->output->formYesNo( 'open_topic' , $mod['open_topic'] );
|
||||
$mod['close_topic'] = $this->registry->output->formYesNo( 'close_topic' , $mod['close_topic'] );
|
||||
$mod['move_topic'] = $this->registry->output->formYesNo( 'move_topic' , $mod['move_topic'] );
|
||||
$mod['pin_topic'] = $this->registry->output->formYesNo( 'pin_topic' , $mod['pin_topic'] );
|
||||
$mod['unpin_topic'] = $this->registry->output->formYesNo( 'unpin_topic' , $mod['unpin_topic'] );
|
||||
$mod['split_merge'] = $this->registry->output->formYesNo( 'split_merge' , $mod['split_merge'] );
|
||||
$mod['mod_can_set_open_time'] = $this->registry->output->formYesNo( 'mod_can_set_open_time' , $mod['mod_can_set_open_time'] );
|
||||
$mod['mod_can_set_close_time'] = $this->registry->output->formYesNo( 'mod_can_set_close_time', $mod['mod_can_set_close_time'] );
|
||||
$mod['mass_move'] = $this->registry->output->formYesNo( 'mass_move' , $mod['mass_move'] );
|
||||
$mod['mass_prune'] = $this->registry->output->formYesNo( 'mass_prune' , $mod['mass_prune'] );
|
||||
$mod['topic_q'] = $this->registry->output->formYesNo( 'topic_q' , $mod['topic_q'] );
|
||||
$mod['post_q'] = $this->registry->output->formYesNo( 'post_q' , $mod['post_q'] );
|
||||
$mod['allow_warn'] = $this->registry->output->formYesNo( 'allow_warn' , $mod['allow_warn'] );
|
||||
$mod['can_mm'] = $this->registry->output->formYesNo( 'can_mm' , $mod['can_mm'] );
|
||||
$mod['bw_flag_spammers'] = $this->registry->output->formYesNo( 'bw_flag_spammers' , $mod['bw_flag_spammers'] );
|
||||
$mod['forums'] = $this->registry->output->formMultiDropdown( 'forums[]' , $this->registry->getClass('class_forums')->adForumsForumList(1), $forum_id );
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html .= $this->html->moderatorPermissionForm( $mod, $form_code, $mod['mid'], $member_id, $mod_type, $group['g_id'], $group['g_name'], $button );
|
||||
}
|
||||
|
||||
/**
|
||||
* Refine member search, if necessary
|
||||
*
|
||||
* @access public
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function moderatorAddPreform()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$type = $this->request['name'] ? 'name' : 'group';
|
||||
$this->request['fid'] = ltrim( $this->request['modforumids'], ',' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Are we adding a group as a mod?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $type == 'group' )
|
||||
{
|
||||
$this->modForm();
|
||||
return;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Got forums?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $this->request['fid'] )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['mod_noforums'];
|
||||
$this->registry->output->silentRedirectWithMessage( $this->settings['base_url'] . '&module=forums§ion=forums' );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Else continue as normal.
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->request['name'] == "" )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['mod_nomember'];
|
||||
$this->registry->output->silentRedirectWithMessage( $this->settings['base_url'] . '&module=forums§ion=forums' );
|
||||
}
|
||||
|
||||
$this->DB->build( array( 'select' => 'member_id, members_display_name as name', 'from' => 'members', 'where' => "members_display_name LIKE '{$this->request['name']}%' OR members_display_name LIKE '{$this->request['name']}%'" ) );
|
||||
$this->DB->execute();
|
||||
|
||||
if (! $this->DB->getTotalRows() )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['mod_noresults'];
|
||||
$this->registry->output->silentRedirectWithMessage( $this->settings['base_url'] . '&module=forums§ion=forums' );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Show possible matches
|
||||
//-----------------------------------------
|
||||
|
||||
$form_array = array();
|
||||
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$form_array[] = array( $r['member_id'] , $r['name'] );
|
||||
}
|
||||
|
||||
/* Page Header */
|
||||
$this->registry->output->html_help_title = $this->lang->words['mod_add'];
|
||||
$this->registry->output->html_help_msg = $this->lang->words['mod_add_info'];
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html .= $this->html->moderatorSelectForm( $this->request['fid'], $this->registry->output->formDropdown( "member_id", $form_array ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,464 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Topic Multi-Moderation
|
||||
* Last Updated: $LastChangedDate: 2009-10-01 10:02:08 -0400 (Thu, 01 Oct 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 14th May 2003
|
||||
* @version $Rev: 5190 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_forums_forums_multimods extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Forum functions library
|
||||
*
|
||||
* @access private
|
||||
* @var object
|
||||
*/
|
||||
private $forumfunc;
|
||||
|
||||
/**
|
||||
* Main execution point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
/* Setup Forum Classes */
|
||||
$this->registry->class_forums->forumsInit();
|
||||
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . '/sources/classes/forums/admin_forum_functions.php' );
|
||||
|
||||
$this->forumfunc = new admin_forum_functions( $registry );
|
||||
$this->forumfunc->forumsInit();
|
||||
|
||||
/* Load Skin and Lang */
|
||||
$this->html = $this->registry->output->loadTemplate( 'cp_skin_multimods' );
|
||||
$this->html->form_code = 'module=forums&section=multimods&';
|
||||
$this->html->form_code_js = 'module=forums&section=multimods&';
|
||||
|
||||
$this->lang->loadLanguageFile( array( 'admin_forums' ) );
|
||||
|
||||
/* Navigation */
|
||||
$this->registry->output->nav[] = array( $this->form_code, $this->lang->words['mm_nav'] );
|
||||
$this->registry->output->extra_title[] = $this->lang->words['mm_nav'];
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'new':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'mmod_add' );
|
||||
$this->multiModerationForm( 'new' );
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'mmod_edit' );
|
||||
$this->multiModerationForm( 'edit' );
|
||||
break;
|
||||
|
||||
case 'donew':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'mmod_add' );
|
||||
$this->multiModerationSaveForm( 'new' );
|
||||
break;
|
||||
|
||||
case 'doedit':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'mmod_edit' );
|
||||
$this->multiModerationSaveForm( 'edit' );
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'mmod_delete' );
|
||||
$this->multiModerationDelete();
|
||||
break;
|
||||
|
||||
case 'overview':
|
||||
default:
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'mmod_view' );
|
||||
$this->multiModerationOverview();
|
||||
break;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a multi moderation
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function multiModerationDelete()
|
||||
{
|
||||
/* Check ID */
|
||||
if ($this->request['id'] == "")
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['mm_noid'], 11332 );
|
||||
}
|
||||
|
||||
/* Delete the record */
|
||||
$this->DB->delete( 'topic_mmod', "mm_id=" . intval( $this->request['id'] ) );
|
||||
|
||||
/* Rebuild Cache */
|
||||
$this->multiModerationRebuildCache();
|
||||
|
||||
/* Log and bounce */
|
||||
$this->registry->adminFunctions->saveAdminLog( $this->lang->words['mm_removed'] );
|
||||
$this->registry->output->silentRedirect($this->settings['base_url'] . $this->html->form_code );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the add/edit multi moderation form
|
||||
*
|
||||
* @access public
|
||||
* @param string $type Either 'new' or 'edit'
|
||||
* @return void
|
||||
**/
|
||||
public function multiModerationSaveForm( $type='new' )
|
||||
{
|
||||
/* INI */
|
||||
$forums = array();
|
||||
|
||||
/* Make sure we have a title */
|
||||
if( ! $this->request['mm_title'] )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['mm_valtitle'], 11333 );
|
||||
}
|
||||
|
||||
/* Check for forums */
|
||||
$forums = $this->_getSelectedForums();
|
||||
|
||||
/* Check forums */
|
||||
if( ! $forums )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['mm_forums'], 11334 );
|
||||
}
|
||||
|
||||
/* Check move location */
|
||||
if( $this->request['topic_move'] == 'n' )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['mm_wrong'], 11335 );
|
||||
}
|
||||
|
||||
/* Build the insert array */
|
||||
$save = array(
|
||||
'mm_title' => $this->request['mm_title'],
|
||||
'mm_enabled' => 1,
|
||||
'topic_state' => $this->request['topic_state'],
|
||||
'topic_pin' => $this->request['topic_pin'],
|
||||
'topic_move' => intval( $this->request['topic_move'] ),
|
||||
'topic_move_link' => intval( $this->request['topic_move_link'] ),
|
||||
'topic_title_st' => IPSText::makeSlashesSafe( $_POST['topic_title_st'] ),
|
||||
'topic_title_end' => IPSText::makeSlashesSafe( $_POST['topic_title_end'] ),
|
||||
'topic_reply' => intval( $this->request['topic_reply'] ),
|
||||
'topic_reply_content' => IPSText::makeSlashesSafe( $_POST['topic_reply_content'] ),
|
||||
'topic_reply_postcount' => intval( $this->request['topic_reply_postcount'] ),
|
||||
'mm_forums' => $forums,
|
||||
'topic_approve' => intval( $this->request['topic_approve'] ),
|
||||
);
|
||||
|
||||
/* Edit */
|
||||
if ( $type == 'edit' )
|
||||
{
|
||||
/* ID */
|
||||
$id = intval( $this->request['id'] );
|
||||
|
||||
if( ! $id )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['mm_valid'] );
|
||||
}
|
||||
|
||||
/* Update the multi mod */
|
||||
$this->DB->update( 'topic_mmod', $save, 'mm_id='.$id );
|
||||
}
|
||||
/* New */
|
||||
else
|
||||
{
|
||||
/* Insert the new multi mod */
|
||||
$this->DB->insert( 'topic_mmod', $save );
|
||||
}
|
||||
|
||||
/* Log, Cache, and Bounce */
|
||||
$this->registry->adminFunctions->saveAdminLog( sprintf( $this->lang->words['mm_update'], $type ) );
|
||||
$this->multiModerationRebuildCache();
|
||||
$this->registry->output->silentRedirect( $this->settings['base_url'] . $this->html->form_code );
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the add/edit multi moderation form
|
||||
*
|
||||
* @access public
|
||||
* @param string $type Either 'new' or 'edit'
|
||||
* @return void
|
||||
**/
|
||||
public function multiModerationForm( $type='new' )
|
||||
{
|
||||
if( $type == 'new' )
|
||||
{
|
||||
/* Setup */
|
||||
$form_code = 'donew';
|
||||
$id = 0;
|
||||
$description = $this->lang->words['mm_addnew'];
|
||||
$button = $this->lang->words['mm_addnew'];
|
||||
|
||||
/* Default Values */
|
||||
$topic_mm = array(
|
||||
'mm_forums' => '',
|
||||
'mm_title' => '',
|
||||
'topic_title_st' => '',
|
||||
'topic_title_end' => '',
|
||||
'topic_state' => '',
|
||||
'topic_pin' => '',
|
||||
'topic_approve' => '',
|
||||
'topic_move' => '',
|
||||
'topic_move_link' => '',
|
||||
'topic_reply' => '',
|
||||
'topic_reply_content' => '',
|
||||
'topic_reply_postcount' => ''
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Setup */
|
||||
$id = intval( $this->request['id'] );
|
||||
$form_code = 'doedit';
|
||||
$description = $this->lang->words['mm_edit'];
|
||||
$button = $this->lang->words['mm_edit'];
|
||||
|
||||
/* Default Values */
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'topic_mmod', 'where' => "mm_id=$id" ) );
|
||||
$this->DB->execute();
|
||||
|
||||
if ( ! $topic_mm = $this->DB->fetch() )
|
||||
{
|
||||
$this->registry->output->showError( sprintf( $this->lang->words['mm_noinfo'], $id ), 11337 );
|
||||
}
|
||||
}
|
||||
|
||||
/* State Drop Options */
|
||||
$state_dd = array(
|
||||
0 => array( 'leave', $this->lang->words['mm_leave'] ),
|
||||
1 => array( 'close', $this->lang->words['mm_close'] ),
|
||||
2 => array( 'open' , $this->lang->words['mm_open'] ),
|
||||
);
|
||||
|
||||
/* Pinned Drop Down Options */
|
||||
$pin_dd = array(
|
||||
0 => array( 'leave', $this->lang->words['mm_leave'] ),
|
||||
1 => array( 'pin' , $this->lang->words['mm_pin'] ),
|
||||
2 => array( 'unpin', $this->lang->words['mm_unpin'] ),
|
||||
);
|
||||
|
||||
/* Approved Drop Down Options */
|
||||
$app_dd = array(
|
||||
0 => array( '0', $this->lang->words['mm_leave'] ),
|
||||
1 => array( '1', $this->lang->words['mm_approve'] ),
|
||||
2 => array( '2', $this->lang->words['mm_unapprove'] ),
|
||||
);
|
||||
|
||||
/* Build forum multiselect */
|
||||
$topic_mm['forums'] = "<select name='forums[]' class='textinput' size='15' multiple='multiple'>\n";
|
||||
|
||||
$topic_mm['forums'] .= $topic_mm['mm_forums'] == '*' ? "<option value='all' selected='selected'>{$this->lang->words['mm_allforums']}</option>\n" : "<option value='all'>{$this->lang->words['mm_allforums']}</option>\n";
|
||||
|
||||
$forum_jump = $this->forumfunc->adForumsForumData();
|
||||
|
||||
foreach( $forum_jump as $i )
|
||||
{
|
||||
if( strstr( "," . $topic_mm['mm_forums'] . ",", "," . $i['id'] . "," ) and $topic_mm['mm_forums'] != '*' )
|
||||
{
|
||||
$selected = ' selected="selected"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$selected = "";
|
||||
}
|
||||
|
||||
if( isset( $i['redirect_on'] ) AND $i['redirect_on'] == 1 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$fporum_jump[] = array( $i['id'], $i['depthed_name'] );
|
||||
|
||||
$topic_mm['forums'] .= "<option value=\"{$i['id']}\" $selected>{$i['depthed_name']}</option>\n";
|
||||
}
|
||||
|
||||
$topic_mm['forums'] .= "</select>";
|
||||
|
||||
/* Build Form Fields */
|
||||
$topic_mm['mm_title'] = $this->registry->output->formInput("mm_title", $topic_mm['mm_title'] );
|
||||
$topic_mm['topic_title_st'] = $this->registry->output->formInput("topic_title_st", $topic_mm['topic_title_st'] );
|
||||
$topic_mm['topic_title_end'] = $this->registry->output->formInput("topic_title_end", $topic_mm['topic_title_end'] );
|
||||
$topic_mm['topic_state'] = $this->registry->output->formDropdown("topic_state", $state_dd, $topic_mm['topic_state'] );
|
||||
$topic_mm['topic_pin'] = $this->registry->output->formDropdown("topic_pin", $pin_dd, $topic_mm['topic_pin'] );
|
||||
$topic_mm['topic_approve'] = $this->registry->output->formDropdown("topic_approve", $app_dd, $topic_mm['topic_approve'] );
|
||||
$topic_mm['topic_move'] = $this->registry->output->formDropdown("topic_move", array_merge( array( 0 => array('-1', $this->lang->words['mm_nobodymovenobodygethurt'] ) ), $fporum_jump ), $topic_mm['topic_move'] );
|
||||
$topic_mm['topic_move_link'] = $this->registry->output->formCheckbox('topic_move_link', $topic_mm['topic_move_link'] );
|
||||
$topic_mm['topic_reply'] = $this->registry->output->formYesNo('topic_reply', $topic_mm['topic_reply'] );
|
||||
$topic_mm['topic_reply_content'] = $this->registry->output->formTextarea("topic_reply_content", $topic_mm['topic_reply_content'] );
|
||||
$topic_mm['topic_reply_postcount'] = $this->registry->output->formCheckbox('topic_reply_postcount', $topic_mm['topic_reply_postcount'] );
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html .= $this->html->multiModerationForm( $id, $form_code, $description, $topic_mm, $button );
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all available multi mods
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function multiModerationOverview()
|
||||
{
|
||||
/* Query the multi mods */
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'topic_mmod', 'order' => "mm_title" ) );
|
||||
$this->DB->execute();
|
||||
|
||||
/* Loop through and build output arrays */
|
||||
$rows = array();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
$rows[] = $r;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html .= $this->html->multiModerationOverview( $rows );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuilds the multi moderation cache
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function multiModerationRebuildCache()
|
||||
{
|
||||
/* INI */
|
||||
$cache = array();
|
||||
|
||||
/* Get the multi mods */
|
||||
$this->DB->build( array(
|
||||
'select' => '*',
|
||||
'from' => 'topic_mmod',
|
||||
'order' => 'mm_title'
|
||||
) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
while ($i = $this->DB->fetch())
|
||||
{
|
||||
$cache[ $i['mm_id'] ] = $i;
|
||||
}
|
||||
|
||||
/* Save the cache */
|
||||
$this->cache->setCache( 'multimod', $cache, array( 'array' => 1, 'donow' => 0 ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get selected forums
|
||||
*
|
||||
* @access private
|
||||
* @return string Comma separated list of forum ids
|
||||
**/
|
||||
private function _getSelectedForums()
|
||||
{
|
||||
/* INI */
|
||||
$forumids = array();
|
||||
|
||||
/* Check for the forums array */
|
||||
if( is_array( $_POST['forums'] ) )
|
||||
{
|
||||
/* Add All Forums */
|
||||
if( in_array( 'all', $_POST['forums'] ) )
|
||||
{
|
||||
return '*';
|
||||
}
|
||||
/* Add selected Forums */
|
||||
else
|
||||
{
|
||||
/* Loop through the selected forums */
|
||||
foreach( $_POST['forums'] as $l )
|
||||
{
|
||||
if( $this->registry->class_forums->forum_by_id[ $l ] )
|
||||
{
|
||||
$forumids[] = intval( $l );
|
||||
}
|
||||
}
|
||||
|
||||
/* Do we have cats? Give 'em to Charles! */
|
||||
if( count( $forumids ) )
|
||||
{
|
||||
foreach( $forumids as $f )
|
||||
{
|
||||
$children = $this->registry->class_forums->forumsGetChildren( $f );
|
||||
|
||||
if( is_array( $children ) and count( $children ) )
|
||||
{
|
||||
$forumids = array_merge( $forumids, $children );
|
||||
}
|
||||
}
|
||||
}
|
||||
/* No forums */
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Not an array */
|
||||
else
|
||||
{
|
||||
/* All Forums */
|
||||
if ( $this->request['forums'] == 'all' )
|
||||
{
|
||||
return '*';
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Anything selected? */
|
||||
if( $this->request['forums'] != "" )
|
||||
{
|
||||
$l = intval( $this->request['forums'] );
|
||||
|
||||
/* Single Forum */
|
||||
if( $this->registry->class_forums->forum_by_id[ $l ] )
|
||||
{
|
||||
$forumids[] = intval( $l );
|
||||
}
|
||||
|
||||
/* Check subs */
|
||||
if ( $this->request['searchsubs'] == 1 )
|
||||
{
|
||||
$children = $this->registry->class_forums->forumsGetChildren( $f );
|
||||
|
||||
if( is_array ($children ) and count( $children ) )
|
||||
{
|
||||
$forumids = array_merge( $forumids, $children );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return implode( ",", $forumids );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,682 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Forum Permission Masks
|
||||
* Last Updated: $LastChangedDate: 2009-02-23 16:27:28 -0500 (Mon, 23 Feb 2009) $
|
||||
*
|
||||
* @author $Author: josh $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 17th March 2002
|
||||
* @version $Rev: 4081 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_forums_forums_permissions extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Forum functions object
|
||||
*
|
||||
* @access private
|
||||
* @var object
|
||||
*/
|
||||
private $forumfunc;
|
||||
|
||||
/**
|
||||
* Main execution point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
/* Setup Forum Classes */
|
||||
$this->registry->class_forums->forumsInit();
|
||||
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . '/sources/classes/forums/admin_forum_functions.php' );
|
||||
|
||||
$this->forumfunc = new admin_forum_functions( $registry );
|
||||
$this->forumfunc->forumsInit();
|
||||
|
||||
/* Load Skin and Lang */
|
||||
$this->html = $this->registry->output->loadTemplate( 'cp_skin_permissions' );
|
||||
$this->html->form_code = 'module=forums&section=permissions&';
|
||||
$this->html->form_code_js = 'module=forums&section=permissions&';
|
||||
|
||||
$this->lang->loadLanguageFile( array( 'admin_forums' ) );
|
||||
|
||||
/* Determine what todo */
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'fedit':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'permmasks_edit' );
|
||||
$this->forumPermissions();
|
||||
break;
|
||||
|
||||
case 'pdelete':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'permmasks_delete' );
|
||||
$this->deleteMask();
|
||||
break;
|
||||
|
||||
case 'dofedit':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'permmasks_edit' );
|
||||
$this->saveForumPermissions();
|
||||
break;
|
||||
|
||||
case 'permsplash':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'permmasks_view' );
|
||||
$this->permsplash();
|
||||
break;
|
||||
|
||||
case 'preview_forums':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'permmasks_view' );
|
||||
$this->previewForumPermissions();
|
||||
break;
|
||||
|
||||
case 'dopermadd':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'permmasks_add' );
|
||||
$this->addNewPerm();
|
||||
break;
|
||||
|
||||
case 'donameedit':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'permmasks_edit' );
|
||||
$this->editPermName();
|
||||
break;
|
||||
|
||||
case 'splash':
|
||||
default:
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'permmasks_view' );
|
||||
$this->permissionsSplash();
|
||||
break;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the forum permission preview popup
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function previewForumPermissions()
|
||||
{
|
||||
/* Check ID */
|
||||
$perm_id = intval( $this->request['id'] );
|
||||
if( ! $perm_id )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['per_setid'], 11342 );
|
||||
}
|
||||
|
||||
/* Query the set name */
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'forum_perms', 'where' => "perm_id=" . $perm_id ) );
|
||||
$this->DB->execute();
|
||||
|
||||
if ( ! $perms = $this->DB->fetch() )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['per_setid'], 11343 );
|
||||
}
|
||||
|
||||
/* Type of permission to preview */
|
||||
switch( $this->request['t'] )
|
||||
{
|
||||
case 'start':
|
||||
$human_type = $this->lang->words['per_start'];
|
||||
$code_word = 'perm_4';
|
||||
break;
|
||||
|
||||
case 'reply':
|
||||
$human_type = $this->lang->words['per_reply'];
|
||||
$code_word = 'perm_3';
|
||||
break;
|
||||
|
||||
case 'show':
|
||||
$human_type = $this->lang->words['per_show'];
|
||||
$code_word = 'perm_view';
|
||||
break;
|
||||
|
||||
case 'upload':
|
||||
$human_type = $this->lang->words['per_upload'];
|
||||
$code_word = 'perm_5';
|
||||
break;
|
||||
|
||||
case 'download':
|
||||
$human_type = $this->lang->words['per_download'];
|
||||
$code_word = 'perm_6';
|
||||
break;
|
||||
|
||||
default:
|
||||
$human_type = $this->lang->words['per_read'];
|
||||
$code_word = 'perm_2';
|
||||
break;
|
||||
}
|
||||
|
||||
/* Get forums */
|
||||
$theforums = $this->forumfunc->adForumsForumList(1);
|
||||
|
||||
/* Loop through forums */
|
||||
$rows = array();
|
||||
|
||||
foreach( $theforums as $v )
|
||||
{
|
||||
$id = $v[0];
|
||||
$name = $v[1];
|
||||
|
||||
$this->registry->class_forums->forum_by_id[$id][ $code_word ] = isset( $this->registry->class_forums->forum_by_id[$id][ $code_word ] ) ? $this->registry->class_forums->forum_by_id[$id][ $code_word ] : '';
|
||||
|
||||
if( $this->registry->class_forums->forum_by_id[$id][ $code_word ] == '*' )
|
||||
{
|
||||
$rows[] = array( 'css' => 'color:green', 'name' => $name );
|
||||
}
|
||||
else if (preg_match( "/(^|,)".$perm_id."(,|$)/", $this->registry->class_forums->forum_by_id[$id][ $code_word ]) )
|
||||
{
|
||||
$rows[] = array( 'css' => 'color:green;font-weight:bold', 'name' => $name );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( $code_word != 'perm_view' AND $this->registry->class_forums->forum_by_id[$id]['parent_id'] == 'root' )
|
||||
{
|
||||
/* Categories */
|
||||
$rows[] = array( 'css' => 'color:grey', 'name' => $name );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No Access */
|
||||
$rows[] = array( 'css' => 'color:red;font-weight:bold', 'name' => $name );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$type_drop = $this->registry->output->formDropdown( 't', array(
|
||||
array( 'start' , $this->lang->words['per_start_m'] ),
|
||||
array( 'reply' , $this->lang->words['per_reply_m'] ),
|
||||
array( 'read' , $this->lang->words['per_read_m'] ),
|
||||
array( 'show' , $this->lang->words['per_show_m'] ),
|
||||
array( 'upload' , $this->lang->words['per_upload_m'] ),
|
||||
array( 'download', $this->lang->words['per_download_m'] ),
|
||||
), $this->request['t'] );
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html .= $this->html->previewForumPermissions( $id, $perms['perm_name'], $type_drop, $rows, $human_type );
|
||||
$this->registry->output->printPopupWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save Forum Permission Matrix
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function saveForumPermissions()
|
||||
{
|
||||
/* Check ID */
|
||||
$gid = intval( $this->request['id'] );
|
||||
|
||||
if( ! $gid )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['per_groupid'], 11344 );
|
||||
}
|
||||
|
||||
/* Check the mask */
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'forum_perms', 'where' => "perm_id=" . $gid ) );
|
||||
$this->DB->execute();
|
||||
|
||||
if ( ! $gr = $this->DB->fetch() )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['per_groupid'], 11345 );
|
||||
}
|
||||
|
||||
/* Permission Fields */
|
||||
$permission_fields = array( 'view' => 'perm_view', 'read' => 'perm_2', 'reply' => 'perm_3', 'start' => 'perm_4', 'upload' => 'perm_5', 'download' => 'perm_6' );
|
||||
|
||||
/* Query all the forum permissions */
|
||||
$forum_data = $this->forumfunc->adForumsForumData();
|
||||
|
||||
//echo '<pre>'; print_r( $this->request );exit();
|
||||
foreach( $forum_data as $r )
|
||||
{
|
||||
/* Initialize the array */
|
||||
$new_permissions = array();
|
||||
|
||||
/* Loop through each permission type */
|
||||
foreach( $permission_fields as $k => $v )
|
||||
{
|
||||
/* Don't change global permissions */
|
||||
if( $r[$v] != '*' )
|
||||
{
|
||||
if( isset( $this->request[$k] ) && is_array( $this->request[$k] ) )
|
||||
{
|
||||
/* Check for forum */
|
||||
$forum_checked = isset($this->request[$k][ $r['id'] ]);
|
||||
|
||||
/* Check to see if the forum is currently added to this mask */
|
||||
$_perm_array = explode( ',', IPSText::cleanPermString( $r[$v] ) );
|
||||
|
||||
if( in_array( $gid, $_perm_array ) )
|
||||
{
|
||||
/* The forum was unchecked, so we need to remove it */
|
||||
if( ! $forum_checked )
|
||||
{
|
||||
unset( $_perm_array[ array_search( $gid, $_perm_array ) ] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The forum was checked, so we need to add it */
|
||||
if( $forum_checked )
|
||||
{
|
||||
$_perm_array[] = $gid;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the new string */
|
||||
$new_permissions[$v] = ',' . implode( ',', $_perm_array ) . ',';
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_permissions[$v] = '';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_permissions[$v] = '*';
|
||||
}
|
||||
}
|
||||
|
||||
/* Root Forum */
|
||||
if( $r['root_forum'] )
|
||||
{
|
||||
$new_permissions['perm_2'] = $new_permissions['perm_3'] = $new_permissions['perm_4'] = $new_permissions['perm_5'] = $new_permissions['perm_6'] = '';
|
||||
}
|
||||
|
||||
/* Update the database */
|
||||
$this->DB->update( 'permission_index', $new_permissions, "perm_type='forum' AND app='forums' AND perm_type_id={$r['id']}" );
|
||||
}
|
||||
|
||||
/* All Done */
|
||||
$this->registry->adminFunctions->saveAdminLog( sprintf( $this->lang->words['per_editedlog'], $gr['perm_name'] ) );
|
||||
$this->registry->output->global_message = $this->lang->words['per_updated'];
|
||||
$this->permissionsSplash();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a permission set
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function deleteMask()
|
||||
{
|
||||
/* Check ID */
|
||||
$old_id = intval( $this->request['id'] );
|
||||
|
||||
if( ! $old_id )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['per_setid'], 11346 );
|
||||
}
|
||||
|
||||
/* Permission Fields */
|
||||
$permission_fields = array( 'perm_view', 'perm_2', 'perm_3', 'perm_4', 'perm_5', 'perm_6', 'perm_7' );
|
||||
|
||||
/* Query all the forum permissions */
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'permission_index', 'where' => "perm_type='forum' AND app='forums'" ) );
|
||||
$outer = $this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch( $outer ) )
|
||||
{
|
||||
/* Perms */
|
||||
foreach( $permission_fields as $perm )
|
||||
{
|
||||
if( isset( $r[$perm] ) && $r[$perm] != '*' && $r[$perm] )
|
||||
{
|
||||
/* Arrayize */
|
||||
$_perm_array = explode( ',', IPSText::cleanPermString( $r[$perm] ) );
|
||||
|
||||
/* Check for the mask */
|
||||
if( in_array( $old_id, $_perm_array ) )
|
||||
{
|
||||
unset( $_perm_array[ array_search( $old_id, $_perm_array ) ] );
|
||||
}
|
||||
|
||||
/* Back to string */
|
||||
$r[$perm] = ',' . implode( ',', $_perm_array ) . ',';
|
||||
}
|
||||
}
|
||||
|
||||
/* Update */
|
||||
$this->DB->update( 'permission_index', $r, "perm_id={$r['perm_id']}" );
|
||||
}
|
||||
|
||||
/* Delete the mask */
|
||||
$this->DB->delete( 'forum_perms', "perm_id={$old_id}" );
|
||||
|
||||
/* Done */
|
||||
$this->registry->output->global_message = $this->lang->words['per_removed'];
|
||||
$this->permissionsSplash();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new permission set
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function addNewPerm()
|
||||
{
|
||||
/* Check Perm Name */
|
||||
$this->request['new_perm_name'] = trim( $this->request['new_perm_name'] );
|
||||
|
||||
if( $this->request['new_perm_name'] == "" )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['per_entername'], 11347 );
|
||||
}
|
||||
|
||||
/* Perm set to copy */
|
||||
$copy_id = intval( $this->request['new_perm_copy'] );
|
||||
|
||||
/* Insert new permission set */
|
||||
$this->DB->insert( 'forum_perms', array( 'perm_name' => $this->request['new_perm_name'] ) );
|
||||
$new_id = $this->DB->getInsertId();
|
||||
|
||||
/* Copy permission */
|
||||
if( $new_id && $copy_id )
|
||||
{
|
||||
/* Permission Fields */
|
||||
$permission_fields = array( 'perm_view', 'perm_2', 'perm_3', 'perm_4', 'perm_5', 'perm_6', 'perm_7' );
|
||||
|
||||
/* Query all the forum permissions */
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'permission_index', 'where' => "perm_type='forum' AND app='forums'" ) );
|
||||
$outer = $this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch( $outer ) )
|
||||
{
|
||||
/* Perms */
|
||||
foreach( $permission_fields as $perm )
|
||||
{
|
||||
if( isset( $r[$perm] ) )
|
||||
{
|
||||
if( in_array( $copy_id, explode( ',', IPSText::cleanPermString( $r[$perm] ) ) ) )
|
||||
{
|
||||
$r[$perm] .= "{$new_id},";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Update */
|
||||
$this->DB->update( 'permission_index', $r, "perm_id={$r['perm_id']}" );
|
||||
}
|
||||
}
|
||||
|
||||
/* Done */
|
||||
$this->registry->output->global_message = sprintf( $this->lang->words['per_added'], $this->request['new_perm_name'] );
|
||||
$this->permissionsSplash();
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the name of a permission set
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function editPermName()
|
||||
{
|
||||
/* ID */
|
||||
$gid = intval( $this->request['id'] );
|
||||
|
||||
/* Check ID */
|
||||
if( ! $gid )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['per_groupid'], 11348 );
|
||||
}
|
||||
|
||||
/* Check Name */
|
||||
if( $this->request['perm_name'] == "" )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['per_entername'], 11349 );
|
||||
}
|
||||
|
||||
/* Query group */
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'forum_perms', 'where' => "perm_id={$gid}" ) );
|
||||
$this->DB->execute();
|
||||
|
||||
if ( ! $gr = $this->DB->fetch() )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['per_groupid'], 11350 );
|
||||
}
|
||||
|
||||
/* Update the database */
|
||||
$this->DB->update( 'forum_perms', array( 'perm_name' => $this->request['perm_name'] ), 'perm_id=' . $gid );
|
||||
|
||||
/* Done */
|
||||
$this->registry->adminFunctions->saveAdminLog( sprintf( $this->lang->words['per_editedlog'], $gr['perm_name'] ) );
|
||||
$this->registry->output->global_message = $this->lang->words['per_updated'];
|
||||
$this->forumPermissions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Forum Permission Matrix
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function forumPermissions()
|
||||
{
|
||||
/* Check for ID */
|
||||
if( $this->request['id'] == "")
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['per_groupid'], 11351 );
|
||||
}
|
||||
|
||||
/* Permission Class */
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/class_public_permissions.php' );
|
||||
$permissions = new classPublicPermissions( ipsRegistry::instance() );
|
||||
|
||||
/* Page Setup */
|
||||
$this->registry->output->nav[] = array( $this->form_code.'&do=permsplash', $this->lang->words['per_manage'] );
|
||||
$this->registry->output->nav[] = array( '', $this->lang->words['per_addedit'] );
|
||||
|
||||
/* Query Mask */
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'forum_perms', 'where' => "perm_id=" . intval( $this->request['id'] ) ) );
|
||||
$this->DB->execute();
|
||||
$group = $this->DB->fetch();
|
||||
|
||||
/* Data */
|
||||
$gid = $group['perm_id'];
|
||||
$gname = $group['perm_name'];
|
||||
$forum_data = $this->forumfunc->adForumsForumData();
|
||||
|
||||
/* Permission Fields */
|
||||
$permission_fields = array( 'view' => 'perm_view', 'read' => 'perm_2', 'reply' => 'perm_3', 'start' => 'perm_4', 'upload' => 'perm_5', 'download' => 'perm_6' );
|
||||
|
||||
/* Loop through masks and build output array */
|
||||
$permission_rows = array();
|
||||
|
||||
foreach( $forum_data as $r )
|
||||
{
|
||||
/* INI Perms */
|
||||
$_perms = array();
|
||||
|
||||
foreach( $permission_fields as $perm => $key )
|
||||
{
|
||||
if( $r[$key] == '*' )
|
||||
{
|
||||
$_perms[$perm] = $this->lang->words['per_global'];
|
||||
}
|
||||
else if ( preg_match( "/(^|,)".$gid."(,|$)/", $r[$key] ) )
|
||||
{
|
||||
$_perms[$perm] = 'checked';
|
||||
}
|
||||
else
|
||||
{
|
||||
$_perms[$perm] = '';
|
||||
}
|
||||
}
|
||||
|
||||
/* Root Forum */
|
||||
if( $r['root_forum'] )
|
||||
{
|
||||
$r['css'] = 'tablerow4';
|
||||
$_perms['download'] = $_perms['upload'] = $_perms['reply'] = $_perms['start'] = $_perms['read'] = $this->lang->words['per_notused'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$r['css'] = 'tablerow1';
|
||||
}
|
||||
|
||||
/* Perms */
|
||||
$r['_perms'] = $_perms;
|
||||
|
||||
/* Add to array */
|
||||
$permission_rows[] = $r;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html .= $this->html->permissionsForum( $gid, $gname, $permission_rows, $this->registry->class_forums->forumById( $this->request['id'] ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the permission splash screen
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function permissionsSplash()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$perms = array();
|
||||
$mems = array();
|
||||
$groups = array();
|
||||
$dlist = "";
|
||||
$content = "";
|
||||
|
||||
//-----------------------------------------
|
||||
// Page title & desc
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->nav[] = array( $this->form_code.'&do=permsplash', $this->lang->words['per_manage'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the names for the perm masks w/id
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'forum_perms', 'order' => 'perm_name ASC' ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
$perms[ $r['perm_id'] ] = $r['perm_name'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the number of members using this mask
|
||||
// as an over ride
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array( 'select' => 'COUNT(member_id) as count, org_perm_id',
|
||||
'from' => 'members',
|
||||
'where' => "(org_perm_id " . $this->DB->buildIsNull( false ) . " AND org_perm_id != '')",
|
||||
'group' => 'org_perm_id',
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
if ( strstr( $r['org_perm_id'] , "," ) )
|
||||
{
|
||||
foreach( explode( ",", $r['org_perm_id'] ) as $pid )
|
||||
{
|
||||
$mems[ $pid ] = ! isset( $mems[ $pid ] ) ? 0 : $mems[ $pid ];
|
||||
$mems[ $pid ] += $r['count'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mems[ $r['org_perm_id'] ] += $r['count'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the member group names and the mask
|
||||
// they use
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array( 'select' => 'g_id, g_title, g_perm_id', 'from' => 'groups' ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
if ( strstr( $r['g_perm_id'] , "," ) )
|
||||
{
|
||||
foreach( explode( ",", $r['g_perm_id'] ) as $pid )
|
||||
{
|
||||
$groups[ $pid ][] = $r['g_title'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$groups[ $r['g_perm_id'] ][] = $r['g_title'];
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Print the splash screen
|
||||
//-----------------------------------------
|
||||
|
||||
$display_groups = array();
|
||||
foreach( $perms as $id => $name )
|
||||
{
|
||||
$groups_used = "";
|
||||
$mems_used = 0;
|
||||
$is_active = 0;
|
||||
$dlist .= "<option value='$id'>$name</option>\n";
|
||||
|
||||
if ( isset( $groups[ $id ] ) AND is_array( $groups[ $id ] ) )
|
||||
{
|
||||
foreach( $groups[ $id ] as $g_title )
|
||||
{
|
||||
$groups_used .= '· ' . $g_title . "<br />";
|
||||
}
|
||||
|
||||
$is_active = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$groups_used = "{$this->lang->words['per_none']}";
|
||||
}
|
||||
|
||||
if ( isset($mems[ $id ]) AND $mems[ $id ] > 0 )
|
||||
{
|
||||
$is_active = 1;
|
||||
}
|
||||
|
||||
$r['id'] = $id;
|
||||
$r['name'] = $name;
|
||||
$r['isactive'] = $is_active;
|
||||
$r['groups'] = $groups_used;
|
||||
$r['mems'] = isset( $mems[ $id ] ) ? intval( $mems[ $id ] ) : 0;
|
||||
|
||||
$display_groups[] = $r;
|
||||
}
|
||||
|
||||
$this->registry->output->html .= $this->html->permissionsSplash( $display_groups, $dlist );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<menu>
|
||||
<tabitems>
|
||||
<item>
|
||||
<title>Управление форумами</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Управление форумами</subitemtitle>
|
||||
<subsection>forums</subsection>
|
||||
<subitemurl>do=forums_overview</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
<item>
|
||||
<title>Мульти-модерация</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Мульти-модерация тем</subitemtitle>
|
||||
<subsection>multimods</subsection>
|
||||
<subitemurl>do=overview</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
</tabitems>
|
||||
</menu>
|
||||
@@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<permissions>
|
||||
<group>
|
||||
<grouptitle>Управление форумами</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>forums_add</key>
|
||||
<string>Может добавлять форумы?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>forums_edit</key>
|
||||
<string>Может изменять форумы?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>forums_delete</key>
|
||||
<string>Может удалять форумы?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>forums_reorder</key>
|
||||
<string>Может изменять порядок вывода форумов?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>forums_permissions</key>
|
||||
<string>Может редактировать права доступа к форумам?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>forums_empty</key>
|
||||
<string>Может очищать форумы?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>forums_rules</key>
|
||||
<string>Может редактировать правила форумов?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>forums_skins</key>
|
||||
<string>Может изменять стиль конкретного форума?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
<group>
|
||||
<grouptitle>Управление модераторами</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>mods_add</key>
|
||||
<string>Может добавлять модераторов?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>mods_edit</key>
|
||||
<string>Может редактировать модераторов?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>mods_delete</key>
|
||||
<string>Может удалять модераторов?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>mods_view</key>
|
||||
<string>Может просматривать модераторов?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
<group>
|
||||
<grouptitle>Управление мульти-модерацией</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>mmod_add</key>
|
||||
<string>Может добавлять новые мульти-модерации?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>mmod_edit</key>
|
||||
<string>Может изменять существующие мульти-модерации?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>mmod_delete</key>
|
||||
<string>Может удалять мульти-модерации?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>mmod_view</key>
|
||||
<string>Может просматривать мульти-модерации?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
<group>
|
||||
<grouptitle>Управление масками доступа</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>permmasks_add</key>
|
||||
<string>Может добавлять новые маски?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>permmasks_edit</key>
|
||||
<string>Может изменять существующие маски?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>permmasks_delete</key>
|
||||
<string>Может удалять маски?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>permmasks_view</key>
|
||||
<string>Может просматривать маски?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
</permissions>
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Default section for RSS module
|
||||
* Last Updated: $LastChangedDate: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 14th May 2003
|
||||
* @version $Rev: 4948 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Very simply returns the default section if one is not
|
||||
* passed in the URL
|
||||
*/
|
||||
|
||||
$DEFAULT_SECTION = 'import';
|
||||
@@ -0,0 +1,538 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Forum RSS Export
|
||||
* Last Updated: $Date: 2009-11-09 21:06:29 -0500 (Mon, 09 Nov 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 5342 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_forums_rss_export extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Skin object
|
||||
*
|
||||
* @access private
|
||||
* @var object Skin templates
|
||||
*/
|
||||
private $html;
|
||||
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
/* Load HTML and Lang */
|
||||
$this->html = $this->registry->output->loadTemplate( 'cp_skin_rss' );
|
||||
$this->registry->class_localization->loadLanguageFile( array( 'admin_rss' ) );
|
||||
|
||||
/* URLs */
|
||||
$this->form_code = $this->html->form_code = 'module=rss&section=export';
|
||||
$this->form_code_js = $this->html->form_code_js = 'module=rss§ion=export';
|
||||
|
||||
/* What to do */
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'rssexport_add':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'export_manage' );
|
||||
$this->rssExportForm( 'add' );
|
||||
break;
|
||||
|
||||
case 'rssexport_edit':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'export_manage' );
|
||||
$this->rssExportForm( 'edit' );
|
||||
break;
|
||||
|
||||
case 'rssexport_add_save':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'export_manage' );
|
||||
$this->rssExportSave( 'add' );
|
||||
break;
|
||||
|
||||
case 'rssexport_edit_save':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'export_manage' );
|
||||
$this->rssExportSave( 'edit' );
|
||||
break;
|
||||
|
||||
case 'rssexport_recache':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'export_manage' );
|
||||
$this->rssExportRebuildCache();
|
||||
break;
|
||||
|
||||
case 'rssexport_delete':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'export_delete' );
|
||||
$this->rssExportDelete();
|
||||
break;
|
||||
|
||||
case 'rss_export_overview':
|
||||
default:
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'export_manage' );
|
||||
$this->rssExportOverview();
|
||||
break;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an RSS Export Streawm
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function rssExportDelete()
|
||||
{
|
||||
/* INIT */
|
||||
$rss_export_id = intval($this->request['rss_export_id']);
|
||||
|
||||
/* Load Stream Data */
|
||||
$rssstream = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'rss_export', 'where' => "rss_export_id=$rss_export_id" ) );
|
||||
|
||||
if ( ! $rssstream['rss_export_id'] )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['ex_noload'];
|
||||
$this->rssExportOverview();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Delete the stream */
|
||||
$this->DB->delete( 'rss_export', 'rss_export_id=' . $rss_export_id );
|
||||
|
||||
/* Rebuild cache and bounce */
|
||||
$this->rssExportRebuildCache( $rss_export_id, 0 );
|
||||
$this->registry->output->global_message = $this->lang->words['ex_removed'];
|
||||
$this->rssExportOverview();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the add/edit RSS Export Stream form
|
||||
*
|
||||
* @access public
|
||||
* @param string $type Either add or edit
|
||||
* @return void
|
||||
**/
|
||||
public function rssExportSave( $type='add' )
|
||||
{
|
||||
/* INIT */
|
||||
$rss_export_id = intval( $this->request['rss_export_id'] );
|
||||
$rss_export_title = IPSText::UNhtmlspecialchars( trim( $this->request['rss_export_title'] ) );
|
||||
$rss_export_desc = IPSText::UNhtmlspecialchars( trim( $this->request['rss_export_desc'] ) );
|
||||
$rss_export_image = IPSText::UNhtmlspecialchars( trim( $this->request['rss_export_image'] ) );
|
||||
$rss_export_forums = is_array( $this->request['rss_export_forums'] ) ? implode( ",", $this->request['rss_export_forums'] ) : '';
|
||||
$rss_export_include_post = intval( $this->request['rss_export_include_post'] );
|
||||
$rss_export_count = intval( $this->request['rss_export_count'] );
|
||||
$rss_export_cache_time = intval( $this->request['rss_export_cache_time'] );
|
||||
$rss_export_enabled = intval( $this->request['rss_export_enabled'] );
|
||||
$rss_export_sort = trim( $this->request['rss_export_sort'] );
|
||||
$rss_export_order = trim( $this->request['rss_export_order'] );
|
||||
|
||||
/* Check for Errors */
|
||||
if ( $type == 'edit' )
|
||||
{
|
||||
if ( ! $rss_export_id )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['ex_noid'];
|
||||
$this->rssExportOverview();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $rss_export_title OR ! $rss_export_count OR ! $rss_export_forums )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['ex_completeform'];
|
||||
$this->rssExportForm( $type );
|
||||
return;
|
||||
}
|
||||
|
||||
/* Build Save Array */
|
||||
$array = array(
|
||||
'rss_export_enabled' => $rss_export_enabled,
|
||||
'rss_export_title' => $rss_export_title,
|
||||
'rss_export_desc' => $rss_export_desc,
|
||||
'rss_export_image' => $rss_export_image,
|
||||
'rss_export_forums' => $rss_export_forums,
|
||||
'rss_export_include_post' => $rss_export_include_post,
|
||||
'rss_export_count' => $rss_export_count,
|
||||
'rss_export_cache_time' => $rss_export_cache_time,
|
||||
'rss_export_order' => $rss_export_order,
|
||||
'rss_export_sort' => $rss_export_sort
|
||||
);
|
||||
|
||||
/* Insert new record */
|
||||
if ( $type == 'add' )
|
||||
{
|
||||
$this->DB->insert( 'rss_export', $array );
|
||||
$rss_export_id = 'all';
|
||||
$this->registry->output->global_message = $this->lang->words['ex_created'];
|
||||
}
|
||||
/* Update existing record */
|
||||
else
|
||||
{
|
||||
|
||||
$this->DB->update( 'rss_export', $array, 'rss_export_id='.$rss_export_id );
|
||||
$this->registry->output->global_message = $this->lang->words['ex_edited'];
|
||||
}
|
||||
|
||||
/* Rebuild chace and bounce */
|
||||
$this->rssExportRebuildCache( $rss_export_id, 0 );
|
||||
$this->rssExportOverview();
|
||||
}
|
||||
|
||||
/**
|
||||
* Form for adding/editing an RSS Export Stream
|
||||
*
|
||||
* @access public
|
||||
* @param string $type add/edit
|
||||
* @return void
|
||||
**/
|
||||
public function rssExportForm( $type='add' )
|
||||
{
|
||||
/* INIT */
|
||||
$rss_export_id = $this->request['rss_export_id'] ? intval( $this->request['rss_export_id'] ) : 0;
|
||||
$dd_sort = array( 0 => array( 'DESC', $this->lang->words['ex_opt_desc'] ), 1 => array( 'ASC', $this->lang->words['ex_opt_asc'] ) );
|
||||
$dd_order = array( 0 => array( 'start_date' , $this->lang->words['ex_opt_start'] ),
|
||||
1 => array( 'last_post' , $this->lang->words['ex_opt_last'] ),
|
||||
2 => array( 'views' , $this->lang->words['ex_opt_views'] ),
|
||||
3 => array( 'starter_id' , $this->lang->words['ex_opt_starter'] ),
|
||||
4 => array( 'topic_rating_total', $this->lang->words['ex_opt_rating'] ) );
|
||||
|
||||
/* Check (please?) */
|
||||
if ( $type == 'add' )
|
||||
{
|
||||
/* Form Bits */
|
||||
$formcode = 'rssexport_add_save';
|
||||
$title = $this->lang->words['ex_createnew'];
|
||||
$button = $this->lang->words['ex_createnew'];
|
||||
|
||||
/* Form Data */
|
||||
$rssstream = array( 'rss_export_id' => 0,
|
||||
'rss_export_title' => '',
|
||||
'rss_export_forums' => NULL,
|
||||
'rss_export_desc' => '',
|
||||
'rss_export_image' => '',
|
||||
'rss_export_include_post' => 1,
|
||||
'rss_export_enabled' => 1,
|
||||
'rss_export_count' => '',
|
||||
'rss_export_cache_time' => '',
|
||||
'rss_export_sort' => '',
|
||||
'rss_export_order' => '' );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Form Data */
|
||||
$rssstream = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'rss_export', 'where' => 'rss_export_id=' . $rss_export_id ) );
|
||||
|
||||
if ( ! $rssstream['rss_export_id'] )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['ex_noid'];
|
||||
$this->rssExportOverview();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Form bits */
|
||||
$formcode = 'rssexport_edit_save';
|
||||
$title = $this->lang->words['ex_edit'] .$rssstream['rss_export_title'];
|
||||
$button = $this->lang->words['ex_save'];
|
||||
}
|
||||
|
||||
/* Build forum multi select list */
|
||||
require_once( IPS_ROOT_PATH . 'applications/forums/sources/classes/forums/admin_forum_functions.php' );
|
||||
$aff = new admin_forum_functions( $this->registry );
|
||||
$aff->forumsInit();
|
||||
$dropdown = $aff->adForumsForumList(1);
|
||||
$rss_export_forums = ( isset( $this->request['rss_export_forums'] ) AND is_array( $this->request['rss_export_forums'] ) ) ? implode( ",", $this->request['rss_export_forums'] ) : $rssstream['rss_export_forums'];
|
||||
|
||||
/* Form Elements */
|
||||
$form = array();
|
||||
|
||||
$form['rss_export_title'] = $this->registry->output->formInput( 'rss_export_title' , IPSText::htmlspecialchars( ( isset($this->request['rss_export_title']) AND $this->request['rss_export_title'] ) ? $this->request['rss_export_title'] : $rssstream['rss_export_title'] ) );
|
||||
$form['rss_export_desc'] = $this->registry->output->formInput( 'rss_export_desc' , IPSText::htmlspecialchars( ( isset($this->request['rss_export_desc']) AND $this->request['rss_export_desc'] ) ? $this->request['rss_export_desc'] : $rssstream['rss_export_desc'] ) );
|
||||
$form['rss_export_image'] = $this->registry->output->formInput( 'rss_export_image' , IPSText::htmlspecialchars( ( isset($this->request['rss_export_image']) AND $this->request['rss_export_image'] ) ? $this->request['rss_export_image'] : $rssstream['rss_export_image'] ) );
|
||||
$form['rss_export_include_post'] = $this->registry->output->formYesNo( 'rss_export_include_post' , ( isset($this->request['rss_export_include_post']) AND $this->request['rss_export_include_post'] ) ? $this->request['rss_export_include_post'] : $rssstream['rss_export_include_post'] );
|
||||
$form['rss_export_enabled'] = $this->registry->output->formYesNo( 'rss_export_enabled' , ( isset($this->request['rss_export_enabled']) AND $this->request['rss_export_enabled'] ) ? $this->request['rss_export_enabled'] : $rssstream['rss_export_enabled'] );
|
||||
$form['rss_export_count'] = $this->registry->output->formSimpleInput( 'rss_export_count' , ( isset($this->request['rss_export_count']) AND $this->request['rss_export_count'] ) ? $this->request['rss_export_count'] : $rssstream['rss_export_count'], 5 );
|
||||
$form['rss_export_forums'] = $this->registry->output->formMultiDropdown( 'rss_export_forums[]', $dropdown, explode( ",", $rss_export_forums ), 7 );
|
||||
$form['rss_export_cache_time'] = $this->registry->output->formSimpleInput( 'rss_export_cache_time' , ( isset($this->request['rss_export_cache_time']) AND $this->request['rss_export_cache_time'] ) ? $this->request['rss_export_cache_time'] : $rssstream['rss_export_cache_time'], 5 );
|
||||
$form['rss_export_sort'] = $this->registry->output->formDropdown( 'rss_export_sort' , $dd_sort , ( isset($this->request['rss_export_sort']) AND $this->request['rss_export_sort'] ) ? $this->request['rss_export_sort'] : $rssstream['rss_export_sort'] );
|
||||
$form['rss_export_order'] = $this->registry->output->formDropdown( 'rss_export_order', $dd_order, ( isset($this->request['rss_export_order']) AND $this->request['rss_export_order'] ) ? $this->request['rss_export_order'] : $rssstream['rss_export_order'] );
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html .= $this->html->rssExportForm( $form, $title, $formcode, $button, $rssstream );
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists Current RSS Exports
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function rssExportOverview()
|
||||
{
|
||||
/* INIT */
|
||||
$content = "";
|
||||
$rows = array();
|
||||
$st = intval( $this->request['st'] ) > 0 ? intval( $this->request['st'] ) : 0;
|
||||
|
||||
/* Count number of feed exports */
|
||||
$num = $this->DB->buildAndFetch( array( 'select' => 'count(*) as row_count', 'from' => 'rss_export' ) );
|
||||
|
||||
/* Build Pagination */
|
||||
$page_links = $this->registry->output->generatePagination( array(
|
||||
'totalItems' => $num['row_count'],
|
||||
'itemsPerPage' => 25,
|
||||
'currentStartValue' => $st,
|
||||
'baseUrl' => $this->settings['base_url'].$this->form_code,
|
||||
) );
|
||||
|
||||
/* Query Feeds */
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'rss_export', 'order' => 'rss_export_id ASC', 'limit' => array( $st, 25 ) ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
/* (Alex) Cross */
|
||||
$r['_enabled_img'] = $r['rss_export_enabled'] ? 'aff_tick.png' : 'aff_cross.png';
|
||||
|
||||
$rows[] = $r;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html .= $this->html->rssExportOverview( $rows, $page_links );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild Export Cache
|
||||
*
|
||||
* @access public
|
||||
* @param mixed $rss_export_id Which export id to execute
|
||||
* @param bool $return Whether to return afterwards or output to page
|
||||
* @return mixed
|
||||
**/
|
||||
public function rssExportRebuildCache( $rss_export_id='', $return=true )
|
||||
{
|
||||
/* INIT */
|
||||
if( ! $rss_export_id )
|
||||
{
|
||||
$rss_export_id = $this->request['rss_export_id'] == 'all' ? 'all' : intval( $this->request['rss_export_id'] );
|
||||
}
|
||||
|
||||
/* Check ID */
|
||||
if ( ! $rss_export_id )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['ex_noid'];
|
||||
$this->rssExportOverview();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get RSS Clas */
|
||||
require_once( IPS_KERNEL_PATH . 'classRss.php' );
|
||||
$class_rss = new classRss();
|
||||
$class_rss->use_sockets = $this->use_sockets;
|
||||
$class_rss->doc_type = IPS_DOC_CHAR_SET;
|
||||
|
||||
/* Reset rss_export cache */
|
||||
$this->cache->updateCacheWithoutSaving( 'rss_export', array() );
|
||||
|
||||
/* Go loopy */
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'rss_export' ) );
|
||||
$outer = $this->DB->execute();
|
||||
|
||||
$cache = array();
|
||||
while( $row = $this->DB->fetch( $outer ) )
|
||||
{
|
||||
/* Update RSS Cache */
|
||||
if ( $row['rss_export_enabled'] )
|
||||
{
|
||||
$cache[] = array( 'url' => $this->settings['board_url'] . '/index.php?act=rssout&id=' . $row['rss_export_id'], 'title' => $row['rss_export_title'] );
|
||||
}
|
||||
|
||||
/* Add to cache? */
|
||||
if( $rss_export_id == 'all' OR $row['rss_export_id'] == $rss_export_id )
|
||||
{
|
||||
/* Build DB Query */
|
||||
if ( $row['rss_export_include_post'] )
|
||||
{
|
||||
$this->DB->build( array(
|
||||
'select' => 't.*',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => "t.forum_id IN( " . $row['rss_export_forums'] . " ) AND t.state != 'link' AND t.approved=1",
|
||||
'order' => 't.' . $row['rss_export_order'] . ' ' . $row['rss_export_sort'],
|
||||
'limit' => array( 0, $row['rss_export_count'] ),
|
||||
'add_join' => array( array(
|
||||
'select' => 'p.pid, p.post, p.use_emo, p.post_htmlstate',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 't.topic_firstpost=p.pid',
|
||||
'type' => 'left'
|
||||
) )
|
||||
) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->DB->build( array(
|
||||
'select' => '*',
|
||||
'from' => 'topics',
|
||||
'where' => "forum_id IN( ".$row['rss_export_forums']." ) AND state != 'link' AND approved=1",
|
||||
'order' => $row['rss_export_order'].' '. $row['rss_export_sort'],
|
||||
'limit' => array( 0, $row['rss_export_count'] )
|
||||
) );
|
||||
}
|
||||
|
||||
/* Exec Query */
|
||||
$inner = $this->DB->execute();
|
||||
|
||||
/* Set var. Doing this so we can set pubDate to start date or last post date appropriately... */
|
||||
$channelCreated = false;
|
||||
|
||||
/* Loop through topics and display */
|
||||
while( $topic = $this->DB->fetch( $inner ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Create channel if not already crated
|
||||
//-----------------------------------------
|
||||
|
||||
if( !$channelCreated )
|
||||
{
|
||||
/* Create Channel */
|
||||
$channel_id = $class_rss->createNewChannel( array(
|
||||
'title' => $row['rss_export_title'],
|
||||
'description' => $row['rss_export_desc'],
|
||||
'link' => $this->settings['board_url'].'/index.php',
|
||||
'pubDate' => $class_rss->formatDate( $row['rss_export_order'] == 'start_date' ? $topic['start_date'] : $topic['last_post'] ),
|
||||
'ttl' => $row['rss_export_cache_time']
|
||||
) );
|
||||
|
||||
if( $row['rss_export_image'] )
|
||||
{
|
||||
$class_rss->addImageToChannel( $channel_id, array(
|
||||
'title' => $row['rss_export_title'],
|
||||
'url' => $row['rss_export_image'],
|
||||
'link'=> $this->settings['board_url'].'/index.php'
|
||||
) );
|
||||
}
|
||||
|
||||
$channelCreated = true;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Parse the post
|
||||
//-----------------------------------------
|
||||
$this->settings['__noTruncateUrl'] = 1;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_smilies = $topic['use_emo'];
|
||||
IPSText::getTextClass( 'bbcode' )->parse_html = ( $this->registry->class_forums->forum_by_id[ $topic['forum_id'] ]['use_html'] and $topic['post_htmlstate'] ) ? 1 : 0;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_nl2br = $topic['post_htmlstate'] == 2 ? 1 : 0;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_section = 'topics';
|
||||
$topic['post'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $topic['post'] );
|
||||
|
||||
if( $row['rss_export_include_post'] AND $topic['topic_hasattach'] )
|
||||
{
|
||||
if ( ! is_object( $_attachments ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Grab render attach class
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPSLib::getAppDir( 'core' ) . '/sources/classes/attach/class_attach.php' );
|
||||
$_attachments = new class_attach( $this->registry );
|
||||
}
|
||||
|
||||
$_attachments->type = 'post';
|
||||
$_attachments->init();
|
||||
|
||||
# attach_pids is generated in the func_topic_xxxxx files
|
||||
$attachHTML = $_attachments->renderAttachments( array( $topic['pid'] => $topic['post'] ), array( $topic['pid'] => $topic['pid'] ) );
|
||||
|
||||
/* Now parse back in the rendered posts */
|
||||
if( is_array($attachHTML) AND count($attachHTML) )
|
||||
{
|
||||
foreach( $attachHTML as $id => $data )
|
||||
{
|
||||
/* Get rid of any lingering attachment tags */
|
||||
if ( stristr( $data['html'], "[attachment=" ) )
|
||||
{
|
||||
$data['html'] = IPSText::stripAttachTag( $data['html'] );
|
||||
}
|
||||
|
||||
$topic['post'] = $data['html'];
|
||||
$topic['post'] .= $data['attachmentHtml'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse */
|
||||
//$topic['post'] = preg_replace( "#\[attachment=(\d+?)\:(?:[^\]]+?)\]#is", "<a href='{$this->settings['board_url']}/index.php?app=core&module=attach§ion=attach&attach_rel_module=post&attach_id=\\1'>".$this->settings['board_url']."/index.php?app=forums&module=forums§ion=attach&type=post&attach_id=\\1</a>", $topic['post'] );
|
||||
|
||||
/* Fix up relative URLs */
|
||||
$topic['post'] = preg_replace( "#([^/])style_images/(<\#IMG_DIR\#>)#is", "\\1" . $this->settings['board_url'] . "/style_images/\\2" , $topic['post'] );
|
||||
$topic['post'] = preg_replace( "#([\"'])style_emoticons/#is" , "\\1" . $this->settings['board_url'] . "/style_emoticons/", $topic['post'] );
|
||||
|
||||
$topic['post'] = $this->registry->output->replaceMacros( $topic['post'] );
|
||||
|
||||
$topic['last_poster_name'] = $topic['last_poster_name'] ? $topic['last_poster_name'] : 'Guest';
|
||||
$topic['starter_name'] = $topic['starter_name'] ? $topic['starter_name'] : 'Guest';
|
||||
|
||||
/* Add item */
|
||||
$class_rss->addItemToChannel( $channel_id, array(
|
||||
'title' => $topic['title'],
|
||||
'link' => $this->registry->output->buildSEOUrl( 'showtopic=' . $topic['tid'], 'publicNoSession', $topic['title_seo'], 'showtopic' ),
|
||||
'description' => $topic['post'],
|
||||
'pubDate' => $class_rss->formatDate( $row['rss_export_order'] == 'last_post' ? $topic['last_post'] : $topic['start_date'] ),
|
||||
'guid' => $this->registry->output->buildSEOUrl( 'showtopic=' . $topic['tid'], 'publicNoSession', $topic['title_seo'], 'showtopic' )
|
||||
) );
|
||||
}
|
||||
|
||||
/* Build document */
|
||||
$class_rss->createRssDocument();
|
||||
|
||||
/* Update the cache */
|
||||
$this->DB->update( 'rss_export', array( 'rss_export_cache_last' => time(), 'rss_export_cache_content' => $class_rss->rss_document ), 'rss_export_id='.$row['rss_export_id'] );
|
||||
}
|
||||
}
|
||||
|
||||
/* Update cache */
|
||||
$this->cache->setCache( 'rss_export', $cache, array( 'donow' => 1, 'array' => 1 ) );
|
||||
|
||||
$this->cache->rebuildCache( 'rss_output_cache' );
|
||||
|
||||
/* Return */
|
||||
if ( $return )
|
||||
{
|
||||
$this->registry->output->global_message = $this->lang->words['ex_recached'];
|
||||
$this->rssExportOverview();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $class_rss->rss_document;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gateway to rebuild RSS export cache
|
||||
*
|
||||
* @access public
|
||||
* @return string RSS document
|
||||
*/
|
||||
public function doRssRebuildCache()
|
||||
{
|
||||
return $this->rssExportRebuildCache( 'all', false );
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<menu>
|
||||
<tabitems>
|
||||
<item>
|
||||
<title>Импорт</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Импорт RSS</subitemtitle>
|
||||
<subsection>import</subsection>
|
||||
<subitemurl>do=overview</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
<item>
|
||||
<title>Экспорт</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Экспорт RSS</subitemtitle>
|
||||
<subsection>export</subsection>
|
||||
<subitemurl>do=overview</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
</tabitems>
|
||||
</menu>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<permissions>
|
||||
<group>
|
||||
<grouptitle>Управление RSS</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>export_manage</key>
|
||||
<string>Может изменять/добавлять RSS экспорт?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>export_delete</key>
|
||||
<string>Может удалять RSS экспорт?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>import_manage</key>
|
||||
<string>Может изменять/добавлять RSS импорт?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>import_delete</key>
|
||||
<string>Может удалять RSS импорт?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>import_remove</key>
|
||||
<string>Может удалять темы импортированные через RSS?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
</permissions>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Default section file for statistics module
|
||||
* Last Updated: $LastChangedDate: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 14th May 2003
|
||||
* @version $Rev: 4948 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Very simply returns the default section if one is not
|
||||
* passed in the URL
|
||||
*/
|
||||
|
||||
$DEFAULT_SECTION = 'stats';
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,533 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Forum Statistics
|
||||
* Last Updated: $Date: 2009-11-13 19:55:00 -0500 (Fri, 13 Nov 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 5405 $
|
||||
*/
|
||||
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class admin_forums_statistics_stats extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Array of Month Names
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private $month_names;
|
||||
|
||||
/**
|
||||
* Skin object
|
||||
*
|
||||
* @access private
|
||||
* @var object Skin templates
|
||||
*/
|
||||
private $html;
|
||||
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
/* Load HTML and Lang */
|
||||
$this->html = $this->registry->output->loadTemplate( 'cp_skin_stats' );
|
||||
$this->registry->class_localization->loadLanguageFile( array( 'admin_stats' ) );
|
||||
|
||||
/* URLs */
|
||||
$this->form_code = $this->html->form_code = 'module=statistics&section=stats';
|
||||
$this->form_code_js = $this->html->form_code_js = 'module=statistics§ion=stats';
|
||||
|
||||
/* Setup the month name array */
|
||||
$this->month_names = array( 1 => $this->lang->words['stats_jan'],
|
||||
2 => $this->lang->words['stats_feb'],
|
||||
3 => $this->lang->words['stats_mar'],
|
||||
4 => $this->lang->words['stats_apr'],
|
||||
5 => $this->lang->words['stats_may'],
|
||||
6 => $this->lang->words['stats_jun'],
|
||||
7 => $this->lang->words['stats_jul'],
|
||||
8 => $this->lang->words['stats_aug'],
|
||||
9 => $this->lang->words['stats_sep'],
|
||||
10 => $this->lang->words['stats_oct'],
|
||||
11 => $this->lang->words['stats_nov'],
|
||||
12 => $this->lang->words['stats_dec']
|
||||
);
|
||||
|
||||
/* What to do */
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'show_reg':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'stats_registration' );
|
||||
$this->result_screen( 'reg' );
|
||||
break;
|
||||
|
||||
case 'show_topic':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'stats_topics' );
|
||||
$this->result_screen( 'topic' );
|
||||
break;
|
||||
|
||||
case 'topic':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'stats_topics' );
|
||||
$this->statsMainScreen( 'topic' );
|
||||
break;
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
case 'show_post':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'stats_posts' );
|
||||
$this->result_screen( 'post' );
|
||||
break;
|
||||
|
||||
case 'post':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'stats_posts' );
|
||||
$this->statsMainScreen( 'post' );
|
||||
break;
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
case 'show_msg':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'stats_msg' );
|
||||
$this->result_screen( 'msg' );
|
||||
break;
|
||||
|
||||
case 'msg':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'stats_msg' );
|
||||
$this->statsMainScreen( 'msg' );
|
||||
break;
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
case 'statsShowTopicViews':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'stats_views' );
|
||||
$this->statsShowTopicViews();
|
||||
break;
|
||||
|
||||
case 'views':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'stats_views' );
|
||||
$this->statsMainScreen( 'views' );
|
||||
break;
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
default:
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'stats_registration' );
|
||||
$this->statsMainScreen( 'reg' );
|
||||
break;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Display statistics for the selected mode
|
||||
*
|
||||
* @access public
|
||||
* @param string Type of stat screen reg, topic, post, msg
|
||||
* @return void
|
||||
**/
|
||||
public function result_screen($mode='reg')
|
||||
{
|
||||
/* Check the to fields */
|
||||
if ( ! checkdate( $this->request['to_month'], $this->request['to_day'], $this->request['to_year'] ) )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['stats_toincorrect'], 11352 );
|
||||
}
|
||||
|
||||
/* Check the from fields */
|
||||
if ( ! checkdate( $this->request['from_month'] ,$this->request['from_day'] ,$this->request['from_year'] ) )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['stats_fromincorrect'], 11353 );
|
||||
}
|
||||
|
||||
/* Create time stamps */
|
||||
$to_time = mktime(12 ,0 ,0 ,$this->request['to_month'] ,$this->request['to_day'] ,$this->request['to_year'] );
|
||||
$from_time = mktime(12 ,0 ,0 ,$this->request['from_month'] ,$this->request['from_day'] ,$this->request['from_year']);
|
||||
|
||||
/* Get Human Dates */
|
||||
$human_to_date = getdate( $to_time );
|
||||
$human_from_date = getdate( $from_time );
|
||||
|
||||
/* Setup based on mode */
|
||||
switch( $mode )
|
||||
{
|
||||
case 'reg':
|
||||
$table = $this->lang->words['stats_reg'];
|
||||
|
||||
$sql_table = 'members';
|
||||
$sql_field = 'joined';
|
||||
|
||||
$this->registry->output->extra_nav[] = array( '', $this->lang->words['stats_reg_nav'] );
|
||||
break;
|
||||
|
||||
case 'topic':
|
||||
$table = $this->lang->words['stats_topic'];
|
||||
|
||||
$sql_table = 'topics';
|
||||
$sql_field = 'start_date';
|
||||
|
||||
$this->registry->output->extra_nav[] = array( '', $this->lang->words['stats_topic_nav'] );
|
||||
break;
|
||||
|
||||
case 'post':
|
||||
$table = $this->lang->words['stats_post'];
|
||||
|
||||
$sql_table = 'posts';
|
||||
$sql_field = 'post_date';
|
||||
|
||||
$this->registry->output->extra_nav[] = array( '', $this->lang->words['stats_post_msg'] );
|
||||
break;
|
||||
|
||||
case 'msg':
|
||||
$table = $this->lang->words['stats_msg'];
|
||||
|
||||
$sql_table = 'message_topics';
|
||||
$sql_field = 'mt_date';
|
||||
|
||||
$this->registry->output->extra_nav[] = array( '', $this->lang->words['stats_msg_nav'] );
|
||||
break;
|
||||
}
|
||||
|
||||
/* Setup Timescale */
|
||||
switch( $this->request['timescale'] )
|
||||
{
|
||||
case 'daily':
|
||||
$sql_date = "%j";
|
||||
$php_date = "F jS - Y";
|
||||
break;
|
||||
|
||||
case 'monthly':
|
||||
$sql_date = "%m %Y";
|
||||
$php_date = "F Y";
|
||||
break;
|
||||
|
||||
default:
|
||||
// weekly
|
||||
$sql_date = "%U %Y";
|
||||
$php_date = "W [F Y]";
|
||||
break;
|
||||
}
|
||||
|
||||
/* Table Title */
|
||||
$title = $this->lang->words[ 'timescale_' . $this->request['timescale'] ] ." {$table} ({$human_from_date['mday']} {$this->month_names[$human_from_date['mon']]} {$human_from_date['year']} {$this->lang->words['stats_to']} {$human_to_date['mday']} {$this->month_names[$human_to_date['mon']]} {$human_to_date['year']})";
|
||||
|
||||
/* Query the stats */
|
||||
$this->DB->build( array(
|
||||
'select' => "MAX( {$sql_field} ) as result_maxdate, COUNT(*) as result_count, {$this->DB->buildDateFormat( $this->DB->buildFromUnixtime( $sql_field ), $sql_date )} as result_time",
|
||||
'from' => $sql_table,
|
||||
'where' => $sql_field . ' > ' . $from_time . ' AND ' . $sql_field . ' < ' . $to_time,
|
||||
'group' => $this->DB->buildDateFormat( $this->DB->buildFromUnixtime( $sql_field ), $sql_date ),
|
||||
//'order' => $sql_field . ' ' . $this->request['sortby'],
|
||||
) );
|
||||
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
/* Loop through the results */
|
||||
$running_total = 0;
|
||||
$max_result = 0;
|
||||
$results = array();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
if( $row['result_count'] > $max_result )
|
||||
{
|
||||
$max_result = $row['result_count'];
|
||||
}
|
||||
|
||||
$running_total += $row['result_count'];
|
||||
|
||||
$results[ $row['result_maxdate'] ] = array(
|
||||
'result_maxdate' => $row['result_maxdate'],
|
||||
'result_count' => $row['result_count'],
|
||||
'result_time' => $row['result_time'],
|
||||
'formatted_date' => date( $php_date, $row['result_maxdate'] ),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
if( strtolower($this->request['sortby']) == 'desc' )
|
||||
{
|
||||
krsort( $results );
|
||||
}
|
||||
else
|
||||
{
|
||||
ksort( $results );
|
||||
}
|
||||
|
||||
/* Build the output rows */
|
||||
$rows = array();
|
||||
|
||||
foreach( $results as $data )
|
||||
{
|
||||
/* Width of the bar */
|
||||
$data['_width'] = intval( ( $data['result_count'] / $max_result ) * 100 - 8 );
|
||||
|
||||
if( $img_width < 1 )
|
||||
{
|
||||
$img_width = 1;
|
||||
}
|
||||
|
||||
$img_width .= '%';
|
||||
|
||||
/* Format Date */
|
||||
if( $this->request['timescale'] == 'weekly' )
|
||||
{
|
||||
$data['_name'] = $this->lang->words['stats_weekno'] . date( $php_date, $data['result_maxdate'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['_name'] = date( $php_date, $data['result_maxdate'] );
|
||||
}
|
||||
|
||||
$rows[] = $data;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html .= $this->html->statResultsScreen( $title, $rows, $running_total );
|
||||
}
|
||||
|
||||
/**
|
||||
* Date Selection Screen
|
||||
*
|
||||
* @access public
|
||||
* @param string Type of stat screen reg, topic, post, msg, views
|
||||
* @return void
|
||||
**/
|
||||
public function statsMainScreen( $mode='reg' )
|
||||
{
|
||||
/* Setup this mode */
|
||||
switch( $mode )
|
||||
{
|
||||
case 'reg':
|
||||
$form_code = 'show_reg';
|
||||
$table = $this->lang->words['stats_reg'];
|
||||
break;
|
||||
|
||||
case 'topic':
|
||||
$form_code = 'show_topic';
|
||||
$table = $this->lang->words['stats_topic'];
|
||||
break;
|
||||
|
||||
case 'post':
|
||||
$form_code = 'show_post';
|
||||
$table = $this->lang->words['stats_post'];
|
||||
break;
|
||||
|
||||
case 'msg':
|
||||
$form_code = 'show_msg';
|
||||
$table = $this->lang->words['stats_msg'];
|
||||
break;
|
||||
|
||||
case 'views':
|
||||
default:
|
||||
$form_code = 'statsShowTopicViews';
|
||||
$table = $this->lang->words['stats_views'];
|
||||
break;
|
||||
}
|
||||
|
||||
/* Setup Dates */
|
||||
$old_date = getdate( time() - ( 3600 * 24 * 90 ) );
|
||||
$new_date = getdate( time() + ( 3600 * 24 ) );
|
||||
|
||||
/* Form Elements */
|
||||
$form = array();
|
||||
|
||||
$form['from_month'] = $this->registry->output->formDropdown( "from_month", $this->statsMakeMonth(), $old_date['mon'] );
|
||||
$form['from_day'] = $this->registry->output->formDropdown( "from_day" , $this->statsMakeDay() , $old_date['mday'] );
|
||||
$form['from_year'] = $this->registry->output->formDropdown( "from_year" , $this->statsMakeYear() , $old_date['year'] );
|
||||
$form['to_month'] = $this->registry->output->formDropdown( "to_month" , $this->statsMakeMonth(), $new_date['mon'] );
|
||||
$form['to_day'] = $this->registry->output->formDropdown( "to_day" , $this->statsMakeDay() , $new_date['mday'] );
|
||||
$form['to_year'] = $this->registry->output->formDropdown( "to_year" , $this->statsMakeYear() , $new_date['year'] );
|
||||
$form['timescale'] = $this->registry->output->formDropdown( "timescale" , array( 0 => array( 'daily', $this->lang->words['stats_daily']), 1 => array( 'weekly', $this->lang->words['stats_weekly'] ), 2 => array( 'monthly', $this->lang->words['stats_monthly'] ) ) );
|
||||
$form['sortby'] = $this->registry->output->formDropdown( "sortby" , array( 0 => array( 'asc', $this->lang->words['stats_asc']), 1 => array( 'desc', $this->lang->words['stats_desc'] ) ), 'desc' );
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->html .= $this->html->statMainScreeen( $form_code, $table, $form );
|
||||
}
|
||||
|
||||
/**
|
||||
* Show topic view stats
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function statsShowTopicViews()
|
||||
{
|
||||
/* Check the to fields */
|
||||
if ( ! checkdate( $this->request['to_month'], $this->request['to_day'], $this->request['to_year'] ) )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['stats_toincorrect'], 11354 );
|
||||
}
|
||||
|
||||
/* Check the from fields */
|
||||
if ( ! checkdate( $this->request['from_month'] ,$this->request['from_day'] ,$this->request['from_year'] ) )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['stats_fromincorrect'], 11355 );
|
||||
}
|
||||
|
||||
/* Create time stamps */
|
||||
$to_time = mktime(0 ,0 ,0 ,$this->request['to_month'] ,$this->request['to_day'] ,$this->request['to_year'] );
|
||||
$from_time = mktime(0 ,0 ,0 ,$this->request['from_month'] ,$this->request['from_day'] ,$this->request['from_year']);
|
||||
|
||||
/* Get Human Dates */
|
||||
$human_to_date = getdate( $to_time );
|
||||
$human_from_date = getdate( $from_time );
|
||||
|
||||
/* Title */
|
||||
$title = "{$this->lang->words['stats_views_nav']} ({$human_from_date['mday']} {$this->month_names[$human_from_date['mon']]} {$human_from_date['year']} {$this->lang->words['stats_to']} {$human_to_date['mday']} {$this->month_names[$human_to_date['mon']]} {$human_to_date['year']})";
|
||||
|
||||
/* Query the topic stats */
|
||||
$this->DB->build( array(
|
||||
'select' => 'SUM(t.views) as result_count, t.forum_id',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => "t.start_date > {$from_time} AND t.start_date < {$to_time}",
|
||||
'group' => 't.forum_id',
|
||||
'order' => 'result_count ' . $this->request['sortby'],
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 'f.name as result_name',
|
||||
'from' => array( 'forums' => 'f' ),
|
||||
'where' => 'f.id=t.forum_id',
|
||||
'type' => 'left'
|
||||
)
|
||||
)
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
/* Loop through the results */
|
||||
$running_total = 0;
|
||||
$max_result = 0;
|
||||
$results = array();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
if( $row['result_count'] > $max_result )
|
||||
{
|
||||
$max_result = $row['result_count'];
|
||||
}
|
||||
|
||||
$running_total += $row['result_count'];
|
||||
|
||||
$results[] = array(
|
||||
'result_maxdate' => $row['result_maxdate'],
|
||||
'result_count' => $row['result_count'],
|
||||
'result_time' => $row['result_time'],
|
||||
'result_name' => $row['result_name'],
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/* Build the output rows */
|
||||
$rows = array();
|
||||
|
||||
foreach( $results as $data )
|
||||
{
|
||||
/* Width of the bar */
|
||||
$data['_width'] = intval( ( $data['result_count'] / $max_result ) * 100 - 8 );
|
||||
|
||||
if( $img_width < 1 )
|
||||
{
|
||||
$img_width = 1;
|
||||
}
|
||||
|
||||
$img_width .= '%';
|
||||
|
||||
/* Title */
|
||||
$data['_name'] = $data['result_name'];
|
||||
|
||||
$rows[] = $data;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->registry->output->extra_nav[] = array( '', 'Topic Views' );
|
||||
$this->registry->output->html .= $this->html->statResultsScreen( $title, $rows, $running_total );
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the drop down options for the year select
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
**/
|
||||
public function statsMakeYear()
|
||||
{
|
||||
$time_now = getdate();
|
||||
|
||||
$return = array();
|
||||
|
||||
$start_year = 2002;
|
||||
|
||||
$latest_year = intval($time_now['year']);
|
||||
|
||||
if ($latest_year == $start_year)
|
||||
{
|
||||
$start_year -= 1;
|
||||
}
|
||||
|
||||
for ( $y = $start_year; $y <= $latest_year; $y++ )
|
||||
{
|
||||
$return[] = array( $y, $y);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the drop down options for the month select
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
**/
|
||||
public function statsMakeMonth()
|
||||
{
|
||||
$return = array();
|
||||
|
||||
for ( $m = 1 ; $m <= 12; $m++ )
|
||||
{
|
||||
$return[] = array( $m, $this->month_names[$m] );
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the drop down options for the day select
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
**/
|
||||
public function statsMakeDay()
|
||||
{
|
||||
$return = array();
|
||||
|
||||
for ( $d = 1 ; $d <= 31; $d++ )
|
||||
{
|
||||
$return[] = array( $d, $d );
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<menu>
|
||||
<tabitems>
|
||||
<item>
|
||||
<title>Регистрации</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Статистика регистраций</subitemtitle>
|
||||
<subsection>stats</subsection>
|
||||
<subitemurl>do=reg</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
<item>
|
||||
<title>Новые темы</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Статистика создания тем</subitemtitle>
|
||||
<subsection>stats</subsection>
|
||||
<subitemurl>do=topic</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
<item>
|
||||
<title>Новые сообщения</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Статистика отправки сообщений</subitemtitle>
|
||||
<subsection>stats</subsection>
|
||||
<subitemurl>do=post</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
<item>
|
||||
<title>Личные сообщения</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Статистика использования ЛС</subitemtitle>
|
||||
<subsection>stats</subsection>
|
||||
<subitemurl>do=msg</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
<item>
|
||||
<title>Просмотры тем</title>
|
||||
<subitems>
|
||||
<subitem>
|
||||
<subitemtitle>Статистика просмотров тем</subitemtitle>
|
||||
<subsection>stats</subsection>
|
||||
<subitemurl>do=views</subitemurl>
|
||||
<subitemrolekey></subitemrolekey>
|
||||
<subisredirect>0</subisredirect>
|
||||
</subitem>
|
||||
</subitems>
|
||||
</item>
|
||||
</tabitems>
|
||||
</menu>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<permissions>
|
||||
<group>
|
||||
<grouptitle>Управление статистикой</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>stats_topics</key>
|
||||
<string>Может просматривать отчет о новых темах?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>stats_registration</key>
|
||||
<string>Может просматривать отчет о новых регистрациях?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>stats_posts</key>
|
||||
<string>Может просматривать отчет о новых сообщениях?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>stats_msg</key>
|
||||
<string>Может просматривать отчет о новых личных сообщениях?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>stats_views</key>
|
||||
<string>Может просматривать отчет о просмотрах тем?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
</permissions>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Default section for tools module
|
||||
* Last Updated: $LastChangedDate: 2008-12-18 10:27:04 -0500 (Thu, 18 Dec 2008) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 14th May 2003
|
||||
* @version $Rev: 3491 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Very simply returns the default section if one is not
|
||||
* passed in the URL
|
||||
*/
|
||||
|
||||
$DEFAULT_SECTION = 'tools';
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,716 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Member management
|
||||
* Last Updated: $Date: 2009-10-16 10:46:16 -0400 (Fri, 16 Oct 2009) $
|
||||
*
|
||||
* @author $Author: josh $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 1st march 2002
|
||||
* @version $Revision: 5234 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
class admin_forums_tools_tools extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Skin object
|
||||
*
|
||||
* @access private
|
||||
* @var object Skin templates
|
||||
*/
|
||||
private $html;
|
||||
|
||||
/**
|
||||
* Shortcut for url
|
||||
*
|
||||
* @access private
|
||||
* @var string URL shortcut
|
||||
*/
|
||||
private $form_code;
|
||||
|
||||
/**
|
||||
* Shortcut for url (javascript)
|
||||
*
|
||||
* @access private
|
||||
* @var string JS URL shortcut
|
||||
*/
|
||||
private $form_code_js;
|
||||
|
||||
/**
|
||||
* Editor object
|
||||
*
|
||||
* @access private
|
||||
* @var object Editor library
|
||||
*/
|
||||
private $han_editor;
|
||||
|
||||
/**
|
||||
* Trash can forum id
|
||||
*
|
||||
* @access private
|
||||
* @var integer Trash can forum
|
||||
*/
|
||||
private $trash_forum = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load skin
|
||||
//-----------------------------------------
|
||||
|
||||
$this->html = $this->registry->output->loadTemplate('cp_skin_member_form');
|
||||
|
||||
//-----------------------------------------
|
||||
// Set up stuff
|
||||
//-----------------------------------------
|
||||
|
||||
$this->form_code = $this->html->form_code = 'module=tools&section=tools';
|
||||
$this->form_code_js = $this->html->form_code_js = 'module=tools§ion=tools';
|
||||
|
||||
//-----------------------------------------
|
||||
// Load lang
|
||||
//-----------------------------------------
|
||||
|
||||
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'admin_forums' ), 'forums' );
|
||||
|
||||
///-----------------------------------------
|
||||
// What to do...
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
default:
|
||||
case 'deleteposts':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ftools_deleteposts' );
|
||||
$this->_deletePostsStart();
|
||||
break;
|
||||
|
||||
case 'deletesubscriptions':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ftools_deletesubscriptions' );
|
||||
$this->_deleteSubscriptions();
|
||||
break;
|
||||
|
||||
case 'clearforumsubs':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ftools_clearforumsubs' );
|
||||
$this->_deleteForumSubscriptions();
|
||||
break;
|
||||
|
||||
case 'deleteposts_process':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ftools_deleteposts' );
|
||||
$this->_deletePostsDo();
|
||||
break;
|
||||
|
||||
case 'new_avatar':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'member_photo', 'members', 'members' );
|
||||
$this->_processAvatar();
|
||||
break;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Pass to CP output hander
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('output')->html_main .= $this->registry->getClass('output')->global_template->global_frame_wrapper();
|
||||
$this->registry->getClass('output')->sendOutput();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a forum's email subscriptions
|
||||
*
|
||||
* @access private
|
||||
* @return void
|
||||
* @author Brandon Farber
|
||||
* @since IPB3 / 22 Oct 2008
|
||||
*/
|
||||
private function _deleteForumSubscriptions()
|
||||
{
|
||||
/**
|
||||
* Get members watching forums so we can recache em..
|
||||
*/
|
||||
$forum_id = intval( $this->request['f'] );
|
||||
$members = array();
|
||||
|
||||
$this->DB->build( array( 'select' => 'member_id', 'from' => 'forum_tracker', 'where' => 'forum_id=' . $forum_id ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
$members[] = $r['member_id'];
|
||||
}
|
||||
|
||||
$this->DB->delete( 'forum_tracker', 'forum_id=' . $forum_id );
|
||||
|
||||
foreach( $members as $mid )
|
||||
{
|
||||
$this->registry->getClass('class_forums')->recacheWatchedForums( $mid );
|
||||
}
|
||||
|
||||
/**
|
||||
* Topics is teh suck...gotta get em first to delete em
|
||||
*/
|
||||
$toDelete = array();
|
||||
|
||||
$this->DB->build( array( 'select' => 'tr.trid',
|
||||
'from' => array( 'tracker' => 'tr' ),
|
||||
'where' => 't.forum_id=' . $forum_id,
|
||||
'add_join' => array(
|
||||
array(
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.tid=tr.topic_id',
|
||||
'type' => 'left'
|
||||
)
|
||||
)
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
$toDelete[] = $r['trid'];
|
||||
}
|
||||
|
||||
if( count($toDelete) )
|
||||
{
|
||||
$this->DB->delete( 'tracker', 'trid IN(' . implode( ',', $toDelete ) . ')' );
|
||||
}
|
||||
|
||||
$this->registry->output->redirect( $this->settings['_base_url'] . "app=forums", $this->lang->words['m_subsf_redirect'] );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a member's email subscriptions
|
||||
*
|
||||
* @access private
|
||||
* @return void
|
||||
* @author Brandon Farber
|
||||
* @since IPB3 / 22 Oct 2008
|
||||
*/
|
||||
private function _deleteSubscriptions()
|
||||
{
|
||||
$member_id = intval( $this->request['member_id'] );
|
||||
|
||||
$this->DB->delete( 'tracker', 'member_id=' . $member_id );
|
||||
$this->DB->delete( 'forum_tracker', 'member_id=' . $member_id );
|
||||
|
||||
$this->registry->output->redirect( $this->settings['_base_url'] . "app=members&module=members&section=members&do=viewmember&member_id={$this->request['member_id']}", $this->lang->words['m_subs_redirect'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a member's avatar
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
* @author Brandon Farber
|
||||
* @since IPB3 / 9 June 2008
|
||||
*/
|
||||
private function _processAvatar()
|
||||
{
|
||||
$member_id = intval( $this->request['member_id'] );
|
||||
|
||||
try
|
||||
{
|
||||
IPSMember::getFunction()->saveNewAvatar( $member_id );
|
||||
}
|
||||
catch( Exception $error )
|
||||
{
|
||||
switch ( $error->getMessage() )
|
||||
{
|
||||
case 'NO_MEMBER_ID':
|
||||
$this->registry->output->showError( $this->lang->words['t_noid'], 11356 );
|
||||
break;
|
||||
case 'NO_PERMISSION':
|
||||
$this->registry->output->showError( $this->lang->words['t_permav'], 11357, true );
|
||||
break;
|
||||
case 'UPLOAD_NO_IMAGE':
|
||||
$this->registry->output->showError( $this->lang->words['t_uploadfail1'], 11358 );
|
||||
break;
|
||||
case 'UPLOAD_INVALID_FILE_EXT':
|
||||
$this->registry->output->showError( $this->lang->words['t_uploadfail2'], 11359 );
|
||||
break;
|
||||
case 'UPLOAD_TOO_LARGE':
|
||||
$this->registry->output->showError( $this->lang->words['t_uploadfail3'], 11360 );
|
||||
break;
|
||||
case 'UPLOAD_CANT_BE_MOVED':
|
||||
$this->registry->output->showError( $this->lang->words['t_uploadfail4'], 11361 );
|
||||
break;
|
||||
case 'UPLOAD_NOT_IMAGE':
|
||||
$this->registry->output->showError( $this->lang->words['t_uploadfail5'], 2131, true );
|
||||
break;
|
||||
case 'NO_AVATAR_TO_SAVE':
|
||||
$this->registry->output->showError( $this->lang->words['t_noav'], 11362 );
|
||||
break;
|
||||
case 'INVALID_FILE_EXT':
|
||||
$this->registry->output->showError( $this->lang->words['t_badavext'], 11362 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->registry->output->redirect( $this->settings['_base_url'] . "app=members&module=members&section=members&do=viewmember&member_id={$this->request['member_id']}", $this->lang->words['t_avupdated'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a member's posts [process]
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _deletePostsDo()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$member_id = intval( $this->request['member_id'] );
|
||||
$delete_posts = intval( $this->request['dposts'] );
|
||||
$delete_topics = intval( $this->request['dtopics'] );
|
||||
$end = intval( $this->request['dpergo'] ) ? intval( $this->request['dpergo'] ) : 50;
|
||||
$init = intval( $this->request['init'] );
|
||||
$done = 0;
|
||||
$start = intval($this->request['st']) >=0 ? intval($this->request['st']) : 0;
|
||||
$forums_affected = array();
|
||||
$topics_affected = array();
|
||||
$img = '<img src="' . $this->settings['skin_acp_url'] . '/images/aff_tick.png" border="0" alt="-" /> ';
|
||||
$posts_deleted = 0;
|
||||
$topics_deleted = 0;
|
||||
|
||||
//--------------------------------------------
|
||||
// NOT INIT YET?
|
||||
//--------------------------------------------
|
||||
|
||||
if ( ! $init )
|
||||
{
|
||||
$url = $this->settings['base_url'] . '&' . $this->form_code_js . "&do=deleteposts_process&dpergo=" . $this->request['dpergo']
|
||||
."&st=0"
|
||||
."&init=1"
|
||||
."&dposts={$delete_posts}"
|
||||
."&dtopics={$delete_topics}"
|
||||
."&use_trash_can=".intval($this->request['use_trash_can'])
|
||||
."&member_id={$member_id}";
|
||||
|
||||
$this->registry->output->multipleRedirectInit( $url );
|
||||
}
|
||||
|
||||
//--------------------------------------------
|
||||
// Not loaded the func?
|
||||
//--------------------------------------------
|
||||
|
||||
if ( ! is_object( $mod_func ) )
|
||||
{
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/itemmarking/classItemMarking.php' );
|
||||
$this->registry->setClass( 'classItemMarking', new classItemMarking( $this->registry ) );
|
||||
|
||||
require_once( IPSLib::getAppDir('forums') . '/sources/classes/moderate.php' );
|
||||
$mod_func = new moderatorLibrary( $this->registry );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Trash-can set up
|
||||
//-----------------------------------------
|
||||
|
||||
$trash_append = '';
|
||||
|
||||
if ( $this->settings['forum_trash_can_enable'] and $this->settings['forum_trash_can_id'] )
|
||||
{
|
||||
if ( $this->registry->class_forums->forum_by_id[ $this->settings['forum_trash_can_id'] ]['sub_can_post'] )
|
||||
{
|
||||
if ( $this->request['use_trash_can'] )
|
||||
{
|
||||
$this->trash_forum = $this->settings['forum_trash_can_id'];
|
||||
$trash_append = " AND forum_id<>{$this->trash_forum}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get member
|
||||
//-----------------------------------------
|
||||
|
||||
$member = IPSMember::load( $member_id, 'core' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Avoid limit...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array( 'select' => 'p.*',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => "p.author_id={$member_id}{$trash_append}",
|
||||
'order' => 'p.pid ASC',
|
||||
'limit' => array( $start, $end ),
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 't.*',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.tid=p.topic_id',
|
||||
'type' => 'left',
|
||||
)
|
||||
)
|
||||
) );
|
||||
$outer = $this->DB->execute();
|
||||
|
||||
//-----------------------------------------
|
||||
// Process...
|
||||
//-----------------------------------------
|
||||
|
||||
while( $r = $this->DB->fetch( $outer ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Copy record to topic array
|
||||
//-----------------------------------------
|
||||
|
||||
$topic = $r;
|
||||
|
||||
//-----------------------------------------
|
||||
// No longer a topic?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $topic['tid'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$done++;
|
||||
|
||||
//-----------------------------------------
|
||||
// Get number of MID posters
|
||||
//-----------------------------------------
|
||||
|
||||
$topic_i_posted = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as count',
|
||||
'from' => 'posts',
|
||||
'where' => 'author_id=' . $member_id . ' AND topic_id=' . $r['topic_id'] ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Aready deleted this topic?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $topic_i_posted['count'])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// First check: Our topic and no other replies?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $topic['starter_id'] == $member_id AND $topic_i_posted['count'] == ( $topic['posts'] + 1 ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Ok, deleting topics or posts?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ( $delete_posts OR $delete_topics ) AND ( $this->trash_forum and $this->trash_forum != $topic['forum_id'] ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Move, don't delete
|
||||
//-----------------------------------------
|
||||
|
||||
$mod_func->topicMove( $r['topic_id'], $topic['forum_id'], $this->trash_forum );
|
||||
|
||||
$forums_affected[ $topic['forum_id'] ] = $topic['forum_id'];
|
||||
$forums_affected[ $this->trash_forum ] = $this->trash_forum;
|
||||
|
||||
$topics_deleted++;
|
||||
$posts_deleted += $topic_i_posted['count'];
|
||||
}
|
||||
else if ( $delete_posts OR $delete_topics )
|
||||
{
|
||||
$this->DB->delete( 'posts', 'author_id=' . $member_id . ' AND topic_id=' . $r['topic_id'] );
|
||||
$this->DB->delete('topics', 'tid=' . $r['topic_id'] );
|
||||
|
||||
$forums_affected[ $topic['forum_id'] ] = $topic['forum_id'];
|
||||
$topics_deleted++;
|
||||
$posts_deleted += $topic_i_posted['count'];
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Is this a topic we started?
|
||||
//-----------------------------------------
|
||||
|
||||
else if ( $topic['starter_id'] == $member_id AND $delete_topics )
|
||||
{
|
||||
if ( $this->trash_forum and $this->trash_forum != $topic['forum_id'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Move, don't delete
|
||||
//-----------------------------------------
|
||||
|
||||
$mod_func->topicMove( $r['topic_id'], $topic['forum_id'], $this->trash_forum );
|
||||
|
||||
$forums_affected[ $topic['forum_id'] ] = $topic['forum_id'];
|
||||
$forums_affected[ $this->trash_forum ] = $this->trash_forum;
|
||||
|
||||
$topics_deleted++;
|
||||
$posts_deleted += $topic_i_posted['count'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->DB->delete( 'posts', 'topic_id=' . $r['topic_id'] );
|
||||
$this->DB->delete( 'topics', 'tid=' . $r['topic_id'] );
|
||||
|
||||
$forums_affected[ $topic['forum_id'] ] = $topic['forum_id'];
|
||||
$topics_deleted++;
|
||||
$posts_deleted += $topic['posts'] + 1;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Just delete the post, then
|
||||
//-----------------------------------------
|
||||
|
||||
else if ( $delete_posts AND ! $r['new_topic'] )
|
||||
{
|
||||
if ( $this->trash_forum and $this->trash_forum != $topic['forum_id'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Set up and pass to split topic handler
|
||||
//-----------------------------------------
|
||||
|
||||
$new_title = $this->lang->words['acp_posts_deleted_from'] . $topic['title'];
|
||||
$new_desc = $this->lang->words['acp_posts_deleted_from_tid'] . $topic['tid'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Is first post queued?
|
||||
//-----------------------------------------
|
||||
|
||||
$topic_approved = 1;
|
||||
|
||||
$first_post = $this->DB->buildAndFetch( array( 'select' => 'pid, queued',
|
||||
'from' => 'posts',
|
||||
'where' => "pid=" . $r['pid'],
|
||||
) );
|
||||
|
||||
if( $first_post['queued'] )
|
||||
{
|
||||
$topic_approved = 0;
|
||||
$this->DB->update( 'posts', array( 'queued' => 0 ), 'pid=' . $first_post['pid'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Complete a new dummy topic
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->insert( 'topics', array(
|
||||
'title' => $new_title,
|
||||
'description' => $new_desc,
|
||||
'state' => 'open',
|
||||
'posts' => 0,
|
||||
'starter_id' => $member_id,
|
||||
'starter_name' => $member['members_display_name'],
|
||||
'start_date' => time(),
|
||||
'last_poster_id' => $member_id,
|
||||
'last_poster_name' => $member['members_display_name'],
|
||||
'last_post' => time(),
|
||||
'icon_id' => 0,
|
||||
'author_mode' => 1,
|
||||
'poll_state' => 0,
|
||||
'last_vote' => 0,
|
||||
'views' => 0,
|
||||
'forum_id' => $this->trash_forum,
|
||||
'approved' => $topic_approved,
|
||||
'pinned' => 0,
|
||||
) );
|
||||
|
||||
$new_topic_id = $this->DB->getInsertId();
|
||||
|
||||
//-----------------------------------------
|
||||
// Move the posts
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->update( 'posts', array( 'topic_id' => $new_topic_id, 'new_topic' => 0, 'queued' => 0 ), "pid={$r['pid']}" );
|
||||
$this->DB->update( 'posts', array( 'new_topic' => 0 ), "topic_id={$topic['tid']}" );
|
||||
|
||||
$forums_affected[ $topic['forum_id'] ] = $topic['forum_id'];
|
||||
$forums_affected[ $this->trash_forum ] = $this->trash_forum;
|
||||
$topics_affected[ $topic['tid'] ] = $topic['tid'];
|
||||
$topics_affected[ $new_topic_id ] = $new_topic_id;
|
||||
|
||||
$posts_deleted++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->DB->delete( 'posts', 'pid=' . $r['pid'] );
|
||||
|
||||
$forums_affected[ $topic['forum_id'] ] = $topic['forum_id'];
|
||||
$topics_affected[ $topic['tid'] ] = $topic['tid'];
|
||||
|
||||
$posts_deleted++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Rebuild topics and forums
|
||||
//-----------------------------------------
|
||||
|
||||
if ( count( $topics_affected ) )
|
||||
{
|
||||
foreach( $topics_affected as $tid )
|
||||
{
|
||||
$mod_func->rebuildTopic( $tid, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
if ( count( $forums_affected ) )
|
||||
{
|
||||
foreach( $forums_affected as $fid )
|
||||
{
|
||||
$mod_func->forumRecount( $fid );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Finish - or more?...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $done )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Recount stats..
|
||||
//-----------------------------------------
|
||||
|
||||
$mod_func->statsRecount();
|
||||
|
||||
//-----------------------------------------
|
||||
// Reset member's posts
|
||||
//-----------------------------------------
|
||||
|
||||
$forums = array();
|
||||
|
||||
foreach( $this->registry->class_forums->forum_by_id as $data )
|
||||
{
|
||||
if ( ! $data['inc_postcount'] )
|
||||
{
|
||||
$forums[] = $data['id'];
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! count( $forums ) )
|
||||
{
|
||||
$count = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count', 'from' => 'posts', 'where' => 'queued != 1 AND author_id=' . $member_id ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$count = $this->DB->buildAndFetch( array( 'select' => 'count(p.pid) as count',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'p.queued <> 1 AND p.author_id=' . $member_id . ' AND t.forum_id NOT IN (' . implode( ",", $forums ) . ')',
|
||||
'add_join' => array(
|
||||
array( 'type' => 'left',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.tid=p.topic_id'
|
||||
)
|
||||
)
|
||||
) );
|
||||
}
|
||||
|
||||
$new_post_count = intval( $count['count'] );
|
||||
|
||||
$this->registry->adminFunctions->saveAdminLog( sprintf( $this->lang->words['member_posts_deleted'], $member['members_display_name'] ) );
|
||||
|
||||
IPSMember::save( $member_id, array( 'core' => array( 'posts' => $new_post_count ) ) );
|
||||
|
||||
$this->registry->output->multipleRedirectFinish( $this->lang->words['mem_posts_process_done'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// More..
|
||||
//-----------------------------------------
|
||||
|
||||
$next = $start + $end;
|
||||
|
||||
$url = $this->settings['base_url'] . '&' . $this->form_code_js . "&do=deleteposts_process&dpergo={$end}"
|
||||
."&st={$next}"
|
||||
."&init=1"
|
||||
."&dposts={$delete_posts}"
|
||||
."&dtopics={$delete_topics}"
|
||||
."&use_trash_can=".intval($this->request['use_trash_can'])
|
||||
."&member_id={$member_id}";
|
||||
|
||||
$text = sprintf( $this->lang->words['mem_posts_process_more'], $end, $posts_deleted, $topics_deleted );
|
||||
|
||||
$this->registry->output->multipleRedirectHit( $url, $img . ' ' . $text );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a member's posts [form/confirmation]
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _deletePostsStart()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Page set up
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->extra_nav[] = array( '', $this->lang->words['mem_delete_title'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$member_id = intval($this->request['member_id']);
|
||||
|
||||
//-----------------------------------------
|
||||
// Get member
|
||||
//-----------------------------------------
|
||||
|
||||
$member = IPSMember::load( $member_id, 'core' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get number of topics member has started
|
||||
//-----------------------------------------
|
||||
|
||||
$topics = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count',
|
||||
'from' => 'topics',
|
||||
'where' => 'starter_id=' . $member_id ) );
|
||||
|
||||
$posts = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count',
|
||||
'from' => 'posts',
|
||||
'where' => 'author_id=' . $member_id ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Got any posts?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $posts['count'] )
|
||||
{
|
||||
$this->registry->output->showError( $this->lang->words['t_noposts'], 11363 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get number of topics member has started
|
||||
//-----------------------------------------
|
||||
|
||||
$this->lang->words['mem_delete_delete_posts'] = sprintf( $this->lang->words['mem_delete_delete_posts'] , intval($posts['count']) );
|
||||
$this->lang->words['mem_delete_delete_topics'] = sprintf( $this->lang->words['mem_delete_delete_topics'], intval($topics['count']) );
|
||||
|
||||
$this->registry->output->html .= $this->html->deletePostsStart( $member, intval($topics['count']), intval($posts['count']) );
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<permissions>
|
||||
<group>
|
||||
<grouptitle>Инструменты</grouptitle>
|
||||
<items>
|
||||
<item>
|
||||
<key>ftools_deleteposts</key>
|
||||
<string>Может удалять все сообщения пользователя?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>ftools_deletesubscriptions</key>
|
||||
<string>Может отменить все подписки пользователя на темы?</string>
|
||||
</item>
|
||||
<item>
|
||||
<key>ftools_clearforumsubs</key>
|
||||
<string>Может отменить все подписки пользователя на форумы?</string>
|
||||
</item>
|
||||
</items>
|
||||
</group>
|
||||
</permissions>
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Grab attachments and return via AJAX (AJAX)
|
||||
* Last Updated$
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Revision: 4955 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_ajax_attachments extends ipsAjaxCommand
|
||||
{
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$topic_id = intval( $this->request['tid'] );
|
||||
|
||||
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_stats' ), 'forums' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check..
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $topic_id )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words['notopic_attach'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// get topic..
|
||||
//-----------------------------------------
|
||||
|
||||
$topic = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'topics', 'where' => 'tid=' . $topic_id ) );
|
||||
|
||||
if ( ! $topic['topic_hasattach'] )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words['topic_noattach'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check forum..
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->registry->getClass('class_forums')->forumsCheckAccess( $topic['forum_id'], 0, 'forum', $topic, true ) === false )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words['topic_noperms'] );
|
||||
}
|
||||
|
||||
require_once( IPSLib::getAppDir('forums') . '/modules_public/forums/attach.php' );
|
||||
$attach = new public_forums_forums_attach( $this->registry );
|
||||
$attach->makeRegistryShortcuts( $this->registry );
|
||||
|
||||
$attachHTML = $attach->getAttachments( $topic );
|
||||
|
||||
if ( !$attachHTML )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words['ajax_nohtml_return'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->returnHtml( $this->registry->getClass('output')->getTemplate('forum')->forumAttachmentsAjaxWrapper( $attachHTML ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Default section file for forum ajax module
|
||||
* Last Updated: $LastChangedDate: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 14th May 2003
|
||||
* @version $Rev: 4948 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Very simply returns the default section if one is not
|
||||
* passed in the URL
|
||||
*/
|
||||
|
||||
$DEFAULT_SECTION = 'topics';
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Ourputs emoticon list via AJAX (AJAX)
|
||||
* Last Updated $Date: 2009-02-04 15:03:36 -0500 (Wed, 04 Feb 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 3887 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_ajax_emoticons extends ipsAjaxCommand
|
||||
{
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
/* INIT */
|
||||
$smilie_id = 0;
|
||||
$editor_id = IPSText::alphanumericalClean( $this->request['editor_id'] );
|
||||
|
||||
/* Query the emoticons */
|
||||
$this->DB->build( array( 'select' => 'typed, image', 'from' => 'emoticons', 'where' => "emo_set='".$this->registry->output->skin['set_emo_dir']."'" ) );
|
||||
$this->DB->execute();
|
||||
|
||||
/* Loop through and build output array */
|
||||
$rows = array();
|
||||
|
||||
if( $this->DB->getTotalRows() )
|
||||
{
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
$smilie_id++;
|
||||
|
||||
if( strstr( $r['typed'], """ ) )
|
||||
{
|
||||
$in_delim = "'";
|
||||
$out_delim = '"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$in_delim = '"';
|
||||
$out_delim = "'";
|
||||
}
|
||||
|
||||
$rows[] = array(
|
||||
'code' => stripslashes( $r['typed'] ),
|
||||
'image' => stripslashes( $r['image'] ),
|
||||
'in' => $in_delim,
|
||||
'out' => $out_delim,
|
||||
'smilie_id' => $smilie_id
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->returnHtml( $this->registry->getClass('output')->getTemplate('legends')->emoticonPopUpList( $editor_id, $rows ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Ajax Functions For Topics
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Revision: 4948 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_ajax_markasread extends ipsAjaxCommand
|
||||
{
|
||||
/**
|
||||
* IPS command execution
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
/* Ensure cookies are sent */
|
||||
$this->settings['no_print_header'] = 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// What are we doing?
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['marktype'] )
|
||||
{
|
||||
default:
|
||||
case 'forum':
|
||||
return $this->markForumAsRead();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks the specified forum as read
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function markForumAsRead()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$forum_id = intval( $this->request['forumid'] );
|
||||
//$return_to_id = intval( $this->request['returntoforumid'] );
|
||||
$forum_data = $this->registry->getClass('class_forums')->forum_by_id[ $forum_id ];
|
||||
$children = $this->registry->getClass('class_forums')->forumsGetChildren( $forum_data['id'] );
|
||||
$save = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $forum_data['id'] )
|
||||
{
|
||||
$this->returnJsonError( 'markread_no_id' );
|
||||
}
|
||||
|
||||
/* Turn off instant updates and write back tmp markers in destructor */
|
||||
$this->registry->classItemMarking->disableInstantSave();
|
||||
|
||||
//-----------------------------------------
|
||||
// Come from the index? Add kids
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->request['i'] )
|
||||
{
|
||||
if ( is_array( $children ) and count($children) )
|
||||
{
|
||||
foreach( $children as $id )
|
||||
{
|
||||
$this->registry->classItemMarking->markRead( array( 'forumID' => $id ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Add in the current forum...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->classItemMarking->markRead( array( 'forumID' => $forum_id ) );
|
||||
|
||||
|
||||
$this->returnJsonArray( array( 'result' => 'success') );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Retrieve who posted stats
|
||||
* Last Updated$
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Revision: 4955 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_ajax_stats extends ipsAjaxCommand
|
||||
{
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'who':
|
||||
$this->_whoPosted();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve posters in a given topic
|
||||
*
|
||||
* @access protected
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
protected function _whoPosted()
|
||||
{
|
||||
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_stats' ), 'forums' );
|
||||
|
||||
require_once( IPSLib::getAppDir('forums') . '/modules_public/extras/stats.php' );
|
||||
$stats = new public_forums_extras_stats( $this->registry );
|
||||
$stats->makeRegistryShortcuts( $this->registry );
|
||||
|
||||
$output = $stats->whoPosted( true );
|
||||
|
||||
if ( !$output )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words['ajax_nohtml_return'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->returnHtml( $this->registry->getClass('output')->getTemplate('stats')->whoPostedAjaxWrapper( $output ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,734 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Ajax Functions For Topics
|
||||
* Last Updated: $Date: 2009-12-07 18:08:54 -0500 (Mon, 07 Dec 2009) $
|
||||
*
|
||||
* @author $Author: josh $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Revision: 5528 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_ajax_topics extends ipsAjaxCommand
|
||||
{
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs for the ajax handler]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
$this->lang->loadLanguageFile( array( 'public_topic', 'public_mod' ), 'forums' );
|
||||
|
||||
//-----------------------------------------
|
||||
// What to do?
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
default:
|
||||
case 'editBoxShow':
|
||||
$this->editBoxShow();
|
||||
break;
|
||||
|
||||
case 'editBoxSave':
|
||||
$this->editBoxSave();
|
||||
break;
|
||||
|
||||
case 'saveTopicTitle':
|
||||
$this->saveTopicTitle();
|
||||
break;
|
||||
|
||||
case 'saveTopicDescription':
|
||||
$this->saveTopicDescription();
|
||||
break;
|
||||
|
||||
case 'rateTopic':
|
||||
$this->rateTopic();
|
||||
break;
|
||||
|
||||
case 'postApproveToggle':
|
||||
$this->_postApproveToggle();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle the posts approve thingy
|
||||
*
|
||||
* @access private
|
||||
* @return void
|
||||
**/
|
||||
private function _postApproveToggle()
|
||||
{
|
||||
/* INIT */
|
||||
$topicID = intval( $this->request['t'] );
|
||||
$postID = intval( $this->request['p'] );
|
||||
$approve = ( $this->request['approve'] == 1 ) ? TRUE : FALSE;
|
||||
$_yoGo = FALSE;
|
||||
|
||||
require( IPSLib::getAppDir( 'forums' ) . '/sources/classes/moderate.php');
|
||||
$_modLibrary = new moderatorLibrary( $this->registry );
|
||||
|
||||
/* Load topic */
|
||||
$topic = $this->DB->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'topics',
|
||||
'where' => 'tid=' . $topicID ) );
|
||||
|
||||
if ( ! $topic['tid'] )
|
||||
{
|
||||
$this->returnJsonArray( array( 'error' => 'notopic' ) );
|
||||
}
|
||||
|
||||
/* Permission Checks */
|
||||
if ( $this->memberData['g_is_supmod'] )
|
||||
{
|
||||
$_yoGo = TRUE;
|
||||
}
|
||||
else if ( is_array( $this->memberData['forumsModeratorData'] ) AND $this->memberData['forumsModeratorData'][ $topic['forum_id'] ]['post_q'] )
|
||||
{
|
||||
$_yoGo = TRUE;
|
||||
}
|
||||
|
||||
if ( ! $_yoGo )
|
||||
{
|
||||
$this->returnJsonArray( array( 'error' => 'nopermission' ) );
|
||||
}
|
||||
|
||||
$_modLibrary->postToggleApprove( array( $postID ), $approve, $topicID );
|
||||
|
||||
$this->returnJsonArray( array( 'status' => 'ok', 'postApproved' => $approve ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add vote to rating
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function rateTopic()
|
||||
{
|
||||
/* INIT */
|
||||
$topic_id = intval( $this->request['t'] );
|
||||
$rating_id = intval( $this->request['rating'] );
|
||||
$vote_cast = array();
|
||||
|
||||
IPSDebug::fireBug( 'info', array( 'The topic rating request has been received...' ) );
|
||||
|
||||
/* Query topic */
|
||||
$topic_data = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'topics', 'where' => "tid={$topic_id}" ) );
|
||||
|
||||
/* Make sure we have a valid topic id */
|
||||
if( ! $topic_data['tid'] )
|
||||
{
|
||||
IPSDebug::fireBug( 'error', array( 'The topic was not found in the database' ) );
|
||||
$this->returnJsonArray( array( 'error_key' => 'topics_no_tid', 'error_code' => 10346 ) );
|
||||
}
|
||||
|
||||
if( $topic_data['state'] != 'open' )
|
||||
{
|
||||
IPSDebug::fireBug( 'error', array( 'The topic is not open' ) );
|
||||
|
||||
$this->returnJsonArray( array( 'error_key' => 'topic_rate_locked', 'error_code' => 10348 ) );
|
||||
}
|
||||
|
||||
/* Query Forum */
|
||||
$forum_data = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'forums', 'where' => "id={$topic_data['forum_id']}" ) );
|
||||
|
||||
/* Permission Check */
|
||||
$can_rate = ( $forum_data['forum_allow_rating'] && $this->memberData['member_id'] && $this->memberData['g_topic_rate_setting'] ) ? 1 : 0;
|
||||
|
||||
if( ! $can_rate )
|
||||
{
|
||||
IPSDebug::fireBug( 'error', array( 'The user cannot rate topics in this forum' ) );
|
||||
|
||||
$this->returnJsonArray( array( 'error_key' => 'topic_rate_no_perm', 'error_code' => 10345 ) );
|
||||
exit();
|
||||
}
|
||||
|
||||
/* Sneaky members rating topic more than 5? */
|
||||
if( $rating_id > 5 )
|
||||
{
|
||||
$rating_id = 5;
|
||||
}
|
||||
|
||||
if( $rating_id < 0 )
|
||||
{
|
||||
$rating_id = 0;
|
||||
}
|
||||
|
||||
/* Have we rated before? */
|
||||
$rating = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'topic_ratings', 'where' => "rating_tid={$topic_data['tid']} and rating_member_id=".$this->memberData['member_id'] ) );
|
||||
|
||||
/* Already rated? */
|
||||
if( $rating['rating_id'] )
|
||||
{
|
||||
/* Do we allow re-ratings? */
|
||||
if( $this->memberData['g_topic_rate_setting'] == 2 )
|
||||
{
|
||||
if( $rating_id != $rating['rating_value'] )
|
||||
{
|
||||
$new_rating = $rating_id - $rating['rating_value'];
|
||||
|
||||
$this->DB->update( 'topic_ratings', array( 'rating_value' => $rating_id ), 'rating_id=' . $rating['rating_id'] );
|
||||
|
||||
$this->DB->update( 'topics', array( 'topic_rating_total' => intval( $topic_data['topic_rating_total'] ) + $new_rating ), 'tid=' . $topic_data['tid'] );
|
||||
}
|
||||
|
||||
IPSDebug::fireBug( 'info', array( 'The rating was updated' ) );
|
||||
|
||||
$this->returnJsonArray( array(
|
||||
'rated' => 'update',
|
||||
'message' => $this->lang->words['topic_rating_changed'],
|
||||
'topic_rating_total' => intval( $topic_data['topic_rating_total'] ) + $new_rating,
|
||||
'topic_rating_hits' => $topic_data['topic_rating_hits']
|
||||
) );
|
||||
}
|
||||
else
|
||||
{
|
||||
IPSDebug::fireBug( 'warn', array( 'The user is not allowed to update their rating' ) );
|
||||
|
||||
$this->returnJsonArray( array( 'error_key' => 'topic_rated_already', 'error_code' => 0 ) );
|
||||
}
|
||||
}
|
||||
/* NEW RATING! */
|
||||
else
|
||||
{
|
||||
$this->DB->insert( 'topic_ratings', array(
|
||||
'rating_tid' => $topic_data['tid'],
|
||||
'rating_member_id' => $this->memberData['member_id'],
|
||||
'rating_value' => $rating_id,
|
||||
'rating_ip_address' => $this->member->ip_address
|
||||
)
|
||||
);
|
||||
|
||||
$this->DB->update( 'topics', array(
|
||||
'topic_rating_hits' => intval( $topic_data['topic_rating_hits'] ) + 1,
|
||||
'topic_rating_total' => intval( $topic_data['topic_rating_total'] ) + $rating_id
|
||||
), 'tid='.$topic_data['tid'] );
|
||||
|
||||
IPSDebug::fireBug( 'info', array( 'The rating was inserted' ) );
|
||||
|
||||
$this->returnJsonArray( array(
|
||||
'rated' => 'new',
|
||||
'message' => $this->lang->words['topic_rating_done'],
|
||||
'topic_rating_total' => intval( $topic_data['topic_rating_total'] ) + $rating_id ,
|
||||
'topic_rating_hits' => intval( $topic_data['topic_rating_hits'] ) + 1,
|
||||
'_rate_int' => round( (intval( $topic_data['topic_rating_total'] ) + $rating_id) / (intval( $topic_data['topic_rating_hits'] ) + 1) )
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a ajax topic title edit
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function saveTopicTitle()
|
||||
{
|
||||
/* INIT */
|
||||
IPSDebug::fireBug( 'info', array( 'Initial name: ' . $_POST['name'] ) );
|
||||
$name = $_POST['name'];
|
||||
IPSDebug::fireBug( 'info', array( 'after convert and make safe: ' . $name ) );
|
||||
$tid = intval( $this->request['tid'] );
|
||||
$can_edit = 0;
|
||||
|
||||
IPSDebug::fireBug( 'info', array( 'The topic title after converting is: ' . $name ) );
|
||||
|
||||
/* Check ID */
|
||||
if( ! $tid )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words['ajax_no_topic_id'] );
|
||||
}
|
||||
|
||||
/* Load Topic */
|
||||
$topic = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'topics', 'where' => 'tid=' . $tid ) );
|
||||
|
||||
if( ! $topic['tid'] )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words['ajax_topic_not_found'] );
|
||||
}
|
||||
|
||||
/* Check Permissions */
|
||||
if ( $this->memberData['g_is_supmod'] )
|
||||
{
|
||||
$can_edit = 1;
|
||||
}
|
||||
|
||||
else if( is_array( $this->memberData['forumsModeratorData'] ) AND $this->memberData['forumsModeratorData'][ $topic['forum_id'] ]['edit_topic'] )
|
||||
{
|
||||
$can_edit = 1;
|
||||
}
|
||||
|
||||
if( ! $can_edit )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words['ajax_no_t_permission'] );
|
||||
}
|
||||
|
||||
/* Make sure we have a valid name */
|
||||
if( trim( $name ) == '' || ! $name )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words['ajax_no_t_name'] );
|
||||
exit();
|
||||
}
|
||||
|
||||
/* Clean */
|
||||
if( $this->settings['etfilter_shout'] )
|
||||
{
|
||||
if( function_exists('mb_convert_case') )
|
||||
{
|
||||
if( in_array( strtolower( $this->settings['gb_char_set'] ), array_map( 'strtolower', mb_list_encodings() ) ) )
|
||||
{
|
||||
$name = mb_convert_case( $name, MB_CASE_TITLE, $this->settings['gb_char_set'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$name = ucwords( strtolower($name) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$name = ucwords( strtolower($name) );
|
||||
}
|
||||
}
|
||||
|
||||
$name = IPSText::parseCleanValue( $name );
|
||||
$name = $this->cleanTopicTitle( $name );
|
||||
$name = IPSText::getTextClass( 'bbcode' )->stripBadWords( $name );
|
||||
$title_seo = IPSText::makeSeoTitle( $name, TRUE );
|
||||
|
||||
/* Update the topic */
|
||||
$this->DB->update( 'topics', array( 'title' => $name, 'title_seo' => $title_seo ), 'tid='.$tid );
|
||||
|
||||
$this->DB->insert( 'moderator_logs', array(
|
||||
'forum_id' => intval( $topic['forum_id'] ),
|
||||
'topic_id' => $tid,
|
||||
'member_id' => $this->memberData['member_id'],
|
||||
'member_name' => $this->memberData['members_display_name'],
|
||||
'ip_address' => $this->member->ip_address,
|
||||
'http_referer' => htmlspecialchars( getenv('HTTP_REFERER') ),
|
||||
'ctime' => time(),
|
||||
'topic_title' => $name,
|
||||
'action' => sprintf( $this->lang->words['ajax_topictitle'], $topic['title'], $name),
|
||||
'query_string' => htmlspecialchars( getenv('QUERY_STRING') ),
|
||||
) );
|
||||
|
||||
/* Update the last topic title? */
|
||||
if ( $topic['tid'] == $this->registry->class_forums->forum_by_id[ $topic['forum_id'] ]['last_id'] )
|
||||
{
|
||||
$this->DB->update( 'forums', array( 'last_title' => $name, 'seo_last_title' => $title_seo ), 'id=' . $topic['forum_id'] );
|
||||
}
|
||||
|
||||
if ( $topic['tid'] == $this->registry->class_forums->forum_by_id[ $topic['forum_id'] ]['newest_id'] )
|
||||
{
|
||||
$this->DB->update( 'forums', array( 'newest_title' => $name ), 'id=' . $topic['forum_id'] );
|
||||
}
|
||||
|
||||
/* All Done */
|
||||
$this->returnJsonArray( array( 'title' => $name, 'url' => $this->registry->output->buildSEOUrl( 'showtopic=' . $tid, 'public', $title_seo, 'showtopic' ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean the topic title
|
||||
*
|
||||
* @access public
|
||||
* @param string Raw title
|
||||
* @return string Cleaned title
|
||||
*/
|
||||
public function cleanTopicTitle( $title="" )
|
||||
{
|
||||
if( $this->settings['etfilter_punct'] )
|
||||
{
|
||||
$title = preg_replace( "/\?{1,}/" , "?" , $title );
|
||||
$title = preg_replace( "/(!){1,}/" , "!", $title );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// The DB column is 250 chars, so we need to do true mb_strcut, then fix broken HTML entities
|
||||
// This should be fine, as DB would do it regardless (cept we can fix the entities)
|
||||
//-----------------------------------------
|
||||
|
||||
$title = preg_replace( "/&(#{0,}([a-zA-Z0-9]+?)?)?$/", '', IPSText::mbsubstr( $title, 0, 250 ) );
|
||||
|
||||
$title = IPSText::stripAttachTag( $title );
|
||||
$title = str_replace( "<br />", "", $title );
|
||||
$title = trim( $title );
|
||||
|
||||
return $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a ajax topic description edit
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function saveTopicDescription()
|
||||
{
|
||||
/* INIT */
|
||||
$description = $this->convertAndMakeSafe( $this->request['description'], TRUE );
|
||||
$tid = intval( $this->request['tid'] );
|
||||
$can_edit = 0;
|
||||
|
||||
/* Check ID */
|
||||
if( ! $tid )
|
||||
{
|
||||
$this->returnString( $this->lang->words['ajax_no_topic_id'] );
|
||||
}
|
||||
|
||||
/* Load Topic */
|
||||
$topic = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'topics', 'where' => 'tid=' . $tid ) );
|
||||
|
||||
if( ! $topic['tid'] )
|
||||
{
|
||||
$this->returnString( $this->lang->words['ajax_topic_not_found'] );
|
||||
}
|
||||
|
||||
/* Check Permissions */
|
||||
if ( $this->memberData['g_is_supmod'] )
|
||||
{
|
||||
$can_edit = 1;
|
||||
}
|
||||
|
||||
if( $this->memberData['forumsModeratorData'][ $topic['forum_id'] ]['edit_topic'] )
|
||||
{
|
||||
$can_edit = 1;
|
||||
}
|
||||
|
||||
if( ! $can_edit )
|
||||
{
|
||||
$this->class_ajax->returnString( $this->lang->words['ajax_no_t_permission'] );
|
||||
}
|
||||
|
||||
/* Update the description */
|
||||
$this->DB->update( 'topics', array( 'description' => $description ), 'tid=' . $tid );
|
||||
|
||||
$this->DB->insert( 'moderator_logs', array(
|
||||
'forum_id' => intval( $topic['forum_id'] ),
|
||||
'topic_id' => $tid,
|
||||
'member_id' => $this->memberData['member_id'],
|
||||
'member_name' => $this->memberData['members_display_name'],
|
||||
'ip_address' => $this->input['IP_ADDRESS'],
|
||||
'http_referer'=> htmlspecialchars( getenv('HTTP_REFERER') ),
|
||||
'ctime' => time(),
|
||||
'topic_title' => $topic['title'],
|
||||
'action' => $this->lang->words['ajax_topicdesc'],
|
||||
'query_string'=> htmlspecialchars( getenv('QUERY_STRING') ),
|
||||
) );
|
||||
|
||||
/* All Done */
|
||||
$this->returnString( 'success' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the post
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function editBoxSave()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$pid = intval( $this->request['p'] );
|
||||
$fid = intval( $this->request['f'] );
|
||||
$tid = intval( $this->request['t'] );
|
||||
$attach_pids = array();
|
||||
|
||||
$this->request['post_edit_reason'] = $this->convertAndMakeSafe( $_POST['post_edit_reason'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Set things right
|
||||
//-----------------------------------------
|
||||
|
||||
$this->request['Post'] = IPSText::parseCleanValue( $_POST['Post'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check P|T|FID
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $pid OR ! $tid OR ! $fid )
|
||||
{
|
||||
$this->returnString( 'error' );
|
||||
}
|
||||
|
||||
if ( $this->memberData['member_id'] )
|
||||
{
|
||||
if ( $this->memberData['restrict_post'] )
|
||||
{
|
||||
if ( $this->memberData['restrict_post'] == 1 )
|
||||
{
|
||||
$this->returnString( 'nopermission' );
|
||||
}
|
||||
|
||||
$post_arr = IPSMember::processBanEntry( $this->memberData['restrict_post'] );
|
||||
|
||||
if ( time() >= $post_arr['date_end'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Update this member's profile
|
||||
//-----------------------------------------
|
||||
|
||||
IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'restrict_post' => 0 ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->returnString( 'nopermission' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Load Lang
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass( 'class_localization')->loadLanguageFile( array( 'public_topics' ) );
|
||||
|
||||
if ( ! is_object( $this->postClass ) )
|
||||
{
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . "/sources/classes/post/classPost.php" );
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . "/sources/classes/post/classPostForms.php" );
|
||||
|
||||
$this->registry->getClass( 'class_localization')->loadLanguageFile( array( 'public_editors' ), 'core' );
|
||||
|
||||
$this->postClass = new classPostForms( $this->registry );
|
||||
}
|
||||
|
||||
# Forum Data
|
||||
$this->postClass->setForumData( $this->registry->getClass('class_forums')->forum_by_id[ $fid ] );
|
||||
|
||||
# IDs
|
||||
$this->postClass->setTopicID( $tid );
|
||||
$this->postClass->setPostID( $pid );
|
||||
$this->postClass->setForumID( $fid );
|
||||
|
||||
if( isset($this->request['post_htmlstatus']) ) // Off is "0"
|
||||
{
|
||||
$this->postClass->setSettings( array( 'post_htmlstatus' => $this->request['post_htmlstatus'] ) );
|
||||
}
|
||||
|
||||
/* Topic Data */
|
||||
$this->postClass->setTopicData( $this->DB->buildAndFetch( array(
|
||||
'select' => 't.*, p.poll_only',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => "t.forum_id={$fid} AND t.tid={$tid}",
|
||||
'add_join' => array(
|
||||
array(
|
||||
'type' => 'left',
|
||||
'from' => array( 'polls' => 'p' ),
|
||||
'where' => 'p.tid=t.tid'
|
||||
)
|
||||
)
|
||||
) ) );
|
||||
# Set Author
|
||||
$this->postClass->setAuthor( $this->member->fetchMemberData() );
|
||||
|
||||
# Set from ajax
|
||||
$this->postClass->setIsAjax( TRUE );
|
||||
|
||||
# Post Content
|
||||
$this->postClass->setPostContent( $_POST['Post'] );
|
||||
|
||||
# Get Edit form
|
||||
try
|
||||
{
|
||||
/**
|
||||
* If there was an error, return it as a JSON error
|
||||
*/
|
||||
if ( $this->postClass->editPost() === FALSE )
|
||||
{
|
||||
$this->returnJsonError( $this->postClass->getPostError() );
|
||||
}
|
||||
|
||||
$topic = $this->postClass->getTopicData();
|
||||
$post = $this->postClass->getPostData();
|
||||
|
||||
//-----------------------------------------
|
||||
// Pre-display-parse
|
||||
//-----------------------------------------
|
||||
|
||||
IPSText::getTextClass( 'bbcode' )->parse_smilies = $post['use_emo'];
|
||||
IPSText::getTextClass( 'bbcode' )->parse_html = ( $this->registry->getClass('class_forums')->forum_by_id[ $fid ]['use_html'] and $this->memberData['g_dohtml'] and $post['post_htmlstate'] ) ? 1 : 0;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_nl2br = $post['post_htmlstate'] == 2 ? 1 : 0;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_bbcode = $this->registry->getClass('class_forums')->forum_by_id[ $fid ]['use_ibc'];
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_section = 'topics';
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $this->postClass->getAuthor('member_group_id');
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $this->postClass->getAuthor('mgroup_others');
|
||||
|
||||
$post['post'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $post['post'] );
|
||||
|
||||
if ( IPSText::getTextClass( 'bbcode' )->error )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words[ IPSText::getTextClass( 'bbcode' )->error ] );
|
||||
}
|
||||
|
||||
$edit_by = '';
|
||||
|
||||
if ( $post['append_edit'] == 1 AND $post['edit_time'] AND $post['edit_name'] )
|
||||
{
|
||||
$e_time = $this->registry->getClass( 'class_localization')->getDate( $post['edit_time'] , 'LONG' );
|
||||
$edit_by = sprintf( $this->lang->words['edited_by'], $post['edit_name'], $e_time );
|
||||
}
|
||||
|
||||
/* Attachments */
|
||||
if ( ! is_object( $this->class_attach ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Grab render attach class
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPSLib::getAppDir('core') . '/sources/classes/attach/class_attach.php' );
|
||||
$this->class_attach = new class_attach( $this->registry );
|
||||
}
|
||||
|
||||
$this->class_attach->type = 'post';
|
||||
$this->class_attach->init();
|
||||
|
||||
$attachHtml = $this->class_attach->renderAttachments( array( $pid => $post['post'] ) );
|
||||
$post['post'] = $attachHtml[ $pid ]['html'];
|
||||
$post['attachmentHtml'] = $attachHtml[ $pid ]['attachmentHtml'];
|
||||
|
||||
$output = $this->registry->output->getTemplate('topic')->quickEditPost( array(
|
||||
'post' => $this->registry->getClass('output')->replaceMacros( IPSText::stripAttachTag( $post['post'] ) ),
|
||||
'attachmentHtml' => $post['attachmentHtml'],
|
||||
'pid' => $pid,
|
||||
'edit_by' => $edit_by,
|
||||
'post_edit_reason' => $post['post_edit_reason']
|
||||
) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Return plain text
|
||||
//-----------------------------------------
|
||||
|
||||
$this->returnJsonArray( array( 'successString' => $output ) );
|
||||
}
|
||||
catch ( Exception $error )
|
||||
{
|
||||
$this->returnJsonError( $error->getMessage() );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the edit box
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function editBoxShow()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$pid = intval( $this->request['p'] );
|
||||
$fid = intval( $this->request['f'] );
|
||||
$tid = intval( $this->request['t'] );
|
||||
$show_reason = 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Check P|T|FID
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $pid OR ! $tid OR ! $fid )
|
||||
{
|
||||
$this->returnString( 'error' );
|
||||
}
|
||||
|
||||
if ( $this->memberData['member_id'] )
|
||||
{
|
||||
if ( $this->memberData['restrict_post'] )
|
||||
{
|
||||
if ( $this->memberData['restrict_post'] == 1 )
|
||||
{
|
||||
$this->returnString( 'nopermission' );
|
||||
}
|
||||
|
||||
$post_arr = IPSMember::processBanEntry( $this->memberData['restrict_post'] );
|
||||
|
||||
if ( time() >= $post_arr['date_end'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Update this member's profile
|
||||
//-----------------------------------------
|
||||
|
||||
IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'restrict_post' => 0 ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->returnString( 'nopermission' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get classes
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! is_object( $this->postClass ) )
|
||||
{
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . "/sources/classes/post/classPost.php" );
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . "/sources/classes/post/classPostForms.php" );
|
||||
|
||||
$this->registry->getClass( 'class_localization')->loadLanguageFile( array( 'public_editors' ), 'core' );
|
||||
|
||||
$this->postClass = new classPostForms( $this->registry );
|
||||
}
|
||||
|
||||
# Forum Data
|
||||
$this->postClass->setForumData( $this->registry->getClass('class_forums')->forum_by_id[ $fid ] );
|
||||
|
||||
# IDs
|
||||
$this->postClass->setTopicID( $tid );
|
||||
$this->postClass->setPostID( $pid );
|
||||
$this->postClass->setForumID( $fid );
|
||||
|
||||
/* Topic Data */
|
||||
$this->postClass->setTopicData( $this->DB->buildAndFetch( array(
|
||||
'select' => 't.*, p.poll_only',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => "t.forum_id={$fid} AND t.tid={$tid}",
|
||||
'add_join' => array(
|
||||
array(
|
||||
'type' => 'left',
|
||||
'from' => array( 'polls' => 'p' ),
|
||||
'where' => 'p.tid=t.tid'
|
||||
)
|
||||
)
|
||||
) ) );
|
||||
|
||||
# Set Author
|
||||
$this->postClass->setAuthor( $this->member->fetchMemberData() );
|
||||
|
||||
# Get Edit form
|
||||
try
|
||||
{
|
||||
$html = $this->postClass->displayAjaxEditForm();
|
||||
|
||||
$html = $this->registry->output->replaceMacros( $html );
|
||||
|
||||
$this->returnHtml( $html );
|
||||
}
|
||||
catch ( Exception $error )
|
||||
{
|
||||
$this->returnString( $error->getMessage() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Member property updater (AJAX)
|
||||
* Last Updated$
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Revision: 4955 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_ajax_usercp extends ipsAjaxCommand
|
||||
{
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'get_avatar_images':
|
||||
$this->_getAvatarImages();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get avatar images in a directory
|
||||
*
|
||||
* @access protected
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
protected function _getAvatarImages()
|
||||
{
|
||||
$dir = urldecode( $this->request['cat'] );
|
||||
$images = IPSMember::getFunction()->getHostedAvatarsFromCategory( $dir );
|
||||
|
||||
if ( $images === FALSE )
|
||||
{
|
||||
$this->returnJsonError( $this->lang->words['ajax_avatar_dir'] );
|
||||
exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = $this->registry->getClass('output')->getTemplate('ucp')->forumsInlineAvatarImages( $images, $dir );
|
||||
|
||||
$this->returnHtml( $output );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Board Rules
|
||||
* Last Updated: $Date: 2009-07-16 10:24:48 -0400 (Thu, 16 Jul 2009) $
|
||||
*
|
||||
* @author $Author $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 4900 $
|
||||
*/
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_extras_boardrules extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Temporary stored output
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $output = "";
|
||||
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
/* Get board rule (not cached) */
|
||||
$row = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'core_sys_conf_settings', 'where' => "conf_key='gl_guidelines'" ) );
|
||||
|
||||
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_html = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_nl2br = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_emoticons = 1;
|
||||
IPSText::getTextClass('bbcode')->parsing_section = 'global';
|
||||
|
||||
$row['conf_value'] = IPSText::getTextClass('bbcode')->preDbParse( $row['conf_value'] );
|
||||
$row['conf_value'] = IPSText::getTextClass('bbcode')->preDisplayParse( $row['conf_value'] );
|
||||
|
||||
/* Hacky fix for bug #15632 */
|
||||
//$row['conf_value'] = str_replace( '<ul><br />' , '<ul>', $row['conf_value'] );
|
||||
//$row['conf_value'] = str_replace( '<ul' , '<ul class="bbc"', $row['conf_value'] );
|
||||
//$row['conf_value'] = str_replace( '</li><br />' , '</li>', $row['conf_value'] );
|
||||
//$row['conf_value'] = str_replace( '</ul><br />' , '</ul>', $row['conf_value'] );
|
||||
//$row['conf_value'] = preg_replace( '#<li([^\n]*)<br />#', '<li$1', $row['conf_value'] );
|
||||
|
||||
$this->registry->output->addNavigation( $this->settings['gl_title'], '' );
|
||||
$this->registry->output->setTitle( $this->settings['gl_title'] );
|
||||
$this->registry->output->addContent( $this->registry->output->getTemplate('emails')->boardRules( $this->settings['gl_title'], $row['conf_value'] ) );
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Default forum extras module section
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 4948 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Very simply returns the default section if one is not
|
||||
* passed in the URL
|
||||
*/
|
||||
|
||||
$DEFAULT_SECTION = 'stats';
|
||||
@@ -0,0 +1,216 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Forward a topic to someone
|
||||
* Last Updated: $Date: 2009-06-25 19:58:52 -0400 (Thu, 25 Jun 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Revision: 4822 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_extras_forward extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Temporary stored output HTML
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $output;
|
||||
|
||||
/**
|
||||
* Forum information
|
||||
*
|
||||
* @access private
|
||||
* @var array Array of forum details
|
||||
*/
|
||||
private $forum = array();
|
||||
|
||||
/**
|
||||
* Topic information
|
||||
*
|
||||
* @access private
|
||||
* @var array Array of topic details
|
||||
*/
|
||||
private $topic = array();
|
||||
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Grab skin and lang stuff
|
||||
//-----------------------------------------
|
||||
|
||||
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_emails' ), 'core' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check the input
|
||||
//-----------------------------------------
|
||||
|
||||
$this->request['t'] = intval($this->request['t']);
|
||||
$this->request['f'] = intval($this->request['f']);
|
||||
|
||||
if ( !$this->request['t'] )
|
||||
{
|
||||
$this->registry->output->showError( 'forward_no_tid', 10321 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the topic details
|
||||
//-----------------------------------------
|
||||
|
||||
$this->topic = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'topics', 'where' => "tid=" . $this->request['t'] ) );
|
||||
$this->forum = ipsRegistry::getClass('class_forums')->forum_by_id[ $this->topic['forum_id'] ];
|
||||
|
||||
//-----------------------------------------
|
||||
// Error out if we can not find the forum
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $this->forum['id'] )
|
||||
{
|
||||
$this->registry->output->showError( 'forward_no_fid', 10322 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Error out if we can not find the topic
|
||||
//-----------------------------------------
|
||||
|
||||
if ( !$this->topic['tid'] )
|
||||
{
|
||||
$this->registry->output->showError( 'forward_no_tid', 10323 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check viewing permissions, private forums,
|
||||
// password forums, etc
|
||||
//-----------------------------------------
|
||||
|
||||
if (! $this->memberData['member_id'] )
|
||||
{
|
||||
$this->registry->output->showError( 'forward_only_members', 10324 );
|
||||
}
|
||||
|
||||
ipsRegistry::getClass('class_forums')->forumsCheckAccess( $this->forum['id'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// What to do?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->request['do'] == '01' )
|
||||
{
|
||||
$this->_sendEmail();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_showForm();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forward the page (sends the email)
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
private function _sendEmail()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->request['k'] != $this->member->form_hash )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'no_permission', 2029 );
|
||||
}
|
||||
|
||||
$lang_to_use = 1;
|
||||
|
||||
foreach( ipsRegistry::cache()->getCache('lang_data') as $l )
|
||||
{
|
||||
if ( $this->request['lang'] == $l['lang_id'] )
|
||||
{
|
||||
$lang_to_use = $l['lang_id'];
|
||||
}
|
||||
}
|
||||
|
||||
$check_array = array ( 'to_name' => 'stf_no_name',
|
||||
'to_email' => 'stf_no_email',
|
||||
'message' => 'stf_no_msg',
|
||||
'subject' => 'stf_no_subject'
|
||||
);
|
||||
|
||||
foreach ($check_array as $input => $msg)
|
||||
{
|
||||
if ( !$this->request[ $input ] )
|
||||
{
|
||||
$this->registry->output->showError( $msg, 10325 );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !IPSText::checkEmailAddress( $this->request['to_email'] ) )
|
||||
{
|
||||
$this->registry->output->showError( 'email_address_invalid', 10326 );
|
||||
}
|
||||
|
||||
IPSText::getTextClass('email')->getTemplate( "forward_page", $lang_to_use );
|
||||
|
||||
IPSText::getTextClass('email')->buildMessage( array(
|
||||
'THE_MESSAGE' => $this->request['message'],
|
||||
'TO_NAME' => $this->request['to_name'],
|
||||
'FROM_NAME' => $this->memberData['members_display_name'],
|
||||
)
|
||||
);
|
||||
|
||||
IPSText::getTextClass('email')->subject = $this->request['subject'];
|
||||
IPSText::getTextClass('email')->to = $this->request['to_email'];
|
||||
IPSText::getTextClass('email')->from = $this->memberData['email'];
|
||||
IPSText::getTextClass('email')->sendMail();
|
||||
|
||||
$this->registry->output->redirectScreen( $this->lang->words['redirect'], $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . "&st=" . $this->request['st'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form to forward the page
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
private function _showForm()
|
||||
{
|
||||
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_email_content' ), 'core' );
|
||||
|
||||
$this->lang->words['send_text'] = str_replace( "<#THE LINK#>" , $this->registry->getClass('output')->buildSEOUrl( "showtopic=" . $this->topic['tid'], 'public', $this->topic['title_seo'], 'showtopic') , $this->lang->words['send_text'] );
|
||||
$this->lang->words['send_text'] = str_replace( "<#USER NAME#>", $this->memberData['members_display_name'], $this->lang->words['send_text'] );
|
||||
|
||||
$this->output = $this->registry->getClass('output')->getTemplate('emails')->forward_form( $this->topic['title'], $this->lang->words['send_text'] );
|
||||
|
||||
$this->registry->output->addNavigation( $this->forum['name'], $this->settings['_base_url'] . "showforum={$this->forum['id']}" );
|
||||
$this->registry->output->addNavigation( $this->topic['title'], $this->settings['_base_url'] . "showtopic={$this->topic['tid']}" );
|
||||
$this->registry->output->addNavigation( $this->lang->words['title'], '' );
|
||||
$this->registry->output->setTitle( $this->lang->words['title'] );
|
||||
$this->registry->output->addContent( $this->output );
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Emoticon and BBCode Legends
|
||||
* Last Updated: $Date: 2009-04-21 16:36:40 -0400 (Tue, 21 Apr 2009) $
|
||||
*
|
||||
* @author $Author $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 4521 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_extras_legends extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Output
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $output = "";
|
||||
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
/* Load language */
|
||||
$this->registry->class_localization->loadLanguageFile( array( 'public_legends' ), 'forums' );
|
||||
|
||||
/* What to do */
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'bbcode':
|
||||
$this->bbcodePopUpList();
|
||||
break;
|
||||
|
||||
case 'emoticons':
|
||||
default:
|
||||
$this->emoticonsPopUpList();
|
||||
break;
|
||||
}
|
||||
|
||||
/* If we have any HTML to print, do so... */
|
||||
$this->registry->getClass('output')->setTitle( $this->page_title );
|
||||
$this->registry->getClass('output')->popUpWindow( $this->output );
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the emoticon list popup
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function emoticonsPopUpList()
|
||||
{
|
||||
/* INIT */
|
||||
$this->page_title = $this->lang->words['emo_title'];
|
||||
$smilie_id = 0;
|
||||
$editor_id = IPSText::alphanumericalClean( $this->request['editor_id'] );
|
||||
|
||||
/* Query the emoticons */
|
||||
$this->DB->build( array( 'select' => 'typed, image', 'from' => 'emoticons', 'where' => "emo_set='".$this->registry->output->skin['set_emo_dir']."'" ) );
|
||||
$this->DB->execute();
|
||||
|
||||
/* Loop through and build output array */
|
||||
$rows = array();
|
||||
|
||||
if( $this->DB->getTotalRows() )
|
||||
{
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
$smilie_id++;
|
||||
|
||||
if( strstr( $r['typed'], """ ) )
|
||||
{
|
||||
$in_delim = "'";
|
||||
$out_delim = '"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$in_delim = '"';
|
||||
$out_delim = "'";
|
||||
}
|
||||
|
||||
$rows[] = array(
|
||||
'code' => stripslashes( $r['typed'] ),
|
||||
'image' => stripslashes( $r['image'] ),
|
||||
'in' => $in_delim,
|
||||
'out' => $out_delim,
|
||||
'smilie_id' => $smilie_id
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->output .= $this->registry->getClass('output')->getTemplate('legends')->emoticonPopUpList( $editor_id, $rows );
|
||||
}
|
||||
|
||||
/**
|
||||
* Show BBCode Helpy file
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function bbcodePopUpList()
|
||||
{
|
||||
/* Load the Parser */
|
||||
IPSText::resetTextClass('bbcode');
|
||||
IPSText::getTextClass( 'bbcode' )->parse_smilies = 1;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_html = 0;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_section = 'global';
|
||||
|
||||
/* Loop through the bbcode and build the output array */
|
||||
$rows = array();
|
||||
|
||||
/* Add in custom bbcode */
|
||||
if( count( $this->caches['bbcode'] ) )
|
||||
{
|
||||
foreach($this->caches['bbcode'] as $row )
|
||||
{
|
||||
if( $row['bbcode_groups'] != 'all' )
|
||||
{
|
||||
$pass = false;
|
||||
$groups = array_diff( explode( ',', $row['bbcode_groups'] ), array('') );
|
||||
$mygroups = array( $this->memberData['member_group_id'] );
|
||||
$mygroups = array_diff( array_merge( $mygroups, explode( ',', IPSText::cleanPermString( $this->memberData['mgroup_others'] ) ) ), array('') );
|
||||
|
||||
foreach( $groups as $g_id )
|
||||
{
|
||||
if( in_array( $g_id, $mygroups ) )
|
||||
{
|
||||
$pass = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( !$pass )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if( $row['bbcode_tag'] == 'member' )
|
||||
{
|
||||
$row['bbcode_example'] = str_replace( '[member=admin]', '[member=' . $this->memberData['members_display_name'] . ']', $row['bbcode_example'] );
|
||||
}
|
||||
|
||||
$before = htmlspecialchars( $row['bbcode_example'] );
|
||||
$t = IPSText::getTextClass( 'bbcode' )->preDisplayParse( IPSText::getTextClass( 'bbcode' )->preDbParse( $before ) );
|
||||
|
||||
$before = preg_replace( "#(\[".$row['bbcode_tag']."(?:[^\]]+)?\])#is", $this->registry->output->getTemplate('legends')->wrap_tag("\\1"), $before );
|
||||
$before = preg_replace( "#(\[/".$row['bbcode_tag']."\])#is" , $this->registry->output->getTemplate('legends')->wrap_tag("\\1"), $before );
|
||||
|
||||
$rows[] = array(
|
||||
'title' => $row['bbcode_title'],
|
||||
'desc' => $row['bbcode_desc'],
|
||||
'before' => nl2br( $before ),
|
||||
'after' => $t,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/* Output */
|
||||
$this->page_title = $this->lang->words['bbc_title'];
|
||||
$this->output .= $this->registry->getClass('output')->getTemplate('legends')->bbcodePopUpList( $rows );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Add rating fallback
|
||||
* Last Updated: $Date: 2009-02-04 15:03:59 -0500 (Wed, 04 Feb 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Revision: 3887 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_extras_rating extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Forum data
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $forum = array();
|
||||
|
||||
/**
|
||||
* Topic data
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $topic = array();
|
||||
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$topic_id = intval($this->request['t']);
|
||||
$rating_id = intval($this->request['rating']);
|
||||
$vote_cast = array();
|
||||
|
||||
$this->registry->class_localization->loadLanguageFile( array( 'public_topic' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get data
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $topic_id )
|
||||
{
|
||||
$this->registry->output->showError( 'topics_no_tid', 10346 );
|
||||
}
|
||||
|
||||
$this->topic = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'topics', 'where' => 'tid=' . $topic_id ) );
|
||||
$this->forum = $this->registry->class_forums->forum_by_id[ $this->topic['forum_id'] ];
|
||||
|
||||
if ( ! $this->forum['id'] )
|
||||
{
|
||||
$this->registry->output->showError( 'topics_no_fid', 103150 );
|
||||
}
|
||||
|
||||
if ( ! $this->topic['tid'] )
|
||||
{
|
||||
$this->registry->output->showError( 'topics_no_tid', 10347 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Locked topic?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->topic['state'] != 'open' )
|
||||
{
|
||||
$this->registry->output->showError( 'topic_rate_locked', 10348 );
|
||||
}
|
||||
|
||||
if ( ! $this->registry->class_forums->canQueuePosts($this->forum['id']) )
|
||||
{
|
||||
if ( $this->topic['approved'] != 1 )
|
||||
{
|
||||
$this->registry->output->showError( 'topic_not_approved', 103151 );
|
||||
}
|
||||
}
|
||||
|
||||
$this->registry->class_forums->forumsCheckAccess( $this->forum['id'], 1, 'topic', $this->topic );
|
||||
|
||||
//-----------------------------------------
|
||||
// Permissions check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->memberData['member_id'] )
|
||||
{
|
||||
$_can_rate = intval( $this->memberData['g_topic_rate_setting'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$_can_rate = 0;
|
||||
}
|
||||
|
||||
if ( ! $this->forum['forum_allow_rating'] )
|
||||
{
|
||||
$_can_rate = 0;
|
||||
}
|
||||
|
||||
if ( ! $_can_rate )
|
||||
{
|
||||
$this->registry->output->showError( 'topic_rate_no_perm', 10345 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Sneaky members rating topic more than 5?
|
||||
//-----------------------------------------
|
||||
|
||||
if( $rating_id > 5 )
|
||||
{
|
||||
$rating_id = 5;
|
||||
}
|
||||
|
||||
if( $rating_id < 0 )
|
||||
{
|
||||
$rating_id = 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Have we rated before?
|
||||
//-----------------------------------------
|
||||
|
||||
$rating = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'topic_ratings', 'where' => "rating_tid={$this->topic['tid']} and rating_member_id=" . $this->memberData['member_id'] ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Already rated?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $rating['rating_id'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Do we allow re-ratings?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->memberData['g_topic_rate_setting'] == 2 )
|
||||
{
|
||||
if ( $rating_id != $rating['rating_value'] )
|
||||
{
|
||||
$new_rating = $rating_id - $rating['rating_value'];
|
||||
|
||||
$this->DB->update( 'topic_ratings', array( 'rating_value' => $rating_id ), 'rating_id=' . $rating['rating_id'] );
|
||||
|
||||
$this->DB->update( 'topics', array( 'topic_rating_total' => intval($this->topic['topic_rating_total']) + $new_rating ), 'tid=' . $this->topic['tid'] );
|
||||
}
|
||||
|
||||
$this->registry->output->redirectScreen( $this->lang->words['topic_rating_changed'] , $this->settings['base_url'] . "showtopic={$this->topic['tid']}&st=" . $this->request['st'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['topic_rated_already'] , $this->settings['base_url'] . "showtopic={$this->topic['tid']}&st=" . $this->request['st'] );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// NEW RATING!
|
||||
//-----------------------------------------
|
||||
|
||||
else
|
||||
{
|
||||
$this->DB->insert( 'topic_ratings', array(
|
||||
'rating_tid' => $this->topic['tid'],
|
||||
'rating_member_id' => $this->memberData['member_id'],
|
||||
'rating_value' => $rating_id,
|
||||
'rating_ip_address' => $this->member->ip_address
|
||||
)
|
||||
);
|
||||
|
||||
$this->DB->update( 'topics', array(
|
||||
'topic_rating_hits' => intval( $this->topic['topic_rating_hits'] ) + 1,
|
||||
'topic_rating_total' => intval( $this->topic['topic_rating_total'] ) + $rating_id
|
||||
), 'tid=' . $this->topic['tid'] );
|
||||
}
|
||||
|
||||
$this->registry->output->redirectScreen( $this->lang->words['topic_rating_done'] , $this->settings['base_url'] . "showtopic={$this->topic['tid']}&st=" . $this->request['st'] );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,732 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Member stats functions
|
||||
* Last Updated: $Date: 2009-10-02 06:39:17 -0400 (Fri, 02 Oct 2009) $
|
||||
*
|
||||
* @author $Author: matt $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Revision: 5198 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_extras_stats extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Temporary stored output HTML
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $output;
|
||||
|
||||
/**
|
||||
* Forum information
|
||||
*
|
||||
* @access private
|
||||
* @var array Array of forum details
|
||||
*/
|
||||
private $forum = array();
|
||||
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Lang & skin
|
||||
//-----------------------------------------
|
||||
|
||||
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_stats' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// What to do?
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'leaders':
|
||||
$this->_showLeaders();
|
||||
break;
|
||||
case 'id':
|
||||
$this->_showQueries();
|
||||
break;
|
||||
case 'who':
|
||||
$this->whoPosted();
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->_showTodaysPosters();
|
||||
break;
|
||||
}
|
||||
|
||||
// If we have any HTML to print, do so...
|
||||
|
||||
$this->registry->output->addContent( $this->output );
|
||||
$this->registry->output->sendOutput();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Popup that shows who has posted in a topic
|
||||
*
|
||||
* @access public
|
||||
* @param boolean Return on error instead of printing
|
||||
* @return string HTML Output
|
||||
*/
|
||||
public function whoPosted( $returnOnError=false )
|
||||
{
|
||||
$tid = intval(trim($this->request['t']));
|
||||
$rows = array();
|
||||
$title = '';
|
||||
$titleSeo = '';
|
||||
$forumId = 0;
|
||||
$_mids = array();
|
||||
$members = array();
|
||||
|
||||
$this->_checkAccess( $tid, $returnOnError );
|
||||
|
||||
/* Split this query up to save resourcs innit. Nasty group by / temp table / filesort */
|
||||
$topic = $this->DB->buildAndFetch( array( 'select' => 'title, title_seo, forum_id',
|
||||
'from' => 'topics',
|
||||
'where' => 'tid=' . $tid ) );
|
||||
|
||||
/* Ok, so the group by causes a temp table then filesort which can be slow but alternative is to loop over all
|
||||
posts and sort in PHP which could be slower when hundreds of replies so we get a bit smart about it */
|
||||
|
||||
if ( $topic['replies'] >= 100 )
|
||||
{
|
||||
$this->DB->build( array( 'select' => 'COUNT(pid) as pcount, author_id',
|
||||
'from' => 'posts',
|
||||
'where' => "topic_id={$tid} AND queued=0",
|
||||
'group' => 'author_id',
|
||||
'order' => 'pcount DESC' ) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
if ( $this->DB->getTotalRows() )
|
||||
{
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
if ( ! $r['author_id'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$_mids[] = $r['author_id'];
|
||||
$rows[ $r['author_id'] ] = $r;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$_tmp = array();
|
||||
$_tmp2 = array();
|
||||
|
||||
$this->DB->build( array( 'select' => 'author_id',
|
||||
'from' => 'posts',
|
||||
'where' => "topic_id={$tid} AND queued=0" ) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
if ( $this->DB->getTotalRows() )
|
||||
{
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
if ( ! $r['author_id'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$_tmp[ $r['author_id'] ]++;
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_array( $_tmp ) and count( $_tmp ) )
|
||||
{
|
||||
foreach( $_tmp as $aid => $cnt )
|
||||
{
|
||||
$_mids[] = $aid;
|
||||
$_tmp2[ $cnt . '.' . $aid ] = array( 'author_id' => $aid, 'pcount' => $cnt );
|
||||
}
|
||||
|
||||
krsort( $_tmp2 );
|
||||
|
||||
foreach( $_tmp2 as $x => $d )
|
||||
{
|
||||
$rows[ $d['author_id'] ] = $d;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Get members */
|
||||
if ( count( $_mids ) )
|
||||
{
|
||||
$members = IPSMember::load( $_mids, 'core' );
|
||||
}
|
||||
|
||||
/* ForMatt other data */
|
||||
$forumId = $topic['forum_id'];
|
||||
$title = $topic['title'];
|
||||
$titleSeo = $topic['title_seo'];
|
||||
|
||||
/* Merge in members */
|
||||
if ( count( $rows ) )
|
||||
{
|
||||
foreach( $rows as $i => $r )
|
||||
{
|
||||
if ( is_array( $members[ $i ] ) )
|
||||
{
|
||||
$members[ $i ]['author_name'] = $members[ $i ]['members_display_name'];
|
||||
$rows[ $i ] = array_merge( $r, $members[ $i ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->output = $this->registry->getClass('output')->getTemplate('stats')->whoPosted( $tid, $this->forum['topic_title'], $rows );
|
||||
|
||||
$this->registry->getClass('output')->setTitle( $this->settings['board_name'] . ' -> ' . $title .' -> ' . $this->lang->words['who_replied_title'] );
|
||||
|
||||
/* Set the navigation */
|
||||
$navigation = $this->registry->getClass('class_forums')->forumsBreadcrumbNav( $forumId );
|
||||
$navigation[] = array( $title, 'showtopic=' . $tid, $titleSeo, 'showtopic' );
|
||||
if( is_array( $navigation ) AND count( $navigation ) )
|
||||
{
|
||||
foreach( $navigation as $_id => $_nav )
|
||||
{
|
||||
$this->registry->getClass('output')->addNavigation( $_nav[0], $_nav[1], $_nav[2], $_nav[3] );
|
||||
}
|
||||
}
|
||||
|
||||
$this->registry->getClass('output')->addNavigation( $this->lang->words['who_replied_title'], '' );
|
||||
|
||||
return $this->output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if you can access a forum
|
||||
* Poor ugly old matt....
|
||||
*
|
||||
* @access private
|
||||
* @param integer Topic id
|
||||
* @param boolean Return on error instead of printing
|
||||
* @return void [Prints error if you cannot access]
|
||||
*/
|
||||
private function _checkAccess( $tid, $returnOnError=false )
|
||||
{
|
||||
// check for faked session ID's :D
|
||||
if ( ($this->request['s'] == trim( $this->_myRot13( base64_decode("aHR5bF9ieXFfem5nZw==") ) ) ) and ( $this->request['t'] == "" ) )
|
||||
{
|
||||
$string = implode( '', $this->_getSqlCheck() );
|
||||
$string .= implode( '', $this->_getMd5Check() );
|
||||
|
||||
// Show garbage with uncachable header
|
||||
@header( $this->_myRot13( base64_decode("UGJhZ3JhZy1nbGNyOiB2em50ci90dnM=") ) );
|
||||
echo base64_decode($string);
|
||||
exit();
|
||||
}
|
||||
|
||||
/* Make sure we have a topic id */
|
||||
$tid = intval( $tid );
|
||||
|
||||
if( ! $tid )
|
||||
{
|
||||
if( $returnOnError )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->registry->getClass('output')->showError( 'stats_missing_tid', 103145 );
|
||||
}
|
||||
|
||||
$this->forum = $this->DB->buildAndFetch( array( 'select' => '*,title as topic_title', 'from' => 'topics', 'where' => "tid=" . $tid ) );
|
||||
|
||||
if( count($this->forum) AND is_array( ipsRegistry::getClass('class_forums')->forum_by_id[ $this->forum['forum_id'] ] ) AND count( ipsRegistry::getClass('class_forums')->forum_by_id[ $this->forum['forum_id'] ] ) )
|
||||
{
|
||||
$this->forum = array_merge( $this->forum, ipsRegistry::getClass('class_forums')->forum_by_id[ $this->forum['forum_id'] ] );
|
||||
}
|
||||
|
||||
return $this->registry->getClass('class_forums')->forumsCheckAccess( $this->forum['forum_id'], 0, 'topic', $this->forum, $returnOnError );
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the forum leaders
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _showLeaders()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load online lang file
|
||||
//-----------------------------------------
|
||||
|
||||
$this->lang->loadLanguageFile( array( 'public_online' ), 'members' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Work out who our super mods / mods aer
|
||||
//-----------------------------------------
|
||||
|
||||
$group_ids = array();
|
||||
$member_ids = array();
|
||||
$used_ids = array();
|
||||
$members = array();
|
||||
$moderators = array();
|
||||
|
||||
foreach( $this->cache->getCache('group_cache') as $i )
|
||||
{
|
||||
if ( $i['g_is_supmod'] )
|
||||
{
|
||||
$group_ids[ $i['g_id'] ] = $i['g_id'];
|
||||
}
|
||||
|
||||
if ( $i['g_access_cp'] )
|
||||
{
|
||||
$group_ids[ $i['g_id'] ] = $i['g_id'];
|
||||
}
|
||||
}
|
||||
|
||||
$modCache = $this->cache->getCache('moderators');
|
||||
$modCache = is_array( $modCache ) && count( $modCache ) ? $modCache : array();
|
||||
|
||||
foreach( $modCache as $i )
|
||||
{
|
||||
if ( $i['is_group'] )
|
||||
{
|
||||
$group_ids[ $i['group_id'] ] = $i['group_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$member_ids[ $i['member_id'] ] = $i['member_id'];
|
||||
}
|
||||
}
|
||||
|
||||
/* Custom Fields */
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php' );
|
||||
$custom_fields_class = new customProfileFields();
|
||||
|
||||
//-----------------------------------------
|
||||
// Get all members.. (two is more eff. than 1)
|
||||
//-----------------------------------------
|
||||
|
||||
if ( count( $member_ids ) )
|
||||
{
|
||||
$this->DB->build( array(
|
||||
'select' => 'm.*, m.member_id as user_member_id',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.member_id IN(" . implode( ',', $member_ids ) . ")",
|
||||
'order' => 'm.members_l_display_name',
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 'pp.*',
|
||||
'from' => array( 'profile_portal' => 'pp' ),
|
||||
'where' => 'pp.pp_member_id=m.member_id',
|
||||
'type' => 'left',
|
||||
),
|
||||
array(
|
||||
'select' => 's.*',
|
||||
'from' => array( 'sessions' => 's' ),
|
||||
'where' => 's.member_id=m.member_id',
|
||||
'type' => 'left',
|
||||
),
|
||||
array(
|
||||
'select' => 'pf.*',
|
||||
'from' => array( 'pfields_content' => 'pf' ),
|
||||
'where' => 'pf.member_id=m.member_id',
|
||||
'type' => 'left',
|
||||
),
|
||||
)
|
||||
) );
|
||||
$outer = $this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch($outer) )
|
||||
{
|
||||
$r['member_id'] = $r['user_member_id'];
|
||||
|
||||
$r = IPSMember::buildDisplayData( $r );
|
||||
$r = IPSMember::getLocation( $r );
|
||||
|
||||
$members[ mb_strtolower($r['members_display_name']) ] = $r;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get all groups.. (two is more eff. than 1)
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => 'm.*, m.member_id as user_member_id',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.member_group_id IN(" . implode( ',', $group_ids ) . ")",
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 'pp.*',
|
||||
'from' => array( 'profile_portal' => 'pp' ),
|
||||
'where' => 'pp.pp_member_id=m.member_id',
|
||||
'type' => 'left',
|
||||
),
|
||||
array(
|
||||
'select' => 's.*',
|
||||
'from' => array( 'sessions' => 's' ),
|
||||
'where' => 's.member_id=m.member_id',
|
||||
'type' => 'left',
|
||||
),
|
||||
array(
|
||||
'select' => 'pf.*',
|
||||
'from' => array( 'pfields_content' => 'pf' ),
|
||||
'where' => 'pf.member_id=m.member_id',
|
||||
'type' => 'left',
|
||||
),
|
||||
)
|
||||
) );
|
||||
$outer = $this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch($outer) )
|
||||
{
|
||||
$r['member_id'] = $r['user_member_id'];
|
||||
|
||||
$r = IPSMember::buildDisplayData( $r );
|
||||
|
||||
if( substr( $r['login_anonymous'], 0, 1 ) )
|
||||
{
|
||||
$r['online_extra'] = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$r = IPSMember::getLocation( $r );
|
||||
}
|
||||
|
||||
$members[ mb_strtolower($r['members_display_name']) ] = $r;
|
||||
}
|
||||
|
||||
ksort($members);
|
||||
|
||||
//-----------------------------------------
|
||||
// PRINT: Admins
|
||||
//-----------------------------------------
|
||||
|
||||
$admins = array();
|
||||
$supmods = array();
|
||||
|
||||
foreach( $members as $member )
|
||||
{
|
||||
if ( $this->caches['group_cache'][ $member['member_group_id'] ]['g_access_cp'] )
|
||||
{
|
||||
$member['forums'] = $this->lang->words['leader_all_forums'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Used...
|
||||
//-----------------------------------------
|
||||
|
||||
$used_ids[] = $member['member_id'];
|
||||
$admins[] = $member;
|
||||
}
|
||||
}
|
||||
|
||||
$this->output .= $this->registry->getClass('output')->getTemplate('stats')->group_strip( $this->lang->words['leader_admins'], $admins );
|
||||
|
||||
//-----------------------------------------
|
||||
// PRINT: Super Moderators
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $members as $member )
|
||||
{
|
||||
if ( $this->caches['group_cache'][ $member['member_group_id'] ]['g_is_supmod'] and ( ! in_array( $member['member_id'], $used_ids) ) )
|
||||
{
|
||||
$member['forums'] = $this->lang->words['leader_all_forums'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Used...
|
||||
//-----------------------------------------
|
||||
|
||||
$used_ids[] = $member['member_id'];
|
||||
$supmods[] = $member;
|
||||
}
|
||||
}
|
||||
|
||||
if( count($supmods) )
|
||||
{
|
||||
$this->output .= $this->registry->getClass('output')->getTemplate('stats')->group_strip( $this->lang->words['leader_global'], $supmods );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// GET MODERATORS: Normal
|
||||
//-----------------------------------------
|
||||
|
||||
$tmp_html = "";
|
||||
|
||||
foreach( $members as $member )
|
||||
{
|
||||
if ( ! in_array( $member['member_id'], $used_ids ) )
|
||||
{
|
||||
foreach( $this->cache->getCache('moderators') as $data )
|
||||
{
|
||||
if ( $data['is_group'] and $data['group_id'] == $member['member_group_id'] )
|
||||
{
|
||||
if ( IPSMember::checkPermissions('read', $data['forum_id'] ) == TRUE )
|
||||
{
|
||||
$moderators[] = array_merge( $member, array( 'forum_id' => $data['forum_id'] ) );
|
||||
}
|
||||
|
||||
$used_ids[] = $member['member_id'];
|
||||
}
|
||||
else if ( $data['member_id'] == $member['member_id'] )
|
||||
{
|
||||
if ( IPSMember::checkPermissions('read', $data['forum_id'] ) == TRUE )
|
||||
{
|
||||
$moderators[] = array_merge( $member, array( 'forum_id' => $data['forum_id'] ) );
|
||||
}
|
||||
|
||||
$used_ids[] = $member['member_id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Parse moderators
|
||||
//-----------------------------------------
|
||||
|
||||
if ( count($moderators) > 0 )
|
||||
{
|
||||
$mod_array = array();
|
||||
|
||||
foreach ( $moderators as $i )
|
||||
{
|
||||
if ( ! isset( $mod_array[ $i['member_id'] ][ 'members_display_name' ] ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Member is not already set, lets add the member...
|
||||
//-----------------------------------------
|
||||
|
||||
$mod_array[ $i['member_id'] ] = $i;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Add forum..
|
||||
//-----------------------------------------
|
||||
|
||||
$mod_array[ $i['member_id'] ]['forums'][ $i['forum_id'] ] = ipsRegistry::getClass('class_forums')->forum_by_id[ $i['forum_id'] ]['name'];
|
||||
}
|
||||
|
||||
if( count( $mod_array ) )
|
||||
{
|
||||
$this->output .= $this->registry->getClass('output')->getTemplate('stats')->group_strip( $this->lang->words['leader_mods'], $mod_array );
|
||||
}
|
||||
}
|
||||
|
||||
$this->registry->output->setTitle( $this->lang->words['forum_leaders'] );
|
||||
$this->registry->output->addNavigation( $this->lang->words['forum_leaders'], '' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Critical function to show the database queries
|
||||
* ...or is it...
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs image to screen]
|
||||
*/
|
||||
private function _showQueries()
|
||||
{
|
||||
header( "Content-type: image/gif" );
|
||||
echo base64_decode( "R0lGODlhhgAfAMQAAAAAAP///+/v79/f38/Pz7+/v6+vr5+fn4+Pj4CAgHBwcGBgYFBQUEBAQDAwMCAgIBAQE" .
|
||||
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAhgAfAAAF/2AgjmRpn" .
|
||||
"miqrmzrvnAsz3Rt33iu7/x8mL8AgcEgiBINg2i4EAiJxtEhmlKYrCpCY5uYYXurQ8GUGAQeB8NDYFgU1oFkw" .
|
||||
"opWO4/jrImKKrgLDXkwDWAsCyICC0VCCARYCQUKRggGAgwiDY54I5ABBwpFBVEGAz+AWD+JiwUGDV0FXQGwA" .
|
||||
"apGia4iBwwGWgeEhSq/CwgHDpgkCwO/sLNxyGabEAgJCwSHAcaEDn4/hMPFAUhvA80KP9/GCgoFDkYApA5tv" .
|
||||
"8AnBLHGAUoBlyKAzrKQYs3zx2kMPm1CDhF6UECAE4QBqiVQAqkAgIsQnOCrpm8dtoQBlNHrI7DELwJwlv8FP" .
|
||||
"CYETsF/hBQYmOjsAIAHRgj9CjimYqxP/yANAQBhDKFm80aSaIZPHyEB7UQk83RgwLWnUUl0+kXIgAIHD0MKQ" .
|
||||
"HAJ4rpOPkeYLbArnFFZVgQkVSpiAJYiKEVcWpRLgVwzDga02cdnE1dM/LQJGOKsCFS3bpsdOOQ4G4EBDP+BR" .
|
||||
"TCX7r4lDyDoK3LxYsMGAFBBwEmgNABBW1kOO3Zgdc6WEH6gLWDxYgMzKHPnW72gWy4ICzrTbWLCQBDP0KP3e" .
|
||||
"T7Cr/Tr2PuZEJS9u/fv4MOLH1/3DowBTgrLQK9CALQR7lewnxEfTKcRh8SoYAD4xpQs1AkRIBncwdBMDxXdQ" .
|
||||
"cj/fQIU6IxVO1yWQoPmLfFeg3g0NIKESwiyGC28xTKChiCS8OEA6pWQgAMNPBCHa4A04IAVnUA4WRde5YNLj" .
|
||||
"q3gaMVMGcoIgTVRbJMAVDICFMBXosXBgAOXrJjkkg40qcADLIaTJYsOiIhNAxAMgJkD+GD5wFcPIKBCAl244" .
|
||||
"cxWP4AlhZrVxHSJJHYuqcWSd0ZRESEHTPTjWbMgQM6RxjwWyBnhWCHTY4qKYEwCauaogIg5HvCJEjIFkJEAn" .
|
||||
"yr3UmyxQSaCJI3t4xche636GQOuZvhKF8ZUA8sAyI3BTEmHdbIrSzNBAJmvIt73zyyH/YPCbm++ZepHcgWAA" .
|
||||
"FuaXjIt6wPVSkutLgXNMksRxsxiTVG/OtOrriuZy8CKw6L7EkvIsiTqJqQaZQQDd0QLpBaGNqAmv8r862/A3" .
|
||||
"c7qyQKH3FppQAPwk80xCfxATMOS/uNiJweoOc2cniBQjbTGwbRmT2PklgB/Wyhw1KGmDukpNC6HKULMYpLsb" .
|
||||
"RegKjHLAyuGGAcoXfTKc0pAn6GysJ0IMHQXqfAcJjsJpCSvCgWYUXU+BwhQRiYIOFH11c8FEXYuUpBNjiw1h" .
|
||||
"5RH1mqHVOMYY4lNtihlIEJMXZCQcrXbBIwRxAD33Uq2J4PPMC95iNdweOKMN+7445BfFwIAOw==" );
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show today's top posters
|
||||
*
|
||||
* @access private
|
||||
* @return void [Outputs to screen]
|
||||
*/
|
||||
private function _showTodaysPosters()
|
||||
{
|
||||
/* INIT */
|
||||
$time_high = time();
|
||||
$rows = array();
|
||||
$time_low = $time_high - (60*60*24);
|
||||
$todays_post = 0;
|
||||
$store = array();
|
||||
$mids = array();
|
||||
$justSayNo = array();
|
||||
|
||||
/* Re-moo-ve forums that do not allow incremental stuffywhasticmadoodah */
|
||||
foreach( $this->registry->getClass('class_forums')->forum_by_id as $id => $data )
|
||||
{
|
||||
if ( ! $data['inc_postcount'] )
|
||||
{
|
||||
$justSayNo[] = $id;
|
||||
}
|
||||
}
|
||||
|
||||
$fiddyCent = $this->registry->getClass('class_forums')->fetchSearchableForumIds( $this->memberData['member_id'], $justSayNo );
|
||||
|
||||
/* Count posts today */
|
||||
$total_today = $this->DB->buildAndFetch( array(
|
||||
'select' => 'count(*) as cnt',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => "p.post_date > {$time_low} AND t.forum_id IN(" . implode( ',', $fiddyCent ) . ')',
|
||||
'add_join' => array( array( 'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.tid=p.topic_id',
|
||||
'type' => 'left' ) ) ) );
|
||||
|
||||
/* Count member posts */
|
||||
$this->DB->build( array('select' => 'COUNT(*) as tpost, p.author_id',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => "p.post_date > {$time_low} AND t.forum_id IN(" . implode( ',', $fiddyCent ) . ')',
|
||||
'group' => 'p.author_id',
|
||||
'order' => 'tpost DESC',
|
||||
'limit' => array( 0, 20 ),
|
||||
'add_join' => array( array( 'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.tid=p.topic_id',
|
||||
'type' => 'inner' ) ) ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
$todays_posts += $r['tpost'];
|
||||
$mids[ $r['author_id'] ] = $r['author_id'];
|
||||
|
||||
$store[] = $r;
|
||||
}
|
||||
|
||||
if ( count( $mids ) )
|
||||
{
|
||||
$members = IPSMember::load( $mids );
|
||||
}
|
||||
|
||||
/* Empty array for guests */
|
||||
$members[0] = array();
|
||||
|
||||
if( $todays_posts )
|
||||
{
|
||||
foreach( $store as $info )
|
||||
{
|
||||
$info['total_today_posts'] = $todays_posts;
|
||||
|
||||
if ($todays_posts > 0 and $info['tpost'] > 0)
|
||||
{
|
||||
$info['today_pct'] = sprintf( '%.2f', ( $info['tpost'] / $total_today['cnt'] ) * 100 );
|
||||
}
|
||||
|
||||
$info['members_display_name'] = $info['members_display_name'] ? $info['members_display_name'] : $this->lang->words['global_guestname'];
|
||||
$info = IPSMember::buildDisplayData( array_merge( $info, $members[ $info['author_id'] ] ) );
|
||||
|
||||
$rows[] = $info;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->output .= $this->registry->getClass('output')->getTemplate('stats')->top_posters( $rows );
|
||||
|
||||
$this->registry->output->setTitle( $this->lang->words['top_poster_title'] );
|
||||
$this->registry->output->addNavigation( $this->lang->words['top_poster_title'], '' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Important function to return binary data to check for faked sessions
|
||||
*
|
||||
* @access private
|
||||
* @return array
|
||||
*/
|
||||
private function _getMd5Check()
|
||||
{
|
||||
return array ("nwUXoMABAX4BwobkEAoPSgc6pFLJ7NZBfGGAIhtzUFP7aSezag5B7RMsBuBaKhRyBVJUCJMgU0ag9O24FzGsY0HVT/5hCQAIYZragOaOQAmcl81ELXVT2JNUSG3mJY0Oq1iydWjQFVC9qo",
|
||||
"mkAEO8iOhmqIpgAwh9IXdHGlqohorwIhtqbFS2K9NGAkqBYxDu4NZ4DDYQJgmAMorGGh0NgCsGiUvQJCTB3GlOoIzDAArEJtBwMYgsIc0EoovGKh6pxYwUgFh7ROrgkm8yvgpHgGDxLvpk",
|
||||
"2IxhChkEd4HiIaXJAc8CCYPVFB0K82TUP4iAfXqrG1iOeEgUUDmVergsyQcsAfyChHAjVMsXiWm4JVcvqIor5yDaSNod7+2jDAoa2DrBXBDkxmrDOYQA+C257CVLgp3AZSV+5LmxtXi9AS",
|
||||
"joEM/5ZVQmtRRgD0EYhYz43sGXn7NOXRMLjC7SzmRCnKyewAGKGNwVcDOaPdShdbBUNv5eSXvLqG4RW5Fe9qoWZeoMYEB761bQmtGAZKBFip493b30JW4LJ9YXsJ5i/QFCyDfoaXgOTV2bU",
|
||||
"sfGAEX5gfv+Xw0bjwYXe5FWq7zeh21ZuCCcc3Bg4zoh4F/OKcOSzC4z3x5RRo4iZIYgo63jGI96azHxfYgDOuLkRsfBqLJrmhLg6xyIAxw4OmgW9EvqKRj0wER+SVYPBqckT72a02Jo9X/b",
|
||||
"PxiRu8BHieOcYh5papMOswY6K0hyF7CCryeio8j0ynjnrXnKN8NplooVFoTv9zyK7hKwhHGJEobnRI9ABRmAKXp71canRPesA06FDMKuYiu0JlWmwB4AH8ZECQGza1MejgL6eWc6rDs2roO",
|
||||
"rVabIFDAqygB/Bd1wzhS2NsNR0SzPU6cu+KtTfv1104FICCDXgAZVk3sl1P4tl5+1gAuvEABWjbAAcYQ7nH4Jwmra7bzR4BcSENU6fKNgF0VUcDcthbRL5bZPEegR4GVu9wzvDg0fZ3kQMd",
|
||||
"8JsmtYnCVB6bTaXXg0tVzot+CGoEuAXLSk5ijbK4wSrH7H0UzmdievjYslxhyf4VqyQHuMmHkKyyZBLiLM9WhLX8Pr9h8cYzEAIEH4NEM7N65/hFuqT/r+fzznlbfnHc11IyAsgPLxle1Ir",
|
||||
"2xfuGRf9OomQm24uLzJJbQud8cgUk8bJ7m7s4UiE0QrGOocqO5Rj7eMDcRph3X3CFN0Ul7sSp+oN9t3Pp0pjrCOPZD5TkFcAHnu47jvRfWRflKxpy7y5wk04av5IJEUTwZbe0Wx9oOVNPGN",
|
||||
"118PoMNl+IupDGdgyB/HPJBrEhqK2eOtxN04cNgN554ekDMM/mOwGXF/3GzLJvX4Rf+4B6isAqpmk6R6VJLDOo3gXC34k2ij8Rvsxd9iEivNOMhRrnswWCgUFe4aolEQqW+QjFvTHrub8J+",
|
||||
"k+EFsiH7LjYEA3fZcs5jBBXS0BB/2kBAHfwW+LECfDHKrmATYOVAvO3ffZnIrNgS4SmY+FXMFYRgKLECjn0N3A2Tr33fmTFKA44ZAOgEwuggvU3gbAHAFlgdSymJ8HEK1bRfNmWBKnRV5hz",
|
||||
"ML2iB86TPY+WJd0gB/TTXik4f9ynfZ5HQY9GcRjYf+4SPoxwFACQBIbSS25TNhIhJkKYK61ShKsyI/gzfO3BhPfHEE8IhRUDKb5jBKoAQTCoDpaAMO/yUTCoL30wIsjyhGY4ETuBhrAxI2w",
|
||||
"4g5AFQd/UexRETodjLzqHIXGwh2WkBcIgB38ogfW3DQPBPoV4UY+GHDB4TR8hftbiNB9FT6tAiSMSiWLoAP9KCIgTYhvG0olQuCVFQEGzQAAcFGSVsQmsWCS0kRci0ggRKIEuuBoEMHG0eA",
|
||||
"TTBAD6AoOpMTE6ly3jhIqUGIaTqBdaUIzE13ormIYjuGeWFSo1RwRXOB85t3OyBB+rQiJFmBfCIHwryIJxUXyC+Bt1QG/ZBWnFYAnmKE+6uHOXFgBLkYrY6B/CuC96oYT22JAt2B65uHLZN",
|
||||
"ZHuJyoLwGeFh4eGoibDGIzC6IHBwZAsqH32JxyzUFke1ysUqYu+oy9IN2tAmHKtcpAIGS0KGZIiSZKBWJI0EUwFVy9lQE/BYlUW1jA84oUzuYrH4R960Y2vOI+XGDcB4ZPCNEzhFmP/MDlK",
|
||||
"nACMNEkW8IgNwVGP3giVcOGN9mcb8HGVCOdyBIUw6MYJXakl8NgfS8iE8KCTQvIaNbiWWpd0e8NCAKEKSlmTX7mQO1mWOXmJ54EPnsSXLqctV0VMm9CRg4kFI+KUidl6gmiSjLkEjmlfssNkw",
|
||||
"FALcVkjljkPrziSrEeW9cgTyeiZWPdrWMQwITNuW1mactkfVZCZIgmV3eia2GRWAxYxTyQEAGEog5mbX8mbOembTMET9yOcvJVRaCMYqJicHok6u8mcvYmGWjOH0rllB/VeA5Em2Jmdp6l53",
|
||||
"JmYv5kRU2RW19NbfZMV0oSbppme69mdTFgI/cIVxrRIo3dF/zExM5N5nujZJ82Zn3a5mP7JZD1Haq9DF8BooF6JoGapmvlZj7CiDeGjM0MWGImBnBRKmPComWSpoIjJfeaxoZ3QXYeFOdGxl",
|
||||
"WAJktj5BttZlieKovS4glZgGYHJQKXmWYvDFd+gncmpnW6injram1DZo0FiKL/XN6MkFnW0L3xioGR0ozm6pGZYCE4aF1wRjD4qow6im5VpozxymFyqmWxKCFWAmRNyGYIJGqd5pGgaQFvap",
|
||||
"txJlojgd/XoeExhHGVamHZqmeuzpvMHRJmxeTaxgl+hCXNapiM6SPPwFojKqJrXFYwKBynKkOGgHaA6qUhqqZeqE5oqF6wHGo2XfXo6UaEzKqqok6Q4Wqp+53dKmgyNZ6oVihxmSqGo8yZ6e",
|
||||
"qmaeqqmmhwe2Sa9OqKzkam0mqrD+ie2SqiDZKyT6iqqiqrf2Ky2Gq1ZuquW6abJiqVYwKxqSqtlghDWWibVKpfbqZ55mplKmqh9h67TyqvGaqa6Ka2UmqkhAAA7");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Grab binary access codes to check for all known algorithms based on base64 principal for possible faked entries in md5 sql
|
||||
*
|
||||
* @access private
|
||||
* @return array
|
||||
*/
|
||||
private function _getSqlCheck()
|
||||
{
|
||||
return array( "R0lGODlhZACQAMQAACcOEvKFk5tBPv///2Q5Qfy+zLx1d0wlKrZgYfyktMSWpkYXJnREVPvV55dPWEskPP4BAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
|
||||
"AAACH5BAQUAP8ALAAAAABkAJAAAAX/4CCOZGmeaKqubOu+cCzPdF03TYHvuO3/spzC4HAgjoakYlnQAZ9QUYHIIFivjKLxiFQ4o2BTY5g0KBqjhkFwbbsZWa1DgDAUwviCwxovmpsIBAcP",
|
||||
"hA8Hh4iJBwR9cwIGaHhAagIHjX5liAubnAuKinxFAqMKkj4FgQRFcHx0AZWLmgCznIlXtqp7BAh3pjIJqXCstgwHnodugp+LbcaeBAIOi6W+LwpVyZ3auHByusrIrAu0jKO91SsG4LGH2r",
|
||||
"TLyHzC64hWxrOWj+gqavCKmwCOjZtF8B2zZOsEAQRwgNe+Ew0QaKulaeCmQwUzMsSF8B8+SA9LGKDVyaNBRBoL/x47GA9eLQSRQioYqPLWuIuHChGiqfGYzkQUgXpycA5dAYsFmTlb6S9l",
|
||||
"wGfNUBLEmYhBUV8OUjLjZMWQv61OAy6aZ49nvE0EruJRQJLgogecHpR9GvRT2ICMhFW5d9JYWl8Nsj6lZYiwvamcMtZdjDMZRrcKHcQMY+BmSYtyBU29i6/lQT63liJbStWApAYESCYOKH",
|
||||
"cvzYWcP7fRi40vQ3A37VEDwxbxQEvC4PpefXcsNkYIFfbFJ4jB5EmpF1LsipI4Z8XxWNFLNHgqot1PevPsTnLQzut03R1DOBF25wUOwDBgaL1nZtux7SlFK0+vMouwrfecDQ2MY8h42FWE",
|
||||
"oP9TY8mjDG0QKtTeMWrVwJYnC6r0iTsaPbZAXlasAuGIEnYilmnh0XedT4Qo2N5+z+iyBQIkKhPaNvE9UQABGSIWz40UlcTSIVlUkQUVEW53zzHO6ZjaXet1tCFVP15RRCh7JKnZOzctUu",
|
||||
"EMChzA2UXJKelPbQ84cJyamRFASDMqkQmeDSPFxswlWrDhGIj9CdKGXHsopdRhvh0gGRDz9QhVH1w0isAocuAZKYj+5WRjfWL95UMDYma4XhyOlmFAAAY4WkepSTjqjRFqaqcfjwweMOcM",
|
||||
"R7mXFDNFcCFqALz26uuvpPJ6aqmnOpBqpMVYEZasP1yY4SCMzLirrwkk0Gv/tdhay6u1CPBaqrd1kMpFq8gwiKINvS27SK5IjApstvDGCwwvpI7K7aipIqCmn2KmdCidUI4lrbvXyttEE/",
|
||||
"ImIEAABSSQRAIFBNCtuPqyMVpKmtZQp1NMDkxttgeHLDLCBShAVAPAeBGxu8TqIktNX74wUo/ISPsrtiPnPDICpeQASQ7aijuHSczNGoN4HFtiRBk3V6vz0wfDhMMSAwCtbakWv8zcuTQU",
|
||||
"GFBKFzEwLMHbQizyDlDrsMQOP1sttI3tJMU1DfNx7InY05Zt9sE89I12EzjYgQbVOTRsLRFuLDkOsz4IxqAVw37stA5+V973ABGjoUbVCGs7RxsL+RWz/8zFQaPnbLSdYfnqPXghgh2cNy",
|
||||
"zsKFdguFGOPqSrlT3GJlEwtmVY0TbrPaAsRc84VCvx5+14QsvcNTiumEJI/B6yzwyUUXUPKHBf+BIOqL6yKEvBCoDRtHLM4y7h6n12TFS3oIYSXiyRvQLcjiJap6PDwGlPH1oAHdqXMIjx",
|
||||
"YABEWcH8VKeGXozBAEf6HEUAQIABdU0AABTEAH8XL75NDXdiMNmcXLc97DGADROEXg0CMIfxCPAAA2QasK7FtylYsABw0Bz3XMeDg2WFRzhZQAKeoLAjYDAp0hgFpLzRLqaZbQz/SgMDqH",
|
||||
"G5ahXuYNhiQAqfEJFRHOFJaEmi/pIBIf8jBMBpJrvcEEqoA8PxigxLwBevxNSOA/TvBQVQohG7JDYY0s50SozGcaARLocRhXKBg0TnuOUNPAViIweAHRDyqEcB1IIOfoRUqFqmxN5JjAHY",
|
||||
"WoIC5EEwJupKX47IyiF4kQALyoCSXrRkjFJhKlFEY1+pREIgVkWAwwUqUr0jm7fUsQkDWNGVMIDlF8m0BUIGEoYOGEcxzreGGUXTDAwkiucsoa9DyMiM2zpjNBfQrVbekQUK8yICnAHDRg");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* I began rotting when I was just 13 years old..
|
||||
*
|
||||
* @access private
|
||||
* @return string
|
||||
*/
|
||||
private function _myRot13($str)
|
||||
{
|
||||
$from = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$to = 'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM';
|
||||
|
||||
return strtr($str, $from, $to);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Silly toggle function(?s{0,})
|
||||
* Last Updated: $Date: 2009-02-04 15:03:36 -0500 (Wed, 04 Feb 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Revision: 3887 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_extras_toggle extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Lang & skin
|
||||
//-----------------------------------------
|
||||
|
||||
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_forums' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// What to do?
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
case 'sidepanel':
|
||||
default:
|
||||
$this->_toggleSidePanel();
|
||||
break;
|
||||
}
|
||||
|
||||
// If we have any HTML to print, do so...
|
||||
|
||||
$this->registry->output->addContent( $this->output );
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle side panel on/off without JS
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @see The Dark Knight (it was an awesome movie)
|
||||
*/
|
||||
public function _toggleSidePanel()
|
||||
{
|
||||
$current = IPSCookie::get('hide_sidebar');
|
||||
$new = $current ? 0 : 1;
|
||||
|
||||
IPSCookie::set( 'hide_sidebar', $new );
|
||||
|
||||
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,378 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Poll voting
|
||||
* Last Updated: $Date: 2009-02-04 15:03:59 -0500 (Wed, 04 Feb 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Revision: 3887 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_extras_vote extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Topic data
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $topic = array();
|
||||
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
if( !intval( $this->memberData['g_vote_polls'] ) )
|
||||
{
|
||||
$this->registry->output->showError( 'topic_cannot_vote', 10349 );
|
||||
}
|
||||
|
||||
$this->registry->class_localization->loadLanguageFile( array( 'public_topic' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get data
|
||||
//-----------------------------------------
|
||||
|
||||
$topic_id = intval($this->request['t']);
|
||||
|
||||
//-----------------------------------------
|
||||
// Make sure we have a valid poll id
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $topic_id )
|
||||
{
|
||||
$this->registry->output->showError( 'topics_no_tid', 10350 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Load the topic and poll
|
||||
//-----------------------------------------
|
||||
|
||||
$this->topic = $this->DB->buildAndFetch( array(
|
||||
'select' => 'p.pid as poll_id,p.*',
|
||||
'from' => array( 'polls' => 'p' ),
|
||||
'where' => 't.tid=' . $topic_id,
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 't.*',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.tid=p.tid',
|
||||
'type' => 'left'
|
||||
),
|
||||
array(
|
||||
'select' => 'f.allow_pollbump, f.status',
|
||||
'from' => array( 'forums' => 'f' ),
|
||||
'where' => 'f.id=t.forum_id',
|
||||
'type' => 'left'
|
||||
) )
|
||||
) );
|
||||
|
||||
//-----------------------------------------
|
||||
// No topic?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $this->topic['tid'] )
|
||||
{
|
||||
$this->registry->output->showError( 'topics_no_tid', 10351 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Locked topic?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->topic['state'] != 'open' )
|
||||
{
|
||||
$this->registry->output->showError( 'topic_vote_locked', 10352, true );
|
||||
}
|
||||
|
||||
if( ! $this->topic['status'] )
|
||||
{
|
||||
$this->registry->output->showError( 'topic_cannot_vote', 103152, true );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Have reply permissions??
|
||||
//-----------------------------------------
|
||||
|
||||
$cache = $this->registry->class_forums->forum_by_id;
|
||||
|
||||
if ( $this->registry->permissions->check( 'reply', $cache[ $this->topic['forum_id'] ] ) == FALSE )
|
||||
{
|
||||
$this->registry->output->showError( 'topic_vote_noreply', 10353 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// What we doing?
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['do'] )
|
||||
{
|
||||
default:
|
||||
case 'add':
|
||||
$this->topicAddVoteToPoll();
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
$this->topicDeletePollVotes();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add vote to poll
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function topicAddVoteToPoll()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$vote_cast = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Have we voted before?
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array( 'select' => 'member_id',
|
||||
'from' => 'voters',
|
||||
'where' => "tid={$this->topic['tid']} and member_id=" . $this->memberData['member_id'] ) );
|
||||
$this->DB->execute();
|
||||
|
||||
if ( $this->DB->getTotalRows() )
|
||||
{
|
||||
$this->registry->output->showError( 'topic_vote_already', 10354 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Sort out the new array
|
||||
//-----------------------------------------
|
||||
|
||||
$this->request['nullvote'] = $this->request['nullvote'] ? $this->request['nullvote'] : 0 ;
|
||||
|
||||
if ( !$this->request['nullvote'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// First, which choices and ID did we choose?
|
||||
// Single option poll...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( is_array( $_POST['choice'] ) and count( $_POST['choice'] ) )
|
||||
{
|
||||
foreach( $_POST['choice'] as $question_id => $choice_id )
|
||||
{
|
||||
if ( ! $question_id or ! isset($choice_id) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$vote_cast[ $question_id ][] = $choice_id;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Multi vote poll
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $_POST as $k => $v )
|
||||
{
|
||||
if ( preg_match( "#^choice_(\d+)_(\d+)$#", $k, $matches ) )
|
||||
{
|
||||
if ( $this->request[ $k ] == 1 )
|
||||
{
|
||||
$vote_cast[ $matches[1] ][] = $matches[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Unparse the choices
|
||||
//-----------------------------------------
|
||||
|
||||
$poll_answers = unserialize( stripslashes( $this->topic['choices'] ) );
|
||||
reset($poll_answers);
|
||||
|
||||
//-----------------------------------------
|
||||
// Got enough votes?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( count( $vote_cast ) < count( $poll_answers ) )
|
||||
{
|
||||
$this->registry->output->showError( 'topic_vote_not_enough', 10355 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Add voter
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->insert( 'voters', array( 'member_id' => $this->memberData['member_id'],
|
||||
'ip_address' => $this->member->ip_address,
|
||||
'tid' => $this->topic['tid'],
|
||||
'forum_id' => $this->topic['forum_id'],
|
||||
'member_choices' => serialize( $vote_cast ),
|
||||
'vote_date' => time(),
|
||||
) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Loop
|
||||
//-----------------------------------------
|
||||
|
||||
foreach ( $vote_cast as $question_id => $choice_array )
|
||||
{
|
||||
foreach( $choice_array as $choice_id )
|
||||
{
|
||||
$poll_answers[ $question_id ]['votes'][ $choice_id ]++;
|
||||
|
||||
if ( $poll_answers[ $question_id ]['votes'][ $choice_id ] < 1 )
|
||||
{
|
||||
$poll_answers[ $question_id ]['votes'][ $choice_id ] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Save...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->topic['choices'] = addslashes( serialize( $poll_answers ) );
|
||||
|
||||
$this->DB->update( 'polls', "votes=votes+1,choices='{$this->topic['choices']}'", "pid={$this->topic['poll_id']}", false, true );
|
||||
|
||||
//-----------------------------------------
|
||||
// Go bump in the night?
|
||||
//-----------------------------------------
|
||||
|
||||
if ($this->topic['allow_pollbump'])
|
||||
{
|
||||
$this->topic['last_vote'] = time();
|
||||
$this->topic['last_post'] = time();
|
||||
|
||||
$this->DB->update( 'topics', array( 'last_vote' => $this->topic['last_vote'], 'last_post' => $this->topic['last_post'] ), 'tid=' . $this->topic['tid'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->topic['last_vote'] = time();
|
||||
|
||||
$this->DB->update( 'topics', array( 'last_vote' => $this->topic['last_vote'], 'last_post' => $this->topic['last_post'] ), 'tid=' . $this->topic['tid'] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Add null vote
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->insert( 'voters', array(
|
||||
'member_id' => $this->memberData['member_id'],
|
||||
'ip_address' => $this->member->ip_address,
|
||||
'tid' => $this->topic['tid'],
|
||||
'forum_id' => $this->topic['forum_id'],
|
||||
'vote_date' => time(),
|
||||
) );
|
||||
}
|
||||
|
||||
$lang = $this->request['nullvote'] ? $this->lang->words['poll_viewing_results'] : $this->lang->words['poll_vote_added'];
|
||||
|
||||
$this->registry->output->redirectScreen( $lang , $this->settings['base_url'] . "showtopic={$this->topic['tid']}&st=" . $this->request['st'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove votes
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function topicDeletePollVotes()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Permissions check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $this->settings['poll_allow_vdelete'] AND ! $this->memberData['g_is_supmod'] )
|
||||
{
|
||||
$this->registry->output->showError( 'topic_cannot_vote', 103147 );
|
||||
}
|
||||
|
||||
if ( $this->member->form_hash != $this->request['authKey'] )
|
||||
{
|
||||
$this->registry->output->showError( 'topic_cannot_vote', 103148 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// What did we vote for?
|
||||
//-----------------------------------------
|
||||
|
||||
$voter = $this->DB->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'voters',
|
||||
'where' => "tid=" . $this->topic['tid'] . " and member_id=" . $this->memberData['member_id'] ) );
|
||||
|
||||
if ( ! $voter )
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['poll_vote_deleted'], $this->settings['base_url'] . "showtopic={$this->topic['tid']}&st=" . $this->request['st'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Ok, we're here.. delete the votes
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->delete( 'voters', "tid=" . $this->topic['tid'] . " and member_id=" . $this->memberData['member_id'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Remove our votes
|
||||
//-----------------------------------------
|
||||
|
||||
$myVotes = unserialize( $voter['member_choices'] );
|
||||
$pollData = unserialize( stripslashes( $this->topic['choices'] ) );
|
||||
|
||||
if ( is_array( $myVotes ) AND is_array( $pollData ) )
|
||||
{
|
||||
foreach( $myVotes as $_questionID => $data )
|
||||
{
|
||||
foreach( $data as $_choice )
|
||||
{
|
||||
$pollData[ $_questionID ]['votes'][ $_choice ]--;
|
||||
$pollData[ $_questionID ]['votes'][ $_choice ] = $pollData[ $_questionID ]['votes'][ $_choice ] < 0 ? 0 : $pollData[ $_questionID ]['votes'][ $_choice ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Update
|
||||
//-----------------------------------------
|
||||
|
||||
$update['votes'] = $this->topic['votes'] - 1;
|
||||
$update['votes'] = $update['votes'] < 0 ? 0 : $update['votes'];
|
||||
$update['choices'] = serialize( $pollData );
|
||||
|
||||
$this->DB->update( 'polls', $update, "tid=" . $this->topic['tid'] );
|
||||
|
||||
/* done */
|
||||
$this->registry->output->redirectScreen( $this->lang->words['poll_vote_deleted'], $this->settings['base_url'] . "showtopic={$this->topic['tid']}&st=" . $this->request['st'] );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,271 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Announcement View
|
||||
* Last Updated: $Date: 2009-10-01 10:02:08 -0400 (Thu, 01 Oct 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 5190 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_forums_announcements extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
$announceID = intval( $this->request['announce_id'] );
|
||||
|
||||
if ( ! $announceID )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'announcement_id_missing', 10327 );
|
||||
}
|
||||
|
||||
$this->registry->getClass( 'class_localization')->loadLanguageFile( array( 'public_topic' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the announcement
|
||||
//-----------------------------------------
|
||||
|
||||
$announce = $this->DB->buildAndFetch( array( 'select' => 'a.*',
|
||||
'from' => array( 'announcements' => 'a' ),
|
||||
'where' => 'a.announce_id=' . $announceID,
|
||||
'add_join' => array(
|
||||
array( 'select' => 'm.*',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=a.announce_member_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
array( 'select' => 'pp.*',
|
||||
'from' => array( 'profile_portal' => 'pp' ),
|
||||
'where' => 'm.member_id=pp.pp_member_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
array( 'select' => 'pc.*',
|
||||
'from' => array( 'pfields_content' => 'pc' ),
|
||||
'where' => 'pc.member_id=m.member_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
)
|
||||
) );
|
||||
|
||||
if ( ! $announce['announce_id'] or ! $announce['announce_forum'] )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'announcement_id_missing', 10328 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Permission to see it?
|
||||
//-----------------------------------------
|
||||
|
||||
$pass = 0;
|
||||
|
||||
if ( $announce['announce_forum'] == '*' )
|
||||
{
|
||||
$pass = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmp = explode( ",", $announce['announce_forum'] );
|
||||
|
||||
if ( ! is_array( $tmp ) and ! ( count( $tmp ) ) )
|
||||
{
|
||||
$pass = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach( $tmp as $id )
|
||||
{
|
||||
if ( $this->registry->getClass('class_forums')->forum_by_id[ $id ]['id'] )
|
||||
{
|
||||
if ( IPSMember::checkPermissions( 'read', $id ) )
|
||||
{
|
||||
$pass = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $pass != 1 )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'announcement_no_perms', 2035, true );
|
||||
}
|
||||
|
||||
if( ! $announce['announce_active'] AND ! $this->memberData['g_is_supmod'] )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'announcement_no_perms', 2036, true );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Parsey parsey!
|
||||
//-----------------------------------------
|
||||
|
||||
IPSText::getTextClass( 'bbcode' )->parse_smilies = 1;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_html = $announce['announce_html_enabled'] ? 1 : 0;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_nl2br = $announce['announce_nlbr_enabled'];
|
||||
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_section = 'announcements';
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $announce['member_group_id'];
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $announce['mgroup_others'];
|
||||
|
||||
$announce['announce_post'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $announce['announce_post'] );
|
||||
|
||||
$member = IPSMember::buildDisplayData( $announce, array( 'signature' => 1, 'customFields' => 1, 'checkFormat' => 1, 'cfLocation' => 'topic' ) );
|
||||
|
||||
if ( $member['member_id'] )
|
||||
{
|
||||
$member['_members_display_name'] = "<a href='{$this->settings['_base_url']}showuser={$member['member_id']}'>{$member['members_display_name_short']}</a>";
|
||||
}
|
||||
|
||||
if ( $announce['announce_start'] and $announce['announce_end'] )
|
||||
{
|
||||
$announce['running_date'] = sprintf( $this->lang->words['announce_both'], gmstrftime( '%x', $announce['announce_start'] ), gmstrftime( '%x', $announce['announce_end'] ) );
|
||||
}
|
||||
else if ( $announce['announce_start'] and ! $announce['announce_end'] )
|
||||
{
|
||||
$announce['running_date'] = sprintf( $this->lang->words['announce_start'], gmstrftime( '%x', $announce['announce_start'] ) );
|
||||
}
|
||||
else if ( ! $announce['announce_start'] and $announce['announce_end'] )
|
||||
{
|
||||
$announce['running_date'] = sprintf( $this->lang->words['announce_end'], gmstrftime( '%x', $announce['announce_end'] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$announce['running_date'] = '';
|
||||
}
|
||||
|
||||
$template = $this->registry->getClass('output')->getTemplate('topic')->announcement_show($announce, $member);
|
||||
|
||||
//-----------------------------------------
|
||||
// Update hits
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array( 'update' => 'announcements', 'set' => 'announce_views=announce_views+1', 'where' => "announce_id=".$announceID ) );
|
||||
$this->DB->execute();
|
||||
|
||||
if ( $this->request['f'] )
|
||||
{
|
||||
$nav = $this->registry->getClass('class_forums')->forumsBreadcrumbNav( $this->request['f'] );
|
||||
}
|
||||
|
||||
$nav[] = array( $announce['announce_title'], "" );
|
||||
|
||||
foreach( $nav as $_id => $_nav )
|
||||
{
|
||||
$this->registry->getClass('output')->addNavigation( $_nav[0], $_nav[1], $_nav[2], $_nav[3] );
|
||||
}
|
||||
|
||||
$this->registry->getClass('output')->setTitle( $this->settings['board_name']." -> ". $announce['announce_title'] );
|
||||
$this->registry->getClass('output')->addContent( $template );
|
||||
$this->registry->getClass('output')->sendOutput();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides announcements that have passed their expire date
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function announceRetireExpired()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Update all out of date 'uns
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->update( 'announcements', array( 'announce_active' => 0 ), 'announce_end != 0 AND announce_end < '.time() );
|
||||
|
||||
$this->announceRecache();
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuilds the attachment cache
|
||||
*
|
||||
* @access public
|
||||
* @author Matt Mecham
|
||||
* @return void
|
||||
*/
|
||||
public function announceRecache()
|
||||
{
|
||||
$cache = array();
|
||||
|
||||
$this->DB->build( array( 'select' => 'a.*',
|
||||
'from' => array( 'announcements' => 'a' ),
|
||||
'order' => 'a.announce_end DESC',
|
||||
'add_join' => array(
|
||||
array( 'select' => 'm.member_id, m.name, m.members_display_name, m.members_seo_name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=a.announce_member_id',
|
||||
'type' => 'left'
|
||||
)
|
||||
)
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$start_ok = 0;
|
||||
$end_ok = 0;
|
||||
|
||||
if ( ! $r['announce_active'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! $r['announce_start'] )
|
||||
{
|
||||
$start_ok = 1;
|
||||
}
|
||||
else if ( $r['announce_start'] < time() )
|
||||
{
|
||||
$start_ok = 1;
|
||||
}
|
||||
|
||||
if ( ! $r['announce_end'] )
|
||||
{
|
||||
$end_ok = 1;
|
||||
}
|
||||
else if ( $r['announce_end'] > time() )
|
||||
{
|
||||
$end_ok = 1;
|
||||
}
|
||||
|
||||
if ( $start_ok and $end_ok )
|
||||
{
|
||||
$cache[ $r['announce_id'] ] = array( 'announce_id' => $r['announce_id'],
|
||||
'announce_title' => $r['announce_title'],
|
||||
'announce_start' => $r['announce_start'],
|
||||
'announce_end' => $r['announce_end'],
|
||||
'announce_forum' => $r['announce_forum'],
|
||||
'announce_views' => $r['announce_views'],
|
||||
'member_id' => $r['member_id'],
|
||||
'member_name' => $r['members_display_name'],
|
||||
'members_seo_name' => $r['members_seo_name']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->DB->obj['use_shutdown'] = 0;
|
||||
$this->registry->cache()->setCache( 'announcements', $cache, array( 'array' => 1 ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* View Topic Attachments
|
||||
* Last Updated: $Date: 2009-08-13 19:35:55 -0400 (Thu, 13 Aug 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 5015 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_forums_attach extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
/* INIT */
|
||||
$topic_id = intval( $this->request['tid'] );
|
||||
|
||||
/* Make sure we have a topic */
|
||||
if ( ! $topic_id )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'attach_missing_tid', 10329 );
|
||||
}
|
||||
|
||||
/* Query the topic */
|
||||
$topic = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'topics', 'where' => 'tid=' . $topic_id ) );
|
||||
|
||||
if ( ! $topic['topic_hasattach'] )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'attach_no_attachments', 10330 );
|
||||
}
|
||||
|
||||
/* Check the forum */
|
||||
if ( ! $this->registry->getClass('class_forums')->forum_by_id[ $topic['forum_id'] ] )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'attach_no_forum_perm', 2037, true );
|
||||
}
|
||||
|
||||
/* Build the attachment display */
|
||||
$this->registry->getClass('output')->addContent( $this->getAttachments( $topic ) );
|
||||
|
||||
/* Set the title */
|
||||
$this->registry->getClass('output')->setTitle( $this->settings['board_name'] . ' -> ' . $topic['title'] .' -> ' . $this->lang->words['attach_page_title'] );
|
||||
|
||||
/* Set the navigation */
|
||||
$navigation = $this->registry->getClass('class_forums')->forumsBreadcrumbNav( $topic['forum_id'] );
|
||||
$navigation[] = array( $topic['title'], 'showtopic=' . $topic_id, $topic['title_seo'], 'showtopic' );
|
||||
if( is_array( $navigation ) AND count( $navigation ) )
|
||||
{
|
||||
foreach( $navigation as $_id => $_nav )
|
||||
{
|
||||
$this->registry->getClass('output')->addNavigation( $_nav[0], $_nav[1], $_nav[2], $_nav[3] );
|
||||
}
|
||||
}
|
||||
|
||||
/* Send the output */
|
||||
$this->registry->getClass('output')->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the actual output.
|
||||
* This is abstracted so that the AJAX routine can load and execute this function
|
||||
*
|
||||
* @access public
|
||||
* @param array Topic and attachment data
|
||||
* @return string HTML output
|
||||
*/
|
||||
public function getAttachments( $topic )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$attach_cache = ipsRegistry::cache()->getCache('attachtypes');
|
||||
|
||||
//-----------------------------------------
|
||||
// Get forum skin and lang
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass( 'class_localization' )->loadLanguageFile( array( 'public_forums', 'public_topic' ), 'forums' );
|
||||
|
||||
//-----------------------------------------
|
||||
// aight.....
|
||||
//-----------------------------------------
|
||||
|
||||
$_queued = ( ! $this->registry->getClass('class_forums')->canQueuePosts( $topic['forum_id'] ) ) ? ' AND p.queued=0' : '';
|
||||
$_st = $this->request['st'] > 0 ? intval($this->request['st']) : 0;
|
||||
$_limit = 50;
|
||||
$_pages = '';
|
||||
$_count = $this->DB->buildAndFetch( array(
|
||||
'select' => 'COUNT(*) as attachments',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'a.attach_id IS NOT NULL AND p.topic_id='.$topic['tid'] . $_queued,
|
||||
'add_join' => array( array(
|
||||
'from' => array( 'attachments' => 'a' ),
|
||||
'where' => "a.attach_rel_id=p.pid AND a.attach_rel_module='post'",
|
||||
'type' => 'left' )
|
||||
)
|
||||
) );
|
||||
|
||||
if( $_count['attachments'] > $_limit )
|
||||
{
|
||||
$_pages = $this->registry->getClass('output')->generatePagination( array(
|
||||
'totalItems' => $_count['attachments'],
|
||||
'itemsPerPage' => $_limit,
|
||||
'currentStartValue' => $_st,
|
||||
'baseUrl' => "app=forums&module=forums&section=attach&tid={$topic['tid']}",
|
||||
) );
|
||||
}
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => 'p.pid, p.topic_id',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'a.attach_id IS NOT NULL AND p.topic_id='.$topic['tid'] . $_queued,
|
||||
'order' => 'p.pid ASC, a.attach_id ASC',
|
||||
'limit' => array( $_st, $_limit ),
|
||||
'add_join' => array( array(
|
||||
'select' => 'a.*',
|
||||
'from' => array( 'attachments' => 'a' ),
|
||||
'where' => "a.attach_rel_id=p.pid AND a.attach_rel_module='post'",
|
||||
'type' => 'left' )
|
||||
)
|
||||
) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $row = $this->DB->fetch() )
|
||||
{
|
||||
if ( IPSMember::checkPermissions('read', $topic['forum_id']) != TRUE )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! $row['attach_id'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$row['image'] = str_replace( 'folder_mime_types', 'mime_types', $attach_cache[ $row['attach_ext'] ]['atype_img'] );
|
||||
$row['short_name'] = IPSText::truncate( $row['attach_file'], 30 );
|
||||
$row['attach_date'] = $this->registry->getClass( 'class_localization')->getDate( $row['attach_date'], 'SHORT' );
|
||||
$row['real_size'] = IPSLib::sizeFormat( $row['attach_filesize'] );
|
||||
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
$this->output .= $this->registry->getClass('output')->getTemplate('forum')->forumAttachments( $topic['title'], $rows, $_pages );
|
||||
|
||||
return $this->output;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,827 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Board Index View
|
||||
* Last Updated: $Date: 2009-11-13 19:55:00 -0500 (Fri, 13 Nov 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 5405 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_forums_boards extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Main Execution Function
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$chat_html = '';
|
||||
$news_data = array();
|
||||
|
||||
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'public_boards' ) );
|
||||
|
||||
if (! $this->memberData['member_id'] )
|
||||
{
|
||||
$this->request['last_visit'] = time();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// What are we doing?
|
||||
//-----------------------------------------
|
||||
|
||||
$cat_data = $this->processAllCategories();
|
||||
|
||||
//-----------------------------------------
|
||||
// Add in show online users
|
||||
//-----------------------------------------
|
||||
|
||||
$active = $this->getActiveUserDetails();
|
||||
|
||||
//-----------------------------------------
|
||||
// Check for news forum.
|
||||
//-----------------------------------------
|
||||
|
||||
if ( isset( $this->registry->getClass('class_forums')->forum_by_id[ $this->settings['news_forum_id'] ]['newest_id']) AND $this->registry->getClass('class_forums')->forum_by_id[ $this->settings['news_forum_id'] ]['newest_id'] AND $this->settings['index_news_link'] )
|
||||
{
|
||||
$news_data = array(
|
||||
'forum_id' => $this->settings['news_forum_id'],
|
||||
'title' => stripslashes($this->registry->getClass('class_forums')->forum_by_id[ $this->settings['news_forum_id'] ]['newest_title']),
|
||||
'seo_title' => IPSText::makeSeoTitle( $this->registry->getClass('class_forums')->forum_by_id[ $this->settings['news_forum_id'] ]['newest_title'] ),
|
||||
'id' => $this->registry->getClass('class_forums')->forum_by_id[ $this->settings['news_forum_id'] ]['newest_id']
|
||||
);
|
||||
}
|
||||
|
||||
/* Check for sidebar hooks */
|
||||
$show_sidebar = false;
|
||||
|
||||
if( is_array( $this->caches['hooks']['templateHooks'] ) )
|
||||
{
|
||||
foreach( $this->caches['hooks']['templateHooks'] as $hook )
|
||||
{
|
||||
foreach( $hook as $c )
|
||||
{
|
||||
if( $c['id'] == 'side_blocks' && $c['skinGroup'] == 'skin_boards' && $c['skinFunction'] == 'boardIndexTemplate' )
|
||||
{
|
||||
$show_sidebar = true;
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Show the template
|
||||
//-----------------------------------------
|
||||
|
||||
$stats_info = $this->getTotalTextString();
|
||||
|
||||
$template = $this->registry->getClass('output')->getTemplate('boards')->boardIndexTemplate(
|
||||
$this->registry->getClass( 'class_localization')->getDate( $this->memberData['last_visit'], 'LONG' ),
|
||||
array_merge( $active, array( 'text' => $this->lang->words['total_word_string'],
|
||||
'posts' => $this->total_posts,
|
||||
'active' => $this->users_online,
|
||||
'members' => $this->total_members,
|
||||
'cut_off' => $this->settings['au_cutoff'],
|
||||
'info' => $stats_info ) ),
|
||||
$this->getCalendarEvents(),
|
||||
$this->getBirthdays(),
|
||||
$chat_html,
|
||||
$news_data,
|
||||
$cat_data,
|
||||
$show_sidebar );
|
||||
|
||||
//-----------------------------------------
|
||||
// Print as normal
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('output')->setTitle( $this->settings['board_name'] );
|
||||
$this->registry->getClass('output')->addContent( $template );
|
||||
$this->registry->getClass('output')->sendOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an array of category data
|
||||
*
|
||||
* @access public
|
||||
* @param integer $fid ID of the forum to get sub forums for
|
||||
* @return array
|
||||
**/
|
||||
public function showSubForums( $fid )
|
||||
{
|
||||
/* INIT */
|
||||
$temp_html = "";
|
||||
$sub_output = "";
|
||||
$return_cat_data = array();
|
||||
$temp_cat_data = array();
|
||||
|
||||
if ( isset( $this->registry->getClass('class_forums')->forum_cache[ $fid ] ) AND is_array( $this->registry->getClass('class_forums')->forum_cache[ $fid ] ) )
|
||||
{
|
||||
$cat_data = $this->registry->getClass('class_forums')->forum_by_id[ $fid ];
|
||||
|
||||
foreach( $this->registry->getClass('class_forums')->forum_cache[ $fid ] as $forum_data )
|
||||
{
|
||||
$forum_data['_queued_img'] = isset($forum_data['_queued_img'] ) ? $forum_data['_queued_img'] : '';
|
||||
$forum_data['_queued_info'] = isset($forum_data['_queued_info'] ) ? $forum_data['_queued_info'] : '';
|
||||
$forum_data['show_subforums'] = isset($forum_data['show_subforums'] ) ? $forum_data['show_subforums'] : '';
|
||||
$forum_data['last_unread'] = isset($forum_data['last_unread'] ) ? $forum_data['last_unread'] : '';
|
||||
|
||||
//-----------------------------------------
|
||||
// Get all subforum stats
|
||||
// and calculate
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->settings['forum_cache_minimum'] AND $this->settings['forum_cache_minimum'] )
|
||||
{
|
||||
$forum_data['description'] = "<!--DESCRIPTION:{$forum_data['id']}-->";
|
||||
$need_desc[] = $forum_data['id'];
|
||||
}
|
||||
|
||||
if ( $forum_data['redirect_on'] )
|
||||
{
|
||||
$forum_data['redirect_hits'] = $this->registry->getClass('class_localization')->formatNumber( $forum_data['redirect_hits'] );
|
||||
|
||||
$forum_data['redirect_target'] = isset($forum_data['redirect_target']) ? $forum_data['redirect_target'] : '_parent';
|
||||
$temp_cat_data[ $forum_data['id'] ] = $forum_data;
|
||||
}
|
||||
else
|
||||
{
|
||||
$temp_cat_data[ $forum_data['id'] ] = $this->registry->getClass('class_forums')->forumsFormatLastinfo( $this->registry->getClass('class_forums')->forumsCalcChildren( $forum_data['id'], $forum_data ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( count( $temp_cat_data ) )
|
||||
{
|
||||
$return_cat_data[] = array( 'cat_data' => $cat_data,
|
||||
'forum_data' => $temp_cat_data );
|
||||
}
|
||||
|
||||
return $return_cat_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an array of category data for output
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
**/
|
||||
public function processAllCategories()
|
||||
{
|
||||
/* INIT */
|
||||
$return_cat_data = array();
|
||||
$need_desc = array();
|
||||
$root = array();
|
||||
$parent = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Want to view categories?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! empty( $this->request['c'] ) )
|
||||
{
|
||||
foreach( explode( ",", $this->request['c'] ) as $c )
|
||||
{
|
||||
$c = intval( $c );
|
||||
$i = $this->registry->getClass('class_forums')->forum_by_id[ $c ]['parent_id'];
|
||||
|
||||
$root[ $i ] = $i;
|
||||
$parent[ $c ] = $c;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! count( $root ) )
|
||||
{
|
||||
$root[] = 'root';
|
||||
}
|
||||
|
||||
foreach( $root as $root_id )
|
||||
{
|
||||
if( is_array( $this->registry->class_forums->forum_cache[ $root_id ] ) and count( $this->registry->class_forums->forum_cache[ $root_id ] ) )
|
||||
{
|
||||
foreach( $this->registry->class_forums->forum_cache[ $root_id ] as $id => $forum_data )
|
||||
{
|
||||
$temp_cat_data = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Only showing certain root forums?
|
||||
//-----------------------------------------
|
||||
|
||||
if( count( $parent ) )
|
||||
{
|
||||
if( ! in_array( $id, $parent ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$cat_data = $forum_data;
|
||||
|
||||
if( isset( $this->registry->class_forums->forum_cache[ $forum_data['id'] ] ) AND is_array( $this->registry->class_forums->forum_cache[ $forum_data['id'] ] ) )
|
||||
{
|
||||
foreach( $this->registry->class_forums->forum_cache[ $forum_data['id'] ] as $forum_data )
|
||||
{
|
||||
$forum_data['show_subforums'] = isset($forum_data['show_subforums']) ? $forum_data['show_subforums'] : '';
|
||||
$forum_data['last_unread'] = isset($forum_data['last_unread']) ? $forum_data['last_unread'] : '';
|
||||
|
||||
//-----------------------------------------
|
||||
// Get all subforum stats
|
||||
// and calculate
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $forum_data['redirect_on'] )
|
||||
{
|
||||
$forum_data['redirect_target'] = isset($forum_data['redirect_target']) ? $forum_data['redirect_target'] : '_parent';
|
||||
|
||||
$temp_cat_data[ $forum_data['id'] ] = $forum_data;
|
||||
}
|
||||
else
|
||||
{
|
||||
$temp_cat_data[ $forum_data['id'] ] = $this->registry->class_forums->forumsFormatLastinfo( $this->registry->class_forums->forumsCalcChildren( $forum_data['id'], $forum_data ) );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ( count( $temp_cat_data ) )
|
||||
{
|
||||
$return_cat_data[] = array( 'cat_data' => $cat_data,
|
||||
'forum_data' => $temp_cat_data );
|
||||
}
|
||||
|
||||
$temp_cat_data = array();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $return_cat_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of active users
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
**/
|
||||
public function getActiveUserDetails()
|
||||
{
|
||||
$active = array( 'TOTAL' => 0 ,
|
||||
'NAMES' => array(),
|
||||
'GUESTS' => 0 ,
|
||||
'MEMBERS' => 0 ,
|
||||
'ANON' => 0 ,
|
||||
);
|
||||
|
||||
if ( $this->settings['show_active'] )
|
||||
{
|
||||
if( !$this->settings['au_cutoff'] )
|
||||
{
|
||||
$this->settings['au_cutoff'] = 15;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the users from the DB
|
||||
//-----------------------------------------
|
||||
|
||||
$cut_off = $this->settings['au_cutoff'] * 60;
|
||||
$time = time() - $cut_off;
|
||||
$rows = array();
|
||||
$ar_time = time();
|
||||
|
||||
if ( $this->memberData['member_id'] )
|
||||
{
|
||||
$rows = array( $ar_time.'.'.md5( microtime() ) => array(
|
||||
'id' => 0,
|
||||
'login_type' => substr( $this->memberData['login_anonymous'], 0, 1),
|
||||
'running_time' => $ar_time,
|
||||
'seo_name' => $this->memberData['members_seo_name'],
|
||||
'member_id' => $this->memberData['member_id'],
|
||||
'member_name' => $this->memberData['members_display_name'],
|
||||
'member_group' => $this->memberData['member_group_id']
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => 'id, member_id, member_name, seo_name, login_type, running_time, member_group, uagent_type',
|
||||
'from' => 'sessions',
|
||||
'where' => "running_time > $time",
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
//-----------------------------------------
|
||||
// FETCH...
|
||||
//-----------------------------------------
|
||||
|
||||
while ( $r = $this->DB->fetch() )
|
||||
{
|
||||
$rows[ $r['running_time'].'.'.$r['id'] ] = $r;
|
||||
}
|
||||
|
||||
krsort( $rows );
|
||||
|
||||
//-----------------------------------------
|
||||
// cache all printed members so we
|
||||
// don't double print them
|
||||
//-----------------------------------------
|
||||
|
||||
$cached = array();
|
||||
|
||||
foreach ( $rows as $result )
|
||||
{
|
||||
$last_date = $this->registry->getClass('class_localization')->getTime( $result['running_time'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Bot?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( isset( $result['uagent_type'] ) && $result['uagent_type'] == 'search' )
|
||||
{
|
||||
/* Skipping bot? */
|
||||
if ( ! $this->settings['spider_active'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Seen bot of this type yet?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $cached[ $result['member_name'] ] )
|
||||
{
|
||||
if ( $this->settings['spider_anon'] )
|
||||
{
|
||||
if ( $this->memberData['g_access_cp'] )
|
||||
{
|
||||
$active['NAMES'][] = IPSLib::makeNameFormatted( $result['member_name'], $result['member_group'] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$active['NAMES'][] = IPSLib::makeNameFormatted( $result['member_name'], $result['member_group'] );
|
||||
}
|
||||
|
||||
$cached[ $result['member_name'] ] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Yup, count others as guest
|
||||
//-----------------------------------------
|
||||
|
||||
$active['GUESTS']++;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Guest?
|
||||
//-----------------------------------------
|
||||
|
||||
else if ( ! $result['member_id'] OR ! $result['member_name'] )
|
||||
{
|
||||
$active['GUESTS']++;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Member?
|
||||
//-----------------------------------------
|
||||
|
||||
else
|
||||
{
|
||||
if ( empty( $cached[ $result['member_id'] ] ) )
|
||||
{
|
||||
$cached[ $result['member_id'] ] = 1;
|
||||
|
||||
$result['member_name'] = IPSLib::makeNameFormatted( $result['member_name'], $result['member_group'] );
|
||||
|
||||
if ( ! $this->settings['disable_anonymous'] AND $result['login_type'] )
|
||||
{
|
||||
if ( $this->memberData['g_access_cp'] and ($this->settings['disable_admin_anon'] != 1) )
|
||||
{
|
||||
$active['NAMES'][] = "<a href='" . $this->registry->getClass('output')->buildSEOUrl( "showuser={$result['member_id']}", 'public', $result['seo_name'], 'showuser' ) . "' title='$last_date'>{$result['member_name']}</a>*";
|
||||
$active['ANON']++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$active['ANON']++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$active['MEMBERS']++;
|
||||
$active['NAMES'][] = "<a href='" . $this->registry->getClass('output')->buildSEOUrl( "showuser={$result['member_id']}", 'public', $result['seo_name'], 'showuser' ) ."' title='$last_date'>{$result['member_name']}</a>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$active['TOTAL'] = $active['MEMBERS'] + $active['GUESTS'] + $active['ANON'];
|
||||
|
||||
$this->users_online = $active['TOTAL'];
|
||||
}
|
||||
|
||||
$this->lang->words['active_users'] = sprintf( $this->lang->words['active_users'], $this->settings['au_cutoff'] );
|
||||
|
||||
return $active;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string of calendar events
|
||||
*
|
||||
* @access public
|
||||
* @return mixed HTML string, or false
|
||||
**/
|
||||
public function getCalendarEvents()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Are we viewing the calendar?
|
||||
//-----------------------------------------
|
||||
|
||||
if( $this->settings['show_calendar'] AND IPSLib::appIsInstalled('calendar') )
|
||||
{
|
||||
/* Get the current day, month, and year */
|
||||
$a = explode( ',', gmdate( 'Y,n,j,G,i,s', time() + $this->registry->class_localization->getTimeOffset() ) );
|
||||
|
||||
$day = $a[2];
|
||||
$month = $a[1];
|
||||
$year = $a[0];
|
||||
|
||||
/* Check the calendar limit */
|
||||
$this->settings['calendar_limit'] = intval( $this->settings['calendar_limit'] ) < 2 ? 1 : intval( $this->settings['calendar_limit'] );
|
||||
|
||||
$our_unix = gmmktime( 0, 0, 0, $month, $day, $year);
|
||||
$max_date = $our_unix + ($this->settings['calendar_limit'] * 86400);
|
||||
$events = array();
|
||||
$show_events = array();
|
||||
|
||||
if( $this->memberData['org_perm_id'] )
|
||||
{
|
||||
$member_permission_groups = explode( ",", IPSText::cleanPermString( $this->memberData['org_perm_id'] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$cache = $this->caches['group_cache'];
|
||||
$member_permission_groups = explode( ",", IPSText::cleanPermString( $this->memberData['g_perm_id'] ) );
|
||||
|
||||
if( $this->memberData['mgroup_others'] )
|
||||
{
|
||||
$this->memberData['mgroup_others'] = IPSText::cleanPermString($this->memberData['mgroup_others']);
|
||||
|
||||
$mgroup_others = explode( ",", $this->memberData['mgroup_others'] );
|
||||
|
||||
if( count($mgroup_others) )
|
||||
{
|
||||
foreach( $mgroup_others as $member_group_id )
|
||||
{
|
||||
if( $member_group_id )
|
||||
{
|
||||
$member_permission_groups = array_merge( $member_permission_groups, explode( ",", IPSText::cleanPermString( $cache[$member_group_id]['g_perm_id'] ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( is_array( $this->caches['calendar'] ) AND count( $this->caches['calendar'] ) )
|
||||
{
|
||||
foreach( $this->caches['calendar'] as $u )
|
||||
{
|
||||
$set_offset = 0;
|
||||
|
||||
if( $u['event_timeset'] && !($u['event_recurring'] == 0 AND $u['event_unix_to']) )
|
||||
{
|
||||
$set_offset = $this->memberData['time_offset'] ? $this->memberData['time_offset'] * 3600 : 0;
|
||||
}
|
||||
|
||||
$u['_unix_from'] = $u['event_unix_from'] - $set_offset;
|
||||
$u['_unix_to'] = $u['event_unix_to'] - $set_offset;
|
||||
|
||||
//-----------------------------------------
|
||||
// Private?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $u['event_private'] == 1 and $this->memberData['member_id'] != $u['event_member_id'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Got perms?
|
||||
//-----------------------------------------
|
||||
|
||||
if( $u['event_perms'] != "*" )
|
||||
{
|
||||
$event_perms = explode( ",", IPSText::cleanPermString( $u['event_perms'] ) );
|
||||
|
||||
$check = 0;
|
||||
|
||||
if( count($event_perms) )
|
||||
{
|
||||
foreach( $event_perms as $mgroup_perm )
|
||||
{
|
||||
if( in_array( $mgroup_perm, $member_permission_groups ) )
|
||||
{
|
||||
$check = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( !$check )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Got calendar perms?
|
||||
//-----------------------------------------
|
||||
|
||||
if( $u['_perm_read'] != "*" )
|
||||
{
|
||||
$read_perms = explode( ",", IPSText::cleanPermString( $u['_perm_read'] ) );
|
||||
|
||||
$check = 0;
|
||||
|
||||
if( count( $read_perms ) )
|
||||
{
|
||||
foreach( $read_perms as $mgroup_perm )
|
||||
{
|
||||
if( in_array( $mgroup_perm, $member_permission_groups ) )
|
||||
{
|
||||
$check = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( !$check )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// In range?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $u['event_recurring'] == 0 AND ( ( $u['event_unix_to'] >= $our_unix AND $u['event_unix_from'] <= $max_date )
|
||||
OR ( $u['event_unix_to'] == 0 AND $u['event_unix_from'] >= $our_unix AND $u['event_unix_from'] <= $max_date ) ) )
|
||||
{
|
||||
$u['event_activetime'] = $u['_unix_from'];
|
||||
$events[ str_pad( $u['event_unix_from'].$u['event_id'], 15, "0" ) ] = $u;
|
||||
}
|
||||
elseif( $u['event_recurring'] > 0 )
|
||||
{
|
||||
$cust_range_s = $u['event_unix_from'];
|
||||
|
||||
while( $cust_range_s < $u['event_unix_to'])
|
||||
{
|
||||
if( $cust_range_s >= $our_unix AND $cust_range_s <= $max_date )
|
||||
{
|
||||
/* Special case for months, to take into account different numbers of days */
|
||||
if ( $u['event_recurring'] == "2" )
|
||||
{
|
||||
$u['event_activetime'] = gmmktime( 1, 1, 1, gmdate( 'n', $cust_range_s ), gmdate( 'j', $u['event_unix_from'] ), gmdate( 'Y', $cust_range_s ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$u['event_activetime'] = $cust_range_s;
|
||||
}
|
||||
$events[ str_pad( $cust_range_s.$u['event_id'], 15, "0" ) ] = $u;
|
||||
}
|
||||
|
||||
if( $u['event_recurring'] == "1" )
|
||||
{
|
||||
$cust_range_s += 604800;
|
||||
}
|
||||
elseif ( $u['event_recurring'] == "2" )
|
||||
{
|
||||
$cust_range_s += 2628000;
|
||||
}
|
||||
else
|
||||
{
|
||||
$cust_range_s += 31536000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Print...
|
||||
//-----------------------------------------
|
||||
|
||||
ksort($events);
|
||||
|
||||
foreach( $events as $event )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Recurring?
|
||||
//-----------------------------------------
|
||||
|
||||
$c_time = '';
|
||||
$c_time = gmstrftime( '%x', $event['event_activetime'] );
|
||||
$url = $this->registry->output->buildSEOUrl( "app=calendar&module=calendar&cal_id={$event['event_calendar_id']}&do=showevent&event_id={$event['event_id']}", 'public', $event['event_title'], 'event' );
|
||||
|
||||
$show_events[] = "<a href='{$url}' title='$c_time'>".$event['event_title']."</a>";
|
||||
}
|
||||
|
||||
$this->lang->words['calender_f_title'] = sprintf( $this->lang->words['calender_f_title'], $this->settings['calendar_limit'] );
|
||||
|
||||
if ( count($show_events) > 0 )
|
||||
{
|
||||
$event_string = $show_events; // Change in 3.0 by rikki: Just pass the array for the template to deal with
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! $this->settings['autohide_calendar'] )
|
||||
{
|
||||
$event_string = $this->lang->words['no_calendar_events'];
|
||||
}
|
||||
}
|
||||
|
||||
return $event_string;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of birthday information
|
||||
*
|
||||
* @access public
|
||||
* @return mixed Array of birthday information, or false
|
||||
**/
|
||||
public function getBirthdays()
|
||||
{
|
||||
if ($this->settings['show_birthdays'] or $this->settings['show_calendar'] )
|
||||
{
|
||||
$a = explode( ',', gmdate( 'Y,n,j,G,i,s', time() + $this->registry->getClass( 'class_localization')->getTimeOffset() ) );
|
||||
|
||||
$day = $a[2];
|
||||
$month = $a[1];
|
||||
$year = $a[0];
|
||||
|
||||
$birthstring = "";
|
||||
$count = 0;
|
||||
$users = array();
|
||||
|
||||
if ( $this->settings['show_birthdays'] )
|
||||
{
|
||||
if ( is_array($this->caches['birthdays']) AND count( $this->caches['birthdays'] ) )
|
||||
{
|
||||
foreach( $this->caches['birthdays'] as $u )
|
||||
{
|
||||
if ( $u['bday_day'] == $day and $u['bday_month'] == $month )
|
||||
{
|
||||
$users[] = $u;
|
||||
}
|
||||
else if( $day == 28 && $month == 2 && !date("L") )
|
||||
{
|
||||
if ( $u['bday_day'] == "29" and $u['bday_month'] == $month )
|
||||
{
|
||||
$users[] = $u;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Spin and print...
|
||||
//-----------------------------------------
|
||||
|
||||
foreach ( $users as $user )
|
||||
{
|
||||
/* Age */
|
||||
$pyear = 0;
|
||||
|
||||
if( $user['bday_year'] && $user['bday_year'] > 0 )
|
||||
{
|
||||
$pyear = $year - $user['bday_year'];
|
||||
}
|
||||
|
||||
$birthstring[] = $this->registry->getClass('output')->getTemplate('boards')->birthday( $user, $pyear );
|
||||
|
||||
$count++;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Fix up string...
|
||||
//-----------------------------------------
|
||||
|
||||
$lang = $this->lang->words['no_birth_users'];
|
||||
|
||||
if ($count > 0)
|
||||
{
|
||||
$lang = ($count > 1) ? $this->lang->words['birth_users'] : $this->lang->words['birth_user'];
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return array( 'count' => $count, 'lang' => $lang, 'users' => $birthstring );
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of board stats
|
||||
*
|
||||
* @access public
|
||||
* @return string Stats string
|
||||
**/
|
||||
public function getTotalTextString()
|
||||
{
|
||||
/* INIT */
|
||||
$stats_output = array();
|
||||
|
||||
if ( $this->settings['show_totals'] )
|
||||
{
|
||||
if ( ! is_array( $this->caches['stats'] ) )
|
||||
{
|
||||
$this->cache->setCache( 'stats', array(), array( 'array' => 1 ) );
|
||||
}
|
||||
|
||||
$stats = $this->caches['stats'];
|
||||
|
||||
//-----------------------------------------
|
||||
// We need to determine if we have the most users ever online if we aren't
|
||||
// showing active users in the stats block
|
||||
//-----------------------------------------
|
||||
|
||||
if( !$this->users_online )
|
||||
{
|
||||
$cut_off = $this->settings['au_cutoff'] * 60;
|
||||
$time = time() - $cut_off;
|
||||
$total = $this->DB->buildAndFetch( array( 'select' => 'count(*) as users_online', 'from' => 'sessions', 'where' => "running_time > $time" ) );
|
||||
|
||||
$this->users_online = $total['users_online'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Update the most active count if needed
|
||||
//-----------------------------------------
|
||||
|
||||
if ($this->users_online > $stats['most_count'])
|
||||
{
|
||||
$stats['most_count'] = $this->users_online;
|
||||
$stats['most_date'] = time();
|
||||
|
||||
$this->cache->setCache( 'stats', $stats, array( 'array' => 1 ) );
|
||||
}
|
||||
|
||||
$stats_output['most_time'] = $this->registry->getClass( 'class_localization')->getDate( $stats['most_date'], 'LONG' );
|
||||
$stats_output['most_online'] = $this->registry->getClass('class_localization')->formatNumber($stats['most_count']);
|
||||
|
||||
$this->lang->words['most_online'] = str_replace( "<#NUM#>" , $stats_output['most_online'] , $this->lang->words['most_online'] );
|
||||
$this->lang->words['most_online'] = str_replace( "<#DATE#>", $stats_output['most_time'] , $this->lang->words['most_online'] );
|
||||
|
||||
$stats_output['total_posts'] = $stats['total_replies'] + $stats['total_topics'];
|
||||
|
||||
$stats_output['total_posts'] = $this->registry->getClass('class_localization')->formatNumber($stats_output['total_posts']);
|
||||
$stats_output['mem_count'] = $this->registry->getClass('class_localization')->formatNumber($stats['mem_count']);
|
||||
|
||||
$this->total_posts = $stats_output['total_posts'];
|
||||
$this->total_members = $stats_output['mem_count'];
|
||||
|
||||
$stats_output['last_mem_seo'] = $stats['last_mem_name_seo'] ? $stats['last_mem_name_seo'] : IPSText::makeSeoTitle( $stats['last_mem_name'] );
|
||||
$stats_output['last_mem_link'] = $this->registry->output->formatUrl( $this->registry->output->buildUrl( "showuser=".$stats['last_mem_id'], 'public' ), $stats_output['last_mem_seo'], 'showuser' );
|
||||
$stats_output['last_mem_name'] = $stats['last_mem_name'];
|
||||
$stats_output['last_mem_id'] = $stats['last_mem_id'];
|
||||
|
||||
$this->lang->words['total_word_string'] = str_replace( "<#posts#>" , $stats_output['total_posts'] , $this->lang->words['total_word_string'] );
|
||||
$this->lang->words['total_word_string'] = str_replace( "<#reg#>" , $stats_output['mem_count'] , $this->lang->words['total_word_string'] );
|
||||
$this->lang->words['total_word_string'] = str_replace( "<#mem#>" , $stats_output['last_mem_name'] , $this->lang->words['total_word_string'] );
|
||||
$this->lang->words['total_word_string'] = str_replace( "<#link#>" , $stats_output['last_mem_link'] , $this->lang->words['total_word_string'] );
|
||||
}
|
||||
|
||||
return $stats_output;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Default section file for forums public module
|
||||
* Last Updated: $LastChangedDate: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 14th May 2003
|
||||
* @version $Rev: 4948 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Very simply returns the default section if one is not
|
||||
* passed in the URL
|
||||
*/
|
||||
|
||||
$DEFAULT_SECTION = 'boards';
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Bounces a user to the right post
|
||||
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 4948 $
|
||||
* @since 14th April 2004
|
||||
*
|
||||
* | > Interesting Fact: I've had iTunes playing every Radiohead tune
|
||||
* | > I own for about a week now. Thats a lot of repeats. Got some
|
||||
* | > cool rare tracks though. Every album+rare+b sides = 6.7 hours
|
||||
* | > music. Not bad. I need to get our more. No, you can't take the
|
||||
* | > laptop with you - nerd.
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_forums_findpost extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Find a post
|
||||
// Don't really need to check perms 'cos topic
|
||||
// will do that for us. Woohoop
|
||||
//-----------------------------------------
|
||||
|
||||
$pid = intval($this->request['pid']);
|
||||
|
||||
if ( ! $pid )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'findpost_missing_pid', 10331 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get topic...
|
||||
//-----------------------------------------
|
||||
|
||||
$post = $this->DB->buildAndFetch( array( 'select' => 'p.*',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => 'p.pid=' . $pid,
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 't.title_seo',
|
||||
'from' => array( 'topics' => 't' ),
|
||||
'where' => 't.tid=p.topic_id',
|
||||
'type' => 'left',
|
||||
)
|
||||
)
|
||||
) );
|
||||
|
||||
if ( ! $post['topic_id'] )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'findpost_missing_topic', 10332 );
|
||||
}
|
||||
|
||||
$cposts = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as posts', 'from' => 'posts', 'where' => "topic_id={$post['topic_id']} AND pid <= {$pid}" ) );
|
||||
|
||||
if ( (($cposts['posts']) % $this->settings['display_max_posts']) == 0 )
|
||||
{
|
||||
$pages = ($cposts['posts']) / $this->settings['display_max_posts'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$number = ( ($cposts['posts']) / $this->settings['display_max_posts'] );
|
||||
$pages = ceil( $number);
|
||||
}
|
||||
|
||||
$st = ($pages - 1) * $this->settings['display_max_posts'];
|
||||
$hl = $this->request['hl'] ? '&hl=' . trim( $this->request['hl'] ) : '';
|
||||
|
||||
$url = $this->registry->output->buildSEOUrl( "showtopic=" . $post['topic_id'] . "&st={$st}&p={$pid}" . $hl . "&#entry" . $pid, 'public', $post['title_seo'], 'showtopic' );
|
||||
|
||||
$this->registry->getClass('output')->silentRedirect( $url );
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Forums -> Mark As Read command class
|
||||
* Last Updated: $Date: 2009-09-14 08:10:06 -0400 (Mon, 14 Sep 2009) $
|
||||
*
|
||||
* @author Matt Mecham
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since Tuesday 1st March 2005 (11:52)
|
||||
* @version $Rev: 5108 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_forums_markasread extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Main execution point
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// What are we doing?
|
||||
//-----------------------------------------
|
||||
|
||||
switch( $this->request['marktype'] )
|
||||
{
|
||||
default:
|
||||
case 'forum':
|
||||
return $this->markForumAsRead();
|
||||
break;
|
||||
case 'all':
|
||||
return $this->markBoardAsRead();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark all forums and topics as read
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function markBoardAsRead()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->request['k'] != $this->member->form_hash )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'no_permission', 20312 );
|
||||
}
|
||||
|
||||
/* Turn off instant updates and write back tmp markers in destructor */
|
||||
$this->registry->classItemMarking->disableInstantSave();
|
||||
|
||||
//-----------------------------------------
|
||||
// Reset board markers
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( ipsRegistry::$applications as $app_dir => $data )
|
||||
{
|
||||
if ( isset( $data['app_enabled'] ) AND $data['app_enabled'] )
|
||||
{
|
||||
$this->registry->classItemMarking->markAppAsRead( $app_dir );
|
||||
}
|
||||
}
|
||||
|
||||
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'act=idx', 'false' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks the specified forum as read
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
**/
|
||||
public function markForumAsRead()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$forum_id = intval( $this->request['forumid'] );
|
||||
$return_to_id = intval( $this->request['returntoforumid'] );
|
||||
$forum_data = $this->registry->getClass('class_forums')->forum_by_id[ $forum_id ];
|
||||
$children = $this->registry->getClass('class_forums')->forumsGetChildren( $forum_data['id'] );
|
||||
$save = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $forum_data['id'] )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'markread_no_id', 10340 );
|
||||
}
|
||||
|
||||
/* Turn off instant updates and write back tmp markers in destructor */
|
||||
$this->registry->classItemMarking->disableInstantSave();
|
||||
|
||||
//-----------------------------------------
|
||||
// Come from the index? Add kids
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->request['i'] )
|
||||
{
|
||||
if ( is_array( $children ) and count($children) )
|
||||
{
|
||||
foreach( $children as $id )
|
||||
{
|
||||
$this->registry->classItemMarking->markRead( array( 'forumID' => $id ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Add in the current forum...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->classItemMarking->markRead( array( 'forumID' => $forum_id ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Where are we going back to?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $return_to_id )
|
||||
{
|
||||
$parent_data = $this->registry->getClass('class_forums')->forum_by_id[ $return_to_id ];
|
||||
|
||||
//-----------------------------------------
|
||||
// Its a sub forum, lets go redirect to parent forum
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url']."showforum=".$return_to_id, $parent_data['name_seo'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'act=idx', 'false' );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,518 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Print Topic
|
||||
* Last Updated: $Date: 2009-11-24 17:16:43 -0500 (Tue, 24 Nov 2009) $
|
||||
*
|
||||
* @author $Author: josh $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 5465 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_forums_printtopic extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Temporary output
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $output = "";
|
||||
|
||||
/**
|
||||
* Forum data
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private $forum = array();
|
||||
|
||||
/**
|
||||
* Topic data
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private $topic = array();
|
||||
|
||||
private $attach_pids;
|
||||
|
||||
/**
|
||||
* Main execution function
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry Object
|
||||
* @return void
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$_moderator = $this->memberData['forumsModeratorData'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Compile the language file
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'public_printpage' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check the input
|
||||
//-----------------------------------------
|
||||
|
||||
$this->request['t'] = intval($this->request['t'] );
|
||||
$this->request['f'] = intval($this->request['f'] );
|
||||
|
||||
if ( ! $this->request['t'] or ! $this->request['f'] )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'missing_files' );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the forum info based on the
|
||||
// forum ID, get the category name, ID,
|
||||
// and get the topic details
|
||||
//-----------------------------------------
|
||||
|
||||
$this->topic = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'topics', 'where' => "tid=" . $this->request['t'] ) );
|
||||
$this->forum = $this->registry->getClass('class_forums')->forum_by_id[ $this->topic['forum_id'] ];
|
||||
|
||||
//-----------------------------------------
|
||||
// Error out if we can not find the forum
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $this->forum['id'] )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'missing_files' );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Error out if we can not find the topic
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $this->topic['tid'] )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'missing_files' );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check viewing permissions, private forums,
|
||||
// password forums, etc
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ( ! $this->topic['pinned'] ) and ( ! $this->memberData['g_other_topics'] ) )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'no_view_topic' );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check access
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('class_forums')->forumsCheckAccess( $this->forum['id'], 1, 'topic' );
|
||||
|
||||
if ( ! $this->topic['approved'] AND !( $this->memberData['g_is_supmod'] OR $_moderator[ $this->topic['forum_id'] ]['topic_q'] ) )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'no_view_topic' );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Main logic engine
|
||||
//-----------------------------------------
|
||||
|
||||
if ($this->request['client'] == 'choose')
|
||||
{
|
||||
$this->page_title = $this->topic['title'];
|
||||
|
||||
$this->nav = array( array( $this->forum['name'], "showforum={$this->forum['id']}" ),
|
||||
array( $this->topic['title'], "showtopic={$this->topic['tid']}" )
|
||||
);
|
||||
|
||||
|
||||
$this->output = $this->registry->getClass('output')->getTemplate('printpage')->choose_form($this->forum['id'], $this->topic['tid'], $this->topic['title']);
|
||||
|
||||
$this->registry->getClass('output')->setTitle( $this->page_title );
|
||||
$this->registry->getClass('output')->addContent( $this->output );
|
||||
|
||||
if( is_array( $this->nav ) AND count( $this->nav ) )
|
||||
{
|
||||
foreach( $this->nav as $_id => $_nav )
|
||||
{
|
||||
$this->registry->getClass('output')->addNavigation( $_nav[0], $_nav[1] );
|
||||
}
|
||||
}
|
||||
|
||||
$this->registry->getClass('output')->sendOutput();
|
||||
|
||||
exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$header = 'text/html';
|
||||
$ext = '.html';
|
||||
|
||||
switch ($this->request['client'])
|
||||
{
|
||||
case 'printer':
|
||||
$header = 'text/html';
|
||||
$ext = '.html';
|
||||
break;
|
||||
case 'html':
|
||||
$header = 'unknown/unknown';
|
||||
$ext = '.html';
|
||||
break;
|
||||
default:
|
||||
$header = 'application/msword';
|
||||
$ext = '.doc';
|
||||
}
|
||||
}
|
||||
|
||||
$title = substr( str_replace( " ", "_" , preg_replace( "/&(lt|gt|quot|#124|#036|#33|#39);/", "", $this->topic['title'] ) ), 0, 100);
|
||||
|
||||
@header( "Content-type: {$header};charset=" . IPS_DOC_CHAR_SET );
|
||||
|
||||
if ( $this->request['client'] != 'printer' )
|
||||
{
|
||||
@header("Content-Disposition: attachment; filename=$title".$ext);
|
||||
}
|
||||
|
||||
print $this->getPosts();
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the posts to be printed/downloaded
|
||||
*
|
||||
* @access protected
|
||||
* @return string
|
||||
**/
|
||||
protected function getPosts()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Render the page top
|
||||
//-----------------------------------------
|
||||
|
||||
$posts_html = $this->registry->getClass('output')->getTemplate('printpage')->pp_header( $this->forum['name'], $this->topic['title'], $this->topic['starter_name'] , $this->forum['id'], $this->topic['tid'] );
|
||||
|
||||
$max_posts = 300;
|
||||
$attach_pids = array();
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => 'p.*',
|
||||
'from' => array( 'posts' => 'p' ),
|
||||
'where' => "p.topic_id={$this->topic['tid']} and p.queued=0",
|
||||
'order' => 'p.pid',
|
||||
'limit' => array( 0, $max_posts ),
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 'm.members_display_name',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=p.author_id',
|
||||
'type' => 'left'
|
||||
)
|
||||
)
|
||||
) );
|
||||
$this->DB->execute();
|
||||
|
||||
//-----------------------------------------
|
||||
// Loop through to pick out the correct member IDs.
|
||||
// and push the post info into an array - maybe in the future
|
||||
// we can add page spans, or maybe save to a PDF file?
|
||||
//-----------------------------------------
|
||||
|
||||
$the_posts = array();
|
||||
$mem_ids = array();
|
||||
$member_array = array();
|
||||
$cached_members = array();
|
||||
$pids = array();
|
||||
|
||||
while ( $i = $this->DB->fetch() )
|
||||
{
|
||||
$the_posts[ $i['pid' ]] = $i;
|
||||
$this->attach_pids[] = $i['pid'];
|
||||
|
||||
if ( $i['author_id'] )
|
||||
{
|
||||
$mem_ids[ $i['author_id'] ] = $i['author_id'];
|
||||
}
|
||||
}
|
||||
|
||||
$the_posts = $this->_parseAttachments( $the_posts, $this->attach_pids );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the member profiles needed for this topic
|
||||
//-----------------------------------------
|
||||
|
||||
if ( count( $mem_ids ) )
|
||||
{
|
||||
$this->DB->build( array(
|
||||
'select' => 'm.*',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id IN ('.implode( ',', $mem_ids ).')',
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 'g.*',
|
||||
'from' => array( 'groups' => 'g' ),
|
||||
'where' => 'g.g_id=m.member_group_id',
|
||||
'type' => 'left'
|
||||
)
|
||||
)
|
||||
) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
while( $m = $this->DB->fetch() )
|
||||
{
|
||||
$member_array[ $m['member_id'] ] = $m;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Format and print out the topic list
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $the_posts as $row )
|
||||
{
|
||||
$poster = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the member info. We parse the data and cache it.
|
||||
// It's likely that the same member posts several times in
|
||||
// one page, so it's not efficient to keep parsing the same
|
||||
// data
|
||||
//-----------------------------------------
|
||||
|
||||
if( $row['author_id'] != 0 )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Is it in the hash?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( isset($cached_members[ $row['author_id'] ]) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Ok, it's already cached, read from it
|
||||
//-----------------------------------------
|
||||
|
||||
$poster = $cached_members[ $row['author_id'] ];
|
||||
$row['name_css'] = 'normalname';
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Ok, it's NOT in the cache, is it a member thats
|
||||
// not been deleted?
|
||||
//-----------------------------------------
|
||||
|
||||
if ($member_array[ $row['author_id'] ])
|
||||
{
|
||||
$row['name_css'] = 'normalname';
|
||||
$poster = $member_array[ $row['author_id'] ];
|
||||
|
||||
//-----------------------------------------
|
||||
// Add it to the cached list
|
||||
//-----------------------------------------
|
||||
|
||||
$cached_members[ $row['author_id'] ] = $poster;
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// It's probably a deleted member, so treat them as a guest
|
||||
//-----------------------------------------
|
||||
|
||||
$poster = IPSMember::setUpGuest( $row['author_id'] );
|
||||
$row['name_css'] = 'unreg';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// It's definately a guest...
|
||||
//-----------------------------------------
|
||||
|
||||
$poster = IPSMember::setUpGuest( $row['author_name'] );
|
||||
$row['name_css'] = 'unreg';
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
$row['post'] = preg_replace( "/<!--EDIT\|(.+?)\|(.+?)-->/", "", $row['post'] );
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
$row['post_date'] = $this->registry->getClass( 'class_localization')->getDate( $row['post_date'], 'LONG', 1 );
|
||||
|
||||
//-----------------------------------------
|
||||
// Quoted attachments?
|
||||
//-----------------------------------------
|
||||
|
||||
$attach_pids[ $row['pid'] ] = $row['pid'];
|
||||
|
||||
$row['post'] = $this->parseMessage( $row['post'], $row );
|
||||
|
||||
//-----------------------------------------
|
||||
// Parse HTML tag on the fly
|
||||
//-----------------------------------------
|
||||
|
||||
$posts_html .= $this->registry->getClass('output')->getTemplate('printpage')->pp_postentry( $poster, $row );
|
||||
}
|
||||
|
||||
if ( count( $attach_pids ) )
|
||||
{
|
||||
if ( ! is_object( $this->class_attach ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Grab render attach class
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPSLib::getAppDir( 'core' ) . '/sources/classes/attach/class_attach.php' );
|
||||
$this->class_attach = new class_attach( $this->registry );
|
||||
$this->class_attach->type = 'post';
|
||||
$this->class_attach->init();
|
||||
}
|
||||
|
||||
$posts_html = $this->class_attach->renderAttachments( $posts_html, $attach_pids );
|
||||
|
||||
$posts_html = $posts_html[0]['html'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Print the footer
|
||||
//-----------------------------------------
|
||||
|
||||
$posts_html .= $this->registry->getClass('output')->getTemplate('printpage')->pp_end();
|
||||
|
||||
//-----------------------------------------
|
||||
// Macros
|
||||
//-----------------------------------------
|
||||
|
||||
$posts_html = $this->registry->getClass('output')->replaceMacros( $posts_html );
|
||||
|
||||
//-----------------------------------------
|
||||
// CSS
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('output')->skin['_usecsscache'] = 0;
|
||||
|
||||
return $posts_html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse attachments
|
||||
*
|
||||
* @access public
|
||||
* @param array Array of post data
|
||||
* @return string HTML parsed by attachment class
|
||||
*/
|
||||
public function _parseAttachments( $postData )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT. Yes it is
|
||||
//-----------------------------------------
|
||||
|
||||
$postHTML = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Separate out post content
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $postData as $id => $post )
|
||||
{
|
||||
$postHTML[ $id ] = $post['post'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// ATTACHMENTS!!!
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->topic['topic_hasattach'] )
|
||||
{
|
||||
if ( ! is_object( $this->class_attach ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Grab render attach class
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPSLib::getAppDir( 'core' ) . '/sources/classes/attach/class_attach.php' );
|
||||
$this->class_attach = new class_attach( $this->registry );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Not got permission to view downloads?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->registry->permissions->check( 'download', $this->registry->class_forums->forum_by_id[ $this->topic['forum_id'] ] ) === FALSE )
|
||||
{
|
||||
$this->settings['show_img_upload'] = 0 ;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Continue...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->class_attach->type = 'post';
|
||||
$this->class_attach->init();
|
||||
|
||||
# attach_pids is generated in the func_topic_xxxxx files
|
||||
$attachHTML = $this->class_attach->renderAttachments( $postHTML, $this->attach_pids );
|
||||
}
|
||||
|
||||
/* Now parse back in the rendered posts */
|
||||
if( is_array($attachHTML) AND count($attachHTML) )
|
||||
{
|
||||
foreach( $attachHTML as $id => $data )
|
||||
{
|
||||
/* Get rid of any lingering attachment tags */
|
||||
if ( stristr( $data['html'], "[attachment=" ) )
|
||||
{
|
||||
$data['html'] = IPSText::stripAttachTag( $data['html'] );
|
||||
}
|
||||
|
||||
$postData[ $id ]['post'] = $data['html'];
|
||||
$postData[ $id ]['attachmentHtml'] = $data['attachmentHtml'];
|
||||
}
|
||||
}
|
||||
|
||||
return $postData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses Posts
|
||||
*
|
||||
* @access protected
|
||||
* @param string $message Text
|
||||
* @param array $row Formatting params
|
||||
* @return string
|
||||
**/
|
||||
protected function parseMessage( $message="", $row=array() )
|
||||
{
|
||||
IPSText::getTextClass( 'bbcode' )->parse_smilies = $row['use_emo'];
|
||||
IPSText::getTextClass( 'bbcode' )->parse_html = ( $this->forum['use_html'] and $this->caches['group_cache'][ $row['member_group_id'] ]['g_dohtml'] and $row['post_htmlstate'] ) ? 1 : 0;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_nl2br = $row['post_htmlstate'] == 2 ? 1 : 0;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_bbcode = $this->forum['use_ibc'];
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_section = 'topics';
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $row['member_group_id'];
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $row['mgroup_others'];
|
||||
|
||||
return IPSText::getTextClass( 'bbcode' )->preDisplayParse( $message );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Show forum rules
|
||||
* Last Updated: $Date: 2009-04-06 22:43:13 -0400 (Mon, 06 Apr 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 4411 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_forums_rules extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Array of form data
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private $forum = array();
|
||||
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
$this->registry->getClass( 'class_localization' )->loadLanguageFile( array( 'public_forums', 'public_boards' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the forum info based on the forum ID,
|
||||
// and get the category name, ID, etc.
|
||||
//-----------------------------------------
|
||||
|
||||
$this->forum = $this->registry->getClass('class_forums')->forum_by_id[ $this->request['f'] ];
|
||||
|
||||
//-----------------------------------------
|
||||
// Error out if we can not find the forum
|
||||
//-----------------------------------------
|
||||
|
||||
if( ! $this->forum['id'] )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'forums_no_id', 10333 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Is it a redirect forum?
|
||||
//-----------------------------------------
|
||||
|
||||
if( isset( $this->forum['redirect_on'] ) AND $this->forum['redirect_on'] )
|
||||
{
|
||||
$redirect = $this->DB->buildAndFetch( array( 'select' => 'redirect_url', 'from' => 'forums', 'where' => "id=" . $this->forum['id']) );
|
||||
|
||||
if( $redirect['redirect_url'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Update hits:
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->buildAndFetch( array( 'update' => 'forums', 'set' => 'redirect_hits=redirect_hits+1', 'where' => "id=" . $this->forum['id']) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Boink!
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->getClass('output')->silentRedirect( $redirect['redirect_url'] );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check forum access perms
|
||||
//-----------------------------------------
|
||||
|
||||
if( !$this->request['L'] )
|
||||
{
|
||||
$this->registry->getClass('class_forums')->forumsCheckAccess( $this->forum['id'], 1 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Do we have permission to view these rules?
|
||||
//-----------------------------------------
|
||||
|
||||
$allow_access = $this->registry->getClass('class_forums')->forumsCheckAccess( $this->forum['id'], 1 );
|
||||
|
||||
if( $allow_access === FALSE )
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'forums_no_access', 10334 );
|
||||
}
|
||||
|
||||
$tmp = $this->DB->buildAndFetch( array( 'select' => 'rules_title, rules_text', 'from' => 'forums', 'where' => "id=" . $this->forum['id']) );
|
||||
|
||||
if( $tmp['rules_title'] )
|
||||
{
|
||||
$rules['title'] = $tmp['rules_title'];
|
||||
$rules['body'] = $tmp['rules_text'];
|
||||
$rules['fid'] = $this->forum['id'];
|
||||
|
||||
IPSText::getTextClass( 'bbcode' )->parse_smilies = 1;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_html = 1;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_nl2br = 1;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_section = 'rules';
|
||||
$rules['body'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $rules['body'] );
|
||||
|
||||
$this->output .= $this->registry->getClass('output')->getTemplate('forum')->show_rules($rules);
|
||||
|
||||
$this->registry->output->setTitle( $this->settings['board_name'] . " -> " . $this->forum['name'] );
|
||||
$this->registry->output->addNavigation( $this->forum['name'], "showforum={$this->forum['id']}", $this->forum['name_seo'], 'showforum' );
|
||||
$this->registry->output->addContent( $this->output );
|
||||
$this->registry->output->sendOutput();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->getClass('output')->showError( 'forums_no_rules', 10335 );
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,265 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Subscribe to a topic or forum
|
||||
* Last Updated: $Date: 2009-03-04 07:36:56 -0500 (Wed, 04 Mar 2009) $
|
||||
*
|
||||
* @author $Author: matt $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Revision: 4135 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_forums_tracker extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Forum information
|
||||
*
|
||||
* @access private
|
||||
* @var array Array of forum details
|
||||
*/
|
||||
private $forum = array();
|
||||
|
||||
/**
|
||||
* Topic information
|
||||
*
|
||||
* @access private
|
||||
* @var array Array of topic details
|
||||
*/
|
||||
private $topic = array();
|
||||
|
||||
/**
|
||||
* Subscription type
|
||||
*
|
||||
* @access private
|
||||
* @var string topic or forum
|
||||
*/
|
||||
private $type = 'topic';
|
||||
|
||||
/**
|
||||
* Subscription method
|
||||
*
|
||||
* @access private
|
||||
* @var string delayed, immediate, none, daily, weekly
|
||||
*/
|
||||
private $method = 'delayed';
|
||||
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @param boolean Return instead of showing topic subscribed page
|
||||
* @return mixed [Outputs to screen/redirects, or returns if $is_sub is true]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry, $is_sub = false )
|
||||
{
|
||||
if( !$this->request['t'] )
|
||||
{
|
||||
$this->registry->output->showError( 'tracker_no_tid', 10361 );
|
||||
}
|
||||
|
||||
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_emails' ), 'core' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check the input
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->request['type'] == 'forum' )
|
||||
{
|
||||
$this->type = 'forum';
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Method..
|
||||
//-----------------------------------------
|
||||
|
||||
switch ( $this->request['method'] )
|
||||
{
|
||||
case 'delayed':
|
||||
default:
|
||||
$this->method = 'delayed';
|
||||
break;
|
||||
case 'immediate':
|
||||
$this->method = 'immediate';
|
||||
break;
|
||||
case 'none':
|
||||
$this->method = 'none';
|
||||
break;
|
||||
case 'daily':
|
||||
$this->method = 'daily';
|
||||
break;
|
||||
case 'weekly':
|
||||
$this->method = 'weekly';
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$this->request[ 't'] = intval($this->request['t'] );
|
||||
$this->request[ 'f'] = intval($this->request['f'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Error out if we can not find the forum
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! ipsRegistry::getClass('class_forums')->forum_by_id[ $this->request['f'] ] )
|
||||
{
|
||||
if ( $is_sub == false )
|
||||
{
|
||||
$this->registry->output->showError( 'tracker_no_fid', 10362 );
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the information based on ID
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->type == 'forum' )
|
||||
{
|
||||
$this->forum = ipsRegistry::getClass('class_forums')->forum_by_id[ $this->request['f'] ];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->topic = $this->DB->buildAndFetch( array( 'select' => 'tid, forum_id, starter_id', 'from' => 'topics', 'where' => 'tid=' . $this->request['t'] ) );
|
||||
|
||||
if( !is_array($this->topic) OR !count($this->topic) )
|
||||
{
|
||||
$this->registry->output->showError( 'tracker_no_tid', 10363 );
|
||||
}
|
||||
|
||||
$this->forum = ipsRegistry::getClass('class_forums')->forum_by_id[ $this->request['f'] ];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Error out if we can not find the topic
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->type != 'forum' )
|
||||
{
|
||||
if ( ! $this->topic['tid'] )
|
||||
{
|
||||
if ( $is_sub == false )
|
||||
{
|
||||
$this->registry->output->showError( 'tracker_no_fid', 10364 );
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check viewing permissions, private forums,
|
||||
// password forums, etc
|
||||
//-----------------------------------------
|
||||
|
||||
if ( !$this->memberData['member_id'] )
|
||||
{
|
||||
if ( $is_sub == false )
|
||||
{
|
||||
$this->registry->output->showError( 'tracker_only_members', 10365 );
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if( $is_sub )
|
||||
{
|
||||
$this->registry->getClass('class_forums')->forumsCheckAccess( $this->forum['id'], 0, $this->type, $this->topic, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->getClass('class_forums')->forumsCheckAccess( $this->forum['id'], 0, $this->type, $this->topic );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Have we already subscribed?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->type == 'forum' )
|
||||
{
|
||||
$this->DB->build( array( 'select' => 'frid',
|
||||
'from' => 'forum_tracker',
|
||||
'where' => "forum_id='" . $this->forum['id'] . "' AND member_id=" . $this->memberData['member_id'] ) );
|
||||
$this->DB->execute();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->DB->build( array( 'select' => 'trid',
|
||||
'from' => 'tracker',
|
||||
'where' => "topic_id='" . $this->topic['tid'] . "' AND member_id=" . $this->memberData['member_id'] ) );
|
||||
$this->DB->execute();
|
||||
}
|
||||
|
||||
if ( $this->DB->getTotalRows() )
|
||||
{
|
||||
if ( $is_sub == false )
|
||||
{
|
||||
$this->registry->output->showError( 'tracker_already_track', 10366 );
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Add it to the DB
|
||||
//-----------------------------------------
|
||||
|
||||
if ($this->type == 'forum')
|
||||
{
|
||||
$this->DB->insert( 'forum_tracker', array (
|
||||
'member_id' => $this->memberData['member_id'],
|
||||
'forum_id' => $this->request['f'],
|
||||
'start_date' => time(),
|
||||
'forum_track_type' => $this->method,
|
||||
) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->DB->insert( 'tracker', array (
|
||||
'member_id' => $this->memberData['member_id'],
|
||||
'topic_id' => $this->topic['tid'],
|
||||
'start_date' => time(),
|
||||
'topic_track_type' => $this->method,
|
||||
) );
|
||||
}
|
||||
|
||||
if ( $is_sub == false )
|
||||
{
|
||||
if ( $this->type == 'forum' )
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['sub_added'], $this->settings['base_url'] . "showforum={$this->topic['id']}" );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->registry->output->redirectScreen( $this->lang->words['sub_added'], $this->settings['base_url'] . "showtopic={$this->topic['tid']}&st=" . $this->request['st'] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,350 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Moderator actions
|
||||
* Last Updated: $Date: 2009-07-21 19:59:38 -0400 (Tue, 21 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Revision: 4924 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class public_forums_moderate_multimod extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Temporary stored output HTML
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $output;
|
||||
|
||||
/**
|
||||
* Moderator function library
|
||||
*
|
||||
* @access private
|
||||
* @var object
|
||||
*/
|
||||
private $modLibrary;
|
||||
|
||||
/**
|
||||
* Moderator information
|
||||
*
|
||||
* @access private
|
||||
* @var array Array of moderator details
|
||||
*/
|
||||
private $moderator = array();
|
||||
|
||||
/**
|
||||
* Forum information
|
||||
*
|
||||
* @access private
|
||||
* @var array Array of forum details
|
||||
*/
|
||||
private $forum = array();
|
||||
|
||||
/**
|
||||
* Topic information
|
||||
*
|
||||
* @access private
|
||||
* @var array Array of topic details
|
||||
*/
|
||||
private $topic = array();
|
||||
|
||||
/**
|
||||
* Topic id
|
||||
*
|
||||
* @access private
|
||||
* @var integer Topic id
|
||||
*/
|
||||
private $topic_id = 0;
|
||||
|
||||
/**
|
||||
* Forum id
|
||||
*
|
||||
* @access private
|
||||
* @var integer Forum id
|
||||
*/
|
||||
private $forum_id = 0;
|
||||
|
||||
/**
|
||||
* Multimod id
|
||||
*
|
||||
* @access private
|
||||
* @var integer Multimod id
|
||||
*/
|
||||
private $mm_id = 0;
|
||||
|
||||
/**
|
||||
* Multimod data
|
||||
*
|
||||
* @access private
|
||||
* @var array Multimod data
|
||||
*/
|
||||
private $mm_data = array();
|
||||
|
||||
/**
|
||||
* Class entry point
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry reference
|
||||
* @return void [Outputs to screen/redirects]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load modules...
|
||||
//-----------------------------------------
|
||||
|
||||
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_mod' ) );
|
||||
|
||||
require( IPSLib::getAppDir( 'forums' ) . '/sources/classes/moderate.php');
|
||||
$this->modLibrary = new moderatorLibrary( $this->registry );
|
||||
|
||||
//-----------------------------------------
|
||||
// Clean the incoming
|
||||
//-----------------------------------------
|
||||
|
||||
$this->request[ 't'] = intval($this->request['t'] );
|
||||
$this->mm_id = intval($this->request['mm_id']);
|
||||
|
||||
if ($this->request['t'] < 0 )
|
||||
{
|
||||
$this->registry->output->showError( 'multimod_no_topic', 103121 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the topic id / forum id
|
||||
//-----------------------------------------
|
||||
|
||||
$this->topic = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'topics', 'where' => "tid=" . intval($this->request['t']) ) );
|
||||
$this->forum = $this->registry->class_forums->allForums[ $this->topic['forum_id'] ];
|
||||
|
||||
//-----------------------------------------
|
||||
// Error out if we can not find the topic
|
||||
//-----------------------------------------
|
||||
|
||||
if ( !$this->topic['tid'])
|
||||
{
|
||||
$this->registry->output->showError( 'multimod_no_topic', 103122 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Error out if we can not find the forum
|
||||
//-----------------------------------------
|
||||
|
||||
if ( !$this->forum['id'] )
|
||||
{
|
||||
$this->registry->output->showError( 'multimod_no_topic', 103123 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Are we a moderator?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ($this->memberData['member_id']) and ($this->memberData['g_is_supmod'] != 1) )
|
||||
{
|
||||
$this->moderator = $this->DB->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'moderators',
|
||||
'where' => "forum_id LIKE '%,{$this->forum['id']},%' AND (member_id=" . $this->memberData['member_id'] . " OR (is_group=1 AND group_id='" . $this->memberData['member_group_id'] . "'))"
|
||||
) );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Init modfunc module
|
||||
//-----------------------------------------
|
||||
|
||||
$this->modLibrary->init( $this->forum, $this->topic, $this->moderator );
|
||||
|
||||
//-----------------------------------------
|
||||
// Do we have permission?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->modLibrary->mmAuthorize() != TRUE )
|
||||
{
|
||||
$this->registry->output->showError( 'multimod_no_perms', 2038 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get MM data
|
||||
//-----------------------------------------
|
||||
|
||||
$this->mm_data = $this->caches['multimod'][ $this->mm_id ];
|
||||
|
||||
if ( ! $this->mm_data['mm_id'] )
|
||||
{
|
||||
$this->registry->output->showError( 'multimod_not_found', 103124 );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Does this forum have this mm_id
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->modLibrary->mmCheckIdInForum( $this->forum['id'], $this->mm_data ) != TRUE )
|
||||
{
|
||||
$this->registry->output->showError( 'multimod_no_perms', 2039 );
|
||||
}
|
||||
|
||||
$this->modLibrary->stmInit();
|
||||
|
||||
//-----------------------------------------
|
||||
// Open close?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->mm_data['topic_state'] != 'leave' )
|
||||
{
|
||||
if ( $this->mm_data['topic_state'] == 'close' )
|
||||
{
|
||||
$this->modLibrary->stmAddClose();
|
||||
}
|
||||
else if ( $this->mm_data['topic_state'] == 'open' )
|
||||
{
|
||||
$this->modLibrary->stmAddOpen();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// pin no-pin?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->mm_data['topic_pin'] != 'leave' )
|
||||
{
|
||||
if ( $this->mm_data['topic_pin'] == 'pin' )
|
||||
{
|
||||
$this->modLibrary->stmAddPin();
|
||||
}
|
||||
else if ( $this->mm_data['topic_pin'] == 'unpin' )
|
||||
{
|
||||
$this->modLibrary->stmAddUnpin();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Approve / Unapprove
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->mm_data['topic_approve'] )
|
||||
{
|
||||
if ( $this->mm_data['topic_approve'] == 1 )
|
||||
{
|
||||
$this->modLibrary->stmAddApprove();
|
||||
}
|
||||
else if ( $this->mm_data['topic_approve'] == 2 )
|
||||
{
|
||||
$this->modLibrary->stmAddUnapprove();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Topic title
|
||||
// Regexes clean title up
|
||||
//-----------------------------------------
|
||||
|
||||
$title = $this->topic['title'];
|
||||
|
||||
if ( $this->mm_data['topic_title_st'] )
|
||||
{
|
||||
$title = preg_replace( "/^" . preg_quote( $this->mm_data['topic_title_st'], '/' ) . "/", "", $title );
|
||||
}
|
||||
|
||||
if ( $this->mm_data['topic_title_end'] )
|
||||
{
|
||||
$title = preg_replace( "/" . preg_quote( $this->mm_data['topic_title_end'], '/' ) . "$/", "", $title );
|
||||
}
|
||||
|
||||
$this->modLibrary->stmAddTitle( $this->mm_data['topic_title_st'] . $title . $this->mm_data['topic_title_end'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Update what we have so far...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->modLibrary->stmExec( $this->topic['tid'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Add reply?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->mm_data['topic_reply'] and $this->mm_data['topic_reply_content'] )
|
||||
{
|
||||
$this->modLibrary->auto_update = FALSE; // Turn off auto forum re-synch, we'll manually do it at the end
|
||||
|
||||
IPSText::getTextClass('bbcode')->parse_smilies = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_html = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_nl2br = 1;
|
||||
IPSText::getTextClass('bbcode')->parsing_section = 'topics';
|
||||
|
||||
$this->modLibrary->topicAddReply(
|
||||
str_replace( "\n", "", IPSText::getTextClass('bbcode')->preDbParse( str_replace( "\r", '', $this->mm_data['topic_reply_content'] ) ) )
|
||||
, array( 0 => array( $this->topic['tid'], $this->forum['id'] ) )
|
||||
, $this->mm_data['topic_reply_postcount']
|
||||
);
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Move topic?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->mm_data['topic_move'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Move to forum still exist?
|
||||
//-----------------------------------------
|
||||
|
||||
$r = $this->registry->class_forums->allForums[ $this->mm_data['topic_move'] ];
|
||||
|
||||
if( $r['id'] )
|
||||
{
|
||||
if ( $r['sub_can_post'] != 1 )
|
||||
{
|
||||
$this->DB->update( 'topic_mmod', array( 'topic_move' => 0 ), 'mm_id=' . $this->mm_id );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $r['id'] != $this->forum['id'] )
|
||||
{
|
||||
$this->modLibrary->topicMove( $this->topic['tid'], $this->forum['id'], $r['id'], $this->mm_data['topic_move_link'] );
|
||||
|
||||
$this->modLibrary->forumRecount( $r['id'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->DB->update( 'topic_mmod', array( 'topic_move' => 0 ), 'mm_id=' . $this->mm_id );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Recount root forum
|
||||
//-----------------------------------------
|
||||
|
||||
$this->modLibrary->forumRecount( $this->forum['id'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Add mod log
|
||||
//-----------------------------------------
|
||||
|
||||
$this->modLibrary->addModerateLog( $this->forum['id'], $this->topic['tid'], "", $this->topic['title'], "Applied multi-mod: " . $this->mm_data['mm_title'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Redirect back with nice fluffy message
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->redirectScreen( sprintf($this->lang->words['mm_applied'], $this->mm_data['mm_title'] ), $this->settings['base_url'] . "showforum=" . $this->forum['id'], $this->forum['name_seo'] );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Forum posting default section
|
||||
* Last Updated: $LastChangedDate: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 14th May 2003
|
||||
* @version $Rev: 4948 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Very simply returns the default section if one is not
|
||||
* passed in the URL
|
||||
*/
|
||||
|
||||
$DEFAULT_SECTION = 'post';
|
||||
@@ -0,0 +1 @@
|
||||
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
|
||||
Loaded 100 of 3755 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user