diff options
-rwxr-xr-x | boot.php | 6 | ||||
-rwxr-xr-x | database.sql | 4 | ||||
-rwxr-xr-x | include/bb2diaspora.php | 13 | ||||
-rwxr-xr-x | include/delivery.php | 12 | ||||
-rwxr-xr-x | include/notifier.php | 6 | ||||
-rwxr-xr-x | include/poller.php | 4 | ||||
-rwxr-xr-x | mod/network.php | 36 | ||||
-rwxr-xr-x | mod/register.php | 4 | ||||
-rwxr-xr-x | update.php | 10 |
9 files changed, 67 insertions, 28 deletions
@@ -9,9 +9,9 @@ require_once('include/nav.php'); require_once('include/cache.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); -define ( 'FRIENDICA_VERSION', '2.3.1241' ); +define ( 'FRIENDICA_VERSION', '2.3.1242' ); define ( 'DFRN_PROTOCOL_VERSION', '2.22' ); -define ( 'DB_UPDATE_VERSION', 1118 ); +define ( 'DB_UPDATE_VERSION', 1119 ); define ( 'EOL', "<br />\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); @@ -101,10 +101,12 @@ define ( 'NETWORK_OSTATUS', 'stat'); // status.net, identi.ca, GNU-s define ( 'NETWORK_FEED', 'feed'); // RSS/Atom feeds with no known "post/notify" protocol define ( 'NETWORK_DIASPORA', 'dspr'); // Diaspora define ( 'NETWORK_MAIL', 'mail'); // IMAP/POP +define ( 'NETWORK_MAIL2', 'mai2'); // extended IMAP/POP define ( 'NETWORK_FACEBOOK', 'face'); // Facebook API define ( 'NETWORK_LINKEDIN', 'lnkd'); // LinkedIn define ( 'NETWORK_XMPP', 'xmpp'); // XMPP define ( 'NETWORK_MYSPACE', 'mysp'); // MySpace +define ( 'NETWORK_GPLUS', 'goog'); // Google+ /** * 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 9a2e5c8dd..8abaa5a93 100755 --- a/database.sql +++ b/database.sql @@ -96,6 +96,7 @@ CREATE TABLE IF NOT EXISTS `contact` ( `pending` tinyint(1) NOT NULL DEFAULT '1', `rating` tinyint(1) NOT NULL DEFAULT '0', `reason` text NOT NULL, + `closeness` tinyint(2) NOT NULL DEFAULT '99', `info` mediumtext NOT NULL, `profile-id` int(11) NOT NULL DEFAULT '0', `bdyear` CHAR( 4 ) NOT NULL COMMENT 'birthday notify flag', @@ -116,7 +117,8 @@ CREATE TABLE IF NOT EXISTS `contact` ( KEY `blocked` (`blocked`), KEY `readonly` (`readonly`), KEY `hidden` (`hidden`), - KEY `pending` (`pending`) + KEY `pending` (`pending`), + KEY `closeness` (`closeness`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -------------------------------------------------------- diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index d367b6716..9a29b05a2 100755 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -14,9 +14,17 @@ require_once('include/html2bbcode.php'); function diaspora2bb($s) { $s = html_entity_decode($s,ENT_COMPAT,'UTF-8'); + $s = str_replace("\r","\n",$s); $s = preg_replace('/\@\{(.+?)\; (.+?)\@(.+?)\}/','@[url=https://$3/u/$2]$1[/url]',$s); + + $s = preg_replace('/\#([^\s\#])/','\\#$1',$s); + $s = Markdown($s); + + $s = str_replace('#','#',$s); + $s = str_replace("\n",'<br />',$s); + $s = html2bbcode($s); // $s = str_replace('*','*',$s); @@ -30,11 +38,6 @@ function diaspora2bb($s) { $s = preg_replace("/(\[code\])+(.*?)(\[\/code\])+/ism","[code]$2[/code]", $s); $s = scale_diaspora_images($s); - // we seem to get a lot of text smushed together with links from Diaspora. - - $s = preg_replace('/[^ ]\[url\=(.*?)\]/',' [url=$1]' ,$s); - $s = preg_replace('/\[\/url\][^ ]/','[/url] ',$s); - return $s; } diff --git a/include/delivery.php b/include/delivery.php index c05358868..71ce30023 100755 --- a/include/delivery.php +++ b/include/delivery.php @@ -373,7 +373,8 @@ function delivery_run($argv, $argc){ break; case NETWORK_MAIL : - + case NETWORK_MAIL2: + if(get_config('system','dfrn_only')) break; // WARNING: does not currently convert to RFC2047 header encodings, etc. @@ -413,7 +414,14 @@ function delivery_run($argv, $argc){ $reply_to = $r1[0]['reply_to']; $subject = (($it['title']) ? $it['title'] : t("\x28no subject\x29")) ; - $headers = 'From: ' . $local_user[0]['username'] . ' <' . $local_user[0]['email'] . '>' . "\n"; + + // only expose our real email address to true friends + + if(($contact['rel'] == CONTACT_IS_FRIEND) && (! $contact['blocked'])) + $headers = 'From: ' . $local_user[0]['username'] . ' <' . $local_user[0]['email'] . '>' . "\n"; + else + $headers = 'From: ' . $local_user[0]['username'] . ' <' . t('noreply') . '@' . $a->get_hostname() . '>' . "\n"; + if($reply_to) $headers .= 'Reply-to: ' . $reply_to . "\n"; $headers .= 'Message-id: <' . $it['uri'] . '>' . "\n"; diff --git a/include/notifier.php b/include/notifier.php index ead7aebad..53178ce53 100755 --- a/include/notifier.php +++ b/include/notifier.php @@ -584,6 +584,7 @@ function notifier_run($argv, $argc){ break; case NETWORK_MAIL: + case NETWORK_MAIL2: if(get_config('system','dfrn_only')) break; @@ -629,7 +630,7 @@ function notifier_run($argv, $argc){ // only expose our real email address to true friends - if($contact['rel'] == CONTACT_IS_FRIEND) + if(($contact['rel'] == CONTACT_IS_FRIEND) && (! $contact['blocked'])) $headers = 'From: ' . $local_user[0]['username'] . ' <' . $local_user[0]['email'] . '>' . "\n"; else $headers = 'From: ' . $local_user[0]['username'] . ' <' . t('noreply') . '@' . $a->get_hostname() . '>' . "\n"; @@ -754,9 +755,10 @@ function notifier_run($argv, $argc){ ); $r2 = q("SELECT `id`, `name`,`network` FROM `contact` - WHERE `network` = '%s' AND `uid` = %d AND `blocked` = 0 AND `pending` = 0 + WHERE `network` in ( '%s', '%s') AND `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `rel` != %d order by rand() ", dbesc(NETWORK_DFRN), + dbesc(NETWORK_MAIL2), intval($owner['uid']), intval(CONTACT_IS_SHARING) ); diff --git a/include/poller.php b/include/poller.php index 89e4488b9..7d42c63b5 100755 --- a/include/poller.php +++ b/include/poller.php @@ -369,7 +369,7 @@ function poller_run($argv, $argc){ $xml = fetch_url($contact['poll']); } - elseif($contact['network'] === NETWORK_MAIL) { + elseif($contact['network'] === NETWORK_MAIL || $contact['network'] === NETWORK_MAIL2) { $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1); if($mail_disabled) @@ -462,7 +462,7 @@ function poller_run($argv, $argc){ $datarray['contact-id'] = $contact['id']; if($datarray['parent-uri'] === $datarray['uri']) $datarray['private'] = 1; - if(! get_pconfig($importer_uid,'system','allow_public_email_replies')) { + if(($contact['network'] === NETWORK_MAIL) && (! get_pconfig($importer_uid,'system','allow_public_email_replies'))) { $datarray['private'] = 1; $datarray['allow_cid'] = '<' . $contact['id'] . '>'; } diff --git a/mod/network.php b/mod/network.php index 271a1236d..497e8a115 100755 --- a/mod/network.php +++ b/mod/network.php @@ -113,6 +113,7 @@ function network_content(&$a, $update = 0) { $all_active = ''; $search_active = ''; $conv_active = ''; + $spam_active = ''; if(($a->argc > 1 && $a->argv[1] === 'new') || ($a->argc > 2 && $a->argv[2] === 'new')) { @@ -135,12 +136,17 @@ function network_content(&$a, $update = 0) { $conv_active = 'active'; } + if($_GET['spam']) { + $spam_active = 'active'; + } + if (($new_active == '') && ($starred_active == '') && ($bookmarked_active == '') && ($conv_active == '') - && ($search_active == '')) { + && ($search_active == '') + && ($spam_active == '')) { $all_active = 'active'; } @@ -151,9 +157,7 @@ function network_content(&$a, $update = 0) { $all_active = ''; $postord_active = 'active'; } - - - + // tabs $tabs = array( array( @@ -187,6 +191,13 @@ function network_content(&$a, $update = 0) { 'url'=>$a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?cid=' . $_GET['cid'] : '') . '&bmark=1', 'sel'=>$bookmarked_active, ), +// array( +// 'label' => t('Spam'), +// 'url'=>$a->get_baseurl() . '/network?f=&spam=1' +// 'sel'=> $spam_active, +// ), + + ); $tpl = get_markup_template('common_tabs.tpl'); $o .= replace_macros($tpl, array('$tabs'=>$tabs)); @@ -209,6 +220,7 @@ function network_content(&$a, $update = 0) { $order = ((x($_GET,'order')) ? notags($_GET['order']) : 'comment'); $liked = ((x($_GET,'liked')) ? intval($_GET['liked']) : 0); $conv = ((x($_GET,'conv')) ? intval($_GET['conv']) : 0); + $spam = ((x($_GET,'spam')) ? intval($_GET['spam']) : 0); $nets = ((x($_GET,'nets')) ? $_GET['nets'] : ''); if(($a->argc > 2) && $a->argv[2] === 'new') @@ -337,14 +349,16 @@ function network_content(&$a, $update = 0) { $o .= "<script> var profile_uid = " . $_SESSION['uid'] . "; var netargs = '" . substr($a->cmd,8) . '?f=' - . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') + . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . ((x($_GET,'search')) ? '&search=' . $_GET['search'] : '') - . ((x($_GET,'star')) ? '&star=' . $_GET['star'] : '') - . ((x($_GET,'order')) ? '&order=' . $_GET['order'] : '') - . ((x($_GET,'bmark')) ? '&bmark=' . $_GET['bmark'] : '') - . ((x($_GET,'liked')) ? '&liked=' . $_GET['liked'] : '') - . ((x($_GET,'conv')) ? '&conv=' . $_GET['conv'] : '') - . ((x($_GET,'nets')) ? '&nets=' . $_GET['nets'] : '') + . ((x($_GET,'star')) ? '&star=' . $_GET['star'] : '') + . ((x($_GET,'order')) ? '&order=' . $_GET['order'] : '') + . ((x($_GET,'bmark')) ? '&bmark=' . $_GET['bmark'] : '') + . ((x($_GET,'liked')) ? '&liked=' . $_GET['liked'] : '') + . ((x($_GET,'conv')) ? '&conv=' . $_GET['conv'] : '') + . ((x($_GET,'spam')) ? '&spam=' . $_GET['spam'] : '') + . ((x($_GET,'nets')) ? '&nets=' . $_GET['nets'] : '') + . "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n"; } diff --git a/mod/register.php b/mod/register.php index 89f561642..388b3e250 100755 --- a/mod/register.php +++ b/mod/register.php @@ -278,8 +278,8 @@ function register_post(&$a) { return; } $r = q("INSERT INTO `contact` ( `uid`, `created`, `self`, `name`, `nick`, `photo`, `thumb`, `micro`, `blocked`, `pending`, `url`, `nurl`, - `request`, `notify`, `poll`, `confirm`, `poco`, `name-date`, `uri-date`, `avatar-date` ) - VALUES ( %d, '%s', 1, '%s', '%s', '%s', '%s', '%s', 0, 0, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ", + `request`, `notify`, `poll`, `confirm`, `poco`, `name-date`, `uri-date`, `avatar-date`, `closeness` ) + VALUES ( %d, '%s', 1, '%s', '%s', '%s', '%s', '%s', 0, 0, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', 0 ) ", intval($newuid), datetime_convert(), dbesc($username), diff --git a/update.php b/update.php index d961f2932..d0fe1645b 100755 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@ <?php -define( 'UPDATE_VERSION' , 1118 ); +define( 'UPDATE_VERSION' , 1119 ); /** * @@ -1012,3 +1012,11 @@ INDEX ( `mid` ) } +function update_1118() { +q("ALTER TABLE `contact` ADD `closeness` TINYINT( 2 ) NOT NULL DEFAULT '99' AFTER `reason` , ADD INDEX (`closensss`) "); +q("update contact set closeness = 0 where self = 1"); +} + +function update_1119() { +q("ALTER TABLE `item` ADD `spam` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `visible` , ADD INDEX (`spam`) "); +} |