Viewing Paste 419

Formated Paste

  1. // Close bugs.
  2. function svnProjectTools($data, $id_member)
  3. {
  4. global $smcFunc, $sourcedir, $context, $user_profile, $issue, $project;
  5.  
  6. $project = 2;
  7.  
  8. if (empty($data->log))
  9. return;
  10.  
  11. // First, explode all entires by new line.
  12. $entries = explode("\n", $data->log);
  13. $bugs = array();
  14. foreach ($entries as $entry)
  15. {
  16. // Pull out the bug/feature index.
  17. preg_match('~\[[Bug|Feature]+\s+([\d,]+)\]~i', $entry, $matches);
  18.  
  19. // Nothing to log?
  20. if (empty($matches[1]))
  21. continue;
  22.  
  23. // Only list them once.
  24. $temp = array_unique(array_map('intval', explode(',', $matches[1])));;
  25.  
  26. // Dump this into an array whos key is the bug id.
  27. foreach ($temp as $id)
  28. $bugs[$id][] = str_replace($matches[0], 'Revision: ' . $data->revision, $entry);
  29. }
  30.  
  31. // Mash that multi-dimensional array to a single array.
  32. foreach ($bugs as $id => $bug)
  33. $bugs[$id] = implode("\n", array_unique($bug));
  34.  
  35. // Still nothing?
  36. if (empty($bugs))
  37. return;
  38.  
  39. // Some junk we need.
  40. require_once($sourcedir . '/Subs-Post.php');
  41. require_once($sourcedir . '/Subs-Issue.php');
  42. require_once($sourcedir . '/Subs-Project.php');
  43. require_once($sourcedir . '/IssueReport.php');
  44. require_once($sourcedir . '/IssueComment.php');
  45.  
  46. // Call a few friends.
  47. loadMemberData($id_member);
  48. loadProjectTools();
  49.  
  50. // Prep the changes.
  51. $posterOptions = array(
  52. 'id' => $id_member,
  53. 'ip' => $user_profile[$id_member]['member_ip'],
  54. 'name' => $data->author,
  55. 'email' => $user_profile[$id_member]['email_address'],
  56. );
  57. $issueOptions = array(
  58. 'mark_read' => true,
  59. 'assignee' => $id_member,
  60. 'status' => 5, // Resolved.
  61. );
  62. $commentOptions = array('body' => '');
  63.  
  64. // Lets do some loops.
  65. foreach ($bugs as $bug => $message)
  66. {
  67. $issue = $bug;
  68. loadIssue();
  69.  
  70. // Update our body message
  71. $commentOptions['body'] = $smcFunc['htmlspecialchars']($message, ENT_QUOTES);
  72.  
  73. // Update status and assigne.
  74. $event_data = updateIssue($bug, $issueOptions, $posterOptions, true);
  75.  
  76. // Fix a Project tracker bug...
  77. if ($event_data === true)
  78. $event_data = array();
  79.  
  80. // Create a comment.
  81. $id_comment = createComment($project, $bug, $commentOptions, $posterOptions);
  82. $commentOptions['id'] = $id_comment;
  83.  
  84. // Spam people.
  85. sendIssueNotification(array('id' => $bug, 'project' => $project), $commentOptions, $event_data, 'new_comment', $id_member);
  86.  
  87. }
  88. }
Name:
Email:
Code/text to paste:
  • Enable code highlighting
  • Code Language:
  • A duck, cat and a goose walk into a bar. How many animals walked into a bar?:
Highslide for Wordpress Plugin