/**
  * Populates the "object_id" field of a "tx_beacl_acl" record depending on
  * whether the field "type" is set to "User" or "Group"
  *
  * @param		array		field configuration
  * @param		object
  * @return	void
  */
 function select($PA, $fobj)
 {
     global $BE_USER;
     if (!array_key_exists('row', $PA)) {
         return;
     }
     if (!array_key_exists('type', $PA['row'])) {
         return;
     }
     // Resetting the SELECT field items
     $PA['items'] = array(0 => array(0 => '', 1 => ''));
     // Get users or groups - The function copies functionality of the method acl_objectSelector()
     // of ux_SC_mod_web_perm_index class as for non-admins it returns only:
     // 1) Users which are members of the groups of the current user.
     // 2) Groups that the current user is a member of.
     switch ($PA['row']['type']) {
         // In case users shall be returned
         case '0':
             $items = t3lib_BEfunc::getUserNames();
             if (!$GLOBALS['BE_USER']->isAdmin()) {
                 $items = t3lib_BEfunc::blindUserNames($items, $BE_USER->userGroupsUID, 1);
             }
             foreach ($items as $row) {
                 $PA['items'][] = array(0 => $row['username'], 1 => $row['uid']);
             }
             break;
             // In case groups shall be returned
         // In case groups shall be returned
         case '1':
             $items = t3lib_BEfunc::getGroupNames();
             if (!$GLOBALS['BE_USER']->isAdmin()) {
                 $items = t3lib_BEfunc::blindGroupNames($items, $BE_USER->userGroupsUID, 1);
             }
             foreach ($items as $row) {
                 $PA['items'][] = array(0 => $row['title'], 1 => $row['uid']);
             }
             break;
         default:
             return;
     }
     return;
 }
 /**
  * outputs a selector for users / groups, returns current ACLs
  *
  * @param	integer		type of ACL. 0 -> user, 1 -> group
  * @param	string		Pointer where the display code is stored
  * @param	array		configuration of ACLs
  * @return	array		list of groups/users where the ACLs will be shown
  */
 function acl_objectSelector($type, &$displayPointer, $conf)
 {
     global $BE_USER;
     $aclObjects = array();
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tx_beacl_acl.object_id AS object_id, tx_beacl_acl.type AS type', 'tx_beacl_acl, be_groups, be_users', 'tx_beacl_acl.type=' . intval($type) . ' AND ((tx_beacl_acl.object_id=be_groups.uid AND tx_beacl_acl.type=1) OR (tx_beacl_acl.object_id=be_users.uid AND tx_beacl_acl.type=0))', '', 'be_groups.title ASC, be_users.realname ASC');
     while ($result = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         $aclObjects[] = $result['object_id'];
     }
     $aclObjects = array_unique($aclObjects);
     // advanced selector disabled
     if (!$conf['enableFilterSelector']) {
         return $aclObjects;
     }
     if (!empty($aclObjects)) {
         // 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);
         }
         // get current selection from UC, merge data, write it back to UC
         $currentSelection = is_array($BE_USER->uc['moduleData']['txbeacl_aclSelector'][$type]) ? $BE_USER->uc['moduleData']['txbeacl_aclSelector'][$type] : array();
         $currentSelectionOverride_raw = t3lib_div::_GP('tx_beacl_objsel');
         $currentSelectionOverride = array();
         if (is_array($currentSelectionOverride_raw[$type])) {
             foreach ($currentSelectionOverride_raw[$type] as $tmp) {
                 $currentSelectionOverride[$tmp] = $tmp;
             }
         }
         if ($currentSelectionOverride) {
             $currentSelection = $currentSelectionOverride;
         }
         $BE_USER->uc['moduleData']['txbeacl_aclSelector'][$type] = $currentSelection;
         $BE_USER->writeUC($BE_USER->uc);
         // display selector
         $displayCode = '<select size="' . t3lib_div::intInRange(count($aclObjects), 5, 15) . '" name="tx_beacl_objsel[' . $type . '][]" multiple="multiple">';
         foreach ($aclObjects as $singleObjectId) {
             if ($type == 0) {
                 $tmpnam = $be_user_Array[$singleObjectId]['username'];
             } else {
                 $tmpnam = $be_group_Array[$singleObjectId]['title'];
             }
             $displayCode .= '<option value="' . $singleObjectId . '" ' . (@in_array($singleObjectId, $currentSelection) ? 'selected' : '') . '>' . $tmpnam . '</option>';
         }
         $displayCode .= '</select>';
         $displayCode .= '<br /><input type="button" value="' . $GLOBALS['LANG']->getLL('aclObjSelUpdate') . '" onClick="document.editform.action=document.location; document.editform.submit()" /><p />';
         // create section
         switch ($type) {
             case 0:
                 $tmpnam = 'aclUsers';
                 break;
             default:
                 $tmpnam = 'aclGroups';
                 break;
         }
         $displayPointer = $this->doc->section($GLOBALS['LANG']->getLL($tmpnam, 1), $displayCode);
         return $currentSelection;
     }
     return NULL;
 }
示例#3
0
    /**
     * Showing the permissions in a tree ($this->edit = false)
     * (Adding content to internal content variable)
     *
     * @return	void
     */
    public 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
        $beGroupKeys = $BE_USER->userGroupsUID;
        $beUserArray = t3lib_BEfunc::getUserNames();
        if (!$GLOBALS['BE_USER']->isAdmin()) {
            $beUserArray = t3lib_BEfunc::blindUserNames($beUserArray, $beGroupKeys, 0);
        }
        $beGroupArray = t3lib_BEfunc::getGroupNames();
        if (!$GLOBALS['BE_USER']->isAdmin()) {
            $beGroupArray = t3lib_BEfunc::blindGroupNames($beGroupArray, $beGroupKeys, 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::getSpriteIconForRecord('pages', $this->pageinfo);
        $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 class="t3-row-header">
					<td colspan="2">&nbsp;</td>
					<td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td>' . $LANG->getLL('Owner', TRUE) . '</td>
					<td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td align="center">' . $LANG->getLL('Group', TRUE) . '</td>
					<td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td align="center">' . $LANG->getLL('Everybody', TRUE) . '</td>
					<td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td align="center">' . $LANG->getLL('EditLock', TRUE) . '</td>
				</tr>
			';
        } else {
            $code .= '
				<tr class="t3-row-header">
					<td colspan="2">&nbsp;</td>
					<td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td align="center" nowrap="nowrap">' . $LANG->getLL('User', TRUE) . ': ' . htmlspecialchars($BE_USER->user['username']) . '</td>
					' . (!$BE_USER->isAdmin() ? '<td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td align="center">' . $LANG->getLL('EditLock', TRUE) . '</td>' : '') . '
				</tr>';
        }
        // Traverse tree:
        foreach ($tree->tree as $data) {
            $cells = array();
            $pageId = $data['row']['uid'];
            // Background colors:
            $bgCol = $this->lastEdited == $pageId ? ' class="bgColor-20"' : '';
            $lE_bgCol = $bgCol;
            // User/Group names:
            $userName = $beUserArray[$data['row']['perms_userid']] ? $beUserArray[$data['row']['perms_userid']]['username'] : ($data['row']['perms_userid'] ? $data['row']['perms_userid'] : '');
            if ($data['row']['perms_userid'] && !$beUserArray[$data['row']['perms_userid']]) {
                $userName = SC_mod_web_perm_ajax::renderOwnername($pageId, $data['row']['perms_userid'], htmlspecialchars(t3lib_div::fixed_lgd_cs($userName, 20)), false);
            } else {
                $userName = SC_mod_web_perm_ajax::renderOwnername($pageId, $data['row']['perms_userid'], htmlspecialchars(t3lib_div::fixed_lgd_cs($userName, 20)));
            }
            $groupName = $beGroupArray[$data['row']['perms_groupid']] ? $beGroupArray[$data['row']['perms_groupid']]['title'] : ($data['row']['perms_groupid'] ? $data['row']['perms_groupid'] : '');
            if ($data['row']['perms_groupid'] && !$beGroupArray[$data['row']['perms_groupid']]) {
                $groupName = SC_mod_web_perm_ajax::renderGroupname($pageId, $data['row']['perms_groupid'], htmlspecialchars(t3lib_div::fixed_lgd_cs($groupName, 20)), false);
            } else {
                $groupName = SC_mod_web_perm_ajax::renderGroupname($pageId, $data['row']['perms_groupid'], htmlspecialchars(t3lib_div::fixed_lgd_cs($groupName, 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_cs($data['row']['title'], $tLen)) . '&nbsp;</td>';
            // "Edit permissions" -icon
            if ($editPermsAllowed && $pageId) {
                $aHref = 'index.php?mode=' . $this->MOD_SETTINGS['mode'] . '&depth=' . $this->MOD_SETTINGS['depth'] . '&id=' . ($data['row']['_ORIG_uid'] ? $data['row']['_ORIG_uid'] : $pageId) . '&return_id=' . $this->id . '&edit=1';
                $cells[] = '
					<td' . $bgCol . '><a href="' . htmlspecialchars($aHref) . '" title="' . $LANG->getLL('ch_permissions', 1) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a></td>';
            } else {
                $cells[] = '
					<td' . $bgCol . '></td>';
            }
            // Rest of columns (depending on mode)
            if ($this->MOD_SETTINGS['mode'] == 'perms') {
                $cells[] = '
					<td' . $bgCol . ' class="center"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td' . $bgCol . ' nowrap="nowrap">' . ($pageId ? SC_mod_web_perm_ajax::renderPermissions($data['row']['perms_user'], $pageId, 'user') . ' ' . $userName : '') . '</td>

					<td' . $bgCol . ' class="center"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td' . $bgCol . ' nowrap="nowrap">' . ($pageId ? SC_mod_web_perm_ajax::renderPermissions($data['row']['perms_group'], $pageId, 'group') . ' ' . $groupName : '') . '</td>

					<td' . $bgCol . ' class="center"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td' . $bgCol . ' nowrap="nowrap">' . ($pageId ? ' ' . SC_mod_web_perm_ajax::renderPermissions($data['row']['perms_everybody'], $pageId, 'everybody') : '') . '</td>

					<td' . $bgCol . ' class="center"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td' . $bgCol . ' nowrap="nowrap">' . ($data['row']['editlock'] ? '<span id="el_' . $pageId . '" class="editlock"><a class="editlock" onclick="WebPermissions.toggleEditLock(\'' . $pageId . '\', \'1\');" title="' . $LANG->getLL('EditLock_descr', 1) . '">' . t3lib_iconWorks::getSpriteIcon('status-warning-lock') . '</a></span>' : ($pageId === 0 ? '' : '<span id="el_' . $pageId . '" class="editlock"><a class="editlock" onclick="WebPermissions.toggleEditLock(\'' . $pageId . '\', \'0\');" title="Enable the &raquo;Admin-only&laquo; edit lock for this page">[+]</a></span>')) . '</td>
				';
            } else {
                $cells[] = '
					<td' . $bgCol . ' class="center"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>';
                $bgCol = $BE_USER->user['uid'] == $data['row']['perms_userid'] ? ' class="bgColor-20"' : $lE_bgCol;
                // FIXME $owner undefined
                $cells[] = '
					<td' . $bgCol . ' nowrap="nowrap" align="center">' . ($pageId ? $owner . SC_mod_web_perm_ajax::renderPermissions($BE_USER->calcPerms($data['row']), $pageId, 'user') : '') . '</td>
					' . (!$BE_USER->isAdmin() ? '
					<td' . $bgCol . ' class="center"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td' . $bgCol . ' nowrap="nowrap">' . ($data['row']['editlock'] ? t3lib_iconWorks::getSpriteIcon('status-warning-lock', array('title' => $LANG->getLL('EditLock_descr', TRUE))) : '') . '</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 = '<strong>' . $LANG->getLL('1', 1) . '</strong>: ' . $LANG->getLL('1_t', 1);
        $legendText .= '<br /><strong>' . $LANG->getLL('16', 1) . '</strong>: ' . $LANG->getLL('16_t', 1);
        $legendText .= '<br /><strong>' . $LANG->getLL('2', 1) . '</strong>: ' . $LANG->getLL('2_t', 1);
        $legendText .= '<br /><strong>' . $LANG->getLL('4', 1) . '</strong>: ' . $LANG->getLL('4_t', 1);
        $legendText .= '<br /><strong>' . $LANG->getLL('8', 1) . '</strong>: ' . $LANG->getLL('8_t', 1);
        $code = '<table border="0" id="typo3-legendTable">
			<tr>
				<td valign="top">
					<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/legend.gif', 'width="86" height="75"') . ' alt="" />
				</td>
				<td valign="top" nowrap="nowrap">' . $legendText . '</td>
			</tr>
		</table>';
        $code .= '<div id="perm-legend">' . $LANG->getLL('def', 1);
        $code .= '<br /><br />' . t3lib_iconWorks::getSpriteIcon('status-status-permission-granted') . ': ' . $LANG->getLL('A_Granted', 1);
        $code .= '<br />' . t3lib_iconWorks::getSpriteIcon('status-status-permission-denied') . ': ' . $LANG->getLL('A_Denied', 1);
        $code .= '</div>';
        // Adding section with legend code:
        $this->content .= $this->doc->spacer(20);
        $this->content .= $this->doc->section($LANG->getLL('Legend') . ':', $code, 0, 1);
    }
 /**
  * Callback function to blind user and group accounts. Used as <code>itemsProcFunc</code> in <code>$TCA</code>.
  *
  * @param	array		$conf	Configuration array. The following elements are set:<ul><li>items - initial set of items (empty in our case)</li><li>config - field config from <code>$TCA</code></li><li>TSconfig - this function name</li><li>table - table name</li><li>row - record row (???)</li><li>field - field name</li></ul>
  * @param	object		$tceforms	<code>t3lib_div::TCEforms</code> object
  * @return	void
  */
 function processUserAndGroups($conf, $tceforms)
 {
     // Get usernames and groupnames
     $be_group_Array = t3lib_BEfunc::getListGroupNames('title,uid');
     $groupArray = array_keys($be_group_Array);
     $be_user_Array = t3lib_BEfunc::getUserNames();
     $be_user_Array = t3lib_BEfunc::blindUserNames($be_user_Array, $groupArray, 1);
     // users
     $title = $GLOBALS['LANG']->sL($GLOBALS['TCA']['be_users']['ctrl']['title']);
     foreach ($be_user_Array as $uid => $user) {
         $conf['items'][] = array($user['username'] . ' (' . $title . ')', 'be_users_' . $user['uid'], t3lib_iconWorks::getIcon('be_users', $user));
     }
     // Process groups only if necessary -- save time!
     if (strstr($conf['config']['mod_ws_allowed'], 'be_groups')) {
         // groups
         $be_group_Array = $be_group_Array_o = t3lib_BEfunc::getGroupNames();
         $be_group_Array = t3lib_BEfunc::blindGroupNames($be_group_Array_o, $groupArray, 1);
         $title = $GLOBALS['LANG']->sL($GLOBALS['TCA']['be_groups']['ctrl']['title']);
         foreach ($be_group_Array as $uid => $group) {
             $conf['items'][] = array($group['title'] . ' (' . $title . ')', 'be_groups_' . $group['uid'], t3lib_iconWorks::getIcon('be_groups', $user));
         }
     }
 }
示例#5
0
 /**
  * Get HTML code for the pages which were mounted, but NOT readable!
  *
  * @return	string		HTML code.
  */
 function ext_getReadableButNonmounted()
 {
     // List of page id mounts which ARE mounted (and should therefore not be selected)
     if (!$this->ext_pageIdsFromMounts) {
         $this->ext_pageIdsFromMounts = 0;
     }
     // User and group names:
     $be_user_Array = t3lib_BEfunc::getUserNames();
     $be_group_Array = t3lib_BEfunc::getGroupNames();
     // Create query:
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('pid,uid,title,doktype,perms_user,perms_group,perms_everybody,perms_userid,perms_groupid' . (t3lib_extMgm::isLoaded('cms') ? ',media,layout,hidden,starttime,endtime,fe_group,extendToSubpages' : ''), 'pages', 'uid NOT IN (' . $this->ext_pageIdsFromMounts . ') AND ' . $this->getPagePermsClause(1) . t3lib_BEfunc::deleteClause('pages'));
     $dat = array();
     while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         $dat[] = array('row' => $row, 'HTML' => t3lib_iconWorks::getSpriteIconForRecord('pages', $row, array('title' => '[' . $row['uid'] . ']')));
     }
     $pp = t3lib_div::makeInstance('printAllPageTree_perms', $this);
     return $pp->printTree($dat, 1);
 }
示例#6
0
 /**
  * Generates a list of user names that has access to the workspace.
  *
  * @param	array		A list of user IDs separated by comma
  * @param	string		Access string
  * @return	string		Generated content
  */
 function workspaceList_getUserListWithAccess(&$list, $access)
 {
     $content_array = array();
     if ($list != '') {
         $userIDs = explode(',', $list);
         // get user names and sort
         $regExp = '/^(be_[^_]+)_(\\d+)$/';
         $groups = false;
         foreach ($userIDs as $userUID) {
             $id = $userUID;
             if (preg_match($regExp, $userUID)) {
                 $table = preg_replace($regExp, '\\1', $userUID);
                 $id = intval(preg_replace($regExp, '\\2', $userUID));
                 if ($table == 'be_users') {
                     // user
                     $icon = $GLOBALS['TCA']['be_users']['typeicons'][$this->be_user_Array[$id]['admin']];
                     if ($id == $GLOBALS['BE_USER']->user['uid']) {
                         // highlight current user
                         $tag0 = '<span class="ver-wl-current-user">';
                         $tag1 = '</span>';
                     } else {
                         $tag0 = $tag1 = '';
                     }
                     $content_array[] = $this->doc->wrapClickMenuOnIcon(t3lib_iconWorks::getIconImage($table, $this->be_user_Array[$id], $GLOBALS['BACK_PATH'], ' align="middle" alt="UID: ' . $id . '"'), $table, $id, 2) . $tag0 . htmlspecialchars($this->be_user_Array_full[$id]['username']) . $tag1;
                 } else {
                     // group
                     if (false === $groups) {
                         $groups = t3lib_BEfunc::getGroupNames();
                     }
                     $content_array[] = $this->doc->wrapClickMenuOnIcon(t3lib_iconWorks::getIconImage($table, $groups[$id], $GLOBALS['BACK_PATH'], ' align="middle" alt="UID: ' . $id . '"'), $table, $id, 2) . $groups[$id]['title'];
                 }
             } else {
                 // user id
                 if ($userUID == $GLOBALS['BE_USER']->user['uid']) {
                     // highlight current user
                     $tag0 = '<span class="ver-wl-current-user">';
                     $tag1 = '</span>';
                 } else {
                     $tag0 = $tag1 = '';
                 }
                 $content_array[] = t3lib_iconWorks::getIconImage('be_users', $this->be_user_Array[$id], $GLOBALS['BACK_PATH'], ' align="middle" alt="UID: ' . $id . '"') . $tag0 . htmlspecialchars($this->be_user_Array_full[$userUID]['username']) . $tag1;
             }
         }
         sort($content_array);
     } else {
         $content_array[] = '&nbsp;&ndash;';
     }
     $content = '<tr><td class="ver-wl-details-label ver-wl-details-user-list-label">';
     // TODO CSH lable explaining access here?
     $content .= '<strong>' . $access . '</strong></td>';
     $content .= '<td class="ver-wl-details">' . implode('<br />', $content_array) . '</td></tr>';
     return $content;
 }
 /**
  * Generate the group selector element
  *
  * @param	Integer		$page: The page id to change the user for
  * @param	Integer		$groupUid: The page group uid
  * @param	String		$username: The username to display
  * @return	String		The html select element
  */
 protected function renderGroupSelector($page, $groupUid, $groupname = '')
 {
     // Get usernames
     $beGroups = t3lib_BEfunc::getListGroupNames('title,uid');
     $beGroupKeys = array_keys($beGroups);
     $beGroupsO = $beGroups = t3lib_BEfunc::getGroupNames();
     if (!$GLOBALS['BE_USER']->isAdmin()) {
         $beGroups = t3lib_BEfunc::blindGroupNames($beGroupsO, $beGroupKeys, 1);
     }
     // Group selector:
     $options = '';
     // flag: is set if the page-groupid equals one from the group-list
     $userset = 0;
     // Loop through the groups
     foreach ($beGroups as $uid => $row) {
         if ($uid == $groupUid) {
             $userset = 1;
             $selected = ' selected="selected"';
         } else {
             $selected = '';
         }
         $options .= '<option value="' . $uid . '"' . $selected . '>' . htmlspecialchars($row['title']) . '</option>';
     }
     // If the group was not set AND there is a group for the page
     if (!$userset && $groupUid) {
         $options = '<option value="' . $groupUid . '" selected="selected">' . htmlspecialchars($beGroupsO[$groupUid]['title']) . '</option>' . $options;
     }
     $elementId = 'g_' . $page;
     $options = '<option value="0"></option>' . $options;
     $selector = '<select name="new_page_group" id="new_page_group">' . $options . '</select>';
     $saveButton = '<a onclick="WebPermissions.changeGroup(' . $page . ', ' . $groupUid . ', \'' . $elementId . '\');" title="Change group">' . t3lib_iconWorks::getSpriteIcon('actions-document-save') . '</a>';
     $cancelButton = '<a onclick="WebPermissions.restoreGroup(' . $page . ', ' . $groupUid . ', \'' . ($groupname == '' ? '<span class=not_set>[not set]</span>' : htmlspecialchars($groupname)) . '\', \'' . $elementId . '\');" title="Cancel">' . t3lib_iconWorks::getSpriteIcon('actions-document-close') . '</a>';
     $ret = $selector . $saveButton . $cancelButton;
     return $ret;
 }
示例#8
0
 /**
  * Menu configuration
  *
  * @return	void
  */
 function menuConfig()
 {
     global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS, $TYPO3_DB;
     // MENU-ITEMS:
     // If array, then it's a selector box menu
     // If empty string it's just a variable, that'll be saved.
     // Values NOT in this array will not be saved in the settings-array for the module.
     $this->MOD_MENU = array('users' => array(0 => $GLOBALS['LANG']->getLL('any'), '-1' => $GLOBALS['LANG']->getLL('self')), 'workspaces' => array('-99' => $GLOBALS['LANG']->getLL('any'), 0 => $GLOBALS['LANG']->getLL('live'), '-1' => $GLOBALS['LANG']->getLL('draft')), 'time' => array(0 => $GLOBALS['LANG']->getLL('thisWeek'), 1 => $GLOBALS['LANG']->getLL('lastWeek'), 2 => $GLOBALS['LANG']->getLL('last7Days'), 10 => $GLOBALS['LANG']->getLL('thisMonth'), 11 => $GLOBALS['LANG']->getLL('lastMonth'), 12 => $GLOBALS['LANG']->getLL('last31Days'), 20 => $GLOBALS['LANG']->getLL('noLimit'), 30 => $GLOBALS['LANG']->getLL('userdefined')), 'max' => array(20 => $GLOBALS['LANG']->getLL('20'), 50 => $GLOBALS['LANG']->getLL('50'), 100 => $GLOBALS['LANG']->getLL('100'), 200 => $GLOBALS['LANG']->getLL('200'), 500 => $GLOBALS['LANG']->getLL('500'), 1000 => $GLOBALS['LANG']->getLL('1000'), 1000000 => $GLOBALS['LANG']->getLL('any')), 'action' => array(0 => $GLOBALS['LANG']->getLL('any'), 1 => $GLOBALS['LANG']->getLL('actionDatabase'), 2 => $GLOBALS['LANG']->getLL('actionFile'), 254 => $GLOBALS['LANG']->getLL('actionSettings'), 255 => $GLOBALS['LANG']->getLL('actionLogin'), '-1' => $GLOBALS['LANG']->getLL('actionErrors')), 'manualdate' => '', 'manualdate_end' => '', 'groupByPage' => '');
     // Add custom workspaces (selecting all, filtering by BE_USER check):
     $workspaces = $TYPO3_DB->exec_SELECTgetRows('uid,title', 'sys_workspace', 'pid=0' . t3lib_BEfunc::deleteClause('sys_workspace'), '', 'title');
     if (count($workspaces)) {
         foreach ($workspaces as $rec) {
             $this->MOD_MENU['workspaces'][$rec['uid']] = $rec['uid'] . ': ' . $rec['title'];
         }
     }
     // Adding groups to the users_array
     $groups = t3lib_BEfunc::getGroupNames();
     if (is_array($groups)) {
         foreach ($groups as $grVals) {
             $this->MOD_MENU['users']['gr-' . $grVals['uid']] = $GLOBALS['LANG']->getLL('group') . ' ' . $grVals['title'];
         }
     }
     $users = t3lib_BEfunc::getUserNames();
     if (is_array($users)) {
         foreach ($users as $grVals) {
             $this->MOD_MENU['users']['us-' . $grVals['uid']] = $GLOBALS['LANG']->getLL('user') . ' ' . $grVals['username'];
         }
     }
     // CLEANSE SETTINGS
     $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
     // manual dates
     if ($this->MOD_SETTINGS['time'] == 30) {
         if (!trim($this->MOD_SETTINGS['manualdate'])) {
             $this->theTime = $this->MOD_SETTINGS['manualdate'] = 0;
         } else {
             $this->theTime = $this->parseDate($this->MOD_SETTINGS['manualdate']);
             if (!$this->theTime) {
                 $this->MOD_SETTINGS['manualdate'] = '';
             } else {
                 $this->MOD_SETTINGS['manualdate'] = date($this->dateFormat, $this->theTime);
             }
         }
         if (!trim($this->MOD_SETTINGS['manualdate_end'])) {
             $this->theTime_end = $this->MOD_SETTINGS['manualdate_end'] = 0;
         } else {
             $this->theTime_end = $this->parseDate($this->MOD_SETTINGS['manualdate_end']);
             if (!$this->theTime_end) {
                 $this->MOD_SETTINGS['manualdate_end'] = '';
             } else {
                 $this->MOD_SETTINGS['manualdate_end'] = date($this->dateFormat, $this->theTime_end);
             }
         }
     }
 }