Changeset 705
- Timestamp:
- 08/31/05 22:41:44 (8 years ago)
- Location:
- trunk/wifidog-auth
- Files:
-
- 4 modified
-
ChangeLog (modified) (1 diff)
-
wifidog/classes/GenericObject.php (modified) (1 diff)
-
wifidog/classes/Network.php (modified) (1 diff)
-
wifidog/classes/Node.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wifidog-auth/ChangeLog
r704 r705 1 2005-08-31 Benoit Grégoire <bock@step.polymtl.ca> 2 * Node.php: Fix node creation 3 1 4 2005-08-31 Francois Proulx <francois.proulx@gmail.com> 2 5 * Fixed new node creation bug 3 6 4 7 2005-08-29 Philippe April <philippe@ilesansfil.org> 5 8 * js/gmaps_hotspots_status_map.js: Fixed small bug in that makes prevents -
trunk/wifidog-auth/wifidog/classes/GenericObject.php
r553 r705 27 27 require_once BASEPATH.'include/common.php'; 28 28 require_once BASEPATH.'classes/Content.php'; 29 /*function __autoload($class_name) {30 require_once BASEPATH.'classes/'.$class_name . '.php';31 }*/32 29 33 30 /** Any object that implement this interface can be administered in a generic way. */ -
trunk/wifidog-auth/wifidog/classes/Network.php
r697 r705 262 262 if(!empty ($_REQUEST[$new_node_id])) 263 263 { 264 Node::createN ode($_REQUEST[$new_node_id], _("Default node name"));264 Node::createNewNode($_REQUEST[$new_node_id], $this); 265 265 $url = GENERIC_OBJECT_ADMIN_ABS_HREF."?".http_build_query(array("object_class" => "Node", "action" => "edit", "object_id" => $_REQUEST[$new_node_id])); 266 266 header("Location: {$url}"); -
trunk/wifidog-auth/wifidog/classes/Node.php
r704 r705 144 144 145 145 /** Create a new Node in the database 146 * @deprecated version - 18-Apr-2005147 146 * @param $id The id to be given to the new node 148 147 * @return the newly created Node object, or null if there was an error … … 153 152 154 153 $node_id = $db->EscapeString(get_guid()); 155 $name = $db->EscapeString('New node'); 156 157 $sql = "INSERT INTO nodes (node_id, name) VALUES ('$node_id','$name')"; 158 159 if (!$db->ExecSqlUpdate($sql, false)) 160 { 161 throw new Exception(_('Unable to insert new node into database!')); 162 } 163 $object = new self($node_id); 154 $object = self::createNewNode($node_id, Network::getCurrentNetwork()); 164 155 return $object; 165 156 } 166 157 167 158 /** Create a new Node in the database 168 * @deprecated version - 18-Apr-2005 169 * @param $id The id to be given to the new node 159 * @param $node_id The id to be given to the new node 160 * @param $network Network object. The node's network 161 * @todo Implement network 170 162 * @return the newly created Node object, or null if there was an error 171 163 */ 172 static function createNode($node_id, $name, $home_page_url = "", $description = "", $map_url = "", $street_name = "", $public_phone_number = "", $public_email = "", $mass_transit_info = "", $node_deployment_status = "IN_PLANNING") 173 { 174 global $db; 175 164 static function createNewNode($node_id, Network $network) 165 { 166 global $db; 176 167 $node_id = $db->EscapeString($node_id); 177 $name = $db->EscapeString($name); 178 $home_page_url = $db->EscapeString($home_page_url); 179 $description = $db->EscapeString($description); 180 $map_url = $db->EscapeString($map_url); 181 $street_name = $db->EscapeString($street_name); 182 $public_phone_number = $db->EscapeString($public_phone_number); 183 $public_email = $db->EscapeString($public_email); 184 $mass_transit_info = $db->EscapeString($mass_transit_info); 185 $node_deployment_status = $db->EscapeString($node_deployment_status); 186 168 $node_deployment_status = $db->EscapeString("IN_PLANNING"); 169 $node_name = _("New node"); 187 170 if (Node :: nodeExists($node_id)) 188 171 throw new Exception(_('This node already exists.')); 189 172 190 $sql = "INSERT INTO nodes (node_id, name, creation_date, home_page_url, description, map_url, street_name, public_phone_number, public_email, mass_transit_info, node_deployment_status) VALUES ('$node_id','$name', NOW(),'$home_page_url','$description','$map_url','$street_name','$public_phone_number','$public_email','$mass_transit_info','$node_deployment_status')";173 $sql = "INSERT INTO nodes (node_id, creation_date, node_deployment_status, name) VALUES ('$node_id', NOW(),'$node_deployment_status', '$node_name')"; 191 174 192 175 if (!$db->ExecSqlUpdate($sql, false)) … … 1246 1229 } 1247 1230 1248 function nodeExists($id) 1249 { 1250 global $db; 1231 /** Check if an node exists */ 1232 private function nodeExists($id) 1233 { 1234 global $db; 1235 $retval = false; 1251 1236 $id_str = $db->EscapeString($id); 1252 1237 $sql = "SELECT * FROM nodes WHERE node_id='{$id_str}'"; 1253 1238 $db->ExecSqlUniqueRes($sql, $row, false); 1254 return $row; 1239 if($row!=null) 1240 { 1241 $retval = true; 1242 } 1243 return $retval; 1255 1244 } 1256 1245
