Subversion Repositories taios

Rev

Rev 515 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php

require '../_taios.php';

$page = new Taios_Page('Add Project', '../');

$page->checkCSRFToken($page->getLoggedInUser()->ID, $_POST['csrftoken']);

$title = $_POST['title'];
$description = $_POST['description'];
$logoURL = $_POST['logourl'];
$websiteURL = $_POST['websiteurl'];
$downloadURL = $_POST['downloadurl'];
$latestVersion = $_POST['latestversion'];

$page->checkLoggedIn();
$user = $page->getLoggedInUser();

if (empty($title)) {
    $page->redirect('add-project.php?error=No Title Specified');
}

if (empty($description)) {
    $page->redirect('add-project.php?error=No Title Specified');
}

if ($page->isUserGM($user)) {
        $args = array($user->ID, $title, $description, $logoURL, $downloadURL, $websiteURL, $latestVersion);
    $page->query("INSERT INTO Projects VALUES (0, ?, ?, ?, ?, ?, ?, ?, NOW())", $args);
    $page->redirect('index.php');
} else {
    $page->drawError('You do not have permission to access this page.');
}

?>