r24582 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24581‎ | r24582 | r24583 >
Date:14:35, 4 August 2007
Author:robchurch
Status:old
Tags:
Comment:
Use Titles to get search URLs and keep $wgUser out of parser hooks
Modified paths:
  • /trunk/extensions/inputbox/inputbox.php (modified) (history)

Diff [purge]

Index: trunk/extensions/inputbox/inputbox.php
@@ -71,10 +71,9 @@
7272 }
7373
7474 function getSearchForm() {
75 - global $wgUser, $wgContLang;
 75+ global $wgContLang;
 76+ $search = SpecialPage::getTitleFor( 'Search' )->escapeLocalUrl();
7677
77 - $sk=$wgUser->getSkin();
78 - $searchpath = $sk->escapeSearchLink();
7978 if(!$this->buttonlabel) {
8079 $this->buttonlabel = wfMsgHtml( 'tryexact' );
8180 }
@@ -88,7 +87,7 @@
8988 <table border="0" width="100%" cellspacing="0" cellpadding="0">
9089 <tr>
9190 <td align="center" bgcolor="{$this->bgcolor}">
92 - <form name="searchbox" action="$searchpath" class="searchbox">
 91+ <form name="searchbox" action="{$search}" class="searchbox">
9392 <input class="searchboxInput" name="search" type="{$type}"
9493 value="{$this->defaulttext}" size="{$this->width}" />{$this->br}
9594 ENDFORM;
@@ -141,10 +140,8 @@
142141 }
143142
144143 function getSearchForm2() {
145 - global $wgUser;
146 -
147 - $sk=$wgUser->getSkin();
148 - $searchpath = $sk->escapeSearchLink();
 144+ $search = SpecialPage::getTitleFor( 'Search' )->escapeLocalUrl();
 145+
149146 if(!$this->buttonlabel) {
150147 $this->buttonlabel = wfMsgHtml( 'tryexact' );
151148 }
@@ -157,7 +154,7 @@
158155
159156 $type = $this->hidden ? 'hidden' : 'text';
160157 $searchform=<<<ENDFORM
161 -<form action="$searchpath" class="bodySearch" id="bodySearch{$this->id}"><div class="bodySearchWrap"><label for="bodySearchIput{$this->id}">{$this->labeltext}</label><input type="{$type}" name="search" size="{$this->width}" class="bodySearchIput" id="bodySearchIput{$this->id}" /><input type="submit" name="go" value="{$this->buttonlabel}" class="bodySearchBtnGo" />
 158+<form action="$search" class="bodySearch" id="bodySearch{$this->id}"><div class="bodySearchWrap"><label for="bodySearchIput{$this->id}">{$this->labeltext}</label><input type="{$type}" name="search" size="{$this->width}" class="bodySearchIput" id="bodySearchIput{$this->id}" /><input type="submit" name="go" value="{$this->buttonlabel}" class="bodySearchBtnGo" />
162159 ENDFORM;
163160
164161 if ( !empty( $this->fulltextbtn ) ) // this is wrong...

Status & tagging log