From: Max H. <fin...@us...> - 2002-03-31 17:49:20
|
Update of /cvsroot/fink/web/pdb In directory usw-pr-cvs1:/tmp/cvs-serv22683 Modified Files: package.php Log Message: parse email address from the maintainer field and use it to make a mailto hyperlink Index: package.php =================================================================== RCS file: /cvsroot/fink/web/pdb/package.php,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- package.php 1 Oct 2001 14:17:08 -0000 1.8 +++ package.php 31 Mar 2002 17:49:15 -0000 1.9 @@ -45,7 +45,22 @@ it_item("Description:", $row[desclong]); it_item("Section:", '<a href="'.$pdbroot.'section.php/'.$row[section].'">'.$row[section].'</a>'); - it_item("Maintainer:", $row[maintainer] ? $row[maintainer] : "unknown"); + + // Get the maintainer field, and try to parse out the email address + if ($row[maintainer]) { + $maintainer = $row[maintainer]; + preg_match("/^(.+?)\s*<(\S+)>/", $maintainer, $matches); + $maintainer = $matches[1]; + $email = $matches[2]; + } else { + $maintainer = "unknown"; + } + // If there was an email specified, make the maintainer field a mailto: link + if ($email) { + it_item("Maintainer:", '<a href="mailto:'.$email.'">'.$maintainer.'</a>'); + } else { + it_item("Maintainer:", $maintainer); + } if ($row[homepage]) { it_item("Website:", '<a href="'.$row[homepage].'">'.$row[homepage].'</a>'); } |