Completed
Push — 1.11.x ( 0609ac...d3f3e5 )
by José
161:19 queued 122:35
created
main/mySpace/course.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,8 +36,8 @@
 block discarded – undo
36 36
 
37 37
 function count_courses()
38 38
 {
39
-	global $nb_courses;
40
-	return $nb_courses;
39
+    global $nb_courses;
40
+    return $nb_courses;
41 41
 }
42 42
 
43 43
 //checking if the current coach is the admin coach
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 $sessionId = isset($_GET['session_id']) ? intval($_GET['session_id']) : null;
16 16
 
17 17
 api_block_anonymous_users();
18
-$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
18
+$interbreadcrumb[] = array("url" => "index.php", "name" => get_lang('MySpace'));
19 19
 
20 20
 if (isset($_GET["id_session"]) && $_GET["id_session"] != "") {
21 21
     $interbreadcrumb[] = array("url" => "session.php", "name" => get_lang('Sessions'));
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
             $user_id = intval($_GET['user_id']);
67 67
             $user_info = api_get_user_info($user_id);
68 68
             $title = get_lang('AssignedCoursesTo').' '.api_get_person_name($user_info['firstname'], $user_info['lastname']);
69
-            $courses  = CourseManager::get_course_list_of_user_as_course_admin($user_id);
69
+            $courses = CourseManager::get_course_list_of_user_as_course_admin($user_id);
70 70
         } else {
71 71
             $title = get_lang('YourCourseList');
72 72
             $courses = CourseManager::get_courses_followed_by_drh(api_get_user_id());
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
     if (!api_is_session_admin()) {
83 83
         $menu_items[] = Display::url(
84
-            Display::return_icon('stats.png', get_lang('MyStats'),'',ICON_SIZE_MEDIUM),
84
+            Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM),
85 85
             api_get_path(WEB_CODE_PATH)."auth/my_progress.php"
86 86
         );
87 87
         $menu_items[] = Display::url(
Please login to merge, or discard this patch.
main/mySpace/admin.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
 }
36 36
 $sql = "SELECT user.user_id,lastname,firstname,email
37 37
         FROM $tbl_user as user, $tbl_admin as admin
38
-        WHERE admin.user_id=user.user_id" . $order_clause;
38
+        WHERE admin.user_id=user.user_id".$order_clause;
39 39
 $result_admins = Database::query($sql);
40 40
 
41 41
 if (api_is_western_name_order()) {
42
-    echo '<table class="data_table"><tr><th>' . get_lang('FirstName') . '</th><th>' . get_lang('LastName') . '</th><th>' . get_lang('Email') . '</th></tr>';
42
+    echo '<table class="data_table"><tr><th>'.get_lang('FirstName').'</th><th>'.get_lang('LastName').'</th><th>'.get_lang('Email').'</th></tr>';
43 43
 } else {
44
-    echo '<table class="data_table"><tr><th>' . get_lang('LastName') . '</th><th>' . get_lang('FirstName') . '</th><th>' . get_lang('Email') . '</th></tr>';
44
+    echo '<table class="data_table"><tr><th>'.get_lang('LastName').'</th><th>'.get_lang('FirstName').'</th><th>'.get_lang('Email').'</th></tr>';
45 45
 }
46 46
 
47 47
 if (api_is_western_name_order(PERSON_NAME_DATA_EXPORT)) {
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
             $css_class = "row_odd";
66 66
             if ($i % 20 == 0 && $i != 0) {
67 67
                 if (api_is_western_name_order()) {
68
-                    echo '<tr><th>' . get_lang('FirstName') . '</th><th>' . get_lang('LastName') . '</th><th>' . get_lang('Email') . '</th></tr>';
68
+                    echo '<tr><th>'.get_lang('FirstName').'</th><th>'.get_lang('LastName').'</th><th>'.get_lang('Email').'</th></tr>';
69 69
                 } else {
70
-                    echo '<tr><th>' . get_lang('LastName') . '</th><th>' . get_lang('FirstName') . '</th><th>' . get_lang('Email') . '</th></tr>';
70
+                    echo '<tr><th>'.get_lang('LastName').'</th><th>'.get_lang('FirstName').'</th><th>'.get_lang('Email').'</th></tr>';
71 71
                 }
72 72
             }
73 73
         } else {
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
         $i++;
78 78
 
79 79
         if (api_is_western_name_order()) {
80
-            echo "<tr class=" . $css_class . "><td>$firstname</td><td>$lastname</td><td><a href='mailto:" . $email . "'>$email</a></td></tr>";
80
+            echo "<tr class=".$css_class."><td>$firstname</td><td>$lastname</td><td><a href='mailto:".$email."'>$email</a></td></tr>";
81 81
         } else {
82
-            echo "<tr class=" . $css_class . "><td>$lastname</td><td>$firstname</td><td><a href='mailto:" . $email . "'>$email</a></td></tr>";
82
+            echo "<tr class=".$css_class."><td>$lastname</td><td>$firstname</td><td><a href='mailto:".$email."'>$email</a></td></tr>";
83 83
         }
84 84
 
85 85
         if (api_is_western_name_order(PERSON_NAME_DATA_EXPORT)) {
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     }
94 94
 } else {
95 95
     // No results
96
-    echo '<tr><td colspan="3">' . get_lang('NoResults') . '</td></tr>';
96
+    echo '<tr><td colspan="3">'.get_lang('NoResults').'</td></tr>';
97 97
 }
98 98
 echo '</table>';
99 99
 
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 echo "
105 105
     <br /><br />
106 106
     <form method='post' action='admin.php'>
107
-        <button type='submit' class='save' name='export' value='" . get_lang('ExportExcel') . "'>
108
-            " . get_lang('ExportExcel') . "
107
+        <button type='submit' class='save' name='export' value='" . get_lang('ExportExcel')."'>
108
+            " . get_lang('ExportExcel')."
109 109
         </button>
110 110
     <form>
111 111
 ";
Please login to merge, or discard this patch.
main/mySpace/access_details.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@
 block discarded – undo
138 138
     </div><br />
139 139
     <div id="cev_cont_stats">
140 140
     <?php
141
-    if ($result_to_print != "")  {
141
+    if ($result_to_print != "") {
142 142
         $rst = get_stats($user_id, $courseId);
143 143
         $foo_stats = '<strong>'.get_lang('Total').': </strong>'.$rst['total'].'<br />';
144 144
         $foo_stats .= '<strong>'.get_lang('Average').': </strong>'.$rst['avg'].'<br />';
Please login to merge, or discard this patch.
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   +630 added lines, -630 removed lines patch added patch discarded remove patch
@@ -99,25 +99,25 @@  discard block
 block discarded – undo
99 99
      **/
100 100
     public function links_to($input)
101 101
     {
102
-        $input_array = preg_split("/(\[\[|\]\])/",$input,-1, PREG_SPLIT_DELIM_CAPTURE);
102
+        $input_array = preg_split("/(\[\[|\]\])/", $input, -1, PREG_SPLIT_DELIM_CAPTURE);
103 103
         $all_links = array();
104 104
 
105 105
         foreach ($input_array as $key=>$value) {
106
-            if (isset($input_array[$key-1]) && $input_array[$key-1] == '[[' &&
107
-                isset($input_array[$key+1]) && $input_array[$key+1] == ']]'
106
+            if (isset($input_array[$key - 1]) && $input_array[$key - 1] == '[[' &&
107
+                isset($input_array[$key + 1]) && $input_array[$key + 1] == ']]'
108 108
             ) {
109 109
                 if (api_strpos($value, "|") !== false) {
110
-                    $full_link_array=explode("|", $value);
111
-                    $link=trim($full_link_array[0]);
112
-                    $title=trim($full_link_array[1]);
110
+                    $full_link_array = explode("|", $value);
111
+                    $link = trim($full_link_array[0]);
112
+                    $title = trim($full_link_array[1]);
113 113
                 } else {
114
-                    $link=trim($value);
115
-                    $title=trim($value);
114
+                    $link = trim($value);
115
+                    $title = trim($value);
116 116
                 }
117
-                unset($input_array[$key-1]);
118
-                unset($input_array[$key+1]);
117
+                unset($input_array[$key - 1]);
118
+                unset($input_array[$key + 1]);
119 119
                 //replace blank spaces by _ within the links. But to remove links at the end add a blank space
120
-                $all_links[]= Database::escape_string(str_replace(' ','_',$link)).' ';
120
+                $all_links[] = Database::escape_string(str_replace(' ', '_', $link)).' ';
121 121
             }
122 122
         }
123 123
         $output = implode($all_links);
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
      **/
132 132
     public function detect_external_link($input)
133 133
     {
134
-        $exlink='href=';
135
-        $exlinkStyle='class="wiki_link_ext" href=';
136
-        $output=str_replace($exlink, $exlinkStyle, $input);
134
+        $exlink = 'href=';
135
+        $exlinkStyle = 'class="wiki_link_ext" href=';
136
+        $output = str_replace($exlink, $exlinkStyle, $input);
137 137
         return $output;
138 138
     }
139 139
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     public function detect_anchor_link($input)
145 145
     {
146 146
         $anchorlink = 'href="#';
147
-        $anchorlinkStyle='class="wiki_anchor_link" href="#';
147
+        $anchorlinkStyle = 'class="wiki_anchor_link" href="#';
148 148
         $output = str_replace($anchorlink, $anchorlinkStyle, $input);
149 149
 
150 150
         return $output;
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      **/
170 170
     public function detect_ftp_link($input)
171 171
     {
172
-        $ftplink='href="ftp';
172
+        $ftplink = 'href="ftp';
173 173
         $ftplinkStyle = 'class="wiki_ftp_link" href="ftp';
174 174
         $output = str_replace($ftplink, $ftplinkStyle, $input);
175 175
 
@@ -214,21 +214,21 @@  discard block
 block discarded – undo
214 214
     {
215 215
         $groupId = api_get_group_id();
216 216
         //now doubles brackets
217
-        $input_array = preg_split("/(\[\[|\]\])/",$input,-1, PREG_SPLIT_DELIM_CAPTURE);
217
+        $input_array = preg_split("/(\[\[|\]\])/", $input, -1, PREG_SPLIT_DELIM_CAPTURE);
218 218
 
219 219
         foreach ($input_array as $key => $value) {
220 220
             //now doubles brackets
221
-            if (isset($input_array[$key-1]) && $input_array[$key-1] == '[[' AND
222
-                $input_array[$key+1] == ']]'
221
+            if (isset($input_array[$key - 1]) && $input_array[$key - 1] == '[[' AND
222
+                $input_array[$key + 1] == ']]'
223 223
             ) {
224 224
                 // now full wikilink
225
-                if (api_strpos($value, "|") !== false){
226
-                    $full_link_array=explode("|", $value);
227
-                    $link=trim(strip_tags($full_link_array[0]));
228
-                    $title=trim($full_link_array[1]);
225
+                if (api_strpos($value, "|") !== false) {
226
+                    $full_link_array = explode("|", $value);
227
+                    $link = trim(strip_tags($full_link_array[0]));
228
+                    $title = trim($full_link_array[1]);
229 229
                 } else {
230
-                    $link=trim(strip_tags($value));
231
-                    $title=trim($value);
230
+                    $link = trim(strip_tags($value));
231
+                    $title = trim($value);
232 232
                 }
233 233
 
234 234
                 //if wikilink is homepage
@@ -240,17 +240,17 @@  discard block
 block discarded – undo
240 240
                 }
241 241
 
242 242
                 // note: checkreflink checks if the link is still free. If it is not used then it returns true, if it is used, then it returns false. Now the title may be different
243
-                if (self::checktitle(strtolower(str_replace(' ','_',$link)))) {
243
+                if (self::checktitle(strtolower(str_replace(' ', '_', $link)))) {
244 244
                     $link = api_html_entity_decode($link);
245
-                    $input_array[$key]='<a href="'.api_get_path(WEB_PATH).'main/wiki/index.php?'.api_get_cidreq().'&action=addnew&amp;title='.Security::remove_XSS($link).'&group_id='.$groupId.'" class="new_wiki_link">'.$title.'</a>';
245
+                    $input_array[$key] = '<a href="'.api_get_path(WEB_PATH).'main/wiki/index.php?'.api_get_cidreq().'&action=addnew&amp;title='.Security::remove_XSS($link).'&group_id='.$groupId.'" class="new_wiki_link">'.$title.'</a>';
246 246
                 } else {
247
-                    $input_array[$key]='<a href="'.api_get_path(WEB_PATH).'main/wiki/index.php?'.api_get_cidreq().'&action=showpage&amp;title='.urlencode(strtolower(str_replace(' ','_',$link))).'&group_id='.$groupId.'" class="wiki_link">'.$title.'</a>';
247
+                    $input_array[$key] = '<a href="'.api_get_path(WEB_PATH).'main/wiki/index.php?'.api_get_cidreq().'&action=showpage&amp;title='.urlencode(strtolower(str_replace(' ', '_', $link))).'&group_id='.$groupId.'" class="wiki_link">'.$title.'</a>';
248 248
                 }
249
-                unset($input_array[$key-1]);
250
-                unset($input_array[$key+1]);
249
+                unset($input_array[$key - 1]);
250
+                unset($input_array[$key + 1]);
251 251
             }
252 252
         }
253
-        $output = implode('',$input_array);
253
+        $output = implode('', $input_array);
254 254
         return $output;
255 255
     }
256 256
 
@@ -292,11 +292,11 @@  discard block
 block discarded – undo
292 292
         // are not made here, but through the interce buttons
293 293
 
294 294
         // cleaning the variables
295
-        if (api_get_setting('htmlpurifier_wiki') == 'true'){
295
+        if (api_get_setting('htmlpurifier_wiki') == 'true') {
296 296
             //$purifier = new HTMLPurifier();
297 297
             $values['content'] = Security::remove_XSS($values['content']);
298 298
         }
299
-        $version = intval($values['version']) + 1 ;
299
+        $version = intval($values['version']) + 1;
300 300
         $linkTo = self::links_to($values['content']); //and check links content
301 301
 
302 302
         //cleaning config variables
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
             $_clean['startdate_assig'] = null;
320 320
         }
321 321
 
322
-        if (isset($values['initenddate']) && $values['initenddate']==1) {
322
+        if (isset($values['initenddate']) && $values['initenddate'] == 1) {
323 323
             $_clean['enddate_assig'] = $values['enddate_assig'];
324 324
         } else {
325 325
             $_clean['enddate_assig'] = null;
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
         }
331 331
 
332 332
         if (!empty($values['max_text']) || !empty($values['max_version'])) {
333
-            $_clean['max_text']	= $values['max_text'];
333
+            $_clean['max_text'] = $values['max_text'];
334 334
             $_clean['max_version'] = $values['max_version'];
335 335
         }
336 336
 
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
                 $groupId
382 382
             );
383 383
 
384
-            if ($values['page_id']== 0) {
384
+            if ($values['page_id'] == 0) {
385 385
                 $sql = 'UPDATE '.$tbl_wiki.' SET page_id="'.$id.'"
386 386
                         WHERE c_id = '.$course_id.' AND iid ="'.$id.'"';
387 387
                 Database::query($sql);
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
         $_course = $this->courseInfo;
466 466
         $r_user_id = api_get_user_id();
467 467
         $r_dtime = api_get_utc_datetime();
468
-        $r_version = $r_version+1;
468
+        $r_version = $r_version + 1;
469 469
         $r_comment = get_lang('RestoredFromVersion').': '.$c_version;
470 470
         $session_id = api_get_session_id();
471 471
         $course_id = api_get_course_int_id();
@@ -570,9 +570,9 @@  discard block
 block discarded – undo
570 570
         // Unlike ordinary pages of pages of assignments.
571 571
         // Allow create a ordinary page although there is a assignment with the same name
572 572
         if ($_clean['assignment'] == 2 || $_clean['assignment'] == 1) {
573
-            $page = str_replace(' ','_',$values['title']."_uass".$assig_user_id);
573
+            $page = str_replace(' ', '_', $values['title']."_uass".$assig_user_id);
574 574
         } else {
575
-            $page = str_replace(' ','_',$values['title']);
575
+            $page = str_replace(' ', '_', $values['title']);
576 576
         }
577 577
         $_clean['reflink'] = $page;
578 578
         $_clean['title']   = trim($values['title']);
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 
609 609
         $groupId = api_get_group_id();
610 610
 
611
-        $_clean['linksto'] = self::links_to($_clean['content']);	//check wikilinks
611
+        $_clean['linksto'] = self::links_to($_clean['content']); //check wikilinks
612 612
 
613 613
         // cleaning config variables
614 614
         $_clean['task'] = isset($values['task']) ? $values['task'] : '';
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
      */
725 725
     public function setForm($form, $row = array())
726 726
     {
727
-        $toolBar = api_is_allowed_to_edit(null,true)
727
+        $toolBar = api_is_allowed_to_edit(null, true)
728 728
             ? array('ToolbarSet' => 'Wiki', 'Width' => '100%', 'Height' => '400')
729 729
             : array('ToolbarSet' => 'WikiStudent', 'Width' => '100%', 'Height' => '400', 'UserStatus' => 'student');
730 730
 
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
 
736 736
         $form->addElement('select', 'progress', get_lang('Progress'), $progress);
737 737
 
738
-        if ((api_is_allowed_to_edit(false,true) ||
738
+        if ((api_is_allowed_to_edit(false, true) ||
739 739
             api_is_platform_admin()) &&
740 740
             isset($row['reflink']) && $row['reflink'] != 'index'
741 741
         ) {
@@ -875,13 +875,13 @@  discard block
 block discarded – undo
875 875
         if ($newtitle) {
876 876
             $pageMIX = $newtitle; //display the page after it is created
877 877
         } else {
878
-            $pageMIX = $page;//display current page
878
+            $pageMIX = $page; //display current page
879 879
         }
880 880
 
881 881
         $filter = null;
882 882
         if (isset($_GET['view']) && $_GET['view']) {
883 883
             $_clean['view'] = Database::escape_string($_GET['view']);
884
-            $filter =' AND w.id="'.$_clean['view'].'"';
884
+            $filter = ' AND w.id="'.$_clean['view'].'"';
885 885
         }
886 886
 
887 887
         // First, check page visibility in the first page version
@@ -923,15 +923,15 @@  discard block
 block discarded – undo
923 923
         }
924 924
 
925 925
         // if both are empty and we are displaying the index page then we display the default text.
926
-        if ($row['content']=='' && $row['title']=='' && $page=='index') {
926
+        if ($row['content'] == '' && $row['title'] == '' && $page == 'index') {
927 927
             if (api_is_allowed_to_edit(false, true) ||
928 928
                 api_is_platform_admin() ||
929 929
                 GroupManager::is_user_in_group(api_get_user_id(), api_get_group_id()) ||
930 930
                 api_is_allowed_in_course()
931 931
             ) {
932 932
                 //Table structure for better export to pdf
933
-                $default_table_for_content_Start='<table align="center" border="0"><tr><td align="center">';
934
-                $default_table_for_content_End='</td></tr></table>';
933
+                $default_table_for_content_Start = '<table align="center" border="0"><tr><td align="center">';
934
+                $default_table_for_content_End = '</td></tr></table>';
935 935
                 $content = $default_table_for_content_Start.
936 936
                     sprintf(get_lang('DefaultContent'), api_get_path(WEB_IMG_PATH)).
937 937
                     $default_table_for_content_End;
@@ -946,23 +946,23 @@  discard block
 block discarded – undo
946 946
 
947 947
         //assignment mode: identify page type
948 948
         $icon_assignment = null;
949
-        if ($row['assignment']==1) {
950
-            $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'),'',ICON_SIZE_SMALL);
951
-        } elseif($row['assignment']==2) {
952
-            $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
949
+        if ($row['assignment'] == 1) {
950
+            $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'), '', ICON_SIZE_SMALL);
951
+        } elseif ($row['assignment'] == 2) {
952
+            $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
953 953
         }
954 954
 
955 955
         //task mode
956 956
         $icon_task = null;
957 957
         if (!empty($row['task'])) {
958
-            $icon_task=Display::return_icon('wiki_task.png', get_lang('StandardTask'),'',ICON_SIZE_SMALL);
958
+            $icon_task = Display::return_icon('wiki_task.png', get_lang('StandardTask'), '', ICON_SIZE_SMALL);
959 959
         }
960 960
 
961 961
         // Show page. Show page to all users if isn't hide page. Mode assignments: if student is the author, can view
962 962
         if ($KeyVisibility == "1" ||
963 963
             api_is_allowed_to_edit(false, true) ||
964 964
             api_is_platform_admin() ||
965
-            ($row['assignment'] == 2 && $KeyVisibility=="0" && (api_get_user_id() == $row['user_id'])) ||
965
+            ($row['assignment'] == 2 && $KeyVisibility == "0" && (api_get_user_id() == $row['user_id'])) ||
966 966
             api_is_allowed_in_course()
967 967
         ) {
968 968
             $actionsLeft = '';
@@ -988,13 +988,13 @@  discard block
 block discarded – undo
988 988
             $protect_page = null;
989 989
             $lock_unlock_protect = null;
990 990
             // page action: protecting (locking) the page
991
-            if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
992
-                if (self::check_protect_page()==1) {
991
+            if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
992
+                if (self::check_protect_page() == 1) {
993 993
                     $protect_page = Display::return_icon('lock.png', get_lang('PageLockedExtra'), '', ICON_SIZE_MEDIUM);
994
-                    $lock_unlock_protect='unlock';
994
+                    $lock_unlock_protect = 'unlock';
995 995
                 } else {
996 996
                     $protect_page = Display::return_icon('unlock.png', get_lang('PageUnlockedExtra'), '', ICON_SIZE_MEDIUM);
997
-                    $lock_unlock_protect='lock';
997
+                    $lock_unlock_protect = 'lock';
998 998
                 }
999 999
             }
1000 1000
 
@@ -1006,13 +1006,13 @@  discard block
 block discarded – undo
1006 1006
             $visibility_page = null;
1007 1007
             $lock_unlock_visibility = null;
1008 1008
             //page action: visibility
1009
-            if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
1009
+            if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
1010 1010
                 if (self::check_visibility_page() == 1) {
1011
-                    $visibility_page = Display::return_icon('visible.png', get_lang('ShowPageExtra'),'', ICON_SIZE_MEDIUM);
1011
+                    $visibility_page = Display::return_icon('visible.png', get_lang('ShowPageExtra'), '', ICON_SIZE_MEDIUM);
1012 1012
                     $lock_unlock_visibility = 'invisible';
1013 1013
 
1014 1014
                 } else {
1015
-                    $visibility_page = Display::return_icon('invisible.png', get_lang('HidePageExtra'),'', ICON_SIZE_MEDIUM);
1015
+                    $visibility_page = Display::return_icon('invisible.png', get_lang('HidePageExtra'), '', ICON_SIZE_MEDIUM);
1016 1016
                     $lock_unlock_visibility = 'visible';
1017 1017
                 }
1018 1018
             }
@@ -1024,11 +1024,11 @@  discard block
 block discarded – undo
1024 1024
 
1025 1025
             //page action: notification
1026 1026
             if (api_is_allowed_to_session_edit()) {
1027
-                if (self::check_notify_page($page)==1) {
1028
-                    $notify_page = Display::return_icon('messagebox_info.png', get_lang('NotifyByEmail'),'',ICON_SIZE_MEDIUM);
1027
+                if (self::check_notify_page($page) == 1) {
1028
+                    $notify_page = Display::return_icon('messagebox_info.png', get_lang('NotifyByEmail'), '', ICON_SIZE_MEDIUM);
1029 1029
                     $lock_unlock_notify_page = 'unlocknotify';
1030 1030
                 } else {
1031
-                    $notify_page = Display::return_icon('mail.png', get_lang('CancelNotifyByEmail'),'',ICON_SIZE_MEDIUM);
1031
+                    $notify_page = Display::return_icon('mail.png', get_lang('CancelNotifyByEmail'), '', ICON_SIZE_MEDIUM);
1032 1032
                     $lock_unlock_notify_page = 'locknotify';
1033 1033
                 }
1034 1034
             }
@@ -1040,33 +1040,33 @@  discard block
 block discarded – undo
1040 1040
                 ) {
1041 1041
                     // menu discuss page
1042 1042
                     $actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=discuss&title='.api_htmlentities(urlencode($page)).'" '.self::is_active_navigation_tab('discuss').'>'.
1043
-                        Display::return_icon('discuss.png',get_lang('DiscussThisPage'),'',ICON_SIZE_MEDIUM).'</a>';
1043
+                        Display::return_icon('discuss.png', get_lang('DiscussThisPage'), '', ICON_SIZE_MEDIUM).'</a>';
1044 1044
                 }
1045 1045
 
1046 1046
                 //menu history
1047 1047
                 $actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=history&title='.api_htmlentities(urlencode($page)).'" '.self::is_active_navigation_tab('history').'>'.
1048
-                    Display::return_icon('history.png',get_lang('ShowPageHistory'),'',ICON_SIZE_MEDIUM).'</a>';
1048
+                    Display::return_icon('history.png', get_lang('ShowPageHistory'), '', ICON_SIZE_MEDIUM).'</a>';
1049 1049
                 //menu linkspages
1050 1050
                 $actionsRight .= '<a href="index.php?'.api_get_cidreq().'action=links&title='.api_htmlentities(urlencode($page)).'" '.self::is_active_navigation_tab('links').'>'.
1051
-                    Display::return_icon('what_link_here.png',get_lang('LinksPages'),'',ICON_SIZE_MEDIUM).'</a>';
1051
+                    Display::return_icon('what_link_here.png', get_lang('LinksPages'), '', ICON_SIZE_MEDIUM).'</a>';
1052 1052
 
1053 1053
                 //menu delete wikipage
1054
-                if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
1054
+                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
1055 1055
                     $actionsRight .= '<a href="index.php?action=delete&'.api_get_cidreq().'&title='.api_htmlentities(urlencode($page)).'"'.self::is_active_navigation_tab('delete').'>'.
1056
-                        Display::return_icon('delete.png',get_lang('DeleteThisPage'),'',ICON_SIZE_MEDIUM).'</a>';
1056
+                        Display::return_icon('delete.png', get_lang('DeleteThisPage'), '', ICON_SIZE_MEDIUM).'</a>';
1057 1057
                 }
1058 1058
 
1059 1059
                 $actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=showpage&actionpage='.$lock_unlock_notify_page.'&title='.api_htmlentities(urlencode($page)).'">'.
1060 1060
                     $notify_page.'</a>';
1061 1061
 
1062 1062
                 // Page action: copy last version to doc area
1063
-                if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
1063
+                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
1064 1064
                     $actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=export2doc&wiki_id='.$row['id'].'">'.
1065 1065
                         Display::return_icon('export_to_documents.png', get_lang('ExportToDocArea'), '', ICON_SIZE_MEDIUM).'</a>';
1066 1066
                 }
1067 1067
 
1068 1068
                 $actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=export_to_pdf&wiki_id='.$row['id'].'">'.
1069
-                    Display::return_icon('pdf.png',get_lang('ExportToPDF'),'',ICON_SIZE_MEDIUM).'</a>';
1069
+                    Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a>';
1070 1070
 
1071 1071
                 $unoconv = api_get_configuration_value('unoconv.binaries');
1072 1072
                 if ($unoconv) {
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
                     )
1120 1120
                 );
1121 1121
 
1122
-            $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>';
1122
+            $footerWiki = '<div id="wikifooter">'.get_lang('Progress').': '.($row['progress'] * 10).'%&nbsp;&nbsp;&nbsp;'.get_lang('Rating').': '.$row['score'].'&nbsp;&nbsp;&nbsp;'.get_lang('Words').': '.self::word_count($content).'</div>';
1123 1123
 
1124 1124
             echo Display::panel($pageWiki, $pageTitle, $footerWiki);
1125 1125
         } //end filter visibility
@@ -1143,7 +1143,7 @@  discard block
 block discarded – undo
1143 1143
 
1144 1144
         # strip all html tags
1145 1145
         $wc = strip_tags($document);
1146
-        $wc = html_entity_decode($wc, ENT_NOQUOTES, 'UTF-8');// TODO:test also old html_entity_decode(utf8_encode($wc))
1146
+        $wc = html_entity_decode($wc, ENT_NOQUOTES, 'UTF-8'); // TODO:test also old html_entity_decode(utf8_encode($wc))
1147 1147
 
1148 1148
         # remove 'words' that don't consist of alphanumerical characters or punctuation. And fix accents and some letters
1149 1149
         $pattern = "#[^(\w|\d|\'|\"|\.|\!|\?|;|,|\\|\/|\-|:|\&|@|á|é|í|ó|ú|à|è|ì|ò|ù|ä|ë|ï|ö|ü|Á|É|Í|Ó|Ú|À|È|Ò|Ù|Ä|Ë|Ï|Ö|Ü|â|ê|î|ô|û|Â|Ê|Î|Ô|Û|ñ|Ñ|ç|Ç)]+#";
@@ -1176,15 +1176,15 @@  discard block
 block discarded – undo
1176 1176
 
1177 1177
         $course_id = api_get_course_int_id();
1178 1178
 
1179
-        $sql='SELECT id FROM '.$tbl_wiki.'
1179
+        $sql = 'SELECT id FROM '.$tbl_wiki.'
1180 1180
               WHERE
1181 1181
                 c_id = '.$course_id.' AND
1182 1182
                 title="'.Database::escape_string($title).'" AND
1183 1183
                 '.$groupfilter.$condition_session.'
1184 1184
               ORDER BY id ASC';
1185
-        $result=Database::query($sql);
1186
-        $cant=Database::num_rows($result);
1187
-        if ($cant>0) {
1185
+        $result = Database::query($sql);
1186
+        $cant = Database::num_rows($result);
1187
+        if ($cant > 0) {
1188 1188
             return true;
1189 1189
         } else {
1190 1190
             return false;
@@ -1266,20 +1266,20 @@  discard block
 block discarded – undo
1266 1266
         $page = $this->page;
1267 1267
 
1268 1268
         $course_id = api_get_course_int_id();
1269
-        $sql='SELECT * FROM '.$tbl_wiki.'
1269
+        $sql = 'SELECT * FROM '.$tbl_wiki.'
1270 1270
               WHERE
1271 1271
                 c_id = '.$course_id.' AND
1272 1272
                 reflink="'.Database::escape_string($page).'" AND
1273 1273
                 '.$groupfilter.$condition_session.'
1274 1274
               ORDER BY id ASC';
1275 1275
 
1276
-        $result=Database::query($sql);
1277
-        $row=Database::fetch_array($result);
1276
+        $result = Database::query($sql);
1277
+        $row = Database::fetch_array($result);
1278 1278
         $status_editlock = $row['editlock'];
1279 1279
         $id = $row['page_id'];
1280 1280
 
1281 1281
         ///change status
1282
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
1282
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
1283 1283
             if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'lock' && $status_editlock == 0) {
1284 1284
                 $status_editlock = 1;
1285 1285
             }
@@ -1291,13 +1291,13 @@  discard block
 block discarded – undo
1291 1291
                     WHERE c_id = '.$course_id.' AND page_id="'.$id.'"';
1292 1292
             Database::query($sql);
1293 1293
 
1294
-            $sql='SELECT * FROM '.$tbl_wiki.'
1294
+            $sql = 'SELECT * FROM '.$tbl_wiki.'
1295 1295
                   WHERE
1296 1296
                     c_id = '.$course_id.' AND
1297 1297
                     reflink="'.Database::escape_string($page).'" AND
1298 1298
                     '.$groupfilter.$condition_session.'
1299 1299
                   ORDER BY id ASC';
1300
-            $result=Database::query($sql);
1300
+            $result = Database::query($sql);
1301 1301
             $row = Database::fetch_array($result);
1302 1302
         }
1303 1303
 
@@ -1328,13 +1328,13 @@  discard block
 block discarded – undo
1328 1328
         $row = Database::fetch_array($result);
1329 1329
         $status_visibility = $row['visibility'];
1330 1330
         //change status
1331
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
1332
-            if (isset($_GET['actionpage']) && $_GET['actionpage']=='visible' && $status_visibility==0) {
1333
-                $status_visibility=1;
1331
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
1332
+            if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'visible' && $status_visibility == 0) {
1333
+                $status_visibility = 1;
1334 1334
 
1335 1335
             }
1336
-            if (isset($_GET['actionpage']) && $_GET['actionpage']=='invisible' && $status_visibility==1) {
1337
-                $status_visibility=0;
1336
+            if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'invisible' && $status_visibility == 1) {
1337
+                $status_visibility = 0;
1338 1338
             }
1339 1339
 
1340 1340
             $sql = 'UPDATE '.$tbl_wiki.' SET visibility="'.Database::escape_string($status_visibility).'"
@@ -1351,12 +1351,12 @@  discard block
 block discarded – undo
1351 1351
                         reflink="'.Database::escape_string($page).'" AND
1352 1352
                         '.$groupfilter.$condition_session.'
1353 1353
                     ORDER BY id ASC';
1354
-            $result=Database::query($sql);
1354
+            $result = Database::query($sql);
1355 1355
             $row = Database::fetch_array($result);
1356 1356
         }
1357 1357
 
1358 1358
         if (empty($row['id'])) {
1359
-            $row['visibility']= 1;
1359
+            $row['visibility'] = 1;
1360 1360
         }
1361 1361
 
1362 1362
         //show status
@@ -1383,18 +1383,18 @@  discard block
 block discarded – undo
1383 1383
                     reflink="'.Database::escape_string($page).'" AND
1384 1384
                     '.$groupfilter.$condition_session.'
1385 1385
                 ORDER BY id ASC';
1386
-        $result=Database::query($sql);
1387
-        $row=Database::fetch_array($result);
1386
+        $result = Database::query($sql);
1387
+        $row = Database::fetch_array($result);
1388 1388
 
1389 1389
         $status_visibility_disc = $row['visibility_disc'];
1390 1390
 
1391 1391
         //change status
1392
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
1393
-            if (isset($_GET['actionpage']) && $_GET['actionpage'] =='showdisc' && $status_visibility_disc==0) {
1394
-                $status_visibility_disc=1;
1392
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
1393
+            if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'showdisc' && $status_visibility_disc == 0) {
1394
+                $status_visibility_disc = 1;
1395 1395
             }
1396
-            if (isset($_GET['actionpage']) && $_GET['actionpage'] =='hidedisc' && $status_visibility_disc==1) {
1397
-                $status_visibility_disc=0;
1396
+            if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'hidedisc' && $status_visibility_disc == 1) {
1397
+                $status_visibility_disc = 0;
1398 1398
             }
1399 1399
 
1400 1400
             $sql = 'UPDATE '.$tbl_wiki.' SET visibility_disc="'.Database::escape_string($status_visibility_disc).'"
@@ -1442,14 +1442,14 @@  discard block
 block discarded – undo
1442 1442
         $result = Database::query($sql);
1443 1443
         $row = Database::fetch_array($result);
1444 1444
 
1445
-        $status_addlock_disc=$row['addlock_disc'];
1445
+        $status_addlock_disc = $row['addlock_disc'];
1446 1446
 
1447 1447
         //change status
1448 1448
         if (api_is_allowed_to_edit() || api_is_platform_admin()) {
1449
-            if (isset($_GET['actionpage']) && $_GET['actionpage'] =='lockdisc' && $status_addlock_disc==0) {
1449
+            if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'lockdisc' && $status_addlock_disc == 0) {
1450 1450
                 $status_addlock_disc = 1;
1451 1451
             }
1452
-            if (isset($_GET['actionpage']) && $_GET['actionpage'] =='unlockdisc' && $status_addlock_disc==1) {
1452
+            if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'unlockdisc' && $status_addlock_disc == 1) {
1453 1453
                 $status_addlock_disc = 0;
1454 1454
             }
1455 1455
 
@@ -1471,8 +1471,8 @@  discard block
 block discarded – undo
1471 1471
                         reflink="'.Database::escape_string($page).'" AND
1472 1472
                         '.$groupfilter.$condition_session.'
1473 1473
                     ORDER BY id ASC';
1474
-            $result=Database::query($sql);
1475
-            $row=Database::fetch_array($result);
1474
+            $result = Database::query($sql);
1475
+            $row = Database::fetch_array($result);
1476 1476
         }
1477 1477
 
1478 1478
         return $row['addlock_disc'];
@@ -1497,17 +1497,17 @@  discard block
 block discarded – undo
1497 1497
                     reflink="'.Database::escape_string($page).'" AND
1498 1498
                     '.$groupfilter.$condition_session.'
1499 1499
                 ORDER BY id ASC';
1500
-        $result=Database::query($sql);
1501
-        $row=Database::fetch_array($result);
1502
-        $status_ratinglock_disc=$row['ratinglock_disc'];
1500
+        $result = Database::query($sql);
1501
+        $row = Database::fetch_array($result);
1502
+        $status_ratinglock_disc = $row['ratinglock_disc'];
1503 1503
 
1504 1504
         //change status
1505
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
1506
-            if (isset($_GET['actionpage']) && $_GET['actionpage'] =='lockrating' && $status_ratinglock_disc==0) {
1507
-                $status_ratinglock_disc=1;
1505
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
1506
+            if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'lockrating' && $status_ratinglock_disc == 0) {
1507
+                $status_ratinglock_disc = 1;
1508 1508
             }
1509
-            if (isset($_GET['actionpage']) && $_GET['actionpage'] =='unlockrating' && $status_ratinglock_disc==1) {
1510
-                $status_ratinglock_disc=0;
1509
+            if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'unlockrating' && $status_ratinglock_disc == 1) {
1510
+                $status_ratinglock_disc = 0;
1511 1511
             }
1512 1512
 
1513 1513
             $sql = 'UPDATE '.$tbl_wiki.'
@@ -1523,14 +1523,14 @@  discard block
 block discarded – undo
1523 1523
             // these three lines remain necessary. They do that by changing the
1524 1524
             // page state is made when you press the button and not have to wait
1525 1525
             // to change his page
1526
-            $sql='SELECT * FROM '.$tbl_wiki.'
1526
+            $sql = 'SELECT * FROM '.$tbl_wiki.'
1527 1527
                   WHERE
1528 1528
                     c_id = '.$course_id.' AND
1529 1529
                     reflink="'.Database::escape_string($page).'" AND
1530 1530
                     '.$groupfilter.$condition_session.'
1531 1531
                   ORDER BY id ASC';
1532
-            $result=Database::query($sql);
1533
-            $row=Database::fetch_array($result);
1532
+            $result = Database::query($sql);
1533
+            $row = Database::fetch_array($result);
1534 1534
         }
1535 1535
 
1536 1536
         return $row['ratinglock_disc'];
@@ -1555,24 +1555,24 @@  discard block
 block discarded – undo
1555 1555
         $sql = 'SELECT * FROM '.$tbl_wiki.'
1556 1556
                 WHERE c_id = '.$course_id.' AND reflink="'.$reflink.'" AND '.$groupfilter.$condition_session.'
1557 1557
                 ORDER BY id ASC';
1558
-        $result=Database::query($sql);
1559
-        $row=Database::fetch_array($result);
1558
+        $result = Database::query($sql);
1559
+        $row = Database::fetch_array($result);
1560 1560
         $id = $row['id'];
1561
-        $sql='SELECT * FROM '.$tbl_wiki_mailcue.'
1561
+        $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
1562 1562
               WHERE c_id = '.$course_id.' AND id="'.$id.'" AND user_id="'.api_get_user_id().'" AND type="P"';
1563
-        $result=Database::query($sql);
1564
-        $row=Database::fetch_array($result);
1563
+        $result = Database::query($sql);
1564
+        $row = Database::fetch_array($result);
1565 1565
 
1566 1566
         $idm = $row['id'];
1567 1567
 
1568 1568
         if (empty($idm)) {
1569
-            $status_notify=0;
1569
+            $status_notify = 0;
1570 1570
         } else {
1571
-            $status_notify=1;
1571
+            $status_notify = 1;
1572 1572
         }
1573 1573
 
1574 1574
         // Change status
1575
-        if (isset($_GET['actionpage']) && $_GET['actionpage'] =='locknotify' && $status_notify==0) {
1575
+        if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'locknotify' && $status_notify == 0) {
1576 1576
             $sql = "SELECT id FROM $tbl_wiki_mailcue
1577 1577
                     WHERE c_id = $course_id AND id = $id AND user_id = $userId";
1578 1578
             $result = Database::query($sql);
@@ -1581,18 +1581,18 @@  discard block
 block discarded – undo
1581 1581
                 $exist = true;
1582 1582
             }
1583 1583
             if ($exist == false) {
1584
-                $sql="INSERT INTO ".$tbl_wiki_mailcue." (c_id, id, user_id, type, group_id, session_id) VALUES
1584
+                $sql = "INSERT INTO ".$tbl_wiki_mailcue." (c_id, id, user_id, type, group_id, session_id) VALUES
1585 1585
                 ($course_id, '".$id."','".api_get_user_id()."','P','".$groupId."','".$session_id."')";
1586 1586
                 Database::query($sql);
1587 1587
             }
1588
-            $status_notify=1;
1588
+            $status_notify = 1;
1589 1589
         }
1590 1590
 
1591
-        if (isset($_GET['actionpage']) && $_GET['actionpage'] =='unlocknotify' && $status_notify==1) {
1591
+        if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'unlocknotify' && $status_notify == 1) {
1592 1592
             $sql = 'DELETE FROM '.$tbl_wiki_mailcue.'
1593 1593
                     WHERE id="'.$id.'" AND user_id="'.api_get_user_id().'" AND type="P" AND c_id = '.$course_id;
1594 1594
             Database::query($sql);
1595
-            $status_notify=0;
1595
+            $status_notify = 0;
1596 1596
         }
1597 1597
 
1598 1598
         return $status_notify;
@@ -1618,9 +1618,9 @@  discard block
 block discarded – undo
1618 1618
         $sql = 'SELECT * FROM '.$tbl_wiki.'
1619 1619
                 WHERE c_id = '.$course_id.' AND reflink="'.$reflink.'" AND '.$groupfilter.$condition_session.'
1620 1620
                 ORDER BY id ASC';
1621
-        $result=Database::query($sql);
1622
-        $row=Database::fetch_array($result);
1623
-        $id=$row['id'];
1621
+        $result = Database::query($sql);
1622
+        $row = Database::fetch_array($result);
1623
+        $id = $row['id'];
1624 1624
         $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
1625 1625
                 WHERE c_id = '.$course_id.' AND id="'.$id.'" AND user_id="'.api_get_user_id().'" AND type="D"';
1626 1626
         $result = Database::query($sql);
@@ -1628,23 +1628,23 @@  discard block
 block discarded – undo
1628 1628
         $idm = $row['id'];
1629 1629
 
1630 1630
         if (empty($idm)) {
1631
-            $status_notify_disc=0;
1631
+            $status_notify_disc = 0;
1632 1632
         } else {
1633
-            $status_notify_disc=1;
1633
+            $status_notify_disc = 1;
1634 1634
         }
1635 1635
 
1636 1636
         //change status
1637
-        if (isset($_GET['actionpage']) && $_GET['actionpage'] =='locknotifydisc' && $status_notify_disc==0) {
1638
-            $sql="INSERT INTO ".$tbl_wiki_mailcue." (c_id, id, user_id, type, group_id, session_id) VALUES
1637
+        if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'locknotifydisc' && $status_notify_disc == 0) {
1638
+            $sql = "INSERT INTO ".$tbl_wiki_mailcue." (c_id, id, user_id, type, group_id, session_id) VALUES
1639 1639
             ($course_id, '".$id."','".api_get_user_id()."','D','".$groupId."','".$session_id."')";
1640 1640
             Database::query($sql);
1641
-            $status_notify_disc=1;
1641
+            $status_notify_disc = 1;
1642 1642
         }
1643
-        if (isset($_GET['actionpage']) && $_GET['actionpage'] =='unlocknotifydisc' && $status_notify_disc==1) {
1643
+        if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'unlocknotifydisc' && $status_notify_disc == 1) {
1644 1644
             $sql = 'DELETE FROM '.$tbl_wiki_mailcue.'
1645 1645
                     WHERE c_id = '.$course_id.' AND id="'.$id.'" AND user_id="'.api_get_user_id().'" AND type="D" AND c_id = '.$course_id;
1646 1646
             Database::query($sql);
1647
-            $status_notify_disc=0;
1647
+            $status_notify_disc = 0;
1648 1648
         }
1649 1649
 
1650 1650
         return $status_notify_disc;
@@ -1659,7 +1659,7 @@  discard block
 block discarded – undo
1659 1659
         $tbl_wiki_mailcue = $this->tbl_wiki_mailcue;
1660 1660
         $course_id = api_get_course_int_id();
1661 1661
         $groupId = api_get_group_id();
1662
-        $session_id=api_get_session_id();
1662
+        $session_id = api_get_session_id();
1663 1663
 
1664 1664
         $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
1665 1665
                 WHERE
@@ -1668,31 +1668,31 @@  discard block
 block discarded – undo
1668 1668
                     type="F" AND
1669 1669
                     group_id="'.$groupId.'" AND
1670 1670
                     session_id="'.$session_id.'"';
1671
-        $result=Database::query($sql);
1672
-        $row=Database::fetch_array($result);
1671
+        $result = Database::query($sql);
1672
+        $row = Database::fetch_array($result);
1673 1673
 
1674
-        $idm=$row['user_id'];
1674
+        $idm = $row['user_id'];
1675 1675
 
1676 1676
         if (empty($idm)) {
1677
-            $status_notify_all=0;
1677
+            $status_notify_all = 0;
1678 1678
         } else {
1679
-            $status_notify_all=1;
1679
+            $status_notify_all = 1;
1680 1680
         }
1681 1681
 
1682 1682
         //change status
1683
-        if (isset($_GET['actionpage']) && $_GET['actionpage'] =='locknotifyall' && $status_notify_all==0) {
1684
-            $sql="INSERT INTO ".$tbl_wiki_mailcue." (c_id, user_id, type, group_id, session_id) VALUES
1683
+        if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'locknotifyall' && $status_notify_all == 0) {
1684
+            $sql = "INSERT INTO ".$tbl_wiki_mailcue." (c_id, user_id, type, group_id, session_id) VALUES
1685 1685
             ($course_id, '".api_get_user_id()."','F','".$groupId."','".$session_id."')";
1686 1686
             Database::query($sql);
1687
-            $status_notify_all=1;
1687
+            $status_notify_all = 1;
1688 1688
         }
1689 1689
 
1690 1690
         if (isset($_GET['actionpage']) &&
1691 1691
             isset($_GET['actionpage']) &&
1692
-            $_GET['actionpage']  =='unlocknotifyall' &&
1692
+            $_GET['actionpage'] == 'unlocknotifyall' &&
1693 1693
             $status_notify_all == 1
1694 1694
         ) {
1695
-            $sql ='DELETE FROM '.$tbl_wiki_mailcue.'
1695
+            $sql = 'DELETE FROM '.$tbl_wiki_mailcue.'
1696 1696
                    WHERE
1697 1697
                     c_id = '.$course_id.' AND
1698 1698
                     user_id="'.api_get_user_id().'" AND
@@ -1701,7 +1701,7 @@  discard block
 block discarded – undo
1701 1701
                     session_id="'.$session_id.'" AND
1702 1702
                     c_id = '.$course_id;
1703 1703
             Database::query($sql);
1704
-            $status_notify_all=0;
1704
+            $status_notify_all = 0;
1705 1705
         }
1706 1706
 
1707 1707
         //show status
@@ -1711,7 +1711,7 @@  discard block
 block discarded – undo
1711 1711
     /**
1712 1712
      * Sends pending e-mails
1713 1713
      */
1714
-    public function check_emailcue($id_or_ref, $type, $lastime='', $lastuser='')
1714
+    public function check_emailcue($id_or_ref, $type, $lastime = '', $lastuser = '')
1715 1715
     {
1716 1716
         $tbl_wiki_mailcue = $this->tbl_wiki_mailcue;
1717 1717
         $tbl_wiki = $this->tbl_wiki;
@@ -1719,14 +1719,14 @@  discard block
 block discarded – undo
1719 1719
         $groupfilter = $this->groupfilter;
1720 1720
         $_course = $this->courseInfo;
1721 1721
         $groupId = api_get_group_id();
1722
-        $session_id=api_get_session_id();
1722
+        $session_id = api_get_session_id();
1723 1723
         $course_id = api_get_course_int_id();
1724 1724
 
1725
-        $group_properties  = GroupManager :: get_group_properties($groupId);
1725
+        $group_properties = GroupManager :: get_group_properties($groupId);
1726 1726
         $group_name = $group_properties['name'];
1727 1727
         $allow_send_mail = false; //define the variable to below
1728 1728
         $email_assignment = null;
1729
-        if ($type=='P') {
1729
+        if ($type == 'P') {
1730 1730
             //if modifying a wiki page
1731 1731
             //first, current author and time
1732 1732
             //Who is the author?
@@ -1737,22 +1737,22 @@  discard block
 block discarded – undo
1737 1737
             $year = substr($lastime, 0, 4);
1738 1738
             $month = substr($lastime, 5, 2);
1739 1739
             $day = substr($lastime, 8, 2);
1740
-            $hours=substr($lastime, 11,2);
1741
-            $minutes=substr($lastime, 14,2);
1742
-            $seconds=substr($lastime, 17,2);
1743
-            $email_date_changes=$day.' '.$month.' '.$year.' '.$hours.":".$minutes.":".$seconds;
1740
+            $hours = substr($lastime, 11, 2);
1741
+            $minutes = substr($lastime, 14, 2);
1742
+            $seconds = substr($lastime, 17, 2);
1743
+            $email_date_changes = $day.' '.$month.' '.$year.' '.$hours.":".$minutes.":".$seconds;
1744 1744
 
1745 1745
             //second, extract data from first reg
1746 1746
             $sql = 'SELECT * FROM '.$tbl_wiki.'
1747 1747
                     WHERE  c_id = '.$course_id.' AND reflink="'.$id_or_ref.'" AND '.$groupfilter.$condition_session.'
1748 1748
                     ORDER BY id ASC';
1749
-            $result=Database::query($sql);
1750
-            $row=Database::fetch_array($result);
1749
+            $result = Database::query($sql);
1750
+            $row = Database::fetch_array($result);
1751 1751
 
1752
-            $id=$row['id'];
1753
-            $email_page_name=$row['title'];
1754
-            if ($row['visibility']==1) {
1755
-                $allow_send_mail=true; //if visibility off - notify off
1752
+            $id = $row['id'];
1753
+            $email_page_name = $row['title'];
1754
+            if ($row['visibility'] == 1) {
1755
+                $allow_send_mail = true; //if visibility off - notify off
1756 1756
                 $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
1757 1757
                         WHERE
1758 1758
                             c_id = '.$course_id.' AND
@@ -1762,10 +1762,10 @@  discard block
 block discarded – undo
1762 1762
                             group_id="'.$groupId.'" AND
1763 1763
                             session_id="'.$session_id.'"';
1764 1764
                 //type: P=page, D=discuss, F=full.
1765
-                $result=Database::query($sql);
1766
-                $emailtext=get_lang('EmailWikipageModified').' <strong>'.$email_page_name.'</strong> '.get_lang('Wiki');
1765
+                $result = Database::query($sql);
1766
+                $emailtext = get_lang('EmailWikipageModified').' <strong>'.$email_page_name.'</strong> '.get_lang('Wiki');
1767 1767
             }
1768
-        } elseif ($type=='D') {
1768
+        } elseif ($type == 'D') {
1769 1769
             //if added a post to discuss
1770 1770
 
1771 1771
             //first, current author and time
@@ -1777,25 +1777,25 @@  discard block
 block discarded – undo
1777 1777
             $year = substr($lastime, 0, 4);
1778 1778
             $month = substr($lastime, 5, 2);
1779 1779
             $day = substr($lastime, 8, 2);
1780
-            $hours=substr($lastime, 11,2);
1781
-            $minutes=substr($lastime, 14,2);
1782
-            $seconds=substr($lastime, 17,2);
1783
-            $email_date_changes=$day.' '.$month.' '.$year.' '.$hours.":".$minutes.":".$seconds;
1780
+            $hours = substr($lastime, 11, 2);
1781
+            $minutes = substr($lastime, 14, 2);
1782
+            $seconds = substr($lastime, 17, 2);
1783
+            $email_date_changes = $day.' '.$month.' '.$year.' '.$hours.":".$minutes.":".$seconds;
1784 1784
 
1785 1785
             //second, extract data from first reg
1786 1786
 
1787
-            $id=$id_or_ref; //$id_or_ref is id from tblwiki
1787
+            $id = $id_or_ref; //$id_or_ref is id from tblwiki
1788 1788
 
1789 1789
             $sql = 'SELECT * FROM '.$tbl_wiki.'
1790 1790
                     WHERE c_id = '.$course_id.' AND id="'.$id.'"
1791 1791
                     ORDER BY id ASC';
1792 1792
 
1793
-            $result=Database::query($sql);
1794
-            $row=Database::fetch_array($result);
1793
+            $result = Database::query($sql);
1794
+            $row = Database::fetch_array($result);
1795 1795
 
1796
-            $email_page_name=$row['title'];
1797
-            if ($row['visibility_disc']==1) {
1798
-                $allow_send_mail=true; //if visibility off - notify off
1796
+            $email_page_name = $row['title'];
1797
+            if ($row['visibility_disc'] == 1) {
1798
+                $allow_send_mail = true; //if visibility off - notify off
1799 1799
                 $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
1800 1800
                         WHERE
1801 1801
                             c_id = '.$course_id.' AND
@@ -1806,22 +1806,22 @@  discard block
 block discarded – undo
1806 1806
                             session_id="'.$session_id.'"';
1807 1807
                 //type: P=page, D=discuss, F=full
1808 1808
                 $result = Database::query($sql);
1809
-                $emailtext=get_lang('EmailWikiPageDiscAdded').' <strong>'.$email_page_name.'</strong> '.get_lang('Wiki');
1809
+                $emailtext = get_lang('EmailWikiPageDiscAdded').' <strong>'.$email_page_name.'</strong> '.get_lang('Wiki');
1810 1810
             }
1811
-        } elseif($type=='A') {
1811
+        } elseif ($type == 'A') {
1812 1812
             //for added pages
1813
-            $id=0; //for tbl_wiki_mailcue
1813
+            $id = 0; //for tbl_wiki_mailcue
1814 1814
             $sql = 'SELECT * FROM '.$tbl_wiki.'
1815 1815
                     WHERE c_id = '.$course_id.'
1816 1816
                     ORDER BY id DESC'; //the added is always the last
1817 1817
 
1818
-            $result=Database::query($sql);
1819
-            $row=Database::fetch_array($result);
1820
-            $email_page_name=$row['title'];
1818
+            $result = Database::query($sql);
1819
+            $row = Database::fetch_array($result);
1820
+            $email_page_name = $row['title'];
1821 1821
 
1822 1822
             //Who is the author?
1823 1823
             $userinfo = api_get_user_info($row['user_id']);
1824
-            $email_user_author= get_lang('AddedBy').': '.$userinfo['complete_name'];
1824
+            $email_user_author = get_lang('AddedBy').': '.$userinfo['complete_name'];
1825 1825
 
1826 1826
             //When ?
1827 1827
             $year = substr($row['dtime'], 0, 4);
@@ -1830,33 +1830,33 @@  discard block
 block discarded – undo
1830 1830
             $hours = substr($row['dtime'], 11, 2);
1831 1831
             $minutes = substr($row['dtime'], 14, 2);
1832 1832
             $seconds = substr($row['dtime'], 17, 2);
1833
-            $email_date_changes=$day.' '.$month.' '.$year.' '.$hours.":".$minutes.":".$seconds;
1834
-
1835
-            if($row['assignment']==0) {
1836
-                $allow_send_mail=true;
1837
-            } elseif($row['assignment']==1) {
1838
-                $email_assignment=get_lang('AssignmentDescExtra').' ('.get_lang('AssignmentMode').')';
1839
-                $allow_send_mail=true;
1840
-            } elseif($row['assignment']==2) {
1841
-                $allow_send_mail=false; //Mode tasks: avoids notifications to all users about all users
1833
+            $email_date_changes = $day.' '.$month.' '.$year.' '.$hours.":".$minutes.":".$seconds;
1834
+
1835
+            if ($row['assignment'] == 0) {
1836
+                $allow_send_mail = true;
1837
+            } elseif ($row['assignment'] == 1) {
1838
+                $email_assignment = get_lang('AssignmentDescExtra').' ('.get_lang('AssignmentMode').')';
1839
+                $allow_send_mail = true;
1840
+            } elseif ($row['assignment'] == 2) {
1841
+                $allow_send_mail = false; //Mode tasks: avoids notifications to all users about all users
1842 1842
             }
1843 1843
 
1844 1844
             $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
1845 1845
                     WHERE c_id = '.$course_id.' AND  id="'.$id.'" AND type="F" AND group_id="'.$groupId.'" AND session_id="'.$session_id.'"';
1846 1846
             //type: P=page, D=discuss, F=full
1847
-            $result=Database::query($sql);
1847
+            $result = Database::query($sql);
1848 1848
 
1849
-            $emailtext = get_lang('EmailWikiPageAdded').' <strong>'.$email_page_name.'</strong> '.get_lang('In').' '. get_lang('Wiki');
1850
-        } elseif ($type=='E') {
1851
-            $id=0;
1852
-            $allow_send_mail=true;
1849
+            $emailtext = get_lang('EmailWikiPageAdded').' <strong>'.$email_page_name.'</strong> '.get_lang('In').' '.get_lang('Wiki');
1850
+        } elseif ($type == 'E') {
1851
+            $id = 0;
1852
+            $allow_send_mail = true;
1853 1853
 
1854 1854
             //Who is the author?
1855
-            $userinfo = api_get_user_info(api_get_user_id());	//current user
1855
+            $userinfo = api_get_user_info(api_get_user_id()); //current user
1856 1856
             $email_user_author = get_lang('DeletedBy').': '.$userinfo['complete_name'];
1857 1857
             //When ?
1858
-            $today = date('r');		//current time
1859
-            $email_date_changes=$today;
1858
+            $today = date('r'); //current time
1859
+            $email_date_changes = $today;
1860 1860
 
1861 1861
             $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.'
1862 1862
                     WHERE
@@ -1870,16 +1870,16 @@  discard block
 block discarded – undo
1870 1870
         ///make and send email
1871 1871
         if ($allow_send_mail) {
1872 1872
             while ($row = Database::fetch_array($result)) {
1873
-                $userinfo = api_get_user_info($row['user_id']);	//$row['user_id'] obtained from tbl_wiki_mailcue
1873
+                $userinfo = api_get_user_info($row['user_id']); //$row['user_id'] obtained from tbl_wiki_mailcue
1874 1874
                 $name_to = $userinfo['complete_name'];
1875 1875
                 $email_to = $userinfo['email'];
1876 1876
                 $sender_name = api_get_setting('emailAdministrator');
1877 1877
                 $sender_email = api_get_setting('emailAdministrator');
1878 1878
                 $email_subject = get_lang('EmailWikiChanges').' - '.$_course['official_code'];
1879 1879
                 $email_body = get_lang('DearUser').' '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).',<br /><br />';
1880
-                if($session_id==0){
1880
+                if ($session_id == 0) {
1881 1881
                     $email_body .= $emailtext.' <strong>'.$_course['name'].' - '.$group_name.'</strong><br /><br /><br />';
1882
-                }else{
1882
+                } else {
1883 1883
                     $email_body .= $emailtext.' <strong>'.$_course['name'].' ('.api_get_session_name(api_get_session_id()).') - '.$group_name.'</strong><br /><br /><br />';
1884 1884
                 }
1885 1885
                 $email_body .= $email_user_author.' ('.$email_date_changes.')<br /><br /><br />';
@@ -1957,23 +1957,23 @@  discard block
 block discarded – undo
1957 1957
             $template);
1958 1958
 
1959 1959
         if (0 != $groupId) {
1960
-            $groupPart = '_group' . $groupId; // and add groupId to put the same document title in different groups
1961
-            $group_properties  = GroupManager :: get_group_properties($groupId);
1960
+            $groupPart = '_group'.$groupId; // and add groupId to put the same document title in different groups
1961
+            $group_properties = GroupManager :: get_group_properties($groupId);
1962 1962
             $groupPath = $group_properties['directory'];
1963 1963
         } else {
1964 1964
             $groupPart = '';
1965
-            $groupPath ='';
1965
+            $groupPath = '';
1966 1966
         }
1967 1967
 
1968
-        $exportDir = api_get_path(SYS_COURSE_PATH).api_get_course_path(). '/document'.$groupPath;
1969
-        $exportFile = api_replace_dangerous_char($wikiTitle) . $groupPart;
1968
+        $exportDir = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/document'.$groupPath;
1969
+        $exportFile = api_replace_dangerous_char($wikiTitle).$groupPart;
1970 1970
         $wikiContents = trim(preg_replace("/\[[\[]?([^\]|]*)[|]?([^|\]]*)\][\]]?/", "$1", $wikiContents));
1971 1971
         //TODO: put link instead of title
1972 1972
 
1973 1973
         $wikiContents = str_replace('{CONTENT}', $wikiContents, $template);
1974 1974
 
1975 1975
         // replace relative path by absolute path for courses, so you can see items into this page wiki (images, mp3, etc..) exported in documents
1976
-        if (api_strpos($wikiContents,'../..'.api_get_path(REL_COURSE_PATH)) !== false) {
1976
+        if (api_strpos($wikiContents, '../..'.api_get_path(REL_COURSE_PATH)) !== false) {
1977 1977
             $web_course_path = api_get_path(WEB_COURSE_PATH);
1978 1978
             $wikiContents = str_replace('../..'.api_get_path(REL_COURSE_PATH), $web_course_path, $wikiContents);
1979 1979
         }
@@ -1984,8 +1984,8 @@  discard block
 block discarded – undo
1984 1984
             $i++;
1985 1985
         }
1986 1986
 
1987
-        $wikiFileName = $exportFile . '_' . $i . '.html';
1988
-        $exportPath = $exportDir . '/' . $wikiFileName;
1987
+        $wikiFileName = $exportFile.'_'.$i.'.html';
1988
+        $exportPath = $exportDir.'/'.$wikiFileName;
1989 1989
 
1990 1990
         file_put_contents($exportPath, $wikiContents);
1991 1991
         $doc_id = add_document(
@@ -2030,14 +2030,14 @@  discard block
 block discarded – undo
2030 2030
         $content_pdf = api_html_entity_decode($data['content'], ENT_QUOTES, api_get_system_encoding());
2031 2031
 
2032 2032
         //clean wiki links
2033
-        $content_pdf=trim(preg_replace("/\[[\[]?([^\]|]*)[|]?([^|\]]*)\][\]]?/", "$1", $content_pdf));
2033
+        $content_pdf = trim(preg_replace("/\[[\[]?([^\]|]*)[|]?([^|\]]*)\][\]]?/", "$1", $content_pdf));
2034 2034
         //TODO: It should be better to display the link insted of the tile but it is hard for [[title]] links
2035 2035
 
2036 2036
         $title_pdf = api_html_entity_decode($data['title'], ENT_QUOTES, api_get_system_encoding());
2037 2037
         $title_pdf = api_utf8_encode($title_pdf, api_get_system_encoding());
2038 2038
         $content_pdf = api_utf8_encode($content_pdf, api_get_system_encoding());
2039 2039
 
2040
-        $html='
2040
+        $html = '
2041 2041
         <!-- defines the headers/footers - this must occur before the headers/footers are set -->
2042 2042
 
2043 2043
         <!--mpdf
@@ -2092,9 +2092,9 @@  discard block
 block discarded – undo
2092 2092
         $session_id = $this->session_id;
2093 2093
         $groupId = api_get_group_id();
2094 2094
 
2095
-        if ($groupId==0) {
2095
+        if ($groupId == 0) {
2096 2096
             //extract course members
2097
-            if(!empty($session_id)) {
2097
+            if (!empty($session_id)) {
2098 2098
                 $a_users_to_add = CourseManager::get_user_list_from_course_code(api_get_course_id(), $session_id);
2099 2099
             } else {
2100 2100
                 $a_users_to_add = CourseManager::get_user_list_from_course_code(api_get_course_id(), 0);
@@ -2120,7 +2120,7 @@  discard block
 block discarded – undo
2120 2120
         $username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username'], ENT_QUOTES));
2121 2121
         $name = $userinfo['complete_name']." - ".$username;
2122 2122
 
2123
-        $photo = '<img src="' . $userinfo['avatar'] . '" alt="' . $name . '"  width="40" height="50" align="top" title="' . $name . '"  />';
2123
+        $photo = '<img src="'.$userinfo['avatar'].'" alt="'.$name.'"  width="40" height="50" align="top" title="'.$name.'"  />';
2124 2124
 
2125 2125
         // teacher assignment title
2126 2126
         $title_orig = $values['title'];
@@ -2148,24 +2148,24 @@  discard block
 block discarded – undo
2148 2148
                 $userPicture = UserManager::getUserPicture($assig_user_id);
2149 2149
                 $username = api_htmlentities(sprintf(get_lang('LoginX'), $o_user_to_add['username'], ENT_QUOTES));
2150 2150
                 $name = api_get_person_name($o_user_to_add['firstname'], $o_user_to_add['lastname'])." . ".$username;
2151
-                $photo= '<img src="'.$userPicture.'" alt="'.$name.'"  width="40" height="50" align="bottom" title="'.$name.'"  />';
2151
+                $photo = '<img src="'.$userPicture.'" alt="'.$name.'"  width="40" height="50" align="bottom" title="'.$name.'"  />';
2152 2152
 
2153 2153
                 $is_tutor_of_group = GroupManager::is_tutor_of_group($assig_user_id, $groupId); //student is tutor
2154 2154
                 $is_tutor_and_member = GroupManager::is_tutor_of_group($assig_user_id, $groupId) && GroupManager::is_subscribed($assig_user_id, $groupId);
2155 2155
                 // student is tutor and member
2156 2156
 
2157 2157
                 if ($is_tutor_and_member) {
2158
-                    $status_in_group=get_lang('GroupTutorAndMember');
2158
+                    $status_in_group = get_lang('GroupTutorAndMember');
2159 2159
                 } else {
2160
-                    if($is_tutor_of_group) {
2161
-                        $status_in_group=get_lang('GroupTutor');
2160
+                    if ($is_tutor_of_group) {
2161
+                        $status_in_group = get_lang('GroupTutor');
2162 2162
                     } else {
2163
-                        $status_in_group=" "; //get_lang('GroupStandardMember')
2163
+                        $status_in_group = " "; //get_lang('GroupStandardMember')
2164 2164
                     }
2165 2165
                 }
2166 2166
 
2167
-                if ($assignment_type==1) {
2168
-                    $values['title']= $title_orig;
2167
+                if ($assignment_type == 1) {
2168
+                    $values['title'] = $title_orig;
2169 2169
                     $values['content'] = '<div align="center" style="background-color: #F5F8FB; border:solid; border-color: #E6E6E6">
2170 2170
                     <table border="0">
2171 2171
                     <tr><td style="font-size:24px">'.get_lang('AssignmentWork').'</td></tr>
@@ -2181,7 +2181,7 @@  discard block
 block discarded – undo
2181 2181
                         ).
2182 2182
                         ' [['.$_POST['title']."_uass".$assig_user_id.' | '.$photo.']] '.$status_in_group.'</li>';
2183 2183
                     //don't change this line without guaranteeing that users will be ordered by last names in the following format (surname, name)
2184
-                    $values['assignment']=2;
2184
+                    $values['assignment'] = 2;
2185 2185
                 }
2186 2186
                 $this->assig_user_id = $assig_user_id;
2187 2187
                 self::save_new_wiki($values);
@@ -2190,12 +2190,12 @@  discard block
 block discarded – undo
2190 2190
 
2191 2191
         foreach ($a_users_to_add as $o_user_to_add) {
2192 2192
             if ($o_user_to_add['user_id'] == $userId) {
2193
-                $assig_user_id=$o_user_to_add['user_id'];
2193
+                $assig_user_id = $o_user_to_add['user_id'];
2194 2194
                 if ($assignment_type == 1) {
2195
-                    $values['title']= $title_orig;
2196
-                    $values['comment']=get_lang('AssignmentDesc');
2195
+                    $values['title'] = $title_orig;
2196
+                    $values['comment'] = get_lang('AssignmentDesc');
2197 2197
                     sort($all_students_pages);
2198
-                    $values['content']=$content_orig_A.$content_orig_B.'<br/>
2198
+                    $values['content'] = $content_orig_A.$content_orig_B.'<br/>
2199 2199
                     <div align="center" style="font-size:18px; background-color: #F5F8FB; border:solid; border-color:#E6E6E6">
2200 2200
                     '.get_lang('AssignmentLinkstoStudentsPage').'
2201 2201
                     </div><br/>
@@ -2203,7 +2203,7 @@  discard block
 block discarded – undo
2203 2203
                     <ol>'.implode($all_students_pages).'</ol>
2204 2204
                     </div>
2205 2205
                     <br/>';
2206
-                    $values['assignment']=1;
2206
+                    $values['assignment'] = 1;
2207 2207
                 }
2208 2208
                 $this->assig_user_id = $assig_user_id;
2209 2209
                 self::save_new_wiki($values);
@@ -2217,7 +2217,7 @@  discard block
 block discarded – undo
2217 2217
      * @param   int     Whether to search the contents (1) or just the titles (0)
2218 2218
      * @param int
2219 2219
      */
2220
-    public function display_wiki_search_results($search_term, $search_content=0, $all_vers=0)
2220
+    public function display_wiki_search_results($search_term, $search_content = 0, $all_vers = 0)
2221 2221
     {
2222 2222
         $tbl_wiki = $this->tbl_wiki;
2223 2223
         $condition_session = $this->condition_session;
@@ -2229,9 +2229,9 @@  discard block
 block discarded – undo
2229 2229
         echo '</legend>';
2230 2230
 
2231 2231
         //only by professors when page is hidden
2232
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
2233
-            if ($all_vers=='1') {
2234
-                if ($search_content=='1') {
2232
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
2233
+            if ($all_vers == '1') {
2234
+                if ($search_content == '1') {
2235 2235
                     $sql = "SELECT * FROM ".$tbl_wiki."
2236 2236
                             WHERE
2237 2237
                                 c_id = $course_id AND
@@ -2248,7 +2248,7 @@  discard block
 block discarded – undo
2248 2248
                     //search all pages and all versions
2249 2249
                 }
2250 2250
             } else {
2251
-                if ($search_content=='1') {
2251
+                if ($search_content == '1') {
2252 2252
                     $sql = "SELECT * FROM ".$tbl_wiki." s1
2253 2253
                             WHERE
2254 2254
                                 s1.c_id = $course_id AND
@@ -2299,7 +2299,7 @@  discard block
 block discarded – undo
2299 2299
                     //search all pages and all versions
2300 2300
                 }
2301 2301
             } else {
2302
-                if($search_content=='1') {
2302
+                if ($search_content == '1') {
2303 2303
                     $sql = "SELECT * FROM ".$tbl_wiki." s1
2304 2304
                             WHERE
2305 2305
                                 s1.c_id = $course_id AND
@@ -2347,17 +2347,17 @@  discard block
 block discarded – undo
2347 2347
                 $seconds = substr($obj->dtime, 17, 2);
2348 2348
 
2349 2349
                 //get type assignment icon
2350
-                if($obj->assignment==1) {
2351
-                    $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL);
2352
-                } elseif ($obj->assignment==2) {
2353
-                    $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
2354
-                } elseif ($obj->assignment==0) {
2350
+                if ($obj->assignment == 1) {
2351
+                    $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL);
2352
+                } elseif ($obj->assignment == 2) {
2353
+                    $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
2354
+                } elseif ($obj->assignment == 0) {
2355 2355
                     $ShowAssignment = Display::return_icon('px_transparent.gif');
2356 2356
                 }
2357 2357
                 $row = array();
2358 2358
                 $row[] = $ShowAssignment;
2359 2359
 
2360
-                if($all_vers=='1') {
2360
+                if ($all_vers == '1') {
2361 2361
                     $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'])).'">'.
2362 2362
                         api_htmlentities($obj->title).'</a>';
2363 2363
                 } else {
@@ -2368,21 +2368,21 @@  discard block
 block discarded – undo
2368 2368
                 $row[] = ($obj->user_id != 0 && $userinfo !== false) ? UserManager::getUserProfileLink($userinfo) : get_lang('Anonymous').' ('.$obj->user_ip.')';
2369 2369
                 $row[] = $year.'-'.$month.'-'.$day.' '.$hours.":".$minutes.":".$seconds;
2370 2370
 
2371
-                if ($all_vers=='1') {
2371
+                if ($all_vers == '1') {
2372 2372
                     $row[] = $obj->version;
2373 2373
                 } else {
2374 2374
                     $showdelete = '';
2375
-                    if (api_is_allowed_to_edit(false,true)|| api_is_platform_admin()) {
2376
-                        $showdelete=' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete&title='.api_htmlentities(urlencode($obj->reflink)).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
2377
-                            Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL);
2375
+                    if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
2376
+                        $showdelete = ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete&title='.api_htmlentities(urlencode($obj->reflink)).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
2377
+                            Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
2378 2378
                     }
2379 2379
                     $row[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit&title='.api_htmlentities(urlencode($obj->reflink)).'&group_id='.api_htmlentities($_GET['group_id']).'">'.
2380
-                        Display::return_icon('edit.png', get_lang('EditPage'),'',ICON_SIZE_SMALL).'</a>
2380
+                        Display::return_icon('edit.png', get_lang('EditPage'), '', ICON_SIZE_SMALL).'</a>
2381 2381
                         <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']).'">'.
2382
-                        Display::return_icon('discuss.png', get_lang('Discuss'),'',ICON_SIZE_SMALL).'</a>
2382
+                        Display::return_icon('discuss.png', get_lang('Discuss'), '', ICON_SIZE_SMALL).'</a>
2383 2383
                         <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']).'">'.
2384
-                        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']).'">'.
2385
-                        Display::return_icon('what_link_here.png', get_lang('LinksPages'),'',ICON_SIZE_SMALL).'</a>'.$showdelete;
2384
+                        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']).'">'.
2385
+                        Display::return_icon('what_link_here.png', get_lang('LinksPages'), '', ICON_SIZE_SMALL).'</a>'.$showdelete;
2386 2386
                 }
2387 2387
                 $rows[] = $row;
2388 2388
             }
@@ -2407,16 +2407,16 @@  discard block
 block discarded – undo
2407 2407
                     'all_vers' => $all_vers,
2408 2408
                 )
2409 2409
             );
2410
-            $table->set_header(0,get_lang('Type'), true, array ('style' => 'width:30px;'));
2411
-            $table->set_header(1,get_lang('Title'), true);
2410
+            $table->set_header(0, get_lang('Type'), true, array('style' => 'width:30px;'));
2411
+            $table->set_header(1, get_lang('Title'), true);
2412 2412
             if ($all_vers == '1') {
2413
-                $table->set_header(2,get_lang('Author'), true);
2414
-                $table->set_header(3,get_lang('Date'), true);
2415
-                $table->set_header(4,get_lang('Version'), true);
2413
+                $table->set_header(2, get_lang('Author'), true);
2414
+                $table->set_header(3, get_lang('Date'), true);
2415
+                $table->set_header(4, get_lang('Version'), true);
2416 2416
             } else {
2417
-                $table->set_header(2,get_lang('Author').' ('.get_lang('LastVersion').')', true);
2418
-                $table->set_header(3,get_lang('Date').' ('.get_lang('LastVersion').')', true);
2419
-                $table->set_header(4,get_lang('Actions'), false, array ('style' => 'width:130px;'));
2417
+                $table->set_header(2, get_lang('Author').' ('.get_lang('LastVersion').')', true);
2418
+                $table->set_header(3, get_lang('Date').' ('.get_lang('LastVersion').')', true);
2419
+                $table->set_header(4, get_lang('Actions'), false, array('style' => 'width:130px;'));
2420 2420
             }
2421 2421
             $table->display();
2422 2422
         } else {
@@ -2429,14 +2429,14 @@  discard block
 block discarded – undo
2429 2429
      * @todo replace this function with the formvalidator datepicker
2430 2430
      *
2431 2431
      */
2432
-    public function draw_date_picker($prefix,$default='')
2432
+    public function draw_date_picker($prefix, $default = '')
2433 2433
     {
2434 2434
         if (empty($default)) {
2435 2435
             $default = date('Y-m-d H:i:s');
2436 2436
         }
2437 2437
         $parts = explode(' ', $default);
2438
-        list($d_year,$d_month,$d_day) = explode('-',$parts[0]);
2439
-        list($d_hour,$d_minute) = explode(':',$parts[1]);
2438
+        list($d_year, $d_month, $d_day) = explode('-', $parts[0]);
2439
+        list($d_hour, $d_minute) = explode(':', $parts[1]);
2440 2440
 
2441 2441
         $month_list = array(
2442 2442
             1 => get_lang('JanuaryLong'),
@@ -2453,9 +2453,9 @@  discard block
 block discarded – undo
2453 2453
             12 => get_lang('DecemberLong'),
2454 2454
         );
2455 2455
 
2456
-        $minute = range(10,59);
2457
-        array_unshift($minute,'00','01','02','03','04','05','06','07','08','09');
2458
-        $date_form = self::make_select($prefix.'_day', array_combine(range(1,31),range(1,31)), $d_day);
2456
+        $minute = range(10, 59);
2457
+        array_unshift($minute, '00', '01', '02', '03', '04', '05', '06', '07', '08', '09');
2458
+        $date_form = self::make_select($prefix.'_day', array_combine(range(1, 31), range(1, 31)), $d_day);
2459 2459
         $date_form .= self::make_select($prefix.'_month', $month_list, $d_month);
2460 2460
         $date_form .= self::make_select(
2461 2461
                 $prefix.'_year',
@@ -2468,7 +2468,7 @@  discard block
 block discarded – undo
2468 2468
                 ),
2469 2469
                 $d_year
2470 2470
             ).'&nbsp;&nbsp;&nbsp;&nbsp;';
2471
-        $date_form .= self::make_select($prefix.'_hour', array_combine(range(0,23),range(0,23)), $d_hour).' : ';
2471
+        $date_form .= self::make_select($prefix.'_hour', array_combine(range(0, 23), range(0, 23)), $d_hour).' : ';
2472 2472
         $date_form .= self::make_select($prefix.'_minute', $minute, $d_minute);
2473 2473
 
2474 2474
         return $date_form;
@@ -2478,11 +2478,11 @@  discard block
 block discarded – undo
2478 2478
      * Draws an HTML form select with the given options
2479 2479
      *
2480 2480
      */
2481
-    public function make_select($name,$values,$checked='')
2481
+    public function make_select($name, $values, $checked = '')
2482 2482
     {
2483 2483
         $output = '<select name="'.$name.'" id="'.$name.'">';
2484
-        foreach($values as $key => $value) {
2485
-            $output .= '<option value="'.$key.'" '.(($checked==$key)?'selected="selected"':'').'>'.$value.'</option>';
2484
+        foreach ($values as $key => $value) {
2485
+            $output .= '<option value="'.$key.'" '.(($checked == $key) ? 'selected="selected"' : '').'>'.$value.'</option>';
2486 2486
         }
2487 2487
         $output .= '</select>';
2488 2488
         return $output;
@@ -2506,7 +2506,7 @@  discard block
 block discarded – undo
2506 2506
      */
2507 2507
     public function two_digits($number)
2508 2508
     {
2509
-        $number = (int)$number;
2509
+        $number = (int) $number;
2510 2510
         return ($number < 10) ? '0'.$number : $number;
2511 2511
     }
2512 2512
 
@@ -2527,7 +2527,7 @@  discard block
 block discarded – undo
2527 2527
                 WHERE c_id = '.$course_id.' AND id = '.$id.' ';
2528 2528
         $result = Database::query($sql);
2529 2529
         $data = array();
2530
-        while ($row=Database::fetch_array($result,'ASSOC'))   {
2530
+        while ($row = Database::fetch_array($result, 'ASSOC')) {
2531 2531
             $data = $row;
2532 2532
         }
2533 2533
         return $data;
@@ -2581,7 +2581,7 @@  discard block
 block discarded – undo
2581 2581
         $result = Database::query($sql);
2582 2582
         $data = array();
2583 2583
         if (Database::num_rows($result)) {
2584
-            $data = Database::fetch_array($result,'ASSOC');
2584
+            $data = Database::fetch_array($result, 'ASSOC');
2585 2585
         }
2586 2586
 
2587 2587
         return $data;
@@ -2675,9 +2675,9 @@  discard block
 block discarded – undo
2675 2675
         $result = self::getAllWiki();
2676 2676
         if (!empty($result)) {
2677 2677
             foreach ($result  as $is_editing_block) {
2678
-                $max_edit_time	= 1200; // 20 minutes
2679
-                $timestamp_edit	= strtotime($is_editing_block['time_edit']);
2680
-                $time_editing	= time()-$timestamp_edit;
2678
+                $max_edit_time = 1200; // 20 minutes
2679
+                $timestamp_edit = strtotime($is_editing_block['time_edit']);
2680
+                $time_editing = time() - $timestamp_edit;
2681 2681
 
2682 2682
                 // First prevent concurrent users and double version
2683 2683
                 if ($is_editing_block['is_editing'] == $userId) {
@@ -2686,7 +2686,7 @@  discard block
 block discarded – undo
2686 2686
                     unset($_SESSION['_version']);
2687 2687
                 }
2688 2688
                 // Second checks if has exceeded the time that a page may be available or if a page was edited and saved by its author
2689
-                if ($time_editing > $max_edit_time || ($is_editing_block['is_editing'] == $userId && $action!='edit')) {
2689
+                if ($time_editing > $max_edit_time || ($is_editing_block['is_editing'] == $userId && $action != 'edit')) {
2690 2690
                     self::updateWikiIsEditing($is_editing_block['is_editing']);
2691 2691
                 }
2692 2692
             }
@@ -2734,7 +2734,7 @@  discard block
 block discarded – undo
2734 2734
                 FROM ".$tbl_wiki."
2735 2735
                 WHERE c_id = $course_id AND ".$groupfilter.$condition_session."";
2736 2736
 
2737
-        $allpages=Database::query($sql);
2737
+        $allpages = Database::query($sql);
2738 2738
         while ($row = Database::fetch_array($allpages)) {
2739 2739
             $total_versions = $row['TOTAL_VERS'];
2740 2740
             $total_visits = intval($row['TOTAL_VISITS']);
@@ -2744,30 +2744,30 @@  discard block
 block discarded – undo
2744 2744
                 WHERE c_id = $course_id AND ".$groupfilter.$condition_session."";
2745 2745
         $allpages = Database::query($sql);
2746 2746
 
2747
-        while ($row=Database::fetch_array($allpages)) {
2747
+        while ($row = Database::fetch_array($allpages)) {
2748 2748
             $total_words = $total_words + self::word_count($row['content']);
2749
-            $total_links 			= $total_links+substr_count($row['content'], "href=");
2750
-            $total_links_anchors 	= $total_links_anchors+substr_count($row['content'], 'href="#');
2751
-            $total_links_mail		= $total_links_mail+substr_count($row['content'], 'href="mailto');
2752
-            $total_links_ftp 		= $total_links_ftp+substr_count($row['content'], 'href="ftp');
2753
-            $total_links_irc		= $total_links_irc+substr_count($row['content'], 'href="irc');
2754
-            $total_links_news 		= $total_links_news+substr_count($row['content'], 'href="news');
2755
-            $total_wlinks 			= $total_wlinks+substr_count($row['content'], "[[");
2756
-            $total_images 			= $total_images+substr_count($row['content'], "<img");
2749
+            $total_links = $total_links + substr_count($row['content'], "href=");
2750
+            $total_links_anchors = $total_links_anchors + substr_count($row['content'], 'href="#');
2751
+            $total_links_mail		= $total_links_mail + substr_count($row['content'], 'href="mailto');
2752
+            $total_links_ftp 		= $total_links_ftp + substr_count($row['content'], 'href="ftp');
2753
+            $total_links_irc = $total_links_irc + substr_count($row['content'], 'href="irc');
2754
+            $total_links_news = $total_links_news + substr_count($row['content'], 'href="news');
2755
+            $total_wlinks 			= $total_wlinks + substr_count($row['content'], "[[");
2756
+            $total_images 			= $total_images + substr_count($row['content'], "<img");
2757 2757
             $clean_total_flash = preg_replace('/player.swf/', ' ', $row['content']);
2758
-            $total_flash			= $total_flash+substr_count($clean_total_flash, '.swf"');
2758
+            $total_flash = $total_flash + substr_count($clean_total_flash, '.swf"');
2759 2759
             //.swf" end quotes prevent insert swf through flvplayer (is not counted)
2760
-            $total_mp3				= $total_mp3+substr_count($row['content'], ".mp3");
2761
-            $total_flv_p = $total_flv_p+substr_count($row['content'], ".flv");
2762
-            $total_flv				=	$total_flv_p/5;
2763
-            $total_youtube			= $total_youtube+substr_count($row['content'], "http://www.youtube.com");
2764
-            $total_multimedia		= $total_multimedia+substr_count($row['content'], "video/x-msvideo");
2765
-            $total_tables			= $total_tables+substr_count($row['content'], "<table");
2760
+            $total_mp3				= $total_mp3 + substr_count($row['content'], ".mp3");
2761
+            $total_flv_p = $total_flv_p + substr_count($row['content'], ".flv");
2762
+            $total_flv				= $total_flv_p / 5;
2763
+            $total_youtube = $total_youtube + substr_count($row['content'], "http://www.youtube.com");
2764
+            $total_multimedia = $total_multimedia + substr_count($row['content'], "video/x-msvideo");
2765
+            $total_tables = $total_tables + substr_count($row['content'], "<table");
2766 2766
         }
2767 2767
 
2768 2768
         //check only last version of all pages (current page)
2769 2769
 
2770
-        $sql =' SELECT *, COUNT(*) AS TOTAL_PAGES, SUM(hits) AS TOTAL_VISITS_LV
2770
+        $sql = ' SELECT *, COUNT(*) AS TOTAL_PAGES, SUM(hits) AS TOTAL_VISITS_LV
2771 2771
                 FROM  '.$tbl_wiki.' s1
2772 2772
                 WHERE s1.c_id = '.$course_id.' AND id=(
2773 2773
                     SELECT MAX(s2.id)
@@ -2778,9 +2778,9 @@  discard block
 block discarded – undo
2778 2778
                         '.$groupfilter.' AND
2779 2779
                         session_id='.$session_id.')';
2780 2780
         $allpages = Database::query($sql);
2781
-        while ($row=Database::fetch_array($allpages)) {
2782
-            $total_pages	 		= $row['TOTAL_PAGES'];
2783
-            $total_visits_lv 		= intval($row['TOTAL_VISITS_LV']);
2781
+        while ($row = Database::fetch_array($allpages)) {
2782
+            $total_pages = $row['TOTAL_PAGES'];
2783
+            $total_visits_lv = intval($row['TOTAL_VISITS_LV']);
2784 2784
         }
2785 2785
 
2786 2786
         $total_words_lv = 0;
@@ -2812,29 +2812,29 @@  discard block
 block discarded – undo
2812 2812
                 )';
2813 2813
         $allpages = Database::query($sql);
2814 2814
 
2815
-        while ($row=Database::fetch_array($allpages)) {
2816
-            $total_words_lv 		= $total_words_lv+ self::word_count($row['content']);
2817
-            $total_links_lv 		= $total_links_lv+substr_count($row['content'], "href=");
2818
-            $total_links_anchors_lv	= $total_links_anchors_lv+substr_count($row['content'], 'href="#');
2819
-            $total_links_mail_lv 	= $total_links_mail_lv+substr_count($row['content'], 'href="mailto');
2820
-            $total_links_ftp_lv 	= $total_links_ftp_lv+substr_count($row['content'], 'href="ftp');
2821
-            $total_links_irc_lv 	= $total_links_irc_lv+substr_count($row['content'], 'href="irc');
2822
-            $total_links_news_lv 	= $total_links_news_lv+substr_count($row['content'], 'href="news');
2823
-            $total_wlinks_lv 		= $total_wlinks_lv+substr_count($row['content'], "[[");
2824
-            $total_images_lv 		= $total_images_lv+substr_count($row['content'], "<img");
2815
+        while ($row = Database::fetch_array($allpages)) {
2816
+            $total_words_lv 		= $total_words_lv + self::word_count($row['content']);
2817
+            $total_links_lv 		= $total_links_lv + substr_count($row['content'], "href=");
2818
+            $total_links_anchors_lv = $total_links_anchors_lv + substr_count($row['content'], 'href="#');
2819
+            $total_links_mail_lv 	= $total_links_mail_lv + substr_count($row['content'], 'href="mailto');
2820
+            $total_links_ftp_lv 	= $total_links_ftp_lv + substr_count($row['content'], 'href="ftp');
2821
+            $total_links_irc_lv 	= $total_links_irc_lv + substr_count($row['content'], 'href="irc');
2822
+            $total_links_news_lv 	= $total_links_news_lv + substr_count($row['content'], 'href="news');
2823
+            $total_wlinks_lv 		= $total_wlinks_lv + substr_count($row['content'], "[[");
2824
+            $total_images_lv 		= $total_images_lv + substr_count($row['content'], "<img");
2825 2825
             $clean_total_flash_lv = preg_replace('/player.swf/', ' ', $row['content']);
2826
-            $total_flash_lv			= $total_flash_lv+substr_count($clean_total_flash_lv, '.swf"');
2826
+            $total_flash_lv = $total_flash_lv + substr_count($clean_total_flash_lv, '.swf"');
2827 2827
             //.swf" end quotes prevent insert swf through flvplayer (is not counted)
2828
-            $total_mp3_lv			= $total_mp3_lv+substr_count($row['content'], ".mp3");
2829
-            $total_flv_p_lv = $total_flv_p_lv+substr_count($row['content'], ".flv");
2830
-            $total_flv_lv			= $total_flv_p_lv/5;
2831
-            $total_youtube_lv		= $total_youtube_lv+substr_count($row['content'], "http://www.youtube.com");
2832
-            $total_multimedia_lv	= $total_multimedia_lv+substr_count($row['content'], "video/x-msvideo");
2833
-            $total_tables_lv		= $total_tables_lv+substr_count($row['content'], "<table");
2828
+            $total_mp3_lv			= $total_mp3_lv + substr_count($row['content'], ".mp3");
2829
+            $total_flv_p_lv = $total_flv_p_lv + substr_count($row['content'], ".flv");
2830
+            $total_flv_lv			= $total_flv_p_lv / 5;
2831
+            $total_youtube_lv = $total_youtube_lv + substr_count($row['content'], "http://www.youtube.com");
2832
+            $total_multimedia_lv = $total_multimedia_lv + substr_count($row['content'], "video/x-msvideo");
2833
+            $total_tables_lv = $total_tables_lv + substr_count($row['content'], "<table");
2834 2834
         }
2835 2835
 
2836 2836
         //Total pages edited at this time
2837
-        $total_editing_now=0;
2837
+        $total_editing_now = 0;
2838 2838
         $sql = 'SELECT *, COUNT(*) AS TOTAL_EDITING_NOW
2839 2839
                 FROM  '.$tbl_wiki.' s1
2840 2840
                 WHERE is_editing!=0 AND s1.c_id = '.$course_id.' AND
@@ -2849,66 +2849,66 @@  discard block
 block discarded – undo
2849 2849
         )';
2850 2850
 
2851 2851
         // Can not use group by because the mark is set in the latest version
2852
-        $allpages=Database::query($sql);
2853
-        while ($row=Database::fetch_array($allpages)) {
2854
-            $total_editing_now	= $row['TOTAL_EDITING_NOW'];
2852
+        $allpages = Database::query($sql);
2853
+        while ($row = Database::fetch_array($allpages)) {
2854
+            $total_editing_now = $row['TOTAL_EDITING_NOW'];
2855 2855
         }
2856 2856
 
2857 2857
         // Total hidden pages
2858
-        $total_hidden=0;
2858
+        $total_hidden = 0;
2859 2859
         $sql = 'SELECT * FROM '.$tbl_wiki.'
2860 2860
                 WHERE  c_id = '.$course_id.' AND visibility=0 AND '.$groupfilter.$condition_session.'
2861 2861
                 GROUP BY reflink';
2862 2862
         // 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
2863
-        $allpages=Database::query($sql);
2864
-        while ($row=Database::fetch_array($allpages)) {
2865
-            $total_hidden = $total_hidden+1;
2863
+        $allpages = Database::query($sql);
2864
+        while ($row = Database::fetch_array($allpages)) {
2865
+            $total_hidden = $total_hidden + 1;
2866 2866
         }
2867 2867
 
2868 2868
         //Total protect pages
2869
-        $total_protected=0;
2869
+        $total_protected = 0;
2870 2870
         $sql = 'SELECT * FROM '.$tbl_wiki.'
2871 2871
                 WHERE  c_id = '.$course_id.' AND editlock=1 AND '.$groupfilter.$condition_session.'
2872 2872
                 GROUP BY reflink';
2873 2873
         // or group by page_id. As the mark of protected page is the first version of the page, I can use group by
2874 2874
 
2875
-        $allpages=Database::query($sql);
2876
-        while ($row=Database::fetch_array($allpages)) {
2877
-            $total_protected = $total_protected+1;
2875
+        $allpages = Database::query($sql);
2876
+        while ($row = Database::fetch_array($allpages)) {
2877
+            $total_protected = $total_protected + 1;
2878 2878
         }
2879 2879
 
2880 2880
         // Total empty versions.
2881
-        $total_empty_content=0;
2881
+        $total_empty_content = 0;
2882 2882
         $sql = 'SELECT * FROM '.$tbl_wiki.'
2883 2883
                 WHERE
2884 2884
                     c_id = '.$course_id.' AND
2885 2885
                     content="" AND
2886 2886
                     '.$groupfilter.$condition_session.'';
2887 2887
         $allpages = Database::query($sql);
2888
-        while ($row=Database::fetch_array($allpages)) {
2889
-            $total_empty_content	= $total_empty_content+1;
2888
+        while ($row = Database::fetch_array($allpages)) {
2889
+            $total_empty_content = $total_empty_content + 1;
2890 2890
         }
2891 2891
 
2892 2892
         //Total empty pages (last version)
2893 2893
 
2894
-        $total_empty_content_lv=0;
2894
+        $total_empty_content_lv = 0;
2895 2895
         $sql = 'SELECT  * FROM  '.$tbl_wiki.' s1
2896 2896
                 WHERE s1.c_id = '.$course_id.' AND content="" AND id=(
2897 2897
                 SELECT MAX(s2.id) FROM '.$tbl_wiki.' s2
2898 2898
                 WHERE s1.c_id = '.$course_id.' AND s1.reflink = s2.reflink AND '.$groupfilter.' AND session_id='.$session_id.')';
2899
-        $allpages=Database::query($sql);
2899
+        $allpages = Database::query($sql);
2900 2900
         while ($row = Database::fetch_array($allpages)) {
2901
-            $total_empty_content_lv	= $total_empty_content_lv+1;
2901
+            $total_empty_content_lv = $total_empty_content_lv + 1;
2902 2902
         }
2903 2903
 
2904 2904
         // Total locked discuss pages
2905
-        $total_lock_disc=0;
2905
+        $total_lock_disc = 0;
2906 2906
         $sql = 'SELECT * FROM '.$tbl_wiki.'
2907 2907
                 WHERE c_id = '.$course_id.' AND addlock_disc=0 AND '.$groupfilter.$condition_session.'
2908 2908
                 GROUP BY reflink';//group by because mark lock in all vers, then always is ok
2909
-        $allpages=Database::query($sql);
2909
+        $allpages = Database::query($sql);
2910 2910
         while ($row = Database::fetch_array($allpages)) {
2911
-            $total_lock_disc	= $total_lock_disc+1;
2911
+            $total_lock_disc = $total_lock_disc + 1;
2912 2912
         }
2913 2913
 
2914 2914
         // Total hidden discuss pages.
@@ -2919,7 +2919,7 @@  discard block
 block discarded – undo
2919 2919
         //group by because mark lock in all vers, then always is ok
2920 2920
         $allpages = Database::query($sql);
2921 2921
         while ($row = Database::fetch_array($allpages)) {
2922
-            $total_hidden_disc	= $total_hidden_disc+1;
2922
+            $total_hidden_disc = $total_hidden_disc + 1;
2923 2923
         }
2924 2924
 
2925 2925
         //Total versions with any short comment by user or system
@@ -2927,44 +2927,44 @@  discard block
 block discarded – undo
2927 2927
         $total_comment_version = 0;
2928 2928
         $sql = 'SELECT * FROM '.$tbl_wiki.'
2929 2929
                 WHERE c_id = '.$course_id.' AND comment!="" AND '.$groupfilter.$condition_session.'';
2930
-        $allpages=Database::query($sql);
2930
+        $allpages = Database::query($sql);
2931 2931
         while ($row = Database::fetch_array($allpages)) {
2932
-            $total_comment_version	= $total_comment_version+1;
2932
+            $total_comment_version = $total_comment_version + 1;
2933 2933
         }
2934 2934
 
2935 2935
         // Total pages that can only be scored by teachers.
2936 2936
 
2937
-        $total_only_teachers_rating=0;
2937
+        $total_only_teachers_rating = 0;
2938 2938
         $sql = 'SELECT * FROM '.$tbl_wiki.'
2939 2939
                 WHERE c_id = '.$course_id.' AND
2940 2940
                 ratinglock_disc = 0 AND
2941 2941
                 '.$groupfilter.$condition_session.'
2942 2942
                 GROUP BY reflink';//group by because mark lock in all vers, then always is ok
2943
-        $allpages=Database::query($sql);
2944
-        while ($row=Database::fetch_array($allpages)) {
2945
-            $total_only_teachers_rating	= $total_only_teachers_rating+1;
2943
+        $allpages = Database::query($sql);
2944
+        while ($row = Database::fetch_array($allpages)) {
2945
+            $total_only_teachers_rating = $total_only_teachers_rating + 1;
2946 2946
         }
2947 2947
 
2948 2948
         // Total pages scored by peers
2949 2949
         // put always this line alfter check num all pages and num pages rated by teachers
2950
-        $total_rating_by_peers=$total_pages-$total_only_teachers_rating;
2950
+        $total_rating_by_peers = $total_pages - $total_only_teachers_rating;
2951 2951
 
2952 2952
         //Total pages identified as standard task
2953 2953
 
2954
-        $total_task=0;
2955
-        $sql='SELECT * FROM '.$tbl_wiki.', '.$tbl_wiki_conf.'
2954
+        $total_task = 0;
2955
+        $sql = 'SELECT * FROM '.$tbl_wiki.', '.$tbl_wiki_conf.'
2956 2956
               WHERE '.$tbl_wiki_conf.'.c_id = '.$course_id.' AND
2957 2957
                '.$tbl_wiki_conf.'.task!="" AND
2958 2958
                '.$tbl_wiki_conf.'.page_id='.$tbl_wiki.'.page_id AND
2959 2959
                 '.$tbl_wiki.'.'.$groupfilter.$condition_session;
2960 2960
         $allpages = Database::query($sql);
2961
-        while ($row=Database::fetch_array($allpages)) {
2962
-            $total_task=$total_task+1;
2961
+        while ($row = Database::fetch_array($allpages)) {
2962
+            $total_task = $total_task + 1;
2963 2963
         }
2964 2964
 
2965 2965
         //Total pages identified as teacher page (wiki portfolio mode - individual assignment)
2966 2966
 
2967
-        $total_teacher_assignment=0;
2967
+        $total_teacher_assignment = 0;
2968 2968
         $sql = 'SELECT  * FROM  '.$tbl_wiki.' s1
2969 2969
                 WHERE s1.c_id = '.$course_id.' AND assignment=1 AND id=(
2970 2970
                     SELECT MAX(s2.id)
@@ -2974,20 +2974,20 @@  discard block
 block discarded – undo
2974 2974
         //mark all versions, but do not use group by reflink because y want the pages not versions
2975 2975
         $allpages = Database::query($sql);
2976 2976
         while ($row = Database::fetch_array($allpages)) {
2977
-            $total_teacher_assignment=$total_teacher_assignment+1;
2977
+            $total_teacher_assignment = $total_teacher_assignment + 1;
2978 2978
         }
2979 2979
 
2980 2980
         //Total pages identifies as student page (wiki portfolio mode - individual assignment)
2981 2981
 
2982
-        $total_student_assignment=0;
2982
+        $total_student_assignment = 0;
2983 2983
         $sql = 'SELECT  * FROM  '.$tbl_wiki.' s1
2984 2984
                 WHERE s1.c_id = '.$course_id.' AND assignment=2 AND
2985 2985
                 id=(SELECT MAX(s2.id) FROM '.$tbl_wiki.' s2
2986 2986
                 WHERE s2.c_id = '.$course_id.' AND s1.reflink = s2.reflink AND '.$groupfilter.' AND session_id='.$session_id.')';
2987 2987
         //mark all versions, but do not use group by reflink because y want the pages not versions
2988
-        $allpages=Database::query($sql);
2989
-        while ($row=Database::fetch_array($allpages)) {
2990
-            $total_student_assignment = $total_student_assignment+1;
2988
+        $allpages = Database::query($sql);
2989
+        while ($row = Database::fetch_array($allpages)) {
2990
+            $total_student_assignment = $total_student_assignment + 1;
2991 2991
         }
2992 2992
 
2993 2993
         //Current Wiki status add new pages
@@ -2996,14 +2996,14 @@  discard block
 block discarded – undo
2996 2996
                 GROUP BY addlock';//group by because mark 0 in all vers, then always is ok
2997 2997
         $allpages = Database::query($sql);
2998 2998
         $wiki_add_lock = null;
2999
-        while ($row=Database::fetch_array($allpages)) {
3000
-            $wiki_add_lock=$row['addlock'];
2999
+        while ($row = Database::fetch_array($allpages)) {
3000
+            $wiki_add_lock = $row['addlock'];
3001 3001
         }
3002 3002
 
3003
-        if ($wiki_add_lock==1) {
3004
-            $status_add_new_pag=get_lang('Yes');
3003
+        if ($wiki_add_lock == 1) {
3004
+            $status_add_new_pag = get_lang('Yes');
3005 3005
         } else {
3006
-            $status_add_new_pag=get_lang('No');
3006
+            $status_add_new_pag = get_lang('No');
3007 3007
         }
3008 3008
 
3009 3009
         //Creation date of the oldest wiki page and version
@@ -3026,7 +3026,7 @@  discard block
 block discarded – undo
3026 3026
                 ORDER BY dtime DESC 
3027 3027
                 LIMIT 1';
3028 3028
         $allpages = Database::query($sql);
3029
-        while ($row=Database::fetch_array($allpages)) {
3029
+        while ($row = Database::fetch_array($allpages)) {
3030 3030
             $last_wiki_date = $row['dtime'];
3031 3031
         }
3032 3032
 
@@ -3039,18 +3039,18 @@  discard block
 block discarded – undo
3039 3039
         // Do not use "count" because using "group by", would give a wrong value
3040 3040
         $allpages = Database::query($sql);
3041 3041
         $total_score = 0;
3042
-        while ($row=Database::fetch_array($allpages)) {
3043
-            $total_score = $total_score+$row['TOTAL_SCORE'];
3042
+        while ($row = Database::fetch_array($allpages)) {
3043
+            $total_score = $total_score + $row['TOTAL_SCORE'];
3044 3044
         }
3045 3045
 
3046 3046
         if (!empty($total_pages)) {
3047
-            $media_score = $total_score/$total_pages;
3047
+            $media_score = $total_score / $total_pages;
3048 3048
             //put always this line alfter check num all pages
3049 3049
         }
3050 3050
 
3051 3051
         // Average user progress in his pages.
3052 3052
 
3053
-        $media_progress=0;
3053
+        $media_progress = 0;
3054 3054
         $sql = 'SELECT  *, SUM(progress) AS TOTAL_PROGRESS
3055 3055
                 FROM  '.$tbl_wiki.' s1
3056 3056
                 WHERE s1.c_id = '.$course_id.' AND id=
@@ -3064,24 +3064,24 @@  discard block
 block discarded – undo
3064 3064
         // As the value is only the latest version I can not use group by
3065 3065
         $allpages = Database::query($sql);
3066 3066
         while ($row = Database::fetch_array($allpages)) {
3067
-            $total_progress	= $row['TOTAL_PROGRESS'];
3067
+            $total_progress = $row['TOTAL_PROGRESS'];
3068 3068
         }
3069 3069
 
3070 3070
         if (!empty($total_pages)) {
3071
-            $media_progress=$total_progress/$total_pages;
3071
+            $media_progress = $total_progress / $total_pages;
3072 3072
             //put always this line alfter check num all pages
3073 3073
         }
3074 3074
 
3075 3075
         //Total users that have participated in the Wiki
3076 3076
 
3077
-        $total_users=0;
3077
+        $total_users = 0;
3078 3078
         $sql = 'SELECT * FROM '.$tbl_wiki.'
3079 3079
                 WHERE  c_id = '.$course_id.' AND '.$groupfilter.$condition_session.'
3080 3080
                 GROUP BY user_id';
3081 3081
         //as the mark of user it in all versions of the page, I can use group by to see the first
3082
-        $allpages=Database::query($sql);
3083
-        while ($row=Database::fetch_array($allpages)) {
3084
-            $total_users = $total_users+1;
3082
+        $allpages = Database::query($sql);
3083
+        while ($row = Database::fetch_array($allpages)) {
3084
+            $total_users = $total_users + 1;
3085 3085
         }
3086 3086
 
3087 3087
         // Total of different IP addresses that have participated in the wiki
@@ -3089,9 +3089,9 @@  discard block
 block discarded – undo
3089 3089
         $sql = 'SELECT * FROM '.$tbl_wiki.'
3090 3090
               WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.'
3091 3091
               GROUP BY user_ip';
3092
-        $allpages=Database::query($sql);
3093
-        while ($row=Database::fetch_array($allpages)) {
3094
-            $total_ip	= $total_ip+1;
3092
+        $allpages = Database::query($sql);
3093
+        while ($row = Database::fetch_array($allpages)) {
3094
+            $total_ip = $total_ip + 1;
3095 3095
         }
3096 3096
 
3097 3097
         echo '<table class="data_table">';
@@ -3283,18 +3283,18 @@  discard block
 block discarded – undo
3283 3283
                 $userinfo = api_get_user_info($obj->user_id);
3284 3284
                 $username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username']), ENT_QUOTES);
3285 3285
                 $row = array();
3286
-                if ($obj->user_id != 0  && $userinfo !== false) {
3286
+                if ($obj->user_id != 0 && $userinfo !== false) {
3287 3287
                     $row[] = UserManager::getUserProfileLink($userinfo).'
3288 3288
                             <a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=usercontrib&user_id='.urlencode($obj->user_id).
3289 3289
                         '&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'"></a>';
3290 3290
                 } else {
3291 3291
                     $row[] = get_lang('Anonymous').' ('.$obj->user_ip.')';
3292 3292
                 }
3293
-                $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>';
3293
+                $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>';
3294 3294
                 $rows[] = $row;
3295 3295
             }
3296 3296
 
3297
-            $table = new SortableTableFromArrayConfig($rows,1,10,'MostActiveUsersA_table','','','DESC');
3297
+            $table = new SortableTableFromArrayConfig($rows, 1, 10, 'MostActiveUsersA_table', '', '', 'DESC');
3298 3298
             $table->set_additional_parameters(
3299 3299
                 array(
3300 3300
                     'cidReq' => Security::remove_XSS($_GET['cidReq']),
@@ -3303,8 +3303,8 @@  discard block
 block discarded – undo
3303 3303
                     'group_id' => Security::remove_XSS($_GET['group_id'])
3304 3304
                 )
3305 3305
             );
3306
-            $table->set_header(0,get_lang('Author'), true);
3307
-            $table->set_header(1,get_lang('Contributions'), true,array ('style' => 'width:30px;'));
3306
+            $table->set_header(0, get_lang('Author'), true);
3307
+            $table->set_header(1, get_lang('Contributions'), true, array('style' => 'width:30px;'));
3308 3308
             $table->display();
3309 3309
         }
3310 3310
     }
@@ -3320,8 +3320,8 @@  discard block
 block discarded – undo
3320 3320
         $groupfilter = $this->groupfilter;
3321 3321
         $tbl_wiki_discuss = $this->tbl_wiki_discuss;
3322 3322
 
3323
-        if (api_get_session_id()!=0 &&
3324
-            api_is_allowed_to_session_edit(false,true)==false
3323
+        if (api_get_session_id() != 0 &&
3324
+            api_is_allowed_to_session_edit(false, true) == false
3325 3325
         ) {
3326 3326
             api_not_allowed();
3327 3327
         }
@@ -3384,9 +3384,9 @@  discard block
 block discarded – undo
3384 3384
         //mode assignment: previous to show  page type
3385 3385
         $icon_assignment = null;
3386 3386
         if ($row['assignment'] == 1) {
3387
-            $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'),'',ICON_SIZE_SMALL);
3387
+            $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'), '', ICON_SIZE_SMALL);
3388 3388
         } elseif ($row['assignment'] == 2) {
3389
-            $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWorkExtra'),'',ICON_SIZE_SMALL);
3389
+            $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWorkExtra'), '', ICON_SIZE_SMALL);
3390 3390
         }
3391 3391
 
3392 3392
         $countWPost = null;
@@ -3397,23 +3397,23 @@  discard block
 block discarded – undo
3397 3397
             // Show discussion to students if isn't hidden.
3398 3398
             // Show page to all teachers if is hidden.
3399 3399
             // Mode assignments: If is hidden, show pages to student only if student is the author
3400
-            if ($row['visibility_disc']==1 ||
3401
-                api_is_allowed_to_edit(false,true) ||
3400
+            if ($row['visibility_disc'] == 1 ||
3401
+                api_is_allowed_to_edit(false, true) ||
3402 3402
                 api_is_platform_admin() ||
3403
-                ($row['assignment']==2 && $row['visibility_disc']==0 && (api_get_user_id()==$row['user_id']))
3403
+                ($row['assignment'] == 2 && $row['visibility_disc'] == 0 && (api_get_user_id() == $row['user_id']))
3404 3404
             ) {
3405 3405
                 echo '<div id="wikititle">';
3406 3406
 
3407 3407
                 // discussion action: protecting (locking) the discussion
3408 3408
                 $addlock_disc = null;
3409 3409
                 $lock_unlock_disc = null;
3410
-                if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
3410
+                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3411 3411
                     if (self::check_addlock_discuss() == 1) {
3412
-                        $addlock_disc = Display::return_icon('unlock.png', get_lang('UnlockDiscussExtra'),'',ICON_SIZE_SMALL);
3413
-                        $lock_unlock_disc ='unlockdisc';
3412
+                        $addlock_disc = Display::return_icon('unlock.png', get_lang('UnlockDiscussExtra'), '', ICON_SIZE_SMALL);
3413
+                        $lock_unlock_disc = 'unlockdisc';
3414 3414
                     } else {
3415
-                        $addlock_disc = Display::return_icon('lock.png', get_lang('LockDiscussExtra'),'',ICON_SIZE_SMALL);
3416
-                        $lock_unlock_disc ='lockdisc';
3415
+                        $addlock_disc = Display::return_icon('lock.png', get_lang('LockDiscussExtra'), '', ICON_SIZE_SMALL);
3416
+                        $lock_unlock_disc = 'lockdisc';
3417 3417
                     }
3418 3418
                 }
3419 3419
                 echo '<span style="float:right">';
@@ -3423,13 +3423,13 @@  discard block
 block discarded – undo
3423 3423
                 // discussion action: visibility.  Show discussion to students if isn't hidden. Show page to all teachers if is hidden.
3424 3424
                 $visibility_disc = null;
3425 3425
                 $hide_show_disc = null;
3426
-                if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
3427
-                    if (self::check_visibility_discuss()==1) {
3426
+                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3427
+                    if (self::check_visibility_discuss() == 1) {
3428 3428
                         /// TODO: 	Fix Mode assignments: If is hidden, show discussion to student only if student is the author
3429
-                        $visibility_disc = Display::return_icon('visible.png', get_lang('ShowDiscussExtra'),'',ICON_SIZE_SMALL);
3429
+                        $visibility_disc = Display::return_icon('visible.png', get_lang('ShowDiscussExtra'), '', ICON_SIZE_SMALL);
3430 3430
                         $hide_show_disc = 'hidedisc';
3431 3431
                     } else {
3432
-                        $visibility_disc = Display::return_icon('invisible.png', get_lang('HideDiscussExtra'),'',ICON_SIZE_SMALL);
3432
+                        $visibility_disc = Display::return_icon('invisible.png', get_lang('HideDiscussExtra'), '', ICON_SIZE_SMALL);
3433 3433
                         $hide_show_disc = 'showdisc';
3434 3434
                     }
3435 3435
                 }
@@ -3440,12 +3440,12 @@  discard block
 block discarded – undo
3440 3440
                 //discussion action: check add rating lock. Show/Hide list to rating for all student
3441 3441
                 $lock_unlock_rating_disc = null;
3442 3442
                 $ratinglock_disc = null;
3443
-                if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
3443
+                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3444 3444
                     if (self::check_ratinglock_discuss() == 1) {
3445
-                        $ratinglock_disc = Display::return_icon('star.png', get_lang('UnlockRatingDiscussExtra'),'',ICON_SIZE_SMALL);
3445
+                        $ratinglock_disc = Display::return_icon('star.png', get_lang('UnlockRatingDiscussExtra'), '', ICON_SIZE_SMALL);
3446 3446
                         $lock_unlock_rating_disc = 'unlockrating';
3447 3447
                     } else {
3448
-                        $ratinglock_disc = Display::return_icon('star_na.png', get_lang('LockRatingDiscussExtra'),'',ICON_SIZE_SMALL);
3448
+                        $ratinglock_disc = Display::return_icon('star_na.png', get_lang('LockRatingDiscussExtra'), '', ICON_SIZE_SMALL);
3449 3449
                         $lock_unlock_rating_disc = 'lockrating';
3450 3450
                     }
3451 3451
                 }
@@ -3456,11 +3456,11 @@  discard block
 block discarded – undo
3456 3456
 
3457 3457
                 //discussion action: email notification
3458 3458
                 if (self::check_notify_discuss($page) == 1) {
3459
-                    $notify_disc= Display::return_icon('messagebox_info.png', get_lang('NotifyDiscussByEmail'),'',ICON_SIZE_SMALL);
3460
-                    $lock_unlock_notify_disc='unlocknotifydisc';
3459
+                    $notify_disc = Display::return_icon('messagebox_info.png', get_lang('NotifyDiscussByEmail'), '', ICON_SIZE_SMALL);
3460
+                    $lock_unlock_notify_disc = 'unlocknotifydisc';
3461 3461
                 } else {
3462
-                    $notify_disc= Display::return_icon('mail.png', get_lang('CancelNotifyDiscussByEmail'),'',ICON_SIZE_SMALL);
3463
-                    $lock_unlock_notify_disc='locknotifydisc';
3462
+                    $notify_disc = Display::return_icon('mail.png', get_lang('CancelNotifyDiscussByEmail'), '', ICON_SIZE_SMALL);
3463
+                    $lock_unlock_notify_disc = 'locknotifydisc';
3464 3464
                 }
3465 3465
                 echo '<span style="float:right">';
3466 3466
                 echo '<a href="index.php?action=discuss&amp;actionpage='.$lock_unlock_notify_disc.'&amp;title='.api_htmlentities(urlencode($page)).'">'.$notify_disc.'</a>';
@@ -3469,27 +3469,27 @@  discard block
 block discarded – undo
3469 3469
                 echo $icon_assignment.'&nbsp;&nbsp;&nbsp;'.api_htmlentities($row['title']);
3470 3470
 
3471 3471
                 if ($lastuserinfo !== false) {
3472
-                    echo ' (' . get_lang('MostRecentVersionBy') . ' ' . UserManager::getUserProfileLink($lastuserinfo) . ' ' . $lastversiondate . $countWPost . ')' . $avg_WPost_score . ' '; //TODO: read average score
3472
+                    echo ' ('.get_lang('MostRecentVersionBy').' '.UserManager::getUserProfileLink($lastuserinfo).' '.$lastversiondate.$countWPost.')'.$avg_WPost_score.' '; //TODO: read average score
3473 3473
                 }
3474 3474
 
3475 3475
                 echo '</div>';
3476 3476
 
3477
-                if ($row['addlock_disc']==1 || api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
3477
+                if ($row['addlock_disc'] == 1 || api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3478 3478
                     //show comments but students can't add theirs
3479 3479
                     ?>
3480 3480
                     <form name="form1" method="post" action="">
3481 3481
                         <table>
3482 3482
                             <tr>
3483
-                                <td valign="top" ><?php echo get_lang('Comments');?>:</td>
3484
-                                <?php  echo '<input type="hidden" name="wpost_id" value="'.md5(uniqid(rand(), true)).'">';//prevent double post ?>
3483
+                                <td valign="top" ><?php echo get_lang('Comments'); ?>:</td>
3484
+                                <?php  echo '<input type="hidden" name="wpost_id" value="'.md5(uniqid(rand(), true)).'">'; //prevent double post ?>
3485 3485
                                 <td><textarea name="comment" cols="80" rows="5" id="comment"></textarea></td>
3486 3486
                             </tr>
3487 3487
                             <tr>
3488 3488
                                 <?php
3489 3489
                                 //check if rating is allowed
3490
-                                if ($row['ratinglock_disc']==1 || api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
3490
+                                if ($row['ratinglock_disc'] == 1 || api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3491 3491
                                     ?>
3492
-                                    <td><?php echo get_lang('Rating');?>: </td>
3492
+                                    <td><?php echo get_lang('Rating'); ?>: </td>
3493 3493
                                     <td valign="top"><select name="rating" id="rating">
3494 3494
                                             <option value="-" selected>-</option>
3495 3495
                                             <option value="0">0</option>
@@ -3506,7 +3506,7 @@  discard block
 block discarded – undo
3506 3506
                                         </select></td>
3507 3507
                                 <?php
3508 3508
                                 } else {
3509
-                                    echo '<input type=hidden name="rating" value="-">';// must pass a default value to avoid rate automatically
3509
+                                    echo '<input type=hidden name="rating" value="-">'; // must pass a default value to avoid rate automatically
3510 3510
                                 }
3511 3511
                                 ?>
3512 3512
                             </tr>
@@ -3546,12 +3546,12 @@  discard block
 block discarded – undo
3546 3546
                 $sql = "SELECT * FROM $tbl_wiki_discuss
3547 3547
                         WHERE c_id = $course_id AND publication_id='".$id."' AND NOT p_score='-'";
3548 3548
                 $result3 = Database::query($sql);
3549
-                $countWPost_score= Database::num_rows($result3);
3549
+                $countWPost_score = Database::num_rows($result3);
3550 3550
 
3551
-                echo ' - '.get_lang('NumCommentsScore').': '.$countWPost_score;//
3551
+                echo ' - '.get_lang('NumCommentsScore').': '.$countWPost_score; //
3552 3552
 
3553
-                if ($countWPost_score!=0) {
3554
-                    $avg_WPost_score = round($row2['sumWPost'] / $countWPost_score,2).' / 10';
3553
+                if ($countWPost_score != 0) {
3554
+                    $avg_WPost_score = round($row2['sumWPost'] / $countWPost_score, 2).' / 10';
3555 3555
                 } else {
3556 3556
                     $avg_WPost_score = $countWPost_score;
3557 3557
                 }
@@ -3569,16 +3569,16 @@  discard block
 block discarded – undo
3569 3569
 
3570 3570
                 echo '<hr noshade size="1">';
3571 3571
 
3572
-                while ($row=Database::fetch_array($result)) {
3572
+                while ($row = Database::fetch_array($result)) {
3573 3573
                     $userinfo = api_get_user_info($row['userc_id']);
3574
-                    if (($userinfo['status'])=="5") {
3575
-                        $author_status=get_lang('Student');
3574
+                    if (($userinfo['status']) == "5") {
3575
+                        $author_status = get_lang('Student');
3576 3576
                     } else {
3577
-                        $author_status=get_lang('Teacher');
3577
+                        $author_status = get_lang('Teacher');
3578 3578
                     }
3579 3579
 
3580 3580
                     $name = $userinfo['complete_name'];
3581
-                    $author_photo= '<img src="'.$userinfo['avatar'].'" alt="'.api_htmlentities($name).'"  width="40" height="50" align="top"  title="'.api_htmlentities($name).'"  />';
3581
+                    $author_photo = '<img src="'.$userinfo['avatar'].'" alt="'.api_htmlentities($name).'"  width="40" height="50" align="top"  title="'.api_htmlentities($name).'"  />';
3582 3582
 
3583 3583
                     //stars
3584 3584
                     $p_score = $row['p_score'];
@@ -3624,7 +3624,7 @@  discard block
 block discarded – undo
3624 3624
                     if ($userinfo !== false) {
3625 3625
                         $userProfile = UserManager::getUserProfileLink($userinfo);
3626 3626
                     }
3627
-                    echo '<td style=" color:#999999">' . $userProfile . ' (' . $author_status . ') '.
3627
+                    echo '<td style=" color:#999999">'.$userProfile.' ('.$author_status.') '.
3628 3628
                         api_get_local_time($row['dtime'], null, date_default_timezone_get()).
3629 3629
                         ' - '.get_lang('Rating').': '.$row['p_score'].' '.$imagerating.' </td>';
3630 3630
                     echo '</tr>';
@@ -3661,7 +3661,7 @@  discard block
 block discarded – undo
3661 3661
         }
3662 3662
         echo '</div>';
3663 3663
 
3664
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { //only by professors if page is hidden
3664
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { //only by professors if page is hidden
3665 3665
             $sql = 'SELECT  *
3666 3666
                     FROM  '.$tbl_wiki.' s1
3667 3667
         		    WHERE s1.c_id = '.$course_id.' AND id=(
@@ -3687,11 +3687,11 @@  discard block
 block discarded – undo
3687 3687
                 $username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username']), ENT_QUOTES);
3688 3688
 
3689 3689
                 //get type assignment icon
3690
-                if ($obj->assignment==1) {
3691
-                    $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL);
3692
-                } elseif ($obj->assignment==2) {
3693
-                    $ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
3694
-                } elseif ($obj->assignment==0) {
3690
+                if ($obj->assignment == 1) {
3691
+                    $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL);
3692
+                } elseif ($obj->assignment == 2) {
3693
+                    $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
3694
+                } elseif ($obj->assignment == 0) {
3695 3695
                     $ShowAssignment = Display::return_icon('px_transparent.gif');
3696 3696
                 }
3697 3697
 
@@ -3714,29 +3714,29 @@  discard block
 block discarded – undo
3714 3714
                 }
3715 3715
                 $row[] = api_get_local_time($obj->dtime, null, date_default_timezone_get());
3716 3716
                 $showdelete = '';
3717
-                if (api_is_allowed_to_edit(false,true)|| api_is_platform_admin()) {
3718
-                    $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']).'">'.
3719
-                        Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL);
3717
+                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3718
+                    $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']).'">'.
3719
+                        Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
3720 3720
                 }
3721
-                if (api_is_allowed_to_session_edit(false,true) ) {
3721
+                if (api_is_allowed_to_session_edit(false, true)) {
3722 3722
                     $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']).'">'.
3723
-                        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']).'">'.
3724
-                        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']).'">'.
3725
-                        Display::return_icon('history.png', get_lang('History'),'',ICON_SIZE_SMALL).'</a>
3723
+                        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']).'">'.
3724
+                        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']).'">'.
3725
+                        Display::return_icon('history.png', get_lang('History'), '', ICON_SIZE_SMALL).'</a>
3726 3726
                         <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']).'">'.
3727
-                        Display::return_icon('what_link_here.png', get_lang('LinksPages'),'',ICON_SIZE_SMALL).'</a>'.$showdelete;
3727
+                        Display::return_icon('what_link_here.png', get_lang('LinksPages'), '', ICON_SIZE_SMALL).'</a>'.$showdelete;
3728 3728
                 }
3729 3729
                 $rows[] = $row;
3730 3730
             }
3731 3731
 
3732
-            $table = new SortableTableFromArrayConfig($rows,1,10,'AllPages_table','','','ASC');
3733
-            $table->set_additional_parameters(array('cidReq' =>Security::remove_XSS($_GET['cidReq']),'action'=>Security::remove_XSS($action),'group_id'=>Security::remove_XSS($_GET['group_id'])));
3734
-            $table->set_header(0,get_lang('Type'), true, array ('style' => 'width:30px;'));
3735
-            $table->set_header(1,get_lang('Title'), true);
3736
-            $table->set_header(2,get_lang('Author').' ('.get_lang('LastVersion').')', true);
3737
-            $table->set_header(3,get_lang('Date').' ('.get_lang('LastVersion').')', true);
3738
-            if (api_is_allowed_to_session_edit(false,true) ) {
3739
-                $table->set_header(4,get_lang('Actions'), true, array ('style' => 'width:130px;'));
3732
+            $table = new SortableTableFromArrayConfig($rows, 1, 10, 'AllPages_table', '', '', 'ASC');
3733
+            $table->set_additional_parameters(array('cidReq' =>Security::remove_XSS($_GET['cidReq']), 'action'=>Security::remove_XSS($action), 'group_id'=>Security::remove_XSS($_GET['group_id'])));
3734
+            $table->set_header(0, get_lang('Type'), true, array('style' => 'width:30px;'));
3735
+            $table->set_header(1, get_lang('Title'), true);
3736
+            $table->set_header(2, get_lang('Author').' ('.get_lang('LastVersion').')', true);
3737
+            $table->set_header(3, get_lang('Date').' ('.get_lang('LastVersion').')', true);
3738
+            if (api_is_allowed_to_session_edit(false, true)) {
3739
+                $table->set_header(4, get_lang('Actions'), true, array('style' => 'width:130px;'));
3740 3740
             }
3741 3741
             $table->display();
3742 3742
         }
@@ -3756,13 +3756,13 @@  discard block
 block discarded – undo
3756 3756
         $groupfilter = $this->groupfilter;
3757 3757
         $tbl_wiki_conf = $this->tbl_wiki_conf;
3758 3758
 
3759
-        if (api_is_allowed_to_session_edit(false,true) ) {
3760
-            if (self::check_notify_all()==1) {
3761
-                $notify_all= Display::return_icon('messagebox_info.png', get_lang('NotifyByEmail'),'',ICON_SIZE_SMALL).' '.get_lang('NotNotifyChanges');
3762
-                $lock_unlock_notify_all='unlocknotifyall';
3759
+        if (api_is_allowed_to_session_edit(false, true)) {
3760
+            if (self::check_notify_all() == 1) {
3761
+                $notify_all = Display::return_icon('messagebox_info.png', get_lang('NotifyByEmail'), '', ICON_SIZE_SMALL).' '.get_lang('NotNotifyChanges');
3762
+                $lock_unlock_notify_all = 'unlocknotifyall';
3763 3763
             } else {
3764
-                $notify_all=Display::return_icon('mail.png', get_lang('CancelNotifyByEmail'),'',ICON_SIZE_SMALL).' '.get_lang('NotifyChanges');
3765
-                $lock_unlock_notify_all='locknotifyall';
3764
+                $notify_all = Display::return_icon('mail.png', get_lang('CancelNotifyByEmail'), '', ICON_SIZE_SMALL).' '.get_lang('NotifyChanges');
3765
+                $lock_unlock_notify_all = 'locknotifyall';
3766 3766
             }
3767 3767
         }
3768 3768
 
@@ -3770,7 +3770,7 @@  discard block
 block discarded – undo
3770 3770
         echo '<a href="index.php?action=recentchanges&amp;actionpage='.$lock_unlock_notify_all.'&amp;title='.api_htmlentities(urlencode($page)).'">'.$notify_all.'</a>';
3771 3771
         echo '</span>'.get_lang('RecentChanges').'</div>';
3772 3772
 
3773
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { //only by professors if page is hidden
3773
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { //only by professors if page is hidden
3774 3774
             $sql = 'SELECT * FROM '.$tbl_wiki.', '.$tbl_wiki_conf.'
3775 3775
         		WHERE 	'.$tbl_wiki_conf.'.c_id= '.$course_id.' AND
3776 3776
         				'.$tbl_wiki.'.c_id= '.$course_id.' AND
@@ -3798,19 +3798,19 @@  discard block
 block discarded – undo
3798 3798
                 $userinfo = api_get_user_info($obj->user_id);
3799 3799
 
3800 3800
                 //get type assignment icon
3801
-                if ($obj->assignment==1) {
3802
-                    $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL);
3803
-                } elseif ($obj->assignment==2) {
3804
-                    $ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
3805
-                } elseif ($obj->assignment==0) {
3806
-                    $ShowAssignment=Display::return_icon('px_transparent.gif');
3801
+                if ($obj->assignment == 1) {
3802
+                    $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL);
3803
+                } elseif ($obj->assignment == 2) {
3804
+                    $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
3805
+                } elseif ($obj->assignment == 0) {
3806
+                    $ShowAssignment = Display::return_icon('px_transparent.gif');
3807 3807
                 }
3808 3808
 
3809 3809
                 // Get icon task
3810 3810
                 if (!empty($obj->task)) {
3811
-                    $icon_task=Display::return_icon('wiki_task.png', get_lang('StandardTask'),'',ICON_SIZE_SMALL);
3811
+                    $icon_task = Display::return_icon('wiki_task.png', get_lang('StandardTask'), '', ICON_SIZE_SMALL);
3812 3812
                 } else {
3813
-                    $icon_task=Display::return_icon('px_transparent.gif');
3813
+                    $icon_task = Display::return_icon('px_transparent.gif');
3814 3814
                 }
3815 3815
 
3816 3816
                 $row = array();
@@ -3818,7 +3818,7 @@  discard block
 block discarded – undo
3818 3818
                 $row[] = $ShowAssignment.$icon_task;
3819 3819
                 $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().'">'.
3820 3820
                     api_htmlentities($obj->title).'</a>';
3821
-                $row[] = $obj->version>1 ? get_lang('EditedBy') : get_lang('AddedBy');
3821
+                $row[] = $obj->version > 1 ? get_lang('EditedBy') : get_lang('AddedBy');
3822 3822
                 if ($userinfo !== false) {
3823 3823
                     $row[] = UserManager::getUserProfileLink($userinfo);
3824 3824
                 } else {
@@ -3827,7 +3827,7 @@  discard block
 block discarded – undo
3827 3827
                 $rows[] = $row;
3828 3828
             }
3829 3829
 
3830
-            $table = new SortableTableFromArrayConfig($rows,0,10,'RecentPages_table','','','DESC');
3830
+            $table = new SortableTableFromArrayConfig($rows, 0, 10, 'RecentPages_table', '', '', 'DESC');
3831 3831
             $table->set_additional_parameters(
3832 3832
                 array(
3833 3833
                     'cidReq' =>api_get_course_id(),
@@ -3836,11 +3836,11 @@  discard block
 block discarded – undo
3836 3836
                     'group_id' => api_get_group_id()
3837 3837
                 )
3838 3838
             );
3839
-            $table->set_header(0,get_lang('Date'), true, array ('style' => 'width:200px;'));
3840
-            $table->set_header(1,get_lang('Type'), true, array ('style' => 'width:30px;'));
3841
-            $table->set_header(2,get_lang('Title'), true);
3842
-            $table->set_header(3,get_lang('Actions'), true, array ('style' => 'width:80px;'));
3843
-            $table->set_header(4,get_lang('Author'), true);
3839
+            $table->set_header(0, get_lang('Date'), true, array('style' => 'width:200px;'));
3840
+            $table->set_header(1, get_lang('Type'), true, array('style' => 'width:30px;'));
3841
+            $table->set_header(2, get_lang('Title'), true);
3842
+            $table->set_header(3, get_lang('Actions'), true, array('style' => 'width:80px;'));
3843
+            $table->set_header(4, get_lang('Author'), true);
3844 3844
             $table->display();
3845 3845
         }
3846 3846
     }
@@ -3872,17 +3872,17 @@  discard block
 block discarded – undo
3872 3872
 
3873 3873
             //get type assignment icon
3874 3874
             $ShowAssignment = '';
3875
-            if ($row['assignment']==1) {
3876
-                $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL);
3877
-            } elseif ($row['assignment']==2) {
3878
-                $ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
3879
-            } elseif ($row['assignment']==0) {
3880
-                $ShowAssignment=Display::return_icon('px_transparent.gif');
3875
+            if ($row['assignment'] == 1) {
3876
+                $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL);
3877
+            } elseif ($row['assignment'] == 2) {
3878
+                $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
3879
+            } elseif ($row['assignment'] == 0) {
3880
+                $ShowAssignment = Display::return_icon('px_transparent.gif');
3881 3881
             }
3882 3882
 
3883 3883
             //fix Title to reflink (link Main Page)
3884
-            if ($page==get_lang('DefaultTitle')) {
3885
-                $page='index';
3884
+            if ($page == get_lang('DefaultTitle')) {
3885
+                $page = 'index';
3886 3886
             }
3887 3887
 
3888 3888
             echo '<div id="wikititle">';
@@ -3893,11 +3893,11 @@  discard block
 block discarded – undo
3893 3893
             //fix index to title Main page into linksto
3894 3894
 
3895 3895
             if ($page == 'index') {
3896
-                $page = str_replace(' ','_',get_lang('DefaultTitle'));
3896
+                $page = str_replace(' ', '_', get_lang('DefaultTitle'));
3897 3897
             }
3898 3898
 
3899 3899
             //table
3900
-            if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
3900
+            if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3901 3901
                 //only by professors if page is hidden
3902 3902
                 $sql = "SELECT * FROM ".$tbl_wiki." s1
3903 3903
                         WHERE s1.c_id = $course_id AND linksto LIKE '%".Database::escape_string($page)."%' AND id=(
@@ -3924,10 +3924,10 @@  discard block
 block discarded – undo
3924 3924
                     //get time
3925 3925
                     $year 	 = substr($obj->dtime, 0, 4);
3926 3926
                     $month	 = substr($obj->dtime, 5, 2);
3927
-                    $day 	 = substr($obj->dtime, 8, 2);
3928
-                    $hours   = substr($obj->dtime, 11,2);
3929
-                    $minutes = substr($obj->dtime, 14,2);
3930
-                    $seconds = substr($obj->dtime, 17,2);
3927
+                    $day = substr($obj->dtime, 8, 2);
3928
+                    $hours   = substr($obj->dtime, 11, 2);
3929
+                    $minutes = substr($obj->dtime, 14, 2);
3930
+                    $seconds = substr($obj->dtime, 17, 2);
3931 3931
 
3932 3932
                     //get type assignment icon
3933 3933
                     if ($obj->assignment == 1) {
@@ -3939,7 +3939,7 @@  discard block
 block discarded – undo
3939 3939
                     }
3940 3940
 
3941 3941
                     $row = array();
3942
-                    $row[] =$ShowAssignment;
3942
+                    $row[] = $ShowAssignment;
3943 3943
                     $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']).'">'.
3944 3944
                         api_htmlentities($obj->title).'</a>';
3945 3945
                     if ($userinfo !== false) {
@@ -4046,13 +4046,13 @@  discard block
 block discarded – undo
4046 4046
         $userId = intval($userId);
4047 4047
         $userinfo = api_get_user_info($userId);
4048 4048
         if ($userinfo !== false) {
4049
-            echo '<div class="actions">' . get_lang('UserContributions') . ': ' . UserManager::getUserProfileLink($userinfo) .
4050
-                '<a href="' . api_get_self() . '?cidReq=' . $_course['code'] . '&action=usercontrib&user_id=' . $userId .
4051
-                '&session_id=' . $this->session_id . '&group_id=' . $this->group_id . '">' .
4049
+            echo '<div class="actions">'.get_lang('UserContributions').': '.UserManager::getUserProfileLink($userinfo).
4050
+                '<a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=usercontrib&user_id='.$userId.
4051
+                '&session_id='.$this->session_id.'&group_id='.$this->group_id.'">'.
4052 4052
                 '</a></div>';
4053 4053
         }
4054 4054
 
4055
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
4055
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
4056 4056
             //only by professors if page is hidden
4057 4057
             $sql = 'SELECT * FROM '.$tbl_wiki.'
4058 4058
                     WHERE
@@ -4077,19 +4077,19 @@  discard block
 block discarded – undo
4077 4077
                 // Get time
4078 4078
                 $year 	 = substr($obj->dtime, 0, 4);
4079 4079
                 $month	 = substr($obj->dtime, 5, 2);
4080
-                $day 	 = substr($obj->dtime, 8, 2);
4081
-                $hours   = substr($obj->dtime, 11,2);
4082
-                $minutes = substr($obj->dtime, 14,2);
4083
-                $seconds = substr($obj->dtime, 17,2);
4080
+                $day = substr($obj->dtime, 8, 2);
4081
+                $hours   = substr($obj->dtime, 11, 2);
4082
+                $minutes = substr($obj->dtime, 14, 2);
4083
+                $seconds = substr($obj->dtime, 17, 2);
4084 4084
 
4085 4085
                 //get type assignment icon
4086 4086
                 $ShowAssignment = '';
4087
-                if ($obj->assignment==1) {
4088
-                    $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'),'',ICON_SIZE_SMALL);
4089
-                } elseif ($obj->assignment==2) {
4090
-                    $ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
4091
-                } elseif ($obj->assignment==0) {
4092
-                    $ShowAssignment= Display::return_icon('px_transparent.gif');
4087
+                if ($obj->assignment == 1) {
4088
+                    $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'), '', ICON_SIZE_SMALL);
4089
+                } elseif ($obj->assignment == 2) {
4090
+                    $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
4091
+                } elseif ($obj->assignment == 0) {
4092
+                    $ShowAssignment = Display::return_icon('px_transparent.gif');
4093 4093
                 }
4094 4094
 
4095 4095
                 $row = array();
@@ -4105,7 +4105,7 @@  discard block
 block discarded – undo
4105 4105
 
4106 4106
             }
4107 4107
 
4108
-            $table = new SortableTableFromArrayConfig($rows,2,10,'UsersContributions_table','','','ASC');
4108
+            $table = new SortableTableFromArrayConfig($rows, 2, 10, 'UsersContributions_table', '', '', 'ASC');
4109 4109
             $table->set_additional_parameters(
4110 4110
                 array(
4111 4111
                     'cidReq' => Security::remove_XSS($_GET['cidReq']),
@@ -4115,13 +4115,13 @@  discard block
 block discarded – undo
4115 4115
                     'group_id' => intval($_GET['group_id']),
4116 4116
                 )
4117 4117
             );
4118
-            $table->set_header(0,get_lang('Date'), true, array ('style' => 'width:200px;'));
4119
-            $table->set_header(1,get_lang('Type'), true, array ('style' => 'width:30px;'));
4120
-            $table->set_header(2,get_lang('Title'), true, array ('style' => 'width:200px;'));
4121
-            $table->set_header(3,get_lang('Version'), true, array ('style' => 'width:30px;'));
4122
-            $table->set_header(4,get_lang('Comment'), true, array ('style' => 'width:200px;'));
4123
-            $table->set_header(5,get_lang('Progress'), true, array ('style' => 'width:30px;'));
4124
-            $table->set_header(6,get_lang('Rating'), true, array ('style' => 'width:30px;'));
4118
+            $table->set_header(0, get_lang('Date'), true, array('style' => 'width:200px;'));
4119
+            $table->set_header(1, get_lang('Type'), true, array('style' => 'width:30px;'));
4120
+            $table->set_header(2, get_lang('Title'), true, array('style' => 'width:200px;'));
4121
+            $table->set_header(3, get_lang('Version'), true, array('style' => 'width:30px;'));
4122
+            $table->set_header(4, get_lang('Comment'), true, array('style' => 'width:200px;'));
4123
+            $table->set_header(5, get_lang('Progress'), true, array('style' => 'width:30px;'));
4124
+            $table->set_header(6, get_lang('Rating'), true, array('style' => 'width:30px;'));
4125 4125
             $table->display();
4126 4126
         }
4127 4127
     }
@@ -4139,7 +4139,7 @@  discard block
 block discarded – undo
4139 4139
 
4140 4140
         echo '<div class="actions">'.get_lang('MostChangedPages').'</div>';
4141 4141
 
4142
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { //only by professors if page is hidden
4142
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { //only by professors if page is hidden
4143 4143
             $sql = 'SELECT *, MAX(version) AS MAX FROM '.$tbl_wiki.'
4144 4144
                     WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.'
4145 4145
                     GROUP BY reflink';//TODO:check MAX and group by return last version
@@ -4157,12 +4157,12 @@  discard block
 block discarded – undo
4157 4157
             while ($obj = Database::fetch_object($allpages)) {
4158 4158
                 //get type assignment icon
4159 4159
                 $ShowAssignment = '';
4160
-                if ($obj->assignment==1) {
4161
-                    $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL);
4162
-                } elseif ($obj->assignment==2) {
4163
-                    $ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
4164
-                } elseif ($obj->assignment==0) {
4165
-                    $ShowAssignment= Display::return_icon('px_transparent.gif');
4160
+                if ($obj->assignment == 1) {
4161
+                    $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL);
4162
+                } elseif ($obj->assignment == 2) {
4163
+                    $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
4164
+                } elseif ($obj->assignment == 0) {
4165
+                    $ShowAssignment = Display::return_icon('px_transparent.gif');
4166 4166
                 }
4167 4167
 
4168 4168
                 $row = array();
@@ -4190,9 +4190,9 @@  discard block
 block discarded – undo
4190 4190
                     'group_id' => intval($_GET['group_id']),
4191 4191
                 )
4192 4192
             );
4193
-            $table->set_header(0,get_lang('Type'), true, array ('style' => 'width:30px;'));
4194
-            $table->set_header(1,get_lang('Title'), true);
4195
-            $table->set_header(2,get_lang('Changes'), true);
4193
+            $table->set_header(0, get_lang('Type'), true, array('style' => 'width:30px;'));
4194
+            $table->set_header(1, get_lang('Title'), true);
4195
+            $table->set_header(2, get_lang('Changes'), true);
4196 4196
             $table->display();
4197 4197
         }
4198 4198
     }
@@ -4217,7 +4217,7 @@  discard block
 block discarded – undo
4217 4217
         /* Only teachers and platform admin can edit the index page.
4218 4218
         Only teachers and platform admin can edit an assignment teacher*/
4219 4219
         if (($current_row['reflink'] == 'index' || $current_row['reflink'] == '' || $current_row['assignment'] == 1) &&
4220
-            (!api_is_allowed_to_edit(false,true) && $this->group_id == 0)
4220
+            (!api_is_allowed_to_edit(false, true) && $this->group_id == 0)
4221 4221
         ) {
4222 4222
             self::setMessage(
4223 4223
                 Display::display_normal_message(get_lang('OnlyEditPagesCourseManager'), false, true)
@@ -4227,7 +4227,7 @@  discard block
 block discarded – undo
4227 4227
             // check if is a wiki group
4228 4228
             if ($current_row['group_id'] != 0) {
4229 4229
                 //Only teacher, platform admin and group members can edit a wiki group
4230
-                if (api_is_allowed_to_edit(false,true) ||
4230
+                if (api_is_allowed_to_edit(false, true) ||
4231 4231
                     api_is_platform_admin() ||
4232 4232
                     GroupManager :: is_user_in_group($userId, $this->group_id) ||
4233 4233
                     api_is_allowed_in_course()
@@ -4246,9 +4246,9 @@  discard block
 block discarded – undo
4246 4246
             //$icon_assignment = null;
4247 4247
             if ($current_row['assignment'] == 1) {
4248 4248
                 self::setMessage(Display::display_normal_message(get_lang('EditAssignmentWarning'), false, true));
4249
-            } elseif($current_row['assignment']==2) {
4250
-                if (($userId == $current_row['user_id'])==false) {
4251
-                    if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
4249
+            } elseif ($current_row['assignment'] == 2) {
4250
+                if (($userId == $current_row['user_id']) == false) {
4251
+                    if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
4252 4252
                         $PassEdit = true;
4253 4253
                     } else {
4254 4254
                         self::setMessage(Display::display_warning_message(get_lang('LockByTeacher'), false, true));
@@ -4262,11 +4262,11 @@  discard block
 block discarded – undo
4262 4262
             //show editor if edit is allowed
4263 4263
             if ($PassEdit) {
4264 4264
                 if ($current_row['editlock'] == 1 &&
4265
-                    (api_is_allowed_to_edit(false,true)==false || api_is_platform_admin()==false)
4265
+                    (api_is_allowed_to_edit(false, true) == false || api_is_platform_admin() == false)
4266 4266
                 ) {
4267 4267
                     self::setMessage(Display::display_normal_message(get_lang('PageLockedExtra'), false, true));
4268 4268
                 } else {
4269
-                    if ($last_row['is_editing']!=0 && $last_row['is_editing'] != $userId) {
4269
+                    if ($last_row['is_editing'] != 0 && $last_row['is_editing'] != $userId) {
4270 4270
                         // Checking for concurrent users
4271 4271
                         $timestamp_edit = strtotime($last_row['time_edit']);
4272 4272
                         $time_editing = time() - $timestamp_edit;
@@ -4275,7 +4275,7 @@  discard block
 block discarded – undo
4275 4275
                         $userinfo = api_get_user_info($last_row['is_editing']);
4276 4276
                         $is_being_edited = get_lang('ThisPageisBeginEditedBy').' <a href='.$userinfo['profile_url'].'>'.
4277 4277
                             Display::tag('span', $userinfo['complete_name_with_username']).
4278
-                            get_lang('ThisPageisBeginEditedTryLater').' '.date( "i",$rest_time).' '.get_lang('MinMinutes');
4278
+                            get_lang('ThisPageisBeginEditedTryLater').' '.date("i", $rest_time).' '.get_lang('MinMinutes');
4279 4279
                         self::setMessage(Display::display_normal_message($is_being_edited, false, true));
4280 4280
                     } else {
4281 4281
                         self::setMessage(Display::display_confirmation_message(
@@ -4383,9 +4383,9 @@  discard block
 block discarded – undo
4383 4383
                 GROUP BY reflink
4384 4384
                 ORDER BY reflink ASC';
4385 4385
         $allpages = Database::query($sql);
4386
-        while ($row=Database::fetch_array($allpages)) {
4387
-            if ($row['reflink']=='index') {
4388
-                $row['reflink']=str_replace(' ', '_', get_lang('DefaultTitle'));
4386
+        while ($row = Database::fetch_array($allpages)) {
4387
+            if ($row['reflink'] == 'index') {
4388
+                $row['reflink'] = str_replace(' ', '_', get_lang('DefaultTitle'));
4389 4389
             }
4390 4390
             $pages[] = $row['reflink'];
4391 4391
         }
@@ -4403,16 +4403,16 @@  discard block
 block discarded – undo
4403 4403
 
4404 4404
         $allpages = Database::query($sql);
4405 4405
 
4406
-        while ($row=Database::fetch_array($allpages)) {
4406
+        while ($row = Database::fetch_array($allpages)) {
4407 4407
             //remove self reference
4408
-            $row['linksto']= str_replace($row["reflink"], " ", trim($row["linksto"]));
4408
+            $row['linksto'] = str_replace($row["reflink"], " ", trim($row["linksto"]));
4409 4409
             $refs = explode(" ", trim($row["linksto"]));
4410 4410
 
4411 4411
             // Find linksto into reflink. If found ->page is linked
4412 4412
             foreach ($refs as $v) {
4413 4413
                 if (in_array($v, $pages)) {
4414
-                    if (trim($v)!="") {
4415
-                        $linked[]=$v;
4414
+                    if (trim($v) != "") {
4415
+                        $linked[] = $v;
4416 4416
                     }
4417 4417
                 }
4418 4418
             }
@@ -4424,12 +4424,12 @@  discard block
 block discarded – undo
4424 4424
         $rows = array();
4425 4425
         foreach ($linked as $linked_show) {
4426 4426
             $row = array();
4427
-            $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']).'">'.
4428
-                str_replace('_',' ',$linked_show).'</a>';
4427
+            $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']).'">'.
4428
+                str_replace('_', ' ', $linked_show).'</a>';
4429 4429
             $rows[] = $row;
4430 4430
         }
4431 4431
 
4432
-        $table = new SortableTableFromArrayConfig($rows,0,10,'LinkedPages_table','','','DESC');
4432
+        $table = new SortableTableFromArrayConfig($rows, 0, 10, 'LinkedPages_table', '', '', 'DESC');
4433 4433
         $table->set_additional_parameters(
4434 4434
             array(
4435 4435
                 'cidReq' => Security::remove_XSS($_GET['cidReq']),
@@ -4438,7 +4438,7 @@  discard block
 block discarded – undo
4438 4438
                 'group_id' => intval($_GET['group_id']),
4439 4439
             )
4440 4440
         );
4441
-        $table->set_header(0,get_lang('Title'), true);
4441
+        $table->set_header(0, get_lang('Title'), true);
4442 4442
         $table->display();
4443 4443
     }
4444 4444
 
@@ -4463,8 +4463,8 @@  discard block
 block discarded – undo
4463 4463
                 WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.'
4464 4464
                 GROUP BY reflink
4465 4465
                 ORDER BY reflink ASC';
4466
-        $allpages=Database::query($sql);
4467
-        while ($row=Database::fetch_array($allpages)) {
4466
+        $allpages = Database::query($sql);
4467
+        while ($row = Database::fetch_array($allpages)) {
4468 4468
             $pages[] = $row['reflink'];
4469 4469
         }
4470 4470
 
@@ -4479,14 +4479,14 @@  discard block
 block discarded – undo
4479 4479
                 )';
4480 4480
         $allpages = Database::query($sql);
4481 4481
         $array_refs_linked = array();
4482
-        while ($row=Database::fetch_array($allpages)) {
4483
-            $row['linksto']= str_replace($row["reflink"], " ", trim($row["linksto"])); //remove self reference
4482
+        while ($row = Database::fetch_array($allpages)) {
4483
+            $row['linksto'] = str_replace($row["reflink"], " ", trim($row["linksto"])); //remove self reference
4484 4484
             $refs = explode(" ", trim($row["linksto"]));
4485
-            foreach ($refs as $ref_linked){
4486
-                if ($ref_linked==str_replace(' ','_',get_lang('DefaultTitle'))) {
4487
-                    $ref_linked='index';
4485
+            foreach ($refs as $ref_linked) {
4486
+                if ($ref_linked == str_replace(' ', '_', get_lang('DefaultTitle'))) {
4487
+                    $ref_linked = 'index';
4488 4488
                 }
4489
-                $array_refs_linked[]= $ref_linked;
4489
+                $array_refs_linked[] = $ref_linked;
4490 4490
             }
4491 4491
         }
4492 4492
 
@@ -4508,20 +4508,20 @@  discard block
 block discarded – undo
4508 4508
 		                '.$groupfilter.$condition_session.' AND
4509 4509
 		                reflink="'.Database::escape_string($orphaned_show).'"
4510 4510
                     GROUP BY reflink';
4511
-            $allpages=Database::query($sql);
4512
-            while ($row=Database::fetch_array($allpages)) {
4513
-                $orphaned_title=$row['title'];
4514
-                $orphaned_visibility=$row['visibility'];
4515
-                if ($row['assignment']==1) {
4516
-                    $ShowAssignment=Display::return_icon('wiki_assignment.png','','',ICON_SIZE_SMALL);
4517
-                } elseif ($row['assignment']==2) {
4518
-                    $ShowAssignment=Display::return_icon('wiki_work.png','','',ICON_SIZE_SMALL);
4519
-                } elseif ($row['assignment']==0) {
4520
-                    $ShowAssignment= Display::return_icon('px_transparent.gif');
4511
+            $allpages = Database::query($sql);
4512
+            while ($row = Database::fetch_array($allpages)) {
4513
+                $orphaned_title = $row['title'];
4514
+                $orphaned_visibility = $row['visibility'];
4515
+                if ($row['assignment'] == 1) {
4516
+                    $ShowAssignment = Display::return_icon('wiki_assignment.png', '', '', ICON_SIZE_SMALL);
4517
+                } elseif ($row['assignment'] == 2) {
4518
+                    $ShowAssignment = Display::return_icon('wiki_work.png', '', '', ICON_SIZE_SMALL);
4519
+                } elseif ($row['assignment'] == 0) {
4520
+                    $ShowAssignment = Display::return_icon('px_transparent.gif');
4521 4521
                 }
4522 4522
             }
4523 4523
 
4524
-            if (!api_is_allowed_to_edit(false,true) || !api_is_platform_admin() && $orphaned_visibility==0){
4524
+            if (!api_is_allowed_to_edit(false, true) || !api_is_platform_admin() && $orphaned_visibility == 0) {
4525 4525
                 continue;
4526 4526
             }
4527 4527
 
@@ -4533,7 +4533,7 @@  discard block
 block discarded – undo
4533 4533
             $rows[] = $row;
4534 4534
         }
4535 4535
 
4536
-        $table = new SortableTableFromArrayConfig($rows,1, 10, 'OrphanedPages_table','','','DESC');
4536
+        $table = new SortableTableFromArrayConfig($rows, 1, 10, 'OrphanedPages_table', '', '', 'DESC');
4537 4537
         $table->set_additional_parameters(
4538 4538
             array(
4539 4539
                 'cidReq' => Security::remove_XSS($_GET['cidReq']),
@@ -4542,8 +4542,8 @@  discard block
 block discarded – undo
4542 4542
                 'group_id' => intval($_GET['group_id']),
4543 4543
             )
4544 4544
         );
4545
-        $table->set_header(0,get_lang('Type'), true, array ('style' => 'width:30px;'));
4546
-        $table->set_header(1,get_lang('Title'), true);
4545
+        $table->set_header(0, get_lang('Type'), true, array('style' => 'width:30px;'));
4546
+        $table->set_header(1, get_lang('Title'), true);
4547 4547
         $table->display();
4548 4548
     }
4549 4549
 
@@ -4565,11 +4565,11 @@  discard block
 block discarded – undo
4565 4565
                 WHERE  c_id = '.$course_id.' AND '.$groupfilter.$condition_session.'
4566 4566
                 GROUP BY reflink
4567 4567
                 ORDER BY reflink ASC';
4568
-        $allpages=Database::query($sql);
4568
+        $allpages = Database::query($sql);
4569 4569
 
4570
-        while ($row=Database::fetch_array($allpages)) {
4571
-            if ($row['reflink']=='index'){
4572
-                $row['reflink']=str_replace(' ','_',get_lang('DefaultTitle'));
4570
+        while ($row = Database::fetch_array($allpages)) {
4571
+            if ($row['reflink'] == 'index') {
4572
+                $row['reflink'] = str_replace(' ', '_', get_lang('DefaultTitle'));
4573 4573
             }
4574 4574
             $pages[] = $row['reflink'];
4575 4575
         }
@@ -4583,31 +4583,31 @@  discard block
 block discarded – undo
4583 4583
 
4584 4584
         $allpages = Database::query($sql);
4585 4585
 
4586
-        while ($row=Database::fetch_array($allpages)) {
4586
+        while ($row = Database::fetch_array($allpages)) {
4587 4587
             $refs = explode(" ", trim($row["linksto"]));
4588 4588
             // Find linksto into reflink. If not found ->page is wanted
4589 4589
             foreach ($refs as $v) {
4590 4590
 
4591 4591
                 if (!in_array($v, $pages)) {
4592
-                    if (trim($v)!="") {
4593
-                        $wanted[]=$v;
4592
+                    if (trim($v) != "") {
4593
+                        $wanted[] = $v;
4594 4594
                     }
4595 4595
                 }
4596 4596
             }
4597 4597
         }
4598 4598
 
4599
-        $wanted = array_unique($wanted);//make a unique list
4599
+        $wanted = array_unique($wanted); //make a unique list
4600 4600
 
4601 4601
         //show table
4602 4602
         $rows = array();
4603 4603
         foreach ($wanted as $wanted_show) {
4604 4604
             $row = array();
4605 4605
             $wanted_show = Security::remove_XSS($wanted_show);
4606
-            $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
4606
+            $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
4607 4607
             $rows[] = $row;
4608 4608
         }
4609 4609
 
4610
-        $table = new SortableTableFromArrayConfig($rows,0,10,'WantedPages_table','','','DESC');
4610
+        $table = new SortableTableFromArrayConfig($rows, 0, 10, 'WantedPages_table', '', '', 'DESC');
4611 4611
         $table->set_additional_parameters(
4612 4612
             array(
4613 4613
                 'cidReq' => Security::remove_XSS($_GET['cidReq']),
@@ -4616,7 +4616,7 @@  discard block
 block discarded – undo
4616 4616
                 'group_id' => intval($_GET['group_id']),
4617 4617
             )
4618 4618
         );
4619
-        $table->set_header(0,get_lang('Title'), true);
4619
+        $table->set_header(0, get_lang('Title'), true);
4620 4620
         $table->display();
4621 4621
     }
4622 4622
 
@@ -4633,7 +4633,7 @@  discard block
 block discarded – undo
4633 4633
 
4634 4634
         echo '<div class="actions">'.get_lang('MostVisitedPages').'</div>';
4635 4635
 
4636
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { //only by professors if page is hidden
4636
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { //only by professors if page is hidden
4637 4637
             $sql = 'SELECT *, SUM(hits) AS tsum FROM '.$tbl_wiki.'
4638 4638
                     WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.'
4639 4639
                     GROUP BY reflink';
@@ -4654,11 +4654,11 @@  discard block
 block discarded – undo
4654 4654
             while ($obj = Database::fetch_object($allpages)) {
4655 4655
                 //get type assignment icon
4656 4656
                 $ShowAssignment = '';
4657
-                if ($obj->assignment==1) {
4658
-                    $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL);
4659
-                } elseif ($obj->assignment==2) {
4660
-                    $ShowAssignment=$ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
4661
-                } elseif ($obj->assignment==0) {
4657
+                if ($obj->assignment == 1) {
4658
+                    $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL);
4659
+                } elseif ($obj->assignment == 2) {
4660
+                    $ShowAssignment = $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
4661
+                } elseif ($obj->assignment == 0) {
4662 4662
                     $ShowAssignment = Display::return_icon('px_transparent.gif');
4663 4663
                 }
4664 4664
 
@@ -4687,7 +4687,7 @@  discard block
 block discarded – undo
4687 4687
                     'group_id' => intval($_GET['group_id']),
4688 4688
                 )
4689 4689
             );
4690
-            $table->set_header(0,get_lang('Type'), true, array ('style' => 'width:30px;'));
4690
+            $table->set_header(0, get_lang('Type'), true, array('style' => 'width:30px;'));
4691 4691
             $table->set_header(1, get_lang('Title'), true);
4692 4692
             $table->set_header(2, get_lang('Visits'), true);
4693 4693
             $table->display();
@@ -4712,8 +4712,8 @@  discard block
 block discarded – undo
4712 4712
 
4713 4713
         if (api_is_allowed_to_session_edit(false, true) && api_is_allowed_to_edit()) {
4714 4714
             // menu add page
4715
-            $actionsLeft .= '<a href="index.php?cidReq=' . $_course['id'] . '&action=addnew&session_id=' . $session_id . '&group_id=' . $groupId . '"' . self::is_active_navigation_tab('addnew').'>'
4716
-            . Display::return_icon('add.png', get_lang('AddNew'), '', ICON_SIZE_MEDIUM) . '</a>';
4715
+            $actionsLeft .= '<a href="index.php?cidReq='.$_course['id'].'&action=addnew&session_id='.$session_id.'&group_id='.$groupId.'"'.self::is_active_navigation_tab('addnew').'>'
4716
+            . Display::return_icon('add.png', get_lang('AddNew'), '', ICON_SIZE_MEDIUM).'</a>';
4717 4717
         }
4718 4718
 
4719 4719
         $lock_unlock_addnew = null;
@@ -4721,12 +4721,12 @@  discard block
 block discarded – undo
4721 4721
 
4722 4722
         if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
4723 4723
             // page action: enable or disable the adding of new pages
4724
-            if (self::check_addnewpagelock()==0) {
4724
+            if (self::check_addnewpagelock() == 0) {
4725 4725
                 $protect_addnewpage = Display::return_icon('off.png', get_lang('AddOptionProtected'));
4726
-                $lock_unlock_addnew ='unlockaddnew';
4726
+                $lock_unlock_addnew = 'unlockaddnew';
4727 4727
             } else {
4728 4728
                 $protect_addnewpage = Display::return_icon('on.png', get_lang('AddOptionUnprotected'));
4729
-                $lock_unlock_addnew ='lockaddnew';
4729
+                $lock_unlock_addnew = 'lockaddnew';
4730 4730
             }
4731 4731
         }
4732 4732
 
@@ -4762,7 +4762,7 @@  discard block
 block discarded – undo
4762 4762
             return;
4763 4763
         }
4764 4764
 
4765
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
4765
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
4766 4766
             self::setMessage('<div id="wikititle">'.get_lang('DeletePageHistory').'</div>');
4767 4767
 
4768 4768
             if ($page == "index") {
@@ -4804,7 +4804,7 @@  discard block
 block discarded – undo
4804 4804
         $userId = api_get_user_id();
4805 4805
 
4806 4806
         if (api_get_session_id() != 0 &&
4807
-            api_is_allowed_to_session_edit(false,true) == false
4807
+            api_is_allowed_to_session_edit(false, true) == false
4808 4808
         ) {
4809 4809
             api_not_allowed();
4810 4810
         }
@@ -4827,12 +4827,12 @@  discard block
 block discarded – undo
4827 4827
                 Display::display_error_message(get_lang('MustSelectPage'), false, true)
4828 4828
             );
4829 4829
             return;
4830
-        } elseif ($row['content']=='' && $row['title']=='' && $page=='index') {
4830
+        } elseif ($row['content'] == '' && $row['title'] == '' && $page == 'index') {
4831 4831
 
4832 4832
             // Table structure for better export to pdf
4833 4833
             $default_table_for_content_Start = '<table align="center" border="0"><tr><td align="center">';
4834 4834
             $default_table_for_content_End = '</td></tr></table>';
4835
-            $content = $default_table_for_content_Start.sprintf(get_lang('DefaultContent'),api_get_path(WEB_IMG_PATH)).$default_table_for_content_End;
4835
+            $content = $default_table_for_content_Start.sprintf(get_lang('DefaultContent'), api_get_path(WEB_IMG_PATH)).$default_table_for_content_End;
4836 4836
             $title = get_lang('DefaultTitle');
4837 4837
             $page_id = 0;
4838 4838
         } else {
@@ -4858,7 +4858,7 @@  discard block
 block discarded – undo
4858 4858
             // Check if is a wiki group
4859 4859
             if (!empty($groupId)) {
4860 4860
                 //Only teacher, platform admin and group members can edit a wiki group
4861
-                if (api_is_allowed_to_edit(false,true) ||
4861
+                if (api_is_allowed_to_edit(false, true) ||
4862 4862
                     api_is_platform_admin() ||
4863 4863
                     GroupManager :: is_user_in_group($userId, $groupId)
4864 4864
                 ) {
@@ -4871,7 +4871,7 @@  discard block
 block discarded – undo
4871 4871
                     );
4872 4872
                 }
4873 4873
             } else {
4874
-                $PassEdit=true;
4874
+                $PassEdit = true;
4875 4875
             }
4876 4876
 
4877 4877
             $icon_assignment = null;
@@ -4881,10 +4881,10 @@  discard block
 block discarded – undo
4881 4881
                     Display::return_message(get_lang('EditAssignmentWarning'))
4882 4882
                 );
4883 4883
 
4884
-                $icon_assignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'),'',ICON_SIZE_SMALL);
4884
+                $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'), '', ICON_SIZE_SMALL);
4885 4885
             } elseif ($row['assignment'] == 2) {
4886
-                $icon_assignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWorkExtra'),'',ICON_SIZE_SMALL);
4887
-                if (($userId == $row['user_id'])==false) {
4886
+                $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWorkExtra'), '', ICON_SIZE_SMALL);
4887
+                if (($userId == $row['user_id']) == false) {
4888 4888
                     if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
4889 4889
                         $PassEdit = true;
4890 4890
                     } else {
@@ -4904,7 +4904,7 @@  discard block
 block discarded – undo
4904 4904
             if ($PassEdit) {
4905 4905
                 //show editor if edit is allowed <<<<<
4906 4906
                 if ($row['editlock'] == 1 &&
4907
-                    (api_is_allowed_to_edit(false, true) == false || api_is_platform_admin()==false)
4907
+                    (api_is_allowed_to_edit(false, true) == false || api_is_platform_admin() == false)
4908 4908
                 ) {
4909 4909
                     Display::addFlash(
4910 4910
                         Display::return_message(
@@ -4914,7 +4914,7 @@  discard block
 block discarded – undo
4914 4914
                 } else {
4915 4915
                     // Check tasks
4916 4916
 
4917
-                    if (!empty($row['startdate_assig']) &&  time() < api_strtotime($row['startdate_assig'])
4917
+                    if (!empty($row['startdate_assig']) && time() < api_strtotime($row['startdate_assig'])
4918 4918
                     ) {
4919 4919
                         $message = get_lang('TheTaskDoesNotBeginUntil').': '.api_get_local_time($row['startdate_assig']);
4920 4920
 
@@ -4932,7 +4932,7 @@  discard block
 block discarded – undo
4932 4932
 
4933 4933
                     if (!empty($row['enddate_assig']) &&
4934 4934
                         time() > strtotime($row['enddate_assig']) &&
4935
-                        $row['delayedsubmit']==0
4935
+                        $row['delayedsubmit'] == 0
4936 4936
                     ) {
4937 4937
                         $message = get_lang('TheDeadlineHasBeenCompleted').': '.api_get_local_time($row['enddate_assig']);
4938 4938
                         Display::addFlash(
@@ -4941,20 +4941,20 @@  discard block
 block discarded – undo
4941 4941
                                 'warning'
4942 4942
                             )
4943 4943
                         );
4944
-                        if (!api_is_allowed_to_edit(false,true)) {
4944
+                        if (!api_is_allowed_to_edit(false, true)) {
4945 4945
                             $this->redirectHome();
4946 4946
                         }
4947 4947
                     }
4948 4948
 
4949
-                    if (!empty($row['max_version']) && $row['version']>=$row['max_version']) {
4950
-                        $message=get_lang('HasReachedMaxiNumVersions');
4949
+                    if (!empty($row['max_version']) && $row['version'] >= $row['max_version']) {
4950
+                        $message = get_lang('HasReachedMaxiNumVersions');
4951 4951
                         Display::addFlash(
4952 4952
                             Display::return_message(
4953 4953
                                 $message,
4954 4954
                                 'warning'
4955 4955
                             )
4956 4956
                         );
4957
-                        if (!api_is_allowed_to_edit(false,true)) {
4957
+                        if (!api_is_allowed_to_edit(false, true)) {
4958 4958
                             $this->redirectHome();
4959 4959
                         }
4960 4960
                     }
@@ -4967,7 +4967,7 @@  discard block
 block discarded – undo
4967 4967
                                 'warning'
4968 4968
                             )
4969 4969
                         );
4970
-                        if (!api_is_allowed_to_edit(false,true)) {
4970
+                        if (!api_is_allowed_to_edit(false, true)) {
4971 4971
                             $this->redirectHome();
4972 4972
                         }
4973 4973
                     }
@@ -4975,7 +4975,7 @@  discard block
 block discarded – undo
4975 4975
                     if (!empty($row['task'])) {
4976 4976
                         //previous change 0 by text
4977 4977
                         if (!empty($row['startdate_assig'])) {
4978
-                            $message_task_startdate  =get_lang('No');
4978
+                            $message_task_startdate = get_lang('No');
4979 4979
                         } else {
4980 4980
                             $message_task_startdate = api_get_local_time($row['startdate_assig']);
4981 4981
                         }
@@ -4986,31 +4986,31 @@  discard block
 block discarded – undo
4986 4986
                             $message_task_enddate = api_get_local_time($row['enddate_assig']);
4987 4987
                         }
4988 4988
 
4989
-                        if ($row['delayedsubmit']==0) {
4990
-                            $message_task_delayedsubmit=get_lang('No');
4989
+                        if ($row['delayedsubmit'] == 0) {
4990
+                            $message_task_delayedsubmit = get_lang('No');
4991 4991
                         } else {
4992
-                            $message_task_delayedsubmit=get_lang('Yes');
4992
+                            $message_task_delayedsubmit = get_lang('Yes');
4993 4993
                         }
4994 4994
 
4995
-                        if ($row['max_version']==0) {
4996
-                            $message_task_max_version=get_lang('No');
4995
+                        if ($row['max_version'] == 0) {
4996
+                            $message_task_max_version = get_lang('No');
4997 4997
                         } else {
4998
-                            $message_task_max_version=$row['max_version'];
4998
+                            $message_task_max_version = $row['max_version'];
4999 4999
                         }
5000 5000
 
5001
-                        if ($row['max_text']==0) {
5002
-                            $message_task_max_text=get_lang('No');
5001
+                        if ($row['max_text'] == 0) {
5002
+                            $message_task_max_text = get_lang('No');
5003 5003
                         } else {
5004
-                            $message_task_max_text=$row['max_text'];
5004
+                            $message_task_max_text = $row['max_text'];
5005 5005
                         }
5006 5006
 
5007 5007
                         // Comp message
5008
-                        $message_task='<b>'.get_lang('DescriptionOfTheTask').'</b><p>'.$row['task'].'</p><hr>';
5009
-                        $message_task.='<p>'.get_lang('StartDate').': '.$message_task_startdate.'</p>';
5010
-                        $message_task.='<p>'.get_lang('EndDate').': '.$message_task_enddate;
5011
-                        $message_task.=' ('.get_lang('AllowLaterSends').') '.$message_task_delayedsubmit.'</p>';
5012
-                        $message_task.='<p>'.get_lang('OtherSettings').': '.get_lang('NMaxVersion').': '.$message_task_max_version;
5013
-                        $message_task.=' '.get_lang('NMaxWords').': '.$message_task_max_text;
5008
+                        $message_task = '<b>'.get_lang('DescriptionOfTheTask').'</b><p>'.$row['task'].'</p><hr>';
5009
+                        $message_task .= '<p>'.get_lang('StartDate').': '.$message_task_startdate.'</p>';
5010
+                        $message_task .= '<p>'.get_lang('EndDate').': '.$message_task_enddate;
5011
+                        $message_task .= ' ('.get_lang('AllowLaterSends').') '.$message_task_delayedsubmit.'</p>';
5012
+                        $message_task .= '<p>'.get_lang('OtherSettings').': '.get_lang('NMaxVersion').': '.$message_task_max_version;
5013
+                        $message_task .= ' '.get_lang('NMaxWords').': '.$message_task_max_text;
5014 5014
                         // Display message
5015 5015
                         Display::addFlash(
5016 5016
                             Display::return_message(
@@ -5021,11 +5021,11 @@  discard block
 block discarded – undo
5021 5021
 
5022 5022
                     $feedback_message = '';
5023 5023
                     if ($row['progress'] == $row['fprogress1'] && !empty($row['fprogress1'])) {
5024
-                        $feedback_message='<b>'.get_lang('Feedback').'</b><p>'.api_htmlentities($row['feedback1']).'</p>';
5024
+                        $feedback_message = '<b>'.get_lang('Feedback').'</b><p>'.api_htmlentities($row['feedback1']).'</p>';
5025 5025
                     } elseif ($row['progress'] == $row['fprogress2'] && !empty($row['fprogress2'])) {
5026
-                        $feedback_message='<b>'.get_lang('Feedback').'</b><p>'.api_htmlentities($row['feedback2']).'</p>';
5026
+                        $feedback_message = '<b>'.get_lang('Feedback').'</b><p>'.api_htmlentities($row['feedback2']).'</p>';
5027 5027
                     } elseif ($row['progress'] == $row['fprogress3'] && !empty($row['fprogress3'])) {
5028
-                        $feedback_message='<b>'.get_lang('Feedback').'</b><p>'.api_htmlentities($row['feedback3']).'</p>';
5028
+                        $feedback_message = '<b>'.get_lang('Feedback').'</b><p>'.api_htmlentities($row['feedback3']).'</p>';
5029 5029
                     }
5030 5030
 
5031 5031
                     if (!empty($feedback_message)) {
@@ -5050,15 +5050,15 @@  discard block
 block discarded – undo
5050 5050
                                 WHERE c_id = '.$course_id.' AND id="'.$row['id'].'"';
5051 5051
                         Database::query($sql);
5052 5052
                     } elseif ($row['is_editing'] != $userId) {
5053
-                        $timestamp_edit=strtotime($row['time_edit']);
5053
+                        $timestamp_edit = strtotime($row['time_edit']);
5054 5054
                         $time_editing = time() - $timestamp_edit;
5055 5055
                         $max_edit_time = 1200; // 20 minutes
5056 5056
                         $rest_time = $max_edit_time - $time_editing;
5057 5057
 
5058 5058
                         $userinfo = api_get_user_info($row['is_editing']);
5059 5059
                         if ($userinfo !== false) {
5060
-                            $is_being_edited = get_lang('ThisPageisBeginEditedBy') . ' ' . UserManager::getUserProfileLink($userinfo) . '
5061
-                            ' . get_lang('ThisPageisBeginEditedTryLater') . ' ' . date("i", $rest_time) . ' ' . get_lang('MinMinutes') . '';
5060
+                            $is_being_edited = get_lang('ThisPageisBeginEditedBy').' '.UserManager::getUserProfileLink($userinfo).'
5061
+                            ' . get_lang('ThisPageisBeginEditedTryLater').' '.date("i", $rest_time).' '.get_lang('MinMinutes').'';
5062 5062
                         }
5063 5063
 
5064 5064
                         Display::addFlash(
@@ -5075,7 +5075,7 @@  discard block
 block discarded – undo
5075 5075
                     // Form.
5076 5076
                     $url = api_get_self().'?action=edit&title='.urlencode($page).'&session_id='.api_get_session_id().'&group_id='.api_get_group_id().'&'.api_get_cidreq();
5077 5077
                     $form = new FormValidator('wiki', 'post', $url);
5078
-                    $form->addElement('header', $icon_assignment.str_repeat('&nbsp;',3).api_htmlentities($title));
5078
+                    $form->addElement('header', $icon_assignment.str_repeat('&nbsp;', 3).api_htmlentities($title));
5079 5079
                     self::setForm($form, $row);
5080 5080
                     $form->addElement('hidden', 'title');
5081 5081
                     $form->addElement('button', 'SaveWikiChange', get_lang('Save'));
@@ -5098,7 +5098,7 @@  discard block
 block discarded – undo
5098 5098
                             );
5099 5099
                         } elseif (!self::double_post($_POST['wpost_id'])) {
5100 5100
                             //double post
5101
-                        } elseif ($_POST['version']!='' && $_SESSION['_version'] !=0 && $_POST['version'] != $_SESSION['_version']) {
5101
+                        } elseif ($_POST['version'] != '' && $_SESSION['_version'] != 0 && $_POST['version'] != $_SESSION['_version']) {
5102 5102
                             //prevent concurrent users and double version
5103 5103
                             Display::addFlash(
5104 5104
                                 Display::return_message(
@@ -5160,7 +5160,7 @@  discard block
 block discarded – undo
5160 5160
         $KeyAssignment = null;
5161 5161
         $KeyTitle = null;
5162 5162
         $KeyUserId = null;
5163
-        while ($row=Database::fetch_array($result)) {
5163
+        while ($row = Database::fetch_array($result)) {
5164 5164
             $KeyVisibility = $row['visibility'];
5165 5165
             $KeyAssignment = $row['assignment'];
5166 5166
             $KeyTitle = $row['title'];
@@ -5169,7 +5169,7 @@  discard block
 block discarded – undo
5169 5169
         $icon_assignment = null;
5170 5170
         if ($KeyAssignment == 1) {
5171 5171
             $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'), '', ICON_SIZE_SMALL);
5172
-        } elseif($KeyAssignment == 2) {
5172
+        } elseif ($KeyAssignment == 2) {
5173 5173
             $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWorkExtra'), '', ICON_SIZE_SMALL);
5174 5174
         }
5175 5175
 
@@ -5177,10 +5177,10 @@  discard block
 block discarded – undo
5177 5177
 
5178 5178
         //if the page is hidden and is a job only sees its author and professor
5179 5179
         if ($KeyVisibility == 1 ||
5180
-            api_is_allowed_to_edit(false,true) ||
5180
+            api_is_allowed_to_edit(false, true) ||
5181 5181
             api_is_platform_admin() ||
5182 5182
             (
5183
-                $KeyAssignment==2 && $KeyVisibility==0 &&
5183
+                $KeyAssignment == 2 && $KeyVisibility == 0 &&
5184 5184
                 ($userId == $KeyUserId)
5185 5185
             )
5186 5186
         ) {
@@ -5210,7 +5210,7 @@  discard block
 block discarded – undo
5210 5210
                     get_lang('ShowDifferences').' '.get_lang('WordsDiff').'</button>';
5211 5211
                 echo '<br/><br/>';
5212 5212
 
5213
-                $counter=0;
5213
+                $counter = 0;
5214 5214
                 $total_versions = Database::num_rows($result);
5215 5215
 
5216 5216
                 while ($row = Database::fetch_array($result)) {
@@ -5218,10 +5218,10 @@  discard block
 block discarded – undo
5218 5218
                     $username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username']), ENT_QUOTES);
5219 5219
 
5220 5220
                     echo '<li style="margin-bottom: 5px;">';
5221
-                    ($counter==0) ? $oldstyle='style="visibility: hidden;"':$oldstyle='';
5222
-                    ($counter==0) ? $newchecked=' checked': $newchecked='';
5223
-                    ($counter==$total_versions-1) ? $newstyle='style="visibility: hidden;"':$newstyle='';
5224
-                    ($counter==1) ? $oldchecked=' checked':$oldchecked='';
5221
+                    ($counter == 0) ? $oldstyle = 'style="visibility: hidden;"' : $oldstyle = '';
5222
+                    ($counter == 0) ? $newchecked = ' checked' : $newchecked = '';
5223
+                    ($counter == $total_versions - 1) ? $newstyle = 'style="visibility: hidden;"' : $newstyle = '';
5224
+                    ($counter == 1) ? $oldchecked = ' checked' : $oldchecked = '';
5225 5225
                     echo '<input name="old" value="'.$row['id'].'" type="radio" '.$oldstyle.' '.$oldchecked.'/> ';
5226 5226
                     echo '<input name="new" value="'.$row['id'].'" type="radio" '.$newstyle.' '.$newchecked.'/> ';
5227 5227
                     echo '<a href="'.api_get_self().'?action=showpage&amp;title='.api_htmlentities(urlencode($page)).'&amp;view='.$row['id'].'">';
@@ -5241,8 +5241,8 @@  discard block
 block discarded – undo
5241 5241
                         $comment = api_substr($comment, 0, 100);
5242 5242
                         if ($comment !== false) {
5243 5243
                             $comment = api_htmlentities($comment);
5244
-                            echo get_lang('Comments').': ' . $comment;
5245
-                            if (api_strlen($row['comment'])>100) {
5244
+                            echo get_lang('Comments').': '.$comment;
5245
+                            if (api_strlen($row['comment']) > 100) {
5246 5246
                                 echo '... ';
5247 5247
                             }
5248 5248
                         }
@@ -5268,8 +5268,8 @@  discard block
 block discarded – undo
5268 5268
 
5269 5269
                 $sql_new = "SELECT * FROM $tbl_wiki
5270 5270
                             WHERE c_id = $course_id AND id='".Database::escape_string($_POST['new'])."'";
5271
-                $result_new=Database::query($sql_new);
5272
-                $version_new=Database::fetch_array($result_new);
5271
+                $result_new = Database::query($sql_new);
5272
+                $version_new = Database::fetch_array($result_new);
5273 5273
                 $oldTime = isset($version_old['dtime']) ? $version_old['dtime'] : null;
5274 5274
                 $oldContent = isset($version_old['content']) ? $version_old['content'] : null;
5275 5275
 
@@ -5296,9 +5296,9 @@  discard block
 block discarded – undo
5296 5296
 
5297 5297
 
5298 5298
                 if (isset($_POST['HistoryDifferences'])) {
5299
-                    echo '<table>'.diff($oldContent, $version_new['content'], true, 'format_table_line' ).'</table>'; // format_line mode is better for words
5299
+                    echo '<table>'.diff($oldContent, $version_new['content'], true, 'format_table_line').'</table>'; // format_line mode is better for words
5300 5300
                     echo '<br />';
5301
-                    echo '<strong>'.get_lang('Legend').'</strong><div class="diff">' . "\n";
5301
+                    echo '<strong>'.get_lang('Legend').'</strong><div class="diff">'."\n";
5302 5302
                     echo '<table><tr>';
5303 5303
                     echo  '<td>';
5304 5304
                     echo '</td><td>';
@@ -5317,7 +5317,7 @@  discard block
 block discarded – undo
5317 5317
                     $renderer = new Text_Diff_Renderer_inline();
5318 5318
                     echo '<style>del{background:#fcc}ins{background:#cfc}</style>'.$renderer->render($diff); // Code inline
5319 5319
                     echo '<br />';
5320
-                    echo '<strong>'.get_lang('Legend').'</strong><div class="diff">' . "\n";
5320
+                    echo '<strong>'.get_lang('Legend').'</strong><div class="diff">'."\n";
5321 5321
                     echo '<table><tr>';
5322 5322
                     echo  '<td>';
5323 5323
                     echo '</td><td>';
@@ -5365,7 +5365,7 @@  discard block
 block discarded – undo
5365 5365
         echo '<td style="vertical-align:top">';
5366 5366
         echo '<ul>';
5367 5367
         // Submenu Statistics
5368
-        if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
5368
+        if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
5369 5369
             echo '<li><a href="index.php?cidReq='.$_course['id'].'&action=statistics&session_id='.$session_id.'&group_id='.$groupId.'">'.get_lang('Statistics').'</a></li>';
5370 5370
         }
5371 5371
         echo '      </ul>';
@@ -5438,7 +5438,7 @@  discard block
 block discarded – undo
5438 5438
                 break;
5439 5439
             case 'deletewiki':
5440 5440
                 $title = '<div class="actions">'.get_lang('DeleteWiki').'</div>';
5441
-                if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
5441
+                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
5442 5442
                     $message = get_lang('ConfirmDeleteWiki');
5443 5443
                     $message .= '<p>
5444 5444
                         <a href="index.php?'.api_get_cidreq().'">'.get_lang('No').'</a>
@@ -5469,14 +5469,14 @@  discard block
 block discarded – undo
5469 5469
                 self::getLinks($page);
5470 5470
                 break;
5471 5471
             case 'addnew':
5472
-                if (api_get_session_id()!=0 && api_is_allowed_to_session_edit(false,true)==false) {
5472
+                if (api_get_session_id() != 0 && api_is_allowed_to_session_edit(false, true) == false) {
5473 5473
                     api_not_allowed();
5474 5474
                 }
5475 5475
                 echo '<div class="actions">'.get_lang('AddNew').'</div>';
5476 5476
                 echo '<br/>';
5477 5477
                 //first, check if page index was created. chektitle=false
5478 5478
                 if (self::checktitle('index')) {
5479
-                    if (api_is_allowed_to_edit(false,true) ||
5479
+                    if (api_is_allowed_to_edit(false, true) ||
5480 5480
                         api_is_platform_admin() ||
5481 5481
                         GroupManager::is_user_in_group(api_get_user_id(), api_get_group_id()) ||
5482 5482
                         api_is_allowed_in_course()
@@ -5485,10 +5485,10 @@  discard block
 block discarded – undo
5485 5485
                     } else {
5486 5486
                         self::setMessage(Display::display_normal_message(get_lang('WikiStandBy'), false, true));
5487 5487
                     }
5488
-                } elseif (self::check_addnewpagelock()==0 && (api_is_allowed_to_edit(false, true)==false || api_is_platform_admin()==false)) {
5488
+                } elseif (self::check_addnewpagelock() == 0 && (api_is_allowed_to_edit(false, true) == false || api_is_platform_admin() == false)) {
5489 5489
                     self::setMessage(Display::display_error_message(get_lang('AddPagesLocked'), false, true));
5490 5490
                 } else {
5491
-                    if (api_is_allowed_to_edit(false,true) ||
5491
+                    if (api_is_allowed_to_edit(false, true) ||
5492 5492
                         api_is_platform_admin() ||
5493 5493
                         GroupManager::is_user_in_group(api_get_user_id(), api_get_group_id()) ||
5494 5494
                         $_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   +94 added lines, -94 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'] . "&origin=$origin$count_loop\"" .
104
-            "$class>" . prepare4display($post['post_title']) . "</a></div>";
101
+        $thread_structure .= "<a href=\"viewthread.php?".api_get_cidreq().
102
+            "&forum=".$forumId."&thread=".$threadId.
103
+            "&post=".$post['post_id']."&origin=$origin$count_loop\"".
104
+            "$class>".prepare4display($post['post_title'])."</a></div>";
105 105
         $prev_next_array[] = $post['post_id'];
106 106
     }
107 107
     $count++;
@@ -148,43 +148,43 @@  discard block
 block discarded – undo
148 148
 $class_next = '';
149 149
 
150 150
 // Links
151
-$first_href = $forumUrl . 'viewthread.php?' . api_get_cidreq() .
152
-    '&forum=' . $forumId . '&thread=' . $threadId .
153
-    '&gradebook=' . $gradebook . '&id=1&post=' . $prev_next_array[0];
154
-$last_href 	= $forumUrl . 'viewthread.php?' . api_get_cidreq() .
155
-    '&forum=' . $forumId . '&thread=' . $threadId .
156
-    '&gradebook=' . $gradebook . '&post=' . $prev_next_array[$max-1];
157
-$prev_href	= $forumUrl . 'viewthread.php?' . api_get_cidreq() .
158
-    '&forum=' . $forumId . '&thread=' . $threadId .
159
-    '&gradebook=' . $gradebook . '&post=' . $prev_next_array[$prev_id];
160
-$next_href	= $forumUrl . 'viewthread.php?' . api_get_cidreq() .
161
-    '&forum=' . $forumId . '&thread=' . $threadId .
162
-    '&post=' . $prev_next_array[$next_id];
151
+$first_href = $forumUrl.'viewthread.php?'.api_get_cidreq().
152
+    '&forum='.$forumId.'&thread='.$threadId.
153
+    '&gradebook='.$gradebook.'&id=1&post='.$prev_next_array[0];
154
+$last_href 	= $forumUrl.'viewthread.php?'.api_get_cidreq().
155
+    '&forum='.$forumId.'&thread='.$threadId.
156
+    '&gradebook='.$gradebook.'&post='.$prev_next_array[$max - 1];
157
+$prev_href	= $forumUrl.'viewthread.php?'.api_get_cidreq().
158
+    '&forum='.$forumId.'&thread='.$threadId.
159
+    '&gradebook='.$gradebook.'&post='.$prev_next_array[$prev_id];
160
+$next_href	= $forumUrl.'viewthread.php?'.api_get_cidreq().
161
+    '&forum='.$forumId.'&thread='.$threadId.
162
+    '&post='.$prev_next_array[$next_id];
163 163
 
164 164
 echo '<center style="margin-top: 10px; margin-bottom: 10px;">';
165 165
 // Go to: first and previous
166 166
 if (((int) $current_id) > 0) {
167
-    echo '<a href="' . $first_href . '" ' . $class . ' title=' .
168
-        $first_message . '>' . $first_img . ' ' . $first_message .'</a>';
169
-    echo '<a href="' . $prev_href . '" ' . $class_prev . ' title=' .
170
-        $prev_message . '>' . $prev_img . ' ' . $prev_message . '</a>';
167
+    echo '<a href="'.$first_href.'" '.$class.' title='.
168
+        $first_message.'>'.$first_img.' '.$first_message.'</a>';
169
+    echo '<a href="'.$prev_href.'" '.$class_prev.' title='.
170
+        $prev_message.'>'.$prev_img.' '.$prev_message.'</a>';
171 171
 } else {
172
-    echo '<b><span class="invisible">' .
173
-        $first_img . ' ' . $first_message . '</b></span>';
174
-    echo '<b><span class="invisible">' .
175
-        $prev_img . ' ' . $prev_message . '</b></span>';
172
+    echo '<b><span class="invisible">'.
173
+        $first_img.' '.$first_message.'</b></span>';
174
+    echo '<b><span class="invisible">'.
175
+        $prev_img.' '.$prev_message.'</b></span>';
176 176
 }
177 177
 
178 178
 // Current counter
179
-echo ' [ ' . ($current_id + 1) . ' / ' . $max . ' ] ';
179
+echo ' [ '.($current_id + 1).' / '.$max.' ] ';
180 180
 
181 181
 // Go to: next and last
182 182
 if (($current_id + 1) < $max) {
183
-    echo '<a href="' . $next_href . '" ' . $class_next . ' title=' . $next_message . '>' . $next_message . ' ' . $next_img . '</a>';
184
-    echo '<a href="' . $last_href . '" ' . $class . ' title=' . $last_message . '>' . $last_message . ' ' . $last_img . '</a>';
183
+    echo '<a href="'.$next_href.'" '.$class_next.' title='.$next_message.'>'.$next_message.' '.$next_img.'</a>';
184
+    echo '<a href="'.$last_href.'" '.$class.' title='.$last_message.'>'.$last_message.' '.$last_img.'</a>';
185 185
 } else {
186
-    echo '<b><span class="invisible">' . $next_message . ' ' . $next_img . '</b></span>';
187
-    echo '<b><span class="invisible">' . $last_message . ' ' . $last_img . '</b></span>';
186
+    echo '<b><span class="invisible">'.$next_message.' '.$next_img.'</b></span>';
187
+    echo '<b><span class="invisible">'.$last_message.' '.$last_img.'</b></span>';
188 188
 }
189 189
 echo '</center>';
190 190
 
@@ -218,18 +218,18 @@  discard block
 block discarded – undo
218 218
 }
219 219
 
220 220
 if (api_get_course_setting('allow_user_image_forum')) {
221
-    echo '<br />' . display_user_image($rows[$display_post_id]['user_id'], $name, $origin) . '<br />';
221
+    echo '<br />'.display_user_image($rows[$display_post_id]['user_id'], $name, $origin).'<br />';
222 222
 }
223 223
 echo display_user_link(
224 224
     $rows[$display_post_id]['user_id'],
225 225
     $name,
226 226
     $origin,
227 227
     $username
228
-) . "<br />";
228
+)."<br />";
229 229
 
230 230
 echo api_convert_and_format_date(
231 231
     $rows[$display_post_id]['post_date']
232
-) . '<br /><br />';
232
+).'<br /><br />';
233 233
 // Get attach id
234 234
 $attachment_list = get_attachment($display_post_id);
235 235
 $id_attach = !empty($attachment_list) ? $attachment_list['id'] : '';
@@ -248,16 +248,16 @@  discard block
 block discarded – undo
248 248
     )
249 249
 ) {
250 250
     if ($locked == false) {
251
-        echo "<a href=\"editpost.php?" . api_get_cidreq() .
252
-            "&forum=" . $forumId . "&thread=" . $threadId .
253
-            "&post=" . $rows[$display_post_id]['post_id'] .
254
-            "&id_attach=" . $id_attach . "\">" .
251
+        echo "<a href=\"editpost.php?".api_get_cidreq().
252
+            "&forum=".$forumId."&thread=".$threadId.
253
+            "&post=".$rows[$display_post_id]['post_id'].
254
+            "&id_attach=".$id_attach."\">".
255 255
             Display::return_icon(
256 256
                 'edit.png',
257 257
                 get_lang('Edit'),
258 258
                 array(),
259 259
                 ICON_SIZE_SMALL
260
-            ) . '</a>';
260
+            ).'</a>';
261 261
     }
262 262
 }
263 263
 
@@ -273,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
-            "&origin=" . $origin . "&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
+            "&origin=".$origin."&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&origin=' . $origin . '">' .
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&origin='.$origin.'">'.
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&origin=' . $origin . '">' .
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&origin='.$origin.'">'.
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,24 +428,24 @@  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() . '&origin=' .
441
-                Security::remove_XSS($_GET['origin']) .
442
-                '&action=delete_attach&id_attach=' .
443
-                $attachment['id'] . '&forum=' . $forumId .
444
-                '&thread=' . $threadId .
445
-                '" onclick="javascript:if(!confirm(\'' .
439
+            echo '&nbsp;&nbsp;<a href="'.api_get_self().'?'.
440
+                api_get_cidreq().'&origin='.
441
+                Security::remove_XSS($_GET['origin']).
442
+                '&action=delete_attach&id_attach='.
443
+                $attachment['id'].'&forum='.$forumId.
444
+                '&thread='.$threadId.
445
+                '" onclick="javascript:if(!confirm(\''.
446 446
                 addslashes(api_htmlentities(
447 447
                     get_lang('ConfirmYourChoice'), ENT_QUOTES)
448
-                ) . '\')) return false;">' . Display::return_icon(
448
+                ).'\')) return false;">'.Display::return_icon(
449 449
                     'delete.gif',
450 450
                     get_lang('Delete')
451 451
                 ).'</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.