Completed
Push — master ( 5da9ea...eef579 )
by Angel Fernando Quiroz
50:18 queued 17:36
created
plugin/buycourses/src/configuration.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,12 +40,12 @@
 block discarded – undo
40 40
 $tpl->assign('sessions_are_included', $includeSession);
41 41
 $tpl->assign('services_are_included', $includeServices);
42 42
 
43
-if ($includeSession) {
43
+if ($includeSession) {
44 44
     $sessions = $plugin->getSessionsForConfiguration();
45 45
     $tpl->assign('sessions', $sessions);
46 46
 }
47 47
 
48
-if ($includeServices) {
48
+if ($includeServices) {
49 49
     $services = $plugin->getServices();
50 50
     $tpl->assign('services', $services);
51 51
 }
Please login to merge, or discard this patch.
plugin/buycourses/src/course_catalog.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
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;
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 $courseList = $plugin->getCatalogCourseList($nameFilter, $minFilter, $maxFilter);
55 55
 
56 56
 //View
57
-if (api_is_platform_admin()) {
57
+if (api_is_platform_admin()) {
58 58
     $interbreadcrumb[] = [
59 59
         'url' => 'configuration.php',
60 60
         'name' => $plugin->get_lang('AvailableCoursesConfiguration')
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         'url' => 'paymentsetup.php',
64 64
         'name' => $plugin->get_lang('PaymentsConfiguration')
65 65
     ];
66
-} else {
66
+} else {
67 67
     $interbreadcrumb[] = [
68 68
         'url' => 'course_panel.php',
69 69
         'name' => get_lang('TabsDashboard')
Please login to merge, or discard this patch.
plugin/buycourses/src/service_success.php 1 patch
Braces   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
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
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 $serviceSale = $plugin->getServiceSale($serviceSaleId);
20 20
 $itemPrice = $serviceSale['price'];
21 21
 
22
-if (empty($serviceSale)) {
22
+if (empty($serviceSale)) {
23 23
     api_not_allowed(true);
24 24
 }
25 25
 
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 $form->addButton('confirm', $plugin->get_lang('ConfirmOrder'), 'check', 'success');
39 39
 $form->addButtonCancel($plugin->get_lang('CancelOrder'), 'cancel');
40 40
 
41
-if ($form->validate()) {
41
+if ($form->validate()) {
42 42
     $formValues = $form->getSubmitValues();
43
-    if (isset($formValues['cancel'])) {
43
+    if (isset($formValues['cancel'])) {
44 44
         $plugin->cancelServiceSale($serviceSale['id']);
45 45
 
46 46
         unset($_SESSION['bc_service_sale_id']);
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
     $confirmPayments = ConfirmPayment($itemPrice);
57 57
 
58
-    if ($confirmPayments['ACK'] !== 'Success') {
58
+    if ($confirmPayments['ACK'] !== 'Success') {
59 59
         $erroMessage = vsprintf(
60 60
             $plugin->get_lang('ErrorOccurred'),
61 61
             [$expressCheckout['L_ERRORCODE0'], $confirmPayments['L_LONGMESSAGE0']]
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
         exit;
69 69
     }
70 70
 
71
-    switch ($confirmPayments["PAYMENTINFO_0_PAYMENTSTATUS"]) {
71
+    switch ($confirmPayments["PAYMENTINFO_0_PAYMENTSTATUS"]) {
72 72
         case 'Completed':
73 73
             $serviceSaleIsCompleted = $plugin->completeServiceSale($serviceSale['id']);
74 74
 
75
-            if ($serviceSaleIsCompleted) {
75
+            if ($serviceSaleIsCompleted) {
76 76
                 Display::addFlash(
77 77
                     Display::return_message(
78 78
                         sprintf($plugin->get_lang('SubscriptionToServiceXSuccessful'), $serviceSale['service']['name']),
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
             );
89 89
             break;
90 90
         case 'Pending':
91
-            switch ($confirmPayments["PAYMENTINFO_0_PENDINGREASON"]) {
91
+            switch ($confirmPayments["PAYMENTINFO_0_PENDINGREASON"]) {
92 92
                 case 'address':
93 93
                     $purchaseStatus = $plugin->get_lang('PendingReasonByAddress');
94 94
                     break;
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
 $token = isset($_GET['token']) ? Security::remove_XSS($_GET['token']) : null;
157 157
 
158
-if (empty($token)) {
158
+if (empty($token)) {
159 159
     api_not_allowed(true);
160 160
 }
161 161
 
Please login to merge, or discard this patch.
plugin/buycourses/src/session_catalog.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 $includeSessions = $plugin->get('include_sessions') === 'true';
15 15
 $includeServices = $plugin->get('include_services') === 'true';
16 16
 
17
-if (!$includeSessions) {
17
+if (!$includeSessions) {
18 18
     api_not_allowed(true);
19 19
 }
20 20
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     FormValidator::LAYOUT_INLINE
32 32
 );
33 33
 
34
-if ($form->validate()) {
34
+if ($form->validate()) {
35 35
     $formValues = $form->getSubmitValues();
36 36
     $nameFilter = isset($formValues['name']) ? $formValues['name'] : null;
37 37
     $minFilter = isset($formValues['min']) ? $formValues['min'] : 0;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 $sessionList = $plugin->getCatalogSessionList($nameFilter, $minFilter, $maxFilter);
59 59
 
60 60
 //View
61
-if (api_is_platform_admin()) {
61
+if (api_is_platform_admin()) {
62 62
     $interbreadcrumb[] = [
63 63
         'url' => 'configuration.php',
64 64
         'name' => $plugin->get_lang('AvailableCoursesConfiguration')
Please login to merge, or discard this patch.
plugin/buycourses/src/service_catalog.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
 $form = new FormValidator('search_filter_form', 'get', null, null, [], FormValidator::LAYOUT_INLINE);
24 24
 
25
-if ($form->validate()) {
25
+if ($form->validate()) {
26 26
     $formValues = $form->getSubmitValues();
27 27
     $nameFilter = isset($formValues['name']) ? $formValues['name'] : null;
28 28
     $minFilter = isset($formValues['min']) ? $formValues['min'] : 0;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 $serviceList = $plugin->getCatalogServiceList($nameFilter, $minFilter, $maxFilter, $appliesToFilter);
60 60
 
61 61
 //View
62
-if (api_is_platform_admin()) {
62
+if (api_is_platform_admin()) {
63 63
     $interbreadcrumb[] = [
64 64
         'url' => 'configuration.php',
65 65
         'name' => $plugin->get_lang('AvailableCoursesConfiguration')
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         'url' => 'paymentsetup.php',
69 69
         'name' => $plugin->get_lang('PaymentsConfiguration')
70 70
     ];
71
-} else {
71
+} else {
72 72
     $interbreadcrumb[] = [
73 73
         'url' => '../index.php',
74 74
         'name' => $plugin->get_lang('UserPanel')
Please login to merge, or discard this patch.
plugin/buycourses/src/paymentsetup.php 1 patch
Braces   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
 $commissionsEnable = $plugin->get('commissions_enable');
19 19
 $culqiEnable = $plugin->get('culqi_enable');
20 20
 
21
-if (isset($_GET['action'], $_GET['id'])) {
22
-    if ($_GET['action'] == 'delete_taccount') {
21
+if (isset($_GET['action'], $_GET['id'])) {
22
+    if ($_GET['action'] == 'delete_taccount') {
23 23
         $plugin->deleteTransferAccount($_GET['id']);
24 24
 
25 25
         Display::addFlash(
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
 $currencyForm = new FormValidator('currency');
35 35
 
36
-if ($currencyForm->validate()) {
36
+if ($currencyForm->validate()) {
37 37
     $currencyFormValues = $currencyForm->getSubmitValues();
38 38
 
39 39
     $plugin->selectCurrency($currencyFormValues['currency']);
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     [get_lang('Select')]
60 60
 );
61 61
 
62
-foreach ($currencies as $currency) {
62
+foreach ($currencies as $currency) {
63 63
     $currencyText = implode(
64 64
         ' => ',
65 65
         [
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
     $currencySelect->addOption($currencyText, $currencyValue);
73 73
 
74
-    if ($currency['status']) {
74
+    if ($currency['status']) {
75 75
         $currencySelect->setSelected($currencyValue);
76 76
     }
77 77
 }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
 $paypalForm = new FormValidator('paypal');
86 86
 
87
-if ($paypalForm->validate()) {
87
+if ($paypalForm->validate()) {
88 88
     $paypalFormValues = $paypalForm->getSubmitValues();
89 89
 
90 90
     $plugin->savePaypalParams($paypalFormValues);
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
 $commissionForm = new FormValidator('commissions');
125 125
 
126
-if ($commissionForm->validate()) {
126
+if ($commissionForm->validate()) {
127 127
     $commissionFormValues = $commissionForm->getSubmitValues();
128 128
 
129 129
     $plugin->updateCommission($commissionFormValues);
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
 $transferForm = new FormValidator('transfer_account');
151 151
 
152
-if ($transferForm->validate()) {
152
+if ($transferForm->validate()) {
153 153
     $transferFormValues = $transferForm->getSubmitValues();
154 154
 
155 155
     $plugin->saveTransferAccount($transferFormValues);
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 
189 189
 $culqiForm = new FormValidator('culqi_config');
190 190
 
191
-if ($culqiForm->validate()) {
191
+if ($culqiForm->validate()) {
192 192
     $culqiFormValues = $culqiForm->getSubmitValues();
193 193
 
194 194
     $plugin->saveCulqiParameters($culqiFormValues);
Please login to merge, or discard this patch.
plugin/buycourses/src/process_confirm.php 1 patch
Braces   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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']);
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
 
85 85
         $form = new FormValidator('success', 'POST', api_get_self(), null, null, FormValidator::LAYOUT_INLINE);
86 86
 
87
-        if ($form->validate()) {
87
+        if ($form->validate()) {
88 88
             $formValues = $form->getSubmitValues();
89 89
 
90
-            if (isset($formValues['cancel'])) {
90
+            if (isset($formValues['cancel'])) {
91 91
                 $plugin->cancelSale($sale['id']);
92 92
 
93 93
                 unset($_SESSION['bc_sale_id']);
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
 
139 139
         $template = new Template();
140 140
 
141
-        if ($buyingCourse) {
141
+        if ($buyingCourse) {
142 142
             $template->assign('course', $course);
143
-        } elseif ($buyingSession) {
143
+        } elseif ($buyingSession) {
144 144
             $template->assign('session', $session);
145 145
         }
146 146
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         $buyingCourse = false;
172 172
         $buyingSession = false;
173 173
 
174
-        switch ($sale['product_type']) {
174
+        switch ($sale['product_type']) {
175 175
             case BuyCoursesPlugin::PRODUCT_TYPE_COURSE:
176 176
                 $buyingCourse = true;
177 177
                 $course = $plugin->getCourseInfo($sale['product_id']);
@@ -184,11 +184,11 @@  discard block
 block discarded – undo
184 184
 
185 185
         $form = new FormValidator('success', 'POST', api_get_self(), null, null, FormValidator::LAYOUT_INLINE);
186 186
 
187
-        if ($form->validate()) {
187
+        if ($form->validate()) {
188 188
 
189 189
             $formValues = $form->getSubmitValues();
190 190
 
191
-            if (isset($formValues['cancel'])) {
191
+            if (isset($formValues['cancel'])) {
192 192
                 $plugin->cancelSale($sale['id']);
193 193
 
194 194
                 unset($_SESSION['bc_sale_id']);
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
 
211 211
         $template = new Template();
212 212
 
213
-        if ($buyingCourse) {
213
+        if ($buyingCourse) {
214 214
             $template->assign('course', $course);
215
-        } elseif ($buyingSession) {
215
+        } elseif ($buyingSession) {
216 216
             $template->assign('session', $session);
217 217
         }
218 218
 
Please login to merge, or discard this patch.
plugin/buycourses/src/expresscheckout.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,9 +30,9 @@
 block discarded – undo
30 30
  */
31 31
 $resArray = CallShortcutExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL);
32 32
 $ack = strtoupper($resArray["ACK"]);
33
-if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") {
33
+if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") {
34 34
     RedirectToPayPal($resArray["TOKEN"]);
35
-} else {
35
+} else {
36 36
     //Display a user friendly Error on the page using any of the following error information returned by PayPal
37 37
     $ErrorCode = urldecode($resArray["L_ERRORCODE0"]);
38 38
     $ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]);
Please login to merge, or discard this patch.
plugin/buycourses/src/success.php 1 patch
Braces   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -11,20 +11,20 @@  discard block
 block discarded – undo
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']);
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
 $form->addButton('confirm', $plugin->get_lang('ConfirmOrder'), 'check', 'success');
49 49
 $form->addButtonCancel($plugin->get_lang('CancelOrder'), 'cancel');
50 50
 
51
-if ($form->validate()) {
51
+if ($form->validate()) {
52 52
     $formValues = $form->getSubmitValues();
53 53
 
54
-    if (isset($formValues['cancel'])) {
54
+    if (isset($formValues['cancel'])) {
55 55
         $plugin->cancelSale($sale['id']);
56 56
 
57 57
         unset($_SESSION['bc_sale_id']);
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
     $confirmPayments = ConfirmPayment($sale['price']);
64 64
 
65
-    if ($confirmPayments['ACK'] !== 'Success') {
65
+    if ($confirmPayments['ACK'] !== 'Success') {
66 66
         $erroMessage = vsprintf(
67 67
             $plugin->get_lang('ErrorOccurred'),
68 68
             [$expressCheckout['L_ERRORCODE0'], $confirmPayments['L_LONGMESSAGE0']]
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
     $transactionId = $confirmPayments["PAYMENTINFO_0_TRANSACTIONID"];
78 78
     $transactionType = $confirmPayments["PAYMENTINFO_0_TRANSACTIONTYPE"];
79 79
 
80
-    switch ($confirmPayments["PAYMENTINFO_0_PAYMENTSTATUS"]) {
80
+    switch ($confirmPayments["PAYMENTINFO_0_PAYMENTSTATUS"]) {
81 81
         case 'Completed':
82 82
             $saleIsCompleted = $plugin->completeSale($sale['id']);
83 83
 
84
-            if ($saleIsCompleted && $buyingSession) {
84
+            if ($saleIsCompleted && $buyingSession) {
85 85
                 Display::addFlash(
86 86
                     Display::return_message(
87 87
                         sprintf($plugin->get_lang('SubscriptionToCourseXSuccessful'), $session['name']),
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
                 break;
93 93
             }
94 94
 
95
-            if ($saleIsCompleted && $buyingCourse) {
95
+            if ($saleIsCompleted && $buyingCourse) {
96 96
                 Display::addFlash(
97 97
                     Display::return_message(
98 98
                         sprintf($plugin->get_lang('SubscriptionToCourseXSuccessful'), $course['title']),
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             );
109 109
             break;
110 110
         case 'Pending':
111
-            switch ($confirmPayments["PAYMENTINFO_0_PENDINGREASON"]) {
111
+            switch ($confirmPayments["PAYMENTINFO_0_PENDINGREASON"]) {
112 112
                 case 'address':
113 113
                     $purchaseStatus = $plugin->get_lang('PendingReasonByAddress');
114 114
                     break;
@@ -171,13 +171,13 @@  discard block
 block discarded – undo
171 171
 
172 172
 $token = isset($_GET['token']) ? $_GET['token'] : null;
173 173
 
174
-if (empty($token)) {
174
+if (empty($token)) {
175 175
     api_not_allowed(true);
176 176
 }
177 177
 
178 178
 $shippingDetails = GetShippingDetails($token);
179 179
 
180
-if ($shippingDetails['ACK'] !== 'Success') {
180
+if ($shippingDetails['ACK'] !== 'Success') {
181 181
     $erroMessage = vsprintf(
182 182
         $plugin->get_lang('ErrorOccurred'),
183 183
         [$expressCheckout['L_ERRORCODE0'], $shippingDetails['L_LONGMESSAGE0']]
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
 $templateName = $plugin->get_lang('PaymentMethods');
195 195
 $tpl = new Template($templateName);
196 196
 
197
-if ($buyingCourse) {
197
+if ($buyingCourse) {
198 198
     $tpl->assign('course', $course);
199
-} elseif ($buyingSession) {
199
+} elseif ($buyingSession) {
200 200
     $tpl->assign('session', $session);
201 201
 }
202 202
 
Please login to merge, or discard this patch.