Project

General

Profile

Bug #22194 » 13670-whilelist-foreach.patch

Administrator Admin, 2010-02-26 00:40

View differences:

t3lib/class.t3lib_admin.php (Arbeitskopie)
*/
function lostRecords($pid_list) {
global $TCA;
reset($TCA);
$this->lostPagesList='';
if ($pid_list) {
while (list($table)=each($TCA)) {
foreach($TCA as $table => $tableConf) {
t3lib_div::loadTCA($table);
$pid_list_tmp = $pid_list;
......
*/
function countRecords($pid_list) {
global $TCA;
reset($TCA);
$list=Array();
$list_n=Array();
if ($pid_list) {
while (list($table)=each($TCA)) {
foreach($TCA as $table => $tableConf) {
t3lib_div::loadTCA($table);
$pid_list_tmp = $pid_list;
......
*/
function getGroupFields($mode) {
global $TCA;
reset ($TCA);
$result = Array();
while (list($table)=each($TCA)) {
foreach($TCA as $table => $tableConf) {
t3lib_div::loadTCA($table);
$cols = $TCA[$table]['columns'];
reset ($cols);
while (list($field,$config)=each($cols)) {
foreach($cols as $field => $config) {
if ($config['config']['type']=='group') {
if (
((!$mode||$mode=='file') && $config['config']['internal_type']=='file') ||
......
*/
function getFileFields($uploadfolder) {
global $TCA;
reset ($TCA);
$result = Array();
while (list($table)=each($TCA)) {
foreach($TCA as $table => $tableConf) {
t3lib_div::loadTCA($table);
$cols = $TCA[$table]['columns'];
reset ($cols);
while (list($field,$config)=each($cols)) {
foreach($cols as $field => $config) {
if ($config['config']['type']=='group' && $config['config']['internal_type']=='file' && $config['config']['uploadfolder']==$uploadfolder) {
$result[]=Array($table,$field);
}
......
global $TCA;
$result = Array();
reset ($TCA);
while (list($table)=each($TCA)) {
foreach($TCA as $table => $tableConf) {
t3lib_div::loadTCA($table);
$cols = $TCA[$table]['columns'];
reset ($cols);
while (list($field,$config)=each($cols)) {
foreach($cols as $field => $config) {
if ($config['config']['type']=='group' && $config['config']['internal_type']=='db') {
if (trim($config['config']['allowed'])=='*' || strstr($config['config']['allowed'],$theSearchTable)) {
$result[]=Array($table,$field);
......
function selectNonEmptyRecordsWithFkeys($fkey_arrays) {
global $TCA;
if (is_array($fkey_arrays)) {
reset($fkey_arrays);
while (list($table,$field_list)=each($fkey_arrays)) {
foreach($fkey_arrays as $table => $field_list) {
if ($TCA[$table] && trim($field_list)) {
t3lib_div::loadTCA($table);
$fieldArr = explode(',',$field_list);
......
list(,$field)=each($fieldArr);
$cl_fl = ($GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'],$table) == 'I' || $GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'],$table) == 'N' || $GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'],$table) == 'R') ?
$field.'!=0' : $field.'!=\'\'';
while (list(,$field)=each($fieldArr)) {
foreach($fieldArr as $field) {
$cl_fl .= ($GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'],$table) == 'I' || $GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'],$table) == 'N' || $GLOBALS['TYPO3_DB']->MetaType($fields[$field]['type'],$table) == 'R') ?
' OR '.$field.'!=0' : ' OR '.$field.'!=\'\'';
}
......
$mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,'.$field_list, $table, $cl_fl);
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($mres)) {
reset($fieldArr);
while (list(,$field)=each($fieldArr)) {
foreach($fieldArr as $field) {
if (trim($row[$field])) {
$fieldConf = $TCA[$table]['columns'][$field]['config'];
if ($fieldConf['type']=='group') {
......
$tempArr=array();
$dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
$dbAnalysis->start('','files',$fieldConf['MM'],$row['uid']);
reset($dbAnalysis->itemArray);
while (list($somekey,$someval)=each($dbAnalysis->itemArray)) {
foreach ($dbAnalysis->itemArray as $somekey => $someval) {
if ($someval['id']) {
$tempArr[]=$someval['id'];
}
......
} else {
$tempArr = explode(',',trim($row[$field]));
}
reset($tempArr);
while (list(,$file)=each($tempArr)) {
foreach($tempArr as $file) {
$file = trim($file);
if ($file) {
$this->checkFileRefs[$fieldConf['uploadfolder']][$file]+=1;
......
// dbs - group
$dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
$dbAnalysis->start($row[$field],$fieldConf['allowed'],$fieldConf['MM'],$row['uid'], $table, $fieldConf);
reset($dbAnalysis->itemArray);
while (list(,$tempArr)=each($dbAnalysis->itemArray)) {
foreach($dbAnalysis->itemArray as $tempArr) {
$this->checkGroupDBRefs[$tempArr['table']][$tempArr['id']]+=1;
}
}
......
// dbs - select
$dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
$dbAnalysis->start($row[$field],$fieldConf['foreign_table'],$fieldConf['MM'],$row['uid'], $table, $fieldConf);
reset($dbAnalysis->itemArray);
while (list(,$tempArr)=each($dbAnalysis->itemArray)) {
foreach($dbAnalysis->itemArray as $tempArr) {
if ($tempArr['id']>0) {
$this->checkGroupDBRefs[$fieldConf['foreign_table']][$tempArr['id']]+=1;
}
......
}
}
}
$GLOBALS['TYPO3_DB']->sql_free_result($mres);
}
}
}
......
}
$this->checkFileRefs = $newCheckFileRefs;
reset($this->checkFileRefs);
while(list($folder,$fileArr)=each($this->checkFileRefs)) {
foreach($this->checkFileRefs as $folder => $fileArr) {
$path = PATH_site.$folder;
if (@is_dir($path)) {
$d = dir($path);
......
global $TCA;
$fileFields = $this->getDBFields($searchTable); // Gets tables / Fields that reference to files...
$theRecordList=Array();
while (list(,$info)=each($fileFields)) {
foreach ($fileFields as $info) {
$table=$info[0]; $field=$info[1];
t3lib_div::loadTCA($table);
$mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
......
}
}
}
$GLOBALS['TYPO3_DB']->sql_free_result($mres);
}
return $theRecordList;
}
t3lib/class.t3lib_formmail.php (Arbeitskopie)
// Runs through $V and generates the mail
if (is_array($V)) {
reset($V);
while (list($key,$val)=each($V)) {
foreach ($V as $key => $val) {
if (!t3lib_div::inList($this->reserved_names,$key)) {
$space = (strlen($val)>60)?chr(10):'';
$val = (is_array($val) ? implode($val,chr(10)) : $val);
t3lib/class.t3lib_stdgraphic.php (Arbeitskopie)
if ($splitstring) {
preg_match('/([^\.]*)$/',$imagefile,$reg);
$splitinfo = explode(' ', $splitstring);
while (list($key,$val) = each($splitinfo)) {
foreach ($splitinfo as $key => $val) {
$temp = '';
if ($val) {$temp = explode('x', $val);}
if (intval($temp[0]) && intval($temp[1])) {
t3lib/class.t3lib_tsparser_ext.php (Arbeitskopie)
$c=0;
$cc=count($this->constants);
reset($this->constants);
while (list(,$str)=each($this->constants)) {
foreach($this->constants as $str) {
$c++;
if ($c==$cc) {
if (strstr($str,$this->edit_divider)) {
......
$HTML='';
$a=0;
reset($arr);
if($alphaSort == '1') {
ksort($arr);
}
$keyArr_num=array();
$keyArr_alpha=array();
while (list($key,)=each($arr)) {
foreach ($arr as $key => $value) {
if (substr($key,-2)!='..') { // Don't do anything with comments / linenumber registrations...
$key=preg_replace('/\.$/','',$key);
if (substr($key,-1)!='.') {
......
}
ksort($keyArr_num);
$keyArr=$keyArr_num+$keyArr_alpha;
reset($keyArr);
$c=count($keyArr);
if ($depth_in) {$depth_in = $depth_in.'.';}
while (list($key,)=each($keyArr)) {
foreach ($keyArr as $key => $value) {
$a++;
$depth=$depth_in.$key;
if ($this->bType!='const' || substr($depth,0,1)!='_') { // this excludes all constants starting with '_' from being shown.
......
$keyArr[$key]=1;
}
}
reset($keyArr);
$c=count($keyArr);
if ($depth_in) { $depth_in = $depth_in.'.'; }
while (list($key,)=each($keyArr)) {
foreach ($keyArr as $key => $value) {
$depth=$depth_in.$key;
$deeper = is_array($arr[$key.'.']);
......
* @return [type] ...
*/
function ext_getTemplateHierarchyArr($arr,$depthData, $keyArray,$first=0) {
reset($arr);
$keyArr=array();
while (list($key,)=each($arr)) {
foreach ($arr as $key => $value) {
$key=preg_replace('/\.$/','',$key);
if (substr($key,-1)!='.') {
$keyArr[$key]=1;
}
}
reset($keyArr);
$a=0;
$c=count($keyArr);
static $i;
while (list($key,)=each($keyArr)) {
foreach ($keyArr as $key => $value) {
$HTML = '';
$a++;
$deeper = is_array($arr[$key . '.']);
......
*/
function ext_outputTS($config, $lineNumbers=0, $comments=0, $crop=0, $syntaxHL=0, $syntaxHLBlockmode=0) {
$all='';
reset($config);
while (list(,$str)=each($config)) {
foreach($config as $str) {
$all .= chr(10) .'[GLOBAL]' . chr(10) . $str;
}
......
$constData['type']='string';
}
$cats = explode(',',$constData['cat']);
reset($cats);
while (list(,$theCat)=each($cats)) { // if = only one category, while allows for many. We have agreed on only one category is the most basic way...
foreach ($cats as $theCat) { // if = only one category, while allows for many. We have agreed on only one category is the most basic way...
$theCat=trim($theCat);
if ($theCat) {
$this->categories[$theCat][$constName]=$constData['subcat'];
t3lib/class.t3lib_tstemplate.php (Arbeitskopie)
function checkFile($name,$menuArr) {
t3lib_div::logDeprecatedFunction();
reset ($menuArr);
while (list($aKey,)=each($menuArr)) {
foreach ($menuArr as $aKey => $value) {
$menuArr[$aKey][$name] = $this->getFileName($menuArr[$aKey][$name]);
}
return $menuArr;
typo3/class.db_list.inc (Arbeitskopie)
$this->pageRecord = t3lib_BEfunc::getRecordWSOL('pages',$this->id);
// Traverse the TCA table array:
reset($TCA);
while (list($tableName)=each($TCA)) {
foreach ($TCA as $tableName => $value) {
// Checking if the table should be rendered:
if ((!$this->table || $tableName==$this->table) && (!$this->tableList || t3lib_div::inList($this->tableList,$tableName)) && $GLOBALS['BE_USER']->check('tables_select',$tableName)) { // Checks that we see only permitted/requested tables:
typo3/class.file_list.inc (Arbeitskopie)
// Folders:
if (count($items['sorting'])) {
reset($items['sorting']);
while (list($key,) = each($items['sorting'])) {
foreach ($items['sorting'] as $key => $value) {
list($flag,$code) = $this->fwd_rwd_nav();
$out.=$code;
if ($flag) {
......
// Files:
if (count($items['sorting'])) {
reset($items['sorting']);
while (list($key,) = each($items['sorting'])) {
foreach ($items['sorting'] as $key => $value) {
list($flag,$code) = $this->fwd_rwd_nav();
$out.=$code;
if ($flag) {
......
$d->close();
}
// Get fileinfo
reset($tempArray);
while (list(,$val)=each($tempArray)) {
foreach ($tempArray as $val) {
$temp = $GLOBALS['SOBE']->basicFF->getTotalFileInfo($val);
$items['files'][] = $temp;
if ($this->sort) {
typo3/mod/tools/em/class.em_xmlhandler.php (Arbeitskopie)
function removeObsolete(&$extensions) {
if($this->useObsolete) return;
reset($extensions);
while (list($version, $data) = each($extensions)) {
foreach ($extensions as $version => $data) {
if($data['state']=='obsolete')
unset($extensions[$version]);
}
......
function checkReviewState(&$extensions) {
if ($this->useUnchecked) return;
reset($extensions);
while (list($version, $data) = each($extensions)) {
foreach ($extensions as $version => $data) {
if($data['reviewstate']<1)
unset($extensions[$version]);
}
typo3/sysext/adodb/adodb/adodb-error.inc.php (Arbeitskopie)
'/Relation [\"\'].*[\"\'] already exists|Cannot insert a duplicate key into (a )?unique index.*|duplicate key violates unique constraint/i'
=> DB_ERROR_ALREADY_EXISTS
);
reset($error_regexps);
while (list($regexp,$code) = each($error_regexps)) {
foreach ($error_regexps as $regexp => $code) {
if (preg_match($regexp, $errormsg)) {
return $code;
}
typo3/sysext/dbal/class.ux_t3lib_db.php (Arbeitskopie)
break;
case 'adodb':
$sqlTables = $this->handlerInstance['_DEFAULT']->MetaTables('TABLES');
while (list($k, $theTable) = each($sqlTables)) {
foreach ($sqlTables as $k => $theTable) {
if (preg_match('/BIN\$/', $theTable)) continue; // skip tables from the Oracle 10 Recycle Bin
$whichTables[$theTable] = $theTable;
}
......
case 'adodb':
$keyRows = $this->handlerInstance[$this->lastHandlerKey]->MetaIndexes($tableName);
if ($keyRows !== FALSE) {
while (list($k, $theKey) = each($keyRows)) {
foreach ($keyRows as $k => $theKey) {
$theKey['Table'] = $tableName;
$theKey['Non_unique'] = (int) !$theKey['unique'];
$theKey['Key_name'] = str_replace($tableName.'_','',$k);
......
// now map multiple fields into multiple rows (we mimic MySQL, remember...)
$keycols = $theKey['columns'];
while (list($c, $theCol) = each($keycols)) {
foreach ($keycols as $c => $theCol) {
$theKey['Seq_in_index'] = $c+1;
$theKey['Column_name'] = $theCol;
$output[] = $theKey;
typo3/sysext/extbase/Classes/Utility/Arrays.php (Arbeitskopie)
*/
static public function integerExplode($delimiter, $string) {
$chunksArr = explode($delimiter, $string);
while (list($key, $value) = each($chunksArr)) {
foreach ($chunksArr as $key => $value) {
$chunks[$key] = intval($value);
}
reset($chunks);
return $chunks;
}
......
* @api
*/
static public function arrayMergeRecursiveOverrule(array $firstArray, array $secondArray, $dontAddNewKeys = FALSE, $emptyValuesOverride = TRUE) {
reset($secondArray);
while (list($key, $value) = each($secondArray)) {
foreach ($secondArray as $key => $value) {
if (array_key_exists($key, $firstArray) && is_array($firstArray[$key])) {
if (is_array($secondArray[$key])) {
$firstArray[$key] = self::arrayMergeRecursiveOverrule($firstArray[$key], $secondArray[$key], $dontAddNewKeys, $emptyValuesOverride);
typo3/sysext/extbase/Classes/Utility/Extension.php (Arbeitskopie)
$returnValue = false;
// Iterate with while since we need the current array position:
while (list(,$token) = each($tokenList)) {
foreach ($tokenList as $token) {
// parse token (see http://www.php.net/manual/en/function.token-get-all.php for format of token list)
if (is_array($token)) {
list($id, $text) = $token;
typo3/sysext/rtehtmlarea/mod3/class.tx_rtehtmlarea_dam_browse_links.php (Arbeitskopie)
}
}
}
reset($anchorTypes);
while (list(, $anchorType) = each($anchorTypes) ) {
foreach ($anchorTypes as $anchorType) {
reset($classesAnchorArray);
while(list(,$class)=each($classesAnchorArray)) {
if (!in_array($class, $classesAnchor['all']) || (in_array($class, $classesAnchor['all']) && is_array($classesAnchor[$anchorType]) && in_array($class, $classesAnchor[$anchorType]))) {
(1-1/8)