function action() { require_once $this->openqrm->get('basedir') . '/plugins/cloud/cloud-portal/web/user/class/cloud-ui.create.class.php'; require_once $this->openqrm->get('basedir') . '/plugins/cloud/web/class/clouduser.class.php'; $username = $this->response->html->request()->get('username'); $this->response->add('username', $username); $user = new clouduser($username); $user->get_instance_by_name($username); $this->lang['label'] = $this->lang['label'] . ' (' . $user->name . ')'; $response = $this->response->response(); $response->add($this->actions_name, 'instance'); $response->redirect = true; require_once $this->openqrm->get('basedir') . '/web/base/class/openqrm.class.php'; $openqrm = new openqrm($this->openqrm->file(), $user, $response); $controller = new cloud_ui_create($openqrm, $response); $controller->tpldir = $this->tpldir; $controller->lang = $this->lang; $controller->basedir = $this->openqrm->get('basedir'); $controller->message_param = $this->message_param; $controller->use_api = false; $data = $controller->action(); if ($data instanceof htmlobject_template || $data instanceof htmlobject_template_debug) { $data->add('', 'private_images_link'); $data->add('', 'profiles_link'); $data->add('', 'profiles'); $data->add('none', 'display_price_list'); } else { #$this->response->html->help($data); } return $data; }
function action() { require_once $this->openqrm->get('basedir') . '/plugins/cloud/cloud-portal/web/user/class/cloud-ui.appliances.class.php'; require_once $this->openqrm->get('basedir') . '/plugins/cloud/cloud-portal/web/user/class/cloud-ui.images.class.php'; require_once $this->openqrm->get('basedir') . '/plugins/cloud/web/class/clouduser.class.php'; require_once $this->openqrm->get('basedir') . '/plugins/cloud/web/class/cloudconfig.class.php'; $return = ''; $username = $this->response->html->request()->get('username'); $this->response->add('username', $username); $user = new clouduser($username); $user->get_instance_by_name($username); $this->lang['appliances']['label'] = $this->lang['appliances']['label'] . ' (' . $user->name . ')'; $response = $this->response->response(); $response->add($this->actions_name, 'instances'); $response->redirect = false; require_once $this->openqrm->get('basedir') . '/web/base/class/openqrm.class.php'; $openqrm = new openqrm($this->openqrm->file(), $user, $response); $controller = new cloud_ui_appliances($openqrm, $response); $controller->tpldir = $this->tpldir; $controller->identifier_name = 'cloudappliance_id'; $controller->lang = $this->lang; $controller->basedir = $this->openqrm->get('basedir'); $controller->message_param = $this->message_param; $controller->clouduser = $user; $controller->cloudconfig = new cloudconfig(); $data = $controller->action(); if ($data instanceof htmlobject_template || $data instanceof htmlobject_template_debug) { $data->add('', 'private_images_link'); $data->add('', 'profiles_link'); $data->add('', 'profiles'); $data->add('none', 'display_price_list'); $return = $data->get_string(); } if ($controller->cloudconfig->get_value_by_key('show_private_image') === 'true') { $controller = new cloud_ui_images($openqrm, $response); $controller->tpldir = $this->tpldir; $controller->identifier_name = 'cloudappliance_id'; $controller->lang = $this->lang['images']; $controller->basedir = $this->openqrm->get('basedir'); $controller->message_param = $this->message_param; $controller->clouduser = $user; $controller->cloudconfig = new cloudconfig(); $data = $controller->action(); if ($data instanceof htmlobject_template || $data instanceof htmlobject_template_debug) { $return .= $data->get_string(); } } return $return; }
function action() { require_once $this->openqrm->get('basedir') . "/plugins/cloud/web/class/clouduser.class.php"; require_once $this->openqrm->get('basedir') . "/plugins/cloud/web/class/cloudrequest.class.php"; $username = $this->response->html->request()->get('username'); $this->response->add('username', $username); $user = new clouduser($username); $user->get_instance_by_name($username); $request = new cloudrequest(); $requests = $request->get_all_ids_per_user($user->id); require_once $this->openqrm->get('basedir') . "/plugins/cloud/web/class/cloud-request.controller.class.php"; $controller = new cloud_request_controller($this->openqrm, $this->response); $str = ''; foreach ($requests as $id) { $_REQUEST['cloud_request_id'] = $id['cr_id']; $_REQUEST[$controller->actions_name] = 'details'; ob_start(); $controller->api(); $str .= ob_get_contents(); ob_end_clean(); } return $str; }
function CloudPushTransaction($method_parameters) { global $event; $parameter_array = explode(',', $method_parameters); $mode = $parameter_array[0]; $username = $parameter_array[1]; $password = $parameter_array[2]; $clouduser_name = $parameter_array[3]; $cr_id = $parameter_array[4]; $ccu_charge = $parameter_array[5]; $ccu_balance = $parameter_array[6]; $reason = $parameter_array[7]; $comment = $parameter_array[8]; // check all user input for ($i = 0; $i <= 8; $i++) { if (!$this->check_param($parameter_array[$i])) { $event->log("cloudsoap->CloudPushTransaction", $_SERVER['REQUEST_TIME'], 2, "cloud-soap-server.php", "Not allowing user-intput with special-characters : {$parameter_array[$i]}", "", "", 0, 0, 0); return; } } // check parameter count $parameter_count = count($parameter_array); if ($parameter_count != 9) { $event->log("cloudsoap->CloudPushTransaction", $_SERVER['REQUEST_TIME'], 2, "cloud-soap-server.php", "Wrong parameter count {$parameter_count} ! Exiting.", "", "", 0, 0, 0); return; } // check authentication if (!$this->check_user($mode, $username, $password)) { $event->log("cloudsoap->CloudPushTransaction", $_SERVER['REQUEST_TIME'], 2, "cloud-soap-server.php", "User authentication failed (mode {$mode})", "", "", 0, 0, 0); return; } // check for admin if (strcmp($mode, "admin")) { $event->log("cloudsoap->CloudPushTransaction", $_SERVER['REQUEST_TIME'], 2, "cloud-soap-server.php", "Cloud method only available in admin mode", "", "", 0, 0, 0); return; } $cl_user = new clouduser(); if ($cl_user->is_name_free($clouduser_name)) { $event->log("cloudsoap->CloudPushTransaction", $_SERVER['REQUEST_TIME'], 2, "cloud-soap-server.php", "Cloud User name {$clouduser_name} does not exists in the Cloud !", "", "", 0, 0, 0); return 1; } $cl_user->get_instance_by_name($clouduser_name); $event->log("cloudsoap->CloudPushTransaction", $_SERVER['REQUEST_TIME'], 5, "cloud-soap-server.php", "Setting Cloud Limits for Cloud Users {$clouduser_name}", "", "", 0, 0, 0); $ct = new cloudtransaction(); $ct->push($cr_id, $cl_user->id, $ccu_charge, $ccu_balance, $reason, $comment); return 0; }
function check_user($mode, $username, $password) { global $RootDir; global $event; switch ($mode) { case 'admin': $OPENQRM_USER = new user($username); if ($OPENQRM_USER->check_user_exists()) { $OPENQRM_USER->set_user(); if (!strcmp($OPENQRM_USER->password, $password)) { return true; } else { $event->log("cloudsoap->check_user", $_SERVER['REQUEST_TIME'], 2, "cloud-soap-server.php", "Got a wrong password from openQRM User name {$username}!", "", "", 0, 0, 0); return false; } } else { $event->log("cloudsoap->check_user", $_SERVER['REQUEST_TIME'], 2, "cloud-soap-server.php", "User name {$username} does not exists in openQRM !", "", "", 0, 0, 0); return false; } break; case 'user': $cl_user = new clouduser(); // check that the user exists if ($cl_user->is_name_free($username)) { $event->log("cloudsoap->check_user", $_SERVER['REQUEST_TIME'], 2, "cloud-soap-server.php", "Cloud User name {$username} does not exists in the Cloud!", "", "", 0, 0, 0); return false; } // check users password, only if ldap is not enabled if (!file_exists($RootDir . "/plugins/ldap/.running")) { $cl_user->get_instance_by_name($username); if (strcmp($cl_user->password, $password)) { $event->log("cloudsoap->check_user", $_SERVER['REQUEST_TIME'], 2, "cloud-soap-server.php", "Got a wrong password from Cloud User name {$username}!", "", "", 0, 0, 0); return false; } } return true; break; default: return false; break; } }
function __construct() { // handle timezone needed since php 5.3 if (function_exists('ini_get')) { if (ini_get('date.timezone') === '') { date_default_timezone_set('Europe/Berlin'); } } $this->rootdir = $_SERVER["DOCUMENT_ROOT"] . '/openqrm/base'; $this->portaldir = $_SERVER["DOCUMENT_ROOT"] . '/cloud-portal'; $this->tpldir = $this->portaldir . '/user/tpl/'; $this->langdir = $this->portaldir . '/user/lang/'; require_once $this->rootdir . '/class/file.handler.class.php'; require_once $this->rootdir . '/class/htmlobjects/htmlobject.class.php'; require_once $this->rootdir . '/class/openqrm.htmlobjects.class.php'; $html = new openqrm_htmlobject(); $file = new file_handler(); $this->response = $html->response(); // handle user $user = ''; if (isset($_SERVER['PHP_AUTH_USER'])) { require_once $this->rootdir . '/plugins/cloud/class/clouduser.class.php'; $user = new clouduser($_SERVER['PHP_AUTH_USER']); $user->get_instance_by_name($_SERVER['PHP_AUTH_USER']); // handle user lang $lang = $this->response->html->request()->get('langselect'); if ($lang !== '') { $user->update($user->id, array('cu_lang' => $lang)); $user->get_instance_by_name($_SERVER['PHP_AUTH_USER']); } } // if openQRM is unconfigured, set openqrm empty if ($file->exists($this->rootdir . '/unconfigured')) { $this->openqrm = ''; $this->webdir = $html->thisdir; $this->baseurl = $html->thisurl; } else { require_once $this->rootdir . '/class/openqrm.class.php'; $this->openqrm = new openqrm($file, $user, $html->response()); $this->webdir = $this->openqrm->get('webdir'); $this->baseurl = $this->openqrm->get('baseurl'); } // translate if ($user !== '') { $lang = $user->lang; } else { $lang = $this->response->html->request()->get('langselect'); } $html->lang = $this->__translate($lang, $html->lang, $this->langdir, 'htmlobjects.ini'); $file->lang = $this->__translate($lang, $file->lang, $this->langdir, 'file.handler.ini'); require_once $this->rootdir . '/include/requestfilter.inc.php'; $request = $html->request(); $request->filter = $requestfilter; $this->file = $file; $this->baseurl = '/cloud-portal/'; // templating default or custom $tpl = $this->portaldir . "/user/tpl/index.default.tpl.php"; if ($this->file->exists($this->portaldir . "/user/tpl/index.tpl.php")) { $tpl = $this->portaldir . "/user/tpl/index.tpl.php"; } $this->tpl = $tpl; }