Rev 492 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
215 | tom | 1 | <?php |
2 | |||
3 | require '../_taios.php'; |
||
4 | |||
515 | freddie | 5 | $page->checkCSRFToken($page->getLoggedInUser()->ID, $_POST['csrftoken']); |
6 | |||
215 | tom | 7 | $page = new Taios_Page('Edit Project', '../'); |
8 | |||
216 | tom | 9 | $project = $page->getProject($page->getPostID()); |
215 | tom | 10 | if (!$project) |
11 | { |
||
216 | tom | 12 | $page->drawError('No such project, #' . $page->getPostID()); |
215 | tom | 13 | } |
14 | |||
15 | $title = $_POST['title']; |
||
16 | $description = $_POST['description']; |
||
17 | $logoURL = $_POST['logourl']; |
||
18 | $websiteURL = $_POST['websiteurl']; |
||
19 | $downloadURL = $_POST['downloadurl']; |
||
20 | $latestVersion = $_POST['latestversion']; |
||
21 | |||
22 | $page->checkLoggedIn(); |
||
23 | $user = $page->getLoggedInUser(); |
||
24 | |||
25 | if ($page->isUserAdmin($page->getLoggedInUser()) || $page->getLoggedInUser()->ID == $project->author->ID) |
||
26 | { |
||
492 | tom | 27 | if (!empty($title)) { |
28 | $page->query("UPDATE Projects SET Title = ? WHERE ID = ?", array($title, $project->ID)); |
||
215 | tom | 29 | } |
492 | tom | 30 | |
31 | if (!empty($description)) { |
||
32 | $page->query("UPDATE Projects SET Description = ? WHERE ID = ?", array($description, $project->ID)); |
||
215 | tom | 33 | } |
492 | tom | 34 | |
35 | if (!empty($logoURL)) { |
||
36 | $page->query("UPDATE Projects SET LogoURL = ? WHERE ID = ?", array($logoURL, $project->ID)); |
||
215 | tom | 37 | } |
492 | tom | 38 | |
39 | if (!empty($websiteURL)) { |
||
40 | $page->query("UPDATE Projects SET WebsiteURL = ? WHERE ID = ?", array($websiteURL, $project->ID)); |
||
215 | tom | 41 | } |
492 | tom | 42 | |
43 | if (!empty($downloadURL)) { |
||
44 | $page->query("UPDATE Projects SET DownloadURL = ? WHERE ID = ?", array($downloadURL, $project->ID)); |
||
215 | tom | 45 | } |
492 | tom | 46 | |
47 | if (!empty($latestVersion)) { |
||
48 | $page->query("UPDATE Projects SET LatestVersion = ? WHERE ID = ?", array($latestVersion, $project->ID)); |
||
215 | tom | 49 | } |
50 | |||
492 | tom | 51 | $page->query("UPDATE Projects SET LastUpdate = NOW() WHERE ID = ?", array($project->ID)); |
215 | tom | 52 | |
53 | $page->redirect('index.php'); |
||
492 | tom | 54 | } else { |
215 | tom | 55 | $page->drawError('You do not have permission to access this page.'); |
56 | } |
||
57 | |||
58 | ?> |