You are here

function photos_edit_update_load in Album Photos 7.3

Ajax edit image load text.

1 string reference to 'photos_edit_update_load'
photos_menu in ./photos.module
Implements hook_menu().

File

inc/photos.edit.inc, line 1062
Handles uploading and editing images.

Code

function photos_edit_update_load($token = NULL) {
  drupal_add_http_header('Content-Type', 'text/plain;');
  $id = check_plain($_POST['id']);
  if (strstr($id, 'title')) {
    $switch = 'title';
    $fid = str_replace('photos-image-edit-title-', '', $id);
  }
  elseif (strstr($id, 'des')) {
    $switch = 'des';
    $fid = str_replace('photos-image-edit-des-', '', $id);
  }

  // Validate token and check user image edit permissions.
  if (drupal_valid_token($token, 'image_edit_token') && _photos_access('imageEdit', $fid)) {
    switch ($switch) {
      case 'title':
        $value = db_query("SELECT title FROM {photos_image} WHERE fid = :fid", array(
          ':fid' => $fid,
        ))
          ->fetchField();
        echo $value;
        break;
      case 'des':
        $value = db_query("SELECT des FROM {photos_image} WHERE fid = :fid", array(
          ':fid' => $fid,
        ))
          ->fetchField();
        echo $value;
        break;
    }
  }
}