示例#1
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);
}
示例#2
0
function profile_show($db_login, $feedback = NULL)
{
    global $params;
    // get login data
    $playerData = profile_getPlayerData($db_login);
    if (!$playerData) {
        page_dberror();
    }
    // open template
    $template = tmpl_open($params->SESSION->player->getTemplatePath() . 'profile.ihtml');
    // show message
    if ($feedback) {
        tmpl_set($template, '/MESSAGE/message', $feedback);
    }
    // show the profile's data
    profile_fillUserData($template, $playerData);
    return tmpl_parse($template);
}