Merge remote-tracking branch 'upstream/develop' into 1409-shadow-items

This commit is contained in:
Michael Vogel 2014-12-20 09:37:33 +01:00
commit 1a0a80c310
20 changed files with 15805 additions and 15606 deletions

View file

@ -56,6 +56,8 @@ function diaspora2bb($s) {
function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) { function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) {
$OriginalText = $Text;
// Since Diaspora is creating a summary for links, this function removes them before posting // Since Diaspora is creating a summary for links, this function removes them before posting
if ($fordiaspora) if ($fordiaspora)
$Text = bb_remove_share_information($Text); $Text = bb_remove_share_information($Text);
@ -73,12 +75,24 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) {
$Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '[img]$3[/img]', $Text); $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '[img]$3[/img]', $Text);
// Convert it to HTML - don't try oembed // Convert it to HTML - don't try oembed
if ($fordiaspora) if ($fordiaspora) {
$Text = bbcode($Text, $preserve_nl, false, 3); $Text = bbcode($Text, $preserve_nl, false, 3);
else {
// Add all tags that maybe were removed
if (preg_match_all("/#\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",$OriginalText, $tags)) {
$tagline = "";
foreach($tags[2] as $tag)
if (!strpos($Text, "#".$tag))
$tagline .= "#".$tag." ";
$Text = $Text."<br />".$tagline;
}
} else {
$Text = bbcode($Text, $preserve_nl, false, 4); $Text = bbcode($Text, $preserve_nl, false, 4);
// Libertree doesn't convert a harizontal rule if there isn't a linefeed // Libertree doesn't convert a harizontal rule if there isn't a linefeed
$Text = str_replace("<hr />", "<br /><hr />", $Text); $Text = str_replace(array("<hr />", "<hr>"), array("<br /><hr />", "<br><hr>"), $Text);
} }
// Now convert HTML to Markdown // Now convert HTML to Markdown

View file

@ -3,10 +3,10 @@ require_once("include/oembed.php");
require_once('include/event.php'); require_once('include/event.php');
function bb_attachment($Text, $plaintext = false, $tryoembed = true) { function bb_attachment($Text, $plaintext = false, $tryoembed = true) {
$Text = preg_replace_callback("/\[attachment(.*?)\](.*?)\[\/attachment\]/ism", $Text = preg_replace_callback("/(.*?)\[attachment(.*?)\](.*?)\[\/attachment\]/ism",
function ($match) use ($plaintext){ function ($match) use ($plaintext){
$attributes = $match[1]; $attributes = $match[2];
$type = ""; $type = "";
preg_match("/type='(.*?)'/ism", $attributes, $matches); preg_match("/type='(.*?)'/ism", $attributes, $matches);
@ -65,6 +65,11 @@ function bb_attachment($Text, $plaintext = false, $tryoembed = true) {
$preview = $matches[1]; $preview = $matches[1];
} }
if (((strpos($match[1], "[img=") !== false) OR (strpos($match[1], "[img]") !== false)) AND ($image != "")) {
$preview = $image;
$image = "";
}
if ($plaintext) if ($plaintext)
$text = sprintf('<a href="%s" target="_blank">%s</a><br>', $url, $title); $text = sprintf('<a href="%s" target="_blank">%s</a><br>', $url, $title);
else { else {
@ -83,10 +88,10 @@ function bb_attachment($Text, $plaintext = false, $tryoembed = true) {
$text .= $oembed; $text .= $oembed;
$text .= sprintf('<blockquote>%s</blockquote></span>', trim($match[2])); $text .= sprintf('<blockquote>%s</blockquote></span>', trim($match[3]));
} }
return($text); return($match[1].$text);
},$Text); },$Text);
return($Text); return($Text);

View file

@ -37,6 +37,8 @@ function gprobe_run(&$argv, &$argc){
dbesc(normalise_link($url)) dbesc(normalise_link($url))
); );
logger("gprobe start for ".normalise_link($url), LOGGER_DEBUG);
if(! count($r)) { if(! count($r)) {
$arr = probe_url($url); $arr = probe_url($url);
@ -56,6 +58,7 @@ function gprobe_run(&$argv, &$argc){
if(count($r)) if(count($r))
poco_load(0,0,$r[0]['id'], str_replace('/profile/','/poco/',$r[0]['url'])); poco_load(0,0,$r[0]['id'], str_replace('/profile/','/poco/',$r[0]['url']));
logger("gprobe end for ".normalise_link($url), LOGGER_DEBUG);
return; return;
} }

View file

@ -872,9 +872,18 @@ 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), $contact['ffi_keyword_blacklist']); $preview = "";
// Handle enclosures and treat them as preview picture
if (isset($attach))
foreach ($attach AS $attachment)
if ($attachment->type == "image/jpeg")
$preview = $attachment->link;
$res["body"] = $res["title"].add_page_info($res['plink'], false, $preview, ($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;
unset($res["attach"]);
} elseif (isset($contact["network"]) AND ($contact["network"] == NETWORK_OSTATUS)) } elseif (isset($contact["network"]) AND ($contact["network"] == NETWORK_OSTATUS))
$res["body"] = add_page_info_to_body($res["body"]); $res["body"] = add_page_info_to_body($res["body"]);
elseif (isset($contact["network"]) AND ($contact["network"] == NETWORK_FEED) AND strstr($res['plink'], ".app.net/")) { elseif (isset($contact["network"]) AND ($contact["network"] == NETWORK_FEED) AND strstr($res['plink'], ".app.net/")) {
@ -903,6 +912,12 @@ function add_page_info_data($data) {
if ($no_photos AND ($data["type"] == "photo")) if ($no_photos AND ($data["type"] == "photo"))
return(""); return("");
// If the link contains BBCode stuff, make a short link out of this to avoid parsing problems
if (strpos($data["url"], '[') OR strpos($data["url"], ']')) {
require_once("include/network.php");
$data["url"] = short_link($data["url"]);
}
if (($data["type"] != "photo") AND is_string($data["title"])) if (($data["type"] != "photo") AND is_string($data["title"]))
$text .= "[bookmark=".$data["url"]."]".trim($data["title"])."[/bookmark]"; $text .= "[bookmark=".$data["url"]."]".trim($data["title"])."[/bookmark]";
@ -935,6 +950,9 @@ function add_page_info($url, $no_photos = false, $photo = "", $keywords = false,
$data = parseurl_getsiteinfo($url, true); $data = parseurl_getsiteinfo($url, true);
if ($photo != "")
$data["images"][0]["src"] = $photo;
logger('add_page_info: fetch page info for '.$url.' '.print_r($data, true), LOGGER_DEBUG); logger('add_page_info: fetch page info for '.$url.' '.print_r($data, true), LOGGER_DEBUG);
if (!$keywords AND isset($data["keywords"])) if (!$keywords AND isset($data["keywords"]))

View file

@ -1130,7 +1130,7 @@ function original_url($url, $depth=1, $fetchbody = false) {
if (in_array($param, array("utm_source", "utm_medium", "utm_term", "utm_content", "utm_campaign", if (in_array($param, array("utm_source", "utm_medium", "utm_term", "utm_content", "utm_campaign",
"wt_mc", "pk_campaign", "pk_kwd", "mc_cid", "mc_eid", "wt_mc", "pk_campaign", "pk_kwd", "mc_cid", "mc_eid",
"fb_action_ids", "fb_action_types", "fb_ref", "fb_action_ids", "fb_action_types", "fb_ref",
"awesm", "awesm", "wtrid",
"woo_campaign", "woo_source", "woo_medium", "woo_content", "woo_term"))) { "woo_campaign", "woo_source", "woo_medium", "woo_content", "woo_term"))) {
$pair = $param."=".urlencode($value); $pair = $param."=".urlencode($value);

View file

@ -78,6 +78,11 @@ function oembed_fetch_url($embedurl, $no_rich_type = false){
if (!is_object($j)) if (!is_object($j))
return false; return false;
// Always embed the SSL version
if (isset($j->html))
$j->html = str_replace(array("http://www.youtube.com/", "http://player.vimeo.com/"),
array("https://www.youtube.com/", "https://player.vimeo.com/"), $j->html);
$j->embedurl = $embedurl; $j->embedurl = $embedurl;
// If fetching information doesn't work, then improve via internal functions // If fetching information doesn't work, then improve via internal functions

View file

@ -62,7 +62,7 @@ ACL.prototype.add_mention = function(id) {
that.element.val( searchText + that.element.val() ); that.element.val( searchText + that.element.val() );
} else { } else {
if ( tinyMCE.activeEditor.getContent({format : 'raw'}).search(searchText) >= 0 ) return; if ( tinyMCE.activeEditor.getContent({format : 'raw'}).search(searchText) >= 0 ) return;
tinyMCE.activeEditor.dom.add(tinyMCE.activeEditor.getBody(), 'span', {}, searchText); tinyMCE.activeEditor.dom.add(tinyMCE.activeEditor.getBody(), 'dummy', {}, searchText);
} }
} }

View file

@ -17,6 +17,12 @@ class HTML5_Parser
* @return Parsed HTML as DOMDocument * @return Parsed HTML as DOMDocument
*/ */
static public function parse($text, $builder = null) { static public function parse($text, $builder = null) {
// Cleanup invalid HTML
$doc = new DOMDocument();
@$doc->loadHTML($text);
$text = $doc->saveHTML();
$tokenizer = new HTML5_Tokenizer($text, $builder); $tokenizer = new HTML5_Tokenizer($text, $builder);
$tokenizer->parse(); $tokenizer->parse();
return $tokenizer->save(); return $tokenizer->save();

View file

@ -20,6 +20,7 @@ function oembed_content(&$a){
echo "<html><body>"; echo "<html><body>";
$url = base64url_decode($a->argv[1]); $url = base64url_decode($a->argv[1]);
$j = oembed_fetch_url($url); $j = oembed_fetch_url($url);
echo $j->html; echo $j->html;
// logger('mod-oembed ' . $j->html, LOGGER_ALL); // logger('mod-oembed ' . $j->html, LOGGER_ALL);
echo "</body></html>"; echo "</body></html>";

View file

@ -187,6 +187,9 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co
case "description": case "description":
$siteinfo["text"] = $attr["content"]; $siteinfo["text"] = $attr["content"];
break; break;
case "thumbnail":
$siteinfo["image"] = $attr["content"];
break;
case "twitter:image": case "twitter:image":
$siteinfo["image"] = $attr["content"]; $siteinfo["image"] = $attr["content"];
break; break;
@ -421,6 +424,12 @@ function parse_url_content(&$a) {
$url= $siteinfo["url"]; $url= $siteinfo["url"];
// If the link contains BBCode stuff, make a short link out of this to avoid parsing problems
if (strpos($url, '[') OR strpos($url, ']')) {
require_once("include/network.php");
$url = short_link($url);
}
$sitedata = ""; $sitedata = "";
if($siteinfo["title"] == "") { if($siteinfo["title"] == "") {

View file

@ -1022,7 +1022,7 @@ function settings_content(&$a) {
)); ));
$hide_wall = replace_macros($opt_tpl,array( $hide_wall = replace_macros($opt_tpl,array(
'$field' => array('hidewall', t('Hide your profile details from unknown viewers?'), $a->user['hidewall'], '', array(t('No'),t('Yes'))), '$field' => array('hidewall', t('Hide your profile details from unknown viewers?'), $a->user['hidewall'], t("If enabled, posting public messages to Diaspora and other networks isn't possible."), array(t('No'),t('Yes'))),
)); ));

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -3,6 +3,7 @@
body { body {
background-color: #eeeeee !important; background-color: #eeeeee !important;
font-family: "Lucida Sans Unicode","Lucida Sans", sans-serif;
} }
header #banner #logo-text { header #banner #logo-text {

View file

@ -45,7 +45,8 @@ function vier_form(&$a, $style){
"flat"=>"Flat", "flat"=>"Flat",
"netcolour"=>"Coloured Networks", "netcolour"=>"Coloured Networks",
"breathe"=>"Breathe", "breathe"=>"Breathe",
"plus"=>"Plus" "plus"=>"Plus",
"dark"=>"Dark"
); );
$t = get_markup_template("theme_settings.tpl" ); $t = get_markup_template("theme_settings.tpl" );
$o .= replace_macros($t, array( $o .= replace_macros($t, array(

61
view/theme/vier/dark.css Normal file
View file

@ -0,0 +1,61 @@
*{
box-shadow: 0 0 0 0 !important;
border-color: #343434 !important;
}
hr { background-color: #343434 !important; }
a, .wall-item-name, .fakelink {
color: #989898 !important;
}
nav {
color: #989898 !important;
background-color: #1C2126 !important;
}
nav .nav-notify {
background-color: #2C77AE !important
}
a.on {
color: #FFFFFF !important;
background-color: #2C77AE !important
}
aside, .menu-popup, .fc-state-highlight, a.off, .autocomplete {
color: #989898 !important;
background-color: #252C33 !important;
border-right: 1px solid #D2D2D2;
}
body, section, blockquote, blockquote.shared_content, #profile-jot-form,
.dspr, .twit, .pump, .dfrn, .tread-wrapper, code, .mail-list-wrapper, div.pager, ul.tabs {
color: #989898 !important;
background-color: #171B1F !important;
}
div.rte, .mceContentBody {
background:none repeat scroll 0 0 #333333!important;
color:#FFF!important;
text-align:left;
}
div.pager, ul.tabs {
box-shadow: unset;
border-bottom: unset;
}
input, option, textarea, select {
color: #989898 !important;
border: 2px solid #0C1116 !important;
background-color: #0C1116 !important;
}
input#side-peoplefind-submit, input#side-follow-submit {
margin-top: 2px !important;
}
li :hover {
color: #767676 !important;
}

View file

@ -1,4 +1,11 @@
*{ box-shadow: 0 0 0 0 !important;} *{
box-shadow: 0 0 0 0 !important;
border-color: #EAEAEA !important;
}
nav { background-color: #27333F !important; }
aside { background-color: #EAEEF4 !important }
body, section { background-color: #ffffff !important;} body, section { background-color: #ffffff !important;}
#profile-jot-form { background-color: #ffffff !important;} #profile-jot-form { background-color: #ffffff !important;}
.dspr, .twit, .pump, .dfrn { background-color: #ffffff !important;} .dspr, .twit, .pump, .dfrn { background-color: #ffffff !important;}

View file

@ -22,6 +22,8 @@ if ($style == "")
if ($style == "flat") if ($style == "flat")
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/vier/flat.css" type="text/css" media="screen"/>'."\n"; $a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/vier/flat.css" type="text/css" media="screen"/>'."\n";
if ($style == "dark")
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/vier/dark.css" type="text/css" media="screen"/>'."\n";
else if ($style == "netcolour") else if ($style == "netcolour")
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/vier/netcolour.css" type="text/css" media="screen"/>'."\n"; $a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/vier/netcolour.css" type="text/css" media="screen"/>'."\n";
else if ($style == "breathe") else if ($style == "breathe")