Merge branch 'master' into spam

This commit is contained in:
friendica 2012-02-01 19:23:45 -08:00
commit 94e396e6c4
9 changed files with 67 additions and 28 deletions

View File

@ -9,9 +9,9 @@ require_once('include/nav.php');
require_once('include/cache.php'); require_once('include/cache.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '2.3.1241' ); define ( 'FRIENDICA_VERSION', '2.3.1242' );
define ( 'DFRN_PROTOCOL_VERSION', '2.22' ); define ( 'DFRN_PROTOCOL_VERSION', '2.22' );
define ( 'DB_UPDATE_VERSION', 1118 ); define ( 'DB_UPDATE_VERSION', 1119 );
define ( 'EOL', "<br />\r\n" ); define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); 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_FEED', 'feed'); // RSS/Atom feeds with no known "post/notify" protocol
define ( 'NETWORK_DIASPORA', 'dspr'); // Diaspora define ( 'NETWORK_DIASPORA', 'dspr'); // Diaspora
define ( 'NETWORK_MAIL', 'mail'); // IMAP/POP define ( 'NETWORK_MAIL', 'mail'); // IMAP/POP
define ( 'NETWORK_MAIL2', 'mai2'); // extended IMAP/POP
define ( 'NETWORK_FACEBOOK', 'face'); // Facebook API define ( 'NETWORK_FACEBOOK', 'face'); // Facebook API
define ( 'NETWORK_LINKEDIN', 'lnkd'); // LinkedIn define ( 'NETWORK_LINKEDIN', 'lnkd'); // LinkedIn
define ( 'NETWORK_XMPP', 'xmpp'); // XMPP define ( 'NETWORK_XMPP', 'xmpp'); // XMPP
define ( 'NETWORK_MYSPACE', 'mysp'); // MySpace 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 * Maximum number of "people who like (or don't like) this" that we will list by name

View File

@ -96,6 +96,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
`pending` tinyint(1) NOT NULL DEFAULT '1', `pending` tinyint(1) NOT NULL DEFAULT '1',
`rating` tinyint(1) NOT NULL DEFAULT '0', `rating` tinyint(1) NOT NULL DEFAULT '0',
`reason` text NOT NULL, `reason` text NOT NULL,
`closeness` tinyint(2) NOT NULL DEFAULT '99',
`info` mediumtext NOT NULL, `info` mediumtext NOT NULL,
`profile-id` int(11) NOT NULL DEFAULT '0', `profile-id` int(11) NOT NULL DEFAULT '0',
`bdyear` CHAR( 4 ) NOT NULL COMMENT 'birthday notify flag', `bdyear` CHAR( 4 ) NOT NULL COMMENT 'birthday notify flag',
@ -116,7 +117,8 @@ CREATE TABLE IF NOT EXISTS `contact` (
KEY `blocked` (`blocked`), KEY `blocked` (`blocked`),
KEY `readonly` (`readonly`), KEY `readonly` (`readonly`),
KEY `hidden` (`hidden`), KEY `hidden` (`hidden`),
KEY `pending` (`pending`) KEY `pending` (`pending`),
KEY `closeness` (`closeness`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- -------------------------------------------------------- -- --------------------------------------------------------

View File

@ -14,9 +14,17 @@ require_once('include/html2bbcode.php');
function diaspora2bb($s) { function diaspora2bb($s) {
$s = html_entity_decode($s,ENT_COMPAT,'UTF-8'); $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('/\@\{(.+?)\; (.+?)\@(.+?)\}/','@[url=https://$3/u/$2]$1[/url]',$s);
$s = preg_replace('/\#([^\s\#])/','\\#$1',$s);
$s = Markdown($s); $s = Markdown($s);
$s = str_replace('&#35;','#',$s);
$s = str_replace("\n",'<br />',$s);
$s = html2bbcode($s); $s = html2bbcode($s);
// $s = str_replace('&#42;','*',$s); // $s = str_replace('&#42;','*',$s);
@ -30,11 +38,6 @@ function diaspora2bb($s) {
$s = preg_replace("/(\[code\])+(.*?)(\[\/code\])+/ism","[code]$2[/code]", $s); $s = preg_replace("/(\[code\])+(.*?)(\[\/code\])+/ism","[code]$2[/code]", $s);
$s = scale_diaspora_images($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; return $s;
} }

View File

@ -373,6 +373,7 @@ function delivery_run($argv, $argc){
break; break;
case NETWORK_MAIL : case NETWORK_MAIL :
case NETWORK_MAIL2:
if(get_config('system','dfrn_only')) if(get_config('system','dfrn_only'))
break; break;
@ -413,7 +414,14 @@ function delivery_run($argv, $argc){
$reply_to = $r1[0]['reply_to']; $reply_to = $r1[0]['reply_to'];
$subject = (($it['title']) ? $it['title'] : t("\x28no subject\x29")) ; $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) if($reply_to)
$headers .= 'Reply-to: ' . $reply_to . "\n"; $headers .= 'Reply-to: ' . $reply_to . "\n";
$headers .= 'Message-id: <' . $it['uri'] . '>' . "\n"; $headers .= 'Message-id: <' . $it['uri'] . '>' . "\n";

View File

@ -584,6 +584,7 @@ function notifier_run($argv, $argc){
break; break;
case NETWORK_MAIL: case NETWORK_MAIL:
case NETWORK_MAIL2:
if(get_config('system','dfrn_only')) if(get_config('system','dfrn_only'))
break; break;
@ -629,7 +630,7 @@ function notifier_run($argv, $argc){
// only expose our real email address to true friends // 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"; $headers = 'From: ' . $local_user[0]['username'] . ' <' . $local_user[0]['email'] . '>' . "\n";
else else
$headers = 'From: ' . $local_user[0]['username'] . ' <' . t('noreply') . '@' . $a->get_hostname() . '>' . "\n"; $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` $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() ", AND `rel` != %d order by rand() ",
dbesc(NETWORK_DFRN), dbesc(NETWORK_DFRN),
dbesc(NETWORK_MAIL2),
intval($owner['uid']), intval($owner['uid']),
intval(CONTACT_IS_SHARING) intval(CONTACT_IS_SHARING)
); );

View File

@ -369,7 +369,7 @@ function poller_run($argv, $argc){
$xml = fetch_url($contact['poll']); $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); $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
if($mail_disabled) if($mail_disabled)
@ -462,7 +462,7 @@ function poller_run($argv, $argc){
$datarray['contact-id'] = $contact['id']; $datarray['contact-id'] = $contact['id'];
if($datarray['parent-uri'] === $datarray['uri']) if($datarray['parent-uri'] === $datarray['uri'])
$datarray['private'] = 1; $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['private'] = 1;
$datarray['allow_cid'] = '<' . $contact['id'] . '>'; $datarray['allow_cid'] = '<' . $contact['id'] . '>';
} }

View File

@ -113,6 +113,7 @@ function network_content(&$a, $update = 0) {
$all_active = ''; $all_active = '';
$search_active = ''; $search_active = '';
$conv_active = ''; $conv_active = '';
$spam_active = '';
if(($a->argc > 1 && $a->argv[1] === 'new') if(($a->argc > 1 && $a->argv[1] === 'new')
|| ($a->argc > 2 && $a->argv[2] === 'new')) { || ($a->argc > 2 && $a->argv[2] === 'new')) {
@ -135,12 +136,17 @@ function network_content(&$a, $update = 0) {
$conv_active = 'active'; $conv_active = 'active';
} }
if($_GET['spam']) {
$spam_active = 'active';
}
if (($new_active == '') if (($new_active == '')
&& ($starred_active == '') && ($starred_active == '')
&& ($bookmarked_active == '') && ($bookmarked_active == '')
&& ($conv_active == '') && ($conv_active == '')
&& ($search_active == '')) { && ($search_active == '')
&& ($spam_active == '')) {
$all_active = 'active'; $all_active = 'active';
} }
@ -152,8 +158,6 @@ function network_content(&$a, $update = 0) {
$postord_active = 'active'; $postord_active = 'active';
} }
// tabs // tabs
$tabs = array( $tabs = array(
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', 'url'=>$a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?cid=' . $_GET['cid'] : '') . '&bmark=1',
'sel'=>$bookmarked_active, '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'); $tpl = get_markup_template('common_tabs.tpl');
$o .= replace_macros($tpl, array('$tabs'=>$tabs)); $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'); $order = ((x($_GET,'order')) ? notags($_GET['order']) : 'comment');
$liked = ((x($_GET,'liked')) ? intval($_GET['liked']) : 0); $liked = ((x($_GET,'liked')) ? intval($_GET['liked']) : 0);
$conv = ((x($_GET,'conv')) ? intval($_GET['conv']) : 0); $conv = ((x($_GET,'conv')) ? intval($_GET['conv']) : 0);
$spam = ((x($_GET,'spam')) ? intval($_GET['spam']) : 0);
$nets = ((x($_GET,'nets')) ? $_GET['nets'] : ''); $nets = ((x($_GET,'nets')) ? $_GET['nets'] : '');
if(($a->argc > 2) && $a->argv[2] === 'new') 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'] $o .= "<script> var profile_uid = " . $_SESSION['uid']
. "; var netargs = '" . substr($a->cmd,8) . "; var netargs = '" . substr($a->cmd,8)
. '?f=' . '?f='
. ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '') . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : '')
. ((x($_GET,'search')) ? '&search=' . $_GET['search'] : '') . ((x($_GET,'search')) ? '&search=' . $_GET['search'] : '')
. ((x($_GET,'star')) ? '&star=' . $_GET['star'] : '') . ((x($_GET,'star')) ? '&star=' . $_GET['star'] : '')
. ((x($_GET,'order')) ? '&order=' . $_GET['order'] : '') . ((x($_GET,'order')) ? '&order=' . $_GET['order'] : '')
. ((x($_GET,'bmark')) ? '&bmark=' . $_GET['bmark'] : '') . ((x($_GET,'bmark')) ? '&bmark=' . $_GET['bmark'] : '')
. ((x($_GET,'liked')) ? '&liked=' . $_GET['liked'] : '') . ((x($_GET,'liked')) ? '&liked=' . $_GET['liked'] : '')
. ((x($_GET,'conv')) ? '&conv=' . $_GET['conv'] : '') . ((x($_GET,'conv')) ? '&conv=' . $_GET['conv'] : '')
. ((x($_GET,'nets')) ? '&nets=' . $_GET['nets'] : '') . ((x($_GET,'spam')) ? '&spam=' . $_GET['spam'] : '')
. ((x($_GET,'nets')) ? '&nets=' . $_GET['nets'] : '')
. "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n"; . "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
} }

View File

@ -278,8 +278,8 @@ function register_post(&$a) {
return; return;
} }
$r = q("INSERT INTO `contact` ( `uid`, `created`, `self`, `name`, `nick`, `photo`, `thumb`, `micro`, `blocked`, `pending`, `url`, `nurl`, $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` ) `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' ) ", VALUES ( %d, '%s', 1, '%s', '%s', '%s', '%s', '%s', 0, 0, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', 0 ) ",
intval($newuid), intval($newuid),
datetime_convert(), datetime_convert(),
dbesc($username), dbesc($username),

View File

@ -1,6 +1,6 @@
<?php <?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`) ");
}