@@ -317,7 +317,10 @@ discard block |
||
317 | 317 | <td width="40%" align="center"> |
318 | 318 | <select name="UserList[]" multiple="multiple" size="20" style="width:300px;"> |
319 | 319 | <?php foreach ($db_users as $user) { ?> |
320 | - <option value="<?php echo $user['user_id']; ?>" <?php if(in_array($user['user_id'],$users)) echo 'selected="selected"'; ?>> |
|
320 | + <option value="<?php echo $user['user_id']; ?>" <?php if(in_array($user['user_id'],$users)) { |
|
321 | + echo 'selected="selected"'; |
|
322 | +} |
|
323 | +?>> |
|
321 | 324 | <?php |
322 | 325 | $userName = $user['lastname'].' '.$user['firstname'].' ('.$user['username'].')'; |
323 | 326 | if ($showOfficialCode) { |
@@ -338,7 +341,10 @@ discard block |
||
338 | 341 | <td width="40%" align="center"> |
339 | 342 | <select name="CourseList[]" multiple="multiple" size="20" style="width:300px;"> |
340 | 343 | <?php foreach ($db_courses as $course) { ?> |
341 | - <option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) echo 'selected="selected"'; ?>> |
|
344 | + <option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) { |
|
345 | + echo 'selected="selected"'; |
|
346 | +} |
|
347 | +?>> |
|
342 | 348 | <?php echo '('.$course['visual_code'].') '.$course['title']; ?> |
343 | 349 | </option> |
344 | 350 | <?php } ?> |
@@ -3885,8 +3885,9 @@ discard block |
||
3885 | 3885 | WHERE c_id = $course_id |
3886 | 3886 | ORDER BY display_order"; |
3887 | 3887 | $res = Database::query($sql); |
3888 | - if ($res === false) |
|
3889 | - return false; |
|
3888 | + if ($res === false) { |
|
3889 | + return false; |
|
3890 | + } |
|
3890 | 3891 | $lps = array (); |
3891 | 3892 | $lp_order = array(); |
3892 | 3893 | $num = Database :: num_rows($res); |
@@ -4491,8 +4492,9 @@ discard block |
||
4491 | 4492 | if ($this->debug > 0) { |
4492 | 4493 | error_log('New LP - In learnpath::set_maker()', 0); |
4493 | 4494 | } |
4494 | - if (empty ($name)) |
|
4495 | - return false; |
|
4495 | + if (empty ($name)) { |
|
4496 | + return false; |
|
4497 | + } |
|
4496 | 4498 | $this->maker = $name; |
4497 | 4499 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4498 | 4500 | $course_id = api_get_course_int_id(); |
@@ -4557,8 +4559,9 @@ discard block |
||
4557 | 4559 | public function set_terms_by_prefix($terms_string, $prefix) |
4558 | 4560 | { |
4559 | 4561 | $course_id = api_get_course_int_id(); |
4560 | - if (api_get_setting('search_enabled') !== 'true') |
|
4561 | - return false; |
|
4562 | + if (api_get_setting('search_enabled') !== 'true') { |
|
4563 | + return false; |
|
4564 | + } |
|
4562 | 4565 | |
4563 | 4566 | if (!extension_loaded('xapian')) { |
4564 | 4567 | return false; |
@@ -4571,8 +4574,9 @@ discard block |
||
4571 | 4574 | $stored_terms = $this->get_common_index_terms_by_prefix($prefix); |
4572 | 4575 | |
4573 | 4576 | // Don't do anything if no change, verify only at DB, not the search engine. |
4574 | - if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) |
|
4575 | - return false; |
|
4577 | + if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) { |
|
4578 | + return false; |
|
4579 | + } |
|
4576 | 4580 | |
4577 | 4581 | require_once 'xapian.php'; // TODO: Try catch every xapian use or make wrappers on API. |
4578 | 4582 | require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'; |
@@ -4764,8 +4768,9 @@ discard block |
||
4764 | 4768 | if ($this->debug > 0) { |
4765 | 4769 | error_log('New LP - In learnpath::set_proximity()', 0); |
4766 | 4770 | } |
4767 | - if (empty ($name)) |
|
4768 | - return false; |
|
4771 | + if (empty ($name)) { |
|
4772 | + return false; |
|
4773 | + } |
|
4769 | 4774 | |
4770 | 4775 | $this->proximity = $name; |
4771 | 4776 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
@@ -5109,8 +5114,9 @@ discard block |
||
5109 | 5114 | |
5110 | 5115 | $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." ORDER BY display_order"; |
5111 | 5116 | $res = Database::query($sql); |
5112 | - if ($res === false) |
|
5113 | - return false; |
|
5117 | + if ($res === false) { |
|
5118 | + return false; |
|
5119 | + } |
|
5114 | 5120 | |
5115 | 5121 | $num = Database :: num_rows($res); |
5116 | 5122 | // First check the order is correct, globally (might be wrong because |
@@ -5421,8 +5427,9 @@ discard block |
||
5421 | 5427 | $position[$key] = $row['display_order']; |
5422 | 5428 | } |
5423 | 5429 | |
5424 | - if (count($array) > 0) |
|
5425 | - array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array); |
|
5430 | + if (count($array) > 0) { |
|
5431 | + array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array); |
|
5432 | + } |
|
5426 | 5433 | |
5427 | 5434 | return $array; |
5428 | 5435 | } |
@@ -6200,10 +6207,12 @@ discard block |
||
6200 | 6207 | if ($new_comment || $new_title) { |
6201 | 6208 | $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); |
6202 | 6209 | $ct = ''; |
6203 | - if ($new_comment) |
|
6204 | - $ct .= ", comment='" . Database::escape_string($new_comment). "'"; |
|
6205 | - if ($new_title) |
|
6206 | - $ct .= ", title='" . Database::escape_string($new_title)."' "; |
|
6210 | + if ($new_comment) { |
|
6211 | + $ct .= ", comment='" . Database::escape_string($new_comment). "'"; |
|
6212 | + } |
|
6213 | + if ($new_title) { |
|
6214 | + $ct .= ", title='" . Database::escape_string($new_title)."' "; |
|
6215 | + } |
|
6207 | 6216 | |
6208 | 6217 | $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)." |
6209 | 6218 | WHERE c_id = ".$course_id." AND id = " . $document_id; |
@@ -6227,17 +6236,21 @@ discard block |
||
6227 | 6236 | // Please, do not modify this dirname formatting. |
6228 | 6237 | $dir = isset($_GET['dir']) ? $_GET['dir'] : $_POST['dir']; |
6229 | 6238 | |
6230 | - if (strstr($dir, '..')) |
|
6231 | - $dir = '/'; |
|
6239 | + if (strstr($dir, '..')) { |
|
6240 | + $dir = '/'; |
|
6241 | + } |
|
6232 | 6242 | |
6233 | - if ($dir[0] == '.') |
|
6234 | - $dir = substr($dir, 1); |
|
6243 | + if ($dir[0] == '.') { |
|
6244 | + $dir = substr($dir, 1); |
|
6245 | + } |
|
6235 | 6246 | |
6236 | - if ($dir[0] != '/') |
|
6237 | - $dir = '/' . $dir; |
|
6247 | + if ($dir[0] != '/') { |
|
6248 | + $dir = '/' . $dir; |
|
6249 | + } |
|
6238 | 6250 | |
6239 | - if ($dir[strlen($dir) - 1] != '/') |
|
6240 | - $dir .= '/'; |
|
6251 | + if ($dir[strlen($dir) - 1] != '/') { |
|
6252 | + $dir .= '/'; |
|
6253 | + } |
|
6241 | 6254 | |
6242 | 6255 | $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir; |
6243 | 6256 | |
@@ -6304,8 +6317,9 @@ discard block |
||
6304 | 6317 | } |
6305 | 6318 | $return .= '<div style="padding:10px;">'; |
6306 | 6319 | |
6307 | - if ($msg != '') |
|
6308 | - $return .= $msg; |
|
6320 | + if ($msg != '') { |
|
6321 | + $return .= $msg; |
|
6322 | + } |
|
6309 | 6323 | |
6310 | 6324 | $return .= '<h3>'.$row['title'].'</h3>'; |
6311 | 6325 | switch ($row['item_type']) { |
@@ -6584,10 +6598,11 @@ discard block |
||
6584 | 6598 | $item_title = Security::remove_XSS($item_title); |
6585 | 6599 | $item_description = Security::remove_XSS($item_description); |
6586 | 6600 | |
6587 | - if ($id != 0 && is_array($extra_info)) |
|
6588 | - $parent = $extra_info['parent_item_id']; |
|
6589 | - else |
|
6590 | - $parent = 0; |
|
6601 | + if ($id != 0 && is_array($extra_info)) { |
|
6602 | + $parent = $extra_info['parent_item_id']; |
|
6603 | + } else { |
|
6604 | + $parent = 0; |
|
6605 | + } |
|
6591 | 6606 | |
6592 | 6607 | $sql = "SELECT * FROM " . $tbl_lp_item . " |
6593 | 6608 | WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
@@ -6887,8 +6902,9 @@ discard block |
||
6887 | 6902 | $arrHide[] = $arrLP[$i]['id']; |
6888 | 6903 | } |
6889 | 6904 | } else { |
6890 | - if ($arrLP[$i]['item_type'] == 'dir') |
|
6891 | - $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
6905 | + if ($arrLP[$i]['item_type'] == 'dir') { |
|
6906 | + $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
6907 | + } |
|
6892 | 6908 | } |
6893 | 6909 | } |
6894 | 6910 | reset($arrLP); |
@@ -6905,11 +6921,13 @@ discard block |
||
6905 | 6921 | |
6906 | 6922 | for ($i = 0; $i < count($arrLP); $i++) { |
6907 | 6923 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
6908 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
6924 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
6925 | + $selected = 'selected="selected" '; |
|
6926 | + } elseif ($action == 'add') { |
|
6909 | 6927 | $selected = 'selected="selected" '; |
6910 | - elseif ($action == 'add') $selected = 'selected="selected" '; |
|
6911 | - else |
|
6912 | - $selected = ''; |
|
6928 | + } else { |
|
6929 | + $selected = ''; |
|
6930 | + } |
|
6913 | 6931 | |
6914 | 6932 | $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>'; |
6915 | 6933 | } |
@@ -6936,9 +6954,11 @@ discard block |
||
6936 | 6954 | $arrHide = array (); |
6937 | 6955 | for ($i = 0; $i < count($arrLP); $i++) { |
6938 | 6956 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
6939 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
6940 | - $s_selected_position = $arrLP[$i]['id']; |
|
6941 | - elseif ($action == 'add') $s_selected_position = 0; |
|
6957 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
6958 | + $s_selected_position = $arrLP[$i]['id']; |
|
6959 | + } elseif ($action == 'add') { |
|
6960 | + $s_selected_position = 0; |
|
6961 | + } |
|
6942 | 6962 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
6943 | 6963 | } |
6944 | 6964 | } |
@@ -7131,9 +7151,11 @@ discard block |
||
7131 | 7151 | $arrHide = array(); |
7132 | 7152 | for ($i = 0; $i < count($arrLP); $i++) { |
7133 | 7153 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
7134 | - if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
7135 | - $s_selected_position = $arrLP[$i]['id']; |
|
7136 | - elseif ($action == 'add') $s_selected_position = 0; |
|
7154 | + if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7155 | + $s_selected_position = $arrLP[$i]['id']; |
|
7156 | + } elseif ($action == 'add') { |
|
7157 | + $s_selected_position = 0; |
|
7158 | + } |
|
7137 | 7159 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
7138 | 7160 | } |
7139 | 7161 | } |
@@ -7328,9 +7350,11 @@ discard block |
||
7328 | 7350 | |
7329 | 7351 | for ($i = 0; $i < count($arrLP); $i++) { |
7330 | 7352 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
7331 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
7332 | - $s_selected_position = $arrLP[$i]['id']; |
|
7333 | - elseif ($action == 'add') $s_selected_position = 0; |
|
7353 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7354 | + $s_selected_position = $arrLP[$i]['id']; |
|
7355 | + } elseif ($action == 'add') { |
|
7356 | + $s_selected_position = 0; |
|
7357 | + } |
|
7334 | 7358 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
7335 | 7359 | |
7336 | 7360 | } |
@@ -7364,8 +7388,7 @@ discard block |
||
7364 | 7388 | |
7365 | 7389 | if (is_numeric($extra_info)) { |
7366 | 7390 | $form->addHidden('path', $extra_info); |
7367 | - } |
|
7368 | - elseif (is_array($extra_info)) { |
|
7391 | + } elseif (is_array($extra_info)) { |
|
7369 | 7392 | $form->addHidden('path', $extra_info['path']); |
7370 | 7393 | } |
7371 | 7394 | |
@@ -7418,8 +7441,9 @@ discard block |
||
7418 | 7441 | lp_id = " . $this->lp_id . " AND |
7419 | 7442 | id != $id"; |
7420 | 7443 | |
7421 | - if ($item_type == 'dir') |
|
7422 | - $sql .= " AND parent_item_id = 0"; |
|
7444 | + if ($item_type == 'dir') { |
|
7445 | + $sql .= " AND parent_item_id = 0"; |
|
7446 | + } |
|
7423 | 7447 | |
7424 | 7448 | $result = Database::query($sql); |
7425 | 7449 | $arrLP = array (); |
@@ -7816,9 +7840,11 @@ discard block |
||
7816 | 7840 | $arrHide = array(); |
7817 | 7841 | for ($i = 0; $i < count($arrLP); $i++) { |
7818 | 7842 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir' && $arrLP[$i]['item_type'] !== TOOL_LP_FINAL_ITEM) { |
7819 | - if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
7843 | + if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7844 | + $s_selected_position = $arrLP[$i]['id']; |
|
7845 | + } elseif ($action == 'add') { |
|
7820 | 7846 | $s_selected_position = $arrLP[$i]['id']; |
7821 | - elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id']; |
|
7847 | + } |
|
7822 | 7848 | |
7823 | 7849 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
7824 | 7850 | |
@@ -7829,17 +7855,18 @@ discard block |
||
7829 | 7855 | $item_type = isset($extra_info['item_type']) ? $extra_info['item_type'] : null; |
7830 | 7856 | $edit = isset($_GET['edit']) ? $_GET['edit'] : null; |
7831 | 7857 | if (($extra_info == 'new' || $item_type == TOOL_DOCUMENT || $item_type == TOOL_LP_FINAL_ITEM || $edit == 'true')) { |
7832 | - if (isset ($_POST['content'])) |
|
7833 | - $content = stripslashes($_POST['content']); |
|
7834 | - elseif (is_array($extra_info)) { |
|
7858 | + if (isset ($_POST['content'])) { |
|
7859 | + $content = stripslashes($_POST['content']); |
|
7860 | + } elseif (is_array($extra_info)) { |
|
7835 | 7861 | //If it's an html document or a text file |
7836 | 7862 | if (!$no_display_edit_textarea) { |
7837 | 7863 | $content = $this->display_document($extra_info['path'], false, false); |
7838 | 7864 | } |
7839 | - } elseif (is_numeric($extra_info)) |
|
7840 | - $content = $this->display_document($extra_info, false, false); |
|
7841 | - else |
|
7842 | - $content = ''; |
|
7865 | + } elseif (is_numeric($extra_info)) { |
|
7866 | + $content = $this->display_document($extra_info, false, false); |
|
7867 | + } else { |
|
7868 | + $content = ''; |
|
7869 | + } |
|
7843 | 7870 | |
7844 | 7871 | if (!$no_display_edit_textarea) { |
7845 | 7872 | // We need to calculate here some specific settings for the online editor. |
@@ -8103,9 +8130,11 @@ discard block |
||
8103 | 8130 | $arrHide = array(); |
8104 | 8131 | for ($i = 0; $i < count($arrLP); $i++) { |
8105 | 8132 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
8106 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
8107 | - $s_selected_position = $arrLP[$i]['id']; |
|
8108 | - elseif ($action == 'add') $s_selected_position = 0; |
|
8133 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
8134 | + $s_selected_position = $arrLP[$i]['id']; |
|
8135 | + } elseif ($action == 'add') { |
|
8136 | + $s_selected_position = 0; |
|
8137 | + } |
|
8109 | 8138 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
8110 | 8139 | |
8111 | 8140 | } |
@@ -8299,9 +8328,11 @@ discard block |
||
8299 | 8328 | $arrHide = array (); |
8300 | 8329 | for ($i = 0; $i < count($arrLP); $i++) { |
8301 | 8330 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
8302 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
8303 | - $s_selected_position = $arrLP[$i]['id']; |
|
8304 | - elseif ($action == 'add') $s_selected_position = 0; |
|
8331 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
8332 | + $s_selected_position = $arrLP[$i]['id']; |
|
8333 | + } elseif ($action == 'add') { |
|
8334 | + $s_selected_position = 0; |
|
8335 | + } |
|
8305 | 8336 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
8306 | 8337 | |
8307 | 8338 | } |
@@ -9377,10 +9408,11 @@ discard block |
||
9377 | 9408 | |
9378 | 9409 | // Dependency to other files - not yet supported. |
9379 | 9410 | $i = 1; |
9380 | - if ($inc_docs) |
|
9381 | - foreach ($inc_docs as $doc_info) { |
|
9411 | + if ($inc_docs) { |
|
9412 | + foreach ($inc_docs as $doc_info) { |
|
9382 | 9413 | if (count($doc_info) < 1 || empty($doc_info[0])) { |
9383 | 9414 | continue; |
9415 | + } |
|
9384 | 9416 | } |
9385 | 9417 | $my_dep = $xmldoc->createElement('resource'); |
9386 | 9418 | $res_id = 'RESOURCE_'.$item->get_id().'_'.$i; |