Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Update web to use git ticket list

  • Loading branch information...
commit 40e0b8f5896227c2522d09aad045329b5ef31091 1 parent 9fbdfb4
Stephen Paul Weber authored

Showing 1 changed file with 23 additions and 29 deletions. Show diff stats Hide diff stats

  1. 52  web/show.php
52  web/show.php
@@ -9,16 +9,12 @@
9 9
 // XXX Should come up with a way of escaping so that tickets can be in folders
10 10
 $ticket = explode("\n\n",file_get_contents(REPOSITORY_PATH.'/.tickets/'.basename($_SERVER['QUERY_STRING'])),2);
11 11
 
12  
-$id = null;
13 12
 $meta = explode("\n", $ticket[0]);
14 13
 if(count($meta)) {
15 14
 	echo "<dl>\n";
16 15
 	foreach($meta as $line) {
17 16
 		$line = preg_split('/:\s*/', $line, 2);
18 17
 		if($line[0] && $line[1]) {
19  
-			if(strtolower($line[0]) == 'message-id') {
20  
-				$id = $line[1];
21  
-			}
22 18
 			if(strtolower($line[0]) == 'from') {
23 19
 				$line[1] = preg_replace('/@[^<>]+/','',$line[1]);
24 20
 			}
@@ -32,33 +28,31 @@
32 28
 
33 29
 echo "\n<p>".str_replace("\n\n","</p>\n\n<p>",$ticket[1])."</p>\n";
34 30
 
35  
-if($id) {
36  
-	$id = escapeshellarg('^In-Reply-To: '.$id);
37  
-	$comments = explode("\n",shell_exec("cd '".REPOSITORY_PATH."/.tickets'; grep -il $id *"));
38  
-	if(count($comments)) {
39  
-		echo "\n<ul>\n";
40  
-		foreach($comments as $comment) {
41  
-			if(!$comment) continue;
42  
-			$comment = explode("\n\n",file_get_contents(REPOSITORY_PATH.'/.tickets/'.$comment));
43  
-			$comment[0] = explode("\n", $comment[0]);
44  
-			foreach($comment[0] as $meta) {
45  
-				if(!$meta) continue;
46  
-				$meta = preg_split('/:\s*/', $meta, 2);
47  
-				if(strtolower($meta[0]) == 'from') $from = preg_replace('/@[^<>]+/','',$meta[1]);
48  
-				if(strtolower($meta[0]) == 'date') $date = $meta[1];
49  
-			}
50  
-			echo "\t<li>\n";
51  
-			echo "\n\t\t<dl>\n";
52  
-			echo "\t\t\t<dt>From</dt>\n";
53  
-			echo "\t\t\t\t<dd>".htmlspecialchars($from)."</dd>\n";
54  
-			echo "\t\t\t<dt>Date</dt>\n";
55  
-			echo "\t\t\t\t<dd>".htmlspecialchars($date)."</dd>\n";
56  
-			echo "\t\t</dl>\n";
57  
-			echo "\n\t\t<p>".str_replace("\n\n","</p>\n\n\t\t<p>",$comment[1])."</p>\n";
58  
-			echo "\t</li>\n";
  31
+// XXX support threaded comments
  32
+$comments = explode("\n",shell_exec("cd '".REPOSITORY_PATH."/.tickets'; git ticket list comments '".basename($_SERVER['QUERY_STRING'])."'"));
  33
+if(count($comments)) {
  34
+	echo "\n<ul>\n";
  35
+	foreach($comments as $comment) {
  36
+		if(!$comment) continue;
  37
+		$comment = explode("\n\n",file_get_contents(REPOSITORY_PATH.'/.tickets/'.$comment));
  38
+		$comment[0] = explode("\n", $comment[0]);
  39
+		foreach($comment[0] as $meta) {
  40
+			if(!$meta) continue;
  41
+			$meta = preg_split('/:\s*/', $meta, 2);
  42
+			if(strtolower($meta[0]) == 'from') $from = preg_replace('/@[^<>]+/','',$meta[1]);
  43
+			if(strtolower($meta[0]) == 'date') $date = $meta[1];
59 44
 		}
60  
-		echo "</ul>\n";
  45
+		echo "\t<li>\n";
  46
+		echo "\n\t\t<dl>\n";
  47
+		echo "\t\t\t<dt>From</dt>\n";
  48
+		echo "\t\t\t\t<dd>".htmlspecialchars($from)."</dd>\n";
  49
+		echo "\t\t\t<dt>Date</dt>\n";
  50
+		echo "\t\t\t\t<dd>".htmlspecialchars($date)."</dd>\n";
  51
+		echo "\t\t</dl>\n";
  52
+		echo "\n\t\t<p>".str_replace("\n\n","</p>\n\n\t\t<p>",$comment[1])."</p>\n";
  53
+		echo "\t</li>\n";
61 54
 	}
  55
+	echo "</ul>\n";
62 56
 }
63 57
 
64 58
 

0 notes on commit 40e0b8f

Please sign in to comment.
Something went wrong with that request. Please try again.