summaryrefslogtreecommitdiff
path: root/modules/cvs.module
blob: 71e7b5ce4a8080588c7b5498f80e8c0943a59450 (plain)
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
<?php

function cvs_cron() {
  $result = db_query("SELECT * FROM cvs WHERE status = '0' ORDER BY timestamp DESC LIMIT 50");

  while ($cvs = db_fetch_object($result)) {
    $body .= "File: $cvs->files\nDate: ". format_date($cvs->timestamp) ."\nUser: $cvs->user\n\n$cvs->message\n----------------------------------------------------------------------\n";
  }

  $result = db_query("UPDATE cvs SET status = '1'");

  if ($body) mail(variable_get(cvs_mail, "root@localhost"), "CVS log messages", $body, "From: no-reply");
}

function cvs_conf() {
  return form_textfield(t("CVS digest recepient"), "cvs_mail", variable_get(cvs_mail, "root@localhost"), 30, 55, t("The e-mail address to mail the CVS log messages to.  Multiple recipients can be specified by putting a comma between each address."));
}

function cvs_page() {
  global $theme;

  $result = db_query("SELECT * FROM cvs ORDER BY timestamp DESC LIMIT 50");

  while ($cvs = db_fetch_object($result)) {
    $output .= "<b>File:</b> $cvs->files<br />";
    $output .= "<b>Date:</b> ". format_date($cvs->timestamp) ."<br />";
    $output .= "<b>User:</b> $cvs->user<br />";
    $output .= "\n". htmlentities($cvs->message) ."<hr />";
  }

  $theme->header();
  $theme->box("CVS commit messages", "<pre>$output</pre>");
  $theme->footer();
}

?>