Completed
Push — 1.10.x ( e39098...d9ba33 )
by Julito
34:46
created
main/wiki/diff.inc.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -137,19 +137,19 @@  discard block
 block discarded – undo
137 137
     switch ($type) {
138 138
         case DIFF_EQUAL:
139 139
             // return $line. ' : ' . ' = <span class="diffEqual" >' . $value . '</span><br />' . "\n" ;
140
-            return '<span class="diffEqual" >' . $value . '</span><br />' . "\n"; //juan carlos muestra solo color
140
+            return '<span class="diffEqual" >'.$value.'</span><br />'."\n"; //juan carlos muestra solo color
141 141
             break;
142 142
         case DIFF_MOVED:
143 143
             //return $line. ' : ' . ' M <span class="diffMoved" >' . $value . '</span><br />' . "\n" ; //juan carlos ra�a  la sustitye la inverior
144
-            return '<span class="diffMoved" >' . $value . '</span><br />' . "\n"; //juan carlos muestra solo color
144
+            return '<span class="diffMoved" >'.$value.'</span><br />'."\n"; //juan carlos muestra solo color
145 145
             break;
146 146
         case DIFF_ADDED:
147 147
             //return $line . ' : ' . ' + <span class="diffAdded" >' . $value . '</span><br />' . "\n" ;
148
-            return '<span class="diffAdded" >' . $value . '</span><br />' . "\n"; //juan carlos muestra solo color
148
+            return '<span class="diffAdded" >'.$value.'</span><br />'."\n"; //juan carlos muestra solo color
149 149
             break;
150 150
         case DIFF_DELETED:
151 151
             //return $line . ' : ' . ' - <span class="diffDeleted" >' . $value . '</span><br />' . "\n" ; //juan carlos ra�a  la sustitye la inverior
152
-            return '<span class="diffDeleted" >' . $value . '</span><br />' . "\n"; //juan carlos muestra solo color
152
+            return '<span class="diffDeleted" >'.$value.'</span><br />'."\n"; //juan carlos muestra solo color
153 153
             break;
154 154
     }
155 155
 }
@@ -169,19 +169,19 @@  discard block
 block discarded – undo
169 169
     switch ($type) {
170 170
         case DIFF_EQUAL:
171 171
             //return '<tr><td>' . $line. '&nbsp;:&nbsp;' . '&nbsp;=</td><td><span class="diffEqual" >'                    . $value . '</span></td></tr>' . "\n"; //juan carlos comentado
172
-            return '<tr><td></td><td bgcolor="#FFFFFF">' . $value . '</td></tr>' . "\n"; //juan carlos muestra solo color (no tambi�n la l�nea). Adem�s EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que est� definido en la hoja de estilos como background-color, aceptando s�lo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, adem�s los cambios de otros objetos que no sean texto no se indican por ej. a�adir una imagen, por esta raz�n doy el color de fondo al td directamente.
172
+            return '<tr><td></td><td bgcolor="#FFFFFF">'.$value.'</td></tr>'."\n"; //juan carlos muestra solo color (no tambi�n la l�nea). Adem�s EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que est� definido en la hoja de estilos como background-color, aceptando s�lo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, adem�s los cambios de otros objetos que no sean texto no se indican por ej. a�adir una imagen, por esta raz�n doy el color de fondo al td directamente.
173 173
             break;
174 174
         case DIFF_MOVED:
175 175
             // return '<tr><td>' . $line. '&nbsp;:&nbsp;' . '&nbsp;M</td><td><span class="diffMoved" >'                    . $value . '</span></td></tr>' . "\n" //juan carlos comenta
176 176
 
177
-            return '<tr><td></td><td bgcolor="#FFFFAA">' . $value . '</td></tr>' . "\n"; //juan carlos muestra solo color (no tambi�n la l�nea). Adem�s EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que est� definido en la hoja de estilos como background-color, aceptando s�lo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, adem�s los cambios de otros objetos que no sean texto no se indican por ej. a�adir una imagen, por esta raz�n doy el color de fondo al td directamente.
177
+            return '<tr><td></td><td bgcolor="#FFFFAA">'.$value.'</td></tr>'."\n"; //juan carlos muestra solo color (no tambi�n la l�nea). Adem�s EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que est� definido en la hoja de estilos como background-color, aceptando s�lo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, adem�s los cambios de otros objetos que no sean texto no se indican por ej. a�adir una imagen, por esta raz�n doy el color de fondo al td directamente.
178 178
             break;
179 179
         case DIFF_ADDED:
180 180
             // return '<tr><td>' . $line. '&nbsp;:&nbsp;' . '&nbsp;+</td><td><span class="diffAdded" >'                    . $value . '</span></td></tr>' . "\n" ; //juan carlos comentado
181
-            return '<tr><td></td><td bgcolor="#CCFFCC">' . $value . '</td></tr>' . "\n"; //juan carlos muestra solo color (no tambi�n la l�nea). Adem�s EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que est� definido en la hoja de estilos como background-color, aceptando s�lo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, adem�s los cambios de otros objetos que no sean texto no se indican por ej. a�adir una imagen, por esta raz�n doy el color de fondo al td directamente.
181
+            return '<tr><td></td><td bgcolor="#CCFFCC">'.$value.'</td></tr>'."\n"; //juan carlos muestra solo color (no tambi�n la l�nea). Adem�s EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que est� definido en la hoja de estilos como background-color, aceptando s�lo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, adem�s los cambios de otros objetos que no sean texto no se indican por ej. a�adir una imagen, por esta raz�n doy el color de fondo al td directamente.
182 182
             break;
183 183
         case DIFF_DELETED:
184 184
             // return '<tr><td>' . $line. '&nbsp;:&nbsp;' . '&nbsp;-</td><td><span class="diffDeleted" >'                    . $value . '</span></td></tr>' . "\n" ; //juan carlos comentado
185
-            return '<tr><td></td><td bgcolor="#FFAAAA">' . $value . '</td></tr>' . "\n"; //juan carlos muestra solo color (no tambi�n la l�nea). Adem�s EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que est� definido en la hoja de estilos como background-color, aceptando s�lo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, adem�s los cambios de otros objetos que no sean texto no se indican por ej. a�adir una imagen, por esta raz�n doy el color de fondo al td directamente.
185
+            return '<tr><td></td><td bgcolor="#FFAAAA">'.$value.'</td></tr>'."\n"; //juan carlos muestra solo color (no tambi�n la l�nea). Adem�s EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que est� definido en la hoja de estilos como background-color, aceptando s�lo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, adem�s los cambios de otros objetos que no sean texto no se indican por ej. a�adir una imagen, por esta raz�n doy el color de fondo al td directamente.
186 186
     }
187 187
 }
Please login to merge, or discard this patch.
main/wiki/index.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
 // section (for the tabs)
20 20
 $this_section = SECTION_COURSES;
21
-$current_course_tool  = TOOL_WIKI;
21
+$current_course_tool = TOOL_WIKI;
22 22
 
23 23
 $course_id = api_get_course_int_id();
24 24
 $session_id = api_get_session_id();
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 $groupId = api_get_group_id();
28 28
 
29 29
 // additional style information
30
-$htmlHeadXtra[] ='<link rel="stylesheet" type="text/css" href="'.api_get_path(WEB_CODE_PATH).'wiki/css/default.css"/>';
30
+$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="'.api_get_path(WEB_CODE_PATH).'wiki/css/default.css"/>';
31 31
 
32 32
 // javascript for advanced parameters menu
33 33
 $htmlHeadXtra[] = '<script>
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     //ensure this tool in groups whe it's private or deactivated
73 73
     if ($group_properties['wiki_state'] == 0) {
74 74
         api_not_allowed();
75
-    } elseif ($group_properties['wiki_state']==2) {
75
+    } elseif ($group_properties['wiki_state'] == 2) {
76 76
         if (!api_is_allowed_to_edit(false, true) and
77 77
             !GroupManager :: is_user_in_group(api_get_user_id(), api_get_group_id())
78 78
         ) {
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 $is_allowed_to_edit = api_is_allowed_to_edit(false, true);
85 85
 
86 86
 // The page we are dealing with
87
-$page = isset($_GET['title']) ? $_GET['title']: 'index';
87
+$page = isset($_GET['title']) ? $_GET['title'] : 'index';
88 88
 $action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : 'showpage';
89 89
 $view = isset($_GET['view']) ? Security::remove_XSS($_GET['view']) : null;
90 90
 
Please login to merge, or discard this patch.
main/wiki/wiki.inc.php 2 patches
Braces   +4 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1878,7 +1878,7 @@  discard block
 block discarded – undo
1878 1878
                 $email_body = get_lang('DearUser').' '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).',<br /><br />';
1879 1879
                 if($session_id==0){
1880 1880
                     $email_body .= $emailtext.' <strong>'.$_course['name'].' - '.$group_name.'</strong><br /><br /><br />';
1881
-                }else{
1881
+                } else{
1882 1882
                     $email_body .= $emailtext.' <strong>'.$_course['name'].' ('.api_get_session_name(api_get_session_id()).') - '.$group_name.'</strong><br /><br /><br />';
1883 1883
                 }
1884 1884
                 $email_body .= $email_user_author.' ('.$email_date_changes.')<br /><br /><br />';
@@ -2261,8 +2261,7 @@  discard block
 block discarded – undo
2261 2261
                                         s1.reflink = s2.reflink AND
2262 2262
                                         ".$groupfilter.$condition_session.")";
2263 2263
                     // warning don't use group by reflink because don't return the last version
2264
-                }
2265
-                else {
2264
+                } else {
2266 2265
                     $sql = " SELECT * FROM ".$tbl_wiki." s1
2267 2266
                             WHERE
2268 2267
                                 s1.c_id = $course_id AND
@@ -3696,8 +3695,7 @@  discard block
 block discarded – undo
3696 3695
                 '.api_htmlentities($obj->title).'</a>';
3697 3696
                 if ($obj->user_id <>0) {
3698 3697
                     $row[] = UserManager::getUserProfileLink($userinfo);
3699
-                }
3700
-                else {
3698
+                } else {
3701 3699
                     $row[] = get_lang('Anonymous').' ('.api_htmlentities($obj->user_ip).')';
3702 3700
                 }
3703 3701
                 $row[] = api_get_local_time($obj->dtime, null, date_default_timezone_get());
@@ -3932,8 +3930,7 @@  discard block
 block discarded – undo
3932 3930
                         api_htmlentities($obj->title).'</a>';
3933 3931
                     if ($obj->user_id <>0) {
3934 3932
                         $row[] = UserManager::getUserProfileLink($userinfo);
3935
-                    }
3936
-                    else {
3933
+                    } else {
3937 3934
                         $row[] = get_lang('Anonymous').' ('.$obj->user_ip.')';
3938 3935
                     }
3939 3936
                     $row[] = $year.'-'.$month.'-'.$day.' '.$hours.":".$minutes.":".$seconds;
Please login to merge, or discard this patch.
Spacing   +647 added lines, -647 removed lines patch added patch discarded remove patch
@@ -99,25 +99,25 @@  discard block
 block discarded – undo
99 99
      **/
100 100
     public function links_to($input)
101 101
     {
102
-        $input_array = preg_split("/(\[\[|\]\])/",$input,-1, PREG_SPLIT_DELIM_CAPTURE);
102
+        $input_array = preg_split("/(\[\[|\]\])/", $input, -1, PREG_SPLIT_DELIM_CAPTURE);
103 103
         $all_links = array();
104 104
 
105 105
         foreach ($input_array as $key=>$value) {
106
-            if (isset($input_array[$key-1]) && $input_array[$key-1] == '[[' &&
107
-                isset($input_array[$key+1]) && $input_array[$key+1] == ']]'
106
+            if (isset($input_array[$key - 1]) && $input_array[$key - 1] == '[[' &&
107
+                isset($input_array[$key + 1]) && $input_array[$key + 1] == ']]'
108 108
             ) {
109 109
                 if (api_strpos($value, "|") !== false) {
110
-                    $full_link_array=explode("|", $value);
111
-                    $link=trim($full_link_array[0]);
112
-                    $title=trim($full_link_array[1]);
110
+                    $full_link_array = explode("|", $value);
111
+                    $link = trim($full_link_array[0]);
112
+                    $title = trim($full_link_array[1]);
113 113
                 } else {
114
-                    $link=trim($value);
115
-                    $title=trim($value);
114
+                    $link = trim($value);
115
+                    $title = trim($value);
116 116
                 }
117
-                unset($input_array[$key-1]);
118
-                unset($input_array[$key+1]);
117
+                unset($input_array[$key - 1]);
118
+                unset($input_array[$key + 1]);
119 119
                 //replace blank spaces by _ within the links. But to remove links at the end add a blank space
120
-                $all_links[]= Database::escape_string(str_replace(' ','_',$link)).' ';
120
+                $all_links[] = Database::escape_string(str_replace(' ', '_', $link)).' ';
121 121
             }
122 122
         }
123 123
         $output = implode($all_links);
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
      **/
132 132
     public function detect_external_link($input)
133 133
     {
134
-        $exlink='href=';
135
-        $exlinkStyle='class="wiki_link_ext" href=';
136
-        $output=str_replace($exlink, $exlinkStyle, $input);
134
+        $exlink = 'href=';
135
+        $exlinkStyle = 'class="wiki_link_ext" href=';
136
+        $output = str_replace($exlink, $exlinkStyle, $input);
137 137
         return $output;
138 138
     }
139 139
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     public function detect_anchor_link($input)
145 145
     {
146 146
         $anchorlink = 'href="#';
147
-        $anchorlinkStyle='class="wiki_anchor_link" href="#';
147
+        $anchorlinkStyle = 'class="wiki_anchor_link" href="#';
148 148
         $output = str_replace($anchorlink, $anchorlinkStyle, $input);
149 149
 
150 150
         return $output;
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      **/
170 170
     public function detect_ftp_link($input)
171 171
     {
172
-        $ftplink='href="ftp';
172
+        $ftplink = 'href="ftp';
173 173
         $ftplinkStyle = 'class="wiki_ftp_link" href="ftp';
174 174
         $output = str_replace($ftplink, $ftplinkStyle, $input);
175 175
 
@@ -214,21 +214,21 @@  discard block
 block discarded – undo
214 214
     {
215 215
         $groupId = api_get_group_id();
216 216
         //now doubles brackets
217
-        $input_array = preg_split("/(\[\[|\]\])/",$input,-1, PREG_SPLIT_DELIM_CAPTURE);
217
+        $input_array = preg_split("/(\[\[|\]\])/", $input, -1, PREG_SPLIT_DELIM_CAPTURE);
218 218
 
219 219
         foreach ($input_array as $key => $value) {
220 220
             //now doubles brackets
221
-            if (isset($input_array[$key-1]) && $input_array[$key-1] == '[[' AND
222
-                $input_array[$key+1] == ']]'
221
+            if (isset($input_array[$key - 1]) && $input_array[$key - 1] == '[[' AND
222
+                $input_array[$key + 1] == ']]'
223 223
             ) {
224 224
                 // now full wikilink
225
-                if (api_strpos($value, "|") !== false){
226
-                    $full_link_array=explode("|", $value);
227
-                    $link=trim(strip_tags($full_link_array[0]));
228
-                    $title=trim($full_link_array[1]);
225
+                if (api_strpos($value, "|") !== false) {
226
+                    $full_link_array = explode("|", $value);
227
+                    $link = trim(strip_tags($full_link_array[0]));
228
+                    $title = trim($full_link_array[1]);
229 229
                 } else {
230
-                    $link=trim(strip_tags($value));
231
-                    $title=trim($value);
230
+                    $link = trim(strip_tags($value));
231
+                    $title = trim($value);
232 232
                 }
233 233
 
234 234
                 //if wikilink is homepage
@@ -240,17 +240,17 @@  discard block
 block discarded – undo
240 240
                 }
241 241
 
242 242
                 // note: checkreflink checks if the link is still free. If it is not used then it returns true, if it is used, then it returns false. Now the title may be different
243
-                if (self::checktitle(strtolower(str_replace(' ','_',$link)))) {
243
+                if (self::checktitle(strtolower(str_replace(' ', '_', $link)))) {
244 244
                     $link = api_html_entity_decode($link);
245
-                    $input_array[$key]='<a href="'.api_get_path(WEB_PATH).'main/wiki/index.php?'.api_get_cidreq().'&action=addnew&amp;title='.Security::remove_XSS($link).'&group_id='.$groupId.'" class="new_wiki_link">'.$title.'</a>';
245
+                    $input_array[$key] = '<a href="'.api_get_path(WEB_PATH).'main/wiki/index.php?'.api_get_cidreq().'&action=addnew&amp;title='.Security::remove_XSS($link).'&group_id='.$groupId.'" class="new_wiki_link">'.$title.'</a>';
246 246
                 } else {
247
-                    $input_array[$key]='<a href="'.api_get_path(WEB_PATH).'main/wiki/index.php?'.api_get_cidreq().'&action=showpage&amp;title='.urlencode(strtolower(str_replace(' ','_',$link))).'&group_id='.$groupId.'" class="wiki_link">'.$title.'</a>';
247
+                    $input_array[$key] = '<a href="'.api_get_path(WEB_PATH).'main/wiki/index.php?'.api_get_cidreq().'&action=showpage&amp;title='.urlencode(strtolower(str_replace(' ', '_', $link))).'&group_id='.$groupId.'" class="wiki_link">'.$title.'</a>';
248 248
                 }
249
-                unset($input_array[$key-1]);
250
-                unset($input_array[$key+1]);
249
+                unset($input_array[$key - 1]);
250
+                unset($input_array[$key + 1]);
251 251
             }
252 252
         }
253
-        $output = implode('',$input_array);
253
+        $output = implode('', $input_array);
254 254
         return $output;
255 255
     }
256 256
 
@@ -292,11 +292,11 @@  discard block
 block discarded – undo
292 292
         // are not made here, but through the interce buttons
293 293
 
294 294
         // cleaning the variables
295
-        if (api_get_setting('htmlpurifier_wiki') == 'true'){
295
+        if (api_get_setting('htmlpurifier_wiki') == 'true') {
296 296
             //$purifier = new HTMLPurifier();
297 297
             $values['content'] = Security::remove_XSS($values['content']);
298 298
         }
299
-        $version = intval($values['version']) + 1 ;
299
+        $version = intval($values['version']) + 1;
300 300
         $linkTo = self::links_to($values['content']); //and check links content
301 301
 
302 302
         //cleaning config variables
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
             $_clean['startdate_assig'] = '0000-00-00 00:00:00';
320 320
         }
321 321
 
322
-        if (isset($values['initenddate']) && $values['initenddate']==1) {
322
+        if (isset($values['initenddate']) && $values['initenddate'] == 1) {
323 323
             $_clean['enddate_assig'] = $values['enddate_assig'];
324 324
         } else {
325 325
             $_clean['enddate_assig'] = '0000-00-00 00:00:00';
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
         }
331 331
 
332 332
         if (!empty($values['max_text']) || !empty($values['max_version'])) {
333
-            $_clean['max_text']	= $values['max_text'];
333
+            $_clean['max_text'] = $values['max_text'];
334 334
             $_clean['max_version'] = $values['max_version'];
335 335
         }
336 336
 
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
                 $groupId
382 382
             );
383 383
 
384
-            if ($values['page_id']== 0) {
384
+            if ($values['page_id'] == 0) {
385 385
                 $sql = 'UPDATE '.$tbl_wiki.' SET page_id="'.$id.'"
386 386
                         WHERE c_id = '.$course_id.' AND iid ="'.$id.'"';
387 387
                 Database::query($sql);
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
         $_course = $this->courseInfo;
466 466
         $r_user_id = api_get_user_id();
467 467
         $r_dtime = api_get_utc_datetime();
468
-        $r_version = $r_version+1;
468
+        $r_version = $r_version + 1;
469 469
         $r_comment = get_lang('RestoredFromVersion').': '.$c_version;
470 470
         $session_id = api_get_session_id();
471 471
         $course_id = api_get_course_int_id();
@@ -570,9 +570,9 @@  discard block
 block discarded – undo
570 570
         // Unlike ordinary pages of pages of assignments.
571 571
         // Allow create a ordinary page although there is a assignment with the same name
572 572
         if ($_clean['assignment'] == 2 || $_clean['assignment'] == 1) {
573
-            $page = str_replace(' ','_',$values['title']."_uass".$assig_user_id);
573
+            $page = str_replace(' ', '_', $values['title']."_uass".$assig_user_id);
574 574
         } else {
575
-            $page = str_replace(' ','_',$values['title']);
575
+            $page = str_replace(' ', '_', $values['title']);
576 576
         }
577 577
         $_clean['reflink'] = $page;
578 578
         $_clean['title']   = trim($values['title']);
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 
609 609
         $groupId = api_get_group_id();
610 610
 
611
-        $_clean['linksto'] = self::links_to($_clean['content']);	//check wikilinks
611
+        $_clean['linksto'] = self::links_to($_clean['content']); //check wikilinks
612 612
 
613 613
         // cleaning config variables
614 614
         $_clean['task'] = isset($values['task']) ? $values['task'] : '';
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
      */
725 725
     public function setForm($form, $row = array())
726 726
     {
727
-        $toolBar = api_is_allowed_to_edit(null,true)
727
+        $toolBar = api_is_allowed_to_edit(null, true)
728 728
             ? array('ToolbarSet' => 'Wiki', 'Width' => '100%', 'Height' => '400')
729 729
             : array('ToolbarSet' => 'WikiStudent', 'Width' => '100%', 'Height' => '400', 'UserStatus' => 'student');
730 730
 
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
 
736 736
         $form->addElement('select', 'progress', get_lang('Progress'), $progress);
737 737
 
738
-        if ((api_is_allowed_to_edit(false,true) ||
738
+        if ((api_is_allowed_to_edit(false, true) ||
739 739
             api_is_platform_admin()) &&
740 740
             isset($row['reflink']) && $row['reflink'] != 'index'
741 741
         ) {
@@ -875,13 +875,13 @@  discard block
 block discarded – undo
875 875
         if ($newtitle) {
876 876
             $pageMIX = $newtitle; //display the page after it is created
877 877
         } else {
878
-            $pageMIX = $page;//display current page
878
+            $pageMIX = $page; //display current page
879 879
         }
880 880
 
881 881
         $filter = null;
882 882
         if (isset($_GET['view']) && $_GET['view']) {
883 883
             $_clean['view'] = Database::escape_string($_GET['view']);
884
-            $filter =' AND w.id="'.$_clean['view'].'"';
884
+            $filter = ' AND w.id="'.$_clean['view'].'"';
885 885
         }
886 886
 
887 887
         // First, check page visibility in the first page version
@@ -923,14 +923,14 @@  discard block
 block discarded – undo
923 923
         }
924 924
 
925 925
         // if both are empty and we are displaying the index page then we display the default text.
926
-        if ($row['content']=='' && $row['title']=='' && $page=='index') {
926
+        if ($row['content'] == '' && $row['title'] == '' && $page == 'index') {
927 927
             if (api_is_allowed_to_edit(false, true) ||
928 928
                 api_is_platform_admin() ||
929 929
                 GroupManager::is_user_in_group(api_get_user_id(), api_get_group_id())
930 930
             ) {
931 931
                 //Table structure for better export to pdf
932
-                $default_table_for_content_Start='<table align="center" border="0"><tr><td align="center">';
933
-                $default_table_for_content_End='</td></tr></table>';
932
+                $default_table_for_content_Start = '<table align="center" border="0"><tr><td align="center">';
933
+                $default_table_for_content_End = '</td></tr></table>';
934 934
                 $content = $default_table_for_content_Start.
935 935
                     sprintf(get_lang('DefaultContent'), api_get_path(WEB_IMG_PATH)).
936 936
                     $default_table_for_content_End;
@@ -945,23 +945,23 @@  discard block
 block discarded – undo
945 945
 
946 946
         //assignment mode: identify page type
947 947
         $icon_assignment = null;
948
-        if ($row['assignment']==1) {
949
-            $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'),'',ICON_SIZE_SMALL);
950
-        } elseif($row['assignment']==2) {
951
-            $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
948
+        if ($row['assignment'] == 1) {
949
+            $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'), '', ICON_SIZE_SMALL);
950
+        } elseif ($row['assignment'] == 2) {
951
+            $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
952 952
         }
953 953
 
954 954
         //task mode
955 955
         $icon_task = null;
956 956
         if (!empty($row['task'])) {
957
-            $icon_task=Display::return_icon('wiki_task.png', get_lang('StandardTask'),'',ICON_SIZE_SMALL);
957
+            $icon_task = Display::return_icon('wiki_task.png', get_lang('StandardTask'), '', ICON_SIZE_SMALL);
958 958
         }
959 959
 
960 960
         // Show page. Show page to all users if isn't hide page. Mode assignments: if student is the author, can view
961 961
         if ($KeyVisibility == "1" ||
962 962
             api_is_allowed_to_edit(false, true) ||
963 963
             api_is_platform_admin() ||
964
-            ($row['assignment'] == 2 && $KeyVisibility=="0" && (api_get_user_id() == $row['user_id']))
964
+            ($row['assignment'] == 2 && $KeyVisibility == "0" && (api_get_user_id() == $row['user_id']))
965 965
         ) {
966 966
             $actionsLeft = '';
967 967
 
@@ -986,13 +986,13 @@  discard block
 block discarded – undo
986 986
             $protect_page = null;
987 987
             $lock_unlock_protect = null;
988 988
             // page action: protecting (locking) the page
989
-            if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
990
-                if (self::check_protect_page()==1) {
989
+            if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
990
+                if (self::check_protect_page() == 1) {
991 991
                     $protect_page = Display::return_icon('lock.png', get_lang('PageLockedExtra'), '', ICON_SIZE_MEDIUM);
992
-                    $lock_unlock_protect='unlock';
992
+                    $lock_unlock_protect = 'unlock';
993 993
                 } else {
994 994
                     $protect_page = Display::return_icon('unlock.png', get_lang('PageUnlockedExtra'), '', ICON_SIZE_MEDIUM);
995
-                    $lock_unlock_protect='lock';
995
+                    $lock_unlock_protect = 'lock';
996 996
                 }
997 997
             }
998 998
 
@@ -1004,13 +1004,13 @@  discard block
 block discarded – undo
1004 1004
             $visibility_page = null;
1005 1005
             $lock_unlock_visibility = null;
1006 1006
             //page action: visibility
1007
-            if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
1007
+            if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
1008 1008
                 if (self::check_visibility_page() == 1) {
1009
-                    $visibility_page = Display::return_icon('visible.png', get_lang('ShowPageExtra'),'', ICON_SIZE_MEDIUM);
1009
+                    $visibility_page = Display::return_icon('visible.png', get_lang('ShowPageExtra'), '', ICON_SIZE_MEDIUM);
1010 1010
                     $lock_unlock_visibility = 'invisible';
1011 1011
 
1012 1012
                 } else {
1013
-                    $visibility_page = Display::return_icon('invisible.png', get_lang('HidePageExtra'),'', ICON_SIZE_MEDIUM);
1013
+                    $visibility_page = Display::return_icon('invisible.png', get_lang('HidePageExtra'), '', ICON_SIZE_MEDIUM);
1014 1014
                     $lock_unlock_visibility = 'visible';
1015 1015
                 }
1016 1016
             }
@@ -1022,11 +1022,11 @@  discard block
 block discarded – undo
1022 1022
 
1023 1023
             //page action: notification
1024 1024
             if (api_is_allowed_to_session_edit()) {
1025
-                if (self::check_notify_page($page)==1) {
1026
-                    $notify_page = Display::return_icon('messagebox_info.png', get_lang('NotifyByEmail'),'',ICON_SIZE_MEDIUM);
1025
+                if (self::check_notify_page($page) == 1) {
1026
+                    $notify_page = Display::return_icon('messagebox_info.png', get_lang('NotifyByEmail'), '', ICON_SIZE_MEDIUM);
1027 1027
                     $lock_unlock_notify_page = 'unlocknotify';
1028 1028
                 } else {
1029
-                    $notify_page = Display::return_icon('mail.png', get_lang('CancelNotifyByEmail'),'',ICON_SIZE_MEDIUM);
1029
+                    $notify_page = Display::return_icon('mail.png', get_lang('CancelNotifyByEmail'), '', ICON_SIZE_MEDIUM);
1030 1030
                     $lock_unlock_notify_page = 'locknotify';
1031 1031
                 }
1032 1032
             }
@@ -1038,33 +1038,33 @@  discard block
 block discarded – undo
1038 1038
                 ) {
1039 1039
                     // menu discuss page
1040 1040
                     $actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=discuss&title='.api_htmlentities(urlencode($page)).'" '.self::is_active_navigation_tab('discuss').'>'.
1041
-                        Display::return_icon('discuss.png',get_lang('DiscussThisPage'),'',ICON_SIZE_MEDIUM).'</a>';
1041
+                        Display::return_icon('discuss.png', get_lang('DiscussThisPage'), '', ICON_SIZE_MEDIUM).'</a>';
1042 1042
                 }
1043 1043
 
1044 1044
                 //menu history
1045 1045
                 $actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=history&title='.api_htmlentities(urlencode($page)).'" '.self::is_active_navigation_tab('history').'>'.
1046
-                    Display::return_icon('history.png',get_lang('ShowPageHistory'),'',ICON_SIZE_MEDIUM).'</a>';
1046
+                    Display::return_icon('history.png', get_lang('ShowPageHistory'), '', ICON_SIZE_MEDIUM).'</a>';
1047 1047
                 //menu linkspages
1048 1048
                 $actionsRight .= '<a href="index.php?'.api_get_cidreq().'action=links&title='.api_htmlentities(urlencode($page)).'" '.self::is_active_navigation_tab('links').'>'.
1049
-                    Display::return_icon('what_link_here.png',get_lang('LinksPages'),'',ICON_SIZE_MEDIUM).'</a>';
1049
+                    Display::return_icon('what_link_here.png', get_lang('LinksPages'), '', ICON_SIZE_MEDIUM).'</a>';
1050 1050
 
1051 1051
                 //menu delete wikipage
1052
-                if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
1052
+                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
1053 1053
                     $actionsRight .= '<a href="index.php?action=delete&'.api_get_cidreq().'&title='.api_htmlentities(urlencode($page)).'"'.self::is_active_navigation_tab('delete').'>'.
1054
-                        Display::return_icon('delete.png',get_lang('DeleteThisPage'),'',ICON_SIZE_MEDIUM).'</a>';
1054
+                        Display::return_icon('delete.png', get_lang('DeleteThisPage'), '', ICON_SIZE_MEDIUM).'</a>';
1055 1055
                 }
1056 1056
 
1057 1057
                 $actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=showpage&actionpage='.$lock_unlock_notify_page.'&title='.api_htmlentities(urlencode($page)).'">'.
1058 1058
                     $notify_page.'</a>';
1059 1059
 
1060 1060
                 // Page action: copy last version to doc area
1061
-                if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
1061
+                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
1062 1062
                     $actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=export2doc&wiki_id='.$row['id'].'">'.
1063 1063
                         Display::return_icon('export_to_documents.png', get_lang('ExportToDocArea'), '', ICON_SIZE_MEDIUM).'</a>';
1064 1064
                 }
1065 1065
 
1066 1066
                 $actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=export_to_pdf&wiki_id='.$row['id'].'">'.
1067
-                    Display::return_icon('pdf.png',get_lang('ExportToPDF'),'',ICON_SIZE_MEDIUM).'</a>';
1067
+                    Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a>';
1068 1068
 
1069 1069
                 $unoconv = api_get_configuration_value('unoconv.binaries');
1070 1070
                 if ($unoconv) {
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
                     )
1121 1121
                 );
1122 1122
 
1123
-            $footerWiki = '<div id="wikifooter">'.get_lang('Progress').': '.($row['progress']*10).'%&nbsp;&nbsp;&nbsp;'.get_lang('Rating').': '.$row['score'].'&nbsp;&nbsp;&nbsp;'.get_lang('Words').': '.self::word_count($content).'</div>';
1123
+            $footerWiki = '<div id="wikifooter">'.get_lang('Progress').': '.($row['progress'] * 10).'%&nbsp;&nbsp;&nbsp;'.get_lang('Rating').': '.$row['score'].'&nbsp;&nbsp;&nbsp;'.get_lang('Words').': '.self::word_count($content).'</div>';
1124 1124
 
1125 1125
             echo Display::panel($pageWiki, $pageTitle, $footerWiki);
1126 1126
         } //end filter visibility
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
 
1145 1145
         # strip all html tags
1146 1146
         $wc = strip_tags($document);
1147
-        $wc = html_entity_decode($wc, ENT_NOQUOTES, 'UTF-8');// TODO:test also old html_entity_decode(utf8_encode($wc))
1147
+        $wc = html_entity_decode($wc, ENT_NOQUOTES, 'UTF-8'); // TODO:test also old html_entity_decode(utf8_encode($wc))
1148 1148
 
1149 1149
         # remove 'words' that don't consist of alphanumerical characters or punctuation. And fix accents and some letters
1150 1150
         $pattern = "#[^(\w|\d|\'|\"|\.|\!|\?|;|,|\\|\/|\-|:|\&|@|á|é|í|ó|ú|à|è|ì|ò|ù|ä|ë|ï|ö|ü|Á|É|Í|Ó|Ú|À|È|Ò|Ù|Ä|Ë|Ï|Ö|Ü|â|ê|î|ô|û|Â|Ê|Î|Ô|Û|ñ|Ñ|ç|Ç)]+#";
@@ -1177,15 +1177,15 @@  discard block
 block discarded – undo
1177 1177
 
1178 1178
         $course_id = api_get_course_int_id();
1179 1179
 
1180
-        $sql='SELECT id FROM '.$tbl_wiki.'
1180
+        $sql = 'SELECT id FROM '.$tbl_wiki.'
1181 1181
               WHERE
1182 1182
                 c_id = '.$course_id.' AND
1183 1183
                 title="'.Database::escape_string($title).'" AND
1184 1184
                 '.$groupfilter.$condition_session.'
1185 1185
               ORDER BY id ASC';
1186
-        $result=Database::query($sql);
1187
-        $cant=Database::num_rows($result);
1188
-        if ($cant>0) {
1186
+        $result = Database::query($sql);
1187
+        $cant = Database::num_rows($result);
1188
+        if ($cant > 0) {
1189 1189
             return true;
1190 1190
         } else {
1191 1191
             return false;
@@ -1267,20 +1267,20 @@  discard block
 block discarded – undo
1267 1267
         $page = $this->page;
1268 1268
 
1269 1269
         $course_id = api_get_course_int_id();
1270
-        $sql='SELECT * FROM '.$tbl_wiki.'
1270
+        $sql = 'SELECT * FROM '.$tbl_wiki.'
1271 1271
               WHERE
1272 1272
                 c_id = '.$course_id.' AND
1273 1273
                 reflink="'.Database::escape_string($page).'" AND
1274 1274
                 '.$groupfilter.$condition_session.'
1275 1275
               ORDER BY id ASC';
1276 1276
 
1277
-        $result=Database::query($sql);
1278
-        $row=Database::fetch_array($result);
1277
+        $result = Database::query($sql);
1278
+        $row = Database::fetch_array($result);
1279 1279
         $status_editlock = $row['editlock'];
1280 1280
         $id = $row['id'];
1281 1281
 
1282 1282
         ///change status
1283
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
1283
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
1284 1284
             if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'lock' && $status_editlock == 0) {
1285 1285
                 $status_editlock = 1;
1286 1286
             }
@@ -1292,13 +1292,13 @@  discard block
 block discarded – undo
1292 1292
                     WHERE c_id = '.$course_id.' AND id="'.$id.'"';
1293 1293
             Database::query($sql);
1294 1294
 
1295
-            $sql='SELECT * FROM '.$tbl_wiki.'
1295
+            $sql = 'SELECT * FROM '.$tbl_wiki.'
1296 1296
                   WHERE
1297 1297
                     c_id = '.$course_id.' AND
1298 1298
                     reflink="'.Database::escape_string($page).'" AND
1299 1299
                     '.$groupfilter.$condition_session.'
1300 1300
                   ORDER BY id ASC';
1301
-            $result=Database::query($sql);
1301
+            $result = Database::query($sql);
1302 1302
             $row = Database::fetch_array($result);
1303 1303
         }
1304 1304
 
@@ -1329,13 +1329,13 @@  discard block
 block discarded – undo
1329 1329
         $row = Database::fetch_array($result);
1330 1330
         $status_visibility = $row['visibility'];
1331 1331
         //change status
1332
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
1333
-            if (isset($_GET['actionpage']) && $_GET['actionpage']=='visible' && $status_visibility==0) {
1334
-                $status_visibility=1;
1332
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
1333
+            if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'visible' && $status_visibility == 0) {
1334
+                $status_visibility = 1;
1335 1335
 
1336 1336
             }
1337
-            if (isset($_GET['actionpage']) && $_GET['actionpage']=='invisible' && $status_visibility==1) {
1338
-                $status_visibility=0;
1337
+            if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'invisible' && $status_visibility == 1) {
1338
+                $status_visibility = 0;
1339 1339
             }
1340 1340
 
1341 1341
             $sql = 'UPDATE '.$tbl_wiki.' SET visibility="'.Database::escape_string($status_visibility).'"
@@ -1352,12 +1352,12 @@  discard block
 block discarded – undo
1352 1352
                         reflink="'.Database::escape_string($page).'" AND
1353 1353
                         '.$groupfilter.$condition_session.'
1354 1354
                     ORDER BY id ASC';
1355
-            $result=Database::query($sql);
1355
+            $result = Database::query($sql);
1356 1356
             $row = Database::fetch_array($result);
1357 1357
         }
1358 1358
 
1359 1359
         if (empty($row['id'])) {
1360
-            $row['visibility']= 1;
1360
+            $row['visibility'] = 1;
1361 1361
         }
1362 1362
 
1363 1363
         //show status
@@ -1384,18 +1384,18 @@  discard block
 block discarded – undo
1384 1384
                     reflink="'.Database::escape_string($page).'" AND
1385 1385
                     '.$groupfilter.$condition_session.'
1386 1386
                 ORDER BY id ASC';
1387
-        $result=Database::query($sql);
1388
-        $row=Database::fetch_array($result);
1387
+        $result = Database::query($sql);
1388
+        $row = Database::fetch_array($result);
1389 1389
 
1390 1390
         $status_visibility_disc = $row['visibility_disc'];
1391 1391
 
1392 1392
         //change status
1393
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
1394
-            if (isset($_GET['actionpage']) && $_GET['actionpage'] =='showdisc' && $status_visibility_disc==0) {
1395
-                $status_visibility_disc=1;
1393
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
1394
+            if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'showdisc' && $status_visibility_disc == 0) {
1395
+                $status_visibility_disc = 1;
1396 1396
             }
1397
-            if (isset($_GET['actionpage']) && $_GET['actionpage'] =='hidedisc' && $status_visibility_disc==1) {
1398
-                $status_visibility_disc=0;
1397
+            if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'hidedisc' && $status_visibility_disc == 1) {
1398
+                $status_visibility_disc = 0;
1399 1399
             }
1400 1400
 
1401 1401
             $sql = 'UPDATE '.$tbl_wiki.' SET visibility_disc="'.Database::escape_string($status_visibility_disc).'"
@@ -1443,14 +1443,14 @@  discard block
 block discarded – undo
1443 1443
         $result = Database::query($sql);
1444 1444
         $row = Database::fetch_array($result);
1445 1445
 
1446
-        $status_addlock_disc=$row['addlock_disc'];
1446
+        $status_addlock_disc = $row['addlock_disc'];
1447 1447
 
1448 1448
         //change status
1449 1449
         if (api_is_allowed_to_edit() || api_is_platform_admin()) {
1450
-            if (isset($_GET['actionpage']) && $_GET['actionpage'] =='lockdisc' && $status_addlock_disc==0) {
1450
+            if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'lockdisc' && $status_addlock_disc == 0) {
1451 1451
                 $status_addlock_disc = 1;
1452 1452
             }
1453
-            if (isset($_GET['actionpage']) && $_GET['actionpage'] =='unlockdisc' && $status_addlock_disc==1) {
1453
+            if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'unlockdisc' && $status_addlock_disc == 1) {
1454 1454
                 $status_addlock_disc = 0;
1455 1455
             }
1456 1456
 
@@ -1472,8 +1472,8 @@  discard block
 block discarded – undo
1472 1472
                         reflink="'.Database::escape_string($page).'" AND
1473 1473
                         '.$groupfilter.$condition_session.'
1474 1474
                     ORDER BY id ASC';
1475
-            $result=Database::query($sql);
1476
-            $row=Database::fetch_array($result);
1475
+            $result = Database::query($sql);
1476
+            $row = Database::fetch_array($result);
1477 1477
         }
1478 1478
 
1479 1479
         return $row['addlock_disc'];
@@ -1498,17 +1498,17 @@  discard block
 block discarded – undo
1498 1498
                     reflink="'.Database::escape_string($page).'" AND
1499 1499
                     '.$groupfilter.$condition_session.'
1500 1500
                 ORDER BY id ASC';
1501
-        $result=Database::query($sql);
1502
-        $row=Database::fetch_array($result);
1503
-        $status_ratinglock_disc=$row['ratinglock_disc'];
1501
+        $result = Database::query($sql);
1502
+        $row = Database::fetch_array($result);
1503
+        $status_ratinglock_disc = $row['ratinglock_disc'];
1504 1504
 
1505 1505
         //change status
1506
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
1507
-            if (isset($_GET['actionpage']) && $_GET['actionpage'] =='lockrating' && $status_ratinglock_disc==0) {
1508
-                $status_ratinglock_disc=1;
1506
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
1507
+            if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'lockrating' && $status_ratinglock_disc == 0) {
1508
+                $status_ratinglock_disc = 1;
1509 1509
             }
1510
-            if (isset($_GET['actionpage']) && $_GET['actionpage'] =='unlockrating' && $status_ratinglock_disc==1) {
1511
-                $status_ratinglock_disc=0;
1510
+            if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'unlockrating' && $status_ratinglock_disc == 1) {
1511
+                $status_ratinglock_disc = 0;
1512 1512
             }
1513 1513
 
1514 1514
             $sql = 'UPDATE '.$tbl_wiki.'
@@ -1524,14 +1524,14 @@  discard block
 block discarded – undo
1524 1524
             // these three lines remain necessary. They do that by changing the
1525 1525
             // page state is made when you press the button and not have to wait
1526 1526
             // to change his page
1527
-            $sql='SELECT * FROM '.$tbl_wiki.'
1527
+            $sql = 'SELECT * FROM '.$tbl_wiki.'
1528 1528
                   WHERE
1529 1529
                     c_id = '.$course_id.' AND
1530 1530
                     reflink="'.Database::escape_string($page).'" AND
1531 1531
                     '.$groupfilter.$condition_session.'
1532 1532
                   ORDER BY id ASC';
1533
-            $result=Database::query($sql);
1534
-            $row=Database::fetch_array($result);
1533
+            $result = Database::query($sql);
1534
+            $row = Database::fetch_array($result);
1535 1535
         }
1536 1536
 
1537 1537
         return $row['ratinglock_disc'];
@@ -1556,24 +1556,24 @@  discard block
 block discarded – undo
1556 1556
         $sql = 'SELECT * FROM '.$tbl_wiki.'
1557 1557
                 WHERE c_id = '.$course_id.' AND reflink="'.$reflink.'" AND '.$groupfilter.$condition_session.'
1558 1558
                 ORDER BY id ASC';
1559
-        $result=Database::query($sql);
1560
-        $row=Database::fetch_array($result);
1559
+        $result = Database::query($sql);
1560
+        $row = Database::fetch_array($result);
1561 1561
         $id = $row['id'];
1562
-        $sql='SELECT * FROM '.$tbl_wiki_mailcue.'
1562
+        $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
1563 1563
               WHERE c_id = '.$course_id.' AND id="'.$id.'" AND user_id="'.api_get_user_id().'" AND type="P"';
1564
-        $result=Database::query($sql);
1565
-        $row=Database::fetch_array($result);
1564
+        $result = Database::query($sql);
1565
+        $row = Database::fetch_array($result);
1566 1566
 
1567 1567
         $idm = $row['id'];
1568 1568
 
1569 1569
         if (empty($idm)) {
1570
-            $status_notify=0;
1570
+            $status_notify = 0;
1571 1571
         } else {
1572
-            $status_notify=1;
1572
+            $status_notify = 1;
1573 1573
         }
1574 1574
 
1575 1575
         // Change status
1576
-        if (isset($_GET['actionpage']) && $_GET['actionpage'] =='locknotify' && $status_notify==0) {
1576
+        if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'locknotify' && $status_notify == 0) {
1577 1577
             $sql = "SELECT id FROM $tbl_wiki_mailcue
1578 1578
                     WHERE c_id = $course_id AND id = $id AND user_id = $userId";
1579 1579
             $result = Database::query($sql);
@@ -1582,18 +1582,18 @@  discard block
 block discarded – undo
1582 1582
                 $exist = true;
1583 1583
             }
1584 1584
             if ($exist == false) {
1585
-                $sql="INSERT INTO ".$tbl_wiki_mailcue." (c_id, id, user_id, type, group_id, session_id) VALUES
1585
+                $sql = "INSERT INTO ".$tbl_wiki_mailcue." (c_id, id, user_id, type, group_id, session_id) VALUES
1586 1586
                 ($course_id, '".$id."','".api_get_user_id()."','P','".$groupId."','".$session_id."')";
1587 1587
                 Database::query($sql);
1588 1588
             }
1589
-            $status_notify=1;
1589
+            $status_notify = 1;
1590 1590
         }
1591 1591
 
1592
-        if (isset($_GET['actionpage']) && $_GET['actionpage'] =='unlocknotify' && $status_notify==1) {
1592
+        if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'unlocknotify' && $status_notify == 1) {
1593 1593
             $sql = 'DELETE FROM '.$tbl_wiki_mailcue.'
1594 1594
                     WHERE id="'.$id.'" AND user_id="'.api_get_user_id().'" AND type="P" AND c_id = '.$course_id;
1595 1595
             Database::query($sql);
1596
-            $status_notify=0;
1596
+            $status_notify = 0;
1597 1597
         }
1598 1598
 
1599 1599
         return $status_notify;
@@ -1619,9 +1619,9 @@  discard block
 block discarded – undo
1619 1619
         $sql = 'SELECT * FROM '.$tbl_wiki.'
1620 1620
                 WHERE c_id = '.$course_id.' AND reflink="'.$reflink.'" AND '.$groupfilter.$condition_session.'
1621 1621
                 ORDER BY id ASC';
1622
-        $result=Database::query($sql);
1623
-        $row=Database::fetch_array($result);
1624
-        $id=$row['id'];
1622
+        $result = Database::query($sql);
1623
+        $row = Database::fetch_array($result);
1624
+        $id = $row['id'];
1625 1625
         $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
1626 1626
                 WHERE c_id = '.$course_id.' AND id="'.$id.'" AND user_id="'.api_get_user_id().'" AND type="D"';
1627 1627
         $result = Database::query($sql);
@@ -1629,23 +1629,23 @@  discard block
 block discarded – undo
1629 1629
         $idm = $row['id'];
1630 1630
 
1631 1631
         if (empty($idm)) {
1632
-            $status_notify_disc=0;
1632
+            $status_notify_disc = 0;
1633 1633
         } else {
1634
-            $status_notify_disc=1;
1634
+            $status_notify_disc = 1;
1635 1635
         }
1636 1636
 
1637 1637
         //change status
1638
-        if (isset($_GET['actionpage']) && $_GET['actionpage'] =='locknotifydisc' && $status_notify_disc==0) {
1639
-            $sql="INSERT INTO ".$tbl_wiki_mailcue." (c_id, id, user_id, type, group_id, session_id) VALUES
1638
+        if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'locknotifydisc' && $status_notify_disc == 0) {
1639
+            $sql = "INSERT INTO ".$tbl_wiki_mailcue." (c_id, id, user_id, type, group_id, session_id) VALUES
1640 1640
             ($course_id, '".$id."','".api_get_user_id()."','D','".$groupId."','".$session_id."')";
1641 1641
             Database::query($sql);
1642
-            $status_notify_disc=1;
1642
+            $status_notify_disc = 1;
1643 1643
         }
1644
-        if (isset($_GET['actionpage']) && $_GET['actionpage'] =='unlocknotifydisc' && $status_notify_disc==1) {
1644
+        if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'unlocknotifydisc' && $status_notify_disc == 1) {
1645 1645
             $sql = 'DELETE FROM '.$tbl_wiki_mailcue.'
1646 1646
                     WHERE c_id = '.$course_id.' AND id="'.$id.'" AND user_id="'.api_get_user_id().'" AND type="D" AND c_id = '.$course_id;
1647 1647
             Database::query($sql);
1648
-            $status_notify_disc=0;
1648
+            $status_notify_disc = 0;
1649 1649
         }
1650 1650
 
1651 1651
         return $status_notify_disc;
@@ -1660,7 +1660,7 @@  discard block
 block discarded – undo
1660 1660
         $tbl_wiki_mailcue = $this->tbl_wiki_mailcue;
1661 1661
         $course_id = api_get_course_int_id();
1662 1662
         $groupId = api_get_group_id();
1663
-        $session_id=api_get_session_id();
1663
+        $session_id = api_get_session_id();
1664 1664
 
1665 1665
         $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
1666 1666
                 WHERE
@@ -1669,31 +1669,31 @@  discard block
 block discarded – undo
1669 1669
                     type="F" AND
1670 1670
                     group_id="'.$groupId.'" AND
1671 1671
                     session_id="'.$session_id.'"';
1672
-        $result=Database::query($sql);
1673
-        $row=Database::fetch_array($result);
1672
+        $result = Database::query($sql);
1673
+        $row = Database::fetch_array($result);
1674 1674
 
1675
-        $idm=$row['user_id'];
1675
+        $idm = $row['user_id'];
1676 1676
 
1677 1677
         if (empty($idm)) {
1678
-            $status_notify_all=0;
1678
+            $status_notify_all = 0;
1679 1679
         } else {
1680
-            $status_notify_all=1;
1680
+            $status_notify_all = 1;
1681 1681
         }
1682 1682
 
1683 1683
         //change status
1684
-        if (isset($_GET['actionpage']) && $_GET['actionpage'] =='locknotifyall' && $status_notify_all==0) {
1685
-            $sql="INSERT INTO ".$tbl_wiki_mailcue." (c_id, user_id, type, group_id, session_id) VALUES
1684
+        if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'locknotifyall' && $status_notify_all == 0) {
1685
+            $sql = "INSERT INTO ".$tbl_wiki_mailcue." (c_id, user_id, type, group_id, session_id) VALUES
1686 1686
             ($course_id, '".api_get_user_id()."','F','".$groupId."','".$session_id."')";
1687 1687
             Database::query($sql);
1688
-            $status_notify_all=1;
1688
+            $status_notify_all = 1;
1689 1689
         }
1690 1690
 
1691 1691
         if (isset($_GET['actionpage']) &&
1692 1692
             isset($_GET['actionpage']) &&
1693
-            $_GET['actionpage']  =='unlocknotifyall' &&
1693
+            $_GET['actionpage'] == 'unlocknotifyall' &&
1694 1694
             $status_notify_all == 1
1695 1695
         ) {
1696
-            $sql ='DELETE FROM '.$tbl_wiki_mailcue.'
1696
+            $sql = 'DELETE FROM '.$tbl_wiki_mailcue.'
1697 1697
                    WHERE
1698 1698
                     c_id = '.$course_id.' AND
1699 1699
                     user_id="'.api_get_user_id().'" AND
@@ -1702,7 +1702,7 @@  discard block
 block discarded – undo
1702 1702
                     session_id="'.$session_id.'" AND
1703 1703
                     c_id = '.$course_id;
1704 1704
             Database::query($sql);
1705
-            $status_notify_all=0;
1705
+            $status_notify_all = 0;
1706 1706
         }
1707 1707
 
1708 1708
         //show status
@@ -1712,7 +1712,7 @@  discard block
 block discarded – undo
1712 1712
     /**
1713 1713
      * Sends pending e-mails
1714 1714
      */
1715
-    public function check_emailcue($id_or_ref, $type, $lastime='', $lastuser='')
1715
+    public function check_emailcue($id_or_ref, $type, $lastime = '', $lastuser = '')
1716 1716
     {
1717 1717
         $tbl_wiki_mailcue = $this->tbl_wiki_mailcue;
1718 1718
         $tbl_wiki = $this->tbl_wiki;
@@ -1720,14 +1720,14 @@  discard block
 block discarded – undo
1720 1720
         $groupfilter = $this->groupfilter;
1721 1721
         $_course = $this->courseInfo;
1722 1722
         $groupId = api_get_group_id();
1723
-        $session_id=api_get_session_id();
1723
+        $session_id = api_get_session_id();
1724 1724
         $course_id = api_get_course_int_id();
1725 1725
 
1726
-        $group_properties  = GroupManager :: get_group_properties($groupId);
1726
+        $group_properties = GroupManager :: get_group_properties($groupId);
1727 1727
         $group_name = $group_properties['name'];
1728 1728
         $allow_send_mail = false; //define the variable to below
1729 1729
         $email_assignment = null;
1730
-        if ($type=='P') {
1730
+        if ($type == 'P') {
1731 1731
             //if modifying a wiki page
1732 1732
             //first, current author and time
1733 1733
             //Who is the author?
@@ -1738,22 +1738,22 @@  discard block
 block discarded – undo
1738 1738
             $year = substr($lastime, 0, 4);
1739 1739
             $month = substr($lastime, 5, 2);
1740 1740
             $day = substr($lastime, 8, 2);
1741
-            $hours=substr($lastime, 11,2);
1742
-            $minutes=substr($lastime, 14,2);
1743
-            $seconds=substr($lastime, 17,2);
1744
-            $email_date_changes=$day.' '.$month.' '.$year.' '.$hours.":".$minutes.":".$seconds;
1741
+            $hours = substr($lastime, 11, 2);
1742
+            $minutes = substr($lastime, 14, 2);
1743
+            $seconds = substr($lastime, 17, 2);
1744
+            $email_date_changes = $day.' '.$month.' '.$year.' '.$hours.":".$minutes.":".$seconds;
1745 1745
 
1746 1746
             //second, extract data from first reg
1747 1747
             $sql = 'SELECT * FROM '.$tbl_wiki.'
1748 1748
                     WHERE  c_id = '.$course_id.' AND reflink="'.$id_or_ref.'" AND '.$groupfilter.$condition_session.'
1749 1749
                     ORDER BY id ASC';
1750
-            $result=Database::query($sql);
1751
-            $row=Database::fetch_array($result);
1750
+            $result = Database::query($sql);
1751
+            $row = Database::fetch_array($result);
1752 1752
 
1753
-            $id=$row['id'];
1754
-            $email_page_name=$row['title'];
1755
-            if ($row['visibility']==1) {
1756
-                $allow_send_mail=true; //if visibility off - notify off
1753
+            $id = $row['id'];
1754
+            $email_page_name = $row['title'];
1755
+            if ($row['visibility'] == 1) {
1756
+                $allow_send_mail = true; //if visibility off - notify off
1757 1757
                 $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
1758 1758
                         WHERE
1759 1759
                             c_id = '.$course_id.' AND
@@ -1763,10 +1763,10 @@  discard block
 block discarded – undo
1763 1763
                             group_id="'.$groupId.'" AND
1764 1764
                             session_id="'.$session_id.'"';
1765 1765
                 //type: P=page, D=discuss, F=full.
1766
-                $result=Database::query($sql);
1767
-                $emailtext=get_lang('EmailWikipageModified').' <strong>'.$email_page_name.'</strong> '.get_lang('Wiki');
1766
+                $result = Database::query($sql);
1767
+                $emailtext = get_lang('EmailWikipageModified').' <strong>'.$email_page_name.'</strong> '.get_lang('Wiki');
1768 1768
             }
1769
-        } elseif ($type=='D') {
1769
+        } elseif ($type == 'D') {
1770 1770
             //if added a post to discuss
1771 1771
 
1772 1772
             //first, current author and time
@@ -1778,25 +1778,25 @@  discard block
 block discarded – undo
1778 1778
             $year = substr($lastime, 0, 4);
1779 1779
             $month = substr($lastime, 5, 2);
1780 1780
             $day = substr($lastime, 8, 2);
1781
-            $hours=substr($lastime, 11,2);
1782
-            $minutes=substr($lastime, 14,2);
1783
-            $seconds=substr($lastime, 17,2);
1784
-            $email_date_changes=$day.' '.$month.' '.$year.' '.$hours.":".$minutes.":".$seconds;
1781
+            $hours = substr($lastime, 11, 2);
1782
+            $minutes = substr($lastime, 14, 2);
1783
+            $seconds = substr($lastime, 17, 2);
1784
+            $email_date_changes = $day.' '.$month.' '.$year.' '.$hours.":".$minutes.":".$seconds;
1785 1785
 
1786 1786
             //second, extract data from first reg
1787 1787
 
1788
-            $id=$id_or_ref; //$id_or_ref is id from tblwiki
1788
+            $id = $id_or_ref; //$id_or_ref is id from tblwiki
1789 1789
 
1790 1790
             $sql = 'SELECT * FROM '.$tbl_wiki.'
1791 1791
                     WHERE c_id = '.$course_id.' AND id="'.$id.'"
1792 1792
                     ORDER BY id ASC';
1793 1793
 
1794
-            $result=Database::query($sql);
1795
-            $row=Database::fetch_array($result);
1794
+            $result = Database::query($sql);
1795
+            $row = Database::fetch_array($result);
1796 1796
 
1797
-            $email_page_name=$row['title'];
1798
-            if ($row['visibility_disc']==1) {
1799
-                $allow_send_mail=true; //if visibility off - notify off
1797
+            $email_page_name = $row['title'];
1798
+            if ($row['visibility_disc'] == 1) {
1799
+                $allow_send_mail = true; //if visibility off - notify off
1800 1800
                 $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
1801 1801
                         WHERE
1802 1802
                             c_id = '.$course_id.' AND
@@ -1807,22 +1807,22 @@  discard block
 block discarded – undo
1807 1807
                             session_id="'.$session_id.'"';
1808 1808
                 //type: P=page, D=discuss, F=full
1809 1809
                 $result = Database::query($sql);
1810
-                $emailtext=get_lang('EmailWikiPageDiscAdded').' <strong>'.$email_page_name.'</strong> '.get_lang('Wiki');
1810
+                $emailtext = get_lang('EmailWikiPageDiscAdded').' <strong>'.$email_page_name.'</strong> '.get_lang('Wiki');
1811 1811
             }
1812
-        } elseif($type=='A') {
1812
+        } elseif ($type == 'A') {
1813 1813
             //for added pages
1814
-            $id=0; //for tbl_wiki_mailcue
1814
+            $id = 0; //for tbl_wiki_mailcue
1815 1815
             $sql = 'SELECT * FROM '.$tbl_wiki.'
1816 1816
                     WHERE c_id = '.$course_id.'
1817 1817
                     ORDER BY id DESC'; //the added is always the last
1818 1818
 
1819
-            $result=Database::query($sql);
1820
-            $row=Database::fetch_array($result);
1821
-            $email_page_name=$row['title'];
1819
+            $result = Database::query($sql);
1820
+            $row = Database::fetch_array($result);
1821
+            $email_page_name = $row['title'];
1822 1822
 
1823 1823
             //Who is the author?
1824 1824
             $userinfo = api_get_user_info($row['user_id']);
1825
-            $email_user_author= get_lang('AddedBy').': '.$userinfo['complete_name'];
1825
+            $email_user_author = get_lang('AddedBy').': '.$userinfo['complete_name'];
1826 1826
 
1827 1827
             //When ?
1828 1828
             $year = substr($row['dtime'], 0, 4);
@@ -1831,33 +1831,33 @@  discard block
 block discarded – undo
1831 1831
             $hours = substr($row['dtime'], 11, 2);
1832 1832
             $minutes = substr($row['dtime'], 14, 2);
1833 1833
             $seconds = substr($row['dtime'], 17, 2);
1834
-            $email_date_changes=$day.' '.$month.' '.$year.' '.$hours.":".$minutes.":".$seconds;
1835
-
1836
-            if($row['assignment']==0) {
1837
-                $allow_send_mail=true;
1838
-            } elseif($row['assignment']==1) {
1839
-                $email_assignment=get_lang('AssignmentDescExtra').' ('.get_lang('AssignmentMode').')';
1840
-                $allow_send_mail=true;
1841
-            } elseif($row['assignment']==2) {
1842
-                $allow_send_mail=false; //Mode tasks: avoids notifications to all users about all users
1834
+            $email_date_changes = $day.' '.$month.' '.$year.' '.$hours.":".$minutes.":".$seconds;
1835
+
1836
+            if ($row['assignment'] == 0) {
1837
+                $allow_send_mail = true;
1838
+            } elseif ($row['assignment'] == 1) {
1839
+                $email_assignment = get_lang('AssignmentDescExtra').' ('.get_lang('AssignmentMode').')';
1840
+                $allow_send_mail = true;
1841
+            } elseif ($row['assignment'] == 2) {
1842
+                $allow_send_mail = false; //Mode tasks: avoids notifications to all users about all users
1843 1843
             }
1844 1844
 
1845 1845
             $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
1846 1846
                     WHERE c_id = '.$course_id.' AND  id="'.$id.'" AND type="F" AND group_id="'.$groupId.'" AND session_id="'.$session_id.'"';
1847 1847
             //type: P=page, D=discuss, F=full
1848
-            $result=Database::query($sql);
1848
+            $result = Database::query($sql);
1849 1849
 
1850
-            $emailtext = get_lang('EmailWikiPageAdded').' <strong>'.$email_page_name.'</strong> '.get_lang('In').' '. get_lang('Wiki');
1851
-        } elseif ($type=='E') {
1852
-            $id=0;
1853
-            $allow_send_mail=true;
1850
+            $emailtext = get_lang('EmailWikiPageAdded').' <strong>'.$email_page_name.'</strong> '.get_lang('In').' '.get_lang('Wiki');
1851
+        } elseif ($type == 'E') {
1852
+            $id = 0;
1853
+            $allow_send_mail = true;
1854 1854
 
1855 1855
             //Who is the author?
1856
-            $userinfo = api_get_user_info(api_get_user_id());	//current user
1856
+            $userinfo = api_get_user_info(api_get_user_id()); //current user
1857 1857
             $email_user_author = get_lang('DeletedBy').': '.$userinfo['complete_name'];
1858 1858
             //When ?
1859
-            $today = date('r');		//current time
1860
-            $email_date_changes=$today;
1859
+            $today = date('r'); //current time
1860
+            $email_date_changes = $today;
1861 1861
 
1862 1862
             $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
1863 1863
                     WHERE
@@ -1871,16 +1871,16 @@  discard block
 block discarded – undo
1871 1871
         ///make and send email
1872 1872
         if ($allow_send_mail) {
1873 1873
             while ($row = Database::fetch_array($result)) {
1874
-                $userinfo = api_get_user_info($row['user_id']);	//$row['user_id'] obtained from tbl_wiki_mailcue
1874
+                $userinfo = api_get_user_info($row['user_id']); //$row['user_id'] obtained from tbl_wiki_mailcue
1875 1875
                 $name_to = $userinfo['complete_name'];
1876 1876
                 $email_to = $userinfo['email'];
1877 1877
                 $sender_name = api_get_setting('emailAdministrator');
1878 1878
                 $sender_email = api_get_setting('emailAdministrator');
1879 1879
                 $email_subject = get_lang('EmailWikiChanges').' - '.$_course['official_code'];
1880 1880
                 $email_body = get_lang('DearUser').' '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).',<br /><br />';
1881
-                if($session_id==0){
1881
+                if ($session_id == 0) {
1882 1882
                     $email_body .= $emailtext.' <strong>'.$_course['name'].' - '.$group_name.'</strong><br /><br /><br />';
1883
-                }else{
1883
+                } else {
1884 1884
                     $email_body .= $emailtext.' <strong>'.$_course['name'].' ('.api_get_session_name(api_get_session_id()).') - '.$group_name.'</strong><br /><br /><br />';
1885 1885
                 }
1886 1886
                 $email_body .= $email_user_author.' ('.$email_date_changes.')<br /><br /><br />';
@@ -1958,25 +1958,25 @@  discard block
 block discarded – undo
1958 1958
             $template);
1959 1959
 
1960 1960
         if (0 != $groupId) {
1961
-            $groupPart = '_group' . $groupId; // and add groupId to put the same document title in different groups
1962
-            $group_properties  = GroupManager :: get_group_properties($groupId);
1961
+            $groupPart = '_group'.$groupId; // and add groupId to put the same document title in different groups
1962
+            $group_properties = GroupManager :: get_group_properties($groupId);
1963 1963
             $groupPath = $group_properties['directory'];
1964 1964
         } else {
1965 1965
             $groupPart = '';
1966
-            $groupPath ='';
1966
+            $groupPath = '';
1967 1967
         }
1968 1968
 
1969
-        $exportDir = api_get_path(SYS_COURSE_PATH).api_get_course_path(). '/document'.$groupPath;
1970
-        $exportFile = api_replace_dangerous_char($wikiTitle) . $groupPart;
1969
+        $exportDir = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/document'.$groupPath;
1970
+        $exportFile = api_replace_dangerous_char($wikiTitle).$groupPart;
1971 1971
         $wikiContents = trim(preg_replace("/\[[\[]?([^\]|]*)[|]?([^|\]]*)\][\]]?/", "$1", $wikiContents));
1972 1972
         //TODO: put link instead of title
1973 1973
 
1974 1974
         $wikiContents = str_replace('{CONTENT}', $wikiContents, $template);
1975 1975
 
1976 1976
         // replace relative path by absolute path for courses, so you can see items into this page wiki (images, mp3, etc..) exported in documents
1977
-        if (api_strpos($wikiContents,'../../courses/') !== false) {
1977
+        if (api_strpos($wikiContents, '../../courses/') !== false) {
1978 1978
             $web_course_path = api_get_path(WEB_COURSE_PATH);
1979
-            $wikiContents = str_replace('../../courses/',$web_course_path,$wikiContents);
1979
+            $wikiContents = str_replace('../../courses/', $web_course_path, $wikiContents);
1980 1980
         }
1981 1981
 
1982 1982
         $i = 1;
@@ -1985,8 +1985,8 @@  discard block
 block discarded – undo
1985 1985
             $i++;
1986 1986
         }
1987 1987
 
1988
-        $wikiFileName = $exportFile . '_' . $i . '.html';
1989
-        $exportPath = $exportDir . '/' . $wikiFileName;
1988
+        $wikiFileName = $exportFile.'_'.$i.'.html';
1989
+        $exportPath = $exportDir.'/'.$wikiFileName;
1990 1990
 
1991 1991
         file_put_contents($exportPath, $wikiContents);
1992 1992
         $doc_id = add_document(
@@ -2031,14 +2031,14 @@  discard block
 block discarded – undo
2031 2031
         $content_pdf = api_html_entity_decode($data['content'], ENT_QUOTES, api_get_system_encoding());
2032 2032
 
2033 2033
         //clean wiki links
2034
-        $content_pdf=trim(preg_replace("/\[[\[]?([^\]|]*)[|]?([^|\]]*)\][\]]?/", "$1", $content_pdf));
2034
+        $content_pdf = trim(preg_replace("/\[[\[]?([^\]|]*)[|]?([^|\]]*)\][\]]?/", "$1", $content_pdf));
2035 2035
         //TODO: It should be better to display the link insted of the tile but it is hard for [[title]] links
2036 2036
 
2037 2037
         $title_pdf = api_html_entity_decode($data['title'], ENT_QUOTES, api_get_system_encoding());
2038 2038
         $title_pdf = api_utf8_encode($title_pdf, api_get_system_encoding());
2039 2039
         $content_pdf = api_utf8_encode($content_pdf, api_get_system_encoding());
2040 2040
 
2041
-        $html='
2041
+        $html = '
2042 2042
         <!-- defines the headers/footers - this must occur before the headers/footers are set -->
2043 2043
 
2044 2044
         <!--mpdf
@@ -2093,9 +2093,9 @@  discard block
 block discarded – undo
2093 2093
         $session_id = $this->session_id;
2094 2094
         $groupId = api_get_group_id();
2095 2095
 
2096
-        if ($groupId==0) {
2096
+        if ($groupId == 0) {
2097 2097
             //extract course members
2098
-            if(!empty($session_id)) {
2098
+            if (!empty($session_id)) {
2099 2099
                 $a_users_to_add = CourseManager::get_user_list_from_course_code(api_get_course_id(), $session_id);
2100 2100
             } else {
2101 2101
                 $a_users_to_add = CourseManager::get_user_list_from_course_code(api_get_course_id(), 0);
@@ -2121,7 +2121,7 @@  discard block
 block discarded – undo
2121 2121
         $username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username'], ENT_QUOTES));
2122 2122
         $name = $userinfo['complete_name']." - ".$username;
2123 2123
 
2124
-        $photo = '<img src="' . $userinfo['avatar'] . '" alt="' . $name . '"  width="40" height="50" align="top" title="' . $name . '"  />';
2124
+        $photo = '<img src="'.$userinfo['avatar'].'" alt="'.$name.'"  width="40" height="50" align="top" title="'.$name.'"  />';
2125 2125
 
2126 2126
         // teacher assignment title
2127 2127
         $title_orig = $values['title'];
@@ -2149,24 +2149,24 @@  discard block
 block discarded – undo
2149 2149
                 $userPicture = UserManager::getUserPicture($assig_user_id);
2150 2150
                 $username = api_htmlentities(sprintf(get_lang('LoginX'), $o_user_to_add['username'], ENT_QUOTES));
2151 2151
                 $name = api_get_person_name($o_user_to_add['firstname'], $o_user_to_add['lastname'])." . ".$username;
2152
-                $photo= '<img src="'.$userPicture.'" alt="'.$name.'"  width="40" height="50" align="bottom" title="'.$name.'"  />';
2152
+                $photo = '<img src="'.$userPicture.'" alt="'.$name.'"  width="40" height="50" align="bottom" title="'.$name.'"  />';
2153 2153
 
2154 2154
                 $is_tutor_of_group = GroupManager::is_tutor_of_group($assig_user_id, $groupId); //student is tutor
2155 2155
                 $is_tutor_and_member = GroupManager::is_tutor_of_group($assig_user_id, $groupId) && GroupManager::is_subscribed($assig_user_id, $groupId);
2156 2156
                 // student is tutor and member
2157 2157
 
2158 2158
                 if ($is_tutor_and_member) {
2159
-                    $status_in_group=get_lang('GroupTutorAndMember');
2159
+                    $status_in_group = get_lang('GroupTutorAndMember');
2160 2160
                 } else {
2161
-                    if($is_tutor_of_group) {
2162
-                        $status_in_group=get_lang('GroupTutor');
2161
+                    if ($is_tutor_of_group) {
2162
+                        $status_in_group = get_lang('GroupTutor');
2163 2163
                     } else {
2164
-                        $status_in_group=" "; //get_lang('GroupStandardMember')
2164
+                        $status_in_group = " "; //get_lang('GroupStandardMember')
2165 2165
                     }
2166 2166
                 }
2167 2167
 
2168
-                if ($assignment_type==1) {
2169
-                    $values['title']= $title_orig;
2168
+                if ($assignment_type == 1) {
2169
+                    $values['title'] = $title_orig;
2170 2170
                     $values['content'] = '<div align="center" style="background-color: #F5F8FB; border:solid; border-color: #E6E6E6">
2171 2171
                     <table border="0">
2172 2172
                     <tr><td style="font-size:24px">'.get_lang('AssignmentWork').'</td></tr>
@@ -2182,7 +2182,7 @@  discard block
 block discarded – undo
2182 2182
                         ).
2183 2183
                         ' [['.$_POST['title']."_uass".$assig_user_id.' | '.$photo.']] '.$status_in_group.'</li>';
2184 2184
                     //don't change this line without guaranteeing that users will be ordered by last names in the following format (surname, name)
2185
-                    $values['assignment']=2;
2185
+                    $values['assignment'] = 2;
2186 2186
                 }
2187 2187
                 $this->assig_user_id = $assig_user_id;
2188 2188
                 self::save_new_wiki($values);
@@ -2191,12 +2191,12 @@  discard block
 block discarded – undo
2191 2191
 
2192 2192
         foreach ($a_users_to_add as $o_user_to_add) {
2193 2193
             if ($o_user_to_add['user_id'] == $userId) {
2194
-                $assig_user_id=$o_user_to_add['user_id'];
2194
+                $assig_user_id = $o_user_to_add['user_id'];
2195 2195
                 if ($assignment_type == 1) {
2196
-                    $values['title']= $title_orig;
2197
-                    $values['comment']=get_lang('AssignmentDesc');
2196
+                    $values['title'] = $title_orig;
2197
+                    $values['comment'] = get_lang('AssignmentDesc');
2198 2198
                     sort($all_students_pages);
2199
-                    $values['content']=$content_orig_A.$content_orig_B.'<br/>
2199
+                    $values['content'] = $content_orig_A.$content_orig_B.'<br/>
2200 2200
                     <div align="center" style="font-size:18px; background-color: #F5F8FB; border:solid; border-color:#E6E6E6">
2201 2201
                     '.get_lang('AssignmentLinkstoStudentsPage').'
2202 2202
                     </div><br/>
@@ -2204,7 +2204,7 @@  discard block
 block discarded – undo
2204 2204
                     <ol>'.implode($all_students_pages).'</ol>
2205 2205
                     </div>
2206 2206
                     <br/>';
2207
-                    $values['assignment']=1;
2207
+                    $values['assignment'] = 1;
2208 2208
                 }
2209 2209
                 $this->assig_user_id = $assig_user_id;
2210 2210
                 self::save_new_wiki($values);
@@ -2218,7 +2218,7 @@  discard block
 block discarded – undo
2218 2218
      * @param   int     Whether to search the contents (1) or just the titles (0)
2219 2219
      * @param int
2220 2220
      */
2221
-    public function display_wiki_search_results($search_term, $search_content=0, $all_vers=0)
2221
+    public function display_wiki_search_results($search_term, $search_content = 0, $all_vers = 0)
2222 2222
     {
2223 2223
         $tbl_wiki = $this->tbl_wiki;
2224 2224
         $condition_session = $this->condition_session;
@@ -2230,9 +2230,9 @@  discard block
 block discarded – undo
2230 2230
         echo '</legend>';
2231 2231
 
2232 2232
         //only by professors when page is hidden
2233
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
2234
-            if ($all_vers=='1') {
2235
-                if ($search_content=='1') {
2233
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
2234
+            if ($all_vers == '1') {
2235
+                if ($search_content == '1') {
2236 2236
                     $sql = "SELECT * FROM ".$tbl_wiki."
2237 2237
                             WHERE
2238 2238
                                 c_id = $course_id AND
@@ -2249,7 +2249,7 @@  discard block
 block discarded – undo
2249 2249
                     //search all pages and all versions
2250 2250
                 }
2251 2251
             } else {
2252
-                if ($search_content=='1') {
2252
+                if ($search_content == '1') {
2253 2253
                     $sql = "SELECT * FROM ".$tbl_wiki." s1
2254 2254
                             WHERE
2255 2255
                                 s1.c_id = $course_id AND
@@ -2300,7 +2300,7 @@  discard block
 block discarded – undo
2300 2300
                     //search all pages and all versions
2301 2301
                 }
2302 2302
             } else {
2303
-                if($search_content=='1') {
2303
+                if ($search_content == '1') {
2304 2304
                     $sql = "SELECT * FROM ".$tbl_wiki." s1
2305 2305
                             WHERE
2306 2306
                                 s1.c_id = $course_id AND
@@ -2348,17 +2348,17 @@  discard block
 block discarded – undo
2348 2348
                 $seconds = substr($obj->dtime, 17, 2);
2349 2349
 
2350 2350
                 //get type assignment icon
2351
-                if($obj->assignment==1) {
2352
-                    $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL);
2353
-                } elseif ($obj->assignment==2) {
2354
-                    $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
2355
-                } elseif ($obj->assignment==0) {
2351
+                if ($obj->assignment == 1) {
2352
+                    $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL);
2353
+                } elseif ($obj->assignment == 2) {
2354
+                    $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
2355
+                } elseif ($obj->assignment == 0) {
2356 2356
                     $ShowAssignment = Display::return_icon('px_transparent.gif');
2357 2357
                 }
2358 2358
                 $row = array();
2359 2359
                 $row[] = $ShowAssignment;
2360 2360
 
2361
-                if($all_vers=='1') {
2361
+                if ($all_vers == '1') {
2362 2362
                     $row[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=showpage&title='.api_htmlentities(urlencode($obj->reflink)).'&view='.$obj->id.'&session_id='.api_htmlentities(urlencode($_GET['$session_id'])).'&group_id='.api_htmlentities(urlencode($_GET['group_id'])).'">'.
2363 2363
                         api_htmlentities($obj->title).'</a>';
2364 2364
                 } else {
@@ -2369,21 +2369,21 @@  discard block
 block discarded – undo
2369 2369
                 $row[] = $obj->user_id != 0 ? UserManager::getUserProfileLink($userinfo) : get_lang('Anonymous').' ('.$obj->user_ip.')';
2370 2370
                 $row[] = $year.'-'.$month.'-'.$day.' '.$hours.":".$minutes.":".$seconds;
2371 2371
 
2372
-                if ($all_vers=='1') {
2372
+                if ($all_vers == '1') {
2373 2373
                     $row[] = $obj->version;
2374 2374
                 } else {
2375 2375
                     $showdelete = '';
2376
-                    if (api_is_allowed_to_edit(false,true)|| api_is_platform_admin()) {
2377
-                        $showdelete=' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete&title='.api_htmlentities(urlencode($obj->reflink)).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
2378
-                            Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL);
2376
+                    if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
2377
+                        $showdelete = ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete&title='.api_htmlentities(urlencode($obj->reflink)).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
2378
+                            Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
2379 2379
                     }
2380 2380
                     $row[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit&title='.api_htmlentities(urlencode($obj->reflink)).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
2381
-                        Display::return_icon('edit.png', get_lang('EditPage'),'',ICON_SIZE_SMALL).'</a>
2381
+                        Display::return_icon('edit.png', get_lang('EditPage'), '', ICON_SIZE_SMALL).'</a>
2382 2382
                         <a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=discuss&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
2383
-                        Display::return_icon('discuss.png', get_lang('Discuss'),'',ICON_SIZE_SMALL).'</a>
2383
+                        Display::return_icon('discuss.png', get_lang('Discuss'), '', ICON_SIZE_SMALL).'</a>
2384 2384
                         <a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=history&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
2385
-                        Display::return_icon('history.png', get_lang('History'),'',ICON_SIZE_SMALL).'</a> <a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=links&title='.api_htmlentities(urlencode($obj->reflink)).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
2386
-                        Display::return_icon('what_link_here.png', get_lang('LinksPages'),'',ICON_SIZE_SMALL).'</a>'.$showdelete;
2385
+                        Display::return_icon('history.png', get_lang('History'), '', ICON_SIZE_SMALL).'</a> <a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=links&title='.api_htmlentities(urlencode($obj->reflink)).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
2386
+                        Display::return_icon('what_link_here.png', get_lang('LinksPages'), '', ICON_SIZE_SMALL).'</a>'.$showdelete;
2387 2387
                 }
2388 2388
                 $rows[] = $row;
2389 2389
             }
@@ -2408,16 +2408,16 @@  discard block
 block discarded – undo
2408 2408
                     'all_vers' => $all_vers,
2409 2409
                 )
2410 2410
             );
2411
-            $table->set_header(0,get_lang('Type'), true, array ('style' => 'width:30px;'));
2412
-            $table->set_header(1,get_lang('Title'), true);
2411
+            $table->set_header(0, get_lang('Type'), true, array('style' => 'width:30px;'));
2412
+            $table->set_header(1, get_lang('Title'), true);
2413 2413
             if ($all_vers == '1') {
2414
-                $table->set_header(2,get_lang('Author'), true);
2415
-                $table->set_header(3,get_lang('Date'), true);
2416
-                $table->set_header(4,get_lang('Version'), true);
2414
+                $table->set_header(2, get_lang('Author'), true);
2415
+                $table->set_header(3, get_lang('Date'), true);
2416
+                $table->set_header(4, get_lang('Version'), true);
2417 2417
             } else {
2418
-                $table->set_header(2,get_lang('Author').' ('.get_lang('LastVersion').')', true);
2419
-                $table->set_header(3,get_lang('Date').' ('.get_lang('LastVersion').')', true);
2420
-                $table->set_header(4,get_lang('Actions'), false, array ('style' => 'width:130px;'));
2418
+                $table->set_header(2, get_lang('Author').' ('.get_lang('LastVersion').')', true);
2419
+                $table->set_header(3, get_lang('Date').' ('.get_lang('LastVersion').')', true);
2420
+                $table->set_header(4, get_lang('Actions'), false, array('style' => 'width:130px;'));
2421 2421
             }
2422 2422
             $table->display();
2423 2423
         } else {
@@ -2430,14 +2430,14 @@  discard block
 block discarded – undo
2430 2430
      * @todo replace this function with the formvalidator datepicker
2431 2431
      *
2432 2432
      */
2433
-    public function draw_date_picker($prefix,$default='')
2433
+    public function draw_date_picker($prefix, $default = '')
2434 2434
     {
2435 2435
         if (empty($default)) {
2436 2436
             $default = date('Y-m-d H:i:s');
2437 2437
         }
2438 2438
         $parts = explode(' ', $default);
2439
-        list($d_year,$d_month,$d_day) = explode('-',$parts[0]);
2440
-        list($d_hour,$d_minute) = explode(':',$parts[1]);
2439
+        list($d_year, $d_month, $d_day) = explode('-', $parts[0]);
2440
+        list($d_hour, $d_minute) = explode(':', $parts[1]);
2441 2441
 
2442 2442
         $month_list = array(
2443 2443
             1 => get_lang('JanuaryLong'),
@@ -2454,9 +2454,9 @@  discard block
 block discarded – undo
2454 2454
             12 => get_lang('DecemberLong'),
2455 2455
         );
2456 2456
 
2457
-        $minute = range(10,59);
2458
-        array_unshift($minute,'00','01','02','03','04','05','06','07','08','09');
2459
-        $date_form = self::make_select($prefix.'_day', array_combine(range(1,31),range(1,31)), $d_day);
2457
+        $minute = range(10, 59);
2458
+        array_unshift($minute, '00', '01', '02', '03', '04', '05', '06', '07', '08', '09');
2459
+        $date_form = self::make_select($prefix.'_day', array_combine(range(1, 31), range(1, 31)), $d_day);
2460 2460
         $date_form .= self::make_select($prefix.'_month', $month_list, $d_month);
2461 2461
         $date_form .= self::make_select(
2462 2462
                 $prefix.'_year',
@@ -2469,7 +2469,7 @@  discard block
 block discarded – undo
2469 2469
                 ),
2470 2470
                 $d_year
2471 2471
             ).'&nbsp;&nbsp;&nbsp;&nbsp;';
2472
-        $date_form .= self::make_select($prefix.'_hour', array_combine(range(0,23),range(0,23)), $d_hour).' : ';
2472
+        $date_form .= self::make_select($prefix.'_hour', array_combine(range(0, 23), range(0, 23)), $d_hour).' : ';
2473 2473
         $date_form .= self::make_select($prefix.'_minute', $minute, $d_minute);
2474 2474
 
2475 2475
         return $date_form;
@@ -2479,11 +2479,11 @@  discard block
 block discarded – undo
2479 2479
      * Draws an HTML form select with the given options
2480 2480
      *
2481 2481
      */
2482
-    public function make_select($name,$values,$checked='')
2482
+    public function make_select($name, $values, $checked = '')
2483 2483
     {
2484 2484
         $output = '<select name="'.$name.'" id="'.$name.'">';
2485
-        foreach($values as $key => $value) {
2486
-            $output .= '<option value="'.$key.'" '.(($checked==$key)?'selected="selected"':'').'>'.$value.'</option>';
2485
+        foreach ($values as $key => $value) {
2486
+            $output .= '<option value="'.$key.'" '.(($checked == $key) ? 'selected="selected"' : '').'>'.$value.'</option>';
2487 2487
         }
2488 2488
         $output .= '</select>';
2489 2489
         return $output;
@@ -2507,7 +2507,7 @@  discard block
 block discarded – undo
2507 2507
      */
2508 2508
     public function two_digits($number)
2509 2509
     {
2510
-        $number = (int)$number;
2510
+        $number = (int) $number;
2511 2511
         return ($number < 10) ? '0'.$number : $number;
2512 2512
     }
2513 2513
 
@@ -2525,7 +2525,7 @@  discard block
 block discarded – undo
2525 2525
                 WHERE c_id = '.$course_id.' AND id = '.$id.' ';
2526 2526
         $result = Database::query($sql);
2527 2527
         $data = array();
2528
-        while ($row=Database::fetch_array($result,'ASSOC'))   {
2528
+        while ($row = Database::fetch_array($result, 'ASSOC')) {
2529 2529
             $data = $row;
2530 2530
         }
2531 2531
         return $data;
@@ -2579,7 +2579,7 @@  discard block
 block discarded – undo
2579 2579
         $result = Database::query($sql);
2580 2580
         $data = array();
2581 2581
         if (Database::num_rows($result)) {
2582
-            $data = Database::fetch_array($result,'ASSOC');
2582
+            $data = Database::fetch_array($result, 'ASSOC');
2583 2583
         }
2584 2584
 
2585 2585
         return $data;
@@ -2673,9 +2673,9 @@  discard block
 block discarded – undo
2673 2673
         $result = self::getAllWiki();
2674 2674
         if (!empty($result)) {
2675 2675
             foreach ($result  as $is_editing_block) {
2676
-                $max_edit_time	= 1200; // 20 minutes
2677
-                $timestamp_edit	= strtotime($is_editing_block['time_edit']);
2678
-                $time_editing	= time()-$timestamp_edit;
2676
+                $max_edit_time = 1200; // 20 minutes
2677
+                $timestamp_edit = strtotime($is_editing_block['time_edit']);
2678
+                $time_editing = time() - $timestamp_edit;
2679 2679
 
2680 2680
                 // First prevent concurrent users and double version
2681 2681
                 if ($is_editing_block['is_editing'] == $userId) {
@@ -2684,7 +2684,7 @@  discard block
 block discarded – undo
2684 2684
                     unset($_SESSION['_version']);
2685 2685
                 }
2686 2686
                 // Second checks if has exceeded the time that a page may be available or if a page was edited and saved by its author
2687
-                if ($time_editing > $max_edit_time || ($is_editing_block['is_editing'] == $userId && $action!='edit')) {
2687
+                if ($time_editing > $max_edit_time || ($is_editing_block['is_editing'] == $userId && $action != 'edit')) {
2688 2688
                     self::updateWikiIsEditing($is_editing_block['is_editing']);
2689 2689
                 }
2690 2690
             }
@@ -2732,7 +2732,7 @@  discard block
 block discarded – undo
2732 2732
                 FROM ".$tbl_wiki."
2733 2733
                 WHERE c_id = $course_id AND ".$groupfilter.$condition_session."";
2734 2734
 
2735
-        $allpages=Database::query($sql);
2735
+        $allpages = Database::query($sql);
2736 2736
         while ($row = Database::fetch_array($allpages)) {
2737 2737
             $total_versions = $row['TOTAL_VERS'];
2738 2738
             $total_visits = intval($row['TOTAL_VISITS']);
@@ -2742,30 +2742,30 @@  discard block
 block discarded – undo
2742 2742
                 WHERE c_id = $course_id AND ".$groupfilter.$condition_session."";
2743 2743
         $allpages = Database::query($sql);
2744 2744
 
2745
-        while ($row=Database::fetch_array($allpages)) {
2745
+        while ($row = Database::fetch_array($allpages)) {
2746 2746
             $total_words = $total_words + self::word_count($row['content']);
2747
-            $total_links 			= $total_links+substr_count($row['content'], "href=");
2748
-            $total_links_anchors 	= $total_links_anchors+substr_count($row['content'], 'href="#');
2749
-            $total_links_mail		= $total_links_mail+substr_count($row['content'], 'href="mailto');
2750
-            $total_links_ftp 		= $total_links_ftp+substr_count($row['content'], 'href="ftp');
2751
-            $total_links_irc		= $total_links_irc+substr_count($row['content'], 'href="irc');
2752
-            $total_links_news 		= $total_links_news+substr_count($row['content'], 'href="news');
2753
-            $total_wlinks 			= $total_wlinks+substr_count($row['content'], "[[");
2754
-            $total_images 			= $total_images+substr_count($row['content'], "<img");
2747
+            $total_links = $total_links + substr_count($row['content'], "href=");
2748
+            $total_links_anchors = $total_links_anchors + substr_count($row['content'], 'href="#');
2749
+            $total_links_mail		= $total_links_mail + substr_count($row['content'], 'href="mailto');
2750
+            $total_links_ftp 		= $total_links_ftp + substr_count($row['content'], 'href="ftp');
2751
+            $total_links_irc = $total_links_irc + substr_count($row['content'], 'href="irc');
2752
+            $total_links_news = $total_links_news + substr_count($row['content'], 'href="news');
2753
+            $total_wlinks 			= $total_wlinks + substr_count($row['content'], "[[");
2754
+            $total_images 			= $total_images + substr_count($row['content'], "<img");
2755 2755
             $clean_total_flash = preg_replace('/player.swf/', ' ', $row['content']);
2756
-            $total_flash			= $total_flash+substr_count($clean_total_flash, '.swf"');
2756
+            $total_flash = $total_flash + substr_count($clean_total_flash, '.swf"');
2757 2757
             //.swf" end quotes prevent insert swf through flvplayer (is not counted)
2758
-            $total_mp3				= $total_mp3+substr_count($row['content'], ".mp3");
2759
-            $total_flv_p = $total_flv_p+substr_count($row['content'], ".flv");
2760
-            $total_flv				=	$total_flv_p/5;
2761
-            $total_youtube			= $total_youtube+substr_count($row['content'], "http://www.youtube.com");
2762
-            $total_multimedia		= $total_multimedia+substr_count($row['content'], "video/x-msvideo");
2763
-            $total_tables			= $total_tables+substr_count($row['content'], "<table");
2758
+            $total_mp3				= $total_mp3 + substr_count($row['content'], ".mp3");
2759
+            $total_flv_p = $total_flv_p + substr_count($row['content'], ".flv");
2760
+            $total_flv				= $total_flv_p / 5;
2761
+            $total_youtube = $total_youtube + substr_count($row['content'], "http://www.youtube.com");
2762
+            $total_multimedia = $total_multimedia + substr_count($row['content'], "video/x-msvideo");
2763
+            $total_tables = $total_tables + substr_count($row['content'], "<table");
2764 2764
         }
2765 2765
 
2766 2766
         //check only last version of all pages (current page)
2767 2767
 
2768
-        $sql =' SELECT *, COUNT(*) AS TOTAL_PAGES, SUM(hits) AS TOTAL_VISITS_LV
2768
+        $sql = ' SELECT *, COUNT(*) AS TOTAL_PAGES, SUM(hits) AS TOTAL_VISITS_LV
2769 2769
                 FROM  '.$tbl_wiki.' s1
2770 2770
                 WHERE s1.c_id = '.$course_id.' AND id=(
2771 2771
                     SELECT MAX(s2.id)
@@ -2776,9 +2776,9 @@  discard block
 block discarded – undo
2776 2776
                         '.$groupfilter.' AND
2777 2777
                         session_id='.$session_id.')';
2778 2778
         $allpages = Database::query($sql);
2779
-        while ($row=Database::fetch_array($allpages)) {
2780
-            $total_pages	 		= $row['TOTAL_PAGES'];
2781
-            $total_visits_lv 		= intval($row['TOTAL_VISITS_LV']);
2779
+        while ($row = Database::fetch_array($allpages)) {
2780
+            $total_pages = $row['TOTAL_PAGES'];
2781
+            $total_visits_lv = intval($row['TOTAL_VISITS_LV']);
2782 2782
         }
2783 2783
 
2784 2784
         $total_words_lv = 0;
@@ -2810,29 +2810,29 @@  discard block
 block discarded – undo
2810 2810
                 )';
2811 2811
         $allpages = Database::query($sql);
2812 2812
 
2813
-        while ($row=Database::fetch_array($allpages)) {
2814
-            $total_words_lv 		= $total_words_lv+ self::word_count($row['content']);
2815
-            $total_links_lv 		= $total_links_lv+substr_count($row['content'], "href=");
2816
-            $total_links_anchors_lv	= $total_links_anchors_lv+substr_count($row['content'], 'href="#');
2817
-            $total_links_mail_lv 	= $total_links_mail_lv+substr_count($row['content'], 'href="mailto');
2818
-            $total_links_ftp_lv 	= $total_links_ftp_lv+substr_count($row['content'], 'href="ftp');
2819
-            $total_links_irc_lv 	= $total_links_irc_lv+substr_count($row['content'], 'href="irc');
2820
-            $total_links_news_lv 	= $total_links_news_lv+substr_count($row['content'], 'href="news');
2821
-            $total_wlinks_lv 		= $total_wlinks_lv+substr_count($row['content'], "[[");
2822
-            $total_images_lv 		= $total_images_lv+substr_count($row['content'], "<img");
2813
+        while ($row = Database::fetch_array($allpages)) {
2814
+            $total_words_lv 		= $total_words_lv + self::word_count($row['content']);
2815
+            $total_links_lv 		= $total_links_lv + substr_count($row['content'], "href=");
2816
+            $total_links_anchors_lv = $total_links_anchors_lv + substr_count($row['content'], 'href="#');
2817
+            $total_links_mail_lv 	= $total_links_mail_lv + substr_count($row['content'], 'href="mailto');
2818
+            $total_links_ftp_lv 	= $total_links_ftp_lv + substr_count($row['content'], 'href="ftp');
2819
+            $total_links_irc_lv 	= $total_links_irc_lv + substr_count($row['content'], 'href="irc');
2820
+            $total_links_news_lv 	= $total_links_news_lv + substr_count($row['content'], 'href="news');
2821
+            $total_wlinks_lv 		= $total_wlinks_lv + substr_count($row['content'], "[[");
2822
+            $total_images_lv 		= $total_images_lv + substr_count($row['content'], "<img");
2823 2823
             $clean_total_flash_lv = preg_replace('/player.swf/', ' ', $row['content']);
2824
-            $total_flash_lv			= $total_flash_lv+substr_count($clean_total_flash_lv, '.swf"');
2824
+            $total_flash_lv = $total_flash_lv + substr_count($clean_total_flash_lv, '.swf"');
2825 2825
             //.swf" end quotes prevent insert swf through flvplayer (is not counted)
2826
-            $total_mp3_lv			= $total_mp3_lv+substr_count($row['content'], ".mp3");
2827
-            $total_flv_p_lv = $total_flv_p_lv+substr_count($row['content'], ".flv");
2828
-            $total_flv_lv			= $total_flv_p_lv/5;
2829
-            $total_youtube_lv		= $total_youtube_lv+substr_count($row['content'], "http://www.youtube.com");
2830
-            $total_multimedia_lv	= $total_multimedia_lv+substr_count($row['content'], "video/x-msvideo");
2831
-            $total_tables_lv		= $total_tables_lv+substr_count($row['content'], "<table");
2826
+            $total_mp3_lv			= $total_mp3_lv + substr_count($row['content'], ".mp3");
2827
+            $total_flv_p_lv = $total_flv_p_lv + substr_count($row['content'], ".flv");
2828
+            $total_flv_lv			= $total_flv_p_lv / 5;
2829
+            $total_youtube_lv = $total_youtube_lv + substr_count($row['content'], "http://www.youtube.com");
2830
+            $total_multimedia_lv = $total_multimedia_lv + substr_count($row['content'], "video/x-msvideo");
2831
+            $total_tables_lv = $total_tables_lv + substr_count($row['content'], "<table");
2832 2832
         }
2833 2833
 
2834 2834
         //Total pages edited at this time
2835
-        $total_editing_now=0;
2835
+        $total_editing_now = 0;
2836 2836
         $sql = 'SELECT *, COUNT(*) AS TOTAL_EDITING_NOW
2837 2837
                 FROM  '.$tbl_wiki.' s1
2838 2838
                 WHERE is_editing!=0 AND s1.c_id = '.$course_id.' AND
@@ -2847,66 +2847,66 @@  discard block
 block discarded – undo
2847 2847
         )';
2848 2848
 
2849 2849
         // Can not use group by because the mark is set in the latest version
2850
-        $allpages=Database::query($sql);
2851
-        while ($row=Database::fetch_array($allpages)) {
2852
-            $total_editing_now	= $row['TOTAL_EDITING_NOW'];
2850
+        $allpages = Database::query($sql);
2851
+        while ($row = Database::fetch_array($allpages)) {
2852
+            $total_editing_now = $row['TOTAL_EDITING_NOW'];
2853 2853
         }
2854 2854
 
2855 2855
         // Total hidden pages
2856
-        $total_hidden=0;
2856
+        $total_hidden = 0;
2857 2857
         $sql = 'SELECT * FROM '.$tbl_wiki.'
2858 2858
                 WHERE  c_id = '.$course_id.' AND visibility=0 AND '.$groupfilter.$condition_session.'
2859 2859
                 GROUP BY reflink';
2860 2860
         // or group by page_id. As the mark of hidden places it in all versions of the page, I can use group by to see the first
2861
-        $allpages=Database::query($sql);
2862
-        while ($row=Database::fetch_array($allpages)) {
2863
-            $total_hidden = $total_hidden+1;
2861
+        $allpages = Database::query($sql);
2862
+        while ($row = Database::fetch_array($allpages)) {
2863
+            $total_hidden = $total_hidden + 1;
2864 2864
         }
2865 2865
 
2866 2866
         //Total protect pages
2867
-        $total_protected=0;
2867
+        $total_protected = 0;
2868 2868
         $sql = 'SELECT * FROM '.$tbl_wiki.'
2869 2869
                 WHERE  c_id = '.$course_id.' AND editlock=1 AND '.$groupfilter.$condition_session.'
2870 2870
                 GROUP BY reflink';
2871 2871
         // or group by page_id. As the mark of protected page is the first version of the page, I can use group by
2872 2872
 
2873
-        $allpages=Database::query($sql);
2874
-        while ($row=Database::fetch_array($allpages)) {
2875
-            $total_protected = $total_protected+1;
2873
+        $allpages = Database::query($sql);
2874
+        while ($row = Database::fetch_array($allpages)) {
2875
+            $total_protected = $total_protected + 1;
2876 2876
         }
2877 2877
 
2878 2878
         // Total empty versions.
2879
-        $total_empty_content=0;
2879
+        $total_empty_content = 0;
2880 2880
         $sql = 'SELECT * FROM '.$tbl_wiki.'
2881 2881
                 WHERE
2882 2882
                     c_id = '.$course_id.' AND
2883 2883
                     content="" AND
2884 2884
                     '.$groupfilter.$condition_session.'';
2885 2885
         $allpages = Database::query($sql);
2886
-        while ($row=Database::fetch_array($allpages)) {
2887
-            $total_empty_content	= $total_empty_content+1;
2886
+        while ($row = Database::fetch_array($allpages)) {
2887
+            $total_empty_content = $total_empty_content + 1;
2888 2888
         }
2889 2889
 
2890 2890
         //Total empty pages (last version)
2891 2891
 
2892
-        $total_empty_content_lv=0;
2892
+        $total_empty_content_lv = 0;
2893 2893
         $sql = 'SELECT  * FROM  '.$tbl_wiki.' s1
2894 2894
                 WHERE s1.c_id = '.$course_id.' AND content="" AND id=(
2895 2895
                 SELECT MAX(s2.id) FROM '.$tbl_wiki.' s2
2896 2896
                 WHERE s1.c_id = '.$course_id.' AND s1.reflink = s2.reflink AND '.$groupfilter.' AND session_id='.$session_id.')';
2897
-        $allpages=Database::query($sql);
2897
+        $allpages = Database::query($sql);
2898 2898
         while ($row = Database::fetch_array($allpages)) {
2899
-            $total_empty_content_lv	= $total_empty_content_lv+1;
2899
+            $total_empty_content_lv = $total_empty_content_lv + 1;
2900 2900
         }
2901 2901
 
2902 2902
         // Total locked discuss pages
2903
-        $total_lock_disc=0;
2903
+        $total_lock_disc = 0;
2904 2904
         $sql = 'SELECT * FROM '.$tbl_wiki.'
2905 2905
                 WHERE c_id = '.$course_id.' AND addlock_disc=0 AND '.$groupfilter.$condition_session.'
2906 2906
                 GROUP BY reflink';//group by because mark lock in all vers, then always is ok
2907
-        $allpages=Database::query($sql);
2907
+        $allpages = Database::query($sql);
2908 2908
         while ($row = Database::fetch_array($allpages)) {
2909
-            $total_lock_disc	= $total_lock_disc+1;
2909
+            $total_lock_disc = $total_lock_disc + 1;
2910 2910
         }
2911 2911
 
2912 2912
         // Total hidden discuss pages.
@@ -2917,7 +2917,7 @@  discard block
 block discarded – undo
2917 2917
         //group by because mark lock in all vers, then always is ok
2918 2918
         $allpages = Database::query($sql);
2919 2919
         while ($row = Database::fetch_array($allpages)) {
2920
-            $total_hidden_disc	= $total_hidden_disc+1;
2920
+            $total_hidden_disc = $total_hidden_disc + 1;
2921 2921
         }
2922 2922
 
2923 2923
         //Total versions with any short comment by user or system
@@ -2925,44 +2925,44 @@  discard block
 block discarded – undo
2925 2925
         $total_comment_version = 0;
2926 2926
         $sql = 'SELECT * FROM '.$tbl_wiki.'
2927 2927
                 WHERE c_id = '.$course_id.' AND comment!="" AND '.$groupfilter.$condition_session.'';
2928
-        $allpages=Database::query($sql);
2928
+        $allpages = Database::query($sql);
2929 2929
         while ($row = Database::fetch_array($allpages)) {
2930
-            $total_comment_version	= $total_comment_version+1;
2930
+            $total_comment_version = $total_comment_version + 1;
2931 2931
         }
2932 2932
 
2933 2933
         // Total pages that can only be scored by teachers.
2934 2934
 
2935
-        $total_only_teachers_rating=0;
2935
+        $total_only_teachers_rating = 0;
2936 2936
         $sql = 'SELECT * FROM '.$tbl_wiki.'
2937 2937
                 WHERE c_id = '.$course_id.' AND
2938 2938
                 ratinglock_disc = 0 AND
2939 2939
                 '.$groupfilter.$condition_session.'
2940 2940
                 GROUP BY reflink';//group by because mark lock in all vers, then always is ok
2941
-        $allpages=Database::query($sql);
2942
-        while ($row=Database::fetch_array($allpages)) {
2943
-            $total_only_teachers_rating	= $total_only_teachers_rating+1;
2941
+        $allpages = Database::query($sql);
2942
+        while ($row = Database::fetch_array($allpages)) {
2943
+            $total_only_teachers_rating = $total_only_teachers_rating + 1;
2944 2944
         }
2945 2945
 
2946 2946
         // Total pages scored by peers
2947 2947
         // put always this line alfter check num all pages and num pages rated by teachers
2948
-        $total_rating_by_peers=$total_pages-$total_only_teachers_rating;
2948
+        $total_rating_by_peers = $total_pages - $total_only_teachers_rating;
2949 2949
 
2950 2950
         //Total pages identified as standard task
2951 2951
 
2952
-        $total_task=0;
2953
-        $sql='SELECT * FROM '.$tbl_wiki.', '.$tbl_wiki_conf.'
2952
+        $total_task = 0;
2953
+        $sql = 'SELECT * FROM '.$tbl_wiki.', '.$tbl_wiki_conf.'
2954 2954
               WHERE '.$tbl_wiki_conf.'.c_id = '.$course_id.' AND
2955 2955
                '.$tbl_wiki_conf.'.task!="" AND
2956 2956
                '.$tbl_wiki_conf.'.page_id='.$tbl_wiki.'.page_id AND
2957 2957
                 '.$tbl_wiki.'.'.$groupfilter.$condition_session;
2958 2958
         $allpages = Database::query($sql);
2959
-        while ($row=Database::fetch_array($allpages)) {
2960
-            $total_task=$total_task+1;
2959
+        while ($row = Database::fetch_array($allpages)) {
2960
+            $total_task = $total_task + 1;
2961 2961
         }
2962 2962
 
2963 2963
         //Total pages identified as teacher page (wiki portfolio mode - individual assignment)
2964 2964
 
2965
-        $total_teacher_assignment=0;
2965
+        $total_teacher_assignment = 0;
2966 2966
         $sql = 'SELECT  * FROM  '.$tbl_wiki.' s1
2967 2967
                 WHERE s1.c_id = '.$course_id.' AND assignment=1 AND id=(
2968 2968
                     SELECT MAX(s2.id)
@@ -2972,20 +2972,20 @@  discard block
 block discarded – undo
2972 2972
         //mark all versions, but do not use group by reflink because y want the pages not versions
2973 2973
         $allpages = Database::query($sql);
2974 2974
         while ($row = Database::fetch_array($allpages)) {
2975
-            $total_teacher_assignment=$total_teacher_assignment+1;
2975
+            $total_teacher_assignment = $total_teacher_assignment + 1;
2976 2976
         }
2977 2977
 
2978 2978
         //Total pages identifies as student page (wiki portfolio mode - individual assignment)
2979 2979
 
2980
-        $total_student_assignment=0;
2980
+        $total_student_assignment = 0;
2981 2981
         $sql = 'SELECT  * FROM  '.$tbl_wiki.' s1
2982 2982
                 WHERE s1.c_id = '.$course_id.' AND assignment=2 AND
2983 2983
                 id=(SELECT MAX(s2.id) FROM '.$tbl_wiki.' s2
2984 2984
                 WHERE s2.c_id = '.$course_id.' AND s1.reflink = s2.reflink AND '.$groupfilter.' AND session_id='.$session_id.')';
2985 2985
         //mark all versions, but do not use group by reflink because y want the pages not versions
2986
-        $allpages=Database::query($sql);
2987
-        while ($row=Database::fetch_array($allpages)) {
2988
-            $total_student_assignment = $total_student_assignment+1;
2986
+        $allpages = Database::query($sql);
2987
+        while ($row = Database::fetch_array($allpages)) {
2988
+            $total_student_assignment = $total_student_assignment + 1;
2989 2989
         }
2990 2990
 
2991 2991
         //Current Wiki status add new pages
@@ -2994,36 +2994,36 @@  discard block
 block discarded – undo
2994 2994
                 GROUP BY addlock';//group by because mark 0 in all vers, then always is ok
2995 2995
         $allpages = Database::query($sql);
2996 2996
         $wiki_add_lock = null;
2997
-        while ($row=Database::fetch_array($allpages)) {
2998
-            $wiki_add_lock=$row['addlock'];
2997
+        while ($row = Database::fetch_array($allpages)) {
2998
+            $wiki_add_lock = $row['addlock'];
2999 2999
         }
3000 3000
 
3001
-        if ($wiki_add_lock==1) {
3002
-            $status_add_new_pag=get_lang('Yes');
3001
+        if ($wiki_add_lock == 1) {
3002
+            $status_add_new_pag = get_lang('Yes');
3003 3003
         } else {
3004
-            $status_add_new_pag=get_lang('No');
3004
+            $status_add_new_pag = get_lang('No');
3005 3005
         }
3006 3006
 
3007 3007
         //Creation date of the oldest wiki page and version
3008 3008
 
3009
-        $first_wiki_date='0000-00-00 00:00:00';
3009
+        $first_wiki_date = '0000-00-00 00:00:00';
3010 3010
         $sql = 'SELECT * FROM '.$tbl_wiki.'
3011 3011
                 WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.'
3012 3012
                 ORDER BY dtime ASC LIMIT 1';
3013
-        $allpages=Database::query($sql);
3014
-        while ($row=Database::fetch_array($allpages)) {
3015
-            $first_wiki_date=$row['dtime'];
3013
+        $allpages = Database::query($sql);
3014
+        while ($row = Database::fetch_array($allpages)) {
3015
+            $first_wiki_date = $row['dtime'];
3016 3016
         }
3017 3017
 
3018 3018
         // Date of publication of the latest wiki version.
3019 3019
 
3020
-        $last_wiki_date='0000-00-00 00:00:00';
3020
+        $last_wiki_date = '0000-00-00 00:00:00';
3021 3021
         $sql = 'SELECT * FROM '.$tbl_wiki.'
3022 3022
                 WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.'
3023 3023
                 ORDER BY dtime DESC LIMIT 1';
3024
-        $allpages=Database::query($sql);
3025
-        while ($row=Database::fetch_array($allpages)) {
3026
-            $last_wiki_date=$row['dtime'];
3024
+        $allpages = Database::query($sql);
3025
+        while ($row = Database::fetch_array($allpages)) {
3026
+            $last_wiki_date = $row['dtime'];
3027 3027
         }
3028 3028
 
3029 3029
         // Average score of all wiki pages. (If a page has not scored zero rated)
@@ -3035,18 +3035,18 @@  discard block
 block discarded – undo
3035 3035
         // Do not use "count" because using "group by", would give a wrong value
3036 3036
         $allpages = Database::query($sql);
3037 3037
         $total_score = 0;
3038
-        while ($row=Database::fetch_array($allpages)) {
3039
-            $total_score = $total_score+$row['TOTAL_SCORE'];
3038
+        while ($row = Database::fetch_array($allpages)) {
3039
+            $total_score = $total_score + $row['TOTAL_SCORE'];
3040 3040
         }
3041 3041
 
3042 3042
         if (!empty($total_pages)) {
3043
-            $media_score = $total_score/$total_pages;
3043
+            $media_score = $total_score / $total_pages;
3044 3044
             //put always this line alfter check num all pages
3045 3045
         }
3046 3046
 
3047 3047
         // Average user progress in his pages.
3048 3048
 
3049
-        $media_progress=0;
3049
+        $media_progress = 0;
3050 3050
         $sql = 'SELECT  *, SUM(progress) AS TOTAL_PROGRESS
3051 3051
                 FROM  '.$tbl_wiki.' s1
3052 3052
                 WHERE s1.c_id = '.$course_id.' AND id=
@@ -3060,24 +3060,24 @@  discard block
 block discarded – undo
3060 3060
         // As the value is only the latest version I can not use group by
3061 3061
         $allpages = Database::query($sql);
3062 3062
         while ($row = Database::fetch_array($allpages)) {
3063
-            $total_progress	= $row['TOTAL_PROGRESS'];
3063
+            $total_progress = $row['TOTAL_PROGRESS'];
3064 3064
         }
3065 3065
 
3066 3066
         if (!empty($total_pages)) {
3067
-            $media_progress=$total_progress/$total_pages;
3067
+            $media_progress = $total_progress / $total_pages;
3068 3068
             //put always this line alfter check num all pages
3069 3069
         }
3070 3070
 
3071 3071
         //Total users that have participated in the Wiki
3072 3072
 
3073
-        $total_users=0;
3073
+        $total_users = 0;
3074 3074
         $sql = 'SELECT * FROM '.$tbl_wiki.'
3075 3075
                 WHERE  c_id = '.$course_id.' AND '.$groupfilter.$condition_session.'
3076 3076
                 GROUP BY user_id';
3077 3077
         //as the mark of user it in all versions of the page, I can use group by to see the first
3078
-        $allpages=Database::query($sql);
3079
-        while ($row=Database::fetch_array($allpages)) {
3080
-            $total_users = $total_users+1;
3078
+        $allpages = Database::query($sql);
3079
+        while ($row = Database::fetch_array($allpages)) {
3080
+            $total_users = $total_users + 1;
3081 3081
         }
3082 3082
 
3083 3083
         // Total of different IP addresses that have participated in the wiki
@@ -3085,9 +3085,9 @@  discard block
 block discarded – undo
3085 3085
         $sql = 'SELECT * FROM '.$tbl_wiki.'
3086 3086
               WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.'
3087 3087
               GROUP BY user_ip';
3088
-        $allpages=Database::query($sql);
3089
-        while ($row=Database::fetch_array($allpages)) {
3090
-            $total_ip	= $total_ip+1;
3088
+        $allpages = Database::query($sql);
3089
+        while ($row = Database::fetch_array($allpages)) {
3090
+            $total_ip = $total_ip + 1;
3091 3091
         }
3092 3092
 
3093 3093
         echo '<table class="data_table">';
@@ -3286,11 +3286,11 @@  discard block
 block discarded – undo
3286 3286
                 } else {
3287 3287
                     $row[] = get_lang('Anonymous').' ('.$obj->user_ip.')';
3288 3288
                 }
3289
-                $row[] ='<a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=usercontrib&user_id='.urlencode($obj->user_id).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'.$obj->NUM_EDIT.'</a>';
3289
+                $row[] = '<a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=usercontrib&user_id='.urlencode($obj->user_id).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'.$obj->NUM_EDIT.'</a>';
3290 3290
                 $rows[] = $row;
3291 3291
             }
3292 3292
 
3293
-            $table = new SortableTableFromArrayConfig($rows,1,10,'MostActiveUsersA_table','','','DESC');
3293
+            $table = new SortableTableFromArrayConfig($rows, 1, 10, 'MostActiveUsersA_table', '', '', 'DESC');
3294 3294
             $table->set_additional_parameters(
3295 3295
                 array(
3296 3296
                     'cidReq' => Security::remove_XSS($_GET['cidReq']),
@@ -3299,8 +3299,8 @@  discard block
 block discarded – undo
3299 3299
                     'group_id' => Security::remove_XSS($_GET['group_id'])
3300 3300
                 )
3301 3301
             );
3302
-            $table->set_header(0,get_lang('Author'), true);
3303
-            $table->set_header(1,get_lang('Contributions'), true,array ('style' => 'width:30px;'));
3302
+            $table->set_header(0, get_lang('Author'), true);
3303
+            $table->set_header(1, get_lang('Contributions'), true, array('style' => 'width:30px;'));
3304 3304
             $table->display();
3305 3305
         }
3306 3306
     }
@@ -3316,8 +3316,8 @@  discard block
 block discarded – undo
3316 3316
         $groupfilter = $this->groupfilter;
3317 3317
         $tbl_wiki_discuss = $this->tbl_wiki_discuss;
3318 3318
 
3319
-        if (api_get_session_id()!=0 &&
3320
-            api_is_allowed_to_session_edit(false,true)==false
3319
+        if (api_get_session_id() != 0 &&
3320
+            api_is_allowed_to_session_edit(false, true) == false
3321 3321
         ) {
3322 3322
             api_not_allowed();
3323 3323
         }
@@ -3380,9 +3380,9 @@  discard block
 block discarded – undo
3380 3380
         //mode assignment: previous to show  page type
3381 3381
         $icon_assignment = null;
3382 3382
         if ($row['assignment'] == 1) {
3383
-            $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'),'',ICON_SIZE_SMALL);
3383
+            $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'), '', ICON_SIZE_SMALL);
3384 3384
         } elseif ($row['assignment'] == 2) {
3385
-            $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWorkExtra'),'',ICON_SIZE_SMALL);
3385
+            $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWorkExtra'), '', ICON_SIZE_SMALL);
3386 3386
         }
3387 3387
 
3388 3388
         $countWPost = null;
@@ -3393,23 +3393,23 @@  discard block
 block discarded – undo
3393 3393
             // Show discussion to students if isn't hidden.
3394 3394
             // Show page to all teachers if is hidden.
3395 3395
             // Mode assignments: If is hidden, show pages to student only if student is the author
3396
-            if ($row['visibility_disc']==1 ||
3397
-                api_is_allowed_to_edit(false,true) ||
3396
+            if ($row['visibility_disc'] == 1 ||
3397
+                api_is_allowed_to_edit(false, true) ||
3398 3398
                 api_is_platform_admin() ||
3399
-                ($row['assignment']==2 && $row['visibility_disc']==0 && (api_get_user_id()==$row['user_id']))
3399
+                ($row['assignment'] == 2 && $row['visibility_disc'] == 0 && (api_get_user_id() == $row['user_id']))
3400 3400
             ) {
3401 3401
                 echo '<div id="wikititle">';
3402 3402
 
3403 3403
                 // discussion action: protecting (locking) the discussion
3404 3404
                 $addlock_disc = null;
3405 3405
                 $lock_unlock_disc = null;
3406
-                if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
3406
+                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3407 3407
                     if (self::check_addlock_discuss() == 1) {
3408
-                        $addlock_disc = Display::return_icon('unlock.png', get_lang('UnlockDiscussExtra'),'',ICON_SIZE_SMALL);
3409
-                        $lock_unlock_disc ='unlockdisc';
3408
+                        $addlock_disc = Display::return_icon('unlock.png', get_lang('UnlockDiscussExtra'), '', ICON_SIZE_SMALL);
3409
+                        $lock_unlock_disc = 'unlockdisc';
3410 3410
                     } else {
3411
-                        $addlock_disc = Display::return_icon('lock.png', get_lang('LockDiscussExtra'),'',ICON_SIZE_SMALL);
3412
-                        $lock_unlock_disc ='lockdisc';
3411
+                        $addlock_disc = Display::return_icon('lock.png', get_lang('LockDiscussExtra'), '', ICON_SIZE_SMALL);
3412
+                        $lock_unlock_disc = 'lockdisc';
3413 3413
                     }
3414 3414
                 }
3415 3415
                 echo '<span style="float:right">';
@@ -3419,13 +3419,13 @@  discard block
 block discarded – undo
3419 3419
                 // discussion action: visibility.  Show discussion to students if isn't hidden. Show page to all teachers if is hidden.
3420 3420
                 $visibility_disc = null;
3421 3421
                 $hide_show_disc = null;
3422
-                if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
3423
-                    if (self::check_visibility_discuss()==1) {
3422
+                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3423
+                    if (self::check_visibility_discuss() == 1) {
3424 3424
                         /// TODO: 	Fix Mode assignments: If is hidden, show discussion to student only if student is the author
3425
-                        $visibility_disc = Display::return_icon('visible.png', get_lang('ShowDiscussExtra'),'',ICON_SIZE_SMALL);
3425
+                        $visibility_disc = Display::return_icon('visible.png', get_lang('ShowDiscussExtra'), '', ICON_SIZE_SMALL);
3426 3426
                         $hide_show_disc = 'hidedisc';
3427 3427
                     } else {
3428
-                        $visibility_disc = Display::return_icon('invisible.png', get_lang('HideDiscussExtra'),'',ICON_SIZE_SMALL);
3428
+                        $visibility_disc = Display::return_icon('invisible.png', get_lang('HideDiscussExtra'), '', ICON_SIZE_SMALL);
3429 3429
                         $hide_show_disc = 'showdisc';
3430 3430
                     }
3431 3431
                 }
@@ -3436,12 +3436,12 @@  discard block
 block discarded – undo
3436 3436
                 //discussion action: check add rating lock. Show/Hide list to rating for all student
3437 3437
                 $lock_unlock_rating_disc = null;
3438 3438
                 $ratinglock_disc = null;
3439
-                if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
3439
+                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3440 3440
                     if (self::check_ratinglock_discuss() == 1) {
3441
-                        $ratinglock_disc = Display::return_icon('star.png', get_lang('UnlockRatingDiscussExtra'),'',ICON_SIZE_SMALL);
3441
+                        $ratinglock_disc = Display::return_icon('star.png', get_lang('UnlockRatingDiscussExtra'), '', ICON_SIZE_SMALL);
3442 3442
                         $lock_unlock_rating_disc = 'unlockrating';
3443 3443
                     } else {
3444
-                        $ratinglock_disc = Display::return_icon('star_na.png', get_lang('LockRatingDiscussExtra'),'',ICON_SIZE_SMALL);
3444
+                        $ratinglock_disc = Display::return_icon('star_na.png', get_lang('LockRatingDiscussExtra'), '', ICON_SIZE_SMALL);
3445 3445
                         $lock_unlock_rating_disc = 'lockrating';
3446 3446
                     }
3447 3447
                 }
@@ -3452,11 +3452,11 @@  discard block
 block discarded – undo
3452 3452
 
3453 3453
                 //discussion action: email notification
3454 3454
                 if (self::check_notify_discuss($page) == 1) {
3455
-                    $notify_disc= Display::return_icon('messagebox_info.png', get_lang('NotifyDiscussByEmail'),'',ICON_SIZE_SMALL);
3456
-                    $lock_unlock_notify_disc='unlocknotifydisc';
3455
+                    $notify_disc = Display::return_icon('messagebox_info.png', get_lang('NotifyDiscussByEmail'), '', ICON_SIZE_SMALL);
3456
+                    $lock_unlock_notify_disc = 'unlocknotifydisc';
3457 3457
                 } else {
3458
-                    $notify_disc= Display::return_icon('mail.png', get_lang('CancelNotifyDiscussByEmail'),'',ICON_SIZE_SMALL);
3459
-                    $lock_unlock_notify_disc='locknotifydisc';
3458
+                    $notify_disc = Display::return_icon('mail.png', get_lang('CancelNotifyDiscussByEmail'), '', ICON_SIZE_SMALL);
3459
+                    $lock_unlock_notify_disc = 'locknotifydisc';
3460 3460
                 }
3461 3461
                 echo '<span style="float:right">';
3462 3462
                 echo '<a href="index.php?action=discuss&amp;actionpage='.$lock_unlock_notify_disc.'&amp;title='.api_htmlentities(urlencode($page)).'">'.$notify_disc.'</a>';
@@ -3468,22 +3468,22 @@  discard block
 block discarded – undo
3468 3468
 
3469 3469
                 echo '</div>';
3470 3470
 
3471
-                if ($row['addlock_disc']==1 || api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
3471
+                if ($row['addlock_disc'] == 1 || api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3472 3472
                     //show comments but students can't add theirs
3473 3473
                     ?>
3474 3474
                     <form name="form1" method="post" action="">
3475 3475
                         <table>
3476 3476
                             <tr>
3477
-                                <td valign="top" ><?php echo get_lang('Comments');?>:</td>
3478
-                                <?php  echo '<input type="hidden" name="wpost_id" value="'.md5(uniqid(rand(), true)).'">';//prevent double post ?>
3477
+                                <td valign="top" ><?php echo get_lang('Comments'); ?>:</td>
3478
+                                <?php  echo '<input type="hidden" name="wpost_id" value="'.md5(uniqid(rand(), true)).'">'; //prevent double post ?>
3479 3479
                                 <td><textarea name="comment" cols="80" rows="5" id="comment"></textarea></td>
3480 3480
                             </tr>
3481 3481
                             <tr>
3482 3482
                                 <?php
3483 3483
                                 //check if rating is allowed
3484
-                                if ($row['ratinglock_disc']==1 || api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
3484
+                                if ($row['ratinglock_disc'] == 1 || api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3485 3485
                                     ?>
3486
-                                    <td><?php echo get_lang('Rating');?>: </td>
3486
+                                    <td><?php echo get_lang('Rating'); ?>: </td>
3487 3487
                                     <td valign="top"><select name="rating" id="rating">
3488 3488
                                             <option value="-" selected>-</option>
3489 3489
                                             <option value="0">0</option>
@@ -3500,7 +3500,7 @@  discard block
 block discarded – undo
3500 3500
                                         </select></td>
3501 3501
                                 <?php
3502 3502
                                 } else {
3503
-                                    echo '<input type=hidden name="rating" value="-">';// must pass a default value to avoid rate automatically
3503
+                                    echo '<input type=hidden name="rating" value="-">'; // must pass a default value to avoid rate automatically
3504 3504
                                 }
3505 3505
                                 ?>
3506 3506
                             </tr>
@@ -3540,12 +3540,12 @@  discard block
 block discarded – undo
3540 3540
                 $sql = "SELECT * FROM $tbl_wiki_discuss
3541 3541
                         WHERE c_id = $course_id AND publication_id='".$id."' AND NOT p_score='-'";
3542 3542
                 $result3 = Database::query($sql);
3543
-                $countWPost_score= Database::num_rows($result3);
3543
+                $countWPost_score = Database::num_rows($result3);
3544 3544
 
3545
-                echo ' - '.get_lang('NumCommentsScore').': '.$countWPost_score;//
3545
+                echo ' - '.get_lang('NumCommentsScore').': '.$countWPost_score; //
3546 3546
 
3547
-                if ($countWPost_score!=0) {
3548
-                    $avg_WPost_score = round($row2['sumWPost'] / $countWPost_score,2).' / 10';
3547
+                if ($countWPost_score != 0) {
3548
+                    $avg_WPost_score = round($row2['sumWPost'] / $countWPost_score, 2).' / 10';
3549 3549
                 } else {
3550 3550
                     $avg_WPost_score = $countWPost_score;
3551 3551
                 }
@@ -3563,16 +3563,16 @@  discard block
 block discarded – undo
3563 3563
 
3564 3564
                 echo '<hr noshade size="1">';
3565 3565
 
3566
-                while ($row=Database::fetch_array($result)) {
3566
+                while ($row = Database::fetch_array($result)) {
3567 3567
                     $userinfo = api_get_user_info($row['userc_id']);
3568
-                    if (($userinfo['status'])=="5") {
3569
-                        $author_status=get_lang('Student');
3568
+                    if (($userinfo['status']) == "5") {
3569
+                        $author_status = get_lang('Student');
3570 3570
                     } else {
3571
-                        $author_status=get_lang('Teacher');
3571
+                        $author_status = get_lang('Teacher');
3572 3572
                     }
3573 3573
 
3574 3574
                     $name = $userinfo['complete_name'];
3575
-                    $author_photo= '<img src="'.$userinfo['avatar'].'" alt="'.api_htmlentities($name).'"  width="40" height="50" align="top"  title="'.api_htmlentities($name).'"  />';
3575
+                    $author_photo = '<img src="'.$userinfo['avatar'].'" alt="'.api_htmlentities($name).'"  width="40" height="50" align="top"  title="'.api_htmlentities($name).'"  />';
3576 3576
 
3577 3577
                     //stars
3578 3578
                     $p_score = $row['p_score'];
@@ -3651,7 +3651,7 @@  discard block
 block discarded – undo
3651 3651
         }
3652 3652
         echo '</div>';
3653 3653
 
3654
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { //only by professors if page is hidden
3654
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { //only by professors if page is hidden
3655 3655
             $sql = 'SELECT  *
3656 3656
                     FROM  '.$tbl_wiki.' s1
3657 3657
         		    WHERE s1.c_id = '.$course_id.' AND id=(
@@ -3677,26 +3677,26 @@  discard block
 block discarded – undo
3677 3677
                 $username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username']), ENT_QUOTES);
3678 3678
 
3679 3679
                 //get type assignment icon
3680
-                if ($obj->assignment==1) {
3681
-                    $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL);
3682
-                } elseif ($obj->assignment==2) {
3683
-                    $ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
3684
-                } elseif ($obj->assignment==0) {
3680
+                if ($obj->assignment == 1) {
3681
+                    $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL);
3682
+                } elseif ($obj->assignment == 2) {
3683
+                    $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
3684
+                } elseif ($obj->assignment == 0) {
3685 3685
                     $ShowAssignment = Display::return_icon('px_transparent.gif');
3686 3686
                 }
3687 3687
 
3688 3688
                 //get icon task
3689 3689
                 if (!empty($obj->task)) {
3690
-                    $icon_task=Display::return_icon('wiki_task.png', get_lang('StandardTask'),'',ICON_SIZE_SMALL);
3690
+                    $icon_task = Display::return_icon('wiki_task.png', get_lang('StandardTask'), '', ICON_SIZE_SMALL);
3691 3691
                 } else {
3692
-                    $icon_task= Display::return_icon('px_transparent.gif');
3692
+                    $icon_task = Display::return_icon('px_transparent.gif');
3693 3693
                 }
3694 3694
 
3695 3695
                 $row = array();
3696 3696
                 $row[] = $ShowAssignment.$icon_task;
3697 3697
                 $row[] = '<a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=showpage&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">
3698 3698
                 '.api_htmlentities($obj->title).'</a>';
3699
-                if ($obj->user_id <>0) {
3699
+                if ($obj->user_id <> 0) {
3700 3700
                     $row[] = UserManager::getUserProfileLink($userinfo);
3701 3701
                 }
3702 3702
                 else {
@@ -3704,29 +3704,29 @@  discard block
 block discarded – undo
3704 3704
                 }
3705 3705
                 $row[] = api_get_local_time($obj->dtime, null, date_default_timezone_get());
3706 3706
                 $showdelete = '';
3707
-                if (api_is_allowed_to_edit(false,true)|| api_is_platform_admin()) {
3708
-                    $showdelete =' <a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=delete&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
3709
-                        Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL);
3707
+                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3708
+                    $showdelete = ' <a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=delete&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
3709
+                        Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
3710 3710
                 }
3711
-                if (api_is_allowed_to_session_edit(false,true) ) {
3711
+                if (api_is_allowed_to_session_edit(false, true)) {
3712 3712
                     $row[] = '<a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=edit&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
3713
-                        Display::return_icon('edit.png', get_lang('EditPage'),'',ICON_SIZE_SMALL).'</a> <a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=discuss&title='.api_htmlentities(urlencode($obj->reflink)).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
3714
-                        Display::return_icon('discuss.png', get_lang('Discuss'),'',ICON_SIZE_SMALL).'</a> <a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=history&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
3715
-                        Display::return_icon('history.png', get_lang('History'),'',ICON_SIZE_SMALL).'</a>
3713
+                        Display::return_icon('edit.png', get_lang('EditPage'), '', ICON_SIZE_SMALL).'</a> <a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=discuss&title='.api_htmlentities(urlencode($obj->reflink)).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
3714
+                        Display::return_icon('discuss.png', get_lang('Discuss'), '', ICON_SIZE_SMALL).'</a> <a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=history&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
3715
+                        Display::return_icon('history.png', get_lang('History'), '', ICON_SIZE_SMALL).'</a>
3716 3716
                         <a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=links&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
3717
-                        Display::return_icon('what_link_here.png', get_lang('LinksPages'),'',ICON_SIZE_SMALL).'</a>'.$showdelete;
3717
+                        Display::return_icon('what_link_here.png', get_lang('LinksPages'), '', ICON_SIZE_SMALL).'</a>'.$showdelete;
3718 3718
                 }
3719 3719
                 $rows[] = $row;
3720 3720
             }
3721 3721
 
3722
-            $table = new SortableTableFromArrayConfig($rows,1,10,'AllPages_table','','','ASC');
3723
-            $table->set_additional_parameters(array('cidReq' =>Security::remove_XSS($_GET['cidReq']),'action'=>Security::remove_XSS($action),'group_id'=>Security::remove_XSS($_GET['group_id'])));
3724
-            $table->set_header(0,get_lang('Type'), true, array ('style' => 'width:30px;'));
3725
-            $table->set_header(1,get_lang('Title'), true);
3726
-            $table->set_header(2,get_lang('Author').' ('.get_lang('LastVersion').')', true);
3727
-            $table->set_header(3,get_lang('Date').' ('.get_lang('LastVersion').')', true);
3728
-            if (api_is_allowed_to_session_edit(false,true) ) {
3729
-                $table->set_header(4,get_lang('Actions'), true, array ('style' => 'width:130px;'));
3722
+            $table = new SortableTableFromArrayConfig($rows, 1, 10, 'AllPages_table', '', '', 'ASC');
3723
+            $table->set_additional_parameters(array('cidReq' =>Security::remove_XSS($_GET['cidReq']), 'action'=>Security::remove_XSS($action), 'group_id'=>Security::remove_XSS($_GET['group_id'])));
3724
+            $table->set_header(0, get_lang('Type'), true, array('style' => 'width:30px;'));
3725
+            $table->set_header(1, get_lang('Title'), true);
3726
+            $table->set_header(2, get_lang('Author').' ('.get_lang('LastVersion').')', true);
3727
+            $table->set_header(3, get_lang('Date').' ('.get_lang('LastVersion').')', true);
3728
+            if (api_is_allowed_to_session_edit(false, true)) {
3729
+                $table->set_header(4, get_lang('Actions'), true, array('style' => 'width:130px;'));
3730 3730
             }
3731 3731
             $table->display();
3732 3732
         }
@@ -3746,13 +3746,13 @@  discard block
 block discarded – undo
3746 3746
         $groupfilter = $this->groupfilter;
3747 3747
         $tbl_wiki_conf = $this->tbl_wiki_conf;
3748 3748
 
3749
-        if (api_is_allowed_to_session_edit(false,true) ) {
3750
-            if (self::check_notify_all()==1) {
3751
-                $notify_all= Display::return_icon('messagebox_info.png', get_lang('NotifyByEmail'),'',ICON_SIZE_SMALL).' '.get_lang('NotNotifyChanges');
3752
-                $lock_unlock_notify_all='unlocknotifyall';
3749
+        if (api_is_allowed_to_session_edit(false, true)) {
3750
+            if (self::check_notify_all() == 1) {
3751
+                $notify_all = Display::return_icon('messagebox_info.png', get_lang('NotifyByEmail'), '', ICON_SIZE_SMALL).' '.get_lang('NotNotifyChanges');
3752
+                $lock_unlock_notify_all = 'unlocknotifyall';
3753 3753
             } else {
3754
-                $notify_all=Display::return_icon('mail.png', get_lang('CancelNotifyByEmail'),'',ICON_SIZE_SMALL).' '.get_lang('NotifyChanges');
3755
-                $lock_unlock_notify_all='locknotifyall';
3754
+                $notify_all = Display::return_icon('mail.png', get_lang('CancelNotifyByEmail'), '', ICON_SIZE_SMALL).' '.get_lang('NotifyChanges');
3755
+                $lock_unlock_notify_all = 'locknotifyall';
3756 3756
             }
3757 3757
         }
3758 3758
 
@@ -3760,7 +3760,7 @@  discard block
 block discarded – undo
3760 3760
         echo '<a href="index.php?action=recentchanges&amp;actionpage='.$lock_unlock_notify_all.'&amp;title='.api_htmlentities(urlencode($page)).'">'.$notify_all.'</a>';
3761 3761
         echo '</span>'.get_lang('RecentChanges').'</div>';
3762 3762
 
3763
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { //only by professors if page is hidden
3763
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { //only by professors if page is hidden
3764 3764
             $sql = 'SELECT * FROM '.$tbl_wiki.', '.$tbl_wiki_conf.'
3765 3765
         		WHERE 	'.$tbl_wiki_conf.'.c_id= '.$course_id.' AND
3766 3766
         				'.$tbl_wiki.'.c_id= '.$course_id.' AND
@@ -3788,19 +3788,19 @@  discard block
 block discarded – undo
3788 3788
                 $userinfo = api_get_user_info($obj->user_id);
3789 3789
 
3790 3790
                 //get type assignment icon
3791
-                if ($obj->assignment==1) {
3792
-                    $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL);
3793
-                } elseif ($obj->assignment==2) {
3794
-                    $ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
3795
-                } elseif ($obj->assignment==0) {
3796
-                    $ShowAssignment=Display::return_icon('px_transparent.gif');
3791
+                if ($obj->assignment == 1) {
3792
+                    $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL);
3793
+                } elseif ($obj->assignment == 2) {
3794
+                    $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
3795
+                } elseif ($obj->assignment == 0) {
3796
+                    $ShowAssignment = Display::return_icon('px_transparent.gif');
3797 3797
                 }
3798 3798
 
3799 3799
                 // Get icon task
3800 3800
                 if (!empty($obj->task)) {
3801
-                    $icon_task=Display::return_icon('wiki_task.png', get_lang('StandardTask'),'',ICON_SIZE_SMALL);
3801
+                    $icon_task = Display::return_icon('wiki_task.png', get_lang('StandardTask'), '', ICON_SIZE_SMALL);
3802 3802
                 } else {
3803
-                    $icon_task=Display::return_icon('px_transparent.gif');
3803
+                    $icon_task = Display::return_icon('px_transparent.gif');
3804 3804
                 }
3805 3805
 
3806 3806
                 $row = array();
@@ -3808,8 +3808,8 @@  discard block
 block discarded – undo
3808 3808
                 $row[] = $ShowAssignment.$icon_task;
3809 3809
                 $row[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=showpage&title='.api_htmlentities(urlencode($obj->reflink)).'&amp;view='.$obj->id.'&session_id='.api_get_session_id().'&group_id='.api_get_group_id().'">'.
3810 3810
                     api_htmlentities($obj->title).'</a>';
3811
-                $row[] = $obj->version>1 ? get_lang('EditedBy') : get_lang('AddedBy');
3812
-                if ($obj->user_id <> 0 ) {
3811
+                $row[] = $obj->version > 1 ? get_lang('EditedBy') : get_lang('AddedBy');
3812
+                if ($obj->user_id <> 0) {
3813 3813
                     $row[] = UserManager::getUserProfileLink($userinfo);
3814 3814
                 } else {
3815 3815
                     $row[] = get_lang('Anonymous').' ('.api_htmlentities($obj->user_ip).')';
@@ -3817,7 +3817,7 @@  discard block
 block discarded – undo
3817 3817
                 $rows[] = $row;
3818 3818
             }
3819 3819
 
3820
-            $table = new SortableTableFromArrayConfig($rows,0,10,'RecentPages_table','','','DESC');
3820
+            $table = new SortableTableFromArrayConfig($rows, 0, 10, 'RecentPages_table', '', '', 'DESC');
3821 3821
             $table->set_additional_parameters(
3822 3822
                 array(
3823 3823
                     'cidReq' =>api_get_course_id(),
@@ -3826,11 +3826,11 @@  discard block
 block discarded – undo
3826 3826
                     'group_id' => api_get_group_id()
3827 3827
                 )
3828 3828
             );
3829
-            $table->set_header(0,get_lang('Date'), true, array ('style' => 'width:200px;'));
3830
-            $table->set_header(1,get_lang('Type'), true, array ('style' => 'width:30px;'));
3831
-            $table->set_header(2,get_lang('Title'), true);
3832
-            $table->set_header(3,get_lang('Actions'), true, array ('style' => 'width:80px;'));
3833
-            $table->set_header(4,get_lang('Author'), true);
3829
+            $table->set_header(0, get_lang('Date'), true, array('style' => 'width:200px;'));
3830
+            $table->set_header(1, get_lang('Type'), true, array('style' => 'width:30px;'));
3831
+            $table->set_header(2, get_lang('Title'), true);
3832
+            $table->set_header(3, get_lang('Actions'), true, array('style' => 'width:80px;'));
3833
+            $table->set_header(4, get_lang('Author'), true);
3834 3834
             $table->display();
3835 3835
         }
3836 3836
     }
@@ -3862,17 +3862,17 @@  discard block
 block discarded – undo
3862 3862
 
3863 3863
             //get type assignment icon
3864 3864
             $ShowAssignment = '';
3865
-            if ($row['assignment']==1) {
3866
-                $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL);
3867
-            } elseif ($row['assignment']==2) {
3868
-                $ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
3869
-            } elseif ($row['assignment']==0) {
3870
-                $ShowAssignment=Display::return_icon('px_transparent.gif');
3865
+            if ($row['assignment'] == 1) {
3866
+                $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL);
3867
+            } elseif ($row['assignment'] == 2) {
3868
+                $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
3869
+            } elseif ($row['assignment'] == 0) {
3870
+                $ShowAssignment = Display::return_icon('px_transparent.gif');
3871 3871
             }
3872 3872
 
3873 3873
             //fix Title to reflink (link Main Page)
3874
-            if ($page==get_lang('DefaultTitle')) {
3875
-                $page='index';
3874
+            if ($page == get_lang('DefaultTitle')) {
3875
+                $page = 'index';
3876 3876
             }
3877 3877
 
3878 3878
             echo '<div id="wikititle">';
@@ -3883,11 +3883,11 @@  discard block
 block discarded – undo
3883 3883
             //fix index to title Main page into linksto
3884 3884
 
3885 3885
             if ($page == 'index') {
3886
-                $page = str_replace(' ','_',get_lang('DefaultTitle'));
3886
+                $page = str_replace(' ', '_', get_lang('DefaultTitle'));
3887 3887
             }
3888 3888
 
3889 3889
             //table
3890
-            if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
3890
+            if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3891 3891
                 //only by professors if page is hidden
3892 3892
                 $sql = "SELECT * FROM ".$tbl_wiki." s1
3893 3893
                         WHERE s1.c_id = $course_id AND linksto LIKE '%".Database::escape_string($page)."%' AND id=(
@@ -3914,25 +3914,25 @@  discard block
 block discarded – undo
3914 3914
                     //get time
3915 3915
                     $year 	 = substr($obj->dtime, 0, 4);
3916 3916
                     $month	 = substr($obj->dtime, 5, 2);
3917
-                    $day 	 = substr($obj->dtime, 8, 2);
3918
-                    $hours   = substr($obj->dtime, 11,2);
3919
-                    $minutes = substr($obj->dtime, 14,2);
3920
-                    $seconds = substr($obj->dtime, 17,2);
3917
+                    $day = substr($obj->dtime, 8, 2);
3918
+                    $hours   = substr($obj->dtime, 11, 2);
3919
+                    $minutes = substr($obj->dtime, 14, 2);
3920
+                    $seconds = substr($obj->dtime, 17, 2);
3921 3921
 
3922 3922
                     //get type assignment icon
3923
-                    if ($obj->assignment==1) {
3924
-                        $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL);
3925
-                    } elseif ($obj->assignment==2) {
3926
-                        $ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
3927
-                    } elseif ($obj->assignment==0) {
3928
-                        $ShowAssignment=Display::return_icon('px_transparent.gif');
3923
+                    if ($obj->assignment == 1) {
3924
+                        $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL);
3925
+                    } elseif ($obj->assignment == 2) {
3926
+                        $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
3927
+                    } elseif ($obj->assignment == 0) {
3928
+                        $ShowAssignment = Display::return_icon('px_transparent.gif');
3929 3929
                     }
3930 3930
 
3931 3931
                     $row = array();
3932
-                    $row[] =$ShowAssignment;
3932
+                    $row[] = $ShowAssignment;
3933 3933
                     $row[] = '<a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=showpage&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
3934 3934
                         api_htmlentities($obj->title).'</a>';
3935
-                    if ($obj->user_id <>0) {
3935
+                    if ($obj->user_id <> 0) {
3936 3936
                         $row[] = UserManager::getUserProfileLink($userinfo);
3937 3937
                     }
3938 3938
                     else {
@@ -4041,7 +4041,7 @@  discard block
 block discarded – undo
4041 4041
             '&session_id='.$this->session_id.'&group_id='.$this->group_id.'">
4042 4042
             </a></div>';
4043 4043
 
4044
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
4044
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
4045 4045
             //only by professors if page is hidden
4046 4046
             $sql = 'SELECT * FROM '.$tbl_wiki.'
4047 4047
                     WHERE
@@ -4066,19 +4066,19 @@  discard block
 block discarded – undo
4066 4066
                 // Get time
4067 4067
                 $year 	 = substr($obj->dtime, 0, 4);
4068 4068
                 $month	 = substr($obj->dtime, 5, 2);
4069
-                $day 	 = substr($obj->dtime, 8, 2);
4070
-                $hours   = substr($obj->dtime, 11,2);
4071
-                $minutes = substr($obj->dtime, 14,2);
4072
-                $seconds = substr($obj->dtime, 17,2);
4069
+                $day = substr($obj->dtime, 8, 2);
4070
+                $hours   = substr($obj->dtime, 11, 2);
4071
+                $minutes = substr($obj->dtime, 14, 2);
4072
+                $seconds = substr($obj->dtime, 17, 2);
4073 4073
 
4074 4074
                 //get type assignment icon
4075 4075
                 $ShowAssignment = '';
4076
-                if ($obj->assignment==1) {
4077
-                    $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'),'',ICON_SIZE_SMALL);
4078
-                } elseif ($obj->assignment==2) {
4079
-                    $ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
4080
-                } elseif ($obj->assignment==0) {
4081
-                    $ShowAssignment= Display::return_icon('px_transparent.gif');
4076
+                if ($obj->assignment == 1) {
4077
+                    $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'), '', ICON_SIZE_SMALL);
4078
+                } elseif ($obj->assignment == 2) {
4079
+                    $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
4080
+                } elseif ($obj->assignment == 0) {
4081
+                    $ShowAssignment = Display::return_icon('px_transparent.gif');
4082 4082
                 }
4083 4083
 
4084 4084
                 $row = array();
@@ -4094,7 +4094,7 @@  discard block
 block discarded – undo
4094 4094
 
4095 4095
             }
4096 4096
 
4097
-            $table = new SortableTableFromArrayConfig($rows,2,10,'UsersContributions_table','','','ASC');
4097
+            $table = new SortableTableFromArrayConfig($rows, 2, 10, 'UsersContributions_table', '', '', 'ASC');
4098 4098
             $table->set_additional_parameters(
4099 4099
                 array(
4100 4100
                     'cidReq' => Security::remove_XSS($_GET['cidReq']),
@@ -4104,13 +4104,13 @@  discard block
 block discarded – undo
4104 4104
                     'group_id' => intval($_GET['group_id']),
4105 4105
                 )
4106 4106
             );
4107
-            $table->set_header(0,get_lang('Date'), true, array ('style' => 'width:200px;'));
4108
-            $table->set_header(1,get_lang('Type'), true, array ('style' => 'width:30px;'));
4109
-            $table->set_header(2,get_lang('Title'), true, array ('style' => 'width:200px;'));
4110
-            $table->set_header(3,get_lang('Version'), true, array ('style' => 'width:30px;'));
4111
-            $table->set_header(4,get_lang('Comment'), true, array ('style' => 'width:200px;'));
4112
-            $table->set_header(5,get_lang('Progress'), true, array ('style' => 'width:30px;'));
4113
-            $table->set_header(6,get_lang('Rating'), true, array ('style' => 'width:30px;'));
4107
+            $table->set_header(0, get_lang('Date'), true, array('style' => 'width:200px;'));
4108
+            $table->set_header(1, get_lang('Type'), true, array('style' => 'width:30px;'));
4109
+            $table->set_header(2, get_lang('Title'), true, array('style' => 'width:200px;'));
4110
+            $table->set_header(3, get_lang('Version'), true, array('style' => 'width:30px;'));
4111
+            $table->set_header(4, get_lang('Comment'), true, array('style' => 'width:200px;'));
4112
+            $table->set_header(5, get_lang('Progress'), true, array('style' => 'width:30px;'));
4113
+            $table->set_header(6, get_lang('Rating'), true, array('style' => 'width:30px;'));
4114 4114
             $table->display();
4115 4115
         }
4116 4116
     }
@@ -4128,7 +4128,7 @@  discard block
 block discarded – undo
4128 4128
 
4129 4129
         echo '<div class="actions">'.get_lang('MostChangedPages').'</div>';
4130 4130
 
4131
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { //only by professors if page is hidden
4131
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { //only by professors if page is hidden
4132 4132
             $sql = 'SELECT *, MAX(version) AS MAX FROM '.$tbl_wiki.'
4133 4133
                     WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.'
4134 4134
                     GROUP BY reflink';//TODO:check MAX and group by return last version
@@ -4146,12 +4146,12 @@  discard block
 block discarded – undo
4146 4146
             while ($obj = Database::fetch_object($allpages)) {
4147 4147
                 //get type assignment icon
4148 4148
                 $ShowAssignment = '';
4149
-                if ($obj->assignment==1) {
4150
-                    $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL);
4151
-                } elseif ($obj->assignment==2) {
4152
-                    $ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
4153
-                } elseif ($obj->assignment==0) {
4154
-                    $ShowAssignment= Display::return_icon('px_transparent.gif');
4149
+                if ($obj->assignment == 1) {
4150
+                    $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL);
4151
+                } elseif ($obj->assignment == 2) {
4152
+                    $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
4153
+                } elseif ($obj->assignment == 0) {
4154
+                    $ShowAssignment = Display::return_icon('px_transparent.gif');
4155 4155
                 }
4156 4156
 
4157 4157
                 $row = array();
@@ -4179,9 +4179,9 @@  discard block
 block discarded – undo
4179 4179
                     'group_id' => intval($_GET['group_id']),
4180 4180
                 )
4181 4181
             );
4182
-            $table->set_header(0,get_lang('Type'), true, array ('style' => 'width:30px;'));
4183
-            $table->set_header(1,get_lang('Title'), true);
4184
-            $table->set_header(2,get_lang('Changes'), true);
4182
+            $table->set_header(0, get_lang('Type'), true, array('style' => 'width:30px;'));
4183
+            $table->set_header(1, get_lang('Title'), true);
4184
+            $table->set_header(2, get_lang('Changes'), true);
4185 4185
             $table->display();
4186 4186
         }
4187 4187
     }
@@ -4206,7 +4206,7 @@  discard block
 block discarded – undo
4206 4206
         /* Only teachers and platform admin can edit the index page.
4207 4207
         Only teachers and platform admin can edit an assignment teacher*/
4208 4208
         if (($current_row['reflink'] == 'index' || $current_row['reflink'] == '' || $current_row['assignment'] == 1) &&
4209
-            (!api_is_allowed_to_edit(false,true) && $this->group_id == 0)
4209
+            (!api_is_allowed_to_edit(false, true) && $this->group_id == 0)
4210 4210
         ) {
4211 4211
             self::setMessage(
4212 4212
                 Display::display_normal_message(get_lang('OnlyEditPagesCourseManager'), false, true)
@@ -4216,7 +4216,7 @@  discard block
 block discarded – undo
4216 4216
             // check if is a wiki group
4217 4217
             if ($current_row['group_id'] != 0) {
4218 4218
                 //Only teacher, platform admin and group members can edit a wiki group
4219
-                if (api_is_allowed_to_edit(false,true) ||
4219
+                if (api_is_allowed_to_edit(false, true) ||
4220 4220
                     api_is_platform_admin() ||
4221 4221
                     GroupManager :: is_user_in_group($userId, $this->group_id)
4222 4222
                 ) {
@@ -4234,9 +4234,9 @@  discard block
 block discarded – undo
4234 4234
             //$icon_assignment = null;
4235 4235
             if ($current_row['assignment'] == 1) {
4236 4236
                 self::setMessage(Display::display_normal_message(get_lang('EditAssignmentWarning'), false, true));
4237
-            } elseif($current_row['assignment']==2) {
4238
-                if (($userId == $current_row['user_id'])==false) {
4239
-                    if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
4237
+            } elseif ($current_row['assignment'] == 2) {
4238
+                if (($userId == $current_row['user_id']) == false) {
4239
+                    if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
4240 4240
                         $PassEdit = true;
4241 4241
                     } else {
4242 4242
                         self::setMessage(Display::display_warning_message(get_lang('LockByTeacher'), false, true));
@@ -4250,11 +4250,11 @@  discard block
 block discarded – undo
4250 4250
             //show editor if edit is allowed
4251 4251
             if ($PassEdit) {
4252 4252
                 if ($current_row['editlock'] == 1 &&
4253
-                    (api_is_allowed_to_edit(false,true)==false || api_is_platform_admin()==false)
4253
+                    (api_is_allowed_to_edit(false, true) == false || api_is_platform_admin() == false)
4254 4254
                 ) {
4255 4255
                     self::setMessage(Display::display_normal_message(get_lang('PageLockedExtra'), false, true));
4256 4256
                 } else {
4257
-                    if ($last_row['is_editing']!=0 && $last_row['is_editing'] != $userId) {
4257
+                    if ($last_row['is_editing'] != 0 && $last_row['is_editing'] != $userId) {
4258 4258
                         // Checking for concurrent users
4259 4259
                         $timestamp_edit = strtotime($last_row['time_edit']);
4260 4260
                         $time_editing = time() - $timestamp_edit;
@@ -4263,7 +4263,7 @@  discard block
 block discarded – undo
4263 4263
                         $userinfo = api_get_user_info($last_row['is_editing']);
4264 4264
                         $is_being_edited = get_lang('ThisPageisBeginEditedBy').' <a href='.$userinfo['profile_url'].'>'.
4265 4265
                             Display::tag('span', $userinfo['complete_name_with_username']).
4266
-                            get_lang('ThisPageisBeginEditedTryLater').' '.date( "i",$rest_time).' '.get_lang('MinMinutes');
4266
+                            get_lang('ThisPageisBeginEditedTryLater').' '.date("i", $rest_time).' '.get_lang('MinMinutes');
4267 4267
                         self::setMessage(Display::display_normal_message($is_being_edited, false, true));
4268 4268
                     } else {
4269 4269
                         self::setMessage(Display::display_confirmation_message(
@@ -4371,9 +4371,9 @@  discard block
 block discarded – undo
4371 4371
                 GROUP BY reflink
4372 4372
                 ORDER BY reflink ASC';
4373 4373
         $allpages = Database::query($sql);
4374
-        while ($row=Database::fetch_array($allpages)) {
4375
-            if ($row['reflink']=='index') {
4376
-                $row['reflink']=str_replace(' ', '_', get_lang('DefaultTitle'));
4374
+        while ($row = Database::fetch_array($allpages)) {
4375
+            if ($row['reflink'] == 'index') {
4376
+                $row['reflink'] = str_replace(' ', '_', get_lang('DefaultTitle'));
4377 4377
             }
4378 4378
             $pages[] = $row['reflink'];
4379 4379
         }
@@ -4391,16 +4391,16 @@  discard block
 block discarded – undo
4391 4391
 
4392 4392
         $allpages = Database::query($sql);
4393 4393
 
4394
-        while ($row=Database::fetch_array($allpages)) {
4394
+        while ($row = Database::fetch_array($allpages)) {
4395 4395
             //remove self reference
4396
-            $row['linksto']= str_replace($row["reflink"], " ", trim($row["linksto"]));
4396
+            $row['linksto'] = str_replace($row["reflink"], " ", trim($row["linksto"]));
4397 4397
             $refs = explode(" ", trim($row["linksto"]));
4398 4398
 
4399 4399
             // Find linksto into reflink. If found ->page is linked
4400 4400
             foreach ($refs as $v) {
4401 4401
                 if (in_array($v, $pages)) {
4402
-                    if (trim($v)!="") {
4403
-                        $linked[]=$v;
4402
+                    if (trim($v) != "") {
4403
+                        $linked[] = $v;
4404 4404
                     }
4405 4405
                 }
4406 4406
             }
@@ -4412,12 +4412,12 @@  discard block
 block discarded – undo
4412 4412
         $rows = array();
4413 4413
         foreach ($linked as $linked_show) {
4414 4414
             $row = array();
4415
-            $row[] = '<a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=showpage&title='.api_htmlentities(urlencode(str_replace('_',' ',$linked_show))).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
4416
-                str_replace('_',' ',$linked_show).'</a>';
4415
+            $row[] = '<a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=showpage&title='.api_htmlentities(urlencode(str_replace('_', ' ', $linked_show))).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
4416
+                str_replace('_', ' ', $linked_show).'</a>';
4417 4417
             $rows[] = $row;
4418 4418
         }
4419 4419
 
4420
-        $table = new SortableTableFromArrayConfig($rows,0,10,'LinkedPages_table','','','DESC');
4420
+        $table = new SortableTableFromArrayConfig($rows, 0, 10, 'LinkedPages_table', '', '', 'DESC');
4421 4421
         $table->set_additional_parameters(
4422 4422
             array(
4423 4423
                 'cidReq' => Security::remove_XSS($_GET['cidReq']),
@@ -4426,7 +4426,7 @@  discard block
 block discarded – undo
4426 4426
                 'group_id' => intval($_GET['group_id']),
4427 4427
             )
4428 4428
         );
4429
-        $table->set_header(0,get_lang('Title'), true);
4429
+        $table->set_header(0, get_lang('Title'), true);
4430 4430
         $table->display();
4431 4431
     }
4432 4432
 
@@ -4451,8 +4451,8 @@  discard block
 block discarded – undo
4451 4451
                 WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.'
4452 4452
                 GROUP BY reflink
4453 4453
                 ORDER BY reflink ASC';
4454
-        $allpages=Database::query($sql);
4455
-        while ($row=Database::fetch_array($allpages)) {
4454
+        $allpages = Database::query($sql);
4455
+        while ($row = Database::fetch_array($allpages)) {
4456 4456
             $pages[] = $row['reflink'];
4457 4457
         }
4458 4458
 
@@ -4467,14 +4467,14 @@  discard block
 block discarded – undo
4467 4467
                 )';
4468 4468
         $allpages = Database::query($sql);
4469 4469
         $array_refs_linked = array();
4470
-        while ($row=Database::fetch_array($allpages)) {
4471
-            $row['linksto']= str_replace($row["reflink"], " ", trim($row["linksto"])); //remove self reference
4470
+        while ($row = Database::fetch_array($allpages)) {
4471
+            $row['linksto'] = str_replace($row["reflink"], " ", trim($row["linksto"])); //remove self reference
4472 4472
             $refs = explode(" ", trim($row["linksto"]));
4473
-            foreach ($refs as $ref_linked){
4474
-                if ($ref_linked==str_replace(' ','_',get_lang('DefaultTitle'))) {
4475
-                    $ref_linked='index';
4473
+            foreach ($refs as $ref_linked) {
4474
+                if ($ref_linked == str_replace(' ', '_', get_lang('DefaultTitle'))) {
4475
+                    $ref_linked = 'index';
4476 4476
                 }
4477
-                $array_refs_linked[]= $ref_linked;
4477
+                $array_refs_linked[] = $ref_linked;
4478 4478
             }
4479 4479
         }
4480 4480
 
@@ -4496,20 +4496,20 @@  discard block
 block discarded – undo
4496 4496
 		                '.$groupfilter.$condition_session.' AND
4497 4497
 		                reflink="'.Database::escape_string($orphaned_show).'"
4498 4498
                     GROUP BY reflink';
4499
-            $allpages=Database::query($sql);
4500
-            while ($row=Database::fetch_array($allpages)) {
4501
-                $orphaned_title=$row['title'];
4502
-                $orphaned_visibility=$row['visibility'];
4503
-                if ($row['assignment']==1) {
4504
-                    $ShowAssignment=Display::return_icon('wiki_assignment.png','','',ICON_SIZE_SMALL);
4505
-                } elseif ($row['assignment']==2) {
4506
-                    $ShowAssignment=Display::return_icon('wiki_work.png','','',ICON_SIZE_SMALL);
4507
-                } elseif ($row['assignment']==0) {
4508
-                    $ShowAssignment= Display::return_icon('px_transparent.gif');
4499
+            $allpages = Database::query($sql);
4500
+            while ($row = Database::fetch_array($allpages)) {
4501
+                $orphaned_title = $row['title'];
4502
+                $orphaned_visibility = $row['visibility'];
4503
+                if ($row['assignment'] == 1) {
4504
+                    $ShowAssignment = Display::return_icon('wiki_assignment.png', '', '', ICON_SIZE_SMALL);
4505
+                } elseif ($row['assignment'] == 2) {
4506
+                    $ShowAssignment = Display::return_icon('wiki_work.png', '', '', ICON_SIZE_SMALL);
4507
+                } elseif ($row['assignment'] == 0) {
4508
+                    $ShowAssignment = Display::return_icon('px_transparent.gif');
4509 4509
                 }
4510 4510
             }
4511 4511
 
4512
-            if (!api_is_allowed_to_edit(false,true) || !api_is_platform_admin() && $orphaned_visibility==0){
4512
+            if (!api_is_allowed_to_edit(false, true) || !api_is_platform_admin() && $orphaned_visibility == 0) {
4513 4513
                 continue;
4514 4514
             }
4515 4515
 
@@ -4521,7 +4521,7 @@  discard block
 block discarded – undo
4521 4521
             $rows[] = $row;
4522 4522
         }
4523 4523
 
4524
-        $table = new SortableTableFromArrayConfig($rows,1, 10, 'OrphanedPages_table','','','DESC');
4524
+        $table = new SortableTableFromArrayConfig($rows, 1, 10, 'OrphanedPages_table', '', '', 'DESC');
4525 4525
         $table->set_additional_parameters(
4526 4526
             array(
4527 4527
                 'cidReq' => Security::remove_XSS($_GET['cidReq']),
@@ -4530,8 +4530,8 @@  discard block
 block discarded – undo
4530 4530
                 'group_id' => intval($_GET['group_id']),
4531 4531
             )
4532 4532
         );
4533
-        $table->set_header(0,get_lang('Type'), true, array ('style' => 'width:30px;'));
4534
-        $table->set_header(1,get_lang('Title'), true);
4533
+        $table->set_header(0, get_lang('Type'), true, array('style' => 'width:30px;'));
4534
+        $table->set_header(1, get_lang('Title'), true);
4535 4535
         $table->display();
4536 4536
     }
4537 4537
 
@@ -4553,11 +4553,11 @@  discard block
 block discarded – undo
4553 4553
                 WHERE  c_id = '.$course_id.' AND '.$groupfilter.$condition_session.'
4554 4554
                 GROUP BY reflink
4555 4555
                 ORDER BY reflink ASC';
4556
-        $allpages=Database::query($sql);
4556
+        $allpages = Database::query($sql);
4557 4557
 
4558
-        while ($row=Database::fetch_array($allpages)) {
4559
-            if ($row['reflink']=='index'){
4560
-                $row['reflink']=str_replace(' ','_',get_lang('DefaultTitle'));
4558
+        while ($row = Database::fetch_array($allpages)) {
4559
+            if ($row['reflink'] == 'index') {
4560
+                $row['reflink'] = str_replace(' ', '_', get_lang('DefaultTitle'));
4561 4561
             }
4562 4562
             $pages[] = $row['reflink'];
4563 4563
         }
@@ -4571,31 +4571,31 @@  discard block
 block discarded – undo
4571 4571
 
4572 4572
         $allpages = Database::query($sql);
4573 4573
 
4574
-        while ($row=Database::fetch_array($allpages)) {
4574
+        while ($row = Database::fetch_array($allpages)) {
4575 4575
             $refs = explode(" ", trim($row["linksto"]));
4576 4576
             // Find linksto into reflink. If not found ->page is wanted
4577 4577
             foreach ($refs as $v) {
4578 4578
 
4579 4579
                 if (!in_array($v, $pages)) {
4580
-                    if (trim($v)!="") {
4581
-                        $wanted[]=$v;
4580
+                    if (trim($v) != "") {
4581
+                        $wanted[] = $v;
4582 4582
                     }
4583 4583
                 }
4584 4584
             }
4585 4585
         }
4586 4586
 
4587
-        $wanted = array_unique($wanted);//make a unique list
4587
+        $wanted = array_unique($wanted); //make a unique list
4588 4588
 
4589 4589
         //show table
4590 4590
         $rows = array();
4591 4591
         foreach ($wanted as $wanted_show) {
4592 4592
             $row = array();
4593 4593
             $wanted_show = Security::remove_XSS($wanted_show);
4594
-            $row[] = '<a href="'.api_get_path(WEB_PATH).'main/wiki/index.php?cidReq=&action=addnew&title='.str_replace('_',' ',$wanted_show).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'" class="new_wiki_link">'.str_replace('_',' ',$wanted_show).'</a>';//meter un remove xss en lugar de htmlentities
4594
+            $row[] = '<a href="'.api_get_path(WEB_PATH).'main/wiki/index.php?cidReq=&action=addnew&title='.str_replace('_', ' ', $wanted_show).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'" class="new_wiki_link">'.str_replace('_', ' ', $wanted_show).'</a>'; //meter un remove xss en lugar de htmlentities
4595 4595
             $rows[] = $row;
4596 4596
         }
4597 4597
 
4598
-        $table = new SortableTableFromArrayConfig($rows,0,10,'WantedPages_table','','','DESC');
4598
+        $table = new SortableTableFromArrayConfig($rows, 0, 10, 'WantedPages_table', '', '', 'DESC');
4599 4599
         $table->set_additional_parameters(
4600 4600
             array(
4601 4601
                 'cidReq' => Security::remove_XSS($_GET['cidReq']),
@@ -4604,7 +4604,7 @@  discard block
 block discarded – undo
4604 4604
                 'group_id' => intval($_GET['group_id']),
4605 4605
             )
4606 4606
         );
4607
-        $table->set_header(0,get_lang('Title'), true);
4607
+        $table->set_header(0, get_lang('Title'), true);
4608 4608
         $table->display();
4609 4609
     }
4610 4610
 
@@ -4621,7 +4621,7 @@  discard block
 block discarded – undo
4621 4621
 
4622 4622
         echo '<div class="actions">'.get_lang('MostVisitedPages').'</div>';
4623 4623
 
4624
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { //only by professors if page is hidden
4624
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { //only by professors if page is hidden
4625 4625
             $sql = 'SELECT *, SUM(hits) AS tsum FROM '.$tbl_wiki.'
4626 4626
                     WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.'
4627 4627
                     GROUP BY reflink';
@@ -4642,11 +4642,11 @@  discard block
 block discarded – undo
4642 4642
             while ($obj = Database::fetch_object($allpages)) {
4643 4643
                 //get type assignment icon
4644 4644
                 $ShowAssignment = '';
4645
-                if ($obj->assignment==1) {
4646
-                    $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL);
4647
-                } elseif ($obj->assignment==2) {
4648
-                    $ShowAssignment=$ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
4649
-                } elseif ($obj->assignment==0) {
4645
+                if ($obj->assignment == 1) {
4646
+                    $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL);
4647
+                } elseif ($obj->assignment == 2) {
4648
+                    $ShowAssignment = $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
4649
+                } elseif ($obj->assignment == 0) {
4650 4650
                     $ShowAssignment = Display::return_icon('px_transparent.gif');
4651 4651
                 }
4652 4652
 
@@ -4675,7 +4675,7 @@  discard block
 block discarded – undo
4675 4675
                     'group_id' => intval($_GET['group_id']),
4676 4676
                 )
4677 4677
             );
4678
-            $table->set_header(0,get_lang('Type'), true, array ('style' => 'width:30px;'));
4678
+            $table->set_header(0, get_lang('Type'), true, array('style' => 'width:30px;'));
4679 4679
             $table->set_header(1, get_lang('Title'), true);
4680 4680
             $table->set_header(2, get_lang('Visits'), true);
4681 4681
             $table->display();
@@ -4700,8 +4700,8 @@  discard block
 block discarded – undo
4700 4700
 
4701 4701
         if (api_is_allowed_to_session_edit(false, true) && api_is_allowed_to_edit()) {
4702 4702
             // menu add page
4703
-            $actionsLeft .= '<a href="index.php?cidReq=' . $_course['id'] . '&action=addnew&session_id=' . $session_id . '&group_id=' . $groupId . '"' . self::is_active_navigation_tab('addnew').'>'
4704
-            . Display::return_icon('add.png', get_lang('AddNew'), '', ICON_SIZE_MEDIUM) . '</a>';
4703
+            $actionsLeft .= '<a href="index.php?cidReq='.$_course['id'].'&action=addnew&session_id='.$session_id.'&group_id='.$groupId.'"'.self::is_active_navigation_tab('addnew').'>'
4704
+            . Display::return_icon('add.png', get_lang('AddNew'), '', ICON_SIZE_MEDIUM).'</a>';
4705 4705
         }
4706 4706
 
4707 4707
         $lock_unlock_addnew = null;
@@ -4709,12 +4709,12 @@  discard block
 block discarded – undo
4709 4709
 
4710 4710
         if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
4711 4711
             // page action: enable or disable the adding of new pages
4712
-            if (self::check_addnewpagelock()==0) {
4712
+            if (self::check_addnewpagelock() == 0) {
4713 4713
                 $protect_addnewpage = Display::return_icon('off.png', get_lang('AddOptionProtected'));
4714
-                $lock_unlock_addnew ='unlockaddnew';
4714
+                $lock_unlock_addnew = 'unlockaddnew';
4715 4715
             } else {
4716 4716
                 $protect_addnewpage = Display::return_icon('on.png', get_lang('AddOptionUnprotected'));
4717
-                $lock_unlock_addnew ='lockaddnew';
4717
+                $lock_unlock_addnew = 'lockaddnew';
4718 4718
             }
4719 4719
         }
4720 4720
 
@@ -4734,7 +4734,7 @@  discard block
 block discarded – undo
4734 4734
             get_lang('RecentChanges').'</a>';
4735 4735
 
4736 4736
 
4737
-        echo Display::toolbarAction('toolbar-wiki', array( 0 => $actionsLeft));
4737
+        echo Display::toolbarAction('toolbar-wiki', array(0 => $actionsLeft));
4738 4738
     }
4739 4739
 
4740 4740
     /**
@@ -4752,7 +4752,7 @@  discard block
 block discarded – undo
4752 4752
             return;
4753 4753
         }
4754 4754
 
4755
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
4755
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
4756 4756
             self::setMessage('<div id="wikititle">'.get_lang('DeletePageHistory').'</div>');
4757 4757
 
4758 4758
             if ($page == "index") {
@@ -4794,7 +4794,7 @@  discard block
 block discarded – undo
4794 4794
         $userId = api_get_user_id();
4795 4795
 
4796 4796
         if (api_get_session_id() != 0 &&
4797
-            api_is_allowed_to_session_edit(false,true) == false
4797
+            api_is_allowed_to_session_edit(false, true) == false
4798 4798
         ) {
4799 4799
             api_not_allowed();
4800 4800
         }
@@ -4817,12 +4817,12 @@  discard block
 block discarded – undo
4817 4817
                 Display::display_error_message(get_lang('MustSelectPage'), false, true)
4818 4818
             );
4819 4819
             return;
4820
-        } elseif ($row['content']=='' && $row['title']=='' && $page=='index') {
4820
+        } elseif ($row['content'] == '' && $row['title'] == '' && $page == 'index') {
4821 4821
 
4822 4822
             // Table structure for better export to pdf
4823 4823
             $default_table_for_content_Start = '<table align="center" border="0"><tr><td align="center">';
4824 4824
             $default_table_for_content_End = '</td></tr></table>';
4825
-            $content = $default_table_for_content_Start.sprintf(get_lang('DefaultContent'),api_get_path(WEB_IMG_PATH)).$default_table_for_content_End;
4825
+            $content = $default_table_for_content_Start.sprintf(get_lang('DefaultContent'), api_get_path(WEB_IMG_PATH)).$default_table_for_content_End;
4826 4826
             $title = get_lang('DefaultTitle');
4827 4827
             $page_id = 0;
4828 4828
         } else {
@@ -4847,7 +4847,7 @@  discard block
 block discarded – undo
4847 4847
             // Check if is a wiki group
4848 4848
             if (!empty($groupId)) {
4849 4849
                 //Only teacher, platform admin and group members can edit a wiki group
4850
-                if (api_is_allowed_to_edit(false,true) ||
4850
+                if (api_is_allowed_to_edit(false, true) ||
4851 4851
                     api_is_platform_admin() ||
4852 4852
                     GroupManager :: is_user_in_group($userId, $groupId)
4853 4853
                 ) {
@@ -4860,7 +4860,7 @@  discard block
 block discarded – undo
4860 4860
                     );
4861 4861
                 }
4862 4862
             } else {
4863
-                $PassEdit=true;
4863
+                $PassEdit = true;
4864 4864
             }
4865 4865
 
4866 4866
             $icon_assignment = null;
@@ -4870,10 +4870,10 @@  discard block
 block discarded – undo
4870 4870
                     Display::return_message(get_lang('EditAssignmentWarning'))
4871 4871
                 );
4872 4872
 
4873
-                $icon_assignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'),'',ICON_SIZE_SMALL);
4873
+                $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'), '', ICON_SIZE_SMALL);
4874 4874
             } elseif ($row['assignment'] == 2) {
4875
-                $icon_assignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWorkExtra'),'',ICON_SIZE_SMALL);
4876
-                if (($userId == $row['user_id'])==false) {
4875
+                $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWorkExtra'), '', ICON_SIZE_SMALL);
4876
+                if (($userId == $row['user_id']) == false) {
4877 4877
                     if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
4878 4878
                         $PassEdit = true;
4879 4879
                     } else {
@@ -4893,7 +4893,7 @@  discard block
 block discarded – undo
4893 4893
             if ($PassEdit) {
4894 4894
                 //show editor if edit is allowed
4895 4895
                 if ($row['editlock'] == 1 &&
4896
-                    (api_is_allowed_to_edit(false, true) == false || api_is_platform_admin()==false)
4896
+                    (api_is_allowed_to_edit(false, true) == false || api_is_platform_admin() == false)
4897 4897
                 ) {
4898 4898
                     Display::addFlash(
4899 4899
                         Display::return_message(
@@ -4904,8 +4904,8 @@  discard block
 block discarded – undo
4904 4904
                     // Check tasks
4905 4905
 
4906 4906
                     if (!empty($row['startdate_assig']) &&
4907
-                        $row['startdate_assig']!='0000-00-00 00:00:00' &&
4908
-                        time()<strtotime($row['startdate_assig'])
4907
+                        $row['startdate_assig'] != '0000-00-00 00:00:00' &&
4908
+                        time() < strtotime($row['startdate_assig'])
4909 4909
                     ) {
4910 4910
                         $message = get_lang('TheTaskDoesNotBeginUntil').': '.api_get_local_time($row['startdate_assig'], null, date_default_timezone_get());
4911 4911
 
@@ -4922,10 +4922,10 @@  discard block
 block discarded – undo
4922 4922
                     }
4923 4923
 
4924 4924
                     if (!empty($row['enddate_assig']) &&
4925
-                        $row['enddate_assig']!='0000-00-00 00:00:00' &&
4925
+                        $row['enddate_assig'] != '0000-00-00 00:00:00' &&
4926 4926
                         time() > strtotime($row['enddate_assig']) &&
4927
-                        $row['enddate_assig']!='0000-00-00 00:00:00' &&
4928
-                        $row['delayedsubmit']==0
4927
+                        $row['enddate_assig'] != '0000-00-00 00:00:00' &&
4928
+                        $row['delayedsubmit'] == 0
4929 4929
                     ) {
4930 4930
                         $message = get_lang('TheDeadlineHasBeenCompleted').': '.api_get_local_time($row['enddate_assig'], null, date_default_timezone_get());
4931 4931
                         Display::addFlash(
@@ -4934,20 +4934,20 @@  discard block
 block discarded – undo
4934 4934
                                 'warning'
4935 4935
                             )
4936 4936
                         );
4937
-                        if (!api_is_allowed_to_edit(false,true)) {
4937
+                        if (!api_is_allowed_to_edit(false, true)) {
4938 4938
                             $this->redirectHome();
4939 4939
                         }
4940 4940
                     }
4941 4941
 
4942
-                    if (!empty($row['max_version']) && $row['version']>=$row['max_version']) {
4943
-                        $message=get_lang('HasReachedMaxiNumVersions');
4942
+                    if (!empty($row['max_version']) && $row['version'] >= $row['max_version']) {
4943
+                        $message = get_lang('HasReachedMaxiNumVersions');
4944 4944
                         Display::addFlash(
4945 4945
                             Display::return_message(
4946 4946
                                 $message,
4947 4947
                                 'warning'
4948 4948
                             )
4949 4949
                         );
4950
-                        if (!api_is_allowed_to_edit(false,true)) {
4950
+                        if (!api_is_allowed_to_edit(false, true)) {
4951 4951
                             $this->redirectHome();
4952 4952
                         }
4953 4953
                     }
@@ -4960,50 +4960,50 @@  discard block
 block discarded – undo
4960 4960
                                 'warning'
4961 4961
                             )
4962 4962
                         );
4963
-                        if (!api_is_allowed_to_edit(false,true)) {
4963
+                        if (!api_is_allowed_to_edit(false, true)) {
4964 4964
                             $this->redirectHome();
4965 4965
                         }
4966 4966
                     }
4967 4967
 
4968 4968
                     if (!empty($row['task'])) {
4969 4969
                         //previous change 0 by text
4970
-                        if ($row['startdate_assig']=='0000-00-00 00:00:00') {
4971
-                            $message_task_startdate  =get_lang('No');
4970
+                        if ($row['startdate_assig'] == '0000-00-00 00:00:00') {
4971
+                            $message_task_startdate = get_lang('No');
4972 4972
                         } else {
4973 4973
                             $message_task_startdate = api_get_local_time($row['startdate_assig'], null, date_default_timezone_get());
4974 4974
                         }
4975 4975
 
4976
-                        if ($row['enddate_assig']=='0000-00-00 00:00:00') {
4976
+                        if ($row['enddate_assig'] == '0000-00-00 00:00:00') {
4977 4977
                             $message_task_enddate = get_lang('No');
4978 4978
                         } else {
4979 4979
                             $message_task_enddate = api_get_local_time($row['enddate_assig'], null, date_default_timezone_get());
4980 4980
                         }
4981 4981
 
4982
-                        if ($row['delayedsubmit']==0) {
4983
-                            $message_task_delayedsubmit=get_lang('No');
4982
+                        if ($row['delayedsubmit'] == 0) {
4983
+                            $message_task_delayedsubmit = get_lang('No');
4984 4984
                         } else {
4985
-                            $message_task_delayedsubmit=get_lang('Yes');
4985
+                            $message_task_delayedsubmit = get_lang('Yes');
4986 4986
                         }
4987 4987
 
4988
-                        if ($row['max_version']==0) {
4989
-                            $message_task_max_version=get_lang('No');
4988
+                        if ($row['max_version'] == 0) {
4989
+                            $message_task_max_version = get_lang('No');
4990 4990
                         } else {
4991
-                            $message_task_max_version=$row['max_version'];
4991
+                            $message_task_max_version = $row['max_version'];
4992 4992
                         }
4993 4993
 
4994
-                        if ($row['max_text']==0) {
4995
-                            $message_task_max_text=get_lang('No');
4994
+                        if ($row['max_text'] == 0) {
4995
+                            $message_task_max_text = get_lang('No');
4996 4996
                         } else {
4997
-                            $message_task_max_text=$row['max_text'];
4997
+                            $message_task_max_text = $row['max_text'];
4998 4998
                         }
4999 4999
 
5000 5000
                         // Comp message
5001
-                        $message_task='<b>'.get_lang('DescriptionOfTheTask').'</b><p>'.$row['task'].'</p><hr>';
5002
-                        $message_task.='<p>'.get_lang('StartDate').': '.$message_task_startdate.'</p>';
5003
-                        $message_task.='<p>'.get_lang('EndDate').': '.$message_task_enddate;
5004
-                        $message_task.=' ('.get_lang('AllowLaterSends').') '.$message_task_delayedsubmit.'</p>';
5005
-                        $message_task.='<p>'.get_lang('OtherSettings').': '.get_lang('NMaxVersion').': '.$message_task_max_version;
5006
-                        $message_task.=' '.get_lang('NMaxWords').': '.$message_task_max_text;
5001
+                        $message_task = '<b>'.get_lang('DescriptionOfTheTask').'</b><p>'.$row['task'].'</p><hr>';
5002
+                        $message_task .= '<p>'.get_lang('StartDate').': '.$message_task_startdate.'</p>';
5003
+                        $message_task .= '<p>'.get_lang('EndDate').': '.$message_task_enddate;
5004
+                        $message_task .= ' ('.get_lang('AllowLaterSends').') '.$message_task_delayedsubmit.'</p>';
5005
+                        $message_task .= '<p>'.get_lang('OtherSettings').': '.get_lang('NMaxVersion').': '.$message_task_max_version;
5006
+                        $message_task .= ' '.get_lang('NMaxWords').': '.$message_task_max_text;
5007 5007
                         // Display message
5008 5008
                         Display::addFlash(
5009 5009
                             Display::return_message(
@@ -5014,11 +5014,11 @@  discard block
 block discarded – undo
5014 5014
 
5015 5015
                     $feedback_message = '';
5016 5016
                     if ($row['progress'] == $row['fprogress1'] && !empty($row['fprogress1'])) {
5017
-                        $feedback_message='<b>'.get_lang('Feedback').'</b><p>'.api_htmlentities($row['feedback1']).'</p>';
5017
+                        $feedback_message = '<b>'.get_lang('Feedback').'</b><p>'.api_htmlentities($row['feedback1']).'</p>';
5018 5018
                     } elseif ($row['progress'] == $row['fprogress2'] && !empty($row['fprogress2'])) {
5019
-                        $feedback_message='<b>'.get_lang('Feedback').'</b><p>'.api_htmlentities($row['feedback2']).'</p>';
5019
+                        $feedback_message = '<b>'.get_lang('Feedback').'</b><p>'.api_htmlentities($row['feedback2']).'</p>';
5020 5020
                     } elseif ($row['progress'] == $row['fprogress3'] && !empty($row['fprogress3'])) {
5021
-                        $feedback_message='<b>'.get_lang('Feedback').'</b><p>'.api_htmlentities($row['feedback3']).'</p>';
5021
+                        $feedback_message = '<b>'.get_lang('Feedback').'</b><p>'.api_htmlentities($row['feedback3']).'</p>';
5022 5022
                     }
5023 5023
 
5024 5024
                     if (!empty($feedback_message)) {
@@ -5043,14 +5043,14 @@  discard block
 block discarded – undo
5043 5043
                                 WHERE c_id = '.$course_id.' AND id="'.$row['id'].'"';
5044 5044
                         Database::query($sql);
5045 5045
                     } elseif ($row['is_editing'] != $userId) {
5046
-                        $timestamp_edit=strtotime($row['time_edit']);
5046
+                        $timestamp_edit = strtotime($row['time_edit']);
5047 5047
                         $time_editing = time() - $timestamp_edit;
5048 5048
                         $max_edit_time = 1200; // 20 minutes
5049 5049
                         $rest_time = $max_edit_time - $time_editing;
5050 5050
 
5051 5051
                         $userinfo = api_get_user_info($row['is_editing']);
5052 5052
                         $is_being_edited = get_lang('ThisPageisBeginEditedBy').' '.UserManager::getUserProfileLink($userinfo).'
5053
-                            '.get_lang('ThisPageisBeginEditedTryLater').' '.date( "i",$rest_time).' '.get_lang('MinMinutes').'';
5053
+                            '.get_lang('ThisPageisBeginEditedTryLater').' '.date("i", $rest_time).' '.get_lang('MinMinutes').'';
5054 5054
 
5055 5055
                         Display::addFlash(
5056 5056
                             Display::return_message(
@@ -5064,7 +5064,7 @@  discard block
 block discarded – undo
5064 5064
                     // Form.
5065 5065
                     $url = api_get_self().'?action=edit&title='.urlencode($page).'&session_id='.api_get_session_id().'&group_id='.api_get_group_id().'&'.api_get_cidreq();
5066 5066
                     $form = new FormValidator('wiki', 'post', $url);
5067
-                    $form->addElement('header', $icon_assignment.str_repeat('&nbsp;',3).api_htmlentities($title));
5067
+                    $form->addElement('header', $icon_assignment.str_repeat('&nbsp;', 3).api_htmlentities($title));
5068 5068
                     self::setForm($form, $row);
5069 5069
                     $form->addElement('hidden', 'title');
5070 5070
                     $form->addElement('button', 'SaveWikiChange', get_lang('Save'));
@@ -5087,7 +5087,7 @@  discard block
 block discarded – undo
5087 5087
                             );
5088 5088
                         } elseif (!self::double_post($_POST['wpost_id'])) {
5089 5089
                             //double post
5090
-                        } elseif ($_POST['version']!='' && $_SESSION['_version'] !=0 && $_POST['version'] != $_SESSION['_version']) {
5090
+                        } elseif ($_POST['version'] != '' && $_SESSION['_version'] != 0 && $_POST['version'] != $_SESSION['_version']) {
5091 5091
                             //prevent concurrent users and double version
5092 5092
                             Display::addFlash(
5093 5093
                                 Display::return_message(
@@ -5149,7 +5149,7 @@  discard block
 block discarded – undo
5149 5149
         $KeyAssignment = null;
5150 5150
         $KeyTitle = null;
5151 5151
         $KeyUserId = null;
5152
-        while ($row=Database::fetch_array($result)) {
5152
+        while ($row = Database::fetch_array($result)) {
5153 5153
             $KeyVisibility = $row['visibility'];
5154 5154
             $KeyAssignment = $row['assignment'];
5155 5155
             $KeyTitle = $row['title'];
@@ -5158,7 +5158,7 @@  discard block
 block discarded – undo
5158 5158
         $icon_assignment = null;
5159 5159
         if ($KeyAssignment == 1) {
5160 5160
             $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'), '', ICON_SIZE_SMALL);
5161
-        } elseif($KeyAssignment == 2) {
5161
+        } elseif ($KeyAssignment == 2) {
5162 5162
             $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWorkExtra'), '', ICON_SIZE_SMALL);
5163 5163
         }
5164 5164
 
@@ -5166,10 +5166,10 @@  discard block
 block discarded – undo
5166 5166
 
5167 5167
         //if the page is hidden and is a job only sees its author and professor
5168 5168
         if ($KeyVisibility == 1 ||
5169
-            api_is_allowed_to_edit(false,true) ||
5169
+            api_is_allowed_to_edit(false, true) ||
5170 5170
             api_is_platform_admin() ||
5171 5171
             (
5172
-                $KeyAssignment==2 && $KeyVisibility==0 &&
5172
+                $KeyAssignment == 2 && $KeyVisibility == 0 &&
5173 5173
                 ($userId == $KeyUserId)
5174 5174
             )
5175 5175
         ) {
@@ -5199,7 +5199,7 @@  discard block
 block discarded – undo
5199 5199
                     get_lang('ShowDifferences').' '.get_lang('WordsDiff').'</button>';
5200 5200
                 echo '<br/><br/>';
5201 5201
 
5202
-                $counter=0;
5202
+                $counter = 0;
5203 5203
                 $total_versions = Database::num_rows($result);
5204 5204
 
5205 5205
                 while ($row = Database::fetch_array($result)) {
@@ -5207,10 +5207,10 @@  discard block
 block discarded – undo
5207 5207
                     $username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username']), ENT_QUOTES);
5208 5208
 
5209 5209
                     echo '<li style="margin-bottom: 5px;">';
5210
-                    ($counter==0) ? $oldstyle='style="visibility: hidden;"':$oldstyle='';
5211
-                    ($counter==0) ? $newchecked=' checked': $newchecked='';
5212
-                    ($counter==$total_versions-1) ? $newstyle='style="visibility: hidden;"':$newstyle='';
5213
-                    ($counter==1) ? $oldchecked=' checked':$oldchecked='';
5210
+                    ($counter == 0) ? $oldstyle = 'style="visibility: hidden;"' : $oldstyle = '';
5211
+                    ($counter == 0) ? $newchecked = ' checked' : $newchecked = '';
5212
+                    ($counter == $total_versions - 1) ? $newstyle = 'style="visibility: hidden;"' : $newstyle = '';
5213
+                    ($counter == 1) ? $oldchecked = ' checked' : $oldchecked = '';
5214 5214
                     echo '<input name="old" value="'.$row['id'].'" type="radio" '.$oldstyle.' '.$oldchecked.'/> ';
5215 5215
                     echo '<input name="new" value="'.$row['id'].'" type="radio" '.$newstyle.' '.$newchecked.'/> ';
5216 5216
                     echo '<a href="'.api_get_self().'?action=showpage&amp;title='.api_htmlentities(urlencode($page)).'&amp;view='.$row['id'].'">';
@@ -5228,7 +5228,7 @@  discard block
 block discarded – undo
5228 5228
                     $comment = $row['comment'];
5229 5229
                     if (!empty($comment)) {
5230 5230
                         echo get_lang('Comments').': '.api_htmlentities(api_substr($row['comment'], 0, 100));
5231
-                        if (api_strlen($row['comment'])>100) {
5231
+                        if (api_strlen($row['comment']) > 100) {
5232 5232
                             echo '... ';
5233 5233
                         }
5234 5234
                     } else {
@@ -5253,8 +5253,8 @@  discard block
 block discarded – undo
5253 5253
 
5254 5254
                 $sql_new = "SELECT * FROM $tbl_wiki
5255 5255
                             WHERE c_id = $course_id AND id='".Database::escape_string($_POST['new'])."'";
5256
-                $result_new=Database::query($sql_new);
5257
-                $version_new=Database::fetch_array($result_new);
5256
+                $result_new = Database::query($sql_new);
5257
+                $version_new = Database::fetch_array($result_new);
5258 5258
                 $oldTime = isset($version_old['dtime']) ? $version_old['dtime'] : null;
5259 5259
                 $oldContent = isset($version_old['content']) ? $version_old['content'] : null;
5260 5260
 
@@ -5281,9 +5281,9 @@  discard block
 block discarded – undo
5281 5281
 
5282 5282
 
5283 5283
                 if (isset($_POST['HistoryDifferences'])) {
5284
-                    echo '<table>'.diff($oldContent, $version_new['content'], true, 'format_table_line' ).'</table>'; // format_line mode is better for words
5284
+                    echo '<table>'.diff($oldContent, $version_new['content'], true, 'format_table_line').'</table>'; // format_line mode is better for words
5285 5285
                     echo '<br />';
5286
-                    echo '<strong>'.get_lang('Legend').'</strong><div class="diff">' . "\n";
5286
+                    echo '<strong>'.get_lang('Legend').'</strong><div class="diff">'."\n";
5287 5287
                     echo '<table><tr>';
5288 5288
                     echo  '<td>';
5289 5289
                     echo '</td><td>';
@@ -5302,7 +5302,7 @@  discard block
 block discarded – undo
5302 5302
                     $renderer = new Text_Diff_Renderer_inline();
5303 5303
                     echo '<style>del{background:#fcc}ins{background:#cfc}</style>'.$renderer->render($diff); // Code inline
5304 5304
                     echo '<br />';
5305
-                    echo '<strong>'.get_lang('Legend').'</strong><div class="diff">' . "\n";
5305
+                    echo '<strong>'.get_lang('Legend').'</strong><div class="diff">'."\n";
5306 5306
                     echo '<table><tr>';
5307 5307
                     echo  '<td>';
5308 5308
                     echo '</td><td>';
@@ -5350,7 +5350,7 @@  discard block
 block discarded – undo
5350 5350
         echo '<td style="vertical-align:top">';
5351 5351
         echo '<ul>';
5352 5352
         // Submenu Statistics
5353
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
5353
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
5354 5354
             echo '<li><a href="index.php?cidReq='.$_course['id'].'&action=statistics&session_id='.$session_id.'&group_id='.$groupId.'">'.get_lang('Statistics').'</a></li>';
5355 5355
         }
5356 5356
         echo '      </ul>';
@@ -5423,7 +5423,7 @@  discard block
 block discarded – undo
5423 5423
                 break;
5424 5424
             case 'deletewiki':
5425 5425
                 $title = '<div class="actions">'.get_lang('DeleteWiki').'</div>';
5426
-                if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
5426
+                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
5427 5427
                     $message = get_lang('ConfirmDeleteWiki');
5428 5428
                     $message .= '<p>
5429 5429
                         <a href="index.php?'.api_get_cidreq().'">'.get_lang('No').'</a>
@@ -5454,14 +5454,14 @@  discard block
 block discarded – undo
5454 5454
                 self::getLinks($page);
5455 5455
                 break;
5456 5456
             case 'addnew':
5457
-                if (api_get_session_id()!=0 && api_is_allowed_to_session_edit(false,true)==false) {
5457
+                if (api_get_session_id() != 0 && api_is_allowed_to_session_edit(false, true) == false) {
5458 5458
                     api_not_allowed();
5459 5459
                 }
5460 5460
                 echo '<div class="actions">'.get_lang('AddNew').'</div>';
5461 5461
                 echo '<br/>';
5462 5462
                 //first, check if page index was created. chektitle=false
5463 5463
                 if (self::checktitle('index')) {
5464
-                    if (api_is_allowed_to_edit(false,true) ||
5464
+                    if (api_is_allowed_to_edit(false, true) ||
5465 5465
                         api_is_platform_admin() ||
5466 5466
                         GroupManager::is_user_in_group(api_get_user_id(), api_get_group_id())
5467 5467
                     ) {
@@ -5469,10 +5469,10 @@  discard block
 block discarded – undo
5469 5469
                     } else {
5470 5470
                         self::setMessage(Display::display_normal_message(get_lang('WikiStandBy'), false, true));
5471 5471
                     }
5472
-                } elseif (self::check_addnewpagelock()==0 && (api_is_allowed_to_edit(false, true)==false || api_is_platform_admin()==false)) {
5472
+                } elseif (self::check_addnewpagelock() == 0 && (api_is_allowed_to_edit(false, true) == false || api_is_platform_admin() == false)) {
5473 5473
                     self::setMessage(Display::display_error_message(get_lang('AddPagesLocked'), false, true));
5474 5474
                 } else {
5475
-                    if (api_is_allowed_to_edit(false,true) ||
5475
+                    if (api_is_allowed_to_edit(false, true) ||
5476 5476
                         api_is_platform_admin() ||
5477 5477
                         GroupManager::is_user_in_group(api_get_user_id(), api_get_group_id()) ||
5478 5478
                         $_GET['group_id'] == 0
Please login to merge, or discard this patch.
main/forum/download.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 $doc_url = str_replace(' ', '+', $doc_url);
32 32
 $doc_url = str_replace('/..', '', $doc_url); //echo $doc_url;
33 33
 
34
-if (! isset($_course)) {
34
+if (!isset($_course)) {
35 35
     api_not_allowed(true);
36 36
 }
37 37
 
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
     exit;
52 52
 }
53 53
 
54
-$tbl_forum_attachment  = Database::get_course_table(TABLE_FORUM_ATTACHMENT);
54
+$tbl_forum_attachment = Database::get_course_table(TABLE_FORUM_ATTACHMENT);
55 55
 $tbl_forum_post = Database::get_course_table(TABLE_FORUM_POST);
56 56
 
57 57
 $course_id = api_get_course_int_id();
58
-$courseInfo =     api_get_course_info_by_id($course_id);
58
+$courseInfo = api_get_course_info_by_id($course_id);
59 59
 
60 60
 // launch event
61 61
 Event::event_download($doc_url);
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     api_get_session_id()
86 86
 );
87 87
 
88
-if ($forum_thread_visibility==1 && $forum_forum_visibility==1) {
88
+if ($forum_thread_visibility == 1 && $forum_forum_visibility == 1) {
89 89
     if (Security::check_abs_path(
90 90
         $full_file_name,
91 91
         api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/upload/forum/')
Please login to merge, or discard this patch.
main/forum/viewthread_threaded.inc.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -457,8 +457,8 @@
 block discarded – undo
457 457
 
458 458
 // The post has been displayed => it can be removed from the what's new array
459 459
 if (isset($whatsnew_post_info[$forumId][$threadId][$row['post_id']])) {
460
-  unset($whatsnew_post_info[$forumId][$threadId][$row['post_id']]);
461
-  unset($_SESSION['whatsnew_post_info'][$forumId][$threadId][$row['post_id']]);
460
+    unset($whatsnew_post_info[$forumId][$threadId][$row['post_id']]);
461
+    unset($_SESSION['whatsnew_post_info'][$forumId][$threadId][$row['post_id']]);
462 462
 }
463 463
 echo "</table>";
464 464
 
Please login to merge, or discard this patch.
Spacing   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * @package chamilo.forum
22 22
  */
23 23
 
24
-$forumUrl = api_get_path(WEB_CODE_PATH) . 'forum/';
24
+$forumUrl = api_get_path(WEB_CODE_PATH).'forum/';
25 25
 $_user = api_get_user_info();
26 26
 $sortDirection = isset($_GET['posts_order']) && $_GET['posts_order'] === 'desc' ? 'DESC' : 'ASC';
27 27
 $rows = getPosts($_GET['thread'], $sortDirection, true);
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
 // Are we in a lp ?
43 43
 $origin = '';
44 44
 if (isset($_GET['origin'])) {
45
-    $origin =  Security::remove_XSS($_GET['origin']);
45
+    $origin = Security::remove_XSS($_GET['origin']);
46 46
 }
47 47
 
48 48
 // Delete attachment file.
49 49
 if (
50 50
     isset($_GET['action']) &&
51
-    $_GET['action']=='delete_attach' &&
51
+    $_GET['action'] == 'delete_attach' &&
52 52
     isset($_GET['id_attach'])
53 53
 ) {
54 54
     delete_attachment(0, $_GET['id_attach']);
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
 // Displaying the thread (structure)
61 61
 
62
-$thread_structure = "<div class=\"structure\">" .get_lang('Structure')."</div>";
62
+$thread_structure = "<div class=\"structure\">".get_lang('Structure')."</div>";
63 63
 $counter = 0;
64 64
 $count = 0;
65 65
 $prev_next_array = array();
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 foreach ($rows as $post) {
72 72
     $counter++;
73 73
     $indent = $post['indent_cnt'] * '20';
74
-    $thread_structure .= "<div style=\"margin-left: " . $indent . "px;\">";
74
+    $thread_structure .= "<div style=\"margin-left: ".$indent."px;\">";
75 75
 
76 76
     if (
77 77
         !empty($whatsnew_post_info[$forumId][$post['thread_id']]) &&
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             $counter == 1 AND !isset($_GET['post'])
90 90
         )
91 91
     ) {
92
-        $thread_structure .= '<strong>' .prepare4display($post['post_title']) . '</strong></div>';
92
+        $thread_structure .= '<strong>'.prepare4display($post['post_title']).'</strong></div>';
93 93
         $prev_next_array[] = $post['post_id'];
94 94
     } else {
95 95
         if ($post['visible'] == '0') {
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
             $class = '';
99 99
         }
100 100
         $count_loop = ($count == 0) ? '&id=1' : '';
101
-        $thread_structure .= "<a href=\"viewthread.php?" . api_get_cidreq() .
102
-            "&forum=" . $forumId . "&thread=" . $threadId .
103
-            "&post=" . $post['post_id'] . "&origin=$origin$count_loop\"" .
104
-            "$class>" . prepare4display($post['post_title']) . "</a></div>";
101
+        $thread_structure .= "<a href=\"viewthread.php?".api_get_cidreq().
102
+            "&forum=".$forumId."&thread=".$threadId.
103
+            "&post=".$post['post_id']."&origin=$origin$count_loop\"".
104
+            "$class>".prepare4display($post['post_title'])."</a></div>";
105 105
         $prev_next_array[] = $post['post_id'];
106 106
     }
107 107
     $count++;
@@ -148,43 +148,43 @@  discard block
 block discarded – undo
148 148
 $class_next = '';
149 149
 
150 150
 // Links
151
-$first_href = $forumUrl . 'viewthread.php?' . api_get_cidreq() .
152
-    '&forum=' . $forumId . '&thread=' . $threadId .
153
-    '&gradebook=' . $gradebook . '&id=1&post=' . $prev_next_array[0];
154
-$last_href 	= $forumUrl . 'viewthread.php?' . api_get_cidreq() .
155
-    '&forum=' . $forumId . '&thread=' . $threadId .
156
-    '&gradebook=' . $gradebook . '&post=' . $prev_next_array[$max-1];
157
-$prev_href	= $forumUrl . 'viewthread.php?' . api_get_cidreq() .
158
-    '&forum=' . $forumId . '&thread=' . $threadId .
159
-    '&gradebook=' . $gradebook . '&post=' . $prev_next_array[$prev_id];
160
-$next_href	= $forumUrl . 'viewthread.php?' . api_get_cidreq() .
161
-    '&forum=' . $forumId . '&thread=' . $threadId .
162
-    '&post=' . $prev_next_array[$next_id];
151
+$first_href = $forumUrl.'viewthread.php?'.api_get_cidreq().
152
+    '&forum='.$forumId.'&thread='.$threadId.
153
+    '&gradebook='.$gradebook.'&id=1&post='.$prev_next_array[0];
154
+$last_href 	= $forumUrl.'viewthread.php?'.api_get_cidreq().
155
+    '&forum='.$forumId.'&thread='.$threadId.
156
+    '&gradebook='.$gradebook.'&post='.$prev_next_array[$max - 1];
157
+$prev_href	= $forumUrl.'viewthread.php?'.api_get_cidreq().
158
+    '&forum='.$forumId.'&thread='.$threadId.
159
+    '&gradebook='.$gradebook.'&post='.$prev_next_array[$prev_id];
160
+$next_href	= $forumUrl.'viewthread.php?'.api_get_cidreq().
161
+    '&forum='.$forumId.'&thread='.$threadId.
162
+    '&post='.$prev_next_array[$next_id];
163 163
 
164 164
 echo '<center style="margin-top: 10px; margin-bottom: 10px;">';
165 165
 // Go to: first and previous
166 166
 if (((int) $current_id) > 0) {
167
-    echo '<a href="' . $first_href . '" ' . $class . ' title=' .
168
-        $first_message . '>' . $first_img . ' ' . $first_message .'</a>';
169
-    echo '<a href="' . $prev_href . '" ' . $class_prev . ' title=' .
170
-        $prev_message . '>' . $prev_img . ' ' . $prev_message . '</a>';
167
+    echo '<a href="'.$first_href.'" '.$class.' title='.
168
+        $first_message.'>'.$first_img.' '.$first_message.'</a>';
169
+    echo '<a href="'.$prev_href.'" '.$class_prev.' title='.
170
+        $prev_message.'>'.$prev_img.' '.$prev_message.'</a>';
171 171
 } else {
172
-    echo '<b><span class="invisible">' .
173
-        $first_img . ' ' . $first_message . '</b></span>';
174
-    echo '<b><span class="invisible">' .
175
-        $prev_img . ' ' . $prev_message . '</b></span>';
172
+    echo '<b><span class="invisible">'.
173
+        $first_img.' '.$first_message.'</b></span>';
174
+    echo '<b><span class="invisible">'.
175
+        $prev_img.' '.$prev_message.'</b></span>';
176 176
 }
177 177
 
178 178
 // Current counter
179
-echo ' [ ' . ($current_id + 1) . ' / ' . $max . ' ] ';
179
+echo ' [ '.($current_id + 1).' / '.$max.' ] ';
180 180
 
181 181
 // Go to: next and last
182 182
 if (($current_id + 1) < $max) {
183
-    echo '<a href="' . $next_href . '" ' . $class_next . ' title=' . $next_message . '>' . $next_message . ' ' . $next_img . '</a>';
184
-    echo '<a href="' . $last_href . '" ' . $class . ' title=' . $last_message . '>' . $last_message . ' ' . $last_img . '</a>';
183
+    echo '<a href="'.$next_href.'" '.$class_next.' title='.$next_message.'>'.$next_message.' '.$next_img.'</a>';
184
+    echo '<a href="'.$last_href.'" '.$class.' title='.$last_message.'>'.$last_message.' '.$last_img.'</a>';
185 185
 } else {
186
-    echo '<b><span class="invisible">' . $next_message . ' ' . $next_img . '</b></span>';
187
-    echo '<b><span class="invisible">' . $last_message . ' ' . $last_img . '</b></span>';
186
+    echo '<b><span class="invisible">'.$next_message.' '.$next_img.'</b></span>';
187
+    echo '<b><span class="invisible">'.$last_message.' '.$last_img.'</b></span>';
188 188
 }
189 189
 echo '</center>';
190 190
 
@@ -218,18 +218,18 @@  discard block
 block discarded – undo
218 218
 }
219 219
 
220 220
 if (api_get_course_setting('allow_user_image_forum')) {
221
-    echo '<br />' . display_user_image($rows[$display_post_id]['user_id'], $name, $origin) . '<br />';
221
+    echo '<br />'.display_user_image($rows[$display_post_id]['user_id'], $name, $origin).'<br />';
222 222
 }
223 223
 echo display_user_link(
224 224
     $rows[$display_post_id]['user_id'],
225 225
     $name,
226 226
     $origin,
227 227
     $username
228
-) . "<br />";
228
+)."<br />";
229 229
 
230 230
 echo api_convert_and_format_date(
231 231
     $rows[$display_post_id]['post_date']
232
-) . '<br /><br />';
232
+).'<br /><br />';
233 233
 // Get attach id
234 234
 $attachment_list = get_attachment($display_post_id);
235 235
 $id_attach = !empty($attachment_list) ? $attachment_list['id'] : '';
@@ -248,16 +248,16 @@  discard block
 block discarded – undo
248 248
     )
249 249
 ) {
250 250
     if ($locked == false) {
251
-        echo "<a href=\"editpost.php?" . api_get_cidreq() .
252
-            "&forum=" . $forumId . "&thread=" . $threadId .
253
-            "&post=" . $rows[$display_post_id]['post_id'] .
254
-            "&id_attach=" . $id_attach . "\">" .
251
+        echo "<a href=\"editpost.php?".api_get_cidreq().
252
+            "&forum=".$forumId."&thread=".$threadId.
253
+            "&post=".$rows[$display_post_id]['post_id'].
254
+            "&id_attach=".$id_attach."\">".
255 255
             Display::return_icon(
256 256
                 'edit.png',
257 257
                 get_lang('Edit'),
258 258
                 array(),
259 259
                 ICON_SIZE_SMALL
260
-            ) . '</a>';
260
+            ).'</a>';
261 261
     }
262 262
 }
263 263
 
@@ -273,22 +273,22 @@  discard block
 block discarded – undo
273 273
     sort($id_posts, SORT_NUMERIC);
274 274
     reset($id_posts);
275 275
     // The post minor
276
-    $post_minor = (int)$id_posts[0];
276
+    $post_minor = (int) $id_posts[0];
277 277
 }
278 278
 
279 279
 if (
280 280
     GroupManager::is_tutor_of_group(api_get_user_id(), $groupId) ||
281 281
     api_is_allowed_to_edit(false, true) &&
282
-    !(api_is_course_coach() &&$current_forum['session_id'] != $sessionId)
282
+    !(api_is_course_coach() && $current_forum['session_id'] != $sessionId)
283 283
 ) {
284 284
     if ($locked == false) {
285
-        echo "<a href=\"" . api_get_self() . "?" . api_get_cidreq() .
286
-            "&forum=" . $forumId . "&thread=" . $threadId .
287
-            "&action=delete&content=post&id=" .
288
-            $rows[$display_post_id]['post_id'] .
289
-            "\" onclick=\"javascript:if(!confirm('" .
290
-            addslashes(api_htmlentities(get_lang('DeletePost'), ENT_QUOTES)) .
291
-            "')) return false;\">" . Display::return_icon(
285
+        echo "<a href=\"".api_get_self()."?".api_get_cidreq().
286
+            "&forum=".$forumId."&thread=".$threadId.
287
+            "&action=delete&content=post&id=".
288
+            $rows[$display_post_id]['post_id'].
289
+            "\" onclick=\"javascript:if(!confirm('".
290
+            addslashes(api_htmlentities(get_lang('DeletePost'), ENT_QUOTES)).
291
+            "')) return false;\">".Display::return_icon(
292 292
                 'delete.png',
293 293
                 get_lang('Delete'),
294 294
                 array(),
@@ -308,16 +308,16 @@  discard block
 block discarded – undo
308 308
     );
309 309
 
310 310
     if (!isset($_GET['id']) && $post_id > $post_minor) {
311
-        echo "<a href=\"viewthread.php?" . api_get_cidreq() .
312
-            "&forum=" . $forumId . "&thread=" . $threadId .
313
-            "&origin=" . $origin . "&action=move&post=" .
314
-            $rows[$display_post_id]['post_id'] . "\">" .
311
+        echo "<a href=\"viewthread.php?".api_get_cidreq().
312
+            "&forum=".$forumId."&thread=".$threadId.
313
+            "&origin=".$origin."&action=move&post=".
314
+            $rows[$display_post_id]['post_id']."\">".
315 315
             Display::return_icon(
316 316
                 'move.png',
317 317
                 get_lang('MovePost'),
318 318
                 array(),
319 319
                 ICON_SIZE_SMALL
320
-            ) . "</a>";
320
+            )."</a>";
321 321
 
322 322
     }
323 323
 }
@@ -340,16 +340,16 @@  discard block
 block discarded – undo
340 340
         );
341 341
 
342 342
         if ($locked == false) {
343
-            echo "<a href=\"forumqualify.php?" . api_get_cidreq() .
344
-                "&forum=" . $forumId . "&thread=" . $threadId .
345
-                "&action=list&post=" . $rows[$display_post_id]['post_id'] .
346
-                "&user=" . $rows[$display_post_id]['user_id'] . "&user_id=" .
347
-                $rows[$display_post_id]['user_id'] . "&origin=" . $origin .
348
-                "&idtextqualify=" . $current_qualify_thread .
349
-                "\" >" . Display::return_icon(
343
+            echo "<a href=\"forumqualify.php?".api_get_cidreq().
344
+                "&forum=".$forumId."&thread=".$threadId.
345
+                "&action=list&post=".$rows[$display_post_id]['post_id'].
346
+                "&user=".$rows[$display_post_id]['user_id']."&user_id=".
347
+                $rows[$display_post_id]['user_id']."&origin=".$origin.
348
+                "&idtextqualify=".$current_qualify_thread.
349
+                "\" >".Display::return_icon(
350 350
                     'quiz.gif',
351 351
                     get_lang('Qualify')
352
-                ) . "</a>";
352
+                )."</a>";
353 353
         }
354 354
     }
355 355
 }
@@ -361,33 +361,33 @@  discard block
 block discarded – undo
361 361
         ($current_forum['allow_anonymous'] == 1 && !$_user['user_id'])
362 362
     ) {
363 363
         if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) {
364
-            echo '<a href="reply.php?' . api_get_cidreq() .
365
-                '&forum=' . $forumId . '&thread=' . $threadId .
366
-                '&post=' . $rows[$display_post_id]['post_id'] .
367
-                '&action=replymessage&origin=' . $origin . '">' .
364
+            echo '<a href="reply.php?'.api_get_cidreq().
365
+                '&forum='.$forumId.'&thread='.$threadId.
366
+                '&post='.$rows[$display_post_id]['post_id'].
367
+                '&action=replymessage&origin='.$origin.'">'.
368 368
                 Display::return_icon(
369 369
                     'message_reply_forum.png',
370 370
                     get_lang('ReplyToMessage')
371
-                ) . "</a>";
372
-            echo '<a href="reply.php?' . api_get_cidreq() .
373
-                '&forum=' . $forumId . '&thread=' . $threadId .
374
-                '&post=' . $rows[$display_post_id]['post_id'] .
375
-                '&action=quote&origin=' . $origin . '">' .
371
+                )."</a>";
372
+            echo '<a href="reply.php?'.api_get_cidreq().
373
+                '&forum='.$forumId.'&thread='.$threadId.
374
+                '&post='.$rows[$display_post_id]['post_id'].
375
+                '&action=quote&origin='.$origin.'">'.
376 376
                 Display::return_icon(
377 377
                     'quote.gif',
378 378
                     get_lang('QuoteMessage')
379
-                ) . "</a>";
379
+                )."</a>";
380 380
         }
381 381
     }
382 382
 } else {
383 383
     if ($current_forum_category && $current_forum_category['locked'] == 1) {
384
-        echo get_lang('ForumcategoryLocked') . '<br />';
384
+        echo get_lang('ForumcategoryLocked').'<br />';
385 385
     }
386 386
     if ($current_forum['locked'] == 1) {
387
-        echo get_lang('ForumLocked') . '<br />';
387
+        echo get_lang('ForumLocked').'<br />';
388 388
     }
389 389
     if ($current_thread['locked'] == 1) {
390
-        echo get_lang('ThreadLocked') . '<br />';
390
+        echo get_lang('ThreadLocked').'<br />';
391 391
     }
392 392
 }
393 393
 
@@ -406,17 +406,17 @@  discard block
 block discarded – undo
406 406
     $rows[$display_post_id]['post_notification'] == '1' AND
407 407
     $rows[$display_post_id]['poster_id'] == $_user['user_id']
408 408
 ) {
409
-    $post_image .= Display::return_icon('forumnotification.gif',get_lang('YouWillBeNotified'));
409
+    $post_image .= Display::return_icon('forumnotification.gif', get_lang('YouWillBeNotified'));
410 410
 }
411 411
 // The post title
412
-echo "<td class=\"$titleclass\">" .
413
-    prepare4display($rows[$display_post_id]['post_title']) . "</td>";
412
+echo "<td class=\"$titleclass\">".
413
+    prepare4display($rows[$display_post_id]['post_title'])."</td>";
414 414
 echo "</tr>";
415 415
 
416 416
 // The post message
417 417
 echo "<tr>";
418
-echo "<td class=\"$messageclass\">" .
419
-    prepare4display($rows[$display_post_id]['post_text']) . "</td>";
418
+echo "<td class=\"$messageclass\">".
419
+    prepare4display($rows[$display_post_id]['post_text'])."</td>";
420 420
 echo "</tr>";
421 421
 
422 422
 // The check if there is an attachment
@@ -429,24 +429,24 @@  discard block
 block discarded – undo
429 429
         echo Display::return_icon('attachment.gif', get_lang('Attachment'));
430 430
         echo '<a href="download.php?file=';
431 431
         echo $realname;
432
-        echo ' "> ' . $user_filename . ' </a>';
433
-        echo '<span class="forum_attach_comment">' .
434
-            Security::remove_XSS($attachment['comment'], STUDENT) . '</span>';
432
+        echo ' "> '.$user_filename.' </a>';
433
+        echo '<span class="forum_attach_comment">'.
434
+            Security::remove_XSS($attachment['comment'], STUDENT).'</span>';
435 435
 
436 436
         if (
437
-            ($current_forum['allow_edit'] == 1 &&$rows[$display_post_id]['user_id'] == $_user['user_id']) ||
437
+            ($current_forum['allow_edit'] == 1 && $rows[$display_post_id]['user_id'] == $_user['user_id']) ||
438 438
             (api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $sessionId))
439 439
         ) {
440
-            echo '&nbsp;&nbsp;<a href="' . api_get_self() . '?' .
441
-                api_get_cidreq() . '&origin=' .
442
-                Security::remove_XSS($_GET['origin']) .
443
-                '&action=delete_attach&id_attach=' .
444
-                $attachment['id'] . '&forum=' . $forumId .
445
-                '&thread=' . $threadId .
446
-                '" onclick="javascript:if(!confirm(\'' .
440
+            echo '&nbsp;&nbsp;<a href="'.api_get_self().'?'.
441
+                api_get_cidreq().'&origin='.
442
+                Security::remove_XSS($_GET['origin']).
443
+                '&action=delete_attach&id_attach='.
444
+                $attachment['id'].'&forum='.$forumId.
445
+                '&thread='.$threadId.
446
+                '" onclick="javascript:if(!confirm(\''.
447 447
                 addslashes(api_htmlentities(
448 448
                     get_lang('ConfirmYourChoice'), ENT_QUOTES)
449
-                ) . '\')) return false;">' . Display::return_icon(
449
+                ).'\')) return false;">'.Display::return_icon(
450 450
                     'delete.gif',
451 451
                     get_lang('Delete')
452 452
                 ).'</a><br />';
Please login to merge, or discard this patch.
main/forum/iframe_thread.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@
 block discarded – undo
81 81
     echo "<tr>";
82 82
     echo "<td rowspan=\"2\" class=\"forum_message_left\">";
83 83
     $username = api_htmlentities(sprintf(get_lang('LoginX'), $row['username']), ENT_QUOTES);
84
-    if ($row['user_id']=='0') {
84
+    if ($row['user_id'] == '0') {
85 85
         $name = $row['poster_name'];
86 86
     } else {
87 87
         $name = api_get_person_name($row['firstname'], $row['lastname']);
Please login to merge, or discard this patch.
main/forum/viewforumcategory.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -500,7 +500,7 @@
 block discarded – undo
500 500
                 $html .= '</div>';
501 501
                 $html .= '</div></div>';
502 502
             }
503
-           echo $html;
503
+            echo $html;
504 504
         }
505 505
     }
506 506
     if (count($forum_list) == 0) {
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -52,17 +52,17 @@  discard block
 block discarded – undo
52 52
 $origin = '';
53 53
 
54 54
 if (isset($_GET['origin'])) {
55
-    $origin =  Security::remove_XSS($_GET['origin']);
55
+    $origin = Security::remove_XSS($_GET['origin']);
56 56
 }
57 57
 
58 58
 /* Header and Breadcrumbs */
59 59
 $gradebook = null;
60 60
 if (isset($_SESSION['gradebook'])) {
61
-    $gradebook=	$_SESSION['gradebook'];
61
+    $gradebook = $_SESSION['gradebook'];
62 62
 }
63 63
 
64 64
 if (!empty($gradebook) && $gradebook == 'view') {
65
-    $interbreadcrumb[] = array (
65
+    $interbreadcrumb[] = array(
66 66
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
67 67
         'name' => get_lang('ToolGradebook')
68 68
     );
@@ -72,16 +72,16 @@  discard block
 block discarded – undo
72 72
 
73 73
 $current_forum_category = get_forum_categories($_GET['forumcategory']);
74 74
 $interbreadcrumb[] = array(
75
-    'url' => 'index.php?gradebook=' . $gradebook . '&search='
75
+    'url' => 'index.php?gradebook='.$gradebook.'&search='
76 76
         . Security::remove_XSS(urlencode(isset($_GET['search']) ? $_GET['search'] : '')),
77 77
     'name' => get_lang('Forum')
78 78
 );
79 79
 
80 80
 if (!empty($_GET['action']) && !empty($_GET['content'])) {
81
-    if ($_GET['action']=='add' && $_GET['content']=='forum' ) {
81
+    if ($_GET['action'] == 'add' && $_GET['content'] == 'forum') {
82 82
         $interbreadcrumb[] = array(
83 83
             'url' => 'viewforumcategory.php?forumcategory='
84
-                . $current_forum_category['cat_id'] . '&origin=' . $origin,
84
+                . $current_forum_category['cat_id'].'&origin='.$origin,
85 85
             'name' => $current_forum_category['cat_title']
86 86
         );
87 87
         $interbreadcrumb[] = array(
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     );
97 97
 }
98 98
 
99
-if ($origin=='learnpath') {
99
+if ($origin == 'learnpath') {
100 100
     Display::display_reduced_header();
101 101
 } else {
102 102
     Display::display_header(null);
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 // then the user is not allowed here.
112 112
 if (
113 113
     !api_is_allowed_to_edit(false, true) AND
114
-    ( $current_forum_category && $current_forum_category['visibility'] == 0)
114
+    ($current_forum_category && $current_forum_category['visibility'] == 0)
115 115
 ) {
116 116
     api_not_allowed();
117 117
 }
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
 $html .= '<div class="actions">';
122 122
 $html .= '<a href="index.php?gradebook='.$gradebook.'&'.api_get_cidreq().'">'.
123 123
     Display::return_icon('back.png', get_lang('BackToForumOverview'), '', ICON_SIZE_MEDIUM).'</a>';
124
-if (api_is_allowed_to_edit(false,true)) {
125
-    $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forumcategory='
126
-        . $current_forum_category['cat_id'] . '&action=add&content=forum"> '
127
-        . Display::return_icon('new_forum.png', get_lang('AddForum'), '', ICON_SIZE_MEDIUM) . '</a>';
124
+if (api_is_allowed_to_edit(false, true)) {
125
+    $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&forumcategory='
126
+        . $current_forum_category['cat_id'].'&action=add&content=forum"> '
127
+        . Display::return_icon('new_forum.png', get_lang('AddForum'), '', ICON_SIZE_MEDIUM).'</a>';
128 128
 }
129 129
 $html .= search_link();
130 130
 $html .= '</div>';
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
     $forum_categories_list = '';
185 185
     $forumId = $forum_category['cat_id'];
186 186
     $forumTitle = $forum_category['cat_title'];
187
-    $linkForumCategory = 'viewforumcategory.php?' . api_get_cidreq() . '&forumcategory=' . strval(intval($forumId));
187
+    $linkForumCategory = 'viewforumcategory.php?'.api_get_cidreq().'&forumcategory='.strval(intval($forumId));
188 188
     $descriptionCategory = $forum_category['cat_comment'];
189 189
     $icoCategory = Display::return_icon(
190 190
         'forum_blue.png',
@@ -195,16 +195,16 @@  discard block
 block discarded – undo
195 195
 
196 196
     if (api_is_allowed_to_edit(false, true) && !($forum_category['session_id'] == 0 && $sessionId != 0)) {
197 197
 
198
-        $iconsEdit = '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forumcategory='
199
-            . Security::remove_XSS($_GET['forumcategory']) . '&action=edit&content=forumcategory&id='
200
-            . '' . $forumId . '">'
201
-            . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>';
202
-        $iconsEdit .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forumcategory='
198
+        $iconsEdit = '<a href="'.api_get_self().'?'.api_get_cidreq().'&forumcategory='
199
+            . Security::remove_XSS($_GET['forumcategory']).'&action=edit&content=forumcategory&id='
200
+            . ''.$forumId.'">'
201
+            . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
202
+        $iconsEdit .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&forumcategory='
203 203
             . Security::remove_XSS($_GET['forumcategory'])
204
-            . '&action=delete&content=forumcategory&id=' . $forumId
204
+            . '&action=delete&content=forumcategory&id='.$forumId
205 205
             . "\" onclick=\"javascript:if(!confirm('"
206 206
             . addslashes(api_htmlentities(get_lang('DeleteForumCategory'), ENT_QUOTES))
207
-            . "')) return false;\">" . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL)
207
+            . "')) return false;\">".Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL)
208 208
             . '</a>';
209 209
         $iconsEdit .= return_visible_invisible_icon(
210 210
             'forumcategory', $forum_category['cat_id'],
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
     );
245 245
 
246 246
 
247
-    if ($descriptionCategory != '' && trim($descriptionCategory)!= '&nbsp;')
247
+    if ($descriptionCategory != '' && trim($descriptionCategory) != '&nbsp;')
248 248
     {
249 249
         $html .= '<div class="forum-description">'.$descriptionCategory.'</div>';
250 250
     }
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
             // SHOULD WE SHOW THIS PARTICULAR FORUM
285 285
             // you are teacher => show forum
286 286
 
287
-            if (api_is_allowed_to_edit(false,true)) {
287
+            if (api_is_allowed_to_edit(false, true)) {
288 288
                 //echo 'teacher';
289 289
                 $show_forum = true;
290 290
             } else {
@@ -351,9 +351,9 @@  discard block
 block discarded – undo
351 351
                         ? $all_groups[$forum['forum_of_group']]['id']
352 352
                         : null;
353 353
                     $group_title = api_substr($my_all_groups_forum_name, 0, 30);
354
-                    $forum_title_group_addition = ' (<a href="../group/group_space.php?' . api_get_cidreq()
355
-                        . '&gidReq=' . $my_all_groups_forum_id . '" class="forum_group_link">'
356
-                        . get_lang('GoTo') . ' ' . $group_title . '</a>)';
354
+                    $forum_title_group_addition = ' (<a href="../group/group_space.php?'.api_get_cidreq()
355
+                        . '&gidReq='.$my_all_groups_forum_id.'" class="forum_group_link">'
356
+                        . get_lang('GoTo').' '.$group_title.'</a>)';
357 357
                 } else {
358 358
                     $forum_title_group_addition = '';
359 359
                 }
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
                 $html .= '<div class="row">';
372 372
                 $html .= '<div class="col-md-6">';
373 373
                 $html .= '<div class="col-md-3">';
374
-                $html .= '<div class="number-post">'.$forum_image .'<p>' . $my_number_threads . ' ' . get_lang('ForumThreads') . '</p></div>';
374
+                $html .= '<div class="number-post">'.$forum_image.'<p>'.$my_number_threads.' '.get_lang('ForumThreads').'</p></div>';
375 375
                 $html .= '</div>';
376 376
 
377 377
                 $html .= '<div class="col-md-9">';
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
                     'a',
387 387
                     $forum['forum_title'].$session_displayed,
388 388
                     array(
389
-                        'href' => 'viewforum.php?' . api_get_cidreq()
389
+                        'href' => 'viewforum.php?'.api_get_cidreq()
390 390
                             . "&gidReq={$forum['forum_of_group']}&forum={$forum['forum_id']}&origin=$origin&search="
391 391
                             . Security::remove_XSS(urlencode(isset($_GET['search']) ? $_GET['search'] : '')),
392 392
                         'class' => return_visible_invisible($forum['visibility'])
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
                 );
395 395
                 $html .= Display::tag(
396 396
                     'h3',
397
-                    $linkForum . ' ' . $forum_title_group_addition,
397
+                    $linkForum.' '.$forum_title_group_addition,
398 398
                     array(
399 399
                         'class' => 'title'
400 400
                     )
@@ -410,19 +410,19 @@  discard block
 block discarded – undo
410 410
                 $html .= '</div>';
411 411
                 $html .= '<div class="col-md-6">';
412 412
 
413
-                $iconEmpty='';
413
+                $iconEmpty = '';
414 414
 
415 415
                 // The number of topics and posts.
416 416
                 if ($forum['forum_of_group'] !== '0') {
417 417
                     $newPost = '';
418 418
                     if (is_array($my_whatsnew_post_info) && !empty($my_whatsnew_post_info)) {
419
-                        $newPost = ' ' . Display::return_icon('alert.png', get_lang('Forum'), null, ICON_SIZE_SMALL);
419
+                        $newPost = ' '.Display::return_icon('alert.png', get_lang('Forum'), null, ICON_SIZE_SMALL);
420 420
                     } else {
421 421
                         $newPost = $iconEmpty;
422 422
                     }
423 423
                 } else {
424 424
                     if (is_array($my_whatsnew_post_info) && !empty($my_whatsnew_post_info)) {
425
-                        $newPost = ' ' . Display::return_icon('alert.png', get_lang('Forum'), null, ICON_SIZE_SMALL);
425
+                        $newPost = ' '.Display::return_icon('alert.png', get_lang('Forum'), null, ICON_SIZE_SMALL);
426 426
                     } else {
427 427
                         $newPost = $iconEmpty;
428 428
                     }
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 
431 431
                 $html .= '<div class="row">';
432 432
                 $html .= '<div class="col-md-2">';
433
-                $html .= $newPost . '</div>';
433
+                $html .= $newPost.'</div>';
434 434
 
435 435
                 // the last post in the forum
436 436
                 if ($forum['last_poster_name'] != '') {
@@ -442,9 +442,9 @@  discard block
 block discarded – undo
442 442
                 }
443 443
                 $html .= '<div class="col-md-6">';
444 444
                 if (!empty($forum['last_post_id'])) {
445
-                    $html .= Display::return_icon('post-item.png', null, null, ICON_SIZE_TINY) . ' ';
445
+                    $html .= Display::return_icon('post-item.png', null, null, ICON_SIZE_TINY).' ';
446 446
                     $html .= api_convert_and_format_date($forum['last_post_date'])
447
-                        . ' ' . get_lang('By') . ' '
447
+                        . ' '.get_lang('By').' '
448 448
                         . display_user_link($poster_id, $name);
449 449
                 }
450 450
                 $html .= '</div>';
@@ -454,13 +454,13 @@  discard block
 block discarded – undo
454 454
                     api_is_allowed_to_edit(false, true) &&
455 455
                     !($forum['session_id'] == 0 && $sessionId != 0)
456 456
                 ) {
457
-                    $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forumcategory='
457
+                    $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&forumcategory='
458 458
                         . Security::remove_XSS($_GET['forumcategory'])
459
-                        . '&action=edit&content=forum&id=' . $forum['forum_id'] . '">'
460
-                        . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>';
461
-                    $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forumcategory='
459
+                        . '&action=edit&content=forum&id='.$forum['forum_id'].'">'
460
+                        . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
461
+                    $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&forumcategory='
462 462
                         . Security::remove_XSS($_GET['forumcategory'])
463
-                        . '&action=delete&content=forum&id=' . $forum['forum_id']
463
+                        . '&action=delete&content=forum&id='.$forum['forum_id']
464 464
                         . "\" onclick=\"javascript:if(!confirm('"
465 465
                         . addslashes(api_htmlentities(get_lang('DeleteForum'), ENT_QUOTES))
466 466
                         . "')) return false;\">"
@@ -484,15 +484,15 @@  discard block
 block discarded – undo
484 484
                 $iconnotify = 'notification_mail_na.png';
485 485
 
486 486
                 if (is_array(isset($_SESSION['forum_notification']['forum']) ? $_SESSION['forum_notification']['forum'] : null)) {
487
-                    if (in_array($forum['forum_id'],$_SESSION['forum_notification']['forum'])) {
487
+                    if (in_array($forum['forum_id'], $_SESSION['forum_notification']['forum'])) {
488 488
                         $iconnotify = 'notification_mail.png';
489 489
                     }
490 490
                 }
491 491
 
492 492
                 if (!api_is_anonymous()) {
493
-                    $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forumcategory='
494
-                        . Security::remove_XSS($_GET['forumcategory']) . '&action=notify&content=forum&id='
495
-                        . $forum['forum_id'] . '">' . Display::return_icon($iconnotify, get_lang('NotifyMe')) . '</a>';
493
+                    $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&forumcategory='
494
+                        . Security::remove_XSS($_GET['forumcategory']).'&action=notify&content=forum&id='
495
+                        . $forum['forum_id'].'">'.Display::return_icon($iconnotify, get_lang('NotifyMe')).'</a>';
496 496
                 }
497 497
                 $html .= '</div>';
498 498
                 $html .= '</div>';
Please login to merge, or discard this patch.
main/forum/editpost.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@
 block discarded – undo
142 142
 
143 143
 if (!api_is_allowed_to_edit(null, true) &&
144 144
     (
145
-        ($current_forum_category && $current_forum_category['locked'] <> 0 ) ||
145
+        ($current_forum_category && $current_forum_category['locked'] <> 0) ||
146 146
         $current_forum['locked'] <> 0 ||
147 147
         $current_thread['locked'] <> 0
148 148
     )
Please login to merge, or discard this patch.
main/forum/viewpost.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 // Are we in a lp ?
29 29
 $origin = '';
30 30
 if (isset($_GET['origin'])) {
31
-    $origin =  Security::remove_XSS($_GET['origin']);
31
+    $origin = Security::remove_XSS($_GET['origin']);
32 32
 }
33 33
 
34 34
 /* MAIN DISPLAY SECTION */
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
 
46 46
 /* Header and Breadcrumbs */
47 47
 
48
-if (isset($_SESSION['gradebook'])){
48
+if (isset($_SESSION['gradebook'])) {
49 49
     $gradebook = $_SESSION['gradebook'];
50 50
 }
51 51
 
52 52
 if (!empty($gradebook) && $gradebook == 'view') {
53
-    $interbreadcrumb[] = array (
53
+    $interbreadcrumb[] = array(
54 54
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
55 55
         'name' => get_lang('ToolGradebook')
56 56
     );
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
     echo "\t<tr>\n\t\t<th style=\"padding-left:5px;\" align=\"left\" colspan=\"6\">";
184 184
     echo '<span class="forum_title">'.prepare4display($current_thread['thread_title']).'</span><br />';
185 185
 
186
-    if ($origin!='learnpath') {
186
+    if ($origin != 'learnpath') {
187 187
         echo '<span class="forum_low_description">'.prepare4display($current_forum_category['cat_title']).' - ';
188 188
     }
189 189
 
Please login to merge, or discard this patch.