function video_admin_preset_validate in Video 6.5
File
- ./
video.admin.inc, line 291
Code
function video_admin_preset_validate($form, $form_state) {
$v = $form_state['values'];
$preset = $form['#preset'];
if (!empty($v['extension'])) {
if (!preg_match('#^[a-z0-9]{1,5}$#', $v['extension'])) {
form_error($form['extension'], t('Use only lowercase alphanumeric characters for the file extension.'));
}
}
if (!empty($v['filenamesuffix'])) {
if (!preg_match('#^[a-zA-Z0-9\\-_.]{1,15}$#', $v['filenamesuffix'])) {
form_error($form['filenamesuffix'], t('Use only alphanumeric characters, . , - or _ for the file name suffix.'));
}
}
if (!empty($v['help']) && drupal_strlen($v['help']) > 200) {
form_error($form['help'], t('The maximum length for the help text is 200 characters.'));
}
if (!empty($v['extension'])) {
$presetid = $preset == NULL ? 0 : $preset->id;
$result = db_fetch_object(db_query('SELECT name FROM {video_preset} WHERE extension = "%s" AND filenamesuffix = "%s" AND id <> %d', $v['extension'], $v['filenamesuffix'], $presetid));
if ($result) {
form_error($form['extension'], t('The given extension and file name suffix are already used by preset @preset. Change the extension and file name suffix to something unique.', array(
'@preset' => $result->name,
)));
}
}
}