コード例 #1
1
 /**
  * For RTE: This displays all files from folder. No thumbnails shown
  *
  * @param	string		The folder path to expand
  * @param	string		List of fileextensions to show
  * @return	string		HTML output
  */
 function expandFolder($expandFolder = 0, $extensionList = '')
 {
     global $BACK_PATH;
     $expandFolder = $expandFolder ? $expandFolder : $this->expandFolder;
     $out = '<table cellspacing="0" cellpadding="0" border="0" style="margin: 0pt; width: 100%;">';
     if ($expandFolder && $this->checkFolder($expandFolder)) {
         // Prepare current path value for comparison (showing red arrow)
         if (!$this->curUrlInfo['value']) {
             $cmpPath = '';
         } else {
             $cmpPath = PATH_site . $this->curUrlInfo['info'];
         }
         // Create header element; The folder from which files are listed.
         $titleLen = 35;
         $picon = '<td style="width: 20px;"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/i/_icon_webfolders.gif', 'width="18" height="16"') . ' alt="" /></td>';
         $piconLink = htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($expandFolder), $titleLen));
         $picon .= '<td colspan="2"><a href="#" onclick="return link_insert(\'' . t3lib_div::rawUrlEncodeFP(substr($expandFolder, strlen(PATH_site))) . '\');">' . $piconLink . '</a></td>';
         if ($this->curUrlInfo['act'] == 'folder' && $cmpPath == $expandFolder) {
             $out .= '<tr style="background: #b7bac0;">';
             //$out.= '<img'.t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/blinkarrow_left.gif', 'width="5" height="9"') . ' class="c-blinkArrowL" alt="" />';
         } else {
             $out .= '<tr>';
         }
         $out .= $picon . '</tr>';
         // Get files from the folder:
         if ($this->mode == 'wizard' && $this->act == 'folder') {
             $files = t3lib_div::get_dirs($expandFolder);
         } else {
             $files = t3lib_div::getFilesInDir($expandFolder, $extensionList, 1, 1);
             // $extensionList='', $prependPath=0, $order='')
         }
         $c = 0;
         $cc = count($files);
         if (is_array($files)) {
             foreach ($files as $filepath) {
                 $c++;
                 $fI = pathinfo($filepath);
                 if ($this->mode == 'wizard' && $this->act == 'folder') {
                     $filepath = $expandFolder . $filepath . '/';
                     $icon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/i/_icon_webfolders.gif', 'width="18" height="16"') . ' alt="" />';
                 } else {
                     // File icon:
                     $icon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
                     // Get size and icon:
                     $size = ' (' . t3lib_div::formatSize(filesize($filepath)) . 'bytes)';
                     $icon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/fileicons/' . $icon . '', 'width="18" height="16"') . ' title="' . htmlspecialchars($fI['basename'] . $size) . '" alt="" />';
                 }
                 // If the listed file turns out to be the CURRENT file, then show blinking arrow:
                 if (($this->curUrlInfo['act'] == 'file' || $this->curUrlInfo['act'] == 'folder') && $cmpPath == $filepath) {
                     $current = 'style="background: #b7bac0;"';
                     //$arrCol='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_left.gif','width="5" height="9"').' class="c-blinkArrowL" alt="" />';
                 } else {
                     $current = '';
                     //$arrCol='';
                 }
                 // Put it all together for the file element:
                 $out .= '<tr ' . $current . '>' . '<td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/ol/join' . ($c == $cc ? 'bottom' : '') . '.gif', 'width="18" height="16"') . ' alt="" /></td>' . '<td style="width: 18px;">' . $icon . '</td>' . '<td><a href="#" onclick="return link_insert(\'' . t3lib_div::rawUrlEncodeFP(substr($filepath, strlen(PATH_site))) . '\');">' . htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath), $titleLen)) . '</a></td></tr>';
             }
         }
     }
     $out .= '</table>';
     return $out;
 }
 /**
  * Get defined Skin for drupdown
  * @return array
  */
 function getSkins($config, $item)
 {
     $confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['imagecarousel']);
     if (!is_dir(t3lib_div::getFileAbsFileName($confArr['skinFolder']))) {
         // if the defined folder does not exist, define the default folder
         $confArr['skinFolder'] = "EXT:imagecarousel/res/skins/";
     }
     $items = t3lib_div::get_dirs(t3lib_div::getFileAbsFileName($confArr['skinFolder']));
     if (count($items) > 0) {
         $optionList = array();
         foreach ($items as $key => $item) {
             $item = trim($item);
             if (!preg_match('/^\\./', $item)) {
                 $optionList[] = array($item, $item);
             }
         }
         $config['items'] = array_merge($config['items'], $optionList);
     }
     return $config;
 }
コード例 #3
0
 /**
  * Gathers all extensions in $path
  *
  * @param	string		Absolute path to local, global or system extensions
  * @param	array		Array with information for each extension key found. Notice: passed by reference
  * @param	array		Categories index: Contains extension titles grouped by various criteria.
  * @param	string		Path-type: L, G or S
  * @return	void		"Returns" content by reference
  * @access private
  * @see getInstalledExtensions()
  */
 function getFlatInstExtList($path, &$list, $type)
 {
     if (@is_dir($path)) {
         $extList = t3lib_div::get_dirs($path);
         if (is_array($extList)) {
             foreach ($extList as $extKey) {
                 $this->singleExtInfo($extKey, $path, $list, $type);
             }
         }
     }
 }
コード例 #4
0
	/**
	 * Generates checkboxes with the extension keys locally available for this install.
	 *
	 * @return	string		list of checkboxes for selecting the local extension to work on (or error message)
	 */
	function makeCheckboxesForLocalExtensions($localExtensionDir)
	{
		$path = PATH_site.$localExtensionDir;
		if (@is_dir($path))	{
			$dirs = $this->extensionList = t3lib_div::get_dirs($path);
			if (is_array($dirs)) {
				sort($dirs);
				$c = 0;
				$opt = array();
				foreach ($dirs as $dirName) {
					// only display loaded extensions
					if (t3lib_extMgm::isLoaded($dirName)) {
						foreach (array('/t3jquery.txt', '/Configuration/t3jquery.txt') as $file_location) {
							if (@file_exists($path.$dirName.$file_location)) {
								// Get extension info from ext_emconf.php
								$extInfo = $this->includeEMCONF($path.$dirName.'/ext_emconf.php', $dirName);
								if (is_array($_POST['ext'])) {
									$selVal = in_array($path.$dirName.$file_location, $_POST['ext']) ? ' checked="checked"' : '';
								}
								$c++;
								$opt[] = '
	<tr class="bgColor4" valign="top">
		<td><input name="ext[]" type="checkbox" id="ext'.$c.'" class="extkey" value="'.htmlspecialchars($path.$dirName.$file_location).'"'.$selVal.' /></td>
		<td title="'.htmlspecialchars($extInfo['description']).'" nowrap><label for="ext'.$c.'">'.htmlspecialchars($extInfo['title']).'</label></td>
		<td nowrap>'.htmlspecialchars($dirName).'</td>
		<td nowrap>'.htmlspecialchars($extInfo['version']).'</td>
	</tr>';
							}
						}
					}
				}
				return implode(' ',$opt);
			}
		} else {
			return '
	<tr><td>ERROR: Extensions path: "'.$path.'" not found!</td></tr>';
		}
	}
コード例 #5
0
 /**
  * Recursively gather all files and folders of extension path.
  *
  * @param	array		Array of files to which new files are added
  * @param	string		Path to look up files in
  * @param	string		List of file extensions to include. Blank = all
  * @param	boolean		If set, directories are included as well.
  * @return	array		$fileArr with new entries added.
  */
 function getAllFilesAndFoldersInPath($fileArr, $extPath, $extList = '', $regDirs = 0)
 {
     if ($regDirs) {
         $fileArr[] = $extPath;
     }
     $fileArr = array_merge($fileArr, t3lib_div::getFilesInDir($extPath, $extList, 1, 1));
     $dirs = t3lib_div::get_dirs($extPath);
     if (is_array($dirs)) {
         foreach ($dirs as $subdirs) {
             if ($subdirs && (strcmp($subdirs, 'CVS') || !$this->noCVS)) {
                 $fileArr = $this->getAllFilesAndFoldersInPath($fileArr, $extPath . $subdirs . '/', $extList, $regDirs);
             }
         }
     }
     return $fileArr;
 }
 /**
  * Get the list of extensions in the given scope
  *
  * @param string $scope
  * @return boolean
  */
 protected function getExtensionListForScope($scope)
 {
     $path = $this->getPathForScope($scope);
     $extensionInfo = array();
     if (@is_dir($path)) {
         $extensionFolders = t3lib_div::get_dirs($path);
         if (is_array($extensionFolders)) {
             foreach ($extensionFolders as $extKey) {
                 $extensionInfo[$extKey]['ext_key'] = $extKey;
                 $extensionInfo[$extKey]['installed'] = (bool) t3lib_extMgm::isLoaded($extKey);
                 if (@is_file($path . $extKey . '/ext_emconf.php')) {
                     $_EXTKEY = $extKey;
                     @(include $path . $extKey . '/ext_emconf.php');
                     $extensionVersion = $EM_CONF[$extKey]['version'];
                 } else {
                     $extensionVersion = FALSE;
                 }
                 if ($extensionVersion) {
                     $extensionInfo[$extKey]['version'] = $extensionVersion;
                     $extensionInfo[$extKey]['scope'][$scope] = $extensionVersion;
                 }
             }
         }
     }
     return $extensionInfo;
 }
コード例 #7
0
 /**
  * Fetches the data for the tree
  *
  * @param	string		Abs file path
  * @param	integer		Max depth (recursivity limit)
  * @return	integer		The count of items on the level
  * @see getBrowsableTree()
  */
 function getFolderTree($files_path, $depth = 999, $type = '')
 {
     // This generates the directory tree
     $dirs = t3lib_div::get_dirs($files_path);
     if (!is_array($dirs)) {
         return 0;
     }
     sort($dirs);
     $c = count($dirs);
     $depth = intval($depth);
     $HTML = '';
     $a = 0;
     foreach ($dirs as $key => $val) {
         $a++;
         $this->tree[] = array();
         // Reserve space.
         end($this->tree);
         $treeKey = key($this->tree);
         // Get the key for this space
         $val = preg_replace('/^\\.\\//', '', $val);
         $title = $val;
         $path = $files_path . $val . '/';
         $specUID = t3lib_div::md5int($path);
         $this->specUIDmap[$specUID] = $path;
         $row = array();
         $row['path'] = $path;
         $row['uid'] = $specUID;
         $row['title'] = $title;
         // Make a recursive call to the next level
         if ($depth > 1 && $this->expandNext($specUID)) {
             $nextCount = $this->getFolderTree($path, $depth - 1, $this->makeHTML ? '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/ol/' . ($a == $c ? 'blank' : 'line') . '.gif', 'width="18" height="16"') . ' alt="" />' : '', $type);
             $exp = 1;
             // Set "did expand" flag
         } else {
             $nextCount = $this->getCount($path);
             $exp = 0;
             // Clear "did expand" flag
         }
         // Set HTML-icons, if any:
         if ($this->makeHTML) {
             $HTML = $this->PMicon($row, $a, $c, $nextCount, $exp);
             $webpath = t3lib_BEfunc::getPathType_web_nonweb($path);
             if (is_writable($path)) {
                 $type = '';
                 $overlays = array();
             } else {
                 $type = 'readonly';
                 $overlays = array('status-overlay-locked' => array());
             }
             if ($webpath == 'web') {
                 $icon = 'apps-filetree-folder-default';
             } else {
                 $icon = 'apps-filetree-folder-default';
             }
             if ($val == '_temp_') {
                 $icon = 'apps-filetree-folder-temp';
                 $row['title'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:temp', true);
                 $row['_title'] = '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:temp', true) . '</strong>';
             }
             if ($val == '_recycler_') {
                 $icon = 'apps-filetree-folder-recycler';
                 $row['title'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:recycler', true);
                 $row['_title'] = '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:recycler', true) . '</strong>';
             }
             $HTML .= $this->wrapIcon(t3lib_iconWorks::getSpriteIcon($icon, array('title' => $row['title']), $overlays), $row);
         }
         // Finally, add the row/HTML content to the ->tree array in the reserved key.
         $this->tree[$treeKey] = array('row' => $row, 'HTML' => $HTML, 'hasSub' => $nextCount && $this->expandNext($specUID), 'isFirst' => $a == 1, 'isLast' => false, 'invertedDepth' => $depth, 'bank' => $this->bank);
     }
     if ($a) {
         $this->tree[$treeKey]['isLast'] = true;
     }
     return $c;
 }
コード例 #8
0
 /**
  * Fetches the data for the tree
  *
  * @param	string		Abs file path
  * @param	integer		Max depth (recursivity limit)
  * @param	string		HTML-code prefix for recursive calls.
  * @return	integer		The count of items on the level
  * @see getBrowsableTree()
  */
 function getFolderTree($files_path, $depth = 999, $depthData = '')
 {
     // This generates the directory tree
     $dirs = t3lib_div::get_dirs($files_path);
     $c = 0;
     if (is_array($dirs)) {
         $depth = intval($depth);
         $HTML = '';
         $a = 0;
         $c = count($dirs);
         natcasesort($dirs);
         foreach ($dirs as $key => $val) {
             $a++;
             $this->tree[] = array();
             // Reserve space.
             end($this->tree);
             $treeKey = key($this->tree);
             // Get the key for this space
             $LN = $a == $c ? 'blank' : 'line';
             $val = preg_replace('/^\\.\\//', '', $val);
             $title = $val;
             $path = $files_path . $val . '/';
             $md5_uid = md5($path);
             $specUID = hexdec(substr($md5_uid, 0, 6));
             $this->specUIDmap[$specUID] = $path;
             $row = array();
             $row['path'] = $path;
             $row['uid'] = $specUID;
             $row['title'] = $title;
             if ($depth > 1 && $this->expandNext($specUID)) {
                 $nextCount = $this->getFolderTree($path, $depth - 1, $this->makeHTML ? $depthData . '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/ol/' . $LN . '.gif', 'width="18" height="16"') . ' alt="" />' : '');
                 $exp = 1;
                 // Set "did expand" flag
             } else {
                 $nextCount = $this->getCount($path);
                 $exp = 0;
                 // Clear "did expand" flag
             }
             // Set HTML-icons, if any:
             if ($this->makeHTML) {
                 $HTML = $depthData . $this->PMicon($row, $a, $c, $nextCount, $exp);
                 $pathInfo = tx_dam::path_compileInfo($path);
                 $HTML .= $this->wrapIcon(tx_dam::icon_getFileTypeImgTag($pathInfo), $row);
             }
             // Finally, add the row/HTML content to the ->tree array in the reserved key.
             $this->tree[$treeKey] = array('row' => $row, 'HTML' => $HTML, 'bank' => $this->bank);
         }
     }
     return $c;
 }
コード例 #9
0
 /**
  * Recursively gather all files and folders of a path.
  * Usage: 5
  *
  * @param	array		$fileArr: Empty input array (will have files added to it)
  * @param	string		$path: The path to read recursively from (absolute) (include trailing slash!)
  * @param	string		$extList: Comma list of file extensions: Only files with extensions in this list (if applicable) will be selected.
  * @param	boolean		$regDirs: If set, directories are also included in output.
  * @param	integer		$recursivityLevels: The number of levels to dig down...
  * @return	array		An array with the found files/directories.
  */
 function getAllFilesAndFoldersInPath($fileArr, $path, $extList = '', $regDirs = 0, $recursivityLevels = 99)
 {
     if ($regDirs) {
         $fileArr[] = $path;
     }
     $fileArr = array_merge($fileArr, t3lib_div::getFilesInDir($path, $extList, 1, 1));
     $dirs = t3lib_div::get_dirs($path);
     if (is_array($dirs) && $recursivityLevels > 0) {
         foreach ($dirs as $subdirs) {
             if ((string) $subdirs != '') {
                 $fileArr = t3lib_div::getAllFilesAndFoldersInPath($fileArr, $path . $subdirs . '/', $extList, $regDirs, $recursivityLevels - 1);
             }
         }
     }
     return $fileArr;
 }
コード例 #10
0
 function sorting4folders($curpath, $sort = 'ASC', $limit = 0)
 {
     // config
     $folderArray = t3lib_div::get_dirs($curpath);
     // get all directories in current path
     $sortFileName = '_sorting.txt';
     // default filename for sorting file
     // Let's go
     if (is_array($folderArray)) {
         // 1. Automatic sorting
         switch ($sort) {
             // sortmode
             case 'random':
                 // shuffle array
                 shuffle($folderArray);
                 break;
             case 'DESC':
                 // alphabetical descendening
                 arsort($folderArray);
                 break;
             default:
                 // default
             // default
             case 'ASC':
                 // or ASC
                 asort($folderArray);
                 break;
         }
         // 2. Manual sorting (if _sorting.txt exists)
         if (file_exists($curpath . $sortFileName)) {
             // if txt file to main folder exists
             $content = t3lib_div::getURL($curpath . $sortFileName);
             // read txtfile
             $content = str_replace(array(',', ';', '|'), "\n", $content);
             // rewrite , ; | to linebreaks
             $contentarray = t3lib_div::trimExplode("\n", $content, 1);
             // split every line
             $manArray = array();
             // init new tmp array
             for ($i = 0; $i < count($contentarray); $i++) {
                 // one loop for every line in _sorting.txt
                 if (in_array($contentarray[$i], $folderArray)) {
                     // if current foldername really exists in folder array
                     $manArray[] = $contentarray[$i];
                 }
             }
             if (count($manArray) > 0) {
                 // if there are folders in the manArray
                 $folderArray = array_merge($manArray, $folderArray);
                 // add folderArray to manualArray
                 $folderArray = array_unique($folderArray);
                 // clean douplicated entries in the array
             }
         }
         // 3. Cut array im limit is set
         if ($limit) {
             $tmp_array = array_chunk($folderArray, $limit);
             // split array in same parts
             $folderArray = $tmp_array[0];
             // take first part of array
         }
     }
     return $folderArray;
     // always return folderArray
 }
コード例 #11
0
 /**
  * Perform a detailed, technical analysis of the available extension on server!
  * Includes all kinds of verifications
  * Takes some time to process, therfore use with care, in particular in listings.
  *
  * @param	string		Extension key
  * @param	array		Extension information
  * @param	boolean		If set, checks for validity of classes etc.
  * @return	array		Information in an array.
  */
 function makeDetailedExtensionAnalysis($extKey, $extInfo, $validity = 0)
 {
     // Get absolute path of the extension
     $absPath = $this->getExtPath($extKey, $extInfo['type']);
     $infoArray = array();
     $table_class_prefix = substr($extKey, 0, 5) == 'user_' ? 'user_' : 'tx_' . str_replace('_', '', $extKey) . '_';
     $module_prefix = substr($extKey, 0, 5) == 'user_' ? 'u' : 'tx' . str_replace('_', '', $extKey);
     // Database status:
     $dbInfo = $this->checkDBupdates($extKey, $extInfo, 1);
     // Database structure required:
     if (is_array($dbInfo['structure']['tables_fields'])) {
         $modify_tables = t3lib_div::trimExplode(',', $extInfo['EM_CONF']['modify_tables'], 1);
         $infoArray['dump_tf'] = array();
         foreach ($dbInfo['structure']['tables_fields'] as $tN => $d) {
             if (in_array($tN, $modify_tables)) {
                 $infoArray['fields'][] = $tN . ': <i>' . (is_array($d['fields']) ? implode(', ', array_keys($d['fields'])) : '') . (is_array($d['keys']) ? ' + ' . count($d['keys']) . ' ' . $GLOBALS['LANG']->getLL('detailedExtAnalysis_keys') : '') . '</i>';
                 if (is_array($d['fields'])) {
                     foreach ($d['fields'] as $fN => $value) {
                         $infoArray['dump_tf'][] = $tN . '.' . $fN;
                         if (!t3lib_div::isFirstPartOfStr($fN, $table_class_prefix)) {
                             $infoArray['NSerrors']['fields'][$fN] = $fN;
                         } else {
                             $infoArray['NSok']['fields'][$fN] = $fN;
                         }
                     }
                 }
                 if (is_array($d['keys'])) {
                     foreach ($d['keys'] as $fN => $value) {
                         $infoArray['dump_tf'][] = $tN . '.KEY:' . $fN;
                     }
                 }
             } else {
                 $infoArray['dump_tf'][] = $tN;
                 $infoArray['tables'][] = $tN;
                 if (!t3lib_div::isFirstPartOfStr($tN, $table_class_prefix)) {
                     $infoArray['NSerrors']['tables'][$tN] = $tN;
                 } else {
                     $infoArray['NSok']['tables'][$tN] = $tN;
                 }
             }
         }
         if (count($dbInfo['structure']['diff']['diff']) || count($dbInfo['structure']['diff']['extra'])) {
             $msg = array();
             if (count($dbInfo['structure']['diff']['diff'])) {
                 $msg[] = $GLOBALS['LANG']->getLL('detailedExtAnalysis_tables_are_missing');
             }
             if (count($dbInfo['structure']['diff']['extra'])) {
                 $msg[] = $GLOBALS['LANG']->getLL('detailedExtAnalysis_tables_are_of_wrong_type');
             }
             $infoArray['tables_error'] = 1;
             if (t3lib_extMgm::isLoaded($extKey)) {
                 $infoArray['errors'][] = sprintf($GLOBALS['LANG']->getLL('detailedExtAnalysis_tables_are'), implode(' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:and') . ' ', $msg));
             }
         }
     }
     // Static tables?
     if (is_array($dbInfo['static'])) {
         $infoArray['static'] = array_keys($dbInfo['static']);
         foreach ($dbInfo['static'] as $tN => $d) {
             if (!$d['exists']) {
                 $infoArray['static_error'] = 1;
                 if (t3lib_extMgm::isLoaded($extKey)) {
                     $infoArray['errors'][] = $GLOBALS['LANG']->getLL('detailedExtAnalysis_static_tables_missing');
                 }
                 if (!t3lib_div::isFirstPartOfStr($tN, $table_class_prefix)) {
                     $infoArray['NSerrors']['tables'][$tN] = $tN;
                 } else {
                     $infoArray['NSok']['tables'][$tN] = $tN;
                 }
             }
         }
     }
     // Backend Module-check:
     $knownModuleList = t3lib_div::trimExplode(',', $extInfo['EM_CONF']['module'], 1);
     foreach ($knownModuleList as $mod) {
         if (@is_dir($absPath . $mod)) {
             if (@is_file($absPath . $mod . '/conf.php')) {
                 $confFileInfo = $this->modConfFileAnalysis($absPath . $mod . '/conf.php');
                 if (is_array($confFileInfo['TYPO3_MOD_PATH'])) {
                     $shouldBePath = $this->typeRelPaths[$extInfo['type']] . $extKey . '/' . $mod . '/';
                     if (strcmp($confFileInfo['TYPO3_MOD_PATH'][1][1], $shouldBePath)) {
                         $infoArray['errors'][] = sprintf($GLOBALS['LANG']->getLL('detailedExtAnalysis_wrong_mod_path'), $confFileInfo['TYPO3_MOD_PATH'][1][1], $shouldBePath);
                     }
                 } else {
                     // It seems like TYPO3_MOD_PATH and therefore also this warning is no longer needed.
                     // $infoArray['errors'][] = 'No definition of TYPO3_MOD_PATH constant found inside!';
                 }
                 if (is_array($confFileInfo['MCONF_name'])) {
                     $mName = $confFileInfo['MCONF_name'][1][1];
                     $mNameParts = explode('_', $mName);
                     $infoArray['moduleNames'][] = $mName;
                     if (!t3lib_div::isFirstPartOfStr($mNameParts[0], $module_prefix) && (!$mNameParts[1] || !t3lib_div::isFirstPartOfStr($mNameParts[1], $module_prefix))) {
                         $infoArray['NSerrors']['modname'][] = $mName;
                     } else {
                         $infoArray['NSok']['modname'][] = $mName;
                     }
                 } else {
                     $infoArray['errors'][] = $GLOBALS['LANG']->getLL('detailedExtAnalysis_mconf_missing');
                 }
             } else {
                 $infoArray['errors'][] = sprintf($GLOBALS['LANG']->getLL('detailedExtAnalysis_be_module_conf_missing'), $mod . '/conf.php');
             }
         } else {
             $infoArray['errors'][] = sprintf($GLOBALS['LANG']->getLL('detailedExtAnalysis_module_folder_missing'), $mod . '/');
         }
     }
     $dirs = t3lib_div::get_dirs($absPath);
     if (is_array($dirs)) {
         reset($dirs);
         while (list(, $mod) = each($dirs)) {
             if (!in_array($mod, $knownModuleList) && @is_file($absPath . $mod . '/conf.php')) {
                 $confFileInfo = $this->modConfFileAnalysis($absPath . $mod . '/conf.php');
                 if (is_array($confFileInfo)) {
                     $infoArray['errors'][] = sprintf($GLOBALS['LANG']->getLL('detailedExtAnalysis_unconfigured_module'), $mod . '/conf.php');
                 }
             }
         }
     }
     // ext_tables.php:
     if (@is_file($absPath . 'ext_tables.php')) {
         $content = t3lib_div::getUrl($absPath . 'ext_tables.php');
         if (stristr($content, 't3lib_extMgm::addModule')) {
             $infoArray['flags'][] = $GLOBALS['LANG']->getLL('detailedExtAnalysis_module');
         }
         if (stristr($content, 't3lib_extMgm::insertModuleFunction')) {
             $infoArray['flags'][] = $GLOBALS['LANG']->getLL('detailedExtAnalysis_module_and_more');
         }
         if (stristr($content, 't3lib_div::loadTCA')) {
             $infoArray['flags'][] = $GLOBALS['LANG']->getLL('detailedExtAnalysis_loadTCA');
         }
         if (stristr($content, '$TCA[')) {
             $infoArray['flags'][] = $GLOBALS['LANG']->getLL('detailedExtAnalysis_TCA');
         }
         if (stristr($content, 't3lib_extMgm::addPlugin')) {
             $infoArray['flags'][] = $GLOBALS['LANG']->getLL('detailedExtAnalysis_plugin');
         }
     }
     // ext_localconf.php:
     if (@is_file($absPath . 'ext_localconf.php')) {
         $content = t3lib_div::getUrl($absPath . 'ext_localconf.php');
         if (stristr($content, 't3lib_extMgm::addPItoST43')) {
             $infoArray['flags'][] = $GLOBALS['LANG']->getLL('detailedExtAnalysis_plugin_st43');
         }
         if (stristr($content, 't3lib_extMgm::addPageTSConfig')) {
             $infoArray['flags'][] = $GLOBALS['LANG']->getLL('detailedExtAnalysis_page_ts');
         }
         if (stristr($content, 't3lib_extMgm::addUserTSConfig')) {
             $infoArray['flags'][] = $GLOBALS['LANG']->getLL('detailedExtAnalysis_user_ts');
         }
         if (stristr($content, 't3lib_extMgm::addTypoScriptSetup')) {
             $infoArray['flags'][] = $GLOBALS['LANG']->getLL('detailedExtAnalysis_ts_setup');
         }
         if (stristr($content, 't3lib_extMgm::addTypoScriptConstants')) {
             $infoArray['flags'][] = $GLOBALS['LANG']->getLL('detailedExtAnalysis_ts_constants');
         }
     }
     if (@is_file($absPath . 'ext_typoscript_constants.txt')) {
         $infoArray['TSfiles'][] = $GLOBALS['LANG']->getLL('detailedExtAnalysis_constants');
     }
     if (@is_file($absPath . 'ext_typoscript_setup.txt')) {
         $infoArray['TSfiles'][] = $GLOBALS['LANG']->getLL('detailedExtAnalysis_setup');
     }
     if (@is_file($absPath . 'ext_conf_template.txt')) {
         $infoArray['conf'] = 1;
     }
     // Classes:
     if ($validity) {
         $filesInside = $this->getClassIndexLocallangFiles($absPath, $table_class_prefix, $extKey);
         if (is_array($filesInside['errors'])) {
             $infoArray['errors'] = array_merge((array) $infoArray['errors'], $filesInside['errors']);
         }
         if (is_array($filesInside['NSerrors'])) {
             $infoArray['NSerrors'] = array_merge((array) $infoArray['NSerrors'], $filesInside['NSerrors']);
         }
         if (is_array($filesInside['NSok'])) {
             $infoArray['NSok'] = array_merge((array) $infoArray['NSok'], $filesInside['NSok']);
         }
         $infoArray['locallang'] = $filesInside['locallang'];
         $infoArray['classes'] = $filesInside['classes'];
     }
     // Upload folders
     if ($extInfo['EM_CONF']['uploadfolder']) {
         $infoArray['uploadfolder'] = $this->ulFolder($extKey);
         if (!@is_dir(PATH_site . $infoArray['uploadfolder'])) {
             $infoArray['errors'][] = sprintf($GLOBALS['LANG']->getLL('detailedExtAnalysis_no_upload_folder'), $infoArray['uploadfolder']);
             $infoArray['uploadfolder'] = '';
         }
     }
     // Create directories:
     if ($extInfo['EM_CONF']['createDirs']) {
         $infoArray['createDirs'] = array_unique(t3lib_div::trimExplode(',', $extInfo['EM_CONF']['createDirs'], 1));
         foreach ($infoArray['createDirs'] as $crDir) {
             if (!@is_dir(PATH_site . $crDir)) {
                 $infoArray['errors'][] = sprintf($GLOBALS['LANG']->getLL('detailedExtAnalysis_no_upload_folder'), $crDir);
             }
         }
     }
     // Return result array:
     return $infoArray;
 }
 /**
  * Function getFolder traverses the target directory,
  * locates all iconFiles and collects them into an array
  *
  * @param string path to an folder which contains images
  * @return array returns an array with all files key: iconname, value: fileName
  */
 protected function getFolder($directoryPath)
 {
     $subFolders = t3lib_div::get_dirs(PATH_site . $directoryPath);
     if (!$this->ommitSpriteNameInIconName) {
         $subFolders[] = '';
     }
     $resultArray = array();
     foreach ($subFolders as $folder) {
         if ($folder !== '.svn') {
             $icons = t3lib_div::getFilesInDir(PATH_site . $directoryPath . $folder . '/', 'gif,png,jpg');
             if (!in_array($folder, $this->spriteBases) && count($icons) && $folder !== '') {
                 $this->spriteBases[] = $folder;
             }
             foreach ($icons as $icon) {
                 $fileInfo = pathinfo($icon);
                 $iconName = ($folder ? $folder . '-' : '') . $fileInfo['filename'];
                 if (!$this->ommitSpriteNameInIconName) {
                     $iconName = $this->spriteName . '-' . $iconName;
                 }
                 $resultArray[$iconName] = $directoryPath . $folder . '/' . $icon;
             }
         }
     }
     return $resultArray;
 }
コード例 #13
0
 /**
  * Gets the items array for a given configuration type (base or site) and path.
  *
  * @param integer $configurationType
  * @param string $relativeConfigurationPath
  * @return array
  */
 protected static function getStaticTemplatesInPath($configurationType, $relativeConfigurationPath)
 {
     $params = array();
     $params['items'] = array();
     $name = basename(PATH_site . $relativeConfigurationPath);
     $prefix = self::getStaticTemplatePrefix();
     // Default TS
     $pathToTS = trim($relativeConfigurationPath, '/') . '/Default/Configuration/TypoScript/';
     if (@is_dir(PATH_site . $pathToTS)) {
         switch ($configurationType) {
             case self::PATH_TYPE_BASE:
                 $configurationName = $configurationKey . ' (Base)';
                 break;
             case self::PATH_TYPE_SITE:
                 $configurationName = $configurationKey . ' (' . $name . ')';
         }
         $params['items'][] = array($prefix . ': ' . $configurationName, $pathToTS);
     }
     // Extension TS
     $configurations = t3lib_div::get_dirs(PATH_site . rtrim($relativeConfigurationPath, '/') . '/Extensions/');
     foreach ((array) $configurations as $configurationKey) {
         $pathToTS = trim($relativeConfigurationPath, '/') . '/Extensions/' . $configurationKey . '/Configuration/TypoScript/';
         if (@is_dir(PATH_site . $pathToTS)) {
             switch ($configurationType) {
                 case self::PATH_TYPE_BASE:
                     $configurationName = $configurationKey . ' (Base)';
                     break;
                 case self::PATH_TYPE_SITE:
                     $configurationName = $configurationKey . ' (' . $name . ')';
             }
             $params['items'][] = array($prefix . ': EXT:' . $configurationName, $pathToTS);
         }
     }
     // addStaticTemplates TS
     $configurations = t3lib_div::get_dirs(PATH_site . rtrim($relativeConfigurationPath, '/') . '/StaticTemplates/');
     foreach ((array) $configurations as $configurationKey) {
         $pathToTS = trim($relativeConfigurationPath, '/') . '/StaticTemplates/' . $configurationKey . '/Configuration/TypoScript/';
         if (@is_dir(PATH_site . $pathToTS)) {
             switch ($configurationType) {
                 case self::PATH_TYPE_BASE:
                     $configurationName = $configurationKey . ' (Base)';
                     break;
                 case self::PATH_TYPE_SITE:
                     $configurationName = $configurationKey . ' (' . $name . ')';
             }
             $params['items'][] = array($prefix . ': ' . $configurationName, $pathToTS);
         }
     }
     return $params;
 }
 /**
  * Get all skins for easyAccordion
  * @return array
  */
 public function getEasyaccordionSkin($config, $item)
 {
     $confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['jfmulticontent']);
     if (!is_dir(t3lib_div::getFileAbsFileName($confArr['easyAccordionSkinFolder']))) {
         // if the defined folder does not exist, define the default folder
         $confArr['easyAccordionSkinFolder'] = "EXT:jfmulticontent/res/easyaccordion/skins/";
     }
     $items = t3lib_div::get_dirs(t3lib_div::getFileAbsFileName($confArr['easyAccordionSkinFolder']));
     if (count($items) > 0) {
         $optionList = array();
         foreach ($items as $key => $item) {
             $item = trim($item);
             if (!preg_match('/^\\./', $item)) {
                 $optionList[] = array(ucfirst($item), $item);
             }
         }
         $config['items'] = array_merge($config['items'], $optionList);
     }
     return $config;
 }
コード例 #15
0
 /**
  * Searching for filename pattern recursively in the specified dir.
  *
  * @param	string		Base directory
  * @param	string		Match pattern
  * @param	array		Array of matching files, passed by reference
  * @param	integer		Depth to recurse
  * @return	array		Array with various information about the search result
  * @see func_filesearch()
  */
 function findFile($basedir, $pattern, &$matching_files, $depth)
 {
     $files_searched = 0;
     $dirs_searched = 0;
     $dirs_error = 0;
     // Traverse files:
     $files = t3lib_div::getFilesInDir($basedir, '', 1);
     if (is_array($files)) {
         $files_searched += count($files);
         foreach ($files as $value) {
             if (preg_match('/' . $pattern . '/i', basename($value))) {
                 $matching_files[] = substr($value, strlen(PATH_site));
             }
         }
     }
     // Traverse subdirs
     if ($depth > 0) {
         $dirs = t3lib_div::get_dirs($basedir);
         if (is_array($dirs)) {
             $dirs_searched += count($dirs);
             foreach ($dirs as $value) {
                 $inf = $this->findFile($basedir . $value . '/', $pattern, $matching_files, $depth - 1);
                 $dirs_searched += $inf[0];
                 $files_searched += $inf[1];
                 $dirs_error = $inf[2];
             }
         }
     } else {
         $dirs = t3lib_div::get_dirs($basedir);
         if (is_array($dirs) && count($dirs)) {
             $dirs_error = 1;
             // Means error - there were further subdirs!
         }
     }
     return array($dirs_searched, $files_searched, $dirs_error);
 }
コード例 #16
0
 /**
  * Returns an array with all files and folders in $extPath
  *
  * @param       array $fileArr
  * @param       string $extPath
  * @return      array          Array with files and folders
  * @access      private
  */
 function getAllFilesAndFoldersInPath($fileArr, $extPath)
 {
     $extList = '';
     $fileArr[] = $extPath;
     $fileArr = array_merge($fileArr, t3lib_div::getFilesInDir($extPath, $extList, 1, 1));
     $dirs = t3lib_div::get_dirs($extPath);
     if (is_array($dirs)) {
         reset($dirs);
         while (list(, $subdirs) = each($dirs)) {
             if ($subdirs) {
                 $fileArr = $this->getAllFilesAndFoldersInPath($fileArr, $extPath . $subdirs . '/');
             }
         }
     }
     return $fileArr;
 }
コード例 #17
0
    /**
     * Shows the update Message
     * @return	string
     */
    public function displayMessage(&$params, &$tsObj)
    {
        $out = '';
        if (tx_t3jquery::getIntFromVersion(TYPO3_version) < 4003000) {
            // 4.3.0 comes with flashmessages styles. For older versions we include the needed styles here
            $cssPath = $GLOBALS['BACK_PATH'] . t3lib_extMgm::extRelPath('t3jquery');
            $out .= '<link rel="stylesheet" type="text/css" href="' . $cssPath . 'compat/flashmessages.css" media="screen" />';
        }
        // get all supported UI-Versions from folder
        $supportedUiVersions = t3lib_div::get_dirs(t3lib_div::getFileAbsFileName("EXT:t3jquery/res/jquery/ui/"));
        if (is_array($supportedUiVersions)) {
            foreach ($supportedUiVersions as $supportedUiVersion) {
                if (file_exists(t3lib_div::getFileAbsFileName("EXT:t3jquery/res/jquery/ui/") . $supportedUiVersion . '/jquery.xml')) {
                    $this->supportedUiVersion[] = $supportedUiVersion;
                }
            }
        }
        // get all supported TOOLS-Versions from folder
        $supportedToolsVersions = t3lib_div::get_dirs(t3lib_div::getFileAbsFileName("EXT:t3jquery/res/jquery/tools/"));
        if (is_array($supportedToolsVersions)) {
            foreach ($supportedToolsVersions as $supportedToolsVersion) {
                if (file_exists(t3lib_div::getFileAbsFileName("EXT:t3jquery/res/jquery/tools/") . $supportedToolsVersion . '/jquery.xml')) {
                    $this->supportedToolsVersion[] = $supportedToolsVersion;
                }
            }
        }
        // get the conf array
        $this->confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['t3jquery']);
        // if form is submited, the POST values are taken
        $post = t3lib_div::_POST();
        if (count($post) > 0) {
            $jQueryUiVersion = $post['data']['jQueryUiVersion'];
            $jQueryToolsVersion = $post['data']['jQueryTOOLSVersion'];
            $jQueryVersion = $post['data']['jQueryVersion'] . "-" . $post['data']['jQueryUiVersion'] . ($post['data']['jQueryTOOLSVersion'] ? "-" . $post['data']['jQueryTOOLSVersion'] : "");
            $configDir = $post['data']['configDir'] . (preg_match("/\\/\$/", $configDir) ? "" : "/");
        } else {
            $jQueryUiVersion = $this->confArr['jQueryUiVersion'];
            $jQueryToolsVersion = $this->confArr['jQueryTOOLSVersion'];
            $jQueryVersion = T3JQUERYVERSION;
            $configDir = tx_t3jquery::getJqPath();
        }
        if ($this->checkConfig() === FALSE) {
            $out .= '
	<div class="typo3-message message-warning">
		<div class="message-header">' . $GLOBALS['LANG']->sL('LLL:EXT:t3jquery/locallang.xml:extmng.checkConfigHeader') . '</div>
		<div class="message-body">
			' . $GLOBALS['LANG']->sL('LLL:EXT:t3jquery/locallang.xml:extmng.checkConfig') . '
		</div>
	</div>';
        } elseif ($this->confArr['integrateFromCDN'] || $post['data']['integrateFromCDN']) {
            // Nothing to check
        } else {
            // check the actual version
            if ($jQueryUiVersion && !in_array($jQueryUiVersion, $this->supportedUiVersion) || $jQueryToolsVersion && !in_array($jQueryToolsVersion, $this->supportedToolsVersion)) {
                $out .= '
	<div class="typo3-message message-information">
		<div class="message-header">' . $GLOBALS['LANG']->sL('LLL:EXT:t3jquery/locallang.xml:extmng.updatermsgHeader') . '</div>
		<div class="message-body">
			' . $GLOBALS['LANG']->sL('LLL:EXT:t3jquery/locallang.xml:extmng.updatermsg') . '
		</div>
	</div>';
            }
            // Check if the library exists
            if (!file_exists(PATH_site . $configDir . tx_t3jquery::getJqName())) {
                $out .= '
	<a href="javascript:void();" onclick="top.goToModule(\'tools_txt3jqueryM1\',\'\',\'createLib=1\');this.blur();return false;">
		<div class="typo3-message message-warning">
			<div class="message-header">' . $GLOBALS['LANG']->sL('LLL:EXT:t3jquery/locallang.xml:extmng.updatermsgHeader2') . '</div>
			<div class="message-body">
				' . sprintf($GLOBALS['LANG']->sL('LLL:EXT:t3jquery/locallang.xml:extmng.updatermsg2'), $configDir . tx_t3jquery::getJqName()) . '
			</div>
		</div>
	</a>';
            }
        }
        $out = '<div style="position:absolute;top:10px;right:10px; width:300px;">' . $out . '</div>';
        return $out;
    }
コード例 #18
0
 /**
  * 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);
                 }
             }
         }
     }
 }
コード例 #19
0
 /**
  * Recursively gather all files and folders of a path.
  * Usage: 5
  *
  * @param	array		$fileArr: Empty input array (will have files added to it)
  * @param	string		$path: The path to read recursively from (absolute) (include trailing slash!)
  * @param	string		$extList: Comma list of file extensions: Only files with extensions in this list (if applicable) will be selected.
  * @param	boolean		$regDirs: If set, directories are also included in output.
  * @param	integer		$recursivityLevels: The number of levels to dig down...
  * @param string		$excludePattern: regex pattern of files/directories to exclude
  * @return	array		An array with the found files/directories.
  */
 public static function getAllFilesAndFoldersInPath(array $fileArr, $path, $extList = '', $regDirs = 0, $recursivityLevels = 99, $excludePattern = '')
 {
     if ($regDirs) {
         $fileArr[] = $path;
     }
     $fileArr = array_merge($fileArr, t3lib_div::getFilesInDir($path, $extList, 1, 1, $excludePattern));
     $dirs = t3lib_div::get_dirs($path);
     if (is_array($dirs) && $recursivityLevels > 0) {
         foreach ($dirs as $subdirs) {
             if ((string) $subdirs != '' && (!strlen($excludePattern) || !preg_match('/^' . $excludePattern . '$/', $subdirs))) {
                 $fileArr = t3lib_div::getAllFilesAndFoldersInPath($fileArr, $path . $subdirs . '/', $extList, $regDirs, $recursivityLevels - 1, $excludePattern);
             }
         }
     }
     return $fileArr;
 }
コード例 #20
0
 /**
  * For RTE: This displays all files from folder. No thumbnails shown
  *
  * @param	string		The folder path to expand
  * @param	string		List of fileextensions to show
  * @return	string		HTML output
  */
 function expandFolder($expandFolder = 0, $extensionList = '')
 {
     global $BACK_PATH;
     $expandFolder = $expandFolder ? $expandFolder : $this->expandFolder;
     $out = '';
     if ($expandFolder && $this->checkFolder($expandFolder)) {
         // Create header for filelisting:
         $out .= $this->barheader($GLOBALS['LANG']->getLL('files') . ':');
         // Prepare current path value for comparison (showing red arrow)
         if (!$this->curUrlInfo['value']) {
             $cmpPath = '';
         } else {
             $cmpPath = PATH_site . $this->curUrlInfo['info'];
         }
         // Create header element; The folder from which files are listed.
         $titleLen = intval($GLOBALS['BE_USER']->uc['titleLen']);
         $picon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/i/_icon_webfolders.gif', 'width="18" height="16"') . ' alt="" />';
         $picon .= htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($expandFolder), $titleLen));
         $picon = '<a href="#" onclick="return link_folder(\'' . t3lib_div::rawUrlEncodeFP(substr($expandFolder, strlen(PATH_site))) . '\');">' . $picon . '</a>';
         if ($this->curUrlInfo['act'] == 'folder' && $cmpPath == $expandFolder) {
             $out .= '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/blinkarrow_left.gif', 'width="5" height="9"') . ' class="c-blinkArrowL" alt="" />';
         }
         $out .= $picon . '<br />';
         // Get files from the folder:
         if ($this->mode == 'wizard' && $this->act == 'folder') {
             $files = t3lib_div::get_dirs($expandFolder);
         } else {
             $files = t3lib_div::getFilesInDir($expandFolder, $extensionList, 1, 1);
             // $extensionList='', $prependPath=0, $order='')
         }
         $c = 0;
         $cc = count($files);
         if (is_array($files)) {
             foreach ($files as $filepath) {
                 $c++;
                 $fI = pathinfo($filepath);
                 if ($this->mode == 'wizard' && $this->act == 'folder') {
                     $filepath = $expandFolder . $filepath . '/';
                     $icon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/i/_icon_webfolders.gif', 'width="18" height="16"') . ' alt="" />';
                 } else {
                     // File icon:
                     $icon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
                     // Get size and icon:
                     $size = ' (' . t3lib_div::formatSize(filesize($filepath)) . 'bytes)';
                     $icon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/fileicons/' . $icon . '', 'width="18" height="16"') . ' title="' . htmlspecialchars($fI['basename'] . $size) . '" alt="" />';
                 }
                 // If the listed file turns out to be the CURRENT file, then show blinking arrow:
                 if (($this->curUrlInfo['act'] == 'file' || $this->curUrlInfo['act'] == 'folder') && $cmpPath == $filepath) {
                     $arrCol = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/blinkarrow_left.gif', 'width="5" height="9"') . ' class="c-blinkArrowL" alt="" />';
                 } else {
                     $arrCol = '';
                 }
                 // Put it all together for the file element:
                 $out .= '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/ol/join' . ($c == $cc ? 'bottom' : '') . '.gif', 'width="18" height="16"') . ' alt="" />' . $arrCol . '<a href="#" onclick="return link_folder(\'' . t3lib_div::rawUrlEncodeFP(substr($filepath, strlen(PATH_site))) . '\');">' . $icon . htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath), $titleLen)) . '</a><br />';
             }
         }
     }
     return $out;
 }
コード例 #21
0
 /**
  * Tests whether getDirs() returns the string 'error' in case of problems reading from the given path
  * @test
  * @see t3lib_div::getDirs($path)
  */
 public function checkGetDirsReturnsStringErrorOnPathFailure()
 {
     $path = 'foo';
     $result = t3lib_div::get_dirs($path);
     $expectedResult = 'error';
     $this->assertEquals($expectedResult, $result);
 }
コード例 #22
0
 function getFolderCount($files_path)
 {
     // This generates the directory tree
     $dirs = t3lib_div::get_dirs($files_path);
     $c = 0;
     if (is_array($dirs)) {
         $c = count($dirs);
     }
     return $c;
 }
 /**
  * genereates a file tree
  *
  * @param object $parameter
  * @return array
  */
 public function getExtFileTree($parameter)
 {
     $type = $parameter->typeShort;
     $node = substr($parameter->node, 0, 6) !== 'xnode-' ? $parameter->node : $parameter->baseNode;
     $path = PATH_site . $node;
     $fileArray = array();
     $dirs = t3lib_div::get_dirs($path);
     $files = t3lib_div::getFilesInDir($path, '', FALSE, '', '');
     if (!is_array($dirs) && !is_array($files)) {
         return array();
     }
     foreach ($dirs as $dir) {
         if ($dir[0] !== '.') {
             $fileArray[] = array('id' => ($node == '' ? '' : $node . '/') . $dir, 'text' => htmlspecialchars($dir), 'leaf' => false, 'qtip' => '');
         }
     }
     foreach ($files as $key => $file) {
         $fileInfo = $this->getFileInfo($file);
         $fileArray[] = array('id' => $node . '/' . $file, 'text' => $fileInfo[0], 'leaf' => true, 'qtip' => $fileInfo[1], 'iconCls' => $fileInfo[4], 'fileType' => $fileInfo[3], 'ext' => $fileInfo[2]);
     }
     return $fileArray;
 }