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


PHP Network類代碼示例

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


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

示例1: get

 function get()
 {
     $profile_uid = intval($_GET['p']);
     $load = argc() > 1 && argv(1) == 'load' ? 1 : 0;
     header("Content-type: text/html");
     echo "<!DOCTYPE html><html><body>\r\n";
     echo array_key_exists('msie', $_GET) && $_GET['msie'] == 1 ? '<div>' : '<section>';
     $mod = new Network();
     $text = $mod->get($profile_uid, $load);
     $pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
     $replace = "<img\${1} dst=\"\${2}\"";
     //        $text = preg_replace($pattern, $replace, $text);
     /*
     		if(! $load) {
     			$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
         	    $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
             	$text = preg_replace($pattern, $replace, $text);
     	        $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
         	    $text = preg_replace($pattern, $replace, $text);
             	$pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
     	        $text = preg_replace($pattern, $replace, $text);
         	    $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
             	$text = preg_replace($pattern, $replace, $text);
     		}
     */
     echo str_replace("\t", '       ', $text);
     echo array_key_exists('msie', $_GET) && $_GET['msie'] == 1 ? '</div>' : '</section>';
     echo "</body></html>\r\n";
     //	logger('update_network: ' . $text);
     killme();
 }
開發者ID:BlaBlaNet,項目名稱:hubzilla,代碼行數:31,代碼來源:Update_network.php

示例2: render

 function render()
 {
     $network = new Network();
     $this->network_links = $network->get();
     $this->inner_HTML = $this->generate_inner_html();
     $links = parent::render();
     return $links;
 }
開發者ID:CivicCommons,項目名稱:oldBellCaPA,代碼行數:8,代碼來源:SplashPageModule.php

示例3: insertCrawlData

 public function insertCrawlData($data)
 {
     $router_data = Router_old::getRouterInfo($data['router_id']);
     $actual_crawl_cycle = Crawling::getActualCrawlCycle();
     $last_endet_crawl_cycle = Crawling::getLastEndedCrawlCycle();
     /**Insert Router Interfaces*/
     foreach ($data['interface_data'] as $sendet_interface) {
         //Update RRD Graph DB
         $interface_last_endet_crawl = Interfaces::getInterfaceCrawlByCrawlCycleAndRouterIdAndInterfaceName($last_endet_crawl_cycle['id'], $data['router_id'], $sendet_interface['name']);
         $traffic_rx_bps = round(($sendet_interface['traffic_rx'] - $interface_last_endet_crawl['traffic_rx']) / $GLOBALS['crawl_cycle'] / 60);
         $traffic_rx_bps = $traffic_rx_bps < 0 ? 0 : $traffic_rx_bps;
         $traffic_tx_bps = round(($sendet_interface['traffic_tx'] - $interface_last_endet_crawl['traffic_tx']) / $GLOBALS['crawl_cycle'] / 60);
         $traffic_tx_bps = $traffic_tx_bps < 0 ? 0 : $traffic_tx_bps;
         //Set default indizies to prevent from warnings
         $sendet_interface['wlan_frequency'] = isset($sendet_interface['wlan_frequency']) ? preg_replace("/([A-Za-z])/", "", $sendet_interface['wlan_frequency']) : "";
         $sendet_interface['wlan_mode'] = isset($sendet_interface['wlan_mode']) ? $sendet_interface['wlan_mode'] : "";
         $sendet_interface['wlan_essid'] = isset($sendet_interface['wlan_essid']) ? $sendet_interface['wlan_essid'] : "";
         $sendet_interface['wlan_bssid'] = isset($sendet_interface['wlan_bssid']) ? $sendet_interface['wlan_bssid'] : "";
         $sendet_interface['wlan_tx_power'] = isset($sendet_interface['wlan_tx_power']) ? $sendet_interface['wlan_tx_power'] : 0;
         //check if interface already exists
         $networkinterface_test = new Networkinterface(false, (int) $data['router_id'], $sendet_interface['name']);
         //if interface not exist, create new
         if (!$networkinterface_test->fetch()) {
             $networkinterface_new = new Networkinterface(false, (int) $data['router_id'], $sendet_interface['name']);
             $networkinterface_id = $networkinterface_new->store();
         } else {
             $networkinterface_id = $networkinterface_test->getNetworkinterfaceId();
         }
         //save crawl data for interface
         $networkinterface_status = new NetworkinterfaceStatus(false, (int) $actual_crawl_cycle['id'], (int) $networkinterface_id, (int) $data['router_id'], $sendet_interface['name'], $sendet_interface['mac_addr'], (int) $sendet_interface['mtu'], (int) $sendet_interface['traffic_rx'], (int) $traffic_rx_bps, (int) $sendet_interface['traffic_tx'], (int) $traffic_tx_bps, $sendet_interface['wlan_mode'], $sendet_interface['wlan_frequency'], $sendet_interface['wlan_essid'], $sendet_interface['wlan_bssid'], (int) $sendet_interface['wlan_tx_power'], false);
         $networkinterface_status->store();
         //Update RRDDatabase
         $rrd_path_traffic_rx = ROOT_DIR . "/rrdtool/databases/router_{$data['router_id']}_interface_{$sendet_interface['name']}_traffic_rx.rrd";
         if (!file_exists($rrd_path_traffic_rx)) {
             exec("rrdtool create {$rrd_path_traffic_rx} --step 600 --start " . time() . " DS:traffic_rx:GAUGE:700:U:U DS:traffic_tx:GAUGE:900:U:U RRA:AVERAGE:0:1:144 RRA:AVERAGE:0:6:168 RRA:AVERAGE:0:18:240");
         }
         exec("rrdtool update {$rrd_path_traffic_rx} " . time() . ":" . round($traffic_rx_bps / 1000, 2) . ":" . round($traffic_tx_bps / 1000, 2));
         //add unknown ipv6 link local addresses to netmon
         //prepare data
         $ipv6_link_local_addr = explode("/", $sendet_interface['ipv6_link_local_addr']);
         $ipv6_link_local_netmask = isset($ipv6_link_local_addr[1]) ? (int) $ipv6_link_local_addr[1] : 64;
         $ipv6_link_local_addr = Ip::ipv6Expand($ipv6_link_local_addr[0]);
         //first try to determine network of given address
         $ipv6_link_local_network = Ip::ipv6NetworkFromAddr($ipv6_link_local_addr, (int) $ipv6_link_local_netmask);
         $network = new Network(false, false, $ipv6_link_local_network, (int) $ipv6_link_local_netmask, 6);
         if ($network->fetch()) {
             //if network found, then try to add ip address
             $ip = new Ip(false, (int) $networkinterface_id, $network->getNetworkId(), $ipv6_link_local_addr);
             $ip->store();
         }
     }
     RrdTool::updateRouterClientCountHistory($data['router_id'], $data['client_count']);
 }
開發者ID:wAmpIre,項目名稱:netmon,代碼行數:53,代碼來源:crawl.class.php

示例4: postNetwork

 public function postNetwork()
 {
     $posted = Input::all();
     $Network = new Network();
     $Network->category_id = $posted['category_id'];
     $Network->country_id = $posted['country_id'];
     $Network->network_name = $posted['network_name'];
     $Network->delivery_time = $posted['delivery_time'];
     $Network->price = $posted['price'];
     $Network->save();
     return Redirect::back()->with('success', 'Network has been successfully added');
 }
開發者ID:bernardowiredu,項目名稱:unlocking-site,代碼行數:12,代碼來源:NetworkController.php

示例5: render

 function render()
 {
     $network = new Network();
     $extra = unserialize(PA::$network_info->extra);
     $this->network_data = '';
     if (!empty($extra['network_feature'])) {
         $network->network_id = $extra['network_feature'];
         $this->network_data = $network->get();
     }
     $this->inner_HTML = $this->generate_inner_html();
     $content = parent::render();
     return $content;
 }
開發者ID:Cyberspace-Networks,項目名稱:PeopleAggregator,代碼行數:13,代碼來源:FeaturedNetworkModule.php

示例6: __construct

 public function __construct($user_id = false, $ipv = false, $offset = false, $limit = false, $sort_by = false, $order = false)
 {
     $result = array();
     if ($offset !== false) {
         $this->setOffset((int) $offset);
     }
     if ($limit !== false) {
         $this->setLimit((int) $limit);
     }
     if ($sort_by !== false) {
         $this->setSortBy($sort_by);
     }
     if ($order !== false) {
         $this->SetOrder($order);
     }
     // initialize $total_count with the total number of objects in the list (over all pages)
     try {
         $stmt = DB::getInstance()->prepare("SELECT COUNT(*) as total_count\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM networks\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t(user_id = :user_id OR :user_id=0) AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t(ipv = :ipv OR :ipv=0)");
         $stmt->bindParam(':user_id', $user_id, PDO::PARAM_INT);
         $stmt->bindParam(':ipv', $ipv, PDO::PARAM_INT);
         $stmt->execute();
         $total_count = $stmt->fetch(PDO::FETCH_ASSOC);
     } catch (PDOException $e) {
         echo $e->getMessage();
         echo $e->getTraceAsString();
     }
     $this->setTotalCount((int) $total_count['total_count']);
     //if limit -1 then get all ressource records
     if ($this->getLimit() == -1) {
         $this->setLimit($this->getTotalCount());
     }
     try {
         $stmt = DB::getInstance()->prepare("SELECT id as network_id\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM networks\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t(user_id = :user_id OR :user_id=0) AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t(ipv = :ipv OR :ipv=0)\n\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase :sort_by\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twhen 'create_date' then networks.create_date\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\telse NULL\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\t\t\t" . $this->getOrder() . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT :offset, :limit");
         $stmt->bindParam(':user_id', $user_id, PDO::PARAM_INT);
         $stmt->bindParam(':ipv', $ipv, PDO::PARAM_INT);
         $stmt->bindParam(':offset', $this->getOffset(), PDO::PARAM_INT);
         $stmt->bindParam(':limit', $this->getLimit(), PDO::PARAM_INT);
         $stmt->bindParam(':sort_by', $this->getSortBy(), PDO::PARAM_STR);
         $stmt->execute();
         $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
     } catch (PDOException $e) {
         echo $e->getMessage();
         echo $e->getTraceAsString();
     }
     foreach ($result as $network) {
         $network = new Network((int) $network['network_id']);
         $network->fetch();
         $this->networklist[] = $network;
     }
 }
開發者ID:wAmpIre,項目名稱:netmon,代碼行數:50,代碼來源:Networklist.class.php

示例7: networks

 public function networks()
 {
     $networks = Network::where('user_id', '=', Auth::user()->id)->get();
     $page_data = array('network_count' => count($networks), 'networks' => $networks);
     $this->layout->title = 'Networks';
     $this->layout->content = View::make('admin.networks', $page_data);
 }
開發者ID:anchetaWern,項目名稱:ahead,代碼行數:7,代碼來源:AdminController.php

示例8: handlePOST

 public function handlePOST($request_data)
 {
     global $mothership_info;
     if (!empty($request_data['request'])) {
         //code for requesting
         $this->error = FALSE;
         $this->success = FALSE;
         try {
             $request_sent = Network::join(PA::$network_info->network_id, PA::$login_uid);
             if (!empty($request_sent)) {
                 $this->success = TRUE;
             }
         } catch (PAException $e) {
             $join_error = $e->message;
             $this->error = TRUE;
         }
         if (!empty($this->error)) {
             $this->error_msg = sprintf(__('Your request to join this network could not be sent due to following reason: %s. You can go back to the home network by clicking Return to home network'), $join_error);
         } else {
             $this->success_msg = __('Your request to join this network has been successfully sent to the moderator of this network. The Moderator will check this request and approve or deny the request. You can go back to mother network by clicking the button Return to home network');
         }
         $this->mode = 'msg_display';
     }
     if (!empty($request_data['back'])) {
         //redirect to mother network
         global $mothership_info;
         $this->message = __('Return to home network successfully.');
         $this->redirect2 = NULL;
         $his->queryString = NULL;
         $this->isError = FALSE;
         $this->setWebPageMessage();
     }
 }
開發者ID:Cyberspace-Networks,項目名稱:PeopleAggregator,代碼行數:33,代碼來源:RequestModule.php

示例9: get_links

 function get_links()
 {
     // Loading the Searching data
     if ($this->sort_by == 'alphabetic') {
         $this->sort_by = 'login_name';
         $sorting_direction = 'ASC';
     } else {
         $this->sort_by = 'created';
         $sorting_direction = 'DESC';
     }
     global $network_info;
     $users = array();
     if ($this->search_data) {
         // load users on the basis of the search parameters.
         $users_count = User::user_search($this->search_data, $this->viewer_uid, $network_info->network_id);
         $this->Paging["count"] = $users_count['total_users'];
         $users = User::user_search($this->search_data, $this->viewer_uid, $network_info->network_id, FALSE, $this->Paging["show"], $this->Paging["page"], 'U.' . $this->sort_by, $sorting_direction);
     } else {
         $this->Paging["count"] = Network::get_network_members($network_info->network_id, array('cnt' => TRUE));
         $params = array('page' => $this->Paging["page"], 'show' => $this->Paging["show"], 'sort_by' => $this->sort_by, 'direction' => $sorting_direction);
         $users = Network::get_network_members($network_info->network_id, $params);
     }
     // echo "<pre>" . print_r($users,1) . "</pre>";
     $this->users_data = $users['users_data'];
 }
開發者ID:CivicCommons,項目名稱:oldBellCaPA,代碼行數:25,代碼來源:PeopleModule.php

示例10: ephimeral_port

 /**
  * Find an open port in a given range, trying several times.
  * Return FALSE if no open port is found after a timeout (1 second by default)
  *
  * @param  string  $host
  * @param  integer $range_start
  * @param  integer $range_end
  * @param  integer $timeout
  * @return integer|boolean
  */
 public static function ephimeral_port($host, $range_start = 1000, $range_end = 5000, $timeout = 1000)
 {
     return Attempt::make(function () use($host, $range_start, $range_end) {
         $port = rand($range_start, $range_end);
         return Network::is_port_open($host, $port) ? $port : FALSE;
     }, $timeout);
 }
開發者ID:openbuildings,項目名稱:spiderling,代碼行數:17,代碼來源:Network.php

示例11: get_links

 private function get_links()
 {
     //get total count
     $param = array('network_id' => PA::$network_info->network_id, 'cnt' => TRUE, 'neglect_owner' => TRUE);
     //search by login name, including full names also
     if (!empty($this->keyword)) {
         $param['search_keyword'] = $this->keyword;
         $param['also_search_fullname'] = true;
     }
     $param['sort_by'] = $this->sort_by;
     $param['direction'] = $this->direction;
     $param['show_waiting_users'] = true;
     $this->Paging["count"] = Network::get_members($param);
     //now we dont need $param['cnt']
     unset($param['cnt']);
     $param['show'] = $this->Paging['show'];
     $param['page'] = $this->Paging['page'];
     //get actual list
     $users = Network::get_members($param);
     $links = $users['users_data'];
     $objects = array('network' => true, 'groups' => array(), 'forums' => array());
     //echo serialize($objects);
     //    echo '<pre>'.print_r($links,1).'</pre>';
     return $links;
 }
開發者ID:Cyberspace-Networks,項目名稱:PeopleAggregator,代碼行數:25,代碼來源:NetworkResultUserModule.php

示例12: getBoardsInfo

 private function getBoardsInfo()
 {
     $boards_info = array();
     $this->nid = isset($this->shared_data['network_id']) ? $this->shared_data['network_id'] : PA::$network_info->network_id;
     $boards = PaForumBoard::listPaForumBoard("network_id = {$this->nid} AND is_active = 1", 'type', 'ASC', 10);
     if (count($boards) > 0) {
         for ($i = 0; $i < count($boards); $i++) {
             $title = $boards[$i]->get_title();
             $type = $boards[$i]->get_type();
             $boards_info[$i]['title'] = strlen($title) <= self::max_title_length ? $title : substr($title, 0, self::max_title_length + 3) . '...';
             $boards_info[$i]['type'] = $type;
             $net_id = $boards[$i]->get_network_id();
             if (Network::is_mother_network($net_id)) {
                 $address = 'www';
             } else {
                 $network = Network::get_by_id((int) $net_id);
                 $address = $network->address;
             }
             $url = "http://{$address}." . PA::$domain_suffix . PA_ROUTE_FORUMS . "/network_id=" . $net_id;
             switch ($type) {
                 case PaForumBoard::network_board:
                     break;
                 case PaForumBoard::group_board:
                     $url .= "&gid=" . $boards[$i]->get_owner_id();
                     break;
                 case PaForumBoard::personal_board:
                     $url .= "&user_id=" . $boards[$i]->get_owner_id();
                     break;
             }
             $boards_info[$i]['url'] = $url;
         }
     }
     return $boards_info;
 }
開發者ID:Cyberspace-Networks,項目名稱:PeopleAggregator,代碼行數:34,代碼來源:ForumsListModule.php

示例13: getNetwork

 public function getNetwork()
 {
     if (!$this->_network instanceof Network_Interface) {
         $this->_network = Network::create($this);
     }
     return $this->_network;
 }
開發者ID:vyrus,項目名稱:ip-conntrack-max-fixer,代碼行數:7,代碼來源:Context.php

示例14: auto_email_notification

function auto_email_notification($activity_type, $params)
{
    global $network_info;
    global $to, $mail_type, $mail_sub_msg_array, $from, $no_id, $network_owner, $subject, $message, $owner;
    if (!$network_info) {
        return;
    }
    //setting common variables
    //mail to
    if ($network_info->type == MOTHER_NETWORK_TYPE) {
        $network_owner_id = SUPER_USER_ID;
    } else {
        $network_owner_id = Network::get_network_owner($network_info->network_id);
    }
    $network_owner = User::map_ids_to_logins($network_owner_id);
    $owner = new User();
    foreach ($network_owner as $key => $value) {
        $owner->load((int) $key);
    }
    $to = $owner->email;
    $owner_name = $owner->login_name;
    //mail from
    $from = (int) $_SESSION['user']['id'];
    $array_of_data = array('to' => $to, 'from' => $from, 'owner_name' => $owner_name, 'params' => $params);
    call_user_func_array($activity_type, array($array_of_data));
}
開發者ID:CivicCommons,項目名稱:oldBellCaPA,代碼行數:26,代碼來源:auto_email_notify.php

示例15: get_user_links

 function get_user_links()
 {
     $extra = unserialize(PA::$network_info->extra);
     if (Network::is_mother_network(PA::$network_info->network_id)) {
         $uid = SUPER_USER_ID;
     } else {
         $uid = Network::get_network_owner(PA::$network_info->network_id);
     }
     $condition = array('user_id' => $uid, 'is_active' => 1);
     $limit = 5;
     // 5 lists to be display on home page
     $Links = new NetworkLinks();
     $category_list = $Links->load_category($condition, $limit);
     if (!empty($category_list)) {
         for ($counter = 0; $counter < count($category_list); $counter++) {
             $links_data_array[$counter]['category_id'] = $category_list[$counter]->category_id;
             $links_data_array[$counter]['category_name'] = $category_list[$counter]->category_name;
             $Links->user_id = $uid;
             $condition = array('category_id' => $category_list[$counter]->category_id, 'is_active' => 1);
             $limit = 5;
             // 5 links to be display on home page
             $links_array = $Links->load_link($condition, $limit);
             $links_data_array[$counter]['links'] = $links_array;
         }
         return $links_data_array;
     }
 }
開發者ID:CivicCommons,項目名稱:oldBellCaPA,代碼行數:27,代碼來源:NetworkDefaultLinksModule.php


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