diff options
-rw-r--r-- | includes/file.inc | 4 | ||||
-rw-r--r-- | includes/menu.inc | 2 | ||||
-rw-r--r-- | includes/module.inc | 3 | ||||
-rw-r--r-- | includes/theme.inc | 1 | ||||
-rw-r--r-- | modules/block/block.module | 10 | ||||
-rw-r--r-- | modules/book/book.module | 2 | ||||
-rw-r--r-- | modules/node/node.module | 12 | ||||
-rw-r--r-- | modules/system/system.module | 26 | ||||
-rw-r--r-- | modules/taxonomy/taxonomy.module | 2 | ||||
-rw-r--r-- | modules/upload/upload.module | 4 | ||||
-rw-r--r-- | modules/user/user.module | 17 | ||||
-rw-r--r-- | themes/engines/phptemplate/phptemplate.engine | 4 |
12 files changed, 48 insertions, 39 deletions
diff --git a/includes/file.inc b/includes/file.inc index 702641312..e7c97a316 100644 --- a/includes/file.inc +++ b/includes/file.inc @@ -193,7 +193,7 @@ function file_check_upload($source = 'upload') { } // If a file was uploaded, process it. - if ($_FILES["files"]["name"][$source] && is_uploaded_file($_FILES["files"]["tmp_name"][$source])) { + if (isset($_FILES["files"]["name"][$source]) && is_uploaded_file($_FILES["files"]["tmp_name"][$source])) { // Check for file upload errors and return FALSE if a // lower level system error occurred. @@ -253,7 +253,7 @@ function file_check_upload($source = 'upload') { else { // In case of previews return previous file object. - if (file_exists($_SESSION['file_uploads'][$source]->filepath)) { + if (isset($_SESSION['file_uploads'][$source]->filepath) && file_exists($_SESSION['file_uploads'][$source]->filepath)) { return $_SESSION['file_uploads'][$source]; } } diff --git a/includes/menu.inc b/includes/menu.inc index 8a5ac6d8c..97a2eda53 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -367,7 +367,7 @@ function _menu_tree($result = NULL, $depth = 0, $link = array('link' => '', 'has break; } } - if ($link['link']) { + if (isset($link['link'])) { $tree .= theme('menu_link', $link); } return array($remnant, $tree); diff --git a/includes/module.inc b/includes/module.inc index 44aba1874..36105b4f8 100644 --- a/includes/module.inc +++ b/includes/module.inc @@ -110,6 +110,9 @@ function module_rebuild_cache() { continue; } $files[$filename]->info = $file->info; + if (!isset($files[$filename]->info['version'])) { + $files[$filename]->info['version'] = NULL; + } // log the critical hooks implemented by this module $bootstrap = 0; diff --git a/includes/theme.inc b/includes/theme.inc index a5aab93ea..24db4adb5 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -610,6 +610,7 @@ function theme_links($links, $attributes = array('class' => 'links')) { function theme_image($path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE) { if (!$getsize || (is_file($path) && (list($width, $height, $type, $image_attributes) = @getimagesize($path)))) { $attributes = drupal_attributes($attributes); + $image_attributes = isset($image_attributes) ? $image_attributes : ''; $url = (url($path) == $path) ? $path : (base_path() . $path); return '<img src="'. check_url($url) .'" alt="'. check_plain($alt) .'" title="'. check_plain($title) .'" '. $image_attributes . $attributes .' />'; } diff --git a/modules/block/block.module b/modules/block/block.module index e7936fef9..bd457de36 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -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']) && is_array($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[] = isset($block['delete']) ? drupal_render($block['delete']) : ''; $rows[] = $row; } } @@ -570,7 +570,7 @@ function block_box_form($edit = array()) { $form['info'] = array( '#type' => 'textfield', '#title' => t('Block description'), - '#default_value' => $edit['info'], + '#default_value' => isset($edit['info']) ? $edit['info'] : '', '#maxlength' => 64, '#description' => t('A brief description of your block. Used on the <a href="@overview">block overview page</a>.', array('@overview' => url('admin/build/block'))), '#required' => TRUE, @@ -580,7 +580,7 @@ function block_box_form($edit = array()) { $form['body_filter']['body'] = array( '#type' => 'textarea', '#title' => t('Block body'), - '#default_value' => $edit['body'], + '#default_value' => isset($edit['body']) ? $edit['body'] : '', '#rows' => 15, '#description' => t('The content of the block as shown to the user.'), '#weight' => -17, @@ -631,7 +631,7 @@ function block_user($type, $edit, &$user, $category = NULL) { break; case 'validate': - if (!$edit['block']) { + if (!isset($edit['block'])) { $edit['block'] = array(); } return $edit; diff --git a/modules/book/book.module b/modules/book/book.module index 8216d617a..e8a68a789 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -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 (isset($children[$nid])) { foreach ($children[$nid] as $foo => $node) { if (!$exclude || $exclude != $node->nid) { $toc[$node->nid] = $indent .' '. $node->title; diff --git a/modules/node/node.module b/modules/node/node.module index d136bde84..a029cae6e 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1393,7 +1393,7 @@ function node_filter_form() { * Theme node administration filter form. */ function theme_node_filter_form($form) { - $output .= '<div id="node-admin-filter">'; + $output = '<div id="node-admin-filter">'; $output .= drupal_render($form['filters']); $output .= '</div>'; $output .= drupal_render($form); @@ -1404,8 +1404,8 @@ function theme_node_filter_form($form) { * Theme node administration filter selector. */ function theme_node_filters($form) { - $output .= '<ul class="clear-block">'; - if (sizeof($form['current'])) { + $output = '<ul class="clear-block">'; + if (isset($form['current']) && sizeof($form['current'])) { foreach (element_children($form['current']) as $key) { $output .= '<li>'. drupal_render($form['current'][$key]) .'</li>'; } @@ -1495,7 +1495,7 @@ function node_admin_nodes_validate($form_id, $form_values) { function node_admin_content() { $output = drupal_get_form('node_filter_form'); - if ($_POST['operation'] == 'delete' && $_POST['nodes']) { + if (isset($_POST['operation']) && $_POST['operation'] == 'delete' && $_POST['nodes']) { return drupal_get_form('node_multiple_delete_confirm'); } // Call the form first, to allow for the form_values array to be populated. @@ -1506,6 +1506,7 @@ function node_admin_content() { function node_admin_nodes() { global $form_values; + $filter = node_build_filter_query(); $result = pager_query('SELECT n.*, u.name, u.uid FROM {node} n '. $filter['join'] .' INNER JOIN {users} u ON n.uid = u.uid '. $filter['where'] .' ORDER BY n.changed DESC', 50, 0, NULL, $filter['args']); @@ -1522,6 +1523,7 @@ function node_admin_nodes() { $form['options']['operation'] = array('#type' => 'select', '#options' => $options, '#default_value' => 'approve'); $form['options']['submit'] = array('#type' => 'submit', '#value' => t('Update')); + $nodes = array(); $destination = drupal_get_destination(); while ($node = db_fetch_object($result)) { $nodes[$node->nid] = ''; @@ -1543,7 +1545,7 @@ function theme_node_admin_nodes($form) { // Overview table: $header = array(theme('table_select_header_cell'), t('Title'), t('Type'), t('Author'), t('Status'), t('Operations')); - $output .= drupal_render($form['options']); + $output = drupal_render($form['options']); if (isset($form['title']) && is_array($form['title'])) { foreach (element_children($form['title']) as $key) { $row = array(); diff --git a/modules/system/system.module b/modules/system/system.module index b78919f5c..f63380fe6 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -354,7 +354,10 @@ function system_main_admin_page($arg = NULL) { usort($menu['children'], '_menu_sort'); foreach ($menu['children'] as $mid) { $block = menu_get_item($mid); - if ($block['block callback'] && function_exists($block['block callback'])) { + if (!isset($block['content'])) { + $block['content'] = ''; + } + if (isset($block['block callback']) && function_exists($block['block callback'])) { $arguments = isset($block['block arguments']) ? $block['block arguments'] : array(); $block['content'] .= call_user_func_array($block['block callback'], $arguments); } @@ -371,7 +374,7 @@ function system_main_admin_page($arg = NULL) { function system_admin_menu_block($block) { return 'This page awaits rewrite'; // TODO: this needs to be rewritten for the new menu system. $content = array(); - if (is_array($block['children'])) { + if (isset($block['children']) && is_array($block['children'])) { usort($block['children'], '_menu_sort'); foreach ($block['children'] as $mid) { $item = menu_get_item($mid); @@ -949,7 +952,7 @@ function system_theme_data() { $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 = isset($theme->template) ? $theme->prefix : $theme->name; // do not double-insert styles with theme files in their directory if (array_key_exists($style->name, $themes)) { continue; @@ -1160,7 +1163,7 @@ function system_themes() { function theme_system_themes($form) { foreach (element_children($form) as $key) { $row = array(); - if (is_array($form[$key]['description'])) { + if (isset($form[$key]['description']) && is_array($form[$key]['description'])) { $row[] = drupal_render($form[$key]['screenshot']); $row[] = drupal_render($form[$key]['description']); $row[] = array('data' => drupal_render($form['status'][$key]), 'align' => 'center'); @@ -1234,6 +1237,9 @@ function system_modules($form_values = NULL) { return $confirm_form; } + // Modules to throttle. + $throttle = array(); + // Store module list for validation callback. $form['validation_modules'] = array('#type' => 'value', '#value' => $files); @@ -1286,7 +1292,7 @@ function system_modules($form_values = NULL) { // Mark dependents disabled so user can not remove modules being depended on. $dependents = array(); - if (is_array($file->info['dependents'])) { + if (isset($file->info['dependents']) && is_array($file->info['dependents'])) { foreach ($file->info['dependents'] as $dependent) { if ($files[$dependent]->status == 1) { $dependents[] = $files[$dependent]->info['name'] . t(' (<span class="admin-enabled">enabled</span>)'); @@ -1483,7 +1489,7 @@ function system_modules_submit($form_id, $form_values) { $current_module_list = module_list(TRUE, FALSE); - if (is_array($form_values['throttle'])) { + if (isset($form_values['throttle']) && is_array($form_values['throttle'])) { foreach ($form_values['throttle'] as $key => $choice) { db_query("UPDATE {system} SET throttle = %d WHERE type = 'module' and name = '%s'", $choice ? 1 : 0, $key); } @@ -1835,7 +1841,7 @@ function system_status($check = FALSE) { * Helper function to sort requirements. */ function _system_sort_requirements($a, $b) { - return (isset($a['weight']) || isset($b['weight'])) ? $a['weight'] - $b['weight'] : strcmp($a['title'], $b['title']); + return (isset($a['weight']) && isset($b['weight'])) ? $a['weight'] - $b['weight'] : strcmp($a['title'], $b['title']); } /** @@ -2168,7 +2174,7 @@ function system_admin_compact_mode() { */ function theme_admin_page($blocks) { $stripe = 0; - $container = array(); + $container = array('left' => '', 'right' => ''); foreach ($blocks as $block) { if ($block_output = theme('admin_block', $block)) { @@ -2323,7 +2329,7 @@ function system_get_module_admin_tasks($module) { function theme_system_admin_by_module($menu_items) { $stripe = 0; $output = ''; - $container = array(); + $container = array('left' => '', 'right' => ''); // Iterate over all modules foreach ($menu_items as $module => $block) { @@ -2337,7 +2343,7 @@ function theme_system_admin_by_module($menu_items) { $block['description'] = t($description); if ($block_output = theme('admin_block', $block)) { - if (!$block['position']) { + if (!isset($block['position'])) { // Perform automatic striping. $block['position'] = ++$stripe % 2 ? 'left' : 'right'; } diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 1f02f01d2..a1c2be20c 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -716,7 +716,7 @@ function taxonomy_form_alter($form_id, &$form) { $form['taxonomy'][$vocabulary->vid]['#required'] = $vocabulary->required; } } - if (is_array($form['taxonomy']) && !empty($form['taxonomy'])) { + if (isset($form['taxonomy']) && is_array($form['taxonomy']) && !empty($form['taxonomy'])) { if (count($form['taxonomy']) > 1) { // Add fieldset only if form has more than 1 element. $form['taxonomy'] += array( '#type' => 'fieldset', diff --git a/modules/upload/upload.module b/modules/upload/upload.module index 5fec76209..15e1526af 100644 --- a/modules/upload/upload.module +++ b/modules/upload/upload.module @@ -285,7 +285,7 @@ function _upload_prepare(&$node) { // Clean up old file previews if a post didn't get the user to this page. // i.e. the user left the edit page, because they didn't want to upload anything. if(count($_POST) == 0) { - if (is_array($_SESSION['file_previews']) && count($_SESSION['file_previews'])) { + if (isset($_SESSION['file_previews']) && is_array($_SESSION['file_previews']) && count($_SESSION['file_previews'])) { foreach ($_SESSION['file_previews'] as $fid => $file) { file_delete($file->filepath); } @@ -321,7 +321,7 @@ function _upload_prepare(&$node) { } // Attach file previews to node object. - if (is_array($_SESSION['file_previews']) && count($_SESSION['file_previews'])) { + if (isset($_SESSION['file_previews']) && is_array($_SESSION['file_previews']) && count($_SESSION['file_previews'])) { foreach ($_SESSION['file_previews'] as $fid => $file) { if ($user->uid != 1) { // Here something.php.pps becomes something.php_.pps diff --git a/modules/user/user.module b/modules/user/user.module index 4f3cafefd..c24eb8355 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -1275,12 +1275,9 @@ function user_register() { // Remove form_group around default fields if there are no other groups. if (!$extra) { - $form['name'] = $form['account']['name']; - $form['mail'] = $form['account']['mail']; - $form['pass'] = $form['account']['pass']; - $form['status'] = $form['account']['status']; - $form['roles'] = $form['account']['roles']; - $form['notify'] = $form['account']['notify']; + foreach ($form['account'] as $key => $value) { + $form[$key] = $value; + } unset($form['account']); } else { @@ -1822,7 +1819,7 @@ function user_admin_access() { if (count($rows) == 0) { $rows[] = array(array('data' => '<em>'. t('There are currently no access rules.') .'</em>', 'colspan' => 5)); } - $output .= theme('table', $header, $rows); + $output = theme('table', $header, $rows); return $output; } @@ -2064,7 +2061,7 @@ function theme_user_admin_new_role($form) { $rows[] = array($name, t('locked'), $edit_permissions); } } - $rows[] = array(drupal_render($form['name']), array('data' => drupal_render($form['submit']), colspan => 2)); + $rows[] = array(drupal_render($form['name']), array('data' => drupal_render($form['submit']), 'colspan' => 2)); $output = drupal_render($form); $output .= theme('table', $header, $rows); @@ -2413,7 +2410,7 @@ function user_admin($callback_arg = '') { $output = drupal_get_form('user_register'); break; default: - if ($_POST['accounts'] && $_POST['operation'] == 'delete') { + if (isset($_POST['accounts']) && $_POST['operation'] == 'delete') { $output = drupal_get_form('user_multiple_delete_confirm'); } else { @@ -2673,7 +2670,7 @@ function theme_user_filter_form($form) { */ function theme_user_filters($form) { $output = '<ul class="clear-block">'; - if (sizeof($form['current'])) { + if (isset($form['current']) && sizeof($form['current'])) { foreach (element_children($form['current']) as $key) { $output .= '<li>'. drupal_render($form['current'][$key]) .'</li>'; } diff --git a/themes/engines/phptemplate/phptemplate.engine b/themes/engines/phptemplate/phptemplate.engine index c8892b097..a1bd0ae9d 100644 --- a/themes/engines/phptemplate/phptemplate.engine +++ b/themes/engines/phptemplate/phptemplate.engine @@ -213,8 +213,8 @@ function phptemplate_page($content, $show_blocks = TRUE) { 'primary_links' => menu_primary_links(), 'search_box' => (theme_get_setting('toggle_search') ? drupal_get_form('search_theme_form') : ''), 'secondary_links' => menu_secondary_links(), - 'sidebar_left' => $sidebar_left, - 'sidebar_right' => $sidebar_right, + 'sidebar_left' => isset($sidebar_left) ? $sidebar_left : '', + 'sidebar_right' => isset($sidebar_right) ? $sidebar_right : '', 'site_name' => (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : ''), 'site_slogan' => (theme_get_setting('toggle_slogan') ? variable_get('site_slogan', '') : ''), 'css' => drupal_add_css(), |