diff options
author | Mike Macgirvin <mike@macgirvin.com> | 2010-07-16 23:14:37 -0700 |
---|---|---|
committer | Mike Macgirvin <mike@macgirvin.com> | 2010-07-16 23:14:37 -0700 |
commit | f937de932d87737d14278003f80b5bc5025acdc6 (patch) | |
tree | 340429a6f2b52c6729ebe7e3cd30771042db9aba /mod | |
parent | 5e4df4b3f7782f8a82664d24b86d46a14b3d178b (diff) | |
download | volse-hubzilla-f937de932d87737d14278003f80b5bc5025acdc6.tar.gz volse-hubzilla-f937de932d87737d14278003f80b5bc5025acdc6.tar.bz2 volse-hubzilla-f937de932d87737d14278003f80b5bc5025acdc6.zip |
fixing stuff that broke with the last big code push
Diffstat (limited to 'mod')
-rw-r--r-- | mod/dfrn_notify.php | 17 | ||||
-rw-r--r-- | mod/item.php | 35 | ||||
-rw-r--r-- | mod/network.php | 44 | ||||
-rw-r--r-- | mod/profile.php | 120 |
4 files changed, 130 insertions, 86 deletions
diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index 6ab8d584a..c5c05134a 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -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'])); diff --git a/mod/item.php b/mod/item.php index 3340183b0..437e6ac59 100644 --- a/mod/item.php +++ b/mod/item.php @@ -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 diff --git a/mod/network.php b/mod/network.php index 0dc743533..7fb12bd39 100644 --- a/mod/network.php +++ b/mod/network.php @@ -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'], diff --git a/mod/profile.php b/mod/profile.php index 76ebe7d84..f3ec57329 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -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 + )); + + + + + + + + + + } } |