)
function checkInput($fields)
{
$errors = "";
if (strlen($fields['queueName']) > 200 )
$errors .= "
Your application name is too long.
\n";
if (empty( $fields['queueName']))
$errors .= "
Please enter an application name.
\n";
if (empty( $fields['queueVersion']))
$errors .= "
Please enter an application version.
\n";
// No vendor entered, and nothing in the list is selected
if (empty( $fields['queueVendor']) and $fields['altvendor'] == '0')
$errors .= "
Please enter a vendor.
\n";
if (empty( $fields['queueDesc']))
$errors .= "
Please enter a description of your application.
\n";
// Not empty and an invalid e-mail address
if (!empty( $fields['queueEmail'])
AND !preg_match('/^[A-Za-z0-9\._-]+[@][A-Za-z0-9_-]+([.][A-Za-z0-9_-]+)+[A-Za-z]$/',
$fields['queueEmail']))
{
$errors .= "
Please enter a valid e-mail address.
\n";
}
if (empty($errors))
return "";
else
return $errors;
}
#################################
# USER SUBMITTED APP OR VERSION #
#################################
if (isset($_REQUEST['queueName']))
{
// Check input and exit if we found errors
$errors = checkInput($_REQUEST);
if( !empty($errors) )
{
errorpage("We found the following errors:","
$errors
Please go back and correct them.");
echo html_back_link(1);
exit;
}
/* if the user picked the vendor we need to retrieve the vendor name */
/* and store it into the $queueVendor */
if(isset($_REQUEST['altvendor']))
{
/* retrieve the actual name here */
$sQuery = "select * from vendor where vendorId = ".$_REQUEST['altvendor'].";";
$result = query_appdb($sQuery);
if($result && mysql_num_rows($result) > 0 )
{
$ob = mysql_fetch_object($result);
$_REQUEST['queueVendor'] = $ob->vendorName;
}
}
$aFields = compile_insert_string(
array( 'queueName' => $_REQUEST['queueName'],
'queueVersion' => $_REQUEST['queueVersion'],
'queueVendor' => $_REQUEST['queueVendor'],
'queueDesc' => $_REQUEST['queueDesc'],
'queueEmail' => $_REQUEST['queueEmail'],
'queueURL' => $_REQUEST['queueURL'],
'queueCatId' => $_REQUEST['queueCatId']));
$sQuery = "INSERT INTO appQueue ({$aFields['FIELDS']},`submitTime`) VALUES ({$aFields['VALUES']}, NOW())";
if(query_appdb($sQuery))
{
addmsg("Your application has been submitted for review. You should hear back soon".
" about the status of your submission.",'green');
}
redirect(apidb_fullurl("index.php"));
}
#######################################
# USER WANTS TO SUBMIT APP OR VERSION #
#######################################
else if (isset($_REQUEST['apptype']))
{
// set email field if logged in
if (loggedin())
$email = $_SESSION['current']->lookup_email($_SESSION['current']->userid);
// header
apidb_header("Submit Application");
// show add to queue form
echo '";
}
# NEW VERSION
else
{
echo html_frame_start("New Version Form",400,"",0);
echo "
\n";
// app parent
$x = new TableVE("view");
echo '
',"\n";
echo html_frame_end();
echo "";
}
}
##########################
# HOME PAGE OF APPSUBMIT #
##########################
else
{
if(!loggedin())
{
// 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 login now or create a new account.","\n";
}
else
{
// choose type of app
apidb_header("Choose Application Type");
echo "Please search through the database first. If you cannot find your application in the database select ","\n";
echo "New Application.","\n";
echo "If you have found your application but have not found your version then choose New Version.","\n";
echo "