Website Summary Files Commits Branches @commit @diff @stats
path: root / models / webpage.php
diff options
context:
space:
mode:
Commit9121554ce064629dc7aef74434b65ee10756a8a7 (patch)
Author
 Georgi Nikolov <ggeorgi60@gmail.com>
2025-01-26 20:28:22 +0200
Committer
 Georgi Nikolov <ggeorgi60@gmail.com>
2025-01-26 20:28:22 +0200
Files9ff596abcead2cffea6b889edfc70398d8354bd0 /models/webpage.php
nowayforward_human-9121554ce064629dc7aef74434b65ee10756a8a7.tar
nowayforward_human-9121554ce064629dc7aef74434b65ee10756a8a7.tar.gz
nowayforward_human-9121554ce064629dc7aef74434b65ee10756a8a7.zip
Parent5b61a18f1bab2cf17f849b64129efa9726848262 (diff)
Added a navbar on top of the archived pages
1 files changed, 33 insertions, 0 deletions
-rw-r--r--models/webpage.php33
diff --git a/models/webpage.php b/models/webpage.php
index 3445f62..e6d964f 100644
--- a/models/webpage.php
+++ b/models/webpage.php
@@ -27,6 +27,39 @@ class Webpage extends Table {
);
}
+ static function getPageById(int $id) : Webpage {
+ return Table::_fromDB(
+ "SELECT * FROM Webpages WHERE WID = \"$id\"",
+ "Database\Webpage"
+ );
+ }
+
+ static function getPreviousPageId(string $url, string $date) : int {
+ $foundId = Table::_get_all(
+ "Webpages",
+ "Database\Webpage",
+ "WHERE URL = \"$url\" && Date < \"$date\" ORDER BY Date DESC LIMIT 1",
+ "WID"
+ );
+ if (count($foundId) > 0) {
+ return $foundId[0]->WID;
+ }
+ return 0;
+ }
+
+ static function getNextPageId(string $url, string $date) : int {
+ $foundId = Table::_get_all(
+ "Webpages",
+ "Database\Webpage",
+ "WHERE URL = \"$url\" && Date > \"$date\" ORDER BY Date ASC LIMIT 1",
+ "WID"
+ );
+ if (count($foundId) > 0) {
+ return $foundId[0]->WID;
+ }
+ return 0;
+ }
+
static function getPagesCount() : int {
return Table::_get_entries_count("Webpages");
}