Printview converts some external URLs to ?print

A place to report and discuss bugs - please mention CMSimple-version, server, platform and browser version
Post Reply
cmb
Posts: 13274
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Printview converts some external URLs to ?print

Post by cmb » Thu Sep 11, 2014 12:36 pm

Hello Community,

I received a bug report from Olaf who noticed, that external URLs without a path (e.g. http://example.com instead of http://example.com/) are converted to ?print in the print view. That is caused by my silly mistake to negate a boolean AND expression without heeding De Morgan's laws; the following code in XH_isInternalUrl() in cmsimple/functions.php is nonsense, of course:

Code: Select all

    $ok = !isset(
        $urlParts['scheme'], $urlParts['host'], $urlParts['port'],
        $urlParts['user'], $urlParts['pass']
    ); 
It should rather be:

Code: Select all

    $ok = true;
    foreach (array('scheme', 'host', 'port', 'user', 'pass') as $key) {
        $ok = $ok && !isset($urlParts[$key]);
    } 
Christoph
Christoph M. Becker – Plugins for CMSimple_XH

cmb
Posts: 13274
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: Printview converts some external URLs to ?print

Post by cmb » Thu Sep 11, 2014 12:41 pm

Fixed (r1368).
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply