https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114866

Revision: 114866
Author:   schuellersa
Date:     2012-04-12 17:34:49 +0000 (Thu, 12 Apr 2012)
Log Message:
-----------
function adField with strip_tags fixed

Modified Paths:
--------------
    trunk/extensions/SolrStore/SolrDoc.php
    trunk/extensions/SolrStore/SpecialSolrSearch.php

Modified: trunk/extensions/SolrStore/SolrDoc.php
===================================================================
--- trunk/extensions/SolrStore/SolrDoc.php      2012-04-12 12:35:05 UTC (rev 
114865)
+++ trunk/extensions/SolrStore/SolrDoc.php      2012-04-12 17:34:49 UTC (rev 
114866)
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * File holding the SolrDoc class
  *
@@ -13,9 +14,10 @@
  * @ingroup SolrStore
  */
 class SolrDoc {
+
        private $output;
-       private $min = array();
-       private $max = array();
+       private $min = array( );
+       private $max = array( );
 
        /**
         * Add a field to the SolrDoc
@@ -24,7 +26,7 @@
         * @param $value String: value of the field
         */
        public function addField( $name, $value ) {
-               $this->output .= '<field name="' .  
Sanitizer::normalizeCharReferences ( $name ) . '">' . 
Sanitizer::normalizeCharReferences ( $value ) . '</field>';
+               $this->output .= '<field name="' . strip_tags( $name ) . '">' . 
strip_tags( $value ) . '</field>';
        }
 
        /**
@@ -36,31 +38,32 @@
         */
        public function addSortField( $name, $value ) {
                // Does a min/max field with this name exist?
-               if ( isset( $this->min[$name] ) && isset( $this->max[$name] ) ) 
{
-                       if ( strcasecmp( $this->min[$name], $value ) > 0 ) {
+               if ( isset( $this->min[ $name ] ) && isset( $this->max[ $name ] 
) ) {
+                       if ( strcasecmp( $this->min[ $name ], $value ) > 0 ) {
                                // If the new string is less the old one, 
replace them
-                               $this->min[$name] = $value;
+                               $this->min[ $name ] = $value;
                        }
-                       if ( strcasecmp( $this->max[$name], $value ) < 0 ) {
+                       if ( strcasecmp( $this->max[ $name ], $value ) < 0 ) {
                                // If the new string is bigger than old one, 
replace them
-                               $this->max[$name] = $value;
+                               $this->max[ $name ] = $value;
                        }
                } else {
-                       $this->min[$name] = $value;
-                       $this->max[$name] = $value;
+                       $this->min[ $name ] = $value;
+                       $this->max[ $name ] = $value;
                }
        }
 
        public function printFields() {
                $all = $this->output;
 
-               foreach ( $this->min as $name => $value ) {
+               foreach ( $this->min as $name=>$value ) {
                        $all .= '<field name="' . $name . 'min">' . $value . 
'</field>';
                }
-               foreach ( $this->max as $name => $value ) {
+               foreach ( $this->max as $name=>$value ) {
                        $all .= '<field name="' . $name . 'max">' . $value . 
'</field>';
                }
 
                return $all;
        }
+
 }

Modified: trunk/extensions/SolrStore/SpecialSolrSearch.php
===================================================================
--- trunk/extensions/SolrStore/SpecialSolrSearch.php    2012-04-12 12:35:05 UTC 
(rev 114865)
+++ trunk/extensions/SolrStore/SpecialSolrSearch.php    2012-04-12 17:34:49 UTC 
(rev 114866)
@@ -527,7 +527,6 @@
                        $out .= Xml::tags( 'div', array( 
'class'=>'results-info' ), Xml::tags( 'ul', null, Xml::tags( 'li', null, $top ) 
) );
                }
 
-               $out .= Xml::element( 'div', array( 'style'=>'clear:both' ), 
'', false );
                $out .= Xml::closeElement( 'div' );
 
                return $out;
@@ -560,7 +559,7 @@
                                        ) ) . "\n";
                        $out .= '</td></tr>';
                }
-               $out .= '</table>';
+               $out .= '<table>';
                $out .= Xml::submitButton( wfMsg( 'searchbutton' ) ) . "\n";
                return $out . $this->didYouMeanHtml;
        }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to