You are here

function photos_editlist_submit_node in Album Photos 6.2

Same name and namespace in other branches
  1. 7.3 inc/photos.edit.inc \photos_editlist_submit_node()
1 string reference to 'photos_editlist_submit_node'
photos_editlist in inc/photos.edit.inc

File

inc/photos.edit.inc, line 283

Code

function photos_editlist_submit_node($form, &$form_state) {
  foreach ($form_state['values']['photos'] as $fid => $key) {
    if (!empty($key['del'])) {
      $msg[] = db_query('DELETE FROM {x_node} WHERE fid = %d', $fid);
    }
    else {
      db_query("UPDATE {x_image} SET des = '%s', wid = %d WHERE fid = %d", $key['des'], $key['wid'], $fid);
      if ($key['filename'] != $key['oldfilename']) {
        db_query("UPDATE {files} SET filename = '%s' WHERE fid = %d", check_plain($key['filename']), $fid);
      }
    }
  }
  if ($msg) {
    photos_set_count('node_node', $form_state['values']['nid']);
    drupal_set_message(t('%count images are move out.', array(
      '%count' => count($msg),
    )));
  }
}