Example #1
0
<?php

require "../../global/session_start.php";
ft_check_permission("admin");
if (isset($_GET['delete']) && !empty($_GET['client_id'])) {
    list($g_success, $g_message) = ft_delete_client($_GET['client_id']);
}
if (isset($_GET['login'])) {
    list($g_success, $g_message) = ft_login_as_client($_GET['login']);
}
if (isset($_GET["reset"])) {
    $_SESSION["ft"]["client_sort_order"] = "";
    $_SESSION["ft"]["client_search_keyword"] = "";
    $_SESSION["ft"]["client_search_status"] = "";
}
$order = ft_load_field("order", "client_sort_order", "last_name-ASC");
$keyword = ft_load_field("keyword", "client_search_keyword", "");
$status = ft_load_field("status", "client_search_status", "");
$search_criteria = array("order" => $order, "keyword" => $keyword, "status" => $status);
$num_clients = ft_get_client_count();
// retrieve all client information
$clients = ft_search_clients($search_criteria);
// ------------------------------------------------------------------------------------------------
// compile the header information
$page_vars = array();
$page_vars["page"] = "clients";
$page_vars["page_url"] = ft_get_page_url("clients");
$page_vars["head_title"] = $LANG["word_clients"];
$page_vars["num_clients"] = $num_clients;
$page_vars["clients"] = $clients;
$page_vars["order"] = $order;
Example #2
0
/**
 * Completely deletes a client account from the database.
 *
 * @param integer $account_id
 * @return mixed
 *        if success:
 *            returns array with two indexes: [0] true, [1] empty string
 *
 *        if error:
 *            if $g_api_debug == true
 *               the error page will be displayed displaying the error code.
 *
 *            if $g_api_debug == false, it returns an array with two indexes:
 *                   [0] false
 *                   [1] the API error code
 */
function ft_api_delete_client_account($account_id)
{
    global $g_api_debug;
    $account_id = ft_sanitize($account_id);
    $account_info = ft_get_account_info($account_id);
    // check the account ID was valid (i.e. the account exists) and that it's a CLIENT account
    if (!isset($account_info["account_id"])) {
        if ($g_api_debug) {
            $page_vars = array("message_type" => "error", "error_code" => 800, "error_type" => "user");
            ft_display_page("error.tpl", $page_vars);
            exit;
        } else {
            return array(false, 800);
        }
    }
    if ($account_info["account_type"] != "client") {
        if ($g_api_debug) {
            $page_vars = array("message_type" => "error", "error_code" => 801, "error_type" => "user");
            ft_display_page("error.tpl", $page_vars);
            exit;
        } else {
            return array(false, 801);
        }
    }
    ft_delete_client($account_id);
    return array(true, "");
}