function check_input_errors($edit) { $errors = array(); if (!validate_nonhtml($edit['name'])) { $errors[] = "A valid league name must be entered"; } if (!validate_yyyymmdd_input($edit['roster_deadline'])) { $errors[] = 'You must provide a valid roster deadline'; } switch ($edit['schedule_type']) { case 'none': case 'roundrobin': break; case 'ratings_ladder': case 'ratings_wager_ladder': if ($edit['games_before_repeat'] == null || $edit['games_before_repeat'] == 0) { $errors[] = "Invalid 'Games Before Repeat' specified!"; } break; default: $errors[] = "Values for allow schedule are none, roundrobin, ratings_ladder, and ratings_wager_ladder"; } if ($edit['schedule_type'] != 'none') { if (!$edit['day']) { $errors[] = "One or more days of play must be selected"; } } if (!validate_number($edit['finalize_after']) || $edit['finalize_after'] < 0) { $errors[] = "A valid number must be entered for the game finalization delay"; } return $errors; }
function check_input_errors($edit) { $errors = array(); if (!validate_nonhtml($edit['note'])) { $errors['edit[note]'] = 'You must not enter HTML in the note field'; } return $errors; }
function check_input_errors($edit) { $errors = array(); if (!validate_nonhtml($edit['name'])) { $errors[] = 'Name cannot be left blank, and cannot contain HTML'; } if (!validate_currency_code($edit['currency_code'])) { $errors[] = 'You must provide a valid currency code'; } if (!validate_number($edit['cost'])) { $errors[] = 'Invalid cost: not a number'; } else { if ($edit['cost'] < 0) { $errors[] = 'Invalid cost: cannot be negative'; } } if (!validate_number($edit['gst'])) { $errors[] = 'Invalid GST: not a number'; } else { if ($edit['gst'] < 0) { $errors[] = 'Invalid GST: cannot be negative'; } } if (!validate_number($edit['pst'])) { $errors[] = 'Invalid PST: not a number'; } else { if ($edit['pst'] < 0) { $errors[] = 'Invalid PST: cannot be negative'; } } if (!validate_yyyymmdd_input($edit['open_date'])) { $errors[] = 'You must provide a valid open date'; } if (!validate_yyyymmdd_input($edit['close_date'])) { $errors[] = 'You must provide a valid close date'; } if (!validate_number($edit['cap_male'])) { $errors[] = 'Invalid male cap: not a number'; } else { if ($edit['cap_male'] < -1) { $errors[] = 'Invalid male cap: cannot be less than -1'; } } if (!validate_number($edit['cap_female'])) { $errors[] = 'Invalid female cap: not a number'; } else { if ($edit['cap_female'] < -2) { $errors[] = 'Invalid female cap: cannot be less than -2'; } else { if ($edit['cap_female'] == -2 && $edit['cap_male'] <= 0) { $errors[] = 'Invalid female cap: can only be -2 if male cap is > 0'; } } } return $errors; }
function check_input_errors($edit) { $errors = array(); if (!validate_nonhtml($edit['display_name'])) { $errors[] = "A valid season name must be entered"; } if (!validate_yyyymmdd_input($edit['year'] . '-01-01')) { $errors[] = 'You must provide a valid year'; } return $errors; }
function check_input_errors($edit) { $errors = array(); if (!validate_nonhtml($edit['name'])) { $errors['edit[name]'] = 'You must enter a valid team name'; } else { if (!$this->team->validate_unique($edit['name'])) { $errors['edit[name]'] = 'You must enter a unique team name'; } } if (!validate_nonhtml($edit['shirt_colour'])) { $errors['edit[shirt_colour]'] = 'Shirt colour cannot be left blank'; } if (validate_nonblank($edit['website'])) { if (!validate_nonhtml($edit['website'])) { $errors['edit[website]'] = 'If you provide a website URL, it must be valid. Otherwise, leave the website field blank.'; } } return $errors; }
/** * * Validates a USA address * @param string $street Street address (incl street name, house number,etc) * @param string $city City name * @param string $state State/Territory abbreviation (2 letter) * @param string $zip Zip code */ function validate_us_address($street, $city, $state, $zip) { $errors = array(); # Street and city must only be non-HTML if (!validate_nonhtml($street)) { array_push($errors, 'You must supply a valid street address'); } if (!validate_nonhtml($city)) { array_push($errors, 'You must supply a city'); } if (!validate_state_full($state)) { array_push($errors, 'You must select a valid US state or territory'); } if (!validate_us_zipcode($zip, $state)) { array_push($errors, 'You must enter a valid US Zip code'); } return $errors; }
function isDataInvalid($edit) { $errors = ''; // nonhtml also checks that the string is not blank, so we'll just // tack on a trailing letter so that it will only check for HTML... if (!validate_nonhtml($edit['notes'] . 'a')) { $errors .= '<li>Notes cannot contain HTML'; } if (strlen($errors) > 0) { return $errors; } else { return false; } }
function isDataInvalid($edit) { $errors = ""; if (!validate_number($edit['num'])) { $errors .= "<li>Number of field must be provided"; } $rating = field_rating_values(); if (!array_key_exists($edit['rating'], $rating)) { $errors .= "<li>Rating must be provided"; } if ($edit['parent_fid'] > 0) { if (!validate_number($edit['parent_fid'])) { $errors .= "<li>Parent must be a valid value"; return $errors; } if ($edit['parent_fid'] == $this->field->fid) { $errors .= "<li>Field cannot be a parent of itself!"; return $errors; } return false; } if (!validate_nonhtml($edit['name'])) { $errors .= "<li>Name cannot be left blank, and cannot contain HTML"; } if (!validate_nonhtml($edit['code'])) { $errors .= "<li>Code cannot be left blank and cannot contain HTML"; } if (!validate_nonhtml($edit['region'])) { $errors .= "<li>Region cannot be left blank and cannot contain HTML"; } if (validate_nonblank($edit['location_url'])) { if (!validate_nonhtml($edit['location_url'])) { $errors .= "<li>If you provide a location URL, it must be valid."; } } if (validate_nonblank($edit['layout_url'])) { if (!validate_nonhtml($edit['layout_url'])) { $errors .= "<li>If you provide a site layout URL, it must be valid."; } } if (strlen($errors) > 0) { return $errors; } else { return false; } }
function check_input_errors($edit = array()) { $errors = array(); if (!validate_number($edit['num'])) { $errors[] = "Number of field must be provided"; } $rating = field_rating_values(); if (!array_key_exists($edit['rating'], $rating)) { $errors[] = "Rating must be provided"; } if ($edit['parent_fid'] > 0) { if (!validate_number($edit['parent_fid'])) { $errors[] = "Parent must be a valid value"; } return $errors; } if (!validate_nonhtml($edit['name'])) { $errors[] = "Name cannot be left blank, and cannot contain HTML"; } if (!validate_nonhtml($edit['code'])) { $errors[] = "Code cannot be left blank and cannot contain HTML"; } if (!validate_nonhtml($edit['region'])) { $errors[] = "Region cannot be left blank and cannot contain HTML"; } if (validate_nonblank($edit['location_url'])) { if (!validate_nonhtml($edit['location_url'])) { $errors[] = "If you provide a location URL, it must be valid."; } } if (validate_nonblank($edit['layout_url'])) { if (!validate_nonhtml($edit['layout_url'])) { $errors[] = "If you provide a site layout URL, it must be valid."; } } return $error; }