]> git.mxchange.org Git - friendica.git/commitdiff
fixing stuff that broke with the last big code push
authorMike Macgirvin <mike@macgirvin.com>
Sat, 17 Jul 2010 06:14:37 +0000 (23:14 -0700)
committerMike Macgirvin <mike@macgirvin.com>
Sat, 17 Jul 2010 06:14:37 +0000 (23:14 -0700)
mod/dfrn_notify.php
mod/item.php
mod/network.php
mod/profile.php
view/comment_item.tpl
view/jot.tpl
view/style.css
view/wallwall_item.tpl

index 6ab8d584a0a1491c3a10339e4f0eea7ee6a0677d..c5c05134aefff58a8b9ec18677e2d70c1be09591 100644 (file)
@@ -32,13 +32,13 @@ function get_atom_elements($item) {
        if($rawedited)
                $res['edited'] = $rawcreated[0]['data'];
 
-       $rawowner = $item->get_item_tags('http://purl.org/macgirvin/dfrn/1.0", 'owner');
+       $rawowner = $item->get_item_tags('http://purl.org/macgirvin/dfrn/1.0', 'owner');
        if($rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['name'][0]['data'])
-               $res['owner-name'] = rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['name'][0]['data'];
+               $res['owner-name'] = $rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['name'][0]['data'];
        if($rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['uri'][0]['data'])
-               $res['owner-link'] = rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['uri'][0]['data'];
+               $res['owner-link'] = $rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['uri'][0]['data'];
        if($rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['avatar'][0]['data'])
-               $res['owner-avatar'] = rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['avatar'][0]['data'];
+               $res['owner-avatar'] = $rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['avatar'][0]['data'];
 
 
        return $res;
@@ -55,10 +55,11 @@ function post_remote($arr) {
        $arr['owner-name'] = notags(trim($arr['owner-name']));
        $arr['owner-link'] = notags(trim($arr['owner-link']));
        $arr['owner-avatar'] = notags(trim($arr['owner-avatar']));
-       if(! strlen($arr['remote-avatar']))
-               $arr['remote-avatar'] = $a->get_baseurl() . '/images/default-profile-sm.jpg';
-       if(! strlen($arr['owner-avatar']))
-               $arr['owner-avatar'] = $a->get_baseurl() . '/images/default-profile-sm.jpg';
+// must pass $a
+//     if(! strlen($arr['remote-avatar']))
+//             $arr['remote-avatar'] = $a->get_baseurl() . '/images/default-profile-sm.jpg';
+//     if(! strlen($arr['owner-avatar']))
+//             $arr['owner-avatar'] = $a->get_baseurl() . '/images/default-profile-sm.jpg';
        $arr['created'] = datetime_convert('UTC','UTC',$arr['created'],'Y-m-d H:i:s');
        $arr['edited'] = datetime_convert('UTC','UTC',$arr['edited'],'Y-m-d H:i:s');
        $arr['title'] = notags(trim($arr['title']));
index 3340183b0b02ebae5926bd95b82877cdde81efb5..437e6ac596482748eb43bf1db9f8c6c8f4a5bbaf 100644 (file)
@@ -22,7 +22,7 @@ function item_post(&$a) {
                );
                if(! count($r)) {
                        notice("Unable to locate original post." . EOL);
-                       goaway($a->get_baseurl() . "/profile/$profile_uid");
+                       goaway($a->get_baseurl() . "/" . $_POST['return'] );
                }
                $parent_item = $r[0];
        }
@@ -67,23 +67,32 @@ function item_post(&$a) {
 
        if(! strlen($body)) {
                notice("Empty post discarded." . EOL );
-               goaway($a->get_baseurl() . "/profile/$profile_uid");
+               goaway($a->get_baseurl() . "/" . $_POST['return'] );
+
        }
 
+       // get contact info for poster
        if((x($_SESSION,'visitor_id')) && (intval($_SESSION['visitor_id'])))
                $contact_id = $_SESSION['visitor_id'];
        else {
                $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
                        intval($_SESSION['uid']));
-               if(count($r)) {
-                       $contact_record = $r[0];
+               if(count($r))
                        $contact_id = $r[0]['id'];
-               }
-       }       
+       }
+
+       // get contact info for owner
+       
+       $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
+               intval($profile_uid)
+       );
+       if(count($r))
+               $contact_record = $r[0];
+
 
        $notify_type = (($parent) ? 'comment-new' : 'wall-new' );
 
-       if($_POST['type'] == 'jot') {
+       if(($_POST['type'] == 'wall') || ($_POST['type'] == 'wall-comment')) {
 
                do {
                        $dups = false;
@@ -99,7 +108,7 @@ function item_post(&$a) {
                        `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`)
                        VALUES( %d, '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
                        intval($profile_uid),
-                       "jot",
+                       dbesc($_POST['type']),
                        intval($contact_id),
                        dbesc($contact_record['name']),
                        dbesc($contact_record['url']),
@@ -154,12 +163,6 @@ function item_post(&$a) {
                        array(),$foo));
 
        }
-       goaway($a->get_baseurl() . "/profile/$profile_uid");
-
-
-
-
-
-
-
+       goaway($a->get_baseurl() . "/" . $_POST['return'] );
+       return; // NOTREACHED
 }
\ No newline at end of file
index 0dc743533d7ac552879a7484c76a2c8c0a1b15a3..7fb12bd39fdcf687e5cacb0e1834b2274e527068 100644 (file)
@@ -25,6 +25,7 @@ function network_content(&$a) {
        $tpl = file_get_contents("view/jot.tpl");
 
        $o .= replace_macros($tpl,array(
+               '$return_path' => $a->cmd,
                '$baseurl' => $a->get_baseurl(),
                '$visitor' => 'block',
                '$lockstate' => 'unlock',
@@ -38,8 +39,6 @@ function network_content(&$a) {
        // and profile to update contact table when names and  photos change.  
        // work on item_display and can_write_wall
 
-       // Add comments. 
-
 
        $sql_extra = ''; 
 
@@ -80,19 +79,38 @@ dbg(2);
        $wallwall = file_get_contents('view/wallwall_item.tpl');
 
        if(count($r)) {
-               foreach($r as $rr) {
+               foreach($r as $item) {
+
                        $comment = '';
+                       $template = $tpl;
+                       $commentww = '';
+
+                       if(($item['parent'] == $item['item_id']) && (! $item['self'])) {
+                               if($item['type'] == 'wall') {
+                                       $owner_url = $a->contact['url'];
+                                       $owner_photo = $a->contact['thumb'];
+                                       $owner_name = $a->contact['name'];
+                                       $template = $wallwall;
+                                       $commentww = 'ww';      
+                               }
+                               if($item['type'] == 'remote' && ($item['owner-link'] != $item['remote-link'])) {
+                                       $owner_url = $item['owner-link'];
+                                       $owner_photo = $item['owner-avatar'];
+                                       $owner_name = $item['owner-name'];
+                                       $template = $wallwall;
+                                       $commentww = 'ww';      
+                               }
+                       }
 
-                       if($rr['last-child']) {
+                       if($item['last-child']) {
                                $comment = replace_macros($cmnt_tpl,array(
-                                       '$id' => $rr['item_id'],
-                                       '$parent' => $rr['parent'],
-                                       '$profile_uid' =>  $_SESSION['uid']
+                                       '$id' => $item['item_id'],
+                                       '$parent' => $item['parent'],
+                                       '$profile_uid' =>  $_SESSION['uid'],
+                                       '$ww' => $commentww
                                ));
                        }
 
-                       $item = $rr;
-                       $template = $tpl;
        
                        $profile_url = $item['url'];
 
@@ -101,17 +119,11 @@ dbg(2);
 
                        $photo = $item['photo'];
                        $thumb = $item['thumb'];
-       
+
                        $profile_name = ((strlen($item['remote-name'])) ? $item['remote-name'] : $item['name']);
                        $profile_link = ((strlen($item['remote-link'])) ? $item['remote-link'] : $profile_url);
                        $profile_avatar = ((strlen($item['remote-avatar'])) ? $item['remote-avatar'] : $thumb);
 
-                       if(($item['parent'] == $item['item_id']) && (! $item['self'])) {
-                               $template = $wallwall;                  // FIXME also if remote owner
-                               $owner_url = $a->contact['url'];
-                               $owner_photo = $a->contact['thumb'];
-                               $owner_name = $a->contact['name'];
-                       }
 
                        $o .= replace_macros($template,array(
                                '$id' => $item['item_id'],
index 76ebe7d844ce2ef1d13454d1f70ebc6c3f9f6137..f3ec57329cacc037380383a84b29e2dbe70ac3e4 100644 (file)
@@ -51,7 +51,7 @@ function profile_init(&$a) {
                return;
        }
 
-       if(($remote_user) && ($a->argc > 2) && ($a->argv[2] == 'visit'))
+       if((remote_user()) && ($a->argc > 2) && ($a->argv[2] == 'visit'))
                $_SESSION['is_visitor'] = 1;
        else {
                unset($_SESSION['is_visitor']);
@@ -69,41 +69,6 @@ function profile_init(&$a) {
 
 }
 
-function item_display(&$a, $item,$template,$comment) {
-
-
-       $profile_url = $item['url'];
-
-       if(local_user() && ($item['contact-uid'] == $_SESSION['uid']) && (strlen($item['dfrn-id'])) && (! $item['self'] ))
-               $profile_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
-
-       $photo = (($item['self']) ? $a->profile['photo'] : $item['photo']);
-       $thumb = (($item['self']) ? $a->profile['thumb'] : $item['thumb']);
-       
-       $profile_name = ((strlen($item['remote-name'])) ? $item['remote-name'] : $item['name']);
-       $profile_link = ((strlen($item['remote-link'])) ? $item['remote-link'] : $profile_url);
-       $profile_avatar = ((strlen($item['remote-avatar'])) ? $item['remote-avatar'] : $thumb);
-
-//     if(! $item['owner-link']) {
-//             $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1".
-
-
-
-       $o .= replace_macros($template,array(
-               '$id' => $item['item_id'],
-               '$profile_url' => $profile_link,
-               '$name' => $profile_name,
-               '$thumb' => $profile_avatar,
-               '$body' => bbcode($item['body']),
-               '$ago' => relative_date($item['created']),
-               '$indent' => (($item['parent'] != $item['item_id']) ? 'comment-' : ''),
-               '$comment' => $comment
-       ));
-
-
-       return $o;
-}
-
 
 function profile_content(&$a) {
 
@@ -153,6 +118,7 @@ function profile_content(&$a) {
 
                $o .= replace_macros($tpl,array(
                        '$baseurl' => $a->get_baseurl(),
+                       '$return_path' => $a->cmd,
                        '$visitor' => (($_SESSION['uid'] == $a->profile['profile_uid']) ? 'block' : 'none'),
                        '$lockstate' => 'unlock',
                        '$acl' => (($_SESSION['uid'] == $a->profile['profile_uid']) ? populate_acl() : ''),
@@ -216,7 +182,7 @@ dbg(2);
                `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
                FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
                WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
-               AND `contact`.`blocked` = 0 
+               AND `item`.`type` != 'remote' AND `contact`.`blocked` = 0 
                $sql_extra
                ORDER BY `parent` DESC, `id` ASC LIMIT %d ,%d ",
                intval($a->profile['uid']),
@@ -226,23 +192,85 @@ dbg(2);
        );
 
 
-       $template = file_get_contents('view/comment_item.tpl');
-
+       $cmnt_tpl = file_get_contents('view/comment_item.tpl');
 
        $tpl = file_get_contents('view/wall_item.tpl');
+       $wallwall = file_get_contents('view/wallwall_item.tpl');
+
+
        if(count($r)) {
-               foreach($r as $rr) {
+               foreach($r as $item) {
                        $comment = '';
+                       $template = $tpl;
+                       $commentww = '';
+                       if(($item['parent'] == $item['item_id']) && (! $item['self'])) {
+                               if($item['type'] == 'wall') {
+                                       $owner_url = $a->contact['url'];
+                                       $owner_photo = $a->contact['thumb'];
+                                       $owner_name = $a->contact['name'];
+                                       $template = $wallwall;
+                                       $commentww = 'ww';      
+                               }
+                               if($item['type'] == 'remote' && ($item['owner-link'] != $item['remote-link'])) {
+                                       $owner_url = $item['owner-link'];
+                                       $owner_photo = $item['owner-avatar'];
+                                       $owner_name = $item['owner-name'];
+                                       $template = $wallwall;
+                                       $commentww = 'ww';      
+                               }
+                       }
+
+
+
                        if(can_write_wall($a,$a->profile['profile_uid'])) {
-                               if($rr['last-child']) {
-                                       $comment = replace_macros($template,array(
-                                               '$id' => $rr['item_id'],
-                                               '$parent' => $rr['parent'],
-                                               '$profile_uid' =>  $a->profile['profile_uid']
+                               if($item['last-child']) {
+                                       $comment = replace_macros($cmnt_tpl,array(
+                                               '$id' => $item['item_id'],
+                                               '$parent' => $item['parent'],
+                                               '$profile_uid' =>  $a->profile['profile_uid'],
+                                               '$ww' => $commentww
                                        ));
                                }
                        }
-                       $o .= item_display($a,$rr,$tpl,$comment);
+
+
+                       $profile_url = $item['url'];
+
+                       if(local_user() && ($item['contact-uid'] == $_SESSION['uid']) && (strlen($item['dfrn-id'])) && (! $item['self'] ))
+                               $profile_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
+
+               //      $photo = (($item['self']) ? $a->profile['photo'] : $item['photo']);
+               //      $thumb = (($item['self']) ? $a->profile['thumb'] : $item['thumb']);
+       
+                       $profile_name = ((strlen($item['remote-name'])) ? $item['remote-name'] : $item['name']);
+                       $profile_link = ((strlen($item['remote-link'])) ? $item['remote-link'] : $profile_url);
+                       $profile_avatar = ((strlen($item['remote-avatar'])) ? $item['remote-avatar'] : $item['thumb']);
+
+
+
+                       $o .= replace_macros($template,array(
+                       '$id' => $item['item_id'],
+                       '$profile_url' => $profile_link,
+                       '$name' => $profile_name,
+                       '$thumb' => $profile_avatar,
+                       '$body' => bbcode($item['body']),
+                       '$ago' => relative_date($item['created']),
+                       '$indent' => (($item['parent'] != $item['item_id']) ? 'comment-' : ''),
+                       '$owner_url' => $owner_url,
+                       '$owner_photo' => $owner_photo,
+                       '$owner_name' => $owner_name,
+                       '$comment' => $comment
+               ));
+
+
+
+
+
+
+
+
+
+
                }
        }
 
index d6dcd8e4a0df3dd04a2f7987ea07ce000417a7b6..530244e8ee8ccfcd8049461960fe67c6275c8164 100644 (file)
@@ -1,8 +1,8 @@
 
 
-<div class="comment-edit-wrapper" id="comment-edit-wrapper-$id" style="display: block;">
+<div class="comment-$wwedit-wrapper" id="comment-edit-wrapper-$id" style="display: block;">
        <form class="comment-edit-form" id="comment-edit-form-$id" action="item" method="post" >
-               <input type="hidden" name="type" value="jot" />
+               <input type="hidden" name="type" value="wall-comment" />
                <input type="hidden" name="profile_uid" value="$profile_uid" />
                <input type="hidden" name="parent" value="$parent" />
 
index f7cb49ec4938ca9823fedb390c933e3af946bb53..dca307c391d2172a58b3f7eea46e9807e1fef421 100644 (file)
@@ -4,8 +4,9 @@
 What's on your mind?
 </p>
 <form id="profile-jot-form" action="item" method="post" >
-<input type="hidden" name="type" value="jot" />
+<input type="hidden" name="type" value="wall" />
 <input type="hidden" name="profile_uid" value="$profile_uid" />
+<input type="hidden" name="return" value="$return_path" />
 
 <textarea rows="5" cols="64" class="profile-jot-text" id="profile-jot-text" name="body" ></textarea>
 
index 574e99e8378eb7af3f1e4713c50c7c4dbea4e0b1..a8f1abb139d3e1c1b1c72474c0839e90a2612dd7 100644 (file)
@@ -435,6 +435,11 @@ input#dfrn-url {
        float: left;
 }
 
+.wall-item-ago {
+       color: #888888;
+       font-size: 0.8em;
+}
+
 .wall-item-wrapper-end {
        clear: both;
 }
@@ -452,6 +457,11 @@ input#dfrn-url {
        margin-left: 100px;
 }
 
+.comment-wwedit-wrapper {
+       margin-top: 15px;
+       margin-left: 250px;
+}
+
 
 #profile-jot-submit-wrapper {
        margin-top: 15px;
index ac3a4e34faf2a54001cac91be71061968983cb1e..94d0da4fc60859c41ae9718dd471e10c026c0d56 100644 (file)
@@ -9,7 +9,7 @@
 <img src="$thumb" class="wall-item-photo" id="wall-item-photo-$id" height="80" width="80" alt="$name" /></a>
 </div>
 <div class="wall-item-wrapper" id="wall-item-wrapper-$id" >
-<a href="$profile_url" title="View $name's profile" class="wall-item-name-link"><span class="wall-item-name" id="wall-item-name-$id" >$name</span></a> to <a href="$owner_url" title="View $owner_name's profile" class="wall-item-name-link"><span class="wall-item-name" id="wall-item-ownername-$id">$owner_name</span</a> via Wall-To-Wall:<br />
+<a href="$profile_url" title="View $name's profile" class="wall-item-name-link"><span class="wall-item-name" id="wall-item-name-$id" >$name</span></a> to <a href="$owner_url" title="View $owner_name's profile" class="wall-item-name-link"><span class="wall-item-name" id="wall-item-ownername-$id">$owner_name</span></a> via Wall-To-Wall:<br />
 <span class="wall-item-body" id="wall-item-body-$id" >$body</span>
 <div class="wall-item-ago"  id="wall-item-ago-$id">$ago</div>