From 3e0040d7c3823e606d222dc4a8225bcb7d08a044 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 26 Jan 2013 03:42:05 -0800 Subject: photos cont. --- include/photos.php | 46 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/photos.php b/include/photos.php index 6609a6fa8..0d0750c22 100644 --- a/include/photos.php +++ b/include/photos.php @@ -274,4 +274,48 @@ function photos_album_widget($channelx,$observer,$albums = null) { )); } return $o; -} \ No newline at end of file +} + +function photos_album_exists($channel_id,$album) { + $r = q("SELECT id from photo where album = '%s' and uid = %d limit 1", + dbesc($album), + intval($channel_id) + ); + return (($r) ? true : false); +} + +function photos_album_rename($channel_id,$oldname,$newname) { + return q("UPDATE photo SET album = '%s' WHERE album = '%s' AND uid = %d", + dbesc($newname), + dbesc($oldname), + intval($channel_id) + ); +} + + +function photos_album_get_db_idstr($channel_id,$album,$remote_xchan = '') { + + if($remote_xchan) { + $r = q("SELECT distinct resource_id as from photo where xchan = '%s' and uid = %d and album = '%s' ", + dbesc($remote_xchan), + intval($channel_id), + dbesc($album) + ); + } + else { + $r = q("SELECT distinct resource_id from photo where uid = %d and album = '%s' ", + intval($channel_id), + dbesc($album) + ); + } + if($r) { + $arr = array(); + foreach($r as $rr) { + $arr[] = "'" . dbesc($rr['resource_id']) . "'" ; + } + $str = implode(',',$arr); + return $str; + } + return false; + +} -- cgit v1.2.3