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


PHP RetrieveAuthPage函数代码示例

本文整理汇总了PHP中RetrieveAuthPage函数的典型用法代码示例。如果您正苦于以下问题:PHP RetrieveAuthPage函数的具体用法?PHP RetrieveAuthPage怎么用?PHP RetrieveAuthPage使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: HandleThumbShoePostRename

function HandleThumbShoePostRename($pagename, $auth = 'edit')
{
    global $WikiLibDirs;
    global $ThumbShoePageSep;
    global $HandleAuth, $UploadFileFmt, $LastModFile, $TimeFmt;
    $newname = $_REQUEST['newname'];
    if ($newname == '') {
        Abort("?no new image name");
    }
    $newname = str_replace('.', '_', $newname);
    $newpage = $_REQUEST['newpage'];
    if ($newpage == '') {
        Abort("?no new image page");
    }
    $newimgpage = $newpage . $ThumbShoePageSep . $newname;
    $tsdir = '';
    foreach ((array) $WikiLibDirs as $dir) {
        if ($dir->exists($pagename) and $dir->iswrite) {
            $tsdir = $dir;
            break;
        }
    }
    if (!$tsdir) {
        Abort("Cannot rename {$pagename} to {$newimgpage}; cannot find page");
        return;
    }
    ## check authorization
    if (!RetrieveAuthPage($newimgpage, $auth, TRUE, READPAGE_CURRENT)) {
        Abort("?cannot rename image page from {$pagename} to {$newimgpage}");
    }
    $newnewpage = @$tsdir->rename($pagename, $newimgpage);
    if ($newnewpage) {
        Redirect($newnewpage);
    }
}
开发者ID:rubykat,项目名称:pmwiki-thumbshoe,代码行数:35,代码来源:rename.php

示例2: HandleRecipeCheck

function HandleRecipeCheck($pagename, $auth = 'admin')
{
    global $RecipeListUrl, $Version, $RecipeInfo, $RecipeCheckFmt, $PageStartFmt, $PageEndFmt;
    $page = RetrieveAuthPage($pagename, $auth, true, READPAGE_CURRENT);
    if (!$page) {
        Abort('?admin access required');
    }
    $cvinfo = GetRecipeList($RecipeListUrl);
    if (!$cvinfo) {
        $msg = "Unable to retrieve cookbook data from {$RecipeListUrl}\n";
        $allow_url_fopen = ini_get('allow_url_fopen');
        if (!$allow_url_fopen) {
            $msg .= "\n      <br /><br />It appears that your PHP environment isn't allowing\n      the recipelist to be downloaded from pmwiki.org  \n      (allow_url_fopen&nbsp;=&nbsp;{$allow_url_fopen}).";
        }
        Abort($msg);
    }
    $rinfo['PmWiki:Upgrades'] = $Version;
    ScanRecipeInfo('cookbook', $cvinfo);
    foreach ((array) $RecipeInfo as $r => $v) {
        if (!@$v['Version']) {
            continue;
        }
        $r = preg_replace('/^(?!PmWiki:)(Cookbook[.:])?/', 'Cookbook:', $r);
        $rinfo[$r] = $v['Version'];
    }
    $markup = "!!Recipe status for {\$PageUrl}\n" . RecipeTable($rinfo, $cvinfo);
    $html = MarkupToHTML($pagename, $markup);
    SDV($RecipeCheckFmt, array(&$PageStartFmt, $html, &$PageEndFmt));
    PrintFmt($pagename, $RecipeCheckFmt);
}
开发者ID:prometheus-ev,项目名称:promwiki,代码行数:30,代码来源:recipecheck.php

示例3: ThumbShoeHandleDelete

function ThumbShoeHandleDelete($pagename, $auth = 'delete')
{
    global $WikiLibDirs, $WikiDir, $LastModFile;
    $page = RetrieveAuthPage($pagename, $auth, true, READPAGE_CURRENT);
    if (!$page) {
        Abort("?cannot delete {$pagename}");
        return;
    }
    $deleted = false;
    foreach ((array) $WikiLibDirs as $dir) {
        if ($dir->exists($pagename) and $dir->iswrite) {
            $dir->delete($pagename);
            $deleted = true;
            break;
        }
    }
    if (!$deleted) {
        // look in the default WikiDir
        if ($WikiDir->exists($pagename)) {
            $WikiDir->delete($pagename);
            $deleted = true;
        }
    }
    if ($deleted && $LastModFile) {
        touch($LastModFile);
        fixperms($LastModFile);
    }
    Redirect($pagename);
    exit;
}
开发者ID:rubykat,项目名称:pmwiki-thumbshoe,代码行数:30,代码来源:delete.php

示例4: HandlePostUpload

function HandlePostUpload($pagename)
{
    global $UploadVerifyFunction, $UploadFileFmt, $LastModFile;
    $page = RetrieveAuthPage($pagename, 'upload');
    if (!$page) {
        Abort("?cannot upload to {$pagename}");
    }
    $uploadfile = $_FILES['uploadfile'];
    $upname = $_REQUEST['upname'];
    if ($upname == '') {
        $upname = $uploadfile['name'];
    }
    $upname = MakeUploadName($pagename, $upname);
    if (!function_exists($UploadVerifyFunction)) {
        Abort('?no UploadVerifyFunction available');
    }
    $filepath = FmtPageName("{$UploadFileFmt}/{$upname}", $pagename);
    $result = $UploadVerifyFunction($pagename, $uploadfile, $filepath);
    if ($result == '') {
        $filedir = preg_replace('#/[^/]*$#', '', $filepath);
        mkdirp($filedir);
        if (!move_uploaded_file($uploadfile['tmp_name'], $filepath)) {
            Abort("?cannot move uploaded file to {$filepath}");
            return;
        }
        fixperms($filepath);
        if ($LastModFile) {
            touch($LastModFile);
            fixperms($LastModFile);
        }
        $result = "upresult=success";
    }
    Redirect($pagename, "\$PageUrl?action=upload&upname={$upname}&{$result}");
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:34,代码来源:upload.php

示例5: loadProjects

/**
 * Fetch the projects page and pass of the parsing to the projects lib.
 */
function loadProjects()
{
    $projectsPage = @RetrieveAuthPage('Projects.Featured', 'read', false, READPAGE_CURRENT);
    if (!$projectsPage || !is_array($projectsPage) || !isset($projectsPage['text'])) {
        return "No projects";
    }
    return parseProjects($projectsPage['text']);
}
开发者ID:LOZORD,项目名称:UPL-Website-Revamp,代码行数:11,代码来源:mainpage.php

示例6: RetrievePageMarkup

function RetrievePageMarkup($pagelist)
{
    foreach ($pagelist as $p) {
        if (PageExists($p)) {
            $page = RetrieveAuthPage($p, 'read', false, READPAGE_CURRENT);
            return array($page['text'], $page['title']);
            break;
        }
    }
    return null;
}
开发者ID:anomen-s,项目名称:pmwiki-recipes,代码行数:11,代码来源:monobook.php

示例7: HandleGuestDelete

function HandleGuestDelete($pagename, $auth)
{
    global $WikiDir, $LastModFile;
    $page = RetrieveAuthPage($pagename, $auth, true, READPAGE_CURRENT);
    if (!$page) {
        Abort("?cannot delete {$pagename}");
        return;
    }
    $WikiDir->delete($pagename);
    if ($LastModFile) {
        touch($LastModFile);
        fixperms($LastModFile);
    }
    Redirect(substr($pagename, 0, strlen($pagename) - 22));
}
开发者ID:ansgar,项目名称:pmguest,代码行数:15,代码来源:guest.php

示例8: WikiGalleryThumbnail

function WikiGalleryThumbnail($pagename, $auth = "read")
{
    global $WikiGallery_UseAuthorization, $WikiGalleryThumbProviders, $WikiGallery_DefaultGroup;
    // get filename
    if (!isset($_GET["image"])) {
        Abort('no image given');
    }
    if (!isset($_GET["group"])) {
        $group = $WikiGallery_DefaultGroup;
    } else {
        $group = $_GET["group"];
    }
    $path = WikiGallerySecurePath(urldecode($_GET["image"]));
    // group exists?
    if (!isset($WikiGalleryThumbProviders[$group])) {
        Abort("Invalid gallery group \"{$group}\" given");
    }
    $provider =& $WikiGalleryThumbProviders[$group];
    // get size
    $width = intval(@$_GET["width"]);
    $height = intval(@$_GET["height"]);
    if ($width < 0 || $width > 1600) {
        $width = 0;
    }
    if ($height < 0 || $height > 1200) {
        $height = 0;
    }
    $resizeMode = urldecode(@$_GET["mode"]);
    // check authorization
    $pagename = fileNameToPageName($path);
    if ($WikiGallery_UseAuthorization) {
        $page = RetrieveAuthPage($pagename, $auth, true, READPAGE_CURRENT);
        if (!$page) {
            Abort('?cannot read $pagename');
        }
        PCache($pagename, $page);
    }
    // get image
    $provider->thumb($path, $width, $height, $resizeMode);
    exit;
}
开发者ID:gregorklaric,项目名称:wikigallery,代码行数:41,代码来源:thumb.php

示例9: HandleApprove

function HandleApprove($pagename)
{
    global $ApproveUrlPattern, $WhiteUrlPatterns, $ApprovedUrlPagesFmt, $action;
    Lock(2);
    $page = ReadPage($pagename);
    $text = preg_replace('/[()]/', '', $page['text']);
    preg_match_all("/{$ApproveUrlPattern}/", $text, $match);
    ReadApprovedUrls($pagename);
    $addpat = array();
    foreach ($match[0] as $a) {
        foreach ((array) $WhiteUrlPatterns as $pat) {
            if (preg_match("!^{$pat}(/|\$)!", $a)) {
                continue 2;
            }
        }
        if ($action == 'approvesites') {
            $a = preg_replace("!^([^:]+://[^/]+).*\$!", '$1', $a);
        }
        $addpat[] = $a;
    }
    if (count($addpat) > 0) {
        $aname = FmtPageName($ApprovedUrlPagesFmt[0], $pagename);
        $apage = RetrieveAuthPage($aname, 'edit');
        if (!$apage) {
            Abort("?cannot edit {$aname}");
        }
        $new = $apage;
        if (substr($new['text'], -1, 1) != "\n") {
            $new['text'] .= "\n";
        }
        foreach ($addpat as $pat) {
            $new['text'] .= "  {$pat}\n";
        }
        $_REQUEST['post'] = 'y';
        PostPage($aname, $apage, $new);
    }
    Redirect($pagename);
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:38,代码来源:urlapprove.php

示例10: HandleUpgrade

function HandleUpgrade($pagename, $auth = 'ALWAYS') {
  global $SiteGroup, $SiteAdminGroup, $StatusPageName, $ScriptUrl,
    $AuthUserPageFmt, $VersionNum, $Version;
  StopWatch('HandleUpgrade: begin');

  $message = '';
  $done = '';
  ##  check for Site.* --> SiteAdmin.*
  foreach(array('AuthUser', 'NotifyList', 'Blocklist', 'ApprovedUrls') as $n) {
    $n0 = "$SiteGroup.$n"; $n1 = "$SiteAdminGroup.$n";
    StopWatch("HandleUpgrade: checking $n0 -> $n1");
    ## checking AuthUser is special, because Site.AuthUser comes with the
    ## distribution.
    if ($n == 'AuthUser') {
      ##  if we already have a user-modified SiteAdmin.AuthUser, we can skip
      SDV($AuthUserPageFmt, '$SiteAdminGroup.AuthUser');
      $n1 = FmtPageName($AuthUserPageFmt, $pagename);
      $page = ReadPage($n1, READPAGE_CURRENT);
      if (@$page['time'] > 1000000000) continue;
      ##  if there's not a user-modified Site.AuthUser, we can skip
      $page = ReadPage($n0, READPAGE_CURRENT);
      if (@$page['time'] == 1000000000) continue;
    } else if (!PageExists($n0) || PageExists($n1)) continue;

    if (@$_REQUEST['migrate'] == 'yes') {
      ##  if the admin wants PmWiki to migrate, do it.
      $page = RetrieveAuthPage($n0, 'admin', true);
      StopWatch("HandleUpgrade: copying $n0 -> $n1");
      if ($page) { 
        WritePage($n1, $page); 
        $done .= "<li>Copied $n0 to $n1</li>";
        continue; 
      }
    }
    $message .= "<li>$n0 -&gt; $n1</li>";
  }

  if ($message) {
    $migrateurl = "$ScriptUrl?action=upgrade&amp;migrate=yes";
    $infourl = 'http://www.pmwiki.org/wiki/PmWiki/UpgradeToSiteAdmin';
    $message = 
      "<h2>Upgrade notice -- SiteAdmin group</h2>
      <p>This version of PmWiki expects several administrative pages 
      from the <em>Site</em> group to be found in a new <em>SiteAdmin</em> group.  
      On this site, the following pages appear to need to be relocated:</p>
      <ul>$message</ul>

      <p>For more information about this change, including the various
      options for proceeding, see</p>
      <blockquote><a target='_blank' href='$infourl'>$infourl</a></blockquote>

      <form action='$ScriptUrl' method='post'>
      <p>If you would like PmWiki to attempt to automatically copy 
      these pages into their new <br /> locations for you, try 
        <input type='hidden' name='action' value='upgrade' />
        <input type='hidden' name='migrate' value='yes' />
        <input type='submit' value='Relocate pages listed above' /> 
        (admin password required) </p>
      </form>

      <p>If you want to configure PmWiki so that it continues to
      look for the above pages in <em>$SiteGroup</em>, add the
      following line near the top of <em>local/config.php</em>:</p>

      <blockquote><pre>\$SiteAdminGroup = \$SiteGroup;</pre></blockquote>

      $Version
      ";
    print $message;
    exit;
  }

  StopWatch("UpgradeCheck: writing $StatusPageName");
  Lock(2);
  SDV($StatusPageName, "$SiteAdminGroup.Status");
  $page = ReadPage($StatusPageName);
  $page['updatedto'] = $VersionNum;
  WritePage($StatusPageName, $page);

  if ($done) {
    $done .= "<li>Updated $StatusPageName</li>";
    echo "<h2>Upgrade to $Version ... ok</h2><ul>$done</ul>";
    $GLOBALS['EnableRedirect'] = 0;
  }
  Redirect($pagename);
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:86,代码来源:upgrades.php

示例11: HandleFeed

function HandleFeed($pagename, $auth = 'read')
{
    global $FeedFmt, $action, $PCache, $FmtV, $ISOTimeFmt, $RSSTimeFmt, $FeedOpt, $FeedDescPatterns, $CategoryGroup, $EntitiesTable;
    SDV($ISOTimeFmt, '%Y-%m-%dT%H:%M:%SZ');
    SDV($RSSTimeFmt, 'D, d M Y H:i:s \\G\\M\\T');
    SDV($FeedDescPatterns, array('/<[^>]*$/' => ' ', '/\\w+$/' => '', '/<[^>]+>/' => ''));
    SDVA($FeedCategoryOpt, array('link' => $pagename, 'readf' => 1));
    SDVA($FeedTrailOpt, array('trail' => $pagename, 'count' => 10, 'readf' => 1));
    $f = $FeedFmt[$action];
    $page = RetrieveAuthPage($pagename, $auth, true, READPAGE_CURRENT);
    if (!$page) {
        Abort("?cannot generate feed");
    }
    $feedtime = $page['time'];
    # determine list of pages to display
    if (@($_REQUEST['trail'] || $_REQUEST['group'] || $_REQUEST['link'])) {
        $opt['readf'] = 1;
    } else {
        if ($action == 'dc') {
            $opt = array();
        } else {
            if (preg_match("/^{$CategoryGroup}\\./", $pagename)) {
                $opt = $FeedCategoryOpt;
            } else {
                $opt = $FeedTrailOpt;
            }
        }
    }
    if (!$opt) {
        PCache($pagename, $page);
        $pagelist = array(&$PCache[$pagename]);
    } else {
        $opt = array_merge($opt, @$_REQUEST);
        $pagelist = MakePageList($pagename, $opt);
    }
    # process list of pages in feed
    $rdfseq = '';
    foreach ($pagelist as $page) {
        $pn = $page['name'];
        if (!PageExists($pn)) {
            continue;
        }
        $pl[] = $pn;
        if (@$opt['count'] && count($pl) >= $opt['count']) {
            break;
        }
        $rdfseq .= FmtPageName("<rdf:li resource=\"\$PageUrl\" />\n", $pn);
        if ($page['time'] > $feedtime) {
            $feedtime = $page['time'];
        }
    }
    $pagelist = $pl;
    $FmtV['$FeedRDFSeq'] = $rdfseq;
    $FmtV['$FeedISOTime'] = gmstrftime($ISOTimeFmt, $feedtime);
    $FmtV['$FeedRSSTime'] = gmdate($RSSTimeFmt, $feedtime);
    # format start of feed
    $out = FmtPageName($f['feed']['_start'], $pagename);
    # format feed elements
    foreach ($f['feed'] as $k => $v) {
        if ($k[0] == '_' || !$v) {
            continue;
        }
        $x = FmtPageName($v, $pagename);
        if (!$x) {
            continue;
        }
        $out .= $v[0] == '<' ? $x : "<{$k}>{$x}</{$k}>\n";
    }
    # format items in feed
    if (@$f['feed']['_items']) {
        $out .= FmtPageName($f['feed']['_items'], $pagename);
    }
    foreach ($pagelist as $pn) {
        $page =& $PCache[$pn];
        $FmtV['$ItemDesc'] = @$page['description'] ? $page['description'] : trim(preg_replace(array_keys($FeedDescPatterns), array_values($FeedDescPatterns), @$page['excerpt']));
        $FmtV['$ItemISOTime'] = gmstrftime($ISOTimeFmt, $page['time']);
        $out .= FmtPageName($f['item']['_start'], $pn);
        foreach ((array) @$f['item'] as $k => $v) {
            if ($k[0] == '_' || !$v) {
                continue;
            }
            if (is_callable($v)) {
                $out .= $v($pn, $page, $k);
                continue;
            }
            if (strpos($v, '$LastModifiedBy') !== false && !@$page['author']) {
                continue;
            }
            if (strpos($v, '$Category') !== false) {
                if (preg_match_all("/(?<=^|,){$CategoryGroup}\\.([^,]+)/", @$page['targets'], $match)) {
                    foreach ($match[1] as $c) {
                        $FmtV['$Category'] = $c;
                        $out .= FmtPageName($v, $pn);
                    }
                }
                continue;
            }
            $x = FmtPageName($v, $pn);
            if (!$x) {
                continue;
//.........这里部分代码省略.........
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:101,代码来源:feeds.php

示例12: HandleDiff

function HandleDiff($pagename, $auth = 'read')
{
    global $HandleDiffFmt, $PageStartFmt, $PageDiffFmt, $PageEndFmt;
    $page = RetrieveAuthPage($pagename, $auth, true);
    if (!$page) {
        Abort("?cannot diff {$pagename}");
    }
    PCache($pagename, $page);
    SDV($HandleDiffFmt, array(&$PageStartFmt, &$PageDiffFmt, "<div id='wikidiff'>", 'function:PrintDiff', '</div>', &$PageEndFmt));
    PrintFmt($pagename, $HandleDiffFmt);
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:11,代码来源:pagerev.php

示例13: 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;
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:39,代码来源:pmwiki.php

示例14: HandlePostAttr

function HandlePostAttr($pagename, $auth = 'attr')
{
    global $PageAttributes, $EnablePostAttrClearSession;
    Lock(2);
    $page = RetrieveAuthPage($pagename, $auth, true);
    if (!$page) {
        Abort("?unable to read {$pagename}");
    }
    foreach ($PageAttributes as $attr => $p) {
        $v = stripmagic(@$_POST[$attr]);
        if ($v == '') {
            continue;
        }
        if ($v == 'clear') {
            unset($page[$attr]);
        } else {
            if (strncmp($attr, 'passwd', 6) != 0) {
                $page[$attr] = $v;
            } else {
                $a = array();
                preg_match_all('/"[^"]*"|\'[^\']*\'|\\S+/', $v, $match);
                foreach ($match[0] as $pw) {
                    $a[] = preg_match('/^\\w+:/', $pw) ? $pw : crypt(preg_replace('/^([\'"])(.*)\\1$/', '$2', $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;
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:40,代码来源:pmwiki.php

示例15: HandleSearchA

function HandleSearchA($pagename, $level = 'read') {
  global $PageSearchForm, $FmtV, $HandleSearchFmt, 
    $PageStartFmt, $PageEndFmt;
  SDV($HandleSearchFmt,array(&$PageStartFmt, '$PageText', &$PageEndFmt));
  SDV($PageSearchForm, '$[{$SiteGroup}/Search]');
  $form = RetrieveAuthPage($pagename, $level, true, READPAGE_CURRENT);
  if (!$form) Abort("?unable to read $pagename");
  PCache($pagename, $form);
  $text = preg_replace('/\\[([=@])(.*?)\\1\\]/s', ' ', @$form['text']);
  if (!preg_match('/\\(:searchresults(\\s.*?)?:\\)/', $text))
    foreach((array)$PageSearchForm as $formfmt) {
      $form = ReadPage(FmtPageName($formfmt, $pagename), READPAGE_CURRENT);
      if ($form['text']) break;
    }
  $text = @$form['text'];
  if (!$text) $text = '(:searchresults:)';
  $FmtV['$PageText'] = MarkupToHTML($pagename,$text);
  PrintFmt($pagename, $HandleSearchFmt);
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:19,代码来源:pagelist.php


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