isAdmin()) die("Illegal access."); switch($action) { case "setDefault": { $projects->setDefault($_GET['setDefault']); $msg = "Changed default project."; break; } case "delete": { $projects->delete($_GET['delete']); $msg = "Project deleted."; break; } case "add": { $result = $projects->add($_POST['title'], $_POST['text'], (empty($_POST['public']) ? false : true), (empty($_POST['default']) ? false : true)); if($result === true) $msg = "Project has been created."; else $msg = $result; break; } } unset($_SESSION['selectCache']); header("location: projects.php?msg=".urlencode($msg)); exit; } echo $xhtml->head("Projects","projects"); if(!empty($_GET['msg'])) echo '

'.xHTML::Protect(urldecode($_GET['msg'])).'

'; $list = $projects->getList(true); if(empty($list) || @count($list) < 1) { echo '

There is no project by now.

'; } else { echo '
'; foreach($list as $p) { if(!$p['public'] && !$users->isAdmin()) continue; $class = ''; if($p['def']) $class = ' class="default"'; if(!$p['public']) $class = ' class="hidden'.($p['def'] ? ' default' : '').'"'; echo ''.xHTML::Protect($p['title']).''; if(!empty($p['text'])) echo '
'.stripslashes($p['text']).'
'; if($users->isAdmin()) { echo '
Edit Delete'; if(!$p['def']) echo ' Make default'; echo '
'; } } echo '
'; } if($users->isAdmin()) { echo '

New project

'; } echo $xhtml->foot(); ?>