/** * Returns array of system languages * * Since TYPO3 4.5 the flagIcon is not returned as a filename in "gfx/flags/*" anymore, * but as a string <flags-xx>. The calling party should call * t3lib_iconWorks::getSpriteIcon(<flags-xx>) to get an HTML which will represent * the flag of this language. * * @param integer $page_id Page id (only used to get TSconfig configuration setting flag and label for default language) * @param string $backPath Backpath for flags * @return array Array with languages (title, uid, flagIcon) * @todo Define visibility */ public function getSystemLanguages($page_id = 0, $backPath = '') { $modSharedTSconfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($page_id, 'mod.SHARED'); $languageIconTitles = array(); // fallback "old iconstyles" if (preg_match('/\\.gif$/', $modSharedTSconfig['properties']['defaultLanguageFlag'])) { $modSharedTSconfig['properties']['defaultLanguageFlag'] = str_replace('.gif', '', $modSharedTSconfig['properties']['defaultLanguageFlag']); } $languageIconTitles[0] = array('uid' => 0, 'title' => strlen($modSharedTSconfig['properties']['defaultLanguageLabel']) ? $modSharedTSconfig['properties']['defaultLanguageLabel'] . ' (' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xml:defaultLanguage') . ')' : $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xml:defaultLanguage'), 'ISOcode' => 'DEF', 'flagIcon' => strlen($modSharedTSconfig['properties']['defaultLanguageFlag']) ? 'flags-' . $modSharedTSconfig['properties']['defaultLanguageFlag'] : 'empty-empty'); // Set "All" language: $languageIconTitles[-1] = array('uid' => -1, 'title' => $GLOBALS['LANG']->getLL('multipleLanguages'), 'ISOcode' => 'DEF', 'flagIcon' => 'flags-multiple'); // Find all system languages: $sys_languages = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_language', ''); foreach ($sys_languages as $row) { $languageIconTitles[$row['uid']] = $row; if ($row['static_lang_isocode'] && \TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('static_info_tables')) { $staticLangRow = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('static_languages', $row['static_lang_isocode'], 'lg_iso_2'); if ($staticLangRow['lg_iso_2']) { $languageIconTitles[$row['uid']]['ISOcode'] = $staticLangRow['lg_iso_2']; } } if (strlen($row['flag'])) { $languageIconTitles[$row['uid']]['flagIcon'] = \TYPO3\CMS\Backend\Utility\IconUtility::mapRecordTypeToSpriteIconName('sys_language', $row); } } return $languageIconTitles; }
/** * Initialize, setting what is necessary for browsing pages. * Using the current user. * * @param string $clause Additional clause for selecting pages. * @param string $orderByFields record ORDER BY field * @return void * @todo Define visibility */ public function init($clause = '', $orderByFields = '') { // This will hide records from display - it has nothing todo with user rights!! $clauseExcludePidList = ''; if ($pidList = $GLOBALS['BE_USER']->getTSConfigVal('options.hideRecords.pages')) { if ($pidList = $GLOBALS['TYPO3_DB']->cleanIntList($pidList)) { $clauseExcludePidList = ' AND pages.uid NOT IN (' . $pidList . ')'; } } // This is very important for making trees of pages: Filtering out deleted pages, pages with no access to and sorting them correctly: parent::init(' AND ' . $GLOBALS['BE_USER']->getPagePermsClause(1) . ' ' . $clause . $clauseExcludePidList, 'sorting'); $this->table = 'pages'; $this->setTreeName('browsePages'); $this->domIdPrefix = 'pages'; $this->iconName = ''; $this->title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']; $this->MOUNTS = $GLOBALS['WEBMOUNTS']; if ($pidList) { // Remove mountpoint if explicitly set in options.hideRecords.pages (see above) $hideList = explode(',', $pidList); $this->MOUNTS = array_diff($this->MOUNTS, $hideList); } $this->fieldArray = array_merge($this->fieldArray, array('doktype', 'php_tree_stop', 't3ver_id', 't3ver_state', 't3ver_wsid', 't3ver_state', 't3ver_move_id')); if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('cms')) { $this->fieldArray = array_merge($this->fieldArray, array('hidden', 'starttime', 'endtime', 'fe_group', 'module', 'extendToSubpages', 'is_siteroot', 'nav_hide')); } }
/** * Init function * REMEMBER to feed a $clause which will filter out non-readable pages! * * @param string $clause Part of where query which will filter out non-readable pages. * @param string $orderByFields Record ORDER BY field * @return void * @todo Define visibility */ public function init($clause = '', $orderByFields = '') { parent::init(' AND deleted=0 ' . $clause, 'sorting'); if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('cms')) { $this->fieldArray = array_merge($this->fieldArray, array('hidden', 'starttime', 'endtime', 'fe_group', 'module', 'extendToSubpages', 'nav_hide')); } $this->table = 'pages'; $this->treeName = 'pages'; }
/** * Frontend hook: If the page is not being re-generated this is our chance to force it to be (because re-generation of the page is required in order to have the indexer called!) * * @param array Parameters from frontend * @param object TSFE object (reference under PHP5) * @return void */ public function headerNoCache(array &$params, $ref) { // Requirements are that the crawler is loaded, a crawler session is running and re-indexing requested as processing instruction: if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('crawler') && $params['pObj']->applicationData['tx_crawler']['running'] && in_array('tx_indexedsearch_reindex', $params['pObj']->applicationData['tx_crawler']['parameters']['procInstructions'])) { // Setting simple log entry: $params['pObj']->applicationData['tx_crawler']['log'][] = 'RE_CACHE (indexed), old status: ' . $params['disableAcquireCacheData']; // Disables a look-up for cached page data - thus resulting in re-generation of the page even if cached. $params['disableAcquireCacheData'] = TRUE; } }
/** * Resolve workspace title from UID. * * @param integer $uid UID of the workspace * @return string username or UID */ public function render($uid) { if ($uid === 0) { return \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('live', $this->controllerContext->getRequest()->getControllerExtensionName()); } if (!\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('workspaces')) { return ''; } /** @var $workspace \TYPO3\CMS\Belog\Domain\Model\Workspace */ $workspace = $this->workspaceRepository->findByUid($uid); if ($workspace !== NULL) { $title = $workspace->getTitle(); } else { $title = ''; } return $title; }
/** * performs the action of the UpdateManager * * @param array &$dbQueries: queries done in this update * @param mixed &$customMessages: custom messages * @return bool whether everything went smoothly or not */ public function performUpdate(array &$dbQueries, &$customMessages) { $result = FALSE; if ($this->versionNumber >= 4004000 && !\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('t3skin')) { // check wether the table can be truncated or if sysext with tca has to be installed if ($this->checkForUpdate($customMessages)) { try { \TYPO3\CMS\Core\Extension\ExtensionManager::loadExtension('t3skin'); $customMessages = 'The system extension "t3skin" was successfully loaded.'; $result = TRUE; } catch (\RuntimeException $e) { $result = FALSE; } } } return $result; }
/** * performs the action of the UpdateManager * * @param array &$dbQueries: queries done in this update * @param mixed &$customMessages: custom messages * @return bool whether everything went smoothly or not */ public function performUpdate(array &$dbQueries, &$customMessages) { if ($this->versionNumber >= 4004000 && !\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('statictemplates')) { // check wether the table can be truncated or if sysext with tca has to be installed if ($this->checkForUpdate($customMessages[])) { try { \TYPO3\CMS\Core\Extension\ExtensionManager::loadExtension('statictemplates'); $customMessages[] = 'System Extension "statictemplates" was successfully loaded, static templates are now supported.'; $result = TRUE; } catch (\RuntimeException $e) { $result = FALSE; } return $result; } return TRUE; } }
/** * Renders an install link * * @param string $extension * @return string the rendered a tag */ public function render($extension) { if (!in_array($extension['type'], \TYPO3\CMS\Extensionmanager\Domain\Model\Extension::returnAllowedInstallTypes())) { return ''; } $uriBuilder = $this->controllerContext->getUriBuilder(); $action = 'removeExtension'; $uriBuilder->reset(); $uriBuilder->setFormat('json'); $uri = $uriBuilder->uriFor($action, array('extension' => $extension['key']), 'Action'); $this->tag->addAttribute('href', $uri); $cssClass = 'removeExtension'; if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded($extension['key'])) { $cssClass .= ' isLoadedWarning'; } $this->tag->addAttribute('class', $cssClass); $label = 'Remove'; $this->tag->setContent($label); return $this->tag->render(); }
/** * Rendering the content. * * @return void * @todo Define visibility */ public function main() { $msg = array(); // Add a message, telling that no documents were open... $msg[] = '<p>' . $GLOBALS['LANG']->getLL('noDocuments_msg', 1) . '</p><br />'; // If another page module was specified, replace the default Page module with the new one $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule')); $pageModule = \TYPO3\CMS\Backend\Utility\BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout'; // Perform some access checks: $a_wl = $GLOBALS['BE_USER']->check('modules', 'web_list'); $a_wp = \TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('cms') && $GLOBALS['BE_USER']->check('modules', $pageModule); // Finding module images: PAGE $imgFile = $GLOBALS['LANG']->moduleLabels['tabs_images']['web_layout_tab']; $imgInfo = @getimagesize($imgFile); $img_web_layout = is_array($imgInfo) ? '<img src="../' . substr($imgFile, strlen(PATH_site)) . '" ' . $imgInfo[3] . ' alt="" />' : ''; // Finding module images: LIST $imgFile = $GLOBALS['LANG']->moduleLabels['tabs_images']['web_list_tab']; $imgInfo = @getimagesize($imgFile); $img_web_list = is_array($imgInfo) ? '<img src="../' . substr($imgFile, strlen(PATH_site)) . '" ' . $imgInfo[3] . ' alt="" />' : ''; // If either the Web>List OR Web>Page module are active, show the little message with links to those modules: if ($a_wl || $a_wp) { $msg_2 = array(); // Web>Page: if ($a_wp) { $msg_2[] = '<strong><a href="#" onclick="top.goToModule(\'' . $pageModule . '\'); return false;">' . $GLOBALS['LANG']->getLL('noDocuments_pagemodule', 1) . $img_web_layout . '</a></strong>'; if ($a_wl) { $msg_2[] = $GLOBALS['LANG']->getLL('noDocuments_OR'); } } // Web>List if ($a_wl) { $msg_2[] = '<strong><a href="#" onclick="top.goToModule(\'web_list\'); return false;">' . $GLOBALS['LANG']->getLL('noDocuments_listmodule', 1) . $img_web_list . '</a></strong>'; } $msg[] = '<p>' . sprintf($GLOBALS['LANG']->getLL('noDocuments_msg2', 1), implode(' ', $msg_2)) . '</p><br />'; } // Display the list of the most recently edited documents: $modObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Opendocs\\Controller\\OpendocsController'); $msg[] = '<p>' . $GLOBALS['LANG']->getLL('noDocuments_msg3', TRUE) . '</p><br />' . $modObj->renderMenu(); // Adding the content: $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('noDocuments'), implode(' ', $msg), 0, 1); }
/** * Check whether any conflicting extension has been installed * * @return tx_reports_reports_status_Status */ protected function checkIfNoConflictingExtensionIsInstalled() { $title = $GLOBALS['LANG']->sL('LLL:EXT:rtehtmlarea/hooks/statusreport/locallang.xml:title'); $conflictingExtensions = array(); if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['conflicts'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['conflicts'] as $extensionKey => $version) { if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded($extensionKey)) { $conflictingExtensions[] = $extensionKey; } } } if (count($conflictingExtensions)) { $value = $GLOBALS['LANG']->sL('LLL:EXT:rtehtmlarea/hooks/statusreport/locallang.xml:keys') . ' ' . implode(', ', $conflictingExtensions); $message = $GLOBALS['LANG']->sL('LLL:EXT:rtehtmlarea/hooks/statusreport/locallang.xml:uninstall'); $status = \TYPO3\CMS\Reports\Status::ERROR; } else { $value = $GLOBALS['LANG']->sL('LLL:EXT:rtehtmlarea/hooks/statusreport/locallang.xml:none'); $message = ''; $status = \TYPO3\CMS\Reports\Status::OK; } return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Reports\\Status', $title, $value, $message, $status); }
/** * Generate the contents for the form for 'Database Analyzer' * when the 'COMPARE' still contains errors * * @param string $type get_form if the form needs to be generated * @param array $arr_update The tables/fields which needs an update * @param array $arr_remove The tables/fields which needs to be removed * @param string $action_type The action type * @return string HTML for the form * @todo Define visibility */ public function generateUpdateDatabaseForm($type, $arr_update, $arr_remove, $action_type) { $content = ''; switch ($type) { case 'get_form': $content .= $this->generateUpdateDatabaseForm_checkboxes($arr_update['clear_table'], 'Clear tables (use with care!)', FALSE, TRUE); $content .= $this->generateUpdateDatabaseForm_checkboxes($arr_update['add'], 'Add fields'); $content .= $this->generateUpdateDatabaseForm_checkboxes($arr_update['change'], 'Changing fields', \TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('dbal') ? 0 : 1, 0, $arr_update['change_currentValue']); $content .= $this->generateUpdateDatabaseForm_checkboxes($arr_remove['change'], 'Remove unused fields (rename with prefix)', $this->setAllCheckBoxesByDefault, 1); $content .= $this->generateUpdateDatabaseForm_checkboxes($arr_remove['drop'], 'Drop fields (really!)', $this->setAllCheckBoxesByDefault); $content .= $this->generateUpdateDatabaseForm_checkboxes($arr_update['create_table'], 'Add tables'); $content .= $this->generateUpdateDatabaseForm_checkboxes($arr_remove['change_table'], 'Removing tables (rename with prefix)', $this->setAllCheckBoxesByDefault, 1, $arr_remove['tables_count'], 1); $content .= $this->generateUpdateDatabaseForm_checkboxes($arr_remove['drop_table'], 'Drop tables (really!)', $this->setAllCheckBoxesByDefault, 0, $arr_remove['tables_count'], 1); $content = $this->getUpdateDbFormWrap($action_type, $content); break; default: break; } return $content; }
/** * This method requests input from the user about the upgrade process, if needed * * @param string $inputPrefix * @return void */ public function getUserInput($inputPrefix) { $content = ''; if (!\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('version') && !\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('workspaces')) { // We need feedback only if versioning is not activated at all // In such a case we want to leave the user with the choice of not activating the stuff at all $content = ' <fieldset> <ol> '; $content .= ' <li class="labelAfter"> <input type="checkbox" id="versioning" name="' . $inputPrefix . '[versioning]" value="1" checked="checked" /> <label for="versioning">Activate workspaces?</label> </li> '; $content .= ' </ol> </fieldset> '; } else { // No feedback needed, just include the update flag as a hidden field $content = '<input type="hidden" id="versioning" name="' . $inputPrefix . '[versioning]" value="1" />'; } return $content; }
/** * Here we check for the module. * Return values: * 'notFound': If the module was not found in the path (no "conf.php" file) * FALSE: If no access to the module (access check failed) * array(): Configuration array, in case a valid module where access IS granted exists. * * @param string $name Module name * @param string $fullpath Absolute path to module * @return mixed See description of function * @todo Define visibility */ public function checkMod($name, $fullpath) { if ($name == 'user_ws' && !\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('version')) { return FALSE; } // Check for own way of configuring module if (is_array($GLOBALS['TBE_MODULES']['_configuration'][$name]['configureModuleFunction'])) { $obj = $GLOBALS['TBE_MODULES']['_configuration'][$name]['configureModuleFunction']; if (is_callable($obj)) { $MCONF = call_user_func($obj, $name, $fullpath); if ($this->checkModAccess($name, $MCONF) !== TRUE) { return FALSE; } return $MCONF; } } // Check if this is a submodule if (strpos($name, '_') !== FALSE) { list($mainModule, ) = explode('_', $name, 2); } $modconf = array(); // Because 'path/../path' does not work $path = preg_replace('/\\/[^\\/.]+\\/\\.\\.\\//', '/', $fullpath); if (@is_dir($path) && file_exists($path . '/conf.php')) { $MCONF = array(); $MLANG = array(); // The conf-file is included. This must be valid PHP. include $path . '/conf.php'; if (!$MCONF['shy'] && $this->checkModAccess($name, $MCONF) && $this->checkModWorkspace($name, $MCONF)) { $modconf['name'] = $name; // Language processing. This will add module labels and image reference to the internal ->moduleLabels array of the LANG object. if (is_object($GLOBALS['LANG'])) { // $MLANG['default']['tabs_images']['tab'] is for modules the reference to the module icon. // Here the path is transformed to an absolute reference. if ($MLANG['default']['tabs_images']['tab']) { // Initializing search for alternative icon: // Alternative icon key (might have an alternative set in $TBE_STYLES['skinImg'] $altIconKey = 'MOD:' . $name . '/' . $MLANG['default']['tabs_images']['tab']; $altIconAbsPath = is_array($GLOBALS['TBE_STYLES']['skinImg'][$altIconKey]) ? \TYPO3\CMS\Core\Utility\GeneralUtility::resolveBackPath(PATH_typo3 . $GLOBALS['TBE_STYLES']['skinImg'][$altIconKey][0]) : ''; // Setting icon, either default or alternative: if ($altIconAbsPath && @is_file($altIconAbsPath)) { $MLANG['default']['tabs_images']['tab'] = $this->getRelativePath(PATH_typo3, $altIconAbsPath); } else { // Setting default icon: $MLANG['default']['tabs_images']['tab'] = $this->getRelativePath(PATH_typo3, $fullpath . '/' . $MLANG['default']['tabs_images']['tab']); } // Finally, setting the icon with correct path: if (substr($MLANG['default']['tabs_images']['tab'], 0, 3) == '../') { $MLANG['default']['tabs_images']['tab'] = PATH_site . substr($MLANG['default']['tabs_images']['tab'], 3); } else { $MLANG['default']['tabs_images']['tab'] = PATH_typo3 . $MLANG['default']['tabs_images']['tab']; } } // If LOCAL_LANG references are used for labels of the module: if ($MLANG['default']['ll_ref']) { // Now the 'default' key is loaded with the CURRENT language - not the english translation... $MLANG['default']['labels']['tablabel'] = $GLOBALS['LANG']->sL($MLANG['default']['ll_ref'] . ':mlang_labels_tablabel'); $MLANG['default']['labels']['tabdescr'] = $GLOBALS['LANG']->sL($MLANG['default']['ll_ref'] . ':mlang_labels_tabdescr'); $MLANG['default']['tabs']['tab'] = $GLOBALS['LANG']->sL($MLANG['default']['ll_ref'] . ':mlang_tabs_tab'); $GLOBALS['LANG']->addModuleLabels($MLANG['default'], $name . '_'); } else { // ... otherwise use the old way: $GLOBALS['LANG']->addModuleLabels($MLANG['default'], $name . '_'); $GLOBALS['LANG']->addModuleLabels($MLANG[$GLOBALS['LANG']->lang], $name . '_'); } } // Default script setup if ($MCONF['script'] === '_DISPATCH') { if ($MCONF['extbase']) { $modconf['script'] = 'mod.php?M=Tx_' . rawurlencode($name); } else { $modconf['script'] = 'mod.php?M=' . rawurlencode($name); } } elseif ($MCONF['script'] && file_exists($path . '/' . $MCONF['script'])) { $modconf['script'] = $this->getRelativePath(PATH_typo3, $fullpath . '/' . $MCONF['script']); } else { $modconf['script'] = 'dummy.php'; } // Default tab setting if ($MCONF['defaultMod']) { $modconf['defaultMod'] = $MCONF['defaultMod']; } // Navigation Frame Script (GET params could be added) if ($MCONF['navFrameScript']) { $navFrameScript = explode('?', $MCONF['navFrameScript']); $navFrameScript = $navFrameScript[0]; if (file_exists($path . '/' . $navFrameScript)) { $modconf['navFrameScript'] = $this->getRelativePath(PATH_typo3, $fullpath . '/' . $MCONF['navFrameScript']); } } // additional params for Navigation Frame Script: "&anyParam=value&moreParam=1" if ($MCONF['navFrameScriptParam']) { $modconf['navFrameScriptParam'] = $MCONF['navFrameScriptParam']; } // check if there is a navigation component (like the pagetree) if (is_array($this->navigationComponents[$name])) { $modconf['navigationComponentId'] = $this->navigationComponents[$name]['componentId']; } elseif ($mainModule && is_array($this->navigationComponents[$mainModule])) { $modconf['navigationComponentId'] = $this->navigationComponents[$mainModule]['componentId']; } } else { return FALSE; } } else { $modconf = 'notFound'; } return $modconf; }
/** * Checks whether the Install Tool password is set to its default value. * * @return \TYPO3\CMS\Reports\Status An tx_reports_reports_status_Status object representing the security of the saltedpassswords extension */ protected function getSaltedPasswordsStatus() { $value = $GLOBALS['LANG']->getLL('status_ok'); $message = ''; $severity = \TYPO3\CMS\Reports\Status::OK; if (!\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('saltedpasswords')) { $value = $GLOBALS['LANG']->getLL('status_insecure'); $severity = \TYPO3\CMS\Reports\Status::ERROR; $message .= $GLOBALS['LANG']->getLL('status_saltedPasswords_notInstalled'); } else { /** @var \TYPO3\CMS\Saltedpasswords\Utility\ExtensionManagerConfigurationUtility $configCheck */ $configCheck = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Saltedpasswords\\Utility\\ExtensionManagerConfigurationUtility'); $message = '<p>' . $GLOBALS['LANG']->getLL('status_saltedPasswords_infoText') . '</p>'; $messageDetail = ''; $flashMessage = $configCheck->checkConfigurationBackend(array(), new \TYPO3\CMS\Core\TypoScript\ConfigurationForm()); if (strpos($flashMessage, 'message-error') !== FALSE) { $value = $GLOBALS['LANG']->getLL('status_insecure'); $severity = \TYPO3\CMS\Reports\Status::ERROR; $messageDetail .= $flashMessage; } if (strpos($flashMessage, 'message-warning') !== FALSE) { $severity = \TYPO3\CMS\Reports\Status::WARNING; $messageDetail .= $flashMessage; } if (strpos($flashMessage, 'message-information') !== FALSE) { $messageDetail .= $flashMessage; } $unsecureUserCount = \TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility::getNumberOfBackendUsersWithInsecurePassword(); if ($unsecureUserCount > 0) { $value = $GLOBALS['LANG']->getLL('status_insecure'); $severity = \TYPO3\CMS\Reports\Status::ERROR; $messageDetail .= '<div class="typo3-message message-warning">' . $GLOBALS['LANG']->getLL('status_saltedPasswords_notAllPasswordsHashed') . '</div>'; } $message .= $messageDetail; if (empty($messageDetail)) { $message = ''; } } return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Reports\\Status', $GLOBALS['LANG']->getLL('status_saltedPasswords'), $value, $message, $severity); }
/** * This selects non-empty-records from the tables/fields in the fkey_array generated by getGroupFields() * * @param array $fkey_arrays Array with tables/fields generated by getGroupFields() * @return void * @see getGroupFields() * @todo Define visibility */ public function selectNonEmptyRecordsWithFkeys($fkey_arrays) { if (is_array($fkey_arrays)) { foreach ($fkey_arrays as $table => $field_list) { if ($GLOBALS['TCA'][$table] && trim($field_list)) { \TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($table); $fieldArr = explode(',', $field_list); if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('dbal')) { $fields = $GLOBALS['TYPO3_DB']->admin_get_fields($table); $field = array_shift($fieldArr); $cl_fl = $GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'], $table) == 'I' || $GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'], $table) == 'N' || $GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'], $table) == 'R' ? $field . '<>0' : $field . '<>\'\''; foreach ($fieldArr as $field) { $cl_fl .= $GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'], $table) == 'I' || $GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'], $table) == 'N' || $GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'], $table) == 'R' ? ' OR ' . $field . '<>0' : ' OR ' . $field . '<>\'\''; } unset($fields); } else { $cl_fl = implode('<>\'\' OR ', $fieldArr) . '<>\'\''; } $mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,' . $field_list, $table, $cl_fl); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($mres)) { foreach ($fieldArr as $field) { if (trim($row[$field])) { $fieldConf = $GLOBALS['TCA'][$table]['columns'][$field]['config']; if ($fieldConf['type'] == 'group') { if ($fieldConf['internal_type'] == 'file') { // Files... if ($fieldConf['MM']) { $tempArr = array(); /** @var $dbAnalysis \TYPO3\CMS\Core\Database\RelationHandler */ $dbAnalysis = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\RelationHandler'); $dbAnalysis->start('', 'files', $fieldConf['MM'], $row['uid']); foreach ($dbAnalysis->itemArray as $somekey => $someval) { if ($someval['id']) { $tempArr[] = $someval['id']; } } } else { $tempArr = explode(',', trim($row[$field])); } foreach ($tempArr as $file) { $file = trim($file); if ($file) { $this->checkFileRefs[$fieldConf['uploadfolder']][$file] += 1; } } } if ($fieldConf['internal_type'] == 'db') { /** @var $dbAnalysis \TYPO3\CMS\Core\Database\RelationHandler */ $dbAnalysis = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\RelationHandler'); $dbAnalysis->start($row[$field], $fieldConf['allowed'], $fieldConf['MM'], $row['uid'], $table, $fieldConf); foreach ($dbAnalysis->itemArray as $tempArr) { $this->checkGroupDBRefs[$tempArr['table']][$tempArr['id']] += 1; } } } if ($fieldConf['type'] == 'select' && $fieldConf['foreign_table']) { /** @var $dbAnalysis \TYPO3\CMS\Core\Database\RelationHandler */ $dbAnalysis = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\RelationHandler'); $dbAnalysis->start($row[$field], $fieldConf['foreign_table'], $fieldConf['MM'], $row['uid'], $table, $fieldConf); foreach ($dbAnalysis->itemArray as $tempArr) { if ($tempArr['id'] > 0) { $this->checkGroupDBRefs[$fieldConf['foreign_table']][$tempArr['id']] += 1; } } } } } } $GLOBALS['TYPO3_DB']->sql_free_result($mres); } } } }
/** * Adding CM element for regular editing of the element! * * @param string $table Table name * @param integer $uid UID for the current record. * @return array Item array, element in $menuItems * @internal * @todo Define visibility */ public function DB_edit($table, $uid) { // If another module was specified, replace the default Page module with the new one $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule')); $pageModule = \TYPO3\CMS\Backend\Utility\BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout'; $editOnClick = ''; $loc = 'top.content.list_frame'; $addParam = ''; $theIcon = 'actions-document-open'; if ($this->iParts[0] == 'pages' && $this->iParts[1] && $GLOBALS['BE_USER']->check('modules', $pageModule)) { $theIcon = 'actions-page-open'; $this->editPageIconSet = 1; if ($GLOBALS['BE_USER']->uc['classicPageEditMode'] || !\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('cms')) { $addParam = '&editRegularContentFromId=' . intval($this->iParts[1]); } else { $editOnClick = 'if(' . $loc . '){' . $loc . '.location.href=top.TS.PATH_typo3+\'alt_doc.php?returnUrl=\'+top.rawurlencode(' . $this->frameLocation($loc . '.document') . '.pathname+' . $this->frameLocation($loc . '.document') . '.search)+\'&edit[' . $table . '][' . $uid . ']=edit' . $addParam . '\';}'; } } if (!$editOnClick) { $editOnClick = 'if(' . $loc . '){' . $loc . '.location.href=top.TS.PATH_typo3+\'alt_doc.php?returnUrl=\'+top.rawurlencode(' . $this->frameLocation($loc . '.document') . '.pathname+' . $this->frameLocation($loc . '.document') . '.search)+\'&edit[' . $table . '][' . $uid . ']=edit' . $addParam . '\';}'; } return $this->linkItem($this->label('edit'), $this->excludeIcon(\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon($theIcon)), $editOnClick . 'return hideCM();'); }
/** * Returns the absolute filename of a relative reference, resolves the "EXT:" prefix (way of referring to files inside extensions) and checks that the file is inside the PATH_site of the TYPO3 installation and implies a check with t3lib_div::validPathStr(). Returns FALSE if checks failed. Does not check if the file exists. * * @param string $filename The input filename/filepath to evaluate * @param boolean $onlyRelative If $onlyRelative is set (which it is by default), then only return values relative to the current PATH_site is accepted. * @param boolean $relToTYPO3_mainDir If $relToTYPO3_mainDir is set, then relative paths are relative to PATH_typo3 constant - otherwise (default) they are relative to PATH_site * @return string Returns the absolute filename of $filename IF valid, otherwise blank string. */ public static function getFileAbsFileName($filename, $onlyRelative = TRUE, $relToTYPO3_mainDir = FALSE) { if (!strcmp($filename, '')) { return ''; } if ($relToTYPO3_mainDir) { if (!defined('PATH_typo3')) { return ''; } $relPathPrefix = PATH_typo3; } else { $relPathPrefix = PATH_site; } // Extension if (substr($filename, 0, 4) == 'EXT:') { list($extKey, $local) = explode('/', substr($filename, 4), 2); $filename = ''; if (strcmp($extKey, '') && \TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded($extKey) && strcmp($local, '')) { $filename = \TYPO3\CMS\Core\Extension\ExtensionManager::extPath($extKey) . $local; } } elseif (!self::isAbsPath($filename)) { // relative. Prepended with $relPathPrefix $filename = $relPathPrefix . $filename; } elseif ($onlyRelative && !self::isFirstPartOfStr($filename, $relPathPrefix)) { // absolute, but set to blank if not allowed $filename = ''; } if (strcmp($filename, '') && self::validPathStr($filename)) { // checks backpath. return $filename; } }
/** * 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 (!\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('cms')) { return; } // EDIT page: $editId = preg_replace('/[^[:alnum:]_]/', '', \TYPO3\CMS\Core\Utility\GeneralUtility::_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 (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($editId)) { $editRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL('pages', $editId, '*', $where); } else { $records = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('pages', 'alias', $editId, $where); if (is_array($records)) { $editRecord = reset($records); \TYPO3\CMS\Backend\Utility\BackendUtility::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); '; // Checking page edit parameter: if (!$GLOBALS['BE_USER']->getTSConfigVal('options.bookmark_onEditId_dontSetPageTree')) { $bookmarkKeepExpanded = $GLOBALS['BE_USER']->getTSConfigVal('options.bookmark_onEditId_keepExistingExpanded'); // Expanding page tree: \TYPO3\CMS\Backend\Utility\BackendUtility::openPageTree(intval($editRecord['pid']), !$bookmarkKeepExpanded); } } else { $this->js .= ' // Warning about page editing: alert(' . $GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->getLL('noEditPage'), $editId)) . '); '; } } }
/** * Checks if user has access to workspace. * * @param integer $wsid Workspace ID * @return boolean <code>TRUE</code> if has access * @todo Define visibility */ public function checkWorkspaceAccess($wsid) { if (!$GLOBALS['BE_USER'] || !\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('workspaces')) { return FALSE; } if (isset($this->workspaceCache[$wsid])) { $ws = $this->workspaceCache[$wsid]; } else { if ($wsid > 0) { // No $GLOBALS['TCA'] yet! $ws = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'sys_workspace', 'uid=' . intval($wsid) . ' AND deleted=0'); if (!is_array($ws)) { return FALSE; } } else { $ws = $wsid; } $ws = $GLOBALS['BE_USER']->checkWorkspace($ws); $this->workspaceCache[$wsid] = $ws; } return $ws['_ACCESS'] != ''; }
/** * Main function, starting the rendering of the list. * * @return void * @todo Define visibility */ public function main() { // Start document template object: $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('templates/db_list.html'); // Loading current page record and checking access: $this->pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo) ? 1 : 0; // Apply predefined values for hidden checkboxes // Set predefined value for DisplayBigControlPanel: if ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'activated') { $this->MOD_SETTINGS['bigControlPanel'] = TRUE; } elseif ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'deactivated') { $this->MOD_SETTINGS['bigControlPanel'] = FALSE; } // Set predefined value for Clipboard: if ($this->modTSconfig['properties']['enableClipBoard'] === 'activated') { $this->MOD_SETTINGS['clipBoard'] = TRUE; } elseif ($this->modTSconfig['properties']['enableClipBoard'] === 'deactivated') { $this->MOD_SETTINGS['clipBoard'] = FALSE; } // Set predefined value for LocalizationView: if ($this->modTSconfig['properties']['enableLocalizationView'] === 'activated') { $this->MOD_SETTINGS['localization'] = TRUE; } elseif ($this->modTSconfig['properties']['enableLocalizationView'] === 'deactivated') { $this->MOD_SETTINGS['localization'] = FALSE; } // Initialize the dblist object: /** @var $dblist \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList */ $dblist = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Recordlist\\RecordList\\DatabaseRecordList'); $dblist->backPath = $GLOBALS['BACK_PATH']; $dblist->script = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_list', array(), ''); $dblist->calcPerms = $GLOBALS['BE_USER']->calcPerms($this->pageinfo); $dblist->thumbs = $GLOBALS['BE_USER']->uc['thumbnailsByDefault']; $dblist->returnUrl = $this->returnUrl; $dblist->allFields = $this->MOD_SETTINGS['bigControlPanel'] || $this->table ? 1 : 0; $dblist->localizationView = $this->MOD_SETTINGS['localization']; $dblist->showClipboard = 1; $dblist->disableSingleTableView = $this->modTSconfig['properties']['disableSingleTableView']; $dblist->listOnlyInSingleTableMode = $this->modTSconfig['properties']['listOnlyInSingleTableView']; $dblist->hideTables = $this->modTSconfig['properties']['hideTables']; $dblist->hideTranslations = $this->modTSconfig['properties']['hideTranslations']; $dblist->tableTSconfigOverTCA = $this->modTSconfig['properties']['table.']; $dblist->alternateBgColors = $this->modTSconfig['properties']['alternateBgColors'] ? 1 : 0; $dblist->allowedNewTables = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->modTSconfig['properties']['allowedNewTables'], 1); $dblist->deniedNewTables = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->modTSconfig['properties']['deniedNewTables'], 1); $dblist->newWizards = $this->modTSconfig['properties']['newWizards'] ? 1 : 0; $dblist->pageRow = $this->pageinfo; $dblist->counter++; $dblist->MOD_MENU = array('bigControlPanel' => '', 'clipBoard' => '', 'localization' => ''); $dblist->modTSconfig = $this->modTSconfig; $clickTitleMode = trim($this->modTSconfig['properties']['clickTitleMode']); $dblist->clickTitleMode = $clickTitleMode === '' ? 'edit' : $clickTitleMode; // Clipboard is initialized: // Start clipboard $dblist->clipObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Clipboard\\Clipboard'); // Initialize - reads the clipboard content from the user session $dblist->clipObj->initializeClipboard(); // Clipboard actions are handled: // CB is the clipboard command array $CB = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('CB'); if ($this->cmd == 'setCB') { // CBH is all the fields selected for the clipboard, CBC is the checkbox fields which were checked. // By merging we get a full array of checked/unchecked elements // This is set to the 'el' array of the CB after being parsed so only the table in question is registered. $CB['el'] = $dblist->clipObj->cleanUpCBC(array_merge((array) \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('CBH'), (array) \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('CBC')), $this->cmd_table); } if (!$this->MOD_SETTINGS['clipBoard']) { // If the clipboard is NOT shown, set the pad to 'normal'. $CB['setP'] = 'normal'; } // Execute commands. $dblist->clipObj->setCmd($CB); // Clean up pad $dblist->clipObj->cleanCurrent(); // Save the clipboard content $dblist->clipObj->endClipboard(); // This flag will prevent the clipboard panel in being shown. // It is set, if the clickmenu-layer is active AND the extended view is not enabled. $dblist->dontShowClipControlPanels = $GLOBALS['CLIENT']['FORMSTYLE'] && !$this->MOD_SETTINGS['bigControlPanel'] && $dblist->clipObj->current == 'normal' && !$this->modTSconfig['properties']['showClipControlPanelsDespiteOfCMlayers']; // If there is access to the page, then render the list contents and set up the document template object: if ($access) { // Deleting records...: // Has not to do with the clipboard but is simply the delete action. The clipboard object is used to clean up the submitted entries to only the selected table. if ($this->cmd == 'delete') { $items = $dblist->clipObj->cleanUpCBC(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('CBC'), $this->cmd_table, 1); if (count($items)) { $cmd = array(); foreach ($items as $iK => $value) { $iKParts = explode('|', $iK); $cmd[$iKParts[0]][$iKParts[1]]['delete'] = 1; } $tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandler\\DataHandler'); $tce->stripslashes_values = 0; $tce->start(array(), $cmd); $tce->process_cmdmap(); if (isset($cmd['pages'])) { \TYPO3\CMS\Backend\Utility\BackendUtility::setUpdateSignal('updatePageTree'); } $tce->printLogErrorMessages(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI')); } } // Initialize the listing object, dblist, for rendering the list: $this->pointer = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->pointer, 0, 100000); $dblist->start($this->id, $this->table, $this->pointer, $this->search_field, $this->search_levels, $this->showLimit); $dblist->setDispFields(); // Render versioning selector: if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('version')) { $dblist->HTMLcode .= $this->doc->getVersionSelector($this->id); } // Render the list of tables: $dblist->generateList(); // Write the bottom of the page: $dblist->writeBottom(); $listUrl = substr($dblist->listURL(), strlen($GLOBALS['BACK_PATH'])); // Add JavaScript functions to the page: $this->doc->JScode = $this->doc->wrapScriptTags(' function jumpToUrl(URL) { // window.location.href = URL; return false; } function jumpExt(URL,anchor) { // var anc = anchor?anchor:""; window.location.href = URL+(T3_THIS_LOCATION?"&returnUrl="+T3_THIS_LOCATION:"")+anc; return false; } function jumpSelf(URL) { // window.location.href = URL+(T3_RETURN_URL?"&returnUrl="+T3_RETURN_URL:""); return false; } function setHighlight(id) { // top.fsMod.recentIds["web"]=id; top.fsMod.navFrameHighlightedID["web"]="pages"+id+"_"+top.fsMod.currentBank; // For highlighting if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) { top.content.nav_frame.refresh_nav(); } } ' . $this->doc->redirectUrls($listUrl) . ' ' . $dblist->CBfunctions() . ' function editRecords(table,idList,addParams,CBflag) { // window.location.href="' . $GLOBALS['BACK_PATH'] . 'alt_doc.php?returnUrl=' . rawurlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI')) . '&edit["+table+"]["+idList+"]=edit"+addParams; } function editList(table,idList) { // var list=""; // Checking how many is checked, how many is not var pointer=0; var pos = idList.indexOf(","); while (pos!=-1) { if (cbValue(table+"|"+idList.substr(pointer,pos-pointer))) { list+=idList.substr(pointer,pos-pointer)+","; } pointer=pos+1; pos = idList.indexOf(",",pointer); } if (cbValue(table+"|"+idList.substr(pointer))) { list+=idList.substr(pointer)+","; } return list ? list : idList; } if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . '; '); // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); } // access // Begin to compile the whole page, starting out with page header: $this->body = $this->doc->header($this->pageinfo['title']); $this->body .= '<form action="' . htmlspecialchars($dblist->listURL()) . '" method="post" name="dblistForm">'; $this->body .= $dblist->HTMLcode; $this->body .= '<input type="hidden" name="cmd_table" /><input type="hidden" name="cmd" /></form>'; // If a listing was produced, create the page footer with search form etc: if ($dblist->HTMLcode) { // Making field select box (when extended view for a single table is enabled): if ($dblist->table) { $this->body .= $dblist->fieldSelectBox($dblist->table); } // Adding checkbox options for extended listing and clipboard display: $this->body .= ' <!-- Listing options for extended view, clipboard and localization view --> <div id="typo3-listOptions"> <form action="" method="post">'; // Add "display bigControlPanel" checkbox: if ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'selectable') { $this->body .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->id, 'SET[bigControlPanel]', $this->MOD_SETTINGS['bigControlPanel'], '', $this->table ? '&table=' . $this->table : '', 'id="checkLargeControl"'); $this->body .= '<label for="checkLargeControl">' . \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_options', $GLOBALS['LANG']->getLL('largeControl', TRUE)) . '</label><br />'; } // Add "clipboard" checkbox: if ($this->modTSconfig['properties']['enableClipBoard'] === 'selectable') { if ($dblist->showClipboard) { $this->body .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->id, 'SET[clipBoard]', $this->MOD_SETTINGS['clipBoard'], '', $this->table ? '&table=' . $this->table : '', 'id="checkShowClipBoard"'); $this->body .= '<label for="checkShowClipBoard">' . \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_options', $GLOBALS['LANG']->getLL('showClipBoard', TRUE)) . '</label><br />'; } } // Add "localization view" checkbox: if ($this->modTSconfig['properties']['enableLocalizationView'] === 'selectable') { $this->body .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->id, 'SET[localization]', $this->MOD_SETTINGS['localization'], '', $this->table ? '&table=' . $this->table : '', 'id="checkLocalization"'); $this->body .= '<label for="checkLocalization">' . \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_options', $GLOBALS['LANG']->getLL('localization', TRUE)) . '</label><br />'; } $this->body .= ' </form> </div>'; // Printing clipboard if enabled: if ($this->MOD_SETTINGS['clipBoard'] && $dblist->showClipboard) { $this->body .= '<div class="db_list-dashboard">' . $dblist->clipObj->printClipboard() . '</div>'; } // Search box: if (!$this->modTSconfig['properties']['disableSearchBox']) { $sectionTitle = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_searchbox', $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.search', TRUE)); $this->body .= '<div class="db_list-searchbox">' . $this->doc->section($sectionTitle, $dblist->getSearchBox(), FALSE, TRUE, FALSE, TRUE) . '</div>'; } // Additional footer content $footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['recordlist/mod1/index.php']['drawFooterHook']; if (is_array($footerContentHook)) { foreach ($footerContentHook as $hook) { $params = array(); $this->body .= \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hook, $params, $this); } } } // Setting up the buttons and markers for docheader $docHeaderButtons = $dblist->getButtons(); $markers = array('CSH' => $docHeaderButtons['csh'], 'CONTENT' => $this->body, 'EXTRACONTAINERCLASS' => $this->table ? 'singletable' : ''); // Build the <body> for the module $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); // Renders the module page $this->content = $this->doc->render('DB list', $this->content); }
/** * Returns the reference to a 'resource' in TypoScript. * This could be from the filesystem if '/' is found in the value $fileFromSetup, else from the resource-list * * @param string $fileFromSetup TypoScript "resource" data type value. * @return string Resulting filename, if any. * @todo Define visibility */ public function getFileName($fileFromSetup) { $file = trim($fileFromSetup); if (!$file) { return; } elseif (strstr($file, '../')) { if ($this->tt_track) { $GLOBALS['TT']->setTSlogMessage('File path "' . $file . '" contained illegal string "../"!', 3); } return; } // Cache $hash = md5($file); if (isset($this->fileCache[$hash])) { return $this->fileCache[$hash]; } if (!strcmp(substr($file, 0, 4), 'EXT:')) { $newFile = ''; list($extKey, $script) = explode('/', substr($file, 4), 2); if ($extKey && \TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded($extKey)) { $extPath = \TYPO3\CMS\Core\Extension\ExtensionManager::extPath($extKey); $newFile = substr($extPath, strlen(PATH_site)) . $script; } if (!@is_file(PATH_site . $newFile)) { if ($this->tt_track) { $GLOBALS['TT']->setTSlogMessage('Extension media file "' . $newFile . '" was not found!', 3); } return; } else { $file = $newFile; } } if (parse_url($file) !== FALSE) { return $file; } // Find if (strpos($file, '/') !== FALSE) { // If the file is in the media/ folder but it doesn't exist, // it is assumed that it's in the tslib folder if (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($file, 'media/') && !is_file($this->getFileName_backPath . $file)) { $file = \TYPO3\CMS\Core\Extension\ExtensionManager::siteRelPath('cms') . 'tslib/' . $file; } if (is_file($this->getFileName_backPath . $file)) { $outFile = $file; $fileInfo = \TYPO3\CMS\Core\Utility\GeneralUtility::split_fileref($outFile); $OK = 0; foreach ($this->allowedPaths as $val) { if (substr($fileInfo['path'], 0, strlen($val)) == $val) { $OK = 1; break; } } if ($OK) { $this->fileCache[$hash] = $outFile; return $outFile; } elseif ($this->tt_track) { $GLOBALS['TT']->setTSlogMessage('"' . $file . '" was not located in the allowed paths: (' . implode(',', $this->allowedPaths) . ')', 3); } } elseif ($this->tt_track) { $GLOBALS['TT']->setTSlogMessage('"' . $this->getFileName_backPath . $file . '" is not a file (non-uploads/.. resource, did not exist).', 3); } } }
<?php if (!defined('TYPO3_MODE')) { die('Access denied.'); } \TYPO3\CMS\Core\Extension\ExtensionManager::addPItoST43($_EXTKEY); if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('extbase')) { // Configure the Extbase Plugin \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin($_EXTKEY, 'Pi2', array('Search' => 'form,search'), array('Search' => 'form,search')); } // Attach to hooks: $TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['pageIndexing'][] = 'EXT:indexed_search/class.indexer.php:tx_indexedsearch_indexer'; $TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['headerNoCache']['tx_indexedsearch'] = 'EXT:indexed_search/hooks/class.tx_indexedsearch_tslib_fe_hook.php:&tx_indexedsearch_tslib_fe_hook->headerNoCache'; // Register with "crawler" extension: $TYPO3_CONF_VARS['EXTCONF']['crawler']['procInstructions']['tx_indexedsearch_reindex'] = 'Re-indexing'; $TYPO3_CONF_VARS['EXTCONF']['crawler']['cli_hooks']['tx_indexedsearch_crawl'] = 'EXT:indexed_search/class.crawler.php:&tx_indexedsearch_crawler'; // Register with TCEmain: $TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass']['tx_indexedsearch'] = 'EXT:indexed_search/class.crawler.php:&tx_indexedsearch_crawler'; $TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass']['tx_indexedsearch'] = 'EXT:indexed_search/class.crawler.php:&tx_indexedsearch_crawler'; // Configure default document parsers: $TYPO3_CONF_VARS['EXTCONF']['indexed_search']['external_parsers'] = array('pdf' => 'EXT:indexed_search/class.external_parser.php:&TYPO3\\CMS\\IndexedSearch\\FileContentParser', 'doc' => 'EXT:indexed_search/class.external_parser.php:&TYPO3\\CMS\\IndexedSearch\\FileContentParser', 'pps' => 'EXT:indexed_search/class.external_parser.php:&TYPO3\\CMS\\IndexedSearch\\FileContentParser', 'ppt' => 'EXT:indexed_search/class.external_parser.php:&TYPO3\\CMS\\IndexedSearch\\FileContentParser', 'xls' => 'EXT:indexed_search/class.external_parser.php:&TYPO3\\CMS\\IndexedSearch\\FileContentParser', 'sxc' => 'EXT:indexed_search/class.external_parser.php:&TYPO3\\CMS\\IndexedSearch\\FileContentParser', 'sxi' => 'EXT:indexed_search/class.external_parser.php:&TYPO3\\CMS\\IndexedSearch\\FileContentParser', 'sxw' => 'EXT:indexed_search/class.external_parser.php:&TYPO3\\CMS\\IndexedSearch\\FileContentParser', 'ods' => 'EXT:indexed_search/class.external_parser.php:&TYPO3\\CMS\\IndexedSearch\\FileContentParser', 'odp' => 'EXT:indexed_search/class.external_parser.php:&TYPO3\\CMS\\IndexedSearch\\FileContentParser', 'odt' => 'EXT:indexed_search/class.external_parser.php:&TYPO3\\CMS\\IndexedSearch\\FileContentParser', 'rtf' => 'EXT:indexed_search/class.external_parser.php:&TYPO3\\CMS\\IndexedSearch\\FileContentParser', 'txt' => 'EXT:indexed_search/class.external_parser.php:&TYPO3\\CMS\\IndexedSearch\\FileContentParser', 'html' => 'EXT:indexed_search/class.external_parser.php:&TYPO3\\CMS\\IndexedSearch\\FileContentParser', 'htm' => 'EXT:indexed_search/class.external_parser.php:&TYPO3\\CMS\\IndexedSearch\\FileContentParser', 'csv' => 'EXT:indexed_search/class.external_parser.php:&TYPO3\\CMS\\IndexedSearch\\FileContentParser', 'xml' => 'EXT:indexed_search/class.external_parser.php:&TYPO3\\CMS\\IndexedSearch\\FileContentParser', 'jpg' => 'EXT:indexed_search/class.external_parser.php:&TYPO3\\CMS\\IndexedSearch\\FileContentParser', 'jpeg' => 'EXT:indexed_search/class.external_parser.php:&TYPO3\\CMS\\IndexedSearch\\FileContentParser', 'tif' => 'EXT:indexed_search/class.external_parser.php:&TYPO3\\CMS\\IndexedSearch\\FileContentParser'); $TYPO3_CONF_VARS['EXTCONF']['indexed_search']['use_tables'] = 'index_phash,index_fulltext,index_rel,index_words,index_section,index_grlist,index_stat_search,index_stat_word,index_debug,index_config'; // unserializing the configuration so we can use it here: $_EXTCONF = unserialize($_EXTCONF); // Use the advanced doubleMetaphone parser instead of the internal one (usage of metaphone parsers is generally disabled by default) if (isset($_EXTCONF['enableMetaphoneSearch']) && intval($_EXTCONF['enableMetaphoneSearch']) == 2) { $TYPO3_CONF_VARS['EXTCONF']['indexed_search']['metaphone'] = 'EXT:indexed_search/class.doublemetaphone.php:&TYPO3\\CMS\\IndexedSearch\\Utility\\DoubleMetaPhoneUtility'; }
/** * Records overview * * @return void * @todo Define visibility */ public function func_records() { /** @var $admin \TYPO3\CMS\Core\Integrity\DatabaseIntegrityCheck */ $admin = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Integrity\\DatabaseIntegrityCheck'); $admin->genTree_makeHTML = 0; $admin->backPath = $GLOBALS['BACK_PATH']; $admin->genTree(0, ''); $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('records')); // Pages stat $codeArr = array(); $codeArr['tableheader'] = array('', $GLOBALS['LANG']->getLL('count')); $i++; $codeArr[$i][] = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', array()); $codeArr[$i][] = $GLOBALS['LANG']->getLL('total_pages'); $codeArr[$i][] = count($admin->page_idArray); $i++; if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('cms')) { $codeArr[$i][] = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', array('hidden' => 1)); $codeArr[$i][] = $GLOBALS['LANG']->getLL('hidden_pages'); $codeArr[$i][] = $admin->recStats['hidden']; $i++; } $codeArr[$i][] = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', array('deleted' => 1)); $codeArr[$i][] = $GLOBALS['LANG']->getLL('deleted_pages'); $codeArr[$i][] = count($admin->recStats['deleted']['pages']); $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('pages'), $this->doc->table($codeArr), FALSE, TRUE); // Doktype $codeArr = array(); $codeArr['tableheader'] = array($GLOBALS['LANG']->getLL('doktype_value'), $GLOBALS['LANG']->getLL('count')); $doktype = $GLOBALS['TCA']['pages']['columns']['doktype']['config']['items']; if (is_array($doktype)) { foreach ($doktype as $n => $setup) { if ($setup[1] != '--div--') { $codeArr[$n][] = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', array('doktype' => $setup[1])); $codeArr[$n][] = $GLOBALS['LANG']->sL($setup[0]) . ' (' . $setup[1] . ')'; $codeArr[$n][] = intval($admin->recStats['doktype'][$setup[1]]); } } $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('doktype'), $this->doc->table($codeArr), FALSE, TRUE); } // Tables and lost records $id_list = '-1,0,' . implode(',', array_keys($admin->page_idArray)); $id_list = rtrim($id_list, ','); $admin->lostRecords($id_list); if ($admin->fixLostRecord(\TYPO3\CMS\Core\Utility\GeneralUtility::_GET('fixLostRecords_table'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('fixLostRecords_uid'))) { $admin = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Integrity\\DatabaseIntegrityCheck'); $admin->backPath = $BACK_PATH; $admin->genTree(0, ''); $id_list = '-1,0,' . implode(',', array_keys($admin->page_idArray)); $id_list = rtrim($id_list, ','); $admin->lostRecords($id_list); } $this->doc->table_TABLE = '<table border="0" cellspacing="0" cellpadding="0" class="typo3-dblist" style="width:700px!important;">'; $codeArr = array(); $codeArr['tableheader'] = array($GLOBALS['LANG']->getLL('label'), $GLOBALS['LANG']->getLL('tablename'), $GLOBALS['LANG']->getLL('total_lost'), ''); $countArr = $admin->countRecords($id_list); if (is_array($GLOBALS['TCA'])) { foreach ($GLOBALS['TCA'] as $t => $value) { if ($GLOBALS['TCA'][$t]['ctrl']['hideTable']) { continue; } $codeArr[$t][] = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($t, array()); $codeArr[$t][] = $GLOBALS['LANG']->sL($GLOBALS['TCA'][$t]['ctrl']['title']); $codeArr[$t][] = $t; if ($t === 'pages' && $admin->lostPagesList !== '') { $lostRecordCount = count(explode(',', $admin->lostPagesList)); } else { $lostRecordCount = count($admin->lRecords[$t]); } if ($countArr['all'][$t]) { $theNumberOfRe = intval($countArr['non_deleted'][$t]) . '/' . $lostRecordCount; } else { $theNumberOfRe = ''; } $codeArr[$t][] = $theNumberOfRe; $lr = ''; if (is_array($admin->lRecords[$t])) { foreach ($admin->lRecords[$t] as $data) { if (!\TYPO3\CMS\Core\Utility\GeneralUtility::inList($admin->lostPagesList, $data[pid])) { $lr .= '<nobr><strong><a href="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('tools_dbint') . '&SET[function]=records&fixLostRecords_table=' . $t . '&fixLostRecords_uid=' . $data['uid']) . '"><img src="' . $BACK_PATH . 'gfx/required_h.gif" width="10" hspace="3" height="10" border="0" align="top" title="' . $GLOBALS['LANG']->getLL('fixLostRecord') . '"></a>uid:' . $data['uid'] . ', pid:' . $data['pid'] . ', ' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs(strip_tags($data['title']), 20)) . '</strong></nobr><br>'; } else { $lr .= '<nobr><img src="' . $BACK_PATH . 'clear.gif" width="16" height="1" border="0"><font color="Gray">uid:' . $data['uid'] . ', pid:' . $data['pid'] . ', ' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs(strip_tags($data['title']), 20)) . '</font></nobr><br>'; } } } $codeArr[$t][] = $lr; } $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('tables'), $this->doc->table($codeArr), FALSE, TRUE); } }
/** * Clears page cache. Takes into account file cache. * * @return void * @todo Define visibility */ public function internal_clearPageCache() { if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('cms')) { $GLOBALS['typo3CacheManager']->getCache('cache_pages')->flush(); } }
/** * Wraps the title of the items listed in link-tags. The items will link to the page/folder where they originate from * * @param string $str Title of element - must be htmlspecialchar'ed on beforehand. * @param mixed $rec If array, a record is expected. If string, its a path * @param string $table Table name * @return string * @todo Define visibility */ public function linkItemText($str, $rec, $table = '') { if (is_array($rec) && $table) { if ($this->fileMode) { $str = $GLOBALS['TBE_TEMPLATE']->dfw($str); } else { if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('recordlist')) { $str = '<a href="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_list', array('id' => $rec['pid']), $this->backPath)) . '">' . $str . '</a>'; } } } elseif (file_exists($rec)) { if (!$this->fileMode) { $str = $GLOBALS['TBE_TEMPLATE']->dfw($str); } else { if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('filelist')) { $str = '<a href="' . htmlspecialchars($this->backPath . \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('file_list') . '&id=' . dirname($rec)) . '">' . $str . '</a>'; } } } return $str; }
* * @author Kasper Skårhøj <*****@*****.**> */ unset($MCONF); require 'conf.php'; require $BACK_PATH . 'init.php'; // Unset MCONF/MLANG since all we wanted was back path etc. for this particular script. unset($MCONF); unset($MLANG); // Merging locallang files/arrays: $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_misc.xml'); $LOCAL_LANG_orig = $LOCAL_LANG; $LANG->includeLLFile('EXT:cms/layout/locallang_db_new_content_el.xml'); $LOCAL_LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($LOCAL_LANG_orig, $LOCAL_LANG); // Exits if 'cms' extension is not loaded: \TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('cms', 1); /** * Local position map class * * @author Kasper Skårhøj <*****@*****.**> * @package TYPO3 * @subpackage core */ class ext_posMap extends \TYPO3\CMS\Backend\Tree\View\PagePositionMap { /** * @todo Define visibility */ public $dontPrintPageInsertIcons = 1; /** * Wrapping the title of the record - here we just return it.
# Setting ' . $_EXTKEY . ' plugin TypoScript ' . $pluginContent); $addLine = ' tt_content.login = COA tt_content.login { 10 = < lib.stdheader 20 > 20 = < plugin.tx_felogin_pi1 } '; \TYPO3\CMS\Core\Extension\ExtensionManager::addTypoScript($_EXTKEY, 'setup', '# Setting ' . $_EXTKEY . ' plugin TypoScript' . $addLine . '', 43); \TYPO3\CMS\Core\Extension\ExtensionManager::addPageTSConfig(' mod.wizards.newContentElement.wizardItems.forms { elements { login { icon = gfx/c_wiz/login_form.gif title = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:forms_login_title description = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:forms_login_description tt_content_defValues { CType = login } } } show :=addToList(login) } '); // Activate support for kb_md5fepw if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('kb_md5fepw') && TYPO3_MODE == 'FE') { $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['loginFormOnSubmitFuncs'][] = 'tx_kbmd5fepw_newloginbox->loginFormOnSubmit'; require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('kb_md5fepw') . 'pi1/class.tx_kbmd5fepw_newloginbox.php'; }
/** * second step: get user input for installing sysextensions * * @param string input prefix, all names of form fields have to start with this. Append custom name in [ ... ] * @return string HTML output */ public function getUserInput($inputPrefix) { $content = ' <p> <strong> Install the following system extensions that are new in TYPO3 4.3: </strong> </p> '; $content .= ' <fieldset> <ol> '; foreach ($this->newSystemExtensions as $_EXTKEY) { if (!\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded($_EXTKEY)) { $EM_CONF = FALSE; // extension may not been loaded at this point, so we can't use an API function from t3lib_extmgm require PATH_site . 'typo3/sysext/' . $_EXTKEY . '/ext_emconf.php'; $content .= ' <li class="labelAfter"> <input type="checkbox" id="' . $_EXTKEY . '" name="' . $inputPrefix . '[sysext][' . $_EXTKEY . ']" value="1" checked="checked" /> <label for="' . $_EXTKEY . '">' . $EM_CONF[$_EXTKEY]['title'] . ' [' . $_EXTKEY . ']</label> </li> '; } } $content .= ' </ol> </fieldset> '; return $content; }
public function main($parentObject) { return parent::main($parentObject) && \TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('static_info_tables') && !in_array($this->htmlAreaRTE->language, \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->htmlAreaRTE->ID]['plugins'][$pluginName]['noSpellCheckLanguages'])) && ($this->htmlAreaRTE->contentCharset == 'iso-8859-1' || $this->htmlAreaRTE->contentCharset == 'utf-8'); }
/** * Generates and return information about which languages the current user should see in preview, configured by options.additionalPreviewLanguages * * @return array Array of additional languages to preview * @todo Define visibility */ public function getAdditionalPreviewLanguages() { if (!isset($this->cachedAdditionalPreviewLanguages)) { if ($GLOBALS['BE_USER']->getTSConfigVal('options.additionalPreviewLanguages')) { $uids = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $GLOBALS['BE_USER']->getTSConfigVal('options.additionalPreviewLanguages')); foreach ($uids as $uid) { if ($sys_language_rec = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('sys_language', $uid)) { $this->cachedAdditionalPreviewLanguages[$uid] = array('uid' => $uid); if ($sys_language_rec['static_lang_isocode'] && \TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('static_info_tables')) { $staticLangRow = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('static_languages', $sys_language_rec['static_lang_isocode'], 'lg_iso_2'); if ($staticLangRow['lg_iso_2']) { $this->cachedAdditionalPreviewLanguages[$uid]['uid'] = $uid; $this->cachedAdditionalPreviewLanguages[$uid]['ISOcode'] = $staticLangRow['lg_iso_2']; } } } } } else { // None: $this->cachedAdditionalPreviewLanguages = array(); } } return $this->cachedAdditionalPreviewLanguages; }