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


PHP Wiki::get_userrights方法代码示例

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


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

示例1: deletedcontribs

 /**
  * List all deleted contributions.
  * The logged in user must have the 'deletedhistory' right
  *
  * @access public
  * @param bool $content Whether or not to return content of each contribution. Default false
  * @param string $start Timestamp to start at. Default null.
  * @param string $end Timestamp to end at. Default null.
  * @param string $dir Direction to list. Default 'older'
  * @param array $prop Information to retrieve. Default array( 'revid', 'user', 'parsedcomment', 'minor', 'len', 'content', 'token' )
  * @return array
  */
 public function deletedcontribs($content = false, $start = null, $end = null, $dir = 'older', $prop = array('revid', 'user', 'parsedcomment', 'minor', 'len', 'content', 'token'))
 {
     if (!in_array('deletedhistory', $this->wiki->get_userrights())) {
         pecho("User is not allowed to view deleted revisions", PECHO_FATAL);
         return false;
     }
     if ($content) {
         $prop[] = 'content';
     }
     $drArray = array('_code' => 'dr', 'list' => 'deletedrevs', 'druser' => $this->username, 'drprop' => implode('|', $prop), 'drdir' => $dir);
     if (!is_null($start)) {
         $drArray['drstart'] = $start;
     }
     if (!is_null($end)) {
         $drArray['drend'] = $end;
     }
     Hooks::runHook('StartDelrevs', array(&$drArray));
     pecho("Getting deleted revisions by {$this->username}...\n\n", PECHO_NORMAL);
     return $this->wiki->listHandler($drArray);
 }
开发者ID:emijrp,项目名称:Peachy,代码行数:32,代码来源:User.php

示例2: rollback

 public function rollback($force = false, $summary = null, $markbot = false, $watch = null)
 {
     global $pgNotag, $pgTag;
     if (!in_array('rollback', $this->wiki->get_userrights())) {
         pecho("User is not allowed to rollback edits", PECHO_FATAL);
         return false;
     }
     if (!$force) {
         try {
             $this->preEditChecks();
         } catch (EditError $e) {
             pecho("Error: {$e}\n\n", PECHO_FATAL);
             return false;
         }
     }
     $history = $this->history(1, 'older', false, null, true);
     $params = array('action' => 'rollback', 'title' => $this->title, 'user' => $history[0]['user'], 'token' => $history[0]['rollbacktoken']);
     if (!is_null($summary)) {
         if (mb_strlen($summary, '8bit') > 255) {
             pecho("Summary is over 255 bytes, the maximum allowed.\n\n", PECHO_FATAL);
             return false;
         }
         if (!$pgNotag) {
             $summary .= $pgTag;
         }
         $params['summary'] = $summary;
     }
     if ($markbot) {
         $params['markbot'] = 'yes';
     }
     if (!is_null($watch)) {
         if ($watch) {
             $params['watchlist'] = 'watch';
         } elseif (!$watch) {
             $params['watchlist'] = 'nochange';
         } elseif (in_array($watch, array('watch', 'unwatch', 'preferences', 'nochange'))) {
             $params['watchlist'] = $watch;
         } else {
             pecho("Watch parameter set incorrectly.  Omitting...\n\n", PECHO_WARN);
         }
     }
     try {
         $this->preEditChecks("Rollback");
     } catch (EditError $e) {
         pecho("Error: {$e}\n\n", PECHO_FATAL);
         return false;
     }
     Hooks::runHook('PreRollback', array(&$params));
     pecho("Rolling back {$this->title}...\n\n", PECHO_NOTICE);
     $result = $this->wiki->apiQuery($params, true);
     if (isset($result['rollback'])) {
         if (isset($result['rollback']['title'])) {
             $this->__construct($this->wiki, $this->title);
             return true;
         } else {
             pecho("Rollback error...\n\n" . print_r($result['rollback'], true) . "\n\n", PECHO_FATAL);
             return false;
         }
     } else {
         pecho("Rollback error...\n\n" . print_r($result, true), PECHO_FATAL);
         return false;
     }
 }
开发者ID:emijrp,项目名称:Peachy,代码行数:63,代码来源:Page.php


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