Completed
Push — 1.11.x ( eb820d...635292 )
by José
41:13
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 3 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.
Doc Comments   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      * This function saves a change in a wiki page
259 259
      * @author Patrick Cool <[email protected]>, Ghent University
260 260
      * @param array $values
261
-     * @return language string saying that the changes are stored
261
+     * @return string string saying that the changes are stored
262 262
      **/
263 263
     public function save_wiki($values)
264 264
     {
@@ -1196,6 +1196,7 @@  discard block
 block discarded – undo
1196 1196
      * Checks if this navigation tab has to be set to active
1197 1197
      * @author Patrick Cool <[email protected]>, Ghent University
1198 1198
      *
1199
+     * @param string $paramwk
1199 1200
      * @return string html code
1200 1201
      */
1201 1202
     public function is_active_navigation_tab($paramwk)
@@ -1711,6 +1712,7 @@  discard block
 block discarded – undo
1711 1712
 
1712 1713
     /**
1713 1714
      * Sends pending e-mails
1715
+     * @param string $type
1714 1716
      */
1715 1717
     public function check_emailcue($id_or_ref, $type, $lastime='', $lastuser='')
1716 1718
     {
@@ -2011,6 +2013,7 @@  discard block
 block discarded – undo
2011 2013
 
2012 2014
     /**
2013 2015
      * Exports the wiki page to PDF
2016
+     * @param string $course_code
2014 2017
      */
2015 2018
     public function export_to_pdf($id, $course_code)
2016 2019
     {
@@ -2478,6 +2481,7 @@  discard block
 block discarded – undo
2478 2481
     /**
2479 2482
      * Draws an HTML form select with the given options
2480 2483
      *
2484
+     * @param string $name
2481 2485
      */
2482 2486
     public function make_select($name,$values,$checked='')
2483 2487
     {
@@ -2514,7 +2518,7 @@  discard block
 block discarded – undo
2514 2518
     /**
2515 2519
      * Get wiki information
2516 2520
      * @param   int|bool     wiki id
2517
-     * @return  array   wiki data
2521
+     * @return  string   wiki data
2518 2522
      */
2519 2523
     public function getWikiDataFromDb($id)
2520 2524
     {
@@ -2561,6 +2565,7 @@  discard block
 block discarded – undo
2561 2565
      * Get wiki information
2562 2566
      * @param   string     wiki id
2563 2567
      * @param int $courseId
2568
+     * @param string $title
2564 2569
      * @return  array   wiki data
2565 2570
      */
2566 2571
     public function getPageByTitle($title, $courseId = null)
@@ -2593,6 +2598,8 @@  discard block
 block discarded – undo
2593 2598
      * @param int $courseId
2594 2599
      * @param string
2595 2600
      * @param string
2601
+     * @param string $groupfilter
2602
+     * @param string $condition_session
2596 2603
      * @return bool
2597 2604
      */
2598 2605
     public function deletePage($title, $courseId, $groupfilter = null, $condition_session = null)
@@ -3644,6 +3651,7 @@  discard block
 block discarded – undo
3644 3651
 
3645 3652
     /**
3646 3653
      * Show all pages
3654
+     * @param string $action
3647 3655
      */
3648 3656
     public function allPages($action)
3649 3657
     {
@@ -4200,7 +4208,7 @@  discard block
 block discarded – undo
4200 4208
 
4201 4209
     /**
4202 4210
      * Restore page
4203
-     * @return bool
4211
+     * @return false|null
4204 4212
      */
4205 4213
     public function restorePage()
4206 4214
     {
@@ -4302,7 +4310,7 @@  discard block
 block discarded – undo
4302 4310
     }
4303 4311
 
4304 4312
     /**
4305
-     * @param int|bool $wikiId
4313
+     * @param false|string $wikiId
4306 4314
      */
4307 4315
     public function setWikiData($wikiId)
4308 4316
     {
Please login to merge, or discard this patch.
Spacing   +618 added lines, -618 removed lines patch added patch discarded remove patch
@@ -99,12 +99,12 @@  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 110
                     $full_link_array = explode("|", $value);
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
                     $link = trim($value);
115 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);
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
      **/
171 171
     public function detect_ftp_link($input)
172 172
     {
173
-        $ftplink='href="ftp';
173
+        $ftplink = 'href="ftp';
174 174
         $ftplinkStyle = 'class="wiki_ftp_link" href="ftp';
175 175
         $output = str_replace($ftplink, $ftplinkStyle, $input);
176 176
 
@@ -215,21 +215,21 @@  discard block
 block discarded – undo
215 215
     {
216 216
         $groupId = api_get_group_id();
217 217
         //now doubles brackets
218
-        $input_array = preg_split("/(\[\[|\]\])/",$input,-1, PREG_SPLIT_DELIM_CAPTURE);
218
+        $input_array = preg_split("/(\[\[|\]\])/", $input, -1, PREG_SPLIT_DELIM_CAPTURE);
219 219
 
220 220
         foreach ($input_array as $key => $value) {
221 221
             //now doubles brackets
222
-            if (isset($input_array[$key-1]) && $input_array[$key-1] == '[[' AND
223
-                $input_array[$key+1] == ']]'
222
+            if (isset($input_array[$key - 1]) && $input_array[$key - 1] == '[[' AND
223
+                $input_array[$key + 1] == ']]'
224 224
             ) {
225 225
                 // now full wikilink
226
-                if (api_strpos($value, "|") !== false){
227
-                    $full_link_array=explode("|", $value);
228
-                    $link=trim(strip_tags($full_link_array[0]));
229
-                    $title=trim($full_link_array[1]);
226
+                if (api_strpos($value, "|") !== false) {
227
+                    $full_link_array = explode("|", $value);
228
+                    $link = trim(strip_tags($full_link_array[0]));
229
+                    $title = trim($full_link_array[1]);
230 230
                 } else {
231
-                    $link=trim(strip_tags($value));
232
-                    $title=trim($value);
231
+                    $link = trim(strip_tags($value));
232
+                    $title = trim($value);
233 233
                 }
234 234
 
235 235
                 //if wikilink is homepage
@@ -241,14 +241,14 @@  discard block
 block discarded – undo
241 241
                 }
242 242
 
243 243
                 // 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
244
-                if (self::checktitle(strtolower(str_replace(' ','_',$link)))) {
244
+                if (self::checktitle(strtolower(str_replace(' ', '_', $link)))) {
245 245
                     $link = api_html_entity_decode($link);
246
-                    $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
+                    $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>';
247 247
                 } else {
248
-                    $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
+                    $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>';
249 249
                 }
250
-                unset($input_array[$key-1]);
251
-                unset($input_array[$key+1]);
250
+                unset($input_array[$key - 1]);
251
+                unset($input_array[$key + 1]);
252 252
             }
253 253
         }
254 254
         $output = implode('', $input_array);
@@ -294,11 +294,11 @@  discard block
 block discarded – undo
294 294
         // are not made here, but through the interce buttons
295 295
 
296 296
         // cleaning the variables
297
-        if (api_get_setting('htmlpurifier_wiki') == 'true'){
297
+        if (api_get_setting('htmlpurifier_wiki') == 'true') {
298 298
             //$purifier = new HTMLPurifier();
299 299
             $values['content'] = Security::remove_XSS($values['content']);
300 300
         }
301
-        $version = intval($values['version']) + 1 ;
301
+        $version = intval($values['version']) + 1;
302 302
         $linkTo = self::links_to($values['content']); //and check links content
303 303
 
304 304
         //cleaning config variables
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
             $_clean['startdate_assig'] = null;
322 322
         }
323 323
 
324
-        if (isset($values['initenddate']) && $values['initenddate']==1) {
324
+        if (isset($values['initenddate']) && $values['initenddate'] == 1) {
325 325
             $_clean['enddate_assig'] = $values['enddate_assig'];
326 326
         } else {
327 327
             $_clean['enddate_assig'] = null;
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
         }
333 333
 
334 334
         if (!empty($values['max_text']) || !empty($values['max_version'])) {
335
-            $_clean['max_text']	= $values['max_text'];
335
+            $_clean['max_text'] = $values['max_text'];
336 336
             $_clean['max_version'] = $values['max_version'];
337 337
         }
338 338
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
                 $groupId
384 384
             );
385 385
 
386
-            if ($values['page_id']== 0) {
386
+            if ($values['page_id'] == 0) {
387 387
                 $sql = 'UPDATE '.$tbl_wiki.' SET page_id="'.$id.'"
388 388
                         WHERE c_id = '.$course_id.' AND iid ="'.$id.'"';
389 389
                 Database::query($sql);
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
         $_course = $this->courseInfo;
468 468
         $r_user_id = api_get_user_id();
469 469
         $r_dtime = api_get_utc_datetime();
470
-        $r_version = $r_version+1;
470
+        $r_version = $r_version + 1;
471 471
         $r_comment = get_lang('RestoredFromVersion').': '.$c_version;
472 472
         $session_id = api_get_session_id();
473 473
         $course_id = api_get_course_int_id();
@@ -572,9 +572,9 @@  discard block
 block discarded – undo
572 572
         // Unlike ordinary pages of pages of assignments.
573 573
         // Allow create a ordinary page although there is a assignment with the same name
574 574
         if ($_clean['assignment'] == 2 || $_clean['assignment'] == 1) {
575
-            $page = str_replace(' ','_',$values['title']."_uass".$assig_user_id);
575
+            $page = str_replace(' ', '_', $values['title']."_uass".$assig_user_id);
576 576
         } else {
577
-            $page = str_replace(' ','_',$values['title']);
577
+            $page = str_replace(' ', '_', $values['title']);
578 578
         }
579 579
         $_clean['reflink'] = $page;
580 580
         $_clean['title']   = trim($values['title']);
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
      */
728 728
     public function setForm($form, $row = array())
729 729
     {
730
-        $toolBar = api_is_allowed_to_edit(null,true)
730
+        $toolBar = api_is_allowed_to_edit(null, true)
731 731
             ? array('ToolbarSet' => 'Wiki', 'Width' => '100%', 'Height' => '400')
732 732
             : array('ToolbarSet' => 'WikiStudent', 'Width' => '100%', 'Height' => '400', 'UserStatus' => 'student');
733 733
 
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 
739 739
         $form->addElement('select', 'progress', get_lang('Progress'), $progress);
740 740
 
741
-        if ((api_is_allowed_to_edit(false,true) ||
741
+        if ((api_is_allowed_to_edit(false, true) ||
742 742
             api_is_platform_admin()) &&
743 743
             isset($row['reflink']) && $row['reflink'] != 'index'
744 744
         ) {
@@ -878,13 +878,13 @@  discard block
 block discarded – undo
878 878
         if ($newtitle) {
879 879
             $pageMIX = $newtitle; //display the page after it is created
880 880
         } else {
881
-            $pageMIX = $page;//display current page
881
+            $pageMIX = $page; //display current page
882 882
         }
883 883
 
884 884
         $filter = null;
885 885
         if (isset($_GET['view']) && $_GET['view']) {
886 886
             $_clean['view'] = Database::escape_string($_GET['view']);
887
-            $filter =' AND w.id="'.$_clean['view'].'"';
887
+            $filter = ' AND w.id="'.$_clean['view'].'"';
888 888
         }
889 889
 
890 890
         // First, check page visibility in the first page version
@@ -926,15 +926,15 @@  discard block
 block discarded – undo
926 926
         }
927 927
 
928 928
         // if both are empty and we are displaying the index page then we display the default text.
929
-        if ($row['content']=='' && $row['title']=='' && $page=='index') {
929
+        if ($row['content'] == '' && $row['title'] == '' && $page == 'index') {
930 930
             if (api_is_allowed_to_edit(false, true) ||
931 931
                 api_is_platform_admin() ||
932 932
                 GroupManager::is_user_in_group(api_get_user_id(), api_get_group_id()) ||
933 933
                 api_is_allowed_in_course()
934 934
             ) {
935 935
                 //Table structure for better export to pdf
936
-                $default_table_for_content_Start='<table align="center" border="0"><tr><td align="center">';
937
-                $default_table_for_content_End='</td></tr></table>';
936
+                $default_table_for_content_Start = '<table align="center" border="0"><tr><td align="center">';
937
+                $default_table_for_content_End = '</td></tr></table>';
938 938
                 $content = $default_table_for_content_Start.
939 939
                     sprintf(get_lang('DefaultContent'), api_get_path(WEB_IMG_PATH)).
940 940
                     $default_table_for_content_End;
@@ -949,23 +949,23 @@  discard block
 block discarded – undo
949 949
 
950 950
         //assignment mode: identify page type
951 951
         $icon_assignment = null;
952
-        if ($row['assignment']==1) {
953
-            $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'),'',ICON_SIZE_SMALL);
954
-        } elseif($row['assignment']==2) {
955
-            $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
952
+        if ($row['assignment'] == 1) {
953
+            $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'), '', ICON_SIZE_SMALL);
954
+        } elseif ($row['assignment'] == 2) {
955
+            $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
956 956
         }
957 957
 
958 958
         //task mode
959 959
         $icon_task = null;
960 960
         if (!empty($row['task'])) {
961
-            $icon_task=Display::return_icon('wiki_task.png', get_lang('StandardTask'),'',ICON_SIZE_SMALL);
961
+            $icon_task = Display::return_icon('wiki_task.png', get_lang('StandardTask'), '', ICON_SIZE_SMALL);
962 962
         }
963 963
 
964 964
         // Show page. Show page to all users if isn't hide page. Mode assignments: if student is the author, can view
965 965
         if ($KeyVisibility == "1" ||
966 966
             api_is_allowed_to_edit(false, true) ||
967 967
             api_is_platform_admin() ||
968
-            ($row['assignment'] == 2 && $KeyVisibility=="0" && (api_get_user_id() == $row['user_id'])) ||
968
+            ($row['assignment'] == 2 && $KeyVisibility == "0" && (api_get_user_id() == $row['user_id'])) ||
969 969
             api_is_allowed_in_course()
970 970
         ) {
971 971
             $actionsLeft = '';
@@ -991,13 +991,13 @@  discard block
 block discarded – undo
991 991
             $protect_page = null;
992 992
             $lock_unlock_protect = null;
993 993
             // page action: protecting (locking) the page
994
-            if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
995
-                if (self::check_protect_page()==1) {
994
+            if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
995
+                if (self::check_protect_page() == 1) {
996 996
                     $protect_page = Display::return_icon('lock.png', get_lang('PageLockedExtra'), '', ICON_SIZE_MEDIUM);
997
-                    $lock_unlock_protect='unlock';
997
+                    $lock_unlock_protect = 'unlock';
998 998
                 } else {
999 999
                     $protect_page = Display::return_icon('unlock.png', get_lang('PageUnlockedExtra'), '', ICON_SIZE_MEDIUM);
1000
-                    $lock_unlock_protect='lock';
1000
+                    $lock_unlock_protect = 'lock';
1001 1001
                 }
1002 1002
             }
1003 1003
 
@@ -1009,13 +1009,13 @@  discard block
 block discarded – undo
1009 1009
             $visibility_page = null;
1010 1010
             $lock_unlock_visibility = null;
1011 1011
             //page action: visibility
1012
-            if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
1012
+            if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
1013 1013
                 if (self::check_visibility_page() == 1) {
1014
-                    $visibility_page = Display::return_icon('visible.png', get_lang('ShowPageExtra'),'', ICON_SIZE_MEDIUM);
1014
+                    $visibility_page = Display::return_icon('visible.png', get_lang('ShowPageExtra'), '', ICON_SIZE_MEDIUM);
1015 1015
                     $lock_unlock_visibility = 'invisible';
1016 1016
 
1017 1017
                 } else {
1018
-                    $visibility_page = Display::return_icon('invisible.png', get_lang('HidePageExtra'),'', ICON_SIZE_MEDIUM);
1018
+                    $visibility_page = Display::return_icon('invisible.png', get_lang('HidePageExtra'), '', ICON_SIZE_MEDIUM);
1019 1019
                     $lock_unlock_visibility = 'visible';
1020 1020
                 }
1021 1021
             }
@@ -1027,11 +1027,11 @@  discard block
 block discarded – undo
1027 1027
 
1028 1028
             //page action: notification
1029 1029
             if (api_is_allowed_to_session_edit()) {
1030
-                if (self::check_notify_page($page)==1) {
1031
-                    $notify_page = Display::return_icon('messagebox_info.png', get_lang('NotifyByEmail'),'',ICON_SIZE_MEDIUM);
1030
+                if (self::check_notify_page($page) == 1) {
1031
+                    $notify_page = Display::return_icon('messagebox_info.png', get_lang('NotifyByEmail'), '', ICON_SIZE_MEDIUM);
1032 1032
                     $lock_unlock_notify_page = 'unlocknotify';
1033 1033
                 } else {
1034
-                    $notify_page = Display::return_icon('mail.png', get_lang('CancelNotifyByEmail'),'',ICON_SIZE_MEDIUM);
1034
+                    $notify_page = Display::return_icon('mail.png', get_lang('CancelNotifyByEmail'), '', ICON_SIZE_MEDIUM);
1035 1035
                     $lock_unlock_notify_page = 'locknotify';
1036 1036
                 }
1037 1037
             }
@@ -1043,33 +1043,33 @@  discard block
 block discarded – undo
1043 1043
                 ) {
1044 1044
                     // menu discuss page
1045 1045
                     $actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=discuss&title='.api_htmlentities(urlencode($page)).'" '.self::is_active_navigation_tab('discuss').'>'.
1046
-                        Display::return_icon('discuss.png',get_lang('DiscussThisPage'),'',ICON_SIZE_MEDIUM).'</a>';
1046
+                        Display::return_icon('discuss.png', get_lang('DiscussThisPage'), '', ICON_SIZE_MEDIUM).'</a>';
1047 1047
                 }
1048 1048
 
1049 1049
                 //menu history
1050 1050
                 $actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=history&title='.api_htmlentities(urlencode($page)).'" '.self::is_active_navigation_tab('history').'>'.
1051
-                    Display::return_icon('history.png',get_lang('ShowPageHistory'),'',ICON_SIZE_MEDIUM).'</a>';
1051
+                    Display::return_icon('history.png', get_lang('ShowPageHistory'), '', ICON_SIZE_MEDIUM).'</a>';
1052 1052
                 //menu linkspages
1053 1053
                 $actionsRight .= '<a href="index.php?'.api_get_cidreq().'action=links&title='.api_htmlentities(urlencode($page)).'" '.self::is_active_navigation_tab('links').'>'.
1054
-                    Display::return_icon('what_link_here.png',get_lang('LinksPages'),'',ICON_SIZE_MEDIUM).'</a>';
1054
+                    Display::return_icon('what_link_here.png', get_lang('LinksPages'), '', ICON_SIZE_MEDIUM).'</a>';
1055 1055
 
1056 1056
                 //menu delete wikipage
1057
-                if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
1057
+                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
1058 1058
                     $actionsRight .= '<a href="index.php?action=delete&'.api_get_cidreq().'&title='.api_htmlentities(urlencode($page)).'"'.self::is_active_navigation_tab('delete').'>'.
1059
-                        Display::return_icon('delete.png',get_lang('DeleteThisPage'),'',ICON_SIZE_MEDIUM).'</a>';
1059
+                        Display::return_icon('delete.png', get_lang('DeleteThisPage'), '', ICON_SIZE_MEDIUM).'</a>';
1060 1060
                 }
1061 1061
 
1062 1062
                 $actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=showpage&actionpage='.$lock_unlock_notify_page.'&title='.api_htmlentities(urlencode($page)).'">'.
1063 1063
                     $notify_page.'</a>';
1064 1064
 
1065 1065
                 // Page action: copy last version to doc area
1066
-                if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
1066
+                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
1067 1067
                     $actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=export2doc&wiki_id='.$row['id'].'">'.
1068 1068
                         Display::return_icon('export_to_documents.png', get_lang('ExportToDocArea'), '', ICON_SIZE_MEDIUM).'</a>';
1069 1069
                 }
1070 1070
 
1071 1071
                 $actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=export_to_pdf&wiki_id='.$row['id'].'">'.
1072
-                    Display::return_icon('pdf.png',get_lang('ExportToPDF'),'',ICON_SIZE_MEDIUM).'</a>';
1072
+                    Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a>';
1073 1073
 
1074 1074
                 $unoconv = api_get_configuration_value('unoconv.binaries');
1075 1075
                 if ($unoconv) {
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
                     )
1123 1123
                 );
1124 1124
 
1125
-            $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>';
1125
+            $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>';
1126 1126
 
1127 1127
             echo Display::panel($pageWiki, $pageTitle, $footerWiki);
1128 1128
         } //end filter visibility
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
 
1147 1147
         # strip all html tags
1148 1148
         $wc = strip_tags($document);
1149
-        $wc = html_entity_decode($wc, ENT_NOQUOTES, 'UTF-8');// TODO:test also old html_entity_decode(utf8_encode($wc))
1149
+        $wc = html_entity_decode($wc, ENT_NOQUOTES, 'UTF-8'); // TODO:test also old html_entity_decode(utf8_encode($wc))
1150 1150
 
1151 1151
         # remove 'words' that don't consist of alphanumerical characters or punctuation. And fix accents and some letters
1152 1152
         $pattern = "#[^(\w|\d|\'|\"|\.|\!|\?|;|,|\\|\/|\-|:|\&|@|á|é|í|ó|ú|à|è|ì|ò|ù|ä|ë|ï|ö|ü|Á|É|Í|Ó|Ú|À|È|Ò|Ù|Ä|Ë|Ï|Ö|Ü|â|ê|î|ô|û|Â|Ê|Î|Ô|Û|ñ|Ñ|ç|Ç)]+#";
@@ -1179,15 +1179,15 @@  discard block
 block discarded – undo
1179 1179
 
1180 1180
         $course_id = api_get_course_int_id();
1181 1181
 
1182
-        $sql='SELECT id FROM '.$tbl_wiki.'
1182
+        $sql = 'SELECT id FROM '.$tbl_wiki.'
1183 1183
               WHERE
1184 1184
                 c_id = '.$course_id.' AND
1185 1185
                 title="'.Database::escape_string($title).'" AND
1186 1186
                 '.$groupfilter.$condition_session.'
1187 1187
               ORDER BY id ASC';
1188
-        $result=Database::query($sql);
1189
-        $cant=Database::num_rows($result);
1190
-        if ($cant>0) {
1188
+        $result = Database::query($sql);
1189
+        $cant = Database::num_rows($result);
1190
+        if ($cant > 0) {
1191 1191
             return true;
1192 1192
         } else {
1193 1193
             return false;
@@ -1269,20 +1269,20 @@  discard block
 block discarded – undo
1269 1269
         $page = $this->page;
1270 1270
 
1271 1271
         $course_id = api_get_course_int_id();
1272
-        $sql='SELECT * FROM '.$tbl_wiki.'
1272
+        $sql = 'SELECT * FROM '.$tbl_wiki.'
1273 1273
               WHERE
1274 1274
                 c_id = '.$course_id.' AND
1275 1275
                 reflink="'.Database::escape_string($page).'" AND
1276 1276
                 '.$groupfilter.$condition_session.'
1277 1277
               ORDER BY id ASC';
1278 1278
 
1279
-        $result=Database::query($sql);
1280
-        $row=Database::fetch_array($result);
1279
+        $result = Database::query($sql);
1280
+        $row = Database::fetch_array($result);
1281 1281
         $status_editlock = $row['editlock'];
1282 1282
         $id = $row['page_id'];
1283 1283
 
1284 1284
         ///change status
1285
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
1285
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
1286 1286
             if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'lock' && $status_editlock == 0) {
1287 1287
                 $status_editlock = 1;
1288 1288
             }
@@ -1294,13 +1294,13 @@  discard block
 block discarded – undo
1294 1294
                     WHERE c_id = '.$course_id.' AND page_id="'.$id.'"';
1295 1295
             Database::query($sql);
1296 1296
 
1297
-            $sql='SELECT * FROM '.$tbl_wiki.'
1297
+            $sql = 'SELECT * FROM '.$tbl_wiki.'
1298 1298
                   WHERE
1299 1299
                     c_id = '.$course_id.' AND
1300 1300
                     reflink="'.Database::escape_string($page).'" AND
1301 1301
                     '.$groupfilter.$condition_session.'
1302 1302
                   ORDER BY id ASC';
1303
-            $result=Database::query($sql);
1303
+            $result = Database::query($sql);
1304 1304
             $row = Database::fetch_array($result);
1305 1305
         }
1306 1306
 
@@ -1331,13 +1331,13 @@  discard block
 block discarded – undo
1331 1331
         $row = Database::fetch_array($result);
1332 1332
         $status_visibility = $row['visibility'];
1333 1333
         //change status
1334
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
1335
-            if (isset($_GET['actionpage']) && $_GET['actionpage']=='visible' && $status_visibility==0) {
1336
-                $status_visibility=1;
1334
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
1335
+            if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'visible' && $status_visibility == 0) {
1336
+                $status_visibility = 1;
1337 1337
 
1338 1338
             }
1339
-            if (isset($_GET['actionpage']) && $_GET['actionpage']=='invisible' && $status_visibility==1) {
1340
-                $status_visibility=0;
1339
+            if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'invisible' && $status_visibility == 1) {
1340
+                $status_visibility = 0;
1341 1341
             }
1342 1342
 
1343 1343
             $sql = 'UPDATE '.$tbl_wiki.' SET visibility="'.Database::escape_string($status_visibility).'"
@@ -1354,12 +1354,12 @@  discard block
 block discarded – undo
1354 1354
                         reflink="'.Database::escape_string($page).'" AND
1355 1355
                         '.$groupfilter.$condition_session.'
1356 1356
                     ORDER BY id ASC';
1357
-            $result=Database::query($sql);
1357
+            $result = Database::query($sql);
1358 1358
             $row = Database::fetch_array($result);
1359 1359
         }
1360 1360
 
1361 1361
         if (empty($row['id'])) {
1362
-            $row['visibility']= 1;
1362
+            $row['visibility'] = 1;
1363 1363
         }
1364 1364
 
1365 1365
         //show status
@@ -1386,18 +1386,18 @@  discard block
 block discarded – undo
1386 1386
                     reflink="'.Database::escape_string($page).'" AND
1387 1387
                     '.$groupfilter.$condition_session.'
1388 1388
                 ORDER BY id ASC';
1389
-        $result=Database::query($sql);
1390
-        $row=Database::fetch_array($result);
1389
+        $result = Database::query($sql);
1390
+        $row = Database::fetch_array($result);
1391 1391
 
1392 1392
         $status_visibility_disc = $row['visibility_disc'];
1393 1393
 
1394 1394
         //change status
1395
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
1396
-            if (isset($_GET['actionpage']) && $_GET['actionpage'] =='showdisc' && $status_visibility_disc==0) {
1397
-                $status_visibility_disc=1;
1395
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
1396
+            if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'showdisc' && $status_visibility_disc == 0) {
1397
+                $status_visibility_disc = 1;
1398 1398
             }
1399
-            if (isset($_GET['actionpage']) && $_GET['actionpage'] =='hidedisc' && $status_visibility_disc==1) {
1400
-                $status_visibility_disc=0;
1399
+            if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'hidedisc' && $status_visibility_disc == 1) {
1400
+                $status_visibility_disc = 0;
1401 1401
             }
1402 1402
 
1403 1403
             $sql = 'UPDATE '.$tbl_wiki.' SET visibility_disc="'.Database::escape_string($status_visibility_disc).'"
@@ -1445,14 +1445,14 @@  discard block
 block discarded – undo
1445 1445
         $result = Database::query($sql);
1446 1446
         $row = Database::fetch_array($result);
1447 1447
 
1448
-        $status_addlock_disc=$row['addlock_disc'];
1448
+        $status_addlock_disc = $row['addlock_disc'];
1449 1449
 
1450 1450
         //change status
1451 1451
         if (api_is_allowed_to_edit() || api_is_platform_admin()) {
1452
-            if (isset($_GET['actionpage']) && $_GET['actionpage'] =='lockdisc' && $status_addlock_disc==0) {
1452
+            if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'lockdisc' && $status_addlock_disc == 0) {
1453 1453
                 $status_addlock_disc = 1;
1454 1454
             }
1455
-            if (isset($_GET['actionpage']) && $_GET['actionpage'] =='unlockdisc' && $status_addlock_disc==1) {
1455
+            if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'unlockdisc' && $status_addlock_disc == 1) {
1456 1456
                 $status_addlock_disc = 0;
1457 1457
             }
1458 1458
 
@@ -1474,8 +1474,8 @@  discard block
 block discarded – undo
1474 1474
                         reflink="'.Database::escape_string($page).'" AND
1475 1475
                         '.$groupfilter.$condition_session.'
1476 1476
                     ORDER BY id ASC';
1477
-            $result=Database::query($sql);
1478
-            $row=Database::fetch_array($result);
1477
+            $result = Database::query($sql);
1478
+            $row = Database::fetch_array($result);
1479 1479
         }
1480 1480
 
1481 1481
         return $row['addlock_disc'];
@@ -1500,17 +1500,17 @@  discard block
 block discarded – undo
1500 1500
                     reflink="'.Database::escape_string($page).'" AND
1501 1501
                     '.$groupfilter.$condition_session.'
1502 1502
                 ORDER BY id ASC';
1503
-        $result=Database::query($sql);
1504
-        $row=Database::fetch_array($result);
1505
-        $status_ratinglock_disc=$row['ratinglock_disc'];
1503
+        $result = Database::query($sql);
1504
+        $row = Database::fetch_array($result);
1505
+        $status_ratinglock_disc = $row['ratinglock_disc'];
1506 1506
 
1507 1507
         //change status
1508
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
1509
-            if (isset($_GET['actionpage']) && $_GET['actionpage'] =='lockrating' && $status_ratinglock_disc==0) {
1510
-                $status_ratinglock_disc=1;
1508
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
1509
+            if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'lockrating' && $status_ratinglock_disc == 0) {
1510
+                $status_ratinglock_disc = 1;
1511 1511
             }
1512
-            if (isset($_GET['actionpage']) && $_GET['actionpage'] =='unlockrating' && $status_ratinglock_disc==1) {
1513
-                $status_ratinglock_disc=0;
1512
+            if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'unlockrating' && $status_ratinglock_disc == 1) {
1513
+                $status_ratinglock_disc = 0;
1514 1514
             }
1515 1515
 
1516 1516
             $sql = 'UPDATE '.$tbl_wiki.'
@@ -1526,14 +1526,14 @@  discard block
 block discarded – undo
1526 1526
             // these three lines remain necessary. They do that by changing the
1527 1527
             // page state is made when you press the button and not have to wait
1528 1528
             // to change his page
1529
-            $sql='SELECT * FROM '.$tbl_wiki.'
1529
+            $sql = 'SELECT * FROM '.$tbl_wiki.'
1530 1530
                   WHERE
1531 1531
                     c_id = '.$course_id.' AND
1532 1532
                     reflink="'.Database::escape_string($page).'" AND
1533 1533
                     '.$groupfilter.$condition_session.'
1534 1534
                   ORDER BY id ASC';
1535
-            $result=Database::query($sql);
1536
-            $row=Database::fetch_array($result);
1535
+            $result = Database::query($sql);
1536
+            $row = Database::fetch_array($result);
1537 1537
         }
1538 1538
 
1539 1539
         return $row['ratinglock_disc'];
@@ -1558,24 +1558,24 @@  discard block
 block discarded – undo
1558 1558
         $sql = 'SELECT * FROM '.$tbl_wiki.'
1559 1559
                 WHERE c_id = '.$course_id.' AND reflink="'.$reflink.'" AND '.$groupfilter.$condition_session.'
1560 1560
                 ORDER BY id ASC';
1561
-        $result=Database::query($sql);
1562
-        $row=Database::fetch_array($result);
1561
+        $result = Database::query($sql);
1562
+        $row = Database::fetch_array($result);
1563 1563
         $id = $row['id'];
1564
-        $sql='SELECT * FROM '.$tbl_wiki_mailcue.'
1564
+        $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
1565 1565
               WHERE c_id = '.$course_id.' AND id="'.$id.'" AND user_id="'.api_get_user_id().'" AND type="P"';
1566
-        $result=Database::query($sql);
1567
-        $row=Database::fetch_array($result);
1566
+        $result = Database::query($sql);
1567
+        $row = Database::fetch_array($result);
1568 1568
 
1569 1569
         $idm = $row['id'];
1570 1570
 
1571 1571
         if (empty($idm)) {
1572
-            $status_notify=0;
1572
+            $status_notify = 0;
1573 1573
         } else {
1574
-            $status_notify=1;
1574
+            $status_notify = 1;
1575 1575
         }
1576 1576
 
1577 1577
         // Change status
1578
-        if (isset($_GET['actionpage']) && $_GET['actionpage'] =='locknotify' && $status_notify==0) {
1578
+        if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'locknotify' && $status_notify == 0) {
1579 1579
             $sql = "SELECT id FROM $tbl_wiki_mailcue
1580 1580
                     WHERE c_id = $course_id AND id = $id AND user_id = $userId";
1581 1581
             $result = Database::query($sql);
@@ -1584,18 +1584,18 @@  discard block
 block discarded – undo
1584 1584
                 $exist = true;
1585 1585
             }
1586 1586
             if ($exist == false) {
1587
-                $sql="INSERT INTO ".$tbl_wiki_mailcue." (c_id, id, user_id, type, group_id, session_id) VALUES
1587
+                $sql = "INSERT INTO ".$tbl_wiki_mailcue." (c_id, id, user_id, type, group_id, session_id) VALUES
1588 1588
                 ($course_id, '".$id."','".api_get_user_id()."','P','".$groupId."','".$session_id."')";
1589 1589
                 Database::query($sql);
1590 1590
             }
1591
-            $status_notify=1;
1591
+            $status_notify = 1;
1592 1592
         }
1593 1593
 
1594
-        if (isset($_GET['actionpage']) && $_GET['actionpage'] =='unlocknotify' && $status_notify==1) {
1594
+        if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'unlocknotify' && $status_notify == 1) {
1595 1595
             $sql = 'DELETE FROM '.$tbl_wiki_mailcue.'
1596 1596
                     WHERE id="'.$id.'" AND user_id="'.api_get_user_id().'" AND type="P" AND c_id = '.$course_id;
1597 1597
             Database::query($sql);
1598
-            $status_notify=0;
1598
+            $status_notify = 0;
1599 1599
         }
1600 1600
 
1601 1601
         return $status_notify;
@@ -1621,9 +1621,9 @@  discard block
 block discarded – undo
1621 1621
         $sql = 'SELECT * FROM '.$tbl_wiki.'
1622 1622
                 WHERE c_id = '.$course_id.' AND reflink="'.$reflink.'" AND '.$groupfilter.$condition_session.'
1623 1623
                 ORDER BY id ASC';
1624
-        $result=Database::query($sql);
1625
-        $row=Database::fetch_array($result);
1626
-        $id=$row['id'];
1624
+        $result = Database::query($sql);
1625
+        $row = Database::fetch_array($result);
1626
+        $id = $row['id'];
1627 1627
         $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
1628 1628
                 WHERE c_id = '.$course_id.' AND id="'.$id.'" AND user_id="'.api_get_user_id().'" AND type="D"';
1629 1629
         $result = Database::query($sql);
@@ -1631,23 +1631,23 @@  discard block
 block discarded – undo
1631 1631
         $idm = $row['id'];
1632 1632
 
1633 1633
         if (empty($idm)) {
1634
-            $status_notify_disc=0;
1634
+            $status_notify_disc = 0;
1635 1635
         } else {
1636
-            $status_notify_disc=1;
1636
+            $status_notify_disc = 1;
1637 1637
         }
1638 1638
 
1639 1639
         //change status
1640
-        if (isset($_GET['actionpage']) && $_GET['actionpage'] =='locknotifydisc' && $status_notify_disc==0) {
1641
-            $sql="INSERT INTO ".$tbl_wiki_mailcue." (c_id, id, user_id, type, group_id, session_id) VALUES
1640
+        if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'locknotifydisc' && $status_notify_disc == 0) {
1641
+            $sql = "INSERT INTO ".$tbl_wiki_mailcue." (c_id, id, user_id, type, group_id, session_id) VALUES
1642 1642
             ($course_id, '".$id."','".api_get_user_id()."','D','".$groupId."','".$session_id."')";
1643 1643
             Database::query($sql);
1644
-            $status_notify_disc=1;
1644
+            $status_notify_disc = 1;
1645 1645
         }
1646
-        if (isset($_GET['actionpage']) && $_GET['actionpage'] =='unlocknotifydisc' && $status_notify_disc==1) {
1646
+        if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'unlocknotifydisc' && $status_notify_disc == 1) {
1647 1647
             $sql = 'DELETE FROM '.$tbl_wiki_mailcue.'
1648 1648
                     WHERE c_id = '.$course_id.' AND id="'.$id.'" AND user_id="'.api_get_user_id().'" AND type="D" AND c_id = '.$course_id;
1649 1649
             Database::query($sql);
1650
-            $status_notify_disc=0;
1650
+            $status_notify_disc = 0;
1651 1651
         }
1652 1652
 
1653 1653
         return $status_notify_disc;
@@ -1662,7 +1662,7 @@  discard block
 block discarded – undo
1662 1662
         $tbl_wiki_mailcue = $this->tbl_wiki_mailcue;
1663 1663
         $course_id = api_get_course_int_id();
1664 1664
         $groupId = api_get_group_id();
1665
-        $session_id=api_get_session_id();
1665
+        $session_id = api_get_session_id();
1666 1666
 
1667 1667
         $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
1668 1668
                 WHERE
@@ -1671,31 +1671,31 @@  discard block
 block discarded – undo
1671 1671
                     type="F" AND
1672 1672
                     group_id="'.$groupId.'" AND
1673 1673
                     session_id="'.$session_id.'"';
1674
-        $result=Database::query($sql);
1675
-        $row=Database::fetch_array($result);
1674
+        $result = Database::query($sql);
1675
+        $row = Database::fetch_array($result);
1676 1676
 
1677
-        $idm=$row['user_id'];
1677
+        $idm = $row['user_id'];
1678 1678
 
1679 1679
         if (empty($idm)) {
1680
-            $status_notify_all=0;
1680
+            $status_notify_all = 0;
1681 1681
         } else {
1682
-            $status_notify_all=1;
1682
+            $status_notify_all = 1;
1683 1683
         }
1684 1684
 
1685 1685
         //change status
1686
-        if (isset($_GET['actionpage']) && $_GET['actionpage'] =='locknotifyall' && $status_notify_all==0) {
1687
-            $sql="INSERT INTO ".$tbl_wiki_mailcue." (c_id, user_id, type, group_id, session_id) VALUES
1686
+        if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'locknotifyall' && $status_notify_all == 0) {
1687
+            $sql = "INSERT INTO ".$tbl_wiki_mailcue." (c_id, user_id, type, group_id, session_id) VALUES
1688 1688
             ($course_id, '".api_get_user_id()."','F','".$groupId."','".$session_id."')";
1689 1689
             Database::query($sql);
1690
-            $status_notify_all=1;
1690
+            $status_notify_all = 1;
1691 1691
         }
1692 1692
 
1693 1693
         if (isset($_GET['actionpage']) &&
1694 1694
             isset($_GET['actionpage']) &&
1695
-            $_GET['actionpage']  =='unlocknotifyall' &&
1695
+            $_GET['actionpage'] == 'unlocknotifyall' &&
1696 1696
             $status_notify_all == 1
1697 1697
         ) {
1698
-            $sql ='DELETE FROM '.$tbl_wiki_mailcue.'
1698
+            $sql = 'DELETE FROM '.$tbl_wiki_mailcue.'
1699 1699
                    WHERE
1700 1700
                     c_id = '.$course_id.' AND
1701 1701
                     user_id="'.api_get_user_id().'" AND
@@ -1704,7 +1704,7 @@  discard block
 block discarded – undo
1704 1704
                     session_id="'.$session_id.'" AND
1705 1705
                     c_id = '.$course_id;
1706 1706
             Database::query($sql);
1707
-            $status_notify_all=0;
1707
+            $status_notify_all = 0;
1708 1708
         }
1709 1709
 
1710 1710
         //show status
@@ -1714,7 +1714,7 @@  discard block
 block discarded – undo
1714 1714
     /**
1715 1715
      * Sends pending e-mails
1716 1716
      */
1717
-    public function check_emailcue($id_or_ref, $type, $lastime='', $lastuser='')
1717
+    public function check_emailcue($id_or_ref, $type, $lastime = '', $lastuser = '')
1718 1718
     {
1719 1719
         $tbl_wiki_mailcue = $this->tbl_wiki_mailcue;
1720 1720
         $tbl_wiki = $this->tbl_wiki;
@@ -1722,14 +1722,14 @@  discard block
 block discarded – undo
1722 1722
         $groupfilter = $this->groupfilter;
1723 1723
         $_course = $this->courseInfo;
1724 1724
         $groupId = api_get_group_id();
1725
-        $session_id=api_get_session_id();
1725
+        $session_id = api_get_session_id();
1726 1726
         $course_id = api_get_course_int_id();
1727 1727
 
1728
-        $group_properties  = GroupManager :: get_group_properties($groupId);
1728
+        $group_properties = GroupManager :: get_group_properties($groupId);
1729 1729
         $group_name = $group_properties['name'];
1730 1730
         $allow_send_mail = false; //define the variable to below
1731 1731
         $email_assignment = null;
1732
-        if ($type=='P') {
1732
+        if ($type == 'P') {
1733 1733
             //if modifying a wiki page
1734 1734
             //first, current author and time
1735 1735
             //Who is the author?
@@ -1740,22 +1740,22 @@  discard block
 block discarded – undo
1740 1740
             $year = substr($lastime, 0, 4);
1741 1741
             $month = substr($lastime, 5, 2);
1742 1742
             $day = substr($lastime, 8, 2);
1743
-            $hours=substr($lastime, 11,2);
1744
-            $minutes=substr($lastime, 14,2);
1745
-            $seconds=substr($lastime, 17,2);
1746
-            $email_date_changes=$day.' '.$month.' '.$year.' '.$hours.":".$minutes.":".$seconds;
1743
+            $hours = substr($lastime, 11, 2);
1744
+            $minutes = substr($lastime, 14, 2);
1745
+            $seconds = substr($lastime, 17, 2);
1746
+            $email_date_changes = $day.' '.$month.' '.$year.' '.$hours.":".$minutes.":".$seconds;
1747 1747
 
1748 1748
             //second, extract data from first reg
1749 1749
             $sql = 'SELECT * FROM '.$tbl_wiki.'
1750 1750
                     WHERE  c_id = '.$course_id.' AND reflink="'.$id_or_ref.'" AND '.$groupfilter.$condition_session.'
1751 1751
                     ORDER BY id ASC';
1752
-            $result=Database::query($sql);
1753
-            $row=Database::fetch_array($result);
1752
+            $result = Database::query($sql);
1753
+            $row = Database::fetch_array($result);
1754 1754
 
1755
-            $id=$row['id'];
1756
-            $email_page_name=$row['title'];
1757
-            if ($row['visibility']==1) {
1758
-                $allow_send_mail=true; //if visibility off - notify off
1755
+            $id = $row['id'];
1756
+            $email_page_name = $row['title'];
1757
+            if ($row['visibility'] == 1) {
1758
+                $allow_send_mail = true; //if visibility off - notify off
1759 1759
                 $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
1760 1760
                         WHERE
1761 1761
                             c_id = '.$course_id.' AND
@@ -1765,10 +1765,10 @@  discard block
 block discarded – undo
1765 1765
                             group_id="'.$groupId.'" AND
1766 1766
                             session_id="'.$session_id.'"';
1767 1767
                 //type: P=page, D=discuss, F=full.
1768
-                $result=Database::query($sql);
1769
-                $emailtext=get_lang('EmailWikipageModified').' <strong>'.$email_page_name.'</strong> '.get_lang('Wiki');
1768
+                $result = Database::query($sql);
1769
+                $emailtext = get_lang('EmailWikipageModified').' <strong>'.$email_page_name.'</strong> '.get_lang('Wiki');
1770 1770
             }
1771
-        } elseif ($type=='D') {
1771
+        } elseif ($type == 'D') {
1772 1772
             //if added a post to discuss
1773 1773
 
1774 1774
             //first, current author and time
@@ -1780,25 +1780,25 @@  discard block
 block discarded – undo
1780 1780
             $year = substr($lastime, 0, 4);
1781 1781
             $month = substr($lastime, 5, 2);
1782 1782
             $day = substr($lastime, 8, 2);
1783
-            $hours=substr($lastime, 11,2);
1784
-            $minutes=substr($lastime, 14,2);
1785
-            $seconds=substr($lastime, 17,2);
1786
-            $email_date_changes=$day.' '.$month.' '.$year.' '.$hours.":".$minutes.":".$seconds;
1783
+            $hours = substr($lastime, 11, 2);
1784
+            $minutes = substr($lastime, 14, 2);
1785
+            $seconds = substr($lastime, 17, 2);
1786
+            $email_date_changes = $day.' '.$month.' '.$year.' '.$hours.":".$minutes.":".$seconds;
1787 1787
 
1788 1788
             //second, extract data from first reg
1789 1789
 
1790
-            $id=$id_or_ref; //$id_or_ref is id from tblwiki
1790
+            $id = $id_or_ref; //$id_or_ref is id from tblwiki
1791 1791
 
1792 1792
             $sql = 'SELECT * FROM '.$tbl_wiki.'
1793 1793
                     WHERE c_id = '.$course_id.' AND id="'.$id.'"
1794 1794
                     ORDER BY id ASC';
1795 1795
 
1796
-            $result=Database::query($sql);
1797
-            $row=Database::fetch_array($result);
1796
+            $result = Database::query($sql);
1797
+            $row = Database::fetch_array($result);
1798 1798
 
1799
-            $email_page_name=$row['title'];
1800
-            if ($row['visibility_disc']==1) {
1801
-                $allow_send_mail=true; //if visibility off - notify off
1799
+            $email_page_name = $row['title'];
1800
+            if ($row['visibility_disc'] == 1) {
1801
+                $allow_send_mail = true; //if visibility off - notify off
1802 1802
                 $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
1803 1803
                         WHERE
1804 1804
                             c_id = '.$course_id.' AND
@@ -1809,22 +1809,22 @@  discard block
 block discarded – undo
1809 1809
                             session_id="'.$session_id.'"';
1810 1810
                 //type: P=page, D=discuss, F=full
1811 1811
                 $result = Database::query($sql);
1812
-                $emailtext=get_lang('EmailWikiPageDiscAdded').' <strong>'.$email_page_name.'</strong> '.get_lang('Wiki');
1812
+                $emailtext = get_lang('EmailWikiPageDiscAdded').' <strong>'.$email_page_name.'</strong> '.get_lang('Wiki');
1813 1813
             }
1814
-        } elseif($type=='A') {
1814
+        } elseif ($type == 'A') {
1815 1815
             //for added pages
1816
-            $id=0; //for tbl_wiki_mailcue
1816
+            $id = 0; //for tbl_wiki_mailcue
1817 1817
             $sql = 'SELECT * FROM '.$tbl_wiki.'
1818 1818
                     WHERE c_id = '.$course_id.'
1819 1819
                     ORDER BY id DESC'; //the added is always the last
1820 1820
 
1821
-            $result=Database::query($sql);
1822
-            $row=Database::fetch_array($result);
1823
-            $email_page_name=$row['title'];
1821
+            $result = Database::query($sql);
1822
+            $row = Database::fetch_array($result);
1823
+            $email_page_name = $row['title'];
1824 1824
 
1825 1825
             //Who is the author?
1826 1826
             $userinfo = api_get_user_info($row['user_id']);
1827
-            $email_user_author= get_lang('AddedBy').': '.$userinfo['complete_name'];
1827
+            $email_user_author = get_lang('AddedBy').': '.$userinfo['complete_name'];
1828 1828
 
1829 1829
             //When ?
1830 1830
             $year = substr($row['dtime'], 0, 4);
@@ -1833,33 +1833,33 @@  discard block
 block discarded – undo
1833 1833
             $hours = substr($row['dtime'], 11, 2);
1834 1834
             $minutes = substr($row['dtime'], 14, 2);
1835 1835
             $seconds = substr($row['dtime'], 17, 2);
1836
-            $email_date_changes=$day.' '.$month.' '.$year.' '.$hours.":".$minutes.":".$seconds;
1837
-
1838
-            if($row['assignment']==0) {
1839
-                $allow_send_mail=true;
1840
-            } elseif($row['assignment']==1) {
1841
-                $email_assignment=get_lang('AssignmentDescExtra').' ('.get_lang('AssignmentMode').')';
1842
-                $allow_send_mail=true;
1843
-            } elseif($row['assignment']==2) {
1844
-                $allow_send_mail=false; //Mode tasks: avoids notifications to all users about all users
1836
+            $email_date_changes = $day.' '.$month.' '.$year.' '.$hours.":".$minutes.":".$seconds;
1837
+
1838
+            if ($row['assignment'] == 0) {
1839
+                $allow_send_mail = true;
1840
+            } elseif ($row['assignment'] == 1) {
1841
+                $email_assignment = get_lang('AssignmentDescExtra').' ('.get_lang('AssignmentMode').')';
1842
+                $allow_send_mail = true;
1843
+            } elseif ($row['assignment'] == 2) {
1844
+                $allow_send_mail = false; //Mode tasks: avoids notifications to all users about all users
1845 1845
             }
1846 1846
 
1847 1847
             $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
1848 1848
                     WHERE c_id = '.$course_id.' AND  id="'.$id.'" AND type="F" AND group_id="'.$groupId.'" AND session_id="'.$session_id.'"';
1849 1849
             //type: P=page, D=discuss, F=full
1850
-            $result=Database::query($sql);
1850
+            $result = Database::query($sql);
1851 1851
 
1852
-            $emailtext = get_lang('EmailWikiPageAdded').' <strong>'.$email_page_name.'</strong> '.get_lang('In').' '. get_lang('Wiki');
1853
-        } elseif ($type=='E') {
1854
-            $id=0;
1855
-            $allow_send_mail=true;
1852
+            $emailtext = get_lang('EmailWikiPageAdded').' <strong>'.$email_page_name.'</strong> '.get_lang('In').' '.get_lang('Wiki');
1853
+        } elseif ($type == 'E') {
1854
+            $id = 0;
1855
+            $allow_send_mail = true;
1856 1856
 
1857 1857
             //Who is the author?
1858
-            $userinfo = api_get_user_info(api_get_user_id());	//current user
1858
+            $userinfo = api_get_user_info(api_get_user_id()); //current user
1859 1859
             $email_user_author = get_lang('DeletedBy').': '.$userinfo['complete_name'];
1860 1860
             //When ?
1861
-            $today = date('r');		//current time
1862
-            $email_date_changes=$today;
1861
+            $today = date('r'); //current time
1862
+            $email_date_changes = $today;
1863 1863
 
1864 1864
             $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
1865 1865
                     WHERE
@@ -1873,16 +1873,16 @@  discard block
 block discarded – undo
1873 1873
         ///make and send email
1874 1874
         if ($allow_send_mail) {
1875 1875
             while ($row = Database::fetch_array($result)) {
1876
-                $userinfo = api_get_user_info($row['user_id']);	//$row['user_id'] obtained from tbl_wiki_mailcue
1876
+                $userinfo = api_get_user_info($row['user_id']); //$row['user_id'] obtained from tbl_wiki_mailcue
1877 1877
                 $name_to = $userinfo['complete_name'];
1878 1878
                 $email_to = $userinfo['email'];
1879 1879
                 $sender_name = api_get_setting('emailAdministrator');
1880 1880
                 $sender_email = api_get_setting('emailAdministrator');
1881 1881
                 $email_subject = get_lang('EmailWikiChanges').' - '.$_course['official_code'];
1882 1882
                 $email_body = get_lang('DearUser').' '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).',<br /><br />';
1883
-                if($session_id==0){
1883
+                if ($session_id == 0) {
1884 1884
                     $email_body .= $emailtext.' <strong>'.$_course['name'].' - '.$group_name.'</strong><br /><br /><br />';
1885
-                }else{
1885
+                } else {
1886 1886
                     $email_body .= $emailtext.' <strong>'.$_course['name'].' ('.api_get_session_name(api_get_session_id()).') - '.$group_name.'</strong><br /><br /><br />';
1887 1887
                 }
1888 1888
                 $email_body .= $email_user_author.' ('.$email_date_changes.')<br /><br /><br />';
@@ -1960,23 +1960,23 @@  discard block
 block discarded – undo
1960 1960
             $template);
1961 1961
 
1962 1962
         if (0 != $groupId) {
1963
-            $groupPart = '_group' . $groupId; // and add groupId to put the same document title in different groups
1964
-            $group_properties  = GroupManager :: get_group_properties($groupId);
1963
+            $groupPart = '_group'.$groupId; // and add groupId to put the same document title in different groups
1964
+            $group_properties = GroupManager :: get_group_properties($groupId);
1965 1965
             $groupPath = $group_properties['directory'];
1966 1966
         } else {
1967 1967
             $groupPart = '';
1968
-            $groupPath ='';
1968
+            $groupPath = '';
1969 1969
         }
1970 1970
 
1971
-        $exportDir = api_get_path(SYS_COURSE_PATH).api_get_course_path(). '/document'.$groupPath;
1972
-        $exportFile = api_replace_dangerous_char($wikiTitle) . $groupPart;
1971
+        $exportDir = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/document'.$groupPath;
1972
+        $exportFile = api_replace_dangerous_char($wikiTitle).$groupPart;
1973 1973
         $wikiContents = trim(preg_replace("/\[[\[]?([^\]|]*)[|]?([^|\]]*)\][\]]?/", "$1", $wikiContents));
1974 1974
         //TODO: put link instead of title
1975 1975
 
1976 1976
         $wikiContents = str_replace('{CONTENT}', $wikiContents, $template);
1977 1977
 
1978 1978
         // replace relative path by absolute path for courses, so you can see items into this page wiki (images, mp3, etc..) exported in documents
1979
-        if (api_strpos($wikiContents,'../..'.api_get_path(REL_COURSE_PATH)) !== false) {
1979
+        if (api_strpos($wikiContents, '../..'.api_get_path(REL_COURSE_PATH)) !== false) {
1980 1980
             $web_course_path = api_get_path(WEB_COURSE_PATH);
1981 1981
             $wikiContents = str_replace('../..'.api_get_path(REL_COURSE_PATH), $web_course_path, $wikiContents);
1982 1982
         }
@@ -1987,8 +1987,8 @@  discard block
 block discarded – undo
1987 1987
             $i++;
1988 1988
         }
1989 1989
 
1990
-        $wikiFileName = $exportFile . '_' . $i . '.html';
1991
-        $exportPath = $exportDir . '/' . $wikiFileName;
1990
+        $wikiFileName = $exportFile.'_'.$i.'.html';
1991
+        $exportPath = $exportDir.'/'.$wikiFileName;
1992 1992
 
1993 1993
         file_put_contents($exportPath, $wikiContents);
1994 1994
         $doc_id = add_document(
@@ -2033,14 +2033,14 @@  discard block
 block discarded – undo
2033 2033
         $content_pdf = api_html_entity_decode($data['content'], ENT_QUOTES, api_get_system_encoding());
2034 2034
 
2035 2035
         //clean wiki links
2036
-        $content_pdf=trim(preg_replace("/\[[\[]?([^\]|]*)[|]?([^|\]]*)\][\]]?/", "$1", $content_pdf));
2036
+        $content_pdf = trim(preg_replace("/\[[\[]?([^\]|]*)[|]?([^|\]]*)\][\]]?/", "$1", $content_pdf));
2037 2037
         //TODO: It should be better to display the link insted of the tile but it is hard for [[title]] links
2038 2038
 
2039 2039
         $title_pdf = api_html_entity_decode($data['title'], ENT_QUOTES, api_get_system_encoding());
2040 2040
         $title_pdf = api_utf8_encode($title_pdf, api_get_system_encoding());
2041 2041
         $content_pdf = api_utf8_encode($content_pdf, api_get_system_encoding());
2042 2042
 
2043
-        $html='
2043
+        $html = '
2044 2044
         <!-- defines the headers/footers - this must occur before the headers/footers are set -->
2045 2045
 
2046 2046
         <!--mpdf
@@ -2098,9 +2098,9 @@  discard block
 block discarded – undo
2098 2098
         $session_id = $this->session_id;
2099 2099
         $groupId = api_get_group_id();
2100 2100
 
2101
-        if ($groupId==0) {
2101
+        if ($groupId == 0) {
2102 2102
             //extract course members
2103
-            if(!empty($session_id)) {
2103
+            if (!empty($session_id)) {
2104 2104
                 $a_users_to_add = CourseManager::get_user_list_from_course_code(api_get_course_id(), $session_id);
2105 2105
             } else {
2106 2106
                 $a_users_to_add = CourseManager::get_user_list_from_course_code(api_get_course_id(), 0);
@@ -2126,7 +2126,7 @@  discard block
 block discarded – undo
2126 2126
         $username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username'], ENT_QUOTES));
2127 2127
         $name = $userinfo['complete_name']." - ".$username;
2128 2128
 
2129
-        $photo = '<img src="' . $userinfo['avatar'] . '" alt="' . $name . '"  width="40" height="50" align="top" title="' . $name . '"  />';
2129
+        $photo = '<img src="'.$userinfo['avatar'].'" alt="'.$name.'"  width="40" height="50" align="top" title="'.$name.'"  />';
2130 2130
 
2131 2131
         // teacher assignment title
2132 2132
         $title_orig = $values['title'];
@@ -2156,24 +2156,24 @@  discard block
 block discarded – undo
2156 2156
                 $userPicture = UserManager::getUserPicture($assig_user_id);
2157 2157
                 $username = api_htmlentities(sprintf(get_lang('LoginX'), $o_user_to_add['username'], ENT_QUOTES));
2158 2158
                 $name = api_get_person_name($o_user_to_add['firstname'], $o_user_to_add['lastname'])." . ".$username;
2159
-                $photo= '<img src="'.$userPicture.'" alt="'.$name.'"  width="40" height="50" align="bottom" title="'.$name.'"  />';
2159
+                $photo = '<img src="'.$userPicture.'" alt="'.$name.'"  width="40" height="50" align="bottom" title="'.$name.'"  />';
2160 2160
 
2161 2161
                 $is_tutor_of_group = GroupManager::is_tutor_of_group($assig_user_id, $groupId); //student is tutor
2162 2162
                 $is_tutor_and_member = GroupManager::is_tutor_of_group($assig_user_id, $groupId) && GroupManager::is_subscribed($assig_user_id, $groupId);
2163 2163
                 // student is tutor and member
2164 2164
 
2165 2165
                 if ($is_tutor_and_member) {
2166
-                    $status_in_group=get_lang('GroupTutorAndMember');
2166
+                    $status_in_group = get_lang('GroupTutorAndMember');
2167 2167
                 } else {
2168
-                    if($is_tutor_of_group) {
2169
-                        $status_in_group=get_lang('GroupTutor');
2168
+                    if ($is_tutor_of_group) {
2169
+                        $status_in_group = get_lang('GroupTutor');
2170 2170
                     } else {
2171
-                        $status_in_group=" "; //get_lang('GroupStandardMember')
2171
+                        $status_in_group = " "; //get_lang('GroupStandardMember')
2172 2172
                     }
2173 2173
                 }
2174 2174
 
2175
-                if ($assignment_type==1) {
2176
-                    $values['title']= $title_orig;
2175
+                if ($assignment_type == 1) {
2176
+                    $values['title'] = $title_orig;
2177 2177
                     $values['content'] = '<div align="center" style="background-color: #F5F8FB; border:solid; border-color: #E6E6E6">
2178 2178
                     <table border="0">
2179 2179
                     <tr><td style="font-size:24px">'.get_lang('AssignmentWork').'</td></tr>
@@ -2189,7 +2189,7 @@  discard block
 block discarded – undo
2189 2189
                         ).
2190 2190
                         ' [['.Security::remove_XSS($_POST['title'])."_uass".$assig_user_id.' | '.$photo.']] '.$status_in_group.'</li>';
2191 2191
                     //don't change this line without guaranteeing that users will be ordered by last names in the following format (surname, name)
2192
-                    $values['assignment']=2;
2192
+                    $values['assignment'] = 2;
2193 2193
                 }
2194 2194
                 $this->assig_user_id = $assig_user_id;
2195 2195
                 self::save_new_wiki($values);
@@ -2198,12 +2198,12 @@  discard block
 block discarded – undo
2198 2198
 
2199 2199
         foreach ($a_users_to_add as $o_user_to_add) {
2200 2200
             if ($o_user_to_add['user_id'] == $userId) {
2201
-                $assig_user_id=$o_user_to_add['user_id'];
2201
+                $assig_user_id = $o_user_to_add['user_id'];
2202 2202
                 if ($assignment_type == 1) {
2203
-                    $values['title']= $title_orig;
2204
-                    $values['comment']=get_lang('AssignmentDesc');
2203
+                    $values['title'] = $title_orig;
2204
+                    $values['comment'] = get_lang('AssignmentDesc');
2205 2205
                     sort($all_students_pages);
2206
-                    $values['content']=$content_orig_A.$content_orig_B.'<br/>
2206
+                    $values['content'] = $content_orig_A.$content_orig_B.'<br/>
2207 2207
                     <div align="center" style="font-size:18px; background-color: #F5F8FB; border:solid; border-color:#E6E6E6">
2208 2208
                     '.get_lang('AssignmentLinkstoStudentsPage').'
2209 2209
                     </div><br/>
@@ -2211,7 +2211,7 @@  discard block
 block discarded – undo
2211 2211
                     <ol>'.implode($all_students_pages).'</ol>
2212 2212
                     </div>
2213 2213
                     <br/>';
2214
-                    $values['assignment']=1;
2214
+                    $values['assignment'] = 1;
2215 2215
                 }
2216 2216
                 $this->assig_user_id = $assig_user_id;
2217 2217
                 self::save_new_wiki($values);
@@ -2225,7 +2225,7 @@  discard block
 block discarded – undo
2225 2225
      * @param   int     Whether to search the contents (1) or just the titles (0)
2226 2226
      * @param int
2227 2227
      */
2228
-    public function display_wiki_search_results($search_term, $search_content=0, $all_vers=0)
2228
+    public function display_wiki_search_results($search_term, $search_content = 0, $all_vers = 0)
2229 2229
     {
2230 2230
         $tbl_wiki = $this->tbl_wiki;
2231 2231
         $condition_session = $this->condition_session;
@@ -2237,9 +2237,9 @@  discard block
 block discarded – undo
2237 2237
         echo '</legend>';
2238 2238
 
2239 2239
         //only by professors when page is hidden
2240
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
2241
-            if ($all_vers=='1') {
2242
-                if ($search_content=='1') {
2240
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
2241
+            if ($all_vers == '1') {
2242
+                if ($search_content == '1') {
2243 2243
                     $sql = "SELECT * FROM ".$tbl_wiki."
2244 2244
                             WHERE
2245 2245
                                 c_id = $course_id AND
@@ -2256,7 +2256,7 @@  discard block
 block discarded – undo
2256 2256
                     //search all pages and all versions
2257 2257
                 }
2258 2258
             } else {
2259
-                if ($search_content=='1') {
2259
+                if ($search_content == '1') {
2260 2260
                     $sql = "SELECT * FROM ".$tbl_wiki." s1
2261 2261
                             WHERE
2262 2262
                                 s1.c_id = $course_id AND
@@ -2307,7 +2307,7 @@  discard block
 block discarded – undo
2307 2307
                     //search all pages and all versions
2308 2308
                 }
2309 2309
             } else {
2310
-                if($search_content=='1') {
2310
+                if ($search_content == '1') {
2311 2311
                     $sql = "SELECT * FROM ".$tbl_wiki." s1
2312 2312
                             WHERE
2313 2313
                                 s1.c_id = $course_id AND
@@ -2355,17 +2355,17 @@  discard block
 block discarded – undo
2355 2355
                 $seconds = substr($obj->dtime, 17, 2);
2356 2356
 
2357 2357
                 //get type assignment icon
2358
-                if($obj->assignment==1) {
2359
-                    $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL);
2360
-                } elseif ($obj->assignment==2) {
2361
-                    $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
2362
-                } elseif ($obj->assignment==0) {
2358
+                if ($obj->assignment == 1) {
2359
+                    $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL);
2360
+                } elseif ($obj->assignment == 2) {
2361
+                    $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
2362
+                } elseif ($obj->assignment == 0) {
2363 2363
                     $ShowAssignment = Display::return_icon('px_transparent.gif');
2364 2364
                 }
2365 2365
                 $row = array();
2366 2366
                 $row[] = $ShowAssignment;
2367 2367
 
2368
-                if($all_vers=='1') {
2368
+                if ($all_vers == '1') {
2369 2369
                     $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'])).'">'.
2370 2370
                         api_htmlentities($obj->title).'</a>';
2371 2371
                 } else {
@@ -2376,21 +2376,21 @@  discard block
 block discarded – undo
2376 2376
                 $row[] = ($obj->user_id != 0 && $userinfo !== false) ? UserManager::getUserProfileLink($userinfo) : get_lang('Anonymous').' ('.$obj->user_ip.')';
2377 2377
                 $row[] = $year.'-'.$month.'-'.$day.' '.$hours.":".$minutes.":".$seconds;
2378 2378
 
2379
-                if ($all_vers=='1') {
2379
+                if ($all_vers == '1') {
2380 2380
                     $row[] = $obj->version;
2381 2381
                 } else {
2382 2382
                     $showdelete = '';
2383
-                    if (api_is_allowed_to_edit(false,true)|| api_is_platform_admin()) {
2384
-                        $showdelete=' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete&title='.api_htmlentities(urlencode($obj->reflink)).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
2385
-                            Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL);
2383
+                    if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
2384
+                        $showdelete = ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete&title='.api_htmlentities(urlencode($obj->reflink)).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
2385
+                            Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
2386 2386
                     }
2387 2387
                     $row[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit&title='.api_htmlentities(urlencode($obj->reflink)).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
2388
-                        Display::return_icon('edit.png', get_lang('EditPage'),'',ICON_SIZE_SMALL).'</a>
2388
+                        Display::return_icon('edit.png', get_lang('EditPage'), '', ICON_SIZE_SMALL).'</a>
2389 2389
                         <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']).'">'.
2390
-                        Display::return_icon('discuss.png', get_lang('Discuss'),'',ICON_SIZE_SMALL).'</a>
2390
+                        Display::return_icon('discuss.png', get_lang('Discuss'), '', ICON_SIZE_SMALL).'</a>
2391 2391
                         <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']).'">'.
2392
-                        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']).'">'.
2393
-                        Display::return_icon('what_link_here.png', get_lang('LinksPages'),'',ICON_SIZE_SMALL).'</a>'.$showdelete;
2392
+                        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']).'">'.
2393
+                        Display::return_icon('what_link_here.png', get_lang('LinksPages'), '', ICON_SIZE_SMALL).'</a>'.$showdelete;
2394 2394
                 }
2395 2395
                 $rows[] = $row;
2396 2396
             }
@@ -2415,16 +2415,16 @@  discard block
 block discarded – undo
2415 2415
                     'all_vers' => $all_vers,
2416 2416
                 )
2417 2417
             );
2418
-            $table->set_header(0,get_lang('Type'), true, array ('style' => 'width:30px;'));
2419
-            $table->set_header(1,get_lang('Title'), true);
2418
+            $table->set_header(0, get_lang('Type'), true, array('style' => 'width:30px;'));
2419
+            $table->set_header(1, get_lang('Title'), true);
2420 2420
             if ($all_vers == '1') {
2421
-                $table->set_header(2,get_lang('Author'), true);
2422
-                $table->set_header(3,get_lang('Date'), true);
2423
-                $table->set_header(4,get_lang('Version'), true);
2421
+                $table->set_header(2, get_lang('Author'), true);
2422
+                $table->set_header(3, get_lang('Date'), true);
2423
+                $table->set_header(4, get_lang('Version'), true);
2424 2424
             } else {
2425
-                $table->set_header(2,get_lang('Author').' ('.get_lang('LastVersion').')', true);
2426
-                $table->set_header(3,get_lang('Date').' ('.get_lang('LastVersion').')', true);
2427
-                $table->set_header(4,get_lang('Actions'), false, array ('style' => 'width:130px;'));
2425
+                $table->set_header(2, get_lang('Author').' ('.get_lang('LastVersion').')', true);
2426
+                $table->set_header(3, get_lang('Date').' ('.get_lang('LastVersion').')', true);
2427
+                $table->set_header(4, get_lang('Actions'), false, array('style' => 'width:130px;'));
2428 2428
             }
2429 2429
             $table->display();
2430 2430
         } else {
@@ -2437,14 +2437,14 @@  discard block
 block discarded – undo
2437 2437
      * @todo replace this function with the formvalidator datepicker
2438 2438
      *
2439 2439
      */
2440
-    public function draw_date_picker($prefix,$default='')
2440
+    public function draw_date_picker($prefix, $default = '')
2441 2441
     {
2442 2442
         if (empty($default)) {
2443 2443
             $default = date('Y-m-d H:i:s');
2444 2444
         }
2445 2445
         $parts = explode(' ', $default);
2446
-        list($d_year,$d_month,$d_day) = explode('-',$parts[0]);
2447
-        list($d_hour,$d_minute) = explode(':',$parts[1]);
2446
+        list($d_year, $d_month, $d_day) = explode('-', $parts[0]);
2447
+        list($d_hour, $d_minute) = explode(':', $parts[1]);
2448 2448
 
2449 2449
         $month_list = array(
2450 2450
             1 => get_lang('JanuaryLong'),
@@ -2461,9 +2461,9 @@  discard block
 block discarded – undo
2461 2461
             12 => get_lang('DecemberLong'),
2462 2462
         );
2463 2463
 
2464
-        $minute = range(10,59);
2465
-        array_unshift($minute,'00','01','02','03','04','05','06','07','08','09');
2466
-        $date_form = self::make_select($prefix.'_day', array_combine(range(1,31),range(1,31)), $d_day);
2464
+        $minute = range(10, 59);
2465
+        array_unshift($minute, '00', '01', '02', '03', '04', '05', '06', '07', '08', '09');
2466
+        $date_form = self::make_select($prefix.'_day', array_combine(range(1, 31), range(1, 31)), $d_day);
2467 2467
         $date_form .= self::make_select($prefix.'_month', $month_list, $d_month);
2468 2468
         $date_form .= self::make_select(
2469 2469
                 $prefix.'_year',
@@ -2476,7 +2476,7 @@  discard block
 block discarded – undo
2476 2476
                 ),
2477 2477
                 $d_year
2478 2478
             ).'&nbsp;&nbsp;&nbsp;&nbsp;';
2479
-        $date_form .= self::make_select($prefix.'_hour', array_combine(range(0,23),range(0,23)), $d_hour).' : ';
2479
+        $date_form .= self::make_select($prefix.'_hour', array_combine(range(0, 23), range(0, 23)), $d_hour).' : ';
2480 2480
         $date_form .= self::make_select($prefix.'_minute', $minute, $d_minute);
2481 2481
 
2482 2482
         return $date_form;
@@ -2486,11 +2486,11 @@  discard block
 block discarded – undo
2486 2486
      * Draws an HTML form select with the given options
2487 2487
      *
2488 2488
      */
2489
-    public function make_select($name,$values,$checked='')
2489
+    public function make_select($name, $values, $checked = '')
2490 2490
     {
2491 2491
         $output = '<select name="'.$name.'" id="'.$name.'">';
2492
-        foreach($values as $key => $value) {
2493
-            $output .= '<option value="'.$key.'" '.(($checked==$key)?'selected="selected"':'').'>'.$value.'</option>';
2492
+        foreach ($values as $key => $value) {
2493
+            $output .= '<option value="'.$key.'" '.(($checked == $key) ? 'selected="selected"' : '').'>'.$value.'</option>';
2494 2494
         }
2495 2495
         $output .= '</select>';
2496 2496
         return $output;
@@ -2514,7 +2514,7 @@  discard block
 block discarded – undo
2514 2514
      */
2515 2515
     public function two_digits($number)
2516 2516
     {
2517
-        $number = (int)$number;
2517
+        $number = (int) $number;
2518 2518
         return ($number < 10) ? '0'.$number : $number;
2519 2519
     }
2520 2520
 
@@ -2535,7 +2535,7 @@  discard block
 block discarded – undo
2535 2535
                 WHERE c_id = '.$course_id.' AND id = '.$id.' ';
2536 2536
         $result = Database::query($sql);
2537 2537
         $data = array();
2538
-        while ($row=Database::fetch_array($result,'ASSOC'))   {
2538
+        while ($row = Database::fetch_array($result, 'ASSOC')) {
2539 2539
             $data = $row;
2540 2540
         }
2541 2541
         return $data;
@@ -2589,7 +2589,7 @@  discard block
 block discarded – undo
2589 2589
         $result = Database::query($sql);
2590 2590
         $data = array();
2591 2591
         if (Database::num_rows($result)) {
2592
-            $data = Database::fetch_array($result,'ASSOC');
2592
+            $data = Database::fetch_array($result, 'ASSOC');
2593 2593
         }
2594 2594
 
2595 2595
         return $data;
@@ -2683,9 +2683,9 @@  discard block
 block discarded – undo
2683 2683
         $result = self::getAllWiki();
2684 2684
         if (!empty($result)) {
2685 2685
             foreach ($result  as $is_editing_block) {
2686
-                $max_edit_time	= 1200; // 20 minutes
2687
-                $timestamp_edit	= strtotime($is_editing_block['time_edit']);
2688
-                $time_editing	= time()-$timestamp_edit;
2686
+                $max_edit_time = 1200; // 20 minutes
2687
+                $timestamp_edit = strtotime($is_editing_block['time_edit']);
2688
+                $time_editing = time() - $timestamp_edit;
2689 2689
 
2690 2690
                 // First prevent concurrent users and double version
2691 2691
                 if ($is_editing_block['is_editing'] == $userId) {
@@ -2694,7 +2694,7 @@  discard block
 block discarded – undo
2694 2694
                     Session::erase('_version');
2695 2695
                 }
2696 2696
                 // Second checks if has exceeded the time that a page may be available or if a page was edited and saved by its author
2697
-                if ($time_editing > $max_edit_time || ($is_editing_block['is_editing'] == $userId && $action!='edit')) {
2697
+                if ($time_editing > $max_edit_time || ($is_editing_block['is_editing'] == $userId && $action != 'edit')) {
2698 2698
                     self::updateWikiIsEditing($is_editing_block['is_editing']);
2699 2699
                 }
2700 2700
             }
@@ -2742,7 +2742,7 @@  discard block
 block discarded – undo
2742 2742
                 FROM ".$tbl_wiki."
2743 2743
                 WHERE c_id = $course_id AND ".$groupfilter.$condition_session."";
2744 2744
 
2745
-        $allpages=Database::query($sql);
2745
+        $allpages = Database::query($sql);
2746 2746
         while ($row = Database::fetch_array($allpages)) {
2747 2747
             $total_versions = $row['TOTAL_VERS'];
2748 2748
             $total_visits = intval($row['TOTAL_VISITS']);
@@ -2752,30 +2752,30 @@  discard block
 block discarded – undo
2752 2752
                 WHERE c_id = $course_id AND ".$groupfilter.$condition_session."";
2753 2753
         $allpages = Database::query($sql);
2754 2754
 
2755
-        while ($row=Database::fetch_array($allpages)) {
2755
+        while ($row = Database::fetch_array($allpages)) {
2756 2756
             $total_words = $total_words + self::word_count($row['content']);
2757
-            $total_links 			= $total_links+substr_count($row['content'], "href=");
2758
-            $total_links_anchors 	= $total_links_anchors+substr_count($row['content'], 'href="#');
2759
-            $total_links_mail		= $total_links_mail+substr_count($row['content'], 'href="mailto');
2760
-            $total_links_ftp 		= $total_links_ftp+substr_count($row['content'], 'href="ftp');
2761
-            $total_links_irc		= $total_links_irc+substr_count($row['content'], 'href="irc');
2762
-            $total_links_news 		= $total_links_news+substr_count($row['content'], 'href="news');
2763
-            $total_wlinks 			= $total_wlinks+substr_count($row['content'], "[[");
2764
-            $total_images 			= $total_images+substr_count($row['content'], "<img");
2757
+            $total_links = $total_links + substr_count($row['content'], "href=");
2758
+            $total_links_anchors = $total_links_anchors + substr_count($row['content'], 'href="#');
2759
+            $total_links_mail		= $total_links_mail + substr_count($row['content'], 'href="mailto');
2760
+            $total_links_ftp 		= $total_links_ftp + substr_count($row['content'], 'href="ftp');
2761
+            $total_links_irc = $total_links_irc + substr_count($row['content'], 'href="irc');
2762
+            $total_links_news = $total_links_news + substr_count($row['content'], 'href="news');
2763
+            $total_wlinks 			= $total_wlinks + substr_count($row['content'], "[[");
2764
+            $total_images 			= $total_images + substr_count($row['content'], "<img");
2765 2765
             $clean_total_flash = preg_replace('/player.swf/', ' ', $row['content']);
2766
-            $total_flash			= $total_flash+substr_count($clean_total_flash, '.swf"');
2766
+            $total_flash = $total_flash + substr_count($clean_total_flash, '.swf"');
2767 2767
             //.swf" end quotes prevent insert swf through flvplayer (is not counted)
2768
-            $total_mp3				= $total_mp3+substr_count($row['content'], ".mp3");
2769
-            $total_flv_p = $total_flv_p+substr_count($row['content'], ".flv");
2770
-            $total_flv				=	$total_flv_p/5;
2771
-            $total_youtube			= $total_youtube+substr_count($row['content'], "http://www.youtube.com");
2772
-            $total_multimedia		= $total_multimedia+substr_count($row['content'], "video/x-msvideo");
2773
-            $total_tables			= $total_tables+substr_count($row['content'], "<table");
2768
+            $total_mp3				= $total_mp3 + substr_count($row['content'], ".mp3");
2769
+            $total_flv_p = $total_flv_p + substr_count($row['content'], ".flv");
2770
+            $total_flv				= $total_flv_p / 5;
2771
+            $total_youtube = $total_youtube + substr_count($row['content'], "http://www.youtube.com");
2772
+            $total_multimedia = $total_multimedia + substr_count($row['content'], "video/x-msvideo");
2773
+            $total_tables = $total_tables + substr_count($row['content'], "<table");
2774 2774
         }
2775 2775
 
2776 2776
         //check only last version of all pages (current page)
2777 2777
 
2778
-        $sql =' SELECT *, COUNT(*) AS TOTAL_PAGES, SUM(hits) AS TOTAL_VISITS_LV
2778
+        $sql = ' SELECT *, COUNT(*) AS TOTAL_PAGES, SUM(hits) AS TOTAL_VISITS_LV
2779 2779
                 FROM  '.$tbl_wiki.' s1
2780 2780
                 WHERE s1.c_id = '.$course_id.' AND id=(
2781 2781
                     SELECT MAX(s2.id)
@@ -2786,9 +2786,9 @@  discard block
 block discarded – undo
2786 2786
                         '.$groupfilter.' AND
2787 2787
                         session_id='.$session_id.')';
2788 2788
         $allpages = Database::query($sql);
2789
-        while ($row=Database::fetch_array($allpages)) {
2790
-            $total_pages	 		= $row['TOTAL_PAGES'];
2791
-            $total_visits_lv 		= intval($row['TOTAL_VISITS_LV']);
2789
+        while ($row = Database::fetch_array($allpages)) {
2790
+            $total_pages = $row['TOTAL_PAGES'];
2791
+            $total_visits_lv = intval($row['TOTAL_VISITS_LV']);
2792 2792
         }
2793 2793
 
2794 2794
         $total_words_lv = 0;
@@ -2820,29 +2820,29 @@  discard block
 block discarded – undo
2820 2820
                 )';
2821 2821
         $allpages = Database::query($sql);
2822 2822
 
2823
-        while ($row=Database::fetch_array($allpages)) {
2824
-            $total_words_lv 		= $total_words_lv+ self::word_count($row['content']);
2825
-            $total_links_lv 		= $total_links_lv+substr_count($row['content'], "href=");
2826
-            $total_links_anchors_lv	= $total_links_anchors_lv+substr_count($row['content'], 'href="#');
2827
-            $total_links_mail_lv 	= $total_links_mail_lv+substr_count($row['content'], 'href="mailto');
2828
-            $total_links_ftp_lv 	= $total_links_ftp_lv+substr_count($row['content'], 'href="ftp');
2829
-            $total_links_irc_lv 	= $total_links_irc_lv+substr_count($row['content'], 'href="irc');
2830
-            $total_links_news_lv 	= $total_links_news_lv+substr_count($row['content'], 'href="news');
2831
-            $total_wlinks_lv 		= $total_wlinks_lv+substr_count($row['content'], "[[");
2832
-            $total_images_lv 		= $total_images_lv+substr_count($row['content'], "<img");
2823
+        while ($row = Database::fetch_array($allpages)) {
2824
+            $total_words_lv 		= $total_words_lv + self::word_count($row['content']);
2825
+            $total_links_lv 		= $total_links_lv + substr_count($row['content'], "href=");
2826
+            $total_links_anchors_lv = $total_links_anchors_lv + substr_count($row['content'], 'href="#');
2827
+            $total_links_mail_lv 	= $total_links_mail_lv + substr_count($row['content'], 'href="mailto');
2828
+            $total_links_ftp_lv 	= $total_links_ftp_lv + substr_count($row['content'], 'href="ftp');
2829
+            $total_links_irc_lv 	= $total_links_irc_lv + substr_count($row['content'], 'href="irc');
2830
+            $total_links_news_lv 	= $total_links_news_lv + substr_count($row['content'], 'href="news');
2831
+            $total_wlinks_lv 		= $total_wlinks_lv + substr_count($row['content'], "[[");
2832
+            $total_images_lv 		= $total_images_lv + substr_count($row['content'], "<img");
2833 2833
             $clean_total_flash_lv = preg_replace('/player.swf/', ' ', $row['content']);
2834
-            $total_flash_lv			= $total_flash_lv+substr_count($clean_total_flash_lv, '.swf"');
2834
+            $total_flash_lv = $total_flash_lv + substr_count($clean_total_flash_lv, '.swf"');
2835 2835
             //.swf" end quotes prevent insert swf through flvplayer (is not counted)
2836
-            $total_mp3_lv			= $total_mp3_lv+substr_count($row['content'], ".mp3");
2837
-            $total_flv_p_lv = $total_flv_p_lv+substr_count($row['content'], ".flv");
2838
-            $total_flv_lv			= $total_flv_p_lv/5;
2839
-            $total_youtube_lv		= $total_youtube_lv+substr_count($row['content'], "http://www.youtube.com");
2840
-            $total_multimedia_lv	= $total_multimedia_lv+substr_count($row['content'], "video/x-msvideo");
2841
-            $total_tables_lv		= $total_tables_lv+substr_count($row['content'], "<table");
2836
+            $total_mp3_lv			= $total_mp3_lv + substr_count($row['content'], ".mp3");
2837
+            $total_flv_p_lv = $total_flv_p_lv + substr_count($row['content'], ".flv");
2838
+            $total_flv_lv			= $total_flv_p_lv / 5;
2839
+            $total_youtube_lv = $total_youtube_lv + substr_count($row['content'], "http://www.youtube.com");
2840
+            $total_multimedia_lv = $total_multimedia_lv + substr_count($row['content'], "video/x-msvideo");
2841
+            $total_tables_lv = $total_tables_lv + substr_count($row['content'], "<table");
2842 2842
         }
2843 2843
 
2844 2844
         //Total pages edited at this time
2845
-        $total_editing_now=0;
2845
+        $total_editing_now = 0;
2846 2846
         $sql = 'SELECT *, COUNT(*) AS TOTAL_EDITING_NOW
2847 2847
                 FROM  '.$tbl_wiki.' s1
2848 2848
                 WHERE is_editing!=0 AND s1.c_id = '.$course_id.' AND
@@ -2857,66 +2857,66 @@  discard block
 block discarded – undo
2857 2857
         )';
2858 2858
 
2859 2859
         // Can not use group by because the mark is set in the latest version
2860
-        $allpages=Database::query($sql);
2861
-        while ($row=Database::fetch_array($allpages)) {
2862
-            $total_editing_now	= $row['TOTAL_EDITING_NOW'];
2860
+        $allpages = Database::query($sql);
2861
+        while ($row = Database::fetch_array($allpages)) {
2862
+            $total_editing_now = $row['TOTAL_EDITING_NOW'];
2863 2863
         }
2864 2864
 
2865 2865
         // Total hidden pages
2866
-        $total_hidden=0;
2866
+        $total_hidden = 0;
2867 2867
         $sql = 'SELECT * FROM '.$tbl_wiki.'
2868 2868
                 WHERE  c_id = '.$course_id.' AND visibility=0 AND '.$groupfilter.$condition_session.'
2869 2869
                 GROUP BY reflink';
2870 2870
         // 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
2871
-        $allpages=Database::query($sql);
2872
-        while ($row=Database::fetch_array($allpages)) {
2873
-            $total_hidden = $total_hidden+1;
2871
+        $allpages = Database::query($sql);
2872
+        while ($row = Database::fetch_array($allpages)) {
2873
+            $total_hidden = $total_hidden + 1;
2874 2874
         }
2875 2875
 
2876 2876
         //Total protect pages
2877
-        $total_protected=0;
2877
+        $total_protected = 0;
2878 2878
         $sql = 'SELECT * FROM '.$tbl_wiki.'
2879 2879
                 WHERE  c_id = '.$course_id.' AND editlock=1 AND '.$groupfilter.$condition_session.'
2880 2880
                 GROUP BY reflink';
2881 2881
         // or group by page_id. As the mark of protected page is the first version of the page, I can use group by
2882 2882
 
2883
-        $allpages=Database::query($sql);
2884
-        while ($row=Database::fetch_array($allpages)) {
2885
-            $total_protected = $total_protected+1;
2883
+        $allpages = Database::query($sql);
2884
+        while ($row = Database::fetch_array($allpages)) {
2885
+            $total_protected = $total_protected + 1;
2886 2886
         }
2887 2887
 
2888 2888
         // Total empty versions.
2889
-        $total_empty_content=0;
2889
+        $total_empty_content = 0;
2890 2890
         $sql = 'SELECT * FROM '.$tbl_wiki.'
2891 2891
                 WHERE
2892 2892
                     c_id = '.$course_id.' AND
2893 2893
                     content="" AND
2894 2894
                     '.$groupfilter.$condition_session.'';
2895 2895
         $allpages = Database::query($sql);
2896
-        while ($row=Database::fetch_array($allpages)) {
2897
-            $total_empty_content	= $total_empty_content+1;
2896
+        while ($row = Database::fetch_array($allpages)) {
2897
+            $total_empty_content = $total_empty_content + 1;
2898 2898
         }
2899 2899
 
2900 2900
         //Total empty pages (last version)
2901 2901
 
2902
-        $total_empty_content_lv=0;
2902
+        $total_empty_content_lv = 0;
2903 2903
         $sql = 'SELECT  * FROM  '.$tbl_wiki.' s1
2904 2904
                 WHERE s1.c_id = '.$course_id.' AND content="" AND id=(
2905 2905
                 SELECT MAX(s2.id) FROM '.$tbl_wiki.' s2
2906 2906
                 WHERE s1.c_id = '.$course_id.' AND s1.reflink = s2.reflink AND '.$groupfilter.' AND session_id='.$session_id.')';
2907
-        $allpages=Database::query($sql);
2907
+        $allpages = Database::query($sql);
2908 2908
         while ($row = Database::fetch_array($allpages)) {
2909
-            $total_empty_content_lv	= $total_empty_content_lv+1;
2909
+            $total_empty_content_lv = $total_empty_content_lv + 1;
2910 2910
         }
2911 2911
 
2912 2912
         // Total locked discuss pages
2913
-        $total_lock_disc=0;
2913
+        $total_lock_disc = 0;
2914 2914
         $sql = 'SELECT * FROM '.$tbl_wiki.'
2915 2915
                 WHERE c_id = '.$course_id.' AND addlock_disc=0 AND '.$groupfilter.$condition_session.'
2916 2916
                 GROUP BY reflink';//group by because mark lock in all vers, then always is ok
2917
-        $allpages=Database::query($sql);
2917
+        $allpages = Database::query($sql);
2918 2918
         while ($row = Database::fetch_array($allpages)) {
2919
-            $total_lock_disc	= $total_lock_disc+1;
2919
+            $total_lock_disc = $total_lock_disc + 1;
2920 2920
         }
2921 2921
 
2922 2922
         // Total hidden discuss pages.
@@ -2927,7 +2927,7 @@  discard block
 block discarded – undo
2927 2927
         //group by because mark lock in all vers, then always is ok
2928 2928
         $allpages = Database::query($sql);
2929 2929
         while ($row = Database::fetch_array($allpages)) {
2930
-            $total_hidden_disc	= $total_hidden_disc+1;
2930
+            $total_hidden_disc = $total_hidden_disc + 1;
2931 2931
         }
2932 2932
 
2933 2933
         //Total versions with any short comment by user or system
@@ -2935,44 +2935,44 @@  discard block
 block discarded – undo
2935 2935
         $total_comment_version = 0;
2936 2936
         $sql = 'SELECT * FROM '.$tbl_wiki.'
2937 2937
                 WHERE c_id = '.$course_id.' AND comment!="" AND '.$groupfilter.$condition_session.'';
2938
-        $allpages=Database::query($sql);
2938
+        $allpages = Database::query($sql);
2939 2939
         while ($row = Database::fetch_array($allpages)) {
2940
-            $total_comment_version	= $total_comment_version+1;
2940
+            $total_comment_version = $total_comment_version + 1;
2941 2941
         }
2942 2942
 
2943 2943
         // Total pages that can only be scored by teachers.
2944 2944
 
2945
-        $total_only_teachers_rating=0;
2945
+        $total_only_teachers_rating = 0;
2946 2946
         $sql = 'SELECT * FROM '.$tbl_wiki.'
2947 2947
                 WHERE c_id = '.$course_id.' AND
2948 2948
                 ratinglock_disc = 0 AND
2949 2949
                 '.$groupfilter.$condition_session.'
2950 2950
                 GROUP BY reflink';//group by because mark lock in all vers, then always is ok
2951
-        $allpages=Database::query($sql);
2952
-        while ($row=Database::fetch_array($allpages)) {
2953
-            $total_only_teachers_rating	= $total_only_teachers_rating+1;
2951
+        $allpages = Database::query($sql);
2952
+        while ($row = Database::fetch_array($allpages)) {
2953
+            $total_only_teachers_rating = $total_only_teachers_rating + 1;
2954 2954
         }
2955 2955
 
2956 2956
         // Total pages scored by peers
2957 2957
         // put always this line alfter check num all pages and num pages rated by teachers
2958
-        $total_rating_by_peers=$total_pages-$total_only_teachers_rating;
2958
+        $total_rating_by_peers = $total_pages - $total_only_teachers_rating;
2959 2959
 
2960 2960
         //Total pages identified as standard task
2961 2961
 
2962
-        $total_task=0;
2963
-        $sql='SELECT * FROM '.$tbl_wiki.', '.$tbl_wiki_conf.'
2962
+        $total_task = 0;
2963
+        $sql = 'SELECT * FROM '.$tbl_wiki.', '.$tbl_wiki_conf.'
2964 2964
               WHERE '.$tbl_wiki_conf.'.c_id = '.$course_id.' AND
2965 2965
                '.$tbl_wiki_conf.'.task!="" AND
2966 2966
                '.$tbl_wiki_conf.'.page_id='.$tbl_wiki.'.page_id AND
2967 2967
                 '.$tbl_wiki.'.'.$groupfilter.$condition_session;
2968 2968
         $allpages = Database::query($sql);
2969
-        while ($row=Database::fetch_array($allpages)) {
2970
-            $total_task=$total_task+1;
2969
+        while ($row = Database::fetch_array($allpages)) {
2970
+            $total_task = $total_task + 1;
2971 2971
         }
2972 2972
 
2973 2973
         //Total pages identified as teacher page (wiki portfolio mode - individual assignment)
2974 2974
 
2975
-        $total_teacher_assignment=0;
2975
+        $total_teacher_assignment = 0;
2976 2976
         $sql = 'SELECT  * FROM  '.$tbl_wiki.' s1
2977 2977
                 WHERE s1.c_id = '.$course_id.' AND assignment=1 AND id=(
2978 2978
                     SELECT MAX(s2.id)
@@ -2982,20 +2982,20 @@  discard block
 block discarded – undo
2982 2982
         //mark all versions, but do not use group by reflink because y want the pages not versions
2983 2983
         $allpages = Database::query($sql);
2984 2984
         while ($row = Database::fetch_array($allpages)) {
2985
-            $total_teacher_assignment=$total_teacher_assignment+1;
2985
+            $total_teacher_assignment = $total_teacher_assignment + 1;
2986 2986
         }
2987 2987
 
2988 2988
         //Total pages identifies as student page (wiki portfolio mode - individual assignment)
2989 2989
 
2990
-        $total_student_assignment=0;
2990
+        $total_student_assignment = 0;
2991 2991
         $sql = 'SELECT  * FROM  '.$tbl_wiki.' s1
2992 2992
                 WHERE s1.c_id = '.$course_id.' AND assignment=2 AND
2993 2993
                 id=(SELECT MAX(s2.id) FROM '.$tbl_wiki.' s2
2994 2994
                 WHERE s2.c_id = '.$course_id.' AND s1.reflink = s2.reflink AND '.$groupfilter.' AND session_id='.$session_id.')';
2995 2995
         //mark all versions, but do not use group by reflink because y want the pages not versions
2996
-        $allpages=Database::query($sql);
2997
-        while ($row=Database::fetch_array($allpages)) {
2998
-            $total_student_assignment = $total_student_assignment+1;
2996
+        $allpages = Database::query($sql);
2997
+        while ($row = Database::fetch_array($allpages)) {
2998
+            $total_student_assignment = $total_student_assignment + 1;
2999 2999
         }
3000 3000
 
3001 3001
         //Current Wiki status add new pages
@@ -3004,14 +3004,14 @@  discard block
 block discarded – undo
3004 3004
                 GROUP BY addlock';//group by because mark 0 in all vers, then always is ok
3005 3005
         $allpages = Database::query($sql);
3006 3006
         $wiki_add_lock = null;
3007
-        while ($row=Database::fetch_array($allpages)) {
3008
-            $wiki_add_lock=$row['addlock'];
3007
+        while ($row = Database::fetch_array($allpages)) {
3008
+            $wiki_add_lock = $row['addlock'];
3009 3009
         }
3010 3010
 
3011
-        if ($wiki_add_lock==1) {
3012
-            $status_add_new_pag=get_lang('Yes');
3011
+        if ($wiki_add_lock == 1) {
3012
+            $status_add_new_pag = get_lang('Yes');
3013 3013
         } else {
3014
-            $status_add_new_pag=get_lang('No');
3014
+            $status_add_new_pag = get_lang('No');
3015 3015
         }
3016 3016
 
3017 3017
         //Creation date of the oldest wiki page and version
@@ -3034,7 +3034,7 @@  discard block
 block discarded – undo
3034 3034
                 ORDER BY dtime DESC 
3035 3035
                 LIMIT 1';
3036 3036
         $allpages = Database::query($sql);
3037
-        while ($row=Database::fetch_array($allpages)) {
3037
+        while ($row = Database::fetch_array($allpages)) {
3038 3038
             $last_wiki_date = $row['dtime'];
3039 3039
         }
3040 3040
 
@@ -3047,18 +3047,18 @@  discard block
 block discarded – undo
3047 3047
         // Do not use "count" because using "group by", would give a wrong value
3048 3048
         $allpages = Database::query($sql);
3049 3049
         $total_score = 0;
3050
-        while ($row=Database::fetch_array($allpages)) {
3051
-            $total_score = $total_score+$row['TOTAL_SCORE'];
3050
+        while ($row = Database::fetch_array($allpages)) {
3051
+            $total_score = $total_score + $row['TOTAL_SCORE'];
3052 3052
         }
3053 3053
 
3054 3054
         if (!empty($total_pages)) {
3055
-            $media_score = $total_score/$total_pages;
3055
+            $media_score = $total_score / $total_pages;
3056 3056
             //put always this line alfter check num all pages
3057 3057
         }
3058 3058
 
3059 3059
         // Average user progress in his pages.
3060 3060
 
3061
-        $media_progress=0;
3061
+        $media_progress = 0;
3062 3062
         $sql = 'SELECT  *, SUM(progress) AS TOTAL_PROGRESS
3063 3063
                 FROM  '.$tbl_wiki.' s1
3064 3064
                 WHERE s1.c_id = '.$course_id.' AND id=
@@ -3072,24 +3072,24 @@  discard block
 block discarded – undo
3072 3072
         // As the value is only the latest version I can not use group by
3073 3073
         $allpages = Database::query($sql);
3074 3074
         while ($row = Database::fetch_array($allpages)) {
3075
-            $total_progress	= $row['TOTAL_PROGRESS'];
3075
+            $total_progress = $row['TOTAL_PROGRESS'];
3076 3076
         }
3077 3077
 
3078 3078
         if (!empty($total_pages)) {
3079
-            $media_progress=$total_progress/$total_pages;
3079
+            $media_progress = $total_progress / $total_pages;
3080 3080
             //put always this line alfter check num all pages
3081 3081
         }
3082 3082
 
3083 3083
         //Total users that have participated in the Wiki
3084 3084
 
3085
-        $total_users=0;
3085
+        $total_users = 0;
3086 3086
         $sql = 'SELECT * FROM '.$tbl_wiki.'
3087 3087
                 WHERE  c_id = '.$course_id.' AND '.$groupfilter.$condition_session.'
3088 3088
                 GROUP BY user_id';
3089 3089
         //as the mark of user it in all versions of the page, I can use group by to see the first
3090
-        $allpages=Database::query($sql);
3091
-        while ($row=Database::fetch_array($allpages)) {
3092
-            $total_users = $total_users+1;
3090
+        $allpages = Database::query($sql);
3091
+        while ($row = Database::fetch_array($allpages)) {
3092
+            $total_users = $total_users + 1;
3093 3093
         }
3094 3094
 
3095 3095
         // Total of different IP addresses that have participated in the wiki
@@ -3097,9 +3097,9 @@  discard block
 block discarded – undo
3097 3097
         $sql = 'SELECT * FROM '.$tbl_wiki.'
3098 3098
               WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.'
3099 3099
               GROUP BY user_ip';
3100
-        $allpages=Database::query($sql);
3101
-        while ($row=Database::fetch_array($allpages)) {
3102
-            $total_ip	= $total_ip+1;
3100
+        $allpages = Database::query($sql);
3101
+        while ($row = Database::fetch_array($allpages)) {
3102
+            $total_ip = $total_ip + 1;
3103 3103
         }
3104 3104
 
3105 3105
         echo '<table class="data_table">';
@@ -3291,18 +3291,18 @@  discard block
 block discarded – undo
3291 3291
                 $userinfo = api_get_user_info($obj->user_id);
3292 3292
                 $username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username']), ENT_QUOTES);
3293 3293
                 $row = array();
3294
-                if ($obj->user_id != 0  && $userinfo !== false) {
3294
+                if ($obj->user_id != 0 && $userinfo !== false) {
3295 3295
                     $row[] = UserManager::getUserProfileLink($userinfo).'
3296 3296
                             <a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=usercontrib&user_id='.urlencode($obj->user_id).
3297 3297
                         '&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'"></a>';
3298 3298
                 } else {
3299 3299
                     $row[] = get_lang('Anonymous').' ('.$obj->user_ip.')';
3300 3300
                 }
3301
-                $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>';
3301
+                $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>';
3302 3302
                 $rows[] = $row;
3303 3303
             }
3304 3304
 
3305
-            $table = new SortableTableFromArrayConfig($rows,1,10,'MostActiveUsersA_table','','','DESC');
3305
+            $table = new SortableTableFromArrayConfig($rows, 1, 10, 'MostActiveUsersA_table', '', '', 'DESC');
3306 3306
             $table->set_additional_parameters(
3307 3307
                 array(
3308 3308
                     'cidReq' => Security::remove_XSS($_GET['cidReq']),
@@ -3311,8 +3311,8 @@  discard block
 block discarded – undo
3311 3311
                     'group_id' => Security::remove_XSS($_GET['group_id'])
3312 3312
                 )
3313 3313
             );
3314
-            $table->set_header(0,get_lang('Author'), true);
3315
-            $table->set_header(1,get_lang('Contributions'), true,array ('style' => 'width:30px;'));
3314
+            $table->set_header(0, get_lang('Author'), true);
3315
+            $table->set_header(1, get_lang('Contributions'), true, array('style' => 'width:30px;'));
3316 3316
             $table->display();
3317 3317
         }
3318 3318
     }
@@ -3328,8 +3328,8 @@  discard block
 block discarded – undo
3328 3328
         $groupfilter = $this->groupfilter;
3329 3329
         $tbl_wiki_discuss = $this->tbl_wiki_discuss;
3330 3330
 
3331
-        if (api_get_session_id()!=0 &&
3332
-            api_is_allowed_to_session_edit(false,true)==false
3331
+        if (api_get_session_id() != 0 &&
3332
+            api_is_allowed_to_session_edit(false, true) == false
3333 3333
         ) {
3334 3334
             api_not_allowed();
3335 3335
         }
@@ -3392,9 +3392,9 @@  discard block
 block discarded – undo
3392 3392
         //mode assignment: previous to show  page type
3393 3393
         $icon_assignment = null;
3394 3394
         if ($row['assignment'] == 1) {
3395
-            $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'),'',ICON_SIZE_SMALL);
3395
+            $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'), '', ICON_SIZE_SMALL);
3396 3396
         } elseif ($row['assignment'] == 2) {
3397
-            $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWorkExtra'),'',ICON_SIZE_SMALL);
3397
+            $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWorkExtra'), '', ICON_SIZE_SMALL);
3398 3398
         }
3399 3399
 
3400 3400
         $countWPost = null;
@@ -3405,23 +3405,23 @@  discard block
 block discarded – undo
3405 3405
             // Show discussion to students if isn't hidden.
3406 3406
             // Show page to all teachers if is hidden.
3407 3407
             // Mode assignments: If is hidden, show pages to student only if student is the author
3408
-            if ($row['visibility_disc']==1 ||
3409
-                api_is_allowed_to_edit(false,true) ||
3408
+            if ($row['visibility_disc'] == 1 ||
3409
+                api_is_allowed_to_edit(false, true) ||
3410 3410
                 api_is_platform_admin() ||
3411
-                ($row['assignment']==2 && $row['visibility_disc']==0 && (api_get_user_id()==$row['user_id']))
3411
+                ($row['assignment'] == 2 && $row['visibility_disc'] == 0 && (api_get_user_id() == $row['user_id']))
3412 3412
             ) {
3413 3413
                 echo '<div id="wikititle">';
3414 3414
 
3415 3415
                 // discussion action: protecting (locking) the discussion
3416 3416
                 $addlock_disc = null;
3417 3417
                 $lock_unlock_disc = null;
3418
-                if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
3418
+                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3419 3419
                     if (self::check_addlock_discuss() == 1) {
3420
-                        $addlock_disc = Display::return_icon('unlock.png', get_lang('UnlockDiscussExtra'),'',ICON_SIZE_SMALL);
3421
-                        $lock_unlock_disc ='unlockdisc';
3420
+                        $addlock_disc = Display::return_icon('unlock.png', get_lang('UnlockDiscussExtra'), '', ICON_SIZE_SMALL);
3421
+                        $lock_unlock_disc = 'unlockdisc';
3422 3422
                     } else {
3423
-                        $addlock_disc = Display::return_icon('lock.png', get_lang('LockDiscussExtra'),'',ICON_SIZE_SMALL);
3424
-                        $lock_unlock_disc ='lockdisc';
3423
+                        $addlock_disc = Display::return_icon('lock.png', get_lang('LockDiscussExtra'), '', ICON_SIZE_SMALL);
3424
+                        $lock_unlock_disc = 'lockdisc';
3425 3425
                     }
3426 3426
                 }
3427 3427
                 echo '<span style="float:right">';
@@ -3431,13 +3431,13 @@  discard block
 block discarded – undo
3431 3431
                 // discussion action: visibility.  Show discussion to students if isn't hidden. Show page to all teachers if is hidden.
3432 3432
                 $visibility_disc = null;
3433 3433
                 $hide_show_disc = null;
3434
-                if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
3435
-                    if (self::check_visibility_discuss()==1) {
3434
+                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3435
+                    if (self::check_visibility_discuss() == 1) {
3436 3436
                         /// TODO: 	Fix Mode assignments: If is hidden, show discussion to student only if student is the author
3437
-                        $visibility_disc = Display::return_icon('visible.png', get_lang('ShowDiscussExtra'),'',ICON_SIZE_SMALL);
3437
+                        $visibility_disc = Display::return_icon('visible.png', get_lang('ShowDiscussExtra'), '', ICON_SIZE_SMALL);
3438 3438
                         $hide_show_disc = 'hidedisc';
3439 3439
                     } else {
3440
-                        $visibility_disc = Display::return_icon('invisible.png', get_lang('HideDiscussExtra'),'',ICON_SIZE_SMALL);
3440
+                        $visibility_disc = Display::return_icon('invisible.png', get_lang('HideDiscussExtra'), '', ICON_SIZE_SMALL);
3441 3441
                         $hide_show_disc = 'showdisc';
3442 3442
                     }
3443 3443
                 }
@@ -3448,12 +3448,12 @@  discard block
 block discarded – undo
3448 3448
                 //discussion action: check add rating lock. Show/Hide list to rating for all student
3449 3449
                 $lock_unlock_rating_disc = null;
3450 3450
                 $ratinglock_disc = null;
3451
-                if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
3451
+                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3452 3452
                     if (self::check_ratinglock_discuss() == 1) {
3453
-                        $ratinglock_disc = Display::return_icon('star.png', get_lang('UnlockRatingDiscussExtra'),'',ICON_SIZE_SMALL);
3453
+                        $ratinglock_disc = Display::return_icon('star.png', get_lang('UnlockRatingDiscussExtra'), '', ICON_SIZE_SMALL);
3454 3454
                         $lock_unlock_rating_disc = 'unlockrating';
3455 3455
                     } else {
3456
-                        $ratinglock_disc = Display::return_icon('star_na.png', get_lang('LockRatingDiscussExtra'),'',ICON_SIZE_SMALL);
3456
+                        $ratinglock_disc = Display::return_icon('star_na.png', get_lang('LockRatingDiscussExtra'), '', ICON_SIZE_SMALL);
3457 3457
                         $lock_unlock_rating_disc = 'lockrating';
3458 3458
                     }
3459 3459
                 }
@@ -3464,11 +3464,11 @@  discard block
 block discarded – undo
3464 3464
 
3465 3465
                 //discussion action: email notification
3466 3466
                 if (self::check_notify_discuss($page) == 1) {
3467
-                    $notify_disc= Display::return_icon('messagebox_info.png', get_lang('NotifyDiscussByEmail'),'',ICON_SIZE_SMALL);
3468
-                    $lock_unlock_notify_disc='unlocknotifydisc';
3467
+                    $notify_disc = Display::return_icon('messagebox_info.png', get_lang('NotifyDiscussByEmail'), '', ICON_SIZE_SMALL);
3468
+                    $lock_unlock_notify_disc = 'unlocknotifydisc';
3469 3469
                 } else {
3470
-                    $notify_disc= Display::return_icon('mail.png', get_lang('CancelNotifyDiscussByEmail'),'',ICON_SIZE_SMALL);
3471
-                    $lock_unlock_notify_disc='locknotifydisc';
3470
+                    $notify_disc = Display::return_icon('mail.png', get_lang('CancelNotifyDiscussByEmail'), '', ICON_SIZE_SMALL);
3471
+                    $lock_unlock_notify_disc = 'locknotifydisc';
3472 3472
                 }
3473 3473
                 echo '<span style="float:right">';
3474 3474
                 echo '<a href="index.php?action=discuss&amp;actionpage='.$lock_unlock_notify_disc.'&amp;title='.api_htmlentities(urlencode($page)).'">'.$notify_disc.'</a>';
@@ -3477,27 +3477,27 @@  discard block
 block discarded – undo
3477 3477
                 echo $icon_assignment.'&nbsp;&nbsp;&nbsp;'.api_htmlentities($row['title']);
3478 3478
 
3479 3479
                 if ($lastuserinfo !== false) {
3480
-                    echo ' (' . get_lang('MostRecentVersionBy') . ' ' . UserManager::getUserProfileLink($lastuserinfo) . ' ' . $lastversiondate . $countWPost . ')' . $avg_WPost_score . ' '; //TODO: read average score
3480
+                    echo ' ('.get_lang('MostRecentVersionBy').' '.UserManager::getUserProfileLink($lastuserinfo).' '.$lastversiondate.$countWPost.')'.$avg_WPost_score.' '; //TODO: read average score
3481 3481
                 }
3482 3482
 
3483 3483
                 echo '</div>';
3484 3484
 
3485
-                if ($row['addlock_disc']==1 || api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
3485
+                if ($row['addlock_disc'] == 1 || api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3486 3486
                     //show comments but students can't add theirs
3487 3487
                     ?>
3488 3488
                     <form name="form1" method="post" action="">
3489 3489
                         <table>
3490 3490
                             <tr>
3491
-                                <td valign="top" ><?php echo get_lang('Comments');?>:</td>
3492
-                                <?php  echo '<input type="hidden" name="wpost_id" value="'.md5(uniqid(rand(), true)).'">';//prevent double post ?>
3491
+                                <td valign="top" ><?php echo get_lang('Comments'); ?>:</td>
3492
+                                <?php  echo '<input type="hidden" name="wpost_id" value="'.md5(uniqid(rand(), true)).'">'; //prevent double post ?>
3493 3493
                                 <td><textarea name="comment" cols="80" rows="5" id="comment"></textarea></td>
3494 3494
                             </tr>
3495 3495
                             <tr>
3496 3496
                                 <?php
3497 3497
                                 //check if rating is allowed
3498
-                                if ($row['ratinglock_disc']==1 || api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
3498
+                                if ($row['ratinglock_disc'] == 1 || api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3499 3499
                                     ?>
3500
-                                    <td><?php echo get_lang('Rating');?>: </td>
3500
+                                    <td><?php echo get_lang('Rating'); ?>: </td>
3501 3501
                                     <td valign="top"><select name="rating" id="rating">
3502 3502
                                             <option value="-" selected>-</option>
3503 3503
                                             <option value="0">0</option>
@@ -3514,7 +3514,7 @@  discard block
 block discarded – undo
3514 3514
                                         </select></td>
3515 3515
                                 <?php
3516 3516
                                 } else {
3517
-                                    echo '<input type=hidden name="rating" value="-">';// must pass a default value to avoid rate automatically
3517
+                                    echo '<input type=hidden name="rating" value="-">'; // must pass a default value to avoid rate automatically
3518 3518
                                 }
3519 3519
                                 ?>
3520 3520
                             </tr>
@@ -3554,12 +3554,12 @@  discard block
 block discarded – undo
3554 3554
                 $sql = "SELECT * FROM $tbl_wiki_discuss
3555 3555
                         WHERE c_id = $course_id AND publication_id='".$id."' AND NOT p_score='-'";
3556 3556
                 $result3 = Database::query($sql);
3557
-                $countWPost_score= Database::num_rows($result3);
3557
+                $countWPost_score = Database::num_rows($result3);
3558 3558
 
3559
-                echo ' - '.get_lang('NumCommentsScore').': '.$countWPost_score;//
3559
+                echo ' - '.get_lang('NumCommentsScore').': '.$countWPost_score; //
3560 3560
 
3561
-                if ($countWPost_score!=0) {
3562
-                    $avg_WPost_score = round($row2['sumWPost'] / $countWPost_score,2).' / 10';
3561
+                if ($countWPost_score != 0) {
3562
+                    $avg_WPost_score = round($row2['sumWPost'] / $countWPost_score, 2).' / 10';
3563 3563
                 } else {
3564 3564
                     $avg_WPost_score = $countWPost_score;
3565 3565
                 }
@@ -3577,16 +3577,16 @@  discard block
 block discarded – undo
3577 3577
 
3578 3578
                 echo '<hr noshade size="1">';
3579 3579
 
3580
-                while ($row=Database::fetch_array($result)) {
3580
+                while ($row = Database::fetch_array($result)) {
3581 3581
                     $userinfo = api_get_user_info($row['userc_id']);
3582
-                    if (($userinfo['status'])=="5") {
3583
-                        $author_status=get_lang('Student');
3582
+                    if (($userinfo['status']) == "5") {
3583
+                        $author_status = get_lang('Student');
3584 3584
                     } else {
3585
-                        $author_status=get_lang('Teacher');
3585
+                        $author_status = get_lang('Teacher');
3586 3586
                     }
3587 3587
 
3588 3588
                     $name = $userinfo['complete_name'];
3589
-                    $author_photo= '<img src="'.$userinfo['avatar'].'" alt="'.api_htmlentities($name).'"  width="40" height="50" align="top"  title="'.api_htmlentities($name).'"  />';
3589
+                    $author_photo = '<img src="'.$userinfo['avatar'].'" alt="'.api_htmlentities($name).'"  width="40" height="50" align="top"  title="'.api_htmlentities($name).'"  />';
3590 3590
 
3591 3591
                     //stars
3592 3592
                     $p_score = $row['p_score'];
@@ -3632,7 +3632,7 @@  discard block
 block discarded – undo
3632 3632
                     if ($userinfo !== false) {
3633 3633
                         $userProfile = UserManager::getUserProfileLink($userinfo);
3634 3634
                     }
3635
-                    echo '<td style=" color:#999999">' . $userProfile . ' (' . $author_status . ') '.
3635
+                    echo '<td style=" color:#999999">'.$userProfile.' ('.$author_status.') '.
3636 3636
                         api_get_local_time($row['dtime'], null, date_default_timezone_get()).
3637 3637
                         ' - '.get_lang('Rating').': '.$row['p_score'].' '.$imagerating.' </td>';
3638 3638
                     echo '</tr>';
@@ -3669,7 +3669,7 @@  discard block
 block discarded – undo
3669 3669
         }
3670 3670
         echo '</div>';
3671 3671
 
3672
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { //only by professors if page is hidden
3672
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { //only by professors if page is hidden
3673 3673
             $sql = 'SELECT  *
3674 3674
                     FROM  '.$tbl_wiki.' s1
3675 3675
         		    WHERE s1.c_id = '.$course_id.' AND id=(
@@ -3695,11 +3695,11 @@  discard block
 block discarded – undo
3695 3695
                 $username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username']), ENT_QUOTES);
3696 3696
 
3697 3697
                 //get type assignment icon
3698
-                if ($obj->assignment==1) {
3699
-                    $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL);
3700
-                } elseif ($obj->assignment==2) {
3701
-                    $ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
3702
-                } elseif ($obj->assignment==0) {
3698
+                if ($obj->assignment == 1) {
3699
+                    $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL);
3700
+                } elseif ($obj->assignment == 2) {
3701
+                    $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
3702
+                } elseif ($obj->assignment == 0) {
3703 3703
                     $ShowAssignment = Display::return_icon('px_transparent.gif');
3704 3704
                 }
3705 3705
 
@@ -3722,29 +3722,29 @@  discard block
 block discarded – undo
3722 3722
                 }
3723 3723
                 $row[] = api_get_local_time($obj->dtime, null, date_default_timezone_get());
3724 3724
                 $showdelete = '';
3725
-                if (api_is_allowed_to_edit(false,true)|| api_is_platform_admin()) {
3726
-                    $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']).'">'.
3727
-                        Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL);
3725
+                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3726
+                    $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']).'">'.
3727
+                        Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
3728 3728
                 }
3729
-                if (api_is_allowed_to_session_edit(false,true) ) {
3729
+                if (api_is_allowed_to_session_edit(false, true)) {
3730 3730
                     $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']).'">'.
3731
-                        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']).'">'.
3732
-                        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']).'">'.
3733
-                        Display::return_icon('history.png', get_lang('History'),'',ICON_SIZE_SMALL).'</a>
3731
+                        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']).'">'.
3732
+                        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']).'">'.
3733
+                        Display::return_icon('history.png', get_lang('History'), '', ICON_SIZE_SMALL).'</a>
3734 3734
                         <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']).'">'.
3735
-                        Display::return_icon('what_link_here.png', get_lang('LinksPages'),'',ICON_SIZE_SMALL).'</a>'.$showdelete;
3735
+                        Display::return_icon('what_link_here.png', get_lang('LinksPages'), '', ICON_SIZE_SMALL).'</a>'.$showdelete;
3736 3736
                 }
3737 3737
                 $rows[] = $row;
3738 3738
             }
3739 3739
 
3740
-            $table = new SortableTableFromArrayConfig($rows,1,10,'AllPages_table','','','ASC');
3741
-            $table->set_additional_parameters(array('cidReq' =>Security::remove_XSS($_GET['cidReq']),'action'=>Security::remove_XSS($action),'group_id'=>Security::remove_XSS($_GET['group_id'])));
3742
-            $table->set_header(0,get_lang('Type'), true, array ('style' => 'width:30px;'));
3743
-            $table->set_header(1,get_lang('Title'), true);
3744
-            $table->set_header(2,get_lang('Author').' ('.get_lang('LastVersion').')', true);
3745
-            $table->set_header(3,get_lang('Date').' ('.get_lang('LastVersion').')', true);
3746
-            if (api_is_allowed_to_session_edit(false,true) ) {
3747
-                $table->set_header(4,get_lang('Actions'), true, array ('style' => 'width:130px;'));
3740
+            $table = new SortableTableFromArrayConfig($rows, 1, 10, 'AllPages_table', '', '', 'ASC');
3741
+            $table->set_additional_parameters(array('cidReq' =>Security::remove_XSS($_GET['cidReq']), 'action'=>Security::remove_XSS($action), 'group_id'=>Security::remove_XSS($_GET['group_id'])));
3742
+            $table->set_header(0, get_lang('Type'), true, array('style' => 'width:30px;'));
3743
+            $table->set_header(1, get_lang('Title'), true);
3744
+            $table->set_header(2, get_lang('Author').' ('.get_lang('LastVersion').')', true);
3745
+            $table->set_header(3, get_lang('Date').' ('.get_lang('LastVersion').')', true);
3746
+            if (api_is_allowed_to_session_edit(false, true)) {
3747
+                $table->set_header(4, get_lang('Actions'), true, array('style' => 'width:130px;'));
3748 3748
             }
3749 3749
             $table->display();
3750 3750
         }
@@ -3764,13 +3764,13 @@  discard block
 block discarded – undo
3764 3764
         $groupfilter = $this->groupfilter;
3765 3765
         $tbl_wiki_conf = $this->tbl_wiki_conf;
3766 3766
 
3767
-        if (api_is_allowed_to_session_edit(false,true) ) {
3768
-            if (self::check_notify_all()==1) {
3769
-                $notify_all= Display::return_icon('messagebox_info.png', get_lang('NotifyByEmail'),'',ICON_SIZE_SMALL).' '.get_lang('NotNotifyChanges');
3770
-                $lock_unlock_notify_all='unlocknotifyall';
3767
+        if (api_is_allowed_to_session_edit(false, true)) {
3768
+            if (self::check_notify_all() == 1) {
3769
+                $notify_all = Display::return_icon('messagebox_info.png', get_lang('NotifyByEmail'), '', ICON_SIZE_SMALL).' '.get_lang('NotNotifyChanges');
3770
+                $lock_unlock_notify_all = 'unlocknotifyall';
3771 3771
             } else {
3772
-                $notify_all=Display::return_icon('mail.png', get_lang('CancelNotifyByEmail'),'',ICON_SIZE_SMALL).' '.get_lang('NotifyChanges');
3773
-                $lock_unlock_notify_all='locknotifyall';
3772
+                $notify_all = Display::return_icon('mail.png', get_lang('CancelNotifyByEmail'), '', ICON_SIZE_SMALL).' '.get_lang('NotifyChanges');
3773
+                $lock_unlock_notify_all = 'locknotifyall';
3774 3774
             }
3775 3775
         }
3776 3776
 
@@ -3778,7 +3778,7 @@  discard block
 block discarded – undo
3778 3778
         echo '<a href="index.php?action=recentchanges&amp;actionpage='.$lock_unlock_notify_all.'&amp;title='.api_htmlentities(urlencode($page)).'">'.$notify_all.'</a>';
3779 3779
         echo '</span>'.get_lang('RecentChanges').'</div>';
3780 3780
 
3781
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { //only by professors if page is hidden
3781
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { //only by professors if page is hidden
3782 3782
             $sql = 'SELECT * FROM '.$tbl_wiki.', '.$tbl_wiki_conf.'
3783 3783
         		WHERE 	'.$tbl_wiki_conf.'.c_id= '.$course_id.' AND
3784 3784
         				'.$tbl_wiki.'.c_id= '.$course_id.' AND
@@ -3806,19 +3806,19 @@  discard block
 block discarded – undo
3806 3806
                 $userinfo = api_get_user_info($obj->user_id);
3807 3807
 
3808 3808
                 //get type assignment icon
3809
-                if ($obj->assignment==1) {
3810
-                    $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL);
3811
-                } elseif ($obj->assignment==2) {
3812
-                    $ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
3813
-                } elseif ($obj->assignment==0) {
3814
-                    $ShowAssignment=Display::return_icon('px_transparent.gif');
3809
+                if ($obj->assignment == 1) {
3810
+                    $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL);
3811
+                } elseif ($obj->assignment == 2) {
3812
+                    $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
3813
+                } elseif ($obj->assignment == 0) {
3814
+                    $ShowAssignment = Display::return_icon('px_transparent.gif');
3815 3815
                 }
3816 3816
 
3817 3817
                 // Get icon task
3818 3818
                 if (!empty($obj->task)) {
3819
-                    $icon_task=Display::return_icon('wiki_task.png', get_lang('StandardTask'),'',ICON_SIZE_SMALL);
3819
+                    $icon_task = Display::return_icon('wiki_task.png', get_lang('StandardTask'), '', ICON_SIZE_SMALL);
3820 3820
                 } else {
3821
-                    $icon_task=Display::return_icon('px_transparent.gif');
3821
+                    $icon_task = Display::return_icon('px_transparent.gif');
3822 3822
                 }
3823 3823
 
3824 3824
                 $row = array();
@@ -3826,7 +3826,7 @@  discard block
 block discarded – undo
3826 3826
                 $row[] = $ShowAssignment.$icon_task;
3827 3827
                 $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().'">'.
3828 3828
                     api_htmlentities($obj->title).'</a>';
3829
-                $row[] = $obj->version>1 ? get_lang('EditedBy') : get_lang('AddedBy');
3829
+                $row[] = $obj->version > 1 ? get_lang('EditedBy') : get_lang('AddedBy');
3830 3830
                 if ($userinfo !== false) {
3831 3831
                     $row[] = UserManager::getUserProfileLink($userinfo);
3832 3832
                 } else {
@@ -3835,7 +3835,7 @@  discard block
 block discarded – undo
3835 3835
                 $rows[] = $row;
3836 3836
             }
3837 3837
 
3838
-            $table = new SortableTableFromArrayConfig($rows,0,10,'RecentPages_table','','','DESC');
3838
+            $table = new SortableTableFromArrayConfig($rows, 0, 10, 'RecentPages_table', '', '', 'DESC');
3839 3839
             $table->set_additional_parameters(
3840 3840
                 array(
3841 3841
                     'cidReq' =>api_get_course_id(),
@@ -3844,11 +3844,11 @@  discard block
 block discarded – undo
3844 3844
                     'group_id' => api_get_group_id()
3845 3845
                 )
3846 3846
             );
3847
-            $table->set_header(0,get_lang('Date'), true, array ('style' => 'width:200px;'));
3848
-            $table->set_header(1,get_lang('Type'), true, array ('style' => 'width:30px;'));
3849
-            $table->set_header(2,get_lang('Title'), true);
3850
-            $table->set_header(3,get_lang('Actions'), true, array ('style' => 'width:80px;'));
3851
-            $table->set_header(4,get_lang('Author'), true);
3847
+            $table->set_header(0, get_lang('Date'), true, array('style' => 'width:200px;'));
3848
+            $table->set_header(1, get_lang('Type'), true, array('style' => 'width:30px;'));
3849
+            $table->set_header(2, get_lang('Title'), true);
3850
+            $table->set_header(3, get_lang('Actions'), true, array('style' => 'width:80px;'));
3851
+            $table->set_header(4, get_lang('Author'), true);
3852 3852
             $table->display();
3853 3853
         }
3854 3854
     }
@@ -3880,17 +3880,17 @@  discard block
 block discarded – undo
3880 3880
 
3881 3881
             //get type assignment icon
3882 3882
             $ShowAssignment = '';
3883
-            if ($row['assignment']==1) {
3884
-                $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL);
3885
-            } elseif ($row['assignment']==2) {
3886
-                $ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
3887
-            } elseif ($row['assignment']==0) {
3888
-                $ShowAssignment=Display::return_icon('px_transparent.gif');
3883
+            if ($row['assignment'] == 1) {
3884
+                $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL);
3885
+            } elseif ($row['assignment'] == 2) {
3886
+                $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
3887
+            } elseif ($row['assignment'] == 0) {
3888
+                $ShowAssignment = Display::return_icon('px_transparent.gif');
3889 3889
             }
3890 3890
 
3891 3891
             //fix Title to reflink (link Main Page)
3892
-            if ($page==get_lang('DefaultTitle')) {
3893
-                $page='index';
3892
+            if ($page == get_lang('DefaultTitle')) {
3893
+                $page = 'index';
3894 3894
             }
3895 3895
 
3896 3896
             echo '<div id="wikititle">';
@@ -3901,11 +3901,11 @@  discard block
 block discarded – undo
3901 3901
             //fix index to title Main page into linksto
3902 3902
 
3903 3903
             if ($page == 'index') {
3904
-                $page = str_replace(' ','_',get_lang('DefaultTitle'));
3904
+                $page = str_replace(' ', '_', get_lang('DefaultTitle'));
3905 3905
             }
3906 3906
 
3907 3907
             //table
3908
-            if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
3908
+            if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3909 3909
                 //only by professors if page is hidden
3910 3910
                 $sql = "SELECT * FROM ".$tbl_wiki." s1
3911 3911
                         WHERE s1.c_id = $course_id AND linksto LIKE '%".Database::escape_string($page)."%' AND id=(
@@ -3932,10 +3932,10 @@  discard block
 block discarded – undo
3932 3932
                     //get time
3933 3933
                     $year 	 = substr($obj->dtime, 0, 4);
3934 3934
                     $month	 = substr($obj->dtime, 5, 2);
3935
-                    $day 	 = substr($obj->dtime, 8, 2);
3936
-                    $hours   = substr($obj->dtime, 11,2);
3937
-                    $minutes = substr($obj->dtime, 14,2);
3938
-                    $seconds = substr($obj->dtime, 17,2);
3935
+                    $day = substr($obj->dtime, 8, 2);
3936
+                    $hours   = substr($obj->dtime, 11, 2);
3937
+                    $minutes = substr($obj->dtime, 14, 2);
3938
+                    $seconds = substr($obj->dtime, 17, 2);
3939 3939
 
3940 3940
                     //get type assignment icon
3941 3941
                     if ($obj->assignment == 1) {
@@ -3947,7 +3947,7 @@  discard block
 block discarded – undo
3947 3947
                     }
3948 3948
 
3949 3949
                     $row = array();
3950
-                    $row[] =$ShowAssignment;
3950
+                    $row[] = $ShowAssignment;
3951 3951
                     $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']).'">'.
3952 3952
                         api_htmlentities($obj->title).'</a>';
3953 3953
                     if ($userinfo !== false) {
@@ -4054,13 +4054,13 @@  discard block
 block discarded – undo
4054 4054
         $userId = intval($userId);
4055 4055
         $userinfo = api_get_user_info($userId);
4056 4056
         if ($userinfo !== false) {
4057
-            echo '<div class="actions">' . get_lang('UserContributions') . ': ' . UserManager::getUserProfileLink($userinfo) .
4058
-                '<a href="' . api_get_self() . '?cidReq=' . $_course['code'] . '&action=usercontrib&user_id=' . $userId .
4059
-                '&session_id=' . $this->session_id . '&group_id=' . $this->group_id . '">' .
4057
+            echo '<div class="actions">'.get_lang('UserContributions').': '.UserManager::getUserProfileLink($userinfo).
4058
+                '<a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=usercontrib&user_id='.$userId.
4059
+                '&session_id='.$this->session_id.'&group_id='.$this->group_id.'">'.
4060 4060
                 '</a></div>';
4061 4061
         }
4062 4062
 
4063
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
4063
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
4064 4064
             //only by professors if page is hidden
4065 4065
             $sql = 'SELECT * FROM '.$tbl_wiki.'
4066 4066
                     WHERE
@@ -4085,19 +4085,19 @@  discard block
 block discarded – undo
4085 4085
                 // Get time
4086 4086
                 $year 	 = substr($obj->dtime, 0, 4);
4087 4087
                 $month	 = substr($obj->dtime, 5, 2);
4088
-                $day 	 = substr($obj->dtime, 8, 2);
4089
-                $hours   = substr($obj->dtime, 11,2);
4090
-                $minutes = substr($obj->dtime, 14,2);
4091
-                $seconds = substr($obj->dtime, 17,2);
4088
+                $day = substr($obj->dtime, 8, 2);
4089
+                $hours   = substr($obj->dtime, 11, 2);
4090
+                $minutes = substr($obj->dtime, 14, 2);
4091
+                $seconds = substr($obj->dtime, 17, 2);
4092 4092
 
4093 4093
                 //get type assignment icon
4094 4094
                 $ShowAssignment = '';
4095
-                if ($obj->assignment==1) {
4096
-                    $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'),'',ICON_SIZE_SMALL);
4097
-                } elseif ($obj->assignment==2) {
4098
-                    $ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
4099
-                } elseif ($obj->assignment==0) {
4100
-                    $ShowAssignment= Display::return_icon('px_transparent.gif');
4095
+                if ($obj->assignment == 1) {
4096
+                    $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'), '', ICON_SIZE_SMALL);
4097
+                } elseif ($obj->assignment == 2) {
4098
+                    $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
4099
+                } elseif ($obj->assignment == 0) {
4100
+                    $ShowAssignment = Display::return_icon('px_transparent.gif');
4101 4101
                 }
4102 4102
 
4103 4103
                 $row = array();
@@ -4113,7 +4113,7 @@  discard block
 block discarded – undo
4113 4113
 
4114 4114
             }
4115 4115
 
4116
-            $table = new SortableTableFromArrayConfig($rows,2,10,'UsersContributions_table','','','ASC');
4116
+            $table = new SortableTableFromArrayConfig($rows, 2, 10, 'UsersContributions_table', '', '', 'ASC');
4117 4117
             $table->set_additional_parameters(
4118 4118
                 array(
4119 4119
                     'cidReq' => Security::remove_XSS($_GET['cidReq']),
@@ -4123,13 +4123,13 @@  discard block
 block discarded – undo
4123 4123
                     'group_id' => intval($_GET['group_id']),
4124 4124
                 )
4125 4125
             );
4126
-            $table->set_header(0,get_lang('Date'), true, array ('style' => 'width:200px;'));
4127
-            $table->set_header(1,get_lang('Type'), true, array ('style' => 'width:30px;'));
4128
-            $table->set_header(2,get_lang('Title'), true, array ('style' => 'width:200px;'));
4129
-            $table->set_header(3,get_lang('Version'), true, array ('style' => 'width:30px;'));
4130
-            $table->set_header(4,get_lang('Comment'), true, array ('style' => 'width:200px;'));
4131
-            $table->set_header(5,get_lang('Progress'), true, array ('style' => 'width:30px;'));
4132
-            $table->set_header(6,get_lang('Rating'), true, array ('style' => 'width:30px;'));
4126
+            $table->set_header(0, get_lang('Date'), true, array('style' => 'width:200px;'));
4127
+            $table->set_header(1, get_lang('Type'), true, array('style' => 'width:30px;'));
4128
+            $table->set_header(2, get_lang('Title'), true, array('style' => 'width:200px;'));
4129
+            $table->set_header(3, get_lang('Version'), true, array('style' => 'width:30px;'));
4130
+            $table->set_header(4, get_lang('Comment'), true, array('style' => 'width:200px;'));
4131
+            $table->set_header(5, get_lang('Progress'), true, array('style' => 'width:30px;'));
4132
+            $table->set_header(6, get_lang('Rating'), true, array('style' => 'width:30px;'));
4133 4133
             $table->display();
4134 4134
         }
4135 4135
     }
@@ -4147,7 +4147,7 @@  discard block
 block discarded – undo
4147 4147
 
4148 4148
         echo '<div class="actions">'.get_lang('MostChangedPages').'</div>';
4149 4149
 
4150
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { //only by professors if page is hidden
4150
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { //only by professors if page is hidden
4151 4151
             $sql = 'SELECT *, MAX(version) AS MAX FROM '.$tbl_wiki.'
4152 4152
                     WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.'
4153 4153
                     GROUP BY reflink';//TODO:check MAX and group by return last version
@@ -4165,12 +4165,12 @@  discard block
 block discarded – undo
4165 4165
             while ($obj = Database::fetch_object($allpages)) {
4166 4166
                 //get type assignment icon
4167 4167
                 $ShowAssignment = '';
4168
-                if ($obj->assignment==1) {
4169
-                    $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL);
4170
-                } elseif ($obj->assignment==2) {
4171
-                    $ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
4172
-                } elseif ($obj->assignment==0) {
4173
-                    $ShowAssignment= Display::return_icon('px_transparent.gif');
4168
+                if ($obj->assignment == 1) {
4169
+                    $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL);
4170
+                } elseif ($obj->assignment == 2) {
4171
+                    $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
4172
+                } elseif ($obj->assignment == 0) {
4173
+                    $ShowAssignment = Display::return_icon('px_transparent.gif');
4174 4174
                 }
4175 4175
 
4176 4176
                 $row = array();
@@ -4198,9 +4198,9 @@  discard block
 block discarded – undo
4198 4198
                     'group_id' => intval($_GET['group_id']),
4199 4199
                 )
4200 4200
             );
4201
-            $table->set_header(0,get_lang('Type'), true, array ('style' => 'width:30px;'));
4202
-            $table->set_header(1,get_lang('Title'), true);
4203
-            $table->set_header(2,get_lang('Changes'), true);
4201
+            $table->set_header(0, get_lang('Type'), true, array('style' => 'width:30px;'));
4202
+            $table->set_header(1, get_lang('Title'), true);
4203
+            $table->set_header(2, get_lang('Changes'), true);
4204 4204
             $table->display();
4205 4205
         }
4206 4206
     }
@@ -4225,7 +4225,7 @@  discard block
 block discarded – undo
4225 4225
         /* Only teachers and platform admin can edit the index page.
4226 4226
         Only teachers and platform admin can edit an assignment teacher*/
4227 4227
         if (($current_row['reflink'] == 'index' || $current_row['reflink'] == '' || $current_row['assignment'] == 1) &&
4228
-            (!api_is_allowed_to_edit(false,true) && $this->group_id == 0)
4228
+            (!api_is_allowed_to_edit(false, true) && $this->group_id == 0)
4229 4229
         ) {
4230 4230
             Display::addFlash(
4231 4231
                 Display::display_normal_message(get_lang('OnlyEditPagesCourseManager'), false, true)
@@ -4235,7 +4235,7 @@  discard block
 block discarded – undo
4235 4235
             // check if is a wiki group
4236 4236
             if ($current_row['group_id'] != 0) {
4237 4237
                 //Only teacher, platform admin and group members can edit a wiki group
4238
-                if (api_is_allowed_to_edit(false,true) ||
4238
+                if (api_is_allowed_to_edit(false, true) ||
4239 4239
                     api_is_platform_admin() ||
4240 4240
                     GroupManager :: is_user_in_group($userId, $this->group_id) ||
4241 4241
                     api_is_allowed_in_course()
@@ -4254,9 +4254,9 @@  discard block
 block discarded – undo
4254 4254
             //$icon_assignment = null;
4255 4255
             if ($current_row['assignment'] == 1) {
4256 4256
                 Display::addFlash(Display::display_normal_message(get_lang('EditAssignmentWarning'), false, true));
4257
-            } elseif($current_row['assignment']==2) {
4258
-                if (($userId == $current_row['user_id'])==false) {
4259
-                    if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
4257
+            } elseif ($current_row['assignment'] == 2) {
4258
+                if (($userId == $current_row['user_id']) == false) {
4259
+                    if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
4260 4260
                         $PassEdit = true;
4261 4261
                     } else {
4262 4262
                         Display::addFlash(Display::display_warning_message(get_lang('LockByTeacher'), false, true));
@@ -4270,11 +4270,11 @@  discard block
 block discarded – undo
4270 4270
             //show editor if edit is allowed
4271 4271
             if ($PassEdit) {
4272 4272
                 if ($current_row['editlock'] == 1 &&
4273
-                    (api_is_allowed_to_edit(false,true)==false || api_is_platform_admin()==false)
4273
+                    (api_is_allowed_to_edit(false, true) == false || api_is_platform_admin() == false)
4274 4274
                 ) {
4275 4275
                     Display::addFlash(Display::display_normal_message(get_lang('PageLockedExtra'), false, true));
4276 4276
                 } else {
4277
-                    if ($last_row['is_editing']!=0 && $last_row['is_editing'] != $userId) {
4277
+                    if ($last_row['is_editing'] != 0 && $last_row['is_editing'] != $userId) {
4278 4278
                         // Checking for concurrent users
4279 4279
                         $timestamp_edit = strtotime($last_row['time_edit']);
4280 4280
                         $time_editing = time() - $timestamp_edit;
@@ -4283,7 +4283,7 @@  discard block
 block discarded – undo
4283 4283
                         $userinfo = api_get_user_info($last_row['is_editing']);
4284 4284
                         $is_being_edited = get_lang('ThisPageisBeginEditedBy').' <a href='.$userinfo['profile_url'].'>'.
4285 4285
                             Display::tag('span', $userinfo['complete_name_with_username']).
4286
-                            get_lang('ThisPageisBeginEditedTryLater').' '.date( "i",$rest_time).' '.get_lang('MinMinutes');
4286
+                            get_lang('ThisPageisBeginEditedTryLater').' '.date("i", $rest_time).' '.get_lang('MinMinutes');
4287 4287
                         Display::addFlash(Display::display_normal_message($is_being_edited, false, true));
4288 4288
                     } else {
4289 4289
                         Display::addFlash(Display::display_confirmation_message(
@@ -4391,9 +4391,9 @@  discard block
 block discarded – undo
4391 4391
                 GROUP BY reflink
4392 4392
                 ORDER BY reflink ASC';
4393 4393
         $allpages = Database::query($sql);
4394
-        while ($row=Database::fetch_array($allpages)) {
4395
-            if ($row['reflink']=='index') {
4396
-                $row['reflink']=str_replace(' ', '_', get_lang('DefaultTitle'));
4394
+        while ($row = Database::fetch_array($allpages)) {
4395
+            if ($row['reflink'] == 'index') {
4396
+                $row['reflink'] = str_replace(' ', '_', get_lang('DefaultTitle'));
4397 4397
             }
4398 4398
             $pages[] = $row['reflink'];
4399 4399
         }
@@ -4411,16 +4411,16 @@  discard block
 block discarded – undo
4411 4411
 
4412 4412
         $allpages = Database::query($sql);
4413 4413
 
4414
-        while ($row=Database::fetch_array($allpages)) {
4414
+        while ($row = Database::fetch_array($allpages)) {
4415 4415
             //remove self reference
4416
-            $row['linksto']= str_replace($row["reflink"], " ", trim($row["linksto"]));
4416
+            $row['linksto'] = str_replace($row["reflink"], " ", trim($row["linksto"]));
4417 4417
             $refs = explode(" ", trim($row["linksto"]));
4418 4418
 
4419 4419
             // Find linksto into reflink. If found ->page is linked
4420 4420
             foreach ($refs as $v) {
4421 4421
                 if (in_array($v, $pages)) {
4422
-                    if (trim($v)!="") {
4423
-                        $linked[]=$v;
4422
+                    if (trim($v) != "") {
4423
+                        $linked[] = $v;
4424 4424
                     }
4425 4425
                 }
4426 4426
             }
@@ -4432,12 +4432,12 @@  discard block
 block discarded – undo
4432 4432
         $rows = array();
4433 4433
         foreach ($linked as $linked_show) {
4434 4434
             $row = array();
4435
-            $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']).'">'.
4436
-                str_replace('_',' ',$linked_show).'</a>';
4435
+            $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']).'">'.
4436
+                str_replace('_', ' ', $linked_show).'</a>';
4437 4437
             $rows[] = $row;
4438 4438
         }
4439 4439
 
4440
-        $table = new SortableTableFromArrayConfig($rows,0,10,'LinkedPages_table','','','DESC');
4440
+        $table = new SortableTableFromArrayConfig($rows, 0, 10, 'LinkedPages_table', '', '', 'DESC');
4441 4441
         $table->set_additional_parameters(
4442 4442
             array(
4443 4443
                 'cidReq' => Security::remove_XSS($_GET['cidReq']),
@@ -4446,7 +4446,7 @@  discard block
 block discarded – undo
4446 4446
                 'group_id' => intval($_GET['group_id']),
4447 4447
             )
4448 4448
         );
4449
-        $table->set_header(0,get_lang('Title'), true);
4449
+        $table->set_header(0, get_lang('Title'), true);
4450 4450
         $table->display();
4451 4451
     }
4452 4452
 
@@ -4471,8 +4471,8 @@  discard block
 block discarded – undo
4471 4471
                 WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.'
4472 4472
                 GROUP BY reflink
4473 4473
                 ORDER BY reflink ASC';
4474
-        $allpages=Database::query($sql);
4475
-        while ($row=Database::fetch_array($allpages)) {
4474
+        $allpages = Database::query($sql);
4475
+        while ($row = Database::fetch_array($allpages)) {
4476 4476
             $pages[] = $row['reflink'];
4477 4477
         }
4478 4478
 
@@ -4487,14 +4487,14 @@  discard block
 block discarded – undo
4487 4487
                 )';
4488 4488
         $allpages = Database::query($sql);
4489 4489
         $array_refs_linked = array();
4490
-        while ($row=Database::fetch_array($allpages)) {
4491
-            $row['linksto']= str_replace($row["reflink"], " ", trim($row["linksto"])); //remove self reference
4490
+        while ($row = Database::fetch_array($allpages)) {
4491
+            $row['linksto'] = str_replace($row["reflink"], " ", trim($row["linksto"])); //remove self reference
4492 4492
             $refs = explode(" ", trim($row["linksto"]));
4493
-            foreach ($refs as $ref_linked){
4494
-                if ($ref_linked==str_replace(' ','_',get_lang('DefaultTitle'))) {
4495
-                    $ref_linked='index';
4493
+            foreach ($refs as $ref_linked) {
4494
+                if ($ref_linked == str_replace(' ', '_', get_lang('DefaultTitle'))) {
4495
+                    $ref_linked = 'index';
4496 4496
                 }
4497
-                $array_refs_linked[]= $ref_linked;
4497
+                $array_refs_linked[] = $ref_linked;
4498 4498
             }
4499 4499
         }
4500 4500
 
@@ -4516,20 +4516,20 @@  discard block
 block discarded – undo
4516 4516
 		                '.$groupfilter.$condition_session.' AND
4517 4517
 		                reflink="'.Database::escape_string($orphaned_show).'"
4518 4518
                     GROUP BY reflink';
4519
-            $allpages=Database::query($sql);
4520
-            while ($row=Database::fetch_array($allpages)) {
4521
-                $orphaned_title=$row['title'];
4522
-                $orphaned_visibility=$row['visibility'];
4523
-                if ($row['assignment']==1) {
4524
-                    $ShowAssignment=Display::return_icon('wiki_assignment.png','','',ICON_SIZE_SMALL);
4525
-                } elseif ($row['assignment']==2) {
4526
-                    $ShowAssignment=Display::return_icon('wiki_work.png','','',ICON_SIZE_SMALL);
4527
-                } elseif ($row['assignment']==0) {
4528
-                    $ShowAssignment= Display::return_icon('px_transparent.gif');
4519
+            $allpages = Database::query($sql);
4520
+            while ($row = Database::fetch_array($allpages)) {
4521
+                $orphaned_title = $row['title'];
4522
+                $orphaned_visibility = $row['visibility'];
4523
+                if ($row['assignment'] == 1) {
4524
+                    $ShowAssignment = Display::return_icon('wiki_assignment.png', '', '', ICON_SIZE_SMALL);
4525
+                } elseif ($row['assignment'] == 2) {
4526
+                    $ShowAssignment = Display::return_icon('wiki_work.png', '', '', ICON_SIZE_SMALL);
4527
+                } elseif ($row['assignment'] == 0) {
4528
+                    $ShowAssignment = Display::return_icon('px_transparent.gif');
4529 4529
                 }
4530 4530
             }
4531 4531
 
4532
-            if (!api_is_allowed_to_edit(false,true) || !api_is_platform_admin() && $orphaned_visibility==0){
4532
+            if (!api_is_allowed_to_edit(false, true) || !api_is_platform_admin() && $orphaned_visibility == 0) {
4533 4533
                 continue;
4534 4534
             }
4535 4535
 
@@ -4541,7 +4541,7 @@  discard block
 block discarded – undo
4541 4541
             $rows[] = $row;
4542 4542
         }
4543 4543
 
4544
-        $table = new SortableTableFromArrayConfig($rows,1, 10, 'OrphanedPages_table','','','DESC');
4544
+        $table = new SortableTableFromArrayConfig($rows, 1, 10, 'OrphanedPages_table', '', '', 'DESC');
4545 4545
         $table->set_additional_parameters(
4546 4546
             array(
4547 4547
                 'cidReq' => Security::remove_XSS($_GET['cidReq']),
@@ -4550,8 +4550,8 @@  discard block
 block discarded – undo
4550 4550
                 'group_id' => intval($_GET['group_id']),
4551 4551
             )
4552 4552
         );
4553
-        $table->set_header(0,get_lang('Type'), true, array ('style' => 'width:30px;'));
4554
-        $table->set_header(1,get_lang('Title'), true);
4553
+        $table->set_header(0, get_lang('Type'), true, array('style' => 'width:30px;'));
4554
+        $table->set_header(1, get_lang('Title'), true);
4555 4555
         $table->display();
4556 4556
     }
4557 4557
 
@@ -4573,11 +4573,11 @@  discard block
 block discarded – undo
4573 4573
                 WHERE  c_id = '.$course_id.' AND '.$groupfilter.$condition_session.'
4574 4574
                 GROUP BY reflink
4575 4575
                 ORDER BY reflink ASC';
4576
-        $allpages=Database::query($sql);
4576
+        $allpages = Database::query($sql);
4577 4577
 
4578
-        while ($row=Database::fetch_array($allpages)) {
4579
-            if ($row['reflink']=='index'){
4580
-                $row['reflink']=str_replace(' ','_',get_lang('DefaultTitle'));
4578
+        while ($row = Database::fetch_array($allpages)) {
4579
+            if ($row['reflink'] == 'index') {
4580
+                $row['reflink'] = str_replace(' ', '_', get_lang('DefaultTitle'));
4581 4581
             }
4582 4582
             $pages[] = $row['reflink'];
4583 4583
         }
@@ -4591,31 +4591,31 @@  discard block
 block discarded – undo
4591 4591
 
4592 4592
         $allpages = Database::query($sql);
4593 4593
 
4594
-        while ($row=Database::fetch_array($allpages)) {
4594
+        while ($row = Database::fetch_array($allpages)) {
4595 4595
             $refs = explode(" ", trim($row["linksto"]));
4596 4596
             // Find linksto into reflink. If not found ->page is wanted
4597 4597
             foreach ($refs as $v) {
4598 4598
 
4599 4599
                 if (!in_array($v, $pages)) {
4600
-                    if (trim($v)!="") {
4601
-                        $wanted[]=$v;
4600
+                    if (trim($v) != "") {
4601
+                        $wanted[] = $v;
4602 4602
                     }
4603 4603
                 }
4604 4604
             }
4605 4605
         }
4606 4606
 
4607
-        $wanted = array_unique($wanted);//make a unique list
4607
+        $wanted = array_unique($wanted); //make a unique list
4608 4608
 
4609 4609
         //show table
4610 4610
         $rows = array();
4611 4611
         foreach ($wanted as $wanted_show) {
4612 4612
             $row = array();
4613 4613
             $wanted_show = Security::remove_XSS($wanted_show);
4614
-            $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
4614
+            $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
4615 4615
             $rows[] = $row;
4616 4616
         }
4617 4617
 
4618
-        $table = new SortableTableFromArrayConfig($rows,0,10,'WantedPages_table','','','DESC');
4618
+        $table = new SortableTableFromArrayConfig($rows, 0, 10, 'WantedPages_table', '', '', 'DESC');
4619 4619
         $table->set_additional_parameters(
4620 4620
             array(
4621 4621
                 'cidReq' => Security::remove_XSS($_GET['cidReq']),
@@ -4624,7 +4624,7 @@  discard block
 block discarded – undo
4624 4624
                 'group_id' => intval($_GET['group_id']),
4625 4625
             )
4626 4626
         );
4627
-        $table->set_header(0,get_lang('Title'), true);
4627
+        $table->set_header(0, get_lang('Title'), true);
4628 4628
         $table->display();
4629 4629
     }
4630 4630
 
@@ -4641,7 +4641,7 @@  discard block
 block discarded – undo
4641 4641
 
4642 4642
         echo '<div class="actions">'.get_lang('MostVisitedPages').'</div>';
4643 4643
 
4644
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { //only by professors if page is hidden
4644
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { //only by professors if page is hidden
4645 4645
             $sql = 'SELECT *, SUM(hits) AS tsum FROM '.$tbl_wiki.'
4646 4646
                     WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.'
4647 4647
                     GROUP BY reflink';
@@ -4662,11 +4662,11 @@  discard block
 block discarded – undo
4662 4662
             while ($obj = Database::fetch_object($allpages)) {
4663 4663
                 //get type assignment icon
4664 4664
                 $ShowAssignment = '';
4665
-                if ($obj->assignment==1) {
4666
-                    $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL);
4667
-                } elseif ($obj->assignment==2) {
4668
-                    $ShowAssignment=$ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
4669
-                } elseif ($obj->assignment==0) {
4665
+                if ($obj->assignment == 1) {
4666
+                    $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL);
4667
+                } elseif ($obj->assignment == 2) {
4668
+                    $ShowAssignment = $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
4669
+                } elseif ($obj->assignment == 0) {
4670 4670
                     $ShowAssignment = Display::return_icon('px_transparent.gif');
4671 4671
                 }
4672 4672
 
@@ -4695,7 +4695,7 @@  discard block
 block discarded – undo
4695 4695
                     'group_id' => intval($_GET['group_id']),
4696 4696
                 )
4697 4697
             );
4698
-            $table->set_header(0,get_lang('Type'), true, array ('style' => 'width:30px;'));
4698
+            $table->set_header(0, get_lang('Type'), true, array('style' => 'width:30px;'));
4699 4699
             $table->set_header(1, get_lang('Title'), true);
4700 4700
             $table->set_header(2, get_lang('Visits'), true);
4701 4701
             $table->display();
@@ -4720,8 +4720,8 @@  discard block
 block discarded – undo
4720 4720
 
4721 4721
         if (api_is_allowed_to_session_edit(false, true) && api_is_allowed_to_edit()) {
4722 4722
             // menu add page
4723
-            $actionsLeft .= '<a href="index.php?cidReq=' . $_course['id'] . '&action=addnew&session_id=' . $session_id . '&group_id=' . $groupId . '"' . self::is_active_navigation_tab('addnew').'>'
4724
-            . Display::return_icon('add.png', get_lang('AddNew'), '', ICON_SIZE_MEDIUM) . '</a>';
4723
+            $actionsLeft .= '<a href="index.php?cidReq='.$_course['id'].'&action=addnew&session_id='.$session_id.'&group_id='.$groupId.'"'.self::is_active_navigation_tab('addnew').'>'
4724
+            . Display::return_icon('add.png', get_lang('AddNew'), '', ICON_SIZE_MEDIUM).'</a>';
4725 4725
         }
4726 4726
 
4727 4727
         $lock_unlock_addnew = null;
@@ -4729,12 +4729,12 @@  discard block
 block discarded – undo
4729 4729
 
4730 4730
         if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
4731 4731
             // page action: enable or disable the adding of new pages
4732
-            if (self::check_addnewpagelock()==0) {
4732
+            if (self::check_addnewpagelock() == 0) {
4733 4733
                 $protect_addnewpage = Display::return_icon('off.png', get_lang('AddOptionProtected'));
4734
-                $lock_unlock_addnew ='unlockaddnew';
4734
+                $lock_unlock_addnew = 'unlockaddnew';
4735 4735
             } else {
4736 4736
                 $protect_addnewpage = Display::return_icon('on.png', get_lang('AddOptionUnprotected'));
4737
-                $lock_unlock_addnew ='lockaddnew';
4737
+                $lock_unlock_addnew = 'lockaddnew';
4738 4738
             }
4739 4739
         }
4740 4740
 
@@ -4770,7 +4770,7 @@  discard block
 block discarded – undo
4770 4770
             return;
4771 4771
         }
4772 4772
 
4773
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
4773
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
4774 4774
             Display::addFlash('<div id="wikititle">'.get_lang('DeletePageHistory').'</div>');
4775 4775
 
4776 4776
             if ($page == "index") {
@@ -4812,7 +4812,7 @@  discard block
 block discarded – undo
4812 4812
         $userId = api_get_user_id();
4813 4813
 
4814 4814
         if (api_get_session_id() != 0 &&
4815
-            api_is_allowed_to_session_edit(false,true) == false
4815
+            api_is_allowed_to_session_edit(false, true) == false
4816 4816
         ) {
4817 4817
             api_not_allowed();
4818 4818
         }
@@ -4835,12 +4835,12 @@  discard block
 block discarded – undo
4835 4835
                 Display::display_error_message(get_lang('MustSelectPage'), false, true)
4836 4836
             );
4837 4837
             return;
4838
-        } elseif ($row['content']=='' && $row['title']=='' && $page=='index') {
4838
+        } elseif ($row['content'] == '' && $row['title'] == '' && $page == 'index') {
4839 4839
 
4840 4840
             // Table structure for better export to pdf
4841 4841
             $default_table_for_content_Start = '<table align="center" border="0"><tr><td align="center">';
4842 4842
             $default_table_for_content_End = '</td></tr></table>';
4843
-            $content = $default_table_for_content_Start.sprintf(get_lang('DefaultContent'),api_get_path(WEB_IMG_PATH)).$default_table_for_content_End;
4843
+            $content = $default_table_for_content_Start.sprintf(get_lang('DefaultContent'), api_get_path(WEB_IMG_PATH)).$default_table_for_content_End;
4844 4844
             $title = get_lang('DefaultTitle');
4845 4845
             $page_id = 0;
4846 4846
         } else {
@@ -4866,7 +4866,7 @@  discard block
 block discarded – undo
4866 4866
             // Check if is a wiki group
4867 4867
             if (!empty($groupId)) {
4868 4868
                 //Only teacher, platform admin and group members can edit a wiki group
4869
-                if (api_is_allowed_to_edit(false,true) ||
4869
+                if (api_is_allowed_to_edit(false, true) ||
4870 4870
                     api_is_platform_admin() ||
4871 4871
                     GroupManager :: is_user_in_group($userId, $groupId)
4872 4872
                 ) {
@@ -4879,7 +4879,7 @@  discard block
 block discarded – undo
4879 4879
                     );
4880 4880
                 }
4881 4881
             } else {
4882
-                $PassEdit=true;
4882
+                $PassEdit = true;
4883 4883
             }
4884 4884
 
4885 4885
             $icon_assignment = null;
@@ -4889,10 +4889,10 @@  discard block
 block discarded – undo
4889 4889
                     Display::return_message(get_lang('EditAssignmentWarning'))
4890 4890
                 );
4891 4891
 
4892
-                $icon_assignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'),'',ICON_SIZE_SMALL);
4892
+                $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'), '', ICON_SIZE_SMALL);
4893 4893
             } elseif ($row['assignment'] == 2) {
4894
-                $icon_assignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWorkExtra'),'',ICON_SIZE_SMALL);
4895
-                if (($userId == $row['user_id'])==false) {
4894
+                $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWorkExtra'), '', ICON_SIZE_SMALL);
4895
+                if (($userId == $row['user_id']) == false) {
4896 4896
                     if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
4897 4897
                         $PassEdit = true;
4898 4898
                     } else {
@@ -4912,7 +4912,7 @@  discard block
 block discarded – undo
4912 4912
             if ($PassEdit) {
4913 4913
                 //show editor if edit is allowed <<<<<
4914 4914
                 if ($row['editlock'] == 1 &&
4915
-                    (api_is_allowed_to_edit(false, true) == false || api_is_platform_admin()==false)
4915
+                    (api_is_allowed_to_edit(false, true) == false || api_is_platform_admin() == false)
4916 4916
                 ) {
4917 4917
                     Display::addFlash(
4918 4918
                         Display::return_message(
@@ -4922,7 +4922,7 @@  discard block
 block discarded – undo
4922 4922
                 } else {
4923 4923
                     // Check tasks
4924 4924
 
4925
-                    if (!empty($row['startdate_assig']) &&  time() < api_strtotime($row['startdate_assig'])
4925
+                    if (!empty($row['startdate_assig']) && time() < api_strtotime($row['startdate_assig'])
4926 4926
                     ) {
4927 4927
                         $message = get_lang('TheTaskDoesNotBeginUntil').': '.api_get_local_time($row['startdate_assig']);
4928 4928
 
@@ -4940,7 +4940,7 @@  discard block
 block discarded – undo
4940 4940
 
4941 4941
                     if (!empty($row['enddate_assig']) &&
4942 4942
                         time() > strtotime($row['enddate_assig']) &&
4943
-                        $row['delayedsubmit']==0
4943
+                        $row['delayedsubmit'] == 0
4944 4944
                     ) {
4945 4945
                         $message = get_lang('TheDeadlineHasBeenCompleted').': '.api_get_local_time($row['enddate_assig']);
4946 4946
                         Display::addFlash(
@@ -4949,20 +4949,20 @@  discard block
 block discarded – undo
4949 4949
                                 'warning'
4950 4950
                             )
4951 4951
                         );
4952
-                        if (!api_is_allowed_to_edit(false,true)) {
4952
+                        if (!api_is_allowed_to_edit(false, true)) {
4953 4953
                             $this->redirectHome();
4954 4954
                         }
4955 4955
                     }
4956 4956
 
4957
-                    if (!empty($row['max_version']) && $row['version']>=$row['max_version']) {
4958
-                        $message=get_lang('HasReachedMaxiNumVersions');
4957
+                    if (!empty($row['max_version']) && $row['version'] >= $row['max_version']) {
4958
+                        $message = get_lang('HasReachedMaxiNumVersions');
4959 4959
                         Display::addFlash(
4960 4960
                             Display::return_message(
4961 4961
                                 $message,
4962 4962
                                 'warning'
4963 4963
                             )
4964 4964
                         );
4965
-                        if (!api_is_allowed_to_edit(false,true)) {
4965
+                        if (!api_is_allowed_to_edit(false, true)) {
4966 4966
                             $this->redirectHome();
4967 4967
                         }
4968 4968
                     }
@@ -4975,7 +4975,7 @@  discard block
 block discarded – undo
4975 4975
                                 'warning'
4976 4976
                             )
4977 4977
                         );
4978
-                        if (!api_is_allowed_to_edit(false,true)) {
4978
+                        if (!api_is_allowed_to_edit(false, true)) {
4979 4979
                             $this->redirectHome();
4980 4980
                         }
4981 4981
                     }
@@ -4983,7 +4983,7 @@  discard block
 block discarded – undo
4983 4983
                     if (!empty($row['task'])) {
4984 4984
                         //previous change 0 by text
4985 4985
                         if (!empty($row['startdate_assig'])) {
4986
-                            $message_task_startdate  =get_lang('No');
4986
+                            $message_task_startdate = get_lang('No');
4987 4987
                         } else {
4988 4988
                             $message_task_startdate = api_get_local_time($row['startdate_assig']);
4989 4989
                         }
@@ -4994,31 +4994,31 @@  discard block
 block discarded – undo
4994 4994
                             $message_task_enddate = api_get_local_time($row['enddate_assig']);
4995 4995
                         }
4996 4996
 
4997
-                        if ($row['delayedsubmit']==0) {
4998
-                            $message_task_delayedsubmit=get_lang('No');
4997
+                        if ($row['delayedsubmit'] == 0) {
4998
+                            $message_task_delayedsubmit = get_lang('No');
4999 4999
                         } else {
5000
-                            $message_task_delayedsubmit=get_lang('Yes');
5000
+                            $message_task_delayedsubmit = get_lang('Yes');
5001 5001
                         }
5002 5002
 
5003
-                        if ($row['max_version']==0) {
5004
-                            $message_task_max_version=get_lang('No');
5003
+                        if ($row['max_version'] == 0) {
5004
+                            $message_task_max_version = get_lang('No');
5005 5005
                         } else {
5006
-                            $message_task_max_version=$row['max_version'];
5006
+                            $message_task_max_version = $row['max_version'];
5007 5007
                         }
5008 5008
 
5009
-                        if ($row['max_text']==0) {
5010
-                            $message_task_max_text=get_lang('No');
5009
+                        if ($row['max_text'] == 0) {
5010
+                            $message_task_max_text = get_lang('No');
5011 5011
                         } else {
5012
-                            $message_task_max_text=$row['max_text'];
5012
+                            $message_task_max_text = $row['max_text'];
5013 5013
                         }
5014 5014
 
5015 5015
                         // Comp message
5016
-                        $message_task='<b>'.get_lang('DescriptionOfTheTask').'</b><p>'.$row['task'].'</p><hr>';
5017
-                        $message_task.='<p>'.get_lang('StartDate').': '.$message_task_startdate.'</p>';
5018
-                        $message_task.='<p>'.get_lang('EndDate').': '.$message_task_enddate;
5019
-                        $message_task.=' ('.get_lang('AllowLaterSends').') '.$message_task_delayedsubmit.'</p>';
5020
-                        $message_task.='<p>'.get_lang('OtherSettings').': '.get_lang('NMaxVersion').': '.$message_task_max_version;
5021
-                        $message_task.=' '.get_lang('NMaxWords').': '.$message_task_max_text;
5016
+                        $message_task = '<b>'.get_lang('DescriptionOfTheTask').'</b><p>'.$row['task'].'</p><hr>';
5017
+                        $message_task .= '<p>'.get_lang('StartDate').': '.$message_task_startdate.'</p>';
5018
+                        $message_task .= '<p>'.get_lang('EndDate').': '.$message_task_enddate;
5019
+                        $message_task .= ' ('.get_lang('AllowLaterSends').') '.$message_task_delayedsubmit.'</p>';
5020
+                        $message_task .= '<p>'.get_lang('OtherSettings').': '.get_lang('NMaxVersion').': '.$message_task_max_version;
5021
+                        $message_task .= ' '.get_lang('NMaxWords').': '.$message_task_max_text;
5022 5022
                         // Display message
5023 5023
                         Display::addFlash(
5024 5024
                             Display::return_message(
@@ -5029,11 +5029,11 @@  discard block
 block discarded – undo
5029 5029
 
5030 5030
                     $feedback_message = '';
5031 5031
                     if ($row['progress'] == $row['fprogress1'] && !empty($row['fprogress1'])) {
5032
-                        $feedback_message='<b>'.get_lang('Feedback').'</b><p>'.api_htmlentities($row['feedback1']).'</p>';
5032
+                        $feedback_message = '<b>'.get_lang('Feedback').'</b><p>'.api_htmlentities($row['feedback1']).'</p>';
5033 5033
                     } elseif ($row['progress'] == $row['fprogress2'] && !empty($row['fprogress2'])) {
5034
-                        $feedback_message='<b>'.get_lang('Feedback').'</b><p>'.api_htmlentities($row['feedback2']).'</p>';
5034
+                        $feedback_message = '<b>'.get_lang('Feedback').'</b><p>'.api_htmlentities($row['feedback2']).'</p>';
5035 5035
                     } elseif ($row['progress'] == $row['fprogress3'] && !empty($row['fprogress3'])) {
5036
-                        $feedback_message='<b>'.get_lang('Feedback').'</b><p>'.api_htmlentities($row['feedback3']).'</p>';
5036
+                        $feedback_message = '<b>'.get_lang('Feedback').'</b><p>'.api_htmlentities($row['feedback3']).'</p>';
5037 5037
                     }
5038 5038
 
5039 5039
                     if (!empty($feedback_message)) {
@@ -5058,15 +5058,15 @@  discard block
 block discarded – undo
5058 5058
                                 WHERE c_id = '.$course_id.' AND id="'.$row['id'].'"';
5059 5059
                         Database::query($sql);
5060 5060
                     } elseif ($row['is_editing'] != $userId) {
5061
-                        $timestamp_edit=strtotime($row['time_edit']);
5061
+                        $timestamp_edit = strtotime($row['time_edit']);
5062 5062
                         $time_editing = time() - $timestamp_edit;
5063 5063
                         $max_edit_time = 1200; // 20 minutes
5064 5064
                         $rest_time = $max_edit_time - $time_editing;
5065 5065
 
5066 5066
                         $userinfo = api_get_user_info($row['is_editing']);
5067 5067
                         if ($userinfo !== false) {
5068
-                            $is_being_edited = get_lang('ThisPageisBeginEditedBy') . ' ' . UserManager::getUserProfileLink($userinfo) . '
5069
-                            ' . get_lang('ThisPageisBeginEditedTryLater') . ' ' . date("i", $rest_time) . ' ' . get_lang('MinMinutes') . '';
5068
+                            $is_being_edited = get_lang('ThisPageisBeginEditedBy').' '.UserManager::getUserProfileLink($userinfo).'
5069
+                            ' . get_lang('ThisPageisBeginEditedTryLater').' '.date("i", $rest_time).' '.get_lang('MinMinutes').'';
5070 5070
                         }
5071 5071
 
5072 5072
                         Display::addFlash(
@@ -5083,7 +5083,7 @@  discard block
 block discarded – undo
5083 5083
                     // Form.
5084 5084
                     $url = api_get_self().'?action=edit&title='.urlencode($page).'&session_id='.api_get_session_id().'&group_id='.api_get_group_id().'&'.api_get_cidreq();
5085 5085
                     $form = new FormValidator('wiki', 'post', $url);
5086
-                    $form->addElement('header', $icon_assignment.str_repeat('&nbsp;',3).api_htmlentities($title));
5086
+                    $form->addElement('header', $icon_assignment.str_repeat('&nbsp;', 3).api_htmlentities($title));
5087 5087
                     self::setForm($form, $row);
5088 5088
                     $form->addElement('hidden', 'title');
5089 5089
                     $form->addElement('button', 'SaveWikiChange', get_lang('Save'));
@@ -5169,7 +5169,7 @@  discard block
 block discarded – undo
5169 5169
         $KeyAssignment = null;
5170 5170
         $KeyTitle = null;
5171 5171
         $KeyUserId = null;
5172
-        while ($row=Database::fetch_array($result)) {
5172
+        while ($row = Database::fetch_array($result)) {
5173 5173
             $KeyVisibility = $row['visibility'];
5174 5174
             $KeyAssignment = $row['assignment'];
5175 5175
             $KeyTitle = $row['title'];
@@ -5178,7 +5178,7 @@  discard block
 block discarded – undo
5178 5178
         $icon_assignment = null;
5179 5179
         if ($KeyAssignment == 1) {
5180 5180
             $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'), '', ICON_SIZE_SMALL);
5181
-        } elseif($KeyAssignment == 2) {
5181
+        } elseif ($KeyAssignment == 2) {
5182 5182
             $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWorkExtra'), '', ICON_SIZE_SMALL);
5183 5183
         }
5184 5184
 
@@ -5186,10 +5186,10 @@  discard block
 block discarded – undo
5186 5186
 
5187 5187
         //if the page is hidden and is a job only sees its author and professor
5188 5188
         if ($KeyVisibility == 1 ||
5189
-            api_is_allowed_to_edit(false,true) ||
5189
+            api_is_allowed_to_edit(false, true) ||
5190 5190
             api_is_platform_admin() ||
5191 5191
             (
5192
-                $KeyAssignment==2 && $KeyVisibility==0 &&
5192
+                $KeyAssignment == 2 && $KeyVisibility == 0 &&
5193 5193
                 ($userId == $KeyUserId)
5194 5194
             )
5195 5195
         ) {
@@ -5219,7 +5219,7 @@  discard block
 block discarded – undo
5219 5219
                     get_lang('ShowDifferences').' '.get_lang('WordsDiff').'</button>';
5220 5220
                 echo '<br/><br/>';
5221 5221
 
5222
-                $counter=0;
5222
+                $counter = 0;
5223 5223
                 $total_versions = Database::num_rows($result);
5224 5224
 
5225 5225
                 while ($row = Database::fetch_array($result)) {
@@ -5227,10 +5227,10 @@  discard block
 block discarded – undo
5227 5227
                     $username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username']), ENT_QUOTES);
5228 5228
 
5229 5229
                     echo '<li style="margin-bottom: 5px;">';
5230
-                    ($counter==0) ? $oldstyle='style="visibility: hidden;"':$oldstyle='';
5231
-                    ($counter==0) ? $newchecked=' checked': $newchecked='';
5232
-                    ($counter==$total_versions-1) ? $newstyle='style="visibility: hidden;"':$newstyle='';
5233
-                    ($counter==1) ? $oldchecked=' checked':$oldchecked='';
5230
+                    ($counter == 0) ? $oldstyle = 'style="visibility: hidden;"' : $oldstyle = '';
5231
+                    ($counter == 0) ? $newchecked = ' checked' : $newchecked = '';
5232
+                    ($counter == $total_versions - 1) ? $newstyle = 'style="visibility: hidden;"' : $newstyle = '';
5233
+                    ($counter == 1) ? $oldchecked = ' checked' : $oldchecked = '';
5234 5234
                     echo '<input name="old" value="'.$row['id'].'" type="radio" '.$oldstyle.' '.$oldchecked.'/> ';
5235 5235
                     echo '<input name="new" value="'.$row['id'].'" type="radio" '.$newstyle.' '.$newchecked.'/> ';
5236 5236
                     echo '<a href="'.api_get_self().'?action=showpage&amp;title='.api_htmlentities(urlencode($page)).'&amp;view='.$row['id'].'">';
@@ -5250,8 +5250,8 @@  discard block
 block discarded – undo
5250 5250
                         $comment = api_substr($comment, 0, 100);
5251 5251
                         if ($comment !== false) {
5252 5252
                             $comment = api_htmlentities($comment);
5253
-                            echo get_lang('Comments').': ' . $comment;
5254
-                            if (api_strlen($row['comment'])>100) {
5253
+                            echo get_lang('Comments').': '.$comment;
5254
+                            if (api_strlen($row['comment']) > 100) {
5255 5255
                                 echo '... ';
5256 5256
                             }
5257 5257
                         }
@@ -5277,8 +5277,8 @@  discard block
 block discarded – undo
5277 5277
 
5278 5278
                 $sql_new = "SELECT * FROM $tbl_wiki
5279 5279
                             WHERE c_id = $course_id AND id='".Database::escape_string($_POST['new'])."'";
5280
-                $result_new=Database::query($sql_new);
5281
-                $version_new=Database::fetch_array($result_new);
5280
+                $result_new = Database::query($sql_new);
5281
+                $version_new = Database::fetch_array($result_new);
5282 5282
                 $oldTime = isset($version_old['dtime']) ? $version_old['dtime'] : null;
5283 5283
                 $oldContent = isset($version_old['content']) ? $version_old['content'] : null;
5284 5284
 
@@ -5305,9 +5305,9 @@  discard block
 block discarded – undo
5305 5305
 
5306 5306
 
5307 5307
                 if (isset($_POST['HistoryDifferences'])) {
5308
-                    echo '<table>'.diff($oldContent, $version_new['content'], true, 'format_table_line' ).'</table>'; // format_line mode is better for words
5308
+                    echo '<table>'.diff($oldContent, $version_new['content'], true, 'format_table_line').'</table>'; // format_line mode is better for words
5309 5309
                     echo '<br />';
5310
-                    echo '<strong>'.get_lang('Legend').'</strong><div class="diff">' . "\n";
5310
+                    echo '<strong>'.get_lang('Legend').'</strong><div class="diff">'."\n";
5311 5311
                     echo '<table><tr>';
5312 5312
                     echo  '<td>';
5313 5313
                     echo '</td><td>';
@@ -5326,7 +5326,7 @@  discard block
 block discarded – undo
5326 5326
                     $renderer = new Text_Diff_Renderer_inline();
5327 5327
                     echo '<style>del{background:#fcc}ins{background:#cfc}</style>'.$renderer->render($diff); // Code inline
5328 5328
                     echo '<br />';
5329
-                    echo '<strong>'.get_lang('Legend').'</strong><div class="diff">' . "\n";
5329
+                    echo '<strong>'.get_lang('Legend').'</strong><div class="diff">'."\n";
5330 5330
                     echo '<table><tr>';
5331 5331
                     echo  '<td>';
5332 5332
                     echo '</td><td>';
@@ -5374,7 +5374,7 @@  discard block
 block discarded – undo
5374 5374
         echo '<td style="vertical-align:top">';
5375 5375
         echo '<ul>';
5376 5376
         // Submenu Statistics
5377
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
5377
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
5378 5378
             echo '<li><a href="index.php?cidReq='.$_course['id'].'&action=statistics&session_id='.$session_id.'&group_id='.$groupId.'">'.get_lang('Statistics').'</a></li>';
5379 5379
         }
5380 5380
         echo '      </ul>';
@@ -5447,7 +5447,7 @@  discard block
 block discarded – undo
5447 5447
                 break;
5448 5448
             case 'deletewiki':
5449 5449
                 $title = '<div class="actions">'.get_lang('DeleteWiki').'</div>';
5450
-                if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
5450
+                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
5451 5451
                     $message = get_lang('ConfirmDeleteWiki');
5452 5452
                     $message .= '<p>
5453 5453
                         <a href="index.php?'.api_get_cidreq().'">'.get_lang('No').'</a>
@@ -5478,14 +5478,14 @@  discard block
 block discarded – undo
5478 5478
                 self::getLinks($page);
5479 5479
                 break;
5480 5480
             case 'addnew':
5481
-                if (api_get_session_id()!=0 && api_is_allowed_to_session_edit(false,true)==false) {
5481
+                if (api_get_session_id() != 0 && api_is_allowed_to_session_edit(false, true) == false) {
5482 5482
                     api_not_allowed();
5483 5483
                 }
5484 5484
                 echo '<div class="actions">'.get_lang('AddNew').'</div>';
5485 5485
                 echo '<br/>';
5486 5486
                 //first, check if page index was created. chektitle=false
5487 5487
                 if (self::checktitle('index')) {
5488
-                    if (api_is_allowed_to_edit(false,true) ||
5488
+                    if (api_is_allowed_to_edit(false, true) ||
5489 5489
                         api_is_platform_admin() ||
5490 5490
                         GroupManager::is_user_in_group(api_get_user_id(), api_get_group_id()) ||
5491 5491
                         api_is_allowed_in_course()
@@ -5494,10 +5494,10 @@  discard block
 block discarded – undo
5494 5494
                     } else {
5495 5495
                         Display::addFlash(Display::display_normal_message(get_lang('WikiStandBy'), false, true));
5496 5496
                     }
5497
-                } elseif (self::check_addnewpagelock()==0 && (api_is_allowed_to_edit(false, true)==false || api_is_platform_admin()==false)) {
5497
+                } elseif (self::check_addnewpagelock() == 0 && (api_is_allowed_to_edit(false, true) == false || api_is_platform_admin() == false)) {
5498 5498
                     Display::addFlash(Display::display_error_message(get_lang('AddPagesLocked'), false, true));
5499 5499
                 } else {
5500
-                    if (api_is_allowed_to_edit(false,true) ||
5500
+                    if (api_is_allowed_to_edit(false, true) ||
5501 5501
                         api_is_platform_admin() ||
5502 5502
                         GroupManager::is_user_in_group(api_get_user_id(), api_get_group_id()) ||
5503 5503
                         $_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   +91 added lines, -91 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($current_forum, $_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'] . "$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']."$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,7 +273,7 @@  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 (
@@ -282,13 +282,13 @@  discard block
 block discarded – undo
282 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(),
@@ -307,16 +307,16 @@  discard block
 block discarded – undo
307 307
     );
308 308
 
309 309
     if (!isset($_GET['id']) && $post_id > $post_minor) {
310
-        echo "<a href=\"viewthread.php?" . api_get_cidreq() .
311
-            "&forum=" . $forumId . "&thread=" . $threadId .
312
-            "&action=move&post=" .
313
-            $rows[$display_post_id]['post_id'] . "\">" .
310
+        echo "<a href=\"viewthread.php?".api_get_cidreq().
311
+            "&forum=".$forumId."&thread=".$threadId.
312
+            "&action=move&post=".
313
+            $rows[$display_post_id]['post_id']."\">".
314 314
             Display::return_icon(
315 315
                 'move.png',
316 316
                 get_lang('MovePost'),
317 317
                 array(),
318 318
                 ICON_SIZE_SMALL
319
-            ) . "</a>";
319
+            )."</a>";
320 320
 
321 321
     }
322 322
 }
@@ -339,16 +339,16 @@  discard block
 block discarded – undo
339 339
         );
340 340
 
341 341
         if ($locked == false) {
342
-            echo "<a href=\"forumqualify.php?" . api_get_cidreq() .
343
-                "&forum=" . $forumId . "&thread=" . $threadId .
344
-                "&action=list&post=" . $rows[$display_post_id]['post_id'] .
345
-                "&user=" . $rows[$display_post_id]['user_id'] . "&user_id=" .
346
-                $rows[$display_post_id]['user_id'] . "&origin=" . $origin .
347
-                "&idtextqualify=" . $current_qualify_thread .
348
-                "\" >" . Display::return_icon(
342
+            echo "<a href=\"forumqualify.php?".api_get_cidreq().
343
+                "&forum=".$forumId."&thread=".$threadId.
344
+                "&action=list&post=".$rows[$display_post_id]['post_id'].
345
+                "&user=".$rows[$display_post_id]['user_id']."&user_id=".
346
+                $rows[$display_post_id]['user_id']."&origin=".$origin.
347
+                "&idtextqualify=".$current_qualify_thread.
348
+                "\" >".Display::return_icon(
349 349
                     'quiz.gif',
350 350
                     get_lang('Qualify')
351
-                ) . "</a>";
351
+                )."</a>";
352 352
         }
353 353
     }
354 354
 }
@@ -360,33 +360,33 @@  discard block
 block discarded – undo
360 360
         ($current_forum['allow_anonymous'] == 1 && !$_user['user_id'])
361 361
     ) {
362 362
         if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) {
363
-            echo '<a href="reply.php?' . api_get_cidreq() .
364
-                '&forum=' . $forumId . '&thread=' . $threadId .
365
-                '&post=' . $rows[$display_post_id]['post_id'] .
366
-                '&action=replymessage">' .
363
+            echo '<a href="reply.php?'.api_get_cidreq().
364
+                '&forum='.$forumId.'&thread='.$threadId.
365
+                '&post='.$rows[$display_post_id]['post_id'].
366
+                '&action=replymessage">'.
367 367
                 Display::return_icon(
368 368
                     'message_reply_forum.png',
369 369
                     get_lang('ReplyToMessage')
370
-                ) . "</a>";
371
-            echo '<a href="reply.php?' . api_get_cidreq() .
372
-                '&forum=' . $forumId . '&thread=' . $threadId .
373
-                '&post=' . $rows[$display_post_id]['post_id'] .
374
-                '&action=quote">' .
370
+                )."</a>";
371
+            echo '<a href="reply.php?'.api_get_cidreq().
372
+                '&forum='.$forumId.'&thread='.$threadId.
373
+                '&post='.$rows[$display_post_id]['post_id'].
374
+                '&action=quote">'.
375 375
                 Display::return_icon(
376 376
                     'quote.gif',
377 377
                     get_lang('QuoteMessage')
378
-                ) . "</a>";
378
+                )."</a>";
379 379
         }
380 380
     }
381 381
 } else {
382 382
     if ($current_forum_category && $current_forum_category['locked'] == 1) {
383
-        echo get_lang('ForumcategoryLocked') . '<br />';
383
+        echo get_lang('ForumcategoryLocked').'<br />';
384 384
     }
385 385
     if ($current_forum['locked'] == 1) {
386
-        echo get_lang('ForumLocked') . '<br />';
386
+        echo get_lang('ForumLocked').'<br />';
387 387
     }
388 388
     if ($current_thread['locked'] == 1) {
389
-        echo get_lang('ThreadLocked') . '<br />';
389
+        echo get_lang('ThreadLocked').'<br />';
390 390
     }
391 391
 }
392 392
 
@@ -405,17 +405,17 @@  discard block
 block discarded – undo
405 405
     $rows[$display_post_id]['post_notification'] == '1' AND
406 406
     $rows[$display_post_id]['poster_id'] == $_user['user_id']
407 407
 ) {
408
-    $post_image .= Display::return_icon('forumnotification.gif',get_lang('YouWillBeNotified'));
408
+    $post_image .= Display::return_icon('forumnotification.gif', get_lang('YouWillBeNotified'));
409 409
 }
410 410
 // The post title
411
-echo "<td class=\"$titleclass\">" .
412
-    prepare4display($rows[$display_post_id]['post_title']) . "</td>";
411
+echo "<td class=\"$titleclass\">".
412
+    prepare4display($rows[$display_post_id]['post_title'])."</td>";
413 413
 echo "</tr>";
414 414
 
415 415
 // The post message
416 416
 echo "<tr>";
417
-echo "<td class=\"$messageclass\">" .
418
-    prepare4display($rows[$display_post_id]['post_text']) . "</td>";
417
+echo "<td class=\"$messageclass\">".
418
+    prepare4display($rows[$display_post_id]['post_text'])."</td>";
419 419
 echo "</tr>";
420 420
 
421 421
 // The check if there is an attachment
@@ -428,21 +428,21 @@  discard block
 block discarded – undo
428 428
         echo Display::return_icon('attachment.gif', get_lang('Attachment'));
429 429
         echo '<a href="download.php?file=';
430 430
         echo $realname;
431
-        echo ' "> ' . $user_filename . ' </a>';
432
-        echo '<span class="forum_attach_comment">' .
433
-            Security::remove_XSS($attachment['comment'], STUDENT) . '</span>';
431
+        echo ' "> '.$user_filename.' </a>';
432
+        echo '<span class="forum_attach_comment">'.
433
+            Security::remove_XSS($attachment['comment'], STUDENT).'</span>';
434 434
 
435 435
         if (
436
-            ($current_forum['allow_edit'] == 1 &&$rows[$display_post_id]['user_id'] == $_user['user_id']) ||
436
+            ($current_forum['allow_edit'] == 1 && $rows[$display_post_id]['user_id'] == $_user['user_id']) ||
437 437
             (api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $sessionId))
438 438
         ) {
439
-            echo '&nbsp;&nbsp;<a href="' . api_get_self() . '?' .
440
-                api_get_cidreq() . '&action=delete_attach&id_attach=' .$attachment['id'] . '&forum=' . $forumId .
441
-                '&thread=' . $threadId .
442
-                '" onclick="javascript:if(!confirm(\'' .
439
+            echo '&nbsp;&nbsp;<a href="'.api_get_self().'?'.
440
+                api_get_cidreq().'&action=delete_attach&id_attach='.$attachment['id'].'&forum='.$forumId.
441
+                '&thread='.$threadId.
442
+                '" onclick="javascript:if(!confirm(\''.
443 443
                 addslashes(api_htmlentities(
444 444
                     get_lang('ConfirmYourChoice'), ENT_QUOTES)
445
-                ) . '\')) return false;">' . Display::return_icon(
445
+                ).'\')) return false;">'.Display::return_icon(
446 446
                     'delete.gif',
447 447
                     get_lang('Delete')
448 448
                 ).'</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   +42 added lines, -42 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,15 +72,15 @@  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
-            'url' => 'viewforumcategory.php?'.api_get_cidreq().'&forumcategory='. $current_forum_category['cat_id'],
83
+            'url' => 'viewforumcategory.php?'.api_get_cidreq().'&forumcategory='.$current_forum_category['cat_id'],
84 84
             'name' => $current_forum_category['cat_title']
85 85
         );
86 86
         $interbreadcrumb[] = array(
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 // then the user is not allowed here.
111 111
 if (
112 112
     !api_is_allowed_to_edit(false, true) AND
113
-    ( $current_forum_category && $current_forum_category['visibility'] == 0)
113
+    ($current_forum_category && $current_forum_category['visibility'] == 0)
114 114
 ) {
115 115
     api_not_allowed();
116 116
 }
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
 $html .= '<div class="actions">';
121 121
 $html .= '<a href="index.php?gradebook='.$gradebook.'&'.api_get_cidreq().'">'.
122 122
     Display::return_icon('back.png', get_lang('BackToForumOverview'), '', ICON_SIZE_MEDIUM).'</a>';
123
-if (api_is_allowed_to_edit(false,true)) {
124
-    $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forumcategory='
125
-        . $current_forum_category['cat_id'] . '&action=add&content=forum"> '
126
-        . Display::return_icon('new_forum.png', get_lang('AddForum'), '', ICON_SIZE_MEDIUM) . '</a>';
123
+if (api_is_allowed_to_edit(false, true)) {
124
+    $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&forumcategory='
125
+        . $current_forum_category['cat_id'].'&action=add&content=forum"> '
126
+        . Display::return_icon('new_forum.png', get_lang('AddForum'), '', ICON_SIZE_MEDIUM).'</a>';
127 127
 }
128 128
 $html .= search_link();
129 129
 $html .= '</div>';
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
     $forum_categories_list = '';
184 184
     $forumId = $forum_category['cat_id'];
185 185
     $forumTitle = $forum_category['cat_title'];
186
-    $linkForumCategory = 'viewforumcategory.php?' . api_get_cidreq() . '&forumcategory=' . strval(intval($forumId));
186
+    $linkForumCategory = 'viewforumcategory.php?'.api_get_cidreq().'&forumcategory='.strval(intval($forumId));
187 187
     $descriptionCategory = $forum_category['cat_comment'];
188 188
     $icoCategory = Display::return_icon(
189 189
         'forum_blue.png',
@@ -194,16 +194,16 @@  discard block
 block discarded – undo
194 194
 
195 195
     if (api_is_allowed_to_edit(false, true) && !($forum_category['session_id'] == 0 && $sessionId != 0)) {
196 196
 
197
-        $iconsEdit = '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forumcategory='
198
-            . Security::remove_XSS($_GET['forumcategory']) . '&action=edit&content=forumcategory&id='
199
-            . '' . $forumId . '">'
200
-            . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>';
201
-        $iconsEdit .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forumcategory='
197
+        $iconsEdit = '<a href="'.api_get_self().'?'.api_get_cidreq().'&forumcategory='
198
+            . Security::remove_XSS($_GET['forumcategory']).'&action=edit&content=forumcategory&id='
199
+            . ''.$forumId.'">'
200
+            . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
201
+        $iconsEdit .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&forumcategory='
202 202
             . Security::remove_XSS($_GET['forumcategory'])
203
-            . '&action=delete&content=forumcategory&id=' . $forumId
203
+            . '&action=delete&content=forumcategory&id='.$forumId
204 204
             . "\" onclick=\"javascript:if(!confirm('"
205 205
             . addslashes(api_htmlentities(get_lang('DeleteForumCategory'), ENT_QUOTES))
206
-            . "')) return false;\">" . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL)
206
+            . "')) return false;\">".Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL)
207 207
             . '</a>';
208 208
         $iconsEdit .= return_visible_invisible_icon(
209 209
             'forumcategory', $forum_category['cat_id'],
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
     );
244 244
 
245 245
 
246
-    if ($descriptionCategory != '' && trim($descriptionCategory)!= '&nbsp;')
246
+    if ($descriptionCategory != '' && trim($descriptionCategory) != '&nbsp;')
247 247
     {
248 248
         $html .= '<div class="forum-description">'.$descriptionCategory.'</div>';
249 249
     }
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
             // SHOULD WE SHOW THIS PARTICULAR FORUM
284 284
             // you are teacher => show forum
285 285
 
286
-            if (api_is_allowed_to_edit(false,true)) {
286
+            if (api_is_allowed_to_edit(false, true)) {
287 287
                 //echo 'teacher';
288 288
                 $show_forum = true;
289 289
             } else {
@@ -350,9 +350,9 @@  discard block
 block discarded – undo
350 350
                         ? $all_groups[$forum['forum_of_group']]['id']
351 351
                         : null;
352 352
                     $group_title = api_substr($my_all_groups_forum_name, 0, 30);
353
-                    $forum_title_group_addition = ' (<a href="../group/group_space.php?' . api_get_cidreq()
354
-                        . '&gidReq=' . $my_all_groups_forum_id . '" class="forum_group_link">'
355
-                        . get_lang('GoTo') . ' ' . $group_title . '</a>)';
353
+                    $forum_title_group_addition = ' (<a href="../group/group_space.php?'.api_get_cidreq()
354
+                        . '&gidReq='.$my_all_groups_forum_id.'" class="forum_group_link">'
355
+                        . get_lang('GoTo').' '.$group_title.'</a>)';
356 356
                 } else {
357 357
                     $forum_title_group_addition = '';
358 358
                 }
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
                 $html .= '<div class="row">';
371 371
                 $html .= '<div class="col-md-6">';
372 372
                 $html .= '<div class="col-md-3">';
373
-                $html .= '<div class="number-post">'.$forum_image .'<p>' . $my_number_threads . ' ' . get_lang('ForumThreads') . '</p></div>';
373
+                $html .= '<div class="number-post">'.$forum_image.'<p>'.$my_number_threads.' '.get_lang('ForumThreads').'</p></div>';
374 374
                 $html .= '</div>';
375 375
 
376 376
                 $html .= '<div class="col-md-9">';
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
                     'a',
386 386
                     $forum['forum_title'].$session_displayed,
387 387
                     array(
388
-                        'href' => 'viewforum.php?' . api_get_cidreq()
388
+                        'href' => 'viewforum.php?'.api_get_cidreq()
389 389
                             . "&gidReq={$forum['forum_of_group']}&forum={$forum['forum_id']}&search="
390 390
                             . Security::remove_XSS(urlencode(isset($_GET['search']) ? $_GET['search'] : '')),
391 391
                         'class' => return_visible_invisible($forum['visibility'])
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
                 );
394 394
                 $html .= Display::tag(
395 395
                     'h3',
396
-                    $linkForum . ' ' . $forum_title_group_addition,
396
+                    $linkForum.' '.$forum_title_group_addition,
397 397
                     array(
398 398
                         'class' => 'title'
399 399
                     )
@@ -409,19 +409,19 @@  discard block
 block discarded – undo
409 409
                 $html .= '</div>';
410 410
                 $html .= '<div class="col-md-6">';
411 411
 
412
-                $iconEmpty='';
412
+                $iconEmpty = '';
413 413
 
414 414
                 // The number of topics and posts.
415 415
                 if ($forum['forum_of_group'] !== '0') {
416 416
                     $newPost = '';
417 417
                     if (is_array($my_whatsnew_post_info) && !empty($my_whatsnew_post_info)) {
418
-                        $newPost = ' ' . Display::return_icon('alert.png', get_lang('Forum'), null, ICON_SIZE_SMALL);
418
+                        $newPost = ' '.Display::return_icon('alert.png', get_lang('Forum'), null, ICON_SIZE_SMALL);
419 419
                     } else {
420 420
                         $newPost = $iconEmpty;
421 421
                     }
422 422
                 } else {
423 423
                     if (is_array($my_whatsnew_post_info) && !empty($my_whatsnew_post_info)) {
424
-                        $newPost = ' ' . Display::return_icon('alert.png', get_lang('Forum'), null, ICON_SIZE_SMALL);
424
+                        $newPost = ' '.Display::return_icon('alert.png', get_lang('Forum'), null, ICON_SIZE_SMALL);
425 425
                     } else {
426 426
                         $newPost = $iconEmpty;
427 427
                     }
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 
430 430
                 $html .= '<div class="row">';
431 431
                 $html .= '<div class="col-md-2">';
432
-                $html .= $newPost . '</div>';
432
+                $html .= $newPost.'</div>';
433 433
 
434 434
                 // the last post in the forum
435 435
                 if ($forum['last_poster_name'] != '') {
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
                 }
442 442
                 $html .= '<div class="col-md-6">';
443 443
                 if (!empty($forum['last_post_id'])) {
444
-                    $html .= Display::return_icon('post-item.png', null, null, ICON_SIZE_TINY) . ' ';
444
+                    $html .= Display::return_icon('post-item.png', null, null, ICON_SIZE_TINY).' ';
445 445
                     $html .= api_convert_and_format_date($forum['last_post_date'])
446
-                        . ' ' . get_lang('By') . ' '
446
+                        . ' '.get_lang('By').' '
447 447
                         . display_user_link($poster_id, $name);
448 448
                 }
449 449
                 $html .= '</div>';
@@ -453,13 +453,13 @@  discard block
 block discarded – undo
453 453
                     api_is_allowed_to_edit(false, true) &&
454 454
                     !($forum['session_id'] == 0 && $sessionId != 0)
455 455
                 ) {
456
-                    $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forumcategory='
456
+                    $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&forumcategory='
457 457
                         . Security::remove_XSS($_GET['forumcategory'])
458
-                        . '&action=edit&content=forum&id=' . $forum['forum_id'] . '">'
459
-                        . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>';
460
-                    $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forumcategory='
458
+                        . '&action=edit&content=forum&id='.$forum['forum_id'].'">'
459
+                        . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
460
+                    $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&forumcategory='
461 461
                         . Security::remove_XSS($_GET['forumcategory'])
462
-                        . '&action=delete&content=forum&id=' . $forum['forum_id']
462
+                        . '&action=delete&content=forum&id='.$forum['forum_id']
463 463
                         . "\" onclick=\"javascript:if(!confirm('"
464 464
                         . addslashes(api_htmlentities(get_lang('DeleteForum'), ENT_QUOTES))
465 465
                         . "')) return false;\">"
@@ -483,15 +483,15 @@  discard block
 block discarded – undo
483 483
                 $iconnotify = 'notification_mail_na.png';
484 484
 
485 485
                 if (is_array(isset($_SESSION['forum_notification']['forum']) ? $_SESSION['forum_notification']['forum'] : null)) {
486
-                    if (in_array($forum['forum_id'],$_SESSION['forum_notification']['forum'])) {
486
+                    if (in_array($forum['forum_id'], $_SESSION['forum_notification']['forum'])) {
487 487
                         $iconnotify = 'notification_mail.png';
488 488
                     }
489 489
                 }
490 490
 
491 491
                 if (!api_is_anonymous()) {
492
-                    $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forumcategory='
493
-                        . Security::remove_XSS($_GET['forumcategory']) . '&action=notify&content=forum&id='
494
-                        . $forum['forum_id'] . '">' . Display::return_icon($iconnotify, get_lang('NotifyMe')) . '</a>';
492
+                    $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&forumcategory='
493
+                        . Security::remove_XSS($_GET['forumcategory']).'&action=notify&content=forum&id='
494
+                        . $forum['forum_id'].'">'.Display::return_icon($iconnotify, get_lang('NotifyMe')).'</a>';
495 495
                 }
496 496
                 $html .= '</div>';
497 497
                 $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.