Advertisement
Guest User

Untitled

a guest
Jun 9th, 2018
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.36 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 3.0.8.0
  8. * @ Author : DeZender
  9. * @ Release on : 25.09.2017
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. class OpenStack
  15. {
  16. const TYPE_CLOUD = 'Multiple Machines, full management';
  17. const TYPE_VPS = 'Single Machine, autocreation';
  18. const O_TYPE = 'option10';
  19. const O_OS = 'option12';
  20. const O_FLAVOR = 'option11';
  21. const O_FLAVORS = 'option31';
  22. const O_LIMIT_MEMORY = 'option3';
  23. const O_LIMIT_CPU = 'option4';
  24. const O_LIMIT_DISK = 'option6';
  25. const O_LIMIT_VM = 'option14';
  26. const O_LIMIT_VOLUME = 'option16';
  27. const O_LIMIT_VOLUME_SIZE = 'maxvolumesize';
  28. const O_LIMIT_SNAPSHOT = 'option17';
  29. const O_LIMIT_IP = 'option13';
  30. const O_FLOATING_IP_POOL = 'option22';
  31. const O_AUTH_RESET = 'passworddisabled';
  32. const O_AUTH_TYPE = 'vmauth';
  33. const O_NEUTRON = 'neutron';
  34. const O_NEUTRON_NETWORKS = 'neutron_networks';
  35. const O_NEUTRON_PORTS = 'neutron_ports';
  36. const O_NEUTRON_DNS = 'neutron_dns';
  37. const O_NEUTRON_ROUTERS = 'neutron_routers';
  38. const O_NEUTRON_SUBNETS = 'neutron_subnets';
  39. const O_NEUTRON_CIDR = 'neutron_cidr';
  40. const O_USER_DATA = 'user_data';
  41. const O_SUSPEND_VMS = 'suspendvms';
  42. const O_STORAGE_TYPES = 'storagetypes';
  43. const O_STORAGE_UPGRADES = 'storagepurchase';
  44. const O_MEMORY_UNIT = 'memory_unit';
  45.  
  46. protected $username_prefix = 'hb_client_';
  47. protected $description = 'OpenStack cloud management module for HostBill. <br/><b>Requires PHP 5.3+</b>';
  48. protected $_repository = 'hosting_openstack2';
  49. protected $version = '2.20180314';
  50. protected $serverFieldsDescription = array(
  51. 'field1' => 'Port (default 5000)',
  52. 'field2' => 'Admin tenant name'
  53. );
  54. protected $serverFields = array(
  55. 'ssl' => true,
  56. 'maxaccounts' => false,
  57. 'status_url' => false,
  58. 'ns' => false,
  59. 'nameservers' => false,
  60. 'field1' => true,
  61. 'field2' => true
  62. );
  63. protected $url = null;
  64. protected $admin_username = null;
  65. protected $admin_password = null;
  66. protected $admin_tenant = null;
  67. protected $connect_data = null;
  68. /**
  69. *
  70. * @var \OpenCloud\OpenStack
  71. */
  72. private $admin_api = null;
  73. /**
  74. *
  75. * @var \OpenCloud\OpenStack
  76. */
  77. private $client_api = null;
  78. protected $cache = array( );
  79. protected $loghandle = array( );
  80. protected $details = array(
  81. 'option1' => array(
  82. 'name' => 'username',
  83. 'value' => false,
  84. 'type' => 'input',
  85. 'default' => false
  86. ),
  87. 'option4' => array(
  88. 'name' => 'domain',
  89. 'value' => false,
  90. 'type' => 'input',
  91. 'default' => false
  92. ),
  93. 'option2' => array(
  94. 'name' => 'password',
  95. 'value' => false,
  96. 'type' => 'input',
  97. 'default' => false
  98. ),
  99. 'option7' => array(
  100. 'name' => 'user_id',
  101. 'value' => false,
  102. 'type' => 'hidden',
  103. 'default' => false
  104. ),
  105. 'option6' => array(
  106. 'name' => 'tenant_id',
  107. 'value' => false,
  108. 'type' => 'hidden',
  109. 'default' => false
  110. ),
  111. 'option5' => array(
  112. 'name' => 'rootpassword',
  113. 'value' => false,
  114. 'type' => 'hidden',
  115. 'default' => false
  116. ),
  117. 'version' => array(
  118. 'name' => 'Account version',
  119. 'value' => false,
  120. 'type' => 'hidden',
  121. 'default' => false
  122. )
  123. );
  124. protected $options = array(
  125. self::O_TYPE => array(
  126. 'value' => self::TYPE_CLOUD,
  127. 'default' => array(
  128. un-handled kind in zend_ast => self::TYPE_CLOUD,
  129. un-handled kind in zend_ast => self::TYPE_VPS
  130. )
  131. ),
  132. self::O_OS => array(
  133. 'name' => 'ostemplate',
  134. 'variable' => 'os'
  135. ),
  136. self::O_FLAVOR => array( 'name' => 'flavor' ),
  137. self::O_FLAVORS => array( 'name' => 'flavors' ),
  138. self::O_LIMIT_MEMORY => array(
  139. 'name' => 'ram',
  140. 'variable' => 'memory'
  141. ),
  142. self::O_LIMIT_CPU => array(
  143. 'name' => 'cpu_limit',
  144. 'variable' => 'cpu'
  145. ),
  146. self::O_LIMIT_DISK => array(
  147. 'name' => 'disk_size',
  148. 'variable' => 'disk_size'
  149. ),
  150. self::O_LIMIT_VM => array( 'name' => 'vmlimit' ),
  151. self::O_LIMIT_VOLUME => array( 'name' => 'vollimit' ),
  152. self::O_STORAGE_TYPES => array( 'name' => self::O_STORAGE_TYPES ),
  153. self::O_STORAGE_UPGRADES => array( 'name' => self::O_STORAGE_UPGRADES ),
  154. self::O_LIMIT_VOLUME_SIZE => array( 'name' => self::O_LIMIT_VOLUME_SIZE ),
  155. self::O_LIMIT_SNAPSHOT => array( 'name' => 'snapshotlimit' ),
  156. self::O_LIMIT_IP => array(
  157. 'name' => 'iplimit',
  158. 'variable' => 'ip_address'
  159. ),
  160. self::O_FLOATING_IP_POOL => array( 'name' => 'floatingippool' ),
  161. self::O_AUTH_RESET => array( 'name' => 'passworddisabled' ),
  162. self::O_AUTH_TYPE => array( 'name' => 'vmauth' ),
  163. self::O_NEUTRON => array( 'name' => 'neutron' ),
  164. self::O_NEUTRON_NETWORKS => array( 'name' => 'neutron_networks' ),
  165. self::O_NEUTRON_PORTS => array( 'name' => 'neutron_ports' ),
  166. self::O_NEUTRON_DNS => array( 'name' => 'neutron_dns' ),
  167. self::O_NEUTRON_ROUTERS => array( 'name' => 'neutron_routers' ),
  168. self::O_NEUTRON_SUBNETS => array( 'name' => 'neutron_subnets' ),
  169. self::O_NEUTRON_CIDR => array(
  170. 'name' => 'neutron_cidr',
  171. 'default' => '192.168.2.0/24'
  172. ),
  173. self::O_USER_DATA => array(
  174. 'name' => 'user_data',
  175. 'default' => ''
  176. ),
  177. self::O_SUSPEND_VMS => array( 'name' => self::O_SUSPEND_VMS ),
  178. self::O_MEMORY_UNIT => array( 'value' => '1' )
  179. );
  180.  
  181. public function __construct()
  182. {
  183. parent::__construct( );
  184. }
  185.  
  186. public function upgrade($old_version)
  187. {
  188. $old = end( explode( '.', $old_version ) );
  189.  
  190. if ((int) $old < 150323) {
  191. $this->info['havecron'] = true;
  192. $managemod = HBLoader::LoadModel( 'Managemodules' );
  193. $managemod->installCron( $this->getModuleId( ), $this );
  194. }
  195. }
  196.  
  197. public function _log($level, $line, $data = array( ))
  198. {
  199. foreach ($this->loghandle as $callback) {
  200. call_user_func( $callback, $level, $line, (array) $data );
  201. }
  202. }
  203.  
  204. public function testConnection(&$loghandle)
  205. {
  206. try {
  207. $this->loghandle[] = $loghandle;
  208. $v2 = false;
  209. $api2 = $this->api( );
  210. $api2->_timeout( 5 );
  211. $versions = $api2->identity->versions( );
  212. ............................................................................
  213. ..............................................
  214. .......................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement