From 789717225614fdccb170d2f41a9cac0c3857aa1b Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Sun, 25 Dec 2022 13:50:33 +0100 Subject: [PATCH] Address dynamic class property deprecation warnings --- models/Asset.php | 3 ++- models/AssetIterator.php | 1 + models/Database.php | 1 + models/GenericTable.php | 7 +++++++ models/Guest.php | 2 +- models/PhotoMosaic.php | 1 + models/Thumbnail.php | 1 + models/User.php | 15 +++++++++------ templates/AlbumButtonBox.php | 2 ++ templates/AlbumHeaderBox.php | 5 +++++ templates/Alert.php | 4 ++++ templates/DummyBox.php | 4 ++++ templates/FormView.php | 9 +++++++++ templates/MediaUploader.php | 2 ++ templates/Pagination.php | 1 + templates/PhotosIndex.php | 1 + templates/TabularData.php | 3 +++ 17 files changed, 54 insertions(+), 8 deletions(-) diff --git a/models/Asset.php b/models/Asset.php index 6bc44c2..483c799 100644 --- a/models/Asset.php +++ b/models/Asset.php @@ -13,6 +13,7 @@ class Asset protected $subdir; protected $filename; protected $title; + protected $slug; protected $mimetype; protected $image_width; protected $image_height; @@ -364,7 +365,7 @@ class Asset public function isImage() { - return substr($this->mimetype, 0, 5) === 'image'; + return isset($this->mimetype) && substr($this->mimetype, 0, 5) === 'image'; } public function getImage() diff --git a/models/AssetIterator.php b/models/AssetIterator.php index 84433f7..3a50cf5 100644 --- a/models/AssetIterator.php +++ b/models/AssetIterator.php @@ -12,6 +12,7 @@ class AssetIterator extends Asset private $res_assets; private $res_meta; private $res_thumbs; + private Database $db; protected function __construct($res_assets, $res_meta, $res_thumbs, $return_format) { diff --git a/models/Database.php b/models/Database.php index 7f59a6c..48df3ec 100644 --- a/models/Database.php +++ b/models/Database.php @@ -17,6 +17,7 @@ class Database private $connection; private $query_count = 0; private $logged_queries = []; + private array $db_callback; /** * Initialises a new database connection. diff --git a/models/GenericTable.php b/models/GenericTable.php index 0ead368..f2147f7 100644 --- a/models/GenericTable.php +++ b/models/GenericTable.php @@ -20,6 +20,13 @@ class GenericTable public $form_above; public $form_below; + private $sort_direction; + private $sort_order; + private $base_url; + private $start; + private $items_per_page; + private $recordCount; + public function __construct($options) { // Make sure we're actually sorting on something sortable. diff --git a/models/Guest.php b/models/Guest.php index cbd717e..74611ad 100644 --- a/models/Guest.php +++ b/models/Guest.php @@ -21,7 +21,7 @@ class Guest extends User $this->is_guest = true; $this->is_admin = false; $this->first_name = 'Guest'; - $this->last_name = ''; + $this->surname = ''; } public function updateAccessTime() diff --git a/models/PhotoMosaic.php b/models/PhotoMosaic.php index 48c3836..9d4c522 100644 --- a/models/PhotoMosaic.php +++ b/models/PhotoMosaic.php @@ -11,6 +11,7 @@ class PhotoMosaic private $queue = []; const NUM_DAYS_CUTOFF = 7; + private AssetIterator $iterator; public function __construct(AssetIterator $iterator) { diff --git a/models/Thumbnail.php b/models/Thumbnail.php index d35c260..8168ee2 100644 --- a/models/Thumbnail.php +++ b/models/Thumbnail.php @@ -16,6 +16,7 @@ class Thumbnail private $width; private $height; private $crop_mode; + private string $filename_suffix; const CROP_MODE_NONE = 0; const CROP_MODE_BOUNDARY = 1; diff --git a/models/User.php b/models/User.php index dd802ef..7132216 100644 --- a/models/User.php +++ b/models/User.php @@ -12,17 +12,20 @@ */ abstract class User { - protected $id_user; - protected $first_name; - protected $surname; - protected $emailaddress; + protected int $id_user; + protected string $first_name; + protected string $surname; + protected string $slug; + protected string $emailaddress; + protected string $password_hash; protected $creation_time; protected $last_action_time; protected $ip_address; protected $is_admin; + protected string $reset_key; - protected $is_logged; - protected $is_guest; + protected bool $is_logged; + protected bool $is_guest; /** * Returns user id. diff --git a/templates/AlbumButtonBox.php b/templates/AlbumButtonBox.php index 5228fe7..d18ef31 100644 --- a/templates/AlbumButtonBox.php +++ b/templates/AlbumButtonBox.php @@ -8,6 +8,8 @@ class AlbumButtonBox extends SubTemplate { + private $buttons; + public function __construct($buttons) { $this->buttons = $buttons; diff --git a/templates/AlbumHeaderBox.php b/templates/AlbumHeaderBox.php index 409d99a..0de991d 100644 --- a/templates/AlbumHeaderBox.php +++ b/templates/AlbumHeaderBox.php @@ -8,6 +8,11 @@ class AlbumHeaderBox extends SubTemplate { + private $back_link_title; + private $back_link; + private $description; + private $title; + public function __construct($title, $description, $back_link, $back_link_title) { $this->title = $title; diff --git a/templates/Alert.php b/templates/Alert.php index 20549e3..d5a2091 100644 --- a/templates/Alert.php +++ b/templates/Alert.php @@ -8,6 +8,10 @@ class Alert extends SubTemplate { + private $_type; + private $_message; + private $_title; + public function __construct($title = '', $message = '', $type = 'alert') { $this->_title = $title; diff --git a/templates/DummyBox.php b/templates/DummyBox.php index cc88114..2632384 100644 --- a/templates/DummyBox.php +++ b/templates/DummyBox.php @@ -8,6 +8,10 @@ class DummyBox extends SubTemplate { + private $_class; + private $_content; + private $_title; + public function __construct($title = '', $content = '', $class = '') { $this->_title = $title; diff --git a/templates/FormView.php b/templates/FormView.php index 0549a88..389fa11 100644 --- a/templates/FormView.php +++ b/templates/FormView.php @@ -8,6 +8,15 @@ class FormView extends SubTemplate { + private $content_below; + private $content_above; + private $data; + private $missing; + private $fields; + private $request_method; + private $request_url; + private $title; + public function __construct(Form $form, $title = '') { $this->title = $title; diff --git a/templates/MediaUploader.php b/templates/MediaUploader.php index c793d04..008cfc9 100644 --- a/templates/MediaUploader.php +++ b/templates/MediaUploader.php @@ -8,6 +8,8 @@ class MediaUploader extends SubTemplate { + private Tag $tag; + public function __construct(Tag $tag) { $this->tag = $tag; diff --git a/templates/Pagination.php b/templates/Pagination.php index 09ab946..fea1df4 100644 --- a/templates/Pagination.php +++ b/templates/Pagination.php @@ -10,6 +10,7 @@ class Pagination extends SubTemplate { private $index; private static $unique_index_count = 0; + private string $class; public function __construct(PageIndex $index) { diff --git a/templates/PhotosIndex.php b/templates/PhotosIndex.php index 1e8c793..c21879c 100644 --- a/templates/PhotosIndex.php +++ b/templates/PhotosIndex.php @@ -10,6 +10,7 @@ class PhotosIndex extends SubTemplate { protected $mosaic; protected $show_edit_buttons; + protected $show_headers; protected $show_labels; protected $row_limit = 1000; protected $previous_header = ''; diff --git a/templates/TabularData.php b/templates/TabularData.php index 0571296..587d4f0 100644 --- a/templates/TabularData.php +++ b/templates/TabularData.php @@ -8,6 +8,9 @@ class TabularData extends SubTemplate { + private Pagination $pager; + private GenericTable $_t; + public function __construct(GenericTable $table) { $this->_t = $table;