Changeset 706

Show
Ignore:
Timestamp:
08/31/05 23:03:21 (8 years ago)
Author:
fproulx
Message:

2005-08-31 Francois Proulx <francois.proulx@…>

  • Fixed bug where node ID containing periods, whitespaces or underscores would confuse PHP
  • MD5 hash is used to make sur the http vars are unique
  • This is only valid for Node administration
Location:
trunk/wifidog-auth
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/ChangeLog

    r705 r706  
     12005-08-31 Francois Proulx <francois.proulx@gmail.com> 
     2        * Fixed bug where node ID containing periods, whitespaces or underscores would confuse PHP 
     3        * MD5 hash is used to make sur the http vars are unique 
     4        * This is only valid for Node administration 
     5         
    162005-08-31 Benoit Grégoire  <bock@step.polymtl.ca> 
    27        * Node.php:  Fix node creation 
    3  
     8         
    492005-08-31 Francois Proulx <francois.proulx@gmail.com> 
    510        * Fixed new node creation bug 
  • trunk/wifidog-auth/wifidog/classes/Node.php

    r705 r706  
    490490                $html .= "</div>\n"; 
    491491 
     492                // Hashed node_id (this is a workaround since PHP auto-converts HTTP vars var periods, spaces or underscores ) 
     493                $hashed_node_id = md5($this->getId()); 
     494                 
    492495                // Name 
    493496                $html .= "<div class='admin_section_container'>\n"; 
    494497                $html .= "<div class='admin_section_title'>"._("Name")." : </div>\n"; 
    495498                $html .= "<div class='admin_section_data'>\n"; 
    496                 $name = "node_".$this->getId()."_name"; 
     499                $name = "node_".$hashed_node_id."_name"; 
    497500                $value = htmlspecialchars($this->getName(), ENT_QUOTES); 
    498501                $html .= "<input type='text' size ='50' value='$value' name='$name'>\n"; 
     
    504507                $html .= "<div class='admin_section_title'>"._("Homepage URL")." : </div>\n"; 
    505508                $html .= "<div class='admin_section_data'>\n"; 
    506                 $name = "node_".$this->getId()."_homepage_url"; 
     509                $name = "node_".$hashed_node_id."_homepage_url"; 
    507510                $value = htmlspecialchars($this->getHomePageURL(), ENT_QUOTES); 
    508511                $html .= "<input type='text' size ='50' value='$value' name='$name'>\n"; 
     
    514517                $html .= "<div class='admin_section_title'>"._("Description")." : </div>\n"; 
    515518                $html .= "<div class='admin_section_data'>\n"; 
    516                 $name = "node_".$this->getId()."_description"; 
     519                $name = "node_".$hashed_node_id."_description"; 
    517520                $value = htmlspecialchars($this->getDescription(), ENT_QUOTES); 
    518521                $html .= "<textarea cols='50' rows='5' name='$name'>$value</textarea>\n"; 
     
    524527                $html .= "<div class='admin_section_title'>"._("Map URL")." : </div>\n"; 
    525528                $html .= "<div class='admin_section_data'>\n"; 
    526                 $name = "node_".$this->getId()."_map_url"; 
     529                $name = "node_".$hashed_node_id."_map_url"; 
    527530                $value = htmlspecialchars($this->getMapURL(), ENT_QUOTES); 
    528531                $html .= "<input type='text' size ='50' value='$value' name='$name'>\n"; 
     
    534537                $html .= "<div class='admin_section_title'>"._("Civic number")." : </div>\n"; 
    535538                $html .= "<div class='admin_section_data'>\n"; 
    536                 $name = "node_".$this->getId()."_civic_number"; 
     539                $name = "node_".$hashed_node_id."_civic_number"; 
    537540                $value = htmlspecialchars($this->getCivicNumber(), ENT_QUOTES); 
    538541                $html .= "<input type='text' size ='10' value='$value' name='$name'>\n"; 
     
    544547                $html .= "<div class='admin_section_title'>"._("Street name")." : </div>\n"; 
    545548                $html .= "<div class='admin_section_data'>\n"; 
    546                 $name = "node_".$this->getId()."_street_name"; 
     549                $name = "node_".$hashed_node_id."_street_name"; 
    547550                $value = htmlspecialchars($this->getStreetName(), ENT_QUOTES); 
    548551                $html .= "<input type='text' size ='25' value='$value' name='$name'>\n"; 
     
    554557                $html .= "<div class='admin_section_title'>"._("City")." : </div>\n"; 
    555558                $html .= "<div class='admin_section_data'>\n"; 
    556                 $name = "node_".$this->getId()."_city"; 
     559                $name = "node_".$hashed_node_id."_city"; 
    557560                $value = htmlspecialchars($this->getCity(), ENT_QUOTES); 
    558561                $html .= "<input type='text' size ='25' value='$value' name='$name'>\n"; 
     
    564567                $html .= "<div class='admin_section_title'>"._("Province / State")." : </div>\n"; 
    565568                $html .= "<div class='admin_section_data'>\n"; 
    566                 $name = "node_".$this->getId()."_province"; 
     569                $name = "node_".$hashed_node_id."_province"; 
    567570                $value = htmlspecialchars($this->getProvince(), ENT_QUOTES); 
    568571                $html .= "<input type='text' size ='15' value='$value' name='$name'>\n"; 
     
    574577                $html .= "<div class='admin_section_title'>"._("Postal code")." : </div>\n"; 
    575578                $html .= "<div class='admin_section_data'>\n"; 
    576                 $name = "node_".$this->getId()."_postal_code"; 
     579                $name = "node_".$hashed_node_id."_postal_code"; 
    577580                $value = htmlspecialchars($this->getPostalCode(), ENT_QUOTES); 
    578581                $html .= "<input type='text' size ='10' value='$value' name='$name'>\n"; 
     
    584587                $html .= "<div class='admin_section_title'>"._("Country")." : </div>\n"; 
    585588                $html .= "<div class='admin_section_data'>\n"; 
    586                 $name = "node_".$this->getId()."_country"; 
     589                $name = "node_".$hashed_node_id."_country"; 
    587590                $value = htmlspecialchars($this->getCountry(), ENT_QUOTES); 
    588591                $html .= "<input type='text' size ='15' value='$value' name='$name'>\n"; 
     
    594597                $html .= "<div class='admin_section_title'>"._("Public phone number")." : </div>\n"; 
    595598                $html .= "<div class='admin_section_data'>\n"; 
    596                 $name = "node_".$this->getId()."_public_phone"; 
     599                $name = "node_".$hashed_node_id."_public_phone"; 
    597600                $value = htmlspecialchars($this->getTelephone(), ENT_QUOTES); 
    598601                $html .= "<input type='text' size ='20' value='$value' name='$name'>\n"; 
     
    604607                $html .= "<div class='admin_section_title'>"._("Public email")." : </div>\n"; 
    605608                $html .= "<div class='admin_section_data'>\n"; 
    606                 $name = "node_".$this->getId()."_public_email"; 
     609                $name = "node_".$hashed_node_id."_public_email"; 
    607610                $value = htmlspecialchars($this->getEmail(), ENT_QUOTES); 
    608611                $html .= "<input type='text' size ='50' value='$value' name='$name'>\n"; 
     
    614617                $html .= "<div class='admin_section_title'>"._("Mass transit info")." : </div>\n"; 
    615618                $html .= "<div class='admin_section_data'>\n"; 
    616                 $name = "node_".$this->getId()."_mass_transit_info"; 
     619                $name = "node_".$hashed_node_id."_mass_transit_info"; 
    617620                $value = htmlspecialchars($this->getTransitInfo(), ENT_QUOTES); 
    618621                $html .= "<input type='text' size ='50' value='$value' name='$name'>\n"; 
     
    624627                $html .= "<div class='admin_section_title'>"._("Node deployment status")." : </div>\n"; 
    625628                $html .= "<div class='admin_section_data'>\n"; 
    626                 $name = "node_".$this->getId()."_deployment_status"; 
     629                $name = "node_".$hashed_node_id."_deployment_status"; 
    627630                $html .= self :: getSelectDeploymentStatus($name); 
    628631                $html .= "</div>\n"; 
     
    638641                // Build HTML form fields names & values 
    639642                $gis_point = $this->getGisLocation(); 
    640                 $gis_lat_name = "node_".$this->getId()."_gis_latitude"; 
     643                $gis_lat_name = "node_".$hashed_node_id."_gis_latitude"; 
    641644                $gis_lat_value = htmlspecialchars($gis_point->getLatitude(), ENT_QUOTES); 
    642                 $gis_long_name = "node_".$this->getId()."_gis_longitude"; 
     645                $gis_long_name = "node_".$hashed_node_id."_gis_longitude"; 
    643646                $gis_long_value = htmlspecialchars($gis_point->getLongitude(), ENT_QUOTES); 
    644647 
     
    791794 
    792795                // Information about the node 
    793  
     796                 
     797                // Hashed node_id (this is a workaround since PHP auto-converts HTTP vars var periods, spaces or underscores ) 
     798                $hashed_node_id = md5($this->getId()); 
     799                 
    794800                // Name 
    795                 $name = "node_".$this->getId()."_name"; 
     801                $name = "node_".$hashed_node_id."_name"; 
    796802                $this->setName($_REQUEST[$name]); 
    797803 
    798804                // Homepage URL 
    799                 $name = "node_".$this->getId()."_homepage_url"; 
     805                $name = "node_".$hashed_node_id."_homepage_url"; 
    800806                $this->setHomePageUrl($_REQUEST[$name]); 
    801807 
    802808                // Description 
    803                 $name = "node_".$this->getId()."_description"; 
     809                $name = "node_".$hashed_node_id."_description"; 
    804810                $this->setDescription($_REQUEST[$name]); 
    805811 
    806812                // Map URL 
    807                 $name = "node_".$this->getId()."_map_url"; 
     813                $name = "node_".$hashed_node_id."_map_url"; 
    808814                $this->setMapUrl($_REQUEST[$name]); 
    809815 
    810816                // Civic number 
    811                 $name = "node_".$this->getId()."_civic_number"; 
     817                $name = "node_".$hashed_node_id."_civic_number"; 
    812818                $this->setCivicNumber($_REQUEST[$name]); 
    813819 
    814820                // Street name 
    815                 $name = "node_".$this->getId()."_street_name"; 
     821                $name = "node_".$hashed_node_id."_street_name"; 
    816822                $this->setStreetName($_REQUEST[$name]); 
    817823 
    818824                // City 
    819                 $name = "node_".$this->getId()."_city"; 
     825                $name = "node_".$hashed_node_id."_city"; 
    820826                $this->setCity($_REQUEST[$name]); 
    821827 
    822828                // Province 
    823                 $name = "node_".$this->getId()."_province"; 
     829                $name = "node_".$hashed_node_id."_province"; 
    824830                $this->setProvince($_REQUEST[$name]); 
    825831 
    826832                // Postal Code 
    827                 $name = "node_".$this->getId()."_postal_code"; 
     833                $name = "node_".$hashed_node_id."_postal_code"; 
    828834                $this->setPostalCode($_REQUEST[$name]); 
    829835 
    830836                // Country 
    831                 $name = "node_".$this->getId()."_country"; 
     837                $name = "node_".$hashed_node_id."_country"; 
    832838                $this->setCountry($_REQUEST[$name]); 
    833839 
    834840                // Public phone # 
    835                 $name = "node_".$this->getId()."_public_phone"; 
     841                $name = "node_".$hashed_node_id."_public_phone"; 
    836842                $this->setTelephone($_REQUEST[$name]); 
    837843 
    838844                // Public mail 
    839                 $name = "node_".$this->getId()."_public_email"; 
     845                $name = "node_".$hashed_node_id."_public_email"; 
    840846                $this->setEmail($_REQUEST[$name]); 
    841847 
    842848                // Mass transit info 
    843                 $name = "node_".$this->getId()."_mass_transit_info"; 
     849                $name = "node_".$hashed_node_id."_mass_transit_info"; 
    844850                $this->setTransitInfo($_REQUEST[$name]); 
    845851 
    846852                // Deployment status 
    847                 $name = "node_".$this->getId()."_deployment_status"; 
     853                $name = "node_".$hashed_node_id."_deployment_status"; 
    848854                $this->setDeploymentStatus(self :: processSelectDeploymentStatus($name)); 
    849855 
     
    874880                { 
    875881                        // Use what has been set by the user.    
    876                         $gis_lat_name = "node_".$this->getId()."_gis_latitude"; 
    877                         $gis_long_name = "node_".$this->getId()."_gis_longitude"; 
     882                        $gis_lat_name = "node_".$hashed_node_id."_gis_latitude"; 
     883                        $gis_long_name = "node_".$hashed_node_id."_gis_longitude"; 
    878884                        $this->setGisLocation(new GisPoint($_REQUEST[$gis_lat_name], $_REQUEST[$gis_long_name], .0)); 
    879885                }