Commit cd430165 authored by drumm's avatar drumm

#73884 by RobRoy, various code cleanup.

parent 6839ce96
......@@ -333,7 +333,7 @@ function _form_validate($elements, $form_id = NULL) {
}
elseif (!isset($options[$elements['#value']])) {
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);
watchdog('form', t('Illegal choice %choice in %name element.', array('%choice' => theme_placeholder(check_plain($elements['#value'])), '%name' => theme('placeholder', empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title']))), WATCHDOG_ERROR);
}
}
}
......
......@@ -833,6 +833,8 @@ function aggregator_parse_feed(&$data, $feed) {
$items = array_reverse($items);
// Initialize variables
$title = $link = $author = $description = $guid = NULL;
foreach ($items as $item) {
unset($title, $link, $author, $description, $guid);
......@@ -1057,6 +1059,7 @@ function _aggregator_page_list($sql, $op, $header = '') {
$result = pager_query($sql, 20);
$categories = array();
$done = FALSE;
while ($item = db_fetch_object($result)) {
$form['items'][$item->iid] = array('#value' => theme('aggregator_page_item', $item));
$output .= $form['items'][$item->iid]['#value'];
......
......@@ -553,6 +553,7 @@ function book_toc_recurse($nid, $indent, $toc, $children, $exclude) {
function book_toc($exclude = 0) {
$result = db_query(db_rewrite_sql('SELECT n.nid, n.title, b.parent, b.weight FROM {node} n INNER JOIN {book} b ON n.vid = b.vid WHERE n.status = 1 ORDER BY b.weight, n.title'));
$children = array();
while ($node = db_fetch_object($result)) {
if (!$children[$node->parent]) {
$children[$node->parent] = array();
......
......@@ -1617,7 +1617,6 @@ function theme_comment_folded($comment) {
function theme_comment_flat_collapsed($comment) {
return theme('comment_view', $comment, '', 0);
return '';
}
function theme_comment_flat_expanded($comment) {
......
......@@ -846,7 +846,7 @@ function filter_form_validate($form) {
}
}
form_error($form, 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($form['#title']) ? $form['#parents'][0] : $form['#title']))), WATCHDOG_ERROR);
watchdog('form', t('Illegal choice %choice in %name element.', array('%choice' => theme('placeholder', check_plain($form[$key]['#value'])), '%name' => theme('placeholder', empty($form['#title']) ? $form['#parents'][0] : $form['#title']))), WATCHDOG_ERROR);
}
/**
......
......@@ -1060,6 +1060,7 @@ function theme_forum_topic_navigation($node) {
$sql = "SELECT n.nid, n.title, n.sticky, l.comment_count, l.last_comment_timestamp FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {term_node} r ON n.nid = r.nid AND r.tid = %d WHERE n.status = 1 AND n.type = 'forum' ORDER BY n.sticky DESC, ". _forum_get_topic_order_sql(variable_get('forum_order', 1));
$result = db_query(db_rewrite_sql($sql), $node->tid);
$stop = 0;
while ($topic = db_fetch_object($result)) {
if ($stop == 1) {
$next = new StdClass();
......
......@@ -54,10 +54,9 @@ function locale_help($section) {
*/
function locale_menu($may_cache) {
$items = array();
$access = user_access('administer locales');
if ($may_cache) {
$access = user_access('administer locales');
// Main admin menu item
$items[] = array('path' => 'admin/settings/locale',
'title' => t('localization'),
......
......@@ -570,6 +570,8 @@ function poll_update($node) {
db_query('DELETE FROM {poll_choices} WHERE nid = %d', $node->nid);
db_query('DELETE FROM {poll_votes} WHERE nid = %d', $node->nid);
$i = 0;
foreach ($node->choice as $choice) {
$chvotes = (int)$choice['chvotes'];
$chtext = $choice['chtext'];
......
......@@ -634,6 +634,7 @@ function profile_form_profile($edit, $user, $category) {
// Use LOWER('%s') instead of PHP's strtolower() to avoid UTF-8 conversion issues.
}
$w = 0;
while ($field = db_fetch_object($result)) {
$category = $field->category;
if (!isset($fields[$category])) {
......
......@@ -243,7 +243,7 @@ function search_admin_settings() {
* Menu callback: confirm wiping of the index.
*/
function search_wipe_confirm() {
return confirm_form('search_wipe_confirm', $form, t('Are you sure you want to re-index the site?'),
return confirm_form('search_wipe_confirm', array(), t('Are you sure you want to re-index the site?'),
'admin/settings/search', t(' The search index is not cleared but systematically updated to reflect the new settings. Searching will continue to work but new content won\'t be indexed until all existing content has been re-indexed. This action cannot be undone.'), t('Re-index site'), t('Cancel'));
}
......
......@@ -1088,6 +1088,7 @@ function user_pass_reset($uid, $timestamp, $hashed_pass, $action = NULL) {
// Now we can set the new user.
$user = $account;
// And proceed with normal login, going to user page.
$edit = array();
user_module_invoke('login', $edit, $user);
drupal_set_message(t('You have just used your one-time login link. It is no longer necessary to use this link to login. Please change your password.'));
drupal_goto('user/'. $user->uid .'/edit');
......@@ -1153,7 +1154,10 @@ function user_register() {
// Redirect back to page which initiated the create request; usually admin/user/user/create
$form['destination'] = array('#type' => 'hidden', '#value' => $_GET['q']);
}
$extra = _user_forms($null, $null, $null, 'register');
// Create a dummy variable for pass-by-reference parameters.
$null = NULL;
$extra = _user_forms($null, NULL, NULL, 'register');
// Remove form_group around default fields if there are no other groups.
if (!$extra) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment