@ -59,10 +59,6 @@ function notifications_post(&$a) {
}
}
function notifications_content ( & $a ) {
if ( ! local_user ()) {
@ -76,57 +72,22 @@ function notifications_content(&$a) {
$o = '' ;
$tabs = array (
array (
'label' => t ( 'System' ),
'url' => 'notifications/system' ,
'sel' => (( $a -> argv [ 1 ] == 'system' ) ? 'active' : '' ),
'accesskey' => 'y' ,
),
array (
'label' => t ( 'Network' ),
'url' => 'notifications/network' ,
'sel' => (( $a -> argv [ 1 ] == 'network' ) ? 'active' : '' ),
'accesskey' => 'w' ,
),
array (
'label' => t ( 'Personal' ),
'url' => 'notifications/personal' ,
'sel' => (( $a -> argv [ 1 ] == 'personal' ) ? 'active' : '' ),
'accesskey' => 'r' ,
),
array (
'label' => t ( 'Home' ),
'url' => 'notifications/home' ,
'sel' => (( $a -> argv [ 1 ] == 'home' ) ? 'active' : '' ),
'accesskey' => 'h' ,
),
array (
'label' => t ( 'Introductions' ),
'url' => 'notifications/intros' ,
'sel' => (( $a -> argv [ 1 ] == 'intros' ) ? 'active' : '' ),
'accesskey' => 'i' ,
),
/* array (
'label' => t ( 'Messages' ),
'url' => 'message' ,
'sel' => '' ,
), */ /*while I can have notifications for messages, this tablist is not place for message page link */
);
$o = " " ;
// get the nav tabs for the notification pages
$tabs = notifications_tabs ( $a );
$notif_content = array ();
if ( (( $a -> argc > 1 ) && ( $a -> argv [ 1 ] == 'intros' )) || (( $a -> argc == 1 ))) {
nav_set_selected ( 'introductions' );
if (( $a -> argc > 2 ) && ( $a -> argv [ 2 ] == 'all' ))
$sql_extra = '' ;
else
$sql_extra = " AND `ignore` = 0 " ;
$notif_header = t ( 'Notifications' );
$notif_tpl = get_markup_template ( 'notifications.tpl' );
$notif_content .= '<a href="' . (( strlen ( $sql_extra )) ? 'notifications/intros/all' : 'notifications/intros' ) . '" id="notifications-show-hide-link" >'
$notif_ignored_lnk .= '<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`
@ -162,7 +123,7 @@ function notifications_content(&$a) {
$return_addr = bin2hex ( $a -> user [ 'nickname' ] . '@' . $a -> get_hostname () . (( $a -> path ) ? '/' . $a -> path : '' ));
$notif_content . = replace_macros ( $sugg , array (
$notif_content [] = replace_macros ( $sugg , array (
'$str_notifytype' => t ( 'Notification type: ' ),
'$notify_type' => t ( 'Friend Suggestion' ),
'$intro_id' => $rr [ 'intro_id' ],
@ -195,7 +156,8 @@ function notifications_content(&$a) {
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' ));
$lbl_knowyou = t ( 'Claims to be known to you: ' );
$knowyou = (( $rr [ 'knowyou' ]) ? t ( 'yes' ) : t ( 'no' ));
$helptext = t ( 'Shall your connection be bidirectional or not? "Friend" implies that you allow to read and you subscribe to their posts. "Fan/Admirer" means that you allow to read but you do not want to read theirs. Approve as: ' );
} else {
$knowyou = '' ;
@ -231,7 +193,7 @@ function notifications_content(&$a) {
$rr [ 'ggender' ] = " " ;
}
$notif_content . = replace_macros ( $tpl , array (
$notif_content [] = replace_macros ( $tpl , array (
'$header' => htmlentities ( $header ),
'$str_notifytype' => t ( 'Notification type: ' ),
'$notify_type' => (( $rr [ 'network' ] !== NETWORK_OSTATUS ) ? t ( 'Friend/Connect Request' ) : t ( 'New Follower' )),
@ -243,18 +205,22 @@ function notifications_content(&$a) {
'$photo' => (( x ( $rr , 'photo' )) ? proxy_url ( $rr [ 'photo' ], false , PROXY_SIZE_SMALL ) : " images/person-175.jpg " ),
'$fullname' => $rr [ 'name' ],
'$location' => bbcode ( $rr [ 'glocation' ], false , false ),
'$location_label ' => t ( 'Location:' ),
'$lbl_l ocation' => t ( 'Location:' ),
'$about' => bbcode ( $rr [ 'gabout' ], false , false ),
'$about_label ' => t ( 'About:' ),
'$lbl_ about' => t ( 'About:' ),
'$keywords' => $rr [ 'gkeywords' ],
'$keywords_label ' => t ( 'Tags:' ),
'$lbl_ keywords' => t ( 'Tags:' ),
'$gender' => $rr [ 'ggender' ],
'$gender_label ' => t ( 'Gender:' ),
'$lbl_ gender' => t ( 'Gender:' ),
'$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' => $rr [ 'url' ],
'$zrl' => zrl ( $rr [ 'url' ]),
'$url_label' => t ( 'Profile URL' ),
'$lbl_url' => t ( 'Profile URL' ),
'$addr' => $rr [ 'addr' ],
'$lbl_knowyou' => $lbl_knowyou ,
'$lbl_network' => t ( 'Network:' ),
'$network' => network_to_name ( $rr [ 'gnetwork' ], $rr [ 'url' ]),
'$knowyou' => $knowyou ,
'$approve' => t ( 'Approve' ),
'$note' => $rr [ 'note' ],
@ -267,17 +233,9 @@ function notifications_content(&$a) {
else
info ( t ( 'No introductions.' ) . EOL );
$o .= replace_macros ( $notif_tpl , array (
'$notif_header' => t ( 'Notifications' ),
'$tabs' => $tabs ,
'$notif_content' => $notif_content ,
));
$o .= paginate ( $a );
return $o ;
} else if (( $a -> argc > 1 ) && ( $a -> argv [ 1 ] == 'network' )) {
$notif_header = t ( 'Network Notifications' );
$notif_tpl = get_markup_template ( 'notifications.tpl' );
$r = q ( " SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`,
@ -295,14 +253,12 @@ function notifications_content(&$a) {
$tpl_item_comments = get_markup_template ( 'notifications_comments_item.tpl' );
$tpl_item_posts = get_markup_template ( 'notifications_posts_item.tpl' );
$notif_content = '' ;
if ( $r ) {
foreach ( $r as $it ) {
switch ( $it [ 'verb' ]){
case ACTIVITY_LIKE :
$notif_content . = replace_macros ( $tpl_item_likes , array (
$notif_content [] = replace_macros ( $tpl_item_likes , array (
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a -> get_baseurl ( true ) . '/display/' . $it [ 'pguid' ],
'$item_image' => proxy_url ( $it [ 'author-avatar' ], false , PROXY_SIZE_MICRO ),
@ -312,7 +268,7 @@ function notifications_content(&$a) {
break ;
case ACTIVITY_DISLIKE :
$notif_content . = replace_macros ( $tpl_item_dislikes , array (
$notif_content [] = replace_macros ( $tpl_item_dislikes , array (
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a -> get_baseurl ( true ) . '/display/' . $it [ 'pguid' ],
'$item_image' => proxy_url ( $it [ 'author-avatar' ], false , PROXY_SIZE_MICRO ),
@ -327,7 +283,7 @@ function notifications_content(&$a) {
$obj = parse_xml_string ( $xmlhead . $it [ 'object' ]);
$it [ 'fname' ] = $obj -> title ;
$notif_content . = replace_macros ( $tpl_item_friends , array (
$notif_content [] = replace_macros ( $tpl_item_friends , array (
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a -> get_baseurl ( true ) . '/display/' . $it [ 'pguid' ],
'$item_image' => proxy_url ( $it [ 'author-avatar' ], false , PROXY_SIZE_MICRO ),
@ -342,7 +298,7 @@ function notifications_content(&$a) {
: sprintf ( t ( " %s commented on %s's post " ), $it [ 'author-name' ], $it [ 'pname' ]));
$tpl = (( $it [ 'id' ] == $it [ 'parent' ]) ? $tpl_item_posts : $tpl_item_comments );
$notif_content . = replace_macros ( $tpl , array (
$notif_content [] = replace_macros ( $tpl , array (
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a -> get_baseurl ( true ) . '/display/' . $it [ 'pguid' ],
'$item_image' => proxy_url ( $it [ 'author-avatar' ], false , PROXY_SIZE_MICRO ),
@ -354,17 +310,12 @@ function notifications_content(&$a) {
} else {
$notif_content = t ( 'No more network notifications.' );
$notif_no content = t ( 'No more network notifications.' );
}
$o .= replace_macros ( $notif_tpl , array (
'$notif_header' => t ( 'Network Notifications' ),
'$tabs' => $tabs ,
'$notif_content' => $notif_content ,
));
} else if (( $a -> argc > 1 ) && ( $a -> argv [ 1 ] == 'system' )) {
$notif_header = t ( 'System Notifications' );
$notif_tpl = get_markup_template ( 'notifications.tpl' );
$not_tpl = get_markup_template ( 'notify.tpl' );
@ -376,7 +327,7 @@ function notifications_content(&$a) {
if ( count ( $r ) > 0 ) {
foreach ( $r as $it ) {
$notif_content . = replace_macros ( $not_tpl , array (
$notif_content [] = replace_macros ( $not_tpl , array (
'$item_link' => $a -> get_baseurl ( true ) . '/notify/view/' . $it [ 'id' ],
'$item_image' => proxy_url ( $it [ 'photo' ], false , PROXY_SIZE_MICRO ),
'$item_text' => strip_tags ( bbcode ( $it [ 'msg' ])),
@ -384,17 +335,12 @@ function notifications_content(&$a) {
));
}
} else {
$notif_content . = t ( 'No more system notifications.' );
$notif_no content = t ( 'No more system notifications.' );
}
$o .= replace_macros ( $notif_tpl , array (
'$notif_header' => t ( 'System Notifications' ),
'$tabs' => $tabs ,
'$notif_content' => $notif_content ,
));
} else if (( $a -> argc > 1 ) && ( $a -> argv [ 1 ] == 'personal' )) {
$notif_header = t ( 'Personal Notifications' );
$notif_tpl = get_markup_template ( 'notifications.tpl' );
$myurl = $a -> get_baseurl ( true ) . '/profile/' . $a -> user [ 'nickname' ];
@ -424,14 +370,12 @@ function notifications_content(&$a) {
$tpl_item_comments = get_markup_template ( 'notifications_comments_item.tpl' );
$tpl_item_posts = get_markup_template ( 'notifications_posts_item.tpl' );
$notif_content = '' ;
if ( count ( $r ) > 0 ) {
foreach ( $r as $it ) {
switch ( $it [ 'verb' ]){
case ACTIVITY_LIKE :
$notif_content . = replace_macros ( $tpl_item_likes , array (
$notif_content [] = replace_macros ( $tpl_item_likes , array (
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a -> get_baseurl ( true ) . '/display/' . $it [ 'pguid' ],
'$item_image' => $it [ 'author-avatar' ],
@ -441,7 +385,7 @@ function notifications_content(&$a) {
break ;
case ACTIVITY_DISLIKE :
$notif_content . = replace_macros ( $tpl_item_dislikes , array (
$notif_content [] = replace_macros ( $tpl_item_dislikes , array (
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a -> get_baseurl ( true ) . '/display/' . $it [ 'pguid' ],
'$item_image' => $it [ 'author-avatar' ],
@ -456,7 +400,7 @@ function notifications_content(&$a) {
$obj = parse_xml_string ( $xmlhead . $it [ 'object' ]);
$it [ 'fname' ] = $obj -> title ;
$notif_content . = replace_macros ( $tpl_item_friends , array (
$notif_content [] = replace_macros ( $tpl_item_friends , array (
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a -> get_baseurl ( true ) . '/display/' . $it [ 'pguid' ],
'$item_image' => $it [ 'author-avatar' ],
@ -471,7 +415,7 @@ function notifications_content(&$a) {
: sprintf ( t ( " %s commented on %s's post " ), $it [ 'author-name' ], $it [ 'pname' ]));
$tpl = (( $it [ 'id' ] == $it [ 'parent' ]) ? $tpl_item_posts : $tpl_item_comments );
$notif_content . = replace_macros ( $tpl , array (
$notif_content [] = replace_macros ( $tpl , array (
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a -> get_baseurl ( true ) . '/display/' . $it [ 'pguid' ],
'$item_image' => $it [ 'author-avatar' ],
@ -483,22 +427,12 @@ function notifications_content(&$a) {
} else {
$notif_content = t ( 'No more personal notifications.' );
$notif_no content = t ( 'No more personal notifications.' );
}
$o .= replace_macros ( $notif_tpl , array (
'$notif_header' => t ( 'Personal Notifications' ),
'$tabs' => $tabs ,
'$notif_content' => $notif_content ,
));
} else if (( $a -> argc > 1 ) && ( $a -> argv [ 1 ] == 'home' )) {
$notif_header = t ( 'Home Notifications' );
$notif_tpl = get_markup_template ( 'notifications.tpl' );
$r = q ( " SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`,
@ -515,14 +449,12 @@ function notifications_content(&$a) {
$tpl_item_friends = get_markup_template ( 'notifications_friends_item.tpl' );
$tpl_item_comments = get_markup_template ( 'notifications_comments_item.tpl' );
$notif_content = '' ;
if ( count ( $r ) > 0 ) {
foreach ( $r as $it ) {
switch ( $it [ 'verb' ]){
case ACTIVITY_LIKE :
$notif_content . = replace_macros ( $tpl_item_likes , array (
$notif_content [] = replace_macros ( $tpl_item_likes , array (
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a -> get_baseurl ( true ) . '/display/' . $it [ 'pguid' ],
'$item_image' => $it [ 'author-avatar' ],
@ -532,7 +464,7 @@ function notifications_content(&$a) {
break ;
case ACTIVITY_DISLIKE :
$notif_content . = replace_macros ( $tpl_item_dislikes , array (
$notif_content [] = replace_macros ( $tpl_item_dislikes , array (
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a -> get_baseurl ( true ) . '/display/' . $it [ 'pguid' ],
'$item_image' => $it [ 'author-avatar' ],
@ -547,7 +479,7 @@ function notifications_content(&$a) {
$obj = parse_xml_string ( $xmlhead . $it [ 'object' ]);
$it [ 'fname' ] = $obj -> title ;
$notif_content . = replace_macros ( $tpl_item_friends , array (
$notif_content [] = replace_macros ( $tpl_item_friends , array (
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a -> get_baseurl ( true ) . '/display/' . $it [ 'pguid' ],
'$item_image' => $it [ 'author-avatar' ],
@ -557,7 +489,7 @@ function notifications_content(&$a) {
break ;
default :
$notif_content . = replace_macros ( $tpl_item_comments , array (
$notif_content [] = replace_macros ( $tpl_item_comments , array (
//'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
'$item_link' => $a -> get_baseurl ( true ) . '/display/' . $it [ 'pguid' ],
'$item_image' => $it [ 'author-avatar' ],
@ -568,16 +500,65 @@ function notifications_content(&$a) {
}
} else {
$notif_content = t ( 'No more home notifications.' );
$notif_no content = t ( 'No more home notifications.' );
}
$o .= replace_macros ( $notif_tpl , array (
'$notif_header' => t ( 'Home Notifications' ),
'$tabs' => $tabs ,
'$notif_content' => $notif_content ,
));
}
$o .= replace_macros ( $notif_tpl , array (
'$notif_header' => $notif_header ,
'$tabs' => $tabs ,
'$notif_content' => $notif_content ,
'$notif_nocontent' => $notif_nocontent ,
'$notif_ignored_lnk' => $notif_ignored_lnk ,
));
$o .= paginate ( $a );
return $o ;
}
/**
* @ brief List of pages for the Notifications TabBar
*
* @ param app $a The
* @ return array with with notifications TabBar data
*/
function notifications_tabs ( $a ) {
$tabs = array (
array (
'label' => t ( 'System' ),
'url' => 'notifications/system' ,
'sel' => (( $a -> argv [ 1 ] == 'system' ) ? 'active' : '' ),
'accesskey' => 'y' ,
),
array (
'label' => t ( 'Network' ),
'url' => 'notifications/network' ,
'sel' => (( $a -> argv [ 1 ] == 'network' ) ? 'active' : '' ),
'accesskey' => 'w' ,
),
array (
'label' => t ( 'Personal' ),
'url' => 'notifications/personal' ,
'sel' => (( $a -> argv [ 1 ] == 'personal' ) ? 'active' : '' ),
'accesskey' => 'r' ,
),
array (
'label' => t ( 'Home' ),
'url' => 'notifications/home' ,
'sel' => (( $a -> argv [ 1 ] == 'home' ) ? 'active' : '' ),
'accesskey' => 'h' ,
),
array (
'label' => t ( 'Introductions' ),
'url' => 'notifications/intros' ,
'sel' => (( $a -> argv [ 1 ] == 'intros' ) ? 'active' : '' ),
'accesskey' => 'i' ,
),
/* array (
'label' => t ( 'Messages' ),
'url' => 'message' ,
'sel' => '' ,
), */ /*while I can have notifications for messages, this tablist is not place for message page link */
);
return $tabs ;
}