Unfinished activity ('quantified self') tracker
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dmdircissues.php 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?PHP
  2. chdir('/home/dmdirc/www/bugs/');
  3. require_once('core.php');
  4. class DMDircIssuesSource implements Source {
  5. private $data = array();
  6. public function __construct() {
  7. mysql_connect('localhost', '', '');
  8. mysql_select_db('');
  9. $sql = 'SELECT UNIX_TIMESTAMP(date_modified) AS ts, field_name, old_value, new_value, type, bug_id FROM mantis_bug_history_table INNER JOIN mantis_user_table ON mantis_bug_history_table.user_id = mantis_user_table.id WHERE mantis_user_table.username = \'MD87\' AND date_modified > FROM_UNIXTIME(' . MIN_TIME . ')';
  10. $res = mysql_query($sql);
  11. while ($row = mysql_fetch_assoc($res)) {
  12. $info = history_localize_item($row['field_name'], $row['type'], $row['old_value'], $row['new_value']);
  13. $desc = $info['note'] . (!empty($info['change']) ? ': ' . $info['change'] : '');
  14. if ($desc == 'Checkin') { $ctime = $row['ts']; continue; }
  15. if ($desc == 'New Issue') { $ntime = $row['ts']; } else if ($ntime == $row['ts']) { continue; }
  16. if ($row['ts'] == $ctime) { continue; }
  17. $link = '<a href="http://bugs.dmdirc.com/view.php?id=' . $row['bug_id'];
  18. $link .= '">' . $row['bug_id'] . '</a>';
  19. if ($desc == 'New Issue') {
  20. $message = 'Created DMDirc issue ' . $link;
  21. } else if (substr($desc, 0, 6) == 'Note A') {
  22. $message = 'Added note to DMDirc issue ' . $link;
  23. } else {
  24. continue;
  25. $message = 'Altered DMDirc issue ' . $link . ' (' . htmlentities($desc) . ')';
  26. }
  27. $this->data[] = new Event($row['ts'], $message);
  28. }
  29. }
  30. public function getData() {
  31. return $this->data;
  32. }
  33. }
  34. $_SOURCES[] =& new DMDircIssuesSource();
  35. ?>