aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-07-14 20:39:46 -0700
committerfriendica <info@friendica.com>2012-07-14 20:39:46 -0700
commit03209d2d0dc6b0ceed2325bff598fede2c538301 (patch)
treefb230666b2b79f97ddd744fe155a4b088640ad29 /mod
parenta20a6377277a985fa596b0ea460d91b97f79b4a5 (diff)
downloadvolse-hubzilla-03209d2d0dc6b0ceed2325bff598fede2c538301.tar.gz
volse-hubzilla-03209d2d0dc6b0ceed2325bff598fede2c538301.tar.bz2
volse-hubzilla-03209d2d0dc6b0ceed2325bff598fede2c538301.zip
updates
Diffstat (limited to 'mod')
-rw-r--r--mod/community.php48
-rwxr-xr-xmod/like.php2
-rw-r--r--mod/network.php42
-rw-r--r--mod/profile.php37
-rw-r--r--mod/search.php46
5 files changed, 108 insertions, 67 deletions
diff --git a/mod/community.php b/mod/community.php
index fb28f7805..354f68528 100644
--- a/mod/community.php
+++ b/mod/community.php
@@ -44,22 +44,24 @@ function community_content(&$a, $update = 0) {
// Only public posts can be shown
// OR your own posts if you are a logged in member
+ if(! get_pconfig(local_user(),'system','alt_pager')) {
+ $r = q("SELECT COUNT(distinct(`item`.`uri`)) AS `total`
+ 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 `item`.`moderated` = 0
+ AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
+ AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''
+ AND `item`.`private` = 0 AND `item`.`wall` = 1 AND `user`.`hidewall` = 0
+ AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0"
+ );
+
+ if(count($r))
+ $a->set_pager_total($r[0]['total']);
+
+ if(! $r[0]['total']) {
+ info( t('No results.') . EOL);
+ return $o;
+ }
- $r = q("SELECT distinct(`item`.`uri`) AS `total`
- 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 `item`.`moderated` = 0
- AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
- AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''
- AND `item`.`private` = 0 AND `item`.`wall` = 1 AND `user`.`hidewall` = 0
- AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 group by `item`.`uri` "
- );
-
- if(count($r))
- $a->set_pager_total($r[0]['total']);
-
- if(! $r[0]['total']) {
- info( t('No results.') . EOL);
- return $o;
}
$r = q("SELECT distinct(`item`.`uri`), `item`.*, `item`.`id` AS `item_id`,
@@ -70,9 +72,9 @@ function community_content(&$a, $update = 0) {
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 `item`.`moderated` = 0
- AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
+ AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''
- AND `item`.`private` = 0 AND `item`.`wall` = 1 AND `user`.`hidewall` = 0
+ AND `item`.`private` = 0 AND `item`.`wall` = 1 AND `user`.`hidewall` = 0
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 group by `item`.`uri`
ORDER BY `received` DESC LIMIT %d, %d ",
intval($a->pager['start']),
@@ -80,11 +82,21 @@ function community_content(&$a, $update = 0) {
);
+ if(! count($r)) {
+ info( t('No results.') . EOL);
+ return $o;
+ }
+
// we behave the same in message lists as the search module
$o .= conversation($a,$r,'community',$update);
- $o .= paginate($a);
+ if(! get_pconfig(local_user(),'system','alt_pager')) {
+ $o .= paginate($a);
+ }
+ else {
+ $o .= alt_pager($a,count($r));
+ }
return $o;
}
diff --git a/mod/like.php b/mod/like.php
index 8fe0cf735..aaa85928c 100755
--- a/mod/like.php
+++ b/mod/like.php
@@ -117,7 +117,7 @@ function like_content(&$a) {
$like_item = $r[0];
// Already voted, undo it
- $r = q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `id` = %d LIMIT 1",
+ $r = q("UPDATE `item` SET `deleted` = 1, `unseen` = 1, `changed` = '%s' WHERE `id` = %d LIMIT 1",
dbesc(datetime_convert()),
intval($like_item['id'])
);
diff --git a/mod/network.php b/mod/network.php
index f058319f4..07b91b1be 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -560,21 +560,23 @@ function network_content(&$a, $update = 0) {
}
else {
- $r = q("SELECT COUNT(*) AS `total`
- FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
- WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
- AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
- $sql_extra2 $sql_extra3
- $sql_extra $sql_nets ",
- intval($_SESSION['uid'])
- );
-
- if(count($r)) {
- $a->set_pager_total($r[0]['total']);
- $itemspage_network = get_pconfig(local_user(),'system','itemspage_network');
- $a->set_pager_itemspage(((intval($itemspage_network)) ? $itemspage_network : 40));
- }
- $pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
+ if(! get_pconfig(local_user(),'system','alt_pager')) {
+ $r = q("SELECT COUNT(*) AS `total`
+ FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
+ WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
+ AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
+ $sql_extra2 $sql_extra3
+ $sql_extra $sql_nets ",
+ intval($_SESSION['uid'])
+ );
+
+ if(count($r)) {
+ $a->set_pager_total($r[0]['total']);
+ }
+ }
+ $itemspage_network = get_pconfig(local_user(),'system','itemspage_network');
+ $a->set_pager_itemspage(((intval($itemspage_network)) ? $itemspage_network : 40));
+ $pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
}
$simple_update = (($update) ? " and `item`.`unseen` = 1 " : '');
@@ -613,7 +615,8 @@ function network_content(&$a, $update = 0) {
if($update) {
$r = q("SELECT `parent` AS `item_id`, `contact`.`uid` AS `contact_uid`
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
- WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
+ WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND
+ (`item`.`deleted` = 0 OR item.verb = '" . ACTIVITY_LIKE ."' OR item.verb = '" . ACTIVITY_DISLIKE . "')
and `item`.`moderated` = 0 and `item`.`unseen` = 1
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
$sql_extra3 $sql_extra $sql_nets ",
@@ -687,7 +690,12 @@ function network_content(&$a, $update = 0) {
$o .= conversation($a,$items,$mode,$update);
if(! $update) {
- $o .= paginate($a);
+ if(! get_pconfig(local_user(),'system','alt_pager')) {
+ $o .= paginate($a);
+ }
+ else {
+ $o .= alt_pager($a,count($items));
+ }
}
return $o;
diff --git a/mod/profile.php b/mod/profile.php
index c9406c464..b5fdeec3a 100644
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -204,7 +204,8 @@ function profile_content(&$a, $update = 0) {
$r = q("SELECT distinct(parent) AS `item_id`, `contact`.`uid` AS `contact-uid`
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
- WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
+ WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND
+ (`item`.`deleted` = 0 OR item.verb = '" . ACTIVITY_LIKE ."' OR item.verb = '" . ACTIVITY_DISLIKE . "')
and `item`.`moderated` = 0 and `item`.`unseen` = 1
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
AND `item`.`wall` = 1
@@ -227,20 +228,21 @@ function profile_content(&$a, $update = 0) {
$sql_extra2 .= protect_sprintf(sprintf(" AND item.created >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2))));
}
-
- $r = q("SELECT COUNT(*) AS `total`
- FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
- WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
- and `item`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
- AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 1
- $sql_extra $sql_extra2 ",
- intval($a->profile['profile_uid'])
- );
-
- if(count($r)) {
- $a->set_pager_total($r[0]['total']);
- $a->set_pager_itemspage(40);
+ if(! get_pconfig($a->profile['profile_uid'],'system','alt_pager')) {
+ $r = q("SELECT COUNT(*) AS `total`
+ FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
+ WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
+ and `item`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
+ AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 1
+ $sql_extra $sql_extra2 ",
+ intval($a->profile['profile_uid'])
+ );
+
+ if(count($r)) {
+ $a->set_pager_total($r[0]['total']);
+ }
}
+ $a->set_pager_itemspage(40);
$pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
@@ -324,7 +326,12 @@ function profile_content(&$a, $update = 0) {
$o .= conversation($a,$items,'profile',$update);
if(! $update) {
- $o .= paginate($a);
+ if(! get_pconfig($a->profile['profile_uid'],'system','alt_pager')) {
+ $o .= paginate($a);
+ }
+ else {
+ $o .= alt_pager($a,count($items));
+ }
}
return $o;
diff --git a/mod/search.php b/mod/search.php
index e9e20b227..5ba35d2b3 100644
--- a/mod/search.php
+++ b/mod/search.php
@@ -130,21 +130,24 @@ function search_content(&$a) {
// OR your own posts if you are a logged in member
// No items will be shown if the member has a blocked profile wall.
- $r = q("SELECT distinct(`item`.`uri`) as `total`
- 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 `item`.`moderated` = 0
- AND (( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `item`.`private` = 0 AND `user`.`hidewall` = 0)
- OR `item`.`uid` = %d )
- AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
- $sql_extra group by `item`.`uri` ",
- intval(local_user())
- );
-
- if(count($r))
- $a->set_pager_total(count($r));
- if(! count($r)) {
- info( t('No results.') . EOL);
- return $o;
+ if(! get_pconfig(local_user(),'system','alt_pager')) {
+ $r = q("SELECT distinct(`item`.`uri`) as `total`
+ 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 `item`.`moderated` = 0
+ AND (( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `item`.`private` = 0 AND `user`.`hidewall` = 0)
+ OR `item`.`uid` = %d )
+ AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
+ $sql_extra group by `item`.`uri` ",
+ intval(local_user())
+ );
+
+ if(count($r))
+ $a->set_pager_total(count($r));
+
+ if(! count($r)) {
+ info( t('No results.') . EOL);
+ return $o;
+ }
}
$r = q("SELECT distinct(`item`.`uri`), `item`.*, `item`.`id` AS `item_id`,
@@ -170,6 +173,12 @@ function search_content(&$a) {
$a = fetch_post_tags($a);
+ if(! count($r)) {
+ info( t('No results.') . EOL);
+ return $o;
+ }
+
+
if($tag)
$o .= '<h2>Items tagged with: ' . htmlspecialchars($search) . '</h2>';
else
@@ -177,7 +186,12 @@ function search_content(&$a) {
$o .= conversation($a,$r,'search',false);
- $o .= paginate($a);
+ if(! get_pconfig(local_user(),'system','alt_pager')) {
+ $o .= paginate($a);
+ }
+ else {
+ $o .= alt_pager($a,count($r));
+ }
return $o;
}