function api_keys_delete_site_key(&$key, $reason = 'expired') { $rsp = api_keys_delete($key, $reason); if ($rsp['ok']) { cache_unset('api_key_site_key'); } return $rsp; }
include "include/init.php"; features_ensure_enabled("api"); login_ensure_loggedin(); loadlib("api_keys"); loadlib("api_keys_utils"); loadlib("api_oauth2_access_tokens"); $key_more = array('allow_disabled' => 1); $key_row = api_keys_utils_get_from_url($key_more); $crumb_key = 'this_api_key'; $GLOBALS['smarty']->assign("crumb_key", $crumb_key); $token_count = api_oauth2_access_tokens_count_for_key($key_row); $GLOBALS['smarty']->assign("token_count", $token_count); if (post_isset('delete') && crumb_check($crumb_key) && !$key_row['disabled']) { $conf = post_str("confirm"); if ($conf) { $rsp = api_keys_delete($key_row); $GLOBALS['smarty']->assign_by_ref("delete_rsp", $rsp); } $GLOBALS['smarty']->assign_by_ref("key", $key_row); $GLOBALS['smarty']->display("page_api_key_delete.txt"); exit; } else { if (post_isset('done') && crumb_check($crumb_key) && !$key_row['disabled']) { $ok = 1; $update = array(); $title = filter_strict(post_str("title")); $description = filter_strict(post_str("description")); $callback = filter_strict(post_str("callback")); if ($ok && !$title) { $GLOBALS['smarty']->assign("error", "no_title"); $ok = 0;