Exemplo n.º 1
0
 /**
  * Gets the human readable representation of one
  * record history entry.
  *
  * @param array $entry Record history entry
  * @return array
  * @see getHistory
  */
 protected function getHistoryEntry(array $entry)
 {
     if (!empty($entry['action'])) {
         $differences = $entry['action'];
     } else {
         $differences = $this->getDifferences($entry);
     }
     return array('datetime' => htmlspecialchars(BackendUtility::datetime($entry['tstamp'])), 'user' => htmlspecialchars($this->getUserName($entry['user'])), 'differences' => $differences);
 }
Exemplo n.º 2
0
 /**
  * Gets the human readable representation of one
  * record history entry.
  *
  * @param array $entry Record history entry
  * @return array
  * @see getHistory
  */
 protected function getHistoryEntry(array $entry)
 {
     if (!empty($entry['action'])) {
         $differences = $entry['action'];
     } else {
         $differences = $this->getDifferences($entry);
     }
     /** @var Avatar $avatar */
     $avatar = GeneralUtility::makeInstance(Avatar::class);
     $beUserRecord = BackendUtility::getRecord('be_users', $entry['user']);
     return ['datetime' => htmlspecialchars(BackendUtility::datetime($entry['tstamp'])), 'user' => htmlspecialchars($this->getUserName($entry['user'])), 'user_avatar' => $avatar->render($beUserRecord), 'differences' => $differences];
 }
Exemplo n.º 3
0
 /**
  * Find syslog
  *
  * @return array
  */
 public function main()
 {
     // 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 = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_log', 'tstamp>' . ($GLOBALS['EXEC_TIME'] - 25 * 3600));
     foreach ($rows as $r) {
         $l = unserialize($r['log_data']);
         $explained = '#' . $r['uid'] . ' ' . \TYPO3\CMS\Backend\Utility\BackendUtility::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, \TYPO3\CMS\Core\Utility\GeneralUtility::arrayToLogString($r, 'uid,userid,action,recuid,tablename,recpid,error,tstamp,type,details_nr,IP,event_pid,NEWid,workspace'));
     }
     return $resultArray;
 }
 /**
  * Checks if sys_refindex is empty.
  *
  * @return \TYPO3\CMS\Reports\Status An object representing whether the reference index is empty or not
  */
 protected function getReferenceIndexStatus()
 {
     $value = $this->getLanguageService()->getLL('status_ok');
     $message = '';
     $severity = ReportStatus::OK;
     $count = $this->getDatabaseConnection()->exec_SELECTcountRows('*', 'sys_refindex');
     $registry = GeneralUtility::makeInstance(Registry::class);
     $lastRefIndexUpdate = $registry->get('core', 'sys_refindex_lastUpdate');
     if (!$count && $lastRefIndexUpdate) {
         $value = $this->getLanguageService()->getLL('status_empty');
         $severity = ReportStatus::WARNING;
         $url = BackendUtility::getModuleUrl('system_dbint') . '&id=0&SET[function]=refindex';
         $message = sprintf($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:warning.backend_reference_index'), '<a href="' . htmlspecialchars($url) . '">', '</a>', BackendUtility::datetime($lastRefIndexUpdate));
     }
     return GeneralUtility::makeInstance(ReportStatus::class, $this->getLanguageService()->getLL('status_referenceIndex'), $value, $message, $severity);
 }
 /**
  * Transforms the rows for the deleted Records into the Array View necessary for ExtJS Ext.data.ArrayReader
  *
  * @param array     $rows   Array with table as key and array with all deleted rows
  * @param integer	$totalDeleted: Number of deleted records in total, for PagingToolbar
  * @return string   JSON Array
  */
 public function transform($deletedRowsArray, $totalDeleted)
 {
     $total = 0;
     $jsonArray = array('rows' => array());
     // iterate
     if (is_array($deletedRowsArray) && count($deletedRowsArray) > 0) {
         foreach ($deletedRowsArray as $table => $rows) {
             $total += count($deletedRowsArray[$table]);
             foreach ($rows as $row) {
                 $backendUser = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('be_users', $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 'username', '', FALSE);
                 $jsonArray['rows'][] = array('uid' => $row['uid'], 'pid' => $row['pid'], 'table' => $table, 'crdate' => \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($row[$GLOBALS['TCA'][$table]['ctrl']['crdate']]), 'tstamp' => \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($row[$GLOBALS['TCA'][$table]['ctrl']['tstamp']]), 'owner' => htmlspecialchars($backendUser['username']), 'owner_uid' => $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 'tableTitle' => \TYPO3\CMS\Recycler\Utility\RecyclerUtility::getUtf8String($GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['ctrl']['title'])), 'title' => htmlspecialchars(\TYPO3\CMS\Recycler\Utility\RecyclerUtility::getUtf8String(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($table, $row))), 'path' => \TYPO3\CMS\Recycler\Utility\RecyclerUtility::getRecordPath($row['pid']));
             }
         }
     }
     $jsonArray['total'] = $totalDeleted;
     return json_encode($jsonArray);
 }
Exemplo n.º 6
0
 /**
  * Checks if sys_refindex is empty.
  *
  * @return \TYPO3\CMS\Reports\Status An object representing whether the reference index is empty or not
  */
 protected function getReferenceIndexStatus()
 {
     $value = $this->getLanguageService()->getLL('status_ok');
     $message = '';
     $severity = ReportStatus::OK;
     $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_refindex');
     $count = $queryBuilder->count('*')->from('sys_refindex')->execute()->fetchColumn(0);
     $registry = GeneralUtility::makeInstance(Registry::class);
     $lastRefIndexUpdate = $registry->get('core', 'sys_refindex_lastUpdate');
     if (!$count && $lastRefIndexUpdate) {
         $value = $this->getLanguageService()->getLL('status_empty');
         $severity = ReportStatus::WARNING;
         $url = BackendUtility::getModuleUrl('system_dbint') . '&id=0&SET[function]=refindex';
         $message = sprintf($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:warning.backend_reference_index'), '<a href="' . htmlspecialchars($url) . '">', '</a>', BackendUtility::datetime($lastRefIndexUpdate));
     }
     return GeneralUtility::makeInstance(ReportStatus::class, $this->getLanguageService()->getLL('status_referenceIndex'), $value, $message, $severity);
 }
 /**
  * Transforms the rows for the deleted records
  *
  * @param array $deletedRowsArray Array with table as key and array with all deleted rows
  * @param int $totalDeleted Number of deleted records in total
  * @return string JSON array
  */
 public function transform($deletedRowsArray, $totalDeleted)
 {
     $total = 0;
     $jsonArray = array('rows' => array());
     if (is_array($deletedRowsArray)) {
         $lang = $this->getLanguageService();
         $backendUser = $this->getBackendUser();
         foreach ($deletedRowsArray as $table => $rows) {
             $total += count($deletedRowsArray[$table]);
             foreach ($rows as $row) {
                 $pageTitle = $this->getPageTitle((int) $row['pid']);
                 $backendUser = BackendUtility::getRecord('be_users', $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 'username', '', FALSE);
                 $jsonArray['rows'][] = array('uid' => $row['uid'], 'pid' => $row['pid'], 'icon' => IconUtility::getSpriteIconForRecord($table, $row), 'pageTitle' => RecyclerUtility::getUtf8String($pageTitle), 'table' => $table, 'crdate' => BackendUtility::datetime($row[$GLOBALS['TCA'][$table]['ctrl']['crdate']]), 'tstamp' => BackendUtility::datetime($row[$GLOBALS['TCA'][$table]['ctrl']['tstamp']]), 'owner' => htmlspecialchars($backendUser['username']), 'owner_uid' => $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 'tableTitle' => RecyclerUtility::getUtf8String($lang->sL($GLOBALS['TCA'][$table]['ctrl']['title'])), 'title' => htmlspecialchars(RecyclerUtility::getUtf8String(BackendUtility::getRecordTitle($table, $row))), 'path' => RecyclerUtility::getRecordPath($row['pid']));
             }
         }
     }
     $jsonArray['total'] = $totalDeleted;
     return $jsonArray;
 }
 /**
  * Transforms the rows for the deleted records
  *
  * @param array $deletedRowsArray Array with table as key and array with all deleted rows
  * @param int $totalDeleted Number of deleted records in total
  * @return string JSON array
  */
 public function transform($deletedRowsArray, $totalDeleted)
 {
     $total = 0;
     $jsonArray = array('rows' => array());
     if (is_array($deletedRowsArray)) {
         $lang = $this->getLanguageService();
         $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
         foreach ($deletedRowsArray as $table => $rows) {
             $total += count($deletedRowsArray[$table]);
             foreach ($rows as $row) {
                 $pageTitle = $this->getPageTitle((int) $row['pid']);
                 $backendUser = BackendUtility::getRecord('be_users', $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 'username', '', false);
                 $jsonArray['rows'][] = array('uid' => $row['uid'], 'pid' => $row['pid'], 'icon' => $iconFactory->getIconForRecord($table, $row, Icon::SIZE_SMALL)->render(), 'pageTitle' => $pageTitle, 'table' => $table, 'crdate' => BackendUtility::datetime($row[$GLOBALS['TCA'][$table]['ctrl']['crdate']]), 'tstamp' => BackendUtility::datetime($row[$GLOBALS['TCA'][$table]['ctrl']['tstamp']]), 'owner' => htmlspecialchars($backendUser['username']), 'owner_uid' => $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 'tableTitle' => $lang->sL($GLOBALS['TCA'][$table]['ctrl']['title']), 'title' => htmlspecialchars(BackendUtility::getRecordTitle($table, $row)), 'path' => RecyclerUtility::getRecordPath($row['pid']));
             }
         }
     }
     $jsonArray['total'] = $totalDeleted;
     return $jsonArray;
 }
Exemplo n.º 9
0
 /**
  * Show the compact information of a direct mail record
  *
  * @param array $row Direct mail record
  *
  * @return string The compact infos of the direct mail record
  */
 function directMail_compactView($row)
 {
     // Render record:
     if ($row['type']) {
         $dmailData = $row['plainParams'] . ', ' . $row['HTMLParams'];
     } else {
         $page = BackendUtility::getRecord('pages', $row['page'], 'title');
         $dmailData = $row['page'] . ', ' . htmlspecialchars($page['title']);
         $dmailInfo = DirectMailUtility::fName('plainParams') . ' ' . htmlspecialchars($row['plainParams'] . LF . DirectMailUtility::fName('HTMLParams') . $row['HTMLParams']) . '; ' . LF;
     }
     $dmailInfo .= $this->getLanguageService()->getLL('view_media') . ' ' . BackendUtility::getProcessedValue('sys_dmail', 'includeMedia', $row['includeMedia']) . '; ' . LF . $this->getLanguageService()->getLL('view_flowed') . ' ' . BackendUtility::getProcessedValue('sys_dmail', 'flowedFormat', $row['flowedFormat']);
     $dmailInfo = '<span title="' . $dmailInfo . '">' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL) . '</span>';
     $fromInfo = $this->getLanguageService()->getLL('view_replyto') . ' ' . htmlspecialchars($row['replyto_name'] . ' <' . $row['replyto_email'] . '>') . '; ' . LF . DirectMailUtility::fName('organisation') . ' ' . htmlspecialchars($row['organisation']) . '; ' . LF . DirectMailUtility::fName('return_path') . ' ' . htmlspecialchars($row['return_path']);
     $fromInfo = '<span title="' . $fromInfo . '">' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL) . '</span>';
     $mailInfo = DirectMailUtility::fName('priority') . ' ' . BackendUtility::getProcessedValue('sys_dmail', 'priority', $row['priority']) . '; ' . LF . DirectMailUtility::fName('encoding') . ' ' . BackendUtility::getProcessedValue('sys_dmail', 'encoding', $row['encoding']) . '; ' . LF . DirectMailUtility::fName('charset') . ' ' . BackendUtility::getProcessedValue('sys_dmail', 'charset', $row['charset']);
     $mailInfo = '<span title="' . $mailInfo . '">' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL) . '</span>';
     $delBegin = $row["scheduled_begin"] ? BackendUtility::datetime($row["scheduled_begin"]) : '-';
     $delEnd = $row["scheduled_end"] ? BackendUtility::datetime($row["scheduled_begin"]) : '-';
     // count total recipient from the query_info
     $totalRecip = 0;
     $idLists = unserialize($row['query_info']);
     foreach ($idLists['id_lists'] as $idArray) {
         $totalRecip += count($idArray);
     }
     $sentRecip = $GLOBALS['TYPO3_DB']->sql_num_rows($GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_dmail_maillog', 'mid=' . $row['uid'] . ' AND response_type = 0', '', 'rid ASC'));
     $out = '<table class="table table-striped table-hover">';
     $out .= '<tr class="t3-row-header"><td colspan="3">' . $this->iconFactory->getIconForRecord('sys_dmail', $row)->render() . htmlspecialchars($row['subject']) . '</td></tr>';
     $out .= '<tr class="db_list_normal"><td>' . $this->getLanguageService()->getLL('view_from') . '</td>' . '<td>' . htmlspecialchars($row['from_name'] . ' <' . htmlspecialchars($row['from_email']) . '>') . '</td>' . '<td>' . $fromInfo . '</td></tr>';
     $out .= '<tr class="db_list_normal"><td>' . $this->getLanguageService()->getLL('view_dmail') . '</td>' . '<td>' . BackendUtility::getProcessedValue('sys_dmail', 'type', $row['type']) . ': ' . $dmailData . '</td>' . '<td>' . $dmailInfo . '</td></tr>';
     $out .= '<tr class="db_list_normal"><td>' . $this->getLanguageService()->getLL('view_mail') . '</td>' . '<td>' . BackendUtility::getProcessedValue('sys_dmail', 'sendOptions', $row['sendOptions']) . ($row['attachment'] ? '; ' : '') . BackendUtility::getProcessedValue('sys_dmail', 'attachment', $row['attachment']) . '</td>' . '<td>' . $mailInfo . '</td></tr>';
     $out .= '<tr class="db_list_normal"><td>' . $this->getLanguageService()->getLL('view_delivery_begin_end') . '</td>' . '<td>' . $delBegin . ' / ' . $delEnd . '</td>' . '<td>&nbsp;</td></tr>';
     $out .= '<tr class="db_list_normal"><td>' . $this->getLanguageService()->getLL('view_recipient_total_sent') . '</td>' . '<td>' . $totalRecip . ' / ' . $sentRecip . '</td>' . '<td>&nbsp;</td></tr>';
     $out .= '</table>';
     $out .= '<div style="padding-top: 5px;"></div>';
     return $out;
 }
Exemplo n.º 10
0
 /**
  * Shows the full change log
  *
  * @return string HTML for list, wrapped in a table.
  */
 public function displayHistory()
 {
     if (empty($this->changeLog)) {
         return '';
     }
     $languageService = $this->getLanguageService();
     $lines = array();
     $beUserArray = BackendUtility::getUserNames();
     $i = 0;
     // Traverse changeLog array:
     foreach ($this->changeLog as $sysLogUid => $entry) {
         // stop after maxSteps
         if ($this->maxSteps && $i > $this->maxSteps) {
             break;
         }
         // Show only marked states
         if (!$entry['snapshot'] && $this->showMarked) {
             continue;
         }
         $i++;
         // Build up single line
         $singleLine = array();
         // Get user names
         $userName = $entry['user'] ? $beUserArray[$entry['user']]['username'] : $languageService->getLL('externalChange');
         // Executed by switch-user
         if (!empty($entry['originalUser'])) {
             $userName .= ' (' . $languageService->getLL('viaUser') . ' ' . $beUserArray[$entry['originalUser']]['username'] . ')';
         }
         $singleLine['backendUserName'] = htmlspecialchars($userName);
         $singleLine['backendUserUid'] = $entry['user'];
         // add user name
         // Diff link
         $image = $this->iconFactory->getIcon('actions-document-history-open', Icon::SIZE_SMALL)->render();
         $singleLine['rollbackLink'] = $this->linkPage($image, array('diff' => $sysLogUid));
         // remove first link
         $singleLine['time'] = htmlspecialchars(BackendUtility::datetime($entry['tstamp']));
         // add time
         $singleLine['age'] = htmlspecialchars(BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $entry['tstamp'], $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')));
         // add age
         $singleLine['tableUid'] = $this->linkPage($this->generateTitle($entry['tablename'], $entry['recuid']), array('element' => $entry['tablename'] . ':' . $entry['recuid']), '', $languageService->getLL('linkRecordHistory', true));
         // add record UID
         // Show insert/delete/diff/changed field names
         if ($entry['action']) {
             // insert or delete of element
             $singleLine['action'] = htmlspecialchars($languageService->getLL($entry['action'], true));
         } else {
             // Display field names instead of full diff
             if (!$this->showDiff) {
                 // Re-write field names with labels
                 $tmpFieldList = explode(',', $entry['fieldlist']);
                 foreach ($tmpFieldList as $key => $value) {
                     $tmp = str_replace(':', '', $languageService->sL(BackendUtility::getItemLabel($entry['tablename'], $value), true));
                     if ($tmp) {
                         $tmpFieldList[$key] = $tmp;
                     } else {
                         // remove fields if no label available
                         unset($tmpFieldList[$key]);
                     }
                 }
                 $singleLine['fieldNames'] = htmlspecialchars(implode(',', $tmpFieldList));
             } else {
                 // Display diff
                 $diff = $this->renderDiff($entry, $entry['tablename']);
                 $singleLine['differences'] = $diff;
             }
         }
         // Show link to mark/unmark state
         if (!$entry['action']) {
             if ($entry['snapshot']) {
                 $title = $languageService->getLL('unmarkState', true);
                 $image = $this->iconFactory->getIcon('actions-unmarkstate', Icon::SIZE_SMALL)->render();
             } else {
                 $title = $languageService->getLL('markState', true);
                 $image = $this->iconFactory->getIcon('actions-markstate', Icon::SIZE_SMALL)->render();
             }
             $singleLine['markState'] = $this->linkPage($image, array('highlight' => $entry['uid']), '', $title);
         } else {
             $singleLine['markState'] = '';
         }
         // put line together
         $lines[] = $singleLine;
     }
     $this->view->assign('history', $lines);
     if ($this->lastSyslogId) {
         $this->view->assign('fullViewLink', $this->linkPage($languageService->getLL('fullView', true), array('diff' => '')));
     }
 }
    /**
     * Main function creating the content for the module.
     *
     * @return string HTML content for the module, actually a "section" made through the parent object in $this->pObj
     */
    public function main()
    {
        $lang = $this->getLanguageService();
        $lang->includeLLFile('EXT:wizard_sortpages/Resources/Private/Language/locallang.xlf');
        $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
        $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Modal');
        $out = '<h1>' . htmlspecialchars($lang->getLL('wiz_sort')) . '</h1>';
        if ($this->getBackendUser()->workspace === 0) {
            $theCode = '';
            // Check if user has modify permissions to
            $sys_pages = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Page\PageRepository::class);
            $sortByField = GeneralUtility::_GP('sortByField');
            if ($sortByField) {
                $menuItems = array();
                if ($sortByField === 'title' || $sortByField === 'subtitle' || $sortByField === 'crdate' || $sortByField === 'tstamp') {
                    $menuItems = $sys_pages->getMenu($this->pObj->id, 'uid,pid,title', $sortByField, '', false);
                } elseif ($sortByField === 'REV') {
                    $menuItems = $sys_pages->getMenu($this->pObj->id, 'uid,pid,title', 'sorting', '', false);
                    $menuItems = array_reverse($menuItems);
                }
                if (!empty($menuItems)) {
                    $tce = GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
                    $menuItems = array_reverse($menuItems);
                    $cmd = array();
                    foreach ($menuItems as $r) {
                        $cmd['pages'][$r['uid']]['move'] = $this->pObj->id;
                    }
                    $tce->start(array(), $cmd);
                    $tce->process_cmdmap();
                    BackendUtility::setUpdateSignal('updatePageTree');
                }
            }
            $menuItems = $sys_pages->getMenu($this->pObj->id, '*', 'sorting', '', false);
            if (!empty($menuItems)) {
                $lines = array();
                $lines[] = '<thead><tr>';
                $lines[] = '<th>' . $lang->getLL('wiz_changeOrder_title') . '</th>';
                $lines[] = '<th>' . $lang->getLL('wiz_changeOrder_subtitle') . '</th>';
                $lines[] = '<th>' . $lang->getLL('wiz_changeOrder_tChange') . '</th>';
                $lines[] = '<th>' . $lang->getLL('wiz_changeOrder_tCreate') . '</th>';
                $lines[] = '</tr></thead>';
                $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
                foreach ($menuItems as $rec) {
                    $m_perms_clause = $this->getBackendUser()->getPagePermsClause(2);
                    // edit permissions for that page!
                    $pRec = BackendUtility::getRecord('pages', $rec['uid'], 'uid', ' AND ' . $m_perms_clause);
                    $lines[] = '<tr><td nowrap="nowrap">' . $iconFactory->getIconForRecord('pages', $rec, Icon::SIZE_SMALL)->render() . (!is_array($pRec) ? '<strong class="text-danger">' . $lang->getLL('wiz_W', true) . '</strong></span> ' : '') . htmlspecialchars(GeneralUtility::fixed_lgd_cs($rec['title'], $GLOBALS['BE_USER']->uc['titleLen'])) . '</td>
					<td nowrap="nowrap">' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($rec['subtitle'], $this->getBackendUser()->uc['titleLen'])) . '</td>
					<td nowrap="nowrap">' . BackendUtility::datetime($rec['tstamp']) . '</td>
					<td nowrap="nowrap">' . BackendUtility::datetime($rec['crdate']) . '</td>
					</tr>';
                }
                $theCode .= '<h2>' . $lang->getLL('wiz_currentPageOrder', true) . '</h2>';
                $theCode .= '<div class="table-fit"><table class="table table-striped table-hover">' . implode('', $lines) . '</table></div>';
                // Menu:
                $lines = array();
                $lines[] = $this->wiz_linkOrder($lang->getLL('wiz_changeOrder_title'), 'title');
                $lines[] = $this->wiz_linkOrder($lang->getLL('wiz_changeOrder_subtitle'), 'subtitle');
                $lines[] = $this->wiz_linkOrder($lang->getLL('wiz_changeOrder_tChange'), 'tstamp');
                $lines[] = $this->wiz_linkOrder($lang->getLL('wiz_changeOrder_tCreate'), 'crdate');
                $lines[] = '';
                $lines[] = $this->wiz_linkOrder($lang->getLL('wiz_changeOrder_REVERSE'), 'REV');
                $theCode .= '<h4>' . $lang->getLL('wiz_changeOrder') . '</h4><p>' . implode(' ', $lines) . '</p>';
            } else {
                $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, $lang->getLL('no_subpages'), '', FlashMessage::NOTICE);
                /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */
                $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
                /** @var $defaultFlashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */
                $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
                $defaultFlashMessageQueue->enqueue($flashMessage);
            }
            // CSH:
            $theCode .= BackendUtility::cshItem('_MOD_web_func', 'tx_wizardsortpages', null, '<span class="btn btn-default btn-sm">|</span>');
            $out .= '<div>' . $theCode . '</div>';
        } else {
            $out .= '<div>Sorry, this function is not available in the current draft workspace!</div>';
        }
        return $out;
    }
 /**
  * @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')
 {
     return BackendUtility::datetime($seconds, $labels);
 }
Exemplo n.º 13
0
    /**
     * Shows the status of the mailer engine.
     * TODO: Should really only show some entries, or provide a browsing interface.
     *
     * @return	string		List of the mailing status
     */
    function cmd_mailerengine()
    {
        $invokeMessage = "";
        // enable manual invocation of mailer engine; enabled by default
        $enableTrigger = !(isset($this->params['menu.']['dmail_mode.']['mailengine.']['disable_trigger']) && $this->params['menu.']['dmail_mode.']['mailengine.']['disable_trigger']);
        if ($enableTrigger && GeneralUtility::_GP('invokeMailerEngine')) {
            /* @var $flashMessage FlashMessage */
            $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', '<strong>' . $this->getLanguageService()->getLL('dmail_mailerengine_log') . '</strong><br />' . nl2br($this->invokeMEngine()), $this->getLanguageService()->getLL('dmail_mailerengine_invoked'), FlashMessage::INFO);
            $invokeMessage = $flashMessage->render();
        }
        // Invoke engine
        if ($enableTrigger) {
            $out = '<p>' . $this->getLanguageService()->getLL('dmail_mailerengine_manual_explain') . '<br /><br /><a class="t3-link" href="' . BackendUtility::getModuleUrl('txdirectmailM1_txdirectmailM5') . '&id=' . $this->id . '&invokeMailerEngine=1"><strong>' . $this->getLanguageService()->getLL('dmail_mailerengine_invoke_now') . '</strong></a></p>';
            $invokeMessage .= '<div style="padding-top: 20px;"></div>';
            $invokeMessage .= $this->doc->section(BackendUtility::cshItem($this->cshTable, 'mailerengine_invoke', $GLOBALS["BACK_PATH"]) . $this->getLanguageService()->getLL('dmail_mailerengine_manual_invoke'), $out, 1, 1, 0, TRUE);
            $invokeMessage .= '<div style="padding-top: 20px;"></div>';
        }
        // Display mailer engine status
        $res = $GLOBALS["TYPO3_DB"]->exec_SELECTquery('uid,pid,subject,scheduled,scheduled_begin,scheduled_end', 'sys_dmail', 'pid=' . intval($this->id) . ' AND scheduled>0' . BackendUtility::deleteClause('sys_dmail'), '', 'scheduled DESC');
        $out = '<tr class="t3-row-header">
				<td>&nbsp;</td>
				<td><b>' . $this->getLanguageService()->getLL('dmail_mailerengine_subject') . '&nbsp;&nbsp;</b></td>
				<td><b>' . $this->getLanguageService()->getLL('dmail_mailerengine_scheduled') . '&nbsp;&nbsp;</b></td>
				<td><b>' . $this->getLanguageService()->getLL('dmail_mailerengine_delivery_begun') . '&nbsp;&nbsp;</b></td>
				<td><b>' . $this->getLanguageService()->getLL('dmail_mailerengine_delivery_ended') . '&nbsp;&nbsp;</b></td>
				<td style="text-align: center;"><b>&nbsp;' . $this->getLanguageService()->getLL('dmail_mailerengine_number_sent') . '&nbsp;</b></td>
				<td style="text-align: center;"><b>&nbsp;' . $this->getLanguageService()->getLL('dmail_mailerengine_delete') . '&nbsp;</b></td>
			</tr>';
        while ($row = $GLOBALS["TYPO3_DB"]->sql_fetch_assoc($res)) {
            $countres = $GLOBALS["TYPO3_DB"]->exec_SELECTquery('count(*)', 'sys_dmail_maillog', 'mid=' . intval($row['uid']) . ' AND response_type=0' . ' AND html_sent>0');
            list($count) = $GLOBALS["TYPO3_DB"]->sql_fetch_row($countres);
            $out .= '<tr class="db_list_normal">
						<td>' . $this->iconFactory->getIconForRecord('sys_dmail', $row, Icon::SIZE_SMALL)->render() . '</td>
						<td>' . $this->linkDMail_record(htmlspecialchars(GeneralUtility::fixed_lgd_cs($row['subject'], 100)) . '&nbsp;&nbsp;', $row['uid']) . '</td>
						<td>' . BackendUtility::datetime($row['scheduled']) . '&nbsp;&nbsp;</td>
						<td>' . ($row['scheduled_begin'] ? BackendUtility::datetime($row['scheduled_begin']) : '') . '&nbsp;&nbsp;</td>
						<td>' . ($row['scheduled_end'] ? BackendUtility::datetime($row['scheduled_end']) : '') . '&nbsp;&nbsp;</td>
						<td style="text-align: center;">' . ($count ? $count : '&nbsp;') . '</td>
						<td style="text-align: center;">' . $this->deleteLink($row['uid']) . '</td>
					</tr>';
        }
        $out = $invokeMessage . '<table class="table table-striped table-hover">' . $out . '</table>';
        return $this->doc->section(BackendUtility::cshItem($this->cshTable, 'mailerengine_status', $GLOBALS["BACK_PATH"]) . $this->getLanguageService()->getLL('dmail_mailerengine_status'), $out, 1, 1, 0, TRUE);
    }
Exemplo n.º 14
0
    /**
     * Creates an info-box for the current page (identified by input record).
     *
     * @param array $rec Page record
     * @param boolean $edit If set, there will be shown an edit icon, linking to editing of the page properties.
     * @return string HTML for the box.
     * @deprecated and unused since 6.0, will be removed two versions later
     * @todo Define visibility
     */
    public function getPageInfoBox($rec, $edit = 0)
    {
        \TYPO3\CMS\Core\Utility\GeneralUtility::logDeprecatedFunction();
        // If editing of the page properties is allowed:
        if ($edit) {
            $params = '&edit[pages][' . $rec['uid'] . ']=edit';
            $editIcon = '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick($params, $this->backPath)) . '" title="' . $GLOBALS['LANG']->getLL('edit', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open') . '</a>';
        } else {
            $editIcon = $this->noEditIcon('noEditPage');
        }
        // Setting page icon, link, title:
        $outPutContent = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $rec, array('title' => \TYPO3\CMS\Backend\Utility\BackendUtility::titleAttribForPages($rec))) . $editIcon . '&nbsp;' . htmlspecialchars($rec['title']);
        // Init array where infomation is accumulated as label/value pairs.
        $lines = array();
        // Owner user/group:
        if ($this->pI_showUser) {
            // User:
            $users = \TYPO3\CMS\Backend\Utility\BackendUtility::getUserNames('username,usergroup,usergroup_cached_list,uid,realName');
            $groupArray = explode(',', $GLOBALS['BE_USER']->user['usergroup_cached_list']);
            $users = \TYPO3\CMS\Backend\Utility\BackendUtility::blindUserNames($users, $groupArray);
            $lines[] = array($GLOBALS['LANG']->getLL('pI_crUser') . ':', htmlspecialchars($users[$rec['cruser_id']]['username']) . ' (' . $users[$rec['cruser_id']]['realName'] . ')');
        }
        // Created:
        $lines[] = array($GLOBALS['LANG']->getLL('pI_crDate') . ':', \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($rec['crdate']) . ' (' . \TYPO3\CMS\Backend\Utility\BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $rec['crdate'], $this->agePrefixes) . ')');
        // Last change:
        $lines[] = array($GLOBALS['LANG']->getLL('pI_lastChange') . ':', \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($rec['tstamp']) . ' (' . \TYPO3\CMS\Backend\Utility\BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $rec['tstamp'], $this->agePrefixes) . ')');
        // Last change of content:
        if ($rec['SYS_LASTCHANGED']) {
            $lines[] = array($GLOBALS['LANG']->getLL('pI_lastChangeContent') . ':', \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($rec['SYS_LASTCHANGED']) . ' (' . \TYPO3\CMS\Backend\Utility\BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $rec['SYS_LASTCHANGED'], $this->agePrefixes) . ')');
        }
        // Spacer:
        $lines[] = '';
        // Display contents of certain page fields, if any value:
        $dfields = explode(',', 'alias,target,hidden,starttime,endtime,fe_group,no_cache,cache_timeout,newUntil,lastUpdated,subtitle,keywords,description,abstract,author,author_email');
        foreach ($dfields as $fV) {
            if ($rec[$fV]) {
                $lines[] = array($GLOBALS['LANG']->sL(\TYPO3\CMS\Backend\Utility\BackendUtility::getItemLabel('pages', $fV)), \TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValue('pages', $fV, $rec[$fV]));
            }
        }
        // Finally, wrap the elements in the $lines array in table cells/rows
        foreach ($lines as $fV) {
            if (is_array($fV)) {
                if (!$fV[2]) {
                    $fV[1] = htmlspecialchars($fV[1]);
                }
                $out .= '
				<tr>
					<td class="bgColor4" nowrap="nowrap"><strong>' . htmlspecialchars($fV[0]) . '&nbsp;&nbsp;</strong></td>
					<td class="bgColor4">' . $fV[1] . '</td>
				</tr>';
            } else {
                $out .= '
				<tr>
					<td colspan="2"><img src="clear.gif" width="1" height="3" alt="" /></td>
				</tr>';
            }
        }
        // Wrap table tags around...
        $outPutContent .= '



			<!--
				Page info box:
			-->
			<table border="0" cellpadding="0" cellspacing="1" id="typo3-page-info">
				' . $out . '
			</table>';
        // ... and return it.
        return $outPutContent;
    }
Exemplo n.º 15
0
 /**
  * [Describe function...]
  *
  * @return 	[type]		...
  * @todo Define visibility
  */
 public 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(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($row['item_title'], 30)), \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize($row['item_size']), $this->getNumberOfWords($row['phash']), BackendUtility::datetime($row['item_mtime']), BackendUtility::datetime($row['crdate']), $row['tstamp'] != $row['crdate'] ? BackendUtility::datetime($row['tstamp']) : '', $row['parsetime'], $this->getNumberOfSections($row['phash']) . '/' . $grListRec[0]['pcount'] . '/' . $this->getNumberOfFulltext($row['phash']), $row['pcount'], $cHash, $row['phash'], htmlentities(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($row['data_filename'], 100)));
         if ($row['pcount'] > 1) {
             $res2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery('index_phash.*', 'index_phash', 'phash_grouping=' . (int) $row['phash_grouping'] . ' AND phash<>' . (int) $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']), '', BackendUtility::datetime($row2['crdate']), $row2['tstamp'] != $row2['crdate'] ? BackendUtility::datetime($row2['tstamp']) : '', $row2['parsetime'], $this->getNumberOfSections($row2['phash']) . '/' . $grListRec[0]['pcount'] . '/' . $this->getNumberOfFulltext($row2['phash']), '', $cHash, $row2['phash'], '');
             }
         }
     }
     return $recList;
 }
Exemplo n.º 16
0
 /**
  * Gets an array with all sys_log entries and their comments for the given record uid and table
  *
  * @param int $uid uid of changed element to search for in log
  * @param string $table Name of the record's table
  * @return array
  */
 public function getCommentsForRecord($uid, $table)
 {
     $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=' . (int) $uid, '', 'tstamp DESC');
     foreach ($sysLogRows as $sysLogRow) {
         $sysLogEntry = array();
         $data = unserialize($sysLogRow['log_data']);
         $beUserRecord = BackendUtility::getRecord('be_users', $sysLogRow['userid']);
         $sysLogEntry['stage_title'] = htmlspecialchars($this->getStagesService()->getStageTitle($data['stage']));
         $sysLogEntry['user_uid'] = (int) $sysLogRow['userid'];
         $sysLogEntry['user_username'] = is_array($beUserRecord) ? htmlspecialchars($beUserRecord['username']) : '';
         $sysLogEntry['tstamp'] = htmlspecialchars(BackendUtility::datetime($sysLogRow['tstamp']));
         $sysLogEntry['user_comment'] = nl2br(htmlspecialchars($data['comment']));
         $sysLogReturnArray[] = $sysLogEntry;
     }
     return $sysLogReturnArray;
 }
Exemplo n.º 17
0
    /**
     * View error log
     *
     * @return	string		HTML
     */
    public function logView()
    {
        $cmd = \TYPO3\CMS\Core\Utility\GeneralUtility::_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>' . \TYPO3\CMS\Backend\Utility\BackendUtility::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') . '">' . $this->getIcon('gfx/napshot.gif', 'width="12" height="12"', $this->pObj->doc->backPath, 'Set as redirect') . '</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>' . \TYPO3\CMS\Backend\Utility\BackendUtility::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') . '">' . $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $this->pObj->doc->backPath, 'Delete All') . ' Flush log</a>
				<br/>
			<table border="0" cellspacing="1" cellpadding="0" id="tx-realurl-pathcacheTable" class="lrPadding c-list">' . $output . '
			</table>';
            return $output;
        }
    }
    /**
     * Render property array as html table
     *
     * @return string
     */
    protected function renderPropertiesAsTable()
    {
        $tableRows = array();
        $extraFields = array();
        if (in_array($this->type, array('folder', 'file'), TRUE)) {
            if ($this->type === 'file') {
                $extraFields['creation_date'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xlf:LGL.creationDate', TRUE);
                $extraFields['modification_date'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xlf:LGL.timestamp', TRUE);
            }
            $extraFields['storage'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tca.xlf:sys_file.storage', TRUE);
            $extraFields['folder'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:folder', TRUE);
        } else {
            $extraFields['crdate'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xlf:LGL.creationDate', TRUE);
            $extraFields['cruser_id'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xlf:LGL.creationUserId', TRUE);
            $extraFields['tstamp'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xlf:LGL.timestamp', TRUE);
            // check if the special fields are defined in the TCA ctrl section of the table
            foreach ($extraFields as $fieldName => $fieldLabel) {
                if (isset($GLOBALS['TCA'][$this->table]['ctrl'][$fieldName])) {
                    $extraFields[$GLOBALS['TCA'][$this->table]['ctrl'][$fieldName]] = $fieldLabel;
                } else {
                    unset($extraFields[$fieldName]);
                }
            }
        }
        foreach ($extraFields as $name => $fieldLabel) {
            $rowValue = '';
            if (!isset($this->row[$name])) {
                $resourceObject = $this->fileObject ?: $this->folderObject;
                if ($name === 'storage') {
                    $rowValue = $resourceObject->getStorage()->getName();
                } elseif ($name === 'folder') {
                    $rowValue = $resourceObject->getParentFolder()->getReadablePath();
                }
            } elseif (in_array($name, array('creation_date', 'modification_date'), TRUE)) {
                $rowValue = BackendUtility::datetime($this->row[$name]);
            } else {
                $rowValue = BackendUtility::getProcessedValueExtra($this->table, $name, $this->row[$name]);
            }
            // show the backend username who created the issue
            if ($name === 'cruser_id' && $rowValue) {
                $userTemp = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('username, realName', 'be_users', 'uid = ' . (int) $rowValue);
                if ($userTemp['username'] !== '') {
                    $rowValue = $userTemp['username'];
                    if ($userTemp['realName'] !== '') {
                        $rowValue .= ' - ' . $userTemp['realName'];
                    }
                }
            }
            $tableRows[] = '
				<tr>
					<th>' . rtrim($fieldLabel, ':') . '</th>
					<td>' . htmlspecialchars($rowValue) . '</td>
				</tr>';
        }
        // Traverse the list of fields to display for the record:
        $fieldList = GeneralUtility::trimExplode(',', $GLOBALS['TCA'][$this->table]['interface']['showRecordFieldList'], TRUE);
        foreach ($fieldList as $name) {
            $name = trim($name);
            $uid = $this->row['uid'];
            if (!isset($GLOBALS['TCA'][$this->table]['columns'][$name])) {
                continue;
            }
            // Storage is already handled above
            if ($this->type === 'file' && $name === 'storage') {
                continue;
            }
            $isExcluded = !(!$GLOBALS['TCA'][$this->table]['columns'][$name]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $this->table . ':' . $name));
            if ($isExcluded) {
                continue;
            }
            $itemValue = BackendUtility::getProcessedValue($this->table, $name, $this->row[$name], 0, 0, FALSE, $uid);
            $itemLabel = $GLOBALS['LANG']->sL(BackendUtility::getItemLabel($this->table, $name), TRUE);
            $tableRows[] = '
				<tr>
					<td><strong>' . $itemLabel . '</strong></td>
					<td>' . htmlspecialchars($itemValue) . '</td>
				</tr>';
        }
        return '<table class="t3-table">' . implode('', $tableRows) . '</table>';
    }
Exemplo n.º 19
0
 /**
  * Sending the mail.
  * if it's a test mail, then will be sent directly.
  * if mass-send mail, only update the DB record. the dmailer script will send it.
  *
  * @param array $row Directmal DB record
  *
  * @return string Messages if the mail is sent or planned to sent
  * @todo	remove htmlmail. sending test mail
  */
 public function cmd_send_mail($row)
 {
     // Preparing mailer
     /* @var $htmlmail Dmailer */
     $htmlmail = GeneralUtility::makeInstance('DirectMailTeam\\DirectMail\\Dmailer');
     $htmlmail->nonCron = 1;
     $htmlmail->start();
     $htmlmail->dmailer_prepare($row);
     // send out non-personalized emails
     $simpleMailMode = GeneralUtility::_GP('mailingMode_simple');
     $sentFlag = false;
     if ($simpleMailMode) {
         // step 4, sending simple test emails
         // setting Testmail flag
         $htmlmail->testmail = $this->params['testmail'];
         // Fixing addresses:
         $addresses = GeneralUtility::_GP('SET');
         $addressList = $addresses['dmail_test_email'] ? $addresses['dmail_test_email'] : $this->MOD_SETTINGS['dmail_test_email'];
         $addresses = preg_split('|[' . LF . ',;]|', $addressList);
         foreach ($addresses as $key => $val) {
             $addresses[$key] = trim($val);
             if (!GeneralUtility::validEmail($addresses[$key])) {
                 unset($addresses[$key]);
             }
         }
         $hash = array_flip($addresses);
         $addresses = array_keys($hash);
         $addressList = implode(',', $addresses);
         if ($addressList) {
             // Sending the same mail to lots of recipients
             $htmlmail->dmailer_sendSimple($addressList);
             $sentFlag = true;
             /* @var $flashMessage FlashMessage */
             $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $this->getLanguageService()->getLL('send_was_sent') . '<br /><br />' . $this->getLanguageService()->getLL('send_recipients') . '<br />' . htmlspecialchars($addressList), $this->getLanguageService()->getLL('send_sending'), FlashMessage::OK);
             $this->noView = 1;
         }
     } elseif ($this->CMD == 'send_mail_test') {
         // step 4, sending test personalized test emails
         // setting Testmail flag
         $htmlmail->testmail = $this->params['testmail'];
         if (GeneralUtility::_GP('tt_address_uid')) {
             // personalized to tt_address
             $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tt_address.*', 'tt_address LEFT JOIN pages ON pages.uid=tt_address.pid', 'tt_address.uid=' . intval(GeneralUtility::_GP('tt_address_uid')) . ' AND ' . $this->perms_clause . BackendUtility::deleteClause('pages') . BackendUtility::BEenableFields('tt_address') . BackendUtility::deleteClause('tt_address'));
             if ($recipRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                 $recipRow = Dmailer::convertFields($recipRow);
                 $recipRow['sys_dmail_categories_list'] = $htmlmail->getListOfRecipentCategories('tt_address', $recipRow['uid']);
                 $htmlmail->dmailer_sendAdvanced($recipRow, 't');
                 $sentFlag = true;
                 /* @var $flashMessage FlashMessage */
                 $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', sprintf($this->getLanguageService()->getLL('send_was_sent_to_name'), htmlspecialchars($recipRow['name']) . htmlspecialchars(' <' . $recipRow['email'] . '>')), $this->getLanguageService()->getLL('send_sending'), FlashMessage::OK);
             }
             $GLOBALS['TYPO3_DB']->sql_free_result($res);
         } elseif (is_array(GeneralUtility::_GP('sys_dmail_group_uid'))) {
             // personalized to group
             $result = $this->cmd_compileMailGroup(GeneralUtility::_GP('sys_dmail_group_uid'));
             $idLists = $result['queryInfo']['id_lists'];
             $sendFlag = 0;
             $sendFlag += $this->sendTestMailToTable($idLists, 'tt_address', $htmlmail);
             $sendFlag += $this->sendTestMailToTable($idLists, 'fe_users', $htmlmail);
             $sendFlag += $this->sendTestMailToTable($idLists, 'PLAINLIST', $htmlmail);
             $sendFlag += $this->sendTestMailToTable($idLists, $this->userTable, $htmlmail);
             /* @var $flashMessage FlashMessage */
             $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', sprintf($this->getLanguageService()->getLL('send_was_sent_to_number'), $sendFlag), $this->getLanguageService()->getLL('send_sending'), FlashMessage::OK);
         }
     } else {
         // step 5, sending personalized emails to the mailqueue
         // prepare the email for sending with the mailqueue
         $recipientGroups = GeneralUtility::_GP('mailgroup_uid');
         if (GeneralUtility::_GP('mailingMode_mailGroup') && $this->sys_dmail_uid && is_array($recipientGroups)) {
             // Update the record:
             $result = $this->cmd_compileMailGroup($recipientGroups);
             $queryInfo = $result['queryInfo'];
             $distributionTime = intval(GeneralUtility::_GP('send_mail_datetime'));
             if ($distributionTime < time()) {
                 $distributionTime = time();
             }
             $updateFields = array('recipientGroups' => implode(',', $recipientGroups), 'scheduled' => $distributionTime, 'query_info' => serialize($queryInfo));
             if (GeneralUtility::_GP('testmail')) {
                 $updateFields['subject'] = $this->params['testmail'] . ' ' . $row['subject'];
             }
             // create a draft version of the record
             if (GeneralUtility::_GP('savedraft')) {
                 if ($row['type'] == 0) {
                     $updateFields['type'] = 2;
                 } else {
                     $updateFields['type'] = 3;
                 }
                 $updateFields['scheduled'] = 0;
                 $content = $this->getLanguageService()->getLL('send_draft_scheduler');
                 $sectionTitle = $this->getLanguageService()->getLL('send_draft_saved');
             } else {
                 $content = $this->getLanguageService()->getLL('send_was_scheduled_for') . ' ' . BackendUtility::datetime($distributionTime);
                 $sectionTitle = $this->getLanguageService()->getLL('send_was_scheduled');
             }
             $sentFlag = true;
             $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_dmail', 'uid=' . intval($this->sys_dmail_uid), $updateFields);
             /* @var $flashMessage FlashMessage */
             $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $sectionTitle . '<br /><br />' . $content, $this->getLanguageService()->getLL('dmail_wiz5_sendmass'), FlashMessage::OK);
         }
     }
     // Setting flags and update the record:
     if ($sentFlag && $this->CMD == 'send_mail_final') {
         $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_dmail', 'uid=' . intval($this->sys_dmail_uid), array('issent' => 1));
     }
     return $flashMessage->render();
 }
Exemplo n.º 20
0
    /**
     * 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 (\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush')) {
            $doFlush = true;
            $doFullFlush = false;
        } elseif (\TYPO3\CMS\Core\Utility\GeneralUtility::_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 ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']) : ' ' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.immediate');
                    $rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-';
                }
                $rowData['result_status'] = \TYPO3\CMS\Core\Utility\GeneralUtility::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(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
                $refreshIcon = $GLOBALS['BACK_PATH'] . 'gfx/refresh_n.gif';
                if (version_compare(TYPO3_version, '7.0', '>=')) {
                    $refreshIcon = $GLOBALS['BACK_PATH'] . 'sysext/t3skin/extjs/images/grid/refresh.gif';
                }
                // Put rows together:
                $content .= '
					<tr class="bgColor' . ($c % 2 ? '-20' : '-10') . '">
						' . $titleClm . '
						<td><a href="' . $this->getModuleUrl(array('qid_details' => $vv['qid'], 'setID' => $setId)) . '">' . htmlspecialchars($vv['qid']) . '</a></td>
						<td><a href="' . $this->getModuleUrl(array('qid_read' => $vv['qid'], 'setID' => $setId)) . '"><img src="' . $refreshIcon . '" width="14" hspace="1" vspace="2" height="14" border="0" title="' . htmlspecialchars('Read') . '" alt="" /></a></td>';
                foreach ($rowData as $fKey => $value) {
                    if (\TYPO3\CMS\Core\Utility\GeneralUtility::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'] = \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']);
                    $rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::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;
    }
Exemplo n.º 21
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) GeneralUtility::_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>' . \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($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>' . \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($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>' . \TYPO3\CMS\Core\Utility\DebugUtility::viewArray(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>' . BackendUtility::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 = GeneralUtility::_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>' . \TYPO3\CMS\Core\Utility\DebugUtility::viewArray(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>' . BackendUtility::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=' . (int) $row['tstamp'] . '">' . htmlspecialchars($row['script']) . '</a></td>
								</tr>';
                    }
                }
                $outStr = '
						<table border="1" cellspacing="0">' . implode('', $tRows) . '
						</table>';
        }
        $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(GeneralUtility::linkThisScript()) . '" target="tx_debuglog">[New window]</a>
					<hr />
		';
        return $menu . $outStr;
    }
Exemplo n.º 22
0
 /**
  * show the compact information of a direct mail record
  *
  * @param	array		$row: direct mail record
  * @return	string		the compact infos of the direct mail record
  */
 function directMail_compactView($row)
 {
     // Render record:
     if ($row['type']) {
         $dmailData = $row['plainParams'] . ', ' . $row['HTMLParams'];
     } else {
         $page = BackendUtility::getRecord('pages', $row['page'], 'title');
         $dmailData = $row['page'] . ', ' . htmlspecialchars($page['title']);
         $dmail_info = DirectMailUtility::fName('plainParams') . ' ' . htmlspecialchars($row['plainParams'] . LF . DirectMailUtility::fName('HTMLParams') . $row['HTMLParams']) . '; ' . LF;
     }
     $dmail_info .= $GLOBALS["LANG"]->getLL('view_media') . ' ' . BackendUtility::getProcessedValue('sys_dmail', 'includeMedia', $row['includeMedia']) . '; ' . LF . $GLOBALS["LANG"]->getLL('view_flowed') . ' ' . BackendUtility::getProcessedValue('sys_dmail', 'flowedFormat', $row['flowedFormat']);
     $dmail_info = '<img' . IconUtility::skinImg($GLOBALS["BACK_PATH"], 'gfx/zoom2.gif', 'width="12" height="12"') . ' title="' . $dmail_info . '">';
     $from_info = $GLOBALS["LANG"]->getLL('view_replyto') . ' ' . htmlspecialchars($row['replyto_name'] . ' <' . $row['replyto_email'] . '>') . '; ' . LF . DirectMailUtility::fName('organisation') . ' ' . htmlspecialchars($row['organisation']) . '; ' . LF . DirectMailUtility::fName('return_path') . ' ' . htmlspecialchars($row['return_path']);
     $from_info = '<img' . IconUtility::skinImg($GLOBALS["BACK_PATH"], 'gfx/zoom2.gif', 'width="12" height="12"') . ' title="' . $from_info . '">';
     $mail_info = DirectMailUtility::fName('priority') . ' ' . BackendUtility::getProcessedValue('sys_dmail', 'priority', $row['priority']) . '; ' . LF . DirectMailUtility::fName('encoding') . ' ' . BackendUtility::getProcessedValue('sys_dmail', 'encoding', $row['encoding']) . '; ' . LF . DirectMailUtility::fName('charset') . ' ' . BackendUtility::getProcessedValue('sys_dmail', 'charset', $row['charset']);
     $mail_info = '<img' . IconUtility::skinImg($GLOBALS["BACK_PATH"], 'gfx/zoom2.gif', 'width="12" height="12"') . ' title="' . $mail_info . '">';
     $delBegin = $row["scheduled_begin"] ? BackendUtility::datetime($row["scheduled_begin"]) : '-';
     $delEnd = $row["scheduled_end"] ? BackendUtility::datetime($row["scheduled_begin"]) : '-';
     //count total recipient from the query_info
     $totalRecip = 0;
     $id_lists = unserialize($row['query_info']);
     foreach ($id_lists['id_lists'] as $idArray) {
         $totalRecip += count($idArray);
     }
     $sentRecip = $GLOBALS['TYPO3_DB']->sql_num_rows($GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_dmail_maillog', 'mid=' . $row['uid'] . ' AND response_type = 0', '', 'rid ASC'));
     $out = '<table cellpadding="3" cellspacing="0" class="stats-table">';
     $out .= '<tr class="bgColor2"><td colspan="3">' . IconUtility::getSpriteIconForRecord('sys_dmail', $row) . htmlspecialchars($row['subject']) . '</td></tr>';
     $out .= '<tr class="bgColor4"><td>' . $GLOBALS["LANG"]->getLL('view_from') . '</td><td>' . htmlspecialchars($row['from_name'] . ' <' . htmlspecialchars($row['from_email']) . '>') . '</td><td>' . $from_info . '</td></tr>';
     $out .= '<tr class="bgColor4"><td>' . $GLOBALS["LANG"]->getLL('view_dmail') . '</td><td>' . BackendUtility::getProcessedValue('sys_dmail', 'type', $row['type']) . ': ' . $dmailData . '</td><td>' . $dmail_info . '</td></tr>';
     $out .= '<tr class="bgColor4"><td>' . $GLOBALS["LANG"]->getLL('view_mail') . '</td><td>' . BackendUtility::getProcessedValue('sys_dmail', 'sendOptions', $row['sendOptions']) . ($row['attachment'] ? '; ' : '') . BackendUtility::getProcessedValue('sys_dmail', 'attachment', $row['attachment']) . '</td><td>' . $mail_info . '</td></tr>';
     $out .= '<tr class="bgColor4"><td>' . $GLOBALS["LANG"]->getLL('view_delivery_begin_end') . '</td><td>' . $delBegin . ' / ' . $delEnd . '</td><td>&nbsp;</td></tr>';
     $out .= '<tr class="bgColor4"><td>' . $GLOBALS["LANG"]->getLL('view_recipient_total_sent') . '</td><td>' . $totalRecip . ' / ' . $sentRecip . '</td><td>&nbsp;</td></tr>';
     $out .= '</table>';
     $out .= $this->doc->spacer(5);
     return $out;
 }
Exemplo n.º 23
0
 /**
  * Gets an array with all sys_log entries and their comments for the given record uid and table
  *
  * @param int $uid uid of changed element to search for in log
  * @param string $table Name of the record's table
  * @return array
  */
 public function getCommentsForRecord($uid, $table)
 {
     $sysLogReturnArray = [];
     $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_log');
     $result = $queryBuilder->select('log_data', 'tstamp', 'userid')->from('sys_log')->where($queryBuilder->expr()->eq('action', $queryBuilder->createNamedParameter(6, \PDO::PARAM_INT)), $queryBuilder->expr()->eq('details_nr', $queryBuilder->createNamedParameter(30, \PDO::PARAM_INT)), $queryBuilder->expr()->eq('tablename', $queryBuilder->createNamedParameter($table, \PDO::PARAM_STR)), $queryBuilder->expr()->eq('recuid', $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)))->orderBy('tstamp', 'DESC')->execute();
     /** @var Avatar $avatar */
     $avatar = GeneralUtility::makeInstance(Avatar::class);
     while ($sysLogRow = $result->fetch()) {
         $sysLogEntry = [];
         $data = unserialize($sysLogRow['log_data']);
         $beUserRecord = BackendUtility::getRecord('be_users', $sysLogRow['userid']);
         $sysLogEntry['stage_title'] = htmlspecialchars($this->getStagesService()->getStageTitle($data['stage']));
         $sysLogEntry['user_uid'] = (int) $sysLogRow['userid'];
         $sysLogEntry['user_username'] = is_array($beUserRecord) ? htmlspecialchars($beUserRecord['username']) : '';
         $sysLogEntry['tstamp'] = htmlspecialchars(BackendUtility::datetime($sysLogRow['tstamp']));
         $sysLogEntry['user_comment'] = nl2br(htmlspecialchars($data['comment']));
         $sysLogEntry['user_avatar'] = $avatar->render($beUserRecord);
         $sysLogReturnArray[] = $sysLogEntry;
     }
     return $sysLogReturnArray;
 }
    /**
     * Render property array as html table
     *
     * @return string
     */
    protected function renderPropertiesAsTable()
    {
        $tableRows = array();
        $extraFields = array();
        $lang = $this->getLanguageService();
        if (in_array($this->type, array('folder', 'file'), true)) {
            if ($this->type === 'file') {
                $extraFields['creation_date'] = $lang->sL('LLL:EXT:lang/locallang_general.xlf:LGL.creationDate', true);
                $extraFields['modification_date'] = $lang->sL('LLL:EXT:lang/locallang_general.xlf:LGL.timestamp', true);
            }
            $extraFields['storage'] = $lang->sL('LLL:EXT:lang/locallang_tca.xlf:sys_file.storage', true);
            $extraFields['folder'] = $lang->sL('LLL:EXT:lang/locallang_common.xlf:folder', true);
        } else {
            $extraFields['crdate'] = $lang->sL('LLL:EXT:lang/locallang_general.xlf:LGL.creationDate', true);
            $extraFields['cruser_id'] = $lang->sL('LLL:EXT:lang/locallang_general.xlf:LGL.creationUserId', true);
            $extraFields['tstamp'] = $lang->sL('LLL:EXT:lang/locallang_general.xlf:LGL.timestamp', true);
            // check if the special fields are defined in the TCA ctrl section of the table
            foreach ($extraFields as $fieldName => $fieldLabel) {
                if (isset($GLOBALS['TCA'][$this->table]['ctrl'][$fieldName])) {
                    $extraFields[$GLOBALS['TCA'][$this->table]['ctrl'][$fieldName]] = $fieldLabel;
                } else {
                    unset($extraFields[$fieldName]);
                }
            }
        }
        foreach ($extraFields as $name => $fieldLabel) {
            $rowValue = '';
            if (!isset($this->row[$name])) {
                $resourceObject = $this->fileObject ?: $this->folderObject;
                if ($name === 'storage') {
                    $rowValue = $resourceObject->getStorage()->getName();
                } elseif ($name === 'folder') {
                    $rowValue = $resourceObject->getParentFolder()->getReadablePath();
                }
            } elseif (in_array($name, array('creation_date', 'modification_date'), true)) {
                $rowValue = BackendUtility::datetime($this->row[$name]);
            } else {
                $rowValue = BackendUtility::getProcessedValueExtra($this->table, $name, $this->row[$name]);
            }
            // show the backend username who created the issue
            if ($name === 'cruser_id' && $rowValue) {
                $creatorRecord = BackendUtility::getRecord('be_users', $rowValue);
                if ($creatorRecord) {
                    /** @var Avatar $avatar */
                    $avatar = GeneralUtility::makeInstance(Avatar::class);
                    $icon = $avatar->render($creatorRecord);
                    $rowValue = '
                        <div class="media">
                            <div class="media-left">
                                ' . $icon . '
                            </div>
                            <div class="media-body">
                                <strong>' . htmlspecialchars($GLOBALS['BE_USER']->user['username']) . '</strong><br>
                                ' . ($GLOBALS['BE_USER']->user['realName'] ? htmlspecialchars($GLOBALS['BE_USER']->user['realName']) : '') . '
                            </div>
                        </div>';
                }
            }
            $tableRows[] = '
				<tr>
					<th class="col-nowrap">' . rtrim($fieldLabel, ':') . '</th>
					<td>' . ($name === 'cruser_id' ? $rowValue : htmlspecialchars($rowValue)) . '</td>
				</tr>';
        }
        // Traverse the list of fields to display for the record:
        $fieldList = GeneralUtility::trimExplode(',', $GLOBALS['TCA'][$this->table]['interface']['showRecordFieldList'], true);
        foreach ($fieldList as $name) {
            $name = trim($name);
            $uid = $this->row['uid'];
            if (!isset($GLOBALS['TCA'][$this->table]['columns'][$name])) {
                continue;
            }
            // Storage is already handled above
            if ($this->type === 'file' && $name === 'storage') {
                continue;
            }
            $isExcluded = !(!$GLOBALS['TCA'][$this->table]['columns'][$name]['exclude'] || $this->getBackendUser()->check('non_exclude_fields', $this->table . ':' . $name));
            if ($isExcluded) {
                continue;
            }
            $itemValue = BackendUtility::getProcessedValue($this->table, $name, $this->row[$name], 0, 0, false, $uid);
            $itemLabel = $lang->sL(BackendUtility::getItemLabel($this->table, $name), true);
            $tableRows[] = '
				<tr>
					<th class="col-nowrap">' . $itemLabel . '</th>
					<td>' . htmlspecialchars($itemValue) . '</td>
				</tr>';
        }
        return '
			<div class="table-fit table-fit-wrap">
				<table class="table table-striped table-hover">
					' . implode('', $tableRows) . '
				</table>
			</div>';
    }
Exemplo n.º 25
0
    /**
     * Shows the full change log
     *
     * @return string HTML for list, wrapped in a table.
     * @todo Define visibility
     */
    public function displayHistory()
    {
        $lines = array();
        // Initialize:
        $lines[] = '<thead><tr>
				<th> </th>
				<th>' . $GLOBALS['LANG']->getLL('time', 1) . '</th>
				<th>' . $GLOBALS['LANG']->getLL('age', 1) . '</th>
				<th>' . $GLOBALS['LANG']->getLL('user', 1) . '</th>
				<th>' . $GLOBALS['LANG']->getLL('tableUid', 1) . '</th>
				<th>' . $GLOBALS['LANG']->getLL('differences', 1) . '</th>
				<th>&nbsp;</th>
			</tr></thead>';
        $be_user_array = BackendUtility::getUserNames();
        // Traverse changelog array:
        if (!$this->changeLog) {
            return 0;
        }
        $i = 0;
        foreach ($this->changeLog as $sysLogUid => $entry) {
            // stop after maxSteps
            if ($i > $this->maxSteps && $this->maxSteps) {
                break;
            }
            // Show only marked states
            if (!$entry['snapshot'] && $this->showMarked) {
                continue;
            }
            $i++;
            // Get user names
            $userName = $entry['user'] ? $be_user_array[$entry['user']]['username'] : $GLOBALS['LANG']->getLL('externalChange', 1);
            // Build up single line
            $singleLine = array();
            // Diff link
            $image = IconUtility::getSpriteIcon('actions-view-go-forward', array('title' => $GLOBALS['LANG']->getLL('sumUpChanges', TRUE)));
            $singleLine[] = '<span>' . $this->linkPage($image, array('diff' => $sysLogUid)) . '</span>';
            // remove first link
            $singleLine[] = htmlspecialchars(BackendUtility::datetime($entry['tstamp']));
            // add time
            $singleLine[] = htmlspecialchars(BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $entry['tstamp'], $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')));
            // add age
            $singleLine[] = htmlspecialchars($userName);
            // add user name
            $singleLine[] = $this->linkPage($this->generateTitle($entry['tablename'], $entry['recuid']), array('element' => $entry['tablename'] . ':' . $entry['recuid']), '', $GLOBALS['LANG']->getLL('linkRecordHistory', 1));
            // add record UID
            // Show insert/delete/diff/changed field names
            if ($entry['action']) {
                // insert or delete of element
                $singleLine[] = '<strong>' . htmlspecialchars($GLOBALS['LANG']->getLL($entry['action'], 1)) . '</strong>';
            } else {
                // Display field names instead of full diff
                if (!$this->showDiff) {
                    // Re-write field names with labels
                    $tmpFieldList = explode(',', $entry['fieldlist']);
                    foreach ($tmpFieldList as $key => $value) {
                        $tmp = str_replace(':', '', $GLOBALS['LANG']->sl(BackendUtility::getItemLabel($entry['tablename'], $value), 1));
                        if ($tmp) {
                            $tmpFieldList[$key] = $tmp;
                        } else {
                            // remove fields if no label available
                            unset($tmpFieldList[$key]);
                        }
                    }
                    $singleLine[] = htmlspecialchars(implode(',', $tmpFieldList));
                } else {
                    // Display diff
                    $diff = $this->renderDiff($entry, $entry['tablename']);
                    $singleLine[] = $diff;
                }
            }
            // Show link to mark/unmark state
            if (!$entry['action']) {
                if ($entry['snapshot']) {
                    $image = IconUtility::getSpriteIcon('actions-unmarkstate', array('title' => $GLOBALS['LANG']->getLL('unmarkState', TRUE)), array());
                } else {
                    $image = IconUtility::getSpriteIcon('actions-markstate', array('title' => $GLOBALS['LANG']->getLL('markState', TRUE)), array());
                }
                $singleLine[] = $this->linkPage($image, array('highlight' => $entry['uid']));
            } else {
                $singleLine[] = '';
            }
            // put line together
            $lines[] = '
				<tr>
					<td>' . implode('</td><td>', $singleLine) . '</td>
				</tr>';
        }
        // Finally, put it all together:
        $theCode = '
			<!--
				History (list):
			-->
			<table class="t3-table" id="typo3-history">
				' . implode('', $lines) . '
			</table>';
        if ($this->lastSyslogId) {
            $theCode .= '<br />' . $this->linkPage(IconUtility::getSpriteIcon('actions-move-to-bottom', array('title' => $GLOBALS['LANG']->getLL('fullView', TRUE))), array('diff' => ''));
        }
        // Add message about the difference view.
        $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('differenceMsg'), '', \TYPO3\CMS\Core\Messaging\FlashMessage::INFO);
        $theCode .= '<br /><br />' . $flashMessage->render() . '<br />';
        // Add the whole content as a module section:
        return $GLOBALS['SOBE']->doc->section($GLOBALS['LANG']->getLL('changes'), $theCode, FALSE, TRUE);
    }
Exemplo n.º 26
0
 /**
  * @param array $arguments
  * @param callable $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  *
  * @return string
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     return htmlspecialchars(BackendUtility::datetime($renderChildrenClosure()));
 }
Exemplo n.º 27
0
 /**
  * Returns the record title for input fields
  *
  * @param mixed $value Current database value of this field
  * @param array $fieldConfig TCA field configuration
  * @return string
  */
 protected function getRecordTitleForInputType($value, $fieldConfig)
 {
     if (!isset($value)) {
         return '';
     }
     $title = $value;
     if (GeneralUtility::inList($fieldConfig['eval'], 'date')) {
         if (isset($fieldConfig['dbType']) && $fieldConfig['dbType'] === 'date') {
             $value = $value === '0000-00-00' ? 0 : (int) strtotime($value);
         } else {
             $value = (int) $value;
         }
         if (!empty($value)) {
             $ageSuffix = '';
             // Generate age suffix as long as not explicitly suppressed
             if (!isset($fieldConfig['disableAgeDisplay']) || (bool) $fieldConfig['disableAgeDisplay'] === false) {
                 $ageDelta = $GLOBALS['EXEC_TIME'] - $value;
                 $calculatedAge = BackendUtility::calcAge(abs($ageDelta), $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears'));
                 $ageSuffix = ' (' . ($ageDelta > 0 ? '-' : '') . $calculatedAge . ')';
             }
             $title = BackendUtility::date($value) . $ageSuffix;
         }
     } elseif (GeneralUtility::inList($fieldConfig['eval'], 'time')) {
         if (!empty($value)) {
             $title = BackendUtility::time((int) $value, false);
         }
     } elseif (GeneralUtility::inList($fieldConfig['eval'], 'timesec')) {
         if (!empty($value)) {
             $title = BackendUtility::time((int) $value);
         }
     } elseif (GeneralUtility::inList($fieldConfig['eval'], 'datetime')) {
         // Handle native date/time field
         if (isset($fieldConfig['dbType']) && $fieldConfig['dbType'] === 'datetime') {
             $value = $value === '0000-00-00 00:00:00' ? 0 : (int) strtotime($value);
         } else {
             $value = (int) $value;
         }
         if (!empty($value)) {
             $title = BackendUtility::datetime($value);
         }
     }
     return $title;
 }
Exemplo n.º 28
0
    /**
     * Shows the full change log
     *
     * @return string HTML for list, wrapped in a table.
     */
    public function displayHistory()
    {
        if (empty($this->changeLog)) {
            return '';
        }
        $languageService = $this->getLanguageService();
        $lines = array();
        // Initialize:
        $lines[] = '<thead><tr>
				<th>' . $languageService->getLL('rollback', true) . '</th>
				<th>' . $languageService->getLL('time', true) . '</th>
				<th>' . $languageService->getLL('age', true) . '</th>
				<th>' . $languageService->getLL('user', true) . '</th>
				<th>' . $languageService->getLL('tableUid', true) . '</th>
				<th>' . $languageService->getLL('differences', true) . '</th>
				<th>&nbsp;</th>
			</tr></thead>';
        $beUserArray = BackendUtility::getUserNames();
        $i = 0;
        /** @var Avatar $avatar */
        $avatar = GeneralUtility::makeInstance(Avatar::class);
        // Traverse changeLog array:
        foreach ($this->changeLog as $sysLogUid => $entry) {
            // stop after maxSteps
            if ($this->maxSteps && $i > $this->maxSteps) {
                break;
            }
            // Show only marked states
            if (!$entry['snapshot'] && $this->showMarked) {
                continue;
            }
            $i++;
            // Get user names
            $userName = $entry['user'] ? $beUserArray[$entry['user']]['username'] : $languageService->getLL('externalChange', true);
            // Build up single line
            $singleLine = array();
            // Diff link
            $image = '<span title="' . $languageService->getLL('sumUpChanges', true) . '">' . $this->iconFactory->getIcon('actions-document-history-open', Icon::SIZE_SMALL)->render() . '</span>';
            $singleLine[] = '<span>' . $this->linkPage($image, array('diff' => $sysLogUid)) . '</span>';
            // remove first link
            $singleLine[] = htmlspecialchars(BackendUtility::datetime($entry['tstamp']));
            // add time
            $singleLine[] = htmlspecialchars(BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $entry['tstamp'], $languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')));
            // add age
            $userEntry = is_array($beUserArray[$entry['user']]) ? $beUserArray[$entry['user']] : null;
            $singleLine[] = $avatar->render($userEntry) . ' ' . htmlspecialchars($userName);
            // add user name
            $singleLine[] = $this->linkPage($this->generateTitle($entry['tablename'], $entry['recuid']), array('element' => $entry['tablename'] . ':' . $entry['recuid']), '', $languageService->getLL('linkRecordHistory', true));
            // add record UID
            // Show insert/delete/diff/changed field names
            if ($entry['action']) {
                // insert or delete of element
                $singleLine[] = '<strong>' . htmlspecialchars($languageService->getLL($entry['action'], true)) . '</strong>';
            } else {
                // Display field names instead of full diff
                if (!$this->showDiff) {
                    // Re-write field names with labels
                    $tmpFieldList = explode(',', $entry['fieldlist']);
                    foreach ($tmpFieldList as $key => $value) {
                        $tmp = str_replace(':', '', $languageService->sl(BackendUtility::getItemLabel($entry['tablename'], $value), true));
                        if ($tmp) {
                            $tmpFieldList[$key] = $tmp;
                        } else {
                            // remove fields if no label available
                            unset($tmpFieldList[$key]);
                        }
                    }
                    $singleLine[] = htmlspecialchars(implode(',', $tmpFieldList));
                } else {
                    // Display diff
                    $diff = $this->renderDiff($entry, $entry['tablename']);
                    $singleLine[] = $diff;
                }
            }
            // Show link to mark/unmark state
            if (!$entry['action']) {
                if ($entry['snapshot']) {
                    $title = $languageService->getLL('unmarkState', true);
                    $image = $this->iconFactory->getIcon('actions-unmarkstate', Icon::SIZE_SMALL)->render();
                } else {
                    $title = $languageService->getLL('markState', true);
                    $image = $this->iconFactory->getIcon('actions-markstate', Icon::SIZE_SMALL)->render();
                }
                $singleLine[] = $this->linkPage($image, array('highlight' => $entry['uid']), '', $title);
            } else {
                $singleLine[] = '';
            }
            // put line together
            $lines[] = '
				<tr>
					<td>' . implode('</td><td>', $singleLine) . '</td>
				</tr>';
        }
        // @TODO: introduce Fluid Standalone view and use callout viewHelper
        $theCode = '<div class="callout callout-info">' . '<div class="media"><div class="media-left"><span class="fa-stack fa-lg callout-icon"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-info fa-stack-1x"></i></span></div>' . '<div class="media-body">' . '<p>' . $languageService->getLL('differenceMsg') . '</p>' . '	<div class="callout-body">' . '	</div></div></div></div>';
        // Finally, put it all together:
        $theCode .= '
			<!--
				History (list):
			-->

			<table class="table table-striped table-hover table-vertical-top" id="typo3-history">
				' . implode('', $lines) . '
			</table>';
        if ($this->lastSyslogId) {
            $theCode .= '<br />' . $this->linkPage('<span class="btn btn-default">' . $languageService->getLL('fullView', true) . '</span>', array('diff' => ''));
        }
        $theCode .= '<br /><br />';
        // Add the whole content as a module section:
        return '<h2>' . $languageService->getLL('changes', true) . '</h2><div>' . $theCode . '</div>';
    }
 /**
  * Generates grid list array from given versions.
  *
  * @param array $versions All available version records
  * @param string $filterTxt Text to be used to filter record result
  * @return void
  */
 protected function generateDataArray(array $versions, $filterTxt)
 {
     $workspaceAccess = $GLOBALS['BE_USER']->checkWorkspace($GLOBALS['BE_USER']->workspace);
     $swapStage = $workspaceAccess['publish_access'] & 1 ? \TYPO3\CMS\Workspaces\Service\StagesService::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) {
         /** @var $stagesObj \TYPO3\CMS\Workspaces\Service\StagesService */
         $stagesObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Workspaces\\Service\\StagesService');
         $defaultGridColumns = array(self::GridColumn_Collection => 0, self::GridColumn_CollectionLevel => 0, self::GridColumn_CollectionParent => '', self::GridColumn_CollectionCurrent => '', self::GridColumn_CollectionChildren => 0);
         foreach ($versions as $table => $records) {
             $hiddenField = $this->getTcaEnableColumnsFieldName($table, 'disabled');
             $isRecordTypeAllowedToModify = $GLOBALS['BE_USER']->check('tables_modify', $table);
             foreach ($records as $record) {
                 $origRecord = BackendUtility::getRecord($table, $record['t3ver_oid']);
                 $versionRecord = BackendUtility::getRecord($table, $record['uid']);
                 $combinedRecord = \TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord::createFromArrays($table, $origRecord, $versionRecord);
                 $this->getIntegrityService()->checkElement($combinedRecord);
                 if ($hiddenField !== NULL) {
                     $recordState = $this->workspaceState($versionRecord['t3ver_state'], $origRecord[$hiddenField], $versionRecord[$hiddenField]);
                 } else {
                     $recordState = $this->workspaceState($versionRecord['t3ver_state']);
                 }
                 $isDeletedPage = $table == 'pages' && $recordState == 'deleted';
                 $viewUrl = \TYPO3\CMS\Workspaces\Service\WorkspaceService::viewSingleRecord($table, $record['uid'], $origRecord, $versionRecord);
                 $versionArray = array();
                 $versionArray['table'] = $table;
                 $versionArray['id'] = $table . ':' . $record['uid'];
                 $versionArray['uid'] = $record['uid'];
                 $versionArray['workspace'] = $versionRecord['t3ver_id'];
                 $versionArray = array_merge($versionArray, $defaultGridColumns);
                 $versionArray['label_Workspace'] = htmlspecialchars(BackendUtility::getRecordTitle($table, $versionRecord));
                 $versionArray['label_Live'] = htmlspecialchars(BackendUtility::getRecordTitle($table, $origRecord));
                 $versionArray['label_Stage'] = htmlspecialchars($stagesObj->getStageTitle($versionRecord['t3ver_stage']));
                 $tempStage = $stagesObj->getNextStage($versionRecord['t3ver_stage']);
                 $versionArray['label_nextStage'] = htmlspecialchars($stagesObj->getStageTitle($tempStage['uid']));
                 $tempStage = $stagesObj->getPrevStage($versionRecord['t3ver_stage']);
                 $versionArray['label_prevStage'] = htmlspecialchars($stagesObj->getStageTitle($tempStage['uid']));
                 $versionArray['path_Live'] = htmlspecialchars(BackendUtility::getRecordPath($record['livepid'], '', 999));
                 $versionArray['path_Workspace'] = htmlspecialchars(BackendUtility::getRecordPath($record['wspid'], '', 999));
                 $versionArray['workspace_Title'] = htmlspecialchars(\TYPO3\CMS\Workspaces\Service\WorkspaceService::getWorkspaceTitle($versionRecord['t3ver_wsid']));
                 $versionArray['workspace_Tstamp'] = $versionRecord['tstamp'];
                 $versionArray['workspace_Formated_Tstamp'] = BackendUtility::datetime($versionRecord['tstamp']);
                 $versionArray['t3ver_wsid'] = $versionRecord['t3ver_wsid'];
                 $versionArray['t3ver_oid'] = $record['t3ver_oid'];
                 $versionArray['livepid'] = $record['livepid'];
                 $versionArray['stage'] = $versionRecord['t3ver_stage'];
                 $versionArray['icon_Live'] = \TYPO3\CMS\Backend\Utility\IconUtility::mapRecordTypeToSpriteIconClass($table, $origRecord);
                 $versionArray['icon_Workspace'] = \TYPO3\CMS\Backend\Utility\IconUtility::mapRecordTypeToSpriteIconClass($table, $versionRecord);
                 $languageValue = $this->getLanguageValue($table, $versionRecord);
                 $versionArray['languageValue'] = $languageValue;
                 $versionArray['language'] = array('cls' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconClasses($this->getSystemLanguageValue($languageValue, 'flagIcon')), 'title' => htmlspecialchars($this->getSystemLanguageValue($languageValue, 'title')));
                 $versionArray['allowedAction_nextStage'] = $isRecordTypeAllowedToModify && $stagesObj->isNextStageAllowedForUser($versionRecord['t3ver_stage']);
                 $versionArray['allowedAction_prevStage'] = $isRecordTypeAllowedToModify && $stagesObj->isPrevStageAllowedForUser($versionRecord['t3ver_stage']);
                 if ($swapAccess && $swapStage != 0 && $versionRecord['t3ver_stage'] == $swapStage) {
                     $versionArray['allowedAction_swap'] = $isRecordTypeAllowedToModify && $stagesObj->isNextStageAllowedForUser($swapStage);
                 } elseif ($swapAccess && $swapStage == 0) {
                     $versionArray['allowedAction_swap'] = $isRecordTypeAllowedToModify;
                 } else {
                     $versionArray['allowedAction_swap'] = FALSE;
                 }
                 $versionArray['allowedAction_delete'] = $isRecordTypeAllowedToModify;
                 // preview and editing of a deleted page won't work ;)
                 $versionArray['allowedAction_view'] = !$isDeletedPage && $viewUrl;
                 $versionArray['allowedAction_edit'] = $isRecordTypeAllowedToModify && !$isDeletedPage;
                 $versionArray['allowedAction_editVersionedPage'] = $isRecordTypeAllowedToModify && !$isDeletedPage;
                 $versionArray['state_Workspace'] = $recordState;
                 $versionArray = array_merge($versionArray, $this->getAdditionalColumnService()->getData($combinedRecord));
                 if ($filterTxt == '' || $this->isFilterTextInVisibleColumns($filterTxt, $versionArray)) {
                     $versionIdentifier = $versionArray['id'];
                     $this->dataArray[$versionIdentifier] = $versionArray;
                 }
             }
         }
         // Suggested slot method:
         // methodName(\TYPO3\CMS\Workspaces\Service\GridDataService $gridData, array &$dataArray, array $versions)
         $this->emitSignal(self::SIGNAL_GenerateDataArray_BeforeCaching, $this->dataArray, $versions);
         // Enrich elements after everything has been processed:
         foreach ($this->dataArray as &$element) {
             $identifier = $element['table'] . ':' . $element['t3ver_oid'];
             $element['integrity'] = array('status' => $this->getIntegrityService()->getStatusRepresentation($identifier), 'messages' => htmlspecialchars($this->getIntegrityService()->getIssueMessages($identifier, TRUE)));
         }
         $this->setDataArrayIntoCache($versions, $filterTxt);
     }
     // Suggested slot method:
     // methodName(\TYPO3\CMS\Workspaces\Service\GridDataService $gridData, array &$dataArray, array $versions)
     $this->emitSignal(self::SIGNAL_GenerateDataArray_PostProcesss, $this->dataArray, $versions);
     $this->sortDataArray();
     $this->resolveDataArrayDependencies();
 }
    /**
     * Main function creating the content for the module.
     *
     * @return string HTML content for the module, actually a "section" made through the parent object in $this->pObj
     */
    public function main()
    {
        $lang = $this->getLanguageService();
        $lang->includeLLFile('EXT:wizard_sortpages/locallang.xlf');
        $out = $this->pObj->doc->header($lang->getLL('wiz_sort'));
        if ($this->getBackendUser()->workspace === 0) {
            $theCode = '';
            // Check if user has modify permissions to
            $sys_pages = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Page\PageRepository::class);
            $sortByField = GeneralUtility::_GP('sortByField');
            if ($sortByField) {
                $menuItems = array();
                if (GeneralUtility::inList('title,subtitle,crdate,tstamp', $sortByField)) {
                    $menuItems = $sys_pages->getMenu($this->pObj->id, 'uid,pid,title', $sortByField, '', FALSE);
                } elseif ($sortByField === 'REV') {
                    $menuItems = $sys_pages->getMenu($this->pObj->id, 'uid,pid,title', 'sorting', '', FALSE);
                    $menuItems = array_reverse($menuItems);
                }
                if (!empty($menuItems)) {
                    $tce = GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
                    $tce->stripslashes_values = 0;
                    $menuItems = array_reverse($menuItems);
                    $cmd = array();
                    foreach ($menuItems as $r) {
                        $cmd['pages'][$r['uid']]['move'] = $this->pObj->id;
                    }
                    $tce->start(array(), $cmd);
                    $tce->process_cmdmap();
                    BackendUtility::setUpdateSignal('updatePageTree');
                }
            }
            $menuItems = $sys_pages->getMenu($this->pObj->id, '*', 'sorting', '', FALSE);
            if (!empty($menuItems)) {
                $lines = array();
                $lines[] = '<thead><tr>';
                $lines[] = '<th>' . $lang->getLL('wiz_changeOrder_title') . '</th>';
                $lines[] = '<th>' . $lang->getLL('wiz_changeOrder_subtitle') . '</th>';
                $lines[] = '<th>' . $lang->getLL('wiz_changeOrder_tChange') . '</th>';
                $lines[] = '<th>' . $lang->getLL('wiz_changeOrder_tCreate') . '</th>';
                $lines[] = '</tr></thead>';
                foreach ($menuItems as $rec) {
                    $m_perms_clause = $this->getBackendUser()->getPagePermsClause(2);
                    // edit permissions for that page!
                    $pRec = BackendUtility::getRecord('pages', $rec['uid'], 'uid', ' AND ' . $m_perms_clause);
                    $lines[] = '<tr><td nowrap="nowrap">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $rec) . (!is_array($pRec) ? '<strong class="text-danger">' . $lang->getLL('wiz_W', TRUE) . '</strong></span> ' : '') . htmlspecialchars(GeneralUtility::fixed_lgd_cs($rec['title'], $GLOBALS['BE_USER']->uc['titleLen'])) . '</td>
					<td nowrap="nowrap">' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($rec['subtitle'], $this->getBackendUser()->uc['titleLen'])) . '</td>
					<td nowrap="nowrap">' . BackendUtility::datetime($rec['tstamp']) . '</td>
					<td nowrap="nowrap">' . BackendUtility::datetime($rec['crdate']) . '</td>
					</tr>';
                }
                $theCode .= '<h2>' . $lang->getLL('wiz_currentPageOrder', TRUE) . '</h2>';
                $theCode .= '<div class="table-fit"><table class="table table-striped table-hover">' . implode('', $lines) . '</table></div>';
                // Menu:
                $lines = array();
                $lines[] = $this->wiz_linkOrder($lang->getLL('wiz_changeOrder_title'), 'title');
                $lines[] = $this->wiz_linkOrder($lang->getLL('wiz_changeOrder_subtitle'), 'subtitle');
                $lines[] = $this->wiz_linkOrder($lang->getLL('wiz_changeOrder_tChange'), 'tstamp');
                $lines[] = $this->wiz_linkOrder($lang->getLL('wiz_changeOrder_tCreate'), 'crdate');
                $lines[] = '';
                $lines[] = $this->wiz_linkOrder($lang->getLL('wiz_changeOrder_REVERSE'), 'REV');
                $theCode .= '<h4>' . $lang->getLL('wiz_changeOrder') . '</h4><p>' . implode(' ', $lines) . '</p>';
            } else {
                $flashMessage = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessage::class, $lang->getLL('no_subpages'), '', \TYPO3\CMS\Core\Messaging\FlashMessage::NOTICE);
                $theCode .= $flashMessage->render();
            }
            // CSH:
            $theCode .= BackendUtility::cshItem('_MOD_web_func', 'tx_wizardsortpages', NULL, '<br />|');
            $out .= $this->pObj->doc->section('', $theCode, FALSE, TRUE);
        } else {
            $out .= $this->pObj->doc->section('', 'Sorry, this function is not available in the current draft workspace!', FALSE, TRUE, 1);
        }
        return $out;
    }