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


PHP LogEventsList::userCan方法代码示例

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


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

示例1: canView

 public function canView()
 {
     return LogEventsList::userCan($this->row, Revision::DELETED_RESTRICTED, $this->list->getUser());
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:4,代码来源:RevisionDelete.php

示例2: setEventVisibility

 /**
  * @param $title, the log page these events apply to
  * @param array $items list of log ID numbers
  * @param int $bitfield new log_deleted value
  * @param string $comment Comment for log records
  */
 function setEventVisibility($title, $items, $bitfield, $comment)
 {
     global $wgOut;
     $userAllowedAll = $success = true;
     $count = 0;
     $log_Ids = array();
     // Run through and pull all our data in one query
     foreach ($items as $logid) {
         $where[] = intval($logid);
     }
     list($log, $logtype) = explode('/', $title->getDBKey(), 2);
     $result = $this->dbw->select('logging', '*', array('log_type' => $logtype, 'log_id' => $where), __METHOD__);
     while ($row = $this->dbw->fetchObject($result)) {
         $logRows[$row->log_id] = $row;
     }
     // To work!
     foreach ($items as $logid) {
         if (!isset($logRows[$logid])) {
             $success = false;
             continue;
             // Must exist
         } else {
             if (!LogEventsList::userCan($logRows[$logid], LogPage::DELETED_RESTRICTED) || $logRows[$logid]->log_type == 'suppress') {
                 // Don't hide from oversight log!!!
                 $userAllowedAll = false;
                 continue;
             }
         }
         // Which logs did we change anything about?
         if ($logRows[$logid]->log_deleted != $bitfield) {
             $log_Ids[] = $logid;
             $count++;
             $this->updateLogs($logRows[$logid], $bitfield);
             $this->updateRecentChangesLog($logRows[$logid], $bitfield, true);
         }
     }
     // Don't log or touch if nothing changed
     if ($count > 0) {
         $this->updateLog($title, $count, $bitfield, $logRows[$logid]->log_deleted, $comment, $title, 'logid', $log_Ids);
     }
     // Were all revs allowed to be set?
     if (!$userAllowedAll) {
         $wgOut->permissionRequired('suppressrevision');
         return false;
     }
     return $success;
 }
开发者ID:ruizrube,项目名称:spdef,代码行数:53,代码来源:SpecialRevisiondelete.php

示例3: getApiData

 public function getApiData(ApiResult $result)
 {
     $logEntry = DatabaseLogEntry::newFromRow($this->row);
     $user = $this->list->getUser();
     $ret = array('id' => $logEntry->getId(), 'type' => $logEntry->getType(), 'action' => $logEntry->getSubtype());
     $ret += $logEntry->isDeleted(LogPage::DELETED_USER) ? array('userhidden' => '') : array();
     $ret += $logEntry->isDeleted(LogPage::DELETED_COMMENT) ? array('commenthidden' => '') : array();
     $ret += $logEntry->isDeleted(LogPage::DELETED_ACTION) ? array('actionhidden' => '') : array();
     if (LogEventsList::userCan($this->row, LogPage::DELETED_ACTION, $user)) {
         $ret['params'] = LogFormatter::newFromEntry($logEntry)->formatParametersForApi();
     }
     if (LogEventsList::userCan($this->row, LogPage::DELETED_USER, $user)) {
         $ret += array('userid' => $this->row->log_user, 'user' => $this->row->log_user_text);
     }
     if (LogEventsList::userCan($this->row, LogPage::DELETED_COMMENT, $user)) {
         $ret += array('comment' => $this->row->log_comment);
     }
     return $ret;
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:19,代码来源:RevDelLogItem.php

示例4: extractRowInfo

 private function extractRowInfo($row)
 {
     $logEntry = DatabaseLogEntry::newFromRow($row);
     $vals = array(ApiResult::META_TYPE => 'assoc');
     $anyHidden = false;
     $user = $this->getUser();
     if ($this->fld_ids) {
         $vals['logid'] = intval($row->log_id);
     }
     if ($this->fld_title || $this->fld_parsedcomment) {
         $title = Title::makeTitle($row->log_namespace, $row->log_title);
     }
     if ($this->fld_title || $this->fld_ids || $this->fld_details && $row->log_params !== '') {
         if (LogEventsList::isDeleted($row, LogPage::DELETED_ACTION)) {
             $vals['actionhidden'] = true;
             $anyHidden = true;
         }
         if (LogEventsList::userCan($row, LogPage::DELETED_ACTION, $user)) {
             if ($this->fld_title) {
                 ApiQueryBase::addTitleInfo($vals, $title);
             }
             if ($this->fld_ids) {
                 $vals['pageid'] = intval($row->page_id);
                 $vals['logpage'] = intval($row->log_page);
             }
             if ($this->fld_details) {
                 $vals['params'] = LogFormatter::newFromEntry($logEntry)->formatParametersForApi();
             }
         }
     }
     if ($this->fld_type) {
         $vals['type'] = $row->log_type;
         $vals['action'] = $row->log_action;
     }
     if ($this->fld_user || $this->fld_userid) {
         if (LogEventsList::isDeleted($row, LogPage::DELETED_USER)) {
             $vals['userhidden'] = true;
             $anyHidden = true;
         }
         if (LogEventsList::userCan($row, LogPage::DELETED_USER, $user)) {
             if ($this->fld_user) {
                 $vals['user'] = $row->user_name === null ? $row->log_user_text : $row->user_name;
             }
             if ($this->fld_userid) {
                 $vals['userid'] = intval($row->log_user);
             }
             if (!$row->log_user) {
                 $vals['anon'] = true;
             }
         }
     }
     if ($this->fld_timestamp) {
         $vals['timestamp'] = wfTimestamp(TS_ISO_8601, $row->log_timestamp);
     }
     if (($this->fld_comment || $this->fld_parsedcomment) && isset($row->log_comment)) {
         if (LogEventsList::isDeleted($row, LogPage::DELETED_COMMENT)) {
             $vals['commenthidden'] = true;
             $anyHidden = true;
         }
         if (LogEventsList::userCan($row, LogPage::DELETED_COMMENT, $user)) {
             if ($this->fld_comment) {
                 $vals['comment'] = $row->log_comment;
             }
             if ($this->fld_parsedcomment) {
                 $vals['parsedcomment'] = Linker::formatComment($row->log_comment, $title);
             }
         }
     }
     if ($this->fld_tags) {
         if ($row->ts_tags) {
             $tags = explode(',', $row->ts_tags);
             ApiResult::setIndexedTagName($tags, 'tag');
             $vals['tags'] = $tags;
         } else {
             $vals['tags'] = array();
         }
     }
     if ($anyHidden && LogEventsList::isDeleted($row, LogPage::DELETED_RESTRICTED)) {
         $vals['suppressed'] = true;
     }
     return $vals;
 }
开发者ID:Acidburn0zzz,项目名称:mediawiki,代码行数:82,代码来源:ApiQueryLogEvents.php

示例5: getApiData

 public function getApiData(ApiResult $result)
 {
     $logEntry = DatabaseLogEntry::newFromRow($this->row);
     $user = $this->list->getUser();
     $ret = array('id' => $logEntry->getId(), 'type' => $logEntry->getType(), 'action' => $logEntry->getSubtype());
     $ret += $logEntry->isDeleted(LogPage::DELETED_USER) ? array('userhidden' => '') : array();
     $ret += $logEntry->isDeleted(LogPage::DELETED_COMMENT) ? array('commenthidden' => '') : array();
     $ret += $logEntry->isDeleted(LogPage::DELETED_ACTION) ? array('actionhidden' => '') : array();
     if (LogEventsList::userCan($this->row, LogPage::DELETED_ACTION, $user)) {
         ApiQueryLogEvents::addLogParams($result, $ret, $logEntry->getParameters(), $logEntry->getType(), $logEntry->getSubtype(), $logEntry->getTimestamp(), $logEntry->isLegacy());
     }
     if (LogEventsList::userCan($this->row, LogPage::DELETED_USER, $user)) {
         $ret += array('userid' => $this->row->log_user, 'user' => $this->row->log_user_text);
     }
     if (LogEventsList::userCan($this->row, LogPage::DELETED_COMMENT, $user)) {
         $ret += array('comment' => $this->row->log_comment);
     }
     return $ret;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:19,代码来源:RevDelLogItem.php


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