Exemplo n.º 1
0
                $bReasonFound = false;
                // username or email already exists
                if ($user->existUsername($user->getUsername())) {
                    $tpl->assign('error_username_exists', 1);
                    $bReasonFound = true;
                }
                if ($user->existEMail($user->getEMail())) {
                    $tpl->assign('error_email_exists', 1);
                    $bReasonFound = true;
                }
                if ($bReasonFound == false) {
                    $tpl->assign('error_unkown', 1);
                }
            }
        }
    }
}
$rs = $countriesList->getRS($country == 'XX' ? null : $country, $show_all_countries);
$tpl->assign_rs('countries', $rs);
sql_free_result($rs);
if (!$countriesList->defaultUsed()) {
    $show_all_countries = 1;
}
$tpl->assign('show_all_countries', $show_all_countries);
$tpl->assign('country', $country);
$tpl->assign('country_full', $countriesList->getCountryLocaleName($country));
$tpl->assign('email', $email);
$tpl->assign('first_name', $first_name);
$tpl->assign('last_name', $last_name);
$tpl->assign('username', $username);
$tpl->display();
Exemplo n.º 2
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();
}