Completed
Branch master (9d5b94)
by Seth
10:18
created
app.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 if (isset($_REQUEST['hack'])) {
10 10
 	while (list($id, $setting) = each($_REQUEST['hack'])) {
11
-		try{
11
+		try {
12 12
 
13 13
 			$hack = CanvasHack::getCanvasHackById($sql, $id);
14 14
 			if ($setting === 'enable') {
@@ -24,13 +24,13 @@  discard block
 block discarded – undo
24 24
 
25 25
 $hacksContents = scandir(realpath(__DIR__ . '/hacks'), SCANDIR_SORT_ASCENDING);
26 26
 $hacks = array();
27
-foreach($hacksContents as $item) {
27
+foreach ($hacksContents as $item) {
28 28
 	if (is_dir($path = realpath(__DIR__ . "/hacks/$item")) && file_exists($manifest = "$path/manifest.xml")) {
29 29
 		try {
30 30
 			$hacks[$item] = new CanvasHack($sql, $path);
31 31
 		} catch (CanvasHack_Exception $e) {
32 32
 			$smarty->addMessage(
33
-				'CanvasHack Manifest Error ['. $e->getCode() . ']',
33
+				'CanvasHack Manifest Error [' . $e->getCode() . ']',
34 34
 				$e->getMessage(),
35 35
 				NotificationMessage::ERROR
36 36
 			);
Please login to merge, or discard this patch.
admin/install.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 	
16 16
 /* ...otherwise, let's start with the SECRETS_FILE */
17 17
 } else {
18
-	if(!file_exists(SECRETS_FILE)) {
18
+	if (!file_exists(SECRETS_FILE)) {
19 19
 		if (isset($_REQUEST['step']) && $_REQUEST['step'] == CanvasAPIviaLTI_Installer::SECRETS_ENTERED_STEP) {
20 20
 			CanvasAPIviaLTI_Installer::createSecretsFile(CanvasAPIviaLTI_Installer::SECRETS_ENTERED_STEP);
21 21
 		} else {
Please login to merge, or discard this patch.
canvashack-loader.js.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 header('Content-Type: application/javascript');
6 6
 
7 7
 if (!empty($_REQUEST['download'])) {
8
-    header("Content-Disposition: attachment; filename=canvashack-loader.js");
8
+	header("Content-Disposition: attachment; filename=canvashack-loader.js");
9 9
 }
10 10
 
11 11
 ?>
Please login to merge, or discard this patch.
hacks/common.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-define ('IGNORE_LTI', true);
3
+define('IGNORE_LTI', true);
4 4
 
5 5
 require_once(__DIR__ . '/../common.inc.php');
6 6
 
Please login to merge, or discard this patch.
classes/CanvasAPIviaLTI.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
18 18
 		if ($this->user->isAdmin()) {
19 19
 			
20 20
 			/* set up any needed session variables */
21
-	        $_SESSION['consumer_key'] = $this->consumer->getKey();
22
-	        $_SESSION['resource_id'] = $this->resource_link->getId();
23
-	        $_SESSION['user_consumer_key'] = $this->user->getResourceLink()->getConsumer()->getKey();
24
-	        $_SESSION['user_id'] = $this->user->getId();
25
-	        $_SESSION['isStudent'] = $this->user->isLearner();
26
-	        $_SESSION['isContentItem'] = FALSE;	   
21
+			$_SESSION['consumer_key'] = $this->consumer->getKey();
22
+			$_SESSION['resource_id'] = $this->resource_link->getId();
23
+			$_SESSION['user_consumer_key'] = $this->user->getResourceLink()->getConsumer()->getKey();
24
+			$_SESSION['user_id'] = $this->user->getId();
25
+			$_SESSION['isStudent'] = $this->user->isLearner();
26
+			$_SESSION['isContentItem'] = FALSE;	   
27 27
 			
28 28
 			/* do we have an admin API access token? */
29 29
 			$haveToken = true;
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
 			}
53 53
 			$_SESSION['apiUrl'] = 'https://' . $this->user->getResourceLink()->settings['custom_canvas_api_domain'] . '/api/v1';
54 54
 			
55
-	        /* pass control off to the app */
56
-	        if ($haveToken) {
57
-		        $this->redirectURL = "{$metadata['APP_URL']}/app.php?lti-request=launch";
58
-	        }
55
+			/* pass control off to the app */
56
+			if ($haveToken) {
57
+				$this->redirectURL = "{$metadata['APP_URL']}/app.php?lti-request=launch";
58
+			}
59 59
 
60 60
 		/* ...otherwise set an appropriate error message and fail */
61 61
 		} else {
Please login to merge, or discard this patch.
classes/UserAPIToken.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@
 block discarded – undo
116 116
 				UserAPIToken_Exception::TOKEN_REQUIRED
117 117
 			);
118 118
 		}
119
-		if($this->consumerKey && $this->id && $this->sql) {
119
+		if ($this->consumerKey && $this->id && $this->sql) {
120 120
 			$_token = $this->sql->real_escape_string($token);
121 121
 			if (!$this->sql->query("UPDATE `" . self::USER_TOKENS_TABLE . "` set `token` = '$_token' WHERE `consumer_key` = '{$this->consumerKey}' AND `id` = '{$this->id}'")) {
122 122
 				throw new UserAPIToken_Exception(
Please login to merge, or discard this patch.
classes/CanvasAPIviaLTI_Installer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 						}
97 97
 						
98 98
 						$htaccessFile = __DIR__ . '/.htaccess';
99
-						if(!file_put_contents($htaccessFile, "AuthType Basic\nAuthName \"{$secrets->app->name} Admin\"\nAuthUserFile $htpasswdFile\nRequire valid-user\n")) {
99
+						if (!file_put_contents($htaccessFile, "AuthType Basic\nAuthName \"{$secrets->app->name} Admin\"\nAuthUserFile $htpasswdFile\nRequire valid-user\n")) {
100 100
 							throw new CanvasAPIviaLTI_Installer_Exception(
101 101
 								"Failed to create $htaccessFile",
102 102
 								CanvasAPIviaLTI_Installer_Exception::HTACCESS_FILE
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 		} elseif (file_exists($ltiSchema)) {
155 155
 			$queries = explode(";", file_get_contents($ltiSchema));
156 156
 			$created = true;
157
-			foreach($queries as $query) {
157
+			foreach ($queries as $query) {
158 158
 				if (!empty(trim($query))) {
159 159
 					if (!$sql->query($query)) {
160 160
 						throw new CanvasAPIviaLTI_Installer_Exception(
Please login to merge, or discard this patch.
classes/CanvasHack.php 1 patch
Spacing   +6 added lines, -8 removed lines patch added patch discarded remove patch
@@ -128,13 +128,11 @@  discard block
 block discarded – undo
128 128
 		$_name = $this->sql->real_escape_string($this->name);
129 129
 		$_abstract = (
130 130
 			isset($this->abstract) ?
131
-				$this->sql->real_escape_string($this->abstract) :
132
-				$this->sql->real_escape_string($this->description)
131
+				$this->sql->real_escape_string($this->abstract) : $this->sql->real_escape_string($this->description)
133 132
 		);
134 133
 		$_description = (
135 134
 			isset($this->description) ?
136
-				$this->sql->real_escape_string($this->description) :
137
-				$this->sql->real_escape_string($this->abstract)
135
+				$this->sql->real_escape_string($this->description) : $this->sql->real_escape_string($this->abstract)
138 136
 		);
139 137
 		$_path = $this->sql->real_escape_string($this->path);
140 138
 		
@@ -160,7 +158,7 @@  discard block
 block discarded – undo
160 158
 	private function parseManifestCanvasPages($pages) {
161 159
 		$this->clearDb($this->pages, $this->id);
162 160
 		if (!empty($pages->include)) {
163
-			foreach($pages->include->children() as $page) {
161
+			foreach ($pages->include->children() as $page) {
164 162
 				if (!$this->sql->query("
165 163
 					INSERT INTO `{$this->pages}`
166 164
 					(
@@ -183,7 +181,7 @@  discard block
 block discarded – undo
183 181
 			}
184 182
 		}
185 183
 		if (!empty($pages->exclude)) {
186
-			foreach($pages->exclude->children() as $page) {
184
+			foreach ($pages->exclude->children() as $page) {
187 185
 				if (!$this->sql->query("
188 186
 					INSERT INTO `{$this->pages}`
189 187
 					(
@@ -211,7 +209,7 @@  discard block
 block discarded – undo
211 209
 	private function parseManifestCanvasDOM($dom) {
212 210
 		$this->clearDb($this->dom, $this->id);
213 211
 		if (!empty($dom)) {
214
-			foreach($dom->children() as $bundle) {
212
+			foreach ($dom->children() as $bundle) {
215 213
 				if (!$this->sql->query("
216 214
 					INSERT INTO `{$this->dom}`
217 215
 					(
@@ -327,7 +325,7 @@  discard block
 block discarded – undo
327 325
 		");
328 326
 		
329 327
 		$params = array();
330
-		foreach($fields as $field => $value) {
328
+		foreach ($fields as $field => $value) {
331 329
 			$params[] = "`$field` = '$value'";
332 330
 		}
333 331
 		
Please login to merge, or discard this patch.