Changeset 1092

Show
Ignore:
Timestamp:
09/07/06 04:38:25 (4 years ago)
Author:
benoitg
Message:
  • Fix #63
  • Fix problem with my Splash only user fix (I used match on the

user_id instead of the username).

  • Prevent the Splash only user from logging out, wrecking havock

in the tokens.

  • Do not allow SplashOnlyUser? to set his preferences.
  • Assigning a reusable content to a contentgroup element would

make it non-reusable.
Usability and UI fixes:

  • Allow other users to log in when they are at a splash only

node.

  • Make isSimpleContent class available for Simple content types.

Make it borderless and backgroundless in the default theme_pack.

  • Simplify HTML output for simple content.
  • Fix IE layout bug in node admin
  • Content linked to nodes and networks now edits in a new

window.

  • Remove "Add new node" menu item for consistency.
Location:
trunk/wifidog-auth
Files:
13 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/CHANGELOG

    r1091 r1092  
    112006-09-06 Benoit Grégoire  <bock@step.polymtl.ca> 
    2  
     2        * Fix #63 
     3        * Fix problem with my Splash only user fix (I used match on the user_id instead of the username). 
     4        * Prevent the Splash only user from logging out, wrecking havock in the tokens. 
     5        * Do not allow SplashOnlyUser to set his preferences. 
     6        * Assigning a reusable content to a contentgroup element would make it non-reusable. 
     7Usability and UI fixes: 
     8        * Allow other users to log in when they are at a splash only node. 
     9        * Make isSimpleContent class available for Simple content types.  Make it borderless and backgroundless in the default theme_pack. 
     10        * Simplify HTML output for simple content. 
     11        * Fix IE layout bug in node admin 
     12        * Content linked to nodes and networks now edits in a new window. 
     13        * Remove "Add new node" menu item for consistency. 
     14         
     152006-09-06 Benoit Grégoire  <bock@step.polymtl.ca> 
     16        * Remove most inclusions of MainUI in classes.  
     17        That completely broke authentication (circular dependencies).  
     18        Fixes 245. 
     19    Unfixes 242. Exceptions should not be caught in the context 
     20    they are thrown in. Else there no point in throwing exception in the 
     21    first place.  
    322        * HyperLink.php:  Fix bug where a link with identical text as it's link would see the text replaced by the clickthrough-tracked equivalent. 
    423 
  • trunk/wifidog-auth/wifidog/admin/generic_object_admin.php

    r1090 r1092  
    236236    $object->processAdminUI(); 
    237237 
    238     // Renew information about the object 
    239     $object = call_user_func(array($class, 'getObject'), $_REQUEST['object_id']); 
    240  
    241238    // Now try to delete the content 
    242239    if ($object->delete($errmsg) == true) { 
  • trunk/wifidog-auth/wifidog/classes/Content.php

    r1091 r1092  
    559559                $html .= "<td>\n"; 
    560560                $name = "{$user_prefix}_" . $content->GetId() . "_edit"; 
    561                 $html .= "<input type='button' class='submit' name='$name' value='" . _("Edit") . "' onClick='window.location.href = \"" . GENERIC_OBJECT_ADMIN_ABS_HREF . "?object_class=Content&action=edit&object_id=" . $content->GetId() . "\";'>\n"; 
     561                $html .= "<input type='button' class='submit' name='$name' value='" . _("Edit") . "' onClick='window.open(\"" . GENERIC_OBJECT_ADMIN_ABS_HREF . "?object_class=Content&action=edit&object_id=" . $content->GetId() . "\");'>\n"; 
    562562                $name = "{$user_prefix}_" . $content->GetId() . "_erase"; 
    563563                $html .= "<input type='submit' class='submit' name='$name' value='" . _("Remove") . "'>"; 
     
    734734            } 
    735735 
    736             $html .= _("Add existing content") . ": "; 
     736            $html .= _("Add reusable content from library") . ": "; 
    737737        } 
    738738 
     
    10251025    public function getUserUI($subclass_user_interface = null) { 
    10261026        $html = ''; 
    1027         $html .= "<div class='user_ui_main_outer " . get_class($this) . "'>\n"; 
     1027        $this->isSimpleContent() ? $isSimpleContentClass = 'isSimpleContent' : $isSimpleContentClass = null; 
     1028        $html .= "<div class='user_ui_main_outer " . get_class($this) . " $isSimpleContentClass'>\n"; 
    10281029        $html .= "<div class='user_ui_main_inner'>\n"; 
    10291030 
     
    10391040        } 
    10401041 
    1041         $html .= "<table><tr>\n"; 
     1042if($this->isSimpleContent()) 
     1043{ 
     1044    $html .= "\n$subclass_user_interface\n"; 
     1045} 
     1046else{ 
     1047$html .= "<table><tr>\n"; 
    10421048        $html .= "<td>\n$subclass_user_interface</td>\n"; 
    1043  
    10441049        $html .= "<td>\n"; 
     1050} 
    10451051        $authors = $this->getAuthors(); 
    10461052        if (count($authors) > 0) { 
     
    10771083            } 
    10781084        } 
    1079  
     1085if(!$this->isSimpleContent()) 
     1086{ 
    10801087        $html .= "</td>\n"; 
    10811088        $html .= "</tr></table>\n"; 
    1082  
     1089} 
    10831090        $html .= "</div>\n"; 
    10841091        $html .= "</div>\n"; 
     
    12701277                /* is_persistent */ 
    12711278                $html .= "<li class='admin_element_item_container admin_section_edit_persistant'>\n"; 
    1272                 $html .= "<div class='admin_element_label'>" . _("Is persistent (reusable and read-only)?") . ": </div>\n"; 
     1279                $html .= "<div class='admin_element_label'>" . _("Is part of reusable content library (protected from deletion)?") . ": </div>\n"; 
    12731280                $html .= "<div class='admin_element_data'>\n"; 
    12741281                $name = "content_" . $this->id . "_is_persistent"; 
  • trunk/wifidog-auth/wifidog/classes/Content/ContentGroup/ContentGroupElement.php

    r1091 r1092  
    454454                                $displayed_content_id = $displayed_content->GetId(); 
    455455                                $db->execSqlUpdate("UPDATE content_group_element SET displayed_content_id = '$displayed_content_id' WHERE content_group_element_id = '$this->id'", FALSE); 
    456                                 $displayed_content->setIsPersistent(false); 
    457456                        } 
    458457                } else { 
  • trunk/wifidog-auth/wifidog/classes/Content/Langstring/Langstring.php

    r1090 r1092  
    494494        $html = ''; 
    495495 
    496         $html .= "<div class='user_ui_container ".get_class($this)."'>\n"; 
    497496        $html .= "<div class='langstring'>\n"; 
    498497        $html .= $this->getString(); 
    499498        $html .= $subclass_user_interface; 
    500         $html .= "</div>\n"; 
    501499        $html .= "</div>\n"; 
    502500        /* Handle hyperlink clicktrough logging */ 
  • trunk/wifidog-auth/wifidog/classes/Content/RssAggregator/RssAggregator.php

    r1090 r1092  
    6464class RssAggregator extends Content { 
    6565    /** 
    66  
     66     
    6767     */ 
    6868    private $content_rss_aggregator_row; 
    6969 
    7070    /** 
    71  
     71     
    7272     */ 
    7373    private $content_rss_aggregator_feeds_rows; 
    7474 
    7575    /** 
    76  
     76     
    7777     */ 
    7878    private $press_review; 
     
    114114        if ($content_rss_aggregator_rows != null) { 
    115115            $this->content_rss_aggregator_feeds_rows = $content_rss_aggregator_rows; 
    116         } 
    117         else { 
     116        } else { 
    118117            $this->content_rss_aggregator_feeds_rows = array (); 
    119118        } 
     
    139138                } 
    140139            } 
    141         } 
    142         else { 
     140        } else { 
    143141            $html = _("RSS support is disabled"); 
    144142        } 
     
    182180 
    183181            $retval = false; 
    184         } 
    185         else { 
     182        } else { 
    186183            /* 
    187184             * Successfull, but nothing modified 
     
    239236 
    240237            $retval = true; 
    241         } 
    242         else { 
     238        } else { 
    243239            /* 
    244240             * Successfull, but nothing modified 
     
    305301 
    306302            $retval = false; 
    307         } 
    308         else { 
     303        } else { 
    309304            /* 
    310305             * Successfull, but nothing modified 
     
    405400        $html .= "<div class='admin_element_label'>\n"; 
    406401        $html .= _("How much bonus feeds that do not publish as often get over feed that publish more often. 
    407                             The default is 0.75, with a typical range between 0 and 1. 
    408                             At 0, you have a classic RSS aggregator, meaning the n most recent entries picked from all feeds 
    409                             will be displayed. 1 is usually as high as you'll want to go:  Assuming that all 
    410                             an homogenous internal distribution (ex:  one feed publishes exactly one entry a day, the 
    411                             second once every two days, and the third once every three days), and you ask for 15 entries, 
    412                             there will be 5 of each.  While that may not sound usefull, it still is, as the feed's distribution is 
    413                             usually not homogenous."); 
     402                                            The default is 0.75, with a typical range between 0 and 1. 
     403                                            At 0, you have a classic RSS aggregator, meaning the n most recent entries picked from all feeds 
     404                                            will be displayed. 1 is usually as high as you'll want to go:  Assuming that all 
     405                                            an homogenous internal distribution (ex:  one feed publishes exactly one entry a day, the 
     406                                            second once every two days, and the third once every three days), and you ask for 15 entries, 
     407                                            there will be 5 of each.  While that may not sound usefull, it still is, as the feed's distribution is 
     408                                            usually not homogenous."); 
    414409        $html .= ": </div>\n"; 
    415410        $html .= "<div class='admin_element_data'>\n"; 
     
    428423        $html .= "<div class='admin_element_label'>\n"; 
    429424        $html .= _("Set the oldest entries (in seconds) you are willing to see.  Any entries older than this will not 
    430                             be considered at all for display, even if it means that the configured number of items to be displayed isn't reached. 
    431                             It's only usefull if all your feed publish very rarely, and you don't want very old entries to show up."); 
     425                                            be considered at all for display, even if it means that the configured number of items to be displayed isn't reached. 
     426                                            It's only usefull if all your feed publish very rarely, and you don't want very old entries to show up."); 
    432427        $html .= ": </div>\n"; 
    433428        $html .= "<div class='admin_element_data'>\n"; 
     
    473468 
    474469        $sql = "SELECT count, content_rss_aggregator_feeds.url, title FROM content_rss_aggregator_feeds 
    475                         JOIN (SELECT url, count(content_rss_aggregator_feeds.url) as count 
    476                         FROM content_rss_aggregator_feeds 
    477                         WHERE content_rss_aggregator_feeds.url NOT IN (SELECT url FROM content_rss_aggregator_feeds WHERE content_id='{$this->id}') 
    478                         GROUP BY content_rss_aggregator_feeds.content_id, content_rss_aggregator_feeds.url) 
    479                         AS available_feeds 
    480                         ON (available_feeds.url=content_rss_aggregator_feeds.url) 
    481                         ORDER by count DESC"; 
     470                                        JOIN (SELECT url, count(content_rss_aggregator_feeds.url) as count 
     471                                        FROM content_rss_aggregator_feeds 
     472                                        WHERE content_rss_aggregator_feeds.url NOT IN (SELECT url FROM content_rss_aggregator_feeds WHERE content_id='{$this->id}') 
     473                                        GROUP BY content_rss_aggregator_feeds.content_id, content_rss_aggregator_feeds.url) 
     474                                        AS available_feeds 
     475                                        ON (available_feeds.url=content_rss_aggregator_feeds.url) 
     476                                        ORDER by count DESC"; 
    482477 
    483478        $db->execSql($sql, $feed_urls, false); 
    484  
    485         foreach ($feed_urls as $feed_row) { 
    486             $tab[$i][0] = $feed_row['url']; 
    487             empty ($feed_row['title']) ? $title = $feed_row['url'] : $title = $feed_row['title']; 
    488             $tab[$i][1] = sprintf(_("%s, used %d times"), $title, $feed_row['count']); 
    489             $i++; 
    490         } 
    491  
     479        if ($feed_urls) { 
     480            foreach ($feed_urls as $feed_row) { 
     481                $tab[$i][0] = $feed_row['url']; 
     482                empty ($feed_row['title']) ? $title = $feed_row['url'] : $title = $feed_row['title']; 
     483                $tab[$i][1] = sprintf(_("%s, used %d times"), $title, $feed_row['count']); 
     484                $i++; 
     485            } 
     486        } 
    492487        $name = "rss_aggregator_{$this->id}_feed_add"; 
    493488        $html .= "<input type='text' size='60' value='' name='$name' id='$name'>\n"; 
     
    563558     * 
    564559     * @return string HTML code for the administration interface 
    565  
     560     
    566561     */ 
    567562    private function getFeedAdminUI($feed_row) { 
     
    602597        if ($calculated_pub_interval == true) { 
    603598            $html .= sprintf(_("The feed publishes an item every %.2f day(s)"), $calculated_pub_interval / (60 * 60 * 24)); 
    604         } 
    605         else { 
     599        } else { 
    606600            $html .= "<div class='admin_element_label'><span class='warningmsg'>" . _("WARNING:  This feed does not include the publication dates. 
    607                                                                                                  The system needs to be able to compute approximate publication 
    608                                                                                                  date for each entry, so the entry can be weighted against the 
    609                                                                                                  others. In order for the aggregator to do a good job, you need 
    610                                                                                                  to estimate fublication frequency of the items, in days. 
    611                                                                                                  If unset, defaults to one day.") . ": </span></div>\n"; 
     601                                                                                                                             The system needs to be able to compute approximate publication 
     602                                                                                                                             date for each entry, so the entry can be weighted against the 
     603                                                                                                                             others. In order for the aggregator to do a good job, you need 
     604                                                                                                                             to estimate fublication frequency of the items, in days. 
     605                                                                                                                             If unset, defaults to one day.") . ": </span></div>\n"; 
    612606            $html .= "<div class='admin_element_data'>\n"; 
    613607            $name = "rss_aggregator_" . $this->id . "_feed_" . md5($feed_row['url']) . "_default_publication_interval"; 
     
    615609            if (!empty ($feed_row['default_publication_interval'])) { 
    616610                $value = $feed_row['default_publication_interval'] / (60 * 60 * 24); 
    617             } 
    618             else { 
     611            } else { 
    619612                $value = ''; 
    620613            } 
     
    631624        $html .= "<li class='admin_element_item_container'>\n"; 
    632625        $html .= "<div class='admin_element_label'>" . _("The bias to be given to the source by the selection algorithm. 
    633                                                                 Bias must be > 0 , typical values would be between 0.75 and 1.5 
    634                                                                 and default is 1 (no bias).  A bias of 2 will cause the items 
    635                                                                 to \"look\" twice as recent to the algorithm. A bias of 0.5 to 
    636                                                                 look twice as old. Be carefull, a bias of 2 will statistically 
    637                                                                 cause the feed to have MORE than twice as many items displayed.") . ": </div>\n"; 
     626                                                                                    Bias must be > 0 , typical values would be between 0.75 and 1.5 
     627                                                                                    and default is 1 (no bias).  A bias of 2 will cause the items 
     628                                                                                    to \"look\" twice as recent to the algorithm. A bias of 0.5 to 
     629                                                                                    look twice as old. Be carefull, a bias of 2 will statistically 
     630                                                                                    cause the feed to have MORE than twice as many items displayed.") . ": </div>\n"; 
    638631        $html .= "<div class='admin_element_data'>\n"; 
    639632 
     
    656649     * 
    657650     * @return void 
    658  
     651     
    659652     */ 
    660653    private function processFeedAdminUI($feed_row) { 
     
    680673        elseif (!is_numeric($bias) || $bias <= 0) { 
    681674            echo _("The bias must be a positive real number"); 
    682         } 
    683         else { 
     675        } else { 
    684676            /* 
    685677             * Successfull, but nothing modified 
     
    709701            elseif (!is_numeric($bias) || $bias <= 0) { 
    710702                echo _("The default publication must must be a positive integer or empty"); 
    711             } 
    712             else { 
     703            } else { 
    713704                /* 
    714705                 * Successfull, but nothing modified 
     
    732723        elseif (empty ($url)) { 
    733724            echo _("The URL cannot be empty!"); 
    734         } 
    735         else { 
     725        } else { 
    736726            /* 
    737727             * Successfull, but nothing modified 
     
    754744            try { 
    755745                $html = $this->press_review->get_rss_html($this->content_rss_aggregator_row['number_of_display_items']); 
    756             } 
    757             catch (Exception $e) { 
     746            } catch (Exception $e) { 
    758747                $html = sprintf(_("Could not get RSS feed: %s"), $feed_row['url']); 
    759748            } 
    760         /* Handle hyperlink clicktrough logging */ 
    761         $html = $this->replaceHyperLinks($html); 
    762  
    763         } 
    764         else { 
     749            /* Handle hyperlink clicktrough logging */ 
     750            $html = $this->replaceHyperLinks($html); 
     751 
     752        } else { 
    765753            $html = _("RSS support is disabled"); 
    766754        } 
     
    780768     * 
    781769     * @return void 
    782  
     770     
    783771     */ 
    784772    private function refresh() { 
  • trunk/wifidog-auth/wifidog/classes/Node.php

    r1091 r1092  
    997997                // custom_portal_redirect_url 
    998998                if ($network->getCustomPortalRedirectAllowed()) { 
    999                 $_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)"); 
     999                $_title = _("URL to show instead of the portal"); 
    10001000                $_data = InterfaceElements::generateInputText("node_" . $hashed_node_id . "_custom_portal_redirect_url", $this->getCustomPortalRedirectUrl(), "node_custom_portal_redirect_url_input"); 
    1001                 $_html_node_config[] = InterfaceElements::generateAdminSectionContainer("node_custom_portal_redirect_url", $_title, $_data); 
     1001                $_data .= _("If this is not empty, the portal will be disabled and this URL will be shown instead"); 
     1002                 $_html_node_config[] = InterfaceElements::generateAdminSectionContainer("node_custom_portal_redirect_url", $_title, $_data); 
    10021003                } 
    10031004 
  • trunk/wifidog-auth/wifidog/classes/User.php

    r1090 r1092  
    11<?php 
     2 
    23 
    34/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ 
     
    4546 * Load required classes 
    4647 */ 
    47 require_once('classes/Network.php'); 
    48 require_once('classes/Mail.php'); 
    49 require_once('classes/InterfaceElements.php'); 
     48require_once ('classes/Network.php'); 
     49require_once ('classes/Mail.php'); 
     50require_once ('classes/InterfaceElements.php'); 
    5051 
    5152/** 
     
    5657 * @copyright  2005-2006 Benoit Grégoire, Technologies Coeus inc. 
    5758 */ 
    58 class User implements GenericObject 
    59 { 
     59class User implements GenericObject { 
    6060    private $mRow; 
    6161    private $id; 
     
    6565     * @return a User object, or null if there was an error 
    6666     */ 
    67     public static function getObject($id) 
    68     { 
     67    public static function getObject($id) { 
    6968        $object = null; 
    7069        $object = new self($id); 
     
    7271    } 
    7372 
    74     static function createNewObject() 
    75     { 
     73    static function createNewObject() { 
    7674        echo "<h1>Use User::createUser() instead</h1>"; 
    7775    } 
     
    7977    * @return html markup 
    8078    */ 
    81     public static function getCreateNewObjectUI() 
    82     { 
     79    public static function getCreateNewObjectUI() { 
    8380        return null; 
    8481    } 
     
    9087     * @return the node object or null if no new node was created. 
    9188     */ 
    92     static function processCreateNewObjectUI() 
    93     { 
     89    static function processCreateNewObjectUI() { 
    9490        return self :: createNewObject(); 
    9591    } 
     
    9894     * 
    9995     * @return mixed A User object, or null if there was an error 
    100  
    101      */ 
    102     public static function getCurrentUser() 
    103     { 
    104         require_once('classes/Session.php'); 
     96     
     97     */ 
     98    public static function getCurrentUser() { 
     99        require_once ('classes/Session.php'); 
    105100        $session = new Session(); 
    106101        $user = null; 
    107         try 
    108         { 
     102        try { 
    109103            $user = self :: getObject($session->get(SESS_USER_ID_VAR)); 
    110104            //$user = new User($session->get(SESS_USER_ID_VAR)); 
    111         } 
    112         catch (Exception $e) 
    113         { 
     105        } catch (Exception $e) { 
    114106            /**If any problem occurs, the user should be considered logged out*/ 
    115107            $session->set(SESS_USER_ID_VAR, null); 
     
    126118     * 
    127119     * @return bool True if everything went well setting the session 
    128  
    129      */ 
    130     public static function setCurrentUser(User $user) 
    131     { 
    132         try 
    133         { 
     120     
     121     */ 
     122    public static function setCurrentUser(User $user) { 
     123        try { 
    134124            $session = new Session(); 
    135125            $session->set(SESS_USER_ID_VAR, $user->getId()); 
    136126            $session->set(SESS_PASSWORD_HASH_VAR, $user->getPasswordHash()); 
    137127            return true; 
    138         } 
    139         catch (Exception $e) 
    140         { 
     128        } catch (Exception $e) { 
    141129            return false; 
    142130        } 
     
    147135     * 
    148136     * @return string Hostname of server 
    149  
    150      */ 
    151     public static function getCurrentServer() 
    152     { 
     137     
     138     */ 
     139    public static function getCurrentServer() { 
    153140        return $_SERVER['SERVER_NAME']; 
    154141    } 
     
    159146     * @return a User object, or null if there was an error 
    160147     */ 
    161     public static function getUserByUsernameAndOrigin($username, Network $account_origin) 
    162     { 
     148    public static function getUserByUsernameAndOrigin($username, Network $account_origin) { 
    163149        global $db; 
    164150        $object = null; 
     
    178164     * @return a User object, or null if there was an error 
    179165     */ 
    180     public static function getUserByEmailAndOrigin($email, Network $account_origin) 
    181     { 
     166    public static function getUserByEmailAndOrigin($email, Network $account_origin) { 
    182167        global $db; 
    183168        $object = null; 
     
    195180     * @return The 32 character hash. 
    196181     */ 
    197     public static function passwordHash($password) 
    198     { 
     182    public static function passwordHash($password) { 
    199183        /** 
    200184         * utf8_decode is used for backward compatibility with old passwords 
     
    209193     * @return the newly created User object, or null if there was an error 
    210194     */ 
    211     static function createUser($id, $username, Network $account_origin, $email, $password) 
    212     { 
     195    static function createUser($id, $username, Network $account_origin, $email, $password) { 
    213196        global $db; 
    214197 
     
    229212    } 
    230213 
    231 /*    public static function purgeUnvalidatedUsers($days_since_creation) 
    232     { 
    233         global $db; 
    234         $days_since_creation = $db->escapeString($days_since_creation); 
    235  
    236         //$db->execSqlUpdate("INSERT INTO users (user_id,username, account_origin,email,pass,account_status,validation_token,reg_date) VALUES ('$id_str','$username_str','$account_origin_str','$email_str','$password_hash','$status','$token',NOW())"); 
    237     }*/ 
     214    /*    public static function purgeUnvalidatedUsers($days_since_creation) 
     215        { 
     216            global $db; 
     217            $days_since_creation = $db->escapeString($days_since_creation); 
     218     
     219            //$db->execSqlUpdate("INSERT INTO users (user_id,username, account_origin,email,pass,account_status,validation_token,reg_date) VALUES ('$id_str','$username_str','$account_origin_str','$email_str','$password_hash','$status','$token',NOW())"); 
     220        }*/ 
    238221 
    239222    /** @param $object_id The id of the user */ 
    240     function __construct($object_id) 
    241     { 
     223    function __construct($object_id) { 
    242224        global $db; 
    243225        $this->mDb = & $db; 
     
    245227        $sql = "SELECT * FROM users WHERE user_id='{$object_id_str}'"; 
    246228        $db->execSqlUniqueRes($sql, $row, false); 
    247         if ($row == null) 
    248         { 
     229        if ($row == null) { 
    249230            throw new Exception(sprintf(_("User id: %s could not be found in the database"), $object_id_str)); 
    250231        } 
     
    253234    } //End class 
    254235 
    255     function getId() 
    256     { 
     236    function getId() { 
    257237        return $this->id; 
    258238    } 
     
    261241     * @return Network object (never returns null) 
    262242     */ 
    263     public function getNetwork() 
    264     { 
     243    public function getNetwork() { 
    265244        return Network :: getObject($this->mRow['account_origin']); 
    266245    } 
    267246 
    268247    /** Get a user display suitable for a user list.  Will include link to the user profile. */ 
    269     function getListUI() 
    270     { 
     248    function getListUI() { 
    271249        /*    $roles = array (); 
    272  
    273     if ($current_node->isOwner($online_user)) { 
     250         
     251        if ($current_node->isOwner($online_user)) { 
    274252        $roles[] = _("owner"); 
    275     } 
    276  
    277     if ($current_node->isTechnicalOfficer($online_user)) { 
     253        } 
     254         
     255        if ($current_node->isTechnicalOfficer($online_user)) { 
    278256        $roles[] = _("technical officer"); 
    279     } 
    280  
    281     if ($roles) { 
     257        } 
     258         
     259        if ($roles) { 
    282260        $rolenames = join($roles, ","); 
    283     }*/ 
     261        }*/ 
    284262        $html = ''; 
    285         if($this->isSplashOnlyUser()) 
    286         { 
    287                 $html .= _("Guest"); 
     263        if ($this->isSplashOnlyUser()) { 
     264            $html .= _("Guest"); 
    288265        } 
    289266        $html .= $this->getUserName(); 
     
    291268    } 
    292269 
    293     function getUsername() 
    294     { 
     270    function getUsername() { 
    295271        return $this->mRow['username']; 
    296272    } 
    297      
    298      /** Set the user's username 
    299      * @param $value The new value 
    300      * @return true on success, false on failure 
    301      * @throws exception if the user tries to set a duplicate username 
    302      */ 
     273 
     274    /** Set the user's username 
     275    * @param $value The new value 
     276    * @return true on success, false on failure 
     277    * @throws exception if the user tries to set a duplicate username 
     278    */ 
    303279    function setUsername($value) { 
    304280        $retval = true; 
     
    306282            global $db; 
    307283            $value = $db->escapeString($value); 
    308             $retval = @$db->execSqlUpdate("UPDATE users SET username = '{$value}' WHERE user_id='{$this->id}'", false); 
    309             if(!$retval) 
    310             { 
    311                 throw new exception (sprintf(_("Sorry, the username %s is not available"), $value)); 
     284            $retval = @ $db->execSqlUpdate("UPDATE users SET username = '{$value}' WHERE user_id='{$this->id}'", false); 
     285            if (!$retval) { 
     286                throw new exception(sprintf(_("Sorry, the username %s is not available"), $value)); 
    312287            } 
    313288            $this->refresh(); 
     
    316291    } 
    317292 
    318     public function getEmail() 
    319     { 
     293    public function getEmail() { 
    320294        return $this->mRow['email']; 
    321295    } 
    322296 
    323     public function setEmail($email) 
    324     { 
    325       $email_str = $this->mDb->escapeString($email); 
    326       if (!($update = $this->mDb->execSqlUpdate("UPDATE users SET email='{$email_str}' WHERE user_id='{$this->id}'"))) 
    327         { 
    328           throw new Exception(_("Could not update email address.")); 
    329         } 
    330       $this->mRow['email'] = $email; // unescaped 
    331     } 
    332  
    333     function setIsInvisible($value) 
    334     { 
    335       $retval = true; 
    336       if ($value != $this->isAdvertised()) 
    337         { 
    338           global $db; 
    339           $value ? $value = 'TRUE' : $value = 'FALSE'; 
    340           $retval = $db->execSqlUpdate("UPDATE users SET is_invisible = {$value} WHERE user_id = '{$this->getId()}'", false); 
    341           $this->refresh(); 
    342         } 
    343       return $retval; 
    344     } 
    345  
    346     public function isInvisible() 
    347     { 
    348       return (($this->mRow['is_invisible'] == 't') ? true : false); 
     297    public function setEmail($email) { 
     298        $email_str = $this->mDb->escapeString($email); 
     299        if (!($update = $this->mDb->execSqlUpdate("UPDATE users SET email='{$email_str}' WHERE user_id='{$this->id}'"))) { 
     300            throw new Exception(_("Could not update email address.")); 
     301        } 
     302        $this->mRow['email'] = $email; // unescaped 
     303    } 
     304 
     305    function setIsInvisible($value) { 
     306        $retval = true; 
     307        if ($value != $this->isAdvertised()) { 
     308            global $db; 
     309            $value ? $value = 'TRUE' : $value = 'FALSE'; 
     310            $retval = $db->execSqlUpdate("UPDATE users SET is_invisible = {$value} WHERE user_id = '{$this->getId()}'", false); 
     311            $this->refresh(); 
     312        } 
     313        return $retval; 
     314    } 
     315 
     316    public function isInvisible() { 
     317        return (($this->mRow['is_invisible'] == 't') ? true : false); 
    349318    } 
    350319 
    351320    /**What locale (language) does the user prefer? */ 
    352     public function getPreferedLocale() 
    353     { 
    354       global $session; 
    355       $locale = $this->mRow['prefered_locale']; 
    356       if (empty($locale) && !empty($session)) 
    357         $locale = $session->get(SESS_LANGUAGE_VAR); 
    358       if (empty($locale)) 
    359         $locale = DEFAULT_LANG; 
    360       return $locale; 
    361     } 
    362  
    363     public function setPreferedLocale($locale) 
    364     { 
    365       $locale_str = $this->mDb->escapeString($locale); 
    366       if (!($update = $this->mDb->execSqlUpdate("UPDATE users SET prefered_locale='{$locale_str}' WHERE user_id='{$this->id}'"))) 
    367         { 
    368           throw new Exception(_("Could not update username locale.")); 
    369         } 
    370       $this->mRow['prefered_locale'] = $locale; 
     321    public function getPreferedLocale() { 
     322        global $session; 
     323        $locale = $this->mRow['prefered_locale']; 
     324        if (empty ($locale) && !empty ($session)) 
     325            $locale = $session->get(SESS_LANGUAGE_VAR); 
     326        if (empty ($locale)) 
     327            $locale = DEFAULT_LANG; 
     328        return $locale; 
     329    } 
     330 
     331    public function setPreferedLocale($locale) { 
     332        $locale_str = $this->mDb->escapeString($locale); 
     333        if (!($update = $this->mDb->execSqlUpdate("UPDATE users SET prefered_locale='{$locale_str}' WHERE user_id='{$this->id}'"))) { 
     334            throw new Exception(_("Could not update username locale.")); 
     335        } 
     336        $this->mRow['prefered_locale'] = $locale; 
    371337    } 
    372338 
    373339    /** get the hashed password stored in the database */ 
    374     public function getPasswordHash() 
    375     { 
     340    public function getPasswordHash() { 
    376341        return $this->mRow['pass']; 
    377342    } 
     
    380345     * @return Possible values are listed in common.php 
    381346    */ 
    382     function getAccountStatus() 
    383     { 
     347    function getAccountStatus() { 
    384348        return $this->mRow['account_status']; 
    385349    } 
    386350 
    387     function setAccountStatus($status) 
    388     { 
     351    function setAccountStatus($status) { 
    389352        global $db; 
    390353 
    391354        $status_str = $db->escapeString($status); 
    392         if (!($update = $db->execSqlUpdate("UPDATE users SET account_status='{$status_str}' WHERE user_id='{$this->id}'"))) 
    393         { 
     355        if (!($update = $db->execSqlUpdate("UPDATE users SET account_status='{$status_str}' WHERE user_id='{$this->id}'"))) { 
    394356            throw new Exception(_("Could not update status.")); 
    395357        } 
     
    399361    /** Is the user valid?  Valid means that the account is validated or hasn't exhausted it's validation period. 
    400362     $errmsg: Returs the reason why the account is or isn't valid */ 
    401     function isUserValid(& $errmsg = null) 
    402     { 
     363    function isUserValid(& $errmsg = null) { 
    403364        global $db; 
    404365        $retval = false; 
    405366        $account_status = $this->getAccountStatus(); 
    406         if ($account_status == ACCOUNT_STATUS_ALLOWED) 
    407         { 
     367        if ($account_status == ACCOUNT_STATUS_ALLOWED) { 
    408368            $retval = true; 
    409         } 
    410         else 
    411             if ($account_status == ACCOUNT_STATUS_VALIDATION) 
    412             { 
     369        } else 
     370            if ($account_status == ACCOUNT_STATUS_VALIDATION) { 
    413371                $sql = "SELECT CASE WHEN ((NOW() - reg_date) > networks.validation_grace_time) THEN true ELSE false END AS validation_grace_time_expired, networks.validation_grace_time FROM users  JOIN networks ON (users.account_origin = networks.network_id) WHERE (user_id='{$this->id}')"; 
    414372                $db->execSqlUniqueRes($sql, $user_info, false); 
    415373 
    416                 if ($user_info['validation_grace_time_expired'] == 't') 
    417                 { 
    418                     $errmsg = sprintf(_("Sorry, your %s minutes grace period to retrieve your email and validate your account has now expired. You will have to connect to the internet and validate your account from another location or create a new account. For help, please %s click here %s."), $user_info['validation_grace_time_expired'], '<a href="'.BASE_URL_PATH.'faq.php'.'">', '</a>'); 
     374                if ($user_info['validation_grace_time_expired'] == 't') { 
     375                    $errmsg = sprintf(_("Sorry, your %s minutes grace period to retrieve your email and validate your account has now expired. You will have to connect to the internet and validate your account from another location or create a new account. For help, please %s click here %s."), $user_info['validation_grace_time_expired'], '<a href="' . BASE_URL_PATH . 'faq.php' . '">', '</a>'); 
    419376                    $retval = false; 
    420                 } 
    421                 else 
    422                 { 
     377                } else { 
    423378                    $errmsg = _("Your account is currently valid."); 
    424379                    $retval = true; 
    425380                } 
    426             } 
    427             else 
    428             { 
    429                 $errmsg = _("Sorry, your account is not valid: ").$account_status_to_text[$account_status]; 
     381            } else { 
     382                $errmsg = _("Sorry, your account is not valid: ") . $account_status_to_text[$account_status]; 
    430383                $retval = false; 
    431384            } 
     
    433386    } 
    434387 
    435     public function isSuperAdmin() 
    436     { 
     388    public function isSuperAdmin() { 
    437389        global $db; 
    438390        //$this->session->dump(); 
    439391 
    440392        $db->execSqlUniqueRes("SELECT * FROM users NATURAL JOIN administrators WHERE (users.user_id='$this->id')", $user_info, false); 
    441         if (!empty ($user_info)) 
    442         { 
     393        if (!empty ($user_info)) { 
    443394            return true; 
    444         } 
    445         else 
    446         { 
     395        } else { 
    447396            return false; 
    448397        } 
     
    453402     * Tells if the current user is owner of at least one hotspot. 
    454403     */ 
    455     public function isOwner() 
    456     { 
     404    public function isOwner() { 
    457405        global $db; 
    458406        $db->execSql("SELECT * FROM node_stakeholders WHERE is_owner = true AND user_id='{$this->getId()}'", $row, false); 
     
    463411    } 
    464412 
    465     public function isNobody() 
    466         { 
    467                 global $db; 
    468                 $db->execSqlUniqueRes("SELECT DISTINCT user_id FROM (SELECT user_id FROM network_stakeholders WHERE user_id='{$this->getId()}' UNION SELECT user_id FROM node_stakeholders WHERE user_id='{$this->getId()}' UNION SELECT user_id FROM administrators WHERE user_id='{$this->getId()}') as tmp", $row, false); 
    469                 if ($row == null) 
    470                         return true; 
    471                 return false; 
    472         } 
    473  
    474 /** Is this user the Splash Only User() */ 
    475     public function isSplashOnlyUser() 
    476         { 
    477 if($this->mRow['user_id'] == "SPLASH_ONLY_USER") { 
    478 return true; 
    479 } 
    480 else { 
    481 return false; 
    482 } 
    483         } 
    484          
    485     function getValidationToken() 
    486     { 
     413    public function isNobody() { 
     414        global $db; 
     415        $db->execSqlUniqueRes("SELECT DISTINCT user_id FROM (SELECT user_id FROM network_stakeholders WHERE user_id='{$this->getId()}' UNION SELECT user_id FROM node_stakeholders WHERE user_id='{$this->getId()}' UNION SELECT user_id FROM administrators WHERE user_id='{$this->getId()}') as tmp", $row, false); 
     416        if ($row == null) 
     417            return true; 
     418        return false; 
     419    } 
     420 
     421    /** Is this user the Splash Only User() */ 
     422    public function isSplashOnlyUser() { 
     423        if ($this->mRow['username'] == "SPLASH_ONLY_USER") { 
     424            return true; 
     425        } else { 
     426            return false; 
     427        } 
     428    } 
     429 
     430    function getValidationToken() { 
    487431        return $this->mRow['validation_token']; 
    488432    } 
     
    491435    @return true on success, false on failure 
    492436    */ 
    493     function generateConnectionToken() 
    494     { 
    495         if ($this->isUserValid()) 
    496         { 
     437    function generateConnectionToken() { 
     438        if ($this->isUserValid()) { 
    497439            global $db; 
    498440            global $session; 
    499441 
    500442            $token = self :: generateToken(); 
    501             if ($_SERVER['REMOTE_ADDR']) 
    502             { 
     443            if ($_SERVER['REMOTE_ADDR']) { 
    503444                $node_ip = $db->escapeString($_SERVER['REMOTE_ADDR']); 
    504445            } 
    505446 
    506             if ($session && $node_ip && $session->get(SESS_GW_ID_VAR)) 
    507             { 
     447            if ($session && $node_ip && $session->get(SESS_GW_ID_VAR)) { 
    508448                $node_id = $db->escapeString($session->get(SESS_GW_ID_VAR)); 
    509                 $db->execSqlUpdate("INSERT INTO connections (user_id, token, token_status, timestamp_in, node_id, node_ip, last_updated) VALUES ('".$this->getId()."', '$token', '".TOKEN_UNUSED."', NOW(), '$node_id', '$node_ip', NOW())", false); 
     449                $db->execSqlUpdate("INSERT INTO connections (user_id, token, token_status, timestamp_in, node_id, node_ip, last_updated) VALUES ('" . $this->getId() . "', '$token', '" . TOKEN_UNUSED . "', NOW(), '$node_id', '$node_ip', NOW())", false); 
    510450                $retval = $token; 
    511             } 
    512             else 
     451            } else 
    513452                $retval = false; 
    514         } 
    515         else 
    516         { 
     453        } else { 
    517454            $retval = false; 
    518455        } 
     
    520457    } 
    521458 
    522     function setPassword($password) 
    523     { 
     459    function setPassword($password) { 
    524460        global $db; 
    525461 
    526462        $new_password_hash = User :: passwordHash($password); 
    527         if (!($update = $db->execSqlUpdate("UPDATE users SET pass='$new_password_hash' WHERE user_id='{$this->id}'"))) 
    528         { 
     463        if (!($update = $db->execSqlUpdate("UPDATE users SET pass='$new_password_hash' WHERE user_id='{$this->id}'"))) { 
    529464            throw new Exception(_("Could not change user's password.")); 
    530465        } 
     
    532467    } 
    533468 
    534     function getAccountOrigin() 
    535     { 
     469    function getAccountOrigin() { 
    536470        return $this->mRow['account_origin']; 
    537471    } 
     
    539473    /** Return all the users 
    540474     */ 
    541     static function getAllUsers() 
    542     { 
     475    static function getAllUsers() { 
    543476        global $db; 
    544477 
    545478        $db->execSql("SELECT * FROM users", $objects, false); 
    546         if ($objects == null) 
    547         { 
     479        if ($objects == null) { 
    548480            throw new Exception(_("No users could not be found in the database")); 
    549481        } 
     
    551483    } 
    552484 
    553     function sendLostUsername() 
    554     { 
     485    function sendLostUsername() { 
    555486        $network = $this->getNetwork(); 
    556487        $mail = new Mail(); 
     
    558489        $mail->setSenderEmail($network->getValidationEmailFromAddress()); 
    559490        $mail->setRecipientEmail($this->getEmail()); 
    560         $mail->setMessageSubject($network->getName()._(" lost username request")); 
    561         $mail->setMessageBody(_("Hello,\nYou have requested that the authentication server send you your username:\nUsername: ").$this->getUsername()._("\n\nHave a nice day,\nThe Team")); 
     491        $mail->setMessageSubject($network->getName() . _(" lost username request")); 
     492        $mail->setMessageBody(_("Hello,\nYou have requested that the authentication server send you your username:\nUsername: ") . $this->getUsername() . _("\n\nHave a nice day,\nThe Team")); 
    562493        $mail->send(); 
    563494    } 
    564495 
    565     function sendValidationEmail() 
    566     { 
    567         if ($this->getAccountStatus() != ACCOUNT_STATUS_VALIDATION) 
    568         { 
     496    function sendValidationEmail() { 
     497        if ($this->getAccountStatus() != ACCOUNT_STATUS_VALIDATION) { 
    569498            throw new Exception(_("The user is not in validation period.")); 
    570         } 
    571         else 
    572         { 
    573             if ($this->getValidationToken() == "") 
    574             { 
     499        } else { 
     500            if ($this->getValidationToken() == "") { 
    575501                throw new Exception(_("The validation token is empty.")); 
    576             } 
    577             else 
    578             { 
     502            } else { 
    579503                $network = $this->getNetwork(); 
    580504 
     
    583507                $mail->setSenderEmail($network->getValidationEmailFromAddress()); 
    584508                $mail->setRecipientEmail($this->getEmail()); 
    585                 $mail->setMessageSubject($network->getName()._(" new user validation")); 
    586                 $url = BASE_SSL_PATH . "validate.php?user_id=".$this->getId()."&token=".$this->getValidationToken(); 
    587                 $mail->setMessageBody(_("Hello,\nPlease follow the link below to validate your account.\n").$url._("\n\nThank you,\nThe Team.")); 
     509                $mail->setMessageSubject($network->getName() . _(" new user validation")); 
     510                $url = BASE_SSL_PATH . "validate.php?user_id=" . $this->getId() . "&token=" . $this->getValidationToken(); 
     511                $mail->setMessageBody(_("Hello,\nPlease follow the link below to validate your account.\n") . $url . _("\n\nThank you,\nThe Team.")); 
    588512                $mail->send(); 
    589513            } 
     
    591515    } 
    592516 
    593     function sendLostPasswordEmail() 
    594     { 
     517    function sendLostPasswordEmail() { 
    595518        $network = $this->getNetwork(); 
    596519        $new_password = $this->randomPass(); 
     
    601524        $mail->setSenderEmail($network->getValidationEmailFromAddress()); 
    602525        $mail->setRecipientEmail($this->getEmail()); 
    603         $mail->setMessageSubject($network->getName()._(" new password request")); 
    604         $mail->setMessageBody(_("Hello,\nYou have requested that the authentication server send you a new password:\nUsername: ").$this->getUsername()._("\nPassword: ").$new_password._("\n\nHave a nice day,\nThe Team")); 
     526        $mail->setMessageSubject($network->getName() . _(" new password request")); 
     527        $mail->setMessageBody(_("Hello,\nYou have requested that the authentication server send you a new password:\nUsername: ") . $this->getUsername() . _("\nPassword: ") . $new_password . _("\n\nHave a nice day,\nThe Team")); 
    605528        $mail->send(); 
    606529    } 
    607530 
    608     static function userExists($id) 
    609     { 
     531    static function userExists($id) { 
    610532        global $db; 
    611533        $id_str = $db->escapeString($id); 
     
    615537    } 
    616538 
    617     public static function emailExists($id) 
    618     { 
     539    public static function emailExists($id) { 
    619540        global $db; 
    620541        $id_str = $db->escapeString($id); 
     
    624545    } 
    625546 
    626     public static function randomPass() 
    627     { 
     547    public static function randomPass() { 
    628548        $rand_pass = ''; // makes sure the $pass var is empty. 
    629         for ($j = 0; $j < 3; $j ++) 
    630         { 
    631             $startnend = array ('b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z',); 
    632             $id = array ('a', 'e', 'i', 'o', 'u', 'y',); 
     549        for ($j = 0; $j < 3; $j++) { 
     550            $startnend = array ( 
     551                'b', 
     552                'c', 
     553                'd', 
     554                'f', 
     555                'g', 
     556                'h', 
     557                'j', 
     558                'k', 
     559                'l', 
     560                'm', 
     561                'n', 
     562                'p', 
     563                'q', 
     564                'r', 
     565                's', 
     566                't', 
     567                'v', 
     568                'w', 
     569                'x', 
     570                'y', 
     571                'z', 
     572                 
     573            ); 
     574            $id = array ( 
     575                'a', 
     576                'e', 
     577                'i', 
     578                'o', 
     579                'u', 
     580                'y', 
     581                 
     582            ); 
    633583            $count1 = count($startnend) - 1; 
    634584            $count2 = count($id) - 1; 
    635585 
    636             for ($i = 0; $i < 3; $i ++) 
    637             { 
    638                 if ($i != 1) 
    639                 { 
     586            for ($i = 0; $i < 3; $i++) { 
     587                if ($i != 1) { 
    640588                    $rand_pass .= $startnend[rand(0, $count1)]; 
    641                 } 
    642                 else 
    643                 { 
     589                } else { 
    644590                    $rand_pass .= $id[rand(0, $count2)]; 
    645591                } 
     
    649595    } 
    650596 
    651     public static function generateToken() 
    652     { 
     597    public static function generateToken() { 
    653598        return md5(uniqid(rand(), 1)); 
    654599    } 
     
    663608     * 
    664609     * @return string HTML markup 
    665  
    666      */ 
    667     public static function getSelectUserUI($user_prefix, $add_button_name = null, $add_button_value = null) 
    668     { 
     610     
     611     */ 
     612    public static function getSelectUserUI($user_prefix, $add_button_name = null, $add_button_value = null) { 
    669613        // Define globals 
    670614        global $db; 
    671615 
    672         $_networkSelector = InterfaceElements::generateDiv(Network::getSelectNetworkUI($user_prefix), "admin_section_network_selector", "admin_section_network_selector_" . $user_prefix); 
     616        $_networkSelector = InterfaceElements :: generateDiv(Network :: getSelectNetworkUI($user_prefix), "admin_section_network_selector", "admin_section_network_selector_" . $user_prefix); 
    673617 
    674618        // Check if we need to add an "add" button 
    675619        if ($add_button_name && $add_button_value) { 
    676             $_userSelector = _("Username") . ": " .  InterfaceElements::generateInputText("select_user_" . $user_prefix . "_username", "", "", "input_text", array("onkeypress" => "if ((event.which ? event.which : event.keyCode) == 13) {form.$add_button_name.click() }")); 
    677             $_userSelector .= InterfaceElements::generateInputSubmit($add_button_name, $add_button_value); 
     620            $_userSelector = _("Username") . ": " . InterfaceElements :: generateInputText("select_user_" . $user_prefix . "_username", "", "", "input_text", array ( 
     621                "onkeypress" => "if ((event.which ? event.which : event.keyCode) == 13) {form.$add_button_name.click() }" 
     622            )); 
     623            $_userSelector .= InterfaceElements :: generateInputSubmit($add_button_name, $add_button_value); 
    678624        } else { 
    679             $_userSelector = _("Username") . ": " .  InterfaceElements::generateInputText("select_user_" . $user_prefix . "_username"); 
    680         } 
    681         $_html = InterfaceElements::generateDiv($_networkSelector . $_userSelector, 'user_select_user_ui_container'); 
     625            $_userSelector = _("Username") . ": " . InterfaceElements :: generateInputText("select_user_" . $user_prefix . "_username"); 
     626        } 
     627        $_html = InterfaceElements :: generateDiv($_networkSelector . $_userSelector, 'user_select_user_ui_container'); 
    682628 
    683629        return $_html; 
     
    688634     * @return the User object, or null if the user is invalid or none was selected 
    689635     */ 
    690     static function processSelectUserUI($user_prefix) 
    691     { 
     636    static function processSelectUserUI($user_prefix) { 
    692637        $object = null; 
    693         try 
    694         { 
     638        try { 
    695639            $network = Network :: processSelectNetworkUI($user_prefix); 
    696640            $name = "select_user_{$user_prefix}_username"; 
    697             if (!empty ($_REQUEST[$name])) 
    698             { 
     641            if (!empty ($_REQUEST[$name])) { 
    699642                $username = $_REQUEST[$name]; 
    700643                return self :: getUserByUsernameAndOrigin($username, $network); 
    701             } 
    702             else 
     644            } else 
    703645                return null; 
    704         } 
    705         catch (Exception $e) 
    706         { 
     646        } catch (Exception $e) { 
    707647            return null; 
    708648        } 
    709649    } 
    710650 
    711     public function getAdminUI() 
    712     { 
    713         global $db; 
    714         $currentUser= self::getCurrentUser(); 
     651    public function getAdminUI() { 
     652        global $db; 
     653        $currentUser = self :: getCurrentUser(); 
    715654        $html = ''; 
    716         $html .= "<fieldset class='admin_container ".get_class($this)."'>\n"; 
     655        $html .= "<fieldset class='admin_container " . get_class($this) . "'>\n"; 
    717656        $html .= "<ul class='admin_element_list'>\n"; 
    718 if($this==$currentUser || $this->getNetwork()->hasAdminAccess($currentUser)) 
    719 { 
    720     //username 
    721         $html .= "<li class='admin_element_item_container'>\n"; 
    722         $html .= "<div class='admin_element_label'>"._("Username")." : </div>\n"; 
    723         $html .= "<div class='admin_element_data'>\n"; 
    724         $name = "user_".$this->getId()."_username"; 
    725         $html .= "<input type='text' name='$name' value='".htmlentities($this->getUsername())."' size=30>\n"; 
    726         $html .= _("Be carefull when changing this: it's the username you use to log in!"); 
    727         $html .= "</div>\n"; 
    728         $html .= "</li>\n"; 
    729 } 
    730 /* 
    731         $html .= "<li class='admin_element_item_container'>\n"; 
    732         $html .= "<div class='admin_element_label'>"._("Real name")." : </div>\n"; 
    733         $html .= "<div class='admin_element_data'>\n"; 
    734         $name = "user_".$this->getId()."_real_name"; 
    735         $html .= "<input type='text' name='$name' value='".htmlentities($this->getRealName())."' size=30 readonly>\n"; 
    736         $html .= "</div>\n"; 
    737         $html .= "</li>\n"; 
    738  
    739         $html .= "<li class='admin_element_item_container'>\n"; 
    740         $html .= "<div class='admin_element_label'>"._("Website URL")." : </div>\n"; 
    741         $html .= "<div class='admin_element_data'>\n"; 
    742         $name = "user_".$this->getId()."_website"; 
    743         $html .= "<input type='text' name='$name' value='".htmlentities($this->getWebsiteURL())."' size=30 readonly>\n"; 
    744         $html .= "</div>\n"; 
    745         $html .= "</li>\n"; 
    746 */ 
     657        if (($this == $currentUser && !$this->isSplashOnlyUser() )|| $this->getNetwork()->hasAdminAccess($currentUser)) { 
     658            //username 
     659            $html .= "<li class='admin_element_item_container'>\n"; 
     660            $html .= "<div class='admin_element_label'>" . _("Username") . " : </div>\n"; 
     661            $html .= "<div class='admin_element_data'>\n"; 
     662            $name = "user_" . $this->getId() . "_username"; 
     663            $html .= "<input type='text' name='$name' value='" . htmlentities($this->getUsername()) . "' size=30>\n"; 
     664            $html .= _("Be carefull when changing this: it's the username you use to log in!"); 
     665            $html .= "</div>\n"; 
     666            $html .= "</li>\n"; 
     667        } 
     668        /* 
     669                $html .= "<li class='admin_element_item_container'>\n"; 
     670                $html .= "<div class='admin_element_label'>"._("Real name")." : </div>\n"; 
     671                $html .= "<div class='admin_element_data'>\n"; 
     672                $name = "user_".$this->getId()."_real_name"; 
     673                $html .= "<input type='text' name='$name' value='".htmlentities($this->getRealName())."' size=30 readonly>\n"; 
     674                $html .= "</div>\n"; 
     675                $html .= "</li>\n"; 
     676         
     677                $html .= "<li class='admin_element_item_container'>\n"; 
     678                $html .= "<div class='admin_element_label'>"._("Website URL")." : </div>\n"; 
     679                $html .= "<div class='admin_element_data'>\n"; 
     680                $name = "user_".$this->getId()."_website"; 
     681                $html .= "<input type='text' name='$name' value='".htmlentities($this->getWebsiteURL())."' size=30 readonly>\n"; 
     682                $html .= "</div>\n"; 
     683                $html .= "</li>\n"; 
     684        */ 
    747685        $html .= "</fieldset>\n"; 
    748686        return $html; 
    749687    } 
    750688 
    751     public function processAdminUI() 
    752     { 
    753                 global $db; 
    754         $currentUser= self::getCurrentUser(); 
    755         if($this==$currentUser || $this->getNetwork()->hasAdminAccess($currentUser)) 
    756 { 
    757     //username 
    758         $name = "user_".$this->getId()."_username"; 
    759         $this->setUsername($_REQUEST[$name]); 
    760  } 
    761     } 
    762  
    763     public function delete(& $errmsg) 
    764     { 
    765     } 
    766  
    767     public function getUserUI() 
    768         { 
     689    public function processAdminUI() { 
     690        global $db; 
     691        $currentUser = self :: getCurrentUser(); 
     692        if ($this == $currentUser || $this->getNetwork()->hasAdminAccess($currentUser)) { 
     693            //username 
     694            $name = "user_" . $this->getId() . "_username"; 
     695            $this->setUsername($_REQUEST[$name]); 
     696        } 
     697    } 
     698 
     699    public function delete(& $errmsg) { 
     700    } 
     701 
     702    public function getUserUI() { 
    769703        $html = ""; 
    770704        $html .= $this->getRealName(); 
    771705 
    772706        return $html; 
    773         } 
     707    } 
    774708 
    775709    /** Add content to this user ( subscription ) */ 
    776     public function addContent(Content $content) 
    777     { 
     710    public function addContent(Content $content) { 
    778711        global $db; 
    779712        $content_id = $db->escapeString($content->getId()); 
     
    784717 
    785718    /** Remove content from this node */ 
    786     public function removeContent(Content $content) 
    787     { 
     719    public function removeContent(Content $content) { 
    788720        global $db; 
    789721        $content_id = $db->escapeString($content->getId()); 
     
    795727    /**Get an array of all Content linked to this node 
    796728    * @return an array of Content or an empty arrray */ 
    797     function getAllContent() 
    798     { 
     729    function getAllContent() { 
    799730        global $db; 
    800731        $retval = array (); 
    801732        $sql = "SELECT * FROM user_has_content WHERE user_id='$this->id' ORDER BY subscribe_timestamp"; 
    802733        $db->execSql($sql, $content_rows, false); 
    803         if ($content_rows != null) 
    804         { 
    805             foreach ($content_rows as $content_row) 
    806             { 
     734        if ($content_rows != null) { 
     735            foreach ($content_rows as $content_row) { 
    807736                $retval[] = Content :: getObject($content_row['content_id']); 
    808737            } 
     
    812741 
    813742    /** Reloads the object from the database.  Should normally be called after a set operation */ 
    814     protected function refresh() 
    815     { 
    816       $this->__construct($this->id); 
     743    protected function refresh() { 
     744        $this->__construct($this->id); 
    817745    } 
    818746 
    819747    /** Set Smarty template values.  Standardization routine. */ 
    820         public static function assignSmartyValues($smarty, $user=null) { 
    821                 if (!$user) $user = User::getCurrentUser(); 
    822                 $smarty->assign('username', $user ? $user->getUsername() : ''); 
     748    public static function assignSmartyValues($smarty, $user = null) { 
     749        if (!$user) 
     750            $user = User :: getCurrentUser(); 
     751        $smarty->assign('username', $user ? $user->getListUI() : ''); 
    823752        $smarty->assign('userId', $user ? $user->getId() : ''); 
    824                 /** 
    825                 * Define user security levels for the template 
    826                 * 
    827                 * These values are used in the default template of WiFoDog but could be 
    828                 * used in a customized template to restrict certain links to specific 
    829                 * user access levels. 
    830                 */ 
    831                 $smarty->assign('isValidUser', $user ? true : false); 
    832                 $smarty->assign('isSuperAdmin', $user && $user->isSuperAdmin()); 
    833                 $smarty->assign('isOwner', $user && $user->isOwner()); 
     753        /** 
     754        * Define user security levels for the template 
     755        * 
     756        * These values are used in the default template of WiFoDog but could be 
     757        * used in a customized template to restrict certain links to specific 
     758        * user access levels. 
     759        */ 
     760        $smarty->assign('isValidUser', $user && !$user->isSplashOnlyUser() ? true : false); 
     761        $smarty->assign('isSuperAdmin', $user && $user->isSuperAdmin()); 
     762        $smarty->assign('isOwner', $user && $user->isOwner()); 
    834763 
    835764        if (isset ($_REQUEST['debug_request']) && ($user && $user->isSuperAdmin())) { 
     
    838767            $smarty->assign('debugOutput', print_r($_REQUEST, true)); 
    839768        } 
    840         } 
     769    } 
    841770} 
    842771 
     
    848777 * End: 
    849778 */ 
    850  
  • trunk/wifidog-auth/wifidog/content/index.php

    r1030 r1092  
    5252require_once('include/common_interface.php'); 
    5353require_once('classes/Node.php'); 
    54  
    55 if (CONF_USE_CRON_FOR_DB_CLEANUP == false) 
    56 { 
    57     garbage_collect(); 
    58 } 
    5954 
    6055$node = null; 
     
    142137    foreach ($contents as $content) 
    143138    { 
    144         $html .= "<div class='portal_content'>\n"; 
    145139        $html .= $content->getUserUI(); 
    146         $html .= "</div>"; 
    147140    } 
    148141    $html .= "</div>\n"; 
  • trunk/wifidog-auth/wifidog/include/common.php

    r1079 r1092  
    194194    $tzd = substr(chunk_split($tzd, 3, ':'), 0, 6); 
    195195    $date = date('Y-m-d\TH:i:s', $unix_timestamp).$tzd; 
    196  
    197196    return $date; 
    198197} 
  • trunk/wifidog-auth/wifidog/login/index.php

    r1090 r1092  
    219219 * Once logged out, we display the login page 
    220220 */ 
    221 if ((!empty($logout) && $logout) && ($user = User::getCurrentUser()) != null) { 
     221if ((!empty($logout) && $logout) && ($user = User::getCurrentUser()) != null  && !$user->isSplashOnlyUser()) { 
    222222    $network->getAuthenticator()->logout(); 
    223223} 
  • trunk/wifidog-auth/wifidog/media/base_theme/stylesheet.css

    r1085 r1092  
    493493} 
    494494 
    495 .portal_content { 
    496 } 
    497495.user_ui_main_outer { 
    498496/*      display: inline;*/ 
     
    504502    padding: 0.1em; 
    505503} 
     504 
     505.isSimpleContent{ 
     506    background: none; 
     507        border: none; 
     508        margin: 0em; 
     509    padding: 0.1em; 
     510} 
     511 
    506512.user_ui_title .user_ui_main_outer, 
    507513.user_ui_description .user_ui_main_outer { 
  • trunk/wifidog-auth/wifidog/templates/classes/MainUI_ToolSection.tpl

    r1090 r1092  
    7777                    <ul> 
    7878                        <li><a href="{$base_url_path}admin/generic_object_admin.php?object_class=Node&action=list">{"Nodes"|_}</a></li> 
    79                         <li><a href="{$base_url_path}admin/generic_object_admin.php?object_class=Node&action=new_ui">{"Add new Node"|_}</a></li> 
    8079                    </ul> 
    8180            {/if} 
     
    9493                    <ul> 
    9594                        <li><a href="{$base_url_path}admin/generic_object_admin.php?object_class=Server&action=list">{"Servers"|_}</a></li> 
    96                         <li><a href="{$base_url_path}admin/generic_object_admin.php?object_class=Content&action=list">{"Content library"|_}</a></li> 
     95                        <li><a href="{$base_url_path}admin/generic_object_admin.php?object_class=Content&action=list">{"Reusable content library"|_}</a></li> 
    9796                    </ul> 
    9897            </fieldset>