From ac824fe83e67950f9303d13d574ff00b57dd5727 Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Mon, 18 Oct 2010 14:34:59 -0700 Subject: [PATCH] eradicate redundant get_uid function --- boot.php | 7 ----- include/Contact.php | 2 +- include/security.php | 2 +- mod/contacts.php | 14 +++++----- mod/dfrn_confirm.php | 2 +- mod/dfrn_request.php | 4 +-- mod/display.php | 6 ++--- mod/group.php | 18 ++++++------- mod/like.php | 2 +- mod/network.php | 2 +- mod/notifications.php | 4 +-- mod/photos.php | 60 +++++++++++++++++++++---------------------- mod/ping.php | 8 +++--- mod/profile.php | 4 +-- mod/profile_photo.php | 14 +++++----- mod/redir.php | 2 +- mod/settings.php | 8 +++--- mod/wall_upload.php | 6 ++--- 18 files changed, 79 insertions(+), 86 deletions(-) diff --git a/boot.php b/boot.php index 786ebdee68..b3d116a50a 100644 --- a/boot.php +++ b/boot.php @@ -1023,13 +1023,6 @@ function photo_new_resource() { }} -// Returns logged in user ID - -if(! function_exists('get_uid')) { -function get_uid() { - return local_user(); -}} - // Take a URL from the wild, prepend http:// if necessary // and check DNS to see if it's real // return true if it's OK, false if something is wrong with it diff --git a/include/Contact.php b/include/Contact.php index a915ae0b44..a514a119ca 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -16,7 +16,7 @@ function user_remove($uid) { q("DELETE FROM `profile` WHERE `uid` = %d", intval($uid)); q("DELETE FROM `profile_check` WHERE `uid` = %d", intval($uid)); q("DELETE FROM `user` WHERE `uid` = %d", intval($uid)); - if($uid == get_uid()) { + if($uid == local_user()) { unset($_SESSION['authenticated']); unset($_SESSION['uid']); killme(); diff --git a/include/security.php b/include/security.php index 2ff26ff74e..794cd2ce1f 100644 --- a/include/security.php +++ b/include/security.php @@ -4,7 +4,7 @@ function can_write_wall(&$a,$owner) { if((! (local_user())) && (! (remote_user()))) return false; - $uid = get_uid(); + $uid = local_user(); if(($uid) && ($uid == $owner)) { return true; diff --git a/mod/contacts.php b/mod/contacts.php index dbad2a1586..746331ea54 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -21,7 +21,7 @@ function contacts_post(&$a) { $orig_record = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($contact_id), - intval(get_uid()) + intval(local_user()) ); if(! count($orig_record)) { @@ -34,7 +34,7 @@ function contacts_post(&$a) { if($profile_id) { $r = q("SELECT `id` FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($profile_id), - intval(get_uid()) + intval(local_user()) ); if(! count($r)) { notice( t('Could not locate selected profile.') . EOL); @@ -62,7 +62,7 @@ function contacts_post(&$a) { intval($rating), dbesc($reason), intval($contact_id), - intval(get_uid()) + intval(local_user()) ); if($r) notice( t('Contact updated.') . EOL); @@ -92,7 +92,7 @@ function contacts_content(&$a) { $orig_record = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($contact_id), - intval(get_uid()) + intval(local_user()) ); if(! count($orig_record)) { @@ -107,7 +107,7 @@ function contacts_content(&$a) { $r = q("UPDATE `contact` SET `blocked` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($blocked), intval($contact_id), - intval(get_uid()) + intval(local_user()) ); if($r) { notice( t('Contact has been ') . (($blocked) ? t('blocked') : t('unblocked')) . EOL ); @@ -121,7 +121,7 @@ function contacts_content(&$a) { $r = q("UPDATE `contact` SET `readonly` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($readonly), intval($contact_id), - intval(get_uid()) + intval(local_user()) ); if($r) { notice( t('Contact has been ') . (($readonly) ? t('ignored') : t('unignored')) . EOL ); @@ -142,7 +142,7 @@ function contacts_content(&$a) { $contact_id = intval($a->argv[1]); $r = q("SELECT * FROM `contact` WHERE `uid` = %d and `id` = %d LIMIT 1", - intval(get_uid()), + intval(local_user()), intval($contact_id) ); if(! count($r)) { diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php index 82e1b7624a..992947613f 100644 --- a/mod/dfrn_confirm.php +++ b/mod/dfrn_confirm.php @@ -25,7 +25,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) { if(! x($_POST,'source_url')) { - $uid = ((is_array($handsfree)) ? $handsfree['uid'] : get_uid()); + $uid = ((is_array($handsfree)) ? $handsfree['uid'] : local_user()); if(! $uid) { notice( t('Permission denied.') . EOL ); diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index 6821e1fd60..0fbd164c0a 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -45,7 +45,7 @@ function dfrn_request_post(&$a) { if(x($dfrn_url)) { $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' LIMIT 1", - intval(get_uid()), + intval(local_user()), dbesc($dfrn_url) ); @@ -99,7 +99,7 @@ function dfrn_request_post(&$a) { $r = q("INSERT INTO `contact` ( `uid`, `created`,`url`, `name`, `photo`, `site-pubkey`, `request`, `confirm`, `notify`, `poll`, `aes_allow`) VALUES ( %d, '%s', '%s', '%s' , '%s', '%s', '%s', '%s', '%s', '%s', %d)", - intval(get_uid()), + intval(local_user()), datetime_convert(), dbesc($dfrn_url), $parms['fn'], diff --git a/mod/display.php b/mod/display.php index 2b721aef8a..fefef8ad6b 100644 --- a/mod/display.php +++ b/mod/display.php @@ -57,7 +57,7 @@ function display_content(&$a) { // Profile owner - everything is visible - if(local_user() && (get_uid() == $a->profile['uid'])) { + if(local_user() && (local_user() == $a->profile['uid'])) { $sql_extra = ''; } @@ -149,7 +149,7 @@ function display_content(&$a) { if((($item['verb'] == ACTIVITY_LIKE) || ($item['verb'] == ACTIVITY_DISLIKE)) && ($item['id'] != $item['parent'])) continue; - $lock = (($item['uid'] == get_uid()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) + $lock = (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) ? '
' . t('Private Message') . '
' : '
'); @@ -222,7 +222,7 @@ function display_content(&$a) { $profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']); $profile_link = $profile_url; - if(($item['contact-id'] == $_SESSION['visitor_id']) || ($item['uid'] == get_uid())) + if(($item['contact-id'] == $_SESSION['visitor_id']) || ($item['uid'] == local_user())) $drop = replace_macros(load_view_file('view/wall_item_drop.tpl'), array('$id' => $item['id'])); else $drop = replace_macros(load_view_file('view/wall_fake_drop.tpl'), array('$id' => $item['id'])); diff --git a/mod/group.php b/mod/group.php index 56c3e21d1e..e5c6b92aea 100644 --- a/mod/group.php +++ b/mod/group.php @@ -22,10 +22,10 @@ function group_post(&$a) { if(($a->argc == 2) && ($a->argv[1] === 'new')) { $name = notags(trim($_POST['groupname'])); - $r = group_add(get_uid(),$name); + $r = group_add(local_user(),$name); if($r) { notice( t('Group created.') . EOL ); - $r = group_byname(get_uid(),$name); + $r = group_byname(local_user(),$name); if($r) goaway($a->get_baseurl() . '/group/' . $r); } @@ -37,7 +37,7 @@ function group_post(&$a) { if(($a->argc == 2) && (intval($a->argv[1]))) { $r = q("SELECT * FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($a->argv[1]), - intval(get_uid()) + intval(local_user()) ); if(! count($r)) { notice( t('Group not found.') . EOL ); @@ -49,7 +49,7 @@ function group_post(&$a) { if((strlen($groupname)) && ($groupname != $group['name'])) { $r = q("UPDATE `group` SET `name` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1", dbesc($groupname), - intval(get_uid()), + intval(local_user()), intval($group['id']) ); if($r) @@ -59,14 +59,14 @@ function group_post(&$a) { array_walk($members,'validate_members'); $r = q("DELETE FROM `group_member` WHERE `gid` = %d AND `uid` = %d", intval($a->argv[1]), - intval(get_uid()) + intval(local_user()) ); $result = true; if(count($members)) { foreach($members as $member) { $r = q("INSERT INTO `group_member` ( `uid`, `gid`, `contact-id`) VALUES ( %d, %d, %d )", - intval(get_uid()), + intval(local_user()), intval($group['id']), intval($member) ); @@ -98,10 +98,10 @@ function group_content(&$a) { if(intval($a->argv[2])) { $r = q("SELECT `name` FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($a->argv[2]), - intval(get_uid()) + intval(local_user()) ); if(count($r)) - $result = group_rmv(get_uid(),$r[0]['name']); + $result = group_rmv(local_user(),$r[0]['name']); if($result) notice( t('Group removed.') . EOL); else @@ -116,7 +116,7 @@ function group_content(&$a) { require_once('view/acl_selectors.php'); $r = q("SELECT * FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($a->argv[1]), - intval(get_uid()) + intval(local_user()) ); if(! count($r)) { notice( t('Group not found.') . EOL ); diff --git a/mod/like.php b/mod/like.php index c7782d4d75..ac528d221c 100644 --- a/mod/like.php +++ b/mod/like.php @@ -66,7 +66,7 @@ function like_content(&$a) { } - if((local_user()) && (get_uid() == $owner_uid)) { + if((local_user()) && (local_user() == $owner_uid)) { $contact = $owner; } else { diff --git a/mod/network.php b/mod/network.php index 347b7817fa..3a747eac94 100644 --- a/mod/network.php +++ b/mod/network.php @@ -175,7 +175,7 @@ function network_content(&$a, $update = 0) { if((($item['verb'] == ACTIVITY_LIKE) || ($item['verb'] == ACTIVITY_DISLIKE)) && ($item['id'] != $item['parent'])) continue; - $lock = (($item['uid'] == get_uid()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) + $lock = (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) ? '
' . t('Private Message') . '
' : '
'); diff --git a/mod/notifications.php b/mod/notifications.php index 603c1117cc..d09ec5edeb 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -17,7 +17,7 @@ function notifications_post(&$a) { WHERE `request-id` = %d AND `uid` = %d LIMIT 1", intval($request_id), - intval(get_uid()) + intval(local_user()) ); if(count($r)) { @@ -33,7 +33,7 @@ function notifications_post(&$a) { ); $r = q("DELETE FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($request_id), - intval(get_uid()) + intval(local_user()) ); return; } diff --git a/mod/photos.php b/mod/photos.php index 767c02543f..c1027fa22e 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -54,7 +54,7 @@ function photos_post(&$a) { $r = q("SELECT `contact`.* `user`.`nickname` FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid` WHERE `user`.`uid` = %d AND `self` = 1 LIMIT 1", - intval(get_uid()) + intval(local_user()) ); $contact_record = $r[0]; @@ -70,7 +70,7 @@ function photos_post(&$a) { $r = q("SELECT count(*) FROM `photo` WHERE `album` = '%s' AND `uid` = %d", dbesc($album), - intval(get_uid()) + intval(local_user()) ); if(! count($r)) { notice( t('Album not found.') . EOL); @@ -83,7 +83,7 @@ function photos_post(&$a) { q("UPDATE `photo` SET `album` = '%s' WHERE `album` = '%s' AND `uid` = %d", dbesc($newalbum), dbesc($album), - intval(get_uid()) + intval(local_user()) ); $newurl = str_replace(bin2hex($album),bin2hex($newalbum),$_SESSION['photo_return']); goaway($a->get_baseurl() . '/' . $newurl); @@ -94,7 +94,7 @@ function photos_post(&$a) { $res = array(); $r = q("SELECT distinct(`resource-id`) as `rid` FROM `photo` WHERE `uid` = %d AND `album` = '%s'", - intval(get_uid()), + intval(local_user()), dbesc($album) ); if(count($r)) { @@ -109,17 +109,17 @@ function photos_post(&$a) { $str_res = implode(',', $res); q("DELETE FROM `photo` WHERE `resource-id` IN ( $str_res ) AND `uid` = %d", - intval(get_uid()) + intval(local_user()) ); $r = q("SELECT `parent-uri` FROM `item` WHERE `resource-id` IN ( $str_res ) AND `uid` = %d", - intval(get_uid()) + intval(local_user()) ); if(count($r)) { foreach($r as $rr) { q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d", dbesc(datetime_convert()), dbesc($rr['parent-uri']), - intval(get_uid()) + intval(local_user()) ); $drop_id = intval($rr['id']); @@ -141,24 +141,24 @@ function photos_post(&$a) { if(($a->argc > 1) && (x($_POST,'delete')) && ($_POST['delete'] == t('Delete Photo'))) { $r = q("SELECT `id` FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s' LIMIT 1", - intval(get_uid()), + intval(local_user()), dbesc($a->argv[1]) ); if(count($r)) { q("DELETE FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s'", - intval(get_uid()), + intval(local_user()), dbesc($r[0]['resource-id']) ); $i = q("SELECT * FROM `item` WHERE `resource-id` = '%s' AND `uid` = %d LIMIT 1", dbesc($r[0]['resource-id']), - intval(get_uid()) + intval(local_user()) ); if(count($i)) { q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d", dbesc(datetime_convert()), dbesc(datetime_convert()), dbesc($i[0]['uri']), - intval(get_uid()) + intval(local_user()) ); $url = $a->get_baseurl(); @@ -189,25 +189,25 @@ function photos_post(&$a) { $p = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' AND `uid` = %d ORDER BY `scale` DESC", dbesc($resource_id), - intval(get_uid()) + intval(local_user()) ); if(count($r)) { $r = q("UPDATE `photo` SET `desc` = '%s' WHERE `resource-id` = '%s' AND `uid` = %d", dbesc($desc), dbesc($resource_id), - intval(get_uid()) + intval(local_user()) ); } if(! $item_id) { $title = ''; $basename = basename($filename); - $uri = item_new_uri($a->get_hostname(),get_uid()); + $uri = item_new_uri($a->get_hostname(),local_user()); // Create item container $arr = array(); - $arr['uid'] = get_uid(); + $arr['uid'] = local_user(); $arr['uri'] = $uri; $arr['parent-uri'] = $uri; $arr['type'] = 'photo'; @@ -236,7 +236,7 @@ function photos_post(&$a) { dbesc(datetime_convert()), dbesc(datetime_convert()), intval($item_id), - intval(get_uid()) + intval(local_user()) ); goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); @@ -266,7 +266,7 @@ function photos_post(&$a) { $r = q("SELECT * FROM `photo` WHERE `album` = '%s' AND `uid` = %d", dbesc($album), - intval(get_uid()) + intval(local_user()) ); if((! count($r)) || ($album == t('Profile Photos'))) $visible = 1; @@ -301,7 +301,7 @@ function photos_post(&$a) { $photo_hash = photo_new_resource(); - $r = $ph->store(get_uid(), 0, $photo_hash, $filename, $album, 0 , 0, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny); + $r = $ph->store(local_user(), 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 ); @@ -310,25 +310,25 @@ function photos_post(&$a) { if($width > 640 || $height > 640) { $ph->scaleImage(640); - $ph->store(get_uid(), 0, $photo_hash, $filename, $album, 1, 0, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny); + $ph->store(local_user(), 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(get_uid(), 0, $photo_hash, $filename, $album, 2, 0, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny); + $ph->store(local_user(), 0, $photo_hash, $filename, $album, 2, 0, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny); $smallest = 2; } $basename = basename($filename); - $uri = item_new_uri($a->get_hostname(), get_uid()); + $uri = item_new_uri($a->get_hostname(), local_user()); // Create item container $arr = array(); - $arr['uid'] = get_uid(); + $arr['uid'] = local_user(); $arr['uri'] = $uri; $arr['parent-uri'] = $uri; $arr['type'] = 'photo'; @@ -437,7 +437,7 @@ function photos_content(&$a) { // Profile owner - everything is visible - if(local_user() && (get_uid() == $owner_uid)) { + if(local_user() && (local_user() == $owner_uid)) { $sql_extra = ''; } elseif(remote_user()) { @@ -466,7 +466,7 @@ function photos_content(&$a) { if($datatype === 'upload') { - if( ! (local_user() && (get_uid() == $a->data['user']['uid']))) { + if( ! (local_user() && (local_user() == $a->data['user']['uid']))) { notice( t('Permission denied.')); return; } @@ -529,7 +529,7 @@ function photos_content(&$a) { if($cmd === 'edit') { if(($album != t('Profile Photos')) && ($album != t('Contact Photos'))) { - if(local_user() && (get_uid() == $a->data['user']['uid'])) { + if(local_user() && (local_user() == $a->data['user']['uid'])) { $edit_tpl = load_view_file('view/album_edit.tpl'); $o .= replace_macros($edit_tpl,array( '$nametext' => t('New album name: '), @@ -543,7 +543,7 @@ function photos_content(&$a) { } else { if(($album != t('Profile Photos')) && ($album != t('Contact Photos'))) { - if(local_user() && (get_uid() == $a->data['user']['uid'])) { + if(local_user() && (local_user() == $a->data['user']['uid'])) { $o .= ''; @@ -602,7 +602,7 @@ function photos_content(&$a) { $o .= '

' . '' . $ph[0]['album'] . '

'; - if(local_user() && ($ph[0]['uid'] == get_uid())) { + if(local_user() && ($ph[0]['uid'] == local_user())) { $o .= ''; } @@ -726,7 +726,7 @@ function photos_content(&$a) { } - if(local_user() && ($item['contact-uid'] == get_uid()) + if(local_user() && ($item['contact-uid'] == local_user()) && ($item['network'] == 'dfrn') && (! $item['self'] )) { $profile_url = $redirect_url; $sparkle = ' sparkle'; @@ -742,7 +742,7 @@ function photos_content(&$a) { $drop = ''; - if(($item['contact-id'] == $_SESSION['visitor_id']) || ($item['uid'] == get_uid())) + if(($item['contact-id'] == $_SESSION['visitor_id']) || ($item['uid'] == local_user())) $drop = replace_macros(load_view_file('view/wall_item_drop.tpl'), array('$id' => $item['id'])); @@ -788,7 +788,7 @@ function photos_content(&$a) { $o .= '

' . t('Recent Photos') . '

'; - if( local_user() && (get_uid() == $a->data['user']['uid'])) { + if( local_user() && (local_user() == $a->data['user']['uid'])) { $o .= ''; } diff --git a/mod/ping.php b/mod/ping.php index 9f7191758e..731562cd1a 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -9,26 +9,26 @@ function ping_init(&$a) { $r = q("SELECT COUNT(*) AS `total` FROM `item` WHERE `unseen` = 1 AND `visible` = 1 AND `deleted` = 0 AND `uid` = %d", - intval(get_uid()) + intval(local_user()) ); $network = $r[0]['total']; $r = q("SELECT COUNT(*) AS `total` FROM `item` WHERE `unseen` = 1 AND `visible` = 1 AND `deleted` = 0 AND `uid` = %d AND `type` != 'remote' ", - intval(get_uid()) + intval(local_user()) ); $home = $r[0]['total']; $r = q("SELECT COUNT(*) AS `total` FROM `intro` WHERE `uid` = %d AND `blocked` = 0 AND `ignore` = 0 ", - intval(get_uid()) + intval(local_user()) ); $intro = $r[0]['total']; $myurl = $a->get_baseurl() . '/profile/' . $user['nickname'] ; $r = q("SELECT COUNT(*) AS `total` FROM `mail` WHERE `uid` = %d AND `seen` = 0 AND `from-url` != '%s' ", - intval(get_uid()), + intval(local_user()), dbesc($myurl) ); diff --git a/mod/profile.php b/mod/profile.php index b72c279e2f..5576b49dd1 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -90,7 +90,7 @@ function profile_content(&$a, $update = 0) { $a->profile['profile_uid'] = $update; } else { - if($a->profile['profile_uid'] == get_uid()) + if($a->profile['profile_uid'] == local_user()) $o .= ''; } @@ -308,7 +308,7 @@ function profile_content(&$a, $update = 0) { if((($item['verb'] == ACTIVITY_LIKE) || ($item['verb'] == ACTIVITY_DISLIKE)) && ($item['id'] != $item['parent'])) continue; - $lock = (($item['uid'] == get_uid()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) + $lock = (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) ? '
' . t('Private Message') . '
' : '
'); diff --git a/mod/profile_photo.php b/mod/profile_photo.php index 07df671da4..b21d9162a0 100644 --- a/mod/profile_photo.php +++ b/mod/profile_photo.php @@ -45,7 +45,7 @@ function profile_photo_post(&$a) { //dbg(3); $r = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' AND `uid` = %d AND `scale` = %d LIMIT 1", dbesc($image_id), - dbesc(get_uid()), + dbesc(local_user()), intval($scale)); if(count($r)) { @@ -56,14 +56,14 @@ function profile_photo_post(&$a) { if($im->is_valid()) { $im->cropImage(175,$srcX,$srcY,$srcW,$srcH); - $r = $im->store(get_uid(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 4, 1); + $r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 4, 1); if($r === false) notice ( t('Image size reduction [175] failed.') . EOL ); $im->scaleImage(80); - $r = $im->store(get_uid(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 5, 1); + $r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 5, 1); if($r === false) notice( t('Image size reduction [80] failed.') . EOL ); @@ -72,12 +72,12 @@ function profile_photo_post(&$a) { $r = q("UPDATE `photo` SET `profile` = 0 WHERE `profile` = 1 AND `resource-id` != '%s' AND `uid` = %d", dbesc($base_image['resource-id']), - intval(get_uid()) + intval(local_user()) ); $r = q("UPDATE `contact` SET `avatar-date` = '%s' WHERE `self` = 1 AND `uid` = %d LIMIT 1", dbesc(datetime_convert()), - intval(get_uid()) + intval(local_user()) ); // Update global directory in background @@ -123,7 +123,7 @@ function profile_photo_post(&$a) { $smallest = 0; - $r = $ph->store(get_uid(), 0 , $hash, $filename, t('Profile Photos'), 0 ); + $r = $ph->store(local_user(), 0 , $hash, $filename, t('Profile Photos'), 0 ); if($r) notice( t('Image uploaded successfully.') . EOL ); @@ -132,7 +132,7 @@ function profile_photo_post(&$a) { if($width > 640 || $height > 640) { $ph->scaleImage(640); - $r = $ph->store(get_uid(), 0 , $hash, $filename, t('Profile Photos'), 1 ); + $r = $ph->store(local_user(), 0 , $hash, $filename, t('Profile Photos'), 1 ); if($r === false) notice( t('Image size reduction [640] failed.') . EOL ); diff --git a/mod/redir.php b/mod/redir.php index e743d003e5..5427d8c786 100644 --- a/mod/redir.php +++ b/mod/redir.php @@ -6,7 +6,7 @@ function redir_init(&$a) { goaway($a->get_baseurl()); $r = q("SELECT `network`, `issued-id`, `dfrn-id`, `duplex`, `poll` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($a->argv[1]), - intval(get_uid()) + intval(local_user()) ); if((! count($r)) || ($r[0]['network'] !== 'dfrn')) goaway($a->get_baseurl()); diff --git a/mod/settings.php b/mod/settings.php index 7adc5e6de3..720a38e8d6 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -15,7 +15,7 @@ function settings_post(&$a) { notice( t('Permission denied.') . EOL); return; } - if(count($a->user) && x($a->user,'uid') && $a->user['uid'] != get_uid()) { + if(count($a->user) && x($a->user,'uid') && $a->user['uid'] != local_user()) { notice( t('Permission denied.') . EOL); return; } @@ -39,7 +39,7 @@ function settings_post(&$a) { $password = hash('whirlpool',$newpass); $r = q("UPDATE `user` SET `password` = '%s' WHERE `uid` = %d LIMIT 1", dbesc($password), - intval(get_uid()) + intval(local_user()) ); if($r) notice( t('Password changed.') . EOL); @@ -116,7 +116,7 @@ function settings_post(&$a) { intval($page_flags), dbesc($defloc), dbesc($theme), - intval(get_uid()) + intval(local_user()) ); if($r) notice( t('Settings updated.') . EOL); @@ -126,7 +126,7 @@ function settings_post(&$a) { WHERE `is-default` = 1 AND `uid` = %d LIMIT 1", intval($publish), intval($net_publish), - intval(get_uid()) + intval(local_user()) ); if($old_visibility != $net_publish) { diff --git a/mod/wall_upload.php b/mod/wall_upload.php index 9875a01ade..77c4eb4fd8 100644 --- a/mod/wall_upload.php +++ b/mod/wall_upload.php @@ -34,7 +34,7 @@ function wall_upload_post(&$a) { $smallest = 0; - $r = $ph->store(get_uid(), 0, $hash, $filename, t('Wall Photos'), 0 ); + $r = $ph->store(local_user(), 0, $hash, $filename, t('Wall Photos'), 0 ); if(! $r) { echo ( t('Image upload failed.') . EOL); @@ -43,14 +43,14 @@ function wall_upload_post(&$a) { if($width > 640 || $height > 640) { $ph->scaleImage(640); - $r = $ph->store(get_uid(), 0, $hash, $filename, t('Wall Photos'), 1 ); + $r = $ph->store(local_user(), 0, $hash, $filename, t('Wall Photos'), 1 ); if($r) $smallest = 1; } if($width > 320 || $height > 320) { $ph->scaleImage(320); - $r = $ph->store(get_uid(), 0, $hash, $filename, t('Wall Photos'), 2 ); + $r = $ph->store(local_user(), 0, $hash, $filename, t('Wall Photos'), 2 ); if($r) $smallest = 2; }