Exemplo n.º 1
0
// interface, including logo and footer and even language
$id = ft_load_field("id", "id", "");
if (!empty($id)) {
    $info = ft_get_account_info($id);
    if (isset($info["account_id"])) {
        // just in case, boot up the appropriate language file (this overrides any language file already loaded)
        $g_theme = $info["theme"];
        $language = $info["ui_language"];
        if (!empty($language) && is_file("global/lang/{$language}.php")) {
            include_once "global/lang/{$language}.php";
        }
    }
}
$error = "";
if (isset($_POST["username"]) && !empty($_POST["username"])) {
    $error = ft_login($_POST);
}
$username = isset($_POST["username"]) && !empty($_POST["username"]) ? $_POST["username"] : "";
$username = ft_strip_chars($username);
// -------------------------------------------------------------------------------------------
// compile the variables for use in the templates
$page_vars = array();
$page_vars["page"] = "login";
$page_vars["page_url"] = ft_get_page_url("login");
$page_vars["head_title"] = $LANG["phrase_admin_panel"];
$page_vars["error"] = $error;
if ($g_upgrade_info["upgraded"]) {
    if ($g_upgrade_info["success"]) {
        $new_version = $settings["program_version"];
        if ($settings["release_type"] == "alpha") {
            $new_version = "{$settings['program_version']}-alpha-{$settings['release_date']}";
Exemplo n.º 2
0
/**
 * Used by administrators to login as a client. This function moves the administrator's sessions to a
 * temporary "admin" session key, and logs the administrator in under the client account. When logging out
 * as a client, the logout function detects if it's really an administrator and erases the old client
 * sessions, replacing them with the old administrator sessions, to enable a smooth transition
 * from one account to the next.
 *
 * @param integer $client_id the client ID
 */
function ft_login_as_client($client_id)
{
    // extract the user's login info
    $client_info = ft_get_account_info($client_id);
    $info = array();
    $info["username"] = $client_info["username"];
    // move the session values to separate $_SESSION["ft"]["admin"] values, so that
    // once the administrator logs out we can reset the sessions appropriately
    $current_values = $_SESSION["ft"];
    $_SESSION["ft"] = array();
    $_SESSION["ft"]["admin"] = $current_values;
    // now log in
    ft_login($info, true);
}