Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.111 diff -u -F^f -r1.111 bootstrap.inc --- includes/bootstrap.inc 7 Aug 2006 15:04:13 -0000 1.111 +++ includes/bootstrap.inc 11 Aug 2006 16:40:22 -0000 @@ -139,7 +139,7 @@ function conf_path() { function drupal_unset_globals() { if (ini_get('register_globals')) { $allowed = array('_ENV' => 1, '_GET' => 1, '_POST' => 1, '_COOKIE' => 1, '_FILES' => 1, '_SERVER' => 1, '_REQUEST' => 1, 'access_check' => 1, 'GLOBALS' => 1); - foreach ($GLOBALS as $key => $value) { + while (list($key, $value) = each($GLOBALS)) { if (!isset($allowed[$key])) { unset($GLOBALS[$key]); } @@ -219,8 +219,8 @@ function drupal_get_filename($type, $nam $config = conf_path(); $dir = (($type == 'theme_engine') ? 'themes/engines' : "${type}s"); $file = (($type == 'theme_engine') ? "$name.engine" : "$name.$type"); - - foreach (array("$config/$dir/$file", "$config/$dir/$name/$file", "$dir/$file", "$dir/$name/$file") as $file) { + $dirs = array("$config/$dir/$file", "$config/$dir/$name/$file", "$dir/$file", "$dir/$name/$file"); + while (list($file) = each($dirs)) { if (file_exists($file)) { $files[$type][$name] = $file; break; @@ -251,7 +251,7 @@ function variable_init($conf = array()) cache_set('variables', serialize($variables)); } - foreach ($conf as $name => $value) { + while (list($name, $value) = each($conf)) { $variables[$name] = $value; } @@ -342,7 +342,8 @@ function page_get_cache() { * The name of the bootstrap hook we wish to invoke. */ function bootstrap_invoke_all($hook) { - foreach (module_list(TRUE, TRUE) as $module) { + $module_list = module_list(TRUE, TRUE); + while (list($module) = each($module_list)) { drupal_load('module', $module); module_invoke($module, $hook); } @@ -439,7 +440,7 @@ function drupal_page_header() { // another so PHP's header() function can deal with duplicate // headers. $headers = explode("\n", $cache->headers); - foreach ($headers as $header) { + while (list($header) = each($headers)) { header($header); } @@ -473,7 +474,7 @@ function bootstrap_hooks() { */ function drupal_unpack($obj, $field = 'data') { if ($obj->$field && $data = unserialize($obj->$field)) { - foreach ($data as $key => $value) { + while (list($key, $value) = each($data)) { if (!isset($obj->$key)) { $obj->$key = $value; } Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.554 diff -u -F^f -r1.554 common.inc --- includes/common.inc 10 Aug 2006 15:42:32 -0000 1.554 +++ includes/common.inc 11 Aug 2006 16:40:23 -0000 @@ -59,7 +59,8 @@ function drupal_get_content($region = NU } } else { - foreach (array_keys($content) as $region) { + $content_keys = array_keys($content); + while (list($region) = each($content_keys)) { if (is_array($content[$region])) { $content[$region] = implode($delimiter, $content[$region]); } @@ -172,7 +173,7 @@ function drupal_get_headers() { function drupal_query_string_encode($query, $exclude = array(), $parent = '') { $params = array(); - foreach ($query as $key => $value) { + while (list($key, $value) = each($query)) { $key = drupal_urlencode($key); if ($parent) { $key = $parent .'['. $key .']'; @@ -403,7 +404,7 @@ function drupal_http_request($url, $head 'Content-Length' => 'Content-Length: '. strlen($data) ); - foreach ($headers as $header => $value) { + while (list($header, $value) = each($headers)) { $defaults[$header] = $header .': '. $value; } @@ -743,7 +744,7 @@ function format_rss_item($title, $link, * with the same format as $array itself for nesting. */ function format_xml_elements($array) { - foreach ($array as $key => $value) { + while (list($key, $value) = each($array)) { if (is_numeric($key)) { if ($value['key']) { $output .= ' <'. $value['key']; @@ -838,7 +839,7 @@ function format_size($size) { function format_interval($timestamp, $granularity = 2) { $units = array('1 year|%count years' => 31536000, '1 week|%count weeks' => 604800, '1 day|%count days' => 86400, '1 hour|%count hours' => 3600, '1 min|%count min' => 60, '1 sec|%count sec' => 1); $output = ''; - foreach ($units as $key => $value) { + while (list($key, $value) = each($units)) { $key = explode('|', $key); if ($timestamp >= $value) { $output .= ($output ? ' ' : '') . format_plural(floor($timestamp / $value), $key[0], $key[1]); @@ -1041,7 +1042,7 @@ function url($path = NULL, $query = NULL function drupal_attributes($attributes = array()) { if (is_array($attributes)) { $t = ''; - foreach ($attributes as $key => $value) { + while (list($key, $value) = each($attributes)) { $t .= " $key=".'"'. check_plain($value) .'"'; } return $t; @@ -1127,14 +1128,14 @@ function drupal_page_footer() { function drupal_map_assoc($array, $function = NULL) { if (!isset($function)) { $result = array(); - foreach ($array as $value) { + while (list($value) = each($array)) { $result[$value] = $value; } return $result; } elseif (function_exists($function)) { $result = array(); - foreach ($array as $value) { + while (list($value) = each($array)) { $result[$value] = $function($value); } return $result; @@ -1241,9 +1242,9 @@ function drupal_get_css($css = NULL) { $css = drupal_add_css(); } - foreach ($css as $type) { - foreach ($type as $file) { - $output .= '\n"; + while (list($type, $paths) = each($css)) { + while (list($path, $data) = each($paths)) { + $output .= '\n"; } } @@ -1285,7 +1286,7 @@ function drupal_call_js($function) { $arguments = func_get_args(); array_shift($arguments); $args = array(); - foreach ($arguments as $arg) { + while (list($arg) = each($arguments)) { $args[] = drupal_to_js($arg); } $output = ''; @@ -1312,7 +1313,7 @@ function drupal_to_js($var) { case 'array': if (array_keys($var) === range(0, sizeof($var) - 1)) { $output = array(); - foreach ($var as $v) { + while (list($v) = each($var)) { $output[] = drupal_to_js($v); } return '[ '. implode(', ', $output) .' ]'; @@ -1320,7 +1321,7 @@ function drupal_to_js($var) { // Fall through case 'object': $output = array(); - foreach ($var as $k => $v) { + while (list($k, $v) = each($var)) { $output[] = drupal_to_js(strval($k)) .': '. drupal_to_js($v); } return '{ '. implode(', ', $output) .' }'; @@ -1497,7 +1498,8 @@ function drupal_mail($mailkey, $to, $sub } $headers = array_merge($defaults, $headers); // Custom hook traversal to allow pass by reference - foreach (module_implements('mail_alter') AS $module) { + $modules = module_implements('mail_alter'); + while (list($module) = each($modules)) { $function = $module .'_mail_alter'; $function($mailkey, $to, $subject, $body, $from, $headers); } @@ -1528,7 +1530,7 @@ function drupal_mail($mailkey, $to, $sub ** */ $mimeheaders = array(); - foreach ($headers as $name => $value) { + while (list($name, $value) = each($headers)) { $mimeheaders[] = $name .': '. mime_header_encode($value); } return mail( @@ -1612,8 +1614,8 @@ function drupal_render(&$elements) { } /* render each of the children using drupal_render and concatenate them */ if (!isset($content) || $content === '') { - foreach ($children as $key) { - $content .= drupal_render($elements[$key]); + while (list($key, $value) = each($children)) { + $content .= drupal_render($elements[$value]); } } } @@ -1633,7 +1635,7 @@ function drupal_render(&$elements) { $content = $prefix . $content . $suffix; if (isset($elements['#after_render'])) { - foreach ($elements['#after_render'] as $function) { + while (list($function) = each($elements['#after_render'])) { $function($elements, $content); } } Index: includes/database.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database.inc,v retrieving revision 1.57 diff -u -F^f -r1.57 database.inc --- includes/database.inc 5 Jul 2006 11:45:51 -0000 1.57 +++ includes/database.inc 11 Aug 2006 16:40:23 -0000 @@ -63,13 +63,13 @@ function db_prefix_tables($sql) { if (array_key_exists('default', $db_prefix)) { $tmp = $db_prefix; unset($tmp['default']); - foreach ($tmp as $key => $val) { + while (list($key, $val) = each($tmp)) { $sql = strtr($sql, array('{'. $key. '}' => $val. $key)); } return strtr($sql, array('{' => $db_prefix['default'], '}' => '')); } else { - foreach ($db_prefix as $key => $val) { + while (list($key, $val) = each($db_prefix)) { $sql = strtr($sql, array('{'. $key. '}' => $val. $key)); } return strtr($sql, array('{' => '', '}' => '')); @@ -235,7 +235,8 @@ function _db_rewrite_sql($query = '', $p $where = array(); $join = array(); $distinct = FALSE; - foreach (module_implements('db_rewrite_sql') as $module) { + $modules = module_implements('db_rewrite_sql'); + while (list($module) = each($modules)) { $result = module_invoke($module, 'db_rewrite_sql', $query, $primary_table, $primary_field, $args); if (isset($result) && is_array($result)) { if (isset($result['where'])) { Index: includes/file.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/file.inc,v retrieving revision 1.80 diff -u -F^f -r1.80 file.inc --- includes/file.inc 6 Aug 2006 22:49:27 -0000 1.80 +++ includes/file.inc 11 Aug 2006 16:40:23 -0000 @@ -547,7 +547,7 @@ function file_save_data($data, $dest, $r function file_transfer($source, $headers) { ob_end_clean(); - foreach ($headers as $header) { + while (list($header) = each($headers)) { // To prevent HTTP header injection, we delete new lines that are // not followed by a space or a tab. // See http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 @@ -689,7 +689,7 @@ function file_directory_temp() { $path_delimiter = '/'; } - foreach ($directories as $directory) { + while (list($directory) = each($directories)) { if (!$temporary_directory && is_dir($directory)) { $temporary_directory = $directory; } Index: includes/form.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/form.inc,v retrieving revision 1.133 diff -u -F^f -r1.133 form.inc --- includes/form.inc 10 Aug 2006 15:42:32 -0000 1.133 +++ includes/form.inc 11 Aug 2006 16:40:24 -0000 @@ -121,7 +121,8 @@ function drupal_build_form($form_id, &$f } } - foreach (module_implements('form_alter') as $module) { + $modules = module_implements('form_alter'); + while (list($key, $module) = each($modules)) { $function = $module .'_form_alter'; $function($form_id, $form); } @@ -187,7 +188,7 @@ function drupal_submit_form($form_id, $f $default_args = array($form_id, &$form_values); if (isset($form['#submit'])) { - foreach ($form['#submit'] as $function => $args) { + while (list($function, $args) = each($form['#submit'])) { if (function_exists($function)) { $args = array_merge($default_args, (array) $args); // Since we can only redirect to one page, only the last redirect will work @@ -228,7 +229,7 @@ function drupal_render_form($form_id, &$ } if (isset($form['#pre_render'])) { - foreach ($form['#pre_render'] as $function) { + while (list($function) = each($form['#pre_render'])) { if (function_exists($function)) { $function($form_id, $form); } @@ -271,9 +272,10 @@ function drupal_redirect_form($form, $re function _form_validate($elements, $form_id = NULL) { // Recurse through all children. - foreach (element_children($elements) as $key) { - if (isset($elements[$key]) && $elements[$key]) { - _form_validate($elements[$key]); + $element_children = element_children($elements); + while (list($key, $name) = each($element_children)) { + if (isset($elements[$name]) && $elements[$name]) { + _form_validate($elements[$name]); } } /* Validate the current input */ @@ -296,7 +298,7 @@ function _form_validate($elements, $form } if (is_array($elements['#value'])) { $value = $elements['#type'] == 'checkboxes' ? array_keys(array_filter($elements['#value'])) : $elements['#value']; - foreach ($value as $v) { + while (list($k, $v) = each($value)) { if (!isset($options[$v])) { form_error($elements, t('An illegal choice has been detected. Please contact the site administrator.')); watchdog('form', t('Illegal choice %choice in %name element.', array('%choice' => theme('placeholder', check_plain($v)), '%name' => theme_placeholder(empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title']))), WATCHDOG_ERROR); @@ -410,7 +412,7 @@ function form_builder($form_id, $form) { $posted = (isset($_POST['edit']) && ($_POST['edit']['form_id'] == $form_id)); $edit = $posted ? $_POST['edit'] : array(); - foreach ($form['#parents'] as $parent) { + while (list($key, $parent) = each($form['#parents'])) { $edit = isset($edit[$parent]) ? $edit[$parent] : NULL; } if (!isset($form['#value']) && !array_key_exists('#value', $form)) { @@ -489,7 +491,8 @@ function form_builder($form_id, $form) { // Recurse through all child elements. $count = 0; - foreach (element_children($form) as $key) { + $element_children = element_children($form); + while (list($pos, $key) = each($element_children)) { // don't squash an existing tree value if (!isset($form[$key]['#tree'])) { $form[$key]['#tree'] = $form['#tree']; @@ -510,7 +513,7 @@ function form_builder($form_id, $form) { } if (isset($form['#after_build']) && !isset($form['#after_build_done'])) { - foreach ($form['#after_build'] as $function) { + while (list($key, $function) = each($form['#after_build'])) { if (function_exists($function)) { $form = $function($form, $form_values); } @@ -575,7 +578,8 @@ function _element_info($type, $refresh = ); if (!isset($cache) || $refresh) { $cache = array(); - foreach (module_implements('elements') as $module) { + $modules = module_implements('elements'); + while (list($key, $module) = each($modules)) { $elements = module_invoke($module, 'elements'); if (isset($elements) && is_array($elements)) { $cache = array_merge_recursive($cache, $elements); @@ -598,7 +602,7 @@ function form_options_flatten($array, $r $return = array(); } - foreach ($array as $key => $value) { + while (list($key, $value) = each($array)) { if (is_array($value)) { form_options_flatten($value, FALSE); } @@ -640,7 +644,7 @@ function form_select_options($element, $ $value_valid = isset($element['#value']) || array_key_exists('#value', $element); $value_is_array = is_array($element['#value']); $options = ''; - foreach ($choices as $key => $choice) { + while (list($key, $choice) = each($choices)) { if (is_array($choice)) { $options .= ''; $options .= form_select_options($element, $choice); @@ -818,7 +822,7 @@ function expand_date($element) { $order = array_keys($sort); // Output multi-selector for date - foreach ($order as $type) { + while (list($key, $type) = each($order)) { switch ($type) { case 'day': $options = drupal_map_assoc(range(1, 31)); @@ -864,7 +868,8 @@ function map_month($month) { */ function checkboxes_value(&$form) { $value = array(); - foreach ((array)$form['#default_value'] as $key) { + $default_value = (array)$form['#default_value']; + while (list($pos, $key) = each($default_value)) { $value[$key] = 1; } $form['#value'] = $value; @@ -888,7 +893,7 @@ function weight_value(&$form) { */ function expand_radios($element) { if (count($element['#options']) > 0) { - foreach ($element['#options'] as $key => $choice) { + while (list($key, $choice) = each($element['#options'])) { if (!isset($element[$key])) { $element[$key] = array('#type' => 'radio', '#title' => $choice, '#return_value' => $key, '#default_value' => $element['#default_value'], '#attributes' => $element['#attributes'], '#parents' => $element['#parents'], '#spawned' => TRUE); } @@ -962,7 +967,7 @@ function expand_checkboxes($element) { if (!isset($element['#default_value']) || $element['#default_value'] == 0) { $element['#default_value'] = array(); } - foreach ($element['#options'] as $key => $choice) { + while (list($key, $choice) = each($element['#options'])) { if (!isset($element[$key])) { $element[$key] = array('#type' => 'checkbox', '#processed' => TRUE, '#title' => $choice, '#return_value' => $key, '#default_value' => isset($value[$key]), '#attributes' => $element['#attributes']); } Index: includes/image.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/image.inc,v retrieving revision 1.13 diff -u -F^f -r1.13 image.inc --- includes/image.inc 5 Jul 2006 11:45:51 -0000 1.13 +++ includes/image.inc 11 Aug 2006 16:40:24 -0000 @@ -10,7 +10,7 @@ function image_get_available_toolkits() $toolkits = file_scan_directory('includes', 'image\..*\.inc$'); $output = array(); - foreach ($toolkits as $file => $toolkit) { + while (list($file, $toolkit) = each($toolkits)) { include_once "./$file"; $function = str_replace('.', '_', $toolkit->name) .'_info'; if (function_exists($function)) { Index: includes/install.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/install.inc,v retrieving revision 1.13 diff -u -F^f -r1.13 install.inc --- includes/install.inc 8 Aug 2006 21:18:02 -0000 1.13 +++ includes/install.inc 11 Aug 2006 16:40:24 -0000 @@ -23,7 +23,8 @@ * Initialize the update system by loading all installed module's .install files. */ function drupal_load_updates() { - foreach (module_list() as $module) { + $modules = module_list(); + while (list($key, $module) = each($modules)) { module_load_install($module); } } @@ -39,7 +40,7 @@ function drupal_load_updates() { */ function drupal_get_schema_versions($module) { $functions = get_defined_functions(); - foreach ($functions['user'] as $function) { + while (list($key, $function) = each($functions['user'])) { if (strpos($function, $module .'_update_') === 0) { $version = substr($function, strlen($module .'_update_')); if (is_numeric($version)) { @@ -144,7 +145,8 @@ function drupal_detect_baseurl($file = ' function drupal_detect_database_types() { $databases = array(); - foreach (array('mysql', 'mysqli', 'pgsql') as $type) { + $types = array('mysql', 'mysqli', 'pgsql'); + while (list($key, $type) = each($types)) { if (file_exists('./includes/install.'. $type .'.inc')) { include_once './includes/install.'. $type .'.inc'; $function = $type .'_is_available'; @@ -169,7 +171,7 @@ function drupal_rewrite_settings($settin // Build list of setting names and insert the values into the global namespace. $keys = array(); - foreach ($settings as $setting => $data) { + while (list($setting, $data) = each($settings)) { $GLOBALS[$setting] = $data['value']; $keys[] = $setting; } @@ -218,7 +220,7 @@ function drupal_rewrite_settings($settin fclose($fp); // Add required settings that were missing from settings.php. - foreach ($settings as $setting => $data) { + while (list($setting, $data) = each($settings)) { if ($data['required']) { $buffer .= "\$$setting = '". $data['value'] ."';\n"; } @@ -242,7 +244,7 @@ function drupal_rewrite_settings($settin */ function drupal_get_install_files($module_list = array()) { $installs = array(); - foreach ($module_list as $module) { + while (list($key, $module) = each($module_list)) { $installs = array_merge($installs, file_scan_directory('./modules', "^$module.install$", array('.', '..', 'CVS'), 0, TRUE, 'name', 0)); } return $installs; @@ -273,7 +275,7 @@ function drupal_verify_profile($profile) // Verify that all required modules exist. $modules_present = TRUE; - foreach ($module_list as $module) { + while (list($key, $module) = each($module_list)) { $module_path = dirname(drupal_get_filename('module', $module, NULL, FALSE)); if (!$module_path) { drupal_set_message(st('The %module module is required but was not found. Please move it into the modules subdirectory.', array('%module' => $module)), 'error'); @@ -327,7 +329,7 @@ function drupal_install_profile($profile * The modules to install. */ function drupal_install_modules($module_list = array()) { - foreach ($module_list as $module) { + while (list($key, $module) = each($module_list)) { drupal_install_module($module); } } Index: includes/locale.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/locale.inc,v retrieving revision 1.85 diff -u -F^f -r1.85 locale.inc --- includes/locale.inc 10 Aug 2006 15:42:32 -0000 1.85 +++ includes/locale.inc 11 Aug 2006 16:40:25 -0000 @@ -40,7 +40,7 @@ function _locale_admin_manage_screen() { $options = array(); $form['name'] = array('#tree' => TRUE); - foreach ($languages['name'] as $key => $lang) { + while (list($key, $lang) = each($languages['name'])) { $options[$key] = ''; $status = db_fetch_object(db_query("SELECT isdefault, enabled FROM {locales_meta} WHERE locale = '%s'", $key)); if ($status->enabled) { @@ -83,7 +83,7 @@ function _locale_admin_manage_screen() { * Theme the locale admin manager form. */ function theme_locale_admin_manage_screen($form) { - foreach ($form['name'] as $key => $element) { + while (list($key, $element) = each($form['name'])) { // Do not take form control structures. if (is_array($element) && element_child($key)) { $rows[] = array(check_plain($key), drupal_render($form['name'][$key]), drupal_render($form['enabled'][$key]), drupal_render($form['site_default'][$key]), ($key != 'en' ? drupal_render($form['translation'][$key]) : t('n/a')), ($key != 'en' ? l(t('delete'), 'admin/settings/locale/language/delete/'. $key) : '')); @@ -102,7 +102,7 @@ function theme_locale_admin_manage_scree function _locale_admin_manage_screen_submit($form_id, $form_values) { // Save changes to existing languages. $languages = locale_supported_languages(FALSE, TRUE); - foreach($languages['name'] as $key => $value) { + while(list($key, $value) = each($languages['name'])) { if ($form_values['site_default'] == $key) { $form_values['enabled'][$key] = 1; // autoenable the default language } @@ -387,7 +387,7 @@ function _locale_string_edit($lid) { '#weight' => -1, ); - foreach ($languages['name'] as $key => $lang) { + while (list($key, $lang) = each($languages['name'])) { $form['translations'][$key] = array( '#type' => 'textarea', '#title' => $lang, @@ -407,7 +407,7 @@ function _locale_string_edit($lid) { */ function _locale_string_edit_submit($form_id, $form_values) { $lid = $form_values['lid']; - foreach ($form_values['translations'] as $key => $value) { + while (list($key, $value) = each($form_values['translations'])) { $value = filter_xss_admin($value); $trans = db_fetch_object(db_query("SELECT translation FROM {locales_target} WHERE lid = %d AND locale = '%s'", $lid, $key)); if (isset($trans->translation)) { @@ -664,7 +664,7 @@ function _locale_import_one_string($valu } $translation = array_map('_locale_import_append_plural', $value['msgstr'], $entries); $english = array_map('_locale_import_append_plural', $english, $entries); - foreach ($translation as $key => $trans) { + while (list($key, $trans) = each($translation)) { if ($key == 0) { $plid = 0; } @@ -753,7 +753,7 @@ function _locale_import_parse_header($he $hdr = array(); $lines = explode("\n", $header); - foreach ($lines as $line) { + while (list($key, $line) = each($lines)) { $line = trim($line); if ($line) { list($tag, $contents) = explode(":", $line, 2); @@ -827,7 +827,7 @@ function _locale_import_parse_arithmetic $opstk = array(); $elstk = array(); - foreach ($tokens as $token) { + while (list($key, $token) = each($tokens)) { $ctok = $token; // Numbers and the $n variable are simply pushed into $elarr @@ -1113,7 +1113,7 @@ function _locale_export_po($language) { print $header; - foreach ($parent as $lid => $message) { + while (list($lid, $message) = each($parent)) { if (!isset($done[$lid])) { if ($message['comment']) { print '#: '. $message['comment'] ."\n"; @@ -1222,7 +1222,7 @@ function _locale_string_language_list($t $languages = locale_supported_languages(FALSE, TRUE); unset($languages['name']['en']); $output = ''; - foreach ($languages['name'] as $key => $value) { + while (list($key, $value) = each($languages['name'])) { if (isset($translation[$key])) { $output .= ($translation[$key] != '') ? $key .' ' : "$key "; } @@ -1241,14 +1241,14 @@ function _locale_string_seek_query() { $fields = array('string', 'language', 'searchin'); $query = new StdClass; if (is_array($_REQUEST['edit'])) { - foreach ($_REQUEST['edit'] as $key => $value) { + while (list($key, $value) = each($_REQUEST['edit'])) { if (!empty($value) && in_array($key, $fields)) { $query->$key = $value; } } } else { - foreach ($_REQUEST as $key => $value) { + while (list($key, $value) = each($_REQUEST)) { if (!empty($value) && in_array($key, $fields)) { $query->$key = strpos(',', $value) ? explode(',', $value) : $value; } @@ -1313,13 +1313,13 @@ function _locale_string_seek() { $arr[$locale->lid]['location'] = $locale->location; $arr[$locale->lid]['source'] = $locale->source; } - foreach ($arr as $lid => $value) { + while (list($lid, $value) = each($arr)) { $rows[] = array(array('data' => check_plain(truncate_utf8($value['source'], 150, FALSE, TRUE)) .'
'. $value['location'] .''), array('data' => _locale_string_language_list($value['locales']), 'align' => 'center'), array('data' => l(t('edit'), "admin/settings/locale/string/edit/$lid"), 'class' => 'nowrap'), array('data' => l(t('delete'), "admin/settings/locale/string/delete/$lid"), 'class' => 'nowrap')); } $request = array(); if (count($query)) { - foreach ($query as $key => $value) { + while (list($key, $value) = each($query)) { $request[$key] = (is_array($value)) ? implode(',', $value) : $value; } } @@ -1344,7 +1344,7 @@ function _locale_string_seek() { function _locale_prepare_iso_list() { $languages = locale_supported_languages(FALSE, TRUE); $isocodes = _locale_get_iso639_list(); - foreach ($isocodes as $key => $value) { + while (list($key, $value) = each($isocodes)) { if (isset($languages['name'][$key])) { unset($isocodes[$key]); continue; Index: includes/menu.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/menu.inc,v retrieving revision 1.132 diff -u -F^f -r1.132 menu.inc --- includes/menu.inc 31 Jul 2006 11:25:52 -0000 1.132 +++ includes/menu.inc 11 Aug 2006 16:40:26 -0000 @@ -297,7 +297,7 @@ function menu_get_root_menus() { $menu = menu_get_menu(); $root_menus = array(); - foreach ($menu['items'][0]['children'] as $mid) { + while (list($key, $mid) = each($menu['items'][0]['children'])) { $root_menus[$mid] = $menu['items'][$mid]['title']; } @@ -332,7 +332,8 @@ function menu_set_location($location) { // position in the menu tree. $location[count($location) - 1]['path'] = $_GET['q']; - foreach (array_reverse($location) as $item) { + $reverse_location = array_reverse($location); + while (list($key, $item) = each($reverse_location)) { if (isset($_menu['path index'][$item['path']])) { $mid = $_menu['path index'][$item['path']]; if (isset($_menu['visible'][$mid])) { @@ -507,7 +508,8 @@ function menu_get_active_help() { return; } - foreach (module_list() as $name) { + $modules = module_list(); + while (list($key, $name) = each($modules)) { if (module_hook($name, 'help')) { if ($temp = module_invoke($name, 'help', $path)) { $output .= $temp . "\n"; @@ -537,7 +539,7 @@ function menu_get_active_breadcrumb() { $links[] = l(t('Home'), variable_get('site_frontpage', 'node')); $trail = _menu_get_active_trail(); - foreach ($trail as $mid) { + while (list($key, $mid) = each($trail)) { $item = menu_get_item($mid); if ($item['type'] & MENU_VISIBLE_IN_BREADCRUMB) { $links[] = menu_item_link($mid); @@ -596,7 +598,7 @@ function menu_rebuild() { // Fill a queue of new menu items which are modifiable. $new_items = array(); - foreach ($menu['items'] as $mid => $item) { + while (list($mid, $item) = each($menu['items'])) { if ($mid < 0 && ($item['type'] & MENU_MODIFIABLE_BY_ADMIN)) { $new_items[$mid] = $item; } @@ -606,14 +608,14 @@ function menu_rebuild() { // Save the new items updating the pids in each iteration while (($c = count($new_items)) && ($c != $old_count)) { $old_count = count($new_items); - foreach($new_items as $mid => $item) { + while(list($mid, $item) = each($new_items)) { // If the item has a valid parent, save it if ($item['pid'] >= 0) { // The new menu ID gets passed back by reference as $item['mid'] menu_save_item($item); // Fix parent IDs for the children of the menu item just saved if ($item['children']) { - foreach ($item['children'] as $child) { + while (list($key, $child) = each($item['children'])) { if (isset($new_items[$child])) { $new_items[$child]['pid'] = $item['mid']; } @@ -658,7 +660,7 @@ function menu_tree($pid = 1) { $output = ''; if (isset($menu['visible'][$pid]) && $menu['visible'][$pid]['children']) { - foreach ($menu['visible'][$pid]['children'] as $mid) { + while (list($key, $mid) = each($menu['visible'][$pid]['children'])) { $type = isset($menu['visible'][$mid]['type']) ? $menu['visible'][$mid]['type'] : NULL; $children = isset($menu['visible'][$mid]['children']) ? $menu['visible'][$mid]['children'] : NULL; $output .= theme('menu_item', $mid, menu_in_active_trail($mid) || ($type & MENU_EXPANDED) ? theme('menu_tree', $mid) : '', count($children) == 0); @@ -757,7 +759,7 @@ function menu_primary_local_tasks() { $output = ''; if (count($local_tasks[$pid]['children'])) { - foreach ($local_tasks[$pid]['children'] as $mid) { + while (list($key, $mid) = each($local_tasks[$pid]['children'])) { $output .= theme('menu_local_task', $mid, menu_in_active_trail($mid), TRUE); } } @@ -774,9 +776,9 @@ function menu_secondary_local_tasks() { $output = ''; if (count($local_tasks[$pid]['children'])) { - foreach ($local_tasks[$pid]['children'] as $mid) { + while (list($key, $mid) = each($local_tasks[$pid]['children'])) { if (menu_in_active_trail($mid) && count($local_tasks[$mid]['children']) > 1) { - foreach ($local_tasks[$mid]['children'] as $cid) { + while (list($key2, $cid) = each($local_tasks[$mid]['children'])) { $output .= theme('menu_local_task', $cid, menu_in_active_trail($cid), FALSE); } } @@ -856,7 +858,7 @@ function menu_primary_links($start_level $links = array(); if ($pid && is_array($menu['visible'][$pid]) && isset($menu['visible'][$pid]['children'])) { $count = 1; - foreach ($menu['visible'][$pid]['children'] as $cid) { + while (list($key, $cid) = each($menu['visible'][$pid]['children'])) { $index = "menu-$start_level-$count-$pid"; if (menu_in_active_trail_in_submenu($cid, $pid)) { $index .= "-active"; @@ -918,7 +920,7 @@ function theme_menu_links($links) { $level_tmp = explode('-', key($links)); $level = $level_tmp[0]; $output = "