@@ -89,7 +89,7 @@ |
||
89 | 89 | 'error' |
90 | 90 | ) |
91 | 91 | ); |
92 | - exit; |
|
92 | + exit; |
|
93 | 93 | } else { |
94 | 94 | /* DOWNLOAD THE FILE */ |
95 | 95 | // the user is allowed to download the file |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | if ($_GET['sent_received'] == 'sent') { |
33 | 33 | // here we also incorporate the person table to make sure that deleted sent documents are not included. |
34 | 34 | $sql = "SELECT DISTINCT file.id, file.filename, file.title |
35 | - FROM ". Database::get_course_table(TABLE_DROPBOX_FILE) ." file |
|
36 | - INNER JOIN ". Database::get_course_table(TABLE_DROPBOX_PERSON) ." person |
|
35 | + FROM ". Database::get_course_table(TABLE_DROPBOX_FILE)." file |
|
36 | + INNER JOIN ". Database::get_course_table(TABLE_DROPBOX_PERSON)." person |
|
37 | 37 | ON (person.file_id=file.id AND file.c_id = $course_id AND person.c_id = $course_id) |
38 | 38 | WHERE |
39 | 39 | file.uploader_id = $user_id AND |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | |
44 | 44 | if ($_GET['sent_received'] == 'received') { |
45 | 45 | $sql = "SELECT DISTINCT file.id, file.filename, file.title |
46 | - FROM ". Database::get_course_table(TABLE_DROPBOX_FILE) ." file |
|
47 | - INNER JOIN ". Database::get_course_table(TABLE_DROPBOX_PERSON) ." person |
|
46 | + FROM ". Database::get_course_table(TABLE_DROPBOX_FILE)." file |
|
47 | + INNER JOIN ". Database::get_course_table(TABLE_DROPBOX_PERSON)." person |
|
48 | 48 | ON (person.file_id=file.id AND file.c_id = $course_id AND person.c_id = $course_id) |
49 | 49 | INNER JOIN ".Database::get_course_table(TABLE_DROPBOX_POST)." post |
50 | 50 | ON (post.file_id = file.id AND post.c_id = $course_id AND file.c_id = $course_id) |
51 | 51 | WHERE |
52 | 52 | post.cat_id = ".intval($_GET['cat_id'])." AND |
53 | - post.dest_user_id = $user_id" ; |
|
53 | + post.dest_user_id = $user_id"; |
|
54 | 54 | } |
55 | 55 | $files_to_download = array(); |
56 | 56 | $result = Database::query($sql); |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | |
98 | 98 | $work = new Dropbox_Work($_GET['id']); |
99 | 99 | |
100 | - $path = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/dropbox/' . $work -> filename; //path to file as stored on server |
|
100 | + $path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/dropbox/'.$work -> filename; //path to file as stored on server |
|
101 | 101 | |
102 | - if (!Security::check_abs_path($path, api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/dropbox/')) { |
|
102 | + if (!Security::check_abs_path($path, api_get_path(SYS_COURSE_PATH).$_course['path'].'/dropbox/')) { |
|
103 | 103 | exit; |
104 | 104 | } |
105 | 105 | $file = $work->title; |
@@ -83,11 +83,11 @@ |
||
83 | 83 | if (strstr($_POST['action'], 'move_')) { |
84 | 84 | // check move_received_n or move_sent_n command |
85 | 85 | if (strstr($_POST['action'], 'received')) { |
86 | - $part = 'received'; |
|
87 | - $to_cat_id = str_replace('move_received_', '', $_POST['action']); |
|
86 | + $part = 'received'; |
|
87 | + $to_cat_id = str_replace('move_received_', '', $_POST['action']); |
|
88 | 88 | } else { |
89 | - $part = 'sent'; |
|
90 | - $to_cat_id = str_replace('move_sent_', '', $_POST['action']); |
|
89 | + $part = 'sent'; |
|
90 | + $to_cat_id = str_replace('move_sent_', '', $_POST['action']); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | foreach ($checked_file_ids as $value) { |
@@ -750,10 +750,15 @@ |
||
750 | 750 | "; |
751 | 751 | $result = Database::query($sql); |
752 | 752 | |
753 | - if (!($res = Database::fetch_array($result))) |
|
754 | - die(get_lang('GeneralError').' (code 901)'); |
|
755 | - if ($owner == 0) return $res['uploader_id']; |
|
756 | - if ($res['uploader_id'] == $owner) return true; |
|
753 | + if (!($res = Database::fetch_array($result))) { |
|
754 | + die(get_lang('GeneralError').' (code 901)'); |
|
755 | + } |
|
756 | + if ($owner == 0) { |
|
757 | + return $res['uploader_id']; |
|
758 | + } |
|
759 | + if ($res['uploader_id'] == $owner) { |
|
760 | + return true; |
|
761 | + } |
|
757 | 762 | die(get_lang('GeneralError').' (code '.$or_die.')'); |
758 | 763 | } |
759 | 764 |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | // STEP 2: at least one file has to be selected. If not we return an error message |
44 | 44 | $ids = isset($_GET['id']) ? $_GET['id'] : array(); |
45 | - if (count($ids)>0) { |
|
45 | + if (count($ids) > 0) { |
|
46 | 46 | $checked_file_ids = $_POST['id']; |
47 | 47 | } else { |
48 | 48 | foreach ($_POST as $key => $value) { |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | $cat = get_dropbox_category($id); |
136 | - if (count($cat)==0) { |
|
136 | + if (count($cat) == 0) { |
|
137 | 137 | return false; |
138 | 138 | } |
139 | 139 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | } |
158 | 158 | |
159 | 159 | // step 1: delete the category |
160 | - $sql = "DELETE FROM ". Database::get_course_table(TABLE_DROPBOX_CATEGORY) ." |
|
160 | + $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_CATEGORY)." |
|
161 | 161 | WHERE c_id = $course_id AND cat_id='".intval($id)."' AND $sentreceived='1'"; |
162 | 162 | Database::query($sql); |
163 | 163 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $return_message = get_lang('ReceivedFileMoved'); |
236 | 236 | } |
237 | 237 | if ($part == 'sent') { |
238 | - $sql = "UPDATE ". Database::get_course_table(TABLE_DROPBOX_FILE) ." |
|
238 | + $sql = "UPDATE ".Database::get_course_table(TABLE_DROPBOX_FILE)." |
|
239 | 239 | SET cat_id = ".intval($target)." |
240 | 240 | WHERE |
241 | 241 | c_id = $course_id AND |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | $session_id = api_get_session_id(); |
271 | 271 | $condition_session = api_get_session_condition($session_id); |
272 | 272 | |
273 | - $sql = "SELECT * FROM ". Database::get_course_table(TABLE_DROPBOX_CATEGORY) ." |
|
273 | + $sql = "SELECT * FROM ".Database::get_course_table(TABLE_DROPBOX_CATEGORY)." |
|
274 | 274 | WHERE c_id = $course_id AND user_id='".$_user['user_id']."' $condition_session"; |
275 | 275 | |
276 | 276 | $result = Database::query($sql); |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | { |
293 | 293 | $course_id = api_get_course_int_id(); |
294 | 294 | if (empty($id) or $id != intval($id)) { return array(); } |
295 | - $sql = "SELECT * FROM ". Database::get_course_table(TABLE_DROPBOX_CATEGORY) ." |
|
295 | + $sql = "SELECT * FROM ".Database::get_course_table(TABLE_DROPBOX_CATEGORY)." |
|
296 | 296 | WHERE c_id = $course_id AND cat_id='".$id."'"; |
297 | 297 | $res = Database::query($sql); |
298 | 298 | if ($res === false) { |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | if (!isset($_POST['edit_id'])) { |
342 | 342 | $session_id = api_get_session_id(); |
343 | 343 | // step 3a, we check if the category doesn't already exist |
344 | - $sql = "SELECT * FROM ". Database::get_course_table(TABLE_DROPBOX_CATEGORY) ." |
|
344 | + $sql = "SELECT * FROM ".Database::get_course_table(TABLE_DROPBOX_CATEGORY)." |
|
345 | 345 | WHERE |
346 | 346 | c_id = $course_id AND |
347 | 347 | user_id='".$_user['user_id']."' AND |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | ]; |
365 | 365 | $id = Database::insert(Database::get_course_table(TABLE_DROPBOX_CATEGORY), $params); |
366 | 366 | if ($id) { |
367 | - $sql = "UPDATE ". Database::get_course_table(TABLE_DROPBOX_CATEGORY) ." SET cat_id = iid WHERE iid = $id"; |
|
367 | + $sql = "UPDATE ".Database::get_course_table(TABLE_DROPBOX_CATEGORY)." SET cat_id = iid WHERE iid = $id"; |
|
368 | 368 | Database::query($sql); |
369 | 369 | } |
370 | 370 | |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | |
414 | 414 | if (isset($id) && $id != '') { |
415 | 415 | // retrieve the category we are editing |
416 | - $sql = "SELECT * FROM ". Database::get_course_table(TABLE_DROPBOX_CATEGORY) ." |
|
416 | + $sql = "SELECT * FROM ".Database::get_course_table(TABLE_DROPBOX_CATEGORY)." |
|
417 | 417 | WHERE c_id = $course_id AND cat_id = ".intval($id); |
418 | 418 | $result = Database::query($sql); |
419 | 419 | $row = Database::fetch_array($result); |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | |
603 | 603 | $full_name = $userInfo['complete_name'].$groupNameListToString; |
604 | 604 | $current_user_id = $current_user['user_id']; |
605 | - $options['user_' . $current_user_id] = $full_name; |
|
605 | + $options['user_'.$current_user_id] = $full_name; |
|
606 | 606 | } |
607 | 607 | } |
608 | 608 | } |
@@ -702,8 +702,8 @@ discard block |
||
702 | 702 | |
703 | 703 | // select all files that aren't referenced anymore |
704 | 704 | $sql = "SELECT DISTINCT f.id, f.filename |
705 | - FROM " . Database::get_course_table(TABLE_DROPBOX_FILE) . " f |
|
706 | - LEFT JOIN " . Database::get_course_table(TABLE_DROPBOX_PERSON) . " p |
|
705 | + FROM " . Database::get_course_table(TABLE_DROPBOX_FILE)." f |
|
706 | + LEFT JOIN " . Database::get_course_table(TABLE_DROPBOX_PERSON)." p |
|
707 | 707 | ON (f.id = p.file_id) |
708 | 708 | WHERE p.user_id IS NULL AND |
709 | 709 | f.c_id = $course_id |
@@ -711,14 +711,14 @@ discard block |
||
711 | 711 | $result = Database::query($sql); |
712 | 712 | while ($res = Database::fetch_array($result)) { |
713 | 713 | //delete the selected files from the post and file tables |
714 | - $sql = "DELETE FROM " . Database::get_course_table(TABLE_DROPBOX_POST) . " |
|
715 | - WHERE c_id = $course_id AND file_id = '" . $res['id'] . "'"; |
|
714 | + $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_POST)." |
|
715 | + WHERE c_id = $course_id AND file_id = '".$res['id']."'"; |
|
716 | 716 | Database::query($sql); |
717 | - $sql = "DELETE FROM " . Database::get_course_table(TABLE_DROPBOX_FILE) . " |
|
718 | - WHERE c_id = $course_id AND id ='" . $res['id'] . "'"; |
|
717 | + $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_FILE)." |
|
718 | + WHERE c_id = $course_id AND id ='".$res['id']."'"; |
|
719 | 719 | Database::query($sql); |
720 | 720 | //delete file from server |
721 | - @unlink( api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/dropbox/' . $res['filename']); |
|
721 | + @unlink(api_get_path(SYS_COURSE_PATH).$_course['path'].'/dropbox/'.$res['filename']); |
|
722 | 722 | } |
723 | 723 | } |
724 | 724 | |
@@ -740,11 +740,11 @@ discard block |
||
740 | 740 | |
741 | 741 | $mailingPseudoId = intval($mailingPseudoId); |
742 | 742 | $sql = "SELECT f.uploader_id |
743 | - FROM " . Database::get_course_table(TABLE_DROPBOX_FILE) . " f |
|
744 | - LEFT JOIN " . Database::get_course_table(TABLE_DROPBOX_POST) . " p |
|
743 | + FROM " . Database::get_course_table(TABLE_DROPBOX_FILE)." f |
|
744 | + LEFT JOIN " . Database::get_course_table(TABLE_DROPBOX_POST)." p |
|
745 | 745 | ON (f.id = p.file_id AND f.c_id = $course_id AND p.c_id = $course_id) |
746 | 746 | WHERE |
747 | - p.dest_user_id = '" . $mailingPseudoId . "' AND |
|
747 | + p.dest_user_id = '".$mailingPseudoId."' AND |
|
748 | 748 | p.c_id = $course_id |
749 | 749 | "; |
750 | 750 | $result = Database::query($sql); |
@@ -770,21 +770,21 @@ discard block |
||
770 | 770 | // for all content files, replace mailingPseudoId by owner as uploader |
771 | 771 | $file_id = intval($file_id); |
772 | 772 | $sql = "SELECT p.dest_user_id |
773 | - FROM " . Database::get_course_table(TABLE_DROPBOX_POST) . " p |
|
774 | - WHERE c_id = $course_id AND p.file_id = '" . $file_id . "'"; |
|
773 | + FROM " . Database::get_course_table(TABLE_DROPBOX_POST)." p |
|
774 | + WHERE c_id = $course_id AND p.file_id = '".$file_id."'"; |
|
775 | 775 | $result = Database::query($sql); |
776 | 776 | |
777 | 777 | if ($res = Database::fetch_array($result)) { |
778 | 778 | $mailingPseudoId = $res['dest_user_id']; |
779 | 779 | $mailId = get_mail_id_base(); |
780 | 780 | if ($mailingPseudoId > $mailId) { |
781 | - $sql = "DELETE FROM " . Database::get_course_table(TABLE_DROPBOX_PERSON) . " |
|
782 | - WHERE c_id = $course_id AND user_id='" . $mailingPseudoId . "'"; |
|
781 | + $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_PERSON)." |
|
782 | + WHERE c_id = $course_id AND user_id='".$mailingPseudoId."'"; |
|
783 | 783 | Database::query($sql); |
784 | 784 | |
785 | - $sql = "UPDATE " . Database::get_course_table(TABLE_DROPBOX_FILE) ." |
|
786 | - SET uploader_id='" . api_get_user_id() . "' |
|
787 | - WHERE c_id = $course_id AND uploader_id='" . $mailingPseudoId . "'"; |
|
785 | + $sql = "UPDATE ".Database::get_course_table(TABLE_DROPBOX_FILE)." |
|
786 | + SET uploader_id='" . api_get_user_id()."' |
|
787 | + WHERE c_id = $course_id AND uploader_id='".$mailingPseudoId."'"; |
|
788 | 788 | Database::query($sql); |
789 | 789 | } |
790 | 790 | } |
@@ -925,7 +925,7 @@ discard block |
||
925 | 925 | } |
926 | 926 | } |
927 | 927 | } else { // rename file to login_filename_uniqueId format |
928 | - $dropbox_filename = $_user['username'] . "_" . $dropbox_filename . "_".uniqid(''); |
|
928 | + $dropbox_filename = $_user['username']."_".$dropbox_filename."_".uniqid(''); |
|
929 | 929 | } |
930 | 930 | |
931 | 931 | // creating the array that contains all the users who will receive the file |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | } |
945 | 945 | } |
946 | 946 | |
947 | - @move_uploaded_file($dropbox_filetmpname, api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/dropbox/' . $dropbox_filename); |
|
947 | + @move_uploaded_file($dropbox_filetmpname, api_get_path(SYS_COURSE_PATH).$_course['path'].'/dropbox/'.$dropbox_filename); |
|
948 | 948 | |
949 | 949 | $b_send_mail = api_get_course_setting('email_alert_on_new_doc_dropbox'); |
950 | 950 | |
@@ -965,14 +965,14 @@ discard block |
||
965 | 965 | ), |
966 | 966 | $recipent_temp['email'], |
967 | 967 | get_lang('NewDropboxFileUploaded'), |
968 | - get_lang('NewDropboxFileUploadedContent').' <a href="'.api_get_path(WEB_CODE_PATH).'dropbox/index.php?' . api_get_cidreq() . '">'.get_lang('SeeFile').'</a>'. |
|
968 | + get_lang('NewDropboxFileUploadedContent').' <a href="'.api_get_path(WEB_CODE_PATH).'dropbox/index.php?'.api_get_cidreq().'">'.get_lang('SeeFile').'</a>'. |
|
969 | 969 | "\n\n". |
970 | 970 | api_get_person_name( |
971 | 971 | $_user['firstName'], |
972 | 972 | $_user['lastName'], |
973 | 973 | null, |
974 | 974 | PERSON_NAME_EMAIL_ADDRESS |
975 | - )."\n". get_lang('Email') ." : ".$_user['mail'], |
|
975 | + )."\n".get_lang('Email')." : ".$_user['mail'], |
|
976 | 976 | api_get_person_name( |
977 | 977 | $_user['firstName'], |
978 | 978 | $_user['lastName'], |
@@ -1068,12 +1068,12 @@ discard block |
||
1068 | 1068 | $id = intval($id); |
1069 | 1069 | $user_id = intval($user_id); |
1070 | 1070 | |
1071 | - $sql = "SELECT file_id FROM ". Database::get_course_table(TABLE_DROPBOX_PERSON) ." |
|
1071 | + $sql = "SELECT file_id FROM ".Database::get_course_table(TABLE_DROPBOX_PERSON)." |
|
1072 | 1072 | WHERE c_id = $course_id AND user_id = $user_id AND file_id = ".$id; |
1073 | 1073 | $result = Database::query($sql); |
1074 | 1074 | $number_users_who_see_file = Database::num_rows($result); |
1075 | 1075 | |
1076 | - $sql = "SELECT file_id FROM ". Database::get_course_table(TABLE_DROPBOX_POST) ." |
|
1076 | + $sql = "SELECT file_id FROM ".Database::get_course_table(TABLE_DROPBOX_POST)." |
|
1077 | 1077 | WHERE c_id = $course_id AND dest_user_id = $user_id AND file_id = ".$id; |
1078 | 1078 | $result = Database::query($sql); |
1079 | 1079 | $count = Database::num_rows($result); |
@@ -1087,12 +1087,12 @@ discard block |
||
1087 | 1087 | { |
1088 | 1088 | $id = intval($id); |
1089 | 1089 | $course_id = api_get_course_int_id(); |
1090 | - $sql = "SELECT file_id FROM ". Database::get_course_table(TABLE_DROPBOX_PERSON) ." |
|
1090 | + $sql = "SELECT file_id FROM ".Database::get_course_table(TABLE_DROPBOX_PERSON)." |
|
1091 | 1091 | WHERE c_id = $course_id AND file_id = ".$id; |
1092 | 1092 | $result = Database::query($sql); |
1093 | 1093 | $number_users_who_see_file = Database::num_rows($result); |
1094 | 1094 | |
1095 | - $sql = "SELECT file_id FROM ". Database::get_course_table(TABLE_DROPBOX_POST) ." |
|
1095 | + $sql = "SELECT file_id FROM ".Database::get_course_table(TABLE_DROPBOX_POST)." |
|
1096 | 1096 | WHERE c_id = $course_id AND file_id = ".$id; |
1097 | 1097 | $result = Database::query($sql); |
1098 | 1098 | $count = Database::num_rows($result); |
@@ -1124,7 +1124,7 @@ discard block |
||
1124 | 1124 | |
1125 | 1125 | $id = Database::insert(Database::get_course_table(TABLE_DROPBOX_FEEDBACK), $params); |
1126 | 1126 | if ($id) { |
1127 | - $sql = "UPDATE ". Database::get_course_table(TABLE_DROPBOX_FEEDBACK) ." SET feedback_id = iid WHERE iid = $id"; |
|
1127 | + $sql = "UPDATE ".Database::get_course_table(TABLE_DROPBOX_FEEDBACK)." SET feedback_id = iid WHERE iid = $id"; |
|
1128 | 1128 | Database::query($sql); |
1129 | 1129 | } |
1130 | 1130 | |
@@ -1151,10 +1151,10 @@ discard block |
||
1151 | 1151 | |
1152 | 1152 | // note: we also have to add the check if the user has received or sent this file. |
1153 | 1153 | $sql = "SELECT DISTINCT file.filename, file.title, file.author, file.description |
1154 | - FROM ". Database::get_course_table(TABLE_DROPBOX_FILE) ." file |
|
1155 | - INNER JOIN ". Database::get_course_table(TABLE_DROPBOX_PERSON) ." person |
|
1154 | + FROM ". Database::get_course_table(TABLE_DROPBOX_FILE)." file |
|
1155 | + INNER JOIN ". Database::get_course_table(TABLE_DROPBOX_PERSON)." person |
|
1156 | 1156 | ON (person.file_id=file.id AND file.c_id = $course_id AND person.c_id = $course_id) |
1157 | - INNER JOIN ". Database::get_course_table(TABLE_DROPBOX_POST) ." post |
|
1157 | + INNER JOIN ".Database::get_course_table(TABLE_DROPBOX_POST)." post |
|
1158 | 1158 | ON (post.file_id = file.id AND post.c_id = $course_id AND file.c_id = $course_id) |
1159 | 1159 | WHERE |
1160 | 1160 | file.id IN (".implode(', ', $fileList).") AND |
@@ -1248,7 +1248,7 @@ discard block |
||
1248 | 1248 | // Adding the content. |
1249 | 1249 | $return .= "\n<tr>"; |
1250 | 1250 | foreach ($column as $column_key => $column_value) { |
1251 | - if (!in_array($column_value,$dont_show_columns)) { |
|
1251 | + if (!in_array($column_value, $dont_show_columns)) { |
|
1252 | 1252 | $return .= "\n\t<td>"; |
1253 | 1253 | if (in_array($column_value, $make_link)) { |
1254 | 1254 | $return .= '<a href="'.$value[$column_value].'">'.$value[$column_value].'</a>'; |
@@ -1276,11 +1276,11 @@ discard block |
||
1276 | 1276 | { |
1277 | 1277 | $course_id = api_get_course_int_id(); |
1278 | 1278 | $sql = "SELECT COUNT(feedback_id) AS total, file_id |
1279 | - FROM ". Database::get_course_table(TABLE_DROPBOX_FEEDBACK) ." |
|
1279 | + FROM ". Database::get_course_table(TABLE_DROPBOX_FEEDBACK)." |
|
1280 | 1280 | WHERE c_id = $course_id GROUP BY file_id"; |
1281 | 1281 | $result = Database::query($sql); |
1282 | 1282 | $return = array(); |
1283 | - while ($row=Database::fetch_array($result)) { |
|
1283 | + while ($row = Database::fetch_array($result)) { |
|
1284 | 1284 | $return[$row['file_id']] = $row['total']; |
1285 | 1285 | } |
1286 | 1286 | return $return; |
@@ -201,20 +201,20 @@ discard block |
||
201 | 201 | $plan_html = null; |
202 | 202 | if (!empty($data)) { |
203 | 203 | foreach ($data as $plan) { |
204 | - $plan_html .= '<strong>' . $plan['title'] . '</strong><br /> ' . $plan['description'] . '<br />'; |
|
204 | + $plan_html .= '<strong>'.$plan['title'].'</strong><br /> '.$plan['description'].'<br />'; |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | $data = $thematic->get_thematic_advance_by_thematic_id($theme['id']); |
208 | 208 | $advance_html = null; |
209 | 209 | if (!empty($data)) { |
210 | 210 | foreach ($data as $advance) { |
211 | - $advance_html .= api_convert_and_format_date($advance['start_date'], DATE_FORMAT_LONG) . ' ('.$advance['duration'].' '.get_lang('HourShort').')<br />'.$advance['content'].'<br />'; |
|
211 | + $advance_html .= api_convert_and_format_date($advance['start_date'], DATE_FORMAT_LONG).' ('.$advance['duration'].' '.get_lang('HourShort').')<br />'.$advance['content'].'<br />'; |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 | $table[] = array($theme['title'], $plan_html, $advance_html); |
215 | 215 | } |
216 | 216 | $params = array( |
217 | - 'filename' => get_lang('Thematic') . '-' . api_get_local_time(), |
|
217 | + 'filename' => get_lang('Thematic').'-'.api_get_local_time(), |
|
218 | 218 | 'pdf_title' => get_lang('Thematic'), |
219 | 219 | 'add_signatures' => true, |
220 | 220 | 'format' => 'A4-L', |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | unset($_SESSION['thematic_plan_token']); |
312 | 312 | $data['message'] = 'ok'; |
313 | 313 | |
314 | - $saveRedirect = api_get_path(WEB_PATH) . 'main/course_progress/index.php?'; |
|
315 | - $saveRedirect.= api_get_cidreq() . '&'; |
|
316 | - $saveRedirect.= 'thematic_plan_save_message=ok'; |
|
314 | + $saveRedirect = api_get_path(WEB_PATH).'main/course_progress/index.php?'; |
|
315 | + $saveRedirect .= api_get_cidreq().'&'; |
|
316 | + $saveRedirect .= 'thematic_plan_save_message=ok'; |
|
317 | 317 | |
318 | 318 | header("Location: $saveRedirect"); |
319 | 319 | exit; |
@@ -23,25 +23,25 @@ discard block |
||
23 | 23 | case 'thematic_add' : |
24 | 24 | case 'thematic_import_select' : |
25 | 25 | echo '<a href="index.php?'.api_get_cidreq().'">'. |
26 | - Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ThematicDetails'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
26 | + Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ThematicDetails'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
27 | 27 | break; |
28 | 28 | case 'thematic_list' : |
29 | 29 | echo '<a href="index.php?'.api_get_cidreq().'&action=thematic_add'.$url_token.'">'. |
30 | - Display::return_icon('new_course_progress.png',get_lang('NewThematicSection'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
30 | + Display::return_icon('new_course_progress.png', get_lang('NewThematicSection'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
31 | 31 | break; |
32 | 32 | case 'thematic_details' : |
33 | 33 | echo '<a href="index.php?'.api_get_cidreq().'&action=thematic_add'.$url_token.'">'. |
34 | - Display::return_icon('new_course_progress.png',get_lang('NewThematicSection'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
34 | + Display::return_icon('new_course_progress.png', get_lang('NewThematicSection'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
35 | 35 | echo '<a href="index.php?'.api_get_cidreq().'&action=thematic_import_select'.$url_token.'">'. |
36 | - Display::return_icon('import_csv.png',get_lang('ImportThematic'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
36 | + Display::return_icon('import_csv.png', get_lang('ImportThematic'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
37 | 37 | echo '<a href="index.php?'.api_get_cidreq().'&action=thematic_export'.$url_token.'">'. |
38 | - Display::return_icon('export_csv.png',get_lang('ExportThematic'),'', ICON_SIZE_MEDIUM).'</a>'; |
|
38 | + Display::return_icon('export_csv.png', get_lang('ExportThematic'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
39 | 39 | echo '<a href="index.php?'.api_get_cidreq().'&action=thematic_export_pdf'.$url_token.'">'. |
40 | - Display::return_icon('pdf.png',get_lang('ExportToPDF'),'', ICON_SIZE_MEDIUM).'</a>'; |
|
40 | + Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
41 | 41 | break; |
42 | 42 | default : |
43 | 43 | echo '<a href="index.php?'.api_get_cidreq().'&action=thematic_add'.$url_token.'">'. |
44 | - Display::return_icon('new_course_progress.png',get_lang('NewThematicSection'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
44 | + Display::return_icon('new_course_progress.png', get_lang('NewThematicSection'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
45 | 45 | } |
46 | 46 | echo '</div>'; |
47 | 47 | } |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | $parameters['action'] = $action; |
58 | 58 | $table->set_additional_parameters($parameters); |
59 | 59 | $table->set_header(0, '', false, array('style'=>'width:20px;')); |
60 | - $table->set_header(1, get_lang('Title'), false ); |
|
60 | + $table->set_header(1, get_lang('Title'), false); |
|
61 | 61 | if (api_is_allowed_to_edit(null, true)) { |
62 | - $table->set_header(2, get_lang('Actions'), false,array('style'=>'text-align:center;width:40%;')); |
|
63 | - $table->set_form_actions(array ('thematic_delete_select' => get_lang('DeleteAllThematics'))); |
|
62 | + $table->set_header(2, get_lang('Actions'), false, array('style'=>'text-align:center;width:40%;')); |
|
63 | + $table->set_form_actions(array('thematic_delete_select' => get_lang('DeleteAllThematics'))); |
|
64 | 64 | } |
65 | 65 | $table->display(); |
66 | 66 | |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | |
73 | 73 | if (isset($last_id) && $last_id) { |
74 | 74 | $link_to_thematic_plan = '<a href="index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$last_id.'">'. |
75 | - Display::return_icon('lesson_plan.png', get_lang('ThematicPlan'), array('style'=>'vertical-align:middle;float:none;'),ICON_SIZE_SMALL).'</a>'; |
|
75 | + Display::return_icon('lesson_plan.png', get_lang('ThematicPlan'), array('style'=>'vertical-align:middle;float:none;'), ICON_SIZE_SMALL).'</a>'; |
|
76 | 76 | $link_to_thematic_advance = '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$last_id.'">'. |
77 | - Display::return_icon('lesson_plan_calendar.png', get_lang('ThematicAdvance'), array('style'=>'vertical-align:middle;float:none;'),ICON_SIZE_SMALL).'</a>'; |
|
77 | + Display::return_icon('lesson_plan_calendar.png', get_lang('ThematicAdvance'), array('style'=>'vertical-align:middle;float:none;'), ICON_SIZE_SMALL).'</a>'; |
|
78 | 78 | Display::display_confirmation_message( |
79 | - get_lang('ThematicSectionHasBeenCreatedSuccessfull').'<br />'.sprintf(get_lang('NowYouShouldAddThematicPlanXAndThematicAdvanceX'),$link_to_thematic_plan, $link_to_thematic_advance), |
|
79 | + get_lang('ThematicSectionHasBeenCreatedSuccessfull').'<br />'.sprintf(get_lang('NowYouShouldAddThematicPlanXAndThematicAdvanceX'), $link_to_thematic_plan, $link_to_thematic_advance), |
|
80 | 80 | false |
81 | 81 | ); |
82 | 82 | } |
@@ -113,27 +113,27 @@ discard block |
||
113 | 113 | $actions_first_col = ''; |
114 | 114 | if (api_is_allowed_to_edit(null, true)) { |
115 | 115 | // Thematic title |
116 | - $actions_first_col = Display::url( |
|
116 | + $actions_first_col = Display::url( |
|
117 | 117 | Display::return_icon('cd.gif', get_lang('Copy')), |
118 | 118 | 'index.php?'.api_get_cidreq().'&action=thematic_copy&thematic_id='.$my_thematic_id.$params.$url_token |
119 | 119 | ); |
120 | - if (api_get_session_id() == 0 ) { |
|
120 | + if (api_get_session_id() == 0) { |
|
121 | 121 | |
122 | 122 | if ($thematic['display_order'] > 1) { |
123 | - $actions_first_col .= ' <a href="'.api_get_self().'?action=moveup&'.api_get_cidreq().'&thematic_id='.$my_thematic_id.$params.$url_token.'">'.Display::return_icon('up.png', get_lang('Up'),'',ICON_SIZE_SMALL).'</a>'; |
|
123 | + $actions_first_col .= ' <a href="'.api_get_self().'?action=moveup&'.api_get_cidreq().'&thematic_id='.$my_thematic_id.$params.$url_token.'">'.Display::return_icon('up.png', get_lang('Up'), '', ICON_SIZE_SMALL).'</a>'; |
|
124 | 124 | } else { |
125 | - $actions_first_col .= ' '.Display::return_icon('up_na.png',' ','',ICON_SIZE_SMALL); |
|
125 | + $actions_first_col .= ' '.Display::return_icon('up_na.png', ' ', '', ICON_SIZE_SMALL); |
|
126 | 126 | } |
127 | 127 | if (isset($thematic['max_thematic_item']) && $thematic['display_order'] < $thematic['max_thematic_item']) { |
128 | - $actions_first_col .= ' <a href="'.api_get_self().'?action=movedown&a'.api_get_cidreq().'&thematic_id='.$my_thematic_id.$params.$url_token.'">'.Display::return_icon('down.png',get_lang('Down'),'',ICON_SIZE_SMALL).'</a>'; |
|
128 | + $actions_first_col .= ' <a href="'.api_get_self().'?action=movedown&a'.api_get_cidreq().'&thematic_id='.$my_thematic_id.$params.$url_token.'">'.Display::return_icon('down.png', get_lang('Down'), '', ICON_SIZE_SMALL).'</a>'; |
|
129 | 129 | } else { |
130 | - $actions_first_col .= ' '.Display::return_icon('down_na.png',' ','',ICON_SIZE_SMALL); |
|
130 | + $actions_first_col .= ' '.Display::return_icon('down_na.png', ' ', '', ICON_SIZE_SMALL); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | } |
134 | 134 | if (api_get_session_id() == $thematic['session_id']) { |
135 | - $actions_first_col .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_edit&thematic_id='.$my_thematic_id.$params.$url_token.'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'; |
|
136 | - $actions_first_col .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_delete&thematic_id='.$my_thematic_id.$params.$url_token.'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
|
135 | + $actions_first_col .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_edit&thematic_id='.$my_thematic_id.$params.$url_token.'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'; |
|
136 | + $actions_first_col .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_delete&thematic_id='.$my_thematic_id.$params.$url_token.'">'.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'; |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | $actions_first_col = Display::div($actions_first_col, array('id'=>'thematic_id_content_'.$thematic['id'], 'class'=>'thematic_tools')); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | //if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) { |
150 | 150 | if (api_is_allowed_to_edit(null, true)) { |
151 | 151 | echo '<div style="text-align:right"><a href="index.php?'.api_get_cidreq().'&origin=thematic_details&action=thematic_plan_list&thematic_id='.$thematic['id'].'&width=700&height=500">'. |
152 | - Display::return_icon('edit.png', get_lang('EditThematicPlan'), array('style'=>'vertical-align:middle'),ICON_SIZE_MEDIUM).'</a></div><br />'; |
|
152 | + Display::return_icon('edit.png', get_lang('EditThematicPlan'), array('style'=>'vertical-align:middle'), ICON_SIZE_MEDIUM).'</a></div><br />'; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | if (empty($thematic_plan_div[$thematic['id']])) { |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | //if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) { |
166 | 166 | if (api_is_allowed_to_edit(null, true)) { |
167 | 167 | echo '<div style="text-align:right"><a href="index.php?'.api_get_cidreq().'&action=thematic_advance_add&thematic_id='.$thematic['id'].'">'. |
168 | - Display::return_icon('add.png',get_lang('NewThematicAdvance'),'',ICON_SIZE_MEDIUM).'</a></div>'; |
|
168 | + Display::return_icon('add.png', get_lang('NewThematicAdvance'), '', ICON_SIZE_MEDIUM).'</a></div>'; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | //if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) { |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | [], |
188 | 188 | ICON_SIZE_SMALL |
189 | 189 | ), |
190 | - 'index.php?' . api_get_cidreq() . '&' . http_build_query([ |
|
190 | + 'index.php?'.api_get_cidreq().'&'.http_build_query([ |
|
191 | 191 | 'action' => 'thematic_advance_edit', |
192 | 192 | 'thematic_id' => $thematic['id'], |
193 | 193 | 'thematic_advance_id' => $thematic_advance['id'], |
@@ -198,17 +198,17 @@ discard block |
||
198 | 198 | 'data-title' => get_lang('EditThematicAdvance') |
199 | 199 | ] |
200 | 200 | ); |
201 | - $edit_link .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_advance_delete&thematic_id='.$thematic['id'].'&thematic_advance_id='.$thematic_advance['id'].'">'. |
|
202 | - Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a></center>'; |
|
201 | + $edit_link .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_advance_delete&thematic_id='.$thematic['id'].'&thematic_advance_id='.$thematic_advance['id'].'">'. |
|
202 | + Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a></center>'; |
|
203 | 203 | |
204 | 204 | //Links |
205 | 205 | $edit_link = Display::div( |
206 | - Display::div($edit_link , array('id'=>'thematic_advance_tools_'.$thematic_advance['id'], 'class'=>'thematic_advance_actions')), |
|
206 | + Display::div($edit_link, array('id'=>'thematic_advance_tools_'.$thematic_advance['id'], 'class'=>'thematic_advance_actions')), |
|
207 | 207 | array('style'=>'height:20px;') |
208 | 208 | ); |
209 | 209 | } |
210 | 210 | |
211 | - $thematic_advance_item = isset($thematic_advance_div[$thematic['id']][$thematic_advance['id']]) ? $thematic_advance_div[$thematic['id']][$thematic_advance['id']] : null; |
|
211 | + $thematic_advance_item = isset($thematic_advance_div[$thematic['id']][$thematic_advance['id']]) ? $thematic_advance_div[$thematic['id']][$thematic_advance['id']] : null; |
|
212 | 212 | echo Display::div($thematic_advance_item, array('id'=>'thematic_advance_'.$thematic_advance['id'])); |
213 | 213 | echo $edit_link; |
214 | 214 | echo '</td>'; |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | } elseif ($action == 'thematic_add' || $action == 'thematic_edit') { |
254 | 254 | |
255 | 255 | // Display form |
256 | - $form = new FormValidator('thematic_add','POST','index.php?action=thematic_add&'.api_get_cidreq()); |
|
256 | + $form = new FormValidator('thematic_add', 'POST', 'index.php?action=thematic_add&'.api_get_cidreq()); |
|
257 | 257 | |
258 | 258 | if ($action == 'thematic_edit') { |
259 | 259 | $form->addElement('header', '', get_lang('EditThematicSection')); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | $form->addElement('hidden', 'action', $action); |
264 | 264 | |
265 | 265 | if (!empty($thematic_id)) { |
266 | - $form->addElement('hidden', 'thematic_id',$thematic_id); |
|
266 | + $form->addElement('hidden', 'thematic_id', $thematic_id); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | $form->addText('title', get_lang('Title'), true, array('size'=>'50')); |
@@ -275,8 +275,8 @@ discard block |
||
275 | 275 | if (!empty($thematic_data)) { |
276 | 276 | if (api_get_session_id()) { |
277 | 277 | if ($thematic_data['session_id'] != api_get_session_id()) { |
278 | - $show_form = false; |
|
279 | - Display::display_error_message(get_lang('NotAllowedClickBack'),false); |
|
278 | + $show_form = false; |
|
279 | + Display::display_error_message(get_lang('NotAllowedClickBack'), false); |
|
280 | 280 | } |
281 | 281 | } |
282 | 282 | // set default values |
@@ -287,14 +287,14 @@ discard block |
||
287 | 287 | |
288 | 288 | // error messages |
289 | 289 | if (isset($error)) { |
290 | - Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false); |
|
290 | + Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false); |
|
291 | 291 | } |
292 | 292 | if ($show_form) { |
293 | 293 | $form->display(); |
294 | 294 | } |
295 | 295 | } elseif ($action == 'thematic_import_select') { |
296 | 296 | // Create form to upload csv file. |
297 | - $form = new FormValidator('thematic_import','POST','index.php?action=thematic_import&'.api_get_cidreq().$url_token); |
|
297 | + $form = new FormValidator('thematic_import', 'POST', 'index.php?action=thematic_import&'.api_get_cidreq().$url_token); |
|
298 | 298 | $form->addElement('header', get_lang('ImportThematic')); |
299 | 299 | $form->addElement('file', 'file'); |
300 | 300 | $form->addElement('checkbox', 'replace', null, get_lang('DeleteAllThematic')); |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | $a_dir = realpath($dir.'/../../archive/'); |
16 | 16 | $list = scandir($a_dir); |
17 | 17 | // calculate 7 days |
18 | -$t = time()-(86400*7); |
|
18 | +$t = time() - (86400 * 7); |
|
19 | 19 | foreach ($list as $item) { |
20 | - if (substr($item,0,1) == '.') { |
|
20 | + if (substr($item, 0, 1) == '.') { |
|
21 | 21 | continue; |
22 | 22 | } |
23 | 23 | $stat = @stat($a_dir.'/'.$item); |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | * Delete a file or recursively delete a directory |
35 | 35 | * @param string $str Path to file or directory |
36 | 36 | */ |
37 | -function recursive_delete($str){ |
|
37 | +function recursive_delete($str) { |
|
38 | 38 | if (is_file($str)) { |
39 | 39 | return @unlink($str); |
40 | 40 | } elseif (is_dir($str)) { |
41 | - $scan = glob(rtrim($str,'/').'/*'); |
|
41 | + $scan = glob(rtrim($str, '/').'/*'); |
|
42 | 42 | foreach ($scan as $index=>$path) { |
43 | 43 | recursive_delete($path); |
44 | 44 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * @package chamilo.cron |
6 | 6 | * @author Imanol Losada <[email protected]> |
7 | 7 | */ |
8 | -require_once __DIR__ . '/../inc/global.inc.php'; |
|
8 | +require_once __DIR__.'/../inc/global.inc.php'; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Initialization |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | foreach ($sessions as $sessionId => $userIds) { |
66 | 66 | $userId = 0; |
67 | - $userIds = $userIds ? " AND sessionUser.user_id NOT IN (" . implode(", ", $userIds) . ")" : null; |
|
67 | + $userIds = $userIds ? " AND sessionUser.user_id NOT IN (".implode(", ", $userIds).")" : null; |
|
68 | 68 | $query = " |
69 | 69 | SELECT sessionUser.session_id, sessionUser.user_id, session.name, session.access_end_date |
70 | 70 | FROM $sessionUserTable AS sessionUser |
@@ -156,10 +156,10 @@ discard block |
||
156 | 156 | $administrator['completeName'], |
157 | 157 | $administrator['email'] |
158 | 158 | ); |
159 | - echo "Email sent to $userCompleteName (" . $user['email'] . ")\n"; |
|
160 | - echo "Session: " . $session['name'] . "\n"; |
|
161 | - echo "Date end: " . $session['access_end_date'] . "\n"; |
|
162 | - echo "Days remaining: " . $daysRemaining->format("%d") . "\n\n"; |
|
159 | + echo "Email sent to $userCompleteName (".$user['email'].")\n"; |
|
160 | + echo "Session: ".$session['name']."\n"; |
|
161 | + echo "Date end: ".$session['access_end_date']."\n"; |
|
162 | + echo "Days remaining: ".$daysRemaining->format("%d")."\n\n"; |
|
163 | 163 | } |
164 | 164 | echo "======================================================================\n\n"; |
165 | 165 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @author Angel Fernando Quiroz Campos <[email protected]> |
7 | 7 | * @package chamilo.cron |
8 | 8 | */ |
9 | -require_once __DIR__ . '/../inc/global.inc.php'; |
|
9 | +require_once __DIR__.'/../inc/global.inc.php'; |
|
10 | 10 | |
11 | 11 | if (php_sapi_name() != 'cli') { |
12 | 12 | exit; //do not run from browser |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | ->getResult(); |
33 | 33 | |
34 | 34 | if (empty($sessions)) { |
35 | - echo "No sessions finishing today $endDate" . PHP_EOL; |
|
35 | + echo "No sessions finishing today $endDate".PHP_EOL; |
|
36 | 36 | exit; |
37 | 37 | } |
38 | 38 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $sessionUsers = $session->getUsers(); |
51 | 51 | |
52 | 52 | if (empty($sessionUsers)) { |
53 | - echo 'No users to send mail' . PHP_EOL; |
|
53 | + echo 'No users to send mail'.PHP_EOL; |
|
54 | 54 | exit; |
55 | 55 | } |
56 | 56 | |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | $administrator['email'] |
82 | 82 | ); |
83 | 83 | |
84 | - echo '============' . PHP_EOL; |
|
85 | - echo "Email sent to: {$user->getCompleteName()} ({$user->getEmail()})" . PHP_EOL; |
|
86 | - echo "Session: {$session->getName()}" . PHP_EOL; |
|
87 | - echo "End date: {$session->getAccessEndDate()->format('Y-m-d h:i')}" . PHP_EOL; |
|
84 | + echo '============'.PHP_EOL; |
|
85 | + echo "Email sent to: {$user->getCompleteName()} ({$user->getEmail()})".PHP_EOL; |
|
86 | + echo "Session: {$session->getName()}".PHP_EOL; |
|
87 | + echo "End date: {$session->getAccessEndDate()->format('Y-m-d h:i')}".PHP_EOL; |
|
88 | 88 | } |
89 | 89 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $totalSize = $row['total']; |
98 | 98 | |
99 | 99 | if ($debug) { |
100 | - echo "Total size in table $table " . (round($totalSize / 1024)) . " MB \n"; |
|
100 | + echo "Total size in table $table ".(round($totalSize / 1024))." MB \n"; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | $table = Database::get_course_table(TABLE_FORUM_ATTACHMENT); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $subTotal = $row['total']; |
108 | 108 | $totalSize += $subTotal; |
109 | 109 | if ($debug) { |
110 | - echo "Total size in table $table " . (round($subTotal / 1024)) . " MB \n"; |
|
110 | + echo "Total size in table $table ".(round($subTotal / 1024))." MB \n"; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | $totalSize = $totalSize / 1024; |
@@ -8,9 +8,9 @@ discard block |
||
8 | 8 | die(); |
9 | 9 | require '../../inc/global.inc.php'; |
10 | 10 | if (empty($_GET['doc'])) { |
11 | - echo "To add a document name to search, add ?doc=abc to the URL\n"; |
|
11 | + echo "To add a document name to search, add ?doc=abc to the URL\n"; |
|
12 | 12 | } else { |
13 | - echo "Received param ".$_GET['doc']."<br />\n"; |
|
13 | + echo "Received param ".$_GET['doc']."<br />\n"; |
|
14 | 14 | } |
15 | 15 | $allowed_mime_types = DocumentManager::file_get_mime_type(true); |
16 | 16 | $allowed_extensions = array( |
@@ -40,30 +40,30 @@ discard block |
||
40 | 40 | $specific_fields = get_specific_field_list(); |
41 | 41 | $specific_fields_values = array(); |
42 | 42 | foreach ($specific_fields as $sf) { |
43 | - $specific_fields_values[$sf['code']] = ''; |
|
43 | + $specific_fields_values[$sf['code']] = ''; |
|
44 | 44 | } |
45 | 45 | $td = Database::get_course_table(TABLE_DOCUMENT); |
46 | 46 | |
47 | 47 | foreach ($courses_list as $course) { |
48 | - $course_dir = $course['directory'].'/document'; |
|
49 | - $title = Database::escape_string($_GET['doc']); |
|
50 | - $sql = "SELECT id, path, session_id FROM $td WHERE c_id = ".$course['id']." AND path LIKE '%$title%' or title LIKE '%$title%'"; |
|
51 | - $res = Database::query($sql); |
|
52 | - if (Database::num_rows($res)>0) { |
|
48 | + $course_dir = $course['directory'].'/document'; |
|
49 | + $title = Database::escape_string($_GET['doc']); |
|
50 | + $sql = "SELECT id, path, session_id FROM $td WHERE c_id = ".$course['id']." AND path LIKE '%$title%' or title LIKE '%$title%'"; |
|
51 | + $res = Database::query($sql); |
|
52 | + if (Database::num_rows($res)>0) { |
|
53 | 53 | while ($row = Database::fetch_array($res)) { |
54 | - $doc_path = api_get_path(SYS_COURSE_PATH).$course_dir.$row['path']; |
|
55 | - $extensions = preg_split("/[\/\\.]/", $doc_path); |
|
56 | - $doc_ext = strtolower($extensions[count($extensions) - 1]); |
|
57 | - if (in_array($doc_ext, $allowed_extensions) && !is_dir($doc_path)) { |
|
54 | + $doc_path = api_get_path(SYS_COURSE_PATH).$course_dir.$row['path']; |
|
55 | + $extensions = preg_split("/[\/\\.]/", $doc_path); |
|
56 | + $doc_ext = strtolower($extensions[count($extensions) - 1]); |
|
57 | + if (in_array($doc_ext, $allowed_extensions) && !is_dir($doc_path)) { |
|
58 | 58 | $doc_mime = mime_content_type($doc_path); |
59 | 59 | echo "Indexing doc ".$row['id']." (".$row['path'].") in course ".$course['code']."\n"; |
60 | 60 | $residx = DocumentManager::index_document($row['id'], $course['code'], $row['session_id'], $course['course_language'], $specific_fields_values); |
61 | 61 | if ($residx) { |
62 | - echo "Success\n"; |
|
62 | + echo "Success\n"; |
|
63 | 63 | } else { |
64 | - echo "Failure\n"; |
|
64 | + echo "Failure\n"; |
|
65 | 65 | } |
66 | - } |
|
66 | + } |
|
67 | + } |
|
67 | 68 | } |
68 | - } |
|
69 | 69 | } |
@@ -12,13 +12,13 @@ |
||
12 | 12 | } else { |
13 | 13 | echo "Received param ".Security::remove_XSS($_GET['doc'])."<br />"; |
14 | 14 | } |
15 | -$courses_list = CourseManager::get_courses_list(); |
|
15 | +$courses_list = CourseManager::get_courses_list(); |
|
16 | 16 | foreach ($courses_list as $course) { |
17 | 17 | $title = Database::escape_string($_GET['doc']); |
18 | 18 | $td = Database::get_course_table(TABLE_DOCUMENT); |
19 | 19 | $sql = "SELECT id, path FROM $td WHERE c_id = ".$course['id']." AND path LIKE '%$title%' OR title LIKE '%$title%'"; |
20 | 20 | $res = Database::query($sql); |
21 | - if (Database::num_rows($res)>0) { |
|
21 | + if (Database::num_rows($res) > 0) { |
|
22 | 22 | while ($row = Database::fetch_array($res)) { |
23 | 23 | echo "Found doc ".$row['id']."-> ".$row['path']." in course ".$course['code']."<br />"; |
24 | 24 | } |