Esempio n. 1
0
<?php

if (isset($_GET["antispam"]) and $_GET["antispam"] == "img") {
    PageEngine::runController("ask_antispam");
}
if (isset($_POST["action"]) and $_POST["action"] == "preview") {
    $wiky = new wiky();
    $out = array();
    $out["html"] = $wiky->parse($_POST["text"]);
    echo json_encode($out);
    exit(1);
}
if (isset($_POST["action"]) and $_POST["action"] == "possiblequestions") {
    $db = new SQL(0);
    $rows = $db->cmdrows(0, 'SELECT *,MATCH (title,question,tags) AGAINST ("{0}") as Score FROM questions WHERE MATCH (title,question,tags) AGAINST ("{0}") ORDER BY Score DESC LIMIT 0,10', array($_POST["q"]));
    echo '<div><b>Schon gestellte ähnliche Fragen...</b><ul style="list-style:none;">';
    foreach ($rows as $row) {
        echo '<li><a href="' . Question::PermalinkByData($row["id"], $row["title"]) . '">' . html($row["title"]) . '</a></li>';
    }
    echo '</ul></div>';
    exit(1);
}
if (isset($_POST["action"]) and $_POST["action"] == "save") {
    $db = new SQL(0);
    $j = true;
    $tags = array();
    if (!MyUser::isloggedin()) {
        if (!isset($_POST["antispam"]) or $_POST["antispam"] . "" == "") {
            PageEngine::AddErrorMessage("AnswerNew", "Bitte lesen Sie die Buchstaben unten im Antispam!");
            $j = false;
        }
Esempio n. 2
0
<?php

/* Wiky.php - A tiny PHP "library" to convert Wiki Markup language to HTML
 * Author: Toni Lähdekorpi <*****@*****.**>
 *
 * Code usage under any of these licenses:
 * Apache License 2.0, http://www.apache.org/licenses/LICENSE-2.0
 * Mozilla Public License 1.1, http://www.mozilla.org/MPL/1.1/
 * GNU Lesser General Public License 3.0, http://www.gnu.org/licenses/lgpl-3.0.html
 * GNU General Public License 2.0, http://www.gnu.org/licenses/gpl-2.0.html
 * Creative Commons Attribution 3.0 Unported License, http://creativecommons.org/licenses/by/3.0/
 */
// This file demonstrates how to use Wiky.php.
// Include the library (obviously)
require_once "wiky.inc.php";
// Create a new wiky to any variable You'd like. Could be $mooming
// If you pass true to __construct (new wiky(true)), "S" PCRE modifier will be added to all regular expressions. This gives a performance boost when running parse thousands of times. Extreme usage only.
$wiky = new wiky();
// Call for the function parse() on the variable You created and pass some unparsed text to it, it will return parsed HTML or false if the content was empty. In this example we are loading the file input.wiki, escaping all html characters with htmlspecialchars, running parse and echoing the output
$input = file_get_contents("input.wiki");
$input = htmlspecialchars($input);
echo $wiky->parse($input);