Page 1 of 1

Pisearch 1.71: Edit template breaks HTML

Posted: Fri Oct 20, 2006 12:25 pm
by olaf_noehring
Hi

when I want to adjust the template of Pisearch (pi_search) 1.71 it breaks the html:
Before changing it looks like this:


  Suchen:


......

after I submit my changes it looks like this:


  Suchen:


......


please, beg, knee down    .... some one help
Thanks,
Olaf

Re: Pisearch 1.71: Edit template breaks HTML

Posted: Sat Oct 21, 2006 3:17 pm
by Piratos
This is the solution:

change the function update of the module:

Code: Select all

function update($id, &$params, $return_id)
{
  if (isset($_GET['form']) && isset($_GET['result']))
  {
    if (get_magic_quotes_gpc()==1)
    {
      $f = stripslashes($_GET['form']);
      $r= stripslashes($_GET['result']);
    }
    else
    {
      $f = $_GET['form'];
      $r= $_GET['result'];
    }
  ......  etc etc 
This behavior must be a cmsms system bug with  php 4.3.3, because in include.php  this was every time in use:

Code: Select all

#Stupid magic quotes...
if(get_magic_quotes_gpc())
{
    strip_slashes($_GET);
    strip_slashes($_POST);
    strip_slashes($_REQUEST);
    strip_slashes($_COOKIE);
    strip_slashes($_SESSIONS);
}
but it seems that this does not work with php 4.3.3 and on module level  (other modules have the same problem).

The next pisearch version comes today.

Re: Pisearch 1.71: Edit template breaks HTML

Posted: Sat Oct 21, 2006 3:43 pm
by Piratos
This says php manual:
Description
string stripslashes ( string str)


Returns a string with backslashes stripped off. (\' becomes ' and so on.) Double backslashes (\\) are made into a single backslash (\).
but this is in include.php

Code: Select all

#Stupid magic quotes...
if(get_magic_quotes_gpc())
{
    strip_slashes($_GET);
    strip_slashes($_POST);
    strip_slashes($_REQUEST);
    strip_slashes($_COOKIE);
    strip_slashes($_SESSIONS);
}
it has no function , where is the return value ?

Re: Pisearch 1.71: Edit template breaks HTML

Posted: Sat Oct 21, 2006 5:25 pm
by Piratos
the working code in include.php must be something like this (found in php.net):

Code: Select all

if ( get_magic_quotes_gpc() ) {
   function stripslashes_deep($value) {
       if( is_array($value) )
       {
             $value = array_map('stripslashes_deep', $value)
       }
       elseif ( !empty($value) && is_string($value) )
       {
             $value = stripslashes($value);
       }
       return $value;
   }

   $_POST = stripslashes_deep($_POST);
   $_GET = stripslashes_deep($_GET);
   $_COOKIE = stripslashes_deep($_COOKIE);
}
you see, that original code of cmsms include.php can make heavy problems.

Re: Pisearch 1.71: Edit template breaks HTML

Posted: Sat Oct 21, 2006 6:03 pm
by Piratos
Module pisearch 1.72 is available in the dev.

Re: Pisearch 1.71: Edit template breaks HTML

Posted: Sat Oct 21, 2006 6:27 pm
by olaf_noehring
Hi

did you see this:
http://de3.php.net/manual/de/function.g ... es-gpc.php

I guess so, judging after your additions to the pi_search code.
Thanks again
Olaf