]> git.mxchange.org Git - friendica.git/commitdiff
properly handle error returns in post w/ajax
authorFriendika <info@friendika.com>
Thu, 17 Feb 2011 04:25:10 +0000 (20:25 -0800)
committerFriendika <info@friendika.com>
Thu, 17 Feb 2011 04:25:10 +0000 (20:25 -0800)
mod/follow.php
mod/item.php

index 763ffb1b01c456e436057d9cfe72f94324273974..28441eae8fbd589010019a86e3a637b56cd6332b 100644 (file)
@@ -117,6 +117,10 @@ function follow_post(&$a) {
                        $author = $feed->get_author();
                        if($author) {                   
                                $vcard['fn'] = unxmlify(trim($author->get_name()));
+                               if(! $vcard['fn'])
+                                       $vcard['fn'] = trim(unxmlify($author->get_email()));
+                               if(strpos($vcard['fn'],'@') !== false)
+                                       $vcard['fn'] = substr($vcard['fn'],0,strpos($vcard['fn'],'@'));
                                $vcard['nick'] = strtolower(notags(unxmlify($vcard['fn'])));
                                if(strpos($vcard['nick'],' '))
                                        $vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' ')));
index 21dfb45607d5239f5e7340e652a8d38324c8c9a6..cbdd11eb976eecf590eeee067db7a527f7cdc158 100644 (file)
@@ -35,7 +35,9 @@ function item_post(&$a) {
                );
                if(! count($r)) {
                        notice( t('Unable to locate original post.') . EOL);
-                       goaway($a->get_baseurl() . "/" . $_POST['return'] );
+                       if(x($_POST,'return')) 
+                               goaway($a->get_baseurl() . "/" . $_POST['return'] );
+                       killme();
                }
                $parent_item = $r[0];
                if($parent_item['contact-id'] && $uid) {
@@ -53,7 +55,9 @@ function item_post(&$a) {
 
        if(! can_write_wall($a,$profile_uid)) {
                notice( t('Permission denied.') . EOL) ;
-               return;
+               if(x($_POST,'return')) 
+                       goaway($a->get_baseurl() . "/" . $_POST['return'] );
+               killme();
        }
 
        $user = null;
@@ -92,8 +96,9 @@ function item_post(&$a) {
 
        if(! strlen($body)) {
                notice( t('Empty post discarded.') . EOL );
-               goaway($a->get_baseurl() . "/" . $_POST['return'] );
-
+               if(x($_POST,'return')) 
+                       goaway($a->get_baseurl() . "/" . $_POST['return'] );
+               killme();
        }
 
        // get contact info for poster