Unsupported scripts and control panel web app for a hosting company
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

addissue.php 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?PHP
  2. require_once('lib/dashboard.php');
  3. require_once('lib/common.php');
  4. if (isset($_POST['submit'])) {
  5. $_POST['title'] = trim($_POST['title']);
  6. $_POST['text'] = trim($_POST['text']);
  7. if (empty($_POST['title']) || empty($_POST['text'])) {
  8. header('Location: '.CP_PATH);
  9. return;
  10. }
  11. if ($_POST['deadline'] == 'none') {
  12. $_POST['deadline'] = 0;
  13. }
  14. if ($_POST['assignee'] != '') {
  15. $_POST['status'] = 'assigned';
  16. } else {
  17. $sql = 'SELECT icat_assign FROM issues_categories WHERE icat_id = '.m($_POST['category']).'';
  18. $catRes = mysql_query($sql);
  19. $catData = mysql_fetch_assoc($catRes);
  20. if ($catData['icat_assign'] != 0) {
  21. $_POST['status'] = 'assigned';
  22. $_POST['assignee'] = $catData['icat_assign'];
  23. } else {
  24. $_POST['status'] = 'open';
  25. }
  26. }
  27. $sql = 'INSERT INTO issues_issues
  28. (i_id, icat_id, i_submitter, i_assignee, i_priority, i_added, i_updated, i_deadline, i_title, i_status, i_text, i_extensiveness)
  29. VALUES(\'0\', \''.m($_POST['category']).'\', \''.m(getUserID($_SERVER['REDIRECT_REMOTE_USER'])).'\',
  30. \''.m($_POST['assignee']).'\', \''.m($_POST['priority']).'\', \''.time().'\', \''.time().'\',
  31. '.(($_POST['deadline'] == 0) ? '0' : strtotime($_POST['deadline'])).', \''.m($_POST['title']).'\',
  32. \''.m($_POST['status']).'\', \''.m($_POST['text']).'\', \''.m($_POST['extensiveness']).'\')';
  33. $res = mysql_query($sql) or die(mysql_error().'<br />'.$sql);
  34. logger::log('Issue tracker: issue added: '.getCategoryName($_POST['category']).': '.$_POST['title'], getUserID($_SERVER['REDIRECT_REMOTE_USER']), logger::information);
  35. header('Location: http://'.$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF'])).'/viewissue/'.mysql_insert_id());
  36. return;
  37. }
  38. $categories = getCategories();
  39. $admins = getAdmins();
  40. define('TITLE', 'Issue tracker :: Add Issue');
  41. addDashboardItem('Actions', 'Raise new issue', 'addissue');
  42. include_once('res/commonDashboard.php');
  43. require_once('lib/header.php');
  44. require_once('pages/addissue.php');
  45. require_once('lib/footer.php');
  46. ?>