function aggregator_form_feed_validate in Drupal 4
Same name and namespace in other branches
- 5 modules/aggregator/aggregator.module \aggregator_form_feed_validate()
- 6 modules/aggregator/aggregator.admin.inc \aggregator_form_feed_validate()
- 7 modules/aggregator/aggregator.admin.inc \aggregator_form_feed_validate()
Validate aggregator_form_feed form submissions.
File
- modules/
aggregator.module, line 472 - Used to aggregate syndicated content (RSS, RDF, and Atom).
Code
function aggregator_form_feed_validate($form_id, $form_values) {
if ($_POST['op'] == t('Submit')) {
// Check for duplicate titles
if (isset($form_values['fid'])) {
$result = db_query("SELECT title, url FROM {aggregator_feed} WHERE (title = '%s' OR url='%s') AND fid != %d", $form_values['title'], $form_values['url'], $form_values['fid']);
}
else {
$result = db_query("SELECT title, url FROM {aggregator_feed} WHERE title = '%s' OR url='%s'", $form_values['title'], $form_values['url']);
}
while ($feed = db_fetch_object($result)) {
if (strcasecmp($feed->title, $form_values['title']) == 0) {
form_set_error('title', t('A feed named %feed already exists. Please enter a unique title.', array(
'%feed' => theme('placeholder', $form_values['title']),
)));
}
if (strcasecmp($feed->url, $form_values['url']) == 0) {
form_set_error('url', t('A feed with this URL %url already exists. Please enter a unique URL.', array(
'%url' => theme('placeholder', $form_values['url']),
)));
}
}
}
}