Example #1
0
if (isset($_REQUEST['TOL_Language'])) {
    $defaultLanguage = $_REQUEST['TOL_Language'];
} elseif (isset($_COOKIE['TOL_Language'])) {
    $defaultLanguage = $_COOKIE['TOL_Language'];
}
// Load the language files.
camp_load_translation_strings("globals");
camp_load_translation_strings("home");
$siteTitle = !empty($Campsite['site']['title']) ? htmlspecialchars($Campsite['site']['title']) : putGS("Newscoop") . $Campsite['VERSION'];
$email = Input::Get("f_email");
$token = Input::Get("token");
$action = "msg";
if (SystemPref::Get("PasswordRecovery") == 'N') {
    $errors[] = getGS('Password recovery is disabled.');
} elseif (!stristr($email, "@") == false && strlen($token) > 4) {
    $usr = User::FetchUserByEmail($email);
    if ($usr != null) {
        $tokenGenerated = (int) substr($token, -10);
        if ($usr->getPasswordResetToken() == $token && time() - $tokenGenerated < 48 * 3600) {
            // valid for 48 hours
            $newPassword = Input::Get("f_password", "string");
            if (strlen($newPassword) > 0) {
                $usr->setPassword($newPassword);
                $errors[] = getGS('Your password has been reset.');
            } else {
                $action = "inputs";
            }
        } else {
            $errors[] = getGS('This link is not valid.');
        }
    } else {