2017-10-22 17:57:55 +02:00
|
|
|
<?php
|
|
|
|
date_default_timezone_set('Europe/Oslo');
|
2018-02-10 18:08:53 +01:00
|
|
|
setlocale(LC_ALL, 'nb_NO');
|
2017-11-11 15:20:58 +01:00
|
|
|
require __DIR__ . '/../../inc/navbar.php';
|
2017-10-22 17:57:55 +02:00
|
|
|
require __DIR__ . '/../../src/_autoload.php';
|
2024-02-15 22:57:03 +01:00
|
|
|
require __DIR__ . '/../../config.php';
|
2017-10-22 17:57:55 +02:00
|
|
|
|
2017-11-11 15:20:58 +01:00
|
|
|
require_once __DIR__ . '/../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
|
2024-04-08 22:11:43 +02:00
|
|
|
$as = new \SimpleSAML\Auth\Simple('default-sp');
|
2017-10-22 17:57:55 +02:00
|
|
|
$as->requireAuth();
|
|
|
|
$attrs = $as->getAttributes();
|
|
|
|
|
2024-03-12 19:33:09 +01:00
|
|
|
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
|
2017-10-22 17:57:55 +02:00
|
|
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
|
|
$projectManager = new \pvv\side\ProjectManager($pdo);
|
|
|
|
|
2017-10-28 20:09:54 +02:00
|
|
|
$new = 0;
|
|
|
|
if(isset($_GET['new'])){
|
|
|
|
$new = $_GET['new'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$projectID = 0;
|
|
|
|
if(isset($_GET['id'])){
|
|
|
|
$projectID = $_GET['id'];
|
|
|
|
}else if($new == 0){
|
|
|
|
echo "\nID not set";
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2017-10-22 17:57:55 +02:00
|
|
|
$project = new \pvv\side\Project(
|
|
|
|
0,
|
|
|
|
'Nytt Prosjekt',
|
|
|
|
'',
|
|
|
|
$attrs["cn"][0],
|
|
|
|
$attrs["uid"][0],
|
2018-02-26 16:24:50 +01:00
|
|
|
$attrs["mail"][0],
|
2017-10-22 17:57:55 +02:00
|
|
|
1
|
|
|
|
);
|
2017-10-28 20:09:54 +02:00
|
|
|
if($new == 0){
|
|
|
|
$project = $projectManager->getByID($projectID);
|
2018-02-26 16:24:50 +01:00
|
|
|
$owner = $projectManager->getProjectOwner($projectID);
|
2017-10-28 20:09:54 +02:00
|
|
|
|
2018-02-26 16:24:50 +01:00
|
|
|
if($owner['uname'] != $attrs["uid"][0]){
|
2017-10-28 20:09:54 +02:00
|
|
|
header('HTTP/1.0 403 Forbidden');
|
|
|
|
echo "wrong user";
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
}
|
2017-10-22 17:57:55 +02:00
|
|
|
?>
|
2018-08-09 00:48:53 +02:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="no">
|
2018-08-14 02:09:32 +02:00
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
|
|
|
<link rel="shortcut icon" href="favicon.ico">
|
|
|
|
<link rel="stylesheet" href="../css/normalize.css">
|
|
|
|
<link rel="stylesheet" href="../css/style.css">
|
|
|
|
<link rel="stylesheet" href="../css/nav.css">
|
2018-08-14 03:25:24 +02:00
|
|
|
<link rel="stylesheet" href="../css/projects.css">
|
2018-08-14 03:29:10 +02:00
|
|
|
<meta name="theme-color" content="#024" />
|
2018-08-14 02:09:32 +02:00
|
|
|
<title>Prosjektverkstedet</title>
|
|
|
|
|
|
|
|
<header>Prosjekt­verk­stedet</header>
|
|
|
|
|
2018-02-10 16:39:30 +01:00
|
|
|
|
|
|
|
<body>
|
|
|
|
<nav>
|
|
|
|
<?php echo navbar(1, 'prosjekt'); ?>
|
2018-02-24 17:02:00 +01:00
|
|
|
<?php echo loginbar(null, $pdo); ?>
|
2018-02-10 16:39:30 +01:00
|
|
|
</nav>
|
|
|
|
|
|
|
|
<main>
|
|
|
|
<h2>Nytt prosjekt</h2>
|
|
|
|
|
|
|
|
<form action="update.php", method="post">
|
|
|
|
<p class="subtitle no-chin">Prosjektnavn</p>
|
|
|
|
<p class="subnote">Gi prosjektet ditt et passende navn</p>
|
2018-08-14 03:25:24 +02:00
|
|
|
<input class="wide" type="text" name="title" value="<?= $project->getName() ?>" class="boxinput"><br>
|
2018-02-10 16:39:30 +01:00
|
|
|
|
2018-08-12 03:52:55 +02:00
|
|
|
<p class="subtitle no-chin">Beskrivelse (<i style="opacity:0.5;">markdown</i>)</p>
|
2018-02-14 17:56:19 +01:00
|
|
|
<p class="subnote no-chin">Hva går prosjektet ditt ut på?</p>
|
2018-08-09 00:48:53 +02:00
|
|
|
<p class="subnote">De første to linjene blir vist på prosjektkortet, prøv å gjøre de til et fint sammendrag eller intro!</p>
|
2024-08-04 00:01:34 +02:00
|
|
|
<textarea class="tall" name="desc" style="width:100%" rows="8" class="boxinput"><?= implode("\n", $project->getDescription()); ?></textarea>
|
2018-02-10 16:39:30 +01:00
|
|
|
|
|
|
|
<?= '<input type="hidden" name="id" value="' . $project->getID() . '" />' ?>
|
2018-02-24 21:09:15 +01:00
|
|
|
<input type="hidden" name="active" value="1"/>
|
2018-02-10 16:39:30 +01:00
|
|
|
|
2018-08-14 03:25:24 +02:00
|
|
|
<div style="margin-top: 0.2em;">
|
2018-02-10 16:39:30 +01:00
|
|
|
<hr class="ruler">
|
2018-08-09 00:48:53 +02:00
|
|
|
<input type="submit" class="btn" value="<?= ($new ? 'Opprett prosjekt' : 'Lagre endringer') ?>"></input>
|
|
|
|
<?php if (!$new){?><input type="submit" class="btn" name="delete" value="Slett"></input><?php } ?>
|
2018-02-10 16:39:30 +01:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</main>
|
2018-08-09 00:48:53 +02:00
|
|
|
</body>
|