Browse Source

Various smaller PHP doc and code formatting improvements

Kovah 2 years ago
parent
commit
f30b284572
36 changed files with 183 additions and 104 deletions
  1. 2 2
      application/core/MY_Model.php
  2. 2 2
      application/core/User_Controller.php
  3. 2 2
      application/helpers/date_helper.php
  4. 28 11
      application/helpers/diacritics_helper.php
  5. 4 3
      application/helpers/invoice_helper.php
  6. 6 4
      application/helpers/mailer_helper.php
  7. 2 2
      application/helpers/mpdf_helper.php
  8. 3 1
      application/helpers/pdf_helper.php
  9. 1 1
      application/helpers/redirect_helper.php
  10. 3 0
      application/libraries/Sumex.php
  11. 15 1
      application/libraries/ZugferdXml.php
  12. 4 4
      application/modules/clients/controllers/Ajax.php
  13. 9 9
      application/modules/clients/models/Mdl_clients.php
  14. 1 1
      application/modules/custom_fields/models/Mdl_custom_fields.php
  15. 3 3
      application/modules/custom_values/models/Mdl_custom_values.php
  16. 3 1
      application/modules/guest/controllers/Payment_handler.php
  17. 3 1
      application/modules/guest/controllers/Payment_information.php
  18. 3 1
      application/modules/guest/controllers/View.php
  19. 5 5
      application/modules/guest/views/payment_information.php
  20. 2 1
      application/modules/import/models/Mdl_import.php
  21. 3 1
      application/modules/invoices/controllers/Cron.php
  22. 1 2
      application/modules/invoices/models/Mdl_invoices.php
  23. 3 1
      application/modules/invoices/views/partial_item_table.php
  24. 4 1
      application/modules/layout/views/includes/head.php
  25. 12 4
      application/modules/mailer/controllers/Mailer.php
  26. 3 0
      application/modules/quotes/models/Mdl_quotes.php
  27. 13 5
      application/modules/reports/models/Mdl_reports.php
  28. 3 1
      application/modules/settings/models/Mdl_settings.php
  29. 1 1
      application/modules/setup/models/Mdl_setup.php
  30. 5 3
      application/modules/setup/views/create_user.php
  31. 3 1
      application/modules/tasks/views/form.php
  32. 2 2
      application/modules/upload/controllers/Upload.php
  33. 2 1
      application/modules/users/views/form.php
  34. 6 3
      application/modules/users/views/form_change_password.php
  35. 9 4
      application/views/reports/sales_by_year.php
  36. 12 19
      index.php

+ 2 - 2
application/core/MY_Model.php

@@ -319,7 +319,7 @@ class MY_Model extends CI_Model
      * Used to retrieve record by ID and populate $this->form_values
      *
      * @param int $id
-     * @return boolean
+     * @return boolean|null
      */
     public function prep_form($id = null)
     {
@@ -396,7 +396,7 @@ class MY_Model extends CI_Model
     }
 
     /**
-     * @param $key
+     * @param string $key
      * @param $value
      */
     public function set_form_value($key, $value)

+ 2 - 2
application/core/User_Controller.php

@@ -17,8 +17,8 @@ class User_Controller extends Base_Controller
 {
     /**
      * User_Controller constructor.
-     * @param $required_key
-     * @param $required_val
+     * @param string $required_key
+     * @param integer $required_val
      */
     public function __construct($required_key, $required_val)
     {

+ 2 - 2
application/helpers/date_helper.php

@@ -128,7 +128,7 @@ function is_date($date)
 }
 
 /**
- * @return mixed
+ * @return string
  */
 function date_format_setting()
 {
@@ -142,7 +142,7 @@ function date_format_setting()
 }
 
 /**
- * @return mixed
+ * @return string
  */
 function date_format_datepicker()
 {

+ 28 - 11
application/helpers/diacritics_helper.php

@@ -11,7 +11,7 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
  */
 
 /**
- * @param $str
+ * @param string $str
  * @return bool
  */
 function diacritics_seems_utf8($str)
@@ -19,16 +19,32 @@ function diacritics_seems_utf8($str)
     $length = strlen($str);
     for ($i = 0; $i < $length; $i++) {
         $c = ord($str[$i]);
-        if ($c < 0x80) $n = 0; # 0bbbbbbb
-        elseif (($c & 0xE0) == 0xC0) $n = 1; # 110bbbbb
-        elseif (($c & 0xF0) == 0xE0) $n = 2; # 1110bbbb
-        elseif (($c & 0xF8) == 0xF0) $n = 3; # 11110bbb
-        elseif (($c & 0xFC) == 0xF8) $n = 4; # 111110bb
-        elseif (($c & 0xFE) == 0xFC) $n = 5; # 1111110b
-        else return false; # Does not match any model
+        if ($c < 0x80) {
+            $n = 0;
+        } # 0bbbbbbb
+        elseif (($c & 0xE0) == 0xC0) {
+            $n = 1;
+        } # 110bbbbb
+        elseif (($c & 0xF0) == 0xE0) {
+            $n = 2;
+        } # 1110bbbb
+        elseif (($c & 0xF8) == 0xF0) {
+            $n = 3;
+        } # 11110bbb
+        elseif (($c & 0xFC) == 0xF8) {
+            $n = 4;
+        } # 111110bb
+        elseif (($c & 0xFE) == 0xFC) {
+            $n = 5;
+        } # 1111110b
+        else {
+            return false;
+        }
+        # Does not match any model
         for ($j = 0; $j < $n; $j++) { # n bytes matching 10bbbbbb follow ?
-            if ((++$i == $length) || ((ord($str[$i]) & 0xC0) != 0x80))
+            if ((++$i == $length) || ((ord($str[$i]) & 0xC0) != 0x80)) {
                 return false;
+            }
         }
     }
     return true;
@@ -44,8 +60,9 @@ function diacritics_seems_utf8($str)
  */
 function diacritics_remove_accents($string)
 {
-    if (!preg_match('/[\x80-\xff]/', $string))
+    if (!preg_match('/[\x80-\xff]/', $string)) {
         return $string;
+    }
 
     if (diacritics_seems_utf8($string)) {
         $chars = array(
@@ -174,7 +191,7 @@ function diacritics_remove_accents($string)
 }
 
 /**
- * @param $text
+ * @param string $text
  * @return string
  */
 function diacritics_remove_diacritics($text)

+ 4 - 3
application/helpers/invoice_helper.php

@@ -47,9 +47,9 @@ function invoice_logo_pdf()
  * Returns a Swiss IS / IS+ code line
  * Documentation: https://www.postfinance.ch/binp/postfinance/public/dam.M26m_i6_6ceYcN2XtAN4w8OHMynQG7FKxJVK8TtQzr0.spool/content/dam/pf/de/doc/consult/manual/dlserv/inpayslip_isr_man_en.pdf
  *
- * @param $slipType
+ * @param string $slipType
  * @param $amount
- * @param $rnumb
+ * @param string $rnumb
  * @param $subNumb
  * @return string
  * @throws Error
@@ -89,7 +89,8 @@ function invoice_genCodeline($slipType, $amount, $rnumb, $subNumb)
  * See https://www.postfinance.ch/binp/postfinance/public/dam.Ii-X5NgtAixO8cQPvja46blV6d7cZCyGUscxO15L5S8.spool/content/dam/pf/de/doc/consult/manual/dldata/efin_recdescr_man_en.pdf
  * Page 5
  *
- * @return string
+ * @param string $in
+ * @return integer
  */
 function invoice_recMod10($in)
 {

+ 6 - 4
application/helpers/mailer_helper.php

@@ -33,7 +33,7 @@ function mailer_configured()
  * @param $from
  * @param $to
  * @param $subject
- * @param $body
+ * @param string $body
  * @param null $cc
  * @param null $bcc
  * @param null $attachments
@@ -75,7 +75,7 @@ function email_invoice($invoice_id, $invoice_template, $from, $to, $subject, $bo
  * @param $from
  * @param $to
  * @param $subject
- * @param $body
+ * @param string $body
  * @param null $cc
  * @param null $bcc
  * @param null $attachments
@@ -107,7 +107,7 @@ function email_quote($quote_id, $quote_template, $from, $to, $subject, $body, $c
 /**
  * Send an email if the status of an email changed
  * @param $quote_id
- * @param $status string "accepted" or "rejected"
+ * @param string $status string "accepted" or "rejected"
  * @return bool if the email was sent
  */
 function email_quote_status($quote_id, $status)
@@ -115,7 +115,9 @@ function email_quote_status($quote_id, $status)
     ini_set('display_errors', 'on');
     error_reporting(E_ALL);
 
-    if (!mailer_configured()) return false;
+    if (!mailer_configured()) {
+        return false;
+    }
 
     $CI = &get_instance();
     $CI->load->helper('mailer/phpmailer');

+ 2 - 2
application/helpers/mpdf_helper.php

@@ -14,10 +14,10 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
  * Create a PDF
  *
  * @param $html
- * @param $filename
+ * @param string $filename
  * @param bool $stream
  * @param null $password
- * @param null $isInvoice
+ * @param boolean $isInvoice
  * @param null $is_guest
  * @param bool $zugferd_invoice
  * @param null $associated_files

+ 3 - 1
application/helpers/pdf_helper.php

@@ -43,7 +43,9 @@ function generate_invoice_pdf($invoice_id, $stream = true, $invoice_template = n
     }
 
     $payment_method = $CI->mdl_payment_methods->where('payment_method_id', $invoice->payment_method)->get()->row();
-    if ($invoice->payment_method == 0) $payment_method = false;
+    if ($invoice->payment_method == 0) {
+        $payment_method = false;
+    }
 
     // Determine if discounts should be displayed
     $items = $CI->mdl_items->where('invoice_id', $invoice_id)->get()->result();

+ 1 - 1
application/helpers/redirect_helper.php

@@ -13,7 +13,7 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
 /**
  * Redirect the user to a given URL
  *
- * @param $fallback_url_string
+ * @param string $fallback_url_string
  * @param bool $redirect
  * @return mixed
  */

+ 3 - 0
application/libraries/Sumex.php

@@ -625,6 +625,9 @@ class Sumex
         return $node;
     }
 
+    /**
+     * @param integer $recordId
+     */
     protected function generateRecord($recordId, $item)
     {
         $node = $this->doc->createElement('invoice:record_other');

+ 15 - 1
application/libraries/ZugferdXml.php

@@ -88,6 +88,9 @@ class ZugferdXml
         return $el;
     }
 
+    /**
+     * @return string|null
+     */
     function zugferdFormattedDate($date)
     {
         if ($date && $date <> '0000-00-00') {
@@ -155,6 +158,9 @@ class ZugferdXml
         return $node;
     }
 
+    /**
+     * @param string $schemeID
+     */
     protected function xmlSpecifiedTaxRegistration($schemeID, $content)
     {
         $node = $this->doc->createElement('ram:SpecifiedTaxRegistration');
@@ -200,7 +206,9 @@ class ZugferdXml
     {
         $result = [];
         foreach ($this->items as $item) {
-            if ($item->item_tax_rate_percent == 0) continue;
+            if ($item->item_tax_rate_percent == 0) {
+                continue;
+            }
 
             if (!isset($result[$item->item_tax_rate_percent])) {
                 $result[$item->item_tax_rate_percent] = 0;
@@ -221,6 +229,9 @@ class ZugferdXml
         return $node;
     }
 
+    /**
+     * @param string $name
+     */
     protected function currencyElement($name, $amount, $nb_decimals = 2)
     {
         $el = $this->doc->createElement($name, $this->zugferdFormattedFloat($amount, $nb_decimals));
@@ -300,6 +311,9 @@ class ZugferdXml
         return $node;
     }
 
+    /**
+     * @param string $name
+     */
     protected function quantityElement($name, $quantity)
     {
         $el = $this->doc->createElement($name, $this->zugferdFormattedFloat($quantity, 4));

+ 4 - 4
application/modules/clients/controllers/Ajax.php

@@ -34,12 +34,12 @@ class Ajax extends Admin_Controller
 
         // Search for clients
         $escapedQuery = $this->db->escape_str($query);
-        $escapedQuery = str_replace("%","",$escapedQuery);
+        $escapedQuery = str_replace("%", "", $escapedQuery);
         $clients = $this->mdl_clients
             ->where('client_active', 1)
-            ->having('client_name LIKE \''.$escapedQuery.'%\'')
-            ->or_having('client_surname LIKE \''.$escapedQuery.'%\'')
-            ->or_having('client_fullname LIKE \''.$escapedQuery.'%\'')
+            ->having('client_name LIKE \'' . $escapedQuery . '%\'')
+            ->or_having('client_surname LIKE \'' . $escapedQuery . '%\'')
+            ->or_having('client_fullname LIKE \'' . $escapedQuery . '%\'')
             ->order_by('client_name')
             ->get()
             ->result();

+ 9 - 9
application/modules/clients/models/Mdl_clients.php

@@ -23,9 +23,9 @@ class Mdl_Clients extends Response_Model
     public function default_select()
     {
         $this->db->select(
-          'SQL_CALC_FOUND_ROWS '.$this->table.'.*, '.
-          'CONCAT('.$this->table.'.client_name, " ", '.$this->table.'.client_surname) as client_fullname'
-        , false);
+            'SQL_CALC_FOUND_ROWS ' . $this->table . '.*, ' .
+            'CONCAT(' . $this->table . '.client_name, " ", ' . $this->table . '.client_surname) as client_fullname'
+            , false);
     }
 
     public function default_order_by()
@@ -220,12 +220,6 @@ class Mdl_Clients extends Response_Model
         return $this;
     }
 
-    public function is_active()
-    {
-        $this->filter_where('client_active', 1);
-        return $this;
-    }
-
     public function is_inactive()
     {
         $this->filter_where('client_active', 0);
@@ -255,4 +249,10 @@ class Mdl_Clients extends Response_Model
         return $this->get()->result();
     }
 
+    public function is_active()
+    {
+        $this->filter_where('client_active', 1);
+        return $this;
+    }
+
 }

+ 1 - 1
application/modules/custom_fields/models/Mdl_custom_fields.php

@@ -31,7 +31,7 @@ class Mdl_Custom_Fields extends MY_Model
     }
 
     /**
-     * @return array
+     * @return string[]
      */
     public static function custom_types()
     {

+ 3 - 3
application/modules/custom_values/models/Mdl_custom_values.php

@@ -19,7 +19,7 @@ class Mdl_Custom_Values extends MY_Model
     public $primary_key = 'ip_custom_values.custom_values_id';
 
     /**
-     * @return array
+     * @return string[]
      */
     public static function custom_types()
     {
@@ -27,7 +27,7 @@ class Mdl_Custom_Values extends MY_Model
     }
 
     /**
-     * @return array
+     * @return string[]
      */
     public static function user_input_types()
     {
@@ -39,7 +39,7 @@ class Mdl_Custom_Values extends MY_Model
     }
 
     /**
-     * @return array
+     * @return string[]
      */
     public static function custom_value_fields()
     {

+ 3 - 1
application/modules/guest/controllers/Payment_handler.php

@@ -166,7 +166,9 @@ class Payment_Handler extends Base_Controller
             $key = str_replace('gateway_' . $d, '', $key);
 
             // skip empty key
-            if (!$key) continue;
+            if (!$key) {
+                continue;
+            }
 
             // Decode password fields and checkboxes
             if (isset($gateway_settings[$key]) && $gateway_settings[$key]['type'] == 'password') {

+ 3 - 1
application/modules/guest/controllers/Payment_information.php

@@ -67,7 +67,9 @@ class Payment_Information extends Base_Controller
 
         // Get additional invoice information
         $payment_method = $this->mdl_payment_methods->where('payment_method_id', $invoice->payment_method)->get()->row();
-        if ($invoice->payment_method == 0) $payment_method = null;
+        if ($invoice->payment_method == 0) {
+            $payment_method = null;
+        }
 
         $is_overdue = ($invoice->invoice_balance > 0 && strtotime($invoice->invoice_date_due) < time() ? true : false);
 

+ 3 - 1
application/modules/guest/controllers/View.php

@@ -36,7 +36,9 @@ class View extends Base_Controller
             }
 
             $payment_method = $this->mdl_payment_methods->where('payment_method_id', $invoice->payment_method)->get()->row();
-            if ($invoice->payment_method == 0) $payment_method = null;
+            if ($invoice->payment_method == 0) {
+                $payment_method = null;
+            }
 
             // Attachments
             $attachments = $this->get_attachments($invoice_url_key);

+ 5 - 5
application/modules/guest/views/payment_information.php

@@ -130,11 +130,11 @@
                             </div>
                         </div>
                         <?php if (!empty($invoice->invoice_terms)) : ?>
-                        <div class="col-xs-12 text-muted">
-                            <br>
-                            <h4><?php echo trans('terms'); ?></h4>
-                            <div><?php echo nl2br(htmlsc($invoice->invoice_terms)); ?></div>
-                        </div>
+                            <div class="col-xs-12 text-muted">
+                                <br>
+                                <h4><?php echo trans('terms'); ?></h4>
+                                <div><?php echo nl2br(htmlsc($invoice->invoice_terms)); ?></div>
+                            </div>
                         <?php endif; ?>
                     </div>
 

+ 2 - 1
application/modules/import/models/Mdl_import.php

@@ -124,8 +124,9 @@ class Mdl_Import extends Response_Model
             $fileheaders = null;
             if ($row == 1) {
                 foreach ($headers as $header) {
-                    if (!in_array($header, $data))
+                    if (!in_array($header, $data)) {
                         return false;
+                    }
                 }
                 $fileheaders = $data;
             } elseif ($row > 1) {

+ 3 - 1
application/modules/invoices/controllers/Cron.php

@@ -22,7 +22,9 @@ class Cron extends Base_Controller
     {
         // Check the provided cron key
         if ($cron_key != get_setting('cron_key')) {
-            if (IP_DEBUG) log_message('error', 'Wrong cron key provided!');
+            if (IP_DEBUG) {
+                log_message('error', 'Wrong cron key provided!');
+            }
             exit('Wrong cron key!');
         }
 

+ 1 - 2
application/modules/invoices/models/Mdl_invoices.php

@@ -358,7 +358,7 @@ class Mdl_Invoices extends Response_Model
     }
 
     /**
-     * @param $invoice_date_created
+     * @param string $invoice_date_created
      * @return string
      */
     public function get_date_due($invoice_date_created)
@@ -408,7 +408,6 @@ class Mdl_Invoices extends Response_Model
     }
 
     /**
-     * @param int $invoice_id
      * @return mixed
      */
     public function get_custom_values($id)

+ 3 - 1
application/modules/invoices/views/partial_item_table.php

@@ -128,7 +128,9 @@
                             echo 'disabled="disabled"';
                         } ?>>
                     <input type="hidden" name="item_task_id" class="item-task-id"
-                           value="<?php if ($item->item_task_id) echo $item->item_task_id; ?>">
+                           value="<?php if ($item->item_task_id) {
+                               echo $item->item_task_id;
+                           } ?>">
                     <input type="hidden" name="item_product_id" value="<?php echo $item->item_product_id; ?>">
 
                     <div class="input-group">

+ 4 - 1
application/modules/layout/views/includes/head.php

@@ -72,7 +72,10 @@
         $(document).on('click', '#btn_copy_quote', function () {
             var quote_id = $(this).data('quote-id');
             var client_id = $(this).data('client-id');
-            $('#modal-placeholder').load("<?php echo site_url('quotes/ajax/modal_copy_quote'); ?>", {quote_id: quote_id, client_id: client_id});
+            $('#modal-placeholder').load("<?php echo site_url('quotes/ajax/modal_copy_quote'); ?>", {
+                quote_id: quote_id,
+                client_id: client_id
+            });
         });
 
         $(document).on('click', '.client-create-invoice', function () {

+ 12 - 4
application/modules/mailer/controllers/Mailer.php

@@ -39,7 +39,9 @@ class Mailer extends Admin_Controller
      */
     public function invoice($invoice_id)
     {
-        if (!$this->mailer_configured) return;
+        if (!$this->mailer_configured) {
+            return;
+        }
 
         $this->load->model('invoices/mdl_templates');
         $this->load->model('invoices/mdl_invoices');
@@ -79,7 +81,9 @@ class Mailer extends Admin_Controller
      */
     public function quote($quote_id)
     {
-        if (!$this->mailer_configured) return;
+        if (!$this->mailer_configured) {
+            return;
+        }
 
         $this->load->model('invoices/mdl_templates');
         $this->load->model('quotes/mdl_quotes');
@@ -122,7 +126,9 @@ class Mailer extends Admin_Controller
             redirect('invoices/view/' . $invoice_id);
         }
 
-        if (!$this->mailer_configured) return;
+        if (!$this->mailer_configured) {
+            return;
+        }
 
         $to = $this->input->post('to_email');
 
@@ -169,7 +175,9 @@ class Mailer extends Admin_Controller
             redirect('quotes/view/' . $quote_id);
         }
 
-        if (!$this->mailer_configured) return;
+        if (!$this->mailer_configured) {
+            return;
+        }
 
         $to = $this->input->post('to_email');
 

+ 3 - 0
application/modules/quotes/models/Mdl_quotes.php

@@ -277,6 +277,9 @@ class Mdl_Quotes extends Response_Model
         return $db_array;
     }
 
+    /**
+     * @param string $quote_date_created
+     */
     public function get_date_due($quote_date_created)
     {
         $quote_date_expires = new DateTime($quote_date_created);

+ 13 - 5
application/modules/reports/models/Mdl_reports.php

@@ -197,13 +197,21 @@ class Mdl_Reports extends CI_Model
      */
     public function sales_by_year($from_date = null, $to_date = null, $minQuantity = null, $maxQuantity = null, $taxChecked = False)
     {
-        if ($minQuantity == "") $minQuantity = 0;
+        if ($minQuantity == "") {
+            $minQuantity = 0;
+        }
 
-        if ($from_date == "") $from_date = date("Y-m-d");
-        else $from_date = date_to_mysql($from_date);
+        if ($from_date == "") {
+            $from_date = date("Y-m-d");
+        } else {
+            $from_date = date_to_mysql($from_date);
+        }
 
-        if ($to_date == "") $to_date = date("Y-m-d");
-        else $to_date = date_to_mysql($to_date);
+        if ($to_date == "") {
+            $to_date = date("Y-m-d");
+        } else {
+            $to_date = date_to_mysql($to_date);
+        }
 
         $from_date_year = intval(substr($from_date, 0, 4));
         $to_date_year = intval(substr($to_date, 0, 4));

+ 3 - 1
application/modules/settings/models/Mdl_settings.php

@@ -112,7 +112,9 @@ class Mdl_Settings extends CI_Model
         $themes = [];
 
         foreach ($found_folders as $theme) {
-            if ($theme == 'core') continue;
+            if ($theme == 'core') {
+                continue;
+            }
 
             // Get the theme info file
             $theme = str_replace('/', '', $theme);

+ 1 - 1
application/modules/setup/models/Mdl_setup.php

@@ -40,7 +40,7 @@ class Mdl_Setup extends CI_Model
     }
 
     /**
-     * @param $contents
+     * @param string $contents
      */
     private function execute_contents($contents)
     {

+ 5 - 3
application/modules/setup/views/create_user.php

@@ -7,7 +7,7 @@
 
         var password_input = $('.passwordmeter-input');
         if (password_input) {
-            password_input.on('input', function(){
+            password_input.on('input', function () {
                 var strength = zxcvbn(password_input.val());
 
                 $('.passmeter-2, .passmeter-3').hide();
@@ -66,8 +66,10 @@
                        class="form-control passwordmeter-input">
                 <div class="progress" style="height:3px;">
                     <div class="progress-bar progress-bar-danger passmeter passmeter-1" style="width: 33%"></div>
-                    <div class="progress-bar progress-bar-warning passmeter passmeter-2" style="display: none; width: 33%"></div>
-                    <div class="progress-bar progress-bar-success passmeter passmeter-3" style="display: none; width: 34%"></div>
+                    <div class="progress-bar progress-bar-warning passmeter passmeter-2"
+                         style="display: none; width: 33%"></div>
+                    <div class="progress-bar progress-bar-success passmeter passmeter-3"
+                         style="display: none; width: 34%"></div>
                 </div>
 
                 <span class="help-block"><?php _trans('setup_user_password_info'); ?></span>

+ 3 - 1
application/modules/tasks/views/form.php

@@ -91,7 +91,9 @@ if ($this->mdl_tasks->form_value('task_id') && $this->mdl_tasks->form_value('tas
                             <label for="task_status"><?php _trans('status'); ?></label>
                             <select name="task_status" id="task_status" class="form-control simple-select">
                                 <?php foreach ($task_statuses as $key => $status) {
-                                    if ($this->mdl_tasks->form_value('task_status') != 4 && $key == 4) continue; ?>
+                                    if ($this->mdl_tasks->form_value('task_status') != 4 && $key == 4) {
+                                        continue;
+                                    } ?>
                                     <option value="<?php echo $key; ?>" <?php check_select($key, $this->mdl_tasks->form_value('task_status')); ?>>
                                         <?php echo $status['label']; ?>
                                     </option>

+ 2 - 2
application/modules/upload/controllers/Upload.php

@@ -41,7 +41,7 @@ class Upload extends Admin_Controller
     /**
      * @param $customerId
      * @param $url_key
-     * @return bool
+     * @return boolean|null
      */
     public function upload_file($customerId, $url_key)
     {
@@ -85,7 +85,7 @@ class Upload extends Admin_Controller
     }
 
     /**
-     * @param $path
+     * @param string $path
      * @param string $chmod
      * @return bool
      */

+ 2 - 1
application/modules/users/views/form.php

@@ -96,7 +96,8 @@ $cv = $this->controller->view_data["custom_values"];
                                 </div>
                             <?php } else { ?>
                                 <div class="form-group">
-                                    <a href="<?php echo site_url('users/change_password/' . $id); ?>" class="btn btn-default">
+                                    <a href="<?php echo site_url('users/change_password/' . $id); ?>"
+                                       class="btn btn-default">
                                         <?php _trans('change_password'); ?>
                                     </a>
                                 </div>

+ 6 - 3
application/modules/users/views/form_change_password.php

@@ -29,9 +29,12 @@
                             <input type="password" name="user_password" id="user_password"
                                    class="form-control passwordmeter-input">
                             <div class="progress" style="height:3px;">
-                                <div class="progress-bar progress-bar-danger passmeter passmeter-1" style="width: 33%"></div>
-                                <div class="progress-bar progress-bar-warning passmeter passmeter-2" style="display: none; width: 33%"></div>
-                                <div class="progress-bar progress-bar-success passmeter passmeter-3" style="display: none; width: 34%"></div>
+                                <div class="progress-bar progress-bar-danger passmeter passmeter-1"
+                                     style="width: 33%"></div>
+                                <div class="progress-bar progress-bar-warning passmeter passmeter-2"
+                                     style="display: none; width: 33%"></div>
+                                <div class="progress-bar progress-bar-success passmeter passmeter-3"
+                                     style="display: none; width: 34%"></div>
                             </div>
                         </div>
 

+ 9 - 4
application/views/reports/sales_by_year.php

@@ -90,10 +90,15 @@
                 <tr>
                     <td style="border-bottom: none;">&nbsp;</td>
                     <td style="border-bottom: none;text-align:center;"><?php
-                        if ($quarter == "t1") echo trans('Q1') . "/" . $year;
-                        else if ($quarter == "t2") echo trans('Q2') . "/" . $year;
-                        else if ($quarter == "t3") echo trans('Q3') . "/" . $year;
-                        else if ($quarter == "t4") echo trans('Q4') . "/" . $year;
+                        if ($quarter == "t1") {
+                            echo trans('Q1') . "/" . $year;
+                        } else if ($quarter == "t2") {
+                            echo trans('Q2') . "/" . $year;
+                        } else if ($quarter == "t3") {
+                            echo trans('Q3') . "/" . $year;
+                        } else if ($quarter == "t4") {
+                            echo trans('Q4') . "/" . $year;
+                        }
                         ?></td>
                     <td style="border-bottom: none;text-align:center;"><?php if ($value > 0) {
                             echo format_currency($value);

+ 12 - 19
index.php

@@ -11,7 +11,9 @@
  *---------------------------------------------------------------
  */
 
-if (!file_exists('ipconfig.php')) exit("The <b>ipconfig.php</b> file is missing! Please make a copy of the <b>ipconfig.php.example</b> file and rename it to <b>ipconfig.php</b>");
+if (!file_exists('ipconfig.php')) {
+    exit("The <b>ipconfig.php</b> file is missing! Please make a copy of the <b>ipconfig.php.example</b> file and rename it to <b>ipconfig.php</b>");
+}
 
 require ('vendor/autoload.php');
 $dotenv = new \Dotenv\Dotenv(__DIR__, 'ipconfig.php');
@@ -83,8 +85,7 @@ switch (ENVIRONMENT)
         if (version_compare(PHP_VERSION, '5.3', '>='))
         {
             error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
-        }
-        else
+        } else
         {
             error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
         }
@@ -212,8 +213,7 @@ if (defined('STDIN'))
 if (($_temp = realpath($system_path)) !== FALSE)
 {
     $system_path = $_temp.DIRECTORY_SEPARATOR;
-}
-else
+} else
 {
     // Ensure there's a trailing slash
     $system_path = strtr(
@@ -254,8 +254,7 @@ if (is_dir($application_folder))
     if (($_temp = realpath($application_folder)) !== FALSE)
     {
         $application_folder = $_temp;
-    }
-    else
+    } else
     {
         $application_folder = strtr(
             rtrim($application_folder, '/\\'),
@@ -263,16 +262,14 @@ if (is_dir($application_folder))
             DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
         );
     }
-}
-elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR))
+} elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR))
 {
     $application_folder = BASEPATH.strtr(
             trim($application_folder, '/\\'),
             '/\\',
             DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
         );
-}
-else
+} else
 {
     header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
     echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
@@ -285,14 +282,12 @@ define('APPPATH', $application_folder.DIRECTORY_SEPARATOR);
 if ( ! isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR))
 {
     $view_folder = APPPATH.'views';
-}
-elseif (is_dir($view_folder))
+} elseif (is_dir($view_folder))
 {
     if (($_temp = realpath($view_folder)) !== FALSE)
     {
         $view_folder = $_temp;
-    }
-    else
+    } else
     {
         $view_folder = strtr(
             rtrim($view_folder, '/\\'),
@@ -300,16 +295,14 @@ elseif (is_dir($view_folder))
             DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
         );
     }
-}
-elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR))
+} elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR))
 {
     $view_folder = APPPATH.strtr(
             trim($view_folder, '/\\'),
             '/\\',
             DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
         );
-}
-else
+} else
 {
     header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
     echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;