/**
  * Find syslog
  *
  * @return	array
  */
 function main()
 {
     global $TYPO3_DB;
     // Initialize result array:
     $resultArray = array('message' => $this->cli_help['name'] . LF . LF . $this->cli_help['description'], 'headers' => array('listing' => array('', '', 1), 'allDetails' => array('', '', 0)), 'listing' => array(), 'allDetails' => array());
     $rows = $TYPO3_DB->exec_SELECTgetRows('*', 'sys_log', 'tstamp>' . ($GLOBALS['EXEC_TIME'] - 25 * 3600));
     foreach ($rows as $r) {
         $l = unserialize($r['log_data']);
         $explained = '#' . $r['uid'] . ' ' . t3lib_BEfunc::datetime($r['tstamp']) . ' USER[' . $r['userid'] . ']: ' . sprintf($r['details'], $l[0], $l[1], $l[2], $l[3], $l[4], $l[5]);
         $resultArray['listing'][$r['uid']] = $explained;
         $resultArray['allDetails'][$r['uid']] = array($explained, t3lib_div::arrayToLogString($r, 'uid,userid,action,recuid,tablename,recpid,error,tstamp,type,details_nr,IP,event_pid,NEWid,workspace'));
     }
     return $resultArray;
 }
Beispiel #2
0
 /**
  * [Describe function...]
  *
  * @return	[type]		...
  */
 function getPhashExternalDocs()
 {
     $recList[] = array($this->tableHead("Filename"), $this->tableHead("Size"), $this->tableHead("Words"), $this->tableHead("mtime"), $this->tableHead("Indexed"), $this->tableHead("Updated"), $this->tableHead("Parsetime"), $this->tableHead("#sec/gr/full"), $this->tableHead("#sub"), $this->tableHead("cHash"), $this->tableHead("phash"), $this->tableHead("Path"));
     // TYPO3 pages, unique
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*) AS pcount,index_phash.*', 'index_phash', 'item_type!=\'0\'', 'phash_grouping,phash,cHashParams,data_filename,data_page_id,data_page_reg1,data_page_type,data_page_mp,gr_list,item_type,item_title,item_description,item_mtime,tstamp,item_size,contentHash,crdate,parsetime,sys_language_uid,item_crdate,externalUrl,recordUid,freeIndexUid,freeIndexSetId', 'item_type');
     while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         $cHash = count(unserialize($row["cHashParams"])) ? $this->formatCHash(unserialize($row["cHashParams"])) : "";
         $grListRec = $this->getGrlistRecord($row["phash"]);
         $recList[] = array(htmlentities(t3lib_div::fixed_lgd_cs($row["item_title"], 30)), t3lib_div::formatSize($row["item_size"]), $this->getNumberOfWords($row["phash"]), t3lib_BEfunc::datetime($row["item_mtime"]), t3lib_BEfunc::datetime($row["crdate"]), $row["tstamp"] != $row["crdate"] ? t3lib_BEfunc::datetime($row["tstamp"]) : "", $row["parsetime"], $this->getNumberOfSections($row["phash"]) . "/" . $grListRec[0]["pcount"] . "/" . $this->getNumberOfFulltext($row["phash"]), $row["pcount"], $cHash, $row["phash"], htmlentities(t3lib_div::fixed_lgd_cs($row["data_filename"], 100)));
         if ($row["pcount"] > 1) {
             $res2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery('index_phash.*', 'index_phash', 'phash_grouping=' . intval($row['phash_grouping']) . ' AND phash!=' . intval($row['phash']));
             while ($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res2)) {
                 $cHash = count(unserialize($row2["cHashParams"])) ? $this->formatCHash(unserialize($row2["cHashParams"])) : "";
                 $grListRec = $this->getGrlistRecord($row2["phash"]);
                 $recList[] = array("", "", $this->getNumberOfWords($row2["phash"]), "", t3lib_BEfunc::datetime($row2["crdate"]), $row2["tstamp"] != $row2["crdate"] ? t3lib_BEfunc::datetime($row2["tstamp"]) : "", $row2["parsetime"], $this->getNumberOfSections($row2["phash"]) . "/" . $grListRec[0]["pcount"] . "/" . $this->getNumberOfFulltext($row2["phash"]), "", $cHash, $row2["phash"], "");
             }
         }
         //		debug($row);
     }
     return $recList;
 }
	/**
	 * View error log
	 *
	 * @return	string		HTML
	 */
	function logView()	{

		$cmd = t3lib_div::_GP('cmd');
		if ($cmd==='deleteAll')	{
			$GLOBALS['TYPO3_DB']->exec_DELETEquery(
				'tx_realurl_errorlog',
				''
			);
		}

		$list = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
			'*',
			'tx_realurl_errorlog',
			'',
			'',
			'counter DESC, tstamp DESC',
			100
		);

		if (is_array($list))	{
			$output=''; $cc = 0;

			foreach($list as $rec)	{
				$host = '';
				if ($rec['rootpage_id'] != 0) {
					if (isset($hostCacheName[$rec['rootpage_id']])) {
						$host = $hostCacheName[$rec['rootpage_id']];
					}
					else {
						$hostCacheName[$rec['rootpage_id']] = $host = $this->getHostName($rec['rootpage_id']);
					}
				}

					// Add data:
				$tCells = array();
				$tCells[]='<td>'.$rec['counter'].'</td>';
				$tCells[]='<td>'.t3lib_BEfunc::dateTimeAge($rec['tstamp']).'</td>';
				$tCells[]='<td><a href="'.htmlspecialchars($host.'/'.$rec['url']).'" target="_blank">'.($host ? $host . '/' : '') . htmlspecialchars($rec['url']).'</a>'.
							' <a href="'.$this->linkSelf('&cmd=new&data[0][source]='.rawurlencode($rec['url']).'&SET[type]=redirects').'">'.
							'<img'.t3lib_iconWorks::skinImg($this->pObj->doc->backPath,'gfx/napshot.gif','width="12" height="12"').' title="Set as redirect" alt="" />'.
							'</a>'.
							'</td>';
				$tCells[]='<td>'.htmlspecialchars($rec['error']).'</td>';
				$tCells[]='<td>'.
								($rec['last_referer'] ? '<a href="'.htmlspecialchars($rec['last_referer']).'" target="_blank">'.htmlspecialchars($rec['last_referer']).'</a>' : '&nbsp;').
								'</td>';
				$tCells[]='<td>'.t3lib_BEfunc::datetime($rec['cr_date']).'</td>';

					// Compile Row:
				$output.= '
					<tr class="bgColor'.($cc%2 ? '-20':'-10').'">
						'.implode('
						',$tCells).'
					</tr>';
				$cc++;
			}
				// Create header:
			$tCells = array();
			$tCells[]='<td>Counter:</td>';
			$tCells[]='<td>Last time:</td>';
			$tCells[]='<td>URL:</td>';
			$tCells[]='<td>Error:</td>';
			$tCells[]='<td>Last Referer:</td>';
			$tCells[]='<td>First time:</td>';

			$output = '
				<tr class="bgColor5 tableheader">
					'.implode('
					',$tCells).'
				</tr>'.$output;

				// Compile final table and return:
			$output = '
			<br/>
				<a href="'.$this->linkSelf('&cmd=deleteAll').'">'.
				'<img'.t3lib_iconWorks::skinImg($this->pObj->doc->backPath,'gfx/garbage.gif','width="11" height="12"').' title="Delete All" alt="" />'.
				' Flush log</a>
				<br/>
			<table border="0" cellspacing="1" cellpadding="0" id="tx-realurl-pathcacheTable" class="lrPadding c-list">'.$output.'
			</table>';

			return $output;
		}
	}
    /**
     * Create the rows for display of the page tree
     * For each page a number of rows are shown displaying GET variable configuration
     *
     * @param	array		Page row or set-id
     * @param	string		Title string
     * @param	int			Items per Page setting
     * @return	string		HTML <tr> content (one or more)
     */
    function drawLog_addRows($pageRow_setId, $titleString, $itemsPerPage = 10)
    {
        // If Flush button is pressed, flush tables instead of selecting entries:
        if (t3lib_div::_POST('_flush')) {
            $doFlush = true;
            $doFullFlush = false;
        } elseif (t3lib_div::_POST('_flush_all')) {
            $doFlush = true;
            $doFullFlush = true;
        } else {
            $doFlush = false;
            $doFullFlush = false;
        }
        // Get result:
        if (is_array($pageRow_setId)) {
            $res = $this->crawlerObj->getLogEntriesForPageId($pageRow_setId['uid'], $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
        } else {
            $res = $this->crawlerObj->getLogEntriesForSetId($pageRow_setId, $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
        }
        // Init var:
        $colSpan = 9 + ($this->pObj->MOD_SETTINGS['log_resultLog'] ? -1 : 0) + ($this->pObj->MOD_SETTINGS['log_feVars'] ? 3 : 0);
        if (count($res)) {
            // Traverse parameter combinations:
            $c = 0;
            $content = '';
            foreach ($res as $kk => $vv) {
                // Title column:
                if (!$c) {
                    $titleClm = '<td rowspan="' . count($res) . '">' . $titleString . '</td>';
                } else {
                    $titleClm = '';
                }
                // Result:
                $resLog = $this->getResultLog($vv);
                $resStatus = $this->getResStatus($vv);
                $resFeVars = $this->getResFeVars($vv);
                // Compile row:
                $parameters = unserialize($vv['parameters']);
                // Put data into array:
                $rowData = array();
                if ($this->pObj->MOD_SETTINGS['log_resultLog']) {
                    $rowData['result_log'] = $resLog;
                } else {
                    $rowData['scheduled'] = $vv['scheduled'] > 0 ? t3lib_BEfunc::datetime($vv['scheduled']) : ' ' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.immediate');
                    $rowData['exec_time'] = $vv['exec_time'] ? t3lib_BEfunc::datetime($vv['exec_time']) : '-';
                }
                $rowData['result_status'] = t3lib_div::fixed_lgd_cs($resStatus, 50);
                $rowData['url'] = '<a href="' . htmlspecialchars($parameters['url']) . '" target="_newWIndow">' . htmlspecialchars($parameters['url']) . '</a>';
                $rowData['feUserGroupList'] = $parameters['feUserGroupList'];
                $rowData['procInstructions'] = is_array($parameters['procInstructions']) ? implode('; ', $parameters['procInstructions']) : '';
                $rowData['set_id'] = $vv['set_id'];
                if ($this->pObj->MOD_SETTINGS['log_feVars']) {
                    $rowData['tsfe_id'] = $resFeVars['id'];
                    $rowData['tsfe_gr_list'] = $resFeVars['gr_list'];
                    $rowData['tsfe_no_cache'] = $resFeVars['no_cache'];
                }
                $setId = intval(t3lib_div::_GP('setID'));
                // Put rows together:
                $content .= '
					<tr class="bgColor' . ($c % 2 ? '-20' : '-10') . '">
						' . $titleClm . '
						<td><a href="index.php?id=' . $this->pObj->id . '&qid_details=' . $vv['qid'] . '&setID=' . $setId . '">' . htmlspecialchars($vv['qid']) . '</a></td>
						<td><a href="index.php?id=' . $this->pObj->id . '&qid_read=' . $vv['qid'] . '&setID=' . $setId . '"><img src="' . $GLOBALS['BACK_PATH'] . 'gfx/refresh_n.gif" width="14" hspace="1" vspace="2" height="14" border="0" title="' . htmlspecialchars('Read') . '" alt="" /></a></td>';
                foreach ($rowData as $fKey => $value) {
                    if (t3lib_div::inList('url', $fKey)) {
                        $content .= '
						<td>' . $value . '</td>';
                    } else {
                        $content .= '
						<td>' . nl2br(htmlspecialchars($value)) . '</td>';
                    }
                }
                $content .= '
					</tr>';
                $c++;
                if ($this->CSVExport) {
                    // Only for CSV (adding qid and scheduled/exec_time if needed):
                    $rowData['result_log'] = implode('// ', explode(chr(10), $resLog));
                    $rowData['qid'] = $vv['qid'];
                    $rowData['scheduled'] = t3lib_BEfunc::datetime($vv['scheduled']);
                    $rowData['exec_time'] = $vv['exec_time'] ? t3lib_BEfunc::datetime($vv['exec_time']) : '-';
                    $this->CSVaccu[] = $rowData;
                }
            }
        } else {
            // Compile row:
            $content = '
				<tr class="bgColor-20">
					<td>' . $titleString . '</td>
					<td colspan="' . $colSpan . '"><em>' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noentries') . '</em></td>
				</tr>';
        }
        return $content;
    }
 /**
  * @param int $seconds Seconds could be the difference of a certain timestamp and time()
  * @param string $labels Labels should be something like ' min| hrs| days| yrs| min| hour| day| year'. This value is typically delivered by this function call: $GLOBALS["LANG"]->sL("LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears")
  * @return string Formatted time
  */
 public function calcAge($seconds, $labels = ' min| hrs| days| yrs| min| hour| day| year')
 {
     /** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
     return t3lib_BEfunc::datetime($seconds, $labels);
 }
Beispiel #6
0
	/**
	 * Render display of a Template Object
	 *
	 * @param	array		Template Object record to render
	 * @param	array		Array of all Template Objects (passed by reference. From here records are unset)
	 * @param	integer		Scope of DS
	 * @param	boolean		If set, the function is asked to render children to template objects (and should not call it self recursively again).
	 * @return	string		HTML content
	 */
	function renderTODisplay($toObj, $scope, $children=0)	{

			// Put together the records icon including content sensitive menu link wrapped around it:
		$recordIcon = t3lib_iconWorks::getSpriteIconForRecord('tx_templavoila_tmplobj', array(), array('title' => $toObj->getKey()));
		$recordIcon = $this->doc->wrapClickMenuOnIcon($recordIcon, 'tx_templavoila_tmplobj', $toObj->getKey(), 1, '&callingScriptId='.rawurlencode($this->doc->scriptID));

			// Preview icon:
		if ($toObj->getIcon())	{
			if (isset($this->modTSconfig['properties']['toPreviewIconThumb']) && $this->modTSconfig['properties']['toPreviewIconThumb'] != '0') {
					$path = realpath(dirname(__FILE__) . '/' . preg_replace('/\w+\/\.\.\//', '', $GLOBALS['BACK_PATH'] . $toObj->getIcon()));
					$path = str_replace(realpath(PATH_site) . '/', PATH_site, $path);
					if($path == FALSE) {
						$icon = $GLOBALS['LANG']->getLL('noicon', 1);
					} else {
						$icon = t3lib_BEfunc::getThumbNail($this->doc->backPath . 'thumbs.php', $path,
							'hspace="5" vspace="5" border="1"',
							strpos($this->modTSconfig['properties']['toPreviewIconThumb'], 'x') ? $this->modTSconfig['properties']['toPreviewIconThumb'] : '');
					}
				} else {
					$icon = '<img src="' . $this->doc->backPath . $toObj->getIcon() . '" alt="" />';
				}
		} else {
			$icon = $GLOBALS['LANG']->getLL('noicon', 1);
		}

			// Mapping status / link:
		$linkUrl = '../cm1/index.php?table=tx_templavoila_tmplobj&uid=' . $toObj->getKey() . '&_reload_from=1&id=' . $this->id . '&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));

		$fileReference = t3lib_div::getFileAbsFileName($toObj->getFileref());
		if (@is_file($fileReference))	{
			$this->tFileList[$fileReference]++;
			$fileRef = '<a href="'.htmlspecialchars($this->doc->backPath.'../'.substr($fileReference,strlen(PATH_site))).'" target="_blank">'.htmlspecialchars($toObj->getFileref()).'</a>';
			$fileMsg = '';
			$fileMtime = filemtime($fileReference);
		} else {
			$fileRef = htmlspecialchars($toObj->getFileref());
			$fileMsg = '<div class="typo3-red">ERROR: File not found</div>';
			$fileMtime = 0;
		}

		$mappingStatus = $mappingStatus_index = '';
		if ($fileMtime && $toObj->getFilerefMtime()) {
			if ($toObj->getFilerefMD5() != '') {
				$modified = (@md5_file($fileReference) != $toObj->getFilerefMD5());
			} else {
				$modified = ($toObj->getFilerefMtime() != $fileMtime);
			}
			if ($modified)	{
				$mappingStatus = $mappingStatus_index = t3lib_iconWorks::getSpriteIcon('status-dialog-warning');
				$mappingStatus.= sprintf($GLOBALS['LANG']->getLL('towasupdated', 1), t3lib_BEfunc::datetime($toObj->getTstamp()));
				$this->setErrorLog($scope, 'warning', sprintf($GLOBALS['LANG']->getLL('warning_mappingstatus', 1), $mappingStatus, $toObj->getLabel()));
			} else {
				$mappingStatus = $mappingStatus_index = t3lib_iconWorks::getSpriteIcon('status-dialog-ok');
				$mappingStatus.= $GLOBALS['LANG']->getLL('mapping_uptodate', 1);
			}
			$mappingStatus .= '<br/><input type="button" onclick="jumpToUrl(\'' . htmlspecialchars($linkUrl) . '\');" value="' . $GLOBALS['LANG']->getLL('update_mapping', 1) . '" />';
		} elseif (!$fileMtime) {
			$mappingStatus = $mappingStatus_index = t3lib_iconWorks::getSpriteIcon('status-dialog-error');
			$mappingStatus.= $GLOBALS['LANG']->getLL('notmapped', 1);
			$this->setErrorLog($scope, 'fatal', sprintf($GLOBALS['LANG']->getLL('warning_mappingstatus', 1), $mappingStatus, $toObj->getLabel()));

			$mappingStatus .= $GLOBALS['LANG']->getLL('updatemapping_info');
			$mappingStatus .= '<br/><input type="button" onclick="jumpToUrl(\'' . htmlspecialchars($linkUrl) . '\');" value="' . $GLOBALS['LANG']->getLL('map', 1) . '" />';
		} else {
			$mappingStatus = '';
			$mappingStatus .= '<input type="button" onclick="jumpToUrl(\'' . htmlspecialchars($linkUrl) . '\');" value="' . $GLOBALS['LANG']->getLL('remap', 1) . '" />';
			$mappingStatus .= '&nbsp;<input type="button" onclick="jumpToUrl(\'' . htmlspecialchars($linkUrl . '&_preview=1') . '\');" value="' . $GLOBALS['LANG']->getLL('preview', 1) . '" />';
		}

		if ($this->MOD_SETTINGS['set_details'])	{
			$XMLinfo = $this->DSdetails($toObj->getLocalDataprotXML(TRUE));
		}

			// Format XML if requested
		if ($this->MOD_SETTINGS['set_details'])	{
			if ($toObj->getLocalDataprotXML(TRUE))	{
				require_once(PATH_t3lib.'class.t3lib_syntaxhl.php');
				$hlObj = t3lib_div::makeInstance('t3lib_syntaxhl');
				$lpXML = '<pre>'.str_replace(chr(9),'&nbsp;&nbsp;&nbsp;',$hlObj->highLight_DS($toObj->getLocalDataprotXML(TRUE))).'</pre>';
			} else $lpXML = '';
		}
		$lpXML.= '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[tx_templavoila_tmplobj]['.$toObj->getKey().']=edit&columnsOnly=localprocessing',$this->doc->backPath)).'">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a>';

			// Compile info table:
		$tableAttribs = ' border="0" cellpadding="1" cellspacing="1" width="98%" style="margin-top: 3px;" class="lrPadding"';

			// Links:
		$toTitle = '<a href="' . htmlspecialchars($linkUrl) . '">' . htmlspecialchars($GLOBALS['LANG']->sL($toObj->getLabel())) . '</a>';
		$editLink = '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[tx_templavoila_tmplobj]['.$toObj->getKey().']=edit',$this->doc->backPath)).'">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a>';

		$fRWTOUres = array();

		if (!$children)	{
			if ($this->MOD_SETTINGS['set_details'])	{
				$fRWTOUres = $this->findRecordsWhereTOUsed($toObj,$scope);
			}

			$content.='
			<table'.$tableAttribs.'>
				<tr class="bgColor4-20">
					<td colspan="3">'.
						$recordIcon.
						$toTitle.
						$editLink.
						'</td>
				</tr>
				<tr class="bgColor4">
					<td rowspan="'.($this->MOD_SETTINGS['set_details'] ? 7 : 4).'" style="width: 100px; text-align: center;">'.$icon.'</td>
					<td style="width:200px;">' . $GLOBALS['LANG']->getLL('filereference', 1) . ':</td>
					<td>'.$fileRef.$fileMsg.'</td>
				</tr>
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('description', 1) . ':</td>
					<td>'.htmlspecialchars($toObj->getDescription()).'</td>
				</tr>
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('mappingstatus', 1) . ':</td>
					<td>'.$mappingStatus.'</td>
				</tr>
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('localprocessing_xml') . ':</td>
					<td>
						'.$lpXML.($toObj->getLocalDataprotXML(TRUE) ?
						t3lib_div::formatSize(strlen($toObj->getLocalDataprotXML(TRUE))).' bytes'.
						($this->MOD_SETTINGS['set_details'] ? '<hr/>'.$XMLinfo['HTML'] : '') : '').'
					</td>
				</tr>'.($this->MOD_SETTINGS['set_details'] ? '
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('usedby', 1) . ':</td>
					<td>'.$fRWTOUres['HTML'].'</td>
				</tr>
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('created', 1) . ':</td>
					<td>' . t3lib_BEfunc::datetime($toObj->getCrdate()) . ' ' . $GLOBALS['LANG']->getLL('byuser', 1) . ' [' . $toObj->getCruser() . ']</td>
				</tr>
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('updated', 1) . ':</td>
					<td>'.t3lib_BEfunc::datetime($toObj->getTstamp()).'</td>
				</tr>' : '').'
			</table>
			';
		} else {
			$content.='
			<table'.$tableAttribs.'>
				<tr class="bgColor4-20">
					<td colspan="3">'.
						$recordIcon.
						$toTitle.
						$editLink.
						'</td>
				</tr>
				<tr class="bgColor4">
					<td style="width:200px;">' . $GLOBALS['LANG']->getLL('filereference', 1) . ':</td>
					<td>'.$fileRef.$fileMsg.'</td>
				</tr>
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('mappingstatus', 1) . ':</td>
					<td>'.$mappingStatus.'</td>
				</tr>
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('rendertype', 1) . ':</td>
					<td>' . $this->getProcessedValue('tx_templavoila_tmplobj', 'rendertype', $toObj->getRendertype()) . '</td>
				</tr>
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('language', 1) . ':</td>
					<td>' . $this->getProcessedValue('tx_templavoila_tmplobj', 'sys_language_uid', $toObj->getSyslang()) . '</td>
				</tr>
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('localprocessing_xml') . ':</td>
					<td>
						'.$lpXML.($toObj->getLocalDataprotXML(TRUE) ?
						t3lib_div::formatSize(strlen($toObj->getLocalDataprotXML(TRUE))).' bytes'.
						($this->MOD_SETTINGS['set_details'] ? '<hr/>'.$XMLinfo['HTML'] : '') : '').'
					</td>
				</tr>'.($this->MOD_SETTINGS['set_details'] ? '
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('created', 1) . ':</td>
					<td>'.t3lib_BEfunc::datetime($toObj->getCrdate()) . ' ' . $GLOBALS['LANG']->getLL('byuser', 1) . ' [' . $toObj->getCruser() . ']</td>
				</tr>
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('updated', 1) . ':</td>
					<td>'.t3lib_BEfunc::datetime($toObj->getTstamp()).'</td>
				</tr>' : '').'
			</table>
			';
		}

			// Traverse template objects which are not children of anything:
		if(!$childRen) {
			$toRepo = t3lib_div::makeInstance('tx_templavoila_templateRepository');
			$toChildren = $toRepo->getTemplatesByParentTemplate($toObj);
		} else {
			$toChildren = array();
		}

		if (!$children && count($toChildren))	{
			$TOchildrenContent = '';
			foreach($toChildren as $toChild)	{
				$rTODres = $this->renderTODisplay($toChild, $scope, 1);
				$TOchildrenContent.= $rTODres['HTML'];
			}
			$content.='<div style="margin-left: 102px;">'.$TOchildrenContent.'</div>';
		}

			// Return content
		return array('HTML' => $content, 'mappingStatus' => $mappingStatus_index, 'usage' => $fRWTOUres['usage']);
	}
    /**
     * 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 . '&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 = 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">&nbsp;' . date('d', $nextMidNight - ($a + 1) * 24 * 3600) . '&nbsp;</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">&nbsp;' . intval(date('H', $nextHour - ($a + 1) * 3600)) . '&nbsp;</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]) . '&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;
    }
    /**
     * Looks up stage changes for version and displays a formatted view on mouseover.
     *
     * @param	string		Table name
     * @param	integer		Record ID
     * @param	string		HTML string to wrap the mouseover around (should be stage change links)
     * @return	string		HTML code.
     */
    function showStageChangeLog($table, $id, $stageCommands)
    {
        global $LANG;
        $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('log_data,tstamp,userid', 'sys_log', 'action=6 and details_nr=30
				AND tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($table, 'sys_log') . '
				AND recuid=' . intval($id));
        $entry = array();
        foreach ($rows as $dat) {
            $data = unserialize($dat['log_data']);
            $username = $this->be_user_Array[$dat['userid']] ? $this->be_user_Array[$dat['userid']]['username'] : '******' . $dat['userid'] . ']';
            switch ($data['stage']) {
                case 1:
                    $text = $LANG->getLL('stage_sent_to_review');
                    break;
                case 10:
                    $text = $LANG->getLL('stage_approved_for_publish');
                    break;
                case -1:
                    $text = $LANG->getLL('stage_rejected');
                    break;
                case 0:
                    $text = $LANG->getLL('stage_reset_to_editing');
                    break;
                default:
                    $text = $LANG->getLL('stage_undefined');
                    break;
            }
            $text = t3lib_BEfunc::datetime($dat['tstamp']) . ': ' . sprintf($text, htmlspecialchars($username));
            $text .= $data['comment'] ? '<br />' . $LANG->getLL('stage_label_user_comment') . ' <em>' . htmlspecialchars($data['comment']) . '</em>' : '';
            $entry[] = $text;
        }
        return count($entry) ? '<span onmouseover="document.getElementById(\'log_' . $table . $id . '\').style.visibility = \'visible\';" onmouseout="document.getElementById(\'log_' . $table . $id . '\').style.visibility = \'hidden\';">' . $stageCommands . ' (' . count($entry) . ')</span>' . '<div class="logLayer" style="visibility: hidden; position: absolute;" id="log_' . $table . $id . '">' . implode('<hr/>', $entry) . '</div>' : $stageCommands;
    }
Beispiel #9
0
 /**
  * Create inner information panel for workspace list. This panel is
  * initially hidden and becomes visible when user click on the expand
  * icon on the very left of workspace list against the workspace he
  * wants to explore.
  *
  * @param	array		Workspace information
  * @return	string		Formatted workspace information
  */
 function workspaceList_formatWorkspaceData(&$wksp)
 {
     global $LANG;
     $content = '<table cellspacing="0" cellpadding="0" width="100%" class="ver-wl-details-table">' . '<tr><td class="ver-wl-details-label"><strong>' . $LANG->getLL('workspace_list_label_file_mountpoints') . '</strong></td>' . '<td class="ver-wl-details">' . $this->workspaceList_getFileMountPoints($wksp) . '</td></tr>' . '<tr><td class="ver-wl-details-label"><strong>' . $LANG->getLL('workspace_list_label_db_mountpoints') . '</strong></td>' . '<td class="ver-wl-details">' . $this->workspaceList_getWebMountPoints($wksp) . '</td></tr>';
     if ($wksp['uid'] > 0) {
         // Displaying information below makes sence only for custom workspaces
         $content .= '<tr><td class="ver-wl-details-label"><strong>' . $LANG->getLL('workspace_list_label_frozen') . '</strong></td>' . '<td class="ver-wl-details">' . $LANG->getLL($wksp['freeze'] ? 'workspace_list_label_frozen_yes' : 'workspace_list_label_frozen_no') . '</td></tr>' . '<tr><td class="ver-wl-details-label"><strong>' . $LANG->getLL('workspace_list_label_publish_date') . '</strong></td>' . '<td class="ver-wl-details">' . ($wksp['publish_time'] == 0 ? '&nbsp;&ndash;' : t3lib_BEfunc::datetime($wksp['publish_time'])) . '</td></tr>' . '<tr><td class="ver-wl-details-label"><strong>' . $LANG->getLL('workspace_list_label_unpublish_date') . '</strong></td>' . '<td class="ver-wl-details">' . ($wksp['unpublish_time'] == 0 ? '&nbsp;&ndash;' : t3lib_BEfunc::datetime($wksp['unpublish_time'])) . '</td></tr>' . '<tr><td class="ver-wl-details-label"><strong>' . $LANG->getLL('workspace_list_label_your_access') . '</strong></td>' . '<td class="ver-wl-details">' . $LANG->getLL('workspace_list_access_' . $wksp['_ACCESS']) . '</td></tr>' . '<tr><td class="ver-wl-details-label"><strong>' . $LANG->getLL('workspace_list_label_workspace_users') . '</strong></td>' . '<td class="ver-wl-details">' . $this->workspaceList_getUserList($wksp) . '</td></tr>';
     } else {
         if ($GLOBALS['BE_USER']->isAdmin()) {
             // show users for draft/live workspace only to admin users
             $content .= '<tr><td class="ver-wl-details-label"><strong>' . $LANG->getLL('workspace_list_label_workspace_users') . '</strong></td>' . '<td class="ver-wl-details">' . $this->workspaceList_getUserList($wksp) . '</td></tr>';
         }
     }
     $content .= '</table>';
     return $content;
 }
 /**
  * Renders a list of saved exports as text.
  *
  * @return string text
  */
 function renderExportsCli()
 {
     global $LANG;
     $out = '';
     $content = array();
     $exports = $this->fetchExports();
     foreach ($exports as $export => $exportData) {
         $content[$export] = sprintf('%-15s%-15s%-15s%-15s%s', t3lib_BEfunc::datetime($exportData['crdate']), $exportData['l10ncfg_id'], $exportData['exportType'], $exportData['translation_lang'], sprintf('%suploads/tx_l10nmgr/jobs/out/%s', PATH_site, $exportData['filename']));
     }
     $out = sprintf('%-15s%-15s%-15s%-15s%s%s%s', $LANG->getLL('export.overview.date.label'), $LANG->getLL('export.overview.configuration.label'), $LANG->getLL('export.overview.type.label'), $LANG->getLL('export.overview.targetlanguage.label'), $LANG->getLL('export.overview.filename.label'), LF, implode(LF, $content));
     return $out;
 }
Beispiel #11
0
    /**
     * Gets an array with all sys_log entries and their comments for the given record uid and table
     *
     * @param integer $uid uid of changed element to search for in log
     * @return string $table table name
     */
    public function getCommentsForRecord($uid, $table)
    {
        $stagesService = t3lib_div::makeInstance('Tx_Workspaces_Service_Stages');
        $sysLogReturnArray = array();
        $sysLogRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('log_data,tstamp,userid', 'sys_log', 'action=6 and details_nr=30
				AND tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($table, 'sys_log') . '
				AND recuid=' . intval($uid), '', 'tstamp DESC');
        foreach ($sysLogRows as $sysLogRow) {
            $sysLogEntry = array();
            $data = unserialize($sysLogRow['log_data']);
            $beUserRecord = t3lib_BEfunc::getRecord('be_users', $sysLogRow['userid']);
            $sysLogEntry['stage_title'] = $stagesService->getStageTitle($data['stage']);
            $sysLogEntry['user_uid'] = $sysLogRow['userid'];
            $sysLogEntry['user_username'] = is_array($beUserRecord) ? $beUserRecord['username'] : '';
            $sysLogEntry['tstamp'] = t3lib_BEfunc::datetime($sysLogRow['tstamp']);
            $sysLogEntry['user_comment'] = $data['comment'];
            $sysLogReturnArray[] = $sysLogEntry;
        }
        return $sysLogReturnArray;
    }
Beispiel #12
0
    /**
     * Printing the debug-log from the DBAL extension
     *
     * To enabled debugging, you will have to enabled it in the configuration!
     *
     * @return	string HTML content
     */
    protected function printLogMgm()
    {
        // Disable debugging in any case...
        $GLOBALS['TYPO3_DB']->debug = FALSE;
        // Get cmd:
        $cmd = (string) t3lib_div::_GP('cmd');
        switch ($cmd) {
            case 'flush':
                $res = $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('tx_dbal_debuglog');
                $res = $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('tx_dbal_debuglog_where');
                $outStr = 'Log FLUSHED!';
                break;
            case 'joins':
                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('table_join,exec_time,query,script', 'tx_dbal_debuglog', 'table_join!=\'\'', 'table_join,script,exec_time,query');
                // Init vars in which to pick up the query result:
                $tableIndex = array();
                $tRows = array();
                $tRows[] = '
					<tr>
						<td>Execution time</td>
						<td>Table joins</td>
						<td>Script</td>
						<td>Query</td>
					</tr>';
                while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                    $tableArray = $GLOBALS['TYPO3_DB']->SQLparser->parseFromTables($row['table_join']);
                    // Create table name index:
                    foreach ($tableArray as $a) {
                        foreach ($tableArray as $b) {
                            if ($b['table'] != $a['table']) {
                                $tableIndex[$a['table']][$b['table']] = 1;
                            }
                        }
                    }
                    // Create output row
                    $tRows[] = '
						<tr>
							<td>' . htmlspecialchars($row['exec_time']) . '</td>
							<td>' . htmlspecialchars($row['table_join']) . '</td>
							<td>' . htmlspecialchars($row['script']) . '</td>
							<td>' . htmlspecialchars($row['query']) . '</td>
						</tr>';
                }
                // Printing direct joins:
                $outStr .= '<h4>Direct joins:</h4>' . t3lib_div::view_array($tableIndex);
                // Printing total dependencies:
                foreach ($tableIndex as $priTable => $a) {
                    foreach ($tableIndex as $tableN => $v) {
                        foreach ($v as $tableP => $vv) {
                            if ($tableP == $priTable) {
                                $tableIndex[$priTable] = array_merge($v, $a);
                            }
                        }
                    }
                }
                $outStr .= '<h4>Total dependencies:</h4>' . t3lib_div::view_array($tableIndex);
                // Printing data rows:
                $outStr .= '
					<table border="1" cellspacing="0">' . implode('', $tRows) . '
					</table>';
                break;
            case 'errors':
                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('serdata,exec_time,query,script', 'tx_dbal_debuglog', 'errorFlag>0', '', 'tstamp DESC');
                // Init vars in which to pick up the query result:
                $tRows = array();
                $tRows[] = '
					<tr>
						<td>Execution time</td>
						<td>Error data</td>
						<td>Script</td>
						<td>Query</td>
					</tr>';
                while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                    // Create output row
                    $tRows[] = '
						<tr>
							<td>' . htmlspecialchars($row['exec_time']) . '</td>
							<td>' . t3lib_div::view_array(unserialize($row['serdata'])) . '</td>
							<td>' . htmlspecialchars($row['script']) . '</td>
							<td>' . htmlspecialchars($row['query']) . '</td>
						</tr>';
                }
                // Printing data rows:
                $outStr .= '
					<table border="1" cellspacing="0">' . implode('', $tRows) . '
					</table>';
                break;
            case 'parsing':
                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('query,serdata', 'tx_dbal_debuglog', 'errorFlag&2=2');
                $tRows = array();
                while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                    // Create output row
                    $tRows[] = '
						<tr>
							<td>' . htmlspecialchars($row['query']) . '</td>
						</tr>';
                }
                // Printing data rows:
                $outStr .= '
					<table border="1" cellspacing="0">' . implode('', $tRows) . '
					</table>';
                break;
            case 'where':
                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp,script,tablename,whereclause', 'tx_dbal_debuglog_where', '', '', 'tstamp DESC');
                $tRows = array();
                $tRows[] = '
					<tr>
						<td>Time</td>
						<td>Script</td>
						<td>Table</td>
						<td>WHERE clause</td>
					</tr>';
                while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                    $tRows[] = '
						<tr>
							<td>' . t3lib_BEfunc::datetime($row['tstamp']) . '</td>
							<td>' . htmlspecialchars($row['script']) . '</td>
							<td>' . htmlspecialchars($row['tablename']) . '</td>
								<td>' . str_replace(array('\'\'', '""', 'IS NULL', 'IS NOT NULL'), array('<span style="background-color:#ff0000;color:#ffffff;padding:2px;font-weight:bold;">\'\'</span>', '<span style="background-color:#ff0000;color:#ffffff;padding:2px;font-weight:bold;">""</span>', '<span style="background-color:#00ff00;color:#ffffff;padding:2px;font-weight:bold;">IS NULL</span>', '<span style="background-color:#00ff00;color:#ffffff;padding:2px;font-weight:bold;">IS NOT NULL</span>'), htmlspecialchars($row['whereclause'])) . '</td>
						</tr>';
                }
                $outStr = '
					<table border="1" cellspacing="0">' . implode('', $tRows) . '
					</table>';
                break;
            default:
                // Look for request to view specific script exec:
                $specTime = t3lib_div::_GP('specTime');
                if ($specTime) {
                    $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('exec_time,errorFlag,table_join,serdata,query', 'tx_dbal_debuglog', 'tstamp=' . (int) $specTime);
                    $tRows = array();
                    $tRows[] = '
						<tr>
							<td>Execution time</td>
							<td>Error</td>
							<td>Table joins</td>
							<td>Data</td>
							<td>Query</td>
						</tr>';
                    while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                        $tRows[] = '
							<tr>
								<td>' . htmlspecialchars($row['exec_time']) . '</td>
								<td>' . ($row['errorFlag'] ? 1 : 0) . '</td>
								<td>' . htmlspecialchars($row['table_join']) . '</td>
								<td>' . t3lib_div::view_array(unserialize($row['serdata'])) . '</td>
								<td>' . str_replace(array('\'\'', '""', 'IS NULL', 'IS NOT NULL'), array('<span style="background-color:#ff0000;color:#ffffff;padding:2px;font-weight:bold;">\'\'</span>', '<span style="background-color:#ff0000;color:#ffffff;padding:2px;font-weight:bold;">""</span>', '<span style="background-color:#00ff00;color:#ffffff;padding:2px;font-weight:bold;">IS NULL</span>', '<span style="background-color:#00ff00;color:#ffffff;padding:2px;font-weight:bold;">IS NOT NULL</span>'), htmlspecialchars($row['query'])) . '</td>
							</tr>';
                    }
                } else {
                    $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp,script, SUM(exec_time) as calc_sum, count(*) AS qrycount, MAX(errorFlag) as error', 'tx_dbal_debuglog', '', 'tstamp,script', 'tstamp DESC');
                    $tRows = array();
                    $tRows[] = '
						<tr>
							<td>Time</td>
							<td># of queries</td>
							<td>Error</td>
							<td>Time (ms)</td>
							<td>Script</td>
						</tr>';
                    while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                        $tRows[] = '
							<tr>
								<td>' . t3lib_BEfunc::datetime($row['tstamp']) . '</td>
								<td>' . htmlspecialchars($row['qrycount']) . '</td>
								<td>' . ($row['error'] ? '<strong style="color:#f00">ERR</strong>' : '') . '</td>
								<td>' . htmlspecialchars($row['calc_sum']) . '</td>
								<td><a href="' . $this->thisScript . '&amp;specTime=' . intval($row['tstamp']) . '">' . htmlspecialchars($row['script']) . '</a></td>
							</tr>';
                    }
                }
                $outStr = '
					<table border="1" cellspacing="0">' . implode('', $tRows) . '
					</table>';
                break;
        }
        $menu = '
					<a href="' . $this->thisScript . '&amp;cmd=flush">FLUSH LOG</a> -
					<a href="' . $this->thisScript . '&amp;cmd=joins">JOINS</a> -
					<a href="' . $this->thisScript . '&amp;cmd=errors">ERRORS</a> -
					<a href="' . $this->thisScript . '&amp;cmd=parsing">PARSING</a> -
					<a href="' . $this->thisScript . '">LOG</a> -
					<a href="' . $this->thisScript . '&amp;cmd=where">WHERE</a> -

					<a href="' . htmlspecialchars(t3lib_div::linkThisScript()) . '" target="tx_debuglog">[New window]</a>
					<hr />
		';
        return $menu . $outStr;
    }
    /**
     * Renders a list of saved exports as HTML table.
     *
     * @return string HTML table
     */
    function renderExports()
    {
        global $LANG;
        $out = '';
        $content = array();
        $exports = $this->fetchExports();
        foreach ($exports as $export => $exportData) {
            $content[$export] = sprintf('
<tr class="db_list_normal">
	<td>%s</td>
	<td>%s</td>
	<td>%s</td>
	<td>%s</td>
	<td>%s</td>
</tr>', t3lib_BEfunc::datetime($exportData['crdate']), $exportData['l10ncfg_id'], $exportData['exportType'], $exportData['translation_lang'], sprintf('<a href="%suploads/tx_l10nmgr/saved_files/%s">%s</a>', t3lib_div::getIndpEnv('TYPO3_SITE_URL'), $exportData['filename'], $exportData['filename']));
        }
        $out = sprintf('
<table border="0" cellpadding="0" cellspacing="0" class="typo3-dblist">
	<thead>
		<tr class="t3-row-header">
			<td>%s</td>
			<td>%s</td>
			<td>%s</td>
			<td>%s</td>
			<td>%s</td>
		</tr>
	</thead>
	<tbody>
%s
	</tbody>
</table>', $LANG->getLL('export.overview.date.label'), $LANG->getLL('export.overview.configuration.label'), $LANG->getLL('export.overview.type.label'), $LANG->getLL('export.overview.targetlanguage.label'), $LANG->getLL('export.overview.filename.label'), implode(chr(10), $content));
        return $out;
    }
Beispiel #14
0
 /**
  * Generates grid list array from given versions.
  *
  * @param array $versions
  * @param string $filterTxt
  * @return void
  */
 protected function generateDataArray(array $versions, $filterTxt)
 {
     /** @var $stagesObj Tx_Workspaces_Service_Stages */
     $stagesObj = t3lib_div::makeInstance('Tx_Workspaces_Service_Stages');
     /** @var $workspacesObj Tx_Workspaces_Service_Workspaces */
     $workspacesObj = t3lib_div::makeInstance('Tx_Workspaces_Service_Workspaces');
     $availableWorkspaces = $workspacesObj->getAvailableWorkspaces();
     $workspaceAccess = $GLOBALS['BE_USER']->checkWorkspace($GLOBALS['BE_USER']->workspace);
     $swapStage = $workspaceAccess['publish_access'] & 1 ? Tx_Workspaces_Service_Stages::STAGE_PUBLISH_ID : 0;
     $swapAccess = $GLOBALS['BE_USER']->workspacePublishAccess($GLOBALS['BE_USER']->workspace) && $GLOBALS['BE_USER']->workspaceSwapAccess();
     $this->initializeWorkspacesCachingFramework();
     // check for dataArray in cache
     if ($this->getDataArrayFromCache($versions, $filterTxt) == FALSE) {
         $stagesObj = t3lib_div::makeInstance('Tx_Workspaces_Service_Stages');
         foreach ($versions as $table => $records) {
             $versionArray = array('table' => $table);
             foreach ($records as $record) {
                 $origRecord = t3lib_BEFunc::getRecord($table, $record['t3ver_oid']);
                 $versionRecord = t3lib_BEFunc::getRecord($table, $record['uid']);
                 if (isset($GLOBALS['TCA'][$table]['columns']['hidden'])) {
                     $recordState = $this->workspaceState($versionRecord['t3ver_state'], $origRecord['hidden'], $versionRecord['hidden']);
                 } else {
                     $recordState = $this->workspaceState($versionRecord['t3ver_state']);
                 }
                 $isDeletedPage = $table == 'pages' && $recordState == 'deleted';
                 $viewUrl = tx_Workspaces_Service_Workspaces::viewSingleRecord($table, $record['t3ver_oid'], $origRecord);
                 $pctChange = $this->calculateChangePercentage($table, $origRecord, $versionRecord);
                 $versionArray['uid'] = $record['uid'];
                 $versionArray['workspace'] = $versionRecord['t3ver_id'];
                 $versionArray['label_Workspace'] = htmlspecialchars($versionRecord[$GLOBALS['TCA'][$table]['ctrl']['label']]);
                 $versionArray['label_Live'] = htmlspecialchars($origRecord[$GLOBALS['TCA'][$table]['ctrl']['label']]);
                 $versionArray['label_Stage'] = htmlspecialchars($stagesObj->getStageTitle($versionRecord['t3ver_stage']));
                 $versionArray['change'] = $pctChange;
                 $versionArray['path_Live'] = htmlspecialchars(t3lib_BEfunc::getRecordPath($record['livepid'], '', 999));
                 $versionArray['path_Workspace'] = htmlspecialchars(t3lib_BEfunc::getRecordPath($record['wspid'], '', 999));
                 $versionArray['workspace_Title'] = htmlspecialchars(tx_Workspaces_Service_Workspaces::getWorkspaceTitle($versionRecord['t3ver_wsid']));
                 $versionArray['workspace_Tstamp'] = $versionRecord['tstamp'];
                 $versionArray['workspace_Formated_Tstamp'] = t3lib_BEfunc::datetime($versionRecord['tstamp']);
                 $versionArray['t3ver_oid'] = $record['t3ver_oid'];
                 $versionArray['livepid'] = $record['livepid'];
                 $versionArray['stage'] = $versionRecord['t3ver_stage'];
                 $versionArray['icon_Live'] = t3lib_iconWorks::mapRecordTypeToSpriteIconClass($table, $origRecord);
                 $versionArray['icon_Workspace'] = t3lib_iconWorks::mapRecordTypeToSpriteIconClass($table, $versionRecord);
                 $versionArray['allowedAction_nextStage'] = $stagesObj->isNextStageAllowedForUser($versionRecord['t3ver_stage']);
                 $versionArray['allowedAction_prevStage'] = $stagesObj->isPrevStageAllowedForUser($versionRecord['t3ver_stage']);
                 if ($swapAccess && $swapStage != 0 && $versionRecord['t3ver_stage'] == $swapStage) {
                     $versionArray['allowedAction_swap'] = $stagesObj->isNextStageAllowedForUser($swapStage);
                 } else {
                     if ($swapAccess && $swapStage == 0) {
                         $versionArray['allowedAction_swap'] = TRUE;
                     } else {
                         $versionArray['allowedAction_swap'] = FALSE;
                     }
                 }
                 $versionArray['allowedAction_delete'] = TRUE;
                 // preview and editing of a deleted page won't work ;)
                 $versionArray['allowedAction_view'] = !$isDeletedPage && $viewUrl;
                 $versionArray['allowedAction_edit'] = !$isDeletedPage;
                 $versionArray['allowedAction_editVersionedPage'] = !$isDeletedPage;
                 $versionArray['state_Workspace'] = $recordState;
                 if ($filterTxt == '' || $this->isFilterTextInVisibleColumns($filterTxt, $versionArray)) {
                     $this->dataArray[] = $versionArray;
                 }
             }
         }
         $this->sortDataArray();
         $this->setDataArrayIntoCache($versions, $filterTxt);
     }
     $this->sortDataArray();
 }
Beispiel #15
0
    /**
     * Render display of a Template Object
     *
     * @param	array		Template Object record to render
     * @param	array		Array of all Template Objects (passed by reference. From here records are unset)
     * @param	integer		Scope of DS
     * @param	boolean		If set, the function is asked to render children to template objects (and should not call it self recursively again).
     * @return	string		HTML content
     */
    function renderTODisplay($toObj, &$toRecords, $scope, $children = 0)
    {
        // Put together the records icon including content sensitive menu link wrapped around it:
        $recordIcon = t3lib_iconWorks::getIconImage('tx_templavoila_tmplobj', $toObj, $this->doc->backPath, 'class="absmiddle"');
        $recordIcon = $this->doc->wrapClickMenuOnIcon($recordIcon, 'tx_templavoila_tmplobj', $toObj['uid'], 1, '&callingScriptId=' . rawurlencode($this->doc->scriptID));
        // Preview icon:
        if ($toObj['previewicon']) {
            $icon = '<img src="' . $this->doc->backPath . '../uploads/tx_templavoila/' . $toObj['previewicon'] . '" alt="" />';
        } else {
            $icon = '[No icon]';
        }
        // Mapping status / link:
        $linkUrl = '../cm1/index.php?table=tx_templavoila_tmplobj&uid=' . $toObj['uid'] . '&_reload_from=1&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
        $fileReference = t3lib_div::getFileAbsFileName($toObj['fileref']);
        if (@is_file($fileReference)) {
            $this->tFileList[$fileReference]++;
            $fileRef = '<a href="' . htmlspecialchars($this->doc->backPath . '../' . substr($fileReference, strlen(PATH_site))) . '" target="_blank">' . htmlspecialchars($toObj['fileref']) . '</a>';
            $fileMsg = '';
            $fileMtime = filemtime($fileReference);
        } else {
            $fileRef = htmlspecialchars($toObj['fileref']);
            $fileMsg = '<div class="typo3-red">ERROR: File not found</div>';
            $fileMtime = 0;
        }
        $mappingStatus = $mappingStatus_index = '';
        if ($fileMtime && $toObj['fileref_mtime']) {
            if ($toObj['fileref_md5'] != '') {
                $modified = @md5_file($fileReference) != $toObj['fileref_md5'];
            } else {
                $modified = $toObj['fileref_mtime'] != $fileMtime;
            }
            if ($modified) {
                $mappingStatus = $mappingStatus_index = '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/icon_warning2.gif', 'width="18" height="16"') . ' alt="" class="absmiddle" />';
                $mappingStatus .= 'Template file was updated since last mapping (' . t3lib_BEfunc::datetime($toObj['tstamp']) . ') and you might need to remap the Template Object!';
                $this->setErrorLog($scope, 'warning', $mappingStatus . ' (TO: "' . $toObj['title'] . '")');
            } else {
                $mappingStatus = $mappingStatus_index = '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/icon_ok2.gif', 'width="18" height="16"') . ' alt="" class="absmiddle" />';
                $mappingStatus .= 'Mapping Up-to-date.';
            }
            $mappingStatus .= '<br/><a href="' . htmlspecialchars($linkUrl) . '">[ Update mapping ]</a>';
        } elseif (!$fileMtime) {
            $mappingStatus = $mappingStatus_index = '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/icon_fatalerror.gif', 'width="18" height="16"') . ' alt="" class="absmiddle" />';
            $mappingStatus .= 'Not mapped yet!';
            $this->setErrorLog($scope, 'fatal', $mappingStatus . ' (TO: "' . $toObj['title'] . '")');
            $mappingStatus .= ' - <em>(It might also mean that the TO was mapped with an older version of TemplaVoila - then just go and save the mapping again at this will be updated.)</em>';
            $mappingStatus .= '<br/><a href="' . htmlspecialchars($linkUrl) . '">[ Map ]</a>';
        } else {
            $mappingStatus = '';
            $mappingStatus .= '<a href="' . htmlspecialchars($linkUrl) . '">[ Remap ]</a>';
            $mappingStatus .= '<a href="' . htmlspecialchars($linkUrl . '&_preview=1') . '">[ Preview ]</a>';
        }
        // Format XML if requested
        if ($this->MOD_SETTINGS['set_details']) {
            if ($toObj['localprocessing']) {
                require_once PATH_t3lib . 'class.t3lib_syntaxhl.php';
                $hlObj = t3lib_div::makeInstance('t3lib_syntaxhl');
                $lpXML = '<pre>' . str_replace(chr(9), '&nbsp;&nbsp;&nbsp;', $hlObj->highLight_DS($toObj['localprocessing'])) . '</pre>';
            } else {
                $lpXML = '';
            }
        } else {
            $lpXML = $toObj['localprocessing'] ? t3lib_div::formatSize(strlen($toObj['localprocessing'])) . 'bytes' : '';
        }
        $lpXML .= '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[tx_templavoila_tmplobj][' . $toObj['uid'] . ']=edit&columnsOnly=localprocessing', $this->doc->backPath)) . '"><img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/edit2.gif', 'width="11" height="12"') . ' alt="" class="absmiddle" /></a>';
        // Compile info table:
        $tableAttribs = ' border="0" cellpadding="1" cellspacing="1" width="98%" style="margin-top: 3px;" class="lrPadding"';
        // Links:
        $editLink = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[tx_templavoila_tmplobj][' . $toObj['uid'] . ']=edit', $this->doc->backPath)) . '"><img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/edit2.gif', 'width="11" height="12"') . ' alt="" class="absmiddle" /></a>';
        $toTitle = '<a href="' . htmlspecialchars($linkUrl) . '">' . htmlspecialchars($toObj['title']) . '</a>';
        $fRWTOUres = array();
        if (!$children) {
            if ($this->MOD_SETTINGS['set_details']) {
                $fRWTOUres = $this->findRecordsWhereTOUsed($toObj, $scope);
            }
            $content .= '
			<table' . $tableAttribs . '>
				<tr class="bgColor4-20">
					<td colspan="3">' . $recordIcon . $toTitle . $editLink . '</td>
				</tr>
				<tr class="bgColor4">
					<td rowspan="' . ($this->MOD_SETTINGS['set_details'] ? 7 : 4) . '" style="width: 100px; text-align: center;">' . $icon . '</td>
					<td>File reference:</td>
					<td>' . $fileRef . $fileMsg . '</td>
				</tr>
				<tr class="bgColor4">
					<td>Description:</td>
					<td>' . htmlspecialchars($toObj['description']) . '</td>
				</tr>
				<tr class="bgColor4">
					<td>Mapping status:</td>
					<td>' . $mappingStatus . '</td>
				</tr>
				<tr class="bgColor4">
					<td>Local Processing:</td>
					<td>' . $lpXML . '</td>
				</tr>' . ($this->MOD_SETTINGS['set_details'] ? '
				<tr class="bgColor4">
					<td>Used by:</td>
					<td>' . $fRWTOUres['HTML'] . '</td>
				</tr>
				<tr class="bgColor4">
					<td>Created:</td>
					<td>' . t3lib_BEfunc::datetime($toObj['crdate']) . ' by user [' . $toObj['cruser_id'] . ']</td>
				</tr>
				<tr class="bgColor4">
					<td>Updated:</td>
					<td>' . t3lib_BEfunc::datetime($toObj['tstamp']) . '</td>
				</tr>' : '') . '
			</table>
			';
        } else {
            $content .= '
			<table' . $tableAttribs . '>
				<tr class="bgColor4-20">
					<td colspan="3">' . $recordIcon . $toTitle . $editLink . '</td>
				</tr>
				<tr class="bgColor4">
					<td>File reference:</td>
					<td>' . $fileRef . $fileMsg . '</td>
				</tr>
				<tr class="bgColor4">
					<td>Mapping status:</td>
					<td>' . $mappingStatus . '</td>
				</tr>
				<tr class="bgColor4">
					<td>Render Type:</td>
					<td>' . t3lib_BEfunc::getProcessedValue('tx_templavoila_tmplobj', 'rendertype', $toObj['rendertype']) . '</td>
				</tr>
				<tr class="bgColor4">
					<td>Language:</td>
					<td>' . t3lib_BEfunc::getProcessedValue('tx_templavoila_tmplobj', 'sys_language_uid', $toObj['sys_language_uid']) . '</td>
				</tr>
				<tr class="bgColor4">
					<td>Local Processing:</td>
					<td>' . $lpXML . '</td>
				</tr>' . ($this->MOD_SETTINGS['set_details'] ? '
				<tr class="bgColor4">
					<td>Created:</td>
					<td>' . t3lib_BEfunc::datetime($toObj['crdate']) . ' by user [' . $toObj['cruser_id'] . ']</td>
				</tr>
				<tr class="bgColor4">
					<td>Updated:</td>
					<td>' . t3lib_BEfunc::datetime($toObj['tstamp']) . '</td>
				</tr>' : '') . '
			</table>
			';
        }
        // Traverse template objects which are not children of anything:
        if (!$children && is_array($toRecords[$toObj['uid']])) {
            $TOchildrenContent = '';
            foreach ($toRecords[$toObj['uid']] as $toIndex => $childToObj) {
                $rTODres = $this->renderTODisplay($childToObj, $toRecords, $scope, 1);
                $TOchildrenContent .= $rTODres['HTML'];
                // Unset it so we can eventually see what is left:
                unset($toRecords[$toObj['uid']][$toIndex]);
            }
            $content .= '<div style="margin-left: 102px;">' . $TOchildrenContent . '</div>';
        }
        // Return content
        return array('HTML' => $content, 'mappingStatus' => $mappingStatus_index, 'usage' => $fRWTOUres['usage']);
    }