if (!defined('__SECURITY')) {
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";
require($INC);
+} elseif ((!EXT_IS_ACTIVE("sponsor"))) {
+ if (IS_ADMIN()) {
+ ADD_FATAL(sprintf(EXTENSION_PROBLEM_NOT_INSTALLED, "sponsor"));
+ } else {
+ ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE, "sponsor");
+ }
+ return;
}
// Add description as navigation point
// Check submitted form data
//
// 1. Salutation / Surname / family name
- if (empty($_POST['gender']))
- {
+ if (empty($_POST['gender'])) {
// Surname is empty
$FORM_ERRORS[] = SPONSOR_NO_GENDER_SELECTED;
}
- if (empty($_POST['surname']))
- {
+
+ if (empty($_POST['surname'])) {
// Surname is empty
$FORM_ERRORS[] = SPONSOR_SURNAME_IS_EMPTY;
}
- if (empty($_POST['family']))
- {
+
+ if (empty($_POST['family'])) {
// Surname is empty
$FORM_ERRORS[] = SPONSOR_FAMILY_IS_EMPTY;
}
+
// 2. Company name
- // 012 3 32 23 4 43 3 4 4321 12 3 32 2 3 3210
- if (((empty($_POST['company'])) && ((!empty($_POST['tax_ident'])) || (!empty($_POST['position'])))) || ((!empty($_POST['company'])) && (empty($_POST['tax_ident']))))
- {
- if (empty($_POST['company']))
- {
+ // 012 3 32 23 4 43 3 4 4321 12 3 32 2 3 3210
+ if (((empty($_POST['company'])) && ((!empty($_POST['tax_ident'])) || (!empty($_POST['position'])))) || ((!empty($_POST['company'])) && (empty($_POST['tax_ident'])))) {
+ if (empty($_POST['company'])) {
// Company name is empty
$FORM_ERRORS[] = SPONSOR_COMPANY_IS_EMPTY;
- }
- elseif (empty($_POST['tax_ident']))
- {
+ } elseif (empty($_POST['tax_ident'])) {
// Tax ident number name is empty
$FORM_ERRORS[] = SPONSOR_TAX_IDENT_IS_EMPTY;
}
- if (empty($_POST['position']))
- {
+
+ if (empty($_POST['position'])) {
// Not fatal but not nice: position in company is empty
$FORM_ERRORS[] = SPONSOR_POSITION_IS_EMPTY;
}
}
+
// 3. Street and number
- if (empty($_POST['street_nr1']))
- {
+ if (empty($_POST['street_nr1'])) {
// Street name and house number are empty
$FORM_ERRORS[] = SPONSOR_STREET_NR1_IS_EMPTY;
- }
- elseif ((!empty($_POST['street_nr2'])) && (empty($_POST['street_nr1'])))
- {
+ } elseif ((!empty($_POST['street_nr2'])) && (empty($_POST['street_nr1']))) {
// 1st line for street is empty, but 2nd line not
$FORM_ERRORS[] = SPONSOR_STREET_NR1_IS_EMPTY_2_NOT;
}
+
// 4. Country code
- if (empty($_POST['country']))
- {
+ if (empty($_POST['country'])) {
// Country code is empty
$FORM_ERRORS[] = SPONSOR_COUNTRY_IS_EMPTY;
- }
- elseif (strlen($_POST['country']) != 2)
- {
+ } elseif (strlen($_POST['country']) != 2) {
// Country code is invalid
$FORM_ERRORS[] = SPONSOR_COUNTRY_IS_INVALID;
}
+
// 3. ZIP code
- if (empty($_POST['zip']))
- {
+ if (empty($_POST['zip'])) {
// ZIP code is empty
$FORM_ERRORS[] = SPONSOR_ZIP_IS_EMPTY;
- }
- elseif (bigintval($_POST['zip']) != $_POST['zip'])
- {
+ } elseif (bigintval($_POST['zip']) != $_POST['zip']) {
// ZIP is invalid
$FORM_ERRORS[] = SPONSOR_ZIP_IS_INVALID;
$_POST['zip'] = "";
}
+
// 4. City
- if (empty($_POST['city']))
- {
+ if (empty($_POST['city'])) {
// City is empty
$FORM_ERRORS[] = SPONSOR_CITY_IS_EMPTY;
}
+
// 5. Phone number
- if (empty($_POST['phone']))
- {
+ if (empty($_POST['phone'])) {
// City is empty
$FORM_ERRORS[] = SPONSOR_PHONE_IS_EMPTY;
}
+
// 6. Homepage URL
- if (empty($_POST['url']))
- {
+ if (empty($_POST['url'])) {
// Homepage URL is empty
$FORM_ERRORS[] = SPONSOR_URL_IS_EMPTY;
- }
- elseif (!VALIDATE_URL($_POST['url']))
- {
+ } elseif (!VALIDATE_URL($_POST['url'])) {
// Homepage URL is invalid
$FORM_ERRORS[] = SPONSOR_URL_IS_INVALID;
$_POST['url'] = "";
}
+
// 7. Light validation of email address
- if ((empty($_POST['email'])) || ($_POST['email'] == "@"))
- {
+ if ((empty($_POST['email'])) || ($_POST['email'] == "@")) {
// Email is invalid/empty
$FORM_ERRORS[] = SPONSOR_EMAIL_IS_INVALID;
- }
- elseif (SPONSOR_FOUND_EMAIL_DB($_POST['email']))
- {
+ } elseif (SPONSOR_FOUND_EMAIL_DB($_POST['email'])) {
// Email already found in database!
$FORM_ERRORS[] = SPONSOR_EMAIL_IS_ALREADY_REGISTERED;
$_POST['email'] = "";