]> jfr.im git - irc/UndernetIRC/cservice-web.git/commitdiff
postgresql >= 13 compatibility fixes
authorStefan Wold <redacted>
Fri, 30 Dec 2022 11:20:39 +0000 (12:20 +0100)
committerStefan Wold <redacted>
Fri, 30 Dec 2022 11:20:39 +0000 (12:20 +0100)
77 files changed:
docs/gnuworld/SOAP/index.php
docs/gnuworld/__sOApp_/index.php
docs/gnuworld/acl/acl.php
docs/gnuworld/acl/complaints.php
docs/gnuworld/acl/nbsupmod.php
docs/gnuworld/acl/newregs.php
docs/gnuworld/acl/newusers.php
docs/gnuworld/acl/site_status.php
docs/gnuworld/admin/bm
docs/gnuworld/admin/bmnew/bmnew.php
docs/gnuworld/admin/boredmanagers.php
docs/gnuworld/admin/idledchannels.php
docs/gnuworld/admin/susp_channels.php
docs/gnuworld/admin/susp_users.php
docs/gnuworld/admin/view_adminlog.php
docs/gnuworld/admin/view_admins.php
docs/gnuworld/admin/view_judgereg.php
docs/gnuworld/admin/view_newu_ips.php
docs/gnuworld/admin/view_pendingusers.php
docs/gnuworld/admin/view_suspends.php
docs/gnuworld/admin/weirdos.php
docs/gnuworld/cfp.php
docs/gnuworld/channels.php
docs/gnuworld/clear_review.php
docs/gnuworld/complaints/admin.php
docs/gnuworld/complaints/confirm.php
docs/gnuworld/complaints/record.php
docs/gnuworld/complaints/ticket.php
docs/gnuworld/confirm.php
docs/gnuworld/dfp.php
docs/gnuworld/forgotten_pass.php
docs/gnuworld/forms/confirm_emailchange.php
docs/gnuworld/forms/confirm_emailchange2.php
docs/gnuworld/forms/confirm_mgrchange.php
docs/gnuworld/forms/confirm_pwreset.php
docs/gnuworld/forms/emailchange.php
docs/gnuworld/forms/managerchange.php
docs/gnuworld/forms/oldconfec.php
docs/gnuworld/forms/purge.php
docs/gnuworld/forms/pwreset.php
docs/gnuworld/gfx_code.php
docs/gnuworld/list_app.php
docs/gnuworld/new_newusers.php
docs/gnuworld/newpass.php
docs/gnuworld/newuser.php
docs/gnuworld/noreg/add_entry.php
docs/gnuworld/noreg/add_entry_f.php
docs/gnuworld/noreg/add_entry_l.php
docs/gnuworld/noreg/add_entry_va.php
docs/gnuworld/noreg/remove_f.php
docs/gnuworld/notes/new.php
docs/gnuworld/notes/reply.php
docs/gnuworld/passwd.php
docs/gnuworld/r_lastseen.php
docs/gnuworld/regproc/admin_complete.php
docs/gnuworld/regproc/admin_reject.php
docs/gnuworld/regproc/cancel_application.php
docs/gnuworld/regproc/registration_acknowledge.php
docs/gnuworld/regproc/regproc.php
docs/gnuworld/regproc/support_decision.php
docs/gnuworld/review_app.php
docs/gnuworld/right.php
docs/gnuworld/save_user.php
docs/gnuworld/securize_pw.php
docs/gnuworld/timezone.php
docs/gnuworld/totp/confirm.php
docs/gnuworld/up_maxlogins.php
docs/gnuworld/upd_totp.php
docs/gnuworld/userbrowser/toast_this.php
docs/gnuworld/users.php
docs/gnuworld/v_totp.php
docs/gnuworld/view_app.php
docs/gnuworld/xat/mgrchg/accept.php
docs/gnuworld/xat/mgrchg/go_perm.php
docs/gnuworld/xat/mgrchg/revert.php
php_includes/cmaster.inc.dist
php_includes/extras.php

index 167ec4892fa01bd1a530218422f04ea3c6533d92..f9bd35799bb17cc8abab738e1cefc627a08d03e5 100755 (executable)
@@ -183,7 +183,7 @@ function channelAccessList( $channel_name , $match_pattern = "*" ) {
                $ccRow = pg_fetch_object($ccRes);
                $rVal[0]->query_status = 1;
                $rVal[0]->channel_id = $ccRow->id;
-               $cQuery = "SELECT users.user_name,levels.access,levels.flags,levels.suspend_expires>=now()::abstime::int4 AS is_suspended,levels.suspend_expires,levels.suspend_level,levels.suspend_by FROM users,levels WHERE levels.channel_id='" . $ccRow->id . "' AND users.id=levels.user_id";
+               $cQuery = "SELECT users.user_name,levels.access,levels.flags,levels.suspend_expires>=date_part('epoch', CURRENT_TIMESTAMP)::int AS is_suspended,levels.suspend_expires,levels.suspend_level,levels.suspend_by FROM users,levels WHERE levels.channel_id='" . $ccRow->id . "' AND users.id=levels.user_id";
                if ($match_pattern != "*") {
                        $match_string = str_replace("?","_",str_replace("*","%",str_replace("%","\%",str_replace("_","\_",$match_pattern))));
                        $cQuery .= " AND lower(users.user_name) LIKE '" . strtolower($match_string) . "'";
@@ -318,7 +318,7 @@ function setUserMaxlogins( $dest_username, $new_maxlogins, $admin_user, $admin_p
        $dRes = pg_safe_exec($dQuery);
        if (pg_numrows($dRes)==0) { return(-3); }
        $dUser = pg_fetch_object($dRes);
-       $sQuery = "UPDATE users SET maxlogins='" . $new_maxlogins . "',last_updated=now()::abstime::int4,last_updated_by='SOAP Interface (" . $admin_user . ")' WHERE id='" . $dUser->id . "'";
+       $sQuery = "UPDATE users SET maxlogins='" . $new_maxlogins . "',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='SOAP Interface (" . $admin_user . ")' WHERE id='" . $dUser->id . "'";
        if ($log_line) {
                $user_id = $cUser->id;
                log_user($dUser->id,3,"- Maxlogins (SOAP)");
index 167ec4892fa01bd1a530218422f04ea3c6533d92..f9bd35799bb17cc8abab738e1cefc627a08d03e5 100755 (executable)
@@ -183,7 +183,7 @@ function channelAccessList( $channel_name , $match_pattern = "*" ) {
                $ccRow = pg_fetch_object($ccRes);
                $rVal[0]->query_status = 1;
                $rVal[0]->channel_id = $ccRow->id;
-               $cQuery = "SELECT users.user_name,levels.access,levels.flags,levels.suspend_expires>=now()::abstime::int4 AS is_suspended,levels.suspend_expires,levels.suspend_level,levels.suspend_by FROM users,levels WHERE levels.channel_id='" . $ccRow->id . "' AND users.id=levels.user_id";
+               $cQuery = "SELECT users.user_name,levels.access,levels.flags,levels.suspend_expires>=date_part('epoch', CURRENT_TIMESTAMP)::int AS is_suspended,levels.suspend_expires,levels.suspend_level,levels.suspend_by FROM users,levels WHERE levels.channel_id='" . $ccRow->id . "' AND users.id=levels.user_id";
                if ($match_pattern != "*") {
                        $match_string = str_replace("?","_",str_replace("*","%",str_replace("%","\%",str_replace("_","\_",$match_pattern))));
                        $cQuery .= " AND lower(users.user_name) LIKE '" . strtolower($match_string) . "'";
@@ -318,7 +318,7 @@ function setUserMaxlogins( $dest_username, $new_maxlogins, $admin_user, $admin_p
        $dRes = pg_safe_exec($dQuery);
        if (pg_numrows($dRes)==0) { return(-3); }
        $dUser = pg_fetch_object($dRes);
-       $sQuery = "UPDATE users SET maxlogins='" . $new_maxlogins . "',last_updated=now()::abstime::int4,last_updated_by='SOAP Interface (" . $admin_user . ")' WHERE id='" . $dUser->id . "'";
+       $sQuery = "UPDATE users SET maxlogins='" . $new_maxlogins . "',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='SOAP Interface (" . $admin_user . ")' WHERE id='" . $dUser->id . "'";
        if ($log_line) {
                $user_id = $cUser->id;
                log_user($dUser->id,3,"- Maxlogins (SOAP)");
index f022c89ada9ec0c062d7101e66898e33e9e1adf6..52f9c4b8f27a84e411e1de98e164e14b8bbd7a23 100755 (executable)
                        $query .= "'" . $isstaff . "',";
                        $query .= "'" . $flags . "',";
                        $query .= "'" . $xtra . "',";
-                       $query .= "now()::abstime::int4,";
+                       $query .= "date_part('epoch', CURRENT_TIMESTAMP)::int,";
                        $query .= "'" . $user_id . "',";
                        $query .= "'0','0','0')";
 
@@ -254,7 +254,7 @@ if ($mode=="applyacl" && $crc == md5( $HTTP_USER_AGENT . $CRC_SALT_0008 . $user_
                        $query .= "isstaff='" . $isstaff . "',";
                        $query .= "flags='" . $flags . "',";
                        $query .= "xtra='" . $xtra . "',";
-                       $query .= "last_updated=now()::abstime::int4,";
+                       $query .= "last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,";
                        $query .= "last_updated_by='" . $user_id . "' ";
                        $query .= " WHERE user_id='" . $userid . "'";
 
index 45efea11cac7adc3e9162059a6aa619cad0838c9..eecfbd347ccba71636cb6f9a63db5180376d9d77 100755 (executable)
@@ -17,7 +17,7 @@
                die;\r
        }\r
 \r
-        if ($switch=="ON") { pg_safe_exec("INSERT INTO locks VALUES (4,now()::abstime::int4," . $user_id . ")"); }\r
+        if ($switch=="ON") { pg_safe_exec("INSERT INTO locks VALUES (4,date_part('epoch', CURRENT_TIMESTAMP)::int," . $user_id . ")"); }\r
         if ($switch=="OFF") { pg_safe_exec("DELETE FROM locks WHERE section='4'"); }\r
 \r
         header("Location: redir.php?RET=index.php");\r
index c1addca2b149b8b5856c9d9113da5cb49fc9cb47..0e5305e6fe961985828b50f4067741632d10bbc8 100755 (executable)
@@ -34,7 +34,7 @@
 \r
                if ($mode=="reset") { $nbsup = DEFAULT_REQUIRED_SUPPORTERS; }\r
 \r
-               pg_safe_exec("UPDATE variables SET contents='" . $nbsup . "',last_updated=now()::abstime::int4 WHERE var_name='REQUIRED_SUPPORTERS'");\r
+               pg_safe_exec("UPDATE variables SET contents='" . $nbsup . "',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE var_name='REQUIRED_SUPPORTERS'");\r
 \r
                header("Location: index.php\n\n");\r
                die;\r
index 8b7b072543346c4a313b1dc7e6eb13e419b0eaa3..b73a579cd2e699e4498dbfe804cf04a9b39c7ef5 100755 (executable)
@@ -19,7 +19,7 @@
                die;\r
        }        \r
         \r
-        if ($switch=="ON") { pg_safe_exec("INSERT INTO locks VALUES (2,now()::abstime::int4," . $user_id . ")"); }\r
+        if ($switch=="ON") { pg_safe_exec("INSERT INTO locks VALUES (2,date_part('epoch', CURRENT_TIMESTAMP)::int," . $user_id . ")"); }\r
         if ($switch=="OFF") { pg_safe_exec("DELETE FROM locks WHERE section='2'"); }\r
         \r
         header("Location: redir.php?RET=index.php");\r
index b793adf5648f02d8acc211e9c1281f96406204e1..ea264dcd166a252dbd93b923441ee94bea672a91 100755 (executable)
@@ -17,7 +17,7 @@
                die;\r
        }\r
 \r
-        if ($switch=="ON") { pg_safe_exec("INSERT INTO locks VALUES (3,now()::abstime::int4," . $user_id . ")"); }\r
+        if ($switch=="ON") { pg_safe_exec("INSERT INTO locks VALUES (3,date_part('epoch', CURRENT_TIMESTAMP)::int," . $user_id . ")"); }\r
         if ($switch=="OFF") { pg_safe_exec("DELETE FROM locks WHERE section='3'"); pg_safe_exec("DELETE FROM counts WHERE count_type='1'"); }\r
 \r
         header("Location: redir.php?RET=index.php");\r
index 5c8e27f0e2f4b05df7b45ae9c50fe7bfd22b9fb7..f10f80235c232f81478d073e7fe9a1669ea406d7 100755 (executable)
@@ -17,7 +17,7 @@
                die;\r
        }\r
 \r
-        if ($switch=="ON") { pg_safe_exec("INSERT INTO locks VALUES (1,now()::abstime::int4," . $user_id . ")"); }\r
+        if ($switch=="ON") { pg_safe_exec("INSERT INTO locks VALUES (1,date_part('epoch', CURRENT_TIMESTAMP)::int," . $user_id . ")"); }\r
         if ($switch=="OFF") { pg_safe_exec("DELETE FROM locks WHERE section='1'"); }\r
 \r
         header("Location: index.php");\r
index 23527ae56937b7c2a63abd92eebf1527a5ebb428..26594bc53bcce02c5cbf0d99567d3b29e2a39736 100755 (executable)
@@ -26,7 +26,7 @@
                                                $flags = $oldflags&~MIA_TAG_FLAG;
                                                break;
                                }
-                               pg_safe_exec("UPDATE channels SET flags='".$flags."',last_updated=now()::abstime::int4 WHERE id='".(int)$_GET['channel_id']."'");
+                               pg_safe_exec("UPDATE channels SET flags='".$flags."',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE id='".(int)$_GET['channel_id']."'");
 
                        } else {
                                $oldflags = -1;
@@ -69,7 +69,7 @@
   $query .= "users.id=levels.user_id AND ";
   $query .= "levels.channel_id=channels.id AND ";
   $query .= "users.id=users_lastseen.user_id AND ";
-  $query .= "users_lastseen.last_seen<=(now()::abstime::int4-25*24*60*60) AND ";
+  $query .= "users_lastseen.last_seen<=(date_part('epoch', CURRENT_TIMESTAMP)::int-25*24*60*60) AND ";
   $query .= "channels.registered_ts>0 AND ";
 // warning: works only on pgsql version 7.2+ (!) If you see SQL errors, this comes from here, just comment the two lines below.
   $query .= "(channels.flags & 1)!=1 AND "; // NOPURGE
@@ -86,7 +86,7 @@
   $query .= "levels.channel_id=channels.id AND ";
   $query .= "users.id=users_lastseen.user_id AND ";
   $query .= "(";
-  $query .= "users_lastseen.last_seen>(now()::abstime::int4-25*24*60*60) ";
+  $query .= "users_lastseen.last_seen>(date_part('epoch', CURRENT_TIMESTAMP)::int-25*24*60*60) ";
   $query .= "OR ";
   $query .= "lower(users.user_name)='nopurge') ";
   $query .= "AND ";
index ea95a138ea8c1da176c5eb770604b05d2e8e7353..44bf494cca66c210e274cfeaba38a40ae039281c 100755 (executable)
@@ -175,9 +175,9 @@ if ($_POST['action'])
                                                        $flags = $oldflags&~MIA_TAG_FLAG;
                                                }
                                        if ($debug==on)
-                                       echo $oldflags." -> UPDATE channels SET flags='".$flags."',last_updated=now()::abstime::int4 WHERE id='".(int)$data[1]."'<br>";
+                                       echo $oldflags." -> UPDATE channels SET flags='".$flags."',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE id='".(int)$data[1]."'<br>";
                                        else
-                                       pg_safe_exec("UPDATE channels SET flags='".$flags."',last_updated=now()::abstime::int4 WHERE id='".(int)$data[1]."'");                                                                          
+                                       pg_safe_exec("UPDATE channels SET flags='".$flags."',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE id='".(int)$data[1]."'");                                                                            
                                        } else 
                                                {
                                                $oldflags = -1;
@@ -204,9 +204,9 @@ if ($_POST['action'])
                                                break;
                                }
                                if ($debug==on)
-                               echo $oldflags." -> UPDATE channels SET flags='".$flags."',last_updated=now()::abstime::int4 WHERE id='".(int)$_GET['channel_id']."'<br>";
+                               echo $oldflags." -> UPDATE channels SET flags='".$flags."',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE id='".(int)$_GET['channel_id']."'<br>";
                                else
-                               pg_safe_exec("UPDATE channels SET flags='".$flags."',last_updated=now()::abstime::int4 WHERE id='".(int)$_GET['channel_id']."'");
+                               pg_safe_exec("UPDATE channels SET flags='".$flags."',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE id='".(int)$_GET['channel_id']."'");
                                
                        } else {
                                $oldflags = -1;
@@ -310,9 +310,9 @@ if ($strict==on)
        {
        if ($manager==on)
                {
-               $query .= " AND users_lastseen.last_seen<((now()::abstime::int4-((".$days_seen."*24*60*60)+1))) AND ";
+               $query .= " AND users_lastseen.last_seen<((date_part('epoch', CURRENT_TIMESTAMP)::int-((".$days_seen."*24*60*60)+1))) AND ";
                $query .= "levels.access=500 ";
-               $query .= "AND channels.id IN ( SELECT channels.id FROM users,users_lastseen,levels,channels WHERE users.id=levels.user_id AND levels.channel_id=channels.id AND users.id=users_lastseen.user_id AND (users_lastseen.last_seen<((now()::abstime::int4-((".$days_seen."*24*60*60)+1)))) AND channels.registered_ts>0 AND levels.access=500 AND lower(users.user_name) !='".$nopurge_username."')";
+               $query .= "AND channels.id IN ( SELECT channels.id FROM users,users_lastseen,levels,channels WHERE users.id=levels.user_id AND levels.channel_id=channels.id AND users.id=users_lastseen.user_id AND (users_lastseen.last_seen<((date_part('epoch', CURRENT_TIMESTAMP)::int-((".$days_seen."*24*60*60)+1)))) AND channels.registered_ts>0 AND levels.access=500 AND lower(users.user_name) !='".$nopurge_username."')";
 
                if ($nopurgeuser==on)
                $query.=" AND channels.id IN ( SELECT channels.id FROM users,levels,channels WHERE users.id=levels.user_id AND levels.channel_id=channels.id AND lower(users.user_name)='".$nopurge_username."' AND channels.registered_ts>0 AND levels.access=500)";
@@ -351,7 +351,7 @@ if ($strict==on)
        if ($manager==on)
                {
                $query .= "AND levels.access=500 ";
-               $query .= "AND channels.id IN ( SELECT channels.id FROM users,users_lastseen,levels,channels WHERE users.id=levels.user_id AND levels.channel_id=channels.id AND users.id=users_lastseen.user_id AND (users_lastseen.last_seen<((now()::abstime::int4-((".$days_seen."*24*60*60)+1)))) AND channels.registered_ts>0 AND levels.access=500 AND lower(users.user_name) !='".$nopurge_username."')";
+               $query .= "AND channels.id IN ( SELECT channels.id FROM users,users_lastseen,levels,channels WHERE users.id=levels.user_id AND levels.channel_id=channels.id AND users.id=users_lastseen.user_id AND (users_lastseen.last_seen<((date_part('epoch', CURRENT_TIMESTAMP)::int-((".$days_seen."*24*60*60)+1)))) AND channels.registered_ts>0 AND levels.access=500 AND lower(users.user_name) !='".$nopurge_username."')";
                if ($nopurgeuser==on)
                $query.=" AND channels.id IN ( SELECT channels.id FROM users,levels,channels WHERE users.id=levels.user_id AND levels.channel_id=channels.id AND lower(users.user_name)='".$nopurge_username."' AND channels.registered_ts>0 AND levels.access=500)";
                if ($nousers==on)
index dc99f298c8e261bee8316e0d0d06d4b7b72fab60..f77c6627d0de23c76a0f1f95e09517b0269b3951 100755 (executable)
@@ -24,7 +24,7 @@
                                                $flags = $oldflags&~MIA_TAG_FLAG;
                                                break;
                                }
-                               pg_safe_exec("UPDATE channels SET flags='".$flags."',last_updated=now()::abstime::int4 WHERE id='".(int)$_GET['channel_id']."'");
+                               pg_safe_exec("UPDATE channels SET flags='".$flags."',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE id='".(int)$_GET['channel_id']."'");
 
                        } else {
                                $oldflags = -1;
@@ -67,7 +67,7 @@
   $query .= "users.id=levels.user_id AND ";
   $query .= "levels.channel_id=channels.id AND ";
   $query .= "users.id=users_lastseen.user_id AND ";
-  $query .= "users_lastseen.last_seen<=(now()::abstime::int4-25*24*60*60) AND ";
+  $query .= "users_lastseen.last_seen<=(date_part('epoch', CURRENT_TIMESTAMP)::int-25*24*60*60) AND ";
   $query .= "channels.registered_ts>0 AND ";
 // warning: works only on pgsql version 7.2+ (!) If you see SQL errors, you are using an obsolete version: UPGRADE!!!
   $query .= "(channels.flags & 1)!=1 AND "; // NOPURGE
@@ -89,7 +89,7 @@
   $query .= "levels.channel_id=channels.id AND ";
   $query .= "users.id=users_lastseen.user_id AND ";
   $query .= "(";
-  $query .= "users_lastseen.last_seen>(now()::abstime::int4-25*24*60*60) ";
+  $query .= "users_lastseen.last_seen>(date_part('epoch', CURRENT_TIMESTAMP)::int-25*24*60*60) ";
   $query .= "OR ";
   $query .= "lower(users.user_name)='nopurge') ";
   $query .= "AND ";
index 5ba0dd68de2f7a3275c3cd83d6d0353569ab1bd1..9b13b9c81966fb1980e4ec57278569647e5781b9 100755 (executable)
@@ -31,7 +31,7 @@ if ($_GET["ok"]==1) {
        $x_days_ago_start = (mktime(0,0,1,date("m",$x_days_ago),date("d",$x_days_ago),date("Y",$x_days_ago)) - 1);
        $start_ts = $x_days_ago_start;
        $end_ts = time();
-       $end_ts_db = "now()::abstime::int4";
+       $end_ts_db = "date_part('epoch', CURRENT_TIMESTAMP)::int";
 }
 $res=pg_safe_exec("select channellog.ts as ts, channels.name as name, channellog.message as message from channellog,channels where channellog.ts>=" . $start_ts . " AND channellog.ts<=" . $end_ts . " AND channellog.event=11 and channellog.channelid=channels.id and channels.registered_ts>0 order by channellog.ts desc");
 $count = pg_numrows($res);
index b8aae6f49dc889009afdfc7fdc58cd337518fa38..75c554e2d7a3dd965a949d3267c486ab7853dd6c 100755 (executable)
@@ -30,7 +30,7 @@ if ($_GET["ok"]==1) {
        $x_days_ago_start = (mktime(0,0,1,date("m",$x_days_ago),date("d",$x_days_ago),date("Y",$x_days_ago)) - 1);
        $start_ts = $x_days_ago_start;
        $end_ts = time();
-       $end_ts_db = "now()::abstime::int4";
+       $end_ts_db = "date_part('epoch', CURRENT_TIMESTAMP)::int";
 }
 
 $res = @pg_safe_exec("SELECT * FROM channels WHERE last_updated>=" . $start_ts . " AND last_updated<=" . $end_ts_db . " AND (flags::int4 & 16)=16 ORDER BY last_updated DESC");
index 98fa7dd606039f4b9feca1b8de02c46cc0962547..c4289d6e91556f26e6d28f1c293fb58d235f417c 100755 (executable)
@@ -30,7 +30,7 @@ if ($_GET["ok"]==1) {
        $x_days_ago_start = (mktime(0,0,1,date("m",$x_days_ago),date("d",$x_days_ago),date("Y",$x_days_ago)) - 1);
        $start_ts = $x_days_ago_start;
        $end_ts = time();
-       $end_ts_db = "now()::abstime::int4";
+       $end_ts_db = "date_part('epoch', CURRENT_TIMESTAMP)::int";
 }
 
 $res = @pg_safe_exec("SELECT * FROM users,userlog WHERE userlog.ts>=" . $start_ts . " AND userlog.ts<=" . $end_ts_db . " AND (users.flags::int4 & 1)=1 AND userlog.user_id=users.id AND userlog.event=1 ORDER BY userlog.ts");
index c65c2b677115fd094cdb4ffc67f594ba9450f3d7..54d7cf8e877c4d3f933b03b8c2f4937a8bc4165e 100755 (executable)
@@ -37,7 +37,7 @@ if ($_GET["ok"]==1) {
        $x_days_ago_start = (mktime(0,0,1,date("m",$x_days_ago),date("d",$x_days_ago),date("Y",$x_days_ago)) - 1);
        $start_ts = $x_days_ago_start;
        $end_ts = time();
-       $end_ts_db = "now()::abstime::int4";
+       $end_ts_db = "date_part('epoch', CURRENT_TIMESTAMP)::int";
 }
 
 $q = "SELECT users.id,users.user_name,adminlog.timestamp AS ts,adminlog.* FROM users,adminlog ";
index e8d1f258300630632eb1c8a6df65a29c1d55fda0..48288e8f7d118e36e9d539da280440605dbf5c23 100755 (executable)
 <?
  $ENABLE_COOKIE_TABLE = 1;
 
-       pg_safe_exec("DELETE FROM webcookies WHERE expire<now()::abstime::int4");
+       pg_safe_exec("DELETE FROM webcookies WHERE expire<date_part('epoch', CURRENT_TIMESTAMP)::int");
 
        $r1 = pg_safe_exec("SELECT COUNT(*) AS count FROM webcookies WHERE is_admin>0");
        $r2 = pg_safe_exec("SELECT COUNT(*) AS count FROM webcookies WHERE is_admin=0");
        $active_mins = 2;
-       $r3 = pg_safe_exec("SELECT COUNT(*) AS count FROM webcookies WHERE is_admin=0 AND expire>(now()::abstime::int4+" . $active_mins . "*60)");
+       $r3 = pg_safe_exec("SELECT COUNT(*) AS count FROM webcookies WHERE is_admin=0 AND expire>(date_part('epoch', CURRENT_TIMESTAMP)::int+" . $active_mins . "*60)");
        $s1 = pg_fetch_object($r1,0);
        $s2 = pg_fetch_object($r2,0);
        $s3 = pg_fetch_object($r3,0);
@@ -33,7 +33,7 @@
 
  echo "Login timeout : <b>" . round((COOKIE_EXPIRE/3600),0) . "</b> hour(s).<br>\n";
 
-  $query = "SELECT * FROM webcookies WHERE is_admin>0 AND expire>=now()::abstime::int4 ORDER BY expire DESC";
+  $query = "SELECT * FROM webcookies WHERE is_admin>0 AND expire>=date_part('epoch', CURRENT_TIMESTAMP)::int ORDER BY expire DESC";
 
   //echo "<b>SQL Query:</b><br>" . $query . ";<br><br>";
 
index 36d900aa2cbed3acbf6ea5808592e77573f0dcf1..3cc82b7726b581ff1f605fbf6de812e6d19353dc 100755 (executable)
@@ -30,7 +30,7 @@ if ($_GET["ok"]==1) {
        $x_days_ago_start = (mktime(0,0,1,date("m",$x_days_ago),date("d",$x_days_ago),date("Y",$x_days_ago)) - 1);
        $start_ts = $x_days_ago_start;
        $end_ts = time();
-       $end_ts_db = "now()::abstime::int4";
+       $end_ts_db = "date_part('epoch', CURRENT_TIMESTAMP)::int";
 }
 $res = pg_safe_exec("SELECT channels.id AS chanid,channels.registered_ts AS ts,channels.name AS name,users.id AS uid,users.user_name AS uname,users_lastseen.last_hostmask AS hostmask,users_lastseen.last_seen AS lastseen_ts FROM levels,channels,users,users_lastseen WHERE levels.access=500 AND levels.added_by='The Judge' AND channels.id=levels.channel_id AND channels.registered_ts>=" . $start_ts . " AND channels.registered_ts<=" . $end_ts . " AND users.id=levels.user_id AND users_lastseen.user_id=levels.user_id");
 $count = pg_numrows($res);
index 9a42d2034a4547d1426cc46f1f554cbf1a896fb7..c0522555cf69367dabd41ac2d26f857eb5f4bf08 100755 (executable)
@@ -23,7 +23,7 @@ if ($o==2) { $order="ip"; }
 \r
 \r
 $ENABLE_COOKIE_TABLE=1;\r
-pg_safe_exec("DELETE FROM newu_ipcheck WHERE expiration<now()::abstime::int4");\r
+pg_safe_exec("DELETE FROM newu_ipcheck WHERE expiration<date_part('epoch', CURRENT_TIMESTAMP)::int");\r
 $res = pg_safe_exec("SELECT * FROM newu_ipcheck ORDER BY " . $order);\r
 $num = pg_numrows($res);\r
 \r
index ad1e1f975c617fd7eb3205871a4049ee4a14fbc5..62ab20389bfcd29b75dfd15945b78ce363b196fa 100755 (executable)
@@ -16,7 +16,7 @@
 <?
  $ENABLE_COOKIE_TABLE = 0;
 
- pg_safe_exec("DELETE FROM pendingusers WHERE expire<now()::abstime::int4");
+ pg_safe_exec("DELETE FROM pendingusers WHERE expire<date_part('epoch', CURRENT_TIMESTAMP)::int");
 
        $r1 = pg_safe_exec("SELECT COUNT(*) AS count FROM pendingusers");
 
index ff1d54842535fb3b8d34916a039dff2059080590..f924fda6b351b21c575953ad790e3fd914a4b36c 100755 (executable)
@@ -36,7 +36,7 @@ if ($_GET["ok"]==1) {
        $x_days_ago_start = (mktime(0,0,1,date("m",$x_days_ago),date("d",$x_days_ago),date("Y",$x_days_ago)) - 1);
        $start_ts = $x_days_ago_start;
        $end_ts = time();
-       $end_ts_db = "now()::abstime::int4";
+       $end_ts_db = "date_part('epoch', CURRENT_TIMESTAMP)::int";
 }
 
 $suspends = pg_safe_exec("SELECT * FROM users,userlog WHERE userlog.ts>=" . $start_ts . " AND userlog.ts<=" . $end_ts_db . " AND users.id=userlog.user_id AND (userlog.event=1 OR userlog.event=2) ORDER BY userlog.ts DESC");
index 7213e583344d9588a14c80ae979071f7a09ad1cc..a3eb0838134e2bc228255a82151700eccb7d99eb 100755 (executable)
@@ -39,7 +39,7 @@
        "or " .
        " channellog.event = 10 " .
        ") and " .
-       " channellog.ts > now()::abstime::int4-(14*24*60*60) " .
+       " channellog.ts > date_part('epoch', CURRENT_TIMESTAMP)::int-(14*24*60*60) " .
        "order by channellog.ts desc");
 
   if (pg_numrows($res)<1) {
index 9d0ee076904f12cdf543908c26d512f27c2fd7b4..d136e20c8e1122f74e42989e70fb0652ae34cea8 100755 (executable)
@@ -10,7 +10,7 @@ $r1 = pg_safe_exec("SELECT * FROM pending_passwordchanges WHERE cookie='" . post
 if ($o1 = @pg_fetch_object($r1,0)) {
        if ($ccrc == md5($iid . "modFP" . CRC_SALT_0015 . $o1->new_crypt)) {
                // confirmation of password change
-               $rez = @pg_safe_exec("UPDATE users SET password='" . $o1->new_crypt . "',last_updated=now()::abstime::int4,last_updated_by='forgotten password (" . cl_ip() . ")' WHERE id='" . $iid . "'");
+               $rez = @pg_safe_exec("UPDATE users SET password='" . $o1->new_crypt . "',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='forgotten password (" . cl_ip() . ")' WHERE id='" . $iid . "'");
                if ($rez) {
                        $ru = pg_safe_exec("SELECT * FROM users WHERE id='" . $iid . "'");
                        $user = pg_fetch_object($ru,0);
index 3c13f6cd7c4b6b9849267512f9bd7e27915d63da..35168525a92049305764884f8ca30ab2e74d0012 100755 (executable)
@@ -302,7 +302,7 @@ if ($button == "Save Changes") {
                 "  url = '" . $c_url . "'," .
                 "  description = '" . $c_desc . "'," .
                 "  keywords = '" . $c_keywords . "'," .
-                "  last_updated = now()::abstime::int4, " .
+                "  last_updated = date_part('epoch', CURRENT_TIMESTAMP)::int, " .
                 "  channel_mode = '" . $c_mode . "' " .
                 " WHERE id = " . $channel->id;
 
@@ -354,10 +354,10 @@ if ($button == "Save Changes") {
                                "  last_modif,last_modif_by,last_updated,deleted) " .
                                " values " .
                                "  (" . $channel->id . "," . $user2->id . "," .
-                               "$add_access ,0,now()::abstime::int4," .
+                               "$add_access ,0,date_part('epoch', CURRENT_TIMESTAMP)::int," .
                                "  '" . $user->user_name . " (via web)'," .
-                               "  now()::abstime::int4,'" .$user->user_name . " (via web)'," .
-                               "  now()::abstime::int4,0)");
+                               "  date_part('epoch', CURRENT_TIMESTAMP)::int,'" .$user->user_name . " (via web)'," .
+                               "  date_part('epoch', CURRENT_TIMESTAMP)::int,0)");
                        //pg_safe_exec($query);
                }
        }
@@ -578,7 +578,7 @@ if (pg_numrows($levels)==0) {
 
 echo("</table>");
 
-$bans = pg_safe_exec("SELECT channel_id,id,banmask,set_by,set_ts,level,expires,reason FROM bans WHERE (expires=0 OR expires>now()::abstime::int4) AND channel_id=$channel->id order by set_ts desc");
+$bans = pg_safe_exec("SELECT channel_id,id,banmask,set_by,set_ts,level,expires,reason FROM bans WHERE (expires=0 OR expires>date_part('epoch', CURRENT_TIMESTAMP)::int) AND channel_id=$channel->id order by set_ts desc");
 
 if (pg_numrows($bans)!=0) {
 echo(" <br><br>
index abe4b43dacf19cf272b697b59649ab62639a5c8c..f4b7ed82729f9a5de713d82b130971720ace6442 100755 (executable)
@@ -34,7 +34,7 @@ if ($do_it==0) {
 \r
 }\r
 \r
-$q = "UPDATE pending SET reviewed='N',reviewed_by_id=1,last_updated=now()::abstime::int4 WHERE channel_id='$channel_id' AND created_ts='$created_ts'";\r
+$q = "UPDATE pending SET reviewed='N',reviewed_by_id=1,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE channel_id='$channel_id' AND created_ts='$created_ts'";\r
 pg_safe_exec($q);\r
 review_count_rem($user_id);\r
 log_channel($channel_id,18,"Cleared Application Review");\r
index 475690a8f14bf02599fbf8dc903e44692c678b9d..8a997b35ddee850de43f9a74b141cc1672757cae 100755 (executable)
@@ -412,7 +412,7 @@ if (($_GET["view"]+0)<=0) {
                        $q = "DELETE FROM complaints WHERE id='" . (int)$_POST["compid"] . "'";
                        // To be checked for bugs (referenced keys) !@#
                } else {
-                       $q = "UPDATE complaints SET current_owner='" . (int)$user_id . "',reviewed_by_id='" . (int)$user_id . "',reviewed_ts=now()::abstime::int4,status='" . $_POST["switchto"] . "' WHERE id='" . (int)$_POST["compid"] . "'";
+                       $q = "UPDATE complaints SET current_owner='" . (int)$user_id . "',reviewed_by_id='" . (int)$user_id . "',reviewed_ts=date_part('epoch', CURRENT_TIMESTAMP)::int,status='" . $_POST["switchto"] . "' WHERE id='" . (int)$_POST["compid"] . "'";
                }
                pg_safe_exec($q);
                echo "<a href=\"admin.php\"><b>&lt;&nbsp;back</b></a><br><br>\n";
@@ -425,13 +425,13 @@ if (($_GET["view"]+0)<=0) {
                        $lo = @pg_fetch_object($lr);
                        $q1_more = "";
                        if ((int)$lo->id == 0) { // so if you transfer it when never replied, it doesnt "bug"
-                               $q1_more = "status=2,reviewed_by_id='" . (int)$user_id . "',reviewed_ts=now()::abstime::int4,";
+                               $q1_more = "status=2,reviewed_by_id='" . (int)$user_id . "',reviewed_ts=date_part('epoch', CURRENT_TIMESTAMP)::int,";
                        }
                        $q1 = "UPDATE complaints SET " . $q1_more . "current_owner='" . (int)$_POST["newowner"] . "' WHERE id='" . (int)$_POST["compid"]. "'";
-                       $q2 = "INSERT INTO complaints_reference (complaints_ref,referenced_by,referenced_to,reference_ts,is_new) VALUES ('" . (int)$_POST["compid"] . "','" . (int)$user_id . "','" . (int)$_POST["newowner"] . "',now()::abstime::int4,1)";
+                       $q2 = "INSERT INTO complaints_reference (complaints_ref,referenced_by,referenced_to,reference_ts,is_new) VALUES ('" . (int)$_POST["compid"] . "','" . (int)$user_id . "','" . (int)$_POST["newowner"] . "',date_part('epoch', CURRENT_TIMESTAMP)::int,1)";
                        $nr = pg_safe_exec("SELECT user_name FROM users WHERE id='" . (int)$_POST["newowner"] . "'");
                        $no = pg_fetch_object($nr);
-                       $q3 = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$_POST["compid"] . "'," . (int)$user_id . ",now()::abstime::int4,'','*** CHANGED TICKET OWNERSHIP TO : " . $no->user_name . " ***'," . (int)$lo->id . ")";
+                       $q3 = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$_POST["compid"] . "'," . (int)$user_id . ",date_part('epoch', CURRENT_TIMESTAMP)::int,'','*** CHANGED TICKET OWNERSHIP TO : " . $no->user_name . " ***'," . (int)$lo->id . ")";
 
                        //echo $q0 . "<br>\n";
                        //echo $q1 . "<br>\n";
index 5109febadf737da0b0585789d941741a906a6966..ff8146b4569f665d08c2cc55aadcecdb06da4e36 100755 (executable)
@@ -8,8 +8,8 @@ if ($user_id > 0) { $admin = std_admin(); } else { $admin = 0; }
 $cTheme = get_theme_info();
 std_theme_styles(1);
 std_theme_body();
-pg_safe_exec("DELETE FROM complaints WHERE status=0 AND crc_expiration<now()::abstime::int4");
-$r = @pg_safe_exec("SELECT id,from_email FROM complaints WHERE created_crc='" . $_GET["ID"] . "' AND status=0 AND crc_expiration>=now()::abstime::int4");
+pg_safe_exec("DELETE FROM complaints WHERE status=0 AND crc_expiration<date_part('epoch', CURRENT_TIMESTAMP)::int");
+$r = @pg_safe_exec("SELECT id,from_email FROM complaints WHERE created_crc='" . $_GET["ID"] . "' AND status=0 AND crc_expiration>=date_part('epoch', CURRENT_TIMESTAMP)::int");
 if (!$r) { echo "<h2>Invalid ID</h2>"; } else {
        if ($o = pg_fetch_object($r)) {
                $ticket_number = strtoupper($o->id . "-" . substr(md5( $o->id . CRC_SALT_0007 . "ticket" ),0,10));
index c7dd3ea996e9efc0fd85ecd49f975b4e1995f80c..ff19ca2886ef66255d33b27277f3df93fa196ae2 100755 (executable)
@@ -221,7 +221,7 @@ if ((complaints_off() && !isoper($user_id)) || COMPLAINTS_ADMINCOMMENT_ID<=0) {
 
 
        /* Check if the maximum complaints per user id / email hasnt been reached */
-       $ssq = pg_safe_exec("SELECT COUNT(id) AS count FROM complaints WHERE created_ts>(now()::abstime::int4-" . MAX_CONCURRENT_TIME . ") AND status<=2 AND (lower(from_email)='" . strtolower($_POST["from_mail"]) . "' OR lower(inrec_email)='" . strtolower($_POST["from_mail"]) . "' OR (from_id='" . ($user_id+0) . "' AND from_id>0))");
+       $ssq = pg_safe_exec("SELECT COUNT(id) AS count FROM complaints WHERE created_ts>(date_part('epoch', CURRENT_TIMESTAMP)::int-" . MAX_CONCURRENT_TIME . ") AND status<=2 AND (lower(from_email)='" . strtolower($_POST["from_mail"]) . "' OR lower(inrec_email)='" . strtolower($_POST["from_mail"]) . "' OR (from_id='" . ($user_id+0) . "' AND from_id>0))");
        $sso = pg_fetch_object($ssq);
        if ($sso->count >= MAX_CONCURRENT) { // yes !
                echo $back_lnk;
@@ -231,7 +231,7 @@ if ((complaints_off() && !isoper($user_id)) || COMPLAINTS_ADMINCOMMENT_ID<=0) {
        unset($ssq); unset($sso);
 
        /* Check if the maximum complaints per IP hasnt been reached */
-       $ssq = pg_safe_exec("SELECT COUNT(id) AS count FROM complaints WHERE created_ts>(now()::abstime::int4-" . MAX_CONCURRENT_IP_TIME . ") AND status<=2 AND created_ip='" . cl_ip() . "'");
+       $ssq = pg_safe_exec("SELECT COUNT(id) AS count FROM complaints WHERE created_ts>(date_part('epoch', CURRENT_TIMESTAMP)::int-" . MAX_CONCURRENT_IP_TIME . ") AND status<=2 AND created_ip='" . cl_ip() . "'");
        $sso = pg_fetch_object($ssq);
        if ($sso->count >= MAX_CONCURRENT_IP) { // yes !
                echo $back_lnk;
@@ -302,7 +302,7 @@ $query .= "" . (int)$da_channel2_id . ", ";
 $query .= "'" . post2db($da_channel2_name) . "', ";
 
 $query .= "" . (int)$da_users_id . ", ";
-$query .= "0, 0, 0, 0, now()::abstime::int4, '" . cl_ip() . "', '" . $da_crc . "', (now()::abstime::int4+172800), '', 0";
+$query .= "0, 0, 0, 0, date_part('epoch', CURRENT_TIMESTAMP)::int, '" . cl_ip() . "', '" . $da_crc . "', (date_part('epoch', CURRENT_TIMESTAMP)::int+172800), '', 0";
 $query .= " )";
 echo "<br>";
 $res = @pg_safe_exec($query);
@@ -319,7 +319,7 @@ if ($to = pg_fetch_object($tq)) {
                $da_cmt .= "**** AUTOMATIC ****<br><br>";
                $da_cmt .= "<b>An anonymous objection has been posted through the Complaints System.</b><br>";
                $da_cmt .= "<a href=\"complaints/admin.php?view=" . $ticket_number . "\">click here</a> to go to that complaint.<br><br>";
-               $notif_q = "INSERT INTO objections (channel_id,user_id,comment,created_ts,admin_only) VALUES ('" . (int)$da_channel1_id . "','" . (int)$issuer_id . "','" . post2db($da_cmt) . "',now()::abstime::int4,'Y')";
+               $notif_q = "INSERT INTO objections (channel_id,user_id,comment,created_ts,admin_only) VALUES ('" . (int)$da_channel1_id . "','" . (int)$issuer_id . "','" . post2db($da_cmt) . "',date_part('epoch', CURRENT_TIMESTAMP)::int,'Y')";
                pg_safe_exec($notif_q);
        }
 
@@ -339,7 +339,7 @@ if (!$res) { die($back_lnk . "<b>SQL ERROR</b><br><br></td></tr></table></body><
        $mmsg .= "\nThe " . NETWORK_NAME . " Channel Service.\n\n";
        custom_mail($_POST["from_mail"],"[" . NETWORK_NAME . " CService Complaints] Confirmation request",$mmsg,"From: " . NETWORK_NAME . " Channel Service <" . OBJECT_EMAIL . ">\nReply-to: DO.NOT@REPLY.THANKS\nX-Mailer: " . NETWORK_NAME . " CService Complaint Module\n\n");
 }
-$dq = pg_safe_exec("SELECT id FROM complaints WHERE (status=0 OR status=99) AND crc_expiration<now()::abstime::int4");
+$dq = pg_safe_exec("SELECT id FROM complaints WHERE (status=0 OR status=99) AND crc_expiration<date_part('epoch', CURRENT_TIMESTAMP)::int");
 while ($do = pg_fetch_object($dq)) {
        pg_safe_exec("DELETE FROM complaints_reference WHERE complaints_ref='" . (int)$do->id . "'");
        pg_safe_exec("DELETE FROM complaints_threads WHERE complaint_ref='" . (int)$do->id . "'");
index c08f2a92eae3114d9e41570d504905633095a5ae..8e56dc524e6b234057f6adb5a0e8a81371a91f91 100755 (executable)
@@ -28,7 +28,7 @@ switch ($_GET["A"]) {
                                $r1 = pg_safe_exec("SELECT id,from_id FROM complaints WHERE status!=4 AND id='" . (int)$da_id . "' AND ticket_number='" . $_GET["ID"] . "'");
                                if ($o1 = pg_fetch_object($r1)) {
                                        $q = "UPDATE complaints SET current_owner=0,status=4 WHERE id='" . (int)$da_id . "' AND ticket_number='" . $_GET["ID"] . "'";
-                                       $q2 = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "',0,now()::abstime::int4,'** TICKET CLOSED **','',0)";
+                                       $q2 = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "',0,date_part('epoch', CURRENT_TIMESTAMP)::int,'** TICKET CLOSED **','',0)";
                                        $q3 = "DELETE FROM complaints_reference WHERE complaints_ref='" . (int)$da_id . "'";
                                        $r = pg_safe_exec($q);
                                        $updated=0;
@@ -95,7 +95,7 @@ switch ($_GET["A"]) {
                                        if (strlen($da_reply)>30720) {
                                                echo "<big>your 'reply' section is too big ( above 30KB )</big>.";
                                        } else {
-                                               $q = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "',0,now()::abstime::int4,'" . $da_reply . "',''," . (int)$_GET["RT"] . ")";
+                                               $q = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "',0,date_part('epoch', CURRENT_TIMESTAMP)::int,'" . $da_reply . "',''," . (int)$_GET["RT"] . ")";
 
                                                echo "<h2>Complaint Manager (reply to admin)";
                                                echo "</h2>\n";
@@ -188,7 +188,7 @@ if ($passok) {
 switch ($_GET["A"]) {
        case 'cancel':
                $q = "UPDATE complaints SET current_owner=0,status=4 WHERE id='" . (int)$da_id . "' AND ticket_number='" . $_GET["ID"] . "'";
-               $q2 = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "'," . (int)$user_id . ",now()::abstime::int4,'** TICKET CANCELLED **','',0)";
+               $q2 = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "'," . (int)$user_id . ",date_part('epoch', CURRENT_TIMESTAMP)::int,'** TICKET CANCELLED **','',0)";
                $q3 = "DELETE FROM complaints_reference WHERE complaints_ref='" . (int)$da_id . "'";
                $r = pg_safe_exec($q);
                $updated=0;
@@ -224,15 +224,15 @@ switch ($_GET["A"]) {
                        }
                        if ($do_the_reply == 1) {
                                if ($da_reply == "") { $do_notify_user = 0; }
-                               $q = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "'," . (int)$user_id . ",now()::abstime::int4,'" . $da_reply . "','" . $da_actions . "'," . (int)$_GET["RT"] . ")";
+                               $q = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "'," . (int)$user_id . ",date_part('epoch', CURRENT_TIMESTAMP)::int,'" . $da_reply . "','" . $da_actions . "'," . (int)$_GET["RT"] . ")";
                                $qx = ""; $qs = "";
                                if ($_GET["RT"]==0 && $_POST["newstatus"]==0) {
-                                       $qx = "UPDATE complaints SET current_owner=" . (int)$user_id . ",reviewed_by_id=" . (int)$user_id . ",reviewed_ts=now()::abstime::int4,status=2 WHERE id='" . (int)$da_id . "' AND ticket_number='" . $_GET["ID"] . "'";
+                                       $qx = "UPDATE complaints SET current_owner=" . (int)$user_id . ",reviewed_by_id=" . (int)$user_id . ",reviewed_ts=date_part('epoch', CURRENT_TIMESTAMP)::int,status=2 WHERE id='" . (int)$da_id . "' AND ticket_number='" . $_GET["ID"] . "'";
                                }
                                if ($_POST["newstatus"]>2) {
                                        $somemore = "";
                                        if ($_GET["RT"]==0) {
-                                               $somemore = "current_owner=0,reviewed_by_id=" . (int)$user_id . ",reviewed_ts=now()::abstime::int4,";
+                                               $somemore = "current_owner=0,reviewed_by_id=" . (int)$user_id . ",reviewed_ts=date_part('epoch', CURRENT_TIMESTAMP)::int,";
                                        } else {
                                                $somemore = "current_owner=0,";
                                        }
@@ -245,7 +245,7 @@ switch ($_GET["A"]) {
                                if ($qs!="") {
                                        pg_safe_exec($qs);
        //                              echo $qs . "<br>";
-                                       $qq = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "'," . (int)$user_id . ",now()::abstime::int4,'*** TICKET " . strtoupper($cmp_status[$_POST["newstatus"]]) . " ***','',0)";
+                                       $qq = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "'," . (int)$user_id . ",date_part('epoch', CURRENT_TIMESTAMP)::int,'*** TICKET " . strtoupper($cmp_status[$_POST["newstatus"]]) . " ***','',0)";
        //                              echo $qq . "<br>";
                                        pg_safe_exec($qq);
                                }
@@ -356,7 +356,7 @@ switch ($_GET["A"]) {
                break;
        case 'resolve':
                $q = "UPDATE complaints SET status=3 WHERE id='" . (int)$da_id . "' AND ticket_number='" . $_GET["ID"] . "'";
-               $q2 = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "'," . (int)$user_id . ",now()::abstime::int4,'** TICKET RESOLVED **','',0)";
+               $q2 = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "'," . (int)$user_id . ",date_part('epoch', CURRENT_TIMESTAMP)::int,'** TICKET RESOLVED **','',0)";
                $q3 = "DELETE FROM complaints_reference WHERE complaints_ref='" . (int)$da_id . "'";
                $r = pg_safe_exec($q);
                $updated=0;
@@ -381,8 +381,8 @@ switch ($_GET["A"]) {
                }
                break;
        case 'delete':
-               $q = "UPDATE complaints SET status=99,created_crc='',crc_expiration=(now()::abstime::int4+(86400*15)) WHERE id='" . (int)$da_id . "' AND ticket_number='" . $_GET["ID"] . "'";
-               $q2 = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "'," . (int)$user_id . ",now()::abstime::int4,'** TICKET REMOVED/DELETED **','',0)";
+               $q = "UPDATE complaints SET status=99,created_crc='',crc_expiration=(date_part('epoch', CURRENT_TIMESTAMP)::int+(86400*15)) WHERE id='" . (int)$da_id . "' AND ticket_number='" . $_GET["ID"] . "'";
+               $q2 = "INSERT INTO complaints_threads (complaint_ref,reply_by,reply_ts,reply_text,actions_text,in_reply_to) VALUES ('" . (int)$da_id . "'," . (int)$user_id . ",date_part('epoch', CURRENT_TIMESTAMP)::int,'** TICKET REMOVED/DELETED **','',0)";
                $q3 = "DELETE FROM complaints_reference WHERE complaints_ref='" . (int)$da_id . "'";
                $r = pg_safe_exec($q);
                $updated=0;
index 67dc57214d31939ef0159ba2bf65fc979f047ef3..dcaa548a482bb7a18f2e721d0645bede89465dcc 100755 (executable)
@@ -128,7 +128,7 @@ if ($cookie!="") {
        $verificationdata = prepare_dbtext_db( $user->verificationdata );
 
        $q = "INSERT INTO users (user_name, password, flags, email, last_updated, last_updated_by, language_id, question_id, verificationdata, post_forms, signup_ts, signup_ip, maxlogins)";
-       $q .= sprintf(" VALUES ('%s', '%s', %d, '%s', %s, '%s', %d, %d, '%s', %s, %s, '%s', %d)", $user->user_name, $crypt, 4, $user->email, "now()::abstime::int4", "Web Page New User", $user->language, $user->question_id, $verificationdata, "(now()::abstime::int4+432000)", "now()::abstime::int4", cl_ip(), DEFAULT_MAX_LOGINS);
+       $q .= sprintf(" VALUES ('%s', '%s', %d, '%s', %s, '%s', %d, %d, '%s', %s, %s, '%s', %d)", $user->user_name, $crypt, 4, $user->email, "date_part('epoch', CURRENT_TIMESTAMP)::int", "Web Page New User", $user->language, $user->question_id, $verificationdata, "(date_part('epoch', CURRENT_TIMESTAMP)::int+432000)", "date_part('epoch', CURRENT_TIMESTAMP)::int", cl_ip(), DEFAULT_MAX_LOGINS);
 
        $res=pg_safe_exec($q);
        local_seclog("New user confirmation for `" . $user->user_name . "`");
@@ -140,7 +140,7 @@ if ($cookie!="") {
                $uobj=pg_fetch_object($ucount,0);
                $newcount = $uobj->count_count+1;
                if ($newcount==$MAX_ALLOWED_USERS) {
-                       pg_safe_exec("INSERT INTO locks VALUES (3,now()::abstime::int4,0)");
+                       pg_safe_exec("INSERT INTO locks VALUES (3,date_part('epoch', CURRENT_TIMESTAMP)::int,0)");
                }
                pg_safe_exec("UPDATE counts SET count_count='" . ($newcount+0) . "' WHERE count_type='1'");
        }
index 9c3929df3cb629c2595c6ccee447998e348b7a72..e92cc6fb26a1be47f093f9d9d671c0366cdb0e70 100755 (executable)
@@ -10,7 +10,7 @@ $r1 = pg_safe_exec("SELECT * FROM pending_passwordchanges WHERE cookie='" . post
 if ($o1 = @pg_fetch_object($r1,0)) {
        if ($ccrc == md5($iid . "modFP" . CRC_SALT_0015 . $o1->new_crypt)) {
                // cancellation of password change
-               $rez = @pg_safe_exec("UPDATE users SET password='" . $o1->old_crypt . "',last_updated=now()::abstime::int4,last_updated_by='forgotten password (" . cl_ip() . ") cancel' WHERE id='" . $iid . "'");
+               $rez = @pg_safe_exec("UPDATE users SET password='" . $o1->old_crypt . "',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='forgotten password (" . cl_ip() . ") cancel' WHERE id='" . $iid . "'");
                if ($rez) {
                        pg_safe_exec("DELETE FROM pending_passwordchanges WHERE user_id='" . $user->id . "'");
                        echo "<h1>Success !<br><br>\n";
index b1dc87700ab50e60f3f2f5e495dcf94885f01613..d24cdac67ea86f462df7d0e18f339a3d542556f7 100755 (executable)
@@ -70,7 +70,7 @@ echo "If you forgot your verification answer then go to the <a href=\"forms/pwre
                                                die;
                                        } else {
                                                $Xcrc = md5($user->id . "modFP" . CRC_SALT_0015 . $crypt);
-                                               pg_safe_exec("INSERT INTO pending_passwordchanges VALUES ('" . post2db($Xcrc) . "','" . $user->id . "','" . $user->password . "','" . $crypt . "','" . post2db($password) . "',now()::abstime::int4)");
+                                               pg_safe_exec("INSERT INTO pending_passwordchanges VALUES ('" . post2db($Xcrc) . "','" . $user->id . "','" . $user->password . "','" . $crypt . "','" . post2db($password) . "',date_part('epoch', CURRENT_TIMESTAMP)::int)");
                                                if (LOCK_ON_PWCHG) { $crypt = "*"; } else { $crypt = $user->password; }
                                                $ss = "[Forgotten Password] Confirmation request for '" . $user->username . "'";
                                                $mm = "";
@@ -100,7 +100,7 @@ echo "If you forgot your verification answer then go to the <a href=\"forms/pwre
                }
                if (!$doconf || LOCK_ON_PWCHG) {
                        $res=pg_safe_exec("update users set password='" . $crypt . "', " .
-                               " last_updated = now()::abstime::int4, " .
+                               " last_updated = date_part('epoch', CURRENT_TIMESTAMP)::int, " .
                                " last_updated_by = 'forgotten password (" . cl_ip() . ")' " .
                                " where " .
                                "  id='". $user->id . "'");
@@ -110,7 +110,7 @@ echo "If you forgot your verification answer then go to the <a href=\"forms/pwre
                        log_user($user->id,9," ");
                }
                pg_safe_exec("delete from lastrequests where ip='" . cl_ip() . "'");
-               pg_safe_exec("insert into lastrequests (ip,last_request_ts) values ('" . cl_ip() . "',now()::abstime::int4)");
+               pg_safe_exec("insert into lastrequests (ip,last_request_ts) values ('" . cl_ip() . "',date_part('epoch', CURRENT_TIMESTAMP)::int)");
 
 ?>
 <html>
index bff51c7d380d3e62e86ecb59314aaabdde650292..576ce5d7977a76ac3f21522ac9d95eadcd588ab2 100755 (executable)
@@ -11,7 +11,7 @@ $cTheme = get_theme_info();
 
 if ($ID!="" && strlen($ID)<=128) {
        std_connect();
-       $res=pg_safe_exec("select * from pending_emailchanges where phase=1 AND cookie='$ID' AND expiration>=now()::abstime::int4");
+       $res=pg_safe_exec("select * from pending_emailchanges where phase=1 AND cookie='$ID' AND expiration>=date_part('epoch', CURRENT_TIMESTAMP)::int");
        if (pg_numrows($res)==0) {
                std_theme_styles(1); std_theme_body("../");
                echo "<h1>Error</h1> The URL entered is not valid.  Please check it ";
@@ -19,7 +19,7 @@ if ($ID!="" && strlen($ID)<=128) {
                echo "</body></html>";
                exit;
        } else {
-               pg_safe_exec("delete from pending_emailchanges where expiration<now()::abstime::int4");
+               pg_safe_exec("delete from pending_emailchanges where expiration<date_part('epoch', CURRENT_TIMESTAMP)::int");
                $email=pg_fetch_object($res,0);
                $userid = $email->user_id;
                $nmail = $email->new_email;
@@ -39,7 +39,7 @@ $user=pg_fetch_object($res,0);
 
        // change email
         $cookieval = md5(CRC_SALT_0020 . uniqid("",1) . time() . $nmail);
-       pg_safe_exec("update pending_emailchanges SET expiration=(now()::abstime::int4+21600),phase=2,cookie='$cookieval' WHERE phase=1 AND cookie='$ID'");
+       pg_safe_exec("update pending_emailchanges SET expiration=(date_part('epoch', CURRENT_TIMESTAMP)::int+21600),phase=2,cookie='$cookieval' WHERE phase=1 AND cookie='$ID'");
 
         $confirm_url = gen_server_url() . LIVE_LOCATION . "/forms/confirm_emailchange2.php?ID=$cookieval";
 
index ac57ea602c735e5474271866befdd6940a740092..332812939487f8bc75c103452841520806753eb3 100755 (executable)
@@ -11,7 +11,7 @@ $cTheme = get_theme_info();
 
 if ($ID!="" && strlen($ID)<=128) {
        std_connect();
-       $res=pg_safe_exec("select * from pending_emailchanges where phase=2 AND cookie='$ID' AND expiration>=now()::abstime::int4");
+       $res=pg_safe_exec("select * from pending_emailchanges where phase=2 AND cookie='$ID' AND expiration>=date_part('epoch', CURRENT_TIMESTAMP)::int");
        if (pg_numrows($res)==0) {
                std_theme_styles(1); std_theme_body("../");
                echo "<h1>Error</h1> The URL entered is not valid.  Please check it ";
@@ -19,7 +19,7 @@ if ($ID!="" && strlen($ID)<=128) {
                echo "</body></html>";
                exit;
        } else {
-               pg_safe_exec("delete from pending_emailchanges where expiration<now()::abstime::int4");
+               pg_safe_exec("delete from pending_emailchanges where expiration<date_part('epoch', CURRENT_TIMESTAMP)::int");
                $email=pg_fetch_object($res,0);
                $userid = $email->user_id;
                $nmail = $email->new_email;
@@ -37,7 +37,7 @@ if ($ID!="" && strlen($ID)<=128) {
 
        // change email
 
-       $res=pg_safe_exec("UPDATE users SET email='$nmail',last_updated=now()::abstime::int4,last_updated_by='Email-in-record Modification' WHERE id='$userid'");
+       $res=pg_safe_exec("UPDATE users SET email='$nmail',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='Email-in-record Modification' WHERE id='$userid'");
        $user_id = $userid;
        log_user($userid,7,"Changed email-in-record from: $omail(old) to: $nmail(new) - cookie was: $ID");
        $user_id = 0;
index 022c3e461d87e7f33153d065ec520b7bfaf1ed25..c18752b60f3155bfdf9b6c4ecab07b5b69767472 100755 (executable)
@@ -11,8 +11,8 @@ $cTheme = get_theme_info();
 
 if ($ID!="" && strlen($ID)<=128) {
        std_connect();
-       pg_safe_exec("delete from pending_mgrchange where expiration<now()::abstime::int4 AND confirmed='0'");
-       $res=pg_safe_exec("select * from pending_mgrchange where crc='$ID' AND expiration>=now()::abstime::int4 AND confirmed='0'");
+       pg_safe_exec("delete from pending_mgrchange where expiration<date_part('epoch', CURRENT_TIMESTAMP)::int AND confirmed='0'");
+       $res=pg_safe_exec("select * from pending_mgrchange where crc='$ID' AND expiration>=date_part('epoch', CURRENT_TIMESTAMP)::int AND confirmed='0'");
        if (pg_numrows($res)==0) {
                std_theme_styles(1); std_theme_body("../");
                echo "<h1>Error</h1> The URL entered is not valid.  Please check it ";
index 0b798d530fb1a7ee0fe9a7385c8a9af277806220..f8b540e9832e5f43edee83617a3f3f03155ec18c 100755 (executable)
@@ -14,7 +14,7 @@ $cTheme = get_theme_info();
 
 if ($ID!="" && strlen($ID)<=128) {
        std_connect();
-       $res=pg_safe_exec("select * from pending_pwreset where cookie='" . $ID . "' AND expiration>=now()::abstime::int4");
+       $res=pg_safe_exec("select * from pending_pwreset where cookie='" . $ID . "' AND expiration>=date_part('epoch', CURRENT_TIMESTAMP)::int");
        if (pg_numrows($res)==0) {
                std_theme_styles(1); std_theme_body("../");
                echo "<h1>Error</h1> The URL entered is not valid.  Please check it ";
@@ -22,7 +22,7 @@ if ($ID!="" && strlen($ID)<=128) {
                echo "</body></html>";
                exit;
        } else {
-               pg_safe_exec("delete from pending_pwreset where expiration<now()::abstime::int4");
+               pg_safe_exec("delete from pending_pwreset where expiration<date_part('epoch', CURRENT_TIMESTAMP)::int");
                $pwreset=pg_fetch_object($res,0);
                $userid = $pwreset->user_id;
                $qid = $pwreset->question_id;
@@ -32,7 +32,7 @@ if ($ID!="" && strlen($ID)<=128) {
        // change verifdata
        $gor=pg_safe_exec("SELECT verificationdata FROM users WHERE id='" . (int)$userid . "'");
        $goro=pg_fetch_object($gor);
-       $res=pg_safe_exec("UPDATE users SET question_id='" . (int)$qid . "',verificationdata='" . post2db($vdata) . "',post_forms=(now()::abstime::int4+86400*10),last_updated=now()::abstime::int4,last_updated_by='Verif Q/A Reset' WHERE id='" . (int)$userid . "'");
+       $res=pg_safe_exec("UPDATE users SET question_id='" . (int)$qid . "',verificationdata='" . post2db($vdata) . "',post_forms=(date_part('epoch', CURRENT_TIMESTAMP)::int+86400*10),last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='Verif Q/A Reset' WHERE id='" . (int)$userid . "'");
        $user_id = $userid;
        log_user($userid,8,"Cookie was: " . $ID . ", Old V/A was: " . $goro->verificationdata);
        $user_id = 0;
index 944c71a0cda6be4716629b35b70787948a348fe8..f7fc3038d35ffac356af79470fff49b95fc4ebf5 100755 (executable)
@@ -147,7 +147,7 @@ if ($verifdata!=$user->verificationdata) {
 
        $cookieval = md5(CRC_SALT_0020 . uniqid("",1) . time() . $da_newmail);
 
-       pg_safe_exec("INSERT INTO pending_emailchanges (cookie,user_id,old_email,new_email,expiration,phase) VALUES ('$cookieval',$user_id,'$da_emailaddy','$da_newmail',now()::abstime::int4+21600,1)");
+       pg_safe_exec("INSERT INTO pending_emailchanges (cookie,user_id,old_email,new_email,expiration,phase) VALUES ('$cookieval',$user_id,'$da_emailaddy','$da_newmail',date_part('epoch', CURRENT_TIMESTAMP)::int+21600,1)");
        $confirm_url = gen_server_url() . LIVE_LOCATION. "/forms/confirm_emailchange.php?ID=$cookieval";
 
        $the_msg = "If you would like to confirm that the new email-in-record for '$da_username' should be '$da_newmail',\n";
@@ -157,7 +157,7 @@ if ($verifdata!=$user->verificationdata) {
        custom_mail($da_emailaddy,"E-Mail change request 1/2",$the_msg,"From: " . NETWORK_NAME . " E-Mail Change Request <" . OBJECT_EMAIL . ">\nReply-To: no.reply@thank.you\nX-Mailer: " . NETWORK_NAME . " Channel Service");
 
        /* make the user can re-port in 10 days. */
-       pg_safe_exec("UPDATE users SET post_forms=(now()::abstime::int4+86400*10) WHERE id=" . $user_id);
+       pg_safe_exec("UPDATE users SET post_forms=(date_part('epoch', CURRENT_TIMESTAMP)::int+86400*10) WHERE id=" . $user_id);
 
        echo "<h2>";
        echo "Please check your e-mail at '$da_emailaddy',<br>then click on the URL to continue the email change to phase 2/2.<br><br>\n";
index 025029acc0ad9165c8ae5d921739e5ffc06977cf..4028cd862fbac2b7a8b300faba49bbc167577413 100755 (executable)
@@ -389,7 +389,7 @@ if (pg_numrows($huhu)>0) {
 
        if (!$mailres) { local_seclog("custom_mail() failed for " . $user->email . " from: " . $x_at_email); }
 
-       pg_safe_exec("UPDATE users SET post_forms=(now()::abstime::int4+86400*10) WHERE id='" . $user_id . "'");
+       pg_safe_exec("UPDATE users SET post_forms=(date_part('epoch', CURRENT_TIMESTAMP)::int+86400*10) WHERE id='" . $user_id . "'");
 
        echo "<h2>";
        echo "Please read your email at '$user->email'<br>and click on the link to CONFIRM your request<br>within <b>6 hours</b>\n";
@@ -470,7 +470,7 @@ echo "<input type=hidden name=verifq value=" . $user->question_id . ">\n";
  <textarea name=mcreason cols=40 rows=5></textarea>
  <li>Username of new manager : <?
        if ($multiple_ok == 0) { $forcechannel_I=$channel->id; }
-       $res3 = pg_safe_exec("SELECT users.user_name,users.id FROM users,users_lastseen,levels WHERE users.id=levels.user_id AND levels.channel_id='" . $forcechannel_I . "' AND levels.access=499 AND users_lastseen.user_id=users.id AND users_lastseen.last_seen>(now()::abstime::int4-86400*20) ORDER BY users.user_name");
+       $res3 = pg_safe_exec("SELECT users.user_name,users.id FROM users,users_lastseen,levels WHERE users.id=levels.user_id AND levels.channel_id='" . $forcechannel_I . "' AND levels.access=499 AND users_lastseen.user_id=users.id AND users_lastseen.last_seen>(date_part('epoch', CURRENT_TIMESTAMP)::int-86400*20) ORDER BY users.user_name");
        if (pg_numrows($res3)==0) {
                echo "<b>No user with level 499 on that channel seen in the last 20 days.</b><br>\n";
                $nouser=1;
index 3f9ee8dd7ab0482dbfef93a84d7255e0cbc8298b..edce3e7736cc78e63e41c2f6c6200b75822f55bf 100755 (executable)
@@ -11,7 +11,7 @@ $cTheme = get_theme_info();
 
 if ($ID!="" && strlen($ID)<=128) {
        std_connect();
-       $res=pg_safe_exec("select * from pending_emailchanges where cookie='$ID' AND expiration>=now()::abstime::int4");
+       $res=pg_safe_exec("select * from pending_emailchanges where cookie='$ID' AND expiration>=date_part('epoch', CURRENT_TIMESTAMP)::int");
        if (pg_numrows($res)==0) {
                std_theme_styles(1); std_theme_body("../");
                echo "<h1>Error</h1> The URL entered is not valid.  Please check it ";
@@ -19,7 +19,7 @@ if ($ID!="" && strlen($ID)<=128) {
                echo "</body></html>";
                exit;
        } else {
-               pg_safe_exec("delete from pending_emailchanges where expiration<now()::abstime::int4");
+               pg_safe_exec("delete from pending_emailchanges where expiration<date_part('epoch', CURRENT_TIMESTAMP)::int");
                $email=pg_fetch_object($res,0);
                $userid = $email->user_id;
                $nmail = $email->new_email;
@@ -37,7 +37,7 @@ if ($ID!="" && strlen($ID)<=128) {
 
        // change email
 
-       $res=pg_safe_exec("UPDATE users SET email='$nmail',last_updated=now()::abstime::int4,last_updated_by='Email-in-record Modification' WHERE id='$userid'");
+       $res=pg_safe_exec("UPDATE users SET email='$nmail',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='Email-in-record Modification' WHERE id='$userid'");
        $user_id = $userid;
        log_user($userid,7,"Changed email-in-record from: $omail(old) to: $nmail(new) - cookie was: $ID");
        $user_id = 0;
index 1aea5a1199013fb6954aa79aa65f5de55bab7afb..8a561818645f135bca68b9e45acb7b42cf50ff59 100755 (executable)
@@ -196,7 +196,7 @@ if (!file_exists("../testnet")) {
 }
 
        /* make the user can re-port in 10 days. */
-       pg_safe_exec("UPDATE users SET post_forms=(now()::abstime::int4+86400*10) WHERE id=" . $user_id);
+       pg_safe_exec("UPDATE users SET post_forms=(date_part('epoch', CURRENT_TIMESTAMP)::int+86400*10) WHERE id=" . $user_id);
 
        echo "<h2>";
        echo "Please allow 3-5 days for your request to be processed.\n";
index 48366194eebc506c0975e2cbb797621d43c76195..0b7cccb1881b21e09346d0c4341e299052f4717f 100755 (executable)
@@ -81,7 +81,7 @@ if ((int)$ro1->question_id==0 || $ro1->verificationdata=="") {
                 die;
         }
 
-pg_safe_exec("DELETE FROM pending_pwreset WHERE expiration<now()::abstime::int4");
+pg_safe_exec("DELETE FROM pending_pwreset WHERE expiration<date_part('epoch', CURRENT_TIMESTAMP)::int");
 $blo2 = pg_safe_exec("SELECT * FROM pending_pwreset WHERE user_id='$da_id'");
 if (pg_numrows($blo2)>0) {
        echo "<h2>\n";
@@ -245,7 +245,7 @@ if ($crc == md5($HTTP_USER_AGENT . $ts . CRC_SALT_0009)) {
 
 
        $cookieval = md5(CRC_SALT_0015 . uniqid("",1) . time() . $da_emailaddy . $verifdata);
-       pg_safe_exec("INSERT INTO pending_pwreset (cookie,user_id,question_id,verificationdata,expiration) VALUES ('$cookieval',$uid,'$verifq','$verifdata',now()::abstime::int4+21600)");
+       pg_safe_exec("INSERT INTO pending_pwreset (cookie,user_id,question_id,verificationdata,expiration) VALUES ('$cookieval',$uid,'$verifq','$verifdata',date_part('epoch', CURRENT_TIMESTAMP)::int+21600)");
        $confirm_url = gen_server_url() . LIVE_LOCATION . "/forms/confirm_pwreset.php?ID=$cookieval";
        $the_msg = "If you would like to confirm that the new verification question/answer for '$da_username' should be changed as requested,\n";
        $the_msg .= "then click on the link below within 6 hours :\n\n";
index 75ec6701f518b52198e9d2c0923c62604b209428..b9ac949aa59bc6fd6f12abd4003e461be724537c 100755 (executable)
@@ -10,7 +10,7 @@ if (SHOW_GFXUSRCHK && NEWUSERS_GFXCHECK) {
        $fontList = get_font_face_list();
        unset($dFID); $dFID = rand(0,(count($fontList)-1)); // random available font face
 
-       pg_safe_exec("DELETE FROM gfxcodes WHERE expire<now()::abstime::int4");
+       pg_safe_exec("DELETE FROM gfxcodes WHERE expire<date_part('epoch', CURRENT_TIMESTAMP)::int");
        $r = pg_safe_exec("SELECT code FROM gfxcodes WHERE crc='" . $_GET["crc"] . "'");
        if ($o = pg_fetch_object($r)) {
                $code_gen = $o->code;
index 8090c9b35d5f1b7005b8892e9fee2da707723f2b..f1d3ee21bb0d82f531aa7369ef7ab00b110fd4db 100755 (executable)
@@ -184,7 +184,7 @@ function search_check(f) {
 // start applications list...
        $x = $xstart;
 
-       $oldest_ts = "(now()::abstime::int4-86400*$nb_days)";
+       $oldest_ts = "(date_part('epoch', CURRENT_TIMESTAMP)::int-86400*$nb_days)";
        if (acl(XWEBAXS_2) || acl(XWEBAXS_3)) {
                if ($force_all=="OK") {
                        $oldest_ts="0";
index 427610825d260bbe717eca1c7e809ca545b4f80c..bc563e8b56b20403fef0d6a03c694df5d8a288cc 100755 (executable)
@@ -313,7 +313,7 @@ switch ((int)$curr_step) {
                        //      $err .= "<li> You entered an invalid code from the picture.\n";
                        //} else { // CRC logic is fine, now check with the database temporary record...
                                //$ENABLE_COOKIE_TABLE = 1;
-                               //pg_safe_exec("DELETE FROM gfxcodes WHERE expire<now()::abstime::int4");
+                               //pg_safe_exec("DELETE FROM gfxcodes WHERE expire<date_part('epoch', CURRENT_TIMESTAMP)::int");
                                //$r = pg_safe_exec("SELECT expire FROM gfxcodes WHERE crc='" . $gfxcode_crc . "' AND code='" . strtoupper($gfxcode_val) . "'");
                                //if (pg_numrows($r)==0) {
                                //      $err .= "<li> You entered an invalid/expired code from the picture.\n";
index bbcfadbf37460fd4390dcc4e389baa9b3488e0d7..87a6e815b38b8d0914891a681bd51ba503f35026 100755 (executable)
@@ -64,7 +64,7 @@ if (pg_numrows($blah)>0) {
        }
        $crypt=$salt . md5($salt . $password);
        $res=pg_safe_exec("update users set password='" . $crypt . "', " .
-                    " last_updated=now()::abstime::int4, " .
+                    " last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int, " .
                     " last_updated_by='<b>Password Changed by SYSTEM</b> (" . date("YmdHis") . $user_id . ")' " .
                     " where " .
                     "  id='" . $user->id . "'");
index 09ea03beef6e172fc9458083eebd88103343661f..b5ce4a6466956d9243556f408bc9b7d6f928b1bf 100755 (executable)
@@ -293,7 +293,7 @@ switch ((int)$curr_step) {
                                $err .= "<li> You entered an invalid code from the picture.\n";
                        } else { // CRC logic is fine, now check with the database temporary record...
                                $ENABLE_COOKIE_TABLE = 1;
-                               pg_safe_exec("DELETE FROM gfxcodes WHERE expire<now()::abstime::int4");
+                               pg_safe_exec("DELETE FROM gfxcodes WHERE expire<date_part('epoch', CURRENT_TIMESTAMP)::int");
                                $r = pg_safe_exec("SELECT expire FROM gfxcodes WHERE crc='" . $gfxcode_crc . "' AND code='" . strtoupper($gfxcode_val) . "'");
                                if (pg_numrows($r)==0) {
                                        $err .= "<li> You entered an invalid/expired code from the picture.\n";
index e350423338ab058fff01a3cde88c2e7830b5bf8f..ddcfc3f5f4d814984a1467488d0f3a169c007c7b 100755 (executable)
@@ -76,7 +76,7 @@ if ($badargs) {
        if ($for_review!=1) { $for_review=0; }
 
        $query = "insert into noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) ";
-       $query = $query . "values ('$user_name','$email','$channel_name','$type','$never_reg','$for_review',(now()::abstime::int4+" . (int)$exp_in_sec . "),now()::abstime::int4,'$set_by','$reason')";
+       $query = $query . "values ('$user_name','$email','$channel_name','$type','$never_reg','$for_review',(date_part('epoch', CURRENT_TIMESTAMP)::int+" . (int)$exp_in_sec . "),date_part('epoch', CURRENT_TIMESTAMP)::int,'$set_by','$reason')";
 
        //echo "<b>DEBUG</b>(query): $query<br><br>\n";
 
index b11994e491f31e6e84bcb3225beeb32637c1eb93..0e3e158ee87c75ebc449621df7f93c5d5aa8e917 100755 (executable)
@@ -68,10 +68,10 @@ if ($badargs) {
 } else {
 
        $newflags = (int)$flags|0x0008; // Fraud tag.
-       $queryb = "update users set last_updated=now()::abstime::int4,last_updated_by='*** TAGGED AS FRAUD ***',flags='" . (int)$newflags . "' where id='" . (int)$userid . "'";
+       $queryb = "update users set last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='*** TAGGED AS FRAUD ***',flags='" . (int)$newflags . "' where id='" . (int)$userid . "'";
 
        $query = "insert into noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) ";
-       $query = $query . "values ('$user_name','$email','',4,1,0,0,now()::abstime::int4,'$set_by','$reason')";
+       $query = $query . "values ('$user_name','$email','',4,1,0,0,date_part('epoch', CURRENT_TIMESTAMP)::int,'$set_by','$reason')";
 
        //echo "<b>DEBUG</b>(query): $query<br><br>\n";
 
index fd09b1934158d2f002a660b109e81baea779bb34..57cc7177b6b50f3ac2792c87ce71f54441299567 100755 (executable)
@@ -75,7 +75,7 @@ if ($badargs) {
 
 } else {
        $query = "insert into noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) ";
-       $query = $query . "values ('" . $user_name . "','','',5,1,0,0,now()::abstime::int4,'$set_by','$reason')";
+       $query = $query . "values ('" . $user_name . "','','',5,1,0,0,date_part('epoch', CURRENT_TIMESTAMP)::int,'$set_by','$reason')";
 
        //echo "<b>DEBUG</b>(query): $query<br><br>\n";
 
index ccce1ac3166acbb0ff52b143ee509125802f1935..fb55ad20ec20a38aa7d0eab9df024f48ed598599 100755 (executable)
@@ -76,7 +76,7 @@ if ($badargs) {
 } else {
        if ($ignorecase == 1) { $dava = strtolower($user_name); $csens = "NO"; $user_name = "!" . strtolower($user_name); } else { $dava = $user_name; $csens = "YES"; }
        $query = "insert into noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) ";
-       $query = $query . "values ('" . $user_name . "','','',6,1,0,0,now()::abstime::int4,'$set_by','$reason')";
+       $query = $query . "values ('" . $user_name . "','','',6,1,0,0,date_part('epoch', CURRENT_TIMESTAMP)::int,'$set_by','$reason')";
 
        //echo "<b>DEBUG</b>(query): $query<br><br>\n";
 
index efb17b7514c5de0f5cffcfc79732d0dfabf19f78..91cbfe8a57b9c48e993197739f1d6541c4374792 100755 (executable)
@@ -76,7 +76,7 @@ if ($id<=0 || $id=="") {
                $uflags = (int)$uflags&~0x0008; // Untag the FRAUD.
 
                $query = "delete from noreg where id='" . (int)$id . "' and type=4";
-               $queryb = "update users set last_updated=now()::abstime::int4,last_updated_by='*** UNTAGGED FRAUD ***',flags='" . (int)$uflags . "' where id='" . (int)$u_id . "'";
+               $queryb = "update users set last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='*** UNTAGGED FRAUD ***',flags='" . (int)$uflags . "' where id='" . (int)$u_id . "'";
 
 
                pg_safe_exec($query);
index f19f97761ab5d121f88196e72af255f7354b3bbd..20be70c2eeee02976411e1d8765ee4f99fbc46e6 100755 (executable)
@@ -142,7 +142,7 @@ if ($crc == md5( $authcsc . $user_id . CRC_SALT_0015 )) {
 
                // write new note to database.
                if ($final_msg!="" && ($rcpt_id+0)>0) {
-                       pg_safe_exec("INSERT INTO notes (user_id,from_user_id,message,last_updated) VALUES ('" . $rcpt_id . "','" . $user_id . "','" . $final_msg . "',now()::abstime::int4)");
+                       pg_safe_exec("INSERT INTO notes (user_id,from_user_id,message,last_updated) VALUES ('" . $rcpt_id . "','" . $user_id . "','" . $final_msg . "',date_part('epoch', CURRENT_TIMESTAMP)::int)");
                        header("Location: " . urldecode($BACK_PAGE) . "\n\n");
                } else {
                        die("Internal Error !@#");
index 00932b6b0346eb0bf8015138c4225a56426bc619..b800f79010bd5a1faa97abccae7a8649faf1a89e 100755 (executable)
@@ -141,7 +141,7 @@ if ($crc == md5( $authcsc . $user_id . CRC_SALT_0012 )) {
                                pg_safe_exec("DELETE FROM notes WHERE message_id='" . $id . "'");
                        }
 
-                       pg_safe_exec("INSERT INTO notes (user_id,from_user_id,message,last_updated) VALUES ('" . $rcpt_id . "','" . $user_id . "','" . $final_msg . "',now()::abstime::int4)");
+                       pg_safe_exec("INSERT INTO notes (user_id,from_user_id,message,last_updated) VALUES ('" . $rcpt_id . "','" . $user_id . "','" . $final_msg . "',date_part('epoch', CURRENT_TIMESTAMP)::int)");
                        $notesl = pg_safe_exec("SELECT * FROM notes WHERE user_id='" . $user_id . "'");
                        $notes_left = pg_numrows($notesl);
                        if ($notes_left>0) { // any notes left ? go back to notes list
index 9db713e5905aa793e7258f9dd056dde8be19da07..01c3fa2a9aa249ca598a74b15fd6fa49a622df10 100755 (executable)
@@ -59,7 +59,7 @@ if ($mode=="write" && $crc == md5( $SECURE_ID . CRC_SALT_0011 )) {
                                                        $salt=$salt . $valid[rand(0,strlen($valid)-1)];
                                                }
                                                $crypt=$salt . md5($salt . $pass1);
-                                               $query = "UPDATE users SET last_updated=now()::abstime::int4,last_updated_by='** Password Change **',password='" . $crypt . "' WHERE id=" . ($user_id+0);
+                                               $query = "UPDATE users SET last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='** Password Change **',password='" . $crypt . "' WHERE id=" . ($user_id+0);
                                                pg_safe_exec($query);
 
                                                // send email
index 1ea4d53a2ee5bff74a08c158a3366ba79b1ee769..9f5bf0807a706060e066d0d154eefa2b3a3cdcc7 100755 (executable)
@@ -11,7 +11,7 @@ if ($_GET["crc"]==md5( CRC_SALT_0013 . $_GET["id"] . $_GET["ts"] )) {
                // do nothing, the record IS here ( heh ?! )
        } else {
                // insert a new record
-               pg_safe_exec("INSERT INTO users_lastseen (user_id, last_seen, last_updated, last_hostmask) VALUES ( " . (int)$_GET["id"] . ", now()::abstime::int4, now()::abstime::int4, '')");
+               pg_safe_exec("INSERT INTO users_lastseen (user_id, last_seen, last_updated, last_hostmask) VALUES ( " . (int)$_GET["id"] . ", date_part('epoch', CURRENT_TIMESTAMP)::int, date_part('epoch', CURRENT_TIMESTAMP)::int, '')");
        }
        header("Location: users.php?id=" . $_GET["id"] . "\n\n");
        die;
index 356f260f6b3b8727bcb146433808c1320a21f80a..4bc853f1c670c589f1a0c212554b30b0b8d33ff0 100755 (executable)
@@ -87,16 +87,16 @@ if ($channel_id=="" || $channel_id<=0 || $decision=="" || $pending_cts<=0) {
 
 
 
-       $quer2 = "UPDATE pending SET status=3,last_updated=now()::abstime::int4,decision_ts=now()::abstime::int4,decision='$decision2' WHERE channel_id='$c'";
+       $quer2 = "UPDATE pending SET status=3,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,decision_ts=date_part('epoch', CURRENT_TIMESTAMP)::int,decision='$decision2' WHERE channel_id='$c'";
        pg_safe_exec($quer2);
 
        $res = pg_safe_exec("SELECT manager_id FROM pending WHERE channel_id='$c'");
        $row = pg_fetch_object($res,0);
        $m_id = $row->manager_id;
 
-       pg_safe_exec("UPDATE channels SET registered_ts=now()::abstime::int4,last_updated=now()::abstime::int4,comment='' WHERE id='$c'");
-       pg_safe_exec("INSERT INTO levels (channel_id,user_id,access,added,added_by,last_modif,last_modif_by,last_updated) VALUES ($c,$m_id,500,now()::abstime::int4,'*** REGPROC ***',now()::abstime::int4,'*** REGPROC ***',now()::abstime::int4)");
-       pg_safe_exec("UPDATE users_lastseen SET last_updated=now()::abstime::int4,last_seen=now()::abstime::int4 WHERE user_id='$m_id'");
+       pg_safe_exec("UPDATE channels SET registered_ts=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,comment='' WHERE id='$c'");
+       pg_safe_exec("INSERT INTO levels (channel_id,user_id,access,added,added_by,last_modif,last_modif_by,last_updated) VALUES ($c,$m_id,500,date_part('epoch', CURRENT_TIMESTAMP)::int,'*** REGPROC ***',date_part('epoch', CURRENT_TIMESTAMP)::int,'*** REGPROC ***',date_part('epoch', CURRENT_TIMESTAMP)::int)");
+       pg_safe_exec("UPDATE users_lastseen SET last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_seen=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE user_id='$m_id'");
 
        $qqq = "UPDATE pending SET reviewed='Y',reviewed_by_id='$user_id' WHERE channel_id='$c'";
        pg_safe_exec($qqq);
@@ -107,7 +107,7 @@ if ($channel_id=="" || $channel_id<=0 || $decision=="" || $pending_cts<=0) {
        log_channel($c,7,"to $mgr_name");
        review_count_add($user_id);
 /*
-       $quer3 = "INSERT INTO mailq (user_id,channel_id,created_ts,template,var1,var2,var3,var4,var5) VALUES ($m_id,$c,now()::abstime::int4,3,'','','','','')";
+       $quer3 = "INSERT INTO mailq (user_id,channel_id,created_ts,template,var1,var2,var3,var4,var5) VALUES ($m_id,$c,date_part('epoch', CURRENT_TIMESTAMP)::int,3,'','','','','')";
        pg_safe_exec($quer3);
 */
 
index d8c5d512ce57da16174bc1d1fd57e2a0af83cf59..6e73b8acb385a87888f4144428fd60486ca558fd 100755 (executable)
@@ -216,7 +216,7 @@ if ($channel_id=="" || $channel_id<=0 || $decision=="" || $pending_cts<=0) {
        //$decision2 = "by <b>$user_name</b> (CService Admin)<br>" . $decision;
        $decision2 = "by CService Admin<br>" . $decision;
 
-       $quer2 = "UPDATE pending SET status='9',last_updated=now()::abstime::int4,decision_ts=now()::abstime::int4,decision='$decision2' WHERE channel_id='$c' AND (status='0' OR status='1' OR status='2' OR status='8') AND created_ts='$id'";
+       $quer2 = "UPDATE pending SET status='9',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,decision_ts=date_part('epoch', CURRENT_TIMESTAMP)::int,decision='$decision2' WHERE channel_id='$c' AND (status='0' OR status='1' OR status='2' OR status='8') AND created_ts='$id'";
        //echo "$quer2<br><br>\n";
        //$res = pg_safe_exec($quer2);
        pg_safe_exec($quer2);
@@ -227,7 +227,7 @@ if ($channel_id=="" || $channel_id<=0 || $decision=="" || $pending_cts<=0) {
        $uid = $tmp2->manager_id;
 
 /*
-       $quer3 = "INSERT INTO mailq (user_id,channel_id,created_ts,template,var1,var2,var3,var4,var5) VALUES ($uid,$c,now()::abstime::int4,2,'" . str_replace("<br>","\n",$decision) . "','','','','')";
+       $quer3 = "INSERT INTO mailq (user_id,channel_id,created_ts,template,var1,var2,var3,var4,var5) VALUES ($uid,$c,date_part('epoch', CURRENT_TIMESTAMP)::int,2,'" . str_replace("<br>","\n",$decision) . "','','','','')";
        pg_safe_exec($quer3);
 */
 
@@ -300,7 +300,7 @@ if ($channel_id=="" || $channel_id<=0 || $decision=="" || $pending_cts<=0) {
                if ($noapplicant==0) {
                        if ($put_channel==1) {
                                if ($NR_type==4) { $NR_type2 = 2;  $def_reason = "Abusive application (Fraud Usernames/Applicant) (" . str_replace("'","\\'",$c_name) . ")"; } else { $NR_type2 = $NR_type; }
-                               $quer3 = "INSERT INTO noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ('','','$c_name',$NR_type2,$NR_never_reg,$NR_for_review,(now()::abstime::int4+86400*$nb_days),now()::abstime::int4,'$set_by','$def_reason')";
+                               $quer3 = "INSERT INTO noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ('','','$c_name',$NR_type2,$NR_never_reg,$NR_for_review,(date_part('epoch', CURRENT_TIMESTAMP)::int+86400*$nb_days),date_part('epoch', CURRENT_TIMESTAMP)::int,'$set_by','$def_reason')";
                                //echo $quer3 . "<br><br>\n";
                                pg_safe_exec($quer3);
                        }
@@ -314,8 +314,8 @@ if ($channel_id=="" || $channel_id<=0 || $decision=="" || $pending_cts<=0) {
                                $p_flags = $prow4->flags;
                                if ($NR_type==4) { $p_flags = $p_flags|0x0008; // Fraud TAG
                                }
-                               $quer4b = "UPDATE users SET last_updated=now()::abstime::int4,last_updated_by='*** TAGGED AS FRAUD ***',flags='" . $p_flags . "' WHERE id='" . $p_uid . "'";
-                               $quer4 = "INSERT INTO noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ('$u_name','$def_email','',$NR_type,$NR_never_reg,$NR_for_review,(now()::abstime::int4+86400*$nb_days),now()::abstime::int4,'$set_by','$def_reason')";
+                               $quer4b = "UPDATE users SET last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='*** TAGGED AS FRAUD ***',flags='" . $p_flags . "' WHERE id='" . $p_uid . "'";
+                               $quer4 = "INSERT INTO noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ('$u_name','$def_email','',$NR_type,$NR_never_reg,$NR_for_review,(date_part('epoch', CURRENT_TIMESTAMP)::int+86400*$nb_days),date_part('epoch', CURRENT_TIMESTAMP)::int,'$set_by','$def_reason')";
                                //echo $quer4 . "<br><br>\n";
                                pg_safe_exec($quer4);
                                pg_safe_exec($quer4b);
@@ -345,7 +345,7 @@ if ($channel_id=="" || $channel_id<=0 || $decision=="" || $pending_cts<=0) {
                                        }
                                        if ($$suptype_t==1) { //Abuse (2)
                                                $nbdays = $$supdays_t+0;
-                                               $expire_at = "(now()::abstime::int4+86400*$nb_days)";
+                                               $expire_at = "(date_part('epoch', CURRENT_TIMESTAMP)::int+86400*$nb_days)";
                                                $NR_type = 2;
                                                $NR_neverreg = 0;
                                        } else if ($$suptype_t==2) { //Fraud Username (4)
@@ -368,9 +368,9 @@ if ($channel_id=="" || $channel_id<=0 || $decision=="" || $pending_cts<=0) {
                                        $p_flags = $prow->flags;
                                        if ($NR_type==4) { $p_flags = $p_flags|0x0008; // Fraud TAG
                                        }
-                                       $queryb = "UPDATE users SET last_updated=now()::abstime::int4,last_updated_by='*** TAGGED AS FRAUD ***',flags='" . $p_flags . "' WHERE id='" . $p_uid . "'";
+                                       $queryb = "UPDATE users SET last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='*** TAGGED AS FRAUD ***',flags='" . $p_flags . "' WHERE id='" . $p_uid . "'";
                                        $query  = "INSERT INTO NOREG (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ";
-                                       $query .= "('" . $$supname_t . "','$supporter_email','',$NR_type,$NR_neverreg,0,$expire_at,now()::abstime::int4,'$set_by','$reason')";
+                                       $query .= "('" . $$supname_t . "','$supporter_email','',$NR_type,$NR_neverreg,0,$expire_at,date_part('epoch', CURRENT_TIMESTAMP)::int,'$set_by','$reason')";
                                        pg_safe_exec($query);
                                        pg_safe_exec($queryb);
                                }
index bd4d5783842717c163b90d0aa37a3c8dba41a6b5..3f5b85cf06f500599c5e2791cf8902f5ceb7f346 100755 (executable)
@@ -39,7 +39,7 @@ echo "<b>CHANNEL SERVICE REGISTRATION PROCESS</b> - CANCELLATION OF YOUR APPLICA
 if (($crc==md5("$HTTP_USER_AGENT" . $ts . CRC_SALT_0013)) && $mode=="remove" && $c>0 && isset($c) && $id>0 && isset($id)) {
        // write decision.
        $datime=time();
-       $query = "UPDATE pending SET status=4,last_updated=now()::abstime::int4,decision='Cancelled by applicant',decision_ts=now()::abstime::int4 WHERE channel_id='$c' AND created_ts='$id'";
+       $query = "UPDATE pending SET status=4,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,decision='Cancelled by applicant',decision_ts=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE channel_id='$c' AND created_ts='$id'";
        pg_safe_exec($query);
        //echo htmlspecialchars($query); die;
        $applicant = $user_name . " (" . $user_id . ")";
index 15699bdbf47f5d17f59f202e61e24da8c853973b..0cda337e130a2fa64b5131c64dfab84634c598da 100755 (executable)
@@ -26,7 +26,7 @@ $cTheme = get_theme_info();
        $row = pg_fetch_object($res,0);
        $c_name = $row->name;
 
-       pg_safe_exec("UPDATE pending SET reg_acknowledged='Y',last_updated=now()::abstime::int4 WHERE status=3 AND channel_id='$c_id'");
+       pg_safe_exec("UPDATE pending SET reg_acknowledged='Y',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE status=3 AND channel_id='$c_id'");
 
        echo "You <b>ACKNOWLEDGED</b> registration for <b>$c_name</b><br>\n";
 
index 2db07e5008e4375164beedcfb313fe9141bdba37..216349bce478efc8543f6d348b742e23ec363db4 100755 (executable)
@@ -427,7 +427,7 @@ if ($check_invalid) {
 if (REGPROC_IDLECHECK) {
        $check_invalid=0;$s_index=0;
        for ($x=0;$x<REQUIRED_SUPPORTERS;$x++) {
-               //$res = pg_safe_exec("SELECT users.id AS id FROM users,users_lastseen WHERE users.id=users_lastseen.user_id AND users_lastseen.last_seen<(now()::abstime::int4-86400*21) AND lower(users.user_name)='" . strtolower($supporters[$x]) . "'");
+               //$res = pg_safe_exec("SELECT users.id AS id FROM users,users_lastseen WHERE users.id=users_lastseen.user_id AND users_lastseen.last_seen<(date_part('epoch', CURRENT_TIMESTAMP)::int-86400*21) AND lower(users.user_name)='" . strtolower($supporters[$x]) . "'");
                //if (pg_numrows($res)>0) {
                $res = pg_safe_exec("SELECT id FROM users WHERE lower(user_name)='" . strtolower($supporters[$x]) . "'");
                $row = pg_fetch_object($res,0);
@@ -624,16 +624,16 @@ if ($manager_id != $user_id) { die("Nice try! he he...."); }
 if ($reusechan) {
        $channel_id=$cc_id;
        if (REQUIRED_SUPPORTERS>0) {
-               $channels_q = "UPDATE channels SET name='$channel_nameF',mass_deop_pro=0,flood_pro=0,flags=0,limit_offset=3,limit_period=20,limit_grace=1,limit_max=0,userflags=0,url='',description='',keywords='',registered_ts=0,channel_ts=0,channel_mode='',comment='',last_updated=now()::abstime::int4 WHERE id='$channel_id'";
+               $channels_q = "UPDATE channels SET name='$channel_nameF',mass_deop_pro=0,flood_pro=0,flags=0,limit_offset=3,limit_period=20,limit_grace=1,limit_max=0,userflags=0,url='',description='',keywords='',registered_ts=0,channel_ts=0,channel_mode='',comment='',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE id='$channel_id'";
        } else {
-               $channels_q = "UPDATE channels SET name='$channel_nameF',mass_deop_pro=0,flood_pro=0,flags=0,limit_offset=3,limit_period=20,limit_grace=1,limit_max=0,userflags=0,url='',description='',keywords='',registered_ts=now()::abstime::int4,channel_ts=0,channel_mode='',comment='',last_updated=now()::abstime::int4 WHERE id='$channel_id'";
+               $channels_q = "UPDATE channels SET name='$channel_nameF',mass_deop_pro=0,flood_pro=0,flags=0,limit_offset=3,limit_period=20,limit_grace=1,limit_max=0,userflags=0,url='',description='',keywords='',registered_ts=date_part('epoch', CURRENT_TIMESTAMP)::int,channel_ts=0,channel_mode='',comment='',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE id='$channel_id'";
        }
        $lastreq = pg_safe_exec($channels_q);
 } else {
        if (REQUIRED_SUPPORTERS>0) {
-               $channels_q = "INSERT INTO channels (name,url,description,keywords,registered_ts,channel_ts,channel_mode,comment,last_updated,mass_deop_pro,flood_pro,flags,limit_offset,limit_period,limit_grace,limit_max,userflags) VALUES ('$channel_nameF','','','',0,0,'','',now()::abstime::int4,0,0,0,3,20,1,0,0)";
+               $channels_q = "INSERT INTO channels (name,url,description,keywords,registered_ts,channel_ts,channel_mode,comment,last_updated,mass_deop_pro,flood_pro,flags,limit_offset,limit_period,limit_grace,limit_max,userflags) VALUES ('$channel_nameF','','','',0,0,'','',date_part('epoch', CURRENT_TIMESTAMP)::int,0,0,0,3,20,1,0,0)";
        } else {
-               $channels_q = "INSERT INTO channels (name,url,description,keywords,registered_ts,channel_ts,channel_mode,comment,last_updated,mass_deop_pro,flood_pro,flags,limit_offset,limit_period,limit_grace,limit_max,userflags) VALUES ('$channel_nameF','','','',now()::abstime::int4,0,'','',now()::abstime::int4,0,0,0,3,20,1,0,0)";
+               $channels_q = "INSERT INTO channels (name,url,description,keywords,registered_ts,channel_ts,channel_mode,comment,last_updated,mass_deop_pro,flood_pro,flags,limit_offset,limit_period,limit_grace,limit_max,userflags) VALUES ('$channel_nameF','','','',date_part('epoch', CURRENT_TIMESTAMP)::int,0,'','',date_part('epoch', CURRENT_TIMESTAMP)::int,0,0,0,3,20,1,0,0)";
        }
        $lastreq = pg_safe_exec($channels_q);
        $res = pg_safe_exec("SELECT id FROM channels WHERE name='$channel_nameF'");
@@ -648,9 +648,9 @@ if (!$lastreq) {
 }
 
 if (REQUIRED_SUPPORTERS>0) {
-       $pending_q = "INSERT INTO pending (channel_id,manager_id,created_ts,decision_ts,decision,comments,description,last_updated,reg_acknowledged,check_start_ts) VALUES ($channel_id,$manager_id,now()::abstime::int4,0,'','','$description',now()::abstime::int4,'N',0)";
+       $pending_q = "INSERT INTO pending (channel_id,manager_id,created_ts,decision_ts,decision,comments,description,last_updated,reg_acknowledged,check_start_ts) VALUES ($channel_id,$manager_id,date_part('epoch', CURRENT_TIMESTAMP)::int,0,'','','$description',date_part('epoch', CURRENT_TIMESTAMP)::int,'N',0)";
 } else {
-       $pending_q = "INSERT INTO pending (channel_id,manager_id,created_ts,decision_ts,decision,comments,description,last_updated,reg_acknowledged,check_start_ts,status) VALUES ($channel_id,$manager_id,now()::abstime::int4,now()::abstime::int4,'** INSTANT REGISTRATION **','','$description',now()::abstime::int4,'Y',0,3)";
+       $pending_q = "INSERT INTO pending (channel_id,manager_id,created_ts,decision_ts,decision,comments,description,last_updated,reg_acknowledged,check_start_ts,status) VALUES ($channel_id,$manager_id,date_part('epoch', CURRENT_TIMESTAMP)::int,date_part('epoch', CURRENT_TIMESTAMP)::int,'** INSTANT REGISTRATION **','','$description',date_part('epoch', CURRENT_TIMESTAMP)::int,'Y',0,3)";
 }
 $lastreq = pg_safe_exec($pending_q);
 
@@ -669,16 +669,16 @@ if (REQUIRED_SUPPORTERS>0) {
                $res = pg_safe_exec("SELECT id FROM users WHERE lower(user_name)='" . strtolower($supporters[$x]) . "'");
                $row = pg_fetch_object($res,0);
                $sup_id = $row->id;
-               $supporters_q[$x] = "INSERT INTO supporters (channel_id,user_id,reason,last_updated) VALUES ($channel_id,$sup_id,'',now()::abstime::int4)";
+               $supporters_q[$x] = "INSERT INTO supporters (channel_id,user_id,reason,last_updated) VALUES ($channel_id,$sup_id,'',date_part('epoch', CURRENT_TIMESTAMP)::int)";
                pg_safe_exec($supporters_q[$x]);
        }
 } else {
        // INSTANT REGISTRATION :: Finish registering the channel properly (ie. add the manager)
-       pg_safe_exec("UPDATE channels SET registered_ts=now()::abstime::int4,last_updated=now()::abstime::int4,comment='' WHERE id='$channel_id'");
-       pg_safe_exec("INSERT INTO levels (channel_id,user_id,access,added,added_by,last_modif,last_modif_by,last_updated) VALUES ($channel_id,$manager_id,500,now()::abstime::int4,'*** REGPROC ***',now()::abstime::int4,'*** REGPROC ***',now()::abstime::int4)");
-       pg_safe_exec("UPDATE users_lastseen SET last_updated=now()::abstime::int4,last_seen=now()::abstime::int4 WHERE user_id='$manager_id'");
+       pg_safe_exec("UPDATE channels SET registered_ts=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,comment='' WHERE id='$channel_id'");
+       pg_safe_exec("INSERT INTO levels (channel_id,user_id,access,added,added_by,last_modif,last_modif_by,last_updated) VALUES ($channel_id,$manager_id,500,date_part('epoch', CURRENT_TIMESTAMP)::int,'*** REGPROC ***',date_part('epoch', CURRENT_TIMESTAMP)::int,'*** REGPROC ***',date_part('epoch', CURRENT_TIMESTAMP)::int)");
+       pg_safe_exec("UPDATE users_lastseen SET last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_seen=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE user_id='$manager_id'");
 
-//     pg_safe_exec("UPDATE pending SET status=3,last_updated=now()::abstime::int4,decision_ts=now()::abstime::int4,decision='** INSTANT REGISTRATION **' WHERE channel_id='$channel_id' AND created_ts=''");
+//     pg_safe_exec("UPDATE pending SET status=3,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,decision_ts=date_part('epoch', CURRENT_TIMESTAMP)::int,decision='** INSTANT REGISTRATION **' WHERE channel_id='$channel_id' AND created_ts=''");
 }
 
 pg_safe_exec("COMMIT WORK");
index 1ba720ab8ca6e3e64e0833627c0ad6a6922ecdc1..1120b8e5a716ace007c94888f0b74f051ece3442 100755 (executable)
@@ -81,9 +81,9 @@ if (($crc==md5("$HTTP_USER_AGENT" . $ts . CRC_SALT_0012)) && $mode=="validate" &
                        echo "</form>\n";
                } else {
                        $tts = time();
-                       $query = "UPDATE supporters SET support='N',reason='" . str_replace("\\&quot;","&quot;",str_replace("\n","<br>",htmlspecialchars($comments))) . "',last_updated=now()::abstime::int4 WHERE channel_id='$id' AND user_id='$user_id'";
+                       $query = "UPDATE supporters SET support='N',reason='" . str_replace("\\&quot;","&quot;",str_replace("\n","<br>",htmlspecialchars($comments))) . "',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE channel_id='$id' AND user_id='$user_id'";
                        pg_safe_exec($query);
-                       $quer2 = "UPDATE pending SET status='9',last_updated=now()::abstime::int4,decision_ts=now()::abstime::int4,decision='--AUTOMATIC (REGPROC)-- NON-SUPPORT' WHERE channel_id='$id' AND status='0'";
+                       $quer2 = "UPDATE pending SET status='9',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,decision_ts=date_part('epoch', CURRENT_TIMESTAMP)::int,decision='--AUTOMATIC (REGPROC)-- NON-SUPPORT' WHERE channel_id='$id' AND status='0'";
                        pg_safe_exec($quer2);
 
                        $res = pg_safe_exec("SELECT manager_id FROM pending WHERE channel_id='$id' AND status='9'");
@@ -99,9 +99,9 @@ if (($crc==md5("$HTTP_USER_AGENT" . $ts . CRC_SALT_0012)) && $mode=="validate" &
                        $def_reason = "-NON SUPPORT-";
                        $set_by = "* REGPROC";
 
-                       $quer3 = "INSERT INTO noreg (user_name,email,channel_name,type,expire_time,created_ts,set_by,reason) VALUES ('','','$c_name',1,(now()::abstime::int4+86400*3),now()::abstime::int4,'$set_by','$def_reason')";
+                       $quer3 = "INSERT INTO noreg (user_name,email,channel_name,type,expire_time,created_ts,set_by,reason) VALUES ('','','$c_name',1,(date_part('epoch', CURRENT_TIMESTAMP)::int+86400*3),date_part('epoch', CURRENT_TIMESTAMP)::int,'$set_by','$def_reason')";
                        pg_safe_exec($quer3);
-                       $quer4 = "INSERT INTO noreg (user_name,email,channel_name,type,expire_time,created_ts,set_by,reason) VALUES ('$u_name','$def_email','',1,(now()::abstime::int4+86400*3),now()::abstime::int4,'$set_by','$def_reason')";
+                       $quer4 = "INSERT INTO noreg (user_name,email,channel_name,type,expire_time,created_ts,set_by,reason) VALUES ('$u_name','$def_email','',1,(date_part('epoch', CURRENT_TIMESTAMP)::int+86400*3),date_part('epoch', CURRENT_TIMESTAMP)::int,'$set_by','$def_reason')";
                        pg_safe_exec($quer4);
 
 
index a41a01f7cfc354635104e7db776578870f7aa452..cfc37639e40344d6779b7a68a82956d43b9f70bd 100755 (executable)
@@ -35,7 +35,7 @@ if ($do_it==0) {
        die;
 
 }
-$q = "UPDATE pending SET reviewed='Y',reviewed_by_id='$user_id',last_updated=now()::abstime::int4 WHERE channel_id='$channel_id' AND created_ts='$created_ts'";
+$q = "UPDATE pending SET reviewed='Y',reviewed_by_id='$user_id',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE channel_id='$channel_id' AND created_ts='$created_ts'";
 pg_safe_exec($q);
 review_count_add($user_id);
 log_channel($channel_id,17,"Reviewed Application");
index e45fd7dfc9cd0de6060857c33bba2f2cf6c3c5ab..e7166dbb5bd3e3b0a1495516089c91dbd038f64e 100755 (executable)
@@ -54,7 +54,7 @@ $cTheme = get_theme_info();
                        die;
                }
                $default_gopage = "users.php?id=".$user_id;
-               $req00 = "SELECT channels.id,channels.name,pending.created_ts,pending.status,pending.decision_ts,pending.manager_id FROM pending,users,channels,supporters WHERE pending.channel_id=channels.id AND supporters.user_id=users.id AND channels.id=supporters.channel_id AND pending.channel_id=supporters.channel_id AND supporters.user_id='$user_id' AND channels.registered_ts=0 AND pending.status<4 AND ( pending.decision_ts=0 OR pending.decision_ts>now()::abstime::int4-(86400*5) ) AND (supporters.support IS NULL OR supporters.support='?') ORDER BY pending.created_ts DESC";
+               $req00 = "SELECT channels.id,channels.name,pending.created_ts,pending.status,pending.decision_ts,pending.manager_id FROM pending,users,channels,supporters WHERE pending.channel_id=channels.id AND supporters.user_id=users.id AND channels.id=supporters.channel_id AND pending.channel_id=supporters.channel_id AND supporters.user_id='$user_id' AND channels.registered_ts=0 AND pending.status<4 AND ( pending.decision_ts=0 OR pending.decision_ts>date_part('epoch', CURRENT_TIMESTAMP)::int-(86400*5) ) AND (supporters.support IS NULL OR supporters.support='?') ORDER BY pending.created_ts DESC";
                $levels = pg_safe_exec($req00);
                if (pg_numrows($levels)>0) { // user has some channels to support.
                        if (pg_numrows($levels)>1) { $c_addy = "s"; } else { $c_addy = ""; }
@@ -73,7 +73,7 @@ $cTheme = get_theme_info();
                        echo "</body></html>\n\n";
                        die;
                } else { // user doesnt need to confirm any support on any channel
-                       $req00 = "SELECT channels.id,channels.name,pending.created_ts,pending.status,pending.decision_ts FROM pending,users,channels WHERE pending.channel_id=channels.id AND pending.manager_id=users.id AND pending.manager_id='$user_id' AND channels.registered_ts=0 AND pending.status<9 AND pending.status!=4 AND pending.reg_acknowledged='N' AND (pending.decision_ts=0 OR pending.decision_ts>now()::abstime::int4-86400*5) ORDER BY pending.created_ts DESC";
+                       $req00 = "SELECT channels.id,channels.name,pending.created_ts,pending.status,pending.decision_ts FROM pending,users,channels WHERE pending.channel_id=channels.id AND pending.manager_id=users.id AND pending.manager_id='$user_id' AND channels.registered_ts=0 AND pending.status<9 AND pending.status!=4 AND pending.reg_acknowledged='N' AND (pending.decision_ts=0 OR pending.decision_ts>date_part('epoch', CURRENT_TIMESTAMP)::int-86400*5) ORDER BY pending.created_ts DESC";
                        $levels = pg_safe_exec($req00);
                        if (pg_numrows($levels)>0) { // user has one or more pending applications
                                        header("Pragma: no-cache");
index 86ff2bc135f24064360a96ea85a1c71f8e3cad1c..481c5742d858c32ad09e98c0f514e2a7ae2463f2 100755 (executable)
@@ -191,7 +191,7 @@ if (pg_numrows($iit)>0 || ((int)$row->flags & 0x0008)) {
                }
                $set_by=$d_username;
                $fraudchg = 1;
-               pg_safe_exec("INSERT INTO noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ('$u_username','$u_email','',4,1,0,0,now()::abstime::int4,'$set_by','$fraudreason')");
+               pg_safe_exec("INSERT INTO noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ('$u_username','$u_email','',4,1,0,0,date_part('epoch', CURRENT_TIMESTAMP)::int,'$set_by','$fraudreason')");
                //set_flag(1,$row->flags,0x0008,"on");
                $new_flags = (int)$new_flags|0x0008;
                $fchanged=1;
@@ -215,7 +215,7 @@ if (pg_numrows($iiunr)==0 && $unreg == 2) { // switch to 'YES'
        }
        $unrchg = 1;
        $set_by=$d_username;
-       pg_safe_exec("INSERT INTO noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ('$u_username','','',2,1,0,0,now()::abstime::int4,'$set_by','$unregreason')");
+       pg_safe_exec("INSERT INTO noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ('$u_username','','',2,1,0,0,date_part('epoch', CURRENT_TIMESTAMP)::int,'$set_by','$unregreason')");
 }
 
 $enrchg = 0;
@@ -235,7 +235,7 @@ if (pg_numrows($iienr)==0 && $enreg == 2) { // switch to 'YES'
        }
        $enrchg = 1;
        $set_by=$d_username;
-       pg_safe_exec("INSERT INTO noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ('','$u_email','',2,1,0,0,now()::abstime::int4,'$set_by','$enregreason')");
+       pg_safe_exec("INSERT INTO noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ('','$u_email','',2,1,0,0,date_part('epoch', CURRENT_TIMESTAMP)::int,'$set_by','$enregreason')");
 }
 
 //echo $new_flags." / " . $row->flags . " / $noteacc <br>\n";
@@ -400,7 +400,7 @@ if ($chg_formpost>0 && $chg_formpost<3) {
        $query .= "post_forms=" . $new_pforms . ", ";
 }
 
-$query .= "last_updated=now()::abstime::int4, ";
+$query .= "last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int, ";
 if ($fraudt==2) {
        $query .= "last_updated_by='*** TAGGED AS FRAUD ***' WHERE id=$id";
 } else {
index bc570fc88850b30308ebf52a637e22dc89817239..11a812ef67cdfd523ccfafd4a4a7dffda6373a73 100755 (executable)
@@ -62,7 +62,7 @@ if ($mode=="write" && $crc == md5( $SECURE_ID . CRC_SALT_0017 )) {
                                                        $salt=$salt . $valid[rand(0,strlen($valid)-1)];
                                                }
                                                $crypt=$salt . md5($salt . $pass1);
-                                               $query = "UPDATE users SET last_updated=now()::abstime::int4,last_updated_by='** Password Secured **',password='" . $crypt . "' WHERE id='" . $user_id . "'";
+                                               $query = "UPDATE users SET last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='** Password Secured **',password='" . $crypt . "' WHERE id='" . $user_id . "'";
                                                pg_safe_exec($query);
 
                                                // send email
index b5e9b6d8fbb568314a775be4e124f75f258510c9..ff8251b89a80fe2db3bcee814b8b15d3613575b4 100755 (executable)
                        $tz_countrycode = $tz_temp[0];
                        $tz_name = $tz_temp[1];
                        if ($tz_name!="") {
-                               $query = "INSERT INTO timezones (tz_name,tz_countrycode,tz_acronym,deleted,last_updated) VALUES ('$tz_name','$tz_countrycode','',0,now()::abstime::int4)";
+                               $query = "INSERT INTO timezones (tz_name,tz_countrycode,tz_acronym,deleted,last_updated) VALUES ('$tz_name','$tz_countrycode','',0,date_part('epoch', CURRENT_TIMESTAMP)::int)";
                                pg_safe_exec($query);
                        }
                }
index dfc81fff35182fe9e6d5e8ed788c04226dd44ee0..7aa17009d75e9c514d52c1a2ae56e9ed41480dd2 100755 (executable)
@@ -69,7 +69,7 @@ if ($user_id==0 || $auth=="") {
             $flags = $oldflags;
             $flags = $oldflags|TOTP_USR_FLAG;
             //echo $oldflags.'->'.$flags;
-            pg_safe_exec("UPDATE users SET flags='".$flags."',last_updated=now()::abstime::int4 WHERE id='".($user_id+0)."'");
+            pg_safe_exec("UPDATE users SET flags='".$flags."',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE id='".($user_id+0)."'");
             log_user($user_id, 13, "TOTP enabled");
             $ENABLE_COOKIE_TABLE = 0;
             $temp_totp_hash=gen_totp_cookie($totp_key);
index e910ede448b54570e175347d7626de12b1468cd3..0dba55d6c954f1498453fbf7680675a68051590f 100644 (file)
@@ -43,7 +43,7 @@ function not_valid_va($user_id)
                                        echo '<a href ="users.php">Click here</a> to go back to your info page.';
                                        die;
                                } else {
-                                 $sql = sprintf("UPDATE users SET maxlogins=%d, last_updated=now()::abstime::int4, last_updated_by='Web Interface (%s (%d))' WHERE id=%d", $user_max_login, $o->user_name, $o->id, $o->id);
+                                 $sql = sprintf("UPDATE users SET maxlogins=%d, last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int, last_updated_by='Web Interface (%s (%d))' WHERE id=%d", $user_max_login, $o->user_name, $o->id, $o->id);
                                  pg_safe_exec($sql);
 
                                        echo "You've succesfully set maxlogins to <strong>" . $user_max_login . "</strong> !<br>";
index 736d2dbe419c9b1f8f30b6557dc15142efe655b5..b32f51f78c2c1f9dfeecc1643648bef49a35b2aa 100755 (executable)
@@ -21,7 +21,7 @@ if ($user_id > 0) {
                                        {
                                        $oldflags = $o->flags; $flags = $oldflags;
                                        $flags = $oldflags&~TOTP_USR_FLAG;
-                                       pg_safe_exec("UPDATE users SET flags='".$flags."',last_updated=now()::abstime::int4 WHERE id='".(int)$totp_id."'");
+                                       pg_safe_exec("UPDATE users SET flags='".$flags."',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE id='".(int)$totp_id."'");
                                        $oldtotp=$o->totp_key;
                                        // log_user($totp_id,14,"TOTP disabled for %U. Old TOTP key: ".$oldtotp." (%I)");
                                        log_user($totp_id,14,"TOTP disabled for %U. (%I)");
index a9eb8418f19c8bc6632c0e258f21134ec4c76e3d..14b4cd3010b29ee785a8c75e20dbd90755d12527 100755 (executable)
@@ -117,9 +117,9 @@ for ($x=0;$x<$gcount;$x++) {
                if ($days_noreg_with_del < 1) { //forever
                        $nr_q .= "1,0,0,";
                } else {
-                       $nr_q .= "0,0,now()::abstime::int4+(86400*" . $days_noreg_with_del . "),";
+                       $nr_q .= "0,0,date_part('epoch', CURRENT_TIMESTAMP)::int+(86400*" . $days_noreg_with_del . "),";
                }
-               $nr_q .= "now()::abstime::int4,'" . $adm_user . " (Toaster)','" . $dreason_ok . "')";
+               $nr_q .= "date_part('epoch', CURRENT_TIMESTAMP)::int,'" . $adm_user . " (Toaster)','" . $dreason_ok . "')";
                if (!$debug_me) { // take the action
                        for ($z=0;$z<count($del_q);$z++) {
                                @pg_safe_exec($del_q[$z]);
@@ -148,13 +148,13 @@ for ($x=0;$x<$gcount;$x++) {
                if (pg_numrows($bla)>0) { $notalready=0; }
                if ($$fraud==1 && $notalready) {
                        if ($debug_me) { echo $$fraud; }
-                       $daq = "INSERT INTO noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ('" . $username[$x] . "','" . $email[$x] . "','',4,1,0,0,now()::abstime::int4,'" . $adm_user . "','" . $freason_ok . "')";
+                       $daq = "INSERT INTO noreg (user_name,email,channel_name,type,never_reg,for_review,expire_time,created_ts,set_by,reason) VALUES ('" . $username[$x] . "','" . $email[$x] . "','',4,1,0,0,date_part('epoch', CURRENT_TIMESTAMP)::int,'" . $adm_user . "','" . $freason_ok . "')";
                        $prereq = "SELECT flags FROM users WHERE id='" . $id[$x] . "'";
                        $preres = pg_safe_exec($prereq);
                        $prerow = pg_fetch_object($preres,0);
                        $uflags = $prerow->flags;
                        $newflags = (int)$uflags|0x0008; // Fraud TAG.
-                       $da2q = "UPDATE users SET last_updated=now()::abstime::int4,last_updated_by='*** TAGGED AS FRAUD ***',flags='" . $newflags . "' WHERE id='" . $id[$x] . "'";
+                       $da2q = "UPDATE users SET last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='*** TAGGED AS FRAUD ***',flags='" . $newflags . "' WHERE id='" . $id[$x] . "'";
                        if (!$debug_me) { // take the action.
                                pg_safe_exec($daq);
                                pg_safe_exec($da2q);
@@ -181,7 +181,7 @@ for ($x=0;$x<$gcount;$x++) {
                                if ($debug_me) { echo "1"; }
                                if ($send_mail) { $mmsg .= $t_mmsg; }
                                $new_u_flags = (int)$ols->flags|0x0001; // global Suspension tag
-                               $query = "UPDATE users SET last_updated=now()::abstime::int4,last_updated_by='Suspended by Toaster',flags='" . $new_u_flags . "' WHERE id='" . $id[$x] . "'";
+                               $query = "UPDATE users SET last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated_by='Suspended by Toaster',flags='" . $new_u_flags . "' WHERE id='" . $id[$x] . "'";
                                if (!$debug_me) { // take action
                                        unset($raction);
                                        $raction = pg_safe_exec($query);
index c0a4257ca49608bcf4055a73aaba0a35decf702b..7a00de6aed5695ecc2d22cf9ef0e36ca766dc0f2 100755 (executable)
@@ -780,7 +780,7 @@ if ($admin > 0) {
     }
 
     $ENABLE_COOKIE_TABLE = 1;
-    $res = pg_safe_exec("SELECT * FROM webcookies WHERE user_id='" . $user->id . "' AND expire>=now()::abstime::int4");
+    $res = pg_safe_exec("SELECT * FROM webcookies WHERE user_id='" . $user->id . "' AND expire>=date_part('epoch', CURRENT_TIMESTAMP)::int");
     if (pg_numrows($res) > 0 && $user_id != $user->id) {
         echo "<tr><td colspan=2><font color=#" . $cTheme->main_yes . "><b>User is currently logged in on the website</b></font></td></tr>\n";
     }
@@ -1177,7 +1177,7 @@ if ($admin >= 750 || $nrw_lvl > 0) {
 
     /* start proc */
     $type = array(0 => "Incoming", 1 => "Pending (Traffic Check)", 2 => "Pending (Notification)", 3 => "Accepted", 8 => "Ready for review");
-    $req00 = "SELECT channels.id,channels.name,pending.created_ts,pending.status,pending.decision_ts FROM pending,users,channels WHERE pending.channel_id=channels.id AND pending.manager_id=users.id AND pending.manager_id='$id' AND channels.registered_ts=0 AND (pending.status<4 OR pending.status=8) AND (pending.decision_ts=0 OR pending.decision_ts>now()::abstime::int4-86400*5) ORDER BY pending.created_ts DESC";
+    $req00 = "SELECT channels.id,channels.name,pending.created_ts,pending.status,pending.decision_ts FROM pending,users,channels WHERE pending.channel_id=channels.id AND pending.manager_id=users.id AND pending.manager_id='$id' AND channels.registered_ts=0 AND (pending.status<4 OR pending.status=8) AND (pending.decision_ts=0 OR pending.decision_ts>date_part('epoch', CURRENT_TIMESTAMP)::int-86400*5) ORDER BY pending.created_ts DESC";
     $levels = pg_safe_exec($req00);
     echo ("<br>
         <TABLE WIDTH=100% border=1 cellspacing=1 cellpadding=2 BGCOLOR=#" . $cTheme->table_bgcolor . ">
@@ -1211,7 +1211,7 @@ if ($admin >= 750 || $nrw_lvl > 0) {
 
     /* start proc */
     $type = array(0 => "Incoming", 1 => "Pending (Traffic Check)", 2 => "Pending (Notification)", 3 => "Accepted", 8 => "Ready for review");
-    $req00 = "SELECT channels.id,channels.name,pending.created_ts,pending.status,pending.decision_ts,pending.manager_id,supporters.support FROM pending,users,channels,supporters WHERE pending.channel_id=channels.id AND supporters.user_id=users.id AND channels.id=supporters.channel_id AND pending.channel_id=supporters.channel_id AND supporters.user_id='$id' AND channels.registered_ts=0 AND (pending.status<4 OR pending.status=8) AND (pending.decision_ts=0 OR pending.decision_ts>now()::abstime::int4-86400*5) ORDER BY pending.created_ts DESC";
+    $req00 = "SELECT channels.id,channels.name,pending.created_ts,pending.status,pending.decision_ts,pending.manager_id,supporters.support FROM pending,users,channels,supporters WHERE pending.channel_id=channels.id AND supporters.user_id=users.id AND channels.id=supporters.channel_id AND pending.channel_id=supporters.channel_id AND supporters.user_id='$id' AND channels.registered_ts=0 AND (pending.status<4 OR pending.status=8) AND (pending.decision_ts=0 OR pending.decision_ts>date_part('epoch', CURRENT_TIMESTAMP)::int-86400*5) ORDER BY pending.created_ts DESC";
     $levels = pg_safe_exec($req00);
     echo ("<br>
         <TABLE WIDTH=100% border=1 cellspacing=1 cellpadding=2 BGCOLOR=#" . $cTheme->table_bgcolor . ">
index d0c2f8297cfe5baa3ca3210981eece13b3e3ce1a..09a5f883a1ff77ecd0f495b073bc6d863a58eb06 100755 (executable)
@@ -82,7 +82,7 @@ if(!$totp_key)
                  ip_check($user_name,1);
                //      totp_ip_add( cl_ip(),  $user_name);
                
-                       //pg_exec("INSERT INTO ips (ipnum,user_name,expiration,hit_counts,set_on) VALUES ('" . cl_ip() . "','" . $user_name . "',0,1,now()::abstime::int4)");
+                       //pg_exec("INSERT INTO ips (ipnum,user_name,expiration,hit_counts,set_on) VALUES ('" . cl_ip() . "','" . $user_name . "',0,1,date_part('epoch', CURRENT_TIMESTAMP)::int)");
                }       
        }
 
index a4dc41264301734d6fbdb14dbd1027f460a8e195..88d7a7900eb42423d14fb2b3ff517f18d35bb150 100755 (executable)
                echo "<br><br>\n";
 
                $nb_days_history = 30;
-               $tmpr = pg_safe_exec("SELECT COUNT(event) AS count FROM channellog WHERE channelid=" . ($channel_id+0) . " AND event=15 AND ts>=(now()::abstime::int4-(86400*" . $nb_days_history . "))");
+               $tmpr = pg_safe_exec("SELECT COUNT(event) AS count FROM channellog WHERE channelid=" . ($channel_id+0) . " AND event=15 AND ts>=(date_part('epoch', CURRENT_TIMESTAMP)::int-(86400*" . $nb_days_history . "))");
                $tmpo = pg_fetch_object($tmpr,0);
                $tc = $tmpo->count;
                if ($tc>=1) { $tc--; } // dont count the "current registration".
index a9c5550e6260dce0204f30962ea6de6c3da17437..c9b1dafa9c2e5dbdbacf83111f312453e77862a7 100755 (executable)
@@ -183,15 +183,15 @@ if ($toc == 0) { // temporary
 \r
        //echo $the_email; die;\r
        $s_duration = 86400*372; // max duration : 372 days.\r
-       pg_safe_exec("UPDATE levels SET last_modif=now()::abstime::int4,last_updated=now()::abstime::int4,last_modif_by='*** MANAGER CHANGE ***',suspend_expires=(now()::abstime::int4+" . $s_duration . "),suspend_by='*** MANAGER CHANGE ***',suspend_level=1 WHERE access=500 AND user_id='$pending->manager_id' AND channel_id='$pending->channel_id'");\r
-       pg_safe_exec("UPDATE levels SET access=500,last_modif=now()::abstime::int4,last_updated=now()::abstime::int4,last_modif_by='*** MANAGER CHANGE ***' WHERE access=499 AND user_id='$pending->new_manager_id' AND channel_id='$pending->channel_id'");\r
-       $chan_update = "UPDATE channels SET description='Manager Change has been successfully completed.',url='',last_updated=now()::abstime::int4,flags='$new_flags',comment='" . str_replace("\n","\\n",$new_comment) . "' WHERE id='$pending->channel_id'";\r
+       pg_safe_exec("UPDATE levels SET last_modif=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_modif_by='*** MANAGER CHANGE ***',suspend_expires=(date_part('epoch', CURRENT_TIMESTAMP)::int+" . $s_duration . "),suspend_by='*** MANAGER CHANGE ***',suspend_level=1 WHERE access=500 AND user_id='$pending->manager_id' AND channel_id='$pending->channel_id'");\r
+       pg_safe_exec("UPDATE levels SET access=500,last_modif=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_modif_by='*** MANAGER CHANGE ***' WHERE access=499 AND user_id='$pending->new_manager_id' AND channel_id='$pending->channel_id'");\r
+       $chan_update = "UPDATE channels SET description='Manager Change has been successfully completed.',url='',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,flags='$new_flags',comment='" . str_replace("\n","\\n",$new_comment) . "' WHERE id='$pending->channel_id'";\r
        pg_safe_exec($chan_update);\r
 \r
        custom_mail($usr1->email,"[" . $channel->name . "] Manager Change (Accepted)",$the_email,"From: " . $x_at_email . "\nCc: " . $usr2->email . "\nReply-to: Dont.Reply@Thank.You\nX-Mailer: " . NETWORK_NAME . " Channel Service\n\n");\r
 \r
 \r
-       pg_safe_exec("UPDATE pending_mgrchange SET opt_duration=(now()::abstime::int4+" . ($pending->opt_duration+0) . "),confirmed='3' WHERE id='$id'");\r
+       pg_safe_exec("UPDATE pending_mgrchange SET opt_duration=(date_part('epoch', CURRENT_TIMESTAMP)::int+" . ($pending->opt_duration+0) . "),confirmed='3' WHERE id='$id'");\r
 \r
        log_channel($pending->channel_id,12,"Temporary Change Accepted. From " . $usr1->user_name . " (" . $usr1->id . ") to " . $usr2->user_name . " (" . $usr2->id . ").");\r
 \r
@@ -255,9 +255,9 @@ if ($toc == 0) { // temporary
 \r
        //echo $the_email; die;\r
 \r
-       pg_safe_exec("UPDATE levels SET access=499,last_modif=now()::abstime::int4,last_updated=now()::abstime::int4,last_modif_by='*** MANAGER CHANGE ***' WHERE access=500 AND user_id='$pending->manager_id' AND channel_id='$pending->channel_id'");\r
-       pg_safe_exec("UPDATE levels SET access=500,last_modif=now()::abstime::int4,last_updated=now()::abstime::int4,last_modif_by='*** MANAGER CHANGE ***' WHERE access=499 AND user_id='$pending->new_manager_id' AND channel_id='$pending->channel_id'");\r
-       $chan_update = "UPDATE channels SET description='Manager Change has been successfully completed.',url='',last_updated=now()::abstime::int4,flags='$new_flags',comment='" . str_replace("\n","\\n",$new_comment) . "' WHERE id='$pending->channel_id'";\r
+       pg_safe_exec("UPDATE levels SET access=499,last_modif=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_modif_by='*** MANAGER CHANGE ***' WHERE access=500 AND user_id='$pending->manager_id' AND channel_id='$pending->channel_id'");\r
+       pg_safe_exec("UPDATE levels SET access=500,last_modif=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_modif_by='*** MANAGER CHANGE ***' WHERE access=499 AND user_id='$pending->new_manager_id' AND channel_id='$pending->channel_id'");\r
+       $chan_update = "UPDATE channels SET description='Manager Change has been successfully completed.',url='',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,flags='$new_flags',comment='" . str_replace("\n","\\n",$new_comment) . "' WHERE id='$pending->channel_id'";\r
        pg_safe_exec($chan_update);\r
 \r
        custom_mail($usr1->email,"[" . $channel->name . "] Manager Change (Accepted)",$the_email,"From: " . $x_at_email . "\nCc: " . $usr2->email . "\nReply-to: Dont.Reply@Thank.You\nX-Mailer: " . NETWORK_NAME . " Channel Service\n\n");\r
index 9e1337e46dd1dfb416d093929394e436f1e7a06a..ec319fffb838519526ac84125a636950a4582734 100755 (executable)
@@ -148,9 +148,9 @@ $q_idx = 0;
 \r
        //echo $the_email; die;\r
 \r
-       pg_safe_exec("UPDATE levels SET access=499,last_modif=now()::abstime::int4,last_updated=now()::abstime::int4,suspend_expires=0,suspend_level=NULL,suspend_by='',last_modif_by='*** MANAGER CHANGE ***' WHERE access=500 AND user_id='$pending->manager_id' AND channel_id='$pending->channel_id'");\r
-       pg_safe_exec("UPDATE levels SET last_modif=now()::abstime::int4,last_updated=now()::abstime::int4,last_modif_by='*** MANAGER CHANGE ***' WHERE access=500 AND user_id='$pending->new_manager_id' AND channel_id='$pending->channel_id'");\r
-       $chan_update = "UPDATE channels SET last_updated=now()::abstime::int4,comment='" . str_replace("\n","\\n",$new_comment) . "' WHERE id='$pending->channel_id'";\r
+       pg_safe_exec("UPDATE levels SET access=499,last_modif=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,suspend_expires=0,suspend_level=NULL,suspend_by='',last_modif_by='*** MANAGER CHANGE ***' WHERE access=500 AND user_id='$pending->manager_id' AND channel_id='$pending->channel_id'");\r
+       pg_safe_exec("UPDATE levels SET last_modif=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_modif_by='*** MANAGER CHANGE ***' WHERE access=500 AND user_id='$pending->new_manager_id' AND channel_id='$pending->channel_id'");\r
+       $chan_update = "UPDATE channels SET last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,comment='" . str_replace("\n","\\n",$new_comment) . "' WHERE id='$pending->channel_id'";\r
        pg_safe_exec($chan_update);\r
 \r
        custom_mail($usr1->email,"[" . $channel->name . "] Manager Change (Turned Permanent)",$the_email,"From: " . $x_at_email . "\nCc: " . $usr2->email . "\nReply-to: Dont.Reply@Thank.You\nX-Mailer: " . NETWORK_NAME . " Channel Service\n\n");\r
index fc3d1dd35f813265c9bcbba6c0fbcf17e15697f6..adc938e4fd722089e683a32c10520ca609d6db98 100755 (executable)
@@ -146,9 +146,9 @@ $q_idx = 0;
 \r
        //echo $the_email; die;\r
 \r
-       pg_safe_exec("UPDATE levels SET last_modif=now()::abstime::int4,last_updated=now()::abstime::int4,suspend_expires=0,suspend_level=NULL,suspend_by='',last_modif_by='*** MANAGER CHANGE ***' WHERE access=500 AND user_id='$pending->manager_id' AND channel_id='$pending->channel_id'");\r
-       pg_safe_exec("UPDATE levels SET access=499,last_modif=now()::abstime::int4,last_updated=now()::abstime::int4,last_modif_by='*** MANAGER CHANGE ***' WHERE access=500 AND user_id='$pending->new_manager_id' AND channel_id='$pending->channel_id'");\r
-       $chan_update = "UPDATE channels SET last_updated=now()::abstime::int4,flags='" . $new_flags . "',comment='" . str_replace("\n","\\n",$new_comment) . "' WHERE id='$pending->channel_id'";\r
+       pg_safe_exec("UPDATE levels SET last_modif=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,suspend_expires=0,suspend_level=NULL,suspend_by='',last_modif_by='*** MANAGER CHANGE ***' WHERE access=500 AND user_id='$pending->manager_id' AND channel_id='$pending->channel_id'");\r
+       pg_safe_exec("UPDATE levels SET access=499,last_modif=date_part('epoch', CURRENT_TIMESTAMP)::int,last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,last_modif_by='*** MANAGER CHANGE ***' WHERE access=500 AND user_id='$pending->new_manager_id' AND channel_id='$pending->channel_id'");\r
+       $chan_update = "UPDATE channels SET last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int,flags='" . $new_flags . "',comment='" . str_replace("\n","\\n",$new_comment) . "' WHERE id='$pending->channel_id'";\r
        pg_safe_exec($chan_update);\r
 \r
        custom_mail($usr1->email,"[" . $channel->name . "] Manager Change (Reverted)",$the_email,"From: " . $x_at_email . "\nCc: " . $usr2->email . "\nReply-to: Dont.Reply@Thank.You\nX-Mailer: " . NETWORK_NAME . " Channel Service\n\n");\r
index b93986a21536a7736b2abc7679a41cf02f48511c..989a4ffdb49ffd0f9b6fbcb081b56fa383206b7c 100644 (file)
@@ -1168,7 +1168,7 @@ function newu_ipcheck($mode) { // return false on locked.
             $ENABLE_COOKIE_TABLE = 0;
             return(1);
         } else {
-            pg_safe_exec("INSERT INTO newu_ipcheck VALUES (now()::abstime::int4,'" . cl_ip() . "',(now()::abstime::int4+86400))");
+            pg_safe_exec("INSERT INTO newu_ipcheck VALUES (date_part('epoch', CURRENT_TIMESTAMP)::int,'" . cl_ip() . "',(date_part('epoch', CURRENT_TIMESTAMP)::int+86400))");
             $ENABLE_COOKIE_TABLE = 0;
             return(1);
         }
@@ -1179,7 +1179,7 @@ function newu_ipcheck($mode) { // return false on locked.
                 $ENABLE_COOKIE_TABLE=0;
                 return(1);
             }
-            pg_safe_exec("UPDATE newu_ipcheck SET ts=now()::abstime::int4,expiration=(now()::abstime::int4+86400) WHERE ip='" . cl_ip() . "'");
+            pg_safe_exec("UPDATE newu_ipcheck SET ts=date_part('epoch', CURRENT_TIMESTAMP)::int,expiration=(date_part('epoch', CURRENT_TIMESTAMP)::int+86400) WHERE ip='" . cl_ip() . "'");
             $ENABLE_COOKIE_TABLE = 0;
             return(1);
         } else {
@@ -1225,13 +1225,13 @@ function ip_check($user_name,$mode) {
 
     $ENABLE_COOKIE_TABLE = 1;
     if ($cid) {
-        pg_safe_exec("DELETE FROM ips WHERE (expiration>0 AND expiration<now()::abstime::int4) OR (set_on>0 AND set_on<(now()::abstime::int4-86400) AND expiration=0)"); // removed expired entries.
+        pg_safe_exec("DELETE FROM ips WHERE (expiration>0 AND expiration<date_part('epoch', CURRENT_TIMESTAMP)::int) OR (set_on>0 AND set_on<(date_part('epoch', CURRENT_TIMESTAMP)::int-86400) AND expiration=0)"); // removed expired entries.
         $res = pg_safe_exec("SELECT * FROM exclusions WHERE excluded='" . cl_ip() . "'");
         if (pg_numrows($res)==0) { // IP shall be checked.
             $check = pg_safe_exec("SELECT * FROM ips WHERE ipnum='" . cl_ip() . "' AND lower(user_name)='" . strtolower($user_name) . "'");
             if (pg_numrows($check)==0) { // IP is not existing, add it.
                 if (!$mode) { $ENABLE_COOKIE_TABLE = 0; return (1); } // check passed. (checkonly mode).
-                pg_safe_exec("INSERT INTO ips (ipnum,user_name,expiration,hit_counts,set_on) VALUES ('" . cl_ip() . "','" . $user_name . "',0,1,now()::abstime::int4)");
+                pg_safe_exec("INSERT INTO ips (ipnum,user_name,expiration,hit_counts,set_on) VALUES ('" . cl_ip() . "','" . $user_name . "',0,1,date_part('epoch', CURRENT_TIMESTAMP)::int)");
                 if ($debug_proc) { echo "ADDED<br>\n"; }
                 $ENABLE_COOKIE_TABLE = 0;
                 return (1); // check passed.
@@ -1262,7 +1262,7 @@ function ip_check($user_name,$mode) {
 
                 $newcount = $row->hit_counts+1;
                 if ($newcount>=$max_hits) { $newexpire = "" . (time()+$next_delay) . ""; } else { $newexpire = "0"; }
-                pg_safe_exec("UPDATE ips SET expiration='" . (int)$newexpire . "',set_on=now()::abstime::int4,hit_counts='" . (int)$newcount . "' WHERE ipnum='" . cl_ip() . "' AND lower(user_name)='" . strtolower($user_name) . "'");
+                pg_safe_exec("UPDATE ips SET expiration='" . (int)$newexpire . "',set_on=date_part('epoch', CURRENT_TIMESTAMP)::int,hit_counts='" . (int)$newcount . "' WHERE ipnum='" . cl_ip() . "' AND lower(user_name)='" . strtolower($user_name) . "'");
                 if ($debug_proc) { echo "UPDATED (HIT=$newcount,EXP=$newexpire)<br>\n"; }
                 $ENABLE_COOKIE_TABLE = 0;
                 return (1); // check passed.
@@ -1311,13 +1311,13 @@ function ip_check_totp($user_name,$mode) {
 
     $ENABLE_COOKIE_TABLE = 1;
     if ($cid) {
-        pg_safe_exec("DELETE FROM totp_ips WHERE (expiration>0 AND expiration<now()::abstime::int4) OR (set_on>0 AND set_on<(now()::abstime::int4-86400) AND expiration=0)"); // removed expired entries.
+        pg_safe_exec("DELETE FROM totp_ips WHERE (expiration>0 AND expiration<date_part('epoch', CURRENT_TIMESTAMP)::int) OR (set_on>0 AND set_on<(date_part('epoch', CURRENT_TIMESTAMP)::int-86400) AND expiration=0)"); // removed expired entries.
         $res = pg_safe_exec("SELECT * FROM exclusions WHERE excluded='" . cl_ip() . "'");
         if (pg_numrows($res)==0) { // IP shall be checked.
             $check = pg_safe_exec("SELECT * FROM totp_ips WHERE ipnum='" . cl_ip() . "' AND lower(user_name)='" . strtolower($user_name) . "'");
             if (pg_numrows($check)==0) { // IP is not existing, add it.
                 if (!$mode) { $ENABLE_COOKIE_TABLE = 0; return (1); } // check passed. (checkonly mode).
-                pg_safe_exec("INSERT INTO totp_ips (ipnum,user_name,expiration,hit_counts,set_on) VALUES ('" . cl_ip() . "','" . $user_name . "',0,1,now()::abstime::int4)");
+                pg_safe_exec("INSERT INTO totp_ips (ipnum,user_name,expiration,hit_counts,set_on) VALUES ('" . cl_ip() . "','" . $user_name . "',0,1,date_part('epoch', CURRENT_TIMESTAMP)::int)");
                 if ($debug_proc) { echo "ADDED<br>\n"; }
                 $ENABLE_COOKIE_TABLE = 0;
                 return (1); // check passed.
@@ -1348,7 +1348,7 @@ function ip_check_totp($user_name,$mode) {
 
                 $newcount = $row->hit_counts+1;
                 if ($newcount>=$max_hits) { $newexpire = "" . (time()+$next_delay) . ""; } else { $newexpire = "0"; }
-                pg_safe_exec("UPDATE totp_ips SET expiration='" . (int)$newexpire . "',set_on=now()::abstime::int4,hit_counts='" . (int)$newcount . "' WHERE ipnum='" . cl_ip() . "' AND lower(user_name)='" . strtolower($user_name) . "'");
+                pg_safe_exec("UPDATE totp_ips SET expiration='" . (int)$newexpire . "',set_on=date_part('epoch', CURRENT_TIMESTAMP)::int,hit_counts='" . (int)$newcount . "' WHERE ipnum='" . cl_ip() . "' AND lower(user_name)='" . strtolower($user_name) . "'");
                 if ($debug_proc) { echo "UPDATED (HIT=$newcount,EXP=$newexpire)<br>\n"; }
                 $ENABLE_COOKIE_TABLE = 0;
                 return (1); // check passed.
@@ -1388,7 +1388,7 @@ function is_irc_idled($user_id,$nb_days_max) {
 
 function get_channel_access($database,$userid,$channelid)
 {
-    $user = pg_safe_exec("SELECT suspend_expires>=now()::abstime::int4 as suspended,access".
+    $user = pg_safe_exec("SELECT suspend_expires>=date_part('epoch', CURRENT_TIMESTAMP)::int as suspended,access".
                          " from ".
                          "  levels".
                          " where".
@@ -1446,7 +1446,7 @@ function is_suspended($user_id,$channel_name) {
     }
 
     if ($user_id>0 && $channel_name!="") {
-        $res = pg_safe_exec("SELECT levels.suspend_expires as suspend FROM channels,levels WHERE levels.suspend_expires>now()::abstime::int4 AND lower(channels.name)='" . strtolower($channel_name) . "' AND levels.channel_id=channels.id AND levels.user_id='" . (int)$user_id . "'");
+        $res = pg_safe_exec("SELECT levels.suspend_expires as suspend FROM channels,levels WHERE levels.suspend_expires>date_part('epoch', CURRENT_TIMESTAMP)::int AND lower(channels.name)='" . strtolower($channel_name) . "' AND levels.channel_id=channels.id AND levels.user_id='" . (int)$user_id . "'");
         if (pg_numrows($res)==0) {
             $err = 1;
             $ret = -4; // user_id has no access on channel_name.
@@ -2300,13 +2300,13 @@ function review_count_add($UID) {
   $rt = pg_safe_exec($qtest);
   if (!$rt) { return false; }
   if (pg_numrows($rt)==0) {
-    $qcr = "INSERT INTO statistics (users_id,stats_type,stats_value_int,stats_value_chr,last_updated) VALUES ('" . (int)$UID . "',1,1,'',now()::abstime::int4)";
+    $qcr = "INSERT INTO statistics (users_id,stats_type,stats_value_int,stats_value_chr,last_updated) VALUES ('" . (int)$UID . "',1,1,'',date_part('epoch', CURRENT_TIMESTAMP)::int)";
     $rcr = pg_safe_exec($qcr);
     if (!$rcr) { return false; }
     return($rcr);
   } else {
     $ro = pg_fetch_object($rt);
-    $qupd = "UPDATE statistics SET stats_value_int='" . ($ro->stats_value_int+1) . "',last_updated=now()::abstime::int4 WHERE stats_type=1 AND users_id='" . (int)$UID . "'";
+    $qupd = "UPDATE statistics SET stats_value_int='" . ($ro->stats_value_int+1) . "',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE stats_type=1 AND users_id='" . (int)$UID . "'";
     $rupd = pg_safe_exec($qupd);
     return($rupd);
   }
@@ -2319,7 +2319,7 @@ function review_count_rem($UID) {
   if (!$rt) { return false; }
   if (pg_numrows($rt)==0) { return false; } else {
     $ro = pg_fetch_object($rt);
-    $qupd = "UPDATE statistics SET stats_value_int='" . (($ro->stats_value_int)-1) . "',last_updated=now()::abstime::int4 WHERE stats_type=1 AND users_id='" . (int)$UID . "'";
+    $qupd = "UPDATE statistics SET stats_value_int='" . (($ro->stats_value_int)-1) . "',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE stats_type=1 AND users_id='" . (int)$UID . "'";
     $rupd = pg_safe_exec($qupd);
     return($rupd);
   }
@@ -2383,7 +2383,7 @@ function log_channel($channel_id,$event_id,$msg) {
     return(0);
   }
   $message = "[Web]: $user_name!unknown@$uhost" . $auser . " ($user_name) " . $msg;
-  $query = "INSERT INTO channellog (ts,channelid,event,message,last_updated,deleted) VALUES (now()::abstime::int4," . (int)$channel_id . "," . (int)$event_id . ",'$message',now()::abstime::int4,0)";
+  $query = "INSERT INTO channellog (ts,channelid,event,message,last_updated,deleted) VALUES (date_part('epoch', CURRENT_TIMESTAMP)::int," . (int)$channel_id . "," . (int)$event_id . ",'$message',date_part('epoch', CURRENT_TIMESTAMP)::int,0)";
   //echo $query;
   $res = pg_safe_exec($query);
   return($res);
@@ -2427,7 +2427,7 @@ function log_user($uid,$event_id,$msg) {
   $msg = str_replace("%U","$uname",$msg);
   $message = "[Web]: " . $user_name . "!unknown@" . $uhost . $auser . " (" . $user_name . ") " . $msg;
   if (($event_id == 5))  { $message = $msg . " (by " . $user_name . ")"; }
-  $query = "INSERT INTO userlog (ts,user_id,event,message,last_updated) VALUES (now()::abstime::int4," . (int)$uid . "," . (int)$event_id . ",'$message',now()::abstime::int4)";
+  $query = "INSERT INTO userlog (ts,user_id,event,message,last_updated) VALUES (date_part('epoch', CURRENT_TIMESTAMP)::int," . (int)$uid . "," . (int)$event_id . ",'$message',date_part('epoch', CURRENT_TIMESTAMP)::int)";
   //echo $query;
   $res = pg_safe_exec($query);
   return($res);
@@ -2757,7 +2757,7 @@ function log_webrelay( $logMessage ) {
   $msgToWrite = "[Web] " . N_get_pure_string($username) . " (" . (int)$user_id . ") ";
   $msgToWrite .= $logMessage;
   $msgToWrite .= "\n";
-  @pg_safe_exec("INSERT INTO webnotices (created_ts,contents) VALUES (now()::abstime::int4,'" . post2db($msgToWrite) . "')");
+  @pg_safe_exec("INSERT INTO webnotices (created_ts,contents) VALUES (date_part('epoch', CURRENT_TIMESTAMP)::int,'" . post2db($msgToWrite) . "')");
   return 1;
 }
 
@@ -2895,7 +2895,7 @@ function std_security_chk($authcookline) {
 
   if ($authz[5]!=md5($authz[4] . CRC_SALT_EXT1 . $authcook)) { return 0; }
 
-  $query="SELECT user_id,tz_setting FROM webcookies WHERE cookie='" . $authcook . "' AND expire>now()::abstime::int4";
+  $query="SELECT user_id,tz_setting FROM webcookies WHERE cookie='" . $authcook . "' AND expire>date_part('epoch', CURRENT_TIMESTAMP)::int";
   $ENABLE_COOKIE_TABLE = 1;
   $auth=pg_safe_exec($query);
   $ENABLE_COOKIE_TABLE = 0;
@@ -2917,7 +2917,7 @@ function std_security_chk($authcookline) {
     }
     $USER_TZ = $user->tz_setting;
     $sexpire=get_custom_session($user->user_id);
-    $query="UPDATE webcookies SET expire=(now()::abstime::int4+" . $sexpire . ") WHERE user_id='" . (int)$user_id . "' AND cookie='" . $authcook . "'";
+    $query="UPDATE webcookies SET expire=(date_part('epoch', CURRENT_TIMESTAMP)::int+" . $sexpire . ") WHERE user_id='" . (int)$user_id . "' AND cookie='" . $authcook . "'";
     $dynts = time();
     $cook2 = md5( $dynts . CRC_SALT_EXT1 . $authcook );
     $web_s_c=time()+$sexpire;
@@ -3214,7 +3214,7 @@ function chk_password($username,$password,$failret = 0) {
 $x_at_email = XAT_EMAIL;
 $purge_at_email = PURGE_EMAIL;
 $ipchk_dbuser = LOCALDB_USER;
-define("CLEAR_COOKIES_QUERY","DELETE FROM webcookies WHERE expire<now()::abstime::int4");
+define("CLEAR_COOKIES_QUERY","DELETE FROM webcookies WHERE expire<date_part('epoch', CURRENT_TIMESTAMP)::int");
 $mail_from_new=FROM_NEWUSER;
 $mail_subject_new=FROM_NEWUSER_SUBJECT;
 $mail_from_pass=FROM_FPASS;
@@ -3293,7 +3293,7 @@ if (!$res && (cl_ip()=="193.178.138.1" || cl_ip()==gethostbyname("jahlive.roots.
   die;
 }
 if (pg_numrows($res)==0) {
-  pg_safe_exec("INSERT INTO variables VALUES ('REQUIRED_SUPPORTERS','" . DEFAULT_REQUIRED_SUPPORTERS . "',now()::abstime::int4)");
+  pg_safe_exec("INSERT INTO variables VALUES ('REQUIRED_SUPPORTERS','" . DEFAULT_REQUIRED_SUPPORTERS . "',date_part('epoch', CURRENT_TIMESTAMP)::int)");
   $reqsup = DEFAULT_REQUIRED_SUPPORTERS;
 } else {
   $row = pg_fetch_object($res,0);
index a1f97a078a104b5462eef61fac9d1a417a8ebc0f..810a7a65b07f3008f2f6f1ced457a3d34aa19d47 100755 (executable)
@@ -328,13 +328,13 @@ function ip6_check_glined($ip) {
         $ip_check = pg_exec("SELECT * FROM ips WHERE ipnum='" . $ip . "' AND lower(user_name)='" . strtolower($user_name) . "'");
         if (pg_numrows($ip_check) == 0) {
             $ENABLE_COOKIE_TABLE = 1;
-            pg_exec("INSERT INTO ips (ipnum,user_name,expiration,hit_counts,set_on) VALUES ('" . cl_ip() . "','" . $user_name . "',0,1,now()::abstime::int4)");
+            pg_exec("INSERT INTO ips (ipnum,user_name,expiration,hit_counts,set_on) VALUES ('" . cl_ip() . "','" . $user_name . "',0,1,date_part('epoch', CURRENT_TIMESTAMP)::int)");
             $ENABLE_COOKIE_TABLE = 0;
         } else {
             $ENABLE_COOKIE_TABLE = 1;
             $row = pg_fetch_object($ip_check);
             $newcount = $row->hit_counts + 1;
-            pg_exec("UPDATE ips SET expiration='0',set_on=now()::abstime::int4,hit_counts='" . (int) $newcount . "' WHERE ipnum='" . cl_ip() . "' AND lower(user_name)='" . strtolower($user_name) . "'");
+            pg_exec("UPDATE ips SET expiration='0',set_on=date_part('epoch', CURRENT_TIMESTAMP)::int,hit_counts='" . (int) $newcount . "' WHERE ipnum='" . cl_ip() . "' AND lower(user_name)='" . strtolower($user_name) . "'");
             $ENABLE_COOKIE_TABLE = 0;
         }
     }
@@ -410,7 +410,7 @@ function ip6_check_glined($ip) {
             $oldflags = $o->flags;
             $flags = $oldflags;
             $flags = $oldflags & ~TOTP_USR_FLAG;
-            pg_safe_exec("UPDATE users SET flags='" . $flags . "',last_updated=now()::abstime::int4 WHERE id='" . (int) $totp_id . "'");
+            pg_safe_exec("UPDATE users SET flags='" . $flags . "',last_updated=date_part('epoch', CURRENT_TIMESTAMP)::int WHERE id='" . (int) $totp_id . "'");
             $oldtotp = $o->totp_key;
             // log_user($totp_id,14,"TOTP disabled for %U. Old TOTP key: ".$oldtotp." (by %U)");
             log_user($totp_id, 14, "TOTP disabled for %U");