function prefs_smarty_validate() { global $_RUN; if (SmartyValidate::is_init() && SmartyValidate::is_valid($_POST)) { SmartyValidate::clear(); // And set the preferences $ok = ""; $errors['PARAMS'] = "Incorrect parameters specified..\n"; $data['name'] = $_POST['name']; $data['email'] = $_POST['email']; $data['theme_id'] = $_POST['theme']; $data['gender'] = $_POST['gender']; $data['city'] = $_POST['city']; $data['country'] = $_POST['country']; $data['tag'] = $_POST['tag']; $data['dob'] = $_POST['dob_Year'] . "-" . $_POST['dob_Month'] . "-" . $_POST['dob_Day']; if (isset($inform)) { $data['inform'] = $_POST['inform']; } if (isset($login_pass)) { $data['login_pass'] = $_POST['login_pass']; } $user_id = decrypt_get_vars($_POST['uid']); $data['user_id'] = $user_id; comm_send_to_server("SETPREFS", $data, $ok, $errors); $result = sql_query("SELECT * FROM perihelion.u_users WHERE id=" . $user_id); $tmp = sql_fetchrow($result); session_reinit($tmp); $template = new Smarty(); $template->display($_RUN['theme_path'] . "/preferences-success.tpl"); return true; } return false; }
// Include Files 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'];
/** * test if a tranform function is registered * * @param string $var the value being booleanized */ function is_registered_transform($func_name, $form = 'default') { if (!SmartyValidate::is_init($form)) { trigger_error("SmartyValidate: [is_registered_transform] form '{$form}' is not initialized."); return false; } return in_array($func_name, $_SESSION['SmartyValidate'][$form]['registered_transform']); }