1
1
Fork 0

Merge pull request #919 from annando/master

plink, disabling features, triming the content of parsed urls
This commit is contained in:
Tobias Diekershoff 2014-03-02 08:31:03 +01:00
commit d29c981aa2
10 changed files with 121 additions and 78 deletions

View file

@ -861,10 +861,12 @@ function diaspora_post($importer,$xml,$msg) {
foreach($matches as $mtch) { foreach($matches as $mtch) {
if(strlen($str_tags)) if(strlen($str_tags))
$str_tags .= ','; $str_tags .= ',';
$str_tags .= '@[url=' . $mtch[1] . '[/url]'; $str_tags .= '@[url=' . $mtch[1] . '[/url]';
} }
} }
$plink = 'https://'.substr($diaspora_handle,strpos($diaspora_handle,'@')+1).'/posts/'.$guid;
$datarray['uid'] = $importer['uid']; $datarray['uid'] = $importer['uid'];
$datarray['contact-id'] = $contact['id']; $datarray['contact-id'] = $contact['id'];
$datarray['wall'] = 0; $datarray['wall'] = 0;
@ -874,6 +876,7 @@ function diaspora_post($importer,$xml,$msg) {
$datarray['created'] = $datarray['edited'] = datetime_convert('UTC','UTC',$created); $datarray['created'] = $datarray['edited'] = datetime_convert('UTC','UTC',$created);
$datarray['private'] = $private; $datarray['private'] = $private;
$datarray['parent'] = 0; $datarray['parent'] = 0;
$datarray['plink'] = $plink;
$datarray['owner-name'] = $contact['name']; $datarray['owner-name'] = $contact['name'];
$datarray['owner-link'] = $contact['url']; $datarray['owner-link'] = $contact['url'];
//$datarray['owner-avatar'] = $contact['thumb']; //$datarray['owner-avatar'] = $contact['thumb'];
@ -891,12 +894,12 @@ function diaspora_post($importer,$xml,$msg) {
$message_id = item_store($datarray); $message_id = item_store($datarray);
if($message_id) { //if($message_id) {
q("update item set plink = '%s' where id = %d limit 1", // q("update item set plink = '%s' where id = %d limit 1",
dbesc($a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $message_id), // dbesc($a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $message_id),
intval($message_id) // intval($message_id)
); // );
} //}
return; return;
@ -1030,6 +1033,8 @@ function diaspora_reshare($importer,$xml,$msg) {
} }
} }
$plink = 'https://'.substr($diaspora_handle,strpos($diaspora_handle,'@')+1).'/posts/'.$guid;
$datarray['uid'] = $importer['uid']; $datarray['uid'] = $importer['uid'];
$datarray['contact-id'] = $contact['id']; $datarray['contact-id'] = $contact['id'];
$datarray['wall'] = 0; $datarray['wall'] = 0;
@ -1039,6 +1044,7 @@ function diaspora_reshare($importer,$xml,$msg) {
$datarray['created'] = $datarray['edited'] = datetime_convert('UTC','UTC',$created); $datarray['created'] = $datarray['edited'] = datetime_convert('UTC','UTC',$created);
$datarray['private'] = $private; $datarray['private'] = $private;
$datarray['parent'] = 0; $datarray['parent'] = 0;
$datarray['plink'] = $plink;
$datarray['owner-name'] = $contact['name']; $datarray['owner-name'] = $contact['name'];
$datarray['owner-link'] = $contact['url']; $datarray['owner-link'] = $contact['url'];
$datarray['owner-avatar'] = ((x($contact,'thumb')) ? $contact['thumb'] : $contact['photo']); $datarray['owner-avatar'] = ((x($contact,'thumb')) ? $contact['thumb'] : $contact['photo']);
@ -1064,12 +1070,12 @@ function diaspora_reshare($importer,$xml,$msg) {
$message_id = item_store($datarray); $message_id = item_store($datarray);
if($message_id) { //if($message_id) {
q("update item set plink = '%s' where id = %d limit 1", // q("update item set plink = '%s' where id = %d limit 1",
dbesc($a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $message_id), // dbesc($a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $message_id),
intval($message_id) // intval($message_id)
); // );
} //}
return; return;
@ -1136,8 +1142,9 @@ function diaspora_asphoto($importer,$xml,$msg) {
return; return;
} }
$datarray = array(); $plink = 'https://'.substr($diaspora_handle,strpos($diaspora_handle,'@')+1).'/posts/'.$guid;
$datarray = array();
$datarray['uid'] = $importer['uid']; $datarray['uid'] = $importer['uid'];
$datarray['contact-id'] = $contact['id']; $datarray['contact-id'] = $contact['id'];
@ -1148,6 +1155,7 @@ function diaspora_asphoto($importer,$xml,$msg) {
$datarray['created'] = $datarray['edited'] = datetime_convert('UTC','UTC',$created); $datarray['created'] = $datarray['edited'] = datetime_convert('UTC','UTC',$created);
$datarray['private'] = $private; $datarray['private'] = $private;
$datarray['parent'] = 0; $datarray['parent'] = 0;
$datarray['plink'] = $plink;
$datarray['owner-name'] = $contact['name']; $datarray['owner-name'] = $contact['name'];
$datarray['owner-link'] = $contact['url']; $datarray['owner-link'] = $contact['url'];
//$datarray['owner-avatar'] = $contact['thumb']; //$datarray['owner-avatar'] = $contact['thumb'];
@ -1161,12 +1169,12 @@ function diaspora_asphoto($importer,$xml,$msg) {
$message_id = item_store($datarray); $message_id = item_store($datarray);
if($message_id) { //if($message_id) {
q("update item set plink = '%s' where id = %d limit 1", // q("update item set plink = '%s' where id = %d limit 1",
dbesc($a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $message_id), // dbesc($a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $message_id),
intval($message_id) // intval($message_id)
); // );
} //}
return; return;

View file

@ -1612,16 +1612,19 @@ if(! function_exists('get_plink')) {
* @return boolean|array False if item has not plink, otherwise array('href'=>plink url, 'title'=>translated title) * @return boolean|array False if item has not plink, otherwise array('href'=>plink url, 'title'=>translated title)
*/ */
function get_plink($item) { function get_plink($item) {
$a = get_app(); $a = get_app();
if (x($item,'plink') && ($item['private'] != 1)) { $ret = array(
return array( 'href' => $a->get_baseurl()."/display/".$a->user['nickname']."/".$item['id'],
'href' => $item['plink'],
'title' => t('link to source'), 'title' => t('link to source'),
); );
}
else { $ret["orig"] = $ret["href"];
return false;
} //if (x($item,'plink') && ($item['private'] != 1))
if (x($item,'plink'))
$ret["href"] = $item['plink'];
return($ret);
}} }}
if(! function_exists('unamp')) { if(! function_exists('unamp')) {

View file

@ -86,7 +86,7 @@ function parseurl_getsiteinfo($url, $no_guessing = false) {
if (isset($oembed_data->title)) if (isset($oembed_data->title))
$siteinfo["title"] = $oembed_data->title; $siteinfo["title"] = $oembed_data->title;
if (isset($oembed_data->description)) if (isset($oembed_data->description))
$siteinfo["text"] = $oembed_data->description; $siteinfo["text"] = trim($oembed_data->description);
if (isset($oembed_data->thumbnail_url)) if (isset($oembed_data->thumbnail_url))
$siteinfo["image"] = $oembed_data->thumbnail_url; $siteinfo["image"] = $oembed_data->thumbnail_url;
} }
@ -159,7 +159,7 @@ function parseurl_getsiteinfo($url, $no_guessing = false) {
foreach ($node->attributes as $attribute) foreach ($node->attributes as $attribute)
$attr[$attribute->name] = $attribute->value; $attr[$attribute->name] = $attribute->value;
$attr["content"] = html_entity_decode($attr["content"], ENT_QUOTES, "UTF-8"); $attr["content"] = trim(html_entity_decode($attr["content"], ENT_QUOTES, "UTF-8"));
switch (strtolower($attr["name"])) { switch (strtolower($attr["name"])) {
case "fulltitle": case "fulltitle":
@ -197,7 +197,7 @@ function parseurl_getsiteinfo($url, $no_guessing = false) {
foreach ($node->attributes as $attribute) foreach ($node->attributes as $attribute)
$attr[$attribute->name] = $attribute->value; $attr[$attribute->name] = $attribute->value;
$attr["content"] = html_entity_decode($attr["content"], ENT_QUOTES, "UTF-8"); $attr["content"] = trim(html_entity_decode($attr["content"], ENT_QUOTES, "UTF-8"));
switch (strtolower($attr["property"])) { switch (strtolower($attr["property"])) {
case "og:image": case "og:image":
@ -280,7 +280,7 @@ function parseurl_getsiteinfo($url, $no_guessing = false) {
while (strpos($text, " ")) while (strpos($text, " "))
$text = trim(str_replace(" ", " ", $text)); $text = trim(str_replace(" ", " ", $text));
$siteinfo["text"] = html_entity_decode(substr($text,0,350), ENT_QUOTES, "UTF-8").'...'; $siteinfo["text"] = trim(html_entity_decode(substr($text,0,350), ENT_QUOTES, "UTF-8").'...');
} }
} }

View file

@ -268,6 +268,26 @@ class Item extends BaseObject {
$owner_name_e = $this->get_owner_name(); $owner_name_e = $this->get_owner_name();
} }
// Disable features that aren't available in several networks
if ($item["item_network"] != "dfrn") {
unset($buttons["dislike"]);
$tagger = '';
}
if ($item["item_network"] == "feed")
unset($buttons["like"]);
if ($item["item_network"] == "mail")
unset($buttons["like"]);
if (($item["item_network"] == "dspr") AND ($indent == 'comment'))
unset($buttons["like"]);
// Facebook can like comments - but it isn't programmed in the connector yet.
if (($item["item_network"] == "face") AND ($indent == 'comment'))
unset($buttons["like"]);
$tmp_item = array( $tmp_item = array(
'template' => $this->get_template(), 'template' => $this->get_template(),

View file

@ -39,7 +39,8 @@ function theme_admin_post(&$a){
function vier_form(&$a, $style){ function vier_form(&$a, $style){
$styles = array( $styles = array(
"shadow"=>"Shadow", "shadow"=>"Shadow",
"flat"=>"Flat" "flat"=>"Flat",
"netcolour"=>"Coloured Networks"
); );
$t = get_markup_template("theme_settings.tpl" ); $t = get_markup_template("theme_settings.tpl" );
$o .= replace_macros($t, array( $o .= replace_macros($t, array(

View file

@ -30,7 +30,7 @@
} }
.icon.s10 { .icon.s10 {
font-size: 1em; font-size: 0.7em;
} }
.icon.s16 { .icon.s16 {
font-size: 1.2em; font-size: 1.2em;

View file

@ -0,0 +1,34 @@
.tread-wrapper {
background-color: #fafafa;
}
.twit {
/* background-color: #FFFAFA; */
background-color: #fafeff;
}
.pump {
/* background-color: #FAFFFA; */
background-color: #fcfffa;
}
.face {
/* background-color: #FAFAFF; */
background-color: #fafcff;
}
.feed {
/* background-color: #FFFFFA; */
background-color: #fffdfa;
}
.dspr {
background-color: #FFFAFF;
}
.dfrn {
background-color: #FAFAFA;
}
.stat {
/* background-color: #FAFFFF; */
background-color: #fffafd;
}
.mail {
/* background-color: #FFFFF9; */
background-color: #fffafa;
}

View file

@ -125,7 +125,8 @@ img {
background-repeat: no-repeat; background-repeat: no-repeat;
width: 18px; width: 18px;
height: 18px; height: 18px;
display: block; /* display: block; */
display: inline-block;
overflow: hidden; overflow: hidden;
padding: 1px; padding: 1px;
color: #999; color: #999;
@ -1116,18 +1117,18 @@ section.minimal {
/* wall item */ /* wall item */
.tread-wrapper { .tread-wrapper {
/* border-bottom: 1px solid #BDCDD4; */ /* border-bottom: 1px solid #BDCDD4; */
border-bottom: 1px solid #D2D2D2; border-bottom: 1px solid #D2D2D2;
position: relative; position: relative;
padding: 5px; padding: 5px;
margin-bottom: 10px; margin-bottom: 10px;
box-shadow: 1px 1px 6px -3px rgba(0, 0, 0, 0.7); box-shadow: 1px 1px 6px -3px rgba(0, 0, 0, 0.7);
background-color: #FAFaFa; background-color: #FFFFFF;
/* width: 755px; */ /* width: 755px; */
} }
.wall-item-decor { .wall-item-decor {
position: absolute; position: absolute;
left: 755px; left: 755px;
left: calc(100% - 7px); left: calc(100% - 16px);
/* top: -10px; */ /* top: -10px; */
width: 16px; width: 16px;
} }
@ -1157,15 +1158,19 @@ border-bottom: 1px solid #D2D2D2;
.wall-item-bottom { .wall-item-bottom {
/* font-size: 14px; */ /* font-size: 14px; */
} }
.wall-item-container .wall-item-bottom { /* .wall-item-container .wall-item-bottom { */
opacity: 0; .wall-item-container .wall-item-links,
.wall-item-container .wall-item-actions {
opacity: 0.2;
-webkit-transition: all 0.2s ease-in-out; -webkit-transition: all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out; -moz-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out; -o-transition: all 0.2s ease-in-out;
-ms-transition: all 0.2s ease-in-out; -ms-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out;
} }
.wall-item-container:hover .wall-item-bottom { /* .wall-item-container:hover .wall-item-bottom { */
.wall-item-container:hover .wall-item-links,
.wall-item-container:hover .wall-item-actions {
opacity: 1; opacity: 1;
-webkit-transition: all 0.2s ease-in-out; -webkit-transition: all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out; -moz-transition: all 0.2s ease-in-out;
@ -1448,37 +1453,6 @@ border-bottom: 1px solid #D2D2D2;
padding-right: 12px; */ padding-right: 12px; */
} }
.twit {
/* background-color: #FFFAFA; */
background-color: #fafeff;
}
.pump {
/* background-color: #FAFFFA; */
background-color: #fcfffa;
}
.face {
/* background-color: #FAFAFF; */
background-color: #fafcff;
}
.feed {
/* background-color: #FFFFFA; */
background-color: #fffdfa;
}
.dspr {
background-color: #FFFAFF;
}
.dfrn {
background-color: #FAFAFA;
}
.stat {
/* background-color: #FAFFFF; */
background-color: #fffafd;
}
.mail {
/* background-color: #FFFFF9; */
background-color: #fffafa;
}
#profile-jot-form { #profile-jot-form {
box-shadow: 1px 1px 6px -3px #666; box-shadow: 1px 1px 6px -3px #666;
background-color: #fafafa; background-color: #fafafa;

View file

@ -27,8 +27,8 @@
{{if $item.thread_level!=1}}<div class="children">{{/if}} {{if $item.thread_level!=1}}<div class="children">{{/if}}
<div class="wall-item-decor"> <div class="wall-item-decor">
<span class="icon s22 star {{$item.isstarred}}" id="starred-{{$item.id}}" title="{{$item.star.starred}}">{{$item.star.starred}}</span> <!-- <span class="icon s22 star {{$item.isstarred}}" id="starred-{{$item.id}}" title="{{$item.star.starred}}">{{$item.star.starred}}</span> -->
{{if $item.lock}}<span class="icon s22 lock fakelink" onclick="lockview(event,{{$item.id}});" title="{{$item.lock}}">{{$item.lock}}</span>{{/if}} <!-- {{if $item.lock}}<span class="icon s22 lock fakelink" onclick="lockview(event,{{$item.id}});" title="{{$item.lock}}">{{$item.lock}}</span>{{/if}} -->
<img id="like-rotator-{{$item.id}}" class="like-rotator" src="images/rotator.gif" alt="{{$item.wait}}" title="{{$item.wait}}" style="display: none;" /> <img id="like-rotator-{{$item.id}}" class="like-rotator" src="images/rotator.gif" alt="{{$item.wait}}" title="{{$item.wait}}" style="display: none;" />
</div> </div>
@ -57,11 +57,11 @@
</div> </div>
<div class="wall-item-actions-author"> <div class="wall-item-actions-author">
<a href="{{$item.profile_url}}" target="redir" title="{{$item.linktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.sparkle}}">{{$item.name}}</span></a> <a href="{{$item.profile_url}}" target="redir" title="{{$item.linktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.sparkle}}">{{$item.name}}</span></a>
{{if $item.owner_url}}{{$item.via}} <a href="{{$item.owner_url}}" target="redir" title="{{$item.olinktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.osparkle}}" id="wall-item-ownername-{{$item.id}}">{{$item.owner_name}}</span></a> <!-- {{$item.vwall}} -->{{/if}} {{if $item.owner_url}}{{$item.via}} <a href="{{$item.owner_url}}" target="redir" title="{{$item.olinktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.osparkle}}" id="wall-item-ownername-{{$item.id}}">{{$item.owner_name}}</span></a> <!-- {{$item.vwall}} -->{{/if}}
<span class="wall-item-ago"> <span class="wall-item-ago">
{{if $item.plink}}<a title="{{$item.plink.title}}" href="{{$item.plink.href}}" style="color: #999">{{$item.created}}</a>{{else}} {{$item.created}} {{/if}} {{if $item.plink}}<a title="{{$item.plink.title}}" href="{{$item.plink.href}}" style="color: #999">{{$item.created}}</a>{{else}} {{$item.created}} {{/if}}
{{if $item.lock}}<span class="fakelink" style="color: #999" onclick="lockview(event,{{$item.id}});">{{$item.lock}}</span> {{/if}}
</span> </span>
{{if $item.lock}}<span class="icon s10 lock fakelink" onclick="lockview(event,{{$item.id}});" title="{{$item.lock}}">{{$item.lock}}</span>{{/if}}
<span class="wall-item-network" title="{{$item.app}}"> <span class="wall-item-network" title="{{$item.app}}">
{{$item.network_name}} {{$item.network_name}}
</span> </span>
@ -92,7 +92,7 @@
</div> </div>
<div class="wall-item-bottom"> <div class="wall-item-bottom">
<div class="wall-item-links"> <div class="wall-item-links">
{{if $item.plink}}<a title="{{$item.plink.title}}" href="{{$item.plink.href}}"><i class="icon-link icon-large"></i></a>{{/if}} {{if $item.plink}}<a title="{{$item.plink.title}}" href="{{$item.plink.orig}}"><i class="icon-link icon-large"></i></a>{{/if}}
</div> </div>
<div class="wall-item-actions"> <div class="wall-item-actions">
<div class="wall-item-actions-social"> <div class="wall-item-actions-social">
@ -100,8 +100,9 @@
<span id="comment-{{$item.id}}" class="fakelink togglecomment" onclick="openClose('item-comments-{{$item.id}}');"><i class="icon-comment"></i></span> <span id="comment-{{$item.id}}" class="fakelink togglecomment" onclick="openClose('item-comments-{{$item.id}}');"><i class="icon-comment"></i></span>
{{/if}}{{/if}} {{/if}}{{/if}}
{{if $item.vote}} {{if $item.vote}}
{{if $item.vote.like}}
<a href="#" id="like-{{$item.id}}" title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}},'like'); return false"><i class="icon-thumbs-up icon-large"></i></a> <a href="#" id="like-{{$item.id}}" title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}},'like'); return false"><i class="icon-thumbs-up icon-large"></i></a>
{{if $item.vote.dislike}} {{/if}}{{if $item.vote.dislike}}
<a href="#" id="dislike-{{$item.id}}" title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}},'dislike'); return false"><i class="icon-thumbs-down icon-large"></i></a> <a href="#" id="dislike-{{$item.id}}" title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}},'dislike'); return false"><i class="icon-thumbs-down icon-large"></i></a>
{{/if}} {{/if}}
{{if $item.vote.share}} {{if $item.vote.share}}

View file

@ -18,6 +18,8 @@ $a->theme_info = array();
$style = get_pconfig(local_user(), 'vier', 'style'); $style = get_pconfig(local_user(), 'vier', '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";
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'] .= <<< EOT $a->page['htmlhead'] .= <<< EOT
<script type="text/javascript" src="$baseurl/view/theme/vier/js/jquery.divgrow-1.3.1.f1.min.js"></script> <script type="text/javascript" src="$baseurl/view/theme/vier/js/jquery.divgrow-1.3.1.f1.min.js"></script>