2004-12-12 03:51:51 +00:00
< ? php
2004-12-11 03:59:45 +00:00
/************************************/
2004-03-15 16:22:00 +00:00
/* code to Submit a new application */
2004-12-11 03:59:45 +00:00
/************************************/
include ( " path.php " );
2005-02-02 00:18:59 +00:00
require ( BASE . " include/incl.php " );
require ( BASE . " include/tableve.php " );
2005-02-07 23:21:33 +00:00
require ( BASE . " include/mail.php " );
require ( BASE . " include/application.php " );
2005-01-30 23:12:48 +00:00
if ( ! $_SESSION [ 'current' ] -> isLoggedIn ())
2004-12-11 03:59:45 +00:00
{
2005-02-07 23:21:33 +00:00
// you must be logged in to submit app
apidb_header ( " Please login " );
echo " To submit an application to the database you must be logged in. Please <a href= \" account.php?cmd=login \" >login now</a> or create a <a href= \" account.php?cmd=new \" >new account</a>. " , " \n " ;
exit ;
2004-12-11 03:59:45 +00:00
}
2004-03-15 16:22:00 +00:00
2005-02-07 23:21:33 +00:00
/*
* User submitted an application
*/
if ( isset ( $_REQUEST [ 'appName' ]))
2004-03-15 16:22:00 +00:00
{
2005-10-10 02:37:55 +00:00
$errors = " " ;
2004-03-18 19:26:33 +00:00
// Check input and exit if we found errors
2005-10-10 02:37:55 +00:00
$oApplication = new Application ();
$errors .= $oApplication -> CheckOutputEditorInput ();
$oVersion = new Version ();
$errors .= $oVersion -> CheckOutputEditorInput ();
2005-06-29 03:01:08 +00:00
if ( empty ( $errors ))
2004-03-18 19:26:33 +00:00
{
2005-10-10 02:37:55 +00:00
if ( $_REQUEST [ 'appVendorName' ])
{
$_REQUEST [ 'vendorId' ] = " " ;
//FIXME: fix this when we fix vendor submission
if ( $_SESSION [ 'current' ] -> hasPriv ( " admin " ))
{
$oVendor = new Vendor ();
$oVendor -> create ( $_REQUEST [ 'appVendorName' ], $_REQUEST [ 'appWebpage' ]);
}
}
$oApplication -> GetOutputEditorValues (); /* load the values from $_REQUEST */
//FIXME: remove this when we fix vendor submission
$oApplication -> sKeywords = $_REQUEST [ 'appKeywords' ] . " *** " . $_REQUEST [ 'appVendorName' ];
$oApplication -> create ();
$oVersion -> GetOutputEditorValues ();
$oVersion -> iAppId = $oApplication -> iAppId ; /* get the iAppId from the application that was just created */
$oVersion -> create ();
2005-06-29 03:01:08 +00:00
redirect ( apidb_fullurl ( " index.php " ));
2004-03-18 19:26:33 +00:00
}
2005-06-29 03:01:08 +00:00
2005-02-07 23:21:33 +00:00
}
2005-06-29 03:01:08 +00:00
2005-02-07 23:21:33 +00:00
/*
* User submitted a version
*/
elseif ( isset ( $_REQUEST [ 'versionName' ]) && is_numeric ( $_REQUEST [ 'appId' ]))
{
// Check input and exit if we found errors
2005-10-10 02:37:55 +00:00
$oVersion = new Version ();
$errors = $oVersion -> CheckOutputEditorInput ();
2005-06-29 03:01:08 +00:00
if ( empty ( $errors ))
2004-03-18 19:26:33 +00:00
{
2005-10-10 02:37:55 +00:00
$oVersion -> GetOutputEditorValues ();
$oVersion -> create ();
2005-06-29 03:01:08 +00:00
redirect ( apidb_fullurl ( " index.php " ));
}
2004-03-15 16:22:00 +00:00
}
2005-06-29 03:01:08 +00:00
2005-02-07 23:21:33 +00:00
/*
* User wants to submit an application or version
*/
2005-06-29 03:01:08 +00:00
if ( isset ( $_REQUEST [ 'apptype' ]))
2004-12-11 03:59:45 +00:00
{
2005-09-30 02:48:33 +00:00
// header
apidb_header ( " Submit Application " );
2005-02-02 04:11:41 +00:00
2005-02-07 23:21:33 +00:00
// show add to queue form
echo '<form name="newApp" action="appsubmit.php" method="post">' . " \n " ;
echo " <p>This page is for submitting new applications to be added to this \n " ;
echo " database. The application will be reviewed by the AppDB Administrator \n " ;
echo " and you will be notified via email if this application will be added to \n " ;
echo " the database.</p> \n " ;
2005-09-30 02:48:33 +00:00
echo " <p><h2>Before continuing please check that you have:</h2> \n " ;
2005-05-14 00:43:33 +00:00
echo " <ul> \n " ;
if ( $_REQUEST [ 'apptype' ] == 1 )
{
echo " <li>Searched for this application in the database. Duplicate submissions will be rejected.</li> \n " ;
echo " <li>Really want to submit an application instead of a new version of an application \n " ;
echo " that is already in the database. If this is the case browse to the application \n " ;
echo " and click on 'Submit new version'</li> \n " ;
}
echo " <li>Entered a valid version for this application. This is the application \n " ;
2005-09-30 02:48:33 +00:00
echo " version, NOT the wine version(which goes in the testing results section of the template)</li> \n " ;
2005-05-14 00:43:33 +00:00
echo " <li>Tested this application under Wine. There are tens of thousands of applications \n " ;
echo " for windows, we don't need placeholder entries in the database. Please enter as complete \n " ;
echo " as possible testing results in the version template provided below</li> \n " ;
echo " </ul></p> " ;
2005-02-07 23:21:33 +00:00
echo " <p>Please don't forget to mention which Wine version you used, how well it worked \n " ;
echo " and if any workaround were needed. Having app descriptions just sponsoring the app \n " ;
2005-09-30 02:48:33 +00:00
echo " (Yes, some vendors want to use the appdb for this) or saying \" I haven't tried this app with Wine \" " ;
2005-02-07 23:21:33 +00:00
echo " won't help Wine development or Wine users.</p> \n " ;
2005-09-30 02:48:33 +00:00
echo " <b><span style= \" color:red \" >Please only submit applications/versions that you have tested. \n " ;
echo " Submissions without testing information or not using the provided template will be rejected. \n " ;
echo " If you can't see the in-browser editors below please try Firefox, Mozilla or Opera browsers. \n </span></b> " ;
2005-05-14 00:43:33 +00:00
echo " <p>After your application has been added you'll be able to submit screenshots for it, post " ;
echo " messages in its forums or become a maintainer to help others trying to run the application.</p> " ;
2005-06-29 03:01:08 +00:00
if ( ! empty ( $errors ))
{
echo '<font color="red">' , " \n " ;
echo '<p class="red"> We found the following errors:</p><ul>' . $errors . '</ul>Please correct them.' ;
echo '</font><br />' , " \n " ;
echo '<p></p>' , " \n " ;
}
2005-02-07 23:21:33 +00:00
2005-10-10 02:37:55 +00:00
if ( $_REQUEST [ 'apptype' ] == 1 && ( trim ( strip_tags ( $_REQUEST [ 'appDescription' ])) == " " ))
2005-02-07 23:21:33 +00:00
{
2005-10-10 02:37:55 +00:00
$_REQUEST [ 'appDescription' ] = GetDefaultApplicationDescription ();
}
2004-03-15 16:22:00 +00:00
2005-10-10 02:37:55 +00:00
if ( trim ( strip_tags ( $_REQUEST [ 'versionDescription' ])) == " " )
2005-02-07 23:21:33 +00:00
{
2005-10-10 02:37:55 +00:00
$_REQUEST [ 'versionDescription' ] = GetDefaultVersionDescription ();
}
2005-02-07 23:21:33 +00:00
2005-10-10 02:37:55 +00:00
$oApp = new Application ();
$oApp -> GetOutputEditorValues (); /* retrieve the values from the current $_REQUEST */
$oVersion = new Version ();
$oVersion -> GetOutputEditorValues (); /* retrieve the values from the current $_REQUEST */
2005-02-07 23:21:33 +00:00
2005-10-10 02:37:55 +00:00
/* output the appropriate editors depending on whether we are processing an */
/* application and a version or just a version */
if ( $_REQUEST [ 'apptype' ] == 1 )
2005-06-29 03:01:08 +00:00
{
2005-10-10 02:37:55 +00:00
$oApp -> OutputEditor ( $_REQUEST [ 'appVendorName' ]);
$oVersion -> OutputEditor ( false );
} else
{
$oVersion -> OutputEditor ( true );
}
2004-11-09 22:34:49 +00:00
2005-06-29 03:01:08 +00:00
echo '<input type="hidden" name="apptype" value="' . $_REQUEST [ 'apptype' ] . '">' , " \n " ;
2005-02-07 23:21:33 +00:00
2005-06-29 03:01:08 +00:00
// new application and version
if ( $_REQUEST [ 'apptype' ] == 1 )
{
echo '<tr valign=top><td class=color3 align=center colspan=2>' , " \n " ;
echo '<input type=submit value="Submit New Application" class="button"> </td></tr>' , " \n " ;
}
// new version
else
{
2005-02-07 23:21:33 +00:00
echo '<tr valign=top><td class="color3" align="center" colspan="2">' , " \n " ;
echo '<input type=submit value="Submit New Version" class="button"> </td></tr>' , " \n " ;
}
2005-06-29 03:01:08 +00:00
echo '</table>' , " \n " ;
echo " </form> " ;
2005-02-07 23:21:33 +00:00
}
2004-03-15 16:22:00 +00:00
apidb_footer ();
?>