示例#1
0
 /**
  * Constructor
  *
  * @return void
  *
  * @access public
  */
 private function __construct()
 {
     //$db = AbstractDb :: getObject();
     // Init Smarty
     $this->smarty = SmartyWifidog::getObject();
     // Init the menu array
     $this->_menuArray = array('childrens' => array());
 }
示例#2
0
// |                                                                   |
// +-------------------------------------------------------------------+
/**
 * @package    WiFiDogAuthServer
 * @author     Francois Proulx <*****@*****.**>
 * @copyright  2005-2006 Francois Proulx, Technologies Coeus inc.
 * @version    Subversion $Id: hotspots.php 1337 2008-03-20 18:07:28Z benoitg $
 * @link       http://www.wifidog.org/
 */
/**
 * Load required files
 */
require_once '../../include/common.php';
require_once 'classes/MainUI.php';
require_once 'classes/Content/PatternLanguage/PatternLanguage.php';
$smarty = SmartyWifidog::getObject();
$session = Session::getObject();
// This trick is done to allow displaying of Pattern Language right away if there is only one available.
if (!empty($_REQUEST['content_id'])) {
    $content_id = $_REQUEST['content_id'];
    $pattern_language = PatternLanguage::getObject($content_id);
} else {
    $content_id = "";
    $pattern_languages = PatternLanguage::getAllContent();
    if (count($pattern_languages) >= 1) {
        $pattern_language = $pattern_languages[0];
    } else {
        exit;
    }
}
// The Pattern Language toolbar
示例#3
0
 /**
  * Returns the first available string in the user's language, faling that in the 
  * same major language (first part of the locale), failing that the first available 
  * string
  *
  * @return UTF-8 string 
  */
 public function getString()
 {
     $smarty = SmartyWifidog::getObject();
     $name = 'string_' . $this->getId();
     smarty_resource_string_add_string($name, parent::getString());
     //echo $smarty->fetch("string:$name");
     return $smarty->fetch("string:{$name}");
 }
示例#4
0
 /**
  * Retreives the user interface of this object.
  *
  * Anything that overrides this method should call the parent method with
  * it's output at the END of processing.
  * @return string The HTML fragment for this interface
  */
 public function getUserUI()
 {
     // Init values
     $current_node = Node::getCurrentNode();
     $smarty = SmartyWifidog::getObject();
     // Set details about onlineusers
     if ($current_node) {
         // online users
         $online_users = $current_node->getOnlineUsers();
         foreach ($online_users as $online_user) {
             $online_user_array[] = $online_user->getListUI();
         }
         $num_online_users = count($online_users);
         if ($num_online_users > 0) {
             $smarty->assign('onlineUsers', $online_user_array);
         } else {
             $smarty->assign('onlineUsers', array());
         }
         // recent users
         $recent_users = $current_node->getRecentUsers();
         foreach ($recent_users as $recent_user) {
             $recent_user_array[] = $recent_user->getListUI();
         }
         $num_recent_users = count($recent_users);
         if ($num_recent_users > 0) {
             $smarty->assign('recentUsers', $recent_user_array);
         } else {
             $smarty->assign('recentUsers', array());
         }
         // active users
         $active_users = $current_node->getActiveUsers();
         foreach ($active_users as $active_user) {
             $active_user_array[] = $active_user->getListUI();
         }
         $num_active_users = count($active_users);
         if ($num_active_users > 0) {
             $smarty->assign('activeUsers', $active_user_array);
         } else {
             $smarty->assign('activeUsers', array());
         }
         // Compile HTML code
         $html = $smarty->fetch("templates/classes/UIUserList_getUserUI.tpl");
     } else {
         $html = _("The online user list must be viewed at a specific node");
     }
     $this->setUserUIMainDisplayContent($html);
     return Content::getUserUI();
 }
示例#5
0
 /**
  * Constructor
  *
  * @return void
  *
  * @access public
  */
 private function __construct()
 {
     $db = AbstractDb::getObject();
     // Init Smarty
     $this->smarty = SmartyWifidog::getObject();
     // Set default title
     if (Server::getServer()->getUseGlobalUserAccounts()) {
         $this->title = _("authentication server");
     } else {
         $this->title = Network::getCurrentNetwork()->getName() . ' ' . _("authentication server");
     }
     // Init the content array
     $current_content_sql = "SELECT display_area FROM content_available_display_areas\n";
     $rows = array();
     $db->execSql($current_content_sql, $rows, false);
     foreach ($rows as $row) {
         $this->_contentDisplayArray[$row['display_area']] = '';
     }
 }
 /**
  * Retreives the user interface of this object.
  *
  * Anything that overrides this method should call the parent method with
  * it's output at the END of processing.
  * @return string The HTML fragment for this interface
  */
 public function getUserUI()
 {
     // Init values
     $current_node = Node::getCurrentNode();
     $smarty = SmartyWifidog::getObject();
     $html = null;
     $user = User::getCurrentUser();
     if ($user) {
         if ($current_node) {
             $abuseControlReport = User::getAbuseControlConnectionHistory($user, null, $current_node);
             if ($abuseControlReport) {
                 //pretty_print_r($abuseControlReport);
                 $db = AbstractDb::getObject();
                 $html .= sprintf(_("During the last %s period, you transfered %s / %s and were connected %s / %s at this node.  Throughout the network, you transfered %s / %s and were connected %s / %s"), $abuseControlReport['connection_limit_window'] ? $db->GetIntervalStrFromDurationArray($db->GetDurationArrayFromIntervalStr($abuseControlReport['connection_limit_window'])) : _("Unknown"), self::formatSize($abuseControlReport['node_total_bytes']), $abuseControlReport['connection_limit_node_max_total_bytes'] ? self::formatSize($abuseControlReport['connection_limit_node_max_total_bytes']) : _("Unlimited"), $abuseControlReport['node_duration'] ? $db->GetIntervalStrFromDurationArray($db->GetDurationArrayFromIntervalStr($abuseControlReport['node_duration'])) : _("None"), $abuseControlReport['connection_limit_node_max_usage_duration'] ? $abuseControlReport['connection_limit_node_max_usage_duration'] : _("Unlimited"), self::formatSize($abuseControlReport['network_total_bytes']), $abuseControlReport['connection_limit_network_max_total_bytes'] ? self::formatSize($abuseControlReport['connection_limit_network_max_total_bytes']) : _("Unlimited"), $abuseControlReport['network_duration'] ? $db->GetIntervalStrFromDurationArray($db->GetDurationArrayFromIntervalStr($abuseControlReport['network_duration'])) : _("None"), $abuseControlReport['connection_limit_network_max_usage_duration'] ? $abuseControlReport['connection_limit_network_max_usage_duration'] : _("Unlimited"));
             } else {
                 $html .= _("Abuse control is currently disabled");
             }
         } else {
             $html .= _("Unable to retrieve node specific restrictions (you are not at a node)");
         }
         $this->setUserUIMainDisplayContent($html);
         return Content::getUserUI();
     }
 }
示例#7
0
 /**
  * Constructor
  *
  * @return void
  */
 public function __construct(&$network)
 {
     $db = AbstractDb::getObject();
     $smarty = SmartyWifidog::getObject();
     // Init Smarty
     $this->_smarty =& $smarty;
     // Init network
     $this->_network = $network;
     // Init user
     $this->_currentUser = User::getCurrentUser();
     // Init MainUI class
     $this->_mainUI = MainUI::getObject();
     $network_where_sql = $network === null ? "" : "network_id = '" . $db->escapeString($this->_network->getId()) . "' AND ";
     // Query the database, sorting by node name
     $db->execSql("SELECT *, (CURRENT_TIMESTAMP-last_heartbeat_timestamp) AS since_last_heartbeat, EXTRACT(epoch FROM creation_date) as creation_date_epoch, CASE WHEN ((CURRENT_TIMESTAMP-last_heartbeat_timestamp) < interval '5 minutes') THEN true ELSE false END AS is_up FROM nodes WHERE {$network_where_sql} (node_deployment_status = 'DEPLOYED' OR node_deployment_status = 'NON_WIFIDOG_NODE') ORDER BY lower(name)", $this->_nodes, false);
 }