+++ /dev/null
-<?php
-
-$domain=ereg_replace('[^\.]*\.(.*)$','\1',$_SERVER['HTTP_HOST']);
-$group_name=ereg_replace('([^\.]*)\..*$','\1',$_SERVER['HTTP_HOST']);
-
-echo '<?xml version="1.0" encoding="UTF-8"?>';
-?>
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en ">
-
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title><?php echo $project_name; ?></title>
- <script language="JavaScript" type="text/javascript">
- <!--
- function help_window(helpurl) {
- HelpWin = window.open( helpurl,'HelpWindow','scrollbars=yes,resizable=yes,toolbar=no,height=400,width=400');
- }
- // -->
- </script>
-
-<style type="text/css">
- <!--
- BODY {
- margin-top: 3;
- margin-left: 3;
- margin-right: 3;
- margin-bottom: 3;
- background: #01004e;
- }
- ol,ul,p,body,td,tr,th,form { font-family: verdana,arial,helvetica,sans-serif; font-size:small;
- color: #333333; }
-
- h1 { font-size: x-large; font-family: verdana,arial,helvetica,sans-serif; }
- h2 { font-size: large; font-family: verdana,arial,helvetica,sans-serif; }
- h3 { font-size: medium; font-family: verdana,arial,helvetica,sans-serif; }
- h4 { font-size: small; font-family: verdana,arial,helvetica,sans-serif; }
- h5 { font-size: x-small; font-family: verdana,arial,helvetica,sans-serif; }
- h6 { font-size: xx-small; font-family: verdana,arial,helvetica,sans-serif; }
-
- pre,tt { font-family: courier,sans-serif }
-
- a:link { text-decoration:none }
- a:visited { text-decoration:none }
- a:active { text-decoration:none }
- a:hover { text-decoration:underline; color:red }
-
- .titlebar { color: black; text-decoration: none; font-weight: bold; }
- a.tablink { color: black; text-decoration: none; font-weight: bold; font-size: x-small; }
- a.tablink:visited { color: black; text-decoration: none; font-weight: bold; font-size: x-small; }
- a.tablink:hover { text-decoration: none; color: black; font-weight: bold; font-size: x-small; }
- a.tabsellink { color: black; text-decoration: none; font-weight: bold; font-size: x-small; }
- a.tabsellink:visited { color: black; text-decoration: none; font-weight: bold; font-size: x-small; }
- a.tabsellink:hover { text-decoration: none; color: black; font-weight: bold; font-size: x-small; }
- -->
-</style>
-
-</head>
-
-<body>
-
-<table border="0" width="100%" cellspacing="0" cellpadding="0">
-
- <tr>
- <td><a href="/"><img src="http://<?php echo $domain; ?>/themes/gforge/images/logo.png" border="0" alt="" width="198" height="52" /></a></td>
- </tr>
-
-</table>
-
-<table border="0" width="100%" cellspacing="0" cellpadding="0">
-
- <tr>
- <td> </td>
- <td colspan="3">
-
-
-
- <!-- start tabs -->
-
- <tr>
- <td align="left" bgcolor="#E0E0E0" width="9"><img src="http://<?php echo $domain; ?>/themes/gforge/images/tabs/topleft.png" height="9" width="9" alt="" /></td>
- <td bgcolor="#E0E0E0" width="30"><img src="http://<?php echo $domain; ?>/themes/gforge/images/clear.png" width="30" height="1" alt="" /></td>
- <td bgcolor="#E0E0E0"><img src="http://<?php echo $domain; ?>/themes/gforge/images/clear.png" width="1" height="1" alt="" /></td>
- <td bgcolor="#E0E0E0" width="30"><img src="http://<?php echo $domain; ?>/themes/gforge/images/clear.png" width="30" height="1" alt="" /></td>
- <td align="right" bgcolor="#E0E0E0" width="9"><img src="http://<?php echo $domain; ?>/themes/gforge/images/tabs/topright.png" height="9" width="9" alt="" /></td>
- </tr>
-
- <tr>
-
- <!-- Outer body row -->
-
- <td bgcolor="#E0E0E0"><img src="http://<?php echo $domain; ?>/themes/gforge/images/clear.png" width="10" height="1" alt="" /></td>
- <td valign="top" width="99%" bgcolor="#E0E0E0" colspan="3">
-
- <!-- Inner Tabs / Shell -->
-
- <table border="0" width="100%" cellspacing="0" cellpadding="0">
- <tr>
- <td align="left" bgcolor="#ffffff" width="9"><img src="http://<?php echo $domain; ?>/themes/gforge/images/tabs/topleft-inner.png" height="9" width="9" alt="" /></td>
- <td bgcolor="#ffffff"><img src="http://<?php echo $domain; ?>/themes/gforge/images/clear.png" width="1" height="1" alt="" /></td>
- <td align="right" bgcolor="#ffffff" width="9"><img src="http://<?php echo $domain; ?>/themes/gforge/images/tabs/topright-inner.png" height="9" width="9" alt="" /></td>
- </tr>
-
- <tr>
- <td bgcolor="#ffffff"><img src="http://<?php echo $domain; ?>/themes/gforge/images/clear.png" width="10" height="1" alt="" /></td>
- <td valign="top" width="99%" bgcolor="white">
-
- <!-- whole page table -->
-<table width="100%" cellpadding="5" cellspacing="0" border="0">
-<tr><td width="65%" valign="top">
-<?php if ($handle=fopen('http://'.$domain.'/export/projtitl.php?group_name='.$group_name,'r')){
-$contents = '';
-while (!feof($handle)) {
- $contents .= fread($handle, 8192);
-}
-fclose($handle);
-echo $contents; } ?>
-
-<?php if ($handle=fopen('http://'.$domain.'/export/projnews.php?group_name='.$group_name,'r')){
-$contents = '';
-while (!feof($handle)) {
- $contents .= fread($handle, 8192);
-}
-fclose($handle);
-$contents=str_replace('href="/','href="http://'.$domain.'/',$contents);
-echo $contents; } ?>
-
-</td>
-
-<td width="35%" valign="top">
-
- <table cellspacing="0" cellpadding="1" width="100%" border="0" bgcolor="#d5d5d7">
- <tr><td>
- <table cellspacing="0" cellpadding="2" width="100%" border="0" bgcolor="#eaecef">
- <tr style="background-color:#d5d5d7" align="center">
- <td colspan="2"><span class="titlebar">Project Summary</span></td>
- </tr>
- <tr align="left">
- <td colspan="2">
-
-<?php if($handle=fopen('http://'.$domain.'/export/projhtml.php?group_name='.$group_name,'r')){
-$contents = '';
-while (!feof($handle)) {
- $contents .= fread($handle, 8192);
-}
-fclose($handle);
-$contents=str_replace('href="/','href="http://'.$domain.'/',$contents);
-$contents=str_replace('src="/','src="http://'.$domain.'/',$contents);
-echo $contents; } ?>
-
- </td>
- </tr>
- </table>
- </td></tr>
- </table><p> </p>
-</td></tr></table>
- <p>
- <center>
- <a href="http://gforgegroup.com/"><img src="http://gforge.org/pro/gforgebanner.jpg" height="60" width="468" border="0" alt="GForge Group Professional Services" /></a><br /><br />
- </center>
- <!-- end main body row -->
-
-
- </td>
- <td width="10" bgcolor="#ffffff"><img src="http://<?php echo $domain; ?>/themes/gforge/images/clear.png" width="2" height="1" alt="" /></td>
- </tr>
- <tr>
- <td align="left" bgcolor="#E0E0E0" width="9"><img src="http://<?php echo $domain; ?>/themes/gforge/images/tabs/bottomleft-inner.png" height="11" width="11" alt="" /></td>
- <td bgcolor="#ffffff"><img src="http://<?php echo $domain; ?>/themes/gforge/images/clear.png" width="1" height="1" alt="" /></td>
- <td align="right" bgcolor="#E0E0E0" width="9"><img src="http://<?php echo $domain; ?>/themes/gforge/images/tabs/bottomright-inner.png" height="11" width="11" alt="" /></td>
- </tr>
- </table>
-
- <!-- end inner body row -->
-
- </td>
- <td width="10" bgcolor="#E0E0E0"><img src="http://<?php echo $domain; ?>/themes/gforge/images/clear.png" width="2" height="1" alt="" /></td>
- </tr>
- <tr>
- <td align="left" bgcolor="#E0E0E0" width="9"><img src="http://<?php echo $domain; ?>/themes/gforge/images/tabs/bottomleft.png" height="9" width="9" alt="" /></td>
- <td bgcolor="#E0E0E0" colspan="3"><img src="http://<?php echo $domain; ?>/themes/gforge/images/clear.png" width="1" height="1" alt="" /></td>
- <td align="right" bgcolor="#E0E0E0" width="9"><img src="http://<?php echo $domain; ?>/themes/gforge/images/tabs/bottomright.png" height="9" width="9" alt="" /></td>
- </tr>
-</table>
-
-<!-- PLEASE LEAVE "Powered By GForge" on your site -->
-<br />
-<center>
-<a href="http://gforge.org/"><img src="http://gforge.org/images/pow-gforge.png" alt="Powered By GForge Collaborative Development Environment" border="0" /></a>
-</center>
-
-
-</body>
-</html>
+++ /dev/null
-#! /usr/bin/python
-
-# NOTE: Until SourceForge installs a modern version of Python on the cvs
-# servers, this script MUST be compatible with Python 1.5.2.
-
-"""Complicated notification for CVS checkins.
-
-This script is used to provide email notifications of changes to the CVS
-repository. These email changes will include context diffs of the changes.
-Really big diffs will be trimmed.
-
-This script is run from a CVS loginfo file (see $CVSROOT/CVSROOT/loginfo). To
-set this up, create a loginfo entry that looks something like this:
-
- mymodule /path/to/this/script %%s some-email-addr@your.domain
-
-In this example, whenever a checkin that matches `mymodule' is made, this
-script is invoked, which will generate the diff containing email, and send it
-to some-email-addr@your.domain.
-
- Note: This module used to also do repository synchronizations via
- rsync-over-ssh, but since the repository has been moved to SourceForge,
- this is no longer necessary. The syncing functionality has been ripped
- out in the 3.0, which simplifies it considerably. Access the 2.x versions
- to refer to this functionality. Because of this, the script is misnamed.
-
-It no longer makes sense to run this script from the command line. Doing so
-will only print out this usage information.
-
-Usage:
-
- %(PROGRAM)s [options] <%%S> email-addr [email-addr ...]
-
-Where options are:
-
- --cvsroot=<path>
- Use <path> as the environment variable CVSROOT. Otherwise this
- variable must exist in the environment.
-
- --context=#
- -C #
- Include # lines of context around lines that differ (default: 2).
-
- -c
- Produce a context diff (default).
-
- -u
- Produce a unified diff (smaller).
-
- --quiet / -q
- Don't print as much status to stdout.
-
- --fromhost=hostname
- -f hostname
- The hostname that email messages appear to be coming from. The From:
- header will of the outgoing message will look like user@hostname. By
- default, hostname is the machine's fully qualified domain name.
-
- --help / -h
- Print this text.
-
-The rest of the command line arguments are:
-
- <%%S>
- CVS %%s loginfo expansion. When invoked by CVS, this will be a single
- string containing the directory the checkin is being made in, relative
- to $CVSROOT, followed by the list of files that are changing. If the
- %%s in the loginfo file is %%{sVv}, context diffs for each of the
- modified files are included in any email messages that are generated.
-
- email-addrs
- At least one email address.
-"""
-import os
-import sys
-import re
-import time
-import string
-import getopt
-import smtplib
-import pwd
-import socket
-
-try:
- from socket import getfqdn
-except ImportError:
- def getfqdn():
- # Python 1.5.2 :(
- hostname = socket.gethostname()
- byaddr = socket.gethostbyaddr(socket.gethostbyname(hostname))
- aliases = byaddr[1]
- aliases.insert(0, byaddr[0])
- aliases.insert(0, hostname)
- for fqdn in aliases:
- if '.' in fqdn:
- break
- else:
- fqdn = 'localhost.localdomain'
- return fqdn
-
-
-from cStringIO import StringIO
-
-# Which SMTP server to do we connect to? Empty string means localhost.
-MAILHOST = 'localhost'
-MAILPORT = 25
-
-# Diff trimming stuff
-DIFF_HEAD_LINES = 20
-DIFF_TAIL_LINES = 20
-DIFF_TRUNCATE_IF_LARGER = 1000
-
-EMPTYSTRING = ''
-SPACE = ' '
-DOT = '.'
-COMMASPACE = ', '
-
-PROGRAM = sys.argv[0]
-
-BINARY_EXPLANATION_LINES = [
- "(This appears to be a binary file; contents omitted.)\n"
- ]
-
-REVCRE = re.compile("^(NONE|[0-9.]+)$")
-NOVERSION = "Couldn't generate diff; no version number found in filespec: %s"
-BACKSLASH = "Couldn't generate diff: backslash in filespec's filename: %s"
-
-
-\f
-def usage(code, msg=''):
- print __doc__ % globals()
- if msg:
- print msg
- sys.exit(code)
-
-
-\f
-def calculate_diff(filespec, contextlines):
- file, oldrev, newrev = string.split(filespec, ',')
- # Make sure we can find a CVS version number
- if not REVCRE.match(oldrev):
- return NOVERSION % filespec
- if not REVCRE.match(newrev):
- return NOVERSION % filespec
-
- if string.find(file, '\\') <> -1:
- # I'm sorry, a file name that contains a backslash is just too much.
- # XXX if someone wants to figure out how to escape the backslashes in
- # a safe way to allow filenames containing backslashes, this is the
- # place to do it. --Zooko 2002-03-17
- return BACKSLASH % filespec
-
- if string.find(file, "'") <> -1:
- # Those crazy users put single-quotes in their file names! Now we
- # have to escape everything that is meaningful inside double-quotes.
- filestr = string.replace(file, '`', '\`')
- filestr = string.replace(filestr, '"', '\"')
- filestr = string.replace(filestr, '$', '\$')
- # and quote it with double-quotes.
- filestr = '"' + filestr + '"'
- else:
- # quote it with single-quotes.
- filestr = "'" + file + "'"
- if oldrev == 'NONE':
- try:
- if os.path.exists(file):
- fp = open(file)
- else:
- update_cmd = "cvs -fn update -r %s -p %s" % (newrev, filestr)
- fp = os.popen(update_cmd)
- lines = fp.readlines()
- fp.close()
- # Is this a binary file? Let's look at the first few
- # lines to figure it out:
- for line in lines[:5]:
- for c in string.rstrip(line):
- if c in string.whitespace:
- continue
- if c < ' ' or c > chr(127):
- lines = BINARY_EXPLANATION_LINES[:]
- break
- lines.insert(0, '--- NEW FILE: %s ---\n' % file)
- except IOError, e:
- lines = ['***** Error reading new file: ',
- str(e), '\n***** file: ', file, ' cwd: ', os.getcwd()]
- elif newrev == 'NONE':
- lines = ['--- %s DELETED ---\n' % file]
- else:
- # This /has/ to happen in the background, otherwise we'll run into CVS
- # lock contention. What a crock.
- if contextlines > 0:
- difftype = "-C " + str(contextlines)
- else:
- difftype = "-u"
- diffcmd = "/usr/bin/cvs -f diff -kk %s --minimal -r %s -r %s %s" \
- % (difftype, oldrev, newrev, filestr)
- fp = os.popen(diffcmd)
- lines = fp.readlines()
- sts = fp.close()
- # ignore the error code, it always seems to be 1 :(
-## if sts:
-## return 'Error code %d occurred during diff\n' % (sts >> 8)
- if len(lines) > DIFF_TRUNCATE_IF_LARGER:
- removedlines = len(lines) - DIFF_HEAD_LINES - DIFF_TAIL_LINES
- del lines[DIFF_HEAD_LINES:-DIFF_TAIL_LINES]
- lines.insert(DIFF_HEAD_LINES,
- '[...%d lines suppressed...]\n' % removedlines)
- return string.join(lines, '')
-
-
-\f
-def blast_mail(subject, people, filestodiff, contextlines, fromhost):
- # cannot wait for child process or that will cause parent to retain cvs
- # lock for too long. Urg!
- if not os.fork():
- # in the child
- # give up the lock you cvs thang!
- time.sleep(2)
- # Create the smtp connection to the localhost
- conn = smtplib.SMTP()
- conn.connect(MAILHOST, MAILPORT)
- user = pwd.getpwuid(os.getuid())[0]
- domain = fromhost or getfqdn()
- author = '%s@%s' % (user, domain)
- s = StringIO()
- sys.stdout = s
- try:
- print '''\
-From: %(author)s
-To: %(people)s
-Subject: %(subject)s
-''' % {'author' : author,
- 'people' : string.join(people, COMMASPACE),
- 'subject': subject,
- }
- s.write(sys.stdin.read())
- # append the diffs if available
- print
- for file in filestodiff:
- print calculate_diff(file, contextlines)
- finally:
- sys.stdout = sys.__stdout__
- resp = conn.sendmail(author, people, s.getvalue())
- conn.close()
- os._exit(0)
-
-
-\f
-# scan args for options
-def main():
- try:
- opts, args = getopt.getopt(
- sys.argv[1:], 'hC:cuqf:',
- ['fromhost=', 'context=', 'cvsroot=', 'help', 'quiet'])
- except getopt.error, msg:
- usage(1, msg)
-
- # parse the options
- contextlines = 2
- verbose = 1
- fromhost = None
- for opt, arg in opts:
- if opt in ('-h', '--help'):
- usage(0)
- elif opt == '--cvsroot':
- os.environ['CVSROOT'] = arg
- elif opt in ('-C', '--context'):
- contextlines = int(arg)
- elif opt == '-c':
- if contextlines <= 0:
- contextlines = 2
- elif opt == '-u':
- contextlines = 0
- elif opt in ('-q', '--quiet'):
- verbose = 0
- elif opt in ('-f', '--fromhost'):
- fromhost = arg
-
- # What follows is the specification containing the files that were
- # modified. The argument actually must be split, with the first component
- # containing the directory the checkin is being made in, relative to
- # $CVSROOT, followed by the list of files that are changing.
- if not args:
- usage(1, 'No CVS module specified')
- subject = args[0]
- fileargs = args[1:-1]
- specs = []
- specs.append(subject)
- while len(fileargs) > 0:
- specs.append(string.join(fileargs[:3], ','))
- fileargs = fileargs[3:]
-
- if not args[-1]:
- usage(1, 'No recipients specified')
- people = []
- people.append(args[-1])
-
- # The remaining args should be the email addresses
- # Now do the mail command
-
- if verbose:
- print 'Mailing %s...' % string.join(people, COMMASPACE)
-
- if specs == ['-', 'Imported', 'sources']:
- return
- if specs[-3:] == ['-', 'New', 'directory']:
- del specs[-3:]
- elif len(specs) > 2:
- L = specs[:2]
- for s in specs[2:]:
- prev = L[-1]
- if string.count(prev, ',') < 2:
- L[-1] = "%s %s" % (prev, s)
- else:
- L.append(s)
- specs = L
-
- if verbose:
- print 'Generating notification message...'
- blast_mail(subject, people, specs[1:], contextlines, fromhost)
- if verbose:
- print 'Generating notification message... done.'
-
-
-\f
-if __name__ == '__main__':
- main()
- sys.exit(0)