aboutsummaryrefslogtreecommitdiff
path: root/ratatoeskr
diff options
context:
space:
mode:
Diffstat (limited to 'ratatoeskr')
-rw-r--r--ratatoeskr/backend.php8
-rw-r--r--ratatoeskr/frontend.php2
-rw-r--r--ratatoeskr/sys/utils.php9
3 files changed, 5 insertions, 14 deletions
diff --git a/ratatoeskr/backend.php b/ratatoeskr/backend.php
index 23568a1..36e2fb3 100644
--- a/ratatoeskr/backend.php
+++ b/ratatoeskr/backend.php
@@ -602,7 +602,7 @@ function build_backend_subactions()
$ste->vars["sort_asc_date"] = true;
$ste->vars["sorting"] = ["dir" => "asc", "by" => "date"];
usort($articles, function ($a, $b) {
- return intcmp($a->timestamp, $b->timestamp);
+ return $a->timestamp <=> $b->timestamp;
});
break;
case "section":
@@ -631,7 +631,7 @@ function build_backend_subactions()
$ste->vars["sort_desc_date"] = true;
$ste->vars["sorting"] = ["dir" => "desc", "by" => "date"];
usort($articles, function ($a, $b) {
- return intcmp($b->timestamp, $a->timestamp);
+ return $b->timestamp <=> $a->timestamp;
});
break;
case "section":
@@ -914,13 +914,13 @@ function build_backend_subactions()
break;
case "date":
usort($comments, function ($a, $b) use ($sort_dir) {
- return intcmp($a->get_timestamp(), $b->get_timestamp()) * $sort_dir;
+ return ($a->get_timestamp() <=> $b->get_timestamp()) * $sort_dir;
});
break;
case "was_read":
default:
usort($comments, function ($a, $b) use ($sort_dir) {
- return intcmp((int) $a->read_by_admin, (int) $b->read_by_admin) * $sort_dir;
+ return ((int)$a->read_by_admin <=> (int)$b->read_by_admin) * $sort_dir;
});
$sort_by = "was_read";
break;
diff --git a/ratatoeskr/frontend.php b/ratatoeskr/frontend.php
index 56bb231..8fab0a1 100644
--- a/ratatoeskr/frontend.php
+++ b/ratatoeskr/frontend.php
@@ -381,7 +381,7 @@ $ste->register_tag("article_comments", function ($ste, $params, $sub) {
$sortdir = (@$params["sort"] == "desc") ? -1 : 1;
usort($comments, function ($a, $b) use ($sortdir) {
- return intcmp($a->get_timestamp(), $b->get_timestamp()) * $sortdir;
+ return ($a->get_timestamp() <=> $b->get_timestamp()) * $sortdir;
});
$comments = array_map("comment_transform_ste", $comments);
diff --git a/ratatoeskr/sys/utils.php b/ratatoeskr/sys/utils.php
index 21d65f9..60f90a8 100644
--- a/ratatoeskr/sys/utils.php
+++ b/ratatoeskr/sys/utils.php
@@ -10,15 +10,6 @@
* See "ratatoeskr/licenses/ratatoeskr" for more information.
*/
-
-/*
- * Function: intcmp
- * Compare integers (equavilent to strcmp)
- */
-function intcmp($a, $b)
-{
- return ($a == $b) ? 0 : (($a < $b) ? -1 : 1);
-}
/*
* Function: delete_directory
* Delete a directory and all of its content.