Exemple #1
0
 */
if (file_exists('libs/Wakka.class.php')) {
    require_once 'libs/Compatibility.lib.php';
    require_once 'libs/Wakka.class.php';
} else {
    die(ERROR_WAKKA_LIBRARY_MISSING);
}
// ----------------------------- END SANITY CHECKS ----------------------------
ob_start();
global $tstart;
$tstart = getmicrotime();
ini_set('magic_quotes_runtime', 0);
if (get_magic_quotes_gpc()) {
    magicQuotesWorkaround($_POST);
    magicQuotesWorkaround($_GET);
    magicQuotesWorkaround($_COOKIE);
}
/**
 * Default configuration.
 */
// attempt to derive base URL fragments and whether rewrite mode is enabled (#438)
$t_domain = $_SERVER['SERVER_NAME'];
$t_scheme = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && 'off' != $_SERVER['HTTPS'] ? 'https://' : 'http://';
$t_port = ':' . $_SERVER['SERVER_PORT'];
if ('http://' == $t_scheme && ':80' == $t_port || 'https://' == $t_scheme && ':443' == $t_port) {
    $t_port = '';
}
$t_request = $_SERVER['REQUEST_URI'];
// append slash if $t_request does not end with either a slash or the string .php
if (!preg_match('@(\\.php|/)$@i', $t_request)) {
    //	$t_request .= '/';
/**
 * Workaround for the amazingly annoying magic quotes.
 *
 * Note that this function will only operate on an array; if a scalar is passed
 * it is left untouched.
 *
 * @param	array	$a	array to be cleaned of "magic quotes" (slashes); passed
 *					by reference
 */
function magicQuotesWorkaround(&$a)
{
    if (is_array($a)) {
        foreach ($a as $k => $v) {
            if (is_array($v)) {
                magicQuotesWorkaround($a[$k]);
            } else {
                $a[$k] = stripslashes($v);
            }
        }
    }
}