本文整理汇总了PHP中IsEnabled函数的典型用法代码示例。如果您正苦于以下问题:PHP IsEnabled函数的具体用法?PHP IsEnabled怎么用?PHP IsEnabled使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsEnabled函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Merge
function Merge($newtext,$oldtext,$pagetext) {
global $WorkDir,$SysMergeCmd, $SysMergePassthru;
SDV($SysMergeCmd,"/usr/bin/diff3 -L '' -L '' -L '' -m -E");
if (substr($newtext,-1,1)!="\n") $newtext.="\n";
if (substr($oldtext,-1,1)!="\n") $oldtext.="\n";
if (substr($pagetext,-1,1)!="\n") $pagetext.="\n";
$tempnew = tempnam($WorkDir,"new");
$tempold = tempnam($WorkDir,"old");
$temppag = tempnam($WorkDir,"page");
if ($newfp=fopen($tempnew,'w')) { fputs($newfp,$newtext); fclose($newfp); }
if ($oldfp=fopen($tempold,'w')) { fputs($oldfp,$oldtext); fclose($oldfp); }
if ($pagfp=fopen($temppag,'w')) { fputs($pagfp,$pagetext); fclose($pagfp); }
$mergetext = '';
if (IsEnabled($SysMergePassthru, 0)) {
ob_start();
passthru("$SysMergeCmd $tempnew $tempold $temppag");
$mergetext = ob_get_clean();
}
else {
$merge_handle = popen("$SysMergeCmd $tempnew $tempold $temppag",'r');
if ($merge_handle) {
while (!feof($merge_handle)) $mergetext .= fread($merge_handle,4096);
pclose($merge_handle);
}
}
@unlink($tempnew); @unlink($tempold); @unlink($temppag);
return $mergetext;
}
示例2: FastCacheUpdate
function FastCacheUpdate($pagename, &$page, &$new)
{
global $IsPagePosted;
global $FastCacheDir, $FastCacheInvalidateAllOnUpdate;
if (!$IsPagePosted || !$FastCacheDir) {
return;
}
if (IsEnabled($FastCacheInvalidateAllOnUpdate, TRUE)) {
if (is_dir($FastCacheDir) && ($fd = opendir($FastCacheDir))) {
while (($fh = readdir($fd)) !== FALSE) {
if ($fh[0] == '.') {
continue;
}
if (!unlink("{$FastCacheDir}/{$fh}")) {
StopWatch("FastCacheUpdate: error unlinking file {$FastCacheDir}/{$fh} > stopping");
return;
}
}
} else {
StopWatch("FastCacheUpdate: error opening directory {$FastCacheDir}");
return;
}
} else {
SDV($FastCacheSuffix, '.html');
$fcfile = "{$FastCacheDir}/{$pagename}{$FastCacheSuffix}";
if (is_file($fcfile)) {
if (!unlink($fcfile)) {
StopWatch("FastCacheUpdate: error unlinking file {$fcfile}");
}
}
}
}
示例3: EditDraft
function EditDraft(&$pagename, &$page, &$new)
{
global $WikiDir, $DraftSuffix, $DeleteKeyPattern, $EnableDraftAtomicDiff, $DraftRecentChangesFmt, $RecentChangesFmt, $Now;
SDV($DeleteKeyPattern, "^\\s*delete\\s*\$");
$basename = preg_replace("/{$DraftSuffix}\$/", '', $pagename);
$draftname = $basename . $DraftSuffix;
if ($_POST['postdraft'] || $_POST['postedit']) {
$pagename = $draftname;
} else {
if ($_POST['post'] && !preg_match("/{$DeleteKeyPattern}/", $new['text'])) {
$pagename = $basename;
if (IsEnabled($EnableDraftAtomicDiff, 0)) {
$page = ReadPage($basename);
foreach ($new as $k => $v) {
# delete draft history
if (preg_match('/:\\d+(:\\d+:)?$/', $k) && !preg_match("/:{$Now}(:\\d+:)?\$/", $k)) {
unset($new[$k]);
}
}
unset($new['rev']);
SDVA($new, $page);
}
$WikiDir->delete($draftname);
} else {
if (PageExists($draftname) && $pagename != $draftname) {
Redirect($draftname, '$PageUrl?action=edit');
exit;
}
}
}
if ($pagename == $draftname && isset($DraftRecentChangesFmt)) {
$RecentChangesFmt = $DraftRecentChangesFmt;
}
}
示例4: FmtUploadList2
function FmtUploadList2($pagename, $args)
{
global $UploadDir, $UploadPrefixFmt, $UploadUrlFmt, $EnableUploadOverwrite, $FileListTimeFmt, $EnableDirectDownload, $HTMLStylesFmt, $FarmPubDirUrl;
$HTMLStylesFmt['filelist'] = "\r\n table.filelist { padding:0; margin:0; border-spacing:0; }\r\n table.filelist td { padding:3px 0 0 0; margin:0; }\r\n .filelist a { text-decoration:underline; }\r\n .dotted { background:url({$FarmPubDirUrl}/images/dot3.png) repeat-x bottom; }\r\n .nodots { background:#feffff; }\r\n ";
$opt = ParseArgs($args);
if (@$opt[''][0]) {
$pagename = MakePageName($pagename, $opt[''][0]);
}
if (@$opt['re']) {
$matchre = '/^(' . $opt['re'] . ')$/i';
}
if (@$opt['ext']) {
$matchext = '/\\.(' . implode('|', preg_split('/\\W+/', $opt['ext'], -1, PREG_SPLIT_NO_EMPTY)) . ')$/i';
}
$uploaddir = FmtPageName("{$UploadDir}{$UploadPrefixFmt}", $pagename);
$uploadurl = FmtPageName(IsEnabled($EnableDirectDownload, 1) ? "{$UploadUrlFmt}{$UploadPrefixFmt}/" : "\$PageUrl?action=download&upname=", $pagename);
$dirp = @opendir($uploaddir);
if (!$dirp) {
return '';
}
$filelist = array();
while (($file = readdir($dirp)) !== false) {
if ($file[0] == '.') {
continue;
}
if (@$matchext && !preg_match(@$matchext, $file)) {
continue;
}
if (@$matchre && !preg_match(@$matchre, $file)) {
continue;
}
$filelist[$file] = $file;
}
closedir($dirp);
$out = array();
#asort($filelist);
$overwrite = '';
foreach ($filelist as $file => $x) {
$name = PUE("{$uploadurl}{$file}");
$stat = stat("{$uploaddir}/{$file}");
if ($EnableUploadOverwrite) {
$overwrite = FmtPageName("<a class='createlink'\r\n href='\$PageUrl?action=upload&upname={$file}'> Δ</a>", $pagename);
}
$out[] = "<tr><td class='dotted'> <a href='{$name}'>{$file}</a>{$overwrite} </td>" . "<td class='dotted' align=right><span class='nodots'>" . number_format($stat['size'] / 1024) . "Kb</span></td>" . "<td> " . strftime($FileListTimeFmt, $stat['mtime']) . "</td>" . "<tr>";
}
return implode("\n", $out);
}
示例5: LinkHTTP
function LinkHTTP($pagename, $imap, $path, $title, $txt, $fmt = NULL)
{
global $EnableUrlApprovalRequired, $IMap, $WhiteUrlPatterns, $FmtV, $UnapprovedLinkFmt;
if (!IsEnabled($EnableUrlApprovalRequired, 1)) {
return LinkIMap($pagename, $imap, $path, $title, $txt, $fmt);
}
static $havereadpages;
if (!$havereadpages) {
ReadApprovedUrls($pagename);
$havereadpages = true;
}
$p = str_replace(' ', '%20', $path);
$url = str_replace('$1', $p, $IMap[$imap]);
foreach ((array) $WhiteUrlPatterns as $pat) {
if (preg_match("!^{$pat}(/|\$)!", $url)) {
return LinkIMap($pagename, $imap, $path, $title, $txt, $fmt);
}
}
$FmtV['$LinkText'] = $txt;
return FmtPageName($UnapprovedLinkFmt, $pagename);
}
示例6: Markup
Markup('[[', 'links', "/(?>\\[\\[\\s*(.*?)\\]\\])({$SuffixPattern})/e", "Keep(MakeLink(\$pagename,PSS('\$1'),NULL,'\$2'),'L')");
## [[!Category]]
SDV($CategoryGroup, 'Category');
SDV($LinkCategoryFmt, "<a class='categorylink' href='\$LinkUrl'>\$LinkText</a>");
Markup('[[!', '<[[', '/\\[\\[!(.*?)\\]\\]/e', "Keep(MakeLink(\$pagename,PSS('{$CategoryGroup}/\$1'),NULL,'',\$GLOBALS['LinkCategoryFmt']),'L')");
# This is a temporary workaround for blank category pages.
# It may be removed in a future release (Pm, 2006-01-24)
if (preg_match("/^{$CategoryGroup}\\./", $pagename)) {
SDV($DefaultPageTextFmt, '');
SDV($PageNotFoundHeaderFmt, 'HTTP/1.1 200 Ok');
}
## [[target | text]]
Markup('[[|', '<[[', "/(?>\\[\\[([^|\\]]*)\\|\\s*)(.*?)\\s*\\]\\]({$SuffixPattern})/e", "Keep(MakeLink(\$pagename,PSS('\$1'),PSS('\$2'),'\$3'),'L')");
## [[text -> target ]]
Markup('[[->', '>[[|', "/(?>\\[\\[([^\\]]+?)\\s*-+>\\s*)(.*?)\\]\\]({$SuffixPattern})/e", "Keep(MakeLink(\$pagename,PSS('\$2'),PSS('\$1'),'\$3'),'L')");
if (IsEnabled($EnableRelativePageLinks, 1)) {
SDV($QualifyPatterns['/(\\[\\[(?>[^\\]]+?->)?\\s*)([-\\w\\s\']+([|#?].*?)?\\]\\])/e'], "PSS('\$1').\$group.PSS('/\$2')");
}
## [[#anchor]]
Markup('[[#', '<[[', '/(?>\\[\\[#([A-Za-z][-.:\\w]*))\\]\\]/e', "Keep(TrackAnchors('\$1') ? '' : \"<a name='\$1' id='\$1'></a>\", 'L')");
function TrackAnchors($x)
{
global $SeenAnchor;
return @$SeenAnchor[$x]++;
}
## [[target |#]] reference links
Markup('[[|#', '<[[|', "/(?>\\[\\[([^|\\]]+))\\|\\s*#\\s*\\]\\]/e", "Keep(MakeLink(\$pagename,PSS('\$1'),'['.++\$MarkupFrame[0]['ref'].']'),'L')");
## [[target |+]] title links
Markup('[[|+', '<[[|', "/(?>\\[\\[([^|\\]]+))\\|\\s*\\+\\s*]]/e", "Keep(MakeLink(\$pagename, PSS('\$1'),\n PageVar(MakePageName(\$pagename,PSS('\$1')), '\$Title')\n ),'L')");
## bare urllinks
Markup('urllink', '>[[', "/\\b(?>(\\L))[^\\s{$UrlExcludeChars}]*[^\\s.,?!{$UrlExcludeChars}]/e", "Keep(MakeLink(\$pagename,'\$0','\$0'),'L')");
示例7: BlockUnapprovedPosts
function BlockUnapprovedPosts($pagename, &$page, &$new)
{
global $EnableUrlApprovalRequired, $UnapprovedLinkCount, $UnapprovedLinkCountMax, $EnablePost, $MessagesFmt, $BlockMessageFmt;
if (!IsEnabled($EnableUrlApprovalRequired, 1)) {
return;
}
if ($UnapprovedLinkCount <= $UnapprovedLinkCountMax) {
return;
}
if ($page['=auth']['admin']) {
return;
}
$EnablePost = 0;
$MessagesFmt[] = $BlockMessageFmt;
}
示例8: MakePageList
function MakePageList($pagename, $opt)
{
global $MakePageListOpt, $SearchPatterns, $EnablePageListProtect, $PCache, $FmtV;
StopWatch('MakePageList begin');
SDVA($MakePageListOpt, array('list' => 'default'));
$opt = array_merge((array) $MakePageListOpt, $opt);
$readf = $opt['readf'];
# we have to read the page if order= is anything but name
$order = $opt['order'];
$readf |= $order && $order != 'name' && $order != '-name';
$pats = @(array) $SearchPatterns[$opt['list']];
if (@$opt['group']) {
array_unshift($pats, "/^({$opt['group']})\\./i");
}
# inclp/exclp contain words to be included/excluded.
$inclp = array();
$exclp = array();
foreach ((array) @$opt[''] as $i) {
$inclp[] = '/' . preg_quote($i, '/') . '/i';
}
foreach ((array) @$opt['+'] as $i) {
$inclp[] = '/' . preg_quote($i, '/') . '/i';
}
foreach ((array) @$opt['-'] as $i) {
$exclp[] = '/' . preg_quote($i, '/') . '/i';
}
$searchterms = count($inclp) + count($exclp);
$readf += $searchterms;
# forced read if incl/excl
if (@$opt['trail']) {
$trail = ReadTrail($pagename, $opt['trail']);
foreach ($trail as $tstop) {
$pn = $tstop['pagename'];
$list[] = $pn;
$tstop['parentnames'] = array();
PCache($pn, $tstop);
}
foreach ($trail as $tstop) {
$PCache[$tstop['pagename']]['parentnames'][] = $trail[$tstop['parent']]['pagename'];
}
} else {
$list = ListPages($pats);
}
if (IsEnabled($EnablePageListProtect, 0)) {
$readf = 1000;
}
$matches = array();
$FmtV['$MatchSearched'] = count($list);
# link= (backlinks)
if (@$opt['link']) {
$link = MakePageName($pagename, $opt['link']);
$linkpat = "/(^|,){$link}(,|\$)/i";
$readf++;
$xlist = BacklinksTo($link, false);
$list = array_diff($list, $xlist);
}
$xlist = array();
StopWatch('MakePageList scan');
foreach ((array) $list as $pn) {
if ($readf) {
$page = $readf >= 1000 ? RetrieveAuthPage($pn, 'read', false, READPAGE_CURRENT) : ReadPage($pn, READPAGE_CURRENT);
if (!$page) {
continue;
}
if (@$linkpat && !preg_match($linkpat, @$page['targets'])) {
$PCache[$pn]['targets'] = @$page['targets'];
$xlist[] = $pn;
continue;
}
if ($searchterms) {
$text = $pn . "\n" . @$page['targets'] . "\n" . @$page['text'];
foreach ($inclp as $i) {
if (!preg_match($i, $text)) {
continue 2;
}
}
foreach ($exclp as $i) {
if (preg_match($i, $text)) {
continue 2;
}
}
}
$page['size'] = strlen(@$page['text']);
} else {
$page = array();
}
$page['pagename'] = $page['name'] = $pn;
PCache($pn, $page);
$matches[] =& $PCache[$pn];
}
StopWatch('MakePageList sort');
SortPageList($matches, $order);
StopWatch('MakePageList update');
if ($xlist) {
LinkIndexUpdate($xlist);
}
StopWatch('MakePageList end');
return $matches;
}
示例9: recode
function recode($pagename, $a) {
if(!$a) return false;
global $Charset, $PageRecodeFunction, $DefaultPageCharset, $EnableOldCharset;
if (function_exists($PageRecodeFunction)) return $PageRecodeFunction($a);
if (IsEnabled($EnableOldCharset)) $a['=oldcharset'] = @$a['charset'];
SDVA($DefaultPageCharset, array(''=>@$Charset)); # pre-2.2.31 RecentChanges
if (@$DefaultPageCharset[$a['charset']]>'') # wrong pre-2.2.30 encs. *-2, *-9, *-13
$a['charset'] = $DefaultPageCharset[@$a['charset']];
if (!$a['charset'] || $Charset==$a['charset']) return $a;
$from = ($a['charset']=='ISO-8859-1') ? 'WINDOWS-1252' : $a['charset'];
$to = ($Charset=='ISO-8859-1') ? 'WINDOWS-1252' : $Charset;
if ($this->recodefn) $F = $this->recodefn;
elseif ($to=='UTF-8' && $from=='WINDOWS-1252') # utf8 wiki & pre-2.2.30 doc
$F = create_function('$s,$from,$to', 'return utf8_encode($s);');
elseif ($to=='WINDOWS-1252' && $from=='UTF-8') # 2.2.31+ documentation
$F = create_function('$s,$from,$to', 'return utf8_decode($s);');
else return $a;
foreach($a as $k=>$v) $a[$k] = $F($v,$from,$to);
$a['charset'] = $Charset;
return $a;
}
示例10: HandlePostAttr
function HandlePostAttr($pagename)
{
global $PageAttributes, $EnablePostAttrClearSession;
Lock(2);
$page = RetrieveAuthPage($pagename, 'attr', true, READPAGE_CURRENT);
if (!$page) {
Abort("?unable to read {$pagename}");
}
foreach ($PageAttributes as $attr => $p) {
$v = @$_POST[$attr];
if ($v == '') {
continue;
}
if ($v == 'clear') {
unset($page[$attr]);
} else {
if (strncmp($attr, 'passwd', 6) != 0) {
$page[$attr] = $v;
} else {
$a = array();
foreach (preg_split('/\\s+/', $v, -1, PREG_SPLIT_NO_EMPTY) as $pw) {
$a[] = preg_match('/^\\w+:/', $pw) ? $pw : crypt($pw);
}
if ($a) {
$page[$attr] = implode(' ', $a);
}
}
}
}
WritePage($pagename, $page);
Lock(0);
if (IsEnabled($EnablePostAttrClearSession, 1)) {
@session_start();
unset($_SESSION['authid']);
$_SESSION['authpw'] = array();
}
Redirect($pagename);
exit;
}
示例11: NotifyUpdate
function NotifyUpdate($pagename, $dir = '')
{
global $NotifyList, $NotifyListPageFmt, $NotifyFile, $IsPagePosted, $IsUploadPosted, $FmtV, $NotifyTimeFmt, $NotifyItemFmt, $SearchPatterns, $NotifySquelch, $NotifyDelay, $Now, $Charset, $EnableNotifySubjectEncode, $NotifySubjectFmt, $NotifyBodyFmt, $NotifyHeaders, $NotifyParameters;
$abort = ignore_user_abort(true);
if ($dir) {
flush();
chdir($dir);
}
$GLOBALS['EnableRedirect'] = 0;
## Read in the current notify configuration
$pn = FmtPageName($NotifyListPageFmt, $pagename);
$npage = ReadPage($pn, READPAGE_CURRENT);
preg_match_all('/^[\\s*:#->]*(notify[:=].*)/m', $npage['text'], $nlist);
$nlist = array_merge((array) @$NotifyList, (array) @$nlist[1]);
if (!$nlist) {
return;
}
## make sure other processes are locked out
Lock(2);
## let's load the current .notifylist table
$nfile = FmtPageName($NotifyFile, $pagename);
$nfp = @fopen($nfile, 'r');
if ($nfp) {
## get our current squelch and delay timestamps
clearstatcache();
$sz = filesize($nfile);
list($nextevent, $firstpost) = explode(' ', rtrim(fgets($nfp, $sz)));
## restore our notify array
$notify = unserialize(fgets($nfp, $sz));
fclose($nfp);
}
if (!is_array($notify)) {
$notify = array();
}
## if this is for a newly posted page, get its information
if ($IsPagePosted || $IsUploadPosted) {
$page = ReadPage($pagename, READPAGE_CURRENT);
$FmtV['$PostTime'] = strftime($NotifyTimeFmt, $Now);
$item = urlencode(FmtPageName($NotifyItemFmt, $pagename));
if ($firstpost < 1) {
$firstpost = $Now;
}
}
foreach ($nlist as $n) {
$opt = ParseArgs($n);
$mailto = preg_split('/[\\s,]+/', $opt['notify']);
if (!$mailto) {
continue;
}
if ($opt['squelch']) {
foreach ($mailto as $m) {
$squelch[$m] = $opt['squelch'];
}
}
if (!$IsPagePosted) {
continue;
}
if ($opt['link']) {
$link = MakePageName($pagename, $opt['link']);
if (!preg_match("/(^|,){$link}(,|\$)/i", $page['targets'])) {
continue;
}
}
$pats = @(array) $SearchPatterns[$opt['list']];
if ($opt['group']) {
$pats[] = FixGlob($opt['group'], '$1$2.*');
}
if ($opt['name']) {
$pats[] = FixGlob($opt['name'], '$1*.$2');
}
if ($pats && !MatchPageNames($pagename, $pats)) {
continue;
}
if ($opt['trail']) {
$trail = ReadTrail($pagename, $opt['trail']);
for ($i = 0; $i < count($trail); $i++) {
if ($trail[$i]['pagename'] == $pagename) {
break;
}
}
if ($i >= count($trail)) {
continue;
}
}
foreach ($mailto as $m) {
$notify[$m][] = $item;
}
}
$nnow = time();
if ($nnow < $firstpost + $NotifyDelay) {
$nextevent = $firstpost + $NotifyDelay;
} else {
$firstpost = 0;
$nextevent = $nnow + 86400;
$mailto = array_keys($notify);
$subject = FmtPageName($NotifySubjectFmt, $pagename);
if (IsEnabled($EnableNotifySubjectEncode, 0) && preg_match("/[^ -~]/", $subject)) {
$subject = strtoupper("=?{$Charset}?B?") . base64_encode($subject) . "?=";
}
$body = FmtPageName($NotifyBodyFmt, $pagename);
//.........这里部分代码省略.........
示例12: MakePageList
function MakePageList($pagename, $opt, $retpages = 1)
{
global $MakePageListOpt, $SearchPatterns, $EnablePageListProtect, $PCache, $FmtV;
StopWatch('MakePageList begin');
SDVA($MakePageListOpt, array('list' => 'default'));
$opt = array_merge((array) $MakePageListOpt, $opt);
$readf = @$opt['readf'];
# we have to read the page if order= is anything but name
$order = @$opt['order'];
$readf |= $order && $order != 'name' && $order != '-name';
$pats = @(array) $SearchPatterns[$opt['list']];
if (@$opt['group']) {
$pats[] = FixGlob($opt['group'], '$1$2.*');
}
if (@$opt['name']) {
$pats[] = FixGlob($opt['name'], '$1*.$2');
}
# inclp/exclp contain words to be included/excluded.
$incl = array();
$inclp = array();
$inclx = false;
$excl = array();
$exclp = '';
foreach ((array) @$opt[''] as $i) {
$incl[] = $i;
}
foreach ((array) @$opt['+'] as $i) {
$incl[] = $i;
}
foreach ((array) @$opt['-'] as $i) {
$excl[] = $i;
}
foreach ($incl as $i) {
$inclp[] = '$' . preg_quote($i) . '$i';
$inclx |= preg_match('[^\\w\\x80-\\xff]', $i);
}
if ($excl) {
$exclp = '$' . implode('|', array_map('preg_quote', $excl)) . '$i';
}
$searchterms = count($incl) + count($excl);
$readf += $searchterms;
# forced read if incl/excl
if (@$opt['trail']) {
$trail = ReadTrail($pagename, $opt['trail']);
$list = array();
foreach ($trail as $tstop) {
$pn = $tstop['pagename'];
$list[] = $pn;
$tstop['parentnames'] = array();
PCache($pn, $tstop);
}
foreach ($trail as $tstop) {
$PCache[$tstop['pagename']]['parentnames'][] = @$trail[$tstop['parent']]['pagename'];
}
} else {
$list = ListPages($pats);
}
if (IsEnabled($EnablePageListProtect, 1)) {
$readf = 1000;
}
$matches = array();
$FmtV['$MatchSearched'] = count($list);
$terms = $incl ? PageIndexTerms($incl) : array();
if (@$opt['link']) {
$link = MakePageName($pagename, $opt['link']);
$linkp = "/(^|,){$link}(,|\$)/i";
$terms[] = " {$link} ";
$readf++;
}
if ($terms) {
$xlist = PageIndexGrep($terms, true);
$a = count($list);
$list = array_diff($list, $xlist);
$a -= count($list);
StopWatch("MakePageList: PageIndex filtered {$a} pages");
}
$xlist = array();
StopWatch('MakePageList scanning ' . count($list) . " pages, readf={$readf}");
foreach ((array) $list as $pn) {
if ($readf) {
$page = $readf >= 1000 ? RetrieveAuthPage($pn, 'read', false, READPAGE_CURRENT) : ReadPage($pn, READPAGE_CURRENT);
if (!$page) {
continue;
}
if (@$linkp && !preg_match($linkp, @$page['targets'])) {
$xlist[] = $pn;
continue;
}
if ($searchterms) {
$text = $pn . "\n" . @$page['targets'] . "\n" . @$page['text'];
if ($exclp && preg_match($exclp, $text)) {
continue;
}
foreach ($inclp as $i) {
if (!preg_match($i, $text)) {
if (!$inclx) {
$xlist[] = $pn;
}
continue 2;
}
//.........这里部分代码省略.........
示例13: PageListProtect
function PageListProtect(&$list, &$opt, $pn, &$page)
{
global $EnablePageListProtect;
switch ($opt['=phase']) {
case PAGELIST_PRE:
if (!IsEnabled($EnablePageListProtect, 1) && @$opt['readf'] < 1000) {
return 0;
}
StopWatch("PageListProtect enabled");
$opt['=protectexclude'] = array();
$opt['=protectsafe'] = (array) @$opt['=protectsafe'];
return PAGELIST_ITEM | PAGELIST_POST;
case PAGELIST_ITEM:
if (@$opt['=protectsafe'][$pn]) {
return 1;
}
$page = RetrieveAuthPage($pn, 'ALWAYS', false, READPAGE_CURRENT);
$opt['=readc']++;
if (!$page['=auth']['read']) {
$opt['=protectexclude'][$pn] = 1;
}
if (!$page['=passwd']['read']) {
$opt['=protectsafe'][$pn] = 1;
}
return 1;
case PAGELIST_POST:
$excl = array_keys($opt['=protectexclude']);
$safe = array_keys($opt['=protectsafe']);
StopWatch("PageListProtect excluded=" . count($excl) . ", safe=" . count($safe));
$list = array_diff($list, $excl);
return 1;
}
}
示例14: SDV
$FmtP to hide any "?action=" url parameters in page urls
generated by PmWiki for actions that robots aren't allowed to
access. This can greatly reduce the load on the server by
not providing the robot with links to pages that it will be
forbidden to index anyway.
*/
## $MetaRobots provides the value for the <meta name='robots' ...> tag.
SDV($MetaRobots, $action != 'browse' || preg_match('#^PmWiki[./](?!PmWiki$)|^Site[./]#', $pagename) ? 'noindex,nofollow' : 'index,follow');
if ($MetaRobots) {
$HTMLHeaderFmt['robots'] = " <meta name='robots' content='\$MetaRobots' />\n";
}
## $RobotPattern is used to identify robots.
SDV($RobotPattern, 'Googlebot|Slurp|msnbot|Teoma|ia_archiver|BecomeBot|HTTrack|MJ12bot');
SDV($IsRobotAgent, $RobotPattern && preg_match("!{$RobotPattern}!", @$_SERVER['HTTP_USER_AGENT']));
if (!$IsRobotAgent) {
return;
}
## $RobotActions indicates which actions a robot is allowed to perform.
SDVA($RobotActions, array('browse' => 1, 'rss' => 1, 'dc' => 1));
if (!@$RobotActions[$action]) {
header("HTTP/1.1 403 Forbidden");
print "<h1>Forbidden</h1>";
exit;
}
## The following removes any ?action= parameters that robots aren't
## allowed to access.
if (IsEnabled($EnableRobotCloakActions, 0)) {
$p = create_function('$a', 'return (boolean)$a;');
$p = join('|', array_keys(array_filter($RobotActions, $p)));
$FmtP["/(\\\$ScriptUrl[^#\"'\\s<>]+)\\?action=(?!{$p})\\w+/"] = '$1';
}
示例15: name
For example, to create customizations for the 'Demo' group, place
them in a file called local/Demo.php. To customize a single page,
use the full page name (e.g., local/Demo.MyPage.php).
Per-page/per-group customizations can be handled at any time by adding
include_once("scripts/pgcust.php");
to config.php. It is automatically included by scripts/stdconfig.php
unless $EnablePGCust is set to zero in config.php.
A page's customization is loaded first, followed by any group
customization. If no page or group customizations are loaded,
then 'local/default.php' is loaded.
A per-page configuration file can prevent its group's config from
loading by setting $EnablePGCust=0;. A per-page configuration file
can force group customizations to be loaded first by using include_once
on the group customization file.
*/
$f = 1;
for ($p = $pagename; $p; $p = preg_replace('/\\.*[^.]*$/', '', $p)) {
if (!IsEnabled($EnablePGCust, 1)) {
return;
}
if (file_exists("{$LocalDir}/{$p}.php")) {
include_once "{$LocalDir}/{$p}.php";
$f = 0;
}
}
if ($f && IsEnabled($EnablePGCust, 1) && file_exists("{$LocalDir}/default.php")) {
include_once "{$LocalDir}/default.php";
}