33 lines
807 B
PHP
33 lines
807 B
PHP
<?php
|
|
session_start();
|
|
require_once __DIR__ . '/cls/class.pef.php';
|
|
|
|
if (!isset($_SESSION['user']) || $_SESSION['user']['role'] === 'viewer') {
|
|
die('Unauthorized');
|
|
}
|
|
|
|
$pef = new Pef();
|
|
$action = $_GET['action'] ?? '';
|
|
|
|
if ($action === 'create') {
|
|
$pef->createProject(
|
|
$_POST['name'],
|
|
$_POST['description'],
|
|
$_POST['industry'],
|
|
$_POST['version'] ?: '1.0.0'
|
|
);
|
|
} elseif ($action === 'update') {
|
|
$pef->updateProject((int)$_POST['id'], [
|
|
'name' => $_POST['name'],
|
|
'description' => $_POST['description'],
|
|
'industry' => $_POST['industry'],
|
|
'status' => $_POST['status']
|
|
]);
|
|
} elseif ($action === 'delete') {
|
|
$id = (int)($_POST['id'] ?? $_GET['id'] ?? 0);
|
|
$pef->deleteProject($id);
|
|
}
|
|
|
|
header('Location: index.php');
|
|
exit;
|