#556018 by Damien Tournoud: Rename drupal_to_js() to drupal_json_encode() and drupal_json() to drupal_output_json().

From: Damien Tournoud <damien@tournoud.net>


---

 includes/ajax.inc                             |   14 +++--
 includes/batch.inc                            |    2 -
 includes/common.inc                           |   50 ++++++-------------
 includes/locale.inc                           |   40 ++++++++-------
 modules/field/field.test                      |    2 -
 modules/poll/poll.test                        |    2 -
 modules/profile/profile.admin.inc             |   24 +++++----
 modules/profile/profile.pages.inc             |    2 -
 modules/simpletest/tests/database_test.module |   10 ++--
 modules/system/system.admin.inc               |   55 +++++----------------
 modules/system/system.module                  |   66 ++++++++-----------------
 modules/taxonomy/taxonomy.pages.inc           |    4 +-
 modules/upload/upload.module                  |   15 +++---
 modules/user/user.pages.inc                   |    2 -
 14 files changed, 110 insertions(+), 178 deletions(-)


diff --git includes/ajax.inc includes/ajax.inc
index 7eab334..dc633c8 100644
--- includes/ajax.inc
+++ includes/ajax.inc
@@ -1,5 +1,5 @@
 <?php
-// $Id: ajax.inc,v 1.3 2009-08-21 00:35:30 webchick Exp $
+// $Id: ajax.inc,v 1.2 2009-08-18 11:26:04 dries Exp $
 
 /**
  * @file
@@ -105,7 +105,7 @@
  *   A list of macro commands generated by the use of ajax_command_*()
  *   functions.
  * @param $header
- *   If set to FALSE the 'text/javascript' header used by drupal_json() will
+ *   If set to FALSE the 'text/javascript' header used by drupal_output_json() will
  *   not be used, which is necessary when using an IFRAME. If set to
  *   'multipart' the output will be wrapped in a textarea, which can also be
  *   used as an alternative method when uploading files.
@@ -123,17 +123,17 @@ function ajax_render($commands = array(), $header = TRUE) {
 
   // Use === here so that bool TRUE doesn't match 'multipart'.
   if ($header === 'multipart') {
-    // We do not use drupal_json() here because the header is not true. We are
+    // We do not use drupal_output_json() here because the header is not true. We are
     // not really returning JSON, strictly-speaking, but rather JSON content
     // wrapped in a textarea as per the "file uploads" example here:
     // http://malsup.com/jquery/form/#code-samples
-    print '<textarea>' . drupal_to_js($commands) . '</textarea>';
+    print '<textarea>' . drupal_json_encode($commands) . '</textarea>';
   }
   else if ($header) {
-    drupal_json($commands);
+    drupal_output_json($commands);
   }
   else {
-    print drupal_to_js($commands);
+    print drupal_json_encode($commands);
   }
   exit;
 }
@@ -363,7 +363,7 @@ function ajax_command_alert($text) {
 /**
  * Creates a Drupal AJAX 'insert/replaceWith' command.
  *
- * The 'insert/replaceWith' command instructs the client to use jQuery's
+ * The 'insert/replace' command instructs the client to use jQuery's
  * replaceWith() method to replace each element matched matched by the given
  * selector with the given HTML.
  *
diff --git includes/batch.inc includes/batch.inc
index 45ea5b7..25f3441 100644
--- includes/batch.inc
+++ includes/batch.inc
@@ -140,7 +140,7 @@ function _batch_do() {
   // Perform actual processing.
   list($percentage, $message) = _batch_process();
 
-  drupal_json(array('status' => TRUE, 'percentage' => $percentage, 'message' => $message));
+  drupal_output_json(array('status' => TRUE, 'percentage' => $percentage, 'message' => $message));
 }
 
 /**
diff --git includes/common.inc includes/common.inc
index cac3b8a..5f1929b 100644
--- includes/common.inc
+++ includes/common.inc
@@ -1,5 +1,5 @@
 <?php
-// $Id: common.inc,v 1.965 2009-08-21 07:50:07 webchick Exp $
+// $Id: common.inc,v 1.964 2009-08-19 20:19:36 dries Exp $
 
 /**
  * @file
@@ -120,32 +120,6 @@ function drupal_get_region_content($region = NULL, $delimiter = ' ') {
 }
 
 /**
- * Get the name of the currently active install profile.
- *
- * When this function is called during Drupal's initial installation process,
- * the name of the profile that's about to be installed is stored in the global
- * installation state. At all other times, the standard Drupal systems variable
- * table contains the name of the current profile, and we can call variable_get()
- * to determine what one is active.
- *
- * @return $profile
- *   The name of the install profile.
- */
-function drupal_get_profile() {
-  global $install_state;
-
-  if (isset($install_state['parameters']['profile'])) {
-    $profile = $install_state['parameters']['profile'];
-  }
-  else {
-    $profile = variable_get('install_profile', 'default');
-  }
-
-  return $profile;
-}
-
-
-/**
  * Set the breadcrumb trail for the current page.
  *
  * @param $breadcrumb
@@ -3088,7 +3062,7 @@ function drupal_get_js($scope = 'header', $javascript = NULL) {
   foreach ($items as $item) {
     switch ($item['type']) {
       case 'setting':
-        $output .= '<script type="text/javascript">' . $embed_prefix . 'jQuery.extend(Drupal.settings, ' . drupal_to_js(call_user_func_array('array_merge_recursive', $item['data'])) . ");" . $embed_suffix . "</script>\n";
+        $output .= '<script type="text/javascript">' . $embed_prefix . 'jQuery.extend(Drupal.settings, ' . drupal_json_encode(call_user_func_array('array_merge_recursive', $item['data'])) . ");" . $embed_suffix . "</script>\n";
         break;
 
       case 'inline':
@@ -3420,7 +3394,7 @@ function drupal_clear_js_cache() {
  *
  * We use HTML-safe strings, i.e. with <, > and & escaped.
  */
-function drupal_to_js($var) {
+function drupal_json_encode($var) {
   // json_encode() does not escape <, > and &, so we do it with str_replace()
   return str_replace(array("<", ">", "&"), array('\x3c', '\x3e', '\x26'), json_encode($var));
 }
@@ -3434,12 +3408,12 @@ function drupal_to_js($var) {
  * @param $var
  *   (optional) If set, the variable will be converted to JSON and output.
  */
-function drupal_json($var = NULL) {
+function drupal_output_json($var = NULL) {
   // We are returning JavaScript, so tell the browser.
   drupal_set_header('Content-Type', 'text/javascript; charset=utf-8');
 
   if (isset($var)) {
-    echo drupal_to_js($var);
+    echo drupal_json_encode($var);
   }
 }
 
@@ -3750,10 +3724,20 @@ function drupal_cron_cleanup() {
  *   An array of file objects of the specified type.
  */
 function drupal_system_listing($mask, $directory, $key = 'name', $min_depth = 1) {
+  global $install_state;
   $config = conf_path();
 
-  $profile = drupal_get_profile();
-
+  // When this function is called during Drupal's initial installation process,
+  // the name of the profile that's about to be installed is stored in the global
+  // installation state. At all other times, the standard Drupal systems variable
+  // table contains the name of the current profile, and we can call variable_get()
+  // to determine what one is active.
+  if (isset($install_state['parameters']['profile'])) {
+    $profile = $install_state['parameters']['profile'];
+  }
+  else {
+    $profile = variable_get('install_profile', 'default');
+  }
   $searchdir = array($directory);
   $files = array();
 
diff --git includes/locale.inc includes/locale.inc
index ea768fc..6e4e35e 100644
--- includes/locale.inc
+++ includes/locale.inc
@@ -1,5 +1,5 @@
 <?php
-// $Id: locale.inc,v 1.225 2009-08-21 14:28:51 dries Exp $
+// $Id: locale.inc,v 1.224 2009-08-17 19:14:39 webchick Exp $
 
 /**
  * @file
@@ -89,7 +89,7 @@ function theme_locale_languages_overview_form($form) {
           array('data' => drupal_render($form['enabled'][$key]), 'align' => 'center'),
           drupal_render($form['site_default'][$key]),
           drupal_render($form['weight'][$key]),
-          l(t('edit'), 'admin/config/regional/language/edit/' . $key) . (($key != 'en' && $key != $default->language) ? ' ' . l(t('delete'), 'admin/config/regional/language/delete/' . $key) : '')
+          l(t('edit'), 'admin/config/international/language/edit/' . $key) . (($key != 'en' && $key != $default->language) ? ' ' . l(t('delete'), 'admin/config/international/language/delete/' . $key) : '')
         ),
         'class' => 'draggable'
       );
@@ -142,7 +142,7 @@ function locale_languages_overview_form_submit($form, &$form_state) {
   // Changing the language settings impacts the interface.
   cache_clear_all('*', 'cache_page', TRUE);
 
-  $form_state['redirect'] = 'admin/config/regional/language';
+  $form_state['redirect'] = 'admin/config/international/language';
   return;
 }
 /**
@@ -345,7 +345,7 @@ function locale_languages_predefined_form_submit($form, &$form_state) {
     batch_set($batch);
   }
 
-  $form_state['redirect'] = 'admin/config/regional/language';
+  $form_state['redirect'] = 'admin/config/international/language';
   return;
 }
 
@@ -391,7 +391,7 @@ function locale_languages_edit_form_submit($form, &$form_state) {
     }
     variable_set('language_default', $default);
   }
-  $form_state['redirect'] = 'admin/config/regional/language';
+  $form_state['redirect'] = 'admin/config/international/language';
   return;
 }
 /**
@@ -411,12 +411,12 @@ function locale_languages_delete_form(&$form_state, $langcode) {
   // Do not allow deletion of English locale.
   if ($langcode == 'en') {
     drupal_set_message(t('The English language cannot be deleted.'));
-    drupal_goto('admin/config/regional/language');
+    drupal_goto('admin/config/international/language');
   }
 
   if (language_default('language') == $langcode) {
     drupal_set_message(t('The default language cannot be deleted.'));
-    drupal_goto('admin/config/regional/language');
+    drupal_goto('admin/config/international/language');
   }
 
   // For other languages, warn user that data loss is ahead.
@@ -427,7 +427,7 @@ function locale_languages_delete_form(&$form_state, $langcode) {
   }
   else {
     $form['langcode'] = array('#type' => 'value', '#value' => $langcode);
-    return confirm_form($form, t('Are you sure you want to delete the language %name?', array('%name' => t($languages[$langcode]->name))), 'admin/config/regional/language', t('Deleting a language will remove all interface translations associated with it, and posts in this language will be set to be language neutral. This action cannot be undone.'), t('Delete'), t('Cancel'));
+    return confirm_form($form, t('Are you sure you want to delete the language %name?', array('%name' => t($languages[$langcode]->name))), 'admin/config/international/language', t('Deleting a language will remove all interface translations associated with it, and posts in this language will be set to be language neutral. This action cannot be undone.'), t('Delete'), t('Cancel'));
   }
 }
 
@@ -460,7 +460,7 @@ function locale_languages_delete_form_submit($form, &$form_state) {
   // Changing the language settings impacts the interface:
   cache_clear_all('*', 'cache_page', TRUE);
 
-  $form_state['redirect'] = 'admin/config/regional/language';
+  $form_state['redirect'] = 'admin/config/international/language';
   return;
 }
 /**
@@ -500,7 +500,7 @@ function locale_languages_configure_form() {
 function locale_languages_configure_form_submit($form, &$form_state) {
   variable_set('language_negotiation', $form_state['values']['language_negotiation']);
   drupal_set_message(t('Language negotiation configuration saved.'));
-  $form_state['redirect'] = 'admin/config/regional/language';
+  $form_state['redirect'] = 'admin/config/international/language';
   return;
 }
 /**
@@ -687,7 +687,7 @@ function locale_translation_filter_form_submit($form, &$form_state) {
       break;
   }
 
-  $form_state['redirect'] = 'admin/config/regional/translate/translate';
+  $form_state['redirect'] = 'admin/config/international/translate/translate';
 }
 
 /**
@@ -777,11 +777,11 @@ function locale_translate_import_form_submit($form, &$form_state) {
   }
   else {
     drupal_set_message(t('File to import not found.'), 'error');
-    $form_state['redirect'] = 'admin/config/regional/translate/import';
+    $form_state['redirect'] = 'admin/config/international/translate/import';
     return;
   }
 
-  $form_state['redirect'] = 'admin/config/regional/translate';
+  $form_state['redirect'] = 'admin/config/international/translate';
   return;
 }
 /**
@@ -886,7 +886,7 @@ function locale_translate_edit_form(&$form_state, $lid) {
   $source = db_query('SELECT source, context, textgroup, location FROM {locales_source} WHERE lid = :lid', array(':lid' => $lid))->fetchObject();
   if (!$source) {
     drupal_set_message(t('String not found.'), 'error');
-    drupal_goto('admin/config/regional/translate/translate');
+    drupal_goto('admin/config/international/translate/translate');
   }
 
   // Add original text to the top and some values for form altering.
@@ -1024,7 +1024,7 @@ function locale_translate_edit_form_submit($form, &$form_state) {
   _locale_invalidate_js();
   cache_clear_all('locale:', 'cache', TRUE);
 
-  $form_state['redirect'] = 'admin/config/regional/translate/translate';
+  $form_state['redirect'] = 'admin/config/international/translate/translate';
   return;
 }
 /**
@@ -1053,7 +1053,7 @@ function locale_translate_delete_page($lid) {
  */
 function locale_translate_delete_form(&$form_state, $source) {
   $form['lid'] = array('#type' => 'value', '#value' => $source->lid);
-  return confirm_form($form, t('Are you sure you want to delete the string "%source"?', array('%source' => $source->source)), 'admin/config/regional/translate/translate', t('Deleting the string will remove all translations of this string in all languages. This action cannot be undone.'), t('Delete'), t('Cancel'));
+  return confirm_form($form, t('Are you sure you want to delete the string "%source"?', array('%source' => $source->source)), 'admin/config/international/translate/translate', t('Deleting the string will remove all translations of this string in all languages. This action cannot be undone.'), t('Delete'), t('Cancel'));
 }
 
 /**
@@ -1070,7 +1070,7 @@ function locale_translate_delete_form_submit($form, &$form_state) {
   _locale_invalidate_js();
   cache_clear_all('locale:', 'cache', TRUE);
   drupal_set_message(t('The string has been removed.'));
-  $form_state['redirect'] = 'admin/config/regional/translate/translate';
+  $form_state['redirect'] = 'admin/config/international/translate/translate';
 }
 /**
  * @} End of "locale-translate-delete"
@@ -2303,8 +2303,8 @@ function _locale_translate_seek() {
       array('data' => check_plain(truncate_utf8($string['source'], 150, FALSE, TRUE)) . '<br /><small>' . $string['location'] . '</small>'),
       $string['context'],
       array('data' => _locale_translate_language_list($string['languages'], $limit_language), 'align' => 'center'),
-      array('data' => l(t('edit'), "admin/config/regional/translate/edit/$lid", array('query' => drupal_get_destination())), 'class' => 'nowrap'),
-      array('data' => l(t('delete'), "admin/config/regional/translate/delete/$lid", array('query' => drupal_get_destination())), 'class' => 'nowrap'),
+      array('data' => l(t('edit'), "admin/config/international/translate/edit/$lid", array('query' => drupal_get_destination())), 'class' => 'nowrap'),
+      array('data' => l(t('delete'), "admin/config/international/translate/delete/$lid", array('query' => drupal_get_destination())), 'class' => 'nowrap'),
     );
   }
 
@@ -2429,7 +2429,7 @@ function _locale_rebuild_js($langcode = NULL) {
       $data .= "'pluralFormula': function (\$n) { return Number({$language->formula}); }, ";
     }
 
-    $data .= "'strings': " . drupal_to_js($translations) . " };";
+    $data .= "'strings': " . drupal_json_encode($translations) . " };";
     $data_hash = md5($data);
   }
 
diff --git modules/field/field.test modules/field/field.test
index de1580b..6170537 100644
--- modules/field/field.test
+++ modules/field/field.test
@@ -1335,7 +1335,7 @@ class FieldFormTestCase extends DrupalWebTestCase {
     $this->drupalPost(NULL, $edit, $submit);
     unset($this->additionalCurlOptions[CURLOPT_URL]);
 
-    // The response is drupal_json, so we need to undo some escaping.
+    // The response is drupal_output_json, so we need to undo some escaping.
     $commands = json_decode(str_replace(array('\x3c', '\x3e', '\x26'), array("<", ">", "&"), $this->drupalGetContent()));
 
     // The JSON response will be two AJAX commands. The first is a settings
diff --git modules/poll/poll.test modules/poll/poll.test
index 355f593..c4741bf 100644
--- modules/poll/poll.test
+++ modules/poll/poll.test
@@ -344,7 +344,7 @@ class PollJSAddChoice extends DrupalWebTestCase {
     $this->drupalPost(NULL, $edit, t('More choices'));
     unset($this->additionalCurlOptions[CURLOPT_URL]);
 
-    // The response is drupal_json, so we need to undo some escaping.
+    // The response is drupal_output_json, so we need to undo some escaping.
     $commands = json_decode(str_replace(array('\x3c', '\x3e', '\x26'), array("<", ">", "&"), $this->drupalGetContent()));
 
     // The JSON response will be two AJAX commands. The first is a settings
diff --git modules/profile/profile.admin.inc modules/profile/profile.admin.inc
index 9fcd4f9..6d94eee 100644
--- modules/profile/profile.admin.inc
+++ modules/profile/profile.admin.inc
@@ -1,5 +1,5 @@
 <?php
-// $Id: profile.admin.inc,v 1.27 2009-08-21 14:27:45 dries Exp $
+// $Id: profile.admin.inc,v 1.26 2009-07-31 19:01:02 dries Exp $
 
 /**
  * @file
@@ -27,8 +27,8 @@ function profile_admin_overview() {
     $form[$field->fid]['type'] = array('#markup' => $field->type);
     $form[$field->fid]['category'] = array('#type' => 'select', '#default_value' => $field->category, '#options' => array());
     $form[$field->fid]['weight'] = array('#type' => 'weight', '#default_value' => $field->weight);
-    $form[$field->fid]['edit'] = array('#markup' => l(t('edit'), "admin/config/people/profile/edit/$field->fid"));
-    $form[$field->fid]['delete'] = array('#markup' => l(t('delete'), "admin/config/people/profile/delete/$field->fid"));
+    $form[$field->fid]['edit'] = array('#markup' => l(t('edit'), "admin/settings/profile/edit/$field->fid"));
+    $form[$field->fid]['delete'] = array('#markup' => l(t('delete'), "admin/settings/profile/delete/$field->fid"));
   }
 
   // Add the category combo boxes
@@ -55,7 +55,7 @@ function profile_admin_overview() {
   $addnewfields = '<h2>' . t('Add new field') . '</h2>';
   $addnewfields .= '<ul>';
   foreach (_profile_field_types() as $key => $value) {
-    $addnewfields .= '<li>' . l($value, "admin/config/people/profile/add/$key") . '</li>';
+    $addnewfields .= '<li>' . l($value, "admin/settings/profile/add/$key") . '</li>';
   }
   $addnewfields .= '</ul>';
   $form['addnewfields'] = array('#markup' => $addnewfields);
@@ -219,7 +219,7 @@ function profile_field_form(&$form_state, $arg = NULL) {
   $form['fields']['category'] = array('#type' => 'textfield',
     '#title' => t('Category'),
     '#default_value' => $edit['category'],
-    '#autocomplete_path' => 'admin/config/people/profile/autocomplete',
+    '#autocomplete_path' => 'admin/settings/profile/autocomplete',
     '#description' => t('The category the new field should be part of. Categories are used to group fields logically. An example category is "Personal information".'),
     '#required' => TRUE,
   );
@@ -361,7 +361,7 @@ function profile_field_form_submit($form, &$form_state) {
       ->fields($values)
       ->execute();
     drupal_set_message(t('The field has been created.'));
-    watchdog('profile', 'Profile field %field added under category %category.', array('%field' => $form_state['values']['title'], '%category' => $form_state['values']['category']), WATCHDOG_NOTICE, l(t('view'), 'admin/config/people/profile'));
+    watchdog('profile', 'Profile field %field added under category %category.', array('%field' => $form_state['values']['title'], '%category' => $form_state['values']['category']), WATCHDOG_NOTICE, l(t('view'), 'admin/settings/profile'));
   }
   else {
     db_update('profile_field')
@@ -373,7 +373,7 @@ function profile_field_form_submit($form, &$form_state) {
   cache_clear_all();
   menu_rebuild();
 
-  $form_state['redirect'] = 'admin/config/people/profile';
+  $form_state['redirect'] = 'admin/settings/profile';
   return;
 }
 
@@ -390,8 +390,8 @@ function profile_field_delete(&$form_state, $fid) {
   $form['title'] = array('#type' => 'value', '#value' => $field->title);
 
   return confirm_form($form,
-    t('Are you sure you want to delete the field %field?', array('%field' => $field->title)), 'admin/config/people/profile',
-    t('This action cannot be undone. If users have entered values into this field in their profile, these entries will also be deleted. If you want to keep the user-entered data, instead of deleting the field you may wish to <a href="@edit-field">edit this field</a> and change it to a hidden profile field so that it may only be accessed by administrators.', array('@edit-field' => url('admin/config/people/profile/edit/' . $fid))),
+    t('Are you sure you want to delete the field %field?', array('%field' => $field->title)), 'admin/settings/profile',
+    t('This action cannot be undone. If users have entered values into this field in their profile, these entries will also be deleted. If you want to keep the user-entered data, instead of deleting the field you may wish to <a href="@edit-field">edit this field</a> and change it to a hidden profile field so that it may only be accessed by administrators.', array('@edit-field' => url('admin/settings/profile/edit/' . $fid))),
     t('Delete'), t('Cancel'));
 }
 
@@ -409,9 +409,9 @@ function profile_field_delete_submit($form, &$form_state) {
   cache_clear_all();
 
   drupal_set_message(t('The field %field has been deleted.', array('%field' => $form_state['values']['title'])));
-  watchdog('profile', 'Profile field %field deleted.', array('%field' => $form_state['values']['title']), WATCHDOG_NOTICE, l(t('view'), 'admin/config/people/profile'));
+  watchdog('profile', 'Profile field %field deleted.', array('%field' => $form_state['values']['title']), WATCHDOG_NOTICE, l(t('view'), 'admin/settings/profile'));
 
-  $form_state['redirect'] = 'admin/config/people/profile';
+  $form_state['redirect'] = 'admin/settings/profile';
   return;
 }
 
@@ -424,5 +424,5 @@ function profile_admin_settings_autocomplete($string) {
   foreach ($result as $data) {
     $matches[$data->category] = check_plain($data->category);
   }
-  drupal_json($matches);
+  drupal_output_json($matches);
 }
diff --git modules/profile/profile.pages.inc modules/profile/profile.pages.inc
index 421cfc1..94e3703 100644
--- modules/profile/profile.pages.inc
+++ modules/profile/profile.pages.inc
@@ -134,5 +134,5 @@ function profile_autocomplete($field, $string) {
     }
   }
 
-  drupal_json($matches);
+  drupal_output_json($matches);
 }
diff --git modules/simpletest/tests/database_test.module modules/simpletest/tests/database_test.module
index f92fa88..ede5fe1 100644
--- modules/simpletest/tests/database_test.module
+++ modules/simpletest/tests/database_test.module
@@ -77,7 +77,7 @@ function database_test_menu() {
  */
 function database_test_db_query_temporary() {
   $table_name = db_query_temporary('SELECT status FROM {system}', array());
-  drupal_json(array(
+  drupal_output_json(array(
     'table_name' => $table_name,
     'row_count' => db_select($table_name)->countQuery()->execute()->fetchField(),
   ));
@@ -102,7 +102,7 @@ function database_test_even_pager_query($limit) {
 
   $names = $query->execute()->fetchCol();
 
-  drupal_json(array(
+  drupal_output_json(array(
     'names' => $names,
   ));
   exit;
@@ -126,7 +126,7 @@ function database_test_odd_pager_query($limit) {
 
   $names = $query->execute()->fetchCol();
 
-  drupal_json(array(
+  drupal_output_json(array(
     'names' => $names,
   ));
   exit;
@@ -155,7 +155,7 @@ function database_test_tablesort() {
   // We need all the results at once to check the sort.
   $tasks = $query->execute()->fetchAll();
 
-  drupal_json(array(
+  drupal_output_json(array(
     'tasks' => $tasks,
   ));
   exit;
@@ -184,7 +184,7 @@ function database_test_tablesort_first() {
   // We need all the results at once to check the sort.
   $tasks = $query->execute()->fetchAll();
 
-  drupal_json(array(
+  drupal_output_json(array(
     'tasks' => $tasks,
   ));
   exit;
diff --git modules/system/system.admin.inc modules/system/system.admin.inc
index 457e49d..d9e9ab5 100644
--- modules/system/system.admin.inc
+++ modules/system/system.admin.inc
@@ -1,5 +1,5 @@
 <?php
-// $Id: system.admin.inc,v 1.182 2009-08-21 14:28:52 dries Exp $
+// $Id: system.admin.inc,v 1.180 2009-08-17 19:14:41 webchick Exp $
 
 /**
  * @file
@@ -40,25 +40,11 @@ function system_main_admin_page($arg = NULL) {
       }
       $block = $item;
       $block['content'] = '';
-      $block['show'] = FALSE;
       if ($item['block_callback'] && function_exists($item['block_callback'])) {
         $function = $item['block_callback'];
         $block['content'] .= $function();
       }
-      $content = system_admin_menu_block($item);
-      if ((isset($item['page_callback']) && !in_array($item['page_callback'], array('system_admin_menu_block_page', 'system_admin_config_page', 'system_settings_overview'))) || count($content)) {
-        // Only show blocks for items which are not containers, or those which
-        // are containers and do have items we can show.
-        $block['show'] = TRUE;
-        if (empty($content)) {
-          // If no items found below, but access checks did not fail, show.
-          $block['title'] = l($item['title'], $item['href'], $item['localized_options']); 
-        }
-        else {
-          // Theme items below.
-          $block['content'] .= theme('admin_block_content', $content);
-        }
-      }
+      $block['content'] .= theme('admin_block_content', system_admin_menu_block($item));
       // Prepare for sorting as in function _menu_tree_check_access().
       // The weight is offset so it is always positive, with a uniform 5-digits.
       $blocks[(50000 + $item['weight']) . ' ' . $item['title'] . ' ' . $item['mlid']] = $block;
@@ -100,7 +86,6 @@ function system_admin_config_page() {
       }
       $block = $item;
       $block['content'] = '';
-      $block['show'] = TRUE;
       if ($item['block_callback'] && function_exists($item['block_callback'])) {
         $function = $item['block_callback'];
         $block['content'] .= $function();
@@ -1580,7 +1565,7 @@ function system_rss_feeds_settings() {
  */
 function system_regional_settings() {
   drupal_add_js(drupal_get_path('module', 'system') . '/system.js');
-  drupal_add_js(array('dateTime' => array('lookup' => url('admin/config/regional/settings/lookup'))), 'setting');
+  drupal_add_js(array('dateTime' => array('lookup' => url('admin/settings/regional-settings/lookup'))), 'setting');
 
   include_once DRUPAL_ROOT . '/includes/locale.inc';
   $countries = country_get_list();
@@ -1777,7 +1762,7 @@ function system_regional_settings_submit($form, &$form_state) {
  */
 function system_date_time_lookup() {
   $result = format_date(REQUEST_TIME, 'custom', $_GET['format']);
-  drupal_json($result);
+  drupal_output_json($result);
 }
 
 /**
@@ -1938,34 +1923,20 @@ function system_batch_page() {
  */
 function theme_admin_block($block) {
   // Don't display the block if it has no content to display.
-  if (!$block['show']) {
+  if (empty($block['content'])) {
     return '';
   }
 
-  if (empty($block['content'])) {
-    $output = <<< EOT
-    <div class="admin-panel">
-      <h3>
-        $block[title]
-      </h3>
-      <div class="description">
-        $block[description]
-      </div>
-    </div>
-EOT;
-  }
-  else {
-    $output = <<< EOT
-    <div class="admin-panel">
-      <h3>
-        $block[title]
-      </h3>
-     <div class="body">
-       $block[content]
-      </div>
+  $output = <<< EOT
+  <div class="admin-panel">
+    <h3>
+      $block[title]
+    </h3>
+    <div class="body">
+      $block[content]
     </div>
+  </div>
 EOT;
-  }
   return $output;
 }
 
diff --git modules/system/system.module modules/system/system.module
index 266cbe5..1df87c0 100644
--- modules/system/system.module
+++ modules/system/system.module
@@ -1,5 +1,5 @@
 <?php
-// $Id: system.module,v 1.757 2009-08-21 14:28:52 dries Exp $
+// $Id: system.module,v 1.752 2009-08-20 10:48:03 dries Exp $
 
 /**
  * @file
@@ -96,7 +96,7 @@ function system_help($path, $arg) {
       $output .= '<li>' . t('support for enabling and disabling <a href="@themes">themes</a>, which determine the design and presentation of your site. Drupal comes packaged with several core themes and additional contributed themes are available at the <a href="@drupal-themes">Drupal.org theme page</a>.', array('@themes' => url('admin/appearance'), '@drupal-themes' => 'http://drupal.org/project/themes')) . '</li>';
       $output .= '<li>' . t('a robust <a href="@cache-settings">caching system</a> that allows the efficient re-use of previously-constructed web pages and web page components. Drupal stores the pages requested by anonymous users in a compressed format; depending on your site configuration and the amount of your web traffic tied to anonymous visitors, Drupal\'s caching system may significantly increase the speed of your site.', array('@cache-settings' => url('admin/config/development/performance'))) . '</li>';
       $output .= '<li>' . t('a set of routine administrative operations that rely on a correctly-configured <a href="@cron">cron maintenance task</a> to run automatically. A number of other modules, including the feed aggregator, and search also rely on <a href="@cron">cron maintenance tasks</a>. For more information, see the online handbook entry for <a href="@handbook">configuring cron jobs</a>.', array('@cron' => url('admin/reports/status'), '@handbook' => 'http://drupal.org/cron')) . '</li>';
-      $output .= '<li>' . t('basic configuration options for your site, including <a href="@regional-settings">date and time settings</a>, <a href="@file-system">file system settings</a>, <a href="@clean-url">clean URL support</a>, <a href="@site-info">site name and other information</a>, and a <a href="@maintenance-mode">maintenance mode</a> for taking your site temporarily offline.', array('@regional-settings' => url('admin/config/regional/settings'), '@file-system' => url('admin/config/media/file-system'), '@clean-url' => url('admin/settings/clean-urls'), '@site-info' => url('admin/settings/site-information'), '@maintenance-mode' => url('admin/config/development/maintenance'))) . '</li></ul>';
+      $output .= '<li>' . t('basic configuration options for your site, including <a href="@regional-settings">date and time settings</a>, <a href="@file-system">file system settings</a>, <a href="@clean-url">clean URL support</a>, <a href="@site-info">site name and other information</a>, and a <a href="@maintenance-mode">maintenance mode</a> for taking your site temporarily offline.', array('@regional-settings' => url('admin/settings/regional-settings'), '@file-system' => url('admin/config/media/file-system'), '@clean-url' => url('admin/settings/clean-urls'), '@site-info' => url('admin/settings/site-information'), '@maintenance-mode' => url('admin/config/development/maintenance'))) . '</li></ul>';
       $output .= '<p>' . t('For more information, see the online handbook entry for <a href="@system">System module</a>.', array('@system' => 'http://drupal.org/handbook/modules/system/')) . '</p>';
       return $output;
     case 'admin/by-module':
@@ -112,8 +112,8 @@ function system_help($path, $arg) {
     case 'admin/appearance/settings':
       return '<p>' . t('These options control the default display settings for your entire site, across all themes. Unless they have been overridden by a specific theme, these settings will be used.') . '</p>';
     case 'admin/config/modules':
-      $output = '<p>' . t('Modules are plugins that extend Drupal\'s core functionality. To further extend your site\'s functionality, a number of <a href="@modules">contributed modules</a> are available for download.', array('@permissions' => url('admin/config/people/permissions'), '@modules' => 'http://drupal.org/project/modules')) . '</p>';
-      $output .= '<p>' . t('Module-related tasks can be located on the <a href="@by-module">administration by module page</a>. New <a href="@permissions">module-related permissions</a> may also become available as new modules are enabled.', array('@by-module' => url('admin/by-module'), '@permissions' => url('admin/config/people/permissions'))) . '</p>';
+      $output = '<p>' . t('Modules are plugins that extend Drupal\'s core functionality. To further extend your site\'s functionality, a number of <a href="@modules">contributed modules</a> are available for download.', array('@permissions' => url('admin/settings/permissions'), '@modules' => 'http://drupal.org/project/modules')) . '</p>';
+      $output .= '<p>' . t('Module-related tasks can be located on the <a href="@by-module">administration by module page</a>. New <a href="@permissions">module-related permissions</a> may also become available as new modules are enabled.', array('@by-module' => url('admin/by-module'), '@permissions' => url('admin/settings/permissions'))) . '</p>';
       $output .= '<p>' . t('Each time a module is updated, it is important that <a href="@update-php">update.php</a> is run. To help manage the update process, the <em>Update status</em> module, if enabled, provides <a href="@updates">information on new versions of modules (and themes)</a> as they are released. Regular review of the <a href="@updates">available updates page</a> is essential to maintaining a secure and current site.', array('@update-php' => $base_url . '/update.php', '@updates' => url('admin/reports/updates'))) . '</p>';
       return $output;
     case 'admin/config/modules/uninstall':
@@ -545,11 +545,9 @@ function system_menu() {
   // Appearance.
   $items['admin/appearance'] = array(
     'title' => 'Appearance',
-    'description' => 'Select and configure your site theme.',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('system_themes_form'),
     'access arguments' => array('administer site configuration'),
-    'position' => 'left',
     'weight' => -6,
   );
   $items['admin/appearance/select'] = array(
@@ -718,7 +716,7 @@ function system_menu() {
     'title' => 'File-system',
     'description' => 'Tell Drupal where to store uploaded files and how they are accessed.',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('system_file_system_settings'),
+    'page arguments' => array('system_performance_settings'),
     'access arguments' => array('administer site configuration'),
   );
     $items['admin/config/media/image-toolkit'] = array(
@@ -735,29 +733,6 @@ function system_menu() {
     'page arguments' => array('system_logging_settings'),
     'access arguments' => array('administer site configuration'),
   );
-  $items['admin/config/regional'] = array(
-   'title' => 'Regional and language',
-   'description' => 'Regional settings, localization and translation.',
-   'position' => 'left',
-   'weight' => -7,
-   'page callback' => 'system_admin_menu_block_page',
-   'access callback' => 'system_admin_menu_block_access',
-   'access arguments' => array('admin/config/regional', 'access administration pages'),
-  );
-  $items['admin/config/regional/settings'] = array(
-    'title' => 'Regional settings',
-    'description' => "Settings for how Drupal displays date and time, as well as the system's default time zone.",
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('system_regional_settings'),
-    'access arguments' => array('administer site configuration'),
-    'weight' => -10,
-  );
-  $items['admin/config/regional/settings/lookup'] = array(
-    'title' => 'Date and time lookup',
-    'type' => MENU_CALLBACK,
-    'page callback' => 'system_date_time_lookup',
-    'access arguments' => array('administer site configuration'),
-  );
   
   // Settings.
   $items['admin/settings/site-information'] = array(
@@ -774,6 +749,19 @@ function system_menu() {
     'page arguments' => array('system_rss_feeds_settings'),
     'access arguments' => array('administer site configuration'),
   );
+  $items['admin/settings/regional-settings'] = array(
+    'title' => 'Regional settings',
+    'description' => "Settings for how Drupal displays date and time, as well as the system's default time zone.",
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('system_regional_settings'),
+    'access arguments' => array('administer site configuration'),
+  );
+  $items['admin/settings/regional-settings/lookup'] = array(
+    'title' => 'Date and time lookup',
+    'type' => MENU_CALLBACK,
+    'page callback' => 'system_date_time_lookup',
+    'access arguments' => array('administer site configuration'),
+  );
   $items['admin/settings/clean-urls'] = array(
     'title' => 'Clean URLs',
     'description' => 'Enable or disable clean URLs for your site.',
@@ -783,7 +771,7 @@ function system_menu() {
   );
   $items['admin/settings/clean-urls/check'] = array(
     'title' => 'Clean URL check',
-    'page callback' => 'drupal_json',
+    'page callback' => 'drupal_output_json',
     'page arguments' => array(array('status' => TRUE)),
     'access callback' => TRUE,
     'type' => MENU_CALLBACK,
@@ -1765,15 +1753,6 @@ function _system_get_module_data() {
   // Find modules
   $modules = drupal_system_listing('/\.module$/', 'modules', 'name', 0);
 
-  // Include the install profile in modules that are loaded.
-  $profile = drupal_get_profile();
-  $modules[$profile]->name = $profile;
-  $modules[$profile]->uri = 'profiles/' . $profile . '/' . $profile . '.profile';
-  $modules[$profile]->filename = $profile . '.profile';
-
-  // Install profile hooks are always executed last.
-  $modules[$profile]->weight = 1000;
-
   // Set defaults for module info.
   $defaults = array(
     'dependencies' => array(),
@@ -1804,9 +1783,6 @@ function _system_get_module_data() {
     drupal_alter('system_info', $modules[$key]->info, $modules[$key]);
   }
 
-  // The install profile is required.
-  $modules[$profile]->info['required'] = TRUE;
-
   return $modules;
 }
 
@@ -2254,7 +2230,7 @@ function system_get_module_admin_tasks($module) {
   $admin_task_count = 0;
   // Check for permissions.
   if (in_array($module, module_implements('permission')) && $admin_access) {
-    $admin_tasks[-1] = l(t('Configure permissions'), 'admin/config/people/permissions', array('fragment' => 'module-' . $module));
+    $admin_tasks[-1] = l(t('Configure permissions'), 'admin/settings/permissions', array('fragment' => 'module-' . $module));
   }
 
   // Check for menu items that are admin links.
@@ -2869,7 +2845,7 @@ function system_timezone($abbreviation = '', $offset = -1, $is_daylight_saving_t
   // interpreted as the empty string.
   $abbreviation = $abbreviation ? $abbreviation : '';
   $timezone = timezone_name_from_abbr($abbreviation, intval($offset), $is_daylight_saving_time);
-  drupal_json($timezone);
+  drupal_output_json($timezone);
 }
 
 /**
diff --git modules/taxonomy/taxonomy.pages.inc modules/taxonomy/taxonomy.pages.inc
index 621cf73..d47ae33 100644
--- modules/taxonomy/taxonomy.pages.inc
+++ modules/taxonomy/taxonomy.pages.inc
@@ -134,7 +134,7 @@ function taxonomy_autocomplete_legacy($vid = 0, $tags_typed = '') {
     }
   }
 
-  drupal_json(array_merge($term_matches, $synonym_matches));
+  drupal_output_json(array_merge($term_matches, $synonym_matches));
 }
 
 /**
@@ -190,5 +190,5 @@ function taxonomy_autocomplete($field_name, $bundle, $tags_typed = '') {
     }
   }
 
-  drupal_json($term_matches);
+  drupal_output_json($term_matches);
 }
diff --git modules/upload/upload.module modules/upload/upload.module
index dc91824..62ca9eb 100644
--- modules/upload/upload.module
+++ modules/upload/upload.module
@@ -1,5 +1,5 @@
 <?php
-// $Id: upload.module,v 1.251 2009-08-21 16:51:52 dries Exp $
+// $Id: upload.module,v 1.248 2009-08-20 10:48:03 dries Exp $
 
 /**
  * @file
@@ -18,7 +18,7 @@ function upload_help($path, $arg) {
       $output .= '<p>' . t('For more information, see the online handbook entry for <a href="@upload">Upload module</a>.', array('@upload' => 'http://drupal.org/handbook/modules/upload/')) . '</p>';
       return $output;
     case 'admin/settings/upload':
-      return '<p>' . t('Users with the <a href="@permissions">upload files permission</a> can upload attachments. Users with the <a href="@permissions">view uploaded files permission</a> can view uploaded attachments. You can choose which post types can take attachments on the <a href="@types">content types settings</a> page.', array('@permissions' => url('admin/config/people/permissions'), '@types' => url('admin/settings/types'))) . '</p>';
+      return '<p>' . t('Users with the <a href="@permissions">upload files permission</a> can upload attachments. Users with the <a href="@permissions">view uploaded files permission</a> can view uploaded attachments. You can choose which post types can take attachments on the <a href="@types">content types settings</a> page.', array('@permissions' => url('admin/settings/permissions'), '@types' => url('admin/settings/types'))) . '</p>';
   }
 }
 
@@ -142,7 +142,7 @@ function _upload_file_limits($user) {
     'extensions' => $all_extensions,
     'file_size' => $file_limit,
     'user_size' => $user_limit,
-    'resolution' => variable_get('upload_max_resolution_x', 0) . 'x' . variable_get('upload_max_resolution_y', 0),
+    'resolution' => variable_get('upload_max_resolution', 0),
   );
 }
 
@@ -236,7 +236,10 @@ function upload_form_alter(&$form, $form_state, $form_id) {
       );
 
       // Wrapper for fieldset contents (used by ajax.js).
-      $form['attachments']['wrapper'] = array();
+      $form['attachments']['wrapper'] = array(
+        '#prefix' => '<div id="attach-wrapper">',
+        '#suffix' => '</div>',
+      );
 
       // Make sure necessary directories for upload.module exist and are
       // writable before displaying the attachment form.
@@ -530,8 +533,6 @@ function _upload_form($node) {
   $form = array(
     '#theme' => 'upload_form_new',
     '#cache' => TRUE,
-    '#prefix' => '<div id="attach-wrapper">',
-    '#suffix' => '</div>',
   );
 
   if (!empty($node->files) && is_array($node->files)) {
@@ -641,7 +642,7 @@ function upload_js() {
   if (!($cached_form = form_get_cache($_POST['form_build_id'], $cached_form_state)) || !isset($cached_form['#node']) || !isset($cached_form['attachments'])) {
     form_set_error('form_token', t('Validation error, please try again. If this error persists, please contact the site administrator.'));
     $output = theme('status_messages');
-    print drupal_to_js(array('status' => TRUE, 'data' => $output));
+    print drupal_json_encode(array('status' => TRUE, 'data' => $output));
     exit();
   }
 
diff --git modules/user/user.pages.inc modules/user/user.pages.inc
index 7c33cd0..dd4301b 100644
--- modules/user/user.pages.inc
+++ modules/user/user.pages.inc
@@ -18,7 +18,7 @@ function user_autocomplete($string = '') {
     }
   }
 
-  drupal_json($matches);
+  drupal_output_json($matches);
 }
 
 /**
