Esempio n. 1
0
function combo_params() {
    if (isset($_SERVER['QUERY_STRING']) and strpos($_SERVER['QUERY_STRING'], 'file=/') === 0) {
        // url rewriting
        $slashargument = substr($_SERVER['QUERY_STRING'], 6);
        return array($slashargument, true);

    } else if (isset($_SERVER['REQUEST_URI']) and strpos($_SERVER['REQUEST_URI'], '?') !== false) {
        $parts = explode('?', $_SERVER['REQUEST_URI'], 2);
        return array($parts[1], false);

    } else if (isset($_SERVER['QUERY_STRING']) and strpos($_SERVER['QUERY_STRING'], '?') !== false) {
        // note: buggy or misconfigured IIS does return the query string in REQUEST_URI
        return array($_SERVER['QUERY_STRING'], false);

    } else if ($slashargument = min_get_slash_argument()) {
        $slashargument = ltrim($slashargument, '/');
        return array($slashargument, true);

    } else {
        // unsupported server, sorry!
        combo_not_found('Unsupported server - query string can not be determined, try disabling YUI combo loading in admin settings.');
    }
}
Esempio n. 2
0
function combo_params()
{
    // note: buggy or misconfigured IIS does return the query string in REQUEST_URL
    if (isset($_SERVER['REQUEST_URI']) and strpos($_SERVER['REQUEST_URI'], '?') !== false) {
        $parts = explode('?', $_SERVER['REQUEST_URI'], 2);
        return $parts[1];
    } else {
        if (isset($_SERVER['QUERY_STRING'])) {
            return $_SERVER['QUERY_STRING'];
        } else {
            // unsupported server, sorry!
            combo_not_found('Unsupported server - query string can not be determined, try disabling YUI combo loading in admin settings.');
        }
    }
}
require '../config.php';
// this stops immediately at the beginning of lib/setup.php
// get special url parameters
if (!($parts = combo_params())) {
    combo_not_found();
}
$parts = trim($parts, '&');
// find out what we are serving - only one type per request
$content = '';
if (substr($parts, -3) === '.js') {
    $mimetype = 'application/javascript';
} else {
    if (substr($parts, -4) === '.css') {
        $mimetype = 'text/css';
    } else {
        combo_not_found();
    }
}
$parts = explode('&', $parts);
$cache = true;
foreach ($parts as $part) {
    if (empty($part)) {
        continue;
    }
    $part = min_clean_param($part, 'SAFEPATH');
    $bits = explode('/', $part);
    if (count($bits) < 2) {
        $content .= "\n// Wrong combo resource {$part}!\n";
        continue;
    }
    //debug($bits);