]> git.mxchange.org Git - friendica.git/blobdiff - mod/contacts.php
ajax live update for all network pages and subpages
[friendica.git] / mod / contacts.php
index 7236a200d5a94b090fd76c67cb9bc7098eb29927..36f42f8e59eef54c9c880fd8dbd46cd566df56a8 100644 (file)
@@ -53,9 +53,9 @@ function contacts_post(&$a) {
                        return;
                }
        }
+logger('contact_edit ' . print_r($_POST,true));
 
-
-       $priority = intval($_POST['priority']);
+       $priority = intval($_POST['poll']);
        if($priority == (-1))
                
        if($priority > 5 || $priority < 0)
@@ -121,6 +121,15 @@ function contacts_content(&$a) {
                        return; // NOTREACHED
                }
 
+               if($cmd === 'update') {
+
+                       // pull feed and consume it, which should subscribe to the hub.
+
+                       $php_path = ((x($a->config,'php_path') && strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
+                       proc_run($php_path,"include/poller.php","$contact_id");
+                       goaway($a->get_baseurl() . '/contacts/' . $contact_id);
+                       // NOTREACHED
+               }
 
                if($cmd === 'block') {
                        $blocked = (($orig_record[0]['blocked']) ? 0 : 1);
@@ -177,6 +186,12 @@ function contacts_content(&$a) {
                                }
                        }
 
+                       if($orig_record[0]['network'] === 'dfrn') {
+                               require_once('include/items.php');
+                               dfrn_deliver($a->user,$orig_record[0],'placeholder', 1);
+                       }
+
+
                        contact_remove($contact_id);
                        notice( t('Contact has been removed.') . EOL );
                        goaway($a->get_baseurl() . '/contacts');
@@ -230,6 +245,13 @@ function contacts_content(&$a) {
                        $sparkle = '';
                }
 
+               $last_update = (($r[0]['last-update'] == '0000-00-00 00:00:00') 
+                               ? t('Never') 
+                               : datetime_convert('UTC',date_default_timezone_get(),$r[0]['last-update'],'D, j M Y, g:i A'));
+
+               if($r[0]['last-update'] !== '0000-00-00 00:00:00')
+                       $last_update .= ' ' . (($r[0]['last-update'] == $r[0]['success_update']) ? t("\x28Update was successful\x29") : t("\x28Update was not successful\x29"));
+
                $o .= replace_macros($tpl,array(
                        '$header' => t('Contact Editor'),
                        '$visit' => t('Visit $name\'s profile'),
@@ -239,14 +261,13 @@ function contacts_content(&$a) {
                        '$poll_interval' => contact_poll_interval($r[0]['priority']),
                        '$lastupdtext' => t('Last updated: '),
                        '$updpub' => t('Update public posts: '),
-                       '$last_update' => (($r[0]['last-update'] == '0000-00-00 00:00:00') 
-                               ? t('Never') 
-                               : datetime_convert('UTC',date_default_timezone_get(),$r[0]['last-update'],'D, j M Y, g:i A')),
+                       '$last_update' => $last_update,
+                       '$udnow' => t('Update now'),
                        '$profile_select' => contact_profile_assign($r[0]['profile-id'],(($r[0]['network'] !== 'dfrn') ? true : false)),
                        '$contact_id' => $r[0]['id'],
                        '$block_text' => (($r[0]['blocked']) ? t('Unblock this contact') : t('Block this contact') ),
                        '$ignore_text' => (($r[0]['readonly']) ? t('Unignore this contact') : t('Ignore this contact') ),
-                       '$insecure' => (($r[0]['network'] === 'dfrn') ? '' : load_view_file('view/insecure_net.tpl')),
+                       '$insecure' => (($r[0]['network'] === 'stat') ? load_view_file('view/insecure_net.tpl') : ''),
                        '$info' => $r[0]['info'],
                        '$blocked' => (($r[0]['blocked']) ? '<div id="block-message">' . t('Currently blocked') . '</div>' : ''),
                        '$ignored' => (($r[0]['readonly']) ? '<div id="ignore-message">' . t('Currently ignored') . '</div>' : ''),
@@ -351,7 +372,7 @@ function contacts_content(&$a) {
                                '$alt_text' => $alt_text,
                                '$dir_icon' => $dir_icon,
                                '$thumb' => $rr['thumb'], 
-                               '$name' => $rr['name'],
+                               '$name' => substr($rr['name'],0,20),
                                '$sparkle' => $sparkle,
                                '$url' => $url
                        ));