function imagepicker_edit_form_submit in Image Picker 5
Same name and namespace in other branches
- 5.2 imagepicker.module \imagepicker_edit_form_submit()
Submit form
File
- ./
imagepicker.module, line 644 - Enables permitted roles to upload images for insertion into configured nodes.
Code
function imagepicker_edit_form_submit($form_id, $form_values) {
if ($form_values['op'] == t('Submit')) {
global $user;
if ($form_values['account']) {
$img_id = arg(4);
}
else {
$img_id = arg(2);
}
$img = _imagepicker_get_img($img_id);
if ($img) {
$title = htmlspecialchars($form_values['title']);
$description = htmlspecialchars($form_values['description']);
if (db_query("UPDATE {imagepicker} SET img_title = '%s', img_description = '%s' WHERE img_id = '%d'", array(
$title,
$description,
$img_id,
))) {
drupal_set_message(t('Image was successfully updated.'));
if ($form_values['account']) {
drupal_goto('user/' . $user->uid . '/imagepicker/browse');
}
else {
drupal_goto('imagepicker/browse/' . $img_id);
}
}
else {
drupal_set_message(t('Error while updating image.'), 'error');
}
}
else {
drupal_set_message(t('Image not found.'), 'error');
}
}
if ($form_values['account']) {
drupal_goto('user/' . $user->uid . '/imagepicker/browse');
}
drupal_goto('imagepicker/browse');
}