Merge branch 'develop' into release-3.3.1

This commit is contained in:
Fabrixxm 2014-10-31 14:50:46 +01:00
commit a32682d78c
6 changed files with 26 additions and 7 deletions

View file

@ -18,7 +18,7 @@ define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_CODENAME', 'Ginger'); define ( 'FRIENDICA_CODENAME', 'Ginger');
define ( 'FRIENDICA_VERSION', '3.3' ); define ( 'FRIENDICA_VERSION', '3.3' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1173 ); define ( 'DB_UPDATE_VERSION', 1174 );
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' );

View file

@ -462,6 +462,7 @@ function db_definition() {
"bd" => array("type" => "date", "not null" => "1"), "bd" => array("type" => "date", "not null" => "1"),
"notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"), "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"), "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"ffi_keyword_blacklist" => array("type" => "mediumtext", "not null" => "1"),
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),

View file

@ -872,7 +872,7 @@ function get_atom_elements($feed, $item, $contact = array()) {
} }
if (isset($contact["network"]) AND ($contact["network"] == NETWORK_FEED) AND $contact['fetch_further_information']) { if (isset($contact["network"]) AND ($contact["network"] == NETWORK_FEED) AND $contact['fetch_further_information']) {
$res["body"] = $res["title"].add_page_info($res['plink'], false, "", ($contact['fetch_further_information'] == 2)); $res["body"] = $res["title"].add_page_info($res['plink'], false, "", ($contact['fetch_further_information'] == 2), $contact['ffi_keyword_blacklist']);
$res["title"] = ""; $res["title"] = "";
$res["object-type"] = ACTIVITY_OBJ_BOOKMARK; $res["object-type"] = ACTIVITY_OBJ_BOOKMARK;
} elseif (isset($contact["network"]) AND ($contact["network"] == NETWORK_OSTATUS)) } elseif (isset($contact["network"]) AND ($contact["network"] == NETWORK_OSTATUS))
@ -921,7 +921,8 @@ function add_page_info_data($data) {
$a = get_app(); $a = get_app();
$hashtags = "\n"; $hashtags = "\n";
foreach ($data["keywords"] AS $keyword) { foreach ($data["keywords"] AS $keyword) {
$hashtag = str_replace(" ", "", $keyword); $hashtag = str_replace(array(" ", "+", "/", ".", "#", "'"),
array("","", "", "", "", ""), $keyword);
$hashtags .= "#[url=".$a->get_baseurl()."/search?tag=".rawurlencode($hashtag)."]".$hashtag."[/url] "; $hashtags .= "#[url=".$a->get_baseurl()."/search?tag=".rawurlencode($hashtag)."]".$hashtag."[/url] ";
} }
} }
@ -929,7 +930,7 @@ function add_page_info_data($data) {
return("\n[class=type-".$data["type"]."]".$text."[/class]".$hashtags); return("\n[class=type-".$data["type"]."]".$text."[/class]".$hashtags);
} }
function add_page_info($url, $no_photos = false, $photo = "", $keywords = false) { function add_page_info($url, $no_photos = false, $photo = "", $keywords = false, $keyword_blacklist = "") {
require_once("mod/parse_url.php"); require_once("mod/parse_url.php");
$data = parseurl_getsiteinfo($url, true); $data = parseurl_getsiteinfo($url, true);
@ -939,6 +940,16 @@ function add_page_info($url, $no_photos = false, $photo = "", $keywords = false)
if (!$keywords AND isset($data["keywords"])) if (!$keywords AND isset($data["keywords"]))
unset($data["keywords"]); unset($data["keywords"]);
if (($keyword_blacklist != "") AND isset($data["keywords"])) {
$list = explode(",", $keyword_blacklist);
foreach ($list AS $keyword) {
$keyword = trim($keyword);
$index = array_search($keyword, $data["keywords"]);
if ($index !== false)
unset($data["keywords"][$index]);
}
}
$text = add_page_info_data($data); $text = add_page_info_data($data);
return($text); return($text);

View file

@ -160,6 +160,8 @@ function contacts_post(&$a) {
$fetch_further_information = intval($_POST['fetch_further_information']); $fetch_further_information = intval($_POST['fetch_further_information']);
$ffi_keyword_blacklist = fix_mce_lf(escape_tags(trim($_POST['ffi_keyword_blacklist'])));
$priority = intval($_POST['poll']); $priority = intval($_POST['poll']);
if($priority > 5 || $priority < 0) if($priority > 5 || $priority < 0)
$priority = 0; $priority = 0;
@ -167,13 +169,15 @@ function contacts_post(&$a) {
$info = fix_mce_lf(escape_tags(trim($_POST['info']))); $info = fix_mce_lf(escape_tags(trim($_POST['info'])));
$r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `info` = '%s', $r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `info` = '%s',
`hidden` = %d, `notify_new_posts` = %d, `fetch_further_information` = %d WHERE `id` = %d AND `uid` = %d", `hidden` = %d, `notify_new_posts` = %d, `fetch_further_information` = %d,
`ffi_keyword_blacklist` = '%s' WHERE `id` = %d AND `uid` = %d",
intval($profile_id), intval($profile_id),
intval($priority), intval($priority),
dbesc($info), dbesc($info),
intval($hidden), intval($hidden),
intval($notify), intval($notify),
intval($fetch_further_information), intval($fetch_further_information),
dbesc($ffi_keyword_blacklist),
intval($contact_id), intval($contact_id),
intval(local_user()) intval(local_user())
); );
@ -504,6 +508,8 @@ function contacts_content(&$a) {
'$notify' => array('notify', t('Notification for new posts'), ($contact['notify_new_posts'] == 1), t('Send a notification of every new post of this contact')), '$notify' => array('notify', t('Notification for new posts'), ($contact['notify_new_posts'] == 1), t('Send a notification of every new post of this contact')),
'$fetch_further_information' => array('fetch_further_information', t('Fetch further information for feeds'), $contact['fetch_further_information'], t('Fetch further information for feeds'), '$fetch_further_information' => array('fetch_further_information', t('Fetch further information for feeds'), $contact['fetch_further_information'], t('Fetch further information for feeds'),
array('0'=>t('Disabled'), '1'=>t('Fetch information'), '2'=>t('Fetch information and keywords'))), array('0'=>t('Disabled'), '1'=>t('Fetch information'), '2'=>t('Fetch information and keywords'))),
'$ffi_keyword_blacklist' => $contact['ffi_keyword_blacklist'],
'$ffi_keyword_blacklist' => array('ffi_keyword_blacklist', t('Blacklisted keywords'), $contact['ffi_keyword_blacklist'], t('Comma separated list of keywords that should not be converted to hashtags, when "Fetch information and keywords" is selected')),
'$photo' => $contact['photo'], '$photo' => $contact['photo'],
'$name' => $contact['name'], '$name' => $contact['name'],
'$dir_icon' => $dir_icon, '$dir_icon' => $dir_icon,

View file

@ -1,6 +1,6 @@
<?php <?php
define( 'UPDATE_VERSION' , 1173 ); define( 'UPDATE_VERSION' , 1174 );
/** /**
* *

View file

@ -67,6 +67,7 @@
<div id="contact-edit-end" ></div> <div id="contact-edit-end" ></div>
{{include file="field_checkbox.tpl" field=$notify}} {{include file="field_checkbox.tpl" field=$notify}}
{{include file="field_select.tpl" field=$fetch_further_information}} {{include file="field_select.tpl" field=$fetch_further_information}}
{{if $fetch_further_information.2 == 2 }} {{include file="field_textarea.tpl" field=$ffi_keyword_blacklist}} {{/if}}
{{include file="field_checkbox.tpl" field=$hidden}} {{include file="field_checkbox.tpl" field=$hidden}}
<div id="contact-edit-info-wrapper"> <div id="contact-edit-info-wrapper">