diff options
author | Dries Buytaert <dries@buytaert.net> | 2007-01-31 15:49:26 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2007-01-31 15:49:26 +0000 |
commit | 05a708fb06137758cf7a15a623b4813af2fc005f (patch) | |
tree | 6ae6f50edbcb601329805cbbd7c22d11340327e3 /includes | |
parent | 4c9fc80fc48608982a731b03655b02e5ccdb6b17 (diff) | |
download | brdo-05a708fb06137758cf7a15a623b4813af2fc005f.tar.gz brdo-05a708fb06137758cf7a15a623b4813af2fc005f.tar.bz2 |
- Patch #112715 by chx, webchick, asimmonds, et al: fixing E_ALL notices. Thanks.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/common.inc | 5 | ||||
-rw-r--r-- | includes/file.inc | 4 | ||||
-rw-r--r-- | includes/form.inc | 55 | ||||
-rw-r--r-- | includes/menu.inc | 18 | ||||
-rw-r--r-- | includes/module.inc | 4 | ||||
-rw-r--r-- | includes/tablesort.inc | 3 | ||||
-rw-r--r-- | includes/theme.inc | 6 |
7 files changed, 56 insertions, 39 deletions
diff --git a/includes/common.inc b/includes/common.inc index a7ea1cab5..1512f30ce 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -1450,6 +1450,8 @@ function drupal_get_css($css = NULL) { if (!isset($css)) { $css = drupal_add_css(); } + $no_module_preprocess = ''; + $no_theme_preprocess = ''; $preprocess_css = variable_get('preprocess_css', FALSE); $directory = file_directory_path(); @@ -2120,6 +2122,7 @@ function drupal_render(&$elements) { if (!isset($elements['#sorted'])) { uasort($elements, "_element_sort"); } + $elements += array('#title' => NULL, '#description' => NULL); if (!isset($elements['#children'])) { $children = element_children($elements); /* Render all the children that use a theme function */ @@ -2201,7 +2204,7 @@ function element_properties($element) { * Check if the key is a child. */ function element_child($key) { - return $key[0] != '#'; + return !isset($key[0]) || $key[0] != '#'; } /** diff --git a/includes/file.inc b/includes/file.inc index 702641312..4b8e3c6e3 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"]) && $_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']) && file_exists($_SESSION['file_uploads'][$source]->filepath)) { return $_SESSION['file_uploads'][$source]; } } diff --git a/includes/form.inc b/includes/form.inc index b6647fdc4..49d8de0cf 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -265,7 +265,9 @@ function drupal_process_form($form_id, &$form) { // We've finished calling functions that alter the global values, so we can // restore the ones that were there before this function was called. list($form_values, $form_submitted, $form_button_counter) = array_pop($saved_globals); - return $redirect; + if (isset($redirect)) { + return $redirect; + } } /** @@ -306,9 +308,7 @@ function drupal_prepare_form($form_id, &$form) { // If $base is set, it is used in place of $form_id when constructing validation, // submission, and theming functions. Useful for mapping many similar or duplicate // forms with different $form_ids to the same processing functions. - if (isset($form['#base'])) { - $base = $form['#base']; - } + $base = isset($form['#base']) ? $form['#base'] : ''; // Add a token, based on either #token or form_id, to any form displayed to // authenticated users. This ensures that any submitted form was actually @@ -432,7 +432,9 @@ function drupal_submit_form($form_id, $form) { } } } - return $goto; + if (isset($goto)) { + return $goto; + } } /** @@ -450,9 +452,7 @@ function drupal_submit_form($form_id, $form) { */ function drupal_render_form($form_id, &$form) { // Don't override #theme if someone already set it. - if (isset($form['#base'])) { - $base = $form['#base']; - } + $base = isset($form['#base']) ? $form['#base'] : ''; if (!isset($form['#theme'])) { if (theme_get_function($form_id)) { @@ -492,16 +492,16 @@ function drupal_redirect_form($form, $redirect = NULL) { if (isset($form['#redirect'])) { $goto = $form['#redirect']; } - if ($goto !== FALSE) { - if (is_array($goto)) { - call_user_func_array('drupal_goto', $goto); - } - elseif (!isset($goto)) { - drupal_goto($_GET['q']); - } - else { - drupal_goto($goto); + if (!isset($goto) || ($goto !== FALSE)) { + if (isset($goto)) { + if (is_array($goto)) { + call_user_func_array('drupal_goto', $goto); + } + else { + drupal_goto($goto); + } } + drupal_goto($_GET['q']); } } @@ -756,7 +756,7 @@ function form_builder($form_id, $form) { if (isset($form['#process']) && !$form['#processed']) { foreach ($form['#process'] as $process => $args) { if (function_exists($process)) { - $args = array_merge(array($form), array($edit), $args); + $args = array_merge(array($form), array(isset($edit) ? $edit : NULL), $args); $form = call_user_func_array($process, $args); } } @@ -929,7 +929,7 @@ function theme_select($element) { $select = ''; $size = $element['#size'] ? ' size="' . $element['#size'] . '"' : ''; _form_set_class($element, array('form-select')); - $multiple = isset($element['#multiple']) && $element['#multiple']; + $multiple = $element['#multiple']; return theme('form_element', $element, '<select name="'. $element['#name'] .''. ($multiple ? '[]' : '') .'"'. ($multiple ? ' multiple="multiple" ' : '') . drupal_attributes($element['#attributes']) .' id="'. $element['#id'] .'" '. $size .'>'. form_select_options($element) .'</select>'); } @@ -1038,7 +1038,7 @@ function theme_fieldset($element) { } } - return '<fieldset' . drupal_attributes($element['#attributes']) .'>' . ($element['#title'] ? '<legend>'. $element['#title'] .'</legend>' : '') . ($element['#description'] ? '<div class="description">'. $element['#description'] .'</div>' : '') . $element['#children'] . $element['#value'] . "</fieldset>\n"; + return '<fieldset' . drupal_attributes($element['#attributes']) .'>' . ($element['#title'] ? '<legend>'. $element['#title'] .'</legend>' : '') . ($element['#description'] ? '<div class="description">'. $element['#description'] .'</div>' : '') . (!empty($element['#children']) ? $element['#children'] : '') . $element['#value'] . "</fieldset>\n"; } /** @@ -1079,7 +1079,7 @@ function theme_radios($element) { if (isset($element['#attributes']['class'])) { $class .= ' '. $element['#attributes']['class']; } - $element['#children'] = '<div class="'. $class .'">'. $element['#children'] .'</div>'; + $element['#children'] = '<div class="'. $class .'">'. (!empty($element['#children']) ? $element['#children'] : '') .'</div>'; if ($element['#title'] || $element['#description']) { unset($element['#id']); return theme('form_element', $element, $element['#children']); @@ -1232,12 +1232,18 @@ function map_month($month) { */ function checkboxes_value(&$form) { $value = array(); - foreach ((array)$form['#default_value'] as $key) { + $form += array('#default_value' => array()); + foreach ($form['#default_value'] as $key) { $value[$key] = 1; } $form['#value'] = $value; } +function password_confirm_value(&$form) { + $form += array('#default_value' => array()); + $form['#value'] = $form['#default_value'] + array('pass1' => '', 'pass2' => ''); +} + /** * If no default value is set for weight select boxes, use 0. */ @@ -1275,7 +1281,7 @@ function expand_radios($element) { * A themed HTML string representing the form item. */ function theme_item($element) { - return theme('form_element', $element, $element['#value'] . $element['#children']); + return theme('form_element', $element, $element['#value'] . (!empty($element['#children']) ? $element['#children'] : '')); } /** @@ -1318,7 +1324,7 @@ function theme_checkboxes($element) { if (isset($element['#attributes']['class'])) { $class .= ' '. $element['#attributes']['class']; } - $element['#children'] = '<div class="'. $class .'">'. $element['#children'] .'</div>'; + $element['#children'] = '<div class="'. $class .'">'. (!empty($element['#children']) ? $element['#children'] : '') .'</div>'; if ($element['#title'] || $element['#description']) { unset($element['#id']); return theme('form_element', $element, $element['#children']); @@ -1492,6 +1498,7 @@ function process_weight($element) { $element['#options'] = $weights; $element['#type'] = 'select'; $element['#is_weight'] = TRUE; + $element += _element_info('select'); return $element; } diff --git a/includes/menu.inc b/includes/menu.inc index 8a5ac6d8c..2fee91a30 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -356,7 +356,7 @@ function _menu_tree($result = NULL, $depth = 0, $link = array('link' => '', 'has list($remnant, $menu) = _menu_tree($result, $item->depth, $menu_link); $tree .= theme('menu_tree', $link, $menu); $link = $remnant; - $remnant = ''; + $remnant = array('link' => '', 'has_children' => FALSE); } elseif ($item->depth == $depth) { $tree .= theme('menu_link', $link); @@ -496,6 +496,7 @@ function menu_rebuild() { '_has_children' => 0, 'title' => '', 'weight' => 0, + 'type' => MENU_NORMAL_ITEM, ); $sort[$path] = ($item['_visible'] ? $depth : $number_parts) . sprintf('%05d', $item['weight']) . $item['title']; unset($item); @@ -527,11 +528,6 @@ function menu_rebuild() { if (!isset($item['map callback']) && isset($item['map arguments'])) { $item['map callback'] = 'menu_map'; } - foreach (array('access', 'map', 'page') as $type) { - if (isset($item["$type callback"]) && !isset($item["$type arguments"])) { - $item["$type arguments"] = array(); - } - } if (is_bool($item['access callback'])) { $item['access callback'] = intval($item['access callback']); } @@ -548,7 +544,15 @@ function menu_rebuild() { $vancode = ''; $link = ''; } - db_query("INSERT INTO {menu} (mid, pid, path, access_callback, access_arguments, page_callback, page_arguments, map_callback, map_arguments, fit, number_parts, vancode, menu_link, visible, parents, depth, has_children) VALUES (%d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, '%s', %d, %d)", $item['_mid'], $item['_pid'], $path, $item['access callback'], serialize($item['access arguments']), $item['page callback'], serialize($item['page arguments']), $item['map callback'], serialize($item['map arguments']), $item['_fit'], $item['_number_parts'], $vancode .'+', $link, $item['_visible'], $item['_parents'], $item['_depth'], $item['_has_children']); + $insert_item = $item + array( + 'access arguments' => array(), + 'access callback' => '', + 'page arguments' => array(), + 'page callback' => '', + 'map arguments' => array(), + 'map callback' => '', + ); + db_query("INSERT INTO {menu} (mid, pid, path, access_callback, access_arguments, page_callback, page_arguments, map_callback, map_arguments, fit, number_parts, vancode, menu_link, visible, parents, depth, has_children) VALUES (%d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, '%s', %d, %d)", $insert_item['_mid'], $insert_item['_pid'], $path, $insert_item['access callback'], serialize($insert_item['access arguments']), $insert_item['page callback'], serialize($insert_item['page arguments']), $insert_item['map callback'], serialize($insert_item['map arguments']), $insert_item['_fit'], $insert_item['_number_parts'], $vancode .'+', $link, $insert_item['_visible'], $insert_item['_parents'], $insert_item['_depth'], $insert_item['_has_children']); // $item needs to be unset because of the reference above. unset($item); } diff --git a/includes/module.inc b/includes/module.inc index 44aba1874..9f16cc7e1 100644 --- a/includes/module.inc +++ b/includes/module.inc @@ -127,7 +127,9 @@ function module_rebuild_cache() { } else { // This is a new module. - db_query("INSERT INTO {system} (name, description, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', %d, %d, %d)", $file->name, $file->info['description'], 'module', $file->filename, $file->status, $file->throttle, $bootstrap); + $files[$filename]->status = 0; + $files[$filename]->throttle = 0; + db_query("INSERT INTO {system} (name, description, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', %d, %d, %d)", $file->name, $file->info['description'], 'module', $file->filename, 0, 0, $bootstrap); } } $files = _module_build_dependents($files); diff --git a/includes/tablesort.inc b/includes/tablesort.inc index f976eb512..48a445828 100644 --- a/includes/tablesort.inc +++ b/includes/tablesort.inc @@ -107,7 +107,7 @@ function tablesort_header($cell, $header, $ts) { * A properly formatted cell, ready for _theme_table_cell(). */ function tablesort_cell($cell, $header, $ts, $i) { - if (isset($header[$i]) && $header[$i]['data'] == $ts['name'] && $header[$i]['field']) { + if (isset($header[$i]['data']) && $header[$i]['data'] == $ts['name'] && !empty($header[$i]['field'])) { if (is_array($cell)) { if (isset($cell['class'])) { $cell['class'] .= ' active'; @@ -162,6 +162,7 @@ function tablesort_get_order($headers) { else { // The first column specified is initial 'order by' field unless otherwise specified if (is_array($headers[0])) { + $headers[0] += array('data' => NULL, 'field' => NULL); return array('name' => $headers[0]['data'], 'sql' => $headers[0]['field']); } else { diff --git a/includes/theme.inc b/includes/theme.inc index a5aab93ea..a829b2cca 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -42,7 +42,7 @@ function init_theme() { // Only select the user selected theme if it is available in the // list of enabled themes. - $theme = $user->theme && $themes[$user->theme]->status ? $user->theme : variable_get('theme_default', 'garland'); + $theme = !empty($user->theme) && $themes[$user->theme]->status ? $user->theme : variable_get('theme_default', 'garland'); // Allow modules to override the present theme... only select custom theme // if it is available in the list of installed themes. @@ -611,7 +611,7 @@ function theme_image($path, $alt = '', $title = '', $attributes = NULL, $getsize if (!$getsize || (is_file($path) && (list($width, $height, $type, $image_attributes) = @getimagesize($path)))) { $attributes = drupal_attributes($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 .' />'; + return '<img src="'. check_url($url) .'" alt="'. check_plain($alt) .'" title="'. check_plain($title) .'" '. (isset($image_attributes) ? $image_attributes : '') . $attributes .' />'; } } @@ -1089,7 +1089,7 @@ function _theme_table_cell($cell, $header = FALSE) { $attributes = ''; if (is_array($cell)) { - $data = $cell['data']; + $data = isset($cell['data']) ? $cell['data'] : ''; $header |= isset($cell['header']); unset($cell['data']); unset($cell['header']); |