📄 index.php
字号:
</tr> <tr> <td align="right" class="bgColor2">'.$LANG->getLL('Owner',1).'</td> <td class="bgColor-20">'.$this->printCheckBox('perms_user',1).'</td> <td class="bgColor-20">'.$this->printCheckBox('perms_user',5).'</td> <td class="bgColor-20">'.$this->printCheckBox('perms_user',2).'</td> <td class="bgColor-20">'.$this->printCheckBox('perms_user',3).'</td> <td class="bgColor-20">'.$this->printCheckBox('perms_user',4).'</td> </tr> <tr> <td align="right" class="bgColor2">'.$LANG->getLL('Group',1).'</td> <td class="bgColor-20">'.$this->printCheckBox('perms_group',1).'</td> <td class="bgColor-20">'.$this->printCheckBox('perms_group',5).'</td> <td class="bgColor-20">'.$this->printCheckBox('perms_group',2).'</td> <td class="bgColor-20">'.$this->printCheckBox('perms_group',3).'</td> <td class="bgColor-20">'.$this->printCheckBox('perms_group',4).'</td> </tr> <tr> <td align="right" class="bgColor2">'.$LANG->getLL('Everybody',1).'</td> <td class="bgColor-20">'.$this->printCheckBox('perms_everybody',1).'</td> <td class="bgColor-20">'.$this->printCheckBox('perms_everybody',5).'</td> <td class="bgColor-20">'.$this->printCheckBox('perms_everybody',2).'</td> <td class="bgColor-20">'.$this->printCheckBox('perms_everybody',3).'</td> <td class="bgColor-20">'.$this->printCheckBox('perms_everybody',4).'</td> </tr> </table> <br /> <input type="hidden" name="data[pages]['.$this->id.'][perms_user]" value="'.$this->pageinfo['perms_user'].'" /> <input type="hidden" name="data[pages]['.$this->id.'][perms_group]" value="'.$this->pageinfo['perms_group'].'" /> <input type="hidden" name="data[pages]['.$this->id.'][perms_everybody]" value="'.$this->pageinfo['perms_everybody'].'" /> '.$this->getRecursiveSelect($this->id,$this->perms_clause).' <input type="submit" name="submit" value="'.$LANG->getLL('Save',1).'" />'. '<input type="submit" value="'.$LANG->getLL('Abort',1).'" onclick="'.htmlspecialchars('jumpToUrl(\'index.php?id='.$this->id.'\'); return false;').'" /> <input type="hidden" name="redirect" value="'.htmlspecialchars(TYPO3_MOD_PATH.'index.php?mode='.$this->MOD_SETTINGS['mode'].'&depth='.$this->MOD_SETTINGS['depth'].'&id='.intval($this->return_id).'&lastEdited='.$this->id).'" /> '; // Adding section with the permission setting matrix: $this->content.=$this->doc->divider(5); $this->content.=$this->doc->section($LANG->getLL('permissions').':',$code); // CSH for permissions setting $this->content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'perm_module_setting', $GLOBALS['BACK_PATH'],'<br/><br/>'); // Adding help text: if ($BE_USER->uc['helpText']) { $this->content.=$this->doc->divider(20); $legendText = '<b>'.$LANG->getLL('1',1).'</b>: '.$LANG->getLL('1_t',1); $legendText.= '<br /><b>'.$LANG->getLL('16',1).'</b>: '.$LANG->getLL('16_t',1); $legendText.= '<br /><b>'.$LANG->getLL('2',1).'</b>: '.$LANG->getLL('2_t',1); $legendText.= '<br /><b>'.$LANG->getLL('4',1).'</b>: '.$LANG->getLL('4_t',1); $legendText.= '<br /><b>'.$LANG->getLL('8',1).'</b>: '.$LANG->getLL('8_t',1); $code=$legendText.'<br /><br />'.$LANG->getLL('def',1); $this->content.=$this->doc->section($LANG->getLL('Legend',1).':',$code); } } /** * Showing the permissions in a tree ($this->edit = false) * (Adding content to internal content variable) * * @return void */ function notEdit() { global $BE_USER,$LANG,$BACK_PATH; // Get usernames and groupnames: The arrays we get in return contains only 1) users which are members of the groups of the current user, 2) groups that the current user is member of $groupArray = $BE_USER->userGroupsUID; $be_user_Array = t3lib_BEfunc::getUserNames(); if (!$GLOBALS['BE_USER']->isAdmin()) $be_user_Array = t3lib_BEfunc::blindUserNames($be_user_Array,$groupArray,0); $be_group_Array = t3lib_BEfunc::getGroupNames(); if (!$GLOBALS['BE_USER']->isAdmin()) $be_group_Array = t3lib_BEfunc::blindGroupNames($be_group_Array,$groupArray,0); // Length of strings: $tLen= ($this->MOD_SETTINGS['mode']=='perms' ? 20 : 30); // Selector for depth: $code.=$LANG->getLL('Depth').': '; $code.=t3lib_BEfunc::getFuncMenu($this->id,'SET[depth]',$this->MOD_SETTINGS['depth'],$this->MOD_MENU['depth']); $this->content.=$this->doc->section('',$code); $this->content.=$this->doc->spacer(5); // Initialize tree object: $tree = t3lib_div::makeInstance('t3lib_pageTree'); $tree->init('AND '.$this->perms_clause); $tree->addField('perms_user',1); $tree->addField('perms_group',1); $tree->addField('perms_everybody',1); $tree->addField('perms_userid',1); $tree->addField('perms_groupid',1); $tree->addField('hidden'); $tree->addField('fe_group'); $tree->addField('starttime'); $tree->addField('endtime'); $tree->addField('editlock'); // Creating top icon; the current page $HTML=t3lib_iconWorks::getIconImage('pages',$this->pageinfo,$BACK_PATH,'align="top"'); $tree->tree[]=Array('row'=>$this->pageinfo,'HTML'=>$HTML); // Create the tree from $this->id: $tree->getTree($this->id,$this->MOD_SETTINGS['depth'],''); // Make header of table: $code=''; if ($this->MOD_SETTINGS['mode']=='perms') { $code.=' <tr> <td class="bgColor2" colspan="2"> </td> <td class="bgColor2"><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/line.gif','width="5" height="16"').' alt="" /></td> <td class="bgColor2" align="center"><b>'.$LANG->getLL('Owner',1).'</b></td> <td class="bgColor2"><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/line.gif','width="5" height="16"').' alt="" /></td> <td class="bgColor2" align="center"><b>'.$LANG->getLL('Group',1).'</b></td> <td class="bgColor2"><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/line.gif','width="5" height="16"').' alt="" /></td> <td class="bgColor2" align="center"><b>'.$LANG->getLL('Everybody',1).'</b></td> <td class="bgColor2"><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/line.gif','width="5" height="16"').' alt="" /></td> <td class="bgColor2" align="center"><b>'.$LANG->getLL('EditLock',1).'</b></td> </tr> '; } else { $code.=' <tr> <td class="bgColor2" colspan="2"> </td> <td class="bgColor2"><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/line.gif','width="5" height="16"').' alt="" /></td> <td class="bgColor2" align="center" nowrap="nowrap"><b>'.$LANG->getLL('User',1).':</b> '.$BE_USER->user['username'].'</td> '.(!$BE_USER->isAdmin()?'<td class="bgColor2"><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/line.gif','width="5" height="16"').' alt="" /></td> <td class="bgColor2" align="center"><b>'.$LANG->getLL('EditLock',1).'</b></td>':'').' </tr>'; } // Traverse tree: foreach($tree->tree as $data) { $cells = array(); // Background colors: if ($this->lastEdited==$data['row']['uid']) {$bgCol = ' class="bgColor-20"';} else {$bgCol = '';} $lE_bgCol = $bgCol; // User/Group names: $userN = $be_user_Array[$data['row']['perms_userid']] ? $be_user_Array[$data['row']['perms_userid']]['username'] : ($data['row']['perms_userid'] ? '<i>['.$data['row']['perms_userid'].']!</i>' : ''); $groupN = $be_group_Array[$data['row']['perms_groupid']] ? $be_group_Array[$data['row']['perms_groupid']]['title'] : ($data['row']['perms_groupid'] ? '<i>['.$data['row']['perms_groupid'].']!</i>' : ''); $groupN = t3lib_div::fixed_lgd_cs($groupN,20); // Seeing if editing of permissions are allowed for that page: $editPermsAllowed=($data['row']['perms_userid']==$BE_USER->user['uid'] || $BE_USER->isAdmin()); // First column: $cellAttrib = ($data['row']['_CSSCLASS'] ? ' class="'.$data['row']['_CSSCLASS'].'"' : ''); $cells[]=' <td align="left" nowrap="nowrap"'.($cellAttrib ? $cellAttrib : $bgCol).'>'.$data['HTML'].htmlspecialchars(t3lib_div::fixed_lgd($data['row']['title'],$tLen)).' </td>'; // "Edit permissions" -icon if ($editPermsAllowed && $data['row']['uid']) { $aHref = 'index.php?mode='.$this->MOD_SETTINGS['mode'].'&depth='.$this->MOD_SETTINGS['depth'].'&id='.($data['row']['_ORIG_uid'] ? $data['row']['_ORIG_uid'] : $data['row']['uid']).'&return_id='.$this->id.'&edit=1'; $cells[]=' <td'.$bgCol.'><a href="'.htmlspecialchars($aHref).'"><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/edit2.gif','width="11" height="12"').' border="0" title="'.$LANG->getLL('ch_permissions',1).'" align="top" alt="" /></a></td>'; } else { $cells[]=' <td'.$bgCol.'></td>'; } // Rest of columns (depending on mode) if ($this->MOD_SETTINGS['mode']=='perms') { $cells[]=' <td'.$bgCol.'><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/line.gif','width="5" height="16"').' alt="" /></td> <td'.$bgCol.' nowrap="nowrap">'.($data['row']['uid']?$this->printPerms($data['row']['perms_user']).' '.$userN:'').'</td> <td'.$bgCol.'><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/line.gif','width="5" height="16"').' alt="" /></td> <td'.$bgCol.' nowrap="nowrap">'.($data['row']['uid']?$this->printPerms($data['row']['perms_group']).' '.$groupN:'').'</td> <td'.$bgCol.'><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/line.gif','width="5" height="16"').' alt="" /></td> <td'.$bgCol.' nowrap="nowrap">'.($data['row']['uid']?' '.$this->printPerms($data['row']['perms_everybody']):'').'</td> <td'.$bgCol.'><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/line.gif','width="5" height="16"').' alt="" /></td> <td'.$bgCol.' nowrap="nowrap">'.($data['row']['editlock']?'<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/recordlock_warning2.gif','width="22" height="16"').' title="'.$LANG->getLL('EditLock_descr',1).'" alt="" />':'').'</td> '; } else { $cells[]=' <td'.$bgCol.'><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/line.gif','width="5" height="16"').' alt="" /></td>'; if ($BE_USER->user['uid']==$data['row']['perms_userid']) {$bgCol = ' class="bgColor-20"';} else {$bgCol = $lE_bgCol;}// FIXME $owner undefined $cells[]=' <td'.$bgCol.' nowrap="nowrap" align="center">'.($data['row']['uid']?$owner.$this->printPerms($BE_USER->calcPerms($data['row'])):'').'</td> '.(!$BE_USER->isAdmin()?' <td'.$bgCol.'><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/line.gif','width="5" height="16"').' alt="" /></td> <td'.$bgCol.' nowrap="nowrap">'.($data['row']['editlock']?'<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/recordlock_warning2.gif','width="22" height="16"').' title="'.$LANG->getLL('EditLock_descr',1).'" alt="" />':'').'</td> ':''); $bgCol = $lE_bgCol; } // Compile table row: $code.=' <tr> '.implode(' ',$cells).' </tr>'; } // Wrap rows in table tags: $code='<table border="0" cellspacing="0" cellpadding="0" id="typo3-permissionList">'.$code.'</table>'; // Adding the content as a section: $this->content.=$this->doc->section('',$code); // CSH for permissions setting $this->content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'perm_module', $GLOBALS['BACK_PATH'],'<br/>|'); // Creating legend table: $legendText = '<b>'.$LANG->getLL('1',1).'</b>: '.$LANG->getLL('1_t',1); $legendText.= '<br /><b>'.$LANG->getLL('16',1).'</b>: '.$LANG->getLL('16_t',1); $legendText.= '<br /><b>'.$LANG->getLL('2',1).'</b>: '.$LANG->getLL('2_t',1); $legendText.= '<br /><b>'.$LANG->getLL('4',1).'</b>: '.$LANG->getLL('4_t',1); $legendText.= '<br /><b>'.$LANG->getLL('8',1).'</b>: '.$LANG->getLL('8_t',1); $code='<table border="0" id="typo3-legendTable"> <tr> <td valign="top"><img src="legend.gif" width="86" height="75" alt="" /></td> <td valign="top" nowrap="nowrap">'.$legendText.'</td> </tr> </table>'; $code.='<br />'.$LANG->getLL('def',1); $code.='<br /><br /><span class="perm-allowed">*</span>: '.$LANG->getLL('A_Granted',1); $code.='<br /><span class="perm-denied">x</span>: '.$LANG->getLL('A_Denied',1); // Adding section with legend code: $this->content.=$this->doc->spacer(20); $this->content.=$this->doc->section($LANG->getLL('Legend').':',$code,0,1); } /***************************** * * Helper functions * *****************************/ /** * Print a checkbox for the edit-permission form * * @param string Checkbox name key * @param integer Checkbox number index * @return string HTML checkbox */ function printCheckBox($checkName,$num) { $onClick = 'checkChange(\'check['.$checkName.']\', \'data[pages]['.$GLOBALS['SOBE']->id.']['.$checkName.']\')'; return '<input type="checkbox" name="check['.$checkName.']['.$num.']" onclick="'.htmlspecialchars($onClick).'" /><br />'; } /** * Print a set of permissions * * @param integer Permission integer (bits) * @return string HTML marked up x/* indications. */ function printPerms($int) { $str=''; $str.= (($int&1)?'*':'<span class="perm-denied">x</span>'); $str.= (($int&16)?'*':'<span class="perm-denied">x</span>'); $str.= (($int&2)?'*':'<span class="perm-denied">x</span>'); $str.= (($int&4)?'*':'<span class="perm-denied">x</span>'); $str.= (($int&8)?'*':'<span class="perm-denied">x</span>'); return '<span class="perm-allowed">'.$str.'</span>'; } /** * Returns the permissions for a group based of the perms_groupid of $row. If the $row[perms_groupid] equals the $firstGroup[uid] then the function returns perms_everybody OR'ed with perms_group, else just perms_everybody * * @param array Row array (from pages table) * @param array First group data * @return integer Integer: Combined permissions. */ function groupPerms($row,$firstGroup) { if (is_array($row)) { $out=intval($row['perms_everybody']); if ($row['perms_groupid'] && $firstGroup['uid']==$row['perms_groupid']) { $out|= intval($row['perms_group']); } return $out; } } /** * Finding tree and offer setting of values recursively. * * @param integer Page id. * @param string Select clause * @return string Select form element for recursive levels (if any levels are found) */ function getRecursiveSelect($id,$perms_clause) { // Initialize tree object: $tree = t3lib_div::makeInstance('t3lib_pageTree'); $tree->init('AND '.$perms_clause); $tree->addField('perms_userid',1); $tree->makeHTML=0; $tree->setRecs = 1; // Make tree: $tree->getTree($id,$this->getLevels,''); // If there are a hierarchy of page ids, then... if ($GLOBALS['BE_USER']->user['uid'] && count($tree->orig_ids_hierarchy)) { // Init: $label_recur = $GLOBALS['LANG']->getLL('recursive'); $label_levels = $GLOBALS['LANG']->getLL('levels'); $label_pA = $GLOBALS['LANG']->getLL('pages_affected'); $theIdListArr=array(); $opts=' <option value=""></option>'; // Traverse the number of levels we want to allow recursive setting of permissions for: for ($a=$this->getLevels;$a>0;$a--) { if (is_array($tree->orig_ids_hierarchy[$a])) { foreach($tree->orig_ids_hierarchy[$a] as $theId) { if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->user['uid']==$tree->recs[$theId]['perms_userid']) { $theIdListArr[]=$theId; } } $lKey = $this->getLevels-$a+1; $opts.=' <option value="'.htmlspecialchars(implode(',',$theIdListArr)).'">'. t3lib_div::deHSCentities(htmlspecialchars($label_recur.' '.$lKey.' '.$label_levels)).' ('.count($theIdListArr).' '.$label_pA.')'. '</option>'; } } // Put the selector box together: $theRecursiveSelect = '<br /> <select name="mirror[pages]['.$id.']"> '.$opts.' </select> <br /><br />'; } else { $theRecursiveSelect = ''; } // Return selector box element: return $theRecursiveSelect; }}// Include extension?if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/web/perm/index.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/web/perm/index.php']);}// Make instance:$SOBE = t3lib_div::makeInstance('SC_mod_web_perm_index');$SOBE->init();$SOBE->main();$SOBE->printContent();if ($TYPO3_CONF_VARS['BE']['compressionLevel']) { new gzip_encode($TYPO3_CONF_VARS['BE']['compressionLevel']);}?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -