/** * Shows the log of indexed URLs * * @return string HTML output */ function drawLog() { global $BACK_PATH; $output = ''; // Init: $this->crawlerObj = t3lib_div::makeInstance('tx_crawler_lib'); $this->crawlerObj->setAccessMode('gui'); $this->crawlerObj->setID = t3lib_div::md5int(microtime()); $this->CSVExport = t3lib_div::_POST('_csv'); // Read URL: if (t3lib_div::_GP('qid_read')) { $this->crawlerObj->readUrl(intval(t3lib_div::_GP('qid_read')), TRUE); } // Look for set ID sent - if it is, we will display contents of that set: $showSetId = intval(t3lib_div::_GP('setID')); // Show details: if (t3lib_div::_GP('qid_details')) { // Get entry record: list($q_entry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tx_crawler_queue', 'qid=' . intval(t3lib_div::_GP('qid_details'))); // Explode values: $resStatus = $this->getResStatus($q_entry); $q_entry['parameters'] = unserialize($q_entry['parameters']); $q_entry['result_data'] = unserialize($q_entry['result_data']); if (is_array($q_entry['result_data'])) { $q_entry['result_data']['content'] = unserialize($q_entry['result_data']['content']); } if (!$this->pObj->MOD_SETTINGS['log_resultLog']) { unset($q_entry['result_data']['content']['log']); } // Print rudimentary details: $output .= ' <br /><br /> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.back') . '" name="_back" /> <input type="hidden" value="' . $this->pObj->id . '" name="id" /> <input type="hidden" value="' . $showSetId . '" name="setID" /> <br /> Current server time: ' . date('H:i:s', time()) . '<br />' . 'Status: ' . $resStatus . '<br />' . (version_compare(TYPO3_version, '4.5.0', '<') ? t3lib_div::view_array($q_entry) : t3lib_utility_Debug::viewArray($q_entry)); } else { // Show list: // If either id or set id, show list: if ($this->pObj->id || $showSetId) { if ($this->pObj->id) { // Drawing tree: $tree = t3lib_div::makeInstance('t3lib_pageTree'); $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); $tree->init('AND ' . $perms_clause); // Set root row: $HTML = t3lib_iconWorks::getSpriteIconForRecord('pages', $this->pObj->pageinfo); $HTML = t3lib_iconWorks::getSpriteIconForRecord('pages', $this->pObj->pageinfo); $tree->tree[] = array('row' => $this->pObj->pageinfo, 'HTML' => $HTML); // Get branch beneath: if ($this->pObj->MOD_SETTINGS['depth']) { $tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], ''); } // Traverse page tree: $code = ''; $count = 0; foreach ($tree->tree as $data) { $code .= $this->drawLog_addRows($data['row'], $data['HTML'] . t3lib_BEfunc::getRecordTitle('pages', $data['row'], TRUE), intval($this->pObj->MOD_SETTINGS['itemsPerPage'])); if (++$count == 1000) { break; } } } else { $code = ''; $code .= $this->drawLog_addRows($showSetId, 'Set ID: ' . $showSetId); } if ($code) { $output .= ' <br /><br /> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.reloadlist') . '" name="_reload" /> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.downloadcsv') . '" name="_csv" /> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.flushvisiblequeue') . '" name="_flush" onclick="return confirm(\'' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.confirmyouresure') . '\');" /> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.flushfullqueue') . '" name="_flush_all" onclick="return confirm(\'' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.confirmyouresure') . '\');" /> <input type="hidden" value="' . $this->pObj->id . '" name="id" /> <input type="hidden" value="' . $showSetId . '" name="setID" /> <br /> ' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime') . ': ' . date('H:i:s', time()) . ' <br /><br /> <table class="lrPadding c-list crawlerlog">' . $this->drawLog_printTableHeader() . $code . '</table>'; } } else { // Otherwise show available sets: $setList = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('set_id, count(*) as count_value, scheduled', 'tx_crawler_queue', '', 'set_id, scheduled', 'scheduled DESC'); $code = ' <tr class="bgColor5 tableheader"> <td>' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.setid') . ':</td> <td>' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count') . 't:</td> <td>' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time') . ':</td> </tr> '; $cc = 0; foreach ($setList as $set) { $code .= ' <tr class="bgColor' . ($cc % 2 ? '-20' : '-10') . '"> <td><a href="' . htmlspecialchars('index.php?setID=' . $set['set_id']) . '">' . $set['set_id'] . '</a></td> <td>' . $set['count_value'] . '</td> <td>' . t3lib_BEfunc::dateTimeAge($set['scheduled']) . '</td> </tr> '; $cc++; } $output .= ' <br /><br /> <table class="lrPadding c-list">' . $code . '</table>'; } } if ($this->CSVExport) { $this->outputCsvFile(); } // Return output return $output; }