Exemple #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));
}
Exemple #2
0
/** This function gets the players data out of the game and login
 *  database.
 */
function profile_change($db_login)
{
    global $params;
    // proccess form data
    $message = profile_update($db_login);
    // update player's data
    page_refreshUserData();
    // show new data
    return profile_show($db_login, $message);
}
Exemple #3
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);
}
Exemple #4
0
function tribe_getContentNoTribe($caveID, &$details)
{
    global $template;
    $messageText = array(-10 => array('type' => 'error', 'message' => _('Die Stammeszugehörigkeit hat sich erst vor kurzem geändert. Warten Sie, bis die Stammeszugehörigkeit geändert werden darf.')), -9 => array('type' => 'error', 'message' => _('Du kannst keinen Stamm gründen während du in einem Stamm bist.')), -8 => array('type' => 'error', 'message' => _('Nicht zulässiges Stammeskürzel oder Passwort.')), -7 => array('type' => 'error', 'message' => _('Der Stamm hat schon die maximale Anzahl an Mitgliedern.')), -6 => array('type' => 'error', 'message' => _('Der Stamm befindet sich gerade im Krieg und darf daher im Moment keine neuen Mitglieder aufnehmen.')), -5 => array('type' => 'error', 'message' => _('Der Stamm konnte nicht angelegt werden.')), -4 => array('type' => 'error', 'message' => _('Es gibt schon einen Stamm mit diesem Kürzel.')), -3 => array('type' => 'error', 'message' => _('Du konntest dem Stamm nicht beitreten. Vermutlich bist du schon bei einem anderen Stamm Mitglied.')), -2 => array('type' => 'error', 'message' => _('Dieser Stammesname ist nicht erlaubt!')), -1 => array('type' => 'error', 'message' => _('Stammeskürzel und Passwort stimmen nicht überein.')), 1 => array('type' => 'success', 'message' => _('Du bist dem Stamm beigetreten.')), 2 => array('type' => 'success', 'message' => _('Der Stamm wurde erfolgreich angelegt.')));
    if (!empty($_SESSION['player']->tribe)) {
        tribe_getContent($caveID, $details);
        return;
    }
    // open template
    $template->setFile('tribe.tmpl');
    $template->setShowRresource(false);
    // process form data
    $messageID = 0;
    $tribeAction = Request::getVar('action', 0);
    switch ($tribeAction) {
        case TRIBE_ACTION_JOIN:
            if (tribe_validatePassword(Request::getVar('password', '')) && tribe_validateTag(Request::getVar('tag', ''))) {
                $messageID = tribe_processJoin($_SESSION['player']->playerID, Request::getVar('tag', ''), Request::getVar('password', ''));
                if ($messageID == 1) {
                    $auth = new auth();
                    $auth->setPermission('tribe', 0, $_SESSION['player']->playerID);
                    page_refreshUserData();
                    $template->addVar('status_msg', $messageText[$messageID]);
                    tribe_getContent($caveID, $details);
                    return;
                }
            } else {
                $messageID = -8;
            }
            break;
        case TRIBE_ACTION_CREATE:
            if (tribe_validatePassword(Request::getVar('password', '')) && tribe_validateTag(Request::getVar('tag', ''))) {
                $messageID = tribe_processCreate($_SESSION['player']->playerID, Request::getVar('tag', ''), Request::getVar('password', ''), Request::getVar('restore_rank', 'no') == 'yes');
            } else {
                $messageID = -8;
            }
            if ($messageID == 2) {
                $auth = new auth();
                $auth->setPermission('tribe', 0, $_SESSION['player']->playerID);
                page_refreshUserData();
                $template->addVar('status_msg', $messageText[$messageID]);
                tribe_getContent($caveID, $details);
                return;
            }
            break;
    }
    /****************************************************************************************************
     *
     * Übergabe ans Template
     *
     ****************************************************************************************************/
    if ($messageID && isset($messageText[$messageID])) {
        $template->addVar('status_msg', $messageText[$messageID]);
    }
    $template->addVars(array('tribe_action_create' => TRIBE_ACTION_CREATE, 'tribe_action_join' => TRIBE_ACTION_JOIN));
}
Exemple #5
0
function tribe_getContent($playerID, $tribe)
{
    global $config, $params, $db, $no_resource_flag, $governmentList;
    $no_resource_flag = 1;
    // messages
    $messageText = array(-12 => _('Der Stamm befindet sich gerade im Krieg und darf daher im Moment keine neuen Mitglieder aufnehmen.'), -11 => _('Die Stammeszugehörigkeit hat sich erst vor kurzem geändert. Warten Sie, bis die Stammeszugehörigkeit geändert werden darf.'), -10 => _('Ihr Stamm befindet sich im Krieg. Sie dürfen derzeit nicht austreten.'), -9 => _('Die Nachricht konnte nicht eingetragen werden.'), -8 => _('Sie sind der Stammesanführer und konnten nicht entfernt werden.'), -7 => _('Das Passwort konnte nicht gesetzt werden!'), -6 => _('Der Stamm konnte nicht angelegt werden.'), -5 => _('Es gibt schon einen Stamm mit diesem Kürzel;'), -4 => _('Sie konnten nicht austreten. Vermutlich gehören Sie gar keinem Stamm an.'), -3 => _('Sie konnten dem Stamm nicht beitreten. Vermutlich sind Sie schon bei einem anderen Stamm Mitglied.'), -2 => _('Passwort und Stammeskürzel stimmen nicht überein.'), -1 => _('Bei der Aktion ist ein unerwarteter Datenbankfehler aufgetreten!'), 01 => _('Sie sind dem Stamm beigetreten.'), 02 => _('Sie haben den Stamm verlassen.'), 03 => _('Der Stamm wurde erfolgreich angelegt.'), 04 => _('Sie waren das letzte Mitglied, der Stamm wurde aufgelöst'), 05 => _('Die Nachricht wurde eingetragen'), 10 => _('Dieser Stammesname ist nicht erlaubt!'));
    // process form data
    if ($params->POST->tribeAction) {
        switch ($params->POST->tribeAction) {
            case TRIBE_ACTION_JOIN:
                if (tribe_validatePassword($params->POST->password) && tribe_validateTag($params->POST->tag)) {
                    $messageID = tribe_processJoin($playerID, $params->POST->tag, $params->POST->password, $db);
                }
                break;
            case TRIBE_ACTION_CREATE:
                if (tribe_validatePassword($params->POST->password) && tribe_validateTag($params->POST->tag)) {
                    $messageID = tribe_processCreate($playerID, $params->POST->tag, $params->POST->password, $db, $params->POST->restore_rank == 'yes');
                }
                break;
            case TRIBE_ACTION_LEAVE:
                $messageID = tribe_processLeave($playerID, $tribe, $db);
                break;
            case TRIBE_ACTION_MESSAGE:
                if ($params->POST->messageText && $params->POST->ingame) {
                    $messageID = tribe_processSendTribeIngameMessage($playerID, $tribe, $params->POST->messageText, $db);
                } else {
                    if ($params->POST->messageText && !$params->POST->ingame) {
                        $messageID = tribe_processSendTribeMessage($playerID, $tribe, $params->POST->messageText, $db);
                    }
                }
                break;
        }
        if ($params->POST->tribeAction == TRIBE_ACTION_JOIN || $params->POST->tribeAction == TRIBE_ACTION_LEAVE || $params->POST->tribeAction == TRIBE_ACTION_CREATE) {
            // the tribe might have changed
            page_refreshUserData();
            $tribe = $params->SESSION->player->tribe;
        }
    }
    // ----------------------------------------------------------------------------
    // ------- SECTION FOR PLAYERS WITHOUT MEMBERSHIP -----------------------------
    if (!$tribe) {
        // not a tribe member
        $template = tmpl_open($params->SESSION->player->getTemplatePath() . 'tribe.ihtml');
        if ($messageID) {
            tmpl_set($template, "MESSAGE/message", $messageText[$messageID]);
        }
        // ------------------------------------------------------------------------
        // ----------- Join existing tribe ----------------------------------------
        tmpl_iterate($template, "FORM");
        $form = array("heading" => _('Einem Stamm beitreten'), "modus_name" => "modus", "modus_value" => TRIBE, "action_name" => "tribeAction", "action_value" => TRIBE_ACTION_JOIN, "TAG/fieldname" => "tag", "TAG/tag_regexp" => _("Buchstaben, Zahlen, Bindestriche; keine Zahlen oder Bindestrich am Anfang"), "TAG/value" => $tribe ? $tribe : $params->POST->tag, "TAG/size" => 8, "TAG/maxlength" => 8, "TAG/form_prefix" => "join_", "PASSWORD/fieldname" => "password", "PASSWORD/pw_regexp" => _("mind. 6 Buchstaben oder Zahlen"), "PASSWORD/value" => $params->POST->password, "PASSWORD/size" => 8, "PASSWORD/maxlength" => 15, "PASSWORD/form_prefix" => "join_", "BUTTON/caption" => _('Beitreten'));
        tmpl_set($template, "FORM", $form);
        // ------------------------------------------------------------------------
        // ----------- Create new tribe -------------------------------------------
        tmpl_iterate($template, "FORM");
        // only change the different values for creation
        $form["heading"] = _('Einen neuen Stamm gründen');
        $form["TAG/form_prefix"] = "create_";
        $form["PASSWORD/form_prefix"] = "create_";
        $form["action_value"] = TRIBE_ACTION_CREATE;
        $form["BUTTON/caption"] = _('Neu gründen');
        $form["RESTORERANKING/fieldName"] = "restore_rank";
        tmpl_set($template, "FORM", $form);
    } else {
        if (!($tribeData = tribe_getTribeByTag($tribe, $db))) {
            return _('Fehler');
        }
        $template = tmpl_open($params->SESSION->player->getTemplatePath() . 'tribeMember.ihtml');
        if ($messageID) {
            tmpl_set($template, "MESSAGE/message", $messageText[$messageID]);
        }
        if (tribe_isLeaderOrJuniorLeader($playerID, $tribe, $db)) {
            $adminData = array("modus_name" => "modus", "modus_value" => TRIBE_ADMIN, "TRIBEMESSAGEFORM" => array("message_name" => "messageText", "modus_name" => "modus", "modus_value" => TRIBE, "action_name" => "tribeAction", "action_value" => TRIBE_ACTION_MESSAGE));
            tmpl_set($template, "ADMIN", $adminData);
        }
        $data = array("tag" => $tribe, "name" => $tribeData['name'], "link_tribe" => "modus=" . TRIBE_DETAIL . "&tribe=" . urlencode(unhtmlentities($tribeData['tag'])), "MEMBERS/tag_name" => "tag", "MEMBERS/tag_value" => $tribe, "MEMBERS/modus_name" => "modus", "MEMBERS/modus_value" => TRIBE_PLAYER_LIST, "LEAVE/modus_name" => "modus", "LEAVE/modus_value" => TRIBE, "LEAVE/action_name" => "tribeAction", "LEAVE/action_value" => TRIBE_ACTION_LEAVE);
        if ($tribeData['leaderID']) {
            $JuniorAdmin = $targetPlayer = new Player(getPlayerByID($tribeData['juniorLeaderID']));
            $leaderData = array("LEADER/name" => $tribeData['leaderName'], "LEADER/leaderID_name" => "detailID", "LEADER/leaderID_value" => $tribeData['leaderID'], "LEADER/juniorLeaderName" => $JuniorAdmin->name, "LEADER/juniorLeaderID_name" => "detailID", "LEADER/juniorLeaderID_value" => $JuniorAdmin->playerID, "LEADER/modus_name" => "modus", "LEADER/modus_value" => PLAYER_DETAIL);
        } else {
            $leaderData = array("NOLEADER/message" => _('Ihr Stamm hat zur Zeit keinen Anführer.'));
        }
        $leaderDeterminationData = array("LEADERDETERMINATION/modus_name" => "modus", "LEADERDETERMINATION/modus_value" => TRIBE_LEADER_DETERMINATION);
        $governmentData = array("GOVERNMENT/name" => $governmentList[$governmentData['governmentID']]);
        if ($warTargets = relation_getWarTargetsAndFame($tribe, $db)) {
            tmpl_set($template, "NORMAL/WAR", array());
            foreach ($warTargets as $target) {
                $target_facts = array("target" => $target["target"], "fame_own" => $target["fame_own"], "fame_target" => $target["fame_target"], "percent_actual" => $target["percent_actual"]);
                if ($target["isForcedSurrenderTheoreticallyPossible"]) {
                    $target_facts["FORCEDSURRENDER/percent_estimated"] = $target["percent_estimated"];
                    if ($target["isForcedSurrenderPracticallyPossible"]) {
                        $target_facts["FORCEDSURRENDER/class"] = "enough";
                    } else {
                        if ($target["isForcedSurrenderPracticallyPossibleForTarget"]) {
                            $target_facts["FORCEDSURRENDER/class"] = "less";
                        } else {
                            $target_facts["FORCEDSURRENDER/class"] = "";
                        }
                    }
                }
                tmpl_iterate($template, "NORMAL/WAR/TARGET");
                tmpl_set($template, "NORMAL/WAR/TARGET", $target_facts);
            }
        }
        if ($messages = tribe_getTribeMessages($tribe, $db)) {
            foreach ($messages as $messageID => $messageData) {
                $message = array("time" => $messageData['date'], "subject" => $messageData['messageSubject'], "message" => $messageData['messageText']);
                tmpl_iterate($template, "NORMAL/TRIBEMESSAGE");
                tmpl_set($template, "NORMAL/TRIBEMESSAGE", $message);
            }
        }
        $data = array_merge($data, $leaderData, $leaderDeterminationData, $governmentData);
        tmpl_set($template, "NORMAL", $data);
    }
    return tmpl_parse($template);
}
Exemple #6
0
function tribe_getContent($playerID, $tribe)
{
    global $config, $params, $db, $no_resource_flag, $governmentList;
    $no_resource_flag = 1;
    // messages
    $messageText = array(-12 => "Der Clan befindet sich gerade im Krieg und darf daher im Moment" . "keine neuen Mitglieder aufnehmen.", -11 => "Ihre Clanzugehörigkeit hat sich erst vor kurzem " . "geändert. Sie müssen noch warten, bis Sie wieder " . "etwas an Ihrer Clanzugehörigkeit ändern dürfen.", -10 => "Ihr Clan befindet sich im Krieg. Sie dürfen derzeit nicht " . "austreten.", -9 => "Die Nachricht konnte nicht eingetragen werden.", -8 => "Sie sind der Clananführer und konnten nicht entfernt " . "werden.", -7 => "Das Passwort konnte nicht gesetzt werden!", -6 => "Der Clan konnte nicht angelegt werden.", -5 => "Es gibt schon einen Clan mit diesem Kürzel;", -4 => "Sie konnten nicht austreten. Vermutlich gehören Sie gar " . "keinem Clan an.", -3 => "Sie konnten dem Clan nicht beitreten. Vermutlich sind Sie schon " . "bei einem anderen Clan Mitglied.", -2 => "Passwort und Clankürzel stimmen nicht überein.", -1 => "Bei der Aktion ist ein unerwarteter Datenbankfehler aufgetreten!", 01 => "Sie sind dem Clan beigetreten.", 02 => "Sie haben den Clan verlassen.", 03 => "Der Clan wurde erfolgreich angelegt.", 04 => "Sie waren das letzte Mitglied, der Clan wurde aufgelöst", 05 => "Die Nachricht wurde eingetragen", 10 => "Dieser Clanname ist nicht erlaubt!");
    // proccess form data
    if ($params->POST->tribeAction) {
        switch ($params->POST->tribeAction) {
            case TRIBE_ACTION_JOIN:
                if ($params->POST->password && $params->POST->tag) {
                    $messageID = tribe_processJoin($playerID, $params->POST->tag, $params->POST->password, $db);
                }
                break;
            case TRIBE_ACTION_CREATE:
                if ($params->POST->password && $params->POST->tag) {
                    $messageID = tribe_processCreate($playerID, $params->POST->tag, $params->POST->password, $db);
                }
                break;
            case TRIBE_ACTION_LEAVE:
                $messageID = tribe_processLeave($playerID, $tribe, $db);
                break;
            case TRIBE_ACTION_MESSAGE:
                if ($params->POST->messageText) {
                    $messageID = tribe_processSendTribeMessage($playerID, $tribe, $params->POST->messageText, $db);
                }
                break;
        }
        if ($params->POST->tribeAction == TRIBE_ACTION_JOIN || $params->POST->tribeAction == TRIBE_ACTION_LEAVE || $params->POST->tribeAction == TRIBE_ACTION_CREATE) {
            // the tribe might have changed
            if (!page_refreshUserData()) {
                return "ERROR";
            }
            $tribe = $params->SESSION->user['tribe'];
        }
    }
    // ----------------------------------------------------------------------------
    // ------- SECTION FOR PLAYERS WITHOUT MEMBERSHIP -----------------------------
    if (!$tribe) {
        // not a tribe member
        $template = @tmpl_open("./templates/" . $config->template_paths[$params->SESSION->user['template']] . "/tribe.ihtml");
        if ($messageID) {
            tmpl_set($template, "MESSAGE/message", $messageText[$messageID]);
        }
        // ------------------------------------------------------------------------
        // ----------- Join existing tribe ----------------------------------------
        tmpl_iterate($template, "FORM");
        $form = array("heading" => "Einem Clan beitreten", "modus_name" => "modus", "modus_value" => TRIBE, "action_name" => "tribeAction", "action_value" => TRIBE_ACTION_JOIN, "TAG/fieldname" => "tag", "TAG/value" => $tribe ? $tribe : $params->POST->tag, "TAG/size" => 8, "TAG/maxlength" => 8, "PASSWORD/fieldname" => "password", "PASSWORD/value" => $params->POST->password, "PASSWORD/size" => 8, "PASSWORD/maxlength" => 15, "BUTTON/caption" => "Beitreten");
        tmpl_set($template, "FORM", $form);
        // ------------------------------------------------------------------------
        // ----------- Create new tribe -------------------------------------------
        tmpl_iterate($template, "FORM");
        // only change the different values for creation
        $form["heading"] = "Einen neuen Clan gründen";
        $form["action_value"] = TRIBE_ACTION_CREATE;
        $form["BUTTON/caption"] = "Neu gründen";
        tmpl_set($template, "FORM", $form);
    } else {
        if (!($tribeData = tribe_getTribeByTag($tribe, $db))) {
            return "ERROR";
        }
        $template = @tmpl_open("./templates/" . $config->template_paths[$params->SESSION->user['template']] . "/tribeMember.ihtml");
        if ($messageID) {
            tmpl_set($template, "MESSAGE/message", $messageText[$messageID]);
        }
        if (tribe_isLeader($playerID, $tribe, $db)) {
            $adminData = array("modus_name" => "modus", "modus_value" => TRIBE_ADMIN, "TRIBEMESSAGEFORM" => array("message_name" => "messageText", "modus_name" => "modus", "modus_value" => TRIBE, "action_name" => "tribeAction", "action_value" => TRIBE_ACTION_MESSAGE));
            tmpl_set($template, "ADMIN", $adminData);
        }
        $data = array("tag" => $tribe, "name" => $tribeData['name'], "link_tribe" => "modus=" . TRIBE_DETAIL . "&tribe=" . urlencode(unhtmlentities($tribeData['tag'])), "MEMBERS/tag_name" => "tag", "MEMBERS/tag_value" => $tribe, "MEMBERS/modus_name" => "modus", "MEMBERS/modus_value" => TRIBE_PLAYER_LIST, "LEAVE/modus_name" => "modus", "LEAVE/modus_value" => TRIBE, "LEAVE/action_name" => "tribeAction", "LEAVE/action_value" => TRIBE_ACTION_LEAVE);
        if ($tribeData[leaderID]) {
            $leaderData = array("LEADER/name" => $tribeData[leaderName], "LEADER/leaderID_name" => "detailID", "LEADER/leaderID_value" => $tribeData[leaderID], "LEADER/modus_name" => "modus", "LEADER/modus_value" => PLAYER_DETAIL);
        } else {
            $leaderData = array("NOLEADER/message" => "Ihr Clan hat zur Zeit keinen Anführer.");
        }
        $leaderDeterminationData = array("LEADERDETERMINATION/modus_name" => "modus", "LEADERDETERMINATION/modus_value" => TRIBE_LEADER_DETERMINATION);
        $governementData = array("GOVERNMENT/name" => $governmentList[$governmentData[governmentID]]);
        if ($messages = tribe_getTribeMessages($tribe, $db)) {
            foreach ($messages as $messageID => $messageData) {
                $message = array("time" => $messageData[date], "subject" => $messageData[messageSubject], "message" => $messageData[messageText]);
                tmpl_iterate($template, "NORMAL/TRIBEMESSAGE");
                tmpl_set($template, "NORMAL/TRIBEMESSAGE", $message);
            }
        }
        $data = array_merge($data, $leaderData, $leaderDeterminationData, $governmentData);
        tmpl_set($template, "NORMAL", $data);
    }
    return tmpl_parse($template);
}
Exemple #7
0
require_once "include/formula_parser.inc.php";
date_default_timezone_set('Europe/Berlin');
// slange: added to fix warning in PHP5
page_start();
// session expired?
if (page_sessionExpired()) {
    page_finish('inaktiv');
} else {
    $_SESSION['lastAction'] = time();
}
// session valid?
if (!page_sessionValidate()) {
    page_finish('wrongSessionID');
}
// refresh user data
page_refreshUserData();
// load template
$template = new Template();
// get modus
$modus = page_getModus();
// get caves
$ownCaves = getCaves($_SESSION['player']->playerID);
// no caves left
if (!$ownCaves) {
    if (!in_array($modus, Config::$noCaveModusInclude)) {
        $modus = NO_CAVE_LEFT;
    }
} else {
    $caveID = Request::getVar('caveID', 0);
    // Keine neue Höhle ausgewählt.
    if ($caveID == 0) {
Exemple #8
0
function profile_getContent($playerID)
{
    global $config, $params, $db, $no_resource_flag;
    $no_resource_flag = 1;
    // try to connect to login db
    if (!($db_login = new DB($config->DB_LOGIN_HOST, $config->DB_LOGIN_USER, $config->DB_LOGIN_PWD, $config->DB_LOGIN_NAME))) {
        page_dberror();
    }
    // messages
    $messageText = array(0 => "Die Daten wurden erfolgreich aktualisiert.", 1 => "Das Paßwort stimmt nicht mit der Wiederholung überein.", 2 => "Die Daten konnten gar nicht oder zumindest nicht vollständig " . "aktualisiert werden.", 3 => "Das Passwort muss mindestens 4 Zeichen lang sein!", 5 => "Die Priorität muß zwischen 0 und 10 liegen!", 6 => "Dein Clan ist im Krieg und du kannst darum den Urlaubsmodus nicht aktivieren!", 7 => "Du warst erst kürzlich im Urlaub und mußt mindestens die gleiche Zeitspanne warten!", 8 => "Fehler beim Aktivieren des Urlaubsmodus", 10 => "Dieser Clanname ist nicht erlaubt!");
    // proccess form data
    if ($params->POST->data || $params->POST->password) {
        // insert necessary fields
        $messageID = profile_processUpdate($playerID, $params->POST->data, $params->POST->password, $params->POST->cave_prio, $db, $db_login);
    }
    // get the user data
    if (!($playerData = profile_getPlayerData($playerID, $db, $db_login))) {
        page_dberror();
    }
    $template = @tmpl_open("./templates/" . $config->template_paths[$params->SESSION->user['template']] . "/profile.ihtml");
    // Show a special message
    if (isset($messageID)) {
        tmpl_set($template, '/MESSAGE/message', $messageText[$messageID]);
        page_refreshUserData();
    }
    // show the profile's data
    tmpl_set($template, 'modus_name', 'modus');
    tmpl_set($template, 'modus_value', USER_PROFILE);
    ////////////// user data //////////////////////
    tmpl_set($template, 'DATA_GROUP/heading', 'Benutzerdaten');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INFO/name', 'Name');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INFO/value', $playerData['game']['name']);
    tmpl_iterate($template, 'DATA_GROUP/ENTRY_INFO');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INFO/name', 'Email');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INFO/value', $playerData['game']['email']);
    tmpl_iterate($template, 'DATA_GROUP/ENTRY_INFO');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/name', 'Email 2');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/dataarray', 'data');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/dataentry', 'email2');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/value', $playerData['game']['email2']);
    tmpl_iterate($template, 'DATA_GROUP/ENTRY_INPUT');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/name', 'Geschlecht (m/w)');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/dataarray', 'data');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/dataentry', 'sex');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/value', $playerData['game']['sex']);
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/size', '1');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/maxlength', '1');
    tmpl_iterate($template, 'DATA_GROUP/ENTRY_INPUT');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/name', 'Herkunft');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/dataarray', 'data');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/dataentry', 'origin');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/value', $playerData['game']['origin']);
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/size', '30');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/maxlength', '30');
    tmpl_iterate($template, 'DATA_GROUP/ENTRY_INPUT');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/name', 'Alter');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/dataarray', 'data');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/dataentry', 'age');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/value', $playerData['game']['age']);
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/size', '2');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/maxlength', '2');
    tmpl_iterate($template, 'DATA_GROUP/ENTRY_INPUT');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/name', 'ICQ#');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/dataarray', 'data');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/dataentry', 'icq');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/value', $playerData['game']['icq']);
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/size', '15');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/maxlength', '15');
    tmpl_iterate($template, 'DATA_GROUP/ENTRY_INPUT');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/name', 'Avatar URL (max ' . AVATAR_X . 'x' . AVATAR_Y . ')');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/dataarray', 'data');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/dataentry', 'avatar');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/value', $playerData['game']['avatar']);
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/size', '30');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/maxlength', '90');
    tmpl_set($template, 'DATA_GROUP/ENTRY_MEMO/name', 'Beschreibung');
    tmpl_set($template, 'DATA_GROUP/ENTRY_MEMO/dataarray', 'data');
    tmpl_set($template, 'DATA_GROUP/ENTRY_MEMO/dataentry', 'description');
    tmpl_set($template, 'DATA_GROUP/ENTRY_MEMO/value', $playerData['game']['description']);
    tmpl_set($template, 'DATA_GROUP/ENTRY_MEMO/cols', '25');
    tmpl_set($template, 'DATA_GROUP/ENTRY_MEMO/rows', '8');
    // ADDED by chris--- for cave sorting
    ////////////// cave sorting //////////////////////
    $meineHoehlen = getCaves($playerID);
    // only show this if there is more than one cave
    if (sizeof($meineHoehlen) > 1) {
        tmpl_iterate($template, 'DATA_GROUP');
        tmpl_set($template, 'DATA_GROUP/heading', 'Siedlungspriorität (1=hoch, 10=niedrig)');
        $i = 0;
        $select = array();
        foreach ($meineHoehlen as $key => $value) {
            tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/name', lib_shorten_html($value['name'], 17));
            tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/dataarray', 'cave_prio');
            tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/dataentry', $key);
            tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/value', $meineHoehlen[$key][priority]);
            tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/size', '2');
            tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/maxlength', '2');
            if ($i + 1 < sizeof($meineHoehlen)) {
                tmpl_iterate($template, 'DATA_GROUP/ENTRY_INPUT');
            }
            $i++;
        }
    }
    // end if
    // ---------------------------------------------------------------------------------------------
    ////////////// template //////////////////////
    /* DISABLED
    
      tmpl_iterate($template, 'DATA_GROUP');
    
      tmpl_set($template, 'DATA_GROUP/heading', 'Template ausw&auml;hlen');
    
      tmpl_set($template, 'DATA_GROUP/ENTRY_SELECTION/name',      'W&auml;hlen Sie ein Template (erneutes einloggen erforderlich!):');
      tmpl_set($template, 'DATA_GROUP/ENTRY_SELECTION/dataarray', 'data');
      tmpl_set($template, 'DATA_GROUP/ENTRY_SELECTION/dataentry', 'template');
      
      $selector = array();
      foreach ($config->template_paths as $key => $value){
        if ($key == $params->SESSION->user['template'])
          array_push($selector, array('value' => $key, 'selected' => "selected", 'text' => $value));
        else
          array_push($selector, array('value' => $key, 'text' => $value));
      }
      tmpl_set($template, 'DATA_GROUP/ENTRY_SELECTION/SELECTOR', $selector);
    */
    ////////////// show_unqualified //////////////////////
    tmpl_iterate($template, 'DATA_GROUP');
    tmpl_set($template, 'DATA_GROUP/heading', "Erweiterte Ansicht");
    tmpl_set($template, 'DATA_GROUP/ENTRY_SELECTION/name', "Sollen auch Einheiten, Erweiterungen etc. angezeigt werden, die noch nicht gebaut werden k&ouml;nnen:");
    tmpl_set($template, 'DATA_GROUP/ENTRY_SELECTION/dataarray', 'data');
    tmpl_set($template, 'DATA_GROUP/ENTRY_SELECTION/dataentry', 'show_unqualified');
    $selector = array();
    $selector[0] = array('value' => 0, 'selected' => $params->SESSION->user['show_unqualified'] == 0 ? "selected" : "", 'text' => "nein");
    $selector[1] = array('value' => 1, 'selected' => $params->SESSION->user['show_unqualified'] == 1 ? "selected" : "", 'text' => "ja");
    tmpl_set($template, 'DATA_GROUP/ENTRY_SELECTION/SELECTOR', $selector);
    // ADDED by chris--- for urlaubsmod:
    ////////////// urlaub //////////////////////
    tmpl_iterate($template, 'DATA_GROUP');
    tmpl_set($template, 'DATA_GROUP/heading', "Urlaubsmodus");
    tmpl_set($template, 'DATA_GROUP/ENTRY_SELECTION/name', "Soll der Urlaubsmodus eingeschaltet werden:<br>ACHTUNG: Lest vorher die Hilfe unten genau durch!");
    tmpl_set($template, 'DATA_GROUP/ENTRY_SELECTION/dataarray', 'data');
    tmpl_set($template, 'DATA_GROUP/ENTRY_SELECTION/dataentry', 'urlaub');
    $selector = array();
    $selector[0] = array('value' => 0, 'selected' => $params->SESSION->user['urlaub'] == 0 ? "selected" : "", 'text' => "nein");
    $selector[1] = array('value' => 1, 'selected' => $params->SESSION->user['urlaub'] == 1 ? "selected" : "", 'text' => "ja");
    tmpl_set($template, 'DATA_GROUP/ENTRY_SELECTION/SELECTOR', $selector);
    // ADDED by chris--- for ticker:
    ////////////// show_ticker //////////////////////
    tmpl_iterate($template, 'DATA_GROUP');
    tmpl_set($template, 'DATA_GROUP/heading', "Nachrichten Ticker");
    tmpl_set($template, 'DATA_GROUP/ENTRY_SELECTION/name', "Soll der Nachrichten Ticker angezeigt werden:");
    tmpl_set($template, 'DATA_GROUP/ENTRY_SELECTION/dataarray', 'data');
    tmpl_set($template, 'DATA_GROUP/ENTRY_SELECTION/dataentry', 'show_ticker');
    $selector = array();
    $selector[0] = array('value' => 0, 'selected' => $params->SESSION->user['show_ticker'] == 0 ? "selected" : "", 'text' => "nein");
    $selector[1] = array('value' => 1, 'selected' => $params->SESSION->user['show_ticker'] == 1 ? "selected" : "", 'text' => "ja");
    tmpl_set($template, 'DATA_GROUP/ENTRY_SELECTION/SELECTOR', $selector);
    // ADDED by chris--- for returns:
    ////////////// show_returns //////////////////////
    tmpl_iterate($template, 'DATA_GROUP');
    tmpl_set($template, 'DATA_GROUP/heading', "R&uuml;ckkehrbewegungen");
    tmpl_set($template, 'DATA_GROUP/ENTRY_SELECTION/name', "Sollen R&uuml;ckkehrbewegungen im Terminkalender angezeigt werden:");
    tmpl_set($template, 'DATA_GROUP/ENTRY_SELECTION/dataarray', 'data');
    tmpl_set($template, 'DATA_GROUP/ENTRY_SELECTION/dataentry', 'show_returns');
    $selector = array();
    $selector[0] = array('value' => 0, 'selected' => $params->SESSION->user['show_returns'] == 0 ? "selected" : "", 'text' => "nein");
    $selector[1] = array('value' => 1, 'selected' => $params->SESSION->user['show_returns'] == 1 ? "selected" : "", 'text' => "ja");
    tmpl_set($template, 'DATA_GROUP/ENTRY_SELECTION/SELECTOR', $selector);
    ////////////// gfxpath //////////////////////
    tmpl_iterate($template, 'DATA_GROUP');
    tmpl_set($template, 'DATA_GROUP/heading', "Grafikpack");
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/name', 'Pfad zum Grafikpack (default:' . DEFAULT_GFX_PATH . '):');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/dataarray', 'data');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/dataentry', 'gfxpath');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/value', $playerData['game']['gfxpath']);
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/size', '30');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT/maxlength', '200');
    ////////////// password //////////////////////
    tmpl_iterate($template, 'DATA_GROUP');
    tmpl_set($template, 'DATA_GROUP/heading', 'Passwort &Auml;nderung');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT_PWD/name', 'Neues Passwort');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT_PWD/dataarray', 'password');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT_PWD/dataentry', 'password1');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT_PWD/size', '15');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT_PWD/maxlength', '15');
    tmpl_iterate($template, 'DATA_GROUP/ENTRY_INPUT_PWD');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT_PWD/name', 'Neues Passwort Wiederholung');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT_PWD/dataarray', 'password');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT_PWD/dataentry', 'password2');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT_PWD/size', '15');
    tmpl_set($template, 'DATA_GROUP/ENTRY_INPUT_PWD/maxlength', '15');
    ////////////// delete account ////////////////////
    tmpl_set($template, 'DELETE/modus_name', 'modus');
    tmpl_set($template, 'DELETE/modus', DELETE_ACCOUNT);
    tmpl_set($template, 'DELETE/heading', 'Account L&ouml;schen');
    tmpl_set($template, 'DELETE/text', 'Ich habe keine Lust mehr!');
    return tmpl_parse($template);
}