From a5a84cc894b7ca499fb96107e362acaed0cb1fff Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Thu, 7 Nov 2013 14:29:35 +0800 Subject: [PATCH] MDL-42668 portfolio_boxnet: Disable the portfolio when non-HTTPS --- portfolio/boxnet/lang/en/portfolio_boxnet.php | 2 ++ portfolio/boxnet/lib.php | 3 +++ 2 files changed, 5 insertions(+) diff --git a/portfolio/boxnet/lang/en/portfolio_boxnet.php b/portfolio/boxnet/lang/en/portfolio_boxnet.php index 2cbd94c5f09..b1f94497937 100644 --- a/portfolio/boxnet/lang/en/portfolio_boxnet.php +++ b/portfolio/boxnet/lang/en/portfolio_boxnet.php @@ -32,6 +32,8 @@ $string['existingfolder'] = 'Existing folder to put file(s) into'; $string['folderclash'] = 'The folder you asked to create already exists!'; $string['foldercreatefailed'] = 'Failed to create your target folder on box.net'; $string['folderlistfailed'] = 'Failed to retrieve a folder listing from box.net'; +$string['missinghttps'] = 'HTTPS required'; +$string['missinghttps_help'] = 'Box.net will only work with an HTTPS enabled website.'; $string['missingoauthkeys'] = 'Missing client ID and secret'; $string['missingoauthkeys_help'] = 'There is no client ID or secret configured for this plugin. You can get one of these from Box.net development page.'; $string['newfolder'] = 'New folder to put file(s) into'; diff --git a/portfolio/boxnet/lib.php b/portfolio/boxnet/lib.php index 1ba65181324..ef8030acda2 100644 --- a/portfolio/boxnet/lib.php +++ b/portfolio/boxnet/lib.php @@ -204,8 +204,11 @@ class portfolio_plugin_boxnet extends portfolio_plugin_push_base { } public function instance_sanity_check() { + global $CFG; if (!$this->get_config('clientid') || !$this->get_config('clientsecret')) { return 'missingoauthkeys'; + } else if (strpos($CFG->wwwroot, 'https') !== 0) { + return 'missinghttps'; } }