当前位置: 首页>>代码示例>>PHP>>正文


PHP ewiki_db::GET方法代码示例

本文整理汇总了PHP中ewiki_db::GET方法的典型用法代码示例。如果您正苦于以下问题:PHP ewiki_db::GET方法的具体用法?PHP ewiki_db::GET怎么用?PHP ewiki_db::GET使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ewiki_db的用法示例。


在下文中一共展示了ewiki_db::GET方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ewiki_powersearch

function ewiki_powersearch($q, $where = 'content')
{
    $q = ewiki_lowercase(preg_replace('/\\s*[\\000-\\040]+\\s*/', ' ', $q));
    $found = array();
    $scored = array();
    #-- initial scan
    foreach (explode(" ", $q) as $search) {
        if (empty($search)) {
            continue;
        }
        $result = ewiki_db::SEARCH($where, $search);
        while ($row = $result->get()) {
            if (($row["flags"] & EWIKI_DB_F_TYPE) == EWIKI_DB_F_TEXT) {
                $id = $row["id"];
                $content = strtolower($row[$where]);
                unset($row);
                #-- have a closer look
                $len1 = strlen($content) + 1;
                if (!isset($scored[$id])) {
                    $scored[$id] = 1;
                }
                $scored[$id] += 800 * (strlen($search) / $len1);
                $scored[$id] += 65 * (count(explode($search, $content)) - 2);
                $p = -1;
                while (($p = strpos($content, $search, $p + 1)) !== false) {
                    $scored[$id] += 80 * (1 - $p / $len1);
                }
            }
            #if-TXT
        }
    }
    #-- output results
    arsort($scored);
    $o = "<ol>\n";
    $n = 0;
    foreach ($scored as $id => $score) {
        #-- refetch page for top 10 entries (still cached by OS or DB)
        $row = $n < 10 ? ewiki_db::GET($id) : NULL;
        #-- check access rights in protected mode
        if (EWIKI_PROTECTED_MODE && !ewiki_auth($id, $row, "view", $ring = false, $force = 0)) {
            if (EWIKI_PROTECTED_MODE_HIDING) {
                continue;
            } else {
                $row["content"] = ewiki_t("FORBIDDEN");
            }
        }
        $o .= "<li>\n";
        $o .= '<div class="search-result ' . ($oe ^= 1 ? "odd" : "even") . '">' . '<a href="' . ewiki_script("", $id) . '">' . $id . "</a> " . "\n";
        #-- top 10 results are printed more verbosely
        if ($n++ < 10) {
            preg_match_all('/([_-\\w]+)/', $row["content"], $uu);
            $text = htmlentities(substr(implode(" ", $uu[1]), 0, 200));
            $o .= "<br />\n<small>{$text}\n" . "<br />" . strftime(ewiki_t("LASTCHANGED"), $row["lastmodified"]) . "<br /><br /></small>\n";
        }
        $o .= "</div>\n";
        $o .= "</li>\n";
    }
    $o .= "</ol>\n";
    return $o;
}
开发者ID:gpuenteallott,项目名称:rox,代码行数:60,代码来源:powersearch.php

示例2: ewiki_page_wiki_mini_tarball_dump

function ewiki_page_wiki_mini_tarball_dump($id, $data, $action)
{
    global $ewiki_config, $ewiki_plugins;
    #-- get all pages / binary files
    $result = ewiki_db::GETALL(array("id", "version", "flags"));
    if ($result) {
        #-- HTTP headers
        header("Content-Type: application/x-tar");
        header("Content-Disposition: attachment; filename=\"InitPages.tar.gz\"");
        #-- start tar file
        $tarball = new ewiki_virtual_tarball();
        $tarball->open(0);
        #-- convert all pages
        while ($row = $result->get(0, 0x1037)) {
            $id = $row["id"];
            $row = ewiki_db::GET($id);
            $content =& $row["content"];
            $fn = $id;
            if (!$row || !$row["id"] || !$row["content"]) {
                continue;
            }
            #-- for tarball
            $perms = array("mtime" => $row["lastmodified"], "uname" => "ewiki", "mode" => 0664 | ($row["flags"] & EWIKI_DB_F_WRITEABLE ? 02 : 00));
            #-- add file
            $tarball->add($fn, $content, $perms);
        }
        #-- end output
        $tarball->close();
    }
    #-- fin
    die;
}
开发者ID:gpuenteallott,项目名称:rox,代码行数:32,代码来源:minidump.php

示例3: ewiki_anacron_checktime

function ewiki_anacron_checktime()
{
    global $ewiki_plugins;
    if ($d = ewiki_db::GET(EWIKI_ANACRON_ID) and $d = unserialize($d["content"]) and $d["last"] >= UNIX_MILLENNIUM and time() >= $d["last"] + EWIKI_ANACRON_INTERLEAVE) {
        register_shutdown_function("ewiki_anacron_runparts");
    }
}
开发者ID:gpuenteallott,项目名称:rox,代码行数:7,代码来源:anacron.php

示例4: ewiki_load_editable_intermap

function ewiki_load_editable_intermap($uu = 0, $uu = 0, $uu = 0)
{
    global $ewiki_plugins, $ewiki_config;
    $inter =& $ewiki_config["interwiki"];
    #-- fetch from db
    $id = "EditableInterMap";
    if ($data = ewiki_db::GET($id)) {
        #-- extract entries
        if (preg_match_all('/^:(\\w+):([^\\s]+)/m', $data["content"], $uu)) {
            foreach ($uu[1] as $i => $moni) {
                if (!isset($inter[$moni])) {
                    $inter[$moni] .= $uu[2][$i];
                }
            }
        }
        /*
           WONT_WORK
           $refs = explode("\n", trim($data["refs"]));
           for ($n=1; $n<count($refs); $n++) {
              if (strpos($refs[$n], "://")) {
                 $moni = $refs[$n-1];
                 if (!isset($inter[$moni])) {
                    $inter[$moni] .= $refs[$n];
                 }
              }
           }
        */
        #-- enable _APPENDONLY part
        if ($data["flags"] & EWIKI_DB_F_APPENDONLY) {
            $ewiki_plugins["page"]["EditableInterMap"] = "ewiki_editable_intermap";
        }
    }
}
开发者ID:gpuenteallott,项目名称:rox,代码行数:33,代码来源:editable.php

示例5: ewiki_banned_link

function ewiki_banned_link($href)
{
    global $ewiki_config;
    #-- buffer list of banned urls
    if (!isset($ewiki_config["banned"])) {
        $data = ewiki_db::GET(EWIKI_PAGE_BANNED);
        $ewiki_config["banned"] = trim(strtolower($data["refs"]));
    }
    #-- check for entry
    if ($b =& $ewiki_config["banned"]) {
        $href = strtolower(urldecode($href));
        if (strpos($b, $href) !== false) {
            return true;
        }
        foreach (explode("\n", $b) as $bad) {
            if (strpos($href, $bad) !== false) {
                return true;
            }
        }
    }
    #-- advanced
    if ($pf_a = $ewiki_plugins["ban_lookup"]) {
        foreach ($pf_a as $pf) {
            if ($pf($href)) {
                return true;
            }
        }
    }
    return false;
}
开发者ID:gpuenteallott,项目名称:rox,代码行数:30,代码来源:zero_pagerank.php

示例6: ewiki_announcements

function ewiki_announcements($id, $data, $action)
{
    global $ewiki_plugins, $ewiki_config;
    if (!isset($GLOBALS['ewiki_auth_user'])) {
        return;
    }
    $notifyDates = ewiki_get_uservar("NotifyDates", FALSE);
    if (!$notifyDates) {
        $notifyDates = $ewiki_config["DefaultNotify"];
    } else {
        $notifyDates = unserialize($notifyDates);
    }
    foreach ($notifyDates as $pageName => $date) {
        $data = ewiki_db::GET($pageName);
        if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth($pageName, $data, "view")) {
            continue;
        }
        if ($data['lastmodified'] > $date) {
            $dispDate = $data['lastmodified'];
            $dispPage = $pageName;
            break;
        }
    }
    if (!isset($dispPage)) {
        return;
    }
    $notifyDates[$dispPage] = $dispDate;
    ewiki_set_uservar("NotifyDates", serialize($notifyDates));
    $o = ewiki_page('view/' . $dispPage);
    //page_final plugins have been run, unset them
    unset($ewiki_plugins["page_final"]);
    return $o;
}
开发者ID:gpuenteallott,项目名称:rox,代码行数:33,代码来源:announcements.php

示例7: ewiki_edit_load_template

function ewiki_edit_load_template($id, &$data, $action)
{
    if ($id = $_REQUEST["load_template"]) {
        $d2 = ewiki_db::GET($id);
        $data["content"] = $d2["content"];
    }
}
开发者ID:gpuenteallott,项目名称:rox,代码行数:7,代码来源:templates.php

示例8: ewiki_action_rss

function ewiki_action_rss($id, &$data, $action)
{
    $list = array();
    #-- recentchanges as rss
    if (strtoupper($id) == "RSS") {
        $res = ewiki_db::GETALL(array("id", "flags", "version", "lastmodified"));
        $sort = array();
        while ($data = $res->get(0, 0x137, EWIKI_DB_F_TEXT)) {
            $sort[$data["id"]] = $data["lastmodified"];
        }
        arsort($sort);
        $limit = 100;
        foreach ($sort as $id => $uu) {
            $list[] = ewiki_db::GET($id);
            if ($limit-- < 0) {
                break;
            }
        }
    } else {
        $list[] = $data;
        for ($v = $data["version"] - 1; $v >= 1; $v--) {
            $d = ewiki_db::GET($id, $v);
            $list[] = $d;
        }
    }
    ewiki_feed($list);
}
开发者ID:gpuenteallott,项目名称:rox,代码行数:27,代码来源:rss.php

示例9: ewiki_blocked_link

function ewiki_blocked_link($href, $LinkPage = EWIKI_PAGE_BLOCKED)
{
    global $ewiki_config, $ewiki_plugins;
    if (!($href = trim(strtolower(urldecode($href))))) {
        return;
    }
    #-- buffer list of banned urls
    if (!isset($ewiki_config[$LinkPage])) {
        $data = ewiki_db::GET($LinkPage);
        $ewiki_config[$LinkPage] = trim(strtolower($data["refs"]));
    }
    #-- check for entry
    if ($b =& $ewiki_config[$LinkPage]) {
        if (strpos($b, $href) !== false) {
            // quick string check
            return true;
        }
        foreach (explode("\n", $b) as $bad) {
            // use as patterns
            if (strlen($bad) && strpos($href, $bad) !== false) {
                return true;
            }
        }
    }
    #-- advanced
    if ($pf_a = $ewiki_plugins["ban_lookup"]) {
        foreach ($pf_a as $pf) {
            if ($pf($href)) {
                return true;
            }
        }
    }
    return false;
}
开发者ID:gpuenteallott,项目名称:rox,代码行数:34,代码来源:spam_block.php

示例10: ewiki_addpage

function ewiki_addpage($id, &$data, $version)
{
    $o = ewiki_make_title($id, $id, 2);
    #-- output page creation dialog
    if (empty($_REQUEST["new_id"])) {
        $o .= ewiki_t('<form action="' . ewiki_script("", $id) . '" method="POST" enctype="multipart/formdata"> ' . '_{name of the new page} <input type="text" name="new_id" size="26" value="">' . '<br />' . '<input type="submit" value="_{create}">' . '<br /><br />' . '<input type="checkbox" name="add_link_from" value="1" checked="checked">' . ' _{link it from} ' . '<input type="text" name="link_from" size="20" value="_{AddedPages}">' . '</form>');
    } else {
        $new_id = trim($_REQUEST["new_id"]);
        #-- add a link to new page
        if ($_REQUEST["add_link_from"] && ($from = $_REQUEST["link_from"])) {
            $row = ewiki_db::GET($from);
            if ($row && $row["version"]) {
                if (($row["flags"] & EWIKI_DB_F_TYPE) == EWIKI_DB_F_TEXT) {
                    $row["version"]++;
                    $row["content"] .= "\n* [{$new_id}]";
                    ewiki_scan_wikiwords($row["content"], $row["refs"], "_STRIP_EMAIL=1");
                    $row["refs"] = "\n\n" . implode("\n", array_keys($row["refs"])) . "\n\n";
                } else {
                    $row = false;
                }
            } else {
                $row = array("id" => $from, "version" => 1, "flags" => EWIKI_DB_F_TEXT, "created" => time(), "lastmodified" => time(), "hits" => 0, "meta" => "", "content" => "\n* [{$new_id}]", "refs" => "\n\n{$new_id}\n\n");
            }
            if ($row) {
                ewiki_db::WRITE($row);
            }
        }
        #-- call edit <form>
        $o = ewiki_page($new_id);
    }
    return $o;
}
开发者ID:gpuenteallott,项目名称:rox,代码行数:32,代码来源:addnewpage.php

示例11: ewiki_page_gnu_diff_safemode

function ewiki_page_gnu_diff_safemode($id, &$data, $action)
{
    #-- different operation modes of GNU diff:
    $OPTIONS = " -B -u -U 50 ";
    #   $OPTIONS = " -B ";
    #   $OPTIONS = " -c ";
    #   $OPTIONS = " --side-by-side ";
    #-- fetch old wiki source
    if (($old_ver = ($new_ver = $data["version"]) - 1) > 0) {
        $data0 = ewiki_db::GET($id, $old_ver);
    }
    $o = ewiki_make_title($id, "Differences between version {$new_ver} and {$old_ver} of »{$id}«");
    #-- create temporary files from wikipages
    $file0 = tempnam(EWIKI_TMP, "ewiki.diff.gnu.");
    $f = fopen($file0, "w");
    fwrite($f, $data0["content"]);
    fclose($f);
    $file1 = tempnam(EWIKI_TMP, "ewiki.diff.gnu.");
    $f = fopen($file1, "w");
    fwrite($f, $data["content"]);
    fclose($f);
    #-- parse thru GNU diff util
    $fn = addslashes($id);
    $OPTIONS .= " --label='{$fn} (version {$old_ver})' --label='{$fn} (version {$new_ver})' ";
    //following lines replace the original
    //$diff = shell_exec("diff $OPTIONS $file0 $file1");
    $dfd = popen("diff {$OPTIONS} {$file0} {$file1}", "r");
    $diff = "";
    while (!feof($dfd)) {
        $diff .= fread($dfd, 5000);
    }
    pclose($dfd);
    //end of moderation
    #-- remove temporary files
    unlink($file0);
    unlink($file1);
    #-- encolor diff output
    foreach (explode("\n", $diff) as $dl) {
        $str = substr($dl, 1);
        switch (substr($dl, 0, 1)) {
            case "<":
            case "-":
                $o .= "<b>-</b><font color=\"#990000\"> <tt>{$str}</tt></font><br />\n";
                break;
            case ">":
            case "+":
                $o .= "<b>+</b><font color=\"#009900\"> <tt>{$str}</tt></font><br />\n";
                break;
            case "*":
            case "-":
                break;
            default:
                $o .= "<small><tt>{$dl}</tt></small><br />";
        }
    }
    return $o;
}
开发者ID:gpuenteallott,项目名称:rox,代码行数:57,代码来源:diff_gnu_safemode.php

示例12: ewiki_mpi_survey

function ewiki_mpi_survey($action, &$args, &$iii, &$s)
{
    global $ewiki_id, $ewiki_plugins;
    $o = "";
    #-- load data page
    if (!($df = $args["data"])) {
        return;
    }
    unset($args["data"]);
    unset($args["_"]);
    unset($args[""]);
    $data = ewiki_db::GET($df);
    if (!$data["version"]) {
        $data = ewiki_new_data($df, EWIKI_DB_F_BINARY);
        $data["version"]--;
    }
    if ($data["flags"] != EWIKI_DB_F_BINARY) {
        return;
    }
    $survey = unserialize($data["content"]);
    #-- operation
    $vote = @$_REQUEST[EWIKI_UP_SURVEY];
    if ($vote == "\$") {
        $action = "show";
    }
    if ($action == "html") {
        #-- show entries
        if (!$vote) {
            $o = "\n" . '<form action="' . $_SERVER["REQUEST_URI"] . '" method="POST" enctype="multipart/form-data">' . '<input type="hidden" name="id" value="' . htmlentities($ewiki_id) . '">' . "\n";
            foreach ($args as $name => $text) {
                if (!$name || !$text || $name == "data") {
                    continue;
                }
                $o .= '<input type="radio" name="' . EWIKI_UP_SURVEY . '" value="' . htmlentities($name) . '"> ' . $text . "<br />\n";
            }
            $o .= '<input type="submit" value="vote">';
            $o .= "\n</form>\n<br /><br />\n";
            $o .= '<a href="' . ewiki_script("", $ewiki_id, array(EWIKI_UP_SURVEY => "\$")) . '">show results</a><br />';
        }
        #-- store an entry
        if ($vote) {
            $survey[$vote]++;
            $data["content"] = serialize($survey);
            $data["version"]++;
            $data["lastmodified"] = time();
            $data["author"] = ewiki_author();
            ewiki_db::WRITE($data);
            #-- show it
            $action = "show";
        }
    }
    if ($action == "show") {
        $o .= $ewiki_plugins["view_stat"][0]($survey, $args);
    }
    return $o;
}
开发者ID:gpuenteallott,项目名称:rox,代码行数:56,代码来源:mpi_survey.php

示例13: ewiki_edit_helptext

function ewiki_edit_helptext($id, &$data, &$hpost)
{
    global $ewiki_t;
    if ($help = ewiki_db::GET("EditingHelp")) {
        $help = ewiki_format($help["content"]);
        if ($l = strpos($help, "<hr")) {
            $ewiki_t["en"]["EDIT_FORM_1"] = substr($help, 0, $l);
            $l = strpos($help, ">", $l);
            $help = substr($help, $l + 1);
        }
        $ewiki_t["en"]["EDIT_FORM_2"] = $help;
    }
}
开发者ID:gpuenteallott,项目名称:rox,代码行数:13,代码来源:helptext.php

示例14: ewiki_trigger_spam_watchonly

function ewiki_trigger_spam_watchonly($id, &$data, &$action, $pf_i)
{
    #-- fetch list of tracked pages
    if ($d = ewiki_db::GET("WatchSpam")) {
        (array) ($ewiki_config["watchspam"] += explode("\n", trim($d["refs"])));
    }
    #-- disable all bot-blocking plugins?
    if (!ewiki_in_array($id, $ewiki_config["watchspam"])) {
        $GLOBALS["ewiki_no_bot"] = 1;
    } elseif ($action == "edit") {
        ewiki_log("someone is {$action}ing specifically watched page '{$id}'", 2);
    }
}
开发者ID:gpuenteallott,项目名称:rox,代码行数:13,代码来源:watchonly.php

示例15: ewiki_pingback_rpc

function ewiki_pingback_rpc($source_url, $target_url)
{
    global $ewiki_config;
    #-- does the target URL refer to a known WikiPage ?
    $id = ewiki_url2id($target_url);
    if (!$id) {
        xmlrpc_send_response(xmlrpc_error(0x21, "Could not determine PageName for the given target URL."));
    }
    if (!($data = ewiki_db::GET($id))) {
        xmlrpc_send_response(xmlrpc_error(0x20, "The given target page does not exist."));
    }
    #-- check if the caller really has a link as he claims
    ini_set("user_agent", $ewiki_config["ua"]);
    if (strpos($source_url, "http://") === 0 && ($test = ewiki_http_asis($source_url, 96256))) {
        $test = strtolower($test);
        $test_url = strtolower($target_url);
        if (!strpos($test, $test_url) and !strpos($test, htmlentities($test_url))) {
            return xmlrpc_error(0x11, "Sorry, but couldn't find a link to '{$target_url}' on your given '{$source_url}' page.");
        }
    } else {
        return xmlrpc_error(0x10, "Your given source URL does not exist, could not be retrieved.");
    }
    #-- reject other frivolous links
    if (preg_match('#^http://[^/]+/?$#', $source_url)) {
        return xmlrpc_error(0x11, "Rejected '{$source_url}' as frivolous.");
    }
    #-- check write permissions
    if (EWIKI_DB_F_TEXT != $data["flags"] & EWIKI_DB_F_TYPE or $data["flags"] & EWIKI_DB_F_READONLY) {
        return xmlrpc_error(0x31, "Sorry, but this page is write-protected or not a system page.");
    }
    #-- already on page
    if (strpos($data["content"], $source_url)) {
        return xmlrpc_error(0x30, "The given link does already exist on this page.");
    }
    #-- other go-away cases
    if (function_exists("ewiki_banned_url") && ewiki_banned_url($source_url) || function_exists("ewiki_blocked_url") && ewiki_blocked_url($source_url)) {
        return xmlrpc_error(0x100, "Your link is unwanted here (registered on BlockedLinks or BannedLinks).");
    }
    #-- else update page
    $data["content"] = rtrim($data["content"]) . "\n* {$source_url} (PingBack)\n";
    ewiki_db::UPDATE($data);
    $data["version"]++;
    $ok = ewiki_db::WRITE($data);
    #-- fin response
    if ($ok) {
        return "Link to '{$source_url}' was added to page '{$id}'.";
    } else {
        return xmlrpc_error(0x101, "Seems like a database/writing error occoured.");
    }
}
开发者ID:gpuenteallott,项目名称:rox,代码行数:50,代码来源:pingback.php


注:本文中的ewiki_db::GET方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。