public function __construct($orientation = 'P', $unit = 'mm', $format = 'A4', $unicode = true, $encoding = 'UTF-8') { Language::loadLang("html_invoice", null, dirname(__FILE__) . DS . "language" . DS); Loader::loadModels($this, array("Companies", "Transactions")); $company_id = Configure::get("Blesta.company_id"); $this->company = $this->Companies->get($company_id); $this->Html = new Html(); $buffer = ''; $this->rtl = ''; }
private function updateAccountCounter($module_row) { $api = $this->getcPanelApi($module_row->meta->accesskey, $module_row->meta->hostname, $module_row->meta->username, $module_row->meta->use_ssl, false); if (($count = $this->accountCounter($api)) !== false) { Loader::loadModels($this, array("ModuleManager")); $vars = $this->ModuleManager->getRowMeta($module_row->id); if ($vars) { $vars->account_count = $count; $vars = (array) $vars; $this->ModuleManager->editRow($module_row->id, $vars); } } }
public function addService($package, array $vars = null, $parent_package = null, $parent_service = null, $status = "pending") { $row = $this->getModuleRow($package->module_row); $api = $this->getApi($row->meta->apiKey); if (!$row) { $this->Input->setErrors(array('module_row' => array('missing' => Language::_("Digitaloceanmodule.!error.module_row.missing", true)))); return; } $ip_address = null; $client_dname = $vars['hostname']; $client_sshkey = $vars['client_sshkey']; Loader::loadModels($this, array("Clients")); if (isset($vars['client_id']) && ($client = $this->Clients->get($vars['client_id'], false))) { $client_id_code = $client->id_code; } $ssh_key = array(); $ssh_key['name'] = $client_id_code . " - " . $vars['hostname']; $ssh_key['public_key'] = isset($vars['client_sshkey']) ? $vars['client_sshkey'] : $vars['client_sshkey']; $sshkey_result = $api->getPostResults("account/keys", $ssh_key); if (isset($sshkey_result->ssh_key->id) && isset($sshkey_result->ssh_key->name) && $sshkey_result->ssh_key->name === $ssh_key['name']) { $this->log("Validating Client SSH Key {$sshkey_result->ssh_key->name}", serialize("sshkey_validate"), "input", true); $api->getDeleteResults("account/keys/{$sshkey_result->ssh_key->id}"); } else { if ($sshkey_result->message === "Ssh key SSH Key is already in use on your account") { $sshkey_result->message = Language::_("Digitaloceanmodule.chooseanothersshkey", true); } $fa = array(0 => array("result" => isset($sshkey_result->message) ? $sshkey_result->message : Language::_("Digitaloceanmodule.empty_invalid_values", true))); $this->Input->setErrors($fa); } if ($vars['use_module'] == "true") { $sshkey_result = $api->getPostResults("account/keys", $ssh_key); if (isset($sshkey_result->ssh_key->id) && isset($sshkey_result->ssh_key->name) && $sshkey_result->ssh_key->name === $ssh_key['name']) { $this->log("Create Client SSH Key {$sshkey_result->ssh_key->name}", serialize("sshkey_create"), "input", true); $vars['client_sshkey'] = $sshkey_result->ssh_key->fingerprint; $this->log("Set client_sshkey variable", print_r($vars['client_sshkey'], true), "input", true); $params = $this->getFieldsFromInput((array) $vars, $package); $result = $api->getPostResults("droplets", $params); $this->log("API CREATE RESULTS" . print_r($result, true), print_r($result, true), "input", true); if (isset($result->droplet->id) && isset($result->droplet->name) && $result->droplet->name === $vars['hostname']) { $this->log("Create New Droplet {$result->droplet->id} - {$result->droplet->name}", serialize("droplet_create"), "input", true); $client_did = $result->droplet->id; $client_dname = $result->droplet->name; $client_sshkey = $sshkey_result->ssh_key->fingerprint; } else { $fa = array(0 => array("result" => isset($result->message) ? str_replace("Droplet", "Server", $result->message) : Language::_("Digitaloceanmodule.empty_invalid_values", true))); $this->Input->setErrors($fa); } } if ($this->Input->errors()) { return; } } return array(array('key' => "droplet_id", 'value' => isset($client_did) ? $client_did : null, 'encrypted' => 0), array('key' => "hostname", 'value' => isset($client_dname) ? $client_dname : null, 'encrypted' => 0), array('key' => "region", 'value' => isset($params['region']) ? $params['region'] : null, 'encrypted' => 0), array('key' => "image", 'value' => isset($params['image']) ? $params['image'] : null, 'encrypted' => 0), array('key' => "backups", 'value' => isset($params['backups']) ? $params['backups'] : null, 'encrypted' => 0), array('key' => "ipv6", 'value' => isset($params['ipv6']) ? $params['ipv6'] : null, 'encrypted' => 0), array('key' => "private_networking", 'value' => isset($params['private_networking']) ? $params['private_networking'] : null, 'encrypted' => 0), array('key' => "user_data", 'value' => isset($params['user_data']) ? $params['user_data'] : null, 'encrypted' => 0), array('key' => "client_sshkey", 'value' => isset($params['client_sshkey']) ? $params['client_sshkey'] : null, 'encrypted' => 0)); }
/** * Determines which module row should be attempted when a service is provisioned * for the given group based upon the order method set for that group. * * @return int The module row ID to attempt to add the service with * @see Module::getGroupOrderOptions() * * /DONE/ */ public function selectModuleRow($module_group_id) { if (!isset($this->ModuleManager)) { Loader::loadModels($this, array("ModuleManager")); } $group = $this->ModuleManager->getGroup($module_group_id); if ($group) { switch ($group->add_order) { default: case "first": foreach ($group->rows as $row) { return $row->id; } break; } } return 0; }
public function StructureToolbox($event) { Loader::loadModels($this, array("CssJavascriptToolbox.Toolbox")); $params = $event->getParams(); $return = $event->getReturnVal(); if (empty($params['action'])) { $action = $params['action']; } else { $action = "_" . $params['action']; } $controller = $params['controller']; $extention = array(".html", ".js", ".css", ".php"); // print_r($controller . $action ); // Set return val if not set if (!isset($return['head'])) { $return['head'] = null; } if (!isset($return['body_start'])) { $return['body_start'] = null; } if (!isset($return['body_end'])) { $return['body_end'] = null; } foreach ($extention as $ext) { if (file_exists($file_name = $this->upload_path . "head.all" . $ext)) { $return['head']['toolbox.head.all' . $ext] = $this->Toolbox->ShowContent($file_name, $ext); } if (file_exists($file_name = $this->upload_path . "body_start.all" . $ext)) { $return['body_start']['toolbox.body_start.all' . $ext] = $this->Toolbox->ShowContent($file_name, $ext); } if (file_exists($file_name = $this->upload_path . "body_end.all" . $ext)) { $return['body_end']['toolbox.body_end.all' . $ext] = $this->Toolbox->ShowContent($file_name, $ext); } } if ($params['portal'] == "client") { foreach ($extention as $ext) { if (file_exists($file_name = $this->upload_path . "head.client_area" . $ext)) { $return['head']['toolbox.head.client_area' . $ext] = $this->Toolbox->ShowContent($file_name, $ext); } if (file_exists($file_name = $this->upload_path . "body_start.client_area" . $ext)) { $return['body_start']['toolbox.body_start.client_area' . $ext] = $this->Toolbox->ShowContent($file_name, $ext); } if (file_exists($file_name = $this->upload_path . "body_end.client_area" . $ext)) { $return['body_end']['toolbox.body_end.client_area' . $ext] = $this->Toolbox->ShowContent($file_name, $ext); } } } if ($params['portal'] == "admin") { foreach ($extention as $ext) { if (file_exists($file_name = $this->upload_path . "head.admin_area" . $ext)) { $return['head']['toolbox.all.admin_area' . $ext] = $this->Toolbox->ShowContent($file_name, $ext); } if (file_exists($file_name = $this->upload_path . "body_start.admin_area" . $ext)) { $return['body_start']['toolbox.body_start.admin_area' . $ext] = $this->Toolbox->ShowContent($file_name, $ext); } if (file_exists($file_name = $this->upload_path . "body_end.admin_area" . $ext)) { $return['body_end']['toolbox.body_end.admin_area' . $ext] = $this->Toolbox->ShowContent($file_name, $ext); } } } foreach ($extention as $ext) { if (file_exists($file_name = $this->upload_path . "head." . $controller . $action . $ext)) { $return['head']['toolbox.all.' . $controller . $action . $ext] = $this->Toolbox->ShowContent($file_name, $ext); } if (file_exists($file_name = $this->upload_path . "body_start." . $controller . $action . $ext)) { $return['body_start']['toolbox.body_start.' . $controller . $action . $ext] = $this->Toolbox->ShowContent($file_name, $ext); } if (file_exists($file_name = $this->upload_path . "body_end." . $controller . $action . $ext)) { $return['body_end']['toolbox.body_end.' . $controller . $action . $ext] = $this->Toolbox->ShowContent($file_name, $ext); } } $event->setReturnVal($return); }
/** * @name generateCSR Generates a CSR request and passes back as json * @param $request This contains the GET & POST requests as an Array * @param $dataRequest This contains the package & service requests as an Array * @throws GoGetSSLAuthException * @return JSON of email Authorisation */ public function generateCSR($request, $dataRequest) { //load our helpers Loader::loadHelpers($this, array("Html")); //load models Loader::loadModels($this, array("Services")); //load our lib $lib = $this->getLib(); //pass our requests $postRequest = $request['postRequest']; $getRequest = $request['getRequest']; //set our packages and services $package = $dataRequest['package']; $service = $dataRequest['service']; //get service_fields $service_fields = $this->serviceFieldsToObject($service->fields); $requires = array("gogetssl_csr_fqdn", "gogetssl_csr_country", "gogetssl_csr_state", "gogetssl_csr_locality", "gogetssl_csr_organization", "gogetssl_csr_organization_unit", "gogetssl_csr_email"); $cert_details = $lib->getRequests($getRequest, $requires); //if any of our fields failed check if they are manditory fields /* if ($cert_details['failed'] != false){ $response['fields'] = $cert_details['failed']; $response['message'] = "missing or empty fields"; $lib->sendAjax($response,false); } */ //we can use generate ourselfs or use API $row = $this->getModuleRow($package->module_row); $api = $this->api($row); //@issue gossl sandbox does not support SHA2 for some reason $SHA = $row->meta->sandbox == "true" ? "SHA1" : "SHA2"; $data = array("csr_commonname" => $cert_details['gogetssl_csr_fqdn'], "csr_organization" => $lib->ifSet($cert_details['gogetssl_csr_organization'], "NA"), "csr_department" => $lib->ifSet($cert_details['gogetssl_csr_organization_unit'], "NA"), "csr_city" => $lib->ifSet($cert_details['gogetssl_csr_locality'], "NA"), "csr_state" => $lib->ifSet($cert_details['gogetssl_csr_state'], "NA"), "csr_country" => $lib->ifSet($cert_details['gogetssl_csr_country'], "NA"), "csr_email" => $cert_details['gogetssl_csr_email'], "signature_hash" => "SHA1"); //generate CSR $response = $api->generateCSR($data); //pass hash used $response['hash'] = $SHA; //catch the error as we may have already generated CSR with gogetssl if (isset($response['error']) && $response['error'] == true) { //if we have already generated CSR details we will retrieve this if ($response['message'] == 'CSR Exist') { if (preg_match('/CSR ID is: .(\\d+)./', $response['description'], $matches)) { $csr_id = $matches[1]; $response = $api->getCSR($csr_id, $cert_details['gogetssl_csr_fqdn']); } } else { //we have a different error lets pass back $lib->sendAjax($response, false); } } //we will end up here with a valid response->csr_code //Update our gogetssl_csr records. $csr_update = array("gogetssl_csr" => $this->Html->ifSet($response['csr_code'])); //update our csr code $service_fields_update = $this->ourServiceFields($lib->serviceFieldMerge($service_fields, $csr_update), $service_fields->gogetssl_orderid); $this->Services->setFields($service->id, $service_fields_update); $lib->sendAjax($response); }
private function updateAccountCount($module_row) { $api = $this->getApi($module_row->meta); // Get the number of accounts on the server if ($count = $this->getAccountCount($module_row)) { // Update the module row account list Loader::loadModels($this, array("ModuleManager")); $vars = $this->ModuleManager->getRowMeta($module_row->id); if ($vars) { $vars->account_count = $count; $vars = (array) $vars; $this->ModuleManager->editRow($module_row->id, $vars); } } }
/** * @param $response */ private function processTransaction($response) { $transaction_id = ''; // If a response was given, record the transaction if (is_array($response)) { Loader::loadModels($this, array('Transactions', 'Clients', 'Companies', 'Emails')); Loader::loadHelpers($this, array('Date', 'CurrencyFormat')); $trans_data = array('client_id' => $response['client_id'], 'amount' => $response['amount'], 'currency' => $response['currency'], 'type' => "other", 'gateway_id' => $response['gateway_id'], 'transaction_id' => isset($response['transaction_id']) ? $response['transaction_id'] : null, 'reference_id' => isset($response['reference_id']) ? $response['reference_id'] : null, 'parent_transaction_id' => isset($response['parent_transaction_id']) ? $response['parent_transaction_id'] : null, 'status' => $response['status']); // If the transaction exists, update it if ($trans_data['transaction_id'] && ($transaction = $this->Transactions->getByTransactionId($trans_data['transaction_id'], null, $response['gateway_id']))) { // Don't update client_id to prevent transaction from being reassigned unset($trans_data['client_id']); $this->Transactions->edit($transaction->id, $trans_data); $transaction_id = $transaction->id; } else { $transaction_id = $this->Transactions->add($trans_data); } } elseif ($errors = $this->errors()) { $this->Input->setErrors($errors); die('Transaction invalid!'); } // Set any errors with adding the transaction if ($errors = $this->Transactions->errors()) { $this->Input->setErrors($errors); die('Cannot process transaction #' . $transaction_id); } else { // Apply the transaction to the invoices given (if any) if (isset($response['invoices']) && is_array($response['invoices'])) { // Format invoices into something suitable for Transactions::apply() foreach ($response['invoices'] as &$invoice) { $invoice['invoice_id'] = $invoice['id']; unset($invoice['id']); } if (!empty($response['invoices']) && $response['status'] == "approved") { $this->Transactions->apply($transaction_id, array('amounts' => $response['invoices'])); } } $transaction = $this->Transactions->get($transaction_id); // Send an email regarding the non-merchant payment received if (isset($response['status']) && isset($response['client_id']) && $response['status'] == "approved" && $transaction && ($client = $this->Clients->get($response['client_id']))) { // Set date helper info $this->Date->setTimezone("UTC", Configure::get("Blesta.company_timezone")); $this->Date->setFormats(array('date_time' => $this->Companies->getSetting($response['company_id'], "datetime_format")->value)); $amount = $this->CurrencyFormat->format($transaction->amount, $transaction->currency); $tags = array('contact' => $client, 'transaction' => $transaction, 'date_added' => $this->Date->cast($transaction->date_added, "date_time")); $this->Emails->send("payment_nonmerchant_approved", $response['company_id'], $client->settings['language'], $client->email, $tags, null, null, null, array('to_client_id' => $client->id)); } die('OK'); } }
public function addService($package, array $vars = null, $parent_package = null, $parent_service = null, $status = "pending") { $row = $this->getModuleRow($package->module_row); $api = $this->getApi($row->meta->apiKey); if (!$row) { $this->Input->setErrors(array('module_row' => array('missing' => Language::_("ngcs.!error.module_row.missing", true)))); return; } $ip_address = null; $servername = isset($vars['servername']) ? $vars['servername'] : 'Blesta CloudServer cID:' . $vars['client_id']; $serverdesc = $vars['clientdescription']; $serversize = array('fixed_instance_size_id' => $package->meta->meta['size']); $serverpass = isset($vars['serverpassword']) ? $vars['serverpassword'] : ''; $serverimage = $vars['configoptions']['images']; Loader::loadModels($this, array("Clients")); if (isset($vars['client_id']) && ($client = $this->Clients->get($vars['client_id'], false))) { $client_id_code = $client->id_code; } //die(var_dump($package)); $params = $this->getFieldsFromInput((array) $vars, $package); // $api->ngcs->Server()->create(ServerNAME, HARDWAREConfig, ServerIMG, Description, Password) $result = $api->ngcs->Server()->create(uniqid($servername . "_"), $serversize, $serverimage, $serverdesc, $serverpass); $cloud = $result['body']; if (isset($result['code']) && $result['code'] == 202) { $this->log("Create New CloudServer {cloud->id} - {$cloud->name}", serialize("Server_Create"), "input", true); $client_did = $cloud->id; $client_dname = $cloud->name; $client_pass = $cloud->first_password; } else { $fa = array(0 => array("result" => $cloud->message)); $this->Input->setErrors($fa); } if ($this->Input->errors()) { return; } return array(array('key' => "ngcs_cloud_id", 'value' => isset($client_did) ? $client_did : null, 'encrypted' => 0), array('key' => "ngcs_cloud_name", 'value' => isset($client_dname) ? $client_dname : null, 'encrypted' => 0), array('key' => "ngcs_cloud_password", 'value' => isset($serverpass) ? $serverpass : $client_pass, 'encrypted' => 1)); }
/** * Returns all HTML markup required to render an authorization and capture payment form * * @param array $contact_info An array of contact info including: * - id The contact ID * - client_id The ID of the client this contact belongs to * - user_id The user ID this contact belongs to (if any) * - contact_type The type of contact * - contact_type_id The ID of the contact type * - first_name The first name on the contact * - last_name The last name on the contact * - title The title of the contact * - company The company name of the contact * - address1 The address 1 line of the contact * - address2 The address 2 line of the contact * - city The city of the contact * - state An array of state info including: * - code The 2 or 3-character state code * - name The local name of the country * - country An array of country info including: * - alpha2 The 2-character country code * - alpha3 The 3-character country code * - name The english name of the country * - alt_name The local name of the country * - zip The zip/postal code of the contact * @param float $amount The amount to charge this contact * @param array $invoice_amounts An array of invoices, each containing: * - id The ID of the invoice being processed * - amount The amount being processed for this invoice (which is included in $amount) * @param array $options An array of options including: * - description The Description of the charge * - return_url The URL to redirect users to after a successful payment * - recur An array of recurring info including: * - amount The amount to recur * - term The term to recur * - period The recurring period (day, week, month, year, onetime) used in conjunction with term in order to determine the next recurring payment * @return string HTML markup required to render an authorization and capture payment form */ public function buildProcess(array $contact_info, $amount, array $invoice_amounts = null, array $options = null) { $this->initPaymentwallConfigs(); $post_to = Configure::get("Blesta.gw_callback_url") . Configure::get("Blesta.company_id") . "/brick/"; $fields = array(); $contact = false; // Set contact email address and phone number if ($this->ifSet($contact_info['id'], false)) { Loader::loadModels($this, array("Contacts")); $contact = $this->Contacts->get($contact_info['id']); } else { return "Contact information invalid!"; } $data = array('public_key' => Paymentwall_Config::getInstance()->getPublicKey(), 'amount' => $amount, 'merchant' => $this->ifSet($this->meta['merchant_name'], 'Blesta'), 'product_name' => $options['description'], 'currency' => $this->currency); $post_to .= "?data=" . $this->encodeData(array('client_id' => $contact->client_id, 'amount' => $amount, 'currency' => $this->currency, 'invoices' => $invoice_amounts, 'email' => $contact->email, 'description' => $options['description'])); $this->view = $this->makeView("process", "default", str_replace(ROOTWEBDIR, "", dirname(__FILE__) . DS)); $this->view->set("data", $data); $this->view->set("post_to", $post_to); $this->view->set("fields", $fields); return $this->view->fetch(); }
/** * Allow you to manage and create your backups. * * @param type $package * @param type $service * @param array $vars * @param array $post */ public function backups($package, $service, array $get = null, array $post = null, array $files = null) { if (isset($get[2])) { if ($get[2] === "addnew") { if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { $this->view = new View("backups", "default"); $this->view->setDefaultView("components" . DS . "modules" . DS . "cpanelextended" . DS); $view_dir = str_replace('client/', '', $this->base_uri) . $this->view->view_path . 'views/' . $this->view->view . '/'; Loader::loadHelpers($this, array("Form", "Html")); $fields = $this->serviceFieldsToObject($service->fields); $row = $this->getModuleRow(); $api = $this->getApiByMeta($row->meta, $fields); if (isset($post) && !empty($post)) { if ($post['dest'] !== "") { $input = array("dest" => $post['dest'], "server" => $post['server'], "user" => $post['user'], "pass" => $post['pass'], "email" => $post['email'], "port" => $post['port'], "rdir" => $post['rdir']); if ($post['dest'] !== "homedir") { if ($post['server'] !== "" && $post['user'] !== "" && $post['pass'] !== "" && $post['port'] !== "" && $post['rdir'] !== "") { Loader::loadModels($this, array("Services")); $add_new = $api->sendApi1Request("Fileman", "fullbackup", $input); $this->log($row->meta->host_name . "|Generate New Backup", serialize("fullbackup"), "input", true); echo "<div class='alert alert-success alert-dismissable' style='margin-top: 0px;'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<p>" . Language::_("Cpe.misc.success", true) . "</p>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>"; } else { $error = array(0 => array("result" => Language::_("Cpe.!error.api.internal", true))); echo "<div class='alert alert-danger alert-dismissable' style='margin-top: 0px;'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<p>{$error[0]['result']}</p>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>"; } } else { Loader::loadModels($this, array("Services")); $add_new = $api->sendApi1Request("Fileman", "fullbackup", $input); $this->log($row->meta->host_name . "|Generate New Backup", serialize("fullbackup"), "input", true); echo "<div class='alert alert-success alert-dismissable' style='margin-top: 0px;'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<p>" . Language::_("Cpe.misc.success", true) . "</p>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>"; } } else { $error = array(0 => array("result" => Language::_("Cpe.!error.api.internal", true))); echo "<div class='alert alert-danger alert-dismissable' style='margin-top: 0px;'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<p>{$error[0]['result']}</p>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>"; } } else { $this->Form->create("", array('onsubmit' => 'return false', 'id' => 'addform', 'autocomplete' => "off")); echo "\n\t\t\t\t\t\t\t\t<script type='text/javascript' src='" . $view_dir . "javascript/main.js'></script>\n\t\t\t\t\t\t\t\t<div class='modal-body'>\n\t\t\t\t\t\t\t\t<div class='div_response'></div>"; echo '<div class="form-group"> <label>' . Language::_("Cpe.label.email", true) . '</label> <input type="email" class="form-control" value="" id="email" name="email" placeholder=""></div> <div class="form-group"> <label>' . Language::_("Cpe.label.destination", true) . '</label> <select name="dest" id="dest" class="form-control"> <option value="homedir" selected="selected">Home Directory</option> <option value="ftp">Remote FTP Server</option> <option value="passiveftp">Remote FTP Server (passive mode transfer):</option> <option value="scp">Secure Copy (SCP)</option> </select> </div> <div id="access_data" style="display:none;"> <div class="form-group"> <label>' . Language::_("Cpe.service_info.server", true) . '</label> <input type="text" class="form-control" value="" id="server" name="server" placeholder=""></div> <div class="form-group"> <label>' . Language::_("Cpe.label.username", true) . '</label> <input type="text" class="form-control" value="" id="user" name="user" placeholder=""></div> <div class="form-group"> <label>' . Language::_("Cpe.label.password", true) . '</label> <input type="password" class="form-control" value="" id="pass" name="pass" placeholder=""></div> <div class="form-group"> <label>' . Language::_("Cpe.label.port", true) . '</label> <input type="text" class="form-control" value="" id="port" name="port" placeholder=""></div> <div class="form-group"> <label>' . Language::_("Cpe.label.directory", true) . '</label> <input type="text" class="form-control" value="" id="rdir" name="rdir" placeholder=""></div> </div> </div> <div class="modal-footer"> <button type="button" name="cancel" class="btn btn-default" data-dismiss="modal"><i class="fa fa-ban"></i> ' . Language::_("Cpe.label.close", true) . '</button> <button type="button" class="btn btn-primary" name="add_new" id="addnewsubmit"><i class="fa fa-plus-circle"></i> ' . Language::_("Cpe.label.generate_backup", true) . '</button> </div> <script type="text/javascript"> $(document).ready(function() { $("#addnewsubmit").click(function () { var form = $("#addform").serialize(); doAjaxPost("' . $this->base_uri . "services/manage/" . $service->id . "/backups/addnew/?" . '"+ form, form); }); $("#dest").change(function () { if($(this).val() !== "homedir"){ $("#access_data").css("display","block"); } else { $("#access_data").css("display","none"); } }); }); </script>'; $this->Form->end(); } exit; } } } else { $this->view = new View("backups", "default"); $this->view->base_uri = $this->base_uri; Loader::loadHelpers($this, array("Form", "Html")); $fields = $this->serviceFieldsToObject($service->fields); $row = $this->getModuleRow(); $api = $this->getApiByMeta($row->meta, $fields); $backups_list = $api->sendApi2Request("Backups", "listfullbackups")->getResponse(); $this->view->set("module_row", $row); $this->view->set("service_fields", $fields); $this->view->set("backups_list", $backups_list->cpanelresult->data); $this->view->set("type", $package->meta->type); $this->view->set("service_id", $service->id); $this->view->setDefaultView("components" . DS . "modules" . DS . "cpanelextended" . DS); return $this->view->fetch(); } }