- Rollback of E_ALL patch. Too much extra breakage.

6.x
Dries Buytaert 2007-01-25 22:14:06 +00:00
parent db7dcfd444
commit 3b543c18f5
13 changed files with 41 additions and 50 deletions

View File

@ -193,7 +193,7 @@ function file_check_upload($source = 'upload') {
} }
// If a file was uploaded, process it. // If a file was uploaded, process it.
if (isset($_FILES["files"]["name"][$source]) && is_uploaded_file($_FILES["files"]["tmp_name"][$source])) { if ($_FILES["files"]["name"][$source] && is_uploaded_file($_FILES["files"]["tmp_name"][$source])) {
// Check for file upload errors and return FALSE if a // Check for file upload errors and return FALSE if a
// lower level system error occurred. // lower level system error occurred.
@ -253,7 +253,7 @@ function file_check_upload($source = 'upload') {
else { else {
// In case of previews return previous file object. // In case of previews return previous file object.
if (isset($_SESSION['file_uploads'][$source]->filepath) && file_exists($_SESSION['file_uploads'][$source]->filepath)) { if (file_exists($_SESSION['file_uploads'][$source]->filepath)) {
return $_SESSION['file_uploads'][$source]; return $_SESSION['file_uploads'][$source];
} }
} }

View File

@ -367,7 +367,7 @@ function _menu_tree($result = NULL, $depth = 0, $link = array('link' => '', 'has
break; break;
} }
} }
if (isset($link['link'])) { if ($link['link']) {
$tree .= theme('menu_link', $link); $tree .= theme('menu_link', $link);
} }
return array($remnant, $tree); return array($remnant, $tree);

View File

@ -110,9 +110,6 @@ function module_rebuild_cache() {
continue; continue;
} }
$files[$filename]->info = $file->info; $files[$filename]->info = $file->info;
if (!isset($files[$filename]->info['version'])) {
$files[$filename]->info['version'] = NULL;
}
// log the critical hooks implemented by this module // log the critical hooks implemented by this module
$bootstrap = 0; $bootstrap = 0;

View File

@ -610,7 +610,6 @@ function theme_links($links, $attributes = array('class' => 'links')) {
function theme_image($path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE) { function theme_image($path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE) {
if (!$getsize || (is_file($path) && (list($width, $height, $type, $image_attributes) = @getimagesize($path)))) { if (!$getsize || (is_file($path) && (list($width, $height, $type, $image_attributes) = @getimagesize($path)))) {
$attributes = drupal_attributes($attributes); $attributes = drupal_attributes($attributes);
$image_attributes = isset($image_attributes) ? $image_attributes : '';
$url = (url($path) == $path) ? $path : (base_path() . $path); $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) .'" '. $image_attributes . $attributes .' />';
} }

View File

@ -310,7 +310,7 @@ function theme_block_admin_display($form) {
foreach (element_children($form) as $i) { foreach (element_children($form) as $i) {
$block = &$form[$i]; $block = &$form[$i];
// Only take form elements that are blocks. // Only take form elements that are blocks.
if (isset($block['info']) && is_array($block['info'])) { if (is_array($block['info'])) {
// Fetch values // Fetch values
$region = $block['region']['#default_value']; $region = $block['region']['#default_value'];
$status = $region != BLOCK_REGION_NONE; $status = $region != BLOCK_REGION_NONE;
@ -337,7 +337,7 @@ function theme_block_admin_display($form) {
$row[] = drupal_render($block['throttle']); $row[] = drupal_render($block['throttle']);
} }
$row[] = drupal_render($block['configure']); $row[] = drupal_render($block['configure']);
$row[] = isset($block['delete']) ? drupal_render($block['delete']) : ''; $row[] = $block['delete'] ? drupal_render($block['delete']) : '';
$rows[] = $row; $rows[] = $row;
} }
} }
@ -570,7 +570,7 @@ function block_box_form($edit = array()) {
$form['info'] = array( $form['info'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Block description'), '#title' => t('Block description'),
'#default_value' => isset($edit['info']) ? $edit['info'] : '', '#default_value' => $edit['info'],
'#maxlength' => 64, '#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'))), '#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, '#required' => TRUE,
@ -580,7 +580,7 @@ function block_box_form($edit = array()) {
$form['body_filter']['body'] = array( $form['body_filter']['body'] = array(
'#type' => 'textarea', '#type' => 'textarea',
'#title' => t('Block body'), '#title' => t('Block body'),
'#default_value' => isset($edit['body']) ? $edit['body'] : '', '#default_value' => $edit['body'],
'#rows' => 15, '#rows' => 15,
'#description' => t('The content of the block as shown to the user.'), '#description' => t('The content of the block as shown to the user.'),
'#weight' => -17, '#weight' => -17,
@ -631,7 +631,7 @@ function block_user($type, $edit, &$user, $category = NULL) {
break; break;
case 'validate': case 'validate':
if (!isset($edit['block'])) { if (!$edit['block']) {
$edit['block'] = array(); $edit['block'] = array();
} }
return $edit; return $edit;

View File

@ -507,7 +507,7 @@ function theme_book_navigation($node) {
* This is a helper function for book_toc(). * This is a helper function for book_toc().
*/ */
function book_toc_recurse($nid, $indent, $toc, $children, $exclude) { function book_toc_recurse($nid, $indent, $toc, $children, $exclude) {
if (isset($children[$nid])) { if ($children[$nid]) {
foreach ($children[$nid] as $foo => $node) { foreach ($children[$nid] as $foo => $node) {
if (!$exclude || $exclude != $node->nid) { if (!$exclude || $exclude != $node->nid) {
$toc[$node->nid] = $indent .' '. $node->title; $toc[$node->nid] = $indent .' '. $node->title;

View File

@ -439,7 +439,7 @@ function forum_form_container($edit = array()) {
'#title' => t('Container name'), '#title' => t('Container name'),
'#type' => 'textfield', '#type' => 'textfield',
'#default_value' => $edit['name'], '#default_value' => $edit['name'],
'#maxlength' => 64, '#maxlength' => 255,
'#description' => t('The container name is used to identify related forums.'), '#description' => t('The container name is used to identify related forums.'),
'#required' => TRUE '#required' => TRUE
); );
@ -496,7 +496,7 @@ function forum_form_forum($edit = array()) {
$form['name'] = array('#type' => 'textfield', $form['name'] = array('#type' => 'textfield',
'#title' => t('Forum name'), '#title' => t('Forum name'),
'#default_value' => $edit['name'], '#default_value' => $edit['name'],
'#maxlength' => 64, '#maxlength' => 255,
'#description' => t('The forum name is used to identify related discussions.'), '#description' => t('The forum name is used to identify related discussions.'),
'#required' => TRUE, '#required' => TRUE,
); );

View File

@ -1393,7 +1393,7 @@ function node_filter_form() {
* Theme node administration filter form. * Theme node administration filter form.
*/ */
function theme_node_filter_form($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 .= drupal_render($form['filters']);
$output .= '</div>'; $output .= '</div>';
$output .= drupal_render($form); $output .= drupal_render($form);
@ -1404,8 +1404,8 @@ function theme_node_filter_form($form) {
* Theme node administration filter selector. * Theme node administration filter selector.
*/ */
function theme_node_filters($form) { function theme_node_filters($form) {
$output = '<ul class="clear-block">'; $output .= '<ul class="clear-block">';
if (isset($form['current']) && sizeof($form['current'])) { if (sizeof($form['current'])) {
foreach (element_children($form['current']) as $key) { foreach (element_children($form['current']) as $key) {
$output .= '<li>'. drupal_render($form['current'][$key]) .'</li>'; $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() { function node_admin_content() {
$output = drupal_get_form('node_filter_form'); $output = drupal_get_form('node_filter_form');
if (isset($_POST['operation']) && $_POST['operation'] == 'delete' && $_POST['nodes']) { if ($_POST['operation'] == 'delete' && $_POST['nodes']) {
return drupal_get_form('node_multiple_delete_confirm'); return drupal_get_form('node_multiple_delete_confirm');
} }
// Call the form first, to allow for the form_values array to be populated. // Call the form first, to allow for the form_values array to be populated.
@ -1506,7 +1506,6 @@ function node_admin_content() {
function node_admin_nodes() { function node_admin_nodes() {
global $form_values; global $form_values;
$filter = node_build_filter_query(); $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']); $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']);
@ -1523,7 +1522,6 @@ function node_admin_nodes() {
$form['options']['operation'] = array('#type' => 'select', '#options' => $options, '#default_value' => 'approve'); $form['options']['operation'] = array('#type' => 'select', '#options' => $options, '#default_value' => 'approve');
$form['options']['submit'] = array('#type' => 'submit', '#value' => t('Update')); $form['options']['submit'] = array('#type' => 'submit', '#value' => t('Update'));
$nodes = array();
$destination = drupal_get_destination(); $destination = drupal_get_destination();
while ($node = db_fetch_object($result)) { while ($node = db_fetch_object($result)) {
$nodes[$node->nid] = ''; $nodes[$node->nid] = '';
@ -1545,7 +1543,7 @@ function theme_node_admin_nodes($form) {
// Overview table: // Overview table:
$header = array(theme('table_select_header_cell'), t('Title'), t('Type'), t('Author'), t('Status'), t('Operations')); $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'])) { if (isset($form['title']) && is_array($form['title'])) {
foreach (element_children($form['title']) as $key) { foreach (element_children($form['title']) as $key) {
$row = array(); $row = array();

View File

@ -354,10 +354,7 @@ function system_main_admin_page($arg = NULL) {
usort($menu['children'], '_menu_sort'); usort($menu['children'], '_menu_sort');
foreach ($menu['children'] as $mid) { foreach ($menu['children'] as $mid) {
$block = menu_get_item($mid); $block = menu_get_item($mid);
if (!isset($block['content'])) { if ($block['block callback'] && function_exists($block['block callback'])) {
$block['content'] = '';
}
if (isset($block['block callback']) && function_exists($block['block callback'])) {
$arguments = isset($block['block arguments']) ? $block['block arguments'] : array(); $arguments = isset($block['block arguments']) ? $block['block arguments'] : array();
$block['content'] .= call_user_func_array($block['block callback'], $arguments); $block['content'] .= call_user_func_array($block['block callback'], $arguments);
} }
@ -374,7 +371,7 @@ function system_main_admin_page($arg = NULL) {
function system_admin_menu_block($block) { function system_admin_menu_block($block) {
return 'This page awaits rewrite'; // TODO: this needs to be rewritten for the new menu system. return 'This page awaits rewrite'; // TODO: this needs to be rewritten for the new menu system.
$content = array(); $content = array();
if (isset($block['children']) && is_array($block['children'])) { if (is_array($block['children'])) {
usort($block['children'], '_menu_sort'); usort($block['children'], '_menu_sort');
foreach ($block['children'] as $mid) { foreach ($block['children'] as $mid) {
$item = menu_get_item($mid); $item = menu_get_item($mid);
@ -952,7 +949,7 @@ function system_theme_data() {
$style->template = isset($theme->template) ? $theme->template : FALSE; $style->template = isset($theme->template) ? $theme->template : FALSE;
$style->name = basename(dirname($style->filename)); $style->name = basename(dirname($style->filename));
$style->owner = $theme->filename; $style->owner = $theme->filename;
$style->prefix = isset($theme->template) ? $theme->prefix : $theme->name; $style->prefix = $theme->template ? $theme->prefix : $theme->name;
// do not double-insert styles with theme files in their directory // do not double-insert styles with theme files in their directory
if (array_key_exists($style->name, $themes)) { if (array_key_exists($style->name, $themes)) {
continue; continue;
@ -1163,7 +1160,7 @@ function system_themes() {
function theme_system_themes($form) { function theme_system_themes($form) {
foreach (element_children($form) as $key) { foreach (element_children($form) as $key) {
$row = array(); $row = array();
if (isset($form[$key]['description']) && is_array($form[$key]['description'])) { if (is_array($form[$key]['description'])) {
$row[] = drupal_render($form[$key]['screenshot']); $row[] = drupal_render($form[$key]['screenshot']);
$row[] = drupal_render($form[$key]['description']); $row[] = drupal_render($form[$key]['description']);
$row[] = array('data' => drupal_render($form['status'][$key]), 'align' => 'center'); $row[] = array('data' => drupal_render($form['status'][$key]), 'align' => 'center');
@ -1237,9 +1234,6 @@ function system_modules($form_values = NULL) {
return $confirm_form; return $confirm_form;
} }
// Modules to throttle.
$throttle = array();
// Store module list for validation callback. // Store module list for validation callback.
$form['validation_modules'] = array('#type' => 'value', '#value' => $files); $form['validation_modules'] = array('#type' => 'value', '#value' => $files);
@ -1292,7 +1286,7 @@ function system_modules($form_values = NULL) {
// Mark dependents disabled so user can not remove modules being depended on. // Mark dependents disabled so user can not remove modules being depended on.
$dependents = array(); $dependents = array();
if (isset($file->info['dependents']) && is_array($file->info['dependents'])) { if (is_array($file->info['dependents'])) {
foreach ($file->info['dependents'] as $dependent) { foreach ($file->info['dependents'] as $dependent) {
if ($files[$dependent]->status == 1) { if ($files[$dependent]->status == 1) {
$dependents[] = $files[$dependent]->info['name'] . t(' (<span class="admin-enabled">enabled</span>)'); $dependents[] = $files[$dependent]->info['name'] . t(' (<span class="admin-enabled">enabled</span>)');
@ -1489,7 +1483,7 @@ function system_modules_submit($form_id, $form_values) {
$current_module_list = module_list(TRUE, FALSE); $current_module_list = module_list(TRUE, FALSE);
if (isset($form_values['throttle']) && is_array($form_values['throttle'])) { if (is_array($form_values['throttle'])) {
foreach ($form_values['throttle'] as $key => $choice) { foreach ($form_values['throttle'] as $key => $choice) {
db_query("UPDATE {system} SET throttle = %d WHERE type = 'module' and name = '%s'", $choice ? 1 : 0, $key); db_query("UPDATE {system} SET throttle = %d WHERE type = 'module' and name = '%s'", $choice ? 1 : 0, $key);
} }
@ -1841,7 +1835,7 @@ function system_status($check = FALSE) {
* Helper function to sort requirements. * Helper function to sort requirements.
*/ */
function _system_sort_requirements($a, $b) { 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']);
} }
/** /**
@ -2174,7 +2168,7 @@ function system_admin_compact_mode() {
*/ */
function theme_admin_page($blocks) { function theme_admin_page($blocks) {
$stripe = 0; $stripe = 0;
$container = array('left' => '', 'right' => ''); $container = array();
foreach ($blocks as $block) { foreach ($blocks as $block) {
if ($block_output = theme('admin_block', $block)) { if ($block_output = theme('admin_block', $block)) {
@ -2329,7 +2323,7 @@ function system_get_module_admin_tasks($module) {
function theme_system_admin_by_module($menu_items) { function theme_system_admin_by_module($menu_items) {
$stripe = 0; $stripe = 0;
$output = ''; $output = '';
$container = array('left' => '', 'right' => ''); $container = array();
// Iterate over all modules // Iterate over all modules
foreach ($menu_items as $module => $block) { foreach ($menu_items as $module => $block) {
@ -2343,7 +2337,7 @@ function theme_system_admin_by_module($menu_items) {
$block['description'] = t($description); $block['description'] = t($description);
if ($block_output = theme('admin_block', $block)) { if ($block_output = theme('admin_block', $block)) {
if (!isset($block['position'])) { if (!$block['position']) {
// Perform automatic striping. // Perform automatic striping.
$block['position'] = ++$stripe % 2 ? 'left' : 'right'; $block['position'] = ++$stripe % 2 ? 'left' : 'right';
} }

View File

@ -716,7 +716,7 @@ function taxonomy_form_alter($form_id, &$form) {
$form['taxonomy'][$vocabulary->vid]['#required'] = $vocabulary->required; $form['taxonomy'][$vocabulary->vid]['#required'] = $vocabulary->required;
} }
} }
if (isset($form['taxonomy']) && is_array($form['taxonomy']) && !empty($form['taxonomy'])) { if (is_array($form['taxonomy']) && !empty($form['taxonomy'])) {
if (count($form['taxonomy']) > 1) { // Add fieldset only if form has more than 1 element. if (count($form['taxonomy']) > 1) { // Add fieldset only if form has more than 1 element.
$form['taxonomy'] += array( $form['taxonomy'] += array(
'#type' => 'fieldset', '#type' => 'fieldset',

View File

@ -285,7 +285,7 @@ function _upload_prepare(&$node) {
// Clean up old file previews if a post didn't get the user to this page. // 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. // i.e. the user left the edit page, because they didn't want to upload anything.
if(count($_POST) == 0) { if(count($_POST) == 0) {
if (isset($_SESSION['file_previews']) && is_array($_SESSION['file_previews']) && count($_SESSION['file_previews'])) { if (is_array($_SESSION['file_previews']) && count($_SESSION['file_previews'])) {
foreach ($_SESSION['file_previews'] as $fid => $file) { foreach ($_SESSION['file_previews'] as $fid => $file) {
file_delete($file->filepath); file_delete($file->filepath);
} }
@ -321,7 +321,7 @@ function _upload_prepare(&$node) {
} }
// Attach file previews to node object. // Attach file previews to node object.
if (isset($_SESSION['file_previews']) && is_array($_SESSION['file_previews']) && count($_SESSION['file_previews'])) { if (is_array($_SESSION['file_previews']) && count($_SESSION['file_previews'])) {
foreach ($_SESSION['file_previews'] as $fid => $file) { foreach ($_SESSION['file_previews'] as $fid => $file) {
if ($user->uid != 1) { if ($user->uid != 1) {
// Here something.php.pps becomes something.php_.pps // Here something.php.pps becomes something.php_.pps

View File

@ -1275,9 +1275,12 @@ function user_register() {
// Remove form_group around default fields if there are no other groups. // Remove form_group around default fields if there are no other groups.
if (!$extra) { if (!$extra) {
foreach ($form['account'] as $key => $value) { $form['name'] = $form['account']['name'];
$form[$key] = $value; $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'];
unset($form['account']); unset($form['account']);
} }
else { else {
@ -1819,7 +1822,7 @@ function user_admin_access() {
if (count($rows) == 0) { if (count($rows) == 0) {
$rows[] = array(array('data' => '<em>'. t('There are currently no access rules.') .'</em>', 'colspan' => 5)); $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; return $output;
} }
@ -2061,7 +2064,7 @@ function theme_user_admin_new_role($form) {
$rows[] = array($name, t('locked'), $edit_permissions); $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 = drupal_render($form);
$output .= theme('table', $header, $rows); $output .= theme('table', $header, $rows);
@ -2410,7 +2413,7 @@ function user_admin($callback_arg = '') {
$output = drupal_get_form('user_register'); $output = drupal_get_form('user_register');
break; break;
default: default:
if (isset($_POST['accounts']) && $_POST['operation'] == 'delete') { if ($_POST['accounts'] && $_POST['operation'] == 'delete') {
$output = drupal_get_form('user_multiple_delete_confirm'); $output = drupal_get_form('user_multiple_delete_confirm');
} }
else { else {
@ -2670,7 +2673,7 @@ function theme_user_filter_form($form) {
*/ */
function theme_user_filters($form) { function theme_user_filters($form) {
$output = '<ul class="clear-block">'; $output = '<ul class="clear-block">';
if (isset($form['current']) && sizeof($form['current'])) { if (sizeof($form['current'])) {
foreach (element_children($form['current']) as $key) { foreach (element_children($form['current']) as $key) {
$output .= '<li>'. drupal_render($form['current'][$key]) .'</li>'; $output .= '<li>'. drupal_render($form['current'][$key]) .'</li>';
} }

View File

@ -213,8 +213,8 @@ function phptemplate_page($content, $show_blocks = TRUE) {
'primary_links' => menu_primary_links(), 'primary_links' => menu_primary_links(),
'search_box' => (theme_get_setting('toggle_search') ? drupal_get_form('search_theme_form') : ''), 'search_box' => (theme_get_setting('toggle_search') ? drupal_get_form('search_theme_form') : ''),
'secondary_links' => menu_secondary_links(), 'secondary_links' => menu_secondary_links(),
'sidebar_left' => isset($sidebar_left) ? $sidebar_left : '', 'sidebar_left' => $sidebar_left,
'sidebar_right' => isset($sidebar_right) ? $sidebar_right : '', 'sidebar_right' => $sidebar_right,
'site_name' => (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : ''), 'site_name' => (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : ''),
'site_slogan' => (theme_get_setting('toggle_slogan') ? variable_get('site_slogan', '') : ''), 'site_slogan' => (theme_get_setting('toggle_slogan') ? variable_get('site_slogan', '') : ''),
'css' => drupal_add_css(), 'css' => drupal_add_css(),