File: rss.php

package info (click to toggle)
flyspray 0.9.8-10
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 2,444 kB
  • ctags: 3,031
  • sloc: php: 17,634; sh: 301; makefile: 12
file content (92 lines) | stat: -rw-r--r-- 3,083 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
// Include the header to set up database access etc
include_once('../header.php');

// If the user gives us a limit, use it.  default is five results
if (isset($_REQUEST['num']) && is_numeric($_REQUEST['num']))
{
   $limit = $_REQUEST['num'];
} else
{
   $limit = '10';
}

// If the user requested tasks from a specific project, select it. default is global default project
if (isset($_REQUEST['proj']) && is_numeric($_REQUEST['proj']) && !empty($_REQUEST['proj']))
{
   $proj = $_REQUEST['proj'];
} else
{
   $proj = $flyspray_prefs['default_project'];
}

switch ($_REQUEST['type'])
{
   case 'new': $orderby = 'date_opened';
               $title = 'Recently opened tasks';
   break;
   case 'clo': $orderby = 'date_closed';
               $title = 'Recently closed tasks';
   break;
   case 'sev': $orderby = 'task_severity';
               $title = 'Most severe tasks';
   break;
   case 'pri': $orderby = 'task_priority';
               $title = 'Priority tasks';
   break;
   default: $orderby = 'date_opened';
            $title = 'Recently opened tasks';
   break;
}

$project_prefs = $fs->getProjectPrefs($proj);

// Set up the basic XML head
header ("Content-type: text/xml");
echo '<?xml version="1.0"?>' . "\n";
echo '<rss version="2.0">';
//echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/">' . "\n";
//echo '<channel rdf:about="http://www.zend.com/news.rss">' . "\n";
echo '<channel>';
echo '<title>Flyspray</title>' . "\n";
echo '<description>Flyspray:: ' . $project_prefs['project_title'] . ': ' . $title . '</description>' . "\n";
echo '<link>http://flyspray.rocks.cc/</link>' . "\n";
//echo '<image rdf:resource="" />' . "\n";

// Query the database
$task_details = $db->Query("SELECT task_id, item_summary, detailed_desc
                            FROM {$dbprefix}tasks t
                            LEFT JOIN {$dbprefix}projects p ON t.attached_to_project = p.project_id
                            WHERE t.is_closed <> '1'
                            AND p.project_id = ?
                            AND p.project_is_active = '1'
                            AND t.mark_private <> '1'
                            ORDER BY $orderby DESC",
                            array($proj), $limit);


// Now, let's loop the results
while ($row = $db->FetchArray($task_details))
{
   $item_summary = htmlspecialchars($row['item_summary']);
   $detailed_desc = htmlspecialchars($row['detailed_desc']);

   if (!get_magic_quotes_gpc())
   {
      $item_summary = str_replace("\\", "&#92;", $item_summary);
      $detailed_desc = str_replace("\\", "&#92;", $detailed_desc);
   }

   $item_summary = stripslashes($item_summary);
   $detailed_desc = stripslashes($detailed_desc);

   echo '<item>' . "\n";
   echo '<title>' . $item_summary . '</title>' . "\n";
   echo '<description>' . $fs->FormatText($detailed_desc) . '</description>' . "\n";
   echo '<link>' . $fs->CreateURL('details', $row['task_id']) . '</link>' . "\n";
   echo '</item>';
}

echo '</channel>' . "\n";
//echo '</rdf:RDF>' . "\n";
echo '</rss>';