]> git.mxchange.org Git - friendica.git/blobdiff - mod/notifications.php
security issue
[friendica.git] / mod / notifications.php
index f38f5ae37b214b2b6c2560d2b3c48a241147cd16..b4116bbe3d8000d198dc808ca01bce0ed39600ff 100644 (file)
@@ -8,7 +8,7 @@ function notifications_post(&$a) {
        
        $request_id = (($a->argc > 1) ? $a->argv[1] : 0);
        
-       if($request_id == "all")
+       if($request_id === "all")
                return;
 
        if($request_id) {
@@ -17,7 +17,7 @@ function notifications_post(&$a) {
                        WHERE `request-id` = %d 
                        AND `uid` = %d LIMIT 1",
                                intval($request_id),
-                               intval(get_uid())
+                               intval(local_user())
                );
        
                if(count($r)) {
@@ -33,7 +33,7 @@ function notifications_post(&$a) {
                        );      
                        $r = q("DELETE FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", 
                                intval($request_id),
-                               intval(get_uid())
+                               intval(local_user())
                        );
                        return;
                }
@@ -71,7 +71,7 @@ function notifications_content(&$a) {
                '$hide_text' => ((strlen($sql_extra)) ? t('Show Ignored Requests') : t('Hide Ignored Requests'))
        )); 
 
-       $r = q("SELECT `intro`.`id` AS `intro-id`, `intro`.*, `contact`.* 
+       $r = q("SELECT `intro`.`id` AS `intro_id`, `intro`.*, `contact`.* 
                FROM `intro` LEFT JOIN `contact` ON `intro`.`contact-id` = `contact`.`id`
                WHERE `intro`.`uid` = %d $sql_extra AND `intro`.`blocked` = 0 ",
                        intval($_SESSION['uid']));
@@ -83,15 +83,36 @@ function notifications_content(&$a) {
 
                foreach($r as $rr) {
 
+                       $friend_selected = (($rr['network'] === 'dfrn') ? ' checked="checked" ' : ' disabled ');
+                       $fan_selected = (($rr['network'] === 'stat') ? ' checked="checked" disabled ' : '');
+                       $dfrn_tpl = load_view_file('view/netfriend.tpl');
+
+                       $knowyou   = '';
+                       $dfrn_text = '';
+                                               
+                       if($rr['network'] === 'dfrn') {
+                               $knowyou = t('Claims to be known to you: ') . (($rr['knowyou']) ? t('yes') : t('no'));
+
+                               $dfrn_text = replace_macros($dfrn_tpl,array(
+                                       '$intro_id' => $rr['intro_id'],
+                                       '$friend_selected' => $friend_selected,
+                                       '$fan_selected' => $fan_selected,
+                               ));
+                       }                       
+
+
+
                        $o .= replace_macros($tpl,array(
-                               '$intro_id' => $rr['intro-id'],
-                               '$dfrn-id' => $rr['issued-id'],
+                               '$notify_type' => (($rr['network'] === 'dfrn') ? t('Friend/Connect Request') : t('New Follower')),
+                               '$dfrn_text' => $dfrn_text,     
+                               '$dfrn_id' => $rr['issued-id'],
                                '$uid' => $_SESSION['uid'],
-                               '$contact-id' => $rr['contact-id'],
+                               '$intro_id' => $rr['intro_id'],
+                               '$contact_id' => $rr['contact-id'],
                                '$photo' => ((x($rr,'photo')) ? $rr['photo'] : "images/default-profile.jpg"),
                                '$fullname' => $rr['name'],
-                               '$knowyou' => (($rr['knowyou']) ? t('yes') : t('no')),
                                '$url' => $rr['url'],
+                               '$knowyou' => $knowyou,
                                '$note' => $rr['note']
                        ));
                }