Example #1
0
 public static function create($name)
 {
     $path = self::sanitizePath($name);
     // Create the project directory, the subdirectory for big images
     // and a dummy index.php to prevent dir listing
     mkdir($path);
     setFileMode($path);
     mkdir($path . CONFIG::IMAGE_BIG_PATH);
     setFileMode($path . CONFIG::IMAGE_BIG_PATH);
     file_put_contents($path . 'index.php', self::$dirProtectIndex);
     setFileMode($path . 'index.php');
     return Project::open($name);
 }
Example #2
0
 public function unshareProject()
 {
     $project = Project::open($_POST['project']);
     $project->removeSharekey();
 }
Example #3
0
// Not authed for this nemex? Maybe we have a sharekey for the project?
// If not, just show the login form
if (!$session->isAuthed()) {
    if (count($_GET) == 2) {
        $get = array_keys($_GET);
        $projectName = $get[0];
        $sharekey = $get[1];
        $project = Project::openWithSharekey($projectName, $sharekey);
        if ($project) {
            $nodes = $project->getNodes();
            include NX_PATH . 'media/templates/project-readonly.html.php';
            exit;
        }
    }
    include NX_PATH . 'media/templates/login.html.php';
} else {
    if (!empty($_GET)) {
        $projectName = key($_GET);
        $project = Project::open($projectName);
        if ($project) {
            $nodes = $project->getNodes();
            include NX_PATH . 'media/templates/project.html.php';
        } else {
            header("HTTP/1.1 404 Not Found");
            echo 'No Such Project: ' . htmlspecialchars($projectName);
        }
    } else {
        $projects = Project::getProjectList();
        include NX_PATH . 'media/templates/project-list.html.php';
    }
}