コード例 #1
0
 /**
  * Initialize some local variables to be used during creation of objects
  *
  * @return void
  */
 public function initializeObject()
 {
     $this->beUserList = \TYPO3\CMS\Backend\Utility\BackendUtility::getUserNames();
     /** @var $defaultQuerySettings \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface */
     $defaultQuerySettings = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class);
     $defaultQuerySettings->setRespectStoragePage(false);
     $this->setDefaultQuerySettings($defaultQuerySettings);
 }
コード例 #2
0
    /**
     * Main Task center module
     *
     * @return string HTML content.
     * @todo Define visibility
     */
    public function main()
    {
        if ($id = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('display')) {
            return $this->urlInIframe($this->backPath . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('impexp') . 'app/index.php?tx_impexp[action]=export&preset[load]=1&preset[select]=' . $id, 1);
        } else {
            // Thumbnail folder and files:
            $tempDir = $this->userTempFolder();
            if ($tempDir) {
                $thumbnails = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir($tempDir, 'png,gif,jpg', 1);
            }
            $clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
            $usernames = \TYPO3\CMS\Backend\Utility\BackendUtility::getUserNames();
            // Create preset links:
            $presets = $this->getPresets();
            $opt = array();
            $opt[] = '
			<tr class="bgColor5 tableheader">
				<td>Icon:</td>
				<td>Preset Title:</td>
				<td>Public</td>
				<td>Owner:</td>
				<td>Page:</td>
				<td>Path:</td>
				<td>Meta data:</td>
			</tr>';
            if (is_array($presets)) {
                foreach ($presets as $presetCfg) {
                    $configuration = unserialize($presetCfg['preset_data']);
                    $thumbnailFile = $thumbnails[$configuration['meta']['thumbnail']];
                    $title = strlen($presetCfg['title']) ? $presetCfg['title'] : '[' . $presetCfg['uid'] . ']';
                    $opt[] = '
					<tr class="bgColor4">
						<td>' . ($thumbnailFile ? '<img src="' . $this->backPath . '../' . substr($tempDir, strlen(PATH_site)) . basename($thumbnailFile) . '" hspace="2" width="70" style="border: solid black 1px;" alt="" /><br />' : '&nbsp;') . '</td>
						<td nowrap="nowrap"><a href="index.php?SET[function]=tx_impexp&display=' . $presetCfg['uid'] . '">' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($title, 30)) . '</a>&nbsp;</td>
						<td>' . ($presetCfg['public'] ? 'Yes' : '&nbsp;') . '</td>
						<td>' . ($presetCfg['user_uid'] === $GLOBALS['BE_USER']->user['uid'] ? 'Own' : '[' . $usernames[$presetCfg['user_uid']]['username'] . ']') . '</td>
						<td>' . ($configuration['pagetree']['id'] ? $configuration['pagetree']['id'] : '&nbsp;') . '</td>
						<td>' . htmlspecialchars($configuration['pagetree']['id'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordPath($configuration['pagetree']['id'], $clause, 20) : '[Single Records]') . '</td>
						<td>
							<strong>' . htmlspecialchars($configuration['meta']['title']) . '</strong><br />' . htmlspecialchars($configuration['meta']['description']) . ($configuration['meta']['notes'] ? '<br /><br /><strong>Notes:</strong> <em>' . htmlspecialchars($configuration['meta']['notes']) . '</em>' : '') . '
						</td>
					</tr>';
                }
                $content = '<table border="0" cellpadding="0" cellspacing="1" class="lrPadding">' . implode('', $opt) . '</table>';
            }
        }
        // Output:
        $theOutput .= $this->pObj->doc->spacer(5);
        $theOutput .= $this->pObj->doc->section('Export presets', $content, 0, 1);
        return $theOutput;
    }
コード例 #3
0
 /**
  * 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'][0]) {
         // In case users shall be returned
         case '0':
             $items = BackendUtility::getUserNames();
             if (!$GLOBALS['BE_USER']->isAdmin()) {
                 $items = BackendUtility::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 = BackendUtility::getGroupNames();
             if (!$GLOBALS['BE_USER']->isAdmin()) {
                 $items = BackendUtility::blindGroupNames($items, $BE_USER->userGroupsUID, 1);
             }
             foreach ($items as $row) {
                 $PA['items'][] = array(0 => $row['title'], 1 => $row['uid']);
             }
             break;
         default:
             return;
     }
     return;
 }
コード例 #4
0
 /**
  * Generate the user selector element
  *
  * @param int $page The page id to change the user for
  * @param int $ownerUid The page owner uid
  * @param string $username The username to display
  * @return string The html select element
  */
 protected function renderUserSelector($page, $ownerUid, $username = '')
 {
     $page = (int) $page;
     $ownerUid = (int) $ownerUid;
     // Get usernames
     $beUsers = BackendUtility::getUserNames();
     // Owner selector:
     $options = '';
     // Loop through the users
     foreach ($beUsers as $uid => $row) {
         $uid = (int) $uid;
         $selected = $uid === $ownerUid ? ' selected="selected"' : '';
         $options .= '<option value="' . $uid . '"' . $selected . '>' . htmlspecialchars($row['username']) . '</option>';
     }
     $elementId = 'o_' . $page;
     $options = '<option value="0"></option>' . $options;
     $selector = '<select name="new_page_owner" id="new_page_owner">' . $options . '</select>';
     $saveButton = '<a class="saveowner btn btn-default" data-page="' . $page . '" data-owner="' . $ownerUid . '" data-element-id="' . $elementId . '" title="Change owner">' . $this->iconFactory->getIcon('actions-document-save', Icon::SIZE_SMALL)->render() . '</a>';
     $cancelButton = '<a class="restoreowner btn btn-default" data-page="' . $page . '"  data-owner="' . $ownerUid . '" data-element-id="' . $elementId . '"' . (!empty($username) ? ' data-username="******"' : '') . ' title="Cancel">' . $this->iconFactory->getIcon('actions-document-close', Icon::SIZE_SMALL)->render() . '</a>';
     return '<span id="' . $elementId . '">' . $selector . '<span class="btn-group">' . $saveButton . $cancelButton . '</span>' . '</span>';
 }
コード例 #5
0
 /**
  * Shows the full change log
  *
  * @return string HTML for list, wrapped in a table.
  */
 public function displayHistory()
 {
     if (empty($this->changeLog)) {
         return '';
     }
     $languageService = $this->getLanguageService();
     $lines = array();
     $beUserArray = BackendUtility::getUserNames();
     $i = 0;
     // Traverse changeLog array:
     foreach ($this->changeLog as $sysLogUid => $entry) {
         // stop after maxSteps
         if ($this->maxSteps && $i > $this->maxSteps) {
             break;
         }
         // Show only marked states
         if (!$entry['snapshot'] && $this->showMarked) {
             continue;
         }
         $i++;
         // Build up single line
         $singleLine = array();
         // Get user names
         $userName = $entry['user'] ? $beUserArray[$entry['user']]['username'] : $languageService->getLL('externalChange');
         // Executed by switch-user
         if (!empty($entry['originalUser'])) {
             $userName .= ' (' . $languageService->getLL('viaUser') . ' ' . $beUserArray[$entry['originalUser']]['username'] . ')';
         }
         $singleLine['backendUserName'] = htmlspecialchars($userName);
         $singleLine['backendUserUid'] = $entry['user'];
         // add user name
         // Diff link
         $image = $this->iconFactory->getIcon('actions-document-history-open', Icon::SIZE_SMALL)->render();
         $singleLine['rollbackLink'] = $this->linkPage($image, array('diff' => $sysLogUid));
         // remove first link
         $singleLine['time'] = htmlspecialchars(BackendUtility::datetime($entry['tstamp']));
         // add time
         $singleLine['age'] = htmlspecialchars(BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $entry['tstamp'], $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')));
         // add age
         $singleLine['tableUid'] = $this->linkPage($this->generateTitle($entry['tablename'], $entry['recuid']), array('element' => $entry['tablename'] . ':' . $entry['recuid']), '', $languageService->getLL('linkRecordHistory', true));
         // add record UID
         // Show insert/delete/diff/changed field names
         if ($entry['action']) {
             // insert or delete of element
             $singleLine['action'] = htmlspecialchars($languageService->getLL($entry['action'], true));
         } else {
             // Display field names instead of full diff
             if (!$this->showDiff) {
                 // Re-write field names with labels
                 $tmpFieldList = explode(',', $entry['fieldlist']);
                 foreach ($tmpFieldList as $key => $value) {
                     $tmp = str_replace(':', '', $languageService->sL(BackendUtility::getItemLabel($entry['tablename'], $value), true));
                     if ($tmp) {
                         $tmpFieldList[$key] = $tmp;
                     } else {
                         // remove fields if no label available
                         unset($tmpFieldList[$key]);
                     }
                 }
                 $singleLine['fieldNames'] = htmlspecialchars(implode(',', $tmpFieldList));
             } else {
                 // Display diff
                 $diff = $this->renderDiff($entry, $entry['tablename']);
                 $singleLine['differences'] = $diff;
             }
         }
         // Show link to mark/unmark state
         if (!$entry['action']) {
             if ($entry['snapshot']) {
                 $title = $languageService->getLL('unmarkState', true);
                 $image = $this->iconFactory->getIcon('actions-unmarkstate', Icon::SIZE_SMALL)->render();
             } else {
                 $title = $languageService->getLL('markState', true);
                 $image = $this->iconFactory->getIcon('actions-markstate', Icon::SIZE_SMALL)->render();
             }
             $singleLine['markState'] = $this->linkPage($image, array('highlight' => $entry['uid']), '', $title);
         } else {
             $singleLine['markState'] = '';
         }
         // put line together
         $lines[] = $singleLine;
     }
     $this->view->assign('history', $lines);
     if ($this->lastSyslogId) {
         $this->view->assign('fullViewLink', $this->linkPage($languageService->getLL('fullView', true), array('diff' => '')));
     }
 }
コード例 #6
0
ファイル: StagesService.php プロジェクト: Mr-Robota/TYPO3.CMS
 /**
  * Get uids of all responsilbe persons for a stage
  *
  * @param string $stageRespValue Responsible_person value from stage record
  * @return string Uid list of responsible be_users
  */
 public function getResponsibleUser($stageRespValue)
 {
     $stageValuesArray = GeneralUtility::trimExplode(',', $stageRespValue, TRUE);
     $beuserUidArray = array();
     $begroupUidArray = array();
     foreach ($stageValuesArray as $uidvalue) {
         if (strstr($uidvalue, 'be_users') !== FALSE) {
             // Current value is a uid of a be_user record
             $beuserUidArray[] = str_replace('be_users_', '', $uidvalue);
         } elseif (strstr($uidvalue, 'be_groups') !== FALSE) {
             $begroupUidArray[] = str_replace('be_groups_', '', $uidvalue);
         } elseif ((int) $uidvalue) {
             $beuserUidArray[] = (int) $uidvalue;
         }
     }
     if (!empty($begroupUidArray)) {
         $allBeUserArray = BackendUtility::getUserNames();
         $begroupUidList = implode(',', $begroupUidArray);
         $this->userGroups = array();
         $begroupUidArray = $this->fetchGroups($begroupUidList);
         foreach ($begroupUidArray as $groupkey => $groupData) {
             foreach ($allBeUserArray as $useruid => $userdata) {
                 if (GeneralUtility::inList($userdata['usergroup_cached_list'], $groupData['uid'])) {
                     $beuserUidArray[] = $useruid;
                 }
             }
         }
     }
     array_unique($beuserUidArray);
     return implode(',', $beuserUidArray);
 }
コード例 #7
0
ファイル: RecordHistory.php プロジェクト: graurus/testgit_t37
    /**
     * Shows the full change log
     *
     * @return string HTML for list, wrapped in a table.
     */
    public function displayHistory()
    {
        if (empty($this->changeLog)) {
            return '';
        }
        $languageService = $this->getLanguageService();
        $lines = array();
        // Initialize:
        $lines[] = '<thead><tr>
				<th>' . $languageService->getLL('rollback', true) . '</th>
				<th>' . $languageService->getLL('time', true) . '</th>
				<th>' . $languageService->getLL('age', true) . '</th>
				<th>' . $languageService->getLL('user', true) . '</th>
				<th>' . $languageService->getLL('tableUid', true) . '</th>
				<th>' . $languageService->getLL('differences', true) . '</th>
				<th>&nbsp;</th>
			</tr></thead>';
        $beUserArray = BackendUtility::getUserNames();
        $i = 0;
        /** @var Avatar $avatar */
        $avatar = GeneralUtility::makeInstance(Avatar::class);
        // Traverse changeLog array:
        foreach ($this->changeLog as $sysLogUid => $entry) {
            // stop after maxSteps
            if ($this->maxSteps && $i > $this->maxSteps) {
                break;
            }
            // Show only marked states
            if (!$entry['snapshot'] && $this->showMarked) {
                continue;
            }
            $i++;
            // Get user names
            $userName = $entry['user'] ? $beUserArray[$entry['user']]['username'] : $languageService->getLL('externalChange', true);
            // Build up single line
            $singleLine = array();
            // Diff link
            $image = '<span title="' . $languageService->getLL('sumUpChanges', true) . '">' . $this->iconFactory->getIcon('actions-document-history-open', Icon::SIZE_SMALL)->render() . '</span>';
            $singleLine[] = '<span>' . $this->linkPage($image, array('diff' => $sysLogUid)) . '</span>';
            // remove first link
            $singleLine[] = htmlspecialchars(BackendUtility::datetime($entry['tstamp']));
            // add time
            $singleLine[] = htmlspecialchars(BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $entry['tstamp'], $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')));
            // add age
            $userEntry = is_array($beUserArray[$entry['user']]) ? $beUserArray[$entry['user']] : null;
            $singleLine[] = $avatar->render($userEntry) . ' ' . htmlspecialchars($userName);
            // add user name
            $singleLine[] = $this->linkPage($this->generateTitle($entry['tablename'], $entry['recuid']), array('element' => $entry['tablename'] . ':' . $entry['recuid']), '', $languageService->getLL('linkRecordHistory', true));
            // add record UID
            // Show insert/delete/diff/changed field names
            if ($entry['action']) {
                // insert or delete of element
                $singleLine[] = '<strong>' . htmlspecialchars($languageService->getLL($entry['action'], true)) . '</strong>';
            } else {
                // Display field names instead of full diff
                if (!$this->showDiff) {
                    // Re-write field names with labels
                    $tmpFieldList = explode(',', $entry['fieldlist']);
                    foreach ($tmpFieldList as $key => $value) {
                        $tmp = str_replace(':', '', $languageService->sl(BackendUtility::getItemLabel($entry['tablename'], $value), true));
                        if ($tmp) {
                            $tmpFieldList[$key] = $tmp;
                        } else {
                            // remove fields if no label available
                            unset($tmpFieldList[$key]);
                        }
                    }
                    $singleLine[] = htmlspecialchars(implode(',', $tmpFieldList));
                } else {
                    // Display diff
                    $diff = $this->renderDiff($entry, $entry['tablename']);
                    $singleLine[] = $diff;
                }
            }
            // Show link to mark/unmark state
            if (!$entry['action']) {
                if ($entry['snapshot']) {
                    $title = $languageService->getLL('unmarkState', true);
                    $image = $this->iconFactory->getIcon('actions-unmarkstate', Icon::SIZE_SMALL)->render();
                } else {
                    $title = $languageService->getLL('markState', true);
                    $image = $this->iconFactory->getIcon('actions-markstate', Icon::SIZE_SMALL)->render();
                }
                $singleLine[] = $this->linkPage($image, array('highlight' => $entry['uid']), '', $title);
            } else {
                $singleLine[] = '';
            }
            // put line together
            $lines[] = '
				<tr>
					<td>' . implode('</td><td>', $singleLine) . '</td>
				</tr>';
        }
        // @TODO: introduce Fluid Standalone view and use callout viewHelper
        $theCode = '<div class="callout callout-info">' . '<div class="media"><div class="media-left"><span class="fa-stack fa-lg callout-icon"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-info fa-stack-1x"></i></span></div>' . '<div class="media-body">' . '<p>' . $languageService->getLL('differenceMsg') . '</p>' . '	<div class="callout-body">' . '	</div></div></div></div>';
        // Finally, put it all together:
        $theCode .= '
			<!--
				History (list):
			-->

			<table class="table table-striped table-hover table-vertical-top" id="typo3-history">
				' . implode('', $lines) . '
			</table>';
        if ($this->lastSyslogId) {
            $theCode .= '<br />' . $this->linkPage('<span class="btn btn-default">' . $languageService->getLL('fullView', true) . '</span>', array('diff' => ''));
        }
        $theCode .= '<br /><br />';
        // Add the whole content as a module section:
        return '<h2>' . $languageService->getLL('changes', true) . '</h2><div>' . $theCode . '</div>';
    }
コード例 #8
0
 /**
  * Will make the simulate-user selector if the logged in user is administrator.
  * It will also set the GLOBAL(!) BE_USER to the simulated user selected if any (and set $this->OLD_BE_USER to logged in user)
  *
  * @return void
  */
 public function simulateUser()
 {
     // If admin, allow simulation of another user
     $this->simUser = 0;
     $this->simulateSelector = '';
     unset($this->OLD_BE_USER);
     if ($GLOBALS['BE_USER']->isAdmin()) {
         $this->simUser = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('simUser'));
         // Make user-selector:
         $users = \TYPO3\CMS\Backend\Utility\BackendUtility::getUserNames('username,usergroup,usergroup_cached_list,uid,realName', \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('be_users'));
         $opt = array();
         foreach ($users as $rr) {
             if ($rr['uid'] != $GLOBALS['BE_USER']->user['uid']) {
                 $opt[] = '<option value="' . $rr['uid'] . '"' . ($this->simUser == $rr['uid'] ? ' selected="selected"' : '') . '>' . htmlspecialchars($rr['username'] . ' (' . $rr['realName'] . ')') . '</option>';
             }
         }
         if (count($opt)) {
             $this->simulateSelector = '<select ' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . ' id="field_simulate" name="simulateUser" onchange="window.location.href=\'' . \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('user_setup') . '&simUser=\'+this.options[this.selectedIndex].value;"><option></option>' . implode('', $opt) . '</select>';
         }
     }
     // This can only be set if the previous code was executed.
     if ($this->simUser > 0) {
         // Save old user...
         $this->OLD_BE_USER = $GLOBALS['BE_USER'];
         unset($GLOBALS['BE_USER']);
         // Unset current
         // New backend user object
         $BE_USER = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication');
         $BE_USER->OS = TYPO3_OS;
         $BE_USER->setBeUserByUid($this->simUser);
         $BE_USER->fetchGroupData();
         $BE_USER->backendSetUC();
         // Must do this, because unsetting $BE_USER before apparently unsets the reference to the global variable by this name!
         $GLOBALS['BE_USER'] = $BE_USER;
     }
 }
コード例 #9
0
 /**
  * Generate the user selector element
  *
  * @param integer $page The page id to change the user for
  * @param integer $ownerUid The page owner uid
  * @param string $username The username to display
  * @return string The html select element
  */
 protected function renderUserSelector($page, $ownerUid, $username = '')
 {
     // Get usernames
     $beUsers = BackendUtility::getUserNames();
     // Init groupArray
     $groups = array();
     if (!$GLOBALS['BE_USER']->isAdmin()) {
         $beUsers = BackendUtility::blindUserNames($beUsers, $groups, 1);
     }
     // Owner selector:
     $options = '';
     // Loop through the users
     foreach ($beUsers as $uid => $row) {
         $selected = $uid == $ownerUid ? ' selected="selected"' : '';
         $options .= '<option value="' . $uid . '"' . $selected . '>' . htmlspecialchars($row['username']) . '</option>';
     }
     $elementId = 'o_' . $page;
     $options = '<option value="0"></option>' . $options;
     $selector = '<select name="new_page_owner" id="new_page_owner">' . $options . '</select>';
     $saveButton = '<a onclick="WebPermissions.changeOwner(' . $page . ', ' . $ownerUid . ', \'' . $elementId . '\');" title="Change owner">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-save') . '</a>';
     $cancelButton = '<a onclick="WebPermissions.restoreOwner(' . $page . ', ' . $ownerUid . ', \'' . ($username == '' ? '<span class=not_set>[not set]</span>' : htmlspecialchars($username)) . '\', \'' . $elementId . '\');" title="Cancel">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-close') . '</a>';
     $ret = $selector . $saveButton . $cancelButton;
     return $ret;
 }
コード例 #10
0
ファイル: RecordHistory.php プロジェクト: Mr-Robota/TYPO3.CMS
    /**
     * Shows the full change log
     *
     * @return string HTML for list, wrapped in a table.
     * @todo Define visibility
     */
    public function displayHistory()
    {
        $lines = array();
        // Initialize:
        $lines[] = '<thead><tr>
				<th> </th>
				<th>' . $GLOBALS['LANG']->getLL('time', 1) . '</th>
				<th>' . $GLOBALS['LANG']->getLL('age', 1) . '</th>
				<th>' . $GLOBALS['LANG']->getLL('user', 1) . '</th>
				<th>' . $GLOBALS['LANG']->getLL('tableUid', 1) . '</th>
				<th>' . $GLOBALS['LANG']->getLL('differences', 1) . '</th>
				<th>&nbsp;</th>
			</tr></thead>';
        $be_user_array = BackendUtility::getUserNames();
        // Traverse changelog array:
        if (!$this->changeLog) {
            return 0;
        }
        $i = 0;
        foreach ($this->changeLog as $sysLogUid => $entry) {
            // stop after maxSteps
            if ($i > $this->maxSteps && $this->maxSteps) {
                break;
            }
            // Show only marked states
            if (!$entry['snapshot'] && $this->showMarked) {
                continue;
            }
            $i++;
            // Get user names
            $userName = $entry['user'] ? $be_user_array[$entry['user']]['username'] : $GLOBALS['LANG']->getLL('externalChange', 1);
            // Build up single line
            $singleLine = array();
            // Diff link
            $image = IconUtility::getSpriteIcon('actions-view-go-forward', array('title' => $GLOBALS['LANG']->getLL('sumUpChanges', TRUE)));
            $singleLine[] = '<span>' . $this->linkPage($image, array('diff' => $sysLogUid)) . '</span>';
            // remove first link
            $singleLine[] = htmlspecialchars(BackendUtility::datetime($entry['tstamp']));
            // add time
            $singleLine[] = htmlspecialchars(BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $entry['tstamp'], $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')));
            // add age
            $singleLine[] = htmlspecialchars($userName);
            // add user name
            $singleLine[] = $this->linkPage($this->generateTitle($entry['tablename'], $entry['recuid']), array('element' => $entry['tablename'] . ':' . $entry['recuid']), '', $GLOBALS['LANG']->getLL('linkRecordHistory', 1));
            // add record UID
            // Show insert/delete/diff/changed field names
            if ($entry['action']) {
                // insert or delete of element
                $singleLine[] = '<strong>' . htmlspecialchars($GLOBALS['LANG']->getLL($entry['action'], 1)) . '</strong>';
            } else {
                // Display field names instead of full diff
                if (!$this->showDiff) {
                    // Re-write field names with labels
                    $tmpFieldList = explode(',', $entry['fieldlist']);
                    foreach ($tmpFieldList as $key => $value) {
                        $tmp = str_replace(':', '', $GLOBALS['LANG']->sl(BackendUtility::getItemLabel($entry['tablename'], $value), 1));
                        if ($tmp) {
                            $tmpFieldList[$key] = $tmp;
                        } else {
                            // remove fields if no label available
                            unset($tmpFieldList[$key]);
                        }
                    }
                    $singleLine[] = htmlspecialchars(implode(',', $tmpFieldList));
                } else {
                    // Display diff
                    $diff = $this->renderDiff($entry, $entry['tablename']);
                    $singleLine[] = $diff;
                }
            }
            // Show link to mark/unmark state
            if (!$entry['action']) {
                if ($entry['snapshot']) {
                    $image = IconUtility::getSpriteIcon('actions-unmarkstate', array('title' => $GLOBALS['LANG']->getLL('unmarkState', TRUE)), array());
                } else {
                    $image = IconUtility::getSpriteIcon('actions-markstate', array('title' => $GLOBALS['LANG']->getLL('markState', TRUE)), array());
                }
                $singleLine[] = $this->linkPage($image, array('highlight' => $entry['uid']));
            } else {
                $singleLine[] = '';
            }
            // put line together
            $lines[] = '
				<tr>
					<td>' . implode('</td><td>', $singleLine) . '</td>
				</tr>';
        }
        // Finally, put it all together:
        $theCode = '
			<!--
				History (list):
			-->
			<table class="t3-table" id="typo3-history">
				' . implode('', $lines) . '
			</table>';
        if ($this->lastSyslogId) {
            $theCode .= '<br />' . $this->linkPage(IconUtility::getSpriteIcon('actions-move-to-bottom', array('title' => $GLOBALS['LANG']->getLL('fullView', TRUE))), array('diff' => ''));
        }
        // Add message about the difference view.
        $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('differenceMsg'), '', \TYPO3\CMS\Core\Messaging\FlashMessage::INFO);
        $theCode .= '<br /><br />' . $flashMessage->render() . '<br />';
        // Add the whole content as a module section:
        return $GLOBALS['SOBE']->doc->section($GLOBALS['LANG']->getLL('changes'), $theCode, FALSE, TRUE);
    }
コード例 #11
0
 /**
  * Gets backend user records from a given list of ids.
  *
  * @param string $backendUserList
  * @return array
  */
 public function getBackendUsers($backendUserList)
 {
     if (empty($backendUserList)) {
         return [];
     }
     $backendUserList = implode(',', GeneralUtility::intExplode(',', $backendUserList));
     $backendUsers = BackendUtility::getUserNames('username, uid, email, realName', 'AND uid IN (' . $backendUserList . ')' . BackendUtility::BEenableFields('be_users'));
     if (empty($backendUsers)) {
         $backendUsers = [];
     }
     return $backendUsers;
 }
コード例 #12
0
    /**
     * Showing the permissions in a tree ($this->edit = FALSE)
     * (Adding content to internal content variable)
     *
     * @return void
     */
    public function notEdit()
    {
        // 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 = $GLOBALS['BE_USER']->userGroupsUID;
        $beUserArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getUserNames();
        if (!$GLOBALS['BE_USER']->isAdmin()) {
            $beUserArray = \TYPO3\CMS\Backend\Utility\BackendUtility::blindUserNames($beUserArray, $beGroupKeys, 0);
        }
        $beGroupArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getGroupNames();
        if (!$GLOBALS['BE_USER']->isAdmin()) {
            $beGroupArray = \TYPO3\CMS\Backend\Utility\BackendUtility::blindGroupNames($beGroupArray, $beGroupKeys, 0);
        }
        // Length of strings:
        $tLen = $this->MOD_SETTINGS['mode'] == 'perms' ? 20 : 30;
        // Selector for depth:
        $code = $GLOBALS['LANG']->getLL('Depth') . ': ';
        $code .= \TYPO3\CMS\Backend\Utility\BackendUtility::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 = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\View\\PageTreeView');
        $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 = \TYPO3\CMS\Backend\Utility\IconUtility::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' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td>' . $GLOBALS['LANG']->getLL('Owner', TRUE) . '</td>
					<td><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td align="center">' . $GLOBALS['LANG']->getLL('Group', TRUE) . '</td>
					<td><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td align="center">' . $GLOBALS['LANG']->getLL('Everybody', TRUE) . '</td>
					<td><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td align="center">' . $GLOBALS['LANG']->getLL('EditLock', TRUE) . '</td>
				</tr>
			';
        } else {
            $code .= '
				<tr class="t3-row-header">
					<td colspan="2">&nbsp;</td>
					<td><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td align="center" nowrap="nowrap">' . $GLOBALS['LANG']->getLL('User', TRUE) . ': ' . htmlspecialchars($GLOBALS['BE_USER']->user['username']) . '</td>
					' . (!$GLOBALS['BE_USER']->isAdmin() ? '<td><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td align="center">' . $GLOBALS['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 = \TYPO3\CMS\Perm\Controller\PermissionAjaxController::renderOwnername($pageId, $data['row']['perms_userid'], htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($userName, 20)), FALSE);
            } else {
                $userName = \TYPO3\CMS\Perm\Controller\PermissionAjaxController::renderOwnername($pageId, $data['row']['perms_userid'], htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::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 = \TYPO3\CMS\Perm\Controller\PermissionAjaxController::renderGroupname($pageId, $data['row']['perms_groupid'], htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($groupName, 20)), FALSE);
            } else {
                $groupName = \TYPO3\CMS\Perm\Controller\PermissionAjaxController::renderGroupname($pageId, $data['row']['perms_groupid'], htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($groupName, 20)));
            }
            // Seeing if editing of permissions are allowed for that page:
            $editPermsAllowed = $data['row']['perms_userid'] == $GLOBALS['BE_USER']->user['uid'] || $GLOBALS['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(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($data['row']['title'], $tLen)) . '&nbsp;</td>';
            // "Edit permissions" -icon
            if ($editPermsAllowed && $pageId) {
                $aHref = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_perm') . '&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="' . $GLOBALS['LANG']->getLL('ch_permissions', 1) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::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' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td' . $bgCol . ' nowrap="nowrap">' . ($pageId ? \TYPO3\CMS\Perm\Controller\PermissionAjaxController::renderPermissions($data['row']['perms_user'], $pageId, 'user') . ' ' . $userName : '') . '</td>

					<td' . $bgCol . ' class="center"><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td' . $bgCol . ' nowrap="nowrap">' . ($pageId ? \TYPO3\CMS\Perm\Controller\PermissionAjaxController::renderPermissions($data['row']['perms_group'], $pageId, 'group') . ' ' . $groupName : '') . '</td>

					<td' . $bgCol . ' class="center"><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td' . $bgCol . ' nowrap="nowrap">' . ($pageId ? ' ' . \TYPO3\CMS\Perm\Controller\PermissionAjaxController::renderPermissions($data['row']['perms_everybody'], $pageId, 'everybody') : '') . '</td>

					<td' . $bgCol . ' class="center"><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['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="' . $GLOBALS['LANG']->getLL('EditLock_descr', 1) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::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' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>';
                $bgCol = $GLOBALS['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 . \TYPO3\CMS\Perm\Controller\PermissionAjaxController::renderPermissions($GLOBALS['BE_USER']->calcPerms($data['row']), $pageId, 'user') : '') . '</td>
					' . (!$GLOBALS['BE_USER']->isAdmin() ? '
					<td' . $bgCol . ' class="center"><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td' . $bgCol . ' nowrap="nowrap">' . ($data['row']['editlock'] ? \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('status-warning-lock', array('title' => $GLOBALS['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 .= \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('xMOD_csh_corebe', 'perm_module', $GLOBALS['BACK_PATH'], '<br />|');
        // Creating legend table:
        $legendText = '<strong>' . $GLOBALS['LANG']->getLL('1', 1) . '</strong>: ' . $GLOBALS['LANG']->getLL('1_t', 1);
        $legendText .= '<br /><strong>' . $GLOBALS['LANG']->getLL('16', 1) . '</strong>: ' . $GLOBALS['LANG']->getLL('16_t', 1);
        $legendText .= '<br /><strong>' . $GLOBALS['LANG']->getLL('2', 1) . '</strong>: ' . $GLOBALS['LANG']->getLL('2_t', 1);
        $legendText .= '<br /><strong>' . $GLOBALS['LANG']->getLL('4', 1) . '</strong>: ' . $GLOBALS['LANG']->getLL('4_t', 1);
        $legendText .= '<br /><strong>' . $GLOBALS['LANG']->getLL('8', 1) . '</strong>: ' . $GLOBALS['LANG']->getLL('8_t', 1);
        $code = '<table border="0" id="typo3-legendTable">
			<tr>
				<td valign="top">
					<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['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">' . $GLOBALS['LANG']->getLL('def', 1);
        $code .= '<br /><br />' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('status-status-permission-granted') . ': ' . $GLOBALS['LANG']->getLL('A_Granted', 1);
        $code .= '<br />' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('status-status-permission-denied') . ': ' . $GLOBALS['LANG']->getLL('A_Denied', 1);
        $code .= '</div>';
        // Adding section with legend code:
        $this->content .= $this->doc->spacer(20);
        $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('Legend') . ':', $code, 0, 1);
    }
コード例 #13
0
ファイル: StagesService.php プロジェクト: burguin/test01
 /**
  * Gets backend user records from a given list of ids.
  *
  * @param string $backendUserList
  * @return array
  */
 public function getBackendUsers($backendUserList)
 {
     if (empty($backendUserList)) {
         return array();
     }
     $backendUserList = $this->getDatabaseConnection()->cleanIntList($backendUserList);
     $backendUsers = BackendUtility::getUserNames('username, uid, email, realName', 'AND uid IN (' . $backendUserList . ')' . BackendUtility::BEenableFields('be_users'));
     if (empty($backendUsers)) {
         $backendUsers = array();
     }
     return $backendUsers;
 }
コード例 #14
0
    /**
     * Creates an info-box for the current page (identified by input record).
     *
     * @param array $rec Page record
     * @param boolean $edit If set, there will be shown an edit icon, linking to editing of the page properties.
     * @return string HTML for the box.
     * @deprecated and unused since 6.0, will be removed two versions later
     * @todo Define visibility
     */
    public function getPageInfoBox($rec, $edit = 0)
    {
        \TYPO3\CMS\Core\Utility\GeneralUtility::logDeprecatedFunction();
        // If editing of the page properties is allowed:
        if ($edit) {
            $params = '&edit[pages][' . $rec['uid'] . ']=edit';
            $editIcon = '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick($params, $this->backPath)) . '" title="' . $GLOBALS['LANG']->getLL('edit', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open') . '</a>';
        } else {
            $editIcon = $this->noEditIcon('noEditPage');
        }
        // Setting page icon, link, title:
        $outPutContent = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $rec, array('title' => \TYPO3\CMS\Backend\Utility\BackendUtility::titleAttribForPages($rec))) . $editIcon . '&nbsp;' . htmlspecialchars($rec['title']);
        // Init array where infomation is accumulated as label/value pairs.
        $lines = array();
        // Owner user/group:
        if ($this->pI_showUser) {
            // User:
            $users = \TYPO3\CMS\Backend\Utility\BackendUtility::getUserNames('username,usergroup,usergroup_cached_list,uid,realName');
            $groupArray = explode(',', $GLOBALS['BE_USER']->user['usergroup_cached_list']);
            $users = \TYPO3\CMS\Backend\Utility\BackendUtility::blindUserNames($users, $groupArray);
            $lines[] = array($GLOBALS['LANG']->getLL('pI_crUser') . ':', htmlspecialchars($users[$rec['cruser_id']]['username']) . ' (' . $users[$rec['cruser_id']]['realName'] . ')');
        }
        // Created:
        $lines[] = array($GLOBALS['LANG']->getLL('pI_crDate') . ':', \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($rec['crdate']) . ' (' . \TYPO3\CMS\Backend\Utility\BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $rec['crdate'], $this->agePrefixes) . ')');
        // Last change:
        $lines[] = array($GLOBALS['LANG']->getLL('pI_lastChange') . ':', \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($rec['tstamp']) . ' (' . \TYPO3\CMS\Backend\Utility\BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $rec['tstamp'], $this->agePrefixes) . ')');
        // Last change of content:
        if ($rec['SYS_LASTCHANGED']) {
            $lines[] = array($GLOBALS['LANG']->getLL('pI_lastChangeContent') . ':', \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($rec['SYS_LASTCHANGED']) . ' (' . \TYPO3\CMS\Backend\Utility\BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $rec['SYS_LASTCHANGED'], $this->agePrefixes) . ')');
        }
        // Spacer:
        $lines[] = '';
        // Display contents of certain page fields, if any value:
        $dfields = explode(',', 'alias,target,hidden,starttime,endtime,fe_group,no_cache,cache_timeout,newUntil,lastUpdated,subtitle,keywords,description,abstract,author,author_email');
        foreach ($dfields as $fV) {
            if ($rec[$fV]) {
                $lines[] = array($GLOBALS['LANG']->sL(\TYPO3\CMS\Backend\Utility\BackendUtility::getItemLabel('pages', $fV)), \TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValue('pages', $fV, $rec[$fV]));
            }
        }
        // Finally, wrap the elements in the $lines array in table cells/rows
        foreach ($lines as $fV) {
            if (is_array($fV)) {
                if (!$fV[2]) {
                    $fV[1] = htmlspecialchars($fV[1]);
                }
                $out .= '
				<tr>
					<td class="bgColor4" nowrap="nowrap"><strong>' . htmlspecialchars($fV[0]) . '&nbsp;&nbsp;</strong></td>
					<td class="bgColor4">' . $fV[1] . '</td>
				</tr>';
            } else {
                $out .= '
				<tr>
					<td colspan="2"><img src="clear.gif" width="1" height="3" alt="" /></td>
				</tr>';
            }
        }
        // Wrap table tags around...
        $outPutContent .= '



			<!--
				Page info box:
			-->
			<table border="0" cellpadding="0" cellspacing="1" id="typo3-page-info">
				' . $out . '
			</table>';
        // ... and return it.
        return $outPutContent;
    }
コード例 #15
0
 /**
  * Will make the simulate-user selector if the logged in user is administrator.
  * It will also set the GLOBAL(!) BE_USER to the simulated user selected if any (and set $this->OLD_BE_USER to logged in user)
  *
  * @return void
  */
 public function simulateUser()
 {
     // If admin, allow simulation of another user
     $this->simUser = 0;
     $this->simulateSelector = '';
     unset($this->OLD_BE_USER);
     if ($this->getBackendUser()->isAdmin()) {
         $this->simUser = (int) GeneralUtility::_GP('simUser');
         // Make user-selector:
         $db = $this->getDatabaseConnection();
         $where = 'AND username NOT LIKE ' . $db->fullQuoteStr($db->escapeStrForLike('_cli_', 'be_users') . '%', 'be_users');
         $where .= ' AND uid <> ' . (int) $this->getBackendUser()->user['uid'] . BackendUtility::BEenableFields('be_users');
         $users = BackendUtility::getUserNames('username,usergroup,usergroup_cached_list,uid,realName', $where);
         $opt = array();
         foreach ($users as $rr) {
             $label = htmlspecialchars($rr['username'] . ($rr['realName'] ? ' (' . $rr['realName'] . ')' : ''));
             $opt[] = '<option value="' . $rr['uid'] . '"' . ($this->simUser == $rr['uid'] ? ' selected="selected"' : '') . '>' . $label . '</option>';
         }
         if (!empty($opt)) {
             $this->simulateSelector = '<select id="field_simulate" name="simulateUser" onchange="window.location.href=' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('user_setup') . '&simUser='******'+this.options[this.selectedIndex].value;"><option></option>' . implode('', $opt) . '</select>';
         }
     }
     // This can only be set if the previous code was executed.
     if ($this->simUser > 0) {
         // Save old user...
         $this->OLD_BE_USER = $this->getBackendUser();
         unset($GLOBALS['BE_USER']);
         // Unset current
         // New backend user object
         $BE_USER = GeneralUtility::makeInstance(BackendUserAuthentication::class);
         $BE_USER->setBeUserByUid($this->simUser);
         $BE_USER->fetchGroupData();
         $BE_USER->backendSetUC();
         // Must do this, because unsetting $BE_USER before apparently unsets the reference to the global variable by this name!
         $GLOBALS['BE_USER'] = $BE_USER;
     }
 }
コード例 #16
0
 /**
  * Create options for the user / group drop down.
  * This is not moved to a repository by intention to not mix up this 'meta' data
  * with real repository work
  *
  * @return array Key is the option name, value its label
  */
 protected function createUserAndGroupListForSelectOptions()
 {
     $userGroupArray = array();
     // Two meta entries: 'all' and 'self'
     $userGroupArray[0] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('allUsers', 'Belog');
     $userGroupArray[-1] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('self', 'Belog');
     // List of groups, key is gr-'uid'
     $groups = \TYPO3\CMS\Backend\Utility\BackendUtility::getGroupNames();
     foreach ($groups as $group) {
         $userGroupArray['gr-' . $group['uid']] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('group', 'Belog') . ' ' . $group['title'];
     }
     // List of users, key is us-'uid'
     $users = \TYPO3\CMS\Backend\Utility\BackendUtility::getUserNames();
     foreach ($users as $user) {
         $userGroupArray['us-' . $user['uid']] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('user', 'Belog') . ' ' . $user['username'];
     }
     return $userGroupArray;
 }
コード例 #17
0
 /**
  * Get a list of all backend users that are not deleted
  *
  * @return array
  */
 protected function getBackendUsers()
 {
     return \TYPO3\CMS\Backend\Utility\BackendUtility::getUserNames();
 }
コード例 #18
0
    /**
     * Showing the permissions in a tree ($this->edit = false)
     * (Adding content to internal content variable).
     *
     * @return void
     */
    public function notEdit()
    {
        $backendUser = $this->getBackendUser();
        $language = $this->getLanguageService();
        // stores which depths already have their last item
        $depthStop = array();
        $lastDepth = 0;
        // 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 = $backendUser->userGroupsUID;
        $beUserArray = BackendUtility::getUserNames();
        if (!$backendUser->isAdmin()) {
            $beUserArray = BackendUtility::blindUserNames($beUserArray, $beGroupKeys, 0);
        }
        $beGroupArray = BackendUtility::getGroupNames();
        if (!$backendUser->isAdmin()) {
            $beGroupArray = BackendUtility::blindGroupNames($beGroupArray, $beGroupKeys, 0);
        }
        // Length of strings:
        $tLen = 20;
        // Selector for depth:
        $code = $language->getLL('Depth') . ': ';
        $code .= BackendUtility::getFuncMenu($this->categoryUid, 'SET[depth]', $this->MOD_SETTINGS['depth'], $this->MOD_MENU['depth']);
        $this->content .= $this->doc->section('', $code);
        // Initialize tree object:
        /**
         * Category tree.
         *
         * @var \CommerceTeam\Commerce\Tree\CategoryTree $tree
         */
        $tree = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Tree\\CategoryTree');
        $tree->setBare();
        $tree->init();
        $tree->readRecursively($this->categoryUid, $this->MOD_SETTINGS['depth']);
        // Creating top icon; the current page
        $rootIcon = IconUtility::getSpriteIcon('apps-pagetree-root');
        // Create the tree from $this->categoryUid:
        $tree->getTree();
        $tree = $tree->getRecordsAsArray($this->categoryUid);
        // Make header of table:
        $code = '
			<thead>
				<tr>
					<th colspan="2">&nbsp;</th>
					<th>' . $language->getLL('Owner', true) . '</th>
					<th align="center">' . $language->getLL('Group', true) . '</th>
					<th align="center">' . $language->getLL('Everybody', true) . '</th>
					<th align="center">' . $language->getLL('EditLock', true) . '</th>
				</tr>
			</thead>
		';
        // Traverse tree:
        foreach ($tree as $data) {
            $cells = array();
            $pageId = $data['row']['uid'];
            // Background colors:
            $bgCol = $this->lastEdited == $pageId ? ' class="bgColor-20"' : '';
            // User/Group names:
            $userId = $data['row']['perms_userid'];
            $userName = $beUserArray[$userId] ? $beUserArray[$userId]['username'] : $userId;
            if ($userId && !$beUserArray[$userId]) {
                $userName = PermissionAjaxController::renderOwnername($pageId, $userId, htmlspecialchars(GeneralUtility::fixed_lgd_cs($userName, 20)), false);
            } else {
                $userName = PermissionAjaxController::renderOwnername($pageId, $userId, htmlspecialchars(GeneralUtility::fixed_lgd_cs($userName, 20)));
            }
            $groupId = $data['row']['perms_groupid'] ? $data['row']['perms_groupid'] : '';
            $groupName = $beGroupArray[$groupId] ? $beGroupArray[$groupId]['title'] : $groupId;
            if ($groupId && !$beGroupArray[$groupId]) {
                $groupName = PermissionAjaxController::renderGroupname($pageId, $groupId, htmlspecialchars(GeneralUtility::fixed_lgd_cs($groupName, 20)), false);
            } else {
                $groupName = PermissionAjaxController::renderGroupname($pageId, $groupId, htmlspecialchars(GeneralUtility::fixed_lgd_cs($groupName, 20)));
            }
            // Seeing if editing of permissions are allowed for that page:
            $editPermsAllowed = $userId == $backendUser->user['uid'] || $backendUser->isAdmin();
            // First column:
            // @todo check for better solution
            $plusMinusIcon = '';
            // Add PM only if we are not looking at the root
            if ($data['depth'] > 0) {
                // Add simple join-images for categories that are deeper level than 1
                if ($data['depth'] > 1) {
                    $k = $data['depth'];
                    for ($j = 1; $j < $k; ++$j) {
                        if (!array_key_exists($j, $depthStop) || $depthStop[$j] != 1) {
                            $plusMinusIcon .= IconUtility::getSpriteIcon('treeline-line');
                        } elseif ($depthStop[$j] == 1) {
                            $plusMinusIcon .= IconUtility::getSpriteIcon('treeline-blank');
                        }
                    }
                }
                if ($lastDepth > $data['depth']) {
                    for ($j = $data['depth'] + 1; $j <= $lastDepth; ++$j) {
                        $depthStop[$j] = 0;
                    }
                }
                // Add cross or bottom
                $bottom = true == $data['last'] ? 'bottom' : '';
                // save that the depth of the current record has its last item - is used to
                // add blanks, not lines to following deeper elements
                if (true == $data['last']) {
                    $depthStop[$data['depth']] = 1;
                }
                $lastDepth = $data['depth'];
                $plusMinusIcon .= IconUtility::getSpriteIcon('treeline-join' . $bottom);
            }
            // determine which icon to use
            $rowIcon = $plusMinusIcon . ($pageId ? IconUtility::getSpriteIconForRecord('tx_commerce_categories', $data['row']) : $rootIcon);
            // @todo end of check for better solution
            // First column:
            $cellAttrib = $data['row']['_CSSCLASS'] ? ' class="' . $data['row']['_CSSCLASS'] . '"' : '';
            $cells[] = '<td align="left" nowrap="nowrap"' . ($cellAttrib ? $cellAttrib : $bgCol) . '>' . $rowIcon . htmlspecialchars(GeneralUtility::fixed_lgd_cs($data['row']['title'], $tLen)) . '</td>';
            // "Edit permissions" -icon
            if ($editPermsAllowed && $pageId) {
                $aHref = BackendUtility::getModuleUrl('commerce_permission') . '&mode=' . $this->MOD_SETTINGS['mode'] . '&depth=' . $this->MOD_SETTINGS['depth'] . '&control[tx_commerce_categories][uid]=' . ($data['row']['_ORIG_uid'] ? $data['row']['_ORIG_uid'] : $pageId) . '&return_id=' . $this->id . '&edit=1';
                $cells[] = '<td' . $bgCol . '><a href="' . htmlspecialchars($aHref) . '" title="' . $language->getLL('ch_permissions', 1) . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a></td>';
            } else {
                $cells[] = LF . '<td' . $bgCol . '></td>';
            }
            $userPermission = PermissionAjaxController::renderPermissions($data['row']['perms_user'], $pageId, 'user');
            $groupPermission = PermissionAjaxController::renderPermissions($data['row']['perms_group'], $pageId, 'group');
            $allPermission = PermissionAjaxController::renderPermissions($data['row']['perms_everybody'], $pageId, 'everybody');
            $userPermissionLabel = $pageId ? $userPermission . ' ' . $userName : '';
            $groupPermissionLabel = $pageId ? $groupPermission . ' ' . $groupName : '';
            $allPermissionLabel = $pageId ? ' ' . $allPermission : '';
            if ($data['row']['editlock']) {
                $editLockLabel = '<span id="el_' . $pageId . '" class="editlock"><a class="editlock"
                    onclick="WebPermissions.toggleEditLock(\'' . $pageId . '\', \'1\');" title="' . $language->getLL('EditLock_descr', true) . '">' . IconUtility::getSpriteIcon('status-warning-lock') . '</a></span>';
            } else {
                $editLockLabel = $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>';
            }
            $cells[] = '
                <td' . $bgCol . ' nowrap="nowrap">' . $userPermissionLabel . '</td>
                <td' . $bgCol . ' nowrap="nowrap">' . $groupPermissionLabel . '</td>
                <td' . $bgCol . ' nowrap="nowrap">' . $allPermissionLabel . '</td>
                <td' . $bgCol . ' nowrap="nowrap">' . $editLockLabel . '</td>
            ';
            // Compile table row:
            $code .= '<tr>' . implode(LF, $cells) . '</tr>';
        }
        // Wrap rows in table tags:
        $code = '<table class="t3-table" id="typo3-permissionList">' . $code . '</table>';
        // Adding the content as a section:
        $this->content .= $this->doc->section('', $code);
        // CSH for permissions setting
        $this->content .= BackendUtility::cshItem('xMOD_csh_corebe', 'perm_module', $this->getBackPath(), '<br />|');
        // Creating legend table:
        $legendText = '<strong>' . $language->getLL('1', true) . '</strong>: ' . $language->getLL('1_t', true) . '<br /><strong>' . $language->getLL('16', true) . '</strong>: ' . $language->getLL('16_t', true) . '<br /><strong>' . $language->getLL('2', true) . '</strong>: ' . $language->getLL('2_t', true) . '<br /><strong>' . $language->getLL('4', true) . '</strong>: ' . $language->getLL('4_t', true) . '<br /><strong>' . $language->getLL('8', true) . '</strong>: ' . $language->getLL('8_t', true);
        $code = '<div id="permission-information">
                    <img' . IconUtility::skinImg($this->getBackPath(), 'gfx/legend.gif', 'width="86" height="75"') . ' alt="" />
                <div class="text">' . $legendText . '</div></div>';
        $code .= '<div id="perm-legend">' . $language->getLL('def', true);
        $code .= '<br /><br />' . IconUtility::getSpriteIcon('status-status-permission-granted') . ': ' . $language->getLL('A_Granted', true);
        $code .= '<br />' . IconUtility::getSpriteIcon('status-status-permission-denied') . ': ' . $language->getLL('A_Denied', true) . '</div>';
        // Adding section with legend code:
        $this->content .= $this->doc->section($language->getLL('Legend') . ':', $code, true, true);
    }
コード例 #19
0
ファイル: HistoryService.php プロジェクト: plan2net/TYPO3.CMS
 /**
  * Creates this object.
  */
 public function __construct()
 {
     $this->backendUserNames = BackendUtility::getUserNames();
 }
コード例 #20
0
    /**
     * Main Task center module
     *
     * @return string HTML content.
     */
    public function main()
    {
        $content = '';
        $id = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('display'));
        // If a preset is found, it is rendered using an iframe
        if ($id > 0) {
            $url = $GLOBALS['BACK_PATH'] . \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('impexp') . 'app/index.php?tx_impexp[action]=export&preset[load]=1&preset[select]=' . $id;
            return $this->taskObject->urlInIframe($url, 1);
        } else {
            // Header
            $content .= $this->taskObject->description($GLOBALS['LANG']->getLL('.alttitle'), $GLOBALS['LANG']->getLL('.description'));
            $thumbnails = $lines = array();
            // Thumbnail folder and files:
            $tempDir = $this->userTempFolder();
            if ($tempDir) {
                $thumbnails = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir($tempDir, 'png,gif,jpg', 1);
            }
            $clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
            $usernames = \TYPO3\CMS\Backend\Utility\BackendUtility::getUserNames();
            // Create preset links:
            $presets = $this->getPresets();
            // If any presets found
            if (is_array($presets)) {
                foreach ($presets as $key => $presetCfg) {
                    $configuration = unserialize($presetCfg['preset_data']);
                    $thumbnailFile = $thumbnails[$configuration['meta']['thumbnail']];
                    $title = strlen($presetCfg['title']) ? $presetCfg['title'] : '[' . $presetCfg['uid'] . ']';
                    $icon = 'EXT:impexp/export.gif';
                    $description = array();
                    // Is public?
                    if ($presetCfg['public']) {
                        $description[] = $GLOBALS['LANG']->getLL('task.public') . ': ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes');
                    }
                    // Owner
                    $description[] = $GLOBALS['LANG']->getLL('task.owner') . ': ' . ($presetCfg['user_uid'] === $GLOBALS['BE_USER']->user['uid'] ? $GLOBALS['LANG']->getLL('task.own') : '[' . htmlspecialchars($usernames[$presetCfg['user_uid']]['username']) . ']');
                    // Page & path
                    if ($configuration['pagetree']['id']) {
                        $description[] = $GLOBALS['LANG']->getLL('task.page') . ': ' . $configuration['pagetree']['id'];
                        $description[] = $GLOBALS['LANG']->getLL('task.path') . ': ' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordPath($configuration['pagetree']['id'], $clause, 20));
                    } else {
                        $description[] = $GLOBALS['LANG']->getLL('single-record');
                    }
                    // Meta information
                    if ($configuration['meta']['title'] || $configuration['meta']['description'] || $configuration['meta']['notes']) {
                        $metaInformation = '';
                        if ($configuration['meta']['title']) {
                            $metaInformation .= '<strong>' . htmlspecialchars($configuration['meta']['title']) . '</strong><br />';
                        }
                        if ($configuration['meta']['description']) {
                            $metaInformation .= htmlspecialchars($configuration['meta']['description']);
                        }
                        if ($configuration['meta']['notes']) {
                            $metaInformation .= '<br /><br />
												<strong>' . $GLOBALS['LANG']->getLL('notes') . ': </strong>
												<em>' . htmlspecialchars($configuration['meta']['notes']) . '</em>';
                        }
                        $description[] = '<br />' . $metaInformation;
                    }
                    // Collect all preset information
                    $lines[$key] = array('icon' => $icon, 'title' => $title, 'descriptionHtml' => implode('<br />', $description), 'link' => 'mod.php?M=user_task&SET[function]=impexp.tx_impexp_task&display=' . $presetCfg['uid']);
                }
                // Render preset list
                $content .= $this->taskObject->renderListMenu($lines);
            } else {
                // No presets found
                $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('no-presets'), '', \TYPO3\CMS\Core\Messaging\FlashMessage::NOTICE);
                $content .= $flashMessage->render();
            }
        }
        return $content;
    }
コード例 #21
0
    /**
     * Main Task center module
     *
     * @return string HTML content.
     */
    public function main()
    {
        $content = '';
        $id = (int) GeneralUtility::_GP('display');
        // If a preset is found, it is rendered using an iframe
        if ($id > 0) {
            $url = BackendUtility::getModuleUrl('xMOD_tximpexp', array('tx_impexp[action]' => 'export', 'preset[load]' => 1, 'preset[select]' => $id));
            return $this->taskObject->urlInIframe($url);
        } else {
            // Header
            $lang = $this->getLanguageService();
            $content .= $this->taskObject->description($lang->getLL('.alttitle'), $lang->getLL('.description'));
            $clause = $this->getBackendUser()->getPagePermsClause(1);
            $usernames = BackendUtility::getUserNames();
            // Create preset links:
            $presets = $this->getPresets();
            // If any presets found
            if (is_array($presets) && !empty($presets)) {
                $lines = [];
                foreach ($presets as $key => $presetCfg) {
                    $configuration = unserialize($presetCfg['preset_data']);
                    $title = strlen($presetCfg['title']) ? $presetCfg['title'] : '[' . $presetCfg['uid'] . ']';
                    $icon = 'EXT:impexp/Resources/Public/Images/export.gif';
                    $description = array();
                    // Is public?
                    if ($presetCfg['public']) {
                        $description[] = $lang->getLL('task.public') . ': ' . $lang->sL('LLL:EXT:lang/locallang_common.xlf:yes');
                    }
                    // Owner
                    $description[] = $lang->getLL('task.owner') . ': ' . ($presetCfg['user_uid'] === $GLOBALS['BE_USER']->user['uid'] ? $lang->getLL('task.own') : '[' . htmlspecialchars($usernames[$presetCfg['user_uid']]['username']) . ']');
                    // Page & path
                    if ($configuration['pagetree']['id']) {
                        $description[] = $lang->getLL('task.page') . ': ' . $configuration['pagetree']['id'];
                        $description[] = $lang->getLL('task.path') . ': ' . htmlspecialchars(BackendUtility::getRecordPath($configuration['pagetree']['id'], $clause, 20));
                    } else {
                        $description[] = $lang->getLL('single-record');
                    }
                    // Meta information
                    if ($configuration['meta']['title'] || $configuration['meta']['description'] || $configuration['meta']['notes']) {
                        $metaInformation = '';
                        if ($configuration['meta']['title']) {
                            $metaInformation .= '<strong>' . htmlspecialchars($configuration['meta']['title']) . '</strong><br />';
                        }
                        if ($configuration['meta']['description']) {
                            $metaInformation .= htmlspecialchars($configuration['meta']['description']);
                        }
                        if ($configuration['meta']['notes']) {
                            $metaInformation .= '<br /><br />
												<strong>' . $lang->getLL('notes') . ': </strong>
												<em>' . htmlspecialchars($configuration['meta']['notes']) . '</em>';
                        }
                        $description[] = '<br />' . $metaInformation;
                    }
                    // Collect all preset information
                    $lines[$key] = array('icon' => $icon, 'title' => $title, 'descriptionHtml' => implode('<br />', $description), 'link' => BackendUtility::getModuleUrl('user_task') . '&SET[function]=impexp.TYPO3\\CMS\\Impexp\\Task\\ImportExportTask&display=' . $presetCfg['uid']);
                }
                // Render preset list
                $content .= $this->taskObject->renderListMenu($lines);
            } else {
                // No presets found
                $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, $lang->getLL('no-presets'), $lang->getLL('.alttitle'), FlashMessage::NOTICE);
                /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */
                $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
                /** @var $defaultFlashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */
                $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
                $defaultFlashMessageQueue->enqueue($flashMessage);
            }
        }
        return $content;
    }
コード例 #22
0
 /**
  * Edit action
  *
  * @return void
  */
 public function editAction()
 {
     $this->view->assign('id', $this->id);
     $this->view->assign('depth', $this->depth);
     if (!$this->id) {
         $this->pageInfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0);
     }
     if ($this->getBackendUser()->workspace != 0) {
         // Adding FlashMessage with the permission setting matrix:
         $this->addFlashMessage(LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:WorkspaceWarningText', 'beuser'), LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:WorkspaceWarning', 'beuser'), FlashMessage::WARNING);
     }
     // Get usernames and groupnames
     $beGroupArray = BackendUtility::getListGroupNames('title,uid');
     $beUserArray = BackendUtility::getUserNames();
     // Owner selector
     $beUserDataArray = array(0 => LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:selectNone', 'beuser'));
     foreach ($beUserArray as $uid => &$row) {
         $beUserDataArray[$uid] = $row['username'];
     }
     $beUserDataArray[-1] = LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:selectUnchanged', 'beuser');
     $this->view->assign('currentBeUser', $this->pageInfo['perms_userid']);
     $this->view->assign('beUserData', $beUserDataArray);
     // Group selector
     $beGroupDataArray = array(0 => LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:selectNone', 'beuser'));
     foreach ($beGroupArray as $uid => $row) {
         $beGroupDataArray[$uid] = $row['title'];
     }
     $beGroupDataArray[-1] = LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:selectUnchanged', 'beuser');
     $this->view->assign('currentBeGroup', $this->pageInfo['perms_groupid']);
     $this->view->assign('beGroupData', $beGroupDataArray);
     $this->view->assign('pageInfo', $this->pageInfo);
     $this->view->assign('returnId', $this->returnId);
     $this->view->assign('recursiveSelectOptions', $this->getRecursiveSelectOptions());
 }
コード例 #23
0
 /**
  * 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 = BackendUtility::getUserNames();
         if (!$GLOBALS['BE_USER']->isAdmin()) {
             $be_user_Array = BackendUtility::blindUserNames($be_user_Array, $groupArray, 0);
         }
         $be_group_Array = BackendUtility::getGroupNames();
         if (!$GLOBALS['BE_USER']->isAdmin()) {
             $be_group_Array = BackendUtility::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 = GeneralUtility::_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="' . \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange(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;
 }