aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-07-05 23:23:43 -0700
committerFriendika <info@friendika.com>2011-07-05 23:23:43 -0700
commit84d12c3e08ae4b6fe228ce881b0c1570175d1667 (patch)
treebb8f4ccca207ff6c226cf79f4ce348c5bc8d9df9 /mod
parentc221d5ea597040c27a8918f9c08629e979a6e273 (diff)
downloadvolse-hubzilla-84d12c3e08ae4b6fe228ce881b0c1570175d1667.tar.gz
volse-hubzilla-84d12c3e08ae4b6fe228ce881b0c1570175d1667.tar.bz2
volse-hubzilla-84d12c3e08ae4b6fe228ce881b0c1570175d1667.zip
move hidewall to user table - queries are getting too complicated and servers falling over
Diffstat (limited to 'mod')
-rw-r--r--mod/community.php13
-rw-r--r--mod/dfrn_poll.php2
-rw-r--r--mod/msearch.php4
-rw-r--r--mod/photos.php6
-rw-r--r--mod/search.php13
-rw-r--r--mod/settings.php9
6 files changed, 20 insertions, 27 deletions
diff --git a/mod/community.php b/mod/community.php
index 90cb7a574..73feaabc6 100644
--- a/mod/community.php
+++ b/mod/community.php
@@ -42,11 +42,11 @@ function community_content(&$a, $update = 0) {
$r = q("SELECT COUNT(*) AS `total`
- FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `profile` ON `profile`.`uid` = `item`.`uid`
+ FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0
AND `wall` = 1 AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
- AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `profile`.`hidewall` = 0
- AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `profile`.`is-default` = 1 "
+ AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `user`.`hidewall` = 0
+ AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 "
);
if(count($r))
@@ -61,14 +61,13 @@ function community_content(&$a, $update = 0) {
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`,
- `user`.`nickname`, `profile`.`hidewall`
+ `user`.`nickname`, `user`.`hidewall`
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`
- LEFT JOIN `profile` ON `profile`.`uid` = `item`.`uid`
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0
AND `wall` = 1 AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
- AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `profile`.`hidewall` = 0
- AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `profile`.`is-default` = 1
+ AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `user`.`hidewall` = 0
+ AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
ORDER BY `received` DESC LIMIT %d, %d ",
intval($a->pager['start']),
intval($a->pager['itemspage'])
diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php
index 7d8568188..76803ef1b 100644
--- a/mod/dfrn_poll.php
+++ b/mod/dfrn_poll.php
@@ -31,7 +31,7 @@ function dfrn_poll_init(&$a) {
killme();
}
- $r = q("SELECT `hidewall` FROM `profile` LEFT JOIN `user` ON `profile`.`uid` = `user`.`uid` WHERE `user`.`nickname` = '%s' AND `profile`.`is-default` = 1 LIMIT 1",
+ $r = q("SELECT `hidewall` FROM `user` WHERE `user`.`nickname` = '%s' LIMIT 1",
dbesc($a->argv[1])
);
if(count($r) && $r[0]['hidewall'])
diff --git a/mod/msearch.php b/mod/msearch.php
index 7d9bbe9e7..94def7d89 100644
--- a/mod/msearch.php
+++ b/mod/msearch.php
@@ -10,13 +10,13 @@ function msearch_post(&$a) {
if(! strlen($search))
killme();
- $r = q("SELECT COUNT(*) AS `total` FROM `profile` WHERE `is-default` = 1 AND `hidewall` = 0 AND MATCH `pub_keywords` AGAINST ('%s') ",
+ $r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `user`.`hidewall` = 0 AND MATCH `pub_keywords` AGAINST ('%s') ",
dbesc($search)
);
if(count($r))
$total = $r[0]['total'];
- $r = q("SELECT `pub_keywords`, `username`, `nickname`, `user`.`uid` FROM `user` LEFT JOIN `profile` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `hidewall` = 0 AND MATCH `pub_keywords` AGAINST ('%s') LIMIT %d , %d ",
+ $r = q("SELECT `pub_keywords`, `username`, `nickname`, `user`.`uid` FROM `user` LEFT JOIN `profile` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `user`.`hidewall` = 0 AND MATCH `pub_keywords` AGAINST ('%s') LIMIT %d , %d ",
dbesc($search),
intval($startrec),
intval($perpage)
diff --git a/mod/photos.php b/mod/photos.php
index 3e0ec5802..4a72bb680 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -816,11 +816,7 @@ function photos_content(&$a) {
}
}
- $r = q("SELECT `hidewall` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1",
- intval($owner_uid)
- );
-
- if(count($r) && $r[0]['hidewall'] && (local_user() != $owner_uid) && (! $remote_contact)) {
+ if($a->data['user']['hidewall'] && (local_user() != $owner_uid) && (! $remote_contact)) {
notice( t('Access to this item is restricted.') . EOL);
return;
}
diff --git a/mod/search.php b/mod/search.php
index d6ab1bb60..9b465c0e5 100644
--- a/mod/search.php
+++ b/mod/search.php
@@ -48,11 +48,11 @@ function search_content(&$a) {
$search_alg = $s_regx;
$r = q("SELECT COUNT(*) AS `total`
- FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `profile` ON `profile`.`uid` = `item`.`uid`
+ FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0
- AND (( `wall` = 1 AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `profile`.`hidewall` = 0)
+ AND (( `wall` = 1 AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `user`.`hidewall` = 0)
OR `item`.`uid` = %d )
- AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `profile`.`is-default` = 1
+ AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
$search_alg ",
intval(local_user()),
dbesc($search)
@@ -70,14 +70,13 @@ function search_content(&$a) {
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`,
- `user`.`nickname`, `profile`.`hidewall`
+ `user`.`nickname`
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`
- LEFT JOIN `profile` ON `profile`.`uid` = `item`.`uid`
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0
- AND (( `wall` = 1 AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `profile`.`hidewall` = 0 )
+ AND (( `wall` = 1 AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `user`.`hidewall` = 0 )
OR `item`.`uid` = %d )
- AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `profile`.`is-default` = 1
+ AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
$search_alg
ORDER BY `received` DESC LIMIT %d , %d ",
intval(local_user()),
diff --git a/mod/settings.php b/mod/settings.php
index 2e942231a..9efa07d76 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -230,7 +230,7 @@ function settings_post(&$a) {
$openidserver = '';
}
- $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `openid` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `allow_location` = %d, `theme` = '%s', `maxreq` = %d, `expire` = %d, `openidserver` = '%s', `blockwall` = %d WHERE `uid` = %d LIMIT 1",
+ $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `openid` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `allow_location` = %d, `theme` = '%s', `maxreq` = %d, `expire` = %d, `openidserver` = '%s', `blockwall` = %d, `hidewall` = %d WHERE `uid` = %d LIMIT 1",
dbesc($username),
dbesc($email),
dbesc($openid),
@@ -248,6 +248,7 @@ function settings_post(&$a) {
intval($expire),
dbesc($openidserver),
intval($blockwall),
+ intval($hidewall),
intval(local_user())
);
if($r)
@@ -257,12 +258,10 @@ function settings_post(&$a) {
SET `publish` = %d,
`net-publish` = %d,
`hide-friends` = %d,
- `hidewall` = %d
WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
intval($publish),
intval($net_publish),
intval($hide_friends),
- intval($hidewall),
intval(local_user())
);
@@ -436,8 +435,8 @@ function settings_content(&$a) {
'$desc' => t('Hide profile details and all your messages from unknown viewers?'),
'$yes_str' => t('Yes'),
'$no_str' => t('No'),
- '$yes_selected' => (($profile['hidewall']) ? " checked=\"checked\" " : ""),
- '$no_selected' => (($profile['hidewall'] == 0) ? " checked=\"checked\" " : "")
+ '$yes_selected' => (($a->user['hidewall']) ? " checked=\"checked\" " : ""),
+ '$no_selected' => (($a->user['hidewall'] == 0) ? " checked=\"checked\" " : "")
));