本文整理汇总了PHP中ewiki_auth函数的典型用法代码示例。如果您正苦于以下问题:PHP ewiki_auth函数的具体用法?PHP ewiki_auth怎么用?PHP ewiki_auth使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ewiki_auth函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ewiki_uservar_collect
function ewiki_uservar_collect($id, $data, $action)
{
global $ewiki_plugins, $ewiki_config;
if (!isset($GLOBALS['ewiki_auth_user'])) {
return;
}
//Authenticate on the UserInfo page that we will be submitting to.
if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth('UserInfo', $uu, "view")) {
return;
}
foreach ($ewiki_config["CollectedUserData"] as $checkVar => $uu) {
if (strlen(ewiki_get_uservar($checkVar)) == 0) {
$currVar = $checkVar;
break;
}
}
if (isset($currVar)) {
$o = ewiki_make_title($id, "User data update", 2);
$o .= "Our database does not include your {$currVar}, please enter it below:";
$o .= '<p><form method="post" action="' . ewiki_script('UserInfo') . '"><table border="1" cellpadding="1">';
$o .= '<tr><th>' . $currVar . '</th><td><input name="text_' . $currVar . '" type="text"></td></tr>';
$o .= '<tr><td></td><td><input value="Submit Changes" type="submit" name="submit_changeaccount" /></td></tr>';
$o .= '</table></form>';
return $o;
}
}
示例2: ewiki_edit_form_append_pageimgcntrl
function ewiki_edit_form_append_pageimgcntrl($id, $data, $action)
{
global $ewiki_config;
#-- fetch and asort images
$sorted = array();
$result = ewiki_db::GETALL(array("flags", "created", "meta"));
while ($row = $result->get()) {
if (($row["flags"] & EWIKI_DB_F_TYPE) == EWIKI_DB_F_BINARY && strpos($row['meta']['Content-Type'], 'image/') === 0) {
if (isset($ewiki_config['image-galleries'][EWIKI_PAGE_LOGOCNTRL_GALLERY])) {
foreach ($ewiki_config['image-galleries'][EWIKI_PAGE_LOGOCNTRL_GALLERY] as $field => $value) {
if ($row['meta'][$field] != $value) {
continue 2;
}
}
}
if (!EWIKI_PROTECTED_MODE || EWIKI_PROTECTED_MODE_HIDING <= 0.5 || ewiki_auth($row["id"], $uu, "binary-get")) {
$sorted[$row["id"]] = substr($row['meta']["Content-Location"] . ' (' . $row["id"] . ')', 0, 70);
//echo("adding ".$row["id"].", ".$sorted[$row["id"]]."<br />");
}
}
}
arsort($sorted);
#-- start selector
$o = '
<br /><label for="pageimagecntrl">Choose Page Image (<A href="' . ewiki_script(EWIKI_PAGE_LOGOCNTRL_GALLERY) . '">view thumbnails</A>):</label>
<select id="pageimagecntrl" name="pageimagecntrl">' . '<option value="-1" ' . (!isset($data['meta']['pageimage']) || $data['meta']['pageimage'] == '' ? ' selected="selected"' : '') . '>None</option>';
foreach ($sorted as $image => $name) {
$o .= '<option value="' . htmlentities($image) . '"' . (isset($data['meta']['pageimage']) && $image == $data['meta']['pageimage'] ? ' selected="selected"' : '') . '>' . htmlentities($name) . '</option>';
}
$o .= "</select>\n";
return $o;
}
示例3: 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;
}
示例4: 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;
}
示例5: ewiki_page_wantedpages
function ewiki_page_wantedpages($id, $data, $action)
{
#-- collect referenced pages
$result = ewiki_db::GETALL(array("refs"));
while ($row = $result->get()) {
if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth($row["id"], $uu, "view")) {
continue;
}
$refs .= $row["refs"];
}
#-- build array
$refs = array_unique(explode("\n", $refs));
#-- strip existing pages from array
$refs = ewiki_db::FIND($refs);
foreach ($refs as $id => $exists) {
if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth($row["id"], $uu, "view")) {
continue;
}
if (!$exists && !strstr($id, "://") && strlen(trim($id))) {
$wanted[] = $id;
}
}
#-- print out
$o .= "<ul>\n";
foreach ($wanted as $page) {
$o .= " <li>" . ewiki_link($page) . "</li>\n";
}
$o .= "<ul>\n";
return $o;
}
示例6: ewiki_page_wordindex
function ewiki_page_wordindex($id, $data, $action)
{
global $ewiki_plugins;
$o = ewiki_make_title($id, $id, 2);
$src = "";
$result = ewiki_db::GETALL(array("flags"));
while ($row = $result->get()) {
if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth($row["id"], $uu, "view")) {
continue;
}
if (($row["flags"] & EWIKI_DB_F_TYPE) == EWIKI_DB_F_TEXT) {
$src .= " " . $row["id"];
}
}
$src = ewiki_split_title($src, "SPLIT", 0);
$chars = strtr(EWIKI_CHARS_U . EWIKI_CHARS_L, "_", " ");
$src = preg_replace("/[^{$chars}]/", " ", $src);
$src = explode(" ", $src);
$src = array_unique($src);
//@ADD: word counting
unset($src[""]);
natcasesort($src);
$sorted = array();
foreach ($src as $i => $word) {
if (strlen($word) >= 2) {
$sorted[] = array(EWIKI_PAGE_POWERSEARCH, array("where" => "id", "q" => $word), $word, "");
}
}
unset($src);
$pf_list_pages = $ewiki_plugins["list_dict"][0];
$o .= ewiki_list_pages($sorted, $limit = 0, $vat = 1, $pf_list_pages);
return $o;
}
示例7: ewiki_page_wiki_dump_tarball
function ewiki_page_wiki_dump_tarball($id = 0, $data = 0, $action = 0)
{
#-- return legacy page
if (empty($_REQUEST["download_tarball"])) {
if ($action == "wikidump") {
$url = ewiki_script("", "WikiDump");
return ewiki_make_title($id, $id, 2) . ewiki_t(<<<END
_{WIKIDUMP}
<br /><br />
<form action="{$url}" method="POST" enctype="multipart/form-data">
<input type="hidden" name="dump_id" value="{$id}">
<input type="hidden" name="dump_depth" value=1>
<input type="submit" name="download_tarball" value= "_{DOWNLOAD_ARCHIVE}">
<br /><br />
<input type="checkbox" name="dump_images" value="1" checked> _{with images}<br />
<input type="hidden" name="dump_fullhtml" value="1">
<input type="hidden" name="dump_virtual" value="0"><br />
Archive Format:
<select NAME="dump_arctype">
<option VALUE="ZIP">ZIP
<option VALUE="TAR">TAR
</select>
</form>
END
);
} else {
return "";
}
} else {
$di = $_REQUEST["dump_images"];
$fh = $_REQUEST["dump_fullhtml"];
$vp = $_REQUEST["dump_virtual"];
$rp = $_REQUEST["dump_id"];
#-- $_REQUEST["dump_depth"]==100 will give a complete dump
if ($_REQUEST["dump_depth"] > EWIKI_WIKIDUMP_MAXLEVEL && $_REQUEST["dump_depth"] != 100) {
$dd = EWIKI_WIKIDUMP_MAXLEVEL;
} else {
$dd = $_REQUEST["dump_depth"];
}
$at = $_REQUEST["dump_arctype"];
$al = 9;
#$_REQUEST["dump_arclevel"];
$_REQUEST = $_GET = $_POST = array();
if (!ewiki_auth($rp, $str_null, "view")) {
return ewiki_make_title($id, $id, 2) . "<p>You either do not have permission to access the page {$rp} or it does not exist.</p>";
}
ewiki_page_wiki_dump_send($di, $fh, $vp, $rp, $dd, $at, $al);
}
}
示例8: ewiki_subpage_list
function ewiki_subpage_list($id, $postfix = "")
{
$_hiding = EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING;
$result = ewiki_db::SEARCH("id", $id . $postfix);
while ($row = $result->get()) {
#-- retrieve and check rights if running in protected mode
if ($_hiding) {
if (!ewiki_auth($row["id"], $uu, 'view', $ring = false, $force = 0)) {
continue;
}
}
$pages[$row["id"]] = "";
}
return $pages;
}
示例9: ewiki_page_like
function ewiki_page_like($id, $data, $action)
{
preg_match_all("/([" . EWIKI_CHARS_U . "][" . EWIKI_CHARS_L . "]+)/", $id, $words);
$pages = array();
foreach ($words[1] as $find) {
$result = ewiki_db::SEARCH("id", $find);
while ($row = $result->get()) {
if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth($row["id"], $row, "view")) {
continue;
}
$pages[$row["id"]] = "";
}
}
$o = ewiki_make_title($id, ewiki_t(strtoupper($action) . "_TITLE"), 3);
$o .= ewiki_list_pages($pages, 0);
return $o;
}
示例10: ewiki_page_random
function ewiki_page_random(&$id, &$data, $action)
{
global $ewiki_plugins;
$result = ewiki_db::GETALL(array("flags"));
while ($row = $result->get()) {
if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth($row["id"], $uu, "view")) {
continue;
}
if (($row["flags"] & EWIKI_DB_F_TYPE) == EWIKI_DB_F_TEXT) {
$pages[] = $row["id"];
}
}
$pages = array_merge($pages, $ewiki_plugins["page"]);
$n = rand(0, count($pages));
$id = $pages[$n];
return ewiki_page($id);
}
示例11: ewiki_page_wantedpages
function ewiki_page_wantedpages($id, $data, $action)
{
$wanted = array();
#-- collect referenced pages
$result = ewiki_database("GETALL", array("refs"));
while ($row = $result->get()) {
if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth($row["id"], $uu, "view")) {
continue;
}
$refs .= $row["refs"];
}
#-- build array
$refs = array_unique(explode("\n", $refs));
#-- strip existing pages from array
$refs = ewiki_database("FIND", $refs);
foreach ($refs as $id => $exists) {
if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth($row["id"], $uu, "view")) {
continue;
}
if (!$exists && !strstr($id, "://") && strlen(trim($id))) {
$wanted[] = $id;
}
}
// to prevent empty <ul></ul> getting printed out, we have to interate twice.
// once to make sure the <ul></ul> is needed at all.
// MDL-7861, <ul></ul> does not validate.
$printul = false;
foreach ($wanted as $page) {
$link = ewiki_link_regex_callback(array($page, $page));
if (strstr($link, "?</a>")) {
$printul = true;
}
}
#-- print out
if ($printul) {
$o .= "<ul>";
foreach ($wanted as $page) {
$link = ewiki_link_regex_callback(array($page, $page));
if (strstr($link, "?</a>")) {
$o .= "<li>" . $link . "</li>";
}
}
$o .= "</ul>";
}
return $o;
}
示例12: ewiki_view_append_attachments
function ewiki_view_append_attachments($id, $data, $action)
{
$o = '<hr><h4><a href="' . ewiki_script(EWIKI_ACTION_ATTACHMENTS, $id) . '">' . ewiki_t("ATTACHMENTS") . '</a></h4>';
$scan = 's:7:"section";' . serialize($id);
$result = ewiki_db::SEARCH("meta", $scan);
$ord = array();
while ($row = $result->get()) {
$ord[$row["id"]] = $row["created"];
}
arsort($ord);
foreach ($ord as $id => $uu) {
$row = ewiki_db::GET($id);
if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth($row["id"], $row, "view")) {
continue;
}
$o .= ewiki_entry_downloads($row, "*");
}
return $o;
}
示例13: mkLiveWebNavBar
function mkLiveWebNavBar($navBarPage, $activePage)
{
#-- fetch from db
$data = ewiki_db::GET($navBarPage);
#-- Authenticate, return nothing if authentication fails
if (!ewiki_auth($navBarPage, $data, EWIKI_NAVBAR_ACTION, $ring = 3, $force = 0)) {
return "";
}
#-- escape if navBarPage does not exist or was not retrieved.
if (empty($data["content"])) {
return "";
}
//echo(":".$data["content"].":");
$o .= ewiki_navbar_format($data["content"], 1, urlencode($activePage));
//Apply class only if we have a bar at all
if ($o) {
return " <div class='wikiNavBar' >\n" . $o . "\n</div>\n";
}
return "";
}
示例14: ewiki_page_orphanedpages
function ewiki_page_orphanedpages($id, $data, $action)
{
global $ewiki_links;
$o = ewiki_make_title($id, ewiki_t($id), 2);
$pages = array();
$refs = array();
$orphaned = array();
#-- read database
$db = ewiki_database("GETALL", array("refs", "flags"));
$n = 0;
while ($row = $db->get()) {
$p = $row["id"];
#-- remove self-reference
$row["refs"] = str_replace("\n{$p}\n", "\n", $row["refs"]);
#-- add to list of referenced pages
$rf = explode("\n", trim($row["refs"]));
$refs = array_merge($refs, $rf);
if ($n++ > 299) {
$refs = array_unique($refs);
$n = 0;
}
// (clean-up only every 300th loop)
#-- add page name
if (($row["flags"] & EWIKI_DB_F_TYPE) == EWIKI_DB_F_TEXT) {
$pages[] = $row["id"];
}
}
$refs = array_unique($refs);
#-- check pages to be referenced from somewhere
foreach ($pages as $p) {
if (!ewiki_in_array($p, $refs)) {
if (!EWIKI_PROTECTED_MODE || EWIKI_PROTECTED_MODE_HIDING || ewiki_auth($p, $uu, "view")) {
$orphaned[] = $p;
}
}
}
#-- output
$o .= ewiki_list_pages($orphaned, 0);
return $o;
}
示例15: ewiki_page_index
function ewiki_page_index($id = 0, $data = 0, $action = 0, $args = array())
{
global $ewiki_plugins;
$o = ewiki_make_title($id, ewiki_t($id), 2);
$sorted = array();
$sorted = array_merge($sorted, array_keys($ewiki_plugins["page"]));
$exclude = "\n" . implode("\n", preg_split("/\\s*[,;:\\|]\\s*/", $args["exclude"])) . "\n";
$result = ewiki_database("GETALL", array("flags"));
while ($row = $result->get()) {
if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth($row["id"], $uu, "view")) {
continue;
}
if (($row["flags"] & EWIKI_DB_F_TYPE) == EWIKI_DB_F_TEXT) {
if (!stristr($exclude, "\n" . $row["id"] . "\n")) {
$sorted[] = $row["id"];
}
}
}
natcasesort($sorted);
$o .= ewiki_list_pages($sorted, 0, 0, $ewiki_plugins["list_dict"][0]);
return $o;
}