Advertisement
Guest User

Untitled

a guest
Aug 6th, 2012
347
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.18 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by deZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 1.1.5.0
  8. * @ Author : DeZender
  9. * @ Release on : 09.06.2012
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. class OnAPP extends VPSModule {
  15. private $username_prefix = 'hb_client_';
  16. var $onapp_tz = array( 'AF' => 'Kabul', 'AX' => 'Vilnius', 'AL' => 'Zagreb', 'DZ' => 'Zagreb', 'AS' => 'Samoa', 'AD' => 'Zagreb', 'AO' => 'Zagreb', 'AI' => 'Santiago', 'AQ' => 'Urumqi', 'AG' => 'Santiago', 'AR' => 'Mid-Atlantic', 'AM' => 'Yerevan', 'AW' => 'Santiago', 'AT' => 'Zagreb', 'AZ' => 'Yerevan', 'BS' => 'Quito', 'BH' => 'Riyadh', 'BD' => 'Novosibirsk', 'BB' => 'Santiago', 'BY' => 'Vilnius', 'BE' => 'Zagreb', 'BZ' => 'Saskatchewan', 'BJ' => 'Zagreb', 'BM' => 'Santiago', 'BT' => 'Ekaterinburg', 'BO' => 'Santiago', 'BA' => 'Zagreb', 'BW' => 'Vilnius', 'BR' => 'Greenland', 'IO' => 'Ekaterinburg', 'BN' => 'Urumqi', 'BG' => 'Vilnius', 'BF' => 'UTC', 'BI' => 'Vilnius', 'KH' => 'Novosibirsk', 'CM' => 'Zagreb', 'CA' => 'Quito', 'CV' => 'Cape Verde Is.', 'KY' => 'Quito', 'CF' => 'Zagreb', 'TD' => 'Zagreb', 'CL' => 'Greenland', 'CN' => 'Urumqi', 'CX' => 'Novosibirsk', 'CC' => 'Rangoon', 'CO' => 'Quito', 'KM' => 'Riyadh', 'CG' => 'Zagreb', 'CD' => 'Zagreb', 'CK' => 'Hawaii', 'CR' => 'Saskatchewan', 'CI' => 'UTC', 'HR' => 'Zagreb', 'CU' => 'Quito', 'CY' => 'Vilnius', 'CZ' => 'Zagreb', 'DK' => 'Zagreb', 'DJ' => 'Riyadh', 'DM' => 'Santiago', 'DO' => 'Santiago', 'EC' => 'Quito', 'EG' => 'Vilnius', 'SV' => 'Saskatchewan', 'GQ' => 'Zagreb', 'ER' => 'Riyadh', 'EE' => 'Vilnius', 'ET' => 'Riyadh', 'FK' => 'Greenland', 'FO' => 'UTC', 'FJ' => 'Wellington', 'FI' => 'Vilnius', 'FR' => 'Zagreb', 'GF' => 'Greenland', 'PF' => 'Alaska', 'TF' => 'Tashkent', 'GA' => 'Zagreb', 'GM' => 'UTC', 'GE' => 'Yerevan', 'DE' => 'Zagreb', 'GH' => 'UTC', 'GI' => 'Zagreb', 'GR' => 'Vilnius', 'GL' => 'UTC', 'GD' => 'Santiago', 'GP' => 'Santiago', 'GU' => 'Yakutsk', 'GT' => 'Saskatchewan', 'GG' => 'UTC', 'GN' => 'UTC', 'GW' => 'UTC', 'GY' => 'Santiago', 'HT' => 'Quito', 'VA' => 'Zagreb', 'HN' => 'Saskatchewan', 'HK' => 'Urumqi', 'HU' => 'Zagreb', 'IS' => 'UTC', 'IN' => 'Sri Jayawardenepura', 'ID' => 'Novosibirsk', 'IR' => 'Tehran', 'IQ' => 'Riyadh', 'IE' => 'UTC', 'IM' => 'UTC', 'IL' => 'Vilnius', 'IT' => 'Zagreb', 'JM' => 'Quito', 'JP' => 'Tokyo', 'JE' => 'UTC', 'JO' => 'Vilnius', 'KZ' => 'Ekaterinburg', 'KE' => 'Riyadh', 'KI' => 'Nuku\'alofa', 'KR' => 'Tokyo', 'KW' => 'Riyadh', 'KG' => 'Ekaterinburg', 'LA' => 'Novosibirsk', 'LV' => 'Vilnius', 'LB' => 'Vilnius', 'LS' => 'Vilnius', 'LR' => 'UTC', 'LY' => 'Vilnius', 'LI' => 'Zagreb', 'LT' => 'Vilnius', 'LU' => 'Zagreb', 'MO' => 'Urumqi', 'MK' => 'Zagreb', 'MG' => 'Riyadh', 'MW' => 'Vilnius', 'MY' => 'Urumqi', 'MV' => 'Tashkent', 'ML' => 'UTC', 'MT' => 'Zagreb', 'MH' => 'Wellington', 'MQ' => 'Santiago', 'MR' => 'UTC', 'MU' => 'Tashkent', 'YT' => 'Riyadh', 'MX' => 'Saskatchewan', 'FM' => 'Vladivostok', 'MD' => 'Vilnius', 'MC' => 'Zagreb', 'MN' => 'Urumqi', 'ME' => 'Zagreb', 'MS' => 'Santiago', 'MA' => 'UTC', 'MZ' => 'Vilnius', 'MM' => 'Rangoon', 'NA' => 'Vilnius', 'NR' => 'Wellington', 'NP' => 'Kathmandu', 'NL' => 'Zagreb', 'AN' => 'Santiago', 'NC' => 'Vladivostok', 'NZ' => 'Nuku\'alofa', 'NI' => 'Saskatchewan', 'NE' => 'Zagreb', 'NG' => 'Zagreb', 'NU' => 'Samoa', 'MP' => 'Yakutsk', 'NO' => 'Zagreb', 'OM' => 'Yerevan', 'PK' => 'Tashkent', 'PW' => 'Tokyo', 'PS' => 'Vilnius', 'PA' => 'Quito', 'PG' => 'Yakutsk', 'PY' => 'Greenland', 'PE' => 'Quito', 'PH' => 'Urumqi', 'PN' => 'Tijuana', 'PL' => 'Zagreb', 'PT' => 'Cape Verde Is.', 'PR' => 'Santiago', 'QA' => 'Riyadh', 'RE' => 'Yerevan', 'RO' => 'Vilnius', 'RU' => 'Wellington', 'RW' => 'Vilnius', 'BL' => 'Santiago', 'SH' => 'UTC', 'KN' => 'Santiago', 'LC' => 'Santiago', 'MF' => 'Santiago', 'PM' => 'Greenland', 'VC' => 'Santiago', 'WS' => 'Samoa', 'SM' => 'Zagreb', 'ST' => 'UTC', 'SA' => 'Riyadh', 'SN' => 'UTC', 'RS' => 'Zagreb', 'SC' => 'Yerevan', 'SL' => 'UTC', 'SG' => 'Urumqi', 'SK' => 'Zagreb', 'SI' => 'Zagreb', 'SB' => 'Vladivostok', 'SO' => 'Riyadh', 'ZA' => 'Vilnius', 'GS' => 'Mid-Atlantic', 'ES' => 'Zagreb', 'LK' => 'Sri Jayawardenepura', 'SD' => 'Riyadh', 'SR' => 'Greenland', 'SJ' => 'Zagreb', 'SZ' => 'Vilnius', 'SE' => 'Zagreb', 'CH' => 'Zagreb', 'SY' => 'Vilnius', 'TW' => 'Urumqi', 'TJ' => 'Tashkent', 'TZ' => 'Riyadh', 'TH' => 'Novosibirsk', 'TL' => 'Tokyo', 'TG' => 'UTC', 'TK' => 'Hawaii', 'TO' => 'Nuku\'alofa', 'TT' => 'Santiago', 'TN' => 'Zagreb', 'TR' => 'Vilnius', 'TM' => 'Tashkent', 'TC' => 'Quito', 'TV' => 'Wellington', 'UG' => 'Riyadh', 'UA' => 'Vilnius', 'AE' => 'Yerevan', 'GB' => 'UTC', 'US' => 'Saskatchewan', 'UM' => 'Hawaii', 'UY' => 'Mid-Atlantic', 'UZ' => 'Tashkent', 'VU' => 'Vladivostok', 'VE' => 'Caracas', 'VN' => 'Novosibirsk', 'VG' => 'Santiago', 'VI' => 'Santiago', 'WF' => 'Wellington', 'EH' => 'UTC', 'YE' => 'Riyadh', 'ZM' => 'Vilnius', 'ZW' => 'Vilnius' );
  17. private $version = '2.3.x.20120313';
  18. private $ajaxLoadValues = true;
  19. var $featurepage = 'http://hostbillapp.com/features/apps/onapp.html#cloudhosting';
  20. var $download_yml = 'http://hostbillapp.com/features/apps/onapp.html#dwd';
  21. private $description = 'OnApp 2.3.x cloud control module - use with OnApp cloud product types. Learn more about this integration on http://hostbillapp.com/features/apps/onapp.html';
  22. var $serverTemplates = array( );
  23. private $import_type = '2';
  24. private $serverFieldsDescription = array( 'field1' => 'Primary network ID', 'field2' => '<em>(optional) Username prefix</em>' );
  25. private $serverFields = array( 'ssl' => true, 'maxaccounts' => false, 'status_url' => false, 'field1' => false, 'field2' => true );
  26. private $old_server_id = false;
  27. private $dzones = array( );
  28. private $vm_details = array( );
  29. private $lang = array( 'english' => array( 'OnAPPuser_role' => 'User Role', 'OnAPPbilling_group' => 'Billing Group', 'OnAPPmem_limit' => 'Memory Limit [MB]', 'OnAPPcpu_limit' => 'CPU Limit', 'OnAPPcpu_share' => 'CPU Shares [%]', 'OnAPPdisk_size' => 'Disk Size [GB]', 'OnAPPhypervisor' => 'Hypervisor', 'OnAPPnetwork' => 'Primary Network', 'OnAPPpspeed' => 'Port Speed (Rate)', 'OnAPPprovtype' => 'Provisioning type', 'OnAPPonapplogin' => 'Show link to OnApp backend', 'OnAPPost' => 'OS Template', 'OnAPPiplimit' => 'IP Address count', 'OnAPPvmlimit' => 'Max Virtual Machines', 'OnAPPbtlimit' => 'Backups/Templates', 'OnAPPbwlimit' => 'Data sent /hour [GB]', 'OnAPPbwlimit_in' => 'Data received /hour [GB]', 'OnAPPbupspace' => 'Backup space [GB]', 'OnAPPautoscale' => 'Show autoscale options', 'OnAPPcrtype' => 'Signups of current client' ) );
  30. private $options = array( 'option10' => array( 'name' => 'provtype', 'value' => 'Multiple Machines, full management', 'type' => 'select', 'default' => array( 0 => 'Multiple Machines, full management', 1 => 'Single Machine, autocreation' ) ), 'option1' => array( 'name' => 'user_role', 'value' => false, 'type' => 'input', 'default' => 'getUserRoles' ), 'option3' => array( 'name' => 'mem_limit', 'value' => false, 'type' => 'input', 'variable' => 'memory', 'description' => 'Slider available: <a href="http://hostbillapp.com/fastconfig/forms/#onapp" target="_blank">learn more</a>' ), 'option4' => array( 'name' => 'cpu_limit', 'value' => false, 'type' => 'input', 'variable' => 'cpu', 'description' => 'Slider available: <a href="http://hostbillapp.com/fastconfig/forms/#onapp" target="_blank">learn more</a>' ), 'option5' => array( 'name' => 'cpu_share', 'value' => false, 'type' => 'input', 'variable' => 'cpu_share', 'description' => 'Slider available: <a href="http://hostbillapp.com/fastconfig/forms/#onapp" target="_blank">learn more</a>' ), 'option6' => array( 'name' => 'disk_size', 'value' => false, 'type' => 'input', 'variable' => 'disk_size', 'description' => 'Slider available: <a href="http://hostbillapp.com/fastconfig/forms/#onapp" target="_blank">learn more</a>' ), 'option9' => array( 'name' => 'pspeed', 'value' => false, 'type' => 'input', 'variable' => 'rate', 'description' => 'Slider available: <a href="http://hostbillapp.com/fastconfig/forms/#onapp" target="_blank">learn more</a>' ), 'option13' => array( 'name' => 'iplimit', 'value' => '1', 'type' => 'input', 'description' => 'Slider available: <a href="http://hostbillapp.com/fastconfig/forms/#onapp" target="_blank">learn more</a>', 'variable' => 'ip_address', 'default' => '1' ), 'option14' => array( 'name' => 'vmlimit', 'value' => '1', 'type' => 'input', 'default' => '1' ), 'option15' => array( 'name' => 'btlimit', 'value' => '1', 'type' => 'input', 'default' => '1' ), 'option16' => array( 'name' => 'bwlimit', 'value' => '', 'type' => 'input', 'default' => '', 'description' => 'Slider available: <a href="http://hostbillapp.com/fastconfig/forms/#onapp" target="_blank">learn more</a>', 'variable' => 'datasent' ), 'option18' => array( 'name' => 'bwlimit_in', 'value' => '', 'type' => 'input', 'default' => '' ), 'option17' => array( 'name' => 'bupspace', 'value' => '0', 'description' => 'Slider available: <a href="http://hostbillapp.com/fastconfig/forms/#onapp" target="_blank">learn more</a>', 'variable' => 'storage_disk_size', 'type' => 'input', 'default' => '0' ), 'option12' => array( 'name' => 'ost', 'value' => '', 'type' => 'input', 'variable' => 'os', 'description' => 'Allow to choose by client using <a href="#" onclick="$(\'#loadostemplates\').click();">Forms:Os</a>', 'default' => 'getOSTemplates' ), 'option19' => array( 'name' => 'autoscale', 'value' => 'No', 'type' => 'select', 'default' => array( 0 => 'Yes', 1 => 'No' ) ), 'option11' => array( 'name' => 'onapplogin', 'value' => 'No', 'type' => 'select', 'default' => array( 0 => 'No', 1 => 'Yes' ) ), 'option20' => array( 'name' => 'templateset', 'value' => array( 0 => 'All' ), 'type' => 'select', 'default' => array( 0 => 'All' ) ), 'option21' => array( 'name' => 'datastorezone', 'value' => array( 0 => 'Auto-Assign' ), 'type' => 'select', 'default' => array( 0 => 'Auto-Assign' ) ), 'option24' => array( 'name' => 'datastorezoneswap', 'value' => array( 0 => 'Auto-Assign' ), 'type' => 'select', 'default' => array( 0 => 'Auto-Assign' ) ), 'option22' => array( 'name' => 'networkzone', 'value' => array( 0 => 'Auto-Assign' ), 'type' => 'select', 'default' => array( 0 => 'Auto-Assign' ) ), 'option23' => array( 'name' => 'hypervisorzone', 'variable' => 'hypervisorzone', 'value' => array( 0 => 'Auto-Assign' ), 'type' => 'select', 'default' => array( 0 => 'Auto-Assign' ) ), 'option25' => array( 'name' => 'autoresizestorage', 'value' => '1', 'type' => 'check', 'default' => '1' ) );
  31. private $details = array( 'option1' => array( 'name' => 'username', 'value' => false, 'type' => 'input', 'default' => false ), 'option4' => array( 'name' => 'domain', 'value' => false, 'type' => 'input', 'default' => false ), 'option2' => array( 'name' => 'password', 'value' => false, 'type' => 'input', 'default' => false ), 'option6' => array( 'name' => 'user-id', 'value' => false, 'type' => 'hidden', 'default' => false ), 'option5' => array( 'name' => 'rootpassword', 'value' => false, 'type' => 'hidden', 'default' => false ), 'option7' => array( 'name' => 'access_token', 'value' => false, 'type' => 'hidden', 'default' => false ), 'option8' => array( 'name' => 'email', 'value' => false, 'type' => 'hidden', 'default' => false ) );
  32. private $commands = array( 0 => 'Suspend', 1 => 'Terminate', 2 => 'Create', 3 => 'Unsuspend', 4 => 'ChangePackage' );
  33. private $clientCommands = array( 0 => 'MyVMs', 1 => 'CreateVM', 2 => 'FastStat', 3 => 'PowerON', 4 => 'PowerOFF', 5 => 'Destroy', 6 => 'RebuildOS', 7 => 'VMDetails', 8 => 'Reboot' );
  34. private $url = null;
  35. private $username = null;
  36. private $admin_username = null;
  37. private $password = null;
  38. private $admin_password = null;
  39. private $connect_data = null;
  40. private $required_user_permissions = array( 0 => 'backups.convert.own', 1 => 'backups.create.own', 2 => 'backups.delete.own', 3 => 'backups.read.own', 4 => 'backups.update.own', 5 => 'data_stores.read', 6 => 'disks.autobackup.own', 7 => 'disks.create', 8 => 'disks.delete.own', 9 => 'disks.read.own', 10 => 'disks.update.own', 11 => 'ip_address_joins.create.own', 12 => 'ip_address_joins.delete.own', 13 => 'ip_addresses.read', 14 => 'iso_joins.create.own', 15 => 'iso_joins.delete.own', 16 => 'iso_joins.read.own', 17 => 'isos.manage.own', 18 => 'log_items.delete.own', 19 => 'log_items.list.own', 20 => 'log_items.read.own', 21 => 'nameservers.read', 22 => 'networks.read', 23 => 'payments.read', 24 => 'payments.read.own', 25 => 'resource_limits.read.own', 26 => 'roles.read', 27 => 'templates.manage.own', 28 => 'transactions.delete.own', 29 => 'transactions.list.own', 30 => 'transactions.read.own', 31 => 'users.read.own', 32 => 'users.update.own', 33 => 'virtual_machines.console.own', 34 => 'virtual_machines.create', 35 => 'virtual_machines.delete.own', 36 => 'virtual_machines.migrate.own', 37 => 'virtual_machines.power.own', 38 => 'virtual_machines.read.own', 39 => 'users.update_api_key.own', 40 => 'virtual_machines.reset_root_password.own', 41 => 'virtual_machines.update.own', 42 => 'vm_stats.read.own', 43 => 'io_stats.read.own', 44 => 'users.read_prices.billing_plan', 45 => 'users.read_prices.outstanding_amount', 46 => 'users.read_prices.summary_payments', 47 => 'users.read_prices.hourly_price', 48 => 'users.read_prices.monthly_price', 49 => 'users.read_prices.vm_prices', 50 => 'users.read_prices.backups_templates', 51 => 'firewall_rules.read.own', 52 => 'firewall_rules.create.own', 53 => 'firewall_rules.update.own', 54 => 'firewall_rules.delete.own', 55 => 'users.change_password.own', 56 => 'ip_address_joins.read.own', 57 => 'load_balancing_clusters.create', 58 => 'load_balancing_clusters.read.own', 59 => 'load_balancing_clusters.update.own' );
  41.  
  42. function install() {
  43. $f = array( '2.3.x.20111122', '2.3.x.20111204', '2.3.x.20111218', '2.3.x.20111226' );
  44. $old = $this->version;
  45. foreach ($f as $v) {
  46. $this->version = $v;
  47. $this->upgrade( $v );
  48. }
  49.  
  50. $this->version = $old;
  51. return true;
  52. }
  53.  
  54. function upgrade($old_version) {
  55. $old_version = explode( '.', $old_version );
  56. $old_version = array_pop( $old_version );
  57.  
  58. if ($old_version <= 20111201) {
  59. $this->db->exec( '
  60. INSERT INTO `hb_email_templates` (`id`, `tplname`, `group`, `for`, `language_id`, `subject`, `message`, `send`, `plain`, `system`, `hidden`) VALUES
  61. (\'\', \'OnApp: Metered Billing Admin Report\', \'Custom\', \'Client\', 1, \'OnApp Metered Billing Report for {$product.name}\', \' {literal} <style type="text/css"> .usetable td, .usetable th{ border:1px solid #C3C3C3; padding:5px; text-align:left; } .usetable, .info { font-size:12px; } .info { padding-top:10px; width:500px; text-align:justify; } .usetable th { background: #E9E9E9; } .dateseparate { background:#F4F4F4; } </style> {/literal} <h2>HostBill Metered billing usage report {$date_from|dateformat:$date_format} - {$date_to|dateformat:$date_format}</h2> <b>Package: {$product.name}</b> <br/> <table cellspacing="0" cellpadding="3" style="border-collapse: collapse;" class="usetable"> <thead> <th width="150"></th> {foreach from=$variables item=variab} <th width="120">{$variab.name}</th> {/foreach} <th>Daily cost</th> </thead> <tbody> {if !$report} <tr><td colspan="{$colspan}">No data found</td></td> {else} {foreach from=$report item=row key=d} <tr> <td colspan="{$colspan}" class="dateseparate">{$d|dateformat:$date_format}:</td> </tr> {foreach from=$row item=acc key=accid} <tr> <td>Account #<a href="{$admin_url}/index.php?cmd=accounts&action=edit&id={$accid}">{$accid}</a><br>Username: {$accounts[$accid].username}</td> {foreach from=$variables item=variab key=vr} <td>Avg: {$acc[$vr].use} {$variab.unit_name}<br>Price: {$acc[$vr].price|price:$currency}</td> {/foreach} <td>{$acc.dailycharge|price:$currency}</td> </tr> {/foreach} {/foreach} {/if} </tbody> </table> <br/> <div class="info"> <b>Legend</b><br/> {foreach from=$variables item=vr}<b><em>{$vr.name}</em></b> - {$vr.description} <br/> {/foreach} </div> <div class="info"> <b>How to read this report?</b><br/> Variables listed in columns are configured in related package (<em>#{$product.id} - {$product.name}</em>) metered pricing table. Usage is automatically synced with OnApp every hour. Table above represent daily average usage of each measured variable across all accounts, since last generated admin report ({$date_from|dateformat:$date_format}). To get detailed hourly usage visit account details section in HostBill adminarea and proceed to "Metered Billing" tab. </div> \', 1, 1, 0, 0);
  62. ' );
  63. $this->db->exec( 'INSERT INTO `hb_email_templates` (`id`, `tplname`, `group`, `for`, `language_id`, `subject`, `message`, `send`, `plain`, `system`, `hidden`) VALUES
  64. (\'\', \'OnApp: Metered Billing Client Report\', \'Custom\', \'Client\', 1, \'Usage report {$product.name}\', \' {literal} <style type="text/css"> .usetable td, .usetable th{ border:1px solid #C3C3C3; padding:5px; text-align:left; } .usetable, .info { font-size:12px; } .info { padding-top:10px; width:500px; text-align:justify; } .usetable th { background: #E9E9E9; } .dateseparate { background:#F4F4F4; } </style> {/literal} <h2>Usage report for {$product.name}, generated at {$date_created|dateformat:$date_format}</h2> <div class="info">This is detailed usage rerport to recently generated invoice for service: {$product.name}</div> <br/> <table cellspacing="0" cellpadding="3" style="border-collapse: collapse;" class="usetable"> <thead> <th width="150"></th> {foreach from=$variables item=variab} <th width="120">{$variab.name}</th> {/foreach} <th>Daily cost</th> </thead> <tbody> {if !$report.usage} <tr><td colspan="{$colspan}">No data found</td></td> {else} {foreach from=$report.usage item=row key=d} <tr> <td>{$d|dateformat:$date_format}</td> {foreach from=$variables item=variab key=vr} <td>Avg: {$row[$vr].use} {$variab.unit_name}<br>Price: {$row[$vr].price|price:$currency}</td> {/foreach} <td>{$row.dailycharge|price:$currency}</td> </tr> {/foreach} <thead> <th >Total</th> {foreach from=$variables item=variab key=vr} <th>{$summary[$variab.id].charge|price:$currency}</th> {/foreach} <th>{$metered_total|price:$currency}</th> </thead> {/if} </tbody> </table> <br/> <div class="info"> <b>Legend</b><br/> {foreach from=$variables item=vr}<b><em>{$vr.name}</em></b> - {$vr.description} <br/>{/foreach} </div> <div class="info"> <b>How to read this report?</b><br/> Variables listed in columns are configured were measured hourly throughout entire billing period. The table above represent daily average usage of each measured variable. Invoice may contain additional fixed recurring fee to coverage operational/non-measurable costs. </div> \', 1, 1, 0, 0);
  65. ' );
  66. $this->db->exec( '
  67. CREATE TABLE IF NOT EXISTS `hb_onapp_map` (
  68. `server_id` int(11) NOT NULL,
  69. `type` enum(\'hv\',\'disk\',\'network\',\'role\',\'os\',\'osgroup\') NOT NULL default \'hv\',
  70. `onapp_id` int(11) NOT NULL,
  71. `onapp_name` varchar(128) NOT NULL,
  72. PRIMARY KEY (`server_id`,`type`,`onapp_id`),
  73. KEY `onapp_name` (`onapp_name`)
  74. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  75. ' );
  76. }
  77.  
  78.  
  79. if ($old_version < 20111205) {
  80. $keywords = array( 'server_performing_task' => 'Server is performing task,', 'refresh' => 'refresh', 'console' => 'Console', 'reboot' => 'Reboot', 'rebuild' => 'Rebuild', 'reboot_recovery' => 'Are you sure you wish to reboot in recovery mode? Please note: in recovery mode the login is (root) and the password is (recovery)', 'start_recovery' => 'Are you sure you wish to power ON in recovery mode? Please note: in recovery mode the login is (root) and the password is (recovery)', 'recovery' => 'Recovery', 'scale' => 'Scale', 'upgrade1' => 'Upgrade', 'cancelvps' => 'Cancel VPS', 'scalevm' => 'Scale VM', 'autoscaling' => 'Autoscaling', 'ifmemory' => 'if memory usage', 'isabove' => 'is above', 'scaleadd' => 'add', 'scaleupto' => 'up to', 'ifcpu' => 'if CPU usage', 'scalefor' => 'for', 'ifdisk' => ' if disk usage', 'scaleapply' => 'Apply', 'minutes' => 'minutes', 'per24h' => 'per 24h', 'Disk' => 'Disk', 'Built' => 'Built', 'notbuilt' => 'not built yet', 'nextinvoicedetails' => 'Next invoice details', 'Totaldue' => 'Total due', 'usagedetails' => 'Usage details', 'entermonth' => 'Month (yyyy-mm):', 'onehour' => '1 Hour', 'oneday' => '1 Day', 'Interval' => 'Interval:', 'perhour' => 'Per Hour', 'createnewserver' => 'Create new server', 'availableresources' => 'Available resources:', 'storage' => 'Storage', 'cpucores' => 'CPU Cores', 'cpuprio' => 'CPU Priority', 'Zone' => 'Zone', 'firstavailable' => 'First Available', 'osdistro' => 'Distribution', 'RAM' => 'RAM', 'swapdisk' => 'Swap Disk Size', 'priotitile' => 'Share percentage of CPU per 1 core', 'priceperhour' => 'Price per hour', 'swapdc' => 'Swap DC', 'storagedc' => 'Storage DC', 'networkzone' => 'Network', 'autoassign' => 'Assign Automatically', 'bwused' => 'Bandwidth used', 'servdetails' => 'Server details', 'updatedhourly' => 'Updated hourly', 'Autobackup' => 'Autobackup', 'standardpri' => 'Standard (primary)', 'swaplabel' => 'Swap', 'standardd' => 'Standard', 'locked' => 'Locked', 'orderextradisk' => 'Order extra disk space', 'diskconfirm1' => 'The virtual machine will be rebooted after any changes to Disk settings. Are you sure you want to continue?', 'cpuusage' => 'CPU Usage', 'networkusage' => 'Network Usage', 'uppckg' => 'Upgrade package', 'updownlabel' => 'Upgrade / Downgrade', 'upsinglenotice' => ' After automatic upgrade/downgrade your disk will be resized. Your virtual machine will be automatically restarted.<br/><b>Note:</b> Downgrading will automatically reduce your virtual machine resources, which may result in data loss!', 'upcloudnotice' => ' <b>Note:</b> To free more resources you can scale down your virtual machines in their overview section.', 'resuplabel' => 'Resource upgrades', 'backups' => 'Backups', 'disks' => 'Disks', 'reslabel' => 'Resources', 'resnotice' => ' Below you can find list of resources available. Use upgrade/downgrade option to scale them to your needs at any time.<br/>Note: To free more resources use "Scale" option in each server overview section.', 'Usage' => 'Usage', 'Totallabel' => 'Total', 'Leftlabel' => 'Left', 'ipcount' => 'IP Addresses', 'cloudlabel1' => 'Your cloud servers', 'diskspace' => 'Disk Space', 'nomachinesnote' => 'You dont have any Virtual Machines yet', 'addservernote' => 'Add new server', 'dateupdated' => 'Date updated', 'ordernewip' => 'Order IP Address', 'freeipleft' => 'free IPs left', 'freeipleft1' => 'You have', 'Firewall' => 'Firewall', 'networkspeed' => 'Network speed:', 'allservers' => 'All servers', 'Overview' => 'Overview', 'Billing' => 'Billing', 'ListServers' => 'List Servers' );
  81. $q = $this->db->prepare( 'REPLACE INTO `hb_language_locales` (`language_id`,`section`,`keyword`,`value`)
  82. SELECT id, \'onapp\', ?,? FROM hb_language WHERE target!=\'admin\';' );
  83. foreach ($keywords as $k => $v) {
  84. $q->execute( array( $k, $v ) );
  85. }
  86. }
  87.  
  88.  
  89. if ($old_version < 20111219) {
  90. $keywords = array( 'backupschedule' => 'Backup schedule', 'newschedule' => 'Create new schedule', 'backupevery' => 'Backup every', 'nextbackup' => 'Next backup', 'yweek' => 'week', 'ymonth' => 'month', 'yday' => 'day', 'yyear' => 'year', 'suretodeleteschedule' => 'Are you sure you wish to remove this backup schedule?' );
  91. $q = $this->db->prepare( 'REPLACE INTO `hb_language_locales` (`language_id`,`section`,`keyword`,`value`)
  92. SELECT id, \'onapp\', ?,? FROM hb_language WHERE target!=\'admin\';' );
  93. foreach ($keywords as $k => $v) {
  94. $q->execute( array( $k, $v ) );
  95. }
  96. }
  97.  
  98.  
  99. if ($old_version < 20111227) {
  100. $keywords = array( 'interfaces' => 'Interfaces', 'networkinterfaces' => 'Network Interfaces', 'interface' => 'Interface', 'portspeed' => 'Port Speed', 'primary' => 'Primary', 'addnewnetwork' => 'Add new network interface', 'vmrebootnote' => 'Note: any action on interface will reboot this virtual machine', 'suretoremoveinterface' => 'Are you sure you wish to remove this interface? Note: VM will be rebooted.', 'networkrebuildnote' => 'The following IP addresses are allocated to this virtual machine. When a machine is built, these will automatically be configured. However, if they are allocated after the machine had been built, you will need to additionally configure a network by yourself. To do this, click \'Rebuild Network\' button at the bottom of the page.', 'rebuildnetwork' => 'Rebuild Network', 'rebuildconfirm' => 'Are you sure? Note: VM will be rebooted.' );
  101. $q = $this->db->prepare( 'REPLACE INTO `hb_language_locales` (`language_id`,`section`,`keyword`,`value`)
  102. SELECT id, \'onapp\', ?,? FROM hb_language WHERE target!=\'admin\';' );
  103. foreach ($keywords as $k => $v) {
  104. $q->execute( array( $k, $v ) );
  105. }
  106. }
  107.  
  108.  
  109. if ($old_version < 20120309) {
  110. $keywords = array( 'templates' => 'OS Templates', 'parent_template' => 'Parent template', 'suretodeletetemplate' => 'Are you sure you wish to remove this template?' );
  111. $q = $this->db->prepare( 'REPLACE INTO `hb_language_locales` (`language_id`,`section`,`keyword`,`value`)
  112. SELECT id, \'onapp\', ?,? FROM hb_language WHERE target!=\'admin\';' );
  113. foreach ($keywords as $k => $v) {
  114. $q->execute( array( $k, $v ) );
  115. }
  116. }
  117.  
  118.  
  119. if ($old_version < 20120313) {
  120. $this->db->exec( 'ALTER TABLE `hb_onapp_map` ENGINE=InnoDB;' );
  121. Exception {
  122. $this->db->exec( '
  123. CREATE TABLE IF NOT EXISTS `hb_onapp_map` (
  124. `server_id` int(11) NOT NULL,
  125. `type` enum(\'hv\',\'disk\',\'network\',\'role\',\'os\',\'osgroup\') NOT NULL default \'hv\',
  126. `onapp_id` int(11) NOT NULL,
  127. `onapp_name` varchar(128) NOT NULL,
  128. PRIMARY KEY (`server_id`,`type`,`onapp_id`),
  129. KEY `onapp_name` (`onapp_name`)
  130. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  131. ' );
  132. }
  133. }
  134.  
  135. }
  136.  
  137. ...........................................................................
  138. ...........................................
  139. ............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement