Changeset 1435

Show
Ignore:
Timestamp:
12/09/09 17:08:25 (2 years ago)
Author:
gbastien
Message:

Merged branch 'gbastien' for node group with the trunk:
* 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)
* Login and signup and logout script now receive the mac address as parameter (#675)
* Initial abuse control verification now made with the mac address (#676)

Location:
trunk/wifidog-auth
Files:
15 modified
3 copied

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/CHANGELOG

    r1428 r1435  
    11# $Id$ 
    2  
     22009-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  
    372009-10-30 Geneviève Bastien <gbastien@versatic.net> 
    48  * 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  
    788788        $rows = null; 
    789789        $db->execSql($current_content_sql, $rows, false); 
     790      
    790791        if ($rows) 
    791792        foreach ($rows as $row) { 
  • trunk/wifidog-auth/wifidog/classes/Dependency.php

    r1416 r1435  
    128128       'mandatory' => true, 
    129129       "type" => "localLib", 
    130        "detectFiles" => "lib/PHPMailer_v2.0.0/class.phpmailer.php", 
     130       "detectFiles" => "lib/PHPMailer_v5.1/class.phpmailer.php", 
    131131       'description' => "Required for sending mail", 
    132132       '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", 
    134134       'installMethod' => "tarball", 
    135135       'installDestination' => "/" 
  • trunk/wifidog-auth/wifidog/classes/MainUI.php

    r1419 r1435  
    467467        $_gwAddress = null; 
    468468        $_gwPort = null; 
     469        $_mac = null; 
    469470        $_selected = ""; 
    470471        $_languageChooser = array (); 
     
    499500            $_gwAddress = $session->get(SESS_GW_ADDRESS_VAR); 
    500501            $_gwPort = $session->get(SESS_GW_PORT_VAR); 
     502            $_mac = $session->get(SESS_USER_MAC_VAR); 
    501503 
    502504            // If gateway information could be detected tell them to Smarty 
    503505            if ($_gwId && $_gwAddress && $_gwPort) { 
    504                 $this->smarty->assign('logoutParameters', "&amp;gw_id=" . $_gwId . "&amp;gw_address=" . $_gwAddress . "&amp;gw_port=" . $_gwPort); 
     506                $this->smarty->assign('logoutParameters', "&amp;gw_id=" . $_gwId . "&amp;gw_address=" . $_gwAddress . "&amp;gw_port=" . $_gwPort . ($_mac? "&amp;mac=".$_mac:"")); 
    505507            } 
    506508        } else { 
  • trunk/wifidog-auth/wifidog/classes/Menu.php

    r1421 r1435  
    188188        $this->processHookMenu('Server'); 
    189189        $this->processHookMenu('Node'); 
     190        $this->processHookMenu('NodeGroup'); 
    190191        $this->processHookMenu('Network'); 
    191192        $this->processHookMenu('User'); 
  • trunk/wifidog-auth/wifidog/classes/Network.php

    r1428 r1435  
    5555require_once('classes/ThemePack.php'); 
    5656require_once('classes/Security.php'); 
     57require_once('classes/HotspotGraphElement.php'); 
    5758 
    5859/** 
     
    7172    /** Object cache for the object factory (getObject())*/ 
    7273    private static $instanceArray = array(); 
     74    protected $_hotspotGraphElement; 
    7375 
    7476    /** 
     
    201203            throw new Exception(_('Unable to insert the new network in the database!')); 
    202204        } 
     205         
     206        HotspotGraphElement::createNewObject($network_id, 'Network'); 
     207         
    203208        $object = self::getObject($network_id); 
    204209        require_once('classes/Stakeholder.php'); 
     
    378383    { 
    379384        $db = AbstractDb::getObject(); 
     385        if ($p_network_id == "") 
     386            $p_network_id = self::getDefaultNetwork()->getId(); 
    380387        $network_id_str = $db->escapeString($p_network_id); 
    381         if ($network_id_str == "") 
    382         $network_id_str = $db->escapeString(self::getDefaultNetwork()->getId()); 
    383388 
    384389        $sql = "SELECT *, EXTRACT(EPOCH FROM validation_grace_time) as validation_grace_time_seconds FROM networks WHERE network_id='$network_id_str'"; 
     
    390395        $this->_row = $row; 
    391396        $this->_id = $p_network_id; 
     397        $this->_hotspotGraphElement = HotspotGraphElement::getObject($this->_id,'Network'); 
    392398    } 
    393399 
     
    16961702         * Content management 
    16971703         */ 
    1698         $title = _("Network content"); 
     1704       /* $title = _("Network content"); 
    16991705        $name = "network_".$this->_id."_content"; 
    17001706        $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(); 
    17021710 
    17031711        /* 
     
    19271935        $data = ProfileTemplate::getLinkedProfileTemplateUI($name, "network_has_profile_templates", "network_id", $this->_id); 
    19281936        $html .= InterfaceElements::generateAdminSectionContainer("network_profile_templates", $title, $data); 
     1937         
     1938        // objects hierarchy 
     1939        if (!is_null($this->_hotspotGraphElement)) 
     1940            $html .= $this->_hotspotGraphElement->getGraphAdminUI($this); 
    19291941 
    19301942        $html .= "</ul>\n"; 
     
    19461958 
    19471959        // 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);*/ 
    19501964 
    19511965        // name 
     
    20642078        $name = "network_".$this->_id."_profile_templates"; 
    20652079        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        } 
    20662087 
    20672088        // Node creation 
  • trunk/wifidog-auth/wifidog/classes/Node.php

    r1419 r1435  
    5050require_once('classes/Utils.php'); 
    5151require_once('classes/DateTimeWD.php'); 
     52require_once('classes/HotspotGraphElement.php'); 
    5253 
    5354/** 
     
    6970    private $id; 
    7071    private static $currentNode = null; 
     72    protected $_hotspotGraphElement; 
    7173 
    7274    /** 
     
    287289        } 
    288290 
     291        HotspotGraphElement::createNewObject($node_id, 'Node'); 
     292         
    289293        $object = self::getObject($node_id); 
    290294 
     
    693697        $this->_row = $row; 
    694698        $this->id = $row['node_id']; 
     699         
     700        $this->_hotspotGraphElement = HotspotGraphElement::getObject($this->id, 'Node'); 
    695701    } 
    696702 
     
    11871193 
    11881194        //Node content 
    1189         $_html_content = array(); 
     1195        /*$_html_content = array(); 
    11901196        $_title = _("Node content"); 
    11911197        $_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             
    11941202        // Name 
    11951203        $permArray = null; 
     
    13621370            $html .= InterfaceElements::generateAdminSectionContainer("access_rights", _("Access rights"), $html_access_rights); 
    13631371        } 
     1372         
     1373        //Node hierarchy 
     1374        if (!is_null($this->_hotspotGraphElement)) 
     1375            $html .= $this->_hotspotGraphElement->getGraphAdminUI($network); 
    13641376 
    13651377        $html .= "</ul>\n"; 
     
    14041416        } 
    14051417        // 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);*/ 
    14081422 
    14091423        // Name 
     
    15661580 
    15671581        // 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        } 
    15681589 
    15691590        // Access rights 
  • trunk/wifidog-auth/wifidog/classes/Permission.php

    r1421 r1435  
    8989            $PERMISSIONS['NETWORK_PERM_VIEW_STATISTICS'] = array(_("User is allowed to view all statistics for this network"), StakeholderType::Network, true); 
    9090            $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); 
    9192            $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); 
    9294            $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); 
    9396 
    9497            $PERMISSIONS['SERVER_PERM_EDIT_ROLES'] = array(_("User is allowed to edit user role definitions"), StakeholderType::Server, true); 
     
    107110            $PERMISSIONS['NODE_PERM_BYPASS_DYNAMIC_ABUSE_CONTROL'] = array(_("User is allowed to exceed dynamic abuse control limits at this node"), StakeholderType::Node, false); 
    108111            $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); 
    109117             
    110118            self::$_permissionArray = $PERMISSIONS; 
  • trunk/wifidog-auth/wifidog/classes/Session.php

    r1421 r1435  
    4545define('SESS_USERNAME_VAR', 'SESS_USERNAME'); 
    4646define('SESS_USER_ID_VAR', 'SESS_USER_ID'); 
     47define('SESS_USER_MAC_VAR', 'SESS_USER_MAC'); 
    4748define('SESS_PASSWORD_HASH_VAR', 'SESS_PASSWORD_HASH'); 
    4849define('SESS_ORIGINAL_URL_VAR', 'SESS_ORIGINAL_URL'); 
  • trunk/wifidog-auth/wifidog/classes/StakeholderType.php

    r1419 r1435  
    6464    const Server = 'Server'; 
    6565    const Content = 'Content'; 
     66    const NodeGroup = 'NodeGroup'; 
     67     
    6668    /** 
    6769     * Get an instance of the object 
  • trunk/wifidog-auth/wifidog/classes/User.php

    r1428 r1435  
    639639    @return true on success, false on failure 
    640640    */ 
    641     function generateConnectionToken() { 
     641    function generateConnectionToken($mac = null) { 
    642642        if ($this->isUserValid()) { 
    643643            $db = AbstractDb::getObject(); 
     
    648648                $node_ip = $db->escapeString($_SERVER['REMOTE_ADDR']); 
    649649            } 
     650             
    650651            if ($session && $node_ip && $session->get(SESS_NODE_ID_VAR)) { 
    651652                //echo "$session && $node_ip && {$session->get(SESS_NODE_ID_VAR)}"; 
    652653                $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)); 
    654655                if($abuseControlFault) { 
    655656                    throw new Exception ($abuseControlFault); 
    656657                } 
     658                $mac = (is_null($mac)?'': $db->escapeString($mac)); 
    657659                /* 
    658660                 * Delete all unused tokens for this user, so we don't fill the database 
     
    663665 
    664666                $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')"; 
    666668                $db->execSqlUpdate($sql, false); 
    667669                $retval = $token; 
  • trunk/wifidog-auth/wifidog/include/schema_validate.php

    r1428 r1435  
    4848 * Define current database schema version 
    4949 */ 
    50 define('REQUIRED_SCHEMA_VERSION', 67); 
     50define('REQUIRED_SCHEMA_VERSION', 68); 
    5151/** Used to test a new shecma version before modyfying the database */ 
    5252define('SCHEMA_UPDATE_TEST_MODE', false); 
     
    14561456    } 
    14571457     
     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     
    14581528    /* 
    14591529     $new_schema_version = ; 
  • trunk/wifidog-auth/wifidog/login/index.php

    r1419 r1435  
    8888$gw_port = null; 
    8989$gw_id = null; 
     90$mac = null; 
    9091$logout = null; 
    9192 
     
    118119    exit; 
    119120} 
     121 
     122if (isset($_REQUEST["mac"])) { 
     123    $session->set(SESS_USER_MAC_VAR, $_REQUEST['mac']); 
     124    $mac = $_REQUEST['mac']; 
     125} 
     126 
    120127 
    121128/* 
     
    182189        // Login from a gateway, redirect to the gateway to activate the token 
    183190        $user = $network->getSplashOnlyUser(); 
    184         $token = $user->generateConnectionToken(); 
     191        $token = $user->generateConnectionToken($mac); 
    185192        User::setCurrentUser($user); 
    186193        header("Location: http://" . $gw_address . ":" . $gw_port . "/wifidog/auth?token=" . $token); 
     
    206213        if (!empty($gw_address) && !empty($gw_port)) { 
    207214            // Login from a gateway, redirect to the gateway to activate the token 
    208             $token = $user->generateConnectionToken(); 
     215            $token = $user->generateConnectionToken($mac); 
    209216            if(!$token) 
    210217            { 
     
    245252$smarty->assign('gw_port', $gw_port); 
    246253$smarty->assign('gw_id', $gw_id); 
     254$smarty->assign('mac', $mac); 
    247255 
    248256// Get the login form 
     
    256264if ($gw_id != null) 
    257265$html .= "<input type='hidden' name='gw_id' value='{$gw_id}'>\n"; 
     266if ($mac != null) 
     267$html .= "<input type='hidden' name='mac' value='{$mac}'>\n"; 
    258268$html .= Authenticator::getLoginUI(); 
    259269$html .= "</form>\n"; 
  • trunk/wifidog-auth/wifidog/portal/index.php

    r1421 r1435  
    166166} 
    167167 
     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 
     172foreach($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 
    168197// Get all network content, but exclude user subscribed content if user is known 
    169 $content_rows = array (); 
     198/*$content_rows = array (); 
    170199$network_id = $db->escapeString($network->getId()); 
    171200if ($current_user) { 
    172201    $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"; 
    174205} 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"; 
    176209} 
    177210$db->execSql($sql, $content_rows, false); 
     
    183216        } 
    184217    } 
    185 } 
     218}*/ 
    186219 
    187220// Get all node content and EXCLUDE user subscribed content 
    188 $content_rows = array (); 
     221/*$content_rows = array (); 
    189222$node_id = $db->escapeString($node->getId()); 
    190223if ($current_user) { 
    191224    $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"; 
    193228} 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"; 
    195232} 
    196233$db->execSql($sql, $content_rows, false); 
     
    203240        } 
    204241    } 
    205 } 
     242}*/ 
    206243 
    207244// Get all user content 
  • trunk/wifidog-auth/wifidog/signup.php

    r1421 r1435  
    228228        $gw_address = $session->get(SESS_GW_ADDRESS_VAR); 
    229229        $gw_port = $session->get(SESS_GW_PORT_VAR); 
     230        $mac = $session->get(SESS_USER_MAC_VAR); 
    230231 
    231232        if ($gw_id && $gw_address && $gw_port) { 
    232233            // Make sure the user IDs match 
    233234            if(($created_user->getId() == $authenticated_user->getId())) { 
    234                 $token = $created_user->generateConnectionToken(); 
     235                $token = $created_user->generateConnectionToken($mac); 
    235236 
    236237                $redirURL = "http://" . $gw_address . ":" . $gw_port . "/wifidog/auth?token=" . $token;