Version 3.0.5

This commit is contained in:
Neo committed 2025-12-19 00:31:03 -08:00
1 parent 19b38c7c74
commit 1d4720f3e2
3755 files changed
+508378 -664541

No files matched your search

@@ -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&amp;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&amp;section=search';
$this->form_code_js = $this->html->form_code_js = 'module=attachments&section=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&section=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&amp;section=stats&amp;';
$this->html->form_code_js = 'module=attachments&amp;section=stats&amp;';
$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&amp;section=types&amp;';
$this->html->form_code_js = 'module=attachments&amp;section=types&amp;';
$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 : '&nbsp;';
$r['aphoto_checked'] = $r['atype_photo'] ? $checked_img : '&nbsp;';
$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&amp;section=moderator&amp;';
$this->html->form_code_js = 'module=forums&amp;section=moderator&amp;';
$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&section=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&section=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&section=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&section=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&section=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&section=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&amp;section=multimods&amp;';
$this->html->form_code_js = 'module=forums&amp;section=multimods&amp;';
$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&amp;section=permissions&amp;';
$this->html->form_code_js = 'module=forums&amp;section=permissions&amp;';
$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 .= '&middot; ' . $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&amp;section=export';
$this->form_code_js = $this->html->form_code_js = 'module=rss&section=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&amp;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&section=attach&attach_rel_module=post&attach_id=\\1'>".$this->settings['board_url']."/index.php?app=forums&module=forums&section=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&amp;section=stats';
$this->form_code_js = $this->html->form_code_js = 'module=statistics&section=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&amp;section=tools';
$this->form_code_js = $this->html->form_code_js = 'module=tools&section=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&amp;module=members&amp;section=members&amp;do=viewmember&amp;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&amp;module=members&amp;section=members&amp;do=viewmember&amp;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>