r104839 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104838‎ | r104839 | r104840 >
Date:06:10, 1 December 2011
Author:yaron
Status:deferred
Tags:
Comment:
Fixes for r102704 and r102365 - improved handling for non-Latin characters in page names, and changed blank comparator to check for null instead
Modified paths:
  • /trunk/extensions/SemanticForms/specials/SF_FormStart.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_FormStart.php
@@ -71,7 +71,7 @@
7272 if ( $page_name !== '' ) {
7373 // Append the namespace prefix to the page name,
7474 // if this namespace was not already entered.
75 - if ( strpos( $page_name, $target_namespace . ':' ) === false && $target_namespace !== '' )
 75+ if ( strpos( $page_name, $target_namespace . ':' ) === false && !is_null( $target_namespace ) )
7676 $page_name = $target_namespace . ':' . $page_name;
7777 // If there was no page title, it's probably an
7878 // invalid page name, containing forbidden
@@ -122,9 +122,8 @@
123123 /**
124124 * Helper function - returns a URL that includes Special:FormEdit.
125125 */
126 - static function getFormEditURL( $formName, $targetTitle) {
 126+ static function getFormEditURL( $formName, $targetName) {
127127 $fe = SpecialPage::getPage( 'FormEdit' );
128 - $targetName = SFUtils::titleURLString( $targetTitle );
129128 // Special handling for forms whose name contains a slash.
130129 if ( strpos( $formName, '/' ) !== false ) {
131130 return $fe->getTitle()->getLocalURL( array( 'form' => $formName, 'target' => $targetName ) );
@@ -144,10 +143,11 @@
145144 $redirect_title = Title::newFromRedirect( $article->fetchContent() );
146145 if ( $redirect_title != null ) {
147146 $page_title = $redirect_title;
 147+ $page_name = SFUtils::titleURLString( $redirect_title );
148148 }
149149 // HACK - if this is the default form for
150150 // this page, send to the regular 'formedit'
151 - // tab page; otherwise, send to the 'Special:EditData'
 151+ // tab page; otherwise, send to the 'Special:FormEdit'
152152 // page, with the form name hardcoded.
153153 // Is this logic necessary? Or should we just
154154 // out-guess the user and always send to the
@@ -160,10 +160,10 @@
161161 if ( $form_name == $default_form_name ) {
162162 $redirect_url = $page_title->getLocalURL( 'action=formedit' );
163163 } else {
164 - $redirect_url = self::getFormEditURL( $form_name, $page_title );
 164+ $redirect_url = self::getFormEditURL( $form_name, $page_name );
165165 }
166166 } else {
167 - $redirect_url = self::getFormEditURL( $form_name, $page_title );
 167+ $redirect_url = self::getFormEditURL( $form_name, $page_name );
168168 // Of all the request values, send on to 'FormEdit'
169169 // only 'preload' and specific form fields - we can
170170 // identify the latter because they show up as arrays.

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r102365strict comparators for empty stringsjeroendedauw02:25, 8 November 2011
r102704Fixed handling of forms whose name contains a slash, via new helper function,...yaron22:27, 10 November 2011