/** * Check all "root" sys_templates and try to find the value for config.sys_language_mode */ public function getLangModes() { $message = ''; $checked = array('ok' => array(), 'fail' => array()); $value = $GLOBALS['LANG']->sL('LLL:EXT:languagevisibility/locallang_db.xml:reports.ok.value'); $severity = tx_reports_reports_status_Status::OK; $rootTpls = t3lib_BEfunc::getRecordsByField('sys_template', 'root', '1', '', 'pid'); foreach ($rootTpls as $tpl) { /** * @var t3lib_tsparser_ext */ $tmpl = t3lib_div::makeInstance("t3lib_tsparser_ext"); $tmpl->tt_track = 0; $tmpl->init(); // Gets the rootLine $sys_page = t3lib_div::makeInstance("t3lib_pageSelect"); $rootLine = $sys_page->getRootLine($tpl['pid']); $tmpl->runThroughTemplates($rootLine, $tpl['uid']); $tplRow = $tmpl->ext_getFirstTemplate($tpl['pid'], $tpl['uid']); $tmpl->generateConfig(); if (!isset($tmpl->setup['config.']['sys_language_mode']) || $tmpl->setup['config.']['sys_language_mode'] != 'ignore') { $checked['fail'][] = array($tpl['pid'], $tpl['uid'], $tmpl->setup['config.']['sys_language_mode']); } } if (count($checked['fail'])) { $severity = tx_reports_reports_status_Status::WARNING; $value = $GLOBALS['LANG']->sL('LLL:EXT:languagevisibility/locallang_db.xml:reports.fail.value'); $message .= $GLOBALS['LANG']->sL('LLL:EXT:languagevisibility/locallang_db.xml:reports.fail.message') . '<br/>'; foreach ($checked['fail'] as $fail) { $message .= vsprintf($GLOBALS['LANG']->sL('LLL:EXT:languagevisibility/locallang_db.xml:reports.fail.message.detail'), $fail) . '<br />'; } } return t3lib_div::makeInstance('tx_reports_reports_status_Status', 'EXT:languagevisibility config.sys_language_mode', $value, $message, $severity); }
/** * @param integer $uid * @return array */ protected function getAllSubPages($uid) { $completeRecords = t3lib_BEfunc::getRecordsByField('pages', 'pid', $uid); $return = array($uid); if (count($completeRecords) > 0) { foreach ($completeRecords as $record) { $return = array_merge($return, $this->getAllSubPages($record['uid'])); } } return $return; }
/** * Gets rootline of a table downwards * * @param string $theTable: Database table * @param string $parentField: Database field to check with third parameter * @param mixed $uids: Uids of (different) parents * @return string An rootline array * */ public static function getRootLineUpwards($theTable, $parentField, $uids) { if (!is_array($uids)) { $uids = tx_cpsdevlib_div::explode($uids); } $rootLine = array(); foreach ($uids as $uid) { $result = t3lib_BEfunc::getRecordsByField($theTable, 'uid', $uid); $rL = array(); if (count($result)) { $rL = self::getRootLineUpwards($theTable, $parentField, $result[0][$parentField]); } $rootLine[$uid] = $rL; } return $rootLine; }
/** * Adds items to the ->MOD_MENU array. Used for the function menu selector. * * @return void */ function menuConfig() { global $LANG; $this->MOD_MENU = array('users' => array('-1' => $LANG->getLL('loggedInUsers'), '0' => $LANG->getLL('notLoggedIn'), '' => '------------------------------'), 'mode' => array('-1' => $LANG->getLL('allTime'), '1' => $LANG->getLL('byTime'))); foreach (t3lib_BEfunc::getRecordsByField('fe_users', 1, 1) as $user) { $this->MOD_MENU['users'][$user['uid']] = $user['username']; } parent::menuConfig(); $set = t3lib_div::_GP('SET'); if ($set['time']) { $dateFrom = strtotime($set['time']['from']); $dateTo = strtotime($set['time']['to']); $set['time']['from'] = $dateFrom > 0 ? date('d.m.Y', $dateFrom) : ''; $set['time']['to'] = $dateTo > 0 ? date('d.m.Y', $dateTo) : ''; $mergedSettings = t3lib_div::array_merge($this->MOD_SETTINGS, $set); $GLOBALS['BE_USER']->pushModuleData($this->MCONF['name'], $mergedSettings); $this->MOD_SETTINGS = $mergedSettings; } }
/** * add localized page records to a cache/globalArray * This is much faster than requesting the DB for each tt_content-record * * @param array $pageRow * @return void */ public function addLocalizedPagesToCache($pageRow) { // create entry in cachedPageRecods for default language $this->cachedPageRecords[0][$pageRow['uid']] = $pageRow; // create entry in cachedPageRecods for additional languages, skip default language 0 foreach ($this->sysLanguages as $sysLang) { if ($sysLang[1] > 0) { if (TYPO3_VERSION_INTEGER >= 7000000) { list($pageOverlay) = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('pages_language_overlay', 'pid', $pageRow['uid'], 'AND sys_language_uid=' . intval($sysLang[1])); } else { list($pageOverlay) = t3lib_BEfunc::getRecordsByField('pages_language_overlay', 'pid', $pageRow['uid'], 'AND sys_language_uid=' . intval($sysLang[1])); } if ($pageOverlay) { if (TYPO3_VERSION_INTEGER >= 7000000) { $this->cachedPageRecords[$sysLang[1]][$pageRow['uid']] = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge($pageRow, $pageOverlay); } else { $this->cachedPageRecords[$sysLang[1]][$pageRow['uid']] = t3lib_div::array_merge($pageRow, $pageOverlay); } } } } }
/** * Find l10n-overlay records and perform the requested delete action for these records. * * @param string $table: Record Table * @param string $uid: Record UID * @return void */ function deleteL10nOverlayRecords($table, $uid) { // Check whether table can be localized or has a different table defined to store localizations: if (!t3lib_BEfunc::isTableLocalizable($table) || !empty($GLOBALS['TCA'][$table]['ctrl']['transForeignTable']) || !empty($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'])) { return; } $where = ''; if (isset($GLOBALS['TCA'][$table]['ctrl']['versioningWS'])) { $where = ' AND t3ver_oid=0'; } $l10nRecords = t3lib_BEfunc::getRecordsByField($table, $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'], $uid, $where); if (is_array($l10nRecords)) { foreach ($l10nRecords as $record) { $this->deleteAction($table, intval($record['t3ver_oid']) > 0 ? intval($record['t3ver_oid']) : intval($record['uid'])); } } }
/** * Rendering the quick-edit view. * * @return void */ function renderQuickEdit() { global $LANG, $BE_USER, $BACK_PATH; // Alternative template $this->doc->setModuleTemplate('templates/db_layout_quickedit.html'); // Alternative form tag; Quick Edit submits its content to tce_db.php. $this->doc->form = '<form action="' . htmlspecialchars($BACK_PATH . 'tce_db.php?&prErr=1&uPT=1') . '" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '" name="editform" onsubmit="return TBE_EDITOR.checkSubmit(1);">'; // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); // Set the edit_record value for internal use in this function: $edit_record = $this->edit_record; // If a command to edit all records in a column is issue, then select all those elements, and redirect to alt_doc.php: if (substr($edit_record, 0, 9) == '_EDIT_COL') { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', 'pid=' . intval($this->id) . ' AND colPos=' . intval(substr($edit_record, 10)) . ' AND sys_language_uid=' . intval($this->current_sys_language) . ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : t3lib_BEfunc::BEenableFields('tt_content')) . t3lib_BEfunc::deleteClause('tt_content') . t3lib_BEfunc::versioningPlaceholderClause('tt_content'), '', 'sorting'); $idListA = array(); while ($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $idListA[] = $cRow['uid']; } $url = $BACK_PATH . 'alt_doc.php?edit[tt_content][' . implode(',', $idListA) . ']=edit&returnUrl=' . rawurlencode($this->local_linkThisScript(array('edit_record' => ''))); t3lib_utility_Http::redirect($url); } // If the former record edited was the creation of a NEW record, this will look up the created records uid: if ($this->new_unique_uid) { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_log', 'userid=' . intval($BE_USER->user['uid']) . ' AND NEWid=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->new_unique_uid, 'sys_log')); $sys_log_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); if (is_array($sys_log_row)) { $edit_record = $sys_log_row['tablename'] . ':' . $sys_log_row['recuid']; } } // Creating the selector box, allowing the user to select which element to edit: $opt = array(); $is_selected = 0; $languageOverlayRecord = ''; if ($this->current_sys_language) { list($languageOverlayRecord) = t3lib_BEfunc::getRecordsByField('pages_language_overlay', 'pid', $this->id, 'AND sys_language_uid=' . intval($this->current_sys_language)); } if (is_array($languageOverlayRecord)) { $inValue = 'pages_language_overlay:' . $languageOverlayRecord['uid']; $is_selected += intval($edit_record == $inValue); $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $LANG->getLL('editLanguageHeader', 1) . ' ]</option>'; } else { $inValue = 'pages:' . $this->id; $is_selected += intval($edit_record == $inValue); $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $LANG->getLL('editPageProperties', 1) . ' ]</option>'; } // Selecting all content elements from this language and allowed colPos: $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', 'pid=' . intval($this->id) . ' AND sys_language_uid=' . intval($this->current_sys_language) . ' AND colPos IN (' . $this->colPosList . ')' . ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : t3lib_BEfunc::BEenableFields('tt_content')) . t3lib_Befunc::deleteClause('tt_content') . t3lib_BEfunc::versioningPlaceholderClause('tt_content'), '', 'colPos,sorting'); $colPos = ''; $first = 1; $prev = $this->id; // Page is the pid if no record to put this after. while ($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { t3lib_BEfunc::workspaceOL('tt_content', $cRow); if (is_array($cRow)) { if ($first) { if (!$edit_record) { $edit_record = 'tt_content:' . $cRow['uid']; } $first = 0; } if (strcmp($cRow['colPos'], $colPos)) { $colPos = $cRow['colPos']; $opt[] = '<option value=""></option>'; $opt[] = '<option value="_EDIT_COL:' . $colPos . '">__' . $LANG->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content', 'colPos', $colPos), 1) . ':__</option>'; } $inValue = 'tt_content:' . $cRow['uid']; $is_selected += intval($edit_record == $inValue); $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>' . htmlspecialchars(t3lib_div::fixed_lgd_cs($cRow['header'] ? $cRow['header'] : '[' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.no_title') . '] ' . strip_tags($cRow['bodytext']), $BE_USER->uc['titleLen'])) . '</option>'; $prev = -$cRow['uid']; } } // If edit_record is not set (meaning, no content elements was found for this language) we simply set it to create a new element: if (!$edit_record) { $edit_record = 'tt_content:new/' . $prev . '/' . $colPos; $inValue = 'tt_content:new/' . $prev . '/' . $colPos; $is_selected += intval($edit_record == $inValue); $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $LANG->getLL('newLabel', 1) . ' ]</option>'; } // If none is yet selected... if (!$is_selected) { $opt[] = '<option value=""></option>'; $opt[] = '<option value="' . $edit_record . '" selected="selected">[ ' . $LANG->getLL('newLabel', 1) . ' ]</option>'; } // Splitting the edit-record cmd value into table/uid: $this->eRParts = explode(':', $edit_record); // Delete-button flag? $this->deleteButton = t3lib_div::testInt($this->eRParts[1]) && $edit_record && ($this->eRParts[0] != 'pages' && $this->EDIT_CONTENT || $this->eRParts[0] == 'pages' && $this->CALC_PERMS & 4); // If undo-button should be rendered (depends on available items in sys_history) $this->undoButton = 0; $undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->eRParts[0], 'sys_history') . ' AND recuid=' . intval($this->eRParts[1]), '', 'tstamp DESC', '1'); if ($this->undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) { $this->undoButton = 1; } // Setting up the Return URL for coming back to THIS script (if links take the user to another script) $R_URL_parts = parse_url(t3lib_div::getIndpEnv('REQUEST_URI')); $R_URL_getvars = t3lib_div::_GET(); unset($R_URL_getvars['popView']); unset($R_URL_getvars['new_unique_uid']); $R_URL_getvars['edit_record'] = $edit_record; $this->R_URI = $R_URL_parts['path'] . '?' . t3lib_div::implodeArrayForUrl('', $R_URL_getvars); // Setting close url/return url for exiting this script: $this->closeUrl = $this->local_linkThisScript(array('SET' => array('function' => 1))); // Goes to 'Columns' view if close is pressed (default) if ($BE_USER->uc['condensedMode']) { $this->closeUrl = $BACK_PATH . 'alt_db_navframe.php'; } if ($this->returnUrl) { $this->closeUrl = $this->returnUrl; } // Return-url for JavaScript: $retUrlStr = $this->returnUrl ? "+'&returnUrl='+'" . rawurlencode($this->returnUrl) . "'" : ''; // Drawing the edit record selectbox $this->editSelect = '<select name="edit_record" onchange="' . htmlspecialchars('jumpToUrl(\'db_layout.php?id=' . $this->id . '&edit_record=\'+escape(this.options[this.selectedIndex].value)' . $retUrlStr . ',this);') . '">' . implode('', $opt) . '</select>'; // Creating editing form: if ($BE_USER->check('tables_modify', $this->eRParts[0]) && $edit_record && ($this->eRParts[0] != 'pages' && $this->EDIT_CONTENT || $this->eRParts[0] == 'pages' && $this->CALC_PERMS & 1)) { // Splitting uid parts for special features, if new: list($uidVal, $ex_pid, $ex_colPos) = explode('/', $this->eRParts[1]); // Convert $uidVal to workspace version if any: if ($uidVal != 'new') { if ($draftRecord = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $this->eRParts[0], $uidVal, 'uid')) { $uidVal = $draftRecord['uid']; } } // Initializing transfer-data object: $trData = t3lib_div::makeInstance('t3lib_transferData'); $trData->addRawData = TRUE; $trData->defVals[$this->eRParts[0]] = array('colPos' => intval($ex_colPos), 'sys_language_uid' => intval($this->current_sys_language)); $trData->disableRTE = $this->MOD_SETTINGS['disableRTE']; $trData->lockRecords = 1; $trData->fetchRecord($this->eRParts[0], $uidVal == 'new' ? $this->id : $uidVal, $uidVal); // 'new' // Getting/Making the record: reset($trData->regTableItems_data); $rec = current($trData->regTableItems_data); if ($uidVal == 'new') { $new_unique_uid = uniqid('NEW'); $rec['uid'] = $new_unique_uid; $rec['pid'] = intval($ex_pid) ? intval($ex_pid) : $this->id; $recordAccess = TRUE; } else { $rec['uid'] = $uidVal; // Checking internals access: $recordAccess = $BE_USER->recordEditAccessInternals($this->eRParts[0], $uidVal); } if (!$recordAccess) { // If no edit access, print error message: $content .= $this->doc->section($LANG->getLL('noAccess'), $LANG->getLL('noAccess_msg') . '<br /><br />' . ($BE_USER->errorMsg ? 'Reason: ' . $BE_USER->errorMsg . '<br /><br />' : ''), 0, 1); } elseif (is_array($rec)) { // If the record is an array (which it will always be... :-) // Create instance of TCEforms, setting defaults: $tceforms = t3lib_div::makeInstance('t3lib_TCEforms'); $tceforms->backPath = $BACK_PATH; $tceforms->initDefaultBEMode(); $tceforms->fieldOrder = $this->modTSconfig['properties']['tt_content.']['fieldOrder']; $tceforms->palettesCollapsed = !$this->MOD_SETTINGS['showPalettes']; $tceforms->disableRTE = $this->MOD_SETTINGS['disableRTE']; $tceforms->enableClickMenu = TRUE; // Clipboard is initialized: $tceforms->clipObj = t3lib_div::makeInstance('t3lib_clipboard'); // Start clipboard $tceforms->clipObj->initializeClipboard(); // Initialize - reads the clipboard content from the user session if ($BE_USER->uc['edit_showFieldHelp'] != 'text' && $this->MOD_SETTINGS['showDescriptions']) { $tceforms->edit_showFieldHelp = 'text'; } // Render form, wrap it: $panel = ''; $panel .= $tceforms->getMainFields($this->eRParts[0], $rec); $panel = $tceforms->wrapTotal($panel, $rec, $this->eRParts[0]); // Add hidden fields: $theCode = $panel; if ($uidVal == 'new') { $theCode .= '<input type="hidden" name="data[' . $this->eRParts[0] . '][' . $rec['uid'] . '][pid]" value="' . $rec['pid'] . '" />'; } $theCode .= ' <input type="hidden" name="_serialNumber" value="' . md5(microtime()) . '" /> <input type="hidden" name="_disableRTE" value="' . $tceforms->disableRTE . '" /> <input type="hidden" name="edit_record" value="' . $edit_record . '" /> <input type="hidden" name="redirect" value="' . htmlspecialchars($uidVal == 'new' ? t3lib_extMgm::extRelPath('cms') . 'layout/db_layout.php?id=' . $this->id . '&new_unique_uid=' . $new_unique_uid . '&returnUrl=' . rawurlencode($this->returnUrl) : $this->R_URI) . '" /> ' . t3lib_TCEforms::getHiddenTokenField('tceAction'); // Add JavaScript as needed around the form: $theCode = $tceforms->printNeededJSFunctions_top() . $theCode . $tceforms->printNeededJSFunctions(); // Add warning sign if record was "locked": if ($lockInfo = t3lib_BEfunc::isRecordLocked($this->eRParts[0], $rec['uid'])) { $lockedMessage = t3lib_div::makeInstance('t3lib_FlashMessage', htmlspecialchars($lockInfo['msg']), '', t3lib_FlashMessage::WARNING); t3lib_FlashMessageQueue::addMessage($lockedMessage); } // Add whole form as a document section: $content .= $this->doc->section('', $theCode); } } else { // If no edit access, print error message: $content .= $this->doc->section($LANG->getLL('noAccess'), $LANG->getLL('noAccess_msg') . '<br /><br />', 0, 1); } // Bottom controls (function menus): $q_count = $this->getNumberOfHiddenElements(); $h_func_b = t3lib_BEfunc::getFuncCheck($this->id, 'SET[tt_content_showHidden]', $this->MOD_SETTINGS['tt_content_showHidden'], 'db_layout.php', '', 'id="checkTt_content_showHidden"') . '<label for="checkTt_content_showHidden">' . (!$q_count ? $GLOBALS['TBE_TEMPLATE']->dfw($LANG->getLL('hiddenCE', 1)) : $LANG->getLL('hiddenCE', 1) . ' (' . $q_count . ')') . '</label>'; $h_func_b .= '<br />' . t3lib_BEfunc::getFuncCheck($this->id, 'SET[showPalettes]', $this->MOD_SETTINGS['showPalettes'], 'db_layout.php', '', 'id="checkShowPalettes"') . '<label for="checkShowPalettes">' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showPalettes', 1) . '</label>'; if (t3lib_extMgm::isLoaded('context_help') && $BE_USER->uc['edit_showFieldHelp'] != 'text') { $h_func_b .= '<br />' . t3lib_BEfunc::getFuncCheck($this->id, 'SET[showDescriptions]', $this->MOD_SETTINGS['showDescriptions'], 'db_layout.php', '', 'id="checkShowDescriptions"') . '<label for="checkShowDescriptions">' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showDescriptions', 1) . '</label>'; } if ($BE_USER->isRTE()) { $h_func_b .= '<br />' . t3lib_BEfunc::getFuncCheck($this->id, 'SET[disableRTE]', $this->MOD_SETTINGS['disableRTE'], 'db_layout.php', '', 'id="checkDisableRTE"') . '<label for="checkDisableRTE">' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.disableRTE', 1) . '</label>'; } // Add the function menus to bottom: $content .= $this->doc->section('', $h_func_b, 0, 0); $content .= $this->doc->spacer(10); // Select element matrix: if ($this->eRParts[0] == 'tt_content' && t3lib_div::testInt($this->eRParts[1])) { $posMap = t3lib_div::makeInstance('ext_posMap'); $posMap->backPath = $BACK_PATH; $posMap->cur_sys_language = $this->current_sys_language; $HTMLcode = ''; // CSH: $HTMLcode .= t3lib_BEfunc::cshItem($this->descrTable, 'quickEdit_selElement', $BACK_PATH, '|<br />'); $HTMLcode .= $posMap->printContentElementColumns($this->id, $this->eRParts[1], $this->colPosList, $this->MOD_SETTINGS['tt_content_showHidden'], $this->R_URI); $content .= $this->doc->spacer(20); $content .= $this->doc->section($LANG->getLL('CEonThisPage'), $HTMLcode, 0, 1); $content .= $this->doc->spacer(20); } // Finally, if comments were generated in TCEforms object, print these as a HTML comment: if (count($tceforms->commentMessages)) { $content .= ' <!-- TCEFORM messages ' . htmlspecialchars(implode(LF, $tceforms->commentMessages)) . ' --> '; } return $content; }
/** * Indicate that the required be_user "_cli_crawler" is * has no admin rights. * * @access protected * @return boolean * * @author Michael Klapper <*****@*****.**> */ protected function isCrawlerUserNotAdmin() { $isAvailable = false; $userArray = t3lib_BEfunc::getRecordsByField('be_users', 'username', '_cli_crawler'); if (is_array($userArray) && $userArray[0]['admin'] == 0) { $isAvailable = true; } return $isAvailable; }
/** * For RTE/link: Parses the incoming URL and determines if it's a page, file, external or mail address. * * @param string HREF value tp analyse * @param string The URL of the current website (frontend) * @return array Array with URL information stored in assoc. keys: value, act (page, file, spec, mail), pageid, cElement, info */ function parseCurUrl($href, $siteUrl) { $href = trim($href); if ($href) { $info = array(); // Default is "url": $info['value'] = $href; $info['act'] = 'url'; $specialParts = explode('#_SPECIAL', $href); if (count($specialParts) == 2) { // Special kind (Something RTE specific: User configurable links through: "userLinks." from ->thisConfig) $info['value'] = '#_SPECIAL' . $specialParts[1]; $info['act'] = 'spec'; } elseif (t3lib_div::isFirstPartOfStr($href, $siteUrl)) { // If URL is on the current frontend website: $rel = substr($href, strlen($siteUrl)); if (file_exists(PATH_site . rawurldecode($rel))) { // URL is a file, which exists: $info['value'] = rawurldecode($rel); if (@is_dir(PATH_site . $info['value'])) { $info['act'] = 'folder'; } else { $info['act'] = 'file'; } } else { // URL is a page (id parameter) $uP = parse_url($rel); if (!trim($uP['path'])) { $pp = preg_split('/^id=/', $uP['query']); $pp[1] = preg_replace('/&id=[^&]*/', '', $pp[1]); $parameters = explode('&', $pp[1]); $id = array_shift($parameters); if ($id) { // Checking if the id-parameter is an alias. if (!t3lib_div::testInt($id)) { list($idPartR) = t3lib_BEfunc::getRecordsByField('pages', 'alias', $id); $id = intval($idPartR['uid']); } $pageRow = t3lib_BEfunc::getRecordWSOL('pages', $id); $titleLen = intval($GLOBALS['BE_USER']->uc['titleLen']); $info['value'] = $GLOBALS['LANG']->getLL('page', 1) . " '" . htmlspecialchars(t3lib_div::fixed_lgd_cs($pageRow['title'], $titleLen)) . "' (ID:" . $id . ($uP['fragment'] ? ', #' . $uP['fragment'] : '') . ')'; $info['pageid'] = $id; $info['cElement'] = $uP['fragment']; $info['act'] = 'page'; $info['query'] = $parameters[0] ? '&' . implode('&', $parameters) : ''; } } } } else { // Email link: if (strtolower(substr($href, 0, 7)) == 'mailto:') { $info['value'] = trim(substr($href, 7)); $info['act'] = 'mail'; } } $info['info'] = $info['value']; } else { // NO value inputted: $info = array(); $info['info'] = $GLOBALS['LANG']->getLL('none'); $info['value'] = ''; $info['act'] = 'page'; } // let the hook have a look foreach ($this->hookObjects as $hookObject) { $info = $hookObject->parseCurrentUrl($href, $siteUrl, $info); } return $info; }
/** * Checks access to the record and adds the clear cache button * * @param array $params * @param template $pObj * * @return void */ public function addButton($params, $pObj) { $this->params = $params; $this->pObj = $pObj; $record = array(); $table = ''; // For web -> page view or web -> list view if ($this->pObj->scriptID === 'ext/cms/layout/db_layout.php' || $this->pObj->scriptID === 'ext/recordlist/mod1/index.php') { $id = t3lib_div::_GP('id'); if (is_object($GLOBALS['SOBE']) && $GLOBALS['SOBE']->current_sys_language) { $table = 'pages_language_overlay'; $record = t3lib_BEfunc::getRecordsByField($table, 'pid', $id, ' AND ' . $table . '.sys_language_uid=' . intval($GLOBALS['SOBE']->current_sys_language), '', '', '1'); if (is_array($record) && !empty($record)) { $record = $record[0]; } } else { $table = 'pages'; $record = array('uid' => $id, 'pid' => $id); } } elseif ($this->pObj->scriptID === 'typo3/alt_doc.php') { // For record edit $editConf = t3lib_div::_GP('edit'); if (is_array($editConf) && !empty($editConf)) { // Finding the current table reset($editConf); $table = key($editConf); // Finding the first id and get the records pid reset($editConf[$table]); $recordUid = key($editConf[$table]); // If table is pages we need uid (as pid) to get TSconfig if ($table === 'pages') { $record['uid'] = $recordUid; $record['pid'] = $recordUid; } else { $record = t3lib_BEfunc::getRecord($table, $recordUid, 'uid, pid'); } } } if (isset($record['pid']) && $record['pid'] > 0) { if ($this->isModuleAccessible($record['pid'], $table)) { // Process last request $button = $this->process($table, $record['uid']); // Generate button with form for list view if ($this->pObj->scriptID === 'ext/recordlist/mod1/index.php') { $button .= $this->generateButton(TRUE); } else { // Generate plain input button $button .= $this->generateButton(); } // Add button to button list and extend layout $this->params['buttons']['vcc'] = $button; $buttonWrap = t3lib_parsehtml::getSubpart($pObj->moduleTemplate, '###BUTTON_GROUP_WRAP###'); $this->params['markers']['BUTTONLIST_LEFT'] .= t3lib_parsehtml::substituteMarker($buttonWrap, '###BUTTONS###', trim($button)); } } }
/** * Obtains system languages. * * @return array */ protected function getSystemLanguages() { $languages = (array)t3lib_BEfunc::getRecordsByField('sys_language','pid',0,'','','title'); $defaultLanguageLabel = $this->getDefaultLanguageName(); array_unshift($languages, array('uid' => 0, 'title' => $defaultLanguageLabel)); array_unshift($languages, array('uid' => '', 'title' => $GLOBALS['LANG']->getLL('all_languages'))); return $languages; }
/** * Look up and return page uid for alias * * @param integer Page alias string value * @return integer Page uid corresponding to alias value. */ function getPageIdFromAlias($link_param) { $pRec = t3lib_BEfunc::getRecordsByField('pages', 'alias', $link_param); return $pRec[0]['uid']; }
/** * Processes the CURL request and sends action to Varnish server * * @param string $url * @param integer $pid * @param string $host * @param boolean $quote * * @return array */ protected function processClearCacheCommand($url, $pid, $host = '', $quote = TRUE) { $responseArray = array(); foreach ($this->serverArray as $server) { $response = array('server' => $server); // Build request if ($this->stripSlash) { $url = rtrim($url, '/'); } $request = $server . '/' . ltrim($url, '/'); $response['request'] = $request; // Check for curl functions if (!function_exists('curl_init')) { // TODO: Implement fallback to file_get_contents() $response['status'] = t3lib_FlashMessage::ERROR; $response['message'] = 'No curl_init available'; } else { // If no host was given we need to loop over all $hostArray = array(); if ($host !== '') { $hostArray = t3lib_div::trimExplode(',', $host, 1); } else { // Get all (non-redirecting) domains from root $rootLine = t3lib_BEfunc::BEgetRootLine($pid); foreach ($rootLine as $row) { $domainArray = t3lib_BEfunc::getRecordsByField('sys_domain', 'pid', $row['uid'], ' AND redirectTo="" AND hidden=0'); if (is_array($domainArray) && !empty($domainArray)) { foreach ($domainArray as $domain) { $hostArray[] = $domain['domainName']; } unset($domain); } } unset($row); } // Fallback to current server if (empty($hostArray)) { $domain = rtrim(t3lib_div::getIndpEnv('TYPO3_SITE_URL'), '/'); $hostArray[] = substr($domain, strpos($domain, '://') + 3); } // Loop over hosts foreach ($hostArray as $xHost) { $response['host'] = $xHost; // Curl initialization $ch = curl_init(); // Disable direct output curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Only get header response curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_NOBODY, 1); // Set url curl_setopt($ch, CURLOPT_URL, $request); // Set method and protocol curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $this->httpMethod); curl_setopt($ch, CURLOPT_HTTP_VERSION, $this->httpProtocol === 'http_10' ? CURL_HTTP_VERSION_1_0 : CURL_HTTP_VERSION_1_1); // Set X-Host and X-Url header curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-Host: ' . ($quote ? preg_quote($xHost) : $xHost), 'X-Url: ' . ($quote ? preg_quote($url) : $url))); // Store outgoing header curl_setopt($ch, CURLINFO_HEADER_OUT, 1); // Include preProcess hook (e.g. to set some alternative curl options foreach ($this->hookObjects as $hookObject) { /** @var tx_vcc_hook_communicationServiceHookInterface $hookObject */ $hookObject->preProcess($ch, $request, $response, $this); } unset($hookObject); $header = curl_exec($ch); if (!curl_error($ch)) { $response['status'] = curl_getinfo($ch, CURLINFO_HTTP_CODE) == 200 ? t3lib_FlashMessage::OK : t3lib_FlashMessage::ERROR; $response['message'] = preg_split('/(\\r|\\n)+/m', trim($header)); } else { $response['status'] = t3lib_FlashMessage::ERROR; $response['message'] = array(curl_error($ch)); } $response['requestHeader'] = preg_split('/(\\r|\\n)+/m', trim(curl_getinfo($ch, CURLINFO_HEADER_OUT))); // Include postProcess hook (e.g. to start some other jobs) foreach ($this->hookObjects as $hookObject) { /** @var tx_vcc_hook_communicationServiceHookInterface $hookObject */ $hookObject->postProcess($ch, $request, $response, $this); } unset($hookObject); curl_close($ch); // Log debug information $logData = array('url' => $url, 'pid' => $pid, 'host' => $host, 'response' => $response); $logType = $response['status'] == t3lib_FlashMessage::OK ? tx_vcc_service_loggingService::OK : tx_vcc_service_loggingService::ERROR; $this->loggingService->log('CommunicationService::processClearCacheCommand', $logData, $logType, $pid, 3); $responseArray[] = $response; } unset($xHost); } } unset($server); return $responseArray; }
/** * Create search form * * @return string HTML */ function renderSearchForm() { $output.= '<br/>'; $output.= '<br/>'; // Language selector: $sys_languages = t3lib_BEfunc::getRecordsByField('sys_language','pid',0,'','','title'); // Masi: fix if no sys_language records defined if (!is_array($sys_languages)) { $sys_languages = array(); } array_unshift($sys_languages,array('uid' => 0, 'title' => 'Default')); array_unshift($sys_languages,array('uid' => '', 'title' => 'All languages')); $options = array(); $showLanguage = t3lib_div::_GP('showLanguage'); foreach($sys_languages as $record) { $options[] = ' <option value="'.htmlspecialchars($record['uid']).'"'.(!strcmp($showLanguage,$record['uid']) ? 'selected="selected"' : '').'>'.htmlspecialchars($record['title'].' ['.$record['uid'].']').'</option>'; } $output.= 'Only language: <select name="showLanguage">'.implode('', $options).'</select><br/>'; // Search path: $output.= 'Path: <input type="text" name="pathPrefixSearch" value="'.htmlspecialchars(t3lib_div::_GP('pathPrefixSearch')).'" />'; $output.= '<input type="submit" name="_" value="Look up" />'; $output.= '<br/>'; // Search / Replace part: if ($this->searchResultCounter && !t3lib_div::_POST('_replace') && !t3lib_div::_POST('_delete')) { $output.= '<br/><b>'.sprintf('%s results found.',$this->searchResultCounter).'</b><br/>'; $output.= 'Replace with: <input type="text" name="pathPrefixReplace" value="'.htmlspecialchars(t3lib_div::_GP('pathPrefixSearch')).'" />'; $output.= '<input type="submit" name="_replace" value="Replace" /> - <input type="submit" name="_delete" value="Delete" /><br/>'; } // Hidden fields: $output.= '<input type="hidden" name="id" value="'.htmlspecialchars($this->pObj->id).'" />'; $output.= '<br/>'; return $output; }
/** * Set all deleted rows * * @param integer $id: UID from record * @param string $table: Tablename from record * @param integer $depth: How many levels recursive * @param array $ctrl: TCA CTRL Array * @param string $filter: Filter text * @return void */ protected function setData($id = 0, $table, $depth, $tcaCtrl, $filter) { $id = intval($id); if (array_key_exists('delete', $tcaCtrl)) { // find the 'deleted' field for this table $deletedField = tx_recycler_helper::getDeletedField($table); // create the filter WHERE-clause if (trim($filter) != '') { $filterWhere = ' AND (' . (t3lib_div::testInt($filter) ? 'uid = ' . $filter . ' OR pid = ' . $filter . ' OR ' : '') . $tcaCtrl['label'] . ' LIKE "%' . $this->escapeValueForLike($filter, $table) . '%"' . ')'; } // get the limit if ($this->limit != '') { // count the number of deleted records for this pid $deletedCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', $table, $deletedField . '!=0 AND pid = ' . $id . $filterWhere); // split the limit $parts = t3lib_div::trimExplode(',', $this->limit); $offset = $parts[0]; $rowCount = $parts[1]; // subtract the number of deleted records from the limit's offset $result = $offset - $deletedCount; // if the result is >= 0 if ($result >= 0) { // store the new offset in the limit and go into the next depth $offset = $result; $this->limit = implode(',', array($offset, $rowCount)); // do NOT query this depth; limit also does not need to be set, we set it anyways $allowQuery = false; $allowDepth = true; $limit = ''; // won't be queried anyways // if the result is < 0 } else { // the offset for the temporary limit has to remain like the original offset // in case the original offset was just crossed by the amount of deleted records if ($offset != 0) { $tempOffset = $offset; } else { $tempOffset = 0; } // set the offset in the limit to 0 $newOffset = 0; // convert to negative result to the positive equivalent $absResult = abs($result); // if the result now is > limit's row count if ($absResult > $rowCount) { // use the limit's row count as the temporary limit $limit = implode(',', array($tempOffset, $rowCount)); // set the limit's row count to 0 $this->limit = implode(',', array($newOffset, 0)); // do not go into new depth $allowDepth = false; } else { // if the result now is <= limit's row count // use the result as the temporary limit $limit = implode(',', array($tempOffset, $absResult)); // subtract the result from the row count $newCount = $rowCount - $absResult; // store the new result in the limit's row count $this->limit = implode(',', array($newOffset, $newCount)); // if the new row count is > 0 if ($newCount > 0) { // go into new depth $allowDepth = true; } else { // if the new row count is <= 0 (only =0 makes sense though) // do not go into new depth $allowDepth = false; } } // allow query for this depth $allowQuery = true; } } else { $limit = ''; $allowDepth = true; $allowQuery = true; } // query for actual deleted records if ($allowQuery) { $recordsToCheck = t3lib_BEfunc::getRecordsByField($table, $deletedField, '1', ' AND pid = ' . $id . $filterWhere, '', '', $limit, false); if ($recordsToCheck) { $this->checkRecordAccess($table, $recordsToCheck); } } // go into depth if ($allowDepth && $depth >= 1) { // check recursively for elements beneath this page $resPages = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'pid=' . $id, '', 'sorting'); if (is_resource($resPages)) { while ($rowPages = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resPages)) { $this->setData($rowPages['uid'], $table, $depth - 1, $tcaCtrl, $filter); // some records might have been added, check if we still have the limit for further queries if ('' != $this->limit) { $parts = t3lib_div::trimExplode(',', $this->limit); // abort loop if LIMIT 0,0 if ($parts[0] == 0 && $parts[1] == 0) { break; } } } $GLOBALS['TYPO3_DB']->sql_free_result($resPages); } } $this->label[$table] = $tcaCtrl['label']; $this->title[$table] = $tcaCtrl['title']; } }
/** * Check if user has access to all existing localizations for a certain record * * @param string the table * @param array the current record * @return boolean */ function checkFullLanguagesAccess($table, $record) { $recordLocalizationAccess = $this->checkLanguageAccess(0); if ($recordLocalizationAccess && (t3lib_BEfunc::isTableLocalizable($table) || isset($GLOBALS['TCA'][$table]['ctrl']['transForeignTable']))) { if (isset($GLOBALS['TCA'][$table]['ctrl']['transForeignTable'])) { $l10nTable = $GLOBALS['TCA'][$table]['ctrl']['transForeignTable']; $pointerField = $GLOBALS['TCA'][$l10nTable]['ctrl']['transOrigPointerField']; $pointerValue = $record['uid']; } else { $l10nTable = $table; $pointerField = $GLOBALS['TCA'][$l10nTable]['ctrl']['transOrigPointerField']; $pointerValue = $record[$pointerField] > 0 ? $record[$pointerField] : $record['uid']; } $recordLocalizations = t3lib_BEfunc::getRecordsByField($l10nTable, $pointerField, $pointerValue, '', '', '', '1'); if (is_array($recordLocalizations)) { foreach ($recordLocalizations as $localization) { $recordLocalizationAccess = $recordLocalizationAccess && $this->checkLanguageAccess($localization[$GLOBALS['TCA'][$l10nTable]['ctrl']['languageField']]); if (!$recordLocalizationAccess) { break; } } } } return $recordLocalizationAccess; }
/** * This methods returns an array of configurations. * And no urls! * * @param integer $id Page ID * @return array Configurations from pages and configuration records */ protected function getUrlsForPageId($id) { /** * Get configuration from tsConfig */ // Get page TSconfig for page ID: $pageTSconfig = $this->getPageTSconfigForId($id); $res = array(); if (is_array($pageTSconfig) && is_array($pageTSconfig['tx_crawler.']['crawlerCfg.'])) { $crawlerCfg = $pageTSconfig['tx_crawler.']['crawlerCfg.']; if (is_array($crawlerCfg['paramSets.'])) { foreach ($crawlerCfg['paramSets.'] as $key => $values) { if (!is_array($values)) { // Sub configuration for a single configuration string: $subCfg = (array) $crawlerCfg['paramSets.'][$key . '.']; $subCfg['key'] = $key; if (strcmp($subCfg['procInstrFilter'], '')) { $subCfg['procInstrFilter'] = implode(',', t3lib_div::trimExplode(',', $subCfg['procInstrFilter'])); } $pidOnlyList = implode(',', t3lib_div::trimExplode(',', $subCfg['pidsOnly'], 1)); // process configuration if it is not page-specific or if the specific page is the current page: if (!strcmp($subCfg['pidsOnly'], '') || t3lib_div::inList($pidOnlyList, $id)) { // add trailing slash if not present if (!empty($subCfg['baseUrl']) && substr($subCfg['baseUrl'], -1) != '/') { $subCfg['baseUrl'] .= '/'; } // Explode, process etc.: $res[$key] = array(); $res[$key]['subCfg'] = $subCfg; $res[$key]['paramParsed'] = $this->parseParams($values); $res[$key]['paramExpanded'] = $this->expandParameters($res[$key]['paramParsed'], $id); $res[$key]['origin'] = 'pagets'; // recognize MP value if (!$this->MP) { $res[$key]['URLs'] = $this->compileUrls($res[$key]['paramExpanded'], array('?id=' . $id)); } else { $res[$key]['URLs'] = $this->compileUrls($res[$key]['paramExpanded'], array('?id=' . $id . '&MP=' . $this->MP)); } } } } } } /** * Get configuration from tx_crawler_configuration records */ // get records along the rootline $rootLine = t3lib_BEfunc::BEgetRootLine($id); foreach ($rootLine as $page) { $configurationRecordsForCurrentPage = t3lib_BEfunc::getRecordsByField('tx_crawler_configuration', 'pid', intval($page['uid']), t3lib_BEfunc::BEenableFields('tx_crawler_configuration') . t3lib_BEfunc::deleteClause('tx_crawler_configuration')); if (is_array($configurationRecordsForCurrentPage)) { foreach ($configurationRecordsForCurrentPage as $configurationRecord) { // check access to the configuration record if (empty($configurationRecord['begroups']) || $GLOBALS['BE_USER']->isAdmin() || $this->hasGroupAccess($GLOBALS['BE_USER']->user['usergroup_cached_list'], $configurationRecord['begroups'])) { $pidOnlyList = implode(',', t3lib_div::trimExplode(',', $configurationRecord['pidsonly'], 1)); // process configuration if it is not page-specific or if the specific page is the current page: if (!strcmp($configurationRecord['pidsonly'], '') || t3lib_div::inList($pidOnlyList, $id)) { $key = $configurationRecord['name']; // don't overwrite previously defined paramSets if (!isset($res[$key])) { /* @var $TSparserObject t3lib_tsparser */ $TSparserObject = t3lib_div::makeInstance('t3lib_tsparser'); $TSparserObject->parse($configurationRecord['processing_instruction_parameters_ts']); $subCfg = array('procInstrFilter' => $configurationRecord['processing_instruction_filter'], 'procInstrParams.' => $TSparserObject->setup, 'baseUrl' => $this->getBaseUrlForConfigurationRecord($configurationRecord['base_url'], $configurationRecord['sys_domain_base_url']), 'realurl' => $configurationRecord['realurl'], 'cHash' => $configurationRecord['chash'], 'userGroups' => $configurationRecord['fegroups'], 'exclude' => $configurationRecord['exclude'], 'workspace' => $configurationRecord['sys_workspace_uid'], 'key' => $key); // add trailing slash if not present if (!empty($subCfg['baseUrl']) && substr($subCfg['baseUrl'], -1) != '/') { $subCfg['baseUrl'] .= '/'; } if (!in_array($id, $this->expandExcludeString($subCfg['exclude']))) { $res[$key] = array(); $res[$key]['subCfg'] = $subCfg; $res[$key]['paramParsed'] = $this->parseParams($configurationRecord['configuration']); $res[$key]['paramExpanded'] = $this->expandParameters($res[$key]['paramParsed'], $id); $res[$key]['URLs'] = $this->compileUrls($res[$key]['paramExpanded'], array('?id=' . $id . (abs($subCfg['workspace']) > 0 ? '&ADMCMD_view=1&ADMCMD_editIcons=0&ADMCMD_previewWS=' . $subCfg['workspace'] : ''))); $res[$key]['origin'] = 'tx_crawler_configuration_' . $configurationRecord['uid']; } } } } } } } if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['processUrls'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['processUrls'] as $func) { $params = array('res' => &$res); t3lib_div::callUserFunction($func, $params, $this); } } return $res; }
/** * Localizes the specified element and only points to the sub elements with references. * * @param integer $sourceElementUid: UID of the element to be copied * @param array $destinationPointer: flexform pointer to the destination location * @param array $destinationParentRecord: Database record of the destination location (either from table 'pages' or 'tt_content') * @return mixed The UID of the newly created copy or FALSE if an error occurred. * @access protected */ function process_localize($sourceElementUid, $destinationPointer, $destinationReferencesArr) { // Determine language record UID of the language we localize to: $staticLanguageRows = t3lib_BEfunc::getRecordsByField('static_languages', 'lg_iso_2', $destinationPointer['_languageKey']); if (is_array($staticLanguageRows) && isset($staticLanguageRows[0]['uid'])) { $languageRecords = t3lib_BEfunc::getRecordsByField('sys_language', 'static_lang_isocode', $staticLanguageRows[0]['uid']); } if (is_array($languageRecords) && isset($languageRecords[0]['uid'])) { $destinationLanguageUid = $languageRecords[0]['uid']; } else { if ($this->debug) { t3lib_div::devLog('API: process_localize(): Cannot localize element because sys_language record can not be found !', 'templavoila', 2); } return FALSE; } // Initialize TCEmain and create configuration for localizing the specified record $tce = t3lib_div::makeInstance('t3lib_TCEmain'); $cmdArray = array(); $cmdArray['tt_content'][$sourceElementUid]['localize'] = $destinationLanguageUid; // Execute the copy process and finally insert the reference for the element to the destination: $flagWasSet = $this->getTCEmainRunningFlag(); $this->setTCEmainRunningFlag(TRUE); $tce->start(array(), $cmdArray); $tce->process_cmdmap(); $newElementUid = $tce->copyMappingArray_merged['tt_content'][$sourceElementUid]; if (!$flagWasSet) { $this->setTCEmainRunningFlag(FALSE); } $newDestinationReferencesArr = $this->flexform_insertElementReferenceIntoList($destinationReferencesArr, $destinationPointer['position'], $newElementUid); $this->flexform_storeElementReferencesListInRecord($newDestinationReferencesArr, $destinationPointer); return $newElementUid; }
function TS_links_rte($value) { $value = $this->TS_AtagToAbs($value); // Split content by the TYPO3 pseudo tag "<link>": $blockSplit = $this->splitIntoBlock('link', $value, 1); foreach ($blockSplit as $k => $v) { $error = ''; if ($k % 2) { // block: $tagCode = t3lib_div::unQuoteFilenames(trim(substr($this->getFirstTag($v), 0, -1)), true); $link_param = $tagCode[1]; $href = ''; $siteUrl = $this->siteUrl(); // Parsing the typolink data. This parsing is roughly done like in tslib_content->typolink() if (strstr($link_param, '@')) { // mailadr $href = 'mailto:' . preg_replace('/^mailto:/i', '', $link_param); } elseif (substr($link_param, 0, 1) == '#') { // check if anchor $href = $siteUrl . $link_param; } else { $fileChar = intval(strpos($link_param, '/')); $urlChar = intval(strpos($link_param, '.')); // Detects if a file is found in site-root OR is a simulateStaticDocument. list($rootFileDat) = explode('?', $link_param); $rFD_fI = pathinfo($rootFileDat); if (trim($rootFileDat) && !strstr($link_param, '/') && (@is_file(PATH_site . $rootFileDat) || t3lib_div::inList('php,html,htm', strtolower($rFD_fI['extension'])))) { $href = $siteUrl . $link_param; } elseif ($urlChar && (strstr($link_param, '//') || !$fileChar || $urlChar < $fileChar)) { // url (external): If doubleSlash or if a '.' comes before a '/'. if (!preg_match('/^[a-z]*:\\/\\//', trim(strtolower($link_param)))) { $scheme = 'http://'; } else { $scheme = ''; } $href = $scheme . $link_param; } elseif ($fileChar) { // file (internal) $href = $siteUrl . $link_param; } else { // integer or alias (alias is without slashes or periods or commas, that is 'nospace,alphanum_x,lower,unique' according to tables.php!!) // Splitting the parameter by ',' and if the array counts more than 1 element it's a id/type/parameters triplet $pairParts = t3lib_div::trimExplode(',', $link_param, TRUE); $idPart = $pairParts[0]; $link_params_parts = explode('#', $idPart); $idPart = trim($link_params_parts[0]); $sectionMark = trim($link_params_parts[1]); if (!strcmp($idPart, '')) { $idPart = $this->recPid; } // If no id or alias is given, set it to class record pid // Checking if the id-parameter is an alias. if (!t3lib_div::testInt($idPart)) { list($idPartR) = t3lib_BEfunc::getRecordsByField('pages', 'alias', $idPart); $idPart = intval($idPartR['uid']); } $page = t3lib_BEfunc::getRecord('pages', $idPart); if (is_array($page)) { // Page must exist... // XCLASS changed from $href = $siteUrl .'?id=' . $idPart . ($pairParts[2] ? $pairParts[2] : '') . ($sectionMark ? '#' . $sectionMark : ''); $href = $idPart . ($pairParts[2] ? $pairParts[2] : '') . ($sectionMark ? '#' . $sectionMark : ''); // linkHandler - allowing links to start with registerd linkHandler e.g.. "record:" } elseif (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['typolinkLinkHandler'][array_shift(explode(':', $link_param))])) { $href = $link_param; } else { #$href = ''; $href = $siteUrl . '?id=' . $link_param; $error = 'No page found: ' . $idPart; } } } // Setting the A-tag: $bTag = '<a href="' . htmlspecialchars($href) . '"' . ($tagCode[2] && $tagCode[2] != '-' ? ' target="' . htmlspecialchars($tagCode[2]) . '"' : '') . ($tagCode[3] && $tagCode[3] != '-' ? ' class="' . htmlspecialchars($tagCode[3]) . '"' : '') . ($tagCode[4] ? ' title="' . htmlspecialchars($tagCode[4]) . '"' : '') . ($error ? ' rteerror="' . htmlspecialchars($error) . '" style="background-color: yellow; border:2px red solid; color: black;"' : '') . '>'; $eTag = '</a>'; $blockSplit[$k] = $bTag . $this->TS_links_rte($this->removeFirstAndLastTag($blockSplit[$k])) . $eTag; } } // Return content: return implode('', $blockSplit); }
/** * Check if user has access to all existing localizations for a certain record * * Patch adds hook and applies changes due to #13194 * * @param string the table * @param array the current record * @return boolean */ function checkFullLanguagesAccess($table, $record) { $recordLocalizationAccess = $this->checkLanguageAccess(0); if ($recordLocalizationAccess && (t3lib_BEfunc::isTableLocalizable($table) || isset($GLOBALS['TCA'][$table]['ctrl']['transForeignTable']))) { if (isset($GLOBALS['TCA'][$table]['ctrl']['transForeignTable'])) { $l10nTable = $GLOBALS['TCA'][$table]['ctrl']['transForeignTable']; $pointerField = $GLOBALS['TCA'][$l10nTable]['ctrl']['transOrigPointerField']; $pointerValue = $record['uid']; } else { $l10nTable = $table; $pointerField = $GLOBALS['TCA'][$l10nTable]['ctrl']['transOrigPointerField']; $pointerValue = $record[$pointerField] > 0 ? $record[$pointerField] : $record['uid']; } $recordLocalizations = t3lib_BEfunc::getRecordsByField($l10nTable, $pointerField, $pointerValue, '', '', '', '1'); if (is_array($recordLocalizations)) { foreach ($recordLocalizations as $localization) { $recordLocalizationAccess = $recordLocalizationAccess && $this->checkLanguageAccess($localization[$GLOBALS['TCA'][$l10nTable]['ctrl']['languageField']]); if (!$recordLocalizationAccess) { break; } } } } if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauthgroup.php']['checkFullLanguagesAccess'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauthgroup.php']['checkFullLanguagesAccess'] as $_funcRef) { $_params = array('table' => $table, 'row' => $record, 'recordLocalizationAccess' => $recordLocalizationAccess); $recordLocalizationAccess = t3lib_div::callUserFunction($_funcRef, $_params, $this); } } return $recordLocalizationAccess; }
/** * Renders Content Elements from the tt_content table from page id * * @param integer Page id * @return string HTML for the listing */ function getTable_tt_content($id) { global $TCA; $this->initializeLanguages(); // Initialize: $RTE = $GLOBALS['BE_USER']->isRTE(); $lMarg = 1; $showHidden = $this->tt_contentConfig['showHidden'] ? '' : t3lib_BEfunc::BEenableFields('tt_content'); $pageTitleParamForAltDoc = '&recTitle=' . rawurlencode(t3lib_BEfunc::getRecordTitle('pages', t3lib_BEfunc::getRecordWSOL('pages', $id), TRUE)); $GLOBALS['SOBE']->doc->getPageRenderer()->loadExtJs(); $GLOBALS['SOBE']->doc->getPageRenderer()->addJsFile($GLOBALS['BACK_PATH'] . 'sysext/cms/layout/js/typo3pageModule.js'); // Get labels for CTypes and tt_content element fields in general: $this->CType_labels = array(); foreach ($TCA['tt_content']['columns']['CType']['config']['items'] as $val) { $this->CType_labels[$val[1]] = $GLOBALS['LANG']->sL($val[0]); } $this->itemLabels = array(); foreach ($TCA['tt_content']['columns'] as $name => $val) { $this->itemLabels[$name] = $GLOBALS['LANG']->sL($val['label']); } // Select display mode: if (!$this->tt_contentConfig['single']) { // MULTIPLE column display mode, side by side: // Setting language list: $langList = $this->tt_contentConfig['sys_language_uid']; if ($this->tt_contentConfig['languageMode']) { if ($this->tt_contentConfig['languageColsPointer']) { $langList = '0,' . $this->tt_contentConfig['languageColsPointer']; } else { $langList = implode(',', array_keys($this->tt_contentConfig['languageCols'])); } $languageColumn = array(); } $langListArr = explode(',', $langList); $defLanguageCount = array(); $defLangBinding = array(); // For EACH languages... : foreach ($langListArr as $lP) { // If NOT languageMode, then we'll only be through this once. $showLanguage = $this->defLangBinding && $lP == 0 ? ' AND sys_language_uid IN (0,-1)' : ' AND sys_language_uid=' . $lP; $cList = explode(',', $this->tt_contentConfig['cols']); $content = array(); $head = array(); // For EACH column, render the content into a variable: foreach ($cList as $key) { if (!$lP) { $defLanguageCount[$key] = array(); } // Select content elements from this column/language: $queryParts = $this->makeQueryArray('tt_content', $id, 'AND colPos=' . intval($key) . $showHidden . $showLanguage); $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts); // If it turns out that there are not content elements in the column, then display a big button which links directly to the wizard script: if ($this->doEdit && $this->option_showBigButtons && !intval($key) && !$GLOBALS['TYPO3_DB']->sql_num_rows($result)) { $onClick = "window.location.href='db_new_content_el.php?id=" . $id . '&colPos=' . intval($key) . '&sys_language_uid=' . $lP . '&uid_pid=' . $id . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . "';"; $theNewButton = $GLOBALS['SOBE']->doc->t3Button($onClick, $GLOBALS['LANG']->getLL('newPageContent')); $content[$key] .= '<img src="clear.gif" width="1" height="5" alt="" /><br />' . $theNewButton; } // Traverse any selected elements and render their display code: $rowArr = $this->getResult($result); foreach ($rowArr as $rKey => $row) { if (is_array($row) && (int) $row['t3ver_state'] != 2) { $singleElementHTML = ''; if (!$lP) { $defLanguageCount[$key][] = $row['uid']; } $editUidList .= $row['uid'] . ','; $singleElementHTML .= $this->tt_content_drawHeader($row, $this->tt_contentConfig['showInfo'] ? 15 : 5, $this->defLangBinding && $lP > 0, TRUE); $isRTE = $RTE && $this->isRTEforField('tt_content', $row, 'bodytext'); $singleElementHTML .= '<div ' . ($row['_ORIG_uid'] ? ' class="ver-element"' : '') . '>' . $this->tt_content_drawItem($row, $isRTE) . '</div>'; // NOTE: this is the end tag for <div class="t3-page-ce-body"> // because of bad (historic) conception, starting tag has to be placed inside tt_content_drawHeader() $singleElementHTML .= '</div>'; $statusHidden = $this->isDisabled('tt_content', $row) ? ' t3-page-ce-hidden' : ''; $singleElementHTML = '<div class="t3-page-ce' . $statusHidden . '">' . $singleElementHTML . '</div>'; if ($this->defLangBinding && $this->tt_contentConfig['languageMode']) { $defLangBinding[$key][$lP][$row[$lP ? 'l18n_parent' : 'uid']] = $singleElementHTML; } else { $content[$key] .= $singleElementHTML; } } else { unset($rowArr[$rKey]); } } // Add new-icon link, header: $newP = $this->newContentElementOnClick($id, $key, $lP); $head[$key] .= $this->tt_content_drawColHeader(t3lib_BEfunc::getProcessedValue('tt_content', 'colPos', $key), $this->doEdit && count($rowArr) ? '&edit[tt_content][' . $editUidList . ']=edit' . $pageTitleParamForAltDoc : '', $newP); $editUidList = ''; } // For EACH column, fit the rendered content into a table cell: $out = ''; foreach ($cList as $k => $key) { if (!$k) { $out .= ' <td><img src="clear.gif" width="' . $lMarg . '" height="1" alt="" /></td>'; } else { $out .= ' <td><img src="clear.gif" width="4" height="1" alt="" /></td> <td bgcolor="#cfcfcf"><img src="clear.gif" width="1" height="1" alt="" /></td> <td><img src="clear.gif" width="4" height="1" alt="" /></td>'; } $out .= ' <td class="t3-page-column t3-page-column-' . $key . '">' . $head[$key] . $content[$key] . '</td>'; // Storing content for use if languageMode is set: if ($this->tt_contentConfig['languageMode']) { $languageColumn[$key][$lP] = $head[$key] . $content[$key]; if (!$this->defLangBinding) { $languageColumn[$key][$lP] .= '<br /><br />' . $this->newLanguageButton($this->getNonTranslatedTTcontentUids($defLanguageCount[$key], $id, $lP), $lP); } } } // Wrap the cells into a table row: $out = ' <table border="0" cellpadding="0" cellspacing="0" class="t3-page-columns"> <tr>' . $out . ' </tr> </table>'; // CSH: $out .= t3lib_BEfunc::cshItem($this->descrTable, 'columns_multi', $GLOBALS['BACK_PATH']); } // If language mode, then make another presentation: // Notice that THIS presentation will override the value of $out! But it needs the code above to execute since $languageColumn is filled with content we need! if ($this->tt_contentConfig['languageMode']) { // Get language selector: $languageSelector = $this->languageSelector($id); // Reset out - we will make new content here: $out = ''; // Separator between language columns (black thin line) $midSep = ' <td><img src="clear.gif" width="4" height="1" alt="" /></td> <td bgcolor="black"><img src="clear.gif" width="1" height="1" alt="" /></td> <td><img src="clear.gif" width="4" height="1" alt="" /></td>'; // Traverse languages found on the page and build up the table displaying them side by side: $cCont = array(); $sCont = array(); foreach ($langListArr as $lP) { // Header: $cCont[$lP] = ' <td valign="top" align="center" class="bgColor6"><strong>' . htmlspecialchars($this->tt_contentConfig['languageCols'][$lP]) . '</strong></td>'; // "View page" icon is added: $viewLink = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::viewOnClick($this->id, $this->backPath, t3lib_BEfunc::BEgetRootLine($this->id), '', '', '&L=' . $lP)) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-view') . '</a>'; // Language overlay page header: if ($lP) { list($lpRecord) = t3lib_BEfunc::getRecordsByField('pages_language_overlay', 'pid', $id, 'AND sys_language_uid=' . intval($lP)); t3lib_BEfunc::workspaceOL('pages_language_overlay', $lpRecord); $params = '&edit[pages_language_overlay][' . $lpRecord['uid'] . ']=edit&overrideVals[pages_language_overlay][sys_language_uid]=' . $lP; $lPLabel = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon(t3lib_iconWorks::getSpriteIconForRecord('pages_language_overlay', $lpRecord), $lpRecord['uid']) . $viewLink . ($GLOBALS['BE_USER']->check('tables_modify', 'pages_language_overlay') ? '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick($params, $this->backPath)) . '" title="' . $GLOBALS['LANG']->getLL('edit', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a>' : '') . htmlspecialchars(t3lib_div::fixed_lgd_cs($lpRecord['title'], 20)); } else { $lPLabel = $viewLink; } $sCont[$lP] = ' <td nowrap="nowrap">' . $lPLabel . '</td>'; } // Add headers: $out .= ' <tr class="bgColor5">' . implode($midSep, $cCont) . ' </tr>'; $out .= ' <tr class="bgColor5">' . implode($midSep, $sCont) . ' </tr>'; // Traverse previously built content for the columns: foreach ($languageColumn as $cKey => $cCont) { $out .= ' <tr> <td valign="top">' . implode('</td>' . $midSep . ' <td valign="top">', $cCont) . '</td> </tr>'; if ($this->defLangBinding) { // "defLangBinding" mode foreach ($defLanguageCount[$cKey] as $defUid) { $cCont = array(); foreach ($langListArr as $lP) { $cCont[] = $defLangBinding[$cKey][$lP][$defUid] . '<br/>' . $this->newLanguageButton($this->getNonTranslatedTTcontentUids(array($defUid), $id, $lP), $lP); } $out .= ' <tr> <td valign="top">' . implode('</td>' . $midSep . ' <td valign="top">', $cCont) . '</td> </tr>'; } // Create spacer: $cCont = array(); foreach ($langListArr as $lP) { $cCont[] = ' '; } $out .= ' <tr> <td valign="top">' . implode('</td>' . $midSep . ' <td valign="top">', $cCont) . '</td> </tr>'; } } // Finally, wrap it all in a table and add the language selector on top of it: $out = $languageSelector . ' <table border="0" cellpadding="0" cellspacing="0" width="480" class="typo3-page-langMode"> ' . $out . ' </table>'; // CSH: $out .= t3lib_BEfunc::cshItem($this->descrTable, 'language_list', $GLOBALS['BACK_PATH']); } } else { // SINGLE column mode (columns shown beneath each other): #debug('single column'); if ($this->tt_contentConfig['sys_language_uid'] == 0 || !$this->defLangBinding) { // Initialize: if ($this->defLangBinding && $this->tt_contentConfig['sys_language_uid'] == 0) { $showLanguage = ' AND sys_language_uid IN (0,-1)'; $lP = 0; } else { $showLanguage = ' AND sys_language_uid=' . $this->tt_contentConfig['sys_language_uid']; $lP = $this->tt_contentConfig['sys_language_uid']; } $cList = explode(',', $this->tt_contentConfig['showSingleCol']); $content = array(); $out = ''; // Expand the table to some preset dimensions: $out .= ' <tr> <td><img src="clear.gif" width="' . $lMarg . '" height="1" alt="" /></td> <td valign="top"><img src="clear.gif" width="150" height="1" alt="" /></td> <td><img src="clear.gif" width="10" height="1" alt="" /></td> <td valign="top"><img src="clear.gif" width="300" height="1" alt="" /></td> </tr>'; // Traverse columns to display top-on-top foreach ($cList as $counter => $key) { // Select content elements: $queryParts = $this->makeQueryArray('tt_content', $id, 'AND colPos=' . intval($key) . $showHidden . $showLanguage); $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts); $c = 0; $rowArr = $this->getResult($result); $rowOut = ''; // If it turns out that there are not content elements in the column, then display a big button which links directly to the wizard script: if ($this->doEdit && $this->option_showBigButtons && !intval($key) && !$GLOBALS['TYPO3_DB']->sql_num_rows($result)) { $onClick = "window.location.href='db_new_content_el.php?id=" . $id . '&colPos=' . intval($key) . '&sys_language_uid=' . $lP . '&uid_pid=' . $id . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . "';"; $theNewButton = $GLOBALS['SOBE']->doc->t3Button($onClick, $GLOBALS['LANG']->getLL('newPageContent')); $theNewButton = '<img src="clear.gif" width="1" height="5" alt="" /><br />' . $theNewButton; } else { $theNewButton = ''; } // Traverse any selected elements: foreach ($rowArr as $rKey => $row) { if (is_array($row) && (int) $row['t3ver_state'] != 2) { $c++; $editUidList .= $row['uid'] . ','; $isRTE = $RTE && $this->isRTEforField('tt_content', $row, 'bodytext'); // Create row output: $rowOut .= ' <tr> <td></td> <td valign="top">' . $this->tt_content_drawHeader($row) . '</td> <td> </td> <td' . ($row['_ORIG_uid'] ? ' class="ver-element"' : '') . ' valign="top">' . $this->tt_content_drawItem($row, $isRTE) . '</td> </tr>'; // If the element was not the last element, add a divider line: if ($c != $GLOBALS['TYPO3_DB']->sql_num_rows($result)) { $rowOut .= ' <tr> <td></td> <td colspan="3"><img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/stiblet_medium2.gif', 'width="468" height="1"') . ' class="c-divider" alt="" /></td> </tr>'; } } else { unset($rowArr[$rKey]); } } // Add spacer between sections in the vertical list if ($counter) { $out .= ' <tr> <td></td> <td colspan="3"><br /><br /><br /><br /></td> </tr>'; } // Add section header: $newP = $this->newContentElementOnClick($id, $key, $this->tt_contentConfig['sys_language_uid']); $out .= ' <!-- Column header: --> <tr> <td></td> <td valign="top" colspan="3">' . $this->tt_content_drawColHeader(t3lib_BEfunc::getProcessedValue('tt_content', 'colPos', $key), $this->doEdit && count($rowArr) ? '&edit[tt_content][' . $editUidList . ']=edit' . $pageTitleParamForAltDoc : '', $newP) . $theNewButton . '<br /></td> </tr>'; // Finally, add the content from the records in this column: $out .= $rowOut; } // Finally, wrap all table rows in one, big table: $out = ' <table border="0" cellpadding="0" cellspacing="0" width="400" class="typo3-page-columnsMode"> ' . $out . ' </table>'; // CSH: $out .= t3lib_BEfunc::cshItem($this->descrTable, 'columns_single', $GLOBALS['BACK_PATH']); } else { $out = '<br/><br/>' . $GLOBALS['SOBE']->doc->icons(1) . 'Sorry, you cannot view a single language in this localization mode (Default Language Binding is enabled)<br/><br/>'; } } // Add the big buttons to page: if ($this->option_showBigButtons) { $bArray = array(); if (!$GLOBALS['SOBE']->current_sys_language) { if ($this->ext_CALC_PERMS & 2) { $bArray[0] = $GLOBALS['SOBE']->doc->t3Button(t3lib_BEfunc::editOnClick('&edit[pages][' . $id . "]=edit", $this->backPath, ''), $GLOBALS['LANG']->getLL('editPageProperties')); } } else { if ($this->doEdit && $GLOBALS['BE_USER']->check('tables_modify', 'pages_language_overlay')) { list($languageOverlayRecord) = t3lib_BEfunc::getRecordsByField('pages_language_overlay', 'pid', $id, 'AND sys_language_uid=' . intval($GLOBALS['SOBE']->current_sys_language)); $bArray[0] = $GLOBALS['SOBE']->doc->t3Button(t3lib_BEfunc::editOnClick('&edit[pages_language_overlay][' . $languageOverlayRecord['uid'] . "]=edit", $this->backPath, ''), $GLOBALS['LANG']->getLL('editPageProperties_curLang')); } } if ($this->ext_CALC_PERMS & 4 || $this->ext_CALC_PERMS & 2) { $bArray[1] = $GLOBALS['SOBE']->doc->t3Button("window.location.href='" . $this->backPath . "move_el.php?table=pages&uid=" . $id . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . "';", $GLOBALS['LANG']->getLL('move_page')); } if ($this->ext_CALC_PERMS & 8) { $bArray[2] = $GLOBALS['SOBE']->doc->t3Button("window.location.href='" . $this->backPath . "db_new.php?id=" . $id . '&pagesOnly=1&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . "';", $GLOBALS['LANG']->getLL('newPage2')); } if ($this->doEdit && $this->ext_function == 1) { $bArray[3] = $GLOBALS['SOBE']->doc->t3Button("window.location.href='db_new_content_el.php?id=" . $id . '&sys_language_uid=' . $GLOBALS['SOBE']->current_sys_language . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . "';", $GLOBALS['LANG']->getLL('newPageContent2')); } $out = ' <table border="0" cellpadding="4" cellspacing="0" class="typo3-page-buttons"> <tr> <td>' . implode('</td> <td>', $bArray) . '</td> <td>' . t3lib_BEfunc::cshItem($this->descrTable, 'button_panel', $GLOBALS['BACK_PATH']) . '</td> </tr> </table> <br /> ' . $out; } // Return content: return $out; }
/** * Checking if the "&edit" variable was sent so we can open it for editing the page. * Code based on code from "alt_shortcut.php" * * @return void */ protected function handlePageEditing() { if (!t3lib_extMgm::isLoaded('cms')) { return; } // EDIT page: $editId = preg_replace('/[^[:alnum:]_]/', '', t3lib_div::_GET('edit')); $editRecord = ''; if ($editId) { // Looking up the page to edit, checking permissions: $where = ' AND (' . $GLOBALS['BE_USER']->getPagePermsClause(2) . ' OR ' . $GLOBALS['BE_USER']->getPagePermsClause(16) . ')'; if (t3lib_div::testInt($editId)) { $editRecord = t3lib_BEfunc::getRecordWSOL('pages', $editId, '*', $where); } else { $records = t3lib_BEfunc::getRecordsByField('pages', 'alias', $editId, $where); if (is_array($records)) { reset($records); $editRecord = current($records); t3lib_BEfunc::workspaceOL('pages', $editRecord); } } // If the page was accessible, then let the user edit it. if (is_array($editRecord) && $GLOBALS['BE_USER']->isInWebMount($editRecord['uid'])) { // Setting JS code to open editing: $this->js .= ' // Load page to edit: window.setTimeout("top.loadEditId(' . intval($editRecord['uid']) . ');", 500); '; // "Shortcuts" have been renamed to "Bookmarks" // @deprecated remove shortcuts code in TYPO3 4.7 $shortcutSetPageTree = $GLOBALS['BE_USER']->getTSConfigVal('options.shortcut_onEditId_dontSetPageTree'); $bookmarkSetPageTree = $GLOBALS['BE_USER']->getTSConfigVal('options.bookmark_onEditId_dontSetPageTree'); if ($shortcutSetPageTree !== '') { t3lib_div::deprecationLog('options.shortcut_onEditId_dontSetPageTree - since TYPO3 4.5, will be removed in TYPO3 4.7 - use options.bookmark_onEditId_dontSetPageTree instead'); } // Checking page edit parameter: if (!$shortcutSetPageTree && !$bookmarkSetPageTree) { $shortcutKeepExpanded = $GLOBALS['BE_USER']->getTSConfigVal('options.shortcut_onEditId_keepExistingExpanded'); $bookmarkKeepExpanded = $GLOBALS['BE_USER']->getTSConfigVal('options.bookmark_onEditId_keepExistingExpanded'); $keepExpanded = $shortcutKeepExpanded || $bookmarkKeepExpanded; // Expanding page tree: t3lib_BEfunc::openPageTree(intval($editRecord['pid']), !$keepExpanded); if ($shortcutKeepExpanded) { t3lib_div::deprecationLog('options.shortcut_onEditId_keepExistingExpanded - since TYPO3 4.5, will be removed in TYPO3 4.7 - use options.bookmark_onEditId_keepExistingExpanded instead'); } } } else { $this->js .= ' // Warning about page editing: alert(' . $GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->getLL('noEditPage'), $editId)) . '); '; } } }
/** * If "editPage" value is sent to script and it points to an accessible page, the internal var $this->theEditRec is set to the page record which should be loaded. * Returns void * * @return void */ function editPageIdFunc() { global $BE_USER, $LANG; if (!t3lib_extMgm::isLoaded('cms')) { return; } // EDIT page: $this->editPage = trim($LANG->csConvObj->conv_case($LANG->charSet, $this->editPage, 'toLower')); $this->editError = ''; $this->theEditRec = ''; $this->searchFor = ''; if ($this->editPage) { // First, test alternative value consisting of [table]:[uid] and if not found, proceed with traditional page ID resolve: $this->alternativeTableUid = explode(':', $this->editPage); if (!(count($this->alternativeTableUid) == 2 && $BE_USER->isAdmin())) { // We restrict it to admins only just because I'm not really sure if alt_doc.php properly checks permissions of passed records for editing. If alt_doc.php does that, then we can remove this. $where = ' AND (' . $BE_USER->getPagePermsClause(2) . ' OR ' . $BE_USER->getPagePermsClause(16) . ')'; if (t3lib_div::testInt($this->editPage)) { $this->theEditRec = t3lib_BEfunc::getRecordWSOL('pages', $this->editPage, '*', $where); } else { $records = t3lib_BEfunc::getRecordsByField('pages', 'alias', $this->editPage, $where); if (is_array($records)) { reset($records); $this->theEditRec = current($records); t3lib_BEfunc::workspaceOL('pages', $this->theEditRec); } } if (!is_array($this->theEditRec)) { unset($this->theEditRec); $this->searchFor = $this->editPage; } elseif (!$BE_USER->isInWebMount($this->theEditRec['uid'])) { unset($this->theEditRec); $this->editError = $LANG->getLL('shortcut_notEditable'); } else { // Visual path set: $perms_clause = $BE_USER->getPagePermsClause(1); $this->editPath = t3lib_BEfunc::getRecordPath($this->theEditRec['pid'], $perms_clause, 30); if (!$BE_USER->getTSConfigVal('options.shortcut_onEditId_dontSetPageTree')) { // Expanding page tree: t3lib_BEfunc::openPageTree($this->theEditRec['pid'], !$BE_USER->getTSConfigVal('options.shortcut_onEditId_keepExistingExpanded')); } } } } }
/** * @param string $theTable Table name present in $GLOBALS['TCA'] * @param string $theField Field to select on * @param string $theValue Value that $theField must match * @param string $whereClause Optional additional WHERE clauses put in the end of the query. DO NOT PUT IN GROUP BY, ORDER BY or LIMIT! * @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. * @param bool $useDeleteClause Use the deleteClause to check if a record is deleted (default TRUE) * @return mixed Multidimensional array with selected records (if any is selected) */ public function getRecordsByField($theTable, $theField, $theValue, $whereClause = '', $groupBy = '', $orderBy = '', $limit = '', $useDeleteClause = TRUE) { /** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */ return t3lib_BEfunc::getRecordsByField($theTable, $theField, $theValue, $whereClause, $groupBy, $orderBy, $limit, $useDeleteClause); }