aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorFabio Comuni <fabrix.xm@gmail.com>2011-04-18 16:58:20 +0200
committerFabio Comuni <fabrix.xm@gmail.com>2011-04-18 16:58:20 +0200
commitee1641393550eea9200f792707070e024879d466 (patch)
treeee9e19d380cdf4fee74d4b7c1fa323098c72b93b /mod
parent62dbfffe399333cd4a792cc77256a2bcd689a14f (diff)
parent741a262f1b2d5c8f911896da32e80d543afb5cd1 (diff)
downloadvolse-hubzilla-ee1641393550eea9200f792707070e024879d466.tar.gz
volse-hubzilla-ee1641393550eea9200f792707070e024879d466.tar.bz2
volse-hubzilla-ee1641393550eea9200f792707070e024879d466.zip
Merge remote-tracking branch 'friendika-master/master'
Diffstat (limited to 'mod')
-rw-r--r--mod/contacts.php2
-rw-r--r--mod/dfrn_confirm.php6
-rw-r--r--mod/dfrn_notify.php12
-rw-r--r--mod/dfrn_request.php10
-rw-r--r--mod/editpost.php22
-rw-r--r--mod/follow.php218
-rw-r--r--mod/help.php8
-rw-r--r--mod/invite.php6
-rw-r--r--mod/item.php28
-rw-r--r--mod/lostpass.php11
-rw-r--r--mod/network.php22
-rw-r--r--mod/profile.php20
-rw-r--r--mod/register.php11
-rw-r--r--mod/regmod.php5
-rw-r--r--mod/settings.php69
15 files changed, 237 insertions, 213 deletions
diff --git a/mod/contacts.php b/mod/contacts.php
index ee7177d48..18eedbe9b 100644
--- a/mod/contacts.php
+++ b/mod/contacts.php
@@ -284,7 +284,7 @@ function contacts_content(&$a) {
'$contact_id' => $r[0]['id'],
'$block_text' => (($r[0]['blocked']) ? t('Unblock this contact') : t('Block this contact') ),
'$ignore_text' => (($r[0]['readonly']) ? t('Unignore this contact') : t('Ignore this contact') ),
- '$insecure' => (($r[0]['network'] !== 'dfrn') ? $insecure : ''),
+ '$insecure' => (($r[0]['network'] !== NETWORK_DFRN && $r[0]['network'] !== NETWORK_MAIL) ? $insecure : ''),
'$info' => $r[0]['info'],
'$blocked' => (($r[0]['blocked']) ? '<div id="block-message">' . t('Currently blocked') . '</div>' : ''),
'$ignored' => (($r[0]['readonly']) ? '<div id="ignore-message">' . t('Currently ignored') . '</div>' : ''),
diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php
index 02437ec36..58473146d 100644
--- a/mod/dfrn_confirm.php
+++ b/mod/dfrn_confirm.php
@@ -651,7 +651,11 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
);
$res = mail($r[0]['email'], sprintf( t("Connection accepted at %s") , $a->config['sitename']),
- $email_tpl, 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] );
+ $email_tpl,
+ 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
+ . 'Content-type: text/plain; charset=UTF-8' . "\n"
+ . 'Content-transfer-encoding: 8bit' );
+
if(!$res) {
// pointless throwing an error here and confusing the person at the other end of the wire.
}
diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php
index f6f68d348..eb9d71fe3 100644
--- a/mod/dfrn_notify.php
+++ b/mod/dfrn_notify.php
@@ -401,7 +401,11 @@ function dfrn_notify_post(&$a) {
));
$res = mail($importer['email'], sprintf(t('%s commented on an item at %s'), $from , $a->config['sitename']),
- $email_tpl, "From: " . t('Administrator') . '@' . $a->get_hostname() );
+ $email_tpl,
+ 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
+ . 'Content-type: text/plain; charset=UTF-8' . "\n"
+ . 'Content-transfer-encoding: 8bit' );
+
}
}
xml_status(0);
@@ -487,7 +491,11 @@ function dfrn_notify_post(&$a) {
));
$res = mail($importer['email'], sprintf( t("%s commented on an item at %s") , $from ,$a->config['sitename']),
- $email_tpl, "From: ".t("Administrator") . "@". $a->get_hostname() );
+ $email_tpl,
+ 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
+ . 'Content-type: text/plain; charset=UTF-8' . "\n"
+ . 'Content-transfer-encoding: 8bit' );
+
break;
}
}
diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php
index 11b7438a7..4463c713f 100644
--- a/mod/dfrn_request.php
+++ b/mod/dfrn_request.php
@@ -544,7 +544,10 @@ function dfrn_request_content(&$a) {
$res = mail($r[0]['email'],
t("Introduction received at ") . $a->config['sitename'],
$email,
- 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] );
+ 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
+ . 'Content-type: text/plain; charset=UTF-8' . "\n"
+ . 'Content-transfer-encoding: 8bit' );
+
// This is a redundant notification - no point throwing errors if it fails.
}
if($auto_confirm) {
@@ -615,17 +618,18 @@ function dfrn_request_content(&$a) {
$o .= replace_macros($tpl,array(
'$header' => t('Friend/Connection Request'),
+ '$desc' => t('Examples: jojo@demo.friendika.com, http://demo.friendika.com/profile/jojo, testuser@identi.ca'),
'$pls_answer' => t('Please answer the following:'),
'$does_know' => t('Does $name know you?'),
'$yes' => t('Yes'),
'$no' => t('No'),
'$add_note' => t('Add a personal note:'),
- '$page_desc' => t('Please enter your profile address from one of the following supported social networks:'),
+ '$page_desc' => t("Please enter your 'Identity Address' from one of the following supported social networks:"),
'$friendika' => t('Friendika'),
'$statusnet' => t('StatusNet/Federated Social Web'),
'$private_net' => t("Private \x28secure\x29 network"),
'$public_net' => t("Public \x28insecure\x29 network"),
- '$your_address' => t('Your profile address:'),
+ '$your_address' => t('Your Identity Address:'),
'$submit' => t('Submit Request'),
'$cancel' => t('Cancel'),
'$nickname' => $a->argv[1],
diff --git a/mod/editpost.php b/mod/editpost.php
index 862ba937f..7a102119b 100644
--- a/mod/editpost.php
+++ b/mod/editpost.php
@@ -51,6 +51,28 @@ function editpost_content(&$a) {
$jotplugins = '';
$jotnets = '';
+
+ $mail_enabled = false;
+ $pubmail_enabled = false;
+
+
+ $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
+ intval(local_user())
+ );
+ if(count($r)) {
+ $mail_enabled = true;
+ if(intval($r[0]['pubmail']))
+ $pubmail_enabled = true;
+ }
+
+ if($mail_enabled) {
+ $selected = (($pubmail_enabled) ? ' checked="checked" ' : '');
+ $jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . 'value="1" /> '
+ . t("Post to Email") . '</div>';
+ }
+
+
+
call_hooks('jot_tool', $jotplugins);
call_hooks('jot_networks', $jotnets);
diff --git a/mod/follow.php b/mod/follow.php
index 04858ce52..23fad81a8 100644
--- a/mod/follow.php
+++ b/mod/follow.php
@@ -11,200 +11,45 @@ function follow_post(&$a) {
}
$url = $orig_url = notags(trim($_POST['url']));
- $diaspora = false;
- $email_conversant = false;
- if($url) {
- $links = lrdd($url);
+ $ret = probe_url($url);
- if(count($links)) {
- foreach($links as $link) {
- if($link['@attributes']['rel'] === NAMESPACE_DFRN)
- $dfrn = unamp($link['@attributes']['href']);
- if($link['@attributes']['rel'] === 'salmon')
- $notify = unamp($link['@attributes']['href']);
- if($link['@attributes']['rel'] === NAMESPACE_FEED)
- $poll = unamp($link['@attributes']['href']);
- if($link['@attributes']['rel'] === 'http://microformats.org/profile/hcard')
- $hcard = unamp($link['@attributes']['href']);
- if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page')
- $profile = unamp($link['@attributes']['href']);
- if($link['@attributes']['rel'] === 'http://joindiaspora.com/seed_location')
- $diaspora = true;
-
- }
-
- // Status.Net can have more than one profile URL. We need to match the profile URL
- // to a contact on incoming messages to prevent spam, and we won't know which one
- // to match. So in case of two, one of them is stored as an alias. Only store URL's
- // and not webfinger user@host aliases. If they've got more than two non-email style
- // aliases, let's hope we're lucky and get one that matches the feed author-uri because
- // otherwise we're screwed.
-
- foreach($links as $link) {
- if($link['@attributes']['rel'] === 'alias') {
- if(strpos($link['@attributes']['href'],'@') === false) {
- if(isset($profile)) {
- if($link['@attributes']['href'] !== $profile)
- $alias = unamp($link['@attributes']['href']);
- }
- else
- $profile = unamp($link['@attributes']['href']);
- }
- }
- }
- }
- else {
- if((strpos($orig_url,'@')) && validate_email($orig_url)) {
- $email_conversant = true;
- }
- }
- }
-
- // If we find a DFRN site, send our subscriber to the other person's
- // dfrn_request page and all the other details will get sorted.
-
- if(strlen($dfrn)) {
- $ret = scrape_dfrn($dfrn);
- if(is_array($ret) && x($ret,'dfrn-request')) {
- if(strlen($a->path))
- $myaddr = bin2hex($a->get_baseurl() . '/profile/' . $a->user['nickname']);
- else
- $myaddr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname());
+ if($ret['network'] === NETWORK_DFRN) {
+ if(strlen($a->path))
+ $myaddr = bin2hex($a->get_baseurl() . '/profile/' . $a->user['nickname']);
+ else
+ $myaddr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname());
- goaway($ret['dfrn-request'] . "&addr=$myaddr");
-
- // NOTREACHED
- }
- }
-
- $network = 'stat';
- $priority = 0;
-
- if($hcard) {
- $vcard = scrape_vcard($hcard);
-
- // Google doesn't use absolute url in profile photos
-
- if((x($vcard,'photo')) && substr($vcard['photo'],0,1) == '/') {
- $h = @parse_url($hcard);
- if($h)
- $vcard['photo'] = $h['scheme'] . '://' . $h['host'] . $vcard['photo'];
- }
+ goaway($ret['request'] . "&addr=$myaddr");
- logger('mod_follow: scrape_vcard: ' . print_r($vcard,true), LOGGER_DATA);
- }
-
- if(! $profile) {
- if($diaspora)
- $profile = $hcard;
- else
- $profile = $url;
- }
-
- if(! x($vcard,'fn'))
- if(x($vcard,'nick'))
- $vcard['fn'] = $vcard['nick'];
-
- if((! isset($vcard)) && (! $poll)) {
-
- $ret = scrape_feed($url);
- logger('mod_follow: scrape_feed returns: ' . print_r($ret,true), LOGGER_DATA);
- if(count($ret) && ($ret['feed_atom'] || $ret['feed_rss'])) {
- $poll = ((x($ret,'feed_atom')) ? unamp($ret['feed_atom']) : unamp($ret['feed_rss']));
- $vcard = array();
- if(x($ret,'photo'))
- $vcard['photo'] = $ret['photo'];
- require_once('simplepie/simplepie.inc');
- $feed = new SimplePie();
- $xml = fetch_url($poll);
-
- $feed->set_raw_data($xml);
-
- $feed->init();
-
- if(! x($vcard,'photo'))
- $vcard['photo'] = $feed->get_image_url();
- $author = $feed->get_author();
- if($author) {
- $vcard['fn'] = unxmlify(trim($author->get_name()));
- if(! $vcard['fn'])
- $vcard['fn'] = trim(unxmlify($author->get_email()));
- if(strpos($vcard['fn'],'@') !== false)
- $vcard['fn'] = substr($vcard['fn'],0,strpos($vcard['fn'],'@'));
- $vcard['nick'] = strtolower(notags(unxmlify($vcard['fn'])));
- if(strpos($vcard['nick'],' '))
- $vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' ')));
- $email = unxmlify($author->get_email());
- }
- else {
- $item = $feed->get_item(0);
- if($item) {
- $author = $item->get_author();
- if($author) {
- $vcard['fn'] = trim(unxmlify($author->get_name()));
- if(! $vcard['fn'])
- $vcard['fn'] = trim(unxmlify($author->get_email()));
- if(strpos($vcard['fn'],'@') !== false)
- $vcard['fn'] = substr($vcard['fn'],0,strpos($vcard['fn'],'@'));
- $vcard['nick'] = strtolower(unxmlify($vcard['fn']));
- if(strpos($vcard['nick'],' '))
- $vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' ')));
- $email = unxmlify($author->get_email());
- }
- if(! $vcard['photo']) {
- $rawmedia = $item->get_item_tags('http://search.yahoo.com/mrss/','thumbnail');
- if($rawmedia && $rawmedia[0]['attribs']['']['url'])
- $vcard['photo'] = unxmlify($rawmedia[0]['attribs']['']['url']);
- }
- }
- }
- if((! $vcard['photo']) && strlen($email))
- $vcard['photo'] = gravatar_img($email);
- if($poll === $profile)
- $lnk = $feed->get_permalink();
- if(isset($lnk) && strlen($lnk))
- $profile = $lnk;
- if(! (x($vcard,'fn')))
- $vcard['fn'] = notags($feed->get_title());
- if(! (x($vcard,'fn')))
- $vcard['fn'] = notags($feed->get_description());
- $network = 'feed';
- $priority = 2;
- }
+ // NOTREACHED
}
- logger('follow: poll=' . $poll . ' notify=' . $notify . ' profile=' . $profile . ' vcard=' . print_r($vcard,true));
-
- $vcard['fn'] = notags($vcard['fn']);
- $vcard['nick'] = notags($vcard['nick']);
-
// do we have enough information?
- if(! ((x($vcard['fn'])) && ($poll) && ($profile))) {
+ if(! ((x($ret,'name')) && (x($ret,'poll')) && ((x($ret,'url')) || (x($ret,'addr'))))) {
notice( t('The profile address specified does not provide adequate information.') . EOL);
goaway($_SESSION['return_url']);
}
- if(! $notify) {
+ if(! $ret['notify']) {
notice( t('Limited profile. This person will be unable to receive direct/personal notifications from you.') . EOL);
}
- if(! x($vcard,'photo'))
- $vcard['photo'] = $a->get_baseurl() . '/images/default-profile.jpg' ;
-
-
- $writeable = ((($network === 'stat') && ($notify)) ? 1 : 0);
-
+ $writeable = ((($ret['network'] === NETWORK_OSTATUS) && ($ret['notify'])) ? 1 : 0);
+ if($ret['network'] === NETWORK_MAIL) {
+ $writeable = 1;
+
+ }
// check if we already have a contact
// the poll url is more reliable than the profile url, as we may have
// indirect links or webfinger links
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `poll` = '%s' LIMIT 1",
intval(local_user()),
- dbesc($poll)
+ dbesc($ret['poll'])
);
if(count($r)) {
@@ -219,27 +64,28 @@ function follow_post(&$a) {
}
else {
// create contact record
- $r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `alias`, `notify`, `poll`, `name`, `nick`, `photo`, `network`, `rel`, `priority`,
+ $r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `addr`, `alias`, `notify`, `poll`, `name`, `nick`, `photo`, `network`, `rel`, `priority`,
`writable`, `blocked`, `readonly`, `pending` )
- VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0 ) ",
+ VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0 ) ",
intval(local_user()),
dbesc(datetime_convert()),
- dbesc($profile),
- dbesc($alias),
- dbesc($notify),
- dbesc($poll),
- dbesc($vcard['fn']),
- dbesc($vcard['nick']),
- dbesc($vcard['photo']),
- dbesc($network),
- intval(REL_FAN),
- intval($priority),
- intval($writable)
+ dbesc($ret['url']),
+ dbesc($ret['addr']),
+ dbesc($ret['alias']),
+ dbesc($ret['notify']),
+ dbesc($ret['poll']),
+ dbesc($ret['name']),
+ dbesc($ret['nick']),
+ dbesc($ret['photo']),
+ dbesc($ret['network']),
+ intval(($ret['network'] === NETWORK_MAIL) ? REL_BUD : REL_FAN),
+ intval($ret['priority']),
+ intval($writeable)
);
}
$r = q("SELECT * FROM `contact` WHERE `url` = '%s' AND `uid` = %d LIMIT 1",
- dbesc($profile),
+ dbesc($ret['url']),
intval(local_user())
);
@@ -254,7 +100,7 @@ function follow_post(&$a) {
require_once("Photo.php");
- $photos = import_profile_photo($vcard['photo'],local_user(),$contact_id);
+ $photos = import_profile_photo($ret['photo'],local_user(),$contact_id);
$r = q("UPDATE `contact` SET `photo` = '%s',
`thumb` = '%s',
diff --git a/mod/help.php b/mod/help.php
index e07e4c5d9..561f5381f 100644
--- a/mod/help.php
+++ b/mod/help.php
@@ -22,12 +22,16 @@ function help_content(&$a) {
$text = '';
- if($a->argc > 1)
+ if($a->argc > 1) {
$text = load_doc_file('doc/' . $a->argv[1] . '.md');
-
+ $a->page['title'] = t('Help:') . ' ' . str_replace('-',' ',notags($a->argv[1]));
+ }
if(! $text) {
$text = load_doc_file('doc/Home.md');
+ $a->page['title'] = t('Help');
}
+
+
return Markdown($text);
} \ No newline at end of file
diff --git a/mod/invite.php b/mod/invite.php
index 84fa978ad..1c5119595 100644
--- a/mod/invite.php
+++ b/mod/invite.php
@@ -30,7 +30,11 @@ function invite_post(&$a) {
}
$res = mail($recip, sprintf(t('Please join my network on %s'), $a->config['sitename']),
- $message, "From: " . $a->user['email']);
+ $message,
+ "From: " . $a->user['email'] . "\n"
+ . 'Content-type: text/plain; charset=UTF-8' . "\n"
+ . 'Content-transfer-encoding: 8bit' );
+
if($res) {
$total ++;
}
diff --git a/mod/item.php b/mod/item.php
index 5cefb3be3..e53cfb033 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -96,6 +96,7 @@ function item_post(&$a) {
$body = escape_tags(trim($_POST['body']));
$private = $orig_post['private'];
+ $pubmail_enable = $orig_post['pubmail'];
}
else {
$str_group_allow = perms2str($_POST['group_allow']);
@@ -121,6 +122,7 @@ function item_post(&$a) {
$private = 1;
}
+ $pubmail_enable = ((x($_POST,'pubmail_enable') && intval($_POST['pubmail_enable']) && (! $private)) ? 1 : 0);
if(! strlen($body)) {
notice( t('Empty post discarded.') . EOL );
@@ -362,6 +364,7 @@ function item_post(&$a) {
$datarray['deny_cid'] = $str_contact_deny;
$datarray['deny_gid'] = $str_group_deny;
$datarray['private'] = $private;
+ $datarray['pubmail'] = $pubmail_enable;
/**
* These fields are for the convenience of plugins...
@@ -399,8 +402,8 @@ function item_post(&$a) {
$r = q("INSERT INTO `item` (`uid`,`type`,`wall`,`gravity`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`,
`author-name`, `author-link`, `author-avatar`, `created`, `edited`, `changed`, `uri`, `title`, `body`, `location`, `coord`,
- `tag`, `inform`, `verb`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private` )
- VALUES( %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d )",
+ `tag`, `inform`, `verb`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail` )
+ VALUES( %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d )",
intval($datarray['uid']),
dbesc($datarray['type']),
intval($datarray['wall']),
@@ -427,7 +430,8 @@ function item_post(&$a) {
dbesc($datarray['allow_gid']),
dbesc($datarray['deny_cid']),
dbesc($datarray['deny_gid']),
- intval($datarray['private'])
+ intval($datarray['private']),
+ intval($datarray['pubmail'])
);
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
@@ -472,7 +476,10 @@ function item_post(&$a) {
));
$res = mail($user['email'], sprintf( t("%s commented on your item at %s") ,$from,$a->config['sitename']),
- $email_tpl,"From: " . t("Administrator") . "@" . $a->get_hostname() );
+ $email_tpl,
+ 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
+ . 'Content-type: text/plain; charset=UTF-8' . "\n"
+ . 'Content-transfer-encoding: 8bit' );
}
}
else {
@@ -495,7 +502,11 @@ function item_post(&$a) {
));
$res = mail($user['email'], sprintf( t("%s posted on your profile wall at %s") ,$from, $a->config['sitename']),
- $email_tpl,"From: " . t("Administrator") . "@" . $a->get_hostname() );
+ $email_tpl,
+ 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
+ . 'Content-type: text/plain; charset=UTF-8' . "\n"
+ . 'Content-transfer-encoding: 8bit' );
+
}
}
@@ -538,11 +549,10 @@ function item_post(&$a) {
$addr = trim($recip);
if(! strlen($addr))
continue;
- $disclaimer = '<hr />' . sprintf(t('This message was sent to you by %s, a member of the Friendika social network.'),$a->user['username'])
+ $disclaimer = '<hr />' . sprintf( t('This message was sent to you by %s, a member of the Friendika social network.'),$a->user['username'])
. '<br />';
- $disclaimer .= t('You may visit them online at') . ' '
- . $a->get_baseurl() . '/profile/' . $a->user['nickname'] . '<br />';
- $disclaimer .= t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . '<br />';
+ $disclaimer .= sprintf( t('You may visit them online at %s'), $a->get_baseurl() . '/profile/' . $a->user['nickname']) . EOL;
+ $disclaimer .= t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL;
$subject = '[Friendika]' . ' ' . sprintf( t('%s posted an update.'),$a->user['username']);
$headers = 'From: ' . $a->user['username'] . ' <' . $a->user['email'] . '>' . "\n";
diff --git a/mod/lostpass.php b/mod/lostpass.php
index c46a57e6a..8d1cf7629 100644
--- a/mod/lostpass.php
+++ b/mod/lostpass.php
@@ -36,7 +36,11 @@ function lostpass_post(&$a) {
));
$res = mail($email, sprintf( t('Password reset requested at %s'),$a->config['sitename']),
- $email_tpl, 'From: ' . t('Administrator') . '@' . $_SERVER[SERVER_NAME]);
+ $email_tpl,
+ 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
+ . 'Content-type: text/plain; charset=UTF-8' . "\n"
+ . 'Content-transfer-encoding: 8bit' );
+
goaway($a->get_baseurl());
}
@@ -94,7 +98,10 @@ function lostpass_content(&$a) {
'$new_password' => $new_password,
'$uid' => $newuid ));
- $res = mail($email,"Your password has changed at {$a->config['sitename']}",$email_tpl,"From: Administrator@{$_SERVER[SERVER_NAME]}");
+ $res = mail($email,"Your password has changed at {$a->config['sitename']}",$email_tpl,
+ 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
+ . 'Content-type: text/plain; charset=UTF-8' . "\n"
+ . 'Content-transfer-encoding: 8bit' );
return $o;
}
diff --git a/mod/network.php b/mod/network.php
index f0a071cbf..746206031 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -94,6 +94,28 @@ function network_content(&$a, $update = 0) {
$jotplugins = '';
$jotnets = '';
+
+
+ $mail_enabled = false;
+ $pubmail_enabled = false;
+
+
+ $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
+ intval(local_user())
+ );
+ if(count($r)) {
+ $mail_enabled = true;
+ if(intval($r[0]['pubmail']))
+ $pubmail_enabled = true;
+ }
+
+ if($mail_enabled) {
+ $selected = (($pubmail_enabled) ? ' checked="checked" ' : '');
+ $jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . 'value="1" /> '
+ . t("Post to Email") . '</div>';
+ }
+
+
call_hooks('jot_tool', $jotplugins);
call_hooks('jot_networks', $jotnets);
diff --git a/mod/profile.php b/mod/profile.php
index 923f4fb90..fa2c261df 100644
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -147,6 +147,26 @@ function profile_content(&$a, $update = 0) {
$jotplugins = '';
$jotnets = '';
+
+ $mail_enabled = false;
+ $pubmail_enabled = false;
+
+ if($is_owner) {
+ $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
+ intval(local_user())
+ );
+ if(count($r)) {
+ $mail_enabled = true;
+ if(intval($r[0]['pubmail']))
+ $pubmail_enabled = true;
+ }
+ }
+ if($mail_enabled) {
+ $selected = (($pubmail_enabled) ? ' checked="checked" ' : '');
+ $jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . 'value="1" /> '
+ . t("Post to Email") . '</div>';
+ }
+
call_hooks('jot_tool', $jotplugins);
call_hooks('jot_networks', $jotnets);
diff --git a/mod/register.php b/mod/register.php
index 5fe7c0c6d..83e9e2891 100644
--- a/mod/register.php
+++ b/mod/register.php
@@ -329,7 +329,10 @@ function register_post(&$a) {
'$uid' => $newuid ));
$res = mail($email, sprintf(t('Registration details for %s'), $a->config['sitename']),
- $email_tpl, 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME']);
+ $email_tpl,
+ 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
+ . 'Content-type: text/plain; charset=UTF-8' . "\n"
+ . 'Content-transfer-encoding: 8bit' );
if($res) {
@@ -366,8 +369,10 @@ function register_post(&$a) {
));
$res = mail($a->config['admin_email'], sprintf(t('Registration request at %s'), $a->config['sitename']),
- $email_tpl,'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME']);
-
+ $email_tpl,
+ 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
+ . 'Content-type: text/plain; charset=UTF-8' . "\n"
+ . 'Content-transfer-encoding: 8bit' );
if($res) {
notice( t('Your registration is pending approval by the site owner.') . EOL ) ;
goaway($a->get_baseurl());
diff --git a/mod/regmod.php b/mod/regmod.php
index 2cbe810bc..b985ee364 100644
--- a/mod/regmod.php
+++ b/mod/regmod.php
@@ -90,7 +90,10 @@ function regmod_content(&$a) {
));
$res = mail($user[0]['email'], sprintf(t('Registration details for %s'), $a->config['sitename']),
- $email_tpl,'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] );
+ $email_tpl,
+ 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
+ . 'Content-type: text/plain; charset=UTF-8' . "\n"
+ . 'Content-transfer-encoding: 8bit' );
if($res) {
notice( t('Account approved.') . EOL );
diff --git a/mod/settings.php b/mod/settings.php
index 42529ae23..8b7e3c5d6 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -73,6 +73,41 @@ function settings_post(&$a) {
$page_flags = (((x($_POST,'page-flags')) && (intval($_POST['page-flags']))) ? intval($_POST['page-flags']) : 0);
$blockwall = (((x($_POST,'blockwall')) && (intval($_POST['blockwall']) == 1)) ? 0: 1); // this setting is inverted!
+ $mail_server = ((x($_POST,'mail_server')) ? $_POST['mail_server'] : '');
+ $mail_port = ((x($_POST,'mail_port')) ? $_POST['mail_port'] : '');
+ $mail_ssl = ((x($_POST,'mail_ssl')) ? strtolower(trim($_POST['mail_ssl'])) : '');
+ $mail_user = ((x($_POST,'mail_user')) ? $_POST['mail_user'] : '');
+ $mail_pass = ((x($_POST,'mail_pass')) ? trim($_POST['mail_pass']) : '');
+ $mail_replyto = ((x($_POST,'mail_replyto')) ? $_POST['mail_replyto'] : '');
+ $mail_pubmail = ((x($_POST,'mail_pubmail')) ? $_POST['mail_pubmail'] : '');
+
+ $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
+ intval(local_user())
+ );
+ if(! count($r)) {
+ q("INSERT INTO `mailacct` (`uid`) VALUES (%d)",
+ intval(local_user())
+ );
+ }
+ if(strlen($mail_pass)) {
+ $pass = '';
+ openssl(private_encrypt($mail_pass,$pass,$a->user['pubkey']));
+ q("UPDATE `mailacct` SET `pass` = '%s' WHERE `uid` = %d LIMIT 1",
+ dbesc(hex2bin($pass)),
+ intval(local_user())
+ );
+ }
+ $r = q("UPDATE `mailacct` SET `server` = '%s', `port` = %d, `ssltype` = '%s', `user` = '%s',
+ `mailbox` = 'INBOX', `reply_to` = '%s', `pubmail` = %d WHERE `uid` = %d LIMIT 1",
+ dbesc($mail_server),
+ intval($mail_port),
+ dbesc($mail_ssl),
+ dbesc($mail_user),
+ dbesc($mail_replyto),
+ intval($mail_pubmail),
+ intval(local_user())
+ );
+
$notify = 0;
if(x($_POST,'notify1'))
@@ -249,6 +284,19 @@ function settings_content(&$a) {
if(! strlen($a->user['timezone']))
$timezone = date_default_timezone_get();
+
+ $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
+ local_user()
+ );
+
+ $mail_server = ((count($r)) ? $r[0]['server'] : '');
+ $mail_port = ((count($r)) ? $r[0]['port'] : '');
+ $mail_ssl = ((count($r)) ? $r[0]['ssltype'] : '');
+ $mail_user = ((count($r)) ? $r[0]['user'] : '');
+ $mail_replyto = ((count($r)) ? $r[0]['reply_to'] : '');
+ $mail_pubmail = ((count($r)) ? $r[0]['pubmail'] : 0);
+
+
$pageset_tpl = load_view_file('view/pagetypes.tpl');
$pagetype = replace_macros($pageset_tpl,array(
'$normal' => (($a->user['page-flags'] == PAGE_NORMAL) ? " checked=\"checked\" " : ""),
@@ -331,6 +379,7 @@ function settings_content(&$a) {
$theme_selector .= '<option val="' . basename($file) . '"' . $selected . '>' . basename($file) . '</option>';
}
}
+
$theme_selector .= '</select>';
$subdir = ((strlen($a->get_path())) ? '<br />' . t('or') . ' ' . $a->get_baseurl() . '/profile/' . $nickname : '');
@@ -338,7 +387,7 @@ function settings_content(&$a) {
$tpl_addr = load_view_file("view/settings_nick_set.tpl");
$prof_addr = replace_macros($tpl_addr,array(
- '$desc' => t('Your profile address is'),
+ '$desc' => t('Your Identity Address is'),
'$nickname' => $nickname,
'$subdir' => $subdir,
'$basepath' => $a->get_hostname()
@@ -407,7 +456,23 @@ function settings_content(&$a) {
'$expire' => $expire,
'$blockw_checked' => (($blockwall) ? '' : ' checked="checked" ' ),
'$theme' => $theme_selector,
- '$pagetype' => $pagetype
+ '$pagetype' => $pagetype,
+ '$lbl_imap0' => t('Email/Mailbox Setup'),
+ '$imap_desc' => t("If you wish to communicate with email contacts using this service \x28optional\x29, please specify how to connect to your mailbox."),
+ '$lbl_imap1' => t('IMAP server name:'),
+ '$imap_server' => $mail_server,
+ '$lbl_imap2' => t('IMAP port:'),
+ '$imap_port' => $mail_port,
+ '$lbl_imap3' => t("Security \x28TLS or SSL\x29:"),
+ '$imap_ssl' => $mail_ssl,
+ '$lbl_imap4' => t('Email login name:'),
+ '$imap_user' => $mail_user,
+ '$lbl_imap5' => t('Email password:'),
+ '$lbl_imap6' => t("Reply-to address \x28Optional\x29:"),
+ '$imap_replyto' => $mail_replyto,
+ '$lbl_imap7' => t('Send public posts to all email contacts:'),
+ '$pubmail_checked' => (($mail_pubmail) ? ' checked="checked" ' : ''),
+
));
call_hooks('settings_form',$o);