_xmlsitemap_node_submit() uses a not declared variable

kiamlaluno - August 23, 2008 - 11:42
Project:XML sitemap
Version:6.x-1.x-dev
Component:xmlsitemap_node
Category:bug report
Priority:critical
Assigned:kiamlaluno
Status:closed
Description

_xmlsitemap_node_submit() uses the variable $form_id which has not been declared.

<?php
function _xmlsitemap_node_submit($form, &$form_state) {
  switch (
$form_id) {
    case
'node_type_form':
     
$op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
     
$type = isset($form_state['values']['old_type']) ? $form_state['values']['old_type'] : trim($form_state['values']['type']);
     
$priority = $form_state['values']['xmlsitemap_node_type_priority'];
     
$old_priority = $form_state['values']['xmlsitemap_old_priority'];
      if (
$op == t('Save content type') && $priority != $old_priority || $op == t('Reset to defaults') && $old_priority != 0.1) {
       
xmlsitemap_update_sitemap();
      }
      break;
  }
}
?>

#1

kiamlaluno - November 16, 2008 - 01:50

The code showed seems like has been copied from another function, but it doesn't have any purpose on _xmlsitemap_node_submit()(except to introduce a bug :-)).

The code should simply be changed in:

<?php
function _xmlsitemap_node_submit($form, &$form_state) {
 
$op   = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
 
$type = isset($form_state['values']['old_type']) ? $form_state['values']['old_type'] : trim($form_state['values']['type']);
 
$priority = $form_state['values']['xmlsitemap_node_type_priority'];
 
$old_priority = $form_state['values']['xmlsitemap_old_priority'];
  if (
$op == t('Save content type') && $priority != $old_priority || $op == t('Reset to defaults') && $old_priority != 0.1) {
   
xmlsitemap_update_sitemap();
  }
}
?>

#2

kiamlaluno - August 23, 2008 - 12:36
Title:_xmlsitemap_node_submit uses a not declared variables» _xmlsitemap_node_submit() uses a not declared variables

#3

kiamlaluno - August 23, 2008 - 12:38
Title:_xmlsitemap_node_submit() uses a not declared variables» _xmlsitemap_node_submit() uses a not declared variable

#4

kiamlaluno - November 16, 2008 - 01:47
Priority:normal» critical

#5

kiamlaluno - November 17, 2008 - 02:20
Version:7.x-2.x-dev» 6.x-1.x-dev
Assigned to:Anonymous» kiamlaluno
Status:active» fixed

Fixed in 6.x-1.x-dev.

#6

System Message - December 1, 2008 - 02:22
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.