session_start(); include "conf/site.php"; include "libs/php/globals.php"; requireLogin(); if (isset($_POST['project']) && isset($_POST['title']) && isset($_POST['descr'])) { include "model/user.php"; include "model/project.php"; include "model/bug.php"; $b = new bug(); $u = new user(); $p = new project(); // let's first verify the project. $pname = htmlentities($_POST['project'], ENT_QUOTES); $title = htmlentities($_POST['title'], ENT_QUOTES); $descr = htmlentities($_POST['descr'], ENT_QUOTES); $p->getByCol("project_name", $pname); $project = $p->getNext(); if ($project != NULL && $project['pID'] > 0) { $fields = array("package" => $project['pID'], "reporter" => $_SESSION['id'], "title" => $title, "descr" => $descr); $id = $b->createNew($fields); $_SESSION['msg'] = "New bug created!"; header("Location: {$SITE_PREFIX}" . "t/bug/{$id}"); exit(0); } else { $_SESSION['err'] = "Please enter a real project!"; header("Location: {$SITE_PREFIX}" . "t/new-bug"); exit(0); } } else { $_SESSION['err'] = "Please fill in all the forms!"; header("Location: {$SITE_PREFIX}" . "t/new-bug");
<?php $p = new project(); $b = new bug(); $p->getByCol("project_name", $argv[1]); // this is goddamn awesome $row = $p->getNext(); $b->getByCol("package", $row['pID']); // this is goddamn awesome $booboos = $b->numrows(); $critical = 0; // doh // $b->specialSelect( "bug_status != 1" ); if (isset($row['pID'])) { $TITLE = $row['project_name'] . ", one of the fantastic projects on Whube"; $CONTENT = "\n<h1>" . $row['project_name'] . "</h1>\n" . $row['descr'] . "<br />\n<br />\nThere are " . $booboos . " bugs in the tracker on this package. " . $critical . " are critical.\n"; } else { $_SESSION['err'] = "Project " . $argv[1] . " does not exist!"; header("Location: {$SITE_PREFIX}" . "t/home"); exit(0); }
$fields = array("reporter" => $submitter['uID'], "owner" => $submitter['uID'], "title" => $meta['title'], "descr" => $meta['body']); $id = $b->createNew($fields); $d['errors'] = false; $d['message'] = "New bug with ID '" + $id + ";"; if (isset($meta['assign'])) { $o->getByCol("username", $meta['assign']); $row = $o->getNext(); if (isset($row['uID'])) { $b->updateByPK($id, array("owner" => $row['uID'])); $d['message'] .= "\nAssigning this bug to " . $row['real_name']; } else { $d['message'] .= "\nCould not find user '" . $meta['assign'] . "' in this DB."; } } if (isset($meta['project'])) { $p->getByCol("project_name", $meta['project']); $row = $p->getNext(); if (isset($row['pID'])) { $b->updateByPK($id, array("package" => $row['pID'])); $d['message'] .= "\nAssigning this bug to project " . $row['project_name']; } else { $d['message'] .= "\nCould not find project '" . $meta['project'] . "' in this DB."; } } if (isset($meta['private'])) { $p->getByCol("private", $meta['private']); if ($meta['private']) { $b->updateByPK($id, array("private" => true)); $d['message'] .= "\nMarking this bug private"; } else { $b->updateByPK($id, array("private" => false));