From 46c5a97a204b6bff64b0e85cccf76b38d247862f Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Fri, 14 Dec 2012 22:47:30 +0100 Subject: [PATCH 1/7] New caching system for photos --- boot.php | 15 ++++++++++++++- include/network.php | 3 +-- include/poller.php | 3 +++ mod/photo.php | 13 +++++++++++-- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/boot.php b/boot.php index 354c24320..9dacaaaec 100644 --- a/boot.php +++ b/boot.php @@ -520,6 +520,19 @@ if(! class_exists('App')) { $this->is_tablet = $mobile_detect->isTablet(); } + function get_basepath() { + + $basepath = get_config("system", "basepath"); + + if ($basepath == "") + $basepath = $_SERVER["DOCUMENT_ROOT"]; + + if ($basepath == "") + $basepath = $_SERVER["PWD"]; + + return($basepath); + } + function get_baseurl($ssl = false) { $scheme = $this->scheme; @@ -1895,7 +1908,7 @@ function clear_cache($basepath = "", $path = "") { $fullpath = $path."/".$file; if ((filetype($fullpath) == "dir") and ($file != ".") and ($file != "..")) clear_cache($basepath, $fullpath); - if ((filetype($fullpath) == "file") and filectime($fullpath) < (time() - $cachetime)) + if ((filetype($fullpath) == "file") and (filectime($fullpath) < (time() - $cachetime))) unlink($fullpath); } closedir($dh); diff --git a/include/network.php b/include/network.php index 599088a2d..5877dda41 100644 --- a/include/network.php +++ b/include/network.php @@ -854,8 +854,7 @@ function scale_external_images($s, $include_link = true, $scale_replace = false) } // replace the special char encoding - - $s = htmlspecialchars($s,ENT_QUOTES,'UTF-8'); + $s = htmlspecialchars($s,ENT_NOQUOTES,'UTF-8'); return $s; } diff --git a/include/poller.php b/include/poller.php index 6f2eeed82..4eb5e8a2b 100644 --- a/include/poller.php +++ b/include/poller.php @@ -105,6 +105,9 @@ function poller_run(&$argv, &$argc){ // clear old item cache files clear_cache(); + // clear cache for photos + clear_cache($a->get_basepath(), $a->get_basepath()."/photo"); + $manual_id = 0; $generation = 0; $hub_update = false; diff --git a/mod/photo.php b/mod/photo.php index e37b92738..93db82a64 100644 --- a/mod/photo.php +++ b/mod/photo.php @@ -7,6 +7,7 @@ function photo_init(&$a) { global $_SERVER; $prvcachecontrol = false; + $file = ""; switch($a->argc) { case 4: @@ -20,6 +21,7 @@ function photo_init(&$a) { break; case 2: $photo = $a->argv[1]; + $file = $photo; break; case 1: default: @@ -42,7 +44,6 @@ function photo_init(&$a) { exit; } - $default = 'images/person-175.jpg'; if(isset($type)) { @@ -94,7 +95,7 @@ function photo_init(&$a) { foreach( Photo::supportedTypes() as $m=>$e){ $photo = str_replace(".$e",'',$photo); } - + if(substr($photo,-2,1) == '-') { $resolution = intval(substr($photo,-1,1)); $photo = substr($photo,0,-2); @@ -115,6 +116,8 @@ function photo_init(&$a) { intval($resolution) ); + $public = ($r[0]['allow_cid'] == '') AND ($r[0]['allow_gid'] == '') AND ($r[0]['deny_cid'] == '') AND ($r[0]['deny_gid'] == ''); + if(count($r)) { $data = $r[0]['data']; $mimetype = $r[0]['type']; @@ -198,6 +201,12 @@ function photo_init(&$a) { header("Cache-Control: max-age=31536000"); } echo $data; + + // If the photo is public and there is an existing photo directory store the photo there + if ($public and ($file != "")) + if (is_dir($_SERVER["DOCUMENT_ROOT"]."/photo")) + file_put_contents($_SERVER["DOCUMENT_ROOT"]."/photo/".$file, $data); + killme(); // NOTREACHED } From a61ac769a084c655f5f01daeae23d7a9a8b33b61 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 15 Dec 2012 11:25:52 +0100 Subject: [PATCH 2/7] vier: Expanding and collapsing now works --- view/theme/vier/theme.php | 98 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 97 insertions(+), 1 deletion(-) diff --git a/view/theme/vier/theme.php b/view/theme/vier/theme.php index 7dd3797ef..97199723e 100644 --- a/view/theme/vier/theme.php +++ b/view/theme/vier/theme.php @@ -6,4 +6,100 @@ * Author: Ike * Maintainer: Ike */ - + +$a->theme_info = array(); + +function vier_init(&$a) { +$a->page['htmlhead'] .= <<< EOT + +EOT; +} From d253d59668b52b4ef12383e14d83231ff4ac2939 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 15 Dec 2012 14:39:37 +0100 Subject: [PATCH 3/7] vier: Added Delegations and optical changes. --- include/nav.php | 8 ++++-- view/theme/vier/nav.tpl | 2 +- view/theme/vier/style.css | 60 ++++++++++++++++++++++++++++++++------- view/theme/vier/theme.php | 7 +++-- 4 files changed, 60 insertions(+), 17 deletions(-) diff --git a/include/nav.php b/include/nav.php index 3c058e04f..d94bf03be 100644 --- a/include/nav.php +++ b/include/nav.php @@ -44,14 +44,14 @@ function nav(&$a) { if(local_user()) { $nav['logout'] = Array('logout',t('Logout'), "", t('End this session')); - + // user menu $nav['usermenu'][] = Array('profile/' . $a->user['nickname'], t('Status'), "", t('Your posts and conversations')); $nav['usermenu'][] = Array('profile/' . $a->user['nickname']. '?tab=profile', t('Profile'), "", t('Your profile page')); $nav['usermenu'][] = Array('photos/' . $a->user['nickname'], t('Photos'), "", t('Your photos')); $nav['usermenu'][] = Array('events/', t('Events'), "", t('Your events')); $nav['usermenu'][] = Array('notes/', t('Personal notes'), "", t('Your personal photos')); - + // user info $r = q("SELECT micro FROM contact WHERE uid=%d AND self=1", intval($a->user['uid'])); $userinfo = array( @@ -130,11 +130,13 @@ function nav(&$a) { $nav['messages']['inbox'] = array('message', t('Inbox'), "", t('Inbox')); $nav['messages']['outbox']= array('message/sent', t('Outbox'), "", t('Outbox')); $nav['messages']['new'] = array('message/new', t('New Message'), "", t('New Message')); - + if(is_array($a->identities) && count($a->identities) > 1) { $nav['manage'] = array('manage', t('Manage'), "", t('Manage other pages')); } + $nav['delegations'] = Array('delegate', t('Delegations'), "", t('Delegate Page Management')); + $nav['settings'] = array('settings', t('Settings'),"", t('Account settings')); if(feature_enabled(local_user(),'multi_profiles')) $nav['profiles'] = array('profiles', t('Profiles'),"", t('Manage/Edit Profiles')); diff --git a/view/theme/vier/nav.tpl b/view/theme/vier/nav.tpl index b2b6cc785..f615be85f 100644 --- a/view/theme/vier/nav.tpl +++ b/view/theme/vier/nav.tpl @@ -41,6 +41,7 @@ {{ if $nav.help }}
  • $nav.help.1
  • {{ endif }}
  • Info/Impressum
  • $nav.directory.1
  • + {{ if $nav.delegations }}
  • $nav.delegations.1
  • {{ endif }} {{ if $nav.settings }}
  • $nav.settings.1
  • {{ endif }} {{ if $nav.admin }}
  • $nav.admin.1
  • {{ endif }} @@ -74,7 +75,6 @@ {{ for $nav.usermenu as $usermenu }}
  • $usermenu.1
  • {{ endfor }} - {{ if $nav.notifications }}
  • $nav.notifications.1
  • {{ endif }} {{ if $nav.messages }}
  • $nav.messages.1
  • {{ endif }} {{ if $nav.contacts }}
  • $nav.contacts.1
  • {{ endif }} diff --git a/view/theme/vier/style.css b/view/theme/vier/style.css index f5e64ca47..f41b70bbb 100644 --- a/view/theme/vier/style.css +++ b/view/theme/vier/style.css @@ -332,10 +332,10 @@ /* global */ body { font-family: 'Lato', "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 13px; + font-size: 14px; background-color: #ffffff; color: #2d2d2d; - margin: 50px 0px 0px 0px; + margin: 37px 0px 0px 0px; display: table; } h4 { @@ -345,7 +345,8 @@ h4 { a { /* color: #36C; */ /* color: #3e3e8c; */ - color: #3465A4; + /* color: #3465A4; */ + color: #3E3E8C; text-decoration: none; } a:hover { @@ -379,7 +380,8 @@ a:hover { .fakelink { /* color: #36c; */ /* color: #3e3e8c; */ - color: #3465A4; + /* color: #3465A4; */ + color: #3E3E8C; text-decoration: none; cursor: pointer; } @@ -580,7 +582,7 @@ nav .nav-menu { padding-left: 5px; padding-right: 5px; margin: 3px 3px 0px; - font-size: 13px; + font-size: 14px; border-bottom: 3px solid #364A84; } nav .nav-menu.selected { @@ -790,6 +792,8 @@ aside { width: 185px; padding: 0px 10px 0px 20px; border-right: 1px solid #D2D2D2; + background-color: #ECECF2; + font-size: 13px; /* background: #F1F1F1; */ } aside .vcard .fn { @@ -1006,7 +1010,7 @@ section { display: table-row; } .wall-item-bottom { - font-size: 13px; + font-size: 14px; } .wall-item-container .wall-item-bottom { opacity: 0.5; @@ -1045,10 +1049,10 @@ section { } .wall-item-container .wall-item-content { - font-size: 13px; + font-size: 14px; max-width: 660px; word-wrap: break-word; - line-height: 1.4; + line-height: 1.36; } .wall-item-container .wall-item-content img { @@ -1620,15 +1624,51 @@ section { ul.tabs { list-style-type: none; padding-bottom: 10px; - font-size: 13px; + font-size: 14px; } ul.tabs li { float: left; margin-left: 7px; } -ul.tabs li .active { +/*ul.tabs li .active { border-bottom: 1px solid #005c94; +}*/ +ul.tabs a { + display: block; + float: left; + padding: 0px 10px 1px 10px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + border: 1px solid #ECECF2; + font-weight: bold; + line-height: 1.4em; + color: #3e3e8c; + text-shadow: 0px 1px 0px rgba(255, 255, 255, 0.9); + background: #ececf2; + background: -moz-linear-gradient(top, #ffffff 0%, #ececf2 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#ececf2)); + background: -webkit-linear-gradient(top, #ffffff 0%,#ececf2 100%); + background: -o-linear-gradient(top, #ffffff 0%,#ececf2 100%); + background: -ms-linear-gradient(top, #ffffff 0%,#ececf2 100%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ececf2',GradientType=0 ); + background: linear-gradient(top, #ffffff 0%,#ececf2 100%); } +ul.tabs li .active, ul.tabs a:hover { + color: #fff; + text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.5); + border: 1px solid #ececf2; + background: #364a84; + background: -moz-linear-gradient(top, #7b8dbb 0%, #364a84 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#7b8dbb), color-stop(100%,#364a84)); + background: -webkit-linear-gradient(top, #7b8dbb 0%,#364a84 100%); + background: -o-linear-gradient(top, #7b8dbb 0%,#364a84 100%); + background: -ms-linear-gradient(top, #7b8dbb 0%,#364a84 100%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7b8dbb', endColorstr='#364a84',GradientType=0 ); + background: linear-gradient(top, #7b8dbb 0%,#364a84 100%); + text-decoration: none; +} + /** * Form fields */ diff --git a/view/theme/vier/theme.php b/view/theme/vier/theme.php index 97199723e..5e483c5ad 100644 --- a/view/theme/vier/theme.php +++ b/view/theme/vier/theme.php @@ -12,7 +12,7 @@ $a->theme_info = array(); function vier_init(&$a) { $a->page['htmlhead'] .= <<< EOT EOT; } From 9c0de2862203619ebf52f8046c3ceee6d175ac83 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 17 Dec 2012 03:01:40 +0100 Subject: [PATCH 4/7] bbcode: New element "share" for shared content mail: Now mails connected via subject line if there isn't an appropriate header. vier: Improvents to the theme so that shared messages are looking fine --- include/bb2diaspora.php | 3 ++ include/bbcode.php | 64 +++++++++++++++++++++++++++++++++++++-- include/onepoll.php | 28 ++++++++++++++--- view/theme/vier/style.css | 23 +++++++++++++- 4 files changed, 110 insertions(+), 8 deletions(-) diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 75fe1ef35..ffe6b3b97 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -155,6 +155,9 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) { // $Text = preg_replace("/\[url\=([^\[\]]*)\]\s*\[img\](.*?)\[\/img\]\s*\[\/url\]/ism", // "[url]$1[/url]\n[img]$2[/img]", $Text); + // Remove the avatar picture since that isn't looking good on the other side + //$Text = preg_replace("/\[share(.*?)avatar\s?=\s?'.*?'\s?(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism","\n[share$1$2]$3[/share]",$Text); + // Convert it to HTML - don't try oembed $Text = bbcode($Text, $preserve_nl, false); diff --git a/include/bbcode.php b/include/bbcode.php index d83fe6c12..b3f6aa826 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -206,7 +206,59 @@ function bb_replace_images($body, $images) { return $newbody; }} +function bb_ShareAttributes($match) { + $attributes = $match[1]; + + $author = ""; + preg_match("/author='(.*?)'/ism", $attributes, $matches); + if ($matches[1] != "") + $author = $matches[1]; + + preg_match('/author="(.*?)"/ism', $attributes, $matches); + if ($matches[1] != "") + $author = $matches[1]; + + $link = ""; + preg_match("/link='(.*?)'/ism", $attributes, $matches); + if ($matches[1] != "") + $link = $matches[1]; + + preg_match('/link="(.*?)"/ism', $attributes, $matches); + if ($matches[1] != "") + $link = $matches[1]; + + $avatar = ""; + preg_match("/avatar='(.*?)'/ism", $attributes, $matches); + if ($matches[1] != "") + $avatar = $matches[1]; + + preg_match('/avatar="(.*?)"/ism', $attributes, $matches); + if ($matches[1] != "") + $avatar = $matches[1]; + + $profile = ""; + preg_match("/profile='(.*?)'/ism", $attributes, $matches); + if ($matches[1] != "") + $profile = $matches[1]; + + preg_match('/profile="(.*?)"/ism', $attributes, $matches); + if ($matches[1] != "") + $profile = $matches[1]; + + $headline = '
    '; + + if ($avatar != "") + $headline .= ''; + + $headline .= sprintf(t('%s wrote the following post:'), $profile, $author, $link); + + $headline .= "
    "; + + $text = "
    ".$headline.'
    '.trim($match[2])."
    "; + + return($text); +} // BBcode 2 HTML was written by WAY2WEB.net // extended to work with Mistpark/Friendica - Mike Macgirvin @@ -248,6 +300,13 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) { $Text = str_replace("<", "<", $Text); $Text = str_replace(">", ">", $Text); + // remove some newlines before the general conversion + $Text = preg_replace("/\s?\[share(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism","[share$1]$2[/share]",$Text); + + // when the content is meant exporting to other systems then remove the avatar picture since this doesn't really look good on these systems + if (!$tryoembed) + $Text = preg_replace("/\[share(.*?)avatar\s?=\s?'.*?'\s?(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism","\n[share$1$2]$3[/share]",$Text); + // Convert new line chars to html
    tags // nlbr seems to be hopelessly messed up @@ -271,7 +330,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) { // Perform URL Search - $Text = preg_replace("/([^\]\=]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1$2', $Text); + $Text = preg_replace("/([^\]\='".'"'."]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1$2', $Text); if ($tryoembed) $Text = preg_replace_callback("/\[bookmark\=([^\]]*)\].*?\[\/bookmark\]/ism",'tryoembed',$Text); @@ -422,7 +481,8 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) { // [img]pathtoimage[/img] $Text = preg_replace("/\[img\](.*?)\[\/img\]/ism", '' . t('Image/photo') . '', $Text); - + // Shared content + $Text = preg_replace_callback("/\[share(.*?)\](.*?)\[\/share\]/ism","bb_ShareAttributes",$Text); $Text = preg_replace("/\[crypt\](.*?)\[\/crypt\]/ism",'
    ' . t('Encrypted content') . '
    ', $Text); $Text = preg_replace("/\[crypt=(.*?)\](.*?)\[\/crypt\]/ism",'
    ' . t('Encrypted content') . '
    ', $Text); diff --git a/include/onepoll.php b/include/onepoll.php index a50d234e2..68d7873ec 100644 --- a/include/onepoll.php +++ b/include/onepoll.php @@ -2,6 +2,13 @@ require_once("boot.php"); +function RemoveReply($subject) { + while (in_array(strtolower(substr($subject, 0, 3)), array("re:", "aw:"))) + $subject = trim(substr($subject, 4)); + + return($subject); +} + function onepoll_run(&$argv, &$argc){ global $a, $db; @@ -367,10 +374,6 @@ function onepoll_run(&$argv, &$argc){ // $datarray['parent-uri'] = $r[0]['uri']; } - - if(! x($datarray,'parent-uri')) - $datarray['parent-uri'] = $datarray['uri']; - // Decoding the header $subject = imap_mime_header_decode($meta->subject); $datarray['title'] = ""; @@ -385,11 +388,26 @@ function onepoll_run(&$argv, &$argc){ //$datarray['title'] = notags(trim($meta->subject)); $datarray['created'] = datetime_convert('UTC','UTC',$meta->date); - // Is it reply? + // Is it a reply? $reply = ((substr(strtolower($datarray['title']), 0, 3) == "re:") or (substr(strtolower($datarray['title']), 0, 3) == "re-") or (raw_refs != "")); + // Remove Reply-signs in the subject + $datarray['title'] = RemoveReply($datarray['title']); + + // If it seems to be a reply but a header couldn't be found take the last message with matching subject + if(!x($datarray,'parent-uri') and $reply) { + $r = q("SELECT `uri` , `parent-uri` FROM `item` WHERE MATCH (`title`) AGAINST ('".'"%s"'."' IN BOOLEAN MODE) ORDER BY `created` DESC LIMIT 1", + besc(protect_sprintf($datarray['title']))); + if(count($r)) + $datarray['parent-uri'] = $r[0]['parent-uri']; + } + + if(! x($datarray,'parent-uri')) + $datarray['parent-uri'] = $datarray['uri']; + + $r = email_get_msg($mbox,$msg_uid, $reply); if(! $r) { logger("Mail: can't fetch msg ".$msg_uid." for ".$mailconf[0]['user']); diff --git a/view/theme/vier/style.css b/view/theme/vier/style.css index f41b70bbb..6a0cbb285 100644 --- a/view/theme/vier/style.css +++ b/view/theme/vier/style.css @@ -313,6 +313,27 @@ cursor: url('lock.cur'), pointer; } +.shared_header { + height: 32px; + color: #999; + border-top: 1px solid #D2D2D2; + padding-top: 16px; + margin-top: 16px; +} + +.shared_header img { + float: left; +} + +.shared_header span { + margin-left: 9px; +} + +blockquote.shared_content { + margin-left: 32px; + color: #000; + border: none; +} #contact-edit-links ul { list-style: none; @@ -793,7 +814,7 @@ aside { padding: 0px 10px 0px 20px; border-right: 1px solid #D2D2D2; background-color: #ECECF2; - font-size: 13px; + font-size: 14px; /* background: #F1F1F1; */ } aside .vcard .fn { From 4164257cb256e78aeb371439d224b15a17b3622e Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 17 Dec 2012 21:12:11 +0100 Subject: [PATCH 5/7] vier: The alt-pager and the birthday- and eventreminder is optically improved --- include/text.php | 4 ++-- view/theme/vier/style.css | 44 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/include/text.php b/include/text.php index a32641241..7d26d3550 100644 --- a/include/text.php +++ b/include/text.php @@ -292,11 +292,11 @@ function alt_pager(&$a, $i) { $o .= '
    '; if($a->pager['page']>1) - $o .= "pager['page'] - 1).'">' . t('newer') . ''; + $o .= "pager['page'] - 1).'" class="pager_newer">' . t('newer') . ''; if($i>0) { if($a->pager['page']>1) $o .= " - "; - $o .= "pager['page'] + 1).'">' . t('older') . ''; + $o .= "pager['page'] + 1).'" class="pager_older">' . t('older') . ''; } diff --git a/view/theme/vier/style.css b/view/theme/vier/style.css index 6a0cbb285..d6acade69 100644 --- a/view/theme/vier/style.css +++ b/view/theme/vier/style.css @@ -313,6 +313,45 @@ cursor: url('lock.cur'), pointer; } + +div.pager, .birthday-notice { + text-align: center; + height: 1.2em; + padding-bottom: 12px; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; + background-color: #f2f2f2; + clear: left; + margin-top: 15px; + padding: 1%; + height: 1em; + margin-bottom: 15px; +} + +.birthday-notice { + margin-top: 5px; + margin-bottom: 5px; +} + +#live-network { +/* border-bottom: 1px solid #BDCDD4; */ + border-bottom: 1px solid #D2D2D2; + width: 100%; + height: 10px; +} + +.pager a { +} + +.pager a.pager_older { + float: right; +} + +.pager a.pager_newer { + float: left; +} + .shared_header { height: 32px; color: #999; @@ -1008,7 +1047,8 @@ section { } /* wall item */ .tread-wrapper { - border-bottom: 1px solid #D2D2D2; +/* border-bottom: 1px solid #BDCDD4; */ +border-bottom: 1px solid #D2D2D2; position: relative; padding: 5px; margin-bottom: 0px; @@ -1869,7 +1909,7 @@ ul.tabs li .active, ul.tabs a:hover { /* page footer */ footer { - height: 100px; + /* height: 100px; */ display: table-row; } From fc816feb6d1b04e19dbcbab14c6bc590871f2b64 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 17 Dec 2012 21:39:52 +0100 Subject: [PATCH 6/7] mailimport: Bug that prevented mails to be imported --- include/onepoll.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/onepoll.php b/include/onepoll.php index 10707ea96..1e11f2ca1 100644 --- a/include/onepoll.php +++ b/include/onepoll.php @@ -406,7 +406,7 @@ function onepoll_run(&$argv, &$argc){ // If it seems to be a reply but a header couldn't be found take the last message with matching subject if(!x($datarray,'parent-uri') and $reply) { $r = q("SELECT `uri` , `parent-uri` FROM `item` WHERE MATCH (`title`) AGAINST ('".'"%s"'."' IN BOOLEAN MODE) ORDER BY `created` DESC LIMIT 1", - besc(protect_sprintf($datarray['title']))); + dbesc(protect_sprintf($datarray['title']))); if(count($r)) $datarray['parent-uri'] = $r[0]['parent-uri']; } From 9ab34f885793a7962f3269d8255198a4f209b518 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Tue, 18 Dec 2012 00:47:55 +0100 Subject: [PATCH 7/7] mail: "reply-to" now triggers the "sender"-header instead of the "reply-to"-header. --- include/delivery.php | 14 +++++++++----- include/notifier.php | 11 +++++++---- mod/settings.php | 3 ++- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/include/delivery.php b/include/delivery.php index 428035973..c56d7d288 100644 --- a/include/delivery.php +++ b/include/delivery.php @@ -458,13 +458,17 @@ function delivery_run(&$argv, &$argc){ // only expose our real email address to true friends - if(($contact['rel'] == CONTACT_IS_FRIEND) && (! $contact['blocked'])) - $headers = 'From: ' . email_header_encode($local_user[0]['username'],'UTF-8') . ' <' . $local_user[0]['email'] . '>' . "\n"; - else + if(($contact['rel'] == CONTACT_IS_FRIEND) && (! $contact['blocked'])) { + if($reply_to) { + $headers = 'From: '.email_header_encode($local_user[0]['username'],'UTF-8').' <'.$reply_to.'>'."\n"; + $headers .= 'Sender: '.$local_user[0]['email']."\n"; + } else + $headers = 'From: '.email_header_encode($local_user[0]['username'],'UTF-8').' <'.$local_user[0]['email'].'>'."\n"; + } else $headers = 'From: ' . email_header_encode($local_user[0]['username'],'UTF-8') . ' <' . t('noreply') . '@' . $a->get_hostname() . '>' . "\n"; - if($reply_to) - $headers .= 'Reply-to: ' . $reply_to . "\n"; + //if($reply_to) + // $headers .= 'Reply-to: ' . $reply_to . "\n"; // for testing purposes: Collect exported mails // $file = tempnam("/tmp/friendica/", "mail-out-"); diff --git a/include/notifier.php b/include/notifier.php index 3398254b6..b685e1b99 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -771,14 +771,17 @@ function notifier_run(&$argv, &$argc){ $subject = (($it['title']) ? email_header_encode($it['title'],'UTF-8') : t("\x28no subject\x29")) ; // only expose our real email address to true friends - if(($contact['rel'] == CONTACT_IS_FRIEND) && (! $contact['blocked'])) - $headers = 'From: ' . email_header_encode($local_user[0]['username'],'UTF-8') . ' <' . $local_user[0]['email'] . '>' . "\n"; + if($reply_to) { + $headers = 'From: ' . email_header_encode($local_user[0]['username'],'UTF-8') . ' <' . $reply_to . '>' . "\n"; + $headers .= 'Sender: '.$local_user[0]['email']."\n"; + } else + $headers = 'From: ' . email_header_encode($local_user[0]['username'],'UTF-8') . ' <' . $local_user[0]['email'] . '>' . "\n"; else $headers = 'From: ' . email_header_encode($local_user[0]['username'],'UTF-8') . ' <' . t('noreply') . '@' . $a->get_hostname() . '>' . "\n"; - if($reply_to) - $headers .= 'Reply-to: ' . $reply_to . "\n"; + //if($reply_to) + // $headers .= 'Reply-to: ' . $reply_to . "\n"; // for testing purposes: Collect exported mails //$file = tempnam("/tmp/friendica/", "mail-out2-"); diff --git a/mod/settings.php b/mod/settings.php index 1e464de18..7cfdbb1cd 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -209,6 +209,7 @@ function settings_post(&$a) { intval($mail_pubmail), intval(local_user()) ); + logger("mail: updating mailaccount. Response: ".print_r($r, true)); $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1", intval(local_user()) ); @@ -731,7 +732,7 @@ function settings_content(&$a) { '$mail_ssl' => array('mail_ssl', t('Security:'), strtoupper($mail_ssl), '', array( 'notls'=>t('None'), 'TLS'=>'TLS', 'SSL'=>'SSL')), '$mail_user' => array('mail_user', t('Email login name:'), $mail_user, ''), '$mail_pass' => array('mail_pass', t('Email password:'), '', ''), - '$mail_replyto' => array('mail_replyto', t('Reply-to address:'), '', 'Optional'), + '$mail_replyto' => array('mail_replyto', t('Reply-to address:'), $mail_replyto, 'Optional'), '$mail_pubmail' => array('mail_pubmail', t('Send public posts to all email contacts:'), $mail_pubmail, ''), '$mail_action' => array('mail_action', t('Action after import:'), $mail_action, '', array(0=>t('None'), /*1=>t('Delete'),*/ 2=>t('Mark as seen'), 3=>t('Move to folder'))), '$mail_movetofolder' => array('mail_movetofolder', t('Move to folder:'), $mail_movetofolder, ''),