* Invision Power Services * IP.Board v3.3.4 * ACP permissions skin file * Last Updated: $Date: 2012-06-29 09:20:50 -0400 (Fri, 29 Jun 2012) $ * * * @author $Author: ips_terabyte $ * @copyright (c) 2001 - 2009 Invision Power Services, Inc. * @license http://www.invisionpower.com/company/standards.php#license * @package IP.Board * @subpackage Members * @link http://www.invisionpower.com * @since 20th February 2002 * @version $Rev: 11004 $ * */ class cp_skin_permissions { /** * Registry Object Shortcuts * * @var $registry * @var $DB * @var $settings * @var $request * @var $lang * @var $member * @var $memberData * @var $cache * @var $caches */ protected $registry; protected $DB; protected $settings; protected $request; protected $lang; protected $member; protected $memberData; protected $cache; protected $caches; /** * Constructor * * @param object $registry Registry object * @return @e void */ public function __construct( ipsRegistry $registry ) { $this->registry = $registry; $this->DB = $this->registry->DB(); $this->settings =& $this->registry->fetchSettings(); $this->request =& $this->registry->fetchRequest(); $this->member = $this->registry->member(); $this->memberData =& $this->registry->member()->fetchMemberData(); $this->cache = $this->registry->cache(); $this->caches =& $this->registry->cache()->fetchCaches(); $this->lang = $this->registry->class_localization; } /** * Confirmation page that perm set was removed * * @param string Name * @return string HTML */ public function permissionSetRemoveDone( $name ) { $IPBHTML = ""; //--starthtml--// $IPBHTML .= <<

{$this->lang->words['per_result']}

{$this->lang->words['per_removecustom']}{$name}.
HTML; //--endhtml--// return $IPBHTML; } /** * Show users assigned to the perm mask * * @param integer Perm mask id * @param string Permission set name * @param array Users with this mask * @return string HTML */ public function permissionSetUsers( $perm_id, $set, $rows ) { $IPBHTML = ""; //--starthtml--// $IPBHTML .= <<

{$this->lang->words['per_membersusing']}{$set}

HTML; foreach( $rows as $r ) { $also_using = ''; if ( $r['_extra'] ) { $also_using = "
\n• {$this->lang->words['per_alsousing']}{$r['_extra']}\n"; } $IPBHTML .= << HTML; } $IPBHTML .= << HTML; //--endhtml--// return $IPBHTML; } /** * Permissions matrix * * @param array Permission names * @param array Compiled grids * @param array Permissions checked * @param array Colors * @param string Type * @param boolean $addOutsideBox Add or not the outside acp-box * @return string HTML */ public function permissionMatrix( $perm_names, $perm_matrix, $perm_checked, $colors, $type, $addOutsideBox=true ) { $IPBHTML = ""; //--starthtml--// $cols = count( $perm_names ) + 1; $width = ceil( 83 / count( $perm_names ) ); $IPBHTML .= $addOutsideBox ? "
" : ''; $IPBHTML .= <<{$this->lang->words['frm_enterthematrix']}-->
{$this->lang->words['per_userdetail']} {$this->lang->words['per_action']}
{$r['members_display_name']}
• {$this->lang->words['per_posts']}{$r['posts']}
• {$this->lang->words['per_email']}{$r['email']} {$also_using}
• form_code}do=remove_mask&id={$r['member_id']}&pid={$perm_id}' title='{$this->lang->words['per_removethis']}'>{$this->lang->words['per_removethisset']}
• form_code}do=remove_mask&id={$r['member_id']}&pid=all' title='{$this->lang->words['per_removeall']}'>{$this->lang->words['per_removeall']}
HTML; foreach( $perm_names as $k => $v ) { $IPBHTML .= <<{$v} HTML; } $IPBHTML .= << HTML; $col_num = 0; foreach( $perm_names as $k => $v ) { $col_num++; $IPBHTML .= << HTML; } $IPBHTML .= << HTML; $row_num = 0; foreach( $perm_matrix as $set => $row ) { $set = explode( '%', $set ); $row_num++; $col_num = 0; $IPBHTML .= << HTML; foreach( $row as $key => $perm ) { $col_num++; $IPBHTML .= << {$perm}
HTML; } $IPBHTML .= << HTML; } $IPBHTML .= << HTML; $IPBHTML .= $addOutsideBox ? '' : ''; //--endhtml--// return $IPBHTML; } /** * Permission set matrix * * @param array Perm names * @param array Perm grids * @param array Boxes to check * @param array Colors * @param string Application * @param string Type * @return string HTML */ public function permissionSetMatrix( $perm_names, $perm_matrix, $perm_checked, $colors, $app, $type ) { $IPBHTML = ""; //--starthtml--// if( !is_array( $perm_matrix ) || !count( $perm_matrix ) ){ return ''; } $IPBHTML .= << HTML; if( is_array( $perm_names ) && count( $perm_names ) ) { $col_num = 0; $col_width = floor( 87 / count( $perm_names ) ); $IPBHTML .= << HTML; } $row_num = 0; foreach( $perm_matrix as $set => $row ) { $set = explode( '%', $set ); $row_num++; if( !empty($row['_noconfig']) ) { $IPBHTML .= << HTML; } else { $IPBHTML .= << HTML; } } $IPBHTML .= << HTML; //--endhtml--// return $IPBHTML; } /** * Show dialog to advise user to apply group restrictions * * @return string HTML */ public function groupAdminConfirm( $group_id ) { $IPBHTML = ""; //--starthtml--// $IPBHTML .= <<

{$this->lang->words['sm_configrest']}

 
{$this->lang->words['frm_global']}
  {$v}
{$set[1]}
  HTML; foreach( $perm_names as $key => $text ) { $col_num++; $IPBHTML .= <<  HTML; } $IPBHTML .= <<
 
{$set[1]}
{$row['_noconfig']}
{$set[1]}
HTML; $col_num = 0; //$col_width = floor( 87 / count( $row ) ); foreach( $perm_names as $key => $perm ) { $col_num++; if( isset( $row[ $key ] ) ) { $IPBHTML .= << {$perm}
HTML; } else { $IPBHTML .= <<{$this->lang->words['per_notused']} HTML; } } $IPBHTML .= <<
 
{$this->lang->words['sm_detectacp']}

{$this->lang->words['sm_setrestrict']}
form_code}'>{$this->lang->words['sm_nothanks']}   {$this->lang->words['sm_yesplease']}

HTML; //--endhtml--// return $IPBHTML; } /** * Edit permissions mask * * @param string Set name * @param array Perm grids * @param integer Id * @param array Applications * @return string HTML */ public function permissionEditor( $set_name, $perm_matricies, $id, $apps ) { $IPBHTML = ""; //--starthtml--// $i = 1; $IPBHTML .= << // -->

{$set_name}

form_code}do=do_edit_set&id={$this->request['id']}' method='post' id='adminform'>
{$this->lang->words['per_setname']}

HTML; foreach( $apps as $app => $types ) { foreach( $types as $type ) { $IPBHTML .= << HTML; } } $IPBHTML .= <<

{$this->lang->words['per_editset']}

« »
HTML; $i = 1; foreach( $perm_matricies as $type => $matrix ) { if( !$matrix ){ continue; } $IPBHTML .= << {$matrix}
HTML; $i++; } $IPBHTML .= <<


HTML; //--endhtml--// return $IPBHTML; } /** * Mask splash page * * @param array Masks * @param string Dropdown lsit * @return string HTML */ public function permissionsSplash( $rows, $dlist ) { $IPBHTML = ""; //--starthtml--// $IPBHTML .= <<

{$this->lang->words['per_title']}

{$this->lang->words['per_setname']}

HTML; /* ROW */ foreach( $rows as $r ) { $IPBHTML .= << HTML; } /* / ROW */ $IPBHTML .= <<
form_code}' method='post'>

{$this->lang->words['per_createnew']}

{$this->lang->words['per_name']} {$this->lang->words['per_usedgroups']} {$this->lang->words['per_usedmembers']}  
{$r['name']} {$r['groups']} HTML; if ( $r['mems'] > 0 ) { $IPBHTML .= <<form_code_js}do=view_perm_users&id={$r['id']}", "{$this->lang->words['per_user']}", "500","350");' title='{$this->lang->words['per_viewnames']}'>{$this->lang->words['per_view']}) HTML; } else { $IPBHTML .= <<lang->words['per_nomember']} HTML; } $IPBHTML .= <<
{$this->lang->words['per_setname']}
{$this->lang->words['per_baseon']}
HTML; //--endhtml--// return $IPBHTML; } }