Bug #16375 » 0006037.patch
t3lib/class.t3lib_div.php (Arbeitskopie) | ||
---|---|---|
function breakTextForEmail($str,$implChar="\n",$charWidth=76) {
|
||
$lines = explode(chr(10),$str);
|
||
$outArr=array();
|
||
while(list(,$lStr)=each($lines)) {
|
||
foreach ($lines as &$lStr) {
|
||
$outArr[] = t3lib_div::breakLinesForEmail($lStr,$implChar,$charWidth);
|
||
}
|
||
return implode(chr(10),$outArr);
|
||
... | ... | |
*/
|
||
function cmpIP($baseIP, $list) {
|
||
if ($list==='*') return TRUE;
|
||
if (strstr($baseIP, ':') && t3lib_div::validIPv6($baseIP)) {
|
||
if (strpos($baseIP, ':') !== false && t3lib_div::validIPv6($baseIP)) {
|
||
return t3lib_div::cmpIPv6($baseIP, $list);
|
||
} else {
|
||
return t3lib_div::cmpIPv4($baseIP, $list);
|
||
... | ... | |
if (count($IPpartsReq)==4) {
|
||
$values = t3lib_div::trimExplode(',',$list,1);
|
||
foreach($values as $test) {
|
||
foreach($values as &$test) {
|
||
list($test,$mask) = explode('/',$test);
|
||
if(intval($mask)) {
|
||
... | ... | |
// "192.168.*.*"
|
||
$IPparts = explode('.',$test);
|
||
$yes = 1;
|
||
reset($IPparts);
|
||
while(list($index,$val)=each($IPparts)) {
|
||
foreach ($IPparts as $index => &$val) {
|
||
$val = trim($val);
|
||
if (strcmp($val,'*') && strcmp($IPpartsReq[$index],$val)) {
|
||
$yes=0;
|
||
... | ... | |
$baseIP = t3lib_div::normalizeIPv6($baseIP);
|
||
$values = t3lib_div::trimExplode(',',$list,1);
|
||
foreach ($values as $test) {
|
||
foreach ($values as &$test) {
|
||
list($test,$mask) = explode('/',$test);
|
||
if (t3lib_div::validIPv6($test)) {
|
||
$test = t3lib_div::normalizeIPv6($test);
|
||
... | ... | |
// normalize the blocks:
|
||
$blocks = explode(':', $stageOneAddress);
|
||
$divCounter = 0;
|
||
foreach ($blocks as $block) {
|
||
foreach ($blocks as &$block) {
|
||
$tmpBlock = '';
|
||
$i = 0;
|
||
$hiddenZeros = 4 - strlen($block);
|
||
... | ... | |
$resolvedHostName = explode('.', gethostbyaddr($baseIP));
|
||
$values = t3lib_div::trimExplode(',',$list,1);
|
||
foreach($values as $test) {
|
||
foreach($values as &$test) {
|
||
$hostNameParts = explode('.',$test);
|
||
$yes = 1;
|
||
foreach($hostNameParts as $index => $val) {
|
||
foreach($hostNameParts as $index => &$val) {
|
||
$val = trim($val);
|
||
if (strcmp($val,'*') && strcmp($resolvedHostName[$index],$val)) {
|
||
$yes=0;
|
||
... | ... | |
* @return boolean true if $item is in $list
|
||
*/
|
||
function inList($list,$item) {
|
||
return strstr(','.$list.',', ','.$item.',') ? true : false;
|
||
return (strpos(' ,'.$list.',', ','.$item.',') ? true : false);
|
||
}
|
||
/**
|
||
... | ... | |
*/
|
||
function rmFromList($element,$list) {
|
||
$items = explode(',',$list);
|
||
while(list($k,$v)=each($items)) {
|
||
if ($v==$element) {unset($items[$k]);}
|
||
foreach ($items as $k => &$v) {
|
||
if ($v==$element) {
|
||
unset($items[$k]);
|
||
}
|
||
}
|
||
return implode(',',$items);
|
||
}
|
||
... | ... | |
function expandList($list) {
|
||
$items = explode(',',$list);
|
||
$list = array();
|
||
while(list(,$item)=each($items)) {
|
||
foreach ($items as &$item) {
|
||
$range = explode('-',$item);
|
||
if (isset($range[1])) {
|
||
$runAwayBrake = 1000;
|
||
... | ... | |
$list[] = $item;
|
||
}
|
||
}
|
||
return implode(',',$list);
|
||
}
|
||
... | ... | |
$number=0;
|
||
$Msign='+';
|
||
$err='';
|
||
$buffer=doubleval(current($reg[2]));
|
||
next($reg[2]); // Advance pointer
|
||
while(list($k,$v)=each($reg[2])) {
|
||
$buffer=doubleval(array_shift($reg[2]));
|
||
foreach ($reg[2] as $k => &$v) {
|
||
$v=doubleval($v);
|
||
$sign = $reg[1][$k];
|
||
if ($sign=='+' || $sign=='-') {
|
||
... | ... | |
*/
|
||
function validEmail($email) {
|
||
$email = trim ($email);
|
||
if (strstr($email,' ')) return FALSE;
|
||
if (strpos($email,' ') !== false) {
|
||
return FALSE;
|
||
}
|
||
return ereg('^[A-Za-z0-9\._-]+[@][A-Za-z0-9\._-]+[\.].[A-Za-z0-9]+$',$email) ? TRUE : FALSE;
|
||
}
|
||
... | ... | |
*/
|
||
function inArray($in_array,$item) {
|
||
if (is_array($in_array)) {
|
||
while (list(,$val)=each($in_array)) {
|
||
if (!is_array($val) && !strcmp($val,$item)) return true;
|
||
foreach ($in_array as &$val) {
|
||
if (!is_array($val) && !strcmp($val,$item)) {
|
||
return true;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
... | ... | |
*/
|
||
function intExplode($delim, $string) {
|
||
$temp = explode($delim,$string);
|
||
while(list($key,$val)=each($temp)) {
|
||
$temp[$key]=intval($val);
|
||
foreach ($temp as $key => &$val) {
|
||
$temp[$key] = intval($val);
|
||
}
|
||
reset($temp);
|
||
return $temp;
|
||
... | ... | |
*/
|
||
function revExplode($delim, $string, $count=0) {
|
||
$temp = explode($delim,strrev($string),$count);
|
||
while(list($key,$val)=each($temp)) {
|
||
foreach ($temp as $key => &$val) {
|
||
$temp[$key]=strrev($val);
|
||
}
|
||
$temp=array_reverse($temp);
|
||
... | ... | |
function removeArrayEntryByValue($array,$cmpValue) {
|
||
if (is_array($array)) {
|
||
reset($array);
|
||
while(list($k,$v)=each($array)) {
|
||
foreach ($array as $k => &$v) {
|
||
if (is_array($v)) {
|
||
$array[$k] = t3lib_div::removeArrayEntryByValue($v,$cmpValue);
|
||
} else {
|
||
... | ... | |
*/
|
||
function implodeArrayForUrl($name,$theArray,$str='',$skipBlank=0,$rawurlencodeParamName=0) {
|
||
if (is_array($theArray)) {
|
||
foreach($theArray as $Akey => $AVal) {
|
||
$thisKeyName = $name ? $name.'['.$Akey.']' : $Akey;
|
||
if (is_array($AVal)) {
|
||
$str = t3lib_div::implodeArrayForUrl($thisKeyName,$AVal,$str,$skipBlank,$rawurlencodeParamName);
|
||
foreach($theArray as $key => &$value) {
|
||
$thisKeyName = $name ? $name.'['.$key.']' : $key;
|
||
if (is_array($value)) {
|
||
$str = t3lib_div::implodeArrayForUrl($thisKeyName,$value,$str,$skipBlank,$rawurlencodeParamName);
|
||
} else {
|
||
if (!$skipBlank || strcmp($AVal,'')) {
|
||
if (!$skipBlank || strcmp($value,'')) {
|
||
$str.='&'.($rawurlencodeParamName ? rawurlencode($thisKeyName) : $thisKeyName).
|
||
'='.rawurlencode($AVal);
|
||
'='.rawurlencode($value);
|
||
}
|
||
}
|
||
}
|
||
... | ... | |
parse_str($string,$output);
|
||
} else {
|
||
$p = explode('&',$string);
|
||
foreach($p as $v) {
|
||
foreach($p as &$v) {
|
||
if (strlen($v)) {
|
||
list($pK,$pV) = explode('=',$v,2);
|
||
$output[rawurldecode($pK)] = rawurldecode($pV);
|
||
... | ... | |
function compileSelectedGetVarsFromArray($varList,$getArray,$GPvarAlt=1) {
|
||
$keys = t3lib_div::trimExplode(',',$varList,1);
|
||
$outArr=array();
|
||
foreach($keys as $v) {
|
||
foreach($keys as &$v) {
|
||
if (isset($getArray[$v])) {
|
||
$outArr[$v]=$getArray[$v];
|
||
} elseif ($GPvarAlt) {
|
||
... | ... | |
* @param array Multidimensional input array, (REFERENCE!)
|
||
* @return array
|
||
*/
|
||
function addSlashesOnArray(&$theArray) {
|
||
if (is_array($theArray)) {
|
||
reset($theArray);
|
||
while(list($Akey,$AVal)=each($theArray)) {
|
||
if (is_array($AVal)) {
|
||
t3lib_div::addSlashesOnArray($theArray[$Akey]);
|
||
function addSlashesOnArray(&$array) {
|
||
if (is_array($array)) {
|
||
foreach ($array as $key => &$value) {
|
||
if (is_array($value)) {
|
||
t3lib_div::addSlashesOnArray($array[$key]);
|
||
} else {
|
||
$theArray[$Akey] = addslashes($AVal);
|
||
$array[$key] = addslashes($value);
|
||
}
|
||
}
|
||
reset($theArray);
|
||
reset($array);
|
||
}
|
||
}
|
||
... | ... | |
* @param array Multidimensional input array, (REFERENCE!)
|
||
* @return array
|
||
*/
|
||
function stripSlashesOnArray(&$theArray) {
|
||
if (is_array($theArray)) {
|
||
reset($theArray);
|
||
while(list($Akey,$AVal)=each($theArray)) {
|
||
if (is_array($AVal)) {
|
||
t3lib_div::stripSlashesOnArray($theArray[$Akey]);
|
||
function stripSlashesOnArray(&$array) {
|
||
if (is_array($array)) {
|
||
foreach ($array as $key => &$value) {
|
||
if (is_array($value)) {
|
||
t3lib_div::stripSlashesOnArray($array[$key]);
|
||
} else {
|
||
$theArray[$Akey] = stripslashes($AVal);
|
||
$array[$key] = stripslashes($value);
|
||
}
|
||
}
|
||
reset($theArray);
|
||
reset($array);
|
||
}
|
||
}
|
||
... | ... | |
* @return array Resulting array where $arr1 values has overruled $arr0 values
|
||
*/
|
||
function array_merge_recursive_overrule($arr0,$arr1,$notAddKeys=0,$includeEmtpyValues=true) {
|
||
reset($arr1);
|
||
while(list($key,$val) = each($arr1)) {
|
||
foreach ($arr1 as $key => &$val) {
|
||
if(is_array($arr0[$key])) {
|
||
if (is_array($arr1[$key])) {
|
||
$arr0[$key] = t3lib_div::array_merge_recursive_overrule($arr0[$key],$arr1[$key],$notAddKeys,$includeEmtpyValues);
|
||
... | ... | |
function csvValues($row,$delim=',',$quote='"') {
|
||
reset($row);
|
||
$out=array();
|
||
foreach ($row as $value) {
|
||
foreach ($row as &$value) {
|
||
$out[] = str_replace($quote, $quote.$quote, $value);
|
||
}
|
||
$str = $quote.implode($quote.$delim.$quote,$out).$quote;
|
||
... | ... | |
function removeDotsFromTS($ts) {
|
||
$out = array();
|
||
if (is_array($ts)) {
|
||
foreach ($ts as $key => $value) {
|
||
foreach ($ts as $key => &$value) {
|
||
if (is_array($value)) {
|
||
$key = rtrim($key, '.');
|
||
$out[$key] = t3lib_div::removeDotsFromTS($value);
|
||
... | ... | |
$name = ''; // attribute name is stored here
|
||
$valuemode = '';
|
||
if (is_array($components)) {
|
||
while (list($key,$val) = each ($components)) {
|
||
foreach ($components as $key => &$val) {
|
||
if ($val != '=') { // Only if $name is set (if there is an attribute, that waits for a value), that valuemode is enabled. This ensures that the attribute is assigned it's value
|
||
if ($valuemode) {
|
||
if ($name) {
|
||
... | ... | |
if (is_array($arr)) {
|
||
if ($xhtmlSafe) {
|
||
$newArr=array();
|
||
foreach($arr as $p => $v) {
|
||
foreach($arr as $p => &$v) {
|
||
if (!isset($newArr[strtolower($p)])) $newArr[strtolower($p)] = htmlspecialchars($v);
|
||
}
|
||
$arr = $newArr;
|
||
}
|
||
$list = array();
|
||
foreach($arr as $p => $v) {
|
||
foreach($arr as $p => &$v) {
|
||
if (strcmp($v,'') || $dontOmitBlankAttribs) {$list[]=$p.'="'.$v.'"';}
|
||
}
|
||
return implode(' ',$list);
|
||
... | ... | |
// FIXME don't use unset() - what does that mean? Use NULL or similar.
|
||
unset($tagi);
|
||
foreach($vals as $key => $val) {
|
||
foreach($vals as $key => &$val) {
|
||
$type = $val['type'];
|
||
// open tag:
|
||
... | ... | |
// Traverse the input array
|
||
if (is_array($array)) {
|
||
foreach($array as $k=>$v) {
|
||
foreach($array as $k => &$v) {
|
||
$attr = '';
|
||
$tagName = $k;
|
||
... | ... | |
$documentTag = '';
|
||
// Traverse the parsed XML structure:
|
||
foreach($vals as $key => $val) {
|
||
foreach($vals as $key => &$val) {
|
||
// First, process the tag-name (which is used in both cases, whether "complete" or "close")
|
||
$tagName = $val['tag'];
|
||
... | ... | |
function xmlRecompileFromStructValArray($vals) {
|
||
$XMLcontent='';
|
||
foreach($vals as $val) {
|
||
$type = $val['type'];
|
||
// open tag:
|
||
if ($type=='open' || $type=='complete') {
|
||
$XMLcontent.='<'.$val['tag'];
|
||
if(isset($val['attributes'])) {
|
||
foreach($val['attributes'] as $k => $v) {
|
||
$XMLcontent.=' '.$k.'="'.htmlspecialchars($v).'"';
|
||
if (is_array($vals)) {
|
||
foreach($vals as &$val) {
|
||
$type = $val['type'];
|
||
|
||
// open tag:
|
||
if ($type=='open' || $type=='complete') {
|
||
$XMLcontent.='<'.$val['tag'];
|
||
if(isset($val['attributes']) && is_array($val['attributes'])) {
|
||
foreach($val['attributes'] as $k => &$v) {
|
||
$XMLcontent.=' '.$k.'="'.htmlspecialchars($v).'"';
|
||
}
|
||
}
|
||
if ($type=='complete') {
|
||
if(isset($val['value'])) {
|
||
$XMLcontent.='>'.htmlspecialchars($val['value']).'</'.$val['tag'].'>';
|
||
} else $XMLcontent.='/>';
|
||
} else $XMLcontent.='>';
|
||
|
||
if ($type=='open' && isset($val['value'])) {
|
||
$XMLcontent.=htmlspecialchars($val['value']);
|
||
}
|
||
}
|
||
if ($type=='complete') {
|
||
if(isset($val['value'])) {
|
||
$XMLcontent.='>'.htmlspecialchars($val['value']).'</'.$val['tag'].'>';
|
||
} else $XMLcontent.='/>';
|
||
} else $XMLcontent.='>';
|
||
if ($type=='open' && isset($val['value'])) {
|
||
// finish tag:
|
||
if ($type=='close') {
|
||
$XMLcontent.='</'.$val['tag'].'>';
|
||
}
|
||
// cdata
|
||
if($type=='cdata') {
|
||
$XMLcontent.=htmlspecialchars($val['value']);
|
||
}
|
||
}
|
||
// finish tag:
|
||
if ($type=='close') {
|
||
$XMLcontent.='</'.$val['tag'].'>';
|
||
}
|
||
// cdata
|
||
if($type=='cdata') {
|
||
$XMLcontent.=htmlspecialchars($val['value']);
|
||
}
|
||
}
|
||
return $XMLcontent;
|
||
... | ... | |
function mkdir_deep($destination,$deepDir) {
|
||
$allParts = t3lib_div::trimExplode('/',$deepDir,1);
|
||
$root = '';
|
||
foreach($allParts as $part) {
|
||
foreach($allParts as &$part) {
|
||
$root.= $part.'/';
|
||
if (!is_dir($destination.$root)) {
|
||
t3lib_div::mkdir($destination.$root);
|
||
... | ... | |
// Sort them:
|
||
if ($order) {
|
||
asort($sortarray);
|
||
reset($sortarray);
|
||
$newArr=array();
|
||
while(list($k,$v)=each($sortarray)) {
|
||
foreach ($sortarray as $k => &$v) {
|
||
$newArr[$k]=$filearray[$k];
|
||
}
|
||
$filearray=$newArr;
|
||
... | ... | |
$dirs = t3lib_div::get_dirs($path);
|
||
if (is_array($dirs) && $recursivityLevels>0) {
|
||
foreach ($dirs as $subdirs) {
|
||
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 array The input $fileArr processed.
|
||
*/
|
||
function removePrefixPathFromList($fileArr,$prefixToRemove) {
|
||
foreach($fileArr as $k => $absFileRef) {
|
||
foreach($fileArr as $k => &$absFileRef) {
|
||
if(t3lib_div::isFirstPartOfStr($absFileRef,$prefixToRemove)) {
|
||
$fileArr[$k] = substr($absFileRef,strlen($prefixToRemove));
|
||
} else return 'ERROR: One or more of the files was NOT prefixed with the prefix-path!';
|
||
... | ... | |
$parts = explode('/',$pathStr);
|
||
$output=array();
|
||
$c = 0;
|
||
foreach($parts as $pV) {
|
||
foreach($parts as &$pV) {
|
||
if ($pV=='..') {
|
||
if ($c) {
|
||
array_pop($output);
|
||
... | ... | |
if (is_array($array_in)) {
|
||
$result='<table border="1" cellpadding="1" cellspacing="0" bgcolor="white">';
|
||
if (!count($array_in)) {$result.= '<tr><td><font face="Verdana,Arial" size="1"><b>'.htmlspecialchars("EMPTY!").'</b></font></td></tr>';}
|
||
while (list($key,$val)=each($array_in)) {
|
||
foreach ($array_in as $key => &$val) {
|
||
$result.= '<tr><td valign="top"><font face="Verdana,Arial" size="1">'.htmlspecialchars((string)$key).'</font></td><td>';
|
||
if (is_array($array_in[$key])) {
|
||
$result.=t3lib_div::view_array($array_in[$key]);
|
||
... | ... | |
array_pop($trail);
|
||
$path = array();
|
||
foreach($trail as $dat) {
|
||
foreach($trail as &$dat) {
|
||
$path[] = $dat['class'].$dat['type'].$dat['function'];
|
||
}
|
||
... | ... | |
// Header:
|
||
$tRows[] = '<tr><td colspan="'.count($headerColumns).'" style="background-color:#bbbbbb; font-family: verdana,arial; font-weight: bold; font-size: 10px;"><strong>'.htmlspecialchars($header).'</strong></td></tr>';
|
||
$tCells = array();
|
||
foreach($headerColumns as $key) {
|
||
foreach($headerColumns as &$key) {
|
||
$tCells[] = '
|
||
<td><font face="Verdana,Arial" size="1"><strong>'.htmlspecialchars($key).'</strong></font></td>';
|
||
}
|
||
... | ... | |
</tr>';
|
||
// Rows:
|
||
foreach($rows as $singleRow) {
|
||
foreach($rows as &$singleRow) {
|
||
$tCells = array();
|
||
foreach($headerColumns as $key) {
|
||
foreach($headerColumns as &$key) {
|
||
$tCells[] = '
|
||
<td><font face="Verdana,Arial" size="1">'.(is_array($singleRow[$key]) ? t3lib_div::debugRows($singleRow[$key],'',TRUE) : htmlspecialchars($singleRow[$key])).'</font></td>';
|
||
}
|
||
... | ... | |
$parts = t3lib_div::getIndpEnv('SCRIPT_NAME');
|
||
$params = t3lib_div::_GET();
|
||
foreach($getParams as $k => $v) {
|
||
foreach($getParams as $k => &$v) {
|
||
if (strcmp($v,'')) {
|
||
$params[$k]=$v;
|
||
} else unset($params[$k]);
|
||
... | ... | |
$SN_A = explode('/',strrev(t3lib_div::getIndpEnv('SCRIPT_NAME')));
|
||
$SFN_A = explode('/',strrev($SFN));
|
||
$acc = array();
|
||
while(list($kk,$vv)=each($SN_A)) {
|
||
foreach ($SN_A as $kk => &$vv) {
|
||
if (!strcmp($SFN_A[$kk],$vv)) {
|
||
$acc[] = $vv;
|
||
} else break;
|
||
... | ... | |
REMOTE_HOST,
|
||
HTTP_USER_AGENT,
|
||
HTTP_ACCEPT_LANGUAGE',1);
|
||
reset($envTestVars);
|
||
while(list(,$v)=each($envTestVars)) {
|
||
foreach ($envTestVars as &$v) {
|
||
$out[$v]=t3lib_div::getIndpEnv($v);
|
||
}
|
||
reset($out);
|
||
... | ... | |
$bInfo=array();
|
||
// Which browser?
|
||
if (strstr($useragent,'Konqueror')) {
|
||
if (strpos($useragent,'Konqueror') !== false) {
|
||
$bInfo['BROWSER']= 'konqu';
|
||
} elseif (strstr($useragent,'Opera')) {
|
||
} elseif (strpos($useragent,'Opera') !== false) {
|
||
$bInfo['BROWSER']= 'opera';
|
||
} elseif (preg_match('/MSIE [4567]/', $useragent)) {
|
||
$bInfo['BROWSER']= 'msie';
|
||
} elseif (strstr($useragent,'Mozilla/4') || strstr($useragent,'Mozilla/5')) {
|
||
} elseif (strpos($useragent,'Mozilla/4') !== false || strpos($useragent,'Mozilla/5') !== false) {
|
||
$bInfo['BROWSER']='net';
|
||
}
|
||
if ($bInfo['BROWSER']) {
|
||
... | ... | |
switch($bInfo['BROWSER']) {
|
||
case 'net':
|
||
$bInfo['VERSION']= doubleval(substr($useragent,8));
|
||
if (strstr($useragent,'Netscape6/')) {$bInfo['VERSION'] = doubleval(substr(strstr($useragent,'Netscape6/'),10));} // Will we ever know if this was a typo or intention...?! :-(
|
||
if (strstr($useragent,'Netscape/6')) {$bInfo['VERSION'] = doubleval(substr(strstr($useragent,'Netscape/6'),10));}
|
||
if (strstr($useragent,'Netscape/7')) {$bInfo['VERSION']=doubleval(substr(strstr($useragent,'Netscape/7'),9));}
|
||
if (strpos($useragent,'Netscape6/') !== false) { $bInfo['VERSION'] = doubleval(substr(strstr($useragent,'Netscape6/'),10)); } // Will we ever know if this was a typo or intention...?! :-(
|
||
if (strpos($useragent,'Netscape/6') !== false) { $bInfo['VERSION'] = doubleval(substr(strstr($useragent,'Netscape/6'),10)); }
|
||
if (strpos($useragent,'Netscape/7') !== false) { $bInfo['VERSION'] = doubleval(substr(strstr($useragent,'Netscape/7'),9)); }
|
||
break;
|
||
case 'msie':
|
||
$tmp = strstr($useragent,'MSIE');
|
||
... | ... | |
break;
|
||
}
|
||
// Client system
|
||
if (strstr($useragent,'Win')) {
|
||
if (strpos($useragent,'Win') !== false) {
|
||
$bInfo['SYSTEM'] = 'win';
|
||
} elseif (strstr($useragent,'Mac')) {
|
||
} elseif (strpos($useragent,'Mac') !== false) {
|
||
$bInfo['SYSTEM'] = 'mac';
|
||
} elseif (strstr($useragent,'Linux') || strstr($useragent,'X11') || strstr($useragent,'SGI') || strstr($useragent,' SunOS ') || strstr($useragent,' HP-UX ')) {
|
||
} elseif (strpos($useragent,'Linux') !== false || strpos($useragent,'X11') !== false || strpos($useragent,'SGI') !== false || strpos($useragent,' SunOS ') !== false || strpos($useragent,' HP-UX ') !== false) {
|
||
$bInfo['SYSTEM'] = 'unix';
|
||
}
|
||
}
|
||
... | ... | |
* @todo Possible improvement: Should it rawurldecode the string first to check if any of these characters is encoded ?
|
||
*/
|
||
function validPathStr($theFile) {
|
||
if (!strstr($theFile,'//') && !strstr($theFile,'\\') && !preg_match('#(?:^\.\.|/\.\./)#',$theFile)) return true;
|
||
if (strpos($theFile,'//') === false && strpos($theFile,'\\') === false && !preg_match('#(?:^\.\.|/\.\./)#',$theFile)) {
|
||
return true;
|
||
}
|
||
}
|
||
/**
|
||
... | ... | |
$recCopy_temp=array();
|
||
if ($fields) {
|
||
$fieldArr = t3lib_div::trimExplode(',',$fields,1);
|
||
reset($fieldArr);
|
||
while(list($k,$v)=each($fieldArr)) {
|
||
foreach ($fieldArr as $k => &$v) {
|
||
$recCopy_temp[$k]=$uid_or_record[$v];
|
||
}
|
||
} else {
|
||
... | ... | |
// Make array:
|
||
$pA = array();
|
||
foreach($params as $theP) {
|
||
foreach($params as &$theP) {
|
||
$pKV = explode('=', $theP); // Splitting single param by '=' sign
|
||
if (!t3lib_div::inList('id,type,no_cache,cHash,MP,ftu',$pKV[0]) && !preg_match('/TSFE_ADMIN_PANEL\[.*?\]/',$pKV[0])) {
|
||
$pA[rawurldecode($pKV[0])] = (string)rawurldecode($pKV[1]);
|
||
... | ... | |
// Since the output from this function is probably always cached it is considered insignificant to do this conversion.
|
||
// - kasper
|
||
if (is_array($LOCAL_LANG['default'])) {
|
||
foreach($LOCAL_LANG['default'] as $labelKey => $labelValue) {
|
||
foreach($LOCAL_LANG['default'] as $labelKey => &$labelValue) {
|
||
$LOCAL_LANG['default'][$labelKey] = $csConvObj->utf8_decode($labelValue,'iso-8859-1');
|
||
}
|
||
}
|
||
... | ... | |
// Checking if charset should be converted.
|
||
if (is_array($LOCAL_LANG[$langKey]) && $origCharset!='utf-8') {
|
||
foreach($LOCAL_LANG[$langKey] as $labelKey => $labelValue) {
|
||
foreach($LOCAL_LANG[$langKey] as $labelKey => &$labelValue) {
|
||
$LOCAL_LANG[$langKey][$labelKey] = $csConvObj->utf8_decode($labelValue,$origCharset);
|
||
}
|
||
}
|
||
... | ... | |
// Checking if charset should be converted.
|
||
if (is_array($LOCAL_LANG[$langKey]) && $origCharset!='utf-8') {
|
||
foreach($LOCAL_LANG[$langKey] as $labelKey => $labelValue) {
|
||
foreach($LOCAL_LANG[$langKey] as $labelKey => &$labelValue) {
|
||
$LOCAL_LANG[$langKey][$labelKey] = $csConvObj->utf8_decode($labelValue,$origCharset);
|
||
}
|
||
}
|
||
... | ... | |
function resolveAllSheetsInDS($dataStructArray) {
|
||
if (is_array($dataStructArray['sheets'])) {
|
||
$out=array('sheets'=>array());
|
||
foreach($dataStructArray['sheets'] as $sheetId => $sDat) {
|
||
foreach($dataStructArray['sheets'] as $sheetId => &$sDat) {
|
||
list($ds,$aS) = t3lib_div::resolveSheetDefInDS($dataStructArray,$sheetId);
|
||
if ($sheetId==$aS) {
|
||
$out['sheets'][$aS]=$ds;
|
||
... | ... | |
}
|
||
// Check file-reference prefix; if found, require_once() the file (should be library of code)
|
||
if (strstr($funcName,':')) {
|
||
if (strpos($funcName,':') !== false) {
|
||
list($file,$funcRef) = t3lib_div::revExplode(':',$funcName,2);
|
||
$requireFile = t3lib_div::getFileAbsFileName($file);
|
||
if ($requireFile) t3lib_div::requireOnce($requireFile);
|
||
... | ... | |
} else {
|
||
// Check file-reference prefix; if found, require_once() the file (should be library of code)
|
||
if (strstr($classRef,':')) {
|
||
if (strpos($classRef,':') !== false) {
|
||
list($file,$class) = t3lib_div::revExplode(':',$classRef,2);
|
||
$requireFile = t3lib_div::getFileAbsFileName($file);
|
||
if ($requireFile) t3lib_div::requireOnce($requireFile);
|
||
... | ... | |
$newString = '';
|
||
$theLines = explode(chr(10),$string); // Split lines
|
||
foreach ($theLines as $val) {
|
||
foreach ($theLines as &$val) {
|
||
$newVal = '';
|
||
$theValLen = strlen($val);
|
||
$len = 0;
|
||
for ($index=0; $index < $theValLen; $index++) { // Walk through each character of this line
|
||
$char = substr($val,$index,1);
|
||
$ordVal = ord($char);
|
||
if ($len>($maxlen-4) || ($len>(($maxlen-10)-4)&&$ordVal==32)) {
|
||
if ($len>($maxlen-4) || ($len>(($maxlen-10)-4) && $ordVal==32)) {
|
||
$newVal.='='.$linebreak; // Add a line break
|
||
$len=0; // Reset the length counter
|
||
}
|
||
... | ... | |
*/
|
||
function encodeHeader($line,$enc='quoted-printable',$charset='ISO-8859-1') {
|
||
// Avoid problems if "###" is found in $line (would conflict with the placeholder which is used below)
|
||
if (strstr($line,'###')) return $line;
|
||
if (strpos($line,'###') !== false) {
|
||
return $line;
|
||
}
|
||
// Check if any non-ASCII characters are found - otherwise encoding is not needed
|
||
if (!preg_match('/[^'.chr(32).'-'.chr(127).']/',$line)) return $line;
|
||
if (!preg_match('/[^'.chr(32).'-'.chr(127).']/',$line)) {
|
||
return $line;
|
||
}
|
||
// Wrap email addresses in a special marker
|
||
$line = preg_replace('/([^ ]+@[^ ]+)/', '###$1###', $line);
|
||
$matches = preg_split('/(.?###.+###.?|\(|\))/', $line, -1, PREG_SPLIT_NO_EMPTY);
|
||
foreach ($matches as $part) {
|
||
foreach ($matches as &$part) {
|
||
$oldPart = $part;
|
||
switch ((string)$enc) {
|
||
case 'base64':
|
||
... | ... | |
// Substitute URLs with shorter links:
|
||
foreach (array('http','https') as $protocol) {
|
||
$urlSplit = explode($protocol.'://',$message);
|
||
reset($urlSplit);
|
||
while (list($c,$v) = each($urlSplit)) {
|
||
foreach ($urlSplit as $c => &$v) {
|
||
if ($c) {
|
||
$newParts = preg_split('/\s|[<>"{}|\\\^`()\']/', $v, 2);
|
||
$newURL = $protocol.'://'.$newParts[0];
|
||
... | ... | |
if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLog'])) {
|
||
$params = array('initLog'=>TRUE);
|
||
$fakeThis = FALSE;
|
||
foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLog'] as $hookMethod) {
|
||
foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLog'] as &$hookMethod) {
|
||
t3lib_div::callUserFunction($hookMethod,$params,$fakeThis);
|
||
}
|
||
}
|
||
... | ... | |
if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLog'])) {
|
||
$params = array('msg'=>$msg, 'extKey'=>$extKey, 'backTrace'=>debug_backtrace());
|
||
$fakeThis = FALSE;
|
||
foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLog'] as $hookMethod) {
|
||
foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLog'] as &$hookMethod) {
|
||
t3lib_div::callUserFunction($hookMethod,$params,$fakeThis);
|
||
}
|
||
}
|
||
... | ... | |
if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_div.php']['devLog'])) {
|
||
$params = array('msg'=>$msg, 'extKey'=>$extKey, 'severity'=>$severity, 'dataVar'=>$dataVar);
|
||
$fakeThis = FALSE;
|
||
foreach($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_div.php']['devLog'] as $hookMethod) {
|
||
foreach($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_div.php']['devLog'] as &$hookMethod) {
|
||
t3lib_div::callUserFunction($hookMethod,$params,$fakeThis);
|
||
}
|
||
}
|
||
... | ... | |
$valueList = t3lib_div::trimExplode(',', $valueList, 1);
|
||
}
|
||
$valListCnt = count($valueList);
|
||
foreach ($arr as $key => $value) {
|
||
foreach ($arr as $key => &$value) {
|
||
if (!$valListCnt || in_array($key, $valueList)) {
|
||
$str .= (string)$key.trim(': '.t3lib_div::fixed_lgd(str_replace("\n",'|',(string)$value), $valueLength)).'; ';
|
||
}
|
||
... | ... | |
$paramsArr = explode(' ', trim($parameters));
|
||
$quoteActive = -1; // Whenever a quote character (") is found, $quoteActive is set to the element number inside of $params. A value of -1 means that there are not open quotes at the current position.
|
||
foreach($paramsArr as $k=>$v) {
|
||
foreach($paramsArr as $k => &$v) {
|
||
if($quoteActive > -1) {
|
||
$paramsArr[$quoteActive] .= ' '.$v;
|
||
unset($paramsArr[$k]);
|
||
... | ... | |
}
|
||
if($unQuote) {
|
||
foreach($paramsArr as $key=>$val) {
|
||
foreach($paramsArr as $key => &$val) {
|
||
$paramsArr[$key]=preg_replace('/(^"|"$)/','',$val);
|
||
}
|
||
}
|
||
... | ... | |
}
|
||
return '\''.$value.'\'';
|
||
}
|
||
}
|
||
?>
|
||
?>
|