eradicate redundant get_uid function

This commit is contained in:
Mike Macgirvin 2010-10-18 14:34:59 -07:00
parent 103814ab8e
commit ac824fe83e
18 changed files with 79 additions and 86 deletions

View File

@ -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

View File

@ -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();

View File

@ -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;

View File

@ -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)) {

View File

@ -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 );

View File

@ -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'],

View File

@ -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']))
? '<div class="wall-item-lock"><img src="images/lock_icon.gif" class="lockview" alt="' . t('Private Message') . '" onclick="lockview(event,' . $item['id'] . ');" /></div>'
: '<div class="wall-item-lock"></div>');
@ -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']));

View File

@ -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 );

View File

@ -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 {

View File

@ -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']))
? '<div class="wall-item-lock"><img src="images/lock_icon.gif" class="lockview" alt="' . t('Private Message') . '" onclick="lockview(event,' . $item['id'] . ');" /></div>'
: '<div class="wall-item-lock"></div>');

View File

@ -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;
}

View File

@ -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 .= '<div id="album-edit-link"><a href="'. $a->get_baseurl() . '/photos/'
. $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '/edit' . '">'
. t('Edit Album') . '</a></div>';
@ -602,7 +602,7 @@ function photos_content(&$a) {
$o .= '<h3>' . '<a href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($ph[0]['album']) . '">' . $ph[0]['album'] . '</a></h3>';
if(local_user() && ($ph[0]['uid'] == get_uid())) {
if(local_user() && ($ph[0]['uid'] == local_user())) {
$o .= '<div id="photo-edit-link-wrap" ><a id="photo-edit-link" href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $datum . '/edit' . '">' . t('Edit photo') . '</a></div>';
}
@ -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 .= '<h3>' . t('Recent Photos') . '</h3>';
if( local_user() && (get_uid() == $a->data['user']['uid'])) {
if( local_user() && (local_user() == $a->data['user']['uid'])) {
$o .= '<div id="photo-top-links"><a id="photo-top-upload-link" href="'. $a->get_baseurl() . '/photos/'
. $a->data['user']['nickname'] . '/upload' . '">' . t('Upload New Photos') . '</a></div>';
}

View File

@ -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)
);

View File

@ -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 .= '<script> $(document).ready(function() { $(\'#nav-home-link\').addClass(\'nav-selected\'); });</script>';
}
@ -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']))
? '<div class="wall-item-lock"><img src="images/lock_icon.gif" class="lockview" alt="' . t('Private Message') . '" onclick="lockview(event,' . $item['id'] . ');" /></div>'
: '<div class="wall-item-lock"></div>');

View File

@ -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 );

View File

@ -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());

View File

@ -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) {

View File

@ -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;
}