Project

General

Profile

Actions

Bug #16036

closed

addQueryString does NOT work properly

Added by Dmitry Pikhno over 18 years ago. Updated over 18 years ago.

Status:
Closed
Priority:
Should have
Category:
Communication
Target version:
-
Start date:
2006-04-12
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.0
PHP Version:
4
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

1) it is again does not work with realurl due to the problem that was already fixed BEFORE. (#15286)
shortly speaking: reaurl transforms _GET but does not transform QUERY_STRING
2)problems even without realurl -
"Warning: rawurlencode() expects parameter 1 to be string, array given in /typo3_src/typo3/sysext/cms/tslib/class.tslib_content.php on line 5552"

marks.PRINTLINK {
    file=fileadmin/images/icon_print.gif
    stdWrap.typolink.parameter.data = page:uid
    stdWrap.typolink.additionalParams = &type=98
    stdWrap.typolink.addQueryString = 1
    stdWrap.typolink.addQueryString.method = GET
    #stdWrap.typolink.addQueryString.exclude = cHash
    altText = print version
}

3)and bonus - double "id" in result url (with enabled ".exclude = .." - it is ok)

bugs are in function getQueryArguments in tslib/class.tslib_content.php

this is code of updated function and it works properly(seems works good):

function getQueryArguments($conf,$overruleQueryArgs=array(),$forceArgs=FALSE) {
        $rawValues = FALSE;

        $q_in = array();
        switch((string)$conf['method'])    {
            case 'POST':
                $q_in = t3lib_div::_POST();
            break;
            case 'GET':
            default:
                foreach (explode('&',t3lib_div::implodeArrayForUrl('', t3lib_div::_GET())) as $arg)    {
                    list($k,$v) = explode('=',$arg);
                    if($v)    $q_in[$k] = $v;
                }
            break;
        }

        $q_out = array();
        $exclude = t3lib_div::trimExplode(',', $conf['exclude']);
        $exclude[] = 'id';    // never repeat id
        foreach ($q_in as $k => $v)   {
            if (!in_array($k, $exclude)) {
                if (isset($overruleQueryArgs[$k]))    {
                    $v = $overruleQueryArgs[$k];
                    unset($overruleQueryArgs[$k]);
                }
                $q_out[$k] = $v;
            }
        }
        // any remaining overrule arguments?
        if ($forceArgs)    {
            foreach ($overruleQueryArgs as $k => $v)    {
                $q_out[$k] = $v;
            }
        }
        $content = '';
        foreach ($q_out as $k => $v)    {
            $content .= '&'.$k.'='.($rawValues ? $v : rawurlencode($v));
        }
        return $content;
    }

(issue imported from #M3241)


Files

patch (561 Bytes) patch Administrator Admin, 2006-04-12 10:26
Actions

Also available in: Atom PDF