r106957 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106956‎ | r106957 | r106958 >
Date:17:06, 21 December 2011
Author:robin
Status:ok
Tags:
Comment:
Follow-up r106857: forgot variables in html, fix {} with elseif, and avoid some undefined indexes. I obviously committed it too quickly :-/
Modified paths:
  • /trunk/tools/web-scripts/missing.php (modified) (history)

Diff [purge]

Index: trunk/tools/web-scripts/missing.php
@@ -61,7 +61,7 @@
6262 $base = 'secure.wikimedia.org/wikipedia/incubator/wiki/';
6363 if( isset( $_SERVER['PATH_INFO'] ) ) {
6464 $page = implode( array_slice( $tmp, 3 ) ); # /wiki/Page (possibly /wiki/Page?foo=bar)
65 - elseif( $_GET['title'] ) {
 65+ } elseif( isset( $_GET['title'] ) && $_GET['title'] ) {
6666 $page = $_GET['title']; # index.php?title=Page
6767 } else {
6868 $page = ''; # no known title, fallback to main page
@@ -76,7 +76,7 @@
7777 $base = 'incubator.wikimedia.org/wiki/';
7878 if( isset( $_SERVER['PATH_INFO'] ) ) {
7979 $page = preg_replace( '/^\/wiki\//', '', $url['path'] ); # /wiki/Page (possibly /wiki/Page?foo=bar)
80 - elseif( $_GET['title'] ) {
 80+ } elseif( isset( $_GET['title'] ) && $_GET['title'] ) {
8181 $page = $_GET['title']; # index.php?title=Page
8282 } else {
8383 $page = ''; # no known title, fallback to main page
@@ -92,7 +92,7 @@
9393 # Go to the page if specified (look out for slashes), otherwise go to
9494 # the main page Wx/xyz?goto=mainpage (WikimediaIncubator extension takes care of that)
9595 $location .= $page && $page !== '/' ? '/' . $page :
96 - '?goto=mainpage' . ( $_GET['uselang'] ? '&uselang=' . urlencode( $_GET['uselang'] ) : '' );
 96+ '?goto=mainpage' . ( isset( $_GET['uselang'] ) ? '&uselang=' . urlencode( $_GET['uselang'] ) : '' );
9797
9898 $redir = false;
9999
@@ -135,9 +135,9 @@
136136 ?><!DOCTYPE html>
137137 <html lang="en" dir="ltr">
138138 <head>
139 - <title>$escLanguage&nbsp;$escProject does not exist</title>
 139+ <title><?php echo "$escLanguage&nbsp;$escProject"; ?> does not exist</title>
140140 <meta charset="UTF-8" />
141 - <link rel="shortcut icon" href="$home/favicon.ico" />
 141+ <link rel="shortcut icon" href="<?php echo $home; ?>/favicon.ico" />
142142 <style type="text/css">
143143 /* <![CDATA[ */
144144 * {
@@ -154,7 +154,7 @@
155155 }
156156
157157 #page {
158 - background: url('$logo') center left no-repeat;
 158+ background: url('<?php echo $logo; ?>') center left no-repeat;
159159 height: 300px;
160160 left: 50%;
161161 margin: -150px 0 0 -360px;
@@ -191,11 +191,11 @@
192192
193193 <h1>This wiki does not exist</h1>
194194
195 - <h2>Welcome to $escProject</h2>
 195+ <h2>Welcome to <?php echo $escProject; ?></h2>
196196
197 - <p>Unfortunately, $escProject in "$escLanguage" does not exist on its own domain yet, or it has been closed.</p>
 197+ <p>Unfortunately, <?php echo $escProject; ?> in "<?php echo $escLanguage; ?>" does not exist on its own domain yet, or it has been closed.</p>
198198
199 - <p>You may like to visit <a href="$home">$name</a> to start or improve <em>$escLanguage&nbsp;$escProject</em> there.</p>
 199+ <p>You may like to visit <a href="<?php echo $home; ?>"><?php echo $name; ?></a> to start or improve <em><?php echo "$escLanguage&nbsp;$escProject"; ?></em> there.</p>
200200
201201 <p>If you would like to request that this wiki be created, see the <a href="https://www.mediawiki.org//meta.wikimedia.org/wiki/Requests_for_new_languages">requests for new languages</a> page on Meta-Wiki.</p>
202202

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r106857Also handle URLs like index.php?title=Page. Fallback to main page if no title...robin20:43, 20 December 2011

Status & tagging log