--- web/lib/aur.inc | 60 ++++++++++++++++++++++++++-------------------------- web/lib/stats.inc | 2 +- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/web/lib/aur.inc b/web/lib/aur.inc index 2b78c99..c31c3e9 100644 --- a/web/lib/aur.inc +++ b/web/lib/aur.inc @@ -16,8 +16,8 @@ include_once("acctfuncs.inc"); # Check if APC extension is loaded, and set cache prefix if it is if (!defined('EXTENSION_LOADED_APC')) { - define('EXTENSION_LOADED_APC', extension_loaded('apc')); - define('APC_PREFIX', 'aur:'); + define('EXTENSION_LOADED_APC', extension_loaded('apc')); + define('APC_PREFIX', 'aur:'); } # see if the visitor is already logged in @@ -268,11 +268,11 @@ function db_query($query="", $db_handle="") { # effectively a no-op (return value is false) # accepts an optional TTL (defaults to 600 seconds) function set_cache_value($key, $value, $ttl=600) { - $status = false; - if (EXTENSION_LOADED_APC) { - $status = apc_store(APC_PREFIX.$key, $value, $ttl); - } - return $status; + $status = false; + if (EXTENSION_LOADED_APC) { + $status = apc_store(APC_PREFIX.$key, $value, $ttl); + } + return $status; } # get a value from the cache (currently apc) if cache @@ -282,28 +282,28 @@ function set_cache_value($key, $value, $ttl=600) { # for testing the fetch result appropriately even in the event # that a 'false' value was the value in the cache. function get_cache_value($key, &$status=false) { - if(EXTENSION_LOADED_APC) { - $ret = apc_fetch(APC_PREFIX.$key, $status); - if ($status) { - return $ret; - } - } - return $status; + if(EXTENSION_LOADED_APC) { + $ret = apc_fetch(APC_PREFIX.$key, $status); + if ($status) { + return $ret; + } + } + return $status; } # run a simple db query, retrieving and/or caching the value if APC # is available for use # accepts an optioanal TTL value (defaults to 600 seconds) function db_cache_value($dbq, $dbh, $key, $ttl=600) { - $status = false; - $value = get_cache_value($key, $status); - if (!$status) { - $result = db_query($dbq, $dbh); - $row = mysql_fetch_row($result); - $value = $row[0]; - set_cache_value($key, $value, $ttl); - } - return $value; + $status = false; + $value = get_cache_value($key, $status); + if (!$status) { + $result = db_query($dbq, $dbh); + $row = mysql_fetch_row($result); + $value = $row[0]; + set_cache_value($key, $value, $ttl); + } + return $value; } # set up the visitor's language @@ -540,12 +540,12 @@ function get_salt($user_id) { $dbh = db_connect(); $salt_q = "SELECT Salt FROM Users WHERE ID = " . $user_id; - $result = db_query($salt_q, $dbh); - if ($result) { - $salt_row = mysql_fetch_row($result); - return $salt_row[0]; - } - return; + $result = db_query($salt_q, $dbh); + if ($result) { + $salt_row = mysql_fetch_row($result); + return $salt_row[0]; + } + return; } function save_salt($user_id, $passwd) @@ -584,7 +584,7 @@ function parse_comment($comment) if ($i % 2) { # convert links $html .= '<a href="' . htmlspecialchars($matches[$i]) . - '">' . htmlspecialchars($matches[$i]) . '</a>'; + '">' . htmlspecialchars($matches[$i]) . '</a>'; } else { # convert everything else diff --git a/web/lib/stats.inc b/web/lib/stats.inc index 29ba0bb..67fbdca 100644 --- a/web/lib/stats.inc +++ b/web/lib/stats.inc @@ -13,7 +13,7 @@ function updates_table($dbh) while ($row = mysql_fetch_assoc($result)) { $newest_packages->append($row); } - set_cache_value($key, $newest_packages); + set_cache_value($key, $newest_packages); } include('stats/updates_table.php'); } -- 1.7.2.5