/** * Get file information. * * @return stdClass */ private function _get_file_info() { if (empty($this->_file_info)) { $prefix = isset($this->_source_settings->subpath) ? $this->_source_settings->subpath : ''; $this->_file_info = $this->source->get_object_info($prefix . $this->subpath); } return $this->_file_info; }
/** * Get Rackspace Cloud containers */ public function get_rs_containers() { if ($this->EE->session->userdata['group_id'] != 1) { $this->_forbidden(); } $this->EE->load->library('table'); $this->EE->load->helper('form_helper'); $username = $this->EE->input->post('rs_username'); $api_key = $this->EE->input->post('rs_api_key'); $region = $this->EE->input->post('rs_region'); $existing_source = $this->EE->input->post('source_id'); $container_settings = array(); // if source id is passed along, load the chosen settings for container if ($existing_source) { try { $source = $this->EE->assets_lib->instantiate_source_type((object) array('source_type' => 'rs', 'source_id' => $existing_source)); } catch (Exception $exception) { exit($exception->getMessage()); } $container_settings = $source->settings(); } require_once PATH_THIRD . 'assets/sources/rs/source.rs.php'; $vars = array(); try { // pass along the chosen settings (if any) for pre-selecting containers $settings = (object) array('username' => $username, 'api_key' => $api_key, 'region' => $region); $source = new Assets_rs_source($existing_source, $settings, true); $vars['container_list'] = $source->get_container_list(); } catch (Exception $exception) { exit($exception->getMessage()); } // here, have some prefilled settings if (empty($container_settings) && !empty($vars['container_list'])) { $container_settings = reset($vars['container_list']); } $vars['source_settings'] = $container_settings; exit($this->EE->load->view('mcp/components/rs_containers', $vars, TRUE)); }