aboutsummaryrefslogtreecommitdiffstats
path: root/include/photos.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/photos.php')
-rw-r--r--include/photos.php46
1 files changed, 45 insertions, 1 deletions
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;
+
+}