]> jfr.im git - irc/UndernetIRC/cservice-web.git/commitdiff
It was brave to test typed variables :D
authorStefan Wold <redacted>
Sun, 17 Jan 2021 14:34:58 +0000 (14:34 +0000)
committerStefan Wold <redacted>
Sun, 17 Jan 2021 14:34:58 +0000 (14:34 +0000)
docs/gnuworld/users.php
php_includes/extras.php

index fbf8918f40e451d941f7a71670fae2bbf45bfc33..001bc4a8f06597aff41351db115cd49b7570d2ae 100755 (executable)
@@ -923,7 +923,7 @@ if (!$edit || $admin < 800) {
         echo "</select>";
         echo "&nbsp;<input type=\"submit\" value=\"Confirm and set\"/></form>" . $can_set_max_logins . "</td></tr>\n";
     } else {
-        echo "<tr><td><b>User's Max Logins</b></td><td><span style=\"font-style: italic; padding-left: 50px;\">&nbsp;&nbsp;" . $can_set_max_logins . "</span></td></tr>\n";
+        echo "<tr><td><b>User's Max Logins</b></td><td>" . ($user->maxlogins + 0) . "</td></tr>\n";
     }
 
     if (!REGPROC_ALLOWMULTIPLE) {
index a1db6e4708253d7a957d1d0ababb8a118ef2a51d..3df2e7dde447332eb9a7b29f29dbe0deba06b6f3 100755 (executable)
@@ -645,43 +645,51 @@ function popUpClosed() {
         return $max_logins;
     }
 
-    function user_max_logins(int $user_signup_timestamp): array {
-        $account_age = time() - $user_signup_timestamp;
+    function user_max_logins($user_signup_timestamp): array {
+        if ($user_signup_timestamp > 0) {
+            $account_age = time() - $user_signup_timestamp;
 
-        foreach (sorted_max_logins() as $item) {
-            if ($account_age >= $item['account_age']) {
-                return $item;
+            foreach (sorted_max_logins() as $item) {
+                if ($account_age >= $item['account_age']) {
+                    return $item;
+                }
             }
         }
 
         return array("max_logins" => DEFAULT_MAX_LOGINS, "account_age" => 0);
     }
 
-    function time_to_next_max_logins(int $user_signup_timestamp): string {
-        $account_age = time() - $user_signup_timestamp;
+    function time_to_next_max_logins($user_signup_timestamp): string {
         $msg = '';
 
-        foreach (sorted_max_logins() as $item) {
-            if ($account_age <= $item['account_age']) {
-                $msg = "You need to wait " . seconds2human($item['account_age'] - $account_age) . " before you can set MAXLOGINS " . $item['max_logins'];
-                break;
+        if ($user_signup_timestamp > 0) {
+            $account_age = time() - $user_signup_timestamp;
+
+            foreach (sorted_max_logins() as $item) {
+                if ($account_age <= $item['account_age']) {
+                    $msg = "You need to wait " . seconds2human($item['account_age'] - $account_age) . " before you can set MAXLOGINS " . $item['max_logins'];
+                    break;
+                }
             }
         }
 
         return $msg;
     }
 
-    function time_next_channel(int $user_signup_timestamp): array {
-        $allow_multi_chans = ALLOW_MULTI_CHANS;
-        $account_age = time() - $user_signup_timestamp;
+    function time_next_channel($user_signup_timestamp): array {
+        if ($user_signup_timestamp > 0) {
+            $allow_multi_chans = ALLOW_MULTI_CHANS;
+            $account_age = time() - $user_signup_timestamp;
 
-        asort($allow_multi_chans);
+            asort($allow_multi_chans);
 
-        foreach ($allow_multi_chans as $key => $val) {
-            if ($account_age < $val) {
-                return ['max_channels' => $key, 'seconds_next_channel' => $val - $account_age];
+            foreach ($allow_multi_chans as $key => $val) {
+                if ($account_age < $val) {
+                    return ['max_channels' => $key, 'seconds_next_channel' => $val - $account_age];
+                }
             }
         }
+
         return [];
     }