dvpbrowse/html/dvp/dvp.php

630 lines
17 KiB
PHP
Raw Permalink Normal View History

2008-09-04 17:59:29 +02:00
<?
// $RCSfile: dvp.php,v $
// $Revision: 1.1 $
// $Name: $
// $Date: 2008/09/04 16:00:45 $
// $Author: agibert $
/*
* DvpBrowse - Development Project Browser
* Copyright (C) 2008 Arnaud G. Gibert
* mailto:arnaud@rx3.net
* http://www.rx3.org/dvp/dvpbrowse
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
$time_start = microtime_float();
include "/var/httpd/www.rx3.org/html/dvp/dvp_config.inc";
$dvp_myname="DvpBrowse";
$dvp_tag_tab=explode( " ", "$Name: $");
$dvp_tag_tab=explode( "-", $dvp_tag_tab[1]);
$dvp_myver=strtr( "$dvp_tag_tab[1]-$dvp_tag_tab[2]", "_", ".");
/*--------------------------------------------------------------------------------------------------------------------*/
/* */
/*--------------------------------------------------------------------------------------------------------------------*/
function dvp_get_section( $dvp_id_lookup)
{
global $dvp_tab;
foreach( $dvp_tab as $section_id => $value)
{
$dvp=$dvp_tab[$section_id]["dvp"];
foreach( $dvp as $dvp_id => $value)
{
if( $dvp_id == $dvp_id_lookup)
{
return $section_id;
}
}
}
return "";
}
/*--------------------------------------------------------------------------------------------------------------------*/
/* */
/*--------------------------------------------------------------------------------------------------------------------*/
function dvp_get_name( $dvp_id_lookup)
{
global $dvp_tab;
foreach( $dvp_tab as $section_id => $value)
{
$dvp=$dvp_tab[$section_id]["dvp"];
foreach( $dvp as $dvp_id => $value)
{
if( $dvp_id == $dvp_id_lookup)
{
return $dvp[$dvp_id]["name"];
}
}
}
return "";
}
/*--------------------------------------------------------------------------------------------------------------------*/
/* */
/*--------------------------------------------------------------------------------------------------------------------*/
function dvp_get_reqby( $dvp_id_lookup)
{
global $dvp_tab;
foreach( $dvp_tab as $section_id => $value)
{
$dvp=$dvp_tab[$section_id]["dvp"];
foreach( $dvp as $dvp_id => $value)
{
$depend=$dvp[$dvp_id]["depend"];
if( $depend != "")
{
foreach( $depend as $depend_id)
{
if( $depend_id == $dvp_id_lookup)
{
$reqby[]=$dvp_id;
}
}
}
}
}
return $reqby;
}
/*--------------------------------------------------------------------------------------------------------------------*/
/* */
/*--------------------------------------------------------------------------------------------------------------------*/
function dvp_main_header( $name)
{
$page_name="$name";
$page_title="$page_name !";
global $dvp_tab;
global $dvp_header;
global $dvp_keywords;
$keywords="$dvp_keywords";
foreach( $dvp_tab as $section_id => $value)
{
foreach( $dvp_tab[$section_id]["dvp"] as $dvp_id => $value)
{
$keywords="$keywords,$dvp_id";
}
}
include "$dvp_header";
echo " <META NAME=\"keywords\" CONTENT=\"$keywords\">
<TITLE>$page_name</TITLE>
</HEAD>
<BODY>
<H1>$page_title</H1>
<H5><A HREF=\"..\">Rx3.Org Main Page</A></H5>
<HR>
";
}
/*--------------------------------------------------------------------------------------------------------------------*/
/* */
/*--------------------------------------------------------------------------------------------------------------------*/
function dvp_main_body( $dvp_tab)
{
global $dvp_download_http_url;
global $dvp_download_ftp_url;
global $dvp_cvsweb_url;
echo " <P>
<BR>
<BR>
</P>
";
foreach( $dvp_tab as $section_id => $value)
{
$section_name=$dvp_tab[$section_id]["name"];
$dvp=$dvp_tab[$section_id]["dvp"];
echo " <H3>$section_name</H3>
<UL>
";
foreach( $dvp as $dvp_id => $value)
{
$dvp_name=$dvp[$dvp_id]["name"];
$dvp_summary=$dvp[$dvp_id]["summary"];
$dvp_listbrk=$dvp[$dvp_id]["listbrk"];
if( $dvp_listbrk == "yes")
{
$dvp_cl="chap1";
}
else
{
$dvp_cl="chap2";
}
echo " <LI CLASS=\"$dvp_cl\"><A HREF=\"?dvp=$dvp_id\">$dvp_name</A>: $dvp_summary</LI>
";
}
echo " </UL>
<P>
<BR>
<BR>
</P>
";
}
echo "
<HR>
<H5>";
echo "<A HREF=\"$dvp_download_http_url\">Rx3 Free Software Development HTTP download page</A>&nbsp;&nbsp;&nbsp;";
echo "<A HREF=\"$dvp_download_ftp_url\">Rx3 Free Software Development FTP download page</A>&nbsp;&nbsp;&nbsp;";
echo "<A HREF=\"$dvp_cvsweb_url\">Rx3 Free Software CVS Web</A></H5>
";
}
/*--------------------------------------------------------------------------------------------------------------------*/
/* */
/*--------------------------------------------------------------------------------------------------------------------*/
function dvp_main_page()
{
global $dvp_tab;
dvp_main_header( "Rx3 Free Software Development Main Page");
dvp_main_body( $dvp_tab);
dvp_footer();
}
/*--------------------------------------------------------------------------------------------------------------------*/
/* */
/*--------------------------------------------------------------------------------------------------------------------*/
function dvp_header( $id, $name, $summary, $curver)
{
$page_name="$name Home Page";
$page_title="$page_name !";
global $dvp_url;
global $dvp_header;
global $dvp_keywords;
$keywords="$dvp_keywords,$id";
include "$dvp_header";
echo " <META NAME=\"keywords\" CONTENT=\"$keywords\">
<TITLE>$page_name</TITLE>
</HEAD>
<BODY>
<H1>$page_title</H1>
<H4>$summary</H4>
<H4>$curver</H4>
<H5><A HREF=\"..\">Rx3.Org Main Page</A>&nbsp;&nbsp;/&nbsp;&nbsp;<A HREF=\"$dvp_url\">Rx3 Free Software Development Main Page</A></H5>
<HR>
";
}
/*--------------------------------------------------------------------------------------------------------------------*/
/* */
/*--------------------------------------------------------------------------------------------------------------------*/
function dvp_body( $id, $name, $description, $depend, $freshmeat, $curver)
{
global $dvp_download_http_url;
global $dvp_download_ftp_url;
global $dvp_cvsweb_url;
global $dvp_freshmeat_url;
echo " <P>
<BR>
<BR>
$description
<BR>
<BR>
";
if( $depend != "")
{
echo " <BR>
</P>
<H5>Dependend on:</H5>
<P>
";
foreach( $depend as $dep_id)
{
$dep_name=dvp_get_name( $dep_id);
echo "<A HREF=\"?dvp=$dep_id\">$dep_name</A>&nbsp;&nbsp;&nbsp;";
}
}
$reqby=dvp_get_reqby( $id);
if( $reqby != "")
{
echo " <BR>
</P>
<H5>Required by:</H5>
<P>
";
foreach( $reqby as $dep_id)
{
$dep_name=dvp_get_name( $dep_id);
echo "<A HREF=\"?dvp=$dep_id\">$dep_name</A>&nbsp;&nbsp;&nbsp;";
}
}
echo " </P>
";
if( $curver != "")
{
$cmd="tar xOzf download/$id/$id-$curver.src.tgz $id-$curver/ReleaseNotes.txt|awk 'BEGIN {go=0; skip=0;} /---------/ {go+=1; skip=1} /^$/ {if(go > 0) go+=1;} {if( ( skip != 1) && ( go > 0) && ( go < 4)) { print $0;} else skip=0;}'";
exec( $cmd, $rn_tab);
echo " <P>
<BR>
</P>
<HR>
<H5>Last Release Notes:&nbsp;&nbsp;&nbsp;$rn_tab[0]</H5>
";
echo " <PRE>
";
for( $i = 1; $i < count($rn_tab); $i++)
{
echo "$rn_tab[$i]\n";
}
echo " </PRE>
";
}
echo" <HR>
<H5>";
if( $curver != "")
{
echo "<A HREF=\"?dvp=$id&amp;rn=yes\">$name release notes page</A>&nbsp;&nbsp;&nbsp;";
echo "<A HREF=\"?dvp=$id&amp;rm=yes\">$name readme page</A>&nbsp;&nbsp;&nbsp;";
}
echo "<A HREF=\"$dvp_download_http_url/$id\">$name HTTP download page</A>&nbsp;&nbsp;&nbsp;";
echo "<A HREF=\"$dvp_download_ftp_url/$id\">$name FTP download page</A>&nbsp;&nbsp;&nbsp;";
echo "<A HREF=\"$dvp_cvsweb_url/$id\">$name CVS Web</A>";
if( $freshmeat == "yes")
{
echo "&nbsp;&nbsp;&nbsp;<A HREF=\"$dvp_freshmeat_url/$id/\">$name FreshMeat page</A>
";
}
echo "</H5>";
}
/*--------------------------------------------------------------------------------------------------------------------*/
/* */
/*--------------------------------------------------------------------------------------------------------------------*/
function dvp_footer()
{
global $dvp_myname;
global $dvp_myver;
global $dvp_footer;
global $time_start;
include "$dvp_footer";
$time_stop = microtime_float();
$time_elaps = intval( ( $time_stop - $time_start) * 1000) / 1000;
echo " </P>
";
echo " <H6>Page generated in $time_elaps seconds by $dvp_myname V $dvp_myver</H6>";
echo" </BODY>
</HTML>
";
}
/*--------------------------------------------------------------------------------------------------------------------*/
/* */
/*--------------------------------------------------------------------------------------------------------------------*/
function dvp_page( $dvp_id, $dvp_name, $dvp_summary, $dvp_description, $depend, $dvp_freshmeat)
{
$cmd="ls download/$dvp_id/$dvp_id*.src.tgz | sed -e 's/.*$dvp_id-//' -e 's/.src.tgz//'";
$dvp_curver=exec($cmd);
dvp_header( $dvp_id, $dvp_name, $dvp_summary, $dvp_curver);
dvp_body( $dvp_id, $dvp_name, $dvp_description, $depend, $dvp_freshmeat, $dvp_curver);
dvp_footer();
}
/*--------------------------------------------------------------------------------------------------------------------*/
/* */
/*--------------------------------------------------------------------------------------------------------------------*/
function dvp_rn_header( $id, $name, $curver)
{
$page_name="$name Release Notes Page";
$page_title="$page_name";
global $dvp_url;
global $dvp_header;
global $dvp_keywords;
$keywords="$dvp_keywords,$id, $id release notes";
include "$dvp_header";
echo " <META NAME=\"keywords\" CONTENT=\"$keywords\">
<TITLE>$page_name</TITLE>
</HEAD>
<BODY>
<H1>$page_title</H1>
<H4>$curver</H4>
<H5><A HREF=\"..\">Rx3.Org Main Page</A>&nbsp;&nbsp;/&nbsp;&nbsp;<A HREF=\"$dvp_url\">Rx3 Free Software Development Main Page</A>&nbsp;&nbsp;/&nbsp;&nbsp;<A HREF=\"$dvp_url?dvp=$id\">$name Home Page</A></H5>
<HR>
";
}
/*--------------------------------------------------------------------------------------------------------------------*/
/* */
/*--------------------------------------------------------------------------------------------------------------------*/
function dvp_rn_body( $id, $name, $curver)
{
if( $curver != "")
{
$cmd="tar xOzf download/$id/$id-$curver.src.tgz $id-$curver/ReleaseNotes.txt";
exec( $cmd, $rn_tab);
echo " <PRE>
";
for( $i = 1; $i < count($rn_tab); $i++)
{
echo "$rn_tab[$i]\n";
}
}
echo " </PRE>
";
}
/*--------------------------------------------------------------------------------------------------------------------*/
/* */
/*--------------------------------------------------------------------------------------------------------------------*/
function dvp_rn_page( $dvp_id, $dvp_name)
{
$cmd="ls download/$dvp_id/$dvp_id*.src.tgz | sed -e 's/.*$dvp_id-//' -e 's/.src.tgz//'";
$dvp_curver=exec($cmd);
dvp_rn_header( $dvp_id, $dvp_name, $dvp_curver);
dvp_rn_body( $dvp_id, $dvp_name, $dvp_curver);
dvp_footer();
}
/*--------------------------------------------------------------------------------------------------------------------*/
/* */
/*--------------------------------------------------------------------------------------------------------------------*/
function dvp_rm_header( $id, $name, $curver)
{
$page_name="$name Read Me Page";
$page_title="$page_name";
global $dvp_url;
global $dvp_header;
global $dvp_keywords;
$keywords="$dvp_keywords,$id, $id release notes";
include "$dvp_header";
echo " <META NAME=\"keywords\" CONTENT=\"$keywords\">
<TITLE>$page_name</TITLE>
</HEAD>
<BODY>
<H1>$page_title</H1>
<H4>$curver</H4>
<H5><A HREF=\"..\">Rx3.Org Main Page</A>&nbsp;&nbsp;/&nbsp;&nbsp;<A HREF=\"$dvp_url\">Rx3 Free Software Development Main Page</A>&nbsp;&nbsp;/&nbsp;&nbsp;<A HREF=\"$dvp_url?dvp=$id\">$name Home Page</A></H5>
<HR>
";
}
/*--------------------------------------------------------------------------------------------------------------------*/
/* */
/*--------------------------------------------------------------------------------------------------------------------*/
function dvp_rm_body( $id, $name, $curver)
{
if( $curver != "")
{
$cmd="tar xOzf download/$id/$id-$curver.src.tgz $id-$curver/ReadMe.txt";
exec( $cmd, $rm_tab);
echo " <PRE>
";
for( $i = 1; $i < count($rm_tab); $i++)
{
echo "$rm_tab[$i]\n";
}
}
echo " </PRE>
";
}
/*--------------------------------------------------------------------------------------------------------------------*/
/* */
/*--------------------------------------------------------------------------------------------------------------------*/
function dvp_rm_page( $dvp_id, $dvp_name)
{
$cmd="ls download/$dvp_id/$dvp_id*.src.tgz | sed -e 's/.*$dvp_id-//' -e 's/.src.tgz//'";
$dvp_curver=exec($cmd);
dvp_rm_header( $dvp_id, $dvp_name, $dvp_curver);
dvp_rm_body( $dvp_id, $dvp_name, $dvp_curver);
dvp_footer();
}
/*--------------------------------------------------------------------------------------------------------------------*/
/* */
/*--------------------------------------------------------------------------------------------------------------------*/
if( $_GET["dvp"] == "")
{
dvp_main_page( $dvp_tab);
}
else
{
$dvp_id=$_GET["dvp"];
$section_id=dvp_get_section( $dvp_id);
$dvp_name=$dvp_tab[$section_id]["dvp"][$dvp_id]["name"];
if( $_GET["rn"] == "yes")
{
dvp_rn_page( $dvp_id, $dvp_name);
}
else
{
if( $_GET["rm"] == "yes")
{
dvp_rm_page( $dvp_id, $dvp_name);
}
else
{
$dvp_summary=$dvp_tab[$section_id]["dvp"][$dvp_id]["summary"];
$dvp_description=$dvp_tab[$section_id]["dvp"][$dvp_id]["description"];
$dvp_depend=$dvp_tab[$section_id]["dvp"][$dvp_id]["depend"];
$dvp_freshmeat=$dvp_tab[$section_id]["dvp"][$dvp_id]["freshmeat"];
dvp_page( $dvp_id, $dvp_name, $dvp_summary, $dvp_description, $dvp_depend, $dvp_freshmeat);
}
}
}
?>