Changeset 716
- Timestamp:
- 09/07/05 02:21:41 (8 years ago)
- Location:
- trunk/wifidog-auth
- Files:
-
- 6 modified
-
ChangeLog (modified) (1 diff)
-
sql/wifidog-postgres-initial-data.sql (modified) (1 diff)
-
sql/wifidog-postgres-schema.sql (modified) (8 diffs)
-
wifidog/classes/Node.php (modified) (7 diffs)
-
wifidog/include/common.php (modified) (1 diff)
-
wifidog/include/schema_validate.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wifidog-auth/ChangeLog
r715 r716 1 2005-08-31 Francois Proulx <francois.proulx@gmail.com> 1 2005-09-05 Benoit Grégoire <bock@step.polymtl.ca> 2 * include/common.php: Add code to undo the effect of magic_quote if enabled in the server config. It is still strongly recommended to disable magic_quote 3 * Node.php: Add UI for splash only node and custom portal 4 * Update schema 5 6 2005-09-04 Francois Proulx <francois.proulx@gmail.com> 2 7 * Removed update.php script ( should not have been in CVS ) 3 8 * Moved authenticator require in Network getAuthenticator() -
trunk/wifidog-auth/sql/wifidog-postgres-initial-data.sql
r695 r716 119 119 -- 120 120 121 INSERT INTO schema_info (tag, value) VALUES ('schema_version', '2 5');121 INSERT INTO schema_info (tag, value) VALUES ('schema_version', '28'); 122 122 123 123 -
trunk/wifidog-auth/sql/wifidog-postgres-schema.sql
r695 r716 28 28 29 29 SET search_path = public, pg_catalog; 30 31 -- 32 -- Name: plpgsql_call_handler(); Type: FUNCTION; Schema: public; Owner: postgres 33 -- 34 35 CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler 36 AS '$libdir/plpgsql', 'plpgsql_call_handler' 37 LANGUAGE c; 38 39 40 -- 41 -- Name: plpgsql_validator(oid); Type: FUNCTION; Schema: public; Owner: postgres 42 -- 43 44 CREATE FUNCTION plpgsql_validator(oid) RETURNS void 45 AS '$libdir/plpgsql', 'plpgsql_validator' 46 LANGUAGE c; 47 48 49 -- 50 -- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: public; Owner: 51 -- 52 53 CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler VALIDATOR plpgsql_validator; 54 30 55 31 56 SET default_tablespace = ''; … … 267 292 content_id text NOT NULL, 268 293 subscribe_timestamp timestamp without time zone DEFAULT now() NOT NULL 294 ); 295 296 297 -- 298 -- Name: network_stakeholders; Type: TABLE; Schema: public; Owner: wifidog; Tablespace: 299 -- 300 301 CREATE TABLE network_stakeholders ( 302 network_id text NOT NULL, 303 user_id character varying(45) NOT NULL, 304 is_admin boolean DEFAULT false NOT NULL, 305 is_stat_viewer boolean DEFAULT false NOT NULL 306 ); 307 308 309 -- 310 -- Name: networks; Type: TABLE; Schema: public; Owner: wifidog; Tablespace: 311 -- 312 313 CREATE TABLE networks ( 314 network_id text NOT NULL, 315 network_authenticator_class text NOT NULL, 316 network_authenticator_params text, 317 is_default_network boolean DEFAULT false NOT NULL, 318 name text DEFAULT 'Unnamed network'::text NOT NULL, 319 creation_date date DEFAULT now() NOT NULL, 320 homepage_url text, 321 tech_support_email text, 322 validation_grace_time interval DEFAULT '00:20:00'::interval NOT NULL, 323 validation_email_from_address text DEFAULT 'validation@wifidognetwork'::text NOT NULL, 324 allow_multiple_login boolean DEFAULT false NOT NULL, 325 allow_splash_only_nodes boolean DEFAULT false NOT NULL, 326 allow_custom_portal_redirect boolean DEFAULT false NOT NULL, 327 CONSTRAINT networks_name_check CHECK ((name <> ''::text)), 328 CONSTRAINT networks_network_authenticator_class_check CHECK ((network_authenticator_class <> ''::text)), 329 CONSTRAINT networks_validation_email_from_address_check CHECK ((validation_email_from_address <> ''::text)) 269 330 ); 270 331 … … 335 396 province text, 336 397 country text, 337 postal_code text 398 postal_code text, 399 network_id text NOT NULL, 400 last_paged timestamp without time zone, 401 is_splash_only_node boolean DEFAULT false, 402 custom_portal_redirect_url text 338 403 ); 339 404 … … 552 617 553 618 -- 619 -- Name: network_stakeholders_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog; Tablespace: 620 -- 621 622 ALTER TABLE ONLY network_stakeholders 623 ADD CONSTRAINT network_stakeholders_pkey PRIMARY KEY (network_id, user_id); 624 625 626 -- 627 -- Name: networks_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog; Tablespace: 628 -- 629 630 ALTER TABLE ONLY networks 631 ADD CONSTRAINT networks_pkey PRIMARY KEY (network_id); 632 633 634 -- 554 635 -- Name: node_deployment_status_pkey; Type: CONSTRAINT; Schema: public; Owner: wifidog; Tablespace: 555 636 -- … … 788 869 789 870 -- 871 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 872 -- 873 874 ALTER TABLE ONLY node_stakeholders 875 ADD CONSTRAINT "$1" FOREIGN KEY (node_id) REFERENCES nodes(node_id); 876 877 878 -- 790 879 -- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 791 880 -- … … 852 941 853 942 -- 943 -- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 944 -- 945 946 ALTER TABLE ONLY node_stakeholders 947 ADD CONSTRAINT "$2" FOREIGN KEY (user_id) REFERENCES users(user_id); 948 949 950 -- 854 951 -- Name: $3; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 855 952 -- … … 892 989 893 990 -- 991 -- Name: account_origin_fkey; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 992 -- 993 994 ALTER TABLE ONLY users 995 ADD CONSTRAINT account_origin_fkey FOREIGN KEY (account_origin) REFERENCES networks(network_id) ON UPDATE CASCADE ON DELETE RESTRICT; 996 997 998 -- 894 999 -- Name: administrators_ibfk_1; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 895 1000 -- … … 940 1045 941 1046 -- 942 -- Name: node_stakeholders_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 943 -- 944 945 ALTER TABLE ONLY node_stakeholders 946 ADD CONSTRAINT node_stakeholders_node_id_fkey FOREIGN KEY (node_id) REFERENCES nodes(node_id); 947 948 949 -- 950 -- Name: node_stakeholders_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 951 -- 952 953 ALTER TABLE ONLY node_stakeholders 954 ADD CONSTRAINT node_stakeholders_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(user_id); 1047 -- Name: network_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 1048 -- 1049 1050 ALTER TABLE ONLY nodes 1051 ADD CONSTRAINT network_id_fkey FOREIGN KEY (network_id) REFERENCES networks(network_id) ON UPDATE CASCADE ON DELETE RESTRICT; 1052 1053 1054 -- 1055 -- Name: network_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 1056 -- 1057 1058 ALTER TABLE ONLY network_has_content 1059 ADD CONSTRAINT network_id_fkey FOREIGN KEY (network_id) REFERENCES networks(network_id) ON UPDATE CASCADE ON DELETE CASCADE; 1060 1061 1062 -- 1063 -- Name: network_stakeholders_network_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 1064 -- 1065 1066 ALTER TABLE ONLY network_stakeholders 1067 ADD CONSTRAINT network_stakeholders_network_id_fkey FOREIGN KEY (network_id) REFERENCES networks(network_id); 1068 1069 1070 -- 1071 -- Name: network_stakeholders_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: wifidog 1072 -- 1073 1074 ALTER TABLE ONLY network_stakeholders 1075 ADD CONSTRAINT network_stakeholders_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(user_id); 955 1076 956 1077 -
trunk/wifidog-auth/wifidog/classes/Node.php
r708 r716 29 29 require_once 'AbstractGeocoder.php'; 30 30 31 /** Abstract a Node. A Node is an actual physical transmitter. */ 31 /** Abstract a Node. A Node is an actual physical transmitter. 32 * @todo: Make all the setter functions no-op if the value is the same as what 33 * was already stored Use setCustomPortelReduirectUrl as an example*/ 32 34 class Node implements GenericObject 33 35 { … … 474 476 } 475 477 478 /** Is the node a Splash Only node? Will only return true if the Network configuration allows it. 479 * @return true or false */ 480 public function isSplashOnly() 481 { 482 return $this->getNetwork()->getSplashOnlyNodesAllowed() && $this->isConfiguredSplashOnly(); 483 } 484 485 /** Is the node configured as a Splash Only node? This is NOT the same as isSplashOnly(). 486 * This is the getter for the configuration set in the database for this node. 487 * For the node to actually be splash only, this AND the network 488 * gonfiguration must match. 489 * @return true or false */ 490 public function isConfiguredSplashOnly() 491 { 492 return (($this->mRow['is_splash_only_node']=='t') ? true : false); 493 } 494 495 /** Set if this node should be a splash-only (no login) node (if enabled in Network configuration) 496 * @param $value The new value, true or false 497 * @return true on success, false on failure */ 498 function setIsConfiguredSplashOnly($value) 499 { 500 $retval = true; 501 if ($value != $this->isConfiguredSplashOnly()) 502 { 503 global $db; 504 $value?$value='TRUE':$value='FALSE'; 505 $retval = $db->ExecSqlUpdate("UPDATE nodes SET is_splash_only_node = {$value} WHERE node_id = '{$this->getId()}'", false); 506 $this->refresh(); 507 } 508 return $retval; 509 } 510 511 512 /** The url to show instead of the portal. If empty, the portal is shown 513 Must be enabled in the Network configuration to have any effect 514 @return a string */ 515 function getCustomPortalRedirectUrl() 516 { 517 return $this->mRow['custom_portal_redirect_url']; 518 } 519 520 /** The url to show instead of the portal. If empty, the portal is shown 521 Must be enabled in the Network configuration to have any effect 522 @return true on success, false on failure */ 523 function setCustomPortalRedirectUrl($value) 524 { 525 $retval = true; 526 if ($value != $this->getCustomPortalRedirectUrl()) 527 { 528 global $db; 529 $value = $db->EscapeString($value); 530 $retval = $db->ExecSqlUpdate("UPDATE nodes SET custom_portal_redirect_url = '{$value}' WHERE node_id = '{$this->getId()}'", false); 531 $this->refresh(); 532 } 533 return $retval; 534 } 535 476 536 /** Retreives the admin interface of this object. 477 537 * @return The HTML fragment for this interface */ … … 480 540 //TODO: Most of this code will be moved to Hotspot class when the abtraction will be completed 481 541 542 //pretty_print_r($_REQUEST); 543 //pretty_print_r($this->mRow); 482 544 $html = ''; 483 545 $html .= "<div class='admin_container'>\n"; … … 629 691 $value = htmlspecialchars($this->getTransitInfo(), ENT_QUOTES); 630 692 $html .= "<input type='text' size ='50' value='$value' name='$name'>\n"; 631 $html .= "</div>\n";632 $html .= "</div>\n";633 634 // Deployment status635 $html .= "<div class='admin_section_container'>\n";636 $html .= "<div class='admin_section_title'>"._("Node deployment status")." : </div>\n";637 $html .= "<div class='admin_section_data'>\n";638 $name = "node_".$hashed_node_id."_deployment_status";639 $html .= self :: getSelectDeploymentStatus($name);640 693 $html .= "</div>\n"; 641 694 $html .= "</div>\n"; … … 701 754 $html .= "</div>\n"; 702 755 756 // Node configuration section 757 $html .= "<div class='admin_section_container'>\n"; 758 $html .= "<div class='admin_section_title'>"._("Node configuration:")."</div>\n"; 759 760 $network = $this->getNetwork(); 761 762 // Deployment status 763 $html .= "<div class='admin_section_container'>\n"; 764 $html .= "<div class='admin_section_title'>"._("Node deployment status")." : </div>\n"; 765 $html .= "<div class='admin_section_data'>\n"; 766 $name = "node_".$hashed_node_id."_deployment_status"; 767 $html .= self :: getSelectDeploymentStatus($name); 768 $html .= "</div>\n"; 769 $html .= "</div>\n"; 770 771 // is_splash_only_node 772 if($network->getSplashOnlyNodesAllowed()) 773 { 774 $html .= "<div class='admin_section_container'>\n"; 775 $html .= "<div class='admin_section_title'>"._("Is this node splash-only (no login)?")." : </div>\n"; 776 $html .= "<div class='admin_section_data'>\n"; 777 $name = "node_".$hashed_node_id."_is_splash_only_node"; 778 $this->isConfiguredSplashOnly()? $checked='CHECKED': $checked=''; 779 $html .= "<input type='checkbox' name='$name' $checked>\n"; 780 $html .= "</div>\n"; 781 $html .= "</div>\n"; 782 } 783 784 // custom_portal_redirect_url 785 if($network->getCustomPortalRedirectAllowed()) 786 { 787 $html .= "<div class='admin_section_container'>\n"; 788 $html .= "<div class='admin_section_title'>"._("URL to show instead of the portal (if this is not empty, the portal will be disabled and this URL will be shown instead)")." : </div>\n"; 789 $html .= "<div class='admin_section_data'>\n"; 790 $name = "node_".$hashed_node_id."_custom_portal_redirect_url"; 791 $value = htmlspecialchars($this->getCustomPortalRedirectUrl(), ENT_QUOTES); 792 $html .= "<input type='text' size ='50' value='$value' name='$name'>\n"; 793 $html .= "</div>\n"; 794 $html .= "</div>\n"; 795 } 796 // End Node configuration section 797 $html .= "</div>\n"; 798 703 799 // Owners management 704 800 $html .= "<div class='admin_section_container'>\n"; … … 858 954 $name = "node_".$hashed_node_id."_mass_transit_info"; 859 955 $this->setTransitInfo($_REQUEST[$name]); 860 861 // Deployment status862 $name = "node_".$hashed_node_id."_deployment_status";863 $this->setDeploymentStatus(self :: processSelectDeploymentStatus($name));864 956 865 957 // GIS data … … 899 991 header("Location: hotspot_log.php?node_id=".urlencode($this->getId())); 900 992 993 // Node configuration section 994 995 $network = $this->getNetwork(); 996 997 // Deployment status 998 $name = "node_".$hashed_node_id."_deployment_status"; 999 $this->setDeploymentStatus(self :: processSelectDeploymentStatus($name)); 1000 1001 // is_splash_only_node 1002 if($network->getSplashOnlyNodesAllowed()) 1003 { 1004 $name = "node_".$hashed_node_id."_is_splash_only_node"; 1005 $this->setIsConfiguredSplashOnly(empty($_REQUEST[$name])?false:true); 1006 } 1007 1008 // custom_portal_redirect_url 1009 if($network->getCustomPortalRedirectAllowed()) 1010 { 1011 $name = "node_".$hashed_node_id."_custom_portal_redirect_url"; 1012 $this->setCustomPortalRedirectUrl($_REQUEST[$name]); 1013 } 1014 1015 // End Node configuration section 1016 901 1017 // Owners processing 902 1018 // Rebuild user id, and delete if it was selected -
trunk/wifidog-auth/wifidog/include/common.php
r695 r716 2 2 error_reporting(E_ALL); 3 3 require_once BASEPATH.'config.php'; 4 5 function undo_magic_quotes() 6 { 7 if (get_magic_quotes_gpc()) 8 { 9 $_GET = array_map_recursive('stripslashes', $_GET); 10 $_POST = array_map_recursive('stripslashes', $_POST); 11 $_COOKIE = array_map_recursive('stripslashes', $_COOKIE); 12 $_REQUEST = array_map_recursive('stripslashes', $_REQUEST); 13 } 14 } 15 16 if (!function_exists('array_map_recursive')) 17 { 18 function array_map_recursive($function, $data) 19 { 20 foreach ($data as $i => $item) 21 { 22 $data[$i] = is_array($item) ? array_map_recursive($function, $item) : $function ($item); 23 } 24 return $data; 25 } 26 } 27 undo_magic_quotes(); 28 4 29 require_once BASEPATH.'classes/AbstractDb.php'; 5 30 require_once BASEPATH.'classes/Session.php'; -
trunk/wifidog-auth/wifidog/include/schema_validate.php
r709 r716 28 28 require_once BASEPATH.'classes/AbstractDb.php'; 29 29 require_once BASEPATH.'classes/Session.php'; 30 define('REQUIRED_SCHEMA_VERSION', 2 7);30 define('REQUIRED_SCHEMA_VERSION', 28); 31 31 32 32 /** Check that the database schema is up to date. If it isn't, offer to update it. */ … … 606 606 607 607 } 608 608 $new_schema_version = 28; 609 if ($schema_version < $new_schema_version) 610 { 611 echo "<h2>Preparing SQL statements to update schema to version $new_schema_version</h2>\n"; 612 $sql .= "\n\nUPDATE schema_info SET value='$new_schema_version' WHERE tag='schema_version';\n"; 613 $sql .= "ALTER TABLE nodes ADD COLUMN is_splash_only_node boolean;\n"; 614 $sql .= "ALTER TABLE nodes ALTER COLUMN is_splash_only_node SET DEFAULT FALSE;\n"; 615 $sql .= "ALTER TABLE nodes ADD COLUMN custom_portal_redirect_url text;\n"; 616 617 } 609 618 $db->ExecSqlUpdate("BEGIN;\n$sql\nCOMMIT;\n", true); 610 619 //$db->ExecSqlUpdate("BEGIN;\n$sql\nROLLBACK;\n", true);
