diff --git a/boot.php b/boot.php index 71304e53e2..cd309d8655 100644 --- a/boot.php +++ b/boot.php @@ -11,7 +11,7 @@ require_once('include/cache.php'); require_once('library/Mobile_Detect/Mobile_Detect.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); -define ( 'FRIENDICA_VERSION', '3.0.1508' ); +define ( 'FRIENDICA_VERSION', '3.0.1517' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); define ( 'DB_UPDATE_VERSION', 1156 ); @@ -1516,9 +1516,9 @@ if(! function_exists('proc_run')) { $cmdline = implode($args," "); if(get_config('system','proc_windows')) - proc_close(proc_open('cmd /c start /b ' . $cmdline,array(),$foo)); + proc_close(proc_open('cmd /c start /b ' . $cmdline,array(),$foo,dirname(__FILE__))); else - proc_close(proc_open($cmdline." &",array(),$foo)); + proc_close(proc_open($cmdline." &",array(),$foo,dirname(__FILE__))); } } @@ -1806,3 +1806,10 @@ function curPageURL() { return $pageURL; } +function random_digits($digits) { + $rn = ''; + for($i = 0; $i < $digits; $i++) { + $rn .= rand(0,9); + } + return $rn; +} diff --git a/doc/Home.md b/doc/Home.md index 30efc93f7d..1df74b5f26 100644 --- a/doc/Home.md +++ b/doc/Home.md @@ -6,6 +6,8 @@ Friendica Documentation and Resources * [Account Basics](help/Account-Basics) * [New User Quick Start](help/guide) +* [Creating posts](help/Text_editor) +* [Comment, sort and delete posts](help/Text_comment) * [Profiles](help/Profiles) * [Connectors](help/Connectors) * [Making Friends](help/Making-Friends) diff --git a/doc/Text_comment.md b/doc/Text_comment.md new file mode 100644 index 0000000000..2aac568378 --- /dev/null +++ b/doc/Text_comment.md @@ -0,0 +1,44 @@ +Comment, sort and delete posts +============== + +* [Home](help) + +Here you can find an overview of the different ways to comment and sort existing posts. Attention: we've used the "diabook" theme. If you're using another theme, some of the icons may be different. + + + +The different icons + + This symbol is used to indicate that you like the post. Click it twice to undo your choice.
+ + This symbol is used to indicate that you dislike the post. Click it twice to undo your choice. + + + This symbol is used to share a post. A copy of this post will automatically appear in your status editor and add a link to the original post. + + + This symbol is used to mark a post. Marked posts will appear on your network page at the "starred" tab (from "star"). Click it twice to undo your choice. + + + This symbol is used to tag a post with a self-chosen keyword. When you click at the word, you'll get a list of all posts with this tag. Attention: you can't delete the tag once you've set one. + + + This symbol is used to categorize posts. Choose an existing folder or create a new one. You'll find the created folder on your network page under the "saved folders" tab. + + + This symbol is used to delete your own post or to remove a post of another person from your stream. + + + This symbol is used to choose more than one post to delete in a single step. After selecting all posts, go to the end of the page and click "Delete Selected Items". + +**Symbols of other themes** + +Darkbubble + +Darkzero + +(incl. more "zero"-themes, slackr, comix, easterbunny, facepark) + +Dispy (incl. smoothly, testbubble) + +Frost Mobile diff --git a/doc/Text_editor.md b/doc/Text_editor.md new file mode 100644 index 0000000000..fa4393f009 --- /dev/null +++ b/doc/Text_editor.md @@ -0,0 +1,40 @@ +Creating posts +================= + +* [Home](help) + +Here you can find an overview of the different ways to create and edit your post. Attention: we've used the "diabook" theme. If you're using another theme, some of the icons may be different. + + + +The different iconss + + This symbol is used to upload a picture from your computer. If you only want to add an adress (url), you can also use the "tree" icon at the upper part of the editor. After selecting an image, you'll see a thumbnail in the editor. + + + This symbol is used to add files from your computer. There'll be no preview of the content. + + + This symbol is used to add a web address (url). You'll see a short preview of the website. + + + This symbol is used to add a web address (url) of a video file. You'll see a small preview of the video. + + + This symbol is used to add a web address (url) of an audio file. You'll see a player in your completed post. + + + This symbol is used to add your geographic location. This location will be added into a Google Maps search. That's why a note like "New York" or "10004" is already enough. + + +**Symbols of other themes** + +Cleanzero + +(incl. more "zero"-themes, comix, easterbunny, facepark, slackr + +Darkbubble (inkl. smoothly, testbubble) + +Frost + +Vier (inkl. dispy) diff --git a/doc/de/README.md b/doc/de/README.md index a42b2dde07..5dc32ee76e 100644 --- a/doc/de/README.md +++ b/doc/de/README.md @@ -5,4 +5,4 @@ Friendica - doc - german Hier findest du die deutsche Version der Friendica-Hilfedateien. Es handelt sich um eine selbst erstellte, öffentlich freigegebene Arbeit mit dem Ziel, Friendica durch deutsche Hilfedateien für weitere Personen zugänglich zu machen, die dem Englischen nicht ausreichend mächtig sind. -Die Daten basieren auf dem offiziellen Friendica-Github https://github.com/friendica/friendica (Stand 12.10.2012). +Die Daten basieren auf dem offiziellen Friendica-Github https://github.com/friendica/friendica (Stand: 03.11.12) diff --git a/doc/de/img/camera.png b/doc/img/camera.png similarity index 100% rename from doc/de/img/camera.png rename to doc/img/camera.png diff --git a/doc/de/img/chain.png b/doc/img/chain.png similarity index 100% rename from doc/de/img/chain.png rename to doc/img/chain.png diff --git a/doc/de/img/darkbubble.png b/doc/img/darkbubble.png similarity index 100% rename from doc/de/img/darkbubble.png rename to doc/img/darkbubble.png diff --git a/doc/de/img/darkzero.png b/doc/img/darkzero.png similarity index 100% rename from doc/de/img/darkzero.png rename to doc/img/darkzero.png diff --git a/doc/de/img/diabook.png b/doc/img/diabook.png similarity index 100% rename from doc/de/img/diabook.png rename to doc/img/diabook.png diff --git a/doc/de/img/dispy.png b/doc/img/dispy.png similarity index 100% rename from doc/de/img/dispy.png rename to doc/img/dispy.png diff --git a/doc/de/img/editor_darkbubble.png b/doc/img/editor_darkbubble.png similarity index 100% rename from doc/de/img/editor_darkbubble.png rename to doc/img/editor_darkbubble.png diff --git a/doc/de/img/editor_frost.png b/doc/img/editor_frost.png similarity index 100% rename from doc/de/img/editor_frost.png rename to doc/img/editor_frost.png diff --git a/doc/de/img/editor_vier.png b/doc/img/editor_vier.png similarity index 100% rename from doc/de/img/editor_vier.png rename to doc/img/editor_vier.png diff --git a/doc/de/img/editor_zero.png b/doc/img/editor_zero.png similarity index 100% rename from doc/de/img/editor_zero.png rename to doc/img/editor_zero.png diff --git a/doc/de/img/friendica_editor.png b/doc/img/friendica_editor.png similarity index 100% rename from doc/de/img/friendica_editor.png rename to doc/img/friendica_editor.png diff --git a/doc/de/img/frost.png b/doc/img/frost.png similarity index 100% rename from doc/de/img/frost.png rename to doc/img/frost.png diff --git a/doc/de/img/globe.png b/doc/img/globe.png similarity index 100% rename from doc/de/img/globe.png rename to doc/img/globe.png diff --git a/doc/de/img/mic.png b/doc/img/mic.png similarity index 100% rename from doc/de/img/mic.png rename to doc/img/mic.png diff --git a/doc/de/img/padlock.png b/doc/img/padlock.png similarity index 100% rename from doc/de/img/padlock.png rename to doc/img/padlock.png diff --git a/doc/de/img/paper_clip.png b/doc/img/paper_clip.png similarity index 100% rename from doc/de/img/paper_clip.png rename to doc/img/paper_clip.png diff --git a/doc/de/img/post_categorize.png b/doc/img/post_categorize.png similarity index 100% rename from doc/de/img/post_categorize.png rename to doc/img/post_categorize.png diff --git a/doc/de/img/post_choose.png b/doc/img/post_choose.png similarity index 100% rename from doc/de/img/post_choose.png rename to doc/img/post_choose.png diff --git a/doc/de/img/post_delete.png b/doc/img/post_delete.png similarity index 100% rename from doc/de/img/post_delete.png rename to doc/img/post_delete.png diff --git a/doc/de/img/post_link.png b/doc/img/post_link.png similarity index 100% rename from doc/de/img/post_link.png rename to doc/img/post_link.png diff --git a/doc/de/img/post_mark.png b/doc/img/post_mark.png similarity index 100% rename from doc/de/img/post_mark.png rename to doc/img/post_mark.png diff --git a/doc/de/img/post_share.png b/doc/img/post_share.png similarity index 100% rename from doc/de/img/post_share.png rename to doc/img/post_share.png diff --git a/doc/de/img/post_tag.png b/doc/img/post_tag.png similarity index 100% rename from doc/de/img/post_tag.png rename to doc/img/post_tag.png diff --git a/doc/de/img/post_thumbs_down.png b/doc/img/post_thumbs_down.png similarity index 100% rename from doc/de/img/post_thumbs_down.png rename to doc/img/post_thumbs_down.png diff --git a/doc/de/img/post_thumbs_up.png b/doc/img/post_thumbs_up.png similarity index 100% rename from doc/de/img/post_thumbs_up.png rename to doc/img/post_thumbs_up.png diff --git a/doc/de/img/posts_define.png b/doc/img/posts_define.png similarity index 100% rename from doc/de/img/posts_define.png rename to doc/img/posts_define.png diff --git a/doc/de/img/video.png b/doc/img/video.png similarity index 100% rename from doc/de/img/video.png rename to doc/img/video.png diff --git a/include/Contact.php b/include/Contact.php index ecc271a8e0..d39d7a28b6 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -22,7 +22,8 @@ function user_remove($uid) { $r[0]['nickname'] ); - q("DELETE FROM `contact` WHERE `uid` = %d", intval($uid)); + // don't delete yet, will be done later when contacts have deleted my stuff + // q("DELETE FROM `contact` WHERE `uid` = %d", intval($uid)); q("DELETE FROM `gcign` WHERE `uid` = %d", intval($uid)); q("DELETE FROM `group` WHERE `uid` = %d", intval($uid)); q("DELETE FROM `group_member` WHERE `uid` = %d", intval($uid)); @@ -41,7 +42,10 @@ function user_remove($uid) { q("DELETE FROM `pconfig` WHERE `uid` = %d", intval($uid)); q("DELETE FROM `search` WHERE `uid` = %d", intval($uid)); q("DELETE FROM `spam` WHERE `uid` = %d", intval($uid)); - q("DELETE FROM `user` WHERE `uid` = %d", intval($uid)); + // don't delete yet, will be done later when contacts have deleted my stuff + // q("DELETE FROM `user` WHERE `uid` = %d", intval($uid)); + q("UPDATE `user` SET `account_removed` = 1, `account_expires_on` = UTC_TIMESTAMP() WHERE `uid` = %d", intval($uid)); + proc_run('php', "include/notifier.php", "removeme", $uid); if($uid == local_user()) { unset($_SESSION['authenticated']); unset($_SESSION['uid']); @@ -165,6 +169,7 @@ function mark_for_death($contact) { q("update contact set `archive` = 1 where id = %d limit 1", intval($contact['id']) ); + q("UPDATE `item` SET `private` = 2 WHERE `contact-id` = %d AND `uid` = %d", intval($contact['id']), intval($contact['uid'])); //contact_remove($contact['id']); diff --git a/include/api.php b/include/api.php index 456d984de1..7517abb70c 100644 --- a/include/api.php +++ b/include/api.php @@ -74,7 +74,7 @@ // process normal login request $r = q("SELECT * FROM `user` WHERE ( `email` = '%s' OR `nickname` = '%s' ) - AND `password` = '%s' AND `blocked` = 0 AND `account_expired` = 0 AND `verified` = 1 LIMIT 1", + AND `password` = '%s' AND `blocked` = 0 AND `account_expired` = 0 AND `account_removed` = 0 AND `verified` = 1 LIMIT 1", dbesc(trim($user)), dbesc(trim($user)), dbesc($encrypted) diff --git a/include/auth.php b/include/auth.php index c4f1f08651..523de88ce9 100644 --- a/include/auth.php +++ b/include/auth.php @@ -59,7 +59,7 @@ if((isset($_SESSION)) && (x($_SESSION,'authenticated')) && ((! (x($_POST,'auth-p } $r = q("SELECT `user`.*, `user`.`pubkey` as `upubkey`, `user`.`prvkey` as `uprvkey` - FROM `user` WHERE `uid` = %d AND `blocked` = 0 AND `account_expired` = 0 AND `verified` = 1 LIMIT 1", + FROM `user` WHERE `uid` = %d AND `blocked` = 0 AND `account_expired` = 0 AND `account_removed` = 0 AND `verified` = 1 LIMIT 1", intval($_SESSION['uid']) ); @@ -147,7 +147,7 @@ else { $r = q("SELECT `user`.*, `user`.`pubkey` as `upubkey`, `user`.`prvkey` as `uprvkey` FROM `user` WHERE ( `email` = '%s' OR `nickname` = '%s' ) - AND `password` = '%s' AND `blocked` = 0 AND `account_expired` = 0 AND `verified` = 1 LIMIT 1", + AND `password` = '%s' AND `blocked` = 0 AND `account_expired` = 0 AND `account_removed` = 0 AND `verified` = 1 LIMIT 1", dbesc(trim($_POST['username'])), dbesc(trim($_POST['username'])), dbesc($encrypted) diff --git a/include/conversation.php b/include/conversation.php index 6b7c3afb03..43d20a4014 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -413,6 +413,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { if(!$update) { $tab = notags(trim($_GET['tab'])); + $tab = ( $tab ? $tab : 'posts' ); if($tab === 'posts') { // This is ugly, but we can't pass the profile_uid through the session to the ajax updater, // because browser prefetching might change it on us. We have to deliver it with the page. @@ -435,7 +436,11 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { else if($mode === 'display') { $profile_owner = $a->profile['uid']; $page_writeable = can_write_wall($a,$profile_owner); - $live_update_div = '' . "\r\n"; + if(!$update) { + $live_update_div = '' . "\r\n" + . ""; + } } else if($mode === 'community') { $profile_owner = 0; @@ -895,7 +900,8 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) { '$audurl' => t("Please enter an audio link/URL:"), '$term' => t('Tag term:'), '$fileas' => t('Save to Folder:'), - '$whereareu' => t('Where are you right now?') + '$whereareu' => t('Where are you right now?'), + '$delitems' => t('Delete item(s)?') )); @@ -992,7 +998,8 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) { '$profile_uid' => $x['profile_uid'], '$preview' => t('Preview'), '$sourceapp' => t($a->sourcename), - '$cancel' => t('Cancel') + '$cancel' => t('Cancel'), + '$rand_num' => random_digits(12) )); @@ -1007,9 +1014,10 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) { function get_item_children($arr, $parent) { $children = array(); + $a = get_app(); foreach($arr as $item) { if($item['id'] != $item['parent']) { - if(get_config('system','thread_allow')) { + if(get_config('system','thread_allow') && $a->theme_thread_allow) { // Fallback to parent-uri if thr-parent is not set $thr_parent = $item['thr-parent']; if($thr_parent == '') diff --git a/include/delivery.php b/include/delivery.php index d879deedb5..4280359735 100644 --- a/include/delivery.php +++ b/include/delivery.php @@ -323,7 +323,7 @@ function delivery_run(&$argv, &$argc){ WHERE `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`network` = '%s' AND `user`.`nickname` = '%s' $sql_extra - AND `user`.`account_expired` = 0 LIMIT 1", + AND `user`.`account_expired` = 0 AND `user`.`account_removed` = 0 LIMIT 1", dbesc(NETWORK_DFRN), dbesc($nickname) ); diff --git a/include/diaspora.php b/include/diaspora.php index c5b724509c..f645aeb39b 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -16,7 +16,7 @@ function diaspora_dispatch_public($msg) { return; } - $r = q("SELECT `user`.* FROM `user` WHERE `user`.`uid` IN ( SELECT `contact`.`uid` FROM `contact` WHERE `contact`.`network` = '%s' AND `contact`.`addr` = '%s' ) AND `account_expired` = 0 ", + $r = q("SELECT `user`.* FROM `user` WHERE `user`.`uid` IN ( SELECT `contact`.`uid` FROM `contact` WHERE `contact`.`network` = '%s' AND `contact`.`addr` = '%s' ) AND `account_expired` = 0 AND `account_removed` = 0 ", dbesc(NETWORK_DIASPORA), dbesc($msg['author']) ); diff --git a/include/items.php b/include/items.php index 4266734842..5ad89d8c18 100755 --- a/include/items.php +++ b/include/items.php @@ -3958,10 +3958,10 @@ function drop_item($id,$interactive = true) { // send the notification upstream/downstream as the case may be + proc_run('php',"include/notifier.php","drop","$drop_id"); + if(! $interactive) return $owner; - - proc_run('php',"include/notifier.php","drop","$drop_id"); goaway($a->get_baseurl() . '/' . $_SESSION['return_url']); //NOTREACHED } diff --git a/include/notifier.php b/include/notifier.php index c78d2f1a76..c58a8a854f 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -134,13 +134,26 @@ function notifier_run(&$argv, &$argc){ $recipients[] = $suggest[0]['cid']; $item = $suggest[0]; } + elseif($cmd === 'removeme') { + $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval($item_id)); + $user = $r[0]; + $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1", intval($item_id)); + $self = $r[0]; + $r = q("SELECT * FROM `contact` WHERE `self` = 0 AND `uid` = %d", intval($item_id)); + if(! count($r)) + return; + require_once('include/Contact.php'); + foreach($r as $contact) { + terminate_friendship($user, $self, $contact); + } + return; + } elseif($cmd === 'relocate') { $normal_mode = false; $relocate = true; $uid = $item_id; } else { - // find ancestors $r = q("SELECT * FROM `item` WHERE `id` = %d and visible = 1 and moderated = 0 LIMIT 1", intval($item_id) @@ -622,7 +635,7 @@ function notifier_run(&$argv, &$argc){ AND `contact`.`pending` = 0 AND `contact`.`network` = '%s' AND `user`.`nickname` = '%s' $sql_extra - AND `user`.`account_expired` = 0 LIMIT 1", + AND `user`.`account_expired` = 0 AND `user`.`account_removed` = 0 LIMIT 1", dbesc(NETWORK_DFRN), dbesc($nickname) ); diff --git a/include/oauth.php b/include/oauth.php index 103d4c2fa9..28ac4428f0 100644 --- a/include/oauth.php +++ b/include/oauth.php @@ -133,7 +133,7 @@ class FKOAuth1 extends OAuthServer { function loginUser($uid){ logger("FKOAuth1::loginUser $uid"); $a = get_app(); - $r = q("SELECT * FROM `user` WHERE uid=%d AND `blocked` = 0 AND `account_expired` = 0 AND `verified` = 1 LIMIT 1", + $r = q("SELECT * FROM `user` WHERE uid=%d AND `blocked` = 0 AND `account_expired` = 0 AND `account_removed` = 0 AND `verified` = 1 LIMIT 1", intval($uid) ); if(count($r)){ diff --git a/include/onepoll.php b/include/onepoll.php index b7199deb61..019455e820 100644 --- a/include/onepoll.php +++ b/include/onepoll.php @@ -292,7 +292,12 @@ function onepoll_run(&$argv, &$argc){ logger("Mail: Parsing ".count($msgs)." mails for ".$mailconf[0]['user'], LOGGER_DEBUG); $metas = email_msg_meta($mbox,implode(',',$msgs)); + if(count($metas) != count($msgs)) { + logger("onepoll: for " . $mailconf[0]['user'] . " there are ". count($msgs) . " messages but received " . count($metas) . " metas", LOGGER_DEBUG); + break; + } $msgs = array_combine($msgs, $metas); + foreach($msgs as $msg_uid => $meta) { logger("Mail: Parsing mail ".$msg_uid, LOGGER_DATA); @@ -309,7 +314,7 @@ function onepoll_run(&$argv, &$argc){ ); if(count($r)) { - logger("Mail: Seen before ".$msg_uid." for ".$mailconf[0]['user']); + logger("Mail: Seen before ".$msg_uid." for ".$mailconf[0]['user'],LOGGER_DEBUG); if($meta->deleted && ! $r[0]['deleted']) { q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `id` = %d LIMIT 1", dbesc(datetime_convert()), diff --git a/include/poller.php b/include/poller.php index 235603979d..d5efa36a83 100644 --- a/include/poller.php +++ b/include/poller.php @@ -67,6 +67,16 @@ function poller_run(&$argv, &$argc){ q("UPDATE user SET `account_expired` = 1 where `account_expired` = 0 AND `account_expires_on` != '0000-00-00 00:00:00' AND `account_expires_on` < UTC_TIMESTAMP() "); + + // delete user and contact records for recently removed accounts + + $r = q("SELECT * FROM `user` WHERE `account_removed` = 1 AND `account_expires_on` < UTC_TIMESTAMP() - INTERVAL 3 DAY"); + if ($r) { + foreach($r as $user) { + q("DELETE FROM `contact` WHERE `uid` = %d", intval($user['uid'])); + q("DELETE FROM `user` WHERE `uid` = %d", intval($user['uid'])); + } + } $abandon_days = intval(get_config('system','account_abandon_days')); if($abandon_days < 1) @@ -154,7 +164,7 @@ function poller_run(&$argv, &$argc){ $sql_extra AND `self` = 0 AND `contact`.`blocked` = 0 AND `contact`.`readonly` = 0 AND `contact`.`archive` = 0 - AND `user`.`account_expired` = 0 $abandon_sql ORDER BY RAND()", + AND `user`.`account_expired` = 0 AND `user`.`account_removed` = 0 $abandon_sql ORDER BY RAND()", intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND), dbesc(NETWORK_DIASPORA), diff --git a/include/redir.php b/include/redir.php index 42008ddd6b..3fbbf4c130 100644 --- a/include/redir.php +++ b/include/redir.php @@ -7,20 +7,37 @@ function auto_redir(&$a, $contact_nick) { if(local_user()) { - $r = q("SELECT id FROM contact WHERE uid = ( SELECT uid FROM user WHERE nickname = '%s' LIMIT 1 ) AND nick = '%s' AND network = '%s' and self = 0 LIMIT 1", + // We need to find out if $contact_nick is a user on this hub, and if so, if I + // am a contact of that user. However, that user may have other contacts with the + // same nickname as me on other hubs or other networks. Exclude these by requiring + // that the contact have a local URL. I will be the only person with my nickname at + // this URL, so if a result is found, then I am a contact of the $contact_nick user. + // + // We also have to make sure that I'm a legitimate contact--I'm not blocked or pending. + + $baseurl = $a->get_baseurl(); + $domain_st = strpos($baseurl, "://"); + if($domain_st === false) + return; + $baseurl = substr($baseurl, $domain_st + 3); + + $r = q("SELECT id FROM contact WHERE uid = ( SELECT uid FROM user WHERE nickname = '%s' LIMIT 1 ) + AND nick = '%s' AND self = 0 AND url LIKE '%%%s%%' AND blocked = 0 AND pending = 0 LIMIT 1", dbesc($contact_nick), dbesc($a->user['nickname']), - dbesc(NETWORK_DFRN) + dbesc($baseurl) ); if((!$r) || (! count($r)) || $r[0]['id'] == remote_user()) return; - $r = q("SELECT * FROM contact WHERE nick = '%s' AND network = '%s' AND uid = %d LIMIT 1", + $r = q("SELECT * FROM contact WHERE nick = '%s' + AND network = '%s' AND uid = %d AND url LIKE '%%%s%%' LIMIT 1", dbesc($contact_nick), dbesc(NETWORK_DFRN), - intval(local_user()) + intval(local_user()), + dbesc($baseurl) ); if(! ($r && count($r))) @@ -52,7 +69,7 @@ function auto_redir(&$a, $contact_nick) { $url = curPageURL(); - logger('check_redir: ' . $r[0]['name'] . ' ' . $sec, LOGGER_DEBUG); + logger('auto_redir: ' . $r[0]['name'] . ' ' . $sec, LOGGER_DEBUG); $dest = (($url) ? '&destination_url=' . $url : ''); goaway ($r[0]['poll'] . '?dfrn_id=' . $dfrn_id . '&dfrn_version=' . DFRN_PROTOCOL_VERSION . '&type=profile&sec=' . $sec . $dest ); diff --git a/js/main.js b/js/main.js index bd6dfc8520..4a75be747a 100644 --- a/js/main.js +++ b/js/main.js @@ -250,12 +250,13 @@ if($('#live-profile').length) { src = 'profile'; liveUpdate(); } if($('#live-community').length) { src = 'community'; liveUpdate(); } if($('#live-notes').length) { src = 'notes'; liveUpdate(); } - if($('#live-display').length) { + if($('#live-display').length) { src = 'display'; liveUpdate(); } +/* if($('#live-display').length) { if(liking) { liking = 0; window.location.href=window.location.href } - } + }*/ if($('#live-photos').length) { if(liking) { liking = 0; @@ -313,10 +314,26 @@ $('#' + prev).after($(this)); } else { + // Find out if the hidden comments are open, so we can keep it that way + // if a new comment has been posted + var id = $('.hide-comments-total', this).attr('id'); + if(typeof id != 'undefined') { + id = id.split('-')[3]; + var commentsOpen = $("#collapsed-comments-" + id).is(":visible"); + } + $('img',this).each(function() { $(this).attr('src',$(this).attr('dst')); }); + //vScroll = $(document).scrollTop(); + $('html').height($('html').height()); $('#' + ident).replaceWith($(this)); + + if(typeof id != 'undefined') { + if(commentsOpen) showHideComments(id); + } + $('html').height('auto'); + //$(document).scrollTop(vScroll); } prev = ident; }); @@ -503,6 +520,19 @@ + function showHideComments(id) { + if( $("#collapsed-comments-" + id).is(":visible")) { + $("#collapsed-comments-" + id).hide(); + $("#hide-comments-" + id).html(window.showMore); + } + else { + $("#collapsed-comments-" + id).show(); + $("#hide-comments-" + id).html(window.showFewer); + } + } + + + function preview_post() { $("#jot-preview").val("1"); $("#jot-preview-content").show(); diff --git a/js/main.min.js b/js/main.min.js index f94d4dc98e..a581e4b85c 100644 --- a/js/main.min.js +++ b/js/main.min.js @@ -1 +1 @@ -function openClose(e){document.getElementById(e).style.display=="block"?document.getElementById(e).style.display="none":document.getElementById(e).style.display="block"}function openMenu(e){document.getElementById(e).style.display="block"}function closeMenu(e){document.getElementById(e).style.display="none"}function NavUpdate(){if(!stopped){var e="ping"+(localUser!=0?"?f=&uid="+localUser:"");$.get(e,function(e){$(e).find("result").each(function(){$("nav").trigger("nav-update",this),$("#live-network").length&&(src="network",liveUpdate()),$("#live-profile").length&&(src="profile",liveUpdate()),$("#live-community").length&&(src="community",liveUpdate()),$("#live-notes").length&&(src="notes",liveUpdate()),$("#live-display").length&&liking&&(liking=0,window.location.href=window.location.href),$("#live-photos").length&&liking&&(liking=0,window.location.href=window.location.href)})})}timer=setTimeout(NavUpdate,updateInterval)}function liveUpdate(){if(src==null||stopped||!profile_uid){$(".like-rotator").hide();return}if($(".comment-edit-text-full").length||in_progress){livetime&&clearTimeout(livetime),livetime=setTimeout(liveUpdate,1e4);return}livetime!=null&&(livetime=null),prev="live-"+src,in_progress=!0;var e=netargs.length?"/"+netargs:"",t="update_"+src+e+"&p="+profile_uid+"&page="+profile_page+"&msie="+(msie?1:0);$.get(t,function(e){in_progress=!1,$(".toplevel_item",e).each(function(){var e=$(this).attr("id");$("#"+e).length==0&&profile_page==1?($("img",this).each(function(){$(this).attr("src",$(this).attr("dst"))}),$("#"+prev).after($(this))):($("img",this).each(function(){$(this).attr("src",$(this).attr("dst"))}),$("#"+e).replaceWith($(this))),prev=e}),$(".like-rotator").hide(),commentBusy&&(commentBusy=!1,$("body").css("cursor","auto")),$(".comment-edit-form textarea").contact_autocomplete(baseurl+"/acl")})}function imgbright(e){$(e).removeClass("drophide").addClass("drop")}function imgdull(e){$(e).removeClass("drop").addClass("drophide")}function dolike(e,t){unpause(),$("#like-rotator-"+e.toString()).show(),$.get("like/"+e.toString()+"?verb="+t,NavUpdate),liking=1}function dostar(e){e=e.toString(),$("#like-rotator-"+e).show(),$.get("starred/"+e,function(t){t.match(/1/)?($("#starred-"+e).addClass("starred"),$("#starred-"+e).removeClass("unstarred"),$("#star-"+e).addClass("hidden"),$("#unstar-"+e).removeClass("hidden")):($("#starred-"+e).addClass("unstarred"),$("#starred-"+e).removeClass("starred"),$("#star-"+e).removeClass("hidden"),$("#unstar-"+e).addClass("hidden")),$("#like-rotator-"+e).hide()})}function getPosition(e){var t={x:0,y:0};if(e.pageX||e.pageY)t.x=e.pageX,t.y=e.pageY;else if(e.clientX||e.clientY)t.x=e.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)-document.documentElement.clientLeft,t.y=e.clientY+(document.documentElement.scrollTop||document.body.scrollTop)-document.documentElement.clientTop;else if(e.x||e.y)t.x=e.x,t.y=e.y;return t}function lockview(e,t){e=e||window.event,cursor=getPosition(e),lockvisible?lockviewhide():(lockvisible=!0,$.get("lockview/"+t,function(e){$("#panel").html(e),$("#panel").css({left:cursor.x+5,top:cursor.y+5}),$("#panel").show()}))}function lockviewhide(){lockvisible=!1,$("#panel").hide()}function post_comment(e){return unpause(),commentBusy=!0,$("body").css("cursor","wait"),$("#comment-preview-inp-"+e).val("0"),$.post("item",$("#comment-edit-form-"+e).serialize(),function(t){if(t.success){$("#comment-edit-wrapper-"+e).hide(),$("#comment-edit-text-"+e).val("");var n=document.getElementById("comment-edit-text-"+e);n&&commentClose(n,e),timer&&clearTimeout(timer),timer=setTimeout(NavUpdate,10)}t.reload&&(window.location.href=t.reload)},"json"),!1}function preview_comment(e){return $("#comment-preview-inp-"+e).val("1"),$("#comment-edit-preview-"+e).show(),$.post("item",$("#comment-edit-form-"+e).serialize(),function(t){t.preview&&($("#comment-edit-preview-"+e).html(t.preview),$("#comment-edit-preview-"+e+" a").click(function(){return!1}))},"json"),!0}function preview_post(){return $("#jot-preview").val("1"),$("#jot-preview-content").show(),tinyMCE.triggerSave(),$.post("item",$("#profile-jot-form").serialize(),function(e){e.preview&&($("#jot-preview-content").html(e.preview),$("#jot-preview-content a").click(function(){return!1}))},"json"),$("#jot-preview").val("0"),!0}function unpause(){totStopped=!1,stopped=!1,$("#pause").html("")}function bin2hex(e){var t,n,r=0,i=[];e+="",r=e.length;for(n=0;n