예제 #1
0
function profile_main()
{
    global $template;
    // open template
    $template->setFile('profile.tmpl');
    // connect to login db
    if (!($db_login = DbConnect(Config::DB_LOGIN_HOST, Config::DB_LOGIN_USER, Config::DB_LOGIN_PWD, Config::DB_LOGIN_NAME))) {
        $template->throwError('Datenbankverbindungsfehler. Bitte wende dich an einen Administrator.');
        return;
    }
    $action = Request::getVar('action', '');
    switch ($action) {
        /****************************************************************************************************
        *
        * Profil aktualisieren
        *
        ****************************************************************************************************/
        case 'change':
            // proccess form data
            $message = profile_update($db_login);
            // update player's data
            page_refreshUserData();
            break;
            /****************************************************************************************************
            *
            * Account "löschen"
            *
            ****************************************************************************************************/
        /****************************************************************************************************
        *
        * Account "löschen"
        *
        ****************************************************************************************************/
        case 'delete':
            if (Request::isPost('postConfirm')) {
                if (profile_processDeleteAccount($db_login, $_SESSION['player']->playerID)) {
                    session_destroy();
                    die(json_encode(array('mode' => 'finish', 'title' => 'Account gelöscht', 'msg' => _('Ihr Account wurde zur Löschung vorgemerkt. Sie sind jetzt ausgeloggt und können das Fenster schließen.'))));
                } else {
                    $message = array('type' => 'error', 'message' => _('Das löschen Ihres Accounts ist fehlgeschlagen. Bitte wenden Sie sich an das Support Team.'));
                }
            } else {
                $template->addVars(array('cancelOrder_box' => true, 'confirm_action' => 'delete', 'confirm_id' => $_SESSION['player']->playerID, 'confirm_mode' => USER_PROFILE, 'confirm_msg' => _('Möchtest du deinen Account wirklich löschen?')));
            }
            break;
    }
    // get login data
    $playerData = profile_getPlayerData($db_login);
    if (!$playerData) {
        $template->throwError('Datenbankfehler. Bitte wende dich an einen Administrator');
        return;
    }
    /****************************************************************************************************
    *
    * Übergeben ans Template
    *
    ****************************************************************************************************/
    $template->addVars(array('status_msg' => isset($message) && !empty($message) ? $message : '', 'player' => $playerData['game'], 'language' => LanguageNames::getLanguageNames(), 'template' => Config::$template_paths));
}
예제 #2
0
/**
 * This function delegates the task at issue to the respective function.
 */
function profile_main()
{
    global $template;
    // connect to login db
    if (!($db_login = DbConnect(Config::DB_LOGIN_HOST, Config::DB_LOGIN_USER, Config::DB_LOGIN_PWD, Config::DB_LOGIN_NAME))) {
        $template->throwError('Datenbankverbindungsfehler. Bitte wende dich an einen Administrator.');
        return;
    }
    $action = Request::getVar('action', '');
    switch ($action) {
        // change cave page
        case 'change':
            // proccess form data
            $message = profile_update($db_login);
            // update player's data
            page_refreshUserData();
            break;
            // change cave page
        // change cave page
        case 'delete':
            if (Request::isPost('cancelOrderConfirm')) {
                if (profile_processDeleteAccount($db_login, $_SESSION['player']->playerID)) {
                    session_destroy();
                    $message = array('type' => 'success', 'message' => _('Ihr Account wurde zur Löschung vorgemerkt. Sie sind jetzt ausgeloggt und können das Fenster schließen.'));
                } else {
                    $message = array('type' => 'error', 'message' => _('Das löschen Ihres Accounts ist fehlgeschlagen. Bitte wenden Sie sich an das Support Team.'));
                }
            } else {
                $template->addVars(array('cancelOrder_box' => true, 'confirm_action' => 'delete', 'confirm_id' => $_SESSION['player']->playerID, 'confirm_mode' => USER_PROFILE, 'confirm_msg' => _('Möchtest du deinen Account wirklich löschen?')));
            }
            break;
    }
    // open template
    $template->setFile('profile.tmpl');
    // get login data
    $playerData = profile_getPlayerData($db_login);
    if (!$playerData) {
        $template->throwError('Datenbankfehler. Bitte wende dich an einen Administrator');
        return;
    }
    // show message
    if (isset($message) && !empty($message)) {
        $template->addVar('status_msg', $message);
    }
    // show the profile's data
    profile_fillUserData($template, $playerData);
}
예제 #3
0
function profile_deleteAccount($playerID, $data)
{
    global $config, $db, $no_resource_flag, $params;
    $no_resource_flag = 1;
    // try to connect to login db
    $db_login = new DB($config->DB_LOGIN_HOST, $config->DB_LOGIN_USER, $config->DB_LOGIN_PWD, $config->DB_LOGIN_NAME);
    if (!$db_login) {
        page_dberror();
    }
    // proccess form data
    if (isset($data->confirm)) {
        // the only necessary field
        $success = profile_processDeleteAccount($playerID, $db_login);
        $template = @tmpl_open('./templates/' . $config->template_paths[$params->SESSION->user['template']] . '/deleteResponse.ihtml');
        if ($success) {
            session_destroy();
            tmpl_set($template, 'message', "Ihr Account wurde zur Löschung vorgemerkt. " . "Sie sind jetzt ausgeloggt und können das Fenster " . "Schließen.");
            tmpl_set($template, 'link', "http://tntchris.dyndns.org/ugaagga/");
        } else {
            tmpl_set($template, 'message', "Das löschen Ihres Accounts ist fehlgeschlagen." . "Bitte wenden Sie sich an das Support Team.");
            tmpl_set($template, 'link', "ugastart.php");
        }
        return tmpl_parse($template);
    }
    // Show confirmation request
    $template = @tmpl_open("./templates/" . $config->template_paths[$params->SESSION->user['template']] . "/dialog.ihtml");
    tmpl_set($template, 'message', "M&ouml;chten Sie Ihren Account unwiderruflich l&ouml;schen? " . "Ihre gesamten Spieldaten gehen verloren, ein neuerliches " . "einloggen als dieser Spieler ist nicht m&ouml;glich. " . "<p> Allerdings steht Ihnen die Emailadresse anschlie&szlig;end " . "f&uuml;r eine Neuanmeldung zur Verf&uuml;gung." . "<p> Beachten Sie, da&szlig; Ihre Siedlung noch f&uuml;r einige " . "Zeit nach der L&ouml;schung f&uuml;r ander Spieler sichtbar ist, " . "da die L&ouml;schungen aus der Datenbank nur einmal am Tag " . "vorgenommen werden.");
    tmpl_set($template, 'BUTTON/formname', 'confirm');
    tmpl_set($template, 'BUTTON/text', 'Account l&ouml;schen');
    tmpl_set($template, 'BUTTON/modus_name', 'modus');
    tmpl_set($template, 'BUTTON/modus_value', DELETE_ACCOUNT);
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_name', 'confirm');
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_value', 1);
    tmpl_iterate($template, 'BUTTON');
    tmpl_set($template, 'BUTTON/formname', 'cancel');
    tmpl_set($template, 'BUTTON/text', 'Abbrechen');
    tmpl_set($template, 'BUTTON/modus_name', 'modus');
    tmpl_set($template, 'BUTTON/modus_value', USER_PROFILE);
    return tmpl_parse($template);
}
예제 #4
0
function profile_deleteAccount($playerID, $data)
{
    global $config, $db, $no_resource_flag, $params;
    $no_resource_flag = 1;
    // try to connect to login db
    $db_login = new DB($config->DB_LOGIN_HOST, $config->DB_LOGIN_USER, $config->DB_LOGIN_PWD, $config->DB_LOGIN_NAME);
    if (!$db_login) {
        page_dberror();
    }
    // proccess form data
    if (isset($data->confirm)) {
        // the only necessary field
        $success = profile_processDeleteAccount($playerID, $db_login);
        $template = tmpl_open($params->SESSION->player->getTemplatePath() . 'deleteResponse.ihtml');
        if ($success) {
            session_destroy();
            tmpl_set($template, 'message', _('Ihr Account wurde zur Löschung vorgemerkt. Sie sind jetzt ausgeloggt und können das Fenster schließen.'));
            tmpl_set($template, 'link', LOGIN_PATH);
        } else {
            tmpl_set($template, 'message', _('Das löschen Ihres Accounts ist fehlgeschlagen. Bitte wenden Sie sich an das Support Team.'));
            tmpl_set($template, 'link', "ugastart.php");
        }
        return tmpl_parse($template);
    }
    // Show confirmation request
    $template = tmpl_open($params->SESSION->player->getTemplatePath() . 'dialog.ihtml');
    tmpl_set($template, 'message', _('Möchten Sie Ihren Account unwiderruflich löschen? Ihre gesamten Spieldaten gehen verloren, ein neuerliches einloggen als dieser Spieler ist nicht möglich. <br /> Allerdings steht Ihnen die Emailadresse anschließend für eine Neuanmeldung zur Verfügung. <br /> Beachten Sie, daß Ihre Höhle noch für einige Zeit nach der Löschung für andere Spieler sichtbar ist, da die Löschungen aus der Datenbank nur einmal am Tag vorgenommen werden.'));
    tmpl_set($template, 'BUTTON/formname', 'confirm');
    tmpl_set($template, 'BUTTON/text', _('Account löschen'));
    tmpl_set($template, 'BUTTON/modus_name', 'modus');
    tmpl_set($template, 'BUTTON/modus_value', DELETE_ACCOUNT);
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_name', 'confirm');
    tmpl_set($template, 'BUTTON/ARGUMENT/arg_value', 1);
    tmpl_iterate($template, 'BUTTON');
    tmpl_set($template, 'BUTTON/formname', 'cancel');
    tmpl_set($template, 'BUTTON/text', _('Abbrechen'));
    tmpl_set($template, 'BUTTON/modus_name', 'modus');
    tmpl_set($template, 'BUTTON/modus_value', USER_PROFILE);
    return tmpl_parse($template);
}