From 1e76fb239e1b3545ba92c38adf4100f38ebbf4df Mon Sep 17 00:00:00 2001 From: Shish Date: Wed, 13 May 2020 13:03:49 +0100 Subject: [PATCH] s/fullrandom/dailyshuffle/, and run formatter --- ext/index/main.php | 19 +++++++++---------- ext/upload/main.php | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/ext/index/main.php b/ext/index/main.php index 0ab9ed67..5c8b2ab8 100644 --- a/ext/index/main.php +++ b/ext/index/main.php @@ -245,20 +245,19 @@ class Index extends Extension Image::$order_sql = "images.$ord $sort"; $event->add_querylet(new Querylet("1=1")); //small hack to avoid metatag being treated as normal tag } elseif (preg_match("/^order[=|:]random[_]([0-9]{1,4})$/i", $event->term, $matches)) { - //order[=|:]random requires a seed to avoid duplicates - //since the tag can't be changed during the parseevent, we instead generate the seed during submit using js + // requires a seed to avoid duplicates + // since the tag can't be changed during the parseevent, we instead generate the seed during submit using js $seed = $matches[1]; Image::$order_sql = "RAND($seed)"; $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)"; + } elseif (preg_match("/^order[=|:]dailyshuffle$/i", $event->term, $matches)) { + // 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:dailyshuffle/1" + $seed = date("Ymd"); + Image::$order_sql = "RAND($seed)"; $event->add_querylet(new Querylet("1=1")); - } - //fullrandom is new + } $this->stpen++; } diff --git a/ext/upload/main.php b/ext/upload/main.php index 2b5b670b..9616dd90 100644 --- a/ext/upload/main.php +++ b/ext/upload/main.php @@ -194,7 +194,7 @@ class Upload extends Extension if ($this->is_full) { throw new UploadException("Can not replace Image: disk nearly full"); } - + // Try to get the image ID if ($event->count_args() >= 1) { $image_id = int_escape($event->get_arg(0));