Index: branches/wmf/1.17wmf1/extensions/WikimediaIncubator/IncubatorTest.php |
— | — | @@ -76,7 +76,7 @@ |
77 | 77 | if( !is_array( $titleparts ) || !isset( $titleparts[1] ) ) { |
78 | 78 | $data['error'] = 'noslash'; |
79 | 79 | } else { |
80 | | - $data['project'] = $titleparts[0][1]; // get the x from Wx/... |
| 80 | + $data['project'] = ( isset( $titleparts[0][1] ) ? $titleparts[0][1] : '' ); // get the x from Wx/... |
81 | 81 | $data['lang'] = $titleparts[1]; |
82 | 82 | $data['prefix'] = 'W'.$data['project'].'/'.$data['lang']; |
83 | 83 | // check language code |
— | — | @@ -125,12 +125,14 @@ |
126 | 126 | */ |
127 | 127 | static function displayPrefix( $project = '', $code = '' ) { |
128 | 128 | global $wgUser, $wmincPref; |
129 | | - if ( self::isContentProject() ) { |
130 | | - // return the prefix |
| 129 | + if ( ($project && $code) || self::isContentProject() ) { |
| 130 | + // if parameters are set OR it falls back to user pref and |
| 131 | + // he has a content project pref set -> return the prefix |
131 | 132 | return 'W' . ( $project ? $project : $wgUser->getOption($wmincPref . '-project') ) . |
132 | 133 | '/' . ( $code ? $code : $wgUser->getOption($wmincPref . '-code') ); // return the prefix |
133 | 134 | } else { |
134 | | - // still provide the value |
| 135 | + // fall back to user pref with NO content pref set |
| 136 | + // -> still provide the value (probably 'none' or 'inc') |
135 | 137 | return $wgUser->getOption($wmincPref . '-project'); |
136 | 138 | } |
137 | 139 | } |