Esempio n. 1
0
<?php

require_once 'Sprinkles.php';
print "PHP major version: " . php_major_version() . "<br />";
print $needs_unbollocks ? "PHP version thought to be pre-6. Needs unbollocks" : "PHP version thought to be 6 or later. No need for unbollocks.";
Esempio n. 2
0
}
# Must die, else circular handling
mysql_select_db($mysql_db ? $mysql_db : 'sprinkles');
function unbollocks($str)
{
    ## CURSE CURSE CURSE
    ## unencodes strings that are needlessly encoded by default in PHP < 6.0
    return preg_replace(array("/\\\\'/", '/\\\\"/', "/\\\\\\\\/", "/\\\\0/"), array("'", '"', "\\", ""), $str);
}
function php_major_version()
{
    $version_str = phpversion();
    list($major) = explode('.', $version_str);
    return $major;
}
$needs_unbollocks = php_major_version() < 6;
# request_param returns the HTTP request parameter, whether it lies in the
# query string or the POST data.
function request_param($name)
{
    if ($_GET[$name]) {
        $result = $_GET[$name];
    } else {
        if ($_POST[$name]) {
            $result = $_POST[$name];
        }
    }
    global $needs_unbollocks;
    # Versions before 6 do an unwarranted backslashing of request parameters;
    # Here we reverse that so we get the real data.
    if ($needs_unbollocks && get_magic_quotes_gpc()) {