Bug #16419 » class.em_index.diff

Administrator Admin, 2006-08-03 09:47

View differences:

class.em_index.php 1 Aug 2006 16:39:23 -0000
322 322
	var $listRemote;					// If set, connects to remote repository
323 323
	var $lookUpStr;						// Search string when listing local extensions
324 324

  
325

  
325
//prs+ 01.08.2006
326
	var $excludeHidden=false;			// if set, hidden or system files will not be transfered
327
	var $pathAttribs=array();			// holds the attribs for a path to reduce exec calls
328
//prs- 01.08.2006
326 329

  
327 330

  
328 331
	/*********************************
......
2581 2584
					</td>
2582 2585
				</tr>
2583 2586
				<tr class="bgColor4">
2587
					<td>Exclude hidden files:</td>
2588
					<td nowrap="nowrap">
2589
						<input type="checkbox" name="em[upload][exclude]" value="1" checked="checked" />
2590
					</td>
2591
				</tr>
2592
				<tr class="bgColor4">
2584 2593
					<td>&nbsp;</td>
2585 2594
					<td><input type="submit" name="submit" value="Upload extension" />
2586 2595
					</td>
......
3868 3877
		$lines .= str_repeat(chr(9),$level-1).')'.($level-1==0 ? '':','.chr(10));
3869 3878
		return $lines;
3870 3879
	}
3871

  
3880
//prs+ 01.08.2006
3881
	/**
3882
	 * Removes hidden files from file array
3883
	 * 
3884
	 * @param array	Array of files
3885
	 * @return array Array of files not hidden or system
3886
	 */
3887
	function _isHiddenWin($key='',$fName='',$extPath='')
3888
	{
3889
		/*
3890
		 * On windows S and H attribute is set on index 3 or 4
3891
		 * 
3892
		 */
3893
		$str=substr(exec('attrib '.$fName),0,6);
3894
		$isHidden=strpos($str,'S') || strpos($str,'H');
3895
		$isHidden=($isHidden===false)?false:true;
3896
		if (!isset($this->pathAttribs[$key]))
3897
		{
3898
			$d=substr((exec('attrib '.dirname($fName))),0,6);
3899
			$this->pathAttribs[$key]=(strpos($d,'S') || strpos($d,'H'));
3900
			$this->pathAttribs[$key]=($this->pathAttribs[$key]===false)?false:true;
3901
		}
3902
		return ($isHidden || $this->pathAttribs[$key]);
3903
	}
3904
	function _isHiddenNix($key='',$fName='',$extPath='')
3905
	{
3906
		$cName=substr($fName,strlen($extPath)-1);
3907
		$pos=strpos($fName,'/.');
3908
		return ($pos===false)?false:true;
3909
	}
3910
	function removeHiddenFiles($fileArr=array(),$extPath='')
3911
	{
3912
		$fA=array();
3913
		$func=(TYPO3_OS=='WIN')?'_isHiddenWin':'_isHiddenNix';
3914
		foreach($fileArr as $key=>$fName)
3915
		{
3916
			if (! $this->$func($key,$fName,$extPath))
3917
			{
3918
				$fA[$key]=$fName;
3919
			}
3920
		}
3921
		return $fA;
3922
	}
3923
//prs- 01.08.2006
3872 3924
	/**
3873 3925
	 * Make upload array out of extension
3874 3926
	 *
......
3885 3937
			$fileArr = array();
3886 3938
			$fileArr = t3lib_div::getAllFilesAndFoldersInPath($fileArr,$extPath);
3887 3939

  
3940
//prs+ 01.08.2006
3941
			if ($this->excludeHidden)
3942
			{
3943
				//remove hidden or system files from fileArr;
3944
				$fileArr=$this->removeHiddenFiles($fileArr,$extPath);
3945
			}
3946
//prs- 01.08.2006
3947

  
3888 3948
			// Calculate the total size of those files:
3889 3949
			$totalSize = 0;
3890 3950
			foreach($fileArr as $file)	{
......
4818 4878
	 */
4819 4879
	function uploadExtensionToTER($em)	{
4820 4880
		$msg = '';
4881
		//prs+ 01.08.2006
4882
		$this->excludeHidden=isset($em['upload']['exclude'])&& $em['upload']['exclude'];
4883
		//prs- 01.08.2006
4821 4884
		$response = $this->terConnection->uploadToTER($em);
4822 4885

  
4823 4886
		if(!is_array($response)) return $response;
(2-2/9)