/**
  * Checks RSA configuration and creates warnings if necessary.
  *
  * @param	array	$warnings	Warnings
  * @return	void
  * @see	t3lib_BEfunc::displayWarningMessages()
  */
 public function displayWarningMessages_postProcess(array &$warnings)
 {
     $backend = tx_rsaauth_backendfactory::getBackend();
     if ($backend instanceof tx_rsaauth_cmdline_backend) {
         // Not using the PHP extension!
         $warnings['rsaauth_cmdline'] = $GLOBALS['LANG']->sL('LLL:EXT:rsaauth/hooks/locallang.xml:hook_using_cmdline');
         // Check the path
         $extconf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['rsaauth']);
         $path = trim($extconf['temporaryDirectory']);
         if ($path == '') {
             // Path is empty
             $warnings['rsaauth'] = $GLOBALS['LANG']->sL('LLL:EXT:rsaauth/hooks/locallang.xml:hook_empty_directory');
         } elseif (!t3lib_div::isAbsPath($path)) {
             // Path is not absolute
             $warnings['rsaauth'] = $GLOBALS['LANG']->sL('LLL:EXT:rsaauth/hooks/locallang.xml:hook_directory_not_absolute');
         } elseif (!@is_dir($path)) {
             // Path does not represent a directory
             $warnings['rsaauth'] = $GLOBALS['LANG']->sL('LLL:EXT:rsaauth/hooks/locallang.xml:hook_directory_not_exist');
         } elseif (!@is_writable($path)) {
             // Directory is not writable
             $warnings['rsaauth'] = $GLOBALS['LANG']->sL('LLL:EXT:rsaauth/hooks/locallang.xml:hook_directory_not_writable');
         } elseif (substr($path, 0, strlen(PATH_site)) == PATH_site) {
             // Directory is inside the site root
             $warnings['rsaauth'] = $GLOBALS['LANG']->sL('LLL:EXT:rsaauth/hooks/locallang.xml:hook_directory_inside_siteroot');
         }
     }
 }
 /**
  * Checks if a given string is a valid frame URL to be loaded in the
  * backend.
  *
  * @param string $url potential URL to check
  *
  * @return string either $url if $url is considered to be harmless, or an
  *                empty string otherwise
  */
 private static function internalSanitizeLocalUrl($url = '')
 {
     $sanitizedUrl = '';
     $decodedUrl = rawurldecode($url);
     if ($decodedUrl !== t3lib_div::removeXSS($decodedUrl)) {
         $decodedUrl = '';
     }
     if (!empty($url) && $decodedUrl !== '') {
         $testAbsoluteUrl = t3lib_div::resolveBackPath($decodedUrl);
         $testRelativeUrl = t3lib_div::resolveBackPath(t3lib_div::dirname(t3lib_div::getIndpEnv('SCRIPT_NAME')) . '/' . $decodedUrl);
         // That's what's usually carried in TYPO3_SITE_PATH
         $typo3_site_path = substr(t3lib_div::getIndpEnv('TYPO3_SITE_URL'), strlen(t3lib_div::getIndpEnv('TYPO3_REQUEST_HOST')));
         // Pass if URL is on the current host:
         if (self::isValidUrl($decodedUrl)) {
             if (self::isOnCurrentHost($decodedUrl) && strpos($decodedUrl, t3lib_div::getIndpEnv('TYPO3_SITE_URL')) === 0) {
                 $sanitizedUrl = $url;
             }
             // Pass if URL is an absolute file path:
         } elseif (t3lib_div::isAbsPath($decodedUrl) && t3lib_div::isAllowedAbsPath($decodedUrl)) {
             $sanitizedUrl = $url;
             // Pass if URL is absolute and below TYPO3 base directory:
         } elseif (strpos($testAbsoluteUrl, $typo3_site_path) === 0 && substr($decodedUrl, 0, 1) === '/') {
             $sanitizedUrl = $url;
             // Pass if URL is relative and below TYPO3 base directory:
         } elseif (strpos($testRelativeUrl, $typo3_site_path) === 0 && substr($decodedUrl, 0, 1) !== '/') {
             $sanitizedUrl = $url;
         }
     }
     if (!empty($url) && empty($sanitizedUrl)) {
         t3lib_div::sysLog('The URL "' . $url . '" is not considered to be local and was denied.', 'Core', t3lib_div::SYSLOG_SEVERITY_NOTICE);
     }
     return $sanitizedUrl;
 }
 /**
  * @return boolean
  */
 public function execute()
 {
     t3lib_div::devLog('[tx_scheduler_ImportMember]: execute', 't3o_membership', 0);
     $membershipRecords = $this->getDatabaseConnection()->exec_SELECTgetRows('uid, name', 'tx_t3omembership_domain_model_membership', 'NOT hidden AND NOT deleted');
     foreach ($membershipRecords as $membershipRecord) {
         $this->memberships[$membershipRecord['name']] = (int) $membershipRecord['uid'];
     }
     // does the import file exist?
     $importFile = $this->getImportFile();
     if (!t3lib_div::isAbsPath($importFile)) {
         $importFile = t3lib_div::getFileAbsFileName($importFile);
     }
     if (!file_exists($importFile)) {
         t3lib_div::devLog('[tx_scheduler_ImportMember]: no importfile - given value: ' . $importFile, 't3o_membership', 0);
         return false;
     }
     $this->initializeHookObjects();
     $fileData = file($importFile);
     array_shift($fileData);
     foreach ($fileData as $key => $line) {
         $line = iconv('ISO-8859-15', 'UTF-8', $line);
         /** @noinspection PhpParamsInspection */
         $fields = t3lib_div::trimExplode("\t", $line);
         $membershipUid = $this->getMembershipUid($fields[12]);
         // Skip records with unknown membership types.
         if (empty($membershipUid)) {
             continue;
         }
         $subscriptionNo = (int) $fields[14];
         $endDate = $this->getMemberEndDate($fields[15]);
         // If the user has cancelled his membership "Gekündigt", we set the endtime enable field.
         $endTime = !empty($fields[17]) ? $endDate : 0;
         $hidden = false;
         if ($endTime > 0 && $endTime < time()) {
             $hidden = true;
         }
         $member = array('name' => $fields[6], 'subscription_no' => $subscriptionNo, 'external_id' => (int) $fields[0], 'address' => $fields[7] !== '' ? $fields[7] : $fields[8], 'zip' => $fields[10], 'city' => $fields[11], 'country' => $fields[13], 'end_date' => $endDate, 'endtime' => $endTime, 'hidden' => $hidden, 'starttime' => 0, 'membership' => $membershipUid, 'pid' => $this->getMembershipStoragePid(), 'crdate' => time(), 'tstamp' => time(), 'invoice_email' => $fields[84], 'email' => $fields[79], 'url' => $fields[80], 'firstname' => $fields[82], 'lastname' => $fields[83]);
         $memberUid = $this->createOrUpdateMember($subscriptionNo, $member);
         foreach ($this->hookObjects as $hookObject) {
             if (method_exists($hookObject, 'postUpdateMemberData')) {
                 $hookObject->postUpdateMemberData($memberUid, $member);
             }
         }
     }
     return true;
 }
 /**
  *
  * @param Tx_ExtensionBuilder_Domain_Model_Extension $extension
  * @param string $backupDir
  *
  * @return void
  */
 static function backupExtension($extension, $backupDir)
 {
     if (empty($backupDir)) {
         throw new Exception('Please define a backup directory in extension configuration!');
     } else {
         if (!t3lib_div::validPathStr($backupDir)) {
             throw new Exception('Backup directory is not a valid path: ' . $backupDir);
         } else {
             if (t3lib_div::isAbsPath($backupDir)) {
                 if (!t3lib_div::isAllowedAbsPath($backupDir)) {
                     throw new Exception('Backup directory is not an allowed absolute path: ' . $backupDir);
                 }
             } else {
                 $backupDir = PATH_site . $backupDir;
             }
         }
     }
     if (strrpos($backupDir, '/') < strlen($backupDir) - 1) {
         $backupDir .= '/';
     }
     if (!is_dir($backupDir)) {
         throw new Exception('Backup directory does not exist: ' . $backupDir);
     } else {
         if (!is_writable($backupDir)) {
             throw new Exception('Backup directory is not writable: ' . $backupDir);
         }
     }
     $backupDir .= $extension->getExtensionKey();
     // create a subdirectory for this extension
     if (!is_dir($backupDir)) {
         t3lib_div::mkdir($backupDir);
     }
     if (strrpos($backupDir, '/') < strlen($backupDir) - 1) {
         $backupDir .= '/';
     }
     $backupDir .= date('Y-m-d-') . time();
     if (!is_dir($backupDir)) {
         t3lib_div::mkdir($backupDir);
     }
     $extensionDir = substr($extension->getExtensionDir(), 0, strlen($extension->getExtensionDir()) - 1);
     try {
         self::recurse_copy($extensionDir, $backupDir);
     } catch (Exception $e) {
         throw new Exception('Code generation aborted:' . $e->getMessage());
     }
     t3lib_div::devlog('Backup created in ' . $backupDir, 'extension_builder', 0);
 }
 /**
  * gets the icon for the shortcut
  *
  * @param	string		backend module name
  * @return	string		shortcut icon as img tag
  */
 protected function getShortcutIcon($row, $shortcut)
 {
     global $TCA;
     switch ($row['module_name']) {
         case 'xMOD_alt_doc.php':
             $table = $shortcut['table'];
             $recordid = $shortcut['recordid'];
             if ($shortcut['type'] == 'edit') {
                 // Creating the list of fields to include in the SQL query:
                 $selectFields = $this->fieldArray;
                 $selectFields[] = 'uid';
                 $selectFields[] = 'pid';
                 if ($table == 'pages') {
                     if (t3lib_extMgm::isLoaded('cms')) {
                         $selectFields[] = 'module';
                         $selectFields[] = 'extendToSubpages';
                     }
                     $selectFields[] = 'doktype';
                 }
                 if (is_array($TCA[$table]['ctrl']['enablecolumns'])) {
                     $selectFields = array_merge($selectFields, $TCA[$table]['ctrl']['enablecolumns']);
                 }
                 if ($TCA[$table]['ctrl']['type']) {
                     $selectFields[] = $TCA[$table]['ctrl']['type'];
                 }
                 if ($TCA[$table]['ctrl']['typeicon_column']) {
                     $selectFields[] = $TCA[$table]['ctrl']['typeicon_column'];
                 }
                 if ($TCA[$table]['ctrl']['versioningWS']) {
                     $selectFields[] = 't3ver_state';
                 }
                 $selectFields = array_unique($selectFields);
                 // Unique list!
                 $permissionClause = $table == 'pages' && $this->perms_clause ? ' AND ' . $this->perms_clause : '';
                 $sqlQueryParts = array('SELECT' => implode(',', $selectFields), 'FROM' => $table, 'WHERE' => 'uid IN (' . $recordid . ') ' . $permissionClause . t3lib_BEfunc::deleteClause($table) . t3lib_BEfunc::versioningPlaceholderClause($table));
                 $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($sqlQueryParts);
                 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
                 $icon = t3lib_iconWorks::getIcon($table, $row, $this->backPath);
             } elseif ($shortcut['type'] == 'new') {
                 $icon = t3lib_iconWorks::getIcon($table, '', $this->backPath);
             }
             $icon = t3lib_iconWorks::skinImg($this->backPath, $icon, '', 1);
             break;
         case 'xMOD_file_edit.php':
             $icon = 'gfx/edit_file.gif';
             break;
         case 'xMOD_wizard_rte.php':
             $icon = 'gfx/edit_rtewiz.gif';
             break;
         default:
             if ($GLOBALS['LANG']->moduleLabels['tabs_images'][$row['module_name'] . '_tab']) {
                 $icon = $GLOBALS['LANG']->moduleLabels['tabs_images'][$row['module_name'] . '_tab'];
                 // change icon of fileadmin references - otherwise it doesn't differ with Web->List
                 $icon = str_replace('mod/file/list/list.gif', 'mod/file/file.gif', $icon);
                 if (t3lib_div::isAbsPath($icon)) {
                     $icon = '../' . substr($icon, strlen(PATH_site));
                 }
             } else {
                 $icon = 'gfx/dummy_module.gif';
             }
     }
     return '<img src="' . $icon . '" alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.shortcut', true) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:toolbarItems.shortcut', true) . '" />';
 }
 /**
  * Convert a path to an absolute path
  *
  * @param	string		$path Path to convert
  * @param	string		$mountpath Path which will be used as base path. Otherwise PATH_site is used.
  * @return	string		Absolute path
  */
 function path_makeAbsolute($path, $mountpath = NULL)
 {
     if ($path) {
         if (is_array($path)) {
             if (isset($path['dir_name'])) {
                 $path = $path['dir_path_absolute'] ? $path['dir_path_absolute'] : $path['dir_path'];
             } else {
                 $path = $path['file_path_absolute'] ? $path['file_path_absolute'] : $path['file_path'];
             }
         }
         $path = tx_dam::path_makeClean($path);
         if (t3lib_div::isAbsPath($path)) {
             return $path;
         }
         $mountpath = is_null($mountpath) ? PATH_site : tx_dam::path_makeClean($mountpath);
         $path = $mountpath ? $mountpath . $path : '';
     }
     return $path;
 }
 /**
  * Indexing files from fileadmin
  *
  * @param	array		Indexing Configuration Record
  * @param	array		Session data for the indexing session spread over multiple instances of the script. Passed by reference so changes hereto will be saved for the next call!
  * @param	array		Parameters from the log queue.
  * @param	object		Parent object (from "crawler" extension!)
  * @return	void
  */
 function crawler_execute_type2($cfgRec, &$session_data, $params, &$pObj)
 {
     // Prepare path, making it absolute and checking:
     $readpath = $params['url'];
     if (!t3lib_div::isAbsPath($readpath)) {
         $readpath = t3lib_div::getFileAbsFileName($readpath);
     }
     if (t3lib_div::isAllowedAbsPath($readpath)) {
         if (@is_file($readpath)) {
             // If file, index it!
             // Get root line (need to provide this when indexing external files)
             $rl = $this->getUidRootLineForClosestTemplate($cfgRec['pid']);
             // Load indexer if not yet.
             $this->loadIndexerClass();
             // (Re)-Indexing file on page.
             $indexerObj = t3lib_div::makeInstance('tx_indexedsearch_indexer');
             $indexerObj->backend_initIndexer($cfgRec['pid'], 0, 0, '', $rl);
             $indexerObj->backend_setFreeIndexUid($cfgRec['uid'], $cfgRec['set_id']);
             $indexerObj->hash['phash'] = -1;
             // EXPERIMENT - but to avoid phash_t3 being written to file sections (otherwise they are removed when page is reindexed!!!)
             // Index document:
             $indexerObj->indexRegularDocument(substr($readpath, strlen(PATH_site)), TRUE);
         } elseif (@is_dir($readpath)) {
             // If dir, read content and create new pending items for log:
             // Select files and directories in path:
             $extList = implode(',', t3lib_div::trimExplode(',', $cfgRec['extensions'], 1));
             $fileArr = array();
             $files = t3lib_div::getAllFilesAndFoldersInPath($fileArr, $readpath, $extList, 0, 0);
             $directoryList = t3lib_div::get_dirs($readpath);
             if (is_array($directoryList) && $params['depth'] < $cfgRec['depth']) {
                 foreach ($directoryList as $subdir) {
                     if ((string) $subdir != '') {
                         $files[] = $readpath . $subdir . '/';
                     }
                 }
             }
             $files = t3lib_div::removePrefixPathFromList($files, PATH_site);
             // traverse the items and create log entries:
             foreach ($files as $path) {
                 $this->instanceCounter++;
                 if ($path !== $params['url']) {
                     // Parameters:
                     $nparams = array('indexConfigUid' => $cfgRec['uid'], 'url' => $path, 'procInstructions' => array('[Index Cfg UID#' . $cfgRec['uid'] . ']'), 'depth' => $params['depth'] + 1);
                     $pObj->addQueueEntry_callBack($cfgRec['set_id'], $nparams, $this->callBack, $cfgRec['pid'], $GLOBALS['EXEC_TIME'] + $this->instanceCounter * $this->secondsPerExternalUrl);
                 }
             }
         }
     }
 }
 /**
  * Loads the $TCA (Table Configuration Array) for the $table
  *
  * Requirements:
  * 1) must be configured table (the ctrl-section configured),
  * 2) columns must not be an array (which it is always if whole table loaded), and
  * 3) there is a value for dynamicConfigFile (filename in typo3conf)
  * Usage: 84
  *
  * @param	string		Table name for which to load the full TCA array part into the global $TCA
  * @return	void
  */
 function loadTCA($table)
 {
     global $TCA, $LANG_GENERAL_LABELS;
     if (isset($TCA[$table]) && !is_array($TCA[$table]['columns']) && $TCA[$table]['ctrl']['dynamicConfigFile']) {
         if (!strcmp(substr($TCA[$table]['ctrl']['dynamicConfigFile'], 0, 6), 'T3LIB:')) {
             include PATH_t3lib . 'stddb/' . substr($TCA[$table]['ctrl']['dynamicConfigFile'], 6);
         } elseif (t3lib_div::isAbsPath($TCA[$table]['ctrl']['dynamicConfigFile']) && @is_file($TCA[$table]['ctrl']['dynamicConfigFile'])) {
             // Absolute path...
             include $TCA[$table]['ctrl']['dynamicConfigFile'];
         } else {
             include PATH_typo3conf . $TCA[$table]['ctrl']['dynamicConfigFile'];
         }
     }
 }
 /**
  * Read image information from a associated text file.
  * The text file should have the same name as the image but
  * should end with '.txt'. Format
  * <pre>
  * {{title}}
  * {{description}}
  * {{author}}
  * </pre>
  *
  * @param	string		$image: path to the image
  * @return	array		title, description and author
  */
 public function readTextComment($image)
 {
     if (!t3lib_div::isAbsPath($image)) {
         $image = t3lib_div::getFileAbsFileName($image);
     }
     $data = array('title' => '', 'description' => '', 'author' => '');
     $textfile = substr($image, 0, strrpos($image, '.')) . '.txt';
     if (file_exists($textfile)) {
         $lines = file($textfile);
         if (count($lines)) {
             $data['title'] = $lines[0];
             $data['description'] = $lines[1];
             $data['author'] = $lines[2];
         }
     }
     return $data;
 }
 /**
  * Indexing a regular document given as $file (relative to PATH_site, local file)
  *
  * @param	string		Relative Filename, relative to PATH_site. It can also be an absolute path as long as it is inside the lockRootPath (validated with t3lib_div::isAbsPath()). Finally, if $contentTmpFile is set, this value can be anything, most likely a URL
  * @param	boolean		If set, indexing is forced (despite content hashes, mtime etc).
  * @param	string		Temporary file with the content to read it from (instead of $file). Used when the $file is a URL.
  * @param	string		File extension for temporary file.
  * @return	void
  */
 function indexRegularDocument($file, $force = FALSE, $contentTmpFile = '', $altExtension = '')
 {
     // Init
     $fI = pathinfo($file);
     $ext = $altExtension ? $altExtension : strtolower($fI['extension']);
     // Create abs-path:
     if (!$contentTmpFile) {
         if (!t3lib_div::isAbsPath($file)) {
             // Relative, prepend PATH_site:
             $absFile = t3lib_div::getFileAbsFileName(PATH_site . $file);
         } else {
             // Absolute, pass-through:
             $absFile = $file;
         }
         $absFile = t3lib_div::isAllowedAbsPath($absFile) ? $absFile : '';
     } else {
         $absFile = $contentTmpFile;
     }
     // Indexing the document:
     if ($absFile && @is_file($absFile)) {
         if ($this->external_parsers[$ext]) {
             $mtime = filemtime($absFile);
             $cParts = $this->fileContentParts($ext, $absFile);
             foreach ($cParts as $cPKey) {
                 $this->internal_log = array();
                 $this->log_push('Index: ' . str_replace('.', '_', basename($file)) . ($cPKey ? '#' . $cPKey : ''), '');
                 $Pstart = t3lib_div::milliseconds();
                 $subinfo = array('key' => $cPKey);
                 // Setting page range. This is "0" (zero) when no division is made, otherwise a range like "1-3"
                 $phash_arr = $this->file_phash_arr = $this->setExtHashes($file, $subinfo);
                 $check = $this->checkMtimeTstamp($mtime, $phash_arr['phash']);
                 if ($check > 0 || $force) {
                     if ($check > 0) {
                         $this->log_setTSlogMessage('Indexing needed, reason: ' . $this->reasons[$check], 1);
                     } else {
                         $this->log_setTSlogMessage('Indexing forced by flag', 1);
                     }
                     // Check external file counter:
                     if ($this->externalFileCounter < $this->maxExternalFiles || $force) {
                         // Divide into title,keywords,description and body:
                         $this->log_push('Split content', '');
                         $contentParts = $this->readFileContent($ext, $absFile, $cPKey);
                         $this->log_pull();
                         if (is_array($contentParts)) {
                             // Calculating a hash over what is to be the actual content. (see indexTypo3PageContent())
                             $content_md5h = $this->md5inthash(implode($contentParts, ''));
                             if ($this->checkExternalDocContentHash($phash_arr['phash_grouping'], $content_md5h) || $force) {
                                 // Increment counter:
                                 $this->externalFileCounter++;
                                 // Splitting words
                                 $this->log_push('Extract words from content', '');
                                 $splitInWords = $this->processWordsInArrays($contentParts);
                                 $this->log_pull();
                                 // Analyse the indexed words.
                                 $this->log_push('Analyse the extracted words', '');
                                 $indexArr = $this->indexAnalyze($splitInWords);
                                 $this->log_pull();
                                 // Submitting page (phash) record
                                 $this->log_push('Submitting page', '');
                                 $size = filesize($absFile);
                                 $ctime = filemtime($absFile);
                                 // Unfortunately I cannot determine WHEN a file is originally made - so I must return the modification time...
                                 $this->submitFilePage($phash_arr, $file, $subinfo, $ext, $mtime, $ctime, $size, $content_md5h, $contentParts);
                                 $this->log_pull();
                                 // Check words and submit to word list if not there
                                 $this->log_push('Check word list and submit words', '');
                                 $this->checkWordList($indexArr);
                                 $this->submitWords($indexArr, $phash_arr['phash']);
                                 $this->log_pull();
                                 // Set parsetime
                                 $this->updateParsetime($phash_arr['phash'], t3lib_div::milliseconds() - $Pstart);
                             } else {
                                 $this->updateTstamp($phash_arr['phash'], $mtime);
                                 // Update the timestamp
                                 $this->log_setTSlogMessage('Indexing not needed, the contentHash, ' . $content_md5h . ', has not changed. Timestamp updated.');
                             }
                         } else {
                             $this->log_setTSlogMessage('Could not index file! Unsupported extension.');
                         }
                     } else {
                         $this->log_setTSlogMessage('The limit of ' . $this->maxExternalFiles . ' has already been exceeded, so no indexing will take place this time.');
                     }
                 } else {
                     $this->log_setTSlogMessage('Indexing not needed, reason: ' . $this->reasons[$check]);
                 }
                 // Checking and setting sections:
                 #			$this->submitFile_grlist($phash_arr['phash']);	// Setting a gr_list record if there is none already (set for default fe_group)
                 $this->submitFile_section($phash_arr['phash']);
                 // Setting a section-record for the file. This is done also if the file is not indexed. Notice that section records are deleted when the page is indexed.
                 $this->log_pull();
             }
         } else {
             $this->log_setTSlogMessage('Indexing not possible; The extension "' . $ext . '" was not supported.');
         }
     } else {
         $this->log_setTSlogMessage('Indexing not possible; File "' . $absFile . '" not found or valid.');
     }
 }
 /**
  * Initialize file-based statistics handling: Check filename and permissions, and create the logfile if it does not exist yet.
  * This function should be called with care because it might overwrite existing settings otherwise.
  *
  * @return	boolean		True if statistics are enabled (will require some more processing after charset handling is initialized)
  * @access private
  */
 protected function statistics_init()
 {
     $setStatPageName = false;
     $theLogFile = $this->TYPO3_CONF_VARS['FE']['logfile_dir'] . strftime($this->config['config']['stat_apache_logfile']);
     // Add PATH_site left to $theLogFile if the path is not absolute yet
     if (!t3lib_div::isAbsPath($theLogFile)) {
         $theLogFile = PATH_site . $theLogFile;
     }
     if ($this->config['config']['stat_apache'] && $this->config['config']['stat_apache_logfile'] && !strstr($this->config['config']['stat_apache_logfile'], '/')) {
         if (t3lib_div::isAllowedAbsPath($theLogFile)) {
             if (!@is_file($theLogFile)) {
                 touch($theLogFile);
                 // Try to create the logfile
                 t3lib_div::fixPermissions($theLogFile);
             }
             if (@is_file($theLogFile) && @is_writable($theLogFile)) {
                 $this->config['stat_vars']['logFile'] = $theLogFile;
                 $setStatPageName = true;
                 // Set page name later on
             } else {
                 $GLOBALS['TT']->setTSlogMessage('Could not set logfile path. Check filepath and permissions.', 3);
             }
         }
     }
     return $setStatPageName;
 }
Beispiel #12
0
 /**
  * Function to load a HTML template file with markers.
  * When calling from own extension, use  syntax getHtmlTemplate('EXT:extkey/template.html')
  *
  * @param	string		tmpl name, usually in the typo3/template/ directory
  * @return	string		HTML of template
  */
 function getHtmlTemplate($filename)
 {
     // setting the name of the original HTML template
     $this->moduleTemplateFilename = $filename;
     if ($GLOBALS['TBE_STYLES']['htmlTemplates'][$filename]) {
         $filename = $GLOBALS['TBE_STYLES']['htmlTemplates'][$filename];
     }
     if (t3lib_div::isFirstPartOfStr($filename, 'EXT:')) {
         $filename = t3lib_div::getFileAbsFileName($filename, TRUE, TRUE);
     } else {
         if (!t3lib_div::isAbsPath($filename)) {
             $filename = t3lib_div::resolveBackPath($this->backPath . $filename);
         } else {
             if (!t3lib_div::isAllowedAbsPath($filename)) {
                 $filename = '';
             }
         }
     }
     $htmlTemplate = '';
     if ($filename !== '') {
         $htmlTemplate = t3lib_div::getURL($filename);
     }
     return $htmlTemplate;
 }
 /**
  * Returns relative path to the icon filename for use in img-tags
  *
  * @param	string		icon filename
  * @return	string		icon filename with relative path
  * @see getModuleIconAbsolute()
  */
 protected function getModuleIconRelative($iconFilename)
 {
     if (t3lib_div::isAbsPath($iconFilename)) {
         $iconFilename = '../' . substr($iconFilename, strlen(PATH_site));
     }
     return $this->backPath . $iconFilename;
 }
Beispiel #14
0
 /**
  * Loads the $TCA (Table Configuration Array) for the $table
  *
  * Requirements:
  * 1) must be configured table (the ctrl-section configured),
  * 2) columns must not be an array (which it is always if whole table loaded), and
  * 3) there is a value for dynamicConfigFile (filename in typo3conf)
  *
  * Note: For the frontend this loads only 'ctrl' and 'feInterface' parts.
  * For complete TCA use $GLOBALS['TSFE']->includeTCA() instead.
  *
  * Usage: 84
  *
  * @param	string		Table name for which to load the full TCA array part into the global $TCA
  * @return	void
  */
 public static function loadTCA($table)
 {
     global $TCA;
     if (isset($TCA[$table])) {
         $tca =& $TCA[$table];
         if (!$tca['columns']) {
             $dcf = $tca['ctrl']['dynamicConfigFile'];
             if ($dcf) {
                 if (!strcmp(substr($dcf, 0, 6), 'T3LIB:')) {
                     include PATH_t3lib . 'stddb/' . substr($dcf, 6);
                 } elseif (t3lib_div::isAbsPath($dcf) && @is_file($dcf)) {
                     // Absolute path...
                     include $dcf;
                 } else {
                     include PATH_typo3conf . $dcf;
                 }
             }
         }
     }
 }
 /**
  * getFilePath
  *
  * returns the correct path for a file, parses "EXT:", returns path relative to PATH_site
  *
  * @param string $filePath
  * @access public
  * @return string
  */
 public function getFilePath($filePath)
 {
     /*{{{*/
     // Parse EXT: in $filePath into real path
     $filePath = t3lib_div::getFileAbsFileName($filePath);
     // Returns relative filename
     if (t3lib_div::isAbsPath($filePath)) {
         $filePath = substr($filePath, strlen(PATH_site));
     }
     return $filePath;
 }
 /**
  * Cleans $theDir for slashes in the end of the string and returns the new path, if it exists on the server.
  *
  * @param	string		Absolute path to directory
  * @return	string		The directory path if it existed as was valid to access.
  * @access private
  * @see filelist()
  */
 function clean_directory($theDir)
 {
     if (t3lib_div::validPathStr($theDir)) {
         // proceeds if no '//', '..' or '\' is in the $theFile
         $theDir = preg_replace('/[\\/\\. ]*$/', '', $theDir);
         // Removes all dots, slashes and spaces after a path...
         if (!t3lib_div::isAbsPath($theDir) && @is_dir($theDir)) {
             return $theDir;
         }
     }
 }
 /**
  * Checks if the $fontFile is already at an absolute path and if not, prepends the correct path.
  * Use PATH_site unless we are in the backend.
  * Call it by t3lib_stdGraphic::prependAbsolutePath()
  *
  * @param	string		The font file
  * @return	string		The font file with absolute path.
  */
 function prependAbsolutePath($fontFile)
 {
     $absPath = defined('PATH_typo3') ? dirname(PATH_thisScript) . '/' : PATH_site;
     $fontFile = t3lib_div::isAbsPath($fontFile) ? $fontFile : t3lib_div::resolveBackPath($absPath . $fontFile);
     return $fontFile;
 }
 /**
  * Returns relative filename for icon.
  *
  * @param	string		Absolute filename of the icon
  * @param	string		Backpath string to prepend the icon after made relative
  * @return	void
  */
 function mIconFilename($Ifilename, $backPath)
 {
     // Change icon of fileadmin references - otherwise it doesn't differ with Web->List
     $Ifilename = str_replace('mod/file/list/list.gif', 'mod/file/file.gif', $Ifilename);
     if (t3lib_div::isAbsPath($Ifilename)) {
         $Ifilename = '../' . substr($Ifilename, strlen(PATH_site));
     }
     return $backPath . $Ifilename;
 }
 /**
  * Replace the EXT:extkey prefix with the appropriate path
  * @param string $encodedTemplateRootPath
  */
 public static function substituteExtensionPath($encodedTemplateRootPath)
 {
     if (t3lib_div::isFirstPartOfStr($encodedTemplateRootPath, 'EXT:')) {
         list($extKey, $script) = explode('/', substr($encodedTemplateRootPath, 4), 2);
         if ($extKey && t3lib_extMgm::isLoaded($extKey)) {
             return t3lib_extMgm::extPath($extKey) . $script;
         }
     } else {
         if (t3lib_div::isAbsPath($encodedTemplateRootPath)) {
             return $encodedTemplateRootPath;
         } else {
             return PATH_site . $encodedTemplateRootPath;
         }
     }
 }