aboutsummaryrefslogtreecommitdiffstats
path: root/mod/profile_photo.php
diff options
context:
space:
mode:
authorPaolo T <tuscanhobbit@users.noreply.github.com>2014-11-24 14:19:22 +0100
committerPaolo T <tuscanhobbit@users.noreply.github.com>2014-11-24 14:19:22 +0100
commitbef8879cb1356b880279c6104fcffb0752414a7c (patch)
treece3733df7ca168f4afe7e963dc81b6f00944c34c /mod/profile_photo.php
parent1cb45c30e9032794b7827738cc28f7728ac28677 (diff)
parent5b7124f0daeca4aa619f6411ee373d9ff5a22b7b (diff)
downloadvolse-hubzilla-bef8879cb1356b880279c6104fcffb0752414a7c.tar.gz
volse-hubzilla-bef8879cb1356b880279c6104fcffb0752414a7c.tar.bz2
volse-hubzilla-bef8879cb1356b880279c6104fcffb0752414a7c.zip
Merge pull request #7 from friendica/master
Merge from main project
Diffstat (limited to 'mod/profile_photo.php')
-rw-r--r--mod/profile_photo.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/mod/profile_photo.php b/mod/profile_photo.php
index aad9c9d16..e9dad6f51 100644
--- a/mod/profile_photo.php
+++ b/mod/profile_photo.php
@@ -33,7 +33,7 @@ function profile_photo_set_profile_perms($profileid = '') {
if (intval($profile['is_default']) != 1) {
$r0 = q("SELECT channel_hash FROM channel WHERE channel_id = %d LIMIT 1", intval(local_user()) );
- $r1 = q("SELECT abook.abook_xchan FROM abook WHERE abook_profile = %d ", intval($profile['id'])); //Should not be needed in future. Catches old int-profile-ids.
+ $r1 = q("SELECT abook.abook_xchan FROM abook WHERE abook_profile = '%d' ", intval($profile['id'])); //Should not be needed in future. Catches old int-profile-ids.
$r2 = q("SELECT abook.abook_xchan FROM abook WHERE abook_profile = '%s'", dbesc($profile['profile_guid']));
$allowcid = "<" . $r0[0]['channel_hash'] . ">";
foreach ($r1 as $entry) {
@@ -173,7 +173,7 @@ function profile_photo_post(&$a) {
dbesc($base_image['resource_id']),
intval(local_user())
);
- $r = q("UPDATE photo SET photo_flags = ( photo_flags ^ %d ) WHERE ( photo_flags & %d )
+ $r = q("UPDATE photo SET photo_flags = ( photo_flags & ~%d ) WHERE ( photo_flags & %d )>0
AND resource_id != '%s' AND `uid` = %d",
intval(PHOTO_PROFILE),
intval(PHOTO_PROFILE),
@@ -182,7 +182,7 @@ function profile_photo_post(&$a) {
);
}
else {
- $r = q("update profile set photo = '%s', thumb = '%s' where id = %d and uid = %d limit 1",
+ $r = q("update profile set photo = '%s', thumb = '%s' where id = %d and uid = %d",
dbesc($a->get_baseurl() . '/photo/' . $base_image['resource_id'] . '-4'),
dbesc($a->get_baseurl() . '/photo/' . $base_image['resource_id'] . '-5'),
intval($_REQUEST['profile']),
@@ -196,7 +196,7 @@ function profile_photo_post(&$a) {
$channel = $a->get_channel();
$r = q("UPDATE xchan set xchan_photo_mimetype = '%s', xchan_photo_date = '%s'
- where xchan_hash = '%s' limit 1",
+ where xchan_hash = '%s'",
dbesc($im->getType()),
dbesc(datetime_convert()),
dbesc($channel['xchan_hash'])
@@ -302,7 +302,7 @@ function profile_photo_content(&$a) {
// unset any existing profile photos
$r = q("UPDATE photo SET profile = 0 WHERE profile = 1 AND uid = %d",
intval(local_user()));
- $r = q("UPDATE photo SET photo_flags = (photo_flags ^ %d ) WHERE (photo_flags & %d ) AND uid = %d",
+ $r = q("UPDATE photo SET photo_flags = (photo_flags & ~%d ) WHERE (photo_flags & %d )>0 AND uid = %d",
intval(PHOTO_PROFILE),
intval(PHOTO_PROFILE),
intval(local_user()));
@@ -320,7 +320,7 @@ function profile_photo_content(&$a) {
);
$r = q("UPDATE xchan set xchan_photo_date = '%s'
- where xchan_hash = '%s' limit 1",
+ where xchan_hash = '%s'",
dbesc(datetime_convert()),
dbesc($channel['xchan_hash'])
);