$w["username"] = $_POST["username"];
    }
    $w["prename"] = $_POST["prename"];
    $w["familyname"] = $_POST["familyname"];
    $w["website"] = $_POST["website"];
    $w["location"] = $_POST["location"];
    $w["country"] = $_POST["country"];
    $w["language"] = $_POST["language"];
    $w["FlattrUID"] = trim($_POST["FlattrUID"]);
    $w["SkypeID"] = trim($_POST["SkypeID"]);
    $w["GooglePlus"] = trim($_POST["GooglePlus"]);
    $w["PayPal_email"] = $_POST["PayPal_email"];
    $w["show_country"] = (isset($_POST["show_country"]) and $_POST["show_country"] == "1" ? 1 : 0);
    $d = $_POST["birthday_year"] . "-" . $_POST["birthday_month"] . "-" . $_POST["birthday_day"];
    if (!preg_match("`^[0-9\\?]{4}-[0-9\\?]{2}-[0-9\\?]{2}\$`", $d)) {
        PageEngine::AddErrorMessage("save", "Ungültiges Geburtsdatum");
    } else {
        $w["birthday"] = $d;
    }
    $w["biography"] = $_POST["text"];
    $db = new SQL(0);
    $db->CreateUpdate(0, "user_list", $w);
    if ($w["username"] != "" and $w["prename"] != "" and $w["familyname"] != "" and $w["location"] != "" and $w["country"] != "" and $w["language"] != "" and $w["birthday"] != "" and $w["biography"] != "") {
        Badges::add(1, $w["id"]);
    }
    if ($w["SkypeID"] . "" != "") {
        Badges::add(6, $w["id"], array("skype" => $w["SkypeID"]));
    }
    PageEngine::AddSuccessMessage("save", "Profil gespeichert");
}
function UsernameAlreadyInUse($name, $myuserid = 0)
Exemple #2
0
    if (MyUser::isloggedin()) {
        $row = $db->cmdrow(0, 'SELECT * FROM user_login WHERE user = {0} AND provider = "local" LIMIT 0,1', array(MyUser::id()));
        if ($row["pwd"] . "" != "" and $row["pwd"] != md5($_POST["password1"])) {
            PageEngine::AddErrorMessage("login", "Falsches bisheriges Passwort");
        } elseif ($_POST["password2"] != $_POST["password3"]) {
            PageEngine::AddErrorMessage("login", "Passwort und Wiederholung sind unterschiedlich");
        } else {
            MyUser::changePassword($_POST["password2"]);
            PageEngine::AddSuccessMessage("login", "Passwort geändert");
        }
    } else {
        $row = $db->cmdrow(0, 'SELECT T1.id, T2.pwd FROM user_list as T1 LEFT JOIN user_login as T2 ON T1.id=T2.user WHERE (LOWER(T1.username) = "{0}" OR email_standard = "{0}") AND provider="local" LIMIT 0,1', array(strtolower($_POST["username"])));
        if (!isset($row["id"])) {
            PageEngine::AddErrorMessage("login", "Ungültiger Benutzername oder Passwort");
        } elseif ($row["pwd"] != md5($_POST["password"])) {
            PageEngine::AddErrorMessage("login", "Ungültiger Benutzername oder Passwort (2)");
        } else {
            MyUser::loginload($row["id"]);
            header("Location: " . get_path("/?t=" . time()));
            exit(1);
        }
    }
}
$fb = new LoginFacebook(array("appId" => SiteConfig::val("facebook/appid"), "secret" => SiteConfig::val("facebook/secret"), "cookie" => true));
if (isset($_GET["action"]) && $_GET["action"] == "login_facebook") {
    if ($fb->getUser() == 0) {
        @header("Location: " . $fb->getLoginUrl());
        exit(1);
    }
    $user = $fb->api("/me");
    $db = new SQL(0);
    @header("Location: " . SocialShare::FacebookPermaLink());
    exit(1);
}
if (isset($_POST["act"]) and $_POST["act"] == "AnswerNew") {
    $j = true;
    if (trim($_POST["text"]) == "") {
        $j = false;
        PageEngine::AddErrorMessage("AnswerNew", "Deine Antwort ist leer.");
    }
    if (!MyUser::isloggedin()) {
        if (!isset($_POST["antispam"]) or $_POST["antispam"] . "" == "") {
            PageEngine::AddErrorMessage("AnswerNew", "Bitte lesen Sie die Buchstaben unten im Antispam!");
            $j = false;
        }
        if (!isset($_SESSION["antispam0"]) or !isset($_POST["antispam"]) or $_SESSION["antispam0"] != $_POST["antispam"]) {
            PageEngine::AddErrorMessage("AnswerNew", "Ungültiger Antispam. Bitte lies nochmal genau!");
            $j = false;
        }
    }
    if ($j) {
        $db = new SQL(0);
        $w = array();
        $w["txt"] = $_POST["text"];
        $w["question"] = $params["id"] + 0;
        $w["author"] = MyUser::isloggedin() ? MyUser::id() + 0 : 0 - rand(10, 999999);
        $w["authorIP"] = $_SERVER["REMOTE_ADDR"];
        $w["date_created"] = time();
        $w["date_edited"] = time();
        if (!MyUser::isloggedin() && SiteConfig::val("akismet/key") . "" != "") {
            $akismet = new Akismet(SiteConfig::val("akismet/host"), SiteConfig::val("akismet/key"));
            $akismet->setCommentContent($w["txt"]);
Exemple #4
0
     }
     if (!isset($_SESSION["antispam0"]) or !isset($_POST["antispam"]) or $_SESSION["antispam0"] != $_POST["antispam"]) {
         PageEngine::AddErrorMessage("AnswerNew", "Ungültiger Antispam. Bitte lies nochmal genau!");
         $j = false;
     }
 }
 if (strlen(trim($_POST["title"])) < 10) {
     PageEngine::AddErrorMessage("save", "Dein Titel ist zu kurz");
     $j = false;
 }
 if (strlen(trim($_POST["title"])) > 200) {
     PageEngine::AddErrorMessage("save", "Dein Titel ist zu lang");
     $j = false;
 }
 if (strlen(trim($_POST["text"])) < 10) {
     PageEngine::AddErrorMessage("save", "Bitte schreibe Deine Frage nochmal ausführlicher in der Beschreibung");
     $j = false;
 }
 if ($j) {
     $w = array();
     $w["title"] = trim($_POST["title"]);
     $w["question"] = $_POST["text"];
     $w["tags"] = implode(",", tags2array($_POST["tags"]));
     $w["date_created"] = time();
     $w["date_edited"] = time();
     $w["date_action"] = time();
     $w["user_action"] = MyUser::id() + 0;
     if (!MyUser::isloggedin()) {
         $w["author"] = -1;
     } elseif (isset($_POST["wiki"]) and $_POST["wiki"] == "1") {
         $w["author"] = -2;
        $w["username"] = $_POST["username"];
        $w["email_standard"] = strtolower($_POST["email"]);
        $w["dt_registered"] = time();
        $db->Create(0, "user_list", $w);
        $userid = $db->LastInsertKey();
        $w2 = array();
        $w2["username"] = "******" . $userid . "]";
        $w2["pwd"] = md5($passwort);
        $w2["provider"] = "local";
        $w2["user"] = $userid;
        $db->Create(0, "user_login", $w2);
        $mail = new PHPMailer();
        $mail->SetFrom('no-reply@' . $_SERVER["HTTP_HOST"], 'Registrierung ' . SiteConfig::val("page/title"));
        $mail->AddAddress($_POST["email"], $w["username"]);
        $local = PageEngine::html_find("email_register", ".tpl");
        $body = file_get_contents($local);
        $body = str_replace(array("{{password}}", "{{page_title}}"), array($passwort, SiteConfig::val("page/title", "Q/A Forum")), $body);
        $mail->Subject = "Deine Registrierung bei " . SiteConfig::val("page/title");
        $mail->AltBody = 'Vielen Dank für Deine Registrierung,
wir schicken Dir nun Deine Zugangsdaten für ' . SiteConfig::val("page/title") . '. Solltest Du diese nicht beantragt haben, dann lösche bitte diese Nachricht umgehend, damit nicht Dritte Deine Identität nutzen können.
Passwort: ' . $passwort . '
Wir wünschen Dir viel Spaß auf ' . SiteConfig::val("page/title") . '';
        $mail->MsgHTML($body);
        if (!$mail->Send()) {
            Observer::Raise("Mail_Send_Error", array("errormsg" => $mail->ErrorInfo));
            Observer::Raise("Register_Error", array("errormsg" => "No Mail send", "errormsg" => $mail->ErrorInfo));
            PageEngine::AddErrorMessage("register", "Fehler beim senden der E-Mail (" . $mail->ErrorInfo . ").");
        }
        PageEngine::AddSuccessMessage("register", "Neuer User angelegt... Bitte prüfe Deine E-Mails!");
    }
}