@@ -37,16 +37,18 @@ discard block |
||
37 | 37 | // converting post vars to get uri |
38 | 38 | $params = ''; |
39 | 39 | $kv = array(); |
40 | - foreach ($_POST as $key => $value) |
|
41 | - if ($key != 'format') |
|
40 | + foreach ($_POST as $key => $value) { |
|
41 | + if ($key != 'format') |
|
42 | 42 | $kv[] = $key.'='.urlencode($value); |
43 | + } |
|
43 | 44 | $query_string = join("&", $kv); |
44 | 45 | die('<a href="reports.php?format=directlink&'.$query_string.'">'.get_lang('ReportTypeLink').'</a>'); |
45 | 46 | } |
46 | 47 | |
47 | 48 | if ($_REQUEST['format'] == 'directlink') { |
48 | - foreach (array('jquery.dataTables.min.js') as $js) |
|
49 | - $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/'.$js.'" type="text/javascript" language="javascript"></script>'."\n"; |
|
49 | + foreach (array('jquery.dataTables.min.js') as $js) { |
|
50 | + $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/'.$js.'" type="text/javascript" language="javascript"></script>'."\n"; |
|
51 | + } |
|
50 | 52 | |
51 | 53 | $htmlCSSXtra[] = 'dataTable.css'; |
52 | 54 | |
@@ -72,9 +74,10 @@ discard block |
||
72 | 74 | // converting post vars to get uri |
73 | 75 | $params = ''; |
74 | 76 | $kv = array(); |
75 | - foreach ($_POST as $key => $value) |
|
76 | - if ($key != 'format') |
|
77 | + foreach ($_POST as $key => $value) { |
|
78 | + if ($key != 'format') |
|
77 | 79 | $kv[] = $key.'='.urlencode($value); |
80 | + } |
|
78 | 81 | $query_string = join("&", $kv); |
79 | 82 | die('<a href="reports.php?format=downloadcsv&'.$query_string.'">'.get_lang('DownloadFile').'</a>'); |
80 | 83 | } else if ($_REQUEST['format'] == 'downloadcsv') { |
@@ -82,8 +85,7 @@ discard block |
||
82 | 85 | header("Pragma: must-revalidate"); |
83 | 86 | header("Cache-Control: must-revalidate"); |
84 | 87 | header("Content-type: application/vnd.ms-excel"); |
85 | - } |
|
86 | - else { |
|
88 | + } else { |
|
87 | 89 | header("Content-type: text/csv"); |
88 | 90 | } |
89 | 91 | $date = date("Y-m-d"); |
@@ -96,10 +98,12 @@ discard block |
||
96 | 98 | |
97 | 99 | if (is_array($reports_template[$_REQUEST['type']])) { |
98 | 100 | $query = $reports_template[$_REQUEST['type']]['getSQL'](); |
99 | - if (! is_array($query)) |
|
100 | - $query = array($query); |
|
101 | - if ($_REQUEST['format'] == 'sql') |
|
102 | - die(var_export($query, true)); |
|
101 | + if (! is_array($query)) { |
|
102 | + $query = array($query); |
|
103 | + } |
|
104 | + if ($_REQUEST['format'] == 'sql') { |
|
105 | + die(var_export($query, true)); |
|
106 | + } |
|
103 | 107 | |
104 | 108 | $result = multiquery_query($query); |
105 | 109 | |
@@ -155,32 +159,35 @@ discard block |
||
155 | 159 | if (substr($columns[$i], -5, 5) != '_link') { |
156 | 160 | $column_islink[$i] = false; |
157 | 161 | echo '<th>'.$columns[$i].'</th>'; |
158 | - } else |
|
159 | - $columns_islink[$i] = true; |
|
162 | + } else { |
|
163 | + $columns_islink[$i] = true; |
|
164 | + } |
|
160 | 165 | } |
161 | 166 | |
162 | 167 | // checking resolving link column id |
163 | 168 | $columns_flip = array_flip($columns); |
164 | 169 | $columns_link = array(); |
165 | - for ($i=0; $i < $nfields; $i++) |
|
166 | - if ($column_islink[$i] == false && array_key_exists($columns[$i].'_link', $columns_flip)) |
|
170 | + for ($i=0; $i < $nfields; $i++) { |
|
171 | + if ($column_islink[$i] == false && array_key_exists($columns[$i].'_link', $columns_flip)) |
|
167 | 172 | $columns_link[$i] = $columns_flip[$columns[$i].'_link']; |
168 | - else |
|
169 | - $columns_link[$i] = ''; |
|
173 | + } |
|
174 | + else { |
|
175 | + $columns_link[$i] = ''; |
|
176 | + } |
|
170 | 177 | echo '</tr></thead><tbody>'; |
171 | 178 | while ($row = multiquery_fetch_row($result)) { |
172 | 179 | echo '<tr>'; |
173 | - for ($i = 0; $i<$nfields; $i++) |
|
174 | - if (!$columns_islink[$i]){ // ignore links |
|
180 | + for ($i = 0; $i<$nfields; $i++) { |
|
181 | + if (!$columns_islink[$i]){ // ignore links |
|
175 | 182 | if ($columns_link[$i] != '') // link is defined |
176 | 183 | if (substr($columns_link[$i],0,10) == 'javascript') { |
177 | 184 | echo '<td><a href="#" onclick="'.$row[$columns_link[$i]].'">'.$row[$i].'</a></td>'; |
178 | - } |
|
179 | - else { |
|
185 | + } |
|
186 | + } else { |
|
180 | 187 | echo '<td><a href="'.$row[$columns_link[$i]].'">'.$row[$i].'</a></td>'; |
181 | - } |
|
182 | - else |
|
183 | - echo '<td>'.$row[$i].'</td>'; |
|
188 | + } else { |
|
189 | + echo '<td>'.$row[$i].'</td>'; |
|
190 | + } |
|
184 | 191 | } |
185 | 192 | echo "</tr>\n"; |
186 | 193 | } |
@@ -206,18 +213,23 @@ discard block |
||
206 | 213 | if (substr($columns[$i], -5, 5) != '_link') { |
207 | 214 | $column_islink[$i] = false; |
208 | 215 | echo csv_escaping($columns[$i]).','; |
209 | - } else |
|
210 | - $columns_islink[$i] = true; |
|
216 | + } else { |
|
217 | + $columns_islink[$i] = true; |
|
218 | + } |
|
211 | 219 | } |
212 | 220 | |
213 | 221 | echo "\n"; |
214 | 222 | while ($row = multiquery_fetch_row($result)) { |
215 | - for ($i = 0; $i<$nfields; $i++) |
|
216 | - if (!$columns_islink[$i]) // ignore links |
|
217 | - echo csv_escaping($row[$i]).','; // fixme |
|
223 | + for ($i = 0; $i<$nfields; $i++) { |
|
224 | + if (!$columns_islink[$i]) // ignore links |
|
225 | + echo csv_escaping($row[$i]).','; |
|
226 | + } |
|
227 | + // fixme |
|
218 | 228 | echo "\n"; |
219 | 229 | } |
220 | -} else die(get_lang('UnknownFormat')); |
|
230 | +} else { |
|
231 | + die(get_lang('UnknownFormat')); |
|
232 | +} |
|
221 | 233 | |
222 | 234 | function csv_escaping($value, $csv_separator = ',') { |
223 | 235 | $value = str_replace('"','""',$value); |
@@ -1878,7 +1878,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -97,9 +97,11 @@ |
||
97 | 97 | echo "\t</tr>\n"; |
98 | 98 | |
99 | 99 | // the main area with the checkboxes or images |
100 | -foreach ($tool_rights as $tool=>$rights) // $tool_rights contains all the possible tools and their rights |
|
100 | +foreach ($tool_rights as $tool=>$rights) { |
|
101 | + // $tool_rights contains all the possible tools and their rights |
|
101 | 102 | { |
102 | 103 | echo "\t<tr>\n"; |
104 | +} |
|
103 | 105 | echo "\t\t<td>\n"; |
104 | 106 | echo get_lang($tool); |
105 | 107 | echo "\t\t</td>\n"; |
@@ -132,24 +132,20 @@ discard block |
||
132 | 132 | { |
133 | 133 | $table=Database::get_course_table(TABLE_PERMISSION_USER); |
134 | 134 | $id_field = 'user_id'; |
135 | - } |
|
136 | - elseif ($content == 'group') |
|
135 | + } elseif ($content == 'group') |
|
137 | 136 | { |
138 | 137 | $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
139 | 138 | $id_field = 'group_id'; |
140 | - } |
|
141 | - elseif ($content == 'role') |
|
139 | + } elseif ($content == 'role') |
|
142 | 140 | { |
143 | 141 | $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
144 | 142 | $id_field = 'role_id'; |
145 | - } |
|
146 | - elseif ($content == 'platform_role') |
|
143 | + } elseif ($content == 'platform_role') |
|
147 | 144 | { |
148 | 145 | $table=Database::get_main_table(TABLE_ROLE_PERMISSION); |
149 | 146 | $id_field = 'role_id'; |
150 | 147 | $course_id_condition = ''; |
151 | - } |
|
152 | - elseif ($content == 'task') |
|
148 | + } elseif ($content == 'task') |
|
153 | 149 | { |
154 | 150 | $table=Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
155 | 151 | $id_field = 'task_id'; |
@@ -162,8 +158,9 @@ discard block |
||
162 | 158 | WHERE $course_id_condition " . $id_field . "='" . Database::escape_string($id) . "'"; |
163 | 159 | $result = Database::query($sql); |
164 | 160 | |
165 | - while($row = Database::fetch_array($result)) |
|
166 | - $currentpermissions[$row['tool']][] = $row['action']; |
|
161 | + while($row = Database::fetch_array($result)) { |
|
162 | + $currentpermissions[$row['tool']][] = $row['action']; |
|
163 | + } |
|
167 | 164 | |
168 | 165 | return $currentpermissions; |
169 | 166 | } |
@@ -321,14 +318,12 @@ discard block |
||
321 | 318 | if ($course_admin) |
322 | 319 | { |
323 | 320 | echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
324 | - } |
|
325 | - else |
|
321 | + } else |
|
326 | 322 | { |
327 | 323 | if (!empty($inherited_permissions) and in_array($permission,$inherited_permissions[$tool])) |
328 | 324 | { |
329 | 325 | echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
330 | - } |
|
331 | - else |
|
326 | + } else |
|
332 | 327 | { |
333 | 328 | if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
334 | 329 | { |
@@ -439,8 +434,7 @@ discard block |
||
439 | 434 | $checked='checked'; |
440 | 435 | $image='checkbox_on2.gif'; |
441 | 436 | $action='revoke'; |
442 | - } |
|
443 | - else |
|
437 | + } else |
|
444 | 438 | { |
445 | 439 | $checked=''; |
446 | 440 | $image='wrong.gif'; |
@@ -140,9 +140,11 @@ discard block |
||
140 | 140 | echo "\t</tr>\n"; |
141 | 141 | |
142 | 142 | // the main area with the checkboxes or images |
143 | -foreach ($tool_rights as $tool=>$rights) // $tool_rights contains all the possible tools and their rights |
|
143 | +foreach ($tool_rights as $tool=>$rights) { |
|
144 | + // $tool_rights contains all the possible tools and their rights |
|
144 | 145 | { |
145 | 146 | echo "\t<tr>\n"; |
147 | +} |
|
146 | 148 | echo "\t\t<td>\n"; |
147 | 149 | if (strstr($tool,'BLOG')) |
148 | 150 | { |
@@ -152,8 +154,7 @@ discard block |
||
152 | 154 | $blog_id = substr($tool,$tmp,strlen($tool)); |
153 | 155 | // Get title |
154 | 156 | echo get_lang('Blog').": ".Blog::get_blog_title($blog_id); |
155 | - } |
|
156 | - else |
|
157 | + } else |
|
157 | 158 | { |
158 | 159 | echo get_lang($tool); |
159 | 160 | } |
@@ -26,8 +26,7 @@ discard block |
||
26 | 26 | $result=Database::query($sql); |
27 | 27 | $role_id=Database::insert_id(); |
28 | 28 | $result_message=store_permissions('role', $role_id); |
29 | - } |
|
30 | - else |
|
29 | + } else |
|
31 | 30 | { |
32 | 31 | $result_message=get_lang('ErrorPleaseGiveRoleName'); |
33 | 32 | } |
@@ -122,9 +121,11 @@ discard block |
||
122 | 121 | echo "\t</tr>\n"; |
123 | 122 | |
124 | 123 | // the main area with the checkboxes or images |
125 | - foreach ($tool_rights as $tool=>$rights) // $tool_rights contains all the possible tools and their rights |
|
124 | + foreach ($tool_rights as $tool=>$rights) { |
|
125 | + // $tool_rights contains all the possible tools and their rights |
|
126 | 126 | { |
127 | 127 | echo "\t<tr>\n"; |
128 | + } |
|
128 | 129 | echo "\t\t<td>\n"; |
129 | 130 | echo get_lang($tool); |
130 | 131 | echo "\t\t</td>\n"; |
@@ -216,9 +217,11 @@ discard block |
||
216 | 217 | echo "\t</tr>\n"; |
217 | 218 | |
218 | 219 | // the main area with the checkboxes or images |
219 | - foreach ($tool_rights as $tool=>$rights) // $tool_rights contains all the possible tools and their rights |
|
220 | + foreach ($tool_rights as $tool=>$rights) { |
|
221 | + // $tool_rights contains all the possible tools and their rights |
|
220 | 222 | { |
221 | 223 | echo "\t<tr>\n"; |
224 | + } |
|
222 | 225 | echo "\t\t<td>\n"; |
223 | 226 | echo get_lang($tool); |
224 | 227 | echo "\t\t</td>\n"; |
@@ -237,8 +240,7 @@ discard block |
||
237 | 240 | if ($_GET['scope']=='platform') |
238 | 241 | { |
239 | 242 | $roles_editable=false; |
240 | - } |
|
241 | - else |
|
243 | + } else |
|
242 | 244 | { |
243 | 245 | $roles_editable=true; |
244 | 246 | } |
@@ -58,19 +58,22 @@ discard block |
||
58 | 58 | list($ip1, $ip2) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); |
59 | 59 | $ip = trim($ip1); |
60 | 60 | } |
61 | - if ($debug) |
|
62 | - error_log("ip: $ip"); |
|
61 | + if ($debug) { |
|
62 | + error_log("ip: $ip"); |
|
63 | + } |
|
63 | 64 | // Check if a file that limits access from webservices exists and contains |
64 | 65 | // the restraining check |
65 | 66 | if (is_file('webservice-auth-ip.conf.php')) { |
66 | 67 | include 'webservice-auth-ip.conf.php'; |
67 | - if ($debug) |
|
68 | - error_log("webservice-auth-ip.conf.php file included"); |
|
68 | + if ($debug) { |
|
69 | + error_log("webservice-auth-ip.conf.php file included"); |
|
70 | + } |
|
69 | 71 | if (!empty($ws_auth_ip)) { |
70 | 72 | $check_ip = true; |
71 | 73 | $ip_matches = api_check_ip_in_range($ip, $ws_auth_ip); |
72 | - if ($debug) |
|
73 | - error_log("ip_matches: $ip_matches"); |
|
74 | + if ($debug) { |
|
75 | + error_log("ip_matches: $ip_matches"); |
|
76 | + } |
|
74 | 77 | } |
75 | 78 | } |
76 | 79 | |
@@ -87,8 +90,9 @@ discard block |
||
87 | 90 | |
88 | 91 | $result = api_is_valid_secret_key($secret_key, $security_key); |
89 | 92 | //error_log($secret_key.'-'.$security_key); |
90 | - if ($debug) |
|
91 | - error_log('WSHelperVerifyKey result: '.intval($result)); |
|
93 | + if ($debug) { |
|
94 | + error_log('WSHelperVerifyKey result: '.intval($result)); |
|
95 | + } |
|
92 | 96 | return $result; |
93 | 97 | } |
94 | 98 |
@@ -48,19 +48,22 @@ discard block |
||
48 | 48 | list($ip1, $ip2) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); |
49 | 49 | $ip = trim($ip1); |
50 | 50 | } |
51 | - if ($debug) |
|
52 | - error_log("ip: $ip"); |
|
51 | + if ($debug) { |
|
52 | + error_log("ip: $ip"); |
|
53 | + } |
|
53 | 54 | // Check if a file that limits access from webservices exists and contains |
54 | 55 | // the restraining check |
55 | 56 | if (is_file('webservice-auth-ip.conf.php')) { |
56 | 57 | include 'webservice-auth-ip.conf.php'; |
57 | - if ($debug) |
|
58 | - error_log("webservice-auth-ip.conf.php file included"); |
|
58 | + if ($debug) { |
|
59 | + error_log("webservice-auth-ip.conf.php file included"); |
|
60 | + } |
|
59 | 61 | if (!empty($ws_auth_ip)) { |
60 | 62 | $check_ip = true; |
61 | 63 | $ip_matches = api_check_ip_in_range($ip, $ws_auth_ip); |
62 | - if ($debug) |
|
63 | - error_log("ip_matches: $ip_matches"); |
|
64 | + if ($debug) { |
|
65 | + error_log("ip_matches: $ip_matches"); |
|
66 | + } |
|
64 | 67 | } |
65 | 68 | } |
66 | 69 | |
@@ -76,8 +79,9 @@ discard block |
||
76 | 79 | } |
77 | 80 | $result = api_is_valid_secret_key($secret_key, $security_key); |
78 | 81 | //error_log($secret_key.'-'.$security_key); |
79 | - if ($debug) |
|
80 | - error_log('WSHelperVerifyKey result: '.intval($result)); |
|
82 | + if ($debug) { |
|
83 | + error_log('WSHelperVerifyKey result: '.intval($result)); |
|
84 | + } |
|
81 | 85 | return $result; |
82 | 86 | } |
83 | 87 | |
@@ -140,7 +144,9 @@ discard block |
||
140 | 144 | if (!WSHelperVerifyKey($params)) { |
141 | 145 | return return_error(WS_ERROR_SECRET_KEY); |
142 | 146 | } |
143 | - if ($debug) error_log('WSImportLP'); |
|
147 | + if ($debug) { |
|
148 | + error_log('WSImportLP'); |
|
149 | + } |
|
144 | 150 | |
145 | 151 | $courseIdName = $params['course_id_name']; |
146 | 152 | $courseIdValue = $params['course_id_value']; |
@@ -156,7 +162,9 @@ discard block |
||
156 | 162 | $courseId = $courseInfo['real_id']; |
157 | 163 | |
158 | 164 | if (empty($courseInfo)) { |
159 | - if ($debug) error_log('Course not found'); |
|
165 | + if ($debug) { |
|
166 | + error_log('Course not found'); |
|
167 | + } |
|
160 | 168 | return 'Course not found'; |
161 | 169 | } |
162 | 170 | |
@@ -169,7 +177,9 @@ discard block |
||
169 | 177 | |
170 | 178 | if (empty($sessionId)) { |
171 | 179 | |
172 | - if ($debug) error_log('Session not found'); |
|
180 | + if ($debug) { |
|
181 | + error_log('Session not found'); |
|
182 | + } |
|
173 | 183 | return 'Session not found'; |
174 | 184 | } |
175 | 185 | } |
@@ -196,7 +206,9 @@ discard block |
||
196 | 206 | $manifest = $oScorm->import_package($fileInfo, '', $courseInfo); |
197 | 207 | |
198 | 208 | if (!$manifest) { |
199 | - if ($debug) error_log('manifest.xml file not found'); |
|
209 | + if ($debug) { |
|
210 | + error_log('manifest.xml file not found'); |
|
211 | + } |
|
200 | 212 | //if api_set_failure |
201 | 213 | return 'manifest.xml file not found'; |
202 | 214 | } |
@@ -215,10 +227,14 @@ discard block |
||
215 | 227 | $oScorm->set_maker($maker, $courseId); |
216 | 228 | //$oScorm->set_jslib('scorm_api.php'); |
217 | 229 | |
218 | - if ($debug) error_log('scorm was added'); |
|
230 | + if ($debug) { |
|
231 | + error_log('scorm was added'); |
|
232 | + } |
|
219 | 233 | return 1; |
220 | 234 | } else { |
221 | - if ($debug) error_log('manifest data empty'); |
|
235 | + if ($debug) { |
|
236 | + error_log('manifest data empty'); |
|
237 | + } |
|
222 | 238 | return 'manifest data empty'; |
223 | 239 | } |
224 | 240 | } |
@@ -311,7 +327,9 @@ discard block |
||
311 | 327 | ); |
312 | 328 | |
313 | 329 | if (empty($courseInfo)) { |
314 | - if ($debug) error_log("Course not found: $courseIdName : $courseIdValue"); |
|
330 | + if ($debug) { |
|
331 | + error_log("Course not found: $courseIdName : $courseIdValue"); |
|
332 | + } |
|
315 | 333 | return 'Course not found'; |
316 | 334 | } |
317 | 335 | |
@@ -326,7 +344,9 @@ discard block |
||
326 | 344 | |
327 | 345 | if (empty($sessionId)) { |
328 | 346 | |
329 | - if ($debug) error_log('Session not found'); |
|
347 | + if ($debug) { |
|
348 | + error_log('Session not found'); |
|
349 | + } |
|
330 | 350 | return 'Session not found'; |
331 | 351 | } |
332 | 352 | } |
@@ -407,7 +427,9 @@ discard block |
||
407 | 427 | ); |
408 | 428 | |
409 | 429 | if (empty($courseInfo)) { |
410 | - if ($debug) error_log("Course not found: $courseIdName : $courseIdValue"); |
|
430 | + if ($debug) { |
|
431 | + error_log("Course not found: $courseIdName : $courseIdValue"); |
|
432 | + } |
|
411 | 433 | return 'Course not found'; |
412 | 434 | } |
413 | 435 | $courseId = $courseInfo['real_id']; |
@@ -432,7 +454,9 @@ discard block |
||
432 | 454 | |
433 | 455 | $lp = new learnpath($courseCode, $lpId, null); |
434 | 456 | if ($lp) { |
435 | - if ($debug) error_log("LP deleted $lpId"); |
|
457 | + if ($debug) { |
|
458 | + error_log("LP deleted $lpId"); |
|
459 | + } |
|
436 | 460 | |
437 | 461 | $course_dir = $courseInfo['directory'] . '/document'; |
438 | 462 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
@@ -448,7 +472,9 @@ discard block |
||
448 | 472 | if ($item) { |
449 | 473 | $documentId = $item->get_path(); |
450 | 474 | |
451 | - if ($debug) error_log("lp item id found #$itemId"); |
|
475 | + if ($debug) { |
|
476 | + error_log("lp item id found #$itemId"); |
|
477 | + } |
|
452 | 478 | |
453 | 479 | $documentInfo = DocumentManager::get_document_data_by_id( |
454 | 480 | $documentId, |
@@ -474,7 +500,9 @@ discard block |
||
474 | 500 | } |
475 | 501 | } |
476 | 502 | } else { |
477 | - if ($debug) error_log("Document not found #$itemId"); |
|
503 | + if ($debug) { |
|
504 | + error_log("Document not found #$itemId"); |
|
505 | + } |
|
478 | 506 | } |
479 | 507 | } |
480 | 508 | } |
@@ -32,8 +32,9 @@ discard block |
||
32 | 32 | } |
33 | 33 | } |
34 | 34 | return $foruns_id; |
35 | - } else |
|
36 | - return get_lang('InvalidId'); |
|
35 | + } else { |
|
36 | + return get_lang('InvalidId'); |
|
37 | + } |
|
37 | 38 | } |
38 | 39 | |
39 | 40 | public function get_forum_title($username, $password, $course_code, $forum_id) |
@@ -54,8 +55,9 @@ discard block |
||
54 | 55 | |
55 | 56 | $forum_title = utf8_decode($forum_info['forum_title']); |
56 | 57 | return $forum_title; |
57 | - } else |
|
58 | - return get_lang('InvalidId'); |
|
58 | + } else { |
|
59 | + return get_lang('InvalidId'); |
|
60 | + } |
|
59 | 61 | } |
60 | 62 | |
61 | 63 | public function get_forum_threads_id($username, $password, $course_code, $forum_id) |
@@ -73,8 +75,9 @@ discard block |
||
73 | 75 | |
74 | 76 | return $threads_id; |
75 | 77 | |
76 | - } else |
|
77 | - return get_lang('InvalidId'); |
|
78 | + } else { |
|
79 | + return get_lang('InvalidId'); |
|
80 | + } |
|
78 | 81 | } |
79 | 82 | |
80 | 83 | public function get_forum_thread_data($username, $password, $course_code, $thread_id, $field) |
@@ -115,8 +118,9 @@ discard block |
||
115 | 118 | |
116 | 119 | return $thread_info[$field_table]; |
117 | 120 | |
118 | - } else |
|
119 | - return get_lang('InvalidId'); |
|
121 | + } else { |
|
122 | + return get_lang('InvalidId'); |
|
123 | + } |
|
120 | 124 | } |
121 | 125 | |
122 | 126 | public function get_forum_thread_title($username, $password, $course_code, $thread_id) |
@@ -139,8 +143,9 @@ discard block |
||
139 | 143 | |
140 | 144 | return $thread_info[$field_table]; |
141 | 145 | |
142 | - } else |
|
143 | - return get_lang('InvalidId'); |
|
146 | + } else { |
|
147 | + return get_lang('InvalidId'); |
|
148 | + } |
|
144 | 149 | } |
145 | 150 | |
146 | 151 | |
@@ -184,8 +189,9 @@ discard block |
||
184 | 189 | } |
185 | 190 | } |
186 | 191 | return $posts_id; |
187 | - } else |
|
188 | - return get_lang('InvalidId'); |
|
192 | + } else { |
|
193 | + return get_lang('InvalidId'); |
|
194 | + } |
|
189 | 195 | } |
190 | 196 | |
191 | 197 | public function get_post_data($username, $password, $course_code, $post_id, $field) |
@@ -226,8 +232,9 @@ discard block |
||
226 | 232 | $field_table = "title"; |
227 | 233 | } |
228 | 234 | return (htmlcode) ? html_entity_decode($post_info[$field_table]) : $post_info[$field_table]; |
229 | - } else |
|
230 | - return get_lang('InvalidId'); |
|
235 | + } else { |
|
236 | + return get_lang('InvalidId'); |
|
237 | + } |
|
231 | 238 | } |
232 | 239 | |
233 | 240 | public function send_post($username, $password, $course_code, $forum_id, $thread_id, $title, $content) |
@@ -269,8 +276,9 @@ discard block |
||
269 | 276 | |
270 | 277 | //send_notification_mails($thread_id, $values); |
271 | 278 | |
272 | - } else |
|
273 | - return get_lang('InvalidId'); |
|
279 | + } else { |
|
280 | + return get_lang('InvalidId'); |
|
281 | + } |
|
274 | 282 | |
275 | 283 | } |
276 | 284 |