4 function notify_init(&$a) {
8 if($a->argc > 2 && $a->argv[1] === 'view' && intval($a->argv[2])) {
9 $r = q("select * from notify where id = %d and uid = %d limit 1",
14 q("update notify set seen = 1 where id = %d and uid = %d limit 1",
18 goaway($r[0]['link']);
21 goaway($a->get_baseurl());
24 if($a->argc > 2 && $a->argv[1] === 'mark' && $a->argv[2] === 'all' ) {
25 $r = q("update notify set seen = 1 where uid = %d",
28 $j = json_encode(array('result' => ($r) ? 'success' : 'fail'));
36 function notify_content(&$a) {
40 $notif_tpl = get_markup_template('notifications.tpl');
42 $not_tpl = get_markup_template('notify.tpl');
43 require_once('include/bbcode.php');
45 $r = q("SELECT * from notify where uid = %d and seen = 0 order by date desc",
51 $notif_content .= replace_macros($not_tpl,array(
52 '$item_link' => $a->get_baseurl().'/notify/view/'. $it['id'],
53 '$item_image' => $it['photo'],
54 '$item_text' => strip_tags(bbcode($it['msg'])),
55 '$item_when' => relative_date($it['date'])
59 $notif_content .= t('No more system notifications.');
62 $o .= replace_macros($notif_tpl,array(
63 '$notif_header' => t('System Notifications'),
64 '$tabs' => '', // $tabs,
65 '$notif_content' => $notif_content,