Completed
Pull Request — master (#411)
by
unknown
22:29 queued 12:15
created
application/config/config.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2 2
 /*
3 3
 | -------------------------------------------------------------------
4 4
 | MIME TYPES
Please login to merge, or discard this patch.
application/modules/quotes/views/modal_create_quote.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,9 +59,9 @@
 block discarded – undo
59 59
                 <select name="client_name" id="client_name" class="form-control" autofocus="autofocus">
60 60
                     <?php
61 61
                     foreach ($clients as $client) {
62
-                        echo "<option value=\"" . htmlspecialchars($client->client_name) . "\" ";
62
+                        echo "<option value=\"".htmlspecialchars($client->client_name)."\" ";
63 63
                         if ($client_name == $client->client_name) echo 'selected';
64
-                        echo ">" . htmlspecialchars($client->client_name) . "</option>";
64
+                        echo ">".htmlspecialchars($client->client_name)."</option>";
65 65
                     }
66 66
                     ?>
67 67
                 </select>
Please login to merge, or discard this patch.
application/modules/sessions/controllers/sessions.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('BASEPATH'))
3
+if ( ! defined('BASEPATH'))
4 4
     exit('No direct script access allowed');
5 5
 
6 6
 /*
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
             if ($this->db->where('user_email', $email)) {
149 149
                 // Create a passwordreset token
150 150
                 $email = $this->input->post('email');
151
-                $token = md5(time() . $email);
151
+                $token = md5(time().$email);
152 152
 
153 153
                 // Save the token to the database and set the user to inactive
154 154
                 $db_array = array(
@@ -162,18 +162,18 @@  discard block
 block discarded – undo
162 162
                 $this->load->helper('mailer');
163 163
 
164 164
                 // Preprare some variables for the email
165
-                $email_resetlink = site_url('sessions/passwordreset/' . $token);
165
+                $email_resetlink = site_url('sessions/passwordreset/'.$token);
166 166
                 $email_message = $this->load->view('emails/passwordreset', array(
167 167
                     'resetlink' => $email_resetlink
168 168
                 ), true);
169
-                $email_from = 'system@' . preg_replace("/^[\w]{2,6}:\/\/([\w\d\.\-]+).*$/", "$1", base_url());
169
+                $email_from = 'system@'.preg_replace("/^[\w]{2,6}:\/\/([\w\d\.\-]+).*$/", "$1", base_url());
170 170
 
171 171
                 // Mail the invoice with the pre-configured mailer if possible
172 172
                 if (mailer_configured()) {
173 173
 
174 174
                     $this->load->helper('mailer/phpmailer');
175 175
 
176
-                    if (!phpmail_send($email_from, $email, trans('password_reset'), $email_message)) {
176
+                    if ( ! phpmail_send($email_from, $email, trans('password_reset'), $email_message)) {
177 177
                         $email_failed = true;
178 178
                         log_message('error', $this->email->print_debugger());
179 179
                     }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
                     $this->email->message($email_message);
194 194
 
195 195
                     // Send the reset email
196
-                    if (!$this->email->send()) {
196
+                    if ( ! $this->email->send()) {
197 197
                         $email_failed = true;
198 198
                         log_message('error', $this->email->print_debugger());
199 199
                     }
Please login to merge, or discard this patch.
application/modules/invoices/views/modal_create_invoice.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,9 +59,9 @@
 block discarded – undo
59 59
                 <select name="client_name" id="client_name" class="form-control" autofocus="autofocus">
60 60
                     <?php
61 61
                     foreach ($clients as $client) {
62
-                        echo "<option value=\"" . htmlspecialchars($client->client_name) . "\" ";
62
+                        echo "<option value=\"".htmlspecialchars($client->client_name)."\" ";
63 63
                         if ($client_name == $client->client_name) echo 'selected';
64
-                        echo ">" . htmlspecialchars($client->client_name) . "</option>";
64
+                        echo ">".htmlspecialchars($client->client_name)."</option>";
65 65
                     }
66 66
                     ?>
67 67
                 </select>
Please login to merge, or discard this patch.
application/helpers/mpdf_helper.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -16,6 +16,9 @@
 block discarded – undo
16 16
  *
17 17
  */
18 18
 
19
+/**
20
+ * @param boolean $isInvoice
21
+ */
19 22
 function pdf_create($html, $filename, $stream = true, $password = null, $isInvoice = null, $isGuest = null, $zugferd_invoice = false, $associatedFiles = null)
20 23
 {
21 24
     $CI = &get_instance();
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('BASEPATH'))
3
+if ( ! defined('BASEPATH'))
4 4
     exit('No direct script access allowed');
5 5
 
6 6
 /*
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
     $invoice_array = array();
25 25
 
26 26
     // mPDF loading
27
-    define('_MPDF_TEMP_PATH', FCPATH . 'uploads/temp/mpdf/');
28
-    define('_MPDF_TTFONTDATAPATH', FCPATH . 'uploads/temp/mpdf/');
27
+    define('_MPDF_TEMP_PATH', FCPATH.'uploads/temp/mpdf/');
28
+    define('_MPDF_TTFONTDATAPATH', FCPATH.'uploads/temp/mpdf/');
29 29
 
30
-    require_once(FCPATH . 'vendor/mpdf/mpdf/mpdf.php');
30
+    require_once(FCPATH.'vendor/mpdf/mpdf/mpdf.php');
31 31
     $mpdf = new mPDF();
32 32
 
33 33
     // mPDF configuration
@@ -49,44 +49,44 @@  discard block
 block discarded – undo
49 49
     }
50 50
 
51 51
     // Set a password if set for the voucher
52
-    if (!empty($password)) {
52
+    if ( ! empty($password)) {
53 53
         $mpdf->SetProtection(array('copy', 'print'), $password, $password);
54 54
     }
55 55
 
56 56
     // Check if the archive folder is available
57
-    if (!(is_dir('./uploads/archive/') || is_link('./uploads/archive/'))) {
57
+    if ( ! (is_dir('./uploads/archive/') || is_link('./uploads/archive/'))) {
58 58
         mkdir('./uploads/archive/', '0777');
59 59
     }
60 60
 
61 61
     // Set the footer if voucher is invoice and if set in settings
62
-    if ($isInvoice && !empty($CI->mdl_settings->settings['pdf_invoice_footer'])) {
62
+    if ($isInvoice && ! empty($CI->mdl_settings->settings['pdf_invoice_footer'])) {
63 63
         $mpdf->setAutoBottomMargin = 'stretch';
64
-        $mpdf->SetHTMLFooter('<div id="footer">' . $CI->mdl_settings->settings['pdf_invoice_footer'] . '</div>');
64
+        $mpdf->SetHTMLFooter('<div id="footer">'.$CI->mdl_settings->settings['pdf_invoice_footer'].'</div>');
65 65
     }
66 66
 
67 67
     $mpdf->WriteHTML($html);
68 68
 
69 69
     if ($isInvoice) {
70 70
 
71
-        foreach (glob(UPLOADS_FOLDER . 'archive/*' . $filename . '.pdf') as $file) {
71
+        foreach (glob(UPLOADS_FOLDER.'archive/*'.$filename.'.pdf') as $file) {
72 72
             array_push($invoice_array, $file);
73 73
         }
74 74
 
75
-        if (!empty($invoice_array) && !is_null($isGuest)) {
75
+        if ( ! empty($invoice_array) && ! is_null($isGuest)) {
76 76
             rsort($invoice_array);
77 77
 
78 78
             if ($stream) {
79
-                return $mpdf->Output($filename . '.pdf', 'I');
79
+                return $mpdf->Output($filename.'.pdf', 'I');
80 80
             } else {
81 81
                 return $invoice_array[0];
82 82
             }
83 83
         }
84 84
 
85
-        $archived_file = UPLOADS_FOLDER . 'archive/' . date('Y-m-d') . '_' . $filename . '.pdf';
85
+        $archived_file = UPLOADS_FOLDER.'archive/'.date('Y-m-d').'_'.$filename.'.pdf';
86 86
         $mpdf->Output($archived_file, 'F');
87 87
 
88 88
         if ($stream) {
89
-            return $mpdf->Output($filename . '.pdf', 'I');
89
+            return $mpdf->Output($filename.'.pdf', 'I');
90 90
         } else {
91 91
             return $archived_file;
92 92
         }
@@ -95,24 +95,24 @@  discard block
 block discarded – undo
95 95
     // If $stream is true (default) the PDF will be displayed directly in the browser
96 96
     // otherwise will be returned as a download
97 97
     if ($stream) {
98
-        return $mpdf->Output($filename . '.pdf', 'I');
98
+        return $mpdf->Output($filename.'.pdf', 'I');
99 99
     } else {
100 100
 
101
-        $mpdf->Output(UPLOADS_FOLDER . 'temp/' . $filename . '.pdf', 'F');
101
+        $mpdf->Output(UPLOADS_FOLDER.'temp/'.$filename.'.pdf', 'F');
102 102
 
103 103
         // Housekeeping
104 104
         // Delete any files in temp/ directory that are >1 hrs old
105 105
         $interval = 3600;
106 106
         if ($handle = @opendir(preg_replace('/\/$/', '', './uploads/temp/'))) {
107 107
             while (false !== ($file = readdir($handle))) {
108
-                if (($file != '..') && ($file != '.') && !is_dir($file) && ((filemtime('./uploads/temp/' . $file) + $interval) < time()) && (substr($file, 0, 1) !== '.') && ($file != 'remove.txt')) { // mPDF 5.7.3
109
-                    unlink(UPLOADS_FOLDER . 'temp/' . $file);
108
+                if (($file != '..') && ($file != '.') && ! is_dir($file) && ((filemtime('./uploads/temp/'.$file) + $interval) < time()) && (substr($file, 0, 1) !== '.') && ($file != 'remove.txt')) { // mPDF 5.7.3
109
+                    unlink(UPLOADS_FOLDER.'temp/'.$file);
110 110
                 }
111 111
             }
112 112
             closedir($handle);
113 113
         }
114 114
 
115
-        return UPLOADS_FOLDER . 'temp/' . $filename . '.pdf';
115
+        return UPLOADS_FOLDER.'temp/'.$filename.'.pdf';
116 116
 
117 117
     }
118 118
 }
Please login to merge, or discard this patch.
index.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
  *
47 47
  */
48 48
 
49
-if (is_dir(__DIR__ . "/application/config/development")) {
49
+if (is_dir(__DIR__."/application/config/development")) {
50 50
     define('ENVIRONMENT', 'development');
51 51
 } else {
52 52
     define('ENVIRONMENT', 'production');
@@ -170,15 +170,15 @@  discard block
 block discarded – undo
170 170
 }
171 171
 
172 172
 if (realpath($system_path) !== FALSE) {
173
-    $system_path = realpath($system_path) . '/';
173
+    $system_path = realpath($system_path).'/';
174 174
 }
175 175
 
176 176
 // ensure there's a trailing slash
177
-$system_path = rtrim($system_path, '/') . '/';
177
+$system_path = rtrim($system_path, '/').'/';
178 178
 
179 179
 // Is the system path correct?
180
-if (!is_dir($system_path)) {
181
-    exit("Your system folder path does not appear to be set correctly. Please open the following file and correct this: " . pathinfo(__FILE__, PATHINFO_BASENAME));
180
+if ( ! is_dir($system_path)) {
181
+    exit("Your system folder path does not appear to be set correctly. Please open the following file and correct this: ".pathinfo(__FILE__, PATHINFO_BASENAME));
182 182
 }
183 183
 
184 184
 /*
@@ -205,17 +205,17 @@  discard block
 block discarded – undo
205 205
 
206 206
 // The path to the "application" folder
207 207
 if (is_dir($application_folder)) {
208
-    define('APPPATH', $application_folder . '/');
208
+    define('APPPATH', $application_folder.'/');
209 209
 } else {
210
-    if (!is_dir(BASEPATH . $application_folder . '/')) {
211
-        exit("Your application folder path does not appear to be set correctly. Please open the following file and correct this: " . SELF);
210
+    if ( ! is_dir(BASEPATH.$application_folder.'/')) {
211
+        exit("Your application folder path does not appear to be set correctly. Please open the following file and correct this: ".SELF);
212 212
     }
213 213
 
214
-    define('APPPATH', BASEPATH . $application_folder . '/');
214
+    define('APPPATH', BASEPATH.$application_folder.'/');
215 215
 }
216 216
 
217 217
 // Set the uploads folder
218
-define('UPLOADS_FOLDER', FCPATH . 'uploads/');
218
+define('UPLOADS_FOLDER', FCPATH.'uploads/');
219 219
 
220 220
 /*
221 221
  * --------------------------------------------------------------------
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
  * And away we go...
226 226
  *
227 227
  */
228
-require_once BASEPATH . 'core/CodeIgniter.php';
228
+require_once BASEPATH.'core/CodeIgniter.php';
229 229
 
230 230
 /* End of file index.php */
231 231
 /* Location: ./index.php */
Please login to merge, or discard this patch.
application/modules/invoices/controllers/cron.php 2 patches
Spacing   +8 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('BASEPATH'))
3
+if ( ! defined('BASEPATH'))
4 4
     exit('No direct script access allowed');
5 5
 
6 6
 /*
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
                 $this->load->model('email_templates/mdl_email_templates');
71 71
 
72 72
                 $email_template_id = $this->mdl_settings->setting('email_invoice_template');
73
-                if (!$email_template_id) {
73
+                if ( ! $email_template_id) {
74 74
                     return;
75 75
                 }
76 76
 
@@ -93,13 +93,11 @@  discard block
 block discarded – undo
93 93
                     $body = htmlspecialchars_decode(nl2br($body));
94 94
                 }
95 95
 
96
-                $from = !empty($tpl->email_template_from_email) ?
97
-                    array($tpl->email_template_from_email, $tpl->email_template_from_name) :
98
-                    array($invoice->user_email, "");
96
+                $from = ! empty($tpl->email_template_from_email) ?
97
+                    array($tpl->email_template_from_email, $tpl->email_template_from_name) : array($invoice->user_email, "");
99 98
 
100
-                $subject = !empty($tpl->email_template_subject) ?
101
-                    $tpl->email_template_subject :
102
-                    trans('invoice') . ' #' . $new_invoice->invoice_number;
99
+                $subject = ! empty($tpl->email_template_subject) ?
100
+                    $tpl->email_template_subject : trans('invoice').' #'.$new_invoice->invoice_number;
103 101
 
104 102
                 $pdf_template = $tpl->email_template_pdf_template;
105 103
                 $to = $invoice->client_email;
@@ -110,11 +108,11 @@  discard block
 block discarded – undo
110 108
                     $this->mdl_invoices->mark_sent($target_id);
111 109
                     $this->mdl_invoice_amounts->calculate($target_id);
112 110
                 } else {
113
-                    log_message('error', 'Invoice ' . $target_id . 'could not be sent. Please review your Email settings.');
111
+                    log_message('error', 'Invoice '.$target_id.'could not be sent. Please review your Email settings.');
114 112
                 }
115 113
             }
116 114
         }
117 115
 
118
-        log_message('debug', '[Recurring Invoices] ' . count($invoices_recurring) . ' recurring invoices processed');
116
+        log_message('debug', '[Recurring Invoices] '.count($invoices_recurring).' recurring invoices processed');
119 117
     }
120 118
 }
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('BASEPATH'))
3
+if (!defined('BASEPATH')) {
4 4
     exit('No direct script access allowed');
5
+}
5 6
 
6 7
 /*
7 8
  * InvoicePlane
@@ -22,7 +23,9 @@  discard block
 block discarded – undo
22 23
     {
23 24
         // Check the provided cron key
24 25
         if ($cron_key != $this->mdl_settings->setting('cron_key')) {
25
-            if (IP_DEBUG) log_message('error', 'Wrong cron key provided!');
26
+            if (IP_DEBUG) {
27
+                log_message('error', 'Wrong cron key provided!');
28
+            }
26 29
             exit('Wrong cron key!');
27 30
         }
28 31
 
Please login to merge, or discard this patch.
application/modules/invoices/views/partial_item_table.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
                     <span class="input-group-addon"><?php echo trans('item_discount'); ?></span>
46 46
                     <input type="text" name="item_discount_amount" class="input-sm form-control amount"
47 47
                            value="" data-toggle="tooltip" data-placement="bottom"
48
-                           title="<?php echo $this->mdl_settings->setting('currency_symbol') . ' ' . trans('per_item'); ?>">
48
+                           title="<?php echo $this->mdl_settings->setting('currency_symbol').' '.trans('per_item'); ?>">
49 49
                 </div>
50 50
             </td>
51 51
             <td class="td-amount">
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
                         <option value="0"><?php echo trans('none'); ?></option>
57 57
                         <?php foreach ($tax_rates as $tax_rate) { ?>
58 58
                             <option value="<?php echo $tax_rate->tax_rate_id; ?>">
59
-                                <?php echo format_amount($tax_rate->tax_rate_percent) . '% - ' . $tax_rate->tax_rate_name; ?>
59
+                                <?php echo format_amount($tax_rate->tax_rate_percent).'% - '.$tax_rate->tax_rate_name; ?>
60 60
                             </option>
61 61
                         <?php } ?>
62 62
                     </select>
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
                         <input type="text" name="item_discount_amount" class="input-sm form-control amount"
138 138
                                value="<?php echo format_amount($item->item_discount_amount); ?>"
139 139
                                data-toggle="tooltip" data-placement="bottom"
140
-                               title="<?php echo $this->mdl_settings->setting('currency_symbol') . ' ' . trans('per_item'); ?>"
140
+                               title="<?php echo $this->mdl_settings->setting('currency_symbol').' '.trans('per_item'); ?>"
141 141
                             <?php if ($invoice->is_read_only == 1) {
142 142
                                 echo 'disabled="disabled"';
143 143
                             } ?>>
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
                             <?php foreach ($tax_rates as $tax_rate) { ?>
156 156
                                 <option value="<?php echo $tax_rate->tax_rate_id; ?>"
157 157
                                         <?php if ($item->item_tax_rate_id == $tax_rate->tax_rate_id) { ?>selected="selected"<?php } ?>>
158
-                                    <?php echo format_amount($tax_rate->tax_rate_percent) . '% - ' . $tax_rate->tax_rate_name; ?>
158
+                                    <?php echo format_amount($tax_rate->tax_rate_percent).'% - '.$tax_rate->tax_rate_name; ?>
159 159
                                 </option>
160 160
                             <?php } ?>
161 161
                         </select>
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
                 </td>
164 164
                 <td class="td-icon text-right td-vert-middle">
165 165
                     <?php if ($invoice->is_read_only != 1): ?>
166
-                        <a href="<?php echo site_url('invoices/delete_item/' . $invoice->invoice_id . '/' . $item->item_id); ?>"
166
+                        <a href="<?php echo site_url('invoices/delete_item/'.$invoice->invoice_id.'/'.$item->item_id); ?>"
167 167
                            title="<?php echo trans('delete'); ?>">
168 168
                             <i class="fa fa-trash-o text-danger"></i>
169 169
                         </a>
@@ -246,8 +246,8 @@  discard block
 block discarded – undo
246 246
                     <?php if ($invoice_tax_rates) {
247 247
                         foreach ($invoice_tax_rates as $invoice_tax_rate) { ?>
248 248
                             <span class="text-muted">
249
-                            <?php echo anchor('invoices/delete_invoice_tax/' . $invoice->invoice_id . '/' . $invoice_tax_rate->invoice_tax_rate_id, '<i class="fa fa-trash-o"></i>');
250
-                            echo ' ' . $invoice_tax_rate->invoice_tax_rate_name . ' ' . format_amount($invoice_tax_rate->invoice_tax_rate_percent); ?>
249
+                            <?php echo anchor('invoices/delete_invoice_tax/'.$invoice->invoice_id.'/'.$invoice_tax_rate->invoice_tax_rate_id, '<i class="fa fa-trash-o"></i>');
250
+                            echo ' '.$invoice_tax_rate->invoice_tax_rate_name.' '.format_amount($invoice_tax_rate->invoice_tax_rate_percent); ?>
251 251
                                 %</span>&nbsp;
252 252
                             <span class="amount">
253 253
                                 <?php echo format_currency($invoice_tax_rate->invoice_tax_rate_amount); ?>
Please login to merge, or discard this patch.
application/modules/invoices/views/modal_add_invoice_tax.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
                         <option value="0"><?php echo trans('none'); ?></option>
36 36
                         <?php foreach ($tax_rates as $tax_rate) { ?>
37 37
                             <option
38
-                                value="<?php echo $tax_rate->tax_rate_id; ?>"><?php echo format_amount($tax_rate->tax_rate_percent) . '% - ' . $tax_rate->tax_rate_name; ?></option>
38
+                                value="<?php echo $tax_rate->tax_rate_id; ?>"><?php echo format_amount($tax_rate->tax_rate_percent).'% - '.$tax_rate->tax_rate_name; ?></option>
39 39
                         <?php } ?>
40 40
                     </select>
41 41
                 </div>
Please login to merge, or discard this patch.