@@ -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 | |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | */ |
| 7 | 7 | require_once '../config.php'; |
| 8 | 8 | |
| 9 | -if (isset($_SESSION['bc_service_sale_id'])) {
|
|
| 9 | +if (isset($_SESSION['bc_service_sale_id'])) { |
|
| 10 | 10 | $plugin = BuyCoursesPlugin::create(); |
| 11 | 11 | $serviceSaleId = $_SESSION['bc_service_sale_id']; |
| 12 | 12 | unset($_SESSION['bc_service_sale_id']); |
@@ -11,20 +11,20 @@ discard block |
||
| 11 | 11 | $plugin = BuyCoursesPlugin::create(); |
| 12 | 12 | $paypalEnabled = $plugin->get('paypal_enable') === 'true';
|
| 13 | 13 | |
| 14 | -if (!$paypalEnabled) {
|
|
| 14 | +if (!$paypalEnabled) { |
|
| 15 | 15 | api_not_allowed(true); |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | $sale = $plugin->getSale($_SESSION['bc_sale_id']); |
| 19 | 19 | |
| 20 | -if (empty($sale)) {
|
|
| 20 | +if (empty($sale)) { |
|
| 21 | 21 | api_not_allowed(true); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | $buyingCourse = false; |
| 25 | 25 | $buyingSession = false; |
| 26 | 26 | |
| 27 | -switch ($sale['product_type']) {
|
|
| 27 | +switch ($sale['product_type']) { |
|
| 28 | 28 | case BuyCoursesPlugin::PRODUCT_TYPE_COURSE: |
| 29 | 29 | $buyingCourse = true; |
| 30 | 30 | $course = $plugin->getCourseInfo($sale['product_id']); |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | $form->addButton('confirm', $plugin->get_lang('ConfirmOrder'), 'check', 'success');
|
| 55 | 55 | $form->addButtonCancel($plugin->get_lang('CancelOrder'), 'cancel');
|
| 56 | 56 | |
| 57 | -if ($form->validate()) {
|
|
| 57 | +if ($form->validate()) { |
|
| 58 | 58 | $formValues = $form->getSubmitValues(); |
| 59 | - if (isset($formValues['cancel'])) {
|
|
| 59 | + if (isset($formValues['cancel'])) { |
|
| 60 | 60 | $plugin->cancelSale($sale['id']); |
| 61 | 61 | unset($_SESSION['bc_sale_id']); |
| 62 | 62 | header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/index.php');
|
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | $confirmPayments = ConfirmPayment($sale['price']); |
| 67 | 67 | |
| 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']] |
@@ -80,10 +80,10 @@ discard block |
||
| 80 | 80 | $transactionId = $confirmPayments['PAYMENTINFO_0_TRANSACTIONID']; |
| 81 | 81 | $transactionType = $confirmPayments['PAYMENTINFO_0_TRANSACTIONTYPE']; |
| 82 | 82 | |
| 83 | - switch ($confirmPayments['PAYMENTINFO_0_PAYMENTSTATUS']) {
|
|
| 83 | + switch ($confirmPayments['PAYMENTINFO_0_PAYMENTSTATUS']) { |
|
| 84 | 84 | case 'Completed': |
| 85 | 85 | $saleIsCompleted = $plugin->completeSale($sale['id']); |
| 86 | - if ($saleIsCompleted && $buyingSession) {
|
|
| 86 | + if ($saleIsCompleted && $buyingSession) { |
|
| 87 | 87 | Display::addFlash( |
| 88 | 88 | Display::return_message( |
| 89 | 89 | sprintf($plugin->get_lang('SubscriptionToCourseXSuccessful'), $session['name']),
|
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | break; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - if ($saleIsCompleted && $buyingCourse) {
|
|
| 97 | + if ($saleIsCompleted && $buyingCourse) { |
|
| 98 | 98 | Display::addFlash( |
| 99 | 99 | Display::return_message( |
| 100 | 100 | sprintf($plugin->get_lang('SubscriptionToCourseXSuccessful'), $course['title']),
|
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | ); |
| 111 | 111 | break; |
| 112 | 112 | case 'Pending': |
| 113 | - switch ($confirmPayments["PAYMENTINFO_0_PENDINGREASON"]) {
|
|
| 113 | + switch ($confirmPayments["PAYMENTINFO_0_PENDINGREASON"]) { |
|
| 114 | 114 | case 'address': |
| 115 | 115 | $purchaseStatus = $plugin->get_lang('PendingReasonByAddress');
|
| 116 | 116 | break; |
@@ -173,13 +173,13 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | $token = isset($_GET['token']) ? $_GET['token'] : null; |
| 175 | 175 | |
| 176 | -if (empty($token)) {
|
|
| 176 | +if (empty($token)) { |
|
| 177 | 177 | api_not_allowed(true); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | $shippingDetails = GetShippingDetails($token); |
| 181 | 181 | |
| 182 | -if ($shippingDetails['ACK'] !== 'Success') {
|
|
| 182 | +if ($shippingDetails['ACK'] !== 'Success') { |
|
| 183 | 183 | $erroMessage = vsprintf( |
| 184 | 184 | $plugin->get_lang('ErrorOccurred'),
|
| 185 | 185 | [$expressCheckout['L_ERRORCODE0'], $shippingDetails['L_LONGMESSAGE0']] |
@@ -196,9 +196,9 @@ discard block |
||
| 196 | 196 | $templateName = $plugin->get_lang('PaymentMethods');
|
| 197 | 197 | $tpl = new Template($templateName); |
| 198 | 198 | |
| 199 | -if ($buyingCourse) {
|
|
| 199 | +if ($buyingCourse) { |
|
| 200 | 200 | $tpl->assign('course', $course);
|
| 201 | -} elseif ($buyingSession) {
|
|
| 201 | +} elseif ($buyingSession) { |
|
| 202 | 202 | $tpl->assign('session', $session);
|
| 203 | 203 | } |
| 204 | 204 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | FormValidator::LAYOUT_INLINE |
| 28 | 28 | ); |
| 29 | 29 | |
| 30 | -if ($form->validate()) {
|
|
| 30 | +if ($form->validate()) { |
|
| 31 | 31 | $formValues = $form->getSubmitValues(); |
| 32 | 32 | $nameFilter = isset($formValues['name']) ? $formValues['name'] : null; |
| 33 | 33 | $minFilter = isset($formValues['min']) ? $formValues['min'] : 0; |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $serviceList = $plugin->getCatalogServiceList($nameFilter, $minFilter, $maxFilter, $appliesToFilter); |
| 65 | 65 | |
| 66 | 66 | //View |
| 67 | -if (api_is_platform_admin()) {
|
|
| 67 | +if (api_is_platform_admin()) { |
|
| 68 | 68 | $interbreadcrumb[] = [ |
| 69 | 69 | 'url' => 'configuration.php', |
| 70 | 70 | 'name' => $plugin->get_lang('AvailableCoursesConfiguration')
|
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | 'url' => 'paymentsetup.php', |
| 74 | 74 | 'name' => $plugin->get_lang('PaymentsConfiguration')
|
| 75 | 75 | ]; |
| 76 | -} else {
|
|
| 76 | +} else { |
|
| 77 | 77 | $interbreadcrumb[] = [ |
| 78 | 78 | 'url' => '../index.php', |
| 79 | 79 | 'name' => $plugin->get_lang('UserPanel')
|
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | $serviceSaleId = $_SESSION['bc_service_sale_id']; |
| 14 | 14 | |
| 15 | -if (empty($serviceSaleId)) {
|
|
| 15 | +if (empty($serviceSaleId)) { |
|
| 16 | 16 | api_not_allowed(true); |
| 17 | 17 | } |
| 18 | 18 | |
@@ -20,14 +20,14 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | $userInfo = api_get_user_info($serviceSale['buyer']['id']); |
| 22 | 22 | |
| 23 | -if (empty($serviceSale)) {
|
|
| 23 | +if (empty($serviceSale)) { |
|
| 24 | 24 | api_not_allowed(true); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | $currency = $plugin->getCurrency($serviceSale['currency_id']); |
| 28 | 28 | $terms = $plugin->getGlobalParameters(); |
| 29 | 29 | |
| 30 | -switch ($serviceSale['payment_type']) {
|
|
| 30 | +switch ($serviceSale['payment_type']) { |
|
| 31 | 31 | case BuyCoursesPlugin::PAYMENT_TYPE_PAYPAL: |
| 32 | 32 | $paypalParams = $plugin->getPaypalParams(); |
| 33 | 33 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $extra |
| 64 | 64 | ); |
| 65 | 65 | |
| 66 | - if ($expressCheckout["ACK"] !== 'Success') {
|
|
| 66 | + if ($expressCheckout["ACK"] !== 'Success') { |
|
| 67 | 67 | $erroMessage = vsprintf( |
| 68 | 68 | $plugin->get_lang('ErrorOccurred'),
|
| 69 | 69 | [$expressCheckout['L_ERRORCODE0'], $expressCheckout['L_LONGMESSAGE0']] |
@@ -92,10 +92,10 @@ discard block |
||
| 92 | 92 | FormValidator::LAYOUT_INLINE |
| 93 | 93 | ); |
| 94 | 94 | |
| 95 | - if ($form->validate()) {
|
|
| 95 | + if ($form->validate()) { |
|
| 96 | 96 | $formValues = $form->getSubmitValues(); |
| 97 | 97 | |
| 98 | - if (isset($formValues['cancel'])) {
|
|
| 98 | + if (isset($formValues['cancel'])) { |
|
| 99 | 99 | $plugin->cancelServiceSale(intval($serviceSale['id'])); |
| 100 | 100 | |
| 101 | 101 | unset($_SESSION['bc_service_sale_id']); |
@@ -180,9 +180,9 @@ discard block |
||
| 180 | 180 | FormValidator::LAYOUT_INLINE |
| 181 | 181 | ); |
| 182 | 182 | |
| 183 | - if ($form->validate()) {
|
|
| 183 | + if ($form->validate()) { |
|
| 184 | 184 | $formValues = $form->getSubmitValues(); |
| 185 | - if (isset($formValues['cancel'])) {
|
|
| 185 | + if (isset($formValues['cancel'])) { |
|
| 186 | 186 | $plugin->cancelServiceSale($serviceSale['id']); |
| 187 | 187 | |
| 188 | 188 | unset($_SESSION['bc_service_sale_id']); |
@@ -1113,7 +1113,8 @@ discard block |
||
| 1113 | 1113 | $nbrActiveTests = $nbrActiveTests + 1; |
| 1114 | 1114 | $actions .= ' <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=disable&page='.$page.'&file='.$path.'">'. |
| 1115 | 1115 | Display::return_icon('visible.png', get_lang('Deactivate'), '', ICON_SIZE_SMALL).'</a>'; |
| 1116 | - } else { // else if not active |
|
| 1116 | + } else { |
|
| 1117 | +// else if not active |
|
| 1117 | 1118 | $actions .= ' <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=enable&page='.$page.'&file='.$path.'">'. |
| 1118 | 1119 | Display::return_icon('invisible.png', get_lang('Activate'), '', ICON_SIZE_SMALL).'</a>'; |
| 1119 | 1120 | } |
@@ -1219,6 +1220,7 @@ discard block |
||
| 1219 | 1220 | echo '</div>'; |
| 1220 | 1221 | } |
| 1221 | 1222 | |
| 1222 | -if ($origin != 'learnpath') { //so we are not in learnpath tool |
|
| 1223 | +if ($origin != 'learnpath') { |
|
| 1224 | +//so we are not in learnpath tool |
|
| 1223 | 1225 | Display :: display_footer(); |
| 1224 | 1226 | } |
@@ -71,23 +71,32 @@ discard block |
||
| 71 | 71 | * @author Roan Embrechts (based on code from Universit� Jean Monet) |
| 72 | 72 | */ |
| 73 | 73 | |
| 74 | -function ldap_login($login, $password) { |
|
| 74 | +function ldap_login($login, $password) |
|
| 75 | +{ |
|
| 75 | 76 | //error_log('Entering ldap_login('.$login.','.$password.')',0); |
| 76 | 77 | $res = ldap_authentication_check($login, $password); |
| 77 | 78 | |
| 78 | 79 | // res=-1 -> the user does not exist in the ldap database |
| 79 | 80 | // res=1 -> invalid password (user does exist) |
| 80 | 81 | |
| 81 | - if ($res == 1) { //WRONG PASSWORD |
|
| 82 | + if ($res == 1) { |
|
| 83 | +//WRONG PASSWORD |
|
| 82 | 84 | //$errorMessage = "LDAP User or password incorrect, try again.<br />"; |
| 83 | - if (isset($log)) unset($log); if (isset($uid)) unset($uid); |
|
| 85 | + if (isset($log)) { |
|
| 86 | + unset($log); |
|
| 87 | + } |
|
| 88 | + if (isset($uid)) { |
|
| 89 | + unset($uid); |
|
| 90 | + } |
|
| 84 | 91 | $loginLdapSucces = false; |
| 85 | 92 | } |
| 86 | - if ($res == -1) { //WRONG USERNAME |
|
| 93 | + if ($res == -1) { |
|
| 94 | +//WRONG USERNAME |
|
| 87 | 95 | //$errorMessage = "LDAP User or password incorrect, try again.<br />"; |
| 88 | 96 | $login_ldap_success = false; |
| 89 | 97 | } |
| 90 | - if ($res == 0) { //LOGIN & PASSWORD OK - SUCCES |
|
| 98 | + if ($res == 0) { |
|
| 99 | +//LOGIN & PASSWORD OK - SUCCES |
|
| 91 | 100 | //$errorMessage = "Successful login w/ LDAP.<br>"; |
| 92 | 101 | $login_ldap_success = true; |
| 93 | 102 | } |
@@ -103,7 +112,8 @@ discard block |
||
| 103 | 112 | * @author Stefan De Wannemacker |
| 104 | 113 | * @author Roan Embrechts |
| 105 | 114 | */ |
| 106 | -function ldap_find_user_info($login) { |
|
| 115 | +function ldap_find_user_info($login) |
|
| 116 | +{ |
|
| 107 | 117 | //error_log('Entering ldap_find_user_info('.$login.')',0); |
| 108 | 118 | global $ldap_host, $ldap_port, $ldap_basedn, $ldap_rdn, $ldap_pass, $ldap_search_dn; |
| 109 | 119 | // basic sequence with LDAP is connect, bind, search, |
@@ -154,7 +164,8 @@ discard block |
||
| 154 | 164 | * "firstname", "name", "email", "isEmployee" |
| 155 | 165 | * @author Roan Embrechts |
| 156 | 166 | */ |
| 157 | -function ldap_put_user_info_locally($login, $info_array) { |
|
| 167 | +function ldap_put_user_info_locally($login, $info_array) |
|
| 168 | +{ |
|
| 158 | 169 | //error_log('Entering ldap_put_user_info_locally('.$login.',info_array)',0); |
| 159 | 170 | global $ldap_pass_placeholder; |
| 160 | 171 | global $submitRegistration, $submit, $uname, $email, |
@@ -242,7 +253,8 @@ discard block |
||
| 242 | 253 | * @param string password given by user |
| 243 | 254 | * @return int 0 if authentication succeeded, 1 if password was incorrect, -1 if it didn't belong to LDAP |
| 244 | 255 | */ |
| 245 | -function ldap_authentication_check($uname, $passwd) { |
|
| 256 | +function ldap_authentication_check($uname, $passwd) |
|
| 257 | +{ |
|
| 246 | 258 | //error_log('Entering ldap_authentication_check('.$uname.','.$passwd.')',0); |
| 247 | 259 | global $ldap_host, $ldap_port, $ldap_basedn, $ldap_host2, $ldap_port2, $ldap_rdn, $ldap_pass; |
| 248 | 260 | //error_log('Entering ldap_authentication_check('.$uname.','.$passwd.')',0); |
@@ -293,7 +305,8 @@ discard block |
||
| 293 | 305 | // return in case of wrong password connection error |
| 294 | 306 | if (@ldap_bind($ds, $dn, $passwd) === false) { |
| 295 | 307 | return (1); // invalid password |
| 296 | - } else {// connection successfull |
|
| 308 | + } else { |
|
| 309 | +// connection successfull |
|
| 297 | 310 | return (0); |
| 298 | 311 | } |
| 299 | 312 | } // end of check |
@@ -302,7 +315,8 @@ discard block |
||
| 302 | 315 | * @param resource resource LDAP connexion resource, passed by reference. |
| 303 | 316 | * @return void |
| 304 | 317 | */ |
| 305 | -function ldap_set_version(&$resource) { |
|
| 318 | +function ldap_set_version(&$resource) |
|
| 319 | +{ |
|
| 306 | 320 | //error_log('Entering ldap_set_version(&$resource)',0); |
| 307 | 321 | global $ldap_version; |
| 308 | 322 | if ($ldap_version > 2) { |
@@ -318,7 +332,8 @@ discard block |
||
| 318 | 332 | * @param boolean $ldap_bind |
| 319 | 333 | * @return boolean Status of the bind assignment. True for success, false for failure. |
| 320 | 334 | */ |
| 321 | -function ldap_handle_bind(&$ldap_handler, &$ldap_bind) { |
|
| 335 | +function ldap_handle_bind(&$ldap_handler, &$ldap_bind) |
|
| 336 | +{ |
|
| 322 | 337 | //error_log('Entering ldap_handle_bind(&$ldap_handler,&$ldap_bind)',0); |
| 323 | 338 | global $ldap_rdn, $ldap_pass, $extldap_config; |
| 324 | 339 | $ldap_rdn = $extldap_config['admin_dn']; |
@@ -347,7 +362,8 @@ discard block |
||
| 347 | 362 | * @see SortableTable#get_total_number_of_items() |
| 348 | 363 | * @author Mustapha Alouani |
| 349 | 364 | */ |
| 350 | -function ldap_get_users() { |
|
| 365 | +function ldap_get_users() |
|
| 366 | +{ |
|
| 351 | 367 | |
| 352 | 368 | global $ldap_basedn, $ldap_host, $ldap_port, $ldap_rdn, $ldap_pass, $ldap_search_dn, $extldap_user_correspondance; |
| 353 | 369 | |
@@ -394,8 +410,9 @@ discard block |
||
| 394 | 410 | return $info; |
| 395 | 411 | |
| 396 | 412 | } else { |
| 397 | - if (count($ldap_query) != 0) |
|
| 398 | - echo Display::return_message(get_lang('LDAPConnectionError'), 'error'); |
|
| 413 | + if (count($ldap_query) != 0) { |
|
| 414 | + echo Display::return_message(get_lang('LDAPConnectionError'), 'error'); |
|
| 415 | + } |
|
| 399 | 416 | return array(); |
| 400 | 417 | } |
| 401 | 418 | } |
@@ -405,7 +422,8 @@ discard block |
||
| 405 | 422 | * @see SortableTable#get_total_number_of_items() |
| 406 | 423 | * @author Mustapha Alouani |
| 407 | 424 | */ |
| 408 | -function ldap_get_number_of_users() { |
|
| 425 | +function ldap_get_number_of_users() |
|
| 426 | +{ |
|
| 409 | 427 | $info = ldap_get_users(); |
| 410 | 428 | if (count($info) > 0) { |
| 411 | 429 | return $info['count']; |
@@ -419,7 +437,8 @@ discard block |
||
| 419 | 437 | * @see SortableTable#get_table_data($from) |
| 420 | 438 | * @author Mustapha Alouani |
| 421 | 439 | */ |
| 422 | -function ldap_get_user_data($from, $number_of_items, $column, $direction) { |
|
| 440 | +function ldap_get_user_data($from, $number_of_items, $column, $direction) |
|
| 441 | +{ |
|
| 423 | 442 | |
| 424 | 443 | global $extldap_user_correspondance; |
| 425 | 444 | |
@@ -463,7 +482,8 @@ discard block |
||
| 463 | 482 | * @return string Some HTML-code with modify-buttons |
| 464 | 483 | * @author Mustapha Alouani |
| 465 | 484 | */ |
| 466 | -function modify_filter($user_id, $url_params, $row) { |
|
| 485 | +function modify_filter($user_id, $url_params, $row) |
|
| 486 | +{ |
|
| 467 | 487 | $query_string = "id[]=".$row[0]; |
| 468 | 488 | if (!empty($_GET['id_session'])) { |
| 469 | 489 | $query_string .= '&id_session='.Security::remove_XSS($_GET['id_session']); |
@@ -478,13 +498,15 @@ discard block |
||
| 478 | 498 | * @param string username (and uid inside LDAP) |
| 479 | 499 | * @author Mustapha Alouani |
| 480 | 500 | */ |
| 481 | -function ldap_add_user($login) { |
|
| 501 | +function ldap_add_user($login) |
|
| 502 | +{ |
|
| 482 | 503 | if ($ldap_user = extldap_authenticate($login, 'nopass', true)) { |
| 483 | 504 | return extldap_add_user_by_array($ldap_user); |
| 484 | 505 | } |
| 485 | 506 | } |
| 486 | 507 | |
| 487 | -function ldap_add_user_by_array($data, $update_if_exists = true) { |
|
| 508 | +function ldap_add_user_by_array($data, $update_if_exists = true) |
|
| 509 | +{ |
|
| 488 | 510 | |
| 489 | 511 | $lastname = api_convert_encoding($data['sn'][0], api_get_system_encoding(), 'UTF-8'); |
| 490 | 512 | $firstname = api_convert_encoding($data['cn'][0], api_get_system_encoding(), 'UTF-8'); |
@@ -533,7 +555,8 @@ discard block |
||
| 533 | 555 | * @param string Course code |
| 534 | 556 | * @return void |
| 535 | 557 | */ |
| 536 | -function ldap_add_user_to_session($UserList, $id_session) { |
|
| 558 | +function ldap_add_user_to_session($UserList, $id_session) |
|
| 559 | +{ |
|
| 537 | 560 | |
| 538 | 561 | // Database Table Definitions |
| 539 | 562 | $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
@@ -588,7 +611,8 @@ discard block |
||
| 588 | 611 | " WHERE id='$id_session'"); |
| 589 | 612 | } |
| 590 | 613 | |
| 591 | -function syncro_users() { |
|
| 614 | +function syncro_users() |
|
| 615 | +{ |
|
| 592 | 616 | global $ldap_basedn, $ldap_host, $ldap_port, $ldap_rdn, $ldap_pass, $ldap_search_dn; |
| 593 | 617 | echo "Connecting ..."; |
| 594 | 618 | $ldap_connect = ldap_connect($ldap_host, $ldap_port); |
@@ -2350,7 +2350,8 @@ discard block |
||
| 2350 | 2350 | if (count($in_files_list) > 0) { |
| 2351 | 2351 | $files_list = array_merge($files_list, $in_files_list); |
| 2352 | 2352 | } |
| 2353 | - } elseif (strstr($source, '..') === 0) { //link is relative but going back in the hierarchy |
|
| 2353 | + } elseif (strstr($source, '..') === 0) { |
|
| 2354 | +//link is relative but going back in the hierarchy |
|
| 2354 | 2355 | $files_list[] = array($source, 'local', 'rel'); |
| 2355 | 2356 | $dir = ''; |
| 2356 | 2357 | if (!empty($abs_path)) { |
@@ -3052,7 +3053,8 @@ discard block |
||
| 3052 | 3053 | case 'application/postscript': |
| 3053 | 3054 | $temp_file = tempnam(sys_get_temp_dir(), 'chamilo'); |
| 3054 | 3055 | exec("ps2pdf $doc_path $temp_file", $output, $ret_val); |
| 3055 | - if ($ret_val !== 0) { // shell fail, probably 127 (command not found) |
|
| 3056 | + if ($ret_val !== 0) { |
|
| 3057 | +// shell fail, probably 127 (command not found) |
|
| 3056 | 3058 | return false; |
| 3057 | 3059 | } |
| 3058 | 3060 | exec("pdftotext $temp_file -", $output, $ret_val); |
@@ -3068,7 +3070,8 @@ discard block |
||
| 3068 | 3070 | // Note: correct handling of code pages in unrtf |
| 3069 | 3071 | // on debian lenny unrtf v0.19.2 can not, but unrtf v0.20.5 can |
| 3070 | 3072 | exec("unrtf --text $doc_path", $output, $ret_val); |
| 3071 | - if ($ret_val == 127) { // command not found |
|
| 3073 | + if ($ret_val == 127) { |
|
| 3074 | +// command not found |
|
| 3072 | 3075 | return false; |
| 3073 | 3076 | } |
| 3074 | 3077 | // Avoid index unrtf comments |
@@ -3094,7 +3097,8 @@ discard block |
||
| 3094 | 3097 | |
| 3095 | 3098 | $content = ''; |
| 3096 | 3099 | if (!is_null($ret_val)) { |
| 3097 | - if ($ret_val !== 0) { // shell fail, probably 127 (command not found) |
|
| 3100 | + if ($ret_val !== 0) { |
|
| 3101 | +// shell fail, probably 127 (command not found) |
|
| 3098 | 3102 | return false; |
| 3099 | 3103 | } |
| 3100 | 3104 | } |
@@ -4137,7 +4141,8 @@ discard block |
||
| 4137 | 4141 | // Update search engine |
| 4138 | 4142 | if (isset($specific_fields_values[$specific_field['code']])) { |
| 4139 | 4143 | $sterms = trim($specific_fields_values[$specific_field['code']]); |
| 4140 | - } else { //if the specific field is not defined, force an empty one |
|
| 4144 | + } else { |
|
| 4145 | +//if the specific field is not defined, force an empty one |
|
| 4141 | 4146 | $sterms = ''; |
| 4142 | 4147 | } |
| 4143 | 4148 | $all_specific_terms .= ' '.$sterms; |
@@ -4177,7 +4182,8 @@ discard block |
||
| 4177 | 4182 | foreach ($specific_fields as $specific_field) { |
| 4178 | 4183 | if (isset($specific_fields_values[$specific_field['code']])) { |
| 4179 | 4184 | $sterms = trim($specific_fields_values[$specific_field['code']]); |
| 4180 | - } else { //if the specific field is not defined, force an empty one |
|
| 4185 | + } else { |
|
| 4186 | +//if the specific field is not defined, force an empty one |
|
| 4181 | 4187 | $sterms = ''; |
| 4182 | 4188 | } |
| 4183 | 4189 | $all_specific_terms .= ' '.$sterms; |
@@ -6002,7 +6008,8 @@ discard block |
||
| 6002 | 6008 | api_get_self()."?$courseParams&curdirpath=$curdirpath&add_as_template=$id" |
| 6003 | 6009 | ); |
| 6004 | 6010 | } |
| 6005 | - if (isset($_GET['curdirpath']) && $_GET['curdirpath'] == '/certificates') {//allow attach certificate to course |
|
| 6011 | + if (isset($_GET['curdirpath']) && $_GET['curdirpath'] == '/certificates') { |
|
| 6012 | +//allow attach certificate to course |
|
| 6006 | 6013 | $visibility_icon_certificate = 'nocertificate'; |
| 6007 | 6014 | if (self::get_default_certificate_id(api_get_course_id()) == $id) { |
| 6008 | 6015 | $visibility_icon_certificate = 'certificate'; |
@@ -6291,7 +6298,8 @@ discard block |
||
| 6291 | 6298 | 3. check plugins: quicktime, mediaplayer, vlc, acrobat, flash, java |
| 6292 | 6299 | */ |
| 6293 | 6300 | |
| 6294 | - if (!($result = in_array($file_extension, $allowed_extensions))) { // Assignment + a logical check. |
|
| 6301 | + if (!($result = in_array($file_extension, $allowed_extensions))) { |
|
| 6302 | +// Assignment + a logical check. |
|
| 6295 | 6303 | return false; |
| 6296 | 6304 | } |
| 6297 | 6305 | |
@@ -43,28 +43,35 @@ |
||
| 43 | 43 | 'where r.course_id=c.id and r.tool_id='. |
| 44 | 44 | reports_getToolId(TOOL_QUIZ). |
| 45 | 45 | ' order by r.course_id, r.child_name'); |
| 46 | - if (Database::num_rows($columns) == 0) |
|
| 47 | - die('<b>'.get_lang('no data found').'</b>'); |
|
| 46 | + if (Database::num_rows($columns) == 0) { |
|
| 47 | + die('<b>'.get_lang('no data found').'</b>'); |
|
| 48 | + } |
|
| 48 | 49 | $query = 'select u.lastname Name, u.firstname Firstname'; |
| 49 | 50 | $columns = Database::store_result($columns); |
| 50 | - if ($_REQUEST['tattempt'] == 'min' || $_REQUEST['tattempt'] == 'max') |
|
| 51 | - $function = $_REQUEST['tattempt']; |
|
| 52 | - else |
|
| 53 | - $function = 'avg'; |
|
| 54 | - foreach ($columns as $key => $column) |
|
| 55 | - $query .= ', '.$function.'(k'.$key.'.score) as `'. |
|
| 51 | + if ($_REQUEST['tattempt'] == 'min' || $_REQUEST['tattempt'] == 'max') { |
|
| 52 | + $function = $_REQUEST['tattempt']; |
|
| 53 | + } else { |
|
| 54 | + $function = 'avg'; |
|
| 55 | + } |
|
| 56 | + foreach ($columns as $key => $column) { |
|
| 57 | + $query .= ', '.$function.'(k'.$key.'.score) as `'. |
|
| 56 | 58 | $column['course'].' - '. |
| 57 | 59 | $column['test'].'` '; |
| 60 | + } |
|
| 58 | 61 | $query .= ' from '.Database::get_main_table(TABLE_MAIN_USER).' u '; |
| 59 | - foreach ($columns as $key => $column) // fixme sessions |
|
| 62 | + foreach ($columns as $key => $column) { |
|
| 63 | + // fixme sessions |
|
| 60 | 64 | $query .= 'left outer join '. |
| 61 | 65 | Database::get_main_table(TABLE_MAIN_REPORTS_VALUES). |
| 62 | 66 | ' k'.$key. |
| 63 | 67 | ' on k'.$key.'.key_id = '.$column['kid']. |
| 64 | 68 | ' and k'.$key.'.user_id = u.user_id '; |
| 69 | + } |
|
| 65 | 70 | $query .= ' group by '; |
| 66 | - foreach ($columns as $key => $column) // grouping attempt |
|
| 71 | + foreach ($columns as $key => $column) { |
|
| 72 | + // grouping attempt |
|
| 67 | 73 | $query .= 'k'.$key.'.attempt, '; |
| 74 | + } |
|
| 68 | 75 | $query = substr($query, 0, -2); // removing last ', '; |
| 69 | 76 | |
| 70 | 77 | return $query; |