Ejemplo n.º 1
0
function ewiki_editable_intermap($id, $data, $action)
{
    global $ewiki_config;
    $o = "";
    if (($url = $_REQUEST["add_url"]) && ($moni = $_REQUEST["add_moniker"])) {
        if (!preg_match('#^http[sz]?://(\\w{2,}\\.)+\\w{2,}(:\\d+)?[^\\[\\]\\"\\s]+$#', $url) || strpos($url, "example")) {
            $o .= "URL was rejected.";
        } elseif (!preg_match('#^([' . EWIKI_CHARS_U . ']+[' . EWIKI_CHARS_L . ']+){2,}[' . EWIKI_CHARS . ']+$#', $moni) || $moni == "WikiName") {
            $o .= "Choosen InterWiki moniker not acceptable.";
        } else {
            if ($ewiki_config["interwiki"][$moni]) {
                $o .= "(Note: eventually overriding earlier entry.)<br />";
            }
            $data["content"] = "\n" . trim($data["content"]) . "\n" . ":{$moni}:{$url}" . "\n";
            ewiki_data_update($data);
            $data["version"]++;
            if (ewiki_db::WRITE($data)) {
                $o .= "Map was updated.";
            } else {
                $o .= "Error occoured when saving your changes.";
            }
        }
        $o .= "<br />";
    }
    $o .= ewiki_make_title($id, $id, 2);
    $o .= ewiki_page_view($id, $data, $action, 0);
    $o .= ewiki_t(<<<EOT
    <form class="intermap-append" action="{$_SERVER['REQUEST_URI']}" method="POST" enctype="multipart/form-data">
      <hr>
      <input type="hidden" name="id" value="{$id}">
      :<input name="add_moniker" value="WikiName" size="16">:<input name="add_url" value="http://www.example.com/..." size="42">
      <br />
      <input type="submit" value="_{add}">
    </form>
EOT
);
    return $o;
}
Ejemplo n.º 2
0
function ewiki_view_append_posts($id, $data, $action)
{
    global $ewiki_plugins, $ewiki_config;
    ## Since this function calls ewiki_page_view it must disable itself when it is called
    ##  I do this by having it set separate view_append and view final actions for posts
    ##  but at a minimum it removes itself
    $std_view_append = $ewiki_plugins["view_append"];
    $std_view_final = $ewiki_plugins["view_final"];
    $std_action_links = $ewiki_config["action_links"]["view"];
    $thread_page_title = $GLOBALS["ewiki_title"];
    if (!isset($ewiki_config['posts_view_append'])) {
        unset($ewiki_plugins["view_append"]['view_append_posts']);
    } else {
        $ewiki_plugins["view_append"] = $ewiki_config['posts_view_append'];
    }
    if (isset($ewiki_config['posts_view_final'])) {
        $ewiki_plugins["view_final"] = $ewiki_config['posts_view_final'];
    }
    if (!isset($ewiki_config['posts_action_links'])) {
        unset($GLOBALS['ewiki_config']["action_links"]["view"]["addpost"]);
    } else {
        $ewiki_config["action_links"]["view"] = $ewiki_config['posts_action_links'];
    }
    unset($_REQUEST["thankyou"]);
    // Prevent thank you message from appearing in the menu
    //  bar
    /**
     * Code for the new database layer */
    $result = ewiki_db::SEARCH("id", $id . '_POST');
    #sort by post number
    $ord = array();
    while ($row = $result->get()) {
        if (preg_match('#_POST(\\d{3})#', $row["id"], $matches = array())) {
            $ord[$matches[1]] = $row['id'];
        }
    }
    asort($ord);
    foreach ($ord as $postNum => $id) {
        $GLOBALS["ewiki_title"] = ewiki_t('POST') . $postNum;
        $row = ewiki_db::GET($id);
        #-- require auth
        if (EWIKI_PROTECTED_MODE) {
            if (!ewiki_auth($id, $row, EWIKI_VIEWPOSTACTION, $ring = false, $force = 0)) {
                continue;
            }
        }
        $postOut = ewiki_page_view($id, $row, EWIKI_VIEWPOSTACTION);
        ewiki_page_css_container($postOut, $id, $row, $oo = EWIKI_VIEWPOSTACTION);
        $o .= $postOut;
    }
    ## Restore normal actions
    $ewiki_plugins["view_append"] = $std_view_append;
    $ewiki_plugins["view_final"] = $std_view_final;
    $ewiki_config["action_links"]["view"] = $std_action_links;
    $GLOBALS["ewiki_title"] = $thread_page_title;
    return "<div class='wiki aview posts'>" . $o . '</div>';
}
Ejemplo n.º 3
0
function ewiki_action_htm($id, &$data, $action)
{
    die(ewiki_page_view($id, $data, $action, $_full_page = 0));
}