diff options
author | Dries Buytaert <dries@buytaert.net> | 2006-09-08 16:33:02 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2006-09-08 16:33:02 +0000 |
commit | 6f0e54b037618676af98d7c59f87b16b0745d575 (patch) | |
tree | dd4b4df4d0be79b3d449b291ea75342dc5c9107d /modules | |
parent | 6ce212e4ebeccb43e4e65421816d99c02019b9b7 (diff) | |
download | brdo-6f0e54b037618676af98d7c59f87b16b0745d575.tar.gz brdo-6f0e54b037618676af98d7c59f87b16b0745d575.tar.bz2 |
- Patch #82465 by webchick: renamed variables in hooks for consistency.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/comment/comment.module | 18 | ||||
-rw-r--r-- | modules/contact/contact.module | 24 | ||||
-rw-r--r-- | modules/node/node.module | 20 | ||||
-rw-r--r-- | modules/path/path.module | 12 | ||||
-rw-r--r-- | modules/search/search.module | 8 | ||||
-rw-r--r-- | modules/system/system.module | 34 | ||||
-rw-r--r-- | modules/user/user.module | 64 | ||||
-rw-r--r-- | modules/watchdog/watchdog.module | 3 |
8 files changed, 91 insertions, 92 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module index e161e9201..db3d04105 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -1048,9 +1048,9 @@ function comment_admin_overview($type = 'new') { /** * We can't execute any 'Update options' if no comments were selected. */ -function comment_admin_overview_validate($form_id, $edit) { - $edit['comments'] = array_diff($edit['comments'], array(0)); - if (count($edit['comments']) == 0) { +function comment_admin_overview_validate($form_id, $form_values) { + $form_values['comments'] = array_diff($form_values['comments'], array(0)); + if (count($form_values['comments']) == 0) { form_set_error('', t('Please select one or more comments to perform the update on.')); drupal_goto('admin/content/comment'); } @@ -1060,19 +1060,19 @@ function comment_admin_overview_validate($form_id, $edit) { * Execute the chosen 'Update option' on the selected comments, such as * publishing, unpublishing or deleting. */ -function comment_admin_overview_submit($form_id, $edit) { +function comment_admin_overview_submit($form_id, $form_values) { $operations = comment_operations(); - if ($operations[$edit['operation']][1]) { + if ($operations[$form_values['operation']][1]) { // extract the appropriate database query operation - $query = $operations[$edit['operation']][1]; - foreach ($edit['comments'] as $cid => $value) { + $query = $operations[$form_values['operation']][1]; + foreach ($form_values['comments'] as $cid => $value) { if ($value) { // perform the update action, then refresh node statistics db_query($query, $cid); $comment = _comment_load($cid); _comment_update_node_statistics($comment->nid); // Allow modules to respond to the updating of a comment. - comment_invoke_comment($comment, $edit['operation']); + comment_invoke_comment($comment, $form_values['operation']); // Add an entry to the watchdog log. watchdog('content', t('Comment: updated %subject.', array('%subject' => $comment->subject)), WATCHDOG_NOTICE, l(t('view'), 'node/'. $comment->nid, NULL, NULL, 'comment-'. $comment->cid)); } @@ -1145,7 +1145,7 @@ function comment_multiple_delete_confirm() { /** * Perform the actual comment deletion. */ -function comment_multiple_delete_confirm_submit($form_id, $edit) { +function comment_multiple_delete_confirm_submit($form_id, $form_values) { if ($edit['confirm']) { foreach ($edit['comments'] as $cid => $value) { $comment = _comment_load($cid); diff --git a/modules/contact/contact.module b/modules/contact/contact.module index 18b169526..573dbc6b2 100644 --- a/modules/contact/contact.module +++ b/modules/contact/contact.module @@ -359,7 +359,7 @@ function contact_mail_user() { /** * Process the personal contact page form submission. */ -function contact_mail_user_submit($form_id, $edit) { +function contact_mail_user_submit($form_id, $form_values) { global $user; $account = user_load(array('uid' => arg(1), 'status' => 1)); @@ -368,7 +368,7 @@ function contact_mail_user_submit($form_id, $edit) { $message[] = t("!name (!name-url) has sent you a message via your contact form (!form-url) at !site.", array('!name' => $user->name, '!name-url' => url("user/$user->uid", NULL, NULL, TRUE), '!form-url' => url($_GET['q'], NULL, NULL, TRUE), '!site' => variable_get('site_name', 'drupal'))); $message[] = t("If you don't want to receive such e-mails, you can change your settings at !url.", array('!url' => url("user/$account->uid", NULL, NULL, TRUE))); $message[] = t('Message:'); - $message[] = $edit['message']; + $message[] = $form_values['message']; // Tidy up the body: foreach ($message as $key => $value) { @@ -380,7 +380,7 @@ function contact_mail_user_submit($form_id, $edit) { $from = $user->mail; // Format the subject: - $subject = '['. variable_get('site_name', 'drupal') .'] '. $edit['subject']; + $subject = '['. variable_get('site_name', 'drupal') .'] '. $form_values['subject']; // Prepare the body: $body = implode("\n\n", $message); @@ -389,7 +389,7 @@ function contact_mail_user_submit($form_id, $edit) { drupal_mail('contact-user-mail', $to, $subject, $body, $from); // Send a copy if requested: - if ($edit['copy']) { + if ($form_values['copy']) { drupal_mail('contact-user-copy', $from, $subject, $body, $from); } @@ -503,15 +503,15 @@ function contact_mail_page_validate($form_id, $form_values) { /** * Process the site-wide contact page form submission. */ -function contact_mail_page_submit($form_id, $edit) { +function contact_mail_page_submit($form_id, $form_values) { // E-mail address of the sender: as the form field is a text field, // all instances of \r and \n have been automatically stripped from it. - $from = $edit['mail']; + $from = $form_values['mail']; // Compose the body: - $message[] = t("%name sent a message using the contact form at %form.", array('%name' => $edit['name'], '%form' => url($_GET['q'], NULL, NULL, TRUE))); - $message[] = $edit['message']; + $message[] = t("%name sent a message using the contact form at %form.", array('%name' => $form_values['name'], '%form' => url($_GET['q'], NULL, NULL, TRUE))); + $message[] = $form_values['message']; // Tidy up the body: foreach ($message as $key => $value) { @@ -519,10 +519,10 @@ function contact_mail_page_submit($form_id, $edit) { } // Load the category information: - $contact = db_fetch_object(db_query("SELECT * FROM {contact} WHERE cid = %d", $edit['cid'])); + $contact = db_fetch_object(db_query("SELECT * FROM {contact} WHERE cid = %d", $form_values['cid'])); // Format the category: - $subject = t('[%category] %subject', array('%category' => $contact->category, '%subject' => $edit['subject'])); + $subject = t('[%category] %subject', array('%category' => $contact->category, '%subject' => $form_values['subject'])); // Prepare the body: $body = implode("\n\n", $message); @@ -531,7 +531,7 @@ function contact_mail_page_submit($form_id, $edit) { drupal_mail('contact-page-mail', $contact->recipients, $subject, $body, $from); // If the user requests it, send a copy. - if ($edit['copy']) { + if ($form_values['copy']) { drupal_mail('contact-page-copy', $from, $subject, $body, $from); } @@ -542,7 +542,7 @@ function contact_mail_page_submit($form_id, $edit) { // Log the operation: flood_register_event('contact'); - watchdog('mail', t('%name-from sent an e-mail regarding %category.', array('%name-from' => $edit['name'] ." <$from>", '%category' => $contact->category))); + watchdog('mail', t('%name-from sent an e-mail regarding %category.', array('%name-from' => $form_values['name'] ." <$from>", '%category' => $contact->category))); // Update user: drupal_set_message(t('Your message has been sent.')); diff --git a/modules/node/node.module b/modules/node/node.module index bc76dacc7..0f2d24dbe 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1389,11 +1389,11 @@ function node_filter_form_submit() { /** * Submit the node administration update form. */ -function node_admin_nodes_submit($form_id, $edit) { +function node_admin_nodes_submit($form_id, $form_values) { $operations = module_invoke_all('node_operations'); - $operation = $operations[$edit['operation']]; + $operation = $operations[$form_values['operation']]; // Filter out unchecked nodes - $nodes = array_filter($edit['nodes']); + $nodes = array_filter($form_values['nodes']); if ($function = $operation['callback']) { // Add in callback arguments if present. if (isset($operation['callback arguments'])) { @@ -1409,8 +1409,8 @@ function node_admin_nodes_submit($form_id, $edit) { } } -function node_admin_nodes_validate($form_id, $edit) { - $nodes = array_filter($edit['nodes']); +function node_admin_nodes_validate($form_id, $form_values) { + $nodes = array_filter($form_values['nodes']); if (count($nodes) == 0) { form_set_error('', t('No items selected.')); } @@ -1515,9 +1515,9 @@ function node_multiple_delete_confirm() { t('Delete all'), t('Cancel')); } -function node_multiple_delete_confirm_submit($form_id, $edit) { - if ($edit['confirm']) { - foreach ($edit['nodes'] as $nid => $value) { +function node_multiple_delete_confirm_submit($form_id, $form_values) { + if ($form_values['confirm']) { + foreach ($form_values['nodes'] as $nid => $value) { node_delete($nid); } drupal_set_message(t('The items have been deleted.')); @@ -2113,11 +2113,11 @@ function theme_node_log_message($log) { return '<div class="log"><div class="title">'. t('Log') .':</div>'. $log .'</div>'; } -function node_form_submit($form_id, $edit) { +function node_form_submit($form_id, $form_values) { global $user; // Fix up the node when required: - $node = node_submit($edit); + $node = node_submit($form_values); // Prepare the node's body: if ($node->nid) { diff --git a/modules/path/path.module b/modules/path/path.module index 1fcc5b000..bd97ac45f 100644 --- a/modules/path/path.module +++ b/modules/path/path.module @@ -340,10 +340,10 @@ function path_load($pid) { /** * Verify that a new URL alias is valid */ -function path_form_validate($form_id, $edit) { - $src = $edit['src']; - $dst = $edit['dst']; - $pid = $edit['pid']; +function path_form_validate($form_id, $form_values) { + $src = $form_values['src']; + $dst = $form_values['dst']; + $pid = $form_values['pid']; if (!valid_url($src)) { form_set_error('src', t('The system path %path is invalid.', array('%path' => $src))); @@ -361,8 +361,8 @@ function path_form_validate($form_id, $edit) { /** * Save a new URL alias to the database. */ -function path_form_submit($form_id, $edit) { - path_set_alias($edit['src'], $edit['dst'], $edit['pid']); +function path_form_submit($form_id, $form_values) { + path_set_alias($form_values['src'], $form_values['dst'], $form_values['pid']); drupal_set_message(t('The alias has been saved.')); return 'admin/build/path'; diff --git a/modules/search/search.module b/modules/search/search.module index 9df070d8d..d23ef0a4c 100644 --- a/modules/search/search.module +++ b/modules/search/search.module @@ -197,15 +197,15 @@ function search_menu($may_cache) { } /** - * Implementation of hook_validate(). + * Validate callback. */ -function search_admin_settings_validate($form_id, &$form) { +function search_admin_settings_validate($form_id, $form_values) { if ($_POST['op'] == t('Re-index site')) { drupal_goto('admin/settings/search/wipe'); } // If these settings change, the index needs to be rebuilt. - if ((variable_get('minimum_word_size', 3) != $form['minimum_word_size']) || - (variable_get('overlap_cjk', TRUE) != $form['overlap_cjk'])) { + if ((variable_get('minimum_word_size', 3) != $form_values['minimum_word_size']) || + (variable_get('overlap_cjk', TRUE) != $form_values['overlap_cjk'])) { drupal_set_message(t('The index will be rebuilt.')); search_wipe(); } diff --git a/modules/system/system.module b/modules/system/system.module index 4a9e79ecf..a700c0435 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -1081,19 +1081,19 @@ function system_settings_form($form) { return $form; } -function system_theme_settings_submit($form_id, $values) { +function system_theme_settings_submit($form_id, $form_values) { $op = isset($_POST['op']) ? $_POST['op'] : ''; - $key = $values['var']; + $key = $form_values['var']; // Exclude unnecessary elements. - unset($values['var'], $values['submit'], $values['reset'], $values['form_id']); + unset($form_values['var'], $form_values['submit'], $form_values['reset'], $form_values['form_id']); if ($op == t('Reset to defaults')) { variable_del($key); drupal_set_message(t('The configuration options have been reset to their default values.')); } else { - variable_set($key, $values); + variable_set($key, $form_values); drupal_set_message(t('The configuration options have been saved.')); } } @@ -1105,18 +1105,18 @@ function system_theme_settings_submit($form_id, $values) { * add an array_filter value to your form. * */ -function system_settings_form_submit($form_id, $values) { +function system_settings_form_submit($form_id, $form_values) { $op = isset($_POST['op']) ? $_POST['op'] : ''; // Exclude unnecessary elements. - unset($values['submit'], $values['reset'], $values['form_id']); + unset($form_values['submit'], $form_values['reset'], $form_values['form_id']); - foreach ($values as $key => $value) { + foreach ($form_values as $key => $value) { if ($op == t('Reset to defaults')) { variable_del($key); } else { - if (is_array($value) && isset($values['array_filter'])) { + if (is_array($value) && isset($form_values['array_filter'])) { $value = array_keys(array_filter($value)); } variable_set($key, $value); @@ -1187,15 +1187,15 @@ function theme_system_themes($form) { } -function system_themes_submit($form_id, $values) { +function system_themes_submit($form_id, $form_values) { db_query("UPDATE {system} SET status = 0 WHERE type = 'theme'"); if ($_POST['op'] == t('Save configuration')) { - if (is_array($values['status'])) { - foreach ($values['status'] as $key => $choice) { + if (is_array($form_values['status'])) { + foreach ($form_values['status'] as $key => $choice) { // Always enable the default theme, despite its status checkbox being checked: - if ($choice || $values['theme_default'] == $key) { + if ($choice || $form_values['theme_default'] == $key) { // If theme status is being set to 1 from 0, initialize block data for this theme if necessary. if (db_num_rows(db_query("SELECT status FROM {system} WHERE type = 'theme' AND name = '%s' AND status = 0", $key))) { system_initialize_theme_blocks($key); @@ -1204,7 +1204,7 @@ function system_themes_submit($form_id, $values) { } } } - variable_set('theme_default', $values['theme_default']); + variable_set('theme_default', $form_values['theme_default']); } else { variable_del('theme_default'); @@ -1286,12 +1286,12 @@ function theme_system_modules($form) { } -function system_modules_submit($form_id, $edit) { +function system_modules_submit($form_id, $form_values) { include_once './includes/install.inc'; $new_modules = array(); // Enable/disable modules that have already been installed - foreach ($edit['status'] as $key => $choice) { + foreach ($form_values['status'] as $key => $choice) { if ($choice) { if (drupal_get_installed_schema_version($key) == SCHEMA_UNINSTALLED) { $new_modules[] = $key; @@ -1314,8 +1314,8 @@ function system_modules_submit($form_id, $edit) { } } - if (is_array($edit['throttle'])) { - foreach ($edit['throttle'] as $key => $choice) { + if (is_array($form_values['throttle'])) { + foreach ($form_values['throttle'] as $key => $choice) { if ($choice) { db_query("UPDATE {system} SET throttle = 1 WHERE type = 'module' and name = '%s'", $key); } diff --git a/modules/user/user.module b/modules/user/user.module index b61ddfd4a..9590a6aad 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -1552,36 +1552,36 @@ function user_admin_access_check() { return $output; } -function user_admin_access_check_validate($form_id, $edit) { - if (empty($edit['test'])) { - form_set_error($edit['type'], t('No value entered. Please enter a test string and try again.')); +function user_admin_access_check_validate($form_id, $form_values) { + if (empty($form_values['test'])) { + form_set_error($form_values['type'], t('No value entered. Please enter a test string and try again.')); } } -function user_admin_access_check_submit($form_id, $edit) { - switch ($edit['type']) { +function user_admin_access_check_submit($form_id, $form_values) { + switch ($form_values['type']) { case 'user': - if (drupal_is_denied('user', $edit['test'])) { - drupal_set_message(t('The username %name is not allowed.', array('%name' => $edit['test']))); + if (drupal_is_denied('user', $form_values['test'])) { + drupal_set_message(t('The username %name is not allowed.', array('%name' => $form_values['test']))); } else { - drupal_set_message(t('The username %name is allowed.', array('%name' => $edit['test']))); + drupal_set_message(t('The username %name is allowed.', array('%name' => $form_values['test']))); } break; case 'mail': - if (drupal_is_denied('mail', $edit['test'])) { - drupal_set_message(t('The e-mail address %mail is not allowed.', array('%mail' => $edit['test']))); + if (drupal_is_denied('mail', $form_values['test'])) { + drupal_set_message(t('The e-mail address %mail is not allowed.', array('%mail' => $form_values['test']))); } else { - drupal_set_message(t('The e-mail address %mail is allowed.', array('%mail' => $edit['test']))); + drupal_set_message(t('The e-mail address %mail is allowed.', array('%mail' => $form_values['test']))); } break; case 'host': - if (drupal_is_denied('host', $edit['test'])) { - drupal_set_message(t('The hostname %host is not allowed.', array('%host' => $edit['test']))); + if (drupal_is_denied('host', $form_values['test'])) { + drupal_set_message(t('The hostname %host is not allowed.', array('%host' => $form_values['test']))); } else { - drupal_set_message(t('The hostname %host is allowed.', array('%host' => $edit['test']))); + drupal_set_message(t('The hostname %host is allowed.', array('%host' => $form_values['test']))); } break; default: @@ -1629,8 +1629,8 @@ function user_admin_access_delete_confirm($aid = 0) { return $output; } -function user_admin_access_delete_confirm_submit($form_id, $edit) { - db_query('DELETE FROM {access} WHERE aid = %d', $edit['aid']); +function user_admin_access_delete_confirm_submit($form_id, $form_values) { + db_query('DELETE FROM {access} WHERE aid = %d', $form_values['aid']); drupal_set_message(t('The access rule has been deleted.')); return 'admin/user/rules'; } @@ -1825,21 +1825,21 @@ function theme_user_admin_perm($form) { return $output; } -function user_admin_perm_submit($form_id, $edit) { +function user_admin_perm_submit($form_id, $form_values) { // Save permissions: $result = db_query('SELECT * FROM {role}'); while ($role = db_fetch_object($result)) { - if(isset($edit[$role->rid])) { + if(isset($form_values[$role->rid])) { // Delete, so if we clear every checkbox we reset that role; // otherwise permissions are active and denied everywhere. db_query('DELETE FROM {permission} WHERE rid = %d', $role->rid); - foreach ($edit[$role->rid] as $key => $value) { + foreach ($form_values[$role->rid] as $key => $value) { if (!$value) { - unset($edit[$role->rid][$key]); + unset($form_values[$role->rid][$key]); } } - if (count($edit[$role->rid])) { - db_query("INSERT INTO {permission} (rid, perm) VALUES (%d, '%s')", $role->rid, implode(', ', array_keys($edit[$role->rid]))); + if (count($form_values[$role->rid])) { + db_query("INSERT INTO {permission} (rid, perm) VALUES (%d, '%s')", $role->rid, implode(', ', array_keys($form_values[$role->rid]))); } } } @@ -2029,11 +2029,11 @@ function theme_user_admin_account($form) { /** * Submit the user administration update form. */ -function user_admin_account_submit($form_id, $edit) { +function user_admin_account_submit($form_id, $form_values) { $operations = module_invoke_all('user_operations'); - $operation = $operations[$edit['operation']]; + $operation = $operations[$form_values['operation']]; // Filter out unchecked accounts. - $accounts = array_filter($edit['accounts']); + $accounts = array_filter($form_values['accounts']); if ($function = $operation['callback']) { // Add in callback arguments if present. if (isset($operation['callback arguments'])) { @@ -2049,9 +2049,9 @@ function user_admin_account_submit($form_id, $edit) { } } -function user_admin_account_validate($form_id, $edit) { - $edit['accounts'] = array_filter($edit['accounts']); - if (count($edit['accounts']) == 0) { +function user_admin_account_validate($form_id, $form_values) { + $form_values['accounts'] = array_filter($form_values['accounts']); + if (count($form_values['accounts']) == 0) { form_set_error('', t('No users selected.')); } } @@ -2163,10 +2163,10 @@ function user_multiple_delete_confirm() { t('Delete all'), t('Cancel')); } -function user_multiple_delete_confirm_submit($form_id, $edit) { - if ($edit['confirm']) { - foreach ($edit['accounts'] as $uid => $value) { - user_delete($edit, $uid); +function user_multiple_delete_confirm_submit($form_id, $form_values) { + if ($form_values['confirm']) { + foreach ($form_values['accounts'] as $uid => $value) { + user_delete($form_values, $uid); } drupal_set_message(t('The users have been deleted.')); } diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module index dd91c7931..883d11945 100644 --- a/modules/watchdog/watchdog.module +++ b/modules/watchdog/watchdog.module @@ -192,8 +192,7 @@ function theme_watchdog_form_overview($form) { return '<div class="container-inline">'. drupal_render($form) .'</div>'; } -function watchdog_form_overview_submit($form_id, $form) { - global $form_values; +function watchdog_form_overview_submit($form_id, $form_values) { $_SESSION['watchdog_overview_filter'] = $form_values['filter']; } |