Пример #1
0
function ewiki_mpi_embed($action = "html", $args, &$iii, &$s)
{
    global $ewiki_plugins, $ewiki_id, $ewiki_action;
    if ($action == "html") {
        $o = "";
        #-- get page name
        $get = $args["id"] or $get = $args["page"];
        if (!$get) {
            $get = array_keys($args);
            $get = array_shift($get);
        }
        #-- params
        $id = $ewiki_id;
        if ($args["real"]) {
            $id = $get;
        }
        #-- plugin function
        $pf = ewiki_array($ewiki_plugins["page"], $get);
        #-- exec dynamic page plugin
        if ($get && function_exists($pf)) {
            $uu = array();
            $o .= $pf($id, $uu, $ewiki_action);
        }
    }
    return $o;
}
Пример #2
0
function ewiki_mpi_redirectlinks($action, $args, &$s, &$iii)
{
    global $ewiki_config;
    if (($to = $args["to"]) || ($to = $args[0])) {
        $ewiki_config["links_redirect_iw"] = ewiki_array($ewiki_config["interwiki"], $to);
    }
}
Пример #3
0
function ewiki_mpi_fallback($action, $args, &$s, &$iii)
{
    global $ewiki_config, $ewiki_plugins;
    if (($to = $args["to"]) || ($to = $args[0])) {
        $ewiki_config["links_fallback_iw"] = ewiki_array($ewiki_config["interwiki"], $to);
        $ewiki_plugins["format_prepare_linking"][] = "ewiki_fallback_iw";
    }
}
Пример #4
0
function ewiki_email_protect_enctext(&$html, $id, $data, $action)
{
    global $ewiki_config;
    #-- only activate if _feedbots() wasn't active, for info/ or
    #   diff/ action or for page plugins
    $a_secure = array("info", "diff");
    if (!isset($ewiki_config["@"]) && (in_array($action, $a_secure) || ewiki_array($GLOBALS["ewiki_plugins"]["page"], $id))) {
        $html = preg_replace('/(?:(?:<a[^>]+href="mailto:)?([-_+\\w\\d.]+@[-\\w\\d.]+\\.[\\w]{2,5})(?:"[^>]*>[-_+\\w\\d.@]+<\\/a>)?)/me', '"<a href=\\"".ewiki_email_protect_encode("\\1",2).
                "\\">".ewiki_email_protect_encode("\\1",0)."</a>"', $html);
    }
}
Пример #5
0
function ewiki_aview_pagetrail($id, &$data, $action)
{
    if ($m = $data["meta"]["meta"]) {
        #-- check for parent page
        $top = $m["top"] or $top = $m["parent"] or $top = $m["group"];
        if ($top) {
            $t = ewiki_db::GET($top);
            $t = explode("\n", trim($t["refs"]));
            $n = array_search(ewiki_array($top), strtolower($t));
            $prev = $t[$n - 1];
            $next = $t[$n + 1];
            $o = "<div class=\"page-trail\">&lt;&lt; " . ($prev ? ewiki_link($prev) : "") . " | " . ewiki_link($top) . " | " . ($prev ? ewiki_link($prev) : "") . " &gt;%gt;</div>\n";
            return $o;
        }
    }
}
Пример #6
0
function ewiki_interwiki($href, &$type)
{
    global $ewiki_config, $ewiki_plugins;
    if (strpos($href, ":") and !strpos($href, "//") and $p1 = strtok($href, ":")) {
        $page = strtok("");
        if (($p1 = ewiki_array($ewiki_config["interwiki"], $p1)) !== NULL) {
            $type = array("interwiki", $uu);
            while ($p1_alias = $ewiki_config["interwiki"][$p1]) {
                $type[] = $p1;
                $p1 = $p1_alias;
            }
            if (!strpos($p1, "%s")) {
                $p1 .= "%s";
            }
            $href = str_replace("%s", $page, $p1);
            return $href;
        } elseif ($pf = $ewiki_plugins["intermap"][$p1]) {
            return $pf($p1, $page);
        }
    }
}
Пример #7
0
<?php

/*
   page list, ordered by count of backlinks
*/
echo ewiki_make_title($id, $id, 2);
#-- fetch all pages
$exist = array() + ewiki_array($ewiki_plugins["page"]);
$refs = array();
$result = ewiki_db::GETALL(array("refs"));
while ($r = $result->get(0, 0x137, EWIKI_DB_F_TEXT)) {
    $id = $r["id"];
    $exist[strtolower($id)] = 1;
    foreach (explode("\n", trim($r["refs"])) as $i) {
        $refs[$i]++;
    }
}
unset($refs[0]);
#-- beatify list
if (isset($_REQUEST["desc"])) {
    asort($refs);
} else {
    arsort($refs);
}
#-- output
foreach ($refs as $id => $num) {
    echo "· " . "(<a href=\"" . ewiki_script("links", $id) . "\">{$num}</a>) " . ($exist[strtolower($id)] ? "<a href=\"" . ewiki_script("", $id) . "\">{$id}</a>" : "{$id}") . "<br>\n";
}
Пример #8
0
function wikiapi_listLinks($id, $ver = NULL)
{
    global $ewiki_config;
    $iw =& $ewiki_config["interwiki"];
    $data = ewiki_db::GET($id, $ver);
    if ($data) {
        $r = array();
        $refs = explode("\n", trim($data["refs"]));
        foreach ($refs as $link) {
            #-- interwiki
            if (($m = strtok($link, ":")) && ($p = strtok(""))) {
                if ($url = ewiki_array($iw, $m)) {
                    while (($uu = ewiki_array($iw, $url)) !== NULL) {
                        $url = $uu;
                    }
                    $link = $url . $p;
                }
            }
            #-- absolute URLs
            if (strpos($link, "://")) {
                if (strpos($link, EWIKI_IDF_INTERNAL) === 0) {
                    $link = ewiki_script_binary("", $link);
                    # BAD NEWS: we can't get absolute URLs for
                    # internal:// image links
                }
                $r[] = array("page" => $link, "type" => "external", "href" => $href);
            } else {
                $r[] = array("page" => $link, "type" => "local", "href" => ewiki_script("", $link));
            }
        }
        return $r;
    }
}