@@ -8,7 +8,7 @@ discard block |
||
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 |
||
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 | ); |
@@ -15,7 +15,7 @@ |
||
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 { |
@@ -1,6 +1,6 @@ |
||
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 |
@@ -116,7 +116,7 @@ |
||
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( |
@@ -96,7 +96,7 @@ discard block |
||
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 |
||
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( |
@@ -128,13 +128,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |