From c583d1620955b8d170b8cbf7a106cefeecad56c8 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 3 Jan 2012 14:27:00 -0800 Subject: fix reference variable effects on sorting --- boot.php | 2 +- include/conversation.php | 10 +++++++--- include/items.php | 2 +- view/atom_feed.tpl | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/boot.php b/boot.php index fe8491332..619a3fead 100644 --- a/boot.php +++ b/boot.php @@ -9,7 +9,7 @@ require_once('include/nav.php'); require_once('include/cache.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); -define ( 'FRIENDICA_VERSION', '2.3.1214' ); +define ( 'FRIENDICA_VERSION', '2.3.1215' ); define ( 'DFRN_PROTOCOL_VERSION', '2.22' ); define ( 'DB_UPDATE_VERSION', 1114 ); diff --git a/include/conversation.php b/include/conversation.php index f4432bfd9..1b1d09d6b 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -911,9 +911,13 @@ function conv_sort($arr,$order) { $parents[$p]['children'][] = $x; } } - foreach($parents as $x) - if(count($x['children'])) - usort($x['children'],'sort_thr_created_rev'); + foreach($parents as $k => $v) { + if(count($parents[$k]['children'])) { + $y = $parents[$k]['children']; + usort($y,'sort_thr_created_rev'); + $parents[$k]['children'] = $y; + } + } $ret = array(); foreach($parents as $x) { diff --git a/include/items.php b/include/items.php index 9becb9ffb..7f003ab57 100644 --- a/include/items.php +++ b/include/items.php @@ -945,7 +945,7 @@ function tgroup_deliver($uid,$item_id) { $link = normalise_link($a->get_baseurl() . '/profile/' . $u[0]['nickname']); - $cnt = preg_match_all('/\@\[url\=(.*?)\](.*?)\[\/url\]/ism',$item['body'],$matches,PREG_SET_ORDER); + $cnt = preg_match_all('/[\@\!]\[url\=(.*?)\](.*?)\[\/url\]/ism',$item['body'],$matches,PREG_SET_ORDER); if($cnt) { foreach($matches as $mtch) { if(link_compare($link,$mtch[1])) { diff --git a/view/atom_feed.tpl b/view/atom_feed.tpl index c7cc08297..72cf8e4fd 100644 --- a/view/atom_feed.tpl +++ b/view/atom_feed.tpl @@ -12,7 +12,7 @@ $feed_id $feed_title - Friendika + Friendica $hub $salmon -- cgit v1.2.3 From 969cd145ce0e717399dbfff6cbc1a45342206e1a Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 3 Jan 2012 17:29:07 -0800 Subject: suggestion notifications --- boot.php | 3 +++ include/conversation.php | 35 +++++++++++++++++++++-------------- include/enotify.php | 13 +++++++++++++ include/items.php | 13 ++++++++++++- mod/settings.php | 6 +++++- view/settings.tpl | 1 + 6 files changed, 55 insertions(+), 16 deletions(-) diff --git a/boot.php b/boot.php index 619a3fead..df9daf483 100644 --- a/boot.php +++ b/boot.php @@ -127,6 +127,9 @@ define ( 'NOTIFY_CONFIRM', 0x0002 ); define ( 'NOTIFY_WALL', 0x0004 ); define ( 'NOTIFY_COMMENT', 0x0008 ); define ( 'NOTIFY_MAIL', 0x0010 ); +define ( 'NOTIFY_SUGGEST', 0x0020 ); +define ( 'NOTIFY_PROFILE', 0x0040 ); + /** * various namespaces we may need to parse diff --git a/include/conversation.php b/include/conversation.php index 1b1d09d6b..a30a78271 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -902,29 +902,35 @@ function conv_sort($arr,$order) { elseif(stristr($order,'commented')) usort($parents,'sort_thr_commented'); - foreach($parents as $x) - $x['children'] = array(); + if(count($parents)) + foreach($parents as $x) + $x['children'] = array(); foreach($arr as $x) { if($x['id'] != $x['parent']) { $p = find_thread_parent_index($parents,$x); - $parents[$p]['children'][] = $x; + if($p !== false) + $parents[$p]['children'][] = $x; } } - foreach($parents as $k => $v) { - if(count($parents[$k]['children'])) { - $y = $parents[$k]['children']; - usort($y,'sort_thr_created_rev'); - $parents[$k]['children'] = $y; - } + if(count($parents)) { + foreach($parents as $k => $v) { + if(count($parents[$k]['children'])) { + $y = $parents[$k]['children']; + usort($y,'sort_thr_created_rev'); + $parents[$k]['children'] = $y; + } + } } $ret = array(); - foreach($parents as $x) { - $ret[] = $x; - if(count($x['children'])) - foreach($x['children'] as $y) - $ret[] = $y; + if(count($parents)) { + foreach($parents as $x) { + $ret[] = $x; + if(count($x['children'])) + foreach($x['children'] as $y) + $ret[] = $y; + } } return $ret; @@ -947,4 +953,5 @@ function find_thread_parent_index($arr,$x) { foreach($arr as $k => $v) if($v['id'] == $x['parent']) return $k; + return false; } \ No newline at end of file diff --git a/include/enotify.php b/include/enotify.php index f6f291e5d..9df9b57e5 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -65,6 +65,19 @@ function notification($params) { $itemlink = $params['link']; } + if($params['type'] == NOTIFY_SUGGEST) { + $subject = sprintf( t('Friend suggestion received at %s'), $sitename); + $preamble = sprintf( t('You\'ve received a friend suggestion from \'%s\' at %s'), $params['source_name'], $sitename); + $body = t('Name:') . ' ' . $params['item']['name'] . "\n"; + $body .= t('Photo:') . ' ' . $params['item']['photo'] . "\n"; + $body .= sprintf( t('You may visit their profile at %s'),$params['item']['url']); + + $sitelink = t('Please visit %s to approve or reject the suggestion.'); + $tsitelink = sprintf( $sitelink, $siteurl ); + $hsitelink = sprintf( $sitelink, '' . $sitename . ''); + $itemlink = $params['link']; + } + if($params['type'] == NOTIFY_CONFIRM) { } diff --git a/include/items.php b/include/items.php index 7f003ab57..9f006306f 100644 --- a/include/items.php +++ b/include/items.php @@ -1788,7 +1788,18 @@ function local_delivery($importer,$data) { intval(0) ); - // TODO - send email notify (which may require a new notification preference) + notification(array( + 'type' => NOTIFY_SUGGEST, + 'notify_flags' => $importer['notify-flags'], + 'language' => $importer['language'], + 'to_name' => $importer['username'], + 'to_email' => $importer['email'], + 'item' => $fsugg, + 'link' => $a->get_baseurl() . '/notifications/intros', + 'source_name' => $importer['name'], + 'source_link' => $importer['url'], + 'source_photo' => $importer['photo'] + )); return 0; } diff --git a/mod/settings.php b/mod/settings.php index 35902f831..8ca0bb7f8 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -255,6 +255,10 @@ function settings_post(&$a) { $notify += intval($_POST['notify4']); if(x($_POST,'notify5')) $notify += intval($_POST['notify5']); + if(x($_POST,'notify6')) + $notify += intval($_POST['notify6']); + if(x($_POST,'notify7')) + $notify += intval($_POST['notify7']); $email_changed = false; @@ -807,7 +811,7 @@ function settings_content(&$a) { '$notify3' => array('notify3', t('Someone writes on your profile wall'), ($notify & NOTIFY_WALL), NOTIFY_WALL, ''), '$notify4' => array('notify4', t('Someone writes a followup comment'), ($notify & NOTIFY_COMMENT), NOTIFY_COMMENT, ''), '$notify5' => array('notify5', t('You receive a private message'), ($notify & NOTIFY_MAIL), NOTIFY_MAIL, ''), - + '$notify6' => array('notify6', t('You receive a friend suggestion'), ($notify & NOTIFY_SUGGEST), NOTIFY_SUGGEST, ''), '$h_advn' => t('Advanced Page Settings'), diff --git a/view/settings.tpl b/view/settings.tpl index e15976581..6310ff47e 100644 --- a/view/settings.tpl +++ b/view/settings.tpl @@ -107,6 +107,7 @@ $suggestme {{inc field_intcheckbox.tpl with $field=$notify3 }}{{endinc}} {{inc field_intcheckbox.tpl with $field=$notify4 }}{{endinc}} {{inc field_intcheckbox.tpl with $field=$notify5 }}{{endinc}} +{{inc field_intcheckbox.tpl with $field=$notify6 }}{{endinc}} -- cgit v1.2.3 From 8e6c02cda383b7655ef7c045a1c9cb2c63541b60 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 3 Jan 2012 18:12:58 -0800 Subject: remove some old email templates --- view/en/cmnt_received_eml.tpl | 18 ------------------ view/en/cmnt_received_html_body_eml.tpl | 25 ------------------------- view/en/cmnt_received_text_body_eml.tpl | 14 -------------- view/en/mail_received_html_body_eml.tpl | 26 -------------------------- view/en/mail_received_text_body_eml.tpl | 10 ---------- view/en/wall_received_eml.tpl | 18 ------------------ view/en/wall_received_html_body_eml.tpl | 24 ------------------------ view/en/wall_received_text_body_eml.tpl | 18 ------------------ 8 files changed, 153 deletions(-) delete mode 100644 view/en/cmnt_received_eml.tpl delete mode 100644 view/en/cmnt_received_html_body_eml.tpl delete mode 100644 view/en/cmnt_received_text_body_eml.tpl delete mode 100644 view/en/mail_received_html_body_eml.tpl delete mode 100644 view/en/mail_received_text_body_eml.tpl delete mode 100644 view/en/wall_received_eml.tpl delete mode 100644 view/en/wall_received_html_body_eml.tpl delete mode 100644 view/en/wall_received_text_body_eml.tpl diff --git a/view/en/cmnt_received_eml.tpl b/view/en/cmnt_received_eml.tpl deleted file mode 100644 index d60fcd375..000000000 --- a/view/en/cmnt_received_eml.tpl +++ /dev/null @@ -1,18 +0,0 @@ - -Dear $username, - - '$from' commented on an item/conversation which you have been following. - ------ -$body ------ - -Please login at $siteurl to view the complete conversation: - -$display - -Thank you, - $sitename administrator - - - diff --git a/view/en/cmnt_received_html_body_eml.tpl b/view/en/cmnt_received_html_body_eml.tpl deleted file mode 100644 index 95f56a4d5..000000000 --- a/view/en/cmnt_received_html_body_eml.tpl +++ /dev/null @@ -1,25 +0,0 @@ - - - - Friendica Message - - - - - - - - - - - - - - - - - - -
Friendica
$from commented on an item/conversation which you have been following.
$from
$body
Please login to view the complete conversation.
Thank You,
$sitename Administrator
- - diff --git a/view/en/cmnt_received_text_body_eml.tpl b/view/en/cmnt_received_text_body_eml.tpl deleted file mode 100644 index 7dcedeb0c..000000000 --- a/view/en/cmnt_received_text_body_eml.tpl +++ /dev/null @@ -1,14 +0,0 @@ -Dear $username, - - '$from' commented on an item/conversation which you have been following. - ------ -$body ------ - -Please login at $siteurl to view the complete conversation: - -$display - -Thank you, - $sitename administrator \ No newline at end of file diff --git a/view/en/mail_received_html_body_eml.tpl b/view/en/mail_received_html_body_eml.tpl deleted file mode 100644 index bd105a61b..000000000 --- a/view/en/mail_received_html_body_eml.tpl +++ /dev/null @@ -1,26 +0,0 @@ - - - - Friendica Message - - - - - - - - - - - - - - - - - - - -
Friendica
$from sent you a new private message at $siteName.
$from
$title
$htmlversion
Please login at $siteurl/message to read and reply to your private messages.
Thank You,
$siteName Administrator
- - diff --git a/view/en/mail_received_text_body_eml.tpl b/view/en/mail_received_text_body_eml.tpl deleted file mode 100644 index 023867304..000000000 --- a/view/en/mail_received_text_body_eml.tpl +++ /dev/null @@ -1,10 +0,0 @@ -$from sent you a new private message at $siteName. - -$title - -$textversion - -Please login at $siteurl to read and reply to your private messages. - -Thank you, -$siteName administrator diff --git a/view/en/wall_received_eml.tpl b/view/en/wall_received_eml.tpl deleted file mode 100644 index c296de785..000000000 --- a/view/en/wall_received_eml.tpl +++ /dev/null @@ -1,18 +0,0 @@ - -Dear $username, - - '$from' posted something to your profile wall. - ------ -$body ------ - -Please login at $siteurl to view or delete the item: - -$display - -Thank you, - $sitename administrator - - - diff --git a/view/en/wall_received_html_body_eml.tpl b/view/en/wall_received_html_body_eml.tpl deleted file mode 100644 index 91ef61e29..000000000 --- a/view/en/wall_received_html_body_eml.tpl +++ /dev/null @@ -1,24 +0,0 @@ - - - - Friendica Message - - - - - - - - - - - - - - - - - -
Friendica
$from posted something to your profile wall.
$from
$body
Please login at $siteurl to view or delete the post.
Thank You,
$sitename Administrator
- - diff --git a/view/en/wall_received_text_body_eml.tpl b/view/en/wall_received_text_body_eml.tpl deleted file mode 100644 index c296de785..000000000 --- a/view/en/wall_received_text_body_eml.tpl +++ /dev/null @@ -1,18 +0,0 @@ - -Dear $username, - - '$from' posted something to your profile wall. - ------ -$body ------ - -Please login at $siteurl to view or delete the item: - -$display - -Thank you, - $sitename administrator - - - -- cgit v1.2.3 From fc7d0360bb059bf87c5c531a2bfd5bcee3aef3f6 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 3 Jan 2012 20:26:20 -0800 Subject: add verb and item to notifications to aid in localisation --- boot.php | 6 +++--- database.sql | 17 +++++++++++++++++ include/diaspora.php | 2 ++ include/items.php | 16 +++++++++++++--- mod/dfrn_request.php | 4 +++- mod/item.php | 8 ++++++-- update.php | 20 +++++++++++++++++++- 7 files changed, 63 insertions(+), 10 deletions(-) diff --git a/boot.php b/boot.php index df9daf483..61deae18b 100644 --- a/boot.php +++ b/boot.php @@ -4,14 +4,14 @@ require_once('include/config.php'); require_once('include/network.php'); require_once('include/plugin.php'); require_once('include/text.php'); -require_once("include/pgettext.php"); +require_once('include/pgettext.php'); require_once('include/nav.php'); require_once('include/cache.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_VERSION', '2.3.1215' ); define ( 'DFRN_PROTOCOL_VERSION', '2.22' ); -define ( 'DB_UPDATE_VERSION', 1114 ); +define ( 'DB_UPDATE_VERSION', 1115 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); @@ -103,7 +103,7 @@ define ( 'NETWORK_MAIL', 'mail'); // IMAP/POP define ( 'NETWORK_FACEBOOK', 'face'); // Facebook API define ( 'NETWORK_LINKEDIN', 'lnkd'); // LinkedIn define ( 'NETWORK_XMPP', 'xmpp'); // XMPP - +define ( 'NETWORK_MYSPACE', 'mysp'); // MySpace /** * Maximum number of "people who like (or don't like) this" that we will list by name diff --git a/database.sql b/database.sql index 4dc1973ed..6826aa6f8 100644 --- a/database.sql +++ b/database.sql @@ -751,3 +751,20 @@ INDEX ( `uid` ), INDEX ( `seen` ), INDEX ( `date` ) ) ENGINE = MyISAM DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `item_id` ( +`iid` INT NOT NULL , +`uid` INT NOT NULL , +`face` CHAR( 255 ) NOT NULL , +`dspr` CHAR( 255 ) NOT NULL , +`twit` CHAR( 255 ) NOT NULL , +`stat` CHAR( 255 ) NOT NULL , +PRIMARY KEY ( `iid` ), +INDEX ( `uid` ), +INDEX ( `face` ), +INDEX ( `dspr` ), +INDEX ( `twit` ), +INDEX ( `stat` ) +) ENGINE = MyISAM DEFAULT CHARSET=utf8; + + diff --git a/include/diaspora.php b/include/diaspora.php index 2d139c77c..25ca11ed0 100644 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -1235,6 +1235,8 @@ function diaspora_conversation($importer,$xml,$msg) { 'source_name' => $person['name'], 'source_link' => $person['url'], 'source_photo' => $person['thumb'], + 'verb' => ACTIVITY_POST, + 'otype' => 'mail' )); } diff --git a/include/items.php b/include/items.php index 9f006306f..a63468d92 100644 --- a/include/items.php +++ b/include/items.php @@ -1798,7 +1798,9 @@ function local_delivery($importer,$data) { 'link' => $a->get_baseurl() . '/notifications/intros', 'source_name' => $importer['name'], 'source_link' => $importer['url'], - 'source_photo' => $importer['photo'] + 'source_photo' => $importer['photo'], + 'verb' => ACTIVITY_REQ_FRIEND, + 'otype' => 'intro' )); return 0; @@ -1847,6 +1849,8 @@ function local_delivery($importer,$data) { 'source_name' => $msg['from-name'], 'source_link' => $importer['url'], 'source_photo' => $importer['thumb'], + 'verb' => ACTIVITY_POST, + 'otype' => 'mail' ); notification($notif_params); @@ -2118,7 +2122,10 @@ function local_delivery($importer,$data) { 'source_name' => stripslashes($datarray['author-name']), 'source_link' => $datarray['author-link'], 'source_photo' => ((link_compare($datarray['author-link'],$importer['url'])) - ? $importer['thumb'] : $datarray['author-avatar']) + ? $importer['thumb'] : $datarray['author-avatar']), + 'verb' => ACTIVITY_POST, + 'otype' => 'item' + )); } @@ -2234,7 +2241,10 @@ function local_delivery($importer,$data) { 'source_name' => stripslashes($datarray['author-name']), 'source_link' => $datarray['author-link'], 'source_photo' => ((link_compare($datarray['author-link'],$importer['url'])) - ? $importer['thumb'] : $datarray['author-avatar']) + ? $importer['thumb'] : $datarray['author-avatar']), + 'verb' => ACTIVITY_POST, + 'otype' => 'item' + )); break; diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index a96860403..aa14bc473 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -580,7 +580,9 @@ function dfrn_request_content(&$a) { 'link' => $a->get_baseurl() . '/notifications/intros', 'source_name' => ((strlen(stripslashes($r[0]['name']))) ? stripslashes($r[0]['name']) : t('[Name Withheld]')), 'source_link' => $r[0]['url'], - 'source_photo' => $r[0]['photo'] + 'source_photo' => $r[0]['photo'], + 'verb' => ACTIVITY_REQ_FRIEND, + 'otype' => 'intro' )); } diff --git a/mod/item.php b/mod/item.php index ece92f0f3..c4e66ebeb 100644 --- a/mod/item.php +++ b/mod/item.php @@ -691,7 +691,9 @@ function item_post(&$a) { 'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id, 'source_name' => $datarray['author-name'], 'source_link' => $datarray['author-link'], - 'source_photo' => $datarray['author-avatar'] + 'source_photo' => $datarray['author-avatar'], + 'verb' => ACTIVITY_POST, + 'otype' => 'item' )); } @@ -731,7 +733,9 @@ function item_post(&$a) { 'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id, 'source_name' => $datarray['author-name'], 'source_link' => $datarray['author-link'], - 'source_photo' => $datarray['author-avatar'] + 'source_photo' => $datarray['author-avatar'], + 'verb' => ACTIVITY_POST, + 'otype' => 'item' )); } } diff --git a/update.php b/update.php index 6eade22f7..4dff59c98 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@ Date: Wed, 4 Jan 2012 07:05:44 +0100 Subject: Update view/de/strings.php --- view/de/strings.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/view/de/strings.php b/view/de/strings.php index b752ef2ea..7c110c093 100644 --- a/view/de/strings.php +++ b/view/de/strings.php @@ -239,11 +239,11 @@ $a->strings["Automatically expire posts after days:"] = "Einträge verfallen aut $a->strings["If empty, posts will not expire. Expired posts will be deleted"] = "Wenn leer verfallen Einträge nie automatisch. Verfallene Einträge werden gelöscht."; $a->strings["Notification Settings"] = "Benachrichtigungseinstellungen"; $a->strings["Send a notification email when:"] = "Benachrichtigungs-Email senden wenn:"; -$a->strings["You receive an introduction"] = "Du eine Vorstellung erhälst"; +$a->strings["You receive an introduction"] = "Du eine Vorstellung erhältst"; $a->strings["Your introductions are confirmed"] = "Eine deiner Vorstellungen angenommen wurde"; $a->strings["Someone writes on your profile wall"] = "Jemand etwas auf deiner Pinnwand postet"; $a->strings["Someone writes a followup comment"] = "Jemand auch einen Kommentar verfasst"; -$a->strings["You receive a private message"] = "Du eine private Nachricht erhälst"; +$a->strings["You receive a private message"] = "Du eine private Nachricht erhältst"; $a->strings["Advanced Page Settings"] = "Erweiterte Seiten Einstellungen"; $a->strings["Saved Searches"] = "Gespeicherte Suchen"; $a->strings["Remove term"] = "Begriff entfernen"; @@ -822,7 +822,7 @@ $a->strings["Post to Twitter"] = "Nach Twitter senden"; $a->strings["Twitter settings updated."] = "Twitter Einstellungen aktualisiert."; $a->strings["Twitter Posting Settings"] = "Twitter Posting Einstellungen"; $a->strings["No consumer key pair for Twitter found. Please contact your site administrator."] = "Kein Consumer Schlüsselpaar für Twitter gefunden. Bitte wende dich an den Administrator der Seite."; -$a->strings["At this Friendika instance the Twitter plugin was enabled but you have not yet connected your account to your Twitter account. To do so click the button below to get a PIN from Twitter which you have to copy into the input box below and submit the form. Only your public posts will be posted to Twitter."] = "Auf dieser Friendika Instanz wurde das Twitter Plugin aktiviert dein Account ist allerdings noch nicht mit einem Twitter Account verbunden. Um deinen Account mit Twitter zu verbinden, klick auf den Button weiter unten und gib die PIN die du auf Twitter erhälst hier ein. Es werden ausschließlich deine öffentlichen Nachrichten auf Twitter veröffentlicht."; +$a->strings["At this Friendika instance the Twitter plugin was enabled but you have not yet connected your account to your Twitter account. To do so click the button below to get a PIN from Twitter which you have to copy into the input box below and submit the form. Only your public posts will be posted to Twitter."] = "Auf dieser Friendika Instanz wurde das Twitter Plugin aktiviert dein Account ist allerdings noch nicht mit einem Twitter Account verbunden. Um deinen Account mit Twitter zu verbinden, klick auf den Button weiter unten und gib die PIN die du auf Twitter erhältst hier ein. Es werden ausschließlich deine öffentlichen Nachrichten auf Twitter veröffentlicht."; $a->strings["Log in with Twitter"] = "bei Twitter anmelden"; $a->strings["Copy the PIN from Twitter here"] = "Kopiere die Twitter PIN hier her"; $a->strings["Currently connected to: "] = "Momentan verbunden mit: "; -- cgit v1.2.3 From 48a5a2484e762a9804237ae28c24dafe5db7f953 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 4 Jan 2012 00:04:19 -0800 Subject: new smiley --- images/smiley-Oo.gif | Bin 0 -> 1045 bytes include/text.php | 4 +++- view/jot-header.tpl | 1 + view/jot.tpl | 4 +++- 4 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 images/smiley-Oo.gif diff --git a/images/smiley-Oo.gif b/images/smiley-Oo.gif new file mode 100644 index 000000000..a125d0ff2 Binary files /dev/null and b/images/smiley-Oo.gif differ diff --git a/include/text.php b/include/text.php index f32aaad07..1db88ca2c 100644 --- a/include/text.php +++ b/include/text.php @@ -678,7 +678,7 @@ function smilies($s) { $a = get_app(); $s = str_replace( - array( '<3', '</3', '<\\3', ':-)', ':)', ';-)', ':-(', ':(', ':-P', ':P', ':-"', ':-x', ':-X', ':-D', '8-|', '8-O', '\\o/', + array( '<3', '</3', '<\\3', ':-)', ':)', ';-)', ':-(', ':(', ':-P', ':P', ':-"', ':-x', ':-X', ':-D', '8-|', '8-O', '\\o/', 'o.O', 'O.o', '~friendika', '~friendica', 'Diaspora*' ), array( '<3', @@ -698,6 +698,8 @@ function smilies($s) { '8-|', '8-O', '\\o/', + 'o.O', + 'O.o', '~friendika ~friendika', '~friendica ~friendica', 'DiasporaDiaspora*', diff --git a/view/jot-header.tpl b/view/jot-header.tpl index ecfed6c42..941a8f3e2 100644 --- a/view/jot-header.tpl +++ b/view/jot-header.tpl @@ -7,6 +7,7 @@ var textlen = 0; function initEditor(cb){ if (editor==false){ $("#profile-jot-text-loading").show(); +// $("#jot-title").show(); tinyMCE.init({ theme : "advanced", mode : "specific_textareas", diff --git a/view/jot.tpl b/view/jot.tpl index 71b92986d..83af1ae37 100644 --- a/view/jot.tpl +++ b/view/jot.tpl @@ -12,8 +12,10 @@ - +
+ +
-- cgit v1.2.3 From c1cf6e48c225725c380472e1f730f6dc02917ecd Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 4 Jan 2012 13:50:12 -0800 Subject: Allow Diaspora to post to forums --- boot.php | 2 +- include/items.php | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/boot.php b/boot.php index 61deae18b..b06c2d0bf 100644 --- a/boot.php +++ b/boot.php @@ -9,7 +9,7 @@ require_once('include/nav.php'); require_once('include/cache.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); -define ( 'FRIENDICA_VERSION', '2.3.1215' ); +define ( 'FRIENDICA_VERSION', '2.3.1216' ); define ( 'DFRN_PROTOCOL_VERSION', '2.22' ); define ( 'DB_UPDATE_VERSION', 1115 ); diff --git a/include/items.php b/include/items.php index a63468d92..0bd77582a 100644 --- a/include/items.php +++ b/include/items.php @@ -945,10 +945,15 @@ function tgroup_deliver($uid,$item_id) { $link = normalise_link($a->get_baseurl() . '/profile/' . $u[0]['nickname']); + // Diaspora uses their own hardwired link URL in @-tags + // instead of the one we supply with webfinger + + $dlink = normalise_link($a->get_baseurl() . '/u/' . $u[0]['nickname']); + $cnt = preg_match_all('/[\@\!]\[url\=(.*?)\](.*?)\[\/url\]/ism',$item['body'],$matches,PREG_SET_ORDER); if($cnt) { foreach($matches as $mtch) { - if(link_compare($link,$mtch[1])) { + if(link_compare($link,$mtch[1]) || link_compare($dlink,$mtch[1])) { $deliver_to_tgroup = true; logger('tgroup_deliver: local group mention found: ' . $mtch[2]); } -- cgit v1.2.3 From d0b743529d5f0034e08456473fe32e38c7144f74 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 4 Jan 2012 14:30:25 -0800 Subject: support auto-friend page types for Diaspora --- include/diaspora.php | 53 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/include/diaspora.php b/include/diaspora.php index 25ca11ed0..f32113668 100644 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -464,7 +464,7 @@ function diaspora_request($importer,$xml) { intval($importer['uid']) ); - if((count($r)) && ($r[0]['hide-friends'] == 0)) { + if((count($r)) && (! $r[0]['hide-friends']) && (! $contact['hidden'])) { require_once('include/items.php'); $self = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1", @@ -527,6 +527,8 @@ function diaspora_request($importer,$xml) { $batch = (($ret['batch']) ? $ret['batch'] : implode('/', array_slice(explode('/',$ret['url']),0,3)) . '/receive/public'); + + $r = q("INSERT INTO `contact` (`uid`, `network`,`addr`,`created`,`url`,`nurl`,`batch`,`name`,`nick`,`photo`,`pubkey`,`notify`,`poll`,`blocked`,`priority`) VALUES ( %d, '%s', '%s', '%s', '%s','%s','%s','%s','%s','%s','%s','%s','%s',%d,%d) ", intval($importer['uid']), @@ -550,9 +552,15 @@ function diaspora_request($importer,$xml) { $contact_record = diaspora_get_contact_by_handle($importer['uid'],$sender_handle); - $hash = random_string() . (string) time(); // Generate a confirm_key + if(! $contact_record) { + logger('diaspora_request: unable to locate newly created contact record.'); + return; + } + + if($importer['page-flags'] == PAGE_NORMAL) { + + $hash = random_string() . (string) time(); // Generate a confirm_key - if($contact_record) { $ret = q("INSERT INTO `intro` ( `uid`, `contact-id`, `blocked`, `knowyou`, `note`, `hash`, `datetime` ) VALUES ( %d, %d, %d, %d, '%s', '%s', '%s' )", intval($importer['uid']), @@ -564,6 +572,45 @@ function diaspora_request($importer,$xml) { dbesc(datetime_convert()) ); } + else { + + // automatic friend approval + + require_once('include/Photo.php'); + + $photos = import_profile_photo($contact_record['photo'],$importer['uid'],$contact_record['id']); + + // technically they are sharing with us (CONTACT_IS_SHARING), + // but if our page-type is PAGE_COMMUNITY or PAGE_SOAPBOX + // we are going to change the relationship and make them a follower. + + if($importer['page-flags'] == PAGE_FREELOVE) + $new_relation = CONTACT_IS_FRIEND; + else + $new_relation = CONTACT_IS_FOLLOWER; + + $r = q("UPDATE `contact` SET + `photo` = '%s', + `thumb` = '%s', + `micro` = '%s', + `rel` = %d, + `name-date` = '%s', + `uri-date` = '%s', + `avatar-date` = '%s', + `blocked` = 0, + `pending` = 0, + WHERE `id` = %d LIMIT 1 + ", + dbesc($photos[0]), + dbesc($photos[1]), + dbesc($photos[2]), + intval($new_relation), + dbesc(datetime_convert()), + dbesc(datetime_convert()), + dbesc(datetime_convert()), + intval($contact_record['id']) + ); + } return; } -- cgit v1.2.3 From b0c3dc00b9252d896d233747bdd317fb5c360d51 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 4 Jan 2012 16:14:26 -0800 Subject: fix registration request pings --- mod/ping.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mod/ping.php b/mod/ping.php index e74ef8314..5b9159fa4 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -128,9 +128,9 @@ function ping_init(&$a) { ); $mail = $mails[0]['total']; - if ($a->config['register_policy'] == REGISTER_APPROVE && is_site_admin()){ - $regs = q("SELECT `contact`.`name`, `contact`.`url`, `contact`.`micro`, `register`.`created`, COUNT(*) as `total` FROM `contact` RIGHT JOIN `register` ON `register`.`uid`=`contact`.`uid` WHERE `contact`.`self`=1"); - $register = $regs[0]['total']; + if ($a->config['register_policy'] == REGISTER_APPROVE && is_site_admin()) { + $regs = q("select register.created, contact.name, contact.url, contact.micro from register left join contact on register.uid = contact.uid where contact.self = 1"); + $register = count($regs); } else { $register = "0"; } -- cgit v1.2.3 From 47edaf9ad79b59d96f908b4501d564e5e63cc210 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 4 Jan 2012 18:03:09 -0800 Subject: dynamic title input box - via fabrixxm --- include/conversation.php | 5 ++++- mod/ping.php | 29 +++++++---------------------- view/jot-header.tpl | 8 ++++++-- view/jot.tpl | 4 +--- view/theme/dispy/jot-header.tpl | 7 +++++++ view/theme/dispy/jot.tpl | 8 ++++---- view/theme/dispy/style.css | 13 +++++++++++++ view/theme/duepuntozero/style.css | 13 +++++++++++++ view/theme/loozah/style.css | 14 ++++++++++++++ view/theme/quattro/jot.tpl | 8 ++++---- view/theme/quattro/quattro.less | 2 ++ view/theme/testbubble/jot-header.tpl | 8 ++++++++ view/theme/testbubble/jot.tpl | 9 +++++---- view/theme/testbubble/style.css | 14 ++++++++++++++ 14 files changed, 102 insertions(+), 40 deletions(-) diff --git a/include/conversation.php b/include/conversation.php index a30a78271..ec1fd4152 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -812,7 +812,8 @@ function status_editor($a,$x, $notes_cid = 0) { '$audurl' => t("Please enter an audio link/URL:"), '$term' => t('Tag term:'), '$whereareu' => t('Where are you right now?'), - '$title' => t('Enter a title for this item') + '$title' => t('Enter a title for this item'), + '$addtitle' => t('click here to add a title') )); @@ -880,6 +881,8 @@ function status_editor($a,$x, $notes_cid = 0) { '$acl' => $x['acl'], '$bang' => $x['bang'], '$profile_uid' => $x['profile_uid'], + '$addtitle' => t('click here to add a title') + )); return $o; diff --git a/mod/ping.php b/mod/ping.php index 5b9159fa4..df07cb768 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -7,7 +7,6 @@ function ping_init(&$a) { header("Content-type: text/xml"); echo " "; - $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">"; if(local_user()){ @@ -18,11 +17,10 @@ function ping_init(&$a) { $dislikes = array(); $friends = array(); $posts = array(); - $cit = array(); $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`, - `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object`, `item`.`body`, + `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object`, `pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink` FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent` WHERE `item`.`unseen` = 1 AND `item`.`visible` = 1 AND @@ -31,8 +29,6 @@ function ping_init(&$a) { intval(local_user()) ); - - $network = count($r); foreach ($r as $it) { switch($it['verb']){ @@ -53,11 +49,8 @@ function ping_init(&$a) { $friends[] = $it; break; default: - $reg = "|@\[url=".$a->get_baseurl()."/profile/".$a->user['nickname']."|"; if ($it['parent']!=$it['id']) { $comments[] = $it; - } else if(preg_match( $reg, $it['body'])){ - $cit[] = $it; } else { $posts[] = $it; } @@ -93,9 +86,6 @@ function ping_init(&$a) { break; default: if ($it['parent']!=$it['id']) $comments[] = $it; - if(preg_match("/@\[[^]]*\]".$a->user['username']."/", $it['body'])){ - $cit[] = $it; - } } } @@ -128,9 +118,9 @@ function ping_init(&$a) { ); $mail = $mails[0]['total']; - if ($a->config['register_policy'] == REGISTER_APPROVE && is_site_admin()) { - $regs = q("select register.created, contact.name, contact.url, contact.micro from register left join contact on register.uid = contact.uid where contact.self = 1"); - $register = count($regs); + if ($a->config['register_policy'] == REGISTER_APPROVE && is_site_admin()){ + $regs = q("SELECT `contact`.`name`, `contact`.`url`, `contact`.`micro`, `register`.`created`, COUNT(*) as `total` FROM `contact` RIGHT JOIN `register` ON `register`.`uid`=`contact`.`uid` WHERE `contact`.`self`=1"); + $register = $regs[0]['total']; } else { $register = "0"; } @@ -150,12 +140,12 @@ function ping_init(&$a) { $home"; if ($register!=0) echo "$register"; - $tot = $mail+$intro+$register+count($comments)+count($likes)+count($dislikes)+count($friends)+count($posts)+count($tags)+count($cit); + $tot = $mail+$intro+$register+count($comments)+count($likes)+count($dislikes)+count($friends)+count($posts)+count($tags); echo ' '; if ($intro>0){ foreach ($intros as $i) { - echo xmlize( $a->get_baseurl().'/notifications/intros/'.$i['id'], $i['name'], $i['url'], $i['photo'], relative_date($i['datetime']), t("{0} wants to be your friend") ); + echo xmlize( $a->get_baseurl().'/notifications/'.$i['id'], $i['name'], $i['url'], $i['photo'], relative_date($i['datetime']), t("{0} wants to be your friend") ); }; } if ($mail>0){ @@ -191,7 +181,7 @@ function ping_init(&$a) { } if (count($posts)){ foreach ($posts as $i) { - echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), t("{0} posted") ); + echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} posted") ) ); }; } if (count($tags)){ @@ -199,11 +189,6 @@ function ping_init(&$a) { echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} tagged %s's post with #%s"), $i['pname'], $i['tname'] ) ); }; } - if (count($cit)){ - foreach ($cit as $i) { - echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), t("{0} mentioned you in a post") ); - }; - } echo " "; } diff --git a/view/jot-header.tpl b/view/jot-header.tpl index 941a8f3e2..f35cbee17 100644 --- a/view/jot-header.tpl +++ b/view/jot-header.tpl @@ -7,7 +7,7 @@ var textlen = 0; function initEditor(cb){ if (editor==false){ $("#profile-jot-text-loading").show(); -// $("#jot-title").show(); + $("#jot-title-desc").show(); tinyMCE.init({ theme : "advanced", mode : "specific_textareas", @@ -111,7 +111,11 @@ function initEditor(cb){ $(this).val(""); initEditor(); }); - + + $("#jot-title-desc").click(function() { + $("#jot-title-desc").hide(); + $("#jot-title").show(); + }); var uploader = new window.AjaxUpload( 'wall-image-upload', diff --git a/view/jot.tpl b/view/jot.tpl index 83af1ae37..cb4eb64d4 100644 --- a/view/jot.tpl +++ b/view/jot.tpl @@ -14,6 +14,7 @@
+
@@ -46,9 +47,6 @@ -
- -
$jotplugins diff --git a/view/theme/dispy/jot-header.tpl b/view/theme/dispy/jot-header.tpl index 7a1012230..a3464f3f7 100644 --- a/view/theme/dispy/jot-header.tpl +++ b/view/theme/dispy/jot-header.tpl @@ -8,6 +8,7 @@ var textlen = 0; function initEditor(cb) { if (editor==false) { $("#profile-jot-text-loading").show(); + $("#jot-title-desc").show(); tinyMCE.init({ theme : "advanced", mode : "specific_textareas", @@ -100,6 +101,12 @@ function initEditor(cb) { $(this).val(""); initEditor(); }); + + $("#jot-title-desc").click(function() { + $("#jot-title-desc").hide(); + $("#jot-title").show(); + }); + var uploader = new window.AjaxUpload( 'wall-image-upload', { action: 'wall_upload/$nickname', diff --git a/view/theme/dispy/jot.tpl b/view/theme/dispy/jot.tpl index a2c883e4b..b340b532b 100644 --- a/view/theme/dispy/jot.tpl +++ b/view/theme/dispy/jot.tpl @@ -14,8 +14,11 @@ - +
+ + +
@@ -49,9 +52,6 @@ -