Project

General

Profile

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
var $listRemote; // If set, connects to remote repository
var $lookUpStr; // Search string when listing local extensions
//prs+ 01.08.2006
var $excludeHidden=false; // if set, hidden or system files will not be transfered
var $pathAttribs=array(); // holds the attribs for a path to reduce exec calls
//prs- 01.08.2006
/*********************************
......
</td>
</tr>
<tr class="bgColor4">
<td>Exclude hidden files:</td>
<td nowrap="nowrap">
<input type="checkbox" name="em[upload][exclude]" value="1" checked="checked" />
</td>
</tr>
<tr class="bgColor4">
<td>&nbsp;</td>
<td><input type="submit" name="submit" value="Upload extension" />
</td>
......
$lines .= str_repeat(chr(9),$level-1).')'.($level-1==0 ? '':','.chr(10));
return $lines;
}
//prs+ 01.08.2006
/**
* Removes hidden files from file array
*
* @param array Array of files
* @return array Array of files not hidden or system
*/
function _isHiddenWin($key='',$fName='',$extPath='')
{
/*
* On windows S and H attribute is set on index 3 or 4
*
*/
$str=substr(exec('attrib '.$fName),0,6);
$isHidden=strpos($str,'S') || strpos($str,'H');
$isHidden=($isHidden===false)?false:true;
if (!isset($this->pathAttribs[$key]))
{
$d=substr((exec('attrib '.dirname($fName))),0,6);
$this->pathAttribs[$key]=(strpos($d,'S') || strpos($d,'H'));
$this->pathAttribs[$key]=($this->pathAttribs[$key]===false)?false:true;
}
return ($isHidden || $this->pathAttribs[$key]);
}
function _isHiddenNix($key='',$fName='',$extPath='')
{
$cName=substr($fName,strlen($extPath)-1);
$pos=strpos($fName,'/.');
return ($pos===false)?false:true;
}
function removeHiddenFiles($fileArr=array(),$extPath='')
{
$fA=array();
$func=(TYPO3_OS=='WIN')?'_isHiddenWin':'_isHiddenNix';
foreach($fileArr as $key=>$fName)
{
if (! $this->$func($key,$fName,$extPath))
{
$fA[$key]=$fName;
}
}
return $fA;
}
//prs- 01.08.2006
/**
* Make upload array out of extension
*
......
$fileArr = array();
$fileArr = t3lib_div::getAllFilesAndFoldersInPath($fileArr,$extPath);
//prs+ 01.08.2006
if ($this->excludeHidden)
{
//remove hidden or system files from fileArr;
$fileArr=$this->removeHiddenFiles($fileArr,$extPath);
}
//prs- 01.08.2006
// Calculate the total size of those files:
$totalSize = 0;
foreach($fileArr as $file) {
......
*/
function uploadExtensionToTER($em) {
$msg = '';
//prs+ 01.08.2006
$this->excludeHidden=isset($em['upload']['exclude'])&& $em['upload']['exclude'];
//prs- 01.08.2006
$response = $this->terConnection->uploadToTER($em);
if(!is_array($response)) return $response;
(2-2/9)