Completed
Push — 1.10.x ( f2aaaf...ef00db )
by Yannick
241:15 queued 197:35
created
main/inc/lib/phpmailer/language/phpmailer.lang-ar.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 $PHPMAILER_LANG['mailer_not_supported'] = ' mailer غير مدعوم.';
20 20
 //$PHPMAILER_LANG['provide_address']      = 'You must provide at least one recipient email address.';
21 21
 $PHPMAILER_LANG['recipients_failed']    = 'SMTP Error: الأخطاء التالية ' .
22
-                                          'فشل في الارسال لكل من : ';
22
+                                            'فشل في الارسال لكل من : ';
23 23
 $PHPMAILER_LANG['signing']              = 'خطأ في التوقيع: ';
24 24
 //$PHPMAILER_LANG['smtp_connect_failed']  = 'SMTP Connect() failed.';
25 25
 //$PHPMAILER_LANG['smtp_error']           = 'SMTP server error: ';
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 //$PHPMAILER_LANG['invalid_email']        = 'Not sending, email address is invalid: ';
19 19
 $PHPMAILER_LANG['mailer_not_supported'] = ' mailer غير مدعوم.';
20 20
 //$PHPMAILER_LANG['provide_address']      = 'You must provide at least one recipient email address.';
21
-$PHPMAILER_LANG['recipients_failed']    = 'SMTP Error: الأخطاء التالية ' .
21
+$PHPMAILER_LANG['recipients_failed']    = 'SMTP Error: الأخطاء التالية '.
22 22
                                           'فشل في الارسال لكل من : ';
23 23
 $PHPMAILER_LANG['signing']              = 'خطأ في التوقيع: ';
24 24
 //$PHPMAILER_LANG['smtp_connect_failed']  = 'SMTP Connect() failed.';
Please login to merge, or discard this patch.
main/inc/lib/array.lib.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -108,24 +108,24 @@
 block discarded – undo
108 108
  */
109 109
 function utf8_sort($array)
110 110
 {
111
-	$old_locale = setlocale(LC_ALL, null);
112
-	$code = api_get_language_isocode();
113
-	$locale_list = array($code.'.utf8', 'en.utf8','en_US.utf8','en_GB.utf8');
114
-	$try_sort = false;
111
+    $old_locale = setlocale(LC_ALL, null);
112
+    $code = api_get_language_isocode();
113
+    $locale_list = array($code.'.utf8', 'en.utf8','en_US.utf8','en_GB.utf8');
114
+    $try_sort = false;
115 115
 
116
-	foreach($locale_list as $locale) {
117
-		$my_local = setlocale(LC_COLLATE, $locale);
118
-		if ($my_local) {
119
-			$try_sort = true;
120
-			break;
121
-		}
122
-	}
116
+    foreach($locale_list as $locale) {
117
+        $my_local = setlocale(LC_COLLATE, $locale);
118
+        if ($my_local) {
119
+            $try_sort = true;
120
+            break;
121
+        }
122
+    }
123 123
 
124
-	if ($try_sort) {
125
-		uasort($array, 'strcoll');
126
-	}
127
-	setlocale(LC_COLLATE, $old_locale);
128
-	return $array;
124
+    if ($try_sort) {
125
+        uasort($array, 'strcoll');
126
+    }
127
+    setlocale(LC_COLLATE, $old_locale);
128
+    return $array;
129 129
 }
130 130
 
131 131
 /**
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 {
111 111
 	$old_locale = setlocale(LC_ALL, null);
112 112
 	$code = api_get_language_isocode();
113
-	$locale_list = array($code.'.utf8', 'en.utf8','en_US.utf8','en_GB.utf8');
113
+	$locale_list = array($code.'.utf8', 'en.utf8', 'en_US.utf8', 'en_GB.utf8');
114 114
 	$try_sort = false;
115 115
 
116
-	foreach($locale_list as $locale) {
116
+	foreach ($locale_list as $locale) {
117 117
 		$my_local = setlocale(LC_COLLATE, $locale);
118 118
 		if ($my_local) {
119 119
 			$try_sort = true;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
     $flatten = array();
152 152
     array_walk_recursive(
153 153
         $array,
154
-        function ($value) use (&$flatten) {
154
+        function($value) use (&$flatten) {
155 155
             $flatten[] = $value;
156 156
         }
157 157
     );
Please login to merge, or discard this patch.
main/inc/lib/surveymanager.lib.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     {
20 20
         // Database table definitions
21 21
         $table_survey = Database :: get_course_table(TABLE_SURVEY);
22
-        $table_survey_question 	= Database :: get_course_table(TABLE_SURVEY_QUESTION);
22
+        $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION);
23 23
         $table_user = Database :: get_main_table(TABLE_MAIN_USER);
24 24
 
25 25
         // searching
@@ -45,23 +45,23 @@  discard block
 block discarded – undo
45 45
 				GROUP BY survey.survey_id";
46 46
 
47 47
         $res = Database::query($sql);
48
-        $surveys_parents = array ();
48
+        $surveys_parents = array();
49 49
         $refs = array();
50 50
         $list = array();
51
-        $plain_array=array();
51
+        $plain_array = array();
52 52
 
53
-        while ($survey = Database::fetch_array($res,'ASSOC')) {
54
-            $plain_array[$survey['survey_id']]=$survey;
55
-            $surveys_parents[]=$survey['survey_version'];
56
-            $thisref = &$refs[ $survey['survey_id'] ];
53
+        while ($survey = Database::fetch_array($res, 'ASSOC')) {
54
+            $plain_array[$survey['survey_id']] = $survey;
55
+            $surveys_parents[] = $survey['survey_version'];
56
+            $thisref = &$refs[$survey['survey_id']];
57 57
             $thisref['parent_id'] = $survey['parent_id'];
58 58
             $thisref['name'] = $survey['name'];
59 59
             $thisref['id'] = $survey['survey_id'];
60 60
             $thisref['survey_version'] = $survey['survey_version'];
61 61
             if ($survey['parent_id'] == 0) {
62
-                $list[ $survey['survey_id'] ] = &$thisref;
62
+                $list[$survey['survey_id']] = &$thisref;
63 63
             } else {
64
-                $refs[ $survey['parent_id'] ]['children'][ $survey['survey_id'] ] = &$thisref;
64
+                $refs[$survey['parent_id']]['children'][$survey['survey_id']] = &$thisref;
65 65
             }
66 66
         }
67 67
         $this->surveylist = $list;
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     public function getParentId($id)
81 81
     {
82 82
         $node = $this->plainsurveylist[$id];
83
-        if (is_array($node)&& !empty($node['parent_id'])) {
83
+        if (is_array($node) && !empty($node['parent_id'])) {
84 84
             return $node['parent_id'];
85 85
         } else {
86 86
             return -1;
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
         if (is_array($list)) {
101 101
             foreach ($list as $key => $node) {
102 102
                 if (isset($node['children']) && is_array($node['children'])) {
103
-                    $result[$key]= $node['name'];
103
+                    $result[$key] = $node['name'];
104 104
                     $re = self::createList($node['children']);
105 105
                     if (!empty($re)) {
106 106
                         if (is_array($re)) {
107 107
                             foreach ($re as $key => $r) {
108
-                                $result[$key] = '' . $r;
108
+                                $result[$key] = ''.$r;
109 109
                             }
110 110
                         } else {
111 111
                             $result[] = $re;
Please login to merge, or discard this patch.
main/inc/lib/notebook.lib.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         return "<script>
30 30
 				function confirmation (name)
31 31
 				{
32
-					if (confirm(\" " . get_lang("NoteConfirmDelete") . " \"+ name + \" ?\"))
32
+					if (confirm(\" " . get_lang("NoteConfirmDelete")." \"+ name + \" ?\"))
33 33
 						{return true;}
34 34
 					else
35 35
 						{return false;}
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
                 description 		AS note_comment,
108 108
                 session_id			AS session_id
109 109
                FROM $t_notebook
110
-               WHERE c_id = $course_id AND notebook_id = '" . intval($notebook_id) . "' ";
110
+               WHERE c_id = $course_id AND notebook_id = '".intval($notebook_id)."' ";
111 111
         $result = Database::query($sql);
112 112
         if (Database::num_rows($result) != 1) {
113 113
             return array();
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
         $sql = "DELETE FROM $t_notebook
182 182
                 WHERE
183 183
                     c_id = $course_id AND
184
-                    notebook_id='" . intval($notebook_id) . "' AND
185
-                    user_id = '" . api_get_user_id() . "'";
184
+                    notebook_id='".intval($notebook_id)."' AND
185
+                    user_id = '" . api_get_user_id()."'";
186 186
         $result = Database::query($sql);
187 187
         $affected_rows = Database::affected_rows($result);
188 188
         if ($affected_rows != 1) {
@@ -220,22 +220,22 @@  discard block
 block discarded – undo
220 220
         echo '<div class="actions">';
221 221
         if (!api_is_anonymous()) {
222 222
             if (api_get_session_id() == 0)
223
-                echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' .
224
-                    Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
223
+                echo '<a href="index.php?'.api_get_cidreq().'&action=addnote">'.
224
+                    Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32').'</a>';
225 225
             elseif (api_is_allowed_to_session_edit(false, true)) {
226
-                echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' .
227
-                    Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
226
+                echo '<a href="index.php?'.api_get_cidreq().'&action=addnote">'.
227
+                    Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32').'</a>';
228 228
             }
229 229
         } else {
230
-            echo '<a href="javascript:void(0)">' . Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
230
+            echo '<a href="javascript:void(0)">'.Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32').'</a>';
231 231
         }
232 232
 
233
-        echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=creation_date&direction=' . $link_sort_direction . '">' .
234
-            Display::return_icon('notes_order_by_date_new.png', get_lang('OrderByCreationDate'), '', '32') . '</a>';
235
-        echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=update_date&direction=' . $link_sort_direction . '">' .
236
-            Display::return_icon('notes_order_by_date_mod.png', get_lang('OrderByModificationDate'), '', '32') . '</a>';
237
-        echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=title&direction=' . $link_sort_direction . '">' .
238
-            Display::return_icon('notes_order_by_title.png', get_lang('OrderByTitle'), '', '32') . '</a>';
233
+        echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=creation_date&direction='.$link_sort_direction.'">'.
234
+            Display::return_icon('notes_order_by_date_new.png', get_lang('OrderByCreationDate'), '', '32').'</a>';
235
+        echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=update_date&direction='.$link_sort_direction.'">'.
236
+            Display::return_icon('notes_order_by_date_mod.png', get_lang('OrderByModificationDate'), '', '32').'</a>';
237
+        echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=title&direction='.$link_sort_direction.'">'.
238
+            Display::return_icon('notes_order_by_title.png', get_lang('OrderByTitle'), '', '32').'</a>';
239 239
         echo '</div>';
240 240
 
241 241
         if (!isset($_SESSION['notebook_view']) || !in_array($_SESSION['notebook_view'], array('creation_date', 'update_date', 'title'))) {
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
         $t_notebook = Database :: get_course_table(TABLE_NOTEBOOK);
247 247
         $order_by = "";
248 248
         if ($_SESSION['notebook_view'] == 'creation_date' || $_SESSION['notebook_view'] == 'update_date') {
249
-            $order_by = " ORDER BY " . $_SESSION['notebook_view'] . " $sort_direction ";
249
+            $order_by = " ORDER BY ".$_SESSION['notebook_view']." $sort_direction ";
250 250
         } else {
251
-            $order_by = " ORDER BY " . $_SESSION['notebook_view'] . " $sort_direction ";
251
+            $order_by = " ORDER BY ".$_SESSION['notebook_view']." $sort_direction ";
252 252
         }
253 253
 
254 254
         //condition for the session
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         $sql = "SELECT * FROM $t_notebook
262 262
                 WHERE
263 263
                     c_id = $course_id AND
264
-                    user_id = '" . api_get_user_id() . "'
264
+                    user_id = '".api_get_user_id()."'
265 265
                     $condition_session
266 266
                     $cond_extra $order_by
267 267
                 ";
@@ -274,18 +274,18 @@  discard block
 block discarded – undo
274 274
 
275 275
             $updateValue = '';
276 276
             if ($row['update_date'] <> $row['creation_date']) {
277
-                $updateValue = ', ' . get_lang('UpdateDate') . ': ' . date_to_str_ago($update_date) . '&nbsp;&nbsp;<span class="dropbox_date">' . $update_date . '</span>';
277
+                $updateValue = ', '.get_lang('UpdateDate').': '.date_to_str_ago($update_date).'&nbsp;&nbsp;<span class="dropbox_date">'.$update_date.'</span>';
278 278
             }
279 279
 
280
-            $actions = '<a href="' . api_get_self() . '?action=editnote&notebook_id=' . $row['notebook_id'] . '">' .
281
-                Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . '</a>';
282
-            $actions .= '<a href="' . api_get_self() . '?action=deletenote&notebook_id=' . $row['notebook_id'] . '" onclick="return confirmation(\'' . $row['title'] . '\');">' .
283
-                Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
280
+            $actions = '<a href="'.api_get_self().'?action=editnote&notebook_id='.$row['notebook_id'].'">'.
281
+                Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
282
+            $actions .= '<a href="'.api_get_self().'?action=deletenote&notebook_id='.$row['notebook_id'].'" onclick="return confirmation(\''.$row['title'].'\');">'.
283
+                Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
284 284
 
285 285
             echo Display::panel(
286 286
                 $row['description'],
287
-                $row['title'] . $session_img.' <div class="pull-right">'.$actions.'</div>',
288
-                get_lang('CreationDate') . ': ' . date_to_str_ago($creation_date) . '&nbsp;&nbsp;<span class="dropbox_date">' . $creation_date . $updateValue."</span>"
287
+                $row['title'].$session_img.' <div class="pull-right">'.$actions.'</div>',
288
+                get_lang('CreationDate').': '.date_to_str_ago($creation_date).'&nbsp;&nbsp;<span class="dropbox_date">'.$creation_date.$updateValue."</span>"
289 289
             );
290 290
         }
291 291
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -219,10 +219,10 @@
 block discarded – undo
219 219
         // action links
220 220
         echo '<div class="actions">';
221 221
         if (!api_is_anonymous()) {
222
-            if (api_get_session_id() == 0)
223
-                echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' .
222
+            if (api_get_session_id() == 0) {
223
+                            echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' .
224 224
                     Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
225
-            elseif (api_is_allowed_to_session_edit(false, true)) {
225
+            } elseif (api_is_allowed_to_session_edit(false, true)) {
226 226
                 echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' .
227 227
                     Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
228 228
             }
Please login to merge, or discard this patch.
main/inc/lib/legal.lib.php 3 patches
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -15,15 +15,15 @@  discard block
 block discarded – undo
15 15
     {
16 16
     }
17 17
 
18
-	/**
19
-	 * Add a new Term and Condition
20
-	 * @param int $language language id
21
-	 * @param string $content content
22
-	 * @param int $type term and condition type (0 or 1)
23
-	 * @param string $changes explain changes
24
-	 * @return boolean success
25
-	 */
26
-	public static function add($language, $content, $type, $changes)
18
+    /**
19
+     * Add a new Term and Condition
20
+     * @param int $language language id
21
+     * @param string $content content
22
+     * @param int $type term and condition type (0 or 1)
23
+     * @param string $changes explain changes
24
+     * @return boolean success
25
+     */
26
+    public static function add($language, $content, $type, $changes)
27 27
     {
28 28
         $legal_table = Database::get_main_table(TABLE_MAIN_LEGAL);
29 29
         $last = self::get_last_condition($language);
@@ -60,62 +60,62 @@  discard block
 block discarded – undo
60 60
         }
61 61
     }
62 62
 
63
-	public static function delete($id)
63
+    public static function delete($id)
64 64
     {
65
-		/*
65
+        /*
66 66
 		$legal_table = Database::get_main_table(TABLE_MAIN_LEGAL);
67 67
 		$id = intval($id);
68 68
 		$sql = "DELETE FROM $legal_table WHERE legal_id = '".$id."'";
69 69
 		*/
70
-	}
71
-
72
-	/**
73
-	 * Gets the last version of a Term and condition by language
74
-	 * @param int $language language id
75
-	 * @return array all the info of a Term and condition
76
-	 */
77
-	public static function get_last_condition_version($language)
70
+    }
71
+
72
+    /**
73
+     * Gets the last version of a Term and condition by language
74
+     * @param int $language language id
75
+     * @return array all the info of a Term and condition
76
+     */
77
+    public static function get_last_condition_version($language)
78 78
     {
79
-		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
80
-		$language= Database::escape_string($language);
81
-		$sql = "SELECT version FROM $legal_conditions_table
79
+        $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
80
+        $language= Database::escape_string($language);
81
+        $sql = "SELECT version FROM $legal_conditions_table
82 82
 		        WHERE language_id = '".$language."'
83 83
 		        ORDER BY legal_id DESC LIMIT 1 ";
84
-		$result = Database::query($sql);
85
-		$row = Database::fetch_array($result);
84
+        $result = Database::query($sql);
85
+        $row = Database::fetch_array($result);
86 86
         if (Database::num_rows($result) > 0) {
87 87
 
88
-			return $row['version'];
89
-		} else {
88
+            return $row['version'];
89
+        } else {
90 90
 
91
-			return 0;
92
-		}
93
-	}
91
+            return 0;
92
+        }
93
+    }
94 94
 
95
-	/**
96
-	 * Gets the data of a Term and condition by language
97
-	 * @param int $language language id
98
-	 * @return array all the info of a Term and condition
99
-	 */
100
-	public static function get_last_condition ($language)
95
+    /**
96
+     * Gets the data of a Term and condition by language
97
+     * @param int $language language id
98
+     * @return array all the info of a Term and condition
99
+     */
100
+    public static function get_last_condition ($language)
101 101
     {
102
-		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
103
-		$language= Database::escape_string($language);
104
-		$sql = "SELECT * FROM $legal_conditions_table
102
+        $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
103
+        $language= Database::escape_string($language);
104
+        $sql = "SELECT * FROM $legal_conditions_table
105 105
                 WHERE language_id = '".$language."'
106 106
                 ORDER BY version DESC
107 107
                 LIMIT 1 ";
108
-		$result = Database::query($sql);
108
+        $result = Database::query($sql);
109 109
 
110
-		return Database::fetch_array($result);
111
-	}
110
+        return Database::fetch_array($result);
111
+    }
112 112
 
113
-	/**
114
-	 * Gets the last version of a Term and condition by language
115
-	 * @param int $language language id
116
-	 * @return boolean | int the version or false if does not exist
117
-	 */
118
-	public static function get_last_version($language)
113
+    /**
114
+     * Gets the last version of a Term and condition by language
115
+     * @param int $language language id
116
+     * @return boolean | int the version or false if does not exist
117
+     */
118
+    public static function get_last_version($language)
119 119
     {
120 120
         $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
121 121
         $language = intval($language);
@@ -133,15 +133,15 @@  discard block
 block discarded – undo
133 133
 
134 134
             return false;
135 135
         }
136
-	}
136
+    }
137 137
 
138
-	/**
139
-	 * Show the last condition
140
-	 * @param array with type and content i.e array('type'=>'1', 'content'=>'hola');
138
+    /**
139
+     * Show the last condition
140
+     * @param array with type and content i.e array('type'=>'1', 'content'=>'hola');
141 141
      *
142
-	 * @return string html preview
143
-	 */
144
-	public static function show_last_condition($term_preview)
142
+     * @return string html preview
143
+     */
144
+    public static function show_last_condition($term_preview)
145 145
     {
146 146
         $preview = '';
147 147
         switch ($term_preview['type']) {
@@ -167,80 +167,80 @@  discard block
 block discarded – undo
167 167
             default:
168 168
                 break;
169 169
         }
170
-		return 	$preview;
171
-	}
172
-
173
-	/**
174
-	 * Get the terms and condition table (only for maintenance)
175
-	 * @param int offset
176
-	 * @param int number of items
177
-	 * @param int column
178
-	 * @return array
179
-	 */
180
-	public static function get_legal_data($from, $number_of_items, $column)
170
+        return 	$preview;
171
+    }
172
+
173
+    /**
174
+     * Get the terms and condition table (only for maintenance)
175
+     * @param int offset
176
+     * @param int number of items
177
+     * @param int column
178
+     * @return array
179
+     */
180
+    public static function get_legal_data($from, $number_of_items, $column)
181 181
     {
182
-		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
183
-		$lang_table = Database::get_main_table(TABLE_MAIN_LANGUAGE);
184
-		$from = intval($from);
185
-		$number_of_items = intval($number_of_items);
186
-		$column = intval($column);
182
+        $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
183
+        $lang_table = Database::get_main_table(TABLE_MAIN_LANGUAGE);
184
+        $from = intval($from);
185
+        $number_of_items = intval($number_of_items);
186
+        $column = intval($column);
187 187
 
188
- 		$sql  = "SELECT version, original_name as language, content, changes, type, FROM_UNIXTIME(date)
188
+            $sql  = "SELECT version, original_name as language, content, changes, type, FROM_UNIXTIME(date)
189 189
 				FROM $legal_conditions_table inner join $lang_table l on(language_id = l.id) ";
190
-		$sql .= "ORDER BY language, version ASC ";
191
-		$sql .= "LIMIT $from, $number_of_items ";
192
-
193
-		$result = Database::query($sql);
194
-		$legals = array ();
195
-		$versions = array ();
196
-		while ($legal = Database::fetch_array($result)) {
197
-			// max 2000 chars
198
-			//echo strlen($legal[1]); echo '<br>';
199
-			$versions[]=$legal[0];
200
-			$languages[]=$legal[1];
201
-			if (strlen($legal[2])>2000)
202
-				$legal[2]= substr($legal[2],0,2000).' ... ';
203
-			if ($legal[4]==0)
204
-				$legal[4]= get_lang('HTMLText');
205
-			elseif($legal[4]==1)
206
-				$legal[4]=get_lang('PageLink');
207
-			$legals[] = $legal;
208
-		}
209
-		return $legals;
210
-	}
211
-
212
-	/**
213
-	 * Gets the number of terms and conditions available
214
-	 * @return int
215
-	 */
216
-	public static function count()
190
+        $sql .= "ORDER BY language, version ASC ";
191
+        $sql .= "LIMIT $from, $number_of_items ";
192
+
193
+        $result = Database::query($sql);
194
+        $legals = array ();
195
+        $versions = array ();
196
+        while ($legal = Database::fetch_array($result)) {
197
+            // max 2000 chars
198
+            //echo strlen($legal[1]); echo '<br>';
199
+            $versions[]=$legal[0];
200
+            $languages[]=$legal[1];
201
+            if (strlen($legal[2])>2000)
202
+                $legal[2]= substr($legal[2],0,2000).' ... ';
203
+            if ($legal[4]==0)
204
+                $legal[4]= get_lang('HTMLText');
205
+            elseif($legal[4]==1)
206
+                $legal[4]=get_lang('PageLink');
207
+            $legals[] = $legal;
208
+        }
209
+        return $legals;
210
+    }
211
+
212
+    /**
213
+     * Gets the number of terms and conditions available
214
+     * @return int
215
+     */
216
+    public static function count()
217 217
     {
218
-		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
219
-		$sql = "SELECT count(*) as count_result
218
+        $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
219
+        $sql = "SELECT count(*) as count_result
220 220
 		        FROM $legal_conditions_table
221 221
 		        ORDER BY legal_id DESC ";
222
-		$result = Database::query($sql);
223
-		$url = Database::fetch_array($result,'ASSOC');
224
-		$result = $url['count_result'];
225
-
226
-		return $result;
227
-	}
228
-
229
-	/**
230
-	 * Get type of terms and conditions
231
-	 * @param int The legal id
232
-	 * @param int The language id
233
-	 * @return int The current type of terms and conditions
234
-	 */
235
-	public static function get_type_of_terms_and_conditions($legal_id, $language_id)
222
+        $result = Database::query($sql);
223
+        $url = Database::fetch_array($result,'ASSOC');
224
+        $result = $url['count_result'];
225
+
226
+        return $result;
227
+    }
228
+
229
+    /**
230
+     * Get type of terms and conditions
231
+     * @param int The legal id
232
+     * @param int The language id
233
+     * @return int The current type of terms and conditions
234
+     */
235
+    public static function get_type_of_terms_and_conditions($legal_id, $language_id)
236 236
     {
237
-		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
238
-		$legal_id = intval($legal_id);
239
-		$language_id = intval($language_id);
240
-		$sql = 'SELECT type FROM '.$legal_conditions_table.'
237
+        $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
238
+        $legal_id = intval($legal_id);
239
+        $language_id = intval($language_id);
240
+        $sql = 'SELECT type FROM '.$legal_conditions_table.'
241 241
 		        WHERE legal_id="'.$legal_id.'" AND language_id="'.$language_id.'"';
242
-		$rs = Database::query($sql);
242
+        $rs = Database::query($sql);
243 243
 
244
-		return Database::result($rs,0,'type');
245
-	}
244
+        return Database::result($rs,0,'type');
245
+    }
246 246
 }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             Database::insert($legal_table, $params);
45 45
 
46 46
             return true;
47
-        } elseif($last['type'] != $type && $language==$last['language_id']) {
47
+        } elseif ($last['type'] != $type && $language == $last['language_id']) {
48 48
             //update
49 49
             $id = $last['legal_id'];
50 50
             $params = [
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	public static function get_last_condition_version($language)
78 78
     {
79 79
 		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
80
-		$language= Database::escape_string($language);
80
+		$language = Database::escape_string($language);
81 81
 		$sql = "SELECT version FROM $legal_conditions_table
82 82
 		        WHERE language_id = '".$language."'
83 83
 		        ORDER BY legal_id DESC LIMIT 1 ";
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
 	 * @param int $language language id
98 98
 	 * @return array all the info of a Term and condition
99 99
 	 */
100
-	public static function get_last_condition ($language)
100
+	public static function get_last_condition($language)
101 101
     {
102 102
 		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
103
-		$language= Database::escape_string($language);
103
+		$language = Database::escape_string($language);
104 104
 		$sql = "SELECT * FROM $legal_conditions_table
105 105
                 WHERE language_id = '".$language."'
106 106
                 ORDER BY version DESC
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
                 ORDER BY version DESC
125 125
                 LIMIT 1 ";
126 126
         $result = Database::query($sql);
127
-        if (Database::num_rows($result)>0){
127
+        if (Database::num_rows($result) > 0) {
128 128
             $version = Database::fetch_array($result);
129
-            $version = explode(':',$version[0]);
129
+            $version = explode(':', $version[0]);
130 130
 
131 131
             return $version[0];
132 132
         } else {
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
                 break;
154 154
                 // Page link
155 155
             case 1:
156
-                $preview ='<fieldset>
156
+                $preview = '<fieldset>
157 157
                              <legend>'.get_lang('TermsAndConditions').'</legend>';
158 158
                 $preview .= '<div id="legal-accept-wrapper" class="form-item">
159 159
                 <label class="option" for="legal-accept">
@@ -185,25 +185,25 @@  discard block
 block discarded – undo
185 185
 		$number_of_items = intval($number_of_items);
186 186
 		$column = intval($column);
187 187
 
188
- 		$sql  = "SELECT version, original_name as language, content, changes, type, FROM_UNIXTIME(date)
188
+ 		$sql = "SELECT version, original_name as language, content, changes, type, FROM_UNIXTIME(date)
189 189
 				FROM $legal_conditions_table inner join $lang_table l on(language_id = l.id) ";
190 190
 		$sql .= "ORDER BY language, version ASC ";
191 191
 		$sql .= "LIMIT $from, $number_of_items ";
192 192
 
193 193
 		$result = Database::query($sql);
194
-		$legals = array ();
195
-		$versions = array ();
194
+		$legals = array();
195
+		$versions = array();
196 196
 		while ($legal = Database::fetch_array($result)) {
197 197
 			// max 2000 chars
198 198
 			//echo strlen($legal[1]); echo '<br>';
199
-			$versions[]=$legal[0];
200
-			$languages[]=$legal[1];
201
-			if (strlen($legal[2])>2000)
202
-				$legal[2]= substr($legal[2],0,2000).' ... ';
203
-			if ($legal[4]==0)
204
-				$legal[4]= get_lang('HTMLText');
205
-			elseif($legal[4]==1)
206
-				$legal[4]=get_lang('PageLink');
199
+			$versions[] = $legal[0];
200
+			$languages[] = $legal[1];
201
+			if (strlen($legal[2]) > 2000)
202
+				$legal[2] = substr($legal[2], 0, 2000).' ... ';
203
+			if ($legal[4] == 0)
204
+				$legal[4] = get_lang('HTMLText');
205
+			elseif ($legal[4] == 1)
206
+				$legal[4] = get_lang('PageLink');
207 207
 			$legals[] = $legal;
208 208
 		}
209 209
 		return $legals;
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 		        FROM $legal_conditions_table
221 221
 		        ORDER BY legal_id DESC ";
222 222
 		$result = Database::query($sql);
223
-		$url = Database::fetch_array($result,'ASSOC');
223
+		$url = Database::fetch_array($result, 'ASSOC');
224 224
 		$result = $url['count_result'];
225 225
 
226 226
 		return $result;
@@ -241,6 +241,6 @@  discard block
 block discarded – undo
241 241
 		        WHERE legal_id="'.$legal_id.'" AND language_id="'.$language_id.'"';
242 242
 		$rs = Database::query($sql);
243 243
 
244
-		return Database::result($rs,0,'type');
244
+		return Database::result($rs, 0, 'type');
245 245
 	}
246 246
 }
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -198,12 +198,14 @@
 block discarded – undo
198 198
 			//echo strlen($legal[1]); echo '<br>';
199 199
 			$versions[]=$legal[0];
200 200
 			$languages[]=$legal[1];
201
-			if (strlen($legal[2])>2000)
202
-				$legal[2]= substr($legal[2],0,2000).' ... ';
203
-			if ($legal[4]==0)
204
-				$legal[4]= get_lang('HTMLText');
205
-			elseif($legal[4]==1)
206
-				$legal[4]=get_lang('PageLink');
201
+			if (strlen($legal[2])>2000) {
202
+							$legal[2]= substr($legal[2],0,2000).' ... ';
203
+			}
204
+			if ($legal[4]==0) {
205
+							$legal[4]= get_lang('HTMLText');
206
+			} elseif($legal[4]==1) {
207
+							$legal[4]=get_lang('PageLink');
208
+			}
207 209
 			$legals[] = $legal;
208 210
 		}
209 211
 		return $legals;
Please login to merge, or discard this patch.
main/inc/lib/events.lib.php 3 patches
Spacing   +10 added lines, -12 removed lines patch added patch discarded remove patch
@@ -78,9 +78,7 @@  discard block
 block discarded – undo
78 78
         Database::query($sql);
79 79
 
80 80
         // Auto subscribe
81
-        $user_status = $userInfo['status']  == SESSIONADMIN ? 'sessionadmin' :
82
-            $userInfo['status'] == COURSEMANAGER ? 'teacher' :
83
-                $userInfo['status'] == DRH ? 'DRH' : 'student';
81
+        $user_status = $userInfo['status'] == SESSIONADMIN ? 'sessionadmin' : $userInfo['status'] == COURSEMANAGER ? 'teacher' : $userInfo['status'] == DRH ? 'DRH' : 'student';
84 82
         $autoSubscribe = api_get_setting($user_status.'_autosubscribe');
85 83
         if ($autoSubscribe) {
86 84
             $autoSubscribe = explode('|', $autoSubscribe);
@@ -334,7 +332,7 @@  discard block
 block discarded – undo
334 332
         global $debug;
335 333
 
336 334
         if ($debug) error_log('Called to update_event_exercice');
337
-        if ($debug) error_log('duration:' . $duration);
335
+        if ($debug) error_log('duration:'.$duration);
338 336
 
339 337
         if ($exeid != '') {
340 338
             /*
@@ -382,7 +380,7 @@  discard block
 block discarded – undo
382 380
         		   status = '".$status."',
383 381
         		   questions_to_check = '".$remind_list."',
384 382
         		   data_tracking = '".implode(',', $question_list)."',
385
-                   user_ip = '" . Database::escape_string(api_get_real_ip()) . "'
383
+                   user_ip = '" . Database::escape_string(api_get_real_ip())."'
386 384
         		 WHERE exe_id = '".Database::escape_string($exeid)."'";
387 385
             $res = Database::query($sql);
388 386
 
@@ -1036,15 +1034,15 @@  discard block
 block discarded – undo
1036 1034
 
1037 1035
         if (!empty($exe_list) && is_array($exe_list) && count($exe_list) > 0) {
1038 1036
             $sql = "DELETE FROM $track_e_exercises
1039
-                WHERE exe_id IN (" . implode(',', $exe_list) . ")";
1037
+                WHERE exe_id IN (".implode(',', $exe_list).")";
1040 1038
             Database::query($sql);
1041 1039
 
1042 1040
             $sql = "DELETE FROM $track_attempts
1043
-                WHERE exe_id IN (" . implode(',', $exe_list) . ")";
1041
+                WHERE exe_id IN (".implode(',', $exe_list).")";
1044 1042
             Database::query($sql);
1045 1043
 
1046 1044
             $sql = "DELETE FROM $recording_table
1047
-                WHERE exe_id IN (" . implode(',', $exe_list) . ")";
1045
+                WHERE exe_id IN (".implode(',', $exe_list).")";
1048 1046
             Database::query($sql);
1049 1047
         }
1050 1048
 
@@ -1086,7 +1084,7 @@  discard block
 block discarded – undo
1086 1084
             Event::addEvent(
1087 1085
                 LOG_EXERCISE_RESULT_DELETE,
1088 1086
                 LOG_EXERCISE_AND_USER_ID,
1089
-                $exercise_id . '-' . $user_id,
1087
+                $exercise_id.'-'.$user_id,
1090 1088
                 null,
1091 1089
                 null,
1092 1090
                 $course_id,
@@ -1458,7 +1456,7 @@  discard block
 block discarded – undo
1458 1456
         $res = Database::query($sql);
1459 1457
         $list = array();
1460 1458
         while ($row = Database::fetch_array($res, 'ASSOC')) {
1461
-            $list[$row['exe_id']] = $row;  /*
1459
+            $list[$row['exe_id']] = $row; /*
1462 1460
               $sql = "SELECT * FROM $table_track_attempt WHERE exe_id = {$row['exe_id']}";
1463 1461
               $res_question = Database::query($sql);
1464 1462
               while($row_q = Database::fetch_array($res_question,'ASSOC')) {
@@ -1684,7 +1682,7 @@  discard block
 block discarded – undo
1684 1682
         Event::addEvent(
1685 1683
             LOG_QUESTION_RESULT_DELETE,
1686 1684
             LOG_EXERCISE_ATTEMPT_QUESTION_ID,
1687
-            $exe_id . '-' . $question_id,
1685
+            $exe_id.'-'.$question_id,
1688 1686
             null,
1689 1687
             null,
1690 1688
             $courseId,
@@ -1720,7 +1718,7 @@  discard block
 block discarded – undo
1720 1718
         Event::addEvent(
1721 1719
             LOG_QUESTION_RESULT_DELETE,
1722 1720
             LOG_EXERCISE_ATTEMPT_QUESTION_ID,
1723
-            $exe_id . '-' . $question_id,
1721
+            $exe_id.'-'.$question_id,
1724 1722
             null,
1725 1723
             null,
1726 1724
             $courseId,
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -333,8 +333,12 @@  discard block
 block discarded – undo
333 333
     ) {
334 334
         global $debug;
335 335
 
336
-        if ($debug) error_log('Called to update_event_exercice');
337
-        if ($debug) error_log('duration:' . $duration);
336
+        if ($debug) {
337
+            error_log('Called to update_event_exercice');
338
+        }
339
+        if ($debug) {
340
+            error_log('duration:' . $duration);
341
+        }
338 342
 
339 343
         if ($exeid != '') {
340 344
             /*
@@ -386,8 +390,12 @@  discard block
 block discarded – undo
386 390
         		 WHERE exe_id = '".Database::escape_string($exeid)."'";
387 391
             $res = Database::query($sql);
388 392
 
389
-            if ($debug) error_log('update_event_exercice called');
390
-            if ($debug) error_log("$sql");
393
+            if ($debug) {
394
+                error_log('update_event_exercice called');
395
+            }
396
+            if ($debug) {
397
+                error_log("$sql");
398
+            }
391 399
 
392 400
             //Deleting control time session track
393 401
             //ExerciseLib::exercise_time_control_delete($exo_id);
Please login to merge, or discard this patch.
Doc Comments   +19 added lines, -10 removed lines patch added patch discarded remove patch
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
     }
240 240
 
241 241
     /**
242
-     * @param doc_id id of document (id in mainDb.document table)
242
+     * @param doc_id string of document (id in mainDb.document table)
243 243
      * @author Sebastien Piraux <[email protected]>
244 244
      * @desc Record information for upload event
245 245
      * used in the works tool to record informations when
@@ -311,6 +311,8 @@  discard block
 block discarded – undo
311 311
      * @param   int     session_id
312 312
      * @param   int     learnpath_id (id of the learnpath)
313 313
      * @param   int     learnpath_item_id (id of the learnpath_item)
314
+     * @param integer $weighting
315
+     * @param integer $session_id
314 316
      *
315 317
      * @author Sebastien Piraux <[email protected]>
316 318
      * @author Julio Montoya Armas <[email protected]> Reworked 2010
@@ -412,7 +414,9 @@  discard block
 block discarded – undo
412 414
      * @param	integer	Session ID (from the session table). Default value of null means "get from context".
413 415
      * @param	integer	Learnpath ID (from c_lp table). Default value of null means "get from context".
414 416
      * @param	integer	Learnpath item ID (from the c_lp_item table). Default value of null means "get from context".
415
-     * @return	boolean	Result of the insert query
417
+     * @param integer $exe_id
418
+     * @param integer $position
419
+     * @return	false|string	Result of the insert query
416 420
      */
417 421
     public static function saveQuestionAttempt(
418 422
         $score,
@@ -582,6 +586,7 @@  discard block
 block discarded – undo
582 586
      * @param	int		Whether this answer is correct (1) or not (0)
583 587
      * @param	string	Coordinates of this point (e.g. 123;324)
584 588
      * @param	bool update results?
589
+     * @param integer $exe_id
585 590
      * @return	boolean	Result of the insert query
586 591
      * @uses Course code and user_id from global scope $_cid and $_user
587 592
      */
@@ -714,7 +719,6 @@  discard block
 block discarded – undo
714 719
     /**
715 720
      * Get every email stored in the database
716 721
      *
717
-     * @param int $etId
718 722
      * @return type
719 723
      * @assert () !== false
720 724
      */
@@ -782,11 +786,11 @@  discard block
 block discarded – undo
782 786
     /**
783 787
      * Save the new message for one event and for one language
784 788
      *
785
-     * @param string $eventName
789
+     * @param string $event_name
786 790
      * @param array $users
787 791
      * @param string $message
788 792
      * @param string $subject
789
-     * @param string $eventMessageLanguage
793
+     * @param string $event_message_language
790 794
      * @param int $activated
791 795
      */
792 796
     public static function save_event_type_message($event_name, $users, $message, $subject, $event_message_language, $activated)
@@ -920,10 +924,10 @@  discard block
 block discarded – undo
920 924
     }
921 925
 
922 926
     /**
923
-     * @param $user_id
927
+     * @param integer $user_id
924 928
      * @param $exerciseId
925
-     * @param $lp_id
926
-     * @param $lp_item_id
929
+     * @param integer $lp_id
930
+     * @param integer $lp_item_id
927 931
      * @return int
928 932
      */
929 933
     public static function get_attempt_count_not_finished($user_id, $exerciseId, $lp_id, $lp_item_id)
@@ -1100,6 +1104,7 @@  discard block
 block discarded – undo
1100 1104
      * @param   int     exercise id
1101 1105
      * @param   int $courseId
1102 1106
      * @param   int     session id
1107
+     * @param integer $user_id
1103 1108
      * @return  array   with the results
1104 1109
      *
1105 1110
      */
@@ -1195,6 +1200,7 @@  discard block
 block discarded – undo
1195 1200
      * @param   int     exercise id
1196 1201
      * @param   int  $courseId
1197 1202
      * @param   int     session id
1203
+     * @param integer $user_id
1198 1204
      * @return  array   with the results
1199 1205
      *
1200 1206
      */
@@ -1235,6 +1241,7 @@  discard block
 block discarded – undo
1235 1241
      * @param   int     exercise id
1236 1242
      * @param   string  course code
1237 1243
      * @param   int     session id
1244
+     * @param integer $exe_id
1238 1245
      * @return  array   with the results
1239 1246
      *
1240 1247
      */
@@ -1284,6 +1291,8 @@  discard block
 block discarded – undo
1284 1291
      * @param   int     lp id
1285 1292
      * @param   int     lp item id
1286 1293
      * @param   string 	order asc or desc
1294
+     * @param integer $courseId
1295
+     * @param string $order
1287 1296
      * @return  array   with the results
1288 1297
      *
1289 1298
      */
@@ -1343,7 +1352,7 @@  discard block
 block discarded – undo
1343 1352
      * @param   int     exercise id
1344 1353
      * @param   int     $courseId
1345 1354
      * @param   int     session id
1346
-     * @return  array   with the results
1355
+     * @return  string   with the results
1347 1356
      *
1348 1357
      */
1349 1358
     public static function count_exercise_attempts_by_user($user_id, $exercise_id, $courseId, $session_id = 0)
@@ -1519,7 +1528,7 @@  discard block
 block discarded – undo
1519 1528
      * @param   int     exercise id
1520 1529
      * @param   int   course id
1521 1530
      * @param   int     session id
1522
-     * @return  array   with the results
1531
+     * @return  integer   with the results
1523 1532
      *
1524 1533
      */
1525 1534
     public static function get_count_exercises_attempted_by_course($courseId, $session_id = 0)
Please login to merge, or discard this patch.
main/inc/lib/message.lib.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1532,7 +1532,7 @@
 block discarded – undo
1532 1532
 
1533 1533
         if (isset($_REQUEST['action'])) {
1534 1534
             switch ($_REQUEST['action']) {
1535
-                 case 'mark_as_unread' :
1535
+                    case 'mark_as_unread' :
1536 1536
                     $number_of_selected_messages = count($_POST['id']);
1537 1537
                     if (is_array($_POST['id'])) {
1538 1538
                         foreach ($_POST['id'] as $index => $message_id) {
Please login to merge, or discard this patch.
Braces   +24 added lines, -16 removed lines patch added patch discarded remove patch
@@ -131,8 +131,9 @@  discard block
 block discarded – undo
131 131
             $direction = 'DESC';
132 132
         } else {
133 133
             $column = intval($column);
134
-            if (!in_array($direction, array('ASC', 'DESC')))
135
-                $direction = 'ASC';
134
+            if (!in_array($direction, array('ASC', 'DESC'))) {
135
+                            $direction = 'ASC';
136
+            }
136 137
         }
137 138
         $table_message = Database::get_main_table(TABLE_MESSAGE);
138 139
 
@@ -488,8 +489,9 @@  discard block
 block discarded – undo
488 489
     public static function delete_message_by_user_receiver($user_receiver_id, $id)
489 490
     {
490 491
         $table_message = Database::get_main_table(TABLE_MESSAGE);
491
-        if ($id != strval(intval($id)))
492
-            return false;
492
+        if ($id != strval(intval($id))) {
493
+                    return false;
494
+        }
493 495
         $user_receiver_id = intval($user_receiver_id);
494 496
         $id = intval($id);
495 497
         $sql = "SELECT * FROM $table_message
@@ -664,8 +666,9 @@  discard block
 block discarded – undo
664 666
      */
665 667
     public static function update_message($user_id, $message_id)
666 668
     {
667
-        if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id)))
668
-            return false;
669
+        if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id))) {
670
+                    return false;
671
+        }
669 672
 
670 673
         $table_message = Database::get_main_table(TABLE_MESSAGE);
671 674
         $sql = "UPDATE $table_message SET msg_status = '0'
@@ -705,8 +708,9 @@  discard block
 block discarded – undo
705 708
      */
706 709
     public static function get_message_by_user($user_id, $message_id)
707 710
     {
708
-        if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id)))
709
-            return false;
711
+        if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id))) {
712
+                    return false;
713
+        }
710 714
         $table_message = Database::get_main_table(TABLE_MESSAGE);
711 715
         $query = "SELECT * FROM $table_message
712 716
                   WHERE user_receiver_id=".intval($user_id)." AND id='".intval($message_id)."'";
@@ -721,8 +725,9 @@  discard block
 block discarded – undo
721 725
      */
722 726
     public static function get_messages_by_group($group_id)
723 727
     {
724
-        if ($group_id != strval(intval($group_id)))
725
-            return false;
728
+        if ($group_id != strval(intval($group_id))) {
729
+                    return false;
730
+        }
726 731
 
727 732
         $table_message = Database::get_main_table(TABLE_MESSAGE);
728 733
         $group_id = intval($group_id);
@@ -749,8 +754,9 @@  discard block
 block discarded – undo
749 754
      */
750 755
     public static function get_messages_by_group_by_message($group_id, $message_id)
751 756
     {
752
-        if ($group_id != strval(intval($group_id)))
753
-            return false;
757
+        if ($group_id != strval(intval($group_id))) {
758
+                    return false;
759
+        }
754 760
         $table_message = Database::get_main_table(TABLE_MESSAGE);
755 761
         $group_id = intval($group_id);
756 762
         $sql = "SELECT * FROM $table_message
@@ -828,8 +834,9 @@  discard block
 block discarded – undo
828 834
      */
829 835
     public static function exist_message($user_id, $id)
830 836
     {
831
-        if ($id != strval(intval($id)) || $user_id != strval(intval($user_id)))
832
-            return false;
837
+        if ($id != strval(intval($id)) || $user_id != strval(intval($user_id))) {
838
+                    return false;
839
+        }
833 840
         $table_message = Database::get_main_table(TABLE_MESSAGE);
834 841
         $query = "SELECT id FROM $table_message
835 842
                   WHERE
@@ -860,8 +867,9 @@  discard block
 block discarded – undo
860 867
             $direction = 'DESC';
861 868
         } else {
862 869
             $column = intval($column);
863
-            if (!in_array($direction, array('ASC', 'DESC')))
864
-                $direction = 'ASC';
870
+            if (!in_array($direction, array('ASC', 'DESC'))) {
871
+                            $direction = 'ASC';
872
+            }
865 873
         }
866 874
         $table_message = Database::get_main_table(TABLE_MESSAGE);
867 875
         $request = api_is_xml_http_request();
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
      * @param string $type
683 683
      * @return bool
684 684
      */
685
-    public static function update_message_status($user_id, $message_id,$type)
685
+    public static function update_message_status($user_id, $message_id, $type)
686 686
     {
687 687
         $type = intval($type);
688 688
         if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id))) {
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
 
997 997
         $receiverUserInfo = api_get_user_info($row['user_receiver_id']);
998 998
 
999
-        $message_content .='<tr>';
999
+        $message_content .= '<tr>';
1000 1000
         if (api_get_setting('allow_social_tool') == 'true') {
1001 1001
             if ($source == 'outbox') {
1002 1002
                 $message_content .= get_lang('From').': <a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_sender_id.'">'.$name.'</a> '.
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
                 $message_content .= get_lang('From').':&nbsp;'.$name.'</b> '.api_strtolower(get_lang('To')).' <b>'.get_lang('Me').'</b>';
1013 1013
             }
1014 1014
         }
1015
-        $message_content .=' '.get_lang('Date').':  '.api_get_local_time($row['send_date']).'
1015
+        $message_content .= ' '.get_lang('Date').':  '.api_get_local_time($row['send_date']).'
1016 1016
 		        <br />
1017 1017
 		        <hr style="color:#ddd" />
1018 1018
 		        <table height="209px" width="100%">
@@ -1038,7 +1038,7 @@  discard block
 block discarded – undo
1038 1038
         $message_content .= '<a href="inbox.php?action=deleteone&id='.$message_id.'&'.$social_link.'" >'.
1039 1039
             Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>&nbsp';
1040 1040
 
1041
-        $message_content .='</div></td>
1041
+        $message_content .= '</div></td>
1042 1042
 		      <td width=10></td>
1043 1043
 		    </tr>
1044 1044
 		</table>';
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
 
1116 1116
                 $items = $topic['count'];
1117 1117
                 $reply_label = ($items == 1) ? get_lang('GroupReply') : get_lang('GroupReplies');
1118
-                $label =  Display::label($items.' '.$reply_label);
1118
+                $label = Display::label($items.' '.$reply_label);
1119 1119
                 $topic['title'] = trim($topic['title']);
1120 1120
 
1121 1121
                 if (empty($topic['title'])) {
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
         $name = $user_sender_info['complete_name'];
1226 1226
 
1227 1227
         $topic_page_nr = isset($_GET['topics_page_nr']) ? intval($_GET['topics_page_nr']) : null;
1228
-        $links.= '<div id="message-reply-link">';
1228
+        $links .= '<div id="message-reply-link">';
1229 1229
         if (($my_group_role == GROUP_USER_PERMISSION_ADMIN ||
1230 1230
             $my_group_role == GROUP_USER_PERMISSION_MODERATOR) ||
1231 1231
             $main_message['user_sender_id'] == $current_user_id
@@ -1237,7 +1237,7 @@  discard block
 block discarded – undo
1237 1237
                 'group_id' => $group_id,
1238 1238
                 'message_id' => $main_message['id'],
1239 1239
                 'action' => 'edit_message_group',
1240
-                'anchor_topic' => 'topic_' . $main_message['id'],
1240
+                'anchor_topic' => 'topic_'.$main_message['id'],
1241 1241
                 'topics_page_nr' => $topic_page_nr,
1242 1242
                 'items_page_nr' => $items_page_nr,
1243 1243
                 'topic_id' => $main_message['id']
@@ -1267,7 +1267,7 @@  discard block
 block discarded – undo
1267 1267
             'group_id' => $group_id,
1268 1268
             'message_id' => $main_message['id'],
1269 1269
             'action' => 'reply_message_group',
1270
-            'anchor_topic' => 'topic_' . $main_message['id'],
1270
+            'anchor_topic' => 'topic_'.$main_message['id'],
1271 1271
             'topics_page_nr' => $topic_page_nr,
1272 1272
             'topic_id' => $main_message['id']
1273 1273
         ]);
@@ -1283,10 +1283,10 @@  discard block
 block discarded – undo
1283 1283
             ]
1284 1284
         );
1285 1285
 
1286
-        $links.= '</div>';
1286
+        $links .= '</div>';
1287 1287
 
1288 1288
         $userPicture = $user_sender_info['avatar'];
1289
-        $main_content.= '<div class="message-group-author">
1289
+        $main_content .= '<div class="message-group-author">
1290 1290
                          <img src="'.$userPicture.'" alt="'.$name.'"  width="32" height="32" title="'.$name.'" /></div>';
1291 1291
         $user_link = '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$main_message['user_sender_id'].'">'.$name.'&nbsp;</a>';
1292 1292
 
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
             $date = '<div class="message-group-date"> '.get_lang('Created').' '.date_to_str_ago($main_message['send_date']).'</div>';
1300 1300
         }
1301 1301
         $attachment = '<div class="message-attach">'.(!empty($files_attachments) ? implode('<br />', $files_attachments) : '').'</div>';
1302
-        $main_content.= '<div class="message-group-content">'.$links.$user_link.' '.$date.$main_message['content'].$attachment.'</div>';
1302
+        $main_content .= '<div class="message-group-content">'.$links.$user_link.' '.$date.$main_message['content'].$attachment.'</div>';
1303 1303
         $main_content = Security::remove_XSS($main_content, STUDENT, true);
1304 1304
 
1305 1305
         $html .= Display::div(Display::div(Display::div($main_content, array('class' => 'group_social_sub_item', 'style' => 'background-color:#fff;')), array('class' => 'group_social_item')), array('class' => 'group_social_grid'));
@@ -1320,18 +1320,18 @@  discard block
 block discarded – undo
1320 1320
                 $files_attachments = self::get_links_message_attachment_files($topic['id']);
1321 1321
                 $name = $user_sender_info['complete_name'];
1322 1322
 
1323
-                $links.= '<div id="message-reply-link">';
1323
+                $links .= '<div id="message-reply-link">';
1324 1324
                 if (($my_group_role == GROUP_USER_PERMISSION_ADMIN || $my_group_role == GROUP_USER_PERMISSION_MODERATOR) || $topic['user_sender_id'] == $current_user_id) {
1325
-                    $links.= '<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?height=400&width=800&&user_friend='.$current_user_id.'&group_id='.$group_id.'&message_id='.$topic['id'].'&action=edit_message_group&anchor_topic=topic_'.$topic_id.'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$topic_id.'" class="ajax btn" data-size="lg" data-title="'.get_lang('Edit').'" title="'.get_lang('Edit').'">'.
1325
+                    $links .= '<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?height=400&width=800&&user_friend='.$current_user_id.'&group_id='.$group_id.'&message_id='.$topic['id'].'&action=edit_message_group&anchor_topic=topic_'.$topic_id.'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$topic_id.'" class="ajax btn" data-size="lg" data-title="'.get_lang('Edit').'" title="'.get_lang('Edit').'">'.
1326 1326
                         Display :: return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
1327 1327
                 }
1328
-                $links.= '&nbsp;&nbsp;<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?height=400&width=800&&user_friend='.api_get_user_id().'&group_id='.$group_id.'&message_id='.$topic['id'].'&action=reply_message_group&anchor_topic=topic_'.$topic_id.'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$topic_id.'" class="ajax btn" data-size="lg" data-title="'.get_lang('Reply').'" title="'.get_lang('Reply').'">';
1329
-                $links.= Display :: return_icon('talk.png', get_lang('Reply')).'</a>';
1330
-                $links.= '</div>';
1328
+                $links .= '&nbsp;&nbsp;<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?height=400&width=800&&user_friend='.api_get_user_id().'&group_id='.$group_id.'&message_id='.$topic['id'].'&action=reply_message_group&anchor_topic=topic_'.$topic_id.'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$topic_id.'" class="ajax btn" data-size="lg" data-title="'.get_lang('Reply').'" title="'.get_lang('Reply').'">';
1329
+                $links .= Display :: return_icon('talk.png', get_lang('Reply')).'</a>';
1330
+                $links .= '</div>';
1331 1331
 
1332 1332
                 $userPicture = $user_sender_info['avatar'];
1333 1333
 
1334
-                $html_items.= '<div class="message-group-author"><img src="'.$userPicture.'" alt="'.$name.'"  width="32" height="32" title="'.$name.'" /></div>';
1334
+                $html_items .= '<div class="message-group-author"><img src="'.$userPicture.'" alt="'.$name.'"  width="32" height="32" title="'.$name.'" /></div>';
1335 1335
                 $user_link = '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$topic['user_sender_id'].'">'.$name.'&nbsp;</a>';
1336 1336
 
1337 1337
                 $date = '';
@@ -1343,7 +1343,7 @@  discard block
 block discarded – undo
1343 1343
                     $date = '<div class="message-group-date"> '.get_lang('Created').' '.date_to_str_ago($topic['send_date']).'</div>';
1344 1344
                 }
1345 1345
                 $attachment = '<div class="message-attach">'.(!empty($files_attachments) ? implode('<br />', $files_attachments) : '').'</div>';
1346
-                $html_items.= '<div class="message-group-content">'.$links.$user_link.' '.$date.Security::remove_XSS($topic['content'], STUDENT, true).$attachment.'</div>';
1346
+                $html_items .= '<div class="message-group-content">'.$links.$user_link.' '.$date.Security::remove_XSS($topic['content'], STUDENT, true).$attachment.'</div>';
1347 1347
 
1348 1348
                 $base_padding = 20;
1349 1349
 
@@ -1618,7 +1618,7 @@  discard block
 block discarded – undo
1618 1618
                     break;
1619 1619
                 case 'deleteone' :
1620 1620
                     MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_GET['id']);
1621
-                    $html .=Display::return_message(api_xml_http_response_encode($success), 'normal', false);
1621
+                    $html .= Display::return_message(api_xml_http_response_encode($success), 'normal', false);
1622 1622
                     $html .= '<br/>';
1623 1623
                     break;
1624 1624
             }
@@ -1710,7 +1710,7 @@  discard block
 block discarded – undo
1710 1710
                 ON m.user_sender_id = u.user_id
1711 1711
                 WHERE
1712 1712
                     m.user_receiver_id = $userId AND
1713
-                    m.msg_status = " . MESSAGE_STATUS_UNREAD . "
1713
+                    m.msg_status = ".MESSAGE_STATUS_UNREAD."
1714 1714
                     AND m.id > $lastId
1715 1715
                 ORDER BY m.send_date DESC";
1716 1716
 
Please login to merge, or discard this patch.
Doc Comments   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -639,6 +639,8 @@  discard block
 block discarded – undo
639 639
      * @param  int	message id
640 640
      * @param  int	message user id (receiver user id or sender user id)
641 641
      * @param  int	group id (optional)
642
+     * @param integer $message_id
643
+     * @param integer $message_uid
642 644
      * @return void
643 645
      */
644 646
     public static function delete_message_attachment_file($message_id, $message_uid, $group_id = 0)
@@ -683,7 +685,7 @@  discard block
 block discarded – undo
683 685
      * update messages by user id and message id
684 686
      * @param  int		$user_id
685 687
      * @param  int		$message_id
686
-     * @return resource
688
+     * @return false|null
687 689
      */
688 690
     public static function update_message($user_id, $message_id)
689 691
     {
@@ -703,7 +705,7 @@  discard block
 block discarded – undo
703 705
      * @param int $user_id
704 706
      * @param int $message_id
705 707
      * @param string $type
706
-     * @return bool
708
+     * @return false|null
707 709
      */
708 710
     public static function update_message_status($user_id, $message_id,$type)
709 711
     {
@@ -740,6 +742,7 @@  discard block
 block discarded – undo
740 742
     /**
741 743
      * get messages by group id
742 744
      * @param  int		group id
745
+     * @param integer $group_id
743 746
      * @return array
744 747
      */
745 748
     public static function get_messages_by_group($group_id)
@@ -1477,7 +1480,7 @@  discard block
 block discarded – undo
1477 1480
      * Sort date by desc from a multi-dimensional array
1478 1481
      * @param array $array1  first array to compare
1479 1482
      * @param array $array2  second array to compare
1480
-     * @return bool
1483
+     * @return integer
1481 1484
      */
1482 1485
     public function order_desc_date($array1, $array2)
1483 1486
     {
@@ -1555,7 +1558,6 @@  discard block
 block discarded – undo
1555 1558
     /**
1556 1559
      * @param $id
1557 1560
      * @param array $params
1558
-     * @param string $display
1559 1561
      * @return string
1560 1562
      */
1561 1563
     public static function generate_invitation_form($id, $params = array())
@@ -1644,7 +1646,7 @@  discard block
 block discarded – undo
1644 1646
 
1645 1647
     /**
1646 1648
      * @param string $keyword
1647
-     * @return null|string
1649
+     * @return string
1648 1650
      */
1649 1651
     public static function outbox_display($keyword = '')
1650 1652
     {
Please login to merge, or discard this patch.
main/inc/lib/search/xapian/XapianQuery.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@  discard block
 block discarded – undo
8 8
  * Code
9 9
  */
10 10
 require_once 'xapian.php';
11
-require_once dirname(__FILE__) . '/../IndexableChunk.class.php';
11
+require_once dirname(__FILE__).'/../IndexableChunk.class.php';
12 12
 //TODO: think another way without including specific fields here
13
-require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
13
+require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
14 14
 
15
-define('XAPIAN_DB', api_get_path(SYS_UPLOAD_PATH) . 'plugins/xapian/searchdb/');
15
+define('XAPIAN_DB', api_get_path(SYS_UPLOAD_PATH).'plugins/xapian/searchdb/');
16 16
 
17 17
 /**
18 18
  * Queries the database.
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
                 // process each specific field prefix
97 97
                 foreach ($specific_fields as $specific_field) {
98
-                    $results[$count]['sf-' . $specific_field['code']] = xapian_get_doc_terms($document, $specific_field['code']);
98
+                    $results[$count]['sf-'.$specific_field['code']] = xapian_get_doc_terms($document, $specific_field['code']);
99 99
                 }
100 100
 
101 101
                 // rest of data
@@ -261,6 +261,6 @@  discard block
 block discarded – undo
261 261
     } else {
262 262
         $message_error = get_lang('SearchOtherXapianError');
263 263
     }
264
-    $display_message = get_lang('Error') . ' : ' . $message_error;
264
+    $display_message = get_lang('Error').' : '.$message_error;
265 265
     Display::display_error_message($display_message);
266 266
 }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -239,6 +239,7 @@
 block discarded – undo
239 239
 /**
240 240
  * @author Isaac flores paz <[email protected]>
241 241
  * @param String The xapian error message
242
+ * @param string $xapian_error_message
242 243
  * @return String The chamilo error message
243 244
  */
244 245
 function display_xapian_error($xapian_error_message) {
Please login to merge, or discard this patch.
main/inc/lib/search/get_terms.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
     return;
18 18
 }
19 19
 
20
-require_once dirname(__FILE__) . '../../../global.inc.php';
21
-require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloQuery.php';
20
+require_once dirname(__FILE__).'../../../global.inc.php';
21
+require_once api_get_path(LIBRARY_PATH).'search/ChamiloQuery.php';
22 22
 
23 23
 /**
24 24
  * search with filter and build base array avoding repeated terms
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     if (is_array($dkterms) && is_array($dkterms[1])) {
34 34
         foreach ($specific_fields as $specific_field) {
35 35
             foreach ($dkterms[1] as $obj) {
36
-                foreach ($obj['sf-' . $specific_field['code']] as $raw_term) {
36
+                foreach ($obj['sf-'.$specific_field['code']] as $raw_term) {
37 37
                     if (count($raw_term['name']) > 1) {
38 38
                         $normal_term = substr($raw_term['name'], 1);
39 39
                         $sf_terms[$specific_field['code']][$normal_term] = $normal_term;
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
 
55 55
 if (($cid = api_get_course_id()) != -1) { // with cid
56 56
     // course filter
57
-    $filter[] = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID . $cid);
57
+    $filter[] = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID.$cid);
58 58
     // term filter
59 59
     if ($term != '__all__') {
60
-        $filter[] = chamilo_get_boolean_query($prefix . $term);
60
+        $filter[] = chamilo_get_boolean_query($prefix.$term);
61 61
         // always and between term and courseid
62 62
         $filter = chamilo_join_queries($filter, null, 'and');
63 63
     }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     $sf_terms = get_usual_sf_terms($filter, $specific_fields);
66 66
 } else { // without cid
67 67
     if ($term != '__all__') {
68
-        $filter[] = chamilo_get_boolean_query($prefix . $term);
68
+        $filter[] = chamilo_get_boolean_query($prefix.$term);
69 69
 
70 70
         $sf_terms = get_usual_sf_terms($filter, $specific_fields);
71 71
     } else { // no cid and all/any terms
Please login to merge, or discard this patch.