Example #1
0
$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?
        if (is_object($userdiagram)) {
            $display = true;
        }
    }
}
//END GUARDIAN: check display
$type = $_REQUEST['type'];
$nowIsNow = now();
//store time
switch ($type) {
    case 'png':
        //load PNG data
        $pngData = $delegate->diagramdataGetByDiagramIdAndType($diagram->id, Diagramdata::TYPE_PNG);
        #print_r($pngData);
Example #2
0
/* This page is used for both logged users and outsiders to */
require_once dirname(__FILE__) . '/common/delegate.php';
if (!isset($_SESSION)) {
    session_start();
}
if (!isset($_SESSION['userId'])) {
    echo "Sic";
    exit;
}
if (!isset($_REQUEST['diagramId'])) {
    echo "No diagram selected";
    exit;
}
$d = new Delegate();
$userdiagram = $d->userdiagramGetByIds($_SESSION['userId'], $_REQUEST['diagramId']);
if (!is_object($userdiagram) || !is_numeric($userdiagram->userId)) {
    echo "No rights to edit that diagram";
    exit;
}
$diagram = $d->diagramGetById($_REQUEST['diagramId']);
?>

<!DOCTYPE html>
<html>
    <head>
        <title>Diagramo - Edit diagram</title>
        <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
        <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
        <link href="./assets/css/style.css" type="text/css" rel="stylesheet"/>
        <link href="./assets/css/style_1.css" type="text/css" rel="stylesheet"/>
Example #3
0
if (!isset($_SESSION)) {
    session_start();
}
require_once dirname(__FILE__) . '/common/rememberme.php';
if (!isset($_SESSION['userId']) || !is_numeric($_SESSION['userId'])) {
    addError("Access denied");
    redirect('./index.php');
}
if (!is_numeric($_REQUEST['diagramId'])) {
    print 'Wrong Diagram Id';
    exit;
}
$delegate = new Delegate();
$loggedUser = $delegate->userGetById($_SESSION['userId']);
$diagram = $delegate->diagramGetById($_REQUEST['diagramId']);
$userdiagram = $delegate->userdiagramGetByIds($loggedUser->id, $diagram->id);
$collaborators = $delegate->usersGetAsCollaboratorNative($diagram->id);
$invitations = $delegate->invitationGetAllForDiagram($diagram->id);
/*All the collaborators this author knows in the system
 * as a dictionary (email, user_object)
 */
$buddies = $delegate->usersGetBuddies($loggedUser->id);
?>

<!DOCTYPE html>
<html>
    <!--Copyright 2010 Scriptoid s.r.l-->
    <head>
        <title>Colaborators - Diagramo</title>
        <link rel="stylesheet" media="screen" type="text/css" href="assets/css/style.css" />
        <script type="text/javascript">
Example #4
0
/**
 * The collaborator remove itself from diagram
 */
function removeMeFromDiagram()
{
    if (!is_numeric($_SESSION['userId'])) {
        print "Wrong way";
        exit;
    }
    if (!is_numeric($_REQUEST['diagramId'])) {
        print "No diagram";
        exit;
    }
    $delegate = new Delegate();
    $loggedUser = $delegate->userGetById($_SESSION['userId']);
    $userdiagram = $delegate->userdiagramGetByIds($loggedUser->id, $_REQUEST['diagramId']);
    if ($userdiagram) {
        /**author can not remove itself. he has to delete the diagram*/
        if ($userdiagram->level == Userdiagram::LEVEL_AUTHOR) {
            addError("Author can not remove itself from a diagram");
            redirect('../myDiagrams.php');
            exit;
        }
        if ($delegate->userdiagramDelete($loggedUser->id, $_REQUEST['diagramId'])) {
            addMessage("Removed from diagram");
            //TODO:  notify author ?
        } else {
            addError("You were not removed from diagram");
        }
        redirect('../myDiagrams.php');
    } else {
        print 'No rights';
        exit;
    }
}
Example #5
0
<?php

require_once dirname(__FILE__) . '/common/delegate.php';
if (!isset($_SESSION)) {
    session_start();
}
require_once dirname(__FILE__) . '/common/rememberme.php';
$delegate = new Delegate();
$loggedUser = $delegate->userGetById($_SESSION['userId']);
//start diagram guardian
if (is_numeric($_REQUEST['diagramId'])) {
    if (is_object($loggedUser)) {
        $userdiagram = $delegate->userdiagramGetByIds($loggedUser->id, $_REQUEST['diagramId']);
        if (!is_object($userdiagram)) {
            print "Not allocated to this diagram";
            exit;
        }
    } else {
        print "Not allowed to see this diagram";
        exit;
    }
}
//end diagram guardian
?>


<!DOCTYPE html>
<html>
    <!--Copyright 2010 Scriptoid s.r.l-->
    <head>
        <title>HTML5 diagram editor</title>