funny behaviour with post permissions after recent changes

This commit is contained in:
Mike Macgirvin 2010-10-17 20:24:58 -07:00
parent 3789c288a7
commit 1d2fdb259e
2 changed files with 6 additions and 2 deletions

View file

@ -1027,7 +1027,7 @@ function photo_new_resource() {
if(! function_exists('get_uid')) { if(! function_exists('get_uid')) {
function get_uid() { function get_uid() {
return ((x($_SESSION,'uid')) ? intval($_SESSION['uid']) : 0) ; return local_user();
}} }}
// Take a URL from the wild, prepend http:// if necessary // Take a URL from the wild, prepend http:// if necessary

View file

@ -1,11 +1,14 @@
<?php <?php
function can_write_wall(&$a,$owner) { function can_write_wall(&$a,$owner) {
if((! (local_user())) && (! (remote_user()))) if((! (local_user())) && (! (remote_user())))
return false; return false;
$uid = get_uid(); $uid = get_uid();
if(($uid) && ($uid === $owner))
if(($uid) && ($uid === $owner)) {
return true; return true;
}
$r = q("SELECT `contact`.*, `user`.`page-flags` FROM `contact` LEFT JOIN `user` on `user`.`uid` = `contact`.`uid` $r = q("SELECT `contact`.*, `user`.`page-flags` FROM `contact` LEFT JOIN `user` on `user`.`uid` = `contact`.`uid`
WHERE `contact`.`uid` = %d AND `contact`.`id` = %d AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 WHERE `contact`.`uid` = %d AND `contact`.`id` = %d AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
@ -16,6 +19,7 @@ function can_write_wall(&$a,$owner) {
intval(REL_BUD), intval(REL_BUD),
intval(PAGE_COMMUNITY) intval(PAGE_COMMUNITY)
); );
if(count($r)) if(count($r))
return true; return true;
return false; return false;