Exemplo n.º 1
0
 public static function allread($data)
 {
     if (!MyUser::isloggedin()) {
         throw new APIException("Nicht angemeldet...", 100);
     }
     $db = new SQL(0);
     $db->cmd(0, 'DELETE * FROM user_notification WHERE user = {0}', true, array(MyUser::id()));
     return true;
 }
Exemplo n.º 2
0
<?php

$db = new SQL(0);
if (MyUser::isloggedin()) {
    $db->cmd(0, 'INSERT LOW_PRIORITY IGNORE INTO user_action SET user={0}, last_action = {0} ON DUPLICATE KEY UPDATE last_action ={1}', true, array(MyUser::id(), time()));
}
Exemplo n.º 3
0
        $w["email_standard"] = $_GET["openid_ext1_value_email"];
        $w["dt_registered"] = time();
        $db->Create(0, 'user_list', $w);
        $userid = $db->LastInsertKey();
        $w2["username"] = $username;
        $w2["provider"] = "google";
        $w2["user"] = $userid;
        $db->Create(0, 'user_login', $w2);
        $row = $db->cmdrow(0, 'SELECT * FROM user_login WHERE username="******" AND provider="google" LIMIT 0,1', array($username));
    }
    MyUser::loginload($row["user"]);
    header("Location: " . get_path("/?t=" . time()));
    exit(1);
    //http://127.0.0.1:8082/askbot/account/signin?action=login_google_response&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.mode=id_res&openid.op_endpoint=https%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fud&openid.response_nonce=2012-10-29T22%3A16%3A45ZxLgZyEdIOppIAw&openid.return_to=http%3A%2F%2F127.0.0.1%3A8082%2Faskbot%2Faccount%2Fsignin%3Faction%3Dlogin_google_response&openid.invalidate_handle=ABSmpf6DNMw&openid.assoc_handle=AMlYA9VO0cDrs_DCb7dwBpWED9qHF0QtHhjdwcLQRwhuf_oHmGjGBQ_d&openid.signed=op_endpoint%2Cclaimed_id%2Cidentity%2Creturn_to%2Cresponse_nonce%2Cassoc_handle%2Cns.ext1%2Cext1.mode%2Cext1.type.firstname%2Cext1.value.firstname%2Cext1.type.email%2Cext1.value.email%2Cext1.type.language%2Cext1.value.language%2Cext1.type.lastname%2Cext1.value.lastname&openid.sig=3H3PjRiFw6w2proHrClS7ChQwWI%3D&openid.identity=https%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fid%3Fid%3DAItOawlJe3brb90Yfk7l938jJsrK9Rv0i7vj_6Q&openid.claimed_id=https%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fid%3Fid%3DAItOawlJe3brb90Yfk7l938jJsrK9Rv0i7vj_6Q&openid.ns.ext1=http%3A%2F%2Fopenid.net%2Fsrv%2Fax%2F1.0&openid.ext1.mode=fetch_response&openid.ext1.type.firstname=http%3A%2F%2Faxschema.org%2FnamePerson%2Ffirst&openid.ext1.value.firstname=Andreas&openid.ext1.type.email=http%3A%2F%2Faxschema.org%2Fcontact%2Femail&openid.ext1.value.email=investmentinformatiker%40googlemail.com&openid.ext1.type.language=http%3A%2F%2Faxschema.org%2Fpref%2Flanguage&openid.ext1.value.language=en&openid.ext1.type.lastname=http%3A%2F%2Faxschema.org%2FnamePerson%2Flast&openid.ext1.value.lastname=Kasper
}
function DoOpenIDLogin($url)
{
    $openid = new LightOpenID($_SERVER["HTTP_HOST"]);
    if (!$openid->mode) {
        $openid->identity = $url;
        $openid->optional = array("namePerson/friendly", "namePerson", "namePerson/first", "contact/email", "birthDate", "person/gender", "contact/postalCode/home", "contact/country/home", "pref/language");
        header('Location: ' . $openid->authUrl());
        exit(1);
    }
    if ($openid->validate()) {
Exemplo n.º 4
0
 public static function setbounty($data)
 {
     if (!MyUser::isloggedin()) {
         throw new APIException("User ist nicht angemeldet.", 100);
     }
     $data["karma"] = floor(string2::vall($data["karma"] + 0));
     $data["bitcoin"] = string2::vall($data["bitcoin"] + 0);
     $data["EUR"] = string2::vall($data["EUR"] + 0);
     $db = new SQL(0);
     if ($data["karma"] > 0) {
         if (MyUser::getKarmaPoints() < 75) {
             throw new APIException("Du benötigst 75 Karma-Punkte um eine Karma Bounty zu geben.", 200);
         }
         if (MyUser::getKarmaPoints() < $data["karma"] + 0) {
             throw new APIException("Du hast nur " . MyUser::getKarmaPoints() . " Karma Punkte zu verschenken!", 200);
         }
         $w = array();
         $w["question"] = $data["question"] + 0;
         $w["user"] = MyUser::id();
         $w["amount"] = $data["karma"];
         $w["currency"] = "kar";
         $w["dt_created"] = time();
         $db->Create(0, 'question_bounty', $w);
         Karma::add(MyUser::id(), 5, 0 - $w["amount"], $w["question"]);
     }
     if ($data["bitcoin"] > 0) {
         throw new APIException("Sie haben nicht genügend Bitcoin Guthaben.", 610);
     }
     if ($data["EUR"] > 0) {
         throw new APIException("Sie haben nicht genügend Euro Guthaben.", 710);
     }
 }
Exemplo n.º 5
0
    ?>
</span></a>
				)
			</span>
			<a class="logout" href="<?php 
    echo get_path("/account/signout");
    ?>
"><?php 
    echo _e("logout");
    ?>
</a>	
<?php 
} else {
    ?>
	<a class="gotologin" href="<?php 
    echo get_path("/account/signin");
    ?>
"><?php 
    echo _e("Hello, please register");
    ?>
</a>
<?php 
}
?>
			<a class="help" href="<?php 
echo get_path("/help");
?>
" title="<?php 
echo _e("help");
?>
"><?php 
Exemplo n.º 6
0
                } else {
                    $w["isSPAM"] = -2;
                }
            } catch (Exception $ex) {
            }
        }
        $db->CreateUpdate(0, 'answers', $w);
        $answerID = $db->LastInsertKey();
        $db->cmd(0, 'UPDATE questions SET date_action={1},user_action="{2}", count_answers = (SELECT count(*) FROM answers WHERE question=questions.id) WHERE id={0} LIMIT 1', true, array($w["question"], time(), MyUser::id() + 0));
        $_SESSION["myuser"]["lastwritten"]["answers"][$answerID] = true;
        Karma::RuleAction("CREATE_ANSWER", array("user" => MyUser::id(), "question" => $w["question"], "answer" => $answerID));
        Badges::add(4, MyUser::id(), array("question" => $w["question"]));
        //Erste Antwort geschrieben
    }
}
if (isset($_POST["act"]) and $_POST["act"] == "addComment") {
    if (strlen($_POST["comment"]) >= 10 and MyUser::isloggedin()) {
        $w = array();
        $db = new SQL(0);
        $w["question"] = $_POST["question"] + 0;
        $w["answer"] = $_POST["answer"] + 0;
        $w["text"] = $_POST["comment"];
        $w["created"] = time();
        $w["user"] = MyUser::id();
        $db->CreateUpdate(0, 'comments', $w);
        $a = $db->LastInsertKey();
        Badges::add(5, MyUser::id(), array("question" => $w["question"]));
        //Erster Kommentar geschrieben
        @header("Location: #comment-" . $a);
    }
}
			
			<p><?php 
echo _e("Bitte gebe einen aussagekräftigen Titel für die Frage ein.");
?>
</p>
			
			<?php 
PageEngine::html("box_editor", array("placeholder" => _h("Schreibe hier deine Frage noch ein wenig ausführlicher..."), "value" => isset($_POST["text"]) ? $_POST["text"] : $info["question"]));
?>
			<strong><?php 
echo _e("tags:");
?>
</strong><br/>
			<input class="gblue" autocomplete="off" type="text" name="tags" size="50" placeholder="tag1, tag2, tag3, ..." value="<?php 
echo html($info["tags"]);
?>
"/>
			<p><?php 
echo _e("Tags sind kurze Schlüsselwörter, die Deine Frage beschreiben. Du kannst bis zu 5 Begriffe jeweils mit Komma nennen.");
?>
</p>
			
			<b><?php 
echo _e("Zusammenfassung der Überarbeitung:");
?>
</b>
			
			<INPUT class="gblue" type="text" name="change_summary" value="" placeholder="Rechtschreibfehler, Tippfehler korrigiert, Grammatik, Stil verbessert, ..."/>
			<p><?php 
echo _e("Bitte gebe eine kurze Beschreibung deiner Überarbeitung ein (z.B. Rechtschreibung, Tippfehler korrigiert, Grammatik, Stil verbessert) (Freiwillige Angabe)");
?>
Exemplo n.º 8
0
$info = $db->cmdrow(0, 'SELECT * FROM tag_details WHERE tag = "{0}" LIMIT 0,1', array($params["id"]));
PageEngine::html("html_head", array("title" => $params["id"], "index" => isset($info["long_desc"])));
PageEngine::html("header");
?>
	<div id="Content" class="content-wrapper PageUserprofile">
		<article class="ContentLeft">
<?php 
PageEngine::html("box_tags_navi", array("tag" => $params["id"]));
?>
		
			<h1 class="search-result-summary"><?php 
echo _e("Infos for Tag '{0}'", array(0 => $params["id"]));
?>
</h1>
<?php 
BBCode::render(isset($info["long_desc"]) ? $info["long_desc"] : "", true);
if (!isset($info["long_desc"]) or trim($info["long_desc"]) == "") {
    echo '<p class="noTagDescription">' . _e("Dieser Tag hat aktuell noch keine Erklärung. Ab 2500 Karma Punkten kannst Du diesen Artikel erstellen und so anderen Usern helfen oder einen kurzen Einblick in das Thema bieten.") . '</p>';
}
if (MyUser::isloggedin() and MyUser::getKarmaPoints() >= 2500 or MyUser::hasAdminRight()) {
    echo '<a href="' . get_path("/tags/" . urlencode($params["id"]) . "/info/edit") . '"><button class="blue" type="button">' . _e("edit") . '</button></a>';
}
?>
		
		</article>
		
		<aside class="ContentRight">
		<div style="text-align: center;">
<?php 
$count = $db->cmdvalue(0, 'SELECT count(*) FROM question_tags WHERE tag="{0}" LIMIT 0,1', array($params["id"]));
echo '<span style="color: #808185; font-size: 30px; font-weight:bold;">' . number_format($count, 0, ",", ".") . '</span>';
Exemplo n.º 9
0
            PageEngine::runController("answer_edit", array("id" => $treffer[1] + 0));
            PageEngine::html("page_answer_edit", array("id" => $treffer[1] + 0));
            exit(1);
    }
}
if (preg_match("@^/badges/([0-9]+)/[^\\/]+(/[a-z]+)?\$@", $_SERVER["REQUEST_URIpure"], $treffer)) {
    PageEngine::html("page_badgeprofile", array("badge_id" => $treffer["1"] + 0));
    exit(1);
}
if (preg_match("@^/tags/(.*?)(/[a-z\\/]+)?\$@", $_SERVER["REQUEST_URIpure"], $treffer)) {
    switch (isset($treffer[2]) ? $treffer[2] : "/info") {
        case "/info":
            PageEngine::runController("tags_info", array("id" => $treffer[1]));
            PageEngine::html("page_tags_info", array("id" => $treffer[1]));
            exit(1);
        case "/info/edit":
            if ((!MyUser::isloggedin() or MyUser::getKarmaPoints() < 2500) and !MyUser::hasAdminRight()) {
                PageEngine::html("page_error_karma", array("karma" => 2500));
            }
            PageEngine::runController("tags_infoedit", array("id" => $treffer[1]));
            PageEngine::html("page_tags_infoedit", array("id" => $treffer[1]));
            exit(1);
        case "/synonyms":
            PageEngine::runController("tags_synonyms", array("id" => $treffer[1]));
            PageEngine::html("page_tags_synonyms", array("id" => $treffer[1]));
            exit(1);
    }
}
Observer::Raise("Error_404", array("path" => $_SERVER["REQUEST_URIpure"]));
PageEngine::html("page_404");
exit(1);
Exemplo n.º 10
0
 public static function accept($data)
 {
     $out = array();
     if (!MyUser::isloggedin()) {
         throw new APIException("User ist nicht angemeldet.", 100);
     }
     if (!isset($data["answer"])) {
         throw new APIException("Benötigter Parameter fehlt (answer).", 50);
     }
     $db = new SQL(0);
     $info = $db->cmdrow(0, 'SELECT * FROM answers WHERE id={0} LIMIT 0,1', array($data["answer"] + 0));
     if (!isset($info["id"])) {
         throw new APIException("Diese Antwort existiert nicht (mehr)", 300);
     }
     if ($info["right_answer"] == "1") {
         throw new APIException("Dies ist bereits die beste Antwort", 330);
     }
     $qinfo = $db->cmdrow(0, 'SELECT * FROM questions WHERE id={0} LIMIT 0,1', array($info["question"] + 0));
     if (!isset($qinfo["id"])) {
         throw new APIException("Diese Frage existiert nicht (mehr)", 300);
     }
     if ($qinfo["is_closed"] == "1") {
         throw new APIException("Diese Frage ist bereits geschlossen", 310);
     }
     if ($qinfo["author"] != MyUser::id()) {
         throw new APIException("Dies ist nicht ihre Frage", 320);
     }
     if ($info["author"] == MyUser::id() and MyUser::getKarmaPoints() < 50) {
         throw new APIException("Deine eigene Antwort darf erst ab 50 Karma Punkten die beste Antwort sein", 210);
     }
     $db->cmd(0, 'UPDATE answers SET right_answer = "1" WHERE id={0} LIMIT 1', true, array($info["id"]));
     $db->cmd(0, 'UPDATE questions SET is_answered = "1" WHERE id={0} LIMIT 1', true, array($info["question"]));
     if (MyUser::id() != $info["author"]) {
         Karma::RuleAction("ACCEPT_ANSWER", array("user" => $info["author"], "question" => $info["question"], "answer" => $info["id"]));
     }
     if (MyUser::id() != $info["author"] && $info["is_bounty"] == "1") {
         Bounty::Release($info["question"], $info["author"]);
     }
     //Gib dem Autor die Bounty
     return true;
 }
Exemplo n.º 11
0
if (MyUser::getKarmaPoints() >= 50) {
    PageEngine::html("box_commenteditor", array("question" => $info["id"], "answer" => -1));
}
?>
			</div>
			
<style>
h2.comment-title { font-weight: bold;font-size: 23px; color: #7EA9B3; width: 200px; font-family: 'Yanone Kaffeesatz',Arial,sans-serif; }
.tabBar a { color: #7EA9B3; line-height: 20px; }
.tabBar a.active { color: #4A757F; }
.tabBar a:hover { color: #4A757F; }
.ThankYou { color: #606060; font-style: italic; text-align: left; font-size:10px; }
.vote-buttons { text-align: center; }
.box_bounties { display: block; border: 1px solid #ff8000; background: #ffa030 url(<?php 
echo get_path("/skins/default/images/icons/bounty.png");
?>
) no-repeat left center; background-size:32px; line-height:32px; padding: 2px 2px 2px 34px; margin-bottom:2px; border-radius: 4px;  }
.box_bounties .bounty.BTC { background: url(<?php 
echo get_path("/skins/default/images/icons/bitcoin.png");
?>
) no-repeat right center; font-weight:bold; font-size:16px; color:#404040; background-size:16px; padding-right: 17px; margin-right:10px; }
.box_bounties .bounty.karma { background: url(<?php 
echo get_path("/skins/default/images/icons/karma.png");
?>
) no-repeat right center; font-weight:bold; font-size:16px; color:#404040; background-size:16px; padding-right: 17px; margin-right:10px; }
.box_bounties .bounty.EUR { font-weight:bold; font-size:16px; color:#404040; background-size:16px; margin-right:10px;}
</style>
			
<script>
$(document).ready(function() {
	$(".post-vote.question.img-upvote").css("cursor","pointer").click(function() {