Code cleanup and revert to php version 7.3 support

master
Eirik Th S 2022-01-26 18:05:50 +01:00
parent 7d57b449b4
commit 8e179e7b0b
6 changed files with 19 additions and 17 deletions

View File

@ -3,9 +3,9 @@
RewriteEngine On
#RewriteRule ^/v1/?([*a-zA-Z0-9_-]+)$ /api/index.php?slug1=$1 [L]
RewriteRule ^([*a-zA-Z0-9_-]+)(?:\/|)$ index.php?fi=$1 [L]
RewriteRule ^([*a-zA-Z0-9_-]+)/([*a-zA-Z0-9_-]+)(?:\/|)$ index.php?fi=$1&sc=$2 [L]
RewriteRule ^([*a-zA-Z0-9_-]+)/([*a-zA-Z0-9_-]+)/([*a-zA-Z0-9_-]+)(?:\/|)$ index.php?fi=$1&sc=$2&th=$3 [L]
RewriteRule ^([*a-zA-Z0-9_-]+)(?:/|)$ index.php?fi=$1 [L]
RewriteRule ^([*a-zA-Z0-9_-]+)/([*a-zA-Z0-9_-]+)(?:/|)$ index.php?fi=$1&sc=$2 [L]
RewriteRule ^([*a-zA-Z0-9_-]+)/([*a-zA-Z0-9_-]+)/([*a-zA-Z0-9_-]+)(?:/|)$ index.php?fi=$1&sc=$2&th=$3 [L]
#RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?slug=$1 [L]
#RewriteRule ^project/$ projects/index.php [L]

View File

@ -98,12 +98,12 @@ class Product {
return $results;
}
private int $product_id;
private int $variant_id;
private string $product_name;
public ?float $price = null;
public ?DateTime $price_updated = null;
public ?int $price_age = null;
private $product_id; // int
private $variant_id; // int
private $product_name; // string
public $price = null; // ?float
public $price_updated = null; // ?DateTime
public $price_age = null; // ?int
public function __construct(int $product_id, string $product_name, int $variant_id = 0){
$this->product_id = $product_id;
@ -111,7 +111,7 @@ class Product {
$this->variant_id = $variant_id;
}
public function getPrice(): int|false {
public function getPrice() { // : int|false
global $db;
if(!empty($this->price)){ return $this->price; }
@ -138,7 +138,7 @@ class Product {
$productArray = array();
$productArray['name'] = $this->product_name;
if($this->price){
$productArray['price']['price'] = $this->price;
$productArray['price']['price'] = (float) $this->price;
$productArray['price']['updated'] = $this->price_updated->format('Y-m-d');
$productArray['price']['age'] = $this->price_age;
$productArray['price']['store'] = "store_id";
@ -149,6 +149,6 @@ class Product {
}
class ProductGroup {
private string $name;
private $name; // string
}

View File

@ -40,13 +40,15 @@ class Draggable {
this.activeDragging = true;
this.draggingElem = $(ev.currentTarget);
if($(".elemHolder").length < 1){
let holderElem = $(".elemHolder");
if(holderElem.length < 1){
$("body").append(elemHolderHtml);
}
this.draggingElem.clone().appendTo(".elemHolder");
this.draggingElem.css('opacity', '30%');
$(".elemHolder").css('height', '').css('height', ($(".elemHolder").height()+10)+"px");
holderElem.css('height', '').css('height', (holderElem.height()+10)+"px");
}
else if(ev.type === "panend" && this.activeDragging){
// console.log("end", ev);

View File

@ -74,7 +74,7 @@
});
});
$("#addEmptyStore").click(ev => {
$("#addEmptyStore").on('click', ev => {
stores.push(new Store());
addStoreModal.hide();
});

View File

@ -121,7 +121,7 @@
</div>
<script>
var myModal = new bootstrap.Modal($("#receiptModal"));
const myModal = new bootstrap.Modal($("#receiptModal"));
$(".openModal").on('click', () => { myModal.show(); });
</script>

View File

@ -1,5 +1,5 @@
<?php
$projectRoot = isset($projectRoot)?$projectRoot:"";
$projectRoot = $projectRoot ?? "";
$activePage = $_SERVER['REQUEST_URI'];
if($activePage == "/index.php"){ $activePage = "/"; }