function get_sshterm_appliance_link($appliance_id)
{
    global $event;
    global $OPENQRM_SERVER_BASE_DIR;
    global $OPENQRM_SERVER_IP_ADDRESS;
    global $OPENQRM_EXEC_PORT;
    $p_appliance = new appliance();
    $p_appliance->get_instance_by_id($appliance_id);
    $p_resource = new resource();
    $p_resource->get_instance_by_id($p_appliance->resources);
    // get the parameters from the plugin config file
    $OPENQRM_PLUGIN_SSHTERM_CONFIG_FILE = "{$OPENQRM_SERVER_BASE_DIR}/openqrm/plugins/sshterm/etc/openqrm-plugin-sshterm.conf";
    $store = openqrm_parse_conf($OPENQRM_PLUGIN_SSHTERM_CONFIG_FILE);
    extract($store);
    $sshterm_login_ip = $p_resource->ip;
    $sshterm_window = 'window' . str_replace('.', '', $sshterm_login_ip);
    $sshterm_login_url = "https://{$sshterm_login_ip}:{$OPENQRM_PLUGIN_WEBSHELL_PORT}";
    $html = new htmlobject($OPENQRM_SERVER_BASE_DIR . '/openqrm/web/base/class/htmlobjects');
    $a = $html->a();
    $a->label = 'SSHTerm';
    $a->css = 'badge';
    $a->href = '#';
    $a->handler = 'onclick="sshwindow = window.open(\'' . $sshterm_login_url . '\',\'' . $sshterm_window . '\', \'location=0,status=0,scrollbars=yes,resizable=yes,width=972,height=500,left=100,top=100,screenX=400,screenY=100\'); sshwindow.focus(); return false;"';
    $plugin_link = '';
    if (strstr($p_appliance->state, "active")) {
        $plugin_link = $a;
    }
    if ($p_resource->id == 0) {
        $plugin_link = $a;
    }
    if ($p_resource->id == '') {
        $plugin_link = "";
    }
    return $plugin_link;
}
function get_template_appliance_link($appliance_id)
{
    global $event;
    global $OPENQRM_SERVER_BASE_DIR;
    global $OPENQRM_SERVER_IP_ADDRESS;
    global $OPENQRM_EXEC_PORT;
    $p_appliance = new appliance();
    $p_appliance->get_instance_by_id($appliance_id);
    $p_resource = new resource();
    $p_resource->get_instance_by_id($p_appliance->resources);
    $html = new htmlobject($OPENQRM_SERVER_BASE_DIR . '/openqrm/web/base/class/htmlobjects');
    $a = $html->a();
    $a->label = 'Template';
    $a->css = 'badge';
    $a->href = '#';
    $a->handler = 'onclick="window.open(\'Template-URL\',\'\', \'location=0,status=0,scrollbars=1,width=1150,height=800,left=50,top=50,screenX=50,screenY=50\');return false;"';
    $plugin_link = '';
    if (strstr($p_appliance->state, "active")) {
        $plugin_link = $a;
    }
    if ($p_resource->id == 0) {
        $plugin_link = $a;
    }
    if ($p_resource->id == '') {
        $plugin_link = "";
    }
    return $plugin_link;
}
function get_nagios3_appliance_link($appliance_id)
{
    global $event;
    global $OPENQRM_SERVER_BASE_DIR;
    global $OPENQRM_SERVER_IP_ADDRESS;
    global $OPENQRM_EXEC_PORT;
    $p_appliance = new appliance();
    $p_appliance->get_instance_by_id($appliance_id);
    $p_resource = new resource();
    $p_resource->get_instance_by_id($p_appliance->resources);
    $nagios_link = "/openqrm/base/index.php?name=Nagios3&iframe=/cgi-bin/nagios3/status.cgi?host=" . $p_appliance->name;
    $html = new htmlobject($OPENQRM_SERVER_BASE_DIR . '/openqrm/web/base/class/htmlobjects');
    $a = $html->a();
    //	$a->label = '<img title="Service monitoring" alt="Service monitoring" height="24" width="24" src="/openqrm/base/plugins/nagios3/img/plugin.png" border=0>';
    $a->label = 'nagios';
    $a->css = 'badge';
    $a->href = $nagios_link;
    $a->handler = '';
    $plugin_link = $a;
    if ($p_resource->id == 0) {
        $plugin_link = $a;
    }
    if ($p_resource->id == '') {
        $plugin_link = "";
    }
    return $plugin_link;
}
function get_lcmc_appliance_link($appliance_id)
{
    global $event;
    global $OPENQRM_SERVER_BASE_DIR;
    global $OPENQRM_SERVER_IP_ADDRESS;
    global $OPENQRM_EXEC_PORT;
    $p_appliance = new appliance();
    $p_appliance->get_instance_by_id($appliance_id);
    $p_resource = new resource();
    $p_resource->get_instance_by_id($p_appliance->resources);
    $lcmc_gui = "/openqrm/base/plugins/lcmc/lcmc-gui.php";
    $icon_size = "width='24' height='24'";
    $icon_title = "Configure appliaction highavailability";
    $html = new htmlobject($OPENQRM_SERVER_BASE_DIR . '/openqrm/web/base/class/htmlobjects');
    $a = $html->a();
    $a->label = 'LCMC';
    //'<img title="'.$icon_title.'" alt="'.$icon_title.'" $icon_size src="/openqrm/base/plugins/lcmc/img/plugin.png" border=0>';
    $a->css = 'badge';
    $a->href = '#';
    $a->handler = 'onclick="window.open(\'' . $lcmc_gui . '\',\'\', \'location=0,status=0,scrollbars=1,width=1150,height=800,left=50,top=50,screenX=50,screenY=50\');return false;"';
    $plugin_link = '';
    if (strstr($p_appliance->state, "active")) {
        $plugin_link = $a;
    }
    if ($p_resource->id == 0) {
        $plugin_link = $a;
    }
    if ($p_resource->id == '') {
        $plugin_link = "";
    }
    return $plugin_link;
}
function get_novnc_appliance_link($appliance_id)
{
    global $event;
    global $OPENQRM_SERVER_BASE_DIR;
    global $OPENQRM_SERVER_IP_ADDRESS;
    global $OPENQRM_EXEC_PORT;
    $p_appliance = new appliance();
    $p_appliance->get_instance_by_id($appliance_id);
    $p_resource = new resource();
    $p_resource->get_instance_by_id($p_appliance->resources);
    $virtualization = new virtualization();
    $virtualization->get_instance_by_id($p_appliance->virtualization);
    $html = new htmlobject($OPENQRM_SERVER_BASE_DIR . '/openqrm/web/base/class/htmlobjects');
    $a = $html->a();
    $a->label = 'noVNC';
    $a->css = 'badge';
    $a->handler = 'onclick="wait();"';
    $plugin_link = '';
    if (strstr($p_appliance->state, "active")) {
        if (strstr($virtualization->type, '-vm-')) {
            $a->href = '/openqrm/base/index.php?plugin=novnc&controller=novnc&novnc_action=console&appliance_id=' . $p_appliance->id;
        } else {
            $a->href = '/openqrm/base/index.php?plugin=novnc&controller=novnc&novnc_action=login&appliance_id=' . $p_appliance->id;
        }
        $plugin_link = $a;
    } else {
        if ($p_resource->id === '0') {
            $a->href = '/openqrm/base/index.php?plugin=novnc&controller=novnc&novnc_action=login&appliance_id=' . $p_appliance->id;
            $plugin_link = $a;
        }
    }
    return $plugin_link;
}
function openqrm_novnc_remote_console($resource_id)
{
    global $event;
    global $OPENQRM_SERVER_BASE_DIR;
    global $OPENQRM_SERVER_IP_ADDRESS;
    global $OPENQRM_EXEC_PORT;
    $html = new htmlobject($OPENQRM_SERVER_BASE_DIR . '/openqrm/web/base/class/htmlobjects');
    $a = $html->a();
    $a->label = 'noVNC';
    $a->css = 'badge';
    $a->href = '/openqrm/base/index.php?plugin=novnc&controller=novnc&novnc_action=console&resource_id=' . $resource_id;
    $a->handler = 'onclick="wait();"';
    return $a;
}
Exemplo n.º 7
0
 function init()
 {
     parent::init();
     if ($this->align != '') {
         $this->_init .= ' align="' . $this->align . '"';
     }
     if (isset($this->border) && $this->border !== '') {
         $this->_init .= ' border="' . $this->border . '"';
     }
     if ($this->bgcolor != '') {
         $this->_init .= ' bgcolor="' . $this->bgcolor . '"';
     }
     if (isset($this->cellpadding) && $this->cellpadding !== '') {
         $this->_init .= ' cellpadding="' . $this->cellpadding . '"';
     }
     if (isset($this->cellspacing) && $this->cellspacing !== '') {
         $this->_init .= ' cellspacing="' . $this->cellspacing . '"';
     }
     if ($this->frame != '') {
         $this->_init .= ' frame="' . $this->frame . '"';
     }
     if ($this->rules != '') {
         $this->_init .= ' rules="' . $this->rules . '"';
     }
     if ($this->summary != '') {
         $this->_init .= ' summary="' . $this->summary . '"';
     }
     if ($this->width != '') {
         $this->_init .= ' width="' . $this->width . '"';
     }
 }
function get_template_appliance_edit($appliance_id)
{
    global $event;
    global $OPENQRM_SERVER_BASE_DIR;
    global $OPENQRM_SERVER_IP_ADDRESS;
    global $OPENQRM_EXEC_PORT;
    $appliance = new appliance();
    $appliance->get_instance_by_id($appliance_id);
    $plugin_title = "Configure Application on Appliance " . $appliance->name;
    $plugin_link = "/openqrm/base/index.php?plugin=template&appliance_id=" . $appliance_id . "&template_action=edit";
    $html = new htmlobject($OPENQRM_SERVER_BASE_DIR . '/openqrm/web/base/class/htmlobjects');
    $a = $html->a();
    $a->label = '<image height="24" width="24" alt="' . $plugin_title . '" title="' . $plugin_title . '" src="/openqrm/base/plugins/template/img/plugin.png">';
    $a->href = $plugin_link;
    $a->handler = '';
    return $a;
}
function get_hybrid_cloud_appliance_link($appliance_id)
{
    global $event;
    global $OPENQRM_SERVER_BASE_DIR;
    global $OPENQRM_SERVER_IP_ADDRESS;
    global $OPENQRM_EXEC_PORT;
    $p_appliance = new appliance();
    $p_appliance->get_instance_by_id($appliance_id);
    $p_resource = new resource();
    $p_resource->get_instance_by_id($p_appliance->resources);
    $virtualization = new virtualization();
    $virtualization->get_instance_by_id($p_appliance->virtualization);
    if ($virtualization->type != "hybrid-cloud-vm-local") {
        return;
    }
    // get hybrid-cloud account
    $hybrid_cloud_acl_id = $p_resource->get_resource_capabilities("HCACL");
    if ($hybrid_cloud_acl_id == '') {
        $event->log("get_hybrid_cloud_appliance_link", $_SERVER['REQUEST_TIME'], 2, "openqrm-hybrid-cloud-appliance-link-hook.php", "Could not find Hybrid-Cloud Account for resource " . $p_resource->id, "", "", 0, 0, $appliance_id);
        return;
    }
    $hc = new hybrid_cloud();
    $hc->get_instance_by_id($hybrid_cloud_acl_id);
    $html = new htmlobject($OPENQRM_SERVER_BASE_DIR . '/openqrm/web/base/class/htmlobjects');
    $a = $html->a();
    $a->label = 'Dashboard';
    $a->css = 'badge';
    $a->target = '_BLANK';
    if ($hc->account_type == 'aws' || $hc->account_type == 'euca') {
        $a->href = 'https://console.aws.amazon.com/ec2/';
    }
    if ($hc->account_type == 'lc-openstack') {
        $a->href = 'http://' . $hc->host . '/project/instances/';
    }
    $plugin_link = $a->get_string();
    return $plugin_link;
}
function get_collectd_appliance_link($appliance_id)
{
    global $event;
    global $OPENQRM_SERVER_BASE_DIR;
    $appliance_name = '';
    $appliance = new appliance();
    $appliance->get_instance_by_id($appliance_id);
    $resource = new resource();
    $resource->get_instance_by_id($appliance->resources);
    $hostname = $appliance->name;
    if ($resource->id == 0) {
        $hostname = 'openqrm';
    }
    $a = '';
    if (file_exists('/usr/share/openqrm/plugins/collectd/data/' . $hostname)) {
        $html = new htmlobject($OPENQRM_SERVER_BASE_DIR . '/openqrm/web/base/class/htmlobjects');
        $a = $html->a();
        $a->label = 'collectd';
        $a->css = 'badge';
        $a->handler = 'onclick="wait();"';
        $a->href = '/openqrm/base/index.php?plugin=collectd&controller=collectd&collectd_action=statistics&appliance_id=' . $appliance->id;
    }
    return $a;
}
Exemplo n.º 11
0
require_once "{$RootDir}/include/openqrm-database-functions.php";
require_once "{$RootDir}/include/user.inc.php";
require_once "{$RootDir}/include/openqrm-server-config.php";
require_once "{$RootDir}/class/storage.class.php";
require_once "{$RootDir}/class/image.class.php";
require_once "{$RootDir}/class/kernel.class.php";
require_once "{$RootDir}/class/resource.class.php";
require_once "{$RootDir}/class/appliance.class.php";
require_once "{$RootDir}/class/deployment.class.php";
require_once "{$RootDir}/class/plugin.class.php";
require_once "{$RootDir}/class/event.class.php";
require_once "{$RootDir}/class/openqrm_server.class.php";
// filter inputs
require_once $RootDir . '/class/htmlobjects/htmlobject.class.php';
require_once $RootDir . '/include/requestfilter.inc.php';
$html = new htmlobject($RootDir . '/class/htmlobjects/');
$request = $html->request();
$request->filter = $requestfilter;
global $IMAGE_INFO_TABLE;
global $DEPLOYMENT_INFO_TABLE;
global $KERNEL_INFO_TABLE;
global $STORAGETYPE_INFO_TABLE;
global $OPENQRM_SERVER_BASE_DIR;
// user/role authentication
if ($OPENQRM_USER->role != "administrator") {
    $event->log("authorization", $_SERVER['REQUEST_TIME'], 1, "local-server-action", "Un-Authorized access to lvm-actions from {$OPENQRM_USER->name}", "", "", 0, 0, 0);
    exit;
}
$local_server_command = $request->get('local_server_command');
$local_server_id = $request->get('local_server_id');
$local_server_root_device = $request->get('local_server_root_device');
Exemplo n.º 12
0
 /**
  * init attribs
  *
  * @acess protected
  */
 function init()
 {
     parent::init();
     if ($this->content == '') {
         $this->content = '&#160;';
     }
     if ($this->css_left != '') {
         $this->css_left = ' class="' . $this->css_left . '"';
     }
     if ($this->css_right != '') {
         $this->css_right = ' class="' . $this->css_right . '"';
     }
 }
Exemplo n.º 13
0
/*
    openQRM Enterprise developed by openQRM Enterprise GmbH.

    All source code and content (c) Copyright 2014, openQRM Enterprise GmbH unless specifically noted otherwise.

    This source code is released under the GNU General Public License version 2, unless otherwise agreed with openQRM Enterprise GmbH.
    The latest version of this license can be found here: src/doc/LICENSE.txt

    By using this software, you acknowledge having read this license and agree to be bound thereby.

                http://openqrm-enterprise.com

    Copyright 2014, openQRM Enterprise GmbH <*****@*****.**>
*/
$RootDir = $_SERVER["DOCUMENT_ROOT"] . '/openqrm/base/';
require_once $RootDir . "/include/user.inc.php";
require_once $RootDir . "/class/openqrm.class.php";
require_once $RootDir . "/plugins/hybrid-cloud/class/hybrid-cloud.controller.class.php";
require_once $RootDir . "/class/htmlobjects/htmlobject.class.php";
$html = new htmlobject($RootDir . "/class/htmlobjects/");
$response = $html->response();
require_once $RootDir . '/class/file.handler.class.php';
$file = new file_handler();
require_once $RootDir . '/class/user.class.php';
$user = new user($_SERVER['PHP_AUTH_USER']);
$user->set_user();
$openqrm = new openqrm($file, $user);
$openqrm->init();
$controller = new hybrid_cloud_controller($openqrm, $response);
$controller->api();
Exemplo n.º 14
0
 function tablebuilder($id, $params = null)
 {
     // handle table params
     !isset($_SESSION) ? @session_start() : null;
     $vars = $this->request()->get($id);
     if ($vars !== '') {
         $_SESSION['tablebuilder'][$id]['sort'] = $vars['sort'];
         $_SESSION['tablebuilder'][$id]['order'] = $vars['order'];
         $_SESSION['tablebuilder'][$id]['limit'] = $vars['limit'];
         $_SESSION['tablebuilder'][$id]['offset'] = $vars['offset'];
     } else {
         if (isset($_SESSION['tablebuilder'][$id]['sort'])) {
             $_REQUEST[$id]['sort'] = $_SESSION['tablebuilder'][$id]['sort'];
             $_REQUEST[$id]['order'] = $_SESSION['tablebuilder'][$id]['order'];
             $_REQUEST[$id]['limit'] = $_SESSION['tablebuilder'][$id]['limit'];
             $_REQUEST[$id]['offset'] = $_SESSION['tablebuilder'][$id]['offset'];
         }
     }
     $obj = parent::tablebuilder($id, $params);
     return $obj;
 }
Exemplo n.º 15
0
    Copyright 2014, openQRM Enterprise GmbH <*****@*****.**>
*/
// check if configured already
if (file_exists("./unconfigured")) {
    header("Location: configure.php");
}
$RootDir = $_SERVER["DOCUMENT_ROOT"] . '/openqrm/base/';
require_once $RootDir . 'class/htmlobjects/htmlobject.class.php';
require_once $RootDir . 'class/openqrm.class.php';
require_once $RootDir . 'class/resource.class.php';
global $OPENQRM_SERVER_BASE_DIR;
global $OPENQRM_EXECUTION_LAYER;
global $OPENQRM_WEB_PROTOCOL;
$lang = array('label' => 'License upload', 'upload' => 'Please select the openQRM Enterprise Server License File and Public Key from your local computer and submit', 'msg' => 'Uploaded License file %s');
$html = new htmlobject($RootDir . 'class/htmlobjects/');
$response = $html->response();
$form = $response->get_form();
$form->box_css = 'htmlobject_box';
$form->display_errors = true;
$d['upload']['label'] = $lang['upload'];
$d['upload']['object']['type'] = 'input';
$d['upload']['object']['attrib']['type'] = 'file';
$d['upload']['object']['attrib']['name'] = 'upload';
$d['upload']['object']['attrib']['size'] = 30;
$form->add($html->thisfile, 'thisfile');
$form->add($d);
if (!$form->get_errors() && $response->submit()) {
    require_once $RootDir . 'class/file.handler.class.php';
    require_once $RootDir . 'class/file.upload.class.php';
    $file = new file_handler();