예제 #1
0
function prefs_smarty_show($user_id)
{
    assert(is_numeric($user_id));
    global $_RUN;
    global $_USER;
    $template = new Smarty();
    help_set_template_vars($template, "PREFERENCES");
    $template->debugging = true;
    $result = sql_query("SELECT * FROM perihelion.t_themes");
    while ($row = sql_fetchrow($result)) {
        $tmpvar['ids'][] = $row['id'];
        $tmpvar['names'][] = $row['name'];
    }
    $template->assign("themes_ids", $tmpvar['ids']);
    $template->assign("themes_names", $tmpvar['names']);
    $user = user_get_perihelion_user($_USER['id']);
    if (SmartyValidate::is_init()) {
        $template->assign($_POST);
    } else {
        SmartyValidate::init();
        SmartyValidate::register_criteria("validate_email_is_ours_or_does_not_exists");
        SmartyValidate::register_criteria("validate_passwd");
        $template->assign("name", $user['name']);
        $template->assign("email", $user['email']);
        $template->assign("inform", $user['inform']);
        $template->assign("gender", $user['gender']);
        $template->assign("country", $user['country']);
        $template->assign("city", $user['city']);
        $template->assign("tag", $user['tag']);
        $tmp = split('-', $user['birthday']);
        $template->assign("dob_Day", $tmp[2]);
        $template->assign("dob_Month", $tmp[1]);
        $template->assign("dob_Year", $tmp[0]);
        $template->assign("theme", $user['theme_id']);
    }
    $template->assign("uid", encrypt_get_vars($user_id));
    $template->assign("cmd", encrypt_get_vars("post"));
    $template->assign("frmid", encrypt_get_vars(get_form_id()));
    $template->display($_RUN['theme_path'] . "/preferences.tpl");
}
예제 #2
0
include "includes.inc.php";
session_start();
print_header();
print_title("Registration", "With this form you can register yourself as a new player of perihelion. Please fill in all information below");
$template = new Smarty();
help_set_template_vars($template, "REGISTER");
$template->debugging = true;
$result = sql_query("SELECT * FROM perihelion.t_themes");
while ($row = sql_fetchrow($result)) {
    $tmpvar['ids'][] = $row['id'];
    $tmpvar['names'][] = $row['name'];
}
$template->assign("themes_ids", $tmpvar['ids']);
$template->assign("themes_names", $tmpvar['names']);
if (!SmartyValidate::is_init() && !isset($_POST['submit'])) {
    SmartyValidate::init();
    SmartyValidate::register_criteria("validate_email");
    SmartyValidate::register_criteria("validate_login");
    SmartyValidate::register_criteria("validate_specie");
    SmartyValidate::register_criteria("validate_sector");
    SmartyValidate::register_criteria("validate_planet");
    $template->display($_RUN['theme_path'] . "/register.tpl");
} else {
    if (SmartyValidate::is_valid($_POST)) {
        SmartyValidate::clear();
        $ok = "";
        $errors['PARAMS'] = "Incorrect parameters specified..\n";
        $data['tag'] = $_POST['tag'];
        $data['name'] = $_POST['name'];
        $data['email'] = $_POST['email'];
        $data['inform'] = $_POST['inform'];