Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by http://DeZender.Net
- * @ deZender (PHP5 Decoder for ionCube Encoder)
- *
- * @ Version : 3.0.8.0
- * @ Author : DeZender
- * @ Release on : 25.09.2017
- * @ Official site : http://DeZender.Net
- *
- */
- class OpenStack
- {
- const TYPE_CLOUD = 'Multiple Machines, full management';
- const TYPE_VPS = 'Single Machine, autocreation';
- const O_TYPE = 'option10';
- const O_OS = 'option12';
- const O_FLAVOR = 'option11';
- const O_FLAVORS = 'option31';
- const O_LIMIT_MEMORY = 'option3';
- const O_LIMIT_CPU = 'option4';
- const O_LIMIT_DISK = 'option6';
- const O_LIMIT_VM = 'option14';
- const O_LIMIT_VOLUME = 'option16';
- const O_LIMIT_VOLUME_SIZE = 'maxvolumesize';
- const O_LIMIT_SNAPSHOT = 'option17';
- const O_LIMIT_IP = 'option13';
- const O_FLOATING_IP_POOL = 'option22';
- const O_AUTH_RESET = 'passworddisabled';
- const O_AUTH_TYPE = 'vmauth';
- const O_NEUTRON = 'neutron';
- const O_NEUTRON_NETWORKS = 'neutron_networks';
- const O_NEUTRON_PORTS = 'neutron_ports';
- const O_NEUTRON_DNS = 'neutron_dns';
- const O_NEUTRON_ROUTERS = 'neutron_routers';
- const O_NEUTRON_SUBNETS = 'neutron_subnets';
- const O_NEUTRON_CIDR = 'neutron_cidr';
- const O_USER_DATA = 'user_data';
- const O_SUSPEND_VMS = 'suspendvms';
- const O_STORAGE_TYPES = 'storagetypes';
- const O_STORAGE_UPGRADES = 'storagepurchase';
- const O_MEMORY_UNIT = 'memory_unit';
- protected $username_prefix = 'hb_client_';
- protected $description = 'OpenStack cloud management module for HostBill. <br/><b>Requires PHP 5.3+</b>';
- protected $_repository = 'hosting_openstack2';
- protected $version = '2.20180314';
- protected $serverFieldsDescription = array(
- 'field1' => 'Port (default 5000)',
- 'field2' => 'Admin tenant name'
- );
- protected $serverFields = array(
- 'ssl' => true,
- 'maxaccounts' => false,
- 'status_url' => false,
- 'ns' => false,
- 'nameservers' => false,
- 'field1' => true,
- 'field2' => true
- );
- protected $url = null;
- protected $admin_username = null;
- protected $admin_password = null;
- protected $admin_tenant = null;
- protected $connect_data = null;
- /**
- *
- * @var \OpenCloud\OpenStack
- */
- private $admin_api = null;
- /**
- *
- * @var \OpenCloud\OpenStack
- */
- private $client_api = null;
- protected $cache = array( );
- protected $loghandle = array( );
- protected $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
- ),
- 'option7' => array(
- 'name' => 'user_id',
- 'value' => false,
- 'type' => 'hidden',
- 'default' => false
- ),
- 'option6' => array(
- 'name' => 'tenant_id',
- 'value' => false,
- 'type' => 'hidden',
- 'default' => false
- ),
- 'option5' => array(
- 'name' => 'rootpassword',
- 'value' => false,
- 'type' => 'hidden',
- 'default' => false
- ),
- 'version' => array(
- 'name' => 'Account version',
- 'value' => false,
- 'type' => 'hidden',
- 'default' => false
- )
- );
- protected $options = array(
- self::O_TYPE => array(
- 'value' => self::TYPE_CLOUD,
- 'default' => array(
- un-handled kind in zend_ast => self::TYPE_CLOUD,
- un-handled kind in zend_ast => self::TYPE_VPS
- )
- ),
- self::O_OS => array(
- 'name' => 'ostemplate',
- 'variable' => 'os'
- ),
- self::O_FLAVOR => array( 'name' => 'flavor' ),
- self::O_FLAVORS => array( 'name' => 'flavors' ),
- self::O_LIMIT_MEMORY => array(
- 'name' => 'ram',
- 'variable' => 'memory'
- ),
- self::O_LIMIT_CPU => array(
- 'name' => 'cpu_limit',
- 'variable' => 'cpu'
- ),
- self::O_LIMIT_DISK => array(
- 'name' => 'disk_size',
- 'variable' => 'disk_size'
- ),
- self::O_LIMIT_VM => array( 'name' => 'vmlimit' ),
- self::O_LIMIT_VOLUME => array( 'name' => 'vollimit' ),
- self::O_STORAGE_TYPES => array( 'name' => self::O_STORAGE_TYPES ),
- self::O_STORAGE_UPGRADES => array( 'name' => self::O_STORAGE_UPGRADES ),
- self::O_LIMIT_VOLUME_SIZE => array( 'name' => self::O_LIMIT_VOLUME_SIZE ),
- self::O_LIMIT_SNAPSHOT => array( 'name' => 'snapshotlimit' ),
- self::O_LIMIT_IP => array(
- 'name' => 'iplimit',
- 'variable' => 'ip_address'
- ),
- self::O_FLOATING_IP_POOL => array( 'name' => 'floatingippool' ),
- self::O_AUTH_RESET => array( 'name' => 'passworddisabled' ),
- self::O_AUTH_TYPE => array( 'name' => 'vmauth' ),
- self::O_NEUTRON => array( 'name' => 'neutron' ),
- self::O_NEUTRON_NETWORKS => array( 'name' => 'neutron_networks' ),
- self::O_NEUTRON_PORTS => array( 'name' => 'neutron_ports' ),
- self::O_NEUTRON_DNS => array( 'name' => 'neutron_dns' ),
- self::O_NEUTRON_ROUTERS => array( 'name' => 'neutron_routers' ),
- self::O_NEUTRON_SUBNETS => array( 'name' => 'neutron_subnets' ),
- self::O_NEUTRON_CIDR => array(
- 'name' => 'neutron_cidr',
- 'default' => '192.168.2.0/24'
- ),
- self::O_USER_DATA => array(
- 'name' => 'user_data',
- 'default' => ''
- ),
- self::O_SUSPEND_VMS => array( 'name' => self::O_SUSPEND_VMS ),
- self::O_MEMORY_UNIT => array( 'value' => '1' )
- );
- public function __construct()
- {
- parent::__construct( );
- }
- public function upgrade($old_version)
- {
- $old = end( explode( '.', $old_version ) );
- if ((int) $old < 150323) {
- $this->info['havecron'] = true;
- $managemod = HBLoader::LoadModel( 'Managemodules' );
- $managemod->installCron( $this->getModuleId( ), $this );
- }
- }
- public function _log($level, $line, $data = array( ))
- {
- foreach ($this->loghandle as $callback) {
- call_user_func( $callback, $level, $line, (array) $data );
- }
- }
- public function testConnection(&$loghandle)
- {
- try {
- $this->loghandle[] = $loghandle;
- $v2 = false;
- $api2 = $this->api( );
- $api2->_timeout( 5 );
- $versions = $api2->identity->versions( );
- ............................................................................
- ..............................................
- .......................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement