function _imagepicker_get_img in Image Picker 5.2
Same name and namespace in other branches
- 5 imagepicker.module \_imagepicker_get_img()
- 6.2 imagepicker.functions.inc \_imagepicker_get_img()
- 7 imagepicker.functions.inc \_imagepicker_get_img()
9 calls to _imagepicker_get_img()
File
- ./
imagepicker.module, line 2429 - Enables permitted roles to upload images for insertion into configured nodes.
Code
function _imagepicker_get_img($img_id, $checkuser = TRUE, $account = FALSE) {
if ($account) {
$user = $account;
}
else {
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;
}