Subversion Repositories taios

Rev

Rev 215 | Rev 492 | 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 = "' . $title . '" WHERE ID = ' . $project->ID);
    }
    if (!empty($description))
    {
        $page->query('UPDATE Projects SET Description = "' . $description . '" WHERE ID = ' . $project->ID);
    }
    if (!empty($logoURL))
    {
        $page->query('UPDATE Projects SET LogoURL = "' . $logoURL . '" WHERE ID = ' . $project->ID);
    }
    if (!empty($websiteURL))
    {
        $page->query('UPDATE Projects SET WebsiteURL = "' . $websiteURL . '" WHERE ID = ' . $project->ID);
    }
    if (!empty($downloadURL))
    {
        $page->query('UPDATE Projects SET DownloadURL = "' . $downloadURL . '" WHERE ID = ' . $project->ID);
    }
    if (!empty($latestVersion))
    {
        $page->query('UPDATE Projects SET LatestVersion = "' . $latestVersion . '" WHERE ID = ' . $project->ID);
    }
   
    $page->query('UPDATE Projects SET LastUpdate = NOW() WHERE ID = ' . $project->ID);

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

?>