@@ -237,12 +237,12 @@ |
||
237 | 237 | ]; |
238 | 238 | } else { |
239 | 239 | $add = "\t<Session>\n" |
240 | - ."\t\t<SessionName>$row[name]</SessionName>\n" |
|
241 | - ."\t\t<Coach>$row[username]</Coach>\n" |
|
242 | - ."\t\t<DateStart>$row[access_start_date]</DateStart>\n" |
|
243 | - ."\t\t<DateEnd>$row[access_end_date]</DateEnd>\n" |
|
244 | - ."\t\t<Visibility>$row[visibility]</Visibility>\n" |
|
245 | - ."\t\t<SessionCategory>$row[session_category]</SessionCategory>\n"; |
|
240 | + ."\t\t<SessionName>$row[name]</SessionName>\n" |
|
241 | + ."\t\t<Coach>$row[username]</Coach>\n" |
|
242 | + ."\t\t<DateStart>$row[access_start_date]</DateStart>\n" |
|
243 | + ."\t\t<DateEnd>$row[access_end_date]</DateEnd>\n" |
|
244 | + ."\t\t<Visibility>$row[visibility]</Visibility>\n" |
|
245 | + ."\t\t<SessionCategory>$row[session_category]</SessionCategory>\n"; |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | if (!$cvs) { |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | $plugin = BuyCoursesPlugin::create(); |
11 | 11 | $paypalEnabled = $plugin->get('paypal_enable') === 'true'; |
12 | 12 | |
13 | -if (!$paypalEnabled) { |
|
13 | +if (!$paypalEnabled) { |
|
14 | 14 | api_not_allowed(true); |
15 | 15 | } |
16 | 16 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $serviceSale = $plugin->getServiceSale($serviceSaleId); |
19 | 19 | $itemPrice = $serviceSale['price']; |
20 | 20 | |
21 | -if (empty($serviceSale)) { |
|
21 | +if (empty($serviceSale)) { |
|
22 | 22 | api_not_allowed(true); |
23 | 23 | } |
24 | 24 | |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | ); |
50 | 50 | $form->addButtonCancel($plugin->get_lang('CancelOrder'), 'cancel'); |
51 | 51 | |
52 | -if ($form->validate()) { |
|
52 | +if ($form->validate()) { |
|
53 | 53 | $formValues = $form->getSubmitValues(); |
54 | - if (isset($formValues['cancel'])) { |
|
54 | + if (isset($formValues['cancel'])) { |
|
55 | 55 | $plugin->cancelServiceSale($serviceSale['id']); |
56 | 56 | |
57 | 57 | unset($_SESSION['bc_service_sale_id']); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | $confirmPayments = ConfirmPayment($itemPrice); |
68 | - if ($confirmPayments['ACK'] !== 'Success') { |
|
68 | + if ($confirmPayments['ACK'] !== 'Success') { |
|
69 | 69 | $erroMessage = vsprintf( |
70 | 70 | $plugin->get_lang('ErrorOccurred'), |
71 | 71 | [$expressCheckout['L_ERRORCODE0'], $confirmPayments['L_LONGMESSAGE0']] |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | exit; |
79 | 79 | } |
80 | 80 | |
81 | - switch ($confirmPayments["PAYMENTINFO_0_PAYMENTSTATUS"]) { |
|
81 | + switch ($confirmPayments["PAYMENTINFO_0_PAYMENTSTATUS"]) { |
|
82 | 82 | case 'Completed': |
83 | 83 | $serviceSaleIsCompleted = $plugin->completeServiceSale($serviceSale['id']); |
84 | 84 | |
85 | - if ($serviceSaleIsCompleted) { |
|
85 | + if ($serviceSaleIsCompleted) { |
|
86 | 86 | Display::addFlash( |
87 | 87 | Display::return_message( |
88 | 88 | sprintf($plugin->get_lang('SubscriptionToServiceXSuccessful'), $serviceSale['service']['name']), |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | ); |
99 | 99 | break; |
100 | 100 | case 'Pending': |
101 | - switch ($confirmPayments["PAYMENTINFO_0_PENDINGREASON"]) { |
|
101 | + switch ($confirmPayments["PAYMENTINFO_0_PENDINGREASON"]) { |
|
102 | 102 | case 'address': |
103 | 103 | $purchaseStatus = $plugin->get_lang('PendingReasonByAddress'); |
104 | 104 | break; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | } |
165 | 165 | |
166 | 166 | $token = isset($_GET['token']) ? Security::remove_XSS($_GET['token']) : null; |
167 | -if (empty($token)) { |
|
167 | +if (empty($token)) { |
|
168 | 168 | api_not_allowed(true); |
169 | 169 | } |
170 | 170 |
@@ -2099,7 +2099,8 @@ |
||
2099 | 2099 | |
2100 | 2100 | // Remind unanswered is a special version of remind all reminder |
2101 | 2101 | $exclude_users = array(); |
2102 | - if ($remindUnAnswered == 1) { // Remind only unanswered users |
|
2102 | + if ($remindUnAnswered == 1) { |
|
2103 | +// Remind only unanswered users |
|
2103 | 2104 | $reminder = 1; |
2104 | 2105 | $exclude_users = SurveyManager::get_people_who_filled_survey($_GET['survey_id']); |
2105 | 2106 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | /** |
138 | 138 | * This function checks the parameters that are used in this page |
139 | 139 | * |
140 | - * @return string $people_filled The header, an error and the footer if any parameter fails, else it returns true |
|
140 | + * @return null|boolean $people_filled The header, an error and the footer if any parameter fails, else it returns true |
|
141 | 141 | * @author Patrick Cool <[email protected]>, Ghent University |
142 | 142 | * @version February 2007 |
143 | 143 | */ |
@@ -729,6 +729,7 @@ discard block |
||
729 | 729 | * Display score data about a survey question |
730 | 730 | * @param array Question info |
731 | 731 | * @param integer The offset of results shown |
732 | + * @param integer $offset |
|
732 | 733 | * @return void (direct output) |
733 | 734 | */ |
734 | 735 | public static function display_question_report_score($survey_data, $question, $offset) |
@@ -1431,7 +1432,7 @@ discard block |
||
1431 | 1432 | * Quite similar to display_complete_report(), returns an HTML string |
1432 | 1433 | * that can be used in a csv file |
1433 | 1434 | * @todo consider merging this function with display_complete_report |
1434 | - * @return string The contents of a csv file |
|
1435 | + * @return false|null The contents of a csv file |
|
1435 | 1436 | * @author Patrick Cool <[email protected]>, Ghent University |
1436 | 1437 | * @version February 2007 |
1437 | 1438 | */ |
@@ -2302,7 +2303,7 @@ discard block |
||
2302 | 2303 | |
2303 | 2304 | /** |
2304 | 2305 | * @param $params |
2305 | - * @return bool|int |
|
2306 | + * @return false|string |
|
2306 | 2307 | */ |
2307 | 2308 | public static function save_invitation($params) |
2308 | 2309 | { |
@@ -2358,6 +2359,7 @@ discard block |
||
2358 | 2359 | * |
2359 | 2360 | * @param int invitedUser - the userId (course user) or emailaddress of additional user |
2360 | 2361 | * $param string $invitation_code - the unique invitation code for the URL |
2362 | + * @param string|null $invitation_text |
|
2361 | 2363 | * @return void |
2362 | 2364 | */ |
2363 | 2365 | public static function send_invitation_mail( |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | Database::query($sql); |
128 | 128 | $insertId = Database::insert_id(); |
129 | 129 | |
130 | - $sql = "UPDATE $table_survey_answer SET answer_id = $insertId |
|
130 | + $sql = "update $table_survey_answer SET answer_id = $insertId |
|
131 | 131 | WHERE iid = $insertId"; |
132 | 132 | Database::query($sql); |
133 | 133 | |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | WHERE c_id = $course_id AND survey_id = '".$survey_id."' AND user = '".$user_id."'"; |
275 | 275 | Database::query($sql); |
276 | 276 | // update field answered from survey_invitation by user_id and survey_id |
277 | - $sql = "UPDATE $table_survey_invitation SET answered = '0' |
|
277 | + $sql = "update $table_survey_invitation SET answered = '0' |
|
278 | 278 | WHERE |
279 | 279 | c_id = $course_id AND |
280 | 280 | survey_code = ( |
@@ -2153,7 +2153,7 @@ discard block |
||
2153 | 2153 | $mail_field = 'reminder_mail'; |
2154 | 2154 | } |
2155 | 2155 | |
2156 | - $sql = "UPDATE $table_survey SET |
|
2156 | + $sql = "update $table_survey SET |
|
2157 | 2157 | mail_subject='".Database::escape_string($mail_subject)."', |
2158 | 2158 | $mail_field = '".Database::escape_string($mailtext)."' |
2159 | 2159 | WHERE c_id = $course_id AND survey_id = '".intval($_GET['survey_id'])."'"; |
@@ -2314,7 +2314,7 @@ discard block |
||
2314 | 2314 | ) { |
2315 | 2315 | $insertId = Database::insert($table, $params); |
2316 | 2316 | if ($insertId) { |
2317 | - $sql = "UPDATE $table |
|
2317 | + $sql = "update $table |
|
2318 | 2318 | SET survey_invitation_id = $insertId |
2319 | 2319 | WHERE iid = $insertId"; |
2320 | 2320 | Database::query($sql); |
@@ -2456,7 +2456,7 @@ discard block |
||
2456 | 2456 | $total_invited = $row['total']; |
2457 | 2457 | |
2458 | 2458 | // Updating the field in the survey table |
2459 | - $sql = "UPDATE $table_survey |
|
2459 | + $sql = "update $table_survey |
|
2460 | 2460 | SET invited = '".Database::escape_string($total_invited)."' |
2461 | 2461 | WHERE |
2462 | 2462 | c_id = $course_id AND |
@@ -880,7 +880,7 @@ |
||
880 | 880 | } |
881 | 881 | |
882 | 882 | if ($origin != 'learnpath') { |
883 | - echo '<div id="highlight-plugin" class="glossary-content">'; |
|
883 | + echo '<div id="highlight-plugin" class="glossary-content">'; |
|
884 | 884 | } |
885 | 885 | |
886 | 886 | if ($reminder == 2) { |
@@ -504,7 +504,7 @@ |
||
504 | 504 | // First we update the attempt to today |
505 | 505 | /* How the expired time is changed into "track_e_exercises" table, |
506 | 506 | then the last attempt for this student should be changed too */ |
507 | - $sql = "UPDATE $exercise_attempt_table SET |
|
507 | + $sql = "update $exercise_attempt_table SET |
|
508 | 508 | tms = '".api_get_utc_datetime()."' |
509 | 509 | WHERE |
510 | 510 | exe_id = '".$exercise_stat_info['exe_id']."' AND |
@@ -481,9 +481,15 @@ discard block |
||
481 | 481 | * If the expired time is major that zero(0) then the expired time is compute on this time. |
482 | 482 | */ |
483 | 483 | if ($time_control) { |
484 | - if ($debug) error_log('7.1. Time control is enabled'); |
|
485 | - if ($debug) error_log('7.2. $current_expired_time_key '.$current_expired_time_key); |
|
486 | - if ($debug) error_log('7.3. $_SESSION[expired_time][$current_expired_time_key] '.$_SESSION['expired_time'][$current_expired_time_key]); |
|
484 | + if ($debug) { |
|
485 | + error_log('7.1. Time control is enabled'); |
|
486 | + } |
|
487 | + if ($debug) { |
|
488 | + error_log('7.2. $current_expired_time_key '.$current_expired_time_key); |
|
489 | + } |
|
490 | + if ($debug) { |
|
491 | + error_log('7.3. $_SESSION[expired_time][$current_expired_time_key] '.$_SESSION['expired_time'][$current_expired_time_key]); |
|
492 | + } |
|
487 | 493 | |
488 | 494 | if (!isset($_SESSION['expired_time'][$current_expired_time_key])) { |
489 | 495 | //Timer - Get expired_time for a student |
@@ -548,7 +554,8 @@ discard block |
||
548 | 554 | * The time control feature is enable here - this feature is enable for a jquery plugin called epiclock |
549 | 555 | * for more details of how it works see this link : http://eric.garside.name/docs.html?p=epiclock |
550 | 556 | */ |
551 | -if ($time_control) { //Sends the exercise form when the expired time is finished |
|
557 | +if ($time_control) { |
|
558 | +//Sends the exercise form when the expired time is finished |
|
552 | 559 | $htmlHeadXtra[] = $objExercise->showTimeControlJS($time_left); |
553 | 560 | } |
554 | 561 | |
@@ -788,7 +795,8 @@ discard block |
||
788 | 795 | ); |
789 | 796 | $interbreadcrumb[] = array("url" => "#", "name" => $objExercise->selectTitle(true)); |
790 | 797 | |
791 | -if ($origin != 'learnpath') { //so we are not in learnpath tool |
|
798 | +if ($origin != 'learnpath') { |
|
799 | +//so we are not in learnpath tool |
|
792 | 800 | if (!api_is_allowed_to_session_edit()) { |
793 | 801 | Display::addFlash( |
794 | 802 | Display::return_message(get_lang('SessionIsReadOnly'), 'warning') |
@@ -675,7 +675,8 @@ discard block |
||
675 | 675 | $actionIcon2 = "delete"; |
676 | 676 | // We are in the course, question title can be a link to the question edit page |
677 | 677 | $questionTagA = 1; |
678 | - } else { // NOT IN A TEST - NOT IN THE COURSE |
|
678 | + } else { |
|
679 | +// NOT IN A TEST - NOT IN THE COURSE |
|
679 | 680 | $actionLabel = get_lang('Reuse'); |
680 | 681 | $actionIcon1 = get_lang('MustBeInATest'); |
681 | 682 | $actionIcon2 = ""; |
@@ -828,7 +829,8 @@ discard block |
||
828 | 829 | $in_questiontype, |
829 | 830 | $in_questionname, |
830 | 831 | $sessionId |
831 | -) { |
|
832 | +) |
|
833 | +{ |
|
832 | 834 | $res = $in_questionname; |
833 | 835 | $sessionIcon = null; |
834 | 836 | if ($in_addA) { |
@@ -868,7 +870,8 @@ discard block |
||
868 | 870 | $in_answerType, |
869 | 871 | $in_session_id, |
870 | 872 | $in_exercise_id |
871 | -) { |
|
873 | +) |
|
874 | +{ |
|
872 | 875 | $res = ""; |
873 | 876 | $getParams = "&selected_course=$in_selected_course&courseCategoryId=$in_courseCategoryId&exerciseId=$in_exercise_id&exerciseLevel=$in_exerciseLevel&answerType=$in_answerType&session_id=$in_session_id"; |
874 | 877 | switch ($in_action) { |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * Returns the name without extension, used for the title |
54 | 54 | * |
55 | 55 | * @param string $name |
56 | - * @return name without the extension |
|
56 | + * @return string without the extension |
|
57 | 57 | */ |
58 | 58 | function get_document_title($name) |
59 | 59 | { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * This function checks if the upload succeeded |
68 | 68 | * |
69 | 69 | * @param array $uploaded_file ($_FILES) |
70 | - * @return true if upload succeeded |
|
70 | + * @return boolean if upload succeeded |
|
71 | 71 | */ |
72 | 72 | function process_uploaded_file($uploaded_file, $show_output = true) |
73 | 73 | { |
@@ -1227,7 +1227,7 @@ discard block |
||
1227 | 1227 | * @param int $session_id Session ID, if any |
1228 | 1228 | * @param int $userId creator id |
1229 | 1229 | * |
1230 | - * @return int id if inserted document |
|
1230 | + * @return string|false id if inserted document |
|
1231 | 1231 | */ |
1232 | 1232 | function add_document( |
1233 | 1233 | $_course, |
@@ -1368,7 +1368,7 @@ discard block |
||
1368 | 1368 | * |
1369 | 1369 | * @author Olivier Cauberghe <[email protected]> |
1370 | 1370 | * @param path+filename eg: /main/document/document.php |
1371 | - * @return The directory depth |
|
1371 | + * @return integer directory depth |
|
1372 | 1372 | */ |
1373 | 1373 | function get_levels($filename) |
1374 | 1374 | { |
@@ -1386,6 +1386,8 @@ discard block |
||
1386 | 1386 | * @author Olivier Cauberghe <[email protected]> |
1387 | 1387 | * @param path,filename |
1388 | 1388 | * action: Adds an entry to the document table with the default settings. |
1389 | + * @param string $upload_path |
|
1390 | + * @param string $filename |
|
1389 | 1391 | */ |
1390 | 1392 | function set_default_settings($upload_path, $filename, $filetype = 'file') |
1391 | 1393 | { |
@@ -1844,7 +1846,6 @@ discard block |
||
1844 | 1846 | * @param int $groupId group.id |
1845 | 1847 | * @param bool $output |
1846 | 1848 | * @param array $parent |
1847 | - * @param string $uploadPath |
|
1848 | 1849 | * |
1849 | 1850 | */ |
1850 | 1851 | function add_all_documents_in_folder_to_database( |
@@ -223,7 +223,8 @@ discard block |
||
223 | 223 | $comment = null, |
224 | 224 | $sessionId = null, |
225 | 225 | $treat_spaces_as_hyphens = true |
226 | -) { |
|
226 | +) |
|
227 | +{ |
|
227 | 228 | if (!$userId) { |
228 | 229 | return false; |
229 | 230 | } |
@@ -985,7 +986,8 @@ discard block |
||
985 | 986 | - add it to the database |
986 | 987 | - parse & change relative html links |
987 | 988 | */ |
988 | - if (PHP_OS == 'Linux' && !get_cfg_var('safe_mode') && false) { // *** UGent, changed by OC *** |
|
989 | + if (PHP_OS == 'Linux' && !get_cfg_var('safe_mode') && false) { |
|
990 | +// *** UGent, changed by OC *** |
|
989 | 991 | // Shell Method - if this is possible, it gains some speed |
990 | 992 | exec("unzip -d \"".$base_work_dir.$upload_path."/\"".$uploaded_file['name']." ".$uploaded_file['tmp_name']); |
991 | 993 | } else { |
@@ -1004,7 +1006,9 @@ discard block |
||
1004 | 1006 | if ($file != '.' && $file != '..') { |
1005 | 1007 | |
1006 | 1008 | $filetype = 'file'; |
1007 | - if (is_dir($base_work_dir.$upload_path.'/'.$file)) $filetype = 'folder'; |
|
1009 | + if (is_dir($base_work_dir.$upload_path.'/'.$file)) { |
|
1010 | + $filetype = 'folder'; |
|
1011 | + } |
|
1008 | 1012 | |
1009 | 1013 | $safe_file = api_replace_dangerous_char($file); |
1010 | 1014 | @rename($base_work_dir.$upload_path.'/'.$file, $base_work_dir.$upload_path.'/'.$safe_file); |
@@ -1056,7 +1060,8 @@ discard block |
||
1056 | 1060 | $groupId = 0, |
1057 | 1061 | $output = true, |
1058 | 1062 | $onlyUploadFile = false |
1059 | -) { |
|
1063 | +) |
|
1064 | +{ |
|
1060 | 1065 | $zip = new PclZip($uploaded_file['tmp_name']); |
1061 | 1066 | |
1062 | 1067 | // Check the zip content (real size and file extension) |
@@ -1170,7 +1175,8 @@ discard block |
||
1170 | 1175 | return 1; // Authorize directories |
1171 | 1176 | } |
1172 | 1177 | $blacklist = api_get_setting('upload_extensions_list_type'); |
1173 | - if ($blacklist != 'whitelist') { // if = blacklist |
|
1178 | + if ($blacklist != 'whitelist') { |
|
1179 | +// if = blacklist |
|
1174 | 1180 | $extensions = explode(';', strtolower(api_get_setting('upload_extensions_blacklist'))); |
1175 | 1181 | |
1176 | 1182 | $skip = api_get_setting('upload_extensions_skip'); |
@@ -1241,7 +1247,8 @@ discard block |
||
1241 | 1247 | $group_id = null, |
1242 | 1248 | $session_id = 0, |
1243 | 1249 | $userId = 0 |
1244 | -) { |
|
1250 | +) |
|
1251 | +{ |
|
1245 | 1252 | $session_id = empty($session_id) ? api_get_session_id() : $session_id; |
1246 | 1253 | $userId = empty($userId) ? api_get_user_id() : $userId; |
1247 | 1254 | |
@@ -1509,7 +1516,8 @@ discard block |
||
1509 | 1516 | $title = null, |
1510 | 1517 | $visibility = null, |
1511 | 1518 | $generateNewNameIfExists = false |
1512 | -) { |
|
1519 | +) |
|
1520 | +{ |
|
1513 | 1521 | $course_id = $_course['real_id']; |
1514 | 1522 | $session_id = intval($session_id); |
1515 | 1523 | |
@@ -1683,7 +1691,8 @@ discard block |
||
1683 | 1691 | $to_group_id, |
1684 | 1692 | $to_user_id, |
1685 | 1693 | $max_filled_space |
1686 | -) { |
|
1694 | +) |
|
1695 | +{ |
|
1687 | 1696 | $number_of_uploaded_images = count($uploaded_file_collection['name']); |
1688 | 1697 | $new_file_list = array(); |
1689 | 1698 | for ($i = 0; $i < $number_of_uploaded_images; $i++) { |
@@ -1856,7 +1865,8 @@ discard block |
||
1856 | 1865 | $groupId = 0, |
1857 | 1866 | $output = false, |
1858 | 1867 | $parent = array() |
1859 | -) { |
|
1868 | +) |
|
1869 | +{ |
|
1860 | 1870 | if (empty($userInfo) || empty($courseInfo)) { |
1861 | 1871 | |
1862 | 1872 | return false; |
@@ -1261,7 +1261,7 @@ discard block |
||
1261 | 1261 | ]; |
1262 | 1262 | $documentId = Database::insert($table_document, $params); |
1263 | 1263 | if ($documentId) { |
1264 | - $sql = "UPDATE $table_document SET id = iid WHERE iid = $documentId"; |
|
1264 | + $sql = "update $table_document SET id = iid WHERE iid = $documentId"; |
|
1265 | 1265 | Database::query($sql); |
1266 | 1266 | |
1267 | 1267 | if ($save_visibility) { |
@@ -1299,7 +1299,7 @@ discard block |
||
1299 | 1299 | $readonly = intval($readonly); |
1300 | 1300 | $course_id = $_course['real_id']; |
1301 | 1301 | |
1302 | - $sql = "UPDATE $document_table SET |
|
1302 | + $sql = "update $document_table SET |
|
1303 | 1303 | size = '$filesize', |
1304 | 1304 | readonly = '$readonly' |
1305 | 1305 | WHERE c_id = $course_id AND id = $documentId"; |
@@ -1351,7 +1351,7 @@ discard block |
||
1351 | 1351 | $folder_id = DocumentManager::get_document_id($_course, $newpath); |
1352 | 1352 | |
1353 | 1353 | if ($folder_id) { |
1354 | - $sql = "UPDATE $table SET |
|
1354 | + $sql = "update $table SET |
|
1355 | 1355 | lastedit_date = '$time', |
1356 | 1356 | lastedit_type = 'DocumentInFolderUpdated', |
1357 | 1357 | lastedit_user_id='$user_id' |
@@ -1419,7 +1419,7 @@ discard block |
||
1419 | 1419 | $result = Database::query($query); |
1420 | 1420 | $row = Database::fetch_array($result); |
1421 | 1421 | if ($row['bestaat'] > 0) { |
1422 | - $query = "UPDATE $dbTable SET |
|
1422 | + $query = "update $dbTable SET |
|
1423 | 1423 | path='$upload_path/$filename', |
1424 | 1424 | visibility='$default_visibility', |
1425 | 1425 | filetype='$filetype' |
@@ -2617,6 +2617,9 @@ |
||
2617 | 2617 | ) |
2618 | 2618 | ); |
2619 | 2619 | |
2620 | +/** |
|
2621 | + * @param string $type |
|
2622 | + */ |
|
2620 | 2623 | function WSHelperActionOnUsers($params, $type) |
2621 | 2624 | { |
2622 | 2625 | if (!WSHelperVerifyKey($params)) { |
@@ -576,7 +576,9 @@ discard block |
||
576 | 576 | |
577 | 577 | // First check wether the login already exists |
578 | 578 | if (!UserManager::is_username_available($loginName)) { |
579 | - if ($debug) error_log("Username $loginName is not available"); |
|
579 | + if ($debug) { |
|
580 | + error_log("Username $loginName is not available"); |
|
581 | + } |
|
580 | 582 | return 0; |
581 | 583 | } |
582 | 584 | |
@@ -1084,9 +1086,15 @@ discard block |
||
1084 | 1086 | ); |
1085 | 1087 | } |
1086 | 1088 | |
1087 | - if ($debug) error_log('$userId found: '.$userId); |
|
1088 | - if ($debug) error_log('$courseId found: '.$courseId); |
|
1089 | - if ($debug) error_log('$sessionId found: '.$sessionId); |
|
1089 | + if ($debug) { |
|
1090 | + error_log('$userId found: '.$userId); |
|
1091 | + } |
|
1092 | + if ($debug) { |
|
1093 | + error_log('$courseId found: '.$courseId); |
|
1094 | + } |
|
1095 | + if ($debug) { |
|
1096 | + error_log('$sessionId found: '.$sessionId); |
|
1097 | + } |
|
1090 | 1098 | |
1091 | 1099 | return [ |
1092 | 1100 | 'user_id' => $userId, |
@@ -1115,13 +1123,17 @@ discard block |
||
1115 | 1123 | function WSSubscribeTeacherToSessionCourse($params) |
1116 | 1124 | { |
1117 | 1125 | global $debug; |
1118 | - if ($debug) error_log('WSSubscribeTeacherToSessionCourse'); |
|
1126 | + if ($debug) { |
|
1127 | + error_log('WSSubscribeTeacherToSessionCourse'); |
|
1128 | + } |
|
1119 | 1129 | |
1120 | 1130 | if (!WSHelperVerifyKey($params)) { |
1121 | 1131 | return returnError(WS_ERROR_SECRET_KEY); |
1122 | 1132 | } |
1123 | 1133 | |
1124 | - if ($debug) error_log('Params '.print_r($params, 1)); |
|
1134 | + if ($debug) { |
|
1135 | + error_log('Params '.print_r($params, 1)); |
|
1136 | + } |
|
1125 | 1137 | |
1126 | 1138 | $params = parseCourseSessionUserParams($params); |
1127 | 1139 | |
@@ -1134,13 +1146,17 @@ discard block |
||
1134 | 1146 | $result = 0; |
1135 | 1147 | |
1136 | 1148 | if (!empty($coaches)) { |
1137 | - if ($debug) error_log('Coaches: '.print_r($coaches, 1)); |
|
1149 | + if ($debug) { |
|
1150 | + error_log('Coaches: '.print_r($coaches, 1)); |
|
1151 | + } |
|
1138 | 1152 | if (in_array($userId, $coaches)) { |
1139 | 1153 | $result = 1; |
1140 | 1154 | } |
1141 | 1155 | } |
1142 | 1156 | |
1143 | - if ($debug) error_log('Result: '.$result); |
|
1157 | + if ($debug) { |
|
1158 | + error_log('Result: '.$result); |
|
1159 | + } |
|
1144 | 1160 | |
1145 | 1161 | return $result; |
1146 | 1162 | } |
@@ -1166,13 +1182,17 @@ discard block |
||
1166 | 1182 | { |
1167 | 1183 | global $debug; |
1168 | 1184 | |
1169 | - if ($debug) error_log('WSSubscribeTeacherToSessionCourse'); |
|
1185 | + if ($debug) { |
|
1186 | + error_log('WSSubscribeTeacherToSessionCourse'); |
|
1187 | + } |
|
1170 | 1188 | |
1171 | 1189 | if (!WSHelperVerifyKey($params)) { |
1172 | 1190 | return returnError(WS_ERROR_SECRET_KEY); |
1173 | 1191 | } |
1174 | 1192 | |
1175 | - if ($debug) error_log('Params '.print_r($params, 1)); |
|
1193 | + if ($debug) { |
|
1194 | + error_log('Params '.print_r($params, 1)); |
|
1195 | + } |
|
1176 | 1196 | |
1177 | 1197 | $params = parseCourseSessionUserParams($params); |
1178 | 1198 | |
@@ -1186,7 +1206,9 @@ discard block |
||
1186 | 1206 | $result = 0; |
1187 | 1207 | |
1188 | 1208 | if (!empty($coaches)) { |
1189 | - if ($debug) error_log('Coaches: '.print_r($coaches, 1)); |
|
1209 | + if ($debug) { |
|
1210 | + error_log('Coaches: '.print_r($coaches, 1)); |
|
1211 | + } |
|
1190 | 1212 | if (!in_array($userId, $coaches)) { |
1191 | 1213 | $result = 1; |
1192 | 1214 | } |
@@ -1194,7 +1216,9 @@ discard block |
||
1194 | 1216 | $result = 1; |
1195 | 1217 | } |
1196 | 1218 | |
1197 | - if ($debug) error_log('Final Result: '.$result); |
|
1219 | + if ($debug) { |
|
1220 | + error_log('Final Result: '.$result); |
|
1221 | + } |
|
1198 | 1222 | |
1199 | 1223 | return $result; |
1200 | 1224 | } |
@@ -1247,8 +1271,12 @@ discard block |
||
1247 | 1271 | { |
1248 | 1272 | global $_user, $_configuration, $debug; |
1249 | 1273 | $debug = 1; |
1250 | - if ($debug) error_log('WSCreateUserPasswordCrypted'); |
|
1251 | - if ($debug) error_log(print_r($params, 1)); |
|
1274 | + if ($debug) { |
|
1275 | + error_log('WSCreateUserPasswordCrypted'); |
|
1276 | + } |
|
1277 | + if ($debug) { |
|
1278 | + error_log(print_r($params, 1)); |
|
1279 | + } |
|
1252 | 1280 | |
1253 | 1281 | if (!WSHelperVerifyKey($params)) { |
1254 | 1282 | return returnError(WS_ERROR_SECRET_KEY); |
@@ -1280,22 +1308,30 @@ discard block |
||
1280 | 1308 | if ($_configuration['password_encryption'] === $encrypt_method) { |
1281 | 1309 | if ($encrypt_method == 'md5' && !preg_match('/^[A-Fa-f0-9]{32}$/', $password)) { |
1282 | 1310 | $msg = "Encryption $encrypt_method is invalid"; |
1283 | - if ($debug) error_log($msg); |
|
1311 | + if ($debug) { |
|
1312 | + error_log($msg); |
|
1313 | + } |
|
1284 | 1314 | return $msg; |
1285 | 1315 | |
1286 | 1316 | } elseif ($encrypt_method == 'sha1' && !preg_match('/^[A-Fa-f0-9]{40}$/', $password)) { |
1287 | 1317 | $msg = "Encryption $encrypt_method is invalid"; |
1288 | - if ($debug) error_log($msg); |
|
1318 | + if ($debug) { |
|
1319 | + error_log($msg); |
|
1320 | + } |
|
1289 | 1321 | return $msg; |
1290 | 1322 | } |
1291 | 1323 | } else { |
1292 | 1324 | $msg = "This encryption $encrypt_method is not configured"; |
1293 | - if ($debug) error_log($msg); |
|
1325 | + if ($debug) { |
|
1326 | + error_log($msg); |
|
1327 | + } |
|
1294 | 1328 | return $msg; |
1295 | 1329 | } |
1296 | 1330 | } else { |
1297 | 1331 | $msg = 'The chamilo setting $_configuration["password_encryption"] is not configured'; |
1298 | - if ($debug) error_log($msg); |
|
1332 | + if ($debug) { |
|
1333 | + error_log($msg); |
|
1334 | + } |
|
1299 | 1335 | return $msg; |
1300 | 1336 | } |
1301 | 1337 | |
@@ -1315,10 +1351,14 @@ discard block |
||
1315 | 1351 | $original_user_id_name |
1316 | 1352 | ); |
1317 | 1353 | |
1318 | - if ($debug) error_log('Ready to create user'); |
|
1354 | + if ($debug) { |
|
1355 | + error_log('Ready to create user'); |
|
1356 | + } |
|
1319 | 1357 | |
1320 | 1358 | if ($user_id > 0) { |
1321 | - if ($debug) error_log('User found with id: '.$user_id); |
|
1359 | + if ($debug) { |
|
1360 | + error_log('User found with id: '.$user_id); |
|
1361 | + } |
|
1322 | 1362 | |
1323 | 1363 | // Check whether user is not active |
1324 | 1364 | //@todo why this condition exists?? |
@@ -1328,7 +1368,9 @@ discard block |
||
1328 | 1368 | $r_check_user = Database::fetch_row($resu); |
1329 | 1369 | $count_check_user = Database::num_rows($resu); |
1330 | 1370 | if ($count_check_user > 0) { |
1331 | - if ($debug) error_log('User id: '.$user_id.' exists and is NOT active. Updating user and setting setting active = 1'); |
|
1371 | + if ($debug) { |
|
1372 | + error_log('User id: '.$user_id.' exists and is NOT active. Updating user and setting setting active = 1'); |
|
1373 | + } |
|
1332 | 1374 | $sql = "UPDATE $table_user SET |
1333 | 1375 | lastname='".Database::escape_string($lastName)."', |
1334 | 1376 | firstname='".Database::escape_string($firstName)."', |
@@ -1364,11 +1406,15 @@ discard block |
||
1364 | 1406 | } |
1365 | 1407 | return $r_check_user[0]; |
1366 | 1408 | } else { |
1367 | - if ($debug) error_log('User exists but is active. Cant be updated'); |
|
1409 | + if ($debug) { |
|
1410 | + error_log('User exists but is active. Cant be updated'); |
|
1411 | + } |
|
1368 | 1412 | return 0; |
1369 | 1413 | } |
1370 | 1414 | } else { |
1371 | - if ($debug) error_log("User not found with original_id = $original_user_id_value and original_name = $original_user_id_name"); |
|
1415 | + if ($debug) { |
|
1416 | + error_log("User not found with original_id = $original_user_id_value and original_name = $original_user_id_name"); |
|
1417 | + } |
|
1372 | 1418 | } |
1373 | 1419 | |
1374 | 1420 | // Default language. |
@@ -1384,12 +1430,16 @@ discard block |
||
1384 | 1430 | |
1385 | 1431 | // First check wether the login already exists |
1386 | 1432 | if (!UserManager::is_username_available($loginName)) { |
1387 | - if ($debug) error_log("Username $loginName is not available"); |
|
1433 | + if ($debug) { |
|
1434 | + error_log("Username $loginName is not available"); |
|
1435 | + } |
|
1388 | 1436 | return 0; |
1389 | 1437 | } |
1390 | 1438 | |
1391 | 1439 | $queryExpirationDate = ''; |
1392 | - if (!empty($params['expiration_date'])) $queryExpirationDate = "expiration_date = '".Database::escape_string($expiration_date)."', "; |
|
1440 | + if (!empty($params['expiration_date'])) { |
|
1441 | + $queryExpirationDate = "expiration_date = '".Database::escape_string($expiration_date)."', "; |
|
1442 | + } |
|
1393 | 1443 | |
1394 | 1444 | $sql = "INSERT INTO $table_user SET |
1395 | 1445 | lastname = '".Database::escape_string(trim($lastName))."', |
@@ -1419,7 +1469,9 @@ discard block |
||
1419 | 1469 | |
1420 | 1470 | $url_id = api_get_current_access_url_id(); |
1421 | 1471 | UrlManager::add_user_to_url($return, $url_id); |
1422 | - if ($debug) error_log("Adding user_id = $return to URL id $url_id "); |
|
1472 | + if ($debug) { |
|
1473 | + error_log("Adding user_id = $return to URL id $url_id "); |
|
1474 | + } |
|
1423 | 1475 | |
1424 | 1476 | // Create extra field for the original_user_id_name |
1425 | 1477 | UserManager::create_extra_field( |
@@ -1456,7 +1508,9 @@ discard block |
||
1456 | 1508 | } |
1457 | 1509 | } |
1458 | 1510 | } else { |
1459 | - if ($debug) error_log('Error while inserting a user'); |
|
1511 | + if ($debug) { |
|
1512 | + error_log('Error while inserting a user'); |
|
1513 | + } |
|
1460 | 1514 | |
1461 | 1515 | return 0; |
1462 | 1516 | } |
@@ -2947,10 +3001,12 @@ discard block |
||
2947 | 3001 | $params['visibility'] = $visibility; |
2948 | 3002 | $params['disk_quota'] = $diskQuota; |
2949 | 3003 | |
2950 | - if (isset($subscribe) && $subscribe != '') { // Valid values: 0, 1 |
|
3004 | + if (isset($subscribe) && $subscribe != '') { |
|
3005 | +// Valid values: 0, 1 |
|
2951 | 3006 | $params['subscribe'] = $subscribe; |
2952 | 3007 | } |
2953 | - if (isset($unsubscribe) && $subscribe != '') { // Valid values: 0, 1 |
|
3008 | + if (isset($unsubscribe) && $subscribe != '') { |
|
3009 | +// Valid values: 0, 1 |
|
2954 | 3010 | $params['unsubscribe'] = $unsubscribe; |
2955 | 3011 | } |
2956 | 3012 | |
@@ -3327,7 +3383,8 @@ discard block |
||
3327 | 3383 | ); |
3328 | 3384 | |
3329 | 3385 | // Define the method WSEditCourse |
3330 | -function WSEditCourse($params) { |
|
3386 | +function WSEditCourse($params) |
|
3387 | +{ |
|
3331 | 3388 | |
3332 | 3389 | global $_configuration; |
3333 | 3390 | if (!WSHelperVerifyKey($params)) { |
@@ -4250,7 +4307,8 @@ discard block |
||
4250 | 4307 | if (empty($name)) { |
4251 | 4308 | $results[] = 0; //SessionNameIsRequired |
4252 | 4309 | continue; |
4253 | - } elseif (empty($id_coach)) { // Session must have coach |
|
4310 | + } elseif (empty($id_coach)) { |
|
4311 | +// Session must have coach |
|
4254 | 4312 | $results[] = 0; |
4255 | 4313 | continue; |
4256 | 4314 | } elseif (empty($nolimit) && (!$month_start || !$day_start || !$year_start || !checkdate($month_start, $day_start, $year_start))) { |
@@ -4545,12 +4603,15 @@ discard block |
||
4545 | 4603 | ); |
4546 | 4604 | |
4547 | 4605 | // define the method WSSubscribeUserToCourse |
4548 | -function WSSubscribeUserToCourse($params) { |
|
4606 | +function WSSubscribeUserToCourse($params) |
|
4607 | +{ |
|
4549 | 4608 | global $debug; |
4550 | 4609 | if (!WSHelperVerifyKey($params)) { |
4551 | 4610 | return returnError(WS_ERROR_SECRET_KEY); |
4552 | 4611 | } |
4553 | - if ($debug) error_log('WSSubscribeUserToCourse params: '.print_r($params, 1)); |
|
4612 | + if ($debug) { |
|
4613 | + error_log('WSSubscribeUserToCourse params: '.print_r($params, 1)); |
|
4614 | + } |
|
4554 | 4615 | |
4555 | 4616 | $results = array(); |
4556 | 4617 | $userscourses = $params['userscourses']; |
@@ -4569,7 +4630,9 @@ discard block |
||
4569 | 4630 | $original_user_id['original_user_id_value'], |
4570 | 4631 | $original_user_id['original_user_id_name'] |
4571 | 4632 | ); |
4572 | - if ($debug) error_log('WSSubscribeUserToCourse user_id: '.$user_id); |
|
4633 | + if ($debug) { |
|
4634 | + error_log('WSSubscribeUserToCourse user_id: '.$user_id); |
|
4635 | + } |
|
4573 | 4636 | |
4574 | 4637 | if ($user_id == 0) { |
4575 | 4638 | // If user was not found, there was a problem |
@@ -4587,13 +4650,19 @@ discard block |
||
4587 | 4650 | // Course was not found |
4588 | 4651 | $resultValue = 0; |
4589 | 4652 | } else { |
4590 | - if ($debug) error_log('WSSubscribeUserToCourse courseCode: '.$courseCode); |
|
4653 | + if ($debug) { |
|
4654 | + error_log('WSSubscribeUserToCourse courseCode: '.$courseCode); |
|
4655 | + } |
|
4591 | 4656 | $result = CourseManager::add_user_to_course($user_id, $courseCode, $status, false); |
4592 | 4657 | if ($result) { |
4593 | 4658 | $resultValue = 1; |
4594 | - if ($debug) error_log('WSSubscribeUserToCourse subscribed'); |
|
4659 | + if ($debug) { |
|
4660 | + error_log('WSSubscribeUserToCourse subscribed'); |
|
4661 | + } |
|
4595 | 4662 | } else { |
4596 | - if ($debug) error_log('WSSubscribeUserToCourse NOT subscribed: '); |
|
4663 | + if ($debug) { |
|
4664 | + error_log('WSSubscribeUserToCourse NOT subscribed: '); |
|
4665 | + } |
|
4597 | 4666 | } |
4598 | 4667 | } |
4599 | 4668 | } |
@@ -4649,11 +4718,16 @@ discard block |
||
4649 | 4718 | ); |
4650 | 4719 | |
4651 | 4720 | // define the method WSSubscribeUserToCourse |
4652 | -function WSSubscribeUserToCourseSimple($params) { |
|
4721 | +function WSSubscribeUserToCourseSimple($params) |
|
4722 | +{ |
|
4653 | 4723 | global $debug; |
4654 | 4724 | |
4655 | - if ($debug) error_log('WSSubscribeUserToCourseSimple'); |
|
4656 | - if ($debug) error_log('Params '.print_r($params, 1)); |
|
4725 | + if ($debug) { |
|
4726 | + error_log('WSSubscribeUserToCourseSimple'); |
|
4727 | + } |
|
4728 | + if ($debug) { |
|
4729 | + error_log('Params '.print_r($params, 1)); |
|
4730 | + } |
|
4657 | 4731 | if (!WSHelperVerifyKey($params)) { |
4658 | 4732 | return returnError(WS_ERROR_SECRET_KEY); |
4659 | 4733 | } |
@@ -4671,7 +4745,9 @@ discard block |
||
4671 | 4745 | if (empty($user_data)) { |
4672 | 4746 | // If user was not found, there was a problem |
4673 | 4747 | $result = "User $user_id does not exist"; |
4674 | - if ($debug) error_log($result); |
|
4748 | + if ($debug) { |
|
4749 | + error_log($result); |
|
4750 | + } |
|
4675 | 4751 | return $result; |
4676 | 4752 | } |
4677 | 4753 | if (!empty($course_code)) { |
@@ -4679,14 +4755,22 @@ discard block |
||
4679 | 4755 | if (empty($course_data)) { |
4680 | 4756 | // Course was not found |
4681 | 4757 | $result = "Course $course_code does not exist in the platform "; |
4682 | - if ($debug) error_log($result); |
|
4758 | + if ($debug) { |
|
4759 | + error_log($result); |
|
4760 | + } |
|
4683 | 4761 | } else { |
4684 | - if ($debug) error_log('Try to register: user_id= '.$user_id.' to course: '.$course_data['code']); |
|
4762 | + if ($debug) { |
|
4763 | + error_log('Try to register: user_id= '.$user_id.' to course: '.$course_data['code']); |
|
4764 | + } |
|
4685 | 4765 | if (!CourseManager::add_user_to_course($user_id, $course_data['code'], $status)) { |
4686 | 4766 | $result = 'User was not registered possible reasons: User already registered to the course, Course visibility doesnt allow user subscriptions '; |
4687 | - if ($debug) error_log($result); |
|
4767 | + if ($debug) { |
|
4768 | + error_log($result); |
|
4769 | + } |
|
4688 | 4770 | } else { |
4689 | - if ($debug) error_log('User registered to the course: '.$course_data['code']); |
|
4771 | + if ($debug) { |
|
4772 | + error_log('User registered to the course: '.$course_data['code']); |
|
4773 | + } |
|
4690 | 4774 | $result = 1; |
4691 | 4775 | } |
4692 | 4776 | } |
@@ -4737,8 +4821,12 @@ discard block |
||
4737 | 4821 | function WSGetUser($params) |
4738 | 4822 | { |
4739 | 4823 | global $debug; |
4740 | - if ($debug) error_log('WSGetUser'); |
|
4741 | - if ($debug) error_log('$params: '.print_r($params, 1)); |
|
4824 | + if ($debug) { |
|
4825 | + error_log('WSGetUser'); |
|
4826 | + } |
|
4827 | + if ($debug) { |
|
4828 | + error_log('$params: '.print_r($params, 1)); |
|
4829 | + } |
|
4742 | 4830 | |
4743 | 4831 | if (!WSHelperVerifyKey($params)) { |
4744 | 4832 | return returnError(WS_ERROR_SECRET_KEY); |
@@ -4793,8 +4881,12 @@ discard block |
||
4793 | 4881 | function WSGetUserFromUsername($params) |
4794 | 4882 | { |
4795 | 4883 | global $debug; |
4796 | - if ($debug) error_log('WSGetUserFromUsername'); |
|
4797 | - if ($debug) error_log('$params: '.print_r($params, 1)); |
|
4884 | + if ($debug) { |
|
4885 | + error_log('WSGetUserFromUsername'); |
|
4886 | + } |
|
4887 | + if ($debug) { |
|
4888 | + error_log('$params: '.print_r($params, 1)); |
|
4889 | + } |
|
4798 | 4890 | |
4799 | 4891 | if (!WSHelperVerifyKey($params)) { |
4800 | 4892 | return returnError(WS_ERROR_SECRET_KEY); |
@@ -5271,7 +5363,9 @@ discard block |
||
5271 | 5363 | ); |
5272 | 5364 | $results[] = 1; |
5273 | 5365 | |
5274 | - if ($debug) error_log("subscribe user:$user_id to session $sessionId"); |
|
5366 | + if ($debug) { |
|
5367 | + error_log("subscribe user:$user_id to session $sessionId"); |
|
5368 | + } |
|
5275 | 5369 | } |
5276 | 5370 | } |
5277 | 5371 | } // end principal foreach |
@@ -5312,7 +5406,8 @@ discard block |
||
5312 | 5406 | 'encoded', // use |
5313 | 5407 | 'This service subscribes a user to a session in a simple way' // documentation |
5314 | 5408 | ); |
5315 | -function WSSubscribeUserToSessionSimple($params) { |
|
5409 | +function WSSubscribeUserToSessionSimple($params) |
|
5410 | +{ |
|
5316 | 5411 | global $debug; |
5317 | 5412 | |
5318 | 5413 | if ($debug) { |
@@ -5355,7 +5450,9 @@ discard block |
||
5355 | 5450 | SESSION_VISIBLE_READ_ONLY, |
5356 | 5451 | false |
5357 | 5452 | ); |
5358 | - if ($debug) error_log('User registered to the course: '.$session_id); |
|
5453 | + if ($debug) { |
|
5454 | + error_log('User registered to the course: '.$session_id); |
|
5455 | + } |
|
5359 | 5456 | $result = 1; |
5360 | 5457 | } |
5361 | 5458 | } |
@@ -5503,7 +5600,9 @@ discard block |
||
5503 | 5600 | |
5504 | 5601 | $results[] = 1; |
5505 | 5602 | |
5506 | - if ($debug) error_log("Unsubscribe user:$user_id to session:$id_session"); |
|
5603 | + if ($debug) { |
|
5604 | + error_log("Unsubscribe user:$user_id to session:$id_session"); |
|
5605 | + } |
|
5507 | 5606 | } |
5508 | 5607 | } |
5509 | 5608 | } // end principal foreach |
@@ -5650,7 +5749,9 @@ discard block |
||
5650 | 5749 | return returnError(WS_ERROR_SECRET_KEY); |
5651 | 5750 | } |
5652 | 5751 | |
5653 | - if ($debug) error_log('WSSuscribeCoursesToSession: '.print_r($params, 1)); |
|
5752 | + if ($debug) { |
|
5753 | + error_log('WSSuscribeCoursesToSession: '.print_r($params, 1)); |
|
5754 | + } |
|
5654 | 5755 | |
5655 | 5756 | $coursessessions_params = $params['coursessessions']; |
5656 | 5757 | $results = array(); |
@@ -5696,7 +5797,9 @@ discard block |
||
5696 | 5797 | array($courseInfo['real_id']), |
5697 | 5798 | false |
5698 | 5799 | ); |
5699 | - if ($debug) error_log("add_courses_to_session: course:$courseCode to session:$sessionId"); |
|
5800 | + if ($debug) { |
|
5801 | + error_log("add_courses_to_session: course:$courseCode to session:$sessionId"); |
|
5802 | + } |
|
5700 | 5803 | |
5701 | 5804 | $results[] = 1; |
5702 | 5805 | } |
@@ -6966,12 +7069,15 @@ discard block |
||
6966 | 7069 | ); |
6967 | 7070 | |
6968 | 7071 | // define the method WSRegisterUserVisibilityToCourseInCatalogue |
6969 | -function WSAddUserVisibilityToCourseInCatalogue($params) { |
|
7072 | +function WSAddUserVisibilityToCourseInCatalogue($params) |
|
7073 | +{ |
|
6970 | 7074 | global $debug; |
6971 | 7075 | if (!WSHelperVerifyKey($params)) { |
6972 | 7076 | return returnError(WS_ERROR_SECRET_KEY); |
6973 | 7077 | } |
6974 | - if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue params: '.print_r($params, 1)); |
|
7078 | + if ($debug) { |
|
7079 | + error_log('WSAddUserVisibilityToCourseCatalogue params: '.print_r($params, 1)); |
|
7080 | + } |
|
6975 | 7081 | |
6976 | 7082 | $results = array(); |
6977 | 7083 | $userscourses = $params['userscourses']; |
@@ -6987,7 +7093,9 @@ discard block |
||
6987 | 7093 | $original_user_id['original_user_id_value'], |
6988 | 7094 | $original_user_id['original_user_id_name'] |
6989 | 7095 | ); |
6990 | - if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue userId: '.$userId); |
|
7096 | + if ($debug) { |
|
7097 | + error_log('WSAddUserVisibilityToCourseCatalogue userId: '.$userId); |
|
7098 | + } |
|
6991 | 7099 | |
6992 | 7100 | if ($userId == 0) { |
6993 | 7101 | // If user was not found, there was a problem |
@@ -7004,13 +7112,19 @@ discard block |
||
7004 | 7112 | // Course was not found |
7005 | 7113 | $resultValue = 0; |
7006 | 7114 | } else { |
7007 | - if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue courseCode: '.$courseCode); |
|
7115 | + if ($debug) { |
|
7116 | + error_log('WSAddUserVisibilityToCourseCatalogue courseCode: '.$courseCode); |
|
7117 | + } |
|
7008 | 7118 | $result = CourseManager::addUserVisibilityToCourseInCatalogue($userId, $courseCode, $visible); |
7009 | 7119 | if ($result) { |
7010 | 7120 | $resultValue = 1; |
7011 | - if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue registered'); |
|
7121 | + if ($debug) { |
|
7122 | + error_log('WSAddUserVisibilityToCourseCatalogue registered'); |
|
7123 | + } |
|
7012 | 7124 | } else { |
7013 | - if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue NOT registered: '); |
|
7125 | + if ($debug) { |
|
7126 | + error_log('WSAddUserVisibilityToCourseCatalogue NOT registered: '); |
|
7127 | + } |
|
7014 | 7128 | } |
7015 | 7129 | } |
7016 | 7130 | } |
@@ -7038,12 +7152,15 @@ discard block |
||
7038 | 7152 | ); |
7039 | 7153 | |
7040 | 7154 | // define the method WSRemoveUserVisibilityToCourseInCatalogue |
7041 | -function WSRemoveUserVisibilityToCourseInCatalogue($params) { |
|
7155 | +function WSRemoveUserVisibilityToCourseInCatalogue($params) |
|
7156 | +{ |
|
7042 | 7157 | global $debug; |
7043 | 7158 | if (!WSHelperVerifyKey($params)) { |
7044 | 7159 | return returnError(WS_ERROR_SECRET_KEY); |
7045 | 7160 | } |
7046 | - if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue params: '.print_r($params, 1)); |
|
7161 | + if ($debug) { |
|
7162 | + error_log('WSRemoveUserVisibilityToCourseInCatalogue params: '.print_r($params, 1)); |
|
7163 | + } |
|
7047 | 7164 | |
7048 | 7165 | $results = array(); |
7049 | 7166 | $userscourses = $params['userscourses']; |
@@ -7059,7 +7176,9 @@ discard block |
||
7059 | 7176 | $original_user_id['original_user_id_value'], |
7060 | 7177 | $original_user_id['original_user_id_name'] |
7061 | 7178 | ); |
7062 | - if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue user_id: '.$userId); |
|
7179 | + if ($debug) { |
|
7180 | + error_log('WSRemoveUserVisibilityToCourseInCatalogue user_id: '.$userId); |
|
7181 | + } |
|
7063 | 7182 | |
7064 | 7183 | if ($userId == 0) { |
7065 | 7184 | // If user was not found, there was a problem |
@@ -7076,13 +7195,19 @@ discard block |
||
7076 | 7195 | // Course was not found |
7077 | 7196 | $resultValue = 0; |
7078 | 7197 | } else { |
7079 | - if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue courseCode: '.$courseCode); |
|
7198 | + if ($debug) { |
|
7199 | + error_log('WSRemoveUserVisibilityToCourseInCatalogue courseCode: '.$courseCode); |
|
7200 | + } |
|
7080 | 7201 | $result = CourseManager::removeUserVisibilityToCourseInCatalogue($userId, $courseCode, $visible); |
7081 | 7202 | if ($result) { |
7082 | 7203 | $resultValue = 1; |
7083 | - if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue removed'); |
|
7204 | + if ($debug) { |
|
7205 | + error_log('WSRemoveUserVisibilityToCourseInCatalogue removed'); |
|
7206 | + } |
|
7084 | 7207 | } else { |
7085 | - if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue NOT removed: '); |
|
7208 | + if ($debug) { |
|
7209 | + error_log('WSRemoveUserVisibilityToCourseInCatalogue NOT removed: '); |
|
7210 | + } |
|
7086 | 7211 | } |
7087 | 7212 | } |
7088 | 7213 | } |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | |
577 | 577 | // First check wether the login already exists |
578 | 578 | if (!UserManager::is_username_available($loginName)) { |
579 | - if ($debug) error_log("Username $loginName is not available"); |
|
579 | + if ($debug) error_log("username $loginName is not available"); |
|
580 | 580 | return 0; |
581 | 581 | } |
582 | 582 | |
@@ -808,11 +808,11 @@ discard block |
||
808 | 808 | if (!empty($_configuration['password_encryption'])) { |
809 | 809 | if ($_configuration['password_encryption'] === $encrypt_method) { |
810 | 810 | if ($encrypt_method == 'md5' && !preg_match('/^[A-Fa-f0-9]{32}$/', $password)) { |
811 | - $msg = "Encryption $encrypt_method is invalid"; |
|
811 | + $msg = "encryption $encrypt_method is invalid"; |
|
812 | 812 | $results[] = $msg; |
813 | 813 | continue; |
814 | 814 | } else if ($encrypt_method == 'sha1' && !preg_match('/^[A-Fa-f0-9]{40}$/', $password)) { |
815 | - $msg = "Encryption $encrypt_method is invalid"; |
|
815 | + $msg = "encryption $encrypt_method is invalid"; |
|
816 | 816 | $results[] = $msg; |
817 | 817 | continue; |
818 | 818 | } |
@@ -867,7 +867,7 @@ discard block |
||
867 | 867 | $r_check_user = Database::fetch_row($resu); |
868 | 868 | $count_check_user = Database::num_rows($resu); |
869 | 869 | if ($count_check_user > 0) { |
870 | - $sql = "UPDATE $table_user SET |
|
870 | + $sql = "update $table_user SET |
|
871 | 871 | lastname='".Database::escape_string($lastName)."', |
872 | 872 | firstname='".Database::escape_string($firstName)."', |
873 | 873 | username='".Database::escape_string($loginName)."',"; |
@@ -947,7 +947,7 @@ discard block |
||
947 | 947 | //echo "id returned"; |
948 | 948 | $return = Database::insert_id(); |
949 | 949 | |
950 | - $sql = "UPDATE $table_user SET user_id = id WHERE id = $return"; |
|
950 | + $sql = "update $table_user SET user_id = id WHERE id = $return"; |
|
951 | 951 | Database::query($sql); |
952 | 952 | |
953 | 953 | if (api_is_multiple_url_enabled()) { |
@@ -1279,12 +1279,12 @@ discard block |
||
1279 | 1279 | if (!empty($_configuration['password_encryption'])) { |
1280 | 1280 | if ($_configuration['password_encryption'] === $encrypt_method) { |
1281 | 1281 | if ($encrypt_method == 'md5' && !preg_match('/^[A-Fa-f0-9]{32}$/', $password)) { |
1282 | - $msg = "Encryption $encrypt_method is invalid"; |
|
1282 | + $msg = "encryption $encrypt_method is invalid"; |
|
1283 | 1283 | if ($debug) error_log($msg); |
1284 | 1284 | return $msg; |
1285 | 1285 | |
1286 | 1286 | } elseif ($encrypt_method == 'sha1' && !preg_match('/^[A-Fa-f0-9]{40}$/', $password)) { |
1287 | - $msg = "Encryption $encrypt_method is invalid"; |
|
1287 | + $msg = "encryption $encrypt_method is invalid"; |
|
1288 | 1288 | if ($debug) error_log($msg); |
1289 | 1289 | return $msg; |
1290 | 1290 | } |
@@ -1329,7 +1329,7 @@ discard block |
||
1329 | 1329 | $count_check_user = Database::num_rows($resu); |
1330 | 1330 | if ($count_check_user > 0) { |
1331 | 1331 | if ($debug) error_log('User id: '.$user_id.' exists and is NOT active. Updating user and setting setting active = 1'); |
1332 | - $sql = "UPDATE $table_user SET |
|
1332 | + $sql = "update $table_user SET |
|
1333 | 1333 | lastname='".Database::escape_string($lastName)."', |
1334 | 1334 | firstname='".Database::escape_string($firstName)."', |
1335 | 1335 | username='".Database::escape_string($loginName)."',"; |
@@ -1384,7 +1384,7 @@ discard block |
||
1384 | 1384 | |
1385 | 1385 | // First check wether the login already exists |
1386 | 1386 | if (!UserManager::is_username_available($loginName)) { |
1387 | - if ($debug) error_log("Username $loginName is not available"); |
|
1387 | + if ($debug) error_log("username $loginName is not available"); |
|
1388 | 1388 | return 0; |
1389 | 1389 | } |
1390 | 1390 | |
@@ -1414,7 +1414,7 @@ discard block |
||
1414 | 1414 | Database::query($sql); |
1415 | 1415 | $return = Database::insert_id(); |
1416 | 1416 | if ($return) { |
1417 | - $sql = "UPDATE $table_user SET user_id = id WHERE id = $return"; |
|
1417 | + $sql = "update $table_user SET user_id = id WHERE id = $return"; |
|
1418 | 1418 | Database::query($sql); |
1419 | 1419 | |
1420 | 1420 | $url_id = api_get_current_access_url_id(); |
@@ -2269,11 +2269,11 @@ discard block |
||
2269 | 2269 | $encrypt_method = $user_param['encrypt_method']; |
2270 | 2270 | if ($_configuration['password_encryption'] === $encrypt_method) { |
2271 | 2271 | if ($encrypt_method == 'md5' && !preg_match('/^[A-Fa-f0-9]{32}$/', $password)) { |
2272 | - $msg = "Encryption $encrypt_method is invalid"; |
|
2272 | + $msg = "encryption $encrypt_method is invalid"; |
|
2273 | 2273 | $results[] = $msg; |
2274 | 2274 | continue; |
2275 | 2275 | } elseif ($encrypt_method == 'sha1' && !preg_match('/^[A-Fa-f0-9]{40}$/', $password)) { |
2276 | - $msg = "Encryption $encrypt_method is invalid"; |
|
2276 | + $msg = "encryption $encrypt_method is invalid"; |
|
2277 | 2277 | $results[] = $msg; |
2278 | 2278 | continue; |
2279 | 2279 | } |
@@ -2322,7 +2322,7 @@ discard block |
||
2322 | 2322 | continue; // username already exits |
2323 | 2323 | } |
2324 | 2324 | |
2325 | - $sql = "UPDATE $table_user SET "; |
|
2325 | + $sql = "update $table_user SET "; |
|
2326 | 2326 | if (!empty($lastname)) { |
2327 | 2327 | $sql .= " lastname='".Database::escape_string($lastname)."', "; |
2328 | 2328 | } |
@@ -2473,10 +2473,10 @@ discard block |
||
2473 | 2473 | $encrypt_method = $params['encrypt_method']; |
2474 | 2474 | if ($_configuration['password_encryption'] === $encrypt_method) { |
2475 | 2475 | if ($encrypt_method == 'md5' && !preg_match('/^[A-Fa-f0-9]{32}$/', $password)) { |
2476 | - $msg = "Encryption $encrypt_method is invalid"; |
|
2476 | + $msg = "encryption $encrypt_method is invalid"; |
|
2477 | 2477 | return $msg; |
2478 | 2478 | } else if ($encrypt_method == 'sha1' && !preg_match('/^[A-Fa-f0-9]{40}$/', $password)) { |
2479 | - $msg = "Encryption $encrypt_method is invalid"; |
|
2479 | + $msg = "encryption $encrypt_method is invalid"; |
|
2480 | 2480 | return $msg; |
2481 | 2481 | } |
2482 | 2482 | } else { |
@@ -2524,7 +2524,7 @@ discard block |
||
2524 | 2524 | return 0; |
2525 | 2525 | } |
2526 | 2526 | // Edit lastname and firstname only if not empty |
2527 | - $sql = "UPDATE $table_user SET "; |
|
2527 | + $sql = "update $table_user SET "; |
|
2528 | 2528 | if (!empty($lastname)) { |
2529 | 2529 | $sql .= " lastname='".Database::escape_string($lastname)."', "; |
2530 | 2530 | } |
@@ -2901,7 +2901,7 @@ discard block |
||
2901 | 2901 | |
2902 | 2902 | if (!empty($courseInfo)) { |
2903 | 2903 | if ($courseInfo['visibility'] != 0) { |
2904 | - $sql = "UPDATE $table_course SET |
|
2904 | + $sql = "update $table_course SET |
|
2905 | 2905 | course_language='".Database::escape_string($course_language)."', |
2906 | 2906 | title='".Database::escape_string($title)."', |
2907 | 2907 | category_code='".Database::escape_string($category_code)."', |
@@ -3136,7 +3136,7 @@ discard block |
||
3136 | 3136 | |
3137 | 3137 | if (!empty($courseInfo)) { |
3138 | 3138 | if ($courseInfo['visibility'] != 0) { |
3139 | - $sql = "UPDATE $table_course SET |
|
3139 | + $sql = "update $table_course SET |
|
3140 | 3140 | course_language='".Database::escape_string($course_language)."', |
3141 | 3141 | title='".Database::escape_string($title)."', |
3142 | 3142 | category_code='".Database::escape_string($category_code)."', |
@@ -3388,7 +3388,7 @@ discard block |
||
3388 | 3388 | $visual_code = CourseManager::generate_course_code(substr($title, 0, $maxlength)); |
3389 | 3389 | } |
3390 | 3390 | $tutor_name = $tutor_name[0]; |
3391 | - $sql = "UPDATE $course_table SET |
|
3391 | + $sql = "update $course_table SET |
|
3392 | 3392 | course_language='".Database::escape_string($course_language)."', |
3393 | 3393 | title='".Database::escape_string($title)."', |
3394 | 3394 | category_code='".Database::escape_string($category_code)."', |
@@ -3820,7 +3820,7 @@ discard block |
||
3820 | 3820 | } |
3821 | 3821 | |
3822 | 3822 | $courseId = $courseInfo['real_id']; |
3823 | - $sql = "UPDATE $table_course SET visibility = '0' WHERE id = '$courseId'"; |
|
3823 | + $sql = "update $table_course SET visibility = '0' WHERE id = '$courseId'"; |
|
3824 | 3824 | $return = Database::query($sql); |
3825 | 3825 | $results[] = $return; |
3826 | 3826 | } |
@@ -4670,7 +4670,7 @@ discard block |
||
4670 | 4670 | |
4671 | 4671 | if (empty($user_data)) { |
4672 | 4672 | // If user was not found, there was a problem |
4673 | - $result = "User $user_id does not exist"; |
|
4673 | + $result = "user $user_id does not exist"; |
|
4674 | 4674 | if ($debug) error_log($result); |
4675 | 4675 | return $result; |
4676 | 4676 | } |
@@ -4678,7 +4678,7 @@ discard block |
||
4678 | 4678 | $course_data = api_get_course_info($course_code); |
4679 | 4679 | if (empty($course_data)) { |
4680 | 4680 | // Course was not found |
4681 | - $result = "Course $course_code does not exist in the platform "; |
|
4681 | + $result = "course $course_code does not exist in the platform "; |
|
4682 | 4682 | if ($debug) error_log($result); |
4683 | 4683 | } else { |
4684 | 4684 | if ($debug) error_log('Try to register: user_id= '.$user_id.' to course: '.$course_data['code']); |
@@ -5047,8 +5047,8 @@ discard block |
||
5047 | 5047 | |
5048 | 5048 | if ($user_id) { |
5049 | 5049 | if ($debug) { |
5050 | - error_log("User $original_user_id_value, $original_user_id_name found"); |
|
5051 | - error_log("Course $original_course_id_value, $original_course_id_name found"); |
|
5050 | + error_log("user $original_user_id_value, $original_user_id_name found"); |
|
5051 | + error_log("course $original_course_id_value, $original_course_id_name found"); |
|
5052 | 5052 | } |
5053 | 5053 | |
5054 | 5054 | $courseInfo = CourseManager::getCourseInfoFromOriginalId( |
@@ -5065,7 +5065,7 @@ discard block |
||
5065 | 5065 | } |
5066 | 5066 | } else { |
5067 | 5067 | if ($debug) { |
5068 | - error_log("Course $courseCode found"); |
|
5068 | + error_log("course $courseCode found"); |
|
5069 | 5069 | } |
5070 | 5070 | CourseManager::unsubscribe_user($user_id, $courseCode, 0); |
5071 | 5071 | $result['result'] = 1; |
@@ -5335,7 +5335,7 @@ discard block |
||
5335 | 5335 | $result = 0; |
5336 | 5336 | |
5337 | 5337 | if (empty($user_data)) { |
5338 | - $result = "User {$user_id} does not exist"; |
|
5338 | + $result = "user {$user_id} does not exist"; |
|
5339 | 5339 | if ($debug) { |
5340 | 5340 | error_log($result); |
5341 | 5341 | } |
@@ -5344,7 +5344,7 @@ discard block |
||
5344 | 5344 | if (!empty($session_id) && is_numeric($session_id)) { |
5345 | 5345 | $session_data = api_get_session_info($session_id); |
5346 | 5346 | if (empty($session_data)) { |
5347 | - $result = "Session {$session_id} does not exist."; |
|
5347 | + $result = "session {$session_id} does not exist."; |
|
5348 | 5348 | if ($debug) { |
5349 | 5349 | error_log($result); |
5350 | 5350 | } |
@@ -5885,7 +5885,7 @@ discard block |
||
5885 | 5885 | } |
5886 | 5886 | |
5887 | 5887 | // Update number of users in the session. |
5888 | - $update_sql = "UPDATE $tbl_session SET nbr_courses= $nbr_courses WHERE id='$id_session' "; |
|
5888 | + $update_sql = "update $tbl_session SET nbr_courses= $nbr_courses WHERE id='$id_session' "; |
|
5889 | 5889 | Database::query($update_sql); |
5890 | 5890 | |
5891 | 5891 | $results[] = 1; |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | $TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER); |
184 | 184 | $max_sort_value = api_max_sort_value($newcategory, $current_user); |
185 | - $sql = "UPDATE $TABLECOURSUSER SET |
|
185 | + $sql = "update $TABLECOURSUSER SET |
|
186 | 186 | user_course_cat='".$newcategory."', |
187 | 187 | sort='" . ($max_sort_value + 1)."' |
188 | 188 | WHERE |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $targetCourseInfo = api_get_course_info($target_course['code']); |
246 | 246 | $targetCourseId = $targetCourseInfo['real_id']; |
247 | 247 | |
248 | - $sql = "UPDATE $table |
|
248 | + $sql = "update $table |
|
249 | 249 | SET sort='".$target_course['sort']."' |
250 | 250 | WHERE |
251 | 251 | c_id = '" . $courseId."' AND |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | |
255 | 255 | $result1 = Database::query($sql); |
256 | 256 | |
257 | - $sql = "UPDATE $table SET sort='".$source_course['sort']."' |
|
257 | + $sql = "update $table SET sort='".$source_course['sort']."' |
|
258 | 258 | WHERE |
259 | 259 | c_id ='" . $targetCourseId."' AND |
260 | 260 | user_id='" . $current_user_id."' AND |
@@ -305,11 +305,11 @@ discard block |
||
305 | 305 | $result = false; |
306 | 306 | if (count($target_category) > 0 && count($source_category) > 0) { |
307 | 307 | $table = Database::get_main_table(TABLE_USER_COURSE_CATEGORY); |
308 | - $sql = "UPDATE $table SET |
|
308 | + $sql = "update $table SET |
|
309 | 309 | sort = '".Database::escape_string($target_category['sort'])."' |
310 | 310 | WHERE id='" . intval($source_category['id'])."' AND user_id='".$userId."'"; |
311 | 311 | $resultFirst = Database::query($sql); |
312 | - $sql = "UPDATE $table SET |
|
312 | + $sql = "update $table SET |
|
313 | 313 | sort = '".Database::escape_string($source_category['sort'])."' |
314 | 314 | WHERE id='" . intval($target_category['id'])."' AND user_id='".$userId."'"; |
315 | 315 | $resultSecond = Database::query($sql); |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | $category_id = intval($category_id); |
335 | 335 | $result = false; |
336 | 336 | $tucc = Database::get_main_table(TABLE_USER_COURSE_CATEGORY); |
337 | - $sql = "UPDATE $tucc |
|
337 | + $sql = "update $tucc |
|
338 | 338 | SET title='".api_htmlentities($title, ENT_QUOTES, api_get_system_encoding())."' |
339 | 339 | WHERE id='" . $category_id."'"; |
340 | 340 | $resultQuery = Database::query($sql); |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | if (Database::affected_rows($resultQuery)) { |
365 | 365 | $result = true; |
366 | 366 | } |
367 | - $sql = "UPDATE $TABLECOURSUSER |
|
367 | + $sql = "update $TABLECOURSUSER |
|
368 | 368 | SET user_course_cat='0' |
369 | 369 | WHERE |
370 | 370 | user_course_cat='".$category_id."' AND |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | OR (s.access_end_date IS NULL) |
724 | 724 | OR (s.access_start_date IS NULL AND |
725 | 725 | s.access_end_date IS NOT NULL AND s.access_end_date > '$date') |
726 | -SQL; |
|
726 | +sql; |
|
727 | 727 | } |
728 | 728 | $sql = "SELECT COUNT(*) |
729 | 729 | FROM $sessionTable s |
@@ -172,6 +172,7 @@ discard block |
||
172 | 172 | * (moving a course to a different course category) |
173 | 173 | * @param int $courseId |
174 | 174 | * @param int Category id |
175 | + * @param integer $newcategory |
|
175 | 176 | * @return bool True if it success |
176 | 177 | */ |
177 | 178 | public function updateCourseCategory($courseId, $newcategory) |
@@ -204,6 +205,9 @@ discard block |
||
204 | 205 | * @param string Direction (up/down) |
205 | 206 | * @param string Course code |
206 | 207 | * @param int Category id |
208 | + * @param string $direction |
|
209 | + * @param string $course2move |
|
210 | + * @param integer $category |
|
207 | 211 | * @return bool True if it success |
208 | 212 | */ |
209 | 213 | public function move_course($direction, $course2move, $category) |
@@ -325,6 +329,8 @@ discard block |
||
325 | 329 | * Updates the user course category in the chamilo_user database |
326 | 330 | * @param string Category title |
327 | 331 | * @param int Category id |
332 | + * @param string $title |
|
333 | + * @param integer $category_id |
|
328 | 334 | * @return bool True if it success |
329 | 335 | */ |
330 | 336 | public function store_edit_course_category($title, $category_id) |
@@ -517,6 +523,7 @@ discard block |
||
517 | 523 | /** |
518 | 524 | * stores the user course category in the chamilo_user database |
519 | 525 | * @param string Category title |
526 | + * @param string $category_title |
|
520 | 527 | * @return bool True if it success |
521 | 528 | */ |
522 | 529 | public function store_course_category($category_title) |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | $saleId = $_SESSION['bc_sale_id']; |
13 | 13 | |
14 | -if (empty($saleId)) { |
|
14 | +if (empty($saleId)) { |
|
15 | 15 | api_not_allowed(true); |
16 | 16 | } |
17 | 17 | |
@@ -19,14 +19,14 @@ discard block |
||
19 | 19 | |
20 | 20 | $userInfo = api_get_user_info($sale['user_id']); |
21 | 21 | |
22 | -if (empty($sale)) { |
|
22 | +if (empty($sale)) { |
|
23 | 23 | api_not_allowed(true); |
24 | 24 | } |
25 | 25 | |
26 | 26 | $currency = $plugin->getCurrency($sale['currency_id']); |
27 | 27 | $terms = $plugin->getGlobalParameters(); |
28 | 28 | |
29 | -switch ($sale['payment_type']) { |
|
29 | +switch ($sale['payment_type']) { |
|
30 | 30 | case BuyCoursesPlugin::PAYMENT_TYPE_PAYPAL: |
31 | 31 | $paypalParams = $plugin->getPaypalParams(); |
32 | 32 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $extra |
52 | 52 | ); |
53 | 53 | |
54 | - if ($expressCheckout["ACK"] !== 'Success') { |
|
54 | + if ($expressCheckout["ACK"] !== 'Success') { |
|
55 | 55 | $erroMessage = vsprintf( |
56 | 56 | $plugin->get_lang('ErrorOccurred'), |
57 | 57 | [$expressCheckout['L_ERRORCODE0'], $expressCheckout['L_LONGMESSAGE0']] |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $buyingCourse = false; |
70 | 70 | $buyingSession = false; |
71 | 71 | |
72 | - switch ($sale['product_type']) { |
|
72 | + switch ($sale['product_type']) { |
|
73 | 73 | case BuyCoursesPlugin::PRODUCT_TYPE_COURSE: |
74 | 74 | $buyingCourse = true; |
75 | 75 | $course = $plugin->getCourseInfo($sale['product_id']); |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | FormValidator::LAYOUT_INLINE |
92 | 92 | ); |
93 | 93 | |
94 | - if ($form->validate()) { |
|
94 | + if ($form->validate()) { |
|
95 | 95 | $formValues = $form->getSubmitValues(); |
96 | 96 | |
97 | - if (isset($formValues['cancel'])) { |
|
97 | + if (isset($formValues['cancel'])) { |
|
98 | 98 | $plugin->cancelSale($sale['id']); |
99 | 99 | |
100 | 100 | unset($_SESSION['bc_sale_id']); |
@@ -153,9 +153,9 @@ discard block |
||
153 | 153 | |
154 | 154 | $template = new Template(); |
155 | 155 | |
156 | - if ($buyingCourse) { |
|
156 | + if ($buyingCourse) { |
|
157 | 157 | $template->assign('course', $course); |
158 | - } elseif ($buyingSession) { |
|
158 | + } elseif ($buyingSession) { |
|
159 | 159 | $template->assign('session', $session); |
160 | 160 | } |
161 | 161 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $buyingCourse = false; |
184 | 184 | $buyingSession = false; |
185 | 185 | |
186 | - switch ($sale['product_type']) { |
|
186 | + switch ($sale['product_type']) { |
|
187 | 187 | case BuyCoursesPlugin::PRODUCT_TYPE_COURSE: |
188 | 188 | $buyingCourse = true; |
189 | 189 | $course = $plugin->getCourseInfo($sale['product_id']); |
@@ -203,10 +203,10 @@ discard block |
||
203 | 203 | FormValidator::LAYOUT_INLINE |
204 | 204 | ); |
205 | 205 | |
206 | - if ($form->validate()) { |
|
206 | + if ($form->validate()) { |
|
207 | 207 | $formValues = $form->getSubmitValues(); |
208 | 208 | |
209 | - if (isset($formValues['cancel'])) { |
|
209 | + if (isset($formValues['cancel'])) { |
|
210 | 210 | $plugin->cancelSale($sale['id']); |
211 | 211 | |
212 | 212 | unset($_SESSION['bc_sale_id']); |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | |
245 | 245 | $template = new Template(); |
246 | 246 | |
247 | - if ($buyingCourse) { |
|
247 | + if ($buyingCourse) { |
|
248 | 248 | $template->assign('course', $course); |
249 | - } elseif ($buyingSession) { |
|
249 | + } elseif ($buyingSession) { |
|
250 | 250 | $template->assign('session', $session); |
251 | 251 | } |
252 | 252 |