Exemplo n.º 1
0
 public function getAllowedActions($config)
 {
     $pid = $config['row']['pid'];
     $tsConfig = t3lib_befunc::getPagesTSconfig($pid);
     $flexConfig =& $tsConfig['options.']['cz_simple_cal_pi1.']['flexform.'];
     if (empty($flexConfig) || !isset($flexConfig['allowedActions.'])) {
         return;
     }
     $allowedActions = array();
     if (isset($flexConfig['allowedActions'])) {
         $enabled = array();
         foreach (t3lib_div::trimExplode(',', $flexConfig['allowedActions'], true) as $i) {
             $enabled[$i . '.'] = '';
         }
         $allowedActions = array_intersect_key($flexConfig['allowedActions.'], $enabled);
     } else {
         $allowedActions = $flexConfig['allowedActions.'];
     }
     foreach ($allowedActions as $name => $action) {
         $name = rtrim($name, '.');
         $label = $GLOBALS['LANG']->sL($action['label']);
         if (empty($label)) {
             $label = $name;
         }
         $config['items'][$name] = array($label, $name);
     }
 }
 /**
  * Test additional query parts for additional fields
  * @test
  */
 public function getTagTest()
 {
     $fields = 'uid, title, tag';
     $table = 'tx_kesearch_filteroptions';
     $where = '1=1 ';
     $where .= t3lib_befunc::BEenableFields($table, 0);
     $where .= t3lib_befunc::deleteClause($table, 0);
     $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow($fields, $table, $where);
     if (is_array($row) && count($row)) {
         $return = $this->indexer->getTag($row['uid'], false);
         $this->assertEquals($row['tag'], $return);
         $return = $this->indexer->getTag($row['uid'], true);
         $this->assertEquals($row['title'], $return);
     }
 }
 /**
  * This function was called from indexer object and saves content to index table
  *
  * @return string content which will be displayed in backend
  */
 public function startIndexing()
 {
     $content = '';
     // get all the records to index
     // don't index hidden, deleted or not approved comments
     $fields = '*';
     $table = 'tx_comments_comments';
     $indexPids = $this->getPidList($this->indexerConfig['startingpoints_recursive'], $this->indexerConfig['sysfolder'], $table);
     if ($this->indexerConfig['index_use_page_tags']) {
         // add the tags of each page to the global page array
         $this->pageRecords = $this->getPageRecords($indexPids);
         $this->addTagsToRecords($indexPids);
     }
     $where = 'pid IN (' . implode(',', $indexPids) . ') ';
     $where .= ' AND approved=1';
     if (TYPO3_VERSION_INTEGER >= 7000000) {
         $where .= ' AND external_prefix IN ("' . implode('","', TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->indexerConfig['commenttypes'])) . '")';
         $where .= TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table);
         $where .= TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table);
     } else {
         $where .= ' AND external_prefix IN ("' . implode('","', t3lib_div::trimExplode(',', $this->indexerConfig['commenttypes'])) . '")';
         $where .= t3lib_befunc::BEenableFields($table);
         $where .= t3lib_befunc::deleteClause($table);
     }
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $where);
     if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
         $count = 0;
         while ($comment = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             // compile the information which should go into the index
             $title = $this->compileCommentTitle($comment);
             $abstract = '';
             $content = trim(strip_tags($comment['content']));
             // use page ID stored in field "external_ref" as target page
             // makes sense for comments to page
             // Should be adjusted for other comments?
             if ($comment['external_prefix'] == 'pages') {
                 $external_ref_exploded = explode('_', $comment['external_ref']);
                 $targetPage = $external_ref_exploded[1];
             } else {
                 // TODO: Make the target page configurable, eg. for tt_news comments
                 //$targetPage = $indexerConfig['targetpid'];
                 $targetPage = 0;
             }
             // create tags
             if ($this->indexerConfig['index_use_page_tags']) {
                 $tags = $this->pageRecords[intval($comment['pid'])]['tags'];
             } else {
                 $tags = '';
             }
             // fill additional fields
             $additionalFields = array('orig_uid' => $comment['uid'], 'orig_pid' => $comment['pid'], 'sortdate' => $comment['crdate']);
             // make it possible to modify the indexerConfig via hook
             $indexerConfig = $this->indexerConfig;
             // hook for custom modifications of the indexed data, e. g. the tags
             if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyCommentsIndexEntry'])) {
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyCommentsIndexEntry'] as $_classRef) {
                     if (TYPO3_VERSION_INTEGER >= 7000000) {
                         $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
                     } else {
                         $_procObj =& t3lib_div::getUserObj($_classRef);
                     }
                     $_procObj->modifyCommentsIndexEntry($title, $abstract, $content, $params, $tags, $comment, $additionalFields, $indexerConfig);
                 }
             }
             // ... and store them
             $this->pObj->storeInIndex($indexerConfig['storagepid'], $title, 'comments', $targetPage, $content, $tags, $params, $abstract, -1, 0, 0, '', false, $additionalFields);
             $count++;
         }
         $content = '<p><b>Indexer "' . $this->indexerConfig['title'] . '":</b><br />' . "\n" . $count . ' Comments have been indexed.</p>' . "\n";
         $content .= $this->showErrors();
         $content .= $this->showTime();
     }
     return $content;
 }
    /**
     * Renders header table row with media type and previewer
     *
     * @param	array		$PA An array with additional configuration options.
     * @param	object		$fobj TCEForms object reference
     * @return	string		The HTML code for the TCEform field
     */
    function tx_dam_mediaType($PA, &$fobj)
    {
        global $TCA;
        $this->tceforms =& $PA['pObj'];
        $config = $PA['fieldConf']['config'];
        $row = $PA['row'];
        $table = $PA['table'];
        // TODO overlay all fields to be safe
        foreach (array('media_type', 'file_name', 'file_path', 'file_size', 'hpixels', 'vpixels') as $field) {
            $row[$field] = $this->tceforms->getLanguageOverlayRawValue($table, $row, $field, $TCA[$table]['columns'][$field]);
        }
        $itemMediaInfo = '';
        $itemMediaInfo .= '<div class="tableRow">' . $this->tceforms->sL('LLL:EXT:lang/locallang_general.xml:LGL.title', true) . '<br />' . '<strong>' . htmlspecialchars($row['title']) . '</strong></div>';
        $itemMediaInfo .= '<div class="tableRow">' . $this->tceforms->sL('LLL:EXT:dam/locallang_db.xml:tx_dam_item.file_name', true) . '<br />' . '<strong>' . htmlspecialchars($row['file_name']) . '</strong></div>';
        $itemMediaInfo .= '<div class="tableRow">' . $this->tceforms->sL('LLL:EXT:dam/locallang_db.xml:tx_dam_item.file_path', true) . '<br />' . '<strong>' . htmlspecialchars($row['file_path']) . '</strong></div>';
        if ($row['media_type'] == TXDAM_mtype_image) {
            $out = '';
            $out .= $row['hpixels'] ? $row['hpixels'] . 'x' . $row['vpixels'] . ' px, ' : '';
            $out .= t3lib_div::formatSize($row['file_size']);
            $out .= $row['color_space'] ? ', ' . $this->tceforms->sL(t3lib_befunc::getLabelFromItemlist($PA['table'], 'color_space', $row['color_space']), true) : '';
            $itemMediaInfo .= '<div class="tableRow"><nobr>' . htmlspecialchars($out) . '</nobr></div>';
        }
        $itemMediaTypeIcon = tx_dam_guiFunc::getMediaTypeIconBox($row);
        $itemMediaInfoTable = '
			<table border="0" cellpadding="0" cellspacing="0">
				<tr>
					<td valign="top">' . $itemMediaTypeIcon . '</td>
					<td valign="top" align="left" style="padding-left:25px;">' . $itemMediaInfo . '
					</td>
				</tr>
			</table>';
        $fieldTemplate = '
			<tr>
				<td colspan="2"><img src="clear.gif" width="1" height="5" alt="" /></td>
			</tr>
			<tr>
				<td nowrap="nowrap"><img name="req_###FIELD_TABLE###_###FIELD_ID###_###FIELD_FIELD###" src="clear.gif" width="10" height="10" alt="" /><img name="cm_###FIELD_TABLE###_###FIELD_ID###_###FIELD_FIELD###" src="clear.gif" width="7" height="10" alt="" /></td>
				<td valign="top">###FIELD_ITEM######FIELD_PAL_LINK_ICON###</td>
			</tr>
			<tr>
				<td colspan="2"><img src="clear.gif" width="1" height="15" alt="" /></td>
			</tr>
			';
        $itemMediaInfoTable = $this->tceforms->intoTemplate(array('NAME' => '', 'ID' => $row['uid'], 'FIELD' => $PA['field'], 'TABLE' => $PA['table'], 'ITEM' => $itemMediaInfoTable, 'HELP_ICON' => ''), $fieldTemplate);
        //
        // previewer
        //
        $itemPreviewer = '';
        $headerCode = '';
        $previewer = NULL;
        if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['dam']['previewerClasses'])) {
            foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['dam']['previewerClasses'] as $idName => $classRessource) {
                if (is_object($previewer = t3lib_div::getUserObj($classRessource))) {
                    if ($previewer->isValid($row, '200', 'topright')) {
                        $outArr = $previewer->render($row, '200', 'topright');
                        $itemPreviewer = $outArr['htmlCode'];
                        $headerCode = $outArr['headerCode'];
                        break;
                    }
                }
            }
            unset($previewer);
            $previewer = NULL;
        }
        // todo: header code should go into header - really - but how
        //
        // all together now
        //
        $out = '
			<tr>
				<td colspan="2">
					<table border="0" cellpadding="0" cellspacing="0" width="100%">
						<tr>
							<td valign="top">
								<table border="0" cellpadding="0" cellspacing="0">' . $itemMediaInfoTable . '
								</table>
							</td>
							<td width="1%" valign="top" align="center" style="padding: 0px 10px 0px 10px">' . $headerCode . $itemPreviewer . '</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td colspan="2"><img src="clear.gif" width="1" height="5" alt="" /></td>
			</tr>';
        return $out;
    }
 /**
  * Adds tags from the ext:news table "tags" as ke_search tags to the index entry
  * 
  * @author Christian Bülter <*****@*****.**>
  * @since 26.06.13 14:25
  * @param string $tags
  * @param array $newsRecord
  * @return string comma-separated list of tags
  */
 private function addTagsFromNewsTags($tags, $newsRecord)
 {
     if (TYPO3_VERSION_INTEGER >= 7000000) {
         $addWhere = \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tx_news_domain_model_tag') . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tx_news_domain_model_tag');
     } else {
         $addWhere = t3lib_befunc::BEenableFields('tx_news_domain_model_tag') . t3lib_befunc::deleteClause('tx_news_domain_model_tag');
     }
     $resTag = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query('tx_news_domain_model_tag.title', 'tx_news_domain_model_news', 'tx_news_domain_model_news_tag_mm', 'tx_news_domain_model_tag', ' AND tx_news_domain_model_news.uid = ' . $newsRecord['uid'] . $addWhere);
     while ($newsTag = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resTag)) {
         tx_kesearch_helper::makeTags($tags, array($newsTag['title']));
     }
     return $tags;
 }
Exemplo n.º 6
0
 /**
  * Returns the page TypoScript configuration.
  *
  * @return array The pageTS
  */
 protected function getPageTS()
 {
     if ($this->pageTS === null) {
         $id = $this->page;
         if ($id <= 0) {
             return array();
         }
         $rootline = array();
         foreach ($this->localRepository->getRootline($id) as $uid => $page) {
             array_unshift($rootline, $page);
         }
         $pageTS = t3lib_befunc::getPagesTSconfig($id, $rootline);
         $this->pageTS = $this->convertTypoScriptArrayToPlainArray($pageTS['tx_contentstage.']);
     }
     return $this->pageTS;
 }
Exemplo n.º 7
0
    /**
     * Make selector box for creating new translation for a record or switching to edit the record in an existing language.
     * Displays only languages which are available for the current page.
     *
     * @param	string		Table name
     * @param	integer		uid for which to create a new language
     * @param	integer		pid of the record
     * @return	string		<select> HTML element (if there were items for the box anyways...)
     */
    function languageSwitch($table, $uid, $pid = NULL)
    {
        global $TCA;
        $content = '';
        $languageField = $TCA[$table]['ctrl']['languageField'];
        $transOrigPointerField = $TCA[$table]['ctrl']['transOrigPointerField'];
        // table editable and activated for languages?
        if ($GLOBALS['BE_USER']->check('tables_modify', $table) && $languageField && $transOrigPointerField && !$TCA[$table]['ctrl']['transOrigPointerTable']) {
            if (is_null($pid)) {
                $row = t3lib_befunc::getRecord($table, $uid, 'pid');
                $pid = $row['pid'];
            }
            // get all avalibale languages for the page
            $langRows = $this->getLanguages($pid);
            // page available in other languages than default language?
            if (is_array($langRows) && count($langRows) > 1) {
                $rowsByLang = array();
                $fetchFields = 'uid,' . $languageField . ',' . $transOrigPointerField;
                // get record in current language
                $rowCurrent = t3lib_befunc::getLiveVersionOfRecord($table, $uid, $fetchFields);
                if (!is_array($rowCurrent)) {
                    $rowCurrent = t3lib_befunc::getRecord($table, $uid, $fetchFields);
                }
                $currentLanguage = $rowCurrent[$languageField];
                if ($currentLanguage > -1) {
                    // Disabled for records with [all] language!
                    // get record in default language if needed
                    if ($currentLanguage) {
                        $rowsByLang[0] = t3lib_befunc::getLiveVersionOfRecord($table, $rowCurrent[$transOrigPointerField], $fetchFields);
                        if (!is_array($rowsByLang[0])) {
                            $rowsByLang[0] = t3lib_befunc::getRecord($table, $rowCurrent[$transOrigPointerField], $fetchFields);
                        }
                    } else {
                        $rowsByLang[0] = $rowCurrent;
                    }
                    // get record in other languages to see what's already available
                    $translations = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($fetchFields, $table, 'pid=' . intval($pid) . ' AND ' . $languageField . '>0' . ' AND ' . $transOrigPointerField . '=' . intval($rowsByLang[0]['uid']) . t3lib_BEfunc::deleteClause($table) . t3lib_BEfunc::versioningPlaceholderClause($table));
                    foreach ($translations as $row) {
                        $rowsByLang[$row[$languageField]] = $row;
                    }
                    $langSelItems = array();
                    foreach ($langRows as $lang) {
                        if ($GLOBALS['BE_USER']->checkLanguageAccess($lang['uid'])) {
                            $newTranslation = isset($rowsByLang[$lang['uid']]) ? '' : ' [' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.new', 1) . ']';
                            // create url for creating a localized record
                            if ($newTranslation) {
                                $href = $this->doc->issueCommand('&cmd[' . $table . '][' . $rowsByLang[0]['uid'] . '][localize]=' . $lang['uid'], $this->backPath . 'alt_doc.php?justLocalized=' . rawurlencode($table . ':' . $rowsByLang[0]['uid'] . ':' . $lang['uid']) . '&returnUrl=' . rawurlencode($this->retUrl) . t3lib_BEfunc::getUrlToken('editRecord'));
                                // create edit url
                            } else {
                                $href = $this->backPath . 'alt_doc.php?';
                                $href .= '&edit[' . $table . '][' . $rowsByLang[$lang['uid']]['uid'] . ']=edit';
                                $href .= '&returnUrl=' . rawurlencode($this->retUrl) . t3lib_BEfunc::getUrlToken('editRecord');
                            }
                            $langSelItems[$lang['uid']] = '
									<option value="' . htmlspecialchars($href) . '"' . ($currentLanguage == $lang['uid'] ? ' selected="selected"' : '') . '>' . htmlspecialchars($lang['title'] . $newTranslation) . '</option>';
                        }
                    }
                    // If any languages are left, make selector:
                    if (count($langSelItems) > 1) {
                        $onChange = 'if(this.options[this.selectedIndex].value){window.location.href=(this.options[this.selectedIndex].value);}';
                        $content = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xml:LGL.language', 1) . ' <select name="_langSelector" onchange="' . htmlspecialchars($onChange) . '">
								' . implode('', $langSelItems) . '
							</select>';
                    }
                }
            }
        }
        return $content;
    }
Exemplo n.º 8
0
 /**
  * Returns a "create new record" image tag that is linked to the new record view.
  *
  * @param int $pid the page ID where the record should be stored, must be > 0
  *
  * @return string the HTML source code to return
  */
 public function getNewIcon($pid)
 {
     global $BACK_PATH, $LANG, $BE_USER;
     $result = '';
     $newRecordPid = $this->getNewRecordPid();
     $pid = $newRecordPid > 0 ? $newRecordPid : $pid;
     $pageData = $this->page->getPageData();
     if ($BE_USER->check('tables_modify', $this->tableName) && $this->doesUserHaveAccess($pid) && $pageData['doktype'] == self::SYSFOLDER_TYPE) {
         $params = '&edit[' . $this->tableName . '][';
         if ($pageData['uid'] == $pid) {
             $params .= $pageData['uid'];
             $storageLabel = sprintf($LANG->getLL('label_create_record_in_current_folder'), $pageData['title'], $pageData['uid']);
         } else {
             $storagePageData = t3lib_befunc::readPageAccess($pid, '');
             $params .= $pid;
             $storageLabel = sprintf($LANG->getLL('label_create_record_in_foreign_folder'), $storagePageData['title'], $pid);
         }
         $params .= ']=new';
         $editOnClick = $this->editNewUrl($params, $BACK_PATH);
         $langNew = $LANG->getLL('newRecordGeneral');
         $result = TAB . TAB . '<div id="typo3-newRecordLink">' . LF . TAB . TAB . TAB . '<a href="' . htmlspecialchars($editOnClick) . '">' . LF . TAB . TAB . TAB . TAB . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/new_record.gif', 'width="7" height="4"') . ' title="' . $langNew . '" alt="" />' . LF . TAB . TAB . TAB . TAB . $langNew . LF . TAB . TAB . TAB . '</a>' . LF . TAB . TAB . '</div>' . LF;
         /** @var t3lib_FlashMessage $message */
         $message = t3lib_div::makeInstance('t3lib_FlashMessage', $storageLabel, '', t3lib_FlashMessage::INFO);
         $this->addFlashMessage($message);
         if (class_exists('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService', TRUE)) {
             /** @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService */
             $flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
             /** @var \TYPO3\CMS\Core\Messaging\FlashMessageQueue $defaultFlashMessageQueue */
             $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
             $renderedFlashMessages = $defaultFlashMessageQueue->renderFlashMessages();
         } else {
             $renderedFlashMessages = t3lib_FlashMessageQueue::renderFlashMessages();
         }
         $result .= '<div id="eventsList-clear"></div>' . $renderedFlashMessages;
     }
     return $result;
 }
Exemplo n.º 9
0
 /**
  * Renders the HTML header for a foreign record, such as the title, toggle-function, drag'n'drop, etc.
  * Later on the command-icons are inserted here.
  *
  * @param string $parentUid The uid of the parent (embedding) record (uid or NEW...)
  * @param string $foreign_table The foreign_table we create a header for
  * @param array $rec The current record of that foreign_table
  * @param array $config content of $PA['fieldConf']['config']
  * @param boolean $isVirtualRecord
  * @return string The HTML code of the header
  * @todo Define visibility
  */
 public function renderForeignRecordHeader($parentUid, $foreign_table, $rec, $config, $isVirtualRecord = FALSE)
 {
     // Init:
     $objectId = $this->inlineNames['object'] . self::Structure_Separator . $foreign_table . self::Structure_Separator . $rec['uid'];
     // We need the returnUrl of the main script when loading the fields via AJAX-call (to correct wizard code, so include it as 3rd parameter)
     // Pre-Processing:
     $isOnSymmetricSide = \TYPO3\CMS\Core\Database\RelationHandler::isOnSymmetricSide($parentUid, $config, $rec);
     $hasForeignLabel = !$isOnSymmetricSide && $config['foreign_label'] ? TRUE : FALSE;
     $hasSymmetricLabel = $isOnSymmetricSide && $config['symmetric_label'] ? TRUE : FALSE;
     // Get the record title/label for a record:
     // render using a self-defined user function
     if ($GLOBALS['TCA'][$foreign_table]['ctrl']['label_userFunc']) {
         $params = array('table' => $foreign_table, 'row' => $rec, 'title' => '', 'isOnSymmetricSide' => $isOnSymmetricSide, 'parent' => array('uid' => $parentUid, 'config' => $config));
         // callUserFunction requires a third parameter, but we don't want to give $this as reference!
         $null = NULL;
         \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($GLOBALS['TCA'][$foreign_table]['ctrl']['label_userFunc'], $params, $null);
         $recTitle = $params['title'];
     } elseif ($hasForeignLabel || $hasSymmetricLabel) {
         $titleCol = $hasForeignLabel ? $config['foreign_label'] : $config['symmetric_label'];
         $foreignConfig = $this->getPossibleRecordsSelectorConfig($config, $titleCol);
         // Render title for everything else than group/db:
         if ($foreignConfig['type'] != 'groupdb') {
             $recTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValueExtra($foreign_table, $titleCol, $rec[$titleCol], 0, 0, FALSE);
         } else {
             // $recTitle could be something like: "tx_table_123|...",
             $valueParts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('|', $rec[$titleCol]);
             $itemParts = \TYPO3\CMS\Core\Utility\GeneralUtility::revExplode('_', $valueParts[0], 2);
             $recTemp = \t3lib_befunc::getRecordWSOL($itemParts[0], $itemParts[1]);
             $recTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($itemParts[0], $recTemp, FALSE);
         }
         $recTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitlePrep($recTitle);
         if (!strcmp(trim($recTitle), '')) {
             $recTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::getNoRecordTitle(TRUE);
         }
     } else {
         $recTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($foreign_table, $rec, TRUE);
     }
     // Renders a thumbnail for the header
     if (!empty($config['appearance']['headerThumbnail']['field'])) {
         $fieldValue = $rec[$config['appearance']['headerThumbnail']['field']];
         $firstElement = array_shift(\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $fieldValue));
         $fileUid = array_pop(\TYPO3\CMS\Backend\Utility\BackendUtility::splitTable_Uid($firstElement));
         if (!empty($fileUid)) {
             $fileObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFileObject($fileUid);
             if ($fileObject) {
                 $imageSetup = $config['appearance']['headerThumbnail'];
                 unset($imageSetup['field']);
                 $imageSetup = array_merge(array('width' => 64, 'height' => 64), $imageSetup);
                 $imageUrl = $fileObject->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW, $imageSetup)->getPublicUrl(TRUE);
                 $thumbnail = '<img src="' . $imageUrl . '" alt="' . htmlspecialchars($recTitle) . '">';
             } else {
                 $thumbnail = FALSE;
             }
         }
     }
     $altText = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordIconAltText($rec, $foreign_table);
     $iconImg = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($foreign_table, $rec, array('title' => htmlspecialchars($altText), 'id' => $objectId . '_icon'));
     $label = '<span id="' . $objectId . '_label">' . $recTitle . '</span>';
     $ctrl = $this->renderForeignRecordHeaderControl($parentUid, $foreign_table, $rec, $config, $isVirtualRecord);
     $header = '<table>' . '<tr>' . (!empty($config['appearance']['headerThumbnail']['field']) && $thumbnail ? '<td class="t3-form-field-header-inline-thumbnail" id="' . $objectId . '_thumbnailcontainer">' . $thumbnail . '</td>' : '<td class="t3-form-field-header-inline-icon" id="' . $objectId . '_iconcontainer">' . $iconImg . '</td>') . '<td class="t3-form-field-header-inline-summary">' . $label . '</td>' . '<td clasS="t3-form-field-header-inline-ctrl">' . $ctrl . '</td>' . '</tr>' . '</table>';
     return $header;
 }
 /**
  * Fetch the context help for the given table/field parameters
  *
  * @param string $table Table identifier
  * @param string $field Field identifier
  * @return array complete Help information
  */
 public function getContextHelp($table, $field)
 {
     $helpTextArray = \t3lib_befunc::helpTextArray($table, $field);
     $moreIcon = $helpTextArray['moreInfo'] ? \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-go-forward') : '';
     return array('title' => $helpTextArray['title'], 'description' => '<p class="t3-help-short' . ($moreIcon ? ' tipIsLinked' : '') . '">' . $helpTextArray['description'] . $moreIcon . '</p>', 'id' => $table . '.' . $field, 'moreInfo' => $helpTextArray['moreInfo']);
 }
 /**
  * get recursive DAM categories
  *
  * @param integer $catUid The category uid to search in recursive records
  * @param integer $depth Recursive depth. Normally you don't have to set it.
  * @return string A commaseperated list of category uids
  */
 public function getRecursiveDAMCategories($catUid, $depth = 0)
 {
     if ($catUid) {
         if (TYPO3_VERSION_INTEGER >= 7000000) {
             $enableFields = TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tx_dam_cat') . TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tx_dam_cat');
         } else {
             $enableFields = t3lib_befunc::BEenableFields('tx_dam_cat') . t3lib_befunc::deleteClause('tx_dam_cat');
         }
         $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('GROUP_CONCAT(uid) AS categoryUids', 'tx_dam_cat', 'parent_id = ' . intval($catUid) . $enableFields, '', '', '');
         // add categories to list
         $listOfCategories = $row['categoryUids'];
         if (TYPO3_VERSION_INTEGER >= 7000000) {
             $categories = TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $row['categoryUids']);
         } else {
             $categories = t3lib_div::trimExplode(',', $row['categoryUids']);
         }
         if (is_array($categories) && count($categories)) {
             foreach ($categories as $category) {
                 // only if further categories are found, add them to list
                 $tempCatList = $this->getRecursiveDAMCategories($category, $depth + 1);
                 if (TYPO3_VERSION_INTEGER >= 7000000) {
                     $addCategory = count(TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $tempCatList, true));
                 } else {
                     $addCategory = count(t3lib_div::trimExplode(',', $tempCatList, true));
                 }
                 if ($addCategory) {
                     $listOfCategories .= ',' . $tempCatList;
                 }
             }
         }
         return ($depth === 0 ? $catUid . ',' : '') . $listOfCategories;
     } else {
         return '';
     }
 }
Exemplo n.º 12
0
 /**
  * This method gets the list of all the log runs
  * It also assembles a limited list of the most recent log runs up to a limit defined by maxLogRuns
  *
  * @return	void
  */
 function getLogRuns()
 {
     $this->logRuns = array();
     $this->recentRuns = array();
     $runLimit = empty($this->extConf['maxLogRuns']) ? 0 : $this->extConf['maxLogRuns'];
     $dbres = $GLOBALS['TYPO3_DB']->exec_SELECTquery('DISTINCT crmsec,crdate', 'tx_devlog', '', '', 'crmsec DESC');
     // Assemble those runs in an associative array with run timestamp as a key
     $counter = 0;
     while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($dbres)) {
         $formattedDate = t3lib_befunc::dateTimeAge($row['crdate']);
         $this->logRuns[$row['crmsec']] = $formattedDate;
         if ($runLimit != 0 && $counter < $runLimit) {
             $this->recentRuns[$row['crmsec']] = $formattedDate;
         }
         $counter++;
     }
     $GLOBALS['TYPO3_DB']->sql_free_result($dbres);
 }
 /**
  * This function was called from indexer object and saves content to index table
  *
  * @return string content which will be displayed in backend
  */
 public function startIndexing()
 {
     $content = '';
     $table = 'tx_a21glossary_main';
     // get the pages from where to index the news
     $indexPids = $this->getPidList($this->indexerConfig['startingpoints_recursive'], $this->indexerConfig['sysfolder'], $table);
     // add the tags of the parent page
     if ($this->indexerConfig['index_use_page_tags']) {
         $this->pageRecords = $this->getPageRecords($indexPids);
         $this->addTagsToRecords($indexPids);
     }
     // get all the glossary records to index, don't index hidden or
     // deleted glossary records, BUT  get the records with frontend user group
     // access restrictions or time (start / stop) restrictions.
     // Copy those restrictions to the index.
     $fields = '*';
     $where = 'pid IN (' . implode(',', $indexPids) . ') ';
     if (TYPO3_VERSION_INTEGER >= 7000000) {
         $where .= TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table);
         $where .= TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table);
     } else {
         $where .= t3lib_befunc::BEenableFields($table);
         $where .= t3lib_befunc::deleteClause($table);
     }
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $where);
     $indexedRecordsCounter = 0;
     $resCount = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
     if ($resCount) {
         while ($record = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             // compile the information which should go into the index:
             // short, shortcut, longversion, shorttype, description, link
             $title = strip_tags($record['short']);
             $abstract = strip_tags($record['longversion']);
             $fullContent = strip_tags($record['shortcut'] . "\n" . $record['longversion'] . "\n" . $record['description'] . "\n" . $record['link']);
             // compile params for single view, example:
             // index.php?id=16&tx_a21glossary[uid]=71&cHash=9f9368211d8ae742a8d3ad29c4f0a308
             $paramsSingleView = array();
             $paramsSingleView['tx_a21glossary']['uid'] = $record['uid'];
             $params = rawurldecode('&' . http_build_query($paramsSingleView, NULL, '&'));
             // add tags from pages
             if ($this->indexerConfig['index_use_page_tags']) {
                 $tags = $this->pageRecords[intval($record['pid'])]['tags'];
             } else {
                 $tags = '';
             }
             // make it possible to modify the indexerConfig via hook
             $indexerConfig = $this->indexerConfig;
             // set additional fields
             $additionalFields = array();
             $additionalFields['orig_uid'] = $record['uid'];
             $additionalFields['orig_pid'] = $record['pid'];
             $additionalFields['sortdate'] = $record['crdate'];
             // hook for custom modifications of the indexed data, e.g. the tags
             if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifya21glossaryIndexEntry'])) {
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifya21glossaryIndexEntry'] as $_classRef) {
                     if (TYPO3_VERSION_INTEGER >= 7000000) {
                         $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
                     } else {
                         $_procObj =& t3lib_div::getUserObj($_classRef);
                     }
                     $_procObj->modifya21glossaryIndexEntry($title, $abstract, $fullContent, $params, $tags, $record, $additionalFields, $indexerConfig, $this);
                 }
             }
             // store this record to the index
             $this->pObj->storeInIndex($indexerConfig['storagepid'], $title, 'a21glossary', $indexerConfig['targetpid'], $fullContent, $tags, $params, $abstract, $record['sys_language_uid'], $record['starttime'], $record['endtime'], $record['fe_group'], false, $additionalFields);
             $indexedRecordsCounter++;
         }
         $content = '<p><b>Indexer "' . $this->indexerConfig['title'] . '":</b><br />' . "\n" . $indexedRecordsCounter . ' glossary records have been indexed.</p>' . "\n";
         $content .= $this->showErrors();
         $content .= $this->showTime();
     }
     return $content;
 }
Exemplo n.º 14
0
 /**
  * Get uids of all responsilbe persons for a stage
  *
  * @param	string	responsible_persion value from stage record
  * @return	string	uid list of responsible be_users
  */
 public function getResponsibleUser($stageRespValue)
 {
     $stageValuesArray = array();
     $stageValuesArray = t3lib_div::trimExplode(',', $stageRespValue);
     $beuserUidArray = array();
     $begroupUidArray = array();
     $allBeUserArray = array();
     $begroupUidList = array();
     foreach ($stageValuesArray as $key => $uidvalue) {
         if (strstr($uidvalue, 'be_users') !== FALSE) {
             // Current value is a uid of a be_user record
             $beuserUidArray[] = str_replace('be_users_', '', $uidvalue);
         } elseif (strstr($uidvalue, 'be_groups') !== FALSE) {
             $begroupUidArray[] = str_replace('be_groups_', '', $uidvalue);
         } else {
             $beuserUidArray[] = $uidvalue;
         }
     }
     if (!empty($begroupUidArray)) {
         $allBeUserArray = t3lib_befunc::getUserNames();
         $begroupUidList = implode(',', $begroupUidArray);
         $this->userGroups = array();
         $begroupUidArray = $this->fetchGroups($begroupUidList);
         foreach ($begroupUidArray as $groupkey => $groupData) {
             foreach ($allBeUserArray as $useruid => $userdata) {
                 if (t3lib_div::inList($userdata['usergroup'], $groupData['uid'])) {
                     $beuserUidArray[] = $useruid;
                 }
             }
         }
     }
     array_unique($beuserUidArray);
     return implode(',', $beuserUidArray);
 }
 /**
  * Returns the items of the given table for the flexforms.
  *
  * The table to retrieve the items for must have a title column.
  *
  * The given configuration array must apply to the following convention:
  * - the sub-arrays "config", "row" and "items" must exist
  * - "config" must have an element "itemTable" with a valid table name of a
  *   table which has a title column
  * - "row" must have an item "pid" with the current page ID
  *
  * @param array[] $configuration the flexforms configuration
  *
  * @return array[] the modified flexforms configuration including the items available for selection
  */
 public function getEntriesFromGeneralStoragePage(array $configuration)
 {
     $whereClause = '1 = 1';
     $table = $configuration['config']['itemTable'];
     if (tx_oelib_configurationProxy::getInstance('seminars')->getAsBoolean('useStoragePid')) {
         $rootlinePages = t3lib_befunc::BEgetRootLine($configuration['row']['pid']);
         foreach ($rootlinePages as $page) {
             $storagePid = (int) $page['storage_pid'];
             if ($storagePid > 0) {
                 $whereClause = '(' . $table . '.pid = ' . $storagePid . ')';
                 break;
             }
         }
     }
     $items = tx_oelib_db::selectMultiple('uid,title', $table, $whereClause . tx_oelib_db::enableFields($table), '', 'title ASC');
     $configuration['items'] = array();
     foreach ($items as $item) {
         $configuration['items'][] = array(0 => $item['title'], 1 => $item['uid'], 2 => $GLOBALS['TCA'][$table]['ctrl']['iconfile']);
     }
     return $configuration;
 }
 function checkTicketAdmin()
 {
     // get cobj from db
     $where = 'uid=' . $this->cObjId;
     $where .= t3lib_BEfunc::BEenableFields('tt_content');
     $where .= t3lib_befunc::deleteClause('tt_content');
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('pi_flexform', 'tt_content', $where, '', '', $limit = 1);
     $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
     if (!empty($row['pi_flexform'])) {
         $ffData = t3lib_div::xml2array($row['pi_flexform']);
     }
     $ticketAdmins = $ffData['data']['sheetUsers']['lDEF']['ticket_administrators']['vDEF'];
     if ($ticketAdmins) {
         if (t3lib_div::inList($ticketAdmins, $this->feUserObj->user['ses_userid'])) {
             return true;
         }
     } else {
         return false;
     }
 }
 /**
  * this function returns all indexer configurations found in DB
  * independant of PID
  */
 public function getConfigurations()
 {
     $fields = '*';
     $table = 'tx_kesearch_indexerconfig';
     $where = '1=1 ';
     if (TYPO3_VERSION_INTEGER >= 7000000) {
         $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table);
         $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table);
     } else {
         $where .= t3lib_befunc::BEenableFields($table);
         $where .= t3lib_befunc::deleteClause($table);
     }
     return $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($fields, $table, $where);
 }
 function getListOfAvailableFilteroptionsForFlexforms(&$config)
 {
     // get id from string
     if (strstr($config['row']['pages'], 'pages_')) {
         $intString = str_replace('pages_', '', $config['row']['pages']);
         $intString = substr($intString, 0, strpos($intString, '|'));
         $intString = intval($intString);
     } else {
         $intString = intval($config['row']['pages']);
     }
     // print message if no startingpoint is set in plugin config
     if (empty($intString)) {
         $config['items'][] = array('[SET STARTINGPOINT FIRST!]', '');
     }
     // get filters
     $fields = '*';
     $table = 'tx_kesearch_filters';
     $where = 'pid IN(' . $intString . ') ';
     if (TYPO3_VERSION_INTEGER > 7000000) {
         $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table, $inv = 0);
         $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table, $inv = 0);
     } else {
         $where .= t3lib_befunc::BEenableFields($table, $inv = 0);
         $where .= t3lib_befunc::deleteClause($table, $inv = 0);
     }
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $where, $groupBy = '', $orderBy = '', $limit = '');
     while ($rowFilter = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         if (!empty($rowFilter['options'])) {
             // get filteroptions
             $fieldsOpts = '*';
             $tableOpts = 'tx_kesearch_filteroptions';
             $whereOpts = 'uid in (' . $rowFilter['options'] . ')';
             if (TYPO3_VERSION_INTEGER > 7000000) {
                 $whereOpts .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($tableOpts, $inv = 0);
                 $whereOpts .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($tableOpts, $inv = 0);
             } else {
                 $whereOpts .= t3lib_befunc::BEenableFields($tableOpts, $inv = 0);
                 $whereOpts .= t3lib_befunc::deleteClause($tableOpts, $inv = 0);
             }
             $resOpts = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fieldsOpts, $tableOpts, $whereOpts, $groupBy = '', $orderBy = '', $limit = '');
             while ($rowOpts = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resOpts)) {
                 $config['items'][] = array($rowFilter['title'] . ': ' . $rowOpts['title'], $rowOpts['uid']);
             }
         }
     }
 }
 /**
  * Getting the tree data: next entry
  *
  * @param	mixed		data handle
  * @param	string		CSS class for sub elements (workspace related)
  * @return	array		item data array OR FALSE if end of elements.
  * @access private
  * @see getDataInit()
  */
 function getDataNext(&$res, $subCSSclass = '')
 {
     $row = parent::getDataNext($res, $subCSSclass);
     // Wir heben jede zweite Zeile hervor
     if ($row) {
         $this->iCurrentRow++;
         $bgColorClass = $this->iCurrentRow % 2 ? 'bgColor' : 'bgColor3';
         // Bereits gewählte werden zusätzlich hervorgehoben
         if (in_array($row['uid'], $this->getItemArrayIds())) {
             $bgColorClass = 'bgColor4';
         }
         $row['_CSSCLASS'] = ($row['_CSSCLASS'] ? ' ' : '') . $bgColorClass;
         $oConfig = $this->getConfig();
         // den Titel mit label_alt fülen
         if ($oConfig->getTreeConfig('parseRecordTitle')) {
             $row[$oConfig->getTitleField() . '_alt'] = t3lib_befunc::getRecordTitle($oConfig->getForeignTable(), $row, $prep = TRUE, $forceResult = TRUE);
         }
     }
     return $row;
 }
    /**
     * Prints a row with data for the various extension listings
     *
     * @param	string		Extension key
     * @param	array		Extension information array
     * @param	array		Preset table cells, eg. install/uninstall icons.
     * @param	string		<tr> tag class
     * @param	array		Array with installed extension keys (as keys)
     * @param	boolean		If set, the list is coming from remote server.
     * @param	string		Alternative link URL
     * @return	string		HTML <tr> content
     */
    function extensionListRow($extKey, $extInfo, $cells, $bgColorClass = '', $inst_list = array(), $import = 0, $altLinkUrl = '')
    {
        $stateColors = tx_em_Tools::getStateColors();
        // Icon:
        $imgInfo = @getImageSize(tx_em_Tools::getExtPath($extKey, $extInfo['type']) . '/ext_icon.gif');
        if (is_array($imgInfo)) {
            $cells[] = '<td><img src="' . $GLOBALS['BACK_PATH'] . tx_em_Tools::typeRelPath($extInfo['type']) . $extKey . '/ext_icon.gif' . '" ' . $imgInfo[3] . ' alt="" /></td>';
        } elseif ($extInfo['_ICON']) {
            $cells[] = '<td>' . $extInfo['_ICON'] . '</td>';
        } else {
            $cells[] = '<td><img src="clear.gif" width="1" height="1" alt="" /></td>';
        }
        // Extension title:
        $cells[] = '<td nowrap="nowrap"><a href="' . htmlspecialchars($altLinkUrl ? $altLinkUrl : t3lib_div::linkThisScript(array('CMD[showExt]' => $extKey, 'SET[singleDetails]' => 'info'))) . '" title="' . htmlspecialchars($extInfo['EM_CONF']['description']) . '">' . t3lib_div::fixed_lgd_cs($extInfo['EM_CONF']['title'] ? htmlspecialchars($extInfo['EM_CONF']['title']) : '<em>' . $extKey . '</em>', 40) . '</a></td>';
        // Based on the display mode you will see more or less details:
        if (!$this->parentObject->MOD_SETTINGS['display_details']) {
            $cells[] = '<td>' . htmlspecialchars(t3lib_div::fixed_lgd_cs($extInfo['EM_CONF']['description'], 400)) . '<br /><img src="clear.gif" width="300" height="1" alt="" /></td>';
            $cells[] = '<td nowrap="nowrap">' . ($extInfo['EM_CONF']['author_email'] ? '<a href="mailto:' . htmlspecialchars($extInfo['EM_CONF']['author_email']) . '">' : '') . htmlspecialchars($extInfo['EM_CONF']['author']) . (htmlspecialchars($extInfo['EM_CONF']['author_email']) ? '</a>' : '') . ($extInfo['EM_CONF']['author_company'] ? '<br />' . htmlspecialchars($extInfo['EM_CONF']['author_company']) : '') . '</td>';
        } elseif ($this->parentObject->MOD_SETTINGS['display_details'] == 2) {
            $cells[] = '<td nowrap="nowrap">' . $extInfo['EM_CONF']['priority'] . '</td>';
            $cells[] = '<td nowrap="nowrap">' . implode('<br />', t3lib_div::trimExplode(',', $extInfo['EM_CONF']['modify_tables'], 1)) . '</td>';
            $cells[] = '<td nowrap="nowrap">' . $extInfo['EM_CONF']['module'] . '</td>';
            $cells[] = '<td nowrap="nowrap">' . ($extInfo['EM_CONF']['clearCacheOnLoad'] ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes') : '') . '</td>';
            $cells[] = '<td nowrap="nowrap">' . ($extInfo['EM_CONF']['internal'] ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes') : '') . '</td>';
            $cells[] = '<td nowrap="nowrap">' . ($extInfo['EM_CONF']['shy'] ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes') : '') . '</td>';
        } elseif ($this->parentObject->MOD_SETTINGS['display_details'] == 3) {
            $techInfo = $this->install->makeDetailedExtensionAnalysis($extKey, $extInfo);
            $cells[] = '<td>' . $this->parentObject->extensionDetails->extInformationArray_dbReq($techInfo) . '</td>';
            $cells[] = '<td nowrap="nowrap">' . (is_array($techInfo['TSfiles']) ? implode('<br />', $techInfo['TSfiles']) : '') . '</td>';
            $cells[] = '<td nowrap="nowrap">' . (is_array($techInfo['flags']) ? implode('<br />', $techInfo['flags']) : '') . '</td>';
            $cells[] = '<td nowrap="nowrap">' . (is_array($techInfo['moduleNames']) ? implode('<br />', $techInfo['moduleNames']) : '') . '</td>';
            $cells[] = '<td nowrap="nowrap">' . ($techInfo['conf'] ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes') : '') . '</td>';
            $cells[] = '<td>' . tx_em_Tools::rfw((t3lib_extMgm::isLoaded($extKey) && $techInfo['tables_error'] ? '<strong>' . $GLOBALS['LANG']->getLL('extInfoArray_table_error') . '</strong><br />' . $GLOBALS['LANG']->getLL('extInfoArray_missing_fields') : '') . (t3lib_extMgm::isLoaded($extKey) && $techInfo['static_error'] ? '<strong>' . $GLOBALS['LANG']->getLL('extInfoArray_static_table_error') . '</strong><br />' . $GLOBALS['LANG']->getLL('extInfoArray_static_tables_missing_empty') : '')) . '</td>';
        } elseif ($this->parentObject->MOD_SETTINGS['display_details'] == 4) {
            $techInfo = $this->install->makeDetailedExtensionAnalysis($extKey, $extInfo, 1);
            $cells[] = '<td>' . (is_array($techInfo['locallang']) ? implode('<br />', $techInfo['locallang']) : '') . '</td>';
            $cells[] = '<td>' . (is_array($techInfo['classes']) ? implode('<br />', $techInfo['classes']) : '') . '</td>';
            $cells[] = '<td>' . (is_array($techInfo['errors']) ? tx_em_Tools::rfw(implode('<hr />', $techInfo['errors'])) : '') . '</td>';
            $cells[] = '<td>' . (is_array($techInfo['NSerrors']) ? !t3lib_div::inList($this->parentObject->nameSpaceExceptions, $extKey) ? t3lib_utility_Debug::viewarray($techInfo['NSerrors']) : tx_em_Tools::dfw($GLOBALS['LANG']->getLL('extInfoArray_exception')) : '') . '</td>';
        } elseif ($this->parentObject->MOD_SETTINGS['display_details'] == 5) {
            $currentMd5Array = $this->parentObject->extensionDetails->serverExtensionMD5array($extKey, $extInfo);
            $affectedFiles = '';
            $msgLines = array();
            $msgLines[] = $GLOBALS['LANG']->getLL('listRow_files') . ' ' . count($currentMd5Array);
            if (strcmp($extInfo['EM_CONF']['_md5_values_when_last_written'], serialize($currentMd5Array))) {
                $msgLines[] = tx_em_Tools::rfw('<br /><strong>' . $GLOBALS['LANG']->getLL('extInfoArray_difference_detected') . '</strong>');
                $affectedFiles = tx_em_Tools::findMD5ArrayDiff($currentMd5Array, unserialize($extInfo['EM_CONF']['_md5_values_when_last_written']));
                if (count($affectedFiles)) {
                    $msgLines[] = '<br /><strong>' . $GLOBALS['LANG']->getLL('extInfoArray_modified_files') . '</strong><br />' . tx_em_Tools::rfw(implode('<br />', $affectedFiles));
                }
            }
            $cells[] = '<td>' . implode('<br />', $msgLines) . '</td>';
        } else {
            // Default view:
            $verDiff = $inst_list[$extKey] && tx_em_Tools::versionDifference($extInfo['EM_CONF']['version'], $inst_list[$extKey]['EM_CONF']['version'], $this->parentObject->versionDiffFactor);
            $cells[] = '<td nowrap="nowrap"><em>' . $extKey . '</em></td>';
            $cells[] = '<td nowrap="nowrap">' . ($verDiff ? '<strong>' . tx_em_Tools::rfw(htmlspecialchars($extInfo['EM_CONF']['version'])) . '</strong>' : $extInfo['EM_CONF']['version']) . '</td>';
            if (!$import) {
                // Listing extension on LOCAL server:
                // Extension Download:
                $cells[] = '<td nowrap="nowrap"><a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('CMD[doBackup]' => 1, 'SET[singleDetails]' => 'backup', 'CMD[showExt]' => $extKey))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:download') . '">' . t3lib_iconWorks::getSpriteIcon('actions-system-extension-download') . '</a></td>';
                // Manual download
                $manual = tx_em_Tools::typePath($extInfo['type']) . $extKey . '/doc/manual.sxw';
                $manualRelPath = t3lib_div::resolveBackPath($this->parentObject->doc->backPath . tx_em_Tools::typeRelPath($extInfo['type'])) . $extKey . '/doc/manual.sxw';
                if ($extInfo['EM_CONF']['docPath']) {
                    $manual = tx_em_Tools::typePath($extInfo['type']) . $extKey . '/' . $extInfo['EM_CONF']['docPath'] . '/manual.sxw';
                    $manualRelPath = t3lib_div::resolveBackPath($this->parentObject->doc->backPath . tx_em_Tools::typeRelPath($extInfo['type'])) . $extKey . '/' . $extInfo['EM_CONF']['docPath'] . '/manual.sxw';
                }
                $cells[] = '<td nowrap="nowrap">' . (tx_em_Tools::typePath($extInfo['type']) && @is_file($manual) ? '<a href="' . htmlspecialchars($manualRelPath) . '" target="_blank" title="' . $GLOBALS['LANG']->getLL('listRow_local_manual') . '">' . t3lib_iconWorks::getSpriteIcon('actions-system-extension-documentation') . '</a>' : '') . '</td>';
                // Double installation (inclusion of an extension in more than one of system, global or local scopes)
                $doubleInstall = '';
                if (strlen($extInfo['doubleInstall']) > 1) {
                    // Separate the "SL" et al. string into an array and replace L by Local, G by Global etc.
                    $doubleInstallations = str_replace(array('S', 'G', 'L'), array($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:sysext'), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:globalext'), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:localext')), str_split($extInfo['doubleInstall']));
                    // Last extension is the one actually used
                    $usedExtension = array_pop($doubleInstallations);
                    // Next extension is overridden
                    $overriddenExtensions = array_pop($doubleInstallations);
                    // If the array is not yet empty, the extension is actually installed 3 times (SGL)
                    if (count($doubleInstallations) > 0) {
                        $lastExtension = array_pop($doubleInstallations);
                        $overriddenExtensions .= ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:and') . ' ' . $lastExtension;
                    }
                    $doubleInstallTitle = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:double_inclusion'), $usedExtension, $overriddenExtensions);
                    $doubleInstall = ' <strong><abbr title="' . $doubleInstallTitle . '">' . tx_em_Tools::rfw($extInfo['doubleInstall']) . '</abbr></strong>';
                }
                $cells[] = '<td nowrap="nowrap">' . $this->types[$extInfo['type']] . $doubleInstall . '</td>';
            } else {
                // Listing extensions from REMOTE repository:
                $inst_curVer = $inst_list[$extKey]['EM_CONF']['version'];
                if (isset($inst_list[$extKey])) {
                    if ($verDiff) {
                        $inst_curVer = '<strong>' . tx_em_Tools::rfw($inst_curVer) . '</strong>';
                    }
                }
                $cells[] = '<td nowrap="nowrap">' . t3lib_befunc::date($extInfo['EM_CONF']['lastuploaddate']) . '</td>';
                $cells[] = '<td nowrap="nowrap">' . htmlspecialchars(t3lib_div::fixed_lgd_cs($extInfo['EM_CONF']['author'], $GLOBALS['BE_USER']->uc[titleLen])) . '</td>';
                $cells[] = '<td nowrap="nowrap">' . $inst_curVer . '</td>';
                $cells[] = '<td nowrap="nowrap">' . $this->api->typeLabels[$inst_list[$extKey]['type']] . (strlen($inst_list[$extKey]['doubleInstall']) > 1 ? '<strong> ' . tx_em_Tools::rfw($inst_list[$extKey]['doubleInstall']) . '</strong>' : '') . '</td>';
                $cells[] = '<td nowrap="nowrap">' . ($extInfo['downloadcounter_all'] ? $extInfo['downloadcounter_all'] : '&nbsp;&nbsp;') . '/' . ($extInfo['downloadcounter'] ? $extInfo['downloadcounter'] : '&nbsp;') . '</td>';
            }
            $cells[] = '<td nowrap="nowrap" class="extstate" style="background-color:' . $stateColors[$extInfo['EM_CONF']['state']] . ';">' . $this->states[$extInfo['EM_CONF']['state']] . '</td>';
        }
        // show a different background through a different class for insecure (-1) extensions,
        // for unreviewed (0) and reviewed extensions (1), just use the regular class
        if ($this->xmlHandler->getReviewState($extKey, $extInfo['EM_CONF']['version']) < 0) {
            $bgclass = ' class="unsupported-ext"';
        } else {
            $bgclass = ' class="' . ($bgColorClass ? $bgColorClass : 'em-listbg1') . '"';
        }
        return '
			<tr' . $bgclass . '>
				' . implode('
				', $cells) . '
			</tr>';
    }
 /**
  * Searches the category rootline (up) for a single view pid. If nothing is found in the current
  * category, the single view pid of the parent categories is taken (recusivly).
  * taken from tx_ttnews
  *
  * @param int $currentCategory: Uid of the current category
  * @return int first found single view pid
  */
 function getRecursiveCategorySinglePid($currentCategory)
 {
     if (TYPO3_VERSION_INTEGER >= 7000000) {
         $addWhere = ' AND tt_news_cat.deleted=0' . TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tt_news_cat');
     } else {
         $addWhere = ' AND tt_news_cat.deleted=0' . t3lib_befunc::BEenableFields('tt_news_cat');
     }
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,parent_category,single_pid', 'tt_news_cat', 'tt_news_cat.uid=' . $currentCategory . $addWhere);
     $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
     $GLOBALS['TYPO3_DB']->sql_free_result($res);
     if ($row['single_pid'] > 0) {
         return $row['single_pid'];
     } elseif ($row['parent_category'] > 0) {
         return $this->getRecursiveCategorySinglePid($row['parent_category']);
     }
 }
Exemplo n.º 22
0
 function renderTimeTracking()
 {
     $mainFunction = $this->getMainFunction();
     t3lib_befunc::setMainFunction($mainFunction);
     $pageByMenu = array_flip($this->pi1->menuByPage);
     $activeMenuID = $pageByMenu[$this->getActiveMenu()];
     $this->pi1->tsfe->id = $activeMenuID;
     $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/cache/frontend/class.t3lib_Cache\\Frontend\\VariableFrontend.php']['set'] = NULL;
     $GLOBALS['LANG'] = NULL;
     $GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['parser']['xml'] = \TYPO3\CMS\Core\Localization\Parser\LocallangXmlParser::class;
     $be = new \TYPO3\CMS\Core\Cache\Backend\NullBackend('context');
     $fe = new \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend('t3lib_l10n', $be);
     $cm = new \TYPO3\CMS\Core\Cache\CacheManager();
     $cm->registerCache($fe);
     $GLOBALS['typo3CacheManager'] = $cm;
     $content[] = $this->pi1->main('', array());
     $html = new View('template/template.phtml');
     $html->title = 'Rechnung+ 2.0';
     $html->headerData = implode("\n", $this->pi1->tsfe->additionalHeaderData);
     $html->content = implode("\n", $content);
     $html->h1 = $this->pi1->menuOptions[$this->getActiveMenu()];
     $html->h2 = $mainFunction;
     $html->activeMenu = $this->pi1->tsfe->id;
     $html->userSelection = $this->getUserSelection();
     $html->countUsers = sizeof($this->pi1->getFEUserChoice());
     $html->clientCount = $this->pi1->clients;
     $html->projectCount = $this->pi1->projects;
     $html->invoiceCount = $this->pi1->invoices;
     $html->workCount = $this->pi1->works;
     $html->groupCount = 0;
     return $html;
 }
Exemplo n.º 23
0
 /**
  * Make selector box for creating new translation for a record or switching to edit the record in an existing language.
  * Displays only languages which are available for the current page.
  *
  * @param	array		$langRowsLanguage records including faked record for default language
  * @param	integer		$currentLanguage uid of the current language
  * @param	boolean		$formFields If true, form-fields will be wrapped around
  * @return	string		<select> HTML element (if there were items for the box anyways...)
  */
 function languageSwitch($langRows, $currentLanguage, $formFields = false)
 {
     $content = '';
     // page available in other languages than default language?
     if (is_array($langRows) && count($langRows)) {
         $langSelItems = array();
         foreach ($langRows as $lang) {
             $langSelItems[$lang['uid']] = $lang['title'];
         }
         // If any languages are left, make selector:
         if (count($langSelItems) > 1) {
             $content .= $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xml:LGL.language', 1) . ' ';
             $content .= t3lib_befunc::getFuncMenu('', 'SET[tx_dam_list_langSelector]', $currentLanguage, $langSelItems);
             if ($currentLanguage > 0) {
                 $content .= t3lib_befunc::getFuncMenu('', 'SET[tx_dam_list_langOverlay]', $this->MOD_SETTINGS['tx_dam_list_langOverlay'], $this->MOD_MENU['tx_dam_list_langOverlay']);
             }
             if ($formFields) {
                 $content = '<form action="' . htmlspecialchars(t3lib_div::linkThisScript()) . '" method="post">' . $content . '</form>';
             }
         }
     }
     return $content;
 }
    /**
     * Renders the template selector.
     *
     * @param	integer		Position id. Can be positive and negative depending of where the new page is going: Negative always points to a position AFTER the page having the abs. value of the positionId. Positive numbers means to create as the first subpage to another page.
     * @param	string		$templateType: The template type, 'tmplobj' or 't3d'
     * @return	string		HTML output containing a table with the template selector
     */
    function renderTemplateSelector($positionPid, $templateType = 'tmplobj')
    {
        global $LANG, $TYPO3_DB;
        $storageFolderPID = $this->apiObj->getStorageFolderPid($positionPid);
        $tmplHTML = array();
        switch ($templateType) {
            case 'tmplobj':
                // Create the "Default template" entry
                $previewIconFilename = $GLOBALS['BACK_PATH'] . '../' . t3lib_extMgm::siteRelPath($this->extKey) . 'res1/default_previewicon.gif';
                $previewIcon = '<input type="image" class="c-inputButton" name="i0" value="0" src="' . $previewIconFilename . '" title="" />';
                $description = htmlspecialchars($LANG->getLL('template_descriptiondefault'));
                $tmplHTML[] = '<table style="float:left; width: 100%;" valign="top"><tr><td colspan="2" nowrap="nowrap">
					<h3 class="bgColor3-20">' . htmlspecialchars($LANG->getLL('template_titledefault')) . '</h3></td></tr>
					<tr><td valign="top">' . $previewIcon . '</td><td width="120" valign="top"><p>' . $description . '</p></td></tr></table>';
                $tTO = 'tx_templavoila_tmplobj';
                $tDS = 'tx_templavoila_datastructure';
                $where = $tTO . '.parent=0 AND ' . $tTO . '.pid=' . intval($storageFolderPID) . ' AND ' . $tDS . '.scope=1' . $this->buildRecordWhere($tTO) . $this->buildRecordWhere($tDS) . t3lib_befunc::deleteClause($tTO) . t3lib_befunc::deleteClause($tDS) . t3lib_BEfunc::versioningPlaceholderClause($tTO) . t3lib_BEfunc::versioningPlaceholderClause($tDS);
                $res = $TYPO3_DB->exec_SELECTquery($tTO . '.*', $tTO . ' LEFT JOIN ' . $tDS . ' ON ' . $tTO . '.datastructure = ' . $tDS . '.uid', $where);
                while (false !== ($row = $TYPO3_DB->sql_fetch_assoc($res))) {
                    // Check if preview icon exists, otherwise use default icon:
                    $tmpFilename = 'uploads/tx_templavoila/' . $row['previewicon'];
                    $previewIconFilename = @is_file(PATH_site . $tmpFilename) ? $GLOBALS['BACK_PATH'] . '../' . $tmpFilename : $GLOBALS['BACK_PATH'] . '../' . t3lib_extMgm::siteRelPath($this->extKey) . 'res1/default_previewicon.gif';
                    // Note: we cannot use value of image input element because MSIE replaces this value with mouse coordinates! Thus on click we set value to a hidden field. See http://bugs.typo3.org/view.php?id=3376
                    $previewIcon = '<input type="image" class="c-inputButton" name="i' . $row['uid'] . '" onclick="document.getElementById(\'data_tx_templavoila_to\').value=' . $row['uid'] . '" src="' . $previewIconFilename . '" title="" />';
                    $description = $row['description'] ? htmlspecialchars($row['description']) : $LANG->getLL('template_nodescriptionavailable');
                    $tmplHTML[] = '<table style="width: 100%;" valign="top"><tr><td colspan="2" nowrap="nowrap"><h3 class="bgColor3-20">' . htmlspecialchars($row['title']) . '</h3></td></tr>' . '<tr><td valign="top">' . $previewIcon . '</td><td width="120" valign="top"><p>' . $description . '</p></td></tr></table>';
                }
                $tmplHTML[] = '<input type="hidden" id="data_tx_templavoila_to" name="data[tx_templavoila_to]" value="0" />';
                break;
            case 't3d':
                if (t3lib_extMgm::isLoaded('impexp')) {
                    // Read template files from a certain folder. I suggest this is configurable in some way. But here it is hardcoded for initial tests.
                    $templateFolder = PATH_site . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'] . '/export/templates/';
                    $files = t3lib_div::getFilesInDir($templateFolder, 't3d,xml', 1, 1);
                    // Traverse the files found:
                    foreach ($files as $absPath) {
                        // Initialize the import object:
                        $import = $this->getImportObject();
                        if ($import->loadFile($absPath)) {
                            if (is_array($import->dat['header']['pagetree'])) {
                                // This means there are pages in the file, we like that...:
                                // Page tree:
                                reset($import->dat['header']['pagetree']);
                                $pageTree = current($import->dat['header']['pagetree']);
                                // Thumbnail icon:
                                if (is_array($import->dat['header']['thumbnail'])) {
                                    $pI = pathinfo($import->dat['header']['thumbnail']['filename']);
                                    if (t3lib_div::inList('gif,jpg,png,jpeg', strtolower($pI['extension']))) {
                                        // Construct filename and write it:
                                        $fileName = PATH_site . 'typo3temp/importthumb_' . t3lib_div::shortMD5($absPath) . '.' . $pI['extension'];
                                        t3lib_div::writeFile($fileName, $import->dat['header']['thumbnail']['content']);
                                        // Check that the image really is an image and not a malicious PHP script...
                                        if (getimagesize($fileName)) {
                                            // Create icon tag:
                                            $iconTag = '<img src="' . $this->doc->backPath . '../' . substr($fileName, strlen(PATH_site)) . '" ' . $import->dat['header']['thumbnail']['imgInfo'][3] . ' vspace="5" style="border: solid black 1px;" alt="" />';
                                        } else {
                                            t3lib_div::unlink_tempfile($fileName);
                                            $iconTag = '';
                                        }
                                    }
                                }
                                $aTagB = '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('templateFile' => $absPath))) . '">';
                                $aTagE = '</a>';
                                $tmplHTML[] = '<table style="float:left; width: 100%;" valign="top"><tr><td colspan="2" nowrap="nowrap">
					<h3 class="bgColor3-20">' . $aTagB . htmlspecialchars($import->dat['header']['meta']['title'] ? $import->dat['header']['meta']['title'] : basename($absPath)) . $aTagE . '</h3></td></tr>
					<tr><td valign="top">' . $aTagB . $iconTag . $aTagE . '</td><td valign="top"><p>' . htmlspecialchars($import->dat['header']['meta']['description']) . '</p>
						<em>Levels: ' . (count($pageTree) > 1 ? 'Deep structure' : 'Single page') . '<br/>
						File: ' . basename($absPath) . '</em></td></tr></table>';
                            }
                        }
                    }
                }
                break;
        }
        if (is_array($tmplHTML) && count($tmplHTML)) {
            $counter = 0;
            $content .= '<table>';
            foreach ($tmplHTML as $single) {
                $content .= ($counter ? '' : '<tr>') . '<td valign="top">' . $single . '</td>' . ($counter ? '</tr>' : '');
                $counter++;
                if ($counter > 1) {
                    $counter = 0;
                }
            }
            $content .= '</table>';
        }
        return $content;
    }
 /**
  * Returns an array of available Page Template Object records from the scope of the given page.
  *
  * Note: All TO records which are found in the selected storage folder will be returned, no matter
  *       if they match the currently selected data structure for the given page.
  *
  * @param	integer		$pageUid: (current) page uid, used for finding the correct storage folder
  * @return	mixed		Array of Template Object records or FALSE if an error occurred.
  * @access	public
  */
 function ds_getAvailablePageTORecords($pageUid)
 {
     global $TYPO3_DB;
     $storageFolderPID = $this->getStorageFolderPid($pageUid);
     $tTO = 'tx_templavoila_tmplobj';
     $tDS = 'tx_templavoila_datastructure';
     $res = $TYPO3_DB->exec_SELECTquery("{$tTO}.*", "{$tTO} LEFT JOIN {$tDS} ON {$tTO}.datastructure = {$tDS}.uid", "{$tTO}.pid=" . intval($storageFolderPID) . " AND {$tDS}.scope=1" . t3lib_befunc::deleteClause($tTO) . t3lib_befunc::deleteClause($tDS) . t3lib_BEfunc::versioningPlaceholderClause($tTO) . t3lib_BEfunc::versioningPlaceholderClause($tDS));
     if (!$res) {
         return FALSE;
     }
     $templateObjectRecords = array();
     while (false != ($row = $TYPO3_DB->sql_fetch_assoc($res))) {
         $templateObjectRecords[$row['uid']] = $row;
     }
     return $templateObjectRecords;
 }
Exemplo n.º 26
0
 /**
  * Determine and get the value for the placeholder and return the placeholder attribute
  *
  * @param string $table
  * @param string $field
  * @param array $config
  * @param array $row
  * @return string
  */
 protected function getPlaceholderAttribute($table, $field, array $config, array $row)
 {
     $value = trim($config['placeholder']);
     if (!$value) {
         return '';
     }
     // Check if we have a reference to another field value from the current record
     if (substr($value, 0, 6) === '__row|') {
         $keySegments = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('|', substr($value, 6));
         if (isset($row[$keySegments[0]])) {
             // First segment (fieldname) exists in the current row
             $value = $row[$keySegments[0]];
             $fieldConf = $GLOBALS['TCA'][$table]['columns'][$keySegments[0]];
             if ($fieldConf['config']['type'] === 'group' && $fieldConf['config']['internal_type'] === 'db') {
                 // The field is a relation to another record
                 list($foreignIdentifier, $foreignTitle) = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('|', $value);
                 // Use the foreign title
                 $value = $foreignTitle;
                 if (!empty($keySegments[1])) {
                     // Use any field in the foreign record
                     list($foreignTable, $foreignUid) = \TYPO3\CMS\Backend\Utility\BackendUtility::splitTable_Uid($foreignIdentifier);
                     $foreignRecord = \t3lib_befunc::getRecord($foreignTable, $foreignUid);
                     if (isset($foreignRecord[$keySegments[1]])) {
                         $value = $foreignRecord[$keySegments[1]];
                     }
                 }
             } elseif (!empty($keySegments[1]) && isset($row[$keySegments[0]][$keySegments[1]])) {
                 $value = $row[$keySegments[0]][$keySegments[1]];
             }
         }
     }
     // Cleanup the string and support 'LLL:'
     $value = htmlspecialchars(trim($this->sL($value)));
     return empty($value) ? '' : ' placeholder="' . $value . '" ';
 }
Exemplo n.º 27
0
 /**
  * Tree rendering
  *
  * @param	integer		PID value
  * @param	string		Additional where clause
  * @return	array		Array of tree elements
  */
 function ext_tree($pid, $clause = '')
 {
     // Initialize:
     $this->init(' AND ' . $this->permsC() . $clause);
     // Get stored tree structure:
     $this->stored = unserialize($this->BE_USER->uc['browseTrees']['browsePages']);
     // PM action:
     $PM = t3lib_div::intExplode('_', t3lib_div::_GP('PM'));
     // traverse mounts:
     $titleLen = intval($this->BE_USER->uc['titleLen']);
     $treeArr = array();
     $idx = 0;
     // Set first:
     $this->bank = $idx;
     $isOpen = $this->stored[$idx][$pid] || $this->expandFirst;
     $curIds = $this->ids;
     // save ids
     $this->reset();
     $this->ids = $curIds;
     // Set PM icon:
     $cmd = $this->bank . '_' . ($isOpen ? '0_' : '1_') . $pid;
     $icon = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/ol/' . ($isOpen ? 'minus' : 'plus') . 'only.gif', 'width="18" height="16"') . ' align="top" alt="" />';
     $firstHtml = $this->PM_ATagWrap($icon, $cmd);
     if ($pid > 0) {
         $rootRec = t3lib_befunc::getRecordWSOL('pages', $pid);
         $firstHtml .= $this->wrapIcon(t3lib_iconWorks::getSpriteIconForRecord('pages', $rootRec), $rootRec);
     } else {
         $rootRec = array('title' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'], 'uid' => 0);
         $firstHtml .= $this->wrapIcon('<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/i/_icon_website.gif', 'width="18" height="16"') . ' align="top" alt="" />', $rootRec);
     }
     $this->tree[] = array('HTML' => $firstHtml, 'row' => $rootRec);
     if ($isOpen) {
         // Set depth:
         $depthD = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/ol/blank.gif', 'width="18" height="16"') . ' align="top" alt="" />';
         if ($this->addSelfId) {
             $this->ids[] = $pid;
         }
         $this->getTree($pid, 999, $depthD);
         $idH = array();
         $idH[$pid]['uid'] = $pid;
         if (count($this->buffer_idH)) {
             $idH[$pid]['subrow'] = $this->buffer_idH;
         }
         $this->buffer_idH = $idH;
     }
     // Add tree:
     $treeArr = array_merge($treeArr, $this->tree);
     return $treeArr;
 }
Exemplo n.º 28
0
 /**
  * Gets a merged variant of recipient defined by uid and custom ones.
  *
  * @param array list of recipients
  * @param string given user string of additional recipients
  * @return array
  */
 public function getRecipientList(array $uidOfRecipients, $additionalRecipients)
 {
     $finalRecipients = array();
     $recipients = array();
     foreach ($uidOfRecipients as $userUid) {
         $beUserRecord = t3lib_befunc::getRecord('be_users', intval($userUid));
         if (is_array($beUserRecord) && $beUserRecord['email'] != '') {
             $recipients[] = $beUserRecord['email'];
         }
     }
     if ($additionalRecipients != '') {
         $additionalRecipients = t3lib_div::trimExplode("\n", $additionalRecipients, TRUE);
     } else {
         $additionalRecipients = array();
     }
     $allRecipients = array_unique(array_merge($recipients, $additionalRecipients));
     foreach ($allRecipients as $recipient) {
         if (t3lib_div::validEmail($recipient)) {
             $finalRecipients[] = $recipient;
         }
     }
     return $finalRecipients;
 }
 /**
  * This function was called from indexer object and saves content to index table
  *
  * @return string content which will be displayed in backend
  */
 public function startIndexing()
 {
     // get all address records from pid set in indexerConfig
     $fields = '*';
     $table = 'tt_address';
     $indexPids = $this->getPidList($this->indexerConfig['startingpoints_recursive'], $this->indexerConfig['sysfolder'], $table);
     if ($this->indexerConfig['index_use_page_tags']) {
         // add the tags of each page to the global page array
         $this->pageRecords = $this->getPageRecords($indexPids);
         $this->addTagsToRecords($indexPids);
     }
     $where = 'pid IN (' . implode(',', $indexPids) . ') ';
     if (TYPO3_VERSION_INTEGER >= 7000000) {
         $where .= TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table);
         $where .= TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table);
     } else {
         $where .= t3lib_befunc::BEenableFields($table);
         $where .= t3lib_befunc::deleteClause($table);
     }
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $where);
     $resCount = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
     // no address records found
     if (!$resCount) {
         $content = '<p>No address records found!</p>';
         return $content;
     }
     // if records found: process them
     while ($addressRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         $abstract = '';
         $content = '';
         // set title, use company if set, otherwise name
         $title = !empty($addressRow['company']) ? $addressRow['company'] : (!empty($addressRow['name']) ? $addressRow['name'] : $addressRow['first_name'] . ' ' . $addressRow['last_name']);
         // use description as abstract if set
         if (!empty($addressRow['description'])) {
             $abstract = $addressRow['description'];
         }
         // build content
         if (!empty($addressRow['company'])) {
             $content .= $addressRow['company'] . "\n";
         }
         if (!empty($addressRow['title'])) {
             $content .= $addressRow['title'] . ' ';
         }
         if (!empty($addressRow['name'])) {
             $content .= $addressRow['name'] . "\n";
             // name
         } else {
             if (!empty($addressRow['first_name'])) {
                 $content .= $addressRow['first_name'] . ' ';
             }
             if (!empty($addressRow['middle_name'])) {
                 $content .= $addressRow['middle_name'] . ' ';
             }
             if (!empty($addressRow['last_name'])) {
                 $content .= $addressRow['last_name'] . ' ';
             }
             if (!empty($addressRow['last_name']) || !empty($addressRow['middle_name']) || !empty($addressRow['middle_name'])) {
                 $content .= "\n";
             }
         }
         if (!empty($addressRow['address'])) {
             $content .= $addressRow['address'] . "\n";
         }
         if (!empty($addressRow['zip'])) {
             $content .= $addressRow['zip'] . "\n";
         }
         if (!empty($addressRow['city'])) {
             $content .= $addressRow['city'] . "\n";
         }
         if (!empty($addressRow['country'])) {
             $content .= $addressRow['country'] . "\n";
         }
         if (!empty($addressRow['region'])) {
             $content .= $addressRow['region'] . "\n";
         }
         if (!empty($addressRow['email'])) {
             $content .= $addressRow['email'] . "\n";
         }
         if (!empty($addressRow['phone'])) {
             $content .= $addressRow['phone'] . "\n";
         }
         if (!empty($addressRow['fax'])) {
             $content .= $addressRow['fax'] . "\n";
         }
         if (!empty($addressRow['mobile'])) {
             $content .= $addressRow['mobile'] . "\n";
         }
         if (!empty($addressRow['www'])) {
             $content .= $addressRow['www'];
         }
         // put content together
         $fullContent = $abstract . "\n" . $content;
         // there is no tt_address default param like this; you have to modify this by hook to fit your needs
         $params = '&tt_address[showUid]=' . $addressRow['uid'];
         // no tags yet
         if ($this->indexerConfig['index_use_page_tags']) {
             $tagContent = $this->pageRecords[intval($addressRow['pid'])]['tags'];
         } else {
             $tagContent = '';
         }
         // set additional fields for sorting
         $additionalFields = array('sortdate' => $addressRow['tstamp']);
         // fill orig_uid
         if (isset($addressRow['uid']) && $addressRow['uid'] > 0) {
             $additionalFields['orig_uid'] = $addressRow['uid'];
         }
         // fill orig_pid
         if (isset($addressRow['pid']) && $addressRow['pid'] > 0) {
             $additionalFields['orig_pid'] = $addressRow['pid'];
         }
         // make it possible to modify the indexerConfig via hook
         $indexerConfig = $this->indexerConfig;
         // add some fields which you may set in your own hook
         $customfields = array('sys_language_uid' => 0, 'starttime' => 0, 'endtime' => 0, 'fe_group' => '');
         // hook for custom modifications of the indexed data, e. g. the tags
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyAddressIndexEntry'])) {
             foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyAddressIndexEntry'] as $_classRef) {
                 if (TYPO3_VERSION_INTEGER >= 7000000) {
                     $_procObj =& TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
                 } else {
                     $_procObj =& t3lib_div::getUserObj($_classRef);
                 }
                 $_procObj->modifyAddressIndexEntry($title, $abstract, $fullContent, $params, $tagContent, $addressRow, $additionalFields, $indexerConfig, $customfields);
             }
         }
         // store in index
         $this->pObj->storeInIndex($indexerConfig['storagepid'], $title, 'tt_address', $indexerConfig['targetpid'], $fullContent, $tagContent, $params, $abstract, $customfields['sys_language_uid'], $customfields['starttime'], $customfields['endtime'], $customfields['fe_group'], false, $additionalFields);
     }
     $content = '<p><b>Indexer "' . $this->indexerConfig['title'] . '": ' . $resCount . ' address records have been indexed.</b></p>' . "\n";
     $content .= $this->showErrors();
     $content .= $this->showTime();
     return $content;
 }
Exemplo n.º 30
0
 /**
  * Fetches the meta data from the index by a given where clause.
  * All selected records will be returned which means an array of meta data arrays.
  * If the uid field is selected it will be used as index in the returned array.
  * Additional WHERE clauses are appended to limit access to non-deleted entries and so on.
  *
  * @param	string		$fields A list of fields to be fetched. Default is a list of fields generated by tx_dam_db::getMetaInfoFieldList().
  * @param	array		$whereClauses WHERE clauses as array with associative keys (which can be used to overwrite 'enableFields' or 'pidList') or a single one as string.
  * @param	string		$groupBy Optional GROUP BY field(s), if none, supply blank string.
  * @param	string		$orderBy Optional ORDER BY field(s), if none, supply blank string.
  * @param	string		$limit Optional LIMIT value ([begin,]max), if none, supply blank string.
  * @return	array		Array of meta data arrays or false
  */
 function getDataWhere($select_fields, $whereClauses = array(), $groupBy = '', $orderBy = '', $limit = '')
 {
     $rows = array();
     $select_fields = $select_fields ? $select_fields : tx_dam_db::getMetaInfoFieldList();
     $where = tx_dam_db::fillWhereClauseArray($whereClauses);
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select_fields, 'tx_dam', implode(' AND ', $where), $groupBy, $orderBy, $limit);
     #debug ($GLOBALS['TYPO3_DB']->SELECTquery($select_fields, 'tx_dam', implode(' AND ', $where), $groupBy, $orderBy, $limit), 'getDataWhere');
     if ($res) {
         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             // Is there a workspace overlay?
             if (isset($GLOBALS['BE_USER']->workspace) && $GLOBALS['BE_USER']->workspace !== 0) {
                 if (isset($GLOBALS['TSFE'])) {
                     // we are in frontend
                     $GLOBALS['TSFE']->sys_page->versionOL('tx_dam', $row);
                 } else {
                     // it's the backend
                     t3lib_befunc::workspaceOL('tx_dam', $row);
                 }
             }
             if (isset($row['uid'])) {
                 $rows[$row['uid']] = $row;
             } else {
                 $rows[] = $row;
             }
         }
     }
     return $rows;
 }