You are here

function _imagepicker_get_img in Image Picker 5

Same name and namespace in other branches
  1. 5.2 imagepicker.module \_imagepicker_get_img()
  2. 6.2 imagepicker.functions.inc \_imagepicker_get_img()
  3. 7 imagepicker.functions.inc \_imagepicker_get_img()
5 calls to _imagepicker_get_img()
imagepicker_edit_form_submit in ./imagepicker.module
Submit form
imagepicker_image_delete in ./imagepicker.module
imagepicker_image_select in ./imagepicker.module
imagepicker_user_view in ./imagepicker.module
_imagepicker_edit_img in ./imagepicker.module

File

./imagepicker.module, line 1488
Enables permitted roles to upload images for insertion into configured nodes.

Code

function _imagepicker_get_img($img_id, $checkuser = TRUE) {
  global $user;
  $result = db_query_range("SELECT * FROM {imagepicker} WHERE img_id = '%d'", $img_id, 0, 1);
  $img = db_fetch_array($result);
  if (count($img)) {
    if ($img['uid'] != $user->uid && $checkuser) {
      drupal_set_message(t('This image does not belong to you.'), 'error');
      watchdog('imagepicker', t('User uid !uid1 attempted to edit image belonging to user uid !uid2', array(
        '!uid1' => $user->uid,
        '!uid2' => $img['uid'],
      )), WATCHDOG_WARNING);
      return FALSE;
    }
    return $img;
  }
  return FALSE;
}