aboutsummaryrefslogtreecommitdiffstats
path: root/mod/notifications.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-12-06 00:02:39 -0800
committerfriendica <info@friendica.com>2013-12-06 00:02:39 -0800
commit1aa79d9ee69bbb7afb2c9b87579aad252ef66730 (patch)
tree266cb889d55e98a06a3353ee4423ddc018c63dbc /mod/notifications.php
parent78d19f3395e8fd0660e58498c15850e1323ec4b3 (diff)
downloadvolse-hubzilla-1aa79d9ee69bbb7afb2c9b87579aad252ef66730.tar.gz
volse-hubzilla-1aa79d9ee69bbb7afb2c9b87579aad252ef66730.tar.bz2
volse-hubzilla-1aa79d9ee69bbb7afb2c9b87579aad252ef66730.zip
some code cleanup - gad I forgot what a mess the "other" notifications tabs (everything but system) were in. Maybe I'll just remove them so we can start over.
Diffstat (limited to 'mod/notifications.php')
-rw-r--r--mod/notifications.php106
1 files changed, 9 insertions, 97 deletions
diff --git a/mod/notifications.php b/mod/notifications.php
index 397ed272b..18f515704 100644
--- a/mod/notifications.php
+++ b/mod/notifications.php
@@ -106,110 +106,22 @@ function notifications_content(&$a) {
$o = "";
-//Disabled
- if( (($a->argc > 1) && ($a->argv[1] == 'intros')) || (($a->argc == 1))) {
+ if((argc() > 1) && (argv(1) == 'intros')) {
nav_set_selected('introductions');
- if(($a->argc > 2) && ($a->argv[2] == 'all'))
- $sql_extra = '';
- else
- $sql_extra = " AND `ignore` = 0 ";
-
- $notif_tpl = get_markup_template('notifications.tpl');
- $notif_content .= '<a href="' . ((strlen($sql_extra)) ? 'notifications/intros/all' : 'notifications/intros' ) . '" id="notifications-show-hide-link" >'
- . ((strlen($sql_extra)) ? t('Show Ignored Requests') : t('Hide Ignored Requests')) . '</a></div>' . "\r\n";
-
- $r = q("SELECT COUNT(*) AS `total` FROM `intro`
- WHERE `intro`.`uid` = %d $sql_extra AND `intro`.`blocked` = 0 ",
- intval($_SESSION['uid'])
+ $r = q("select * from abook left join xchan on abook_xchan = xchan_hash where uid = %d and (abook_flags & %d) and not (abook_flags & %d)",
+ intval(local_user()),
+ intval(ABOOK_FLAG_PENDING),
+ intval(ABOOK_FLAG_IGNORED)
);
- if($r && count($r)) {
- $a->set_pager_total($r[0]['total']);
- $a->set_pager_itemspage(20);
- }
-
- $r = q("SELECT `intro`.`id` AS `intro_id`, `intro`.*, `contact`.*, `fcontact`.`name` AS `fname`,`fcontact`.`url` AS `furl`,`fcontact`.`photo` AS `fphoto`,`fcontact`.`request` AS `frequest`
- FROM `intro` LEFT JOIN `contact` ON `contact`.`id` = `intro`.`contact-id` LEFT JOIN `fcontact` ON `intro`.`fid` = `fcontact`.`id`
- WHERE `intro`.`uid` = %d $sql_extra AND `intro`.`blocked` = 0 ",
- intval($_SESSION['uid']));
-
- if(($r !== false) && (count($r))) {
-
- $sugg = get_markup_template('suggestions.tpl');
- $tpl = get_markup_template("intros.tpl");
+ if($r) {
+ // FIXME finish this
foreach($r as $rr) {
- if($rr['fid']) {
-
- $return_addr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname() . (($a->path) ? '/' . $a->path : ''));
- $notif_content .= replace_macros($sugg,array(
- '$str_notifytype' => t('Notification type: '),
- '$notify_type' => t('Friend Suggestion'),
- '$intro_id' => $rr['intro_id'],
- '$madeby' => sprintf( t('suggested by %s'),$rr['name']),
- '$contact_id' => $rr['contact-id'],
- '$photo' => ((x($rr,'fphoto')) ? $rr['fphoto'] : "images/person-175.jpg"),
- '$fullname' => $rr['fname'],
- '$url' => zid($rr['furl']),
- '$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''),
- '$activity' => array('activity', t('Post a new friend activity'), (intval(get_pconfig(local_user(),'system','post_newfriend')) ? '1' : 0), t('if applicable')),
-
- '$knowyou' => $knowyou,
- '$approve' => t('Approve'),
- '$note' => $rr['note'],
- '$request' => $rr['frequest'] . '?addr=' . $return_addr,
- '$ignore' => t('Ignore'),
- '$discard' => t('Discard')
-
- ));
-
- continue;
- }
- $friend_selected = (($rr['network'] !== NETWORK_OSTATUS) ? ' checked="checked" ' : ' disabled ');
- $fan_selected = (($rr['network'] === NETWORK_OSTATUS) ? ' checked="checked" disabled ' : '');
- $dfrn_tpl = get_markup_template('netfriend.tpl');
-
- $knowyou = '';
- $dfrn_text = '';
-
- if($rr['network'] === NETWORK_DFRN || $rr['network'] === NETWORK_DIASPORA) {
- if($rr['network'] === NETWORK_DFRN)
- $knowyou = t('Claims to be known to you: ') . (($rr['knowyou']) ? t('yes') : t('no'));
- else
- $knowyou = '';
- $dfrn_text = replace_macros($dfrn_tpl,array(
- '$intro_id' => $rr['intro_id'],
- '$friend_selected' => $friend_selected,
- '$fan_selected' => $fan_selected,
- '$approve_as' => t('Approve as: '),
- '$as_friend' => t('Friend'),
- '$as_fan' => (($rr['network'] == NETWORK_DIASPORA) ? t('Sharer') : t('Fan/Admirer'))
- ));
- }
-
- $notif_content .= replace_macros($tpl,array(
- '$str_notifytype' => t('Notification type: '),
- '$notify_type' => (($rr['network'] !== NETWORK_OSTATUS) ? t('Friend/Connect Request') : t('New Follower')),
- '$dfrn_text' => $dfrn_text,
- '$dfrn_id' => $rr['issued_id'],
- '$uid' => $_SESSION['uid'],
- '$intro_id' => $rr['intro_id'],
- '$contact_id' => $rr['contact-id'],
- '$photo' => ((x($rr,'photo')) ? $rr['photo'] : "images/person-175.jpg"),
- '$fullname' => $rr['name'],
- '$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''),
- '$activity' => array('activity', t('Post a new friend activity'), (intval(get_pconfig(local_user(),'system','post_newfriend')) ? '1' : 0), t('if applicable')),
- '$url' => zid($rr['url']),
- '$knowyou' => $knowyou,
- '$approve' => t('Approve'),
- '$note' => $rr['note'],
- '$ignore' => t('Ignore'),
- '$discard' => t('Discard')
+ }
- ));
- }
}
else
info( t('No introductions.') . EOL);
@@ -220,7 +132,7 @@ function notifications_content(&$a) {
'$notif_content' => $notif_content,
));
- $o .= paginate($a);
+// $o .= paginate($a);
return $o;
}