forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-75316 core_moodlenet: Share to MoodleNet modal and activity menu
Originally implemented as MDL-75785
- Loading branch information
1 parent
6a877d4
commit 58ced4a
Showing
36 changed files
with
1,594 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
// This file is part of Moodle - http://moodle.org/ | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Moodle is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* MoodleNet callback. | ||
* | ||
* @package core | ||
* @copyright 2023 Huong Nguyen <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
use core\moodlenet\moodlenet_client; | ||
use core\oauth2\api; | ||
|
||
require_once(__DIR__ . '/../config.php'); | ||
require_login(); | ||
|
||
// Parameters. | ||
$issuerid = required_param('issuerid', PARAM_INT); | ||
$error = optional_param('error', '', PARAM_RAW); | ||
$message = optional_param('error_description', null, PARAM_RAW); | ||
|
||
// Headers to make it not cacheable. | ||
header('Cache-Control: no-cache, must-revalidate'); | ||
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); | ||
|
||
$PAGE->set_context(context_system::instance()); | ||
$PAGE->set_url('/admin/moodlenet_oauth2_callback.php'); | ||
$PAGE->set_pagelayout('popup'); | ||
|
||
// Wait as long as it takes for this script to finish. | ||
core_php_time_limit::raise(); | ||
|
||
$issuer = api::get_issuer($issuerid); | ||
$returnurl = new moodle_url('/admin/moodlenet_oauth2_callback.php'); | ||
$returnurl->param('issuerid', $issuerid); | ||
$returnurl->param('callback', 'yes'); | ||
$returnurl->param('sesskey', sesskey()); | ||
$oauthclient = api::get_user_oauth_client($issuer, $returnurl, moodlenet_client::API_SCOPE_CREATE, true); | ||
$oauthclient->is_logged_in(); // Will upgrade the auth code to a token. | ||
|
||
echo $OUTPUT->header(); | ||
$PAGE->requires->js_call_amd('core/moodlenet/oauth2callback', 'init', [$error, $message]); | ||
echo $OUTPUT->footer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.