Version 3.2.3
This commit is contained in:
1 parent
ae5c01cc78
commit
78706903a2
2641 files changed
+228363
-201264
No files matched your search
@@ -2,18 +2,18 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* IP.Board v3.2.3
|
||||
* Group management
|
||||
* Last Updated: $Date: 2010-10-23 08:40:34 -0400 (Sat, 23 Oct 2010) $
|
||||
* Last Updated: $Date: 2011-10-05 15:30:51 -0400 (Wed, 05 Oct 2011) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: ips_terabyte $
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @license This is NULLED!
|
||||
* @package IP.Board
|
||||
* @subpackage Members
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Revision: 7023 $
|
||||
* @link http://hatynka.in
|
||||
* @version $Revision: 9582 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
@@ -29,27 +29,27 @@ class admin_members_groups_groups extends ipsCommand
|
||||
*
|
||||
* @var object Skin templates
|
||||
*/
|
||||
private $html;
|
||||
protected $html;
|
||||
|
||||
/**
|
||||
* Shortcut for url
|
||||
*
|
||||
* @var string URL shortcut
|
||||
*/
|
||||
private $form_code;
|
||||
protected $form_code;
|
||||
|
||||
/**
|
||||
* Shortcut for url (javascript)
|
||||
*
|
||||
* @var string JS URL shortcut
|
||||
*/
|
||||
private $form_code_js;
|
||||
protected $form_code_js;
|
||||
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
* @return @e void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
@@ -129,9 +129,9 @@ class admin_members_groups_groups extends ipsCommand
|
||||
/**
|
||||
* List the groups
|
||||
*
|
||||
* @return void [Outputs to screen]
|
||||
* @return @e void [Outputs to screen]
|
||||
*/
|
||||
private function _mainScreen()
|
||||
protected function _mainScreen()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
@@ -141,13 +141,7 @@ class admin_members_groups_groups extends ipsCommand
|
||||
$content = "";
|
||||
$form = array();
|
||||
$rows = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Page details
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->extra_nav[] = array( $this->form_code, $this->lang->words['g_nav'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get groups
|
||||
//-----------------------------------------
|
||||
@@ -203,7 +197,7 @@ class admin_members_groups_groups extends ipsCommand
|
||||
/**
|
||||
* Exports the groups to a master XML file for distribution
|
||||
*
|
||||
* @return void [Outputs to screen]
|
||||
* @return @e void [Outputs to screen]
|
||||
*/
|
||||
public function masterXMLExport()
|
||||
{
|
||||
@@ -215,22 +209,17 @@ class admin_members_groups_groups extends ipsCommand
|
||||
$skip = IPSLib::fetchNonDefaultGroupFields();
|
||||
|
||||
//-----------------------------------------
|
||||
// Get XML class
|
||||
// Get xml class
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( IPS_KERNEL_PATH . 'class_xml.php' );
|
||||
|
||||
$xml = new class_xml();
|
||||
$xml->doc_type = IPS_DOC_CHAR_SET;
|
||||
require_once( IPS_KERNEL_PATH.'classXML.php' );/*noLibHook*/
|
||||
|
||||
$xml->xml_set_root( 'export', array( 'exported' => time() ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Set group
|
||||
//-----------------------------------------
|
||||
|
||||
$xml->xml_add_group( 'group' );
|
||||
$xml = new classXML( IPS_DOC_CHAR_SET );
|
||||
|
||||
$xml->newXMLDocument();
|
||||
$xml->addElement( 'export' );
|
||||
$xml->addElement( 'group', 'export' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Grab our default 6 groups
|
||||
//-----------------------------------------
|
||||
@@ -247,38 +236,31 @@ class admin_members_groups_groups extends ipsCommand
|
||||
$content = array();
|
||||
$r['g_icon'] = '';
|
||||
|
||||
//-----------------------------------------
|
||||
// Sort the fields...
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $r as $k => $v )
|
||||
if( is_array($skip) AND count($skip) )
|
||||
{
|
||||
if ( ! in_array( $k, $skip ) )
|
||||
foreach( $skip as $_kk )
|
||||
{
|
||||
$content[] = $xml->xml_build_simple_tag( $k, $v );
|
||||
unset( $r[ $_kk ] );
|
||||
}
|
||||
}
|
||||
|
||||
$entry[] = $xml->xml_build_entry( 'row', $content );
|
||||
$xml->addElementAsRecord( 'group', 'row', $r );
|
||||
}
|
||||
|
||||
$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 );
|
||||
$this->registry->output->showDownload( $xml->fetchDocument(), 'groups.xml', '', 0 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Form to delete a group
|
||||
*
|
||||
* @return void [Outputs to screen]
|
||||
* @return @e void [Outputs to screen]
|
||||
*/
|
||||
private function _deleteForm()
|
||||
protected function _deleteForm()
|
||||
{
|
||||
$group_id = intval($this->request['id']);
|
||||
$group = $this->caches['group_cache'][ $group_id ];
|
||||
@@ -314,9 +296,9 @@ class admin_members_groups_groups extends ipsCommand
|
||||
/**
|
||||
* Delete the group
|
||||
*
|
||||
* @return void [Outputs to screen]
|
||||
* @return @e void [Outputs to screen]
|
||||
*/
|
||||
private function _doDelete()
|
||||
protected function _doDelete()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
@@ -470,9 +452,9 @@ class admin_members_groups_groups extends ipsCommand
|
||||
* Save the group [add/edit]
|
||||
*
|
||||
* @param string 'add' or 'edit'
|
||||
* @return void [Outputs to screen]
|
||||
* @return @e void [Outputs to screen]
|
||||
*/
|
||||
private function _saveGroup( $type='edit' )
|
||||
protected function _saveGroup( $type='edit' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
@@ -576,9 +558,9 @@ class admin_members_groups_groups extends ipsCommand
|
||||
}
|
||||
}
|
||||
|
||||
$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'] );
|
||||
$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'],
|
||||
@@ -593,12 +575,10 @@ class admin_members_groups_groups extends ipsCommand
|
||||
// Set the db array
|
||||
//-----------------------------------------
|
||||
|
||||
$db_string = array(
|
||||
'g_view_board' => intval($this->request['g_view_board']),
|
||||
$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_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']),
|
||||
@@ -614,7 +594,6 @@ class admin_members_groups_groups extends ipsCommand
|
||||
'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']),
|
||||
@@ -622,7 +601,6 @@ class admin_members_groups_groups extends ipsCommand
|
||||
'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']),
|
||||
@@ -636,9 +614,8 @@ class admin_members_groups_groups extends ipsCommand
|
||||
'g_max_bgimg_upload' => intval( $this->request['g_max_bgimg_upload'] ),
|
||||
'g_bitoptions' => IPSBWOPtions::freeze( $this->request, 'groups', 'global' ), # Saves all BW options for all apps
|
||||
);
|
||||
|
||||
/* Leave here in case an application below needs to add a force_data_type */
|
||||
$this->DB->force_data_type = array( 'g_title' => 'string' );
|
||||
|
||||
$this->DB->setDataType( 'g_title', 'string' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Ok? Load interface and child classes
|
||||
@@ -646,21 +623,18 @@ class admin_members_groups_groups extends ipsCommand
|
||||
|
||||
IPSLib::loadInterface( 'admin/group_form.php' );
|
||||
|
||||
foreach( ipsRegistry::$applications as $app_dir => $app_data )
|
||||
$_groupPlugins = array();
|
||||
|
||||
foreach( IPSLib::getEnabledApplications() as $app_dir => $app_data )
|
||||
{
|
||||
if ( ! IPSLib::appIsInstalled( $app_dir ) )
|
||||
if ( is_file( IPSLib::getAppDir( $app_dir ) . '/extensions/admin/group_form.php' ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( file_exists( IPSLib::getAppDir( $app_dir ) . '/extensions/admin/group_form.php' ) )
|
||||
{
|
||||
$_class = IPSLib::loadLibrary( IPSLib::getAppDir( $app_dir ) . '/extensions/admin/group_form.php', 'admin_group_form__'.$app_dir, $app_dir );
|
||||
$_object = new $_class( $this->registry );
|
||||
$_class = IPSLib::loadLibrary( IPSLib::getAppDir( $app_dir ) . '/extensions/admin/group_form.php', 'admin_group_form__'.$app_dir, $app_dir );
|
||||
$_groupPlugins[ $_class ] = new $_class( $this->registry );
|
||||
|
||||
$remote = $_object->getForSave();
|
||||
$remote = $_groupPlugins[ $_class ]->getForSave();
|
||||
|
||||
$db_string = array_merge( $remote, $db_string );
|
||||
$db_string = array_merge( $db_string, $remote );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -668,7 +642,7 @@ class admin_members_groups_groups extends ipsCommand
|
||||
// Editing...do an update
|
||||
//-----------------------------------------
|
||||
|
||||
if ($type == 'edit')
|
||||
if ( $type == 'edit' )
|
||||
{
|
||||
$this->DB->update( 'groups', $db_string, 'g_id=' . $group_id );
|
||||
|
||||
@@ -678,6 +652,8 @@ class admin_members_groups_groups extends ipsCommand
|
||||
|
||||
$this->DB->update( 'moderators', array( 'group_name' => $db_string['g_title'] ), 'group_id=' . $group_id );
|
||||
|
||||
$this->cache->rebuildCache( 'moderators', 'forums' );
|
||||
|
||||
ipsRegistry::getClass('adminFunctions')->saveAdminLog( sprintf( $this->lang->words['g_editedlog'], $db_string['g_title'] ) );
|
||||
|
||||
$this->registry->output->global_message = $this->lang->words['g_edited'];
|
||||
@@ -695,6 +671,21 @@ class admin_members_groups_groups extends ipsCommand
|
||||
|
||||
$this->rebuildGroupCache();
|
||||
|
||||
//-----------------------------------------
|
||||
// Post save callbacks
|
||||
//-----------------------------------------
|
||||
|
||||
if( count($_groupPlugins) )
|
||||
{
|
||||
foreach( $_groupPlugins as $_className => $_object )
|
||||
{
|
||||
if( method_exists( $_object, 'postSave' ) )
|
||||
{
|
||||
$_object->postSave( $group_id );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( $new_perm_set_id )
|
||||
{
|
||||
$from = '';
|
||||
@@ -713,8 +704,8 @@ class admin_members_groups_groups extends ipsCommand
|
||||
}
|
||||
}
|
||||
|
||||
$this->registry->output->doneScreen( $this->lang->words['per_saved'], $this->lang->words['per_manage'], 'module=groups&section=permissions&do=edit_set_form' . $from . '&id=' . $new_perm_set_id, 'redirect' );
|
||||
return;
|
||||
$this->registry->output->global_message = $this->lang->words['per_saved'];
|
||||
$this->registry->output->silentRedirectWithMessage( $this->settings['base_url'] . 'module=groups&section=permissions&do=edit_set_form' . $from . '&id=' . $new_perm_set_id );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -739,7 +730,7 @@ class admin_members_groups_groups extends ipsCommand
|
||||
/**
|
||||
* Rebuilds the group cache
|
||||
*
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
public function rebuildGroupCache()
|
||||
{
|
||||
@@ -752,7 +743,7 @@ class admin_members_groups_groups extends ipsCommand
|
||||
|
||||
while ( $i = $this->DB->fetch() )
|
||||
{
|
||||
$cache[ $i['g_id'] ] = IPSLib::unpackGroup( $i );
|
||||
$cache[ $i['g_id'] ] = IPSMember::unpackGroup( $i );
|
||||
}
|
||||
|
||||
$this->cache->setCache( 'group_cache', $cache, array( 'array' => 1 ) );
|
||||
@@ -762,9 +753,10 @@ class admin_members_groups_groups extends ipsCommand
|
||||
* Show the add/edit group form
|
||||
*
|
||||
* @param string 'add' or 'edit'
|
||||
* @return void [Outputs to screen]
|
||||
* @return @e void [Outputs to screen]
|
||||
* @todo _initTab doesn't seem to work anymore with the new tabs, need to update each app to have a unique name/id
|
||||
*/
|
||||
private function _groupForm( $type='edit' )
|
||||
protected function _groupForm( $type='edit' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Grab group data and start us off
|
||||
@@ -778,7 +770,7 @@ class admin_members_groups_groups extends ipsCommand
|
||||
}
|
||||
|
||||
$group = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'groups', 'where' => "g_id=" . intval($this->request['id']) ) );
|
||||
$group = IPSLib::unpackGroup( $group );
|
||||
$group = IPSMember::unpackGroup( $group );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check restrictions.
|
||||
@@ -796,7 +788,7 @@ class admin_members_groups_groups extends ipsCommand
|
||||
if( $this->request['id'] )
|
||||
{
|
||||
$group = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'groups', 'where' => "g_id=" . intval($this->request['id']) ) );
|
||||
$group = IPSLib::unpackGroup( $group );
|
||||
$group = IPSMember::unpackGroup( $group );
|
||||
}
|
||||
|
||||
$group['g_title'] = 'New Group';
|
||||
@@ -808,7 +800,7 @@ class admin_members_groups_groups extends ipsCommand
|
||||
|
||||
$perm_masks = array();
|
||||
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'forum_perms' ) );
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'forum_perms', 'order' => 'perm_name ASC' ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while ( $r = $this->DB->fetch() )
|
||||
@@ -824,33 +816,28 @@ class admin_members_groups_groups extends ipsCommand
|
||||
|
||||
IPSLib::loadInterface( 'admin/group_form.php' );
|
||||
|
||||
$tabsUsed = 2;
|
||||
$firsttab = false;
|
||||
$tabsUsed = 5;
|
||||
$firstTab = empty($this->request['_initTab']) ? false : trim($this->request['_initTab']);
|
||||
|
||||
foreach( ipsRegistry::$applications as $app_dir => $app_data )
|
||||
foreach( IPSLib::getEnabledApplications() as $app_dir => $app_data )
|
||||
{
|
||||
if ( ! IPSLib::appIsInstalled( $app_dir ) )
|
||||
if ( is_file( IPSLib::getAppDir( $app_dir ) . '/extensions/admin/group_form.php' ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( file_exists( IPSLib::getAppDir( $app_dir ) . '/extensions/admin/group_form.php' ) )
|
||||
{
|
||||
$_class = IPSLib::loadLibrary( IPSLib::getAppDir( $app_dir ) . '/extensions/admin/group_form.php', 'admin_group_form__'.$app_dir, $app_dir );
|
||||
$_class = IPSLib::loadLibrary( IPSLib::getAppDir( $app_dir ) . '/extensions/admin/group_form.php', 'admin_group_form__'.$app_dir, $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'];
|
||||
$blocks['area'][ $app_dir ] = $data['content'];
|
||||
$blocks['tabs'][ $app_dir ] = $data['tabs'];
|
||||
|
||||
$tabsUsed = $data['tabsUsed'] ? ( $tabsUsed + $data['tabsUsed'] ) : ( $tabsUsed + 1 );
|
||||
$tabsUsed = $data['tabsUsed'] ? ( $tabsUsed + $data['tabsUsed'] ) : ( $tabsUsed + 1 );
|
||||
|
||||
if ( $this->request['_initTab'] == $app_dir )
|
||||
if ( !empty($this->request['_initTab']) && $this->request['_initTab'] == $app_dir )
|
||||
{
|
||||
$firsttab = $tabsUsed;
|
||||
$firstTab = $tabsUsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -860,6 +847,6 @@ class admin_members_groups_groups extends ipsCommand
|
||||
// And output to form
|
||||
//-----------------------------------------
|
||||
|
||||
$this->registry->output->html .= $this->html->groupsForm( $type, $group, $perm_masks, $blocks, $firsttab );
|
||||
$this->registry->output->html .= $this->html->groupsForm( $type, $group, $perm_masks, $blocks, $firstTab );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user