コード例 #1
0
ファイル: file.s3.php プロジェクト: kentonquatman/iofa
 private function _get_file_info()
 {
     if (empty($this->_file_info)) {
         $prefix = !empty($this->_source_settings->subfolder) ? rtrim($this->_source_settings->subfolder, '/') . '/' : '';
         $this->source->s3->setEndpoint($this->source->get_endpoint_by_location($this->_source_settings->location));
         $this->_file_info = (object) $this->source->s3->getObjectInfo($this->_source_settings->bucket, $prefix . $this->subpath);
     }
     return $this->_file_info;
 }
コード例 #2
0
ファイル: mcp.assets.php プロジェクト: kentonquatman/iofa
 /**
  * Get S3 buckets
  */
 public function get_s3_buckets()
 {
     if ($this->EE->session->userdata['group_id'] != 1) {
         $this->_forbidden();
     }
     $this->EE->load->library('table');
     $this->EE->load->helper('form_helper');
     $key_id = $this->EE->input->post('s3_access_key_id');
     $secret_key = $this->EE->input->post('s3_secret_access_key');
     $existing_source = $this->EE->input->post('source_id');
     $bucket_settings = array();
     // if source id is passed along, load the chosen settings for buckets
     if ($existing_source) {
         try {
             $source = $this->EE->assets_lib->instantiate_source_type((object) array('source_type' => 's3', 'source_id' => $existing_source));
         } catch (Exception $exception) {
             exit($exception->getMessage());
         }
         $bucket_settings = $source->settings();
     }
     require_once PATH_THIRD . 'assets/sources/s3/source.s3.php';
     $vars = array();
     try {
         // pass along the chosen settings (if any) for pre-selecting enabled buckets
         $vars['bucket_list'] = Assets_s3_source::get_bucket_list($key_id, $secret_key);
     } catch (Exception $exception) {
         exit($exception->getMessage());
     }
     // here, have some prefilled settings
     if (empty($bucket_settings) && !empty($vars['bucket_list'])) {
         $bucket_settings = reset($vars['bucket_list']);
     }
     $vars['source_settings'] = $bucket_settings;
     exit($this->EE->load->view('mcp/components/s3_buckets', $vars, TRUE));
 }