Browse Source

Add admin pages

master
Chris Smith 13 years ago
parent
commit
71218e983d
77 changed files with 3547 additions and 0 deletions
  1. 7
    0
      admin-www/.htaccess
  2. 22
    0
      admin-www/discount.php
  3. 1
    0
      admin-www/info.php
  4. 1
    0
      admin-www/info.php6
  5. 10
    0
      admin-www/info.pl
  6. 28
    0
      admin-www/info.py
  7. 9
    0
      admin-www/issues/.htaccess
  8. 35
    0
      admin-www/issues/addcategory.php
  9. 58
    0
      admin-www/issues/addissue.php
  10. 50
    0
      admin-www/issues/addreply.php
  11. 21
    0
      admin-www/issues/categories.php
  12. 54
    0
      admin-www/issues/deletecategory.php
  13. 53
    0
      admin-www/issues/deleteissue.php
  14. 47
    0
      admin-www/issues/editcategory.php
  15. 118
    0
      admin-www/issues/editissue.php
  16. 37
    0
      admin-www/issues/index.php
  17. 25
    0
      admin-www/issues/lib/account.php
  18. 201
    0
      admin-www/issues/lib/common.php
  19. 42
    0
      admin-www/issues/lib/dashboard.php
  20. 10
    0
      admin-www/issues/lib/database.php
  21. 2
    0
      admin-www/issues/lib/footer.php
  22. 37
    0
      admin-www/issues/lib/header.php
  23. 59
    0
      admin-www/issues/lib/log.php
  24. 19
    0
      admin-www/issues/notfound.php
  25. 4
    0
      admin-www/issues/pages/404.php
  26. 11
    0
      admin-www/issues/pages/addcategory.php
  27. 51
    0
      admin-www/issues/pages/addissue.php
  28. 13
    0
      admin-www/issues/pages/addreply.php
  29. 113
    0
      admin-www/issues/pages/addsearch.php
  30. 40
    0
      admin-www/issues/pages/deletecategory.php
  31. 12
    0
      admin-www/issues/pages/deleteissue.php
  32. 0
    0
      admin-www/issues/pages/deletesearch.php
  33. 21
    0
      admin-www/issues/pages/editcategory.php
  34. 61
    0
      admin-www/issues/pages/editissue.php
  35. 113
    0
      admin-www/issues/pages/editsearch.php
  36. 35
    0
      admin-www/issues/pages/listsearch.php
  37. 114
    0
      admin-www/issues/pages/searchform.php
  38. 173
    0
      admin-www/issues/pages/searchresults.php
  39. 157
    0
      admin-www/issues/pages/searchresults.php~
  40. 160
    0
      admin-www/issues/pages/stats.php
  41. 31
    0
      admin-www/issues/pages/viewcategories.php
  42. 63
    0
      admin-www/issues/pages/viewissue.php
  43. 34
    0
      admin-www/issues/pages/viewlog.php
  44. 12
    0
      admin-www/issues/res/commonDashboard.php
  45. BIN
      admin-www/issues/res/high.png
  46. BIN
      admin-www/issues/res/logo.png
  47. BIN
      admin-www/issues/res/low.png
  48. BIN
      admin-www/issues/res/normal.png
  49. 97
    0
      admin-www/issues/res/script.js
  50. 254
    0
      admin-www/issues/res/style.css
  51. 83
    0
      admin-www/issues/search.php
  52. 117
    0
      admin-www/issues/searches.php
  53. 18
    0
      admin-www/issues/stats.php
  54. 54
    0
      admin-www/issues/viewissue.php
  55. 48
    0
      admin-www/issues/viewlog.php
  56. 22
    0
      admin-www/mon/index.php
  57. 4
    0
      admin-www/mon/lib/account.php
  58. 38
    0
      admin-www/mon/lib/bandwidth.php
  59. 42
    0
      admin-www/mon/lib/common.php
  60. 42
    0
      admin-www/mon/lib/dashboard.php
  61. 10
    0
      admin-www/mon/lib/database.php
  62. 2
    0
      admin-www/mon/lib/footer.php
  63. 44
    0
      admin-www/mon/lib/header.php
  64. 57
    0
      admin-www/mon/pages/servers.php
  65. 56
    0
      admin-www/mon/pages/status.php
  66. 31
    0
      admin-www/mon/probe.php
  67. BIN
      admin-www/mon/res/bandfree.png
  68. BIN
      admin-www/mon/res/bandout.png
  69. 27
    0
      admin-www/mon/res/bandwidth.php
  70. BIN
      admin-www/mon/res/error.png
  71. BIN
      admin-www/mon/res/log.png
  72. BIN
      admin-www/mon/res/logo.png
  73. 97
    0
      admin-www/mon/res/script.js
  74. 240
    0
      admin-www/mon/res/style.css
  75. BIN
      admin-www/res/support/201/ie1.png
  76. BIN
      admin-www/res/support/201/ie2.png
  77. BIN
      admin-www/res/support/201/ie3.png

+ 7
- 0
admin-www/.htaccess View File

@@ -0,0 +1,7 @@
1
+AuthUserFile /home/utd/.htpasswd 
2
+AuthName "UTD-Hosting Admin"
3
+AuthType Basic
4
+
5
+<Limit GET POST PUT DELETE>
6
+require valid-user
7
+</Limit>

+ 22
- 0
admin-www/discount.php View File

@@ -0,0 +1,22 @@
1
+<?PHP
2
+
3
+$codes = array();
4
+
5
+function randLetter($set) {
6
+ global $codes;
7
+ $num = rand(65,90);
8
+ $codes[$set] += $num - 65;
9
+ return chr($num);
10
+}
11
+
12
+for ($i = 0; $i < 4; $i++) {
13
+ for ($j = 0; $j < 4; $j++) {
14
+  echo randLetter($i);
15
+ }
16
+ echo '-';
17
+}
18
+for ($i = 0; $i < 4; $i++) {
19
+ echo chr(($codes[$i] % 26) + 65);
20
+}
21
+
22
+?>

+ 1
- 0
admin-www/info.php View File

@@ -0,0 +1 @@
1
+<?PHP phpinfo(); ?>

+ 1
- 0
admin-www/info.php6 View File

@@ -0,0 +1 @@
1
+<?PHP phpinfo(); ?>

+ 10
- 0
admin-www/info.pl View File

@@ -0,0 +1,10 @@
1
+#!/opt/perl/current/bin/perl
2
+print "Content-type: text/html\n\n";
3
+print "<HTML><HEAD>";
4
+print "<TITLE>CGI Test</TITLE>";
5
+print "</head>";
6
+print "<BODY><h2>Perl Enviroment Info</h2>";
7
+foreach $key (sort keys(%ENV)) {
8
+      print "$key = $ENV{$key}<p>";
9
+   } 
10
+print "</BODY></HTML>";

+ 28
- 0
admin-www/info.py View File

@@ -0,0 +1,28 @@
1
+#!/opt/python/current/bin/python
2
+
3
+   import os
4
+   import cgi
5
+
6
+  print "Content-type: text/html"
7
+  print
8
+
9
+  print """<!DOCTYPE html PUBLIC
10
+     "-//W3C//DTD XHTML 1.0 Transitional//EN"
11
+     "DTD/xhtml1-transitional.dtd">"""
12
+ print """
13
+ <html xmlns = "http://www.w3.org/1999/xhtml" xml:lang="en"
14
+    lang="en">
15
+    <head><title>Environment Variables</title></head>
16
+    <body><table style = "border: 0">"""
17
+rowNumber = 0
18
+for item in os.environ.keys():
19
+    rowNumber += 1
20
+    if rowNumber % 2 == 0:
21
+       backgroundColor = "white"
22
+    else:
23
+       backgroundColor = "lightgrey"
24
+   print """<tr style = "background-color: %s">
25
+    <td>%s</td><td>%s</td></tr>""" \
26
+       % ( backgroundColor, item,
27
+          cgi.escape( os.environ[ item ] ) )
28
+print """</table></body></html>"""

+ 9
- 0
admin-www/issues/.htaccess View File

@@ -0,0 +1,9 @@
1
+ErrorDocument 404 /issues/notfound.php
2
+
3
+Options -MultiViews
4
+RewriteEngine on
5
+
6
+RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
7
+RewriteRule ^([a-z0-9]+)$ /issues/$1.php [L]
8
+RewriteRule ^([a-z]+)/([0-9a-z]+)$ /issues/$1.php?n=$2 [L]
9
+RewriteRule ^([a-z]+)/([0-9a-z]+)/([0-9a-z]+)$ /issues/$1.php?n=$2&m=$3 [L]

+ 35
- 0
admin-www/issues/addcategory.php View File

@@ -0,0 +1,35 @@
1
+<?PHP
2
+
3
+ require_once('lib/dashboard.php');
4
+ require_once('lib/common.php');
5
+
6
+ if (isset($_POST['submit'])) {
7
+  $_POST['name'] = trim($_POST['name']);
8
+  if (empty($_POST['name'])) {
9
+   header('Location: '.CP_PATH.'categories');
10
+   return;
11
+  }
12
+
13
+  $sql = 'INSERT INTO issues_categories
14
+          (icat_id, icat_name) VALUES(\'0\', \''.m($_POST['name']).'\')';
15
+
16
+  $res = mysql_query($sql) or die(mysql_error().'<br />'.$sql);
17
+  logger::log('Issue tracker: category added: '.$_POST['name'], getUserID($_SERVER['REDIRECT_REMOTE_USER']), logger::information);
18
+  header('Location: '.CP_PATH.'categories');
19
+  return;
20
+ }
21
+
22
+ define('TITLE', 'Issue tracker :: Add Category');
23
+
24
+ addDashboardItem('Actions', 'Add Category', 'addcategory');
25
+
26
+ include_once('res/commonDashboard.php');
27
+
28
+ require_once('lib/header.php');
29
+
30
+ require_once('pages/addcategory.php');
31
+
32
+ require_once('lib/footer.php');
33
+
34
+
35
+?>

+ 58
- 0
admin-www/issues/addissue.php View File

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

+ 50
- 0
admin-www/issues/addreply.php View File

@@ -0,0 +1,50 @@
1
+<?PHP
2
+
3
+ require_once('lib/dashboard.php');
4
+ require_once('lib/common.php');
5
+
6
+ if (!isset($_GET['n']) && !ctype_digit($_GET['n'])) {
7
+   header('Location: '.CP_PATH.'viewissues');
8
+ }
9
+ 
10
+ $sql = 'SELECT i_id FROM issues_issues WHERE i_id = '.m($_GET['n']);
11
+ $res = mysql_query($sql);
12
+ if (mysql_num_rows($res) == 0) {
13
+   header('Location: '.CP_PATH.'viewissues');
14
+ }
15
+
16
+ if (isset($_POST['submit'])) {
17
+  if ($_POST['text'] == '') {
18
+   header('Location: '.CP_PATH.'viewissue/'.$_GET['n']);
19
+  }
20
+
21
+  $sql = 'INSERT INTO issues_replies
22
+            (irep_id, i_id, user_id, irep_time, irep_text)
23
+             VALUES(\'0\', \''.m($_GET['n']).'\', \''.m(getUserID($_SERVER['REDIRECT_REMOTE_USER'])).'\',
24
+             \''.time().'\', \''.m($_POST['text']).'\')';
25
+
26
+  $res = mysql_query($sql) or die(mysql_error().'<br />'.$sql);
27
+  $sql = 'UPDATE issues_issues SET i_updated = \''.time().'\' WHERE i_id = \''.$_GET['n'].'\';';
28
+  $res = mysql_query($sql) or die(mysql_error().'<br />'.$sql);
29
+  logger::log('Issue tracker: reply added to : '.getIssueInfo($_GET['n']), getUserID($_SERVER['REDIRECT_REMOTE_USER']), logger::information);
30
+  header('Location: '.CP_PATH.'viewissue/'.$_GET['n'].'#'.mysql_insert_id());
31
+  return;
32
+ }
33
+
34
+ $categories = getCategories();
35
+ $admins = getAdmins();
36
+
37
+ define('TITLE', 'Issue tracker :: Add Issue');
38
+
39
+ addDashboardItem('Actions', 'Raise new issue', 'addissue');
40
+
41
+ include_once('res/commonDashboard.php');
42
+
43
+ require_once('lib/header.php');
44
+
45
+ require_once('pages/addreply.php');
46
+
47
+ require_once('lib/footer.php');
48
+
49
+
50
+?>

+ 21
- 0
admin-www/issues/categories.php View File

@@ -0,0 +1,21 @@
1
+<?PHP
2
+
3
+ require_once('lib/dashboard.php');
4
+ require_once('lib/common.php');
5
+
6
+ $categories = getCategoriesInfo();
7
+
8
+ define('TITLE', 'Issue tracker :: View Categories');
9
+
10
+ addDashboardItem('Actions', 'Add Category', 'addcategory');
11
+
12
+ include_once('res/commonDashboard.php');
13
+
14
+ require_once('lib/header.php');
15
+
16
+ require_once('pages/viewcategories.php');
17
+
18
+ require_once('lib/footer.php');
19
+
20
+
21
+?>

+ 54
- 0
admin-www/issues/deletecategory.php View File

@@ -0,0 +1,54 @@
1
+<?PHP
2
+
3
+ require_once('lib/dashboard.php');
4
+ require_once('lib/common.php');
5
+
6
+ if (!isset($_GET['n']) || !ctype_digit($_GET['n'])) {
7
+   header('Location: '.CP_PATH.'categories');
8
+ }
9
+ 
10
+ $categories = getCategories();
11
+
12
+ if (!isset($categories[$_GET['n']])) {
13
+   header('Location: '.CP_PATH.'categories');
14
+   return;
15
+ }
16
+ 
17
+ $sql = 'SELECT COUNT(*) FROM issues_issues WHERE icat_id = '.m($_GET['n']);
18
+ $res = mysql_query($sql);
19
+ $data = mysql_fetch_array($res);
20
+ 
21
+ if ($data[0] == 0) {
22
+   if (isset($_POST['confirm'])) {
23
+    $sql = 'DELETE FROM issues_categories WHERE icat_id = '.m($_GET['n']);
24
+    mysql_query($sql);
25
+    $sql = 'DELETE FROM issues_assigns WHERE icat_id = '.m($_GET['n']);
26
+    mysql_query($sql);
27
+    logger::log('Issue tracker: category deleted: '.getCategoryName($_POST['n']), getUserID($_SERVER['REDIRECT_REMOTE_USER']), logger::information);
28
+    header('Location: '.CP_PATH.'categories');
29
+    return;
30
+   } else {
31
+     $sql = 'SELECT icat_id, icat_name FROM issues_categories WHERE icat_id = '.m($_GET['n']);
32
+     $res = mysql_query($sql);
33
+     $data = mysql_fetch_assoc($res);
34
+     $data[0] = 0;
35
+   }
36
+ } else {
37
+  $sql = 'SELECT i_id, i_title FROM issues_issues WHERE icat_id = '.m($_GET['n']);
38
+  $res = mysql_query($sql);
39
+ }
40
+
41
+ define('TITLE', 'Issue tracker :: Delete Category :: '.h($categories[$_GET['n']]));
42
+
43
+ addDashboardItem('Actions', 'Raise new issue', 'addissue');
44
+
45
+ include_once('res/commonDashboard.php');
46
+
47
+ require_once('lib/header.php');
48
+ 
49
+ require_once('pages/deletecategory.php');
50
+
51
+ require_once('lib/footer.php');
52
+
53
+
54
+?>

+ 53
- 0
admin-www/issues/deleteissue.php View File

@@ -0,0 +1,53 @@
1
+<?PHP
2
+
3
+ require_once('lib/dashboard.php');
4
+ require_once('lib/common.php');
5
+
6
+ if (!isset($_GET['n']) || !ctype_digit($_GET['n'])) {
7
+   header('Location: '.CP_PATH);
8
+ }
9
+ $sql  = 'SELECT i_id, i_title FROM issues_issues WHERE i_id = '.m($_GET['n']);
10
+
11
+ $viewIssueRes = mysql_query($sql) or die(mysql_error().'<br />'.$sql);
12
+
13
+ if (mysql_num_rows($viewIssueRes) == 0) {
14
+   header('Location: '.CP_PATH);
15
+ }
16
+ 
17
+ $viewIssueData = mysql_fetch_assoc($viewIssueRes);
18
+ 
19
+ if (isset($_POST['confirm'])) {
20
+   $sql = 'DELETE FROM issues_issues WHERE i_id = '.m($_GET['n']);
21
+   mysql_query($sql);
22
+   $sql = 'DELETE FROM issues_replies WHERE i_id = '.m($_GET['n']);
23
+   mysql_query($sql);
24
+   $sql = 'DELETE FROM issues_logs WHERE i_id = '.m($_GET['n']);
25
+   mysql_query($sql);
26
+   logger::log('Issue tracker: issue deleted: '.$viewIssueData['i_title'], getUserID($_SERVER['REDIRECT_REMOTE_USER']), logger::information);
27
+   header('Location: '.CP_PATH);
28
+   return;
29
+ }
30
+
31
+ $sql  = 'SELECT COUNT(*) FROM issues_replies WHERE i_id = '.m($_GET['n']);
32
+ $viewIssueRepliesRes = mysql_query($sql) or die(mysql_error());
33
+ $viewIssueRepliesData = mysql_fetch_array($viewIssueRepliesRes);
34
+ 
35
+ $sql  = 'SELECT COUNT(*) FROM issues_logs WHERE i_id = '.m($_GET['n']);
36
+ $viewIssueChangesRes = mysql_query($sql) or die(mysql_error());
37
+ $viewIssueChangesData = mysql_fetch_array($viewIssueChangesRes);
38
+
39
+
40
+ define('TITLE', 'Issue tracker :: Delete Issue :: '.h($viewIssueData['i_title']));
41
+
42
+ addDashboardItem('Actions', 'Raise new issue', 'addissue');
43
+
44
+ include_once('res/commonDashboard.php');
45
+
46
+ require_once('lib/header.php');
47
+ 
48
+ require_once('pages/deleteissue.php');
49
+
50
+ require_once('lib/footer.php');
51
+
52
+
53
+?>

+ 47
- 0
admin-www/issues/editcategory.php View File

@@ -0,0 +1,47 @@
1
+<?PHP
2
+
3
+ require_once('lib/dashboard.php');
4
+ require_once('lib/common.php');
5
+
6
+ if (!isset($_GET['n']) && !ctype_digit($_GET['n'])) {
7
+  header('Location: '.CP_PATH.'categories');
8
+ }
9
+
10
+ if (isset($_POST['submit'])) {
11
+  $_POST['name'] = trim($_POST['name']);
12
+  if (empty($_POST['name'])) {
13
+   header('Location: '.CP_PATH.'categories');
14
+   return;
15
+  }
16
+
17
+  $sql = 'UPDATE issues_categories SET icat_name = \''.m($_POST['name']).'\', icat_assign = '.m($_POST['assignee']).' WHERE icat_id = '.m($_GET['n']);
18
+
19
+  $res = mysql_query($sql) or die(mysql_error().'<br />'.$sql);
20
+  logger::log('Issue tracker: category edited: '.getCategoryName($_GET['n']), getUserID($_SERVER['REDIRECT_REMOTE_USER']), logger::information);
21
+  header('Location: '.CP_PATH.'categories');
22
+  return;
23
+ }
24
+
25
+ $admins = getAdmins();
26
+ $sql = 'SELECT icat_id, icat_name, icat_assign FROM issues_categories WHERE icat_id = \''.$_GET['n'].'\'';
27
+ $res = mysql_query($sql);
28
+ if (mysql_num_rows($res) == 0) {
29
+  header('Location: '.CP_PATH.'categories');
30
+ }
31
+ $data = mysql_fetch_assoc($res);
32
+
33
+
34
+ define('TITLE', 'Issue tracker :: Edit Category :: '.h($data['icat_name']));
35
+
36
+ addDashboardItem('Actions', 'Add Category', 'addcategory');
37
+
38
+ include_once('res/commonDashboard.php');
39
+
40
+ require_once('lib/header.php');
41
+
42
+ require_once('pages/editcategory.php');
43
+
44
+ require_once('lib/footer.php');
45
+
46
+
47
+?>

+ 118
- 0
admin-www/issues/editissue.php View File

@@ -0,0 +1,118 @@
1
+<?PHP
2
+
3
+ require_once('lib/dashboard.php');
4
+ require_once('lib/common.php');
5
+
6
+ if (!isset($_GET['n']) || !ctype_digit($_GET['n'])) {
7
+   header('Location: '.CP_PATH);
8
+ }
9
+
10
+ $categories = getCategories();
11
+ $admins = getAdmins();
12
+
13
+ $sql  = 'SELECT i.i_id, i.icat_id, c.icat_name, i.i_title, i.i_status, u1.user_name AS i_assignee,
14
+ u2.user_name AS i_submitter, i.i_priority, i.i_added, i.i_deadline, i.i_updated, i.i_text, i.i_extensiveness
15
+ FROM issues_issues AS i
16
+ LEFT JOIN issues_categories AS c ON i.icat_id = c.icat_id
17
+ LEFT JOIN users AS u1 ON i.i_assignee = u1.user_id
18
+ LEFT JOIN users AS u2 ON i.i_submitter = u2.user_id
19
+ WHERE i_id = '.m($_GET['n']);
20
+ 
21
+ $viewIssueRes = mysql_query($sql) or die(mysql_error().'<br />'.$sql);
22
+
23
+ if (mysql_num_rows($viewIssueRes) == 0) {
24
+   header('Location: '.CP_PATH);
25
+ }
26
+
27
+ $viewIssueData = mysql_fetch_assoc($viewIssueRes);
28
+
29
+ if (isset($_POST['submit'])) {
30
+  if ($_POST['deadline'] == 'none') {
31
+   $_POST['deadline'] = 0;
32
+  }
33
+  if ($_POST['assignee'] == '') {
34
+    $_POST['assignee'] = 0;
35
+  }
36
+  if ($_POST['assignee'] != '' && $_POST['status'] != 'closed') {
37
+   $_POST['status'] = 'assigned';
38
+  }
39
+  $changed = false;
40
+  if ($_POST['assignee'] != $viewIssueData['i_assignee']) {
41
+   $changed = true;
42
+   $sql = 'INSERT INTO issues_logs
43
+           VALUES (0, '.m($_GET['n']).', '.time().', \''.m(getUserID($_SERVER['REDIRECT_REMOTE_USER'])).'\', \'assignee\', \''.m($viewIssueData['i_assignee']).'\', \''.m($_POST['assignee']).'\')';
44
+   mysql_query($sql) or die($sql."<br>".mysql_error());
45
+  }
46
+  if ($_POST['status'] != $viewIssueData['i_status']) {
47
+   $changed = true;
48
+   $sql = 'INSERT INTO issues_logs
49
+           VALUES (0, '.m($_GET['n']).', '.time().', \''.m(getUserID($_SERVER['REDIRECT_REMOTE_USER'])).'\', \'status\', \''.m($viewIssueData['i_status']).'\', \''.m($_POST['status']).'\')';
50
+   mysql_query($sql) or die($sql."<br>".mysql_error());
51
+  }
52
+  if ($_POST['title'] != $viewIssueData['i_title']) {
53
+   $changed = true;
54
+   $sql = 'INSERT INTO issues_logs
55
+           VALUES (0, '.m($_GET['n']).', '.time().', \''.m(getUserID($_SERVER['REDIRECT_REMOTE_USER'])).'\', \'title\', \''.m($viewIssueData['i_title']).'\', \''.m($_POST['title']).'\')';
56
+   mysql_query($sql) or die($sql."<br>".mysql_error());
57
+  }
58
+  if ($_POST['text'] != $viewIssueData['i_text']) {
59
+   $changed = true;
60
+   $sql = 'INSERT INTO issues_logs
61
+           VALUES (0, '.m($_GET['n']).',  '.time().', \''.m(getUserID($_SERVER['REDIRECT_REMOTE_USER'])).'\', \'text\', \''.m($viewIssueData['i_text']).'\', \''.m($_POST['text']).'\')';
62
+   mysql_query($sql) or die($sql."<br>".mysql_error());
63
+  }
64
+  if ($_POST['category'] != $viewIssueData['icat_id']) {
65
+   $changed = true;
66
+   $sql = 'INSERT INTO issues_logs
67
+           VALUES (0, '.m($_GET['n']).',  '.time().', \''.m(getUserID($_SERVER['REDIRECT_REMOTE_USER'])).'\', \'category\', \''.m($viewIssueData['icat_id']).'\', \''.m($_POST['category']).'\')';
68
+   mysql_query($sql) or die($sql."<br>".mysql_error());
69
+  }
70
+  if ($_POST['priority'] != $viewIssueData['i_priority']) {
71
+   $changed = true;
72
+   $sql = 'INSERT INTO issues_logs
73
+           VALUES (0, '.m($_GET['n']).',  '.time().', \''.m(getUserID($_SERVER['REDIRECT_REMOTE_USER'])).'\', \'priority\', \''.m($viewIssueData['i_priority']).'\', \''.m($_POST['priority']).'\')';
74
+   mysql_query($sql) or die($sql."<br>".mysql_error());
75
+  }
76
+  if (strtotime($_POST['deadline']) != $viewIssueData['i_deadline']) {
77
+   $changed = true;
78
+   $sql = 'INSERT INTO issues_logs
79
+           VALUES (0, '.m($_GET['n']).',  '.time().', \''.m(getUserID($_SERVER['REDIRECT_REMOTE_USER'])).'\', \'deadline\', \''.m($viewIssueData['i_deadline']).'\', \''.m(strtotime($_POST['deadline'])).'\')';
80
+   mysql_query($sql) or die($sql."<br>".mysql_error());
81
+  }
82
+  if ($_POST['extensiveness'] != $viewIssueData['i_extensiveness']) {
83
+   $changed = true;
84
+   $sql = 'INSERT INTO issues_logs
85
+           VALUES (0, '.m($_GET['n']).',  '.time().', \''.m(getUserID($_SERVER['REDIRECT_REMOTE_USER'])).'\', \'extensiveness\', \''.m($viewIssueData['i_extensiveness']).'\', \''.m(strtotime($_POST['extensiveness'])).'\')';
86
+   mysql_query($sql) or die($sql."<br>".mysql_error());
87
+  }
88
+  if ($changed) {
89
+   $sql = 'UPDATE issues_issues
90
+           SET i_title = \''.m($_POST['title']).'\', i_status = \''.m($_POST['status']).'\',
91
+               i_assignee = \''.m($_POST['assignee']).'\', i_text = \''.m($_POST['text']).'\',
92
+               i_updated = '.time().', icat_id = '.m($_POST['category']).', i_priority = \''.m($_POST['priority']).'\',
93
+               i_deadline = '.m(strtotime($_POST['deadline'])).', i_extensiveness = \''.m($_POST['extensiveness']).'\' 
94
+          WHERE i_id = '.m($_GET['n']);
95
+   $res = mysql_query($sql) or die($sql."<br>".mysql_error());
96
+   logger::log('Issue tracker: issue edited: '.getCategoryName($_POST['category']).': '.$_POST['title'], getUserID($_SERVER['REDIRECT_REMOTE_USER']), logger::information);
97
+  }
98
+  header('Location: '.CP_PATH.'viewissue/'.$_GET['n']);
99
+  return;
100
+ }
101
+
102
+ define('TITLE', 'Issue tracker :: Edit Issue :: '.h($viewIssueData['i_title']));
103
+
104
+ addDashboardItem('Actions', 'Raise new issue', 'addissue');
105
+ addDashboardItem('Actions', 'Edit', 'editissue/'.$_GET['n']);
106
+ addDashboardItem('Actions', 'Reply', 'addreply/'.$_GET['n']);
107
+ addDashboardItem('Actions', 'View Log', 'viewlog/'.$_GET['n']);
108
+
109
+ include_once('res/commonDashboard.php');
110
+
111
+ require_once('lib/header.php');
112
+ 
113
+ require_once('pages/editissue.php');
114
+
115
+ require_once('lib/footer.php');
116
+
117
+
118
+?>

+ 37
- 0
admin-www/issues/index.php View File

@@ -0,0 +1,37 @@
1
+<?PHP
2
+
3
+ require_once('lib/dashboard.php');
4
+ require_once('lib/common.php');
5
+
6
+ $admins = getAdmins();
7
+ $categories = getCategories();
8
+
9
+ $search = array();
10
+ $search['title'] = 'Recently updated issues';
11
+ $search['keywords'] = '';
12
+ $search['keywordloc'] = 'both';
13
+ $search['submitter'] = 'any';
14
+ $search['assignee'] = 'any';
15
+ $search['added'] = 'any';
16
+ $search['updated'] = 'any';
17
+ $search['deadline'] = 'any';
18
+ $search['priority'] = array('urgent', 'high', 'normal', 'low');
19
+ $search['status'] = array('open', 'assigned', 'closed', 'reopened');
20
+ $search['categories'] = array_keys($categories);
21
+ $search['order'] = 'updateddesc';
22
+ $search['limit'] = 20;
23
+
24
+ define('TITLE', 'Issue tracker');
25
+
26
+ addDashboardItem('Actions', 'Raise new issue', 'addissue');
27
+
28
+ include_once('res/commonDashboard.php');
29
+
30
+ require_once('lib/header.php');
31
+
32
+ require_once('pages/searchresults.php');
33
+ 
34
+ require_once('lib/footer.php');
35
+
36
+
37
+?>

+ 25
- 0
admin-www/issues/lib/account.php View File

@@ -0,0 +1,25 @@
1
+<?php
2
+$authInfo = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"],6));
3
+unset($_SERVER['REDIRECT_REMOTE_USER']);
4
+if ($authInfo != "") {
5
+list($user, $password) = explode(':', $authInfo);
6
+$_SERVER['REDIRECT_REMOTE_USER'] = $user;
7
+$_SERVER['PHP_AUTH_PW'] = $password;
8
+}
9
+while (!isset($_SERVER['REDIRECT_REMOTE_USER']) || $_SERVER['REDIRECT_REMOTE_USER'] == "" ) {
10
+ if ( (strlen($authInfo) == 0) || ( strcasecmp($authInfo, ":" )  == 0 )) {
11
+  header('WWW-Authenticate: Basic realm="UTD-Hosting"');
12
+  header('HTTP/1.0 401 Unauthorized');
13
+  die('<div class="block">Authorisation failed.</div>');
14
+  return;
15
+ } else {
16
+ $sql = 'SELECT user_name FROM users
17
+   WHERE user_name = \''.m($_SERVER['REDIRECT_REMOTE_USER']).'\'
18
+   AND user_pass = \''.m(md5($_SERVER['REDIRECT_REMOTE_USER'].$_SERVER['PHP_AUTH_PW'])).'\' AND user_admin = 1';
19
+ $res = mysql_query($sql) or die(mysql_error());
20
+ if (mysql_num_rows($res) > 0) {
21
+   $result = mysql_fetch_assoc($res);
22
+ }
23
+ }
24
+}
25
+?>

+ 201
- 0
admin-www/issues/lib/common.php View File

@@ -0,0 +1,201 @@
1
+<?PHP
2
+
3
+ if (defined('LIB_COMMON')) { return; }
4
+
5
+ require_once('lib/database.php');
6
+ //require_once('lib/account.php');
7
+ require_once('lib/log.php');
8
+ 
9
+ define('CP_PATH', '/issues/');
10
+
11
+ function stripSlashesDeep($value) {
12
+    $value = is_array($value) ? array_map('stripslashesDeep', $value) : (isset($value) ? stripslashes($value) : null);
13
+    return $value;
14
+  }
15
+
16
+ function stripSlashesOnInput() {
17
+    if (get_magic_quotes_gpc()) {
18
+      $_POST = stripSlashesDeep($_POST);
19
+      $_GET = stripSlashesDeep($_GET);
20
+      $_COOKIE = stripSlashesDeep($_COOKIE);
21
+    }
22
+  }
23
+
24
+ function repairPost($data) {
25
+  $rawpost = "&".file_get_contents("php://input");
26
+   while(list($key,$value)= each($data)) {
27
+    $pos = preg_match_all("/&".$key."=([^&]*)/i",$rawpost, $regs, PREG_PATTERN_ORDER);
28
+    if((!is_array($value)) && ($pos > 1)) {
29
+     $qform[$key] = array();
30
+     for($i = 0; $i < $pos; $i++) {
31
+      $qform[$key][$i] = urldecode($regs[1][$i]);
32
+     }
33
+    } else {
34
+    $qform[$key] = $value;
35
+   }
36
+  }
37
+  return $qform;
38
+ }
39
+
40
+ function getAdmins() {
41
+  $sql = 'SELECT user_id, user_name FROM users WHERE user_admin = 1 AND user_pass != \'invalid\' ORDER BY user_name';
42
+  $adminsRes = mysql_query($sql);
43
+  if (mysql_num_rows($adminsRes) == 0) {
44
+   return array();
45
+  }
46
+  while ($adminsData = mysql_fetch_assoc($adminsRes)) {
47
+   $admins[$adminsData['user_id']] = $adminsData['user_name'];
48
+  }
49
+  return $admins;
50
+ }
51
+
52
+ function getCategories() {
53
+  $sql = 'SELECT icat_id, icat_name, icat_assign FROM issues_categories ORDER BY icat_name';
54
+  $categoriesRes = mysql_query($sql);
55
+  if (mysql_num_rows($categoriesRes) == 0) {
56
+   return array();
57
+  }
58
+  $categories = array();
59
+  while ($categoriesData = mysql_fetch_assoc($categoriesRes)) {
60
+   $categories[$categoriesData['icat_id']] = $categoriesData['icat_name'];   
61
+  }
62
+  return $categories;
63
+ }
64
+ 
65
+ function getCategoriesInfo() {
66
+  $sql = 'SELECT icat_id, icat_name, icat_assign FROM issues_categories ORDER BY icat_name';
67
+  $categoriesRes = mysql_query($sql);
68
+  if (mysql_num_rows($categoriesRes) == 0) {
69
+   return array();
70
+  }
71
+  $categories = array();
72
+  while ($categoriesData = mysql_fetch_assoc($categoriesRes)) {
73
+   $categories[$categoriesData['icat_id']] = array('name'=>$categoriesData['icat_name'], 'assign'=>$categoriesData['icat_assign']);
74
+  }
75
+  return $categories;
76
+ }
77
+
78
+ function getUserID($name) {
79
+   $sql = 'SELECT user_id FROM users WHERE user_name = \''.m($name).'\'';
80
+   $res = mysql_query($sql);
81
+   if (mysql_num_rows($res) == 0) {
82
+     return 0;
83
+   }
84
+   $result = mysql_fetch_assoc($res);
85
+   return $result['user_id'];
86
+ }
87
+
88
+function getUserName($id) {
89
+   $sql = 'SELECT user_name FROM users WHERE user_id = '.m($id);
90
+   $res = mysql_query($sql);
91
+   if (mysql_num_rows($res) == 0) {
92
+     return 'Unknown';
93
+   }
94
+   $result = mysql_fetch_assoc($res);
95
+   return $result['user_name'];
96
+ }
97
+ 
98
+ function getCategoryID($name) {
99
+   $sql = 'SELECT icat_id FROM issues_categories WHERE icat_name = \''.m($name).'\'';
100
+   $res = mysql_query($sql);
101
+   if (mysql_num_rows($res) == 0) {
102
+     return 0;
103
+   }
104
+   $result = mysql_fetch_assoc($res);
105
+   return $result['icat_id'];
106
+ }
107
+
108
+ function getCategoryName($id) {
109
+   $sql = 'SELECT icat_name FROM issues_categories WHERE icat_id = '.m($id);
110
+   $res = mysql_query($sql);
111
+   if (mysql_num_rows($res) == 0) {
112
+     return 'Unknown';
113
+   }
114
+   $result = mysql_fetch_assoc($res);
115
+   return $result['icat_name'];
116
+ }
117
+ 
118
+ function getIssueTitle($id) {
119
+  $sql = 'SELECT i_title FROM issues_issues WHERE i_id = '.m($id);
120
+  $res = mysql_query($sql);
121
+  if (mysql_num_rows($res) == 0) {
122
+   return 'Unknown';
123
+  }
124
+  $result = mysql_fetch_assoc($res);
125
+  return $result['i_title'];
126
+ }
127
+
128
+ function getIssueInfo($id) {
129
+  $sql = 'SELECT i_title, icat_name FROM issues_issues NATURAL JOIN issues_categories WHERE i_id = '.m($id);
130
+  $res = mysql_query($sql);
131
+  if (mysql_num_rows($res) == 0) {
132
+   return 'Unknown : Unknown';
133
+  }
134
+  $result = mysql_fetch_assoc($res);
135
+  return $result['icat_name'].': '.$result['i_title'];
136
+ }
137
+ 
138
+ function NiceSize($bytes) {
139
+  $sizes = array();
140
+  $sizes[1024] = ' <abbr title="Kibibytes">KiB</abbr>';
141
+  $sizes[(1024*1024)] = ' <abbr title="Mebibytes">MiB</abbr>';
142
+  $sizes[(1024*1024*1024)] = ' <abbr title="Gibibytes">GiB</abbr>';
143
+  krsort($sizes);
144
+  foreach ($sizes as $val => $name) {
145
+   if ($bytes > ($val * 1.2)) {
146
+    return round($bytes/$val, 2).$name;
147
+   }
148
+  }
149
+  return $bytes.' <abbr title="Bytes">B</abbr>';
150
+ }
151
+ 
152
+ function h ($text) { return htmlspecialchars($text); } 
153
+ function m ($a) { return mysql_real_escape_string($a); }
154
+
155
+ function n ($user) {
156
+  if (strtolower($user) == strtolower($_SERVER['REDIRECT_REMOTE_USER'])) {
157
+   return '<strong>You</strong>';
158
+  } elseif ($user == '') {
159
+   return '<span style="font-style: italic;">None</span>';
160
+  } else {
161
+   return h($user);
162
+  }
163
+ }
164
+ 
165
+ function d($format, $timestamp) {
166
+   if ($timestamp == 0) {
167
+     return '<span style="font-style: italic;">None</span>';
168
+   }
169
+   return date($format, $timestamp);
170
+ }
171
+
172
+ function duration($seconds=0, $max_periods=7)
173
+ {
174
+  if (empty($seconds)) {
175
+    return '0 seconds';
176
+  }
177
+  $periods = array("year" => 31536000, "month" => 2419200, "week" => 604800, "day" => 86400, "hour" => 3600, "minute" => 60, "second" => 1);
178
+  $i = 1;
179
+  foreach ( $periods as $period => $period_seconds )
180
+  {
181
+   $period_duration = floor($seconds / $period_seconds);
182
+   $seconds = $seconds % $period_seconds;
183
+   if ( $period_duration == 0 )
184
+   {
185
+    continue;
186
+   }
187
+   $duration[] = "{$period_duration} {$period}" . ($period_duration > 1 ? 's' : '');
188
+   $i++;
189
+   if ( $i >  $max_periods )
190
+   {
191
+    break;
192
+   }
193
+  }
194
+  return implode(' ', $duration);
195
+ }
196
+ 
197
+ stripSlashesOnInput();
198
+
199
+ define('LIB_COMMON', true);
200
+
201
+?>

+ 42
- 0
admin-www/issues/lib/dashboard.php View File

@@ -0,0 +1,42 @@
1
+<?PHP
2
+
3
+if (defined('LIB_DASHBOARD')) { return; }
4
+
5
+$dbitems = array();
6
+
7
+function addDashboardItem ($category, $title, $url) {
8
+  global $dbitems;
9
+  
10
+  if (!isset($dbitems[$category])) {
11
+    $dbitems[$category] = array();
12
+  }
13
+  
14
+  $dbitems[$category][$title] = $url;
15
+}
16
+
17
+function generateDashboard () {
18
+  global $dbitems;
19
+  
20
+  ksort($dbitems);
21
+  
22
+  foreach ($dbitems as $k => $v) { ksort($dbitems[$k]); }
23
+  
24
+  echo '<div id="dashboard">';
25
+  
26
+  foreach ($dbitems as $category => $data) {
27
+    echo '<h2>'.$category.'</h2><ul>';  
28
+    foreach ($data as $title => $url) {
29
+      if ($url[0] != '#' && substr($url,0,7) != 'http://') { 
30
+	    $url = CP_PATH.$url;
31
+      }
32
+      echo '<li><a href="'.htmlspecialchars($url).'">'.$title.'</a></li>';
33
+    }
34
+    echo '</ul>';
35
+  }
36
+  
37
+  echo '</div>';
38
+}
39
+
40
+define('LIB_DASHBOARD', true);
41
+
42
+?>

+ 10
- 0
admin-www/issues/lib/database.php View File

@@ -0,0 +1,10 @@
1
+<?PHP
2
+
3
+ if (defined('LIB_DB') && !isset($_redodb)) { return; }
4
+
5
+ mysql_connect('', '', '');
6
+ mysql_select_db('');
7
+
8
+ define('LIB_DB', true);
9
+
10
+?>

+ 2
- 0
admin-www/issues/lib/footer.php View File

@@ -0,0 +1,2 @@
1
+ </body>
2
+</html>

+ 37
- 0
admin-www/issues/lib/header.php View File

@@ -0,0 +1,37 @@
1
+<?PHP
2
+
3
+ if (!defined('LIB_COMMON')) { require_once('lib/common.php'); }
4
+ if (!defined('LIB_DASHBOARD')) { require_once('lib/dashboard.php'); }
5
+
6
+?>
7
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
8
+<html>
9
+ <head>
10
+  <title>UTD-Hosting :: <?PHP echo TITLE; ?></title>
11
+  <link rel="stylesheet" type="text/css" href="<?PHP echo CP_PATH; ?>res/style.css">
12
+ </head>
13
+ <body>
14
+  <div id="header">
15
+   <h1><img src="<?PHP echo CP_PATH; ?>res/logo.png" alt="UTD-Hosting" title="UTD-Hosting"></h1>
16
+  </div>
17
+  <div id="menu">
18
+   <div id="menuleft">
19
+    <a href="<?PHP echo CP_PATH; ?>">Issue Tracker</a> |
20
+    <a href="<?PHP echo CP_PATH; ?>search">Search</a> |
21
+    <a href="<?PHP echo CP_PATH; ?>stats">Stats</a> |
22
+    <a href="<?PHP echo CP_PATH; ?>categories">Categories</a> |
23
+    <a href="<?PHP echo CP_PATH; ?>searches">Searches</a>
24
+   </div>
25
+   <div id="menuright">
26
+    <a href="https://secure.utd-hosting.com/control">Control panel</a> |
27
+    <a href="https://secure.utd-hosting.com/control/admin">Admin</a>
28
+   </div>
29
+  </div>
30
+  <?PHP generateDashboard(); ?>
31
+  <?PHP if (defined('MESSAGE')) { ?>
32
+  <div id="message">
33
+   <div>
34
+    <?PHP echo MESSAGE; ?>
35
+   </div>
36
+  </div>
37
+  <?PHP } ?>

+ 59
- 0
admin-www/issues/lib/log.php View File

@@ -0,0 +1,59 @@
1
+<?PHP
2
+
3
+ require_once('lib/database.php');
4
+
5
+ class logger {
6
+
7
+  const unknown = "'unknown'";
8
+  const critical = "'critical'";
9
+  const important = "'important'";
10
+  const normal = "'normal'";
11
+  const information = "'info'";
12
+  const info = "'info'";
13
+
14
+  static function log ($message, $uid = false, $level = logger::unknown) {
15
+   if ($uid !== false && !ctype_digit($uid)) {
16
+    $temp = $level;
17
+    $level = $uid;
18
+    $uid = $temp;
19
+   }
20
+
21
+   if ($uid === false || !ctype_digit($uid)) {
22
+    if (defined('UID')) { $uid = UID; } else { $uid = 5; }
23
+   }
24
+
25
+   $sql  = 'INSERT INTO log (user_id, log_level, log_time, log_message) ';
26
+   $sql .= 'VALUES('.$uid.', '.$level.', '.time().', \''.m($message).'\')';
27
+   mysql_query($sql);
28
+
29
+   $botmsg = '';
30
+   switch ($level) {
31
+    case self::critical:
32
+     $botmsg = chr(2).chr(3).'4CRITICAL:'.chr(3).chr(2); break;
33
+    case self::important:
34
+     $botmsg = chr(2).'IMPORTANT:'.chr(2); break;
35
+    case self::normal:
36
+     $botmsg = 'NORMAL:'; break;
37
+    case self::unknown:
38
+     $botmsg = 'UNKNOWN:'; break;
39
+    case self::information:
40
+     $botmsg = chr(3).'14INFORMATION:'.chr(3); break;
41
+   }
42
+
43
+   if ($uid != 5) {
44
+    $sql = 'SELECT user_name FROM users WHERE user_id = '.$uid;
45
+    $res = mysql_query($sql);
46
+    $row = mysql_fetch_array($res);
47
+    $botmsg .= ' User '.$row['user_name'].':';
48
+   }
49
+
50
+   $botmsg .= ' '.$message;
51
+
52
+   if ($fh = @fsockopen('207.150.170.50',7530,$errno,$errstr,0.1)) {
53
+    fputs($fh, '...'.$botmsg."\r\n");
54
+    fclose($fh);
55
+   }
56
+  }
57
+ }
58
+
59
+?>

+ 19
- 0
admin-www/issues/notfound.php View File

@@ -0,0 +1,19 @@
1
+<?PHP
2
+
3
+ require_once('lib/dashboard.php');
4
+ require_once('lib/common.php');
5
+
6
+ define('TITLE', 'Issue tracker :: 404 - Page not found');
7
+
8
+ addDashboardItem('Actions', 'Raise new issue', 'addissue');
9
+
10
+ include_once('res/commonDashboard.php');
11
+
12
+ require_once('lib/header.php');
13
+ 
14
+ require_once('pages/404.php');
15
+ 
16
+ require_once('lib/footer.php');
17
+
18
+
19
+?>

+ 4
- 0
admin-www/issues/pages/404.php View File

@@ -0,0 +1,4 @@
1
+<div class="block">
2
+ <h2>Page not found</h2>
3
+ <p>The page you requested (<?php echo str_replace(CP_PATH, '', $_SERVER['REQUEST_URI']) ?>) was not found.</p>
4
+</div>

+ 11
- 0
admin-www/issues/pages/addcategory.php View File

@@ -0,0 +1,11 @@
1
+<div class="block">
2
+ <h2>Add Category</h2>
3
+ <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
4
+ <table class="innerblock righthead">
5
+  <tr><th>Name</th><td><input type="text" name="name" value="" size="50" /></td></tr>
6
+  <tr><th>Actions</th><td>
7
+   <input type="submit" name="submit" value="Submit" />&nbsp;<input type="reset" value="Reset" />
8
+  </td></tr>
9
+ </table>
10
+ </form>
11
+</div>

+ 51
- 0
admin-www/issues/pages/addissue.php View File

@@ -0,0 +1,51 @@
1
+<div class="block">
2
+ <h2>Add Issue</h2>
3
+ <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
4
+ <table class="innerblock righthead">
5
+  <tr><th>Title</th><td><input type="text" name="title" size="50" /></td></tr>
6
+  <tr><th>Category</th><td>
7
+   <select name="category" size="1">
8
+    <?php
9
+      foreach($categories as $id => $name) {
10
+        echo '<option value="'.$id.'">'.$name.'</option>'."\r\n";
11
+      }
12
+    ?>
13
+   </select>
14
+  </td></tr>
15
+  <tr><th>Assignee</th><td>
16
+   <select name="assignee">
17
+    <option value="">(None)</option>
18
+    <?php
19
+      foreach($admins as $id => $username) {
20
+        echo '<option value="'.$id.'">'.$username.'</option>'."\r\n";
21
+      }
22
+    ?>
23
+   </select>
24
+  </td></tr>
25
+  <tr><th>Priority</th><td>
26
+   <select name="priority" size="1">
27
+    <option value="urgent">Urgent</option>
28
+    <option value="high">High</option>
29
+    <option value="normal" selected="true">Normal</option>
30
+    <option value="low">Low</option>
31
+   </select>
32
+  </tr><tr>
33
+   <th>Extensiveness</th>
34
+   <td>
35
+    <select name="extensiveness" size="1">
36
+     <option name="extensive">Extensive</option>
37
+     <option name="normal" selected="true">Normal</option>
38
+     <option name="trivial">Trivial</option>
39
+    </select>
40
+   </td>
41
+  </tr> 
42
+  <tr><th>Deadline</th><td><input type="text" name="deadline" size="50" value="none"/></td></tr>
43
+  <tr><th>Notes</th><td>
44
+  <textarea name="text" cols="45" rows="10"></textarea>
45
+  </td></tr>
46
+  <tr><th>Actions</th><td>
47
+   <input type="submit" name="submit" value="Submit" />&nbsp;<input type="reset" value="Reset" />
48
+  </td></tr>
49
+ </table>
50
+ </form>
51
+</div>

+ 13
- 0
admin-www/issues/pages/addreply.php View File

@@ -0,0 +1,13 @@
1
+<div class="block">
2
+ <h2>Add Reply</h2>
3
+ <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
4
+ <table class="innerblock righthead">
5
+  <tr><th>Notes</th><td>
6
+  <textarea name="text" cols="45" rows="10"></textarea>
7
+  </td></tr>
8
+  <tr><th>Actions</th><td>
9
+   <input type="submit" name="submit" value="Submit" />&nbsp;<input type="reset" value="Reset" />
10
+  </td></tr>
11
+ </table>
12
+ </form>
13
+</div>

+ 113
- 0
admin-www/issues/pages/addsearch.php View File

@@ -0,0 +1,113 @@
1
+<div class="block">
2
+ <h2>Search Options</h2>
3
+ <div class="innerblock">
4
+ <form action="<?php $_SERVER['REQUEST_URI']; ?>" method="post">
5
+  <div class="searchrow">
6
+   <label for="name">Title: </label>
7
+   <input type="text" name="title" value="" />
8
+  </div>
9
+  <div class="searchrow">
10
+   <label for="keywords">Keywords:</label>
11
+   <input type="text" name="keywords" class="search" value="">
12
+
13
+   <label for="keywordloc">Search in:</label>
14
+   <select name="keywordloc">
15
+    <option value="both">Titles And Notes</option>
16
+    <option value="title">Titles</option>
17
+    <option value="notes">Notes</option>
18
+   </select>
19
+  </div>
20
+  <div class="searchrow">
21
+   <label for="submitter">Submitter:</label>
22
+   <select name="submitter">
23
+    <option value="any">Any</option>
24
+    <?php
25
+      foreach($admins as $id => $username) {
26
+        echo '<option value="'.$id.'">'.$username.'</option>'."\r\n";
27
+      }
28
+    ?>
29
+   </select>
30
+
31
+   <label for="assignee">Assignee:</label>
32
+   <select name="assignee">
33
+    <option value="any">Any</option>
34
+    <?php
35
+      foreach($admins as $id => $username) {
36
+        echo '<option value="'.$id.'">'.$username.'</option>'."\r\n";
37
+      }
38
+    ?>
39
+   </select>
40
+  </div>
41
+  <div class="searchrow">
42
+   <label for="added">Added:</label>
43
+   <select name="added">
44
+    <option value="any">Any time</option>
45
+    <option value="day">Past day</option>
46
+    <option value="week">Past week</option>
47
+    <option value="month">Past month</option>
48
+   </select>
49
+
50
+   <label for="updated">Updated:</label>
51
+   <select name="updated">
52
+    <option value="any">Any time</option>
53
+    <option value="day">Past day</option>
54
+    <option value="week">Past week</option>
55
+    <option value="month">Past month</option>
56
+   </select>
57
+
58
+   <label for="deadline">Deadline:</label>
59
+   <select name="deadline">
60
+    <option value="any">Any time</option>
61
+    <option value="day">Tomorrow</option>
62
+    <option value="week">Next week</option>
63
+    <option value="month">Next month</option>
64
+   </select>
65
+  </div>
66
+  <div class="searchrow">
67
+   <label for="status" style="vertical-align: top">Status: </label>
68
+   <select name="status" multiple="true" size="4">
69
+    <option value="open">Open</option>
70
+    <option value="assigned">Assigned</option>
71
+    <option value="closed">Closed</option>
72
+    <option value="reopened">Re-Opened</option>
73
+   </select>
74
+
75
+   <label for="priority" style="vertical-align: top">Priority: </label>
76
+   <select name="priority" multiple="true" size="4">
77
+    <option value="urgent">Urgent</option>
78
+    <option value="high">High</option>
79
+    <option value="normal">Normal</option>
80
+    <option value="low">Low</option>
81
+   </select>
82
+
83
+   <label for="categories" style="vertical-align: top">Category: </label>
84
+   <select name="categories" multiple="true" size="4">
85
+    <option value="all">All</option>
86
+    <?php
87
+      foreach($categories as $id => $name) {
88
+        echo '<option value="'.$id.'">'.$name.'</option>'."\r\n";
89
+      }
90
+    ?>
91
+   </select>
92
+
93
+   <label for="order" style="vertical-align: top">Order: </label>
94
+   <select name="order" size="4">
95
+    <option value="added">Added</option>
96
+    <option value="updated">Updated</option>
97
+    <option value="status">Status</option>
98
+    <option value="priority">Priority</option>
99
+    <option value="category">Category</option>
100
+    <option value="deadline">Deadline</option>
101
+    <option value="title">Title</option>
102
+   </select>
103
+  </div>
104
+  <div class="searchrow">
105
+   <label for="limit">Limit: </label>
106
+   <input type="text" name="limit" value="" />
107
+  </div>
108
+  <div class="searchrow">
109
+   <input type="submit" name="add" value="Add">
110
+  </div>
111
+ </form>
112
+ </div>
113
+</div>

+ 40
- 0
admin-www/issues/pages/deletecategory.php View File

@@ -0,0 +1,40 @@
1
+<?php
2
+if ($data[0] == 0) {
3
+  ?>
4
+  <div class="block">
5
+   <h2>Delete Category :: Confirmation</h2>
6
+   <div class="innerblock">
7
+    Are you sure you want to delete category #<?php echo $data['icat_id']; ?> (<?php echo $data['icat_name']; ?>)?
8
+    <form action="<?php $_SERVER['REQUEST_URI']; ?>" method="post"><input type="submit" name="confirm" value="Yes" /></form>
9
+   </div>
10
+  </div>
11
+  <?php
12
+} else {
13
+?>
14
+<div class="block">
15
+ <h2>Unable to delete category</h2>
16
+ <div class="innerblock bottomdiv">
17
+  You cannot delete a category which has active issues, please alter the issues below before proceeding.
18
+ </div>
19
+ <table class="innerblock">
20
+  <tr>
21
+   <th>ID</th><th>Title</th><th>Actions</th>
22
+  </tr>
23
+   <?php
24
+   $i = -1;
25
+   while($data = mysql_fetch_assoc($res)) {
26
+     $i++;
27
+    ?>
28
+    <tr <?php echo ($i % 2 == 0 ? 'class="even"':'class="odd"'); ?>>
29
+     <td><?php echo $data['i_id']; ?></td>
30
+     <td><?php echo $data['i_title']; ?></td>
31
+     <td><a href="<?php echo CP_PATH.'editissue/'.$data['i_id']; ?>" title="Edit">Edit</a> | <a href="<?php echo CP_PATH.'deleteissue/'.$data['i_id']; ?>" title="Delete">Delete</a></td>
32
+    </tr>
33
+    <?php
34
+   }
35
+   ?>
36
+ </table>
37
+</div>
38
+<?php
39
+}
40
+?>

+ 12
- 0
admin-www/issues/pages/deleteissue.php View File

@@ -0,0 +1,12 @@
1
+<div class="block">
2
+ <h2>Delete Issue :: Confirmation</h2>
3
+ <table class="innerblock righthead bottomdiv">
4
+  <tr><th>Title</th><td><?php echo $viewIssueData['i_title']; ?></td></tr>
5
+  <tr><th># Replies</th><td><?php echo $viewIssueRepliesData['0']; ?></td></tr>
6
+  <tr><th># Changes</th><td><?php echo $viewIssueChangesData['0']; ?></td></tr>
7
+ </table>
8
+ <div class="innerblock">
9
+  Are you sure you want to delete issue #<?php echo $viewIssueData['i_id']; ?>?
10
+  <form action="<?php $_SERVER['REQUEST_URI']; ?>" method="post"><input type="submit" name="confirm" value="Yes" /></form>
11
+ </div>
12
+</div>

+ 0
- 0
admin-www/issues/pages/deletesearch.php View File


+ 21
- 0
admin-www/issues/pages/editcategory.php View File

@@ -0,0 +1,21 @@
1
+<div class="block">
2
+ <h2>Edit Category</h2>
3
+ <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
4
+ <table class="innerblock righthead">
5
+  <tr><th>Name</th><td><input type="text" name="name" value="<?php echo $data['icat_name']; ?>" size="50" /></td></tr>
6
+  <tr><th>Auto-Assignee</th><td>
7
+    <select name="assignee">
8
+     <option value="0">(None)</option>
9
+     <?php
10
+       foreach($admins as $id => $username) {
11
+         echo '<option value="'.$id.'"'.(($data['icat_assign'] == $id) ? ' selected="true"' : '').'>'.$username.'</option>'."\r\n";
12
+       }
13
+     ?>
14
+    </select>
15
+   </td></tr>
16
+  <tr><th>Actions</th><td>
17
+   <input type="submit" name="submit" value="Submit" />&nbsp;<input type="reset" value="Reset" />
18
+  </td></tr>
19
+ </table>
20
+ </form>
21
+</div>

+ 61
- 0
admin-www/issues/pages/editissue.php View File

@@ -0,0 +1,61 @@
1
+<div class="block">
2
+ <h2>Edit Issue</h2>
3
+ <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
4
+  <table class="innerblock righthead">
5
+   <tr><th>Title</th><td><input type="text" name="title" value="<?php echo h($viewIssueData['i_title']); ?>" size="50" /></td></tr>
6
+   <tr><th>Category</th><td>
7
+    <select name="category" size="1">
8
+     <?php
9
+       foreach($categories as $id => $name) {
10
+         echo '<option value="'.$id.'"'.(($viewIssueData['icat_name'] == $name) ? ' selected="true"' : '').'>'.$name.'</option>'."\r\n";
11
+       }
12
+     ?>
13
+   </td></tr>
14
+   <tr><th>Status</th><td>
15
+    <select name="status" size="1">
16
+     <option value="open"<?php echo (($viewIssueData['i_status'] == 'open') ? ' selected="true"': '');?>>Open</option>
17
+     <option value="assigned"<?php echo (($viewIssueData['i_status'] == 'assigned') ? ' selected="true"': '');?>>Assigned</option>
18
+     <option value="closed"<?php echo (($viewIssueData['i_status'] == 'closed') ? ' selected="true"': '');?>>Closed</option>
19
+     <option value="reopened"<?php echo (($viewIssueData['i_status'] == 'reopened') ? ' selected="true"': '');?>>Re-Open</option>
20
+    </select>
21
+   </td></tr>
22
+   <tr><th>Assignee</th><td>
23
+    <select name="assignee">
24
+     <option value="">(None)</option>
25
+     <?php
26
+       foreach($admins as $id => $username) {
27
+         echo '<option value="'.$id.'"'.(($viewIssueData['i_assignee'] == $username) ? ' selected="true"' : '').'>'.$username.'</option>'."\r\n";
28
+       }
29
+     ?>
30
+    </select>
31
+   </td></tr>
32
+   <tr><th>Priority</th><td>
33
+    <select name="priority" size="1">
34
+     <option value="urgent"<?php echo (($viewIssueData['i_priority'] == 'urgent') ? ' selected="true"': '');?>>Urgent</option>
35
+     <option value="high"<?php echo (($viewIssueData['i_priority'] == 'high') ? ' selected="true"': '');?>>High</option>
36
+     <option value="normal"<?php echo (($viewIssueData['i_priority'] == 'normal') ? ' selected="true"': '');?>>Normal</option>
37
+     <option value="low"<?php echo (($viewIssueData['i_priority'] == 'low') ? ' selected="true"': '');?>>Low</option>
38
+    </select>
39
+   </td></tr>
40
+   <tr>
41
+    <th>Extensiveness</th>
42
+    <td>
43
+     <select name="extensiveness" size="1">
44
+      <option name="extensive"<?php echo (($viewIssueData['i_extensiveness'] == 'extensive') ? ' selected="true"': '');?>>Extensive</option>
45
+      <option name="normal"<?php echo (($viewIssueData['i_extensiveness'] == 'normal') ? ' selected="true"': '');?>>Normal</option>
46
+      <option name="trivial"<?php echo (($viewIssueData['i_extensiveness'] == 'trivial') ? ' selected="true"': '');?>>Trivial</option>
47
+     </select>
48
+    </td>
49
+   </tr>
50
+   <tr><th>Deadline</th><td>
51
+    <input type="text" name="deadline" size="50" value="<?php echo date('Y-m-d H:i:s', $viewIssueData['i_deadline']);?>"/>
52
+   </td></tr>
53
+   <tr><th>Notes</th><td>
54
+    <textarea name="text" cols="45" rows="10"><?php echo htmlentities($viewIssueData['i_text']); ?></textarea>
55
+   </td></tr>
56
+   <tr><th>Actions</th><td>
57
+    <input type="submit" name="submit" value="Submit" />&nbsp;<input type="reset" value="Reset" />
58
+   </td></tr>
59
+  </table>
60
+ </form>
61
+</div>

+ 113
- 0
admin-www/issues/pages/editsearch.php View File

@@ -0,0 +1,113 @@
1
+<div class="block">
2
+ <h2>Search Options</h2>
3
+ <div class="innerblock">
4
+ <form action="<?php $_SERVER['REQUEST_URI']; ?>" method="post">
5
+  <div class="searchrow">
6
+   <label for="name">Title: </label>
7
+   <input type="text" name="title" value="<?php echo $search['title']; ?>" />
8
+  </div>
9
+  <div class="searchrow">
10
+   <label for="keywords">Keywords:</label>
11
+   <input type="text" name="keywords" class="search" value="<?php echo $search['keywords']?>">
12
+
13
+   <label for="keywordloc">Search in:</label>
14
+   <select name="keywordloc">
15
+    <option value="both"<?php echo (($search['keywordloc'] == 'both') ? ' selected="true"' : '' )?>>Titles And Notes</option>
16
+    <option value="title"<?php echo (($search['keywordloc'] == 'title') ? ' selected="true"' : '' )?>>Titles</option>
17
+    <option value="notes"<?php echo (($search['keywordloc'] == 'notes') ? ' selected="true"' : '' )?>>Notes</option>
18
+   </select>
19
+  </div>
20
+  <div class="searchrow">
21
+   <label for="submitter">Submitter:</label>
22
+   <select name="submitter">
23
+    <option value="any"<?php echo (($search['submitter'] == 'any') ? ' selected="true"' : '' )?>>Any</option>
24
+    <?php
25
+      foreach($admins as $id => $username) {
26
+        echo '<option value="'.$id.'"'.(($search['submitter'] == $id) ? ' selected="true"' : '' ).'>'.$username.'</option>'."\r\n";
27
+      }
28
+    ?>
29
+   </select>
30
+
31
+   <label for="assignee">Assignee:</label>
32
+   <select name="assignee">
33
+    <option value="any"<?php echo (($search['assignee'] == 'any') ? ' selected="true"' : '' )?>>Any</option>
34
+    <?php
35
+      foreach($admins as $id => $username) {
36
+        echo '<option value="'.$id.'"'.(($search['assignee'] == $id) ? ' selected="true"' : '' ).'>'.$username.'</option>'."\r\n";
37
+      }
38
+    ?>
39
+   </select>
40
+  </div>
41
+  <div class="searchrow">
42
+   <label for="added">Added:</label>
43
+   <select name="added">
44
+    <option value="any"<?php echo (($search['added'] == 'any') ? ' selected="true"' : '' )?>>Any time</option>
45
+    <option value="day"<?php echo (($search['added'] == 'day') ? ' selected="true"' : '' )?>>Past day</option>
46
+    <option value="week"<?php echo (($search['added'] == 'week') ? ' selected="true"' : '' )?>>Past week</option>
47
+    <option value="month"<?php echo (($search['added'] == 'month') ? ' selected="true"' : '' )?>>Past month</option>
48
+   </select>
49
+
50
+   <label for="updated">Updated:</label>
51
+   <select name="updated">
52
+    <option value="any"<?php echo (($search['updated'] == 'any') ? ' selected="true"' : '' )?>>Any time</option>
53
+    <option value="day"<?php echo (($search['updated'] == 'day') ? ' selected="true"' : '' )?>>Past day</option>
54
+    <option value="week"<?php echo (($search['updated'] == 'week') ? ' selected="true"' : '' )?>>Past week</option>
55
+    <option value="month"<?php echo (($search['updated'] == 'month') ? ' selected="true"' : '' )?>>Past month</option>
56
+   </select>
57
+
58
+   <label for="deadline">Deadline:</label>
59
+   <select name="deadline">
60
+    <option value="any"<?php echo (($search['deadline'] == 'any') ? ' selected="true"' : '' )?>>Any time</option>
61
+    <option value="day"<?php echo (($search['deadline'] == 'day') ? ' selected="true"' : '' )?>>Tomorrow</option>
62
+    <option value="week"<?php echo (($search['deadline'] == 'week') ? ' selected="true"' : '' )?>>Next week</option>
63
+    <option value="month"<?php echo (($search['deadline'] == 'month') ? ' selected="true"' : '' )?>>Next month</option>
64
+   </select>
65
+  </div>
66
+  <div class="searchrow">
67
+   <label for="status" style="vertical-align: top">Status: </label>
68
+   <select name="status" multiple="true" size="4">
69
+    <option value="open"<?php echo ((in_array('open', $search['status'])) ? ' selected="true"' : '' )?>>Open</option>
70
+    <option value="assigned"<?php echo ((in_array('assigned', $search['status'])) ? ' selected="true"' : '' )?>>Assigned</option>
71
+    <option value="closed"<?php echo ((in_array('closed', $search['status'])) ? ' selected="true"' : '' )?>>Closed</option>
72
+    <option value="reopened"<?php echo ((in_array('reopened', $search['status'])) ? ' selected="true"' : '' )?>>Re-Opened</option>
73
+   </select>
74
+
75
+   <label for="priority" style="vertical-align: top">Priority: </label>
76
+   <select name="priority" multiple="true" size="4">
77
+    <option value="urgent"<?php echo ((in_array('urgent', $search['priority'])) ? ' selected="true"' : '' )?>>Urgent</option>
78
+    <option value="high"<?php echo ((in_array('high', $search['priority'])) ? ' selected="true"' : '' )?>>High</option>
79
+    <option value="normal"<?php echo ((in_array('normal', $search['priority'])) ? ' selected="true"' : '' )?>>Normal</option>
80
+    <option value="low"<?php echo ((in_array('low', $search['priority'])) ? ' selected="true"' : '' )?>>Low</option>
81
+   </select>
82
+
83
+   <label for="categories" style="vertical-align: top">Category: </label>
84
+   <select name="categories" multiple="true" size="4">
85
+    <option value="any"<?php echo (($search['categories'] == 'all') ? ' selected="true"' : '' )?>>All</option>
86
+    <?php
87
+      foreach($categories as $id => $name) {
88
+        echo '<option value="'.$id.'"'.((in_array($id, $search['categories'])) ? ' selected="true"' : '' ).'>'.$name.'</option>'."\r\n";
89
+      }
90
+    ?>
91
+   </select>
92
+
93
+   <label for="order" style="vertical-align: top">Order: </label>
94
+   <select name="order" size="4">
95
+    <option value="added"<?php echo (($search['order'] == 'added') ? ' selected="true"' : '' )?>>Added</option>
96
+    <option value="updated"<?php echo (($search['order'] == 'updated') ? ' selected="true"' : '' )?>>Updated</option>
97
+    <option value="status"<?php echo (($search['order'] == 'status') ? ' selected="true"' : '' )?>>Status</option>
98
+    <option value="priority"<?php echo (($search['order'] == 'priority') ? ' selected="true"' : '' )?>>Priority</option>
99
+    <option value="category"<?php echo (($search['order'] == 'category') ? ' selected="true"' : '' )?>>Category</option>
100
+    <option value="deadline"<?php echo (($search['order'] == 'deadline') ? ' selected="true"' : '' )?>>Deadline</option>
101
+    <option value="title"<?php echo (($search['order'] == 'title') ? ' selected="true"' : '' )?>>Title</option>
102
+   </select>
103
+  </div>
104
+  <div class="searchrow">
105
+   <label for="limit">Limit: </label>
106
+   <input type="text" name="limit" value="<?php echo $search['limit']?>" />
107
+  </div>
108
+  <div class="searchrow">
109
+   <input type="submit" name="edit" value="Edit">
110
+  </div>
111
+ </form>
112
+ </div>
113
+</div>

+ 35
- 0
admin-www/issues/pages/listsearch.php View File

@@ -0,0 +1,35 @@
1
+<div class="block">
2
+ <h2>Your saved searches</h2>
3
+ <table class="innerblock">
4
+  <tr><th>Name</th><th>Actions</th></tr>
5
+  <?php
6
+   if (count($savedsearches) == 0) {
7
+    echo '<tr><td style="text-align: center; font-style: italic;" colspan="3">No Results Found</td></tr>';
8
+   } else {
9
+    foreach($savedsearches as $search) {
10
+     echo '<tr><td><a href="'.CP_PATH.'search/'.$search['isea_id'].'" title="'.$search['isea_name'].'">'.$search['isea_name'].'</a></td>
11
+           <td><a href="'.CP_PATH.'searches/edit/'.$search['isea_id'].'" title="Edit">Edit</a> |
12
+           <a href="'.CP_PATH.'searches/delete/'.$search['isea_id'].'" title="Delete">Delete</a></td></tr>';
13
+    }
14
+   }
15
+  ?>
16
+ </table>
17
+</div>
18
+
19
+<div class="block">
20
+ <h2>Global saved searches</h2>
21
+ <table class="innerblock">
22
+  <tr><th>Name</th><th>Actions</th></tr>
23
+  <?php
24
+   if (count($globalsavedsearches) == 0) {
25
+    echo '<tr><td style="text-align: center; font-style: italic;" colspan="3">No Results Found</td></tr>';
26
+   } else {
27
+    foreach($globalsavedsearches as $search) {
28
+     echo '<tr><td><a href="'.CP_PATH.'search/'.$search['isea_id'].'" title="'.$search['isea_name'].'">'.$search['isea_name'].'</a></td>
29
+           <td><a href="'.CP_PATH.'searches/edit/'.$search['isea_id'].'" title="Edit">Edit</a> |
30
+           <a href="'.CP_PATH.'searches/delete/'.$search['isea_id'].'" title="Delete">Delete</a></td></tr>';
31
+    }
32
+   }
33
+  ?>
34
+ </table>
35
+</div>

+ 114
- 0
admin-www/issues/pages/searchform.php View File

@@ -0,0 +1,114 @@
1
+<?php
2
+//unset($search['search']);
3
+//echo serialize($search);
4
+?>
5
+<div class="block">
6
+ <h2>Search Options</h2>
7
+ <div class="innerblock">
8
+ <form action="<?php $_SERVER['REQUEST_URI']; ?>" method="post">
9
+  <div class="searchrow">
10
+   <label for="keywords">Keywords:</label>
11
+   <input type="text" name="keywords" class="search" value="<?php echo $search['keywords']?>">
12
+
13
+   <label for="keywordloc">Search in:</label>
14
+   <select name="keywordloc">
15
+    <option value="both"<?php echo (($search['keywordloc'] == 'both') ? ' selected="true"' : '' )?>>Titles And Notes</option>
16
+    <option value="title"<?php echo (($search['keywordloc'] == 'title') ? ' selected="true"' : '' )?>>Titles</option>
17
+    <option value="notes"<?php echo (($search['keywordloc'] == 'notes') ? ' selected="true"' : '' )?>>Notes</option>
18
+   </select>
19
+  </div>
20
+  <div class="searchrow">
21
+   <label for="submitter">Submitter:</label>
22
+   <select name="submitter">
23
+    <option value="any"<?php echo (($search['submitter'] == 'any') ? ' selected="true"' : '' )?>>Any</option>
24
+    <?php
25
+      foreach($admins as $id => $username) {
26
+        echo '<option value="'.$id.'"'.(($search['submitter'] == $id) ? ' selected="true"' : '' ).'>'.$username.'</option>'."\r\n";
27
+      }
28
+    ?>
29
+   </select>
30
+
31
+   <label for="assignee">Assignee:</label>
32
+   <select name="assignee">
33
+    <option value="any"<?php echo (($search['assignee'] == 'any') ? ' selected="true"' : '' )?>>Any</option>
34
+    <?php
35
+      foreach($admins as $id => $username) {
36
+        echo '<option value="'.$id.'"'.(($search['assignee'] == $id) ? ' selected="true"' : '' ).'>'.$username.'</option>'."\r\n";
37
+      }
38
+    ?>
39
+   </select>
40
+  </div>
41
+  <div class="searchrow">
42
+   <label for="added">Added:</label>
43
+   <select name="added">
44
+    <option value="any"<?php echo (($search['added'] == 'any') ? ' selected="true"' : '' )?>>Any time</option>
45
+    <option value="day"<?php echo (($search['added'] == 'day') ? ' selected="true"' : '' )?>>Past day</option>
46
+    <option value="week"<?php echo (($search['added'] == 'week') ? ' selected="true"' : '' )?>>Past week</option>
47
+    <option value="month"<?php echo (($search['added'] == 'month') ? ' selected="true"' : '' )?>>Past month</option>
48
+   </select>
49
+
50
+   <label for="updated">Updated:</label>
51
+   <select name="updated">
52
+    <option value="any"<?php echo (($search['updated'] == 'any') ? ' selected="true"' : '' )?>>Any time</option>
53
+    <option value="day"<?php echo (($search['updated'] == 'day') ? ' selected="true"' : '' )?>>Past day</option>
54
+    <option value="week"<?php echo (($search['updated'] == 'week') ? ' selected="true"' : '' )?>>Past week</option>
55
+    <option value="month"<?php echo (($search['updated'] == 'month') ? ' selected="true"' : '' )?>>Past month</option>
56
+   </select>
57
+
58
+   <label for="deadline">Deadline:</label>
59
+   <select name="deadline">
60
+    <option value="any"<?php echo (($search['deadline'] == 'any') ? ' selected="true"' : '' )?>>Any time</option>
61
+    <option value="day"<?php echo (($search['deadline'] == 'day') ? ' selected="true"' : '' )?>>Tomorrow</option>
62
+    <option value="week"<?php echo (($search['deadline'] == 'week') ? ' selected="true"' : '' )?>>Next week</option>
63
+    <option value="month"<?php echo (($search['deadline'] == 'month') ? ' selected="true"' : '' )?>>Next month</option>
64
+   </select>
65
+  </div>
66
+  <div class="searchrow">
67
+   <label for="status" style="vertical-align: top">Status: </label>
68
+   <select name="status" multiple="true" size="4">
69
+    <option value="open"<?php echo ((in_array('open', $search['status'])) ? ' selected="true"' : '' )?>>Open</option>
70
+    <option value="assigned"<?php echo ((in_array('assigned', $search['status'])) ? ' selected="true"' : '' )?>>Assigned</option>
71
+    <option value="closed"<?php echo ((in_array('closed', $search['status'])) ? ' selected="true"' : '' )?>>Closed</option>
72
+    <option value="reopened"<?php echo ((in_array('reopened', $search['status'])) ? ' selected="true"' : '' )?>>Re-Opened</option>
73
+   </select>
74
+
75
+   <label for="priority" style="vertical-align: top">Priority: </label>
76
+   <select name="priority" multiple="true" size="4">
77
+    <option value="urgent"<?php echo ((in_array('urgent', $search['priority'])) ? ' selected="true"' : '' )?>>Urgent</option>
78
+    <option value="high"<?php echo ((in_array('high', $search['priority'])) ? ' selected="true"' : '' )?>>High</option>
79
+    <option value="normal"<?php echo ((in_array('normal', $search['priority'])) ? ' selected="true"' : '' )?>>Normal</option>
80
+    <option value="low"<?php echo ((in_array('low', $search['priority'])) ? ' selected="true"' : '' )?>>Low</option>
81
+   </select>
82
+
83
+   <label for="categories" style="vertical-align: top">Category: </label>
84
+   <select name="categories" multiple="true" size="4">
85
+    <?php
86
+      foreach($categories as $id => $name) {
87
+        echo '<option value="'.$id.'"'.((in_array($id, $search['categories'])) ? ' selected="true"' : '' ).'>'.$name.'</option>'."\r\n";
88
+      }
89
+    ?>
90
+   </select>
91
+
92
+   <label for="order" style="vertical-align: top">Order: </label>
93
+   <select name="order" size="4">
94
+    <option value="added"<?php echo (($search['order'] == 'added') ? ' selected="true"' : '' )?>>Added</option>
95
+    <option value="addeddesc"<?php echo (($search['order'] == 'addeddesc') ? ' selected="true"' : '' )?>>Added Desc</option>
96
+    <option value="updated"<?php echo (($search['order'] == 'updated') ? ' selected="true"' : '' )?>>Updated</option>
97
+    <option value="updateddesc"<?php echo (($search['order'] == 'updateddesc') ? ' selected="true"' : '' )?>>Updated Desc</option>
98
+    <option value="status"<?php echo (($search['order'] == 'status') ? ' selected="true"' : '' )?>>Status</option>
99
+    <option value="priority"<?php echo (($search['order'] == 'priority') ? ' selected="true"' : '' )?>>Priority</option>
100
+    <option value="category"<?php echo (($search['order'] == 'category') ? ' selected="true"' : '' )?>>Category</option>
101
+    <option value="deadline"<?php echo (($search['order'] == 'deadline') ? ' selected="true"' : '' )?>>Deadline</option>
102
+    <option value="title"<?php echo (($search['order'] == 'title') ? ' selected="true"' : '' )?>>Title</option>
103
+   </select>
104
+  </div>
105
+  <div class="searchrow">
106
+   <label for="limit">Limit: </label>
107
+   <input type="text" name="limit" value="<?php echo $search['limit']?>" />
108
+  </div>
109
+  <div class="searchrow">
110
+   <input type="submit" name="search" value="Search">
111
+  </div>
112
+ </form>
113
+ </div>
114
+</div>

+ 173
- 0
admin-www/issues/pages/searchresults.php View File

@@ -0,0 +1,173 @@
1
+<?PHP
2
+
3
+ $sqlSelect  = 'SELECT i.i_id, c.icat_name, i.i_title, i.i_status, u1.user_name AS i_assignee,
4
+ u2.user_name AS i_submitter, i.i_priority, i.i_added, i.i_deadline, i.i_updated
5
+ FROM issues_issues AS i
6
+ LEFT JOIN issues_categories AS c ON i.icat_id = c.icat_id
7
+ LEFT JOIN users AS u1 ON i.i_assignee = u1.user_id
8
+ LEFT JOIN users AS u2 ON i.i_submitter = u2.user_id
9
+ WHERE 1';
10
+
11
+ $sqlCount = 'SELECT COUNT(*) FROM issues_issues AS i WHERE 1';
12
+
13
+ $sql = '';
14
+
15
+ //keywords
16
+ if (isset($search['keywords']) && !empty($search['keywords'])) {
17
+   switch ($search['keywordloc']) {
18
+   case 'title':
19
+    $target = 'i_title';
20
+    break;
21
+   case 'notes':
22
+    $target = 'i_text';
23
+    break;
24
+   default:
25
+    $target = 'CONCAT(i_title,i_text)';
26
+  }
27
+  $sql .= ' AND '.$target.' LIKE \'%'.m($search['keywords']).'%\'';
28
+ }
29
+
30
+ //submitter
31
+ if ($search['submitter'] != 'any' && !empty($search['submitter'])) {
32
+  $sql .= ' AND i_submitter = \''.m($search['submitter']).'\'';
33
+ }
34
+
35
+ //assignee
36
+ if ($search['assignee'] != 'any' && !empty($search['assignee'])) {
37
+  $sql .= ' AND i_assignee = \''.m($search['assignee']).'\'';
38
+ }
39
+
40
+ //added
41
+ if ($search['added'] != 'any' && !empty($search['added'])) {
42
+  $sql .= ' AND i_added > '.strtotime('-1 '.$search['added']);
43
+ }
44
+
45
+ //updated
46
+ if ($search['updated'] != 'any' && !empty($search['updated'])) {
47
+  $sql .= ' AND i_updated > '.strtotime('-1 '.$search['updated']);
48
+ }
49
+
50
+ //deadline
51
+ if ($search['deadline'] != 'any' && !empty($search['deadline'])) {
52
+  $sql .= ' AND i_deadline < '.strtotime('+1 '.$search['deadline']);
53
+ }
54
+
55
+ //priority
56
+ $sql .= ' AND (0';
57
+ foreach ($search['priority'] as $k => $v) {
58
+   $sql .= ' OR i_priority = \''.m($v).'\'';
59
+ }
60
+ $sql .= ')';
61
+
62
+ //status
63
+ $sql .= ' AND (0';
64
+ foreach ($search['status'] as $k => $v) {
65
+   $sql .= ' OR i_status = \''.m($v).'\'';
66
+ }
67
+ $sql .= ')';
68
+
69
+ //categories
70
+ $sql .= ' AND (0';
71
+ foreach ($search['categories'] as $k => $v) {
72
+   $sql .= ' OR i.icat_id = '.m($v);
73
+ }
74
+ $sql .= ')';
75
+
76
+ //order
77
+ if (isset($search['order']) && !empty($search['order'])) {
78
+   switch ($search['order']) {
79
+   case 'added':
80
+    $order = 'i_added';
81
+    break;
82
+   case 'addeddesc':
83
+    $order = 'i_added DESC';
84
+    break;
85
+   case 'updated':
86
+    $order = 'i_updated';
87
+    break;
88
+   case 'updateddesc':
89
+    $order = 'i_updated DESC';
90
+    break;
91
+   case 'status':
92
+    $order = 'i_status';
93
+    break;
94
+   case 'priority':
95
+    $order = 'i_priority';
96
+    break;
97
+   case 'category':
98
+    $order = 'i_category';
99
+    break;
100
+   case 'dealine':
101
+    $order = 'i_deadline';
102
+    break;
103
+   case 'status':
104
+    $order = 'i_status';
105
+    break;
106
+   default:
107
+    $order = 'i_added';
108
+  }
109
+  $sql .= ' ORDER BY '.m($order);
110
+ }
111
+
112
+ //limit
113
+ if (ctype_digit(''.$search['limit'])) {
114
+  if ($search['limit'] > 0) {
115
+   $sql .= ' LIMIT 0,'.m($search['limit']);
116
+  }
117
+ }
118
+
119
+ $res = mysql_query($sqlSelect.$sql) or print(mysql_error().'<hr>'.$sqlSelect.$sql);
120
+ $res2 = mysql_query($sqlCount.$sql) or print(mysql_error().'<hr>'.$sqlCount.$sql);
121
+ $data2 = mysql_fetch_array($res2);
122
+?>
123
+<div class="block">
124
+ <h2><?php echo ((isset($search['title'])) ? $search['title'] : 'Search Results'); ?></h2>
125
+ <table class="innerblock">
126
+  <tr>
127
+   <th>ID</th>
128
+   <th>Category</th>
129
+   <th>Title</th>
130
+   <th>Status</th>
131
+   <th>Priority</th>
132
+   <th>Submitter</th>
133
+   <th>Assignee</th>
134
+   <th>Updated</th>
135
+   <th>Deadline</th>
136
+  </tr>
137
+<?PHP
138
+ $i = 0;
139
+ if (isset($res) && mysql_num_rows($res) == 0) {
140
+  echo '<tr><td colspan="10" style="text-align: center; font-style: italic;">';
141
+  echo 'No results returned</td></tr>';
142
+ } else {
143
+  while ($row = mysql_fetch_assoc($res)) {
144
+   $i = 1 - $i;
145
+   ?>
146
+   <tr class="<?PHP echo ($i == 1) ? 'even' : 'odd'; ?>">
147
+    <td><a href="<?PHP echo CP_PATH.'viewissue/'.$row['i_id']; ?>"><?PHP echo $row['i_id']; ?></a></td>
148
+    <td><?PHP echo h($row['icat_name']); ?></td>
149
+    <td><?PHP echo h($row['i_title']); ?></td>
150
+    <td><?PHP echo h($row['i_status']); ?></td>
151
+    <td><?PHP echo h($row['i_priority']); ?></td>
152
+    <td><?PHP echo n($row['i_submitter']); ?></td>
153
+    <td><?PHP echo n($row['i_assignee']); ?></td>
154
+    <td><?PHP echo d('Y-m-d H:i',$row['i_updated']); ?></td>
155
+    <td>
156
+     <?PHP 
157
+      if ($row['i_deadline'] == 0) {
158
+       echo '<span style="text-style: italic">None</span>';
159
+      } elseif ($row['i_deadline'] - time() < 0) {
160
+       echo '<span style="color: red">Overdue</span>';
161
+      } else {
162
+       echo duration(time()-$row['i_deadline']);
163
+      } 
164
+     ?>
165
+    </td>
166
+   </tr>
167
+  <?PHP
168
+  }
169
+ }
170
+?>
171
+ </table>
172
+ <h2>Total Results (without limit): <?php echo $data2[0]; ?></h2>
173
+</div>

+ 157
- 0
admin-www/issues/pages/searchresults.php~ View File

@@ -0,0 +1,157 @@
1
+<?PHP
2
+
3
+ $sqlSelect  = 'SELECT i.i_id, c.icat_name, i.i_title, i.i_status, u1.user_name AS i_assignee,
4
+ u2.user_name AS i_submitter, i.i_priority, i.i_added, i.i_deadline, i.i_updated
5
+ FROM issues_issues AS i
6
+ LEFT JOIN issues_categories AS c ON i.icat_id = c.icat_id
7
+ LEFT JOIN users AS u1 ON i.i_assignee = u1.user_id
8
+ LEFT JOIN users AS u2 ON i.i_submitter = u2.user_id
9
+ WHERE 1';
10
+
11
+ $sqlCount = 'SELECT COUNT(*) FROM issues_issues AS i WHERE 1';
12
+
13
+ $sql = '';
14
+
15
+ //keywords
16
+ if (isset($search['keywords']) && !empty($search['keywords'])) {
17
+   switch ($search['keywordloc']) {
18
+   case 'title':
19
+    $target = 'i_title';
20
+    break;
21
+   case 'notes':
22
+    $target = 'i_text';
23
+    break;
24
+   default:
25
+    $target = 'CONCAT(i_title,i_text)';
26
+  }
27
+  $sql .= ' AND '.$target.' LIKE \'%'.m($search['keywords']).'%\'';
28
+ }
29
+
30
+ //submitter
31
+ if ($search['submitter'] != 'any' && !empty($search['submitter'])) {
32
+  $sql .= ' AND i_submitter = \''.m($search['submitter']).'\'';
33
+ }
34
+
35
+ //assignee
36
+ if ($search['assignee'] != 'any' && !empty($search['assignee'])) {
37
+  $sql .= ' AND i_assignee = \''.m($search['assignee']).'\'';
38
+ }
39
+
40
+ //added
41
+ if ($search['added'] != 'any' && !empty($search['added'])) {
42
+  $sql .= ' AND i_added > '.strtotime('-1 '.$search['added']);
43
+ }
44
+
45
+ //updated
46
+ if ($search['updated'] != 'any' && !empty($search['updated'])) {
47
+  $sql .= ' AND i_updated > '.strtotime('-1 '.$search['updated']);
48
+ }
49
+
50
+ //deadline
51
+ if ($search['deadline'] != 'any' && !empty($search['deadline'])) {
52
+  $sql .= ' AND i_deadline < '.strtotime('+1 '.$search['deadline']);
53
+ }
54
+
55
+ //priority
56
+ $sql .= ' AND (0';
57
+ foreach ($search['priority'] as $k => $v) {
58
+   $sql .= ' OR i_priority = \''.m($v).'\'';
59
+ }
60
+ $sql .= ')';
61
+
62
+ //status
63
+ $sql .= ' AND (0';
64
+ foreach ($search['status'] as $k => $v) {
65
+   $sql .= ' OR i_status = \''.m($v).'\'';
66
+ }
67
+ $sql .= ')';
68
+
69
+ //categories
70
+ $sql .= ' AND (0';
71
+ foreach ($search['categories'] as $k => $v) {
72
+   $sql .= ' OR i.icat_id = '.m($v);
73
+ }
74
+ $sql .= ')';
75
+
76
+ //order
77
+ if (isset($search['order']) && !empty($search['order'])) {
78
+   switch ($search['order']) {
79
+   case 'added':
80
+    $order = 'i_added';
81
+    break;
82
+   case 'updated':
83
+    $order = 'i_updated, i_added';
84
+    break;
85
+   case 'status':
86
+    $order = 'i_status';
87
+    break;
88
+   case 'priority':
89
+    $order = 'i_priority';
90
+    break;
91
+   case 'category':
92
+    $order = 'i_category';
93
+    break;
94
+   case 'dealine':
95
+    $order = 'i_deadline';
96
+    break;
97
+   case 'status':
98
+    $order = 'i_status';
99
+    break;
100
+   default:
101
+    $order = 'i_added';
102
+  }
103
+  $sql .= ' ORDER BY '.m($order);
104
+ }
105
+
106
+ //limit
107
+ if (ctype_digit(''.$search['limit'])) {
108
+  $sql .= ' LIMIT 0,'.m($search['limit']);
109
+ }
110
+
111
+ $res = mysql_query($sqlSelect.$sql) or print(mysql_error().'<hr>'.$sqlSelect.$sql);
112
+ $res2 = mysql_query($sqlCount.$sql) or print(mysql_error().'<hr>'.$sqlCount.$sql);
113
+ $data2 = mysql_fetch_array($res2);
114
+?>
115
+<div class="block">
116
+ <h2><?php echo ((isset($search['title'])) ? $search['title'] : 'Search Results'); ?></h2>
117
+ <table class="innerblock">
118
+  <tr>
119
+   <th>ID</th>
120
+   <th>Category</th>
121
+   <th>Title</th>
122
+   <th>Status</th>
123
+   <th>Priority</th>
124
+   <th>Submitter</th>
125
+   <th>Assignee</th>
126
+   <th>Added</th>
127
+   <th>Updated</th>
128
+   <th>Deadline</th>
129
+  </tr>
130
+<?PHP
131
+ $i = 0;
132
+ if (isset($res) && mysql_num_rows($res) == 0) {
133
+  echo '<tr><td colspan="10" style="text-align: center; font-style: italic;">';
134
+  echo 'No results returned</td></tr>';
135
+ } else {
136
+  while ($row = mysql_fetch_assoc($res)) {
137
+   $i = 1 - $i;
138
+   ?>
139
+   <tr class="<?PHP echo ($i == 1) ? 'even' : 'odd'; ?>">
140
+    <td><a href="<?PHP echo CP_PATH.'viewissue/'.$row['i_id']; ?>"><?PHP echo $row['i_id']; ?></a></td>
141
+    <td><?PHP echo h($row['icat_name']); ?></td>
142
+    <td><?PHP echo h($row['i_title']); ?></td>
143
+    <td><?PHP echo h($row['i_status']); ?></td>
144
+    <td><?PHP echo h($row['i_priority']); ?></td>
145
+    <td><?PHP echo n($row['i_submitter']); ?></td>
146
+    <td><?PHP echo n($row['i_assignee']); ?></td>
147
+    <td><?PHP echo d('Y-m-d H:i',$row['i_added']); ?></td>
148
+    <td><?PHP echo d('Y-m-d H:i',$row['i_updated']); ?></td>
149
+    <td><?PHP echo d('Y-m-d H:i',$row['i_deadline']); ?></td>
150
+   </tr>
151
+  <?PHP
152
+  }
153
+ }
154
+?>
155
+ </table>
156
+ <h2>Total Results: <?php echo $data2[0]; ?></h2>
157
+</div>

+ 160
- 0
admin-www/issues/pages/stats.php View File

@@ -0,0 +1,160 @@
1
+<div class="block">
2
+ <h2>User Statistics</h2>
3
+ <table class="innerblock stats">
4
+  <tr>
5
+   <th rowspan="2">User</th>
6
+   <th rowspan="2">Raised</th>
7
+   <th rowspan="2">Assigned</th>
8
+   <th colspan="5">Closed</th>
9
+   <th rowspan="2">Average Resolution Time</th>
10
+  </tr>
11
+  <tr>
12
+   <th>All time</th>
13
+   <th>Past year</th>
14
+   <th>Past month</th>
15
+   <th>Past week</th>
16
+   <th>Past day</th>
17
+  </tr>
18
+<?PHP
19
+
20
+ $admins = getAdmins();
21
+
22
+ $i = -1;
23
+ foreach ($admins as $id => $admin) {
24
+  $i++;
25
+  echo '<tr '.($i % 2 == 0 ? 'class="even"':'class="odd"').'>';
26
+  echo '<td>'.h($admin).'</td><td class="number">';
27
+  $sql = 'SELECT COUNT(*) FROM issues_issues WHERE i_submitter = \''.m(getUserID($admin))."'";
28
+  $res = mysql_query($sql); $row = mysql_fetch_array($res); echo $row[0];
29
+  echo '</td><td class="number">';
30
+  $sql = 'SELECT COUNT(*) FROM issues_issues WHERE i_status = \'assigned\' AND i_assignee = \''.m(getUserID($admin))."'";
31
+  $res = mysql_query($sql); $row = mysql_fetch_array($res); echo $row[0];
32
+  echo '</td><td class="number">';
33
+  $sql = 'SELECT COUNT(*) FROM issues_issues WHERE i_status = \'closed\' AND i_assignee = \''.m(getUserID($admin))."'";
34
+  $res = mysql_query($sql); $row = mysql_fetch_array($res); echo $row[0];
35
+  echo '</td><td class="number">';
36
+  $sql = 'SELECT COUNT(*) FROM issues_issues WHERE i_status = \'closed\' AND i_assignee = \''.m(getUserID($admin))."' AND i_updated > ".strtotime('-1 year');
37
+  $res = mysql_query($sql); $row = mysql_fetch_array($res); echo $row[0];
38
+  echo '</td><td class="number">';
39
+  $sql = 'SELECT COUNT(*) FROM issues_issues WHERE i_status = \'closed\' AND i_assignee = \''.m(getUserID($admin))."' AND i_updated > ".strtotime('-1 month');
40
+  $res = mysql_query($sql); $row = mysql_fetch_array($res); echo $row[0];
41
+  echo '</td><td class="number">';
42
+  $sql = 'SELECT COUNT(*) FROM issues_issues WHERE i_status = \'closed\' AND i_assignee = \''.m(getUserID($admin))."' AND i_updated > ".strtotime('-1 week');
43
+  $res = mysql_query($sql); $row = mysql_fetch_array($res); echo $row[0];
44
+  echo '</td><td class="number">';
45
+  $sql = 'SELECT COUNT(*) FROM issues_issues WHERE i_status = \'closed\' AND i_assignee = \''.m(getUserID($admin))."' AND i_updated > ".strtotime('-1 day');
46
+  $res = mysql_query($sql); $row = mysql_fetch_array($res); echo $row[0];
47
+  echo '</td>';
48
+  echo '<td>';
49
+  $sql = 'SELECT AVG(i_updated - i_added) FROM issues_issues WHERE i_status = \'closed\' AND i_assignee = \''.m(getUserID($admin))."'";
50
+  $res = mysql_query($sql); $row = mysql_fetch_array($res); echo (($row[0] != 0) ? duration($row[0]) : 'None');
51
+  echo '</td></tr>';
52
+ }
53
+ $i++;
54
+
55
+  echo '<tr '.($i % 2 == 0 ? 'class="even"':'class="odd"').'>';
56
+  echo '<td>Total:</td><td class="number">';
57
+  $sql = 'SELECT COUNT(*) FROM issues_issues';
58
+  $res = mysql_query($sql); $row = mysql_fetch_array($res); echo $row[0];
59
+  echo '</td><td class="number">';
60
+  $sql = 'SELECT COUNT(*) FROM issues_issues WHERE i_status = \'assigned\'';
61
+  $res = mysql_query($sql); $row = mysql_fetch_array($res); echo $row[0];
62
+  echo '</td><td class="number">';
63
+  $sql = 'SELECT COUNT(*) FROM issues_issues WHERE i_status = \'closed\'';
64
+  $res = mysql_query($sql); $row = mysql_fetch_array($res); echo $row[0];
65
+  echo '</td><td class="number">';
66
+  $sql = 'SELECT COUNT(*) FROM issues_issues WHERE i_status = \'closed\' AND i_updated > '.strtotime('-1 year');
67
+  $res = mysql_query($sql); $row = mysql_fetch_array($res); echo $row[0];
68
+  echo '</td><td class="number">';
69
+  $sql = 'SELECT COUNT(*) FROM issues_issues WHERE i_status = \'closed\' AND i_updated > '.strtotime('-1 month');
70
+  $res = mysql_query($sql); $row = mysql_fetch_array($res); echo $row[0];
71
+  echo '</td><td class="number">';
72
+  $sql = 'SELECT COUNT(*) FROM issues_issues WHERE i_status = \'closed\' AND i_updated > '.strtotime('-1 week');
73
+  $res = mysql_query($sql); $row = mysql_fetch_array($res); echo $row[0];
74
+  echo '</td><td class="number">';
75
+  $sql = 'SELECT COUNT(*) FROM issues_issues WHERE i_status = \'closed\' AND i_updated > '.strtotime('-1 day');
76
+  $res = mysql_query($sql); $row = mysql_fetch_array($res); echo $row[0];
77
+  echo '</td><td>';
78
+  $sql = 'SELECT AVG(i_updated - i_added) FROM issues_issues WHERE i_status = \'closed\' AND i_assignee != 0';
79
+  $res = mysql_query($sql); $row = mysql_fetch_array($res); echo (($row[0] != 0) ? duration($row[0]) : 'None');
80
+  echo '</td></tr>';
81
+?>
82
+
83
+ </table>
84
+</div>
85
+
86
+<div class="block">
87
+ <h2>Category Statistics</h2>
88
+ <table class="innerblock stats">
89
+  <tr>
90
+   <th rowspan="2">Category</th>
91
+   <th rowspan="2">New</th>
92
+   <th rowspan="2">Assigned</th>
93
+   <th colspan="5">Closed</th>
94
+   <th rowspan="2">Average Resolution Time</th>
95
+  </tr>
96
+  <tr>
97
+   <th>All time</th>
98
+   <th>Past year</th>
99
+   <th>Past month</th>
100
+   <th>Past week</th>
101
+   <th>Past day</th>
102
+  </tr>
103
+<?PHP
104
+
105
+ $totals = array(0 => 0, 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0);
106
+
107
+ $categories  = getCategories();
108
+
109
+ $i = -1;
110
+ foreach ($categories as $id => $category) {
111
+  $i++;
112
+  echo '<tr '.($i % 2 == 0 ? 'class="even"':'class="odd"').'>';
113
+  echo '<td>'.h($category).'</td><td class="number">';
114
+  $sql = 'SELECT COUNT(*) FROM issues_issues WHERE (i_status = \'open\' OR i_status = \'reopened\') AND icat_id = \''.m($id)."'";
115
+  $res = mysql_query($sql); $row = mysql_fetch_array($res); echo $row[0];
116
+  $totals[0] += $row[0];
117
+  echo '</td><td class="number">';
118
+  $sql = 'SELECT COUNT(*) FROM issues_issues WHERE i_status = \'assigned\' AND icat_id = \''.m($id)."'";
119
+  $res = mysql_query($sql); $row = mysql_fetch_array($res); echo $row[0];
120
+  $totals[1] += $row[0];
121
+  echo '</td><td class="number">';
122
+  $sql = 'SELECT COUNT(*) FROM issues_issues WHERE i_status = \'closed\' AND icat_id = \''.m($id)."'";
123
+  $res = mysql_query($sql); $row = mysql_fetch_array($res); echo $row[0];
124
+  $totals[2] += $row[0];
125
+  echo '</td><td class="number">';
126
+  $sql = 'SELECT COUNT(*) FROM issues_issues WHERE i_status = \'closed\' AND icat_id = \''.m($id)."' AND i_updated > ".strtotime('-1 year');
127
+  $res = mysql_query($sql); $row = mysql_fetch_array($res); echo $row[0];
128
+  $totals[3] += $row[0];
129
+  echo '</td><td class="number">';
130
+  $sql = 'SELECT COUNT(*) FROM issues_issues WHERE i_status = \'closed\' AND icat_id = \''.m($id)."' AND i_updated > ".strtotime('-1 month');
131
+  $res = mysql_query($sql); $row = mysql_fetch_array($res); echo $row[0];
132
+  $totals[4] += $row[0];
133
+  echo '</td><td class="number">';
134
+  $sql = 'SELECT COUNT(*) FROM issues_issues WHERE i_status = \'closed\' AND icat_id = \''.m($id)."' AND i_updated > ".strtotime('-1 week');
135
+  $res = mysql_query($sql); $row = mysql_fetch_array($res); echo $row[0];
136
+  $totals[5] += $row[0];
137
+  echo '</td><td class="number">';
138
+  $sql = 'SELECT COUNT(*) FROM issues_issues WHERE i_status = \'closed\' AND icat_id = \''.m($id)."' AND i_updated > ".strtotime('-1 day');
139
+  $res = mysql_query($sql); $row = mysql_fetch_array($res); echo $row[0];
140
+  $totals[6] += $row[0];
141
+  echo '</td><td>';
142
+  $sql = 'SELECT AVG(i_updated - i_added) FROM issues_issues WHERE i_status = \'closed\' AND icat_id = \''.m($id).'\'';
143
+  $res = mysql_query($sql); $row = mysql_fetch_array($res); echo (($row[0] != 0) ? duration($row[0]) : 'None');
144
+  echo '</td></tr>';
145
+ }
146
+ $i++;
147
+
148
+?>
149
+  <tr <?php echo ($i % 2 == 0 ? 'class="even"':'class="odd"'); ?>><td>Total:</td>
150
+  <?PHP foreach ($totals as $v) { echo '<td class="number">'.$v.'</td>'; } ?>
151
+  <td>
152
+  <?php
153
+  $sql = 'SELECT AVG(i_updated - i_added) FROM issues_issues WHERE i_status = \'closed\'';
154
+  $res = mysql_query($sql); $row = mysql_fetch_array($res); echo (($row[0] != 0) ? duration($row[0]) : 'None');
155
+  ?>
156
+  </td>
157
+  </tr>
158
+ </table>
159
+ </div>
160
+

+ 31
- 0
admin-www/issues/pages/viewcategories.php View File

@@ -0,0 +1,31 @@
1
+<?php
2
+ if (count($categories) == 0) {
3
+  ?>
4
+  <div class="block">
5
+  <h2>Categories</h2>
6
+  <div class="innerblock" style="text-align: center; font-style: italic;">No Categories</div>
7
+  </div>
8
+  <?php
9
+  return;
10
+ }
11
+
12
+ echo '<div class="block nobottomdiv">';
13
+ echo '<h2>Categories</h2>';
14
+ echo '<table class="innerblock bottomdiv">';
15
+ echo '<tr>';
16
+ echo '<th>ID</th><th>Name</th><th>Auto Assign</th><th>Actions</th>';
17
+ echo '</tr>';
18
+ foreach($categories as $id => $category) {
19
+   ?>
20
+      <tr>
21
+       <td><?php echo h($id); ?></td>
22
+       <td><?php echo h($category['name']); ?></td>
23
+       <td><?php echo n((($category['assign'] == 0) ? 'None': getUserName($category['assign'])))?></td>
24
+       <td><a href="<?php echo CP_PATH.'editcategory/'.$id; ?>" title="Edit">Edit</a> | <a href="<?php echo CP_PATH.'deletecategory/'.$id; ?>" title="Delete">Delete</a></td>
25
+      </tr>
26
+
27
+   <?php
28
+ }
29
+ echo '</table>';
30
+ echo '</div>';
31
+?>

+ 63
- 0
admin-www/issues/pages/viewissue.php View File

@@ -0,0 +1,63 @@
1
+<div class="block">
2
+ <h2>Edit Issue</h2>
3
+  <table class="innerblock righthead bottomdiv">
4
+   <tr><th>ID</th><td><?php echo h($viewIssueData['i_id']); ?></td></tr>
5
+   <tr><th>Title</th><td><?php echo h($viewIssueData['i_title']); ?></td></tr>
6
+   <tr><th>Category</th><td><?php echo h($viewIssueData['icat_name']); ?></td></tr>
7
+   <tr><th>Status</th><td><?php echo h($viewIssueData['i_status']); ?></td></tr>
8
+   <tr><th>Submitter</th><td><?php echo n($viewIssueData['i_submitter']); ?></td></tr>
9
+   <tr><th>Assignee</th><td><?php echo n($viewIssueData['i_assignee']); ?></td></tr>
10
+   <tr><th>Priority</th><td><?php echo h($viewIssueData['i_priority']); ?></td></tr>
11
+   <tr><th>Extensiveness</th><td><?php echo h($viewIssueData['i_extensiveness']); ?></td></tr>
12
+   <tr><th>Added</th><td><?php echo d('Y-m-d H:i:s', $viewIssueData['i_added']) ?></td></tr>
13
+   <tr><th>Updated</th><td><?php echo d('Y-m-d H:i:s', $viewIssueData['i_updated']) ?></td></tr>
14
+   <tr><th>Deadline</th><td>
15
+    <?PHP
16
+     if ($viewIssueData['i_deadline'] == 0) {
17
+      echo '<span style="text-style: italic">None</span>';
18
+     } elseif ($viewIssueData['i_deadline'] - time() < 0) {
19
+      echo '<span style="color: red">Overdue by '.duration(time()-$viewIssueData['i_deadline']).'</span>';
20
+     } else {
21
+      echo duration(time()-$viewIssueData['i_deadline']);
22
+     }
23
+    ?>
24
+   </td></tr>
25
+  </table>
26
+  <div class="innerblock">
27
+   <?php echo nl2br(htmlentities($viewIssueData['i_text'])); ?>
28
+  </div>
29
+</div>
30
+
31
+<?php
32
+ if (count($issueReplies) == 0) {
33
+  ?>
34
+  <div class="block">
35
+  <h2>Replies</h2>
36
+  <div class="innerblock" style="text-align: center; font-style: italic;">No Replies</div>
37
+  </div>
38
+  <?php
39
+  return;
40
+ }
41
+
42
+ echo '<div class="block nobottomdiv">';
43
+ echo '<h2>Replies</h2>';
44
+ foreach($issueReplies as $id => $reply) {
45
+   ?>
46
+     <table class="innerblock righthead bottomdiv">
47
+      <tr>
48
+       <th>User</th><td><a href="#<?php echo $reply['irep_id']; ?>" /><?php echo $reply['irep_user']; ?></td>
49
+      </tr>
50
+      <tr>
51
+       <th>Time</th><td><?php echo date('Y-m-d H:i:s', $reply['irep_time']); ?></td>
52
+      </tr>
53
+      <tr>
54
+       <th>Actions</th><td><a href="<?php echo CP_PATH; ?>deletereply/<?php echo $id; ?>" title="Delete">Delete</a></td>
55
+      </tr>
56
+     </table>
57
+     <div class="innerblock bottomdiv">
58
+      <?PHP echo nl2br(htmlentities($reply['irep_text'])); ?>
59
+     </div>
60
+   <?php
61
+ }
62
+ echo '</div>';
63
+?>

+ 34
- 0
admin-www/issues/pages/viewlog.php View File

@@ -0,0 +1,34 @@
1
+<?php
2
+ if (count($issueChanges) == 0) {
3
+  ?>
4
+  <div class="block">
5
+  <h2>Changes</h2>
6
+  <div class="innerblock" style="text-align: center; font-style: italic;">No Changes</div>
7
+  </div>
8
+  <?php
9
+  return;
10
+ }
11
+
12
+ echo '<div class="block nobottomdiv">';
13
+ echo '<h2>Changes</h2>';
14
+ foreach($issueChanges as $id => $change) {
15
+   ?>
16
+     <table class="innerblock righthead bottomdiv">
17
+      <tr>
18
+       <th>ID</th><td><?php echo h($change['ilog_id']); ?></td>
19
+      </tr><tr>
20
+       <th>Time</th><td><?php echo d('Y-m-d H:m:s', $change['ilog_time']); ?></td>
21
+      </tr><tr>
22
+       <th>User</th><td><?php echo n($change['user_name']); ?></td>
23
+      </tr><tr>
24
+       <th>Field</th><td><?php echo h($change['ilog_field']); ?></td>
25
+      </tr><tr>
26
+       <th>Old Value</th><td><?php echo h($change['ilog_old']); ?></td>
27
+      </tr><tr>
28
+       <th>New Value</th><td><?php echo h($change['ilog_new']); ?></td>
29
+      </tr>
30
+     </table>
31
+   <?php
32
+ }
33
+ echo '</div>';
34
+?>

+ 12
- 0
admin-www/issues/res/commonDashboard.php View File

@@ -0,0 +1,12 @@
1
+<?php
2
+ $sql = 'SELECT isea_id, isea_name FROM issues_searches WHERE user_id = \'\'';
3
+ $searchesdashboard = mysql_query($sql);
4
+ while ($searchdatadashboard = mysql_fetch_assoc($searchesdashboard)) {
5
+  addDashboardItem('Searches', $searchdatadashboard['isea_name'] ,'search/'.$searchdatadashboard['isea_id']);
6
+ }
7
+ $sql = 'SELECT isea_id, isea_name FROM issues_searches WHERE user_id = \''.m(getUserID($_SERVER['REDIRECT_REMOTE_USER'])).'\'';
8
+ $searchesdashboard = mysql_query($sql);
9
+ while ($searchdatadashboard = mysql_fetch_assoc($searchesdashboard)) {
10
+  addDashboardItem('Saved Searches', $searchdatadashboard['isea_name'] ,'search/'.$searchdatadashboard['isea_id']);
11
+ }
12
+?>

BIN
admin-www/issues/res/high.png View File


BIN
admin-www/issues/res/logo.png View File


BIN
admin-www/issues/res/low.png View File


BIN
admin-www/issues/res/normal.png View File


+ 97
- 0
admin-www/issues/res/script.js View File

@@ -0,0 +1,97 @@
1
+function validateLoginForm () {
2
+  var error = false;
3
+  
4
+  document.getElementById('username').className = 'inflat';
5
+  document.getElementById('usernamevalid').innerHTML = '';
6
+  document.getElementById('password').className = 'inflat';
7
+  document.getElementById('passwordvalid').innerHTML = '';  
8
+  
9
+  if (document.forms.login.password.value.length < 4) {
10
+    error = true;
11
+    document.getElementById('password').className = 'inflaterr';
12
+    document.getElementById('passwordvalid').innerHTML = 'Passwords must be at least four characters long.';
13
+    document.getElementById('password').focus();
14
+  }
15
+  
16
+  if (document.forms.login.username.value.length < 2) {
17
+    error = true;
18
+    document.getElementById('username').className = 'inflaterr';
19
+    document.getElementById('usernamevalid').innerHTML = 'Usernames must be at least two characters long.';
20
+    document.getElementById('username').focus();
21
+  }
22
+  
23
+  return (error == false);
24
+}
25
+
26
+function validateSubdomainForm () {
27
+  var error = false;
28
+
29
+  document.getElementById('subdomain').className = 'inflat';
30
+  document.getElementById('subdomainerr').innerHTML = '';
31
+
32
+  if (document.forms.submd.subdomain.value.length == 0) {
33
+    error = true;
34
+    document.getElementById('subdomain').className = 'inflaterr';
35
+    document.getElementById('subdomainerr').innerHTML = 'You must enter a subdomain';
36
+    document.getElementById('subdomain').focus();
37
+  }
38
+
39
+  var valid = /^[a-z][a-z0-9\-]*$/i;
40
+  if (!valid.test(document.forms.submd.subdomain.value)) {
41
+    error = true;
42
+    document.getElementById('subdomain').className = 'inflaterr';
43
+    document.getElementById('subdomainerr').innerHTML = 'Invalid subdomain.';
44
+    document.getElementById('subdomain').focus();
45
+  }
46
+
47
+  return (error == false);
48
+}
49
+
50
+function validateDomainForm () {
51
+  var error = false;
52
+
53
+  document.getElementById('domain').className = 'inflat';
54
+  document.getElementById('domainerr').innerHTML = '';
55
+
56
+  if (document.forms.md.domain.value.length == 0) {
57
+    error = true;
58
+    document.getElementById('domain').className = 'inflaterr';
59
+    document.getElementById('domainerr').innerHTML = 'You must enter a domain';
60
+    document.getElementById('domain').focus();
61
+  }
62
+  
63
+  var valid = /^[a-z][a-z0-9\-\.]*\.[a-z]{2,}$/i
64
+  if (!valid.test(document.forms.md.domain.value)) {
65
+    error = true;
66
+    document.getElementById('domain').className = 'inflaterr';
67
+    document.getElementById('domainerr').innerHTML = 'Invalid domain.';
68
+    document.getElementById('domain').focus();
69
+  }
70
+
71
+  return (error == false);
72
+}
73
+
74
+function validateTicketForm () {
75
+  var error = false;
76
+  
77
+  document.getElementById('body').className = 'inflat';
78
+  document.getElementById('messagevalid').innerHTML = '';
79
+  document.getElementById('subject').className = 'inflat';
80
+  document.getElementById('subjectvalid').innerHTML = '';  
81
+  
82
+  if (document.forms.ticket.body.value.length < 10) {
83
+    error = true;
84
+    document.getElementById('body').className = 'inflaterr';
85
+    document.getElementById('messagevalid').innerHTML = 'Please enter a complete description of the problem.';
86
+    document.getElementById('body').focus();
87
+  }
88
+  
89
+  if (document.forms.ticket.subject.value.length < 5) {
90
+    error = true;
91
+    document.getElementById('subject').className = 'inflaterr';
92
+    document.getElementById('subjectvalid').innerHTML = 'Please enter a complete subject.';
93
+    document.getElementById('subject').focus();
94
+  }
95
+  
96
+  return (error == false);
97
+}

+ 254
- 0
admin-www/issues/res/style.css View File

@@ -0,0 +1,254 @@
1
+body {
2
+  font-family: Tahoma, Arial, Sans-serif;
3
+  font-size: small;
4
+  margin: 170px 3% 5px 5%;
5
+  padding: 0px;
6
+}
7
+
8
+div#header {
9
+  position: absolute;
10
+  top: 15px;
11
+  left: 3%;
12
+  margin: 0px;
13
+}
14
+
15
+div#header h1 {
16
+  margin: 0px;
17
+}
18
+
19
+div#menu {
20
+  border: 1px solid #AAA;
21
+  position: absolute;
22
+  top: 115px;
23
+  left: 3%;
24
+  width: 94%;
25
+  background-color: #EEE;
26
+  padding: 5px;
27
+}
28
+
29
+div#menu a {
30
+  color: black;
31
+  text-decoration: none;
32
+}
33
+
34
+div#menu a:hover {
35
+  text-decoration: underline;
36
+}
37
+
38
+div#menuleft, div#menuright {
39
+  display: inline;
40
+}
41
+
42
+div#menuright {
43
+  position: absolute;
44
+  right: 0px;
45
+  padding-right: 6px;
46
+  text-align: right;
47
+}
48
+
49
+div.block {
50
+  width: 70%;
51
+  border: 1px solid #666;
52
+  padding: 0px;
53
+  margin-bottom: 20px;
54
+}
55
+
56
+div.nobottomdiv {
57
+  border-bottom: 0;
58
+}
59
+
60
+div.block h2 {
61
+  margin: 0px;
62
+  background-color: #666;
63
+  font-size: 1em;
64
+  font-weight: bold;
65
+  padding: 3px 7px;
66
+  color: #F5F5F5;
67
+}
68
+
69
+div.innerblock {
70
+  padding: 10px;
71
+}
72
+
73
+table.innerblock {
74
+  width: 100%;
75
+  border-collapse: collapse;
76
+}
77
+
78
+table.innerblock th {
79
+  text-align: left;
80
+  background-color: #EEE;
81
+  border-bottom: 1px solid #666;
82
+}
83
+
84
+body table.righthead th {
85
+  text-align: right;	
86
+  background-color: #EEE;
87
+  border-bottom: 0px;
88
+  border-right: 1px solid #666;
89
+  padding-right: 10px;
90
+  width: 30%;
91
+}
92
+
93
+body table.bottomdiv {
94
+  border-bottom: 1px solid #666;
95
+}
96
+
97
+body div.bottomdiv {
98
+  border-bottom: 1px solid #666;
99
+}
100
+
101
+body table.righthead td {
102
+  padding-left: 10px;
103
+}
104
+
105
+table.innerblock td, table.innerblock th {
106
+  margin: 0px;
107
+  padding: 3px;
108
+}
109
+
110
+p.blurb {
111
+  font-style: italic;
112
+  margin: 0px;
113
+}
114
+
115
+table.form {
116
+  margin: 10px 0px;	
117
+}
118
+
119
+table.form td, table.form th {
120
+  padding: 3px;
121
+}
122
+
123
+table.leftpad {
124
+  margin-left: 10px;	
125
+}
126
+
127
+.inflat {
128
+  border: 1px solid #AAA;
129
+  padding: 3px;
130
+  width: 170px;
131
+}
132
+
133
+.inflaterr {
134
+  border: 1px solid #F00;
135
+  padding: 3px;
136
+  width: 170px;
137
+}
138
+
139
+div#dashboard {
140
+  float: right;
141
+  width: 25%;
142
+  border-left: 1px dotted #AAA;
143
+  padding: 5px 10px;
144
+}
145
+
146
+div#dashboard h2 {
147
+  margin: 0px;
148
+  font-size: 1em;
149
+  font-weight: bold;
150
+  color: #666;
151
+}
152
+
153
+div#dashboard ul {
154
+  padding-left: 20px;
155
+  margin-left: 0px;
156
+}
157
+
158
+div#dashboard li {
159
+  margin: 10px 0px;
160
+}
161
+
162
+div#dashboard a {
163
+  color: #000;
164
+  text-decoration: none;
165
+}
166
+
167
+div#dashboard a:hover {
168
+  text-decoration: underline;
169
+}
170
+
171
+table {
172
+  width: 100%;
173
+}
174
+
175
+th {
176
+  text-align: left;
177
+}
178
+
179
+table tr.odd td {
180
+  background-color: #F3F3F3;
181
+}
182
+
183
+table tr:hover td {
184
+  background-color: #E8E8E8;	
185
+}
186
+
187
+table.form tr:hover td { background-color: #FFF; }
188
+
189
+td.err {
190
+  color: #C44;
191
+}
192
+
193
+em {
194
+  font-style: normal;
195
+  font-family: monospace;
196
+  padding: 0px 5px;
197
+}
198
+
199
+ol li {
200
+  margin: 5px;
201
+}
202
+
203
+p.cleartop {
204
+  margin-top: 10px;
205
+}
206
+
207
+div#message {
208
+ border: 2px dashed #FAA;	
209
+ background-color: #FEE;
210
+ width: 70%;
211
+ margin-bottom: 20px;
212
+}
213
+
214
+div#message div {
215
+ padding: 10px;	
216
+}
217
+
218
+table#bandwidth {
219
+ border: 1px solid #AAA;
220
+ border-collapse: collapse;
221
+ width: auto;
222
+ position: absolute;
223
+ top: 20px;
224
+ right: 3%;
225
+ font-size: small;
226
+ font-family: Tahoma, sans-serif
227
+}
228
+
229
+table#bandwidth th {
230
+ font-weight: normal;
231
+ padding: 3px 10px;
232
+ width: auto;
233
+}
234
+
235
+table#bandwidth td {
236
+ border: 0px;
237
+ padding: 3px 7px;
238
+}
239
+
240
+table#bandwidth th, table#bandwidth td {
241
+ border-bottom: 1px solid #AAA;	
242
+}
243
+
244
+div.longtext {
245
+ line-height: 1.5em;
246
+}
247
+
248
+a img { border: 0px; }
249
+
250
+td.number { text-align: right; }
251
+
252
+table.stats th { border-right: 1px solid #666; vertical-align: bottom; text-align: center; }
253
+
254
+div.searchrow.center { text-align: center; }

+ 83
- 0
admin-www/issues/search.php View File

@@ -0,0 +1,83 @@
1
+<?PHP
2
+
3
+ require_once('lib/dashboard.php');
4
+ require_once('lib/common.php');
5
+
6
+ $admins = getAdmins();
7
+ $categories = getCategories();
8
+ if (isset($_POST['search'])) {
9
+  $_POST = repairPost($_POST);
10
+  $search = $_POST;
11
+ } elseif (isset($_GET['n']) && ctype_digit($_GET['n'])) {
12
+  $sql = 'SELECT isea_name, user_id, isea_options FROM issues_searches WHERE isea_id = '.m($_GET['n']).';';
13
+  $res = mysql_query($sql) or die(mysql_error());
14
+  if (mysql_num_rows($res) > 0) {
15
+   $data = mysql_fetch_assoc($res);
16
+   $search = unserialize($data['isea_options']);
17
+   $search['title'] = $data['isea_name'];
18
+   foreach($search as $key => $value) {
19
+     if ($value == '<<me>>') {
20
+       $search[$key] = getUserID($_SERVER['REDIRECT_REMOTE_USER']);
21
+     }
22
+   }
23
+  }
24
+ }
25
+ if (isset($search)) {
26
+  if (!isset($search['categories'])) {
27
+    $search['categories'] = array();
28
+  }
29
+  if ($search['categories'] == 'all') {
30
+   $search['categories'] = array_keys($categories);
31
+  }
32
+  if (!is_array($search['categories'])) {
33
+    $search['categories'] = array($search['categories']);
34
+  }
35
+  if (!isset($search['priority'])) {
36
+    $search['priority'] = array();
37
+  }
38
+  if ($search['priority'] == 'all') {
39
+    $search['priority'] = array('urgent', 'high', 'normal', 'low');
40
+  }
41
+  if (!is_array($search['priority'])) {
42
+    $search['priority'] = array($search['priority']);
43
+  }
44
+  if (!isset($search['status'])) {
45
+    $search['status'] = array();
46
+  }
47
+  if ($search['status'] == 'all') {
48
+    $search['status'] = array('open', 'assigned', 'closed', 'reopened');
49
+  }
50
+  if (!is_array($search['status'])) {
51
+    $search['status'] = array($search['status']);
52
+  }
53
+ } else {
54
+  $search = array();
55
+  $search['keywords'] = '';
56
+  $search['keywordloc'] = 'both';
57
+  $search['submitter'] = 'any';
58
+  $search['assignee'] = 'any';
59
+  $search['added'] = 'any';
60
+  $search['updated'] = 'any';
61
+  $search['deadline'] = 'any';
62
+  $search['priority'] = array('urgent', 'high', 'normal', 'low');
63
+  $search['status'] = array('open', 'assigned', 'closed', 'reopened');
64
+  $search['categories'] = array_keys($categories);
65
+  $search['order'] = 'added';
66
+  $search['limit'] = 20;
67
+ }
68
+
69
+ define('TITLE', 'Issue tracker :: Search');
70
+
71
+ addDashboardItem('Actions', 'Raise new issue', 'addissue');
72
+
73
+ include_once('res/commonDashboard.php');
74
+
75
+ require_once('lib/header.php');
76
+
77
+ require_once('pages/searchform.php');
78
+ require_once('pages/searchresults.php');
79
+ 
80
+ require_once('lib/footer.php');
81
+
82
+
83
+?>

+ 117
- 0
admin-www/issues/searches.php View File

@@ -0,0 +1,117 @@
1
+<?PHP
2
+
3
+ require_once('lib/dashboard.php');
4
+ require_once('lib/common.php');
5
+ 
6
+ $categories = getCategories();
7
+ $admins = getAdmins();
8
+
9
+ if (!isset($_GET['n'])) { $_GET['n'] = 'list'; }
10
+
11
+ if ($_GET['n'] == 'add') {
12
+  if (isset($_POST['add'])) {
13
+   $_GET['n'] = 'list';
14
+   unset($_POST['add']);
15
+   $_POST = repairPost($_POST);
16
+   print_r($_POST);
17
+   if (!empty($_POST['title'])) {
18
+    $sql = 'INSERT INTO issues_searches (user_id, isea_name, isea_options) 
19
+            VALUES (0, \''.m($_POST['title']).'\', \''.m(serialize($_POST)).'\')';
20
+    mysql_query($sql) or die(mysql_error().'<br />'.$sql);
21
+   }
22
+  } else {
23
+   $title = ' :: Add search';
24
+   $page = 'addsearch.php';
25
+  }
26
+ }
27
+ elseif ($_GET['n'] == 'edit') {
28
+  if (isset($_GET['m']) && ctype_digit($_GET['m'])) {
29
+   $title = ' :: Edit Search';
30
+   $page = 'editsearch.php';
31
+   if (!isset($_POST['edit'])) {
32
+    $sql = 'SELECT isea_id, isea_name, isea_options FROM issues_searches WHERE isea_id = '.$_GET['m'].';';
33
+    $res = mysql_query($sql);
34
+    if (mysql_num_rows($res) == 0) {
35
+     $_GET['n'] = 'list';
36
+    } else {
37
+     $data = mysql_fetch_assoc($res);
38
+     $search = unserialize($data['isea_options']);
39
+     $search['title'] = $data['isea_name']; 
40
+     foreach($search as $key => $value) {
41
+      if ($value == '<<me>>') {
42
+       $search[$key] = getUserID($_SERVER['REDIRECT_REMOTE_USER']);
43
+      }
44
+     }
45
+    }
46
+   } else {
47
+    echo 'moo';
48
+   }
49
+   if (!isset($search['categories'])) {
50
+    $search['categories'] = array();
51
+   }
52
+   if ($search['categories'] == 'all') {     
53
+    $search['categories'] = array_keys($categories);
54
+   }
55
+   if (!is_array($search['categories'])) {
56
+    $search['categories'] = array($search['categories']);
57
+   }
58
+   if (!isset($search['priority'])) {
59
+    $search['priority'] = array();
60
+   }
61
+   if ($search['priority'] == 'all') {
62
+    $search['priority'] = array('urgent', 'high', 'normal', 'low');
63
+   }
64
+   if (!is_array($search['priority'])) {
65
+    $search['priority'] = array($search['priority']);
66
+   }
67
+   if (!isset($search['status'])) {
68
+    $search['status'] = array();
69
+   }
70
+   if ($search['status'] == 'all') {
71
+    $search['status'] = array('open', 'assigned', 'closed', 'reopened');
72
+   }
73
+   if (!is_array($search['status'])) {
74
+    $search['status'] = array($search['status']);
75
+   }
76
+  }
77
+ }
78
+ elseif ($_GET['n'] == 'delete') {
79
+  if (isset($_GET['m']) && ctype_digit($_GET['m'])) {
80
+   $title = ' :: Delete search';
81
+   $page = 'deletesearch.php';
82
+  }
83
+ }
84
+ if ($_GET['n'] == 'list') {
85
+   $title = ' :: List searches';
86
+   $page = 'listsearch.php';
87
+   $sql = 'SELECT isea_id, isea_name, isea_options FROM issues_searches WHERE user_id =\''.m(getUserID($_SERVER['REDIRECT_REMOTE_USER'])).'\';';
88
+   $res = mysql_query($sql);
89
+   $savedsearches = array();
90
+   if (mysql_num_rows($res) > 0) {
91
+    while ($data = mysql_fetch_assoc($res)) {
92
+     $savedsearches[] = $data;
93
+    }
94
+   }
95
+   $sql = 'SELECT isea_id, isea_name, isea_options FROM issues_searches WHERE user_id =\'0\';';
96
+   $res = mysql_query($sql);
97
+   $globalsavedsearches = array();
98
+   if (mysql_num_rows($res) > 0) {
99
+    while ($data = mysql_fetch_assoc($res)) {
100
+     $globalsavedsearches[] = $data;
101
+    }
102
+   }
103
+ }
104
+
105
+ define('TITLE', 'Issue tracker :: Manage searches'.$title);
106
+
107
+ addDashboardItem('Actions', 'Add new saved search', 'searches/add');
108
+
109
+ include('res/commonDashboard.php');
110
+
111
+ require_once('lib/header.php');
112
+ echo '<p>Incomplete</p>';
113
+ require_once('pages/'.$page);
114
+
115
+ require_once('lib/footer.php');
116
+
117
+?>

+ 18
- 0
admin-www/issues/stats.php View File

@@ -0,0 +1,18 @@
1
+<?PHP
2
+
3
+ require_once('lib/dashboard.php');
4
+ require_once('lib/common.php');
5
+
6
+ define('TITLE', 'Issue tracker :: Stats');
7
+
8
+ addDashboardItem('Actions', 'Raise new issue', 'addissue');
9
+
10
+ include_once('res/commonDashboard.php');
11
+
12
+ require_once('lib/header.php');
13
+ 
14
+ require_once('pages/stats.php');
15
+ 
16
+ require_once('lib/footer.php');
17
+
18
+?>

+ 54
- 0
admin-www/issues/viewissue.php View File

@@ -0,0 +1,54 @@
1
+<?PHP
2
+
3
+ require_once('lib/dashboard.php');
4
+ require_once('lib/common.php');
5
+
6
+ if (!isset($_GET['n']) || !ctype_digit($_GET['n'])) {
7
+   header('Location: '.CP_PATH);
8
+ }
9
+ $sql  = 'SELECT i.i_id, c.icat_name, i.i_title, i.i_status, u1.user_name AS i_assignee,
10
+ u2.user_name AS i_submitter, i.i_priority, i.i_added, i.i_deadline, i.i_updated, i.i_text, i.i_extensiveness
11
+ FROM issues_issues AS i
12
+ LEFT JOIN issues_categories AS c ON i.icat_id = c.icat_id
13
+ LEFT JOIN users AS u1 ON i.i_assignee = u1.user_id
14
+ LEFT JOIN users AS u2 ON i.i_submitter = u2.user_id
15
+ WHERE i_id = '.m($_GET['n']);
16
+ 
17
+ $viewIssueRes = mysql_query($sql) or die(mysql_error().'<br />'.$sql);
18
+ 
19
+ if (mysql_num_rows($viewIssueRes) == 0) {
20
+   header('Location: '.CP_PATH);
21
+ }
22
+
23
+ $viewIssueData = mysql_fetch_assoc($viewIssueRes);
24
+ 
25
+ $sql  = 'SELECT irep_id, u1.user_name AS irep_user, irep_time, irep_text';
26
+ $sql .= ' FROM issues_replies NATURAL JOIN users as u1';
27
+ $sql .= ' WHERE u1.user_id = user_id AND i_id = '.m($_GET['n']);
28
+ $sql .= ' ORDER BY irep_time';
29
+
30
+ $viewIssueRepliesRes = mysql_query($sql) or die(mysql_error());
31
+
32
+ $issueReplies = array();
33
+ while ($viewIssueRepliesData = mysql_fetch_assoc($viewIssueRepliesRes)) {
34
+   $issueReplies[$viewIssueRepliesData['irep_id']] = $viewIssueRepliesData;
35
+ }
36
+
37
+ define('TITLE', 'Issue tracker :: View Issue :: '.h($viewIssueData['i_title']));
38
+
39
+ addDashboardItem('Actions', 'Raise new issue', 'addissue');
40
+ addDashboardItem('Actions', 'Delete', 'deleteissue/'.$_GET['n']);
41
+ addDashboardItem('Actions', 'Edit', 'editissue/'.$_GET['n']);
42
+ addDashboardItem('Actions', 'Reply', 'addreply/'.$_GET['n']);
43
+ addDashboardItem('Actions', 'View Log', 'viewlog/'.$_GET['n']);
44
+
45
+ include_once('res/commonDashboard.php');
46
+
47
+ require_once('lib/header.php');
48
+
49
+ require_once('pages/viewissue.php');
50
+
51
+ require_once('lib/footer.php');
52
+
53
+
54
+?>

+ 48
- 0
admin-www/issues/viewlog.php View File

@@ -0,0 +1,48 @@
1
+<?PHP
2
+
3
+ require_once('lib/dashboard.php');
4
+ require_once('lib/common.php');
5
+
6
+ if (!isset($_GET['n']) || !ctype_digit($_GET['n'])) {
7
+   header('Location: '.CP_PATH);
8
+ }
9
+ 
10
+ $sql  = 'SELECT i_title FROM issues_issues WHERE i_id = '.m($_GET['n']);
11
+ 
12
+ $viewIssueRes = mysql_query($sql) or die(mysql_error().'<br />'.$sql);
13
+ 
14
+ if (mysql_num_rows($viewIssueRes) == 0) {
15
+   header('Location: '.CP_PATH);
16
+ }
17
+
18
+ $viewIssueData = mysql_fetch_assoc($viewIssueRes);
19
+
20
+ $sql  = 'SELECT ilog_id, ilog_time, user_name, ilog_field, ilog_old, ilog_new';
21
+ $sql .= ' FROM issues_logs NATURAL JOIN users';
22
+ $sql .= ' WHERE i_id = '.m($_GET['n']);
23
+ $sql .= ' ORDER BY ilog_time';
24
+ 
25
+ $viewIssueChangesRes = mysql_query($sql) or die(mysql_error());
26
+
27
+ $issueChanges = array();
28
+ while ($viewIssueChangesData = mysql_fetch_assoc($viewIssueChangesRes)) {
29
+   $issueChanges[$viewIssueChangesData['ilog_id']] = $viewIssueChangesData;
30
+ }
31
+
32
+ define('TITLE', 'Issue tracker :: View Issue Changes :: '.h($viewIssueData['i_title']));
33
+
34
+ addDashboardItem('Actions', 'Raise new issue', 'addissue');
35
+ addDashboardItem('Actions', 'Edit', 'editissue/'.$_GET['n']);
36
+ addDashboardItem('Actions', 'Reply', 'addreply/'.$_GET['n']);
37
+ addDashboardItem('Actions', 'View Log', 'viewlog/'.$_GET['n']);
38
+ 
39
+ include_once('res/commonDashboard.php');
40
+
41
+ require_once('lib/header.php');
42
+ 
43
+ require_once('pages/viewlog.php');
44
+
45
+ require_once('lib/footer.php');
46
+
47
+
48
+?>

+ 22
- 0
admin-www/mon/index.php View File

@@ -0,0 +1,22 @@
1
+<?PHP
2
+
3
+ require_once('lib/dashboard.php');
4
+ require_once('lib/account.php');
5
+ require_once('lib/database.php');
6
+ 
7
+ define('TITLE', 'Service monitoring');
8
+
9
+ if (isset($_GET['silence']) && isset($_GET['serv']) && isset($_GET['svc'])) {
10
+  mysql_query('UPDATE servserv SET ss_silenced = 1 WHERE server_id = '.$_GET['serv'].' AND service_id = '.$_GET['svc']);
11
+  define('MESSAGE', 'Service silenced.');
12
+ }
13
+
14
+ require_once('lib/header.php');
15
+ 
16
+ require_once('pages/servers.php');
17
+ require_once('pages/status.php');
18
+ 
19
+ require_once('lib/footer.php');
20
+
21
+
22
+?>

+ 4
- 0
admin-www/mon/lib/account.php View File

@@ -0,0 +1,4 @@
1
+<?PHP
2
+
3
+
4
+?>

+ 38
- 0
admin-www/mon/lib/bandwidth.php View File

@@ -0,0 +1,38 @@
1
+<?PHP
2
+
3
+ $sql = 'SELECT band_total, band_used, hdd_total, hdd_used FROM users WHERE user_id = '.UID;
4
+ $ress = mysql_query($sql);
5
+ $row = mysql_fetch_array($ress);
6
+
7
+ $used = round($row[1] * (150/($row[0])),0);
8
+ $free = 150 - $used;
9
+
10
+ $hused = round($row[3] * (150/($row[2])),0);
11
+ $hfree = 150 - $hused;
12
+
13
+ $sql  = 'SELECT bill_due FROM billing WHERE';
14
+ $sql .= ' user_id = '.UID.' AND bill_paid <> 2';
15
+ $ress = mysql_query($sql);
16
+ $pay = mysql_fetch_array($ress);
17
+ $next = $pay[0];
18
+?>
19
+<table id="bandwidth" class="righthead">
20
+ <tr>
21
+  <th>Bandwidth</th>
22
+  <td>
23
+   <img src="<?PHP echo CP_PATH; ?>res/bandout.png" alt="[Red]" title="Bandwidth used" width="<?PHP echo $used; ?>" height="10"><img src="<?PHP echo CP_PATH; ?>res/bandfree.png" alt="[Green]" title="Free bandwidth" width="<?PHP echo $free; ?>" height="10">
24
+  </td>
25
+  <td><?PHP echo niceSize($row[1]).' / '.niceSize($row[0]); ?></td>
26
+ </tr>
27
+ <tr>
28
+  <th>Hard drive</th>
29
+  <td>
30
+   <img src="<?PHP echo CP_PATH; ?>res/bandout.png" alt="[Red]" title="Hard drive space used" width="<?PHP echo $hused; ?>" height="10"><img src="<?PHP echo CP_PATH; ?>res/bandfree.png" alt="[Green]" title="Free space" width="<?PHP echo $hfree; ?>" height="10">
31
+  </td>
32
+  <td><?PHP echo niceSize($row[3]).' / '.niceSize($row[2]); ?></td>
33
+ </tr>
34
+ <tr>
35
+  <th>Next payment</th>
36
+  <td colspan="2" style="text-align: center"><?PHP echo date('l, jS F, Y', $next); ?></td>
37
+ </tr>
38
+</table>

+ 42
- 0
admin-www/mon/lib/common.php View File

@@ -0,0 +1,42 @@
1
+<?PHP
2
+
3
+ if (defined('LIB_COMMON')) { return; }
4
+
5
+ require_once('lib/database.php');
6
+ 
7
+ define('CP_PATH', '/mon/');
8
+ 
9
+ function NiceSize($bytes) {
10
+  $sizes = array();
11
+  $sizes[1024] = ' <abbr title="Kibibytes">KiB</abbr>';
12
+  $sizes[(1024*1024)] = ' <abbr title="Mebibytes">MiB</abbr>';
13
+  $sizes[(1024*1024*1024)] = ' <abbr title="Gibibytes">GiB</abbr>';
14
+  krsort($sizes);
15
+  foreach ($sizes as $val => $name) {
16
+   if ($bytes > ($val * 1.2)) {
17
+    return round($bytes/$val, 2).$name;
18
+   }
19
+  }
20
+  return $bytes.' <abbr title="Bytes">B</abbr>';
21
+ }
22
+ 
23
+ function h ($text) { return htmlspecialchars($text); } 
24
+ function m ($a) { return mysql_real_escape_string($a); }
25
+ function l ($message, $uid = false) { 
26
+  if ($uid === false ){ $uid = UID; }; mysql_query('INSERT INTO log (log_time, user_id, log_message) VALUES ('.time().', '.$uid.', \''.m($message).'\')') or print(mysql_error());
27
+  $sql = 'SELECT user_name FROM users WHERE user_id = '.$uid;
28
+  $res = mysql_query($sql);
29
+  $row = mysql_fetch_array($res);
30
+  botlog('User '.chr(2).$row[0].chr(2).': '.$message);
31
+ }
32
+
33
+ function botlog ($message) {
34
+  if ($fh = @fsockopen('soren.dataforce.org.uk',7530,$errno,$errstr,0.2)) {
35
+   fputs($fh, 'ZOMGutdSTAFF '.$message."\r\n");
36
+   fclose($fh);
37
+  }
38
+ }
39
+ 
40
+ define('LIB_COMMON', true);
41
+
42
+?>

+ 42
- 0
admin-www/mon/lib/dashboard.php View File

@@ -0,0 +1,42 @@
1
+<?PHP
2
+
3
+if (defined('LIB_DASHBOARD')) { return; }
4
+
5
+$dbitems = array();
6
+
7
+function addDashboardItem ($category, $title, $url) {
8
+  global $dbitems;
9
+  
10
+  if (!isset($dbitems[$category])) {
11
+    $dbitems[$category] = array();
12
+  }
13
+  
14
+  $dbitems[$category][$title] = $url;
15
+}
16
+
17
+function generateDashboard () {
18
+  global $dbitems;
19
+  
20
+  ksort($dbitems);
21
+  
22
+  foreach ($dbitems as $k => $v) { ksort($dbitems[$k]); }
23
+  
24
+  echo '<div id="dashboard">';
25
+  
26
+  foreach ($dbitems as $category => $data) {
27
+    echo '<h2>'.$category.'</h2><ul>';  
28
+    foreach ($data as $title => $url) {
29
+      if ($url[0] != '#' && substr($url,0,7) != 'http://') { 
30
+	    $url = CP_PATH.$url;
31
+      }
32
+      echo '<li><a href="'.htmlspecialchars($url).'">'.$title.'</a></li>';
33
+    }
34
+    echo '</ul>';
35
+  }
36
+  
37
+  echo '</div>';
38
+}
39
+
40
+define('LIB_DASHBOARD', true);
41
+
42
+?>

+ 10
- 0
admin-www/mon/lib/database.php View File

@@ -0,0 +1,10 @@
1
+<?PHP
2
+
3
+ if (defined('LIB_DB') && !isset($_redodb)) { return; }
4
+
5
+ mysql_connect('', '', '');
6
+ mysql_select_db('');
7
+
8
+ define('LIB_DB', true);
9
+
10
+?>

+ 2
- 0
admin-www/mon/lib/footer.php View File

@@ -0,0 +1,2 @@
1
+ </body>
2
+</html>

+ 44
- 0
admin-www/mon/lib/header.php View File

@@ -0,0 +1,44 @@
1
+<?PHP
2
+
3
+ if (!defined('LIB_COMMON')) { require_once('lib/common.php'); }
4
+ if (!defined('LIB_ACCOUNT')) { require_once('lib/account.php'); }
5
+ if (!defined('LIB_DASHBOARD')) { require_once('lib/dashboard.php'); }
6
+
7
+?>
8
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
9
+<html>
10
+ <head>
11
+  <title>UTD-Hosting :: <?PHP echo TITLE; ?></title>
12
+  <link rel="stylesheet" type="text/css" href="<?PHP echo CP_PATH; ?>res/style.css">
13
+  </script>
14
+  <script type="text/javascript">
15
+   _uacct = "UA-70222-2";
16
+   urchinTracker();
17
+  </script>
18
+ </head>
19
+ <body>
20
+  <div id="header">
21
+   <h1><img src="<?PHP echo CP_PATH; ?>res/logo.png" alt="UTD-Hosting" title="UTD-Hosting"></h1>
22
+  </div>
23
+<?PHP
24
+
25
+ if (defined('USER')) { require_once('lib/bandwidth.php'); }
26
+
27
+?>  
28
+  <div id="menu">
29
+   <div id="menuleft">
30
+    <a href="<?PHP echo CP_PATH; ?>">Monitoring</a> 
31
+   </div>
32
+   <div id="menuright">
33
+    <a href="https://secure.utd-hosting.com/control">Control panel</a> |
34
+    <a href="https://secure.utd-hosting.com/control/admin">Admin</a>
35
+   </div>
36
+  </div>
37
+  <?PHP generateDashboard(); ?>
38
+  <?PHP if (defined('MESSAGE')) { ?>
39
+  <div id="message">
40
+   <div>
41
+    <?PHP echo MESSAGE; ?>
42
+   </div>
43
+  </div>
44
+  <?PHP } ?>

+ 57
- 0
admin-www/mon/pages/servers.php View File

@@ -0,0 +1,57 @@
1
+<?PHP
2
+
3
+ $sql = 'SELECT count(*) FROM services';
4
+ $res = mysql_query($sql);
5
+ $row = mysql_fetch_array($res);
6
+ define('SERVICES', (int)$row[0]);
7
+
8
+?>
9
+<div class="block">
10
+ <h2>Servers</h2>
11
+ <table class="innerblock">
12
+  <tr>
13
+   <th>ID</th>
14
+   <th>Name</th>
15
+   <th>Host</th>
16
+   <th>Status</th>
17
+  </tr>
18
+<?PHP
19
+
20
+ $sql = 'SELECT server_id, server_name, server_host FROM servers';
21
+ $res = mysql_query($sql);
22
+ $i = 0;
23
+ while ($row = mysql_fetch_assoc($res)) {
24
+  $i = 1 - $i;
25
+?>
26
+  <tr class="<?PHP echo ($i == 1) ? 'even' : 'odd'; ?>">
27
+   <td><?PHP echo $row['server_id']; ?></td>
28
+   <td><a href="#<?PHP echo $row['server_name']; ?>"><?PHP echo $row['server_name']; ?></a></td>
29
+   <td><?PHP echo $row['server_host']; ?></td>
30
+   <td>
31
+<?PHP
32
+
33
+ $sql = 'SELECT COUNT(*) FROM servserv WHERE server_id = '.$row['server_id'];
34
+ $re2 = mysql_query($sql);
35
+ $ro2 = mysql_fetch_array($re2);
36
+ $services = $ro2[0];
37
+
38
+ $sql = 'SELECT COUNT(*) FROM results WHERE server_id = '.$row['server_id'].' AND result_result = \'down\' AND result_last = 1';
39
+ $re2 = mysql_query($sql);
40
+ $ro2 = mysql_fetch_array($re2);
41
+ if ((int)$ro2[0] > 0) {
42
+  echo '<span style="color: red; font-weight: bold;">'.$ro2[0].' DOWN</span>';
43
+ } 
44
+ if ((int)$ro2[0] < $services) {
45
+  if ((int)$ro2[0] > 0) { echo ' / '; }
46
+  echo '<span style="color: green;">'.($services - (int)$ro2[0]).' UP</span>';
47
+ }
48
+
49
+?>
50
+   </td>
51
+  </tr>
52
+<?PHP
53
+ }
54
+
55
+?>
56
+ </table>
57
+</div>

+ 56
- 0
admin-www/mon/pages/status.php View File

@@ -0,0 +1,56 @@
1
+<?PHP
2
+
3
+ $sql = 'SELECT result_result, result_time, server_name, service_name, results.server_id, results.service_id FROM results NATURAL JOIN servers, services WHERE results.service_id = services.service_id AND result_last = 1 ORDER BY server_name, service_name';
4
+ $last = 0;
5
+ $res = mysql_query($sql);
6
+ while ($row = mysql_fetch_array($res)) {
7
+  if ($row['server_name'] !== $last) {
8
+   if ($last !== 0) { echo '</table></div>'; }
9
+   $i = 1;
10
+?>
11
+   <div class="block" id="<?PHP echo $row['server_name']; ?>">
12
+    <h2><?PHP echo $row['server_name']; ?></h2>
13
+    <table class="innerblock">
14
+     <tr>
15
+      <th>Service</th>
16
+      <th>Status</th>
17
+      <th>Time</th>
18
+      <th>Last up</th>
19
+      <th>Observed Uptime</th>
20
+      <th>Silence</th>
21
+     </tr>
22
+<?PHP
23
+   $last = $row['server_name'];
24
+  }
25
+  $i = 1 - $i;
26
+  echo '<tr class="'.($i == 0 ? 'even' : 'odd').'"><td>'.$row['service_name'].'</td><td';
27
+  if ($row['result_result'] == 'up') {
28
+   echo ' style="color: green;"';
29
+  } else {
30
+   echo ' style="color: red;"';
31
+  }
32
+  echo '>'.ucfirst($row['result_result']).'</td>';
33
+  echo '<td>'.date('r',$row['result_time']).'</td>';
34
+  $sql = 'SELECT MAX(result_time) FROM results WHERE server_id = '.$row['server_id'].' AND service_id = '.$row['service_id'].' AND result_result = \'up\'';
35
+  $re2 = mysql_query($sql);
36
+  $ro2 = mysql_fetch_array($re2);
37
+  echo '<td>'.date('r',$ro2[0]).'</td>';
38
+  $sql = 'SELECT COUNT(*), result_result FROM results WHERE server_id = '.$row['server_id'].' AND service_id = '.$row['service_id'].' GROUP BY result_result';
39
+  $re2 = mysql_query($sql) or print(mysql_error());
40
+  $uptime = array('up'=>0,'down'=>0);
41
+  while ($ro2 = mysql_fetch_array($re2)) {
42
+   $uptime[($ro2[1])] = $ro2[0];
43
+  }
44
+  echo '<td>'.round(100*$uptime['up']/($uptime['up']+$uptime['down']),3).'%</td>';
45
+  $re2 = mysql_query('SELECT ss_silenced FROM servserv WHERE server_id = '.$row['server_id'].' AND service_id = '.$row['service_id']) or print(mysql_error());
46
+  $ro2 = mysql_fetch_array($re2);
47
+  if ($ro2[0] == '1') {
48
+   echo '<td style="color: red;">Silenced</td>';
49
+  } else {
50
+   echo '<td><a href="?silence&amp;serv='.$row['server_id'].'&amp;svc='.$row['service_id'].'">Silence</a></td>';
51
+  }
52
+  echo '</tr>';
53
+ }
54
+
55
+?>
56
+</div>

+ 31
- 0
admin-www/mon/probe.php View File

@@ -0,0 +1,31 @@
1
+#!/usr/bin/php -q
2
+<?PHP
3
+
4
+ chdir('/home/utd/public_html/mon');
5
+
6
+ set_time_limit(0);
7
+
8
+ require_once('lib/database.php');
9
+ require_once('lib/common.php');
10
+
11
+ mysql_query('UPDATE results SET result_last = 0');
12
+
13
+ $sql = 'SELECT ss_silenced, servers.server_id, server_host, service_name, server_name, services.service_id, service_port FROM servserv NATURAL JOIN servers, services WHERE services.service_id = servserv.service_id';
14
+ $res = mysql_query($sql) or print(mysql_error());
15
+ while ($row = mysql_fetch_assoc($res)) {
16
+  if (@fsockopen($row['server_host'], $row['service_port'], $a, $b, 10)) {
17
+   $result = 'up';
18
+   if ($row['ss_silenced'] == '1') {
19
+    mysql_query('UPDATE servserv SET ss_silenced = 0 WHERE server_id = '.$row['server_id'].' AND service_id = '.$row['service_id']);
20
+    botlog($row['service_name'].' [port '.$row['service_port'].'] is now accessible on '.$row['server_name'].'. The service has been unsilenced.'); 
21
+   }
22
+  } else {
23
+   $result = 'down';
24
+   if ($row['ss_silenced'] == '0') {
25
+    botlog(chr(2).'WARNING'.chr(2).': '.$row['service_name'].' [port '.$row['service_port'].'] is not accessible on '.$row['server_name'].' ['.$row['server_host'].']. Silence: http://admin.utd-hosting.com/mon/?silence&serv='.$row['server_id'].'&svc='.$row['service_id']);
26
+   }
27
+  }
28
+  mysql_query('INSERT INTO results (service_id, server_id, result_result, result_time) VALUES ('.$row['service_id'].', '.$row['server_id'].', \''.$result.'\', '.time().')'); 
29
+ }
30
+
31
+?>

BIN
admin-www/mon/res/bandfree.png View File


BIN
admin-www/mon/res/bandout.png View File


+ 27
- 0
admin-www/mon/res/bandwidth.php View File

@@ -0,0 +1,27 @@
1
+<?PHP
2
+
3
+ chdir('..'); // So all our includes work right
4
+ 
5
+ require('ext/pie.php');
6
+
7
+ require('lib/common.php');
8
+ require('lib/database.php');
9
+ require('lib/account.php');
10
+ 
11
+ $total = 0;
12
+ 
13
+ $sql = 'SELECT site_name, site_bandin, site_bandout FROM sites WHERE user_id = '.UID;
14
+ $res = mysql_query($sql); 
15
+ $stuf = array();
16
+ 
17
+ while ($row = mysql_fetch_array($res)) {
18
+  $stuff[($row['site_name'])] = ((int)$row['site_bandin'] + (int)$row['site_bandout']	) ;
19
+  $total += $stuff[($row['site_name'])];
20
+ }
21
+ 
22
+  $im = doPie('Bandwidth usage', $stuff); 
23
+ 
24
+ header('Content-type: image/png');
25
+ imagepng($im);
26
+
27
+?>

BIN
admin-www/mon/res/error.png View File


BIN
admin-www/mon/res/log.png View File


BIN
admin-www/mon/res/logo.png View File


+ 97
- 0
admin-www/mon/res/script.js View File

@@ -0,0 +1,97 @@
1
+function validateLoginForm () {
2
+  var error = false;
3
+  
4
+  document.getElementById('username').className = 'inflat';
5
+  document.getElementById('usernamevalid').innerHTML = '';
6
+  document.getElementById('password').className = 'inflat';
7
+  document.getElementById('passwordvalid').innerHTML = '';  
8
+  
9
+  if (document.forms.login.password.value.length < 4) {
10
+    error = true;
11
+    document.getElementById('password').className = 'inflaterr';
12
+    document.getElementById('passwordvalid').innerHTML = 'Passwords must be at least four characters long.';
13
+    document.getElementById('password').focus();
14
+  }
15
+  
16
+  if (document.forms.login.username.value.length < 2) {
17
+    error = true;
18
+    document.getElementById('username').className = 'inflaterr';
19
+    document.getElementById('usernamevalid').innerHTML = 'Usernames must be at least two characters long.';
20
+    document.getElementById('username').focus();
21
+  }
22
+  
23
+  return (error == false);
24
+}
25
+
26
+function validateSubdomainForm () {
27
+  var error = false;
28
+
29
+  document.getElementById('subdomain').className = 'inflat';
30
+  document.getElementById('subdomainerr').innerHTML = '';
31
+
32
+  if (document.forms.submd.subdomain.value.length == 0) {
33
+    error = true;
34
+    document.getElementById('subdomain').className = 'inflaterr';
35
+    document.getElementById('subdomainerr').innerHTML = 'You must enter a subdomain';
36
+    document.getElementById('subdomain').focus();
37
+  }
38
+
39
+  var valid = /^[a-z][a-z0-9\-]*$/i;
40
+  if (!valid.test(document.forms.submd.subdomain.value)) {
41
+    error = true;
42
+    document.getElementById('subdomain').className = 'inflaterr';
43
+    document.getElementById('subdomainerr').innerHTML = 'Invalid subdomain.';
44
+    document.getElementById('subdomain').focus();
45
+  }
46
+
47
+  return (error == false);
48
+}
49
+
50
+function validateDomainForm () {
51
+  var error = false;
52
+
53
+  document.getElementById('domain').className = 'inflat';
54
+  document.getElementById('domainerr').innerHTML = '';
55
+
56
+  if (document.forms.md.domain.value.length == 0) {
57
+    error = true;
58
+    document.getElementById('domain').className = 'inflaterr';
59
+    document.getElementById('domainerr').innerHTML = 'You must enter a domain';
60
+    document.getElementById('domain').focus();
61
+  }
62
+  
63
+  var valid = /^[a-z][a-z0-9\-\.]*\.[a-z]{2,}$/i
64
+  if (!valid.test(document.forms.md.domain.value)) {
65
+    error = true;
66
+    document.getElementById('domain').className = 'inflaterr';
67
+    document.getElementById('domainerr').innerHTML = 'Invalid domain.';
68
+    document.getElementById('domain').focus();
69
+  }
70
+
71
+  return (error == false);
72
+}
73
+
74
+function validateTicketForm () {
75
+  var error = false;
76
+  
77
+  document.getElementById('body').className = 'inflat';
78
+  document.getElementById('messagevalid').innerHTML = '';
79
+  document.getElementById('subject').className = 'inflat';
80
+  document.getElementById('subjectvalid').innerHTML = '';  
81
+  
82
+  if (document.forms.ticket.body.value.length < 10) {
83
+    error = true;
84
+    document.getElementById('body').className = 'inflaterr';
85
+    document.getElementById('messagevalid').innerHTML = 'Please enter a complete description of the problem.';
86
+    document.getElementById('body').focus();
87
+  }
88
+  
89
+  if (document.forms.ticket.subject.value.length < 5) {
90
+    error = true;
91
+    document.getElementById('subject').className = 'inflaterr';
92
+    document.getElementById('subjectvalid').innerHTML = 'Please enter a complete subject.';
93
+    document.getElementById('subject').focus();
94
+  }
95
+  
96
+  return (error == false);
97
+}

+ 240
- 0
admin-www/mon/res/style.css View File

@@ -0,0 +1,240 @@
1
+body {
2
+  font-family: Tahoma, Arial, Sans-serif;
3
+  font-size: small;
4
+  margin: 170px 3% 5px 5%;
5
+  padding: 0px;
6
+}
7
+
8
+div#header {
9
+  position: absolute;
10
+  top: 15px;
11
+  left: 3%;
12
+  margin: 0px;
13
+}
14
+
15
+div#header h1 {
16
+  margin: 0px;
17
+}
18
+
19
+div#menu {
20
+  border: 1px solid #AAA;
21
+  position: absolute;
22
+  top: 115px;
23
+  left: 3%;
24
+  width: 94%;
25
+  background-color: #EEE;
26
+  padding: 5px;
27
+}
28
+
29
+div#menu a {
30
+  color: black;
31
+  text-decoration: none;
32
+}
33
+
34
+div#menu a:hover {
35
+  text-decoration: underline;
36
+}
37
+
38
+div#menuleft, div#menuright {
39
+  display: inline;
40
+}
41
+
42
+div#menuright {
43
+  position: absolute;
44
+  right: 0px;
45
+  padding-right: 6px;
46
+  text-align: right;
47
+}
48
+
49
+div.block {
50
+  width: 70%;
51
+  border: 1px solid #666;
52
+  padding: 0px;
53
+  margin-bottom: 20px;
54
+}
55
+
56
+div.block h2 {
57
+  margin: 0px;
58
+  background-color: #666;
59
+  font-size: 1em;
60
+  font-weight: bold;
61
+  padding: 3px 7px;
62
+  color: #F5F5F5;
63
+}
64
+
65
+div.innerblock {
66
+  padding: 10px;
67
+}
68
+
69
+table.innerblock {
70
+  width: 100%;
71
+  border-collapse: collapse;
72
+}
73
+
74
+table.innerblock th {
75
+  text-align: left;
76
+  background-color: #EEE;
77
+  border-bottom: 1px solid #666;
78
+}
79
+
80
+body table.righthead th {
81
+  text-align: right;	
82
+  background-color: #EEE;
83
+  border-bottom: 0px;
84
+  border-right: 1px solid #666;
85
+  padding-right: 10px;
86
+  width: 30%;
87
+}
88
+
89
+body table.bottomdiv {
90
+  border-bottom: 1px solid #666;
91
+}
92
+
93
+body table.righthead td {
94
+  padding-left: 10px;
95
+}
96
+
97
+table.innerblock td, table.innerblock th {
98
+  margin: 0px;
99
+  padding: 3px;
100
+}
101
+
102
+p.blurb {
103
+  font-style: italic;
104
+  margin: 0px;
105
+}
106
+
107
+table.form {
108
+  margin: 10px 0px;	
109
+}
110
+
111
+table.form td, table.form th {
112
+  padding: 3px;
113
+}
114
+
115
+table.leftpad {
116
+  margin-left: 10px;	
117
+}
118
+
119
+.inflat {
120
+  border: 1px solid #AAA;
121
+  padding: 3px;
122
+  width: 170px;
123
+}
124
+
125
+.inflaterr {
126
+  border: 1px solid #F00;
127
+  padding: 3px;
128
+  width: 170px;
129
+}
130
+
131
+div#dashboard {
132
+  float: right;
133
+  width: 25%;
134
+  border-left: 1px dotted #AAA;
135
+  padding: 5px 10px;
136
+}
137
+
138
+div#dashboard h2 {
139
+  margin: 0px;
140
+  font-size: 1em;
141
+  font-weight: bold;
142
+  color: #666;
143
+}
144
+
145
+div#dashboard ul {
146
+  padding-left: 20px;
147
+  margin-left: 0px;
148
+}
149
+
150
+div#dashboard li {
151
+  margin: 10px 0px;
152
+}
153
+
154
+div#dashboard a {
155
+  color: #000;
156
+  text-decoration: none;
157
+}
158
+
159
+div#dashboard a:hover {
160
+  text-decoration: underline;
161
+}
162
+
163
+table {
164
+  width: 100%;
165
+}
166
+
167
+th {
168
+  text-align: left;
169
+}
170
+
171
+table tr.odd td {
172
+  background-color: #F3F3F3;
173
+}
174
+
175
+table tr:hover td {
176
+  background-color: #E8E8E8;	
177
+}
178
+
179
+table.form tr:hover td { background-color: #FFF; }
180
+
181
+td.err {
182
+  color: #C44;
183
+}
184
+
185
+em {
186
+  font-style: normal;
187
+  font-family: monospace;
188
+  padding: 0px 5px;
189
+}
190
+
191
+ol li {
192
+  margin: 5px;
193
+}
194
+
195
+p.cleartop {
196
+  margin-top: 10px;
197
+}
198
+
199
+div#message {
200
+ border: 2px dashed #FAA;	
201
+ background-color: #FEE;
202
+ width: 70%;
203
+ margin-bottom: 20px;
204
+}
205
+
206
+div#message div {
207
+ padding: 10px;	
208
+}
209
+
210
+table#bandwidth {
211
+ border: 1px solid #AAA;
212
+ border-collapse: collapse;
213
+ width: auto;
214
+ position: absolute;
215
+ top: 20px;
216
+ right: 3%;
217
+ font-size: small;
218
+ font-family: Tahoma, sans-serif
219
+}
220
+
221
+table#bandwidth th {
222
+ font-weight: normal;
223
+ padding: 3px 10px;
224
+ width: auto;
225
+}
226
+
227
+table#bandwidth td {
228
+ border: 0px;
229
+ padding: 3px 7px;
230
+}
231
+
232
+table#bandwidth th, table#bandwidth td {
233
+ border-bottom: 1px solid #AAA;	
234
+}
235
+
236
+div.longtext {
237
+ line-height: 1.5em;
238
+}
239
+
240
+a img { border: 0px; }

BIN
admin-www/res/support/201/ie1.png View File


BIN
admin-www/res/support/201/ie2.png View File


BIN
admin-www/res/support/201/ie3.png View File


Loading…
Cancel
Save