From c6a7af0639dbdd7d7b645f634755c01c1967b98b Mon Sep 17 00:00:00 2001 From: Erik Thuning <boooink@gmail.com> Date: Tue, 27 Feb 2024 13:59:59 +0100 Subject: [PATCH] Cleaned up trailing whitespace --- include/Attachment.php | 2 +- include/Download.php | 2 +- include/Entity.php | 1 - include/HistoryPage.php | 2 +- include/Inventory.php | 6 +++--- include/InventoryPage.php | 2 +- include/Kvs.php | 10 +++++----- include/NewPage.php | 6 +++--- include/Printer.php | 2 +- include/Product.php | 38 +++++++++++++++++++------------------- include/ProductPage.php | 6 +++--- include/Responder.php | 8 ++++---- include/SearchPage.php | 6 +++--- include/Service.php | 2 +- include/Template.php | 14 +++++++------- include/UserPage.php | 4 ++-- include/functions.php | 6 +++--- 17 files changed, 58 insertions(+), 59 deletions(-) diff --git a/include/Attachment.php b/include/Attachment.php index 0450bcc..27087b6 100644 --- a/include/Attachment.php +++ b/include/Attachment.php @@ -80,7 +80,7 @@ class Attachment { public function get_id() { return $this->id; } - + public function get_product() { return new Product($this->product); } diff --git a/include/Download.php b/include/Download.php index 3f99ee6..cc74e6d 100644 --- a/include/Download.php +++ b/include/Download.php @@ -1,7 +1,7 @@ <?php class Download extends Responder { private $attachment; - + public function __construct() { parent::__construct(); if(isset($_GET['id'])) { diff --git a/include/Entity.php b/include/Entity.php index 37c5f8e..0713bbd 100644 --- a/include/Entity.php +++ b/include/Entity.php @@ -1,7 +1,6 @@ <?php abstract class Entity { protected function __construct() { - } abstract public function matches($term, $ldap); diff --git a/include/HistoryPage.php b/include/HistoryPage.php index 6761c2c..2fe2a0d 100644 --- a/include/HistoryPage.php +++ b/include/HistoryPage.php @@ -2,7 +2,7 @@ class HistoryPage extends Page { private $action = 'list'; private $inventory = null; - + public function __construct() { parent::__construct(); if(isset($_GET['action'])) { diff --git a/include/Inventory.php b/include/Inventory.php index 86e743d..09fb001 100644 --- a/include/Inventory.php +++ b/include/Inventory.php @@ -35,7 +35,7 @@ class Inventory { } return new Inventory($result['id']); } - + public function __construct($id) { $search = prepare('select `id` from `inventory` where `id`=?'); bind($search, 'i', $id); @@ -87,7 +87,7 @@ class Inventory { $this->products[] = $product->get_id(); return true; } - + public function get_id() { return $this->id; } @@ -99,7 +99,7 @@ class Inventory { public function get_endtime() { return $this->endtime; } - + public function get_seen_products() { $out = array(); foreach($this->seen_products as $prodid) { diff --git a/include/InventoryPage.php b/include/InventoryPage.php index 2e3320a..434fb28 100644 --- a/include/InventoryPage.php +++ b/include/InventoryPage.php @@ -1,7 +1,7 @@ <?php class InventoryPage extends Page { private $inventory = null; - + public function __construct() { parent::__construct(); $this->inventory = Inventory::get_active(); diff --git a/include/Kvs.php b/include/Kvs.php index 2900dcd..2681d75 100644 --- a/include/Kvs.php +++ b/include/Kvs.php @@ -1,7 +1,7 @@ <?php class Kvs { private $items = array(); - + public function __construct() { $get = prepare('select * from `kvs`'); execute($get); @@ -11,18 +11,18 @@ class Kvs { $this->items[$key] = $value; } } - + public function get_keys() { return array_keys($this->items); } - + public function get_value($key, $default=null) { if(isset($this->items[$key])) { return $this->items[$key]; } return $default; } - + public function set_key($key, $value) { $find = prepare('select * from `kvs` where `key`=?'); bind($find, 's', $key); @@ -38,7 +38,7 @@ class Kvs { $this->items[$key] = $value; return true; } - + public function remove_key($key) { $find = prepare('select * from `kvs` where `key`=?'); bind($find, 's', $key); diff --git a/include/NewPage.php b/include/NewPage.php index ffe6a48..b84db33 100644 --- a/include/NewPage.php +++ b/include/NewPage.php @@ -1,7 +1,7 @@ <?php class NewPage extends Page { private $template = null; - + public function __construct() { parent::__construct(); if(isset($_GET['template'])) { @@ -16,11 +16,11 @@ class NewPage extends Page { } } } - + protected function render_body() { print($this->build_new_page()); } - + private function build_new_page() { $template = ''; $fields = ''; diff --git a/include/Printer.php b/include/Printer.php index 1b3a8e2..2c0365a 100644 --- a/include/Printer.php +++ b/include/Printer.php @@ -3,7 +3,7 @@ class Printer extends QR { public function __construct() { parent::__construct(); } - + public function render() { $label = replace(array('id' => $this->product->get_id(), 'name' => $this->product->get_name(), diff --git a/include/Product.php b/include/Product.php index 3de4598..461a73c 100644 --- a/include/Product.php +++ b/include/Product.php @@ -9,7 +9,7 @@ class Product extends Entity { private $discardtime = null; private $info = array(); private $tags = array(); - + public static function create_product( $brand, $name, @@ -41,7 +41,7 @@ class Product extends Entity { throw $e; } } - + public function __construct($clue, $type = 'id') { parent::__construct(); $search = null; @@ -76,7 +76,7 @@ class Product extends Entity { $this->email_sender = $sender; $this->email_subject_prefix = $email_subject_prefix; } - + private function update_fields() { $get = prepare('select * from `product` where `id`=?'); bind($get, 'i', $this->id); @@ -90,7 +90,7 @@ class Product extends Entity { $this->discardtime = $product['discardtime']; return true; } - + private function update_info() { $get = prepare('select * from `product_info` where `product`=? order by `field`'); @@ -103,7 +103,7 @@ class Product extends Entity { } return true; } - + private function update_tags() { $get = prepare('select * from `product_tag` where `product`=? order by `tag`'); @@ -367,11 +367,11 @@ EOF; } return new Service($result['id']); } - + public function get_brand() { return $this->brand; } - + public function set_brand($newbrand) { $update = prepare('update `product` set `brand`=? where `id`=?'); bind($update, 'si', $newbrand, $this->id); @@ -379,11 +379,11 @@ EOF; $this->brand = $newbrand; return true; } - + public function get_name() { return $this->name; } - + public function set_name($newname) { $update = prepare('update `product` set `name`=? where `id`=?'); bind($update, 'si', $newname, $this->id); @@ -391,11 +391,11 @@ EOF; $this->name = $newname; return true; } - + public function get_invoice() { return $this->invoice; } - + public function set_invoice($newinvoice) { $update = prepare('update `product` set `invoice`=? where `id`=?'); bind($update, 'si', $newinvoice, $this->id); @@ -403,11 +403,11 @@ EOF; $this->invoice = $newinvoice; return true; } - + public function get_serial() { return $this->serial; } - + public function set_serial($newserial) { $update = prepare('update `product` set `serial`=? where `id`=?'); bind($update, 'si', $newserial, $this->id); @@ -415,11 +415,11 @@ EOF; $this->serial = $newserial; return true; } - + public function get_info() { return $this->info; } - + public function set_info($field, $value) { if(!$value) { return true; @@ -441,7 +441,7 @@ EOF; $this->update_info(); return true; } - + public function remove_info($field) { $find = prepare('select * from `product_info` where `product`=? and `field`=?'); @@ -457,11 +457,11 @@ EOF; $this->update_info(); return true; } - + public function get_tags() { return $this->tags; } - + public function add_tag($tag) { if(!$tag) { return true; @@ -479,7 +479,7 @@ EOF; } return true; } - + public function remove_tag($tag) { $find = prepare('select * from `product_tag` where `product`=? and `tag`=?'); diff --git a/include/ProductPage.php b/include/ProductPage.php index 9939ae7..071e886 100644 --- a/include/ProductPage.php +++ b/include/ProductPage.php @@ -2,7 +2,7 @@ class ProductPage extends Page { private $action = 'list'; private $product = null; - + public function __construct() { parent::__construct(); if(isset($_GET['action'])) { @@ -29,7 +29,7 @@ class ProductPage extends Page { break; } } - + protected function render_body() { switch($this->action) { case 'list': @@ -42,7 +42,7 @@ class ProductPage extends Page { break; } } - + private function build_product_form() { $discarded = $this->product->get_discardtime(); diff --git a/include/Responder.php b/include/Responder.php index 69864e0..dbc15a0 100644 --- a/include/Responder.php +++ b/include/Responder.php @@ -2,27 +2,27 @@ abstract class Responder { protected $fragments = array(); protected $ldap = null; - + public function __construct() { global $language; $this->fragments = get_fragments("./html/$language/fragments.html"); $this->ldap = new Ldap(); } - + final protected function escape_tags($tags) { foreach($tags as $key => $tag) { $tags[$key] = $this->escape_string(strtolower($tag)); } return $tags; } - + final protected function unescape_tags($tags) { foreach($tags as $key => $tag) { $tags[$key] = $this->unescape_string(strtolower($tag)); } return $tags; } - + final protected function escape_string($string) { return str_replace(array("'", '"'), diff --git a/include/SearchPage.php b/include/SearchPage.php index 2fc313c..f2311f9 100644 --- a/include/SearchPage.php +++ b/include/SearchPage.php @@ -3,7 +3,7 @@ class SearchPage extends Page { private $terms = array(); private $product_hits = array(); private $user_hits = array(); - + public function __construct() { parent::__construct(); unset($_GET['page']); @@ -22,7 +22,7 @@ class SearchPage extends Page { } } } - + private function do_search() { $out = array(); if(!$this->terms) { @@ -165,7 +165,7 @@ class SearchPage extends Page { } return $translated; } - + protected function render_body() { $hidden = 'hidden'; $terms = ''; diff --git a/include/Service.php b/include/Service.php index b854319..526e241 100644 --- a/include/Service.php +++ b/include/Service.php @@ -10,7 +10,7 @@ class Service extends Event { commit_trans(); return new Service($event_id); } - + public function __construct($id) { parent::__construct($id); $search = prepare('select * from `service` where `event`=?'); diff --git a/include/Template.php b/include/Template.php index b069cc2..181f48b 100644 --- a/include/Template.php +++ b/include/Template.php @@ -4,7 +4,7 @@ class Template { private $name = ''; private $fields = array(); private $tags = array(); - + public static function create_template( $name = '', $fields = array(), @@ -44,7 +44,7 @@ class Template { execute($delete); return true; } - + public function __construct($clue, $type = 'id') { switch($type) { case 'id': @@ -81,7 +81,7 @@ class Template { public function get_id() { return $this->id; } - + public function get_name() { return ucfirst($this->name); } @@ -93,7 +93,7 @@ class Template { $this->name = $name; return true; } - + private function update_fields() { $get = prepare('select `field` from `template_info` where `template`=? order by `field`'); @@ -106,7 +106,7 @@ class Template { $this->fields = $fields; return true; } - + private function update_tags() { $get = prepare('select * from `template_tag` where `template`=? order by `tag`'); @@ -138,7 +138,7 @@ class Template { } return true; } - + public function remove_field($field) { $find = prepare('select * from `template_info` where `template`=? and `field`=?'); @@ -176,7 +176,7 @@ class Template { } return true; } - + public function remove_tag($tag) { $find = prepare('select * from `template_tag` where `template`=? and `tag`=?'); diff --git a/include/UserPage.php b/include/UserPage.php index 4473aa7..bff215e 100644 --- a/include/UserPage.php +++ b/include/UserPage.php @@ -2,7 +2,7 @@ class UserPage extends Page { private $action = 'list'; private $user = null; - + public function __construct() { parent::__construct(); if(isset($_GET['action'])) { @@ -40,7 +40,7 @@ class UserPage extends Page { break; } } - + private function build_user_details() { $active_loans = $this->user->get_loans('active'); $table_active = 'Inga aktuella lån.'; diff --git a/include/functions.php b/include/functions.php index 84d4a4c..a975f29 100644 --- a/include/functions.php +++ b/include/functions.php @@ -5,9 +5,9 @@ require_once('./include/translations.php'); /* Takes an html file containing named fragments. Returns an associative array on the format array[name]=>fragment. - + Fragments are delimited like this: - + ¤¤ name 1 ¤¤ fragment 1 ¤¤ name 2 ¤¤ @@ -56,7 +56,7 @@ function try_adding($key, $value, $array, $filename) { } else if($key === '') { throw new Exception('There is an unnamed fragment in '.$filename); } - + $array[$key] = trim($value); return $array;