diff --git a/boot.php b/boot.php index f1f955637..c1fbf2985 100644 --- a/boot.php +++ b/boot.php @@ -498,3 +498,6 @@ function expand_acl($s) { } +function sanitise_acl(&$item) { + $item = '<' . intval(notags(trim($item))) . '>'; +} diff --git a/include/Photo.php b/include/Photo.php index b8557e7ec..0f5003a6f 100644 --- a/include/Photo.php +++ b/include/Photo.php @@ -168,11 +168,12 @@ class Photo { - public function store($uid, $cid, $rid, $filename, $album, $scale, $profile = 0) { + public function store($uid, $cid, $rid, $filename, $album, $scale, + $profile = 0, $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '') { $r = q("INSERT INTO `photo` - ( `uid`, `contact-id`, `resource-id`, `created`, `edited`, `filename`, `album`, `height`, `width`, `data`, `scale`, `profile` ) - VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d )", + ( `uid`, `contact-id`, `resource-id`, `created`, `edited`, `filename`, `album`, `height`, `width`, `data`, `scale`, `profile`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid` ) + VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, '%s', '%s', '%s', '%s' )", intval($uid), intval($cid), dbesc($rid), @@ -184,7 +185,11 @@ class Photo { intval($this->width), dbesc($this->imageString()), intval($scale), - intval($profile) + intval($profile), + dbesc($allow_cid), + dbesc($allow_gid), + dbesc($deny_cid), + dbesc($deny_gid) ); return $r; } diff --git a/mod/item.php b/mod/item.php index ca6f703b3..cc743b77f 100644 --- a/mod/item.php +++ b/mod/item.php @@ -1,9 +1,5 @@ '; -} - function item_post(&$a) { if((! local_user()) && (! remote_user())) diff --git a/mod/photos.php b/mod/photos.php index 5598de434..82f3c13ec 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1,6 +1,7 @@ store($_SESSION['uid'], 0, $photo_hash, $filename, $album, 0 ); + $r = $ph->store($_SESSION['uid'], 0, $photo_hash, $filename, $album, 0 , 0, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny); if(! $r) { notice( t('Image upload failed.') . EOL ); @@ -105,13 +135,13 @@ function photos_post(&$a) { if($width > 640 || $height > 640) { $ph->scaleImage(640); - $ph->store($_SESSION['uid'], 0, $photo_hash, $filename, $album, 1 ); + $ph->store($_SESSION['uid'], 0, $photo_hash, $filename, $album, 1, 0, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny); $smallest = 1; } if($width > 320 || $height > 320) { $ph->scaleImage(320); - $ph->store($_SESSION['uid'], 0, $photo_hash, $filename, $album, 2 ); + $ph->store($_SESSION['uid'], 0, $photo_hash, $filename, $album, 2, 0, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny); $smallest = 2; } @@ -292,6 +322,8 @@ function photos_content(&$a) { '$existalbumtext' => t('or existing album name: '), '$filestext' => t('Select files to upload: '), '$albumselect' => $albumselect, + '$permissions' => t('Permissions'), + '$aclselect' => populate_acl(), '$archive' => $a->get_baseurl() . '/jumploader_z.jar', '$nojava' => t('Use the following controls only if the Java uploader (above) fails to launch.'), '$uploadurl' => $a->get_baseurl() . '/photos', @@ -348,7 +380,7 @@ function photos_content(&$a) { require_once('security.php'); require_once('bbcode.php'); - // fetch item containing image, then comments + // fetch image, item containing image, then comments $ph = q("SELECT * FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s' $sql_extra ORDER BY `scale` ASC ", @@ -421,9 +453,8 @@ function photos_content(&$a) { ); -// require_once('view/acl_selectors.php'); - $o .= '