Changeset 1435
- Timestamp:
- 12/09/09 17:08:25 (2 years ago)
- Location:
- trunk/wifidog-auth
- Files:
-
- 15 modified
- 3 copied
-
CHANGELOG (modified) (1 diff)
-
wifidog/classes/Content.php (modified) (1 diff)
-
wifidog/classes/Dependency.php (modified) (1 diff)
-
wifidog/classes/HotspotGraph.php (copied) (copied from branches/gbastien/wifidog/classes/HotspotGraph.php)
-
wifidog/classes/HotspotGraphElement.php (copied) (copied from branches/gbastien/wifidog/classes/HotspotGraphElement.php)
-
wifidog/classes/MainUI.php (modified) (2 diffs)
-
wifidog/classes/Menu.php (modified) (1 diff)
-
wifidog/classes/Network.php (modified) (9 diffs)
-
wifidog/classes/Node.php (modified) (8 diffs)
-
wifidog/classes/NodeGroup.php (copied) (copied from branches/gbastien/wifidog/classes/NodeGroup.php)
-
wifidog/classes/Permission.php (modified) (2 diffs)
-
wifidog/classes/Session.php (modified) (1 diff)
-
wifidog/classes/StakeholderType.php (modified) (1 diff)
-
wifidog/classes/User.php (modified) (3 diffs)
-
wifidog/include/schema_validate.php (modified) (2 diffs)
-
wifidog/login/index.php (modified) (6 diffs)
-
wifidog/portal/index.php (modified) (3 diffs)
-
wifidog/signup.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wifidog-auth/CHANGELOG
r1428 r1435 1 1 # $Id$ 2 2 2009-12-08 3 * Added the concept of node group and hierarchy (in a not too clean way to start with, I will refactor the code before adding new functionalities to nodes and groups) (#246) 4 * Login and signup and logout script now receive the mac address as parameter (#675) 5 * Initial abuse control verification now made with the mac address (#676) 6 3 7 2009-10-30 Geneviève Bastien <gbastien@versatic.net> 4 8 * Network can now be set as case insensitive. Emails are now never case sensitive and usernames' case sensitivity is consistent with network settings (#616) -
trunk/wifidog-auth/wifidog/classes/Content.php
r1421 r1435 788 788 $rows = null; 789 789 $db->execSql($current_content_sql, $rows, false); 790 790 791 if ($rows) 791 792 foreach ($rows as $row) { -
trunk/wifidog-auth/wifidog/classes/Dependency.php
r1416 r1435 128 128 'mandatory' => true, 129 129 "type" => "localLib", 130 "detectFiles" => "lib/PHPMailer_v 2.0.0/class.phpmailer.php",130 "detectFiles" => "lib/PHPMailer_v5.1/class.phpmailer.php", 131 131 'description' => "Required for sending mail", 132 132 'website' => "http://phpmailer.codeworxtech.com/", 133 'installSourceUrl' => "http:// superb-west.dl.sourceforge.net/sourceforge/phpmailer/PHPMailer_v2.0.0.tar.gz",133 'installSourceUrl' => "http://iweb.dl.sourceforge.net/sourceforge/phpmailer/PHPMailer_v5.1.tar.gz", 134 134 'installMethod' => "tarball", 135 135 'installDestination' => "/" -
trunk/wifidog-auth/wifidog/classes/MainUI.php
r1419 r1435 467 467 $_gwAddress = null; 468 468 $_gwPort = null; 469 $_mac = null; 469 470 $_selected = ""; 470 471 $_languageChooser = array (); … … 499 500 $_gwAddress = $session->get(SESS_GW_ADDRESS_VAR); 500 501 $_gwPort = $session->get(SESS_GW_PORT_VAR); 502 $_mac = $session->get(SESS_USER_MAC_VAR); 501 503 502 504 // If gateway information could be detected tell them to Smarty 503 505 if ($_gwId && $_gwAddress && $_gwPort) { 504 $this->smarty->assign('logoutParameters', "&gw_id=" . $_gwId . "&gw_address=" . $_gwAddress . "&gw_port=" . $_gwPort );506 $this->smarty->assign('logoutParameters', "&gw_id=" . $_gwId . "&gw_address=" . $_gwAddress . "&gw_port=" . $_gwPort . ($_mac? "&mac=".$_mac:"")); 505 507 } 506 508 } else { -
trunk/wifidog-auth/wifidog/classes/Menu.php
r1421 r1435 188 188 $this->processHookMenu('Server'); 189 189 $this->processHookMenu('Node'); 190 $this->processHookMenu('NodeGroup'); 190 191 $this->processHookMenu('Network'); 191 192 $this->processHookMenu('User'); -
trunk/wifidog-auth/wifidog/classes/Network.php
r1428 r1435 55 55 require_once('classes/ThemePack.php'); 56 56 require_once('classes/Security.php'); 57 require_once('classes/HotspotGraphElement.php'); 57 58 58 59 /** … … 71 72 /** Object cache for the object factory (getObject())*/ 72 73 private static $instanceArray = array(); 74 protected $_hotspotGraphElement; 73 75 74 76 /** … … 201 203 throw new Exception(_('Unable to insert the new network in the database!')); 202 204 } 205 206 HotspotGraphElement::createNewObject($network_id, 'Network'); 207 203 208 $object = self::getObject($network_id); 204 209 require_once('classes/Stakeholder.php'); … … 378 383 { 379 384 $db = AbstractDb::getObject(); 385 if ($p_network_id == "") 386 $p_network_id = self::getDefaultNetwork()->getId(); 380 387 $network_id_str = $db->escapeString($p_network_id); 381 if ($network_id_str == "")382 $network_id_str = $db->escapeString(self::getDefaultNetwork()->getId());383 388 384 389 $sql = "SELECT *, EXTRACT(EPOCH FROM validation_grace_time) as validation_grace_time_seconds FROM networks WHERE network_id='$network_id_str'"; … … 390 395 $this->_row = $row; 391 396 $this->_id = $p_network_id; 397 $this->_hotspotGraphElement = HotspotGraphElement::getObject($this->_id,'Network'); 392 398 } 393 399 … … 1696 1702 * Content management 1697 1703 */ 1698 $title = _("Network content");1704 /* $title = _("Network content"); 1699 1705 $name = "network_".$this->_id."_content"; 1700 1706 $data = Content::getLinkedContentUI($name, "network_has_content", "network_id", $this->_id, $display_page = "portal"); 1701 $html .= InterfaceElements::generateAdminSectionContainer("network_content", $title, $data); 1707 $html .= InterfaceElements::generateAdminSectionContainer("network_content", $title, $data);*/ 1708 if (!is_null($this->_hotspotGraphElement)) 1709 $html .= $this->_hotspotGraphElement->getContentAdminUI(); 1702 1710 1703 1711 /* … … 1927 1935 $data = ProfileTemplate::getLinkedProfileTemplateUI($name, "network_has_profile_templates", "network_id", $this->_id); 1928 1936 $html .= InterfaceElements::generateAdminSectionContainer("network_profile_templates", $title, $data); 1937 1938 // objects hierarchy 1939 if (!is_null($this->_hotspotGraphElement)) 1940 $html .= $this->_hotspotGraphElement->getGraphAdminUI($this); 1929 1941 1930 1942 $html .= "</ul>\n"; … … 1946 1958 1947 1959 // Content management 1948 $name = "network_".$this->_id."_content"; 1949 Content :: processLinkedContentUI($name, 'network_has_content', 'network_id', $this->_id); 1960 if (!is_null($this->_hotspotGraphElement)) 1961 $this->_hotspotGraphElement->processContentAdminUI(); 1962 /* $name = "network_".$this->_id."_content"; 1963 Content :: processLinkedContentUI($name, 'network_has_content', 'network_id', $this->_id);*/ 1950 1964 1951 1965 // name … … 2064 2078 $name = "network_".$this->_id."_profile_templates"; 2065 2079 ProfileTemplate :: processLinkedProfileTemplateUI($name, 'network_has_profile_templates', 'network_id', $this->_id); 2080 2081 if (!is_null($this->_hotspotGraphElement)) 2082 $this->_hotspotGraphElement->processGraphAdminUI($errMsg, $this); 2083 if(!empty($errMsg)) { 2084 echo $errMsg; 2085 $errMsg = null; 2086 } 2066 2087 2067 2088 // Node creation -
trunk/wifidog-auth/wifidog/classes/Node.php
r1419 r1435 50 50 require_once('classes/Utils.php'); 51 51 require_once('classes/DateTimeWD.php'); 52 require_once('classes/HotspotGraphElement.php'); 52 53 53 54 /** … … 69 70 private $id; 70 71 private static $currentNode = null; 72 protected $_hotspotGraphElement; 71 73 72 74 /** … … 287 289 } 288 290 291 HotspotGraphElement::createNewObject($node_id, 'Node'); 292 289 293 $object = self::getObject($node_id); 290 294 … … 693 697 $this->_row = $row; 694 698 $this->id = $row['node_id']; 699 700 $this->_hotspotGraphElement = HotspotGraphElement::getObject($this->id, 'Node'); 695 701 } 696 702 … … 1187 1193 1188 1194 //Node content 1189 $_html_content = array();1195 /*$_html_content = array(); 1190 1196 $_title = _("Node content"); 1191 1197 $_data = Content::getLinkedContentUI("node_" . $node_id . "_content", "node_has_content", "node_id", $this->id, "portal"); 1192 $html .= InterfaceElements::generateAdminSectionContainer("node_content", $_title, $_data); 1193 1198 $html .= InterfaceElements::generateAdminSectionContainer("node_content", $_title, $_data);*/ 1199 if (!is_null($this->_hotspotGraphElement)) 1200 $html .= $this->_hotspotGraphElement->getContentAdminUI(); 1201 1194 1202 // Name 1195 1203 $permArray = null; … … 1362 1370 $html .= InterfaceElements::generateAdminSectionContainer("access_rights", _("Access rights"), $html_access_rights); 1363 1371 } 1372 1373 //Node hierarchy 1374 if (!is_null($this->_hotspotGraphElement)) 1375 $html .= $this->_hotspotGraphElement->getGraphAdminUI($network); 1364 1376 1365 1377 $html .= "</ul>\n"; … … 1404 1416 } 1405 1417 // Content processing 1406 $name = "node_{$node_id}_content"; 1407 Content::processLinkedContentUI($name, 'node_has_content', 'node_id', $this->id); 1418 if (!is_null($this->_hotspotGraphElement)) 1419 $this->_hotspotGraphElement->processContentAdminUI(); 1420 /*$name = "node_{$node_id}_content"; 1421 Content::processLinkedContentUI($name, 'node_has_content', 'node_id', $this->id);*/ 1408 1422 1409 1423 // Name … … 1566 1580 1567 1581 // End Node configuration section 1582 1583 if (!is_null($this->_hotspotGraphElement)) 1584 $this->_hotspotGraphElement->processGraphAdminUI($errMsg, $network); 1585 if(!empty($errMsg)) { 1586 echo $errMsg; 1587 $errMsg = null; 1588 } 1568 1589 1569 1590 // Access rights -
trunk/wifidog-auth/wifidog/classes/Permission.php
r1421 r1435 89 89 $PERMISSIONS['NETWORK_PERM_VIEW_STATISTICS'] = array(_("User is allowed to view all statistics for this network"), StakeholderType::Network, true); 90 90 $PERMISSIONS['NETWORK_PERM_EDIT_ANY_NODE_CONFIG'] = array(_("User is allowed to edit any configuration of any node on the network"), StakeholderType::Network, true); 91 $PERMISSIONS['NETWORK_PERM_EDIT_ANY_NODEGROUP_CONFIG'] = array(_("User is allowed to edit any configuration of any node group on the network"), StakeholderType::Network, true); 91 92 $PERMISSIONS['NETWORK_PERM_ADD_NODE'] = array(_("User is allowed to create a new Node on this network"), StakeholderType::Network, true); 93 $PERMISSIONS['NETWORK_PERM_ADD_NODEGROUP'] = array(_("User is allowed to create a new Node Group on this network"), StakeholderType::Network, true); 92 94 $PERMISSIONS['NETWORK_PERM_EDIT_DYNAMIC_ABUSE_CONTROL'] = array(_("User is allowed to set dynamic abuse control options for the network"), StakeholderType::Network, false); 95 $PERMISSIONS['NETWORK_PERM_ALLOW_GROUP_NODE'] = array(_("User is allowed group nodes into virtual node groups"), StakeholderType::Network, false); 93 96 94 97 $PERMISSIONS['SERVER_PERM_EDIT_ROLES'] = array(_("User is allowed to edit user role definitions"), StakeholderType::Server, true); … … 107 110 $PERMISSIONS['NODE_PERM_BYPASS_DYNAMIC_ABUSE_CONTROL'] = array(_("User is allowed to exceed dynamic abuse control limits at this node"), StakeholderType::Node, false); 108 111 $PERMISSIONS['NODE_PERM_ALLOW_GENERATING_PUBLIC_STATS'] = array(_("User is allowed to turn on publicly accessible aggregate statistics for this node"), StakeholderType::Node, false); 112 113 $PERMISSIONS['NODEGROUP_PERM_DELETE_NODEGROUP'] = array(_("User is allowed to delete this node group"), StakeholderType::NodeGroup, true); 114 $PERMISSIONS['NODEGROUP_PERM_EDIT_ANY_NODEGROUP_CONFIG'] = array(_("User is allowed to edit any configuration of any node group on the network"), StakeholderType::NodeGroup, true); 115 $PERMISSIONS['NODEGROUP_PERM_EDIT_NODEGROUP_CONFIG'] = array(_("User is allowed to edit any configuration of this node group"), StakeholderType::NodeGroup, true); 116 $PERMISSIONS['NODEGROUP_PERM_ADD_NODEGROUP'] = array(_("User is allowed to create a new Node Group on this network"), StakeholderType::NodeGroup, true); 109 117 110 118 self::$_permissionArray = $PERMISSIONS; -
trunk/wifidog-auth/wifidog/classes/Session.php
r1421 r1435 45 45 define('SESS_USERNAME_VAR', 'SESS_USERNAME'); 46 46 define('SESS_USER_ID_VAR', 'SESS_USER_ID'); 47 define('SESS_USER_MAC_VAR', 'SESS_USER_MAC'); 47 48 define('SESS_PASSWORD_HASH_VAR', 'SESS_PASSWORD_HASH'); 48 49 define('SESS_ORIGINAL_URL_VAR', 'SESS_ORIGINAL_URL'); -
trunk/wifidog-auth/wifidog/classes/StakeholderType.php
r1419 r1435 64 64 const Server = 'Server'; 65 65 const Content = 'Content'; 66 const NodeGroup = 'NodeGroup'; 67 66 68 /** 67 69 * Get an instance of the object -
trunk/wifidog-auth/wifidog/classes/User.php
r1428 r1435 639 639 @return true on success, false on failure 640 640 */ 641 function generateConnectionToken( ) {641 function generateConnectionToken($mac = null) { 642 642 if ($this->isUserValid()) { 643 643 $db = AbstractDb::getObject(); … … 648 648 $node_ip = $db->escapeString($_SERVER['REMOTE_ADDR']); 649 649 } 650 650 651 if ($session && $node_ip && $session->get(SESS_NODE_ID_VAR)) { 651 652 //echo "$session && $node_ip && {$session->get(SESS_NODE_ID_VAR)}"; 652 653 $node_id = $db->escapeString($session->get(SESS_NODE_ID_VAR)); 653 $abuseControlFault = User::isAbuseControlViolated($this, null, Node::getObject($node_id));654 $abuseControlFault = User::isAbuseControlViolated($this, $mac, Node::getObject($node_id)); 654 655 if($abuseControlFault) { 655 656 throw new Exception ($abuseControlFault); 656 657 } 658 $mac = (is_null($mac)?'': $db->escapeString($mac)); 657 659 /* 658 660 * Delete all unused tokens for this user, so we don't fill the database … … 663 665 664 666 $sql .= "INSERT INTO tokens (token_owner, token_issuer, token_id, token_status) VALUES ('" . $this->getId() . "', '" . $this->getId() . "', '$token', '" . TOKEN_UNUSED . "');\n"; 665 $sql .= "INSERT INTO connections (user_id, token_id, timestamp_in, node_id, node_ip, last_updated ) VALUES ('" . $this->getId() . "', '$token', CURRENT_TIMESTAMP, '$node_id', '$node_ip', CURRENT_TIMESTAMP)";667 $sql .= "INSERT INTO connections (user_id, token_id, timestamp_in, node_id, node_ip, last_updated, user_mac) VALUES ('" . $this->getId() . "', '$token', CURRENT_TIMESTAMP, '$node_id', '$node_ip', CURRENT_TIMESTAMP, '$mac')"; 666 668 $db->execSqlUpdate($sql, false); 667 669 $retval = $token; -
trunk/wifidog-auth/wifidog/include/schema_validate.php
r1428 r1435 48 48 * Define current database schema version 49 49 */ 50 define('REQUIRED_SCHEMA_VERSION', 6 7);50 define('REQUIRED_SCHEMA_VERSION', 68); 51 51 /** Used to test a new shecma version before modyfying the database */ 52 52 define('SCHEMA_UPDATE_TEST_MODE', false); … … 1456 1456 } 1457 1457 1458 $new_schema_version = 68; 1459 if ($schema_version < $new_schema_version && $new_schema_version <= $targetSchema) { 1460 printUpdateVersion($new_schema_version); 1461 $sql .= "\n\nUPDATE schema_info SET value='$new_schema_version' WHERE tag='schema_version';\n"; 1462 1463 $sql .= "CREATE TABLE node_groups \n"; 1464 $sql .= "( \n"; 1465 $sql .= "node_group_id character varying(32) PRIMARY KEY, \n"; 1466 $sql .= "name text, \n"; 1467 $sql .= "description text , \n"; 1468 $sql .= "group_creation_date timestamp NOT NULL DEFAULT now() \n"; 1469 $sql .= ");\n\n"; 1470 1471 $sql .= "CREATE TABLE hotspot_graph_elements \n"; 1472 $sql .= "( \n"; 1473 $sql .= "hotspot_graph_element_id character varying(32) PRIMARY KEY, \n"; 1474 $sql .= "element_id text, \n"; 1475 $sql .= "element_type character varying(16) \n"; 1476 $sql .= ");\n\n"; 1477 1478 $sql .= "CREATE TABLE hotspot_graph \n"; 1479 $sql .= "( \n"; 1480 $sql .= "child_element_id character varying(32) REFERENCES hotspot_graph_elements (hotspot_graph_element_id) ON UPDATE CASCADE ON DELETE CASCADE NOT NULL , \n"; 1481 $sql .= "parent_element_id character varying(32) REFERENCES hotspot_graph_elements (hotspot_graph_element_id) ON UPDATE CASCADE ON DELETE CASCADE NOT NULL , \n"; 1482 $sql .= "link_order integer DEFAULT 1 , \n"; 1483 $sql .= "PRIMARY KEY(child_element_id, parent_element_id) \n"; 1484 $sql .= ");\n\n"; 1485 1486 $sql .= "CREATE TABLE hotspot_graph_element_has_content (\n"; 1487 $sql .= "hotspot_graph_element_id character varying(32) REFERENCES hotspot_graph_elements (hotspot_graph_element_id) ON UPDATE CASCADE ON DELETE CASCADE NOT NULL ,\n"; 1488 $sql .= "content_id text NOT NULL,\n"; 1489 $sql .= "subscribe_timestamp timestamp without time zone DEFAULT now() NOT NULL,\n"; 1490 $sql .= "display_page text DEFAULT 'portal'::text NOT NULL,\n"; 1491 $sql .= "display_area text DEFAULT 'main_area_middle'::text NOT NULL,\n"; 1492 $sql .= "display_order integer DEFAULT 1 NOT NULL\n"; 1493 $sql .= ");\n\n"; 1494 1495 $sql .= "INSERT INTO stakeholder_types (stakeholder_type_id) VALUES ('NodeGroup');\n"; 1496 1497 //$networks = Network::getAllNetworks(); 1498 $networks = array(); 1499 $db->execSql("Select network_id from networks", $networks, false); 1500 foreach ($networks as $network) { 1501 $new_guid = get_guid(); 1502 $sql .= "INSERT INTO hotspot_graph_elements values('{$new_guid}', '{$network['network_id']}', 'Network' );\n "; 1503 $nodes = array(); 1504 $db->execSql("SELECT node_id FROM nodes where network_id = '{$network['network_id']}'", $nodes, false); 1505 foreach ($nodes as $node) { 1506 $node_guid = get_guid(); 1507 $sql .= "INSERT INTO hotspot_graph_elements values('{$node_guid}', '{$node['node_id']}', 'Node' );\n "; 1508 $sql .= "INSERT INTO hotspot_graph(child_element_id, parent_element_id) VALUES ('{$node_guid}', '{$new_guid}');\n"; 1509 } 1510 } 1511 1512 $sql .= "INSERT INTO hotspot_graph_element_has_content (\n"; 1513 $sql .= "SELECT hge.hotspot_graph_element_id, content_id, subscribe_timestamp, display_page, display_area, display_order \n"; 1514 $sql .= "FROM hotspot_graph_elements hge inner join network_has_content nhc on nhc.network_id = hge.element_id \n"; 1515 $sql .= "WHERE hge.element_type = 'Network');\n\n"; 1516 1517 $sql .= "INSERT INTO hotspot_graph_element_has_content (\n"; 1518 $sql .= "SELECT hge.hotspot_graph_element_id, content_id, subscribe_timestamp, display_page, display_area, display_order \n"; 1519 $sql .= "FROM hotspot_graph_elements hge inner join node_has_content nhc on nhc.node_id = hge.element_id \n"; 1520 $sql .= "WHERE hge.element_type = 'Node');\n\n"; 1521 1522 $sql .= "CREATE TABLE nodegroup_stakeholders (\n"; 1523 $sql .= ")\n"; 1524 $sql .= "INHERITS (stakeholders);\n\n"; 1525 } 1526 1527 1458 1528 /* 1459 1529 $new_schema_version = ; -
trunk/wifidog-auth/wifidog/login/index.php
r1419 r1435 88 88 $gw_port = null; 89 89 $gw_id = null; 90 $mac = null; 90 91 $logout = null; 91 92 … … 118 119 exit; 119 120 } 121 122 if (isset($_REQUEST["mac"])) { 123 $session->set(SESS_USER_MAC_VAR, $_REQUEST['mac']); 124 $mac = $_REQUEST['mac']; 125 } 126 120 127 121 128 /* … … 182 189 // Login from a gateway, redirect to the gateway to activate the token 183 190 $user = $network->getSplashOnlyUser(); 184 $token = $user->generateConnectionToken( );191 $token = $user->generateConnectionToken($mac); 185 192 User::setCurrentUser($user); 186 193 header("Location: http://" . $gw_address . ":" . $gw_port . "/wifidog/auth?token=" . $token); … … 206 213 if (!empty($gw_address) && !empty($gw_port)) { 207 214 // Login from a gateway, redirect to the gateway to activate the token 208 $token = $user->generateConnectionToken( );215 $token = $user->generateConnectionToken($mac); 209 216 if(!$token) 210 217 { … … 245 252 $smarty->assign('gw_port', $gw_port); 246 253 $smarty->assign('gw_id', $gw_id); 254 $smarty->assign('mac', $mac); 247 255 248 256 // Get the login form … … 256 264 if ($gw_id != null) 257 265 $html .= "<input type='hidden' name='gw_id' value='{$gw_id}'>\n"; 266 if ($mac != null) 267 $html .= "<input type='hidden' name='mac' value='{$mac}'>\n"; 258 268 $html .= Authenticator::getLoginUI(); 259 269 $html .= "</form>\n"; -
trunk/wifidog-auth/wifidog/portal/index.php
r1421 r1435 166 166 } 167 167 168 // Get all the parent objects of the node 169 $parents = HotspotGraph::getAllParents(HotspotGraphElement::getObjectFor($node)); 170 171 // Get the contents for all elements parents of and including the node, but exclude user subscribed content if user is known 172 foreach($parents as $parentid) { 173 $content_rows = array (); 174 $parent_id = $db->escapeString($parentid); 175 if ($current_user) { 176 $user_id = $db->escapeString($current_user->getId()); 177 $sql = "SELECT content_id, display_area, display_order FROM hotspot_graph_element_has_content hgehc "; 178 $sql .= "INNER JOIN hotspot_graph_elements hge on hgehc.hotspot_graph_element_id = hge.hotspot_graph_element_id "; 179 $sql .= "WHERE hge.hotspot_graph_element_id='$parent_id' AND display_page='portal' AND content_id NOT IN (SELECT content_id FROM user_has_content WHERE user_id = '{$user_id}') ORDER BY display_area, display_order, subscribe_timestamp DESC"; 180 } else { 181 $sql = "SELECT content_id, display_area, display_order FROM hotspot_graph_element_has_content hgehc "; 182 $sql .= "INNER JOIN hotspot_graph_elements hge on hgehc.hotspot_graph_element_id = hge.hotspot_graph_element_id "; 183 $sql .= "WHERE hge.hotspot_graph_element_id='$parent_id' AND display_page='portal' ORDER BY display_area, display_order, subscribe_timestamp DESC"; 184 } 185 $db->execSql($sql, $content_rows, false); 186 if ($content_rows) { 187 foreach ($content_rows as $content_row) { 188 $content = Content :: getObject($content_row['content_id']); 189 if ($content->isDisplayableAt($node)) { 190 $ui->addContent($content_row['display_area'], $content, $content_row['display_order']); 191 } 192 } 193 } 194 } 195 $showMoreLink = false; 196 168 197 // Get all network content, but exclude user subscribed content if user is known 169 $content_rows = array ();198 /*$content_rows = array (); 170 199 $network_id = $db->escapeString($network->getId()); 171 200 if ($current_user) { 172 201 $user_id = $db->escapeString($current_user->getId()); 173 $sql = "SELECT content_id, display_area, display_order FROM network_has_content WHERE network_id='$network_id' AND display_page='portal' AND content_id NOT IN (SELECT content_id FROM user_has_content WHERE user_id = '{$user_id}') ORDER BY display_area, display_order, subscribe_timestamp DESC"; 202 $sql = "SELECT content_id, display_area, display_order FROM hotspot_graph_element_has_content hgehc "; 203 $sql .= "INNER JOIN hotspot_graph_elements hge on hgehc.hotspot_graph_element_id = hge.hotspot_graph_element_id "; 204 $sql .= "WHERE hge.element_id='$network_id' AND hge.element_type = 'Network' AND display_page='portal' AND content_id NOT IN (SELECT content_id FROM user_has_content WHERE user_id = '{$user_id}') ORDER BY display_area, display_order, subscribe_timestamp DESC"; 174 205 } else { 175 $sql = "SELECT content_id, display_area, display_order FROM network_has_content WHERE network_id='$network_id' AND display_page='portal' ORDER BY display_area, display_order, subscribe_timestamp DESC"; 206 $sql = "SELECT content_id, display_area, display_order FROM hotspot_graph_element_has_content hgehc "; 207 $sql .= "INNER JOIN hotspot_graph_elements hge on hgehc.hotspot_graph_element_id = hge.hotspot_graph_element_id "; 208 $sql .= "WHERE hge.element_id='$network_id' AND hge.element_type = 'Network' AND display_page='portal' ORDER BY display_area, display_order, subscribe_timestamp DESC"; 176 209 } 177 210 $db->execSql($sql, $content_rows, false); … … 183 216 } 184 217 } 185 } 218 }*/ 186 219 187 220 // Get all node content and EXCLUDE user subscribed content 188 $content_rows = array ();221 /*$content_rows = array (); 189 222 $node_id = $db->escapeString($node->getId()); 190 223 if ($current_user) { 191 224 $user_id = $db->escapeString($current_user->getId()); 192 $sql = "SELECT content_id, display_area, display_order FROM node_has_content WHERE node_id='$node_id' AND display_page='portal' AND content_id NOT IN (SELECT content_id FROM user_has_content WHERE user_id = '{$user_id}') ORDER BY display_area, display_order, subscribe_timestamp DESC"; 225 $sql = "SELECT content_id, display_area, display_order FROM hotspot_graph_element_has_content hgehc "; 226 $sql .= "INNER JOIN hotspot_graph_elements hge on hgehc.hotspot_graph_element_id = hge.hotspot_graph_element_id "; 227 $sql .= "WHERE hge.element_id='$node_id' AND hge.element_type = 'Node' AND display_page='portal' AND content_id NOT IN (SELECT content_id FROM user_has_content WHERE user_id = '{$user_id}') ORDER BY display_area, display_order, subscribe_timestamp DESC"; 193 228 } else { 194 $sql = "SELECT content_id, display_area, display_order FROM node_has_content WHERE node_id='$node_id' AND display_page='portal' ORDER BY display_area, display_order, subscribe_timestamp DESC"; 229 $sql = "SELECT content_id, display_area, display_order FROM hotspot_graph_element_has_content hgehc "; 230 $sql .= "INNER JOIN hotspot_graph_elements hge on hgehc.hotspot_graph_element_id = hge.hotspot_graph_element_id "; 231 $sql .= "WHERE hge.element_id='$node_id' AND hge.element_type = 'Node' AND display_page='portal' ORDER BY display_area, display_order, subscribe_timestamp DESC"; 195 232 } 196 233 $db->execSql($sql, $content_rows, false); … … 203 240 } 204 241 } 205 } 242 }*/ 206 243 207 244 // Get all user content -
trunk/wifidog-auth/wifidog/signup.php
r1421 r1435 228 228 $gw_address = $session->get(SESS_GW_ADDRESS_VAR); 229 229 $gw_port = $session->get(SESS_GW_PORT_VAR); 230 $mac = $session->get(SESS_USER_MAC_VAR); 230 231 231 232 if ($gw_id && $gw_address && $gw_port) { 232 233 // Make sure the user IDs match 233 234 if(($created_user->getId() == $authenticated_user->getId())) { 234 $token = $created_user->generateConnectionToken( );235 $token = $created_user->generateConnectionToken($mac); 235 236 236 237 $redirURL = "http://" . $gw_address . ":" . $gw_port . "/wifidog/auth?token=" . $token;
