Changeset 706
- Timestamp:
- 08/31/05 23:03:21 (8 years ago)
- Location:
- trunk/wifidog-auth
- Files:
-
- 2 modified
-
ChangeLog (modified) (1 diff)
-
wifidog/classes/Node.php (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wifidog-auth/ChangeLog
r705 r706 1 2005-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 1 6 2005-08-31 Benoit Grégoire <bock@step.polymtl.ca> 2 7 * Node.php: Fix node creation 3 8 4 9 2005-08-31 Francois Proulx <francois.proulx@gmail.com> 5 10 * Fixed new node creation bug -
trunk/wifidog-auth/wifidog/classes/Node.php
r705 r706 490 490 $html .= "</div>\n"; 491 491 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 492 495 // Name 493 496 $html .= "<div class='admin_section_container'>\n"; 494 497 $html .= "<div class='admin_section_title'>"._("Name")." : </div>\n"; 495 498 $html .= "<div class='admin_section_data'>\n"; 496 $name = "node_".$ this->getId()."_name";499 $name = "node_".$hashed_node_id."_name"; 497 500 $value = htmlspecialchars($this->getName(), ENT_QUOTES); 498 501 $html .= "<input type='text' size ='50' value='$value' name='$name'>\n"; … … 504 507 $html .= "<div class='admin_section_title'>"._("Homepage URL")." : </div>\n"; 505 508 $html .= "<div class='admin_section_data'>\n"; 506 $name = "node_".$ this->getId()."_homepage_url";509 $name = "node_".$hashed_node_id."_homepage_url"; 507 510 $value = htmlspecialchars($this->getHomePageURL(), ENT_QUOTES); 508 511 $html .= "<input type='text' size ='50' value='$value' name='$name'>\n"; … … 514 517 $html .= "<div class='admin_section_title'>"._("Description")." : </div>\n"; 515 518 $html .= "<div class='admin_section_data'>\n"; 516 $name = "node_".$ this->getId()."_description";519 $name = "node_".$hashed_node_id."_description"; 517 520 $value = htmlspecialchars($this->getDescription(), ENT_QUOTES); 518 521 $html .= "<textarea cols='50' rows='5' name='$name'>$value</textarea>\n"; … … 524 527 $html .= "<div class='admin_section_title'>"._("Map URL")." : </div>\n"; 525 528 $html .= "<div class='admin_section_data'>\n"; 526 $name = "node_".$ this->getId()."_map_url";529 $name = "node_".$hashed_node_id."_map_url"; 527 530 $value = htmlspecialchars($this->getMapURL(), ENT_QUOTES); 528 531 $html .= "<input type='text' size ='50' value='$value' name='$name'>\n"; … … 534 537 $html .= "<div class='admin_section_title'>"._("Civic number")." : </div>\n"; 535 538 $html .= "<div class='admin_section_data'>\n"; 536 $name = "node_".$ this->getId()."_civic_number";539 $name = "node_".$hashed_node_id."_civic_number"; 537 540 $value = htmlspecialchars($this->getCivicNumber(), ENT_QUOTES); 538 541 $html .= "<input type='text' size ='10' value='$value' name='$name'>\n"; … … 544 547 $html .= "<div class='admin_section_title'>"._("Street name")." : </div>\n"; 545 548 $html .= "<div class='admin_section_data'>\n"; 546 $name = "node_".$ this->getId()."_street_name";549 $name = "node_".$hashed_node_id."_street_name"; 547 550 $value = htmlspecialchars($this->getStreetName(), ENT_QUOTES); 548 551 $html .= "<input type='text' size ='25' value='$value' name='$name'>\n"; … … 554 557 $html .= "<div class='admin_section_title'>"._("City")." : </div>\n"; 555 558 $html .= "<div class='admin_section_data'>\n"; 556 $name = "node_".$ this->getId()."_city";559 $name = "node_".$hashed_node_id."_city"; 557 560 $value = htmlspecialchars($this->getCity(), ENT_QUOTES); 558 561 $html .= "<input type='text' size ='25' value='$value' name='$name'>\n"; … … 564 567 $html .= "<div class='admin_section_title'>"._("Province / State")." : </div>\n"; 565 568 $html .= "<div class='admin_section_data'>\n"; 566 $name = "node_".$ this->getId()."_province";569 $name = "node_".$hashed_node_id."_province"; 567 570 $value = htmlspecialchars($this->getProvince(), ENT_QUOTES); 568 571 $html .= "<input type='text' size ='15' value='$value' name='$name'>\n"; … … 574 577 $html .= "<div class='admin_section_title'>"._("Postal code")." : </div>\n"; 575 578 $html .= "<div class='admin_section_data'>\n"; 576 $name = "node_".$ this->getId()."_postal_code";579 $name = "node_".$hashed_node_id."_postal_code"; 577 580 $value = htmlspecialchars($this->getPostalCode(), ENT_QUOTES); 578 581 $html .= "<input type='text' size ='10' value='$value' name='$name'>\n"; … … 584 587 $html .= "<div class='admin_section_title'>"._("Country")." : </div>\n"; 585 588 $html .= "<div class='admin_section_data'>\n"; 586 $name = "node_".$ this->getId()."_country";589 $name = "node_".$hashed_node_id."_country"; 587 590 $value = htmlspecialchars($this->getCountry(), ENT_QUOTES); 588 591 $html .= "<input type='text' size ='15' value='$value' name='$name'>\n"; … … 594 597 $html .= "<div class='admin_section_title'>"._("Public phone number")." : </div>\n"; 595 598 $html .= "<div class='admin_section_data'>\n"; 596 $name = "node_".$ this->getId()."_public_phone";599 $name = "node_".$hashed_node_id."_public_phone"; 597 600 $value = htmlspecialchars($this->getTelephone(), ENT_QUOTES); 598 601 $html .= "<input type='text' size ='20' value='$value' name='$name'>\n"; … … 604 607 $html .= "<div class='admin_section_title'>"._("Public email")." : </div>\n"; 605 608 $html .= "<div class='admin_section_data'>\n"; 606 $name = "node_".$ this->getId()."_public_email";609 $name = "node_".$hashed_node_id."_public_email"; 607 610 $value = htmlspecialchars($this->getEmail(), ENT_QUOTES); 608 611 $html .= "<input type='text' size ='50' value='$value' name='$name'>\n"; … … 614 617 $html .= "<div class='admin_section_title'>"._("Mass transit info")." : </div>\n"; 615 618 $html .= "<div class='admin_section_data'>\n"; 616 $name = "node_".$ this->getId()."_mass_transit_info";619 $name = "node_".$hashed_node_id."_mass_transit_info"; 617 620 $value = htmlspecialchars($this->getTransitInfo(), ENT_QUOTES); 618 621 $html .= "<input type='text' size ='50' value='$value' name='$name'>\n"; … … 624 627 $html .= "<div class='admin_section_title'>"._("Node deployment status")." : </div>\n"; 625 628 $html .= "<div class='admin_section_data'>\n"; 626 $name = "node_".$ this->getId()."_deployment_status";629 $name = "node_".$hashed_node_id."_deployment_status"; 627 630 $html .= self :: getSelectDeploymentStatus($name); 628 631 $html .= "</div>\n"; … … 638 641 // Build HTML form fields names & values 639 642 $gis_point = $this->getGisLocation(); 640 $gis_lat_name = "node_".$ this->getId()."_gis_latitude";643 $gis_lat_name = "node_".$hashed_node_id."_gis_latitude"; 641 644 $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"; 643 646 $gis_long_value = htmlspecialchars($gis_point->getLongitude(), ENT_QUOTES); 644 647 … … 791 794 792 795 // 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 794 800 // Name 795 $name = "node_".$ this->getId()."_name";801 $name = "node_".$hashed_node_id."_name"; 796 802 $this->setName($_REQUEST[$name]); 797 803 798 804 // Homepage URL 799 $name = "node_".$ this->getId()."_homepage_url";805 $name = "node_".$hashed_node_id."_homepage_url"; 800 806 $this->setHomePageUrl($_REQUEST[$name]); 801 807 802 808 // Description 803 $name = "node_".$ this->getId()."_description";809 $name = "node_".$hashed_node_id."_description"; 804 810 $this->setDescription($_REQUEST[$name]); 805 811 806 812 // Map URL 807 $name = "node_".$ this->getId()."_map_url";813 $name = "node_".$hashed_node_id."_map_url"; 808 814 $this->setMapUrl($_REQUEST[$name]); 809 815 810 816 // Civic number 811 $name = "node_".$ this->getId()."_civic_number";817 $name = "node_".$hashed_node_id."_civic_number"; 812 818 $this->setCivicNumber($_REQUEST[$name]); 813 819 814 820 // Street name 815 $name = "node_".$ this->getId()."_street_name";821 $name = "node_".$hashed_node_id."_street_name"; 816 822 $this->setStreetName($_REQUEST[$name]); 817 823 818 824 // City 819 $name = "node_".$ this->getId()."_city";825 $name = "node_".$hashed_node_id."_city"; 820 826 $this->setCity($_REQUEST[$name]); 821 827 822 828 // Province 823 $name = "node_".$ this->getId()."_province";829 $name = "node_".$hashed_node_id."_province"; 824 830 $this->setProvince($_REQUEST[$name]); 825 831 826 832 // Postal Code 827 $name = "node_".$ this->getId()."_postal_code";833 $name = "node_".$hashed_node_id."_postal_code"; 828 834 $this->setPostalCode($_REQUEST[$name]); 829 835 830 836 // Country 831 $name = "node_".$ this->getId()."_country";837 $name = "node_".$hashed_node_id."_country"; 832 838 $this->setCountry($_REQUEST[$name]); 833 839 834 840 // Public phone # 835 $name = "node_".$ this->getId()."_public_phone";841 $name = "node_".$hashed_node_id."_public_phone"; 836 842 $this->setTelephone($_REQUEST[$name]); 837 843 838 844 // Public mail 839 $name = "node_".$ this->getId()."_public_email";845 $name = "node_".$hashed_node_id."_public_email"; 840 846 $this->setEmail($_REQUEST[$name]); 841 847 842 848 // Mass transit info 843 $name = "node_".$ this->getId()."_mass_transit_info";849 $name = "node_".$hashed_node_id."_mass_transit_info"; 844 850 $this->setTransitInfo($_REQUEST[$name]); 845 851 846 852 // Deployment status 847 $name = "node_".$ this->getId()."_deployment_status";853 $name = "node_".$hashed_node_id."_deployment_status"; 848 854 $this->setDeploymentStatus(self :: processSelectDeploymentStatus($name)); 849 855 … … 874 880 { 875 881 // 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"; 878 884 $this->setGisLocation(new GisPoint($_REQUEST[$gis_lat_name], $_REQUEST[$gis_long_name], .0)); 879 885 }
