當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Network::getObject方法代碼示例

本文整理匯總了PHP中Network::getObject方法的典型用法代碼示例。如果您正苦於以下問題:PHP Network::getObject方法的具體用法?PHP Network::getObject怎麽用?PHP Network::getObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Network的用法示例。


在下文中一共展示了Network::getObject方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1:

/**
 * Process recovering username
 */
// Init ALL smarty SWITCH values
$smarty->assign('sectionTOOLCONTENT', false);
$smarty->assign('sectionMAINCONTENT', false);
// Init ALL smarty values
$smarty->assign('message', "");
$smarty->assign('error', "");
$smarty->assign('auth_sources', "");
$smarty->assign('selected_auth_source', "");
$smarty->assign('SelectNetworkUI', "");
$smarty->assign('username', "");
$smarty->assign('email', "");
if (isset($_REQUEST['form_request'])) {
    $account_origin = Network::getObject($_REQUEST['auth_source']);
    try {
        /*
         * Tool content
         */
        // Set section of Smarty template
        $smarty->assign('sectionTOOLCONTENT', true);
        // Compile HTML code
        $html = $smarty->fetch("templates/sites/lost_password.tpl");
        /*
         * Main content
         */
        // Reset ALL smarty SWITCH values
        $smarty->assign('sectionTOOLCONTENT', false);
        $smarty->assign('sectionMAINCONTENT', false);
        // Set section of Smarty template
開發者ID:cnlangzi,項目名稱:wifidog-auth,代碼行數:31,代碼來源:lost_password.php

示例2: WHEN

$info = null;
$token = null;
if (!empty($_REQUEST['token'])) {
    $token = $db->escapeString($_REQUEST['token']);
    $dbRetval = $db->execSqlUniqueRes("SELECT CURRENT_TIMESTAMP, *, CASE WHEN ((CURRENT_TIMESTAMP - reg_date) > networks.validation_grace_time) THEN true ELSE false END AS validation_grace_time_expired FROM connections JOIN tokens USING (token_id) JOIN users ON (users.user_id=connections.user_id) JOIN networks ON (users.account_origin = networks.network_id) WHERE connections.token_id='{$token}'", $info, false);
    if ($dbRetval == false) {
        $auth_message .= "| Error: couldn't retrieve the requested token: {$token} because of a SQL error. ";
        $auth_response = ACCOUNT_STATUS_ERROR;
    }
} else {
    $auth_message .= "| Error: no connection token provided. ";
    $auth_response = ACCOUNT_STATUS_DENIED;
}
if ($info != null) {
    // Retrieve the associated authenticator
    $network = Network::getObject($info['account_origin']);
    $authenticator = $network->getAuthenticator();
    if (!$authenticator) {
        $auth_message .= "| Error: Unable to instantiate authenticator. ";
        $auth_response = ACCOUNT_STATUS_ERROR;
    } else {
        if ($_REQUEST['stage'] == STAGE_LOGIN) {
            if ($info['token_status'] == TOKEN_UNUSED) {
                /* This is for the 15 minutes validation period, the exact same code is also present in when the stage is counters.  If you update this one don't forget to update the other one! */
                if ($info['account_status'] == ACCOUNT_STATUS_VALIDATION && $info['validation_grace_time_expired'] == 't') {
                    $auth_response = ACCOUNT_STATUS_VALIDATION_FAILED;
                    $auth_message .= "| The validation grace period which began at " . $info['reg_date'] . " has now expired. ";
                } else {
                    // Start accounting
                    if ($authenticator->acctStart($info['conn_id'], $auth_message)) {
                        $auth_response = ACCOUNT_STATUS_ALLOWED;
開發者ID:soitun,項目名稱:wifidog-auth,代碼行數:31,代碼來源:index.php

示例3: array

    }
}
/*
 * Tool content
 */
// Set section of Smarty template
$smarty->assign('sectionTOOLCONTENT', true);
$smarty->assign('sectionMAINCONTENT', false);
// Compile HTML code
$htmlToolContent = $smarty->fetch("templates/sites/signup.tpl");
/*
 * Main content
 */
// Use the account_origin along, if it was set (it may be set in case there was an error processing the form).
if (isset($_REQUEST["auth_source"])) {
    $selectedNetwork = Network::getObject($_REQUEST['auth_source']);
} else {
    $selectedNetwork = Network::getDefaultNetwork();
}
if (Server::getServer()->getUseGlobalUserAccounts()) {
    $smarty->assign('SelectNetworkUI', "<input type=\"hidden\" name=\"auth_source\" value='" . $selectedNetwork->getId() . "' />");
} else {
    //Make sure to only list networks whose authenticator allows user self-signup
    $smarty->assign('SelectNetworkUI', Network::getSelectUI('auth_source', array('preSelectedObject' => $selectedNetwork, 'onlyNetwoksAllowingSignup' => true)));
}
// Set section of Smarty template
$smarty->assign('sectionTOOLCONTENT', false);
$smarty->assign('sectionMAINCONTENT', true);
// Compile HTML code
$htmlMainContent = $smarty->fetch("templates/sites/signup.tpl");
/*
開發者ID:soitun,項目名稱:wifidog-auth,代碼行數:31,代碼來源:signup.php

示例4: catch

    // Check if ordering should ignore uppper and lower case
    if ($sort_by_param == "name" || $sort_by_param == "node_id") {
        $sort_by_param_sql = "lower(" . $sort_by_param . ")";
    } else {
        $sort_by_param_sql = $sort_by_param;
    }
} else {
    $sort_by_param_sql = DEFAULT_SORT_BY_PARAM;
}
if (isset($_REQUEST["network_id"])) {
    $network_id = $_REQUEST["network_id"];
    if ($network_id == "") {
        $network = null;
    } else {
        try {
            $network = Network::getObject($network_id);
        } catch (Exception $e) {
            $network = Network::getDefaultNetwork();
        }
    }
} else {
    $network = Network::getDefaultNetwork();
}
$network_id_sql = $network === null ? "" : "AND network_id = '{$network->getId()}'";
$sql = "SELECT node_id, gw_id, name, last_heartbeat_user_agent, (CURRENT_TIMESTAMP-last_heartbeat_timestamp) AS since_last_heartbeat, last_heartbeat_ip, CASE WHEN ((CURRENT_TIMESTAMP-last_heartbeat_timestamp) < interval '5 minutes') THEN true ELSE false END AS online, creation_date, node_deployment_status, last_heartbeat_wifidog_uptime, last_heartbeat_sys_uptime FROM nodes WHERE node_deployment_status != 'PERMANENTLY_CLOSED' {$network_id_sql} ORDER BY {$sort_by_param_sql}";
$nodes_results = null;
$db->execSql($sql, $nodes_results, false);
//Possible to select empty networks, not an error
if ($nodes_results === null) {
    $nodes_results = array();
}
開發者ID:soitun,項目名稱:wifidog-auth,代碼行數:31,代碼來源:node_list.php

示例5: getNetwork

 /** Gets the Network to which the user belongs
  * @return Network object (never returns null)
  */
 public function getNetwork()
 {
     return Network::getObject($this->_row['account_origin']);
 }
開發者ID:soitun,項目名稱:wifidog-auth,代碼行數:7,代碼來源:User.php

示例6: getNetwork

 /** Gets the Network to which the node belongs
  * @return Network object (never returns null)
  */
 public function getNetwork()
 {
     return Network::getObject($this->_row['network_id']);
 }
開發者ID:cnlangzi,項目名稱:wifidog-auth,代碼行數:7,代碼來源:Node.php

示例7: array

 */
// Set section of Smarty template
$smarty->assign('sectionMAINCONTENT', true);
// Set network selector
$preSelectedObject = !empty($_REQUEST['network_map']) ? Network::getObject($_REQUEST['network_map']) : Network::getCurrentNetwork();
//$selectNetworkUI = Network::getSelectUI('network_map', array('preSelectedObject' => $preSelectedObject, 'onChange' => "javascript: document.lang_form.submit();"));
$selectNetworkUI = Network::getSelectUI('network_map', array('preSelectedObject' => $preSelectedObject, 'onChange' => "submit.click();"));
$smarty->assign('selectNetworkUI', $selectNetworkUI . (count(Network::getAllNetworks()) > 1 ? '<input class="submit" type="submit" name="submit" value="' . _("Change network") . '">' : ""));
// Compile HTML code
$html_body = $smarty->fetch("templates/sites/hotspots_map.tpl");
/*
 * Footer JavaScripts
 */
// Get GIS data to set
if (!empty($_REQUEST['network_map'])) {
    $network = Network::getObject($_REQUEST['network_map']);
} else {
    $network = Network::getCurrentNetwork();
}
$gis_data = $network->getGisLocation();
// The onLoad code should only be called once all DIV are created.
$script = "<script type=\"text/javascript\">//<![CDATA[\n";
$script .= "    function toggleOverlay(name)\n";
$script .= "    {\n";
$script .= "        o = document.getElementById('map_postalcode_overlay');\n";
$script .= "        if (o != undefined) {\n";
$script .= "            if (o.style.display == 'block') {\n";
$script .= "                o.style.display = 'none';\n";
$script .= "            } else {\n";
$script .= "                o.style.display = 'block';\n";
$script .= "            }\n";
開發者ID:cnlangzi,項目名稱:wifidog-auth,代碼行數:31,代碼來源:hotspots_map.php

示例8: acctStart

 /**
  * Start accounting traffic for the user
  *
  * @param string $conn_id The connection id for the connection to work on
  *
  * @return void
  */
 public function acctStart($conn_id)
 {
     $db = AbstractDb::getObject();
     $conn_id = $db->escapeString($conn_id);
     $db->execSqlUniqueRes("SELECT CURRENT_TIMESTAMP, *, CASE WHEN ((CURRENT_TIMESTAMP - reg_date) > networks.validation_grace_time) THEN true ELSE false END AS validation_grace_time_expired FROM connections JOIN users ON (users.user_id=connections.user_id) JOIN networks ON (users.account_origin = networks.network_id) WHERE connections.conn_id='{$conn_id}'", $info, false);
     $network = Network::getObject($info['network_id']);
     $splash_user_id = $network->getSplashOnlyUser()->getId();
     $auth_response = $info['account_status'];
     // Login the user
     $mac = $db->escapeString($_REQUEST['mac']);
     $ip = $db->escapeString($_REQUEST['ip']);
     $sql = "BEGIN;\n";
     $sql .= "UPDATE connections SET user_mac='{$mac}',user_ip='{$ip}',last_updated=CURRENT_TIMESTAMP WHERE conn_id='{$conn_id}';";
     $sql .= "UPDATE tokens SET token_status='" . TOKEN_INUSE . "' FROM connections WHERE connections.token_id=tokens.token_id AND conn_id='{$conn_id}';";
     $sql .= "COMMIT;\n";
     $db->execSqlUpdate($sql, false);
     if ($splash_user_id != $info['user_id'] && $network->getMultipleLoginAllowed() === false) {
         /*
          * The user isn't the splash_only user and the network config does
          * not allow multiple logins. Logging in with a new token implies
          * that all other active tokens should expire
          */
         $token = $db->escapeString($_REQUEST['token']);
         $sql = "SELECT * FROM connections JOIN tokens USING (token_id) WHERE user_id = '{$info['user_id']}' AND token_status='" . TOKEN_INUSE . "' AND token_id!='{$token}';";
         $conn_rows = array();
         $db->execSql($sql, $conn_rows, false);
         if (isset($conn_rows)) {
             foreach ($conn_rows as $conn_row) {
                 $this->acctStop($conn_row['conn_id']);
             }
         }
     }
 }
開發者ID:soitun,項目名稱:wifidog-auth,代碼行數:40,代碼來源:Authenticator.php

示例9: processCreateNewObjectUI

 /**
  * Process the new object interface.
  *
  * Will return the new object if the user has the credentials and the form was fully filled.
  * @return the node object or null if no new node was created.
  */
 public static function processCreateNewObjectUI()
 {
     // Init values
     $retval = null;
     $name = "new_node_group_name";
     if (!empty($_REQUEST[$name])) {
         $ng_name = $_REQUEST[$name];
     } else {
         $ng_name = null;
     }
     $name = "new_node_group_network_id";
     if (!empty($_REQUEST[$name])) {
         $network = Network::getObject($_REQUEST[$name]);
     } else {
         $network = Network::processSelectUI('new_node_group');
     }
     if ($network) {
         Security::requirePermission(Permission::P('NETWORK_PERM_ADD_NODEGROUP'), $network);
         $retval = self::createNewObject($ng_name, $network);
     }
     return $retval;
 }
開發者ID:cnlangzi,項目名稱:wifidog-auth,代碼行數:28,代碼來源:NodeGroup.php

示例10:

 /**
  * Get this vhost's default network
  *
  * @return object A Network object, NEVER returns null.
  */
 public function &getDefaultNetwork()
 {
     return Network::getObject($this->__row['default_network']);
 }
開發者ID:cnlangzi,項目名稱:wifidog-auth,代碼行數:9,代碼來源:VirtualHost.php


注:本文中的Network::getObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。