groups.php

来自「sabreipb 2.1.6 utf-8中文版本!」· PHP 代码 · 共 264 行

PHP
264
字号
<?php/*+--------------------------------------------------------------------------|   Invision Power Board v2.1.5|   =============================================|   by Matthew Mecham|   (c) 2001 - 2005 Invision Power Services, Inc.|   |   =============================================|   Web: |   Time: Wed, 01 Mar 2006 19:11:27 GMT|   Release: |   Licence Info: +---------------------------------------------------------------------------|   > $Date: 2006-01-11 22:47:48 +0000 (Wed, 11 Jan 2006) $|   > $Revision: 122 $|   > $Author: bfarber $+---------------------------------------------------------------------------||   > Admin Forum functions|   > Module written by Matt Mecham|   > Date started: 17th March 2002||	> Module Version Number: 1.0.0|   > DBA Checked: Mon 24th May 2004+--------------------------------------------------------------------------*/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 ad_groups{	# Global	var $ipsclass;	var $html;		var $base_url;		/**	* Section title name	*	* @var	string	*/	var $perm_main = "content";		/**	* Section title name	*	* @var	string	*/	var $perm_child = "group";		function auto_run()	{		$this->ipsclass->forums->forums_init();				require ROOT_PATH.'sources/lib/admin_forum_functions.php';				$this->forumfunc = new admin_forum_functions();		$this->forumfunc->ipsclass =& $this->ipsclass;				//-----------------------------------------		// Kill globals - globals bad, Homer good.		//-----------------------------------------				$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );				foreach ( $tmp_in as $k => $v )		{			unset($$k);		}				//-----------------------------------------		// LOAD HTML		//-----------------------------------------				$this->html = $this->ipsclass->acp_load_template('cp_skin_groups');		//-----------------------------------------		// To do		//-----------------------------------------				switch($this->ipsclass->input['code'])		{			case 'doadd':				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':add' );				$this->save_group('add');				break;							case 'add':				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':add' );				$this->group_form('add');				break;							case 'edit':				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':edit' );				$this->group_form('edit');				break;						case 'doedit':				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':edit' );				$this->save_group('edit');				break;						case 'delete':				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':remove' );				$this->delete_form();				break;						case 'dodelete':				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':remove' );				$this->do_delete();				break;							//-----------------------------------------								case 'fedit':				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':perms' );				$this->forum_perms();				break;							case 'pdelete':				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':perms' );				$this->delete_mask();				break;							case 'dofedit':				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':perms' );				$this->do_forum_perms();				break;							case 'permsplash':				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':perms' );				$this->permsplash();				break;							case 'view_perm_users':				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':perms' );				$this->view_perm_users();				break;								case 'remove_mask':				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':perms' );				$this->remove_mask();				break;							case 'preview_forums':				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':perms' );				$this->preview_forums();				break;							case 'dopermadd':				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':perms' );				$this->add_new_perm();				break;							case 'donameedit':				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':perms' );				$this->edit_name_perm();				break;			//-----------------------------------------											default:				$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':' );				$this->main_screen();				break;		}			}		/*-------------------------------------------------------------------------*/	// Member group /forum mask permission form thingy doodle do yes. Viewing Perm users	/*-------------------------------------------------------------------------*/		function delete_mask()	{		//-----------------------------------------		// Check for a valid ID		//-----------------------------------------				if ($this->ipsclass->input['id'] == "")		{			$this->ipsclass->admin->error("Could not resolve the permission mask setty doodle thingy ID, please try again");		}				$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'forum_perms', 'where' => "perm_id=".$this->ipsclass->input['id'] ) );				$old_id = intval($this->ipsclass->input['id']);				//-----------------------------------------		// Remove from forums...		//-----------------------------------------				$this->ipsclass->DB->simple_construct( array( 'select' => 'id, permission_array', 'from' => 'forums' ) );		$get = $this->ipsclass->DB->simple_exec();				while( $f = $this->ipsclass->DB->fetch_row($get) )		{			$d_str = "";			$d_arr = unserialize(stripslashes( $f['permission_array'] ) );						$perms = unserialize(stripslashes( $f['permission_array'] ) );						foreach( array( 'read_perms', 'reply_perms', 'start_perms', 'upload_perms', 'show_perms' ) as $perm_bit )			{				if ($perms[ $perm_bit ] != '*')				{					if ( preg_match( "/(^|,)".$old_id."(,|$)/", $perms[ $perm_bit ]) )					{						$perms[ $perm_bit ] = preg_replace( "/(^|,)".$old_id."(,|$)/", "\\1\\2", $perms[ $perm_bit ] );												$d_arr[ $perm_bit ] = $this->clean_perms( $perms[ $perm_bit ] );					}				}			}						//-----------------------------------------			// Do we have anything to save?			//-----------------------------------------						if ( count($d_arr) > 0 )			{				//-----------------------------------------				// Sure?..				//-----------------------------------------								$string = addslashes(serialize( $d_arr ) );								if ( strlen($string) > 5)				{					$this->ipsclass->DB->do_update( 'forums', array( 'permission_array' => $string ), 'id='.$f['id'] );				}			}		}				//-----------------------------------------		// Recache forums		//-----------------------------------------				require_once( ROOT_PATH.'sources/action_admin/forums.php' );		$ad_forums = new ad_forums();		$ad_forums->ipsclass =& $this->ipsclass;		$ad_forums->recache_forums();				$this->permsplash();	}		/*-------------------------------------------------------------------------*/	// Add new perm mask	/*-------------------------------------------------------------------------*/		function add_new_perm()	{		$this->ipsclass->input['new_perm_name'] = trim($this->ipsclass->input['new_perm_name']);				if ($this->ipsclass->input['new_perm_name'] == "")		{			$this->ipsclass->admin->error("鎮ㄥ繀椤昏緭鍏ユā鍧楀悕绉

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?