Passed
Push — 1.10.x ( 04397c...5e25f1 )
by Angel Fernando Quiroz
181:14 queued 130:00
created
main/inc/lib/array.lib.php 1 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 1 patch
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.
main/inc/lib/legal.lib.php 1 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.
main/inc/lib/blog.lib.php 1 patch
Spacing   +399 added lines, -399 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @return String Blog Title
23 23
 	 */
24
-	public static function get_blog_title ($blog_id)
24
+	public static function get_blog_title($blog_id)
25 25
 	{
26 26
 	    $course_id = api_get_course_int_id();
27 27
 
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 			$tbl_blogs = Database::get_course_table(TABLE_BLOGS);
31 31
 
32 32
 			$sql = "SELECT blog_name
33
-					FROM " . $tbl_blogs . "
34
-					WHERE c_id = $course_id AND blog_id = " . intval($blog_id);
33
+					FROM " . $tbl_blogs."
34
+					WHERE c_id = $course_id AND blog_id = ".intval($blog_id);
35 35
 
36 36
 			$result = Database::query($sql);
37 37
 			$blog = Database::fetch_array($result);
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
 
79 79
 		// Get blog members
80 80
 		$sql = "SELECT user.user_id, user.firstname, user.lastname
81
-				FROM " . $tbl_blogs_rel_user . " blogs_rel_user
82
-				INNER JOIN " . $tbl_users . " user
81
+				FROM " . $tbl_blogs_rel_user." blogs_rel_user
82
+				INNER JOIN " . $tbl_users." user
83 83
 				ON blogs_rel_user.user_id = user.user_id
84 84
 				WHERE
85 85
 				    blogs_rel_user.c_id = $course_id AND
86
-					blogs_rel_user.blog_id = '" . (int)$blog_id."'";
86
+					blogs_rel_user.blog_id = '".(int) $blog_id."'";
87 87
 		$result = Database::query($sql);
88
-		$blog_members = array ();
89
-		while($user = Database::fetch_array($result)) {
88
+		$blog_members = array();
89
+		while ($user = Database::fetch_array($result)) {
90 90
 			$blog_members[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']);
91 91
 		}
92 92
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		$_user = api_get_user_info();
106 106
         $course_id = api_get_course_int_id();
107 107
 
108
-		$current_date=date('Y-m-d H:i:s',time());
108
+		$current_date = date('Y-m-d H:i:s', time());
109 109
 		$session_id = api_get_session_id();
110 110
 		// Tabel definitions
111 111
         $tbl_blogs = Database::get_course_table(TABLE_BLOGS);
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
                 'blog_name' => $title,
131 131
                 'blog_subtitle' =>  $subtitle,
132 132
                 'date_creation' => $current_date,
133
-                'visibility' => 1 ,
133
+                'visibility' => 1,
134 134
                 'session_id' => $session_id,
135 135
             ];
136 136
 			$this_blog_id = Database::insert($tbl_blogs, $params);
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 
170 170
 			// Put it on course homepage
171 171
 			$sql = "INSERT INTO $tbl_tool (c_id, name, link, image, visibility, admin, address, added_tool, session_id)
172
-					VALUES ($course_id, '".Database::escape_string($title)."','blog/blog.php?blog_id=".(int)$this_blog_id."','blog.gif','1','0','pastillegris.gif',0,'$session_id')";
172
+					VALUES ($course_id, '".Database::escape_string($title)."','blog/blog.php?blog_id=".(int) $this_blog_id."','blog.gif','1','0','pastillegris.gif',0,'$session_id')";
173 173
 			Database::query($sql);
174 174
 
175 175
             $toolId = Database::insert_id();
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 		        blog_subtitle = '".Database::escape_string($subtitle)."'
205 205
 		        WHERE
206 206
 		            c_id = $course_id AND
207
-		            blog_id ='".Database::escape_string((int)$blog_id)."'
207
+		            blog_id ='".Database::escape_string((int) $blog_id)."'
208 208
                 LIMIT 1";
209 209
 		Database::query($sql);
210 210
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 		// Update course homepage link
221 221
 		$sql = "UPDATE $tbl_tool SET
222 222
 		        name = '".Database::escape_string($title)."'
223
-		        WHERE c_id = $course_id AND link = 'blog/blog.php?blog_id=".(int)$blog_id."' LIMIT 1";
223
+		        WHERE c_id = $course_id AND link = 'blog/blog.php?blog_id=".(int) $blog_id."' LIMIT 1";
224 224
 		Database::query($sql);
225 225
 	}
226 226
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 		Database::query($sql);
264 264
 
265 265
 		// Delete blog
266
-		$sql ="DELETE FROM $tbl_blogs WHERE c_id = $course_id AND blog_id ='".$blog_id."'";
266
+		$sql = "DELETE FROM $tbl_blogs WHERE c_id = $course_id AND blog_id ='".$blog_id."'";
267 267
 		Database::query($sql);
268 268
 
269 269
 		// Delete from course homepage
@@ -294,13 +294,13 @@  discard block
 block discarded – undo
294 294
 		$course_id = $_course['real_id'];
295 295
 
296 296
 		$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
297
-		$upload_ok=true;
298
-		$has_attachment=false;
297
+		$upload_ok = true;
298
+		$has_attachment = false;
299 299
 		$current_date = api_get_utc_datetime();
300 300
 
301 301
 		if (!empty($_FILES['user_upload']['name'])) {
302 302
 			$upload_ok = process_uploaded_file($_FILES['user_upload']);
303
-			$has_attachment=true;
303
+			$has_attachment = true;
304 304
 		}
305 305
 
306 306
 		if ($upload_ok) {
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 
310 310
 			// Create the post
311 311
 			$sql = "INSERT INTO $tbl_blogs_posts (c_id, title, full_text, date_creation, blog_id, author_id )
312
-					VALUES ($course_id, '".Database::escape_string($title)."', '".Database::escape_string($full_text)."','".$current_date."', '".(int)$blog_id."', '".(int)$_user['user_id']."');";
312
+					VALUES ($course_id, '".Database::escape_string($title)."', '".Database::escape_string($full_text)."','".$current_date."', '".(int) $blog_id."', '".(int) $_user['user_id']."');";
313 313
 
314 314
 			Database::query($sql);
315 315
 			$last_post_id = Database::insert_id();
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
             }
321 321
 
322 322
 			if ($has_attachment) {
323
-				$courseDir   = $_course['path'].'/upload/blog';
323
+				$courseDir = $_course['path'].'/upload/blog';
324 324
 				$sys_course_path = api_get_path(SYS_COURSE_PATH);
325 325
 				$updir = $sys_course_path.$courseDir;
326 326
 
@@ -371,9 +371,9 @@  discard block
 block discarded – undo
371 371
 
372 372
 		// Create the post
373 373
 		$sql = "UPDATE $tbl_blogs_posts SET
374
-		        title = '" . Database::escape_string($title)."',
374
+		        title = '".Database::escape_string($title)."',
375 375
 		        full_text = '" . Database::escape_string($full_text)."'
376
-		        WHERE c_id = $course_id AND post_id ='".(int)$post_id."' AND blog_id ='".(int)$blog_id."'
376
+		        WHERE c_id = $course_id AND post_id ='".(int) $post_id."' AND blog_id ='".(int) $blog_id."'
377 377
 		        LIMIT 1 ";
378 378
 		Database::query($sql);
379 379
 	}
@@ -394,21 +394,21 @@  discard block
 block discarded – undo
394 394
 
395 395
 		// Delete ratings on this comment
396 396
 		$sql = "DELETE FROM $tbl_blogs_rating
397
-				WHERE c_id = $course_id AND blog_id = '".(int)$blog_id."' AND item_id = '".(int)$post_id."' AND rating_type = 'post'";
397
+				WHERE c_id = $course_id AND blog_id = '".(int) $blog_id."' AND item_id = '".(int) $post_id."' AND rating_type = 'post'";
398 398
 		Database::query($sql);
399 399
 
400 400
 		// Delete the post
401 401
 		$sql = "DELETE FROM $tbl_blogs_posts
402
-				WHERE c_id = $course_id AND post_id = '".(int)$post_id."'";
402
+				WHERE c_id = $course_id AND post_id = '".(int) $post_id."'";
403 403
 		Database::query($sql);
404 404
 
405 405
 		// Delete the comments
406 406
 		$sql = "DELETE FROM $tbl_blogs_comments
407
-				WHERE c_id = $course_id AND post_id = '".(int)$post_id."' AND blog_id = '".(int)$blog_id."'";
407
+				WHERE c_id = $course_id AND post_id = '".(int) $post_id."' AND blog_id = '".(int) $blog_id."'";
408 408
 		Database::query($sql);
409 409
 
410 410
 		// Delete posts and attachments
411
-		delete_all_blog_attachment($blog_id,$post_id);
411
+		delete_all_blog_attachment($blog_id, $post_id);
412 412
 	}
413 413
 
414 414
 	/**
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 	{
425 425
 		$_user = api_get_user_info();
426 426
 		$_course = api_get_course_info();
427
-        $blog_table_attachment 	= Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
427
+        $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
428 428
 
429 429
         $upload_ok = true;
430 430
         $has_attachment = false;
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 
434 434
 		if (!empty($_FILES['user_upload']['name'])) {
435 435
 			$upload_ok = process_uploaded_file($_FILES['user_upload']);
436
-			$has_attachment=true;
436
+			$has_attachment = true;
437 437
 		}
438 438
 
439 439
 		if ($upload_ok) {
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 
443 443
 			// Create the comment
444 444
 			$sql = "INSERT INTO $tbl_blogs_comments (c_id, title, comment, author_id, date_creation, blog_id, post_id, parent_comment_id, task_id )
445
-					VALUES ($course_id, '".Database::escape_string($title)."', '".Database::escape_string($full_text)."', '".(int)$_user['user_id']."','".$current_date."', '".(int)$blog_id."', '".(int)$post_id."', '".(int)$parent_id."', '".(int)$task_id."')";
445
+					VALUES ($course_id, '".Database::escape_string($title)."', '".Database::escape_string($full_text)."', '".(int) $_user['user_id']."','".$current_date."', '".(int) $blog_id."', '".(int) $post_id."', '".(int) $parent_id."', '".(int) $task_id."')";
446 446
 			Database::query($sql);
447 447
 
448 448
 			// Empty post values, or they are shown on the page again
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
             }
455 455
 
456 456
 			if ($has_attachment) {
457
-				$courseDir   = $_course['path'].'/upload/blog';
457
+				$courseDir = $_course['path'].'/upload/blog';
458 458
 				$sys_course_path = api_get_path(SYS_COURSE_PATH);
459 459
 				$updir = $sys_course_path.$courseDir;
460 460
 
@@ -465,19 +465,19 @@  discard block
 block discarded – undo
465 465
 				);
466 466
 
467 467
 				// user's file name
468
-				$file_name =$_FILES['user_upload']['name'];
468
+				$file_name = $_FILES['user_upload']['name'];
469 469
 
470 470
 				if (!filter_extension($new_file_name)) {
471 471
 					Display :: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension'));
472 472
 				} else {
473 473
 					$new_file_name = uniqid('');
474
-					$new_path=$updir.'/'.$new_file_name;
475
-					$result= @move_uploaded_file($_FILES['user_upload']['tmp_name'], $new_path);
474
+					$new_path = $updir.'/'.$new_file_name;
475
+					$result = @move_uploaded_file($_FILES['user_upload']['tmp_name'], $new_path);
476 476
 					$comment = Database::escape_string($file_comment);
477 477
 
478 478
 					// Storing the attachments if any
479 479
 					if ($result) {
480
-						$sql='INSERT INTO '.$blog_table_attachment.'(c_id, filename,comment, path, post_id,size,blog_id,comment_id) '.
480
+						$sql = 'INSERT INTO '.$blog_table_attachment.'(c_id, filename,comment, path, post_id,size,blog_id,comment_id) '.
481 481
 							 "VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$post_id."', '".$_FILES['user_upload']['size']."',  '".$blog_id."', '".$last_id."'  )";
482 482
 						Database::query($sql);
483 483
 
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 
527 527
 		// Delete them recursively
528 528
 		while ($comment = Database::fetch_array($result)) {
529
-			Blog::delete_comment($blog_id,$post_id,$comment['comment_id']);
529
+			Blog::delete_comment($blog_id, $post_id, $comment['comment_id']);
530 530
 		}
531 531
 
532 532
 		// Finally, delete the selected comment to
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 
554 554
 		// Create the task
555 555
 		$sql = "INSERT INTO $tbl_blogs_tasks (c_id, blog_id, title, description, color, system_task)
556
-				VALUES ($course_id , '".(int)$blog_id."', '" . Database::escape_string($title)."', '" . Database::escape_string($description)."', '" . Database::escape_string($color)."', '0');";
556
+				VALUES ($course_id , '".(int) $blog_id."', '".Database::escape_string($title)."', '".Database::escape_string($description)."', '".Database::escape_string($color)."', '0');";
557 557
 		Database::query($sql);
558 558
 
559 559
 		$task_id = Database::insert_id();
@@ -563,13 +563,13 @@  discard block
 block discarded – undo
563 563
             Database::query($sql);
564 564
         }
565 565
 
566
-		$tool = 'BLOG_' . $blog_id;
566
+		$tool = 'BLOG_'.$blog_id;
567 567
 
568 568
 		if ($articleDelete == 'on') {
569
-			$sql = " INSERT INTO " . $tbl_tasks_permissions . " ( c_id,  task_id, tool, action) VALUES (
570
-					'" . (int)$course_id . "',
571
-					'" . (int)$task_id . "',
572
-					'" . Database::escape_string($tool) . "',
569
+			$sql = " INSERT INTO ".$tbl_tasks_permissions." ( c_id,  task_id, tool, action) VALUES (
570
+					'" . (int) $course_id."',
571
+					'" . (int) $task_id."',
572
+					'" . Database::escape_string($tool)."',
573 573
 					'article_delete'
574 574
 				)";
575 575
 			Database::query($sql);
@@ -584,10 +584,10 @@  discard block
 block discarded – undo
584 584
 
585 585
 		if ($articleEdit == 'on') {
586 586
 			$sql = "
587
-				INSERT INTO " . $tbl_tasks_permissions . " (c_id, task_id, tool, action ) VALUES (
588
-					'" . (int)$course_id . "',
589
-					'" . (int)$task_id . "',
590
-					'" . Database::escape_string($tool) . "',
587
+				INSERT INTO " . $tbl_tasks_permissions." (c_id, task_id, tool, action ) VALUES (
588
+					'" . (int) $course_id."',
589
+					'" . (int) $task_id."',
590
+					'" . Database::escape_string($tool)."',
591 591
 					'article_edit'
592 592
 				)";
593 593
 			Database::query($sql);
@@ -601,10 +601,10 @@  discard block
 block discarded – undo
601 601
 
602 602
 		if ($commentsDelete == 'on') {
603 603
 			$sql = "
604
-				INSERT INTO " . $tbl_tasks_permissions . " (c_id, task_id, tool, action ) VALUES (
605
-					'" . (int)$course_id . "',
606
-					'" . (int)$task_id . "',
607
-					'" . Database::escape_string($tool) . "',
604
+				INSERT INTO " . $tbl_tasks_permissions." (c_id, task_id, tool, action ) VALUES (
605
+					'" . (int) $course_id."',
606
+					'" . (int) $task_id."',
607
+					'" . Database::escape_string($tool)."',
608 608
 					'article_comments_delete'
609 609
 				)";
610 610
 			Database::query($sql);
@@ -637,20 +637,20 @@  discard block
 block discarded – undo
637 637
 					title = '".Database::escape_string($title)."',
638 638
 					description = '".Database::escape_string($description)."',
639 639
 					color = '".Database::escape_string($color)."'
640
-				WHERE c_id = $course_id AND task_id ='".(int)$task_id."' LIMIT 1";
640
+				WHERE c_id = $course_id AND task_id ='".(int) $task_id."' LIMIT 1";
641 641
 		Database::query($sql);
642 642
 
643
-		$tool = 'BLOG_' . $blog_id;
643
+		$tool = 'BLOG_'.$blog_id;
644 644
 
645
-		$sql = "DELETE FROM " . $tbl_tasks_permissions . "
646
-				WHERE c_id = $course_id AND task_id = '" . (int)$task_id."'";
645
+		$sql = "DELETE FROM ".$tbl_tasks_permissions."
646
+				WHERE c_id = $course_id AND task_id = '".(int) $task_id."'";
647 647
 		Database::query($sql);
648 648
 
649 649
 		if ($articleDelete == 'on') {
650
-			$sql = "INSERT INTO " . $tbl_tasks_permissions . " ( c_id, task_id, tool, action) VALUES (
651
-					'" . (int)$course_id . "',
652
-					'" . (int)$task_id . "',
653
-					'" . Database::escape_string($tool) . "',
650
+			$sql = "INSERT INTO ".$tbl_tasks_permissions." ( c_id, task_id, tool, action) VALUES (
651
+					'" . (int) $course_id."',
652
+					'" . (int) $task_id."',
653
+					'" . Database::escape_string($tool)."',
654 654
 					'article_delete'
655 655
 				)";
656 656
 			Database::query($sql);
@@ -663,10 +663,10 @@  discard block
 block discarded – undo
663 663
 		}
664 664
 
665 665
 		if ($articleEdit == 'on') {
666
-			$sql = "INSERT INTO " . $tbl_tasks_permissions . " (c_id, task_id, tool, action) VALUES (
667
-					'" . (int)$course_id . "',
668
-					'" . (int)$task_id . "',
669
-					'" . Database::escape_string($tool) . "',
666
+			$sql = "INSERT INTO ".$tbl_tasks_permissions." (c_id, task_id, tool, action) VALUES (
667
+					'" . (int) $course_id."',
668
+					'" . (int) $task_id."',
669
+					'" . Database::escape_string($tool)."',
670 670
 					'article_edit'
671 671
 				)";
672 672
 			Database::query($sql);
@@ -679,10 +679,10 @@  discard block
 block discarded – undo
679 679
 		}
680 680
 
681 681
 		if ($commentsDelete == 'on') {
682
-			$sql = " INSERT INTO " . $tbl_tasks_permissions . " (c_id, task_id, tool, action) VALUES (
683
-					'" . (int)$course_id . "',
684
-					'" . (int)$task_id . "',
685
-					'" . Database::escape_string($tool) . "',
682
+			$sql = " INSERT INTO ".$tbl_tasks_permissions." (c_id, task_id, tool, action) VALUES (
683
+					'" . (int) $course_id."',
684
+					'" . (int) $task_id."',
685
+					'" . Database::escape_string($tool)."',
686 686
 					'article_comments_delete'
687 687
 				)";
688 688
 			Database::query($sql);
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 
708 708
 		// Delete posts
709 709
 		$sql = "DELETE FROM $tbl_blogs_tasks
710
-				WHERE c_id = $course_id AND blog_id = '".(int)$blog_id."' AND task_id = '".(int)$task_id."'";
710
+				WHERE c_id = $course_id AND blog_id = '".(int) $blog_id."' AND task_id = '".(int) $task_id."'";
711 711
 		Database::query($sql);
712 712
 	}
713 713
 
@@ -725,9 +725,9 @@  discard block
 block discarded – undo
725 725
 		$sql = "DELETE FROM $tbl_blogs_tasks_rel_user
726 726
 				WHERE
727 727
 				    c_id = $course_id AND
728
-				    blog_id = '".(int)$blog_id."' AND
729
-				    task_id = '".(int)$task_id."' AND
730
-				    user_id = '".(int)$user_id."'";
728
+				    blog_id = '".(int) $blog_id."' AND
729
+				    task_id = '".(int) $task_id."' AND
730
+				    user_id = '".(int) $user_id."'";
731 731
 		Database::query($sql);
732 732
 	}
733 733
 
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 		$_user = api_get_user_info();
742 742
 
743 743
 		$tbl_blogs = Database::get_course_table(TABLE_BLOGS);
744
-		$tbl_blogs_tasks_rel_user 	= Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER);
744
+		$tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER);
745 745
 		$tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS);
746 746
 
747 747
 		$course_id = api_get_course_int_id();
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
                         task.c_id = $course_id AND
759 759
                         blog.c_id = $course_id AND
760 760
                         task_rel_user.c_id = $course_id AND
761
-                        task_rel_user.user_id = ".(int)$_user['user_id']."
761
+                        task_rel_user.user_id = ".(int) $_user['user_id']."
762 762
                     ORDER BY target_date ASC";
763 763
 
764 764
 			$result = Database::query($sql);
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 			if (Database::num_rows($result) > 0) {
767 767
 				echo '<ul>';
768 768
 				while ($mytask = Database::fetch_array($result)) {
769
-					echo '<li><a href="blog.php?action=execute_task&blog_id=' . $mytask['blog_id'] . '&task_id='.stripslashes($mytask['task_id']) . '" title="[Blog: '.stripslashes($mytask['blog_name']) . '] ' . get_lang('ExecuteThisTask') . '">'.stripslashes($mytask['title']) . '</a></li>';
769
+					echo '<li><a href="blog.php?action=execute_task&blog_id='.$mytask['blog_id'].'&task_id='.stripslashes($mytask['task_id']).'" title="[Blog: '.stripslashes($mytask['blog_name']).'] '.get_lang('ExecuteThisTask').'">'.stripslashes($mytask['title']).'</a></li>';
770 770
 				}
771 771
 				echo '<ul>';
772 772
 			} else {
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
 
791 791
 		// Get blog properties
792 792
 		$sql = "SELECT blog_name, visibility FROM $tbl_blogs
793
-				WHERE c_id = $course_id AND blog_id='".(int)$blog_id."'";
793
+				WHERE c_id = $course_id AND blog_id='".(int) $blog_id."'";
794 794
 		$result = Database::query($sql);
795 795
 		$blog = Database::fetch_array($result);
796 796
 		$visibility = $blog['visibility'];
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
 		if ($visibility == 1) {
800 800
 			// Change visibility state, remove from course home.
801 801
 			$sql = "UPDATE $tbl_blogs SET visibility = '0'
802
-					WHERE c_id = $course_id AND blog_id ='".(int)$blog_id."' LIMIT 1";
802
+					WHERE c_id = $course_id AND blog_id ='".(int) $blog_id."' LIMIT 1";
803 803
 			Database::query($sql);
804 804
 
805 805
 			$sql = "DELETE FROM $tbl_tool
@@ -808,11 +808,11 @@  discard block
 block discarded – undo
808 808
 		} else {
809 809
 			// Change visibility state, add to course home.
810 810
 			$sql = "UPDATE $tbl_blogs SET visibility = '1'
811
-					WHERE c_id = $course_id AND blog_id ='".(int)$blog_id."' LIMIT 1";
811
+					WHERE c_id = $course_id AND blog_id ='".(int) $blog_id."' LIMIT 1";
812 812
 			Database::query($sql);
813 813
 
814 814
 			$sql = "INSERT INTO $tbl_tool (c_id, name, link, image, visibility, admin, address, added_tool, target )
815
-					VALUES ($course_id, '".Database::escape_string($title)."', 'blog/blog.php?blog_id=".(int)$blog_id."', 'blog.gif', '1', '0', 'pastillegris.gif', '0', '_self')";
815
+					VALUES ($course_id, '".Database::escape_string($title)."', 'blog/blog.php?blog_id=".(int) $blog_id."', 'blog.gif', '1', '0', 'pastillegris.gif', '0', '_self')";
816 816
 			Database::query($sql);
817 817
             $id = Database::insert_id();
818 818
 
@@ -843,14 +843,14 @@  discard block
 block discarded – undo
843 843
 		        FROM $tbl_blogs_posts post
844 844
                 INNER JOIN $tbl_users user
845 845
                 ON post.author_id = user.user_id
846
-				WHERE 	post.blog_id = '".(int)$blog_id."' AND
846
+				WHERE 	post.blog_id = '".(int) $blog_id."' AND
847 847
 						post.c_id = $course_id AND
848 848
 						$filter
849
-				ORDER BY post_id DESC LIMIT 0,".(int)$max_number_of_posts;
849
+				ORDER BY post_id DESC LIMIT 0,".(int) $max_number_of_posts;
850 850
 		$result = Database::query($sql);
851 851
 
852 852
 		// Display
853
-		if(Database::num_rows($result) > 0) {
853
+		if (Database::num_rows($result) > 0) {
854 854
 		    $limit = 200;
855 855
 			while ($blog_post = Database::fetch_array($result)) {
856 856
 				// Get number of comments
@@ -858,8 +858,8 @@  discard block
 block discarded – undo
858 858
 						FROM $tbl_blogs_comments
859 859
 						WHERE
860 860
 						    c_id = $course_id AND
861
-						    blog_id = '".(int)$blog_id."' AND
862
-						    post_id = '" . (int)$blog_post['post_id']."'";
861
+						    blog_id = '".(int) $blog_id."' AND
862
+						    post_id = '" . (int) $blog_post['post_id']."'";
863 863
 				$tmp = Database::query($sql);
864 864
 				$blog_post_comments = Database::fetch_array($tmp);
865 865
 
@@ -870,11 +870,11 @@  discard block
 block discarded – undo
870 870
 
871 871
 				// Create an introduction text (but keep FULL sentences)
872 872
 				$words = 0;
873
-				$blog_post_text_cut = cut($blog_post_text, $limit) ;
873
+				$blog_post_text_cut = cut($blog_post_text, $limit);
874 874
 				$words = strlen($blog_post_text);
875 875
 
876 876
 				if ($words >= $limit) {
877
-					$readMoreLink = ' <div class="link" onclick="document.getElementById(\'blogpost_text_' . $blog_post_id . '\').style.display=\'block\'; document.getElementById(\'blogpost_introduction_' . $blog_post_id . '\').style.display=\'none\'">' . get_lang('ReadMore') . '</div>';
877
+					$readMoreLink = ' <div class="link" onclick="document.getElementById(\'blogpost_text_'.$blog_post_id.'\').style.display=\'block\'; document.getElementById(\'blogpost_introduction_'.$blog_post_id.'\').style.display=\'none\'">'.get_lang('ReadMore').'</div>';
878 878
 					$introduction_text = $blog_post_text_cut;
879 879
 				} else {
880 880
 				    $introduction_text = $blog_post_text;
@@ -884,27 +884,27 @@  discard block
 block discarded – undo
884 884
 				$introduction_text = stripslashes($introduction_text);
885 885
 
886 886
 				echo '<div class="blogpost">';
887
-				echo '<span class="blogpost_title"><a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $blog_post['post_id'] . '#add_comment" title="' . get_lang('ReadPost') . '" >'.stripslashes($blog_post['title']) . '</a></span>';
888
-				echo '<span class="blogpost_date"><a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $blog_post['post_id'] . '#add_comment" title="' . get_lang('ReadPost') . '" >' . $blog_post_date . '</a></span>';
889
-				echo '<div class="blogpost_introduction" id="blogpost_introduction_'.$blog_post_id.'">' . $introduction_text.$readMoreLink.'</div>';
890
-				echo '<div class="blogpost_text" id="blogpost_text_' . $blog_post_id . '" style="display: none">' . $blog_post_text . '</div>';
887
+				echo '<span class="blogpost_title"><a href="blog.php?action=view_post&blog_id='.$blog_id.'&post_id='.$blog_post['post_id'].'#add_comment" title="'.get_lang('ReadPost').'" >'.stripslashes($blog_post['title']).'</a></span>';
888
+				echo '<span class="blogpost_date"><a href="blog.php?action=view_post&blog_id='.$blog_id.'&post_id='.$blog_post['post_id'].'#add_comment" title="'.get_lang('ReadPost').'" >'.$blog_post_date.'</a></span>';
889
+				echo '<div class="blogpost_introduction" id="blogpost_introduction_'.$blog_post_id.'">'.$introduction_text.$readMoreLink.'</div>';
890
+				echo '<div class="blogpost_text" id="blogpost_text_'.$blog_post_id.'" style="display: none">'.$blog_post_text.'</div>';
891 891
 
892
-				$file_name_array = get_blog_attachment($blog_id,$blog_post_id,0);
892
+				$file_name_array = get_blog_attachment($blog_id, $blog_post_id, 0);
893 893
 
894 894
 				if (!empty($file_name_array)) {
895 895
 					echo '<br /><br />';
896
-					echo Display::return_icon('attachment.gif',get_lang('Attachment'));
896
+					echo Display::return_icon('attachment.gif', get_lang('Attachment'));
897 897
 					echo '<a href="download.php?file=';
898 898
 					echo $file_name_array['path'];
899 899
 					echo ' "> '.$file_name_array['filename'].' </a><br />';
900 900
 					echo '</span>';
901 901
 				}
902 902
 				$username = api_htmlentities(sprintf(get_lang('LoginX'), $blog_post['username']), ENT_QUOTES);
903
-				echo '<span class="blogpost_info">' . get_lang('Author') . ': ' . Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username)) .' - <a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $blog_post['post_id'] . '#add_comment" title="' . get_lang('ReadPost') . '" >' . get_lang('Comments') . ': ' . $blog_post_comments['number_of_comments'] . '</a></span>';
903
+				echo '<span class="blogpost_info">'.get_lang('Author').': '.Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username)).' - <a href="blog.php?action=view_post&blog_id='.$blog_id.'&post_id='.$blog_post['post_id'].'#add_comment" title="'.get_lang('ReadPost').'" >'.get_lang('Comments').': '.$blog_post_comments['number_of_comments'].'</a></span>';
904 904
 				echo '</div>';
905 905
 			}
906 906
 		} else {
907
-			if($filter == '1=1') {
907
+			if ($filter == '1=1') {
908 908
 				echo get_lang('NoArticles');
909 909
 			} else {
910 910
 				echo get_lang('NoArticleMatches');
@@ -918,19 +918,19 @@  discard block
 block discarded – undo
918 918
 	 * @param Integer $blog_id
919 919
 	 * @param String $query_string
920 920
 	 */
921
-	public static function display_search_results ($blog_id, $query_string)
921
+	public static function display_search_results($blog_id, $query_string)
922 922
 	{
923 923
 		// Init
924 924
 		$query_string = Database::escape_string($query_string);
925
-		$query_string_parts = explode(' ',$query_string);
925
+		$query_string_parts = explode(' ', $query_string);
926 926
 		$query_string = array();
927 927
 		foreach ($query_string_parts as $query_part) {
928
-			$query_string[] = " full_text LIKE '%" . $query_part."%' OR title LIKE '%" . $query_part."%' ";
928
+			$query_string[] = " full_text LIKE '%".$query_part."%' OR title LIKE '%".$query_part."%' ";
929 929
 		}
930
-		$query_string = '('.implode('OR',$query_string) . ')';
930
+		$query_string = '('.implode('OR', $query_string).')';
931 931
 
932 932
 		// Display the posts
933
-		echo '<span class="blogpost_title">' . get_lang('SearchResults') . '</span>';
933
+		echo '<span class="blogpost_title">'.get_lang('SearchResults').'</span>';
934 934
 		Blog::display_blog_posts($blog_id, $query_string);
935 935
 	}
936 936
 
@@ -943,14 +943,14 @@  discard block
 block discarded – undo
943 943
 	public static function display_day_results($blog_id, $query_string)
944 944
 	{
945 945
 		$date_output = $query_string;
946
-		$date = explode('-',$query_string);
947
-		$query_string = ' DAYOFMONTH(date_creation) =' . intval($date[2]) . ' AND MONTH(date_creation) =' . intval($date[1]) . ' AND YEAR(date_creation) =' . intval($date[0]);
946
+		$date = explode('-', $query_string);
947
+		$query_string = ' DAYOFMONTH(date_creation) ='.intval($date[2]).' AND MONTH(date_creation) ='.intval($date[1]).' AND YEAR(date_creation) ='.intval($date[0]);
948 948
 
949 949
 		// Put date in correct output format
950 950
 		$date_output = api_format_date($date_output, DATE_FORMAT_LONG);
951 951
 
952 952
 		// Display the posts
953
-		echo '<span class="blogpost_title">' . get_lang('PostsOf') . ': ' . $date_output . '</span>';
953
+		echo '<span class="blogpost_title">'.get_lang('PostsOf').': '.$date_output.'</span>';
954 954
 		Blog::display_blog_posts($blog_id, $query_string);
955 955
 	}
956 956
 
@@ -977,8 +977,8 @@  discard block
 block discarded – undo
977 977
 					ON post.author_id = user.user_id
978 978
                 WHERE
979 979
                     post.c_id = $course_id AND
980
-                    post.blog_id = '".(int)$blog_id."' AND
981
-                    post.post_id = '".(int)$post_id."'
980
+                    post.blog_id = '".(int) $blog_id."' AND
981
+                    post.post_id = '".(int) $post_id."'
982 982
                 ORDER BY post_id DESC";
983 983
 		$result = Database::query($sql);
984 984
 		$blog_post = Database::fetch_array($result);
@@ -986,7 +986,7 @@  discard block
 block discarded – undo
986 986
 		// Get number of comments
987 987
 		$sql = "SELECT COUNT(1) as number_of_comments
988 988
 		        FROM $tbl_blogs_comments
989
-				WHERE c_id = $course_id AND blog_id = '".(int)$blog_id."' AND post_id = '".(int)$post_id."'";
989
+				WHERE c_id = $course_id AND blog_id = '".(int) $blog_id."' AND post_id = '".(int) $post_id."'";
990 990
 		$result = Database::query($sql);
991 991
 		$blog_post_comments = Database::fetch_array($result);
992 992
 
@@ -997,28 +997,28 @@  discard block
 block discarded – undo
997 997
 
998 998
 		$task_id = (isset($_GET['task_id']) && is_numeric($_GET['task_id'])) ? intval($_GET['task_id']) : 0;
999 999
 
1000
-		if (api_is_allowed('BLOG_' . $blog_id, 'article_edit', $task_id))
1001
-			$blog_post_actions .= '<a href="blog.php?action=edit_post&blog_id=' . $blog_id . '&post_id=' . $post_id . '&article_id=' . $blog_post['post_id'] . '&task_id=' . $task_id . '" title="' . get_lang('EditThisPost') . '"><img src="../img/edit.gif" /></a>';
1000
+		if (api_is_allowed('BLOG_'.$blog_id, 'article_edit', $task_id))
1001
+			$blog_post_actions .= '<a href="blog.php?action=edit_post&blog_id='.$blog_id.'&post_id='.$post_id.'&article_id='.$blog_post['post_id'].'&task_id='.$task_id.'" title="'.get_lang('EditThisPost').'"><img src="../img/edit.gif" /></a>';
1002 1002
 
1003
-		if (api_is_allowed('BLOG_' . $blog_id, 'article_delete', $task_id))
1004
-			$blog_post_actions .= '<a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $post_id . '&do=delete_article&article_id=' . $blog_post['post_id'] . '&task_id=' . $task_id . '" title="' . get_lang('DeleteThisArticle') . '" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;"><img src="../img/delete.gif" border="0" /></a>';
1003
+		if (api_is_allowed('BLOG_'.$blog_id, 'article_delete', $task_id))
1004
+			$blog_post_actions .= '<a href="blog.php?action=view_post&blog_id='.$blog_id.'&post_id='.$post_id.'&do=delete_article&article_id='.$blog_post['post_id'].'&task_id='.$task_id.'" title="'.get_lang('DeleteThisArticle').'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)).'\')) return false;"><img src="../img/delete.gif" border="0" /></a>';
1005 1005
 
1006
-		if(api_is_allowed('BLOG_' . $blog_id, 'article_rate'))
1007
-			$rating_select = Blog::display_rating_form('post',$blog_id,$post_id);
1006
+		if (api_is_allowed('BLOG_'.$blog_id, 'article_rate'))
1007
+			$rating_select = Blog::display_rating_form('post', $blog_id, $post_id);
1008 1008
 
1009
-		$blog_post_text=stripslashes($blog_post_text);
1009
+		$blog_post_text = stripslashes($blog_post_text);
1010 1010
 
1011 1011
 		// Display post
1012 1012
 		echo '<div class="blogpost">';
1013
-		echo '<span class="blogpost_title"><a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $blog_post['post_id'] . '" title="' . get_lang('ReadPost') . '" >'.stripslashes($blog_post['title']) . '</a></span>';
1014
-		echo '<span class="blogpost_date">' . $blog_post_date . '</span>';
1015
-		echo '<span class="blogpost_text">' . $blog_post_text . '</span><br />';
1013
+		echo '<span class="blogpost_title"><a href="blog.php?action=view_post&blog_id='.$blog_id.'&post_id='.$blog_post['post_id'].'" title="'.get_lang('ReadPost').'" >'.stripslashes($blog_post['title']).'</a></span>';
1014
+		echo '<span class="blogpost_date">'.$blog_post_date.'</span>';
1015
+		echo '<span class="blogpost_text">'.$blog_post_text.'</span><br />';
1016 1016
 
1017 1017
 		$file_name_array = get_blog_attachment($blog_id, $post_id);
1018 1018
 
1019 1019
         if (!empty($file_name_array)) {
1020 1020
 			echo ' <br />';
1021
-			echo Display::return_icon('attachment.gif',get_lang('Attachment'));
1021
+			echo Display::return_icon('attachment.gif', get_lang('Attachment'));
1022 1022
 			echo '<a href="download.php?file=';
1023 1023
 			echo $file_name_array['path'];
1024 1024
 			echo ' "> '.$file_name_array['filename'].' </a>';
@@ -1029,20 +1029,20 @@  discard block
 block discarded – undo
1029 1029
 			echo '<br />';
1030 1030
 		}
1031 1031
         $username = api_htmlentities(sprintf(get_lang('LoginX'), $blog_post['username']), ENT_QUOTES);
1032
-		echo '<span class="blogpost_info">'.get_lang('Author').': ' .Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username)).' - '.get_lang('Comments').': '.$blog_post_comments['number_of_comments'].' - '.get_lang('Rating').': '.Blog::display_rating('post',$blog_id,$post_id).$rating_select.'</span>';
1033
-		echo '<span class="blogpost_actions">' . $blog_post_actions . '</span>';
1032
+		echo '<span class="blogpost_info">'.get_lang('Author').': '.Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username)).' - '.get_lang('Comments').': '.$blog_post_comments['number_of_comments'].' - '.get_lang('Rating').': '.Blog::display_rating('post', $blog_id, $post_id).$rating_select.'</span>';
1033
+		echo '<span class="blogpost_actions">'.$blog_post_actions.'</span>';
1034 1034
 		echo '</div>';
1035 1035
 
1036 1036
 		// Display comments if there are any
1037
-		if($blog_post_comments['number_of_comments'] > 0) {
1037
+		if ($blog_post_comments['number_of_comments'] > 0) {
1038 1038
 			echo '<div class="comments">';
1039
-				echo '<span class="blogpost_title">' . get_lang('Comments') . '</span><br />';
1039
+				echo '<span class="blogpost_title">'.get_lang('Comments').'</span><br />';
1040 1040
 				Blog::get_threaded_comments(0, 0, $blog_id, $post_id, $task_id);
1041 1041
 			echo '</div>';
1042 1042
 		}
1043 1043
 
1044 1044
 		// Display comment form
1045
-		if (api_is_allowed('BLOG_' . $blog_id, 'article_comments_add')) {
1045
+		if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_add')) {
1046 1046
 			Blog::display_new_comment_form($blog_id, $post_id, $blog_post['title']);
1047 1047
 		}
1048 1048
 	}
@@ -1070,16 +1070,16 @@  discard block
 block discarded – undo
1070 1070
 		$sql = "SELECT rating_id FROM $tbl_blogs_rating
1071 1071
                 WHERE
1072 1072
                     c_id = $course_id AND
1073
-                    blog_id = '".(int)$blog_id."' AND
1074
-                    item_id = '".(int)$item_id."' AND
1073
+                    blog_id = '".(int) $blog_id."' AND
1074
+                    item_id = '".(int) $item_id."' AND
1075 1075
                     rating_type = '".Database::escape_string($type)."' AND
1076
-                    user_id = '".(int)$_user['user_id']."'";
1076
+                    user_id = '".(int) $_user['user_id']."'";
1077 1077
 		$result = Database::query($sql);
1078 1078
 
1079 1079
         // Add rating
1080 1080
 		if (Database::num_rows($result) == 0) {
1081 1081
 			$sql = "INSERT INTO $tbl_blogs_rating (c_id, blog_id, rating_type, item_id, user_id, rating )
1082
-					VALUES ($course_id, '".(int)$blog_id."', '".Database::escape_string($type)."', '".(int)$item_id."', '".(int)$_user['user_id']."', '".Database::escape_string($rating)."')";
1082
+					VALUES ($course_id, '".(int) $blog_id."', '".Database::escape_string($type)."', '".(int) $item_id."', '".(int) $_user['user_id']."', '".Database::escape_string($rating)."')";
1083 1083
 			Database::query($sql);
1084 1084
 
1085 1085
             $id = Database::insert_id();
@@ -1112,8 +1112,8 @@  discard block
 block discarded – undo
1112 1112
 		$sql = "SELECT AVG(rating) as rating FROM $tbl_blogs_rating
1113 1113
 				WHERE
1114 1114
 				    c_id = $course_id AND
1115
-				    blog_id = '".(int)$blog_id."' AND
1116
-				    item_id = '".(int)$item_id."' AND
1115
+				    blog_id = '".(int) $blog_id."' AND
1116
+				    item_id = '".(int) $item_id."' AND
1117 1117
 				    rating_type = '".Database::escape_string($type)."' ";
1118 1118
 		$result = Database::query($sql);
1119 1119
 		$result = Database::fetch_array($result);
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 	 *
1131 1131
 	 *@return String
1132 1132
 	 */
1133
-	public static function display_rating_form ($type, $blog_id, $post_id, $comment_id = NULL)
1133
+	public static function display_rating_form($type, $blog_id, $post_id, $comment_id = NULL)
1134 1134
 	{
1135 1135
 		$_user = api_get_user_info();
1136 1136
 		$tbl_blogs_rating = Database::get_course_table(TABLE_BLOGS_RATING);
@@ -1140,14 +1140,14 @@  discard block
 block discarded – undo
1140 1140
 			// Check if the user has already rated this post
1141 1141
 			$sql = "SELECT rating_id FROM $tbl_blogs_rating
1142 1142
 					WHERE c_id = $course_id AND
1143
-					blog_id = '".(int)$blog_id."'
1144
-					AND item_id = '".(int)$post_id."'
1143
+					blog_id = '".(int) $blog_id."'
1144
+					AND item_id = '".(int) $post_id."'
1145 1145
 					AND rating_type = '".Database::escape_string($type)."'
1146
-					AND user_id = '".(int)$_user['user_id']."'";
1146
+					AND user_id = '".(int) $_user['user_id']."'";
1147 1147
 			$result = Database::query($sql);
1148 1148
             // Add rating
1149 1149
             if (Database::num_rows($result) == 0) {
1150
-				return ' - ' . get_lang('RateThis') . ': <form method="get" action="blog.php" style="display: inline" id="frm_rating_' . $type . '_' . $post_id . '" name="frm_rating_' . $type . '_' . $post_id . '"><select name="rating" onchange="document.forms[\'frm_rating_' . $type . '_' . $post_id . '\'].submit()"><option value="">-</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option></select><input type="hidden" name="action" value="view_post" /><input type="hidden" name="type" value="' . $type . '" /><input type="hidden" name="do" value="rate" /><input type="hidden" name="blog_id" value="' . $blog_id . '" /><input type="hidden" name="post_id" value="' . $post_id . '" /></form>';
1150
+				return ' - '.get_lang('RateThis').': <form method="get" action="blog.php" style="display: inline" id="frm_rating_'.$type.'_'.$post_id.'" name="frm_rating_'.$type.'_'.$post_id.'"><select name="rating" onchange="document.forms[\'frm_rating_'.$type.'_'.$post_id.'\'].submit()"><option value="">-</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option></select><input type="hidden" name="action" value="view_post" /><input type="hidden" name="type" value="'.$type.'" /><input type="hidden" name="do" value="rate" /><input type="hidden" name="blog_id" value="'.$blog_id.'" /><input type="hidden" name="post_id" value="'.$post_id.'" /></form>';
1151 1151
             } else {
1152 1152
 				return '';
1153 1153
 			}
@@ -1156,14 +1156,14 @@  discard block
 block discarded – undo
1156 1156
         if ($type = 'comment') {
1157 1157
 			// Check if the user has already rated this comment
1158 1158
 			$sql = "SELECT rating_id FROM $tbl_blogs_rating
1159
-					WHERE c_id = $course_id AND blog_id = '".(int)$blog_id ."'
1160
-					AND item_id = '".(int)$comment_id."'
1159
+					WHERE c_id = $course_id AND blog_id = '".(int) $blog_id."'
1160
+					AND item_id = '".(int) $comment_id."'
1161 1161
 					AND rating_type = '".Database::escape_string($type)."'
1162
-					AND user_id = '".(int)$_user['user_id']."'";
1162
+					AND user_id = '".(int) $_user['user_id']."'";
1163 1163
 			$result = Database::query($sql);
1164 1164
 
1165 1165
             if (Database::num_rows($result) == 0) {
1166
-				return ' - ' . get_lang('RateThis') . ': <form method="get" action="blog.php" style="display: inline" id="frm_rating_' . $type . '_' . $comment_id . '" name="frm_rating_' . $type . '_' . $comment_id . '"><select name="rating" onchange="document.forms[\'frm_rating_' . $type . '_' . $comment_id . '\'].submit()"><option value="">-</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option></select><input type="hidden" name="action" value="view_post" /><input type="hidden" name="type" value="' . $type . '" /><input type="hidden" name="do" value="rate" /><input type="hidden" name="blog_id" value="' . $blog_id . '" /><input type="hidden" name="post_id" value="' . $post_id . '" /><input type="hidden" name="comment_id" value="' . $comment_id . '" /></form>';
1166
+				return ' - '.get_lang('RateThis').': <form method="get" action="blog.php" style="display: inline" id="frm_rating_'.$type.'_'.$comment_id.'" name="frm_rating_'.$type.'_'.$comment_id.'"><select name="rating" onchange="document.forms[\'frm_rating_'.$type.'_'.$comment_id.'\'].submit()"><option value="">-</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option></select><input type="hidden" name="action" value="view_post" /><input type="hidden" name="type" value="'.$type.'" /><input type="hidden" name="do" value="rate" /><input type="hidden" name="blog_id" value="'.$blog_id.'" /><input type="hidden" name="post_id" value="'.$post_id.'" /><input type="hidden" name="comment_id" value="'.$comment_id.'" /></form>';
1167 1167
             } else {
1168 1168
 				return '';
1169 1169
 			}
@@ -1198,11 +1198,11 @@  discard block
 block discarded – undo
1198 1198
                 WHERE
1199 1199
                     comments.c_id = $course_id AND
1200 1200
                     parent_comment_id = $current AND
1201
-                    comments.blog_id = '".(int)$blog_id."' AND
1202
-                    comments.post_id = '".(int)$post_id."'";
1201
+                    comments.blog_id = '".(int) $blog_id."' AND
1202
+                    comments.post_id = '".(int) $post_id."'";
1203 1203
 		$result = Database::query($sql);
1204 1204
 
1205
-		while($comment = Database::fetch_array($result)) {
1205
+		while ($comment = Database::fetch_array($result)) {
1206 1206
 			// Select the children recursivly
1207 1207
 			$tmp = "SELECT comments.*, user.lastname, user.firstname, user.username
1208 1208
 			        FROM $tbl_blogs_comments comments
@@ -1211,8 +1211,8 @@  discard block
 block discarded – undo
1211 1211
 					WHERE
1212 1212
 						comments.c_id = $course_id AND
1213 1213
 						comment_id = $current
1214
-						AND blog_id = '".(int)$blog_id."'
1215
-						AND post_id = '".(int)$post_id."'";
1214
+						AND blog_id = '".(int) $blog_id."'
1215
+						AND post_id = '".(int) $post_id."'";
1216 1216
 			$tmp = Database::query($tmp);
1217 1217
 			$tmp = Database::fetch_array($tmp);
1218 1218
 			$parent_cat = $tmp['parent_comment_id'];
@@ -1222,26 +1222,26 @@  discard block
 block discarded – undo
1222 1222
 			$comment_text = make_clickable(stripslashes($comment['comment']));
1223 1223
 			$blog_comment_date = api_convert_and_format_date($comment['date_creation'], null, date_default_timezone_get());
1224 1224
 			$blog_comment_actions = "";
1225
-			if(api_is_allowed('BLOG_' . $blog_id, 'article_comments_delete', $task_id)) { $blog_comment_actions .= '<a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $post_id . '&do=delete_comment&comment_id=' . $comment['comment_id'] . '&task_id=' . $task_id . '" title="' . get_lang('DeleteThisComment') . '" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;"><img src="../img/delete.gif" border="0" /></a>'; }
1226
-			if(api_is_allowed('BLOG_' . $blog_id, 'article_comments_rate')) { $rating_select = Blog::display_rating_form('comment', $blog_id, $post_id, $comment['comment_id']); }
1225
+			if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_delete', $task_id)) { $blog_comment_actions .= '<a href="blog.php?action=view_post&blog_id='.$blog_id.'&post_id='.$post_id.'&do=delete_comment&comment_id='.$comment['comment_id'].'&task_id='.$task_id.'" title="'.get_lang('DeleteThisComment').'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)).'\')) return false;"><img src="../img/delete.gif" border="0" /></a>'; }
1226
+			if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_rate')) { $rating_select = Blog::display_rating_form('comment', $blog_id, $post_id, $comment['comment_id']); }
1227 1227
 
1228 1228
 			if (!is_null($comment['task_id'])) {
1229
-				$border_color = ' border-left: 3px solid #' . $comment['color'];
1229
+				$border_color = ' border-left: 3px solid #'.$comment['color'];
1230 1230
 			}
1231 1231
 
1232 1232
 			$comment_text = stripslashes($comment_text);
1233 1233
 
1234 1234
 			// Output...
1235 1235
 			$margin = $current_level * 30;
1236
-			echo '<div class="blogpost_comment" style="margin-left: ' . $margin . 'px;' . $border_color . '">';
1237
-				echo '<span class="blogpost_comment_title"><a href="#add_comment" onclick="document.getElementById(\'comment_parent_id\').value=\'' . $comment['comment_id'] . '\'; document.getElementById(\'comment_title\').value=\'Re: '.addslashes($comment['title']) . '\'" title="' . get_lang('ReplyToThisComment') . '" >'.stripslashes($comment['title']) . '</a></span>';
1238
-				echo '<span class="blogpost_comment_date">' . $blog_comment_date . '</span>';
1239
-				echo '<span class="blogpost_text">' . $comment_text . '</span>';
1236
+			echo '<div class="blogpost_comment" style="margin-left: '.$margin.'px;'.$border_color.'">';
1237
+				echo '<span class="blogpost_comment_title"><a href="#add_comment" onclick="document.getElementById(\'comment_parent_id\').value=\''.$comment['comment_id'].'\'; document.getElementById(\'comment_title\').value=\'Re: '.addslashes($comment['title']).'\'" title="'.get_lang('ReplyToThisComment').'" >'.stripslashes($comment['title']).'</a></span>';
1238
+				echo '<span class="blogpost_comment_date">'.$blog_comment_date.'</span>';
1239
+				echo '<span class="blogpost_text">'.$comment_text.'</span>';
1240 1240
 
1241
-				$file_name_array=get_blog_attachment($blog_id,$post_id, $comment['comment_id']);
1241
+				$file_name_array = get_blog_attachment($blog_id, $post_id, $comment['comment_id']);
1242 1242
 				if (!empty($file_name_array)) {
1243 1243
 					echo '<br /><br />';
1244
-					echo Display::return_icon('attachment.gif',get_lang('Attachment'));
1244
+					echo Display::return_icon('attachment.gif', get_lang('Attachment'));
1245 1245
 					echo '<a href="download.php?file=';
1246 1246
 					echo $file_name_array['path'];
1247 1247
 					echo ' "> '.$file_name_array['filename'].' </a>';
@@ -1251,7 +1251,7 @@  discard block
 block discarded – undo
1251 1251
 				}
1252 1252
                 $username = api_htmlentities(sprintf(get_lang('LoginX'), $comment['username']), ENT_QUOTES);
1253 1253
 				echo '<span class="blogpost_comment_info">'.get_lang('Author').': '.Display::tag('span', api_get_person_name($comment['firstname'], $comment['lastname']), array('title'=>$username)).' - '.get_lang('Rating').': '.Blog::display_rating('comment', $blog_id, $comment['comment_id']).$rating_select.'</span>';
1254
-				echo '<span class="blogpost_actions">' . $blog_comment_actions . '</span>';
1254
+				echo '<span class="blogpost_actions">'.$blog_comment_actions.'</span>';
1255 1255
 			echo '</div>';
1256 1256
 
1257 1257
 			// Go further down the tree.
@@ -1267,11 +1267,11 @@  discard block
 block discarded – undo
1267 1267
 	 */
1268 1268
 	public static function display_form_new_post($blog_id)
1269 1269
 	{
1270
-		if (api_is_allowed('BLOG_' . $blog_id, 'article_add')) {
1270
+		if (api_is_allowed('BLOG_'.$blog_id, 'article_add')) {
1271 1271
 			$form = new FormValidator(
1272 1272
 				'add_post',
1273 1273
 				'post',
1274
-				api_get_path(WEB_CODE_PATH)."blog/blog.php?action=new_post&blog_id=" . $blog_id . "&" . api_get_cidreq(),
1274
+				api_get_path(WEB_CODE_PATH)."blog/blog.php?action=new_post&blog_id=".$blog_id."&".api_get_cidreq(),
1275 1275
 				null,
1276 1276
 				array('enctype' => 'multipart/form-data')
1277 1277
 			);
@@ -1315,8 +1315,8 @@  discard block
 block discarded – undo
1315 1315
 				INNER JOIN $tbl_users user ON post.author_id = user.user_id
1316 1316
 				WHERE
1317 1317
 				post.c_id 			= $course_id AND
1318
-				post.blog_id 		= '".(int)$blog_id ."'
1319
-				AND post.post_id	= '".(int)$post_id."'
1318
+				post.blog_id 		= '".(int) $blog_id."'
1319
+				AND post.post_id	= '".(int) $post_id."'
1320 1320
 				ORDER BY post_id DESC";
1321 1321
 		$result = Database::query($sql);
1322 1322
 		$blog_post = Database::fetch_array($result);
@@ -1325,7 +1325,7 @@  discard block
 block discarded – undo
1325 1325
 		$form = new FormValidator(
1326 1326
 			'edit_post',
1327 1327
 			'post',
1328
-			api_get_path(WEB_CODE_PATH).'blog/blog.php?action=edit_post&post_id=' . intval($_GET['post_id']) . '&blog_id=' . intval($blog_id) . '&article_id='.intval($_GET['article_id']).'&task_id='.intval($_GET['task_id'])
1328
+			api_get_path(WEB_CODE_PATH).'blog/blog.php?action=edit_post&post_id='.intval($_GET['post_id']).'&blog_id='.intval($blog_id).'&article_id='.intval($_GET['article_id']).'&task_id='.intval($_GET['task_id'])
1329 1329
 		);
1330 1330
 
1331 1331
 		$form->addHeader(get_lang('EditPost'));
@@ -1357,26 +1357,26 @@  discard block
 block discarded – undo
1357 1357
 		global $charset;
1358 1358
         $course_id = api_get_course_int_id();
1359 1359
 
1360
-		if (api_is_allowed('BLOG_' . $blog_id, 'article_add')) {
1360
+		if (api_is_allowed('BLOG_'.$blog_id, 'article_add')) {
1361 1361
 			$tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS);
1362 1362
 			$counter = 0;
1363 1363
 			global $color2;
1364 1364
 
1365 1365
 			echo '<div class="actions">';
1366
-			echo '<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $blog_id . '&do=add"><img src="../img/blog_newtasks.gif" border="0" align="middle" alt="'.get_lang('AddTasks').'" />' . get_lang('AddTasks') . '</a> ';
1367
-			echo '<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $blog_id . '&do=assign"><img src="../img/blog_task.gif" border="0" align="middle" alt="'.get_lang('AssignTasks').'" />' . get_lang('AssignTasks') . '</a>';
1366
+			echo '<a href="'.api_get_self().'?action=manage_tasks&blog_id='.$blog_id.'&do=add"><img src="../img/blog_newtasks.gif" border="0" align="middle" alt="'.get_lang('AddTasks').'" />'.get_lang('AddTasks').'</a> ';
1367
+			echo '<a href="'.api_get_self().'?action=manage_tasks&blog_id='.$blog_id.'&do=assign"><img src="../img/blog_task.gif" border="0" align="middle" alt="'.get_lang('AssignTasks').'" />'.get_lang('AssignTasks').'</a>';
1368 1368
 			?>
1369
-				<a href="<?php echo api_get_self(); ?>?action=manage_rights&blog_id=<?php echo $blog_id ?>" title="<?php echo get_lang('ManageRights') ?>"><?php echo Display::return_icon('blog_admin_users.png', get_lang('RightsManager'),'',ICON_SIZE_SMALL). get_lang('RightsManager') ?></a>
1369
+				<a href="<?php echo api_get_self(); ?>?action=manage_rights&blog_id=<?php echo $blog_id ?>" title="<?php echo get_lang('ManageRights') ?>"><?php echo Display::return_icon('blog_admin_users.png', get_lang('RightsManager'), '', ICON_SIZE_SMALL).get_lang('RightsManager') ?></a>
1370 1370
 			<?php
1371 1371
 			echo '</div>';
1372 1372
 
1373
-			echo '<span class="blogpost_title">' . get_lang('TaskList') . '</span><br />';
1373
+			echo '<span class="blogpost_title">'.get_lang('TaskList').'</span><br />';
1374 1374
 			echo "<table class=\"data_table\">";
1375 1375
 			echo	"<tr bgcolor=\"$color2\" align=\"center\" valign=\"top\">",
1376
-					 "<th width='240'><b>",get_lang('Title'),"</b></th>\n",
1377
-					 "<th><b>",get_lang('Description'),"</b></th>\n",
1378
-					 "<th><b>",get_lang('Color'),"</b></th>\n",
1379
-					 "<th width='50'><b>",get_lang('Modify'),"</b></th>\n",
1376
+					 "<th width='240'><b>", get_lang('Title'), "</b></th>\n",
1377
+					 "<th><b>", get_lang('Description'), "</b></th>\n",
1378
+					 "<th><b>", get_lang('Color'), "</b></th>\n",
1379
+					 "<th width='50'><b>", get_lang('Modify'), "</b></th>\n",
1380 1380
 				"</tr>\n";
1381 1381
 
1382 1382
 
@@ -1388,31 +1388,31 @@  discard block
 block discarded – undo
1388 1388
                         description,
1389 1389
                         color,
1390 1390
                         system_task
1391
-                    FROM " . $tbl_blogs_tasks . "
1392
-                    WHERE c_id = $course_id AND blog_id = " . (int)$blog_id . "
1391
+                    FROM " . $tbl_blogs_tasks."
1392
+                    WHERE c_id = $course_id AND blog_id = ".(int) $blog_id."
1393 1393
                     ORDER BY system_task, title";
1394 1394
 			$result = Database::query($sql);
1395 1395
 
1396 1396
 
1397
-			while($task = Database::fetch_array($result)) {
1397
+			while ($task = Database::fetch_array($result)) {
1398 1398
 				$counter++;
1399 1399
 				$css_class = (($counter % 2) == 0) ? "row_odd" : "row_even";
1400 1400
 				$delete_icon = ($task['system_task'] == '1') ? "delete_na.gif" : "delete.gif";
1401 1401
 				$delete_title = ($task['system_task'] == '1') ? get_lang('DeleteSystemTask') : get_lang('DeleteTask');
1402
-				$delete_link = ($task['system_task'] == '1') ? '#' : api_get_self() . '?action=manage_tasks&blog_id=' . $task['blog_id'] . '&do=delete&task_id=' . $task['task_id'];
1403
-				$delete_confirm = ($task['system_task'] == '1') ? '' : 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;"';
1402
+				$delete_link = ($task['system_task'] == '1') ? '#' : api_get_self().'?action=manage_tasks&blog_id='.$task['blog_id'].'&do=delete&task_id='.$task['task_id'];
1403
+				$delete_confirm = ($task['system_task'] == '1') ? '' : 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)).'\')) return false;"';
1404 1404
 
1405
-				echo	'<tr class="' . $css_class . '" valign="top">',
1406
-							 '<td width="240">' . Security::remove_XSS($task['title']) . '</td>',
1407
-							 '<td>' . Security::remove_XSS($task['description']) . '</td>',
1408
-							 '<td><span style="background-color: #' . $task['color'] . '">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></td>',
1405
+				echo	'<tr class="'.$css_class.'" valign="top">',
1406
+							 '<td width="240">'.Security::remove_XSS($task['title']).'</td>',
1407
+							 '<td>'.Security::remove_XSS($task['description']).'</td>',
1408
+							 '<td><span style="background-color: #'.$task['color'].'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></td>',
1409 1409
 							 '<td width="50">',
1410
-							 	'<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $task['blog_id'] . '&do=edit&task_id=' . $task['task_id'] . '">',
1411
-								'<img src="../img/edit.gif" border="0" title="' . get_lang('EditTask') . '" />',
1410
+							 	'<a href="'.api_get_self().'?action=manage_tasks&blog_id='.$task['blog_id'].'&do=edit&task_id='.$task['task_id'].'">',
1411
+								'<img src="../img/edit.gif" border="0" title="'.get_lang('EditTask').'" />',
1412 1412
 								"</a>\n",
1413
-								'<a href="' . $delete_link . '"',
1413
+								'<a href="'.$delete_link.'"',
1414 1414
 								$delete_confirm,
1415
-								'><img src="../img/' . $delete_icon . '" border="0" title="' . $delete_title . '" />',
1415
+								'><img src="../img/'.$delete_icon.'" border="0" title="'.$delete_title.'" />',
1416 1416
 								"</a>\n",
1417 1417
 							 '</td>',
1418 1418
 						'</tr>';
@@ -1427,23 +1427,23 @@  discard block
 block discarded – undo
1427 1427
 	 *
1428 1428
 	 * @param Integer $blog_id
1429 1429
 	 */
1430
-	public static function display_assigned_task_list ($blog_id)
1430
+	public static function display_assigned_task_list($blog_id)
1431 1431
     {
1432 1432
 		// Init
1433 1433
 		$tbl_users = Database::get_main_table(TABLE_MAIN_USER);
1434 1434
 		$tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS);
1435 1435
 		$tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER);
1436 1436
 		$counter = 0;
1437
-		global $charset,$color2;
1437
+		global $charset, $color2;
1438 1438
 
1439
-		echo '<span class="blogpost_title">' . get_lang('AssignedTasks') . '</span><br />';
1439
+		echo '<span class="blogpost_title">'.get_lang('AssignedTasks').'</span><br />';
1440 1440
 		echo "<table class=\"data_table\">";
1441 1441
 		echo	"<tr bgcolor=\"$color2\" align=\"center\" valign=\"top\">",
1442
-				 "<th width='240'><b>",get_lang('Member'),"</b></th>\n",
1443
-				 "<th><b>",get_lang('Task'),"</b></th>\n",
1444
-				 "<th><b>",get_lang('Description'),"</b></th>\n",
1445
-				 "<th><b>",get_lang('TargetDate'),"</b></th>\n",
1446
-				 "<th width='50'><b>",get_lang('Modify'),"</b></th>\n",
1442
+				 "<th width='240'><b>", get_lang('Member'), "</b></th>\n",
1443
+				 "<th><b>", get_lang('Task'), "</b></th>\n",
1444
+				 "<th><b>", get_lang('Description'), "</b></th>\n",
1445
+				 "<th><b>", get_lang('TargetDate'), "</b></th>\n",
1446
+				 "<th width='50'><b>", get_lang('Modify'), "</b></th>\n",
1447 1447
 			"</tr>";
1448 1448
 
1449 1449
 		$course_id = api_get_course_int_id();
@@ -1455,32 +1455,32 @@  discard block
 block discarded – undo
1455 1455
 				WHERE
1456 1456
 				    task_rel_user.c_id = $course_id AND
1457 1457
 					task.c_id = $course_id AND
1458
-					task_rel_user.blog_id = '".(int)$blog_id."'
1458
+					task_rel_user.blog_id = '".(int) $blog_id."'
1459 1459
 				ORDER BY target_date ASC";
1460 1460
 		$result = Database::query($sql);
1461 1461
 
1462 1462
 		while ($assignment = Database::fetch_array($result)) {
1463 1463
 			$counter++;
1464
-			$css_class = (($counter % 2)==0) ? "row_odd" : "row_even";
1464
+			$css_class = (($counter % 2) == 0) ? "row_odd" : "row_even";
1465 1465
 			$delete_icon = ($assignment['system_task'] == '1') ? "delete_na.gif" : "delete.gif";
1466 1466
 			$delete_title = ($assignment['system_task'] == '1') ? get_lang('DeleteSystemTask') : get_lang('DeleteTask');
1467
-			$delete_link = ($assignment['system_task'] == '1') ? '#' : api_get_self() . '?action=manage_tasks&blog_id=' . $assignment['blog_id'] . '&do=delete&task_id=' . $assignment['task_id'];
1468
-			$delete_confirm = ($assignment['system_task'] == '1') ? '' : 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;"';
1467
+			$delete_link = ($assignment['system_task'] == '1') ? '#' : api_get_self().'?action=manage_tasks&blog_id='.$assignment['blog_id'].'&do=delete&task_id='.$assignment['task_id'];
1468
+			$delete_confirm = ($assignment['system_task'] == '1') ? '' : 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)).'\')) return false;"';
1469 1469
 
1470 1470
             $username = api_htmlentities(sprintf(get_lang('LoginX'), $assignment['username']), ENT_QUOTES);
1471 1471
 
1472
-			echo	'<tr class="' . $css_class . '" valign="top">',
1473
-						 '<td width="240">' . Display::tag('span', api_get_person_name($assignment['firstname'], $assignment['lastname']), array('title'=>$username)) . '</td>',
1474
-						 '<td>'.stripslashes($assignment['title']) . '</td>',
1475
-						 '<td>'.stripslashes($assignment['description']) . '</td>',
1476
-						 '<td>' . $assignment['target_date'] . '</td>',
1472
+			echo	'<tr class="'.$css_class.'" valign="top">',
1473
+						 '<td width="240">'.Display::tag('span', api_get_person_name($assignment['firstname'], $assignment['lastname']), array('title'=>$username)).'</td>',
1474
+						 '<td>'.stripslashes($assignment['title']).'</td>',
1475
+						 '<td>'.stripslashes($assignment['description']).'</td>',
1476
+						 '<td>'.$assignment['target_date'].'</td>',
1477 1477
 						 '<td width="50">',
1478
-						 	'<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $assignment['blog_id'] . '&do=edit_assignment&task_id=' . $assignment['task_id'] . '&user_id=' . $assignment['user_id'] . '">',
1479
-							'<img src="../img/edit.gif" border="0" title="' . get_lang('EditTask') . '" />',
1478
+						 	'<a href="'.api_get_self().'?action=manage_tasks&blog_id='.$assignment['blog_id'].'&do=edit_assignment&task_id='.$assignment['task_id'].'&user_id='.$assignment['user_id'].'">',
1479
+							'<img src="../img/edit.gif" border="0" title="'.get_lang('EditTask').'" />',
1480 1480
 							"</a>\n",
1481
-							'<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $assignment['blog_id'] . '&do=delete_assignment&task_id=' . $assignment['task_id'] . '&user_id=' . $assignment['user_id'] . '" ',
1482
-							'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;"',
1483
-							'<img src="../img/' . $delete_icon . '" border="0" title="' . $delete_title . '" />',
1481
+							'<a href="'.api_get_self().'?action=manage_tasks&blog_id='.$assignment['blog_id'].'&do=delete_assignment&task_id='.$assignment['task_id'].'&user_id='.$assignment['user_id'].'" ',
1482
+							'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)).'\')) return false;"',
1483
+							'<img src="../img/'.$delete_icon.'" border="0" title="'.$delete_title.'" />',
1484 1484
 							"</a>\n",
1485 1485
 						 '</td>',
1486 1486
 					'</tr>';
@@ -1493,7 +1493,7 @@  discard block
 block discarded – undo
1493 1493
 	 * @author Toon Keppens
1494 1494
 	 *
1495 1495
 	 */
1496
-	public static function display_new_task_form ($blog_id)
1496
+	public static function display_new_task_form($blog_id)
1497 1497
 	{
1498 1498
 		// Init
1499 1499
         $colors = array(
@@ -1515,7 +1515,7 @@  discard block
 block discarded – undo
1515 1515
         );
1516 1516
 
1517 1517
 		// form
1518
-		echo '<form name="add_task" method="post" action="blog.php?action=manage_tasks&blog_id=' . $blog_id . '">';
1518
+		echo '<form name="add_task" method="post" action="blog.php?action=manage_tasks&blog_id='.$blog_id.'">';
1519 1519
 
1520 1520
 		// form title
1521 1521
 		echo '<legend>'.get_lang('AddTask').'</legend>';
@@ -1523,7 +1523,7 @@  discard block
 block discarded – undo
1523 1523
 		// task title
1524 1524
 		echo '	<div class="control-group">
1525 1525
 					<label class="control-label">
1526
-						<span class="form_required">*</span>' . get_lang('Title') . '
1526
+						<span class="form_required">*</span>' . get_lang('Title').'
1527 1527
 					</label>
1528 1528
 					<div class="controls">
1529 1529
 						<input name="task_name" type="text" size="70" />
@@ -1533,7 +1533,7 @@  discard block
 block discarded – undo
1533 1533
 		// task comment
1534 1534
 		echo '	<div class="control-group">
1535 1535
 					<label class="control-label">
1536
-						' . get_lang('Description') . '
1536
+						' . get_lang('Description').'
1537 1537
 					</label>
1538 1538
 					<div class="controls">
1539 1539
 						<textarea name="task_description" cols="45"></textarea>
@@ -1543,18 +1543,18 @@  discard block
 block discarded – undo
1543 1543
 		// task management
1544 1544
 		echo '	<div class="control-group">
1545 1545
 					<label class="control-label">
1546
-						' . get_lang('TaskManager') . '
1546
+						' . get_lang('TaskManager').'
1547 1547
 					</label>
1548 1548
 					<div class="controls">';
1549 1549
                 echo '<table class="data_table" cellspacing="0" style="border-collapse:collapse; width:446px;">';
1550 1550
                     echo '<tr>';
1551
-                        echo '<th colspan="2" style="width:223px;">' . get_lang('ArticleManager') . '</th>';
1552
-                        echo '<th width:223px;>' . get_lang('CommentManager') . '</th>';
1551
+                        echo '<th colspan="2" style="width:223px;">'.get_lang('ArticleManager').'</th>';
1552
+                        echo '<th width:223px;>'.get_lang('CommentManager').'</th>';
1553 1553
                     echo '</tr>';
1554 1554
                     echo '<tr>';
1555
-                        echo '<th style="width:111px;"><label for="articleDelete">' . get_lang('Delete') . '</label></th>';
1556
-                        echo '<th style="width:112px;"><label for="articleEdit">' . get_lang('Edit') . '</label></th>';
1557
-                        echo '<th style="width:223px;"><label for="commentsDelete">' . get_lang('Delete') . '</label></th>';
1555
+                        echo '<th style="width:111px;"><label for="articleDelete">'.get_lang('Delete').'</label></th>';
1556
+                        echo '<th style="width:112px;"><label for="articleEdit">'.get_lang('Edit').'</label></th>';
1557
+                        echo '<th style="width:223px;"><label for="commentsDelete">'.get_lang('Delete').'</label></th>';
1558 1558
                     echo '</tr>';
1559 1559
                     echo '<tr>';
1560 1560
                         echo '<td style="text-align:center;"><input id="articleDelete" name="chkArticleDelete" type="checkbox" /></td>';
@@ -1569,13 +1569,13 @@  discard block
 block discarded – undo
1569 1569
 		// task color
1570 1570
 		echo '	<div class="control-group">
1571 1571
 					<label class="control-label">
1572
-						' . get_lang('Color') . '
1572
+						' . get_lang('Color').'
1573 1573
 					</label>
1574 1574
 					<div class="controls">';
1575 1575
         echo '<select name="task_color" id="color" style="width: 150px; background-color: #eeeeee" onchange="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value" onkeypress="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value">';
1576 1576
                 foreach ($colors as $color) {
1577
-                    $style = 'style="background-color: #' . $color . '"';
1578
-                    echo '<option value="' . $color . '" ' . $style . '>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>';
1577
+                    $style = 'style="background-color: #'.$color.'"';
1578
+                    echo '<option value="'.$color.'" '.$style.'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>';
1579 1579
                 }
1580 1580
         echo '</select>';
1581 1581
 		echo '		</div>
@@ -1586,7 +1586,7 @@  discard block
 block discarded – undo
1586 1586
 					<div class="controls">
1587 1587
 							<input type="hidden" name="action" value="" />
1588 1588
 							<input type="hidden" name="new_task_submit" value="true" />
1589
-						<button class="save" type="submit" name="Submit">' . get_lang('Save') . '</button>
1589
+						<button class="save" type="submit" name="Submit">' . get_lang('Save').'</button>
1590 1590
 					</div>
1591 1591
 				</div>';
1592 1592
 		echo '</form>';
@@ -1600,34 +1600,34 @@  discard block
 block discarded – undo
1600 1600
 	 * @author Toon Keppens
1601 1601
 	 *
1602 1602
 	 */
1603
-	public static function display_edit_task_form ($blog_id, $task_id) {
1603
+	public static function display_edit_task_form($blog_id, $task_id) {
1604 1604
 		$tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS);
1605 1605
         $course_id = api_get_course_int_id();
1606 1606
 
1607
-		$colors = array('FFFFFF','FFFF99','FFCC99','FF9933','FF6699','CCFF99','CC9966','66FF00', '9966FF', 'CF3F3F', '990033','669933','0033FF','003366','000000');
1607
+		$colors = array('FFFFFF', 'FFFF99', 'FFCC99', 'FF9933', 'FF6699', 'CCFF99', 'CC9966', '66FF00', '9966FF', 'CF3F3F', '990033', '669933', '0033FF', '003366', '000000');
1608 1608
 
1609
-		$sql = "SELECT blog_id, task_id, title, description, color FROM $tbl_blogs_tasks WHERE c_id = $course_id AND task_id = '".(int)$task_id."'";
1609
+		$sql = "SELECT blog_id, task_id, title, description, color FROM $tbl_blogs_tasks WHERE c_id = $course_id AND task_id = '".(int) $task_id."'";
1610 1610
 		$result = Database::query($sql);
1611 1611
 		$task = Database::fetch_array($result);
1612 1612
 
1613 1613
 		// Display
1614
-		echo '<form name="edit_task" method="post" action="blog.php?action=manage_tasks&blog_id=' . $blog_id . '">
1615
-					<legend>' . get_lang('EditTask') . '</legend>
1614
+		echo '<form name="edit_task" method="post" action="blog.php?action=manage_tasks&blog_id='.$blog_id.'">
1615
+					<legend>' . get_lang('EditTask').'</legend>
1616 1616
 					<table width="100%" border="0" cellspacing="2">
1617 1617
 						<tr>
1618
-					   <td align="right">' . get_lang('Title') . ':&nbsp;&nbsp;</td>
1619
-					   <td><input name="task_name" type="text" size="70" value="'.Security::remove_XSS($task['title']) . '" /></td>
1618
+					   <td align="right">' . get_lang('Title').':&nbsp;&nbsp;</td>
1619
+					   <td><input name="task_name" type="text" size="70" value="'.Security::remove_XSS($task['title']).'" /></td>
1620 1620
 						</tr>
1621 1621
 						<tr>
1622
-					   <td align="right">' . get_lang('Description') . ':&nbsp;&nbsp;</td>
1622
+					   <td align="right">' . get_lang('Description').':&nbsp;&nbsp;</td>
1623 1623
 					   <td><textarea name="task_description" cols="45">'.Security::remove_XSS($task['description']).'</textarea></td>
1624 1624
 						</tr>';
1625 1625
 
1626 1626
 						/* edit by Kevin Van Den Haute ([email protected]) */
1627 1627
 						$tbl_tasks_permissions = Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS);
1628 1628
 
1629
-						$sql = " SELECT id, action FROM " . $tbl_tasks_permissions . "
1630
-							     WHERE c_id = $course_id AND task_id = '" . (int)$task_id."'";
1629
+						$sql = " SELECT id, action FROM ".$tbl_tasks_permissions."
1630
+							     WHERE c_id = $course_id AND task_id = '".(int) $task_id."'";
1631 1631
 						$result = Database::query($sql);
1632 1632
 
1633 1633
 						$arrPermissions = array();
@@ -1636,22 +1636,22 @@  discard block
 block discarded – undo
1636 1636
 							$arrPermissions[] = $row['action'];
1637 1637
 
1638 1638
 						    echo '<tr>';
1639
-							echo '<td style="text-align:right; vertical-align:top;">' . get_lang('TaskManager') . ':&nbsp;&nbsp;</td>';
1639
+							echo '<td style="text-align:right; vertical-align:top;">'.get_lang('TaskManager').':&nbsp;&nbsp;</td>';
1640 1640
 							echo '<td>';
1641 1641
 								echo '<table  class="data_table" cellspacing="0" style="border-collapse:collapse; width:446px;">';
1642 1642
 									echo '<tr>';
1643
-										echo '<th colspan="2" style="width:223px;">' . get_lang('ArticleManager') . '</th>';
1644
-										echo '<th width:223px;>' . get_lang('CommentManager') . '</th>';
1643
+										echo '<th colspan="2" style="width:223px;">'.get_lang('ArticleManager').'</th>';
1644
+										echo '<th width:223px;>'.get_lang('CommentManager').'</th>';
1645 1645
 									echo '</tr>';
1646 1646
 									echo '<tr>';
1647
-										echo '<th style="width:111px;"><label for="articleDelete">' . get_lang('Delete') . '</label></th>';
1648
-										echo '<th style="width:112px;"><label for="articleEdit">' . get_lang('Edit') . '</label></th>';
1649
-										echo '<th style="width:223px;"><label for="commentsDelete">' . get_lang('Delete') . '</label></th>';
1647
+										echo '<th style="width:111px;"><label for="articleDelete">'.get_lang('Delete').'</label></th>';
1648
+										echo '<th style="width:112px;"><label for="articleEdit">'.get_lang('Edit').'</label></th>';
1649
+										echo '<th style="width:223px;"><label for="commentsDelete">'.get_lang('Delete').'</label></th>';
1650 1650
 									echo '</tr>';
1651 1651
 									echo '<tr>';
1652
-										echo '<td style="text-align:center;"><input ' . ((in_array('article_delete', $arrPermissions)) ? 'checked ' : '') . 'id="articleDelete" name="chkArticleDelete" type="checkbox" /></td>';
1653
-										echo '<td style="text-align:center;"><input ' . ((in_array('article_edit', $arrPermissions)) ? 'checked ' : '') . 'id="articleEdit" name="chkArticleEdit" type="checkbox" /></td>';
1654
-										echo '<td style="text-align:center;"><input ' . ((in_array('article_comments_delete', $arrPermissions)) ? 'checked ' : '') . 'id="commentsDelete" name="chkCommentsDelete" type="checkbox" /></td>';
1652
+										echo '<td style="text-align:center;"><input '.((in_array('article_delete', $arrPermissions)) ? 'checked ' : '').'id="articleDelete" name="chkArticleDelete" type="checkbox" /></td>';
1653
+										echo '<td style="text-align:center;"><input '.((in_array('article_edit', $arrPermissions)) ? 'checked ' : '').'id="articleEdit" name="chkArticleEdit" type="checkbox" /></td>';
1654
+										echo '<td style="text-align:center;"><input '.((in_array('article_comments_delete', $arrPermissions)) ? 'checked ' : '').'id="commentsDelete" name="chkCommentsDelete" type="checkbox" /></td>';
1655 1655
 									echo '</tr>';
1656 1656
 								echo '</table>';
1657 1657
 							echo '</td>';
@@ -1659,13 +1659,13 @@  discard block
 block discarded – undo
1659 1659
 						/* end of edit */
1660 1660
 
1661 1661
 						echo '<tr>
1662
-					   <td align="right">' . get_lang('Color') . ':&nbsp;&nbsp;</td>
1662
+					   <td align="right">' . get_lang('Color').':&nbsp;&nbsp;</td>
1663 1663
 					   <td>
1664
-					   	<select name="task_color" id="color" style="width: 150px; background-color: #' . $task['color'] . '" onchange="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value" onkeypress="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value">';
1664
+					   	<select name="task_color" id="color" style="width: 150px; background-color: #' . $task['color'].'" onchange="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value" onkeypress="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value">';
1665 1665
                             foreach ($colors as $color) {
1666 1666
                                 $selected = ($color == $task['color']) ? ' selected' : '';
1667
-                                $style = 'style="background-color: #' . $color . '"';
1668
-                                echo '<option value="' . $color . '" ' . $style . ' ' . $selected . ' >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>';
1667
+                                $style = 'style="background-color: #'.$color.'"';
1668
+                                echo '<option value="'.$color.'" '.$style.' '.$selected.' >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>';
1669 1669
                             }
1670 1670
 		echo '			   </select>
1671 1671
 						  </td>
@@ -1674,9 +1674,9 @@  discard block
 block discarded – undo
1674 1674
 							<td align="right">&nbsp;</td>
1675 1675
 							<td><br /><input type="hidden" name="action" value="" />
1676 1676
 							<input type="hidden" name="edit_task_submit" value="true" />
1677
-							<input type="hidden" name="task_id" value="' . $task['task_id'] . '" />
1678
-							<input type="hidden" name="blog_id" value="' . $task['blog_id'] . '" />
1679
-							<button class="save" type="submit" name="Submit">' . get_lang('Save') . '</button></td>
1677
+							<input type="hidden" name="task_id" value="' . $task['task_id'].'" />
1678
+							<input type="hidden" name="blog_id" value="' . $task['blog_id'].'" />
1679
+							<button class="save" type="submit" name="Submit">' . get_lang('Save').'</button></td>
1680 1680
 						</tr>
1681 1681
 					</table>
1682 1682
 				</form>';
@@ -1698,7 +1698,7 @@  discard block
 block discarded – undo
1698 1698
 				FROM $tbl_users user
1699 1699
 				INNER JOIN $tbl_blogs_rel_user blogs_rel_user
1700 1700
 				ON user.user_id = blogs_rel_user.user_id
1701
-				WHERE blogs_rel_user.c_id = $course_id AND blogs_rel_user.blog_id = '".(int)$blog_id."'";
1701
+				WHERE blogs_rel_user.c_id = $course_id AND blogs_rel_user.blog_id = '".(int) $blog_id."'";
1702 1702
 		$result = Database::query($sql);
1703 1703
 
1704 1704
 		$options = array();
@@ -1717,7 +1717,7 @@  discard block
 block discarded – undo
1717 1717
 				color,
1718 1718
 				system_task
1719 1719
 			FROM $tbl_blogs_tasks
1720
-			WHERE c_id = $course_id AND blog_id = " . (int)$blog_id . "
1720
+			WHERE c_id = $course_id AND blog_id = ".(int) $blog_id."
1721 1721
 			ORDER BY system_task, title";
1722 1722
 		$result = Database::query($sql);
1723 1723
 
@@ -1765,7 +1765,7 @@  discard block
 block discarded – undo
1765 1765
 	 */
1766 1766
 	public static function display_edit_assigned_task_form($blog_id, $task_id, $user_id)
1767 1767
 	{
1768
-		$tbl_blogs_tasks_rel_user 	= Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER);
1768
+		$tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER);
1769 1769
 
1770 1770
 		$course_id = api_get_course_int_id();
1771 1771
 
@@ -1774,9 +1774,9 @@  discard block
 block discarded – undo
1774 1774
 			SELECT target_date
1775 1775
 			FROM $tbl_blogs_tasks_rel_user
1776 1776
 			WHERE c_id = $course_id AND
1777
-			      blog_id = '".(int)$blog_id."' AND
1778
-			      user_id = '".(int)$user_id."' AND
1779
-			      task_id = '".(int)$task_id."'";
1777
+			      blog_id = '".(int) $blog_id."' AND
1778
+			      user_id = '".(int) $user_id."' AND
1779
+			      task_id = '".(int) $task_id."'";
1780 1780
 		$result = Database::query($sql);
1781 1781
 		$row = Database::fetch_assoc($result);
1782 1782
 
@@ -1811,11 +1811,11 @@  discard block
 block discarded – undo
1811 1811
 
1812 1812
 		$sql = "
1813 1813
 			SELECT COUNT(*) as 'number'
1814
-			FROM " . $tbl_blogs_tasks_rel_user . "
1814
+			FROM " . $tbl_blogs_tasks_rel_user."
1815 1815
 			WHERE c_id = $course_id AND
1816
-			blog_id = " . (int)$blog_id . "
1817
-			AND	user_id = " . (int)$user_id . "
1818
-			AND	task_id = " . (int)$task_id . "
1816
+			blog_id = ".(int) $blog_id."
1817
+			AND	user_id = " . (int) $user_id."
1818
+			AND	task_id = " . (int) $task_id."
1819 1819
 		";
1820 1820
 
1821 1821
 		$result = Database::query($sql);
@@ -1823,18 +1823,18 @@  discard block
 block discarded – undo
1823 1823
 
1824 1824
 		if ($row['number'] == 0) {
1825 1825
 			$sql = "
1826
-				INSERT INTO " . $tbl_blogs_tasks_rel_user . " (
1826
+				INSERT INTO " . $tbl_blogs_tasks_rel_user." (
1827 1827
 					c_id,
1828 1828
 					blog_id,
1829 1829
 					user_id,
1830 1830
 					task_id,
1831 1831
 					target_date
1832 1832
 				) VALUES (
1833
-					'" . (int)$course_id . "',
1834
-					'" . (int)$blog_id . "',
1835
-					'" . (int)$user_id . "',
1836
-					'" . (int)$task_id . "',
1837
-					'" . Database::escape_string($target_date) . "'
1833
+					'" . (int) $course_id."',
1834
+					'" . (int) $blog_id."',
1835
+					'" . (int) $user_id."',
1836
+					'" . (int) $task_id."',
1837
+					'" . Database::escape_string($target_date)."'
1838 1838
 				)";
1839 1839
 
1840 1840
 			Database::query($sql);
@@ -1864,12 +1864,12 @@  discard block
 block discarded – undo
1864 1864
 		$course_id = api_get_course_int_id();
1865 1865
 
1866 1866
 		$sql = "SELECT COUNT(*) as 'number'
1867
-                FROM " . $tbl_blogs_tasks_rel_user . "
1867
+                FROM " . $tbl_blogs_tasks_rel_user."
1868 1868
                 WHERE
1869 1869
                     c_id = $course_id AND
1870
-                    blog_id = " . (int)$blog_id . " AND
1871
-                    user_id = " . (int)$user_id . " AND
1872
-                    task_id = " . (int)$task_id . "
1870
+                    blog_id = ".(int) $blog_id." AND
1871
+                    user_id = " . (int) $user_id." AND
1872
+                    task_id = " . (int) $task_id."
1873 1873
             ";
1874 1874
 
1875 1875
 		$result = Database::query($sql);
@@ -1877,17 +1877,17 @@  discard block
 block discarded – undo
1877 1877
 
1878 1878
 		if ($row['number'] == 0 || ($row['number'] != 0 && $task_id == $old_task_id && $user_id == $old_user_id)) {
1879 1879
 			$sql = "
1880
-				UPDATE " . $tbl_blogs_tasks_rel_user . "
1880
+				UPDATE " . $tbl_blogs_tasks_rel_user."
1881 1881
 				SET
1882
-					user_id = " . (int)$user_id . ",
1883
-					task_id = " . (int)$task_id . ",
1884
-					target_date = '" . Database::escape_string($target_date) . "'
1882
+					user_id = " . (int) $user_id.",
1883
+					task_id = " . (int) $task_id.",
1884
+					target_date = '" . Database::escape_string($target_date)."'
1885 1885
 				WHERE
1886 1886
 					c_id = $course_id AND
1887
-					blog_id = " . (int)$blog_id . " AND
1888
-					user_id = " . (int)$old_user_id . " AND
1889
-					task_id = " . (int)$old_task_id . " AND
1890
-					target_date = '" . Database::escape_string($old_target_date) . "'
1887
+					blog_id = ".(int) $blog_id." AND
1888
+					user_id = " . (int) $old_user_id." AND
1889
+					task_id = " . (int) $old_task_id." AND
1890
+					target_date = '" . Database::escape_string($old_target_date)."'
1891 1891
 			";
1892 1892
 			Database::query($sql);
1893 1893
 		}
@@ -1908,7 +1908,7 @@  discard block
 block discarded – undo
1908 1908
 
1909 1909
 
1910 1910
 		$sql = "SELECT title, description FROM $tbl_blogs_tasks
1911
-				WHERE task_id = '".(int)$task_id."'
1911
+				WHERE task_id = '".(int) $task_id."'
1912 1912
 				AND c_id = $course_id";
1913 1913
 		$result = Database::query($sql);
1914 1914
 		$row = Database::fetch_assoc($result);
@@ -1916,19 +1916,19 @@  discard block
 block discarded – undo
1916 1916
 		$sql = "SELECT post.*, user.lastname, user.firstname, user.username
1917 1917
 				FROM $tbl_blogs_posts post
1918 1918
 				INNER JOIN $tbl_users user ON post.author_id = user.user_id
1919
-				WHERE post.blog_id = '".(int)$blog_id."' AND post.c_id = $course_id
1919
+				WHERE post.blog_id = '".(int) $blog_id."' AND post.c_id = $course_id
1920 1920
 				ORDER BY post_id DESC
1921 1921
 				LIMIT 0, 100";
1922 1922
 		$result = Database::query($sql);
1923 1923
 
1924 1924
 		// Display
1925
-		echo '<span class="blogpost_title">' . get_lang('SelectTaskArticle') . ' "' . stripslashes($row['title']) . '"</span>';
1926
-		echo '<span style="font-style: italic;"">'.stripslashes($row['description']) . '</span><br><br>';
1925
+		echo '<span class="blogpost_title">'.get_lang('SelectTaskArticle').' "'.stripslashes($row['title']).'"</span>';
1926
+		echo '<span style="font-style: italic;"">'.stripslashes($row['description']).'</span><br><br>';
1927 1927
 
1928 1928
 		if (Database::num_rows($result) > 0) {
1929
-			while($blog_post = Database::fetch_array($result)) {
1929
+			while ($blog_post = Database::fetch_array($result)) {
1930 1930
 			    $username = api_htmlentities(sprintf(get_lang('LoginX'), $blog_post['username']), ENT_QUOTES);
1931
-				echo '<a href="blog.php?action=execute_task&blog_id=' . $blog_id . '&task_id=' . $task_id . '&post_id=' . $blog_post['post_id'] . '#add_comment">'.stripslashes($blog_post['title']) . '</a>, ' . get_lang('WrittenBy') . ' ' . stripslashes(Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username))) . '<br />';
1931
+				echo '<a href="blog.php?action=execute_task&blog_id='.$blog_id.'&task_id='.$task_id.'&post_id='.$blog_post['post_id'].'#add_comment">'.stripslashes($blog_post['title']).'</a>, '.get_lang('WrittenBy').' '.stripslashes(Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username))).'<br />';
1932 1932
 			}
1933 1933
         } else {
1934 1934
             echo get_lang('NoArticles');
@@ -1952,12 +1952,12 @@  discard block
 block discarded – undo
1952 1952
 
1953 1953
 		// Subscribe the user
1954 1954
 		$sql = "INSERT INTO $tbl_blogs_rel_user (c_id, blog_id, user_id )
1955
-		        VALUES ($course_id, '".(int)$blog_id."', '".(int)$user_id."');";
1955
+		        VALUES ($course_id, '".(int) $blog_id."', '".(int) $user_id."');";
1956 1956
 		Database::query($sql);
1957 1957
 
1958 1958
 		// Give this user basic rights
1959 1959
 		$sql = "INSERT INTO $tbl_user_permissions (c_id, user_id,tool,action)
1960
-		        VALUES ($course_id, '".(int)$user_id."','BLOG_" . (int)$blog_id."','article_add')";
1960
+		        VALUES ($course_id, '".(int) $user_id."','BLOG_".(int) $blog_id."','article_add')";
1961 1961
 		Database::query($sql);
1962 1962
 
1963 1963
         $id = Database::insert_id();
@@ -1967,7 +1967,7 @@  discard block
 block discarded – undo
1967 1967
         }
1968 1968
 
1969 1969
 		$sql = "INSERT INTO $tbl_user_permissions (c_id, user_id,tool,action)
1970
-		        VALUES ($course_id, '".(int)$user_id."','BLOG_" . (int)$blog_id."','article_comments_add')";
1970
+		        VALUES ($course_id, '".(int) $user_id."','BLOG_".(int) $blog_id."','article_comments_add')";
1971 1971
 		Database::query($sql);
1972 1972
 
1973 1973
         $id = Database::insert_id();
@@ -1993,12 +1993,12 @@  discard block
 block discarded – undo
1993 1993
 
1994 1994
 		// Unsubscribe the user
1995 1995
 		$sql = "DELETE FROM $tbl_blogs_rel_user
1996
-		        WHERE blog_id = '".(int)$blog_id."' AND user_id = '".(int)$user_id."'";
1996
+		        WHERE blog_id = '".(int) $blog_id."' AND user_id = '".(int) $user_id."'";
1997 1997
 		Database::query($sql);
1998 1998
 
1999 1999
 		// Remove this user's permissions.
2000 2000
 		$sql = "DELETE FROM $tbl_user_permissions
2001
-		        WHERE user_id = '".(int)$user_id."'";
2001
+		        WHERE user_id = '".(int) $user_id."'";
2002 2002
 		Database::query($sql);
2003 2003
 	}
2004 2004
 
@@ -2019,7 +2019,7 @@  discard block
 block discarded – undo
2019 2019
 		$course_id = $_course['real_id'];
2020 2020
 
2021 2021
 		$currentCourse = $_course['code'];
2022
-		$tbl_users 			= Database::get_main_table(TABLE_MAIN_USER);
2022
+		$tbl_users = Database::get_main_table(TABLE_MAIN_USER);
2023 2023
 		$tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER);
2024 2024
 
2025 2025
 		echo '<legend>'.get_lang('SubscribeMembers').'</legend>';
@@ -2034,12 +2034,12 @@  discard block
 block discarded – undo
2034 2034
 		$result = Database::query($sql);
2035 2035
 
2036 2036
 		$blog_member_ids = array();
2037
-		while($user = Database::fetch_array($result)) {
2037
+		while ($user = Database::fetch_array($result)) {
2038 2038
 			$blog_member_ids[] = $user['user_id'];
2039 2039
 		}
2040 2040
 
2041 2041
 		// Set table headers
2042
-		$column_header[] = array ('', false, '');
2042
+		$column_header[] = array('', false, '');
2043 2043
 		if ($is_western_name_order) {
2044 2044
 			$column_header[] = array(get_lang('FirstName'), true, '');
2045 2045
 			$column_header[] = array(get_lang('LastName'), true, '');
@@ -2059,13 +2059,13 @@  discard block
 block discarded – undo
2059 2059
 
2060 2060
 		// Add users that are not in this blog to the list.
2061 2061
 		foreach ($student_list as $key=>$user) {
2062
-			if(isset($user['id_user'])) {
2062
+			if (isset($user['id_user'])) {
2063 2063
 				$user['user_id'] = $user['id_user'];
2064 2064
 			}
2065
-			if(!in_array($user['user_id'],$blog_member_ids)) {
2065
+			if (!in_array($user['user_id'], $blog_member_ids)) {
2066 2066
 				$a_infosUser = api_get_user_info($user['user_id']);
2067
-				$row = array ();
2068
-				$row[] = '<input type="checkbox" name="user[]" value="' . $a_infosUser['user_id'] . '" '.((isset($_GET['selectall']) && $_GET['selectall'] == "subscribe") ? ' checked="checked" ' : '') . '/>';
2067
+				$row = array();
2068
+				$row[] = '<input type="checkbox" name="user[]" value="'.$a_infosUser['user_id'].'" '.((isset($_GET['selectall']) && $_GET['selectall'] == "subscribe") ? ' checked="checked" ' : '').'/>';
2069 2069
 				$username = api_htmlentities(sprintf(get_lang('LoginX'), $a_infosUser["username"]), ENT_QUOTES);
2070 2070
 				if ($is_western_name_order) {
2071 2071
 					$row[] = $a_infosUser["firstname"];
@@ -2077,8 +2077,8 @@  discard block
 block discarded – undo
2077 2077
 				$row[] = Display::icon_mailto_link($a_infosUser["email"]);
2078 2078
 
2079 2079
 				//Link to register users
2080
-				if ($a_infosUser["user_id"] != $_SESSION['_user']['user_id']){
2081
-					$row[] = "<a class=\"btn btn-primary \" href=\"" .api_get_self()."?action=manage_members&blog_id=$blog_id&register=yes&user_id=" . $a_infosUser["user_id"]."\">" . get_lang('Register')."</a>";
2080
+				if ($a_infosUser["user_id"] != $_SESSION['_user']['user_id']) {
2081
+					$row[] = "<a class=\"btn btn-primary \" href=\"".api_get_self()."?action=manage_members&blog_id=$blog_id&register=yes&user_id=".$a_infosUser["user_id"]."\">".get_lang('Register')."</a>";
2082 2082
 				} else {
2083 2083
 					$row[] = '';
2084 2084
 				}
@@ -2089,20 +2089,20 @@  discard block
 block discarded – undo
2089 2089
 		// Display
2090 2090
 		$query_vars['action'] = 'manage_members';
2091 2091
 		$query_vars['blog_id'] = $blog_id;
2092
-		echo '<form method="post" action="blog.php?action=manage_members&blog_id=' . $blog_id . '">';
2093
-			Display::display_sortable_table($column_header, $user_data,null,null,$query_vars);
2092
+		echo '<form method="post" action="blog.php?action=manage_members&blog_id='.$blog_id.'">';
2093
+			Display::display_sortable_table($column_header, $user_data, null, null, $query_vars);
2094 2094
 			$link = '';
2095
-			$link .= isset ($_GET['action']) ? 'action=' . Security::remove_XSS($_GET['action']) . '&' : '';
2095
+			$link .= isset ($_GET['action']) ? 'action='.Security::remove_XSS($_GET['action']).'&' : '';
2096 2096
 			$link .= "blog_id=$blog_id&";
2097 2097
 
2098
-			echo '<a href="blog.php?' . $link . 'selectall=subscribe">' . get_lang('SelectAll') . '</a> - ';
2099
-			echo '<a href="blog.php?' . $link . '">' . get_lang('UnSelectAll') . '</a> ';
2100
-			echo get_lang('WithSelected') . ' : ';
2098
+			echo '<a href="blog.php?'.$link.'selectall=subscribe">'.get_lang('SelectAll').'</a> - ';
2099
+			echo '<a href="blog.php?'.$link.'">'.get_lang('UnSelectAll').'</a> ';
2100
+			echo get_lang('WithSelected').' : ';
2101 2101
 			echo '<select name="action">';
2102
-			echo '<option value="select_subscribe">' . get_lang('Register') . '</option>';
2102
+			echo '<option value="select_subscribe">'.get_lang('Register').'</option>';
2103 2103
 			echo '</select>';
2104 2104
 			echo '<input type="hidden" name="register" value="true" />';
2105
-			echo '<button class="save" type="submit">' . get_lang('Ok') . '</button>';
2105
+			echo '<button class="save" type="submit">'.get_lang('Ok').'</button>';
2106 2106
 		echo '</form>';
2107 2107
 	}
2108 2108
 
@@ -2115,7 +2115,7 @@  discard block
 block discarded – undo
2115 2115
 	 *
2116 2116
 	 * @return Html Form with sortable table with users to unsubcribe from a blog.
2117 2117
 	 */
2118
-	public static function display_form_user_unsubscribe ($blog_id)
2118
+	public static function display_form_user_unsubscribe($blog_id)
2119 2119
 	{
2120 2120
 		$_user = api_get_user_info();
2121 2121
 		$is_western_name_order = api_is_western_name_order();
@@ -2128,34 +2128,34 @@  discard block
 block discarded – undo
2128 2128
 
2129 2129
 		$properties["width"] = "100%";
2130 2130
 		//table column titles
2131
-		$column_header[] = array ('', false, '');
2131
+		$column_header[] = array('', false, '');
2132 2132
 		if ($is_western_name_order) {
2133
-			$column_header[] = array (get_lang('FirstName'), true, '');
2134
-			$column_header[] = array (get_lang('LastName'), true, '');
2133
+			$column_header[] = array(get_lang('FirstName'), true, '');
2134
+			$column_header[] = array(get_lang('LastName'), true, '');
2135 2135
 		} else {
2136
-			$column_header[] = array (get_lang('LastName'), true, '');
2137
-			$column_header[] = array (get_lang('FirstName'), true, '');
2136
+			$column_header[] = array(get_lang('LastName'), true, '');
2137
+			$column_header[] = array(get_lang('FirstName'), true, '');
2138 2138
 		}
2139
-		$column_header[] = array (get_lang('Email'), false, '');
2140
-		$column_header[] = array (get_lang('TaskManager'), true, '');
2141
-		$column_header[] = array (get_lang('UnRegister'), false, '');
2139
+		$column_header[] = array(get_lang('Email'), false, '');
2140
+		$column_header[] = array(get_lang('TaskManager'), true, '');
2141
+		$column_header[] = array(get_lang('UnRegister'), false, '');
2142 2142
 
2143 2143
 		$course_id = api_get_course_int_id();
2144 2144
 
2145 2145
 		$sql = "SELECT user.user_id, user.lastname, user.firstname, user.email, user.username
2146 2146
                 FROM $tbl_users user INNER JOIN $tbl_blogs_rel_user blogs_rel_user
2147 2147
                 ON user.user_id = blogs_rel_user.user_id
2148
-                WHERE blogs_rel_user.c_id = $course_id AND  blogs_rel_user.blog_id = '".(int)$blog_id."'";
2148
+                WHERE blogs_rel_user.c_id = $course_id AND  blogs_rel_user.blog_id = '".(int) $blog_id."'";
2149 2149
 
2150 2150
 		if (!($sql_result = Database::query($sql))) {
2151 2151
 			return false;
2152 2152
 		}
2153 2153
 
2154
-		$user_data = array ();
2154
+		$user_data = array();
2155 2155
 
2156 2156
 		while ($myrow = Database::fetch_array($sql_result)) {
2157
-			$row = array ();
2158
-			$row[] = '<input type="checkbox" name="user[]" value="' . $myrow['user_id'] . '" '.((isset($_GET['selectall']) && $_GET['selectall'] == "unsubscribe") ? ' checked="checked" ' : '') . '/>';
2157
+			$row = array();
2158
+			$row[] = '<input type="checkbox" name="user[]" value="'.$myrow['user_id'].'" '.((isset($_GET['selectall']) && $_GET['selectall'] == "unsubscribe") ? ' checked="checked" ' : '').'/>';
2159 2159
 			$username = api_htmlentities(sprintf(get_lang('LoginX'), $myrow["username"]), ENT_QUOTES);
2160 2160
 			if ($is_western_name_order) {
2161 2161
 				$row[] = $myrow["firstname"];
@@ -2167,19 +2167,19 @@  discard block
 block discarded – undo
2167 2167
 			$row[] = Display::icon_mailto_link($myrow["email"]);
2168 2168
 
2169 2169
 			$sql = "SELECT bt.title task
2170
-					FROM " . Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER) . " btu
2171
-					INNER JOIN " . Database::get_course_table(TABLE_BLOGS_TASKS) . " bt
2170
+					FROM " . Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER)." btu
2171
+					INNER JOIN " . Database::get_course_table(TABLE_BLOGS_TASKS)." bt
2172 2172
 					ON btu.task_id = bt.task_id
2173 2173
 					WHERE 	btu.c_id 	= $course_id  AND
2174 2174
 							bt.c_id 	= $course_id  AND
2175 2175
 							btu.blog_id = $blog_id AND
2176
-							btu.user_id = " . $myrow['user_id'];
2176
+							btu.user_id = ".$myrow['user_id'];
2177 2177
 			$sql_res = Database::query($sql);
2178 2178
 
2179 2179
 			$task = '';
2180 2180
 
2181
-			while($r = Database::fetch_array($sql_res)) {
2182
-				$task .= stripslashes($r['task']) . ', ';
2181
+			while ($r = Database::fetch_array($sql_res)) {
2182
+				$task .= stripslashes($r['task']).', ';
2183 2183
 			}
2184 2184
 			//echo $task;
2185 2185
 			$task = (api_strlen(trim($task)) != 0) ? api_substr($task, 0, api_strlen($task) - 2) : get_lang('Reader');
@@ -2187,7 +2187,7 @@  discard block
 block discarded – undo
2187 2187
 			//Link to register users
2188 2188
 
2189 2189
 			if ($myrow["user_id"] != $_user['user_id']) {
2190
-				$row[] = "<a class=\"btn btn-primary\" href=\"" .api_get_self()."?action=manage_members&blog_id=$blog_id&unregister=yes&user_id=" . $myrow['user_id']."\">" . get_lang('UnRegister')."</a>";
2190
+				$row[] = "<a class=\"btn btn-primary\" href=\"".api_get_self()."?action=manage_members&blog_id=$blog_id&unregister=yes&user_id=".$myrow['user_id']."\">".get_lang('UnRegister')."</a>";
2191 2191
 			} else {
2192 2192
 				$row[] = '';
2193 2193
 			}
@@ -2197,20 +2197,20 @@  discard block
 block discarded – undo
2197 2197
 
2198 2198
 		$query_vars['action'] = 'manage_members';
2199 2199
 		$query_vars['blog_id'] = $blog_id;
2200
-		echo '<form method="post" action="blog.php?action=manage_members&blog_id=' . $blog_id . '">';
2201
-		Display::display_sortable_table($column_header, $user_data,null,null,$query_vars);
2200
+		echo '<form method="post" action="blog.php?action=manage_members&blog_id='.$blog_id.'">';
2201
+		Display::display_sortable_table($column_header, $user_data, null, null, $query_vars);
2202 2202
 		$link = '';
2203
-		$link .= isset ($_GET['action']) ? 'action=' . Security::remove_XSS($_GET['action']). '&' : '';
2203
+		$link .= isset ($_GET['action']) ? 'action='.Security::remove_XSS($_GET['action']).'&' : '';
2204 2204
 		$link .= "blog_id=$blog_id&";
2205 2205
 
2206
-		echo '<a href="blog.php?' . $link . 'selectall=unsubscribe">' . get_lang('SelectAll') . '</a> - ';
2207
-		echo '<a href="blog.php?' . $link . '">' . get_lang('UnSelectAll') . '</a> ';
2208
-		echo get_lang('WithSelected') . ' : ';
2206
+		echo '<a href="blog.php?'.$link.'selectall=unsubscribe">'.get_lang('SelectAll').'</a> - ';
2207
+		echo '<a href="blog.php?'.$link.'">'.get_lang('UnSelectAll').'</a> ';
2208
+		echo get_lang('WithSelected').' : ';
2209 2209
 		echo '<select name="action">';
2210
-		echo '<option value="select_unsubscribe">' . get_lang('UnRegister') . '</option>';
2210
+		echo '<option value="select_unsubscribe">'.get_lang('UnRegister').'</option>';
2211 2211
 		echo '</select>';
2212 2212
 		echo '<input type="hidden" name="unregister" value="true" />';
2213
-		echo '<button class="save" type="submit">' . get_lang('Ok') . '</button>';
2213
+		echo '<button class="save" type="submit">'.get_lang('Ok').'</button>';
2214 2214
 		echo '</form>';
2215 2215
 	}
2216 2216
 
@@ -2220,7 +2220,7 @@  discard block
 block discarded – undo
2220 2220
 	 *
2221 2221
 	 * @param Integer $blog_id
2222 2222
 	 */
2223
-	public static function display_form_user_rights ($blog_id)
2223
+	public static function display_form_user_rights($blog_id)
2224 2224
     {
2225 2225
 		echo '<legend>'.get_lang('RightsManager').'</legend>';
2226 2226
 		echo '<br />';
@@ -2240,7 +2240,7 @@  discard block
 block discarded – undo
2240 2240
 		$form = new FormValidator(
2241 2241
 			'add_post',
2242 2242
 			'post',
2243
-			api_get_path(WEB_CODE_PATH)."blog/blog.php?action=view_post&blog_id=" . intval($blog_id)  . "&post_id=".intval($post_id)."&".api_get_cidreq(),
2243
+			api_get_path(WEB_CODE_PATH)."blog/blog.php?action=view_post&blog_id=".intval($blog_id)."&post_id=".intval($post_id)."&".api_get_cidreq(),
2244 2244
 			null,
2245 2245
 			array('enctype' => 'multipart/form-data')
2246 2246
 		);
@@ -2308,21 +2308,21 @@  discard block
 block discarded – undo
2308 2308
 		$course_id = api_get_course_int_id();
2309 2309
 
2310 2310
 		//Handle leap year
2311
-		$numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
2311
+		$numberofdays = array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
2312 2312
 
2313
-		if(($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0))
2313
+		if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0))
2314 2314
 			$numberofdays[2] = 29;
2315 2315
 
2316 2316
 		//Get the first day of the month
2317 2317
 		$dayone = getdate(mktime(0, 0, 0, $month, 1, $year));
2318
-		$monthName = $MonthsLong[$month-1];
2318
+		$monthName = $MonthsLong[$month - 1];
2319 2319
 
2320 2320
 		//Start the week on monday
2321 2321
 		$startdayofweek = $dayone['wday'] <> 0 ? ($dayone['wday'] - 1) : 6;
2322 2322
 		$blogId = isset($_GET['blog_id']) ? intval($_GET['blog_id']) : null;
2323 2323
 		$filter = isset($_GET['filter']) ? Security::remove_XSS($_GET['filter']) : null;
2324
-		$backwardsURL = api_get_self()."?blog_id=" . $blogId."&filter=" . $filter."&month=". ($month == 1 ? 12 : $month -1)."&year=". ($month == 1 ? $year -1 : $year);
2325
-		$forewardsURL = api_get_self()."?blog_id=" . $blogId."&filter=" . $filter."&month=". ($month == 12 ? 1 : $month +1)."&year=". ($month == 12 ? $year +1 : $year);
2324
+		$backwardsURL = api_get_self()."?blog_id=".$blogId."&filter=".$filter."&month=".($month == 1 ? 12 : $month - 1)."&year=".($month == 1 ? $year - 1 : $year);
2325
+		$forewardsURL = api_get_self()."?blog_id=".$blogId."&filter=".$filter."&month=".($month == 12 ? 1 : $month + 1)."&year=".($month == 12 ? $year + 1 : $year);
2326 2326
 
2327 2327
 		// Get posts for this month
2328 2328
 		$sql = "SELECT post.*, DAYOFMONTH(date_creation) as post_day, user.lastname, user.firstname
@@ -2331,15 +2331,15 @@  discard block
 block discarded – undo
2331 2331
 				ON post.author_id = user.user_id
2332 2332
 				WHERE
2333 2333
 					post.c_id = $course_id AND
2334
-					post.blog_id = '".(int)$blog_id."' AND
2335
-					MONTH(date_creation) = '".(int)$month."' AND
2336
-					YEAR(date_creation) = '".(int)$year."'
2334
+					post.blog_id = '".(int) $blog_id."' AND
2335
+					MONTH(date_creation) = '".(int) $month."' AND
2336
+					YEAR(date_creation) = '".(int) $year."'
2337 2337
 				ORDER BY date_creation";
2338 2338
 		$result = Database::query($sql);
2339 2339
 
2340 2340
 		// We will create an array of days on which there are posts.
2341
-		if( Database::num_rows($result) > 0) {
2342
-			while($blog_post = Database::fetch_array($result)) {
2341
+		if (Database::num_rows($result) > 0) {
2342
+			while ($blog_post = Database::fetch_array($result)) {
2343 2343
 				// If the day of this post is not yet in the array, add it.
2344 2344
 				if (!in_array($blog_post['post_day'], $posts))
2345 2345
 					$posts[] = $blog_post['post_day'];
@@ -2356,9 +2356,9 @@  discard block
 block discarded – undo
2356 2356
 					task_rel_user.c_id = $course_id AND
2357 2357
 					task.c_id = $course_id AND
2358 2358
 					blog.c_id = $course_id AND
2359
-					task_rel_user.user_id = '".(int)$_user['user_id']."' AND
2360
-					MONTH(target_date) = '".(int)$month."' AND
2361
-					YEAR(target_date) = '".(int)$year."'
2359
+					task_rel_user.user_id = '".(int) $_user['user_id']."' AND
2360
+					MONTH(target_date) = '".(int) $month."' AND
2361
+					YEAR(target_date) = '".(int) $year."'
2362 2362
 				ORDER BY target_date ASC";
2363 2363
 			$result = Database::query($sql);
2364 2364
 
@@ -2381,7 +2381,7 @@  discard block
 block discarded – undo
2381 2381
 
2382 2382
 		echo "<tr>\n";
2383 2383
 
2384
-		for($ii = 1; $ii < 8; $ii ++)
2384
+		for ($ii = 1; $ii < 8; $ii++)
2385 2385
 			echo "<td class=\"weekdays\">", $DaysShort[$ii % 7], "</td>";
2386 2386
 
2387 2387
 		echo "</tr>";
@@ -2391,24 +2391,24 @@  discard block
 block discarded – undo
2391 2391
 
2392 2392
 		while ($curday <= $numberofdays[$month]) {
2393 2393
 			echo "<tr>";
2394
-			for ($ii = 0; $ii < 7; $ii ++) {
2394
+			for ($ii = 0; $ii < 7; $ii++) {
2395 2395
 				if (($curday == -1) && ($ii == $startdayofweek))
2396 2396
 					$curday = 1;
2397 2397
 
2398 2398
 			 	if (($curday > 0) && ($curday <= $numberofdays[$month])) {
2399
-					$bgcolor = $ii < 5 ? $class="class=\"days_week\"" : $class="class=\"days_weekend\"";
2399
+					$bgcolor = $ii < 5 ? $class = "class=\"days_week\"" : $class = "class=\"days_weekend\"";
2400 2400
 					$dayheader = "$curday";
2401 2401
 
2402
-					if(($curday == $today['mday']) && ($year == $today['year']) && ($month == $today['mon'])) {
2402
+					if (($curday == $today['mday']) && ($year == $today['year']) && ($month == $today['mon'])) {
2403 2403
 						$dayheader = "$curday";
2404 2404
 						$class = "class=\"days_today\"";
2405 2405
 					}
2406 2406
 
2407
-					echo "<td " . $class.">";
2407
+					echo "<td ".$class.">";
2408 2408
 
2409 2409
 					// If there are posts on this day, create a filter link.
2410
-					if(in_array($curday, $posts))
2411
-						echo '<a href="blog.php?blog_id=' . $blog_id . '&filter=' . $year . '-' . $month . '-' . $curday . '&month=' . $month . '&year=' . $year . '" title="' . get_lang('ViewPostsOfThisDay') . '">' . $curday . '</a>';
2410
+					if (in_array($curday, $posts))
2411
+						echo '<a href="blog.php?blog_id='.$blog_id.'&filter='.$year.'-'.$month.'-'.$curday.'&month='.$month.'&year='.$year.'" title="'.get_lang('ViewPostsOfThisDay').'">'.$curday.'</a>';
2412 2412
 					else
2413 2413
 						echo $dayheader;
2414 2414
 
@@ -2416,14 +2416,14 @@  discard block
 block discarded – undo
2416 2416
 						if (isset($tasks[$curday]) && is_array($tasks[$curday])) {
2417 2417
 							// Add tasks to calendar
2418 2418
 							foreach ($tasks[$curday] as $task) {
2419
-								echo '<a href="blog.php?action=execute_task&blog_id=' . $task['blog_id'] . '&task_id='.stripslashes($task['task_id']) . '" title="' . $task['title'] . ' : ' . get_lang('InBlog') . ' : ' . $task['blog_name'] . ' - ' . get_lang('ExecuteThisTask') . '">
2420
-								<img src="../img/blog_task.gif" alt="Task" title="' . get_lang('ExecuteThisTask') . '" /></a>';
2419
+								echo '<a href="blog.php?action=execute_task&blog_id='.$task['blog_id'].'&task_id='.stripslashes($task['task_id']).'" title="'.$task['title'].' : '.get_lang('InBlog').' : '.$task['blog_name'].' - '.get_lang('ExecuteThisTask').'">
2420
+								<img src="../img/blog_task.gif" alt="Task" title="' . get_lang('ExecuteThisTask').'" /></a>';
2421 2421
 							}
2422 2422
 						}
2423 2423
 					}
2424 2424
 
2425 2425
 					echo "</td>";
2426
-					$curday ++;
2426
+					$curday++;
2427 2427
 				} else
2428 2428
 					echo "<td>&nbsp;</td>";
2429 2429
 			}
@@ -2461,7 +2461,7 @@  discard block
 block discarded – undo
2461 2461
 	public static function display_edit_blog_form($blog_id)
2462 2462
 	{
2463 2463
 	    $course_id = api_get_course_int_id();
2464
-		$blog_id= intval($blog_id);
2464
+		$blog_id = intval($blog_id);
2465 2465
 		$tbl_blogs = Database::get_course_table(TABLE_BLOGS);
2466 2466
 
2467 2467
 		$sql = "SELECT blog_id, blog_name, blog_subtitle
@@ -2476,7 +2476,7 @@  discard block
 block discarded – undo
2476 2476
 			$blog['blog_subtitle'] = Security::remove_XSS($_POST['blog_subtitle']);
2477 2477
 		}
2478 2478
 
2479
-        $form = new FormValidator('edit_blog', 'post','blog_admin.php?action=edit&blog_id='.intval($_GET['blog_id']));
2479
+        $form = new FormValidator('edit_blog', 'post', 'blog_admin.php?action=edit&blog_id='.intval($_GET['blog_id']));
2480 2480
         $form->addElement('header', get_lang('EditBlog'));
2481 2481
         $form->addElement('text', 'blog_name', get_lang('Title'));
2482 2482
         $form->addElement('textarea', 'blog_subtitle', get_lang('SubTitle'));
@@ -2513,8 +2513,8 @@  discard block
 block discarded – undo
2513 2513
 		$result = Database::query($sql);
2514 2514
 		$list_info = array();
2515 2515
 		if (Database::num_rows($result)) {
2516
-			while ($row_project=Database::fetch_row($result)) {
2517
-				$list_info[]=$row_project;
2516
+			while ($row_project = Database::fetch_row($result)) {
2517
+				$list_info[] = $row_project;
2518 2518
 			}
2519 2519
 		}
2520 2520
 
@@ -2526,39 +2526,39 @@  discard block
 block discarded – undo
2526 2526
 				// Validation when belongs to a session
2527 2527
 				$session_img = api_get_session_image($info_log[4], $_user['status']);
2528 2528
 
2529
-				$url_start_blog = 'blog.php' ."?". "blog_id=".$info_log[3]. "&".api_get_cidreq();
2529
+				$url_start_blog = 'blog.php'."?"."blog_id=".$info_log[3]."&".api_get_cidreq();
2530 2530
 				$title = $info_log[0];
2531 2531
                         $image = Display::return_icon('blog.png', $title);
2532
-    			$list_name = '<div style="float: left; width: 35px; height: 22px;"><a href="'.$url_start_blog.'">' . $image . '</a></div><a href="'.$url_start_blog.'">' .$title. '</a>' . $session_img;
2532
+    			$list_name = '<div style="float: left; width: 35px; height: 22px;"><a href="'.$url_start_blog.'">'.$image.'</a></div><a href="'.$url_start_blog.'">'.$title.'</a>'.$session_img;
2533 2533
 
2534 2534
 				$list_body_blog[] = $list_name;
2535 2535
 				$list_body_blog[] = $info_log[1];
2536 2536
 
2537
-				$visibility_icon=($info_log[2]==0) ? 'invisible' : 'visible';
2538
-				$visibility_info=($info_log[2]==0) ? 'Visible' : 'Invisible';
2539
-			 	$my_image = '<a href="' .api_get_self(). '?action=edit&blog_id=' . $info_log[3] . '">';
2540
-                                $my_image.= Display::return_icon('edit.png', get_lang('EditBlog'));
2537
+				$visibility_icon = ($info_log[2] == 0) ? 'invisible' : 'visible';
2538
+				$visibility_info = ($info_log[2] == 0) ? 'Visible' : 'Invisible';
2539
+			 	$my_image = '<a href="'.api_get_self().'?action=edit&blog_id='.$info_log[3].'">';
2540
+                                $my_image .= Display::return_icon('edit.png', get_lang('EditBlog'));
2541 2541
 
2542
-				$my_image.= "</a>\n";
2543
-				$my_image.= '<a href="' .api_get_self(). '?action=delete&blog_id=' . $info_log[3] . '" ';
2544
-				$my_image.= 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;" >';
2545
-                                $my_image.= Display::return_icon('delete.png', get_lang('DeleteBlog'));
2542
+				$my_image .= "</a>\n";
2543
+				$my_image .= '<a href="'.api_get_self().'?action=delete&blog_id='.$info_log[3].'" ';
2544
+				$my_image .= 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)).'\')) return false;" >';
2545
+                                $my_image .= Display::return_icon('delete.png', get_lang('DeleteBlog'));
2546 2546
 
2547
-				$my_image.= "</a>\n";
2548
-				$my_image.= '<a href="' .api_get_self(). '?action=visibility&blog_id=' . $info_log[3] . '">';
2549
-                                $my_image.= Display::return_icon($visibility_icon . '.gif', get_lang($visibility_info));
2547
+				$my_image .= "</a>\n";
2548
+				$my_image .= '<a href="'.api_get_self().'?action=visibility&blog_id='.$info_log[3].'">';
2549
+                                $my_image .= Display::return_icon($visibility_icon.'.gif', get_lang($visibility_info));
2550 2550
 
2551
-				$my_image.= "</a>\n";
2551
+				$my_image .= "</a>\n";
2552 2552
 
2553
-				$list_body_blog[]=$my_image;
2553
+				$list_body_blog[] = $my_image;
2554 2554
 
2555
-				$list_content_blog[]=$list_body_blog;
2555
+				$list_content_blog[] = $list_body_blog;
2556 2556
 				$list_body_blog = array();
2557 2557
 
2558 2558
 			}
2559
-			$parameters='';
2559
+			$parameters = '';
2560 2560
 			//$parameters=array('action'=>Security::remove_XSS($_GET['action']));
2561
-			$table = new SortableTableFromArrayConfig($list_content_blog, 1,20,'project');
2561
+			$table = new SortableTableFromArrayConfig($list_content_blog, 1, 20, 'project');
2562 2562
 			//$table->set_additional_parameters($parameters);
2563 2563
 			$table->set_header(0, get_lang('Title'));
2564 2564
 			$table->set_header(1, get_lang('SubTitle'));
@@ -2583,34 +2583,34 @@  discard block
 block discarded – undo
2583 2583
  * @author Julio Montoya Dokeos
2584 2584
  * @version avril 2008, dokeos 1.8.5
2585 2585
  */
2586
-function get_blog_attachment($blog_id, $post_id=null,$comment_id=null)
2586
+function get_blog_attachment($blog_id, $post_id = null, $comment_id = null)
2587 2587
 {
2588 2588
 	$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
2589 2589
 
2590 2590
 	$blog_id = intval($blog_id);
2591 2591
 	$comment_id = intval($comment_id);
2592 2592
 	$post_id = intval($post_id);
2593
-	$row=array();
2594
-	$where='';
2593
+	$row = array();
2594
+	$where = '';
2595 2595
 	if (!empty ($post_id) && is_numeric($post_id)) {
2596
-		$where.=' AND post_id ="'.$post_id.'" ';
2596
+		$where .= ' AND post_id ="'.$post_id.'" ';
2597 2597
 	}
2598 2598
 
2599 2599
 	if (!empty ($comment_id) && is_numeric($comment_id)) {
2600 2600
 		if (!empty ($post_id)) {
2601
-			$where.= ' AND ';
2601
+			$where .= ' AND ';
2602 2602
 		}
2603
-		$where.=' comment_id ="'.$comment_id.'" ';
2603
+		$where .= ' comment_id ="'.$comment_id.'" ';
2604 2604
 	}
2605 2605
 
2606 2606
     $course_id = api_get_course_int_id();
2607 2607
 
2608
-	$sql = 'SELECT path, filename, comment FROM '. $blog_table_attachment.'
2608
+	$sql = 'SELECT path, filename, comment FROM '.$blog_table_attachment.'
2609 2609
 	        WHERE c_id = '.$course_id.' AND blog_id ="'.intval($blog_id).'"  '.$where;
2610 2610
 
2611
-	$result=Database::query($sql);
2612
-	if (Database::num_rows($result)!=0) {
2613
-		$row=Database::fetch_array($result);
2611
+	$result = Database::query($sql);
2612
+	if (Database::num_rows($result) != 0) {
2613
+		$row = Database::fetch_array($result);
2614 2614
 	}
2615 2615
 	return $row;
2616 2616
 }
@@ -2624,7 +2624,7 @@  discard block
 block discarded – undo
2624 2624
  * @version avril 2008, dokeos 1.8.5
2625 2625
  */
2626 2626
 
2627
-function delete_all_blog_attachment($blog_id,$post_id=null,$comment_id=null)
2627
+function delete_all_blog_attachment($blog_id, $post_id = null, $comment_id = null)
2628 2628
 {
2629 2629
 	$_course = api_get_course_info();
2630 2630
 	$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
@@ -2648,22 +2648,22 @@  discard block
 block discarded – undo
2648 2648
     }
2649 2649
 
2650 2650
 	// delete all files in directory
2651
-	$courseDir   = $_course['path'].'/upload/blog';
2651
+	$courseDir = $_course['path'].'/upload/blog';
2652 2652
 	$sys_course_path = api_get_path(SYS_COURSE_PATH);
2653 2653
 	$updir = $sys_course_path.$courseDir;
2654 2654
 
2655 2655
 	$sql = 'SELECT path FROM '.$blog_table_attachment.'
2656 2656
 	        WHERE c_id = '.$course_id.' AND blog_id ="'.intval($blog_id).'"  '.$where;
2657
-	$result=Database::query($sql);
2657
+	$result = Database::query($sql);
2658 2658
 
2659
-	while ($row=Database::fetch_row($result)) {
2660
-		$file=$updir.'/'.$row[0];
2661
-		if (Security::check_abs_path($file,$updir) )
2659
+	while ($row = Database::fetch_row($result)) {
2660
+		$file = $updir.'/'.$row[0];
2661
+		if (Security::check_abs_path($file, $updir))
2662 2662
 		{
2663 2663
 			@ unlink($file);
2664 2664
 		}
2665 2665
 	}
2666
-	$sql = 'DELETE FROM '. $blog_table_attachment.'
2666
+	$sql = 'DELETE FROM '.$blog_table_attachment.'
2667 2667
 	        WHERE c_id = '.$course_id.' AND  blog_id ="'.intval($blog_id).'"  '.$where;
2668 2668
 	Database::query($sql);
2669 2669
 }
@@ -2676,8 +2676,8 @@  discard block
 block discarded – undo
2676 2676
 function get_blog_post_from_user($course_code, $user_id)
2677 2677
 {
2678 2678
 	$tbl_blogs 		= Database::get_course_table(TABLE_BLOGS);
2679
-	$tbl_blog_post 	= Database::get_course_table(TABLE_BLOGS_POSTS);
2680
-	$course_info 	= api_get_course_info($course_code);
2679
+	$tbl_blog_post = Database::get_course_table(TABLE_BLOGS_POSTS);
2680
+	$course_info = api_get_course_info($course_code);
2681 2681
 	$course_id 		= $course_info['real_id'];
2682 2682
 
2683 2683
 	$sql = "SELECT DISTINCT blog.blog_id, post_id, title, full_text, post.date_creation
@@ -2692,13 +2692,13 @@  discard block
 block discarded – undo
2692 2692
 	$result = Database::query($sql);
2693 2693
 	$return_data = '';
2694 2694
 
2695
-	if (Database::num_rows($result)!=0) {
2696
-		while ($row=Database::fetch_array($result)) {
2697
-			$return_data.=  '<div class="clear"></div><br />';
2698
-			$return_data.=  '<div class="actions" style="margin-left:5px;margin-right:5px;">'.Display::return_icon('blog_article.png',get_lang('BlogPosts')).' '.$row['title'].'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.$my_course_id.' " >'.get_lang('SeeBlog').'</a></div></div>';
2699
-			$return_data.=  '<br / >';
2700
-			$return_data.= $row['full_text'];
2701
-			$return_data.= '<br /><br />';
2695
+	if (Database::num_rows($result) != 0) {
2696
+		while ($row = Database::fetch_array($result)) {
2697
+			$return_data .= '<div class="clear"></div><br />';
2698
+			$return_data .= '<div class="actions" style="margin-left:5px;margin-right:5px;">'.Display::return_icon('blog_article.png', get_lang('BlogPosts')).' '.$row['title'].'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.$my_course_id.' " >'.get_lang('SeeBlog').'</a></div></div>';
2699
+			$return_data .= '<br / >';
2700
+			$return_data .= $row['full_text'];
2701
+			$return_data .= '<br /><br />';
2702 2702
 		}
2703 2703
 	}
2704 2704
 	return $return_data;
@@ -2728,14 +2728,14 @@  discard block
 block discarded – undo
2728 2728
 			ORDER BY blog_name";
2729 2729
 	$result = Database::query($sql);
2730 2730
 	$return_data = '';
2731
-	if (Database::num_rows($result)!=0) {
2732
-		while ($row=Database::fetch_array($result)) {
2733
-			$return_data.=  '<div class="clear"></div><br />';
2734
-			$return_data.=  '<div class="actions" style="margin-left:5px;margin-right:5px;">'.$row['title'].'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.Security::remove_XSS($course_code).' " >'.get_lang('SeeBlog').'</a></div></div>';
2735
-			$return_data.=  '<br / >';
2731
+	if (Database::num_rows($result) != 0) {
2732
+		while ($row = Database::fetch_array($result)) {
2733
+			$return_data .= '<div class="clear"></div><br />';
2734
+			$return_data .= '<div class="actions" style="margin-left:5px;margin-right:5px;">'.$row['title'].'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.Security::remove_XSS($course_code).' " >'.get_lang('SeeBlog').'</a></div></div>';
2735
+			$return_data .= '<br / >';
2736 2736
 			//$return_data.=  '<strong>'.$row['title'].'</strong>'; echo '<br>';*/
2737
-			$return_data.=  $row['comment'];
2738
-			$return_data.=  '<br />';
2737
+			$return_data .= $row['comment'];
2738
+			$return_data .= '<br />';
2739 2739
 		}
2740 2740
 	}
2741 2741
 	return $return_data;
Please login to merge, or discard this patch.
main/inc/lib/plugin.class.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         $this->fields = $settings;
61 61
 
62 62
         global $language_files;
63
-        $language_files[] = 'plugin_' . $this->get_name();
63
+        $language_files[] = 'plugin_'.$this->get_name();
64 64
     }
65 65
 
66 66
     /**
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
     {
267 267
         $settings = $this->get_settings();
268 268
         foreach ($settings as $setting) {
269
-            if ($setting['variable'] == ($this->get_name() . '_' . $name)) {
269
+            if ($setting['variable'] == ($this->get_name().'_'.$name)) {
270 270
                 return $setting['selected_value'];
271 271
             }
272 272
         }
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 
322 322
             $interfaceLanguageId = api_get_language_id($language_interface);
323 323
             $interfaceLanguageInfo = api_get_language_info($interfaceLanguageId);
324
-            $languageParentId = (!empty($interfaceLanguageInfo['parent_id'])?intval($interfaceLanguageInfo['parent_id']):0);
324
+            $languageParentId = (!empty($interfaceLanguageInfo['parent_id']) ? intval($interfaceLanguageInfo['parent_id']) : 0);
325 325
 
326 326
             //1. Loading english if exists
327 327
             $english_path = $root.$plugin_name."/lang/english.php";
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
         if (!empty($this->course_settings)) {
400 400
             foreach ($this->course_settings as $setting) {
401 401
                 $variable = $setting['name'];
402
-                $value ='';
402
+                $value = '';
403 403
                 if (isset($setting['init_value'])) {
404 404
                     $value = ($setting['init_value']);
405 405
                 }
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 
612 612
         //Avoid Tab Name Spaces
613 613
         $tabNameNoSpaces = preg_replace('/\s+/', '', $tabName);
614
-        $subkeytext = "Tabs" . $tabNameNoSpaces;
614
+        $subkeytext = "Tabs".$tabNameNoSpaces;
615 615
 
616 616
         //Check if it is already added
617 617
         $checkCondition = array(
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
             return false;
628 628
         }
629 629
         //End Check
630
-        $subkey = 'custom_tab_' . $tabNum;
630
+        $subkey = 'custom_tab_'.$tabNum;
631 631
         $attributes = array(
632 632
             'variable' => 'show_tabs',
633 633
             'subkey' => $subkey,
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 
646 646
         //Save the id
647 647
         $settings = $this->get_settings();
648
-        $setData = array (
648
+        $setData = array(
649 649
             'comment' => $subkey
650 650
         );
651 651
         $whereCondition = array(
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
                 $i = 1;
687 687
                 foreach ($tabs as $row) {
688 688
                     $attributes = array(
689
-                        'subkey' => 'custom_tab_' . $i
689
+                        'subkey' => 'custom_tab_'.$i
690 690
                     );
691 691
                     $this->updateTab($row['subkey'], $attributes);
692 692
                     $i++;
Please login to merge, or discard this patch.
main/inc/lib/events.lib.php 1 patch
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.
main/inc/lib/course.lib.php 1 patch
Spacing   +327 added lines, -328 removed lines patch added patch discarded remove patch
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
                     $template = api_get_setting('course_creation_use_template');
129 129
                     if (!empty($template)) {
130 130
                         // Include the necessary libraries to generate a course copy
131
-                        require_once api_get_path(SYS_CODE_PATH) . 'coursecopy/classes/CourseBuilder.class.php';
132
-                        require_once api_get_path(SYS_CODE_PATH) . 'coursecopy/classes/CourseRestorer.class.php';
133
-                        require_once api_get_path(SYS_CODE_PATH) . 'coursecopy/classes/CourseSelectForm.class.php';
131
+                        require_once api_get_path(SYS_CODE_PATH).'coursecopy/classes/CourseBuilder.class.php';
132
+                        require_once api_get_path(SYS_CODE_PATH).'coursecopy/classes/CourseRestorer.class.php';
133
+                        require_once api_get_path(SYS_CODE_PATH).'coursecopy/classes/CourseSelectForm.class.php';
134 134
                         // Call the course copy object
135 135
                         $originCourse = api_get_course_info_by_id($template);
136 136
                         $originCourse['official_code'] = $originCourse['code'];
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
     {
167 167
         return Database::fetch_array(
168 168
             Database::query(
169
-                "SELECT *, id as real_id FROM " . Database::get_main_table(TABLE_MAIN_COURSE) . "
170
-                WHERE code='" . Database::escape_string($course_code) . "'"), 'ASSOC'
169
+                "SELECT *, id as real_id FROM ".Database::get_main_table(TABLE_MAIN_COURSE)."
170
+                WHERE code='" . Database::escape_string($course_code)."'"), 'ASSOC'
171 171
         );
172 172
     }
173 173
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
         $alsoSearchCode = false,
196 196
         $conditionsLike = array()
197 197
     ) {
198
-        $sql = "SELECT course.* FROM " . Database::get_main_table(TABLE_MAIN_COURSE) . " course ";
198
+        $sql = "SELECT course.* FROM ".Database::get_main_table(TABLE_MAIN_COURSE)." course ";
199 199
 
200 200
         if (!empty($urlId)) {
201 201
             $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
@@ -203,9 +203,9 @@  discard block
 block discarded – undo
203 203
         }
204 204
 
205 205
         if (!empty($startwith)) {
206
-            $sql .= "WHERE (title LIKE '" . Database::escape_string($startwith) . "%' ";
206
+            $sql .= "WHERE (title LIKE '".Database::escape_string($startwith)."%' ";
207 207
             if ($alsoSearchCode) {
208
-                $sql .= "OR code LIKE '" . Database::escape_string($startwith) . "%' ";
208
+                $sql .= "OR code LIKE '".Database::escape_string($startwith)."%' ";
209 209
             }
210 210
             $sql .= ') ';
211 211
             if ($visibility !== -1 && $visibility == strval(intval($visibility))) {
@@ -239,19 +239,19 @@  discard block
 block discarded – undo
239 239
                 $value = Database::escape_string($value);
240 240
                 $simple_like = false;
241 241
                 if ($simple_like) {
242
-                    $temp_conditions[] = $field . " LIKE '$value%'";
242
+                    $temp_conditions[] = $field." LIKE '$value%'";
243 243
                 } else {
244
-                    $temp_conditions[] = $field . ' LIKE \'%' . $value . '%\'';
244
+                    $temp_conditions[] = $field.' LIKE \'%'.$value.'%\'';
245 245
                 }
246 246
             }
247 247
             $condition = ' AND ';
248 248
             if (!empty($temp_conditions)) {
249
-                $sql .= implode(' ' . $condition . ' ', $temp_conditions);
249
+                $sql .= implode(' '.$condition.' ', $temp_conditions);
250 250
             }
251 251
         }
252 252
 
253 253
         if (!empty($orderby)) {
254
-            $sql .= " ORDER BY " . Database::escape_string($orderby) . " ";
254
+            $sql .= " ORDER BY ".Database::escape_string($orderby)." ";
255 255
         } else {
256 256
             $sql .= " ORDER BY 1 ";
257 257
         }
@@ -263,13 +263,13 @@  discard block
 block discarded – undo
263 263
         }
264 264
 
265 265
         if (!empty($howmany) && is_int($howmany) and $howmany > 0) {
266
-            $sql .= ' LIMIT ' . Database::escape_string($howmany);
266
+            $sql .= ' LIMIT '.Database::escape_string($howmany);
267 267
         } else {
268 268
             $sql .= ' LIMIT 1000000'; //virtually no limit
269 269
         }
270 270
         if (!empty($from)) {
271 271
             $from = intval($from);
272
-            $sql .= ' OFFSET ' . intval($from);
272
+            $sql .= ' OFFSET '.intval($from);
273 273
         } else {
274 274
             $sql .= ' OFFSET 0';
275 275
         }
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
         return Database::fetch_array(
294 294
             Database::query(
295 295
                 "SELECT visibility, subscribe, unsubscribe
296
-                FROM " . Database::get_main_table(TABLE_MAIN_COURSE) . "
297
-                WHERE code = '" . Database::escape_string($course_code) . "'"
296
+                FROM " . Database::get_main_table(TABLE_MAIN_COURSE)."
297
+                WHERE code = '" . Database::escape_string($course_code)."'"
298 298
             )
299 299
         );
300 300
     }
@@ -312,10 +312,10 @@  discard block
 block discarded – undo
312 312
         $courseId = $courseInfo['real_id'];
313 313
         $result = Database::fetch_array(
314 314
             Database::query(
315
-                "SELECT status FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . "
315
+                "SELECT status FROM ".Database::get_main_table(TABLE_MAIN_COURSE_USER)."
316 316
                 WHERE
317 317
                     c_id  = $courseId AND
318
-                    user_id = " . intval($user_id)
318
+                    user_id = ".intval($user_id)
319 319
             )
320 320
         );
321 321
 
@@ -333,9 +333,9 @@  discard block
 block discarded – undo
333 333
 
334 334
         $result = Database::fetch_array(
335 335
             Database::query("
336
-                SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . "
336
+                SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER)."
337 337
                 WHERE
338
-                    c_id  = '" . intval($courseId). "' AND
338
+                    c_id  = '" . intval($courseId)."' AND
339 339
                     user_id = " . intval($userId)
340 340
             )
341 341
         );
@@ -382,9 +382,9 @@  discard block
 block discarded – undo
382 382
         $result = Database::fetch_array(
383 383
             Database::query("
384 384
                 SELECT is_tutor
385
-                FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . "
385
+                FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER)."
386 386
                 WHERE
387
-                    course_code = '" . Database::escape_string($course_code) . "' AND
387
+                    course_code = '" . Database::escape_string($course_code)."' AND
388 388
                     user_id = " . intval($user_id)
389 389
             )
390 390
         );
@@ -437,17 +437,17 @@  discard block
 block discarded – undo
437 437
         $course_id = $course_info['real_id'];
438 438
 
439 439
         // Unsubscribe user from all groups in the course.
440
-        $sql = "DELETE FROM " . Database::get_course_table(TABLE_GROUP_USER) . "
441
-                WHERE c_id = $course_id AND user_id IN (" . $user_ids . ")";
440
+        $sql = "DELETE FROM ".Database::get_course_table(TABLE_GROUP_USER)."
441
+                WHERE c_id = $course_id AND user_id IN (".$user_ids.")";
442 442
         Database::query($sql);
443
-        $sql = "DELETE FROM " . Database::get_course_table(TABLE_GROUP_TUTOR) . "
444
-                WHERE c_id = $course_id AND user_id IN (" . $user_ids . ")";
443
+        $sql = "DELETE FROM ".Database::get_course_table(TABLE_GROUP_TUTOR)."
444
+                WHERE c_id = $course_id AND user_id IN (".$user_ids.")";
445 445
         Database::query($sql);
446 446
 
447 447
         // Erase user student publications (works) in the course - by André Boivin
448 448
 
449 449
         if (!empty($user_list)) {
450
-            require_once api_get_path(SYS_CODE_PATH) . 'work/work.lib.php';
450
+            require_once api_get_path(SYS_CODE_PATH).'work/work.lib.php';
451 451
             foreach ($user_list as $userId) {
452 452
                 // Getting all work from user
453 453
                 $workList = getWorkPerUser($userId);
@@ -466,74 +466,74 @@  discard block
 block discarded – undo
466 466
         }
467 467
 
468 468
         // Unsubscribe user from all blogs in the course.
469
-        Database::query("DELETE FROM " . Database::get_course_table(TABLE_BLOGS_REL_USER) . " WHERE c_id = $course_id AND  user_id IN (" . $user_ids . ")");
470
-        Database::query("DELETE FROM " . Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER) . " WHERE c_id = $course_id AND  user_id IN (" . $user_ids . ")");
469
+        Database::query("DELETE FROM ".Database::get_course_table(TABLE_BLOGS_REL_USER)." WHERE c_id = $course_id AND  user_id IN (".$user_ids.")");
470
+        Database::query("DELETE FROM ".Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER)." WHERE c_id = $course_id AND  user_id IN (".$user_ids.")");
471 471
 
472 472
         // Deleting users in forum_notification and mailqueue course tables
473
-        $sql = "DELETE FROM  " . Database::get_course_table(TABLE_FORUM_NOTIFICATION) . "
474
-                WHERE c_id = $course_id AND user_id IN (" . $user_ids . ")";
473
+        $sql = "DELETE FROM  ".Database::get_course_table(TABLE_FORUM_NOTIFICATION)."
474
+                WHERE c_id = $course_id AND user_id IN (".$user_ids.")";
475 475
         Database::query($sql);
476 476
 
477
-        $sql = "DELETE FROM " . Database::get_course_table(TABLE_FORUM_MAIL_QUEUE) . "
478
-                WHERE c_id = $course_id AND user_id IN (" . $user_ids . ")";
477
+        $sql = "DELETE FROM ".Database::get_course_table(TABLE_FORUM_MAIL_QUEUE)."
478
+                WHERE c_id = $course_id AND user_id IN (".$user_ids.")";
479 479
         Database::query($sql);
480 480
 
481 481
         // Unsubscribe user from the course.
482 482
         if (!empty($session_id)) {
483 483
 
484 484
             // Delete in table session_rel_course_rel_user
485
-            $sql = "DELETE FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . "
485
+            $sql = "DELETE FROM ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)."
486 486
                     WHERE
487
-                        session_id ='" . $session_id . "' AND
488
-                        c_id = '" . $course_id . "' AND
487
+                        session_id ='" . $session_id."' AND
488
+                        c_id = '" . $course_id."' AND
489 489
                         user_id IN ($user_ids)";
490 490
             Database::query($sql);
491 491
 
492 492
             foreach ($user_list as $uid) {
493 493
                 // check if a user is register in the session with other course
494
-                $sql = "SELECT user_id FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . "
494
+                $sql = "SELECT user_id FROM ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)."
495 495
                         WHERE session_id='$session_id' AND user_id='$uid'";
496 496
                 $rs = Database::query($sql);
497 497
 
498 498
                 if (Database::num_rows($rs) == 0) {
499 499
                     // Delete in table session_rel_user
500
-                    $sql = "DELETE FROM " . Database::get_main_table(TABLE_MAIN_SESSION_USER) . "
500
+                    $sql = "DELETE FROM ".Database::get_main_table(TABLE_MAIN_SESSION_USER)."
501 501
                             WHERE
502
-                                session_id ='" . $session_id . "' AND
502
+                                session_id ='" . $session_id."' AND
503 503
                                 user_id = '$uid' AND
504
-                                relation_type<>" . SESSION_RELATION_TYPE_RRHH . "";
504
+                                relation_type<>".SESSION_RELATION_TYPE_RRHH."";
505 505
                     Database::query($sql);
506 506
                 }
507 507
             }
508 508
 
509 509
             // Update the table session
510
-            $sql = "SELECT COUNT(*) FROM " . Database::get_main_table(TABLE_MAIN_SESSION_USER) . "
511
-                    WHERE session_id = '" . $session_id . "' AND relation_type <> " . SESSION_RELATION_TYPE_RRHH;
510
+            $sql = "SELECT COUNT(*) FROM ".Database::get_main_table(TABLE_MAIN_SESSION_USER)."
511
+                    WHERE session_id = '" . $session_id."' AND relation_type <> ".SESSION_RELATION_TYPE_RRHH;
512 512
             $row = Database::fetch_array(Database::query($sql));
513 513
             $count = $row[0];
514 514
             // number of users by session
515
-            $sql = "UPDATE " . Database::get_main_table(TABLE_MAIN_SESSION) . " SET nbr_users = '$count'
516
-                    WHERE id = '" . $session_id . "'";
515
+            $sql = "UPDATE ".Database::get_main_table(TABLE_MAIN_SESSION)." SET nbr_users = '$count'
516
+                    WHERE id = '".$session_id."'";
517 517
             Database::query($sql);
518 518
 
519 519
             // Update the table session_rel_course
520
-            $sql = "SELECT COUNT(*) FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . "
520
+            $sql = "SELECT COUNT(*) FROM ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)."
521 521
                     WHERE session_id = '$session_id' AND c_id = '$course_id' AND status<>2";
522 522
             $row = Database::fetch_array(@Database::query($sql));
523 523
             $count = $row[0];
524 524
 
525 525
             // number of users by session and course
526
-            $sql = "UPDATE " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE) . "
526
+            $sql = "UPDATE ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE)."
527 527
                     SET nbr_users = '$count'
528 528
                     WHERE session_id = '$session_id' AND c_id = '$course_id'";
529 529
             Database::query($sql);
530 530
 
531 531
         } else {
532
-            $sql = "DELETE FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . "
532
+            $sql = "DELETE FROM ".Database::get_main_table(TABLE_MAIN_COURSE_USER)."
533 533
                     WHERE
534
-                        user_id IN (" . $user_ids . ") AND
535
-                        relation_type<>" . COURSE_RELATION_TYPE_RRHH . " AND
536
-                        c_id = '" . $course_id . "'";
534
+                        user_id IN (" . $user_ids.") AND
535
+                        relation_type<>" . COURSE_RELATION_TYPE_RRHH." AND
536
+                        c_id = '" . $course_id."'";
537 537
             Database::query($sql);
538 538
 
539 539
             // add event to system log
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 
604 604
         // A preliminary check whether the user has bben already registered on the platform.
605 605
         if (Database::num_rows(Database::query(
606
-                "SELECT status FROM " . Database::get_main_table(TABLE_MAIN_USER) . "
606
+                "SELECT status FROM ".Database::get_main_table(TABLE_MAIN_USER)."
607 607
                 WHERE user_id = '$user_id' ")) == 0
608 608
         ) {
609 609
             return false; // The user has not been registered to the platform.
@@ -613,8 +613,8 @@  discard block
 block discarded – undo
613 613
 
614 614
         if (empty($session_id)) {
615 615
             if (Database::num_rows(Database::query("
616
-                    SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . "
617
-                    WHERE user_id = '$user_id' AND relation_type<>" . COURSE_RELATION_TYPE_RRHH . " AND c_id = '$courseId'")) > 0
616
+                    SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER)."
617
+                    WHERE user_id = '$user_id' AND relation_type<>".COURSE_RELATION_TYPE_RRHH." AND c_id = '$courseId'")) > 0
618 618
             ) {
619 619
                 // The user has been already subscribed to the course.
620 620
                 return false;
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
         $courseId = $courseInfo['real_id'];
737 737
 
738 738
         // Check in advance whether the user has already been registered on the platform.
739
-        $sql = "SELECT status FROM " . $user_table . " WHERE user_id = $user_id ";
739
+        $sql = "SELECT status FROM ".$user_table." WHERE user_id = $user_id ";
740 740
         if (Database::num_rows(Database::query($sql)) == 0) {
741 741
             if ($debug) {
742 742
                 error_log('The user has not been registered to the platform');
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
         $sql = "SELECT * FROM $course_user_table
749 749
                 WHERE
750 750
                     user_id = $user_id AND
751
-                    relation_type <> " . COURSE_RELATION_TYPE_RRHH . " AND
751
+                    relation_type <> ".COURSE_RELATION_TYPE_RRHH." AND
752 752
                     c_id = $courseId";
753 753
         if (Database::num_rows(Database::query($sql)) > 0) {
754 754
             if ($debug) {
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
         if (!api_is_course_admin()) {
761 761
             // Check in advance whether subscription is allowed or not for this course.
762 762
             $sql = "SELECT code, visibility FROM $course_table
763
-                    WHERE id = $courseId AND subscribe = '" . SUBSCRIBE_NOT_ALLOWED . "'";
763
+                    WHERE id = $courseId AND subscribe = '".SUBSCRIBE_NOT_ALLOWED."'";
764 764
             if (Database::num_rows(Database::query($sql)) > 0) {
765 765
                 if ($debug) {
766 766
                     error_log('Subscription is not allowed for this course');
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
     {
820 820
         $wanted_course_code = Database::escape_string($wanted_course_code);
821 821
         $sql = "SELECT COUNT(*) as number
822
-                FROM " . Database::get_main_table(TABLE_MAIN_COURSE) . "
822
+                FROM " . Database::get_main_table(TABLE_MAIN_COURSE)."
823 823
                 WHERE code = '$wanted_course_code' OR visual_code = '$wanted_course_code'";
824 824
         $result = Database::fetch_array(Database::query($sql));
825 825
 
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
         $sql = "SELECT * FROM $table
1006 1006
                 WHERE
1007 1007
                     user_id = $userId AND
1008
-                    relation_type = " . COURSE_RELATION_TYPE_RRHH . " AND
1008
+                    relation_type = ".COURSE_RELATION_TYPE_RRHH." AND
1009 1009
                     c_id = $courseId";
1010 1010
 
1011 1011
         $result = Database::fetch_array(Database::query($sql));
@@ -1044,13 +1044,13 @@  discard block
 block discarded – undo
1044 1044
                 return false;
1045 1045
             }
1046 1046
             $courseId = $courseInfo['real_id'];
1047
-            $condition_course = ' AND c_id = ' . $courseId;
1047
+            $condition_course = ' AND c_id = '.$courseId;
1048 1048
         }
1049 1049
 
1050
-        $sql = "SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . "
1050
+        $sql = "SELECT * FROM ".Database::get_main_table(TABLE_MAIN_COURSE_USER)."
1051 1051
                 WHERE
1052 1052
                     user_id = $user_id AND
1053
-                    relation_type<>" . COURSE_RELATION_TYPE_RRHH . "
1053
+                    relation_type<>".COURSE_RELATION_TYPE_RRHH."
1054 1054
                     $condition_course ";
1055 1055
 
1056 1056
         $result = Database::fetch_array(Database::query($sql));
@@ -1066,20 +1066,20 @@  discard block
 block discarded – undo
1066 1066
         }
1067 1067
 
1068 1068
         $tableSessionCourseUser = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
1069
-        $sql = 'SELECT 1 FROM ' . $tableSessionCourseUser .
1070
-            ' WHERE user_id = ' . $user_id . ' ' . $condition_course;
1069
+        $sql = 'SELECT 1 FROM '.$tableSessionCourseUser.
1070
+            ' WHERE user_id = '.$user_id.' '.$condition_course;
1071 1071
         if (Database::num_rows(Database::query($sql)) > 0) {
1072 1072
             return true;
1073 1073
         }
1074 1074
 
1075
-        $sql = 'SELECT 1 FROM ' . $tableSessionCourseUser .
1076
-            ' WHERE user_id = ' . $user_id . ' AND status=2 ' . $condition_course;
1075
+        $sql = 'SELECT 1 FROM '.$tableSessionCourseUser.
1076
+            ' WHERE user_id = '.$user_id.' AND status=2 '.$condition_course;
1077 1077
         if (Database::num_rows(Database::query($sql)) > 0) {
1078 1078
             return true;
1079 1079
         }
1080 1080
 
1081
-        $sql = 'SELECT 1 FROM ' . Database::get_main_table(TABLE_MAIN_SESSION) .
1082
-            ' WHERE id = ' . $session_id . ' AND id_coach=' . $user_id;
1081
+        $sql = 'SELECT 1 FROM '.Database::get_main_table(TABLE_MAIN_SESSION).
1082
+            ' WHERE id = '.$session_id.' AND id_coach='.$user_id;
1083 1083
 
1084 1084
         if (Database::num_rows(Database::query($sql)) > 0) {
1085 1085
             return true;
@@ -1106,8 +1106,8 @@  discard block
 block discarded – undo
1106 1106
         $courseId = $courseInfo['real_id'];
1107 1107
 
1108 1108
         $result = Database::query(
1109
-            'SELECT status FROM ' . Database::get_main_table(TABLE_MAIN_COURSE_USER) .
1110
-            ' WHERE c_id = ' . $courseId . ' AND user_id = ' . $user_id . ''
1109
+            'SELECT status FROM '.Database::get_main_table(TABLE_MAIN_COURSE_USER).
1110
+            ' WHERE c_id = '.$courseId.' AND user_id = '.$user_id.''
1111 1111
         );
1112 1112
 
1113 1113
         if (Database::num_rows($result) > 0) {
@@ -1137,12 +1137,12 @@  discard block
 block discarded – undo
1137 1137
             $result = Database::fetch_array(
1138 1138
                 Database::query(
1139 1139
                     "SELECT *
1140
-                    FROM " . Database::get_main_table(TABLE_MAIN_COURSE) . " course
1141
-                    LEFT JOIN " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " course_user
1140
+                    FROM " . Database::get_main_table(TABLE_MAIN_COURSE)." course
1141
+                    LEFT JOIN " . Database::get_main_table(TABLE_MAIN_COURSE_USER)." course_user
1142 1142
                     ON course.id = course_user.c_id
1143 1143
                     WHERE
1144 1144
                         course_user.user_id = '$user_id' AND
1145
-                        course_user.relation_type<>" . COURSE_RELATION_TYPE_RRHH . " AND
1145
+                        course_user.relation_type<>".COURSE_RELATION_TYPE_RRHH." AND
1146 1146
                         ( course.id = '$courseId')"
1147 1147
                 )
1148 1148
             );
@@ -1156,8 +1156,8 @@  discard block
 block discarded – undo
1156 1156
 
1157 1157
         // A user?
1158 1158
         if (Database::num_rows(Database::query("SELECT user_id
1159
-                FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . "
1160
-                WHERE session_id='" . $session_id . "'
1159
+                FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)."
1160
+                WHERE session_id='" . $session_id."'
1161 1161
                 AND user_id ='$user_id'"))
1162 1162
         ) {
1163 1163
             return true;
@@ -1165,8 +1165,8 @@  discard block
 block discarded – undo
1165 1165
 
1166 1166
         // A course coach?
1167 1167
         if (Database::num_rows(Database::query("SELECT user_id
1168
-                FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . "
1169
-                WHERE session_id='" . $session_id . "'
1168
+                FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)."
1169
+                WHERE session_id='" . $session_id."'
1170 1170
                 AND user_id = '$user_id' AND status = 2
1171 1171
                 AND c_id ='$courseId'"))
1172 1172
         ) {
@@ -1175,8 +1175,8 @@  discard block
 block discarded – undo
1175 1175
 
1176 1176
         // A session coach?
1177 1177
         if (Database::num_rows(Database::query("SELECT id_coach
1178
-                FROM " . Database::get_main_table(TABLE_MAIN_SESSION) . " AS session
1179
-                WHERE session.id='" . $session_id . "'
1178
+                FROM " . Database::get_main_table(TABLE_MAIN_SESSION)." AS session
1179
+                WHERE session.id='" . $session_id."'
1180 1180
                 AND id_coach='$user_id'"))
1181 1181
         ) {
1182 1182
             return true;
@@ -1244,7 +1244,7 @@  discard block
 block discarded – undo
1244 1244
         // we have to check if it is a valid field that can be sorted on
1245 1245
         if (!strstr($order_by, 'ORDER BY')) {
1246 1246
             if (!empty($order_by)) {
1247
-                $order_by = 'ORDER BY ' . $order_by;
1247
+                $order_by = 'ORDER BY '.$order_by;
1248 1248
             } else {
1249 1249
                 $order_by = '';
1250 1250
             }
@@ -1276,11 +1276,11 @@  discard block
 block discarded – undo
1276 1276
             if (!empty($courseCodeList)) {
1277 1277
                 $courseCodeListForSession = array_map(array('Database', 'escape_string'), $courseCodeList);
1278 1278
                 $courseCodeListForSession = implode('","', $courseCodeListForSession);
1279
-                $courseCondition = ' course.code IN ("' . $courseCodeListForSession . '")  ';
1279
+                $courseCondition = ' course.code IN ("'.$courseCodeListForSession.'")  ';
1280 1280
             }
1281 1281
 
1282
-            $sql .= ' FROM ' . Database::get_main_table(TABLE_MAIN_USER) . ' as user ';
1283
-            $sql .= " LEFT JOIN ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . " as session_course_user
1282
+            $sql .= ' FROM '.Database::get_main_table(TABLE_MAIN_USER).' as user ';
1283
+            $sql .= " LEFT JOIN ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)." as session_course_user
1284 1284
                       ON
1285 1285
                         user.user_id = session_course_user.user_id AND
1286 1286
                         $sessionCondition
@@ -1322,14 +1322,14 @@  discard block
 block discarded – undo
1322 1322
                 }
1323 1323
             }
1324 1324
 
1325
-            $sql .= ' FROM ' . Database::get_main_table(TABLE_MAIN_USER) . ' as user ';
1326
-            $sql .= ' LEFT JOIN ' . Database::get_main_table(TABLE_MAIN_COURSE_USER) . ' as course_rel_user
1325
+            $sql .= ' FROM '.Database::get_main_table(TABLE_MAIN_USER).' as user ';
1326
+            $sql .= ' LEFT JOIN '.Database::get_main_table(TABLE_MAIN_COURSE_USER).' as course_rel_user
1327 1327
                         ON user.user_id = course_rel_user.user_id AND
1328
-                        course_rel_user.relation_type <> ' . COURSE_RELATION_TYPE_RRHH . '  ';
1328
+                        course_rel_user.relation_type <> ' . COURSE_RELATION_TYPE_RRHH.'  ';
1329 1329
             $sql .= " INNER JOIN $course_table course ON course_rel_user.c_id = course.id ";
1330 1330
 
1331 1331
             if (!empty($course_code)) {
1332
-                $sql .= ' AND course_rel_user.c_id="' . $courseId . '"';
1332
+                $sql .= ' AND course_rel_user.c_id="'.$courseId.'"';
1333 1333
             }
1334 1334
             $where[] = ' course_rel_user.c_id IS NOT NULL ';
1335 1335
 
@@ -1341,7 +1341,7 @@  discard block
 block discarded – undo
1341 1341
 
1342 1342
         $multiple_access_url = api_get_multiple_access_url();
1343 1343
         if ($multiple_access_url) {
1344
-            $sql .= ' LEFT JOIN ' . Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER) . ' au
1344
+            $sql .= ' LEFT JOIN '.Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER).' au
1345 1345
                       ON (au.user_id = user.user_id) ';
1346 1346
         }
1347 1347
 
@@ -1361,7 +1361,7 @@  discard block
 block discarded – undo
1361 1361
             }
1362 1362
         }
1363 1363
 
1364
-        $sql .= ' WHERE ' . $filter_by_status_condition . ' ' . implode(' OR ', $where);
1364
+        $sql .= ' WHERE '.$filter_by_status_condition.' '.implode(' OR ', $where);
1365 1365
 
1366 1366
         if ($multiple_access_url) {
1367 1367
             $current_access_url_id = api_get_current_access_url_id();
@@ -1383,15 +1383,15 @@  discard block
 block discarded – undo
1383 1383
         if (!empty($userIdList)) {
1384 1384
             $userIdList = array_map('intval', $userIdList);
1385 1385
             $userIdList = implode('","', $userIdList);
1386
-            $sql .= ' AND user.user_id IN ("' . $userIdList . '")';
1386
+            $sql .= ' AND user.user_id IN ("'.$userIdList.'")';
1387 1387
         }
1388 1388
 
1389 1389
         if (isset($filterByActive)) {
1390 1390
             $filterByActive = intval($filterByActive);
1391
-            $sql .= ' AND user.active = ' . $filterByActive;
1391
+            $sql .= ' AND user.active = '.$filterByActive;
1392 1392
         }
1393 1393
 
1394
-        $sql .= ' ' . $order_by . ' ' . $limit;
1394
+        $sql .= ' '.$order_by.' '.$limit;
1395 1395
 
1396 1396
         $rs = Database::query($sql);
1397 1397
         $users = array();
@@ -1548,7 +1548,7 @@  discard block
 block discarded – undo
1548 1548
                             )
1549 1549
                         );
1550 1550
                         $report_info['progress_100'] = $progress == 100 ? Display::label(get_lang('Yes'), 'success') : Display::label(get_lang('No'));
1551
-                        $report_info['progress'] = $progress . "%";
1551
+                        $report_info['progress'] = $progress."%";
1552 1552
 
1553 1553
                         foreach ($extra_fields as $extra) {
1554 1554
                             $user_data = UserManager::get_extra_user_data_by_field($user['user_id'], $extra['1']);
@@ -1617,32 +1617,32 @@  discard block
 block discarded – undo
1617 1617
         $courseInfo = api_get_course_info($course_code);
1618 1618
         $courseId = $courseInfo['real_id'];
1619 1619
 
1620
-        $sql = 'SELECT DISTINCT count(*) as count  FROM ' . Database::get_main_table(TABLE_MAIN_USER) . ' as user ';
1620
+        $sql = 'SELECT DISTINCT count(*) as count  FROM '.Database::get_main_table(TABLE_MAIN_USER).' as user ';
1621 1621
         $where = array();
1622 1622
         if (!empty($session_id)) {
1623
-            $sql .= ' LEFT JOIN ' . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . ' as session_course_user
1623
+            $sql .= ' LEFT JOIN '.Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER).' as session_course_user
1624 1624
                       ON
1625 1625
                         user.user_id = session_course_user.user_id AND
1626
-                        session_course_user.c_id = "' . $courseId . '" AND
1626
+                        session_course_user.c_id = "' . $courseId.'" AND
1627 1627
                         session_course_user.session_id  = ' . $session_id;
1628 1628
 
1629 1629
             $where[] = ' session_course_user.c_id IS NOT NULL ';
1630 1630
         } else {
1631
-            $sql .= ' LEFT JOIN ' . Database::get_main_table(TABLE_MAIN_COURSE_USER) . ' as course_rel_user
1631
+            $sql .= ' LEFT JOIN '.Database::get_main_table(TABLE_MAIN_COURSE_USER).' as course_rel_user
1632 1632
                         ON
1633 1633
                             user.user_id = course_rel_user.user_id AND
1634
-                            course_rel_user.relation_type<>' . COURSE_RELATION_TYPE_RRHH . ' AND
1635
-                            course_rel_user.c_id = ' . $courseId ;
1634
+                            course_rel_user.relation_type<>' . COURSE_RELATION_TYPE_RRHH.' AND
1635
+                            course_rel_user.c_id = ' . $courseId;
1636 1636
             $where[] = ' course_rel_user.c_id IS NOT NULL ';
1637 1637
         }
1638 1638
 
1639 1639
         $multiple_access_url = api_get_multiple_access_url();
1640 1640
         if ($multiple_access_url) {
1641
-            $sql .= ' LEFT JOIN ' . Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER) . '  au
1641
+            $sql .= ' LEFT JOIN '.Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER).'  au
1642 1642
                       ON (au.user_id = user.user_id) ';
1643 1643
         }
1644 1644
 
1645
-        $sql .= ' WHERE ' . implode(' OR ', $where);
1645
+        $sql .= ' WHERE '.implode(' OR ', $where);
1646 1646
 
1647 1647
         if ($multiple_access_url) {
1648 1648
             $current_access_url_id = api_get_current_access_url_id();
@@ -1678,8 +1678,8 @@  discard block
 block discarded – undo
1678 1678
         $users = array();
1679 1679
 
1680 1680
         // We get the coach for the given course in a given session.
1681
-        $sql = 'SELECT user_id FROM ' . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) .
1682
-               ' WHERE session_id ="' . $session_id . '" AND c_id="' . $courseId . '" AND status = 2';
1681
+        $sql = 'SELECT user_id FROM '.Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER).
1682
+               ' WHERE session_id ="'.$session_id.'" AND c_id="'.$courseId.'" AND status = 2';
1683 1683
         $rs = Database::query($sql);
1684 1684
         while ($user = Database::fetch_array($rs)) {
1685 1685
             $user_info = api_get_user_info($user['user_id']);
@@ -1691,7 +1691,7 @@  discard block
 block discarded – undo
1691 1691
 
1692 1692
         $table = Database::get_main_table(TABLE_MAIN_SESSION);
1693 1693
         // We get the session coach.
1694
-        $sql = 'SELECT id_coach FROM ' . $table . ' WHERE id=' . $session_id;
1694
+        $sql = 'SELECT id_coach FROM '.$table.' WHERE id='.$session_id;
1695 1695
         $rs = Database::query($sql);
1696 1696
         $session_id_coach = Database::result($rs, 0, 'id_coach');
1697 1697
         $user_info = api_get_user_info($session_id_coach);
@@ -1767,11 +1767,11 @@  discard block
 block discarded – undo
1767 1767
             $joinSession = "";
1768 1768
             //Session creation date
1769 1769
             if (!empty($date_from) && !empty($date_to)) {
1770
-                $joinSession = "INNER JOIN " . Database::get_main_table(TABLE_MAIN_SESSION) . " s";
1770
+                $joinSession = "INNER JOIN ".Database::get_main_table(TABLE_MAIN_SESSION)." s";
1771 1771
             }
1772 1772
 
1773 1773
             $sql_query = "SELECT *
1774
-                          FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . " scu
1774
+                          FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)." scu
1775 1775
                           $joinSession
1776 1776
                           INNER JOIN $userTable u ON scu.user_id = u.user_id
1777 1777
                           WHERE scu.c_id = '$courseId' AND scu.status <> 2";
@@ -1783,11 +1783,11 @@  discard block
 block discarded – undo
1783 1783
             }
1784 1784
 
1785 1785
             if ($session_id != 0) {
1786
-                $sql_query .= ' AND scu.session_id = ' . $session_id;
1786
+                $sql_query .= ' AND scu.session_id = '.$session_id;
1787 1787
             }
1788 1788
 
1789 1789
             if (!$includeInvitedUsers) {
1790
-                $sql_query .= " AND u.status != " . INVITEE;
1790
+                $sql_query .= " AND u.status != ".INVITEE;
1791 1791
             }
1792 1792
 
1793 1793
             $rs = Database::query($sql_query);
@@ -1821,8 +1821,8 @@  discard block
 block discarded – undo
1821 1821
                     u.email,
1822 1822
                     u.username,
1823 1823
                     u.status
1824
-                FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " cu
1825
-                INNER JOIN " . Database::get_main_table(TABLE_MAIN_USER) . " u
1824
+                FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER)." cu
1825
+                INNER JOIN " . Database::get_main_table(TABLE_MAIN_USER)." u
1826 1826
                 ON (cu.user_id = u.id)
1827 1827
                 WHERE
1828 1828
                     cu.c_id = $courseId AND
@@ -1860,7 +1860,7 @@  discard block
 block discarded – undo
1860 1860
                     $teacher['lastname']
1861 1861
                 );
1862 1862
                 if ($add_link_to_profile) {
1863
-                    $url = api_get_path(WEB_AJAX_PATH) . 'user_manager.ajax.php?a=get_user_popup&user_id=' . $teacher['user_id'];
1863
+                    $url = api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?a=get_user_popup&user_id='.$teacher['user_id'];
1864 1864
                     $teacher_name = Display::url(
1865 1865
                         $teacher_name,
1866 1866
                         $url,
@@ -1874,13 +1874,13 @@  discard block
 block discarded – undo
1874 1874
             }
1875 1875
 
1876 1876
             if (!empty($list)) {
1877
-                if ($orderList === true){
1877
+                if ($orderList === true) {
1878 1878
                     $html .= '<ul class="user-teacher">';
1879
-                    foreach ($list as $teacher){
1880
-                        $html .= Display::tag('li', Display::return_icon('teacher.png', $teacher, null, ICON_SIZE_TINY) . ' ' . $teacher);
1879
+                    foreach ($list as $teacher) {
1880
+                        $html .= Display::tag('li', Display::return_icon('teacher.png', $teacher, null, ICON_SIZE_TINY).' '.$teacher);
1881 1881
                     }
1882 1882
                     $html .= '</ul>';
1883
-                }else{
1883
+                } else {
1884 1884
                     $html .= array_to_string($list, $separator);
1885 1885
                 }
1886 1886
             }
@@ -1959,7 +1959,7 @@  discard block
 block discarded – undo
1959 1959
             foreach ($coachs_course as $coach_course) {
1960 1960
                 $coach_name = api_get_person_name($coach_course['firstname'], $coach_course['lastname']);
1961 1961
                 if ($add_link_to_profile) {
1962
-                    $url = api_get_path(WEB_AJAX_PATH) . 'user_manager.ajax.php?a=get_user_popup&user_id=' . $coach_course['user_id'];
1962
+                    $url = api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?a=get_user_popup&user_id='.$coach_course['user_id'];
1963 1963
                     $coach_name = Display::url(
1964 1964
                         $coach_name,
1965 1965
                         $url,
@@ -1975,10 +1975,10 @@  discard block
 block discarded – undo
1975 1975
         $coaches_to_string = null;
1976 1976
 
1977 1977
         if (!empty($course_coachs)) {
1978
-            if ($orderList === true){
1978
+            if ($orderList === true) {
1979 1979
                 $html .= '<ul class="user-coachs">';
1980
-                    foreach ($course_coachs as $coachs){
1981
-                        $html .= Display::tag('li', Display::return_icon('teacher.png', $coachs, null, ICON_SIZE_TINY) . ' ' . $coachs);
1980
+                    foreach ($course_coachs as $coachs) {
1981
+                        $html .= Display::tag('li', Display::return_icon('teacher.png', $coachs, null, ICON_SIZE_TINY).' '.$coachs);
1982 1982
                     }
1983 1983
                 $html .= '</ul>';
1984 1984
             } else {
@@ -2033,20 +2033,20 @@  discard block
 block discarded – undo
2033 2033
         }
2034 2034
 
2035 2035
         $group_list = array();
2036
-        $session_id != 0 ? $session_condition = ' WHERE g.session_id IN(1,' . intval($session_id) . ')' : $session_condition = ' WHERE g.session_id = 0';
2036
+        $session_id != 0 ? $session_condition = ' WHERE g.session_id IN(1,'.intval($session_id).')' : $session_condition = ' WHERE g.session_id = 0';
2037 2037
 
2038 2038
         if ($in_get_empty_group == 0) {
2039 2039
             // get only groups that are not empty
2040 2040
             $sql = "SELECT DISTINCT g.id, g.name
2041
-                    FROM " . Database::get_course_table(TABLE_GROUP) . " AS g
2042
-                    INNER JOIN " . Database::get_course_table(TABLE_GROUP_USER) . " gu
2041
+                    FROM " . Database::get_course_table(TABLE_GROUP)." AS g
2042
+                    INNER JOIN " . Database::get_course_table(TABLE_GROUP_USER)." gu
2043 2043
                     ON (g.id = gu.group_id AND g.c_id = $course_id AND gu.c_id = $course_id)
2044 2044
                     $session_condition
2045 2045
                     ORDER BY g.name";
2046 2046
         } else {
2047 2047
             // get all groups even if they are empty
2048 2048
             $sql = "SELECT g.id, g.name
2049
-                    FROM " . Database::get_course_table(TABLE_GROUP) . " AS g
2049
+                    FROM " . Database::get_course_table(TABLE_GROUP)." AS g
2050 2050
                     $session_condition
2051 2051
                     AND c_id = $course_id";
2052 2052
         }
@@ -2101,7 +2101,7 @@  discard block
 block discarded – undo
2101 2101
         $table_stats_uploads = Database::get_main_table(TABLE_STATISTIC_TRACK_E_UPLOADS);
2102 2102
 
2103 2103
         $codeFiltered = Database::escape_string($code);
2104
-        $sql = "SELECT * FROM $table_course WHERE code='" . $codeFiltered . "'";
2104
+        $sql = "SELECT * FROM $table_course WHERE code='".$codeFiltered."'";
2105 2105
         $res = Database::query($sql);
2106 2106
 
2107 2107
         if (Database::num_rows($res) == 0) {
@@ -2109,7 +2109,7 @@  discard block
 block discarded – undo
2109 2109
         }
2110 2110
 
2111 2111
         $sql = "SELECT * FROM $table_course
2112
-                WHERE code = '" . $codeFiltered . "'";
2112
+                WHERE code = '".$codeFiltered."'";
2113 2113
         $res = Database::query($sql);
2114 2114
         $course = Database::fetch_array($res);
2115 2115
         $courseId = $course['id'];
@@ -2154,34 +2154,34 @@  discard block
 block discarded – undo
2154 2154
                 }
2155 2155
             }
2156 2156
 
2157
-            $course_dir = api_get_path(SYS_COURSE_PATH) . $course['directory'];
2158
-            $archive_dir = api_get_path(SYS_ARCHIVE_PATH) . $course['directory'] . '_' . time();
2157
+            $course_dir = api_get_path(SYS_COURSE_PATH).$course['directory'];
2158
+            $archive_dir = api_get_path(SYS_ARCHIVE_PATH).$course['directory'].'_'.time();
2159 2159
             if (is_dir($course_dir)) {
2160 2160
                 rename($course_dir, $archive_dir);
2161 2161
             }
2162 2162
 
2163 2163
             // Unsubscribe all users from the course
2164
-            $sql = "DELETE FROM $table_course_user WHERE c_id='" . $courseId . "'";
2164
+            $sql = "DELETE FROM $table_course_user WHERE c_id='".$courseId."'";
2165 2165
             Database::query($sql);
2166 2166
             // Delete the course from the sessions tables
2167
-            $sql = "DELETE FROM $table_session_course WHERE c_id='" . $courseId . "'";
2167
+            $sql = "DELETE FROM $table_session_course WHERE c_id='".$courseId."'";
2168 2168
             Database::query($sql);
2169
-            $sql = "DELETE FROM $table_session_course_user WHERE c_id='" . $courseId . "'";
2169
+            $sql = "DELETE FROM $table_session_course_user WHERE c_id='".$courseId."'";
2170 2170
             Database::query($sql);
2171 2171
 
2172 2172
             // Delete from Course - URL
2173
-            $sql = "DELETE FROM $table_course_rel_url WHERE c_id = '" . $courseId. "'";
2173
+            $sql = "DELETE FROM $table_course_rel_url WHERE c_id = '".$courseId."'";
2174 2174
             Database::query($sql);
2175 2175
 
2176
-            $sql = 'SELECT survey_id FROM ' . $table_course_survey . ' WHERE course_code="' . $codeFiltered . '"';
2176
+            $sql = 'SELECT survey_id FROM '.$table_course_survey.' WHERE course_code="'.$codeFiltered.'"';
2177 2177
             $result_surveys = Database::query($sql);
2178 2178
             while ($surveys = Database::fetch_array($result_surveys)) {
2179 2179
                 $survey_id = $surveys[0];
2180
-                $sql = 'DELETE FROM ' . $table_course_survey_question . ' WHERE survey_id="' . $survey_id . '"';
2180
+                $sql = 'DELETE FROM '.$table_course_survey_question.' WHERE survey_id="'.$survey_id.'"';
2181 2181
                 Database::query($sql);
2182
-                $sql = 'DELETE FROM ' . $table_course_survey_question_option . ' WHERE survey_id="' . $survey_id . '"';
2182
+                $sql = 'DELETE FROM '.$table_course_survey_question_option.' WHERE survey_id="'.$survey_id.'"';
2183 2183
                 Database::query($sql);
2184
-                $sql = 'DELETE FROM ' . $table_course_survey . ' WHERE survey_id="' . $survey_id . '"';
2184
+                $sql = 'DELETE FROM '.$table_course_survey.' WHERE survey_id="'.$survey_id.'"';
2185 2185
                 Database::query($sql);
2186 2186
             }
2187 2187
 
@@ -2214,7 +2214,7 @@  discard block
 block discarded – undo
2214 2214
             Database::query($sql);
2215 2215
 
2216 2216
             // Delete the course from the database
2217
-            $sql = "DELETE FROM $table_course WHERE code = '" . $codeFiltered . "'";
2217
+            $sql = "DELETE FROM $table_course WHERE code = '".$codeFiltered."'";
2218 2218
             Database::query($sql);
2219 2219
 
2220 2220
             // delete extra course fields
@@ -2260,15 +2260,15 @@  discard block
 block discarded – undo
2260 2260
                 while ($row = Database::fetch_array($res_table, 'ASSOC')) {
2261 2261
                     $row_to_save = array();
2262 2262
                     foreach ($row as $key => $value) {
2263
-                        $row_to_save[$key] = $key . "='" . Database::escape_string($row[$key]) . "'";
2263
+                        $row_to_save[$key] = $key."='".Database::escape_string($row[$key])."'";
2264 2264
                     }
2265
-                    $sql_dump .= "\nINSERT INTO $table SET " . implode(', ', $row_to_save) . ';';
2265
+                    $sql_dump .= "\nINSERT INTO $table SET ".implode(', ', $row_to_save).';';
2266 2266
                 }
2267 2267
             }
2268 2268
         }
2269 2269
 
2270
-        if (is_dir(api_get_path(SYS_COURSE_PATH) . $course['directory'])) {
2271
-            $file_name = api_get_path(SYS_COURSE_PATH) . $course['directory'] . '/mysql_dump.sql';
2270
+        if (is_dir(api_get_path(SYS_COURSE_PATH).$course['directory'])) {
2271
+            $file_name = api_get_path(SYS_COURSE_PATH).$course['directory'].'/mysql_dump.sql';
2272 2272
             $handle = fopen($file_name, 'a+');
2273 2273
             if ($handle !== false) {
2274 2274
                 fwrite($handle, $sql_dump);
@@ -2296,13 +2296,13 @@  discard block
 block discarded – undo
2296 2296
         $TABLECOURSE = Database::get_main_table(TABLE_MAIN_COURSE);
2297 2297
         $TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
2298 2298
 
2299
-        $course_title = Database::result(Database::query('SELECT title FROM ' . $TABLECOURSE . ' WHERE code="' . $course_code . '"'),
2299
+        $course_title = Database::result(Database::query('SELECT title FROM '.$TABLECOURSE.' WHERE code="'.$course_code.'"'),
2300 2300
             0, 0);
2301 2301
 
2302 2302
         $sql = 'SELECT course.code as code, course.title as title, cu.sort as sort
2303
-                FROM ' . $TABLECOURSUSER . ' as cu, ' . $TABLECOURSE . ' as course
2304
-                WHERE   course.id = cu.c_id AND user_id = "' . $user_id . '" AND
2305
-                        cu.relation_type<>' . COURSE_RELATION_TYPE_RRHH . ' AND
2303
+                FROM ' . $TABLECOURSUSER.' as cu, '.$TABLECOURSE.' as course
2304
+                WHERE   course.id = cu.c_id AND user_id = "' . $user_id.'" AND
2305
+                        cu.relation_type<>' . COURSE_RELATION_TYPE_RRHH.' AND
2306 2306
                         user_course_cat = 0
2307 2307
                 ORDER BY cu.sort';
2308 2308
         $result = Database::query($sql);
@@ -2321,21 +2321,21 @@  discard block
 block discarded – undo
2321 2321
                     $course_found = true;
2322 2322
                     $course_sort = $courses['sort'];
2323 2323
                     if ($counter == 0) {
2324
-                        $sql = 'UPDATE ' . $TABLECOURSUSER . '
2324
+                        $sql = 'UPDATE '.$TABLECOURSUSER.'
2325 2325
                                 SET sort = sort+1
2326 2326
                                 WHERE
2327
-                                    user_id= "' . $user_id . '" AND
2328
-                                    relation_type<>' . COURSE_RELATION_TYPE_RRHH . '
2327
+                                    user_id= "' . $user_id.'" AND
2328
+                                    relation_type<>' . COURSE_RELATION_TYPE_RRHH.'
2329 2329
                                     AND user_course_cat="0"
2330
-                                    AND sort > "' . $course_sort . '"';
2330
+                                    AND sort > "' . $course_sort.'"';
2331 2331
                         $course_sort++;
2332 2332
                     } else {
2333
-                        $sql = 'UPDATE ' . $TABLECOURSUSER . ' SET sort = sort+1
2333
+                        $sql = 'UPDATE '.$TABLECOURSUSER.' SET sort = sort+1
2334 2334
                                 WHERE
2335
-                                    user_id= "' . $user_id . '" AND
2336
-                                    relation_type<>' . COURSE_RELATION_TYPE_RRHH . ' AND
2335
+                                    user_id= "' . $user_id.'" AND
2336
+                                    relation_type<>' . COURSE_RELATION_TYPE_RRHH.' AND
2337 2337
                                     user_course_cat="0" AND
2338
-                                    sort >= "' . $course_sort . '"';
2338
+                                    sort >= "' . $course_sort.'"';
2339 2339
                     }
2340 2340
                     Database::query($sql);
2341 2341
                     break;
@@ -2348,9 +2348,9 @@  discard block
 block discarded – undo
2348 2348
 
2349 2349
             // We must register the course in the beginning of the list
2350 2350
             if (!$course_found) {
2351
-                $course_sort = Database::result(Database::query('SELECT min(sort) as min_sort FROM ' . $TABLECOURSUSER . ' WHERE user_id="' . $user_id . '" AND user_course_cat="0"'),
2351
+                $course_sort = Database::result(Database::query('SELECT min(sort) as min_sort FROM '.$TABLECOURSUSER.' WHERE user_id="'.$user_id.'" AND user_course_cat="0"'),
2352 2352
                     0, 0);
2353
-                Database::query('UPDATE ' . $TABLECOURSUSER . ' SET sort = sort+1 WHERE user_id= "' . $user_id . '" AND user_course_cat="0"');
2353
+                Database::query('UPDATE '.$TABLECOURSUSER.' SET sort = sort+1 WHERE user_id= "'.$user_id.'" AND user_course_cat="0"');
2354 2354
             }
2355 2355
         }
2356 2356
         return $course_sort;
@@ -2365,11 +2365,11 @@  discard block
 block discarded – undo
2365 2365
     public static function course_exists($course_code, $accept_virtual = false)
2366 2366
     {
2367 2367
         if ($accept_virtual === true) {
2368
-            $sql = 'SELECT 1 FROM ' . Database::get_main_table(TABLE_MAIN_COURSE) . '
2369
-                    WHERE code="' . Database::escape_string($course_code) . '" OR visual_code="' . Database::escape_string($course_code) . '"';
2368
+            $sql = 'SELECT 1 FROM '.Database::get_main_table(TABLE_MAIN_COURSE).'
2369
+                    WHERE code="' . Database::escape_string($course_code).'" OR visual_code="'.Database::escape_string($course_code).'"';
2370 2370
         } else {
2371
-            $sql = 'SELECT 1 FROM ' . Database::get_main_table(TABLE_MAIN_COURSE) . '
2372
-                    WHERE code="' . Database::escape_string($course_code) . '"';
2371
+            $sql = 'SELECT 1 FROM '.Database::get_main_table(TABLE_MAIN_COURSE).'
2372
+                    WHERE code="' . Database::escape_string($course_code).'"';
2373 2373
         }
2374 2374
 
2375 2375
         return Database::num_rows(Database::query($sql));
@@ -2395,7 +2395,7 @@  discard block
 block discarded – undo
2395 2395
         $student = api_get_user_info($user_id);
2396 2396
 
2397 2397
         $name_course = $information['title'];
2398
-        $sql = "SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " WHERE c_id ='" . $courseId . "'";
2398
+        $sql = "SELECT * FROM ".Database::get_main_table(TABLE_MAIN_COURSE_USER)." WHERE c_id ='".$courseId."'";
2399 2399
 
2400 2400
         // TODO: Ivan: This is a mistake, please, have a look at it. Intention here is diffcult to be guessed.
2401 2401
         //if ($send_to_tutor_also = true)
@@ -2410,18 +2410,18 @@  discard block
 block discarded – undo
2410 2410
         while ($row = Database::fetch_array($result)) {
2411 2411
             $tutor = api_get_user_info($row['user_id']);
2412 2412
             $emailto = $tutor['email'];
2413
-            $emailsubject = get_lang('NewUserInTheCourse') . ': ' . $name_course;
2414
-            $emailbody = get_lang('Dear') . ': ' . api_get_person_name($tutor['firstname'], $tutor['lastname']) . "\n";
2415
-            $emailbody .= get_lang('MessageNewUserInTheCourse') . ': ' . $name_course . "\n";
2416
-            $emailbody .= get_lang('UserName') . ': ' . $student['username'] . "\n";
2413
+            $emailsubject = get_lang('NewUserInTheCourse').': '.$name_course;
2414
+            $emailbody = get_lang('Dear').': '.api_get_person_name($tutor['firstname'], $tutor['lastname'])."\n";
2415
+            $emailbody .= get_lang('MessageNewUserInTheCourse').': '.$name_course."\n";
2416
+            $emailbody .= get_lang('UserName').': '.$student['username']."\n";
2417 2417
             if (api_is_western_name_order()) {
2418
-                $emailbody .= get_lang('FirstName') . ': ' . $student['firstname'] . "\n";
2419
-                $emailbody .= get_lang('LastName') . ': ' . $student['lastname'] . "\n";
2418
+                $emailbody .= get_lang('FirstName').': '.$student['firstname']."\n";
2419
+                $emailbody .= get_lang('LastName').': '.$student['lastname']."\n";
2420 2420
             } else {
2421
-                $emailbody .= get_lang('LastName') . ': ' . $student['lastname'] . "\n";
2422
-                $emailbody .= get_lang('FirstName') . ': ' . $student['firstname'] . "\n";
2421
+                $emailbody .= get_lang('LastName').': '.$student['lastname']."\n";
2422
+                $emailbody .= get_lang('FirstName').': '.$student['firstname']."\n";
2423 2423
             }
2424
-            $emailbody .= get_lang('Email') . ': <a href="mailto:' . $student['email'] . '">' . $student['email'] ."</a>\n\n";
2424
+            $emailbody .= get_lang('Email').': <a href="mailto:'.$student['email'].'">'.$student['email']."</a>\n\n";
2425 2425
             $recipient_name = api_get_person_name($tutor['firstname'], $tutor['lastname'], null,
2426 2426
                 PERSON_NAME_EMAIL_ADDRESS);
2427 2427
             $sender_name = api_get_person_name(api_get_setting('administratorName'),
@@ -2523,9 +2523,9 @@  discard block
 block discarded – undo
2523 2523
 
2524 2524
             $with_special_courses = $without_special_courses = '';
2525 2525
             if (!empty($special_course_list)) {
2526
-                $sc_string = '"' . implode('","', $special_course_list) . '"';
2527
-                $with_special_courses = ' course.code IN (' . $sc_string . ')';
2528
-                $without_special_courses = ' AND course.code NOT IN (' . $sc_string . ')';
2526
+                $sc_string = '"'.implode('","', $special_course_list).'"';
2527
+                $with_special_courses = ' course.code IN ('.$sc_string.')';
2528
+                $without_special_courses = ' AND course.code NOT IN ('.$sc_string.')';
2529 2529
             }
2530 2530
 
2531 2531
             if (!empty($with_special_courses)) {
@@ -2569,8 +2569,8 @@  discard block
 block discarded – undo
2569 2569
 
2570 2570
         if ($include_sessions === true) {
2571 2571
             $sql = "SELECT DISTINCT(c.code), c.id as real_id
2572
-                    FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . " s,
2573
-                    " . Database::get_main_table(TABLE_MAIN_COURSE) . " c
2572
+                    FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)." s,
2573
+                    " . Database::get_main_table(TABLE_MAIN_COURSE)." c
2574 2574
                     WHERE user_id = $user_id AND s.c_id = c.id";
2575 2575
             $r = Database::query($sql);
2576 2576
             while ($row = Database::fetch_array($r, 'ASSOC')) {
@@ -2591,7 +2591,7 @@  discard block
 block discarded – undo
2591 2591
     public static function get_course_id_from_path($path)
2592 2592
     {
2593 2593
         $path = Database::escape_string(str_replace('.', '', str_replace('/', '', $path)));
2594
-        $res = Database::query("SELECT code FROM " . Database::get_main_table(TABLE_MAIN_COURSE) . "
2594
+        $res = Database::query("SELECT code FROM ".Database::get_main_table(TABLE_MAIN_COURSE)."
2595 2595
                 WHERE directory LIKE BINARY '$path'");
2596 2596
         if ($res === false) {
2597 2597
             return false;
@@ -2613,8 +2613,8 @@  discard block
 block discarded – undo
2613 2613
     public static function get_courses_info_from_visual_code($code)
2614 2614
     {
2615 2615
         $result = array();
2616
-        $sql_result = Database::query("SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE) . "
2617
-                WHERE visual_code = '" . Database::escape_string($code) . "'");
2616
+        $sql_result = Database::query("SELECT * FROM ".Database::get_main_table(TABLE_MAIN_COURSE)."
2617
+                WHERE visual_code = '" . Database::escape_string($code)."'");
2618 2618
         while ($virtual_course = Database::fetch_array($sql_result)) {
2619 2619
             $result[] = $virtual_course;
2620 2620
         }
@@ -2630,10 +2630,10 @@  discard block
 block discarded – undo
2630 2630
     public static function get_emails_of_tutors_to_course($courseId)
2631 2631
     {
2632 2632
         $list = array();
2633
-        $res = Database::query("SELECT user_id FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . "
2634
-                WHERE c_id ='" . intval($courseId) . "' AND status=1");
2633
+        $res = Database::query("SELECT user_id FROM ".Database::get_main_table(TABLE_MAIN_COURSE_USER)."
2634
+                WHERE c_id ='" . intval($courseId)."' AND status=1");
2635 2635
         while ($list_users = Database::fetch_array($res)) {
2636
-            $result = Database::query("SELECT * FROM " . Database::get_main_table(TABLE_MAIN_USER) . "
2636
+            $result = Database::query("SELECT * FROM ".Database::get_main_table(TABLE_MAIN_USER)."
2637 2637
                     WHERE user_id=" . $list_users['user_id']);
2638 2638
             while ($row_user = Database::fetch_array($result)) {
2639 2639
                 $name_teacher = api_get_person_name($row_user['firstname'], $row_user['lastname']);
@@ -2676,7 +2676,7 @@  discard block
 block discarded – undo
2676 2676
             }
2677 2677
 
2678 2678
             $sql = "SELECT firstname, lastname, email FROM $tbl_user
2679
-                    WHERE user_id IN (" . implode(",", $user_ids) . ")";
2679
+                    WHERE user_id IN (".implode(",", $user_ids).")";
2680 2680
             $rs_user = Database::query($sql);
2681 2681
 
2682 2682
             while ($row_emails = Database::fetch_array($rs_user)) {
@@ -2722,9 +2722,9 @@  discard block
 block discarded – undo
2722 2722
      */
2723 2723
     public static function update_attribute($id, $name, $value)
2724 2724
     {
2725
-        $id = (int)$id;
2725
+        $id = (int) $id;
2726 2726
         $table = Database::get_main_table(TABLE_MAIN_COURSE);
2727
-        $sql = "UPDATE $table SET $name = '" . Database::escape_string($value) . "'
2727
+        $sql = "UPDATE $table SET $name = '".Database::escape_string($value)."'
2728 2728
                 WHERE id = '$id';";
2729 2729
         return Database::query($sql);
2730 2730
     }
@@ -2739,7 +2739,7 @@  discard block
 block discarded – undo
2739 2739
      */
2740 2740
     public static function update_attributes($id, $attributes)
2741 2741
     {
2742
-        $id = (int)$id;
2742
+        $id = (int) $id;
2743 2743
         $table = Database::get_main_table(TABLE_MAIN_COURSE);
2744 2744
         $sql = "UPDATE $table SET ";
2745 2745
         $i = 0;
@@ -2748,7 +2748,7 @@  discard block
 block discarded – undo
2748 2748
                 if ($i > 0) {
2749 2749
                     $sql .= ", ";
2750 2750
                 }
2751
-                $sql .= " $name = '" . Database::escape_string($value) . "'";
2751
+                $sql .= " $name = '".Database::escape_string($value)."'";
2752 2752
                 $i++;
2753 2753
             }
2754 2754
         }
@@ -2785,9 +2785,9 @@  discard block
 block discarded – undo
2785 2785
     {
2786 2786
         return Database::result(
2787 2787
             Database::query('SELECT  sc.id session_category
2788
-                FROM ' . Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY) . ' sc
2789
-                INNER JOIN ' . Database::get_main_table(TABLE_MAIN_SESSION) . ' s
2790
-                ON sc.id=s.session_category_id WHERE s.id="' . Database::escape_string($session_id) . '"'),
2788
+                FROM ' . Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY).' sc
2789
+                INNER JOIN ' . Database::get_main_table(TABLE_MAIN_SESSION).' s
2790
+                ON sc.id=s.session_category_id WHERE s.id="' . Database::escape_string($session_id).'"'),
2791 2791
             0,
2792 2792
             'session_category'
2793 2793
         );
@@ -2830,13 +2830,13 @@  discard block
 block discarded – undo
2830 2830
                 $data .= '<div class="sectiontitle">';
2831 2831
                 if (api_is_allowed_to_edit() && $action_show) {
2832 2832
                     //delete
2833
-                    $data .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=delete&description_id=' . $description->id . '" onclick="javascript:if(!confirm(\'' . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),
2834
-                                ENT_QUOTES, $charset)) . '\')) return false;">';
2833
+                    $data .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete&description_id='.$description->id.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),
2834
+                                ENT_QUOTES, $charset)).'\')) return false;">';
2835 2835
                     $data .= Display::return_icon('delete.gif', get_lang('Delete'),
2836 2836
                         array('style' => 'vertical-align:middle;float:right;'));
2837 2837
                     $data .= '</a> ';
2838 2838
                     //edit
2839
-                    $data .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&description_id=' . $description->id . '">';
2839
+                    $data .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&description_id='.$description->id.'">';
2840 2840
                     $data .= Display::return_icon('edit.png', get_lang('Edit'),
2841 2841
                         array('style' => 'vertical-align:middle;float:right; padding-right:4px;'), ICON_SIZE_SMALL);
2842 2842
                     $data .= '</a> ';
@@ -2848,7 +2848,7 @@  discard block
 block discarded – undo
2848 2848
                 $data .= '</div>';
2849 2849
             }
2850 2850
         } else {
2851
-            $data .= '<em>' . get_lang('ThisCourseDescriptionIsEmpty') . '</em>';
2851
+            $data .= '<em>'.get_lang('ThisCourseDescriptionIsEmpty').'</em>';
2852 2852
         }
2853 2853
 
2854 2854
         return $data;
@@ -2915,11 +2915,11 @@  discard block
 block discarded – undo
2915 2915
                     ON (a.c_id = s.c_id)
2916 2916
                     WHERE
2917 2917
                         user_id = $hr_manager_id AND
2918
-                        relation_type=" . COURSE_RELATION_TYPE_RRHH . " AND
2919
-                        access_url_id = " . api_get_current_access_url_id() . "";
2918
+                        relation_type=".COURSE_RELATION_TYPE_RRHH." AND
2919
+                        access_url_id = " . api_get_current_access_url_id()."";
2920 2920
         } else {
2921 2921
             $sql = "SELECT c_id FROM $tbl_course_rel_user
2922
-                    WHERE user_id = $hr_manager_id AND relation_type=" . COURSE_RELATION_TYPE_RRHH . " ";
2922
+                    WHERE user_id = $hr_manager_id AND relation_type=".COURSE_RELATION_TYPE_RRHH." ";
2923 2923
         }
2924 2924
         $result = Database::query($sql);
2925 2925
         if (Database::num_rows($result) > 0) {
@@ -2928,7 +2928,7 @@  discard block
 block discarded – undo
2928 2928
                         WHERE
2929 2929
                             c_id = '{$row['c_id']}' AND
2930 2930
                             user_id = $hr_manager_id AND
2931
-                            relation_type=" . COURSE_RELATION_TYPE_RRHH . " ";
2931
+                            relation_type=".COURSE_RELATION_TYPE_RRHH." ";
2932 2932
                 Database::query($sql);
2933 2933
             }
2934 2934
         }
@@ -2939,7 +2939,7 @@  discard block
 block discarded – undo
2939 2939
                 $courseInfo = api_get_course_info($course_code);
2940 2940
                 $courseId = $courseInfo['real_id'];
2941 2941
                 $sql = "INSERT IGNORE INTO $tbl_course_rel_user(c_id, user_id, status, relation_type)
2942
-                        VALUES($courseId, $hr_manager_id, '" . DRH . "', '" . COURSE_RELATION_TYPE_RRHH . "')";
2942
+                        VALUES($courseId, $hr_manager_id, '".DRH."', '".COURSE_RELATION_TYPE_RRHH."')";
2943 2943
                 $result = Database::query($sql);
2944 2944
                 if (Database::affected_rows($result)) {
2945 2945
                     $affected_rows++;
@@ -3022,16 +3022,16 @@  discard block
 block discarded – undo
3022 3022
             case COURSEMANAGER:
3023 3023
                 $whereConditions .= " AND cru.user_id = '$user_id'";
3024 3024
                 if (!$showAllAssignedCourses) {
3025
-                    $whereConditions .= " AND status = " . COURSEMANAGER;
3025
+                    $whereConditions .= " AND status = ".COURSEMANAGER;
3026 3026
                 } else {
3027
-                    $whereConditions .= " AND relation_type = " . COURSE_RELATION_TYPE_COURSE_MANAGER;
3027
+                    $whereConditions .= " AND relation_type = ".COURSE_RELATION_TYPE_COURSE_MANAGER;
3028 3028
                 }
3029 3029
                 break;
3030 3030
             case DRH:
3031 3031
                 $whereConditions .= " AND
3032 3032
                     cru.user_id = '$user_id' AND
3033
-                    status = " . DRH . " AND
3034
-                    relation_type = '" . COURSE_RELATION_TYPE_RRHH . "'
3033
+                    status = ".DRH." AND
3034
+                    relation_type = '" . COURSE_RELATION_TYPE_RRHH."'
3035 3035
                 ";
3036 3036
                 break;
3037 3037
         }
@@ -3052,7 +3052,7 @@  discard block
 block discarded – undo
3052 3052
                 );
3053 3053
                 if (!empty($courseList)) {
3054 3054
                     $courseListToString = implode("','", array_keys($courseList));
3055
-                    $whereConditions .= " AND c.id IN ('" . $courseListToString . "')";
3055
+                    $whereConditions .= " AND c.id IN ('".$courseListToString."')";
3056 3056
                 }
3057 3057
                 $tableSessionRelCourse = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
3058 3058
                 $orderBy = ' ORDER BY position';
@@ -3068,7 +3068,7 @@  discard block
 block discarded – undo
3068 3068
                     INNER JOIN $tbl_course_rel_access_url a ON (a.c_id = c.id)
3069 3069
                     $extraInnerJoin
3070 3070
                 WHERE
3071
-                    access_url_id = " . api_get_current_access_url_id() . "
3071
+                    access_url_id = ".api_get_current_access_url_id()."
3072 3072
                     $whereConditions
3073 3073
                 $orderBy
3074 3074
                 ";
@@ -3128,10 +3128,10 @@  discard block
 block discarded – undo
3128 3128
     {
3129 3129
         $course_info = api_get_course_info($course_code);
3130 3130
         // course path
3131
-        $store_path = api_get_path(SYS_COURSE_PATH) . $course_info['path'];
3131
+        $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path'];
3132 3132
         // image name for courses
3133
-        $course_image = $store_path . '/course-pic.png';
3134
-        $course_medium_image = $store_path . '/course-pic85x85.png';
3133
+        $course_image = $store_path.'/course-pic.png';
3134
+        $course_medium_image = $store_path.'/course-pic85x85.png';
3135 3135
 
3136 3136
         if (file_exists($course_image)) {
3137 3137
             unlink($course_image);
@@ -3165,11 +3165,11 @@  discard block
 block discarded – undo
3165 3165
     {
3166 3166
         $course_info = api_get_course_info($courseCode);
3167 3167
         // course path
3168
-        $storePath = api_get_path(SYS_COURSE_PATH) . $course_info['path'];
3168
+        $storePath = api_get_path(SYS_COURSE_PATH).$course_info['path'];
3169 3169
         // image name for courses
3170
-        $courseImage = $storePath . '/course-pic.png';
3171
-        $courseMediumImage = $storePath . '/course-pic85x85.png';
3172
-        $courseSmallImage = $storePath . '/course-pic32.png';
3170
+        $courseImage = $storePath.'/course-pic.png';
3171
+        $courseMediumImage = $storePath.'/course-pic85x85.png';
3172
+        $courseSmallImage = $storePath.'/course-pic32.png';
3173 3173
 
3174 3174
         if (file_exists($courseImage)) {
3175 3175
             unlink($courseImage);
@@ -3197,26 +3197,26 @@  discard block
 block discarded – undo
3197 3197
 
3198 3198
         $notifications = isset($params['notifications']) ? $params['notifications'] : null;
3199 3199
 
3200
-        $html .= '<h3>' . $params['title'] . $notifications . '</h3> ';
3200
+        $html .= '<h3>'.$params['title'].$notifications.'</h3> ';
3201 3201
 
3202 3202
         if (isset($params['description'])) {
3203
-            $html .= '<p>' . $params['description'] . '</p>';
3203
+            $html .= '<p>'.$params['description'].'</p>';
3204 3204
         }
3205 3205
         if (!empty($params['subtitle'])) {
3206
-            $html .= '<small>' . $params['subtitle'] . '</small>';
3206
+            $html .= '<small>'.$params['subtitle'].'</small>';
3207 3207
         }
3208 3208
         if (!empty($params['teachers'])) {
3209
-            $html .= '<h5 class="teacher">' . Display::return_icon('teacher.png', get_lang('Teacher'), array(),
3210
-                    ICON_SIZE_TINY) . $params['teachers'] . '</h5>';
3209
+            $html .= '<h5 class="teacher">'.Display::return_icon('teacher.png', get_lang('Teacher'), array(),
3210
+                    ICON_SIZE_TINY).$params['teachers'].'</h5>';
3211 3211
         }
3212 3212
         if (!empty($params['coaches'])) {
3213
-            $html .= '<h5 class="teacher">' . Display::return_icon('teacher.png', get_lang('Coach'), array(),
3214
-                    ICON_SIZE_TINY) . $params['coaches'] . '</h5>';
3213
+            $html .= '<h5 class="teacher">'.Display::return_icon('teacher.png', get_lang('Coach'), array(),
3214
+                    ICON_SIZE_TINY).$params['coaches'].'</h5>';
3215 3215
         }
3216 3216
 
3217 3217
         $html .= '</div>';
3218 3218
         $params['right_actions'] = isset($params['right_actions']) ? $params['right_actions'] : null;
3219
-        $html .= '<div class="pull-right course-box-actions">' . $params['right_actions'] . '</div>';
3219
+        $html .= '<div class="pull-right course-box-actions">'.$params['right_actions'].'</div>';
3220 3220
         $html .= '</div>';
3221 3221
         $html .= '</div>';
3222 3222
         return $html;
@@ -3232,11 +3232,11 @@  discard block
 block discarded – undo
3232 3232
         $html = '';
3233 3233
         $html .= '<div class="row">';
3234 3234
         $html .= '<div class="col-md-2">';
3235
-        if (!empty($params['link'])){
3235
+        if (!empty($params['link'])) {
3236 3236
             $html .= '<a class="thumbnail" href="'.$params['link'].'">';
3237 3237
             $html .= $params['icon'];
3238 3238
             $html .= '</a>';
3239
-        }else{
3239
+        } else {
3240 3240
             $html .= $params['icon'];
3241 3241
         }
3242 3242
         $html .= '</div>';
@@ -3263,13 +3263,13 @@  discard block
 block discarded – undo
3263 3263
         if ($is_sub_content) {
3264 3264
             $class = "course_item";
3265 3265
         }
3266
-        $html .= '<div class="' . $class . '">';
3266
+        $html .= '<div class="'.$class.'">';
3267 3267
         $html .= '<div class="panel-body">';
3268 3268
         $html .= '<div class="course-items">';
3269 3269
         $html .= ' <div class="row">';
3270 3270
         $html .= '<div class="col-md-2">';
3271 3271
         if (!empty($params['link'])) {
3272
-            $html .= '<a class="thumbnail" href="' . $params['link'] . '">';
3272
+            $html .= '<a class="thumbnail" href="'.$params['link'].'">';
3273 3273
             $html .= $params['icon'];
3274 3274
             $html .= '</a>';
3275 3275
         } else {
@@ -3282,25 +3282,25 @@  discard block
 block discarded – undo
3282 3282
         $param_class = isset($params['class']) ? $params['class'] : '';
3283 3283
         $params['right_actions'] = isset($params['right_actions']) ? $params['right_actions'] : '';
3284 3284
 
3285
-        $html .= '<div class="col-md-10 ' . $param_class . '">';
3286
-        $html .= '<div class="pull-right">' . $params['right_actions'] . '</div>';
3287
-        $html .= '<h4 class="course-items-title">' . $params['title'] . $notifications . '</h4> ';
3285
+        $html .= '<div class="col-md-10 '.$param_class.'">';
3286
+        $html .= '<div class="pull-right">'.$params['right_actions'].'</div>';
3287
+        $html .= '<h4 class="course-items-title">'.$params['title'].$notifications.'</h4> ';
3288 3288
 
3289 3289
         if (isset($params['show_description'], $params['description']) && $params['show_description'] == 1) {
3290
-            $html .= '<p class="description-session">' . $params['description'] . '</p>';
3290
+            $html .= '<p class="description-session">'.$params['description'].'</p>';
3291 3291
         }
3292 3292
         if (!empty($params['subtitle'])) {
3293
-            $html .= '<div class="subtitle-session">' . $params['subtitle'] . '</div>';
3293
+            $html .= '<div class="subtitle-session">'.$params['subtitle'].'</div>';
3294 3294
         }
3295 3295
         if (!empty($params['teachers'])) {
3296
-            $html .= '<h5 class="course-items-session">' .
3297
-                    Display::return_icon('teacher.png', get_lang('Teacher'), array(), ICON_SIZE_TINY) .
3298
-                $params['teachers'] . '</h5>';
3296
+            $html .= '<h5 class="course-items-session">'.
3297
+                    Display::return_icon('teacher.png', get_lang('Teacher'), array(), ICON_SIZE_TINY).
3298
+                $params['teachers'].'</h5>';
3299 3299
         }
3300 3300
         if (!empty($params['coaches'])) {
3301
-            $html .= '<h5 class="course-items-session">' .
3302
-                Display::return_icon('teacher.png', get_lang('Coach'), array(), ICON_SIZE_TINY) .
3303
-                $params['coaches'] . '</h5>';
3301
+            $html .= '<h5 class="course-items-session">'.
3302
+                Display::return_icon('teacher.png', get_lang('Coach'), array(), ICON_SIZE_TINY).
3303
+                $params['coaches'].'</h5>';
3304 3304
         }
3305 3305
 
3306 3306
         $html .= '</div>';
@@ -3321,7 +3321,7 @@  discard block
 block discarded – undo
3321 3321
      */
3322 3322
     public static function course_item_parent($main_content, $sub_content, $sub_sub_content = null)
3323 3323
     {
3324
-        return '<div class="panel panel-default">' . $main_content . $sub_content . $sub_sub_content . '</div>';
3324
+        return '<div class="panel panel-default">'.$main_content.$sub_content.$sub_sub_content.'</div>';
3325 3325
     }
3326 3326
 
3327 3327
     /**
@@ -3343,7 +3343,7 @@  discard block
 block discarded – undo
3343 3343
 
3344 3344
         $with_special_courses = $without_special_courses = '';
3345 3345
         if (!empty($special_course_list)) {
3346
-            $with_special_courses = ' course.code IN ("' . implode('","', $special_course_list) . '")';
3346
+            $with_special_courses = ' course.code IN ("'.implode('","', $special_course_list).'")';
3347 3347
         }
3348 3348
         $html = null;
3349 3349
         $courseCount = 0;
@@ -3394,14 +3394,14 @@  discard block
 block discarded – undo
3394 3394
                     $params['right_actions'] = '';
3395 3395
                     if (api_is_platform_admin()) {
3396 3396
                         if ($load_dirs) {
3397
-                            $params['right_actions'] .= '<a id="document_preview_' . $course['id'] . '_0" class="document_preview" href="javascript:void(0);">' .
3397
+                            $params['right_actions'] .= '<a id="document_preview_'.$course['id'].'_0" class="document_preview" href="javascript:void(0);">'.
3398 3398
                                 Display::return_icon(
3399 3399
                                     'folder.png',
3400 3400
                                     get_lang('Documents'),
3401 3401
                                     array('align' => 'absmiddle'),
3402 3402
                                     ICON_SIZE_SMALL
3403 3403
                                 ).'</a>';
3404
-                            $params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' .
3404
+                            $params['right_actions'] .= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.
3405 3405
                                 Display::return_icon(
3406 3406
                                     'edit.png',
3407 3407
                                     get_lang('Edit'),
@@ -3409,13 +3409,13 @@  discard block
 block discarded – undo
3409 3409
                                     ICON_SIZE_SMALL
3410 3410
                                 ).'</a>';
3411 3411
                             $params['right_actions'] .= Display::div('', array(
3412
-                                    'id' => 'document_result_' . $course['id'] . '_0',
3412
+                                    'id' => 'document_result_'.$course['id'].'_0',
3413 3413
                                     'class' => 'document_preview_container'
3414 3414
                                 ));
3415 3415
                         } else {
3416
-                            $params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' .
3416
+                            $params['right_actions'] .= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.
3417 3417
                                 Display::return_icon('edit.png',
3418
-                                    get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
3418
+                                    get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>';
3419 3419
                         }
3420 3420
                         if ($course['status'] == COURSEMANAGER) {
3421 3421
                             //echo Display::return_icon('teachers.gif', get_lang('Status').': '.get_lang('Teacher'), array('style'=>'width: 11px; height: 11px;'));
@@ -3423,7 +3423,7 @@  discard block
 block discarded – undo
3423 3423
                     } else {
3424 3424
                         if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) {
3425 3425
                             if ($load_dirs) {
3426
-                                $params['right_actions'] .= '<a id="document_preview_' . $course['id'] . '_0" class="document_preview" href="javascript:void(0);">' .
3426
+                                $params['right_actions'] .= '<a id="document_preview_'.$course['id'].'_0" class="document_preview" href="javascript:void(0);">'.
3427 3427
                                     Display::return_icon(
3428 3428
                                         'folder.png',
3429 3429
                                         get_lang('Documents'),
@@ -3431,7 +3431,7 @@  discard block
 block discarded – undo
3431 3431
                                         ICON_SIZE_SMALL
3432 3432
                                     ).'</a>';
3433 3433
                                 $params['right_actions'] .= Display::div('', array(
3434
-                                        'id' => 'document_result_' . $course['id'] . '_0',
3434
+                                        'id' => 'document_result_'.$course['id'].'_0',
3435 3435
                                         'class' => 'document_preview_container'
3436 3436
                                     ));
3437 3437
                             }
@@ -3439,14 +3439,14 @@  discard block
 block discarded – undo
3439 3439
                     }
3440 3440
 
3441 3441
                     if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED || $course['status'] == COURSEMANAGER) {
3442
-                        $course_title = '<a href="' . $course_info['course_public_url'] . '?id_session=0&autoreg=1">' . $course_info['title'] . '</a>';
3442
+                        $course_title = '<a href="'.$course_info['course_public_url'].'?id_session=0&autoreg=1">'.$course_info['title'].'</a>';
3443 3443
                     } else {
3444
-                        $course_title = $course_info['title'] . " " . Display::tag('span', get_lang('CourseClosed'),
3444
+                        $course_title = $course_info['title']." ".Display::tag('span', get_lang('CourseClosed'),
3445 3445
                                 array('class' => 'item_closed'));
3446 3446
                     }
3447 3447
 
3448 3448
                     if (api_get_setting('display_coursecode_in_courselist') == 'true') {
3449
-                        $course_title .= ' (' . $course_info['visual_code'] . ') ';
3449
+                        $course_title .= ' ('.$course_info['visual_code'].') ';
3450 3450
                     }
3451 3451
                     if (api_get_setting('display_teacher_in_courselist') == 'true') {
3452 3452
                         $params['teachers'] = CourseManager::get_teacher_list_from_course_code_to_string(
@@ -3495,7 +3495,7 @@  discard block
 block discarded – undo
3495 3495
         // Step 1: We get all the categories of the user
3496 3496
         $table = Database::get_main_table(TABLE_USER_COURSE_CATEGORY);
3497 3497
         $sql = "SELECT id, title FROM $table
3498
-                WHERE user_id = '" . $user_id . "'
3498
+                WHERE user_id = '".$user_id."'
3499 3499
                 ORDER BY sort ASC";
3500 3500
         $result = Database::query($sql);
3501 3501
         $html = null;
@@ -3556,7 +3556,7 @@  discard block
 block discarded – undo
3556 3556
 
3557 3557
         $without_special_courses = '';
3558 3558
         if (!empty($special_course_list)) {
3559
-            $without_special_courses = ' AND course.code NOT IN ("' . implode('","', $special_course_list) . '")';
3559
+            $without_special_courses = ' AND course.code NOT IN ("'.implode('","', $special_course_list).'")';
3560 3560
         }
3561 3561
 
3562 3562
         //AND course_rel_user.relation_type<>".COURSE_RELATION_TYPE_RRHH."
@@ -3575,14 +3575,14 @@  discard block
 block discarded – undo
3575 3575
                 WHERE
3576 3576
                     course.id = course_rel_user.c_id AND
3577 3577
                     url.c_id = course.id AND
3578
-                    course_rel_user.user_id = '" . $user_id . "' AND
3579
-                    course_rel_user.user_course_cat = '" . $user_category_id . "'
3578
+                    course_rel_user.user_id = '".$user_id."' AND
3579
+                    course_rel_user.user_course_cat = '" . $user_category_id."'
3580 3580
                     $without_special_courses ";
3581 3581
 
3582 3582
         // If multiple URL access mode is enabled, only fetch courses
3583 3583
         // corresponding to the current URL.
3584 3584
         if (api_get_multiple_access_url() && $current_url_id != -1) {
3585
-            $sql .= " AND url.c_id = course.id AND access_url_id='" . $current_url_id . "'";
3585
+            $sql .= " AND url.c_id = course.id AND access_url_id='".$current_url_id."'";
3586 3586
         }
3587 3587
         // Use user's classification for courses (if any).
3588 3588
         $sql .= " ORDER BY course_rel_user.user_course_cat, course_rel_user.sort ASC";
@@ -3638,17 +3638,17 @@  discard block
 block discarded – undo
3638 3638
 
3639 3639
             if (api_is_platform_admin()) {
3640 3640
                 if ($load_dirs) {
3641
-                    $params['right_actions'] .= '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview" href="javascript:void(0);">' . Display::return_icon('folder.png',
3642
-                            get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
3643
-                    $params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' . Display::return_icon('edit.png',
3644
-                            get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
3641
+                    $params['right_actions'] .= '<a id="document_preview_'.$course_info['real_id'].'_0" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png',
3642
+                            get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>';
3643
+                    $params['right_actions'] .= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png',
3644
+                            get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>';
3645 3645
                     $params['right_actions'] .= Display::div('', array(
3646
-                            'id' => 'document_result_' . $course_info['real_id'] . '_0',
3646
+                            'id' => 'document_result_'.$course_info['real_id'].'_0',
3647 3647
                             'class' => 'document_preview_container'
3648 3648
                         ));
3649 3649
                 } else {
3650
-                    $params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' . Display::return_icon('edit.png',
3651
-                            get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
3650
+                    $params['right_actions'] .= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png',
3651
+                            get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>';
3652 3652
                 }
3653 3653
 
3654 3654
                 if ($course_info['status'] == COURSEMANAGER) {
@@ -3657,16 +3657,16 @@  discard block
 block discarded – undo
3657 3657
             } else {
3658 3658
                 if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) {
3659 3659
                     if ($load_dirs) {
3660
-                        $params['right_actions'] .= '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview" href="javascript:void(0);">' . Display::return_icon('folder.png',
3661
-                                get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
3660
+                        $params['right_actions'] .= '<a id="document_preview_'.$course_info['real_id'].'_0" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png',
3661
+                                get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>';
3662 3662
                         $params['right_actions'] .= Display::div('', array(
3663
-                                'id' => 'document_result_' . $course_info['real_id'] . '_0',
3663
+                                'id' => 'document_result_'.$course_info['real_id'].'_0',
3664 3664
                                 'class' => 'document_preview_container'
3665 3665
                             ));
3666 3666
                     } else {
3667 3667
                         if ($course_info['status'] == COURSEMANAGER) {
3668
-                            $params['right_actions'] .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code'] . '">' . Display::return_icon('edit.png',
3669
-                                    get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>';
3668
+                            $params['right_actions'] .= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png',
3669
+                                    get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>';
3670 3670
                         }
3671 3671
                     }
3672 3672
                 }
@@ -3674,16 +3674,16 @@  discard block
 block discarded – undo
3674 3674
 
3675 3675
             $course_title_url = '';
3676 3676
             if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED || $course['status'] == COURSEMANAGER) {
3677
-                $course_title_url = api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/index.php?id_session=0';
3677
+                $course_title_url = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/index.php?id_session=0';
3678 3678
                 $course_title = Display::url($course_info['title'], $course_title_url);
3679 3679
             } else {
3680
-                $course_title = $course_info['title'] . " " . Display::tag('span', get_lang('CourseClosed'),
3680
+                $course_title = $course_info['title']." ".Display::tag('span', get_lang('CourseClosed'),
3681 3681
                         array('class' => 'item_closed'));
3682 3682
             }
3683 3683
 
3684 3684
             // Start displaying the course block itself
3685 3685
             if (api_get_setting('display_coursecode_in_courselist') == 'true') {
3686
-                $course_title .= ' (' . $course_info['visual_code'] . ') ';
3686
+                $course_title .= ' ('.$course_info['visual_code'].') ';
3687 3687
             }
3688 3688
 
3689 3689
             if (api_get_setting('display_teacher_in_courselist') == 'true') {
@@ -3896,14 +3896,14 @@  discard block
 block discarded – undo
3896 3896
                 }
3897 3897
 
3898 3898
                 if ($user_in_course_status == COURSEMANAGER || $sessionCourseAvailable) {
3899
-                    $session_url = $course_info['course_public_url'] . '?id_session=' . $course_info['id_session'];
3900
-                    $session_title = '<h4><a href="' . $session_url. '">'. $course_info['name'] . '</a>'.$notifications.'</h4>';
3899
+                    $session_url = $course_info['course_public_url'].'?id_session='.$course_info['id_session'];
3900
+                    $session_title = '<h4><a href="'.$session_url.'">'.$course_info['name'].'</a>'.$notifications.'</h4>';
3901 3901
                 } else {
3902 3902
                     $session_title = $course_info['name'];
3903 3903
                 }
3904 3904
 
3905 3905
             } else {
3906
-                $session_title = $course_info['name'] . ' ' . Display::tag('span', get_lang('CourseClosed'),
3906
+                $session_title = $course_info['name'].' '.Display::tag('span', get_lang('CourseClosed'),
3907 3907
                         array('class' => 'item_closed'));
3908 3908
             }
3909 3909
         } else {
@@ -3928,21 +3928,21 @@  discard block
 block discarded – undo
3928 3928
             $course_visibility != COURSE_VISIBILITY_HIDDEN
3929 3929
         ) {
3930 3930
             if ($load_dirs) {
3931
-                $params['right_actions'] .= '<a id="document_preview_' . $course_info['real_id'] . '_' . $course_info['id_session'] . '" class="document_preview" href="javascript:void(0);">' .
3931
+                $params['right_actions'] .= '<a id="document_preview_'.$course_info['real_id'].'_'.$course_info['id_session'].'" class="document_preview" href="javascript:void(0);">'.
3932 3932
                     Display::return_icon('folder.png',
3933 3933
                         get_lang('Documents'),
3934 3934
                         array('align' => 'absmiddle'),
3935 3935
                         ICON_SIZE_SMALL
3936
-                    ) . '</a>';
3936
+                    ).'</a>';
3937 3937
                 $params['right_actions'] .= Display::div('', array(
3938
-                    'id' => 'document_result_' . $course_info['real_id'] . '_' . $course_info['id_session'],
3938
+                    'id' => 'document_result_'.$course_info['real_id'].'_'.$course_info['id_session'],
3939 3939
                     'class' => 'document_preview_container'
3940 3940
                 ));
3941 3941
             }
3942 3942
         }
3943 3943
 
3944 3944
         if (api_get_setting('display_coursecode_in_courselist') == 'true') {
3945
-            $session_title .= ' (' . $course_info['visual_code'] . ') ';
3945
+            $session_title .= ' ('.$course_info['visual_code'].') ';
3946 3946
         }
3947 3947
 
3948 3948
         if (api_get_setting('display_teacher_in_courselist') == 'true') {
@@ -3971,7 +3971,7 @@  discard block
 block discarded – undo
3971 3971
             }
3972 3972
         }
3973 3973
 
3974
-        $session_title .= isset($course['special_course']) ? ' ' .
3974
+        $session_title .= isset($course['special_course']) ? ' '.
3975 3975
                           Display::return_icon('klipper.png', get_lang('CourseAutoRegister')) : '';
3976 3976
 
3977 3977
         $params['title'] = $session_title;
@@ -3987,12 +3987,12 @@  discard block
 block discarded – undo
3987 3987
 
3988 3988
                 // Request for the name of the general coach
3989 3989
                 $sql = 'SELECT lastname, firstname,sc.name
3990
-                        FROM ' . $tbl_session . ' ts
3991
-                        LEFT JOIN ' . $main_user_table . ' tu
3990
+                        FROM ' . $tbl_session.' ts
3991
+                        LEFT JOIN ' . $main_user_table.' tu
3992 3992
                         ON ts.id_coach = tu.user_id
3993
-                        INNER JOIN ' . $tbl_session_category . ' sc
3993
+                        INNER JOIN ' . $tbl_session_category.' sc
3994 3994
                         ON ts.session_category_id = sc.id
3995
-                        WHERE ts.id=' . (int)$course_info['id_session'] . '
3995
+                        WHERE ts.id=' . (int) $course_info['id_session'].'
3996 3996
                         LIMIT 1';
3997 3997
 
3998 3998
                 $rs = Database::query($sql);
@@ -4007,14 +4007,14 @@  discard block
 block discarded – undo
4007 4007
                     //$session['dates'] = get_lang('WithoutTimeLimits');
4008 4008
                     $session['dates'] = '';
4009 4009
                     if (api_get_setting('show_session_coach') === 'true') {
4010
-                        $session['coach'] = get_lang('GeneralCoach') . ': ' . api_get_person_name($sessioncoach['firstname'],
4010
+                        $session['coach'] = get_lang('GeneralCoach').': '.api_get_person_name($sessioncoach['firstname'],
4011 4011
                                 $sessioncoach['lastname']);
4012 4012
                     }
4013 4013
                     $active = true;
4014 4014
                 } else {
4015
-                    $session ['dates'] = ' - ' . get_lang('From') . ' ' . $course_info['access_start_date'] . ' ' . get_lang('To') . ' ' . $course_info['access_end_date'];
4015
+                    $session ['dates'] = ' - '.get_lang('From').' '.$course_info['access_start_date'].' '.get_lang('To').' '.$course_info['access_end_date'];
4016 4016
                     if (api_get_setting('show_session_coach') === 'true') {
4017
-                        $session['coach'] = get_lang('GeneralCoach') . ': ' . api_get_person_name($sessioncoach['firstname'],
4017
+                        $session['coach'] = get_lang('GeneralCoach').': '.api_get_person_name($sessioncoach['firstname'],
4018 4018
                                 $sessioncoach['lastname']);
4019 4019
                     }
4020 4020
                     $active = ($date_start <= $now && $date_end >= $now);
@@ -4066,9 +4066,9 @@  discard block
 block discarded – undo
4066 4066
         $destination_session_id,
4067 4067
         $params = array()
4068 4068
     ) {
4069
-        require_once api_get_path(SYS_CODE_PATH) . 'coursecopy/classes/CourseBuilder.class.php';
4070
-        require_once api_get_path(SYS_CODE_PATH) . 'coursecopy/classes/CourseRestorer.class.php';
4071
-        require_once api_get_path(SYS_CODE_PATH) . 'coursecopy/classes/CourseSelectForm.class.php';
4069
+        require_once api_get_path(SYS_CODE_PATH).'coursecopy/classes/CourseBuilder.class.php';
4070
+        require_once api_get_path(SYS_CODE_PATH).'coursecopy/classes/CourseRestorer.class.php';
4071
+        require_once api_get_path(SYS_CODE_PATH).'coursecopy/classes/CourseSelectForm.class.php';
4072 4072
 
4073 4073
         $course_info = api_get_course_info($source_course_code);
4074 4074
 
@@ -4141,7 +4141,7 @@  discard block
 block discarded – undo
4141 4141
             if (Database::num_rows($result) > 0) {
4142 4142
                 $row = Database::fetch_array($result);
4143 4143
                 $count = $row['count'] + 1;
4144
-                $wanted_code = $wanted_code . '_' . $count;
4144
+                $wanted_code = $wanted_code.'_'.$count;
4145 4145
                 $result = api_get_course_info($wanted_code);
4146 4146
                 if (empty($result)) {
4147 4147
                     return $wanted_code;
@@ -4175,7 +4175,7 @@  discard block
 block discarded – undo
4175 4175
         $enabled = api_get_plugin_setting('courselegal', 'tool_enable');
4176 4176
 
4177 4177
         if ($enabled == 'true') {
4178
-            require_once api_get_path(SYS_PLUGIN_PATH) . 'courselegal/config.php';
4178
+            require_once api_get_path(SYS_PLUGIN_PATH).'courselegal/config.php';
4179 4179
             $plugin = CourseLegalPlugin::create();
4180 4180
             return $plugin->isUserAcceptedLegal($user_id, $course_code, $session_id);
4181 4181
         }
@@ -4220,7 +4220,7 @@  discard block
 block discarded – undo
4220 4220
         $enabled = api_get_plugin_setting('courselegal', 'tool_enable');
4221 4221
 
4222 4222
         if ($enabled == 'true') {
4223
-            require_once api_get_path(SYS_PLUGIN_PATH) . 'courselegal/config.php';
4223
+            require_once api_get_path(SYS_PLUGIN_PATH).'courselegal/config.php';
4224 4224
             $plugin = CourseLegalPlugin::create();
4225 4225
             return $plugin->saveUserLegal($user_id, $course_code, $session_id);
4226 4226
         }
@@ -4561,10 +4561,10 @@  discard block
 block discarded – undo
4561 4561
                 INNER JOIN $table_course_url u
4562 4562
                 ON u.c_id = c.id
4563 4563
                 WHERE
4564
-                    u.access_url_id = " . api_get_current_access_url_id() . " AND
4564
+                    u.access_url_id = ".api_get_current_access_url_id()." AND
4565 4565
                     login_course_date <= '$now' AND
4566 4566
                     login_course_date > DATE_SUB('$now', INTERVAL $days DAY) AND
4567
-                    visibility <> '" . COURSE_VISIBILITY_CLOSED . "' AND visibility <> '" . COURSE_VISIBILITY_HIDDEN . "'
4567
+                    visibility <> '".COURSE_VISIBILITY_CLOSED."' AND visibility <> '".COURSE_VISIBILITY_HIDDEN."'
4568 4568
                 GROUP BY a.c_id
4569 4569
                 ORDER BY course_count DESC
4570 4570
                 LIMIT $limit
@@ -4590,7 +4590,7 @@  discard block
 block discarded – undo
4590 4590
     {
4591 4591
         $hotCourses = [];
4592 4592
 
4593
-        $ajax_url = api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?a=add_course_vote';
4593
+        $ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote';
4594 4594
 
4595 4595
         $stok = Security::get_existing_token();
4596 4596
 
@@ -4612,7 +4612,7 @@  discard block
 block discarded – undo
4612 4612
             if ($access_link && in_array('register', $access_link)) {
4613 4613
                 $my_course['extra_info']['register_button'] = Display::url(
4614 4614
                     Display::returnFontAwesomeIcon('sign-in'),
4615
-                    api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/index.php?action=subscribe&sec_token=' . $stok,
4615
+                    api_get_path(WEB_COURSE_PATH).$course_info['path'].'/index.php?action=subscribe&sec_token='.$stok,
4616 4616
                     array('class' => 'btn btn-success btn-sm', 'title' => get_lang('Subscribe')));
4617 4617
             }
4618 4618
 
@@ -4621,14 +4621,14 @@  discard block
 block discarded – undo
4621 4621
             ) {
4622 4622
                 $my_course['extra_info']['go_to_course_button'] = Display::url(
4623 4623
                     Display::returnFontAwesomeIcon('share'),
4624
-                    api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/index.php',
4624
+                    api_get_path(WEB_COURSE_PATH).$course_info['path'].'/index.php',
4625 4625
                     array('class' => 'btn btn-default btn-sm', 'title' => get_lang('GoToCourse')));
4626 4626
             }
4627 4627
 
4628 4628
             if ($access_link && in_array('unsubscribe', $access_link)) {
4629 4629
                 $my_course['extra_info']['unsubscribe_button'] = Display::url(
4630 4630
                     Display::returnFontAwesomeIcon('sign-out'),
4631
-                    api_get_path(WEB_CODE_PATH) . 'auth/courses.php?action=unsubscribe&unsubscribe=' . $courseCode . '&sec_token=' . $stok . '&category_code=' . $categoryCode,
4631
+                    api_get_path(WEB_CODE_PATH).'auth/courses.php?action=unsubscribe&unsubscribe='.$courseCode.'&sec_token='.$stok.'&category_code='.$categoryCode,
4632 4632
                     array('class' => 'btn btn-danger btn-sm', 'title' => get_lang('Unreg')));
4633 4633
             }
4634 4634
 
@@ -4639,7 +4639,7 @@  discard block
 block discarded – undo
4639 4639
             ) { */
4640 4640
                 $my_course['extra_info']['description_button'] = Display::url(
4641 4641
                     Display::returnFontAwesomeIcon('info-circle'),
4642
-                    api_get_path(WEB_AJAX_PATH) . 'course_home.ajax.php?a=show_course_information&code=' . $course_info['code'],
4642
+                    api_get_path(WEB_AJAX_PATH).'course_home.ajax.php?a=show_course_information&code='.$course_info['code'],
4643 4643
                     [
4644 4644
                         'class' => 'btn btn-default btn-sm ajax',
4645 4645
                         'data-title' => get_lang('Description'),
@@ -4650,8 +4650,8 @@  discard block
 block discarded – undo
4650 4650
             /* get_lang('Description') */
4651 4651
             $my_course['extra_info']['teachers'] = CourseManager::get_teacher_list_from_course_code_to_string($course_info['code']);
4652 4652
             $point_info = self::get_course_ranking($course_info['real_id'], 0);
4653
-            $my_course['extra_info']['rating_html'] = Display::return_rating_system('star_' . $course_info['real_id'],
4654
-                $ajax_url . '&course_id=' . $course_info['real_id'], $point_info);
4653
+            $my_course['extra_info']['rating_html'] = Display::return_rating_system('star_'.$course_info['real_id'],
4654
+                $ajax_url.'&course_id='.$course_info['real_id'], $point_info);
4655 4655
 
4656 4656
             $hotCourses[] = $my_course;
4657 4657
         }
@@ -4725,9 +4725,9 @@  discard block
 block discarded – undo
4725 4725
                     WHERE
4726 4726
                         c.id = u.c_id AND
4727 4727
                         u.access_url_id = $urlId AND
4728
-                        visibility <> " . COURSE_VISIBILITY_HIDDEN;
4728
+                        visibility <> ".COURSE_VISIBILITY_HIDDEN;
4729 4729
         } else {
4730
-            $sql .= " WHERE visibility <> " . COURSE_VISIBILITY_HIDDEN;
4730
+            $sql .= " WHERE visibility <> ".COURSE_VISIBILITY_HIDDEN;
4731 4731
         }
4732 4732
         $res = Database::query($sql);
4733 4733
         $row = Database::fetch_row($res);
@@ -4747,7 +4747,7 @@  discard block
 block discarded – undo
4747 4747
 
4748 4748
         $withoutSpecialCourses = '';
4749 4749
         if (!empty($specialCourseList)) {
4750
-            $withoutSpecialCourses = ' AND c.code NOT IN ("' . implode('","', $specialCourseList) . '")';
4750
+            $withoutSpecialCourses = ' AND c.code NOT IN ("'.implode('","', $specialCourseList).'")';
4751 4751
         }
4752 4752
 
4753 4753
         $visibilityCondition = null;
@@ -4881,12 +4881,12 @@  discard block
 block discarded – undo
4881 4881
             if (count($teachers) > 0) {
4882 4882
                 foreach ($teachers as $key) {
4883 4883
                     $key = Database::escape_string($key);
4884
-                    $cond .= " AND user_id <> '" . $key . "'";
4884
+                    $cond .= " AND user_id <> '".$key."'";
4885 4885
                 }
4886 4886
             }
4887 4887
 
4888
-            $sql = 'DELETE FROM ' . $course_user_table . '
4889
-                    WHERE c_id ="' . $courseId . '" AND status="1" AND relation_type = 0 ' . $cond;
4888
+            $sql = 'DELETE FROM '.$course_user_table.'
4889
+                    WHERE c_id ="' . $courseId.'" AND status="1" AND relation_type = 0 '.$cond;
4890 4890
             Database::query($sql);
4891 4891
         }
4892 4892
 
@@ -4894,12 +4894,12 @@  discard block
 block discarded – undo
4894 4894
             foreach ($teachers as $userId) {
4895 4895
                 $userId = intval($userId);
4896 4896
                 // We check if the teacher is already subscribed in this course
4897
-                $sql = 'SELECT 1 FROM ' . $course_user_table . '
4898
-                        WHERE user_id = "' . $userId . '" AND c_id = "' . $courseId . '" ';
4897
+                $sql = 'SELECT 1 FROM '.$course_user_table.'
4898
+                        WHERE user_id = "' . $userId.'" AND c_id = "'.$courseId.'" ';
4899 4899
                 $result = Database::query($sql);
4900 4900
                 if (Database::num_rows($result)) {
4901
-                    $sql = 'UPDATE ' . $course_user_table . ' SET status = "1"
4902
-                            WHERE c_id = "' . $courseId . '" AND user_id = "' . $userId . '"  ';
4901
+                    $sql = 'UPDATE '.$course_user_table.' SET status = "1"
4902
+                            WHERE c_id = "' . $courseId.'" AND user_id = "'.$userId.'"  ';
4903 4903
                 } else {
4904 4904
                     $userCourseCategory = '0';
4905 4905
                     if (isset($teacherBackup[$userId]) &&
@@ -4909,9 +4909,9 @@  discard block
 block discarded – undo
4909 4909
                         $userCourseCategory = $courseUserData['user_course_cat'];
4910 4910
                     }
4911 4911
 
4912
-                    $sql = "INSERT INTO " . $course_user_table . " SET
4913
-                            c_id = " . $courseId . ",
4914
-                            user_id = " . $userId . ",
4912
+                    $sql = "INSERT INTO ".$course_user_table." SET
4913
+                            c_id = " . $courseId.",
4914
+                            user_id = " . $userId.",
4915 4915
                             status = '1',
4916 4916
                             is_tutor = '0',
4917 4917
                             sort = '0',
@@ -5247,8 +5247,8 @@  discard block
 block discarded – undo
5247 5247
     {
5248 5248
         $tbl_main_categories = Database:: get_main_table(TABLE_MAIN_COURSE);
5249 5249
         $sql = 'SELECT title
5250
-                FROM ' . $tbl_main_categories . '
5251
-                WHERE code = "' . Database::escape_string($code) . '"';
5250
+                FROM ' . $tbl_main_categories.'
5251
+                WHERE code = "' . Database::escape_string($code).'"';
5252 5252
         $result = Database::query($sql);
5253 5253
         if ($col = Database::fetch_array($result)) {
5254 5254
             return $col['title'];
@@ -5431,7 +5431,7 @@  discard block
 block discarded – undo
5431 5431
             foreach ($group_list as $this_group) {
5432 5432
                 if (is_array($to_already_selected)) {
5433 5433
                     if (!in_array(
5434
-                        "GROUP:" . $this_group['id'],
5434
+                        "GROUP:".$this_group['id'],
5435 5435
                         $to_already_selected
5436 5436
                     )
5437 5437
                     ) { // $to_already_selected is the array containing the groups (and users) that are already selected
@@ -5439,8 +5439,8 @@  discard block
 block discarded – undo
5439 5439
                         $user_disabled = ($this_group['userNb'] > 0) ? "" : "disabled=disabled";
5440 5440
                         $result[] = array(
5441 5441
                             'disabled' => $user_disabled,
5442
-                            'value' => "GROUP:" . $this_group['id'],
5443
-                            'content' => "G: " . $this_group['name'] . " - " . $this_group['userNb'] . " " . $user_label
5442
+                            'value' => "GROUP:".$this_group['id'],
5443
+                            'content' => "G: ".$this_group['name']." - ".$this_group['userNb']." ".$user_label
5444 5444
                         );
5445 5445
                     }
5446 5446
                 }
@@ -5452,13 +5452,13 @@  discard block
 block discarded – undo
5452 5452
             foreach ($user_list as $user) {
5453 5453
                 if (is_array($to_already_selected)) {
5454 5454
                     if (!in_array(
5455
-                        "USER:" . $user['user_id'],
5455
+                        "USER:".$user['user_id'],
5456 5456
                         $to_already_selected
5457 5457
                     )
5458 5458
                     ) { // $to_already_selected is the array containing the users (and groups) that are already selected
5459 5459
 
5460 5460
                         $result[] = array(
5461
-                            'value' => "USER:" . $user['user_id'],
5461
+                            'value' => "USER:".$user['user_id'],
5462 5462
                             'content' => api_get_person_name($user['firstname'], $user['lastname'])
5463 5463
                         );
5464 5464
                     }
@@ -5487,7 +5487,7 @@  discard block
 block discarded – undo
5487 5487
     {
5488 5488
         $category_id = intval($category_id);
5489 5489
         $info = Database::fetch_array(
5490
-            Database::query('SELECT course_code FROM ' . Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY) . '
5490
+            Database::query('SELECT course_code FROM '.Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY).'
5491 5491
             WHERE id=' . $category_id), 'ASSOC'
5492 5492
         );
5493 5493
         return $info ? $info['course_code'] : false;
@@ -5503,15 +5503,14 @@  discard block
 block discarded – undo
5503 5503
     public static function getCoursesWithoutSession($startDate = null, $endDate = null, $includeClosed = false)
5504 5504
     {
5505 5505
         $dateConditional = ($startDate && $endDate) ?
5506
-            " WHERE session_id IN (SELECT id FROM " . Database::get_main_table(TABLE_MAIN_SESSION) .
5507
-            " WHERE access_start_date = '$startDate' AND access_end_date = '$endDate')" :
5508
-            null;
5506
+            " WHERE session_id IN (SELECT id FROM ".Database::get_main_table(TABLE_MAIN_SESSION).
5507
+            " WHERE access_start_date = '$startDate' AND access_end_date = '$endDate')" : null;
5509 5508
         $visibility = ($includeClosed ? '' : 'visibility NOT IN (0, 4) AND ');
5510 5509
 
5511 5510
         $query = "SELECT id, code, title
5512
-                FROM " . Database::get_main_table(TABLE_MAIN_COURSE). "
5511
+                FROM " . Database::get_main_table(TABLE_MAIN_COURSE)."
5513 5512
                 WHERE $visibility code NOT IN (
5514
-                    SELECT DISTINCT course_code FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE) . $dateConditional . ")
5513
+                    SELECT DISTINCT course_code FROM ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE).$dateConditional.")
5515 5514
                 ORDER BY id";
5516 5515
 
5517 5516
         $result = Database::query($query);
@@ -5544,7 +5543,7 @@  discard block
 block discarded – undo
5544 5543
                 FROM $courseTable c
5545 5544
                 INNER JOIN $courseUserTable cru ON c.id = cru.c_id
5546 5545
                 WHERE (
5547
-                    cru.user_id IN (" . implode(', ', $userIdList) . ")
5546
+                    cru.user_id IN (".implode(', ', $userIdList).")
5548 5547
                     AND cru.relation_type = 0
5549 5548
                 )";
5550 5549
 
@@ -5559,7 +5558,7 @@  discard block
 block discarded – undo
5559 5558
                         INNER JOIN $courseAccessUrlTable crau ON c.id = crau.c_id
5560 5559
                         WHERE crau.access_url_id = $accessUrlId
5561 5560
                             AND (
5562
-                            cru.id_user IN (" . implode(', ', $userIdList) . ") AND
5561
+                            cru.id_user IN (".implode(', ', $userIdList).") AND
5563 5562
                             cru.relation_type = 0
5564 5563
                         )";
5565 5564
             }
@@ -5668,7 +5667,7 @@  discard block
 block discarded – undo
5668 5667
 
5669 5668
         $without_special_courses = '';
5670 5669
         if (!empty($special_course_list)) {
5671
-            $without_special_courses = ' AND course.code NOT IN ("'.implode('","',$special_course_list).'")';
5670
+            $without_special_courses = ' AND course.code NOT IN ("'.implode('","', $special_course_list).'")';
5672 5671
         }
5673 5672
 
5674 5673
         //AND course_rel_user.relation_type<>".COURSE_RELATION_TYPE_RRHH."
@@ -5724,11 +5723,11 @@  discard block
 block discarded – undo
5724 5723
 
5725 5724
         if (api_is_platform_admin()) {
5726 5725
             if ($loadDirs) {
5727
-                $params['right_actions'] .= '<a id="document_preview_'.$course_info['real_id'].'_0" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'),ICON_SIZE_SMALL).'</a>';
5728
-                $params['right_actions'] .= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'),ICON_SIZE_SMALL).'</a>';
5726
+                $params['right_actions'] .= '<a id="document_preview_'.$course_info['real_id'].'_0" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>';
5727
+                $params['right_actions'] .= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>';
5729 5728
                 $params['right_actions'] .= Display::div('', array('id' => 'document_result_'.$course_info['real_id'].'_0', 'class'=>'document_preview_container'));
5730 5729
             } else {
5731
-                $params['right_actions'].= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'),ICON_SIZE_SMALL).'</a>';
5730
+                $params['right_actions'] .= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>';
5732 5731
             }
5733 5732
 
5734 5733
             if ($course_info['status'] == COURSEMANAGER) {
@@ -5737,11 +5736,11 @@  discard block
 block discarded – undo
5737 5736
         } else {
5738 5737
             if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) {
5739 5738
                 if ($loadDirs) {
5740
-                    $params['right_actions'] .= '<a id="document_preview_'.$course_info['real_id'].'_0" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'),ICON_SIZE_SMALL).'</a>';
5739
+                    $params['right_actions'] .= '<a id="document_preview_'.$course_info['real_id'].'_0" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>';
5741 5740
                     $params['right_actions'] .= Display::div('', array('id' => 'document_result_'.$course_info['real_id'].'_0', 'class'=>'document_preview_container'));
5742 5741
                 } else {
5743 5742
                     if ($course_info['status'] == COURSEMANAGER) {
5744
-                        $params['right_actions'].= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'),ICON_SIZE_SMALL).'</a>';
5743
+                        $params['right_actions'] .= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>';
5745 5744
                     }
5746 5745
                 }
5747 5746
             }
@@ -5752,7 +5751,7 @@  discard block
 block discarded – undo
5752 5751
             $course_title_url = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/?id_session=0';
5753 5752
             $course_title = Display::url($course_info['title'], $course_title_url);
5754 5753
         } else {
5755
-            $course_title = $course_info['title']." ".Display::tag('span',get_lang('CourseClosed'), array('class'=>'item_closed'));
5754
+            $course_title = $course_info['title']." ".Display::tag('span', get_lang('CourseClosed'), array('class'=>'item_closed'));
5756 5755
         }
5757 5756
 
5758 5757
         // Start displaying the course block itself
Please login to merge, or discard this patch.
main/inc/lib/social.lib.php 1 patch
Spacing   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -109,12 +109,12 @@  discard block
 block discarded – undo
109 109
                     friend_user_id<>'.((int) $user_id).' AND
110 110
                     user_id='.((int) $user_id);
111 111
         if (isset($id_group) && $id_group > 0) {
112
-            $sql.=' AND relation_type='.$id_group;
112
+            $sql .= ' AND relation_type='.$id_group;
113 113
         }
114 114
         if (isset($search_name)) {
115 115
             $search_name = trim($search_name);
116 116
             $search_name = str_replace(' ', '', $search_name);
117
-            $sql.=' AND friend_user_id IN (
117
+            $sql .= ' AND friend_user_id IN (
118 118
                 SELECT user_id FROM '.$tbl_my_user.'
119 119
                 WHERE
120 120
                     firstName LIKE "%'.Database::escape_string($search_name).'%" OR
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 
369 369
         $user_info = api_get_user_info($userfriend_id);
370 370
         $succes = get_lang('MessageSentTo');
371
-        $succes.= ' : '.api_get_person_name($user_info['firstName'], $user_info['lastName']);
371
+        $succes .= ' : '.api_get_person_name($user_info['firstName'], $user_info['lastName']);
372 372
 
373 373
         if (isset($subject_message) && isset($content_message) && isset($userfriend_id)) {
374 374
             $send_message = MessageManager::send_message($userfriend_id, $subject_message, $content_message);
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
         $user_in_course_status = CourseManager :: get_user_in_course_status(api_get_user_id(), $course_code);
486 486
 
487 487
         //$valor = api_get_settings_params();
488
-        $course_path = api_get_path(SYS_COURSE_PATH).$course_directory;   // course path
488
+        $course_path = api_get_path(SYS_COURSE_PATH).$course_directory; // course path
489 489
         if (api_get_setting('course_images_in_courses_list') === 'true') {
490 490
             if (file_exists($course_path.'/course-pic85x85.png')) {
491 491
                 $image = $my_course['course_info']['course_image'];
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
         if ($course_visibility != COURSE_VISIBILITY_HIDDEN &&
511 511
             ($course_visibility != COURSE_VISIBILITY_CLOSED || $user_in_course_status == COURSEMANAGER)
512 512
         ) {
513
-           $result .= '<span class="title">' . $course_title . '<span>';
513
+           $result .= '<span class="title">'.$course_title.'<span>';
514 514
         } else {
515 515
             $result .= $course_title." "." ".get_lang('CourseClosed')."";
516 516
         }
@@ -729,57 +729,57 @@  discard block
 block discarded – undo
729 729
             $links = '<ul class="nav nav-pills nav-stacked">';
730 730
             $active = $show == 'home' ? 'active' : null;
731 731
             $links .= '
732
-                <li class="home-icon ' . $active . '">
733
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/home.php">
734
-                        ' . $homeIcon . ' ' . get_lang('Home') . '
732
+                <li class="home-icon ' . $active.'">
733
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/home.php">
734
+                        ' . $homeIcon.' '.get_lang('Home').'
735 735
                     </a>
736 736
                 </li>';
737 737
             $active = $show == 'messages' ? 'active' : null;
738 738
             $links .= '
739
-                <li class="messages-icon ' . $active . '">
740
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php?f=social">
741
-                        ' . $messagesIcon . ' ' . get_lang('Messages') . $count_unread_message . '
739
+                <li class="messages-icon ' . $active.'">
740
+                    <a href="' . api_get_path(WEB_CODE_PATH).'messages/inbox.php?f=social">
741
+                        ' . $messagesIcon.' '.get_lang('Messages').$count_unread_message.'
742 742
                     </a>
743 743
                 </li>';
744 744
 
745 745
             //Invitations
746 746
             $active = $show == 'invitations' ? 'active' : null;
747 747
             $links .= '
748
-                <li class="invitations-icon ' . $active . '">
749
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php">
750
-                        ' . $invitationsIcon . ' ' . get_lang('Invitations') . $total_invitations . '
748
+                <li class="invitations-icon ' . $active.'">
749
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/invitations.php">
750
+                        ' . $invitationsIcon.' '.get_lang('Invitations').$total_invitations.'
751 751
                     </a>
752 752
                 </li>';
753 753
 
754 754
             //Shared profile and groups
755 755
             $active = $show == 'shared_profile' ? 'active' : null;
756 756
             $links .= '
757
-                <li class="shared-profile-icon' . $active . '">
758
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php">
759
-                        ' . $sharedProfileIcon . ' ' . get_lang('ViewMySharedProfile') . '
757
+                <li class="shared-profile-icon' . $active.'">
758
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/profile.php">
759
+                        ' . $sharedProfileIcon.' '.get_lang('ViewMySharedProfile').'
760 760
                     </a>
761 761
                 </li>';
762 762
             $active = $show == 'friends' ? 'active' : null;
763 763
             $links .= '
764
-                <li class="friends-icon ' . $active . '">
765
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/friends.php">
766
-                        ' . $friendsIcon . ' ' . get_lang('Friends') . '
764
+                <li class="friends-icon ' . $active.'">
765
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/friends.php">
766
+                        ' . $friendsIcon.' '.get_lang('Friends').'
767 767
                     </a>
768 768
                 </li>';
769 769
             $active = $show == 'browse_groups' ? 'active' : null;
770 770
             $links .= '
771
-                <li class="browse-groups-icon ' . $active . '">
772
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/groups.php">
773
-                        ' . $groupsIcon . ' ' . get_lang('SocialGroups') . '
771
+                <li class="browse-groups-icon ' . $active.'">
772
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/groups.php">
773
+                        ' . $groupsIcon.' '.get_lang('SocialGroups').'
774 774
                     </a>
775 775
                 </li>';
776 776
 
777 777
             //Search users
778 778
             $active = $show == 'search' ? 'active' : null;
779 779
             $links .= '
780
-                <li class="search-icon ' . $active . '">
781
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/search.php">
782
-                        ' . $searchIcon . ' ' . get_lang('Search') . '
780
+                <li class="search-icon ' . $active.'">
781
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/search.php">
782
+                        ' . $searchIcon.' '.get_lang('Search').'
783 783
                     </a>
784 784
                 </li>';
785 785
 
@@ -787,9 +787,9 @@  discard block
 block discarded – undo
787 787
             $active = $show == 'myfiles' ? 'active' : null;
788 788
 
789 789
             $myFiles = '
790
-                <li class="myfiles-icon ' . $active . '">
791
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php">
792
-                        ' . $filesIcon . ' ' . get_lang('MyFiles') . '
790
+                <li class="myfiles-icon ' . $active.'">
791
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/myfiles.php">
792
+                        ' . $filesIcon.' '.get_lang('MyFiles').'
793 793
                     </a>
794 794
                 </li>';
795 795
 
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
             }
799 799
             $links .= $myFiles;
800 800
 
801
-            $links .='</ul>';
801
+            $links .= '</ul>';
802 802
             
803 803
             $html .= Display::panelCollapse(
804 804
                     get_lang('SocialNetwork'),
@@ -819,57 +819,57 @@  discard block
 block discarded – undo
819 819
         }
820 820
 
821 821
         if ($show == 'shared_profile') {
822
-            $links =  '<ul class="nav nav-pills nav-stacked">';
822
+            $links = '<ul class="nav nav-pills nav-stacked">';
823 823
             // My own profile
824 824
             if ($show_full_profile && $user_id == intval(api_get_user_id())) {
825 825
                 $links .= '
826
-                    <li class="home-icon ' . $active . '">
827
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/home.php">
828
-                            ' . $homeIcon . ' ' . get_lang('Home') . '
826
+                    <li class="home-icon ' . $active.'">
827
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/home.php">
828
+                            ' . $homeIcon.' '.get_lang('Home').'
829 829
                         </a>
830 830
                     </li>
831
-                    <li class="messages-icon ' . $active . '">
832
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php?f=social">
833
-                            ' . $messagesIcon . ' ' . get_lang('Messages') . $count_unread_message . '
831
+                    <li class="messages-icon ' . $active.'">
832
+                        <a href="' . api_get_path(WEB_CODE_PATH).'messages/inbox.php?f=social">
833
+                            ' . $messagesIcon.' '.get_lang('Messages').$count_unread_message.'
834 834
                         </a>
835 835
                     </li>';
836 836
                 $active = $show == 'invitations' ? 'active' : null;
837 837
                 $links .= '
838
-                    <li class="invitations-icon' . $active . '">
839
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php">
840
-                            ' . $invitationsIcon . ' ' . get_lang('Invitations') . $total_invitations . '
838
+                    <li class="invitations-icon' . $active.'">
839
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/invitations.php">
840
+                            ' . $invitationsIcon.' '.get_lang('Invitations').$total_invitations.'
841 841
                         </a>
842 842
                     </li>';
843 843
 
844 844
                 $links .= '
845 845
                     <li class="shared-profile-icon active">
846
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php">
847
-                            ' . $sharedProfileIcon . ' ' . get_lang('ViewMySharedProfile') . '
846
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/profile.php">
847
+                            ' . $sharedProfileIcon.' '.get_lang('ViewMySharedProfile').'
848 848
                         </a>
849 849
                     </li>
850 850
                     <li class="friends-icon">
851
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/friends.php">
852
-                            ' . $friendsIcon . ' ' . get_lang('Friends') . '
851
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/friends.php">
852
+                            ' . $friendsIcon.' '.get_lang('Friends').'
853 853
                         </a>
854 854
                     </li>
855 855
                     <li class="browse-groups-icon">
856
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/groups.php">
857
-                            ' . $groupsIcon . ' ' . get_lang('SocialGroups') . '
856
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/groups.php">
857
+                            ' . $groupsIcon.' '.get_lang('SocialGroups').'
858 858
                         </a>
859 859
                     </li>';
860 860
                 $active = $show == 'search' ? 'active' : null;
861 861
                 $links .= '
862
-                    <li class="search-icon ' . $active . '">
863
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/search.php">
864
-                            ' . $searchIcon . ' ' . get_lang('Search') . '
862
+                    <li class="search-icon ' . $active.'">
863
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/search.php">
864
+                            ' . $searchIcon.' '.get_lang('Search').'
865 865
                         </a>
866 866
                     </li>';
867 867
                 $active = $show == 'myfiles' ? 'active' : null;
868 868
 
869 869
                 $myFiles = '
870
-                    <li class="myfiles-icon ' . $active . '">
871
-                     <a href="' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php">
872
-                            ' . $filesIcon . ' ' . get_lang('MyFiles') . '
870
+                    <li class="myfiles-icon ' . $active.'">
871
+                     <a href="' . api_get_path(WEB_CODE_PATH).'social/myfiles.php">
872
+                            ' . $filesIcon.' '.get_lang('MyFiles').'
873 873
                         </a>
874 874
                     </li>';
875 875
 
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
                 $links .= '<li><a href="'.api_get_path(WEB_CODE_PATH).'social/invitations.php">'.Display::return_icon('invitation.png', get_lang('YouAlreadySentAnInvitation')).'&nbsp;&nbsp;'.get_lang('YouAlreadySentAnInvitation').'</a></li>';
916 916
             } else {
917 917
                 if (!$show_full_profile) {
918
-                    $links .= '<li><a class="btn-to-send-invitation" href="#" data-send-to="' . $user_id . '" title="'.get_lang('SendInvitation').'">'.Display :: return_icon('invitation.png', get_lang('SocialInvitationToFriends')).'&nbsp;'.get_lang('SendInvitation').'</a></li>';
918
+                    $links .= '<li><a class="btn-to-send-invitation" href="#" data-send-to="'.$user_id.'" title="'.get_lang('SendInvitation').'">'.Display :: return_icon('invitation.png', get_lang('SocialInvitationToFriends')).'&nbsp;'.get_lang('SendInvitation').'</a></li>';
919 919
                 }
920 920
             }
921 921
 
@@ -1025,10 +1025,10 @@  discard block
 block discarded – undo
1025 1025
         foreach ($user_list as $uid) {
1026 1026
             $user_info = api_get_user_info($uid, $checkIfUserOnline = true);
1027 1027
             $lastname = $user_info['lastname'];
1028
-            $firstname =  $user_info['firstname'];
1028
+            $firstname = $user_info['firstname'];
1029 1029
             $completeName = $firstname.', '.$lastname;
1030 1030
 
1031
-            $user_rol = $user_info['status'] == 1 ? Display::return_icon('teacher.png',get_lang('Teacher'),null,ICON_SIZE_TINY) : Display::return_icon('user.png',get_lang('Student'),null,ICON_SIZE_TINY);
1031
+            $user_rol = $user_info['status'] == 1 ? Display::return_icon('teacher.png', get_lang('Teacher'), null, ICON_SIZE_TINY) : Display::return_icon('user.png', get_lang('Student'), null, ICON_SIZE_TINY);
1032 1032
             $status_icon_chat = null;
1033 1033
             if ($user_info['user_is_online_in_chat'] == 1) {
1034 1034
                 $status_icon_chat = Display::return_icon('online.png', get_lang('Online'));
@@ -1039,7 +1039,7 @@  discard block
 block discarded – undo
1039 1039
             $userPicture = $user_info['avatar'];
1040 1040
             $img = '<img class="img-responsive img-circle" title="'.$completeName.'" alt="'.$completeName.'" src="'.$userPicture.'">';
1041 1041
 
1042
-            $url =  null;
1042
+            $url = null;
1043 1043
             // Anonymous users can't have access to the profile
1044 1044
             if (!api_is_anonymous()) {
1045 1045
                 if (api_get_setting('allow_social_tool') == 'true') {
@@ -1205,13 +1205,13 @@  discard block
 block discarded – undo
1205 1205
             case SOCIAL_CENTER_PLUGIN:
1206 1206
                 $social_plugins = array(1, 2);
1207 1207
                 if (is_array($social_plugins) && count($social_plugins) > 0) {
1208
-                    $content.= '<div id="social-plugins">';
1208
+                    $content .= '<div id="social-plugins">';
1209 1209
                     foreach ($social_plugins as $plugin) {
1210
-                        $content.= '<div class="social-plugin-item">';
1211
-                        $content.= $plugin;
1212
-                        $content.= '</div>';
1210
+                        $content .= '<div class="social-plugin-item">';
1211
+                        $content .= $plugin;
1212
+                        $content .= '</div>';
1213 1213
                     }
1214
-                    $content.= '</div>';
1214
+                    $content .= '</div>';
1215 1215
                 }
1216 1216
                 break;
1217 1217
             case SOCIAL_LEFT_PLUGIN:
@@ -1279,12 +1279,12 @@  discard block
 block discarded – undo
1279 1279
         if (!in_array($extension, $allowedTypes)) {
1280 1280
             $flag = false;
1281 1281
         } else {
1282
-            $newFileName = uniqid('') . '.' . $extension;
1282
+            $newFileName = uniqid('').'.'.$extension;
1283 1283
             if (!file_exists($pathMessageAttach)) {
1284 1284
                 @mkdir($pathMessageAttach, api_get_permissions_for_new_directories(), true);
1285 1285
             }
1286 1286
 
1287
-            $newPath = $pathMessageAttach . $newFileName;
1287
+            $newPath = $pathMessageAttach.$newFileName;
1288 1288
             if (is_uploaded_file($fileAttach['tmp_name'])) {
1289 1289
                 @copy($fileAttach['tmp_name'], $newPath);
1290 1290
             }
@@ -1293,9 +1293,9 @@  discard block
 block discarded – undo
1293 1293
             $medium = self::resize_picture($newPath, IMAGE_WALL_MEDIUM_SIZE);
1294 1294
 
1295 1295
             $big = new Image($newPath);
1296
-            $ok = $small && $small->send_image($pathMessageAttach . IMAGE_WALL_SMALL . '_' . $newFileName) &&
1297
-                $medium && $medium->send_image($pathMessageAttach . IMAGE_WALL_MEDIUM .'_' . $newFileName) &&
1298
-                $big && $big->send_image($pathMessageAttach . IMAGE_WALL_BIG . '_' . $newFileName);
1296
+            $ok = $small && $small->send_image($pathMessageAttach.IMAGE_WALL_SMALL.'_'.$newFileName) &&
1297
+                $medium && $medium->send_image($pathMessageAttach.IMAGE_WALL_MEDIUM.'_'.$newFileName) &&
1298
+                $big && $big->send_image($pathMessageAttach.IMAGE_WALL_BIG.'_'.$newFileName);
1299 1299
 
1300 1300
             // Insert
1301 1301
             $newFileName = $social.$newFileName;
@@ -1386,7 +1386,7 @@  discard block
 block discarded – undo
1386 1386
             $start = '0000-00-00';
1387 1387
         }
1388 1388
 
1389
-        $isOwnWall = (api_get_user_id() == $userId  && $userId == $friendId);
1389
+        $isOwnWall = (api_get_user_id() == $userId && $userId == $friendId);
1390 1390
         $messages = self::getWallMessages($userId, MESSAGE_STATUS_WALL, $idMessage, $start, $limit, $offset);
1391 1391
         $formattedList = '<div class="sub-mediapost">';
1392 1392
         $users = array();
@@ -1401,8 +1401,8 @@  discard block
 block discarded – undo
1401 1401
             }
1402 1402
 
1403 1403
             $nameComplete = api_is_western_name_order()
1404
-                ? $users[$userIdLoop]['firstname'] .' ' . $users[$userIdLoop]['lastname']
1405
-                : $users[$userIdLoop]['lastname'] . ' ' . $users[$userIdLoop]['firstname'];
1404
+                ? $users[$userIdLoop]['firstname'].' '.$users[$userIdLoop]['lastname']
1405
+                : $users[$userIdLoop]['lastname'].' '.$users[$userIdLoop]['firstname'];
1406 1406
             $url = api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$userIdLoop;
1407 1407
             $media = '';
1408 1408
             $media .= '<div class="rep-post">';
@@ -1413,11 +1413,11 @@  discard block
 block discarded – undo
1413 1413
                 $media .= '</div>';
1414 1414
             }
1415 1415
             $media .= '<div class="user-image">';
1416
-            $media .= '<a href="'.$url.'" ><img src="'. $users[$userIdLoop]['avatar'] .
1416
+            $media .= '<a href="'.$url.'" ><img src="'.$users[$userIdLoop]['avatar'].
1417 1417
                        '" alt="'.$users[$userIdLoop]['complete_name'].'" class="avatar-thumb"></a>';
1418 1418
             $media .= '</div>';
1419 1419
             $media .= '<div class="user-data">';
1420
-            $media .= '<div class="username">' . '<a href="'.$url.'">'.$nameComplete.'</a></div>';
1420
+            $media .= '<div class="username">'.'<a href="'.$url.'">'.$nameComplete.'</a></div>';
1421 1421
             $media .= '<div class="time timeago" title="'.$date.'">'.$date.'</div>';
1422 1422
             $media .= '</div>';
1423 1423
             $media .= '<div class="msg-content">';
@@ -1452,12 +1452,12 @@  discard block
 block discarded – undo
1452 1452
      * @param   int     $offset     Wall messages offset
1453 1453
      * @return  array   $data       return user's starting wall messages along with message extra data
1454 1454
      */
1455
-    public static function getWallMessagesPostHTML($userId, $friendId = 0, $start = null, $limit = 10, $offset= 0)
1455
+    public static function getWallMessagesPostHTML($userId, $friendId = 0, $start = null, $limit = 10, $offset = 0)
1456 1456
     {
1457 1457
         if (empty($start)) {
1458 1458
             $start = '0000-00-00';
1459 1459
         }
1460
-        $isOwnWall = (api_get_user_id() == $userId  && $userId == $friendId);
1460
+        $isOwnWall = (api_get_user_id() == $userId && $userId == $friendId);
1461 1461
         $messages = self::getWallMessages($userId, MESSAGE_STATUS_WALL_POST, null, $start, $limit, $offset);
1462 1462
         $users = array();
1463 1463
         $data = array();
@@ -1516,7 +1516,7 @@  discard block
 block discarded – undo
1516 1516
 
1517 1517
         $htmlReceiver = '';
1518 1518
         if ($authorId != $receiverId) {
1519
-            $htmlReceiver = ' > <a href="'.$urlReceiver.'">' . $nameCompleteReceiver . '</a> ';
1519
+            $htmlReceiver = ' > <a href="'.$urlReceiver.'">'.$nameCompleteReceiver.'</a> ';
1520 1520
         }
1521 1521
 
1522 1522
         $wallImage = '';
@@ -1551,7 +1551,7 @@  discard block
 block discarded – undo
1551 1551
         $html .= '<div class="img-post">';
1552 1552
         $html .= $wallImage;
1553 1553
         $html .= '</div>';
1554
-        $html .= '<p>'. Security::remove_XSS($message['content']).'</p>';
1554
+        $html .= '<p>'.Security::remove_XSS($message['content']).'</p>';
1555 1555
         $html .= '</div>';
1556 1556
         $html .= '</div>'; // end mediaPost
1557 1557
 
@@ -1574,11 +1574,11 @@  discard block
 block discarded – undo
1574 1574
         $domain = empty($url) ? parse_url($link) : parse_url($url);
1575 1575
         $domain = $domain['scheme'].'://'.$domain['host'];
1576 1576
         // Trick to verify if the Image Url Exist because of some bad metatag dev
1577
-        if (self::verifyUrl($image) == false){
1578
-            if (!($image[0] == '/')){
1579
-                $domain = $domain . '/';
1577
+        if (self::verifyUrl($image) == false) {
1578
+            if (!($image[0] == '/')) {
1579
+                $domain = $domain.'/';
1580 1580
             }
1581
-            $image = $domain . $image;
1581
+            $image = $domain.$image;
1582 1582
         }
1583 1583
         $title = $graph->title;
1584 1584
         
@@ -1630,16 +1630,16 @@  discard block
 block discarded – undo
1630 1630
         if (isset($array[2]) && !empty($array[2])) {
1631 1631
 
1632 1632
             if ($size == IMAGE_WALL_SMALL) {
1633
-                $name = IMAGE_WALL_SMALL. '_' . $array[2];
1634
-            }else if($size == IMAGE_WALL_MEDIUM){
1635
-                $name = IMAGE_WALL_MEDIUM. '_' . $array[2];
1636
-            }else if($size == IMAGE_WALL_BIG){
1637
-                $name = IMAGE_WALL_BIG. '_' . $array[2];
1638
-            }else {
1639
-                $name = IMAGE_WALL_SMALL. '_' . $array[2];
1633
+                $name = IMAGE_WALL_SMALL.'_'.$array[2];
1634
+            } else if ($size == IMAGE_WALL_MEDIUM) {
1635
+                $name = IMAGE_WALL_MEDIUM.'_'.$array[2];
1636
+            } else if ($size == IMAGE_WALL_BIG) {
1637
+                $name = IMAGE_WALL_BIG.'_'.$array[2];
1638
+            } else {
1639
+                $name = IMAGE_WALL_SMALL.'_'.$array[2];
1640 1640
             }
1641 1641
             $lessImage = str_replace($array[2], '', $path);
1642
-            $name = $lessImage . $name;
1642
+            $name = $lessImage.$name;
1643 1643
         }
1644 1644
 
1645 1645
         return $name;
@@ -1747,18 +1747,18 @@  discard block
 block discarded – undo
1747 1747
         if ($number_friends != 0) {
1748 1748
             if ($number_friends > $number_of_images) {
1749 1749
                 if (api_get_user_id() == $user_id) {
1750
-                    $friendHtml.= ' <span><a href="friends.php">'.get_lang('SeeAll').'</a></span>';
1750
+                    $friendHtml .= ' <span><a href="friends.php">'.get_lang('SeeAll').'</a></span>';
1751 1751
                 } else {
1752
-                    $friendHtml.= ' <span>'
1752
+                    $friendHtml .= ' <span>'
1753 1753
                         .'<a href="'.api_get_path(WEB_CODE_PATH).'social/profile_friends_and_groups.inc.php'
1754 1754
                         .'?view=friends&height=390&width=610&user_id='.$user_id.'"'
1755 1755
                         .'class="ajax" data-title="'.get_lang('SeeAll').'" title="'.get_lang('SeeAll').'" >'.get_lang('SeeAll').'</a></span>';
1756 1756
                 }
1757 1757
             }
1758 1758
 
1759
-            $friendHtml.= '<ul class="nav nav-list">';
1759
+            $friendHtml .= '<ul class="nav nav-list">';
1760 1760
             $j = 1;
1761
-            for ($k=0; $k < $number_friends; $k++) {
1761
+            for ($k = 0; $k < $number_friends; $k++) {
1762 1762
                 if ($j > $number_of_images) break;
1763 1763
 
1764 1764
                 if (isset($friends[$k])) {
@@ -1772,26 +1772,26 @@  discard block
 block discarded – undo
1772 1772
                         $statusIcon = Display::span('', array('class' => 'offline_user_in_text'));
1773 1773
                     }
1774 1774
 
1775
-                    $friendHtml.= '<li>';
1776
-                    $friendHtml.= '<div>';
1775
+                    $friendHtml .= '<li>';
1776
+                    $friendHtml .= '<div>';
1777 1777
 
1778 1778
                     // the height = 92 must be the same in the image_friend_network span style in default.css
1779 1779
                     $friends_profile = UserManager::getUserPicture($friend['friend_user_id'], USER_IMAGE_SIZE_SMALL);
1780
-                    $friendHtml.= '<img src="'.$friends_profile.'" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$name_user.'"/>';
1780
+                    $friendHtml .= '<img src="'.$friends_profile.'" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$name_user.'"/>';
1781 1781
                     $link_shared = (empty($link_shared)) ? '' : '&'.$link_shared;
1782
-                    $friendHtml.= $statusIcon .'<a href="profile.php?' .'u=' . $friend['friend_user_id'] . $link_shared . '">' . $name_user .'</a>';
1783
-                    $friendHtml.= '</div>';
1784
-                    $friendHtml.= '</li>';
1782
+                    $friendHtml .= $statusIcon.'<a href="profile.php?'.'u='.$friend['friend_user_id'].$link_shared.'">'.$name_user.'</a>';
1783
+                    $friendHtml .= '</div>';
1784
+                    $friendHtml .= '</li>';
1785 1785
                 }
1786 1786
                 $j++;
1787 1787
             }
1788
-            $friendHtml.='</ul>';
1788
+            $friendHtml .= '</ul>';
1789 1789
         } else {
1790
-            $friendHtml.= '<div class="">'.get_lang('NoFriendsInYourContactList').'<br />'
1791
-                .'<a class="btn btn-primary" href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '. get_lang('TryAndFindSomeFriends').'</a></div>';
1790
+            $friendHtml .= '<div class="">'.get_lang('NoFriendsInYourContactList').'<br />'
1791
+                .'<a class="btn btn-primary" href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '.get_lang('TryAndFindSomeFriends').'</a></div>';
1792 1792
         }
1793 1793
 
1794
-        $friendHtml = Display::panel($friendHtml, get_lang('SocialFriend').' (' . $number_friends . ')' );
1794
+        $friendHtml = Display::panel($friendHtml, get_lang('SocialFriend').' ('.$number_friends.')');
1795 1795
 
1796 1796
         return $friendHtml;
1797 1797
     }
@@ -1812,9 +1812,9 @@  discard block
 block discarded – undo
1812 1812
 
1813 1813
         if ($number_friends != 0) {
1814 1814
 
1815
-            $friendHtml.= '<div class="list-group">';
1815
+            $friendHtml .= '<div class="list-group">';
1816 1816
             $j = 1;
1817
-            for ($k=0; $k < $number_friends; $k++) {
1817
+            for ($k = 0; $k < $number_friends; $k++) {
1818 1818
                 if ($j > $number_of_images) break;
1819 1819
 
1820 1820
                 if (isset($friends[$k])) {
@@ -1823,11 +1823,11 @@  discard block
 block discarded – undo
1823 1823
                     $user_info_friend = api_get_user_info($friend['friend_user_id'], true);
1824 1824
 
1825 1825
                     if ($user_info_friend['user_is_online']) {
1826
-                        $statusIcon = Display::return_icon('statusonline.png',get_lang('Online'));
1827
-                        $status=1;
1826
+                        $statusIcon = Display::return_icon('statusonline.png', get_lang('Online'));
1827
+                        $status = 1;
1828 1828
                     } else {
1829
-                        $statusIcon = Display::return_icon('statusoffline.png',get_lang('Offline'));
1830
-                        $status=0;
1829
+                        $statusIcon = Display::return_icon('statusoffline.png', get_lang('Offline'));
1830
+                        $status = 0;
1831 1831
                     }
1832 1832
 
1833 1833
                     $friendAvatarMedium = UserManager::getUserPicture($friend['friend_user_id'], USER_IMAGE_SIZE_MEDIUM);
@@ -1836,24 +1836,24 @@  discard block
 block discarded – undo
1836 1836
                     $showLinkToChat = api_is_global_chat_enabled() &&
1837 1837
                         $friend['friend_user_id'] != api_get_user_id();
1838 1838
 
1839
-                    if ($showLinkToChat){
1839
+                    if ($showLinkToChat) {
1840 1840
                         $friendHtml .= '<a onclick="javascript:chatWith(\''.$friend['friend_user_id'].'\', \''.$name_user.'\', \''.$status.'\',\''.$friendAvatarSmall.'\')" href="javascript:void(0);" class="list-group-item">';
1841
-                        $friendHtml .=  $friend_avatar.' <span class="username">' . $name_user . '</span>';
1842
-                        $friendHtml .= '<span class="status">' . $statusIcon . '</span>';
1841
+                        $friendHtml .= $friend_avatar.' <span class="username">'.$name_user.'</span>';
1842
+                        $friendHtml .= '<span class="status">'.$statusIcon.'</span>';
1843 1843
                     } else {
1844 1844
                         $link_shared = (empty($link_shared)) ? '' : '&'.$link_shared;
1845
-                        $friendHtml .= '<a href="profile.php?' .'u=' . $friend['friend_user_id'] . $link_shared . '" class="list-group-item">';
1846
-                        $friendHtml .=  $friend_avatar.' <span class="username-all">' . $name_user . '</span>';
1845
+                        $friendHtml .= '<a href="profile.php?'.'u='.$friend['friend_user_id'].$link_shared.'" class="list-group-item">';
1846
+                        $friendHtml .= $friend_avatar.' <span class="username-all">'.$name_user.'</span>';
1847 1847
                     }
1848 1848
 
1849 1849
                     $friendHtml .= '</a>';
1850 1850
                 }
1851 1851
                 $j++;
1852 1852
             }
1853
-            $friendHtml.='</div>';
1853
+            $friendHtml .= '</div>';
1854 1854
         } else {
1855
-            $friendHtml.= '<div class="help">'.get_lang('NoFriendsInYourContactList').' '
1856
-                .'<a href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '. get_lang('TryAndFindSomeFriends').'</a></div>';
1855
+            $friendHtml .= '<div class="help">'.get_lang('NoFriendsInYourContactList').' '
1856
+                .'<a href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '.get_lang('TryAndFindSomeFriends').'</a></div>';
1857 1857
         }
1858 1858
 
1859 1859
         return $friendHtml;
@@ -1871,7 +1871,7 @@  discard block
 block discarded – undo
1871 1871
                 'post',
1872 1872
                 api_get_path(WEB_CODE_PATH).'social/profile.php'.$userId,
1873 1873
                 null,
1874
-                array('enctype' => 'multipart/form-data') ,
1874
+                array('enctype' => 'multipart/form-data'),
1875 1875
                 FormValidator::LAYOUT_HORIZONTAL    
1876 1876
             );
1877 1877
 
Please login to merge, or discard this patch.