Пример #1
0
function fs_save_excluded_users($list)
{
    if (!fs_is_admin()) {
        return "Access denied : fs_save_excluded_users";
    }
    $fsdb =& fs_get_db_conn();
    $hits = fs_hits_table();
    if ($fsdb->query("START TRANSACTION") === false) {
        return fs_db_error();
    }
    $sql = "UPDATE `{$hits}` SET `excluded_user`=IF(`user_id` IS NOT NULL AND `user_id` in (" . ($list ? $list : 'NULL') . "),'1','0')";
    if ($fsdb->query($sql) === false) {
        return fs_db_error(true);
    }
    if (fs_update_local_option('firestats_excluded_users', $list) === false) {
        return fs_db_error(true);
    }
    if ($fsdb->query("COMMIT") === false) {
        return fs_db_error(true);
    }
}
Пример #2
0
function fs_ajax_delete_site(&$response)
{
    if (!fs_ajax_assert_admin($response)) {
        return;
    }
    $sid = $_POST['site_id'];
    $action = $_POST['action_code'];
    $new_sid = isset($_POST['new_sid']) ? $_POST['new_sid'] : null;
    $res = fs_delete_site($sid, $action, $new_sid);
    if ($res === true) {
        // if the deleted site was selected in the filter, update the filter
        $current_selected = fs_get_local_option('firestats_sites_filter');
        if ($current_selected == $sid) {
            // reset filter to 'all'.
            fs_update_local_option('firestats_sites_filter', 'all');
            fs_ajax_get_all_stats($response);
        }
        // and also send whatever the client requested.
        fs_ajax_send_update($response);
    } else {
        ajax_error($response, $res);
    }
}