* @file
*/
-if ( !defined( 'MEDIAWIKI' ) ) {
- // Eclipse helper - will be ignored in production
- require_once( 'ApiQueryBase.php' );
-}
-
/**
* A query module to show basic page information.
*
* Get an array mapping token names to their handler functions.
* The prototype for a token function is func($pageid, $title)
* it should return a token or false (permission denied)
- * @return array(tokenname => function)
+ * @return array array(tokenname => function)
*/
protected function getTokenFunctions() {
// Don't call the hooks twice
return $cachedWatchToken;
}
+ public static function getOptionsToken( $pageid, $title ) {
+ global $wgUser;
+ if ( !$wgUser->isLoggedIn() ) {
+ return false;
+ }
+
+ static $cachedOptionsToken = null;
+ if ( !is_null( $cachedOptionsToken ) ) {
+ return $cachedOptionsToken;
+ }
+
+ $cachedOptionsToken = $wgUser->getEditToken();
+ return $cachedOptionsToken;
+ }
+
public function execute() {
$this->params = $this->extractRequestParams();
if ( !is_null( $this->params['prop'] ) ) {
$pageInfo['fullurl'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT );
$pageInfo['editurl'] = wfExpandUrl( $title->getFullURL( 'action=edit' ), PROTO_CURRENT );
}
- if ( $this->fld_readable && $title->userCanRead() ) {
+ if ( $this->fld_readable && $title->userCan( 'read' ) ) {
$pageInfo['readable'] = '';
}
}
if ( $this->fld_displaytitle ) {
- if ( isset( $this->displaytitles[$title->getArticleId()] ) ) {
- $pageInfo['displaytitle'] = $this->displaytitles[$title->getArticleId()];
+ if ( isset( $this->displaytitles[$title->getArticleID()] ) ) {
+ $pageInfo['displaytitle'] = $this->displaytitles[$title->getArticleID()];
} else {
$pageInfo['displaytitle'] = $title->getPrefixedText();
}
}
public function getHelpUrls() {
- return 'http://www.mediawiki.org/wiki/API:Properties#info_.2F_in';
+ return 'https://www.mediawiki.org/wiki/API:Properties#info_.2F_in';
}
public function getVersion() {