Cleaned up trailing whitespace
This commit is contained in:
parent
deb47f94d3
commit
c6a7af0639
@ -80,7 +80,7 @@ class Attachment {
|
||||
public function get_id() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
|
||||
public function get_product() {
|
||||
return new Product($this->product);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
class Download extends Responder {
|
||||
private $attachment;
|
||||
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
if(isset($_GET['id'])) {
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?php
|
||||
abstract class Entity {
|
||||
protected function __construct() {
|
||||
|
||||
}
|
||||
|
||||
abstract public function matches($term, $ldap);
|
||||
|
@ -2,7 +2,7 @@
|
||||
class HistoryPage extends Page {
|
||||
private $action = 'list';
|
||||
private $inventory = null;
|
||||
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
if(isset($_GET['action'])) {
|
||||
|
@ -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) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
class InventoryPage extends Page {
|
||||
private $inventory = null;
|
||||
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
$this->inventory = Inventory::get_active();
|
||||
|
@ -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);
|
||||
|
@ -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 = '';
|
||||
|
@ -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(),
|
||||
|
@ -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`=?');
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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("'",
|
||||
'"'),
|
||||
|
@ -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 = '';
|
||||
|
@ -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`=?');
|
||||
|
@ -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`=?');
|
||||
|
@ -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.';
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user