Пример #1
0
//print $_SERVER['REQUEST_URI'];
//print_r($_REQUEST);
//exit;
if (!isset($_SESSION)) {
    session_start();
}
if (!isset($_REQUEST['hash'])) {
    echo 'No hash';
    exit;
}
if (strlen(trim($_REQUEST['hash'])) != 6) {
    print "Wrong hash";
    exit;
}
$delegate = new Delegate();
$diagram = $delegate->diagramGetByHash(trim($_REQUEST['hash']));
if (!is_object($diagram)) {
    print "No diagram";
    exit;
}
$diagram = $delegate->diagramGetById($diagram->id);
//GUARDIAN: see if we can display this diagram
$display = false;
if ($diagram->public) {
    $display = true;
} else {
    $loggedUser = $delegate->userGetById($_SESSION['userId']);
    //do we have a logged user
    if (is_object($loggedUser)) {
        $userdiagram = $delegate->userdiagramGetByIds($loggedUser->id, $diagram->id);
        //is he allocated to this diagram?