Beispiel #1
0
function parse_request()
{
    global $conf, $page;
    if ($conf['question_mark_in_urls'] == false and isset($_SERVER["PATH_INFO"]) and !empty($_SERVER["PATH_INFO"])) {
        $req = $_SERVER["PATH_INFO"];
        $req = str_replace('//', '/', $req);
        $path_count = count(explode('/', $req));
        $page['root_path'] = PHPWG_ROOT_PATH . str_repeat('../', $path_count - 1);
    } else {
        $req = $_SERVER["QUERY_STRING"];
        if ($pos = strpos($req, '&')) {
            $req = substr($req, 0, $pos);
        }
        $req = rawurldecode($req);
        /*foreach (array_keys($_GET) as $keynum => $key)
          {
            $req = $key;
            break;
          }*/
        $page['root_path'] = PHPWG_ROOT_PATH;
    }
    $req = ltrim($req, '/');
    foreach (preg_split('#/+#', $req) as $token) {
        preg_match($conf['sync_chars_regex'], $token) or ierror('Invalid chars in request', 400);
    }
    $page['derivative_path'] = PHPWG_ROOT_PATH . PWG_DERIVATIVE_DIR . $req;
    $pos = strrpos($req, '.');
    $pos !== false || ierror('Missing .', 400);
    $ext = substr($req, $pos);
    $page['derivative_ext'] = $ext;
    $req = substr($req, 0, $pos);
    $pos = strrpos($req, '-');
    $pos !== false || ierror('Missing -', 400);
    $deriv = substr($req, $pos + 1);
    $req = substr($req, 0, $pos);
    $deriv = explode('_', $deriv);
    foreach (ImageStdParams::get_defined_type_map() as $type => $params) {
        if (derivative_to_url($type) == $deriv[0]) {
            $page['derivative_type'] = $type;
            $page['derivative_params'] = $params;
            break;
        }
    }
    if (!isset($page['derivative_type'])) {
        if (derivative_to_url(IMG_CUSTOM) == $deriv[0]) {
            $page['derivative_type'] = IMG_CUSTOM;
        } else {
            ierror('Unknown parsing type', 400);
        }
    }
    array_shift($deriv);
    if ($page['derivative_type'] == IMG_CUSTOM) {
        $params = $page['derivative_params'] = parse_custom_params($deriv);
        ImageStdParams::apply_global($params);
        if ($params->sizing->ideal_size[0] < 20 or $params->sizing->ideal_size[1] < 20) {
            ierror('Invalid size', 400);
        }
        if ($params->sizing->max_crop < 0 or $params->sizing->max_crop > 1) {
            ierror('Invalid crop', 400);
        }
        $greatest = ImageStdParams::get_by_type(IMG_XXLARGE);
        $key = array();
        $params->add_url_tokens($key);
        $key = implode('_', $key);
        if (!isset(ImageStdParams::$custom[$key])) {
            ierror('Size not allowed', 403);
        }
    }
    if (is_file(PHPWG_ROOT_PATH . $req . $ext)) {
        $req = './' . $req;
        // will be used to match #iamges.path
    } elseif (is_file(PHPWG_ROOT_PATH . '../' . $req . $ext)) {
        $req = '../' . $req;
    }
    $page['src_location'] = $req . $ext;
    $page['src_path'] = PHPWG_ROOT_PATH . $page['src_location'];
    $page['src_url'] = $page['root_path'] . $page['src_location'];
}
Beispiel #2
0
        $userkey = $_REQUEST['graphkey'];
    } else {
        $userkey = "";
    }
    if ($key != "" && $key != $userkey) {
        ierror("Graph Key Failure");
        exit;
    }
}
if (!isset($_REQUEST['nodeid'])) {
    $nodeid = "";
} else {
    $nodeid = $_REQUEST['nodeid'];
}
if (!isset($_REQUEST['testid'])) {
    ierror("No test ID");
}
$day = date("d");
$month = date("m");
$year = date("Y");
if (isset($_REQUEST['startx'])) {
    $startx = $_REQUEST['startx'];
} else {
    // 0:00 today    HMS mo da yr
    $startx = mktime(0, 0, 0, $month, $day, $year);
    //$startx=1203451396;
}
if (isset($_REQUEST['finishx'])) {
    $finishx = $_REQUEST['finishx'];
} else {
    $finishx = mktime(23, 59, 59, $month, $day, $year);
Beispiel #3
0
	$key=$NATS->Cfg->Get("site.graph.key","");
	if (isset($_REQUEST['graphkey'])) $userkey=$_REQUEST['graphkey'];
	else $userkey="";
	
	if ( ($key!="") && ($key!=$userkey) )
		{
		ierror("Graph Key Failure");
		exit();
		}
	}


if (!isset($_REQUEST['nodeid'])) $nodeid="";
else $nodeid=$_REQUEST['nodeid'];

if (!isset($_REQUEST['testid'])) ierror("No test ID");

$day=date("d");
$month=date("m");
$year=date("Y");

if (isset($_REQUEST['startx'])) $startx=$_REQUEST['startx'];
else
	{ // 0:00 today    HMS mo da yr
	$startx=mktime(0,0,0,$month,$day,$year);
	//$startx=1203451396;
	}
	
if (isset($_REQUEST['finishx'])) $finishx=$_REQUEST['finishx'];
else $finishx=mktime(23,59,59,$month,$day,$year);