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,129 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Member form manipulation
* 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 Members
* @link http://www.iinvisionpower.com
* @since 1st march 2002
* @version $Revision: 4948 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class admin_member_form__members implements admin_member_form
{
/**
* Tab name
* This can be left blank and the application title will
* be used
*
* @access public
* @var string Tab name
*/
public $tab_name = "";
/**
* Returns sidebar links for this tab
* You may return an empty array or FALSE to not have
* any links show in the sidebar for this block.
*
* The links must have 'section=xxxxx&module=xxxxx[&do=xxxxxx]'. The rest of the URL
* is added automatically.
*
* The image must be a full URL or blank to use a default image.
*
* Use the format:
* $array[] = array( 'img' => '', 'url' => '', 'title' => '' );
*
* @access public
* @author Matt Mecham
* @param array Member data
* @return array Array of links
*/
public function getSidebarLinks( $member=array() )
{
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'admin_members' ), 'members' );
$array = array();
if( ipsRegistry::getClass('class_permissions')->checkPermission( 'membertools_delete_pms', 'members', 'members' ) )
{
$array[] = array( 'img' => '',
'url' => 'section=tools&amp;module=members&amp;do=deleteMessages',
'title' => ipsRegistry::getClass('class_localization')->words['form_deletepms'] );
}
if( ipsRegistry::getClass('class_permissions')->checkPermission( 'membertools_ip', 'members', 'members' ) )
{
$array[] = array( 'img' => '',
'url' => 'section=tools&amp;module=members&amp;do=show_all_ips',
'title' => ipsRegistry::getClass('class_localization')->words['form_showallips'] );
}
if( ipsRegistry::getClass('class_permissions')->checkPermission( 'member_suspend', 'members', 'members' ) )
{
if( $member['temp_ban'] )
{
$array[] = array( 'img' => '',
'url' => 'section=members&amp;module=members&amp;do=unsuspend',
'title' => ipsRegistry::getClass('class_localization')->words['form_unsuspendmem'] );
}
else
{
$array[] = array( 'img' => '',
'url' => 'section=members&amp;module=members&amp;do=banmember',
'title' => ipsRegistry::getClass('class_localization')->words['form_suspendmem'] );
}
}
if( ipsRegistry::getClass('class_permissions')->checkPermission( 'members_merge', 'members', 'members' ) )
{
$array[] = array( 'img' => '',
'url' => 'section=tools&amp;module=members&amp;do=merge',
'title' => ipsRegistry::getClass('class_localization')->words['form_mergemember'] );
}
return $array;
}
/**
* Returns content for the page.
*
* @access public
* @author Matt Mecham
* @param array Member data
* @return array Array of tabs, content
*/
public function getDisplayContent( $member=array() )
{
return array();
}
/**
* Process the entries for saving and return
*
* @access public
* @author Brandon Farber
* @return array Multi-dimensional array (core, extendedProfile) for saving
*/
public function getForSave()
{
return array( 'core' => array(), 'extendedProfile' => array() );
}
}
@@ -0,0 +1,141 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Core extensions
* Last Updated: $Date: 2009-11-10 18:07:22 -0500 (Tue, 10 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 Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Rev: 5345 $
*
*/
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 publicSessions__members
{
/**
* Return session variables for this application
*
* current_appcomponent, current_module and current_section are automatically
* stored. This function allows you to add specific variables in.
*
* @access public
* @author Matt Mecham
* @return array
*/
public function getSessionVariables()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$array = array( 'location_1_type' => '',
'location_1_id' => 0,
'location_2_type' => '',
'location_2_id' => 0 );
if( ipsRegistry::$request['id'] AND ipsRegistry::$request['section'] == 'view' AND ipsRegistry::$request['module'] == 'profile' )
{
$array['location_1_type'] = 'profile';
$array['location_1_id'] = ipsRegistry::$request['id'];
}
return $array;
}
/**
* Parse/format the online list data for the records
*
* @access public
* @author Brandon Farber
* @param array Online list rows to check against
* @return array Online list rows parsed
*/
public function parseOnlineEntries( $rows )
{
if( !is_array($rows) OR !count($rows) )
{
return $rows;
}
$final = array();
$profiles = array();
$names = array();
//-----------------------------------------
// Extract the topic/forum data
//-----------------------------------------
foreach( $rows as $row )
{
if( $row['current_appcomponent'] != 'members' OR !$row['current_module'] )
{
continue;
}
if( $row['current_module'] == 'profile' )
{
$profiles[] = $row['location_1_id'];
}
}
if( count($profiles) )
{
ipsRegistry::DB()->build( array( 'select' => 'member_id, members_display_name, members_seo_name', 'from' => 'members', 'where' => 'member_id IN(' . implode( ',', $profiles ) . ')' ) );
$pr = ipsRegistry::DB()->execute();
while( $r = ipsRegistry::DB()->fetch($pr) )
{
$names[ $r['member_id'] ] = array( 'members_display_name' => $r['members_display_name'], 'members_seo_name' => $r['members_seo_name'] );
}
}
foreach( $rows as $row )
{
if( $row['current_appcomponent'] == 'members' )
{
if( $row['current_module'] == 'online' )
{
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['WHERE_online'];
}
if( $row['current_module'] == 'list' )
{
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['WHERE_members'];
}
if( $row['current_module'] == 'messaging' )
{
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['WHERE_msg'];
}
if( $row['current_module'] == 'profile' )
{
if ( isset( $names[ $row['location_1_id'] ] ) )
{
$row['where_line'] = ipsRegistry::getClass( 'class_localization' )->words['WHERE_profile'];
$row['where_line_more'] = $names[ $row['location_1_id'] ]['members_display_name'];
$row['where_link'] = 'showuser=' . $row['location_1_id'];
$row['_whereLinkSeo'] = ipsRegistry::getClass('output')->buildSEOUrl( $row['where_link'], 'public', $names[ $row['location_1_id'] ]['members_seo_name'], 'showuser' );
}
}
}
$final[ $row['id'] ] = $row;
}
return $final;
}
}
@@ -0,0 +1,72 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Core variables extension file
* 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 Members
* @link http://www.iinvisionpower.com
* @since 1st march 2002
* @version $Revision: 4948 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
$_LOAD = array();
# PERSONAL MESSAGES
if( ( isset( $_GET['module'] ) && $_GET['module'] == 'messaging' ) )
{
$_LOAD['ranks'] = 1;
$_LOAD['profilefields'] = 1;
$_LOAD['badwords'] = 1;
$_LOAD['bbcode'] = 1;
$_LOAD['emoticons'] = 1;
$_LOAD['reputation_levels'] = 1;
$_LOAD['moderators'] = 1;
}
# MEMBER LIST
if( ( isset( $_GET['section'] ) && $_GET['section'] == 'view' ) && ( isset( $_GET['module'] ) && $_GET['module'] == 'list' ) )
{
$_LOAD['ranks'] = 1;
$_LOAD['profilefields'] = 1;
$_LOAD['reputation_levels'] = 1;
}
# ONLINE LIST
if( isset( $_GET['module'] ) && $_GET['module'] == 'online' )
{
$_LOAD['ranks'] = 1;
$_LOAD['profilefields'] = 1;
$_LOAD['reputation_levels'] = 1;
$_LOAD['moderators'] = 1; // This is need for forums application - as there are usually people browsing topics,
// we should load this on the assumption it'll be needed anyways
}
# PROFILE
if ( ( isset( $_GET['showuser'] ) && $_GET['showuser'] ) OR $_GET['module'] == 'profile' AND $_GET['section'] == 'view' )
{
$_LOAD['ranks'] = 1;
$_LOAD['profilefields'] = 1;
$_LOAD['badwords'] = 1;
$_LOAD['bbcode'] = 1;
$_LOAD['emoticons'] = 1;
$_LOAD['reputation_levels'] = 1;
$_LOAD['moderators'] = 1;
}
/* Never, ever remove or re-order these options!!
* Feel free to add, though. :) */
$_BITWISE = array();
@@ -0,0 +1,37 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* BBCode Management : Determines if bbcode can be used in this section
* Last Updated: $LastChangedDate: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @subpackage Members
* @link http://www.iinvisionpower.com
* @since 27th January 2004
* @version $Rev: 4948 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
/*
* An array of key => value pairs
* When going to parse, the key should be passed to the editor
* to determine which bbcodes should be parsed in the section
*
*/
$BBCODE = array(
'signatures' => ipsRegistry::getClass('class_localization')->words['ctype__signatures'],
'aboutme' => ipsRegistry::getClass('class_localization')->words['ctype__aboutme'],
'pms' => ipsRegistry::getClass('class_localization')->words['ctype__pms'],
'warn' => ipsRegistry::getClass('class_localization')->words['ctype__warn'],
);
@@ -0,0 +1,46 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.1
* Sets up SEO templates
* Last Updated: $Date: 2009-03-04 15:08:31 +0000 (Wed, 04 Mar 2009) $
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @subpackage Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Rev: 4136 $
*
*/
/**
* SEO templates
*
* 'allowRedirect' is a flag to tell IP.Board whether to check the incoming link and if not formatted correctly, redirect the correct one
*
* OUT FORMAT REGEX:
* First array element is a regex to run to see if we've a match for the URL
* The second array element is the template to use the results of the parenthesis capture
*
* Special variable #{__title__} is replaced with the $title data passed to output->formatUrl( $url, $title)
*
* IMPORTANT: Remember that when these regex are used, the output has not been fully parsed so you will get:
* showuser={$data['member_id']} NOT showuser=1 so do not try and match numerics only!
*
* IN FORMAT REGEX
*
* This allows the registry to piece back together a URL based on the template regex
* So, for example: "/user/(\d+?)/", 'matches' => array( array( 'showuser' => '$1' ) )tells IP.Board to populate 'showuser' with the result
* of the parenthesis capture #1
*/
$_SEOTEMPLATES = array(
'showuser' => array( 'app' => 'members',
'allowRedirect' => 1,
'out' => array( '#showuser=(.+?)(&|$)#i', 'user/$1/$2' ),
'in' => array( 'regex' => "#/user/(\d+)/#i",
'matches' => array( array( 'showuser', '$1' ) ) ) ),
);
@@ -0,0 +1,139 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* RSS output plugin :: posts
* Last Updated: $Date: 2009-01-05 22:21:54 +0000 (Mon, 05 Jan 2009) $
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @subpackage Forums
* @link http://www.iinvisionpower.com
* @since 6/24/2008
* @version $Revision: 3572 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class furlRedirect_members
{
/**
* Key type: Type of action (topic/forum)
*
* @access private
* @var string
*/
private $_type = '';
/**
* Key ID
*
* @access private
* @var int
*/
private $_id = 0;
/**
* Constructor
*
*/
function __construct( ipsRegistry $registry )
{
$this->registry = $registry;
$this->DB = $registry->DB();
$this->settings =& $registry->fetchSettings();
}
/**
* Set the key ID
* @example furlRedirect_forums::setKey( 'topic', 12 );
*
* @access public
* @param string Type
* @param mixed Value
*/
public function setKey( $name, $value )
{
$this->_type = $name;
$this->_id = $value;
}
/**
* Set up the key by URI
*
* @access public
* @param string URI (example: index.php?showtopic=5&view=getlastpost)
* @return void
*/
public function setKeyByUri( $uri )
{
$uri = str_replace( '&amp;', '&', $uri );
if ( strstr( $uri, '?' ) )
{
list( $_chaff, $uri ) = explode( '?', $uri );
}
foreach( explode( '&', $uri ) as $bits )
{
list( $k, $v ) = explode( '=', $bits );
if ( $k )
{
if ( $k == 'showuser' )
{
$this->setKey( 'user', intval( $v ) );
return TRUE;
}
}
}
return FALSE;
}
/**
* Return the SEO title
*
* @access public
* @return string The SEO friendly name
*/
public function fetchSeoTitle()
{
switch ( $this->_type )
{
default:
return FALSE;
break;
case 'user':
return $this->_fetchSeoTitle_user();
break;
}
}
/**
* Return the SEO title for a user
*
* @access public
* @return string The SEO friendly name
*/
public function _fetchSeoTitle_user()
{
$member = IPSMember::load( intval( $this->_id ), 'core' );
if ( $member['member_id'] )
{
if ( IPB_USE_ONLY_ID_FURL ) return $member['member_id'];
return ( $member['members_seo_name'] ) ? $member['members_seo_name'] : IPSText::makeSeoTitle( $member['members_display_name'] );
}
return FALSE;
}
}
@@ -0,0 +1,53 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Sets up SEO templates
* Last Updated: $Date: 2009-03-04 15:08:31 +0000 (Wed, 04 Mar 2009) $
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @subpackage Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Rev: 4136 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
/**
* SEO templates
*
* 'allowRedirect' is a flag to tell IP.Board whether to check the incoming link and if not formatted correctly, redirect the correct one
*
* OUT FORMAT REGEX:
* First array element is a regex to run to see if we've a match for the URL
* The second array element is the template to use the results of the parenthesis capture
*
* Special variable #{__title__} is replaced with the $title data passed to output->formatUrl( $url, $title)
*
* IMPORTANT: Remember that when these regex are used, the output has not been fully parsed so you will get:
* showuser={$data['member_id']} NOT showuser=1 so do not try and match numerics only!
*
* IN FORMAT REGEX
*
* This allows the registry to piece back together a URL based on the template regex
* So, for example: "/user/(\d+?)/", 'matches' => array( array( 'showuser' => '$1' ) )tells IP.Board to populate 'showuser' with the result
* of the parenthesis capture #1
*/
$_SEOTEMPLATES = array(
'showuser' => array( 'app' => 'members',
'allowRedirect' => 1,
'out' => array( '#showuser=(.+?)((?:&|&amp;)f=(.+?))?(&|$)#i', 'user/$1-#{__title__}/$2$4' ),
'in' => array( 'regex' => "#/user/(\d+?)-#i",
'matches' => array( array( 'showuser', '$1' ) ) ) ),
);
@@ -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,75 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Portal plugin: online users
* 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 Members
* @link http://www.iinvisionpower.com
* @since 1st march 2002
* @version $Revision: 4948 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
/**
* This file must be named {file_name_minus_php}-cfg.php
*
* Please see each variable for more information
* $PORTAL_CONFIG is OK for each file, do not change
* this array name.
*/
$PORTAL_CONFIG = array();
/**
* Main plug in title
*
*/
$PORTAL_CONFIG['pc_title'] = 'Онлайн пользователи';
/**
* Plug in mini description
*
*/
$PORTAL_CONFIG['pc_desc'] = "Блок онлайн пользователей";
/**
* Keyword for settings. This is the keyword
* entered into ibf_conf_settings_titles -> conf_title_keyword
* Can be left blank.
* PLEASE stick to the naming convention when entering a setting
* keyword: portal_{file_name_minus_php} This will prevent
* other keyword clashes. Likewise, when creating settings, choose
* NOT to cache them (they will be loaded at run time) and always
* prefix with {file_name_minus_php}_setting_key - for example
* If you had a setting called "export_forums" then please name it
* "recent_topics_export_forums". This will be available in
* $this->settings['recent_topics_export_forums'] in the
* main module.
*/
$PORTAL_CONFIG['pc_settings_keyword'] = "";
/**
* Exportable tags key must be in the naming format of:
* {file_name_minus_php}-tag. The value *MUST* be the function
* which it corresponds to. For example:
* 'recent_topics_last_x' => 'recent_topics_last_x'
* The portal will look for function 'recent_topics_last_x' in
* module "sources/portal_plugins/recent_topics.php" when it parses
* the tag <!--::recent_topics_last_x::-->
*
* @param array[ TAG ] = array( FUNCTION NAME, DESCRIPTION );
*/
$PORTAL_CONFIG['pc_exportable_tags']['online_users_show'] = array( 'online_users_show', 'Shows the online users' );
@@ -0,0 +1,61 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Portal plugin: online users
* Last Updated: $Date: 2009-02-04 15:03:36 -0500 (Wed, 04 Feb 2009) $
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @subpackage Members
* @link http://www.iinvisionpower.com
* @since 1st march 2002
* @version $Revision: 3887 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class ppi_online_users extends public_portal_portal_portal
{
/**
* Initialize module
*
* @access public
* @return void
*/
public function init()
{
}
/**
* Show the online users
*
* @access public
* @return string HTML content to replace tag with
*/
public function online_users_show()
{
//-----------------------------------------
// Get the users from the DB
//-----------------------------------------
require_once( IPSLib::getAppDir( 'forums', 'forums' ) . '/boards.php' );
$boards = new public_forums_forums_boards();
$boards->makeRegistryShortcuts( $this->registry );
$active = $boards->getActiveUserDetails();
$active['visitors'] = $active['GUESTS'] + $active['ANON'];
$active['members'] = $active['MEMBERS'];
return $this->registry->getClass('output')->getTemplate('portal')->onlineUsers( $active );
}
}
@@ -0,0 +1,69 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Format member search results
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
*
* @author $author$
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @subpackage Members
* @link http://www.iinvisionpower.com
* @version $Rev: 4948 $
**/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class membersSearchDisplay implements iSearchDisplay
{
/**
* The search plugin for this app
*
* @access public
* @var object
*/
public $search_plugin;
/**
* Formats the member search result for display
*
* @access public
* @param array $search_row Array of data from search_index
* @return string Formatted content, ready for display
*/
public function formatContent( $search_row )
{
$search_row['misc'] = unserialize( $search_row['misc'] );
return ipsRegistry::getClass( 'output' )->getTemplate( 'search' )->memberSearchResult( $search_row, $this->search_plugin->onlyTitles );
}
/**
* Retuns the html for displaying the member filter on the advanced search page
*
* @access public
* @return string
*/
public function getFilterHTML()
{
return '';
}
/**
* Build filter SQL data
*
* @access public
* @param array
* @return array
*/
public function buildFilterSQL( $data )
{
return array();
}
}
@@ -0,0 +1,425 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Basic Member Search
* Last Updated: $Date: 2009-01-12 16:56:39 -0500 (Mon, 12 Jan 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 Members
* @link http://www.iinvisionpower.com
* @version $Rev: 3640 $
*/
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 searchMembersPlugin implements iSearchIndexPlugin
{
/**
* Database object
*
* @access private
* @var object
*/
private $DB;
/**
* Date range restriction start
*
* @access private
* @var integer
*/
private $search_begin_timestamp = 0;
/**
* Date range restriction end
*
* @access private
* @var integer
*/
private $search_end_timestamp = 0;
/**
* Array of conditions for this search
*
* @access private
* @var array
*/
private $whereConditions = array();
/**
* Remoe self from search results
*
* @access public
* @var boolean
*/
public $removeSelf = false;
/**
* Only display title
*
* @access public
* @var boolean
*/
public $onlyTitles = false;
/**
* Setup registry objects
*
* @access public
* @param object ipsRegistry $registry
* @return void
*/
public function __construct( ipsRegistry $registry )
{
$this->DB = $registry->DB();
$this->member = $registry->member();
$this->memberData =& $registry->member()->fetchMemberData();
}
/**
* Performs search and returns an array of results
*
* @access public
* @param string $search_term
* @param array $limit_clause The erray should be array( begin, end )
* @param string $sort_by Column to sort by
* @param string $group_by Column to group by
* @param bool $content_title_only Only search title records
* @return array
*/
public function getSearchResults( $search_term, $limit_clause, $sort_by, $group_by='', $content_title_only=false, $sort_order='' )
{
if( $group_by )
{
$group_by = 'm.' . $group_by;
}
/* User prefs */
$order_dir = ( $sort_order == 'asc' ) ? 'asc' : 'desc';
/* Do the search */
$this->DB->build( array(
'select' => "m.*",
'from' => array( 'members' => 'm' ),
'where' => $this->_buildWhereStatement( $search_term, $content_title_only ),
'limit' => $limit_clause,
'group' => $group_by,
'order' => "m.member_id " . $order_dir, //"m.joined DESC", - m.member_id uses Primary key and avoids filesort
'add_join' => array(
array(
'select' => 'p.*',
'from' => array( 'profile_portal' => 'p' ),
'where' => "p.pp_member_id=m.member_id",
'type' => 'left',
),
array(
'from' => array( 'profile_friends' => 'friend' ),
'where' => 'friend.friends_member_id=m.member_id AND friend.friends_friend_id=' . $this->memberData['member_id'],
'type' => 'left',
),
)
) );
$this->DB->execute();
/* Build result array */
$rows = array();
while( $r = $this->DB->fetch() )
{
/* Reassign stuff to match the search_index */
$rows[] = $this->formatFieldsForIndex( $r );
}
return $rows;
}
/**
* Performs live search and returns an array of results
* NOT AVAILABLE IN BASIC SEARCH
*
* @access public
* @param string $search_term
* @return array
*/
public function getLiveSearchResults( $search_term )
{
return array();
}
/**
* Returns the total number of results the search will return
*
* @access public
* @param string $search_term Search term
* @param string $group_by Column to group by
* @param bool $content_title_only Only search title records
* @return integer
*/
public function getSearchCount( $search_term, $group_by='', $content_title_only=false )
{
/* Query the count */
$this->DB->build( array(
'select' => 'COUNT(*) as total_results',
'from' => array( 'members' => 'm' ),
'where' => $this->_buildWhereStatement( $search_term, $content_title_only ),
'group' => $group_by,
'add_join' => array(
array(
'from' => array( 'profile_portal' => 'p' ),
'where' => "p.pp_member_id=m.member_id",
'type' => 'left',
)
)
) );
$this->DB->execute();
$search = $this->DB->fetch();
/* Return the count */
return $search['total_results'];
}
/**
* Restrict the date range that the search is performed on
*
* @access public
* @param int $begin Start timestamp
* @param int [$end] End timestamp
* @return void
*/
public function setDateRange( $begin, $end=0 )
{
$this->search_begin_timestamp = $begin;
$this->search_end_timestamp = $end;
}
/**
* mySQL function for adding special search conditions
*
* @access public
* @param string $column sql table column for this condition
* @param string $operator Operation to perform for this condition, ex: =, <>, IN, NOT IN
* @param mixed $value Value to check with
* @param string $comp Comparison type
* @return void
*/
public function setCondition( $column, $operator, $value, $comp='AND' )
{
if( $column == 'app' OR $column == 'type_id' )
{
return;
}
/* Build the condition based on operator */
switch( strtoupper( $operator ) )
{
case 'IN':
case 'NOT IN':
$this->whereConditions[$comp][] = "m.{$column} {$operator} ( {$value} )";
break;
default:
$this->whereConditions[$comp][] = "m.{$column} {$operator} {$value}";
break;
}
}
/**
* Allows you to specify multiple conditions that are chained together
*
* @access public
* @param array $conditions Array of conditions, each element has 3 keys: column, operator, value, see the setCondition function for information on each
* @param string $inner_comp Comparison operator to use inside the chain
* @param string $outer_comp Comparison operator to use outside the chain
* @return void
*/
public function setMultiConditions( $conditions, $inner_comp='OR', $outer_comp='AND' )
{
/* Loop through the conditions to build the statement */
$_temp = array();
foreach( $conditions as $r )
{
/* REMAP */
if( $r['column'] == 'type_id' )
{
continue;
}
if( $r['column'] == 'app' )
{
continue;
}
switch( strtoupper( $r['operator'] ) )
{
case 'IN':
case 'NOT IN':
$_temp[] = "m.{$r['column']} {$r['operator']} ( {$r['value']} )";
break;
default:
$_temp[] = "m.{$r['column']} {$r['operator']} {$r['value']}";
break;
}
}
$this->whereConditions[$outer_comp][] = '( ' . implode( $_temp, ' ' . $inner_comp . ' ' ) . ' ) ';
}
/**
* Set search conditions for "View unread content"
*
* @access public
* @return void
*/
public function setUnreadConditions()
{
$this->setDateRange( intval( $this->memberData['last_visit'] ), time() );
}
/**
* Builds the where portion of a search string
*
* @access private
* @param string $search_term The string to use in the search
* @param bool $content_title_only Search only title records
* @return string
**/
private function _buildWhereStatement( $search_term, $content_title_only=false )
{
/* INI */
$where_clause = array();
if( $search_term )
{
if( $content_title_only )
{
$where_clause[] = "m.members_l_display_name LIKE '%" . mb_strtolower( $search_term ) . "%'";
}
else
{
$where_clause[] = "m.members_l_display_name LIKE '%" . mb_strtolower( $search_term ) . "%' OR p.pp_bio_content LIKE '%{$search_term}%' OR p.signature LIKE '%{$search_term}%' OR p.pp_about_me LIKE '%{$search_term}%'";
}
}
/* Add in AND where conditions */
if( isset( $this->whereConditions['AND'] ) && count( $this->whereConditions['AND'] ) )
{
$where_clause = array_merge( $where_clause, $this->whereConditions['AND'] );
}
/* ADD in OR where conditions */
if( isset( $this->whereConditions['OR'] ) && count( $this->whereConditions['OR'] ) )
{
$where_clause[] = '( ' . implode( ' OR ', $this->whereConditions['OR'] ) . ' )';
}
/* Date Restrict */
if( $this->search_begin_timestamp && $this->search_end_timestamp )
{
$where_clause[] = $this->DB->buildBetween( "m.joined", $this->search_begin_timestamp, $this->search_end_timestamp );
}
else
{
if( $this->search_begin_timestamp )
{
$where_clause[] = "m.joined > {$this->search_begin_timestamp}";
}
if( $this->search_end_timestamp )
{
$where_clause[] = "m.joined < {$this->search_end_timestamp}";
}
}
/* Build and return the string */
return implode( " AND ", $where_clause );
}
/**
* Reassigns fields in a way the index exepcts
*
* @param array $r
* @return array
**/
public function formatFieldsForIndex( $r )
{
$r['app'] = 'members';
$r['content'] = $r['signature'] . ' ' . $r['bio'] . ' ' . $r['pp_about_me'];
$r['content_title'] = $r['members_display_name'];
$r['updated'] = time();
$r['type_2'] = 'profile_view';
$r['type_id_2'] = $r['member_id'];
$r['misc'] = serialize( array(
'pp_bio_content' => $r['pp_bio_content'],
'pp_thumb_photo' => $r['pp_thumb_photo'],
'pp_thumb_width' => $r['pp_thumb_width'],
'pp_thumb_height' => $r['pp_thumb_height']
) );
return $r;
}
/**
* This function grabs the actual results for display
*
* @param array $ids
* @return query result
**/
public function getResultsForSphinx( $ids )
{
$this->DB->build( array(
'select' => "m.*",
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id IN( ' . implode( ',', $ids ) . ')',
'order' => 'm.member_id DESC', //'m.joined DESC',
'add_join' => array(
array(
'select' => 'p.*',
'from' => array( 'profile_portal' => 'p' ),
'where' => "p.pp_member_id=m.member_id",
'type' => 'left',
)
)
) );
return $this->DB->execute();
}
/**
* Gets the name of the field this search index uses for dates.... >_<
*
* @return string
**/
public function getDateField()
{
return 'joined';
}
/**
* Gets field names for other conditions
*
* @param string Column
* @return string
**/
public function getConditionField( $column )
{
switch( $column )
{
case 'member_id':
return 'search_id';
break;
}
return $column;
}
}
@@ -0,0 +1,92 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Sphinx template file
* 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 Members
* @link http://www.iinvisionpower.com
* @version $Rev: 4948 $
* @since 3.0.0
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
$appSphinxTemplate = <<<EOF
############################## --- MEMBERS --- ##############################
source members_search_main : ipb_source_config
{
# Set our forum PID counter
sql_query_pre = REPLACE INTO <!--SPHINX_DB_PREFIX-->cache_store VALUES( 'sphinx_members_counter', (SELECT max(member_id) FROM <!--SPHINX_DB_PREFIX-->members), '', 0, UNIX_TIMESTAMP() )
# Query posts for the main source
sql_query = SELECT m.member_id, m.member_id as search_id, m.member_group_id, m.email, m.joined, m.members_display_name, m.name, \
REPLACE( pi.perm_view, '*', 0 ) as perm_view, \
CASE WHEN pi.authorized_users IS NULL THEN 0 ELSE pi.authorized_users END AS authorized_users, \
CASE WHEN pi.friend_only=0 THEN 0 ELSE m.member_id END AS friend_only, \
CASE WHEN pi.owner_only=0 THEN 0 ELSE m.member_id END AS owner_only \
FROM <!--SPHINX_DB_PREFIX-->members m \
LEFT JOIN <!--SPHINX_DB_PREFIX-->permission_index pi ON ( pi.perm_type_id=1 AND pi.perm_type='profile_view' ) \
WHERE m.member_id <= ( SELECT cs_value FROM <!--SPHINX_DB_PREFIX-->cache_store WHERE cs_key='sphinx_members_counter' )
# Fields
sql_attr_uint = search_id
sql_attr_uint = friend_only
sql_attr_uint = owner_only
sql_attr_timestamp = joined
sql_attr_multi = uint perm_view from field
sql_attr_multi = uint authorized_users from field
sql_ranged_throttle = 0
}
source members_search_delta : members_search_main
{
# Override the base sql_query_pre
sql_query_pre =
# Query posts for the main source
sql_query = SELECT m.member_id, m.member_id as search_id, m.member_group_id, m.email, m.joined, m.members_display_name, m.name, \
REPLACE( pi.perm_view, '*', 0 ) as perm_view, \
CASE WHEN pi.authorized_users IS NULL THEN 0 ELSE pi.authorized_users END AS authorized_users, \
CASE WHEN pi.friend_only=0 THEN 0 ELSE m.member_id END AS friend_only, \
CASE WHEN pi.owner_only=0 THEN 0 ELSE m.member_id END AS owner_only \
FROM <!--SPHINX_DB_PREFIX-->members m \
LEFT JOIN <!--SPHINX_DB_PREFIX-->permission_index pi ON ( pi.perm_type_id=1 AND pi.perm_type='profile_view' ) \
WHERE m.member_id > ( SELECT cs_value FROM <!--SPHINX_DB_PREFIX-->cache_store WHERE cs_key='sphinx_members_counter' )
}
index members_search_main
{
source = members_search_main
path = <!--SPHINX_BASE_PATH-->/members_search_main
docinfo = extern
mlock = 0
morphology = none
min_word_len = 2
charset_type = sbcs
html_strip = 0
}
index members_search_delta : members_search_main
{
source = members_search_delta
path = <!--SPHINX_BASE_PATH-->/members_search_delta
}
EOF;
File diff suppressed because it is too large. Load diff
@@ -0,0 +1 @@
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
@@ -0,0 +1 @@
<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,39 @@
function checkform() {
isAdmin = $('g_access_cp_yes');
isMod = $('g_is_supmod_yes');
msg = '';
if ( isAdmin && isAdmin.checked == true )
{
msg += 'Пользователи этой группы имеют доступ к Админцентру\n\n';
}
if ( isMod && isMod.checked == true )
{
msg += 'Пользователи этой группы являются супермодераторы.\n\n';
}
if ( msg != '' )
{
if( confirm( "Проверка безопасности\n--------------\nНазвание группы пользователей: " + $F('g_title') + "\n--------------\n\n" + msg + 'Это верно?' ) )
{
return true;
}
else
{
return false;
}
}
}
function stripGuestLegend()
{
$$('.guest_legend').each(
function( elem )
{
elem.hide();
}
);
//$('tabtab-GROUPS|6').hide();
}
@@ -0,0 +1,38 @@
function check_boxes()
{
var ticked = $('maincheckbox').checked;
var checkboxes = document.getElementsByTagName('input');
for ( var i = 0 ; i <= checkboxes.length ; i++ )
{
var e = checkboxes[i];
if ( typeof(e) != 'undefined' && e.type == 'checkbox')
{
var boxname = e.id;
var boxcheck = boxname.replace( /^(.+?)_.+?$/, "$1" );
if ( boxcheck == 'mid' )
{
e.checked = ticked;
}
}
}
}
function checkThisForm()
{
var selectedOpt = $F('manage_type');
if( selectedOpt == 'delete' )
{
return confirm( "Are you SURE you want to delete all of the selected accounts?\n\nThere are no other confirmation screens and there is no way to undo this action!" );
}
else if( selectedOpt == 'unban' )
{
return confirm( "Please note that this action ONLY removes the 'Ban this member' flag!\n\nIf you moved the member to a banned group, or banned the member's IP address, email address or username, you will need to update each of these items separately.\n\nAlternatively you can click 'Cancel' and click on the member's name to use the member's centralized ban management panel." );
}
return false;
}
@@ -0,0 +1,30 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Define the default ajax section
* 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 Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Rev: 4948 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
/**
* Very simply returns the default section if one is not
* passed in the URL
*/
$DEFAULT_SECTION = 'editform';
@@ -0,0 +1,664 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Member property updater (AJAX)
* Last Updated: $Date: 2009-12-04 21:38:22 -0500 (Fri, 04 Dec 2009) $
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @subpackage Members
* @link http://www.iinvisionpower.com
* @version $Revision: 5521 $
*
*/
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_members_ajax_editform extends ipsAjaxCommand
{
/**
* Main class entry point
*
* @access public
* @param object ipsRegistry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
$this->registry->class_localization->loadLanguageFile( array( 'admin_member' ), 'members' );
switch( $this->request['do'] )
{
default:
case 'show':
$this->show();
break;
case 'save_display_name':
$this->save_member_name( 'members_display_name' );
break;
case 'save_name':
$this->save_member_name( 'name' );
break;
case 'save_password':
$this->save_password();
break;
case 'save_email':
$this->save_email();
break;
case 'remove_photo':
$this->remove_photo();
break;
}
}
/**
* Remove user's photo
*
* @access protected
* @return void [Outputs to screen]
*/
protected function remove_photo()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval( $this->request['member_id'] );
//-----------------------------------------
// Get member
//-----------------------------------------
$member = IPSMember::load( $member_id );
if ( ! $member['member_id'] )
{
$this->returnJsonError( $this->lang->words['m_noid'] );
exit();
}
//-----------------------------------------
// Allowed to upload pics for administrators?
//-----------------------------------------
if( $member['g_access_cp'] AND !$this->registry->getClass('class_permissions')->checkPermission( 'member_photo_admin', 'members', 'members' ) )
{
$this->returnJsonError( $this->lang->words['m_editadmin'] );
exit();
}
//-----------------------------------------
// Sort out upload dir
//-----------------------------------------
/* Fix for bug 5075 */
$this->settings[ 'upload_dir'] = str_replace( '&#46;', '.', $this->settings['upload_dir'] );
$upload_path = $this->settings['upload_dir'];
//-----------------------------------------
// Already a dir?
//-----------------------------------------
if ( file_exists( $upload_path . "/profile" ) )
{
# Set path and dir correct
$upload_path .= "/profile";
$upload_dir = "profile/";
}
IPSMember::getFunction()->removeUploadedPhotos( $member_id, $upload_path );
IPSMember::save( $member_id, array( 'extendedProfile' => array( 'pp_main_photo' => '',
'pp_main_width' => 0,
'pp_main_height' => 0,
'pp_thumb_photo' => '',
'pp_thumb_width' => 0,
'pp_thumb_height' => 0,
) ) );
ipsRegistry::getClass('adminFunctions')->saveAdminLog( sprintf($this->lang->words['m_imgremlog'], $member_id ) );
$member = IPSMember::load( $member_id );
$member = IPSMember::buildDisplayData( $member, 0 );
//-----------------------------------------
// Return
//-----------------------------------------
$this->returnJsonArray( array(
'success' => TRUE,
'pp_main_photo' => $member['pp_main_photo'],
'pp_main_width' => $member['pp_main_width'],
'pp_main_height' => $member['pp_main_height']
) );
}
/**
* Change a member's email address
*
* @access protected
* @return void [Outputs to screen]
*/
protected function save_email()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval( $this->request['member_id'] );
$email = trim( $this->request['email'] );
//-----------------------------------------
// Get member
//-----------------------------------------
$member = IPSMember::load( $member_id );
if ( ! $member['member_id'] )
{
$this->returnJsonError( $this->lang->words['m_noid'] );
exit();
}
//-----------------------------------------
// Allowed to edit administrators?
//-----------------------------------------
if( $member['g_access_cp'] AND !$this->registry->getClass('class_permissions')->checkPermission( 'member_edit_admin', 'members', 'members' ) )
{
$this->returnJsonError( $this->lang->words['m_editadmin'] );
exit();
}
//-----------------------------------------
// Is this email addy taken? CONVERGE THIS??
//-----------------------------------------
$email_check = IPSMember::load( mb_strtolower($email) );
if ( $email_check['member_id'] AND $email_check['member_id'] != $member_id )
{
$this->returnJsonError( $this->lang->words['m_emailalready'] );
exit();
}
//-----------------------------------------
// Load handler...
//-----------------------------------------
require_once( IPS_ROOT_PATH . 'sources/handlers/han_login.php' );
$han_login = new han_login( $this->registry );
$han_login->init();
$han_login->changeEmail( trim( mb_strtolower( $member['email'] ) ), trim( mb_strtolower( $email ) ) );
//-----------------------------------------
// We don't want to die just from a Converge error
//-----------------------------------------
/*if ( $han_login->return_code AND ( $han_login->return_code != 'METHOD_NOT_DEFINED' AND $han_login->return_code != 'SUCCESS' ) )
{
$this->returnJsonError( $this->lang->words['m_emailalready'] );
exit();
}*/
//-----------------------------------------
// Update member
//-----------------------------------------
IPSMember::save( $member_id, array( 'core' => array( 'email' => mb_strtolower( $email ) ) ) );
IPSLib::runMemberSync( 'onEmailChange', $member_id, mb_strtolower( $email ) );
ipsRegistry::getClass('adminFunctions')->saveAdminLog( sprintf( $this->lang->words['m_emailchangelog'], $member['email'], $email, $member_id ) );
$this->returnJsonArray( array(
'success' => TRUE,
'email' => $email
) );
}
/**
* Change a member's password
*
* @access protected
* @return void [Outputs to screen]
*/
protected function save_password()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval( $this->request['member_id'] );
$password = IPSText::parseCleanValue( urldecode( $_REQUEST['password'] ) );
$password2 = IPSText::parseCleanValue( urldecode( $_REQUEST['password2'] ) );
$new_key = intval( $this->request['new_key'] );
$new_salt = intval( $this->request['new_salt'] );
$salt = str_replace( '\\', "\\\\", IPSMember::generatePasswordSalt(5) );
$key = IPSMember::generateAutoLoginKey();
$md5_once = md5( trim($password) );
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $password OR ! $password2 )
{
$this->returnJsonError( $this->lang->words['password_nogood'] );
exit();
}
if ( $password != $password2 )
{
$this->returnJsonError( $this->lang->words['m_passmatch'] );
exit();
}
//-----------------------------------------
// Get member
//-----------------------------------------
$member = IPSMember::load( $member_id );
//-----------------------------------------
// Allowed to edit administrators?
//-----------------------------------------
if( $member['g_access_cp'] AND !$this->registry->getClass('class_permissions')->checkPermission( 'member_edit_admin', 'members', 'members' ) )
{
$this->returnJsonError( $this->lang->words['m_editadmin'] );
exit();
}
//-----------------------------------------
// Check Converge: Password
//-----------------------------------------
require_once( IPS_ROOT_PATH . 'sources/handlers/han_login.php' );
$han_login = new han_login( $this->registry );
$han_login->init();
$han_login->changePass( $member['email'], $md5_once );
/*if ( $han_login->return_code != 'METHOD_NOT_DEFINED' AND $han_login->return_code != 'SUCCESS' )
{
$this->returnJsonError( $this->lang->words['m_passchange']);
exit();
}*/
//-----------------------------------------
// Local DB
//-----------------------------------------
$update = array();
if( $new_salt )
{
$update['members_pass_salt'] = $salt;
}
if( $new_key )
{
$update['member_login_key'] = $key;
}
if( count($update) )
{
IPSMember::save( $member_id, array( 'core' => $update ) );
}
IPSMember::updatePassword( $member_id, $md5_once );
IPSLib::runMemberSync( 'onPassChange', $member_id, $password );
ipsRegistry::getClass('adminFunctions')->saveAdminLog( sprintf( $this->lang->words['m_passlog'], $member_id ) );
$this->returnJsonArray( array(
'success' => TRUE,
'password' => "*************"
) );
}
/**
* Update a user's login or display name
*
* @access protected
* @param string Field to update
* @return void [Outputs to screen]
*/
protected function save_member_name( $field='members_display_name' )
{
$member_id = intval( $this->request['member_id'] );
$member = IPSMember::load( $member_id );
//-----------------------------------------
// Allowed to edit administrators?
//-----------------------------------------
if( $member['g_access_cp'] AND !$this->registry->getClass('class_permissions')->checkPermission( 'member_edit_admin', 'members', 'members' ) )
{
$this->returnJsonError( $this->lang->words['m_editadmin'] );
exit();
}
if ( $field == 'members_display_name' )
{
$display_name = $this->convertAndMakeSafe( $_POST['display_name'], 1 );
$display_name = str_replace("&#43;", "+", $display_name );
}
else
{
$display_name = $this->convertAndMakeSafe( $_POST['name'], 1 );
$display_name = str_replace("&#43;", "+", $display_name );
$display_name = str_replace( '|', '&#124;' , $display_name );
$display_name = trim( preg_replace( "/\s{2,}/", " ", $display_name ) );
}
if ( $this->settings['strip_space_chr'] )
{
// use hexdec to convert between '0xAD' and chr
$display_name = IPSText::removeControlCharacters( $display_name );
}
if ( $field == 'members_display_name' AND preg_match( "#[\[\];,\|]#", str_replace('&#39;', "'", str_replace('&amp;', '&', $members_display_name) ) ) )
{
$this->returnJsonError($this->lang->words['m_displaynames']);
}
try
{
if ( IPSMember::getFunction()->updateName( $member_id, $display_name, $field ) === TRUE )
{
if ( $field == 'members_display_name' )
{
ipsRegistry::getClass('adminFunctions')->saveAdminLog(sprintf( $this->lang->words['m_dnamelog'], $member['members_display_name'], $display_name ));
}
else
{
ipsRegistry::getClass('adminFunctions')->saveAdminLog(sprintf( $this->lang->words['m_namelog'], $member['name'], $display_name ) );
//-----------------------------------------
// If updating a name, and display names
// disabled, update display name too
//-----------------------------------------
if( !ipsRegistry::$settings['auth_allow_dnames'] )
{
IPSMember::getFunction()->updateName( $member_id, $display_name, 'members_display_name' );
}
//-----------------------------------------
// I say, did we choose to email 'dis member?
//-----------------------------------------
if ( $this->request['send_email'] == 1 )
{
//-----------------------------------------
// By golly, we did!
//-----------------------------------------
$msg = trim( IPSText::stripslashes( nl2br( $_POST['email_contents'] ) ) );
$msg = str_replace( "{old_name}", $member['name'], $msg );
$msg = str_replace( "{new_name}", $display_name , $msg );
$msg = str_replace( "<#BOARD_NAME#>", $this->settings['board_name'], $msg );
$msg = str_replace( "<#BOARD_ADDRESS#>", $this->settings['board_url'] . '/index.' . $this->settings['php_ext'], $msg );
IPSText::getTextClass('email')->message = stripslashes( IPSText::getTextClass('email')->cleanMessage($msg) );
IPSText::getTextClass('email')->subject = $this->lang->words['m_changesubj'];
IPSText::getTextClass('email')->to = $member['email'];
IPSText::getTextClass('email')->sendMail();
}
}
$this->cache->rebuildCache( 'stats', 'global' );
}
else
{
# We should absolutely never get here. So this is a fail-safe, really to
# prevent a "false" positive outcome for the end-user
$this->returnJsonError($this->lang->words['m_namealready']);
}
}
catch( Exception $error )
{
$this->returnJsonError( $error->getMessage() );
switch( $error->getMessage() )
{
case 'NO_USER':
$this->returnJsonError( $this->lang->words['m_noid'] );
break;
case 'NO_PERMISSION':
case 'NO_NAME':
$this->returnJsonError( sprintf($this->lang->words['m_morethan3'], $this->settings['max_user_name_length'] ) );
break;
case 'ILLEGAL_CHARS':
$this->returnJsonError( $this->lang->words['m_illegal'] );
break;
case 'USER_NAME_EXISTS':
$this->returnJsonError( $this->lang->words['m_namealready'] );
break;
default:
$this->returnJsonError( $error->getMessage() );
break;
}
}
//-----------------------------------------
// Load handler...
//-----------------------------------------
if( $field == 'name' )
{
require_once( IPS_ROOT_PATH . 'sources/handlers/han_login.php' );
$han_login = new han_login( $this->registry );
$han_login->init();
$han_login->changeName( $member['name'], $display_name, $member['email'] );
}
else
{
IPSLib::runMemberSync( 'onNameChange', $member_id, $display_name );
}
$__display_name = addslashes( $display_name );
$this->returnJsonArray( array(
'success' => TRUE,
'display_name' => "$__display_name"
) );
}
/**
* Show the form
*
* @access protected
* @return void [Outputs to screen]
*/
protected function show()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$name = trim( IPSText::alphanumericalClean( $this->request['name'] ) );
$member_id = intval( $this->request['member_id'] );
$output = '';
//-----------------------------------------
// Load language and skin
//-----------------------------------------
$html = $this->registry->output->loadTemplate('cp_skin_member_form');
$this->lang->loadLanguageFile( array( 'admin_member' ) );
//-----------------------------------------
// Get member data
//-----------------------------------------
$member = IPSMember::load( $member_id, 'extendedProfile,customFields' );
//-----------------------------------------
// Got a member?
//-----------------------------------------
if ( ! $member['member_id'] )
{
$this->returnJsonError( $this->lang->words['m_noid'] );
}
//-----------------------------------------
// Return the form
//-----------------------------------------
if ( method_exists( $html, $name ) )
{
$output = $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_ban_member':
if( !$this->registry->getClass('class_permissions')->checkPermission( 'member_ban', 'members', 'members' ) )
{
$this->returnJsonError($this->lang->words['m_noban']);
}
if( $member['g_access_cp'] AND !$this->registry->getClass('class_permissions')->checkPermission( 'member_ban_admin', 'members', 'members' ) )
{
$this->returnJsonError($this->lang->words['m_noban']);
}
//-----------------------------------------
// INIT
//-----------------------------------------
$ban_filters = array( 'email' => array(), 'name' => array(), 'ip' => array() );
$email_banned = false;
$ip_banned = array();
$name_banned = false;
//-----------------------------------------
// Grab existing ban filters
//-----------------------------------------
$this->DB->build( array( 'select' => '*', 'from' => 'banfilters' ) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
$ban_filters[ $r['ban_type'] ][] = $r['ban_content'];
}
//-----------------------------------------
// Check name and email address
//-----------------------------------------
if( in_array( $member['email'], $ban_filters['email'] ) )
{
$email_banned = true;
}
if( in_array( $member['name'], $ban_filters['name'] ) )
{
$name_banned = true;
}
//-----------------------------------------
// Retrieve IP addresses
//-----------------------------------------
$ip_addresses = IPSMember::findIPAddresses( $member['member_id'] );
//-----------------------------------------
// Start form fields
//-----------------------------------------
$form['member'] = ipsRegistry::getClass('output')->formCheckbox( "ban__member", $member['member_banned'] );
$form['email'] = ipsRegistry::getClass('output')->formCheckbox( "ban__email", $email_banned );
$form['name'] = ipsRegistry::getClass('output')->formCheckbox( "ban__name", $name_banned );
$form['note'] = ipsRegistry::getClass('output')->formCheckbox( "ban__note", 0 );
$form['note_field'] = ipsRegistry::getClass('output')->formTextarea( "ban__note_field" );
$form['ips'] = array();
//-----------------------------------------
// What about IPs?
//-----------------------------------------
if( is_array($ip_addresses) AND count($ip_addresses) )
{
foreach( $ip_addresses as $ip_address => $count )
{
if( in_array( $ip_address, $ban_filters['ip'] ) )
{
$form['ips'][ $ip_address ] = ipsRegistry::getClass('output')->formCheckbox( "ban__ip_" . str_replace( '.', '_', $ip_address ), true );
}
else
{
$form['ips'][ $ip_address ] = ipsRegistry::getClass('output')->formCheckbox( "ban__ip_" . str_replace( '.', '_', $ip_address ), false );
}
}
}
$member_groups = array();
foreach( ipsRegistry::cache()->getCache('group_cache') as $group )
{
if( $group['g_id'] == $member['member_group_id'] )
{
$member['_group_title'] = $group['g_title'];
}
$member_groups[] = array( $group['g_id'], $group['g_title'] );
}
$form['groups_confirm'] = ipsRegistry::getClass('output')->formCheckbox( "ban__group_change", 0 );
$form['groups'] = ipsRegistry::getClass('output')->formDropdown( "ban__group", $member_groups, $member['member_group_id'] );
$output = $html->inline_ban_member_form( $member, $form );
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 @@
<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,839 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Bulk mail management
* Last Updated: $Date: 2009-09-22 11:55:32 -0400 (Tue, 22 Sep 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 Members
* @link http://www.iinvisionpower.com
* @version $Revision: 5139 $
*
*/
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly.";
exit();
}
class admin_members_bulkmail_bulkmail 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 skin
//-----------------------------------------
$this->html = $this->registry->output->loadTemplate('cp_skin_bulkmail');
//-----------------------------------------
// Set up stuff
//-----------------------------------------
$this->form_code = $this->html->form_code = 'module=bulkmail&amp;section=bulkmail';
$this->form_code_js = $this->html->form_code_js = 'module=bulkmail&section=bulkmail';
//-----------------------------------------
// Load lang
//-----------------------------------------
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'admin_bulkmail' ) );
switch( $this->request['do'] )
{
case 'mail_new':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'bulkmail_addedit' );
$this->_mailForm('add');
break;
case 'mail_edit':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'bulkmail_addedit' );
$this->_mailForm('edit');
break;
case 'mail_save':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'bulkmail_addedit' );
$this->_mailSave();
break;
case 'mail_preview':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'bulkmail_view' );
$this->_mailPreviewStart();
break;
case 'mail_preview_do':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'bulkmail_view' );
$this->_mailPreviewComplete();
break;
case 'mail_send_start':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'bulkmail_send' );
$this->_mailSendStart();
break;
case 'mail_send_complete':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'bulkmail_send' );
$this->_mailSendComplete();
break;
case 'mail_send_cancel':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'bulkmail_cancel' );
$this->_mailSendCancel();
break;
case 'mail_delete':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'bulkmail_delete' );
$this->_mailDelete();
break;
default:
case 'bulk_mail':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'bulkmail_view' );
$this->_mailStart();
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 bulk mail
*
* @access private
* @return void [Outputs to screen]
*/
private function _mailDelete()
{
$id = intval( $this->request['id'] );
$active = $this->DB->buildAndFetch( array( 'select' => 'mail_id', 'from' => 'bulk_mail', 'where' => 'mail_active=1 AND mail_id <>' . $id ) );
if( !$active['mail_id'] )
{
$this->DB->update( 'task_manager', array( 'task_enabled' => 0 ), "task_key='bulkmail'" );
}
$this->DB->delete( 'bulk_mail', 'mail_id=' . $id );
$this->registry->output->global_message = $this->lang->words['b_deleted'];
$this->_mailStart();
}
/**
* Cancels a bulk mail
*
* @access private
* @return void [Outputs to screen]
*/
private function _mailSendCancel()
{
$this->DB->update( 'bulk_mail', array( 'mail_active' => 0,
'mail_updated' => time(),
), "mail_active=1" );
$this->DB->update( 'task_manager', array( 'task_enabled' => 0 ), "task_key='bulkmail'" );
$this->registry->output->global_message = $this->lang->words['b_cancelled'];
$this->_mailStart();
}
/**
* Processes a bulk mail
*
* @access public
* @return void
*/
public function mailSendProcess()
{
//-----------------------------------------
// Set up
//-----------------------------------------
$done = 0;
$sent = 0;
//-----------------------------------------
// Get it from the db
//-----------------------------------------
$mail = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'bulk_mail', 'where' => 'mail_active=1' ) );
if ( ! $mail['mail_subject'] and ! $mail['mail_content'] )
{
$done = 1;
}
//-----------------------------------------
// Per go...
//-----------------------------------------
$pergo = intval($mail['mail_pergo']);
if ( ! $pergo or $pergo > 1000 )
{
$pergo = 50;
}
//-----------------------------------------
// So far...
//-----------------------------------------
$sofar = intval($mail['mail_sentto']);
$mail['mail_content'] = IPSText::stripslashes( $mail['mail_content'] );
$mail['mail_subject'] = IPSText::stripslashes( $mail['mail_subject'] );
//-----------------------------------------
// Unconvert options
//-----------------------------------------
$opts = unserialize( stripslashes( $mail['mail_opts'] ) );
foreach( $opts as $k => $v )
{
$mail[ $k ] = $v;
}
if ( $mail['mail_html_on'] )
{
$this->settings['html_email'] = 1;
}
//-----------------------------------------
// Format the query
//-----------------------------------------
$query = $this->_buildMembersQuery( $mail );
//-----------------------------------------
// Clear out any other temp headers
//-----------------------------------------
IPSText::getTextClass('email')->clearHeaders();
//-----------------------------------------
// Now get members....
//-----------------------------------------
$this->DB->build( array( 'select' => '*',
'from' => 'members',
'where' => $query,
'order' => 'member_id',
'limit' => array( $sofar, $pergo ) ) );
$o = $this->DB->execute();
while ( $r = $this->DB->fetch( $o ) )
{
$sent++;
$contents = $this->_convertQuicktags( $mail['mail_content'], $r );
IPSText::getTextClass('email')->from = $this->settings['email_out'];
IPSText::getTextClass('email')->to = $r['email'];
IPSText::getTextClass('email')->message = str_replace( "\r\n", "\n", $contents );
IPSText::getTextClass('email')->subject = $mail['mail_subject'];
IPSText::getTextClass('email')->setHeader( 'Precedence', 'bulk' );
IPSText::getTextClass('email')->sendMail();
}
//-----------------------------------------
// Did we send any?
//-----------------------------------------
if ( ! $sent )
{
$done = 1;
}
$this->settings['html_email'] = 0;
//-----------------------------------------
// Save out..
//-----------------------------------------
if ( $done )
{
$this->DB->update( 'bulk_mail', array( 'mail_active' => 0,
'mail_updated' => time(),
'mail_sentto' => $sofar + $sent
), 'mail_id=' . $mail['mail_id'] );
$this->DB->update( 'task_manager', array( 'task_enabled' => 0 ), "task_key='bulkmail'" );
}
else
{
$this->DB->update( 'bulk_mail', array( 'mail_updated' => time(),
'mail_sentto' => $sofar + $sent
), 'mail_id=' . $mail['mail_id'] );
}
}
/**
* Complete bulk mail processing
*
* @access private
* @return void
*/
private function _mailSendComplete()
{
$pergo = intval( $this->request['pergo'] );
$id = intval( $this->request['id'] );
if ( ! $id )
{
$this->registry->output->global_message = $this->lang->words['b_norecord'];
$this->_mailStart();
return;
}
//-----------------------------------------
// Get it from the db
//-----------------------------------------
$mail = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'bulk_mail', 'where' => 'mail_id=' . $id ) );
if ( ! $mail['mail_subject'] and ! $mail['mail_content'] )
{
$this->registry->output->global_message = $this->lang->words['b_nosend'];
$this->_mailStart();
return;
}
//-----------------------------------------
// Update mail
//-----------------------------------------
if ( ! $pergo or $pergo > 1000 )
{
$pergo = 50;
}
$this->DB->update( 'bulk_mail', array( 'mail_active' => 1, 'mail_pergo' => $pergo, 'mail_sentto' => 0, 'mail_start' => time() ), 'mail_id=' . $id );
$this->DB->update( 'bulk_mail', array( 'mail_active' => 0 ) , 'mail_id <> ' . $id );
//-----------------------------------------
// Wake up task manager
//-----------------------------------------
require_once( IPS_ROOT_PATH . 'sources/classes/class_taskmanager.php' );
$task = new class_taskmanager( $this->registry );
$this->DB->update( 'task_manager', array( 'task_enabled' => 1 ), "task_key='bulkmail'" );
$this_task = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'task_manager', 'where' => "task_key='bulkmail'" ) );
$newdate = $task->generateNextRun( $this_task );
$this->DB->update( 'task_manager', array( 'task_next_run' => $newdate ), "task_id=".$this_task['task_id'] );
$task->saveNextRunStamp();
//-----------------------------------------
// Sit back and watch the show
//-----------------------------------------
$this->registry->output->global_message = $this->lang->words['b_initiated'];
$this->_mailStart();
}
/**
* Start the sending of the bulk mail
*
* @access private
* @return void
*/
private function _mailSendStart()
{
$id = intval($this->request['id']);
if ( ! $id )
{
$this->registry->output->global_message = $this->lang->words['b_noid'];
$this->_mailStart();
return;
}
//-----------------------------------------
// Get it from the db
//-----------------------------------------
$mail = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'bulk_mail', 'where' => 'mail_id=' . $id ) );
if ( ! $mail['mail_subject'] and ! $mail['mail_content'] )
{
$this->registry->output->global_message = $this->lang->words['b_nosend'];
$this->_mailStart();
return;
}
//-----------------------------------------
// Unconvert options
//-----------------------------------------
$opts = unserialize( stripslashes( $mail['mail_opts'] ) );
foreach( $opts as $k => $v )
{
$mail[ $k ] = $v;
}
//-----------------------------------------
// Format the query
//-----------------------------------------
$query = $this->_buildMembersQuery( $mail );
//-----------------------------------------
// Count how many matches
//-----------------------------------------
$count = $this->DB->buildAndFetch( array( 'select' => 'count(*) as cnt', 'from' => 'members', 'where' => $query ) );
$the_count = intval( $count['cnt'] );
//-----------------------------------------
// Print 'continue' screen
//-----------------------------------------
$this->registry->output->html .= $this->html->mailSendStart( $mail, $the_count );
}
/**
* Process the sending of the bulk mail
*
* @access private
* @return void
*/
private function _mailPreviewComplete()
{
$id = intval($this->request['id']);
$content = "";
//-----------------------------------------
// Grab content and format it
//-----------------------------------------
if( $id )
{
//-----------------------------------------
// Get it from the db
//-----------------------------------------
$mail = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'bulk_mail', 'where' => 'mail_id=' . $id ) );
$content = $this->_convertQuickTags( IPSText::stripslashes($mail['mail_content']), $this->memberData );
$mailopts = unserialize( $mail['mail_opts'] );
if( $mailopts['mail_html_on'] == 0 )
{
$content = nl2br( htmlspecialchars( $content, ENT_QUOTES ) );
}
}
else
{
if( $_POST['html'] )
{
$content = $this->_convertQuickTags( IPSText::stripslashes($_POST['text']), $this->memberData );
}
else
{
$content = nl2br( htmlspecialchars( $this->_convertQuickTags( IPSText::stripslashes($_POST['text']), $this->memberData ), ENT_QUOTES) );
}
}
//-----------------------------------------
// Print headers and content (to iframe)
//-----------------------------------------
header("Content-Disposition: inline");
ob_end_clean();
$this->registry->output->html .= $this->html->mailIframeContent( $content );
$this->registry->output->printPopupWindow();
exit();
}
/**
* Preview the email (javascript popup)
*
* @access private
* @return void
*/
private function _mailPreviewStart()
{
$this->registry->output->html .= $this->html->mailPopupContent();
$this->registry->output->printPopupWindow();
exit();
}
/**
* Save the new or edited bulk mail
*
* @access private
* @return void
*/
private function _mailSave()
{
//-----------------------------------------
// Set up
//-----------------------------------------
$ids = array();
$id = intval($this->request['id']);
$type = $this->request['type'];
//-----------------------------------------
// Start
//-----------------------------------------
if ( ! $this->request['mail_subject'] or ! $this->request['mail_content'] )
{
$this->registry->output->global_message = $this->lang->words['b_entercont'];
$this->_mailForm( $type );
return;
}
//-----------------------------------------
// Groups...
//-----------------------------------------
foreach( $_POST as $key => $value )
{
if( preg_match( "/^sg_(\d+)$/", $key, $match ) )
{
if( $this->request[ $match[0] ] AND $value )
{
$ids[] = $match[1];
}
}
}
$ids = IPSLib::cleanIntArray( $ids );
if( ! count( $ids ) )
{
$this->registry->output->global_message = $this->lang->words['b_nogroups'];
$this->_mailForm( $type );
return;
}
$this->request[ 'mail_groups'] = implode( ",", $ids );
//-----------------------------------------
// Format the query
//-----------------------------------------
$query = $this->_buildMembersQuery( array( 'mail_post_ltmt' => $this->request['mail_post_ltmt'],
'mail_filter_post' => $this->request['mail_filter_post'],
'mail_visit_ltmt' => $this->request['mail_visit_ltmt'],
'mail_filter_visit' => intval($this->request['mail_filter_visit']),
'mail_joined_ltmt' => $this->request['mail_joined_ltmt'],
'mail_filter_joined' => intval($this->request['mail_filter_joined']),
'mail_honor' => 1,//intval($this->request['mail_honor']),
'mail_groups' => $this->request['mail_groups'],
) );
//-----------------------------------------
// Count how many matches
//-----------------------------------------
$count = $this->DB->buildAndFetch( array( 'select' => 'count(*) as cnt', 'from' => 'members', 'where' => $query ) );
if ( ! $count['cnt'] )
{
$this->registry->output->global_message = $this->lang->words['b_nonefound'];
$this->_mailForm( $type );
return;
}
//-----------------------------------------
// Save
//-----------------------------------------
$save_array = array(
'mail_subject' => IPSText::stripslashes( $_POST['mail_subject'] ),
'mail_content' => IPSText::stripslashes( $_POST['mail_content'] ),
'mail_groups' => $this->request['mail_groups'],
'mail_honor' => 1,//intval($this->request['mail_honor']),
'mail_start' => time(),
'mail_updated' => time(),
'mail_sentto' => 0,
'mail_opts' => serialize( array( 'mail_post_ltmt' => $_POST['mail_post_ltmt'],
'mail_filter_post' => $_POST['mail_filter_post'],
'mail_visit_ltmt' => $_POST['mail_visit_ltmt'],
'mail_filter_visit' => $_POST['mail_filter_visit'],
'mail_joined_ltmt' => $_POST['mail_joined_ltmt'],
'mail_filter_joined' => $_POST['mail_filter_joined'],
'mail_html_on' => $_POST['mail_html_on'],
) )
);
if ( $type == 'add' )
{
//-----------------------------------------
// Save to DB
//-----------------------------------------
$this->DB->insert( 'bulk_mail', $save_array );
$this->request[ 'id'] = $this->DB->getInsertId( );
ipsRegistry::getClass('adminFunctions')->saveAdminLog( sprintf( $this->lang->words['b_maillogadd'], $this->request['mail_subject'] ) );
$this->_mailSendStart();
return;
}
else
{
if ( ! $id )
{
$this->registry->output->global_message = $this->lang->words['b_norecord'];
$this->_mailForm( $type );
return;
}
$this->DB->update( 'bulk_mail', $save_array, 'mail_id=' . $id );
ipsRegistry::getClass('adminFunctions')->saveAdminLog( sprintf( $this->lang->words['b_maillogedit'], $this->request['mail_subject'] ) );
$this->registry->output->global_message = $this->lang->words['b_edited'];
$this->_mailStart();
return;
}
}
/**
* Show the edit bulk mail form
*
* @access private
* @param string [add|edit]
* @return void
*/
private function _mailForm( $type='add' )
{
//-----------------------------------------
// Init some values
//-----------------------------------------
$id = intval($this->request['id']);
if ( $type == 'add' )
{
$mail = array();
}
else
{
$mail = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'bulk_mail', 'where' => 'mail_id='.$this->request['id'] ) );
}
if ( $this->request['mail_groups'] )
{
$mail['mail_groups'] = $this->request['mail_groups'];
}
//-----------------------------------------
// Format mail content
//-----------------------------------------
$mail_content = $_POST['mail_content'] ? IPSText::stripslashes($_POST['mail_content']) : $mail['mail_content'];
$mail_content = preg_replace( "[^\r]\n", "\r\n", $mail_content );
if ( !$mail_content and $type == 'add' )
{
$mail_content = $this->_getDefaultMailContents();
}
$mail_content = htmlspecialchars( $mail_content, ENT_QUOTES );
$this->registry->output->html .= $this->html->mailForm( $type, $mail, $mail_content );
}
/**
* Show the main bulk mail overview screen
*
* @access private
* @return void
*/
private function _mailStart()
{
$content = '';
$st = intval( $this->request['st'] );
$perpage = 50;
/* Get count */
$items = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as cnt',
'from' => 'bulk_mail' ) );
//-----------------------------------------
// Get mail from DB
//-----------------------------------------
$this->DB->build( array( 'select' => '*', 'from' => 'bulk_mail', 'order' => 'mail_start DESC', 'limit' => array( $st, $perpage ) ) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
$r['_mail_start'] = ipsRegistry::getClass( 'class_localization')->getDate( $r['mail_start'], 'SHORT' );
$r['_mail_sentto'] = ipsRegistry::getClass('class_localization')->formatNumber( $r['mail_sentto'] ) . ' members';
$content .= $this->html->mailOverviewRow( $r );
}
/* Pages */
$pages = $this->registry->output->generatePagination( array( 'totalItems' => $items['cnt'],
'itemsPerPage' => $perpage,
'currentStartValue' => $st,
'baseUrl' => $this->settings['base_url'] . 'app=members&amp;module=bulkmail&do=bulk_mail' ) );
$this->registry->output->html .= $this->html->mailOverviewWrapper( $content, $pages );
}
/**
* Build the query to retrieve the members
*
* @access private
* @param array Arguments to send to the query
* @return string Formatted query
*/
private function _buildMembersQuery( $args = array() )
{
$query = array();
if ( is_numeric($args['mail_filter_post']) )
{
$ltmt = $args['mail_post_ltmt'] == 'lt' ? '<' : '>';
$query[] = "posts " . $ltmt . " " . intval($args['mail_filter_post']);
}
if ( $args['mail_filter_visit'] )
{
$ltmt = $args['mail_visit_ltmt'] == 'lt' ? '>' : '<';
$time = time() - ( $args['mail_filter_visit'] * 86400 );
$query[] = "last_visit " . $ltmt . " " . $time;
}
if ( $args['mail_filter_joined'] )
{
$ltmt = $args['mail_joined_ltmt'] == 'lt' ? '>' : '<';
$time = time() - ( $args['mail_filter_joined'] * 86400 );
$query[] = "joined " . $ltmt . " " . $time;
}
if ( $args['mail_honor'] )
{
$query[] = "allow_admin_mails=1";
}
if ( $args['mail_groups'] )
{
$tmp_q = '(member_group_id IN (' . $args['mail_groups'] . ')';
$temp = explode( ',', $args['mail_groups'] );
if ( is_array( $temp ) and count( $temp ) )
{
$tmp = array();
foreach( $temp as $id )
{
$tmp[] = $this->DB->buildConcat( array( array( ',', 'string' ), array( 'mgroup_others' ), array( ',', 'string' ) ) ) . "LIKE '%,{$id},%'";
}
$tmp_q .= " OR ( " . implode( ' OR ', $tmp ) . " ) )";
}
else
{
$tmp_q .= ")";
}
$query[] = $tmp_q;
}
return implode( ' AND ', $query );
}
/**
* Conver the 'quick tags' in the email
*
* @access private
* @param string The email contents
* @param array Member information
* @return string The email contents, replaced
*/
private function _convertQuickTags( $contents="", $member=array() )
{
$contents = str_replace( "{board_name}" , str_replace( "&#39;", "'", $this->settings['board_name'] ) , $contents );
$contents = str_replace( "{board_url}" , $this->settings['board_url'] . "/index." . $this->settings['php_ext'] , $contents );
$contents = str_replace( "{reg_total}" , $this->caches['stats']['mem_count'] , $contents );
$contents = str_replace( "{total_posts}" , $this->caches['stats']['total_topics'] + $this->caches['stats']['total_replies'] , $contents );
$contents = str_replace( "{busy_count}" , $this->caches['stats']['most_count'] , $contents );
$contents = str_replace( "{busy_time}" , ipsRegistry::getClass( 'class_localization')->getDate( $this->caches['stats']['most_date'], 'SHORT' ), $contents );
$contents = str_replace( "{member_id}" , $member['member_id'], $contents );
$contents = str_replace( "{member_name}" , $member['members_display_name'], $contents );
$contents = str_replace( "{member_joined}", ipsRegistry::getClass( 'class_localization')->getDate( $member['joined'], 'JOINED' ), $contents );
$contents = str_replace( "{member_posts}" , $member['posts'], $contents );
return $contents;
}
/**
* Retrieve the 'default' email contents
*
* @access private
* @return string Default email contents
*/
private function _getDefaultMailContents()
{
$mail = $this->lang->words['b_mailcontents'];
return $mail;
}
}
@@ -0,0 +1,30 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Define the default bulkmail section
* 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 Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Rev: 4948 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
/**
* Very simply returns the default section if one is not
* passed in the URL
*/
$DEFAULT_SECTION = 'bulkmail';
@@ -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,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<menu>
<tabitems>
<item>
<title>Рассылки</title>
<subitems>
<subitem>
<subitemtitle>Рассылки</subitemtitle>
<subsection>bulkmail</subsection>
<subitemurl>do=bulk_mail</subitemurl>
<subitemrolekey></subitemrolekey>
<subisredirect>0</subisredirect>
</subitem>
</subitems>
</item>
</tabitems>
</menu>
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<permissions>
<group>
<grouptitle>Управление рассылками</grouptitle>
<items>
<item>
<key>bulkmail_addedit</key>
<string>Может добавлять/изменять рассылки?</string>
</item>
<item>
<key>bulkmail_delete</key>
<string>Может удалять рассылки?</string>
</item>
</items>
</group>
<group>
<grouptitle>Отправка рассылок</grouptitle>
<items>
<item>
<key>bulkmail_view</key>
<string>Может просматривать текущие рассылки?</string>
</item>
<item>
<key>bulkmail_send</key>
<string>Может запускать отправку рассылки?</string>
</item>
<item>
<key>bulkmail_cancel</key>
<string>Может отменить отправку рассылки?</string>
</item>
</items>
</group>
</permissions>
@@ -0,0 +1,30 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Define the default groups section
* 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 Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Rev: 4948 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
/**
* Very simply returns the default section if one is not
* passed in the URL
*/
$DEFAULT_SECTION = 'groups';
@@ -0,0 +1,877 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Group management
* Last Updated: $Date: 2009-11-25 05:46:35 -0500 (Wed, 25 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 Members
* @link http://www.iinvisionpower.com
* @version $Revision: 5468 $
*
*/
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_members_groups_groups 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 skin
//-----------------------------------------
$this->html = $this->registry->output->loadTemplate('cp_skin_groups');
//-----------------------------------------
// Set up stuff
//-----------------------------------------
$this->form_code = $this->html->form_code = 'module=groups&amp;section=groups';
$this->form_code_js = $this->html->form_code_js = 'module=groups&section=groups';
//-----------------------------------------
// Load lang
//-----------------------------------------
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'admin_groups' ) );
///----------------------------------------
// What to do...
//-----------------------------------------
switch( $this->request['do'] )
{
case 'doadd':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'groups_add' );
$this->_saveGroup('add');
break;
case 'add':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'groups_add' );
$this->_groupForm('add');
break;
case 'edit':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'groups_edit' );
$this->_groupForm('edit');
break;
case 'doedit':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'groups_edit' );
$this->_saveGroup('edit');
break;
case 'delete':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'groups_delete' );
$this->_deleteForm();
break;
case 'dodelete':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'groups_delete' );
$this->_doDelete();
break;
case 'master_xml_export':
$this->masterXMLExport();
break;
case 'groups_overview':
default:
$this->_mainScreen();
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();
}
/**
* List the groups
*
* @access private
* @return void [Outputs to screen]
*/
private function _mainScreen()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$g_array = array();
$content = "";
$form = array();
$rows = array();
//-----------------------------------------
// Page details
//-----------------------------------------
$this->registry->output->extra_nav[] = array( $this->form_code, $this->lang->words['g_nav'] );
//-----------------------------------------
// Get groups
//-----------------------------------------
$this->DB->build( array( 'select' => 'g_id, g_access_cp, g_is_supmod, g_title, prefix, suffix',
'from' => 'groups',
'order' => 'g_title' ) );
$o = $this->DB->execute();
while ( $row = $this->DB->fetch( $o ) )
{
$_extra = ( $this->request['showSecondary'] ) ? ' OR mgroup_others LIKE \'%,' . intval($row['g_id']) . ',%\'' : '';
/* As much as I hate nested queries, this is actually quicker especially when you add in the LIKE check.*/
$count = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as count',
'from' => 'members',
'where' => 'member_group_id=' . intval($row['g_id']) . $_extra ) );
$row['count'] = $count['count'];
$rows[ $row['g_id'] ] = $row;
}
foreach( $rows as $row )
{
//-----------------------------------------
// Set up basics
//-----------------------------------------
$row['_can_delete'] = ( $row['g_id'] > 4 ) ? 1 : 0;
$row['_can_acp'] = ( $row['g_access_cp'] == 1 ) ? 1 : 0;
$row['_can_supmod'] = ( $row['g_is_supmod'] == 1 ) ? 1 : 0;
//-----------------------------------------
// Add
//-----------------------------------------
$content .= $this->html->groupsOverviewRow( $row );
//-----------------------------------------
// Add to array
//-----------------------------------------
$g_array[] = array( $row['g_id'], $row['g_title'] );
}
//-----------------------------------------
// And output
//-----------------------------------------
$this->registry->output->html .= $this->html->groupsOverviewWrapper( $content, $g_array );
}
/**
* Exports the groups to a master XML file for distribution
*
* @access public
* @return void [Outputs to screen]
*/
public function masterXMLExport()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$entry = array();
$skip = IPSLib::fetchNonDefaultGroupFields();
//-----------------------------------------
// Get XML class
//-----------------------------------------
require_once( IPS_KERNEL_PATH . 'class_xml.php' );
$xml = new class_xml();
$xml->doc_type = IPS_DOC_CHAR_SET;
$xml->xml_set_root( 'export', array( 'exported' => time() ) );
//-----------------------------------------
// Set group
//-----------------------------------------
$xml->xml_add_group( 'group' );
//-----------------------------------------
// Grab our default 6 groups
//-----------------------------------------
$this->DB->build( array( 'select' => '*',
'from' => 'groups',
'order' => 'g_id ASC',
'limit' => array( 0, 6 )
) );
$this->DB->execute();
while ( $r = $this->DB->fetch() )
{
$content = array();
$r['g_icon'] = '';
//-----------------------------------------
// Sort the fields...
//-----------------------------------------
foreach( $r as $k => $v )
{
if ( ! in_array( $k, $skip ) )
{
$content[] = $xml->xml_build_simple_tag( $k, $v );
}
}
$entry[] = $xml->xml_build_entry( 'row', $content );
}
$xml->xml_add_entry_to_group( 'group', $entry );
$xml->xml_format_document();
//-----------------------------------------
// Print to browser
//-----------------------------------------
$this->registry->output->showDownload( $xml->xml_document, 'groups.xml', '', 0 );
}
/**
* Form to delete a group
*
* @access private
* @return void [Outputs to screen]
*/
private function _deleteForm()
{
$group_id = intval($this->request['id']);
$group = $this->caches['group_cache'][ $group_id ];
if ( !$group_id )
{
$this->registry->output->showError( $this->lang->words['g_whichgroup'], 1120 );
}
if ( $group_id < 6 )
{
$this->registry->output->showError( $this->lang->words['g_preset'], 1121 );
}
if( $group['g_access_cp'] )
{
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'groups_delete_admin' );
}
//-----------------------------------------
// How many users will we be moving?
//-----------------------------------------
$black_adder = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as users', 'from' => 'members', 'where' => "member_group_id=" . $group_id ) );
$extra_group = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as users', 'from' => 'members', 'where' => "mgroup_others LIKE '%,". $group_id .",%'" ) );
$black_adder['users'] = $black_adder['users'] > 0 ? $black_adder['users'] : 0;
$extra_group['users'] = $extra_group['users'] > 1 ? $extra_group['users'] : 0;
$this->registry->output->html .= $this->html->groupDelete( $group, $black_adder['users'], $extra_group['users'] );
}
/**
* Delete the group
*
* @access private
* @return void [Outputs to screen]
*/
private function _doDelete()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$this->request['id'] = intval($this->request['id'] );
$this->request['to_id'] = intval($this->request['to_id'] );
//-----------------------------------------
// Auth check...
//-----------------------------------------
ipsRegistry::getClass('adminFunctions')->checkSecurityKey( $this->request['secure_key'] );
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $this->request['id'] )
{
$this->registry->output->showError( $this->lang->words['g_whichgroup'], 1122 );
}
if ( $this->request['id'] < 6 )
{
$this->registry->output->showError( $this->lang->words['g_preset'], 1124 );
}
if ( ! $this->request['to_id'] )
{
$this->registry->output->showError( $this->lang->words['g_mecries'], 1123 );
}
//-----------------------------------------
// Check to make sure that the relevant groups exist.
//-----------------------------------------
$original = $this->caches['group_cache'][ $this->request['id'] ];
$move_to = $this->caches['group_cache'][ $this->request['to_id'] ];
if( !count($original) )
{
$this->registry->output->showError( $this->lang->words['g_whichgroup'], 1125 );
}
if( !count($move_to) )
{
$this->registry->output->showError( $this->lang->words['g_mecries'], 1126 );
}
//-----------------------------------------
// Check restrictions.
//-----------------------------------------
if( $original['g_access_cp'] )
{
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'groups_delete_admin' );
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'member_move_admin1', 'members', 'members' );
}
else if( $move_to['g_access_cp'] )
{
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'member_move_admin2', 'members', 'members' );
}
//-----------------------------------------
// Move and delete
//-----------------------------------------
$this->DB->update( 'members', array( 'member_group_id' => $this->request['to_id'] ), 'member_group_id=' . $this->request['id'] );
$this->DB->delete( 'groups', "g_id=" . $this->request['id'] );
$this->DB->delete( 'admin_permission_rows', "row_id_type='group' AND row_id=" . $this->request['id'] );
//-----------------------------------------
// Can't promote to non-existent group
//-----------------------------------------
foreach( $this->cache->getCache('group_cache') as $row )
{
$promotion = explode( '&', $row['g_promotion'] );
if( $promotion[0] == $this->request['id'] )
{
$this->DB->update( 'groups', array( 'g_promotion' => '-1&-1' ), 'g_id=' . $row['g_id'] );
}
}
//-----------------------------------------
// Remove from moderators table
//-----------------------------------------
$this->DB->delete( 'moderators', "is_group=1 AND group_id=" . $this->request['id'] );
//-----------------------------------------
// Remove as a secondary group
//-----------------------------------------
$this->DB->build( array(
'select' => 'member_group_id, mgroup_others, member_id',
'from' => 'members',
'where' => "mgroup_others LIKE '%," . $this->request['id'] . ",%'"
) );
$exg = $this->DB->execute();
while( $others = $this->DB->fetch($exg) )
{
$extra = array();
$extra = explode( ",", IPSText::cleanPermString( $others['mgroup_others'] ) );
$to_insert = array();
if( count( $extra ) )
{
foreach( $extra as $mgroup_other )
{
if( $mgroup_other != $this->request['id'] )
{
if( $mgroup_other != "" )
{
$to_insert[] = $mgroup_other;
}
}
}
if( count( $to_insert ) )
{
$new_others = ',' . implode( ',', $to_insert ) . ',';
}
else
{
$new_others = "";
}
$this->DB->update( 'members', array( 'mgroup_others' => $new_others ), 'member_id=' . $others['member_id'] );
}
}
//-----------------------------------------
// Rebuild caches
//-----------------------------------------
$this->rebuildGroupCache();
$this->cache->rebuildCache( 'moderators', 'forums' );
ipsRegistry::getClass('adminFunctions')->saveAdminLog( sprintf( $this->lang->words['g_removedlog'], $original['g_title'] ) );
$this->registry->output->global_message = $this->lang->words['g_removed'];
$this->_mainScreen();
}
/**
* Save the group [add/edit]
*
* @access private
* @param string 'add' or 'edit'
* @return void [Outputs to screen]
*/
private function _saveGroup( $type='edit' )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$group_id = intval($this->request['id']);
$oldGroup = $this->caches['group_cache'][ $group_id ];
//-----------------------------------------
// Auth check...
//-----------------------------------------
ipsRegistry::getClass('adminFunctions')->checkSecurityKey( $this->request['secure_key'] );
//-----------------------------------------
// Check...
//-----------------------------------------
if ( ! $this->request['g_title'] )
{
$this->registry->output->showError( $this->lang->words['g_title_error'], 1127 );
}
if( intval($this->request['g_max_mass_pm']) > 500 )
{
$this->registry->output->showError( $this->lang->words['g_mass_pm_too_large'], 1127 );
}
#MSSQL needs a check on this
if ( IPSText::mbstrlen( $this->request['g_title'] ) > 32 )
{
$this->registry->output->showError( $this->lang->words['g_title_error'], 1127 );
}
if ( $type == 'edit' )
{
if ( !$group_id )
{
$this->registry->output->showError( $this->lang->words['g_whichgroup'], 1128 );
}
//-----------------------------------------
// Check restrictions.
//-----------------------------------------
if( $this->caches['group_cache'][ $group_id ]['g_access_cp'] )
{
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'groups_edit_admin' );
}
}
//-----------------------------------------
// Check restrictions.
//-----------------------------------------
if( ( $type == 'add' OR !$this->caches['group_cache'][ $group_id ]['g_access_cp'] ) AND $this->request['g_access_cp'] )
{
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'groups_add_admin' );
}
//-----------------------------------------
// Sort out the perm mask id things
//-----------------------------------------
$new_perm_set_id = 0;
if( $this->request['g_new_perm_set'] )
{
$this->DB->insert( 'forum_perms', array( 'perm_name' => $this->request['g_new_perm_set'] ) );
$new_perm_set_id = $this->DB->getInsertId();
}
else
{
if ( !is_array( $this->request['permid'] ) )
{
$this->registry->output->showError( $this->lang->words['g_oneperm'], 1129 );
}
}
$this->lang->loadLanguageFile( array( 'admin_permissions' ), 'members' );
//-----------------------------------------
// Some other generic fields
//-----------------------------------------
$promotion_a = '-1'; // id
$promotion_b = '-1'; // posts
if ( $this->request['g_promotion_id'] AND $this->request['g_promotion_id'] > 0 )
{
$promotion_a = $this->request['g_promotion_id'];
$promotion_b = $this->request['g_promotion_posts'];
}
if ( $this->request['g_attach_per_post'] and $this->request['g_attach_max'] > 0 )
{
if ( $this->request['g_attach_per_post'] > $this->request['g_attach_max'] )
{
$this->registry->output->global_message = $this->lang->words['g_pergreater'];
$this->_groupForm('edit');
return;
}
}
$this->request[ 'p_max'] = str_replace( ":", "", $this->request['p_max'] );
$this->request[ 'p_width'] = str_replace( ":", "", $this->request['p_width'] );
$this->request[ 'p_height'] = str_replace( ":", "", $this->request['p_height'] );
$sig_limits = array(
$this->request['use_signatures'],
$this->request['max_images'],
$this->request['max_dims_x'],
$this->request['max_dims_y'],
$this->request['max_urls'],
$this->request['max_lines'],
);
//-----------------------------------------
// Set the db array
//-----------------------------------------
$db_string = array(
'g_view_board' => intval($this->request['g_view_board']),
'g_mem_info' => intval($this->request['g_mem_info']),
'g_can_add_friends' => intval($this->request['g_can_add_friends']),
'g_use_search' => intval($this->request['g_use_search']),
'g_email_friend' => intval($this->request['g_email_friend']),
'g_invite_friend' => $this->request['g_invite_friend'] ? intval( $this->request['g_invite_friend'] ) : 0,
'g_edit_profile' => intval($this->request['g_edit_profile']),
'g_use_pm' => intval($this->request['g_use_pm']),
'g_pm_perday' => intval($this->request['g_pm_perday']),
'g_is_supmod' => intval($this->request['g_is_supmod']),
'g_access_cp' => intval($this->request['g_access_cp']),
'g_title' => trim($this->request['g_title']),
'g_access_offline' => intval($this->request['g_access_offline']),
'g_dname_changes' => intval($this->request['g_dname_changes']),
'g_dname_date' => intval($this->request['g_dname_date']),
'prefix' => trim( IPSText::safeslashes( $_POST['prefix'] ) ),
'suffix' => trim( IPSText::safeslashes( $_POST['suffix'] ) ),
'g_hide_from_list' => intval($this->request['g_hide_from_list']),
'g_perm_id' => $new_perm_set_id ? $new_perm_set_id : implode( ",", $this->request['permid'] ),
'g_icon' => trim( IPSText::safeslashes( $_POST['g_icon'] ) ),
'g_attach_max' => $this->request['g_attach_max'],
'g_avatar_upload' => intval($this->request['g_avatar_upload']),
'g_max_messages' => intval($this->request['g_max_messages']),
'g_max_mass_pm' => intval($this->request['g_max_mass_pm']),
'g_pm_flood_mins' => intval($this->request['g_pm_flood_mins']),
'g_search_flood' => intval($this->request['g_search_flood']),
'g_promotion' => $promotion_a . '&' . $promotion_b,
'g_photo_max_vars' => $this->request['p_max'].':'.$this->request['p_width'].':'.$this->request['p_height'],
'g_dohtml' => intval($this->request['g_dohtml']),
'g_email_limit' => intval($this->request['join_limit']).':'.intval($this->request['join_flood']),
'g_bypass_badwords' => intval($this->request['g_bypass_badwords']),
'g_can_msg_attach' => intval($this->request['g_can_msg_attach']),
'g_attach_per_post' => intval($this->request['g_attach_per_post']),
'g_rep_max_positive' => intval( $this->request['g_rep_max_positive'] ),
'g_rep_max_negative' => intval( $this->request['g_rep_max_negative'] ),
'g_signature_limits' => implode( ':', $sig_limits ),
'g_hide_online_list' => intval( $this->request['g_hide_online_list'] ),
'g_displayname_unit' => intval( $this->request['g_displayname_unit'] ),
'g_sig_unit' => intval( $this->request['g_sig_unit'] ),
'g_bitoptions' => IPSBWOPtions::freeze( $this->request, 'groups', 'global' ), # Saves all BW options for all apps
);
//-----------------------------------------
// Ok? Load interface and child classes
//-----------------------------------------
IPSLib::loadInterface( 'admin/group_form.php' );
foreach( ipsRegistry::$applications as $app_dir => $app_data )
{
if ( ! IPSLib::appIsInstalled( $app_dir ) )
{
continue;
}
if ( file_exists( IPSLib::getAppDir( $app_dir ) . '/extensions/admin/group_form.php' ) )
{
require_once( IPSLib::getAppDir( $app_dir ) . '/extensions/admin/group_form.php' );
$_class = 'admin_group_form__' . $app_dir;
$_object = new $_class( $this->registry );
$remote = $_object->getForSave();
$db_string = array_merge( $remote, $db_string );
}
}
$this->DB->force_data_type = array( 'g_title' => 'string' );
//-----------------------------------------
// Editing...do an update
//-----------------------------------------
if ($type == 'edit')
{
$this->DB->update( 'groups', $db_string, 'g_id=' . $group_id );
//-----------------------------------------
// Update moderator table too
//-----------------------------------------
$this->DB->update( 'moderators', array( 'group_name' => $db_string['g_title'] ), 'group_id=' . $group_id );
ipsRegistry::getClass('adminFunctions')->saveAdminLog( sprintf( $this->lang->words['g_editedlog'], $db_string['g_title'] ) );
$this->registry->output->global_message = $this->lang->words['g_edited'];
}
else
{
$this->DB->insert( 'groups', $db_string );
$group_id = $this->DB->getInsertId();
ipsRegistry::getClass('adminFunctions')->saveAdminLog( sprintf( $this->lang->words['g_addedlog'], $db_string['g_title'] ) );
$this->registry->output->global_message = $this->lang->words['g_added'];
}
$this->rebuildGroupCache();
if( $new_perm_set_id )
{
$from = '';
if( ( $type == 'edit' AND $db_string['g_access_cp'] AND !$oldGroup['g_access_cp'] ) OR ( $type == 'add' AND $db_string['g_access_cp'] ) )
{
//-----------------------------------------
// Do they already have restrictions?
//-----------------------------------------
$test = $this->DB->buildAndFetch( array( 'select' => 'row_id', 'from' => 'admin_permission_rows', 'where' => "row_id_type='group' AND row_id=" . $group_id ) );
if( !$test['row_id'] )
{
$from = '&amp;_from=group-' . $group_id;
}
}
$this->registry->output->doneScreen( $this->lang->words['per_saved'], $this->lang->words['per_manage'], 'module=groups&amp;section=permissions&amp;do=edit_set_form' . $from . '&amp;id=' . $new_perm_set_id, 'redirect' );
return;
}
else
{
if( ( $type == 'edit' AND $db_string['g_access_cp'] AND !$oldGroup['g_access_cp'] ) OR ( $type == 'add' AND $db_string['g_access_cp'] ) )
{
//-----------------------------------------
// Do they already have restrictions?
//-----------------------------------------
$test = $this->DB->buildAndFetch( array( 'select' => 'row_id', 'from' => 'admin_permission_rows', 'where' => "row_id_type='group' AND row_id=" . $group_id ) );
if( !$test['row_id'] )
{
$this->registry->output->html .= $this->html->groupAdminConfirm( $group_id );
}
}
$this->_mainScreen();
}
}
/**
* Rebuilds the group cache
*
* @access public
* @return void
*/
public function rebuildGroupCache()
{
$cache = array();
$this->DB->build( array( 'select' => '*',
'from' => 'groups',
'order' => 'g_title ASC' ) );
$this->DB->execute();
while ( $i = $this->DB->fetch() )
{
$cache[ $i['g_id'] ] = IPSLib::unpackGroup( $i );
}
$this->cache->setCache( 'group_cache', $cache, array( 'array' => 1 ) );
}
/**
* Show the add/edit group form
*
* @access private
* @param string 'add' or 'edit'
* @return void [Outputs to screen]
*/
private function _groupForm( $type='edit' )
{
//-----------------------------------------
// Grab group data and start us off
//-----------------------------------------
if ($type == 'edit')
{
if ($this->request['id'] == "")
{
$this->registry->output->showError( $this->lang->words['g_whichgroup'], 11210 );
}
$group = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'groups', 'where' => "g_id=" . intval($this->request['id']) ) );
$group = IPSLib::unpackGroup( $group );
//-----------------------------------------
// Check restrictions.
//-----------------------------------------
if( $group['g_access_cp'] )
{
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'groups_edit_admin' );
}
}
else
{
$group = array();
if( $this->request['id'] )
{
$group = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'groups', 'where' => "g_id=" . intval($this->request['id']) ) );
$group = IPSLib::unpackGroup( $group );
}
$group['g_title'] = 'New Group';
}
//-----------------------------------------
// Grab permission masks
//-----------------------------------------
$perm_masks = array();
$this->DB->build( array( 'select' => '*', 'from' => 'forum_perms' ) );
$this->DB->execute();
while ( $r = $this->DB->fetch() )
{
$perm_masks[] = array( $r['perm_id'], $r['perm_name'] );
}
//-----------------------------------------
// Ok? Load interface and child classes
//-----------------------------------------
$blocks = array( 'tabs' => array(), 'area' => array() );
IPSLib::loadInterface( 'admin/group_form.php' );
$tabsUsed = 2;
$firsttab = false;
foreach( ipsRegistry::$applications as $app_dir => $app_data )
{
if ( ! IPSLib::appIsInstalled( $app_dir ) )
{
continue;
}
if ( file_exists( IPSLib::getAppDir( $app_dir ) . '/extensions/admin/group_form.php' ) )
{
require_once( IPSLib::getAppDir( $app_dir ) . '/extensions/admin/group_form.php' );
$_class = 'admin_group_form__' . $app_dir;
if ( class_exists( $_class ) )
{
$_object = new $_class( $this->registry );
$data = $_object->getDisplayContent( $group, $tabsUsed );
$blocks['area'][ $app_dir ] = $data['content'];
$blocks['tabs'][ $app_dir ] = $data['tabs'];
$tabsUsed = $data['tabsUsed'] ? ( $tabsUsed + $data['tabsUsed'] ) : ( $tabsUsed + 1 );
if ( $this->request['_initTab'] == $app_dir )
{
$firsttab = $tabsUsed;
}
}
}
}
//-----------------------------------------
// And output to form
//-----------------------------------------
$this->registry->output->html .= $this->html->groupsForm( $type, $group, $perm_masks, $blocks, $firsttab );
}
}
@@ -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,639 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Permissions management
* Last Updated: $Date: 2009-10-19 06:55:42 -0400 (Mon, 19 Oct 2009) $
*
* @author $Author: matt $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @subpackage Members
* @link http://www.iinvisionpower.com
* @version $Revision: 5240 $
*
*/
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_members_groups_permissions 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 Skin and Lang */
$this->html = $this->registry->output->loadTemplate('cp_skin_permissions');
$this->registry->class_localization->loadLanguageFile( array( 'admin_permissions' ) );
/* URL Bits */
$this->form_code = $this->html->form_code = 'module=groups&amp;section=permissions&amp;';
$this->form_code_js = $this->html->form_code_js = 'module=groups&section=permissions&';
/* What to do */
switch( $this->request['do'] )
{
case 'delete_set':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'perms_delete' );
$this->_doDeleteSet();
break;
case 'do_create_set':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'perms_manage' );
$this->_doCreatePermissionSet();
break;
case 'do_edit_set':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'perms_manage' );
$this->_permissionSaveForm();
break;
case 'edit_set_form':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'perms_manage' );
$this->_permissionSetForm();
break;
case 'view_perm_users':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'permmasks_view' );
$this->permissionSetUsers();
break;
case 'remove_mask':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'permmasks_delete' );
$this->removePermissionSet();
break;
case 'overview':
default:
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'perms_manage' );
$this->_mainScreen();
break;
}
/* Output */
$this->registry->getClass('output')->html_main .= $this->registry->getClass('output')->global_template->global_frame_wrapper();
$this->registry->getClass('output')->sendOutput();
}
/**
* Removes permission set(s) from a user
*
* @access public
* @return void
**/
public function removePermissionSet()
{
/* INI */
$member_id = intval( $this->request['id'] );
$perm_id = $this->request['pid'];
if( ! $member_id )
{
$this->registry->output->showError( $this->lang->words['per_memid'], 11338 );
}
/* Get the member */
$this->DB->build( array( 'select' => 'member_id, members_display_name, org_perm_id', 'from' => 'members', 'where' => "member_id={$member_id}" ) );
$this->DB->execute();
if( ! $mem = $this->DB->fetch() )
{
$this->registry->output->showError( $this->lang->words['per_memid'], 11339 );
}
/* Remove all permission sets */
if( $perm_id == 'all' )
{
$this->DB->update( 'members', array( 'org_perm_id' => 0 ), "member_id={$member_id}" );
}
/* Remove specific permission set */
else
{
/* Make Safe */
$perm_id = intval( $perm_id );
/* Get an array of permission ids */
$pid_array = explode( ",", IPSText::cleanPermString( $mem['org_perm_id'] ) );
/* If there's only one, then we can just remove it */
if( count( $pid_array ) < 2 )
{
$this->DB->update( 'members', array( 'org_perm_id' => 0 ), "member_id={$member_id}" );
}
else
{
/* Remove the specified element */
unset( $pid_array[ array_search( $perm_id, $pid_array ) ] );
/* Update the database */
$this->DB->update( 'members', array( 'org_perm_id' => implode( ",", $pid_array ) ), "member_id={$member_id}" );
}
}
/* Output */
$this->registry->output->html .= $this->html->permissionSetRemoveDone( $mem['members_display_name'] );
$this->registry->output->printPopupWindow();
}
/**
* Show users that are assigned the specified permission set
*
* @access public
* @return void
**/
public function permissionSetUsers()
{
/* Check ID */
$perm_id = intval( $this->request['id'] );
if( ! $perm_id )
{
$this->registry->output->showError( $this->lang->words['per_setid'], 11340 );
}
/* Query the permission set */
$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'], 11341 );
}
/* Query the users who have this set */
$this->DB->build( array(
'select' => 'member_id, members_display_name, email, posts, org_perm_id',
'from' => 'members',
'where' => "(org_perm_id IS NOT NULL AND org_perm_id != '')",
'order' => 'name'
) );
$outer = $this->DB->execute();
/* Loop through the users */
$rows = array();
while( $r = $this->DB->fetch( $outer ) )
{
/* Arrayize the perm ids */
$exp_pid = explode( ",", IPSText::cleanPermString( $r['org_perm_id'] ) );
/* Loop through the ids */
foreach( $exp_pid as $pid )
{
/* Is the perm id we are looking for? */
if( $pid == $perm_id )
{
/* What other sets is this member using? */
if( count( $exp_pid ) > 1 )
{
/* INI the extra field */
$extra = "<em style='color:red'>";
/* Query the set names */
$this->DB->build( array(
'select' => '*',
'from' => 'forum_perms',
'where' => "perm_id IN (" . IPSText::cleanPermString( $r['org_perm_id'] ) . ") AND perm_id <> {$perm_id}"
) );
$this->DB->execute();
/* Add each set to the extra field */
while( $mr = $this->DB->fetch() )
{
$extra .= $mr['perm_name'].",";
}
/* Finish the extra field */
$extra = rtrim( $extra, ',' );
$extra .= "</em>";
}
/* No other sets in use */
else
{
$extra = "";
}
/* Add to array */
$r['_extra'] = $extra;
$rows[] = $r;
}
}
}
/* Output */
$this->registry->output->html .= $this->html->permissionSetUsers( $perm_id, $perms['perm_name'], $rows );
$this->registry->output->printPopupWindow();
}
/**
* Deletes a permission set
*
* @access private
* @return void [Outputs to screen]
*/
private function _doDeleteSet()
{
/* INIT */
$id = $this->request['id'];
/* Permissions Class */
require_once( IPS_ROOT_PATH . 'sources/classes/class_public_permissions.php' );
$perm_obj = new classPublicPermissions( $this->registry );
/* Loop through applications */
$where = array();
foreach( $this->registry->getApplications() as $app )
{
/* Check to see if there is a permission map */
$_file = IPSLib::getAppDir( $app['app_directory'] ) . '/extensions/coreExtensions.php';
if( file_exists( $_file ) )
{
/* Get the permission mappings */
require_once( $_file );
/* Check for a config array */
if( isset( $_PERM_CONFIG ) && is_array( $_PERM_CONFIG ) && count( $_PERM_CONFIG ) )
{
/* Loop through the types */
foreach( $_PERM_CONFIG as $perm_type )
{
$where[] = " app='{$app['app_directory']}' AND perm_type='" . strtolower( $perm_type ) . "' ";
}
}
}
}
/* Query Permission Rows */
$this->DB->build( array( 'select' => '*', 'from' => 'permission_index', 'where' => implode( ' OR ', $where ) ) );
$outer = $this->DB->execute();
while( $r = $this->DB->fetch( $outer ) )
{
foreach( array( 'perm_view', 'perm_2', 'perm_3', 'perm_4', 'perm_5', 'perm_6', 'perm_7' ) as $p )
{
if( $r[$p] != '*' )
{
$_perm_arr = explode( ',', IPSText::cleanPermString( $r[$p] ) );
if( in_array( $id, $_perm_arr ) )
{
unset( $_perm_arr[ array_search( $id, $_perm_arr ) ] );
}
$r[$p] = ',' . implode( ',', $_perm_arr ) . ',';
}
}
$update = $r;
unset( $update['perm_id'] );
/* Update */
$this->DB->update( 'permission_index', $update, "perm_id={$r['perm_id']}" );
}
/* Delete */
$this->DB->delete( 'forum_perms', "perm_id=$id" );
/* Done */
$this->registry->output->doneScreen( $this->lang->words['per_removed'], $this->lang->words['per_manage'], $this->form_code, 'redirect' );
}
/**
* Creates a nwe permission set
*
* @access private
* @return void [Outputs to screen]
*/
private function _doCreatePermissionSet()
{
/* INIT */
$set_name = $this->request['new_perm_name'];
$base_on = $this->request['new_perm_copy'];
if( ! $set_name )
{
$this->registry->output->global_message = $this->words['err_specify_set_name'];
$this->_mainScreen();
return;
}
/* Permissions Class */
require_once( IPS_ROOT_PATH . 'sources/classes/class_public_permissions.php' );
$perm_obj = new classPublicPermissions( $this->registry );
/* Loop through applications */
$where = array();
foreach( $this->registry->getApplications() as $app )
{
/* Check to see if there is a permission map */
$_file = IPSLib::getAppDir( $app['app_directory'] ) . '/extensions/coreExtensions.php';
if( file_exists( $_file ) )
{
/* Get the permission mappings */
require_once( $_file );
/* Check for a config array */
if( isset( $_PERM_CONFIG ) && is_array( $_PERM_CONFIG ) && count( $_PERM_CONFIG ) )
{
/* Loop through the types */
foreach( $_PERM_CONFIG as $perm_type )
{
$where[] = " app='{$app['app_directory']}' AND perm_type='" . strtolower( $perm_type ) . "' ";
}
}
}
}
/* Create the set */
$this->DB->insert( 'forum_perms', array( 'perm_name' => $set_name ) );
$new_set_id = $this->DB->getInsertId();
/* Query Permission Rows */
$this->DB->build( array( 'select' => '*', 'from' => 'permission_index', 'where' => implode( ' OR ', $where ) ) );
$outer = $this->DB->execute();
while( $r = $this->DB->fetch( $outer ) )
{
$perm_id = $r['perm_id'];
foreach( array( 'perm_view', 'perm_2', 'perm_3', 'perm_4', 'perm_5', 'perm_6', 'perm_7' ) as $p )
{
if( $r[$p] != '*' )
{
if( in_array( $base_on, explode( ',', IPSText::cleanPermString( $r[$p] ) ) ) )
{
$r[$p] .= $new_set_id . ',';
}
}
}
/* Unset main ID */
unset( $r['perm_id'] );
/* Update */
$this->DB->update( 'permission_index', $r, "perm_id=" . $perm_id );
}
/* Done */
$this->registry->output->doneScreen( $this->lang->words['per_saved'], $this->lang->words['per_manage'], $this->form_code . 'do=edit_set_form&amp;id=' . $new_set_id, 'redirect' );
}
/**
* Saves the global permission set form
*
* @access private
* @return void [Outputs to screen]
*/
private function _permissionSaveForm()
{
/* ID */
$id = intval( $this->request['id'] );
$matricies = array();
/* Query Set Name */
$set_data = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'forum_perms', 'where' => "perm_id={$id}" ) );
/* Permissions Class */
require_once( IPS_ROOT_PATH . 'sources/classes/class_public_permissions.php' );
$perm_obj = new classPublicPermissions( $this->registry );
/* Save */
$perm_obj->saveItemPermMatrix( $this->request['perms'], $id, $this->request['apps'] );
if( $this->request['perm_name'] != $set_data['perm_name'] )
{
$this->DB->update( 'forum_perms', array( 'perm_name' => $this->request['perm_name'] ), "perm_id={$id}" );
}
/* Done */
$this->registry->output->doneScreen( $this->lang->words['per_saved'], $this->lang->words['per_manage'], $this->form_code . '&amp;_from=' . $this->request['_from'], 'redirect' );
}
/**
* Form for modifying a permission set
*
* @access private
* @return void [Outputs to screen]
*/
private function _permissionSetForm()
{
/* ID */
$id = intval( $this->request['id'] );
$matricies = array();
$apps = array();
/* Query Set Name */
$set_data = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'forum_perms', 'where' => "perm_id={$id}" ) );
/* Permissions Class */
require_once( IPS_ROOT_PATH . 'sources/classes/class_public_permissions.php' );
$perm_obj = new classPublicPermissions( $this->registry );
/* Loop through applications */
foreach( $this->registry->getApplications() as $app )
{
/* Check to see if there is a permission map */
$_file = IPSLib::getAppDir( $app['app_directory'] ) . '/extensions/coreExtensions.php';
if( file_exists( $_file ) )
{
/* Get the permission mappings */
require_once( $_file );
/* Check for a config array */
if( isset( $_PERM_CONFIG ) && is_array( $_PERM_CONFIG ) && count( $_PERM_CONFIG ) )
{
/* Loop through the types */
foreach( $_PERM_CONFIG as $perm_type )
{
/* Check for a class */
$_class = $app['app_directory'] . 'PermMapping' . $perm_type;
if( class_exists( $_class ) )
{
/* Create the object */
$perm_map = new $_class;
/* Make sure the function exists */
if( method_exists( $perm_map, 'getPermItems' ) )
{
$matricies[$app['app_title']] = $perm_obj->adminItemPermMatrix( $perm_map, $perm_map->getPermItems(), $id, $app['app_directory'], $perm_type );
$apps[$app['app_directory']] = $perm_type;
}
}
}
}
}
}
/* Output */
$this->registry->output->html .= $this->html->permissionEditor( $set_data['perm_name'], $matricies, $id, $apps );
}
/**
* List permission masks
*
* @access private
* @return void [Outputs to screen]
*/
private function _mainScreen()
{
/* INIT */
$perms = array();
$mems = array();
$groups = array();
$dlist = "";
$content = "";
/* 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'];
}
/* Number of users using this mask as an override */
$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'];
}
}
/* Groups using this mask */
$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'];
}
}
/* Build the output data */
$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;
}
/**
* Wow this is convoluted...
*/
if( $this->request['_from'] )
{
$from = explode( '-', $this->request['_from'] );
if( $from[1] )
{
$this->registry->class_localization->loadLanguageFile( array( 'admin_groups' ), 'members' );
$this->registry->output->html .= $this->html->groupAdminConfirm( $from[1] );
}
}
$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>groups</subsection>
<subitemurl>do=groups_overview</subitemurl>
<subitemrolekey></subitemrolekey>
<subisredirect>0</subisredirect>
</subitem>
</subitems>
</item>
<item>
<title>Маски доступа</title>
<subitems>
<subitem>
<subitemtitle>Управление масками доступа</subitemtitle>
<subsection>permissions</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>groups_add</key>
<string>Может добавлять группы?</string>
</item>
<item>
<key>groups_add_admin</key>
<string>Может добавлять АДМИНИСТРАТОРСКИЕ группы?</string>
</item>
<item>
<key>groups_edit</key>
<string>Может редактировать группы?</string>
</item>
<item>
<key>groups_edit_admin</key>
<string>Может редактировать АДМИНИСТРАТОРСКИЕ группы?</string>
</item>
<item>
<key>groups_delete</key>
<string>Может удалять группы?</string>
</item>
<item>
<key>groups_delete_admin</key>
<string>Может удалять АДМИНИСТРАТОРСКИЕ группы?</string>
</item>
</items>
</group>
<group>
<grouptitle>Управление правами</grouptitle>
<items>
<item>
<key>perms_manage</key>
<string>Может добавлять и редактировать маски доступа?</string>
</item>
<item>
<key>perms_delete</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,278 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Ban Filters
* 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 Members
* @link http://www.iinvisionpower.com
* @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_members_members_banfilters 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 skin
//-----------------------------------------
$this->html = $this->registry->output->loadTemplate( 'cp_skin_banfilters' );
//-----------------------------------------
// Set up stuff
//-----------------------------------------
$this->form_code = $this->html->form_code = 'module=members&amp;section=banfilters';
$this->form_code_js = $this->html->form_code_js = 'module=members&section=banfilters';
//-----------------------------------------
// Load lang
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'admin_member' ) );
//-----------------------------------------
// What to do...
//-----------------------------------------
switch( $this->request['do'] )
{
case 'ban_add':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ban_manage' );
$this->banAdd();
break;
case 'ban_delete':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ban_remove' );
$this->banDelete();
break;
default:
case 'ban':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ban_manage' );
$this->banOverview();
break;
}
//-----------------------------------------
// Pass to CP output hander
//-----------------------------------------
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
$this->registry->output->sendOutput();
}
/**
* Add a new ban filter
*
* @access public
* @return void
*/
public function banAdd()
{
/* Error checking */
if( ! $this->request['bantext'] )
{
$this->registry->output->global_message = $this->lang->words['ban_entersomething'];
$this->banOverview();
return;
}
/* Check for duplicate */
$result = $this->DB->buildAndFetch( array(
'select' => '*',
'from' => 'banfilters',
'where' => "ban_content='{$this->request['bantext']}' and ban_type='{$this->request['bantype']}'"
) );
if ( $result['ban_id'] )
{
$this->registry->output->global_message = $this->lang->words['ban_dupe'];
$this->banOverview();
return;
}
/* Insert the new ban filter */
$this->DB->insert( 'banfilters', array( 'ban_type' => $this->request['bantype'], 'ban_content' => trim( $this->request['bantext'] ), 'ban_date' => time() ) );
/* Rebuild cacne and bounce */
$this->rebuildBanCache();
$this->registry->output->global_message = $this->lang->words['ban_added'];
$this->banOverview();
}
/**
* Delete a ban filter
*
* @access public
* @return void
*/
public function banDelete()
{
/* INI */
$ids = array();
/* Loop through the request fields and find checked ban filters */
foreach( $this->request as $key => $value )
{
if( preg_match( "/^id_(\d+)$/", $key, $match ) )
{
if( $this->request[ $match[0] ] )
{
$ids[] = $match[1];
}
}
}
/* Clean the array */
$ids = IPSLib::cleanIntArray( $ids );
/* Delete any checked ban filters */
if ( count( $ids ) )
{
$this->DB->delete( 'banfilters', 'ban_id IN(' . implode( ",", $ids ) . ')' );
$this->DB->execute();
}
/* Rebuild the cache */
$this->rebuildBanCache();
/* Bounce */
$this->registry->output->global_message = $this->lang->words['ban_removed'];
$this->banOverview();
}
/**
* Displays the ban overview screen
*
* @access public
* @return void
*/
public function banOverview()
{
/* INI */
$ban = array();
/* Get ban filters */
$this->DB->build( array( 'select' => '*', 'from' => 'banfilters', 'order' => 'ban_date desc' ) );
$this->DB->execute();
while ( $r = $this->DB->fetch() )
{
$ban[ $r['ban_type'] ][ $r['ban_id'] ] = $r;
}
/* IPs */
$ips = array();
if( isset( $ban['ip'] ) AND is_array( $ban['ip'] ) AND count( $ban['ip'] ) )
{
foreach( $ban['ip'] as $entry )
{
$entry['_checkbox'] = "<input type='checkbox' name='id_{$entry['ban_id']}' value='1' />";
$entry['_date'] = $this->registry->class_localization->getDate( $entry['ban_date'], 'SHORT' );
$ips[] = $entry;
}
}
/* Emails */
$emails = array();
if( isset( $ban['email'] ) AND is_array( $ban['email'] ) AND count( $ban['email'] ) )
{
foreach( $ban['email'] as $entry )
{
$entry['_checkbox'] = "<input type='checkbox' name='id_{$entry['ban_id']}' value='1' />";
$entry['_date'] = $this->registry->class_localization->getDate( $entry['ban_date'], 'SHORT' );
$emails[] = $entry;
}
}
/* Banned Names */
$names = array();
if( isset( $ban['name'] ) AND is_array( $ban['name'] ) AND count( $ban['name'] ) )
{
foreach( $ban['name'] as $entry )
{
$entry['_checkbox'] = "<input type='checkbox' name='id_{$entry['ban_id']}' value='1' />";
$entry['_date'] = $this->registry->class_localization->getDate( $entry['ban_date'], 'SHORT' );
$names[] = $entry;
}
}
/* Output */
$this->registry->output->html .= $this->html->banOverview( $ips, $emails, $names );
}
/**
* Rebuilds the ban cache
*
* @access public
* @return void
*/
public function rebuildBanCache()
{
/* INI */
$cache = array();
/* Get the ban filters */
$this->DB->build( array( 'select' => 'ban_content', 'from' => 'banfilters', 'where' => "ban_type='ip' AND ban_nocache=0" ) );
$this->DB->execute();
while ( $r = $this->DB->fetch() )
{
$cache[] = $r['ban_content'];
}
/* Update the cache */
$this->cache->setCache( 'banfilters', $cache, array( 'array' => 1 ) );
}
}
@@ -0,0 +1,687 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Custom field 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 Members
* @link http://www.iinvisionpower.com
* @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_members_members_customfields 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 skin & lang
//-----------------------------------------
$this->html = $this->registry->output->loadTemplate( 'cp_skin_profilefields' );
$this->registry->class_localization->loadLanguageFile( array( 'admin_member' ) );
$this->form_code = $this->html->form_code = '&module=members&amp;section=customfields&amp;';
$this->js_form_code = $this->html->form_code_js = '&module=members&section=customfields&';
//-----------------------------------------
// switch-a-magoo
//-----------------------------------------
switch( $this->request['do'] )
{
case 'add':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'profilefields_add' );
$this->mainForm( 'add' );
break;
case 'doadd':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'profilefields_add' );
$this->mainSave( 'add' );
break;
case 'edit':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'profilefields_edit' );
$this->mainForm( 'edit' );
break;
case 'doedit':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'profilefields_edit' );
$this->mainSave( 'edit' );
break;
case 'delete':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'profilefields_delete' );
$this->deleteForm();
break;
case 'dodelete':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'profilefields_delete' );
$this->doDelete();
break;
case 'group_overview':
$this->groupOverview();
break;
case 'group_form_add':
$this->groupForm( 'add' );
break;
case 'group_form_edit':
$this->groupForm( 'edit' );
break;
case 'do_add_group':
$this->groupSave( 'add' );
break;
case 'do_edit_group':
$this->groupSave( 'edit' );
break;
case 'group_form_delete':
$this->groupDelete();
break;
case 'reorder':
$this->reorder();
break;
default:
$this->mainScreen();
break;
}
/* Output */
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
$this->registry->output->sendOutput();
}
/**
* Remove a profile field group
*
* @access public
* @return void
*/
public function groupDelete()
{
/* ID */
$id = intval( $this->request['id'] );
if( ! $id )
{
$this->registry->output->showError( $this->lang->words['cf_gid'], 11211 );
}
/* Do the delete */
$this->DB->delete( 'pfields_groups', "pf_group_id={$id}" );
/* Done */
$this->registry->output->main_msg = $this->lang->words['cf_gremoved'];
$this->rebuildCache();
$this->groupOverview();
}
/**
* Handles the form for adding/editing profile field groups
*
* @access public
* @param string $mode Either add or edit
* @return void
*/
public function groupSave( $mode='add' )
{
/* Error Checking */
if( ! $this->request['pf_group_name'] || ! $this->request['pf_group_key'] )
{
$this->registry->output->showError( $this->lang->words['cf_completeform'], 11212 );
}
/* DB Array */
$db_array = array(
'pf_group_name' => $this->request['pf_group_name'],
'pf_group_key' => str_replace( ' ', '_', $this->request['pf_group_key'] ),
);
/* Create the field */
if( $mode == 'add' )
{
/* Make sure the key is unique */
$chk = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'pfields_groups', 'where' => "pf_group_key='{$db_array['pf_group_key']}'" ) );
if( $chk )
{
$this->registry->output->showError( $this->lang->words['cf_gkey'], 11213 );
}
/* Insert the group */
$this->DB->insert( 'pfields_groups', $db_array );
/* Done */
$this->registry->output->main_msg = $this->lang->words['cf_gadded'];
}
/* Edit the field */
else
{
/* ID */
$id = intval( $this->request['id'] );
if( ! $id )
{
$this->registry->output->showError( $this->lang->words['cf_gid'], 11214 );
}
/* Make sure the key is unique */
$chk = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'pfields_groups', 'where' => "pf_group_key='{$db_array['pf_group_key']}' AND pf_group_id <> {$id}" ) );
if( $chk )
{
$this->registry->output->showError( $this->lang->words['cf_gkey'], 11215 );
}
/* Update the group */
$this->DB->update( 'pfields_groups', $db_array, "pf_group_id={$id}" );
/* Done */
$this->registry->output->main_msg = $this->lang->words['cf_gmodified'];
}
/* Done */
$this->rebuildCache();
$this->groupOverview();
}
/**
* Builds the form for adding/editing profile field groups
*
* @access public
* @param string $mode Either add or edit
* @return void
*/
public function groupForm( $mode='add' )
{
/* Add Form */
if( $mode == 'add' )
{
/* ID */
$id = 0;
/* Data */
$data = array();
/* Text Bits */
$title = $this->lang->words['cf_gcreate'];
$do = 'do_add_group';
}
/* Edit Form */
else
{
/* ID */
$id = intval( $this->request['id'] );
if( ! $id )
{
$this->registry->output->showError( $this->lang->words['cf_gid'], 11216 );
}
/* Data */
$data = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'pfields_groups', 'where' => "pf_group_id={$id}" ) );
/* Text Bits */
$title = $this->lang->words['cf_gedit'];
$do = 'do_edit_group';
}
/* Default Values */
$data = array(
'pf_group_name' => $this->request['pf_group_name'] ? $this->request['pf_group_name'] : $data['pf_group_name'],
'pf_group_key' => $this->request['pf_group_key'] ? $this->request['pf_group_key'] : $data['pf_group_key'],
);
/* Output */
$this->registry->output->html .= $this->html->groupForm( $id, $data, $title, $do );
}
/**
* Builds the group listing screen
*
* @access public
* @return void
*/
public function groupOverview()
{
/* Query Groups */
$this->DB->build( array( 'select' => '*', 'from' => 'pfields_groups' ) );
$this->DB->execute();
$fields = array();
while( $r = $this->DB->fetch() )
{
$fields[] = $r;
}
/* Output */
$this->registry->output->html .= $this->html->groupList( $fields );
}
/**
* Rebuilds the custom profile field cache
*
* @access public
* @return void
*/
public function rebuildCache()
{
/* INIT */
$profile_fields = array();
/* Query the fields */
$this->DB->build( array(
'select' => 'p.*',
'from' => array( 'pfields_data' => 'p' ),
'order' => 'p.pf_group_id, p.pf_position',
'add_join' => array(
array(
'select' => 'g.*',
'from' => array( 'pfields_groups' => 'g' ),
'where' => 'p.pf_group_id=g.pf_group_id',
'type' => 'left',
)
)
) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
$r['pf_group_key'] = $r['pf_group_key'] ? $r['pf_group_key'] : '_other';
$profile_fields[ $r['pf_id'] ] = $r;
}
/* Update the cache */
$this->cache->setCache( 'profilefields', $profile_fields, array( 'array' => 1 ) );
}
/**
* Confirm field deletion form
*
* @access public
* @return void
*/
public function deleteForm()
{
/* INI */
$id = intval( $this->request['id'] );
if( ! $id )
{
$this->registry->output->showError( $this->lang->words['cf_gid'], 11217 );
}
/* Query the field */
$this->DB->build( array( 'select' => 'pf_title', 'from' => 'pfields_data', 'where' => "pf_id={$id}" ) );
$this->DB->execute();
if ( ! $field = $this->DB->fetch() )
{
$this->registry->output->showError( $this->lang->words['cf_norow'], 11218 );
}
/* Output */
$this->registry->output->html .= $this->html->customProfileFieldDelete( $id, $field['pf_title'] );
}
/**
* Removes a field from the database
*
* @access public
* @return void
*/
public function doDelete()
{
/* INI */
$id = intval( $this->request['id'] );
if( ! $id )
{
$this->registry->output->showError( $this->lang->words['cf_gid'], 11219 );
}
/* Query the field */
$this->DB->build( array( 'select' => '*', 'from' => 'pfields_data', 'where' => "pf_id={$id}" ) );
$this->DB->execute();
if ( ! $row = $this->DB->fetch() )
{
$this->registry->output->showError( $this->lang->words['cf_norow'], 11220 );
}
/* Remove the filed */
$this->DB->dropField( 'pfields_content', "field_{$row['pf_id']}" );
$this->DB->buildAndFetch( array( 'delete' => 'pfields_data', 'where' => "pf_id={$id}" ) );
/* Rebuild the cache and redirect */
$this->rebuildCache();
$this->registry->output->doneScreen( $this->lang->words['cf_removed'], $this->lang->words['cf_control'], $this->form_code, 'redirect' );
}
/**
* Saves a custom field form
*
* @access public
* @param string Type (add|edit)
* @return void
*/
public function mainSave( $type='edit' )
{
/* ID */
$id = intval( $this->request['id'] );
/* Custom Fields Class */
require_once( IPS_KERNEL_PATH . 'classCustomFields.php' );
$cfields_class = new classCustomFields( array() );
if( ! $this->request['pf_title'] )
{
$this->registry->output->showError( $this->lang->words['cf_entertitle'], 11221 );
}
//-----------------------------------------
// check-da-motcha
//-----------------------------------------
if( $type == 'edit' )
{
if( ! $id )
{
$this->registry->output->showError( $this->lang->words['cf_norow'], 11222 );
}
}
$content = "";
if( $_POST['pf_content'] != "" )
{
$content = $cfields_class->formatContentForSave( $_POST['pf_content'] );
}
$db_string = array( 'pf_title' => $this->request['pf_title'],
'pf_desc' => $this->request['pf_desc'],
'pf_content' => IPSText::stripslashes( $content ),
'pf_type' => $this->request['pf_type'],
'pf_not_null' => intval( $this->request['pf_not_null'] ),
'pf_member_hide' => intval( $this->request['pf_member_hide'] ),
'pf_max_input' => intval( $this->request['pf_max_input'] ),
'pf_member_edit' => intval( $this->request['pf_member_edit'] ),
'pf_position' => intval( $this->request['pf_position'] ),
'pf_show_on_reg' => intval( $this->request['pf_show_on_reg'] ),
'pf_input_format' => $this->request['pf_input_format'],
'pf_admin_only' => intval( $this->request['pf_admin_only'] ),
'pf_topic_format' => IPSText::stripslashes( $_POST['pf_topic_format'] ),
'pf_group_id' => intval( $this->request['pf_group_id'] ),
'pf_icon' => trim($this->request['pf_icon']),
'pf_key' => trim($this->request['pf_key']),
);
if ($type == 'edit')
{
$this->DB->update( 'pfields_data', $db_string, 'pf_id=' . $id );
$this->registry->output->main_msg = $this->lang->words['cf_edited'];
}
else
{
$this->DB->insert( 'pfields_data', $db_string );
$new_id = $this->DB->getInsertId();
$this->DB->addField( 'pfields_content', "field_$new_id", 'text' );
$this->DB->optimize( 'pfields_content' );
$this->registry->output->main_msg = $this->lang->words['cf_added'];
}
$this->rebuildCache();
$this->mainScreen();
}
/**
* Shows a custom field form
*
* @access public
* @param string Type (add|edit)
* @return void
*/
public function mainForm( $type='edit' )
{
/* INI */
$id = intval( $this->request['id'] );
/* Custom Fields Class */
require_once( IPS_KERNEL_PATH . 'classCustomFields.php' );
$cfields_class = new classCustomFields( array() );
/* Type of form */
if( $type == 'edit' )
{
/* Check for id */
if ( ! $id )
{
$this->registry->output->showError( $this->lang->words['cf_gid'], 11223 );
}
/* Query data */
$this->DB->build( array( 'select' => '*', 'from' => 'pfields_data', 'where' => "pf_id=" . $id ) );
$this->DB->execute();
$fields = $this->DB->fetch();
/* Form Setup */
$form_code = 'doedit';
$button = $this->lang->words['cf_editbutton'];
$title = $this->lang->words['cf_pagetitle_edit'];
}
else
{
/* Form Setup */
$form_code = 'doadd';
$button = $this->lang->words['cf_addbutton'];
/* Data */
$fields = array( 'pf_topic_format' => '<span class="ft">{title}:</span><span class="fc">{content}</span>' );
$title = $this->lang->words['cf_pagetitle_add'];
}
/* Format Content */
$fields['pf_content'] = $cfields_class->formatContentForEdit($fields['pf_content'] );
/* Form Fields */
$fields['pf_show_on_reg'] = $this->registry->output->formYesNo( 'pf_show_on_reg', $fields['pf_show_on_reg'] );
$fields['pf_not_null'] = $this->registry->output->formYesNo( 'pf_not_null', $fields['pf_not_null'] );
$fields['pf_member_edit'] = $this->registry->output->formYesNo( 'pf_member_edit', $fields['pf_member_edit'] );
$fields['pf_member_hide'] = $this->registry->output->formYesNo( 'pf_member_hide', $fields['pf_member_hide'] );
$fields['pf_admin_only'] = $this->registry->output->formYesNo( 'pf_admin_only', $fields['pf_admin_only'] );
$fields['pf_type'] = $this->registry->output->formDropdown( 'pf_type', $cfields_class->getFieldTypes(), $fields['pf_type'] );
$fields['pf_icon'] = $this->registry->output->formInput( 'pf_icon', $fields['pf_icon'] );
$fields['pf_key'] = $this->registry->output->formInput( 'pf_key', $fields['pf_key'] );
/* Grab the groups */
$this->DB->build( array( 'select' => '*', 'from' => 'pfields_groups' ) );
$this->DB->execute();
$_groups = array();
while( $r = $this->DB->fetch() )
{
$_groups[] = array( $r['pf_group_id'], $r['pf_group_name'] );
}
$fields['pf_group_id'] = $this->registry->output->formDropdown( 'pf_group_id', $_groups, $fields['pf_group_id'] );
/* Output */
$this->registry->output->html .= $this->html->customProfileFieldForm( $id, $form_code, $button, $fields, $title );
}
/**
* Lists the current custom profile fields
*
* @access public
* @return void
*/
public function mainScreen()
{
/* Get the fields */
$this->DB->build( array(
'select' => 'p.*',
'from' => array( 'pfields_data' => 'p' ),
'order' => 'p.pf_position',
'add_join' => array(
array(
'select' => 'g.*',
'from' => array( 'pfields_groups' => 'g' ),
'where' => 'p.pf_group_id=g.pf_group_id',
'type' => 'left'
)
)
) );
$this->DB->execute();
/* Loop through and build list */
$fields = array();
if ( $this->DB->getTotalRows() )
{
while ( $r = $this->DB->fetch() )
{
/* INI */
$hide = '&nbsp;';
$req = '&nbsp;';
$regi = '&nbsp;';
$admin = '&nbsp;';
/* Hidden */
$r['_hide'] = ( $r['pf_member_hide'] ) ? 'tick.png' : 'cross.png';
$r['_req'] = ( $r['pf_not_null'] ) ? 'tick.png' : 'cross.png';
$r['_regi'] = ( $r['pf_show_on_reg'] ) ? 'tick.png' : 'cross.png';
$r['_admin'] = ( $r['pf_admin_only'] ) ? 'tick.png' : 'cross.png';
/*if( $r['pf_member_hide'] == 1 )
{
$r['_hide'] = ;
}
if( $r['pf_not_null'] == 1 )
{
$r['_req'] = '<center><span style="color:red">Y</span></center>';
}
if( $r['pf_show_on_reg'] == 1 )
{
$r['_regi'] = '<center><span style="color:red">Y</span></center>';
}
if( $r['pf_admin_only'] == 1 )
{
$r['_admin'] = '<center><span style="color:red">Y</span></center>';
}*/
/* Add to fields */
$key = $r['pf_group_name'] ? $r['pf_group_name'] : 'Other';
$fields[$key][] = $r;
}
}
/* Output */
$this->registry->output->html .= $this->html->customProfileFieldsList( $fields );
}
/**
* Reorder fields
*
* @access private
* @return void [Outputs to screen]
*/
private function reorder()
{
//-----------------------------------------
// INIT
//-----------------------------------------
require_once( IPS_KERNEL_PATH . 'classAjax.php' );
$ajax = new classAjax();
//-----------------------------------------
// Checks...
//-----------------------------------------
if( $this->registry->adminFunctions->checkSecurityKey( $this->request['md5check'], true ) === false )
{
$ajax->returnString( $this->lang->words['postform_badmd5'] );
exit();
}
//-----------------------------------------
// Save new position
//-----------------------------------------
$position = 1;
if( is_array($this->request['fields']) AND count($this->request['fields']) )
{
foreach( $this->request['fields'] as $this_id )
{
$this->DB->update( 'pfields_data', array( 'pf_position' => $position ), 'pf_id=' . $this_id );
$position++;
}
}
$this->rebuildCache();
$ajax->returnString( 'OK' );
exit();
}
}
@@ -0,0 +1,30 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Define the default members section
* 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 Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Rev: 4948 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
/**
* Very simply returns the default section if one is not
* passed in the URL
*/
$DEFAULT_SECTION = 'members';
@@ -0,0 +1 @@
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<hr>␍You have reached this page in error, please use your back button to return to the forum.␍<hr>␍<a href="http://www.invisionboard.com/">IP.Board</a>␍</body>␍</html>␍
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,334 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Member 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 Members
* @link http://www.iinvisionpower.com
* @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_members_members_ranks 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_ranks');
//-----------------------------------------
// Set up stuff
//-----------------------------------------
$this->form_code = $this->html->form_code = 'module=members&amp;section=ranks';
$this->form_code_js = $this->html->form_code_js = 'module=members&section=ranks';
//-----------------------------------------
// Load lang
//-----------------------------------------
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'admin_member' ) );
///-----------------------------------------
// What to do...
//-----------------------------------------
switch( $this->request['do'] )
{
default:
case 'title':
$this->_titlesStart();
break;
case 'rank_edit':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ranks_edit' );
$this->_titlesForm( 'edit' );
break;
case 'rank_add':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ranks_add' );
$this->_titlesForm( 'add' );
break;
case 'do_add_rank':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ranks_add' );
$this->_titlesSave( 'add' );
break;
case 'do_rank_edit':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ranks_edit' );
$this->_titlesSave( 'edit' );
break;
case 'rank_delete':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'ranks_delete' );
$this->_titlesDelete();
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();
}
/**
* Recache ranks
*
* @access public
* @return void
*/
public function titlesRecache()
{
$ranks = array();
$this->DB->build( array( 'select' => 'id, title, pips, posts',
'from' => 'titles',
'order' => 'posts DESC',
) );
$this->DB->execute();
while ( $i = $this->DB->fetch() )
{
$ranks[ $i['id'] ] = array(
'TITLE' => $i['title'],
'PIPS' => $i['pips'],
'POSTS' => $i['posts'],
);
}
$this->cache->setCache( 'ranks', $ranks, array( 'array' => 1 ) );
}
/**
* Overview page
*
* @access protected
* @return void [Outputs to screen]
*/
protected function _titlesStart()
{
$this->registry->output->extra_nav[] = array( '', $this->lang->words['member_rank_nav'] );
$titles = array();
//-----------------------------------------
// Parse macro
//-----------------------------------------
$row = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'skin_replacements', 'where' => "replacement_set_id=0 AND replacement_key='pip_pip'" ) );
$row['A_STAR'] = str_replace( "{style_image_url}", $this->settings['img_url'], $row['replacement_content'] );
//-----------------------------------------
// Lets get on with it...
//-----------------------------------------
$this->DB->build( array( 'select' => '*', 'from' => 'titles', 'order' => "posts" ) );
$this->DB->execute();
while ( $r = $this->DB->fetch() )
{
$r['A_STAR'] = $row['A_STAR'];
$titles[] = $r;
}
$this->registry->output->html .= $this->html->titlesOverview( $titles );
}
/**
* Save rank [add/edit]
*
* @access protected
* @param string 'add' or 'edit'
* @return void [Outputs to screen]
*/
protected function _titlesSave( $type = 'add' )
{
//-----------------------------------------
// check for input
//-----------------------------------------
foreach( array( 'title', 'pips' ) as $field )
{
if ( ! isset( $this->request[ $field ] ) )
{
$this->registry->output->showError( $this->lang->words['rnk_completeform'], 11239 );
}
}
if ( $this->request['pips'] > 100 )
{
$this->registry->output->showError( $this->lang->words['rnk_max100'], 11240 );
}
if( $type == 'add' )
{
$this->DB->insert( 'titles', array(
'posts' => intval( trim( $this->request['posts'] ) ),
'title' => trim($this->request['title']),
'pips' => trim($this->request['pips']),
) );
ipsRegistry::getClass('adminFunctions')->saveAdminLog( $this->lang->words['rnk_added'] );
}
else
{
if ( !$this->request['id'] )
{
$this->registry->output->showError( $this->lang->words['rnk_notfound'], 11241 );
}
$this->DB->update( 'titles', array ( 'posts' => trim($this->request['posts']),
'title' => trim($this->request['title']),
'pips' => trim($this->request['pips']),
) , "id=" . intval( $this->request['id'] ) );
ipsRegistry::getClass('adminFunctions')->saveAdminLog( $this->lang->words['rnk_edit'] );
}
$this->titlesRecache();
if( $type == 'add' )
{
$this->registry->output->doneScreen($this->lang->words['rnk_added2'], $this->lang->words['rnk_rankcontrol'], "{$this->form_code}&do=title", 'redirect' );
}
else
{
$this->registry->output->doneScreen($this->lang->words['rnk_edited'], $this->lang->words['rnk_rankcontrol'], "{$this->form_code}&do=title", 'redirect' );
}
}
/**
* Delete a rank
*
* @access protected
* @return void [Outputs to screen]
*/
protected function _titlesDelete()
{
//-----------------------------------------
// check for input
//-----------------------------------------
if ( !$this->request['id'] )
{
$this->registry->output->showError( $this->lang->words['rnk_notfounddel'], 11242 );
}
$this->DB->delete( 'titles', "id=" . intval($this->request['id']) );
$this->titlesRecache();
ipsRegistry::getClass('adminFunctions')->saveAdminLog( $this->lang->words['rnk_removed'] );
$this->registry->output->doneScreen($this->lang->words['rnk_removed2'], $this->lang->words['rnk_rankcontrol'], "{$this->form_code}&do=title", 'redirect' );
}
/**
* Show the form to add/edit a rank
*
* @access protected
* @param string Type of form (add|edit)
* @return void [Outputs to screen]
*/
protected function _titlesForm( $mode='edit' )
{
$this->registry->output->extra_nav[] = array( '', $this->lang->words['rnk_setup'] );
if ( $mode == 'edit' )
{
$form_code = 'do_rank_edit';
if ( !$this->request['id'] )
{
$this->registry->output->showError( $this->lang->words['rnk_notfound'], 11243 );
}
$rank = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'titles', 'where' => "id=" . intval($this->request['id']) ) );
$button = $this->lang->words['rnk_editrank'];
}
else
{
$form_code = 'do_add_rank';
$rank = array( 'posts' => '', 'title' => "", 'pips' => "");
$button = $this->lang->words['rnk_addrank'];
}
//-----------------------------------------
$this->registry->output->html .= $this->html->titlesForm( $rank, $form_code, $button );
}
}
@@ -0,0 +1,299 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Reputation System
* 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 Members
* @link http://www.iinvisionpower.com
* @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_members_members_reputation 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 Skin & Lang */
$this->html = $this->registry->output->loadTemplate( 'cp_skin_reputation' );
$this->registry->class_localization->loadLanguageFile( array( 'admin_member' ) );
/* URL Bits */
$this->form_code = $this->html->form_code = 'module=members&amp;section=reputation';
$this->form_code_js = $this->html->form_code_js = 'module=members&section=reputation';
/* What to do */
switch( $this->request['do'] )
{
case 'add_level_form':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'reps_manage' );
$this->levelForm( 'add' );
break;
case 'do_add_level':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'reps_manage' );
$this->doLevelForm( 'add' );
break;
case 'edit_level_form':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'reps_manage' );
$this->levelForm( 'edit' );
break;
case 'do_edit_level':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'reps_manage' );
$this->doLevelForm( 'edit' );
break;
case 'delete_level':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'reps_delete' );
$this->deleteLevel();
break;
default:
case 'overview':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'reps_manage' );
$this->reputationOverview();
break;
}
/* Output */
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
$this->registry->output->sendOutput();
}
/**
* Rebuilds the reputation level cache
*
* @access public
* @return void
*/
public function rebuildReputationLevelCache()
{
/* Cache */
$cache = array();
/* Query the levels */
$this->DB->build( array( 'select' => '*', 'from' => 'reputation_levels', 'order' => 'level_points DESC' ) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
$cache[] = $r;
}
/* Update the cache */
$this->cache->setCache( 'reputation_levels', $cache, array( 'array' => 1 ) );
}
/**
* Removes the selected reputation level
*
* @access public
* @return void
*/
public function deleteLevel()
{
/* ID */
$id = intval( $this->request['id'] );
if( ! $id )
{
$this->registry->output->showError( $this->lang->words['invalid_id'], 11244 );
}
/* Delete */
$this->DB->delete( 'reputation_levels', "level_id={$id}" );
$this->rebuildReputationLevelCache();
/* Redirect */
$this->registry->output->doneScreen( $this->lang->words['rep_level_removed'], $this->lang->words['rep_management'], $this->form_code, 'redirect' );
}
/**
* Handles the add/edit reputation level form
*
* @access public
* @param string $mode Either add or edit
* @return void
*/
public function doLevelForm( $mode='add' )
{
/* Error Checking */
$errors = array();
if( ! $this->request['level_title'] && ! $this->request['level_image'] )
{
$errors[] = $this->lang->words['rep_no_title_img'];
}
if( count( $errors ) )
{
$this->levelForm( $mode, $errors );
return;
}
/* Build the data array */
$data = array(
'level_title' => $this->request['level_title'],
'level_image' => $this->request['level_image'],
'level_points' => intval( $this->request['level_points'] )
);
/* Add the level */
if( $mode == 'add' )
{
/* Insert */
$this->DB->insert( 'reputation_levels', $data );
$this->rebuildReputationLevelCache();
/* Redirect */
$this->registry->output->doneScreen( $this->lang->words['rep_level_added'], $this->lang->words['rep_management'], $this->form_code, 'redirect' );
}
else
{
/* ID Check */
$id = intval( $this->request['id'] );
if( ! $id )
{
$this->registry->output->showError( $this->lang->words['invalid_id'], 11245 );
}
/* Update */
$this->DB->update( 'reputation_levels', $data, "level_id={$id}" );
$this->rebuildReputationLevelCache();
/* Redirect */
$this->registry->output->doneScreen( $this->lang->words['rep_level_edited'], $this->lang->words['rep_management'], $this->form_code, 'redirect' );
}
}
/**
* Form for adding/exiting reputation levels
*
* @access public
* @param string $mode Either add or edit
* @param array $errors Array of error messages to display
* @return void
*/
public function levelForm( $mode='add', $errors=array() )
{
/* Add Level Form */
if( $mode == 'add' )
{
/* ID */
$id = 0;
/* Data */
$data = array();
/* Text Bits */
$title = $this->lang->words['rep_form_add_title'];
$do = 'do_add_level';
}
/* Edit Level Form */
else
{
/* ID */
$id = intval( $this->request['id'] );
if( ! $id )
{
$this->registry->output->showError( $this->lang->words['invalid_id'], 11246 );
}
/* Data */
$data = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'reputation_levels', 'where' => 'level_id=' . $id ) );
/* Text Bits */
$title = $this->lang->words['rep_form_edit_title'];
$do = 'do_edit_level';
}
/* Default Values */
$data['level_title'] = isset( $this->request['level_title'] ) ? $this->request['level_title'] : $data['level_title'];
$data['level_image'] = isset( $this->request['level_image'] ) ? $this->request['level_image'] : $data['level_image'];
$data['level_points'] = isset( $this->request['level_points'] ) ? $this->request['level_points'] : $data['level_points'];
/* Form Elements */
$form = array();
$form['level_title'] = $this->registry->output->formInput( 'level_title' , $data['level_title'] );
$form['level_image'] = $this->registry->output->formInput( 'level_image' , $data['level_image'] );
$form['level_points'] = $this->registry->output->formInput( 'level_points', $data['level_points'] );
/* Output */
$this->registry->output->html .= $this->html->reputationForm( $id, $do, $title, $form, $errors );
}
/**
* Reputation overview
*
* @access public
* @return void
*/
public function reputationOverview()
{
/* INIT */
$levels = array();
/* Query Levels */
$this->DB->build( array( 'select' => '*', 'from' => 'reputation_levels', 'order' => 'level_points ASC' ) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
$r['level_image'] = $r['level_image'] ? "<img src='{$this->settings['public_dir']}style_extra/reputation_icons/{$r['level_image']}'>" : '';
$levels[] = $r;
}
/* Output */
$this->registry->output->html .= $this->html->reputationOverview( $levels );
}
}
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,136 @@
<?xml version="1.0" encoding="UTF-8"?>
<menu>
<tabitems>
<item>
<title>Управление пользователями</title>
<subitems>
<subitem>
<subitemtitle>Управление пользователями</subitemtitle>
<subsection>members</subsection>
<subitemurl>do=members_overview</subitemurl>
<subitemrolekey></subitemrolekey>
<subisredirect>0</subisredirect>
</subitem>
<subitem>
<subitemtitle>Список неактивированных</subitemtitle>
<subsection>tools</subsection>
<subitemurl>do=validating</subitemurl>
<subitemrolekey></subitemrolekey>
<subisredirect>0</subisredirect>
</subitem>
<subitem>
<subitemtitle>Список заблокированных</subitemtitle>
<subsection>tools</subsection>
<subitemurl>do=locked</subitemurl>
<subitemrolekey></subitemrolekey>
<subisredirect>0</subisredirect>
</subitem>
<subitem>
<subitemtitle>Список забаненных</subitemtitle>
<subsection>tools</subsection>
<subitemurl>do=banned</subitemurl>
<subitemrolekey></subitemrolekey>
<subisredirect>0</subisredirect>
</subitem>
<subitem>
<subitemtitle>Список спамеров</subitemtitle>
<subsection>tools</subsection>
<subitemurl>do=spam</subitemurl>
<subitemrolekey></subitemrolekey>
<subisredirect>0</subisredirect>
</subitem>
</subitems>
</item>
<item>
<title>Звания</title>
<subitems>
<subitem>
<subitemtitle>Управление званиями пользователей</subitemtitle>
<subsection>ranks</subsection>
<subitemurl>do=ranks_overview</subitemurl>
<subitemrolekey></subitemrolekey>
<subisredirect>0</subisredirect>
</subitem>
</subitems>
</item>
<item>
<title>Репутация</title>
<subitems>
<subitem>
<subitemtitle>Управление репутацией пользователей</subitemtitle>
<subsection>reputation</subsection>
<subitemurl>do=overview</subitemurl>
<subitemrolekey></subitemrolekey>
<subisredirect>0</subisredirect>
</subitem>
</subitems>
</item>
<item>
<title>Дополнительные поля</title>
<subitems>
<subitem>
<subitemtitle>Управление дополнительными полями профиля</subitemtitle>
<subsection>customfields</subsection>
<subitemurl></subitemurl>
<subitemrolekey></subitemrolekey>
<subisredirect>0</subisredirect>
</subitem>
</subitems>
</item>
<item>
<title>Группы дополнительных полей</title>
<subitems>
<subitem>
<subitemtitle>Управление группами дополнительных полей профиля</subitemtitle>
<subsection>customfields</subsection>
<subitemurl>do=group_overview</subitemurl>
<subitemrolekey></subitemrolekey>
<subisredirect>0</subisredirect>
</subitem>
</subitems>
</item>
<item>
<title>Определение IP</title>
<subitems>
<subitem>
<subitemtitle>Инструменты</subitemtitle>
<subsection>tools</subsection>
<subitemurl></subitemurl>
<subitemrolekey></subitemrolekey>
<subisredirect>0</subisredirect>
</subitem>
</subitems>
</item>
<item>
<title>Добавление пользователя</title>
<subitems>
<subitem>
<subitemtitle>Добавление пользователя</subitemtitle>
<subsection>members</subsection>
<subitemurl>do=add</subitemurl>
<subitemrolekey></subitemrolekey>
<subisredirect>0</subisredirect>
</subitem>
</subitems>
</item>
<item>
<title>Бан фильтры</title>
<subitems>
<subitem>
<subitemtitle>Управление бан фильтрами</subitemtitle>
<subsection>banfilters</subsection>
<subitemurl>do=add</subitemurl>
<subitemrolekey></subitemrolekey>
<subisredirect>0</subisredirect>
</subitem>
</subitems>
</item>
</tabitems>
</menu>
@@ -0,0 +1,161 @@
<?xml version="1.0" encoding="UTF-8"?>
<permissions>
<group>
<grouptitle>Управление пользователями</grouptitle>
<items>
<item>
<key>member_add</key>
<string>Может добавлять пользователей?</string>
</item>
<item>
<key>member_add_admin</key>
<string>Может добавлять АДМИНОВ?</string>
</item>
<item>
<key>member_edit</key>
<string>Может редактировать пользователей?</string>
</item>
<item>
<key>member_edit_admin</key>
<string>Может редактировать АДМИНОВ?</string>
</item>
<item>
<key>member_delete</key>
<string>Может удалять пользователей?</string>
</item>
<item>
<key>member_delete_admin</key>
<string>Может удалять АДМИНОВ?</string>
</item>
<item>
<key>members_merge</key>
<string>Может соединять пользовательские учетки?</string>
</item>
<item>
<key>member_suspend</key>
<string>Может блокировать и разблокировать пользователей?</string>
</item>
<item>
<key>member_suspend_admin</key>
<string>Может блокировать и разблокировать АДМИНОВ?</string>
</item>
<item>
<key>member_prune</key>
<string>Может массово удалять пользователей?</string>
</item>
<item>
<key>member_prune_admin</key>
<string>Может массово удалять АДМИНОВ?</string>
</item>
<item>
<key>member_move</key>
<string>Может перемещать пользователей в другие группы?</string>
</item>
<item>
<key>member_move_admin1</key>
<string>Может перемещать АДМИНОВ в другие группы?</string>
</item>
<item>
<key>member_move_admin2</key>
<string>Может настроить продвижение группы в АДМИНА?</string>
</item>
<item>
<key>member_ban</key>
<string>Может банить пользователей?</string>
</item>
<item>
<key>member_ban_admin</key>
<string>Может банить АДМИНОВ?</string>
</item>
<item>
<key>member_photo</key>
<string>Может изменять пользователские фотографии и аватары?</string>
</item>
<item>
<key>member_photo_admin</key>
<string>Может изменять фотографии и аватары у АДМИНОВ?</string>
</item>
</items>
</group>
<group>
<grouptitle>Инструменты по работе с пользователями</grouptitle>
<items>
<item>
<key>membertools_validating</key>
<string>Может управлять неактивированными пользователями?</string>
</item>
<item>
<key>membertools_locked</key>
<string>Может управлять заблокированными пользователями?</string>
</item>
<item>
<key>membertools_banned</key>
<string>Может управлять забаненными пользователями?</string>
</item>
<item>
<key>membertools_ip</key>
<string>Может использовать инструмент для работы с IP адресами?</string>
</item>
</items>
</group>
<group>
<grouptitle>Звания пользователей</grouptitle>
<items>
<item>
<key>ranks_add</key>
<string>Может добавлять новые?</string>
</item>
<item>
<key>ranks_edit</key>
<string>Может изменять существующие?</string>
</item>
<item>
<key>ranks_delete</key>
<string>Может удалять?</string>
</item>
</items>
</group>
<group>
<grouptitle>Дополнительные поля</grouptitle>
<items>
<item>
<key>profilefields_add</key>
<string>Может добавлять новые?</string>
</item>
<item>
<key>profilefields_edit</key>
<string>Может изменять существующие?</string>
</item>
<item>
<key>profilefields_delete</key>
<string>Может удалять?</string>
</item>
</items>
</group>
<group>
<grouptitle>Бан фильтры</grouptitle>
<items>
<item>
<key>ban_manage</key>
<string>Может добавлять/изменять?</string>
</item>
<item>
<key>ban_remove</key>
<string>Может удалять?</string>
</item>
</items>
</group>
<group>
<grouptitle>Репутация пользователей</grouptitle>
<items>
<item>
<key>reps_manage</key>
<string>Может добавлять/изменять уровни репутации?</string>
</item>
<item>
<key>reps_delete</key>
<string>Может удалять уровни?</string>
</item>
</items>
</group>
</permissions>
@@ -0,0 +1,30 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Define the default restrictions section
* 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 Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Rev: 4948 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
/**
* Very simply returns the default section if one is not
* passed in the URL
*/
$DEFAULT_SECTION = 'restrictions';
@@ -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,774 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* ACP Restrictions
* Last Updated: $Date: 2009-06-10 16:15:40 -0400 (Wed, 10 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 Members
* @link http://www.iinvisionpower.com
* @since 1st march 2002
* @version $Revision: 4755 $
*
*/
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_members_restrictions_restrictions 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;
/**
* Member information
*
* @access private
* @var array Member information
*/
private $member_info = array();
/**
* 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_restrictions');
//-----------------------------------------
// Set up stuff
//-----------------------------------------
$this->form_code = $this->html->form_code = 'module=restrictions&amp;section=restrictions';
$this->form_code_js = $this->html->form_code_js = 'module=restrictions&section=restrictions';
//-----------------------------------------
// Load lang
//-----------------------------------------
ipsRegistry::getClass('class_localization')->loadLanguageFile( array( 'admin_restrictions' ) );
///-----------------------------------------
// What to do...
//-----------------------------------------
switch( $this->request['do'] )
{
///-----------------------------------------
// Remove restrictions
//-----------------------------------------
case 'accperms-member-remove':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'restrictions_delete_member' );
$this->_removePermissions( 'member' );
break;
case 'accperms-group-remove':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'restrictions_delete_group' );
$this->_removePermissions( 'group' );
break;
///-----------------------------------------
// Add restrictions to member
//-----------------------------------------
case 'acpperms-member-add':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'restrictions_add_member' );
$this->_addRole( 'member' );
break;
case 'acpperms-member-add-complete':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'restrictions_add_member' );
$this->_addMemberDo();
break;
///-----------------------------------------
// Add restrictions to group
//-----------------------------------------
case 'acpperms-group-add':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'restrictions_add_group' );
$this->_addRole( 'group' );
break;
case 'acpperms-group-add-complete':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'restrictions_add_group' );
$this->_addGroupDo();
break;
///-----------------------------------------
// Management form..
//-----------------------------------------
case 'accperms-member-edit':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'restrictions_edit_member' );
$this->_restrictionsForm( 'member' );
break;
case 'accperms-group-edit':
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'restrictions_edit_group' );
$this->_restrictionsForm( 'group' );
break;
///-----------------------------------------
// And saving the restrictions..
//-----------------------------------------
case 'acpperms-save':
$this->_restrictionsSave();
break;
default:
case 'overview':
$this->_acppermsList();
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();
}
/**
* Saving the ACP restrictions - here's where it gets really dirty
*
* @access private
* @return void
* @since 2.1.0.2005-7-11
*/
private function _restrictionsSave()
{
$role_id = intval($this->request['id']);
$role_type = $this->request['type'];
if( $role_type == 'member' )
{
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'restrictions_edit_member' );
}
else
{
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'restrictions_edit_group' );
}
if( !$role_id OR !$role_type )
{
$this->registry->output->global_message = $this->lang->words['r_whichmodify'];
$this->_acppermsList();
return;
}
if( !in_array( $role_type, array( 'member', 'group' ) ) )
{
$this->registry->output->global_message = $this->lang->words['r_whichmodify'];
$this->_acppermsList();
return;
}
$role_entry = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'admin_permission_rows', 'where' => "row_id_type='{$role_type}' AND row_id=" . $role_id ) );
if( !$role_entry['row_id'] )
{
$this->registry->output->global_message = sprintf( $this->lang->words['r_whichrole'], $role_type );
$this->_acppermsList();
return;
}
$updated_permissions = array(
'applications' => array(),
'modules' => array(),
'items' => array(),
);
foreach( $_POST as $key => $value )
{
if( preg_match( "/^app_(\d+)$/", $key, $matches ) )
{
if( $value )
{
$updated_permissions['applications'][] = $matches[1];
}
}
else if( preg_match( "/^module_(\d+)$/", $key, $matches ) )
{
if( $value )
{
$updated_permissions['modules'][] = $matches[1];
}
}
else if( preg_match( "/^item_(\d+)_(\S+)$/", $key, $matches ) )
{
if( $value )
{
$updated_permissions['items'][ $matches[1] ][] = $matches[2];
}
}
}
$this->DB->update( 'admin_permission_rows', array( 'row_perm_cache' => serialize($updated_permissions), 'row_updated' => time() ), "row_id_type='{$role_type}' AND row_id=" . $role_id );
$this->registry->output->global_message = sprintf( $this->lang->words['r_roleupdate'], $role_type );
$this->_acppermsList();
}
/**
* Manage ACP restrictions - The meat and potatoes, so to speak
*
* @access private
* @param string [member|group]
* @return void
* @since 2.1.0.2005-7-11
* @todo One of the only areas that still uses the old XML parser
*/
private function _restrictionsForm( $type='member' )
{
//-------------------------------
// INIT
//-------------------------------
$row_id = $type == 'member' ? intval( $this->request['mid'] ) : intval( $this->request['gid'] );
$perms = array();
//-------------------------------
// Check...
//-------------------------------
if ( ! $row_id )
{
$this->registry->output->global_message = sprintf( $this->lang->words['r_notypeid'], $type );
$this->_acppermsList();
return;
}
//-------------------------------
// Grab member's row
//-------------------------------
$row = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'admin_permission_rows', 'where' => "row_id_type='{$type}' AND row_id=" . $row_id ) );
$row['current'] = unserialize( $row['row_perm_cache'] );
if( !is_array($row['current']) OR !count($row['current']) )
{
$row['current'] = array(
'applications' => array(),
'modules' => array(),
'items' => array(),
);
}
//-------------------------------
// Grab XML library
//-------------------------------
require_once( IPS_KERNEL_PATH . 'class_xml.php' );
$xml = new class_xml();
//-------------------------------
// Start the madness...err parsing
//-------------------------------
foreach( ipsRegistry::$applications as $app_dir => $app_data )
{
if( !is_array(ipsRegistry::$modules[ $app_dir ]) OR !count(ipsRegistry::$modules[ $app_dir ]) )
{
continue;
}
foreach( ipsRegistry::$modules[ $app_dir ] as $module )
{
$_file = IPSLib::getAppDir( $app_dir ) . '/modules_admin/' . $module['sys_module_key'] . '/xml/permissions.xml';
if( ! $module['sys_module_admin'] )
{
continue;
}
if( ! file_exists( $_file ) )
{
continue;
}
$content = file_get_contents( $_file );
$xml->xml_parse_document( $content );
if ( ! is_array( $xml->xml_array['permissions']['group'][0] ) )
{
//-----------------------------------------
// Ensure [0] is populated
//-----------------------------------------
$xml->xml_array['permissions']['group'] = array( 0 => $xml->xml_array['permissions']['group'] );
}
//-----------------------------------------
// Loop through and sort out permissions and groups...
//-----------------------------------------
$group = 0;
foreach( $xml->xml_array['permissions']['group'] as $entry )
{
//-----------------------------------------
// Do we have a row matching this already?
//-----------------------------------------
$_title = $entry['grouptitle']['VALUE'];
$items = array();
$group++;
if( is_array($entry['items']) AND count($entry['items']) )
{
foreach( $entry['items'] as $item )
{
if( is_array($item) AND count($item) )
{
if( isset($item['key']) )
{
$items[ $item['key']['VALUE'] ] = $item['string']['VALUE'];
}
else
{
foreach( $item as $sub_item )
{
$items[ $sub_item['key']['VALUE'] ] = $sub_item['string']['VALUE'];
}
}
}
}
$perms[ $app_data['app_id'] ][ $module['sys_module_id'] ][ $group ]['title'] = $_title;
$perms[ $app_data['app_id'] ][ $module['sys_module_id'] ][ $group ]['items'] = $items;
}
}
}
}
//-------------------------------
// Print
//-------------------------------
$this->registry->output->html .= $this->html->restrictionsForm( $row_id, $type, $perms, $row['current'] );
}
/**
* List members and groups with restrictions
*
* @access private
* @return void Outputs to screen
* @since 2.1.0.2005-7-7
*/
private function _acppermsList()
{
//-------------------------------
// INIT
//-------------------------------
$members = '';
$groups = '';
//-------------------------------
// Get current ACP listed members
//-------------------------------
$this->DB->build( array( 'select' => 'p.*',
'from' => array( 'admin_permission_rows' => 'p' ),
'add_join' => array(
array(
'select' => 'm.members_display_name, m.member_id, m.member_group_id, m.mgroup_others',
'from' => array( 'members' => 'm' ),
'where' => "p.row_id_type='member' AND m.member_id=p.row_id",
'type' => 'left'
)
),
'order' => 'm.members_display_name DESC'
) );
$outer = $this->DB->execute();
while( $r = $this->DB->fetch($outer) )
{
//-------------------------------
// (Alex) Cross
//-------------------------------
$r['_date'] = ipsRegistry::getClass('class_localization')->getDate( $r['row_updated'], 'SHORT' );
if( $r['row_id_type'] == 'member' )
{
$r['_group_name'] = $this->caches['group_cache'][ $r['member_group_id'] ]['g_title'];
$r['_other_groups'] = '<em>Нет</em>';
if( $r['mgroup_others'] )
{
$other_mgroups = explode( ',', IPSText::cleanPermString( $r['mgroup_others'] ) );
$formatted = array();
if( is_array($other_mgroups) AND count($other_mgroups) )
{
foreach( $other_mgroups as $omg )
{
$formatted[] = $this->caches['group_cache'][ $omg ]['g_title'];
}
$r['_other_groups'] = implode( ', ', $formatted );
}
}
$members .= $this->html->acpMemberRow($r);
}
else
{
$count = $this->DB->buildAndFetch(
array(
'select' => 'count(*) as total',
'from' => 'members',
'where' => "member_group_id = {$r['row_id']} OR mgroup_others LIKE '%,{$r['row_id']},%'",
)
);
$r['_group_name'] = $this->caches['group_cache'][ $r['row_id'] ]['g_title'];
$r['_total'] = $count['total'];
$groups .= $this->html->acpGroupRow($r);
}
}
$this->registry->output->html .= $this->html->acpPermsOverview( $members, $groups );
}
/**
* Remove ACP restrictions - this will make a restricted member or group have full permissions
*
* @access private
* @param string [member|group]
* @return void
* @since 2.1.0.2005-7-11
*/
private function _removePermissions( $type='member' )
{
//-------------------------------
// INIT
//-------------------------------
$row_id = $type == 'member' ? intval( $this->request['mid'] ) : intval( $this->request['gid'] );
//-------------------------------
// Check...
//-------------------------------
if ( ! $row_id )
{
$this->registry->output->global_message = sprintf( $this->lang->words['r_notypeid'], $type );
$this->_acppermsList();
return;
}
//-------------------------------
// Remove member's row
//-------------------------------
$this->DB->delete( 'admin_permission_rows', 'row_id=' . $row_id );
//-------------------------------
// Print
//-------------------------------
$this->registry->output->global_message = $this->lang->words['r_lifted'];
$this->_acppermsList();
}
/**
* ACP Perms: Add member form
*
* @access private
* @param string [member|group]
* @return void
* @since 2.1.0.2005-7-7
*/
private function _addRole( $type='member' )
{
$this->registry->output->extra_nav[] = array( '', $this->lang->words['r_nav'] );
//-------------------------------
// Show the form
//-------------------------------
$method = $type == 'member' ? 'restrictionsMemberForm' : 'restrictionsGroupForm';
$this->registry->output->html .= $this->html->$method();
}
/**
* ACP Perms: Finish adding the member
*
* Checks input, adds row to DB if OK
* This bud's for you
*
* @access private
* @return void
* @since 2.1.0.2005-7-8
*/
private function _addMemberDo()
{
//-------------------------------
// INIT
//-------------------------------
$name = trim( $this->request['entered_name'] );
$isok = 0;
//-------------------------------
// Check...
//-------------------------------
if ( ! $name )
{
$this->registry->output->global_message = $this->lang->words['r_entername'];
$this->_addRole( 'member' );
return;
}
//-------------------------------
// Get member...
//-------------------------------
$member = IPSMember::load( $name, 'groups' , 'displayname' );
//-------------------------------
// Check...
//-------------------------------
if ( ! $member['member_id'] )
{
$this->registry->output->global_message = sprintf( $this->lang->words['r_noname'], $name );
$this->_addRole( 'member' );
return;
}
//-------------------------------
// Already got 'em
//-------------------------------
$test = $this->DB->buildAndFetch( array( 'select' => 'row_id', 'from' => 'admin_permission_rows', 'where' => "row_id_type='member' AND row_id=" . $member['member_id'] ) );
if ( $test['row_id'] )
{
$this->registry->output->global_message = sprintf( $this->lang->words['r_namealready'], $name );
$this->_addRole( 'member' );
return;
}
//-------------------------------
// Don't restrict ourselves
//-------------------------------
if( $member['member_id'] == $this->memberData['member_id'] )
{
$this->registry->output->global_message = $this->lang->words['r_ownaccount'];
$this->_addRole( 'member' );
return;
}
//-------------------------------
// Primary ACP group?
//-------------------------------
if ( $member['g_access_cp'] )
{
$isok = 1;
}
//-------------------------------
// Secondary ACP group?
//-------------------------------
else if ( $member['mgroup_others'] )
{
foreach( explode( ',', IPSText::cleanPermString( $member['mgroup_others'] ) ) as $gid )
{
if ( $this->caches['group_cache'][ $gid ]['g_access_cp'] )
{
$isok = 1;
break;
}
}
}
//-------------------------------
// Not oK?
//-------------------------------
if ( ! $isok )
{
$this->registry->output->global_message = sprintf( $this->lang->words['r_noaccess'], $member['members_display_name'] );
$this->_addRole( 'member' );
return;
}
//-------------------------------
// Does we haz groop perms?
// Too many LOLCATZ >.<
//-------------------------------
$groups[] = $member['member_group_id'];
$restrict = array();
if( $member['mgroup_others'] )
{
$groups = array_merge( $groups, explode( ',', IPSText::cleanPermString( $member['mgroup_others'] ) ) );
}
$this->DB->build( array( 'select' => '*', 'from' => 'admin_permission_rows', 'where' => "row_id_type='group' AND row_id IN(" . implode( ',', $groups ) . ")" ) );
$this->DB->execute();
while( $r = $this->DB->fetch() )
{
$restrict = array_merge( $restrict, unserialize($r['row_perm_cache']) );
}
//-------------------------------
// A-OK
//-------------------------------
$this->DB->insert( 'admin_permission_rows', array( 'row_id' => $member['member_id'],
'row_id_type' => 'member',
'row_perm_cache' => serialize( $restrict ),
'row_updated' => time() ) );
$message = count($restrict) ? $this->lang->words['r_restrictbase'] : $this->lang->words['r_noacpaccessuntil'];
$this->registry->output->global_message = sprintf( $this->lang->words['r_addedmember'], $member['members_display_name'], $message );
$this->request[ 'mid'] = $member['member_id'] ;
$this->_restrictionsForm( 'member' );
}
/**
* ACP Perms: Finish adding the group
*
* @access private
* @return void
* @since 2.1.0.2005-7-8
*/
private function _addGroupDo()
{
//-------------------------------
// INIT
//-------------------------------
$g_id = intval( $this->request['entered_group'] );
$isok = 0;
//-------------------------------
// Check...
//-------------------------------
if ( !$g_id )
{
$this->registry->output->global_message = $this->lang->words['r_nogroup'];
$this->_addRole( 'group' );
return;
}
//-------------------------------
// Get member...
//-------------------------------
$group = $this->caches['group_cache'][ $g_id ];
//-------------------------------
// Check...
//-------------------------------
if ( ! $group['g_id'] )
{
$this->registry->output->global_message = $this->lang->words['r_nofindgroup'];
$this->_addRole( 'group' );
return;
}
//-------------------------------
// Already got 'em
//-------------------------------
$test = $this->DB->buildAndFetch( array( 'select' => 'row_id', 'from' => 'admin_permission_rows', 'where' => "row_id_type='group' AND row_id=" . $g_id ) );
if ( $test['row_id'] )
{
$this->registry->output->global_message = sprintf( $this->lang->words['r_groupalready'], $group['g_title'] );
$this->_addRole( 'group' );
return;
}
//-------------------------------
// Don't restrict ourselves
//-------------------------------
if( $g_id == $this->memberData['member_group_id'] )
{
$this->registry->output->global_message = $this->lang->words['r_ownaccount'];
$this->_addRole( 'group' );
return;
}
if( in_array( $g_id, explode( ',', IPSText::cleanPermString( $this->memberData['mgroup_others'] ) ) ) )
{
$this->registry->output->global_message = $this->lang->words['r_ownaccount'];
$this->_addRole( 'group' );
return;
}
//-------------------------------
// Primary ACP group?
//-------------------------------
if ( !$group['g_access_cp'] )
{
$this->registry->output->global_message = sprintf( $this->lang->words['r_groupnoacp'], $group['g_title'] );
$this->_addRole( 'group' );
return;
}
//-------------------------------
// A-OK
//-------------------------------
$this->DB->insert( 'admin_permission_rows', array( 'row_id' => $g_id,
'row_id_type' => 'group',
'row_perm_cache' => serialize( array() ),
'row_updated' => time() ) );
$this->registry->output->global_message = sprintf( $this->lang->words['r_addedgroup'], $group['g_title'] );
$this->_acppermsList();
}
}
@@ -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,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<menu>
<tabitems>
<item>
<title>Управление администраторскими ограничениями</title>
<subitems>
<subitem>
<subitemtitle>Администраторские ограничения</subitemtitle>
<subsection>restrictions</subsection>
<subitemurl>do=overview</subitemurl>
<subitemrolekey></subitemrolekey>
<subisredirect>0</subisredirect>
</subitem>
</subitems>
</item>
</tabitems>
</menu>
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<permissions>
<group>
<grouptitle>Управление ограничениями доступа</grouptitle>
<items>
<item>
<key>restrictions_add_member</key>
<string>Может добавлять ограничения?</string>
</item>
<item>
<key>restrictions_edit_member</key>
<string>Может изменять ограничения?</string>
</item>
<item>
<key>restrictions_delete_member</key>
<string>Может удалять ограничения?</string>
</item>
<item>
<key>restrictions_add_group</key>
<string>Может добавлять ограничения для групп?</string>
</item>
<item>
<key>restrictions_edit_group</key>
<string>Может изменять ограничения для групп?</string>
</item>
<item>
<key>restrictions_delete_group</key>
<string>Может удалять ограничения для групп?</string>
</item>
</items>
</group>
</permissions>
@@ -0,0 +1,83 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile AJAX hCard
* Last Updated: $Date: 2009-09-30 06:58:35 -0400 (Wed, 30 Sep 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 Members
* @link http://www.iinvisionpower.com
* @since Tuesday 1st March 2005 (11:52)
* @version $Revision: 5180 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_ajax_card extends ipsAjaxCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
$this->registry->class_localization->loadLanguageFile( array( 'public_profile') );
/* INIT */
$member_id = intval( $this->request['mid'] );
//-----------------------------------------
// Can we access?
//-----------------------------------------
if ( !$this->memberData['g_mem_info'] )
{
$this->returnString( 'error' );
}
if( !$member_id )
{
$this->returnString( 'error' );
}
$member = IPSMember::load( $member_id, 'profile_portal,pfields_content,sessions,groups,basic', 'id' );
if( !$member['member_id'] )
{
$this->returnString( 'error' );
}
$this->registry->class_localization->loadLanguageFile( array( 'public_online' ), 'members' );
$member = IPSMember::buildDisplayData( $member, array( 'customFields' => 1, 'cfSkinGroup' => 'profile', 'spamStatus' => 1 ) );
$member = IPSMember::getLocation( $member );
$board_posts = $this->caches['stats']['total_topics'] + $this->caches['stats']['total_replies'];
if( $member['posts'] and $board_posts )
{
$member['_posts_day'] = round( $member['posts'] / ( ( time() - $member['joined']) / 86400 ), 2 );
# Fix the issue when there is less than one day
$member['_posts_day'] = ( $member['_posts_day'] > $member['posts'] ) ? $member['posts'] : $member['_posts_day'];
$member['_total_pct'] = sprintf( '%.2f', ( $member['posts'] / $board_posts * 100 ) );
}
$member['_posts_day'] = floatval( $member['_posts_day'] );
$this->returnHtml( $this->registry->getClass('output')->getTemplate('profile')->showCard( $member ) );
}
}
@@ -0,0 +1,232 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile AJAX Comment Handler
* 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 Members
* @link http://www.iinvisionpower.com
* @since Tuesday 1st March 2005 (11:52)
* @version $Revision: 4948 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_ajax_comments extends ipsAjaxCommand
{
/**
* Comments library
*
* @access private
* @var object
*/
private $comments;
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
require_once( IPSLib::getAppDir( 'members' ) . '/sources/comments.php' );
$this->comments = new profileCommentsLib( $this->registry );
switch( $this->request[ 'do' ] )
{
case 'view':
default:
$this->returnHtml( $this->comments->buildComments( IPSMember::load( intval( $this->request['member_id'] ) ) ) );
break;
case 'add':
$this->_addComment();
break;
case 'delete':
$this->_deleteComment();
break;
case 'approve':
$this->_approveComment();
break;
case 'reload':
$this->_reloadComment();
break;
}
}
/**
* Approve a comment on member's profile
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-02
*/
private function _approveComment()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval( $this->request['member_id'] );
$md5check = IPSText::md5Clean( $this->request['md5check'] );
$comment_id = intval( $this->request['comment_id'] );
//-----------------------------------------
// MD5 check
//-----------------------------------------
if ( $md5check != $this->member->form_hash )
{
$this->returnString( 'error' );
}
//-----------------------------------------
// Delete
//-----------------------------------------
$result = $this->comments->approveComment( $member_id, $comment_id );
/* Check for error */
if( $result )
{
$this->returnString( $result );
}
else
{
$this->returnHtml( $this->comments->buildComments( IPSMember::load( $member_id ) ) );
}
}
/**
* Reload comments
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-15
*/
private function _reloadComment()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval( $this->request['member_id'] );
$md5check = IPSText::md5Clean( $this->request['md5check'] );
//-----------------------------------------
// MD5 check
//-----------------------------------------
if ( $md5check != $this->member->form_hash )
{
$this->returnString( 'error' );
}
//-----------------------------------------
// Load member
//-----------------------------------------
$member = IPSMember::load( $member_id );
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $member['member_id'] )
{
$this->returnString( 'error' );
}
//-----------------------------------------
// Regenerate comments...
//-----------------------------------------
$this->returnHtml( $this->comments->buildComments( $member ) );
}
/**
* Deletes a comment on member's profile
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-02
*/
private function _deleteComment()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval( $this->request['member_id'] );
$md5check = IPSText::md5Clean( $this->request['md5check'] );
$comment_id = intval( $this->request['comment_id'] );
//-----------------------------------------
// MD5 check
//-----------------------------------------
if ( $md5check != $this->member->form_hash )
{
$this->returnString( 'error' );
}
//-----------------------------------------
// Delete
//-----------------------------------------
$result = $this->comments->deleteComment( $member_id, $comment_id );
/* Check for error */
if( $result )
{
$this->returnString( $result );
}
else
{
$this->returnHtml( $this->comments->buildComments( IPSMember::load( $member_id ) ) );
}
}
/**
* Saves a comment on member's profile
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-02
*/
private function _addComment()
{
/* INIT */
$member_id = intval( $this->request['member_id'] );
$result = $this->comments->addCommentToDB( $member_id, IPSText::parseCleanValue( $_POST['comment'] ) );
/* Check for error */
if( $result AND $result != 'pp_comment_added_mod' )
{
$this->returnString( $result );
}
else
{
$this->returnHtml( $this->comments->buildComments( IPSMember::load( $member_id ), $new_id, $return_msg ) );
}
}
}
@@ -0,0 +1,102 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile display name history
*
* @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 Members
* @link http://www.iinvisionpower.com
* @since Tuesday 1st March 2005 (11:52)
* @version $Revision: 4948 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_ajax_dname extends ipsAjaxCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$info = array();
$id = intval( $this->request['id'] );
//-----------------------------------------
// Get HTML and skin
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
//-----------------------------------------
// Can we access?
//-----------------------------------------
if ( !$this->memberData['g_mem_info'] )
{
$this->returnJsonError( $this->lang->words['dname_profiles_off'] );
}
if ( ! $this->settings['auth_allow_dnames'] )
{
$this->returnJsonError( $this->lang->words['dnames_off'] );
}
if( !$id )
{
$this->returnJsonError( $this->lang->words['dnames_no_id'] );
}
$member = IPSMember::load( $id );
//-----------------------------------------
// Get Dname history
//-----------------------------------------
$this->DB->build( array( 'select' => 'd.*',
'from' => array( 'dnames_change' => 'd' ),
'where' => 'dname_member_id='.$id,
'add_join' => array( 0 => array( 'select' => 'm.members_display_name',
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id=d.dname_member_id',
'type' => 'inner' ) ),
'order' => 'dname_date DESC'
) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
{
$records[] = $row;
}
//-----------------------------------------
// Print the pop-up window
//-----------------------------------------
$html = $this->registry->getClass('output')->getTemplate('profile')->dnameWrapper( $member['members_display_name'], $records );
//-----------------------------------------
// Push to print handler
//-----------------------------------------
$this->returnHtml( $html );
}
}
@@ -0,0 +1,51 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Member AJAX DST switcher
* Last Updated: $Date: 2009-09-29 17:59:02 -0400 (Tue, 29 Sep 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 Members
* @link http://www.iinvisionpower.com
* @since Tuesday 1st March 2005 (11:52)
* @version $Revision: 5178 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_ajax_dst extends ipsAjaxCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
if( !$this->memberData['member_id'] )
{
$this->returnNull();
}
if( $this->memberData['members_auto_dst'] == 1 AND $this->settings['time_dst_auto_correction'] )
{
$newValue = $this->memberData['dst_in_use'] ? 0 : 1;
IPSMember::save( $this->memberData['member_id'], array( 'members' => array( 'dst_in_use' => $newValue ) ) );
}
$this->returnNull();
}
}
@@ -0,0 +1,202 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile AJAX Comment Handler
* 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 Members
* @link http://www.iinvisionpower.com
* @since Tuesday 1st March 2005 (11:52)
* @version $Revision: 4948 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_ajax_friends extends ipsAjaxCommand
{
/**
* Friends library
*
* @access private
* @var object
*/
private $friends;
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
/* Friends Enabled */
if( ! $this->settings['friends_enabled'] )
{
$this->registry->getClass('output')->showError( 'friends_not_enabled', 10220 );
}
/* Friends Library */
require_once( IPSLib::getAppDir( 'members' ) . '/sources/friends.php' );
$this->friends = new profileFriendsLib( $registry );
switch( $this->request['do'] )
{
case 'add':
$this->_addFriend();
break;
case 'remove':
$this->_removeFriend();
break;
case 'view':
$this->_iframeList();
break;
}
}
/**
* Loads the content for the friends tab
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-15
*/
private function _iframeList()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval( $this->request['member_id'] );
$content = '';
$friends = array();
//-----------------------------------------
// Load member
//-----------------------------------------
$member = IPSMember::load( $member_id );
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $member['member_id'] )
{
$this->returnString( $this->lang->words['nofriendid'] );
}
//-----------------------------------------
// Grab the friends
//-----------------------------------------
$this->DB->build( array( 'select' => 'f.*',
'from' => array( 'profile_friends' => 'f' ),
'where' => 'f.friends_member_id=' . $member_id . ' AND f.friends_approved=1',
'order' => 'm.members_display_name ASC',
'add_join' => array(
1 => array( 'select' => 'pp.*',
'from' => array( 'profile_portal' => 'pp' ),
'where' => 'pp.pp_member_id=f.friends_friend_id',
'type' => 'left' ),
2 => array( 'select' => 'm.*',
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id=f.friends_friend_id',
'type' => 'left' )
)
) );
$outer = $this->DB->execute();
//-----------------------------------------
// Get and store...
//-----------------------------------------
while( $row = $this->DB->fetch($outer) )
{
$row['members_display_name_short'] = IPSText::truncate( $row['members_display_name'], 13 );
$friends[] = IPSMember::buildDisplayData( $row, 0 );
}
//-----------------------------------------
// Ok.. show the friends
//-----------------------------------------
$content = $this->registry->getClass('output')->getTemplate('profile')->friendsIframe( $member, $friends );
$this->returnHtml( $content );
}
/**
* Add a friend
*
* @access private
* @return void
*/
private function _addFriend()
{
/* INIT */
$member_id = intval( $this->request['member_id'] );
/* Add friend */
$result = $this->friends->addFriend( $member_id );
/* Add to other user as well, but only if not pending */
if( !$this->friends->pendingApproval )
{
$result2 = $this->friends->addFriend( $this->memberData['member_id'], $member_id, true );
}
/* Check for error */
if( $result )
{
$this->returnString( $result );
}
else
{
$this->returnString( 'success' );
}
}
/**
* Removes a friend
*
* @access private
* @return void
*/
private function _removeFriend()
{
/* INIT */
$member_id = intval( $this->request['member_id'] );
/* Remove friend */
$result = $this->friends->removeFriend( $member_id );
/* Remove from other user as well */
$result2 = $this->friends->removeFriend( $this->memberData['member_id'], $member_id );
/* Check for error */
if( $result )
{
$this->returnString( $result );
}
else
{
$this->returnString( 'success' );
}
}
}
@@ -0,0 +1,64 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile AJAX Ignore User
* 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 Members
* @link http://www.iinvisionpower.com
* @since Tuesday 1st March 2005 (11:52)
* @version $Revision: 4948 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_ajax_ignore extends ipsAjaxCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
/* Get ignore user quick call file */
require_once( IPSLib::getAppDir( 'members' ) . '/modules_public/profile/ignore.php' );
$library = new public_members_profile_ignore( $registry );
$library->makeRegistryShortcuts( $registry );
switch( $this->request['do'] )
{
default:
case 'add':
$result = $library->ignoreMember( $this->request['memberID'], 'topics' );
break;
case 'remove':
$result = $library->stopIgnoringMember( $this->request['memberID'], 'topics' );
break;
case 'addPM':
$result = $library->ignoreMember( $this->request['memberID'], 'messages' );
break;
case 'removePM':
$result = $library->stopIgnoringMember( $this->request['memberID'], 'messages' );
break;
}
$this->returnJsonArray( $result );
}
}
@@ -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,113 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile AJAX Tab Loader
* 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 Members
* @link http://www.iinvisionpower.com
* @since Tuesday 1st March 2005 (11:52)
* @version $Revision: 4948 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_ajax_load extends ipsAjaxCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval( ipsRegistry::$request['member_id'] );
$tab = substr( IPSText::alphanumericalClean( str_replace( '..', '', trim( ipsRegistry::$request['tab'] ) ) ), 0, 20 );
$md5check = IPSText::md5Clean( $this->request['md5check'] );
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
//-----------------------------------------
// MD5 check
//-----------------------------------------
if ( $md5check != $this->member->form_hash )
{
$this->returnString( 'error' );
}
//-----------------------------------------
// Load member
//-----------------------------------------
$member = IPSMember::load( $member_id );
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $member['member_id'] )
{
$this->returnString( 'error' );
}
//-----------------------------------------
// Load config
//-----------------------------------------
if( !file_exists( IPSLib::getAppDir( 'members' ) . '/sources/tabs/' . $tab . '.conf.php' ) )
{
$this->returnString( 'error' );
}
require( IPSLib::getAppDir( 'members' ) . '/sources/tabs/' . $tab . '.conf.php' );
//-----------------------------------------
// Active?
//-----------------------------------------
if ( ! $CONFIG['plugin_enabled'] )
{
$this->returnString( 'error' );
}
//-----------------------------------------
// Load main class...
//-----------------------------------------
if( !file_exists( IPSLib::getAppDir( 'members' ) . '/sources/tabs/' . $tab . '.php' ) )
{
$this->returnString( 'error' );
}
require( IPSLib::getAppDir( 'members' ) . '/sources/tabs/pluginParentClass.php' );
require( IPSLib::getAppDir( 'members' ) . '/sources/tabs/' . $tab . '.php' );
$_func_name = 'profile_' . $tab;
$plugin = new $_func_name( $this->registry );
$html = $plugin->return_html_block( $member );
//-----------------------------------------
// Return it...
//-----------------------------------------
$this->returnHtml( $html );
}
}
@@ -0,0 +1,699 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile AJAX Ignored User methods
* 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 Members
* @link http://www.iinvisionpower.com
* @since Thursday 26th June 2008
* @version $Revision: 4948 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_ajax_messenger extends ipsAjaxCommand
{
/**
* Messenger library
*
* @access private
* @var object
*/
private $messengerFunctions;
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Grab class
//-----------------------------------------
require_once( IPSLib::getAppDir( 'members' ) . '/sources/classes/messaging/messengerFunctions.php' );
$this->messengerFunctions = new messengerFunctions( $registry );
switch( $this->request[ 'do' ] )
{
case 'addFolder':
$this->_addFolder();
break;
case 'removeFolder':
$this->_removeFolder();
break;
case 'renameFolder':
$this->_renameFolder();
break;
case 'emptyFolder':
$this->_emptyFolder();
break;
case 'getPMNotification':
$this->_getPMNotification();
break;
case 'showQuickForm':
$this->_showQuickForm();
break;
case 'PMSend':
$this->_PMSend();
break;
default:
break;
}
}
/**
* Sends the PM
*
* @access private
* @return string HTML to be returned via ajax
* @since IPB 3.0.0.2008-06-25
*/
private function _PMSend()
{
if( $this->messengerFunctions->checkHasHitMax() )
{
$this->returnJsonError( 'cannotUsePMSystem' );
}
//-----------------------------------------
// INIT
//-----------------------------------------
$toMemberID = intval( $this->request['toMemberID'] );
$msgContent = $this->convertHtmlEntities( $this->convertUnicode( $_POST['Post'] ) );
$msgTitle = IPSText::parseCleanValue( $this->convertHtmlEntities( $this->convertUnicode( $_POST['subject'] ) ) );
$this->request['Post'] = IPSText::parseCleanValue( $_POST['Post'] );
$_trackMsg = intval( $this->request['trackMsg'] );
$_addToSent = intval( $this->request['addToSent'] );
//-----------------------------------------
// Check viewing permissions, etc
//-----------------------------------------
if ( ! $this->memberData['g_use_pm'] )
{
$this->returnJsonError( 'cannotUsePMSystem' );
}
if ( $this->memberData['members_disable_pm'] )
{
$this->returnJsonError( 'cannotUsePMSystem' );
}
if ( ! $this->memberData['member_id'] )
{
$this->returnJsonError( 'cannotUsePMSystem' );
}
//-----------------------------------------
// Reset Classes
//-----------------------------------------
IPSText::resetTextClass('editor');
//-----------------------------------------
// Load lang file
//-----------------------------------------
$this->registry->getClass( 'class_localization')->loadLanguageFile( array( "public_error" ), 'core' );
//-----------------------------------------
// Language
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_messaging' ), 'members' );
//-----------------------------------------
// Send .. or.. save...
//-----------------------------------------
try
{
$this->messengerFunctions->sendNewPersonalTopic( $toMemberID, $this->memberData['member_id'], array(), $msgTitle, $msgContent, array( 'origMsgID' => 0,
'fromMsgID' => 0,
'postKey' => md5(microtime()),
'trackMsg' => $_trackMsg,
'addToSentFolder' => $_addToSent,
'hideCCUser' => 0 ) );
return $this->returnJsonArray( array( 'status' => 'sent' ) );
}
catch( Exception $error )
{
$msg = $error->getMessage();
$toMember = IPSMember::load( $toMemberID, 'core', 'displayname' );
if ( strstr( $msg, 'BBCODE_' ) )
{
$msg = str_replace( 'BBCODE_', '', $msg );
return $this->returnJsonArray( array( 'inlineError' => $this->lang->words[ $msg ] ) );
}
else if ( isset($this->lang->words[ 'err_' . $msg ]) )
{
$_msgString = $this->lang->words[ 'err_' . $msg ];
$_msgString = str_replace( '#NAMES#' , implode( ",", $this->messengerFunctions->exceptionData ), $_msgString );
$_msgString = str_replace( '#TONAME#' , $toMember['members_display_name'] , $_msgString );
$_msgString = str_replace( '#FROMNAME#', $this->memberData['members_display_name'], $_msgString );
}
else
{
$_msgString = $this->lang->words['err_UNKNOWN'] . ' ' . $msg;
}
return $this->returnJsonArray( array( 'inlineError' => $_msgString ) );
}
}
/**
* Shows the quick PM form
*
* @access private
* @return string HTML to be returned via ajax
* @since IPB 3.0.0.2008-06-25
*/
private function _showQuickForm()
{
if( $this->messengerFunctions->checkHasHitMax() )
{
$this->returnJsonError( 'cannotUsePMSystem' );
}
//-----------------------------------------
// INIT
//-----------------------------------------
$toMemberID = intval( $this->request['toMemberID'] );
//-----------------------------------------
// Load...
//-----------------------------------------
$toMemberData = IPSMember::load( $toMemberID, 'all' );
if ( ! $toMemberData['member_id'] )
{
$this->returnJsonError( 'noSuchToMember' );
}
//-----------------------------------------
// Check viewing permissions, etc
//-----------------------------------------
if ( ! $this->memberData['g_use_pm'] )
{
$this->returnJsonError( 'cannotUsePMSystem' );
}
if ( $this->memberData['members_disable_pm'] )
{
$this->returnJsonError( 'cannotUsePMSystem' );
}
if ( ! $this->memberData['member_id'] )
{
$this->returnJsonError( 'cannotUsePMSystem' );
}
//-----------------------------------------
// Stil here?
//-----------------------------------------
$this->registry->getClass( 'class_localization')->loadLanguageFile( array( 'public_editors' ), 'core' );
return $this->returnJsonArray( array( 'success' => $this->registry->getClass('output')->getTemplate('messaging')->PMQuickForm( $toMemberData ) ) );
}
/**
* Returns PM notification
*
* @access private
* @return string JSON either error or status
* @since IPB 3.0.0.2008-06-25
*/
private function _getPMNotification()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$limit = intval( $this->request['limit'] );
//-----------------------------------------
// INIT the parser
//-----------------------------------------
IPSText::resetTextClass('bbcode');
IPSText::getTextClass('bbcode')->allow_update_caches = 0;
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
IPSText::getTextClass('bbcode')->parse_smilies = 1;
IPSText::getTextClass('bbcode')->parse_html = 0;
IPSText::getTextClass('bbcode')->parsing_section = 'pms';
//-----------------------------------------
// Get last PM details
//-----------------------------------------
$msg = $this->DB->buildAndFetch( array( 'select' => 'mt.*',
'from' => array( 'message_topics' => 'mt' ),
'where' => "mt.mt_owner_id=" . $this->memberData['member_id'] . " AND mt.mt_vid_folder='in'",
'order' => 'mt.mt_date DESC',
'limit' => array( intval($limit), 1 ),
'add_join' => array(
array( 'select' => 'msg.*',
'from' => array( 'message_text' => 'msg' ),
'where' => 'msg.msg_id=mt.mt_msg_id',
'type' => 'left'
),
array( 'select' => 'm.member_id,m.name,m.member_group_id,m.mgroup_others,m.email,m.joined,m.posts, m.last_visit, m.last_activity, m.warn_level, m.warn_lastwarn, m.members_display_name',
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id=mt.mt_from_id',
'type' => 'left'
),
array( 'select' => 'pp.*',
'from' => array( 'profile_portal' => 'pp' ),
'where' => 'pp.pp_member_id=mt.mt_from_id',
'type' => 'left'
),
array( 'select' => 'g.g_id, g.g_title, g.g_icon, g.g_dohtml',
'from' => array( 'groups' => 'g' ),
'where' => 'g.g_id=m.member_group_id',
'type' => 'left'
) ) ) );
//-----------------------------------------
// Check...
//-----------------------------------------
if ( ! $msg['msg_id'] and ! $msg['mt_id'] and ! $msg['id'] )
{
$this->returnJsonError( 'noMsg' );
}
//-----------------------------------------
// Strip and wrap
//-----------------------------------------
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $msg['member_group_id'];
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $msg['mgroup_others'];
$msg['msg_post'] = IPSText::getTextClass('bbcode')->stripAllTags( strip_tags( str_replace( '<br />', "\n", $msg['msg_post'] ) ) );
$msg['msg_post'] = IPSText::getTextClass('bbcode')->wordWrap( $msg['msg_post'], 50, "\n" );
if ( IPSText::mbstrlen( $msg['msg_post'] ) > 300 )
{
$msg['msg_post'] = IPSText::truncate( $msg['msg_post'], 350 ) ;
}
$msg['msg_post'] = nl2br($msg['msg_post']);
//-----------------------------------------
// Add attach icon
//-----------------------------------------
if ( $msg['mt_hasattach'] )
{
$msg['attach_img'] = '<{ATTACH_ICON}>&nbsp;';
}
//-----------------------------------------
// Date
//-----------------------------------------
$msg['msg_date'] = $this->registry->getClass('class_localization')->getDate( $msg['msg_date'], 'TINY' );
//-----------------------------------------
// Next / Total links
//-----------------------------------------
$msg['_cur_num'] = intval($limit) + 1;
$msg['_msg_count_total'] = intval($this->memberData['msg_count_new']) ? intval($this->memberData['msg_count_new']) : 1;
//-----------------------------------------
// Return loverly HTML
//-----------------------------------------
return $this->returnHtml( $this->registry->getClass('output')->getTemplate('messaging')->PMNotificationBox( $msg ) );
}
/**
* Empties a folder
*
* @access private
* @return string JSON either error or status
* @since IPB 3.0.0.2008-06-25
*/
private function _emptyFolder()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$folderID = IPSText::alphanumericalClean( $this->request['folderID'] );
$memberID = intval( $this->request['memberID'] );
$memberData = IPSMember::load( $memberID, 'extendedProfile' );
$status = 'ok';
$mtids = array();
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $memberData['member_id'] OR ! $folderID )
{
$this->returnJsonError( 'noSuchFolder' );
}
//-----------------------------------------
// First off, get dir data
//-----------------------------------------
$folders = $this->messengerFunctions->explodeFolderData( $memberData['pconversation_filters'] );
//-----------------------------------------
// "New" folder?
//-----------------------------------------
if ( $folderID == 'new' )
{
/* Just mark them as read */
$this->DB->update( 'message_topic_user_map', array( 'map_has_unread' => 0 ), 'map_user_id=' . $memberID . " AND map_user_banned=0 AND map_user_active=1" );
}
else
{
/* Delete all PMs -you- sent regardless of which folder they're in */
$messages = $this->messengerFunctions->getPersonalTopicsList( $memberID, $folderID, array( 'offsetStart' => 0, 'offsetEnd' => 100000 ) );
/* Just grab IDs */
$mtids = array_keys( $messages );
//-----------------------------------------
// Got anything?
//-----------------------------------------
if ( ! count( $mtids ) )
{
$this->returnJsonError( 'nothingToRemove' );
}
//-----------------------------------------
// Delete the messages
//-----------------------------------------
try
{
$this->messengerFunctions->deleteTopics( $memberData['member_id'], $mtids );
}
catch( Exception $error )
{
$this->returnJsonError( $error->getMessage() );
}
}
//-----------------------------------------
// Reset total message count
//-----------------------------------------
$totalMsgs = $this->messengerFunctions->resetMembersTotalTopicCount( $memberData['member_id'] );
//-----------------------------------------
// Update directory counts
//-----------------------------------------
$newDirs = $this->messengerFunctions->resetMembersFolderCounts( $memberData['member_id'] );
$folders = $this->messengerFunctions->explodeFolderData( $newDirs );
$this->returnJsonArray( array( 'status' => $status, 'totalMsgs' => $totalMsgs, 'newDirs' => $newDirs, 'affectedDirCount' => $folders[ $folderID ]['count'] ) );
}
/**
* Renames a folder
*
* @access private
* @return string JSON either error or status
* @since IPB 3.0.0.2008-06-25
*/
private function _renameFolder()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$folderID = IPSText::alphanumericalClean( $this->request['folderID'] );
$memberID = intval( $this->request['memberID'] );
$memberData = IPSMember::load( $memberID, 'extendedProfile' );
// If we run through alpha clean, chars in other langs don't work properly of course
$name = IPSText::truncate( $this->convertAndMakeSafe($_POST['name']), 50 ); //IPSText::alphanumericalClean( $this->request['name'], ' ' );
$status = 'ok';
//-----------------------------------------
// First off, get dir data
//-----------------------------------------
$folders = $this->messengerFunctions->explodeFolderData( $memberData['pconversation_filters'] );
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $memberData['member_id'] OR ! $folderID )
{
$this->returnJsonError( 'noSuchFolder' );
}
//-----------------------------------------
// Now ensure we actually have that folder
//-----------------------------------------
if ( ! $folders[ $folderID ] )
{
$this->returnJsonError( 'noSuchFolder' );
}
//-----------------------------------------
// ..and it is not a 'set' folder..
// 8.25.2008 - We should be able to rename these
// 10.10.2008 - No, we shouldn't now they are "magic"
//-----------------------------------------
/* Protected? */
if ( $folders[ $folderID ]['protected'] )
{
$this->returnJsonError( 'cannotDeleteUndeletable' );
}
//-----------------------------------------
// OK, rename it.
//-----------------------------------------
$folders[ $folderID ]['real'] = $name;
//-----------------------------------------
// Collapse
//-----------------------------------------
$newDirs = $this->messengerFunctions->implodeFolderData( $folders );
//-----------------------------------------
// Save...
//-----------------------------------------
IPSMember::save( $memberID, array( 'extendedProfile' => array( 'pconversation_filters' => $newDirs ) ) );
//-----------------------------------------
// Return...
//-----------------------------------------
$this->returnJsonArray( array( 'status' => $status, 'newDirs' => $newDirs, 'name' => $name ) );
}
/**
* Removes a folder
*
* @access private
* @return string JSON either error or status
* @since IPB 3.0.0.2008-06-25
*/
private function _removeFolder()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$folderID = IPSText::alphanumericalClean( $this->request['folderID'] );
$memberID = intval( $this->request['memberID'] );
$memberData = IPSMember::load( $memberID, 'extendedProfile' );
$status = 'ok';
IPSDebug::fireBug( 'info', array( 'Received folder id:' . $folderID ) );
IPSDebug::fireBug( 'info', array( 'Received member id:' . $memberID ) );
//-----------------------------------------
// First off, get dir data
//-----------------------------------------
$folders = $this->messengerFunctions->explodeFolderData( $memberData['pconversation_filters'] );
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $memberData['member_id'] OR ! $folderID )
{
IPSDebug::fireBug( 'error', array( 'Missing member id or folder id' ) );
$this->returnJsonError( 'noSuchFolder' );
}
//-----------------------------------------
// Now ensure we actually have that folder
//-----------------------------------------
if ( ! $folders[ $folderID ] )
{
IPSDebug::fireBug( 'error', array( 'Specified folder does not exist' ) );
$this->returnJsonError( 'noSuchFolder' );
}
//-----------------------------------------
// Protected folder?
//-----------------------------------------
/* Protected? */
if ( $folders[ $folderID ]['protected'] )
{
$this->returnJsonError( 'cannotDeleteUndeletable' );
}
//-----------------------------------------
// .. and it has no messages
//-----------------------------------------
if ( $folders[ $folderID ]['count'] > 0 )
{
$this->returnJsonError( 'cannotDeleteHasMessages' );
}
//-----------------------------------------
// OK, remove it.
//-----------------------------------------
unset( $folders[ $folderID ] );
///-----------------------------------------
// Collapse
//-----------------------------------------
$newDirs = $this->messengerFunctions->implodeFolderData( $folders );
//-----------------------------------------
// Save...
//-----------------------------------------
IPSMember::save( $memberID, array( 'extendedProfile' => array( 'pconversation_filters' => $newDirs ) ) );
//-----------------------------------------
// Return...
//-----------------------------------------
$this->returnJsonArray( array( 'status' => $status, 'newDirs' => $newDirs ) );
}
/**
* Adds a folder
*
* @access private
* @return string JSON either error or status
* @since IPB 3.0.0.2008-06-25
*/
private function _addFolder()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$name = IPSText::truncate( $this->convertAndMakeSafe($_POST['name']), 50 );
$memberID = intval( $this->request['memberID'] );
$memberData = IPSMember::load( $memberID, 'extendedProfile' );
$status = 'ok';
$maxID = 0;
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $memberData['member_id'] OR ! $name )
{
$this->returnJsonError( 'invalidName' );
}
//-----------------------------------------
// Get vdir information
//-----------------------------------------
$folders = $this->messengerFunctions->explodeFolderData( $memberData['pconversation_filters'] );
foreach( $folders as $id => $folder )
{
if ( stristr( $folder['id'], 'dir_' ) )
{
$maxID = intval( str_replace( 'dir_', "", $folder['id'] ) ) + 1;
}
}
//-----------------------------------------
// Add a folder
//-----------------------------------------
$folders[ 'dir_' . $maxID ] = array( 'id' => 'dir_' . $maxID,
'real' => $name,
'protected' => 0,
'count' => 0 );
//-----------------------------------------
// If we have more than 50 folders, error
//-----------------------------------------
if ( count( $folders ) > 50 )
{
$this->returnJsonError( 'tooManyFolders' );
}
//-----------------------------------------
// Collapse
//-----------------------------------------
$newDirs = $this->messengerFunctions->implodeFolderData( $folders );
//-----------------------------------------
// Save...
//-----------------------------------------
IPSMember::save( $memberID, array( 'extendedProfile' => array( 'pconversation_filters' => $newDirs ) ) );
//-----------------------------------------
// Return...
//-----------------------------------------
$this->returnJsonArray( array( 'status' => $status, 'newDirs' => $newDirs, 'newID' => 'dir_' . $maxID ) );
}
}
@@ -0,0 +1,149 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile AJAX Tab Loader
* Last Updated: $Date: 2009-09-22 17:31:43 -0400 (Tue, 22 Sep 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 Members
* @link http://www.iinvisionpower.com
* @since Tuesday 1st March 2005 (11:52)
* @version $Revision: 5141 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_ajax_rate extends ipsAjaxCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$rating_id = intval($this->request['rating']);
$rating_id = $rating_id > 5 ? 5 : $rating_id;
$rating_id = $rating_id < 0 ? 0 : $rating_id;
$member_id = intval($this->request['member_id']);
$member = array();
$type = 'new';
$md5_check = IPSText::md5Clean( $this->request['md5check'] );
$error = array();
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $this->settings['pp_allow_member_rate'] )
{
$error['error_key'] = 'user_rate_no_perm';
$this->returnJsonArray( $error );
}
if ( ! $member_id OR ! $this->memberData['member_id'] OR $member_id == $this->memberData['member_id'] )
{
$error['error_key'] = 'user_rate_no_perm';
$this->returnJsonArray( $error );
}
//-----------------------------------------
// MD5 check
//-----------------------------------------
if ( $md5_check != $this->member->form_hash )
{
$error['error_key'] = 'user_rate_no_perm3';
$this->returnJsonArray( $error );
}
$member = IPSMember::load( $member_id, 'extendedProfile,groups' );
if ( ! $member['member_id'] )
{
$error['error_key'] = 'user_rate_no_perm4';
$this->returnJsonArray( $error );
}
//-----------------------------------------
// Have we already rated?
//-----------------------------------------
$rating = $this->DB->buildAndFetch( array( 'select' => '*',
'from' => 'profile_ratings',
'where' => "rating_for_member_id={$member_id} AND rating_by_member_id=" . $this->memberData['member_id'] ) );
//-----------------------------------------
// Already rated?
//-----------------------------------------
if ( $rating['rating_id'] )
{
//-----------------------------------------
// Do we allow re-ratings?
//-----------------------------------------
if ( $rating_id != $rating['rating_value'] )
{
$member['pp_rating_value'] = intval( $member['pp_rating_value'] );
$member['pp_rating_value'] = ( $member['pp_rating_value'] + $rating_id ) - $rating['rating_value'];
$this->DB->update( 'profile_ratings', array( 'rating_value' => $rating_id ), 'rating_id=' . $rating['rating_id'] );
$this->DB->update( 'profile_portal', array( 'pp_rating_value' => $member['pp_rating_value'],
'pp_rating_real' => round( $member['pp_rating_value'] / $member['pp_rating_hits'] ) ), 'pp_member_id=' . $member_id );
$type = 'update';
}
}
//-----------------------------------------
// NEW RATING!
//-----------------------------------------
else
{
$member['pp_rating_value'] = intval($member['pp_rating_value']) + $rating_id;
$member['pp_rating_hits'] = intval($member['pp_rating_hits']) + 1;
$this->DB->insert( 'profile_ratings', array( 'rating_for_member_id' => $member_id,
'rating_by_member_id' => $this->memberData['member_id'],
'rating_value' => $rating_id,
'rating_ip_address' => $this->member->ip_address ) );
$this->DB->update( 'profile_portal', array( 'pp_rating_hits' => intval($member['pp_rating_hits']),
'pp_rating_value' => intval($member['pp_rating_value']),
'pp_rating_real' => round( $member['pp_rating_value'] / $member['pp_rating_hits'] ) ), 'pp_member_id=' . $member_id );
}
$member['pp_rating_real'] = round( $member['pp_rating_value'] / $member['pp_rating_hits'] );
$return = array(
'rating' => $member['pp_rating_value'],
'total' => $member['pp_rating_real'],
'average' => $member['pp_rating_real'],
'rated' => $type
);
$this->returnJsonArray( $return );
//$this->returnString( $member['pp_rating_value'] . ',' . $member['pp_rating_hits'] . ',' . $member['pp_rating_real'] . ',' . $type );
}
}
@@ -0,0 +1,153 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile AJAX Tab Loader
* 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 Members
* @link http://www.iinvisionpower.com
* @since Tuesday 1st March 2005 (11:52)
* @version $Revision: 4948 $
* @deprecated We no longer have AJAX setting changes in profile
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_ajax_settings extends ipsAjaxCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval($this->request['member_id']);
$member = array();
$command = trim( $this->request['cmd'] );
$value = $this->convertAndMakeSafe( $this->request['value'], 0 );
$md5_check = IPSText::md5Clean( $this->request['md5check'] );
$return_string = '';
$pp_b_day = intval( $this->request['pp_b_day'] );
$pp_b_month = intval( $this->request['pp_b_month'] );
$pp_b_year = intval( $this->request['pp_b_year'] );
//-----------------------------------------
// MD5 check
//-----------------------------------------
if ( $md5_check != $this->member->form_hash )
{
$this->returnString( 'error' );
}
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $member_id OR ! $this->memberData['member_id'] )
{
$this->returnString( 'error' );
}
if ( ! $this->memberData['g_edit_profile'] )
{
$this->returnString( 'error' );
}
//-----------------------------------------
// Load member
//-----------------------------------------
$member = IPSMember::load( $member_id, 'extendedProfile,groups' );
if ( ! $member['member_id'] )
{
$this->returnString( 'error' );
}
//-----------------------------------------
// Not the same member?
//-----------------------------------------
if ( !$this->memberData['g_is_supmod'] AND $member_id != $this->memberData['member_id'] )
{
$this->returnString( 'error' );
}
//-----------------------------------------
// Alright.. what are we doing?
//-----------------------------------------
switch( $command )
{
case 'birthdate':
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ) );
if( $pp_b_month OR $pp_b_day OR $pp_b_year )
{
if ( ! $pp_b_month or ! $pp_b_day )
{
$return_string = 'dateerror';
}
}
if ( ( $pp_b_month AND $pp_b_day AND $pp_b_year ) AND ! @checkdate( $pp_b_month, $pp_b_day, $pp_b_year ) )
{
$return_string = 'dateerror';
}
if( $return_string != 'dateerror' )
{
IPSMember::save( $member_id, array( 'core' => array( 'bday_month' => intval( $pp_b_month ), 'bday_day' => intval( $pp_b_day ), 'bday_year' => intval( $pp_b_year ) ) ) );
$_pp_b_month = '';
if( $pp_b_month > 0 AND $pp_b_month < 13 )
{
$_pp_b_month = $this->lang->words['M_' . $pp_b_month ];
}
$date_vars = array();
# Adding this to support birthdays that don't specify all 3 params
if( $_pp_b_month )
{
$date_vars[] = $_pp_b_month;
}
if( $pp_b_day )
{
$date_vars[] = $pp_b_day;
}
if( $pp_b_year )
{
$date_vars[] = $pp_b_year;
}
$return_string = ( count($date_vars) ) ? implode( '-', $date_vars ) : $this->lang->words['m_bday_unknown'];
}
}
$this->returnString( $return_string );
}
}
@@ -0,0 +1,71 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Allow user to change their status
*
* @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 Members
* @link http://www.iinvisionpower.com
* @since Tuesday 1st March 2005 (11:52)
* @version $Revision: 4948 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_ajax_status extends ipsAjaxCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$info = array();
$id = intval( $this->memberData['member_id'] );
//-----------------------------------------
// Get HTML and skin
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
//-----------------------------------------
// Can we access?
//-----------------------------------------
if ( !$this->memberData['g_mem_info'] OR $this->memberData['gbw_no_status_update'] )
{
$this->returnJsonError( $this->lang->words['status_off'] );
}
if( !$id )
{
$this->returnJsonError( $this->lang->words['status_off'] );
}
$newStatus = trim( IPSText::getTextClass('bbcode')->stripBadWords( IPSText::parseCleanValue( $_POST['new_status'] ) ) );
IPSMember::save( $id, array( 'extendedProfile' => array( 'pp_status' => $newStatus, 'pp_status_update' => time() ) ) );
$this->returnJsonArray( array( 'status' => 'success', 'new_status' => $newStatus ) );
exit;
}
}
@@ -0,0 +1,76 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Retrieve member warn log
* 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 Members
* @link http://www.iinvisionpower.com
* @since Tuesday 1st March 2005 (11:52)
* @version $Revision: 4948 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_ajax_warn extends ipsAjaxCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_mod' ), 'forums' );
if ( ! $this->settings['warn_on'] )
{
$this->returnJsonError( $this->lang->words['ajax_no_warn'] );
}
switch( $this->request['do'] )
{
case 'view':
$this->_viewWarnLogs();
break;
}
}
/**
* Retieve warn logs and return them
*
* @access private
* @return void
*/
private function _viewWarnLogs()
{
require_once( IPSLib::getAppDir('members') . '/modules_public/warn/warn.php' );
$warn = new public_members_warn_warn( $this->registry );
$warn->makeRegistryShortcuts( $this->registry );
$warn->loadData();
$warnHTML = $warn->viewLog();
if ( !$warnHTML )
{
$this->returnJsonError( $this->lang->words['ajax_bad_html'] );
}
else
{
$this->returnHtml( $this->registry->getClass('output')->getTemplate('mod')->warnLogsAjaxWrapper( $warnHTML ) );
}
}
}
@@ -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,30 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Define the default memberlist section
* 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 Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Rev: 4948 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
/**
* Very simply returns the default section if one is not
* passed in the URL
*/
$DEFAULT_SECTION = 'view';
@@ -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,522 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Member list
* Last Updated: $Date: 2009-12-07 21:57:46 -0500 (Mon, 07 Dec 2009) $
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @subpackage Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Revision: 5529 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_list_view extends ipsCommand
{
/**
* Custom fields object
*
* @access public
* @var object
*/
public $custom_fields;
/**
* Temporary stored output HTML
*
* @access public
* @var string
*/
public $output;
/**
* DB result start point
*
* @access private
* @var integer
*/
private $first = 0;
/**
* Maximum results per page
*
* @access private
* @var integer
*/
private $max_results = 20;
/**
* Key to sort on
*
* @access private
* @var string
*/
private $sort_key = 'members_display_name';
/**
* Sort order (desc or asc)
*
* @access private
* @var string
*/
private $sort_order = 'asc';
/**
* Filter
*
* @access private
* @var string
*/
private $filter = 'ALL';
/**
* Member titles
*
* @access private
* @var array
*/
private $mem_titles = array();
/**
* Member groups
*
* @access private
* @var array
*/
private $mem_groups = array();
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Get HTML and skin
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_list' ), 'members' );
//-----------------------------------------
// Can we access?
//-----------------------------------------
if ( !$this->memberData['g_mem_info'] )
{
$this->registry->output->showError( 'cannot_view_memberlist', 10221 );
}
//-----------------------------------------
// Init variables
//-----------------------------------------
$see_groups = array();
$the_filter = array( 'ALL' => $this->lang->words['show_all'] );
$the_members = array();
$query = array();
$url = array();
$pp_rating_real = intval( $this->request['pp_rating_real'] );
$pp_gender = substr( trim( $this->request['pp_gender'] ), 0, 10 );
$this->first = intval($this->request['st']);
$this->max_results = ( $this->request['max_results'] ) ? $this->request['max_results'] : '20';
$this->sort_key = ( $this->request['sort_key'] ) ? $this->request['sort_key'] : 'members_display_name';
$this->sort_order = ( $this->request['sort_order'] ) ? $this->request['sort_order'] : 'asc';
$this->filter = ( $this->request['filter'] ) ? ( $this->request['filter'] == 'ALL' ? 'ALL' : intval( $this->request['filter'] ) ) : 'ALL';
$this->request['showall'] = intval( $this->request['showall'] );
$this->request['name_box'] = $this->request['name_box'] ? $this->request['name_box'] : '';
//-----------------------------------------
// Set some of the URL params
//-----------------------------------------
if ( $this->request['quickjump'] )
{
$this->request['name_box'] = 'begins';
$this->request['name'] = $this->request['quickjump'];
}
$url['showall'] = 'showall=' . $this->request['showall'];
$url['sort_key'] = "sort_key={$this->sort_key}";
$url['sort_order'] = "sort_order={$this->sort_order}";
$url['max_results'] = "max_results={$this->max_results}";
$url['app'] = "app=members&amp;section=view&amp;module=list";
$url['quickjump'] = "quickjump={$this->request['quickjump']}";
$url['name_box'] = 'name_box=' . $this->request['name_box'];
$url['name'] = "name={$this->request['name']}";
//-----------------------------------------
// Sort the member group info
//-----------------------------------------
foreach( $this->caches['group_cache'] as $row )
{
if ( $row['g_hide_from_list'] )
{
if ( ! ( $this->memberData['g_access_cp'] AND $this->request['showall'] ) )
{
$hide_ids[] = $row['g_id'];
continue;
}
}
$see_groups[] = $row['g_id'];
$this->mem_groups[ $row['g_id'] ] = array( 'TITLE' => $row['g_title'],
'ICON' => $row['g_icon'] );
if ( $row['g_id'] == $this->settings['guest_group'] )
{
continue;
}
$the_filter[ $row['g_id'] ] = $row['g_title'];
}
//-----------------------------------------
// Init some arrays
//-----------------------------------------
$the_sort_key = array(
'members_l_display_name' => 'sort_by_name',
'posts' => 'sort_by_posts',
'joined' => 'sort_by_joined',
'members_profile_views' => 'm_dd_views',
);
$the_max_results = array(
10 => '10',
20 => '20',
40 => '40',
60 => '60',
);
$the_sort_order = array(
'desc' => 'descending_order',
'asc' => 'ascending_order',
);
$dropdowns = array(
'filter' => $the_filter,
'sort_key' => $the_sort_key,
'sort_order' => $the_sort_order,
'max_results' => $the_max_results,
);
$defaults = array(
'filter' => $this->filter,
'sort_key' => $this->sort_key,
'sort_order' => $this->sort_order,
'max_results' => $this->max_results,
'photoonly' => $this->request['photoonly'] == 1 ? 1 : 0,
);
//-----------------------------------------
// Final vars for query
//-----------------------------------------
$this->sort_key = isset($the_sort_key[ $this->sort_key ]) ? $this->sort_key : 'members_l_display_name';
$this->sort_order = isset($the_sort_order[ $this->sort_order ]) ? $this->sort_order : 'asc';
$this->filter = isset($the_filter[ $this->filter ]) ? $this->filter : 'ALL';
$this->max_results = isset($the_max_results[ $this->max_results ]) ? $this->max_results : 20;
//-----------------------------------------
// Get custom profile information
//-----------------------------------------
require_once( IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php' );
$this->custom_fields = new customProfileFields();
$this->custom_fields->initData( 'edit', 1 );
$this->custom_fields->parseToEdit();
//-----------------------------------------
// Member Groups...
//-----------------------------------------
if ( $this->filter != 'ALL' )
{
if ( ! in_array( $this->filter, $see_groups ) )
{
$query[] = 'm.member_group_id IN(' . implode( ',', $see_groups ) . ')';
}
else
{
$query[] = 'm.member_group_id=' . $this->filter;
}
$url['filter'] = 'filter='.$this->filter;
}
//-----------------------------------------
// NOT IN Member Groups...
//-----------------------------------------
if ( count( $hide_ids ) )
{
$query[] = "m.member_group_id NOT IN(" . implode( ",", $hide_ids ) . ")";
}
//-----------------------------------------
// Build query
//-----------------------------------------
$dates = array( 'lastpost', 'lastvisit', 'joined' );
$mapit = array( 'posts' => 'm.posts',
'joined' => 'm.joined',
'lastpost' => 'm.last_post',
'lastvisit' => 'm.last_visit',
'signature' => 'pp.signature',
'name' => 'm.members_display_name',
'photoonly' => 'pp.pp_main_photo',
);
//-----------------------------------------
// Do search
//-----------------------------------------
foreach( $mapit as $in => $tbl )
{
$this->request[$in] = $this->request[ $in ] ? $this->request[ $in ] : '';
$inbit = IPSText::parseCleanValue( trim( urldecode( IPSText::stripslashes( $this->request[ $in ] ) ) ) );
$url[ $in ] = $in . '=' . urlencode($this->request[ $in ]);
//-----------------------------------------
// Name...
//-----------------------------------------
if ( $in == 'name' and $inbit != "" )
{
if ( $this->request['name_box'] == 'begins' )
{
$query[] = "m.members_l_display_name LIKE '" . strtolower( $inbit ) . "%'";
}
else
{
$query[] = "m.members_l_display_name LIKE '%" . strtolower( $inbit ) . "%'";
}
}
else if ( $in == 'posts' and is_numeric($inbit) and intval($inbit) > -1 )
{
$ltmt = $this->request[ $in .'_ltmt' ] == 'lt' ? '<' : '>';
$query[] = $tbl . ' ' . $ltmt . ' ' . intval($inbit);
$url[ $in ] = $in . '_ltmt=' . $this->request[ $in .'_ltmt' ] . '&posts=' . intval($inbit);
}
else if ( in_array( $in, $dates ) and $inbit )
{
if( preg_match( "/\d{2}-\d{2}-\d{4}/", $this->request[ $in ] ) )
{
$_tmp = explode( '-', $this->request[ $in ] );
$time_int = mktime( 23, 59, 59, $_tmp[1], $_tmp[0], $_tmp[2] );
}
else
{
$time_int = strtotime( IPSText::monthNameRu2En($date) );
}
if( $time_int )
{
$ltmt = $this->request[ $in . '_ltmt' ] == 'lt' ? '<' : '>';
$query[] = $tbl . ' ' . $ltmt . ' ' . $time_int;
$url[ $in . '_ltmt' ] = $in . '_ltmt=' . $this->request[ $in . '_ltmt' ];
}
}
else if ( $in == 'photoonly' )
{
if ( $this->request['photoonly'] == 1 )
{
$query[] = $tbl . "<> ''";
$url[] = 'photoonly=1';
}
}
else if ( $inbit != "" AND $in != 'posts' )
{
$query[] = $tbl . " LIKE '%{$inbit}%'";
}
}
//-----------------------------------------
// Custom fields?
//-----------------------------------------
if ( count( $this->custom_fields->out_fields ) )
{
foreach( $this->custom_fields->out_fields as $id => $data )
{
if ( $this->request[ 'field_' . $id ] AND $this->request[ 'field_' . $id ] )
{
if( $this->custom_fields->cache_data[ $id ]['pf_type'] == 'drop' )
{
$query[] = "p.field_{$id}='" . $this->request[ 'field_' . $id ] . "'";
}
else
{
$query[] = "p.field_{$id} LIKE '" . $this->request[ 'field_' . $id ] . "%'";
}
$url[ $in ] = "field_{$id}=" . $this->request[ 'field_' . $id ];
}
}
}
//-----------------------------------------
// Rating..
//-----------------------------------------
if ( $pp_rating_real )
{
$query[] = "pp.pp_rating_real > " . $pp_rating_real;
$url['pp_rating_real'] = "pp_rating_real=" . $pp_rating_real;
}
//-----------------------------------------
// Finish query
//-----------------------------------------
//$query[] = "m.members_l_display_name != ''";
$joins = array();
$joins[] = array( 'from' => array( 'pfields_content' => 'p' ), 'where' => 'p.member_id=m.member_id', 'type' => 'left' );
$joins[] = array( 'from' => array( 'profile_portal' => 'pp' ), 'where' => 'pp.pp_member_id=m.member_id', 'type' => 'left' );
//-----------------------------------------
// Reputation
//-----------------------------------------
if( ! ipsRegistry::isClassLoaded( 'repCache' ) )
{
require_once( IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php' );
ipsRegistry::setClass( 'repCache', new classReputationCache() );
}
//-----------------------------------------
// START THE LISTING
//-----------------------------------------
/* Get the count */
if ( count( $query ) > 1 OR $this->sort_key != 'members_l_display_name' OR $this->request['request_method'] == 'post' OR $this->request['st'] > 0 )
{
$_max = $this->DB->buildAndFetch( array( 'select' => 'COUNT( * ) as cnt',
'from' => array( 'members' => 'm' ),
'where' => implode( " AND ", $query ),
'add_join' => $joins ) );
$this->DB->build( array( 'select' =>' m.member_id',
'from' => array( 'members' => 'm' ),
'where' => implode( " AND ", $query ),
'order' => 'm.' . $this->sort_key . ' ' . $this->sort_order,
'limit' => array( $this->first, $this->max_results ),
'add_join' => $joins ) );
}
else
{
$_max = $this->DB->buildAndFetch( array( 'select' => 'COUNT( * ) as cnt',
'from' => 'members m',
'where' => implode( " AND ", $query ) ) );
$this->DB->build( array( 'select' => 'm.member_id',
'from' => array( 'members' => 'm' ),
'where' => implode( " AND ", $query ),
'order' => ( $this->sort_key == 'pp_profile_views' ? 'pp.' : 'm.' ) . $this->sort_key . ' ' . $this->sort_order,
'limit' => array( $this->first, $this->max_results ) ) );
}
/* Fetch IDs */
$mids = array();
$this->DB->execute();
while( $m = $this->DB->fetch() )
{
if( $m['member_id'] )
{
$mids[] = $m['member_id'];
}
}
if ( count( $mids ) )
{
$members = array();
$_members = IPSMember::load( $mids, 'all' );
/* Make sure that we keep the ordering from the query */
foreach( $mids as $id )
{
$members[$id] = $_members[$id];
}
}
$max = $_max['cnt'];
if( is_array($members) AND count($members) )
{
foreach( $members as $id => $member )
{
/* Damn SQL thing with member_id */
if ( ! $member['member_id'] )
{
$member['member_id'] = $member['member_table_id'];
}
$member['members_display_name'] = $member['members_display_name'] ? $member['members_display_name'] : $member['name'];
$member['members_seo_name'] = IPSMember::fetchSeoName( $member );
$member['group'] = $this->mem_groups[ $member['member_group_id'] ]['TITLE'];
$member = IPSMember::buildProfilePhoto( $member );
$member['pp_reputation_points'] = $member['pp_reputation_points'] ? $member['pp_reputation_points'] : 0;
$member['author_reputation'] = ipsRegistry::getClass( 'repCache' )->getReputation( $member['pp_reputation_points'] );
$the_members[] = $member;
}
}
/* make sure URL doesn't contain empty params */
$_url = $url;
$url = array();
foreach( $_url as $key => $bit )
{
if ( strrpos( $bit, '=' ) + 1 == strlen( $bit ) )
{
continue;
}
$url[] = $bit;
}
$pages = $this->registry->output->generatePagination( array( 'totalItems' => $max,
'itemsPerPage' => $this->max_results,
'currentStartValue' => $this->first,
'baseUrl' => implode( '&amp;', $url ) ) );
//-----------------------------------------
// Print...
//-----------------------------------------
$this->output .= $this->registry->getClass('output')->getTemplate('mlist')->member_list_show( $the_members, $pages, $dropdowns, $defaults, $this->custom_fields, implode( '&amp;', $url ) );
//-----------------------------------------
// Push to print handler
//-----------------------------------------
$this->registry->output->addContent( $this->output );
$this->registry->output->setTitle( $this->lang->words['page_title'] );
$this->registry->output->addNavigation( $this->lang->words['page_title'], 'app=members&amp;module=list' );
$this->registry->output->sendOutput();
}
}
@@ -0,0 +1,417 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Contact Member Functions
* Last Updated: $Date: 2009-04-14 03:01:20 -0400 (Tue, 14 Apr 2009) $
*
* @author $Author $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @subpackage Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Rev: 4453 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_messaging_contact extends ipsCommand
{
/**
* Temporary HTML output
*
* @access public
* @var string
*/
public $output = "";
/**
* Temporary navigation items
*
* @access public
* @var array
*/
public $nav = array();
/**
* Temporary page title
*
* @access public
* @var string
*/
public $page_title = "";
/**
* Error
*
* @access private
* @var string
*/
private $int_error = "";
/**
* Extra info
*
* @access private
* @var string
*/
private $int_extra = "";
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
/* What to do? */
switch( $this->request['do'] )
{
case '01':
case '00':
case 'Mail':
$this->mailMember();
break;
case 'report':
if( $this->request['send'] != 1 )
{
$this->reportPostForm();
}
else
{
$this->reportPostSend();
}
break;
default:
$this->registry->output->showError( 'contact_what_action', 1034 );
break;
}
/* Navigation */
foreach( $this->nav as $nav )
{
$this->registry->output->addNavigation( $nav[0], $nav[1] );
}
/* Output */
$this->registry->output->setTitle( $this->page_title );
$this->registry->output->addContent( $this->output );
$this->registry->output->sendOutput();
}
/**
* Displays the report post form
*
* @access public
* @return void
* @deprecated Just redirects to report center now
*/
public function reportPostForm()
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . "app=core&module=reports&rcom=post&tid={$this->request['t']}&pid={$this->request['p']}&st={$this->request['st']}" );
}
/**
* Sends the reported post
*
* @access public
* @return void
* @deprecated Just redirects to report center now
*/
public function reportPostSend()
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . "app=core&module=reports&rcom=post&tid={$this->request['t']}&pid={$this->request['p']}&st={$this->request['st']}" );
}
/**
* Handles the routines called by clicking on the "email" button
*
* @access public
* @return void
*/
public function mailMember()
{
/* Load Language */
$this->registry->class_localization->loadLanguageFile( array( 'public_emails' ), 'core' );
if( empty( $this->memberData['member_id'] ) )
{
ipsRegistry::getClass('output')->showError( 'members_only_mail', 10313 );
}
/* Check email permission */
if( ! $this->memberData['g_email_friend'] )
{
ipsRegistry::getClass('output')->showError( 'no_member_mail', 10314 );
}
if( $this->request['do'] == '01' )
{
$this->mailMemberSend();
}
else
{
$this->mailMemberForm();
}
}
/**
* Displays the form for mailing a member
*
* @access public
* @param string Errors
* @param string Extra data
* @return void
*/
public function mailMemberForm( $errors="", $extra="" )
{
/* Check ID */
$id = intval( $this->request['MID'] );
if( ! $id )
{
$this->registry->output->showError( 'mail_member_no_mid', 10315 );
}
/* Query member information */
$member = IPSMember::load( $id );
/* Make sure we have a valid user */
if( ! $member['member_id'] )
{
$this->registry->output->showError( 'mail_member_no_member', 10316 );
}
/* Check email privacy */
if( $member['hide_email'] == 1 )
{
$this->registry->output->showError( 'mail_member_private', 10317 );
}
/* Show errors */
if ( $errors != "" )
{
$msg = $this->lang->words[$errors];
if ( $extra != "" )
{
$msg = sprintf( $msg, $extra );
}
$this->output .= $this->registry->output->getTemplate('emails')->errors( $msg );
}
/* Output */
$this->output .= $this->settings['use_mail_form']
? $this->registry->output->getTemplate('emails')->sendMailForm(
array(
'NAME' => $member['members_display_name'],
'TO' => $member['member_id'],
'subject'=> $this->request['subject'],
'content'=> stripslashes( htmlspecialchars( $_POST['message'] ) ),
)
)
: $this->registry->output->getTemplate('emails')->show_address(
array(
'NAME' => $member['members_display_name'],
'ADDRESS' => $member['email'],
)
);
$this->page_title = $this->lang->words['member_address_title'];
$this->nav[] = array( $this->lang->words['member_address_title'], '' );
}
/**
* Sends the email
*
* @access public
* @return void
*/
public function mailMemberSend()
{
//-----------------------------------------
// Check form key first
//-----------------------------------------
if ( $this->request['k'] != $this->member->form_hash )
{
$this->registry->getClass('output')->showError( 'no_permission', 20313 );
}
$this->request['to'] = intval( $this->request['to'] );
if( $this->request['to'] == 0 )
{
$this->registry->output->showError( 'mail_member_no_mid', 10318 );
}
/* Query Member */
$member = IPSMember::load( $this->request['to'] );
/* Check for schtuff */
if( ! $member['member_id'] )
{
$this->registry->output->showError( 'mail_member_no_member', 10319 );
}
/* Check email privacy */
if( $member['hide_email'] == 1 )
{
$this->registry->output->showError( 'mail_member_private', 10320, true );
}
/* Check for blanks */
$check_array = array (
'message' => 'no_message',
'subject' => 'no_subject'
);
foreach( $check_array as $input => $msg )
{
if( empty( $this->request[$input] ) )
{
$this->request['MID'] = $this->request['to'];
$this->mailMemberForm( $msg );
return;
}
}
/* Check for spam / delays */
$email_check = $this->_allowToMail( $this->memberData['member_id'], $this->memberData['g_email_limit'] );
if( $email_check != TRUE )
{
$this->request['MID'] = $this->request['to'];
$this->mailMemberForm( $this->int_error, $this->int_extra );
return;
}
/**
* No check for injected headers in the message
* @link http://forums.invisionpower.com/index.php?app=tracker&showissue=13098
*/
if( preg_match("/(content-type:|content-transfer-encoding:|content-disposition:)/i", $this->request['message'] ) )
{
$this->registry->output->showError( 'bad_email_message', 5021, true );
}
/* Send the email */
IPSText::getTextClass( 'email' )->getTemplate( 'email_member' );
IPSText::getTextClass( 'email' )->buildMessage( array(
'MESSAGE' => str_replace( "<br>", "\n", str_replace( "\r", "", $this->request['message'] ) ),
'MEMBER_NAME' => $member['members_display_name'],
'FROM_NAME' => $this->memberData['members_display_name']
) );
IPSText::getTextClass( 'email' )->subject = $this->request['subject'];
IPSText::getTextClass( 'email' )->to = $member['email'];
IPSText::getTextClass( 'email' )->from = $this->memberData['email'];
IPSText::getTextClass( 'email' )->sendMail();
/* Store email in the database */
$this->DB->insert( 'email_logs', array(
'email_subject' => $this->request['subject'],
'email_content' => $this->request['message'],
'email_date' => time(),
'from_member_id' => $this->memberData['member_id'],
'from_email_address' => $this->memberData['email'],
'from_ip_address' => $this->member->ip_address,
'to_member_id' => $member['member_id'],
'to_email_address' => $member['email'],
) );
$this->output = $this->registry->output->getTemplate('emails')->sentScreen( $member['members_display_name'] );
$this->page_title = $this->lang->words['email_sent'];
$this->nav[] = array( $this->lang->words['email_sent'], '' );
}
/**
* Check Flood Limit
*
* @access private
* @param integer $member_id
* @param string $email_limit
* @return bool
**/
private function _allowToMail( $member_id, $email_limit )
{
$member_id = intval( $member_id );
if( ! $member_id )
{
$this->int_error = 'gen_error';
return FALSE;
}
list( $limit, $flood ) = explode( ':', $email_limit );
if ( ! $limit and ! $flood )
{
return TRUE;
}
//-----------------------------------------
// Get some stuff from the DB!
// 1) FLOOD?
//-----------------------------------------
if( $flood )
{
$this->DB->build( array(
'select' => '*',
'from' => 'email_logs',
'where' => "from_member_id=$member_id",
'order' => 'email_date DESC',
'limit' => array( 0, 1 ) ) );
$this->DB->execute();
$last_email = $this->DB->fetch();
if( $last_email['email_date'] + ( $flood * 60 ) > time() )
{
$this->int_error = 'exceeded_flood';
$this->int_extra = $flood;
return FALSE;
}
}
if( $limit )
{
$time_range = time() - 86400;
$this->DB->build( array(
'select' => 'count(email_id) as cnt',
'from' => 'email_logs',
'where' => "from_member_id=$member_id AND email_date > $time_range",
) );
$this->DB->execute();
$quota_sent = $this->DB->fetch();
if( $quota_sent['cnt'] + 1 > $limit )
{
$this->int_error = 'exceeded_quota';
$this->int_extra = limit;
return FALSE;
}
}
return TRUE; //<{%dyn.down.var.md5p2%}> If we get here...
}
}
@@ -0,0 +1,30 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Define the default messaging section
* 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 Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Rev: 4948 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
/**
* Very simply returns the default section if one is not
* passed in the URL
*/
$DEFAULT_SECTION = 'view';
@@ -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,218 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Online list
* Last Updated: $Date: 2009-07-08 17:04:40 -0400 (Wed, 08 Jul 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 Members
* @link http://www.iinvisionpower.com
* @since 12th March 2002
* @version $Revision: 4855 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_messaging_search extends ipsCommand
{
/**
* Page title
*
* @access private
* @var string
*/
private $_title;
/**
* Navigation entries
*
* @access private
* @var array
*/
private $_navigation;
/**
* Messenger library
*
* @access public
* @var object
*/
public $messengerFunctions;
/**
* Error string
*
* @access private
* @var string
*/
public $_errorString = '';
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Check viewing permissions, etc
//-----------------------------------------
if ( ! $this->memberData['g_use_pm'] )
{
$this->registry->getClass('output')->showError( 'messenger_disabled', 10226 );
}
if ( $this->memberData['members_disable_pm'] )
{
$this->registry->getClass('output')->showError( 'messenger_disabled', 10227 );
}
if ( ! $this->memberData['member_id'] )
{
$this->registry->getClass('output')->showError( 'messenger_no_guests', 10228 );
}
if( ! IPSLib::moduleIsEnabled( 'messaging', 'members' ) )
{
$this->registry->getClass('output')->showError( 'messenger_disabled', 10227 );
}
//-----------------------------------------
// Language
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_messaging' ), 'members' );
$this->registry->class_localization->loadLanguageFile( array( 'public_topic' ), 'forums' );
//-----------------------------------------
// Grab class
//-----------------------------------------
require_once( IPSLib::getAppDir( 'members' ) . '/sources/classes/messaging/messengerFunctions.php' );
$this->messengerFunctions = new messengerFunctions( $registry );
/* Messenger Totals */
$totals = $this->messengerFunctions->buildMessageTotals();
//-----------------------------------------
// What to do?
//-----------------------------------------
switch( $this->request['do'] )
{
default:
case 'search':
$html = $this->_search();
break;
}
//-----------------------------------------
// If we have any HTML to print, do so...
//-----------------------------------------
$this->registry->output->addContent( $this->registry->getClass('output')->getTemplate('messaging')->messengerTemplate( $html, $this->messengerFunctions->_jumpMenu, $this->messengerFunctions->_dirData, $totals, $this->_topicParticipants, $this->_errorString ) );
$this->registry->output->setTitle( $this->_title );
$this->registry->output->addNavigation( $this->lang->words['messenger__nav'], 'app=members&amp;module=messaging' );
if ( is_array( $this->_navigation ) AND count( $this->_navigation ) )
{
foreach( $this->_navigation as $idx => $data )
{
$this->registry->output->addNavigation( $data[0], $data[1] );
}
}
$this->registry->output->sendOutput();
}
/**
* Search. Do it.
*
* @access private
* @param string Any error text
* @return string returns HTML
*/
private function _search( $error='' )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$start = intval($this->request['st']);
$p_end = $this->settings['show_max_msg_list'] > 0 ? $this->settings['show_max_msg_list'] : 50;
$searchFor_TAINTED = IPSText::parseCleanValue( urldecode( $_REQUEST['searchFor'] ) );
$searchIn = '';
/* Got an error? */
if ( $error )
{
$this->_errorString = $error;
}
/* Search for owt? */
if( ! $searchFor_TAINTED )
{
$error = $this->lang->words['search_convo_no_keywords'];
}
else if( ( $this->settings['min_search_word'] && strlen( $searchFor_TAINTED ) < $this->settings['min_search_word'] ) )
{
$error = sprintf( $this->lang->words['search_term_short'], $this->settings['min_search_word'] );
}
/* Do the search */
else
{
$searchResults = $this->messengerFunctions->searchMessages( $this->memberData['member_id'], $searchFor_TAINTED, $start, $p_end, array() );
$totalMsg = $searchResults['totalMatches'];
$messages = $searchResults['results'];
/* Got anything? */
if ( ! $totalMsg OR ( ! count( $messages ) ) )
{
$error = $this->lang->words['search_convo_no_results'];
}
}
//-----------------------------------------
// Generate Pagination
//-----------------------------------------
$pages = $this->registry->getClass('output')->generatePagination( array( 'totalItems' => $totalMsg,
'itemsPerPage' => $p_end,
'currentStartValue' => $start,
'baseUrl' => "app=members&amp;module=messaging&amp;section=search&amp;do=search&amp;searchFor=" . urlencode( $searchFor_TAINTED ) ) );
//-----------------------------------------
// Set title
//-----------------------------------------
$this->_title = $this->lang->words['t_welcome'] . $this->lang->words['search_results_pt'];
//-----------------------------------------
// Set navigation
//-----------------------------------------
//$this->_navigation[] = array( $this->messengerFunctions->_dirData[ $this->messengerFunctions->_currentFolderID ]['real'], $this->settings['base_url']."app=members&amp;module=messaging&amp;section=view&amp;do=showFolder&amp;folderID=".$this->messengerFunctions->_currentFolderID."&amp;sort=".$this->request['sort'] );
//-----------------------------------------
// Done...
//-----------------------------------------
return $this->registry->getClass('output')->getTemplate('messaging')->showSearchResults( $messages, $pages, $error );
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,782 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Online list
* Last Updated: $Date: 2009-08-31 20:32:10 -0400 (Mon, 31 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 Members
* @link http://www.iinvisionpower.com
* @since 12th March 2002
* @version $Revision: 5066 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_messaging_view extends ipsCommand
{
/**
* Page title
*
* @access private
* @var string
*/
private $_title;
/**
* Navigation
*
* @access private
* @var array[ 0 => [ title, url ] ]
*/
private $_navigation;
/**
* Folder totals
*
* @access private
* @var mixed
*/
private $_totals;
/**
* Contains topic participant data
*
* @access public
* @var array
*/
public $_topicParticipants;
/**
* Messenger library
*
* @access public
* @var object
*/
public $messengerFunctions;
/**
* Error string
*
* @access public
* @var string
*/
public $_errorString = '';
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Check viewing permissions, etc
//-----------------------------------------
if ( ! $this->memberData['g_use_pm'] )
{
$this->registry->getClass('output')->showError( 'messenger_disabled', 10226 );
}
if ( $this->memberData['members_disable_pm'] )
{
$this->registry->getClass('output')->showError( 'messenger_disabled', 10227 );
}
if ( ! $this->memberData['member_id'] )
{
$this->registry->getClass('output')->showError( 'messenger_no_guests', 10228 );
}
if( ! IPSLib::moduleIsEnabled( 'messaging', 'members' ) )
{
$this->registry->getClass('output')->showError( 'messenger_disabled', 10227 );
}
//-----------------------------------------
// Language
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( "public_editors" ), 'core' );
$this->registry->class_localization->loadLanguageFile( array( 'public_messaging' ), 'members' );
$this->registry->class_localization->loadLanguageFile( array( 'public_topic' ), 'forums' );
//-----------------------------------------
// Grab class
//-----------------------------------------
require_once( IPSLib::getAppDir( 'members' ) . '/sources/classes/messaging/messengerFunctions.php' );
$this->messengerFunctions = new messengerFunctions( $registry );
/* Messenger Totals */
$this->_totals = $this->messengerFunctions->buildMessageTotals();
/* Filtah */
if ( $this->request['folderFilter'] )
{
$this->messengerFunctions->addFolderFilter( $this->request['folderFilter'] );
}
//-----------------------------------------
// What to do?
//-----------------------------------------
switch( $this->request['do'] )
{
default:
case 'inbox':
case 'showFolder':
$html = $this->_showFolder();
break;
case 'showConversation':
case 'showMessage':
$html = $this->showConversation();
break;
case 'multiFile':
$html = $this->_multiFile();
break;
case 'findMessage':
$html = $this->_findMessage();
break;
case 'addParticipants':
$html = $this->_addParticipants();
break;
/*case 'leaveConversation':
$html = $this->_leaveConversation();
break;
case 'rejoinConversation':
$html = $this->_rejoinConversation();
break;*/
case 'deleteConversation':
$html = $this->_deleteConversation();
break;
case 'blockParticipant':
$html = $this->_blockParticipant();
break;
case 'unblockParticipant':
$html = $this->_unblockParticipant();
break;
case 'toggleNotifications':
$html = $this->_toggleNotifications();
break;
}
//-----------------------------------------
// If we have any HTML to print, do so...
//-----------------------------------------
$this->registry->output->addContent( $this->registry->getClass('output')->getTemplate('messaging')->messengerTemplate( $html, $this->messengerFunctions->_jumpMenu, $this->messengerFunctions->_dirData, $this->_totals, $this->_topicParticipants, $this->_errorString, $this->_deletedTopic ) );
$this->registry->output->setTitle( $this->_title );
$this->registry->output->addNavigation( $this->lang->words['messenger__nav'], 'app=members&amp;module=messaging' );
if ( is_array( $this->_navigation ) AND count( $this->_navigation ) )
{
foreach( $this->_navigation as $idx => $data )
{
$this->registry->output->addNavigation( $data[0], $data[1] );
}
}
$this->registry->output->sendOutput();
}
/**
* Block a participant
*
* @access private
* @return mixed void, or HTML
*/
private function _toggleNotifications()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$authKey = $this->request['authKey'];
$topicID = intval( $this->request['topicID'] );
//-----------------------------------------
// Auth check
//-----------------------------------------
if ( $this->request['authKey'] != $this->member->form_hash )
{
$this->registry->getClass('output')->showError( 'messenger_bad_key', 2024 );
}
//-----------------------------------------
// Do it
//-----------------------------------------
try
{
$this->messengerFunctions->toggleNotificationStatus( $this->memberData['member_id'], array( $topicID ), 'toggle' );
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'app=members&amp;module=messaging&amp;section=view&amp;do=showConversation&amp;topicID=' . $topicID );
}
catch( Exception $error )
{
$msg = $error->getMessage();
$this->_errorString = $msg;
return $this->showConversation();
}
}
/**
* Block a participant
*
* @access private
* @return mixed void, or HTML
*/
private function _blockParticipant()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$authKey = $this->request['authKey'];
$memberID = intval( $this->request['memberID'] );
$topicID = intval( $this->request['topicID'] );
//-----------------------------------------
// Auth check
//-----------------------------------------
if ( $this->request['authKey'] != $this->member->form_hash )
{
$this->registry->getClass('output')->showError( 'messenger_bad_key', 2024 );
}
//-----------------------------------------
// Do it
//-----------------------------------------
try
{
$this->messengerFunctions->toggleTopicBlock( $memberID, $this->memberData['member_id'], $topicID, TRUE );
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'app=members&amp;module=messaging&amp;section=view&amp;do=showConversation&amp;topicID=' . $topicID );
}
catch( Exception $error )
{
$msg = $error->getMessage();
$this->_errorString = $msg;
return $this->showConversation();
}
}
/**
* Leave a conversation (non topic starter)
*
* @access private
* @return mixed void, or HTML
*/
private function _unblockParticipant()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$authKey = $this->request['authKey'];
$memberID = intval( $this->request['memberID'] );
$topicID = intval( $this->request['topicID'] );
//-----------------------------------------
// Auth check
//-----------------------------------------
if ( $this->request['authKey'] != $this->member->form_hash )
{
$this->registry->getClass('output')->showError( 'messenger_bad_key', 2024 );
}
//-----------------------------------------
// Do it
//-----------------------------------------
try
{
$this->messengerFunctions->toggleTopicBlock( $memberID, $this->memberData['member_id'], $topicID, FALSE );
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'app=members&amp;module=messaging&amp;section=view&amp;do=showConversation&amp;topicID=' . $topicID );
}
catch( Exception $error )
{
$msg = $error->getMessage();
$this->_errorString = $msg;
return $this->showConversation();
}
}
/**
* Leave a conversation (non topic starter)
*
* @access private
* @return mixed void, or HTML
*/
private function _deleteConversation()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$authKey = $this->request['authKey'];
$topicID = intval( $this->request['topicID'] );
//-----------------------------------------
// Auth check
//-----------------------------------------
if ( $this->request['authKey'] != $this->member->form_hash )
{
$this->registry->getClass('output')->showError( 'messenger_bad_key', 2024 );
}
//-----------------------------------------
// Do it
//-----------------------------------------
try
{
$this->messengerFunctions->deleteTopics( $this->memberData['member_id'], array( $topicID ) );
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'app=members&amp;module=messaging' );
}
catch( Exception $error )
{
$msg = $error->getMessage();
$this->_errorString = $msg;
return $this->showConversation();
}
}
/**
* Deletes a reply
*
* @access private
* @return mixed void, or HTML
*/
private function _addParticipants()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$authKey = $this->request['authKey'];
$topicID = intval( $this->request['topicID'] );
$inviteUsers = array();
$start = intval( $this->request['st'] );
//-----------------------------------------
// Auth check
//-----------------------------------------
if ( $this->request['authKey'] != $this->member->form_hash )
{
$this->registry->getClass('output')->showError( 'messenger_bad_key', 2024 );
}
//-----------------------------------------
// Invite Users
//-----------------------------------------
if ( $this->memberData['g_max_mass_pm'] AND $this->request['inviteNames'] )
{
foreach( explode( ",", $this->request['inviteNames'] ) as $id => $name )
{
$name = trim( $name );
if ( $name )
{
$inviteUsers[] = $name;
}
}
}
//-----------------------------------------
// Do it
//-----------------------------------------
try
{
$this->messengerFunctions->addTopicParticipants( $topicID, $inviteUsers, $this->memberData['member_id'] );
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'app=members&amp;module=messaging&amp;section=view&amp;do=showConversation&amp;topicID=' . $topicID . '&amp;st=' . $start );
}
catch( Exception $error )
{
$msg = $error->getMessage();
$msg = $error->getMessage();
if ( isset($this->lang->words[ 'err_' . $msg ]) )
{
$_msgString = $this->lang->words[ 'err_' . $msg ];
$_msgString = str_replace( '#NAMES#' , implode( ",", $this->messengerFunctions->exceptionData ), $_msgString );
$_msgString = str_replace( '#TONAME#' , $toMember['members_display_name'] , $_msgString );
$_msgString = str_replace( '#FROMNAME#', $this->memberData['members_display_name'], $_msgString );
}
else
{
$_msgString = $this->lang->words['err_UNKNOWN'] . ' ' . $msg;
}
$this->_errorString = $_msgString;
return $this->showConversation();
}
}
/**
* Redirects the user to the correct page in a conversation based on the incoming msg ID
*
* @access private
* @return string returns HTML
*/
private function _findMessage()
{
$msgID = ( $this->request['msgID'] == '__firstUnread__' ) ? '__firstUnread__' : intval( $this->request['msgID'] );
$topicID = intval( $this->request['topicID'] );
/* Fetch topic data */
$topicData = $this->messengerFunctions->fetchTopicData( $topicID );
/* Figure out the MSG id */
if ( $msgID == '__firstUnread__' )
{
/* Grab mah 'pants */
$participants = $this->messengerFunctions->fetchTopicParticipants( $topicID );
if ( $participants[ $this->memberData['member_id'] ] )
{
$_msgID = $this->DB->buildAndFetch( array( 'select' => 'msg_id',
'from' => 'message_posts',
'where' => 'msg_topic_id=' . $topicID . ' AND msg_date > ' . intval( $participants[ $this->memberData['member_id'] ]['map_read_time'] ),
'order' => 'msg_date ASC',
'limit' => array( 0, 1 ) ) );
$msgID = $_msgID['msg_id'];
}
}
$msgID = ( $msgID ) ? $msgID : $topicData['mt_last_msg_id'];
/* Figure it out */
$replies = $topicData['mt_replies'] + 1;
$perPage = $this->messengerFunctions->messagesPerPage;
$page = 0;
$_count = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as count',
'from' => 'message_posts',
'where' => "msg_topic_id=" . $topicID . " AND msg_id <=" . intval( $msgID ) ) );
if ( (($_count['count']) % $perPage) == 0 )
{
$pages = ($_count['count']) / $perPage;
}
else
{
$pages = ceil( ( ( $_count['count'] ) / $perPage ) );
}
$st = ($pages - 1) * $perPage;
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'app=members&amp;module=messaging&amp;section=view&amp;do=showConversation&amp;topicID=' . $topicID . '&amp;st=' . $st . '#msg' . $msgID );
}
/**
* Multi Files Messages
*
* @access private
* @return string returns HTML
*/
private function _multiFile()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$method = $this->request['method'];
$folderID = $this->request['folderID'];
$cfolderID = $this->request['cFolderID'];
$sort = $this->request['sort'];
$start = intval( $this->request['st'] );
$ids = array();
//-----------------------------------------
// Auth OK?
//-----------------------------------------
if ( $this->request['auth_key'] != $this->member->form_hash )
{
$this->messengerFunctions->_currentFolderID = $cfolderID;
return $this->_showFolder( $this->lang->words['err_auth'] );
}
//-----------------------------------------
// Grab IDs
//-----------------------------------------
if ( is_array( $_POST['msgid'] ) )
{
foreach( $_POST['msgid'] as $id => $value )
{
$id = intval( $id );
$ids[ $id ] = $id;
}
}
//-----------------------------------------
// What are we doing?
//-----------------------------------------
try
{
if ( $method == 'delete' )
{
$this->messengerFunctions->deleteTopics( $this->memberData['member_id'], $ids );
}
else if ( $method == 'move' )
{
$this->messengerFunctions->moveTopics( $this->memberData['member_id'], $ids, $folderID );
}
else if ( $method == 'markread' OR $method == 'markunread' )
{
$_method = ( $method == 'markread' ) ? TRUE : FALSE;
$this->messengerFunctions->toggleReadStatus( $this->memberData['member_id'], $ids, $_method );
}
else if ( $method == 'notifyon' OR $method == 'notifyoff' )
{
$_method = ( $method == 'notifyon' ) ? TRUE : FALSE;
$this->messengerFunctions->toggleNotificationStatus( $this->memberData['member_id'], $ids, $_method );
}
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'app=members&amp;module=messaging&amp;section=view&amp;do=showFolder&amp;folderID=' . $cfolderID . '&amp;sort=' . $sort . '&amp;st=' . $start );
}
catch( Exception $error )
{
$msg = $error->getMessage();
$error = '';
switch( $msg )
{
default:
$error = $this->lang->words['err_unspecifed'];
break;
case 'NO_IDS_SELECTED':
$error = $this->lang->words['err_NO_IDS_SELECTED'];
break;
/* Move exceptions */
case 'NO_SUCH_FOLDER':
$error = $this->lang->words['err_NO_SUCH_FOLDER'];
break;
case 'NO_IDS_TO_MOVE':
$error = $this->lang->words['err_NO_IDS_TO_MOVE'];
break;
/* Delete exceptions */
case 'NO_IDS_TO_DELETE':
$error = $this->lang->words['err_NO_IDS_TO_DELETE'];
break;
}
$this->messengerFunctions->_currentFolderID = $cfolderID;
return $this->_showFolder( $error );
}
}
/**
* Show a message
*
* @access public
* @return string returns HTML
*/
public function showConversation()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$topicID = intval( $this->request['topicID'] );
$start = intval( $this->request['st'] );
$end = $this->messengerFunctions->messagesPerPage;
//-----------------------------------------
// Got a message ID?
//-----------------------------------------
if ( ! $topicID )
{
$this->registry->getClass('output')->showError( 'messenger_no_msgid', 10225 );
}
//-----------------------------------------
// Fetch the conversation
//-----------------------------------------
try
{
$conversationData = $this->messengerFunctions->fetchConversation( $topicID, $this->memberData['member_id'], array( 'offsetStart' => $start, 'offsetEnd' => $end ) );
}
catch( Exception $error )
{
$_msg = $error->getMessage();
if ( $_msg == 'NO_READ_PERMISSION' )
{
$this->registry->getClass('output')->showError( 'messenger_no_msgid', 10229 );
}
else if ( $_msg == 'YOU_ARE_BANNED' )
{
$this->registry->getClass('output')->showError( 'messenger_you_be_banned_yo', 99910229 );
}
}
//-----------------------------------------
// Add to the topic data...
//-----------------------------------------
$conversationData['topicData']['_canReply'] = $this->messengerFunctions->canReplyTopic( $this->memberData['member_id'], $conversationData['topicData'], $conversationData['memberData'] );
//-----------------------------------------
// Pages
//-----------------------------------------
$conversationData['topicData']['_pages'] = $this->registry->output->generatePagination( array( 'totalItems' => $conversationData['topicData']['mt_replies'] + 1,
'itemsPerPage' => $end,
'currentStartValue' => $start,
'baseUrl' => "app=members&amp;module=messaging&amp;section=view&amp;do=showConversation&amp;topicID=".$topicID."&amp;sort=".$this->request['sort'] ) );
//-----------------------------------------
// Show...
//-----------------------------------------
$html = $this->registry->getClass('output')->getTemplate('messaging')->showConversation( $conversationData['topicData'], $conversationData['replyData'], $conversationData['memberData'], $this->messengerFunctions->_jumpMenu );
/* Sort out topic participants */
$this->_topicParticipants = $conversationData['memberData'];
/* Deleted topic flag */
$this->_deletedTopic = $conversationData['topicData']['mt_is_deleted'];
/* Finish off... */
$_folder = $conversationData['memberData'][ $this->memberData['member_id'] ]['map_folder_id'];
$this->messengerFunctions->_currentFolderID = $_folder;
$this->_title = $conversationData['topicData']['mt_title'];
$this->_navigation[] = array( $this->messengerFunctions->_dirData[ $_folder ]['real'], "app=members&amp;module=messaging&amp;section=view&amp;do=showFolder&amp;folderID=".$_folder."&amp;sort=".$this->request['sort'] );
$this->_navigation[] = array( $conversationData['topicData']['mt_title'], '' );
return $html;
}
/**
* Show the folder list
*
* @access private
* @param string Any error text
* @return string returns HTML
*/
private function _showFolder( $error='' )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$sort = $this->request['sort'];
$start = intval($this->request['st']);
$p_end = $this->settings['show_max_msg_list'] > 0 ? $this->settings['show_max_msg_list'] : 50;
$sort_key = '';
/* Got an error? */
if ( $error )
{
$this->_errorString = $error;
}
//-----------------------------------------
// Get the number of messages in our curr folder.
//-----------------------------------------
$totalMsg = $this->messengerFunctions->getPersonalTopicsCount( $this->memberData['member_id'], $this->messengerFunctions->_currentFolderID );
/* Only update if we're not using a filter */
if ( ( ! $this->request['folderFilter'] ) AND $totalMsg != $this->messengerFunctions->_dirData[ $this->messengerFunctions->_currentFolderID ]['count'] )
{
$this->messengerFunctions->rebuildFolderCount( $this->memberData['member_id'], array( $this->messengerFunctions->_currentFolderID => $totalMsg ) );
}
//-----------------------------------------
// Generate Pagination
//-----------------------------------------
if ( $start >= $totalMsg )
{
$start = 0;
}
$_baseURL = "app=members&amp;module=messaging&amp;section=view&amp;do=showFolder&amp;folderID=".$this->messengerFunctions->_currentFolderID;
if ( $this->request['sort'] )
{
$_baseURL .= "&amp;sort=".$this->request['sort'];
}
if ( $this->request['folderFilter'] )
{
$_baseURL .= "&amp;folderFilter=".$this->request['folderFilter'];
}
$pages = $this->registry->getClass('output')->generatePagination( array( 'totalItems' => $totalMsg,
'itemsPerPage' => $p_end,
'currentStartValue' => $start,
'baseUrl' => $_baseURL ) );
//-----------------------------------------
// Get the PMs
//-----------------------------------------
$messages = $this->messengerFunctions->getPersonalTopicsList( $this->memberData['member_id'], $this->messengerFunctions->_currentFolderID, array( 'sort' => $sort, 'offsetStart' => $start, 'offsetEnd' => $p_end ) );
//-----------------------------------------
// Set title
//-----------------------------------------
$this->_title = $this->lang->words['t_welcome'];
//-----------------------------------------
// Set navigation
//-----------------------------------------
$this->_navigation[] = array( $this->messengerFunctions->_dirData[ $this->messengerFunctions->_currentFolderID ]['real'], "app=members&amp;module=messaging&amp;section=view&amp;do=showFolder&amp;folderID={$this->messengerFunctions->_currentFolderID}" );
//-----------------------------------------
// Done...
//-----------------------------------------
return $this->registry->getClass('output')->getTemplate('messaging')->showFolder( $messages, $this->messengerFunctions->_dirData[ $this->messengerFunctions->_currentFolderID ]['real'], $pages, $this->messengerFunctions->_currentFolderID, $this->messengerFunctions->_jumpMenu, $error );
}
}
@@ -0,0 +1,30 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Define the default online section
* 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 Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Rev: 4948 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
/**
* Very simply returns the default section if one is not
* passed in the URL
*/
$DEFAULT_SECTION = 'online';
@@ -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,290 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Online list
* Last Updated: $Date: 2009-09-28 13:36:50 -0400 (Mon, 28 Sep 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 Members
* @link http://www.iinvisionpower.com
* @since 12th March 2002
* @version $Revision: 5169 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_online_online extends ipsCommand
{
/**
* Temporary stored output HTML
*
* @access public
* @var string
*/
public $output;
/**
* DB result start point
*
* @access public
* @var integer
*/
public $first = 0;
/**
* DB number of rows to pull
*
* @access public
* @var integer
*/
public $perpage = 25;
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Are we allowed to see the online list?
//-----------------------------------------
if ( !$this->settings['allow_online_list'] )
{
$this->registry->output->showError( 'onlinelist_disabled', 10230 );
}
//-----------------------------------------
// Init, lang, html
//-----------------------------------------
$this->request['st'] = intval( $this->request['st'] >= 0 ? intval($this->request['st']) : 0 );
$this->registry->class_localization->loadLanguageFile( array( 'public_online' ), 'members' );
//-----------------------------------------
// What to do?
//-----------------------------------------
switch( $this->request['do'] )
{
case 'listall':
default:
$this->_listAll();
break;
}
//-----------------------------------------
// If we have any HTML to print, do so...
//-----------------------------------------
$this->registry->output->addContent( $this->output );
$this->registry->output->setTitle( $this->lang->words['page_title'] );
$this->registry->output->addNavigation( $this->lang->words['page_title'], '' );
$this->registry->output->sendOutput();
}
/**
* Show the online list
*
* @access private
* @return void [Stores HTML in $this->output]
*/
private function _listAll()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$this->first = intval($this->request['st']) > 0 ? intval($this->request['st']) : 0;
$final = array();
$modules = array();
$memberIDs = array();
if ( !$this->settings['au_cutoff'] )
{
$this->settings[ 'au_cutoff'] = 15 ;
}
$defaults = array(
'show_mem' => ( $this->request['show_mem'] AND in_array( $this->request['show_mem'], array( 'reg', 'guest', 'all' ) ) ) ? $this->request['show_mem'] : 'all',
'sort_order' => ( $this->request['sort_order'] AND in_array( $this->request['sort_order'], array( 'desc', 'asc' ) ) ) ? $this->request['sort_order'] : 'asc',
'sort_key' => ( $this->request['sort_key'] AND in_array( $this->request['sort_key'], array( 'click', 'name' ) ) ) ? $this->request['sort_key'] : 'click',
);
//-----------------------------------------
// Sort the db query
//-----------------------------------------
$cut_off = $this->settings['au_cutoff'] * 60;
$t_time = time() - $cut_off;
$db_order = $defaults['sort_order'] == 'asc' ? 'asc' : 'desc';
$db_key = $defaults['sort_key'] == 'click' ? 'running_time' : 'member_name';
$wheres = array( 'running_time > ' . $t_time );
switch ( $defaults['show_mem'] )
{
case 'reg':
$wheres[] = "member_id > 0";
$wheres[] = "member_group != " . $this->settings['guest_group'];
break;
case 'guest':
$wheres[] = "member_group = " . $this->settings['guest_group'];
break;
}
if ( $this->settings['spider_anon'] OR ! $this->settings['spider_active'] )
{
if ( ! $this->settings['spider_active'] OR ! $this->memberData['g_access_cp'] )
{
$wheres[] = $this->DB->buildRight( 'id', 8 ) . " != '_session'";
}
}
if ( ! $this->settings['disable_anonymous'] AND ! $this->memberData['g_access_cp'] OR $this->settings['disable_admin_anon'] )
{
$wheres[] = "login_type != 1";
}
//-----------------------------------------
// Grab all the current sessions.
//-----------------------------------------
$this->DB->build( array( 'select' => '*',
'from' => 'sessions',
'where' => implode( ' AND ', $wheres ),
'calcRows' => TRUE,
'order' => $db_key . ' ' . $db_order,
'limit' => array( $this->first, $this->perpage ) ) );
$outer = $this->DB->execute();
$max = $this->DB->fetchCalculatedRows();
if ( ! $this->DB->getTotalRows($outer) && $this->first > 0 )
{
// We are request page 2 - but there is no page 2 now...
$this->registry->output->silentRedirect( $this->settings['base_url']."app=members&amp;section=online&amp;module=online&amp;sortkey={$defaults['sort_key']}&amp;show_mem={$defaults['show_mem']}&amp;sort_order={$defaults['sort_order']}" );
}
//-----------------------------------------
// Put results into array
//-----------------------------------------
while( $r = $this->DB->fetch($outer) )
{
if ( strstr( $r['id'], '_session' ) )
{
$r['is_bot'] = 1;
}
$r['where_line'] = '';
$r['where_link'] = '';
//-----------------------------------------
// Sessions aren't updated until shutdown
// so reset our session now
//-----------------------------------------
if( $this->memberData['member_id'] AND $r['member_id'] == $this->memberData['member_id'] )
{
$r['current_appcomponent'] = 'members';
$r['current_module'] = 'online';
$r['current_section'] = 'online';
}
//-----------------------------------------
// Is this a member?
//-----------------------------------------
if ( $r['member_id'] )
{
$memberIDs[] = $r['member_id'];
}
$final[ $r['id'] ] = $r;
//-----------------------------------------
// Module?
//-----------------------------------------
$modules[ $r['current_section'] ] = array( 'app' => $r['current_appcomponent'] );
}
$links = $this->registry->output->generatePagination( array( 'totalItems' => $max,
'itemsPerPage' => $this->perpage,
'currentStartValue' => $this->first,
'baseUrl' => "app=members&amp;section=online&amp;module=online&amp;sort_key={$defaults['sort_key']}&amp;sort_order={$defaults['sort_order']}&amp;show_mem={$defaults['show_mem']}"
) );
//-----------------------------------------
// Pass off entries to modules..
//-----------------------------------------
if ( count( $modules ) )
{
foreach( $modules as $module_array )
{
$filename = IPSLib::getAppDir( IPSText::alphanumericalClean($module_array['app']) ) . '/extensions/coreExtensions.php';
if ( file_exists( $filename ) )
{
require_once( $filename );
$toload = 'publicSessions__' . IPSText::alphanumericalClean($module_array['app']);
$loader = new $toload;
if( method_exists( $loader, 'parseOnlineEntries' ) )
{
$final = $loader->parseOnlineEntries( $final );
}
}
}
}
//-----------------------------------------
// Finally, members...
//-----------------------------------------
if ( count( $memberIDs ) )
{
$members = IPSMember::load( $memberIDs, 'all' );
}
$newFinal = array();
foreach( $final as $id => $data )
{
if ( $data['member_id'] )
{
$newFinal[ 'member-' . $data['member_id'] ] = $data;
$newFinal[ 'member-' . $data['member_id'] ]['memberData'] = $members[ $data['member_id'] ];
$newFinal[ 'member-' . $data['member_id'] ]['_memberData'] = IPSMember::buildProfilePhoto( $members[ $data['member_id'] ] );
}
else
{
$newFinal[ $data['id'] ] = $data;
$newFinal[ $data['id'] ]['memberData'] = array();
$newFinal[ $data['id'] ]['_memberData'] = IPSMember::buildProfilePhoto( 0 );
}
}
$this->output .= $this->registry->getClass('output')->getTemplate('online')->showOnlineList( $newFinal, $links, $defaults );
}
}
@@ -0,0 +1,408 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile View
* Last Updated: $Date: 2009-05-18 22:05:12 -0400 (Mon, 18 May 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 Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Revision: 4668 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_profile_comments extends ipsCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Get HTML and skin
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
//-----------------------------------------
// Can we access?
//-----------------------------------------
if ( !$this->memberData['g_mem_info'] )
{
$this->registry->output->showError( 'comments_profiles', 10231 );
}
switch( $this->request['do'] )
{
case 'view':
default:
$this->_viewComments();
break;
case 'save':
$this->_saveComment();
break;
case 'delete':
$this->_deleteComment();
break;
case 'approve':
$this->_approveComment();
break;
case 'add_new_comment':
$this->_doAddComment();
break;
}
}
/**
* Approve a comment on member's profile
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-02
*/
private function _approveComment()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval( $this->request['member_id'] );
$comment_id = intval( $this->request['comment_id'] );
//-----------------------------------------
// Try it. You might like it.
//-----------------------------------------
require_once( IPSLib::getAppDir( 'members' ) . '/sources/comments.php' );
$comment_lib = new profileCommentsLib( $this->registry );
$result = $comment_lib->approveComment( $member_id, $comment_id );
/* Check for error */
if( $result )
{
$this->registry->output->showError( $result, 10232 );
}
else
{
$member = IPSMember::load( $member_id );
$this->registry->output->redirectScreen( $this->lang->words['comment_was_approved'], $this->settings['base_url'] . 'showuser=' . $member_id, $member['members_seo_name'] );
}
}
/**
* Deletes a comment on member's profile
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-02
*/
private function _deleteComment()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval( $this->request['member_id'] );
$comment_id = intval( $this->request['comment_id'] );
//-----------------------------------------
// Try it. You might like it.
//-----------------------------------------
require_once( IPSLib::getAppDir( 'members' ) . '/sources/comments.php' );
$comment_lib = new profileCommentsLib( $this->registry );
$result = $comment_lib->deleteComment( $member_id, $comment_id );
/* Check for error */
if( $result )
{
$this->registry->output->showError( $result, 10232 );
}
else
{
$member = IPSMember::load( $member_id );
$this->registry->output->redirectScreen( $this->lang->words['comment_was_deleted'], $this->settings['base_url'] . 'showuser=' . $member_id, $member['members_seo_name'] );
}
}
/**
* Updates the comments
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-15
*/
private function _saveComment()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval( $this->request['member_id'] );
$md5check = IPSText::md5Clean( $this->request['md5check'] );
$content = '';
$comment_ids = array();
$final_ids = '';
//-----------------------------------------
// MD5 check
//-----------------------------------------
if ( $md5check != $this->member->form_hash )
{
die( '' );
}
//-----------------------------------------
// My tab?
//-----------------------------------------
if ( $member_id != $this->memberData['member_id'] AND !$this->memberData['g_is_supmod'] )
{
die( '' );
}
//-----------------------------------------
// Load member
//-----------------------------------------
$member = IPSMember::load( $member_id );
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $member['member_id'] )
{
die( '' );
}
//-----------------------------------------
// Grab comment_ids
//-----------------------------------------
if ( is_array( $this->request['pp-checked'] ) AND count( $this->request['pp-checked'] ) )
{
foreach( $this->request['pp-checked'] as $key => $value )
{
$key = intval( $key );
if ( $value )
{
$comment_ids[ $key ] = $key;
}
}
}
//-----------------------------------------
// Update the database...
//-----------------------------------------
if ( is_array( $comment_ids ) AND count( $comment_ids ) )
{
$final_ids = implode( ',', $comment_ids );
//-----------------------------------------
// Now update...
//-----------------------------------------
switch( $this->request['pp-moderation'] )
{
case 'approve':
$this->DB->update( 'profile_comments', array( 'comment_approved' => 1 ), 'comment_id IN(' . $final_ids . ')' );
break;
case 'unapprove':
$this->DB->update( 'profile_comments', array( 'comment_approved' => 0 ), 'comment_id IN(' . $final_ids . ')' );
break;
case 'delete':
$this->DB->delete( 'profile_comments', 'comment_id IN(' . $final_ids . ')' );
break;
}
}
//-----------------------------------------
// Bounce...
//-----------------------------------------
$this->registry->output->silentRedirect( $this->settings['base_url'] . 'app=members&section=comments&module=profile&member_id=' . $member_id . '&do=list&_saved=1&___msg=pp_comments_updated&md5check=' . $this->member->form_hash );
}
/**
* Loads the content for the comments tab
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-02
*/
private function _viewComments()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval( $this->request['member_id'] );
$md5check = IPSText::md5Clean( $this->request['md5check'] );
$content = '';
$comment_perpage = 10;
$pages = '';
$start = intval( $this->request['st'] );
$sql_extra = '';
//-----------------------------------------
// MD5 check
//-----------------------------------------
if ( $md5check != $this->member->form_hash )
{
die( '' );
}
//-----------------------------------------
// Not my tab? So no moderation...
//-----------------------------------------
if ( ( $member_id != $this->memberData['member_id'] ) AND ( ! $this->memberData['g_is_supmod'] ) )
{
$sql_extra = ' AND comment_approved=1';
}
//-----------------------------------------
// Load member
//-----------------------------------------
$member = IPSMember::load( $member_id );
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $member['member_id'] )
{
die( '' );
}
//-----------------------------------------
// How many comments must a man write down
// before he is considered a spammer?
//-----------------------------------------
$comment_count = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count_comment',
'from' => 'profile_comments',
'where' => 'comment_for_member_id=' . $member_id . $sql_extra
) );
//-----------------------------------------
// Pages
//-----------------------------------------
$pages = $this->registry->output->generatePagination( array( 'totalItems' => intval( $comment_count['count_comment'] ),
'itemsPerPage' => $comment_perpage,
'currentStartValue' => $start,
'baseUrl' => $this->settings['base_url'] . 'app=members&amp;section=comments&amp;module=profile&amp;member_id=' . $member_id . '&amp;do=view&amp;md5check=' . $this->member->form_hash,
) );
//-----------------------------------------
// Regenerate comments...
//-----------------------------------------
$this->DB->build( array( 'select' => 'pc.*',
'from' => array( 'profile_comments' => 'pc' ),
'where' => 'pc.comment_for_member_id='.$member_id . $sql_extra,
'order' => 'pc.comment_date DESC',
'limit' => array( $start, $comment_perpage ),
'add_join' => array(
0 => array(
'select' => 'm.members_display_name, m.login_anonymous',
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id=pc.comment_by_member_id',
'type' => 'left'
),
1 => array(
'select' => 'pp.*',
'from' => array( 'profile_portal' => 'pp' ),
'where' => 'pp.pp_member_id=m.member_id',
'type' => 'left'
),
)
) );
$o = $this->DB->execute();
while( $row = $this->DB->fetch($o) )
{
$row['comment_content'] = IPSText::wordwrap( $row['comment_content'], '19', ' ' );
$row = IPSMember::buildDisplayData( $row, 0 );
if( !$row['members_display_name_short'] )
{
$row = array_merge( $row, IPSMember::setUpGuest() );
}
$comments[] = $row;
}
//-----------------------------------------
// Ok.. show the settings
//-----------------------------------------
$content = $this->registry->getClass('output')->getTemplate('profile')->showIframeComments( $member, $comments, $pages );
$this->registry->getClass('output')->setTitle( $this->settings['board_name'] );
$this->registry->getClass('output')->popUpWindow( $content );
}
/**
* Save the new comment
*
* @access private
* @return void
*/
private function _doAddComment()
{
/* INIT */
$member_id = intval( $this->request['member_id'] );
$comment = $this->request['comment_text'];
/* Add Comment */
require_once( IPSLib::getAppDir( 'members' ) . '/sources/comments.php' );
$comment_lib = new profileCommentsLib( $this->registry );
$result = $comment_lib->addCommentToDB( $member_id, $comment );
/* Check for error */
if( $result AND $result != 'pp_comment_added_mod' )
{
$this->registry->output->showError( $result, 10232 );
}
else if ( $result == 'pp_comment_added_mod' )
{
$this->registry->output->redirectScreen( $this->lang->words[ $result ], $this->settings['base_url'] . 'showuser=' . $member_id );
}
else
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . 'showuser=' . $member_id );
}
}
}
@@ -0,0 +1,30 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Define the default profile section
* 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 Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Rev: 4948 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
/**
* Very simply returns the default section if one is not
* passed in the URL
*/
$DEFAULT_SECTION = 'view';
@@ -0,0 +1,107 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile View
* Last Updated: $Date: 2009-03-04 07:36:56 -0500 (Wed, 04 Mar 2009) $
*
* @author $Author: matt $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @subpackage Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Revision: 4135 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_profile_dname extends ipsCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$info = array();
$id = intval( $this->request['id'] );
//-----------------------------------------
// Get HTML and skin
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
//-----------------------------------------
// Can we access?
//-----------------------------------------
if ( !$this->memberData['g_mem_info'] )
{
$this->registry->output->showError( 'dname_profiles_off', 10233 );
}
if ( ! $this->settings['auth_allow_dnames'] )
{
$this->registry->output->showError( 'dnames_off', 10234 );
}
if( !$id )
{
$this->registry->output->showError( 'dnames_no_id', 10235 );
}
$member = IPSMember::load( $id );
//-----------------------------------------
// Get Dname history
//-----------------------------------------
$this->DB->build( array( 'select' => 'd.*',
'from' => array( 'dnames_change' => 'd' ),
'where' => 'dname_member_id='.$id,
'add_join' => array( 0 => array( 'select' => 'm.members_display_name',
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id=d.dname_member_id',
'type' => 'inner' ) ),
'order' => 'dname_date DESC'
) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
{
$records[] = $row;
}
//-----------------------------------------
// Print the pop-up window
//-----------------------------------------
$html = $this->registry->getClass('output')->getTemplate('profile')->dnameWrapper( $member['members_display_name'], $records );
//-----------------------------------------
// Push to print handler
//-----------------------------------------
$this->registry->getClass('output')->setTitle( $this->lang->words['dname_title'] );
$this->registry->getClass('output')->addNavigation( $this->lang->words['dname_title'], '' );
$this->registry->getClass('output')->addContent( $html );
$this->registry->output->sendOutput();
}
}
@@ -0,0 +1,718 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile View
* Last Updated: $Date: 2009-09-22 10:21:17 -0400 (Tue, 22 Sep 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 Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Revision: 5138 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_profile_friends extends ipsCommand
{
/**
* Friend's library
*
* @access private
* @var object
*/
private $friend_lib;
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
/* Friends enabled? */
if( ! $this->settings['friends_enabled'] )
{
$this->registry->getClass('output')->showError( 'friends_not_enabled', 10236 );
}
/* Friend Library */
require_once( IPSLib::getAppDir( 'members' ) . '/sources/friends.php' );
$this->friend_lib = new profileFriendsLib( $this->registry );
//-----------------------------------------
// Get HTML and skin
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
switch( $this->request['do'] )
{
case 'list':
default:
$this->_viewList();
break;
case 'add':
$this->_addFriend();
break;
case 'remove':
$this->_removeFriend();
break;
case 'moderate':
$this->_moderation();
break;
case 'view':
$this->_iframeList();
break;
}
}
/**
* Loads the content for the friends tab
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-15
*/
private function _iframeList()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval( $this->request['member_id'] );
$content = '';
$friends = array();
//-----------------------------------------
// Load member
//-----------------------------------------
$member = IPSMember::load( $member_id );
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $member['member_id'] )
{
$this->registry->output->showError( $this->lang->words['nofriendid'], 10270 );
}
//-----------------------------------------
// Grab the friends
//-----------------------------------------
$this->DB->build( array( 'select' => 'f.*',
'from' => array( 'profile_friends' => 'f' ),
'where' => 'f.friends_member_id=' . $member_id . ' AND f.friends_approved=1',
'order' => 'm.members_display_name ASC',
'add_join' => array(
1 => array( 'select' => 'pp.*',
'from' => array( 'profile_portal' => 'pp' ),
'where' => 'pp.pp_member_id=f.friends_friend_id',
'type' => 'left' ),
2 => array( 'select' => 'm.*',
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id=f.friends_friend_id',
'type' => 'left' )
)
) );
$outer = $this->DB->execute();
//-----------------------------------------
// Get and store...
//-----------------------------------------
while( $row = $this->DB->fetch($outer) )
{
$row['members_display_name_short'] = IPSText::truncate( $row['members_display_name'], 13 );
$friends[] = IPSMember::buildDisplayData( $row, 0 );
}
//-----------------------------------------
// Ok.. show the friends
//-----------------------------------------
$content = $this->registry->getClass('output')->getTemplate('profile')->friendsIframe( $member, $friends, true );
$this->registry->getClass('output')->setTitle( $this->settings['board_name'] );
$this->registry->getClass('output')->addContent( $content );
$this->registry->getClass('output')->sendOutput();
}
/**
* Remove a friend
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-09
*/
private function _removeFriend()
{
/* INIT */
$friend_id = intval( $this->request['member_id'] );
/* Check the secure key */
$this->request['secure_key'] = $this->request['secure_key'] ? $this->request['secure_key'] : $this->request['md5check'];
if( $this->request['secure_key'] != $this->member->form_hash )
{
$this->registry->output->showError( 'nopermission', 10274 );
}
/* Remove the friend */
$result = $this->friend_lib->removeFriend( $friend_id );
/* Remove from other user as well */
$result2 = $this->friend_lib->removeFriend( $this->memberData['member_id'], $member_id );
if( $result )
{
$this->registry->output->showError( $result, 10237 );
}
else
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . 'showuser=' . $friend_id );
}
}
/**
* Moderate pending friends
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-09
*/
private function _moderation()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$md5check = IPSText::md5Clean( $this->request['md5check'] );
$friends = array();
$friend_ids = array();
$friend_member_ids = array();
$_friend_ids = array();
$friends_already = array();
$friends_update = array();
$member = array();
$pp_option = $this->request['pp_option'] == 'delete' ? 'delete' : 'add_reciprocal';//trim( $this->request['pp_option'] );
$message = '';
$subject = '';
$msg = 'pp_friend_approved';
//-----------------------------------------
// MD5 check
//-----------------------------------------
if ( $md5check != $this->member->form_hash )
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . '&app=members&section=friends&module=profile&do=list&___msg=error&tab=pending' );
exit();
}
//-----------------------------------------
// Get friends...
//-----------------------------------------
if ( ! is_array( $this->request['pp_friend_id'] ) OR ! count( $this->request['pp_friend_id'] ) )
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . '&app=members&section=friends&module=profile&do=list&___msg=error&tab=pending' );
exit();
}
//-----------------------------------------
// Figure IDs
//-----------------------------------------
foreach( $this->request['pp_friend_id'] as $key => $value )
{
$_key = intval( $key );
if ( $_key )
{
$_friend_ids[ $_key ] = $_key;
}
}
if ( ! is_array( $_friend_ids ) OR ! count( $_friend_ids ) )
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . '&app=members&section=friends&module=profile&do=list&___msg=error&tab=pending' );
exit();
}
//-----------------------------------------
// Check our friends are OK
//-----------------------------------------
$this->DB->build( array( 'select' => '*',
'from' => 'profile_friends',
'where' => 'friends_friend_id=' . $this->memberData['member_id'] . ' AND friends_approved=0 AND friends_member_id IN (' . implode( ',', $_friend_ids ) . ')' ) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
{
$friend_ids[ $row['friends_id'] ] = $row['friends_id'];
$friend_member_ids[ $row['friends_member_id'] ] = $row['friends_member_id'];
}
if ( ! is_array( $friend_ids ) OR ! count( $friend_ids ) )
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . '&app=members&section=friends&module=profile&do=list&___msg=error&tab=pending' );
exit();
}
//-----------------------------------------
// Load friends...
//-----------------------------------------
$friends = IPSMember::load( $friend_member_ids );
//-----------------------------------------
// Get member...
//-----------------------------------------
$member = IPSMember::load( $this->memberData['member_id'] );
//-----------------------------------------
// Check...
//-----------------------------------------
if ( ! is_array( $friends ) OR ! count( $friends ) OR ! $member['member_id'] )
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . '&app=members&section=friends&module=profile&do=list&___msg=error&tab=pending' );
exit();
}
//-----------------------------------------
// What to do?
//-----------------------------------------
if ( $pp_option == 'delete' )
{
//-----------------------------------------
// Ok.. delete them in the DB.
//-----------------------------------------
$this->DB->delete( 'profile_friends', 'friends_id IN(' . implode( ',', $friend_ids ) . ')' );
//-----------------------------------------
// And make sure you are no longer their friend
//-----------------------------------------
foreach( $friend_member_ids as $friend_id )
{
$this->friend_lib->removeFriend( $this->memberData['member_id'], $friend_id );
}
$msg = 'pp_friend_removed';
}
else
{
//-----------------------------------------
// Ok.. approve them in the DB.
//-----------------------------------------
$this->DB->update( 'profile_friends', array( 'friends_approved' => 1 ), 'friends_id IN(' . implode( ',', $friend_ids ) . ')' );
//-----------------------------------------
// And make sure they're added in reverse
//-----------------------------------------
foreach( $friend_member_ids as $friend_id )
{
$this->friend_lib->addFriend( $this->memberData['member_id'], $friend_id, true );
}
//-----------------------------------------
// Reciprocal mode?
//-----------------------------------------
if ( $pp_option == 'add_reciprocal' )
{
//-----------------------------------------
// Find out who isn't already on your list...
//-----------------------------------------
$this->DB->build( array( 'select' => '*',
'from' => 'profile_friends',
'where' => 'friends_member_id=' . $this->memberData['member_id'] . ' AND friends_approved=1 AND friends_friend_id IN (' . implode( ',', $_friend_ids ) . ')' ) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
{
$friends_already[ $row['friends_friend_id'] ] = $row['friends_friend_id'];
}
//-----------------------------------------
// Check which aren't already members...
//-----------------------------------------
foreach( $friend_member_ids as $id => $_id )
{
if ( in_array( $id, $friends_already ) )
{
continue;
}
$friends_update[ $id ] = $id;
}
//-----------------------------------------
// Gonna do it?
//-----------------------------------------
if ( is_array( $friends_update ) AND count( $friends_update ) )
{
foreach( $friends_update as $id => $_id )
{
$this->DB->insert( 'profile_friends', array( 'friends_member_id' => $member['member_id'],
'friends_friend_id' => $id,
'friends_approved' => 1,
'friends_added' => time() ) );
}
}
}
//-----------------------------------------
// Send out message...
//-----------------------------------------
foreach( $friends as $friend )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$message = '';
$subject = '';
if ( $friend['pp_setting_notify_friend'] )
{
IPSText::getTextClass( 'email' )->getTemplate( "new_friend_approved" );
IPSText::getTextClass( 'email' )->buildMessage( array( 'MEMBERS_DISPLAY_NAME' => $friend['members_display_name'],
'FRIEND_NAME' => $member['members_display_name'],
'LINK' => $this->settings['board_url'] . '/index.' . $this->settings['php_ext'] . '?app=members&amp;module=profile&amp;section=friends&amp;do=list' ) );
$message = IPSText::getTextClass( 'email' )->message;
$subject = IPSText::getTextClass( 'email' )->subject;
$return_msg = '';
}
//-----------------------------------------
// Got anything to send?
//-----------------------------------------
if ( $message AND $subject )
{
//-----------------------------------------
// Email?
//-----------------------------------------
if ( $friend['pp_setting_notify_friend'] == 'email' OR $friend['members_disable_pm'] )
{
IPSText::getTextClass( 'email' )->subject = $subject;
IPSText::getTextClass( 'email' )->message = $message;
IPSText::getTextClass( 'email' )->to = $friend['email'];
IPSText::getTextClass( 'email' )->sendMail();
}
//-----------------------------------------
// PM?
//-----------------------------------------
else
{
require_once( IPSLib::getAppDir( 'members' ) . '/sources/classes/messaging/messengerFunctions.php' );
$this->messengerFunctions = new messengerFunctions( $this->registry );
try
{
$this->messengerFunctions->sendNewPersonalTopic( $friend['member_id'],
$member['member_id'],
array(),
$subject,
IPSText::getTextClass( 'editor' )->method == 'rte' ? nl2br($message) : $message,
array( 'origMsgID' => 0,
'fromMsgID' => 0,
'postKey' => md5(microtime()),
'trackMsg' => 0,
'addToSentFolder' => 0,
'hideCCUser' => 0,
'forcePm' => 1,
'isSystem' => 1,
)
);
}
catch( Exception $error )
{
$msg = $error->getMessage();
$toMember = IPSMember::load( $toMemberID, 'core', 'displayname' );
if ( strstr( $msg, 'BBCODE_' ) )
{
$msg = str_replace( 'BBCODE_', '', $msg );
$this->registry->output->showError( $msg, 10238 );
}
else if ( isset($this->lang->words[ 'err_' . $msg ]) )
{
$this->lang->words[ 'err_' . $msg ] = $this->lang->words[ 'err_' . $msg ];
$this->lang->words[ 'err_' . $msg ] = str_replace( '#NAMES#' , implode( ",", $this->messengerFunctions->exceptionData ), $this->lang->words[ 'err_' . $msg ] );
$this->lang->words[ 'err_' . $msg ] = str_replace( '#TONAME#' , $toMember['members_display_name'] , $this->lang->words[ 'err_' . $msg ] );
$this->lang->words[ 'err_' . $msg ] = str_replace( '#FROMNAME#', $this->memberData['members_display_name'], $this->lang->words[ 'err_' . $msg ] );
$this->registry->output->showError( 'err_' . $msg, 10239 );
}
else
{
$_msgString = $this->lang->words['err_UNKNOWN'] . ' ' . $msg;
$this->registry->output->showError( 'err_UNKNOWN', 10240 );
}
}
}
}
}
$this->friend_lib->recacheFriends( $friend );
}
//-----------------------------------------
// Recache..
//-----------------------------------------
$this->friend_lib->recacheFriends( $member );
//-----------------------------------------
// Return
//-----------------------------------------
$this->registry->output->silentRedirect( $this->settings['base_url'] . '&app=members&section=friends&module=profile&do=list&___msg='.$msg.'&tab=pending' );
}
/**
* Add a friend
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-09
*/
private function _addFriend()
{
/* INIT */
$friend_id = intval( $this->request['member_id'] );
/* Check the secure key */
$this->request['secure_key'] = $this->request['secure_key'] ? $this->request['secure_key'] : $this->request['md5check'];
if( $this->request['secure_key'] != $this->member->form_hash )
{
$this->registry->output->showError( 'nopermission', 10273 );
}
/* Add the friend */
$result = $this->friend_lib->addFriend( $friend_id );
/* Add to other user as well, but only if not pending */
if( !$this->friends->pendingApproval )
{
$result2 = $this->friend_lib->addFriend( $this->memberData['member_id'], $friend_id, true );
}
if( $result )
{
$this->registry->output->showError( $result, 10241 );
}
else
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . 'showuser=' . $friend_id );
}
}
/**
* List all current friends.
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-08
*/
private function _viewList()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$content = '';
$member_id = intval( $this->memberData['member_id'] );
$friends = array();
$tab = substr( IPSText::alphanumericalClean( $this->request['tab'] ), 0, 20 );
$friends_filter = substr( IPSText::alphanumericalClean( $this->request['friends_filter'] ), 0, 20 );
$_mutual_ids = array( 0 => 0 );
$query = '';
$join_field = '';
$time_limit = time() - $this->settings['au_cutoff'] * 60;
$per_page = 25;
$start = intval( $this->request['st'] );
//-----------------------------------------
// Check we're a member
//-----------------------------------------
if ( ! $member_id )
{
$this->lang->loadLanguageFile( array( 'public_error' ), 'core' );
$this->registry->output->showError( $this->lang->words['no_friend_mid'], 10267 );
}
//-----------------------------------------
// To what are we doing to whom?
//-----------------------------------------
if ( $tab == 'pending' )
{
$query = 'f.friends_friend_id=' . $member_id . ' AND f.friends_approved=0';
$join_field = 'f.friends_member_id';
}
else if ( $tab == 'mutual' AND $friends_filter == 'added' )
{
$query = 'f.friends_friend_id=' . $member_id . ' AND f.friends_approved=1';
$join_field = 'f.friends_member_id';
}
else if ( $tab == 'mutual' )
{
# My friends...
$this->DB->build( array( 'select' => '*',
'from' => 'profile_friends',
'where' => 'friends_member_id=' . $member_id . ' AND friends_approved=1' ) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
{
$_mutual_ids[] = $row['friends_friend_id'];
}
$query = 'f.friends_member_id IN (' . implode( ',', $_mutual_ids ) . ') AND f.friends_friend_id=' . $member_id . ' AND f.friends_approved=1';
$join_field = 'f.friends_member_id';
}
else
{
$query = 'f.friends_member_id=' . $member_id;
$join_field = 'f.friends_friend_id';
}
//-----------------------------------------
// Filtered?
//-----------------------------------------
if ( $friends_filter == 'online' )
{
$query .= " AND ( ( m.last_visit > {$time_limit} OR m.last_activity > {$time_limit} ) AND m.login_anonymous='0&1' )";
}
else if ( $friends_filter == 'offline' )
{
$query .= " AND ( m.last_activity < {$time_limit} OR ( m.login_anonymous='0&0' OR m.login_anonymous='1&0' ) )";
}
//-----------------------------------------
// Get count...
//-----------------------------------------
$count = $this->DB->buildAndFetch( array(
'select' => 'COUNT(*) as count',
'from' => array( 'profile_friends' => 'f' ),
'where' => $query,
'add_join' => array( array(
'select' => '',
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id=' . $join_field,
'type' => 'inner'
) )
) );
//-----------------------------------------
// Pages...
//-----------------------------------------
$pages = $this->registry->output->generatePagination( array(
'totalItems' => intval( $count['count'] ),
'noDropdown' => 1,
'itemsPerPage' => $per_page,
'currentStartValue' => $start,
'baseUrl' => 'app=members&amp;module=profile&amp;section=friends&amp;do=list&amp;tab='.$tab.'&amp;friends_filter=' . $friends_filter,
) );
//-----------------------------------------
// Get current friends...
//-----------------------------------------
$this->DB->build( array(
'select' => 'f.*',
'from' => array( 'profile_friends' => 'f' ),
'where' => $query,
'order' => 'm.members_l_display_name ASC',
'limit' => array( $start, $per_page ),
'add_join' => array(
array(
'select' => 'pp.*',
'from' => array( 'profile_portal' => 'pp' ),
'where' => 'pp.pp_member_id=' . $join_field,
'type' => 'left'
),
array(
'select' => 'm.*',
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id=' . $join_field,
'type' => 'left'
)
)
) );
$q = $this->DB->execute();
//-----------------------------------------
// Get and store...
//-----------------------------------------
while( $row = $this->DB->fetch( $q ) )
{
$row = IPSMember::buildDisplayData( $row );
$friends[] = $row;
}
//-----------------------------------------
// Show...
//-----------------------------------------
$content = $this->registry->getClass('output')->getTemplate('profile')->friendsList( $friends, $pages );
$this->registry->output->setTitle( $this->lang->words['m_title_friends'] );
$this->registry->output->addNavigation( $this->lang->words['m_title_friends'], '' );
$this->registry->getClass('output')->addContent( $content );
$this->registry->getClass('output')->sendOutput( $content );
}
}
@@ -0,0 +1,247 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Ignore a user
* Last Updated: $Date: 2009-04-07 08:23:29 -0400 (Tue, 07 Apr 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 Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Revision: 4414 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_profile_ignore extends ipsCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
switch( $this->request['do'] )
{
default:
case 'add':
$result = $this->ignoreMember( $this->request['memberID'], 'topics' );
break;
case 'remove':
$result = $this->stopIgnoringMember( $this->request['memberID'], 'topics' );
break;
case 'addPM':
$result = $this->ignoreMember( $this->request['memberID'], 'messages' );
break;
case 'removePM':
$result = $this->stopIgnoringMember( $this->request['memberID'], 'messages' );
break;
}
if( $result['error'] )
{
$this->registry->output->showError( $result['error'], 10266 );
}
else
{
$this->registry->output->redirectScreen( $result['message'], $this->settings['base_url'] . 'showuser=' . $this->request['memberID'] );
}
}
/**
* Ignore a member's topics
*
* @access public
* @param integer Member ID to ignore
* @param string Column to update
* @return array Array of info
*/
public function ignoreMember( $ignoreId, $type='topics' )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$this->lang->loadLanguageFile( array( 'public_usercp' ), 'core' );
$ignoreId = intval( $ignoreId );
$md5check = IPSText::md5Clean( $this->request['md5check'] );
$antiType = $type == 'topics' ? 'messages' : 'topics';
//-----------------------------------------
// MD5 check
//-----------------------------------------
if( !$ignoreId )
{
return array( 'error' => $this->lang->words['ignoreuser_noid'] );
}
if ( $md5check != $this->member->form_hash )
{
return array( 'error' => $this->lang->words['securehash_not_secure'] );
}
//-----------------------------------------
// Load member
//-----------------------------------------
$member = IPSMember::load( $ignoreId, 'core' );
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $member['member_id'] )
{
return array( 'error' => $this->lang->words['ignoreuser_noid'] );
}
//-----------------------------------------
// Can we ignore them?
//-----------------------------------------
if ( $member['_canBeIgnored'] !== TRUE )
{
return array( 0 => $this->lang->words['ignoreuser_cannot'] );
}
//-----------------------------------------
// Already ignoring?
//-----------------------------------------
$ignoreMe = $this->DB->buildAndFetch( array(
'select' => '*',
'from' => 'ignored_users',
'where' => 'ignore_owner_id=' . $this->memberData['member_id'] . ' AND ignore_ignore_id=' . $member['member_id']
) );
if ( $ignoreMe['ignore_id'] )
{
if( $ignoreMe['ignore_' . $type ] )
{
return array( 'error' => $this->lang->words['ignoreuser_already'] );
}
else
{
$this->DB->update( 'ignored_users', array( 'ignore_' . $type => 1 ), 'ignore_id=' . $ignoreMe['ignore_id'] );
return array( 'message' => $this->lang->words['ignoreuser_success'] );
}
}
//-----------------------------------------
// Add it
//-----------------------------------------
$this->DB->insert( 'ignored_users', array(
'ignore_owner_id' => $this->memberData['member_id'],
'ignore_ignore_id' => $member['member_id'],
'ignore_' . $antiType => 0,
'ignore_' . $type => 1,
)
);
/* Rebuild cache */
IPSMember::rebuildIgnoredUsersCache( $this->memberData );
return array( 'message' => $this->lang->words['ignoreuser_success'] );
}
/**
* Stop ignoring the user's topics
*
* @access public
* @param integer Member ID to stop ignoring
* @param string Column to update
* @return array Array of info
*/
public function stopIgnoringMember( $ignoreId, $type='topics' )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$this->lang->loadLanguageFile( array( 'public_usercp' ), 'core' );
$ignoreId = intval( $ignoreId );
$md5check = IPSText::md5Clean( $this->request['md5check'] );
$antiType = $type == 'topics' ? 'messages' : 'topics';
//-----------------------------------------
// MD5 check
//-----------------------------------------
if( !$ignoreId )
{
return array( 'error' => $this->lang->words['noignoreuser_noid'] );
}
if ( $md5check != $this->member->form_hash )
{
return array( 'error' => $this->lang->words['securehash_not_secure'] );
}
//-----------------------------------------
// Load member
//-----------------------------------------
$member = IPSMember::load( $ignoreId, 'core' );
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $member['member_id'] )
{
return array( 'error' => $this->lang->words['noignoreuser_noid'] );
}
//-----------------------------------------
// Already ignoring?
//-----------------------------------------
$ignoreMe = $this->DB->buildAndFetch( array(
'select' => '*',
'from' => 'ignored_users',
'where' => 'ignore_owner_id=' . $this->memberData['member_id'] . ' AND ignore_ignore_id=' . $member['member_id']
) );
if ( $ignoreMe['ignore_id'] )
{
if( !$ignoreMe['ignore_' . $antiType ] )
{
$this->DB->delete( 'ignored_users', 'ignore_id=' . $ignoreMe['ignore_id'] );
}
else
{
$this->DB->update( 'ignored_users', array( 'ignore_' . $type => 0 ), 'ignore_id=' . $ignoreMe['ignore_id'] );
}
/* Rebuild cache */
IPSMember::rebuildIgnoredUsersCache( $this->memberData );
return array( 'message' => $this->lang->words['noignoreuser_success'] );
}
else
{
return array( 'error' => $this->lang->words['noignoreuser_noid'] );
}
}
}
@@ -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,77 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile View
* Last Updated: $Date: 2009-03-04 07:36:56 -0500 (Wed, 04 Mar 2009) $
*
* @author $Author: matt $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @subpackage Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Revision: 4135 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_profile_photo extends ipsCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$info = array();
$id = intval( $this->request['id'] );
//-----------------------------------------
// Get HTML and skin
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
//-----------------------------------------
// Can we access?
//-----------------------------------------
if ( !$this->memberData['g_mem_info'] )
{
$this->registry->output->showError( 'photos_profiles_off', 10242 );
}
if( !$id )
{
$this->registry->output->showError( 'photos_no_id', 10243 );
}
$member = IPSMember::load( $id );
$member = IPSMember::buildDisplayData( $member );
$html = $this->registry->getClass('output')->getTemplate('profile')->showPhoto( $member );
//-----------------------------------------
// Push to print handler
//-----------------------------------------
$this->registry->getClass('output')->setTitle( $this->lang->words['photo_title'] );
$this->registry->getClass('output')->popUpWindow( $html );
}
}
@@ -0,0 +1,78 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Allow user to change their status
*
* @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 Members
* @link http://www.iinvisionpower.com
* @since Tuesday 1st March 2005 (11:52)
* @version $Revision: 4239 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_profile_status extends ipsCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Security check
//-----------------------------------------
if ( $this->request['k'] != $this->member->form_hash )
{
$this->registry->getClass('output')->showError( 'no_permission', 20314 );
}
//-----------------------------------------
// INIT
//-----------------------------------------
$info = array();
$id = intval( $this->memberData['member_id'] );
//-----------------------------------------
// Get HTML and skin
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
//-----------------------------------------
// Can we access?
//-----------------------------------------
if ( !$this->memberData['g_mem_info'] )
{
$this->registry->output->showError( 'status_off', 10268 );
}
if( !$id )
{
$this->registry->output->showError( 'status_off', 10269 );
}
$newStatus = trim( IPSText::getTextClass('bbcode')->stripBadWords( $this->request['new_status'] ) );
IPSMember::save( $id, array( 'extendedProfile' => array( 'pp_status' => $newStatus, 'pp_status_update' => time() ) ) );
$this->registry->output->redirectScreen( $this->lang->words['status_was_changed'], $this->settings['base_url'] . 'showuser=' . $id, $this->memberData['members_seo_name'] );
}
}
@@ -0,0 +1,86 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Allow user to change their status
*
* @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 Members
* @link http://www.iinvisionpower.com
* @since Tuesday 1st March 2005 (11:52)
* @version $Revision: 4948 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_profile_status extends ipsCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Security check
//-----------------------------------------
if ( $this->request['k'] != $this->member->form_hash )
{
$this->registry->getClass('output')->showError( 'no_permission', 20314 );
}
//-----------------------------------------
// INIT
//-----------------------------------------
$info = array();
$id = intval( $this->memberData['member_id'] );
//-----------------------------------------
// Get HTML and skin
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
//-----------------------------------------
// Can we access?
//-----------------------------------------
if ( ! $this->memberData['g_mem_info'] OR $this->memberData['gbw_no_status_update'] )
{
$this->registry->output->showError( 'status_off', 10268 );
}
if( !$id )
{
$this->registry->output->showError( 'status_off', 10269 );
}
$newStatus = trim( IPSText::getTextClass('bbcode')->stripBadWords( $this->request['new_status'] ) );
IPSMember::save( $id, array( 'extendedProfile' => array( 'pp_status' => $newStatus, 'pp_status_update' => time() ) ) );
/* Got a return URL? */
if ( $this->request['rurl'] )
{
$this->registry->output->redirectScreen( $this->lang->words['status_was_changed'], $this->settings['base_url'] . base64_decode( $this->request['rurl'] ) );
}
else
{
$this->registry->output->redirectScreen( $this->lang->words['status_was_changed'], $this->settings['base_url'] . 'showuser=' . $id, $this->memberData['members_seo_name'] );
}
}
}
@@ -0,0 +1,676 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile View
* 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 Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Revision: 5342 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_profile_view extends ipsCommand
{
/**
* Custom fields object
*
* @access public
* @var object
*/
public $custom_fields;
/**
* Temporary stored output HTML
*
* @access public
* @var string
*/
public $output;
/**
* Member name
*
* @access public
* @var string
*/
private $member_name;
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Get HTML and skin
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
$this->registry->class_localization->loadLanguageFile( array( 'public_online' ), 'members' );
//-----------------------------------------
// Can we access?
//-----------------------------------------
if ( !$this->memberData['g_mem_info'] )
{
$this->registry->output->showError( 'profiles_off', 10245 );
}
$this->_viewModern();
//-----------------------------------------
// Push to print handler
//-----------------------------------------
$this->registry->output->addContent( $this->output );
$this->registry->output->setTitle( $this->member_name . ' - ' . $this->lang->words['page_title_pp'] );
$this->registry->output->addNavigation( $this->lang->words['page_title_pp'], '' );
$this->registry->output->sendOutput();
}
/**
* Modern profile
*
* @access private
* @return void [Outputs to screen]
*/
private function _viewModern()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval( $this->request['id'] ) ? intval( $this->request['id'] ) : intval( $this->request['MID'] );
$member_id = $member_id ? $member_id : $this->memberData['member_id'];
$tab = substr( IPSText::alphanumericalClean( str_replace( '..', '', trim( $this->request['tab'] ) ) ), 0, 20 );
$firsttab = '';
$member = array();
$comments = array();
$comments_html = "";
$friends = array();
$visitors = array();
$comment_perpage = 5;
$pips = 0;
$tabs = array();
$_tabs = array();
$_positions = array( 0 => 0 );
$custom_path = IPSLib::getAppDir( 'members' ) . '/sources/tabs';
$_member_ids = array();
$sql_extra = '';
$pass = 0;
$mod = 0;
$_todays_date = getdate();
$time_adjust = $this->settings['time_adjust'] == "" ? 0 : $this->settings['time_adjust'];
$board_posts = $this->caches['stats']['total_topics'] + $this->caches['stats']['total_replies'];
//-----------------------------------------
// Check input..
//-----------------------------------------
if ( ! $member_id )
{
$this->registry->output->silentRedirect( $this->settings['base_url'] );
}
//-----------------------------------------
// Configure tabs
//-----------------------------------------
if( is_dir( $custom_path ) )
{
foreach( new DirectoryIterator( $custom_path ) as $f )
{
if ( ! $f->isDot() && ! $f->isDir() )
{
$file = $f->getFileName();
if( $file[0] == '.' )
{
continue;
}
if ( preg_match( "#\.conf\.php$#i", $file ) )
{
$classname = str_replace( ".conf.php", "", $file );
require( $custom_path . '/' . $file );
//-------------------------------
// Allowed to use?
//-------------------------------
if ( $CONFIG['plugin_enabled'] )
{
if( in_array( $this->settings['search_method'], array( 'traditional', 'sphinx' ) ) && $CONFIG['plugin_key'] == 'recentActivity' )
{
continue;
}
$_position = $this->_getTabPosition( $_positions, $CONFIG['plugin_order'] );
$_tabs[ $_position ] = $CONFIG;
$_positions[] = $_position;
}
}
}
}
}
ksort( $_tabs );
foreach( $_tabs as $_pos => $data )
{
if( !$firsttab )
{
$firsttab = $data['plugin_key'];
}
$data['_lang'] = isset($this->lang->words[ $data['plugin_lang_bit'] ]) ? $this->lang->words[ $data['plugin_lang_bit'] ] : $data['plugin_name'];
$tabs[ $data['plugin_key'] ] = $data;
}
if( $tab != 'comments' AND $tab != 'settings' AND !file_exists( $custom_path . '/' . $tab . '.php' ) )
{
$tab = $firsttab;
}
//-----------------------------------------
// Grab all data...
//-----------------------------------------
$member = IPSMember::load( $member_id, 'profile_portal,pfields_content,sessions,groups', 'id' );
if ( !$member['member_id'] )
{
$this->registry->output->showError( 'profiles_no_member', 10246 );
}
// Cycle redirect on member profile for ID FURL Fix
if ( IPB_USE_ONLY_ID_FURL )
{
$member['members_seo_name'] = $member['member_id'];
}
else
{
$member['members_seo_name'] = ( $member['members_seo_name'] ) ? $member['members_seo_name'] : IPSText::makeSeoTitle( $member['members_display_name'] );
}
/* Check USER permalink... */
$this->registry->getClass('output')->checkPermalink( $member['members_seo_name'] );
/* Build data */
$member = IPSMember::buildDisplayData( $member, array( 'customFields' => 1, 'cfSkinGroup' => 'profile', 'checkFormat' => 1, 'cfGetGroupData' => 1, 'signature' => 1, 'spamStatus' => 1 ) );
//-----------------------------------------
// Recent visitor?
//-----------------------------------------
if ( $member['member_id'] != $this->memberData['member_id'] )
{
list( $be_anon, $loggedin ) = explode( '&', $this->memberData['login_anonymous'] );
if ( ! $be_anon )
{
$this->_addRecentVisitor( $member, $this->memberData['member_id'] );
}
}
//-----------------------------------------
// DST?
//-----------------------------------------
if ( $member['dst_in_use'] == 1 )
{
$member['time_offset'] += 1;
}
//-----------------------------------------
// Format extra user data
//-----------------------------------------
$member['_age'] = ( $member['bday_year'] ) ? date( 'Y' ) - $member['bday_year'] : 0;
if( $member['bday_month'] > date( 'n' ) )
{
$member['_age'] -= 1;
}
else if( $member['bday_month'] == date( 'n' ) )
{
if( $member['bday_day'] > date( 'j' ) )
{
$member['_age'] -= 1;
}
}
$member['_local_time'] = $member['time_offset'] != "" ? gmstrftime( $this->settings['clock_long'], time() + ($member['time_offset']*3600) + ($time_adjust * 60) ) : '';
$member['g_title'] = IPSLib::makeNameFormatted( $member['g_title'], $member['g_id'], $member['prefix'], $member['suffix'] );
$member['_posts_day'] = 0;
$member['_total_pct'] = 0;
$member['_bday_month'] = $member['bday_month'] ? $this->lang->words['M_' . $member['bday_month'] ] : 0;
//-----------------------------------------
// BIO
// Not used/displayed anymore?
//-----------------------------------------
//$member['pp_bio_content'] = IPSText::getTextClass('bbcode')->stripBadWords( $member['pp_bio_content'] );
//$member['pp_bio_content'] = IPSText::wordwrap( $member['pp_bio_content'], '25', ' ' );
$posts = $this->DB->buildAndFetch( array(
'select' => "COUNT(*) as total_posts",
'from' => "posts",
'where' => "author_id=" . $member['member_id'],
) );
$member['posts'] = $posts['total_posts'];
//-----------------------------------------
// Total posts
//-----------------------------------------
if ( $member['posts'] and $board_posts )
{
$member['_posts_day'] = round( $member['posts'] / ( ( time() - $member['joined']) / 86400 ), 2 );
# Fix the issue when there is less than one day
$member['_posts_day'] = ( $member['_posts_day'] > $member['posts'] ) ? $member['posts'] : $member['_posts_day'];
$member['_total_pct'] = sprintf( '%.2f', ( $member['posts'] / $board_posts * 100 ) );
}
$member['_posts_day'] = floatval($member['_posts_day']);
if( ! $this->settings['disable_profile_stats'] )
{
//-----------------------------------------
// Most active in
//-----------------------------------------
/* Get list of good forum IDs */
$forumIdsOk = $this->registry->class_forums->fetchSearchableForumIds();
$faves = array();
$top = 0;
if( is_array($forumIdsOk) AND count($forumIdsOk) )
{
$favorite = $this->DB->buildAndFetch( array('select' => 'COUNT(p.author_id) as f_posts',
'from' => array( 'posts' => 'p' ),
'where' => 'p.author_id=' . $member['member_id'] . ' AND t.forum_id IN (' . implode( ",", $forumIdsOk ) . ") ",
'group' => 't.forum_id',
'order' => 'f_posts DESC',
'limit' => array( 0, 1 ),
'add_join' => array( array( 'select' => 't.forum_id',
'from' => array( 'topics' => 't' ),
'where' => 't.tid=p.topic_id' ) ) ) );
}
else
{
$favorite = array( 'forum_id' => 0, 'f_posts' => 0 );
}
$member['favorite_id'] = $favorite['forum_id'];
$member['_fav_posts'] = $favorite['f_posts'];
if( $member['posts'] )
{
$member['_fav_percent'] = round( $favorite['f_posts'] / $member['posts'] * 100 );
}
}
//-----------------------------------------
// Comments
//-----------------------------------------
if( $member['pp_setting_count_comments'] )
{
require_once( IPSLib::getAppDir( 'members' ) . '/sources/comments.php' );
$comment_lib = new profileCommentsLib( $this->registry );
$comment_html = $comment_lib->buildComments( $member );
}
//-----------------------------------------
// Visitors
//-----------------------------------------
if ( $member['pp_setting_count_visitors'] )
{
$_pp_last_visitors = unserialize( $member['pp_last_visitors'] );
$_visitor_info = array();
$_count = 1;
if ( is_array( $_pp_last_visitors ) )
{
krsort( $_pp_last_visitors );
$_members = IPSMember::load( array_values( $_pp_last_visitors ), 'extendedProfile' );
foreach( $_members as $_id => $_member )
{
$_visitor_info[ $_id ] = IPSMember::buildDisplayData( $_member, 0 );
}
foreach( $_pp_last_visitors as $_time => $_id )
{
if ( $_count > $member['pp_setting_count_visitors'] )
{
break;
}
$_count++;
if( !$_visitor_info[ $_id ]['members_display_name_short'] )
{
$_visitor_info[ $_id ] = IPSMember::setUpGuest();
}
$_visitor_info[ $_id ]['_visited_date'] = ipsRegistry::getClass( 'class_localization')->getDate( $_time, 'TINY' );
$_visitor_info[ $_id ]['members_display_name_short'] = $_visitor_info[ $_id ]['members_display_name_short'] ? $_visitor_info[ $_id ]['members_display_name_short'] : $this->lang->words['global_guestname'];
$visitors[] = $_visitor_info[ $_id ];
}
}
}
//-----------------------------------------
// Friends
//-----------------------------------------
# Get random number from member's friend cache... grab 10 random. array_rand( array, no.)
# also fall back on last 10 if no cache
if ( $member['pp_setting_count_friends'] > 0 && $this->settings['friends_enabled'] )
{
$member['_cache'] = IPSMember::unpackMemberCache( $member['members_cache'] );
if ( is_array( $member['_cache']['friends'] ) AND count( $member['_cache']['friends'] ) )
{
foreach( $member['_cache']['friends'] as $id => $approved )
{
$id = intval( $id );
if ( $approved AND $id )
{
$_member_ids[] = $id;
}
}
$member['_total_approved_friends'] = count( $_member_ids );
if ( is_array( $_member_ids ) AND count( $_member_ids ) )
{
$_max = count( $_member_ids ) > 50 ? 50 : count( $_member_ids );
$_rand = array_rand( $_member_ids, $_max );
$_final = array();
# If viewing member is in list, let's show em
if( in_array( $this->memberData[ 'member_id' ], $_member_ids ) )
{
$_final[] = $this->memberData[ 'member_id' ];
$new_mids = array();
foreach( $_member_ids as $mid )
{
if( $mid == $this->memberData[ 'member_id' ] )
{
continue;
}
$new_mids[] = $mid;
}
$_member_ids = $new_mids;
unset( $new_mids );
if( is_array( $_rand ) )
{
if( count( $_rand ) >= 50 )
{
array_pop( $_rand );
}
}
}
if ( is_array( $_rand ) AND count( $_rand ) )
{
foreach( $_rand as $_id )
{
$_final[] = $_member_ids[ $_id ];
}
}
if ( count( $_final ) )
{
$sql_extra = ' AND friends_friend_id IN (' . IPSText::cleanPermString( implode( ',', $_final ) ) . ')';
}
}
}
/* Fetch friends */
$_memberIds = array();
$_members = array();
$_friends = array();
$this->DB->build( array('select' => '*',
'from' => 'profile_friends',
'where' => 'friends_member_id=' . $member_id . ' AND friends_approved=1' . $sql_extra,
'limit' => array( 0, 50 ),
'order' => 'friends_approved DESC' ) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
{
$_memberIds[] = $row['friends_friend_id'];
$_friends[] = $row;
}
/* Got members? */
$_members = IPSMember::load( $_memberIds, 'core,extendedProfile' );
$member['_total_displayed_friends'] = 0;
foreach( $_friends as $row )
{
if( ! isset( $_members[ $row['friends_friend_id'] ] ) )
{
continue;
}
if ( $row['friends_friend_id'] && isset( $_members[ $row['friends_friend_id'] ] ) )
{
$row = array_merge( $row, $_members[ $row['friends_friend_id'] ] );
}
$row['_friends_added'] = ipsRegistry::getClass( 'class_localization')->getDate( $row['friends_added'], 'SHORT' );
$row['_location'] = $row['location'] ? $row['location'] : $this->lang->words['no_info'];
$row = IPSMember::buildProfilePhoto( $row );
$row['members_display_name_short'] = IPSText::truncate( $row['members_display_name'], 13 );
$friends[] = $row;
$member['_total_displayed_friends']++;
}
}
//-----------------------------------------
// Online location
//-----------------------------------------
$member = IPSMember::getLocation( $member );
//-----------------------------------------
// Add profile view
//-----------------------------------------
$this->DB->insert( 'profile_portal_views', array( 'views_member_id' => $member['member_id'] ), true );
//-----------------------------------------
// Grab default tab...
//-----------------------------------------
$tab_html = '';
if ( $tab != 'comments' AND $tab != 'settings' )
{
if( file_exists( $custom_path . '/' . $tab . '.php' ) )
{
require( $custom_path . '/pluginParentClass.php' );
require( $custom_path . '/' . $tab . '.php' );
$_func_name = 'profile_' . $tab;
$plugin = new $_func_name( $this->registry );
$tab_html = $plugin->return_html_block( $member );
}
}
//-----------------------------------------
// Set description tag
//-----------------------------------------
$_desc = ( $member['pp_about_me'] ) ? $member['pp_about_me'] : $member['signature'];
if ( $_desc )
{
$this->registry->output->addMetaTag( 'description', $member['members_display_name'] . ': ' . IPSText::getTextClass('bbcode')->stripAllTags( $_desc ) );
}
//-----------------------------------------
// Add to output
//-----------------------------------------
$this->member_name = $member['members_display_name'];
$this->output = $this->registry->getClass('output')->getTemplate('profile')->profileModern( $tabs, $member, $comment_html, $friends, $visitors, $tab, $tab_html, $fields );
}
/**
* Determines where to put custom profile tabs
*
* @access private
* @param array $takenPositions Array of positions that have been used
* @param integer $requestedPosition Position to check
* @return integer
*/
private function _getTabPosition( $takenPositions, $requestedPosition )
{
if( in_array( $requestedPosition, $takenPositions ) )
{
$requestedPosition++;
$this->_getTabPosition( $takenPositions, $requestedPosition );
}
return $requestedPosition;
}
/**
* Adds a recent visitor to ones profile
*
* @access private
* @param array Member information
* @param integer Member id to add
* @return boolean
* @since IPB 2.2.0.2006-7-31
*/
private function _addRecentVisitor( $member=array(), $member_id_to_add=0 )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id_to_add = intval( $member_id_to_add );
$found = 0;
$_recent_visitors = array();
//-----------------------------------------
// Check...
//-----------------------------------------
if ( ! $member_id_to_add )
{
return false;
}
//-----------------------------------------
// Sort out data...
//-----------------------------------------
$recent_visitors = unserialize( $member['pp_last_visitors'] );
if ( ! is_array( $recent_visitors ) OR ! count( $recent_visitors ) )
{
$recent_visitors = array();
}
foreach( $recent_visitors as $_time => $_id )
{
if ( $_id == $member_id_to_add )
{
$found = 1;
continue;
}
else
{
$_recent_visitors[ $_time ] = $_id;
}
}
$recent_visitors = $_recent_visitors;
krsort( $recent_visitors );
//-----------------------------------------
// No more than 10
//-----------------------------------------
if ( ! $found )
{
if ( count( $recent_visitors ) > 10 )
{
$_tmp = array_pop( $recent_visitors );
}
}
//-----------------------------------------
// Add the visit
//-----------------------------------------
$recent_visitors[ time() ] = $member_id_to_add;
krsort( $recent_visitors );
//-----------------------------------------
// Update profile...
//-----------------------------------------
if ( $member['pp_member_id'] )
{
$this->DB->update( 'profile_portal ', array( 'pp_last_visitors' => serialize( $recent_visitors ) ), 'pp_member_id=' . $member['member_id'], true );
}
else
{
$this->DB->insert( 'profile_portal ', array( 'pp_member_id' => $member['member_id'],
'pp_profile_update' => time(),
'pp_last_visitors' => serialize( $recent_visitors )
), true );
}
return true;
}
}
@@ -0,0 +1,30 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Define the default warn section
* Last Updated: $Date: 2008-12-22 18:10:25 -0500 (Mon, 22 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 Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Rev: 3540 $
*
*/
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 = 'warn';
@@ -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,954 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Member warn functions
* Last Updated: $Date: 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 Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Revision: 4818 $
*
* @todo [Future] Ability to require confirmation of a warning (feature)?
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_warn_warn extends ipsCommand
{
/**
* Temporary stored output HTML
*
* @access public
* @var string
*/
public $output;
/**
* Forum information
*
* @access private
* @var array Array of forum details
*/
private $forum = array();
/**
* Topic information
*
* @access private
* @var array Array of topic details
*/
private $topic = array();
/**
* Topic ID
*
* @access private
* @var integer Topic id
*/
private $topic_id = 0;
/**
* Forum ID
*
* @access private
* @var integer Forum id
*/
private $forum_id = 0;
/**
* Moderator information
*
* @access private
* @var array Array of moderator details
*/
private $moderator = array();
/**
* Can ban member from warn panel
*
* @access private
* @var bool Can ban member
*/
private $canSuspend = 0;
/**
* Can mod queue member from warn panel
*
* @access private
* @var bool Can mod queue member
*/
private $canModQueue = 0;
/**
* Can remove posting rights from member from warn panel
*
* @access private
* @var bool Can remove posting for member
*/
private $canRemovePostAbility = 0;
/**
* Number of times per day member can be warned
*
* @access private
* @var integer Number of times per day member can be warned
*/
private $restrictWarnsPerDay = 0;
/**
* Type of member
*
* @access private
* @var string mod, supmod, or member
*/
private $type = 'mod';
/**
* Data for the member being warned
*
* @access private
* @var array Member being warned
*/
private $warn_member = array();
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
$this->loadData();
//-----------------------------------------
// Bouncy, bouncy!
//-----------------------------------------
switch ($this->request['do'])
{
case 'dowarn':
$this->_doWarn();
break;
case 'add_note':
$this->_checkAccess();
$this->_addNoteform();
break;
case 'save_note':
$this->_checkAccess();
$this->_saveNote();
break;
case 'view':
$this->_checkAccess();
$this->viewLog();
break;
case 'form':
default:
$this->_showForm();
break;
}
$this->registry->output->addNavigation( $this->lang->words['w_title'], '' );
$this->registry->output->addContent( $this->output );
if( $this->request['popup'] )
{
$this->registry->getClass('output')->popUpWindow( $this->output );
}
else
{
$this->registry->output->sendOutput();
}
}
/**
* Load all necessary properties
*
* @access public
* @param boolean Return false on error, instead of display
* @return void
*/
public function loadData( $returnOnError=false )
{
//-----------------------------------------
// Set up
//-----------------------------------------
$this->settings[ 'warn_min'] = $this->settings['warn_min'] ? $this->settings['warn_min'] : 0;
$this->settings[ 'warn_max'] = $this->settings['warn_max'] ? $this->settings['warn_max'] : 10;
//-----------------------------------------
// Load modules...
//-----------------------------------------
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_mod' ), 'forums' );
if ( ! $this->settings['warn_on'] )
{
if( $returnOnError )
{
return false;
}
$this->registry->output->showError( 'warn_system_off', 10248 );
}
/* Need app_class_forums to setup moderator stuff */
require_once( IPS_ROOT_PATH . 'applications/forums/app_class_forums.php' );
$app_class_forums = new app_class_forums( $this->registry );
//-----------------------------------------
// Make sure we're a moderator...
//-----------------------------------------
$pass = 0;
if( $this->memberData['member_id'] )
{
if( $this->memberData['g_is_supmod'] == 1 )
{
$pass = 1;
$this->canSuspend = $this->settings['warn_gmod_ban'];
$this->canModQueue = $this->settings['warn_gmod_modq'];
$this->canRemovePostAbility = $this->settings['warn_gmod_post'];
$this->restrictWarnsPerDay = intval($this->settings['warn_gmod_day']);
$this->canApprovePosts = 1;
$this->canApproveTopics = 1;
$this->canDeletePosts = 1;
$this->canDeleteTopics = 1;
$this->type = 'supmod';
}
else if( $this->memberData['is_mod'] )
{
$other_mgroups = array();
if( $this->memberData['mgroup_others'] )
{
$other_mgroups = explode( ",", IPSText::cleanPermString( $this->memberData['mgroup_others'] ) );
}
$other_mgroups[] = $this->memberData['member_group_id'];
$this->DB->build( array(
'select' => '*',
'from' => 'moderators',
'where' => "(member_id='" . $this->memberData['member_id'] . "' OR (is_group=1 AND group_id IN(" . implode( ",", $other_mgroups ) . ")))"
) );
$this->DB->execute();
while ( $this->moderator = $this->DB->fetch() )
{
if ( $this->moderator['allow_warn'] )
{
$pass = 1;
$this->canSuspend = $this->settings['warn_mod_ban'];
$this->canModQueue = $this->settings['warn_mod_modq'];
$this->canRemovePostAbility = $this->settings['warn_mod_post'];
$this->restrictWarnsPerDay = intval($this->settings['warn_mod_day']);
$this->canApprovePosts = $this->moderator['post_q'];
$this->canApproveTopics = $this->moderator['topic_q'];
$this->canDeletePosts = $this->moderator['delete_post'];
$this->canDeleteTopics = $this->moderator['delete_topic'];
$this->type = 'mod';
}
}
}
else if( $this->settings['warn_show_own'] and $this->memberData['member_id'] == $this->request['mid'] )
{
$pass = 1;
$this->canSuspend = 0;
$this->canModQueue = 0;
$this->canRemovePostAbility = 0;
$this->restrictWarnsPerDay = 0;
$this->canApprovePosts = 0;
$this->canApproveTopics = 0;
$this->canDeletePosts = 0;
$this->canDeleteTopics = 0;
$this->type = 'member';
}
}
if ( $pass == 0 )
{
if( $returnOnError )
{
return false;
}
$this->registry->output->showError( 'warn_no_access', 2025 );
}
//-----------------------------------------
// Ensure we have a valid member
//-----------------------------------------
$mid = intval($this->request['mid']);
if ( $mid < 1 )
{
if( $returnOnError )
{
return false;
}
$this->registry->output->showError( 'warn_no_user', 10249 );
}
$this->warn_member = IPSMember::load( $mid, 'all' );
if ( ! $this->warn_member['member_id'] )
{
if( $returnOnError )
{
return false;
}
$this->registry->output->showError( 'warn_no_user', 10250 );
}
$this->registry->output->setTitle( $this->page_title ? $this->page_title : $this->lang->words['w_title'] );
}
/**
* Save a new note
*
* @access private
* @return void [Outputs to screen/redirects]
*/
private function _saveNote()
{
if ( $this->type == 'member' )
{
$this->registry->output->showError( 'warn_member_notes', 2026 );
}
//-----------------------------------------
// INIT
//-----------------------------------------
$content = '';
$note = trim( $this->request['note'] );
$save = array();
if ( $note )
{
//-----------------------------------------
// Ready to save?
//-----------------------------------------
$save['wlog_notes'] = "<content>{$note}</content>";
$save['wlog_notes'] .= "<mod></mod>";
$save['wlog_notes'] .= "<post></post>";
$save['wlog_notes'] .= "<susp></susp>";
$save['wlog_mid'] = $this->warn_member['member_id'];
$save['wlog_addedby'] = $this->memberData['member_id'];
$save['wlog_type'] = 'note';
$save['wlog_date'] = time();
//-----------------------------------------
// Enter into warn loggy poos (eeew - poo)
//-----------------------------------------
$this->DB->insert( 'warn_logs', $save );
}
//-----------------------------------------
// Done...
//-----------------------------------------
$popup = $this->request['popup'] ? '&amp;popup=1' : '';
$this->registry->output->silentRedirect( $this->settings['base_url']."app=members&amp;module=warn&amp;section=warn&amp;mid={$this->warn_member['member_id']}&amp;do=view" . $popup );
}
/**
* Form to add a new note
*
* @access private
* @return void [Outputs to screen/redirects]
*/
private function _addNoteForm()
{
if ( $this->type == 'member' )
{
$this->registry->output->showError( 'warn_member_notes', 2027 );
}
//-----------------------------------------
// INIT
//-----------------------------------------
$content = '';
$this->output .= $this->registry->getClass('output')->getTemplate('mod')->warn_add_note_form( $this->warn_member['member_id'], $this->warn_member['members_display_name'], $this->warn_member['members_seo_name'] );
$this->registry->getClass('output')->setTitle( $this->lang->words['warn_popup_title'] );
$this->registry->getClass('output')->popUpWindow( $this->output );
}
/**
* View the warn logs
*
* @access public
* @return string HTML output
*/
public function viewLog()
{
$perpage = 50;
$start = intval($this->request['st']) >= 0 ? intval($this->request['st']) : 0;
$row = $this->DB->buildAndFetch( array( 'select' => 'count(*) as cnt', 'from' => 'warn_logs', 'where' => "wlog_mid={$this->warn_member['member_id']}" ) );
$rows = array();
$links = $this->registry->output->generatePagination( array(
'totalItems' => $row['cnt'],
'itemsPerPage' => $perpage,
'currentStartValue' => $start,
'baseUrl' => "app=members&amp;module=warn&amp;section=warn&amp;do=view&amp;mid={$this->warn_member['member_id']}",
) );
if ( $row['cnt'] > 0 )
{
$this->DB->build( array(
'select' => 'l.*',
'from' => array( 'warn_logs' => 'l' ),
'where' => 'l.wlog_mid=' . $this->warn_member['member_id'],
'order' => 'l.wlog_date DESC ',
'limit' => array( $start, $perpage ),
'add_join' => array(
array(
'select' => 'p.member_id as punisher_id, p.members_display_name as punisher_name, p.members_seo_name, p.member_group_id, p.mgroup_others',
'from' => array( 'members' => 'p' ),
'where' => 'p.member_id=l.wlog_addedby',
'type' => 'left',
)
)
) );
$q =$this->DB->execute();
while ( $r = $this->DB->fetch( $q ) )
{
if ( strstr( $r['wlog_notes'], '<content>' ) )
{
$raw = preg_match( "#<content>(.+?)</content>#is", $r['wlog_notes'], $match );
}
else
{
$_array = unserialize( $r['wlog_notes'] );
if ( is_array( $_array ) AND $_array['content'] )
{
$match[1] = $_array['content'];
}
}
IPSText::getTextClass( 'bbcode' )->parse_smilies = 1;
IPSText::getTextClass( 'bbcode' )->parse_html = 0;
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
IPSText::getTextClass( 'bbcode' )->parsing_section = 'warn';
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $r['member_group_id'];
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $r['mgroup_others'];
$r['content'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $match[1] );
$rows[] = $r;
}
}
$this->output .= $this->registry->getClass('output')->getTemplate('mod')->warn_view_log( $this->warn_member, $rows, $links );
$this->registry->getClass('output')->setTitle( $this->lang->words['warn_popup_title'] );
return $this->output;
}
/**
* Add a new arn entry
*
* @access private
* @return void [Outputs to screen/redirects]
*/
private function _doWarn()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$save = array();
$err = 0;
$topicPosts_type = trim( $this->request['topicPosts_type'] );
$topicPosts_topics = intval( $this->request['topicPosts_topics'] );
$topicPosts_replies = intval( $this->request['topicPosts_replies'] );
$topicPosts_lastx = intval( $this->request['topicPosts_lastx'] );
$topicPosts_lastxunits = trim( $this->request['topicPosts_lastxunits'] );
$level_custom = intval( $this->request['level_custom'] );
$ban_indef = intval( $this->request['ban_indef'] );
$member_banned = intval( $this->warn_member['member_banned'] );
$warn_level = intval( $this->warn_member['warn_level']) ;
//-----------------------------------------
// Load Mod Squad
//-----------------------------------------
require_once( IPSLib::getAppDir( 'forums' ) . '/sources/classes/moderate.php' );
$moderatorLibrary = new moderatorLibrary( $this->registry );
//-----------------------------------------
// Security checks
//-----------------------------------------
if ( $this->type == 'member' )
{
$this->registry->output->showError( 'warn_member_notes', 2028 );
}
//-----------------------------------------
// Check security fang
//-----------------------------------------
if ( $this->request['key'] != $this->member->form_hash )
{
$this->registry->output->showError( 'warn_bad_key', 3020 );
}
//-----------------------------------------
// As Celine Dion once squawked, "Show me the reason"
//-----------------------------------------
if ( trim($this->request['reason']) == "" )
{
$this->_showForm( 'we_no_reason' );
return;
}
//-----------------------------------------
// Other checks
//-----------------------------------------
if ( ! $this->settings['warn_past_max'] && $this->request['level'] != 'nochange' )
{
if ( $this->request['level'] == 'custom' )
{
if ( $level_custom > $this->settings['warn_max'] )
{
$err = 1;
}
else if( $level_custom < $this->settings['warn_min'] )
{
$err = 2;
}
}
else if ( $this->request['level'] == 'add' )
{
if ( $warn_level >= $this->settings['warn_max'] )
{
$err = 1;
}
}
else
{
if ( $warn_level <= $this->settings['warn_min'] )
{
$err = 2;
}
}
if ( $err )
{
$this->registry->output->showError( $err == 1 ? 'warn_past_max_high' : 'warn_past_max_low', 10251 );
}
}
//-----------------------------------------
// Plussy - minussy?
//-----------------------------------------
if( $this->request['level'] == 'nochange' )
{
$save['wlog_type'] = 'nochan';
}
else
{
$save['wlog_type'] = ( $this->request['level'] == 'custom' ) ? 'custom' : ( ( $this->request['level'] == 'add' ) ? 'neg' : 'pos' );
}
$save['wlog_date'] = time();
//-----------------------------------------
// Contacting the member?
//-----------------------------------------
$test_content = trim( IPSText::br2nl( $_POST['contact'] ) ) ;
if ( $test_content != "" )
{
if ( trim($this->request['subject']) == "" )
{
$this->_showForm('we_no_subject');
return;
}
unset($test_content);
if ( IPSText::getTextClass('editor')->method == 'rte' )
{
$this->request['contact'] = IPSText::getTextClass('editor')->processRawPost( 'contact' );
}
IPSText::getTextClass( 'bbcode' )->parse_smilies = 1;
IPSText::getTextClass( 'bbcode' )->parse_html = 0;
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
IPSText::getTextClass( 'bbcode' )->parsing_section = 'warn';
$save['wlog_contact'] = $this->request['contactmethod'];
$save['wlog_contact_content'] = "<subject>" . $this->request['subject'] . "</subject><content>" . $this->request['contact'] . "</content>";
$save['wlog_contact_content'] = IPSText::getTextClass( 'bbcode' )->preDbParse( $save['wlog_contact_content'] );
if ( $this->request['contactmethod'] == 'email' )
{
IPSText::getTextClass( 'bbcode' )->parse_smilies = 0;
IPSText::getTextClass( 'bbcode' )->parse_html = 1;
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
IPSText::getTextClass( 'bbcode' )->parsing_section = 'warn';
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $this->memberData['member_group_id'];
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $this->memberData['mgroup_others'];
$this->request['contact'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( IPSText::getTextClass( 'bbcode' )->preDbParse( $this->request['contact'] ) );
//-----------------------------------------
// Send the email
//-----------------------------------------
IPSText::getTextClass( 'email' )->getTemplate("email_member");
IPSText::getTextClass( 'email' )->buildMessage( array(
'MESSAGE' => IPSText::br2nl( $this->request['contact'] ),
'MEMBER_NAME' => $this->warn_member['members_display_name'],
'FROM_NAME' => $this->memberData['members_display_name']
)
);
IPSText::getTextClass( 'email' )->subject = $this->request['subject'];
IPSText::getTextClass( 'email' )->to = $this->warn_member['email'];
IPSText::getTextClass( 'email' )->from = $this->settings['email_out'];
IPSText::getTextClass( 'email' )->sendMail();
}
else
{
//-----------------------------------------
// Grab PM class
//-----------------------------------------
require_once( IPSLib::getAppDir( 'members' ) . '/sources/classes/messaging/messengerFunctions.php' );
$messengerFunctions = new messengerFunctions( $this->registry );
try
{
$messengerFunctions->sendNewPersonalTopic( $this->warn_member['member_id'],
$this->memberData['member_id'],
array(),
$this->request['subject'],
IPSText::getTextClass( 'editor' )->method == 'rte' ? nl2br($_POST['contact']) : $_POST['contact'],
array( 'origMsgID' => 0,
'fromMsgID' => 0,
'postKey' => md5(microtime()),
'trackMsg' => 0,
'addToSentFolder' => 0,
'hideCCUser' => 0,
'forcePm' => 1,
)
);
}
catch( Exception $error )
{
$msg = $error->getMessage();
$toMember = IPSMember::load( $this->warn_member['member_id'], 'core' );
if ( strstr( $msg, 'BBCODE_' ) )
{
$msg = str_replace( 'BBCODE_', '', $msg );
$this->registry->output->showError( $msg, 10252 );
}
else if ( isset($this->lang->words[ 'err_' . $msg ]) )
{
$this->lang->words[ 'err_' . $msg ] = $this->lang->words[ 'err_' . $msg ];
$this->lang->words[ 'err_' . $msg ] = str_replace( '#NAMES#' , implode( ",", $messengerFunctions->exceptionData ), $this->lang->words[ 'err_' . $msg ] );
$this->lang->words[ 'err_' . $msg ] = str_replace( '#TONAME#' , $toMember['members_display_name'] , $this->lang->words[ 'err_' . $msg ] );
$this->lang->words[ 'err_' . $msg ] = str_replace( '#FROMNAME#', $this->memberData['members_display_name'], $this->lang->words[ 'err_' . $msg ] );
$this->registry->output->showError( 'err_' . $msg, 10253 );
}
else if( $msg != 'CANT_SEND_TO_SELF' )
{
$_msgString = $this->lang->words['err_UNKNOWN'] . ' ' . $msg;
$this->registry->output->showError( $_msgString, 10254 );
}
}
}
}
else
{
unset($test_content);
}
//-----------------------------------------
// Right - is we banned or wha?
//-----------------------------------------
$restrict_post = '';
$mod_queue = '';
$susp = '';
$_notes = array();
$_notes['content'] = $this->request['reason'];
$_notes['mod'] = $this->request['mod_value'];
$_notes['post'] = $this->request['post_value'];
$_notes['susp'] = $this->request['susp_value'];
$_notes['ban'] = $ban_indef;
$_notes['topicPosts_type'] = $topicPosts_type;
$_notes['topicPosts_topics'] = $topicPosts_topics;
$_notes['topicPosts_replies'] = $topicPosts_replies;
$_notes['topicPosts_lastx'] = $topicPosts_lastx;
$_notes['topicPosts_lastxunits'] = $topicPosts_lastxunits;
$save['wlog_notes'] = serialize( $_notes );
//-----------------------------------------
// Member Content
//-----------------------------------------
if ( $topicPosts_type == 'unapprove' OR $topicPosts_type == 'approve' )
{
$time = ( $topicPosts_lastxunits == 'd' ) ? ( $topicPosts_lastx * 24 ) : $topicPosts_lastx;
$approve = ( $topicPosts_type == 'approve' ) ? TRUE : FALSE;
if ( ( $topicPosts_topics AND $this->canApproveTopics ) AND ( $topicPosts_replies AND $this->canApprovePosts ) )
{
$moderatorLibrary->toggleApproveMemberContent( $this->warn_member['member_id'], $approve, 'all', $time );
}
else if ( $topicPosts_topics AND $this->canApproveTopics )
{
$moderatorLibrary->toggleApproveMemberContent( $this->warn_member['member_id'], $approve, 'topics', $time );
}
else if ( $topicPosts_replies AND $this->canApprovePosts )
{
$moderatorLibrary->toggleApproveMemberContent( $this->warn_member['member_id'], $approve, 'replies', $time );
}
}
else if ( $topicPosts_type == 'delete')
{
$time = ( $topicPosts_lastxunits == 'd' ) ? ( $topicPosts_lastx * 24 ) : $topicPosts_lastx;
if ( ( $topicPosts_topics AND $this->canDeleteTopics ) AND ( $topicPosts_replies AND $this->canDeletePosts ) )
{
$moderatorLibrary->deleteMemberContent( $this->warn_member['member_id'], 'all', $time );
}
else if ( $topicPosts_topics AND $this->canDeleteTopics )
{
$moderatorLibrary->deleteMemberContent( $this->warn_member['member_id'], 'topics', $time );
}
else if ( $topicPosts_replies AND $this->canDeletePosts )
{
$moderatorLibrary->deleteMemberContent( $this->warn_member['member_id'], 'replies', $time );
}
}
//-----------------------------------------
// Member Suspension
//-----------------------------------------
if ( $this->canModQueue )
{
if ( $this->request['mod_indef'] == 1 )
{
$mod_queue = 1;
}
elseif ( $this->request['mod_value'] > 0 )
{
$mod_queue = IPSMember::processBanEntry( array( 'timespan' => intval($this->request['mod_value']), 'unit' => $this->request['mod_unit'] ) );
}
}
if ( $this->canRemovePostAbility )
{
if ( $this->request['post_indef'] == 1 )
{
$restrict_post = 1;
}
elseif ( $this->request['post_value'] > 0 )
{
$restrict_post = IPSMember::processBanEntry( array( 'timespan' => intval($this->request['post_value']), 'unit' => $this->request['post_unit'] ) );
}
}
if ( $this->canSuspend )
{
if ( $ban_indef )
{
$member_banned = 1;
}
else if ( $this->request['susp_value'] > 0 )
{
$susp = IPSMember::processBanEntry( array( 'timespan' => intval($this->request['susp_value']), 'unit' => $this->request['susp_unit'] ) );
}
/* Were banned but now unticked? */
if ( ! $ban_indef AND $member_banned )
{
$member_banned = 0;
}
}
$save['wlog_mid'] = $this->warn_member['member_id'];
$save['wlog_addedby'] = $this->memberData['member_id'];
//-----------------------------------------
// Enter into warn loggy poos (eeew - poo)
//-----------------------------------------
$this->DB->insert( 'warn_logs', $save );
//-----------------------------------------
// Update member
//-----------------------------------------
if( $this->request['level'] != 'nochange' )
{
if ( $this->request['level'] == 'custom' )
{
$warn_level = $level_custom;
}
else if ( $this->request['level'] == 'add' )
{
$warn_level++;
}
else
{
$warn_level--;
}
if ( $warn_level > $this->settings['warn_max'] )
{
$warn_level = $this->settings['warn_max'];
}
if ( $warn_level < intval($this->settings['warn_min']) )
{
$warn_level = intval($this->settings['warn_min']);
}
}
IPSMember::save( $this->warn_member['member_id'], array( 'core' => array( 'mod_posts' => $mod_queue,
'restrict_post' => $restrict_post,
'temp_ban' => $susp,
'member_banned' => $member_banned,
'warn_level' => $warn_level,
'warn_lastwarn' => time() ) ) );
//-----------------------------------------
// Now what? Show success screen, that's what!!
//-----------------------------------------
$this->lang->words['w_done_te'] = sprintf( $this->lang->words['w_done_te'], $this->warn_member['members_display_name'] );
$tid = intval($this->request['t']);
$topic = array();
if ( $tid > 0 )
{
$topic = $this->DB->buildAndFetch( array(
'select' => 't.tid, t.title, t.title_seo',
'from' => array( 'topics' => 't' ),
'where' => "t.tid={$tid}",
'add_join' => array( array(
'select' => 'f.id, f.name, f.name_seo',
'from' => array( 'forums' => 'f' ),
'where' => 'f.id=t.forum_id',
'type' => 'left'
) )
) );
}
$this->output .= $this->registry->getClass('output')->getTemplate('mod')->warn_success( $topic );
}
/**
* Show the add new warn form
*
* @access private
* @param mixed Empty | Error message language key
* @return void [Outputs to screen/redirects]
*/
private function _showForm( $errors="" )
{
if ( $this->type == 'member' )
{
$this->registry->output->showError( 'warn_member_notes', 10255 );
}
$this->warn_member['warn_level'] = intval($this->warn_member['warn_level']);
$this->request['contact'] = $this->request['contact'] ? IPSText::getTextClass( 'bbcode' )->preEditParse( $this->request['contact'] ) : '';
$this->output .= $this->registry->getClass('output')->getTemplate('mod')->warnForm( IPSMember::buildDisplayData( $this->warn_member, '__all__' ),
intval($this->request['t']),
intval($this->request['st']),
$errors ? $this->lang->words[$errors] : '',
$this->canModQueue,
$this->canRemovePostAbility,
$this->canSuspend,
IPSText::getTextClass( 'editor' )->showEditor( $this->request['contact'] ? $this->request['contact'] : '', 'contact' ) );
}
/**
* Checking method access
*
* @access private
* @return void [Displays error if appropriate]
*/
private function _checkAccess()
{
//-----------------------------------------
// Protected member? Really? o_O
//-----------------------------------------
if ( strstr( ',' . $this->settings['warn_protected'] . ',', ',' . $this->warn_member['member_group_id'] . ',' ) )
{
$this->registry->output->showError( 'warn_protected_member', 10256 );
}
//-----------------------------------------
// I've already warned you!!
//-----------------------------------------
if ( $this->restrictWarnsPerDay > 0 )
{
$time_to_check = time() - 86400;
$check = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as warn_times', 'from' => 'warn_logs', 'where' => "wlog_mid={$this->warn_member['member_id']} AND wlog_date > $time_to_check" ) );
if ( $check['warn_times'] >= $this->restrictWarnsPerDay )
{
$this->registry->output->showError( 'warned_already', 10257 );
}
}
}
}
@@ -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,18 @@
<?php
/*
* Returns known settings
*
* No, really it does!
*
* Remember: ipsRegistry::$settings probably won't be available.
*
*
* IPSSetUp::getSavedData('admin_email')
* IPSSetUp::getSavedData('install_dir') [Example: /home/user/public_html/forums] - No trailing slash supplied
* IPSSetUp::getSavedData('install_url') [Example: http://www.domain.tld/forums] - No trailing slash supplied
*/
$knownSettings = array(
'report_mod_group_access' => '4,6,8',
);
@@ -0,0 +1,8 @@
<?php
/**
* Installation Schematic File
* Generated on Thu, 19 Feb 2009 08:15:49 +0000 GMT
*/
$INDEX[] = "ALTER TABLE message_posts ADD FULLTEXT KEY msg_post (msg_post)";
$INDEX[] = "ALTER TABLE message_topics ADD FULLTEXT KEY mt_title (mt_title)";
?>
@@ -0,0 +1,60 @@
<?php
/**
* Installation Schematic File
* Generated on Thu, 19 Feb 2009 08:15:47 +0000 GMT
*/
$TABLE[] = "CREATE TABLE message_posts (
msg_id int(10) NOT NULL auto_increment,
msg_topic_id int(10) NOT NULL default '0',
msg_date int(10) default NULL,
msg_post text,
msg_post_key varchar(32) NOT NULL default '0',
msg_author_id mediumint(8) NOT NULL default '0',
msg_ip_address varchar(16) NOT NULL default '0',
msg_is_first_post int(1) NOT NULL default '0',
PRIMARY KEY (msg_id),
KEY msg_topic_id (msg_topic_id),
KEY msg_date (msg_date),
KEY msg_ip_address (msg_ip_address)
);";
$TABLE[] = "CREATE TABLE message_topic_user_map (
map_id int(10) NOT NULL auto_increment,
map_user_id int(10) NOT NULL default '0',
map_topic_id int(10) NOT NULL default '0',
map_folder_id varchar(32) NOT NULL default '',
map_read_time int(10) NOT NULL default '0',
map_user_active int(1) NOT NULL default '0',
map_user_banned int(1) NOT NULL default '0',
map_has_unread int(1) NOT NULL default '0',
map_is_system int(1) NOT NULL default '0',
map_is_starter int(1) NOT NULL default '0',
map_left_time int(10) NOT NULL default '0',
map_ignore_notification int(1) NOT NULL default '0',
map_last_topic_reply INT(10) NOT NULL default '0',
PRIMARY KEY map_id (map_id),
UNIQUE KEY map_main (map_user_id,map_topic_id),
KEY map_user (map_user_id,map_folder_id),
KEY map_topic_id (map_topic_id)
);";
$TABLE[] = "CREATE TABLE message_topics (
mt_id int(10) NOT NULL auto_increment,
mt_date int(10) NOT NULL default '0',
mt_title varchar(255) NOT NULL default '',
mt_hasattach smallint(5) NOT NULL default '0',
mt_starter_id int(10) NOT NULL default '0',
mt_start_time int(10) NOT NULL default '0',
mt_last_post_time int(10) NOT NULL default '0',
mt_invited_members text,
mt_to_count int(3) NOT NULL default '0',
mt_to_member_id int(10) NOT NULL default '0',
mt_replies int(10) NOT NULL default '0',
mt_last_msg_id int(10) NOT NULL default '0',
mt_first_msg_id int(10) NOT NULL default '0',
mt_is_draft int(1) NOT NULL default '0',
mt_is_deleted int(1) NOT NULL default '0',
mt_is_system int(1) NOT NULL default '0',
PRIMARY KEY (mt_id),
KEY mt_date (mt_date),
KEY mt_starter_id (mt_starter_id)
);";
?>
@@ -0,0 +1,182 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* ACP ban filters skin file
* Last Updated: $Date: 2009-09-24 16:56:42 -0400 (Thu, 24 Sep 2009) $
*
* @author $Author: rikki $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @subpackage Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Rev: 5154 $
*
*/
class cp_skin_banfilters extends output
{
/**
* Prevent our main destructor being called by this class
*
* @access public
* @return void
*/
public function __destruct()
{
}
/**
* Ban filter overview screen
*
* @access public
* @param array IPs
* @param array Emails
* @param array Usernames
* @return string HTML
*/
public function banOverview( $ips, $emails, $names ) {
$IPBHTML = "";
//--starthtml--//
$IPBHTML .= <<<HTML
<div class='section_title'>
<h2>{$this->lang->words['ban_title']}</h2>
</div>
<form method='post' action='{$this->settings['base_url']}{$this->form_code}&amp;do=ban_add'>
<input type='hidden' name='_admin_auth_key' value='{$this->registry->adminFunctions->_admin_auth_key}' />
<input type='text' size='30' class='input_text' value='' name='bantext' />
<select class='input_select' name='bantype' style='vertical-align:middle;'>
<option value='ip'>{$this->lang->words['ban_ip']}</option>
<option value='email'>{$this->lang->words['ban_email']}</option>
<option value='name'>{$this->lang->words['ban_name']}</option>
</select>
<input type='submit' value='{$this->lang->words['ban_addnew']}' class='button primary' />
</form>
<div class='acp-box' style='margin-top: 4px;'>
<h3>{$this->lang->words['ban_bancontrol']}</h3>
<form method='post' id='ban-delete' action='{$this->settings['base_url']}{$this->form_code}&amp;do=ban_delete'>
<input type='hidden' name='_admin_auth_key' value='{$this->registry->adminFunctions->_admin_auth_key}' />
<table width='100%' class='alternate_rows double_pad'>
<tr>
<th colspan='3'>{$this->lang->words['ban_ips']}</th>
</tr>
HTML;
if( is_array( $ips ) && count( $ips ) )
{
foreach( $ips as $r )
{
$IPBHTML .= <<<HTML
<tr>
<td width='1%'>{$r['_checkbox']}</td>
<td width='80%'>{$r['ban_content']}</td>
<td width='20%'>{$r['_date']}</td>
</tr>
HTML;
}
}
else
{
$IPBHTML .= <<<HTML
<tr>
<td colspan='3'>{$this->lang->words['ban_ips_none']}</td>
</tr>
HTML;
}
$IPBHTML .= <<<HTML
<tr>
<th colspan='3'>{$this->lang->words['ban_emails']}</th>
</tr>
HTML;
if( is_array( $emails ) && count( $emails ) )
{
foreach( $emails as $r )
{
$IPBHTML .= <<<HTML
<tr>
<td width='1%'>{$r['_checkbox']}</td>
<td width='80%'>{$r['ban_content']}</td>
<td width='20%'>{$r['_date']}</td>
</tr>
HTML;
}
}
else
{
$IPBHTML .= <<<HTML
<tr>
<td colspan='3'>{$this->lang->words['ban_emails_none']}</td>
</tr>
HTML;
}
$IPBHTML .= <<<HTML
<tr>
<th colspan='3'>{$this->lang->words['ban_names']}</th>
</tr>
HTML;
if( is_array( $names ) && count( $names ) )
{
foreach( $names as $r )
{
$IPBHTML .= <<<HTML
<tr>
<td width='1%'>{$r['_checkbox']}</td>
<td width='80%'>{$r['ban_content']}</td>
<td width='20%'>{$r['_date']}</td>
</tr>
HTML;
}
}
else
{
$IPBHTML .= <<<HTML
<tr>
<td colspan='3'>{$this->lang->words['ban_names_none']}</td>
</tr>
HTML;
}
$IPBHTML .= <<<HTML
</tr>
</table>
<div class='acp-actionbar'>
<input type='submit' value='{$this->lang->words['ban_deletebutton']}' class='realbutton redbutton' />
</div>
</form>
</div>
<script type='text/javascript'>
$('ban-delete').observe( 'submit', function( e ){
var checkboxes = $('ban-delete').getElementsByTagName( 'input' );
for( var i = 0; i < checkboxes.length; i++ )
{
if( checkboxes[i].checked )
{
return true;
}
}
alert( '{$this->lang->words['no_ban_to_delete']}' );
Event.stop( e );
});
</script>
HTML;
//--endhtml--//
return $IPBHTML;
}
}
@@ -0,0 +1,530 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* ACP bulk mail skin file
* Last Updated: $Date: 2009-09-22 11:55:32 -0400 (Tue, 22 Sep 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 Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Rev: 5139 $
*
*/
class cp_skin_bulkmail extends output
{
/**
* Prevent our main destructor being called by this class
*
* @access public
* @return void
*/
public function __destruct()
{
}
/**
* Bulk mail start
*
* @access public
* @param array Mail data
* @param int Number of members to send this to
* @return string HTML
*/
public function mailSendStart( $mail, $count=0 ) {
$countmembers = sprintf($this->lang->words['b_countmember'], $count );
$IPBHTML = "";
//--starthtml--//
$IPBHTML .= <<<HTML
<div class='section_title'>
<h2>{$this->lang->words['b_title']}</h2>
</div>
<form name='theAdminForm' id='adminform' action='{$this->settings['base_url']}&amp;{$this->form_code}&amp;do=mail_send_complete' method='post'>
<input type='hidden' name='id' value='{$mail['mail_id']}' />
<input type='hidden' name='_admin_auth_key' value='{$this->registry->getClass('adminFunctions')->_admin_auth_key}' />
<div class='acp-box'>
<h3>{$countmembers}</h3>
<table class='form_table double_pad alternate_rows' cellspacing='0' cellpadding='0'>
<tr>
<th colspan='2'>{$this->lang->words['b_maildetails']}</th>
</tr>
<tr>
<td style='width: 40%;'>
<label>{$this->lang->words['b_subject']}</label>
</td>
<td style='width: 60%'>
{$mail['mail_subject']}
</td>
</tr>
<tr>
<td colspan='2'>
<label>{$this->lang->words['b_content']}</label>
<br />
<div style='margin-top: 10px; margin-left: 15px;'>
<iframe width='100%' height='200px' scrollbars='auto' src='{$this->settings['base_url']}&amp;{$this->form_code}&amp;do=mail_preview_do&amp;id={$mail['mail_id']}'></iframe>
</div>
</td>
</tr>
<tr>
<th colspan='2'>{$this->lang->words['b_sending']}</th>
</tr>
<tr>
<td colspan='2'>
{$this->lang->words['b_sending_info']}
</td>
</tr>
</table>
</div>
<div class='acp-actionbar'>
{$this->lang->words['b_percycle']} <input type='text' class='realbutton' size='5' name='pergo' value='20' /> &nbsp; <input type='submit' value='{$this->lang->words['b_mailbutton']}' class='realbutton' />
</div>
</form>
HTML;
//--endhtml--//
return $IPBHTML;
}
/**
* Bulk mail form
*
* @access public
* @param string Type (add|edit)
* @param array Mail data
* @param string Mail content
* @return string HTML
*/
public function mailForm( $type, $mail, $mail_content ) {
$dd_ltmt = array(
0 => array( 'lt' , $this->lang->words['b_lessthan'] ),
1 => array( 'mt' , $this->lang->words['b_morethan'] )
);
if ( $type == 'add' )
{
$title = $this->lang->words['b_step1'];
$button = $this->lang->words['b_proceed'];
$honour_checked = 1;
$html_checked = 0;
}
else
{
$title = $this->lang->words['b_editstored'];
$button = $this->lang->words['b_edit'];
//-----------------------------------------
// Unpack more..
//-----------------------------------------
$tmp = unserialize( stripslashes( $mail['mail_opts'] ) );
if ( is_array( $tmp ) and count ( $tmp ) )
{
foreach( $tmp as $k => $v )
{
if ( ! $mail[ $k ] )
{
$mail[ $k ] = $v;
}
}
}
$honour_checked = 1; // We no longer support not honoring $mail['mail_honor'];
$html_checked = $mail['mail_html_on'];
}
$form = array();
$form['groups'] = '';
$form['mail_subject'] = $this->registry->output->formInput( 'mail_subject', htmlspecialchars( IPSText::stripslashes( $_POST['mail_subject'] ? $_POST['mail_subject'] : $mail['mail_subject'] ), ENT_QUOTES ) );
$form['mail_content'] = $this->registry->output->formTextarea( 'mail_content', $mail_content, 60, 14, '', '', "' style='width: 100%'" ); // Hacky CSS thing, but eh
$form['mail_honor'] = $this->registry->output->formCheckbox( 'mail_honor', $honour_checked );
$form['mail_html'] = $this->registry->output->formCheckbox( 'mail_html_on', $html_checked );
$form['mail_post_ltmt'] = $this->registry->output->formDropdown( 'mail_post_ltmt', $dd_ltmt, $_POST['mail_post_ltml'] ? $_POST['mail_post_ltml'] : $mail['mail_post_ltmt'] );
$form['mail_filter_post'] = $this->registry->output->formSimpleInput( "mail_filter_post", $_POST['mail_filter_post'] ? $_POST['mail_filter_post'] : $mail['mail_filter_post'], 7 );
$form['mail_visit_ltmt'] = $this->registry->output->formDropdown( 'mail_visit_ltmt', $dd_ltmt, $_POST['mail_visit_ltml'] ? $_POST['mail_visit_ltml'] : $mail['mail_visit_ltmt'] );
$form['mail_filter_visit'] = $this->registry->output->formSimpleInput( "mail_filter_visit", $_POST['mail_filter_visit'] ? $_POST['mail_filter_visit'] : $mail['mail_filter_visit'], 7 );
$form['mail_joined_ltmt'] = $this->registry->output->formDropdown( 'mail_joined_ltmt', $dd_ltmt, $_POST['mail_joined_ltml'] ? $_POST['mail_joined_ltml'] : $mail['mail_joined_ltmt'] );
$form['mail_filter_joined'] = $this->registry->output->formSimpleInput( "mail_filter_joined", $_POST['mail_filter_joined'] ? $_POST['mail_filter_joined'] : $mail['mail_filter_joined'], 7 );
foreach( $this->cache->getCache('group_cache') as $g )
{
if ( $g['g_id'] == $this->settings['guest_group'] )
{
continue;
}
$checked = 0;
if ( $mail['mail_groups'] )
{
if ( strstr( ',' . $mail['mail_groups'] . ',', ',' . $g['g_id'] . ',' ) )
{
$checked = 1;
}
}
$form['groups'] .= $this->registry->output->formCheckbox( 'sg_' . $g['g_id'], $checked ) . "&nbsp;&nbsp;<b>{$g['g_title']}</b><br />";
}
$IPBHTML = "";
//--starthtml--//
$IPBHTML .= <<<HTML
<div class='section_title'>
<h2>{$this->lang->words['b_title']}</h2>
</div>
<script type='text/javascript'>
function runpreview()
{
thisval = document.theAdminForm.mail_content.value;
if( document.theAdminForm.mail_html_on.checked == true )
{
thatval = 1;
}
else
{
thatval = 0;
}
myUrl = '{$this->settings['base_url']}{$this->form_code_js}&do=mail_preview';
myUrl = myUrl.replace( /&amp;/g, '&' );
myWin = window.open( myUrl,'newWin','width=500,height=500,resizable=yes,scrollbars=yes');
}
</script>
<form name='theAdminForm' id='adminform' action='{$this->settings['base_url']}&amp;{$this->form_code}&amp;do=mail_save' method='post'>
<input type='hidden' name='id' value='{$mail['mail_id']}' />
<input type='hidden' name='type' value='{$type}' />
<input type='hidden' name='_admin_auth_key' value='{$this->registry->getClass('adminFunctions')->_admin_auth_key}' />
<div class='acp-box'>
<h3>{$title}</h3>
<table class='form_table double_pad alternate_rows' cellspacing='0' cellpadding='0'>
<tr>
<th colspan='2'>{$this->lang->words['b_step1_title']}</th>
</tr>
<tr>
<td style='width: 40%;'>
<label>{$this->lang->words['b_subject']}</label>
</td>
<td style='width: 60%'>
{$form['mail_subject']}
</td>
</tr>
<tr>
<td colspan='2'>
<label>{$this->lang->words['b_content']}</label>
<br />
<div style='margin-top: 10px; margin-left: 15px;'>{$form['mail_content']}</div>
</td>
</tr>
<tr>
<td>
<label>{$this->lang->words['b_html']}</label>
</td>
<td>
{$form['mail_html']}&nbsp;
</td>
</tr>
</table>
</div>
<br />
<div class='acp-box'>
<h3>{$this->lang->words['b_step2']}</h3>
<div style='width: 100%;'>
<table class='form_table double_pad alternate_rows' cellspacing='0' cellpadding='0'>
<tr>
<th colspan='2'>{$this->lang->words['b_addfilters']}</th>
<th>{$this->lang->words['b_groups']}</th>
</tr>
<tr>
<td style='width: 40%;'>
<label>{$this->lang->words['b_nposts']}</label><br />
<span class='desctext'>{$this->lang->words['b_leaveblank']}</span>
</td>
<td style='width: 40%'>
{$form['mail_post_ltmt']} {$form['mail_filter_post']}
</td>
<td style='width: 20%;' rowspan='3'>
{$form['groups']}
</td>
</tr>
<tr>
<td>
<label>{$this->lang->words['b_ndays']}</label><br />
<span class='desctext'>{$this->lang->words['b_leaveblank']}</span>
</td>
<td>
{$form['mail_visit_ltmt']} {$form['mail_filter_visit']}
</td>
</tr>
<tr>
<td>
<label>{$this->lang->words['b_njoined']}</label><br />
<span class='desctext'>{$this->lang->words['b_leaveblank']}</span>
</td>
<td>
{$form['mail_joined_ltmt']} {$form['mail_filter_joined']}
</td>
</tr>
</table>
</div>
</div>
<br />
<div class='acp-actionbar'>
<input class='realbutton' onclick='runpreview()' type='button' value='{$this->lang->words['b_preview']}' /> &nbsp; &nbsp; <input class='realbutton' type='submit' value='{$button}' />
</div>
<br />
<div class='information-box'>
<h4>{$this->lang->words['b_qtag']}</h4>
{$this->lang->words['b_qtag_info']}
<br /><br />
<table cellpadding='2' width='100%' cellspacing='0' border='0'>
<tr>
<td><strong>{board_name}</strong></td>
<td>{$this->lang->words['b_qbname']}</td>
<td><strong>{board_url}</strong></td>
<td>{$this->lang->words['b_qboardurl']}</td>
</tr>
<tr>
<td><strong>{reg_total}</strong></td>
<td>{$this->lang->words['b_qmtotal']}</td>
<td><strong>{total_posts}</strong></td>
<td>{$this->lang->words['b_qptotal']}</td>
</tr>
<tr>
<td><strong>{busy_count}</strong></td>
<td>{$this->lang->words['b_qonline']}</td>
<td><strong>{busy_time}</strong></td>
<td>{$this->lang->words['b_qonlinetime']}</td>
</tr>
<tr>
<td><strong>{member_id}</strong></td>
<td>{$this->lang->words['b_qid']}</td>
<td><strong>{member_name}</strong></td>
<td>{$this->lang->words['b_qmname']}</td>
</tr>
<tr>
<td><strong>{member_joined}</strong></td>
<td>{$this->lang->words['b_qjoin']}</td>
<td><strong>{member_posts}</strong></td>
<td>{$this->lang->words['b_qposts']}</td>
</tr>
</table>
</div>
</form>
HTML;
//--endhtml--//
return $IPBHTML;
}
/**
* HTML to show inside preview iframe
*
* @access public
* @param string Content
* @return string HTML
*/
public function mailIframeContent( $content ) {
$IPBHTML = "";
//--starthtml--//
$IPBHTML .= <<<HTML
<html>
<body>
<div style='padding:6px;text-align:left;font-family:courier, monospace;font-size:12px'>
{$content}
</div>
</body>
</html>
HTML;
//--endhtml--//
return $IPBHTML;
}
/**
* HTML to show in popup
*
* @access public
* @return string HTML
*/
public function mailPopupContent() {
$IPBHTML = "";
//--starthtml--//
$IPBHTML .= <<<HTML
<html>
<body onload='doitdude()'>
<script type='text/javascript'>
posty = opener.thisval;
pisty = opener.thatval;
function doitdude()
{
document.peekaboo.action = '{$this->settings['base_url']}&{$this->form_code_js}&do=mail_preview_do';
document.peekaboo.action = document.peekaboo.action.replace( /&amp;/, '&' );
document.peekaboo.text.value = posty;
document.peekaboo.html.value = pisty;
document.peekaboo.submit();
}
</script>
<form name='peekaboo' method='post'>
<input type='hidden' name='text' />
<input type='hidden' name='html' />
</form>
</body>
</html>
HTML;
//--endhtml--//
return $IPBHTML;
}
/**
* Saved bulk mails overview
*
* @access public
* @param string Content
* @return string HTML
*/
public function mailOverviewWrapper( $content, $pages ) {
$IPBHTML = "";
//--starthtml--//
$IPBHTML .= <<<HTML
<div class='section_title'>
<h2>{$this->lang->words['b_title']}</h2>
<ul class='context_menu'>
<li><a href='{$this->settings['base_url']}{$this->form_code}&amp;do=mail_new'><img src='{$this->settings['skin_acp_url']}/_newimages/icons/add.png' alt='' /> {$this->lang->words['b_create']}</a></li>
</ul>
</div>
<div class='acp-box'>
<h3>{$this->lang->words['b_stored']}</h3>
<table class='alternate_rows' width='100%'>
<tr>
<th width='1%'>&nbsp;</th>
<th width='30%'>{$this->lang->words['b_lsubject']}</th>
<th width='15%'>{$this->lang->words['b_lsenton']}</th>
<th width='15%'>{$this->lang->words['b_lsentto']}</th>
<th width='15%'>{$this->lang->words['b_ltime']}</th>
<th width='1%'>&nbsp;</th>
</tr>
HTML;
if( $content )
{
$IPBHTML .= <<<HTML
{$content}
HTML;
}
else
{
$IPBHTML .= <<<HTML
<tr>
<td colspan='6' class='no_items'>{$this->lang->words['b_nobulk']}</td>
</tr>
HTML;
}
$IPBHTML .= <<<HTML
</table>
<div class='acp-actionbar'>
<div class="leftaction">{$pages}</div>
</div>
</div>
HTML;
//--endhtml--//
return $IPBHTML;
}
/**
* Bulk mail row
*
* @access public
* @param array Mail data
* @return string HTML
*/
public function mailOverviewRow( $r ) {
$IPBHTML = "";
//--starthtml--//
$inprogress = "";
$time_taken = "";
if ( $r['mail_updated'] == $r['mail_start'] )
{
$time_taken = $this->lang->words['b_notyet'];
}
else
{
$time_taken = intval($r['mail_updated'] - $r['mail_start']);
if ( $time_taken < 0 )
{
$time_taken = 0;
}
if ( $time_taken )
{
$time_taken = ceil( $time_taken / 60 );
}
$time_taken .= $this->lang->words['b_minutes'];
}
if ( $r['mail_active'] )
{
$inprogress = " <em>( {$this->lang->words['b_inprogress']} - <a href='#' class='cancel' onclick=\"acp.confirmDelete('{$this->settings['base_url']}&{$this->form_code_js}&do=mail_send_cancel', '{$this->lang->words['b_cancelconfirm']}'); return false;\">{$this->lang->words['b_cancel']}</a> )</em>";
}
$IPBHTML .= <<<HTML
<tr>
<td><img src='{$this->settings['skin_acp_url']}/_newimages/icons/email.png' /></td>
<td><b>{$r['mail_subject']}</b> {$inprogress}</td>
<td>{$r['_mail_start']}</td>
<td>{$r['_mail_sentto']}</td>
<td>{$time_taken}</td>
<td>
<img id='mid-{$r['mail_id']}' src='{$this->settings['skin_acp_url']}/_newimages/menu_open.png' border='0' alt='{$this->lang->words['b_options']}' class='ipbmenu' />
<ul class='acp-menu' id='mid-{$r['mail_id']}_menucontent'>
<li class='icon info'><a href='{$this->settings['base_url']}&{$this->form_code}&do=mail_send_start&id={$r['mail_id']}'>{$this->lang->words['b_resenddot']}</a></li>
<li class='icon edit'><a href='{$this->settings['base_url']}&{$this->form_code}&do=mail_edit&id={$r['mail_id']}'>{$this->lang->words['b_editdot']}</a></li>
<li class='icon delete'><a href='#' onclick='return acp.confirmDelete("{$this->settings['base_url']}&{$this->form_code}&do=mail_delete&id={$r['mail_id']}");'>{$this->lang->words['b_deletedot']}</a></li>
</ul>
</td>
</tr>
HTML;
//--endhtml--//
return $IPBHTML;
}
}
@@ -0,0 +1,936 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* ACP groups skin file
* Last Updated: $Date: 2009-11-25 05:46:35 -0500 (Wed, 25 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 Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Rev: 5468 $
*
*/
class cp_skin_groups extends output
{
/**
* Prevent our main destructor being called by this class
*
* @access public
* @return void
*/
public function __destruct()
{
}
/**
* Should this admin group get ACP restrictions?
*
* @access public
* @return string HTML
*/
public function groupAdminConfirm( $group_id ) {
$IPBHTML = "";
//--starthtml--//
$IPBHTML .= <<<HTML
<!--SKINNOTE: Not yet skinned-->
<div class='tableborder'>
<div class='tableheaderalt'>{$this->lang->words['sm_configrest']}</div>
<div class='tablerow1'>
{$this->lang->words['sm_detectacp']}
<br /><br />
{$this->lang->words['sm_setrestrict']}
</div>
<div class='tablesubheader' align='center'>
<span class='fauxbutton'><a href='{$this->settings['base_url']}&amp;{$this->form_code}'>{$this->lang->words['sm_nothanks']}</a></span>&nbsp;&nbsp;
<span class='fauxbutton'><a href='{$this->settings['base_url']}&amp;module=restrictions&amp;section=restrictions&amp;do=acpperms-group-add-complete&amp;entered_group={$group_id}'>{$this->lang->words['sm_yesplease']}</a></span>
</div>
</div>
<br />
HTML;
//--endhtml--//
return $IPBHTML;
}
/**
* Group form
*
* @access public
* @param string Type (add|edit)
* @param array Group data
* @param array Permission masks
* @param array Extra tabs
* @return string HTML
*/
public function groupsForm( $type, $group, $permission_masks, $content=array(), $firsttab='' ) {
//-----------------------------------------
// Format some of the data
//-----------------------------------------
list($group['g_promotion_id'], $group['g_promotion_posts']) = explode( '&', $group['g_promotion'] );
list($p_max, $p_width, $p_height) = explode( ":", $group['g_photo_max_vars'] );
list( $limit, $flood ) = explode( ":", $group['g_email_limit'] );
if ($group['g_promotion_posts'] < 1)
{
$group['g_promotion_posts'] = '';
}
if( $type == 'edit' AND $group['g_attach_max'] == 0 )
{
$group['g_attach_maxdis'] = $this->lang->words['g_unlimited'];
}
else if( $type == 'edit' AND $group['g_attach_max'] == -1 )
{
$group['g_attach_maxdis'] = $this->lang->words['g_disabled'];
}
else
{
$group['g_attach_maxdis'] = IPSLib::sizeFormat( $group['g_attach_max'] * 1024 );
}
if( $type == 'edit' AND $group['g_attach_per_post'] == 0 )
{
$group['g_attach_per_postdis'] = $this->lang->words['g_unlimited'];
}
else if( $type == 'edit' AND $group['g_attach_per_post'] == -1 )
{
$group['g_attach_per_postdis'] = $this->lang->words['g_disabled'];
}
else
{
$group['g_attach_per_postdis'] = IPSLib::sizeFormat( $group['g_attach_per_post'] * 1024 );
}
//-----------------------------------------
// Set some of the form variables
//-----------------------------------------
$form_code = $type == 'edit' ? 'doedit' : 'doadd';
$button = $type == 'edit' ? $this->lang->words['g_compedit'] : $this->lang->words['g_addgroup'];
$ini_max = @ini_get( 'upload_max_filesize' ) ? @ini_get( 'upload_max_filesize' ) : $this->lang->words['g_cannotobt'];
$guest_legend = $group['g_id'] == $this->settings['guest_group'] ? $this->lang->words['g_appguests'] : '';
$secure_key = ipsRegistry::getClass('adminFunctions')->getSecurityKey();
//-----------------------------------------
// Start off the form fields
//-----------------------------------------
$all_groups = array( 0 => array ( 'none', $this->lang->words['g_dontprom'] ) );
foreach( $this->cache->getCache('group_cache') as $group_data )
{
$all_groups[] = array( $group_data['g_id'], $group_data['g_title'] );
}
$gbw_unit_type = array(
0 => array( 0, $this->lang->words['g_dd_apprp'] ),
1 => array( 1, $this->lang->words['g_dd_days'] ) );
$form = array();
$form['g_title'] = $this->registry->output->formInput( "g_title", $group['g_title'], '', 32, 'text', '', '', 32 );
$form['permid'] = $this->registry->output->formMultiDropdown( "permid[]", $permission_masks, explode( ",", $group['g_perm_id'] ) );
$form['g_icon'] = $this->registry->output->formTextarea( "g_icon", htmlspecialchars( $group['g_icon'], ENT_QUOTES ) );
$form['prefix'] = $this->registry->output->formInput( "prefix", htmlspecialchars( $group['prefix'], ENT_QUOTES ) );
$form['suffix'] = $this->registry->output->formInput( "suffix", htmlspecialchars( $group['suffix'], ENT_QUOTES ) );
$form['g_hide_from_list'] = $this->registry->output->formYesNo( "g_hide_from_list", $group['g_hide_from_list'] );
$form['g_attach_max'] = $this->registry->output->formInput( "g_attach_max", $group['g_attach_max'] );
$form['g_attach_per_post'] = $this->registry->output->formInput( "g_attach_per_post", $group['g_attach_per_post'] );
$form['p_max'] = $this->registry->output->formInput( "p_max", $p_max );
$form['p_width'] = $this->registry->output->formSimpleInput( "p_width", $p_width, 3 );
$form['p_height'] = $this->registry->output->formSimpleInput( "p_height", $p_height, 3 );
$form['g_avatar_upload'] = $this->registry->output->formYesNo( "g_avatar_upload", $group['g_avatar_upload'] );
$form['g_can_msg_attach'] = $this->registry->output->formYesNo( "g_can_msg_attach", $group['g_can_msg_attach'] );
$form['g_view_board'] = $this->registry->output->formYesNo( "g_view_board", $group['g_view_board'] );
$form['g_access_offline'] = $this->registry->output->formYesNo( "g_access_offline", $group['g_access_offline'] );
$form['g_mem_info'] = $this->registry->output->formYesNo( "g_mem_info", $group['g_mem_info'] );
$form['g_can_add_friends'] = $this->registry->output->formYesNo( "g_can_add_friends", $group['g_can_add_friends'] );
$form['g_hide_online_list'] = $this->registry->output->formYesNo( "g_hide_online_list", $group['g_hide_online_list'] );
$form['g_use_search'] = $this->registry->output->formYesNo( "g_use_search", $group['g_use_search'] );
$form['g_search_flood'] = $this->registry->output->formInput( "g_search_flood", $group['g_search_flood'] );
$form['g_email_friend'] = $this->registry->output->formYesNo( "g_email_friend", $group['g_email_friend'] );
$form['join_limit'] = $this->registry->output->formSimpleInput( "join_limit", $limit, 2 );
$form['join_flood'] = $this->registry->output->formSimpleInput( "join_flood", $flood, 2 );
$form['g_edit_profile'] = $this->registry->output->formYesNo( "g_edit_profile", $group['g_edit_profile'] );
$form['g_use_pm'] = $this->registry->output->formYesNo( "g_use_pm", $group['g_use_pm'] );
$form['g_max_mass_pm'] = $this->registry->output->formInput( "g_max_mass_pm", $group['g_max_mass_pm'] );
$form['g_max_messages'] = $this->registry->output->formInput( "g_max_messages", $group['g_max_messages'] );
$form['g_pm_perday'] = $this->registry->output->formSimpleInput( "g_pm_perday", $group['g_pm_perday'], 4 );
$form['g_pm_flood_mins'] = $this->registry->output->formSimpleInput( "g_pm_flood_mins", $group['g_pm_flood_mins'], 3 );
$form['g_dohtml'] = $this->registry->output->formYesNo( "g_dohtml", $group['g_dohtml'] );
$form['g_bypass_badwords'] = $this->registry->output->formYesNo( "g_bypass_badwords", $group['g_bypass_badwords'] );
$form['g_dname_date'] = $this->registry->output->formSimpleInput( "g_dname_date", $group['g_dname_date'], 3 );
$form['g_dname_changes'] = $this->registry->output->formSimpleInput( "g_dname_changes", $group['g_dname_changes'], 3 );
$form['g_is_supmod'] = $this->registry->output->formYesNo( "g_is_supmod", $group['g_is_supmod'] );
$form['g_access_cp'] = $this->registry->output->formYesNo( "g_access_cp", $group['g_access_cp'] );
$form['g_promotion_id'] = $this->registry->output->formDropdown( "g_promotion_id", $all_groups, $group['g_promotion_id'] );
$form['g_promotion_posts'] = $this->registry->output->formSimpleInput( 'g_promotion_posts', $group['g_promotion_posts'] );
$form['g_new_perm_set'] = $this->registry->output->formInput( "g_new_perm_set", '' );
$form['g_rep_max_positive'] = $this->registry->output->formInput( "g_rep_max_positive", $group['g_rep_max_positive'] );
$form['g_rep_max_negative'] = $this->registry->output->formInput( "g_rep_max_negative", $group['g_rep_max_negative'] );
$sig_limits = explode( ':', $group['g_signature_limits'] );
$form['use_signatures'] = $this->registry->output->formYesNo( "use_signatures", $sig_limits[0] );
$form['max_images'] = $this->registry->output->formInput( "max_images", $sig_limits[1] );
$form['max_dims'] = $this->registry->output->formSimpleInput( "max_dims_x", $sig_limits[2] ) . ' x ' . $this->registry->output->formSimpleInput( "max_dims_y", $sig_limits[3] );
$form['max_urls'] = $this->registry->output->formInput( "max_urls", $sig_limits[4] );
$form['max_lines'] = $this->registry->output->formInput( "max_lines", $sig_limits[5] );
$form['g_displayname_unit'] = $this->registry->output->formSimpleInput( "g_displayname_unit", $group['g_displayname_unit'], 3 );
$form['gbw_displayname_unit_type'] = $this->registry->output->formDropdown( "gbw_displayname_unit_type", $gbw_unit_type, $group['gbw_displayname_unit_type'] );
$form['g_sig_unit'] = $this->registry->output->formSimpleInput( "g_sig_unit", $group['g_sig_unit'], 3 );
$form['gbw_sig_unit_type'] = $this->registry->output->formDropdown( "gbw_sig_unit_type", $gbw_unit_type, $group['gbw_sig_unit_type'] );
$form['gbw_promote_unit_type'] = $this->registry->output->formDropdown( "gbw_promote_unit_type", $gbw_unit_type, $group['gbw_promote_unit_type'] );
$form['gbw_no_status_update'] = $this->registry->output->formYesNo( "gbw_no_status_update", $group['gbw_no_status_update'] );
if( $type == 'edit' )
{
$title = $this->lang->words['g_editing'] . $group['g_title'];
}
else
{
$title = $this->lang->words['g_adding'];
}
$IPBHTML = "";
//--starthtml--//
$IPBHTML .= <<<HTML
<div class='section_title'>
<h2>{$title}</h2>
</div>
<script type='text/javascript' src='{$this->settings['js_app_url']}ipsEditGroup.js'></script>
<script type='text/javascript'>
HTML;
foreach( $permission_masks as $d )
{
$IPBHTML .= " perms_{$d[0]} = '{$d[1]}';\n";
}
$IPBHTML .= <<<HTML
</script>
<form action='{$this->settings['base_url']}&amp;{$this->form_code}&amp;do={$form_code}&amp;secure_key={$secure_key}' method='post' id='adform' name='adform' onsubmit='return checkform();'>
<input type='hidden' name='id' value='{$group['g_id']}' />
<ul id='tabstrip_group' class='tab_bar no_title'>
<li id='tabtab-GROUPS|1' class=''>{$this->lang->words['g_globalsett']}</li>
<li id='tabtab-GROUPS|2' class=''>{$this->lang->words['g_globalperm']}</li>
HTML;
// Got blocks from other apps?
$IPBHTML .= implode( "\n", $content['tabs'] );
$semaillimit = sprintf( $this->lang->words['g_semail_limit'], $form['join_limit'] );
$semailflood = sprintf( $this->lang->words['g_semail_flood'], $form['join_flood'] );
$pmlimit = sprintf( $this->lang->words['g_pm_limit'], $form['g_pm_perday'] );
$pmflood = sprintf( $this->lang->words['g_pm_flood'], $form['g_pm_flood_mins'] );
$_firstTab = ( $firsttab ) ? '\'GROUPS|' . $firsttab . "'" : "''";
$IPBHTML .= <<<HTML
</ul>
<script type="text/javascript">
//<![CDATA[
document.observe("dom:loaded",function()
{
ipbAcpTabStrips.first_on_load = $_firstTab;
ipbAcpTabStrips.register('tabstrip_group');
});
//]]>
</script>
<div class='acp-box'>
<div id='tabpane-GROUPS|1'>
<table width='100%' cellpadding='0' cellspacing='0' class='form_table alternate_rows double_pad'>
<tr>
<th colspan='2'>{$this->lang->words['gt_details']}</th>
</tr>
<tr>
<td style='width: 40%'>
<label>{$this->lang->words['g_gtitle']}</label>
</td>
<td style='width: 60%'>
{$form['g_title']}
</td>
</tr>
<tr>
<td>
<label>{$this->lang->words['g_gicon']}</label><br />
<span class='desctext'>{$this->lang->words['g_gicon_info']}</span>
</td>
<td>
{$form['g_icon']}
</td>
</tr>
<tr>
<td>
<label>{$this->lang->words['g_gformpre']}</label><br />
<span class='desctext'>{$this->lang->words['g_gformpre_info']}</span>
</td>
<td>
{$form['prefix']}
</td>
</tr>
<tr>
<td>
<label>{$this->lang->words['g_gformsuf']}</label><br />
<span class='desctext'>{$this->lang->words['g_gformsuf_info']}</span>
</td>
<td>
{$form['suffix']}
</td>
</tr>
<tr>
<th colspan='2'>{$this->lang->words['gt_permissions']}</th>
</tr>
<tr>
<td>
<label>{$this->lang->words['g_permset']}</label><br />
<span class='desctext'>{$this->lang->words['g_permset_info']}</span>
</td>
<td>
{$form['permid']}
</td>
</tr>
<tr>
<td>
<label>{$this->lang->words['g_newpermset']}</label><br />
<span class='desctext'>{$this->lang->words['g_newpermset_info']}</span>
</td>
<td>
{$form['g_new_perm_set']}
</td>
</tr>
<tr class='guest_legend'>
<td>
<label>{$this->lang->words['g_hide']}</label>
{$guest_legend}
</td>
<td>
{$form['g_hide_from_list']}
</td>
</tr>
<tr class='guest_legend'>
<td>
<label>{$this->lang->words['g_hide_online']}</label>
{$guest_legend}
</td>
<td>
{$form['g_hide_online_list']}
</td>
</tr>
<tr>
<th colspan='2'>{$this->lang->words['gt_display_name']}</th>
</tr>
<tr>
<td>
<label>{$this->lang->words['g_dmax']}</label><br />
<span class='desctext'>{$this->lang->words['g_dmax_info']}</span>
</td>
<td>
<p>{$form['g_dname_changes']} &nbsp; {$this->lang->words['g_when']} {$form['g_displayname_unit']} {$form['gbw_displayname_unit_type']}</p>
<p style='color:gray;font-size:0.8em'>{$this->lang->words['g_limit_dd']}</p>
</td>
</tr>
<tr>
<td>
<label>{$this->lang->words['g_dlimit']}</label><br />
<span class='desctext'>{$this->lang->words['g_dlimit_info']}</span>
</td>
<td>
{$form['g_dname_date']}
</td>
</tr>
<tr class='guest_legend'>
<th colspan='2'>{$this->lang->words['gt_access_control']}</th>
</tr>
<tr class='guest_legend'>
<td>
<label>{$this->lang->words['g_msup']}</label>
{$guest_legend}
</td>
<td>
{$form['g_is_supmod']}
</td>
</tr>
<tr class='guest_legend'>
<td>
<label>{$this->lang->words['g_macp']}</label>
{$guest_legend}
</td>
<td>
{$form['g_access_cp']}
</td>
</tr>
<tr class='guest_legend'>
<th colspan='2'>{$this->lang->words['gt_promotion']}</th>
</tr>
<tr class='guest_legend'>
<td>
<label>{$this->lang->words['g_mpromote']}</label><br />
{$guest_legend}
<span class='desctext'>{$this->registry->output->javascriptHelpLink('mg_promote')}</span>
</td>
<td>
HTML;
if( $group['g_access_cp'] )
{
$IPBHTML .= "{$this->lang->words['g_mpromote_no']}";
}
else
{
$promotegrouptxt = sprintf( $this->lang->words['g_mpromote_to'], $form['g_promotion_id'], $form['g_promotion_posts'], $form['gbw_promote_unit_type'] );
$IPBHTML .= "{$promotegrouptxt}";
}
$IPBHTML .= <<<HTML
</td>
</tr>
</table>
</div>
<div id='tabpane-GROUPS|2'>
<table class='form_table alternate_rows double_pad' cellspacing='0'>
<tr>
<th colspan='2'>{$this->lang->words['gt_access_permissions']}</th>
</tr>
<tr>
<td style='width: 40%'>
<label>{$this->lang->words['g_ssite']}</label>
</td>
<td style='width: 60%'>
{$form['g_view_board']}
</td>
</tr>
<tr>
<td>
<label>{$this->lang->words['g_soffline']}</label>
</td>
<td>
{$form['g_access_offline']}
</td>
</tr>
<tr>
<td>
<label>{$this->lang->words['g_sprofile']}</label>
</td>
<td>
{$form['g_mem_info']}
</td>
</tr>
<tr class='guest_legend'>
<td>
<label>{$this->lang->words['g_addfriends']}{$guest_legend}</label>
</td>
<td>
{$form['g_can_add_friends']}
</td>
</tr>
<tr class='guest_legend'>
<td>
<label>{$this->lang->words['g_editprofile']}</label>
{$guest_legend}
</td>
<td>
{$form['g_edit_profile']}
</td>
</tr>
<tr class='guest_legend'>
<td>
<label>{$this->lang->words['g_shtml']}</label><br />
{$guest_legend}
<span class='desctext'>{$this->registry->output->javascriptHelpLink('mg_dohtml')}</span>
</td>
<td>
{$form['g_dohtml']}
</td>
</tr>
<tr class='guest_legend'>
<td>
<label>{$this->lang->words['g_semail']}</label><br />
{$guest_legend}
<span class='desctext'>{$this->lang->words['g_semail_info']}</span>
</td>
<td>
{$form['g_email_friend']}
<br />{$semaillimit}
<br />{$semailflood}
</td>
</tr>
<tr class='guest_legend'>
<td>
<label>{$this->lang->words['g_uav']}</label>
{$guest_legend}
</td>
<td>
{$form['g_avatar_upload']}
</td>
</tr>
<tr class='guest_legend'>
<td>
<label>{$this->lang->words['g_sbadword']}</label>
{$guest_legend}
</td>
<td>
{$form['g_bypass_badwords']}
</td>
</tr>
<tr class='guest_legend'>
<td>
<label>{$this->lang->words['g_no_status']}</label>
{$guest_legend}
</td>
<td>
{$form['gbw_no_status_update']}
</td>
</tr>
<tr>
<th colspan='2'>{$this->lang->words['gt_search']}</th>
</tr>
<tr>
<td>
<label>{$this->lang->words['g_ssearch']}</label>
</td>
<td>
{$form['g_use_search']}
</td>
</tr>
<tr>
<td>
<label>{$this->lang->words['g_sflood']}</label><br />
<span class='desctext'>{$this->lang->words['g_sflood_info']}</span>
</td>
<td>
{$form['g_search_flood']}
</td>
</tr>
<tr class='guest_legend'>
<th colspan='2'>{$this->lang->words['gt_pms']}</th>
</tr>
<tr class='guest_legend'>
<td>
<label>{$this->lang->words['g_spm']}</label><br />
{$guest_legend}
<span class='desctext'>{$this->lang->words['g_spmperday_info']}</span>
</td>
<td>
{$form['g_use_pm']}
<br />{$pmlimit}
<br />{$pmflood}
</td>
</tr>
<tr class='guest_legend'>
<td>
<label>{$this->lang->words['g_spmmax']}</label><br />
{$guest_legend}
<span class='desctext'>{$this->lang->words['g_spmmax_info']}</span>
</td>
<td>
{$form['g_max_mass_pm']}
</td>
</tr>
<tr class='guest_legend'>
<td>
<label>{$this->lang->words['g_spmmaxstor']}</label>
{$guest_legend}
</td>
<td>
{$form['g_max_messages']}
</td>
</tr>
<tr class='guest_legend'>
<td>
<label>{$this->lang->words['g_upm']}</label>
{$guest_legend}
</td>
<td>
{$form['g_can_msg_attach']}
</td>
</tr>
<tr>
<th colspan='2'>{$this->lang->words['gt_reps']}</th>
</tr>
<tr>
<td>
<label>{$this->lang->words['g_repmaxpos']}</label><br />
<span class='desctext'>{$this->lang->words['g_repnum_info']}</span>
</td>
<td>
{$form['g_rep_max_positive']}
</td>
</tr>
<tr>
<td>
<label>{$this->lang->words['g_repmaxneg']}</label><br />
<span class='desctext'>{$this->lang->words['g_repnum_info']}</span>
</td>
<td>
{$form['g_rep_max_negative']}
</td>
</tr>
<tr>
<th colspan='2'>{$this->lang->words['gt_sigs']}</th>
</tr>
<tr>
<td>
<label>{$this->lang->words['g_usesigs']}</label>
</td>
<td>
<p>{$form['use_signatures']} &nbsp; {$this->lang->words['g_until']} {$form['g_sig_unit']} {$form['gbw_sig_unit_type']}</p>
<p style='color:gray;font-size:0.8em'>{$this->lang->words['g_limit_dd']}</p>
</td>
</tr>
<tr>
<td>
<label>{$this->lang->words['g_sigmaximages']}</label>
</td>
<td>
{$form['max_images']}
</td>
</tr>
<tr>
<td>
<label>{$this->lang->words['g_sigmaxdims']}</label>
</td>
<td>
{$form['max_dims']}
</td>
</tr>
<tr>
<td>
<label>{$this->lang->words['g_sigmaxurls']}</label>
</td>
<td>
{$form['max_urls']}
</td>
</tr>
<tr>
<td>
<label>{$this->lang->words['g_sigmaxtext']}</label>
</td>
<td>
{$form['max_lines']}
</td>
</tr>
<tr>
<th colspan='2'>{$this->lang->words['gt_uploads']}</th>
</tr>
<tr>
<td>
<label>{$this->lang->words['g_uglobal']}</label><br />
<span class='desctext'>{$this->registry->output->javascriptHelpLink('mg_upload')}<br />{$this->lang->words['g_uglobal_info']}</span>
</td>
<td>
{$form['g_attach_max']}
{$this->lang->words['g_inkb']} ({$this->lang->words['g_ucurrently']}{$group['g_attach_maxdis']})
<br />{$this->lang->words['g_usingle']}{$ini_max}
</td>
</tr>
<tr>
<td>
<label>{$this->lang->words['g_upost']}</label><br />
<span class='desctext'>{$this->registry->output->javascriptHelpLink('mg_upload')}<br />{$this->lang->words['g_upost_info']}</span>
</td>
<td>
{$form['g_attach_per_post']}
{$this->lang->words['g_inkb']} ({$this->lang->words['g_ucurrently']}{$group['g_attach_per_postdis']})
<br />{$this->lang->words['g_usingle']}{$ini_max}
</td>
</tr>
<tr class='guest_legend'>
<td>
<label>{$this->lang->words['g_upersonalpho']}</label><br />
{$guest_legend}
<span class='desc'>{$this->lang->words['g_upersonalpho_l']}</span>
</td>
<td>
{$form['p_max']}{$this->lang->words['g_inkb']}
<br />{$this->lang->words['g_upersonalpho_w']}{$form['p_width']} x {$this->lang->words['g_upersonalpho_h']}{$form['p_height']}
</td>
</tr>
</table>
</div>
HTML;
// Got blocks from other apps?
$IPBHTML .= implode( "\n", $content['area'] );
$IPBHTML .= <<<HTML
<div class='acp-actionbar'>
<input type='submit' value=' {$button} ' class='realbutton' />
</div>
</div>
</form>
<script type="text/javascript">
HTML;
if( $group['g_id'] == $this->settings['guest_group'] )
{
$IPBHTML .= "stripGuestLegend();";
}
$IPBHTML .= <<<HTML
</script>
HTML;
//--endhtml--//
return $IPBHTML;
}
/**
* Overview of groups
*
* @access public
* @param string Groups HTML
* @param array Groups
* @return string HTML
*/
public function groupsOverviewWrapper( $content, $g_array ) {
$new_dd = $this->registry->output->formDropdown( "id", $g_array, 3 );
$IPBHTML = "";
//--starthtml--//
$leSigh = ( $this->request['showSecondary'] ) ? ' class="closed"' : '';
$leBigh = ( $this->request['showSecondary'] ) ? 0 : 1;
$IPBHTML .= <<<HTML
<div class='section_title'>
<h2>{$this->lang->words['g_title']}</h2>
</div>
<div class='acp-box'>
<h3>{$this->lang->words['g_usergroupman']}</h3>
<table class='alternate_rows double_pad' width='100%'>
<tr>
<th width='1%'>&nbsp;</th>
<th width='30%'>{$this->lang->words['g_grouptitle']}</th>
<th width='15%' align='center' style='text-align:center'>{$this->lang->words['g_canaccessacp']}</th>
<th width='15%' align='center' style='text-align:center'>{$this->lang->words['g_issupermod']}</th>
<th width='10%' align='center' style='text-align:center'>{$this->lang->words['g_membercount']}</th>
<th width='1%'>&nbsp;</th>
</tr>
{$content}
</table>
</div>
<br />
<div class='section_title'>
<ul class='context_menu'>
<li{$leSigh}>
<a href='{$this->settings['base_url']}&amp;{$this->form_code}&amp;do=groups_overview&amp;showSecondary={$leBigh}'><img src='{$this->settings['skin_acp_url']}/_newimages/icons/cog.png' /> {$this->lang->words['g_calc_with_secondary']}</a>
</li>
</ul>
</div>
<br />
<form action='{$this->settings['base_url']}&amp;{$this->form_code}&amp;do=add' method='POST' >
<input type='hidden' name='_admin_auth_key' value='{$this->registry->getClass('adminFunctions')->_admin_auth_key}' />
<div class='acp-box'>
<h3>{$this->lang->words['g_createnew']}</h3>
<table cellpadding='4' cellspacing='0' width='100%'>
<tr>
<th width='40%'>{$this->lang->words['g_basenewon']}</th>
<th width='60%'>{$new_dd}</th>
</tr>
</table>
<div class='acp-actionbar'>
<div class='centeraction'>
<input type='submit' value='{$this->lang->words['g_createbutton']}' class='button primary' />
</div>
</div>
</div>
</form>
HTML;
if ( IN_DEV )
{
$IPBHTML .= "<br /><div><a href='{$this->settings['base_url']}&amp;{$this->form_code}&amp;do=master_xml_export'>Экспортировать XML</a></div>";
}
//--endhtml--//
return $IPBHTML;
}
/**
* Group row
*
* @access public
* @param array Group
* @return string HTML
*/
public function groupsOverviewRow( $r="" ) {
$IPBHTML = "";
//--starthtml--//
$r['_can_acp_img'] = $r['_can_acp'] ? 'accept.png' : 'cross.png';
$r['_can_supmod_img'] = $r['_can_supmod'] ? 'accept.png' : 'cross.png';
$r['_title'] = IPSLib::makeNameFormatted( $r['g_title'], $r['g_id'] );
$IPBHTML .= <<<HTML
<tr>
<td><img src='{$this->settings['skin_acp_url']}/_newimages/icons/group.png' border='0' /></td>
<td><a href='{$this->settings['base_url']}&amp;{$this->form_code}&amp;do=edit&amp;id={$r['g_id']}' style='font-weight:bold'>{$r['_title']}</a> <small>({$this->lang->words['g_id']}: {$r['g_id']})</small></td>
<td align='center'><img src='{$this->settings['skin_acp_url']}/_newimages/icons/{$r['_can_acp_img']}' border='0' alt='-' class='ipd' /></td>
<td align='center'><img src='{$this->settings['skin_acp_url']}/_newimages/icons/{$r['_can_supmod_img']}' border='0' alt='-' class='ipd' /></td>
<td align='center'>
HTML;
if ( $r['g_id'] != $this->settings['guest_group'] )
{
$IPBHTML .= <<<HTML
<a href='{$this->settings['_base_url']}app=members&amp;section=members&amp;module=members&amp;__update=1&amp;f_primary_group={$r['g_id']}' title='{$this->lang->words['g_listusers']}'>{$r['count']}</a>
HTML;
}
else
{
$IPBHTML .= <<<HTML
{$r['count']}
HTML;
}
$IPBHTML .= <<<HTML
</td>
<td align='right'>
<img id="menu{$r['g_id']}" src='{$this->settings['skin_acp_url']}/_newimages/menu_open.png' border='0' alt='{$this->lang->words['a_options']}' class='ipbmenu' />
<ul class='acp-menu' id='menu{$r['g_id']}_menucontent'>
<li class='icon edit'><a href='{$this->settings['base_url']}&amp;{$this->form_code}&amp;do=edit&amp;id={$r['g_id']}'>{$this->lang->words['g_editg']}</a></li>
HTML;
if ( ! in_array( $r['g_id'], array( $this->settings['auth_group'], $this->settings['guest_group'], $this->settings['member_group'] ) ) )
{
$IPBHTML .= <<<HTML
<li class='icon delete'><a href='#' onclick='return acp.confirmDelete("{$this->settings['base_url']}&amp;{$this->form_code}&amp;do=delete&amp;_admin_auth_key={$this->registry->getClass('adminFunctions')->_admin_auth_key}&amp;id={$r['g_id']}");'>{$this->lang->words['g_deleteg']}</a></li>
HTML;
}
else
{
$IPBHTML .= <<<HTML
<li class='icon delete'>{$this->lang->words['g_cannotdel']}</li>
HTML;
}
$IPBHTML .= <<<HTML
</ul>
</td>
</tr>
HTML;
//--endhtml--//
return $IPBHTML;
}
/**
* Delete group confirmation
*
* @access public
* @param array Group
* @param int Members with this group as primary group
* @param int Members with this group as secondary group
* @return string HTML
*/
public function groupDelete( $group, $primary=0, $secondary=0 ) {
$IPBHTML = "";
//--starthtml--//
//-----------------------------------------
// Grab group, and other groups
//-----------------------------------------
$mem_groups = array();
foreach( $this->caches['group_cache'] as $g_id => $r )
{
if( $g_id == $group['g_id'] )
{
continue;
}
$mem_groups[] = array( $r['g_id'], $r['g_title'] );
}
$dropDown = $this->registry->output->formDropdown( "to_id", $mem_groups, $this->settings['member_group'] );
$IPBHTML .= <<<HTML
<div class='section_title'>
<h2>{$this->lang->words['g_deleting']}</h2>
</div>
<div class='acp-box'>
<h3>{$this->lang->words['g_removeconf']}{$group['g_title']}</h3>
<form name='theAdminForm' id='adminform' action='{$this->settings['base_url']}&amp;{$this->form_code}&amp;do=dodelete' method='post'>
<input type='hidden' name='id' value='{$group['g_id']}' />
<input type='hidden' name='_admin_auth_key' value='{$this->registry->getClass('adminFunctions')->_admin_auth_key}' />
<table class='alternate_rows' width='100%'>
<tr>
<td width='40%'>{$this->lang->words['g_numusers']}</td>
<td width='60%'>
<a href='{$this->settings['_base_url']}&amp;app=members&amp;module=members&amp;section=members&amp;__update=1&amp;f_primary_group={$group['g_id']}'>{$primary}</a>
</td>
</tr>
<tr>
<td width='40%'>{$this->lang->words['g_numusers_sec']}</td>
<td width='60%'>
<a href='{$this->settings['_base_url']}&amp;app=members&amp;module=members&amp;section=members&amp;__update=1&amp;f_secondary_group={$group['g_id']}'>{$secondary}</a>
</td>
</tr>
<tr>
<td width='40%'>{$this->lang->words['g_moveusersto']}</td>
<td width='60%'>{$dropDown}</td>
</tr>
</table>
<div class='acp-actionbar'>
<div class='centeraction'>
<input type='submit' class='button primary' value=' {$this->lang->words['g_deletebutton']} ' />
</div>
</div>
</form>
</div>
HTML;
//--endhtml--//
return $IPBHTML;
}
}
Loaded 100 of 3755 files, more files were not shown because too many files have changed in this diff. Show more