<?php

$rss = new RSS("Letzte Antworten - " . SiteConfig::val("page/title", "Q/A Forum"), "Die neusten Antworten aus dem Forum", get_path("/questions/rss"));
$db = new SQL(0);
$rows = $db->cmdrows(0, 'SELECT T1.*,T3.title,T2.username as authorname FROM answers as T1 LEFT JOIN user_list as T2 ON T1.author=T2.id LEFT JOIN questions as T3 ON T1.question=T3.id WHERE 1 ORDER BY date_created DESC LIMIT 0,30');
foreach ($rows as $row) {
    $item = new RSSItem("Antwort auf: " . $row["title"], $row["txt"] . '<br/><br/><div style="color:#8080ff;">SPAMcheck: ' . SpamText($row["isSPAM"]) . '<br/><i>' . html($row["authorname"]) . '</i></div>', Question::PermalinkByData($row["question"], $row["title"]) . "#answer-" . $row["id"]);
    $rss->addItem($item);
}
//die($rss->fetch());
$rss->display();
exit(1);
function SpamText($v)
{
    switch ($v) {
        case -2:
            return "Akismet gute Antwort";
        case -1:
            return "Ham";
        case 1:
            return "<b>Spam</b>";
        case 2:
            return "<b>Akismet SPAM</b>";
    }
}
示例#2
0
<?php

header("Content-Type: text/xml; Charset: UTF-8");
header("Content-Type: application/xml; Charset: UTF-8");
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">' . PHP_EOL;
$db = new SQL(0);
$maxviews = max(1, $db->cmdvalue(0, 'SELECT max(count_views) FROM questions WHERE 1'));
$rows = $db->cmdrows(0, 'SELECT id, title, date_edited, date_action, count_views FROM questions ORDER BY id DESC');
foreach ($rows as $row) {
    echo '<url>
    <loc>' . Question::PermalinkByData($row["id"], $row["title"]) . '</loc>
    <lastmod>' . date("Y-m-d", $row["date_action"]) . 'T' . date("H:i:s", $row["date_action"]) . '+01:00</lastmod>
    <changefreq>daily</changefreq>
    <priority>' . (0.49 + 0.5 * $row["count_views"] / $maxviews) . '</priority>
  </url>' . PHP_EOL;
}
?>
<url>
    <loc><?php 
echo $_ENV["baseurl"];
?>
questions</loc>
    <lastmod><?php 
echo date("Y-m-d");
?>
T01:00:00+01:00</lastmod>
    <changefreq>daily</changefreq>
    <priority>.99</priority>
 </url>
<url>
<?php

$d = API_facebook::statistic(Question::PermalinkByData($params["data"]["id"], $params["data"]["title"]));
?>
<div id="widget-tags" class="widget tags">
				<h2 class="contributorback"><?php 
echo _e("Question Statistics");
?>
</h2>
<table class="StatisticTbl">
	<tr><th><?php 
echo _e("Asked:");
?>
</th><td><?php 
echo _e("{ts}", array("ts" => date(_h("m/d/Y H:i:s"), $params["data"]["date_created"])));
?>
</td></tr>
	<tr><th><?php 
echo _e("Number of Views:");
?>
</th><td><?php 
echo $params["data"]["count_views"];
?>
 Mal</td></tr>
	<tr><th><?php 
echo _e("Last edit:");
?>
</th><td><?php 
echo _e("{ts}", array("ts" => date(_h("m/d/Y H:i:s"), $params["data"]["date_edited"])));
?>
</td></tr>
<?php

$db = new SQL(0);
$rows = $db->cmdrows(0, 'SELECT id, title,MATCH (`title`,`question`,`tags`) AGAINST ("{0}") as Score FROM questions WHERE id != {1} AND MATCH (`title`,`question`,`tags`) AGAINST ("{0}") ORDER BY Score DESC LIMIT 0,5', array($params["data"]["title"] . " " . $params["data"]["question"] . " " . $params["data"]["tags"], $params["data"]["id"] + 0));
?>
<div id="widget-similar" class="widget similar questions"> 
				<h2 class=""><?php 
echo _e("similar questions");
?>
</h2>
<ul>
<?php 
foreach ($rows as $row) {
    echo '<li><a class="question" href="' . Question::PermalinkByData($row["id"], $row["title"]) . '">' . html($row["title"]) . '</a> ' . number_format($row["Score"], 1) . '%</li>';
}
?>
</ul>
			</div>
<style>
#widget-similar ul { padding:0px; margin:0px; }
#widget-similar li { font-family: 'Yanone Kaffeesatz',Arial,sans-serif;  font-size:14px; list-style: none; margin: 4px 0px; padding:0px; color: #707070; }
#widget-similar a { color: #1B79BD; }
#widget-similar a:hover { }
</Style>
示例#5
0
        Badges::add(3, MyUser::id(), array("question" => $frageid));
        //Erste Frage geschrieben
        @file_get_contents("www.google.com/webmasters/tools/ping?sitemap=" . urlencode(SiteConfig::val("baseurl") . "sitemap.xml"));
        $m = SiteConfig::get(0);
        if ($m["twitter"]["consumer"]["secret"] . "" != "" && $m["twitter"]["access"]["secret"] . "" != "") {
            try {
                $twitter = new Twitter($m["twitter"]["consumer"]["key"], $m["twitter"]["consumer"]["secret"]);
                $twitter->setOAuthToken($m["twitter"]["access"]["key"]);
                $twitter->setOAuthTokenSecret($m["twitter"]["access"]["secret"]);
                $url = API_urlshortener::add(Question::PermalinkByData($w3["question"], $w["title"]));
                if (strlen($w["title"]) > 100) {
                    $tweet = substr($w["title"], 0, 100) . "... " . $url . " #wikihelp";
                } else {
                    $tweet = substr($w["title"], 0, 100) . " " . $url . " #wikihelp";
                }
                $twitter->statusesUpdate($tweet);
            } catch (Exception $ex) {
            }
        }
        header("Location: " . Question::PermalinkByData($frageid));
    }
}
function tags2array($text)
{
    $g = explode(",", $text);
    $out = array();
    for ($i = 0; $i < min(5, count($g)); $i++) {
        $out[] = trim(strtolower($g[$i]));
    }
    return $out;
}
    ?>
</div> </div> 
						<div class="countbox votes  <?php 
    echo $row["count_votes"] > 0 ? "some-votes" : "no-votes";
    ?>
"> <span class="item-count"><?php 
    echo format_blocknumber($row["count_votes"]);
    ?>
</span> <div><?php 
    echo _e("votes");
    ?>
</div> 
					</div> 
				<div class="clearfix"></div> 
				<div class="userinfo"> <abbr class="timeago" title="<?php 
    echo date(_h("j. M Y H:i:s T"), $row["date_action"]);
    ?>
"><?php 
    echo Question::format_date($row["date_action"]);
    ?>
</abbr> 
				<?php 
    if ($row["user_action"] > 0) {
        ?>
				<a href="<?php 
        echo UserProfile::ProfilePermaLink($row["user_action"], $row["actionusername"]);
        ?>
"><?php 
        echo html($row["actionusername"]);
        if ($row["country"] != "" and $row["show_country"] == "1") {
            echo '<img class="flag" src="' . get_path("/skins/default/images/flags/16x11/" . strtolower($row["country"]) . ".png") . '" alt="' . _e(Country::getCountryName($row["country"])) . '" title="' . _e(Country::getCountryName($row["country"])) . '"/>';
<?php

$db = new SQL(0);
$info = $db->cmdrow(0, 'SELECT * FROM questions WHERE id={0} LIMIT 0,1', array($params["id"]));
$versions = $db->cmdrows(0, 'SELECT * FROM qatext_versions WHERE type="q" AND keyid="{0}" ORDER BY dt_created ASC', array($info["id"] + 0));
PageEngine::html("html_head");
PageEngine::html("header");
?>
	<div id="Content" class="content-wrapper PageQuestionEdit">
		<article class="ContentLeft">
			<h1>Frage bearbeiten [<a href="<?php 
echo Question::PermalinkByData($info["id"], $info["title"]);
?>
">zurück</a>]</h1>
			<SELECT name="revision">
<?php 
foreach ($versions as $row) {
    echo '<OPTION value="V' . $row["id"] . '">Sicherung vom ' . date("d.m.Y H:i:s", $row["dt_created"]) . ' Uhr</OPTION>';
}
?>
			<OPTION value="current">Aktuelle Version</OPTION>
			</SELECT><button id="BtnLoadRevision" type="button" DISABLED="DISABLED">laden</button>
			<form method="POST"><INPUT type="hidden" name="action" value="save"/>
			
			<b>Titel:</b>
			<INPUT class="gblue" type="text" name="title" value="<?php 
echo html($info["title"]);
?>
"/>
			
			<p><?php 
示例#8
0
         $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"]);
         $akismet->setPermalink(Question::PermalinkByData($w["question"], "Frage"));
         $akismet->setUserIP($_SERVER["REMOTE_ADDR"]);
         try {
             if ($akismet->isCommentSpam()) {
                 $w["isSPAM"] = 2;
             } 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));
    $w2 = array();
    $w2["id"] = $info["id"];
    $w2["title"] = $_POST["title"];
    $w2["question"] = $_POST["text"];
    $w2["author"] = MyUser::id();
    $w2["tags"] = implode(",", tags2array($_POST["tags"]));
    $w2["date_edited"] = time();
    $w2["date_action"] = time();
    $w2["user_action"] = MyUser::id() + 0;
    $db->CreateUpdate(0, 'questions', $w2);
    $db->cmd(0, 'DELETE FROM `question_tags` WHERE question={0}', true, array($info["id"]));
    foreach (tags2array($_POST["tags"]) as $a) {
        $w3 = array();
        $w3["question"] = $info["id"];
        $w3["tag"] = $a;
        $db->CreateUpdate(0, "question_tags", $w3);
    }
    Badges::add(10, MyUser::id());
    //Erfolg Redakteur: Editiere einen Beitrag
    header("Location: " . Question::PermalinkByData($info["id"], $info["title"]));
    exit(1);
}
function tags2array($text)
{
    $g = explode(",", $text);
    $out = array();
    for ($i = 0; $i < min(5, count($g)); $i++) {
        $out[] = trim(strtolower($g[$i]));
    }
    return $out;
}
示例#10
0
			<script type="text/javascript" src="https://www.google.com/jsapi"></script>
			<script type="text/javascript">
				google.load("visualization", "1", {packages:["corechart"]});
				google.setOnLoadCallback(drawChart);
				function drawChart() {
					var data = google.visualization.arrayToDataTable(<?php 
$out = array(array("Datum", "Karma"));
$rows = $db->cmdrows(0, 'SELECT sum(points) as Karma, substr(stamp,1,10) as Datum FROM karma_log WHERE user={0} GROUP BY Datum ORDER BY Datum ASC', array($userinfo["id"]));
$raws = array();
$sum = 0;
$time = $userinfo["dt_registered"] - 86400;
foreach ($rows as $row) {
    $raws[$row["Datum"]] = $row["Karma"];
}
while ($time < time()) {
    $time += 86400;
    if (isset($raws[date("Y-m-d", $time)])) {
        $sum += $raws[date("Y-m-d", $time)];
    }
    $out[] = array(date("d.m.Y", $time), $sum);
}
echo json_encode($out);
?>
);
        var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
        chart.draw(data, {title: "Karma Verlauf",legend:{position: "none"}, hAxis: { title: "Datum"}, vAxis: { title: "Karma"}});
				}
			</script>
			
			<table><tr style="vertical-align:top;">
			<td style="width:640px;">
示例#11
0
if (isset($_POST["action"]) and $_POST["action"] == "save") {
    $db = new SQL(0);
    $info = $db->cmdrow(0, 'SELECT T1.*, T2.title FROM answers as T1 LEFT JOIN questions as T2 ON T1.question=T2.id WHERE T1.id={0} LIMIT 0,1', array($params["id"] + 0));
    if ($info["author"] != MyUser::id() && !isset($_SESSION["myuser"]["lastwritten"]["answers"][$info["id"]])) {
        die("Dies ist nicht Ihre Frage.");
    }
    $w = array();
    $w["keyid"] = $info["id"];
    $w["type"] = "a";
    $w["title"] = "";
    $w["text"] = $info["txt"];
    $w["user"] = MyUser::id();
    $w["dt_created"] = time();
    $db->CreateUpdate(0, 'qatext_versions', $w);
    $w2 = array();
    $w2["id"] = $info["id"];
    $w2["txt"] = $_POST["text"];
    $w2["author"] = MyUser::id();
    $w2["date_edited"] = time();
    $db->CreateUpdate(0, 'answers', $w2);
    $w3 = array();
    $w3["id"] = $info["question"] + 0;
    $w3["date_action"] = time();
    $w3["user_action"] = MyUser::id();
    $db->CreateUpdate(0, 'questions', $w3);
    Badges::add(10, MyUser::id());
    //Erfolg Redakteur: Editiere einen Beitrag
    header("Location: " . Question::PermalinkByData($info["question"], $info["title"]) . "#answer-" . $w2["id"]);
    exit(1);
}
示例#12
0
    require $_ENV["basepath"] . "/app/api/" . $treffer[2] . "/main.php";
    exit(1);
}
if (preg_match("@^/question/([0-9]+)/[^\\/]+(/[a-z\\/]+)?\$@", $_SERVER["REQUEST_URIpure"], $treffer)) {
    switch (isset($treffer[2]) ? $treffer[2] : "") {
        case "/edit":
            PageEngine::runController("question_edit", array("id" => $treffer[1]));
            PageEngine::html("page_question_edit", array("id" => $treffer[1]));
            exit(1);
        case "/rss":
            PageEngine::html("rss_questionanswers", array("question" => $treffer[1]));
        case "/share/facebook":
            PageEngine::html("page_iframe", array("url" => SocialShare::FacebookPermaLink(Question::PermalinkByData($treffer[1] + 0))));
            exit(1);
        case "/share/twitter":
            PageEngine::html("page_iframe", array("url" => SocialShare::TwitterPermaLink(Question::PermalinkByData($treffer[1] + 0))));
            exit(1);
        default:
            PageEngine::runController("question", array("id" => $treffer[1]));
            PageEngine::html("page_question", array("id" => $treffer[1]));
            exit(1);
    }
}
if (preg_match("@^/questions/(.*)\$@", $_SERVER["REQUEST_URIpure"], $treffer)) {
    PageEngine::html("page_questions");
    exit(1);
}
if (preg_match("@^/users/([0-9]+)/[^\\/]+(/[a-z]+)?\$@", $_SERVER["REQUEST_URIpure"], $treffer)) {
    switch (isset($treffer[2]) ? $treffer[2] : "") {
        case "/inbox":
            if (MyUser::id() != $treffer["1"] + 0) {
示例#13
0
$isAdmin = MyUser::isloggedin() && MyUser::hasAdminRight();
$iAnswer = 0;
foreach ($answers as $row) {
    $iAnswer++;
    if (!$isAdmin && $row["isSPAM"] > 0) {
        continue;
    }
    if ($row["author"] == MyUser::id()) {
        $j["already_answered"] = $row["id"];
    }
    echo '<a id="answer-' . $row["id"] . '"></a>';
    ?>
	<div class="answer answer-<?php 
    echo $row["id"];
    ?>
 <?php 
    echo $row["author"] == MyUser::id() ? "myanswer" : "";
    ?>
 <?php 
    echo $row["isSPAM"] > 0 ? "SPAManswer" : "";
    ?>
" rel="<?php 
    echo $row["id"];
    ?>
" style="margin-bottom:10px;">
	<div class="vote-buttons">
		<div id="answer-img-upvote-<?php 
    echo $row["id"];
    ?>
" class="answer img-upvote post-vote <?php 
    echo $row["MyVote"] == "1" ? "active" : "";