/** * 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; }
/** * 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"> </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"> </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)) . ' </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 »Admin-only« 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); }
/** * Rendering the overview of versions in the current workspace * * @return string HTML (table) * @see typo3/mod/user/ws/index.php for sister function! */ function displayWorkspaceOverview() { // Initialize variables: $this->showWorkspaceCol = $GLOBALS['BE_USER']->workspace === 0 && $this->MOD_SETTINGS['display'] <= -98; // Get usernames and groupnames $be_group_Array = t3lib_BEfunc::getListGroupNames('title,uid'); $groupArray = array_keys($be_group_Array); $this->be_user_Array = t3lib_BEfunc::getUserNames(); if (!$GLOBALS['BE_USER']->isAdmin()) { $this->be_user_Array = t3lib_BEfunc::blindUserNames($this->be_user_Array, $groupArray, 1); } // Initialize Workspace ID and filter-value: if ($GLOBALS['BE_USER']->workspace === 0) { $wsid = $this->details ? -99 : $this->MOD_SETTINGS['display']; // Set wsid to the value from the menu (displaying content of other workspaces) $filter = $this->details ? 0 : $this->MOD_SETTINGS['filter']; } else { $wsid = $GLOBALS['BE_USER']->workspace; $filter = 0; } // Initialize workspace object and request all pending versions: $wslibObj = t3lib_div::makeInstance('wslib'); // Selecting ALL versions belonging to the workspace: $versions = $wslibObj->selectVersionsInWorkspace($wsid, $filter, -99, $this->uid); // $this->uid is the page id of LIVE record. // Traverse versions and build page-display array: $pArray = array(); foreach ($versions as $table => $records) { foreach ($records as $rec) { $pageIdField = $table === 'pages' ? 't3ver_oid' : 'realpid'; $this->displayWorkspaceOverview_setInPageArray($pArray, $table, $rec); } } // Make header of overview: $tableRows = array(); if (count($pArray)) { $tableRows[] = ' <tr class="bgColor5 tableheader"> ' . ($this->diffOnly ? '' : '<td nowrap="nowrap" colspan="2">' . $GLOBALS['LANG']->getLL('liveVersion') . '</td>') . ' <td nowrap="nowrap" colspan="2">' . $GLOBALS['LANG']->getLL('wsVersions') . '</td> <td nowrap="nowrap"' . ($this->diffOnly ? ' colspan="2"' : ' colspan="4"') . '>' . $GLOBALS['LANG']->getLL('controls') . '</td> </tr>'; // Add lines from overview: $tableRows = array_merge($tableRows, $this->displayWorkspaceOverview_list($pArray)); $table = '<table border="0" cellpadding="0" cellspacing="1" class="lrPadding workspace-overview">' . implode('', $tableRows) . '</table>'; } else { $table = ''; } $linkBack = t3lib_div::_GP('returnUrl') ? '<a href="' . htmlspecialchars(t3lib_div::_GP('returnUrl')) . '" class="typo3-goBack">' . t3lib_iconWorks::getSpriteIcon('actions-view-go-back') . $GLOBALS['LANG']->getLL('goBack', TRUE) . '</a><br /><br />' : ''; $resetDiffOnly = $this->diffOnly ? '<a href="index.php?id=' . intval($this->id) . '" class="typo3-goBack">' . $GLOBALS['LANG']->getLL('showAllInformation') . '</a><br /><br />' : ''; $versionSelector = $GLOBALS['BE_USER']->workspace ? $this->doc->getVersionSelector($this->id) : ''; return $versionSelector . $linkBack . $resetDiffOnly . $table . $this->markupNewOriginals(); }
/** * 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)); } } }
/** * Creates an info-box for the current page (identified by input record). * * @param array Page record * @param boolean If set, there will be shown an edit icon, linking to editing of the page properties. * @return string HTML for the box. */ function getPageInfoBox($rec, $edit = 0) { global $LANG; // If editing of the page properties is allowed: if ($edit) { $params = '&edit[pages][' . $rec['uid'] . ']=edit'; $editIcon = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick($params, $this->backPath)) . '" title="' . $GLOBALS['LANG']->getLL('edit', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a>'; } else { $editIcon = $this->noEditIcon('noEditPage'); } // Setting page icon, link, title: $outPutContent = t3lib_iconWorks::getSpriteIconForRecord('pages', $rec, array('title' => t3lib_BEfunc::titleAttribForPages($rec))) . $editIcon . ' ' . htmlspecialchars($rec['title']); // Init array where infomation is accumulated as label/value pairs. $lines = array(); // Owner user/group: if ($this->pI_showUser) { // User: $users = t3lib_BEfunc::getUserNames('username,usergroup,usergroup_cached_list,uid,realName'); $groupArray = explode(',', $GLOBALS['BE_USER']->user['usergroup_cached_list']); $users = t3lib_BEfunc::blindUserNames($users, $groupArray); $lines[] = array($LANG->getLL('pI_crUser') . ':', htmlspecialchars($users[$rec['cruser_id']]['username']) . ' (' . $users[$rec['cruser_id']]['realName'] . ')'); } // Created: $lines[] = array($LANG->getLL('pI_crDate') . ':', t3lib_BEfunc::datetime($rec['crdate']) . ' (' . t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME'] - $rec['crdate'], $this->agePrefixes) . ')'); // Last change: $lines[] = array($LANG->getLL('pI_lastChange') . ':', t3lib_BEfunc::datetime($rec['tstamp']) . ' (' . t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME'] - $rec['tstamp'], $this->agePrefixes) . ')'); // Last change of content: if ($rec['SYS_LASTCHANGED']) { $lines[] = array($LANG->getLL('pI_lastChangeContent') . ':', t3lib_BEfunc::datetime($rec['SYS_LASTCHANGED']) . ' (' . t3lib_BEfunc::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(t3lib_BEfunc::getItemLabel('pages', $fV)), t3lib_BEfunc::getProcessedValue('pages', $fV, $rec[$fV])); } } // Page hits (depends on "sys_stat" extension) if ($this->pI_showStat && t3lib_extMgm::isLoaded('sys_stat')) { // Counting total hits: $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', 'sys_stat', 'page_id=' . intval($rec['uid'])); if ($count) { // Get min/max $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('min(tstamp) AS min,max(tstamp) AS max', 'sys_stat', 'page_id=' . intval($rec['uid'])); $rrow2 = $GLOBALS['TYPO3_DB']->sql_fetch_row($res); $lines[] = ''; $lines[] = array($LANG->getLL('pI_hitsPeriod') . ':', t3lib_BEfunc::date($rrow2[0]) . ' - ' . t3lib_BEfunc::date($rrow2[1]) . ' (' . t3lib_BEfunc::calcAge($rrow2[1] - $rrow2[0], $this->agePrefixes) . ')'); $lines[] = array($LANG->getLL('pI_hitsTotal') . ':', $rrow[0]); // Last 10 days $nextMidNight = mktime(0, 0, 0) + 1 * 3600 * 24; $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*), FLOOR((' . $nextMidNight . '-tstamp)/(24*3600)) AS day', 'sys_stat', 'page_id=' . intval($rec['uid']) . ' AND tstamp>' . ($nextMidNight - 10 * 24 * 3600), 'day'); $days = array(); while ($rrow = $GLOBALS['TYPO3_DB']->sql_fetch_row($res)) { $days[$rrow[1]] = $rrow[0]; } $headerH = array(); $contentH = array(); for ($a = 9; $a >= 0; $a--) { $headerH[] = ' <td class="bgColor5" nowrap="nowrap"> ' . date('d', $nextMidNight - ($a + 1) * 24 * 3600) . ' </td>'; $contentH[] = ' <td align="center">' . ($days[$a] ? intval($days[$a]) : '-') . '</td>'; } // Compile first hit-table (last 10 days) $hitTable = ' <table border="0" cellpadding="0" cellspacing="1" class="typo3-page-hits"> <tr>' . implode('', $headerH) . '</tr> <tr>' . implode('', $contentH) . '</tr> </table>'; $lines[] = array($LANG->getLL('pI_hits10days') . ':', $hitTable, 1); // Last 24 hours $nextHour = mktime(date('H'), 0, 0) + 3600; $hours = 16; $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*), FLOOR((' . $nextHour . '-tstamp)/3600) AS hours', 'sys_stat', 'page_id=' . intval($rec['uid']) . ' AND tstamp>' . ($nextHour - $hours * 3600), 'hours'); $days = array(); while ($rrow = $GLOBALS['TYPO3_DB']->sql_fetch_row($res)) { $days[$rrow[1]] = $rrow[0]; } $headerH = array(); $contentH = array(); for ($a = $hours - 1; $a >= 0; $a--) { $headerH[] = ' <td class="bgColor5" nowrap="nowrap"> ' . intval(date('H', $nextHour - ($a + 1) * 3600)) . ' </td>'; $contentH[] = ' <td align="center">' . ($days[$a] ? intval($days[$a]) : '-') . '</td>'; } // Compile second hit-table (last 24 hours) $hitTable = ' <table border="0" cellpadding="0" cellspacing="1" class="typo3-page-stat"> <tr>' . implode('', $headerH) . '</tr> <tr>' . implode('', $contentH) . '</tr> </table>'; $lines[] = array($LANG->getLL('pI_hits24hours') . ':', $hitTable, 1); } } // 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]) . ' </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; }
/** * Initializes several class variables * * @return void */ function initVars() { // Init users $be_group_Array = t3lib_BEfunc::getListGroupNames('title,uid'); $groupArray = array_keys($be_group_Array); // Need 'admin' field for t3lib_iconWorks::getIconImage() $this->be_user_Array = t3lib_BEfunc::getUserNames('username,usergroup,usergroup_cached_list,uid,admin,workspace_perms'); if (!$GLOBALS['BE_USER']->isAdmin()) { $this->be_user_Array = t3lib_BEfunc::blindUserNames($this->be_user_Array, $groupArray, 1); } // If another page module was specified, replace the default Page module with the new one $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule')); $this->pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout'; // Setting publish access permission for workspace: $this->publishAccess = $GLOBALS['BE_USER']->workspacePublishAccess($GLOBALS['BE_USER']->workspace); // FIXME Should be $this->workspaceId here? }
/** * Main function for Workspace Manager module. * * @return void */ function main() { global $LANG, $BE_USER, $BACK_PATH; // See if we need to switch workspace $changeWorkspace = t3lib_div::_GET('changeWorkspace'); if ($changeWorkspace != '') { $BE_USER->setWorkspace($changeWorkspace); $this->content .= $this->doc->wrapScriptTags('top.location.href="' . $BACK_PATH . t3lib_BEfunc::getBackendScript() . '";'); } else { // Starting page: $this->content .= $this->doc->header($LANG->getLL('title')); $this->content .= $this->doc->spacer(5); // Get usernames and groupnames $be_group_Array = t3lib_BEfunc::getListGroupNames('title,uid'); $groupArray = array_keys($be_group_Array); // Need 'admin' field for t3lib_iconWorks::getIconImage() $this->be_user_Array_full = $this->be_user_Array = t3lib_BEfunc::getUserNames('username,usergroup,usergroup_cached_list,uid,admin,workspace_perms'); if (!$GLOBALS['BE_USER']->isAdmin()) { $this->be_user_Array = t3lib_BEfunc::blindUserNames($this->be_user_Array, $groupArray, 1); } // Build top menu: $menuItems = array(); $menuItems[] = array('label' => $LANG->getLL('menuitem_review'), 'content' => $this->moduleContent_publish()); $menuItems[] = array('label' => $LANG->getLL('menuitem_workspaces'), 'content' => $this->moduleContent_workspaceList()); // Add hidden fields and create tabs: $content = $this->doc->getDynTabMenu($menuItems, 'user_ws'); $this->content .= $this->doc->section('', $content, 0, 1); // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons(); // $markers['CSH'] = $docHeaderButtons['csh']; } $markers['CONTENT'] = $this->content; // Build the <body> for the module $this->content = $this->doc->startPage($LANG->getLL('title')); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * 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 = t3lib_BEfunc::getUserNames(); // Init groupArray $groups = array(); if (!$GLOBALS['BE_USER']->isAdmin()) { $beUsers = t3lib_BEfunc::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">' . t3lib_iconWorks::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">' . t3lib_iconWorks::getSpriteIcon('actions-document-close') . '</a>'; $ret = $selector . $saveButton . $cancelButton; return $ret; }
/** * Main function * * @return void */ function main() { global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS; $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('adminLog')); $this->content .= $this->doc->spacer(5); // Menu compiled: $menuU = t3lib_BEfunc::getFuncMenu(0, 'SET[users]', $this->MOD_SETTINGS['users'], $this->MOD_MENU['users']); $menuM = t3lib_BEfunc::getFuncMenu(0, 'SET[max]', $this->MOD_SETTINGS['max'], $this->MOD_MENU['max']); $menuT = t3lib_BEfunc::getFuncMenu(0, 'SET[time]', $this->MOD_SETTINGS['time'], $this->MOD_MENU['time']); $menuA = t3lib_BEfunc::getFuncMenu(0, 'SET[action]', $this->MOD_SETTINGS['action'], $this->MOD_MENU['action']); $menuW = t3lib_BEfunc::getFuncMenu(0, 'SET[workspaces]', $this->MOD_SETTINGS['workspaces'], $this->MOD_MENU['workspaces']); $groupByPage = t3lib_BEfunc::getFuncCheck(0, 'SET[groupByPage]', $this->MOD_SETTINGS['groupByPage']); $style = ' style="margin:4px 2px;padding:1px;vertical-align:middle;width: 115px;"'; $inputDate = '<input type="text" value="' . ($this->MOD_SETTINGS['manualdate'] ? $this->MOD_SETTINGS['manualdate'] : '') . '" name="SET[manualdate]" id="tceforms-datetimefield-manualdate"' . $style . ' />'; $pickerInputDate = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/datepicker.gif', '', 0) . ' style="cursor:pointer; vertical-align:middle;" alt=""' . ' id="picker-tceforms-datetimefield-manualdate" />'; $inputDate_end = '<input type="text" value="' . ($this->MOD_SETTINGS['manualdate_end'] ? $this->MOD_SETTINGS['manualdate_end'] : '') . '" name="SET[manualdate]" id="tceforms-datetimefield-manualdate_end"' . $style . ' />'; $pickerInputDate_end = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/datepicker.gif', '', 0) . ' style="cursor:pointer; vertical-align:middle;" alt=""' . ' id="picker-tceforms-datetimefield-manualdate_end" />'; $setButton = '<input type="button" value="' . $GLOBALS['LANG']->getLL('set') . '" onclick="jumpToUrl(\'mod.php?&id=0&M=tools_log&SET[manualdate]=\'+escape($(\'tceforms-datetimefield-manualdate\').value)+\'&SET[manualdate_end]=\'+escape($(\'tceforms-datetimefield-manualdate_end\').value),this);" />'; $this->content .= $this->doc->section('', $this->doc->menuTable(array(array($GLOBALS['LANG']->getLL('users'), $menuU), array($GLOBALS['LANG']->getLL('time'), $menuT . ($this->MOD_SETTINGS['time'] == 30 ? '<br />' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:from', true) . ' ' . $inputDate . $pickerInputDate . ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:to', true) . ' ' . $inputDate_end . $pickerInputDate_end . ' ' . $setButton : ''))), array(array($GLOBALS['LANG']->getLL('max'), $menuM), array($GLOBALS['LANG']->getLL('action'), $menuA)), array($GLOBALS['BE_USER']->workspace !== 0 ? array($GLOBALS['LANG']->getLL('workspace'), '<strong>' . $GLOBALS['BE_USER']->workspace . '</strong>') : array($GLOBALS['LANG']->getLL('workspace'), $menuW), array($GLOBALS['LANG']->getLL('groupByPage'), $groupByPage)))); $codeArr = $this->lF->initArray(); $oldHeader = ''; $c = 0; // Action (type): $where_part = ''; if ($this->MOD_SETTINGS['action'] > 0) { $where_part .= ' AND type=' . intval($this->MOD_SETTINGS['action']); } elseif ($this->MOD_SETTINGS['action'] == -1) { $where_part .= ' AND error != 0'; } $starttime = 0; $endtime = $GLOBALS['EXEC_TIME']; // Time: switch ($this->MOD_SETTINGS['time']) { case 0: // This week $week = (date('w') ? date('w') : 7) - 1; $starttime = mktime(0, 0, 0) - $week * 3600 * 24; break; case 1: // Last week $week = (date('w') ? date('w') : 7) - 1; $starttime = mktime(0, 0, 0) - ($week + 7) * 3600 * 24; $endtime = mktime(0, 0, 0) - $week * 3600 * 24; break; case 2: // Last 7 days $starttime = mktime(0, 0, 0) - 7 * 3600 * 24; break; case 10: // This month $starttime = mktime(0, 0, 0, date('m'), 1); break; case 11: // Last month $starttime = mktime(0, 0, 0, date('m') - 1, 1); $endtime = mktime(0, 0, 0, date('m'), 1); break; case 12: // Last 31 days $starttime = mktime(0, 0, 0) - 31 * 3600 * 24; break; case 30: $starttime = $this->theTime; if ($this->theTime_end) { $endtime = $this->theTime_end; } else { $endtime = $GLOBALS['EXEC_TIME']; } } if ($starttime) { $where_part .= ' AND tstamp>=' . $starttime . ' AND tstamp<' . $endtime; } // Users $selectUsers = array(); if (substr($this->MOD_SETTINGS['users'], 0, 3) == "gr-") { // All users $this->be_user_Array = t3lib_BEfunc::blindUserNames($this->be_user_Array, array(substr($this->MOD_SETTINGS['users'], 3)), 1); if (is_array($this->be_user_Array)) { foreach ($this->be_user_Array as $val) { if ($val['uid'] != $BE_USER->user['uid']) { $selectUsers[] = $val['uid']; } } } $selectUsers[] = 0; $where_part .= ' AND userid in (' . implode($selectUsers, ',') . ')'; } elseif (substr($this->MOD_SETTINGS['users'], 0, 3) == "us-") { // All users $selectUsers[] = intval(substr($this->MOD_SETTINGS['users'], 3)); $where_part .= ' AND userid in (' . implode($selectUsers, ',') . ')'; } elseif ($this->MOD_SETTINGS['users'] == -1) { $where_part .= ' AND userid=' . $BE_USER->user['uid']; // Self user } // Workspace if ($GLOBALS['BE_USER']->workspace !== 0) { $where_part .= ' AND workspace=' . intval($GLOBALS['BE_USER']->workspace); } elseif ($this->MOD_SETTINGS['workspaces'] != -99) { $where_part .= ' AND workspace=' . intval($this->MOD_SETTINGS['workspaces']); } // Finding out which page ids are in the log: $logPids = array(); if ($this->MOD_SETTINGS['groupByPage']) { $log = $GLOBALS['TYPO3_DB']->exec_SELECTquery('event_pid', 'sys_log', '1=1' . $where_part, 'event_pid'); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($log)) { $logPids[] = $row['event_pid']; } // Overview: $overviewList = array(); foreach ($logPids as $pid) { if ((int) $pid > 0) { $overviewList[] = htmlspecialchars(sprintf($GLOBALS['LANG']->getLL('pagenameWithUID'), t3lib_BEfunc::getRecordPath($pid, '', 20), $pid)); } } sort($overviewList); $this->content .= $this->doc->divider(5); $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('overview'), sprintf($GLOBALS['LANG']->getLL('timeInfo'), date($this->dateFormat, $starttime), date($this->dateFormat, $endtime)) . '<br /><br /><br />' . implode('<br />', $overviewList), 1, 1, 0); $this->content .= $this->doc->spacer(30); } else { $logPids[] = '_SINGLE'; } foreach ($logPids as $pid) { $codeArr = $this->lF->initArray(); $this->lF->reset(); $oldHeader = ''; $this->content .= $this->doc->divider(5); switch ($pid) { case '_SINGLE': $insertMsg = ''; break; case '-1': $insertMsg = ' ' . $GLOBALS['LANG']->getLL('forNonPageRelatedActions') . ' '; break; case '0': $insertMsg = ' ' . $GLOBALS['LANG']->getLL('forRootLevel') . ' '; break; default: $insertMsg = ' ' . sprintf($GLOBALS['LANG']->getLL('forPage'), t3lib_BEfunc::getRecordPath($pid, '', 20), $pid) . ' '; break; } $this->content .= $this->doc->section(sprintf($GLOBALS['LANG']->getLL('logForNonPageRelatedActionsOrRootLevelOrPage'), $insertMsg, date($this->dateFormat, $starttime), date($this->dateFormat, $endtime)), '', 1, 1, 0); $log = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_log', '1=1' . $where_part . ($pid != '_SINGLE' ? ' AND event_pid=' . intval($pid) : ''), '', 'uid DESC', intval($this->MOD_SETTINGS['max'])); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($log)) { $header = $this->doc->formatTime($row['tstamp'], 10); if (!$oldHeader) { $oldHeader = $header; } if ($header != $oldHeader) { $this->content .= $this->doc->spacer(10); $this->content .= $this->doc->section($oldHeader, $this->doc->table($codeArr)); $codeArr = $this->lF->initArray(); $oldHeader = $header; $this->lF->reset(); } $i++; $codeArr[$i][] = $this->lF->getTimeLabel($row['tstamp']); $codeArr[$i][] = $this->lF->getUserLabel($row['userid'], $row['workspace']); $codeArr[$i][] = $this->lF->getTypeLabel($row['type']); $codeArr[$i][] = $row['error'] ? $this->lF->getErrorFormatting($this->lF->errorSign[$row['error']], $row['error']) : ''; $codeArr[$i][] = $this->lF->getActionLabel($row['type'] . '_' . $row['action']); $codeArr[$i][] = $this->lF->formatDetailsForList($row); } $this->content .= $this->doc->spacer(10); $this->content .= $this->doc->section($header, $this->doc->table($codeArr)); $GLOBALS['TYPO3_DB']->sql_free_result($log); } // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons(); //$markers['CSH'] = $docHeaderButtons['csh']; $markers['CONTENT'] = $this->content; // Build the <body> for the module $this->content = $this->doc->startPage($GLOBALS['LANG']->getLL('adminLog')); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Show the log entries for page * * @return string HTML output */ function main() { global $SOBE, $LANG; $this->localLang(); $lF = t3lib_div::makeInstance('logFunctions_ext'); $theOutput = ''; $menu = ''; $menu .= ' ' . $LANG->getLL('chLog_menuUsers') . ': ' . t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[log_users]', $this->pObj->MOD_SETTINGS['log_users'], $this->pObj->MOD_MENU['log_users']); $menu .= ' ' . $LANG->getLL('chLog_menuDepth') . ': ' . t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[depth]', $this->pObj->MOD_SETTINGS['depth'], $this->pObj->MOD_MENU['depth']); $menu .= ' ' . $LANG->getLL('chLog_menuTime') . ': ' . t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[log_time]', $this->pObj->MOD_SETTINGS['log_time'], $this->pObj->MOD_MENU['log_time']); $theOutput .= $this->pObj->doc->section($LANG->getLL('chLog_title'), '<span class="nobr">' . $menu . '</span>', 0, 1); // Build query $where_part = ''; // Get the id-list of pages for the tree structure. $tree = t3lib_div::makeInstance('t3lib_pageTree'); $tree->init('AND ' . $this->pObj->perms_clause); $tree->makeHTML = 0; $tree->fieldArray = array('uid'); if ($this->pObj->MOD_SETTINGS['depth']) { $tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], ''); } $tree->ids[] = $this->pObj->id; $idList = implode($tree->ids, ','); $where_part .= ' AND (event_pid in (' . $idList . '))'; // DB // Time: $starttime = 0; $endtime = $GLOBALS['EXEC_TIME']; switch ($this->pObj->MOD_SETTINGS['log_time']) { case 0: // This week $week = (date('w') ? date('w') : 7) - 1; $starttime = mktime(0, 0, 0) - $week * 3600 * 24; break; case 1: // Last week $week = (date('w') ? date('w') : 7) - 1; $starttime = mktime(0, 0, 0) - ($week + 7) * 3600 * 24; $endtime = mktime(0, 0, 0) - $week * 3600 * 24; break; case 2: // Last 7 days $starttime = mktime(0, 0, 0) - 7 * 3600 * 24; break; case 10: // This month $starttime = mktime(0, 0, 0, date('m'), 1); break; case 11: // Last month $starttime = mktime(0, 0, 0, date('m') - 1, 1); $endtime = mktime(0, 0, 0, date('m'), 1); break; case 12: // Last 31 days $starttime = mktime(0, 0, 0) - 31 * 3600 * 24; break; } if ($starttime) { $where_part .= ' AND tstamp>=' . $starttime . ' AND tstamp<' . $endtime; } $where_part .= ' AND type=1'; // DB // Users $this->pObj->be_user_Array = t3lib_BEfunc::getUserNames(); if (!$this->pObj->MOD_SETTINGS['log_users']) { // All users // Get usernames and groupnames if (!$GLOBALS['BE_USER']->isAdmin()) { $groupArray = explode(',', $GLOBALS['BE_USER']->user['usergroup_cached_list']); $this->pObj->be_user_Array = t3lib_BEfunc::blindUserNames($this->pObj->be_user_Array, $groupArray, 1); } if (is_array($this->pObj->be_user_Array)) { foreach ($this->pObj->be_user_Array as $val) { $selectUsers[] = $val['uid']; } } $selectUsers[] = $GLOBALS['BE_USER']->user['uid']; $where_part .= ' AND userid in (' . implode($selectUsers, ',') . ')'; } else { $where_part .= ' AND userid=' . $GLOBALS['BE_USER']->user['uid']; // Self user } $lF->be_user_Array =& $this->pObj->be_user_Array; if ($GLOBALS['BE_USER']->workspace !== 0) { $where_part .= ' AND workspace=' . intval($GLOBALS['BE_USER']->workspace); } // Select 100 recent log entries: $log = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_log', '1=1' . $where_part, '', 'uid DESC', 100); $codeArr = $lF->initArray(); $oldHeader = ''; while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($log)) { $header = $this->pObj->doc->formatTime($row['tstamp'], 10); if (!$oldHeader) { $oldHeader = $header; } if ($header != $oldHeader) { $theOutput .= $this->pObj->doc->spacer(10); $theOutput .= $this->pObj->doc->section($oldHeader, $this->pObj->doc->table($codeArr)); $codeArr = $lF->initArray(); $oldHeader = $header; $lF->reset(); } $i++; $codeArr[$i][] = $lF->getTimeLabel($row['tstamp']); $codeArr[$i][] = $lF->getUserLabel($row['userid'], $row['workspace']); $codeArr[$i][] = $row['error'] ? $lF->getErrorFormatting($lF->errorSign[$row['error']], $row['error']) : ''; $codeArr[$i][] = $lF->getActionLabel($row['type'] . '_' . $row['action']); $codeArr[$i][] = $row['tablename']; $codeArr[$i][] = $lF->formatDetailsForList($row); } $theOutput .= $this->pObj->doc->spacer(10); $theOutput .= $this->pObj->doc->section($header, $this->pObj->doc->table($codeArr)); $GLOBALS['TYPO3_DB']->sql_free_result($log); return $theOutput; }