Example #1
0
<?php

$root = '.';
include_once "{$root}/config.php";
include_once "{$root}/common.php";
if (!isset($_GET['pid'])) {
    die('Missing parameter');
}
$pid = (int) $_GET['pid'];
if (!Session::$logged) {
    header("Location: {$config['root']}signin/?next={$config['root']}dd/projects/{$pid}/delete/");
}
$title = __('ProjectsDeleteTitle');
$project = Db::fetchRow("SELECT name, description, uid\n     FROM projects\n     WHERE pid = '{$pid}'");
if ($project) {
    $name = $project['name'];
    $description = $project['description'];
    if ($project['uid'] == Session::_('uid')) {
        $access = true;
    }
}
if (!empty($_POST)) {
    if ($pid) {
        Db::query("DELETE FROM projects\n             WHERE pid = '{$pid}'");
    }
    header("Location: {$config['root']}dd/projects/");
}
require_once "{$root}/themes/{$theme}/ddprojectsdelete.php";
Example #2
0
<?php

$root = '.';
include_once "{$root}/config.php";
include_once "{$root}/common.php";
if (!Session::$logged) {
    header("Location: {$config['root']}signin/?next={$config['root']}dd/");
}
$projects = Db::fetchAssoc("SELECT pid, name, 1 AS own\n     FROM projects\n     WHERE uid = '" . Session::_('uid') . "'\n\n     UNION\n\n     SELECT p.pid, p.name, 0 AS own\n     FROM projects p\n     INNER JOIN projects_access a\n     ON a.pid = p.pid AND a.uid = '" . Session::_('uid') . "'\n\n     ORDER BY name\n     LIMIT 10");
if (isset($_GET['noticed'])) {
    Db::query("UPDATE projects_access\n         SET notice = 0\n         WHERE uid = '" . Session::_('uid') . "'");
} else {
    $notices = Db::fetchAssoc("SELECT a.aid, p.pid, p.name, a.message\n         FROM projects_access a\n         INNER JOIN projects p ON p.pid = a.pid\n         WHERE a.uid = '" . Session::_('uid') . "'\n           AND a.notice = 1");
}
require_once "{$root}/themes/{$theme}/dd.php";
Example #3
0
<?php

$root = '.';
include_once "{$root}/config.php";
include_once "{$root}/common.php";
if (Session::$logged) {
    $email = Session::_('email');
}
Session::destroy();
if ($email) {
    header("Location: {$config['root']}signin/?email={$email}");
} else {
    header("Location: {$config['root']}signin/");
}
Example #4
0
<?php

$root = '.';
include_once "{$root}/config.php";
include_once "{$root}/common.php";
if (!Session::$logged) {
    header("Location: {$config['root']}signin/?next={$config['root']}dd/projects/add/");
}
$title = __('ProjectsAddTitle');
if (!empty($_POST)) {
    $name = $_POST['name'];
    $description = $_POST['description'];
    if (strlen($name) < 3) {
        $error['name'] = true;
    }
    if (!empty($description) && strlen($description) > 140) {
        $error['description'] = true;
    }
    if (empty($error)) {
        Db::insert('projects', array('uid' => Session::_('uid'), 'name' => $name, 'description' => $description, 'public' => 0));
        header("Location: {$config['root']}dd/projects/");
    }
}
require_once "{$root}/themes/{$theme}/ddprojectsadd.php";
Example #5
0
<?php

$root = '.';
include_once "{$root}/config.php";
include_once "{$root}/common.php";
if (!Session::$logged) {
    header("Location: {$config['root']}signin/?next={$config['root']}dd/projects/");
}
$title = __('ProjectsTitle');
$count = Db::fetchOne("SELECT COUNT(*) FROM projects WHERE uid = '" . Session::_('uid') . "'");
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$start = ($page - 1) * $config['perpage'];
$projects = Db::fetchAssoc("SELECT pid, name, description\n     FROM projects\n     WHERE uid = '" . Session::_('uid') . "'\n     ORDER BY name\n     LIMIT {$start},{$config['perpage']}");
$pagination = pagination("{$config['root']}dd/projects/", $count, $config['perpage'], $page);
require_once "{$root}/themes/{$theme}/ddprojects.php";
Example #6
0
<?php

$root = '.';
include_once "{$root}/config.php";
include_once "{$root}/common.php";
if (!isset($_GET['pid'])) {
    die('Missing parameter');
}
$pid = (int) $_GET['pid'];
if (!Session::$logged) {
    header("Location: {$config['root']}signin/?next={$config['root']}dd/projects/{$pid}/");
}
$project = Db::fetchRow("SELECT pid, uid, name, description, public\n     FROM projects\n     WHERE pid = '{$pid}'");
$title = empty($project) ? __('ProjectNotFound') : $project['name'];
if (!empty($project)) {
    $access = false;
    if ($project['public']) {
        $access = true;
    } elseif ($project['uid'] == Session::_('uid')) {
        $access = true;
    } else {
        $usersAccess = Db::fetchPairs("SELECT uid, aid\n             FROM projects_access\n             WHERE pid = '{$pid}'\n               AND uid != 0");
        if (!empty($usersAccess)) {
            $access = isset($usersAccess[Session::_('uid')]) ? true : false;
        }
    }
    $names = Db::fetchAssoc("SELECT n.nid, n.name, n.description, u.uid, u.email\n         FROM projects_names n\n         INNER JOIN users u ON u.uid = n.uid\n         WHERE n.pid = '{$pid}'");
}
require_once "{$root}/themes/{$theme}/ddprojectsview.php";