Update main.php

Added order[=|:]fullrandom so user doesn't need to choose a new seed every time.
Thus the list will change on a daily basis without user interaction, giving a more dynamic feel to the website
This commit is contained in:
MetallicAchu 2020-05-07 08:10:15 +03:00 committed by GitHub
parent 72645af9a4
commit 10d46395d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -250,7 +250,15 @@ class Index extends Extension
$seed = $matches[1]; $seed = $matches[1];
Image::$order_sql = "RAND($seed)"; Image::$order_sql = "RAND($seed)";
$event->add_querylet(new Querylet("1=1")); //small hack to avoid metatag being treated as normal tag $event->add_querylet(new Querylet("1=1")); //small hack to avoid metatag being treated as normal tag
} elseif (preg_match("/^order[=|:]fullrandom$/i", $event->term, $matches)) {
//order[=|:]fullrandom will use today's date as seed, thus allowing for a dynamic randomized list without outside intervention.
//This way the list will change every day, giving a more dynamic feel to the imageboard.
//recommended to change homepage to "post/list/order:fullrandom/1"
$seed = date("Ymd");
Image::$order_sql = "RAND($seed)";
$event->add_querylet(new Querylet("1=1"));
} }
//fullrandom is new
$this->stpen++; $this->stpen++;
} }