<?php /*************************************************************************** * For license information see doc/license.txt * * Unicode Reminder メモ ***************************************************************************/ require './lib2/web.inc.php'; require_once $opt['rootpath'] . 'lib2/logic/user.class.php'; require_once $opt['rootpath'] . 'lib2/logic/countriesList.class.php'; require_once $opt['rootpath'] . 'lib2/mail.class.php'; $tpl->name = 'register'; $tpl->menuitem = MNU_START_REGISTER; $countriesList = new countriesList(); // Read register informations $show_all_countries = isset($_POST['show_all_countries']) ? $_POST['show_all_countries'] + 0 : 0; $username = isset($_POST['username']) ? $_POST['username'] : ''; $last_name = isset($_POST['last_name']) ? $_POST['last_name'] : ''; $first_name = isset($_POST['first_name']) ? $_POST['first_name'] : ''; $password = isset($_POST['password1']) ? $_POST['password1'] : ''; $password2 = isset($_POST['password2']) ? $_POST['password2'] : ''; $email = isset($_POST['email']) ? mb_trim($_POST['email']) : ''; $country = isset($_POST['country']) ? $_POST['country'] : 'XX'; $tos = isset($_POST['TOS']) ? $_POST['TOS'] == 'ON' : false; if (isset($_POST['show_all_countries_submit'])) { $show_all_countries = 1; } else { if (isset($_POST['submit'])) { $bError = false; $user = new user(ID_NEW); if (!$user->setEMail($email)) {
function sendRegistrationCode() { global $opt, $translate; $countriesList = new countriesList(); $mail = new mail(); $mail->name = 'register'; $mail->to = $this->getEMail(); $mail->subject = $translate->t('Registration confirmation', '', basename(__FILE__), __LINE__); $mail->assign('domain', $opt['page']['domain']); $mail->assign('activation_page', $opt['page']['absolute_url'] . 'activation.php'); $mail->assign('short_activation_page', $opt['page']['absolute_url'] . 'a.php'); $mail->assign('username', $this->getUsername()); $mail->assign('userid', $this->getUserId()); $mail->assign('last_name', $this->getLastName()); $mail->assign('first_name', $this->getFirstName()); $mail->assign('country', $countriesList->getCountryLocaleName($this->getCountryCode())); $mail->assign('code', $this->getActivationCode()); if ($mail->send()) { return true; } else { return false; } }
function sendRegistrationCode() { global $translate; $countriesList = new countriesList(); $mail = new mail(); $mail->name = 'register'; $mail->to = $this->getEMail(); $mail->subject = $translate->t('Registration confirmation', '', basename(__FILE__), __LINE__); $mail->assign('username', $this->getUsername()); $mail->assign('last_name', $this->getLastName()); $mail->assign('first_name', $this->getFirstName()); $mail->assign('country', $countriesList->getCountryLocaleName($this->getCountryCode())); $mail->assign('code', $this->getActivationCode()); if ($mail->send()) { return true; } else { return false; } }
/** * @author giorgio 29/mag/2013 * * added extra parameter to constructor to allow editing of student confirmed registration * */ public function __construct($languages = array(), $allowEditProfile = false, $allowEditConfirm = false, $action = null) { parent::__construct(); $this->addHidden('id_utente')->withData(0); /* * @author:Sara 20/05/2014 * Workaround to remove the Google-Chrome autocomplete functionality. */ $j = 'return remove_false_element()'; $this->setOnSubmit($j); $false_username = FormControl::create(FormControl::INPUT_TEXT, 'false_username', ''); $false_password = FormControl::create(FormControl::INPUT_PASSWORD, 'false_password', ''); $false_elements_fieldset = FormControl::create(FormControl::FIELDSET, 'false_elements_fieldset', ''); $false_elements_fieldset->setHidden(); $false_elements_fieldset->withData(array($false_username, $false_password)); $this->addControl($false_elements_fieldset); $this->addPasswordInput('password', translateFN('Password')); //->setValidator(FormValidator::PASSWORD_VALIDATOR); $this->addPasswordInput('passwordcheck', translateFN('Conferma la password')); /** * If the swithcer does not use this form to edit her own * profile, the avatar upload must be disabled */ if ($_SESSION['sess_userObj']->getType() != AMA_TYPE_SWITCHER || !$allowEditConfirm) { $this->addFileInput('avatarfile', translateFN('Seleziona un file immagine per il tuo avatar')); $this->addTextInput('avatar', NULL); } if ($action != null) { $this->setAction($action); } /// $this->addTextInput('telefono', translateFN('Telefono')); $telefono = FormControl::create(FormControl::INPUT_TEXT, 'telefono', translateFN('Telefono')); $cap = FormControl::create(FormControl::INPUT_TEXT, 'cap', translateFN('cap')); $citta = FormControl::create(FormControl::INPUT_TEXT, 'citta', translateFN('Città')); $indirizzo = FormControl::create(FormControl::INPUT_TEXT, 'indirizzo', translateFN('Indirizzo')); $provincia = FormControl::create(FormControl::INPUT_TEXT, 'provincia', translateFN('Provincia')); $countries = countriesList::getCountriesList($_SESSION['sess_user_language']); $nazione = FormControl::create(FormControl::SELECT, 'nazione', translateFN('Nazione')); $nazione->withData($countries); $this->addFieldset(translateFN('Dati residenza'), 'residenza')->withData(array($indirizzo, $cap, $citta, $provincia, $nazione, $telefono)); // $this->addTextInput('indirizzo', translateFN('Indirizzo')); // $this->addTextInput('citta', translateFN('Città')); // $this->addTextInput('provincia', translateFN('Provincia')); /* $countries = countriesList::getCountriesList($_SESSION['sess_user_language']); $this->addSelect( 'nazione', translateFN('Nazione'), $countries, 'IT'); * */ $this->addTextInput('codice_fiscale', translateFN('Cod. Fiscale')); /** * @author giorgio 29/mag/2013 * * added select field to allow editing of user confirmed registration status */ if ($allowEditConfirm) { $this->addSelect('stato', translateFN('Confermato'), array(ADA_STATUS_PRESUBSCRIBED => translateFN('No'), ADA_STATUS_REGISTERED => translateFN('Si')), 0); } //->setValidator(FormValidator::PASSWORD_VALIDATOR); if ($allowEditProfile) { $this->addTextarea('profilo', translateFN('Il tuo profilo utente')); } $layoutsAr = array('' => translateFN('seleziona un layout')); $layoutObj = new UILayout(); $avalaibleLayoutAr = $layoutObj->getAvailableLayouts(); $layouts = array_merge($layoutsAr, $avalaibleLayoutAr); $this->addSelect('layout', translateFN('Layout'), $layouts, 0); if (is_array($languages) && count($languages) > 0) { $languagesAr[0] = translateFN('seleziona una lingua'); $languages = array_replace($languagesAr, $languages); // $languages = array_merge($languagesAr,$languages); $this->addSelect('lingua', translateFN('Lingua'), $languages, 0); } }
function change() { global $tpl, $login; if (isset($_REQUEST['cancel'])) { $tpl->redirect('myprofile.php'); } $user = new user($login->userid); assignFromUser($user); $bError = false; // set user properties if (isset($_REQUEST['username'])) { $tpl->assign('username', $_REQUEST['username']); if (!$user->setUsername($_REQUEST['username'])) { $tpl->assign('usernameErrorInvalidChars', true); $bError = true; } } if (isset($_REQUEST['firstName'])) { $tpl->assign('firstName', $_REQUEST['firstName']); if (!$user->setFirstName($_REQUEST['firstName'])) { $tpl->assign('firstNameError', true); $bError = true; } } if (isset($_REQUEST['lastName'])) { $tpl->assign('lastName', $_REQUEST['lastName']); if (!$user->setLastName($_REQUEST['lastName'])) { $tpl->assign('lastNameError', true); $bError = true; } } if (isset($_REQUEST['country'])) { $tpl->assign('countryCode', $_REQUEST['country']); if (!$user->setCountryCode($_REQUEST['country'] == 'XX' ? null : $_REQUEST['country'])) { $tpl->assign('countryError', true); $bError = true; } } if (isset($_REQUEST['notifyRadius'])) { $tpl->assign('notifyRadius', $_REQUEST['notifyRadius']); if (!$user->setNotifyRadius($_REQUEST['notifyRadius'])) { $tpl->assign('notifyRadiusError', true); $bError = true; } } $coord['lat'] = coordinate::parseRequestLat('coord'); $coord['lon'] = coordinate::parseRequestLon('coord'); if ($coord['lat'] !== false && $coord['lon'] !== false) { $tpl->assign('coordsDecimal', $coord); if (!$user->setLatitude($coord['lat'])) { $tpl->assign('latitudeError', true); $bError = true; } if (!$user->setLongitude($coord['lon'])) { $tpl->assign('longitudeError', true); $bError = true; } } $bUsePMR = isset($_REQUEST['save']) ? isset($_REQUEST['usePMR']) : $user->getUsePMR(); $tpl->assign('usePMR', $bUsePMR); $user->setUsePMR($bUsePMR); $bPermanentLogin = isset($_REQUEST['save']) ? isset($_REQUEST['permanentLogin']) : $user->getPermanentLogin(); $tpl->assign('permanentLogin', $bPermanentLogin); $user->setPermanentLogin($bPermanentLogin); $bNoHTMLEditor = isset($_REQUEST['save']) ? isset($_REQUEST['noHTMLEditor']) : $user->getNoHTMLEditor(); $tpl->assign('noHTMLEditor', $bNoHTMLEditor); $user->setNoHTMLEditor($bNoHTMLEditor); if (!$bError && isset($_REQUEST['save'])) { if ($user->getAnyChanged()) { if (!$user->save()) { $bError = true; // check for duplicate username if ($user->getUsernameChanged() && user::existUsername($_REQUEST['username'])) { $tpl->assign('errorUsernameExist', true); } else { $tpl->assign('errorUnknown', true); } } else { $tpl->redirect('myprofile.php'); } } else { $tpl->redirect('myprofile.php'); } } $showAllCountries = isset($_REQUEST['showAllCountries']) ? $_REQUEST['showAllCountries'] + 0 : 0; if (isset($_REQUEST['showAllCountriesSubmit'])) { $showAllCountries = 1; } $countriesList = new countriesList(); $rs = $countriesList->getRS($user->getCountryCode(), $showAllCountries != 0); $tpl->assign_rs('countries', $rs); sql_free_result($rs); if ($countriesList->defaultUsed() == true) { $showAllCountries = 0; } else { $showAllCountries = 1; } $tpl->assign('showAllCountries', $showAllCountries); $tpl->assign('edit', true); $tpl->display(); }