Skip to content

Commit e2e5f17

Browse files
committed
Merge pull request #70 from ucfcdl/UDOIT_issue69
Fix for issue 69, base_url not being saved properly.
2 parents 6c1bc70 + 4029973 commit e2e5f17

File tree

6 files changed

+103
-25
lines changed

6 files changed

+103
-25
lines changed

README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,9 @@ CREATE TABLE `users` (
9393
## Configuration
9494
Make a copy of `config/localConfig.template.php`, rename it to `localConfig.php`.
9595

96-
### Miscellaneous
97-
98-
* `$referer_test` This is a regular expression that lets UDOIT detect whether the user accessed UDOIT from the correct URL. For instance, UCF's value for this is: `$referer_test = '/(webcourses.ucf.edu)/';`
99-
10096
### Canvas API
10197
Please refer to the [Canvas API Policy](http://www.canvaslms.com/policies/api-policy) before using this application, as it makes heavy use of the Canvas API.
10298

103-
* `$base_url`: The URL of your Canvas installation
10499
* `$consumer_key`: A consumer key you make up. Used when installing the LTI in Canvas.
105100
* `$shared_secret`: The shared secret you make up. Used when installing the LTI in Canvas.
106101

composer.lock

Lines changed: 73 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

composer.phar

134 KB
Binary file not shown.

index.php

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,29 @@
6868
$redirect = true;
6969

7070
// Establish base_url given by canvas API
71-
$base_url = 'https://'.$_POST['custom_canvas_api_domain'].'/';
71+
if( isset($_POST['custom_canvas_api_domain']) ){
72+
$base_url = $_SESSION['base_url'] = 'https://'.$_POST['custom_canvas_api_domain'].'/';
73+
} else {
74+
echo '
75+
<!DOCTYPE html>
76+
<html lang="en">
77+
<head>
78+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
79+
<title>UDOIT Accessibility Checker</title>
80+
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" />
81+
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css" />
82+
</head>
83+
<body>
84+
<div style="padding: 12px;">
85+
<div class="alert alert-danger">
86+
<span class="glyphicon glyphicon-exclamation-sign"></span> No domain provided. Please ensure that your instance of UDOIT is installed to Canvas correctly.
87+
</div>
88+
</div>
89+
</body>
90+
</html>
91+
';
92+
die();
93+
}
7294

7395
// Pull the API key from the database
7496
$dsn = "mysql:dbname=$db_name;host=$db_host";
@@ -152,7 +174,7 @@
152174
</div>
153175
<form class="form-horizontal no-print" id="udoitForm" method="post" action="lib/process.php" role="form">
154176
<input type="hidden" name="main_action" value="udoit">
155-
<input type="hidden" name="base_url" value="https://<?php echo $_POST['custom_canvas_api_domain'] ?>/">
177+
<input type="hidden" name="base_url" value="<?php echo $base_url ?>">
156178
<input type="hidden" name="session_course_id" value="<?php echo $_SESSION['launch_params']['custom_canvas_course_id'] ?>">
157179
<input type="hidden" name="session_context_label" value="<?php echo $_SESSION['launch_params']['context_label'] ?>">
158180
<input type="hidden" name="session_context_title" value="<?php echo $_SESSION['launch_params']['context_title'] ?>">

lib/process.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@
2323
include 'Udoit.php';
2424
include 'Ufixit.php';
2525

26+
session_start();
27+
2628
use Httpful\Request;
27-
$base_url = $_POST['base_url'];
29+
$base_url = $_SESSION['base_url'];
2830
$SESSION_course_id = $_POST['course_id'];
2931
$SESSION_context_label = $_POST['context_label'];
3032
$SESSION_context_title = $_POST['context_title'];
33+
session_write_close();
3134

3235
// check if course content is being scanned or fixed
3336
switch ($_POST['main_action']) {

oauth2response.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ function printError($msg){
4343
die();
4444
}
4545

46+
$base_url = $_SESSION['base_url'];
47+
4648
if (isset($_GET['code'])) {
4749
//Exchange code for API key
4850
$url = $base_url . '/login/oauth2/token';

0 commit comments

Comments
 (0)