Loading

Author Topic: Links in pages  (Read 818 times)

Anders

  • Newbie
  • *
  • Posts: 10
Links in pages
« on: January 21, 2012, 12:22:11 pm »
Hi All!

I did a new fresh 2.3.5 installation and when I tried to make links in Pages and even in the plugin, Editable Module I always got "%5C".

<p><a href="http://www.osclass.org/">osclass</a></p>  become  <p><a href="%5C">osclass</a></p>

This works great in 2.3.4

How to get links to works in pages, when I use 2.3.5? 
Anders

sstef25

  • Jr. Member
  • **
  • Posts: 68
    • Email
Re: Links in pages
« Reply #1 on: January 21, 2012, 02:43:35 pm »
Hi!

I was just about to start a topic on this  :) I noticed the same behaviour!!

Links on custom pages are replaced with "%5C" !!

I had the links working on my site, and today i've noticed the %5C. I can't say for sure though that it's from the update since i didn't check the links after upgrading....
Anybody got any ideea why this is happening?

Stefan

freeeadz

  • Newbie
  • *
  • Posts: 42
  • E-Adz
    • E-Adz
    • Email
Re: Links in pages
« Reply #2 on: January 26, 2012, 09:38:44 am »
me too having same problem..........

really keen to now the solution.

sstef25

  • Jr. Member
  • **
  • Posts: 68
    • Email
Re: Links in pages
« Reply #3 on: January 26, 2012, 12:12:33 pm »
Yes, we are quit a few with this problem, unfortunately seems that nobody knows the answer....

There is a similar topic opened here http://forums.osclass.org/development/my-links-on-page-do-not-work/ with the same "answers" :D ....
hopefully someone would get to the bottom of this eventualy....

Stefan

sstef25

  • Jr. Member
  • **
  • Posts: 68
    • Email
Re: Links in pages
« Reply #4 on: January 27, 2012, 09:06:44 pm »
Anybody knows how to correct this ??
It's really frustrating... none of the inserted links on the site works...

Stefan

sumitm

  • Newbie
  • *
  • Posts: 12
    • Email
Re: Links in pages
« Reply #5 on: February 10, 2012, 10:35:55 am »
Guys ... I eventually found a solution to this. The issue is solved by cleaning up the magic quotes. Add the following code to the bottom of your /oc-includes/osclass/core/Params.php and you'll be good to go.

if (get_magic_quotes_gpc()) {
    function stripslashes_deep($value)
    {
        $value = is_array($value) ?
                    array_map('stripslashes_deep', $value) :
                    stripslashes($value);

        return $value;
    }

    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
    $_REQUEST = array_map('stripslashes_deep', $_REQUEST);
}


rafl

  • Sr. Member
  • ****
  • Posts: 415
    • Anunturi
Re: Links in pages
« Reply #6 on: February 19, 2012, 09:41:05 pm »
I'm not able to reproduce this issue...

cas87

  • Newbie
  • *
  • Posts: 36
    • Email
Re: Links in pages
« Reply #7 on: February 22, 2012, 10:07:40 pm »
Guys ... I eventually found a solution to this. The issue is solved by cleaning up the magic quotes. Add the following code to the bottom of your /oc-includes/osclass/core/Params.php and you'll be good to go.

if (get_magic_quotes_gpc()) {
    function stripslashes_deep($value)
    {
        $value = is_array($value) ?
                    array_map('stripslashes_deep', $value) :
                    stripslashes($value);

        return $value;
    }

    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
    $_REQUEST = array_map('stripslashes_deep', $_REQUEST);
}

This Doesn't work for me using the modern theme.. if i change this i end up with an error on line xxx and the whole site goes down lol, what theme are you using? :)

sumitm

  • Newbie
  • *
  • Posts: 12
    • Email
Re: Links in pages
« Reply #8 on: February 22, 2012, 11:25:53 pm »
Hey cas87

I am using modern theme too .. Working fine for me. A few others also tried the same method and it worked for them too. Maybe you missed a brace or something.

Regards,
SumitM

cas87

  • Newbie
  • *
  • Posts: 36
    • Email
Re: Links in pages
« Reply #9 on: February 26, 2012, 07:06:40 pm »
Thanks for the reply sumitm, This is what my params.php looks like before i edit it..



Code: [Select]
<?php if ( ! defined('ABS_PATH')) exit('ABS_PATH is not loaded. Direct access is not allowed.');

    
/*
     *      OSCLass – software for creating and publishing online classified
     *                           advertising platforms
     *
     *                        Copyright (C) 2010 OSCLASS
     *
     *       This program is free software: you can redistribute it and/or
     *     modify it under the terms of the GNU Affero General Public License
     *     as published by the Free Software Foundation, either version 3 of
     *            the License, or (at your option) any later version.
     *
     *     This program is distributed in the hope that it will be useful, but
     *         WITHOUT ANY WARRANTY; without even the implied warranty of
     *        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     *             GNU Affero General Public License for more details.
     *
     *      You should have received a copy of the GNU Affero General Public
     * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
     */


    
class Params
    
{
        
        private static 
$purifier;
        
        function 
__construct() { }

        static function 
getParam($param$htmlencode false$xss_check true)
        {
            if (
$param == "") return '' ;
            if (!isset(
$_REQUEST[$param])) return '' ;

            if(
$xss_check==true && !isset(self::$purifier)) {
                require_once 
LIB_PATH 'htmlpurifier/HTMLPurifier.auto.php';
                
$config HTMLPurifier_Config::createDefault();
                
$config->set('HTML.Allowed''b,strong,i,em,u,a[href|title],ul,ol,li,p[style],br,span[style]');
                
$config->set('CSS.AllowedProperties''font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align');
                
$config->set('Cache.SerializerPath'ABS_PATH 'oc-content/uploads');
                
self::$purifier = new HTMLPurifier($config);
            }
            
            
$value $_REQUEST[$param];

            if (!
is_array($value)) {
                if(
$xss_check) {
                    
$value self::$purifier->purify($_REQUEST[$param]);
                }
                if (
$htmlencode) {
                    return 
htmlspecialchars(stripslashes($value), ENT_QUOTES);
                }
            } else {
                if(
$xss_check) {
                    foreach(
$value as $k => $v) {
                        
$value[$k] = self::$purifier->purify($v);
                    }
                }
            }

            if(
get_magic_quotes_gpc()) {
                
$value strip_slashes_extended($value);
            }

            return (
$value);
        }

        static function 
existParam($param) {
            if (
$param == "") return false ;
            if (!isset(
$_REQUEST[$param])) return false ;
            return 
true;
        }

        static function 
getFiles($param)
        {
            if (isset(
$_FILES[$param])) {
                return (
$_FILES[$param]);
            } else {
                return 
"";
            }
        }

        
//$what = "post, get, cookie"
        
static function getParamsAsArray($what ""$xss_check true)
        {
            switch (
$what) {
                case(
"get"):    
                    
$value $_GET;
                break;
                case(
"post"):   
                    
$value $_POST;
                break;
                case(
"cookie"):
                    return 
$_COOKIE;
                break;
                default:        
                    
$value $_REQUEST;
                break;
            }
            
            if(
$xss_check==true) {
                if(!isset(
self::$purifier)) {
                    require_once 
LIB_PATH 'htmlpurifier/HTMLPurifier.auto.php';
                    
$config HTMLPurifier_Config::createDefault();
                    
$config->set('HTML.Allowed''b,strong,i,em,u,a[href|title],ul,ol,li,p[style],br,span[style]');
                    
$config->set('CSS.AllowedProperties''font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align');
                    
$config->set('Cache.SerializerPath'ABS_PATH 'oc-content/uploads');
                    
self::$purifier = new HTMLPurifier($config);
                }
                foreach(
$value as $k => $v) {
                    
$value[$k] = self::$purifier->purify($v);
                }
            }
            if(
get_magic_quotes_gpc()) {
                return 
strip_slashes_extended($value);
            }
            return 
$value;
        }

        static function 
setParam($key$value)
        {
            
$_REQUEST[$key] = $value;
            
$_GET[$key] = $value;
            
$_POST[$key] = $value;
        }

        static function 
_view() {
            
print_r(self::getParamsAsArray()) ;
        }
    }

?>



This is After

Code: [Select]
<?php if ( ! defined('ABS_PATH')) exit('ABS_PATH is not loaded. Direct access is not allowed.');

    
/*
     *      OSCLass – software for creating and publishing online classified
     *                           advertising platforms
     *
     *                        Copyright (C) 2010 OSCLASS
     *
     *       This program is free software: you can redistribute it and/or
     *     modify it under the terms of the GNU Affero General Public License
     *     as published by the Free Software Foundation, either version 3 of
     *            the License, or (at your option) any later version.
     *
     *     This program is distributed in the hope that it will be useful, but
     *         WITHOUT ANY WARRANTY; without even the implied warranty of
     *        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     *             GNU Affero General Public License for more details.
     *
     *      You should have received a copy of the GNU Affero General Public
     * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
     */


    
class Params
    
{
        
        private static 
$purifier;
        
        function 
__construct() { }

        static function 
getParam($param$htmlencode false$xss_check true)
        {
            if (
$param == "") return '' ;
            if (!isset(
$_REQUEST[$param])) return '' ;

            if(
$xss_check==true && !isset(self::$purifier)) {
                require_once 
LIB_PATH 'htmlpurifier/HTMLPurifier.auto.php';
                
$config HTMLPurifier_Config::createDefault();
                
$config->set('HTML.Allowed''b,strong,i,em,u,a[href|title],ul,ol,li,p[style],br,span[style]');
                
$config->set('CSS.AllowedProperties''font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align');
                
$config->set('Cache.SerializerPath'ABS_PATH 'oc-content/uploads');
                
self::$purifier = new HTMLPurifier($config);
            }
            
            
$value $_REQUEST[$param];

            if (!
is_array($value)) {
                if(
$xss_check) {
                    
$value self::$purifier->purify($_REQUEST[$param]);
                }
                if (
$htmlencode) {
                    return 
htmlspecialchars(stripslashes($value), ENT_QUOTES);
                }
            } else {
                if(
$xss_check) {
                    foreach(
$value as $k => $v) {
                        
$value[$k] = self::$purifier->purify($v);
                    }
                }
            }

            if(
get_magic_quotes_gpc()) {
                
$value strip_slashes_extended($value);
            }

            return (
$value);
        }

        static function 
existParam($param) {
            if (
$param == "") return false ;
            if (!isset(
$_REQUEST[$param])) return false ;
            return 
true;
        }

        static function 
getFiles($param)
        {
            if (isset(
$_FILES[$param])) {
                return (
$_FILES[$param]);
            } else {
                return 
"";
            }
        }

        
//$what = "post, get, cookie"
        
static function getParamsAsArray($what ""$xss_check true)
        {
            switch (
$what) {
                case(
"get"):    
                    
$value $_GET;
                break;
                case(
"post"):   
                    
$value $_POST;
                break;
                case(
"cookie"):
                    return 
$_COOKIE;
                break;
                default:        
                    
$value $_REQUEST;
                break;
            }
            
            if(
$xss_check==true) {
                if(!isset(
self::$purifier)) {
                    require_once 
LIB_PATH 'htmlpurifier/HTMLPurifier.auto.php';
                    
$config HTMLPurifier_Config::createDefault();
                    
$config->set('HTML.Allowed''b,strong,i,em,u,a[href|title],ul,ol,li,p[style],br,span[style]');
                    
$config->set('CSS.AllowedProperties''font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align');
                    
$config->set('Cache.SerializerPath'ABS_PATH 'oc-content/uploads');
                    
self::$purifier = new HTMLPurifier($config);
                }
                foreach(
$value as $k => $v) {
                    
$value[$k] = self::$purifier->purify($v);
                }
            }
if (
get_magic_quotes_gpc()) {
    function 
stripslashes_deep($value)
    {
        
$value is_array($value) ?
                    
array_map('stripslashes_deep'$value) :
                    
stripslashes($value);

        return 
$value;
    }

    
$_POST array_map('stripslashes_deep'$_POST);
    
$_GET array_map('stripslashes_deep'$_GET);
    
$_COOKIE array_map('stripslashes_deep'$_COOKIE);
    
$_REQUEST array_map('stripslashes_deep'$_REQUEST);
}
    }

?>

This after with no joy.. am i doing this wrong? also if not, is my params.php the same as yours? if not, could you paste your params.php ? if so would it be possible for me to just copy/paste what works for you ? :) :)
« Last Edit: February 27, 2012, 12:55:40 am by cas87 »

sumitm

  • Newbie
  • *
  • Posts: 12
    • Email
Re: Links in pages
« Reply #10 on: February 27, 2012, 07:53:12 am »
Hey cas87,

This is what my Params.php looks like.

<?php if ( ! defined('ABS_PATH')) exit('ABS_PATH is not loaded. Direct access is not allowed.');

    /*
     *      OSCLass – software for creating and publishing online classified
     *                           advertising platforms
     *
     *                        Copyright (C) 2010 OSCLASS
     *
     *       This program is free software: you can redistribute it and/or
     *     modify it under the terms of the GNU Affero General Public License
     *     as published by the Free Software Foundation, either version 3 of
     *            the License, or (at your option) any later version.
     *
     *     This program is distributed in the hope that it will be useful, but
     *         WITHOUT ANY WARRANTY; without even the implied warranty of
     *        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     *             GNU Affero General Public License for more details.
     *
     *      You should have received a copy of the GNU Affero General Public
     * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
     */


    class Params
    {
       
        private static $purifier;
       
        function __construct() { }

        static function getParam($param, $htmlencode = false, $xss_check = true)
        {
            if ($param == "") return '' ;
            if (!isset($_REQUEST[$param])) return '' ;

            if($xss_check==true && !isset(self::$purifier)) {
                require_once LIB_PATH . 'htmlpurifier/HTMLPurifier.auto.php';
                $config = HTMLPurifier_Config::createDefault();
                $config->set('HTML.Allowed', 'b,strong,i,em,u,a[href|title],ul,ol,li,p[style],br,span[style]');
                $config->set('CSS.AllowedProperties', 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align');
                $config->set('Cache.SerializerPath', ABS_PATH . 'oc-content/uploads');
                self::$purifier = new HTMLPurifier($config);
            }
           
            $value = $_REQUEST[$param];

            if (!is_array($value)) {
                if($xss_check) {
                    $value = self::$purifier->purify($_REQUEST[$param]);
                }
                if ($htmlencode) {
                    return htmlspecialchars(stripslashes($value), ENT_QUOTES);
                }
            } else {
                if($xss_check) {
                    foreach($value as $k => $v) {
                        $value[$k] = self::$purifier->purify($v);
                    }
                }
            }

            if(get_magic_quotes_gpc()) {
                $value = strip_slashes_extended($value);
            }

            return ($value);
        }

        static function existParam($param) {
            if ($param == "") return false ;
            if (!isset($_REQUEST[$param])) return false ;
            return true;
        }

        static function getFiles($param)
        {
            if (isset($_FILES[$param])) {
                return ($_FILES[$param]);
            } else {
                return "";
            }
        }

        //$what = "post, get, cookie"
        static function getParamsAsArray($what = "", $xss_check = true)
        {
            switch ($what) {
                case("get"):   
                    $value = $_GET;
                break;
                case("post"):   
                    $value = $_POST;
                break;
                case("cookie"):
                    return $_COOKIE;
                break;
                default:       
                    $value = $_REQUEST;
                break;
            }
           
            if($xss_check==true) {
                if(!isset(self::$purifier)) {
                    require_once LIB_PATH . 'htmlpurifier/HTMLPurifier.auto.php';
                    $config = HTMLPurifier_Config::createDefault();
                    $config->set('HTML.Allowed', 'b,strong,i,em,u,a[href|title],ul,ol,li,p[style],br,span[style]');
                    $config->set('CSS.AllowedProperties', 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align');
                    $config->set('Cache.SerializerPath', ABS_PATH . 'oc-content/uploads');
                    self::$purifier = new HTMLPurifier($config);
                }
                foreach($value as $k => $v) {
                    $value[$k] = self::$purifier->purify($v);
                }
            }
            if(get_magic_quotes_gpc()) {
                return strip_slashes_extended($value);
            }
            return $value;
        }

        static function setParam($key, $value)
        {
            $_REQUEST[$key] = $value;
            $_GET[$key] = $value;
            $_POST[$key] = $value;
        }

        static function _view() {
            print_r(self::getParamsAsArray()) ;
        }
    }
if (get_magic_quotes_gpc()) {
    function stripslashes_deep($value)
    {
        $value = is_array($value) ?
                    array_map('stripslashes_deep', $value) :
                    stripslashes($value);

        return $value;
    }

    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
    $_REQUEST = array_map('stripslashes_deep', $_REQUEST);
}
?>

expressnetwork

  • Newbie
  • *
  • Posts: 11
    • Email
Re: Links in pages
« Reply #11 on: February 28, 2012, 09:37:51 am »
Hi i just tried this code but getting below given error.
my url is : http://www.expressnetwork.in


Warning: preg_match() expects parameter 2 to be string, array given in /home/expressn/public_html/oc-includes/htmlpurifier/HTMLPurifier/Lexer.php on line 316

Warning: preg_match() expects parameter 2 to be string, array given in /home/expressn/public_html/oc-includes/htmlpurifier/HTMLPurifier/Encoder.php on line 54

Warning: preg_match() expects parameter 2 to be string, array given in /home/expressn/public_html/oc-includes/htmlpurifier/HTMLPurifier/Lexer.php on line 316

Warning: preg_match() expects parameter 2 to be string, array given in /home/expressn/public_html/oc-includes/htmlpurifier/HTMLPurifier/Encoder.php on line 54

Warning: current() [function.current]: Passed variable is not an array or object in /home/expressn/public_html/oc-content/plugins/moreedit/index.php on line 84

Fatal error: Call to a member function row() on a non-object in /home/expressn/public_html/oc-includes/osclass/model/User.php on line 103

rafl

  • Sr. Member
  • ****
  • Posts: 415
    • Anunturi
Re: Links in pages
« Reply #12 on: February 28, 2012, 04:30:59 pm »
Quote
Links on custom pages are replaced with "%5C"

Hi, can you please check this other post? It will be interesting to get to a solution

http://forums.osclass.org/development/my-links-on-page-do-not-work/msg22956/#msg22956

cas87

  • Newbie
  • *
  • Posts: 36
    • Email
Re: Links in pages
« Reply #13 on: February 29, 2012, 01:36:54 am »
Tanks sumitm, your copy of params.php worked like a charm, i must have been missing something..  ;D

Evelyne

  • Jr. Member
  • **
  • Posts: 56
Re: Links in pages
« Reply #14 on: May 13, 2012, 10:45:00 pm »
Thanks sumitm

Your code insertion worked for me too!
I don't know much. Hence, I'm always learning!