Beispiel #1
0
    public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array()) {
        global $SESSION, $CFG, $DB, $PAGE;
        if (!is_numeric($repositoryid)) {
            // ELIS-8550: were constructing these with repositoryid = 'elisfiles'
            $sql = 'SELECT MIN(ri.id)
                      FROM {repository} r
                      JOIN {repository_instances} ri
                        ON r.id = ri.typeid
                     WHERE r.type = ?';
            $repositoryid = $DB->get_field_sql($sql, array($repositoryid));
        }
        parent::__construct($repositoryid, $context, $options);

        require_once dirname(__FILE__). '/ELIS_files_factory.class.php';

        if (is_object($context)) {
            $this->context = $context;
        } else {
            $this->context = context::instance_by_id($context);
        }

        /// ELIS files class
        $this->elis_files = repository_factory::factory();
        $this->config = get_config('elisfiles');
        $this->current_node = null;

        // jQuery files required for file picker - just for this repository
        $PAGE->requires->js('/repository/elisfiles/js/jquery-1.6.2.min.js');
        $PAGE->requires->js('/repository/elisfiles/js/jquery-ui-1.8.16.custom.min.js');
        $PAGE->requires->js('/repository/elisfiles/js/fileuploader.js');
        $PAGE->requires->js('/repository/elisfiles/lib/HTML_TreeMenu-1.2.0/TreeMenu.js', true);
    }
Beispiel #2
0
 /**
  * @param int $repositoryid
  * @param object $context
  * @param array $options
  */
 public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array())
 {
     global $CFG;
     parent::__construct($repositoryid, $context, $options);
     $this->file_url = optional_param('file', '', PARAM_RAW);
     $this->file_url = $this->escape_url($this->file_url);
 }
 public function __construct($repositoryid, $context = SITEID, $options = array())
 {
     global $SESSION, $CFG;
     parent::__construct($repositoryid, $context, $options);
     $this->sessname = 'alfresco_ticket_' . $this->id;
     if (class_exists('SoapClient')) {
         require_once $CFG->libdir . '/alfresco/Service/Repository.php';
         require_once $CFG->libdir . '/alfresco/Service/Session.php';
         require_once $CFG->libdir . '/alfresco/Service/SpacesStore.php';
         require_once $CFG->libdir . '/alfresco/Service/Node.php';
         // setup alfresco instance
         $this->instance = new Alfresco_Repository($this->options['alfresco_url']);
         $this->username = optional_param('al_username', '', PARAM_RAW);
         $this->password = optional_param('al_password', '', PARAM_RAW);
         try {
             // deal with user logging in
             if (empty($SESSION->{$this->sessname}) && !empty($this->username) && !empty($this->password)) {
                 $this->ticket = $this->instance->authenticate($this->username, $this->password);
                 $SESSION->{$this->sessname} = $this->ticket;
             } else {
                 if (!empty($SESSION->{$this->sessname})) {
                     $this->ticket = $SESSION->{$this->sessname};
                 }
             }
             $this->user_session = $this->instance->createSession($this->ticket);
             $this->store = new SpacesStore($this->user_session);
         } catch (Exception $e) {
             $this->logout();
         }
         $this->current_node = null;
     } else {
         $this->disabled = true;
     }
 }
Beispiel #4
0
 /**
  * Constructor
  * @param int $repositoryid
  * @param object $context
  * @param array $options
  */
 public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array())
 {
     global $CFG;
     parent::__construct($repositoryid, $context, $options);
     $this->access_key = get_config('s3', 'access_key');
     $this->secret_key = get_config('s3', 'secret_key');
     $this->endpoint = get_config('s3', 'endpoint');
     if ($this->endpoint === false) {
         // If no endpoint has been set, use the default.
         $this->endpoint = 's3.amazonaws.com';
     }
     $this->s = new S3($this->access_key, $this->secret_key, false, $this->endpoint);
     $this->s->setExceptions(true);
     // Port of curl::__construct().
     if (!empty($CFG->proxyhost)) {
         if (empty($CFG->proxyport)) {
             $proxyhost = $CFG->proxyhost;
         } else {
             $proxyhost = $CFG->proxyhost . ':' . $CFG->proxyport;
         }
         $proxytype = CURLPROXY_HTTP;
         $proxyuser = null;
         $proxypass = null;
         if (!empty($CFG->proxyuser) and !empty($CFG->proxypassword)) {
             $proxyuser = $CFG->proxyuser;
             $proxypass = $CFG->proxypassword;
         }
         if (!empty($CFG->proxytype) && $CFG->proxytype == 'SOCKS5') {
             $proxytype = CURLPROXY_SOCKS5;
         }
         $this->s->setProxy($proxyhost, $proxyuser, $proxypass, $proxytype);
     }
 }
 public function __construct($repositoryid, $context, array $options, $readonly)
 {
     global $SESSION, $PAGE;
     parent::__construct($repositoryid, $context, $options, $readonly);
     $this->config = get_config('entermedia');
     $PAGE->requires->js('/repository/entermedia/javascript/jquery.sumoselect.min.js');
     $PAGE->requires->yui_module('moodle-repository_entermedia-filepicker', 'M.repository_entermedia.filepicker.init');
     $PAGE->requires->strings_for_js(array('search_placeholder', 'search_selectall'), 'repository_entermedia');
     // Handle login
     if ($this->config->autologin_enable == 1) {
         $username = $this->config->autologin_user;
         $password = $this->config->autologin_password;
     } else {
         $username = optional_param('entermedia_username', '', PARAM_RAW);
         $password = optional_param('entermedia_password', '', PARAM_RAW);
     }
     try {
         if (empty($SESSION->entermediakey) && !empty($username) && !empty($password)) {
             $maybeKey = $this->try_login($username, $password);
             if ($maybeKey) {
                 $this->entermediakey = $SESSION->entermediakey = $maybeKey;
             } else {
                 // TODO Handle error
             }
         } else {
             if (!empty($SESSION->entermediakey)) {
                 $this->entermediakey = $SESSION->entermediakey;
             }
         }
     } catch (GuzzleException $e) {
         $this->logout();
     }
 }
 public function __construct($repositoryid = 9, $context = SYSCONTEXTID, $options = array(), $readonly = 0)
 {
     global $USER, $COURSE, $DB;
     $this->repositoryid = $repositoryid;
     $this->context = $context;
     $this->options = $options;
     $this->readonly = $readonly;
     $this->useremail = $COURSE->shortname . '@luther.edu';
     if (!($this->admin = get_config('morsle', 'google_admin'))) {
         throw new moodle_exception('Google admin not setup');
     }
     parent::__construct($this->repositoryid, $this->context, $this->options, $this->readonly);
     // days past last enrollment day that morsle resources are retained
     $this->expires = get_config('morsle', 'morsle_expiration') == 0 ? 600 * 24 * 60 * 60 : get_config('blocks/morsle', 'morsle_expiration') * 24 * 60 * 60;
     $this->curtime = time();
     // set basefeeds
     $this->user_auth = "https://www.googleapis.com/auth/admin.directory.user";
     $this->site_feed = "https://sites.google.com/feeds/site/{$this->domain}";
     $this->drive_auth = 'https://www.googleapis.com/auth/drive ';
     $this->file_auth = 'https://www.googleapis.com/auth/drive.file ';
     $this->alias_feed = "https://apps-apis.google.com/a/feeds/alias/2.0/{$this->domain}/?start=aaaarnold@luther.edu";
     $this->group_auth = 'https://www.googleapis.com/auth/admin.directory.group';
     $this->id_feed = 'https://docs.google.com/feeds/id/';
     $this->cal_auth = 'https://www.googleapis.com/auth/calendar';
     $this->owncalendars_feed = 'https://www.google.com/calendar/feeds/default/owncalendars/full';
     // skip marked for delete, unapproved and past term
     $this->disregard = "'Past Term','DELETED'";
 }
Beispiel #7
0
 /**
  * Constructor of dropbox plugin
  *
  * @param int $repositoryid
  * @param stdClass $context
  * @param array $options
  */
 public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array())
 {
     global $CFG;
     $options['page'] = optional_param('p', 1, PARAM_INT);
     parent::__construct($repositoryid, $context, $options);
     $this->setting = 'dropbox_';
     $this->dropbox_key = $this->get_option('dropbox_key');
     $this->dropbox_secret = $this->get_option('dropbox_secret');
     // one day
     $this->cachedfilettl = 60 * 60 * 24;
     if (isset($options['access_key'])) {
         $this->access_key = $options['access_key'];
     } else {
         $this->access_key = get_user_preferences($this->setting . '_access_key', '');
     }
     if (isset($options['access_secret'])) {
         $this->access_secret = $options['access_secret'];
     } else {
         $this->access_secret = get_user_preferences($this->setting . '_access_secret', '');
     }
     if (!empty($this->access_key) && !empty($this->access_secret)) {
         $this->logged = true;
     }
     $callbackurl = new moodle_url($CFG->wwwroot . '/repository/repository_callback.php', array('callback' => 'yes', 'repo_id' => $repositoryid));
     $args = array('oauth_consumer_key' => $this->dropbox_key, 'oauth_consumer_secret' => $this->dropbox_secret, 'oauth_callback' => $callbackurl->out(false), 'api_root' => 'https://api.dropbox.com/1/oauth');
     $this->dropbox = new dropbox($args);
 }
Beispiel #8
0
 public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array())
 {
     parent::__construct($repositoryid, $context, $options);
     $this->keyword = optional_param('merlot_keyword', '', PARAM_RAW);
     $this->author = optional_param('merlot_author', '', PARAM_RAW);
     $this->licensekey = trim(get_config('merlot', 'licensekey'));
 }
Beispiel #9
0
 public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array())
 {
     parent::__construct($repositoryid, $context, $options);
     $this->list_url = "https://media.heanet.ie/api/1.0/media_list.php?";
     $this->check_login_url = "https://media.heanet.ie/api/1.0/media_list.php?";
     $this->bind_url = "https://media.heanet.ie/secure/account/user_setguid.php?";
 }
Beispiel #10
0
 /**
  * Constructor
  * @param int $repositoryid
  * @param object $context
  * @param array $options
  */
 public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array()) {
     parent::__construct($repositoryid, $context, $options);
     $this->access_key = get_config('s3', 'access_key');
     $this->secret_key = get_config('s3', 'secret_key');
     $this->s = new S3($this->access_key, $this->secret_key);
     $this->s->setExceptions(true);
 }
 public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array())
 {
     parent::__construct($repositoryid, $context, $options);
     // set up webdav client
     if (empty($this->options['webdav_server'])) {
         return;
     }
     if ($this->options['webdav_auth'] == 'none') {
         $this->options['webdav_auth'] = false;
     }
     $this->dav = new webdav_client($this->options['webdav_server'], $this->options['webdav_user'], $this->options['webdav_password'], $this->options['webdav_auth']);
     if (empty($this->options['webdav_type'])) {
         $this->webdav_type = '';
     } else {
         $this->webdav_type = 'ssl://';
     }
     if (empty($this->options['webdav_port'])) {
         if (empty($this->webdav_type)) {
             $this->dav->port = 80;
         } else {
             $this->dav->port = 443;
         }
         $port = '';
     } else {
         $this->dav->port = $this->options['webdav_port'];
         $port = ':' . $this->options['webdav_port'];
     }
     $this->webdav_host = $this->webdav_type . $this->options['webdav_server'] . $port;
     $this->dav->debug = false;
 }
 public function __construct($repositoryid, $context = SITEID, $options = array())
 {
     parent::__construct($repositoryid, $context, $options);
     // set up webdav client
     $this->wd = new webdav_client();
     if (empty($this->options['webdav_server'])) {
         return;
     }
     if (empty($this->options['webdav_type'])) {
         $this->options['webdav_type'] = '';
     } else {
         $this->options['webdav_type'] = 'ssl://';
     }
     $this->wd->set_server($this->options['webdav_server']);
     if (empty($this->options['webdav_port'])) {
         if (empty($this->options['webdav_type'])) {
             $this->wd->set_port(80);
         } else {
             $this->wd->set_port(443);
         }
         $port = '';
     } else {
         $this->wd->set_port($this->options['webdav_port']);
         $port = ':' . $this->options['webdav_port'];
     }
     $this->webdav_host = $this->options['webdav_type'] . $this->options['webdav_server'] . $port;
     if (!empty($this->options['webdav_user'])) {
         $this->wd->set_user($this->options['webdav_user']);
     }
     if (!empty($this->options['webdav_password'])) {
         $this->wd->set_pass($this->options['webdav_password']);
     }
     $this->wd->set_protocol(1);
     $this->wd->set_debug(false);
 }
Beispiel #13
0
 /**
  * Youtube plugin constructor
  * @param int $repositoryid
  * @param object $context
  * @param array $options
  */
 public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array())
 {
     $this->start = 1;
     $this->max = 27;
     $this->sort = optional_param('youtube_sort', 'relevance', PARAM_TEXT);
     parent::__construct($repositoryid, $context, $options);
 }
 public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array())
 {
     $options['page'] = optional_param('p', 1, PARAM_INT);
     parent::__construct($repositoryid, $context, $options);
     // if moodle is telling us what kind of mimetypes it wants, we check to see if it happens to be just ZIP.
     // If that's the case, we know we're on a SCORM page, because in all other cases supported_filetypes() will return web_image
     // this allows us to override our own type and act like a SCORM supplier.
     if (isset($options['mimetypes'])) {
         if (in_array(".zip", $options['mimetypes'])) {
             $this->fileTypes = "zipscorm";
             $this->fileExtension = ".zip";
         }
     }
     $this->setting = 'elevator_';
     $elevatorURL = get_config('elevator', 'elevatorURL');
     $apiKey = get_config('elevator', 'apiKey');
     $apiSecret = get_config('elevator', 'apiSecret');
     if (isset($options['userId'])) {
         $this->userId = $options['userId'];
     } else {
         $this->userId = get_user_preferences($this->setting . '_userId', '');
     }
     $this->repositoryId = $repositoryid;
     // initiate an instance of the elevator API, which handles all the backend communication.
     $this->elevatorAPI = new elevatorAPI($elevatorURL, $apiKey, $apiSecret, $this->userId);
     $this->elevatorAPI->fileTypes = $this->fileTypes;
     if ($this->userId) {
         $this->loggedIn = $this->testUserId();
         $this->manageURL = $this->elevatorAPI->getManageURL();
     }
 }
 public function __construct($repositoryid, $context = SITEID, $options = array())
 {
     parent::__construct($repositoryid, $context, $options);
     if (empty($this->root_path)) {
         return;
     }
     $this->root_path = trim($this->root_path);
     if (!empty($options['ajax'])) {
         // if created from filepicker
         if (empty($this->root_path)) {
             $ret = array();
             $ret['msg'] = get_string('invalidpath', 'repository_filesystem');
             $ret['nosearch'] = true;
             echo json_encode($ret);
             exit;
         } else {
             if (!is_dir($this->root_path)) {
                 $ret = array();
                 $ret['msg'] = get_string('invalidpath', 'repository_filesystem');
                 $ret['nosearch'] = true;
                 if ($options['ajax']) {
                     echo json_encode($ret);
                     exit;
                 }
             }
         }
         if ($this->root_path[strlen($this->root_path) - 1] !== '/') {
             $this->root_path .= '/';
         }
     }
 }
Beispiel #16
0
    /**
     * constructor method
     *
     * @global object $CFG
     * @global object $SESSION
     * @param int $repositoryid
     * @param int $context
     * @param array $options
     * @param boolean $readonly
     */
    public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array(), $readonly=0) {
        global $CFG, $SESSION;
        parent::__construct($repositoryid, $context, $options,$readonly);
        $this->api_key = $this->get_option('api_key');
        $this->flickr  = new phpFlickr($this->api_key);
        $this->flickr_account = $this->get_option('email_address');
        $this->usewatermarks = $this->get_option('usewatermarks');

        $account  = optional_param('flickr_account', '', PARAM_RAW);
        $fulltext = optional_param('flickr_fulltext', '', PARAM_RAW);
        if (empty($fulltext)) {
            $fulltext = optional_param('s', '', PARAM_RAW);
        }
        $tag      = optional_param('flickr_tag', '', PARAM_RAW);
        $license  = optional_param('flickr_license', '', PARAM_RAW);

        $this->sess_account = 'flickr_public_'.$this->id.'_account';
        $this->sess_tag     = 'flickr_public_'.$this->id.'_tag';
        $this->sess_text    = 'flickr_public_'.$this->id.'_text';

        if (!empty($account) or !empty($fulltext) or !empty($tag) or !empty($license)) {
            $SESSION->{$this->sess_tag}  = $tag;
            $SESSION->{$this->sess_text} = $fulltext;
            $SESSION->{$this->sess_account} = $account;
        }
    }
 /**
  * Constructor
  * @global object $SESSION
  * @param int $repositoryid
  * @param object $context
  * @param array $options
  */
 public function __construct($repositoryid, $context = SITEID, $options = array())
 {
     global $SESSION;
     $options['username'] = optional_param('boxusername', '', PARAM_RAW);
     $options['password'] = optional_param('boxpassword', '', PARAM_RAW);
     $options['ticket'] = optional_param('ticket', '', PARAM_RAW);
     parent::__construct($repositoryid, $context, $options);
     $this->api_key = $this->get_option('api_key');
     $sess_name = 'box_token' . $this->id;
     $this->sess_name = 'box_token' . $this->id;
     // do login
     if (!empty($options['username']) && !empty($options['password']) && !empty($options['ticket'])) {
         $this->box = new boxclient($this->api_key);
         try {
             $SESSION->{$sess_name} = $this->box->getAuthToken($options['ticket'], $options['username'], $options['password']);
         } catch (repository_exception $e) {
             throw $e;
         }
     }
     // already logged
     if (!empty($SESSION->{$sess_name})) {
         if (empty($this->box)) {
             $this->box = new boxclient($this->api_key, $SESSION->{$sess_name});
         }
         $this->auth_token = $SESSION->{$sess_name};
     } else {
         $this->box = new boxclient($this->api_key);
     }
 }
Beispiel #18
0
    /**
     *
     * @param int $repositoryid
     * @param object $context
     * @param array $options
     */
    public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array()) {
        global $SESSION, $CFG;
        $options['page']    = optional_param('p', 1, PARAM_INT);
        parent::__construct($repositoryid, $context, $options);

        $this->setting = 'flickr_';

        $this->api_key = $this->get_option('api_key');
        $this->secret  = $this->get_option('secret');

        $this->token = get_user_preferences($this->setting, '');
        $this->nsid  = get_user_preferences($this->setting.'_nsid', '');

        $this->flickr = new phpFlickr($this->api_key, $this->secret, $this->token);

        $frob  = optional_param('frob', '', PARAM_RAW);
        if (empty($this->token) && !empty($frob)) {
            $auth_info = $this->flickr->auth_getToken($frob);
            $this->token = $auth_info['token'];
            $this->nsid  = $auth_info['user']['nsid'];
            set_user_preference($this->setting, $auth_info['token']);
            set_user_preference($this->setting.'_nsid', $auth_info['user']['nsid']);
        }

    }
 public function __construct($repositoryid, $context = SITEID, $options = array())
 {
     $options['keyword'] = optional_param('youtube_keyword', '', PARAM_RAW);
     $options['start'] = 1;
     $options['max'] = 27;
     $options['sort'] = 'relevance';
     parent::__construct($repositoryid, $context, $options);
 }
 public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array())
 {
     global $USER, $DB;
     parent::__construct($repositoryid, $context, $options);
     $this->dspace_url = $this->get_option('dspace_url');
     $this->username = $this->get_option('dspace_username');
     $this->password = $this->get_option('dspace_password');
 }
 public function __construct($repositoryid, $context = SITEID, $options = array())
 {
     $this->keyword = optional_param('youtube_keyword', '', PARAM_RAW);
     $this->start = 1;
     $this->max = 27;
     $this->sort = 'published';
     parent::__construct($repositoryid, $context, $options);
 }
Beispiel #22
0
 public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array())
 {
     parent::__construct($repositoryid, $context, $options);
     $this->keyword = optional_param('wikimedia_keyword', '', PARAM_RAW);
     if (empty($this->keyword)) {
         $this->keyword = optional_param('s', '', PARAM_RAW);
     }
 }
Beispiel #23
0
 /**
  * Youtube plugin constructor
  * @param int $repositoryid
  * @param object $context
  * @param array $options
  */
 public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array())
 {
     parent::__construct($repositoryid, $context, $options);
     $this->apikey = $this->get_option('apikey');
     // Without an API key, don't show this repo to users as its useless without it.
     if (empty($this->apikey)) {
         $this->disabled = true;
     }
 }
Beispiel #24
0
 /**
  * Constructor
  *
  * @param int $repositoryid repository instance id.
  * @param int|stdClass $context a context id or context object.
  * @param array $options repository options.
  */
 public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array())
 {
     parent::__construct($repositoryid, $context, $options);
     try {
         $this->onenoteapi = \local_onenote\api\base::getinstance();
     } catch (\Exception $e) {
         $this->onenoteapi = false;
     }
 }
Beispiel #25
0
 /**
  * Constructor
  *
  * @param int $repositoryid repository instance id
  * @param int|stdClass $context a context id or context object
  * @param array $options repository options
  * @param int $readonly indicate this repo is readonly or not
  */
 public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array(), $readonly = 0)
 {
     parent::__construct($repositoryid, $context, $options, $readonly);
     $this->httpclient = new \local_o365\httpclient();
     $this->clientdata = \local_o365\oauth2\clientdata::instance_from_oidc();
     $this->onedriveconfigured = \local_o365\rest\onedrive::is_configured();
     $this->unifiedconfigured = \local_o365\rest\unified::is_configured();
     $this->sharepointconfigured = \local_o365\rest\sharepoint::is_configured();
 }
 /**
  *
  * @global object $SESSION
  * @global string $action
  * @global object $CFG
  * @param int $repositoryid
  * @param object $context
  * @param array $options
  */
 public function __construct($repositoryid, $context = SITEID, $options = array())
 {
     global $SESSION, $action, $CFG;
     parent::__construct($repositoryid, $context, $options);
     $itemid = optional_param('itemid', '', PARAM_INT);
     if ($action == 'upload') {
         $filepath = '/';
         $this->info = repository::store_to_filepool('repo_upload_file', 'user_draft', $filepath, $itemid);
     }
 }
 /**
  * @param int $repositoryid
  * @param object $context
  * @param array $options
  */
 public function __construct($repositoryid, $context = SITEID, $options = array())
 {
     global $CFG;
     parent::__construct($repositoryid, $context, $options);
     if (!empty($options['client_id'])) {
         // will be used to construct download form
         $this->client_id = $options['client_id'];
     }
     $this->file_url = optional_param('file', '', PARAM_RAW);
 }
Beispiel #28
0
    /**
     * Constructor
     *
     * @param int $repositoryid repository instance id
     * @param int|stdClass $context a context id or context object
     * @param array $options repository options
     */
    public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array()) {
        parent::__construct($repositoryid, $context, $options);

        if (isset($this->options['mimetypes'])) {
            $mt = $this->options['mimetypes'];
            if (!empty($mt) && is_array($mt) && !in_array('*', $mt)) {
                $this->mimetypes = array_unique(array_map(array($this, 'to_mime_type'), $mt));
            }
        }
    }
Beispiel #29
0
 /**
  * Initialize recent plugin
  * @param int $repositoryid
  * @param int $context
  * @param array $options
  */
 public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array()) {
     parent::__construct($repositoryid, $context, $options);
     $number = get_config('recent', 'recentfilesnumber');
     $number = (int)$number;
     if (empty($number)) {
         $this->number = DEFAULT_RECENT_FILES_NUM;
     } else {
         $this->number = $number;
     }
 }
 public function __construct($repositoryid, $context = SITEID, $options = array())
 {
     parent::__construct($repositoryid, $context, $options);
     $this->access_key = get_config('s3', 'access_key');
     $this->secret_key = get_config('s3', 'secret_key');
     if (empty($this->access_key)) {
         die(json_encode(array('e' => get_string('repository_s3', 'needaccesskey'))));
     }
     $this->s = new S3($this->access_key, $this->secret_key);
 }