Fixed bugs caused by the previous commit

This commit is contained in:
Erik Thuning 2019-06-11 17:19:00 +02:00
parent 692c2e0aeb
commit 97d483524a
3 changed files with 6 additions and 5 deletions

@ -80,7 +80,7 @@ class ProductPage extends Page {
'tags' => $tags, 'tags' => $tags,
'info' => $info); 'info' => $info);
$label = ''; $label = '';
if(class_exists('QRcode', false)) { if(class_exists('QRcode')) {
$label = replace($fields, $this->fragments['product_label']); $label = replace($fields, $this->fragments['product_label']);
} }
$fields['label'] = $label; $fields['label'] = $label;

@ -10,7 +10,7 @@ class QR extends Responder {
} }
public function render() { public function render() {
if(class_exists('QRcode', false)) { if(class_exists('QRcode')) {
QRcode::svg((string)$this->product->get_serial()); QRcode::svg((string)$this->product->get_serial());
} }
} }

@ -1,13 +1,14 @@
<?php <?php
set_include_path(get_include_path().PATH_SEPARATOR.'include/');
spl_autoload_register(function ($class) { spl_autoload_register(function ($class) {
if($class == 'qrcode') { if($class == 'QRcode') {
include('./phpqrcode/qrlib.php'); include('./phpqrcode/qrlib.php');
return;
} }
include('./include/'.$class.'.php');
}); });
require('./config.php'); require('./config.php');
require('functions.php'); require('./include/functions.php');
header('Content-Type: text/html; charset=UTF-8'); header('Content-Type: text/html; charset=UTF-8');