Fixed the obnoxious issue with forms using GET and index.php?title=Foo URL scheme (this works a whole lot better than MediaWiki now
authorDan
Tue, 04 Sep 2007 12:52:23 -0400
changeset 115 261f367623af
parent 114 47393c6619ea
child 116 77c75179bb95
Fixed the obnoxious issue with forms using GET and index.php?title=Foo URL scheme (this works a whole lot better than MediaWiki now
includes/pageutils.php
includes/template.php
plugins/SpecialSearch.php
plugins/SpecialUserFuncs.php
upgrade.sql
--- a/includes/pageutils.php	Tue Sep 04 08:25:48 2007 -0400
+++ b/includes/pageutils.php	Tue Sep 04 12:52:23 2007 -0400
@@ -509,6 +509,9 @@
       
       echo '<form action="'.makeUrlNS($namespace, $page_id, 'do=diff').'" onsubmit="ajaxHistDiff(); return false;" method="get">
             <input type="submit" value="Compare selected revisions" />
+            ' . ( urlSeparator == '&' ? '<input type="hidden" name="title" value="' . htmlspecialchars($paths->nslist[$namespace] . $page_id) . '" />' : '' ) . '
+            ' . ( $session->sid_super ? '<input type="hidden" name="auth"  value="' . $session->sid_super . '" />' : '') . '
+            <input type="hidden" name="do" value="diff" />
             <br /><span>&nbsp;</span>
             <div class="tblholder">
             <table border="0" width="100%" cellspacing="1" cellpadding="4">
--- a/includes/template.php	Tue Sep 04 08:25:48 2007 -0400
+++ b/includes/template.php	Tue Sep 04 12:52:23 2007 -0400
@@ -741,6 +741,9 @@
       'LOGOUT_LINK'=>$logout_link,
       'ADMIN_LINK'=>$admin_link,
       'THEME_LINK'=>$theme_link,
+      'SEARCH_ACTION'=>makeUrlNS('Special', 'Search'),
+      'INPUT_TITLE'=>( urlSeparator == '&' ? '<input type="hidden" name="title" value="' . htmlspecialchars( $paths->nslist[$paths->namespace] . $paths->cpage['urlname_nons'] ) . '" />' : ''),
+      'INPUT_AUTH'=>( $session->sid_super ? '<input type="hidden" name="auth"  value="' . $session->sid_super . '" />' : ''),
       'TEMPLATE_DIR'=>scriptPath.'/themes/'.$this->theme,
       'THEME_ID'=>$this->theme,
       'STYLE_ID'=>$this->style,
--- a/plugins/SpecialSearch.php	Tue Sep 04 08:25:48 2007 -0400
+++ b/plugins/SpecialSearch.php	Tue Sep 04 12:52:23 2007 -0400
@@ -71,7 +71,7 @@
       {
         $not[$i] = '-' . $not[$i];
       }
-      $q .= implode(' ', $not);
+      $q .= implode(' ', $not) . ' ';
     }
     if(!empty($_GET['require_words']))
     {
@@ -80,7 +80,7 @@
       {
         $req[$i] = '+' . $req[$i];
       }
-      $q .= implode(' ', $req);
+      $q .= implode(' ', $req) . ' ';
     }
   }
   $q = trim($q);
@@ -244,6 +244,9 @@
         <?php if ( $session->sid_super ): ?>
           <input type="hidden" name="auth" value="<?php echo $session->sid_super; ?>" />
         <?php endif; ?>
+        <?php if ( urlSeparator == '&' ): ?>
+          <input type="hidden" name="title" value="<?php echo $paths->nslist['Special'] . 'Search'; ?>" />
+        <?php endif; ?>
         <input type="text" name="q" size="40" value="<?php echo htmlspecialchars( $q ); ?>" /> <input type="submit" value="Go" style="font-weight: bold;" /> <input name="search" type="submit" value="Search" />  <small><a href="<?php echo makeUrlNS('Special', 'Search'); ?>">Advanced Search</a></small>
       </p>
     </form>
@@ -254,6 +257,9 @@
   ?>
     <br />
     <form action="<?php echo makeUrl($paths->page); ?>" method="get">
+      <?php if ( urlSeparator == '&' ): ?>
+        <input type="hidden" name="title" value="<?php echo $paths->nslist['Special'] . 'Search'; ?>" />
+      <?php endif; ?>
       <div class="tblholder">
         <table border="0" style="width: 100%;" cellspacing="1" cellpadding="4">
           <tr><th colspan="2">Advanced Search</th></tr>
--- a/plugins/SpecialUserFuncs.php	Tue Sep 04 08:25:48 2007 -0400
+++ b/plugins/SpecialUserFuncs.php	Tue Sep 04 12:52:23 2007 -0400
@@ -1224,6 +1224,8 @@
               ' .
               '<div style="float: left;">
                 <form action="' . makeUrlNS('Special', 'Memberlist') . '" method="get" onsubmit="if ( !submitAuthorized ) return false;">'
+               . ( urlSeparator == '&' ? '<input type="hidden" name="title" value="' . htmlspecialchars( $paths->nslist[$paths->namespace] . $paths->cpage['urlname_nons'] ) . '" />' : '' )
+               . ( $session->sid_super ? '<input type="hidden" name="auth"  value="' . $session->sid_super . '" />' : '')
                . '<p>Find a member: ' . $template->username_field('finduser') . ' <input type="submit" value="Go" /><br /><small>You may use the following wildcards: * to match multiple characters, ? to match a single character.</small></p>'
                . '</form>
                </div>'                                                                                                // Footer (printed after rows)
--- a/upgrade.sql	Tue Sep 04 08:25:48 2007 -0400
+++ b/upgrade.sql	Tue Sep 04 12:52:23 2007 -0400
@@ -5,6 +5,8 @@
 DELETE FROM {{TABLE_PREFIX}}config WHERE config_name='enano_version' OR config_name='enano_beta_version' OR config_name='enano_alpha_version' OR config_name='enano_rc_version';
 INSERT INTO {{TABLE_PREFIX}}config (config_name, config_value) VALUES( 'enano_version', '1.0.1' );
 ---BEGIN 1.0---
+-- Fix for obnoxious $_GET issue
+UPDATE {{TABLE_PREFIX}}sidebar SET block_content='<div class="slideblock2" style="padding: 0px;"><form action="$CONTENTPATH$$NS_SPECIAL$Search" method="get" style="padding: 0; margin: 0;"><p><input type="hidden" name="title" value="$NS_SPECIAL$Search" />$INPUT_AUTH$<input name="q" alt="Search box" type="text" size="10" style="width: 70%" /> <input type="submit" value="Go" style="width: 20%" /></p></form></div>' WHERE block_name='Search' AND item_id=4;
 -- Added on advice from Neal
 INSERT INTO {{TABLE_PREFIX}}acl(target_type,target_id,page_id,namespace,rules) VALUES(2,1,'Memberlist','Special','read=1;mod_misc=1;upload_files=1;upload_new_version=1;create_page=1;edit_acl=1;');
 -- Bugfix for MySQL 5.0.45, see http://forum.enanocms.org/viewtopic.php?f=5&t=8