log("OpenStack authentication URL: ".$authurl); $client = new OpenStack($authurl, array( 'username' => $user, 'password' => $password, 'tenantName' => $tenant )); $this->client = $client; if ($disablesslverify) { $client->setSslVerification(false); } else { if ($useservercerts) { $client->setConfig(array($client::SSL_CERT_AUTHORITY => false)); } else { $client->setSslVerification(UPDRAFTPLUS_DIR.'/includes/cacert.pem', true, 2); } } $client->authenticate(); if (empty($region)) { $catalog = $client->getCatalog(); if (!empty($catalog)) { $items = $catalog->getItems(); if (is_array($items)) { foreach ($items as $item) { $name = $item->getName(); $type = $item->getType(); if ('swift' != $name || 'object-store' != $type) continue; $eps = $item->getEndpoints(); if (!is_array($eps)) continue; foreach ($eps as $ep) { if (is_object($ep) && !empty($ep->region)) { $region = $ep->region; } } } } } } $this->region = $region; return $client->objectStoreService('swift', $region); } public function get_credentials() { return array('updraft_openstack'); } public function get_opts() { global $updraftplus; $opts = $updraftplus->get_job_option('updraft_openstack'); if (!is_array($opts)) $opts = array('user' => '', 'authurl' => '', 'password' => '', 'tenant' => '', 'path' => '', 'region' => ''); return $opts; } public function config_print_middlesection() { $opts = $this->get_opts(); ?>

">

:
: :
: : : stripslashes($posted_settings['user']), 'password' => stripslashes($posted_settings['password']), 'authurl' => stripslashes($posted_settings['authurl']), 'tenant' => stripslashes($posted_settings['tenant']), 'region' => (!empty($posted_settings['region'])) ? $posted_settings['region'] : '', ); $this->credentials_test_go($opts, stripslashes($posted_settings['path']), $posted_settings['useservercerts'], $posted_settings['disableverify']); } }