wfProfileOut( get_class( $this ) . "::importContentFormData" );
}
- # Truncate for whole multibyte characters. +5 bytes for ellipsis
- $this->summary = $wgLang->truncate( $request->getText( 'wpSummary' ), 250 );
+ # Truncate for whole multibyte characters
+ $this->summary = $wgLang->truncate( $request->getText( 'wpSummary' ), 255 );
# If the summary consists of a heading, e.g. '==Foobar==', extract the title from the
# header syntax, e.g. 'Foobar'. This is mainly an issue when we are using wpSummary for
# currently doing double duty as both edit summary and section title. Right now this
# is just to allow API edits to work around this limitation, but this should be
# incorporated into the actual edit form when EditPage is rewritten (Bugs 18654, 26312).
- $this->sectiontitle = $wgLang->truncate( $request->getText( 'wpSectionTitle' ), 250 );
+ $this->sectiontitle = $wgLang->truncate( $request->getText( 'wpSectionTitle' ), 255 );
$this->sectiontitle = preg_replace( '/^\s*=+\s*(.*?)\s*=+\s*$/', '$1', $this->sectiontitle );
$this->edittime = $request->getVal( 'wpEdittime' );
} elseif ( $wgUser->getOption( 'watchcreations' ) && !$this->mTitle->exists() ) {
# Watch creations
$this->watchthis = true;
- } elseif ( $this->mTitle->userIsWatching() ) {
+ } elseif ( $wgUser->isWatched( $this->mTitle ) ) {
# Already watched
$this->watchthis = true;
}
wfProfileOut( __METHOD__ . '-checks' );
- // Use SELECT FOR UPDATE here to avoid transaction collision in
- // WikiPage::updateRevisionOn() and ending in the self::AS_END case.
- $this->mArticle->loadPageData( 'forupdate' );
+ # Load the page data from the master. If anything changes in the meantime,
+ # we detect it by using page_latest like a token in a 1 try compare-and-swap.
+ $this->mArticle->loadPageData( 'fromdbmaster' );
$new = !$this->mArticle->exists();
try {
*/
protected function commitWatch() {
global $wgUser;
- if ( $this->watchthis xor $this->mTitle->userIsWatching() ) {
+ if ( $wgUser->isLoggedIn() && $this->watchthis != $wgUser->isWatched( $this->mTitle ) ) {
$dbw = wfGetDB( DB_MASTER );
$dbw->begin( __METHOD__ );
if ( $this->watchthis ) {
* @private
* @todo document
*
- * @parma $editText string
+ * @param $editText string
*
* @return bool
* @deprecated since 1.WD, use mergeChangesIntoContent() instead
/**
* Check given input text against $wgSpamRegex, and return the text of the first match.
*
- * @parma $text string
+ * @param $text string
*
* @return string|bool matching string or false
*/
$wgOut->addHTML( Html::hidden( 'wpIgnoreBlankSummary', true ) );
}
+ if ( $this->undidRev ) {
+ $wgOut->addHTML( Html::hidden( 'wpUndidRevision', $this->undidRev ) );
+ }
+
if ( $this->hasPresetSummary ) {
// If a summary has been preset using &summary= we dont want to prompt for
// a different summary. Only prompt for a summary if the summary is blanked.
* @return array An array in the format array( $label, $input )
*/
function getSummaryInput( $summary = "", $labelText = null, $inputAttrs = null, $spanLabelAttrs = null ) {
- // Note: the maxlength is overriden in JS to 250 and to make it use UTF-8 bytes, not characters.
+ // Note: the maxlength is overriden in JS to 255 and to make it use UTF-8 bytes, not characters.
$inputAttrs = ( is_array( $inputAttrs ) ? $inputAttrs : array() ) + array(
'id' => 'wpSummary',
'maxlength' => '200',
'</div>' );
}
+ /**
+ * Get the copyright warning
+ *
+ * Renamed to getCopyrightWarning(), old name kept around for backwards compatibility
+ */
protected function getCopywarn() {
+ return self::getCopyrightWarning( $this->mTitle );
+ }
+
+ public static function getCopyrightWarning( $title ) {
global $wgRightsText;
if ( $wgRightsText ) {
$copywarnMsg = array( 'copyrightwarning',
'[[' . wfMsgForContent( 'copyrightpage' ) . ']]' );
}
// Allow for site and per-namespace customization of contribution/copyright notice.
- wfRunHooks( 'EditPageCopyrightWarning', array( $this->mTitle, &$copywarnMsg ) );
+ wfRunHooks( 'EditPageCopyrightWarning', array( $title, &$copywarnMsg ) );
return "<div id=\"editpage-copywarn\">\n" .
call_user_func_array( "wfMsgNoTrans", $copywarnMsg ) . "\n</div>";
* failure, etc).
*
* @todo This doesn't include category or interlanguage links.
- * Would need to enhance it a bit, <s>maybe wrap them in XML
- * or something...</s> that might also require more skin
+ * Would need to enhance it a bit, "<s>maybe wrap them in XML
+ * or something...</s>" that might also require more skin
* initialization, so check whether that's a problem.
*/
function livePreview() {
* @private
*/
function checkUnicodeCompliantBrowser() {
- global $wgBrowserBlackList;
- if ( empty( $_SERVER["HTTP_USER_AGENT"] ) ) {
+ global $wgBrowserBlackList, $wgRequest;
+
+ $currentbrowser = $wgRequest->getHeader( 'User-Agent' );
+ if ( $currentbrowser === false ) {
// No User-Agent header sent? Trust it by default...
return true;
}
- $currentbrowser = $_SERVER["HTTP_USER_AGENT"];
+
foreach ( $wgBrowserBlackList as $browser ) {
if ( preg_match( $browser, $currentbrowser ) ) {
return false;