mirror of
https://github.com/Yubico/yubikey-val.git
synced 2025-02-08 03:54:20 +01:00
Refactor.
- string substitution rather than concatenation.
This commit is contained in:
parent
69a3c4417c
commit
9aa740d299
@ -69,7 +69,7 @@ if (!$db->connect())
|
|||||||
|
|
||||||
function get_count($db, $table, $conditions)
|
function get_count($db, $table, $conditions)
|
||||||
{
|
{
|
||||||
$res = $db->customQuery('SELECT count(1) as count FROM ' . $table . ' WHERE ' . $conditions);
|
$res = $db->customQuery("SELECT count(1) as count FROM $table WHERE $conditions");
|
||||||
|
|
||||||
if ($res)
|
if ($res)
|
||||||
{
|
{
|
||||||
@ -81,16 +81,16 @@ function get_count($db, $table, $conditions)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($count = get_count($db, 'yubikeys', 'active=true'))
|
if ($count = get_count($db, 'yubikeys', 'active=true'))
|
||||||
echo "yubikeys_enabled.value " . $count . "\n";
|
echo "yubikeys_enabled.value $count\n";
|
||||||
|
|
||||||
if ($count = get_count($db, 'yubikeys', 'active=false'))
|
if ($count = get_count($db, 'yubikeys', 'active=false'))
|
||||||
echo "yubikeys_disabled.value " . $count . "\n";
|
echo "yubikeys_disabled.value $count\n";
|
||||||
|
|
||||||
if ($count = get_count($db, 'yubikeys', 'modified >= ' . (time() - (31 * 86400))))
|
if ($count = get_count($db, 'yubikeys', 'modified >= ' . (time() - (31 * 86400))))
|
||||||
echo "yubikeys_1month.value " . $count . "\n";
|
echo "yubikeys_1month.value $count\n";
|
||||||
|
|
||||||
if ($count = get_count($db, 'clients', 'active=true'))
|
if ($count = get_count($db, 'clients', 'active=true'))
|
||||||
echo "clients_enabled.value " . $count . "\n";
|
echo "clients_enabled.value $count\n";
|
||||||
|
|
||||||
if ($count = get_count($db, 'clients', 'active=false'))
|
if ($count = get_count($db, 'clients', 'active=false'))
|
||||||
echo "clients_disabled.value " . $count . "\n";
|
echo "clients_disabled.value $count\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user