Conflicts:
	include/zot.php
	mod/connedit.php
	util/messages.po
This commit is contained in:
redmatrix 2015-06-28 22:33:13 -07:00
commit 63f2e9b412
15 changed files with 144 additions and 28 deletions

View File

@ -49,7 +49,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 );
define ( 'DB_UPDATE_VERSION', 1143 );
define ( 'DB_UPDATE_VERSION', 1144 );
/**
* @brief Constant with a HTML line break.

View File

@ -5,6 +5,8 @@ Roadmap for $Projectname V3
Crypto
Convert E2EE to dynamic loading (on demand) using jQuery.getScript() [or other methods] to only load encryption libs when you require them. This should also support multiple encryption libraries (e.g. SJCL, others) triggered from the choice of algorithm and remain pluggable.
Diaspora
Convert core Diaspora federation code into a plugin. This presents a number of challenges since it touches and special cases a lot of core functionality.
Subscriptions and business models
Build enough into core(/addons) to generate income (or at least try and cover costs) out of the box

View File

@ -4,6 +4,7 @@ We need much more than this, but here are areas where developers can help. Pleas
[li]Documentation - see Red Documentation Project To-Do List[/li]
[li]Include TOS link in registration/verification email[/li]
[li]forum widget with unread counts (requires the DB schema changes from v3/hubzilla to be viable)[/li]
[li]Create bug tracker module[/li]
[li]translation plugins - moses or apertium[/li]
[li]Infinite scroll improvements (i.e. embedded page links) see http://scrollsample.appspot.com/items

View File

@ -3295,8 +3295,7 @@ function check_item_source($uid, $item) {
$text = prepare_text($item['body'],$item['mimetype']);
$text = html2plain($text);
/** @BUG $items is undefined, should this be $item? */
$tags = ((count($items['term'])) ? $items['term'] : false);
$tags = ((count($item['term'])) ? $item['term'] : false);
$words = explode("\n",$r[0]['src_patt']);
if($words) {
@ -3306,7 +3305,9 @@ function check_item_source($uid, $item) {
if(($t['type'] == TERM_HASHTAG) && ((substr($t,1) === substr($word,1)) || (substr($word,1) === '*')))
return true;
}
if(stristr($text,$word) !== false)
elseif((strpos($word,'/') === 0) && preg_match($word,$body))
return true;
elseif(stristr($text,$word) !== false)
return true;
}
}
@ -3314,6 +3315,64 @@ function check_item_source($uid, $item) {
return false;
}
function post_is_importable($item,$abook) {
if(! $abook)
return true;
if(! $item)
return false;
if((! $abook['abook_incl']) && (! $abook['abook_excl']))
return true;
require_once('include/html2plain.php');
$text = prepare_text($item['body'],$item['mimetype']);
$text = html2plain($text);
$tags = ((count($item['term'])) ? $item['term'] : false);
// exclude always has priority
$exclude = (($abook['abook_excl']) ? explode("\n",$abook['abook_excl']) : null);
if($exclude) {
foreach($exclude as $word) {
$word = trim($word);
if(substr($word,0,1) === '#' && $tags) {
foreach($tags as $t)
if(($t['type'] == TERM_HASHTAG) && ((substr($t,1) === substr($word,1)) || (substr($word,1) === '*')))
return false;
}
elseif((strpos($word,'/') === 0) && preg_match($word,$body))
return false;
elseif(stristr($text,$word) !== false)
return false;
}
}
$include = (($abook['abook_incl']) ? explode("\n",$abook['abook_incl']) : null);
if($include) {
foreach($include as $word) {
$word = trim($word);
if(substr($word,0,1) === '#' && $tags) {
foreach($tags as $t)
if(($t['type'] == TERM_HASHTAG) && ((substr($t,1) === substr($word,1)) || (substr($word,1) === '*')))
return true;
}
elseif((strpos($word,'/') === 0) && preg_match($word,$body))
return true;
elseif(stristr($text,$word) !== false)
return true;
}
}
else {
return true;
}
return false;
}
function mail_store($arr) {

View File

@ -1625,6 +1625,13 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $
}
}
$ab = q("select abook.* from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d
and abook_self = 0",
intval($channel['channel_id'])
);
$abook = (($ab) ? $ab[0] : null);
if(intval($arr['item_deleted'])) {
// remove_community_tag is a no-op if this isn't a community tag activity
@ -1665,11 +1672,16 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $
elseif($arr['edited'] > $r[0]['edited']) {
$arr['id'] = $r[0]['id'];
$arr['uid'] = $channel['channel_id'];
if(($arr['mid'] == $arr['parent_mid']) && (! post_is_importable($arr,$abook))) {
$result[] = array($d['hash'],'update ignored',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']);
}
else {
update_imported_item($sender,$arr,$channel['channel_id']);
$result[] = array($d['hash'],'updated',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']);
if(! $relay)
add_source_route($item_id,$sender['hash']);
}
}
else {
$result[] = array($d['hash'],'update ignored',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']);
@ -1689,8 +1701,13 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $
if(check_item_source($arr['uid'], $arr))
call_hooks('post_local', $arr);
$item_result = item_store($arr);
$item_id = 0;
if(($arr['mid'] == $arr['parent_mid']) && (! post_is_importable($arr,$abook))) {
$result[] = array($d['hash'],'post ignored',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']);
}
else {
$item_result = item_store($arr);
if($item_result['success']) {
$item_id = $item_result['item_id'];
$parr = array('item_id' => $item_id,'item' => $arr,'sender' => $sender,'channel' => $channel);
@ -1701,6 +1718,7 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $
}
$result[] = array($d['hash'],(($item_id) ? 'posted' : 'storage failed:' . $item_result['message']),$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']);
}
}
if($relay && $item_id) {
logger('process_delivery: invoking relay');

View File

@ -21,6 +21,8 @@ CREATE TABLE IF NOT EXISTS `abook` (
`abook_self` tinyint(4) NOT NULL DEFAULT '0',
`abook_feed` tinyint(4) NOT NULL DEFAULT '0',
`abook_profile` char(64) NOT NULL DEFAULT '',
`abook_incl` TEXT NOT NULL DEFAULT '',
`abook_excl` TEXT NOT NULL DEFAULT '',
PRIMARY KEY (`abook_id`),
KEY `abook_account` (`abook_account`),
KEY `abook_channel` (`abook_channel`),

View File

@ -14,6 +14,8 @@ CREATE TABLE "abook" (
"abook_dob" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
"abook_flags" bigint NOT NULL DEFAULT '0',
"abook_profile" char(64) NOT NULL DEFAULT '',
"abook_incl" TEXT NOT NULL DEFAULT '',
"abook_excl" TEXT NOT NULL DEFAULT '',
PRIMARY KEY ("abook_id")
);
create index "abook_account" on abook ("abook_account");

View File

@ -1,6 +1,6 @@
<?php
define( 'UPDATE_VERSION' , 1143 );
define( 'UPDATE_VERSION' , 1144 );
/**
*
@ -1657,3 +1657,13 @@ function update_r1142() {
}
function update_r1143() {
$r1 = q("ALTER TABLE abook ADD abook_incl TEXT NOT NULL DEFAULT ''");
$r2 = q("ALTER TABLE abook ADD abook_excl TEXT NOT NULL DEFAULT '' ");
if($r1 && $r2)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}

View File

@ -101,6 +101,9 @@ function connedit_post(&$a) {
}
}
$abook_incl = escape_tags($_POST['abook_incl']);
$abook_excl = escape_tags($_POST['abook_excl']);
$hidden = intval($_POST['hidden']);
$priority = intval($_POST['poll']);
@ -189,12 +192,16 @@ function connedit_post(&$a) {
}
}
$r = q("UPDATE abook SET abook_profile = '%s', abook_my_perms = %d , abook_closeness = %d, abook_pending = %d
$r = q("UPDATE abook SET abook_profile = '%s', abook_my_perms = %d , abook_closeness = %d, abook_pending = %d,
abook_incl = '%s', abook_excl = '%s'
where abook_id = %d AND abook_channel = %d",
dbesc($profile_id),
intval($abook_my_perms),
intval($closeness),
intval(1 - intval($new_friend)),
dbesc($abook_incl),
dbesc($abook_excl),
intval($contact_id),
intval(local_channel())
);
@ -661,7 +668,9 @@ function connedit_content(&$a) {
'$lbl_slider' => t('Slide to adjust your degree of friendship'),
'$lbl_rating' => t('Rating (this information is public)'),
'$lbl_rating_txt' => t('Optionally explain your rating (this information is public)'),
'$rating_txt' => $rating_text,
'$incl' => array('abook_incl',t('Only import posts with this text'), $contact['abook_incl'],t('words one per line or #tags or /patterns/, leave blank to import all posts')),
'$excl' => array('abook_excl',t('Do not import posts with this text'), $contact['abook_excl'],t('words one per line or #tags or /patterns/, leave blank to import all posts')),
'$rating_text' => array('rating_text', t('Optionally explain your rating (this information is public)'),$rating_text,''),
'$rating' => $rating,
'$rating_val' => $rating_val,
'$slide' => $slide,

View File

@ -48,7 +48,7 @@ function tagger_content(&$a) {
break;
default:
$targettype = ACTIVITY_OBJ_NOTE;
$post_type = t('status');
$post_type = t('post');
if($item['mid'] != $item['parent_mid'])
$post_type = t('comment');
break;

View File

@ -1 +1 @@
2015-06-23.1072
2015-06-28.1077

View File

@ -10,11 +10,13 @@
.contact-photo-wrapper {
display: table-cell;
table-layout: fixed;
vertical-align: top;
}
.contact-info {
display: table-cell;
table-layout: fixed;
vertical-align: top;
padding-left: 10px;
}

View File

@ -1326,6 +1326,7 @@ header {
.contactname {
padding-top: 2px;
font-weight: bold;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: block;
@ -1408,7 +1409,6 @@ header {
.acl-list-item p {
font-size: $font_size;
margin: 0px;
overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@ -1870,6 +1870,9 @@ nav .dropdown-menu {
.section-subtitle-wrapper h3 {
margin-top: 0px;
margin-bottom: 0px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.section-subtitle-wrapper {
@ -2000,6 +2003,7 @@ nav .badge.mail-update:hover {
.dropdown-menu {
font-size: $body_font_size;
border-radius: $radiuspx;
max-width: 100%;
}
.dropdown-menu img {
@ -2277,3 +2281,4 @@ nav .badge.mail-update:hover {
.channels_ckbx, .pending_ckbx, .users_ckbx {
margin-top: -5px !important;
}

View File

@ -50,6 +50,9 @@
{{/if}}
{{include file="field_textarea.tpl" field=$incl}}
{{include file="field_textarea.tpl" field=$excl}}
{{if $rating}}
<h3>{{$lbl_rating}}</h3>
@ -58,6 +61,8 @@
{{/if}}
{{/if}}
@ -75,8 +80,7 @@
{{if $rating}}
{{if $notself}}
<h3 class="abook-rating-text-desc">{{$lbl_rating_txt}}</h3>
<textarea name="rating_text" id="rating-text" >{{$rating_txt}}</textarea>
{{include file="field_textarea.tpl" field=$rating_text}}
{{/if}}
{{/if}}

View File

@ -8,7 +8,9 @@
{{if $entry.ignlink}}
<a class="directory-ignore btn btn-warning btn-xs" href="{{$entry.ignlink}}"> {{$entry.ignore_label}}</a>
{{/if}}
{{if $entry.connect}}
<a class="btn btn-success btn-xs" href="{{$entry.connect}}"><i class="icon-plus connect-icon"></i> {{$entry.conn_label}}</a>
{{/if}}
</div>
<h3>{{if $entry.public_forum}}<i class="icon-comments-alt" title="{{$entry.forum_label}} @{{$entry.nickname}}+"></i>&nbsp;{{/if}}<a href='{{$entry.profile_link}}' >{{$entry.name}}</a>{{if $entry.online}}&nbsp;<i class="icon-asterisk online-now" title="{{$entry.online}}"></i>{{/if}}</h3>
</div>