2004-12-12 03:51:51 +00:00
< ? php
2006-07-06 18:37:34 +00:00
/**
* Adds a maintainer .
*
* Mandatory parameters :
* - iAppId , application identifier
* AND / OR
* - iVersionId , version identifier
*
* Optional parameters :
* - iSuperMaintainer , 1 if we want to delete a supermaintainer instead of a normal maintainer
* - sMaintainReason , why the users want to be a maintainer
*
* TODO :
* - replace iSuperMaintainer with bIsSuperMaintainer
*/
2004-11-09 22:41:18 +00:00
2006-07-06 18:37:34 +00:00
// application environment
2004-12-25 20:08:00 +00:00
include ( " path.php " );
2005-02-02 00:12:35 +00:00
require ( BASE . " include/incl.php " );
require ( BASE . " include/category.php " );
2005-02-07 04:31:26 +00:00
require ( BASE . " include/application.php " );
2004-12-25 20:08:00 +00:00
2006-06-17 06:10:10 +00:00
$aClean = array (); //array of filtered user input
2006-07-06 17:27:54 +00:00
$aClean [ 'sMaintainReason' ] = makeSafe ( $_REQUEST [ 'sMaintainReason' ]);
$aClean [ 'iAppId' ] = makeSafe ( $_POST [ 'iAppId' ]);
$aClean [ 'iVersionId' ] = makeSafe ( strip_tags ( $_POST [ 'iVersionId' ]));
$aClean [ 'iSuperMaintainer' ] = makeSafe ( $_POST [ 'iSuperMaintainer' ]);
2006-06-17 06:10:10 +00:00
2004-12-25 20:08:00 +00:00
/**
* Check the input of a submitted form . And output with a list
* of errors . ( < ul ></ ul > )
*/
2006-06-17 06:10:10 +00:00
function checkAppMaintainerInput ( $maintainReason )
2004-11-09 22:41:18 +00:00
{
$errors = " " ;
2006-06-17 06:10:10 +00:00
if ( empty ( $maintainReason ) )
2004-11-09 22:41:18 +00:00
{
2005-01-10 22:15:44 +00:00
$errors .= " <li>Please enter why you would like to be an application maintainer.</li> \n " ;
2004-11-09 22:41:18 +00:00
}
if ( empty ( $errors ) )
{
return " " ;
}
else
{
return $errors ;
}
}
2005-01-30 23:12:48 +00:00
if ( ! $_SESSION [ 'current' ] -> isLoggedIn ())
2006-06-29 16:13:35 +00:00
util_show_error_page ( " You need to be logged in to apply to be a maintainer. " );
2004-11-09 22:41:18 +00:00
2005-10-06 00:04:59 +00:00
/* if we have a versionId to check against see if */
/* the user is already a maintainer */
2006-07-06 17:27:54 +00:00
if ( ! $aClean [ 'iSuperMaintainer' ] && $_SESSION [ 'current' ] -> isMaintainer ( $aClean [ 'iVersionId' ]))
2004-11-09 22:41:18 +00:00
{
echo " You are already a maintainer of this app! " ;
exit ;
}
2004-12-10 00:18:01 +00:00
/* if this user is a super maintainer they maintain all of the versionIds of this appId */
2006-07-06 17:27:54 +00:00
if ( $_SESSION [ 'current' ] -> isSuperMaintainer ( $aClean [ 'iAppId' ]))
2004-12-10 00:18:01 +00:00
{
echo " You are already a supermaintainer of the whole application family! " ;
exit ;
}
2006-07-06 17:27:54 +00:00
if ( $aClean [ 'sMaintainReason' ] )
2004-11-09 22:41:18 +00:00
{
// check the input for empty/invalid fields
2006-07-06 17:27:54 +00:00
$errors = checkAppMaintainerInput ( $aClean [ 'sMaintainReason' ]);
2004-11-09 22:41:18 +00:00
if ( ! empty ( $errors ))
2006-06-29 16:13:35 +00:00
util_show_error_page ( " We found the following errors: " , " <ul> $errors </ul><br />Please go back and correct them. " );
2004-11-09 22:41:18 +00:00
// header
2006-07-06 17:27:54 +00:00
if ( $aClean [ 'iSuperMaintainer' ])
2004-12-10 00:18:01 +00:00
apidb_header ( " Submit SuperMaintainer Request " );
else
apidb_header ( " Submit Maintainer Request " );
2004-11-09 22:41:18 +00:00
// add to queue
2006-06-24 04:20:32 +00:00
$hResult = query_parameters ( " INSERT INTO appMaintainerQueue (queueId, appId, versionId, " .
" userId, maintainReason, superMaintainer, submitTime) " .
" VALUES (?, '?', '?', '?', '?', '?', ?) " ,
2006-07-06 17:27:54 +00:00
" null " , $aClean [ 'iAppId' ], $aClean [ 'iVersionId' ],
$_SESSION [ 'current' ] -> iUserId , $aClean [ 'sMaintainReason' ],
$aClean [ 'iSuperMaintainer' ], " NOW() " );
2006-06-24 04:20:32 +00:00
if ( $hResult )
2004-11-09 22:41:18 +00:00
{
2006-06-06 18:54:12 +00:00
echo " <p>Your maintainer request has been submitted for review. You should hear back \n " ;
2004-11-09 22:41:18 +00:00
echo " soon about the status of your submission</p> \n " ;
}
} else
{
2005-01-14 05:32:48 +00:00
// header
2006-07-06 17:27:54 +00:00
if ( $aClean [ 'iVersionId' ])
2005-02-07 04:31:26 +00:00
{
2006-07-06 17:27:54 +00:00
$oVersion = new Version ( $aClean [ 'iVersionId' ]);
2005-02-07 04:31:26 +00:00
$oApp = new Application ( $oVersion -> iAppId );
apidb_header ( " Request to become an application maintainer of " . $oApp -> sName . " " . $oVersion -> sName );
}
2005-01-14 05:32:48 +00:00
else
2005-02-07 04:31:26 +00:00
{
2006-07-06 17:27:54 +00:00
$oApp = new Application ( $aClean [ 'iAppId' ]);
2005-02-07 04:31:26 +00:00
apidb_header ( " Request to become an application super maintainer of " . $oApp -> sName );
}
2004-11-09 22:41:18 +00:00
// show add to queue form
echo '<form name="newApp" action="maintainersubmit.php" method="post" enctype="multipart/form-data">' , " \n " ;
echo " <p>This page is for submitting a request to become an application maintainer. \n " ;
echo " An application maintainer is someone who runs the application \n " ;
echo " regularly and who is willing to be active in reporting regressions with newer \n " ;
2005-02-11 01:35:39 +00:00
echo " versions of Wine and to help other users run this application under Wine.</p> " ;
2006-07-06 17:27:54 +00:00
echo " <p>Being an application maintainer comes with new rights and new responsibilities; please be sure to read the <a href= \" " . BASE . " /help/?sTopic=maintainer_guidelines \" >maintainer's guidelines</a> before to proceed.</p> " ;
2005-01-10 22:15:44 +00:00
echo " <p>We ask that all maintainers explain why they want to be an application maintainer, \n " ;
2004-11-09 22:41:18 +00:00
echo " why they think they will do a good job and a little about their experience \n " ;
2005-01-10 22:15:44 +00:00
echo " with Wine. This is both to give you time to \n " ;
echo " think about whether you really want to be an application maintainer and also for the \n " ;
2004-11-09 22:41:18 +00:00
echo " appdb admins to identify people that are best suited for the job. Your request \n " ;
2005-01-10 22:15:44 +00:00
echo " may be denied if there are already a handful of maintainers for this application or if you \n " ;
2005-02-11 01:35:39 +00:00
echo " don't have the experience with Wine that is necessary to help other users out.</p> \n " ;
2004-12-10 00:18:01 +00:00
/* Special message for super maintainer applications */
2006-07-06 17:27:54 +00:00
if ( $aClean [ 'iSuperMaintainer' ])
2004-12-10 00:18:01 +00:00
{
2005-02-11 01:35:39 +00:00
echo " <p>Super maintainers are just like normal maintainers but they can modify EVERY version of \n " ;
echo " this application (and the application itself). We don't expect you to run every version but at least to help keep \n " ;
echo " the forums clean of stale and out-of-date information.</p> \n " ;
2004-12-10 00:18:01 +00:00
}
2004-12-29 20:21:31 +00:00
echo " <br /><br /> " ;
2004-11-09 22:41:18 +00:00
2006-07-06 17:27:54 +00:00
if ( $aClean [ 'iSuperMaintainer' ])
2004-12-10 00:18:01 +00:00
echo html_frame_start ( " New Super Maintainer Form " , 400 , " " , 0 );
else
echo html_frame_start ( " New Maintainer Form " , 400 , " " , 0 );
2004-11-09 22:41:18 +00:00
echo " <table width='100%' border=0 cellpadding=2 cellspacing=0> \n " ;
echo " <tr valign=top><td class=color0> " ;
2005-02-07 04:31:26 +00:00
echo '<b>Application</b></td><td>' . $oApp -> sName ;
2004-11-09 22:41:18 +00:00
echo '</td></tr>' , " \n " ;
2006-07-06 17:27:54 +00:00
if ( $aClean [ 'iVersionId' ])
2005-01-14 05:32:48 +00:00
{
echo " <tr valign=top><td class=color0> " ;
2005-02-07 04:31:26 +00:00
echo '<b>Version</b></td><td>' . $oVersion -> sName ;
2005-01-14 05:32:48 +00:00
echo '</td></tr>' , " \n " ;
}
2006-07-06 17:27:54 +00:00
echo " <input type=hidden name='iAppId' value= { $aClean [ 'iAppId' ] } > " ;
echo " <input type=hidden name='iVersionId' value= { $aClean [ 'iVersionId' ] } > " ;
echo " <input type=hidden name='iSuperMaintainer' value= { $aClean [ 'iSuperMaintainer' ] } > " ;
2004-12-10 00:18:01 +00:00
2006-07-06 17:27:54 +00:00
if ( $aClean [ 'iSuperMaintainer' ])
echo '<tr valign=top><td class=color0><b>Why you want to and should be an application super maintainer</b></td><td><textarea name="sMaintainReason" rows=15 cols=70></textarea></td></tr>' , " \n " ;
2004-12-10 00:18:01 +00:00
else
2006-07-06 17:27:54 +00:00
echo '<tr valign=top><td class=color0><b>Why you want to and should be an application maintainer</b></td><td><textarea name="sMaintainReason" rows=15 cols=70></textarea></td></tr>' , " \n " ;
2004-12-10 00:18:01 +00:00
2004-11-09 22:41:18 +00:00
echo '<tr valign=top><td class=color3 align=center colspan=2> <input type=submit value=" Submit Maintainer Request " class=button> </td></tr>' , " \n " ;
echo '</table>' , " \n " ;
echo html_frame_end ();
echo " </form> " ;
}
apidb_footer ();
?>