Completed
Push — master ( 6abae4...8c7895 )
by Megh
02:56
created
src/app/models/contest_model.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -45,8 +45,7 @@  discard block
 block discarded – undo
45 45
         );
46 46
         if (!$stmt) {
47 47
             return false;
48
-        }
49
-        else {
48
+        } else {
50 49
             return true;
51 50
         }
52 51
     }
@@ -63,8 +62,7 @@  discard block
 block discarded – undo
63 62
         $this->ttt_dump_data($nick, 'callback', $payment_data);
64 63
         if (!$stmt) {
65 64
             return false;
66
-        }
67
-        else {
65
+        } else {
68 66
             return true;
69 67
         }
70 68
     }
@@ -272,8 +270,7 @@  discard block
 block discarded – undo
272 270
         $this->webdev_dump_data($nick, 'callback', $payment_data);
273 271
         if (!$stmt) {
274 272
             return false;
275
-        }
276
-        else {
273
+        } else {
277 274
             return true;
278 275
         }
279 276
     }
@@ -341,8 +338,7 @@  discard block
 block discarded – undo
341 338
         $this->riderofstorms_dump_data($nick, 'callback', $payment_data);
342 339
         if (!$stmt) {
343 340
             return false;
344
-        }
345
-        else {
341
+        } else {
346 342
             return true;
347 343
         }
348 344
     }
@@ -396,8 +392,7 @@  discard block
 block discarded – undo
396 392
         $this->arvr_dump_data($nick, 'callback', $payment_data);
397 393
         if (!$stmt) {
398 394
             return false;
399
-        }
400
-        else {
395
+        } else {
401 396
             return true;
402 397
         }
403 398
     }
@@ -525,8 +520,7 @@  discard block
 block discarded – undo
525 520
         $this->artuino_dump_data($team_id, 'callback', $payment_data);
526 521
         if (!$stmt) {
527 522
             return false;
528
-        }
529
-        else {
523
+        } else {
530 524
             return true;
531 525
         }
532 526
     }
@@ -582,8 +576,7 @@  discard block
 block discarded – undo
582 576
         $this->mun_dump_data($nick, 'callback', $payment_data);
583 577
         if (!$stmt) {
584 578
             return false;
585
-        }
586
-        else {
579
+        } else {
587 580
             return true;
588 581
         }
589 582
     }
Please login to merge, or discard this patch.
src/app/views/contest/mun.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2
-$text_input = function ($name, $large_text=false) use ($errors) {
2
+$text_input = function($name, $large_text = false) use ($errors) {
3 3
 ?>
4 4
     <?php if ($large_text): ?>
5 5
         <textarea name="<?= $name ?>" class="pure-input-1" required=""><?= isset($_POST[$name]) ? $_POST[$name] : '' ?></textarea>
6
-    <?php else: ?>
6
+    <?php else : ?>
7 7
         <input
8 8
             name="<?= $name ?>"
9 9
             value="<?= isset($_POST[$name]) ? $_POST[$name] : '' ?>"
Please login to merge, or discard this patch.
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,14 +3,17 @@  discard block
 block discarded – undo
3 3
 ?>
4 4
     <?php if ($large_text): ?>
5 5
         <textarea name="<?= $name ?>" class="pure-input-1" required=""><?= isset($_POST[$name]) ? $_POST[$name] : '' ?></textarea>
6
-    <?php else: ?>
6
+    <?php else {
7
+    : ?>
7 8
         <input
8 9
             name="<?= $name ?>"
9 10
             value="<?= isset($_POST[$name]) ? $_POST[$name] : '' ?>"
10 11
             required=""
11 12
             type="text"
12 13
             class="pure-input-1">
13
-    <?php endif; ?>
14
+    <?php endif;
15
+}
16
+?>
14 17
 
15 18
     <?php if (isset($errors[$name])): ?>
16 19
         <div class="error pure-input-1-1"><?= $errors[$name] ?></div>
@@ -39,7 +42,8 @@  discard block
 block discarded – undo
39 42
                     But your payment is unsuccessful. If you think this is a mistake, please email us at <a href="mailto:[email protected]" class="underlined">[email protected]</a>
40 43
                 </p>
41 44
                 <a class="btn" href="<?= locale_base_url() ?>talks-and-workshops/mun/pay_again/"> Click here to pay again.</a>
42
-            <?php else: ?>
45
+            <?php else {
46
+    : ?>
43 47
                 <p class="text-center lead success">
44 48
                     Payment Successful. You're registered for the event.
45 49
                 </p>
@@ -47,13 +51,18 @@  discard block
 block discarded – undo
47 51
                     Kindly carry your payment receipt which is mailed to you while atteding workshop.<br/>
48 52
                     If you think this is a mistake, please email us at <a href="mailto:[email protected]" class="underlined">[email protected]</a>
49 53
                 </p>
50
-            <?php endif; ?>
51
-        <?php else: ?>
54
+            <?php endif;
55
+}
56
+?>
57
+        <?php else {
58
+    : ?>
52 59
             <form class="pure-form pure-form-stacked row" method="post" action="">
53 60
                 <fieldset class="offset3 col6">
54 61
                     <?php if (isset($errors['common'])): ?>
55 62
                         <div class="error pure-input-1-1"><?= $errors['common'] ?></div>
56
-                    <?php endif; ?>
63
+                    <?php endif;
64
+}
65
+?>
57 66
 
58 67
                     <label><?= __('Contact number') ?></label>
59 68
                     <?php $text_input('contact_number'); ?>
Please login to merge, or discard this patch.
src/app/controllers/mun.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@
 block discarded – undo
109 109
         $user_details = $this->model->is_registered_for_mun($user_nick);
110 110
         if ($user_details && $user_details['payment_status'] != 'success') {
111 111
             $redirect_url = $this->get_mun_payment_url($user_nick, $user_details['contact_number'],
112
-                                                       $user_details['team_size'], $user_details['needs_accomodation']);
112
+                                                        $user_details['team_size'], $user_details['needs_accomodation']);
113 113
             $this->load_library('http_lib', 'http');
114 114
             $this->http->redirect($redirect_url);
115 115
         } else {
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
         $purpose    = $payment_cfg['mun']['purpose'];
24 24
         $amount     = $payment_cfg['mun']['amount'] * $team_size;
25 25
         if ($needs_accomodation)
26
-            $amount    = $amount + $payment_cfg['mun']['accomodation_amount'] * $team_size;
27
-        $redirect_url    = $payment_cfg['mun']['redirect_url'];
28
-        $webhook    = $payment_cfg['mun']['webhook'];
26
+            $amount = $amount + $payment_cfg['mun']['accomodation_amount'] * $team_size;
27
+        $redirect_url = $payment_cfg['mun']['redirect_url'];
28
+        $webhook = $payment_cfg['mun']['webhook'];
29 29
 
30 30
         $ch = curl_init();
31 31
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         $errors = [];
62 62
         if ($_SERVER['REQUEST_METHOD'] === 'POST' && !$user_details) {
63 63
             required_post_params(['contact_number', 'institute', 'team_size'], $errors);
64
-            if (!empty($_POST['contact_number']) && !is_valid_phone_number($_POST['contact_number']) ) {
64
+            if (!empty($_POST['contact_number']) && !is_valid_phone_number($_POST['contact_number'])) {
65 65
                 $errors['contact_number'] = 'Please enter a valid phone number';
66 66
             }
67 67
             if (!ctype_digit($_POST['team_size'])) {
@@ -82,14 +82,14 @@  discard block
 block discarded – undo
82 82
                 if ($this->model->register_for_mun($user_details)) {
83 83
                     $redirect_url = $this->get_mun_payment_url($user_nick, $_POST['contact_number'], $team_size, $needs_accomodation);
84 84
                     $this->load_library('http_lib', 'http');
85
-                    $this->http->redirect( $redirect_url );
85
+                    $this->http->redirect($redirect_url);
86 86
                 } else {
87 87
                     $errors['common'] = __('Some unexpected error occurred');
88 88
                 }
89 89
             }
90 90
         }
91 91
         $this->load_view('skeleton_template/header', [
92
-            'title'             => __('Register').' · '.__('MUN'),
92
+            'title'             => __('Register') . ' · ' . __('MUN'),
93 93
             'is_authenticated'  => true,
94 94
             'user_nick'         => $user_nick,
95 95
         ]);
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
     public function success() {
122 122
         $this->load_library('http_lib', 'http');
123 123
         if (!isset($_GET['payment_id'])) {
124
-            $this->http->response_code( 400 );
124
+            $this->http->response_code(400);
125 125
             exit();
126 126
         }
127 127
         global $payment_cfg;
128 128
         $proxy = 'http://proxy.iiit.ac.in:8080';
129 129
 
130
-        $nick      = $this->auth->get_user();
130
+        $nick = $this->auth->get_user();
131 131
         $id             = urlencode($_GET['payment_request_id']);
132 132
         $payment_id     = urlencode($_GET['payment_id']);
133 133
         $url            = $payment_cfg['mun']['api_url'] . $id . '/' . $payment_id . '/';
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
             $payment_data = $response;
152 152
             $this->model->mun_payment_success($payment_id, $nick, $status == 'Credit' ? 'success' : 'failed', $payment_data);
153 153
         } else {
154
-            if ( is_array( $response_array ) ) {
155
-                $this->model->mun_dump_data('unknown', 'callback', json_encode( [ '$_GET' => $_GET, 'response' => $response_array ] ));
154
+            if (is_array($response_array)) {
155
+                $this->model->mun_dump_data('unknown', 'callback', json_encode(['$_GET' => $_GET, 'response' => $response_array]));
156 156
             } else {
157 157
                 $this->model->mun_dump_data('unknown', 'callback', json_encode($_GET));
158 158
             }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,8 +22,9 @@
 block discarded – undo
22 22
         $api_headers    = $payment_cfg['mun']['api_headers'];
23 23
         $purpose    = $payment_cfg['mun']['purpose'];
24 24
         $amount     = $payment_cfg['mun']['amount'] * $team_size;
25
-        if ($needs_accomodation)
26
-            $amount    = $amount + $payment_cfg['mun']['accomodation_amount'] * $team_size;
25
+        if ($needs_accomodation) {
26
+                    $amount    = $amount + $payment_cfg['mun']['accomodation_amount'] * $team_size;
27
+        }
27 28
         $redirect_url    = $payment_cfg['mun']['redirect_url'];
28 29
         $webhook    = $payment_cfg['mun']['webhook'];
29 30
 
Please login to merge, or discard this patch.