当前位置: 首页>>代码示例>>PHP>>正文


PHP t3lib_div::isAllowedAbsPath方法代码示例

本文整理汇总了PHP中t3lib_div::isAllowedAbsPath方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_div::isAllowedAbsPath方法的具体用法?PHP t3lib_div::isAllowedAbsPath怎么用?PHP t3lib_div::isAllowedAbsPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在t3lib_div的用法示例。


在下文中一共展示了t3lib_div::isAllowedAbsPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: internalSanitizeLocalUrl

 /**
  * 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;
 }
开发者ID:rod86,项目名称:t3sandbox,代码行数:42,代码来源:class.tx_templavoila_div.php

示例2: getPath

 /**
  * prepare path, resolve relative path and resolve EXT: path
  *
  * @param $path absolute or relative path or EXT:foobar/
  * @return string/bool false if path is invalid, else the absolute path
  */
 protected function getPath($path)
 {
     // getFileAbsFileName can't handle directory path with trailing / correctly
     if (substr($path, -1) === '/') {
         $path = substr($path, 0, -1);
     }
     // FIXME remove this hacky part
     // skip path checks for CLI mode
     if (defined('TYPO3_cliMode')) {
         return $path;
     }
     $path = t3lib_div::getFileAbsFileName($path);
     if (t3lib_div::isAllowedAbsPath($path)) {
         return $path;
     } else {
         return false;
     }
 }
开发者ID:IchHabRecht,项目名称:caretaker_instance,代码行数:24,代码来源:class.tx_caretakerinstance_Operation_CheckPathExists.php

示例3: getCorrectUrl

 /**
  * If it is an URL, nothing to do, if it is a file, check if path is allowed and prepend current url
  *
  * @param string $url
  * @return string
  * @throws UnexpectedValueException
  */
 public static function getCorrectUrl($url)
 {
     if (empty($url)) {
         throw new UnexpectedValueException('An empty url is given');
     }
     $url = self::getFalFilename($url);
     // check URL
     $urlInfo = parse_url($url);
     // means: it is no external url
     if (!isset($urlInfo['scheme'])) {
         // resolve paths like ../
         $url = t3lib_div::resolveBackPath($url);
         // absolute path is used to check path
         $absoluteUrl = t3lib_div::getFileAbsFileName($url);
         if (!t3lib_div::isAllowedAbsPath($absoluteUrl)) {
             throw new UnexpectedValueException('The path "' . $url . '" is not allowed.');
         }
         // append current domain
         $url = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $url;
     }
     return $url;
 }
开发者ID:rafu1987,项目名称:t3bootstrap-project,代码行数:29,代码来源:FileService.php

示例4: indexRegularDocument

 /**
  * 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();
             }
//.........这里部分代码省略.........
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:101,代码来源:class.indexer.php

示例5: exportData


//.........这里部分代码省略.........
            }
            // In any case we should have a multi-level array, $idH, with the page structure here (and the HTML-code loaded into memory for nice display...)
            if (is_array($idH)) {
                $flatList = $this->export->setPageTree($idH);
                // Sets the pagetree and gets a 1-dim array in return with the pages (in correct submission order BTW...)
                foreach ($flatList as $k => $value) {
                    $this->export->export_addRecord('pages', t3lib_BEfunc::getRecord('pages', $k));
                    $this->addRecordsForPid($k, $inData['pagetree']['tables'], $inData['pagetree']['maxNumber']);
                }
            }
        }
        // After adding ALL records we set relations:
        for ($a = 0; $a < 10; $a++) {
            $addR = $this->export->export_addDBRelations($a);
            if (!count($addR)) {
                break;
            }
        }
        // Finally files are added:
        $this->export->export_addFilesFromRelations();
        // MUST be after the DBrelations are set so that files from ALL added records are included!
        // If the download button is clicked, return file
        if ($inData['download_export'] || $inData['save_export']) {
            switch ((string) $inData['filetype']) {
                case 'xml':
                    $out = $this->export->compileMemoryToFileContent('xml');
                    $fExt = '.xml';
                    break;
                case 't3d':
                    $this->export->dontCompress = 1;
                default:
                    $out = $this->export->compileMemoryToFileContent();
                    $fExt = ($this->export->doOutputCompress() ? '-z' : '') . '.t3d';
                    break;
            }
            // Filename:
            $dlFile = $inData['filename'] ? $inData['filename'] : 'T3D_' . substr(preg_replace('/[^[:alnum:]_]/', '-', $inData['download_export_name']), 0, 20) . '_' . date('d-m-H-i-s') . $fExt;
            // Export for download:
            if ($inData['download_export']) {
                $mimeType = 'application/octet-stream';
                Header('Content-Type: ' . $mimeType);
                Header('Content-Length: ' . strlen($out));
                Header('Content-Disposition: attachment; filename=' . basename($dlFile));
                echo $out;
                exit;
            }
            // Export by saving:
            if ($inData['save_export']) {
                $savePath = $this->userSaveFolder();
                $fullName = $savePath . $dlFile;
                if (t3lib_div::isAllowedAbsPath($savePath) && @is_dir(dirname($fullName)) && t3lib_div::isAllowedAbsPath($fullName)) {
                    t3lib_div::writeFile($fullName, $out);
                    $this->content .= $this->doc->section($LANG->getLL('exportdata_savedFile'), sprintf($LANG->getLL('exportdata_savedInSBytes', 1), substr($savePath . $dlFile, strlen(PATH_site)), t3lib_div::formatSize(strlen($out))), 0, 1);
                } else {
                    $this->content .= $this->doc->section($LANG->getLL('exportdata_problemsSavingFile'), sprintf($LANG->getLL('exportdata_badPathS', 1), $fullName), 0, 1, 2);
                }
            }
        }
        // OUTPUT to BROWSER:
        // Now, if we didn't make download file, show configuration form based on export:
        $menuItems = array();
        // Export configuration
        $row = array();
        $this->makeConfigurationForm($inData, $row);
        $menuItems[] = array('label' => $LANG->getLL('tableselec_configuration'), 'content' => '
				<table border="0" cellpadding="1" cellspacing="1">
					' . implode('
					', $row) . '
				</table>
			');
        // File options
        $row = array();
        $this->makeSaveForm($inData, $row);
        $menuItems[] = array('label' => $LANG->getLL('exportdata_filePreset'), 'content' => '
				<table border="0" cellpadding="1" cellspacing="1">
					' . implode('
					', $row) . '
				</table>
			');
        // File options
        $row = array();
        $this->makeAdvancedOptionsForm($inData, $row);
        $menuItems[] = array('label' => $LANG->getLL('exportdata_advancedOptions'), 'content' => '
				<table border="0" cellpadding="1" cellspacing="1">
					' . implode('
					', $row) . '
				</table>
			');
        // Generate overview:
        $overViewContent = $this->export->displayContentOverview();
        // Print errors that might be:
        $errors = $this->export->printErrorLog();
        $menuItems[] = array('label' => $LANG->getLL('exportdata_messages'), 'content' => $errors, 'stateIcon' => $errors ? 2 : 0);
        // Add hidden fields and create tabs:
        $content = $this->doc->getDynTabMenu($menuItems, 'tx_impexp_export', -1);
        $content .= '<input type="hidden" name="tx_impexp[action]" value="export" />';
        $this->content .= $this->doc->section('', $content, 0, 1);
        // Output Overview:
        $this->content .= $this->doc->section($LANG->getLL('execlistqu_structureToBeExported'), $overViewContent, 0, 1);
    }
开发者ID:zsolt-molnar,项目名称:TYPO3-4.5-trunk,代码行数:101,代码来源:index.php

示例6: backupExtension

 /**
  *
  * @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);
 }
开发者ID:rafu1987,项目名称:t3bootstrap-project,代码行数:54,代码来源:RoundTrip.php

示例7: crawler_execute_type2

 /**
  * 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);
                 }
             }
         }
     }
 }
开发者ID:zsolt-molnar,项目名称:TYPO3-4.5-trunk,代码行数:58,代码来源:class.crawler.php

示例8: init

 /**
  * Initialize; reading parameters with GPvar and checking file path
  * Results in internal var, $this->input, being set to the absolute path of the file for which to make the thumbnail.
  *
  * @return	void
  */
 function init()
 {
     global $TYPO3_CONF_VARS;
     // Setting GPvars:
     $file = t3lib_div::_GP('file');
     $size = t3lib_div::_GP('size');
     $md5sum = t3lib_div::_GP('md5sum');
     // Image extension list is set:
     $this->imageList = $TYPO3_CONF_VARS['GFX']['imagefile_ext'];
     // valid extensions. OBS: No spaces in the list, all lowercase...
     // If the filereference $this->file is relative, we correct the path
     if (substr($file, 0, 3) == '../') {
         $file = PATH_site . substr($file, 3);
     }
     // Now the path is absolute.
     // Checking for backpath and double slashes + the thumbnail can be made from files which are in the PATH_site OR the lockRootPath only!
     if (t3lib_div::isAllowedAbsPath($file)) {
         $mtime = filemtime($file);
     }
     // Do an MD5 check to prevent viewing of images without permission
     $OK = FALSE;
     if ($mtime) {
         // Always use the absolute path for this check!
         $check = basename($file) . ':' . $mtime . ':' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];
         $md5_real = t3lib_div::shortMD5($check);
         if (!strcmp($md5_real, $md5sum)) {
             $OK = TRUE;
         }
     }
     if ($OK) {
         $this->input = $file;
         $this->size = $size;
         $this->mtime = $mtime;
     } else {
         throw new RuntimeException('TYPO3 Fatal Error: Image does not exist and/or MD5 checksum did not match.', 1270853950);
     }
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:43,代码来源:thumbs.php

示例9: statistics_init

 /**
  * 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;
 }
开发者ID:zsolt-molnar,项目名称:TYPO3-4.5-trunk,代码行数:33,代码来源:class.tslib_fe.php

示例10: init

 /**
  * Initialization of the class
  * Will determine if table/uid GET vars are database record or a file and if the user has access to view information about the item.
  *
  * @return	void
  */
 function init()
 {
     global $BE_USER, $BACK_PATH, $TCA;
     // Setting input variables.
     $this->table = t3lib_div::_GET('table');
     $this->uid = t3lib_div::_GET('uid');
     // Initialize:
     $this->perms_clause = $BE_USER->getPagePermsClause(1);
     $this->access = 0;
     // Set to true if there is access to the record / file.
     $this->type = '';
     // Sets the type, "db" or "file". If blank, nothing can be shown.
     // Checking if the $table value is really a table and if the user has access to it.
     if (isset($TCA[$this->table])) {
         t3lib_div::loadTCA($this->table);
         $this->type = 'db';
         $this->uid = intval($this->uid);
         // Check permissions and uid value:
         if ($this->uid && $BE_USER->check('tables_select', $this->table)) {
             if ((string) $this->table == 'pages') {
                 $this->pageinfo = t3lib_BEfunc::readPageAccess($this->uid, $this->perms_clause);
                 $this->access = is_array($this->pageinfo) ? 1 : 0;
                 $this->row = $this->pageinfo;
             } else {
                 $this->row = t3lib_BEfunc::getRecordWSOL($this->table, $this->uid);
                 if ($this->row) {
                     $this->pageinfo = t3lib_BEfunc::readPageAccess($this->row['pid'], $this->perms_clause);
                     $this->access = is_array($this->pageinfo) ? 1 : 0;
                 }
             }
             $treatData = t3lib_div::makeInstance('t3lib_transferData');
             $treatData->renderRecord($this->table, $this->uid, 0, $this->row);
             $cRow = $treatData->theRecord;
         }
     } else {
         // if the filereference $this->file is relative, we correct the path
         if (substr($this->table, 0, 3) == '../') {
             $this->file = PATH_site . preg_replace('/^\\.\\.\\//', '', $this->table);
         } else {
             $this->file = $this->table;
         }
         if (@is_file($this->file) && t3lib_div::isAllowedAbsPath($this->file)) {
             $this->type = 'file';
             $this->access = 1;
         }
     }
     // Initialize document template object:
     $this->doc = t3lib_div::makeInstance('template');
     $this->doc->backPath = $BACK_PATH;
     // Starting the page by creating page header stuff:
     $this->content .= $this->doc->startPage($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.viewItem'));
     $this->content .= '<h3 class="t3-row-header">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.viewItem') . '</h3>';
     $this->content .= $this->doc->spacer(5);
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:60,代码来源:show_item.php

示例11: exportClipElementParameters

 /**
  * Creates GET parameters for linking to the export module.
  *
  * @return	string		GET parameters for current clipboard content to be exported.
  */
 function exportClipElementParameters()
 {
     // Init:
     $pad = $this->current;
     $params = array();
     $params[] = 'tx_impexp[action]=export';
     // Traverse items:
     if (is_array($this->clipData[$pad]['el'])) {
         foreach ($this->clipData[$pad]['el'] as $k => $v) {
             if ($v) {
                 list($table, $uid) = explode('|', $k);
                 if ($table == '_FILE') {
                     // Rendering files/directories on the clipboard:
                     if (file_exists($v) && t3lib_div::isAllowedAbsPath($v)) {
                         $params[] = 'tx_impexp[' . (is_dir($v) ? 'dir' : 'file') . '][]=' . rawurlencode($v);
                     }
                 } else {
                     // Rendering records:
                     $rec = t3lib_BEfunc::getRecord($table, $uid);
                     if (is_array($rec)) {
                         $params[] = 'tx_impexp[record][]=' . rawurlencode($table . ':' . $uid);
                     }
                 }
             }
         }
     }
     return '?' . implode('&', $params);
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:33,代码来源:class.t3lib_clipboard.php

示例12: getHtmlTemplate

 /**
  * 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;
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:31,代码来源:template.php

示例13: createNewFile

 /**
  * Creates a new file
  *
  * Returns an array with
  * 0: boolean success
  * 1: string absolute path of written file/folder
  * 2: error code
  *
  * The error code returns
  * 0: no error
  * -1: not writable
  * -2: not allowed path
  * -3: already exists
  * -4: not able to create
  *
  * @static
  * @param  $folder
  * @param  $file
  * @param  $isFolder
  * @return array
  */
 public static function createNewFile($folder, $file, $isFolder)
 {
     $success = FALSE;
     $error = 0;
     if (substr($folder, -1) !== '/') {
         $folder .= '/';
     }
     $newFile = t3lib_div::resolveBackPath(PATH_site . $folder . $file);
     if (!is_writable(dirname($newFile))) {
         $error = -1;
     } elseif (!t3lib_div::isAllowedAbsPath($newFile)) {
         $error = -2;
     } elseif (file_exists($newFile)) {
         $error = -3;
     } else {
         if ($isFolder) {
             $success = t3lib_div::mkdir($newFile);
         } else {
             $success = t3lib_div::writeFile($newFile, '');
         }
         if (!$success) {
             $error = -4;
         }
     }
     return array($success, $newFile, $error);
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:47,代码来源:class.tx_em_tools.php

示例14: printFileClickMenu

 /**
  * Make 1st level clickmenu:
  *
  * @param	string		The absolute path
  * @return	string		HTML content
  */
 function printFileClickMenu($path)
 {
     $menuItems = array();
     if (file_exists($path) && t3lib_div::isAllowedAbsPath($path)) {
         $fI = pathinfo($path);
         $size = ' (' . t3lib_div::formatSize(filesize($path)) . 'bytes)';
         $icon = t3lib_iconWorks::getSpriteIconForFile(is_dir($path) ? 'folder' : strtolower($fI['extension']), array('class' => 'absmiddle', 'title' => htmlspecialchars($fI['basename'] . $size)));
         // edit
         if (!in_array('edit', $this->disabledItems) && is_file($path) && t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], $fI['extension'])) {
             $menuItems['edit'] = $this->FILE_launch($path, 'file_edit.php', 'edit', 'edit_file.gif');
         }
         // rename
         if (!in_array('rename', $this->disabledItems)) {
             $menuItems['rename'] = $this->FILE_launch($path, 'file_rename.php', 'rename', 'rename.gif');
         }
         // upload
         if (!in_array('upload', $this->disabledItems) && is_dir($path)) {
             $menuItems['upload'] = $this->FILE_upload($path);
         }
         // new
         if (!in_array('new', $this->disabledItems) && is_dir($path)) {
             $menuItems['new'] = $this->FILE_launch($path, 'file_newfolder.php', 'new', 'new_file.gif');
         }
         // info
         if (!in_array('info', $this->disabledItems)) {
             $menuItems['info'] = $this->DB_info($path, '');
         }
         $menuItems[] = 'spacer';
         // copy:
         if (!in_array('copy', $this->disabledItems)) {
             $menuItems['copy'] = $this->FILE_copycut($path, 'copy');
         }
         // cut:
         if (!in_array('cut', $this->disabledItems)) {
             $menuItems['cut'] = $this->FILE_copycut($path, 'cut');
         }
         // Paste:
         $elFromAllTables = count($this->clipObj->elFromTable('_FILE'));
         if (!in_array('paste', $this->disabledItems) && $elFromAllTables && is_dir($path)) {
             $elArr = $this->clipObj->elFromTable('_FILE');
             reset($elArr);
             $selItem = current($elArr);
             $elInfo = array(basename($selItem), basename($path), $this->clipObj->currentMode());
             $menuItems['pasteinto'] = $this->FILE_paste($path, $selItem, $elInfo);
         }
         $menuItems[] = 'spacer';
         // delete:
         if (!in_array('delete', $this->disabledItems)) {
             $menuItems['delete'] = $this->FILE_delete($path);
         }
     }
     // Adding external elements to the menuItems array
     $menuItems = $this->processingByExtClassArray($menuItems, $path, 0);
     // Processing by external functions?
     $menuItems = $this->externalProcessingOfFileMenuItems($menuItems);
     // Return the printed elements:
     return $this->printItems($menuItems, $icon . basename($path));
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:64,代码来源:alt_clickmenu.php

示例15: showExtDetails


//.........这里部分代码省略.........
                                $messageLabel = 'ext_details_ext_' . $action . '_with_key';
                                $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', sprintf($GLOBALS['LANG']->getLL($messageLabel), $extKey), '', t3lib_FlashMessage::OK, TRUE);
                                t3lib_FlashMessageQueue::addMessage($flashMessage);
                            }
                            if ($this->CMD['clrCmd'] || t3lib_div::_GP('_clrCmd')) {
                                if ($this->CMD['load'] && @is_file($absPath . 'ext_conf_template.txt')) {
                                    $vA = array('CMD' => array('showExt' => $extKey));
                                } else {
                                    $vA = array('CMD' => '');
                                }
                            } else {
                                $vA = array('CMD' => array('showExt' => $extKey));
                            }
                            if ($this->CMD['standAlone'] || t3lib_div::_GP('standAlone')) {
                                $this->content .= sprintf($GLOBALS['LANG']->getLL('ext_details_ext_installed_removed'), $this->CMD['load'] ? $GLOBALS['LANG']->getLL('ext_details_installed') : $GLOBALS['LANG']->getLL('ext_details_removed')) . '<br /><br />' . $this->getSubmitAndOpenerCloseLink();
                            } else {
                                // Determine if new modules were installed:
                                $techInfo = $this->install->makeDetailedExtensionAnalysis($extKey, $list[$extKey]);
                                if (($this->CMD['load'] || $this->CMD['remove']) && is_array($techInfo['flags']) && in_array('Module', $techInfo['flags'], true)) {
                                    $vA['CMD']['refreshMenu'] = 1;
                                }
                                t3lib_utility_Http::redirect(t3lib_div::linkThisScript($vA));
                                exit;
                            }
                        }
                    }
                } else {
                    $writeAccessError = $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('ext_details_write_access_error'), 'toUpper');
                    $this->content .= $this->doc->section(sprintf($GLOBALS['LANG']->getLL('ext_details_installing') . ' ', $this->extensionTitleIconHeader($extKey, $list[$extKey])) . ' ' . $writeAccessError, $GLOBALS['LANG']->getLL('ext_details_write_error_localconf'), 1, 1, 2, 1);
                }
            } elseif ($this->CMD['downloadFile'] && !in_array($extKey, $this->requiredExt)) {
                // Link for downloading extension has been clicked - deliver content stream:
                $dlFile = $this->CMD['downloadFile'];
                if (t3lib_div::isAllowedAbsPath($dlFile) && t3lib_div::isFirstPartOfStr($dlFile, PATH_site) && t3lib_div::isFirstPartOfStr($dlFile, $absPath) && @is_file($dlFile)) {
                    $mimeType = 'application/octet-stream';
                    Header('Content-Type: ' . $mimeType);
                    Header('Content-Disposition: attachment; filename=' . basename($dlFile));
                    echo t3lib_div::getUrl($dlFile);
                    exit;
                } else {
                    throw new RuntimeException('TYPO3 Fatal Error: ' . $GLOBALS['LANG']->getLL('ext_details_error_downloading'), 1270853980);
                }
            } elseif ($this->CMD['editFile'] && !in_array($extKey, $this->requiredExt)) {
                // Editing extension file:
                $editFile = rawurldecode($this->CMD['editFile']);
                if (t3lib_div::isAllowedAbsPath($editFile) && t3lib_div::isFirstPartOfStr($editFile, $absPath)) {
                    $fI = t3lib_div::split_fileref($editFile);
                    if (@is_file($editFile) && t3lib_div::inList($this->editTextExtensions, $fI['fileext'] ? $fI['fileext'] : $fI['filebody'])) {
                        if (filesize($editFile) < $this->kbMax * 1024) {
                            $outCode = '<form action="' . $this->script . ' method="post" name="editfileform">';
                            $info = '';
                            $submittedContent = t3lib_div::_POST('edit');
                            $saveFlag = 0;
                            if (isset($submittedContent['file']) && !$GLOBALS['TYPO3_CONF_VARS']['EXT']['noEdit']) {
                                // Check referer here?
                                $oldFileContent = t3lib_div::getUrl($editFile);
                                if ($oldFileContent != $submittedContent['file']) {
                                    $oldMD5 = md5(str_replace(CR, '', $oldFileContent));
                                    $info .= sprintf($GLOBALS['LANG']->getLL('ext_details_md5_previous'), '<strong>' . $oldMD5 . '</strong>') . '<br />';
                                    t3lib_div::writeFile($editFile, $submittedContent['file']);
                                    $saveFlag = 1;
                                } else {
                                    $info .= $GLOBALS['LANG']->getLL('ext_details_no_changes') . '<br />';
                                }
                            }
                            $fileContent = t3lib_div::getUrl($editFile);
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:67,代码来源:index.php


注:本文中的t3lib_div::isAllowedAbsPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。