Merge pull request #349 from git-marijus/master
make photo upload work for remote channels with perms
This commit is contained in:
commit
ec54111e6b
@ -452,13 +452,13 @@ function photos_album_rename($channel_id, $oldname, $newname) {
|
|||||||
function photos_album_get_db_idstr($channel_id, $album, $remote_xchan = '') {
|
function photos_album_get_db_idstr($channel_id, $album, $remote_xchan = '') {
|
||||||
|
|
||||||
if ($remote_xchan) {
|
if ($remote_xchan) {
|
||||||
$r = q("SELECT distinct resource_id as from photo where xchan = '%s' and uid = %d and album = '%s' ",
|
$r = q("SELECT distinct resource_id from photo where xchan = '%s' and uid = %d and album = '%s' ",
|
||||||
dbesc($remote_xchan),
|
dbesc($remote_xchan),
|
||||||
intval($channel_id),
|
intval($channel_id),
|
||||||
dbesc($album)
|
dbesc($album)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$r = q("SELECT distinct resource_id from photo where uid = %d and album = '%s' ",
|
$r = q("SELECT distinct resource_id from photo where uid = %d and album = '%s' ",
|
||||||
intval($channel_id),
|
intval($channel_id),
|
||||||
dbesc($album)
|
dbesc($album)
|
||||||
);
|
);
|
||||||
|
@ -6,6 +6,7 @@ require_once('include/acl_selectors.php');
|
|||||||
require_once('include/bbcode.php');
|
require_once('include/bbcode.php');
|
||||||
require_once('include/security.php');
|
require_once('include/security.php');
|
||||||
require_once('include/Contact.php');
|
require_once('include/Contact.php');
|
||||||
|
require_once('include/text.php');
|
||||||
|
|
||||||
|
|
||||||
function photos_init(&$a) {
|
function photos_init(&$a) {
|
||||||
@ -401,9 +402,20 @@ function photos_post(&$a) {
|
|||||||
* default post action - upload a photo
|
* default post action - upload a photo
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$channel = $a->data['channel'];
|
||||||
|
$observer = $a->data['observer'];
|
||||||
|
|
||||||
$_REQUEST['source'] = 'photos';
|
$_REQUEST['source'] = 'photos';
|
||||||
|
|
||||||
$r = photo_upload($a->channel,$a->get_observer(), $_REQUEST);
|
if(!local_channel()) {
|
||||||
|
$_REQUEST['contact_allow'] = expand_acl($channel['channel_allow_cid']);
|
||||||
|
$_REQUEST['group_allow'] = expand_acl($channel['channel_allow_gid']);
|
||||||
|
$_REQUEST['contact_deny'] = expand_acl($channel['channel_deny_cid']);
|
||||||
|
$_REQUEST['group_deny'] = expand_acl($channel['channel_deny_gid']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$r = photo_upload($channel, $observer, $_REQUEST);
|
||||||
|
|
||||||
if(! $r['success']) {
|
if(! $r['success']) {
|
||||||
notice($r['message'] . EOL);
|
notice($r['message'] . EOL);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user