示例#1
0
 /**
  * Action to edit records
  *
  * @param array $record sys_action record
  * @return string list of records
  */
 protected function viewEditRecord($record)
 {
     $content = '';
     $actionList = array();
     $dbAnalysis = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\RelationHandler::class);
     $dbAnalysis->setFetchAllFields(true);
     $dbAnalysis->start($record['t4_recordsToEdit'], '*');
     $dbAnalysis->getFromDB();
     // collect the records
     foreach ($dbAnalysis->itemArray as $el) {
         $path = BackendUtility::getRecordPath($el['id'], $this->taskObject->perms_clause, $this->getBackendUser()->uc['titleLen']);
         $record = BackendUtility::getRecord($el['table'], $dbAnalysis->results[$el['table']][$el['id']]);
         $title = BackendUtility::getRecordTitle($el['table'], $dbAnalysis->results[$el['table']][$el['id']]);
         $description = $this->getLanguageService()->sL($GLOBALS['TCA'][$el['table']]['ctrl']['title'], true);
         // @todo: which information could be needful
         if (isset($record['crdate'])) {
             $description .= ' - ' . BackendUtility::dateTimeAge($record['crdate']);
         }
         $link = BackendUtility::getModuleUrl('record_edit', array('edit[' . $el['table'] . '][' . $el['id'] . ']' => 'edit', 'returnUrl' => $this->moduleUrl), false, true);
         $actionList[$el['id']] = array('uid' => 'record-' . $el['table'] . '-' . $el['id'], 'title' => $title, 'description' => BackendUtility::getRecordTitle($el['table'], $dbAnalysis->results[$el['table']][$el['id']]), 'descriptionHtml' => $description, 'link' => $link, 'icon' => '<span title="' . htmlspecialchars($path) . '">' . $this->iconFactory->getIconForRecord($el['table'], $dbAnalysis->results[$el['table']][$el['id']], Icon::SIZE_SMALL)->render() . '</span>');
     }
     // Render the record list
     $content .= $this->taskObject->renderListMenu($actionList);
     return $content;
 }
 /**
  * @param int $tstamp Time stamp, seconds
  * @param int $prefix 1/-1 depending on polarity of age.
  * @param string $date $date=="date" will yield "dd:mm:yy" formatting, otherwise "dd:mm:yy hh:mm
  * @return string
  */
 public function dateTimeAge($tstamp, $prefix = 1, $date = '')
 {
     return BackendUtility::dateTimeAge($tstamp, $prefix, $date);
 }
 /**
  * Creates an HTML table row for a single redirect record.
  *
  * @param array $rec
  * @param int $page
  * @return string
  */
 protected function generateSingleRedirectContent(array $rec, $page)
 {
     $output = '<td>' . '<a href="' . $this->linkSelf('&cmd=edit&uid=' . rawurlencode($rec['uid'])) . '&page=' . $page . '">' . $this->getIcon('gfx/edit2.gif', 'width="11" height="12"', $this->pObj->doc->backPath, 'Edit entry') . '</a>' . '<a href="' . $this->linkSelf('&cmd=delete&uid=' . rawurlencode($rec['uid'])) . '&page=' . $page . '">' . $this->getIcon('gfx/garbage.gif', 'width="11" height="12"', $this->pObj->doc->backPath, 'Delete entry') . '</a>' . '</td>';
     $output .= sprintf('<td><a href="%s" target="_blank">/%s</a></td>', htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $rec['url']), htmlspecialchars($rec['url']));
     $destinationURL = $this->getDestinationRedirectURL($rec['destination']);
     $output .= sprintf('<td><a href="%1$s" target="_blank" title="%1$s">%2$s</a></td>', htmlspecialchars($destinationURL), htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($destinationURL, 30)));
     $output .= '<td>' . htmlspecialchars($this->getRedirectDomain($rec['domain_limit'])) . '</td>';
     $output .= '<td align="center">' . ($rec['has_moved'] ? '+' : '&nbsp;') . '</td>';
     $output .= '<td align="center">' . $rec['counter'] . '</td>';
     if ($rec['tstamp']) {
         $output .= '<td>' . \TYPO3\CMS\Backend\Utility\BackendUtility::dateTimeAge($rec['tstamp']) . '</td>';
     } else {
         $output .= '<td align="center">&mdash;</td>';
     }
     if ($rec['last_referer']) {
         $lastRef = htmlspecialchars($rec['last_referer']);
         $output .= sprintf('<td><a href="%s" target="_blank" title="%s">%s</a></td>', $lastRef, $lastRef, strlen($rec['last_referer']) > 30 ? htmlspecialchars(substr($rec['last_referer'], 0, 30)) . '...' : $lastRef);
     } else {
         $output .= '<td>&nbsp;</td>';
     }
     // Error:
     $errorMessage = '';
     $pagesWithURL = array_keys($GLOBALS['TYPO3_DB']->exec_SELECTgetRows('page_id', 'tx_realurl_urlencodecache', 'content=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($rec['url'], 'tx_realurl_urlencodecache'), '', '', '', '', 'page_id'));
     if (count($pagesWithURL) > 0) {
         $errorMessage .= $this->pObj->doc->icons(3) . 'Also a page URL: ' . implode(',', array_unique($pagesWithURL));
     }
     $output .= '<td>' . $errorMessage . '</td>';
     return $output;
 }
示例#4
0
文件: index.php 项目: rabe69/mm_forum
 /**
  *
  * Displays the user administration interface.
  * This includes a list of all registered users ordered descending by
  * username. The list includes the usergroups a user is member in and the
  * user's age. A search function is also included.
  *
  * @return string The HTML output.
  * @todo Outsource user management into own class!
  */
 function userManagement()
 {
     /* Get template */
     $template = file_get_contents(GeneralUtility::getFileAbsFileName('EXT:mm_forum/res/tmpl/mod1/users.html'));
     $template = tx_mmforum_BeTools::getSubpart($template, '###USERS_LIST###');
     $uTemplate = tx_mmforum_BeTools::getSubpart($template, '###USERS_LIST_ITEM###');
     // Retrieve global variables
     global $LANG, $BACK_PATH, $BE_USER;
     /** @var $LANG \TYPO3\CMS\Lang\LanguageService */
     // Generate SQL query
     $ug = $this->feGroups2Array();
     $mmforum = GeneralUtility::_GP('mmforum');
     if ($mmforum['no_filter']) {
         unset($mmforum['sword']);
         unset($mmforum['old_sword']);
     }
     if ($mmforum['old_sword'] && !$mmforum['sword']) {
         $mmforum['sword'] = $mmforum['old_sword'];
     }
     $gp = '';
     if ($mmforum['sword']) {
         $gp = '&mmforum[sword]=' . $mmforum['sword'];
     }
     $groups = implode(',', array(intval($this->confArr['userGroup']), intval($this->confArr['modGroup']), intval($this->confArr['adminGroup'])));
     if ($sword = $mmforum['sword']) {
         $sword = $this->databaseHandle->escapeStrForLike($sword, 'fe_users');
         $sword = $this->databaseHandle->fullQuoteStr($sword . '%', 'fe_users');
         $filter = 'username like ' . $sword;
     } else {
         $filter = '1';
     }
     // Determine sort order. The default is "ASC" order.
     switch (strtoupper(GeneralUtility::_GP('mmforum_style'))) {
         case 'DESC':
             $orderBy = 'DESC';
             break;
         case 'ASC':
         default:
             $orderBy = 'ASC';
             break;
     }
     if (GeneralUtility::_GP('mmforum_sort') == 'username') {
         $order = 'username ' . $orderBy . '';
         $uOrder = $orderBy == 'ASC' ? 'DESC' : 'ASC';
         $aOrder = 'ASC';
     } elseif (GeneralUtility::_GP('mmforum_sort') == 'age') {
         $order = 'crdate ' . $orderBy . '';
         $aOrder = $orderBy == 'ASC' ? 'DESC' : 'ASC';
         $uOrder = 'ASC';
     } else {
         $order = 'username ' . $orderBy . '';
         $aOrder = 'ASC';
         $uOrder = 'DESC';
     }
     #$userGroup_query = "(".$this->confArr['userGroup']." IN (usergroup) OR ".$this->confArr['modGroup']." IN (usergroup) OR ".$this->confArr['adminGroup']." IN (usergroup))";
     $userGroup_query = "(FIND_IN_SET('" . $this->confArr['userGroup'] . "',usergroup) OR FIND_IN_SET('" . $this->confArr['modGroup'] . "',usergroup) OR FIND_IN_SET('" . $this->confArr['adminGroup'] . "',usergroup))";
     #$userGroup_query = "1";
     $res = $this->databaseHandle->exec_SELECTquery('count(*)', 'fe_users', "{$filter} and pid='" . $this->confArr['userPID'] . "' and " . $userGroup_query . " and deleted=0");
     $row = $this->databaseHandle->sql_fetch_row($res);
     $records = $row[0];
     $pages = ceil($records / $this->confArr['recordsPerPage']);
     $offset = intval($mmforum['offset']);
     // Page navigation
     $pb = $LANG->getLL('page.page') . ' <a href="index.php?mmforum[offset]=0' . $gp . '">[' . $LANG->getLL('page.first') . ']</a> ';
     $end = $offset + 6 >= $pages ? $pages : $offset + 6;
     $start = $offset - 5;
     if ($start < 0) {
         $start = 0;
     }
     if ($start > 0) {
         $pb .= '... ';
     }
     for ($i = $start; $i < $end; $i++) {
         $pb .= '<a href="index.php?mmforum[offset]=' . $i . $gp . '">' . ($i == $offset ? '<b>' . ($i + 1) . '</b>' : $i + 1) . '</a> ';
     }
     if ($offset + 11 < $pages) {
         $pb .= ' ... <a href="index.php?mmforum[offset]=' . ($pages - 1) . $gp . '">[' . $LANG->getLL('page.last') . ']</a> ';
     }
     // Generate header table
     if ($records < $this->confArr['recordsPerPage']) {
         $mDisp = $records;
     } else {
         $mDisp = $offset * $this->confArr['recordsPerPage'] + $this->confArr['recordsPerPage'];
     }
     $userString = sprintf($LANG->getLL('useradmin.usercount'), $offset * $this->confArr['recordsPerPage'] + 1, $mDisp, $records);
     $out = '<table width="733"><tr>';
     $out .= '<td width="420">' . $pb . '</td>';
     $out .= '<td width="120" align="center"><b>' . $userString . '</b></td>';
     $out .= '<td align="right">' . $LANG->getLL('useradmin.searchfor') . ': <input type="text" id="sword" size="20" name="mmforum[sword]" /></td>';
     $out .= '</tr></table>';
     if ($mmforum['sword'] || $mmforum['old_sword']) {
         $out .= '<p>' . $LANG->getLL('useradmin.filter') . ': ' . $mmforum['sword'] . '* <a href="index.php?mmforum[no_filter]=1&' . $this->linkParams($mmforum) . '">' . $LANG->getLL('useradmin.filter.clear') . '</a></p>';
         $out .= '<input type="hidden" name="mmforum[old_sword]" value="' . $mmforum['sword'] . '" />';
     }
     // Display userdata table
     // Execute database query
     $res = $this->databaseHandle->exec_SELECTquery('*', 'fe_users', "{$filter} and pid='" . $this->confArr['userPID'] . "' and deleted=0 AND " . $userGroup_query, '', $order, $offset * $this->confArr['recordsPerPage'] . "," . $this->confArr['recordsPerPage']);
     if ($res) {
         $marker = array('###USERS_LLL_TITLE###' => $LANG->getLL('users.title'), '###USERS_LLL_USERNAME###' => '<a href="index.php?mmforum_sort=username&mmforum_style=' . $uOrder . '">' . $LANG->getLL('useradmin.username') . '</a>', '###USERS_LLL_REGISTERED###' => '<a href="index.php?mmforum_sort=age&mmforum_style=' . $aOrder . '">' . $LANG->getLL('useradmin.age') . '</a>', '###USERS_LLL_GROUPS###' => $LANG->getLL('useradmin.usergroup'), '###USERS_LLL_OPTIONS###' => '&nbsp;');
         $i = 0;
         $uContent = '';
         while ($row = $this->databaseHandle->sql_fetch_assoc($res)) {
             // Display user groups
             $g = explode(',', $row['usergroup']);
             $outg = '';
             foreach ($g as $sg) {
                 $outg .= $ug[$sg] . ', ';
             }
             $iconAltText = BackendUtility::getRecordIconAltText($row, $table);
             $elementTitle = BackendUtility::getRecordPath($row['uid'], '1=1', 0);
             $elementTitle = GeneralUtility::fixed_lgd_cs($elementTitle, -$BE_USER->uc['titleLen']);
             $elementIcon = IconUtility::getIconImage($table, $row, $BACK_PATH, 'class="c-recicon" title="' . $iconAltText . '"');
             $params = '&edit[fe_users][' . $row['uid'] . ']=edit';
             $editOnClick = BackendUtility::editOnClick($params, $BACK_PATH);
             // Generate row item
             $class_suffix = $i++ % 2 == 0 ? '2' : '';
             $link = "index.php?mmforum[cid]=" . $row['uid'];
             $js = 'onmouseover="this.className=\'mm_forum-listrow_active\'; this.style.cursor=\'pointer\';" onmouseout="this.className=\'mm_forum-listrow' . $class_suffix . '\'" onclick="' . htmlspecialchars($editOnClick) . '"';
             $icon = '<img src="../icon_tx_mmforum_forums.gif" />';
             $hidden = $row['hidden'] == 1 ? '<span style="color:blue;">[' . $LANG->getLL('boardadmin.hidden') . ']</span> ' : '';
             $uMarker = array('###USER_USERNAME###' => htmlspecialchars($row['username']), '###USER_REGISTERED###' => BackendUtility::dateTimeAge($row['crdate'], 1), '###USER_GROUPS###' => substr($outg, -2) == ', ' ? substr($outg, 0, strlen($outg) - 2) : $outg, '###USER_OPTIONS###' => '<img src="img/edit.png" onclick="' . htmlspecialchars($editOnClick) . '" style="cursor:pointer;" />');
             $uContent .= tx_mmforum_BeTools::substituteMarkerArray($uTemplate, $uMarker);
         }
         $template = tx_mmforum_BeTools::substituteSubpart($template, '###USERS_LIST_ITEM###', $uContent);
         $template = tx_mmforum_BeTools::substituteMarkerArray($template, $marker);
         $out .= $template;
     }
     return $out;
 }
示例#5
0
    /**
     * Generates the module content
     *
     * @return string
     */
    protected function moduleContent()
    {
        $useRecycler = $this->extensionConfiguration['useRecycler'];
        $createDropFile = $this->extensionConfiguration['createDropFile'];
        $garbageCollectionTriggerTimer = $this->extensionConfiguration['garbageCollectionTriggerTimer'];
        $rollbackSafetyTimespan = $this->extensionConfiguration['rollbackSafetyTimespan'];
        $rollbackPreviewRows = $this->extensionConfiguration['rollbackPreviewRows'];
        $rollbackDeleteFromDB = $this->extensionConfiguration['rollbackDeleteFromDB'];
        // garbage collection
        $this->gc($garbageCollectionTriggerTimer, $rollbackSafetyTimespan);
        // check if we have a file upload or have an already existing file
        $newFileObjectOrErrorMessage = $this->checkUpload();
        if (is_string($newFileObjectOrErrorMessage)) {
            $this->content .= $newFileObjectOrErrorMessage;
        }
        // check if we already have an uploaded file
        $uploadedFileUid = (int) $this->inData['settings']['uploadedFileUid'];
        if ($uploadedFileUid > 0) {
            $existingFileObject = $this->getResourceFactory()->getInstance()->getFileObject($uploadedFileUid);
            if ($existingFileObject instanceof File) {
                $fileObject = $existingFileObject;
            }
        }
        // there seems to be a new upload file
        if ($newFileObjectOrErrorMessage instanceof File) {
            // set current file to new value
            $fileObject = $newFileObjectOrErrorMessage;
            // and wipe out old module data to start new session
            $this->inData = '';
        }
        // always check if the file is present
        if (!is_object($fileObject) || !file_exists($fileObject->getForLocalProcessing(FALSE))) {
            $this->inData = '';
        }
        if ($newFileObjectOrErrorMessage instanceof File && !file_exists($newFileObjectOrErrorMessage->getForLocalProcessing(FALSE))) {
            $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('f1.tab1.section.error'), $GLOBALS['LANG']->getLL('f1.tab1.section.error.description'), 0, 1, 3);
        }
        if ($fileObject instanceof File) {
            $fileAbsolutePathAndName = $fileObject->getForLocalProcessing(FALSE);
        }
        $content = '';
        switch ((string) $this->MOD_SETTINGS['function']) {
            // print security message
            case 3:
                $content .= $this->doc->section($GLOBALS['LANG']->getLL('f3.securityNote'), '', 0, 1, 1);
                $content .= $GLOBALS['LANG']->getLL('f3.securityNote.message');
                $this->content .= $content;
                break;
                // rollback function
            // rollback function
            case 2:
                // temporary hack
                $this->inData = GeneralUtility::_GP('tx_rsuserimp');
                // if the rollback button was pressed...
                if (is_array($this->inData['rollback'])) {
                    // get the ID of the rollback session ...
                    $rollbackSession = array_keys($this->inData['rollback']);
                    if ($rollbackSession[0] != '') {
                        // ... and get the rollback session details
                        $data = $this->getRollbackDataSet($rollbackSession[0]);
                        $candidates = explode(',', $data['session_data']);
                    }
                    foreach ($candidates as $user) {
                        // how shall we handle updated users: are they to be deleted during rollback since
                        // they have been there before they were updated so they are not our "own" users...
                        // currently, they get deleted but i'm not sure what to do here...
                        if ($rollbackDeleteFromDB) {
                            $GLOBALS['TYPO3_DB']->exec_DELETEquery($data['db_table'], 'uid=' . $user . ' AND pid=' . $data['target_pid']);
                            $this->getBackendUserAuthentication()->writelog(1, 3, 0, '', 'UID %s deleted by CSV rollback action', array($user));
                        } else {
                            $GLOBALS['TYPO3_DB']->exec_UPDATEquery($data['db_table'], 'uid=' . $user, array('deleted' => '1'));
                        }
                    }
                    $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_rsuserimp_sessions', 'uid=' . $rollbackSession[0], array('active' => '0'));
                }
                // ... else display the form
                $rollbackData = $this->getRollbackDataSets();
                if (!empty($rollbackData)) {
                    $content .= '<table name="sessionlist" class="typo3-dblist" id="sessionlist" border="0" width="100%" align="center">';
                    $content .= '<tr class="t3-row-header">
										<td><strong>' . $GLOBALS['LANG']->getLL('f2.session') . '</strong></td>
										<td><strong>' . $GLOBALS['LANG']->getLL('f2.date') . '</strong></td>
										<td><strong>' . $GLOBALS['LANG']->getLL('f2.title') . '</strong></td>
										<td><strong>' . $GLOBALS['LANG']->getLL('f2.status') . '</strong></td>
									</tr>';
                    $rowcount = 0;
                    $colorcount = 0;
                    foreach ($rollbackData as $session) {
                        $info = explode(',', $session['session_data']);
                        $rollbacktime = $session['crdate'] + 60 * $rollbackSafetyTimespan;
                        $createtime = getdate($session['crdate'][0]);
                        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('username', 'be_users', 'uid=' . $session['user_uid']);
                        $row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
                        if ($GLOBALS['TYPO3_DB']->sql_affected_rows() == 1) {
                            $username = $row[0];
                        } elseif ($GLOBALS['TYPO3_DB']->sql_affected_rows() == 0) {
                            $username = $GLOBALS['LANG']->getLL('f2.importedBy.deleted', 1);
                        } else {
                            $username = $GLOBALS['LANG']->getLL('f2.importedBy.unknown', 1);
                        }
                        $infoBlock = '<strong>' . $GLOBALS['LANG']->getLL('f2.importSummary', 1) . '</strong>:
							<div align="left">
								<table cellpadding="0px" cellspacing="0px" border="0">
									<tr>
										<td>' . $GLOBALS['LANG']->getLL('f2.importFile', 1) . '</td>
										<td width="10pt"></td>
										<td>' . $session['file'] . '</td>
									</tr>
									<tr>
										<td>' . $GLOBALS['LANG']->getLL('f2.importedBy', 1) . '</td>
										<td width="10pt"></td>
										<td>' . $username . ' [UID ' . $session['user_uid'] . ']</td>
									</tr>
									<tr>
										<td>' . $GLOBALS['LANG']->getLL('f2.userType', 1) . '</td>
										<td width="10pt"></td>
										<td>' . $session['db_table'] . '</td>
									</tr>
									<tr>
										<td>' . $GLOBALS['LANG']->getLL('f2.usersImported', 1) . '</td>
										<td width="10pt"></td>
										<td>' . $session['num_imp'] . '</td>
									</tr>
									<tr>
										<td>' . $GLOBALS['LANG']->getLL('f2.usersUpdated', 1) . '</td>
										<td width="10pt"></td>
										<td>' . $session['num_upd'] . '</td>
									</tr>
									<tr>
										<td>' . $GLOBALS['LANG']->getLL('f2.usersDropped', 1) . '</td>
										<td width="10pt"></td>
										<td>' . $session['num_drop'] . (!empty($session['dropfile']) && is_file($session['dropfile']) ? ' [<a href="/uploads/tx_rsuserimp/' . basename($session['dropfile']) . '">' . $GLOBALS['LANG']->getLL('f1.tab5.downloadFile') . '</a>]' : '') . '</td>
									</tr>
								</table>
							</div>';
                        $previewNum = $rollbackPreviewRows < count($info) ? $rollbackPreviewRows : count($info);
                        if ($previewNum > 0) {
                            $infoBlock .= '<br><strong>' . $GLOBALS['LANG']->getLL('f2.sampleData', 1) . '</strong><br><br>';
                            for ($i = 0; $i < $previewNum; $i++) {
                                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($session['unique_identifier'], $session['db_table'], 'uid=' . $info[$i] . ' AND deleted=0');
                                $row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
                                if ($GLOBALS['TYPO3_DB']->sql_affected_rows() == 1) {
                                    $infoBlock .= $row[0] . ' [UID ' . $info[$i] . ']<br>';
                                } elseif ($GLOBALS['TYPO3_DB']->sql_affected_rows() == 0) {
                                    $infoBlock .= sprintf($GLOBALS['LANG']->getLL('f2.userAlreadyDeleted'), $info[$i]) . '<br>';
                                } else {
                                    $infoBlock .= $GLOBALS['LANG']->getLL('f2.unknownError') . '<br>';
                                }
                            }
                            $infoBlock .= '[...]<br>';
                        }
                        $infoBlock .= '<div align="right">
													<input type="submit" onclick="return confirm(\'' . $GLOBALS['LANG']->getLL('f2.rollback.sure', 1) . '\');" name="tx_rsuserimp[rollback][' . $session['uid'] . ']" value="Roll back" ' . ((mktime() < $rollbacktime || $rollbackSafetyTimespan == 0) && $session['active'] == 1 ? '' : 'disabled') . '/>
												</div>';
                        $colorcount = $colorcount == 1 ? 0 : 1;
                        $color = $colorcount == 1 ? $this->doc->bgColor5 : $this->doc->bgColor4;
                        $tr_params = ' onclick="setRowColor(this,\'' . $rowcount . '\',\'click\',\'' . $this->doc->bgColor6 . '\',\'' . $color . '\');" bgcolor="' . $color . '");"';
                        $content .= '<tr class="db_list_normal"' . $tr_params . ' id="sessionrow_' . $rowcount . '" name="sessionrow" style="cursor: pointer;">
											<td valign="top"><strong>' . $session['uid'] . '</td>
											<td valign="top">' . BackendUtility::dateTimeAge($session['crdate'], 1) . '</td>
											<td valign="top">' . $session['title'] . '</td>';
                        $now = mktime();
                        if ($now < $rollbacktime || $rollbackSafetyTimespan == 0) {
                            if ($session['active'] == 1) {
                                $content .= '<td valign="top">' . sprintf($GLOBALS['LANG']->getLL('f2.sessionRollback'), BackendUtility::dateTimeAge($rollbacktime, 1)) . '</td>';
                            }
                            if ($session['active'] == 0) {
                                $content .= '<td valign="top">' . $GLOBALS['LANG']->getLL('f2.sessionRolledBack') . '</td>';
                            }
                        } elseif ($now >= $rollbacktime) {
                            $content .= '<td valign="top">' . sprintf($GLOBALS['LANG']->getLL('f2.sessionExpired'), BackendUtility::dateTimeAge($rollbacktime, 1)) . '</td>';
                        }
                        $content .= '</tr>';
                        $content .= '<tr style="display: none;" id="rs_userimp_be_rollbacksession_' . $rowcount . '" bgcolor="' . $this->doc->bgColor6 . '">
												<td colspan="5">' . $infoBlock . '</td>
											</tr>';
                        $rowcount++;
                    }
                    //end foreach
                    $content .= '</table>';
                } else {
                    //if not empty rollbackData
                    $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('f2.noSessionFound'), '', 0, 1, 1);
                }
                $this->content .= $content;
                break;
                // import function
            // import function
            case 1:
                /***** start ********/
                /***** file upload ********/
                /**** TAB 1 data *****/
                $additionalMandatoryFields = isset($this->inData['settings']['extraFields']) ? $this->inData['settings']['extraFields'] : '';
                // create and initialize instance of our import object
                /** @var \Visol\RsUserimp\Service\UserImporterService $mapper */
                $mapper = GeneralUtility::makeInstance('Visol\\RsUserimp\\Service\\UserImporterService');
                $mapper->userType = isset($this->inData['settings']['importUserType']) ? $this->inData['settings']['importUserType'] : $mapper->userType;
                $mapper->setUserTypeDefaultData();
                $dbFieldsDefault = $mapper->columnNamesFromDB;
                $dbFieldsDefault = $mapper->removeNoMapFields($dbFieldsDefault);
                $dbFieldsDefault = array_unique(array_diff($dbFieldsDefault, $mapper->mandatoryFields));
                $row[] = '
						<input type="hidden" name="tx_rsuserimp[settings][uploadedFileUid]" value="' . ($fileObject instanceof File ? $fileObject->getUid() : '') . '" />';
                $row[] = '
						<tr class="t3-row-header">
							<td colspan="2">' . $GLOBALS['LANG']->getLL('f1.tab1.section.importFile') . '</td>
						</tr>';
                $tempDir = $this->userTempFolder();
                $row[] = '
						<tr class="db_list_normal">
							<td><strong>' . $GLOBALS['LANG']->getLL('f1.tab1.section.importFile.importFile') . '</strong></td>
							<td>' . $GLOBALS['LANG']->getLL('importFile') . '
								<input type="file" name="upload_1" size="30" ' . ($_POST['importNow'] ? 'disabled' : '') . '/><br/>
								<input type="hidden" name="file[upload][1][target]" value="' . htmlspecialchars($tempDir) . '" ' . ($_POST['importNow'] ? 'disabled' : '') . '/>
								<input type="hidden" name="file[upload][1][data]" value="1" />
								' . $GLOBALS['LANG']->getLL('f1.tab1.section.importFile.overwriteFile') . '
								<input type="checkbox" name="tx_rsuserimp[preset][overwriteExistingFiles]" value="1"' . (isset($this->inData['preset']['overwriteExistingFiles']) ? ' checked="checked"' : '') . ' ' . ($_POST['importNow'] ? 'disabled' : '') . '/><br/>
								<div align="right"><input type="submit" value="Upload" ' . ($_POST['importNow'] ? 'disabled' : '') . '/></div>
							</td>
						</tr>';
                if (!empty($fileAbsolutePathAndName) && file_exists($fileAbsolutePathAndName)) {
                    $currentFileInfo = $fileObject->getStorage()->getFileInfo($fileObject);
                    $currentFileMessage = $currentFileInfo['name'];
                } else {
                    $currentFileMessage = $GLOBALS['LANG']->getLL('f1.tab1.section.importFile.emptyImportFile');
                }
                $row[] = '
							<tr class="db_list_normal">
								<td><strong>' . $GLOBALS['LANG']->getLL('f1.tab1.section.importFile.currentImportFile') . '</strong></td>
								<td><div align="left"><strong>' . $currentFileMessage . '</strong></div></td>
							</tr>';
                // now compose TAB menu array for TAB1
                $menuItems[] = array('label' => $GLOBALS['LANG']->getLL('f1.tab1'), 'content' => '
							<table class="typo3-dblist">
								' . implode('
								', $row) . '
							</table>
						', 'description' => $GLOBALS['LANG']->getLL('f1.tab1.description'), 'linkTitle' => '', 'stateIcon' => file_exists($fileAbsolutePathAndName) ? -1 : 2);
                /**** TAB 1 data *****/
                /***** start ********/
                /***** general import ********/
                /**** TAB 2 data *****/
                $row = array();
                $row[] = '
						<tr class="t3-row-header">
							<td colspan="2">' . $GLOBALS['LANG']->getLL('f1.tab2.section.userType') . '</td>
						</tr>';
                // define options for usertype dropdown menu
                $opt = array('FE' => $GLOBALS['LANG']->getLL('f1.tab2.constants.FE'), 'TT' => $GLOBALS['LANG']->getLL('f1.tab2.constants.TT'));
                $row[] = '
							<tr class="db_list_normal">
								<td><strong>' . $GLOBALS['LANG']->getLL('f1.tab2.section.userType.label') . '</strong></td>
								<td>' . $this->renderSelectBox('tx_rsuserimp[settings][importUserType]', isset($this->inData['settings']['importUserType']) ? $this->inData['settings']['importUserType'] : '', $opt, '', "onchange='submit()'") . '</td>
							</tr>';
                $row[] = '
						<tr class="t3-row-header">
							<td colspan="2">' . $GLOBALS['LANG']->getLL('f1.tab2.section.storageFolder') . '</td>
						</tr>';
                // fe_users
                if ($mapper->userType == 'FE') {
                    $preopt = $this->getFrontendUserFolders();
                    $opt = array('' => '');
                    foreach ($preopt as $val) {
                        $opt = $opt + array($val['uid'] => $val['title'] . ' [UID ' . $val['uid'] . ']');
                    }
                } else {
                    if ($mapper->userType == 'TT') {
                        // tt_address
                        $preopt = $this->getSysFolders();
                        $opt = array('' => '');
                        foreach ($preopt as $val) {
                            $opt = $opt + array($val['uid'] => $val['title'] . ' [UID ' . $val['uid'] . ']');
                        }
                    } else {
                        // be_users
                        $preopt = $this->getSysFolders();
                        $opt = array('' => '');
                        foreach ($preopt as $val) {
                            $opt = $opt + array($val['uid'] => $val['title'] . ' [UID ' . $val['uid'] . ']');
                        }
                        $row[] = '
							<tr class="t3-row-header">
								<td colspan="2">' . $GLOBALS['LANG']->getLL('f1.tab2.section.defaultGroup') . '</td>
							</tr>';
                    }
                }
                // end user specific settings
                if (isset($this->inData['settings']['importStorageFolder']) && !in_array($this->inData['settings']['importStorageFolder'], array_keys($opt))) {
                    unset($this->inData['settings']['importStorageFolder']);
                }
                $row[] = '
							<tr class="db_list_normal">
								<td><strong>' . $GLOBALS['LANG']->getLL('f1.tab2.section.storageFolder.label') . '</strong></td>
								<td>' . $this->renderSelectBox('tx_rsuserimp[settings][importStorageFolder]', isset($this->inData['settings']['importStorageFolder']) ? $this->inData['settings']['importStorageFolder'] : '', $opt, 'importStorageFolder') . '</td>
							</tr>';
                if (empty($this->inData) || is_array($this->inData) && is_array($this->inData['settings']) && $this->inData['settings']['importUserType'] === 'FE') {
                    // These rows are only applicable for table fe_users
                    $row[] = '
						<tr class="t3-row-header">
							<td colspan="2">' . $GLOBALS['LANG']->getLL('f1.tab2.section.defaultGroup') . '</td>
						</tr>';
                    $preopt = $this->getFrontendUserGroups();
                    if (!empty($preopt)) {
                        $opt = array();
                        foreach ($preopt as $key => $val) {
                            $opt = $opt + array($val['uid'] => $val['title'] . ' [UID ' . $val['uid'] . ']');
                        }
                    } else {
                        $opt = array('' => $GLOBALS['LANG']->getLL('f1.tab2.section.defaultGroup.emptyGroup'));
                    }
                    $row[] = '
								<tr class="db_list_normal">
									<td><strong>' . $GLOBALS['LANG']->getLL('f1.tab2.section.defaultGroup.label') . '</strong></td>
									<td>' . $this->renderMultipleSelector('tx_rsuserimp[settings][importUserGroup]', $opt, isset($this->inData['settings']['importUserGroup']) ? $this->inData['settings']['importUserGroup'] : '', 1, 'importUserGroup') . '</td>
								</tr>';
                    $row[] = '
						<tr class="t3-row-header">
							<td colspan="2">' . $GLOBALS['LANG']->getLL('f1.tab2.section.usernamePassword') . '</td>
						</tr>';
                    $row[] = '
							<tr class="db_list_normal">
								<td><strong>' . $GLOBALS['LANG']->getLL('f1.tab2.section.usernamePassword.useEMailAsUsername') . '</td>
								<td><input type="checkbox" id="useEMailAsUsername" name="tx_rsuserimp[settings][useEMailAsUsername]" value="1"' . (isset($this->inData['settings']['useEMailAsUsername']) ? ' checked="checked"' : '') . ' ' . ($_POST['importNow'] ? 'disabled' : '') . '/></td>
							</tr>';
                    $row[] = '
							<tr class="db_list_normal">
								<td><strong>' . $GLOBALS['LANG']->getLL('f1.tab2.section.usernamePassword.generatePassword') . '</td>
								<td><input type="checkbox" id="generatePassword" name="tx_rsuserimp[settings][generatePassword]" value="1"' . (isset($this->inData['settings']['generatePassword']) ? ' checked="checked"' : '') . ' ' . ($_POST['importNow'] ? 'disabled' : '') . '/></td>
							</tr>';
                }
                $row[] = '
						<tr class="t3-row-header">
							<td colspan="2">' . $GLOBALS['LANG']->getLL('f1.tab2.section.generalSettings.userupdate') . '</td>
						</tr>';
                $row[] = '
							<tr class="db_list_normal">
								<td><strong>' . $GLOBALS['LANG']->getLL('f1.tab2.section.generalSettings.userupdate.description') . '</td>
								<td><input onChange="toggle();" type="checkbox" id="enableUpdate" name="tx_rsuserimp[settings][enableUpdate]" value="1"' . (isset($this->inData['settings']['enableUpdate']) ? ' checked="checked"' : '') . ' ' . ($_POST['importNow'] ? 'disabled' : '') . '/></td>
							</tr>';
                $opt = array('' => '');
                if ($mapper->userType == 'FE') {
                    if (!empty($this->extensionConfiguration['uniqueIdentifierListFE'])) {
                        $preopt = explode(',', $this->extensionConfiguration['uniqueIdentifierListFE']);
                    } else {
                        $preopt = isset($dbFieldsDefault) ? $dbFieldsDefault : '';
                    }
                }
                if ($mapper->userType == 'TT') {
                    if (!empty($this->extensionConfiguration['uniqueIdentifierListTT'])) {
                        $preopt = explode(',', $this->extensionConfiguration['uniqueIdentifierListTT']);
                    } else {
                        $preopt = isset($dbFieldsDefault) ? $dbFieldsDefault : '';
                    }
                }
                foreach ($preopt as $val) {
                    $opt = $opt + array($val => $val);
                }
                if (isset($this->inData['settings']['uniqueIdentifier']) && !in_array($this->inData['settings']['uniqueIdentifier'], array_keys($opt))) {
                    unset($this->inData['settings']['uniqueIdentifier']);
                }
                $row[] = '
							<tr class="db_list_normal">
								<td><strong>' . $GLOBALS['LANG']->getLL('f1.tab2.section.uniqueIdentifier.label') . '</strong></td>
								<td>' . $this->renderSelectBox('tx_rsuserimp[settings][uniqueIdentifier]', isset($this->inData['settings']['uniqueIdentifier']) ? $this->inData['settings']['uniqueIdentifier'] : '', $opt, 'uniqueIdentifier', '') . '</td>
							</tr>';
                $row[] = '
						<tr class="t3-row-header">
							<td colspan="2">' . $GLOBALS['LANG']->getLL('f1.tab2.section.generalSettings') . '</td>
						</tr>';
                $row[] = '
							<tr class="db_list_normal">
								<td><strong>' . $GLOBALS['LANG']->getLL('f1.tab2.section.generalSettings.firstRowHasFieldnames') . '</strong></td>
								<td><input type="checkbox" name="tx_rsuserimp[settings][firstRowHasFieldnames]" value="1"' . (isset($this->inData['settings']['firstRowHasFieldnames']) ? ' checked="checked"' : '') . ' ' . ($_POST['importNow'] ? 'disabled' : '') . '/></td>
							</tr>';
                $row[] = '
							<tr class="db_list_normal">
								<td><strong>' . $GLOBALS['LANG']->getLL('f1.tab2.section.generalSettings.enableAutoRename') . '</td>
								<td><input type="checkbox" id="enableAutoRename" name="tx_rsuserimp[settings][enableAutoRename]" value="1"' . (isset($this->inData['settings']['enableAutoRename']) ? ' checked="checked"' : '') . ' ' . ($_POST['importNow'] ? 'disabled' : '') . '/></td>
							</tr>';
                $row[] = '
							<tr class="db_list_normal">
								<td><strong>' . $GLOBALS['LANG']->getLL('f1.tab2.section.generalSettings.enableAutoValues') . '</td>
								<td><input type="checkbox" id="enableAutoValues" name="tx_rsuserimp[settings][enableAutoValues]" value="1"' . (isset($this->inData['settings']['enableAutoValues']) ? ' checked="checked"' : '') . ' ' . ($_POST['importNow'] ? 'disabled' : '') . '/></td>
							</tr>';
                // define options for fieldDelimiter dropdown menu
                $opt = array(';' => $GLOBALS['LANG']->getLL('f1.tab2.constants.semicolon'), ',' => $GLOBALS['LANG']->getLL('f1.tab2.constants.comma'), ':' => $GLOBALS['LANG']->getLL('f1.tab2.constants.colon'), 'TAB' => $GLOBALS['LANG']->getLL('f1.tab2.constants.tab'));
                $row[] = '
							<tr class="db_list_normal">
								<td><strong>' . $GLOBALS['LANG']->getLL('f1.tab2.section.generalSettings.fieldDelimiter') . '</strong></td>
								<td>' . $this->renderSelectBox('tx_rsuserimp[settings][fieldDelimiter]', isset($this->inData['settings']['fieldDelimiter']) ? $this->inData['settings']['fieldDelimiter'] : '', $opt) . '</td>
							</tr>';
                // define options for fieldEncaps dropdown menu$opt = array(';',',',':');
                $opt = array('"' => '"', "'" => "'");
                //	was: $opt = array(''=>"",'"'=>'"',"'"=>"'");
                $row[] = '
							<tr class="db_list_normal">
								<td><strong>' . $GLOBALS['LANG']->getLL('f1.tab2.section.generalSettings.fieldEncaps') . '</strong></td>
								<td>' . $this->renderSelectBox('tx_rsuserimp[settings][fieldEncaps]', isset($this->inData['settings']['fieldEncaps']) ? $this->inData['settings']['fieldEncaps'] : '', $opt) . '</td>
							</tr>';
                // Options for input encoding
                $opt = array('iso-8859-1' => $GLOBALS['LANG']->getLL('f1.tab2.constants.iso-8859-1'), 'UTF-8' => $GLOBALS['LANG']->getLL('f1.tab2.constants.utf-8'));
                $row[] = '
							<tr class="db_list_normal">
								<td><strong>' . $GLOBALS['LANG']->getLL('f1.tab2.section.generalSettings.inputEncoding') . '</strong></td>
								<td>' . $this->renderSelectBox('tx_rsuserimp[settings][inputEncoding]', isset($this->inData['settings']['inputEncoding']) ? $this->inData['settings']['inputEncoding'] : '', $opt) . '</td>
							</tr>';
                $row[] = '
							<tr class="db_list_normal">
								<td><strong>' . $GLOBALS['LANG']->getLL('f1.tab2.section.generalSettings.previewNum') . '</strong></td>
								<td><input type="text" name="tx_rsuserimp[settings][maxPreview]" value="' . htmlspecialchars(isset($this->inData['settings']['maxPreview']) && $this->inData['settings']['maxPreview'] >= 0 ? $this->inData['settings']['maxPreview'] : '3') . '" size="2" maxlength="2" ' . ($_POST['importNow'] ? 'disabled' : '') . '></td>
							</tr>';
                $row[] = '
						<tr class="t3-row-header">
							<td colspan="2">' . $GLOBALS['LANG']->getLL('f1.tab2.section.generalSettings.additionalMandatoryFields') . '</td>
						</tr>';
                $row[] = '
							<tr class="db_list_normal">
								<td><strong>' . $GLOBALS['LANG']->getLL('f1.tab2.section.generalSettings.additionalMandatoryFields.description') . '</strong></td>
								<td>' . $this->renderMultipleSelector('tx_rsuserimp[settings][extraFields]', $dbFieldsDefault, isset($this->inData['settings']['extraFields']) ? $this->inData['settings']['extraFields'] : '') . '</td>
							</tr>';
                $row[] = '
							<tr class="db_list_normal">
								<td><strong>' . $GLOBALS['LANG']->getLL('f1.tab2.section.generalSettings.update') . '</strong></td>
								<td><div align="right"><input  onclick="return checkForm()" type="submit" name="tx_rsuserimp[settings][OK]" value="' . $GLOBALS['LANG']->getLL('f1.tab2.section.generalSettings.update.update', 1) . '" ' . ($_POST['importNow'] ? 'disabled' : '') . '/></div></td>
							</tr>';
                $this->makeSaveForm($this->inData, $row);
                //call by reference, alters the array(row) !!!
                //now, compose TAB menu array for TAB2
                $menuItems[] = array('label' => $GLOBALS['LANG']->getLL('f1.tab2'), 'content' => file_exists($fileAbsolutePathAndName) ? '
							<table class="typo3-dblist import-settings">
								' . implode('
								', $row) . '
							</table>
						' : '', 'description' => $GLOBALS['LANG']->getLL('f1.tab2.description'), 'linkTitle' => '', 'toggle' => 0, 'stateIcon' => isset($this->inData['settings']['OK']) && file_exists($fileAbsolutePathAndName) ? -1 : 0);
                /**** TAB 2 data *****/
                /***** start ********/
                /***** field mapping ********/
                /**** TAB 3 data *****/
                $row = array();
                if (isset($this->inData['settings']['OK'])) {
                    // playing around with the import object
                    $mapper->file = $fileAbsolutePathAndName;
                    $mapper->userType = $this->inData['settings']['importUserType'];
                    $mapper->previewNum = $this->inData['settings']['maxPreview'];
                    $mapper->CSVhasTitle = $this->inData['settings']['firstRowHasFieldnames'];
                    $mapper->fieldDelimiter = $this->inData['settings']['fieldDelimiter'] === 'TAB' ? chr(9) : $this->inData['settings']['fieldDelimiter'];
                    $mapper->fieldEncaps = $this->inData['settings']['fieldEncaps'];
                    $mapper->inputEncoding = $this->inData['settings']['inputEncoding'];
                    //(isset($this->inData['settings']['enableUpdate']) && !empty($this->inData['settings']['uniqueIdentifier'])) ? $mapper->uniqueUserIdentifier = $this->inData['settings']['uniqueIdentifier'] : '';
                    $mapper->enableUpdate = isset($this->inData['settings']['enableUpdate']) && !empty($this->inData['settings']['uniqueIdentifier']) ? TRUE : FALSE;
                    $mapper->defaultUserData['pid'] = $this->inData['settings']['importStorageFolder'];
                    $mapper->defaultUserData['usergroup'] = isset($this->inData['settings']['importUserGroup']) ? implode(',', $this->inData['settings']['importUserGroup']) : '';
                    $mapper->enableAutoRename = $this->inData['settings']['enableAutoRename'];
                    $mapper->enableAutoValues = $this->inData['settings']['enableAutoValues'];
                    $mapper->createDropFile = $createDropFile;
                    $mapper->additionalMandatoryFields = $additionalMandatoryFields;
                    $mapper->inData = $this->inData;
                    $mapper->useRecycler = $useRecycler;
                    $mapper->init();
                    if (isset($this->inData['settings']['enableUpdate']) && !empty($this->inData['settings']['uniqueIdentifier'])) {
                        $mapper->mandatoryFields = array_merge($mapper->mandatoryFields, array($this->inData['settings']['uniqueIdentifier']));
                        $mapper->uniqueUserIdentifier = $this->inData['settings']['uniqueIdentifier'];
                    }
                    $row[] = '
								<input type=hidden name="tx_rsuserimp[settings][OK]" value="Update">';
                    $row[] = '
								<tr class="db_list_normal">' . $mapper->createMappingForm() . '</tr>';
                }
                $menuItems[] = array('label' => $GLOBALS['LANG']->getLL('f1.tab3'), 'content' => (isset($this->inData['settings']['OK']) || GeneralUtility::_GP('map')) && file_exists($fileAbsolutePathAndName) ? '
							<table class="typo3-dblist">
								' . implode('
								', $row) . '
							</table>
						' : '', 'description' => $GLOBALS['LANG']->getLL('f1.tab3.description'), 'linkTitle' => '', 'toggle' => 0, 'stateIcon' => !empty($mapper->importOK) || isset($this->inData['fieldmap']['OK']) ? -1 : 0);
                /**** TAB 3 data *****/
                /***** start ********/
                /***** importOK ********/
                /**** TAB 4 data *****/
                $row = array();
                if (!empty($mapper->importOK)) {
                    $row[] = '
						<tr class="t3-row-header">
							<td colspan="2">' . $GLOBALS['LANG']->getLL('f1.tab4.section.import') . '</td>
						</tr>';
                    $row[] = '
							<tr class="db_list_normal"><td>' . $mapper->createImportForm() . '</td></tr>';
                }
                if ($mapper->importNow == 'TRUE') {
                    $msg = $mapper->importUsers();
                }
                $menuItems[] = array('label' => $GLOBALS['LANG']->getLL('f1.tab4'), 'content' => !empty($mapper->importOK) ? '
						<table class="typo3-dblist">
							' . implode('
							', $row) . '
						</table>
					' : '', 'description' => $GLOBALS['LANG']->getLL('f1.tab4.description'), 'linkTitle' => '', 'toggle' => 0, 'stateIcon' => $mapper->importNow == 'TRUE' ? -1 : 0);
                /***** TAB 4 data ********/
                /***** start ********/
                /***** import messages ********/
                /**** TAB 5 data *****/
                $row = array();
                $row[] = '
					<tr class="t3-row-header">
						<td colspan="2">' . $GLOBALS['LANG']->getLL('f1.tab5') . '</td>
					</tr>';
                $row[] = '
					<tr class="db_list_normal">
						<td colspan=2>' . $msg . '</td>
					</tr>';
                $menuItems[] = array('label' => $GLOBALS['LANG']->getLL('f1.tab5'), 'content' => !empty($msg) ? '<table class="typo3-dblist">
						' . implode('
						', $row) . '
					</table>' : '', 'linkTitle' => '', 'toggle' => 0, 'stateIcon' => $mapper->importNow == 'TRUE' ? 1 : 0);
                /***** TAB 5 data ********/
                // finally, print out the whole tabmenu
                //getDynTabMenu($menuItems,$identString,$toggle=0,$foldout=FALSE,$newRowCharLimit=50,$noWrap=1,$fullWidth=FALSE,$defaultTabIndex=1)
                $content = $this->doc->getDynTabMenu($menuItems, 'tx_rsuserimp_import', 0, '', 40);
                $this->content .= $content;
                break;
        }
        return $this->content;
    }
 /**
  * Render a single row of information about a indexing entry.
  *
  * @param 	array		Row from query (combined phash table with sections etc).
  * @param 	boolean		Set if grouped to previous result; the icon of the element is not shown again.
  * @param 	array		Array of index_grlist records.
  * @return 	array		Array of table rows.
  * @see indexed_info()
  * @todo Define visibility
  */
 public function printPhashRow($row, $grouping = 0, $extraGrListRows)
 {
     $lines = array();
     // Title cell attributes will highlight TYPO3 pages with a slightly darker color (bgColor4) than attached medias. Also IF there are more than one section record for a phash row it will be red as a warning that something is wrong!
     $titleCellAttribs = $row['count_val'] != 1 ? ' bgcolor="red"' : ($row['item_type'] === '0' ? ' class="bgColor4"' : '');
     if ($row['item_type']) {
         $arr = unserialize($row['cHashParams']);
         $page = $arr['key'] ? ' [' . $arr['key'] . ']' : '';
     } else {
         $page = '';
     }
     $elTitle = $this->linkDetails($row['item_title'] ? htmlspecialchars(GeneralUtility::fixed_lgd_cs($row['item_title'], 20) . $page) : '<em>[No Title]</em>', $row['phash']);
     $cmdLinks = $this->printRemoveIndexed($row['phash'], 'Clear phash-row') . $this->printReindex($row, 'Re-index element');
     switch ($this->pObj->MOD_SETTINGS['type']) {
         case 1:
             // Technical details:
             // Display icon:
             if (!$grouping) {
                 $lines[] = '<td>' . $this->makeItemTypeIcon($row['item_type'], $row['data_filename'] ? $row['data_filename'] : $row['item_title']) . '</td>';
             } else {
                 $lines[] = '<td>&nbsp;</td>';
             }
             // Title displayed:
             $lines[] = '<td' . $titleCellAttribs . '>' . $elTitle . '</td>';
             // Remove-indexing-link:
             $lines[] = '<td>' . $cmdLinks . '</td>';
             // Various data:
             $lines[] = '<td>' . $row['phash'] . '</td>';
             $lines[] = '<td>' . $row['contentHash'] . '</td>';
             if ($row['item_type'] === '0') {
                 $lines[] = '<td>' . ($row['data_page_id'] ? $row['data_page_id'] : '&nbsp;') . '</td>';
                 $lines[] = '<td>' . ($row['data_page_type'] ? $row['data_page_type'] : '&nbsp;') . '</td>';
                 $lines[] = '<td>' . ($row['sys_language_uid'] ? $row['sys_language_uid'] : '&nbsp;') . '</td>';
                 $lines[] = '<td>' . ($row['data_page_mp'] ? $row['data_page_mp'] : '&nbsp;') . '</td>';
             } else {
                 $lines[] = '<td colspan="4">' . htmlspecialchars($row['data_filename']) . '</td>';
             }
             $lines[] = '<td>' . $row['gr_list'] . $this->printExtraGrListRows($extraGrListRows) . '</td>';
             $lines[] = '<td>' . $this->printRootlineInfo($row) . '</td>';
             $lines[] = '<td>' . ($row['page_id'] ? $row['page_id'] : '&nbsp;') . '</td>';
             $lines[] = '<td>' . ($row['phash_t3'] != $row['phash'] ? $row['phash_t3'] : '&nbsp;') . '</td>';
             $lines[] = '<td>' . ($row['freeIndexUid'] ? $row['freeIndexUid'] . ($row['freeIndexSetId'] ? '/' . $row['freeIndexSetId'] : '') : '&nbsp;') . '</td>';
             $lines[] = '<td>' . ($row['recordUid'] ? $row['recordUid'] : '&nbsp;') . '</td>';
             // cHash parameters:
             $arr = unserialize($row['cHashParams']);
             if (!is_array($arr)) {
                 $arr = array('cHash' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xlf:LGL.error', TRUE));
             }
             $theCHash = $arr['cHash'];
             unset($arr['cHash']);
             if ($row['item_type']) {
                 // pdf...
                 $lines[] = '<td>' . ($arr['key'] ? 'Page ' . $arr['key'] : '') . '&nbsp;</td>';
             } elseif ($row['item_type'] == 0) {
                 $lines[] = '<td>' . htmlspecialchars(GeneralUtility::implodeArrayForUrl('', $arr)) . '&nbsp;</td>';
             } else {
                 $lines[] = '<td class="bgColor">&nbsp;</td>';
             }
             $lines[] = '<td>' . $theCHash . '</td>';
             break;
         case 2:
             // Words and content:
             // Display icon:
             if (!$grouping) {
                 $lines[] = '<td>' . $this->makeItemTypeIcon($row['item_type'], $row['data_filename'] ? $row['data_filename'] : $row['item_title']) . '</td>';
             } else {
                 $lines[] = '<td>&nbsp;</td>';
             }
             // Title displayed:
             $lines[] = '<td' . $titleCellAttribs . '>' . $elTitle . '</td>';
             // Remove-indexing-link:
             $lines[] = '<td>' . $cmdLinks . '</td>';
             // Query:
             $ftrow = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'index_fulltext', 'phash = ' . (int) $row['phash']);
             $lines[] = '<td style="white-space: normal;">' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($ftrow['fulltextdata'], 3000)) . '<hr/><em>Size: ' . strlen($ftrow['fulltextdata']) . '</em>' . '</td>';
             // Query:
             $ftrows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('index_words.baseword, index_rel.*', 'index_rel, index_words', 'index_rel.phash = ' . (int) $row['phash'] . ' AND index_words.wid = index_rel.wid', '', '', '', 'baseword');
             $wordList = '';
             if (is_array($ftrows)) {
                 $indexed_words = array_keys($ftrows);
                 sort($indexed_words);
                 $wordList = htmlspecialchars(implode(' ', $indexed_words));
                 $wordList .= '<hr/><em>Count: ' . count($indexed_words) . '</em>';
             }
             $lines[] = '<td style="white-space: normal;">' . $wordList . '</td>';
             break;
         default:
             // Overview
             // Display icon:
             if (!$grouping) {
                 $lines[] = '<td>' . $this->makeItemTypeIcon($row['item_type'], $row['data_filename'] ? $row['data_filename'] : $row['item_title']) . '</td>';
             } else {
                 $lines[] = '<td>&nbsp;</td>';
             }
             // Title displayed:
             $lines[] = '<td' . $titleCellAttribs . '>' . $elTitle . '</td>';
             // Remove-indexing-link:
             $lines[] = '<td>' . $cmdLinks . '</td>';
             $lines[] = '<td style="white-space: normal;">' . htmlspecialchars($row['item_description']) . '...</td>';
             $lines[] = '<td>' . GeneralUtility::formatSize($row['item_size']) . '</td>';
             $lines[] = '<td>' . BackendUtility::dateTimeAge($row['tstamp']) . '</td>';
     }
     return $lines;
 }
    /**
     * Shows the log of indexed URLs
     *
     * @return	string		HTML output
     */
    function drawLog()
    {
        global $BACK_PATH;
        $output = '';
        // Init:
        $this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
        $this->crawlerObj->setAccessMode('gui');
        $this->crawlerObj->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime());
        $this->CSVExport = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_csv');
        // Read URL:
        if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')) {
            $this->crawlerObj->readUrl(intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')), TRUE);
        }
        // Look for set ID sent - if it is, we will display contents of that set:
        $showSetId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
        // Show details:
        if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) {
            // Get entry record:
            list($q_entry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tx_crawler_queue', 'qid=' . intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')));
            // Explode values:
            $resStatus = $this->getResStatus($q_entry);
            $q_entry['parameters'] = unserialize($q_entry['parameters']);
            $q_entry['result_data'] = unserialize($q_entry['result_data']);
            if (is_array($q_entry['result_data'])) {
                $q_entry['result_data']['content'] = unserialize($q_entry['result_data']['content']);
            }
            if (!$this->pObj->MOD_SETTINGS['log_resultLog']) {
                unset($q_entry['result_data']['content']['log']);
            }
            // Print rudimentary details:
            $output .= '
				<br /><br />
				<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.back') . '" name="_back" />
				<input type="hidden" value="' . $this->pObj->id . '" name="id" />
				<input type="hidden" value="' . $showSetId . '" name="setID" />
				<br />
				Current server time: ' . date('H:i:s', time()) . '<br />' . 'Status: ' . $resStatus . '<br />' . \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($q_entry);
        } else {
            // Show list:
            // If either id or set id, show list:
            if ($this->pObj->id || $showSetId) {
                if ($this->pObj->id) {
                    // Drawing tree:
                    $tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\View\\PageTreeView');
                    $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
                    $tree->init('AND ' . $perms_clause);
                    // Set root row:
                    $HTML = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $this->pObj->pageinfo);
                    $HTML = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $this->pObj->pageinfo);
                    $tree->tree[] = array('row' => $this->pObj->pageinfo, 'HTML' => $HTML);
                    // Get branch beneath:
                    if ($this->pObj->MOD_SETTINGS['depth']) {
                        $tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], '');
                    }
                    // Traverse page tree:
                    $code = '';
                    $count = 0;
                    foreach ($tree->tree as $data) {
                        $code .= $this->drawLog_addRows($data['row'], $data['HTML'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $data['row'], TRUE), intval($this->pObj->MOD_SETTINGS['itemsPerPage']));
                        if (++$count == 1000) {
                            break;
                        }
                    }
                } else {
                    $code = '';
                    $code .= $this->drawLog_addRows($showSetId, 'Set ID: ' . $showSetId);
                }
                if ($code) {
                    $output .= '
						<br /><br />
						<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.reloadlist') . '" name="_reload" />
						<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.downloadcsv') . '" name="_csv" />
						<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.flushvisiblequeue') . '" name="_flush" onclick="return confirm(\'' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.confirmyouresure') . '\');" />
						<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.flushfullqueue') . '" name="_flush_all" onclick="return confirm(\'' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.confirmyouresure') . '\');" />
						<input type="hidden" value="' . $this->pObj->id . '" name="id" />
						<input type="hidden" value="' . $showSetId . '" name="setID" />
						<br />
						' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime') . ': ' . date('H:i:s', time()) . '
						<br /><br />


						<table class="lrPadding c-list crawlerlog">' . $this->drawLog_printTableHeader() . $code . '</table>';
                }
            } else {
                // Otherwise show available sets:
                $setList = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('set_id, count(*) as count_value, scheduled', 'tx_crawler_queue', '', 'set_id, scheduled', 'scheduled DESC');
                $code = '
					<tr class="bgColor5 tableheader">
						<td>' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.setid') . ':</td>
						<td>' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count') . 't:</td>
						<td>' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time') . ':</td>
					</tr>
				';
                $cc = 0;
                foreach ($setList as $set) {
                    $code .= '
						<tr class="bgColor' . ($cc % 2 ? '-20' : '-10') . '">
							<td><a href="' . htmlspecialchars('index.php?setID=' . $set['set_id']) . '">' . $set['set_id'] . '</a></td>
							<td>' . $set['count_value'] . '</td>
							<td>' . \TYPO3\CMS\Backend\Utility\BackendUtility::dateTimeAge($set['scheduled']) . '</td>
						</tr>
					';
                    $cc++;
                }
                $output .= '
					<br /><br />
					<table class="lrPadding c-list">' . $code . '</table>';
            }
        }
        if ($this->CSVExport) {
            $this->outputCsvFile();
        }
        // Return output
        return $output;
    }
示例#8
0
 /**
  * Action to edit records
  *
  * @param array $record sys_action record
  * @return string list of records
  */
 protected function viewEditRecord($record)
 {
     $content = '';
     $actionList = array();
     $dbAnalysis = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\RelationHandler');
     $dbAnalysis->setFetchAllFields(TRUE);
     $dbAnalysis->start($record['t4_recordsToEdit'], '*');
     $dbAnalysis->getFromDB();
     // collect the records
     foreach ($dbAnalysis->itemArray as $el) {
         $path = BackendUtility::getRecordPath($el['id'], $this->taskObject->perms_clause, $GLOBALS['BE_USER']->uc['titleLen']);
         $record = BackendUtility::getRecord($el['table'], $dbAnalysis->results[$el['table']][$el['id']]);
         $title = BackendUtility::getRecordTitle($el['table'], $dbAnalysis->results[$el['table']][$el['id']]);
         $description = $GLOBALS['LANG']->sL($GLOBALS['TCA'][$el['table']]['ctrl']['title'], TRUE);
         // @todo: which information could be needful
         if (isset($record['crdate'])) {
             $description .= ' - ' . BackendUtility::dateTimeAge($record['crdate']);
         }
         $actionList[$el['id']] = array('title' => $title, 'description' => BackendUtility::getRecordTitle($el['table'], $dbAnalysis->results[$el['table']][$el['id']]), 'descriptionHtml' => $description, 'link' => $GLOBALS['BACK_PATH'] . 'alt_doc.php?returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')) . '&edit[' . $el['table'] . '][' . $el['id'] . ']=edit', 'icon' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($el['table'], $dbAnalysis->results[$el['table']][$el['id']], array('title' => htmlspecialchars($path))));
     }
     // Render the record list
     $content .= $this->taskObject->renderListMenu($actionList);
     return $content;
 }
 /**
  * @test
  */
 public function dateTimeAgeReturnsCorrectValues()
 {
     /** @var ObjectProphecy|LanguageService $languageServiceProphecy */
     $languageServiceProphecy = $this->prophesize(LanguageService::class);
     $languageServiceProphecy->sL(Argument::cetera())->willReturn(' min| hrs| days| yrs| min| hour| day| year');
     $GLOBALS['LANG'] = $languageServiceProphecy->reveal();
     $GLOBALS['EXEC_TIME'] = mktime(0, 0, 0, 3, 23, 2016);
     $this->assertSame('24-03-16 00:00 (-1 day)', BackendUtility::dateTimeAge($GLOBALS['EXEC_TIME'] + 86400));
     $this->assertSame('24-03-16 (-1 day)', BackendUtility::dateTimeAge($GLOBALS['EXEC_TIME'] + 86400, 1, 'date'));
 }
示例#10
0
 /**
  * Get age of last checked date, based on BackendUtility
  *
  * @return string
  */
 public function getAgeLastChecked()
 {
     if ($this->lastChecked instanceof \DateTime) {
         return BackendUtility::dateTimeAge($this->lastChecked->getTimestamp());
     }
     return null;
 }