/** * Main function * * @return void */ function main() { switch ((string) t3lib_div::_GET('cmd')) { case 'menuitem': echo ' <img src="gfx/x_t3logo.png" width="61" height="16" hspace="3" alt="" />'; $menuItems = array(array('title' => 'About TYPO3', 'xurl' => 'http://typo3.com/', 'subitems' => array(array('title' => 'License', 'xurl' => 'http://typo3.com/License.1625.0.html'), array('title' => 'Support', 'subitems' => array(array('title' => 'Mailing lists', 'xurl' => 'http://lists.netfielders.de/cgi-bin/mailman/listinfo'), array('title' => 'Documentation', 'xurl' => 'http://typo3.org/documentation/'), array('title' => 'Find consultancy', 'xurl' => 'http://typo3.com/Consultancies.1248.0.html'))), array('title' => 'Contribute', 'xurl' => 'http://typo3.org/community/participate/'), array('title' => 'Donate', 'xurl' => 'http://typo3.com/Donations.1261.0.html', 'icon' => '1'))), array('title' => 'Extensions', 'url' => 'mod/tools/em/index.php'), array('title' => 'Menu preferences and such things', 'onclick' => 'alert("A dialog is now shown which will allow user configuration of items in the menu");event.stopPropagation();', 'state' => 'checked'), array('title' => '--div--'), array('title' => 'Recent Items', 'id' => $this->id . '_recent', 'subitems' => array(), 'html' => $this->menuItemObject($this->id . '_recent', ' fetched: false, onActivate: function() { // if (!this.fetched) { //Element.update("' . $this->id . '_recent-layer","asdfasdf"); getElementContent("' . $this->id . '_recent-layer", 0, "logomenu.php?cmd=recent") this.fetched = true; // } } ')), array('title' => '--div--'), array('title' => 'View frontend', 'xurl' => t3lib_div::getIndpEnv('TYPO3_SITE_URL')), array('title' => 'Log out', 'onclick' => "top.document.location='logout.php';")); echo $this->menuLayer($menuItems); break; case 'recent': $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('sys_log.*, MAX(sys_log.tstamp) AS tstamp_MAX', 'sys_log,pages', 'pages.uid=sys_log.event_pid AND sys_log.userid=' . intval($GLOBALS['BE_USER']->user['uid']) . ' AND sys_log.event_pid>0 AND sys_log.type=1 AND sys_log.action=2 AND sys_log.error=0', 'tablename,recuid', 'tstamp_MAX DESC', 20); $items = array(); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $elRow = t3lib_BEfunc::getRecord($row['tablename'], $row['recuid']); if (is_array($elRow)) { $items[] = array('title' => t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($row['tablename'], $elRow), $GLOBALS['BE_USER']->uc['titleLen']) . ' - ' . t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME'] - $row['tstamp_MAX']), 'icon' => array(t3lib_iconworks::getIcon($row['tablename'], $elRow), 'width="18" height="16"'), 'onclick' => 'content.' . t3lib_BEfunc::editOnClick('&edit[' . $row['tablename'] . '][' . $row['recuid'] . ']=edit', '', 'dummy.php')); } } echo $this->menuItems($items); break; } }
/** * Create the panel of buttons for submitting the form or otherwise perform operations. * * @return array all available buttons as an assoc. array */ protected function getButtons() { $buttons = array('close' => '', 'save' => '', 'save_view' => '', 'save_close' => '', 'shortcut' => '', 'undo' => ''); if ($this->P['table'] && $this->P['field'] && $this->P['uid'] && $this->checkEditAccess($this->P['table'], $this->P['uid'])) { $closeUrl = t3lib_div::sanitizeLocalUrl($this->P['returnUrl']); // Getting settings for the undo button: $undoButton = 0; $undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->P['table'], 'sys_history') . ' AND recuid=' . intval($this->P['uid']), '', 'tstamp DESC', '1'); if ($undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) { $undoButton = 1; } // Close $buttons['close'] = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(unescape(\'' . rawurlencode($closeUrl) . '\')); return false;') . '">' . '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/closedok.gif') . ' class="c-inputButton" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc', 1) . '" alt="" />' . '</a>'; // Save $buttons['save'] = '<a href="#" onclick="TBE_EDITOR.checkAndDoSubmit(1); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/savedok.gif') . ' class="c-inputButton" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc', 1) . '" alt="" />' . '</a>'; // Save & View if (t3lib_extMgm::isLoaded('cms')) { $buttons['save_view'] = '<a href="#" onclick="' . htmlspecialchars('document.editform.redirect.value+=\'&popView=1\'; TBE_EDITOR.checkAndDoSubmit(1); return false;') . '">' . '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/savedokshow.gif') . ' class="c-inputButton" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDocShow', 1) . '" alt="" />' . '</a>'; } // Save & Close $buttons['save_close'] = '<input type="image" class="c-inputButton" onclick="' . htmlspecialchars('document.editform.redirect.value=\'' . $closeUrl . '\'; TBE_EDITOR.checkAndDoSubmit(1); return false;') . '" name="_saveandclosedok"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/saveandclosedok.gif', '') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc', 1) . '" />'; // Undo/Revert: if ($undoButton) { $buttons['undo'] = '<a href="#" onclick="' . htmlspecialchars('window.location.href=\'show_rechis.php?element=' . rawurlencode($this->P['table'] . ':' . $this->P['uid']) . '&revert=' . rawurlencode('field:' . $this->P['field']) . '&sumUp=-1&returnUrl=' . rawurlencode($this->R_URI) . '\'; return false;') . '">' . '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/undo.gif') . ' class="c-inputButton" title="' . htmlspecialchars(sprintf($GLOBALS['LANG']->getLL('rte_undoLastChange'), t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME'] - $undoButtonR['tstamp'], $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')))) . '" alt="" />' . '</a>'; } // Shortcut if ($GLOBALS['BE_USER']->mayMakeShortcut()) { $buttons['shortcut'] = $this->doc->makeShortcutIcon('P', '', $this->MCONF['name'], 1); } } return $buttons; }
/** * Rendering the encode-cache content * * @param array The Page tree data * @return string HTML for the information table. */ function encodeView(t3lib_pageTree $tree) { // Delete entries: $cmd = t3lib_div::_GP('cmd'); $subcmd = ''; if ($cmd === 'deleteEC') { $subcmd = t3lib_div::_GP('entry'); $this->clearDEncodeCache($subcmd); } // Traverse tree: $cc = 0; $countDisplayed = 0; $output = ''; $duplicates = array(); foreach($tree->tree as $row) { // Select rows: $displayRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','tx_realurl_urlencodecache','page_id='.intval($row['row']['uid']),'','content'); // Row title: $rowTitle = $row['HTML'].t3lib_BEfunc::getRecordTitle('pages',$row['row'],TRUE); // Add at least one empty element: if (!count($displayRows) || $subcmd==='displayed') { // Add title: $tCells = array(); $tCells[]='<td nowrap="nowrap">'.$rowTitle.'</td>'; $tCells[]='<td nowrap="nowrap"> </td>'; // Empty row: $tCells[]='<td colspan="7" align="center"> </td>'; // Compile Row: $output.= ' <tr class="bgColor'.($cc%2 ? '-20':'-10').'"> '.implode(' ',$tCells).' </tr>'; $cc++; if ($subcmd==='displayed') { foreach($displayRows as $c => $inf) { $this->clearDEncodeCache('urlhash_'.$inf['url_hash']); } } } else { foreach($displayRows as $c => $inf) { // Add icon/title and ID: $tCells = array(); if (!$c) { $tCells[]='<td nowrap="nowrap" rowspan="'.count($displayRows).'">'.$rowTitle.'</td>'; $tCells[]='<td nowrap="nowrap" rowspan="'.count($displayRows).'">'.$row['row']['uid'].'</td>'; $tCells[]='<td rowspan="'.count($displayRows).'">'. '<a href="'.$this->linkSelf('&cmd=deleteEC&entry=page_'.intval($row['row']['uid'])).'">'. '<img'.t3lib_iconWorks::skinImg($this->pObj->doc->backPath,'gfx/garbage.gif','width="11" height="12"').' title="Delete entries for page" alt="" />'. '</a>'. '</td>'; } // Get vars: $tCells[]='<td>'.htmlspecialchars(t3lib_div::fixed_lgd_cs($inf['origparams'], 100)).'</td>'; // Internal Extras: $tCells[]='<td>'.($inf['internalExtras'] ? t3lib_div::arrayToLogString(unserialize($inf['internalExtras'])) : ' ').'</td>'; // Path: $tCells[]='<td>'.htmlspecialchars(t3lib_div::fixed_lgd_cs($inf['content'],100)).'</td>'; // Delete: $tCells[]='<td>'. '<a href="'.$this->linkSelf('&cmd=deleteEC&entry=urlhash_'.intval($inf['url_hash'])).'">'. '<img'.t3lib_iconWorks::skinImg($this->pObj->doc->backPath,'gfx/garbage.gif','width="11" height="12"').' title="Delete entry" alt="" />'. '</a>'. '</td>'; // Error: $eMsg = ($duplicates[$inf['content']] && $duplicates[$inf['content']] !== $row['row']['uid'] ? $this->pObj->doc->icons(2).'Already used on page ID '.$duplicates[$inf['content']].'<br/>' : ''); if (count($GLOBALS['TYPO3_DB']->exec_SELECTgetRows('url_hash','tx_realurl_redirects','url_hash='.intval(t3lib_div::md5int($inf['content']))))) { $eMsg.= $this->pObj->doc->icons(3).'Also a redirect!'; } $tCells[]='<td>'.$eMsg.'</td>'; // Timestamp: $tCells[]='<td>'.htmlspecialchars(t3lib_BEfunc::datetime($inf['tstamp'])).' / '.htmlspecialchars(t3lib_BEfunc::calcAge(time()-$inf['tstamp'])).'</td>'; // Compile Row: $output.= ' <tr class="bgColor'.($cc%2 ? '-20':'-10').'"> '.implode(' ',$tCells).' </tr>'; $cc++; $countDisplayed++; if (!isset($duplicates[$inf['content']])) { $duplicates[$inf['content']] = $row['row']['uid']; } } } } list($count_allInTable) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('count(*) AS count','tx_realurl_urlencodecache',''); // Create header: $tCells = array(); $tCells[]='<td>Title:</td>'; $tCells[]='<td>ID:</td>'; $tCells[]='<td> </td>'; $tCells[]='<td>Host | GET variables:</td>'; $tCells[]='<td>Internal Extras:</td>'; $tCells[]='<td>Path:</td>'; $tCells[]='<td> </td>'; $tCells[]='<td>Errors:</td>'; $tCells[]='<td>Timestamp:</td>'; $output = ' <tr class="bgColor5 tableheader"> '.implode(' ',$tCells).' </tr>'.$output; // Compile final table and return: $output = ' <br/> <br/> Displayed entries: <b>'.$countDisplayed.'</b> '. '<a href="'.$this->linkSelf('&cmd=deleteEC&entry=displayed').'">'. '<img'.t3lib_iconWorks::skinImg($this->pObj->doc->backPath,'gfx/garbage.gif','width="11" height="12"').' title="Delete displayed entries" alt="" />'. '</a>'. '<br/> Total entries in encode cache: <b>'.$count_allInTable['count'].'</b> '. '<a href="'.$this->linkSelf('&cmd=deleteEC&entry=all').'">'. '<img'.t3lib_iconWorks::skinImg($this->pObj->doc->backPath,'gfx/garbage.gif','width="11" height="12"').' title="Delete WHOLE encode cache!" alt="" />'. '</a>'. '<br/> <table border="0" cellspacing="1" cellpadding="0" id="tx-realurl-pathcacheTable" class="lrPadding c-list">'.$output.' </table>'; return $output; }
/** * Create the panel of buttons for submitting the form or otherwise perform operations. * * @return array all available buttons as an assoc. array */ protected function getButtons() { global $TCA, $LANG; $buttons = array('save' => '', 'save_view' => '', 'save_new' => '', 'save_close' => '', 'close' => '', 'delete' => '', 'undo' => '', 'history' => '', 'columns_only' => '', 'csh' => '', 'translation_save' => '', 'translation_saveclear' => ''); // Render SAVE type buttons: // The action of each button is decided by its name attribute. (See doProcessData()) if (!$this->errorC && !$TCA[$this->firstEl['table']]['ctrl']['readOnly']) { // SAVE button: $buttons['save'] = t3lib_iconWorks::getSpriteIcon('actions-document-save', array('html' => '<input type="image" name="_savedok" class="c-inputButton" src="clear.gif" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc', 1) . '" />')); // SAVE / VIEW button: if ($this->viewId && !$this->noView && t3lib_extMgm::isLoaded('cms') && $this->getNewIconMode($this->firstEl['table'], 'saveDocView')) { $buttons['save_view'] = t3lib_iconWorks::getSpriteIcon('actions-document-save-view', array('html' => '<input type="image" class="c-inputButton" name="_savedokview" src="clear.gif" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveDocShow', 1) . '" />')); } // SAVE / NEW button: if (count($this->elementsData) == 1 && $this->getNewIconMode($this->firstEl['table'])) { $buttons['save_new'] = t3lib_iconWorks::getSpriteIcon('actions-document-save-new', array('html' => '<input type="image" class="c-inputButton" name="_savedoknew" src="clear.gif" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveNewDoc', 1) . '" />')); } // SAVE / CLOSE $buttons['save_close'] = t3lib_iconWorks::getSpriteIcon('actions-document-save-close', array('html' => '<input type="image" class="c-inputButton" name="_saveandclosedok" src="clear.gif" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc', 1) . '" />')); // FINISH TRANSLATION / SAVE / CLOSE if ($GLOBALS['TYPO3_CONF_VARS']['BE']['explicitConfirmationOfTranslation']) { $buttons['translation_save'] = '<input type="image" class="c-inputButton" name="_translation_savedok" src="' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/translationsavedok.gif', '', 1) . '" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.translationSaveDoc', 1) . '" />'; $buttons['translation_saveclear'] = '<input type="image" class="c-inputButton" name="_translation_savedokclear" src="' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/translationsavedok_clear.gif', '', 1) . '" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.translationSaveDocClear', 1) . '" />'; } } // CLOSE button: $buttons['close'] = '<a href="#" onclick="document.editform.closeDoc.value=1; document.editform.submit(); return false;" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-close') . '</a>'; // DELETE + UNDO buttons: if (!$this->errorC && !$TCA[$this->firstEl['table']]['ctrl']['readOnly'] && count($this->elementsData) == 1) { if ($this->firstEl['cmd'] != 'new' && t3lib_div::testInt($this->firstEl['uid'])) { // Delete: if ($this->firstEl['deleteAccess'] && !$TCA[$this->firstEl['table']]['ctrl']['readOnly'] && !$this->getNewIconMode($this->firstEl['table'], 'disableDelete')) { $aOnClick = 'return deleteRecord(\'' . $this->firstEl['table'] . '\',\'' . $this->firstEl['uid'] . '\',unescape(\'' . rawurlencode($this->retUrl) . '\'));'; $buttons['delete'] = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '" title="' . $LANG->getLL('deleteItem', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-edit-delete') . '</a>'; } // Undo: $undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->firstEl['table'], 'sys_history') . ' AND recuid=' . intval($this->firstEl['uid']), '', 'tstamp DESC', '1'); if ($undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) { $aOnClick = 'window.location.href=\'show_rechis.php?element=' . rawurlencode($this->firstEl['table'] . ':' . $this->firstEl['uid']) . '&revert=ALL_FIELDS&sumUp=-1&returnUrl=' . rawurlencode($this->R_URI) . '\'; return false;'; $buttons['undo'] = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '"' . ' title="' . htmlspecialchars(sprintf($LANG->getLL('undoLastChange'), t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME'] - $undoButtonR['tstamp'], $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')))) . '">' . t3lib_iconWorks::getSpriteIcon('actions-edit-undo') . '</a>'; } if ($this->getNewIconMode($this->firstEl['table'], 'showHistory')) { $aOnClick = 'window.location.href=\'show_rechis.php?element=' . rawurlencode($this->firstEl['table'] . ':' . $this->firstEl['uid']) . '&returnUrl=' . rawurlencode($this->R_URI) . '\'; return false;'; $buttons['history'] = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-history-open') . '</a>'; } // If only SOME fields are shown in the form, this will link the user to the FULL form: if ($this->columnsOnly) { $buttons['columns_only'] = '<a href="' . htmlspecialchars($this->R_URI . '&columnsOnly=') . '" title="' . $LANG->getLL('editWholeRecord', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a>'; } } } // add the CSH icon $buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'TCEforms', $GLOBALS['BACK_PATH'], '', TRUE); $buttons['shortcut'] = $this->shortCutLink(); $buttons['open_in_new_window'] = $this->openInNewWindowLink(); return $buttons; }
/** * 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; }
/** * Format field content of various types if $config['format'] is set to date, filesize, ..., user * This is primarily for the field type none but can be used for user field types for example * * @param array Configuration for the display * @param string The value to display * @return string Formatted Field content */ function formatValue($config, $itemValue) { $format = trim($config['format']); switch ($format) { case 'date': if ($itemValue) { $option = trim($config['format.']['option']); if ($option) { if ($config['format.']['strftime']) { $value = strftime($option, $itemValue); } else { $value = date($option, $itemValue); } } else { $value = date('d-m-Y', $itemValue); } } else { $value = ''; } if ($config['format.']['appendAge']) { $value .= ' (' . t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME'] - $itemValue, $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')) . ')'; } $itemValue = $value; break; case 'datetime': // compatibility with "eval" (type "input") $itemValue = date('H:i d-m-Y', $itemValue); break; case 'time': // compatibility with "eval" (type "input") $itemValue = date('H:i', $itemValue); break; case 'timesec': // compatibility with "eval" (type "input") $itemValue = date('H:i:s', $itemValue); break; case 'year': // compatibility with "eval" (type "input") $itemValue = date('Y', $itemValue); break; case 'int': $baseArr = array('dec' => 'd', 'hex' => 'x', 'HEX' => 'X', 'oct' => 'o', 'bin' => 'b'); $base = trim($config['format.']['base']); $format = $baseArr[$base] ? $baseArr[$base] : 'd'; $itemValue = sprintf('%' . $format, $itemValue); break; case 'float': $precision = t3lib_div::intInRange($config['format.']['precision'], 1, 10, 2); $itemValue = sprintf('%.' . $precision . 'f', $itemValue); break; case 'number': $format = trim($config['format.']['option']); $itemValue = sprintf('%' . $format, $itemValue); break; case 'md5': $itemValue = md5($itemValue); break; case 'filesize': $value = t3lib_div::formatSize(intval($itemValue)); if ($config['format.']['appendByteSize']) { $value .= ' (' . $itemValue . ')'; } $itemValue = $value; break; case 'user': $func = trim($config['format.']['userFunc']); if ($func) { $params = array('value' => $itemValue, 'args' => $config['format.']['userFunc'], 'config' => $config, 'pObj' => &$this); $itemValue = t3lib_div::callUserFunction($func, $params, $this); } break; default: break; } return $itemValue; }
/** * Create the panel of buttons for submitting the form or otherwise perform operations. * * @param string Identifier for function of module * @return array all available buttons as an assoc. array */ protected function getButtons($function = '') { global $TCA, $LANG, $BACK_PATH, $BE_USER; $buttons = array('view' => '', 'history_page' => '', 'new_content' => '', 'move_page' => '', 'move_record' => '', 'new_page' => '', 'edit_page' => '', 'record_list' => '', 'csh' => '', 'shortcut' => '', 'cache' => '', 'savedok' => '', 'savedokshow' => '', 'closedok' => '', 'deletedok' => '', 'undo' => '', 'history_record' => ''); // View page $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::viewOnClick($this->pageinfo['uid'], $BACK_PATH, t3lib_BEfunc::BEgetRootLine($this->pageinfo['uid']))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-view') . '</a>'; // Shortcut if ($BE_USER->mayMakeShortcut()) { $buttons['shortcut'] = $this->doc->makeShortcutIcon('id, edit_record, pointer, new_unique_uid, search_field, search_levels, showLimit', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']); } // Cache if (!$this->modTSconfig['properties']['disableAdvanced']) { $buttons['cache'] = '<a href="' . htmlspecialchars('db_layout.php?id=' . $this->pageinfo['uid'] . '&clear_cache=1') . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.clear_cache', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-system-cache-clear') . '</a>'; } // If access to Web>List for user, then link to that module. $buttons['record_list'] = t3lib_BEfunc::getListViewLink(array('id' => $this->pageinfo['uid'], 'returnUrl' => t3lib_div::getIndpEnv('REQUEST_URI')), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList')); if (!$this->modTSconfig['properties']['disableIconToolbar']) { // Page history $buttons['history_page'] = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(\'' . $BACK_PATH . 'show_rechis.php?element=' . rawurlencode('pages:' . $this->id) . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . '#latest\');return false;') . '" title="' . $LANG->getLL('recordHistory', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-history-open') . '</a>'; // New content element $buttons['new_content'] = '<a href="' . htmlspecialchars('db_new_content_el.php?id=' . $this->id . '&sys_language_uid=' . $this->current_sys_language . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))) . '" title="' . $LANG->getLL('newContentElement', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-new') . '</a>'; // Move page $buttons['move_page'] = '<a href="' . htmlspecialchars($BACK_PATH . 'move_el.php?table=pages&uid=' . $this->id . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))) . '" title="' . $LANG->getLL('move_page', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-page-move') . '</a>'; // Move record if (t3lib_div::testInt($this->eRParts[1])) { $buttons['move_record'] = '<a href="' . htmlspecialchars($BACK_PATH . 'move_el.php?table=' . $this->eRParts[0] . '&uid=' . $this->eRParts[1] . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))) . '">' . t3lib_iconWorks::getSpriteIcon('actions-' . ($this->eRParts[0] == 'tt_content' ? 'document' : 'page') . '-move', array('class' => 'c-inputButton', 'title' => $LANG->getLL('move_' . ($this->eRParts[0] == 'tt_content' ? 'record' : 'page'), 1))) . '</a>'; } // Create new page (wizard) $buttons['new_page'] = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(\'' . $BACK_PATH . 'db_new.php?id=' . $this->id . '&pagesOnly=1&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . '\');return false;') . '" title="' . $LANG->getLL('newPage', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-page-new') . '</a>'; // Edit page properties if ($this->CALC_PERMS & 2) { $params = '&edit[pages][' . $this->id . ']=edit'; $buttons['edit_page'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick($params, $BACK_PATH)) . '" title="' . $LANG->getLL('editPageProperties', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-page-open') . '</a>'; } // Add CSH (Context Sensitive Help) icon to tool bar if ($function == 'quickEdit') { $buttons['csh'] = t3lib_BEfunc::cshItem($this->descrTable, 'quickEdit', $BACK_PATH, '', TRUE, 'margin-top: 0px; margin-bottom: 0px;'); } else { $buttons['csh'] = t3lib_BEfunc::cshItem($this->descrTable, 'columns_' . $this->MOD_SETTINGS['function'], $BACK_PATH, '', TRUE, 'margin-top: 0px; margin-bottom: 0px;'); } if ($function == 'quickEdit') { // Save record $buttons['savedok'] = '<input class="c-inputButton" type="image" name="savedok"' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/savedok.gif', '') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc', 1) . '" alt="" />'; // Save record and show page $buttons['savedokshow'] = '<a href="#" onclick="' . htmlspecialchars('document.editform.redirect.value+=\'&popView=1\'; TBE_EDITOR.checkAndDoSubmit(1); return false;') . '" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveDocShow', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-save-view') . '</a>'; // Close record $buttons['closedok'] = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(unescape(\'' . rawurlencode($this->closeUrl) . '\')); return false;') . '" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-close') . '</a>'; // Delete record if ($this->deleteButton) { $buttons['deletedok'] = '<a href="#" onclick="' . htmlspecialchars('return deleteRecord(\'' . $this->eRParts[0] . '\',\'' . $this->eRParts[1] . '\',\'' . t3lib_div::getIndpEnv('SCRIPT_NAME') . '?id=' . $this->id . '\');') . '" title="' . $LANG->getLL('deleteItem', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-edit-delete') . '</a>'; } if ($this->undoButton) { // Undo button $buttons['undo'] = '<a href="#" onclick="' . htmlspecialchars('window.location.href=\'' . $BACK_PATH . 'show_rechis.php?element=' . rawurlencode($this->eRParts[0] . ':' . $this->eRParts[1]) . '&revert=ALL_FIELDS&sumUp=-1&returnUrl=' . rawurlencode($this->R_URI) . '\'; return false;') . '" title="' . htmlspecialchars(sprintf($LANG->getLL('undoLastChange'), t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME'] - $this->undoButtonR['tstamp'], $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')))) . '">' . t3lib_iconWorks::getSpriteIcon('actions-edit-undo') . '</a>'; // History button $buttons['history_record'] = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(\'' . $BACK_PATH . 'show_rechis.php?element=' . rawurlencode($this->eRParts[0] . ':' . $this->eRParts[1]) . '&returnUrl=' . rawurlencode($this->R_URI) . '#latest\');return false;') . '" title="' . $LANG->getLL('recordHistory', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-history-open') . '</a>'; } } } return $buttons; }