当前位置: 首页>>代码示例>>PHP>>正文


PHP openqrm_server::get_ip_address方法代码示例

本文整理汇总了PHP中openqrm_server::get_ip_address方法的典型用法代码示例。如果您正苦于以下问题:PHP openqrm_server::get_ip_address方法的具体用法?PHP openqrm_server::get_ip_address怎么用?PHP openqrm_server::get_ip_address使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在openqrm_server的用法示例。


在下文中一共展示了openqrm_server::get_ip_address方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: openqrm_dhcpd_appliance

function openqrm_dhcpd_appliance($cmd, $appliance_fields)
{
    global $OPENQRM_SERVER_BASE_DIR;
    global $OPENQRM_EXEC_PORT;
    $openqrm_server = new openqrm_server();
    $OPENQRM_SERVER_IP_ADDRESS = $openqrm_server->get_ip_address();
    $event = new event();
    $appliance_id = $appliance_fields["appliance_id"];
    $appliance_name = $appliance_fields["appliance_name"];
    $resource = new resource();
    $resource->get_instance_by_id($appliance_fields["appliance_resources"]);
    $resource_mac = $resource->mac;
    $resource_ip = $resource->ip;
    $appliance = new appliance();
    $appliance->get_instance_by_id($appliance_id);
    if ($resource->id == "-1" || $resource->id == "") {
        return;
    }
    $event->log("openqrm_dhcpd_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-dhcpd-appliance-hook.php", "Handling {$cmd} event {$appliance_id}/{$appliance_name}/{$resource_ip}/{$resource_mac}", "", "", 0, 0, $resource->id);
    switch ($cmd) {
        case "start":
            $event->log("openqrm_dhcpd_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-dhcpd-appliance-hook.php", "Adding hostname " . $appliance->name . " from resource " . $resource->id . ".", "", "", 0, 0, $resource->id);
            $dhcpd_command = $OPENQRM_SERVER_BASE_DIR . "/openqrm/plugins/dhcpd/bin/openqrm-dhcpd-appliance add_hostname -m " . $resource_mac . " -n " . $appliance->name . " -d " . $resource->id . " --openqrm-cmd-mode background";
            $openqrm_server->send_command($dhcpd_command);
            break;
        case "stop":
            $event->log("openqrm_dhcpd_appliance", $_SERVER['REQUEST_TIME'], 5, "openqrm-dhcpd-appliance-hook.php", "Removing hostname " . $appliance->name . " from resource " . $resource->id . ".", "", "", 0, 0, $resource->id);
            $dhcpd_command = $OPENQRM_SERVER_BASE_DIR . "/openqrm/plugins/dhcpd/bin/openqrm-dhcpd-appliance remove_hostname -m " . $resource_mac . " -n " . $appliance->name . " -d " . $resource->id . " --openqrm-cmd-mode background";
            $openqrm_server->send_command($dhcpd_command);
            break;
    }
}
开发者ID:kelubo,项目名称:OpenQRM,代码行数:32,代码来源:openqrm-dhcpd-appliance-hook.php

示例2: action

 function action()
 {
     $external_portal_name = $this->cloud_config->get_value(3);
     // 3 is the external name;
     if (!strlen($external_portal_name)) {
         $openqrm_server = new openqrm_server();
         $openqrm_server_ip = $openqrm_server->get_ip_address();
         $external_portal_name = "http://" . $openqrm_server_ip . "/cloud-portal";
     }
     $template = $this->response->html->template($this->tpldir . "/cloud-documentation-about.tpl.php");
     $template->add($this->lang['cloud_documentation_title'], 'title');
     $template->add($this->lang['cloud_documentation_intro'], 'cloud_documentation_intro');
     $template->add($this->lang['cloud_documentation_label'], 'cloud_documentation_label');
     $template->add($this->lang['cloud_documentation_setup'], 'cloud_documentation_setup');
     $template->add($this->lang['cloud_documentation_setup_title'], 'cloud_documentation_setup_title');
     $template->add($this->lang['cloud_documentation_setup_steps'], 'cloud_documentation_setup_steps');
     $template->add($this->lang['cloud_documentation_users'], 'cloud_documentation_users');
     $template->add($this->lang['cloud_documentation_create_user'], 'cloud_documentation_create_user');
     $template->add($this->lang['cloud_documentation_ip_management'], 'cloud_documentation_ip_management');
     $template->add($this->lang['cloud_documentation_ip_management_setup'], 'cloud_documentation_ip_management_setup');
     $template->add($this->lang['cloud_documentation_type_title'], 'cloud_documentation_type_title');
     $template->add($this->lang['cloud_documentation_type_content'], 'cloud_documentation_type_content');
     $template->add($this->lang['cloud_documentation_tested_title'], 'cloud_documentation_tested_title');
     $template->add($this->lang['cloud_documentation_tested_content'], 'cloud_documentation_tested_content');
     $template->add($this->lang['cloud_documentation_api'], 'cloud_documentation_api');
     $template->add($this->lang['cloud_documentation_soap'], 'cloud_documentation_soap');
     $template->add($this->lang['cloud_documentation_lockfile'], 'cloud_documentation_lockfile');
     $template->add(sprintf($this->lang['cloud_documentation_lockfile_details'], $this->rootdir . "/web/action/cloud-conf/cloud-monitor.lock"), 'cloud_documentation_lockfile_details');
     $template->add($this->baseurl, 'baseurl');
     $template->add($external_portal_name, 'external_portal_name');
     $template->add($this->response->html->thisfile, "thisfile");
     $template->group_elements(array('param_' => 'form'));
     return $template;
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:34,代码来源:cloud-about.documentation.class.php

示例3: action

 function action()
 {
     $response = $this->update();
     if (isset($response->error)) {
         $_REQUEST[$this->message_param] = $response->error;
     }
     if (isset($response->msg)) {
         $this->response->redirect($this->response->get_url($this->actions_name, 'select', $this->message_param, $response->msg));
     }
     $external_portal_name = $this->cloud_config->get_value_by_key('external_portal_url');
     if (!strlen($external_portal_name)) {
         $openqrm_server = new openqrm_server();
         $openqrm_server_ip = $openqrm_server->get_ip_address();
         $external_portal_name = "http://" . $openqrm_server_ip . "/cloud-portal";
     }
     $template = $response->html->template($this->tpldir . "/cloud-usergroup-update.tpl.php");
     $template->add(sprintf($this->lang['cloud_usergroup_update_title'], $response->name), 'title');
     $template->add($external_portal_name, 'external_portal_name');
     $template->add($response->form->get_elements());
     $template->add($response->html->thisfile, "thisfile");
     $template->group_elements(array('param_' => 'form'));
     return $template;
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:23,代码来源:cloud-usergroup.update.class.php

示例4: openqrm_hybrid_cloud_monitor

require_once $RootDir . "/class/image.class.php";
require_once $RootDir . "/class/image_authentication.class.php";
require_once $RootDir . "/class/resource.class.php";
require_once $RootDir . "/class/virtualization.class.php";
require_once $RootDir . "/class/appliance.class.php";
require_once $RootDir . "/class/storage.class.php";
require_once $RootDir . "/class/deployment.class.php";
require_once $RootDir . "/class/openqrm_server.class.php";
require_once $RootDir . "/class/event.class.php";
# class for the hybrid cloud accounts
require_once $RootDir . "/plugins/hybrid-cloud/class/hybrid-cloud.class.php";
global $OPENQRM_SERVER_BASE_DIR;
global $OPENQRM_EXEC_PORT;
$event = new event();
$openqrm_server = new openqrm_server();
$OPENQRM_SERVER_IP_ADDRESS = $openqrm_server->get_ip_address();
global $OPENQRM_SERVER_IP_ADDRESS;
global $event;
// this function is going to be called by the monitor-hook in the resource-monitor
function openqrm_hybrid_cloud_monitor()
{
    global $event;
    global $OPENQRM_SERVER_BASE_DIR;
    global $OPENQRM_SERVER_IP_ADDRESS;
    global $OPENQRM_EXEC_PORT;
    global $openqrm_server;
    global $BaseDir;
    global $RootDir;
    $now = $_SERVER['REQUEST_TIME'];
    // $event->log("hybrid_cloud_monitor", $_SERVER['REQUEST_TIME'], 2, "hybrid-cloud-monitor-hook", "Hybrid Cloud monitor hook DISABLED for now!!!", "", "", 0, 0, 0);
    // return;
开发者ID:kelubo,项目名称:OpenQRM,代码行数:31,代码来源:openqrm-hybrid-cloud-monitor-hook.php

示例5: update

 function update()
 {
     $response = $this->get_response();
     $form = $response->form;
     $cloud_user_resource_limit = $form->get_request('cloud_user_resource_limit');
     $cloud_user_disk_limit = $form->get_request('cloud_user_disk_limit');
     $cloud_user_memory_limit = $form->get_request('cloud_user_memory_limit');
     $cloud_user_cpu_limit = $form->get_request('cloud_user_cpu_limit');
     $cloud_user_network_limit = $form->get_request('cloud_user_network_limit');
     if (!$form->get_errors() && $response->submit()) {
         $db = $this->cloud_user;
         $data = $form->get_request();
         $data['cu_id'] = $this->response->html->request()->get('cloud_user_id');
         // name already in use ?
         $this->cloud_user->get_instance_by_id($data['cu_id']);
         // email valid ?
         if (!strcmp($data['cu_email'], "@localhost")) {
             if (!$this->cloud_user->checkEmail($data['cu_email'])) {
                 $form->set_error("cu_email", $this->lang['cloud_user_email_invalid']);
             }
         }
         if (!$form->get_errors()) {
             $password = '';
             if (isset($data['cu_password'])) {
                 $password = $data['cu_password'];
                 // password min 6 characters
                 if (strlen($data['cu_password']) < 6) {
                     $form->set_error("cu_password", $this->lang['cloud_user_short_password']);
                 }
             }
             unset($data['cloud_user_resource_limit']);
             unset($data['cloud_user_disk_limit']);
             unset($data['cloud_user_memory_limit']);
             unset($data['cloud_user_cpu_limit']);
             unset($data['cloud_user_network_limit']);
             // add user to htpasswd
             if (strlen($password)) {
                 $cloud_htpasswd = $this->clouddir . "/user/.htpasswd";
                 if (file_exists($cloud_htpasswd)) {
                     $openqrm_server_command = "htpasswd -b " . $this->clouddir . "/user/.htpasswd " . $username . " " . $password;
                 } else {
                     $openqrm_server_command = "htpasswd -c -b " . $this->clouddir . "/user/.htpasswd " . $username . " " . $password;
                 }
                 $output = shell_exec($openqrm_server_command);
                 // send mail to user just in case the password is set
                 $cc_admin_email = $this->cloud_config->get_value(1);
                 // 1 is admin_email
                 // get external name
                 $external_portal_name = $this->cloud_config->get_value(3);
                 // 3 is the external name
                 if (!strlen($external_portal_name)) {
                     $openqrm_server = new openqrm_server();
                     $openqrm_server_ip = $openqrm_server->get_ip_address();
                     $external_portal_name = "http://{$openqrm_server_ip}/cloud-portal";
                 }
                 $email = $data['cu_email'];
                 $forename = $data['cu_forename'];
                 $lastname = $data['cu_lastname'];
                 $this->cloud_mailer->to = $email;
                 $this->cloud_mailer->from = $cc_admin_email;
                 $this->cloud_mailer->subject = "openQRM Cloud: Your account has been updated";
                 $this->cloud_mailer->template = $this->rootdir . "/plugins/cloud/etc/mail/welcome_new_cloud_user.mail.tmpl";
                 $arr = array('@@USER@@' => $username, '@@PASSWORD@@' => $password, '@@EXTERNALPORTALNAME@@' => $external_portal_name, '@@FORENAME@@' => $forename, '@@LASTNAME@@' => $lastname, '@@CLOUDADMIN@@' => $cc_admin_email);
                 $this->cloud_mailer->var_array = $arr;
                 $this->cloud_mailer->send();
             }
             // set user permissions and limits, set to 0 (infinite) by default
             $cloud_user_limits_fields['cl_resource_limit'] = $cloud_user_resource_limit;
             $cloud_user_limits_fields['cl_memory_limit'] = $cloud_user_memory_limit;
             $cloud_user_limits_fields['cl_disk_limit'] = $cloud_user_disk_limit;
             $cloud_user_limits_fields['cl_cpu_limit'] = $cloud_user_cpu_limit;
             $cloud_user_limits_fields['cl_network_limit'] = $cloud_user_network_limit;
             $this->cloud_user_limits->get_instance_by_cu_id($data['cu_id']);
             $this->cloud_user_limits->update($this->cloud_user_limits->id, $cloud_user_limits_fields);
             $dberror = $this->cloud_user->update($data['cu_id'], $data);
             // success msg
             $response->msg = $this->lang['cloud_user_update_successful'];
         }
     } else {
         if ($form->get_errors()) {
             $response->error = implode('<br>', $form->get_errors());
         }
     }
     return $response;
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:85,代码来源:cloud-user.update.class.php

示例6: remove

 function remove($resource_id, $resource_mac)
 {
     global $OPENQRM_EXEC_PORT;
     global $RESOURCE_INFO_TABLE;
     global $RootDir;
     global $event;
     // never remove the openQRM server resource
     if ($resource_id == 0) {
         return;
     }
     // never remove an auto-select resource
     if ($resource_id == -1) {
         return;
     }
     $openqrm_server = new openqrm_server();
     $OPENQRM_SERVER_IP_ADDRESS = $openqrm_server->get_ip_address();
     // remove resource hook
     $plugin = new plugin();
     $enabled_plugins = $plugin->enabled();
     foreach ($enabled_plugins as $index => $plugin_name) {
         $plugin_new_resource_hook = "{$RootDir}/plugins/{$plugin_name}/openqrm-{$plugin_name}-resource-hook.php";
         if (file_exists($plugin_new_resource_hook)) {
             $event->log("remove", $_SERVER['REQUEST_TIME'], 5, "resource.class.php", "Found plugin {$plugin_name} handling remove-resource event.", "", "", 0, 0, $resource_id);
             require_once "{$plugin_new_resource_hook}";
             $resource_fields = array();
             $resource_fields = $this->get_fields($resource_id);
             // run remove hook
             $resource_function = "openqrm_" . "{$plugin_name}" . "_resource";
             $resource_function = str_replace("-", "_", $resource_function);
             $resource_function("remove", $resource_fields);
         }
     }
     $db = openqrm_get_db_connection();
     $rs = $db->Execute("delete from {$RESOURCE_INFO_TABLE} where resource_id={$resource_id} and resource_mac='{$resource_mac}'");
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:35,代码来源:resource.class.php

示例7: insert

 function insert()
 {
     $response = $this->get_response();
     $form = $response->form;
     $cloud_user_resource_limit = $form->get_request('cloud_user_resource_limit');
     $cloud_user_disk_limit = $form->get_request('cloud_user_disk_limit');
     $cloud_user_memory_limit = $form->get_request('cloud_user_memory_limit');
     $cloud_user_cpu_limit = $form->get_request('cloud_user_cpu_limit');
     $cloud_user_network_limit = $form->get_request('cloud_user_network_limit');
     if (!$form->get_errors() && $response->submit()) {
         $db = $this->cloud_user;
         $data = $form->get_request();
         // name already in use ?
         $this->cloud_user->get_instance_by_name($data['cu_name']);
         if ($this->cloud_user->id > 0) {
             $form->set_error("cu_name", $this->lang['cloud_user_name_in_use']);
         }
         // email valid ?
         if (!strcmp($data['cu_email'], "@localhost")) {
             if (!$this->cloud_user->checkEmail($data['cu_email'])) {
                 $form->set_error("cu_email", $this->lang['cloud_user_email_invalid']);
             }
         }
         // password min 6 characters
         if (strlen($data['cu_password']) < 6) {
             $form->set_error("cu_password", $this->lang['cloud_user_short_password']);
         }
         // username min 4 characters
         if (strlen($data['cu_name']) < 4) {
             $strMsg .= "Username must be at least 4 characters long <br>";
             $form->set_error("cu_password", $this->lang['cloud_user_short_username']);
         }
         if (!$form->get_errors()) {
             $data['cu_id'] = (int) str_replace(".", "", str_pad(microtime(true), 15, "0"));
             // enabled by default
             $data['cu_status'] = 1;
             $username = $data['cu_name'];
             $password = $data['cu_password'];
             unset($data['cloud_user_resource_limit']);
             unset($data['cloud_user_disk_limit']);
             unset($data['cloud_user_memory_limit']);
             unset($data['cloud_user_cpu_limit']);
             unset($data['cloud_user_network_limit']);
             // add user to htpasswd
             $cloud_htpasswd = $this->clouddir . "/user/.htpasswd";
             if (file_exists($cloud_htpasswd)) {
                 $openqrm_server_command = "htpasswd -b " . $this->clouddir . "/user/.htpasswd " . $username . " " . $password;
             } else {
                 $openqrm_server_command = "htpasswd -c -b " . $this->clouddir . "/user/.htpasswd " . $username . " " . $password;
             }
             $output = shell_exec($openqrm_server_command);
             // set user permissions and limits, set to 0 (infinite) by default
             $cloud_user_limits_fields['cl_id'] = (int) str_replace(".", "", str_pad(microtime(true), 15, "0"));
             $cloud_user_limits_fields['cl_cu_id'] = $data['cu_id'];
             $cloud_user_limits_fields['cl_resource_limit'] = $cloud_user_resource_limit;
             $cloud_user_limits_fields['cl_memory_limit'] = $cloud_user_memory_limit;
             $cloud_user_limits_fields['cl_disk_limit'] = $cloud_user_disk_limit;
             $cloud_user_limits_fields['cl_cpu_limit'] = $cloud_user_cpu_limit;
             $cloud_user_limits_fields['cl_network_limit'] = $cloud_user_network_limit;
             $this->cloud_user_limits->add($cloud_user_limits_fields);
             // send mail to user
             $cc_admin_email = $this->cloud_config->get_value_by_key('cloud_admin_email');
             // get external name
             $external_portal_name = $this->cloud_config->get_value_by_key('external_portal_url');
             if (!strlen($external_portal_name)) {
                 $openqrm_server = new openqrm_server();
                 $openqrm_server_ip = $openqrm_server->get_ip_address();
                 $external_portal_name = "http://{$openqrm_server_ip}/cloud-portal";
             }
             $email = $data['cu_email'];
             $forename = $data['cu_forename'];
             $lastname = $data['cu_lastname'];
             $this->cloud_mailer->to = $email;
             $this->cloud_mailer->from = $cc_admin_email;
             $this->cloud_mailer->subject = "openQRM Cloud: Your account has been created";
             $this->cloud_mailer->template = $this->rootdir . "/plugins/cloud/etc/mail/welcome_new_cloud_user.mail.tmpl";
             $arr = array('@@USER@@' => $username, '@@PASSWORD@@' => $password, '@@EXTERNALPORTALNAME@@' => $external_portal_name, '@@FORENAME@@' => $forename, '@@LASTNAME@@' => $lastname, '@@CLOUDADMIN@@' => $cc_admin_email);
             $this->cloud_mailer->var_array = $arr;
             $this->cloud_mailer->send();
             $dberror = $this->cloud_user->add($data);
             // success msg
             $response->msg = $this->lang['cloud_user_insert_successful'];
         }
     } else {
         if ($form->get_errors()) {
             $response->error = implode('<br>', $form->get_errors());
         }
     }
     return $response;
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:90,代码来源:cloud-user.insert.class.php

示例8: sync

 function sync($ct_id, $insert_into_failed)
 {
     $openqrm_server = new openqrm_server();
     $OPENQRM_SERVER_IP_ADDRESS = $openqrm_server->get_ip_address();
     $this->get_instance_by_id($ct_id);
     // get cloud user
     $local_transaction_cloud_user = new clouduser();
     $local_transaction_cloud_user->get_instance_by_id($this->cu_id);
     // get cloud-zones config parameters from main config
     $cz_conf = new cloudconfig();
     $cloud_zones_master_ip = $cz_conf->get_value(36);
     // 36 is cloud_zones_master_ip
     // check if cloud_external_ip is set
     $cloud_external_ip = $cz_conf->get_value(37);
     // 37 is cloud_external_ip
     if (!strlen($cloud_external_ip)) {
         $cloud_external_ip = $openqrm_server->get_ip_address();
     }
     // get the admin user, the zone master will automatically authenticate against this user
     $openqrm_admin_user = new user("openqrm");
     $openqrm_admin_user->set_user();
     // url for the wdsl
     $url = "https://" . $cloud_zones_master_ip . "/openqrm/boot-service/cloud-zones-soap.wsdl";
     // turn off the WSDL cache
     ini_set("soap.wsdl_cache_enabled", "0");
     // create the soap-client
     $client = new SoapClient($url, array('soap_version' => SOAP_1_2, 'trace' => 1, 'login' => $openqrm_admin_user->name, 'password' => $openqrm_admin_user->password));
     //			var_dump($client->__getFunctions());
     try {
         $send_transaction_parameters = $openqrm_admin_user->name . "," . $openqrm_admin_user->password . "," . $cloud_external_ip . "," . $local_transaction_cloud_user->name . "," . $this->id . "," . $this->time . "," . $this->cr_id . "," . $this->ccu_charge . "," . $this->reason . "," . $this->comment;
         $new_local_ccu_value = $client->CloudZonesSync($send_transaction_parameters);
         // update users ccus values with return from master
         $local_transaction_cloud_user->set_users_ccunits($this->cu_id, $new_local_ccu_value);
         $this->_event->log("push", $_SERVER['REQUEST_TIME'], 5, "cloudtransaction.class.php", "Synced transaction! User:" . $this->cu_id . "/CR:" . $this->cr_id . "/Global CCU:" . $new_local_ccu_value, "", "", 0, 0, 0);
         return true;
     } catch (Exception $e) {
         $soap_error_msg = $e->getMessage();
         $this->_event->log("push", $_SERVER['REQUEST_TIME'], 2, "cloudtransaction.class.php", "Could not sync transaction! User:" . $this->cu_id . "/CR:" . $this->cr_id . "/Charge:" . $this->ccu_charge . "/" . $soap_error_msg, "", "", 0, 0, 0);
         if ($insert_into_failed) {
             // add to failed transactions
             $cloudtransactionfailed = new cloudtransactionfailed();
             $failed_transaction_fields['tf_id'] = (int) str_replace(".", "", str_pad(microtime(true), 15, "0"));
             $failed_transaction_fields['tf_ct_id'] = $ct_id;
             $cloudtransactionfailed->add($failed_transaction_fields);
         }
         return false;
     }
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:48,代码来源:cloudtransaction.class.php


注:本文中的openqrm_server::get_ip_address方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。