Subversion Repositories taios

Rev

Rev 484 | Rev 515 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php

require '../_taios.php';

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

$project = $page->getProject($page->getPostID());
if (!$project)
{
    $page->drawError('No such project, #' . $page->getPostID());
}

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

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

if ($page->isUserAdmin($page->getLoggedInUser()) || $page->getLoggedInUser()->ID == $project->author->ID)
{
    if (!empty($title)) {
        $page->query("UPDATE Projects SET Title = ? WHERE ID = ?", array($title, $project->ID));
    }
   
    if (!empty($description)) {
        $page->query("UPDATE Projects SET Description = ? WHERE ID = ?", array($description, $project->ID));
    }
   
    if (!empty($logoURL)) {
        $page->query("UPDATE Projects SET LogoURL = ? WHERE ID = ?", array($logoURL, $project->ID));
    }
   
    if (!empty($websiteURL)) {
        $page->query("UPDATE Projects SET WebsiteURL = ? WHERE ID = ?", array($websiteURL, $project->ID));
    }
   
    if (!empty($downloadURL)) {
        $page->query("UPDATE Projects SET DownloadURL = ? WHERE ID = ?", array($downloadURL, $project->ID));
    }
   
    if (!empty($latestVersion)) {
        $page->query("UPDATE Projects SET LatestVersion = ? WHERE ID = ?", array($latestVersion,  $project->ID));
    }
   
    $page->query("UPDATE Projects SET LastUpdate = NOW() WHERE ID = ?", array($project->ID));

    $page->redirect('index.php');
} else {
    $page->drawError('You do not have permission to access this page.');
}

?>