You are here

function photos_edit_delete in Album Photos 6.2

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

File

inc/photos.edit.inc, line 400

Code

function photos_edit_delete($fid) {
  if ($_GET['type'] != 'sub_album') {
    $v = photos_file_del($fid, 0, 1);
    if ($_GET['pid'] && intval($_GET['pid']) == $_GET['pid']) {
      photos_set_count('node_album', $_GET['pid']);
    }
    if ($_GET['uid'] && intval($_GET['uid']) == $_GET['uid']) {
      photos_set_count('user_image', $_GET['uid']);
    }
  }
  else {
    $v = db_query('DELETE FROM {x_node} WHERE fid = %d', $fid);
    if ($_GET['nid'] && intval($_GET['nid']) == $_GET['nid']) {
      photos_set_count('node_node', $_GET['nid']);
    }
  }
  if ($_GET['go'] == 1) {
    drupal_set_header('Content-Type: text/plain;');
    echo $v;
  }
  else {
    if ($v) {
      drupal_set_message(t('Delete success'));
      return drupal_goto();
    }
    else {
      drupal_set_message(t('Delete failure'));
      return drupal_goto('photos/image/' . $fid);
    }
  }
}