本文整理汇总了PHP中doAuth函数的典型用法代码示例。如果您正苦于以下问题:PHP doAuth函数的具体用法?PHP doAuth怎么用?PHP doAuth使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了doAuth函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: define
define('PROTOCOL', 'http://');
break;
default:
define('PROTOCOL', 'https://');
break;
}
}
define("hu", PROTOCOL . $siteurl . '/');
// v1.0 experimental relative url global
define("rhu", preg_replace("/https?:\\/\\/.+(\\/.*)\\/?\$/U", "\$1", hu));
if (!empty($locale)) {
setlocale(LC_ALL, $locale);
}
$textarray = load_lang(LANG);
include txpath . '/include/txp_auth.php';
doAuth();
// individual user prefs
$prefs = get_user_prefs() + $prefs;
build_element_list($elements_main);
if ($elements_aux) {
build_element_list($elements_aux);
}
load_elements('init');
register_element_tabs();
$event = gps('event') ? gps('event') : 'article';
$step = gps('step');
if (!$dbversion or $dbversion != $thisversion or $txp_using_svn) {
define('TXP_UPDATE', 1);
include txpath . '/update/_update.php';
}
load_elements($event);
示例2: doArticles
//.........这里部分代码省略.........
$time = " AND Posted <= " . now('posted');
}
if (!$expired) {
$time .= " AND (" . now('expires') . " <= Expires OR Expires = " . NULLDATETIME . ")";
}
$custom = '';
if ($customFields) {
foreach ($customFields as $cField) {
if (isset($atts[$cField])) {
$customPairs[$cField] = $atts[$cField];
}
}
if (!empty($customPairs)) {
$custom = buildCustomSql($customFields, $customPairs);
}
}
// Allow keywords for no-custom articles. That tagging mode, you know.
if ($keywords) {
$keys = doSlash(do_list_unique($keywords));
foreach ($keys as $key) {
$keyparts[] = "FIND_IN_SET('" . $key . "', Keywords)";
}
$keywords = " AND (" . join(' or ', $keyparts) . ")";
}
if ($q and $searchsticky) {
$statusq = " AND Status >= " . STATUS_LIVE;
} elseif ($id) {
$statusq = " AND Status >= " . STATUS_LIVE;
} else {
$statusq = " AND Status = " . intval($status);
}
$where = "1 = 1" . $statusq . $time . $search . $id . $category . $section . $excerpted . $month . $author . $keywords . $custom . $frontpage;
// Do not paginate if we are on a custom list.
if (!$iscustom and !$issticky) {
$grand_total = safe_count('textpattern', $where);
$total = $grand_total - $offset;
$numPages = ceil($total / $pageby);
$pg = !$pg ? 1 : $pg;
$pgoffset = $offset + ($pg - 1) * $pageby;
// Send paging info to txp:newer and txp:older.
$pageout['pg'] = $pg;
$pageout['numPages'] = $numPages;
$pageout['s'] = $s;
$pageout['c'] = $c;
$pageout['context'] = 'article';
$pageout['grand_total'] = $grand_total;
$pageout['total'] = $total;
global $thispage;
if (empty($thispage)) {
$thispage = $pageout;
}
if ($pgonly) {
return;
}
} else {
$pgoffset = $offset;
}
// Preserve order of custom article ids unless 'sort' attribute is set.
if (!empty($atts['id']) && empty($atts['sort'])) {
$safe_sort = "FIELD(id, " . join(',', $ids) . ")";
} else {
$safe_sort = doSlash($sort);
}
$rs = safe_rows_start("*, UNIX_TIMESTAMP(Posted) AS uPosted, UNIX_TIMESTAMP(Expires) AS uExpires, UNIX_TIMESTAMP(LastMod) AS uLastMod" . $match, 'textpattern', "{$where} ORDER BY {$safe_sort} LIMIT " . intval($pgoffset) . ", " . intval($limit));
// Get the form name.
if ($q and !$iscustom and !$issticky) {
$fname = $searchform ? $searchform : 'search_results';
} else {
$fname = !empty($listform) ? $listform : $form;
}
if ($rs) {
$count = 0;
$last = numRows($rs);
$articles = array();
while ($a = nextRow($rs)) {
++$count;
populateArticleData($a);
global $thisarticle, $uPosted, $limit;
$thisarticle['is_first'] = $count == 1;
$thisarticle['is_last'] = $count == $last;
// Article form preview.
if (txpinterface === 'admin' && ps('Form')) {
doAuth();
if (!has_privs('form')) {
txp_status_header('401 Unauthorized');
exit(hed('401 Unauthorized', 1) . graf(gTxt('restricted_area')));
}
$articles[] = parse(gps('Form'));
} elseif ($allowoverride and $a['override_form']) {
$articles[] = parse_form($a['override_form']);
} else {
$articles[] = $thing ? parse($thing) : parse_form($fname);
}
// Sending these to paging_link(); Required?
$uPosted = $a['uPosted'];
unset($GLOBALS['thisarticle']);
}
return doLabel($label, $labeltag) . doWrap($articles, $wraptag, $break, $class);
}
}
示例3: action_trust
/**
* Ask the user whether he wants to trust this site
*/
function action_trust()
{
$info = getRequestInfo();
$trusted = isset($_POST['trust']);
return doAuth($info, $trusted, true, @$_POST['idSelect']);
}
示例4: action_trust
/**
* Ask the user whether he wants to trust this site
*/
function action_trust()
{
global $store;
$info = getRequestInfo();
$trusted = isset($_POST['trust']);
if ($info && isset($_POST['remember'])) {
$store->setTrustedSite($info->trust_root);
}
return doAuth($info, $trusted, true);
}
示例5: debug
} else {
debug("...not allowing");
$content = array("page", "Not a valid Wiki", "That (" . $request[0] . ") not a Wiki I am aware of, and current config forbids creation of arbitrary new wikis", "Aquarion (Admin)", date("r"));
}
} else {
debug("Loading wikipage " . $_EXTRAS['current']);
$content = wiki($request[0], $_EXTRAS['current']);
}
} else {
debug("Listing wikis");
$listOfwikis = $dataSource->listOfWikis();
foreach ($listOfwikis as $row) {
$out .= "# <a href=\"" . $row[0] . "\">" . $row[0] . "</a>, " . $row[1] . " pages\n";
}
$content = array("page", "Index of Wikis", $out, "Aquarion (Admin)", date("r"));
}
if (isset($_EXTRAS['reqUser'])) {
debug("Requiring auth " . $_EXTRAS['reqAuth']);
doAuth($_EXTRAS['reqUser'], "enter");
}
if (isset($_EXTRAS['reqAuth'])) {
debug("Requiring auth " . $_EXTRAS['reqAuth']);
doAuth($_EXTRAS['reqAuth'], "enter");
}
if (isset($_EXTRAS['reqUsers'])) {
debug("Requiring auth from users array");
doAuth($_EXTRAS['reqUsers'], "enter");
}
debug("Memory Track: " . number_format(memory_get_usage()));
echo page($content);
debug("Game over, No high score.");
示例6: doArticles
//.........这里部分代码省略.........
}
if (!$expired) {
$time .= " and (now() <= Expires or Expires = " . NULLDATETIME . ")";
}
$custom = '';
if ($customFields) {
foreach ($customFields as $cField) {
if (isset($atts[$cField])) {
$customPairs[$cField] = $atts[$cField];
}
}
if (!empty($customPairs)) {
$custom = buildCustomSql($customFields, $customPairs);
}
}
//Allow keywords for no-custom articles. That tagging mode, you know
if ($keywords) {
$keys = doSlash(do_list($keywords));
foreach ($keys as $key) {
$keyparts[] = "FIND_IN_SET('" . $key . "',Keywords)";
}
$keywords = " and (" . join(' or ', $keyparts) . ")";
}
if ($q and $searchsticky) {
$statusq = ' and Status >= 4';
} elseif ($id) {
$statusq = ' and Status >= 4';
} else {
$statusq = ' and Status = ' . intval($status);
}
$where = "1=1" . $statusq . $time . $search . $id . $category . $section . $excerpted . $month . $author . $keywords . $custom . $frontpage;
//do not paginate if we are on a custom list
if (!$iscustom and !$issticky) {
$grand_total = safe_count('textpattern', $where);
$total = $grand_total - $offset;
$numPages = ceil($total / $pageby);
$pg = !$pg ? 1 : $pg;
$pgoffset = $offset + ($pg - 1) * $pageby;
// send paging info to txp:newer and txp:older
$pageout['pg'] = $pg;
$pageout['numPages'] = $numPages;
$pageout['s'] = $s;
$pageout['c'] = $c;
$pageout['context'] = 'article';
$pageout['grand_total'] = $grand_total;
$pageout['total'] = $total;
global $thispage;
if (empty($thispage)) {
$thispage = $pageout;
}
if ($pgonly) {
return;
}
} else {
$pgoffset = $offset;
}
// preserve order of custom article ids unless 'sort' attribute is set
if (!empty($atts['id']) && empty($atts['sort'])) {
$safe_sort = 'field(id, ' . join(',', $ids) . ')';
} else {
$safe_sort = doSlash($sort);
}
$rs = safe_rows_start("*, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod" . $match, 'textpattern', $where . ' order by ' . $safe_sort . ' limit ' . intval($pgoffset) . ', ' . intval($limit));
// get the form name
if ($q and !$iscustom and !$issticky) {
$fname = $searchform ? $searchform : 'search_results';
} else {
$fname = $listform ? $listform : $form;
}
if ($rs) {
$count = 0;
$last = numRows($rs);
$articles = array();
while ($a = nextRow($rs)) {
++$count;
populateArticleData($a);
global $thisarticle, $uPosted, $limit;
$thisarticle['is_first'] = $count == 1;
$thisarticle['is_last'] = $count == $last;
filterAtts($theAtts);
// article form preview
if (txpinterface === 'admin' && ps('Form')) {
doAuth();
if (!has_privs('form')) {
txp_status_header('401 Unauthorized');
exit(hed('401 Unauthorized', 1) . graf(gTxt('restricted_area')));
}
$articles[] = parse(gps('Form'));
} elseif ($allowoverride and $a['override_form']) {
$articles[] = parse_form($a['override_form']);
} else {
$articles[] = $thing ? parse($thing) : parse_form($fname);
}
// sending these to paging_link(); Required?
$uPosted = $a['uPosted'];
unset($GLOBALS['thisarticle']);
}
return doLabel($label, $labeltag) . doWrap($articles, $wraptag, $break, $class);
}
}
示例7: wiki
//.........这里部分代码省略.........
$errors[] = "password cannot be blank";
} elseif ($_POST['password'] != $_POST['password2']) {
$errors[] = "passwords must match";
}
if (isset($_CONFIG['recaptcha_private_key'])) {
$privatekey = $_CONFIG['recaptcha_private_key'];
$resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
$errors[] = "Captcha invalid";
}
}
if (count($errors) == 0) {
$dataSource->newUser($_POST['username'], $_POST['name'], $_POST['password'], $_POST['email']);
sendAdminEmail('New User Created', $_POST);
$out = "h2. New user created\n\n";
$out .= "Hi, " . $_POST['name'] . ", Welcome to this aqWiki install.\n\n";
$url = parse_url($_SERVER['REQUEST_URI']);
$out .= "You should now \"login\":" . $url['path'] . "?action=login";
} else {
$out = "h2. Error in user creation\n\n";
foreach ($errors as $error) {
$out .= "* " . $error . "\n";
}
$out .= "\n\n" . $form;
}
} else {
$out = "h2. New user\n\n";
$out .= $form;
}
$content[2] = $out;
break;
case "edit":
if ($_EXTRAS['reqEdit']) {
doAuth($_EXTRAS['reqEdit'], "edit a page");
}
if ($_EXTRAS['restrictNewPages']) {
doAuth($_EXTRAS['restrictNewPages'], "create a new page");
}
$form = true;
$text = false;
switch ($_POST['submit']) {
case "Preview":
$out = $_POST['content'];
$text = stripslashes($_POST['content']);
break;
case "Spell Check":
$checker = new Spellchecker();
$text = strip_tags(textile($_POST['content']));
$num_errors = $checker->check($text);
if ($num_errors > 0) {
$out .= "h3. Spell Check\n\n";
#$out .= "Items <span class=\"spellCorrect\">like this</span> could be errors, hover over for suggestions. Items <span class=\"spellNoSuggest\">like this</span> arn't in the dictionary, and the spell checker has no idea.\n\n";
$errors = $checker->getErrors();
$oldtext = $text;
foreach ($errors as $word => $suggestions) {
/*$title = trim(implode(', ', $suggestions));
if ($title == ""){
$span = '<|-|'.$title.'|-|>'.$word.'</-|>';
} else {
$span = '<|||'.$title.'|||>'.$word.'</||>';
}*/
$suggs = implode(' ', $suggestions);
if ($suggs != " ") {
$errorlist .= "*" . $word . ":* " . $suggs . "\n\n";
} else {
$noidea[] = $word;
示例8: action_trust
/**
* Ask the user whether he wants to trust this site
*/
function action_trust()
{
$info = getRequestInfo();
$trusted = isset($_POST['trust']);
if ($info && isset($_POST['remember'])) {
$sites = getSessionSites();
$sites[$info->trust_root] = $trusted;
setSessionSites($sites);
}
return doAuth($info, $trusted, true);
}