function path_form_validate in Drupal 4
Same name and namespace in other branches
- 5 modules/path/path.module \path_form_validate()
Verify that URL alias is valid.
File
- modules/
path.module, line 323 - Enables users to rename URLs.
Code
function path_form_validate($form_id, $edit) {
$src = $edit['src'];
$dst = $edit['dst'];
$pid = $edit['pid'];
if (!valid_url($src)) {
form_set_error('src', t('The system path %path is invalid.', array(
'%path' => theme('placeholder', $src),
)));
}
if (!valid_url($dst)) {
form_set_error('dst', t('The alias %alias is invalid.', array(
'%alias' => theme('placeholder', $dst),
)));
}
if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE pid != %d AND dst = '%s'", $pid, $dst))) {
form_set_error('dst', t('The alias %alias is already in use.', array(
'%alias' => theme('placeholder', $dst),
)));
}
}