"community"]); // No errors, processing depends on POST data $errors = []; $process = [] !== $_POST; // Avoid E_NOTICE errors on incoming vars if not set $vars = [ 'sday', 'smonth', 'syear', 'eday', 'emonth', 'eyear', 'recur', 'recur_day', ]; foreach ($vars as $varname) { if (empty($_POST[$varname])) { $_POST[$varname] = 0; } } $vars = [ 'type', 'country', 'category', 'email', 'url', 'ldesc', 'sdesc', ]; foreach ($vars as $varname) { if (!isset($_POST[$varname])) { $_POST[$varname] = ""; } } // We need to process some form data if ($process) { // Clean and validate data if (!is_emailable_address($_POST['email'])) { $errors[] = 'You must supply a valid email address.'; } /** * Lockout of addresses and domains known to SPAM us. * Add, edit, or remove blacklisted users or domains * in include/email-validation.inc :: blacklisted(). */ $uemail = isset($_POST['email']) ? strtolower($_POST['email']) : ''; if (blacklisted($uemail)) { $errors[] = 'An expected error has been encountered. Please don\'t try again later.'; } $_POST['sdesc'] = trim($_POST['sdesc']); if (!$_POST['sdesc']) { $errors[] = "You must supply a short description of the event."; } $_POST['ldesc'] = trim(strip_tags($_POST['ldesc'], '

')); $_POST['ldesc'] = preg_replace("/(style|on\\w+?)\s*=[^>]*/i", "", $_POST['ldesc']); if (!$_POST['ldesc']) { $errors[] = "You must supply a long description of the event."; } elseif (stripos($_POST['ldesc'], 'PHP') === false) { $errors[] = "This does not look like a 'PHP' event"; } $valid_schemes = ['http', 'https', 'ftp']; $_POST['url'] = trim($_POST['url']); $pu = parse_url($_POST['url']); $pu['host'] = isset($pu['host']) ? trim($pu['host']) : ''; if (!$_POST['url']) { $errors[] = "You must supply a URL with more information about the event."; } elseif (empty($pu['host']) || !in_array($pu['scheme'], $valid_schemes, false)) { $errors[] = "The URL you supplied was invalid."; } if (!$_POST['country']) { $errors[] = 'You must specify a country for the event.'; } if (!$_POST['category']) { $errors[] = 'You must specify a category for the event.'; } if (!checkdate($_POST['smonth'], $_POST['sday'], $_POST['syear'])) { $errors[] = "You must specify a valid start date."; } else { $sdate = mktime(0, 0, 1, $_POST['smonth'], $_POST['sday'], $_POST['syear']); if ($sdate < time()) { $errors[] = "You must specify a start date that is in the future."; } } if ($_POST['type'] == 'multi' && !checkdate($_POST['emonth'], $_POST['eday'], $_POST['eyear'])) { $errors[] = "You must specify a valid end date for a multi-day event."; } elseif ($_POST['type'] == 'multi' && checkdate($_POST['smonth'], $_POST['sday'], $_POST['syear'])) { $sdate = mktime(0, 0, 1, $_POST['smonth'], $_POST['sday'], $_POST['syear']); $edate = mktime(0, 0, 1, $_POST['emonth'], $_POST['eday'], $_POST['eyear']); if ($edate < time()) { $errors[] = "You must specify an end date that is in the future."; } elseif ($edate < $sdate) { $errors[] = "You must specify an end date that is after the start date."; } } if ($_POST['type'] == 'recur' && !($_POST['recur'] && $_POST['recur_day'])) { $errors[] = "You must specify a valid day of the month for a recurring event."; } // Spam question if ($_POST["sane"] != 4) { $errors[] = "It's OK. I'm not real either"; } if (isset($_POST['action']) && $_POST['action'] === 'Submit' && empty($errors)) { // Submit to main.php.net $result = posttohost("http://main.php.net/entry/event.php", $_POST); if ($result) { $errors[] = "There was an error processing your submission: $result"; } if (count($errors) === 0) { echo "

\n Thank you for your submission! You should hear back soon\n" . " as to whether your event has been accepted for inclusion in\n" . " our calendar.\n

"; site_footer(); exit; } } if (count($errors) === 0) { echo "

\n The following is a preview of your event submission.\n" . " Please double-check it to make sure all of the information is correct.\n

"; } } // No form data to process else { echo "

\n Have an upcoming PHP user group meeting?\n" . " Submit your event here, and after it has been approved, it will be listed in\n" . " our event calendar.\n

"; echo "

Please note that conference submissions should be emailed to php-webmaster@lists.php.net

\n"; echo '
' . "\n" . "

\n All submissions will be reviewed by human. Do not waste " . "our and your own time on submitting events unrelated to PHP. Thank you.

\n" . "
\n"; } // Display errors if found if (count($errors)) { display_errors($errors); } // Generate days and months arrays for form for ($i = 1; $i <= 7; $i++) { $days[$i] = date('l', mktime(12, 0, 0, 4, $i)); } for ($i = 1; $i <= 12; $i++) { $months[$i] = date('F', mktime(12, 0, 0, $i, 1)); } // Possibilities to recur $re = [ 1 => 'First', 2 => 'Second', 3 => 'Third', 4 => 'Fourth', -1 => 'Last', -2 => '2nd Last', -3 => '3rd Last', ]; // If we have data, display preview if ($process && count($errors) === 0) { echo "

Preview:

\n"; display_event($_POST); echo "

Change:

\n"; } ?>
Start Date "> >
End Date "> >
OR Recurring >
Short Description
URL
Country
Event Category
Email
This email address is only used to contact you about the listing, it will not displayed along with the listing.
Long Description
Are you real?
$v) { echo '\n"; } } ?>