summaryrefslogtreecommitdiffstats
path: root/web/lib/pkgbasefuncs.inc.php
diff options
context:
space:
mode:
authorMark Weiman <mark.weiman@markzz.com>2016-11-10 00:54:37 +0100
committerLukas Fleischer <lfleischer@archlinux.org>2016-11-10 18:31:20 +0100
commit3e442a0f7d49fc8eed45002841d84d9080473cc9 (patch)
treeb2543fd438ee1b38b59f4da3943945a3e9059118 /web/lib/pkgbasefuncs.inc.php
parentc3f464f50fb35ffb7825b90437bd912051a994ee (diff)
downloadaur-3e442a0f7d49fc8eed45002841d84d9080473cc9.tar.gz
aur-3e442a0f7d49fc8eed45002841d84d9080473cc9.tar.xz
Remove all usage of UNIX_TIMESTAMP in web interface
UNIX_TIMESTAMP is not part of the SQL standard. Instead, all usage in the web interface is changed to use PHP's time() function. Signed-off-by: Mark Weiman <mark.weiman@markzz.com> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'web/lib/pkgbasefuncs.inc.php')
-rw-r--r--web/lib/pkgbasefuncs.inc.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php
index b0827844..4f102040 100644
--- a/web/lib/pkgbasefuncs.inc.php
+++ b/web/lib/pkgbasefuncs.inc.php
@@ -98,7 +98,7 @@ function pkgbase_add_comment($base_id, $uid, $comment) {
$q = "INSERT INTO PackageComments ";
$q.= "(PackageBaseID, UsersID, Comments, CommentTS) VALUES (";
$q.= intval($base_id) . ", " . $uid . ", ";
- $q.= $dbh->quote($comment) . ", UNIX_TIMESTAMP())";
+ $q.= $dbh->quote($comment) . ", " . strval(time()) . ")";
$dbh->exec($q);
$comment_id = $dbh->lastInsertId();
@@ -144,7 +144,7 @@ function pkgbase_pin_comment($unpin=false) {
$dbh = DB::connect();
$q = "UPDATE PackageComments ";
if (!$unpin) {
- $q.= "SET PinnedTS = UNIX_TIMESTAMP() ";
+ $q.= "SET PinnedTS = " . strval(time()) . " ";
} else {
$q.= "SET PinnedTS = 0 ";
}
@@ -395,7 +395,7 @@ function pkgbase_flag($base_ids, $comment) {
$dbh = DB::connect();
$q = "UPDATE PackageBases SET ";
- $q.= "OutOfDateTS = UNIX_TIMESTAMP(), FlaggerUID = " . $uid . ", ";
+ $q.= "OutOfDateTS = " . strval(time()) . ", FlaggerUID = " . $uid . ", ";
$q.= "FlaggerComment = " . $dbh->quote($comment) . " ";
$q.= "WHERE ID IN (" . implode(",", $base_ids) . ") ";
$q.= "AND OutOfDateTS IS NULL";
@@ -749,12 +749,12 @@ function pkgbase_vote ($base_ids, $action=true) {
$first = 0;
$vote_ids = $pid;
if ($action) {
- $vote_clauses = "($uid, $pid, UNIX_TIMESTAMP())";
+ $vote_clauses = "($uid, $pid, " . strval(time()) . ")";
}
} else {
$vote_ids .= ", $pid";
if ($action) {
- $vote_clauses .= ", ($uid, $pid, UNIX_TIMESTAMP())";
+ $vote_clauses .= ", ($uid, $pid, " . strval(time()) . ")";
}
}
}
@@ -972,7 +972,7 @@ function pkgbase_delete_comment($undelete=false) {
$q = "UPDATE PackageComments ";
$q.= "SET DelUsersID = ".$uid.", ";
- $q.= "DelTS = UNIX_TIMESTAMP() ";
+ $q.= "DelTS = " . strval(time()) . " ";
$q.= "WHERE ID = ".intval($comment_id);
$dbh->exec($q);
return array(true, __("Comment has been deleted."));
@@ -1005,7 +1005,7 @@ function pkgbase_edit_comment($comment) {
$q = "UPDATE PackageComments ";
$q.= "SET EditedUsersID = ".$uid.", ";
$q.= "Comments = ".$dbh->quote($comment).", ";
- $q.= "EditedTS = UNIX_TIMESTAMP() ";
+ $q.= "EditedTS = " . strval(time()) . " ";
$q.= "WHERE ID = ".intval($comment_id);
$dbh->exec($q);
return array(true, __("Comment has been edited."));