From 13b449f4a56490b6cef22b976ce286c8e12ac036 Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Fri, 24 Mar 2017 15:34:15 +0800 Subject: [PATCH] MDL-58220 oauth2: cibot cleanups --- auth/oauth2/classes/api.php | 1 - auth/oauth2/classes/auth.php | 10 +++++----- auth/oauth2/lang/en/auth_oauth2.php | 30 ++++++++++++++--------------- lib/classes/filetypes.php | 3 ++- lib/classes/oauth2/rest.php | 1 + lib/filestorage/file_storage.php | 3 ++- repository/skydrive/db/upgrade.php | 2 ++ repository/skydrive/lib.php | 1 + 8 files changed, 28 insertions(+), 23 deletions(-) diff --git a/auth/oauth2/classes/api.php b/auth/oauth2/classes/api.php index 58028a9f573..793fe895c66 100644 --- a/auth/oauth2/classes/api.php +++ b/auth/oauth2/classes/api.php @@ -131,7 +131,6 @@ class api { * @return bool */ public static function send_confirm_link_login_email($userinfo, $issuer, $userid) { - $record = new stdClass(); $record->issuerid = $issuer->get('id'); $record->username = $userinfo['username']; diff --git a/auth/oauth2/classes/auth.php b/auth/oauth2/classes/auth.php index 951d8757d77..af536865861 100644 --- a/auth/oauth2/classes/auth.php +++ b/auth/oauth2/classes/auth.php @@ -315,7 +315,7 @@ class auth extends \auth_plugin_base { * @param string $username * @param string $confirmsecret */ - function user_confirm($username, $confirmsecret) { + public function user_confirm($username, $confirmsecret) { global $DB; $user = get_complete_user_data('username', $username); @@ -326,8 +326,8 @@ class auth extends \auth_plugin_base { } else if ($user->secret == $confirmsecret && $user->confirmed) { return AUTH_CONFIRM_ALREADY; - } else if ($user->secret == $confirmsecret) { // They have provided the secret key to get in - $DB->set_field("user", "confirmed", 1, array("id"=>$user->id)); + } else if ($user->secret == $confirmsecret) { // They have provided the secret key to get in. + $DB->set_field("user", "confirmed", 1, array("id" => $user->id)); return AUTH_CONFIRM_OK; } } else { @@ -338,8 +338,8 @@ class auth extends \auth_plugin_base { /** * Print a page showing that a confirm email was sent with instructions. * - * @param string title - * @param string message + * @param string $title + * @param string $message */ public function print_confirm_required($title, $message) { global $PAGE, $OUTPUT, $CFG; diff --git a/auth/oauth2/lang/en/auth_oauth2.php b/auth/oauth2/lang/en/auth_oauth2.php index f4395bf4e36..53f850e7714 100644 --- a/auth/oauth2/lang/en/auth_oauth2.php +++ b/auth/oauth2/lang/en/auth_oauth2.php @@ -65,20 +65,20 @@ line at the top of your web browser window. If you need help, please contact the site administrator, {$a->admin}'; $string['confirmlinkedloginemailsubject'] = '{$a}: linked login confirmation'; -$string['confirmaccountemail'] = 'Hi {$a->fullname}, - -A new account has been requested at \'{$a->sitename}\' -using your email address. - -To confirm your new account, please go to this web address: - -{$a->link} - -In most mail programs, this should appear as a blue link -which you can just click on. If that doesn\'t work, -then cut and paste the address into the address -line at the top of your web browser window. - -If you need help, please contact the site administrator, +$string['confirmaccountemail'] = 'Hi {$a->fullname}, + +A new account has been requested at \'{$a->sitename}\' +using your email address. + +To confirm your new account, please go to this web address: + +{$a->link} + +In most mail programs, this should appear as a blue link +which you can just click on. If that doesn\'t work, +then cut and paste the address into the address +line at the top of your web browser window. + +If you need help, please contact the site administrator, {$a->admin}'; $string['confirmaccountemailsubject'] = '{$a}: account confirmation'; diff --git a/lib/classes/filetypes.php b/lib/classes/filetypes.php index 23d45bde610..97ff4568271 100644 --- a/lib/classes/filetypes.php +++ b/lib/classes/filetypes.php @@ -104,7 +104,8 @@ abstract class core_filetypes { 'gdoc' => array('type' => 'application/vnd.google-apps.document', 'icon' => 'document', 'groups' => array('document')), 'gsheet' => array('type' => 'application/vnd.google-apps.spreadsheet', 'icon' => 'spreadsheet', 'groups' => array('spreadsheet')), - 'gslides' => array('type' => 'application/vnd.google-apps.presentation', 'icon' => 'powerpoint', 'groups' => array('presentation')), + 'gslides' => array('type' => 'application/vnd.google-apps.presentation', 'icon' => 'powerpoint', + 'groups' => array('presentation')), 'gif' => array('type' => 'image/gif', 'icon' => 'gif', 'groups' => array('image', 'web_image'), 'string' => 'image'), 'gtar' => array('type' => 'application/x-gtar', 'icon' => 'archive', 'groups' => array('archive'), 'string' => 'archive'), diff --git a/lib/classes/oauth2/rest.php b/lib/classes/oauth2/rest.php index c790429c891..b4a78732999 100644 --- a/lib/classes/oauth2/rest.php +++ b/lib/classes/oauth2/rest.php @@ -64,6 +64,7 @@ abstract class rest { * @param string $functionname * @param array $functionargs * @param string $rawpost Optional param to include in the body of a post. + * @return string|object */ public function call($functionname, $functionargs, $rawpost = false) { $functions = $this->get_api_functions(); diff --git a/lib/filestorage/file_storage.php b/lib/filestorage/file_storage.php index 7fd1eaaa4ac..1b26eba8860 100644 --- a/lib/filestorage/file_storage.php +++ b/lib/filestorage/file_storage.php @@ -1128,7 +1128,8 @@ class file_storage { // creating a new file from an existing alias creates new alias implicitly. // here we just check the database consistency. if (!empty($newrecord->repositoryid)) { - // It is OK if the current reference does not exist. It may have been altered by a repository plugin when the files where saved from a draft area. + // It is OK if the current reference does not exist. It may have been altered by a repository plugin when the files + // where saved from a draft area. $newrecord->referencefileid = $this->get_or_create_referencefileid($newrecord->repositoryid, $newrecord->reference); } diff --git a/repository/skydrive/db/upgrade.php b/repository/skydrive/db/upgrade.php index a9922abe2f1..0439640d1f1 100644 --- a/repository/skydrive/db/upgrade.php +++ b/repository/skydrive/db/upgrade.php @@ -17,6 +17,8 @@ defined('MOODLE_INTERNAL') || die(); /** + * Upgrade this plugin. + * * @param int $oldversion the version we are upgrading from * @package repository_skydrive * @return bool result diff --git a/repository/skydrive/lib.php b/repository/skydrive/lib.php index 569526c58ec..d3ca1b16cf8 100644 --- a/repository/skydrive/lib.php +++ b/repository/skydrive/lib.php @@ -1007,6 +1007,7 @@ class repository_skydrive extends repository { /** * Callback to get the required scopes for system account. * + * @param \core\oauth2\issuer $issuer * @return string */ function repository_skydrive_oauth2_system_scopes(\core\oauth2\issuer $issuer) {