Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.66 diff -u -r1.66 bootstrap.inc --- includes/bootstrap.inc 8 Sep 2005 19:17:34 -0000 1.66 +++ includes/bootstrap.inc 11 Sep 2005 15:38:28 -0000 @@ -148,7 +148,7 @@ function drupal_get_filename($type, $name, $filename = NULL) { static $files = array(); - if (!$files[$type]) { + if (!isset($files[$type])) { $files[$type] = array(); } Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.476 diff -u -r1.476 common.inc --- includes/common.inc 31 Aug 2005 18:37:30 -0000 1.476 +++ includes/common.inc 11 Sep 2005 18:05:11 -0000 @@ -54,9 +54,11 @@ function drupal_get_content($region = null, $delimiter = ' ') { $content = drupal_set_content(); if (isset($region)) { - if (is_array($content[$region])) { - return implode ($delimiter, $content[$region]); - } + if (isset($content[$region])) { + if (is_array($content[$region])) { + return implode ($delimiter, $content[$region]); + } + } } else { foreach (array_keys($content) as $region) { @@ -599,7 +601,7 @@ // Useful for e.g. XML/HTML 'lang' attributes. $languages = array('en' => 'English'); } - if ($user->uid && $languages[$user->language]) { + if ($user->uid && isset($languages[$user->language])) { return $user->language; } else { @@ -1130,7 +1132,7 @@ function form_group_collapsible($legend, $group, $collapsed = FALSE, $description = NULL, $attributes = NULL) { drupal_add_js('misc/collapse.js'); - $attributes['class'] .= ' collapsible'; + ($attributes == NULL) ? $attributes['class'] = 'collapsible' : $attributes['class'] .= ' collapsible'; if ($collapsed) { $attributes['class'] .= ' collapsed'; } Index: includes/menu.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/menu.inc,v retrieving revision 1.84 diff -u -r1.84 menu.inc --- includes/menu.inc 25 Aug 2005 21:14:16 -0000 1.84 +++ includes/menu.inc 11 Sep 2005 18:18:34 -0000 @@ -737,7 +737,18 @@ $a = &$menu['items'][$a]; $b = &$menu['items'][$b]; - return $a['weight'] < $b['weight'] ? -1 : ($a['weight'] > $b['weight'] ? 1 : ($a['title'] < $b['title'] ? -1 : 1)); + if ($a['weight'] < $b['weight']) { + return -1; + } + elseif ($a['weight'] > $b['weight']) { + return 1; + } + elseif (isset($a['title']) && isset($b['title']) && ($a['title'] < $b['title'])) { + return -1; + } + else { + return 1; + } } /** @@ -922,7 +933,7 @@ $_menu['items'][$mid]['access'] = $item['access']; $_menu['items'][$mid]['callback'] = $item['callback']; - $_menu['items'][$mid]['callback arguments'] = $item['callback arguments']; + isset($_menu['items'][$mid]['callback arguments']) ? $_menu['items'][$mid]['callback arguments'] = $item['callback arguments'] : $_menu['items'][$mid]['callback arguments'] = ''; } else { if (!array_key_exists('path', $item)) { Index: includes/pager.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/pager.inc,v retrieving revision 1.47 diff -u -r1.47 pager.inc --- includes/pager.inc 25 Aug 2005 21:14:16 -0000 1.47 +++ includes/pager.inc 11 Sep 2005 16:59:02 -0000 @@ -50,14 +50,16 @@ */ function pager_query($query, $limit = 10, $element = 0, $count_query = NULL) { global $pager_page_array, $pager_total, $pager_total_items; - $page = $_GET['page']; + $page = isset($_GET['page']) ? $_GET['page'] : ''; // Substitute in query arguments. $args = func_get_args(); $args = array_slice($args, 4); // Alternative syntax for '...' - if (is_array($args[0])) { - $args = $args[0]; + if (isset ($args[0])) { + if (is_array($args[0])) { + $args = $args[0]; + } } // Construct a count query if none was given. Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.258 diff -u -r1.258 theme.inc --- includes/theme.inc 8 Sep 2005 19:17:34 -0000 1.258 +++ includes/theme.inc 11 Sep 2005 16:42:43 -0000 @@ -316,7 +316,10 @@ // Get the amount of links to show, possibly expanding if there are more links defined than the count specifies. $count = variable_get($type . '_link_count', 5); - $count = ($count > sizeof($value['link'])) ? $count : sizeof($value['link']); + + if (isset($value['link'])) { + $count = ($count > sizeof($value['link'])) ? $count : sizeof($value['link']); + } if ($settings['toggle_' . $type . '_links']) { for ($i =0; $i < $count; $i++) { Index: modules/block.module =================================================================== RCS file: /cvs/drupal/drupal/modules/block.module,v retrieving revision 1.178 diff -u -r1.178 block.module --- modules/block.module 25 Aug 2005 21:14:16 -0000 1.178 +++ modules/block.module 11 Sep 2005 18:27:56 -0000 @@ -96,6 +96,8 @@ function block_block($op = 'list', $delta = 0, $edit = array()) { switch ($op) { case 'list': + $blocks = ''; + $result = db_query('SELECT bid, title, info FROM {boxes} ORDER BY title'); while ($block = db_fetch_object($result)) { $blocks[$block->bid]['info'] = $block->info ? check_plain($block->info) : check_plain($block->title); @@ -404,8 +406,8 @@ * Menu callback; displays the block overview page. */ function block_admin() { - $edit = $_POST['edit']; - $op = $_POST['op']; + $edit = isset($_POST['edit']) ? $_POST['edit'] : ''; + $op = isset($_POST['op']) ? $_POST['op'] : ''; if ($op == t('Save blocks')) { block_admin_save($edit); Index: modules/menu.module =================================================================== RCS file: /cvs/drupal/drupal/modules/menu.module,v retrieving revision 1.34 diff -u -r1.34 menu.module --- modules/menu.module 25 Aug 2005 21:14:16 -0000 1.34 +++ modules/menu.module 11 Sep 2005 18:10:20 -0000 @@ -99,8 +99,8 @@ if (user_access('administer menu')) { switch ($op) { case 'form post': - $edit = $_POST['edit']; - $edit['nid'] = $node->nid; + $edit = isset($_POST['edit']) ? $_POST['edit'] : ''; + $edit['nid'] = isset($node->nid) ? $node->nid : ''; return menu_node_form($edit); break; @@ -514,7 +514,7 @@ $options = array(); - if (isset($menu['items'][$pid]) && $menu['items'][$pid]['children']) { + if (isset($menu['items'][$pid]) && isset($menu['items'][$pid]['children'])) { usort($menu['items'][$pid]['children'], '_menu_sort'); foreach ($menu['items'][$pid]['children'] as $child) { if ($child != $mid) { @@ -548,17 +548,19 @@ } } - $group = form_textfield(t('Title'), 'menu][title', $item['title'], 60, 128, t('The name to display for this link.')); + $group = form_textfield(t('Title'), 'menu][title', isset($item['title']) ? $item['title'] : '', 60, 128, t('The name to display for this link.')); // Generate a list of possible parents (not including this item or descendants). - $options = menu_parent_options($edit['mid']); - $group .= form_select(t('Parent item'), 'menu][pid', $item['pid'], $options); - $group .= form_hidden('menu][description', $item['description']); - $group .= form_hidden('menu][path', $item['path']); - $group .= form_hidden('menu][weight', ($item['weight']) ? $item['weight'] : 0); - $group .= form_hidden('menu][mid', ($item['mid']) ? $item['mid'] : 0); - $group .= form_hidden('menu][type', ($item['type']) ? $item['type'] : MENU_CUSTOM_ITEM); - - if ($item['mid'] > 0) { + if (isset($edit['mid'])) { + $options = menu_parent_options($edit['mid']); + $group .= form_select(t('Parent item'), 'menu][pid', $item['pid'], $options); + $group .= form_hidden('menu][description', $item['description']); + $group .= form_hidden('menu][path', $item['path']); + $group .= form_hidden('menu][weight', ($item['weight']) ? $item['weight'] : 0); + $group .= form_hidden('menu][mid', ($item['mid']) ? $item['mid'] : 0); + $group .= form_hidden('menu][type', ($item['type']) ? $item['type'] : MENU_CUSTOM_ITEM); + } + + if (isset($item['mid']) && $item['mid'] > 0) { $group .= form_checkbox(t('Check to delete this menu item.'), 'menu][delete', 1, $item['delete'], null); } $form = form_group_collapsible(t('Menu item settings'), $group, TRUE); Index: modules/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node.module,v retrieving revision 1.527 diff -u -r1.527 node.module --- modules/node.module 2 Sep 2005 02:11:41 -0000 1.527 +++ modules/node.module 11 Sep 2005 17:51:40 -0000 @@ -120,7 +120,7 @@ $history[$nid] = db_fetch_object(db_query("SELECT timestamp FROM {history} WHERE uid = '$user->uid' AND nid = %d", $nid)); } - return ($history[$nid]->timestamp ? $history[$nid]->timestamp : 0); + return (isset($history[$nid]->timestamp) ? $history[$nid]->timestamp : 0); } /** @@ -353,7 +353,7 @@ if (is_numeric($param)) { $cachable = $revision == NULL; - if ($cachable && $nodes[$param]) { + if ($cachable && isset($nodes[$param])) { return $nodes[$param]; } $cond = 'n.nid = '. $param; @@ -1229,20 +1229,20 @@ // Auto-generate the teaser, but only if it hasn't been set (e.g. by a // module-provided 'teaser' form item). if (!isset($node->teaser)) { - $node->teaser = node_teaser($node->body, $node->format); + $node->teaser = isset($node->format) && isset($node->body) ? node_teaser($node->body, $node->format) : ''; } - if (node_last_changed($node->nid) > $node->changed) { + if (isset($node->nid) && (node_last_changed($node->nid) > $node->changed)) { form_set_error('changed', t('This content has been modified by another user, unable to save changes.')); } if (user_access('administer nodes')) { // Set up default values, if required. - if (!$node->created) { + if (!isset($node->created)) { $node->created = time(); } - if (!$node->date) { + if (!isset($node->date)) { $node->date = format_date($node->created, 'custom', 'Y-m-d H:i:s O'); } @@ -1299,8 +1299,13 @@ * Generate the node editing form. */ function node_form($edit) { + // Initialize variables + $output = ''; + $options = ''; + $extras = ''; + // Validate the node if we don't already know the errors. - if (!$edit->validated) { + if ((!isset($edit)) || (!isset($edit->validated)) || !$edit->validated) { $edit = node_validate($edit); } @@ -1351,13 +1356,13 @@ // Add the default fields. $output .= '
'; - $output .= form_textfield(t('Title'), 'title', $edit->title, 60, 128, NULL, NULL, TRUE); + $output .= form_textfield(t('Title'), 'title', isset($edit->title) ? $edit->title : '', 60, 128, NULL, NULL, TRUE); // Add the node-type-specific fields. $output .= $form; // Add the hidden fields. - if ($edit->nid) { + if (isset($edit->nid)) { $output .= form_hidden('nid', $edit->nid); } @@ -1367,11 +1372,11 @@ $output .= form_hidden('uid', $edit->uid); } - if ($edit->created) { + if (isset($edit->created)) { $output .= form_hidden('created', $edit->created); } - if ($edit->changed) { + if (isset($edit->changed)) { $output .= form_hidden('changed', $edit->changed); } @@ -1380,11 +1385,11 @@ // Add the buttons. $output .= form_submit(t('Preview')); - if ($edit->type && (($_POST['op'] == t('Preview') && !form_get_errors()) || !variable_get('node_preview', 0))) { + if ($edit->type && ((isset($_POST['op']) && $_POST['op'] == t('Preview') && !form_get_errors()) || !variable_get('node_preview', 0))) { $output .= form_submit(t('Submit')); } - if ($edit->nid && node_access('delete', $edit)) { + if (isset($edit->nid) && node_access('delete', $edit)) { $output .= form_submit(t('Delete')); } @@ -1406,10 +1411,10 @@ } $attributes = array('id' => 'node-form'); - if (is_array($param['options'])) { + if (isset($param['options']) && is_array($param['options'])) { $attributes = array_merge($param['options'], $attributes); } - return form($output, ($param['method'] ? $param['method'] : 'post'), $param['action'], $attributes); + return form($output, (isset($param['method']) ? $param['method'] : 'post'), isset($param['action']) ? $param['action'] : '', $attributes); } /** @@ -1418,7 +1423,7 @@ function node_add($type) { global $user; - $edit = $_POST['edit']; + $edit = isset($_POST['edit']) ? $_POST['edit'] : ''; // If a node type has been specified, validate its existence. if (array_key_exists($type, node_get_types()) && node_access('create', $type)) { @@ -1428,7 +1433,7 @@ // Allow the following fields to be initialized via $_GET (e.g. for use // with a "blog it" bookmarklet): foreach (array('title', 'teaser', 'body') as $field) { - if ($_GET['edit'][$field]) { + if (isset($_GET['edit'][$field])) { $node[$field] = $_GET['edit'][$field]; } } @@ -1665,8 +1670,8 @@ * Menu callback; dispatches control to the appropriate operation handler. */ function node_page() { - $op = $_POST['op'] ? $_POST['op'] : arg(1); - $edit = $_POST['edit']; + $op = isset($_POST['op']) ? $_POST['op'] : arg(1); + $edit = isset($_POST['edit']) ? $_POST['edit'] : ''; if (is_numeric($op)) { $op = (arg(2) && !is_numeric(arg(2))) ? arg(2) : 'view'; @@ -2015,7 +2020,7 @@ } } $sql .= implode(',', $grants) .') AND grant_view = 1'; - $result = db_query($sql, $node->nid); + $result = db_query($sql); $access = db_result($result); } Index: modules/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system.module,v retrieving revision 1.233 diff -u -r1.233 system.module --- modules/system.module 8 Sep 2005 20:25:08 -0000 1.233 +++ modules/system.module 11 Sep 2005 15:57:31 -0000 @@ -347,10 +347,10 @@ foreach ($themes as $theme) { foreach (file_scan_directory(dirname($theme->filename), 'style.css$') as $style) { $style->style = TRUE; - $style->template = $theme->template; + $style->template = isset($theme->template) ? $theme->template : FALSE; $style->name = basename(dirname($style->filename)); $style->owner = $theme->filename; - $style->prefix = $theme->template ? $theme->prefix : $theme->name; + $style->prefix = $style->template ? $theme->prefix : $theme->name; // do not double-insert styles with theme files in their directory if (array_key_exists($style->name, $themes)) { continue; @@ -552,8 +552,8 @@ } function system_listing_save($edit = array()) { - $op = $_POST['op']; - $edit = $_POST['edit']; + $op = isset($_POST['op']) ? $_POST['op'] : ''; + $edit = isset($_POST['edit']) ? $_POST['edit'] : ''; if ($op == t('Save configuration')) { db_query("UPDATE {system} SET status = 0 WHERE type = '%s'", $edit['type']); Index: modules/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user.module,v retrieving revision 1.509 diff -u -r1.509 user.module --- modules/user.module 8 Sep 2005 19:46:05 -0000 1.509 +++ modules/user.module 11 Sep 2005 18:23:19 -0000 @@ -606,7 +606,7 @@ $picture = variable_get('user_picture_default', ''); } - if ($picture) { + if (isset($picture)) { $alt = t('%user\'s picture', array('%user' => $account->name ? $account->name : variable_get('anonymous', 'Anonymous'))); $picture = theme('image', $picture, $alt, $alt, '', false); if ($account->uid) { @@ -1281,7 +1281,7 @@ foreach (module_list() as $module) { if ($data = module_invoke($module, 'user', 'view', '', $account)) { foreach ($data as $category => $content) { - $fields[$category] .= $content; + isset($fields[$category]) ? $fields[$category] .= $content : $fields[$category] = $content; } } } @@ -1297,8 +1297,8 @@ function user_page() { global $user; - $edit = $_POST['edit']; - $op = $_POST['op']; + $edit = isset($_POST['edit']) ? $_POST['edit'] : ''; + $op = isset($_POST['op']) ? $_POST['op'] : ''; if (empty($op)) { $op = arg(2) ? arg(2) : arg(1); @@ -1545,7 +1545,7 @@ * Menu callback: administer permissions. */ function user_admin_perm() { - $edit = $_POST['edit']; + $edit = isset($_POST['edit']) ? $_POST['edit'] : ''; if ($edit) { // Save permissions: $result = db_query('SELECT * FROM {role}'); Index: modules/watchdog.module =================================================================== RCS file: /cvs/drupal/drupal/modules/watchdog.module,v retrieving revision 1.126 diff -u -r1.126 watchdog.module --- modules/watchdog.module 25 Aug 2005 21:14:17 -0000 1.126 +++ modules/watchdog.module 11 Sep 2005 18:19:23 -0000 @@ -77,7 +77,7 @@ $_SESSION['watchdog_overview_filter'] = 'all'; } - $op = $_POST['op']; + $op = isset($_POST['op']) ? $_POST['op'] : ''; if ($op == t('Filter') && isset($_POST['edit']['filter'])) { $_SESSION['watchdog_overview_filter'] = $_POST['edit']['filter']; } Index: themes/engines/phptemplate/phptemplate.engine =================================================================== RCS file: /cvs/drupal/drupal/themes/engines/phptemplate/phptemplate.engine,v retrieving revision 1.17 diff -u -r1.17 phptemplate.engine --- themes/engines/phptemplate/phptemplate.engine 9 Sep 2005 05:32:31 -0000 1.17 +++ themes/engines/phptemplate/phptemplate.engine 11 Sep 2005 18:30:04 -0000 @@ -60,7 +60,7 @@ $variables = array_merge($variables, _phptemplate_variables($hook, $variables)); } - if ($variables['template_file']) { + if (isset($variables['template_file'])) { $file = $variables['template_file']; } @@ -86,13 +86,13 @@ function _phptemplate_default_variables($hook, $variables) { global $theme; static $count = array(); - $count[$hook] = is_int($count[$hook]) ? $count[$hook] : 1; + $count[$hook] = isset($count[$hook]) && is_int($count[$hook]) ? $count[$hook] : 1; $variables['zebra'] = ($count[$hook] % 2) ? 'odd' : 'even'; $variables['id'] = $count[$hook]++; global $sidebar_indicator; if ($hook == 'block') { - $count['block_counter'][$sidebar_indicator] = is_int($count['block_counter'][$sidebar_indicator]) ? $count['block_counter'][$sidebar_indicator] : 1; + $count['block_counter'][$sidebar_indicator] = isset($count['block_counter']) && is_int($count['block_counter'][$sidebar_indicator]) ? $count['block_counter'][$sidebar_indicator] : 1; $variables['block_zebra'] = ($count['block_counter'][$sidebar_indicator] % 2) ? 'odd' : 'even'; $variables['block_id'] = $count['block_counter'][$sidebar_indicator]++; } @@ -104,7 +104,7 @@ // This pre-loading is necessary because phptemplate uses variable names different from // the region names, e.g., 'sidebar_left' instead of 'left'. if (!in_array($region, array('left', 'right', 'footer'))) { - $variables[$region] .= theme('blocks', $region); + isset($variables[$region]) ? $variables[$region] .= theme('blocks', $region) : $variables[$region] = theme('blocks', $region); } } } @@ -194,7 +194,7 @@ 'layout' => $layout, 'logo' => theme_get_setting('logo'), 'messages' => theme('status_messages'), - 'mission' => $mission, + 'mission' => isset($mission) ? $mission : '', 'onload_attributes' => theme('onload_attribute'), 'primary_links' => theme_get_setting('primary_links'), 'site_name' => (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : ''),