class OutputPage {
var $mMetatags = array(), $mKeywords = array(), $mLinktags = array();
var $mExtStyles = array();
- var $mPagetitle = '', $mBodytext = '', $mDebugtext = '';
+ var $mPagetitle = '', $mBodytext = '';
+
+ /**
+ * Holds the debug lines that will be outputted as comments in page source if
+ * $wgDebugComments is enabled. See also $wgShowDebug.
+ * TODO: make a getter method for this
+ */
+ public $mDebugtext = '';
+
var $mHTMLtitle = '', $mIsarticle = true, $mPrintable = false;
var $mSubtitle = '', $mRedirect = '', $mStatusCode;
var $mLastModified = '', $mETag = false;
*/
public function addScriptFile( $file, $version = null ) {
global $wgStylePath, $wgStyleVersion;
+ // See if $file parameter is an absolute URL or begins with a slash
if( substr( $file, 0, 1 ) == '/' || preg_match( '#^[a-z]*://#i', $file ) ) {
$path = $file;
} else {
if ( $this->mTitle instanceof Title ) {
return $this->mTitle;
} else {
- wfDebug( __METHOD__ . ' called and $mTitle is null. Return $wgTitle for sanity' );
+ wfDebug( __METHOD__ . " called and \$mTitle is null. Return \$wgTitle for sanity\n" );
global $wgTitle;
return $wgTitle;
}
$pageTable = $dbr->tableName( 'page' );
$where = $lb->constructSet( 'page', $dbr );
$propsTable = $dbr->tableName( 'page_props' );
- $sql = "SELECT page_id, page_namespace, page_title, page_len, page_is_redirect, pp_value
+ $sql = "SELECT page_id, page_namespace, page_title, page_len, page_is_redirect, page_latest, pp_value
FROM $pageTable LEFT JOIN $propsTable ON pp_propname='hiddencat' AND pp_page=page_id WHERE $where";
$res = $dbr->query( $sql, __METHOD__ );
$popts, true, true, $this->mRevisionId
);
$popts->setTidy( false );
- if ( $cache && $article && !$parserOutput->isCacheable() ) {
+ if ( $cache && $article && $parserOutput->isCacheable() ) {
$parserCache = ParserCache::singleton();
$parserCache->save( $parserOutput, $article, $popts );
}
$cvCookies = $this->getCacheVaryCookies();
foreach ( $cvCookies as $cookieName ) {
# Check for a simple string match, like the way squid does it
- if ( strpos( $cookieHeader, $cookieName ) ) {
+ if ( strpos( $cookieHeader, $cookieName ) !== false ) {
wfDebug( __METHOD__ . ": found $cookieName\n" );
return true;
}
$this->returnToMain();
}
- /**
- * @deprecated use permissionRequired()
- */
- public function sysopRequired() {
- throw new MWException( "Call to deprecated OutputPage::sysopRequired() method\n" );
- }
-
- /**
- * @deprecated use permissionRequired()
- */
- public function developerRequired() {
- throw new MWException( "Call to deprecated OutputPage::developerRequired() method\n" );
- }
-
/**
* Produce the stock "please login to use the wiki" page
*/
if ( $action == null ) {
$text = wfMsgNoTrans( 'permissionserrorstext', count( $errors ) ) . "\n\n";
} else {
- global $wgLang;
$action_desc = wfMsgNoTrans( "action-$action" );
$text = wfMsgNoTrans(
'permissionserrorstext-withaction',
if( $source ) {
$this->setPageTitle( wfMsg( 'viewsource' ) );
$this->setSubtitle(
- wfMsg(
- 'viewsourcefor',
- $skin->link(
- $this->getTitle(),
- null,
- array(),
- array(),
- array( 'known', 'noclasses' )
- )
- )
+ wfMsg( 'viewsourcefor', $skin->linkKnown( $this->getTitle() ) )
);
} else {
$this->setPageTitle( wfMsg( 'badaccess' ) );
}
}
+ /**
+ * Adds JS-based password security checker
+ * @param $passwordId String ID of input box containing password
+ * @param $retypeId String ID of input box containing retyped password
+ * @return none
+ */
+ public function addPasswordSecurity( $passwordId, $retypeId ) {
+ $this->includeJQuery();
+ $data = array(
+ 'password' => '#' . $passwordId,
+ 'retype' => '#' . $retypeId,
+ 'messages' => array(),
+ );
+ foreach ( array( 'password-strength', 'password-strength-bad', 'password-strength-mediocre',
+ 'password-strength-acceptable', 'password-strength-good', 'password-retype', 'password-retype-mismatch'
+ ) as $message ) {
+ $data['messages'][$message] = wfMsg( $message );
+ }
+ $this->addScript( Html::inlineScript( 'var passwordSecurity=' . FormatJson::encode( $data ) ) );
+ $this->addScriptFile( 'password.js' );
+ $this->addStyle( 'common/password.css' );
+ }
+
/** @deprecated */
public function errorpage( $title, $msg ) {
wfDeprecated( __METHOD__ );
* @return String: The doctype, opening <html>, and head element.
*/
public function headElement( Skin $sk, $includeStyle = true ) {
- global $wgContLanguageCode, $wgOutputEncoding, $wgMimeType;
- global $wgContLang, $wgUseTrackbacks, $wgStyleVersion, $wgHtml5;
+ global $wgOutputEncoding, $wgMimeType;
+ global $wgUseTrackbacks, $wgHtml5;
global $wgUser, $wgRequest, $wgLang;
if ( $sk->commonPrintStylesheet() ) {
}
$sk->setupUserCss( $this );
- $dir = $wgContLang->getDir();
- $htmlAttribs = array( 'lang' => $wgContLanguageCode, 'dir' => $dir );
- $ret = Html::htmlHeader( $htmlAttribs );
+ $ret = Html::htmlHeader( array( 'lang' => wfUILang()->getCode() ) );
if ( $this->getHTMLTitle() == '' ) {
$this->setHTMLTitle( wfMsg( 'pagetitle', $this->getPageTitle() ) );
}
# Class bloat
+ $dir = wfUILang()->getDir();
$bodyAttrs['class'] = "mediawiki $dir";
if ( $wgLang->capitalizeAllNouns() ) {
NS_USER,
$userpage->getDBkey() . '/' . $name . '.js'
);
- if ( $scriptpage && $scriptpage->exists() ) {
+ if ( $scriptpage && $scriptpage->exists() && ( $scriptpage->getLength() > 0 ) ) {
$userjs = $scriptpage->getLocalURL( 'action=raw&ctype=' . $wgJsMimeType );
- $this->addScriptFile( $userjs );
+ $this->addScriptFile( $userjs, $scriptpage->getLatestRevID() );
}
}
}
*/
protected function styleLink( $style, $options ) {
if( isset( $options['dir'] ) ) {
- global $wgContLang;
- $siteDir = $wgContLang->getDir();
+ $siteDir = wfUILang()->getDir();
if( $siteDir != $options['dir'] ) {
return '';
}