From e71c0356717e43470ca3195458f457cebd024d96 Mon Sep 17 00:00:00 2001 From: objecttothis Date: Mon, 1 Apr 2024 13:55:44 +0400 Subject: [PATCH] Formatting - Made view CI form helper function call format uniform. - replaced calls to array() with [] - Placed { on its own line - Removed empty lines where there shouldn't be any. - Replaced text/javascript with application/javascript as the former is deprecated --- app/Config/Database.php | 5 +- app/Controllers/Config.php | 6 +- app/Models/Attribute.php | 7 +- app/Models/Cashup.php | 9 ++- app/Models/Customer.php | 7 +- app/Models/Expense.php | 7 +- app/Models/Giftcard.php | 7 +- app/Models/Item.php | 4 +- app/Models/Person.php | 7 +- app/Models/Reports/Summary_payments.php | 22 ++++-- app/Views/attributes/form.php | 2 +- app/Views/attributes/item.php | 2 +- app/Views/attributes/manage.php | 2 +- app/Views/cashups/form.php | 2 +- app/Views/cashups/manage.php | 2 +- app/Views/configs/barcode_config.php | 2 +- app/Views/configs/email_config.php | 2 +- app/Views/configs/general_config.php | 2 +- app/Views/configs/info_config.php | 2 +- app/Views/configs/integrations_config.php | 2 +- app/Views/configs/invoice_config.php | 2 +- app/Views/configs/locale_config.php | 71 ++++++++++--------- app/Views/configs/manage.php | 2 +- app/Views/configs/message_config.php | 2 +- app/Views/configs/receipt_config.php | 4 +- app/Views/configs/reward_config.php | 2 +- app/Views/configs/stock_config.php | 2 +- app/Views/configs/system_info.php | 9 ++- app/Views/configs/table_config.php | 2 +- app/Views/configs/tax_config.php | 2 +- app/Views/customers/form.php | 2 +- app/Views/customers/form_csv_import.php | 2 +- app/Views/employees/form.php | 2 +- app/Views/expenses/form.php | 2 +- app/Views/expenses/manage.php | 2 +- app/Views/expenses_categories/form.php | 2 +- app/Views/expenses_categories/manage.php | 2 +- app/Views/giftcards/form.php | 2 +- app/Views/giftcards/manage.php | 2 +- app/Views/home/form_change_password.php | 2 +- app/Views/home/home.php | 2 +- app/Views/home/office.php | 2 +- app/Views/item_kits/form.php | 2 +- app/Views/item_kits/manage.php | 2 +- app/Views/items/form.php | 4 +- app/Views/items/form_bulk.php | 2 +- app/Views/items/form_count_details.php | 2 +- app/Views/items/form_csv_import.php | 2 +- app/Views/items/form_inventory.php | 2 +- app/Views/items/manage.php | 2 +- app/Views/messages/form_sms.php | 2 +- app/Views/messages/sms.php | 4 +- app/Views/partial/header_js.php | 2 +- app/Views/partial/lang_lines.php | 2 +- app/Views/partial/print_receipt.php | 2 +- app/Views/people/form_basic_info.php | 2 +- app/Views/people/manage.php | 2 +- app/Views/receivings/form.php | 2 +- app/Views/receivings/receiving.php | 2 +- app/Views/reports/date_input.php | 4 +- app/Views/reports/graphical.php | 2 +- app/Views/reports/inventory_summary_input.php | 4 +- app/Views/reports/listing.php | 2 +- app/Views/reports/specific_customer_input.php | 4 +- app/Views/reports/specific_input.php | 4 +- app/Views/reports/tabular.php | 4 +- app/Views/reports/tabular_details.php | 2 +- app/Views/sales/form.php | 2 +- app/Views/sales/invoice.php | 4 +- app/Views/sales/manage.php | 2 +- app/Views/sales/quote.php | 4 +- app/Views/sales/receipt.php | 2 +- app/Views/sales/register.php | 2 +- app/Views/sales/tax_invoice.php | 4 +- app/Views/sales/work_order.php | 4 +- app/Views/suppliers/form.php | 2 +- app/Views/taxes/manage.php | 2 +- app/Views/taxes/tax_categories.php | 2 +- app/Views/taxes/tax_codes.php | 2 +- app/Views/taxes/tax_jurisdictions.php | 2 +- app/Views/taxes/tax_rates.php | 2 +- app/Views/taxes/tax_rates_form.php | 2 +- 82 files changed, 166 insertions(+), 159 deletions(-) diff --git a/app/Config/Database.php b/app/Config/Database.php index f230b3280..78bd6d1a6 100644 --- a/app/Config/Database.php +++ b/app/Config/Database.php @@ -118,13 +118,12 @@ class Database extends Config break; } - foreach ([&$this->development, &$this->tests, &$this->default] as &$config) { + foreach ([&$this->development, &$this->tests, &$this->default] as &$config) + { $config['hostname'] = !getenv('MYSQL_HOST_NAME') ? $config['hostname'] : getenv('MYSQL_HOST_NAME'); $config['username'] = !getenv('MYSQL_USERNAME') ? $config['username'] : getenv('MYSQL_USERNAME'); $config['password'] = !getenv('MYSQL_PASSWORD') ? $config['password'] : getenv('MYSQL_PASSWORD'); $config['database'] = !getenv('MYSQL_DB_NAME') ? $config['database'] : getenv('MYSQL_DB_NAME'); - - } } } diff --git a/app/Controllers/Config.php b/app/Controllers/Config.php index 2a4330480..99e8209a0 100644 --- a/app/Controllers/Config.php +++ b/app/Controllers/Config.php @@ -504,14 +504,14 @@ class Config extends Secure_Controller 'timezone' => $this->request->getPost('timezone'), 'dateformat' => $this->request->getPost('dateformat'), 'timeformat' => $this->request->getPost('timeformat'), - 'thousands_separator' => !empty($this->request->getPost('thousands_separator', FILTER_SANITIZE_NUMBER_INT)), + 'thousands_separator' => !empty($this->request->getPost('thousands_separator')), 'number_locale' => $this->request->getPost('number_locale'), 'currency_decimals' => $this->request->getPost('currency_decimals', FILTER_SANITIZE_NUMBER_INT), 'tax_decimals' => $this->request->getPost('tax_decimals', FILTER_SANITIZE_NUMBER_INT), 'quantity_decimals' => $this->request->getPost('quantity_decimals', FILTER_SANITIZE_NUMBER_INT), - 'country_codes' => $this->request->getPost('country_codes'), + 'country_codes' => htmlspecialchars($this->request->getPost('country_codes')), 'payment_options_order' => $this->request->getPost('payment_options_order'), - 'date_or_time_format' => $this->request->getPost('date_or_time_format', FILTER_SANITIZE_NUMBER_INT), + 'date_or_time_format' => $this->request->getPost('date_or_time_format'), 'cash_decimals' => $this->request->getPost('cash_decimals', FILTER_SANITIZE_NUMBER_INT), 'cash_rounding_code' => $this->request->getPost('cash_rounding_code'), 'financial_year' => $this->request->getPost('financial_year', FILTER_SANITIZE_NUMBER_INT) diff --git a/app/Models/Attribute.php b/app/Models/Attribute.php index 01371857d..e59bcdc64 100644 --- a/app/Models/Attribute.php +++ b/app/Models/Attribute.php @@ -743,12 +743,11 @@ class Attribute extends Model $empty_obj = new stdClass(); // Iterate through field definitions to determine how the fields should be initialized - - foreach($this->db->getFieldData($table_name) as $field) { - + foreach($this->db->getFieldData($table_name) as $field) + { $field_name = $field->name; - if(in_array($field->type, array('int', 'tinyint', 'decimal'))) + if(in_array($field->type, ['int', 'tinyint', 'decimal'])) { $empty_obj->$field_name = ($field->primary_key == 1) ? NEW_ENTRY : 0; } diff --git a/app/Models/Cashup.php b/app/Models/Cashup.php index 17816df4b..f47fb6b53 100644 --- a/app/Models/Cashup.php +++ b/app/Models/Cashup.php @@ -98,7 +98,7 @@ class Cashup extends Model if($count_only) { $builder->select('COUNT(cash_up.cashup_id) as count'); - } + } else { $builder->select(' @@ -221,12 +221,11 @@ class Cashup extends Model $empty_obj = new stdClass(); // Iterate through field definitions to determine how the fields should be initialized - - foreach($this->db->getFieldData($table_name) as $field) { - + foreach($this->db->getFieldData($table_name) as $field) + { $field_name = $field->name; - if(in_array($field->type, array('int', 'tinyint', 'decimal'))) + if(in_array($field->type, ['int', 'tinyint', 'decimal'])) { $empty_obj->$field_name = ($field->primary_key == 1) ? NEW_ENTRY : 0; } diff --git a/app/Models/Customer.php b/app/Models/Customer.php index beacf6f8e..676b287c9 100644 --- a/app/Models/Customer.php +++ b/app/Models/Customer.php @@ -118,12 +118,11 @@ class Customer extends Person $empty_obj = parent::get_info(NEW_ENTRY); // Iterate through field definitions to determine how the fields should be initialized - - foreach($this->db->getFieldData($table_name) as $field) { - + foreach($this->db->getFieldData($table_name) as $field) + { $field_name = $field->name; - if(in_array($field->type, array('int', 'tinyint', 'decimal'))) + if(in_array($field->type, ['int', 'tinyint', 'decimal'])) { $empty_obj->$field_name = ($field->primary_key == 1) ? NEW_ENTRY : 0; } diff --git a/app/Models/Expense.php b/app/Models/Expense.php index 0c7debc65..ce948fc8f 100644 --- a/app/Models/Expense.php +++ b/app/Models/Expense.php @@ -262,12 +262,11 @@ class Expense extends Model $empty_obj = new stdClass(); // Iterate through field definitions to determine how the fields should be initialized - - foreach($this->db->getFieldData($table_name) as $field) { - + foreach($this->db->getFieldData($table_name) as $field) + { $field_name = $field->name; - if(in_array($field->type, array('int', 'tinyint', 'decimal'))) + if(in_array($field->type, ['int', 'tinyint', 'decimal'])) { $empty_obj->$field_name = ($field->primary_key == 1) ? NEW_ENTRY : 0; } diff --git a/app/Models/Giftcard.php b/app/Models/Giftcard.php index a7cdd0fbb..ffd50d079 100644 --- a/app/Models/Giftcard.php +++ b/app/Models/Giftcard.php @@ -93,12 +93,11 @@ class Giftcard extends Model $empty_obj = new stdClass(); // Iterate through field definitions to determine how the fields should be initialized - - foreach($this->db->getFieldData($table_name) as $field) { - + foreach($this->db->getFieldData($table_name) as $field) + { $field_name = $field->name; - if(in_array($field->type, array('int', 'tinyint', 'decimal'))) + if(in_array($field->type, ['int', 'tinyint', 'decimal'])) { $empty_obj->$field_name = ($field->primary_key == 1) ? NEW_ENTRY : 0; } diff --git a/app/Models/Item.php b/app/Models/Item.php index 35c31179f..c2a4b6493 100644 --- a/app/Models/Item.php +++ b/app/Models/Item.php @@ -354,13 +354,11 @@ class Item extends Model $empty_obj = new stdClass(); // Iterate through field definitions to determine how the fields should be initialized - foreach($this->db->getFieldData($table_name) as $field) { - $field_name = $field->name; - if(in_array($field->type, array('int', 'tinyint', 'decimal'))) + if(in_array($field->type, ['int', 'tinyint', 'decimal'])) { $empty_obj->$field_name = ($field->primary_key == 1) ? NEW_ENTRY : 0; } diff --git a/app/Models/Person.php b/app/Models/Person.php index 41aaea681..dcac3a0a0 100644 --- a/app/Models/Person.php +++ b/app/Models/Person.php @@ -108,12 +108,11 @@ class Person extends Model $empty_obj = new stdClass(); // Iterate through field definitions to determine how the fields should be initialized - - foreach($this->db->getFieldData($table_name) as $field) { - + foreach($this->db->getFieldData($table_name) as $field) + { $field_name = $field->name; - if(in_array($field->type, array('int', 'tinyint', 'decimal'))) + if(in_array($field->type, ['int', 'tinyint', 'decimal'])) { $empty_obj->$field_name = ($field->primary_key == 1) ? NEW_ENTRY : 0; } diff --git a/app/Models/Reports/Summary_payments.php b/app/Models/Reports/Summary_payments.php index 6a0c57183..0f9558ffb 100644 --- a/app/Models/Reports/Summary_payments.php +++ b/app/Models/Reports/Summary_payments.php @@ -44,9 +44,12 @@ class Summary_payments extends Summary_report $where = ''; //TODO: Duplicated code //TODO: this needs to be converted to ternary notation - if(empty($config['date_or_time_format'])) { + if(empty($config['date_or_time_format'])) + { $where .= 'DATE(sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']); - } else { + } + else + { $where .= 'sale_time BETWEEN ' . $this->db->escape(rawurldecode($inputs['start_date'])) . ' AND ' . $this->db->escape(rawurldecode($inputs['end_date'])); } @@ -76,8 +79,10 @@ class Summary_payments extends Summary_report // At this point in time refunds are assumed to be cash refunds. $total_cash_refund = 0; - foreach($sales as $key => $sale_summary) { - if($sale_summary['trans_refunded'] <> 0) { + foreach($sales as $key => $sale_summary) + { + if($sale_summary['trans_refunded'] <> 0) + { $total_cash_refund += $sale_summary['trans_refunded']; } } @@ -103,8 +108,10 @@ class Summary_payments extends Summary_report // consider Gift Card as only one type of payment and do not show "Gift Card: 1, Gift Card: 2, etc." in the total $gift_card_count = 0; $gift_card_amount = 0; - foreach($payments as $key => $payment) { - if(strstr($payment['trans_type'], lang('Sales.giftcard')) !== false) { + foreach($payments as $key => $payment) + { + if(strstr($payment['trans_type'], lang('Sales.giftcard')) !== false) + { $gift_card_count += $payment['trans_sales']; $gift_card_amount += $payment['trans_amount']; @@ -113,7 +120,8 @@ class Summary_payments extends Summary_report } } - if($gift_card_count > 0) { + if($gift_card_count > 0) + { $payments[] = [ 'trans_group' => lang('Reports.trans_payments'), 'trans_type' => lang('Sales.giftcard'), diff --git a/app/Views/attributes/form.php b/app/Views/attributes/form.php index 8bea58cc4..67afc5614 100644 --- a/app/Views/attributes/form.php +++ b/app/Views/attributes/form.php @@ -105,7 +105,7 @@ - diff --git a/app/Views/configs/message_config.php b/app/Views/configs/message_config.php index 4e0f5efa3..4cefe1ad2 100644 --- a/app/Views/configs/message_config.php +++ b/app/Views/configs/message_config.php @@ -77,7 +77,7 @@ - +
Vulnerable or Incorrect Permissions ✗'; - } else { + } + else + { echo ' | Security Check Passed ✓ '; } clearstatcache(); diff --git a/app/Views/configs/table_config.php b/app/Views/configs/table_config.php index 96295fae0..d535c79f6 100644 --- a/app/Views/configs/table_config.php +++ b/app/Views/configs/table_config.php @@ -36,7 +36,7 @@
- diff --git a/app/Views/home/office.php b/app/Views/home/office.php index da65d77c6..0552a7f41 100644 --- a/app/Views/home/office.php +++ b/app/Views/home/office.php @@ -5,7 +5,7 @@ ?> - diff --git a/app/Views/item_kits/form.php b/app/Views/item_kits/form.php index 01e2c84df..1c616e210 100644 --- a/app/Views/item_kits/form.php +++ b/app/Views/item_kits/form.php @@ -210,7 +210,7 @@ - @@ -478,7 +478,7 @@ - @@ -34,7 +34,7 @@ - @@ -106,7 +106,7 @@ if(isset($error)) - diff --git a/app/Views/reports/inventory_summary_input.php b/app/Views/reports/inventory_summary_input.php index 87c064234..cfe0543dc 100644 --- a/app/Views/reports/inventory_summary_input.php +++ b/app/Views/reports/inventory_summary_input.php @@ -6,7 +6,7 @@ ?> - @@ -47,7 +47,7 @@ if(isset($error)) - diff --git a/app/Views/reports/specific_customer_input.php b/app/Views/reports/specific_customer_input.php index e76142091..0de199ea6 100644 --- a/app/Views/reports/specific_customer_input.php +++ b/app/Views/reports/specific_customer_input.php @@ -8,7 +8,7 @@ ?> - @@ -62,7 +62,7 @@ if(isset($error)) - @@ -86,7 +86,7 @@ if(isset($error)) - @@ -42,7 +42,7 @@ ?> - diff --git a/app/Views/taxes/tax_categories.php b/app/Views/taxes/tax_categories.php index b55c295ec..6a602b080 100644 --- a/app/Views/taxes/tax_categories.php +++ b/app/Views/taxes/tax_categories.php @@ -23,7 +23,7 @@ -