mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 00:16:46 +02:00
Merge branch 's10_MDL-27330_dropbox_authorization_url_master' of github.com:dongsheng/moodle
This commit is contained in:
commit
f4c7c735f5
2 changed files with 10 additions and 3 deletions
|
@ -156,6 +156,7 @@ $string['renameto'] = 'Rename to';
|
||||||
$string['repositories'] = 'Repositories';
|
$string['repositories'] = 'Repositories';
|
||||||
$string['repository'] = 'Repository';
|
$string['repository'] = 'Repository';
|
||||||
$string['repositorycourse'] = 'Course repositories';
|
$string['repositorycourse'] = 'Course repositories';
|
||||||
|
$string['repositoryerror'] = 'Remote repository returned error: {$a}';
|
||||||
$string['save'] = 'Save';
|
$string['save'] = 'Save';
|
||||||
$string['saveas'] = 'Save as';
|
$string['saveas'] = 'Save as';
|
||||||
$string['saved'] = 'Saved';
|
$string['saved'] = 'Saved';
|
||||||
|
|
|
@ -66,7 +66,7 @@ class repository_dropbox extends repository {
|
||||||
'oauth_consumer_key'=>$this->dropbox_key,
|
'oauth_consumer_key'=>$this->dropbox_key,
|
||||||
'oauth_consumer_secret'=>$this->dropbox_secret,
|
'oauth_consumer_secret'=>$this->dropbox_secret,
|
||||||
'oauth_callback' => $this->callback->out(false),
|
'oauth_callback' => $this->callback->out(false),
|
||||||
'api_root' => 'http://api.dropbox.com/0/oauth',
|
'api_root' => 'http://www.dropbox.com/0/oauth',
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->dropbox = new dropbox($args);
|
$this->dropbox = new dropbox($args);
|
||||||
|
@ -163,10 +163,16 @@ class repository_dropbox extends repository {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$files = $result->contents;
|
if (!empty($result->error)) {
|
||||||
if (!is_array($files) || empty($files)) {
|
// reset access key
|
||||||
|
set_user_preference($this->setting.'_access_key', '');
|
||||||
|
set_user_preference($this->setting.'_access_secret', '');
|
||||||
|
throw new repository_exception('repositoryerror', 'repository', '', $result->error);
|
||||||
|
}
|
||||||
|
if (empty($result->contents) or !is_array($result->contents)) {
|
||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
$files = $result->contents;
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
if ($file->is_dir) {
|
if ($file->is_dir) {
|
||||||
$list['list'][] = array(
|
$list['list'][] = array(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue