diff --git a/appsubmit.php b/appsubmit.php index ba306c0..f295953 100644 --- a/appsubmit.php +++ b/appsubmit.php @@ -1,63 +1,61 @@ ) -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; - } -} - +# ENVIRONMENT AND HEADER include("path.php"); require(BASE."include/"."incl.php"); require(BASE."include/"."tableve.php"); -global $current; -if ($_REQUEST['queueName']) +// Send user to the correct branch of code even if they try to bypass +// the first page (appsubmit.php without parameters) +if(!loggedin()) +{ + unset($_REQUEST['queueName']); + unset($_REQUEST['apptype']); +} + +// Check the input of a submitted form. And output with a list +// of errors. () +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); @@ -103,141 +101,145 @@ if ($_REQUEST['queueName']) { echo "

    Error:

    \n"; echo "

    $error

    \n"; - } - else - { + } else { echo "

    Your application has been submitted for Review. You should hear back\n"; echo "soon about the status of your submission

    \n"; } } -else if ($_REQUEST['apptype']) + +####################################### +# USER WANTS TO SUBMIT APP OR VERSION # +####################################### +else if (isset($_REQUEST['apptype'])) { - // set email field if logged in - if ($current && loggedin()) - { - $email = $current->lookup_email($current->userid); - } + // set email field if logged in + if (loggedin()) + $email = $_SESSION[current]->lookup_email($_SESSION[current]->userid); - // header - apidb_header("Submit Application"); + // header + apidb_header("Submit Application"); - // show add to queue form - - echo '
    ',"\n"; + // show add to queue form + echo '',"\n"; + echo "

    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.

    \n"; + echo "

    Please don't forget to mention which Wine version you used, how well it worked\n"; + echo "and if any workaround were needed. Haveing app descriptions just sponsoring the app\n"; + echo "(Yes, some vendor want to use the appdb for this) or saying \"I haven't tried this app with wine\" "; + echo "won't help wine development or wine users.

    \n"; + echo "

    To submit screenshots, please email them to "; + echo "appdb@winehq.org

    \n"; - echo "

    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.

    \n"; - echo "

    Please don't forget to mention which Wine version you used, how well it worked\n"; - echo "and if any workaround were needed. Haveing app descriptions just sponsoring the app\n"; - echo "(Yes, some vendor want to use the appdb for this) or saying \"I haven't tried this app with wine\" "; - echo "won't help wine development or wine users.

    \n"; - echo "

    To submit screenshots, please email them to "; - echo "appdb@winehq.org

    \n"; + # NEW APPLICATION + if ($_REQUEST[apptype] == 1) + { + echo html_frame_start("New Application Form",400,"",0); + echo "\n"; + echo '',"\n"; + echo '',"\n"; + echo '',"\n"; + echo '',"\n"; - if ($apptype == 1) - { - echo html_frame_start("New Application Form",400,"",0); - echo "
    App Name
    App Version
    \n"; + // app Category + $w = new TableVE("view"); + echo '',"\n"; - echo '',"\n"; - echo '',"\n"; + echo '',"\n"; + echo '',"\n"; + // alt vendor + $x = new TableVE("view"); + echo '',"\n"; + + echo '',"\n"; + echo '',"\n"; + + echo '',"\n"; + echo '',"\n"; - echo '',"\n"; - echo '',"\n"; + echo '',"\n"; + echo '',"\n"; - // app Category - $w = new TableVE("view"); - echo '',"\n"; + echo '',"\n"; + + + echo '
    Category',"\n"; + $w->make_option_list("queueCatId","","appCategory","catId","catName"); + echo '
    App Name
    App Vendor
     ',"\n"; + $x->make_option_list("altvendor","","vendor","vendorId","vendorName"); + echo '
    App URL
    App Desc
    App Version
    Email
    Category',"\n"; - $w->make_option_list("queueCatId","","appCategory","catId","catName"); - echo '
    ',"\n"; + echo '
    ',"\n"; + echo html_frame_end(); - echo 'App Vendor',"\n"; - echo '',"\n"; + echo "
    "; + } + + # NEW VERSION + else + { + echo html_frame_start("New Version Form",400,"",0); + echo "\n"; - //alt vendor - $x = new TableVE("view"); - echo '',"\n"; + // app parent + $x = new TableVE("view"); + echo '',"\n"; - echo '',"\n"; - echo '',"\n"; + echo '',"\n"; + echo '',"\n"; - echo '',"\n"; - echo '',"\n"; + echo '',"\n"; + echo '',"\n"; - echo '',"\n"; - echo '',"\n"; + echo '',"\n"; + echo '',"\n"; - echo '',"\n"; - echo '
     ',"\n"; - $x->make_option_list("altvendor","","vendor","vendorId","vendorName"); - echo '
    App Parent',"\n"; + $x->make_option_list("queueName",stripslashes($appId),"appFamily","appId","appName"); + echo '
    App URL
    App Version
    App Desc
    App URL
    Email
    App Desc
    ',"\n"; - echo '
    ',"\n"; + echo 'Email',"\n"; + echo '',"\n"; - echo html_frame_end(); + echo '',"\n"; + echo '',"\n"; - echo ""; - } - else - { - echo html_frame_start("New Version Form",400,"",0); + echo '',"\n"; + echo ' ',"\n"; + + echo '',"\n"; - echo "\n"; + echo html_frame_end(); - //app parent - $x = new TableVE("view"); - echo '',"\n"; - - echo '',"\n"; - echo '',"\n"; - - echo '',"\n"; - echo '',"\n"; - - echo '',"\n"; - echo '',"\n"; - - echo '',"\n"; - echo '',"\n"; - - echo '',"\n"; - echo '',"\n"; - - - echo '',"\n"; - echo '
    App Parent',"\n"; - $x->make_option_list("queueName",stripslashes($appId),"appFamily","appId","appName"); - echo '
    App Version
    App URL
    App Desc
    Email
    ',"\n"; - echo '
    ',"\n"; - - echo html_frame_end(); - - echo ""; - } + echo ""; + } } + +########################## +# HOME PAGE OF APPSUBMIT # +########################## else { - // choose type of app - apidb_header("Choose Application Type"); - - echo '
    ',"\n"; - 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 "\n"; - echo "","\n"; - echo "","\n"; - echo '
    New ApplicationNew Version
    ',"\n"; - - - echo "
    "; + 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 "\n"; + echo "","\n"; + echo "","\n"; + echo '
    New ApplicationNew Version
    ',"\n"; + } } - apidb_footer(); - ?>