Completed
Push — 1.10.x ( 3f49cd...45b387 )
by Yannick
272:36 queued 230:11
created
main/auth/openid/login.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -337,6 +337,7 @@
 block discarded – undo
337 337
 
338 338
 /**
339 339
  * Make a HTTP request - This function has been copied straight over from Drupal 6 code (drupal_http_request)
340
+ * @param string $data
340 341
  */
341 342
 function openid_http_request($url, $headers = array(), $method = 'GET', $data = NULL, $retry = 3) {
342 343
     $result = new stdClass();
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 /**
14 14
  * Initialisation
15 15
  */
16
-require_once api_get_path(CONFIGURATION_PATH) . 'auth.conf.php';
16
+require_once api_get_path(CONFIGURATION_PATH).'auth.conf.php';
17 17
 
18 18
 require_once 'openid.lib.php';
19 19
 require_once 'xrds.lib.php';
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     // Now that there is an association created, move on
69 69
     // to request authentication from the IdP
70 70
     $identity = (!empty($services[0]['delegate'])) ? $services[0]['delegate'] : $claimed_id;
71
-    if (isset($services[0]['types']) && is_array($services[0]['types']) && in_array(OPENID_NS_2_0 . '/server', $services[0]['types'])) {
71
+    if (isset($services[0]['types']) && is_array($services[0]['types']) && in_array(OPENID_NS_2_0.'/server', $services[0]['types'])) {
72 72
         $identity = 'http://openid.net/identifier_select/2.0';
73 73
     }
74 74
     $authn_request = openid_authentication_request($claimed_id, $identity, $return_to, $assoc_handle, $services[0]['version']);
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
     $xrds_url = $claimed_id;
128 128
     if (_openid_is_xri($claimed_id)) {
129
-        $xrds_url = 'http://xri.net/' . $claimed_id;
129
+        $xrds_url = 'http://xri.net/'.$claimed_id;
130 130
     }
131 131
     $url = @parse_url($xrds_url);
132 132
     if ($url['scheme'] == 'http' || $url['scheme'] == 'https') {
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     //@todo Remove Old Associations:
192 192
     $openid_association = Database::get_main_table(TABLE_MAIN_OPENID_ASSOCIATION);
193 193
     $sql = "DELETE FROM $openid_association
194
-            WHERE created + expires_in < '" . api_get_utc_datetime() . "'";
194
+            WHERE created + expires_in < '".api_get_utc_datetime()."'";
195 195
     Database::query($sql);
196 196
 
197 197
     // Check to see if we have an association for this IdP already
@@ -347,17 +347,17 @@  discard block
 block discarded – undo
347 347
     switch ($uri['scheme']) {
348 348
         case 'http':
349 349
             $port = isset($uri['port']) ? $uri['port'] : 80;
350
-            $host = $uri['host'] . ($port != 80 ? ':' . $port : '');
350
+            $host = $uri['host'].($port != 80 ? ':'.$port : '');
351 351
             $fp = @fsockopen($uri['host'], $port, $errno, $errstr, 15);
352 352
             break;
353 353
         case 'https':
354 354
             // Note: Only works for PHP 4.3 compiled with OpenSSL.
355 355
             $port = isset($uri['port']) ? $uri['port'] : 443;
356
-            $host = $uri['host'] . ($port != 443 ? ':' . $port : '');
357
-            $fp = @fsockopen('ssl://' . $uri['host'], $port, $errno, $errstr, 20);
356
+            $host = $uri['host'].($port != 443 ? ':'.$port : '');
357
+            $fp = @fsockopen('ssl://'.$uri['host'], $port, $errno, $errstr, 20);
358 358
             break;
359 359
         default:
360
-            $result->error = 'invalid schema ' . $uri['scheme'];
360
+            $result->error = 'invalid schema '.$uri['scheme'];
361 361
             return $result;
362 362
     }
363 363
 
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
     // Construct the path to act on.
374 374
     $path = isset($uri['path']) ? $uri['path'] : '/';
375 375
     if (isset($uri['query'])) {
376
-        $path .= '?' . $uri['query'];
376
+        $path .= '?'.$uri['query'];
377 377
     }
378 378
 
379 379
     // Create HTTP request.
@@ -383,23 +383,23 @@  discard block
 block discarded – undo
383 383
         // host that do not take into account the port number.
384 384
         'Host' => "Host: $host",
385 385
         'User-Agent' => 'User-Agent: Chamilo (+http://www.chamilo.org/)',
386
-        'Content-Length' => 'Content-Length: ' . strlen($data)
386
+        'Content-Length' => 'Content-Length: '.strlen($data)
387 387
     );
388 388
 
389 389
     // If the server url has a user then attempt to use basic authentication
390 390
     if (isset($uri['user'])) {
391
-        $defaults['Authorization'] = 'Authorization: Basic ' . base64_encode($uri['user'] . (!empty($uri['pass']) ? ":" . $uri['pass'] : ''));
391
+        $defaults['Authorization'] = 'Authorization: Basic '.base64_encode($uri['user'].(!empty($uri['pass']) ? ":".$uri['pass'] : ''));
392 392
     }
393 393
 
394 394
     foreach ($headers as $header => $value) {
395
-        $defaults[$header] = $header . ': ' . $value;
395
+        $defaults[$header] = $header.': '.$value;
396 396
     }
397 397
 
398
-    $request = $method . ' ' . $path . " HTTP/1.0\r\n";
398
+    $request = $method.' '.$path." HTTP/1.0\r\n";
399 399
     $request .= implode("\r\n", $defaults);
400 400
     $request .= "\r\n\r\n";
401 401
     if ($data) {
402
-        $request .= $data . "\r\n";
402
+        $request .= $data."\r\n";
403 403
     }
404 404
     $result->request = $request;
405 405
 
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
         if (isset($result->headers[$header]) && $header == 'Set-Cookie') {
426 426
             // RFC 2109: the Set-Cookie response header comprises the token Set-
427 427
             // Cookie:, followed by a comma-separated list of one or more cookies.
428
-            $result->headers[$header] .= ',' . trim($value);
428
+            $result->headers[$header] .= ','.trim($value);
429 429
         } else {
430 430
             $result->headers[$header] = trim($value);
431 431
         }
Please login to merge, or discard this patch.
main/auth/openid/openid.lib.php 3 patches
Doc Comments   +16 added lines patch added patch discarded remove patch
@@ -121,6 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
 /**
123 123
  * Encode a message from _openid_create_message for HTTP Post
124
+ * @param null|string $message
124 125
  */
125 126
 function _openid_encode_message($message) {
126 127
     $encoded_message = '';
@@ -173,6 +174,7 @@  discard block
 block discarded – undo
173 174
 
174 175
 /**
175 176
  * Pull the href attribute out of an html link element.
177
+ * @param string $rel
176 178
  */
177 179
 function _openid_link_href($rel, $html) {
178 180
     $rel = preg_quote($rel);
@@ -186,6 +188,7 @@  discard block
 block discarded – undo
186 188
 
187 189
 /**
188 190
  * Pull the http-equiv attribute out of an html meta element
191
+ * @param string $equiv
189 192
  */
190 193
 function _openid_meta_httpequiv($equiv, $html) {
191 194
     preg_match('|<meta\s+http-equiv=["\']' . $equiv . '["\'](.*)/?>|iU', $html, $matches);
@@ -221,6 +224,10 @@  discard block
 block discarded – undo
221 224
     return base64_encode($signature);
222 225
 }
223 226
 
227
+/**
228
+ * @param string $key
229
+ * @param null|string $text
230
+ */
224 231
 function _openid_hmac($key, $text) {
225 232
     if (strlen($key) > OPENID_SHA1_BLOCKSIZE) {
226 233
         $key = _openid_sha1($key, true);
@@ -256,6 +263,9 @@  discard block
 block discarded – undo
256 263
     return base64_encode(_openid_dh_long_to_binary($str));
257 264
 }
258 265
 
266
+/**
267
+ * @param string $str
268
+ */
259 269
 function _openid_dh_binary_to_long($str) {
260 270
     $bytes = array_merge(unpack('C*', $str));
261 271
 
@@ -297,6 +307,9 @@  discard block
 block discarded – undo
297 307
     return $string;
298 308
 }
299 309
 
310
+/**
311
+ * @param string $secret
312
+ */
300 313
 function _openid_dh_xorsecret($shared, $secret) {
301 314
     $dh_shared_str = _openid_dh_long_to_binary($shared);
302 315
     $sha1_dh_shared = _openid_sha1($dh_shared_str);
@@ -308,6 +321,9 @@  discard block
 block discarded – undo
308 321
     return $xsecret;
309 322
 }
310 323
 
324
+/**
325
+ * @param string $stop
326
+ */
311 327
 function _openid_dh_rand($stop) {
312 328
     static $duplicate_cache = array();
313 329
 
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -9,10 +9,10 @@  discard block
 block discarded – undo
9 9
  * Code
10 10
  */
11 11
 // Diffie-Hellman Key Exchange Default Value.
12
-define('OPENID_DH_DEFAULT_MOD', '155172898181473697471232257763715539915724801' .
13
-        '966915404479707795314057629378541917580651227423698188993727816152646631' .
14
-        '438561595825688188889951272158842675419950341258706556549803580104870537' .
15
-        '681476726513255747040765857479291291572334510643245094715007229621094194' .
12
+define('OPENID_DH_DEFAULT_MOD', '155172898181473697471232257763715539915724801'.
13
+        '966915404479707795314057629378541917580651227423698188993727816152646631'.
14
+        '438561595825688188889951272158842675419950341258706556549803580104870537'.
15
+        '681476726513255747040765857479291291572334510643245094715007229621094194'.
16 16
         '349783925984760375594985848253359305585439638443');
17 17
 
18 18
 // Constants for Diffie-Hellman key exchange computations.
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
 function openid_redirect_http($url, $message) {
33 33
     $query = array();
34 34
     foreach ($message as $key => $val) {
35
-        $query[] = $key . '=' . urlencode($val);
35
+        $query[] = $key.'='.urlencode($val);
36 36
     }
37 37
     $sep = (strpos($url, '?') === FALSE) ? '?' : '&';
38
-    header('Location: ' . $url . $sep . implode('&', $query), TRUE, 302);
38
+    header('Location: '.$url.$sep.implode('&', $query), TRUE, 302);
39 39
     //exit;
40 40
 }
41 41
 
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
  * This function should be deprecated for 1.8.6.2 needs documentation
45 45
  */
46 46
 function openid_redirect($url, $message) {
47
-    $output = '<html><head><title>' . get_lang('OpenIDRedirect') . "</title></head>\n<body>";
48
-    $output .= '<form method="post" action="' . $url . '" id="openid-redirect-form">';
47
+    $output = '<html><head><title>'.get_lang('OpenIDRedirect')."</title></head>\n<body>";
48
+    $output .= '<form method="post" action="'.$url.'" id="openid-redirect-form">';
49 49
     foreach ($message as $key => $value) {
50
-        $output .='<input type="hidden" name="' . $key . '" value="' . $value . '">';
50
+        $output .= '<input type="hidden" name="'.$key.'" value="'.$value.'">';
51 51
     }
52
-    $output .= '<noscript><input type="submit" name="submit" value="' . get_lang('Send') . '"/></noscript>';
52
+    $output .= '<noscript><input type="submit" name="submit" value="'.get_lang('Send').'"/></noscript>';
53 53
     $output .= '</form>';
54 54
     $output .= '<script type="text/javascript">document.getElementById("openid-redirect-form").submit();</script>';
55 55
     $output .= "</body></html>";
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     $normalized_url = $url;
95 95
 
96 96
     if (stristr($url, '://') === FALSE) {
97
-        $normalized_url = 'http://' . $url;
97
+        $normalized_url = 'http://'.$url;
98 98
     }
99 99
 
100 100
     if (substr_count($normalized_url, '/') < 3) {
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             if ($encoded_message != '') {
134 134
                 $encoded_message .= '&';
135 135
             }
136
-            $encoded_message .= rawurlencode(trim($parts[0])) . '=' . rawurlencode(trim($parts[1]));
136
+            $encoded_message .= rawurlencode(trim($parts[0])).'='.rawurlencode(trim($parts[1]));
137 137
         }
138 138
     }
139 139
 
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
  */
165 165
 function _openid_nonce() {
166 166
     // YYYY-MM-DDThh:mm:ssTZD UTC, plus some optional extra unique chars
167
-    return gmstrftime('%Y-%m-%dT%H:%M:%S%Z') .
168
-            chr(mt_rand(0, 25) + 65) .
169
-            chr(mt_rand(0, 25) + 65) .
170
-            chr(mt_rand(0, 25) + 65) .
167
+    return gmstrftime('%Y-%m-%dT%H:%M:%S%Z').
168
+            chr(mt_rand(0, 25) + 65).
169
+            chr(mt_rand(0, 25) + 65).
170
+            chr(mt_rand(0, 25) + 65).
171 171
             chr(mt_rand(0, 25) + 65);
172 172
 }
173 173
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
  */
177 177
 function _openid_link_href($rel, $html) {
178 178
     $rel = preg_quote($rel);
179
-    preg_match('|<link\s+rel=["\'](.*)' . $rel . '(.*)["\'](.*)/?>|iU', $html, $matches);
179
+    preg_match('|<link\s+rel=["\'](.*)'.$rel.'(.*)["\'](.*)/?>|iU', $html, $matches);
180 180
     if (isset($matches[3])) {
181 181
         preg_match('|href=["\']([^"]+)["\']|iU', $matches[0], $href);
182 182
         return trim($href[1]);
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
  * Pull the http-equiv attribute out of an html meta element
189 189
  */
190 190
 function _openid_meta_httpequiv($equiv, $html) {
191
-    preg_match('|<meta\s+http-equiv=["\']' . $equiv . '["\'](.*)/?>|iU', $html, $matches);
191
+    preg_match('|<meta\s+http-equiv=["\']'.$equiv.'["\'](.*)/?>|iU', $html, $matches);
192 192
     if (isset($matches[1])) {
193 193
         preg_match('|content=["\']([^"]+)["\']|iU', $matches[1], $content);
194 194
         return $content[1];
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
     $sign_data = array();
210 210
 
211 211
     foreach ($keys_to_sign as $key) {
212
-        if (isset($message_array['openid.' . $key])) {
213
-            $sign_data[$key] = $message_array['openid.' . $key];
212
+        if (isset($message_array['openid.'.$key])) {
213
+            $sign_data[$key] = $message_array['openid.'.$key];
214 214
         }
215 215
     }
216 216
 
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
     $key = str_pad($key, OPENID_SHA1_BLOCKSIZE, chr(0x00));
230 230
     $ipad = str_repeat(chr(0x36), OPENID_SHA1_BLOCKSIZE);
231 231
     $opad = str_repeat(chr(0x5c), OPENID_SHA1_BLOCKSIZE);
232
-    $hash1 = _openid_sha1(($key ^ $ipad) . $text, true);
233
-    $hmac = _openid_sha1(($key ^ $opad) . $hash1, true);
232
+    $hash1 = _openid_sha1(($key ^ $ipad).$text, true);
233
+    $hmac = _openid_sha1(($key ^ $opad).$hash1, true);
234 234
 
235 235
     return $hmac;
236 236
 }
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
     }
338 338
 
339 339
     do {
340
-        $bytes = "\x00" . _openid_get_bytes($nbytes);
340
+        $bytes = "\x00"._openid_get_bytes($nbytes);
341 341
         $n = _openid_dh_binary_to_long($bytes);
342 342
         // Keep looping if this value is in the low duplicated range.
343 343
     } while (bccomp($n, $duplicate) < 0);
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,8 +61,9 @@
 block discarded – undo
61 61
  */
62 62
 function _openid_is_xri($identifier) {
63 63
     $firstchar = substr($identifier, 0, 1);
64
-    if ($firstchar == "@" || $firstchar == "=")
65
-        return TRUE;
64
+    if ($firstchar == "@" || $firstchar == "=") {
65
+            return TRUE;
66
+    }
66 67
 
67 68
     if (stristr($identifier, 'xri://') !== FALSE) {
68 69
         return TRUE;
Please login to merge, or discard this patch.
main/auth/shibboleth/app/model/shibboleth_store.class.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 
18 18
     /**
19 19
      *
20
-     * @return ShibbolethData 
20
+     * @return ShibbolethStore 
21 21
      */
22 22
     public static function instance()
23 23
     {
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -168,12 +168,10 @@
 block discarded – undo
168 168
                 if (empty($result))
169 169
                 {
170 170
                     $result = $default;
171
-                }
172
-                else if (count($result) == 1)
171
+                } else if (count($result) == 1)
173 172
                 {
174 173
                     $result = reset($result);
175
-                }
176
-                else
174
+                } else
177 175
                 {
178 176
                     $result = $result;
179 177
                 }
Please login to merge, or discard this patch.
main/auth/shibboleth/app/model/user.class.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -56,6 +56,9 @@
 block discarded – undo
56 56
         return $this->get(array('shibb_unique_id' => $id));
57 57
     }
58 58
     
59
+    /**
60
+     * @param string $id
61
+     */
59 62
     public function shibboleth_id_exists($id)
60 63
     {
61 64
         return $this->exist(array('shibb_unique_id' => $id));
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 namespace Shibboleth;
4 4
 
5
-require_once dirname(__FILE__) . '/scaffold/user.class.php';
5
+require_once dirname(__FILE__).'/scaffold/user.class.php';
6 6
 
7 7
 /**
8 8
  * A Chamilo user. Model for the User table.
Please login to merge, or discard this patch.
main/auth/shibboleth/app/shibboleth.class.php 2 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 
129 129
     /**
130 130
      *
131
-     * @param ShibbolethUser $user
131
+     * @param ShibbolethUser $shibb_user
132 132
      */
133 133
     public static function save($shibb_user)
134 134
     {
@@ -230,6 +230,7 @@  discard block
 block discarded – undo
230 230
      * Sends an email to the Chamilo and Shibboleth administrators in the name
231 231
      * of the logged-in user.
232 232
      *
233
+     * @param string $subject
233 234
      */
234 235
     public static function email_admin($subject, $message)
235 236
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,14 +78,14 @@
 block discarded – undo
78 78
 
79 79
     public static function sys_path()
80 80
     {
81
-        $path = dirname(__FILE__) . '/../';
81
+        $path = dirname(__FILE__).'/../';
82 82
         return $path;
83 83
     }
84 84
 
85 85
     public static function url($path = '')
86 86
     {
87 87
         $result = api_get_path('WEB_PATH');
88
-        $result .= '/main/auth/shibboleth/' . $path;
88
+        $result .= '/main/auth/shibboleth/'.$path;
89 89
         return $result;
90 90
     }
91 91
 
Please login to merge, or discard this patch.
main/auth/shibboleth/db/shibboleth_upgrade.class.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
      * Creates the 'shibb_unique_id' field in the table 'user' of the main Chamilo database if it doesn't exist yet
36 36
      *
37 37
      * @author Nicolas Rod
38
-     * @return void
38
+     * @return false|null
39 39
      */
40 40
     public static function create_shibb_unique_id_field_if_missing()
41 41
     {
Please login to merge, or discard this patch.
main/auth/shibboleth/lib/store.class.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -346,6 +346,9 @@
 block discarded – undo
346 346
         return $result;
347 347
     }
348 348
 
349
+    /**
350
+     * @param string $sql
351
+     */
349 352
     protected function execute($sql)
350 353
     {
351 354
         return Database::query($sql, null, __FILE__);
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
 
247 247
         $db_name = $this->get_db_name($object);
248 248
         $sql = "INSERT INTO `{$db_name}`.`{$this->table_name}` ";
249
-        $sql .= ' (' . join(', ', $keys) . ') ';
249
+        $sql .= ' ('.join(', ', $keys).') ';
250 250
         $sql .= 'VALUES';
251
-        $sql .= ' (' . join(', ', $values) . ') ';
251
+        $sql .= ' ('.join(', ', $values).') ';
252 252
 
253 253
         $result = $this->execute($sql);
254 254
         if ($result)
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
         $items = array();
296 296
         foreach ($args as $key => $val)
297 297
         {
298
-            $items[] = $key . ' = ' . $this->format_value($val);
298
+            $items[] = $key.' = '.$this->format_value($val);
299 299
         }
300 300
         return implode(' AND ', $items);
301 301
     }
Please login to merge, or discard this patch.
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -107,8 +107,7 @@  discard block
 block discarded – undo
107 107
         if ($this->is_new($object))
108 108
         {
109 109
             $result = $this->insert($object);
110
-        }
111
-        else
110
+        } else
112 111
         {
113 112
             $result = $this->update($object);
114 113
         }
@@ -257,8 +256,7 @@  discard block
 block discarded – undo
257 256
             $object->{$this->id_name} = $id;
258 257
             $object->{db_name} = $db_name;
259 258
             return $id;
260
-        }
261
-        else
259
+        } else
262 260
         {
263 261
             return false;
264 262
         }
@@ -278,16 +276,13 @@  discard block
 block discarded – undo
278 276
                     return '';
279 277
                 }
280 278
                 $args = array($this->pk_name, $arg);
281
-            }
282
-            else if (is_string($arg))
279
+            } else if (is_string($arg))
283 280
             {
284 281
                 return $arg;
285
-            }
286
-            else if (is_array($arg))
282
+            } else if (is_array($arg))
287 283
             {
288 284
                 $args = $arg;
289
-            }
290
-            else
285
+            } else
291 286
             {
292 287
                 return $arg;
293 288
             }
@@ -309,17 +304,14 @@  discard block
 block discarded – undo
309 304
         if (is_bool($var))
310 305
         {
311 306
             return $value ? '1' : '0';
312
-        }
313
-        else if (is_numeric($value))
307
+        } else if (is_numeric($value))
314 308
         {
315 309
             return empty($value) ? '0' : $value;
316
-        }
317
-        else if (is_string($value))
310
+        } else if (is_string($value))
318 311
         {
319 312
             $value = mysql_escape_string($value);
320 313
             return "'$value'";
321
-        }
322
-        else
314
+        } else
323 315
         {
324 316
             return $value;
325 317
         }
Please login to merge, or discard this patch.
main/auth/sso/sso.Drupal.class.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
 
91 91
     /**
92 92
      * Validates the received active connection data with the database
93
-     * @return	bool	Return the loginFailed variable value to local.inc.php
93
+     * @return	null|false	Return the loginFailed variable value to local.inc.php
94 94
      */
95 95
     public function check_user()
96 96
     {
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -22,11 +22,11 @@  discard block
 block discarded – undo
22 22
  */
23 23
 class ssoDrupal
24 24
 {
25
-    public $protocol;   // 'http://',
26
-    public $domain;     // 'localhost/project/drupal',
27
-    public $auth_uri;   // '/?q=user',
25
+    public $protocol; // 'http://',
26
+    public $domain; // 'localhost/project/drupal',
27
+    public $auth_uri; // '/?q=user',
28 28
     public $deauth_uri; // '/?q=logout',
29
-    public $referer;    // http://my.chamilo.com/main/auth/profile.php
29
+    public $referer; // http://my.chamilo.com/main/auth/profile.php
30 30
 
31 31
     /**
32 32
      * Instanciates the object, initializing all relevant URL strings
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
                     && ($sso['username'] == $uData['username'])) {
124 124
 
125 125
                     //Check if the account is active (not locked)
126
-                    if ($uData['active']=='1') {
126
+                    if ($uData['active'] == '1') {
127 127
                         // check if the expiration date has not been reached
128
-                        if (empty($uData['expiration_date']) OR $uData['expiration_date'] > date('Y-m-d H:i:s') OR $uData['expiration_date']=='0000-00-00 00:00:00') {
128
+                        if (empty($uData['expiration_date']) OR $uData['expiration_date'] > date('Y-m-d H:i:s') OR $uData['expiration_date'] == '0000-00-00 00:00:00') {
129 129
 
130 130
                             //If Multiple URL is enabled
131 131
                             if (api_get_multiple_access_url()) {
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
                                             // the user credentials are OK, which
159 159
                                             // should be protection enough
160 160
                                             // against evil URL spoofing...
161
-                                            $sso_target = api_get_path(WEB_PATH) . base64_decode($sso['ruri']);
161
+                                            $sso_target = api_get_path(WEB_PATH).base64_decode($sso['ruri']);
162 162
                                         } else {
163
-                                            $sso_target = isset($sso['target']) ? $sso['target'] : api_get_path(WEB_PATH) . 'index.php';
163
+                                            $sso_target = isset($sso['target']) ? $sso['target'] : api_get_path(WEB_PATH).'index.php';
164 164
                                         }
165
-                                        header('Location: '. $sso_target);
165
+                                        header('Location: '.$sso_target);
166 166
                                         exit;
167 167
                                     } else {
168 168
                                         // user does not have permission for this site
@@ -279,12 +279,12 @@  discard block
 block discarded – undo
279 279
         // If this is an administrator, allow him to make some changes in
280 280
         // the Chamilo profile
281 281
         if ($asAdmin && api_is_platform_admin(true)) {
282
-            return api_get_path(WEB_CODE_PATH) . "admin/user_edit.php?user_id=$userId";
282
+            return api_get_path(WEB_CODE_PATH)."admin/user_edit.php?user_id=$userId";
283 283
         }
284 284
         // If the user doesn't match a Drupal user, give the normal profile
285 285
         // link
286 286
         if ($drupalUserIdData === false) {
287
-            return api_get_path(WEB_CODE_PATH) . 'auth/profile.php';
287
+            return api_get_path(WEB_CODE_PATH).'auth/profile.php';
288 288
         }
289 289
         // In all other cases, generate a link to the Drupal profile edition
290 290
         $drupalUserId = $drupalUserIdData['value'];
Please login to merge, or discard this patch.
main/coursecopy/classes/Course.class.php 3 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -327,6 +327,7 @@  discard block
 block discarded – undo
327 327
 
328 328
     /**
329 329
     * Serialize the course with the best serializer available
330
+    * @return string
330 331
     */
331 332
     public static function serialize($course)
332 333
     {
@@ -339,6 +340,7 @@  discard block
 block discarded – undo
339 340
 
340 341
     /**
341 342
     * Unserialize the course with the best serializer available
343
+    * @param string $course
342 344
     */
343 345
     public static function unserialize($course)
344 346
     {
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -326,8 +326,8 @@  discard block
 block discarded – undo
326 326
     }
327 327
 
328 328
     /**
329
-    * Serialize the course with the best serializer available
330
-    */
329
+     * Serialize the course with the best serializer available
330
+     */
331 331
     public static function serialize($course)
332 332
     {
333 333
         if (extension_loaded('igbinary')) {
@@ -338,8 +338,8 @@  discard block
 block discarded – undo
338 338
     }
339 339
 
340 340
     /**
341
-    * Unserialize the course with the best serializer available
342
-    */
341
+     * Unserialize the course with the best serializer available
342
+     */
343 343
     public static function unserialize($course)
344 344
     {
345 345
         if (extension_loaded('igbinary')) {
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
             if (is_array($resources)) {
41 41
                 foreach ($resources as $resource) {
42 42
                     Coursecopy\Resource::setClassType($resource);
43
-                    if ($resource->links_to($resource_to_check) ) {
43
+                    if ($resource->links_to($resource_to_check)) {
44 44
                         return true;
45 45
                     }
46
-                    if ($type == RESOURCE_LEARNPATH && get_class($resource)=='CourseCopyLearnpath') {
46
+                    if ($type == RESOURCE_LEARNPATH && get_class($resource) == 'CourseCopyLearnpath') {
47 47
                         if ($resource->has_item($resource_to_check)) {
48 48
                             return true;
49 49
                         }
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function has_resources($resource_type = null)
72 72
     {
73
-        if( $resource_type != null) {
73
+        if ($resource_type != null) {
74 74
             return isset($this->resources[$resource_type]) && is_array($this->resources[$resource_type]) && (count(
75 75
                     $this->resources[$resource_type]
76 76
                 ) > 0);
@@ -177,12 +177,12 @@  discard block
 block discarded – undo
177 177
                             $description = $resource->content;
178 178
                             break;
179 179
                         case RESOURCE_THEMATIC:
180
-                            $title 			= $resource->title;
181
-                            $description 	= $resource->content;
180
+                            $title = $resource->title;
181
+                            $description = $resource->content;
182 182
                             break;
183 183
                         case RESOURCE_ATTENDANCE:
184
-                            $title 			= $resource->params['name'];
185
-                            $description 	= $resource->params['description'];
184
+                            $title = $resource->params['name'];
185
+                            $description = $resource->params['description'];
186 186
                             break;
187 187
                         case RESOURCE_WORK:
188 188
                             $title = $resource->title;
Please login to merge, or discard this patch.