[ PHPXref.com ] [ Generated: Sun Jul 20 17:51:59 2008 ] [ Flyspray 0.9.8 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/scripts/ -> rss.php (source)

   1  <?php
   2  // Include the header to set up database access etc
   3  include_once ('../header.php');
   4  
   5  // If the user gives us a limit, use it.  default is five results
   6  if (isset($_REQUEST['num']) && is_numeric($_REQUEST['num']))
   7  {
   8     $limit = $_REQUEST['num'];
   9  } else
  10  {
  11     $limit = '10';
  12  }
  13  
  14  // If the user requested tasks from a specific project, select it. default is global default project
  15  if (isset($_REQUEST['proj']) && is_numeric($_REQUEST['proj']) && !empty($_REQUEST['proj']))
  16  {
  17     $proj = $_REQUEST['proj'];
  18  } else
  19  {
  20     $proj = $flyspray_prefs['default_project'];
  21  }
  22  
  23  switch ($_REQUEST['type'])
  24  {
  25     case 'new': $orderby = 'date_opened';
  26                 $title = 'Recently opened tasks';
  27     break;
  28     case 'clo': $orderby = 'date_closed';
  29                 $title = 'Recently closed tasks';
  30     break;
  31     case 'sev': $orderby = 'task_severity';
  32                 $title = 'Most severe tasks';
  33     break;
  34     case 'pri': $orderby = 'task_priority';
  35                 $title = 'Priority tasks';
  36     break;
  37     default: $orderby = 'date_opened';
  38              $title = 'Recently opened tasks';
  39     break;
  40  }
  41  
  42  $project_prefs = $fs->getProjectPrefs($proj);
  43  
  44  // Set up the basic XML head
  45  header ("Content-type: text/xml");
  46  echo '<?xml version="1.0"?>' . "\n";
  47  echo '<rss version="2.0">';
  48  //echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/">' . "\n";
  49  //echo '<channel rdf:about="http://www.zend.com/news.rss">' . "\n";
  50  echo '<channel>';
  51  echo '<title>Flyspray</title>' . "\n";
  52  echo '<description>Flyspray:: ' . $project_prefs['project_title'] . ': ' . $title . '</description>' . "\n";
  53  echo '<link>http://flyspray.rocks.cc/</link>' . "\n";
  54  //echo '<image rdf:resource="" />' . "\n";
  55  
  56  // Query the database
  57  $task_details = $db->Query("SELECT task_id, item_summary, detailed_desc
  58                              FROM {$dbprefix}tasks t
  59                              LEFT JOIN {$dbprefix}projects p ON t.attached_to_project = p.project_id
  60                              WHERE t.is_closed <> '1'
  61                              AND p.project_id = ?
  62                              AND p.project_is_active = '1'
  63                              AND t.mark_private <> '1'
  64                              ORDER BY $orderby DESC",
  65                              array($proj), $limit);
  66  
  67  
  68  // Now, let's loop the results
  69  while ($row = $db->FetchArray($task_details))
  70  {
  71     $item_summary = htmlspecialchars($row['item_summary']);
  72     $detailed_desc = htmlspecialchars($row['detailed_desc']);
  73  
  74     if (!get_magic_quotes_gpc())
  75     {
  76        $item_summary = str_replace("\\", "&#92;", $item_summary);
  77        $detailed_desc = str_replace("\\", "&#92;", $detailed_desc);
  78     }
  79  
  80     $item_summary = stripslashes($item_summary);
  81     $detailed_desc = stripslashes($detailed_desc);
  82  
  83     echo '<item>' . "\n";
  84     echo '<title>' . $item_summary . '</title>' . "\n";
  85     echo '<description>' . $fs->FormatText($detailed_desc) . '</description>' . "\n";
  86     echo '<link>' . $fs->CreateURL('details', $row['task_id']) . '</link>' . "\n";
  87     echo '</item>';
  88  }
  89  
  90  echo '</channel>' . "\n";
  91  //echo '</rdf:RDF>' . "\n";
  92  echo '</rss>';


[ Powered by PHPXref - Served by Debian GNU/Linux ]