From 05a708fb06137758cf7a15a623b4813af2fc005f Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Wed, 31 Jan 2007 15:49:26 +0000 Subject: - Patch #112715 by chx, webchick, asimmonds, et al: fixing E_ALL notices. Thanks. --- modules/aggregator/aggregator.module | 8 ++++-- modules/block/block.module | 10 +++---- modules/blog/blog.module | 6 ++-- modules/book/book.module | 7 +++-- modules/comment/comment.module | 19 ++++++------ modules/contact/contact.module | 2 +- modules/filter/filter.module | 9 +++--- modules/forum/forum.module | 8 +++--- modules/locale/locale.module | 2 +- modules/node/node.module | 32 ++++++++++++--------- modules/path/path.module | 7 +++-- modules/profile/profile.module | 3 ++ modules/statistics/statistics.module | 7 ++++- modules/system/system.install | 2 +- modules/system/system.module | 56 ++++++++++++++++++++---------------- modules/taxonomy/taxonomy.module | 24 +++++++--------- modules/upload/upload.module | 10 +++---- modules/user/user.module | 31 +++++++++++--------- modules/watchdog/watchdog.module | 3 +- 19 files changed, 137 insertions(+), 109 deletions(-) (limited to 'modules') diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module index 9f2712990..ca9b693fb 100644 --- a/modules/aggregator/aggregator.module +++ b/modules/aggregator/aggregator.module @@ -300,7 +300,9 @@ function aggregator_block($op = 'list', $delta = 0, $edit = array()) { $block['content'] = theme('item_list', $items) . $read_more; } } - return $block; + if (isset($block)) { + return $block; + } } } @@ -1102,7 +1104,9 @@ function _aggregator_page_list($sql, $op, $header = '') { } $output .= ''; $output .= $form['pager']['#value']; - $output .= $form['feed_icon']['#value']; + if (isset($form['feed_icon']['#value'])) { + $output .= $form['feed_icon']['#value']; + } return $output; } } diff --git a/modules/block/block.module b/modules/block/block.module index e7936fef9..d0311a206 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -160,7 +160,7 @@ function _block_rehash() { $block['module'] = $module; $block['delta'] = $delta; // If previously written to database, load values. - if ($old_blocks[$module][$delta]) { + if (!empty($old_blocks[$module][$delta])) { $block['status'] = $old_blocks[$module][$delta]->status; $block['weight'] = $old_blocks[$module][$delta]->weight; $block['region'] = $old_blocks[$module][$delta]->region; @@ -310,7 +310,7 @@ function theme_block_admin_display($form) { foreach (element_children($form) as $i) { $block = &$form[$i]; // Only take form elements that are blocks. - if (is_array($block['info'])) { + if (isset($block['info'])) { // Fetch values $region = $block['region']['#default_value']; $status = $region != BLOCK_REGION_NONE; @@ -337,7 +337,7 @@ function theme_block_admin_display($form) { $row[] = drupal_render($block['throttle']); } $row[] = drupal_render($block['configure']); - $row[] = $block['delete'] ? drupal_render($block['delete']) : ''; + $row[] = !empty($block['delete']) ? drupal_render($block['delete']) : ''; $rows[] = $row; } } @@ -624,14 +624,14 @@ function block_user($type, $edit, &$user, $category = NULL) { } } - if ($return) { + if (!empty($return)) { return $form; } } break; case 'validate': - if (!$edit['block']) { + if (empty($edit['block'])) { $edit['block'] = array(); } return $edit; diff --git a/modules/blog/blog.module b/modules/blog/blog.module index d3e4a49c8..5b853ddbe 100644 --- a/modules/blog/blog.module +++ b/modules/blog/blog.module @@ -185,7 +185,7 @@ function blog_page_last() { */ function blog_form(&$node) { global $nid; - $iid = $_GET['iid']; + $iid = isset($_GET['iid']) ? (int)$_GET['iid'] : 0; $type = node_get_types('type', $node); @@ -207,8 +207,8 @@ function blog_form(&$node) { } - $form['title'] = array('#type' => 'textfield', '#title' => check_plain($type->title_label), '#required' => TRUE, '#default_value' => $node->title, '#weight' => -5); - $form['body_filter']['body'] = array('#type' => 'textarea', '#title' => check_plain($type->body_label), '#default_value' => $node->body, '#rows' => 20, '#required' => TRUE); + $form['title'] = array('#type' => 'textfield', '#title' => check_plain($type->title_label), '#required' => TRUE, '#default_value' => !empty($node->title) ? $node->title : NULL, '#weight' => -5); + $form['body_filter']['body'] = array('#type' => 'textarea', '#title' => check_plain($type->body_label), '#default_value' => !empty($node->body) ? $node->title : NULL, '#rows' => 20, '#required' => TRUE); $form['body_filter']['filter'] = filter_form($node->format); return $form; } diff --git a/modules/book/book.module b/modules/book/book.module index 8216d617a..d1913bc2e 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -445,7 +445,7 @@ function book_nodeapi(&$node, $op, $teaser, $page) { break; case 'update': if (isset($node->parent)) { - if ($node->revision) { + if (!empty($node->revision)) { db_query("INSERT INTO {book} (nid, vid, parent, weight) VALUES (%d, %d, %d, %d)", $node->nid, $node->vid, $node->parent, $node->weight); } else { @@ -507,7 +507,7 @@ function theme_book_navigation($node) { * This is a helper function for book_toc(). */ function book_toc_recurse($nid, $indent, $toc, $children, $exclude) { - if ($children[$nid]) { + if (!empty($children[$nid])) { foreach ($children[$nid] as $foo => $node) { if (!$exclude || $exclude != $node->nid) { $toc[$node->nid] = $indent .' '. $node->title; @@ -527,7 +527,7 @@ function book_toc($exclude = 0) { $children = array(); while ($node = db_fetch_object($result)) { - if (!$children[$node->parent]) { + if (empty($children[$node->parent])) { $children[$node->parent] = array(); } $children[$node->parent][] = $node; @@ -958,6 +958,7 @@ function book_admin($nid = 0) { */ function book_admin_overview() { $result = db_query(db_rewrite_sql('SELECT n.nid, n.title, b.weight FROM {node} n INNER JOIN {book} b ON n.vid = b.vid WHERE b.parent = 0 ORDER BY b.weight, n.title')); + $rows = array(); while ($book = db_fetch_object($result)) { $rows[] = array(l($book->title, "node/$book->nid"), l(t('outline'), "admin/content/book/$book->nid")); } diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 8e7a2e937..f92467c4a 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -791,6 +791,7 @@ function comment_save($edit) { $edit['name'] = $user->name; } + $edit += array('mail' => '', 'homepage' => ''); db_query("INSERT INTO {comments} (cid, nid, pid, uid, subject, comment, format, hostname, timestamp, status, score, users, thread, name, mail, homepage) VALUES (%d, %d, %d, %d, '%s', '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s')", $edit['cid'], $edit['nid'], $edit['pid'], $edit['uid'], $edit['subject'], $edit['comment'], $edit['format'], $_SERVER['REMOTE_ADDR'], $edit['timestamp'], $status, $score, $users, $thread, $edit['name'], $edit['mail'], $edit['homepage']); _comment_update_node_statistics($edit['nid']); @@ -1150,7 +1151,7 @@ function comment_operations($action = NULL) { function comment_admin($type = 'new') { $edit = $_POST; - if ($edit['operation'] == 'delete' && $edit['comments']) { + if (isset($edit['operation']) && ($edit['operation'] == 'delete') && $edit['comments']) { return drupal_get_form('comment_multiple_delete_confirm'); } else { @@ -1192,7 +1193,7 @@ function comment_admin_overview($type = 'new', $arg) { $form['timestamp'][$comment->cid] = array('#value' => format_date($comment->timestamp, 'small')); $form['operations'][$comment->cid] = array('#value' => l(t('edit'), 'comment/edit/'. $comment->cid, array(), $destination)); } - $form['comments'] = array('#type' => 'checkboxes', '#options' => $comments); + $form['comments'] = array('#type' => 'checkboxes', '#options' => isset($comments) ? $comments: array()); $form['pager'] = array('#value' => theme('pager', NULL, 50, 0)); return $form; } @@ -1431,7 +1432,7 @@ function comment_form($edit, $title = NULL) { $op = isset($_POST['op']) ? $_POST['op'] : ''; if ($user->uid) { - if ($edit['cid'] && user_access('administer comments')) { + if (!empty($edit['cid']) && user_access('administer comments')) { if ($edit['author']) { $author = $edit['author']; } @@ -1537,19 +1538,19 @@ function comment_form($edit, $title = NULL) { } if (variable_get('comment_subject_field', 1) == 1) { - $form['subject'] = array('#type' => 'textfield', '#title' => t('Subject'), '#maxlength' => 64, '#default_value' => $edit['subject']); + $form['subject'] = array('#type' => 'textfield', '#title' => t('Subject'), '#maxlength' => 64, '#default_value' => !empty($edit['subject']) ? $edit['subject'] : ''); } - $form['comment_filter']['comment'] = array('#type' => 'textarea', '#title' => t('Comment'), '#rows' => 15, '#default_value' => $edit['comment'] ? $edit['comment'] : $user->signature, '#required' => TRUE); + $form['comment_filter']['comment'] = array('#type' => 'textarea', '#title' => t('Comment'), '#rows' => 15, '#default_value' => !empty($edit['comment']) ? $edit['comment'] : $user->signature, '#required' => TRUE); if (!isset($edit['format'])) { $edit['format'] = FILTER_FORMAT_DEFAULT; } $form['comment_filter']['format'] = filter_form($edit['format']); - $form['cid'] = array('#type' => 'value', '#value' => $edit['cid']); + $form['cid'] = array('#type' => 'value', '#value' => !empty($edit['cid']) ? $edit['cid'] : NULL); $form['pid'] = array('#type' => 'value', '#value' => $edit['pid']); $form['nid'] = array('#type' => 'value', '#value' => $edit['nid']); - $form['uid'] = array('#type' => 'value', '#value' => $edit['uid']); + $form['uid'] = array('#type' => 'value', '#value' => !empty($edit['uid']) ? $edit['uid'] : NULL); $form['preview'] = array('#type' => 'button', '#value' => t('Preview comment'), '#weight' => 19); $form['#token'] = 'comment'. $edit['nid'] . $edit['pid']; @@ -1565,7 +1566,7 @@ function comment_form($edit, $title = NULL) { $form['#after_build'] = array('comment_form_add_preview'); } - if ($_REQUEST['destination']) { + if (!empty($_REQUEST['destination'])) { $form['#attributes']['destination'] = $_REQUEST['destination']; } @@ -1603,7 +1604,7 @@ function comment_form_add_preview($form, $edit) { $comment->uid = $account->uid; $comment->name = check_plain($account->name); } - $comment->timestamp = $edit['timestamp'] ? $edit['timestamp'] : time(); + $comment->timestamp = !empty($edit['timestamp']) ? $edit['timestamp'] : time(); // Preview the comment with security check. if (!form_get_errors()) { diff --git a/modules/contact/contact.module b/modules/contact/contact.module index 7dcc0e894..909b90e6f 100644 --- a/modules/contact/contact.module +++ b/modules/contact/contact.module @@ -116,7 +116,7 @@ function contact_user($type, &$edit, &$user, $category = NULL) { ); $form['contact']['contact'] = array('#type' => 'checkbox', '#title' => t('Personal contact form'), - '#default_value' => $edit['contact'], + '#default_value' => !empty($edit['contact']) ? $edit['contact'] : FALSE, '#description' => t('Allow other users to contact you by e-mail via your personal contact form. Note that while your e-mail address is not made public to other members of the community, privileged users such as site administrators are able to contact you even if you choose not to enable this feature.', array('@url' => url("user/$user->uid/contact"))), ); return $form; diff --git a/modules/filter/filter.module b/modules/filter/filter.module index 0892b5541..83fa3ba74 100644 --- a/modules/filter/filter.module +++ b/modules/filter/filter.module @@ -507,12 +507,11 @@ function filter_admin_format_form_submit($form_id, $form_values) { cache_clear_all($format .':', 'cache_filter', TRUE); // If a new filter was added, return to the main list of filters. Otherwise, stay on edit filter page to show new changes. - if ($new) { - return 'admin/settings/filters/'; - } - else { - return 'admin/settings/filters/'. $format; + $return = 'admin/settings/filters'; + if (!empty($new)) { + $return .= '/'. $format; } + return $return; } /** diff --git a/modules/forum/forum.module b/modules/forum/forum.module index 23cab35e8..de845a837 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -388,16 +388,16 @@ function forum_update($node) { */ function forum_form(&$node) { $type = node_get_types('type', $node); - $form['title'] = array('#type' => 'textfield', '#title' => check_plain($type->title_label), '#default_value' => $node->title, '#required' => TRUE, '#weight' => -5); + $form['title'] = array('#type' => 'textfield', '#title' => check_plain($type->title_label), '#default_value' => !empty($node->title) ? $node->title : '', '#required' => TRUE, '#weight' => -5); - if ($node->nid) { + if (!empty($node->nid)) { $forum_terms = taxonomy_node_get_terms_by_vocabulary(_forum_get_vid(), $node->nid); // if editing, give option to leave shadows $shadow = (count($forum_terms) > 1); $form['shadow'] = array('#type' => 'checkbox', '#title' => t('Leave shadow copy'), '#default_value' => $shadow, '#description' => t('If you move this topic, you can leave a link in the old forum to the new forum.')); } - $form['body_filter']['body'] = array('#type' => 'textarea', '#title' => check_plain($type->body_label), '#default_value' => $node->body, '#rows' => 20, '#required' => TRUE); + $form['body_filter']['body'] = array('#type' => 'textarea', '#title' => check_plain($type->body_label), '#default_value' => !empty($node->body) ? $node->body : '', '#rows' => 20, '#required' => TRUE); $form['body_filter']['format'] = filter_form($node->format); return $form; @@ -407,7 +407,7 @@ function forum_form(&$node) { * Implementation of hook_prepare; assign forum taxonomy when adding a topic from within a forum. */ function forum_prepare(&$node) { - if (!$node->nid) { + if (empty($node->nid)) { // new topic $node->taxonomy[arg(3)]->vid = _forum_get_vid(); $node->taxonomy[arg(3)]->tid = arg(3); diff --git a/modules/locale/locale.module b/modules/locale/locale.module index 7b22ca5c4..dd4c88093 100644 --- a/modules/locale/locale.module +++ b/modules/locale/locale.module @@ -240,7 +240,7 @@ function locale_supported_languages($reset = FALSE, $getall = FALSE) { unset($enabled); unset($all); } - if (is_null($enabled)) { + if (!isset($enabled)) { $enabled = $all = array(); $all['name'] = $all['formula'] = $enabled['name'] = $enabled['formula'] = array(); $result = db_query('SELECT locale, name, formula, enabled FROM {locales_meta} ORDER BY isdefault DESC, enabled DESC, name ASC'); diff --git a/modules/node/node.module b/modules/node/node.module index d136bde84..e560f79ec 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -41,7 +41,7 @@ function node_help($section) { if (arg(0) == 'node' && arg(1) == 'add' && $type = arg(2)) { $type = node_get_types('type', str_replace('-', '_', arg(2))); - return '

'. filter_xss_admin($type->help) .'

'; + return '

'. (isset($type->help) ? filter_xss_admin($type->help) : '') .'

'; } } @@ -564,7 +564,7 @@ function node_save(&$node) { } $node = $node_current; - if ($node->revision) { + if (!empty($node->revision)) { $node->old_vid = $node->vid; $node->vid = db_next_id('{node_revisions}_vid'); } @@ -617,7 +617,7 @@ function node_save(&$node) { } $node_table_values[] = $node->nid; $node_query = 'UPDATE {node} SET '. implode(', ', $arr) .' WHERE nid = %d'; - if ($node->revision) { + if (!empty($node->revision)) { $revisions_query = 'INSERT INTO {node_revisions} ('. implode(', ', array_keys($revisions_table_types)) .') VALUES ('. implode(', ', $revisions_table_types) .')'; } else { @@ -1393,6 +1393,7 @@ function node_filter_form() { * Theme node administration filter form. */ function theme_node_filter_form($form) { + $output = ''; $output .= '
'; $output .= drupal_render($form['filters']); $output .= '
'; @@ -1404,14 +1405,15 @@ function theme_node_filter_form($form) { * Theme node administration filter selector. */ function theme_node_filters($form) { + $output = ''; $output .= '