throw new BadRequestException("no new albumname specified");
}
// check if album is existing
- if (!Photo::exists(null, ['uid' => api_user(), 'album' => $album])) {
+ if (!Photo::exists(['uid' => api_user(), 'album' => $album])) {
throw new BadRequestException("album not available");
}
// now let's update all photos to the albumname
$mode = "update";
// check if photo is existing in databasei
- if (!Photo::exists($photo_id, ['uid' => api_user(), 'album' => $album])) {
+ if (!Photo::exists(['resource-id' => $photo_id, 'uid' => api_user(), 'album' => $album])) {
throw new BadRequestException("photo not available");
}
}
throw new BadRequestException("no photo_id specified");
}
// check if photo is existing in database
- $r = Photo::exists($photo_id, ['uid' => api_user()]);
+ $r = Photo::exists(['resource-id' => $photo_id, 'uid' => api_user()]);
if (!$r) {
throw new BadRequestException("photo not available");
}
$condition = [
'allow_cid' => $srch, 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '',
- 'uid' => $profile_uid
+ 'resource-id' => $image_uri, 'uid' => $profile_uid
];
- if (!Photo::exists($image_uri, $condition)) {
+ if (!Photo::exists($condition)) {
continue;
}
/**
* @brief Check if photo with given resource id exists
*
- * @param string $resourceid Resource ID of the photo
* @param array $conditions Array of extra conditions. Optional
*
* @return boolean
*/
- public static function exists($resourceid, array $conditions = [])
+ public static function exists(array $conditions = [])
{
- if (!is_null($resourceid)) {
- $conditions["resource-id"] = $resourceid;
- }
- if (count($conditions) == 0) {
- // no conditions defined. return false
- return false;
- }
return DBA::count("photo", $conditions) > 0;
}