Completed
Push — 1.10.x ( f409b5...1f80a0 )
by Julito
112:29 queued 56:28
created
main/inc/lib/opengraph/OpenGraph.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
 
19 19
 class OpenGraph implements Iterator
20 20
 {
21
-  /**
22
-   * There are base schema's based on type, this is just
23
-   * a map so that the schema can be obtained
24
-   *
25
-   */
21
+    /**
22
+     * There are base schema's based on type, this is just
23
+     * a map so that the schema can be obtained
24
+     *
25
+     */
26 26
     public static $TYPES = array(
27 27
         'activity' => array('activity', 'sport'),
28 28
         'business' => array('bar', 'company', 'cafe', 'hotel', 'restaurant'),
@@ -34,19 +34,19 @@  discard block
 block discarded – undo
34 34
         'website' => array('blog', 'website'),
35 35
     );
36 36
 
37
-  /**
38
-   * Holds all the Open Graph values we've parsed from a page
39
-   *
40
-   */
37
+    /**
38
+     * Holds all the Open Graph values we've parsed from a page
39
+     *
40
+     */
41 41
     private $_values = array();
42 42
 
43
-  /**
44
-   * Fetches a URI and parses it for Open Graph data, returns
45
-   * false on error.
46
-   *
47
-   * @param $URI    URI to page to parse for Open Graph data
48
-   * @return OpenGraph
49
-   */
43
+    /**
44
+     * Fetches a URI and parses it for Open Graph data, returns
45
+     * false on error.
46
+     *
47
+     * @param $URI    URI to page to parse for Open Graph data
48
+     * @return OpenGraph
49
+     */
50 50
     static public function fetch($URI) {
51 51
         $curl = curl_init($URI);
52 52
 
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
         }
70 70
     }
71 71
 
72
-  /**
73
-   * Parses HTML and extracts Open Graph data, this assumes
74
-   * the document is at least well formed.
75
-   *
76
-   * @param $HTML    HTML to parse
77
-   * @return OpenGraph
78
-   */
72
+    /**
73
+     * Parses HTML and extracts Open Graph data, this assumes
74
+     * the document is at least well formed.
75
+     *
76
+     * @param $HTML    HTML to parse
77
+     * @return OpenGraph
78
+     */
79 79
     static private function _parse($HTML) {
80 80
         $old_libxml_error = libxml_use_internal_errors(true);
81 81
 
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
         return $page;
141 141
     }
142 142
 
143
-  /**
144
-   * Helper method to access attributes directly
145
-   * Example:
146
-   * $graph->title
147
-   *
148
-   * @param $key    Key to fetch from the lookup
149
-   */
143
+    /**
144
+     * Helper method to access attributes directly
145
+     * Example:
146
+     * $graph->title
147
+     *
148
+     * @param $key    Key to fetch from the lookup
149
+     */
150 150
     public function __get($key) {
151 151
         if (array_key_exists($key, $this->_values)) {
152 152
             return $this->_values[$key];
@@ -161,29 +161,29 @@  discard block
 block discarded – undo
161 161
         }
162 162
     }
163 163
 
164
-  /**
165
-   * Return all the keys found on the page
166
-   *
167
-   * @return array
168
-   */
164
+    /**
165
+     * Return all the keys found on the page
166
+     *
167
+     * @return array
168
+     */
169 169
     public function keys() {
170 170
         return array_keys($this->_values);
171 171
     }
172 172
 
173
-  /**
174
-   * Helper method to check an attribute exists
175
-   *
176
-   * @param $key
177
-   */
173
+    /**
174
+     * Helper method to check an attribute exists
175
+     *
176
+     * @param $key
177
+     */
178 178
     public function __isset($key) {
179 179
         return array_key_exists($key, $this->_values);
180 180
     }
181 181
 
182
-  /**
183
-   * Will return true if the page has location data embedded
184
-   *
185
-   * @return boolean Check if the page has location data
186
-   */
182
+    /**
183
+     * Will return true if the page has location data embedded
184
+     *
185
+     * @return boolean Check if the page has location data
186
+     */
187 187
     public function hasLocation() {
188 188
         if (array_key_exists('latitude', $this->_values) && array_key_exists('longitude', $this->_values)) {
189 189
             return true;
@@ -197,9 +197,9 @@  discard block
 block discarded – undo
197 197
         return $valid_address;
198 198
     }
199 199
 
200
-  /**
201
-   * Iterator code
202
-   */
200
+    /**
201
+     * Iterator code
202
+     */
203 203
     private $_position = 0;
204 204
     public function rewind() { reset($this->_values); $this->_position = 0; }
205 205
     public function current() { return current($this->_values); }
Please login to merge, or discard this patch.
main/inc/lib/events_dispatcher.class.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,9 +18,11 @@
 block discarded – undo
18 18
 
19 19
         foreach ($event_config[$event_name]["actions"] as $func) {
20 20
             $execute = true;
21
-            if (!function_exists($func)) // if the function doesn't exist, we log
21
+            if (!function_exists($func)) {
22
+                // if the function doesn't exist, we log
22 23
             {
23 24
                 error_log("EventsDispatcher warning : ".$func." does not exist.");
25
+            }
24 26
                 $execute = false;
25 27
             }
26 28
 
Please login to merge, or discard this patch.
main/inc/lib/auth.lib.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -379,7 +379,7 @@
 block discarded – undo
379 379
         $sql_delete = "DELETE FROM $tucc
380 380
                       WHERE id='" . $category_id . "' and user_id='" . $current_user_id . "'";
381 381
         $resultQuery = Database::query($sql_delete);
382
-       if (Database::affected_rows($resultQuery)) {
382
+        if (Database::affected_rows($resultQuery)) {
383 383
             $result = true;
384 384
         }
385 385
         $sql = "UPDATE $TABLECOURSUSER
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
         $special_course_list = array();
47 47
         if (Database::num_rows($result) > 0) {
48 48
             while ($result_row = Database::fetch_array($result)) {
49
-                $special_course_list[] = '"' . $result_row['item_id'] . '"';
49
+                $special_course_list[] = '"'.$result_row['item_id'].'"';
50 50
             }
51 51
         }
52 52
         $without_special_courses = '';
53 53
         if (!empty($special_course_list)) {
54
-            $without_special_courses = ' AND course.id NOT IN (' . implode(',', $special_course_list) . ')';
54
+            $without_special_courses = ' AND course.id NOT IN ('.implode(',', $special_course_list).')';
55 55
         }
56 56
 
57 57
         // Secondly we select the courses that are in a category (user_course_cat<>0) and sort these according to the sort of the category
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
                 FROM $TABLECOURS course, $TABLECOURSUSER  course_rel_user
71 71
                 WHERE
72 72
                     course.id = course_rel_user.c_id AND
73
-                    course_rel_user.relation_type<>" . COURSE_RELATION_TYPE_RRHH . " AND
74
-                    course_rel_user.user_id = '" . $user_id . "' $without_special_courses
73
+                    course_rel_user.relation_type<>".COURSE_RELATION_TYPE_RRHH." AND
74
+                    course_rel_user.user_id = '" . $user_id."' $without_special_courses
75 75
                 ORDER BY course_rel_user.sort ASC";
76 76
         $result = Database::query($sql);
77 77
         $courses = array();
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     {
103 103
         $user_id = api_get_user_id();
104 104
         $table_category = Database::get_main_table(TABLE_USER_COURSE_CATEGORY);
105
-        $sql = "SELECT * FROM " . $table_category . "
105
+        $sql = "SELECT * FROM ".$table_category."
106 106
                 WHERE user_id=$user_id
107 107
                 ORDER BY sort ASC";
108 108
         $result = Database::query($sql);
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
         $special_course_list = array();
145 145
         if (Database::num_rows($result) > 0) {
146 146
             while ($result_row = Database::fetch_array($result)) {
147
-                $special_course_list[] = '"' . $result_row['item_id'] . '"';
147
+                $special_course_list[] = '"'.$result_row['item_id'].'"';
148 148
             }
149 149
         }
150 150
 
151 151
         $without_special_courses = '';
152 152
         if (!empty($special_course_list)) {
153
-            $without_special_courses = ' AND course.id NOT IN (' . implode(',', $special_course_list) . ')';
153
+            $without_special_courses = ' AND course.id NOT IN ('.implode(',', $special_course_list).')';
154 154
         }
155 155
 
156 156
         $sql = "SELECT
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
                 $TABLECOURSUSER  course_rel_user
162 162
                 WHERE
163 163
                     course.id = course_rel_user.c_id AND
164
-                    course_rel_user.user_id = '" . $user_id . "' AND
165
-                    course_rel_user.relation_type <> " . COURSE_RELATION_TYPE_RRHH . "
164
+                    course_rel_user.user_id = '".$user_id."' AND
165
+                    course_rel_user.relation_type <> " . COURSE_RELATION_TYPE_RRHH."
166 166
                     $without_special_courses
167 167
                 ORDER BY course_rel_user.user_course_cat, course_rel_user.sort ASC";
168 168
         $result = Database::query($sql);
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
         $TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
192 192
         $max_sort_value = api_max_sort_value($newcategory, $current_user);
193 193
         $sql = "UPDATE $TABLECOURSUSER SET
194
-                    user_course_cat='" . $newcategory . "',
195
-                    sort='" . ($max_sort_value + 1) . "'
194
+                    user_course_cat='".$newcategory."',
195
+                    sort='" . ($max_sort_value + 1)."'
196 196
                 WHERE
197
-                    c_id ='" . $courseId . "' AND
198
-                    user_id='" . $current_user . "' AND
197
+                    c_id ='" . $courseId."' AND
198
+                    user_id='" . $current_user."' AND
199 199
                     relation_type<>" . COURSE_RELATION_TYPE_RRHH;
200 200
         $resultQuery = Database::query($sql);
201 201
 
@@ -254,18 +254,18 @@  discard block
 block discarded – undo
254 254
             $targetCourseId = $targetCourseInfo['real_id'];
255 255
 
256 256
             $sql = "UPDATE $table
257
-                    SET sort='" . $target_course['sort'] . "'
257
+                    SET sort='".$target_course['sort']."'
258 258
                     WHERE
259
-                        c_id = '" . $courseId . "' AND
260
-                        user_id = '" . $current_user_id . "' AND
259
+                        c_id = '" . $courseId."' AND
260
+                        user_id = '" . $current_user_id."' AND
261 261
                         relation_type<>" . COURSE_RELATION_TYPE_RRHH;
262 262
 
263 263
             $result1 = Database::query($sql);
264 264
 
265
-            $sql = "UPDATE $table SET sort='" . $source_course['sort'] . "'
265
+            $sql = "UPDATE $table SET sort='".$source_course['sort']."'
266 266
                     WHERE
267
-                        c_id ='" . $targetCourseId . "' AND
268
-                        user_id='" . $current_user_id . "' AND
267
+                        c_id ='" . $targetCourseId."' AND
268
+                        user_id='" . $current_user_id."' AND
269 269
                         relation_type<>" . COURSE_RELATION_TYPE_RRHH;
270 270
 
271 271
             $result2 = Database::query($sql);
@@ -309,10 +309,10 @@  discard block
 block discarded – undo
309 309
         }
310 310
 
311 311
         if (count($target_category) > 0 && count($source_category) > 0) {
312
-            $sql_update1 = "UPDATE $table_user_defined_category SET sort='" . Database::escape_string($target_category['sort']) . "'
313
-                            WHERE id='" . intval($source_category['id']) . "' AND user_id='" . $current_user_id . "'";
314
-            $sql_update2 = "UPDATE $table_user_defined_category SET sort='" . Database::escape_string($source_category['sort']) . "'
315
-                            WHERE id='" . intval($target_category['id']) . "' AND user_id='" . $current_user_id . "'";
312
+            $sql_update1 = "UPDATE $table_user_defined_category SET sort='".Database::escape_string($target_category['sort'])."'
313
+                            WHERE id='" . intval($source_category['id'])."' AND user_id='".$current_user_id."'";
314
+            $sql_update2 = "UPDATE $table_user_defined_category SET sort='".Database::escape_string($source_category['sort'])."'
315
+                            WHERE id='" . intval($target_category['id'])."' AND user_id='".$current_user_id."'";
316 316
 
317 317
             $result1 = Database::query($sql_update2);
318 318
             $result2 = Database::query($sql_update1);
@@ -331,8 +331,8 @@  discard block
 block discarded – undo
331 331
     {
332 332
         $current_user_id = api_get_user_id();
333 333
         $table_category = Database::get_main_table(TABLE_USER_COURSE_CATEGORY);
334
-        $sql = "SELECT * FROM " . $table_category . "
335
-                WHERE user_id='" . $current_user_id . "'
334
+        $sql = "SELECT * FROM ".$table_category."
335
+                WHERE user_id='" . $current_user_id."'
336 336
                 ORDER BY sort ASC";
337 337
         $result = Database::query($sql);
338 338
         while ($row = Database::fetch_array($result)) {
@@ -355,8 +355,8 @@  discard block
 block discarded – undo
355 355
         $result = false;
356 356
         $tucc = Database::get_main_table(TABLE_USER_COURSE_CATEGORY);
357 357
         $sql = "UPDATE $tucc
358
-                SET title='" . api_htmlentities($title, ENT_QUOTES, api_get_system_encoding()) . "'
359
-                WHERE id='" . $category_id . "'";
358
+                SET title='".api_htmlentities($title, ENT_QUOTES, api_get_system_encoding())."'
359
+                WHERE id='" . $category_id."'";
360 360
         $resultQuery = Database::query($sql);
361 361
         if (Database::affected_rows($resultQuery)) {
362 362
             $result = true;
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
         $category_id = intval($category_id);
378 378
         $result = false;
379 379
         $sql_delete = "DELETE FROM $tucc
380
-                      WHERE id='" . $category_id . "' and user_id='" . $current_user_id . "'";
380
+                      WHERE id='".$category_id."' and user_id='".$current_user_id."'";
381 381
         $resultQuery = Database::query($sql_delete);
382 382
        if (Database::affected_rows($resultQuery)) {
383 383
             $result = true;
@@ -385,9 +385,9 @@  discard block
 block discarded – undo
385 385
         $sql = "UPDATE $TABLECOURSUSER
386 386
                 SET user_course_cat='0'
387 387
                 WHERE
388
-                    user_course_cat='" . $category_id . "' AND
389
-                    user_id='" . $current_user_id . "' AND
390
-                    relation_type<>" . COURSE_RELATION_TYPE_RRHH . " ";
388
+                    user_course_cat='".$category_id."' AND
389
+                    user_id='" . $current_user_id."' AND
390
+                    relation_type<>" . COURSE_RELATION_TYPE_RRHH." ";
391 391
         Database::query($sql);
392 392
 
393 393
         return $result;
@@ -420,20 +420,20 @@  discard block
 block discarded – undo
420 420
         if (Database::num_rows($special_course_result) > 0) {
421 421
             $special_course_list = array();
422 422
             while ($result_row = Database::fetch_array($special_course_result)) {
423
-                $special_course_list[] = '"' . $result_row['item_id'] . '"';
423
+                $special_course_list[] = '"'.$result_row['item_id'].'"';
424 424
             }
425 425
         }
426 426
         $without_special_courses = '';
427 427
         if (!empty($special_course_list)) {
428
-            $without_special_courses = ' AND course.code NOT IN (' . implode(',', $special_course_list) . ')';
428
+            $without_special_courses = ' AND course.code NOT IN ('.implode(',', $special_course_list).')';
429 429
         }
430 430
 
431 431
         $search_term_safe = Database::escape_string($search_term);
432 432
         $sql_find = "SELECT * FROM $courseTable
433 433
                     WHERE (
434
-                            code LIKE '%" . $search_term_safe . "%' OR
435
-                            title LIKE '%" . $search_term_safe . "%' OR
436
-                            tutor_name LIKE '%" . $search_term_safe . "%'
434
+                            code LIKE '%".$search_term_safe."%' OR
435
+                            title LIKE '%" . $search_term_safe."%' OR
436
+                            tutor_name LIKE '%" . $search_term_safe."%'
437 437
                         )
438 438
                         $without_special_courses
439 439
                     ORDER BY title, visual_code ASC
@@ -450,9 +450,9 @@  discard block
 block discarded – undo
450 450
                             ON (url_rel_course.c_id = course.id)
451 451
                             WHERE
452 452
                                 access_url_id = $url_access_id AND (
453
-                                    code LIKE '%" . $search_term_safe . "%' OR
454
-                                    title LIKE '%" . $search_term_safe . "%' OR
455
-                                    tutor_name LIKE '%" . $search_term_safe . "%'
453
+                                    code LIKE '%".$search_term_safe."%' OR
454
+                                    title LIKE '%" . $search_term_safe."%' OR
455
+                                    tutor_name LIKE '%" . $search_term_safe."%'
456 456
                                 )
457 457
                                 $without_special_courses
458 458
                             ORDER BY title, visual_code ASC
@@ -513,8 +513,8 @@  discard block
 block discarded – undo
513 513
         // (s)he can only delete the course
514 514
         $sql = "SELECT * FROM $tbl_course_user
515 515
                 WHERE
516
-                    user_id='" . $current_user_id . "' AND
517
-                    c_id ='" . $courseId . "' AND
516
+                    user_id='".$current_user_id."' AND
517
+                    c_id ='" . $courseId."' AND
518 518
                     status='1' ";
519 519
         $result_check = Database::query($sql);
520 520
         $number_of_rows = Database::num_rows($result_check);
@@ -541,17 +541,17 @@  discard block
 block discarded – undo
541 541
         $result = false;
542 542
 
543 543
         // step 1: we determine the max value of the user defined course categories
544
-        $sql = "SELECT sort FROM $tucc WHERE user_id='" . $current_user_id . "' ORDER BY sort DESC";
544
+        $sql = "SELECT sort FROM $tucc WHERE user_id='".$current_user_id."' ORDER BY sort DESC";
545 545
         $rs_sort = Database::query($sql);
546 546
         $maxsort = Database::fetch_array($rs_sort);
547 547
         $nextsort = $maxsort['sort'] + 1;
548 548
 
549 549
         // step 2: we check if there is already a category with this name, if not we store it, else we give an error.
550
-        $sql = "SELECT * FROM $tucc WHERE user_id='" . $current_user_id . "' AND title='" . $category_title . "'ORDER BY sort DESC";
550
+        $sql = "SELECT * FROM $tucc WHERE user_id='".$current_user_id."' AND title='".$category_title."'ORDER BY sort DESC";
551 551
         $rs = Database::query($sql);
552 552
         if (Database::num_rows($rs) == 0) {
553 553
             $sql_insert = "INSERT INTO $tucc (user_id, title,sort)
554
-                           VALUES ('" . $current_user_id . "', '" . api_htmlentities($category_title, ENT_QUOTES, api_get_system_encoding()) . "', '" . $nextsort . "')";
554
+                           VALUES ('".$current_user_id."', '".api_htmlentities($category_title, ENT_QUOTES, api_get_system_encoding())."', '".$nextsort."')";
555 555
             $resultQuery = Database::query($sql_insert);
556 556
             if (Database::affected_rows($resultQuery)) {
557 557
                 $result = true;
@@ -628,10 +628,10 @@  discard block
 block discarded – undo
628 628
             if (isset($_POST['course_registration_code']) && $_POST['course_registration_code'] != $all_course_information['registration_code']) {
629 629
                 return false;
630 630
             }
631
-            $message = get_lang('CourseRequiresPassword') . '<br />';
631
+            $message = get_lang('CourseRequiresPassword').'<br />';
632 632
             $message .= $all_course_information['title'].' ('.$all_course_information['visual_code'].') ';
633 633
 
634
-            $action  = api_get_path(WEB_CODE_PATH) . "auth/courses.php?action=subscribe_user_with_password&sec_token=" . $_SESSION['sec_token'];
634
+            $action  = api_get_path(WEB_CODE_PATH)."auth/courses.php?action=subscribe_user_with_password&sec_token=".$_SESSION['sec_token'];
635 635
             $form = new FormValidator('subscribe_user_with_password', 'post', $action);
636 636
             $form->addElement('hidden', 'sec_token', $_SESSION['sec_token']);
637 637
             $form->addElement('hidden', 'subscribe_user_with_password', $all_course_information['code']);
Please login to merge, or discard this patch.
main/inc/lib/thematic.lib.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $from = intval($from);
75 75
         $number_of_items = intval($number_of_items);
76 76
 
77
-        if (!in_array($direction, array('ASC','DESC'))) {
77
+        if (!in_array($direction, array('ASC', 'DESC'))) {
78 78
             $direction = 'ASC';
79 79
         }
80 80
 
@@ -97,24 +97,24 @@  discard block
 block discarded – undo
97 97
             $thematic[1] = '<a href="index.php?'.api_get_cidreq().'&action=thematic_details&thematic_id='.$thematic[0].'">'.
98 98
                 Security::remove_XSS($thematic[1], STUDENT).$session_star.'</a>';
99 99
             if (api_is_allowed_to_edit(null, true)) {
100
-                $actions  = '';
100
+                $actions = '';
101 101
 
102 102
                 if (api_get_session_id()) {
103 103
                     if (api_get_session_id() == $thematic[3]) {
104 104
                         $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic[0].'">'.
105
-                            Display::return_icon('lesson_plan.png',get_lang('ThematicPlan'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
105
+                            Display::return_icon('lesson_plan.png', get_lang('ThematicPlan'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
106 106
                         $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic[0].'">'.
107
-                            Display::return_icon('lesson_plan_calendar.png',get_lang('ThematicAdvance'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
107
+                            Display::return_icon('lesson_plan_calendar.png', get_lang('ThematicAdvance'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
108 108
 
109 109
                         $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_edit&thematic_id='.$thematic[0].'">'.
110
-                            Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>';
110
+                            Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
111 111
                         $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_delete&thematic_id='.$thematic[0].'">'.
112
-                            Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
112
+                            Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
113 113
                     } else {
114
-                        $actions .= Display::return_icon('lesson_plan_na.png',get_lang('ThematicPlan'),'',ICON_SIZE_SMALL).'&nbsp;';
115
-                        $actions .= Display::return_icon('lesson_plan_calendar_na.png',get_lang('ThematicAdvance'),'',ICON_SIZE_SMALL).'&nbsp;';
116
-                        $actions .= Display::return_icon('edit_na.png',get_lang('Edit'),'',ICON_SIZE_SMALL);
117
-                        $actions .= Display::return_icon('delete_na.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'&nbsp;';
114
+                        $actions .= Display::return_icon('lesson_plan_na.png', get_lang('ThematicPlan'), '', ICON_SIZE_SMALL).'&nbsp;';
115
+                        $actions .= Display::return_icon('lesson_plan_calendar_na.png', get_lang('ThematicAdvance'), '', ICON_SIZE_SMALL).'&nbsp;';
116
+                        $actions .= Display::return_icon('edit_na.png', get_lang('Edit'), '', ICON_SIZE_SMALL);
117
+                        $actions .= Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'&nbsp;';
118 118
                         $actions .= Display::url(
119 119
                             Display::return_icon('cd.gif', get_lang('Copy')),
120 120
                             'index.php?'.api_get_cidreq().'&action=thematic_copy&thematic_id='.$thematic[0]
@@ -122,26 +122,26 @@  discard block
 block discarded – undo
122 122
                     }
123 123
                 } else {
124 124
                     $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic[0].'">'.
125
-                        Display::return_icon('lesson_plan.png',get_lang('ThematicPlan'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
125
+                        Display::return_icon('lesson_plan.png', get_lang('ThematicPlan'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
126 126
                     $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic[0].'">'.
127
-                        Display::return_icon('lesson_plan_calendar.png',get_lang('ThematicAdvance'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
127
+                        Display::return_icon('lesson_plan_calendar.png', get_lang('ThematicAdvance'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
128 128
 
129 129
                     if ($thematic[2] > 1) {
130 130
                         $actions .= '<a href="'.api_get_self().'?action=moveup&'.api_get_cidreq().'&thematic_id='.$thematic[0].'">'.
131
-                            Display::return_icon('up.png', get_lang('Up'),'',ICON_SIZE_SMALL).'</a>';
131
+                            Display::return_icon('up.png', get_lang('Up'), '', ICON_SIZE_SMALL).'</a>';
132 132
                     } else {
133
-                        $actions .= Display::return_icon('up_na.png','&nbsp;','',ICON_SIZE_SMALL);
133
+                        $actions .= Display::return_icon('up_na.png', '&nbsp;', '', ICON_SIZE_SMALL);
134 134
                     }
135 135
                     if ($thematic[2] < self::get_max_thematic_item()) {
136 136
                         $actions .= '<a href="'.api_get_self().'?action=movedown&a'.api_get_cidreq().'&thematic_id='.$thematic[0].'">'.
137
-                            Display::return_icon('down.png',get_lang('Down'),'',ICON_SIZE_SMALL).'</a>';
137
+                            Display::return_icon('down.png', get_lang('Down'), '', ICON_SIZE_SMALL).'</a>';
138 138
                     } else {
139
-                        $actions .= Display::return_icon('down_na.png','&nbsp;','',ICON_SIZE_SMALL);
139
+                        $actions .= Display::return_icon('down_na.png', '&nbsp;', '', ICON_SIZE_SMALL);
140 140
                     }
141 141
                     $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_edit&thematic_id='.$thematic[0].'">'.
142
-                        Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>';
142
+                        Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
143 143
                     $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_delete&thematic_id='.$thematic[0].'">'.
144
-                        Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
144
+                        Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
145 145
                 }
146 146
                 $thematics[] = array($thematic[0], $thematic[1], $actions);
147 147
             }
@@ -278,9 +278,9 @@  discard block
 block discarded – undo
278 278
         $res = Database::query($sql);
279 279
         if (Database::num_rows($res) > 0) {
280 280
             if (!empty($thematic_id)) {
281
-                $data = Database::fetch_array($res,'ASSOC');
281
+                $data = Database::fetch_array($res, 'ASSOC');
282 282
             } else {
283
-                while ($row = Database::fetch_array($res,'ASSOC')) {
283
+                while ($row = Database::fetch_array($res, 'ASSOC')) {
284 284
                     $data[$row['id']] = $row;
285 285
                 }
286 286
             }
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 
376 376
         if (is_array($thematic_id)) {
377 377
             foreach ($thematic_id as $id) {
378
-                $id	= intval($id);
378
+                $id = intval($id);
379 379
                 $sql = "UPDATE $tbl_thematic SET active = 0
380 380
                         WHERE c_id = $course_id AND id = $id";
381 381
                 $result = Database::query($sql);
@@ -391,8 +391,8 @@  discard block
 block discarded – undo
391 391
                     );
392 392
                 }
393 393
             }
394
-        } else  {
395
-            $thematic_id	= intval($thematic_id);
394
+        } else {
395
+            $thematic_id = intval($thematic_id);
396 396
             $sql = "UPDATE $tbl_thematic SET active = 0
397 397
                     WHERE c_id = $course_id AND id = $thematic_id";
398 398
             $result = Database::query($sql);
@@ -428,8 +428,8 @@  discard block
 block discarded – undo
428 428
         $new_thematic_id = $thematic_copy->thematic_save();
429 429
         if (!empty($new_thematic_id)) {
430 430
             $thematic_advanced = self::get_thematic_advance_by_thematic_id($thematic_id);
431
-            if(!empty($thematic_advanced)) {
432
-                foreach($thematic_advanced as $item) {
431
+            if (!empty($thematic_advanced)) {
432
+                foreach ($thematic_advanced as $item) {
433 433
                     $thematic = new Thematic();
434 434
                     $thematic->set_thematic_advance_attributes(
435 435
                         0,
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
         $column = intval($column);
493 493
         $from   = intval($from);
494 494
         $number_of_items = intval($number_of_items);
495
-        if (!in_array($direction, array('ASC','DESC'))) {
495
+        if (!in_array($direction, array('ASC', 'DESC'))) {
496 496
             $direction = 'ASC';
497 497
         }
498 498
         $data = array();
@@ -525,8 +525,8 @@  discard block
 block discarded – undo
525 525
                     $thematic_advance[1] = api_get_local_time($thematic_advance[1]);
526 526
                     $thematic_advance[1] = api_format_date($thematic_advance[1], DATE_TIME_FORMAT_LONG);
527 527
                     $actions  = '';
528
-                    $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_edit&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('edit.png',get_lang('Edit'),'',22).'</a>';
529
-                    $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_advance_delete&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('delete.png',get_lang('Delete'),'',22).'</a></center>';
528
+                    $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_edit&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('edit.png', get_lang('Edit'), '', 22).'</a>';
529
+                    $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_advance_delete&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('delete.png', get_lang('Delete'), '', 22).'</a></center>';
530 530
                     $data[] = array($i, $thematic_advance[1], $thematic_advance[2], $thematic_advance[3], $actions);
531 531
                     $i++;
532 532
                 }
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 
591 591
                 $session_star = '';
592 592
                 if (api_is_allowed_to_edit(null, true)) {
593
-                    if ($thematic_advance['session_id'] !=0) {
593
+                    if ($thematic_advance['session_id'] != 0) {
594 594
                         $session_star = api_get_session_image(api_get_session_id(), $uinfo['status']);
595 595
                     }
596 596
                 }
@@ -616,13 +616,13 @@  discard block
 block discarded – undo
616 616
 
617 617
         foreach ($data as $thematic_id => $thematic_plan_data) {
618 618
             $new_thematic_plan_data = array();
619
-            foreach($thematic_plan_data as $thematic_item) {
619
+            foreach ($thematic_plan_data as $thematic_item) {
620 620
                 $thematic_simple_list[] = $thematic_item['description_type'];
621 621
                 $new_thematic_plan_data[$thematic_item['description_type']] = $thematic_item;
622 622
             }
623 623
 
624 624
             if (!empty($thematic_simple_list)) {
625
-                foreach($thematic_simple_list as $item) {
625
+                foreach ($thematic_simple_list as $item) {
626 626
                     $default_thematic_plan_title[$item] = $new_thematic_plan_data[$item]['title'];
627 627
                 }
628 628
             }
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
                     }
639 639
                     if (!empty($data[$thematic_id][$id]['title']) && !empty($data[$thematic_id][$id]['description'])) {
640 640
                         if (api_is_allowed_to_edit(null, true)) {
641
-                            if ($data[$thematic_id][$id]['session_id'] !=0) {
641
+                            if ($data[$thematic_id][$id]['session_id'] != 0) {
642 642
                                 $session_star = api_get_session_image(api_get_session_id(), $uinfo['status']);
643 643
                             }
644 644
                         }
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
             if ($no_data) {
652 652
                 $return .= '<div><em>'.get_lang('StillDoNotHaveAThematicPlan').'</em></div>';
653 653
             }
654
-            $return  .= '</div>';
654
+            $return .= '</div>';
655 655
             $final_return[$thematic_id] = $return;
656 656
         }
657 657
         return $final_return;
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
                 api_get_session_id()
692 692
             );
693 693
             foreach ($list as $value) {
694
-                $elements[$value['ref']]= $value;
694
+                $elements[$value['ref']] = $value;
695 695
             }
696 696
         }
697 697
 
@@ -865,18 +865,18 @@  discard block
 block discarded – undo
865 865
             api_get_session_id()
866 866
         );
867 867
 
868
-        $thematic_plan_complete_list  = array();
868
+        $thematic_plan_complete_list = array();
869 869
         $thematic_plan_id_list = array();
870 870
 
871 871
         if (!empty($items_from_course)) {
872
-            foreach($items_from_course as $item) {
872
+            foreach ($items_from_course as $item) {
873 873
                 $thematic_plan_id_list[] = $item['ref'];
874 874
                 $thematic_plan_complete_list[$item['ref']] = $item;
875 875
             }
876 876
         }
877 877
 
878 878
         if (!empty($items_from_session)) {
879
-            foreach($items_from_session as $item) {
879
+            foreach ($items_from_session as $item) {
880 880
                 $thematic_plan_id_list[] = $item['ref'];
881 881
                 $thematic_plan_complete_list[$item['ref']] = $item;
882 882
             }
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
                 if (!isset($thematic_id) && !isset($description_type)) {
899 899
                     // group all data group by thematic id
900 900
                     $tmp = array();
901
-                    while ($row = Database::fetch_array($rs,'ASSOC')) {
901
+                    while ($row = Database::fetch_array($rs, 'ASSOC')) {
902 902
                         $tmp[] = $row['thematic_id'];
903 903
                         if (in_array($row['thematic_id'], $tmp)) {
904 904
                             $row['session_id'] = $thematic_plan_complete_list[$row['id']];
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
                         }
907 907
                     }
908 908
                 } else {
909
-                    while ($row = Database::fetch_array($rs,'ASSOC')) {
909
+                    while ($row = Database::fetch_array($rs, 'ASSOC')) {
910 910
                         $row['session_id'] = $thematic_plan_complete_list[$row['id']];
911 911
                         $data[] = $row;
912 912
                     }
@@ -941,8 +941,8 @@  discard block
 block discarded – undo
941 941
         );
942 942
 
943 943
         $elements_to_show = array();
944
-        foreach($list as $value) {
945
-            $elements_to_show[]= $value['ref'];
944
+        foreach ($list as $value) {
945
+            $elements_to_show[] = $value['ref'];
946 946
         }
947 947
         $condition = '';
948 948
         if (!empty($elements_to_show)) {
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
                     c_id = $course_id AND
955 955
                     thematic_id = $thematic_id AND
956 956
                     description_type = '$description_type'";
957
-        $rs	 = Database::query($sql);
957
+        $rs = Database::query($sql);
958 958
 
959 959
         $affected_rows = 0;
960 960
         if (Database::num_rows($rs) > 0) {
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
             $diff = array_diff($all, $a_thematic_advance_ids);
1191 1191
             if (!empty($diff)) {
1192 1192
                 $upd = "UPDATE $tbl_thematic_advance SET done_advance = 0
1193
-    			        WHERE c_id = $course_id AND id IN(".implode(',',$diff).") ";
1193
+    			        WHERE c_id = $course_id AND id IN(".implode(',', $diff).") ";
1194 1194
                 Database::query($upd);
1195 1195
             }
1196 1196
 
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
             $course_code = api_get_course_id();
1305 1305
         }
1306 1306
         if (api_get_session_id()) {
1307
-            $thematic_data = $this->get_thematic_list(null, $course_code );
1307
+            $thematic_data = $this->get_thematic_list(null, $course_code);
1308 1308
         } else {
1309 1309
             $thematic_data = $this->get_thematic_list(null, $course_code, 0);
1310 1310
         }
@@ -1356,7 +1356,7 @@  discard block
 block discarded – undo
1356 1356
             }
1357 1357
             // calculate average by thematic
1358 1358
             $count_total_advances = count($advances);
1359
-            $average = round(($count_done_advances*100)/$count_total_advances);
1359
+            $average = round(($count_done_advances * 100) / $count_total_advances);
1360 1360
         }
1361 1361
 
1362 1362
         return $average;
@@ -1447,12 +1447,12 @@  discard block
 block discarded – undo
1447 1447
     public function get_default_thematic_plan_title()
1448 1448
     {
1449 1449
         $default_thematic_plan_titles = array();
1450
-        $default_thematic_plan_titles[1]= get_lang('Objectives');
1451
-        $default_thematic_plan_titles[2]= get_lang('SkillToAcquire');
1452
-        $default_thematic_plan_titles[3]= get_lang('Methodology');
1453
-        $default_thematic_plan_titles[4]= get_lang('Infrastructure');
1454
-        $default_thematic_plan_titles[5]= get_lang('Assessment');
1455
-        $default_thematic_plan_titles[6]= get_lang('Others');
1450
+        $default_thematic_plan_titles[1] = get_lang('Objectives');
1451
+        $default_thematic_plan_titles[2] = get_lang('SkillToAcquire');
1452
+        $default_thematic_plan_titles[3] = get_lang('Methodology');
1453
+        $default_thematic_plan_titles[4] = get_lang('Infrastructure');
1454
+        $default_thematic_plan_titles[5] = get_lang('Assessment');
1455
+        $default_thematic_plan_titles[6] = get_lang('Others');
1456 1456
 
1457 1457
         return $default_thematic_plan_titles;
1458 1458
     }
@@ -1464,12 +1464,12 @@  discard block
 block discarded – undo
1464 1464
     public function get_default_thematic_plan_icon()
1465 1465
     {
1466 1466
         $default_thematic_plan_icon = array();
1467
-        $default_thematic_plan_icon[1]= 'icons/32/objective.png';
1468
-        $default_thematic_plan_icon[2]= 'icons/32/skills.png';
1469
-        $default_thematic_plan_icon[3]= 'icons/32/strategy.png';
1470
-        $default_thematic_plan_icon[4]= 'icons/32/laptop.png';
1471
-        $default_thematic_plan_icon[5]= 'icons/32/assessment.png';
1472
-        $default_thematic_plan_icon[6]= 'icons/32/wizard.png';
1467
+        $default_thematic_plan_icon[1] = 'icons/32/objective.png';
1468
+        $default_thematic_plan_icon[2] = 'icons/32/skills.png';
1469
+        $default_thematic_plan_icon[3] = 'icons/32/strategy.png';
1470
+        $default_thematic_plan_icon[4] = 'icons/32/laptop.png';
1471
+        $default_thematic_plan_icon[5] = 'icons/32/assessment.png';
1472
+        $default_thematic_plan_icon[6] = 'icons/32/wizard.png';
1473 1473
 
1474 1474
         return $default_thematic_plan_icon;
1475 1475
     }
@@ -1481,11 +1481,11 @@  discard block
 block discarded – undo
1481 1481
     public function get_default_question()
1482 1482
     {
1483 1483
         $question = array();
1484
-        $question[1]= get_lang('ObjectivesQuestions');
1485
-        $question[2]= get_lang('SkillToAcquireQuestions');
1486
-        $question[3]= get_lang('MethodologyQuestions');
1487
-        $question[4]= get_lang('InfrastructureQuestions');
1488
-        $question[5]= get_lang('AssessmentQuestions');
1484
+        $question[1] = get_lang('ObjectivesQuestions');
1485
+        $question[2] = get_lang('SkillToAcquireQuestions');
1486
+        $question[3] = get_lang('MethodologyQuestions');
1487
+        $question[4] = get_lang('InfrastructureQuestions');
1488
+        $question[5] = get_lang('AssessmentQuestions');
1489 1489
 
1490 1490
         return $question;
1491 1491
     }
Please login to merge, or discard this patch.
main/inc/lib/internationalization.lib.php 4 patches
Indentation   +21 added lines, -22 removed lines patch added patch discarded remove patch
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
     if (isset($_configuration['language_measure_frequency']) &&
104 104
         $_configuration['language_measure_frequency'] == 1
105 105
     ) {
106
-      require_once api_get_path(SYS_CODE_PATH).'/cron/lang/langstats.class.php';
107
-      global $langstats;
108
-      $langstats->add_use($variable,'');
106
+        require_once api_get_path(SYS_CODE_PATH).'/cron/lang/langstats.class.php';
107
+        global $langstats;
108
+        $langstats->add_use($variable,'');
109 109
     }
110 110
 
111 111
     if (!isset($used_lang_vars)) {
112
-    	$used_lang_vars = array();
112
+        $used_lang_vars = array();
113 113
     }
114 114
 
115 115
     // Caching results from some API functions, for speed.
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
     static $text_direction = array();
306 306
 
307 307
     if (empty($language)) {
308
-    	$language = api_get_interface_language();
308
+        $language = api_get_interface_language();
309 309
     }
310 310
     if (!isset($text_direction[$language])) {
311 311
         $text_direction[$language] = in_array(api_purify_language_id($language),
@@ -536,24 +536,24 @@  discard block
 block discarded – undo
536 536
             case DATE_FORMAT_ONLY_DAYNAME:
537 537
                 $date_format = get_lang('dateFormatOnlyDayName', '', $language);
538 538
                 if (INTL_INSTALLED) {
539
-        			$datetype = IntlDateFormatter::SHORT;
540
-        			$timetype = IntlDateFormatter::NONE;
541
-        		}
539
+                    $datetype = IntlDateFormatter::SHORT;
540
+                    $timetype = IntlDateFormatter::NONE;
541
+                }
542 542
                 break;
543 543
             case DATE_FORMAT_NUMBER_NO_YEAR:
544 544
                 $date_format = get_lang('dateFormatShortNumberNoYear', '', $language);
545
-        		if (INTL_INSTALLED) {
546
-        			$datetype = IntlDateFormatter::SHORT;
547
-        			$timetype = IntlDateFormatter::NONE;
548
-        		}
545
+                if (INTL_INSTALLED) {
546
+                    $datetype = IntlDateFormatter::SHORT;
547
+                    $timetype = IntlDateFormatter::NONE;
548
+                }
549
+                break;
550
+            case DATE_FORMAT_NUMBER:
551
+                $date_format = get_lang('dateFormatShortNumber', '', $language);
552
+                if (INTL_INSTALLED) {
553
+                    $datetype = IntlDateFormatter::SHORT;
554
+                    $timetype = IntlDateFormatter::NONE;
555
+                }
549 556
                 break;
550
-        	case DATE_FORMAT_NUMBER:
551
-        		$date_format = get_lang('dateFormatShortNumber', '', $language);
552
-        		if (INTL_INSTALLED) {
553
-        			$datetype = IntlDateFormatter::SHORT;
554
-        			$timetype = IntlDateFormatter::NONE;
555
-        		}
556
-        		break;
557 557
             case TIME_NO_SEC_FORMAT:
558 558
                 $date_format = get_lang('timeNoSecFormat', '', $language);
559 559
                 if (INTL_INSTALLED) {
@@ -589,14 +589,14 @@  discard block
 block discarded – undo
589 589
                     $timetype = IntlDateFormatter::SHORT;
590 590
                 }
591 591
                 break;
592
-			case DATE_TIME_FORMAT_SHORT:
592
+            case DATE_TIME_FORMAT_SHORT:
593 593
                 $date_format = get_lang('dateTimeFormatShort', '', $language);
594 594
                 if (INTL_INSTALLED) {
595 595
                     $datetype = IntlDateFormatter::FULL;
596 596
                     $timetype = IntlDateFormatter::SHORT;
597 597
                 }
598 598
                 break;
599
-			case DATE_TIME_FORMAT_SHORT_TIME_FIRST:
599
+            case DATE_TIME_FORMAT_SHORT_TIME_FIRST:
600 600
                 $date_format = get_lang('dateTimeFormatShortTimeFirst', '', $language);
601 601
                 if (INTL_INSTALLED) {
602 602
                     $datetype = IntlDateFormatter::FULL;
@@ -1817,7 +1817,6 @@  discard block
 block discarded – undo
1817 1817
 
1818 1818
 /**
1819 1819
  * Return true a date is valid
1820
-
1821 1820
  * @param string $date example: 2014-06-30 13:05:05
1822 1821
  * @param string $format example: "Y-m-d H:i:s"
1823 1822
  *
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1710,8 +1710,7 @@
 block discarded – undo
1710 1710
             }
1711 1711
         }
1712 1712
         return false;
1713
-    }
1714
-    elseif (is_array($encoding2)) {
1713
+    } elseif (is_array($encoding2)) {
1715 1714
         foreach ($encoding2 as $encoding) {
1716 1715
             if (api_equal_encodings($encoding1, $encoding, $strict)) {
1717 1716
                 return true;
Please login to merge, or discard this patch.
Doc Comments   +17 added lines, -11 removed lines patch added patch discarded remove patch
@@ -437,6 +437,7 @@  discard block
 block discarded – undo
437 437
  * If null, the timezone will be determined based on user preference,
438 438
  * or timezone chosen by the admin for the platform.
439 439
  * @param string The timezone to be converted from. If null, UTC will be assumed.
440
+ * @param string $to_timezone
440 441
  * @return string The converted time formatted as Y-m-d H:i:s
441 442
  *
442 443
  * @author Guillaume Viguier <[email protected]>
@@ -793,6 +794,7 @@  discard block
 block discarded – undo
793 794
  * @param mixed The time to be converted
794 795
  * @param mixed Format to be used (TIME_NO_SEC_FORMAT, DATE_FORMAT_SHORT, DATE_FORMAT_LONG, DATE_TIME_FORMAT_LONG)
795 796
  * @param string Timezone to be converted from. If null, UTC will be assumed.
797
+ * @param string $from_timezone
796 798
  * @return string Converted and localized date
797 799
  *
798 800
  * @author Guillaume Viguier <[email protected]>
@@ -862,7 +864,7 @@  discard block
 block discarded – undo
862 864
  * @param int/string $format (optional)	The person name format. It may be a pattern-string (for example '%t %l, %f' or '%T %F %L', ...) or some of the constants PERSON_NAME_COMMON_CONVENTION (default), PERSON_NAME_WESTERN_ORDER, PERSON_NAME_EASTERN_ORDER, PERSON_NAME_LIBRARY_ORDER.
863 865
  * @param string $language (optional)	The language id. If it is omitted, the current interface language is assumed. This parameter has meaning with the format PERSON_NAME_COMMON_CONVENTION only.
864 866
  * @param string $encoding (optional)	The used internally by this function character encoding. If it is omitted, the platform character set will be used by default.
865
- * @return bool							The result is sort of full name of the person.
867
+ * @return string							The result is sort of full name of the person.
866 868
  * Sample results:
867 869
  * Peter Ustinoff or Dr. Peter Ustinoff     - the Western order
868 870
  * Ustinoff Peter or Dr. Ustinoff Peter     - the Eastern order
@@ -956,7 +958,7 @@  discard block
 block discarded – undo
956 958
 
957 959
 /**
958 960
  * Checks whether a given format represents person name in Western order (for which first name is first).
959
- * @param int/string $format (optional)	The person name format. It may be a pattern-string (for example '%t. %l, %f') or some of the constants PERSON_NAME_COMMON_CONVENTION (default), PERSON_NAME_WESTERN_ORDER, PERSON_NAME_EASTERN_ORDER, PERSON_NAME_LIBRARY_ORDER.
961
+ * @param integer $format (optional)	The person name format. It may be a pattern-string (for example '%t. %l, %f') or some of the constants PERSON_NAME_COMMON_CONVENTION (default), PERSON_NAME_WESTERN_ORDER, PERSON_NAME_EASTERN_ORDER, PERSON_NAME_LIBRARY_ORDER.
960 962
  * @param string $language (optional)	The language id. If it is omitted, the current interface language is assumed. This parameter has meaning with the format PERSON_NAME_COMMON_CONVENTION only.
961 963
  * @return bool							The result TRUE means that the order is first_name last_name, FALSE means last_name first_name.
962 964
  * Note: You may use this function for determing the order of the fields or columns "First name" and "Last name" in forms, tables and reports.
@@ -1184,8 +1186,8 @@  discard block
 block discarded – undo
1184 1186
 
1185 1187
 /**
1186 1188
  * This function returns a string or an array with all occurrences of search in subject (ignoring case) replaced with the given replace value.
1187
- * @param mixed $search					String or array of strings to be found.
1188
- * @param mixed $replace				String or array of strings used for replacement.
1189
+ * @param string $search					String or array of strings to be found.
1190
+ * @param string $replace				String or array of strings used for replacement.
1189 1191
  * @param mixed $subject				String or array of strings being searched.
1190 1192
  * @param int $count (optional)			The number of matched and replaced needles will be returned in count, which is passed by reference.
1191 1193
  * @param string $encoding (optional)	The used internally by this function character encoding.
@@ -1248,10 +1250,10 @@  discard block
 block discarded – undo
1248 1250
 /**
1249 1251
  * Finds first occurrence of a string within another, case insensitive.
1250 1252
  * @param string $haystack					The string from which to get the first occurrence.
1251
- * @param mixed $needle						The string to be found.
1253
+ * @param string $needle						The string to be found.
1252 1254
  * @param bool $before_needle (optional)	Determines which portion of $haystack this function returns. The default value is FALSE.
1253 1255
  * @param string $encoding (optional)		The used internally by this function character encoding. If it is omitted, the platform character set will be used by default.
1254
- * @return mixed							Returns the portion of $haystack, or FALSE if $needle is not found.
1256
+ * @return false|string							Returns the portion of $haystack, or FALSE if $needle is not found.
1255 1257
  * Notes:
1256 1258
  * If $needle is not a string, it is converted to an integer and applied as the ordinal value (codepoint if the encoding is UTF-8) of a character.
1257 1259
  * If $before_needle is set to TRUE, the function returns all of $haystack from the beginning to the first occurrence of $needle.
@@ -1307,7 +1309,7 @@  discard block
 block discarded – undo
1307 1309
  * @param mixed $needle						The string which first character is to be found.
1308 1310
  * @param bool $before_needle (optional)	Determines which portion of $haystack this function returns. The default value is FALSE.
1309 1311
  * @param string $encoding (optional)		The used internally by this function character encoding. If it is omitted, the platform character set will be used by default.
1310
- * @return mixed							Returns the portion of $haystack, or FALSE if the first character from $needle is not found.
1312
+ * @return false|string							Returns the portion of $haystack, or FALSE if the first character from $needle is not found.
1311 1313
  * Notes:
1312 1314
  * If $needle is not a string, it is converted to an integer and applied as the ordinal value (codepoint if the encoding is UTF-8) of a character.
1313 1315
  * If $before_needle is set to TRUE, the function returns all of $haystack from the beginning to the first occurrence.
@@ -1374,7 +1376,7 @@  discard block
 block discarded – undo
1374 1376
  * @param mixed $needle						The string to be found.
1375 1377
  * @param bool $before_needle (optional)	Determines which portion of $haystack this function returns. The default value is FALSE.
1376 1378
  * @param string $encoding (optional)		The used internally by this function character encoding. If it is omitted, the platform character set will be used by default.
1377
- * @return mixed							Returns the portion of $haystack, or FALSE if $needle is not found.
1379
+ * @return false|string							Returns the portion of $haystack, or FALSE if $needle is not found.
1378 1380
  * Notes:
1379 1381
  * If $needle is not a string, it is converted to an integer and applied as the ordinal value (codepoint if the encoding is UTF-8) of a character.
1380 1382
  * If $before_needle is set to TRUE, the function returns all of $haystack from the beginning to the first occurrence of $needle.
@@ -1555,8 +1557,8 @@  discard block
 block discarded – undo
1555 1557
 
1556 1558
 /**
1557 1559
  * Performs a regular expression search and replace, UTF-8 aware when it is applicable.
1558
- * @param string|array $pattern			The pattern to search for. It can be either a string or an array with strings.
1559
- * @param string|array $replacement		The string or an array with strings to replace.
1560
+ * @param string $pattern			The pattern to search for. It can be either a string or an array with strings.
1561
+ * @param string $replacement		The string or an array with strings to replace.
1560 1562
  * @param string|array $subject			The string or an array with strings to search and replace.
1561 1563
  * @param int $limit					The maximum possible replacements for each pattern in each subject string. Defaults to -1 (no limit).
1562 1564
  * @param int &$count					If specified, this variable will be filled with the number of replacements done.
@@ -1808,6 +1810,7 @@  discard block
 block discarded – undo
1808 1810
 /**
1809 1811
  * Checks a string for UTF-8 validity.
1810 1812
  *
1813
+ * @param string $string
1811 1814
  */
1812 1815
 function api_is_valid_utf8(&$string)
1813 1816
 {
@@ -1950,7 +1953,7 @@  discard block
 block discarded – undo
1950 1953
 /**
1951 1954
  * Replaces non-valid formats for person names with the default (English) format.
1952 1955
  * @param string $format	The input format to be verified.
1953
- * @return bool				Returns the same format if is is valid, otherwise returns a valid English format.
1956
+ * @return string				Returns the same format if is is valid, otherwise returns a valid English format.
1954 1957
  */
1955 1958
 function _api_validate_person_name_format($format) {
1956 1959
     if (empty($format) || stripos($format, '%f') === false || stripos($format, '%l') === false) {
@@ -2077,6 +2080,9 @@  discard block
 block discarded – undo
2077 2080
 
2078 2081
 // This function checks whether the function _api_convert_encoding() (the php-
2079 2082
 // implementation) is able to convert from/to a given encoding.
2083
+/**
2084
+ * @param string $encoding
2085
+ */
2080 2086
 function _api_convert_encoding_supports($encoding) {
2081 2087
     static $supports = array();
2082 2088
     if (!isset($supports[$encoding])) {
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     ) {
95 95
       require_once api_get_path(SYS_CODE_PATH).'/cron/lang/langstats.class.php';
96 96
       global $langstats;
97
-      $langstats->add_use($variable,'');
97
+      $langstats->add_use($variable, '');
98 98
     }
99 99
 
100 100
     if (!isset($used_lang_vars)) {
@@ -643,10 +643,10 @@  discard block
 block discarded – undo
643 643
         // We replace %a %A %b %B masks of date format with translated strings
644 644
         $translated = &_api_get_day_month_names($language);
645 645
         $date_format = str_replace(array('%A', '%a', '%B', '%b'),
646
-        array($translated['days_long'][(int)strftime('%w', $time )],
647
-            $translated['days_short'][(int)strftime('%w', $time)],
648
-            $translated['months_long'][(int)strftime('%m', $time) - 1],
649
-            $translated['months_short'][(int)strftime('%m', $time) - 1]),
646
+        array($translated['days_long'][(int) strftime('%w', $time)],
647
+            $translated['days_short'][(int) strftime('%w', $time)],
648
+            $translated['months_long'][(int) strftime('%m', $time) - 1],
649
+            $translated['months_short'][(int) strftime('%m', $time) - 1]),
650 650
         $date_format);
651 651
         $formatted_date = api_to_system_encoding(strftime($date_format, $time), 'UTF-8');
652 652
     }
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
         if ($seconds > $time) {
745 745
             continue;
746 746
         }
747
-        $current_value = intval($time/$seconds);
747
+        $current_value = intval($time / $seconds);
748 748
 
749 749
         if ($current_value != 1) {
750 750
             $date_str = $sec_time_plu[$i];
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
     }
762 762
 
763 763
     if (!empty($key_result)) {
764
-        if ($key_result[0] == $min_day && $key_result[1]== $min_minute) {
764
+        if ($key_result[0] == $min_day && $key_result[1] == $min_minute) {
765 765
             $key_result[1] = ' 0 '.$min_hours;
766 766
             $str_result[0] = $time_result[0].' '.$key_result[0];
767 767
             $str_result[1] = $key_result[1];
@@ -1694,7 +1694,7 @@  discard block
 block discarded – undo
1694 1694
  * @return string					Returns the encoding identificator modified in suitable for comparison way.
1695 1695
  */
1696 1696
 function api_refine_encoding_id($encoding) {
1697
-    if (is_array($encoding)){
1697
+    if (is_array($encoding)) {
1698 1698
         return array_map('api_refine_encoding_id', $encoding);
1699 1699
     }
1700 1700
     return strtoupper(str_replace('_', '-', $encoding));
Please login to merge, or discard this patch.
main/inc/lib/phpseclib/Crypt/Random.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -167,9 +167,9 @@
 block discarded – undo
167 167
             ini_set('session.use_cookies', $old_use_cookies);
168 168
             session_cache_limiter($old_session_cache_limiter);
169 169
         } else {
170
-           if (isset($_OLD_SESSION)) {
171
-               $_SESSION = $_OLD_SESSION;
172
-               unset($_OLD_SESSION);
170
+            if (isset($_OLD_SESSION)) {
171
+                $_SESSION = $_OLD_SESSION;
172
+                unset($_OLD_SESSION);
173 173
             } else {
174 174
                 unset($_SESSION);
175 175
             }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -145,12 +145,12 @@  discard block
 block discarded – undo
145 145
         session_start();
146 146
 
147 147
         $v = $seed = $_SESSION['seed'] = pack('H*', sha1(
148
-            serialize($_SERVER) .
149
-            serialize($_POST) .
150
-            serialize($_GET) .
151
-            serialize($_COOKIE) .
152
-            serialize($GLOBALS) .
153
-            serialize($_SESSION) .
148
+            serialize($_SERVER).
149
+            serialize($_POST).
150
+            serialize($_GET).
151
+            serialize($_COOKIE).
152
+            serialize($GLOBALS).
153
+            serialize($_SESSION).
154 154
             serialize($_OLD_SESSION)
155 155
         ));
156 156
         if (!isset($_SESSION['count'])) {
@@ -183,8 +183,8 @@  discard block
 block discarded – undo
183 183
         // http://tools.ietf.org/html/rfc4253#section-7.2
184 184
         //
185 185
         // see the is_string($crypto) part for an example of how to expand the keys
186
-        $key = pack('H*', sha1($seed . 'A'));
187
-        $iv = pack('H*', sha1($seed . 'C'));
186
+        $key = pack('H*', sha1($seed.'A'));
187
+        $iv = pack('H*', sha1($seed.'C'));
188 188
 
189 189
         // ciphers are used as per the nist.gov link below. also, see this link:
190 190
         //
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
             $i = pack('H*', sha1(microtime()));
232 232
             $r = pack('H*', sha1($i ^ $v));
233 233
             $v = pack('H*', sha1($r ^ $i));
234
-            $result.= $r;
234
+            $result .= $r;
235 235
         }
236 236
         return substr($result, 0, $length);
237 237
     }
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
         $i = $crypto->encrypt(microtime());
244 244
         $r = $crypto->encrypt($i ^ $v);
245 245
         $v = $crypto->encrypt($r ^ $i);
246
-        $result.= $r;
246
+        $result .= $r;
247 247
     }
248 248
     return substr($result, 0, $length);
249 249
 }
Please login to merge, or discard this patch.
main/inc/lib/phpseclib/Crypt/AES.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      */
178 178
     function Crypt_AES($mode = CRYPT_AES_MODE_CBC)
179 179
     {
180
-        if ( !defined('CRYPT_AES_MODE') ) {
180
+        if (!defined('CRYPT_AES_MODE')) {
181 181
             switch (true) {
182 182
                 case extension_loaded('mcrypt') && in_array('rijndael-128', mcrypt_list_algorithms()):
183 183
                     define('CRYPT_AES_MODE', CRYPT_AES_MODE_MCRYPT);
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
             }
188 188
         }
189 189
 
190
-        switch ( CRYPT_AES_MODE ) {
190
+        switch (CRYPT_AES_MODE) {
191 191
             case CRYPT_AES_MODE_MCRYPT:
192 192
                 switch ($mode) {
193 193
                     case CRYPT_AES_MODE_ECB:
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
     function setIV($iv)
268 268
     {
269 269
         parent::setIV($iv);
270
-        if ( CRYPT_AES_MODE == CRYPT_AES_MODE_MCRYPT ) {
270
+        if (CRYPT_AES_MODE == CRYPT_AES_MODE_MCRYPT) {
271 271
             $this->changed = true;
272 272
         }
273 273
     }
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
      */
292 292
     function encrypt($plaintext)
293 293
     {
294
-        if ( CRYPT_AES_MODE == CRYPT_AES_MODE_MCRYPT ) {
294
+        if (CRYPT_AES_MODE == CRYPT_AES_MODE_MCRYPT) {
295 295
             $this->_mcryptSetup();
296 296
 
297 297
             // re: http://phpseclib.sourceforge.net/cfb-demo.phps
@@ -308,11 +308,11 @@  discard block
 block discarded – undo
308 308
                     $max = 16 - $pos;
309 309
                     if ($len >= $max) {
310 310
                         $i = $max;
311
-                        $len-= $max;
311
+                        $len -= $max;
312 312
                         $pos = 0;
313 313
                     } else {
314 314
                         $i = $len;
315
-                        $pos+= $len;
315
+                        $pos += $len;
316 316
                         $len = 0;
317 317
                     }
318 318
                     $ciphertext = substr($iv, $orig_pos) ^ $plaintext;
@@ -325,15 +325,15 @@  discard block
 block discarded – undo
325 325
                             mcrypt_generic_init($this->enmcrypt, $this->key, $iv);
326 326
                             $this->enbuffer['enmcrypt_init'] = false;
327 327
                         }
328
-                        $ciphertext.= mcrypt_generic($this->enmcrypt, substr($plaintext, $i, $len - $len % 16));
328
+                        $ciphertext .= mcrypt_generic($this->enmcrypt, substr($plaintext, $i, $len - $len % 16));
329 329
                         $iv = substr($ciphertext, -16);
330
-                        $len%= 16;
330
+                        $len %= 16;
331 331
                     } else {
332 332
                         while ($len >= 16) {
333 333
                             $iv = mcrypt_generic($this->ecb, $iv) ^ substr($plaintext, $i, 16);
334
-                            $ciphertext.= $iv;
335
-                            $len-= 16;
336
-                            $i+= 16;
334
+                            $ciphertext .= $iv;
335
+                            $len -= 16;
336
+                            $i += 16;
337 337
                         }
338 338
                     }
339 339
                 }
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
                     $iv = mcrypt_generic($this->ecb, $iv);
343 343
                     $block = $iv ^ substr($plaintext, -$len);
344 344
                     $iv = substr_replace($iv, $block, 0, $len);
345
-                    $ciphertext.= $block;
345
+                    $ciphertext .= $block;
346 346
                     $pos = $len;
347 347
                 }
348 348
 
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
      */
377 377
     function decrypt($ciphertext)
378 378
     {
379
-        if ( CRYPT_AES_MODE == CRYPT_AES_MODE_MCRYPT ) {
379
+        if (CRYPT_AES_MODE == CRYPT_AES_MODE_MCRYPT) {
380 380
             $this->_mcryptSetup();
381 381
 
382 382
             if ($this->mode == 'ncfb' && $this->continuousBuffer) {
@@ -390,11 +390,11 @@  discard block
 block discarded – undo
390 390
                     $max = 16 - $pos;
391 391
                     if ($len >= $max) {
392 392
                         $i = $max;
393
-                        $len-= $max;
393
+                        $len -= $max;
394 394
                         $pos = 0;
395 395
                     } else {
396 396
                         $i = $len;
397
-                        $pos+= $len;
397
+                        $pos += $len;
398 398
                         $len = 0;
399 399
                     }
400 400
                     // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $blocksize
@@ -403,13 +403,13 @@  discard block
 block discarded – undo
403 403
                 }
404 404
                 if ($len >= 16) {
405 405
                     $cb = substr($ciphertext, $i, $len - $len % 16);
406
-                    $plaintext.= mcrypt_generic($this->ecb, $iv . $cb) ^ $cb;
406
+                    $plaintext .= mcrypt_generic($this->ecb, $iv.$cb) ^ $cb;
407 407
                     $iv = substr($cb, -16);
408
-                    $len%= 16;
408
+                    $len %= 16;
409 409
                 }
410 410
                 if ($len) {
411 411
                     $iv = mcrypt_generic($this->ecb, $iv);
412
-                    $plaintext.= $iv ^ substr($ciphertext, -$len);
412
+                    $plaintext .= $iv ^ substr($ciphertext, -$len);
413 413
                     $iv = substr_replace($iv, substr($ciphertext, -$len), 0, $len);
414 414
                     $pos = $len;
415 415
                 }
Please login to merge, or discard this patch.
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -98,6 +98,7 @@  discard block
 block discarded – undo
98 98
      * CRYPT_DES_MODE_ECB or CRYPT_DES_MODE_CBC.  If not explictly set, CRYPT_DES_MODE_CBC will be used.
99 99
      *
100 100
      * @param optional Integer $mode
101
+     * @param integer $mode
101 102
      * @return Crypt_TripleDES
102 103
      * @access public
103 104
      */
@@ -318,6 +319,7 @@  discard block
 block discarded – undo
318 319
      *
319 320
      * @access public
320 321
      * @param String $plaintext
322
+     * @return string
321 323
      */
322 324
     function encrypt($plaintext)
323 325
     {
Please login to merge, or discard this patch.
main/inc/lib/phpseclib/Crypt/Blowfish.php 4 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -625,13 +625,13 @@
 block discarded – undo
625 625
             $l^= $p[++$i];
626 626
             $r^= ($sb_0[$l >> 24 & 0xff]  +
627 627
                   $sb_1[$l >> 16 & 0xff]  ^
628
-                  $sb_2[$l >>  8 & 0xff]) +
628
+                    $sb_2[$l >>  8 & 0xff]) +
629 629
                   $sb_3[$l       & 0xff];
630 630
 
631 631
             $r^= $p[++$i];
632 632
             $l^= ($sb_0[$r >> 24 & 0xff]  +
633 633
                   $sb_1[$r >> 16 & 0xff]  ^
634
-                  $sb_2[$r >>  8 & 0xff]) +
634
+                    $sb_2[$r >>  8 & 0xff]) +
635 635
                   $sb_3[$r       & 0xff];
636 636
 
637 637
         }
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
      * @access private
279 279
      * @var    array
280 280
      */
281
-    var $sbox0 = array (
281
+    var $sbox0 = array(
282 282
         0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99,
283 283
         0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16, 0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e,
284 284
         0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee, 0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013,
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
      */
470 470
     function Crypt_Blowfish($mode = CRYPT_BLOWFISH_MODE_CBC)
471 471
     {
472
-        if ( !defined('CRYPT_BLOWFISH_MODE') ) {
472
+        if (!defined('CRYPT_BLOWFISH_MODE')) {
473 473
             switch (true) {
474 474
                 case extension_loaded('mcrypt') && in_array('blowfish', mcrypt_list_algorithms()):
475 475
                     define('CRYPT_BLOWFISH_MODE', CRYPT_BLOWFISH_MODE_MCRYPT);
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
             }
480 480
         }
481 481
 
482
-        switch ( CRYPT_BLOWFISH_MODE ) {
482
+        switch (CRYPT_BLOWFISH_MODE) {
483 483
             case CRYPT_BLOWFISH_MODE_MCRYPT:
484 484
                 switch ($mode) {
485 485
                     case CRYPT_BLOWFISH_MODE_ECB:
@@ -590,13 +590,13 @@  discard block
 block discarded – undo
590 590
         $datar = 0;
591 591
         for ($i = 0; $i < 18; $i += 2) {
592 592
             $this->_encryptBlock($datal, $datar);
593
-            $this->bctx['p'][$i    ] = $datal;
593
+            $this->bctx['p'][$i] = $datal;
594 594
             $this->bctx['p'][$i + 1] = $datar;
595 595
         }
596 596
         for ($i = 0; $i < 4; ++$i) {
597 597
             for ($j = 0; $j < 256; $j += 2) {
598 598
                 $this->_encryptBlock($datal, $datar);
599
-                $this->bctx['sb'][$i][$j    ] = $datal;
599
+                $this->bctx['sb'][$i][$j] = $datal;
600 600
                 $this->bctx['sb'][$i][$j + 1] = $datar;
601 601
             }
602 602
         }
@@ -622,17 +622,17 @@  discard block
 block discarded – undo
622 622
 
623 623
         $i = -1;
624 624
         while ($i < 15) {
625
-            $l^= $p[++$i];
626
-            $r^= ($sb_0[$l >> 24 & 0xff]  +
627
-                  $sb_1[$l >> 16 & 0xff]  ^
628
-                  $sb_2[$l >>  8 & 0xff]) +
629
-                  $sb_3[$l       & 0xff];
630
-
631
-            $r^= $p[++$i];
632
-            $l^= ($sb_0[$r >> 24 & 0xff]  +
633
-                  $sb_1[$r >> 16 & 0xff]  ^
634
-                  $sb_2[$r >>  8 & 0xff]) +
635
-                  $sb_3[$r       & 0xff];
625
+            $l ^= $p[++$i];
626
+            $r ^= ($sb_0[$l >> 24 & 0xff] +
627
+                  $sb_1[$l >> 16 & 0xff] ^
628
+                  $sb_2[$l >> 8 & 0xff]) +
629
+                  $sb_3[$l & 0xff];
630
+
631
+            $r ^= $p[++$i];
632
+            $l ^= ($sb_0[$r >> 24 & 0xff] +
633
+                  $sb_1[$r >> 16 & 0xff] ^
634
+                  $sb_2[$r >> 8 & 0xff]) +
635
+                  $sb_3[$r & 0xff];
636 636
 
637 637
         }
638 638
         $Xr = $l ^ $p[16];
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
 
657 657
         switch ($method) {
658 658
             default: // 'pbkdf2'
659
-                list(, , $hash, $salt, $count) = func_get_args();
659
+                list(,, $hash, $salt, $count) = func_get_args();
660 660
                 if (!isset($hash)) {
661 661
                     $hash = 'sha1';
662 662
                 }
@@ -680,12 +680,12 @@  discard block
 block discarded – undo
680 680
                     $hmac = new Crypt_Hash();
681 681
                     $hmac->setHash($hash);
682 682
                     $hmac->setKey($password);
683
-                    $f = $u = $hmac->hash($salt . pack('N', $i++));
683
+                    $f = $u = $hmac->hash($salt.pack('N', $i++));
684 684
                     for ($j = 2; $j <= $count; $j++) {
685 685
                         $u = $hmac->hash($u);
686
-                        $f^= $u;
686
+                        $f ^= $u;
687 687
                     }
688
-                    $key.= $f;
688
+                    $key .= $f;
689 689
                 }
690 690
         }
691 691
 
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
      */
728 728
     function encrypt($plaintext)
729 729
     {
730
-        if ( CRYPT_BLOWFISH_MODE == CRYPT_BLOWFISH_MODE_MCRYPT ) {
730
+        if (CRYPT_BLOWFISH_MODE == CRYPT_BLOWFISH_MODE_MCRYPT) {
731 731
             if ($this->paddable) {
732 732
                 $plaintext = $this->_pad($plaintext);
733 733
             }
@@ -753,11 +753,11 @@  discard block
 block discarded – undo
753 753
                     $max = 8 - $pos;
754 754
                     if ($len >= $max) {
755 755
                         $i = $max;
756
-                        $len-= $max;
756
+                        $len -= $max;
757 757
                         $pos = 0;
758 758
                     } else {
759 759
                         $i = $len;
760
-                        $pos+= $len;
760
+                        $pos += $len;
761 761
                         $len = 0;
762 762
                     }
763 763
                     $ciphertext = substr($iv, $orig_pos) ^ $plaintext;
@@ -770,15 +770,15 @@  discard block
 block discarded – undo
770 770
                             mcrypt_generic_init($this->enmcrypt, $this->key, $iv);
771 771
                             $this->enbuffer['enmcrypt_init'] = false;
772 772
                         }
773
-                        $ciphertext.= mcrypt_generic($this->enmcrypt, substr($plaintext, $i, $len - $len % 8));
773
+                        $ciphertext .= mcrypt_generic($this->enmcrypt, substr($plaintext, $i, $len - $len % 8));
774 774
                         $iv = substr($ciphertext, -8);
775
-                        $len%= 8;
775
+                        $len %= 8;
776 776
                     } else {
777 777
                         while ($len >= 8) {
778 778
                             $iv = mcrypt_generic($this->ecb, $iv) ^ substr($plaintext, $i, 8);
779
-                            $ciphertext.= $iv;
780
-                            $len-= 8;
781
-                            $i+= 8;
779
+                            $ciphertext .= $iv;
780
+                            $len -= 8;
781
+                            $i += 8;
782 782
                         }
783 783
                     }
784 784
                 }
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
                     $iv = mcrypt_generic($this->ecb, $iv);
787 787
                     $block = $iv ^ substr($plaintext, -$len);
788 788
                     $iv = substr_replace($iv, $block, 0, $len);
789
-                    $ciphertext.= $block;
789
+                    $ciphertext .= $block;
790 790
                     $pos = $len;
791 791
                 }
792 792
                 return $ciphertext;
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
      */
819 819
     function decrypt($ciphertext)
820 820
     {
821
-        if ( CRYPT_BLOWFISH_MODE == CRYPT_BLOWFISH_MODE_MCRYPT ) {
821
+        if (CRYPT_BLOWFISH_MODE == CRYPT_BLOWFISH_MODE_MCRYPT) {
822 822
             if ($this->paddable) {
823 823
                 // we pad with chr(0) since that's what mcrypt_generic does.  to quote from http://php.net/function.mcrypt-generic :
824 824
                 // "The data is padded with "\0" to make sure the length of the data is n * blocksize."
@@ -846,11 +846,11 @@  discard block
 block discarded – undo
846 846
                     $max = 8 - $pos;
847 847
                     if ($len >= $max) {
848 848
                         $i = $max;
849
-                        $len-= $max;
849
+                        $len -= $max;
850 850
                         $pos = 0;
851 851
                     } else {
852 852
                         $i = $len;
853
-                        $pos+= $len;
853
+                        $pos += $len;
854 854
                         $len = 0;
855 855
                     }
856 856
                     $plaintext = substr($iv, $orig_pos) ^ $ciphertext;
@@ -858,13 +858,13 @@  discard block
 block discarded – undo
858 858
                 }
859 859
                 if ($len >= 8) {
860 860
                     $cb = substr($ciphertext, $i, $len - $len % 8);
861
-                    $plaintext.= mcrypt_generic($this->ecb, $iv . $cb) ^ $cb;
861
+                    $plaintext .= mcrypt_generic($this->ecb, $iv.$cb) ^ $cb;
862 862
                     $iv = substr($cb, -8);
863
-                    $len%= 8;
863
+                    $len %= 8;
864 864
                 }
865 865
                 if ($len) {
866 866
                     $iv = mcrypt_generic($this->ecb, $iv);
867
-                    $plaintext.= $iv ^ substr($ciphertext, -$len);
867
+                    $plaintext .= $iv ^ substr($ciphertext, -$len);
868 868
                     $iv = substr_replace($iv, substr($ciphertext, -$len), 0, $len);
869 869
                     $pos = $len;
870 870
                 }
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
     function _generate_xor(&$iv)
1033 1033
     {
1034 1034
         $xor = $iv;
1035
-        for ($j = 4; $j <= 8; $j+=4) {
1035
+        for ($j = 4; $j <= 8; $j += 4) {
1036 1036
             $temp = substr($iv, -$j, 4);
1037 1037
             switch ($temp) {
1038 1038
                 case "\xFF\xFF\xFF\xFF":
@@ -1058,7 +1058,7 @@  discard block
 block discarded – undo
1058 1058
      */
1059 1059
     function inline_crypt_setup()
1060 1060
     {/*{{{*/
1061
-        $lambda_functions =& Crypt_Blowfish::get_lambda_functions();
1061
+        $lambda_functions = & Crypt_Blowfish::get_lambda_functions();
1062 1062
         $block_size = 8;
1063 1063
         $mode = $this->mode;
1064 1064
         $code_hash = "$mode";
@@ -1075,8 +1075,8 @@  discard block
 block discarded – undo
1075 1075
                 $l = $in[1];
1076 1076
                 $r = $in[2];
1077 1077
             ';
1078
-            for ($i = 0; $i < 16; $i+= 2) {
1079
-                $_encryptBlock.= '
1078
+            for ($i = 0; $i < 16; $i += 2) {
1079
+                $_encryptBlock .= '
1080 1080
                     $l^= $p_'.($i).';
1081 1081
                     $r^= ($sb_0[$l >> 24 & 0xff]  +
1082 1082
                           $sb_1[$l >> 16 & 0xff]  ^
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
                           $sb_3[$r       & 0xff];
1091 1091
                 ';
1092 1092
             }
1093
-            $_encryptBlock.= '
1093
+            $_encryptBlock .= '
1094 1094
                 $in = pack("N*", $r ^ $p_17, $l ^ $p_16);
1095 1095
             ';
1096 1096
 
@@ -1101,8 +1101,8 @@  discard block
 block discarded – undo
1101 1101
                 $r = $in[2];
1102 1102
             ';
1103 1103
 
1104
-            for ($i = 17; $i > 2; $i-= 2) {
1105
-                $_decryptBlock.= '
1104
+            for ($i = 17; $i > 2; $i -= 2) {
1105
+                $_decryptBlock .= '
1106 1106
                     $l^= $p_'.($i).';
1107 1107
                     $r^= ($sb_0[$l >> 24 & 0xff]  +
1108 1108
                           $sb_1[$l >> 16 & 0xff]  ^
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
                 ';
1118 1118
             }
1119 1119
 
1120
-            $_decryptBlock.= '
1120
+            $_decryptBlock .= '
1121 1121
                 $in = pack("N*", $r ^ $p_0, $l ^ $p_1);
1122 1122
             ';
1123 1123
 
@@ -1439,12 +1439,12 @@  discard block
 block discarded – undo
1439 1439
                     break;
1440 1440
             }
1441 1441
             $fnc_head = '$action, &$self, $text';
1442
-            $fnc_body = $init_cryptBlock . 'if ($action == "encrypt") { ' . $encrypt . ' } else { ' . $decrypt . ' }';
1442
+            $fnc_body = $init_cryptBlock.'if ($action == "encrypt") { '.$encrypt.' } else { '.$decrypt.' }';
1443 1443
 
1444 1444
             if (function_exists('create_function') && is_callable('create_function')) {
1445 1445
                 $lambda_functions[$code_hash] = create_function($fnc_head, $fnc_body);
1446 1446
             } else {
1447
-                eval('function ' . ($lambda_functions[$code_hash] = 'f' . md5(microtime())) . '(' . $fnc_head . ') { ' . $fnc_body . ' }');
1447
+                eval('function '.($lambda_functions[$code_hash] = 'f'.md5(microtime())).'('.$fnc_head.') { '.$fnc_body.' }');
1448 1448
             }
1449 1449
         }
1450 1450
         $this->inline_crypt = $lambda_functions[$code_hash];
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -545,8 +545,7 @@
 block discarded – undo
545 545
 
546 546
         if (!$keylength) {
547 547
             $key = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
548
-        }
549
-        elseif ($keylength > 56) {
548
+        } elseif ($keylength > 56) {
550 549
             $key = substr($key, 0, 56);
551 550
         }
552 551
 
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -563,6 +563,7 @@  discard block
 block discarded – undo
563 563
      * If not explictly set, CRYPT_TWOFISH_MODE_CBC will be used.
564 564
      *
565 565
      * @param optional Integer $mode
566
+     * @param integer $mode
566 567
      * @access public
567 568
      */
568 569
     function Crypt_Twofish($mode = CRYPT_TWOFISH_MODE_CBC)
@@ -1072,6 +1073,7 @@  discard block
 block discarded – undo
1072 1073
      *
1073 1074
      * @see Crypt_Twofish::_unpad()
1074 1075
      * @access private
1076
+     * @param string $text
1075 1077
      */
1076 1078
     function _pad($text)
1077 1079
     {
@@ -1099,6 +1101,7 @@  discard block
 block discarded – undo
1099 1101
      *
1100 1102
      * @see Crypt_Twofish::_pad()
1101 1103
      * @access private
1104
+     * @param string $text
1102 1105
      */
1103 1106
     function _unpad($text)
1104 1107
     {
Please login to merge, or discard this patch.
main/inc/lib/phpseclib/Crypt/RC4.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
      */
172 172
     function Crypt_RC4()
173 173
     {
174
-        if ( !defined('CRYPT_RC4_MODE') ) {
174
+        if (!defined('CRYPT_RC4_MODE')) {
175 175
             switch (true) {
176 176
                 case extension_loaded('mcrypt') && (defined('MCRYPT_ARCFOUR') || defined('MCRYPT_RC4')) && in_array('arcfour', mcrypt_list_algorithms()):
177 177
                     define('CRYPT_RC4_MODE', CRYPT_RC4_MODE_MCRYPT);
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
             }
182 182
         }
183 183
 
184
-        switch ( CRYPT_RC4_MODE ) {
184
+        switch (CRYPT_RC4_MODE) {
185 185
             case CRYPT_RC4_MODE_MCRYPT:
186 186
                 switch (true) {
187 187
                     case defined('MCRYPT_ARCFOUR'):
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
     {
210 210
         $this->key = $key;
211 211
 
212
-        if ( CRYPT_RC4_MODE == CRYPT_RC4_MODE_MCRYPT ) {
212
+        if (CRYPT_RC4_MODE == CRYPT_RC4_MODE_MCRYPT) {
213 213
             mcrypt_generic_init($this->encryptStream, $this->key, '');
214 214
             mcrypt_generic_init($this->decryptStream, $this->key, '');
215 215
             return;
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 
250 250
         switch ($method) {
251 251
             default: // 'pbkdf2'
252
-                list(, , $hash, $salt, $count) = func_get_args();
252
+                list(,, $hash, $salt, $count) = func_get_args();
253 253
                 if (!isset($hash)) {
254 254
                     $hash = 'sha1';
255 255
                 }
@@ -276,12 +276,12 @@  discard block
 block discarded – undo
276 276
                     $hmac = new Crypt_Hash();
277 277
                     $hmac->setHash($hash);
278 278
                     $hmac->setKey($password);
279
-                    $f = $u = $hmac->hash($salt . pack('N', $i++));
279
+                    $f = $u = $hmac->hash($salt.pack('N', $i++));
280 280
                     for ($j = 2; $j <= $count; $j++) {
281 281
                         $u = $hmac->hash($u);
282
-                        $f^= $u;
282
+                        $f ^= $u;
283 283
                     }
284
-                    $key.= $f;
284
+                    $key .= $f;
285 285
                 }
286 286
         }
287 287
 
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
      */
350 350
     function _crypt($text, $mode)
351 351
     {
352
-        if ( CRYPT_RC4_MODE == CRYPT_RC4_MODE_MCRYPT ) {
352
+        if (CRYPT_RC4_MODE == CRYPT_RC4_MODE_MCRYPT) {
353 353
             $keyStream = $mode == CRYPT_RC4_ENCRYPT ? 'encryptStream' : 'decryptStream';
354 354
 
355 355
             if (!$this->continuousBuffer) {
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
             $keyStream[$i] = $keyStream[$j];
382 382
             $keyStream[$j] = $temp;
383 383
             $temp = $keyStream[($keyStream[$i] + $keyStream[$j]) & 255];
384
-            $newText.= chr(ord($text[$k]) ^ $temp);
384
+            $newText .= chr(ord($text[$k]) ^ $temp);
385 385
         }
386 386
 
387 387
         if ($this->continuousBuffer) {
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
      */
439 439
     function enableContinuousBuffer()
440 440
     {
441
-        if ( CRYPT_RC4_MODE == CRYPT_RC4_MODE_MCRYPT ) {
441
+        if (CRYPT_RC4_MODE == CRYPT_RC4_MODE_MCRYPT) {
442 442
             mcrypt_generic_init($this->encryptStream, $this->key, '');
443 443
             mcrypt_generic_init($this->decryptStream, $this->key, '');
444 444
         }
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
      */
457 457
     function disableContinuousBuffer()
458 458
     {
459
-        if ( CRYPT_RC4_MODE == CRYPT_RC4_MODE_INTERNAL ) {
459
+        if (CRYPT_RC4_MODE == CRYPT_RC4_MODE_INTERNAL) {
460 460
             $this->encryptIndex = $this->decryptIndex = array(0, 0);
461 461
             $this->encryptStream = $this->decryptStream = false;
462 462
         }
Please login to merge, or discard this patch.