2004-12-11 22:33:01 +00:00
< ? php
2004-12-11 03:25:13 +00:00
/**********************************/
/* code to display an application */
/**********************************/
2004-03-15 16:22:00 +00:00
2004-12-25 20:08:00 +00:00
/*
2004-12-27 23:54:55 +00:00
* application environment
2004-03-15 16:22:00 +00:00
*/
include ( " path.php " );
2005-02-02 00:35:49 +00:00
require ( BASE . " include/incl.php " );
require ( BASE . " include/application.php " );
require ( BASE . " include/appdb.php " );
require ( BASE . " include/vote.php " );
require ( BASE . " include/category.php " );
require ( BASE . " include/maintainer.php " );
2005-07-13 01:16:37 +00:00
require ( BASE . " include/mail.php " );
2004-11-09 22:41:18 +00:00
2004-03-15 16:22:00 +00:00
2005-02-19 01:23:02 +00:00
$oApp = new Application ( $_REQUEST [ 'appId' ]);
$oVersion = new Version ( $_REQUEST [ 'versionId' ]);
2004-12-11 03:25:13 +00:00
/**
2004-12-29 20:21:31 +00:00
* display the full path of the Category we are looking at
2004-12-11 03:25:13 +00:00
*/
2004-12-25 20:11:13 +00:00
function display_catpath ( $catId , $appId , $versionId = '' )
2004-03-15 16:22:00 +00:00
{
$cat = new Category ( $catId );
2004-12-25 20:11:13 +00:00
$catFullPath = make_cat_path ( $cat -> getCategoryPath (), $appId , $versionId );
2004-03-15 16:22:00 +00:00
echo html_frame_start ( " " , '98%' , '' , 2 );
2004-12-29 20:21:31 +00:00
echo " <p><b>Category: " . $catFullPath . " </b><br /> \n " ;
2004-03-15 16:22:00 +00:00
echo html_frame_end ();
}
2004-12-11 03:25:13 +00:00
/**
* display the SUB apps that belong to this app
*/
2004-03-15 16:22:00 +00:00
function display_bundle ( $appId )
{
2005-02-07 23:21:33 +00:00
$oApp = new Application ( $appId );
2005-01-05 05:29:42 +00:00
$result = query_appdb ( " SELECT appFamily.appId, appName, description FROM appBundle, appFamily " .
2005-02-19 01:21:14 +00:00
" WHERE appFamily.queued='false' AND bundleId = $appId AND appBundle.appId = appFamily.appId " );
2004-03-15 16:22:00 +00:00
if ( ! $result || mysql_num_rows ( $result ) == 0 )
2004-12-11 03:25:13 +00:00
{
return ; // do nothing
}
2004-03-15 16:22:00 +00:00
echo html_frame_start ( " " , " 98% " , " " , 0 );
2005-02-11 23:42:50 +00:00
echo " <table width= \" 100% \" border= \" 0 \" cellpadding= \" 3 \" cellspacing= \" 1 \" > \n \n " ;
2004-03-15 16:22:00 +00:00
2005-02-11 23:42:50 +00:00
echo " <tr class= \" color4 \" > \n " ;
2005-02-09 23:48:31 +00:00
echo " <td>Application Name</td> \n " ;
echo " <td>Description</td> \n " ;
2004-03-15 16:22:00 +00:00
echo " </tr> \n \n " ;
$c = 0 ;
2004-12-11 03:25:13 +00:00
while ( $ob = mysql_fetch_object ( $result )) {
//set row color
$bgcolor = ( $c % 2 == 0 ) ? " color0 " : " color1 " ;
2004-03-15 16:22:00 +00:00
2004-12-11 03:25:13 +00:00
//display row
2005-02-11 23:42:50 +00:00
echo " <tr class= \" $bgcolor\ " > \n " ;
echo " <td><a href= \" appview.php?appId= $ob->appId\ " > " .stripslashes( $ob->appName ). " </ a ></ td > \n " ;
2005-02-07 23:21:33 +00:00
echo " <td> " . trim_description ( $oApp -> sDescription ) . " </td> \n " ;
2004-12-11 03:25:13 +00:00
echo " </tr> \n \n " ;
2004-03-15 16:22:00 +00:00
2004-12-11 03:25:13 +00:00
$c ++ ;
}
2004-03-15 16:22:00 +00:00
echo " </table> \n \n " ;
echo html_frame_end ();
}
2004-12-29 03:48:47 +00:00
/* Show note */
function show_note ( $sType , $oData ){
2005-02-19 01:23:02 +00:00
global $oVersion ;
2004-12-29 03:48:47 +00:00
switch ( $sType )
{
case 'WARNING' :
$color = 'red' ;
$title = 'Warning' ;
break ;
2004-03-15 16:22:00 +00:00
2004-12-29 03:48:47 +00:00
case 'HOWTO' ;
$color = 'green' ;
$title = 'HOWTO' ;
break ;
default :
2004-12-11 03:25:13 +00:00
2004-12-29 03:48:47 +00:00
if ( ! empty ( $oData -> noteTitle ))
$title = $oData -> noteTitle ;
else
$title = 'Note' ;
$color = 'blue' ;
2004-03-15 16:22:00 +00:00
}
2004-12-29 03:48:47 +00:00
$s = html_frame_start ( " " , " 98% " , '' , 0 );
2005-02-11 23:42:50 +00:00
$s .= " <table width= \" 100% \" border= \" 0 \" cellspacing= \" 0 \" > \n " ;
2005-02-14 18:22:04 +00:00
$s .= " <tr bgcolor= \" " . $color . " \" align= \" center \" valign= \" top \" ><td><b> " . $title . " </b></td></tr> \n " ;
2005-02-11 23:42:50 +00:00
$s .= " <tr><td class= \" note \" > \n " ;
2005-02-05 17:08:10 +00:00
$s .= $oData -> noteDesc ;
2004-12-29 03:48:47 +00:00
$s .= " </td></tr> \n " ;
2005-02-19 01:23:02 +00:00
if ( $_SESSION [ 'current' ] -> hasPriv ( " admin " ) || $_SESSION [ 'current' ] -> isMaintainer ( $oVersion -> iVersionId ) || $_SESSION [ 'current' ] -> isSuperMaintainer ( $oVersion -> iAppId ))
2004-12-11 03:25:13 +00:00
{
2005-02-14 18:22:04 +00:00
$s .= " <tr class= \" color1 \" align= \" center \" valign= \" top \" ><td> " ;
2005-02-11 23:42:50 +00:00
$s .= " <form method= \" post \" name= \" message \" action= \" admin/editAppNote.php?noteId= { $oData -> noteId } \" > " ;
$s .= '<input type="submit" value="Edit Note" class="button">' ;
2004-12-29 03:48:47 +00:00
$s .= '</form></td></tr>' ;
2004-12-11 03:25:13 +00:00
}
2004-03-15 16:22:00 +00:00
2004-12-29 03:48:47 +00:00
$s .= " </table> \n " ;
$s .= html_frame_end ();
return $s ;
2004-03-15 16:22:00 +00:00
}
2005-02-02 03:01:29 +00:00
if ( ! is_numeric ( $_REQUEST [ 'appId' ]) && ! is_numeric ( $_REQUEST [ 'versionId' ]))
2004-12-27 05:18:41 +00:00
{
2005-02-02 03:01:29 +00:00
errorpage ( " Something went wrong with the application or version id " );
2004-12-27 05:18:41 +00:00
exit ;
}
2005-07-13 01:16:37 +00:00
if ( $_REQUEST [ 'sub' ])
{
if (( $_REQUEST [ 'sub' ] == 'delete' ) && ( $_REQUEST [ 'buglinkId' ]))
{
if (( $_SESSION [ 'current' ] -> hasPriv ( " admin " ) ||
$_SESSION [ 'current' ] -> isMaintainer ( $oVersion -> iVersionId ) ||
$_SESSION [ 'current' ] -> isSuperMaintainer ( $oVersion -> iAppId )))
{
$oBuglink = new bug ( $_REQUEST [ 'buglinkId' ]);
$oBuglink -> delete ();
redirect ( apidb_fullurl ( " appview.php?versionId= " . $_REQUEST [ 'versionId' ]));
exit ;
}
}
if (( $_REQUEST [ 'sub' ] == 'unqueue' ) && ( $_REQUEST [ 'buglinkId' ]))
{
if (( $_SESSION [ 'current' ] -> hasPriv ( " admin " ) ||
$_SESSION [ 'current' ] -> isMaintainer ( $oVersion -> iVersionId ) ||
$_SESSION [ 'current' ] -> isSuperMaintainer ( $oVersion -> iAppId )))
{
$oBuglink = new bug ( $_REQUEST [ 'buglinkId' ]);
$oBuglink -> unqueue ();
redirect ( apidb_fullurl ( " appview.php?versionId= " . $_REQUEST [ 'versionId' ]));
exit ;
}
}
if (( $_REQUEST [ 'sub' ] == 'Submit a new bug link.' ) && ( $_REQUEST [ 'buglinkId' ]))
{
$oBuglink = new bug ();
$oBuglink -> create ( $_REQUEST [ 'versionId' ], $_REQUEST [ 'buglinkId' ]);
redirect ( apidb_fullurl ( " appview.php?versionId= " . $_REQUEST [ 'versionId' ]));
exit ;
}
2004-12-27 05:18:41 +00:00
2005-07-13 01:16:37 +00:00
}
2005-02-06 17:49:48 +00:00
/**
* We want to see an application family ( = no version ) .
*/
2005-02-02 03:01:29 +00:00
if ( $_REQUEST [ 'appId' ])
2004-03-15 20:39:12 +00:00
{
2005-02-06 17:49:48 +00:00
$oApp = new Application ( $_REQUEST [ 'appId' ]);
2004-03-15 16:22:00 +00:00
2004-12-11 03:25:13 +00:00
// show Vote Menu
2005-01-30 23:12:48 +00:00
if ( $_SESSION [ 'current' ] -> isLoggedIn ())
2004-12-10 00:18:01 +00:00
apidb_sidebar_add ( " vote_menu " );
2004-03-15 16:22:00 +00:00
2004-12-10 00:18:01 +00:00
// header
2005-02-06 17:49:48 +00:00
apidb_header ( " Viewing App - " . $oApp -> sName );
2004-03-15 16:22:00 +00:00
2004-12-11 03:25:13 +00:00
// cat display
2005-02-06 17:49:48 +00:00
display_catpath ( $oApp -> iCatId , $oApp -> iAppId );
2004-03-15 16:22:00 +00:00
2004-12-11 03:25:13 +00:00
// set Vendor
2005-02-07 23:21:33 +00:00
$oVendor = new Vendor ( $oApp -> iVendorId );
2004-03-15 16:22:00 +00:00
2004-12-11 03:25:13 +00:00
// set URL
2005-02-21 01:41:02 +00:00
$appLinkURL = ( $oApp -> sWebpage ) ? " <a href= \" " . $oApp -> sWebpage . " \" > " . substr ( stripslashes ( $oApp -> sWebpage ), 0 , 30 ) . " </a> " : " " ;
2004-12-11 03:25:13 +00:00
// start display application
2004-12-10 00:18:01 +00:00
echo html_frame_start ( " " , " 98% " , " " , 0 );
echo " <tr><td class=color4 valign=top> \n " ;
echo " <table> \n " ;
echo " <tr><td> \n " ;
2005-02-11 23:42:50 +00:00
echo ' <table width="250" border="0" cellpadding="3" cellspacing="1">' , " \n " ;
2005-02-06 17:49:48 +00:00
echo " <tr class=color0 valign=top><td width= \" 100 \" ><b>Name</b></td><td width='100%'> " . $oApp -> sName . " </td> \n " ;
2005-02-02 00:35:49 +00:00
echo " <tr class= \" color1 \" ><td><b>Vendor</b></td><td> " .
2005-02-07 23:21:33 +00:00
" <a href='vendorview.php?vendorId= $oVendor->iVendorId '> " . $oVendor -> sName . " </a> \n " ;
2005-02-02 00:35:49 +00:00
echo " <tr class= \" color0 \" ><td><b>Votes</b></td><td> " ;
2005-02-06 17:49:48 +00:00
echo vote_count_app_total ( $oApp -> iAppId );
2004-12-28 00:05:00 +00:00
echo " </td></tr> \n " ;
2004-12-11 03:25:13 +00:00
// main URL
2005-02-02 00:35:49 +00:00
echo " <tr class= \" color1 \" ><td><b>URL</b></td><td> " . $appLinkURL . " </td></tr> \n " ;
2004-12-11 03:25:13 +00:00
2005-02-06 22:50:08 +00:00
// optional links
$result = query_appdb ( " SELECT * FROM appData WHERE appId = " . $_REQUEST [ 'appId' ] . " AND versionID = 0 AND type = 'url' " );
if ( $result && mysql_num_rows ( $result ) > 0 )
{
echo " <tr class= \" color1 \" ><td> <b>Links</b></td><td> \n " ;
while ( $ob = mysql_fetch_object ( $result ))
{
echo " <a href=' $ob->url '> " . substr ( stripslashes ( $ob -> description ), 0 , 30 ) . " </a> <br /> \n " ;
}
echo " </td></tr> \n " ;
}
2004-12-11 03:25:13 +00:00
// image
2005-02-06 17:49:48 +00:00
$img = get_screenshot_img ( $oApp -> iAppId );
2005-02-11 23:42:50 +00:00
echo " <tr><td align= \" center \" colspan= \" 2 \" > $img </td></tr> \n " ;
2004-12-11 03:25:13 +00:00
2004-12-10 00:18:01 +00:00
echo " </table> \n " ; /* close of name/vendor/bugs/url table */
2004-12-06 23:12:23 +00:00
2004-12-10 00:18:01 +00:00
echo " </td></tr> \n " ;
echo " <tr><td> \n " ;
2004-12-06 23:12:23 +00:00
2004-12-10 00:18:01 +00:00
// Display all supermaintainers maintainers of this application
2005-02-11 23:42:50 +00:00
echo " <table class= \" color4 \" width= \" 250 \" border= \" 1 \" > \n " ;
echo " <tr><td align= \" left \" ><b>Super maintainers:</b></td></tr> \n " ;
2005-02-06 17:49:48 +00:00
$other_maintainers = getSuperMaintainersUserIdsFromAppId ( $oApp -> iAppId );
2004-12-10 00:18:01 +00:00
if ( $other_maintainers )
{
2005-02-11 23:42:50 +00:00
echo " <tr><td align= \" left \" ><ul> \n " ;
2005-02-17 01:01:01 +00:00
while ( list ( $index , $userIdValue ) = each ( $other_maintainers ))
2004-12-10 00:18:01 +00:00
{
2005-01-30 23:12:48 +00:00
$oUser = new User ( $userIdValue );
2005-02-11 23:42:50 +00:00
echo " <li> " . $oUser -> sRealname . " </li> \n " ;
2004-12-10 00:18:01 +00:00
}
2005-02-11 23:42:50 +00:00
echo " </ul></td></tr> \n " ;
2004-12-10 00:18:01 +00:00
} else
{
echo " <tr><td align=right>No maintainers.Volunteer today!</td></tr> \n " ;
}
2004-03-15 16:22:00 +00:00
2004-12-10 00:18:01 +00:00
// Display the app maintainer button
2005-02-11 23:42:50 +00:00
echo ' <tr><td align="center">' ;
2005-01-30 23:12:48 +00:00
if ( $_SESSION [ 'current' ] -> isLoggedIn ())
2004-12-10 00:18:01 +00:00
{
/* are we already a maintainer? */
2005-02-06 17:49:48 +00:00
if ( $_SESSION [ 'current' ] -> isSuperMaintainer ( $oApp -> iAppId )) /* yep */
2004-12-10 00:18:01 +00:00
{
2005-02-09 02:19:24 +00:00
echo ' <form method="post" name="message" action="maintainerdelete.php"><input type=submit value="Remove yourself as a super maintainer" class="button">' ;
2004-12-10 00:18:01 +00:00
} else /* nope */
{
2005-02-11 01:35:39 +00:00
echo ' <form method="post" name="message" action="maintainersubmit.php"><input type="submit" value="Be a super maintainer of this app" class="button" title="Click here to know more about super maintainers.">' ;
2004-12-10 00:18:01 +00:00
}
2004-03-15 16:22:00 +00:00
2005-02-06 17:49:48 +00:00
echo " <input type= \" hidden \" name= \" appId \" value= \" " . $oApp -> iAppId . " \" > " ;
2005-02-02 03:01:29 +00:00
echo " <input type= \" hidden \" name= \" superMaintainer \" value= \" 1 \" > " ; /* set superMaintainer to 1 because we are at the appFamily level */
2004-12-10 00:18:01 +00:00
echo " </form> " ;
2005-01-29 00:52:49 +00:00
2005-02-06 17:49:48 +00:00
if ( $_SESSION [ 'current' ] -> isSuperMaintainer ( $oApp -> iAppId ) || $_SESSION [ 'current' ] -> hasPriv ( " admin " ))
2005-01-29 00:52:49 +00:00
{
2005-02-11 01:35:39 +00:00
echo ' <form method="post" name="edit" action="admin/editAppFamily.php"><input type="hidden" name="appId" value="' . $_REQUEST [ 'appId' ] . '"><input type="submit" value="Edit Application" class="button"></form>' ;
2005-02-09 02:19:24 +00:00
}
if ( $_SESSION [ 'current' ] -> isLoggedIn ())
{
2005-02-11 23:42:50 +00:00
echo '<form method="post" name="message" action="appsubmit.php?appId=' . $oApp -> iAppId . '&apptype=2">' ;
2005-05-14 00:43:33 +00:00
echo '<input type=submit value="Submit new version" class="button">' ;
2005-01-29 00:52:49 +00:00
echo '</form>' ;
}
2005-01-30 23:12:48 +00:00
if ( $_SESSION [ 'current' ] -> hasPriv ( " admin " ))
2005-01-29 00:52:49 +00:00
{
2005-02-11 23:42:50 +00:00
$url = BASE . " admin/deleteAny.php?what=appFamily&appId= " . $oApp -> iAppId . " &confirmed=yes " ;
2005-02-02 04:42:19 +00:00
echo " <form method= \" post \" name= \" edit \" action= \" javascript:deleteURL('Are you sure?', ' " . $url . " ') \" ><input type= \" submit \" value= \" Delete App \" class= \" button \" ></form> " ;
2005-02-06 17:49:48 +00:00
echo ' <form method="post" name="edit" action="admin/editBundle.php"><input type="hidden" name="bundleId" value="' . $oApp -> iAppId . '"><input type="submit" value="Edit Bundle" class="button"></form>' ;
2005-01-29 00:52:49 +00:00
}
2004-12-10 00:18:01 +00:00
} else
{
2005-02-04 03:32:52 +00:00
echo '<form method="post" action="account.php?cmd=login"><input type="submit" value="Log in to become a super maintainer" class="button"></form>' ;
2004-12-10 00:18:01 +00:00
}
2005-02-11 23:42:50 +00:00
echo " </td></tr> \n " ;
2004-12-10 00:18:01 +00:00
echo " </table> \n " ; /* close of super maintainers table */
echo " </td></tr> \n " ;
echo " </table> \n " ; /* close the table that contains the whole left hand side of the upper table */
2004-03-15 16:22:00 +00:00
2004-12-11 03:25:13 +00:00
// description
2004-12-10 00:18:01 +00:00
echo " <td class=color2 valign=top width='100%'> \n " ;
2005-02-02 03:01:29 +00:00
echo " <table width='100%' border=0><tr><td width='100%' valign=top><span class= \" title \" >Description</span> \n " ;
2005-02-06 17:49:48 +00:00
echo $oApp -> sDescription ;
2004-12-10 00:18:01 +00:00
echo " </td></tr></table> \n " ;
echo html_frame_end ( " For more details and user comments, view the versions of this application. " );
2004-12-11 03:25:13 +00:00
// display versions
2005-02-06 17:49:48 +00:00
display_versions ( $oApp -> iAppId , $oApp -> aVersionsIds );
2004-12-10 00:18:01 +00:00
2004-12-11 03:25:13 +00:00
// display bundle
2005-02-06 17:49:48 +00:00
display_bundle ( $oApp -> iAppId );
2004-12-10 00:18:01 +00:00
// disabled for now
2005-02-06 17:49:48 +00:00
//log_application_visit($oApp->iAppId);
2004-03-15 16:22:00 +00:00
}
2004-12-11 03:25:13 +00:00
2005-02-04 02:55:50 +00:00
/*
* We want to see a particular version .
*/
2005-02-02 03:01:29 +00:00
else if ( $_REQUEST [ 'versionId' ])
2004-03-15 16:22:00 +00:00
{
2005-02-06 17:49:48 +00:00
$oVersion = new Version ( $_REQUEST [ 'versionId' ]);
$oApp = new Application ( $oVersion -> iAppId );
if ( ! $oApp -> iAppId )
2004-11-17 23:02:07 +00:00
{
// Oops! application not found or other error. do something
errorpage ( 'Internal Database Access Error. No App found.' );
2004-12-11 03:25:13 +00:00
exit ;
2004-11-17 23:02:07 +00:00
}
2004-03-15 16:22:00 +00:00
2005-02-06 17:49:48 +00:00
if ( ! $oVersion -> iVersionId )
2004-11-17 23:02:07 +00:00
{
// Oops! Version not found or other error. do something
errorpage ( 'Internal Database Access Error. No Version Found.' );
2004-12-11 03:25:13 +00:00
exit ;
2004-11-17 23:02:07 +00:00
}
2004-03-15 16:22:00 +00:00
2004-11-17 23:02:07 +00:00
// header
2005-07-29 02:02:41 +00:00
apidb_header ( " Viewing App- " . $oApp -> sName . " Version - " . $oVersion -> sName );
2004-11-17 23:02:07 +00:00
2004-12-11 03:25:13 +00:00
// cat
2005-02-06 17:49:48 +00:00
display_catpath ( $oApp -> iCatId , $oApp -> iAppId , $oVersion -> iVersionId );
2004-12-11 03:25:13 +00:00
// set URL
2005-02-21 01:41:02 +00:00
$appLinkURL = ( $oApp -> sWebpage ) ? " <a href= \" " . $oApp -> sWebpage . " \" > " . substr ( stripslashes ( $oApp -> sWebpage ), 0 , 30 ) . " </a> " : " " ;
2004-03-15 16:22:00 +00:00
2004-12-11 03:25:13 +00:00
// start version display
2004-11-17 23:02:07 +00:00
echo html_frame_start ( " " , " 98% " , " " , 0 );
2005-02-11 23:42:50 +00:00
echo '<tr><td class="color4" valign="top">' , " \n " ;
echo '<table width="250" border="0" cellpadding="3" cellspacing="1">' , " \n " ;
echo " <tr class= \" color0 \" valign= \" top \" ><td width= \" 100 \" > <b>Name</b></td><td width= \" 100% \" > " . $oApp -> sName . " </td> \n " ;
echo " <tr class= \" color1 \" valign= \" top \" ><td><b>Version</b></td><td> " . $oVersion -> sName . " </td></tr> \n " ;
2005-02-02 00:35:49 +00:00
2005-02-21 01:41:02 +00:00
// main URL
echo " <tr class= \" color1 \" ><td><b>URL</b></td><td> " . $appLinkURL . " </td></tr> \n " ;
2005-02-02 00:35:49 +00:00
// links
2005-02-06 17:49:48 +00:00
$result = query_appdb ( " SELECT * FROM appData WHERE versionID = " . $oVersion -> iVersionId . " AND type = 'url' " );
2005-02-02 00:35:49 +00:00
if ( $result && mysql_num_rows ( $result ) > 0 )
{
echo " <tr class= \" color1 \" ><td><b>Links</b></td><td> \n " ;
while ( $ob = mysql_fetch_object ( $result ))
{
2005-02-11 23:42:50 +00:00
echo " <a href= \" $ob->url\ " > " .substr(stripslashes( $ob->description ),0,30). " </ a > < br /> \n " ;
2005-02-02 00:35:49 +00:00
}
echo " </td></tr> \n " ;
}
2004-03-15 16:22:00 +00:00
2004-12-11 03:25:13 +00:00
// rating Area
2005-02-11 23:42:50 +00:00
echo " <tr class= \" color1 \" valign= \" top \" ><td><b>Maintainer Rating</b></td><td> " . $oVersion -> sTestedRating . " </td></tr> \n " ;
echo " <tr class= \" color0 \" valign= \" top \" ><td><b>Maintainers Version</b></td><td> " . $oVersion -> sTestedRelease . " </td></tr> \n " ;
2005-01-05 05:22:41 +00:00
2004-12-11 03:25:13 +00:00
// image
2005-02-06 17:49:48 +00:00
$img = get_screenshot_img ( $oApp -> iAppId , $oVersion -> iVersionId );
2005-02-11 23:42:50 +00:00
echo " <tr><td align= \" center \" colspan= \" 2 \" > $img </td></tr> \n " ;
2004-11-09 22:41:18 +00:00
2004-12-11 03:25:13 +00:00
// display all maintainers of this application
2005-02-17 01:01:01 +00:00
echo " <tr class= \" color0 \" ><td align= \" left \" colspan= \" 2 \" ><b>Maintainers of this version:</b> \n " ;
2005-02-11 23:42:50 +00:00
echo " <table width= \" 250 \" border= \" 0 \" > " ;
2005-02-17 01:01:01 +00:00
$aMaintainers = getMaintainersUserIdsFromAppIdVersionId ( $oVersion -> iVersionId );
$aSupermaintainers = getSuperMaintainersUserIdsFromAppId ( $oVersion -> iAppId );
$aAllMaintainers = array_merge ( $aMaintainers , $aSupermaintainers );
$aAllMaintainers = array_unique ( $aAllMaintainers );
if ( sizeof ( $aAllMaintainers ) > 0 )
2004-11-09 22:41:18 +00:00
{
2005-02-11 23:42:50 +00:00
echo " <tr class= \" color0 \" ><td align= \" left \" colspan= \" 2 \" ><ul> " ;
2005-02-17 01:01:01 +00:00
while ( list ( $index , $userIdValue ) = each ( $aAllMaintainers ))
2004-11-09 22:41:18 +00:00
{
2005-02-02 00:13:12 +00:00
$oUser = new User ( $userIdValue );
2005-02-11 23:42:50 +00:00
echo " <li> " . $oUser -> sRealname . " </li> " ;
2004-11-09 22:41:18 +00:00
}
2005-02-11 23:42:50 +00:00
echo " </ul></td></tr> \n " ;
2004-11-09 22:41:18 +00:00
} else
{
echo " <tr class=color0><td align=right colspan=2> " ;
echo " No maintainers. Volunteer today!</td></tr> \n " ;
}
echo " </table></td></tr> " ;
2004-12-11 03:25:13 +00:00
// display the app maintainer button
2005-02-11 23:42:50 +00:00
echo '<tr><td colspan="2" align="center">' ;
2005-01-30 23:12:48 +00:00
if ( $_SESSION [ 'current' ] -> isLoggedIn ())
2004-11-09 22:41:18 +00:00
{
2004-12-10 00:18:01 +00:00
/* is this user a maintainer of this version by virtue of being a super maintainer */
/* of this app family? */
2005-02-06 17:49:48 +00:00
if ( $_SESSION [ 'current' ] -> isSuperMaintainer ( $oApp -> iAppId ))
2004-11-09 22:41:18 +00:00
{
2005-02-11 23:42:50 +00:00
echo '<form method="post" name="message" action="maintainerdelete.php">' ;
echo '<input type="submit" value="Remove yourself as a supermaintainer" class="button">' ;
echo '<input type="hidden" name="superMaintainer" value="1">' ;
2004-12-10 00:18:01 +00:00
} else
2004-11-09 22:41:18 +00:00
{
2004-12-10 00:18:01 +00:00
/* are we already a maintainer? */
2005-02-06 17:49:48 +00:00
if ( $_SESSION [ 'current' ] -> isMaintainer ( $oVersion -> iVersionId )) /* yep */
2004-12-10 00:18:01 +00:00
{
2005-02-11 23:42:50 +00:00
echo '<form method="post" name="message" action="maintainerdelete.php">' ;
echo '<input type="submit" value="Remove yourself as a maintainer" class=button>' ;
echo '<input type="hidden" name="superMaintainer" value="0">' ;
2004-12-10 00:18:01 +00:00
} else /* nope */
{
2005-02-11 23:42:50 +00:00
echo '<form method="post" name="message" action="maintainersubmit.php">' ;
echo '<input type="submit" value="Be a maintainer for this app" class="button" title="Click here to know more about maintainers.">' ;
2004-12-10 00:18:01 +00:00
}
2004-11-09 22:41:18 +00:00
}
2005-02-06 17:49:48 +00:00
echo " <input type=hidden name= \" appId \" value= \" " . $oApp -> iAppId . " \" > " ;
echo " <input type=hidden name= \" versionId \" value= \" " . $oVersion -> iVersionId . " \" > " ;
2004-11-09 22:41:18 +00:00
echo " </form> " ;
} else
{
2005-02-11 23:42:50 +00:00
echo '<form method="post" name="message" action="account.php">' ;
echo '<input type="hidden" name="cmd" value="login">' ;
echo '<input type=submit value="Log in to become an app maintainer" class="button">' ;
2004-12-01 22:33:48 +00:00
echo '</form>' ;
2004-11-09 22:41:18 +00:00
}
2004-11-17 23:02:07 +00:00
2005-02-11 23:42:50 +00:00
echo " </td></tr> " ;
2004-12-01 22:33:48 +00:00
2005-02-17 00:59:31 +00:00
if ( $_SESSION [ 'current' ] -> hasPriv ( " admin " ) || $_SESSION [ 'current' ] -> isMaintainer ( $oVersion -> iVersionId ) || $_SESSION [ 'current' ] -> isSuperMaintainer ( $oVersion -> iAppId ))
2004-11-17 23:02:07 +00:00
{
2005-02-11 23:42:50 +00:00
echo '<tr><td colspan="2" align="center">' ;
echo '<form method="post" name="message" action="admin/editAppVersion.php">' ;
echo '<input type="hidden" name="appId" value="' . $oApp -> iAppId . '" />' ;
echo '<input type="hidden" name="versionId" value="' . $oVersion -> iVersionId . '" />' ;
echo '<input type=submit value="Edit Version" class="button" />' ;
2004-12-01 22:33:48 +00:00
echo '</form>' ;
2005-02-11 23:42:50 +00:00
$url = BASE . " admin/deleteAny.php?what=appVersion&appId= " . $oApp -> iAppId . " &versionId= " . $oVersion -> iVersionId . " &confirmed=yes " ;
2005-01-29 17:17:32 +00:00
echo " <form method= \" post \" name= \" delete \" action= \" javascript:deleteURL('Are you sure?', ' " . $url . " ') \" > " ;
2005-02-11 23:42:50 +00:00
echo '<input type=submit value="Delete Version" class="button" />' ;
2005-01-29 00:52:49 +00:00
echo '</form>' ;
2005-02-14 18:22:04 +00:00
echo '<form method="post" name="message" action="admin/addAppNote.php">' ;
echo '<input type="hidden" name="versionId" value="' . $oVersion -> iVersionId . '" />' ;
echo '<input type="submit" value="Add Note" class="button" />' ;
2004-12-01 22:33:48 +00:00
echo '</form>' ;
2005-02-06 17:49:48 +00:00
echo '<form method=post name=message action=admin/addAppNote.php?versionId=' . $oVersion -> iVersionId . '>' ;
2005-02-11 23:42:50 +00:00
echo '<input type=hidden name="noteTitle" value="HOWTO" />' ;
echo '<input type=submit value="Add How To" class="button" />' ;
2004-12-01 22:33:48 +00:00
echo '</form>' ;
2005-02-06 17:49:48 +00:00
echo '<form method=post name=message action=admin/addAppNote.php?versionId=' . $oVersion -> iVersionId . '>' ;
2005-02-11 23:42:50 +00:00
echo '<input type=hidden name="noteTitle" value="WARNING" />' ;
echo '<input type=submit value="Add Warning" class="button" />' ;
2004-12-01 22:33:48 +00:00
echo '</form>' ;
2005-02-11 23:42:50 +00:00
echo " </td></tr> " ;
2004-11-17 23:02:07 +00:00
}
2004-11-09 22:41:18 +00:00
2004-12-01 22:33:48 +00:00
echo " </table><td class=color2 valign=top width='100%'> \n " ;
2004-03-15 16:22:00 +00:00
2005-02-02 03:01:29 +00:00
// description
2004-12-29 20:21:31 +00:00
echo " <table width='100%' border=0><tr><td width='100%' valign=top> <b>Description</b><br /> \n " ;
2005-02-06 17:49:48 +00:00
echo $oVersion -> sDescription ;
2004-11-17 23:02:07 +00:00
echo " </td></tr> " ;
2004-11-09 22:41:18 +00:00
/* close the table */
echo " </table> \n " ;
2004-12-01 22:33:48 +00:00
2004-11-17 23:02:07 +00:00
echo html_frame_end ();
2004-03-15 16:22:00 +00:00
2005-07-13 01:16:37 +00:00
view_version_bugs ( $oVersion -> iVersionId , $oVersion -> aBuglinkIds );
2005-02-06 17:49:48 +00:00
$rNotes = query_appdb ( " SELECT * FROM appNotes WHERE versionId = " . $oVersion -> iVersionId );
2004-12-29 03:48:47 +00:00
while ( $oNote = mysql_fetch_object ( $rNotes ) )
2004-12-01 22:33:48 +00:00
{
2004-12-29 03:48:47 +00:00
echo show_note ( $oNote -> noteTitle , $oNote );
2004-12-01 22:33:48 +00:00
}
2004-12-29 03:48:47 +00:00
2004-11-17 23:02:07 +00:00
// Comments Section
2005-02-06 17:49:48 +00:00
view_app_comments ( $oVersion -> iVersionId );
2004-12-11 03:25:13 +00:00
} else
2004-03-15 16:22:00 +00:00
{
2004-12-11 03:25:13 +00:00
// Oops! Called with no params, bad llamah!
errorpage ( 'Page Called with No Params!' );
exit ;
2004-03-15 16:22:00 +00:00
}
apidb_footer ();
2004-12-11 22:33:01 +00:00
?>