function um_db_get_update($id_update) { $result = process_sql('SELECT * FROM ' . DB_PREFIX . 'tupdate WHERE id = "' . $id_update . '" LIMIT 1'); if ($result === false) { echo '<strong>Error getting update</strong> <br />'; return NULL; } $update = um_std_from_result($result); return $update; }
function um_component_is_blacklisted($component, $name) { global $config; switch ($config["dbtype"]) { case "mysql": $result = process_sql('SELECT COUNT(*) AS blacklisted FROM ' . DB_PREFIX . 'tupdate_component_blacklist WHERE component = "' . $component->name . '" AND name = "' . $name . '"'); break; case "postgresql": case "oracle": $result = process_sql('SELECT COUNT(*) AS blacklisted FROM ' . DB_PREFIX . 'tupdate_component_blacklist WHERE component = \'' . $component->name . '\' AND name = \'' . $name . '\''); break; } if ($result === false) { echo '<strong>Error getting blacklist item</strong> <br />'; return false; } $retval = um_std_from_result($result); return $retval->blacklisted ? true : false; }
function um_db_check_auth($client_key, $subscription_limit) { global $config; switch ($config["dbtype"]) { case "mysql": $result = process_sql('SELECT * FROM ' . DB_PREFIX . 'tupdate_auth WHERE client_key = "' . $client_key . '" LIMIT 1'); break; case "postgresql": $result = process_sql('SELECT * FROM ' . DB_PREFIX . 'tupdate_auth WHERE client_key = \'' . $client_key . '\' LIMIT 1'); break; case "oracle": $result = process_sql('SELECT * FROM ' . DB_PREFIX . 'tupdate_auth WHERE client_key = \'' . $client_key . '\' AND rownum < 2'); break; } if ($result === false) { echo '<strong>Error checking authorization</strong> <br />'; return array(); } $auth = um_std_from_result($result); if (!$auth) { return false; } if ($auth->developer == 1 || $auth->subscription_limit >= $subscription_limit) { return $auth->id; } return false; }