Merge pull request #944 from annando/master
Some more frontend stuff/Native Diaspora reshare
This commit is contained in:
commit
c1d14bcc98
4
boot.php
4
boot.php
|
@ -1255,6 +1255,10 @@ if(! function_exists('info')) {
|
|||
*/
|
||||
function info($s) {
|
||||
$a = get_app();
|
||||
|
||||
if (local_user() AND get_pconfig(local_user(),'system','ignore_info'))
|
||||
return;
|
||||
|
||||
if(! x($_SESSION,'sysmsg_info')) $_SESSION['sysmsg_info'] = array();
|
||||
if($a->interactive)
|
||||
$_SESSION['sysmsg_info'][] = $s;
|
||||
|
|
BIN
images/dreamwidth.png
Normal file
BIN
images/dreamwidth.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.4 KiB |
BIN
images/insanejournal.gif
Normal file
BIN
images/insanejournal.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.8 KiB |
|
@ -2309,26 +2309,40 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
|
|||
require_once('include/datetime.php');
|
||||
$created = datetime_convert('UTC','UTC',$item['created'],'Y-m-d H:i:s \U\T\C');
|
||||
|
||||
// To-Do
|
||||
// Detect a share element and do a reshare
|
||||
// see: https://github.com/Raven24/diaspora-federation/blob/master/lib/diaspora-federation/entities/reshare.rb
|
||||
$tpl = get_markup_template('diaspora_post.tpl');
|
||||
$msg = replace_macros($tpl, array(
|
||||
'$body' => $body,
|
||||
'$guid' => $item['guid'],
|
||||
'$handle' => xmlify($myaddr),
|
||||
'$public' => $public,
|
||||
'$created' => $created,
|
||||
'$provider' => $item["app"]
|
||||
));
|
||||
if (!$item['private'] AND ($ret = diaspora_is_reshare($item["body"]))) {
|
||||
$tpl = get_markup_template('diaspora_reshare.tpl');
|
||||
$msg = replace_macros($tpl, array(
|
||||
'$root_handle' => xmlify($ret['root_handle']),
|
||||
'$root_guid' => $ret['root_guid'],
|
||||
'$guid' => $item['guid'],
|
||||
'$handle' => xmlify($myaddr),
|
||||
'$public' => $public,
|
||||
'$created' => $created,
|
||||
'$provider' => $item["app"]
|
||||
));
|
||||
} else {
|
||||
$tpl = get_markup_template('diaspora_post.tpl');
|
||||
$msg = replace_macros($tpl, array(
|
||||
'$body' => $body,
|
||||
'$guid' => $item['guid'],
|
||||
'$handle' => xmlify($myaddr),
|
||||
'$public' => $public,
|
||||
'$created' => $created,
|
||||
'$provider' => $item["app"]
|
||||
));
|
||||
}
|
||||
|
||||
logger('diaspora_send_status: ' . $owner['username'] . ' -> ' . $contact['name'] . ' base message: ' . $msg, LOGGER_DATA);
|
||||
logger('diaspora_send_status: '.$owner['username'].' -> '.$contact['name'].' base message: '.$msg, LOGGER_DATA);
|
||||
|
||||
$slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],$public_batch)));
|
||||
//$slap = 'xml=' . urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'],$public_batch));
|
||||
|
||||
$return_code = diaspora_transmit($owner,$contact,$slap,$public_batch);
|
||||
|
||||
logger('diaspora_send_status: guid: '.$item['guid'].' result '.$return_code, LOGGER_DEBUG);
|
||||
|
||||
if(count($images)) {
|
||||
diaspora_send_images($item,$owner,$contact,$images,$public_batch);
|
||||
}
|
||||
|
@ -2336,6 +2350,53 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
|
|||
return $return_code;
|
||||
}
|
||||
|
||||
function diaspora_is_reshare($body) {
|
||||
$body = trim($body);
|
||||
|
||||
// Skip if it isn't a pure repeated messages
|
||||
// Does it start with a share?
|
||||
if (strpos($body, "[share") > 0)
|
||||
return(false);
|
||||
|
||||
// Does it end with a share?
|
||||
if (strlen($body) > (strrpos($body, "[/share]") + 8))
|
||||
return(false);
|
||||
|
||||
$attributes = preg_replace("/\[share(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism","$1",$body);
|
||||
// Skip if there is no shared message in there
|
||||
if ($body == $attributes)
|
||||
return(false);
|
||||
|
||||
$profile = "";
|
||||
preg_match("/profile='(.*?)'/ism", $attributes, $matches);
|
||||
if ($matches[1] != "")
|
||||
$profile = $matches[1];
|
||||
|
||||
preg_match('/profile="(.*?)"/ism', $attributes, $matches);
|
||||
if ($matches[1] != "")
|
||||
$profile = $matches[1];
|
||||
|
||||
$ret= array();
|
||||
|
||||
$ret["root_handle"] = preg_replace("=https?://(.*)/u/(.*)=ism", "$2@$1", $profile);
|
||||
if (($ret["root_handle"] == $profile) OR ($ret["root_handle"] == ""))
|
||||
return(false);
|
||||
|
||||
$link = "";
|
||||
preg_match("/link='(.*?)'/ism", $attributes, $matches);
|
||||
if ($matches[1] != "")
|
||||
$link = $matches[1];
|
||||
|
||||
preg_match('/link="(.*?)"/ism', $attributes, $matches);
|
||||
if ($matches[1] != "")
|
||||
$link = $matches[1];
|
||||
|
||||
$ret["root_guid"] = preg_replace("=https?://(.*)/posts/(.*)=ism", "$2", $link);
|
||||
if (($ret["root_guid"] == $link) OR ($ret["root_guid"] == ""))
|
||||
return(false);
|
||||
|
||||
return($ret);
|
||||
}
|
||||
|
||||
function diaspora_send_images($item,$owner,$contact,$images,$public_batch = false) {
|
||||
$a = get_app();
|
||||
|
|
|
@ -117,6 +117,9 @@ function delegate_content(&$a) {
|
|||
if(! in_array($rr['uid'],$uids))
|
||||
$potentials[] = $rr;
|
||||
|
||||
require_once("mod/settings.php");
|
||||
settings_init($a);
|
||||
|
||||
$o = replace_macros(get_markup_template('delegate.tpl'),array(
|
||||
'$header' => t('Delegate Page Management'),
|
||||
'$base' => $a->get_baseurl(),
|
||||
|
|
|
@ -265,6 +265,7 @@ function settings_post(&$a) {
|
|||
$theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : $a->user['theme']);
|
||||
$mobile_theme = ((x($_POST,'mobile_theme')) ? notags(trim($_POST['mobile_theme'])) : '');
|
||||
$nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0);
|
||||
$noinfo = ((x($_POST,'noinfo')) ? intval($_POST['noinfo']) : 0);
|
||||
$infinite_scroll = ((x($_POST,'infinite_scroll')) ? intval($_POST['infinite_scroll']) : 0);
|
||||
$browser_update = ((x($_POST,'browser_update')) ? intval($_POST['browser_update']) : 0);
|
||||
$browser_update = $browser_update * 1000;
|
||||
|
@ -287,6 +288,7 @@ function settings_post(&$a) {
|
|||
set_pconfig(local_user(),'system','itemspage_network', $itemspage_network);
|
||||
set_pconfig(local_user(),'system','itemspage_mobile_network', $itemspage_mobile_network);
|
||||
set_pconfig(local_user(),'system','no_smilies',$nosmile);
|
||||
set_pconfig(local_user(),'system','ignore_info',$noinfo);
|
||||
set_pconfig(local_user(),'system','infinite_scroll',$infinite_scroll);
|
||||
|
||||
|
||||
|
@ -850,6 +852,9 @@ function settings_content(&$a) {
|
|||
$nosmile = get_pconfig(local_user(),'system','no_smilies');
|
||||
$nosmile = (($nosmile===false)? '0': $nosmile); // default if not set: 0
|
||||
|
||||
$noinfo = get_pconfig(local_user(),'system','ignore_info');
|
||||
$noinfo = (($noinfo===false)? '0': $noinfo); // default if not set: 0
|
||||
|
||||
$infinite_scroll = get_pconfig(local_user(),'system','infinite_scroll');
|
||||
$infinite_scroll = (($infinite_scroll===false)? '0': $infinite_scroll); // default if not set: 0
|
||||
|
||||
|
@ -873,6 +878,7 @@ function settings_content(&$a) {
|
|||
'$itemspage_network' => array('itemspage_network', t("Number of items to display per page:"), $itemspage_network, t('Maximum of 100 items')),
|
||||
'$itemspage_mobile_network' => array('itemspage_mobile_network', t("Number of items to display per page when viewed from mobile device:"), $itemspage_mobile_network, t('Maximum of 100 items')),
|
||||
'$nosmile' => array('nosmile', t("Don't show emoticons"), $nosmile, ''),
|
||||
'$noinfo' => array('noinfo', t("Don't show notices"), $noinfo, ''),
|
||||
'$infinite_scroll' => array('infinite_scroll', t("Infinite scroll"), $infinite_scroll, ''),
|
||||
|
||||
'$theme_config' => $theme_config,
|
||||
|
|
|
@ -4,6 +4,10 @@ function uexport_init(&$a){
|
|||
if(! local_user())
|
||||
killme();
|
||||
|
||||
require_once("mod/settings.php");
|
||||
settings_init($a);
|
||||
|
||||
/*
|
||||
$tabs = array(
|
||||
array(
|
||||
'label' => t('Account settings'),
|
||||
|
@ -49,6 +53,7 @@ function uexport_init(&$a){
|
|||
'$class' => 'settings-widget',
|
||||
'$items' => $tabs,
|
||||
));
|
||||
*/
|
||||
}
|
||||
|
||||
function uexport_content(&$a){
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
/* List of social Networks */
|
||||
img.connector {
|
||||
img.connector, img.connector-disabled {
|
||||
height: 40px;
|
||||
margin-right: 10px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
img.connector-disabled {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
h3.connector {
|
||||
display: inline-block;
|
||||
vertical-align: bottom;
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<div class="comment-edit-text-end"></div>
|
||||
<div class="comment-edit-submit-wrapper" id="comment-edit-submit-wrapper-{{$id}}" style="display: none;" >
|
||||
<input type="submit" onclick="post_comment({{$id}}); return false;" id="comment-edit-submit-{{$id}}" class="comment-edit-submit" name="submit" value="{{$submit}}" />
|
||||
<span onclick="preview_comment({{$id}});" id="comment-edit-preview-link-{{$id}}" class="fakelink">{{$preview}}</span>
|
||||
{{if $preview}}<span onclick="preview_comment({{$id}});" id="comment-edit-preview-link-{{$id}}" class="fakelink">{{$preview}}</span>{{/if}}
|
||||
<div id="comment-edit-preview-{{$id}}" class="comment-edit-preview" style="display:none;"></div>
|
||||
</div>
|
||||
|
||||
|
|
18
view/templates/diaspora_reshare.tpl
Normal file
18
view/templates/diaspora_reshare.tpl
Normal file
|
@ -0,0 +1,18 @@
|
|||
{{*
|
||||
* AUTOMATICALLY GENERATED TEMPLATE
|
||||
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
|
||||
*
|
||||
*}}
|
||||
<XML>
|
||||
<post>
|
||||
<reshare>
|
||||
<root_diaspora_id>{{$root_handle}}</root_diaspora_id>
|
||||
<root_guid>{{$root_guid}}</root_guid>
|
||||
<guid>{{$guid}}</guid>
|
||||
<diaspora_handle>{{$handle}}</diaspora_handle>
|
||||
<public>{{$public}}</public>
|
||||
<created_at>{{$created}}</created_at>
|
||||
<provider_display_name>{{$provider}}</provider_display_name>
|
||||
</reshare>
|
||||
</post>
|
||||
</XML>
|
|
@ -3,12 +3,12 @@
|
|||
* DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
|
||||
*
|
||||
*}}
|
||||
<script>$(function(){ previewTheme($("#id_{{$field.0}}")[0]); });</script>
|
||||
{{if $field.5}}<script>$(function(){ previewTheme($("#id_{{$field.0}}")[0]); });</script>{{/if}}
|
||||
<div class='field select'>
|
||||
<label for='id_{{$field.0}}'>{{$field.1}}</label>
|
||||
<select name='{{$field.0}}' id='id_{{$field.0}}' {{if $field.5}}onchange="previewTheme(this);"{{/if}} >
|
||||
{{foreach $field.4 as $opt=>$val}}<option value="{{$opt}}" {{if $opt==$field.2}}selected="selected"{{/if}}>{{$val}}</option>{{/foreach}}
|
||||
</select>
|
||||
<span class='field_help'>{{$field.3}}</span>
|
||||
<div id="theme-preview"></div>
|
||||
{{if $field.5}}<div id="theme-preview"></div>{{/if}}
|
||||
</div>
|
||||
|
|
|
@ -59,7 +59,8 @@
|
|||
<a href="#profile-jot-acl-wrapper" id="jot-perms-icon" class="icon {{$lockstate}}" title="{{$permset}}" ></a>{{$bang}}
|
||||
</div>
|
||||
|
||||
<span onclick="preview_post();" id="jot-preview-link" class="fakelink">{{$preview}}</span>
|
||||
<!-- {{if $preview}}<span onclick="preview_post();" id="jot-preview-link" class="fakelink">{{$preview}}</span>{{/if}} -->
|
||||
{{if $preview}}<input type="submit" onclick="preview_post(); return false;" id="jot-preview-link" value="{{$preview}}" />{{/if}}
|
||||
|
||||
<div id="profile-jot-perms-end"></div>
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
{{include file="field_input.tpl" field=$itemspage_mobile_network}}
|
||||
{{include file="field_input.tpl" field=$ajaxint}}
|
||||
{{include file="field_checkbox.tpl" field=$nosmile}}
|
||||
{{include file="field_checkbox.tpl" field=$noinfo}}
|
||||
{{include file="field_checkbox.tpl" field=$infinite_scroll}}
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
<div class="settings-submit-wrapper" >
|
||||
<input type="submit" name="submit" class="settings-submit" value="{{$submit}}" />
|
||||
<input type="submit" name="cancel" class="settings-submit" value="{{$cancel}}" />
|
||||
<!-- <input type="submit" name="cancel" class="settings-submit" value="{{$cancel}}" /> -->
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
|
|
@ -727,6 +727,7 @@ nav #nav-messages-linkmenu.selected,
|
|||
nav #nav-user-linklabel.selected,
|
||||
nav #nav-apps-link.selected {
|
||||
background-color: #364e59;
|
||||
border-bottom-style: none;
|
||||
}
|
||||
|
||||
/* nav #nav-community-link { */
|
||||
|
@ -1424,8 +1425,9 @@ h2 {
|
|||
/* width: 700px; */
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
margin: 10px 0;
|
||||
margin: 10px 0px 0px 0px;
|
||||
border-bottom: 0px;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.wall-item-bottom .comment-edit-preview {
|
||||
|
@ -1926,12 +1928,12 @@ ul.tabs a {
|
|||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
div.pager, .birthday-notice, #jot-preview-link, .comment-edit-submit-wrapper .fakelink {
|
||||
div.pager, .birthday-notice, .comment-edit-submit-wrapper .fakelink {
|
||||
padding: 2px 7px 2px 7px;
|
||||
color: black;
|
||||
}
|
||||
|
||||
div.pager, .birthday-notice, ul.tabs a, #jot-preview-link, .comment-edit-submit-wrapper .fakelink {
|
||||
div.pager, .birthday-notice, ul.tabs a, .comment-edit-submit-wrapper .fakelink {
|
||||
border: 1px solid lightgray;
|
||||
background: #F2F2F2;
|
||||
margin-top: 2px;
|
||||
|
@ -1942,11 +1944,11 @@ ul.tabs a:hover {
|
|||
color: #333;
|
||||
}
|
||||
|
||||
#event-notice:hover, #birthday-notice:hover, ul.tabs li .active, #jot-preview-link:hover, .comment-edit-submit-wrapper .fakelink:hover {
|
||||
#event-notice:hover, #birthday-notice:hover, ul.tabs li .active, .comment-edit-submit-wrapper .fakelink:hover {
|
||||
color: black;
|
||||
}
|
||||
|
||||
ul.tabs a:hover, #event-notice:hover, #birthday-notice:hover, ul.tabs li .active, #jot-preview-link:hover, .comment-edit-submit-wrapper .fakelink:hover {
|
||||
ul.tabs a:hover, #event-notice:hover, #birthday-notice:hover, ul.tabs li .active, .comment-edit-submit-wrapper .fakelink:hover {
|
||||
background-color: #e5e5e5;
|
||||
text-decoration: none;
|
||||
border: 1px solid darkgray;
|
||||
|
|
|
@ -46,7 +46,8 @@
|
|||
|
||||
</div>
|
||||
<input type="submit" onclick="post_comment({{$id}}); return false;" id="comment-edit-submit-{{$id}}" class="comment-edit-submit" name="submit" value="{{$submit}}" />
|
||||
<span onclick="preview_comment({{$id}});" id="comment-edit-preview-link-{{$id}}" class="fakelink">{{$preview}}</span>
|
||||
{{if $preview}}<input type="submit" onclick="preview_comment({{$id}}); return false;" id="comment-edit-preview-link-{{$id}}" class="comment-edit-submit" value="{{$preview}}" />{{/if}}
|
||||
<!-- {{if $preview}}<span onclick="preview_comment({{$id}});" id="comment-edit-preview-link-{{$id}}" class="fakelink">{{$preview}}</span>{{/if}} -->
|
||||
<div id="comment-edit-preview-{{$id}}" class="comment-edit-preview" style="display:none;"></div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -42,12 +42,12 @@
|
|||
|
||||
<li id="nav-site-linkmenu" class="nav-menu-icon"><a href="#" rel="#nav-site-menu"><span class="icon s22 gear"></span></a>
|
||||
<ul id="nav-site-menu" class="menu-popup">
|
||||
{{if $nav.manage}}<li><a class="{{$nav.manage.2}}" href="{{$nav.manage.0}}" title="{{$nav.manage.3}}">{{$nav.manage.1}}</a></li>{{/if}}
|
||||
{{if $nav.help}} <li><a class="{{$nav.help.2}}" target="friendica-help" href="{{$nav.help.0}}" title="{{$nav.help.3}}" >{{$nav.help.1}}</a></li>{{/if}}
|
||||
<li><a class="{{$nav.directory.2}}" href="{{$nav.directory.0}}" title="{{$nav.directory.3}}" >{{$nav.directory.1}}</a></li>
|
||||
<!-- {{if $nav.delegations}}<li><a class="{{$nav.delegations.2}}" href="{{$nav.delegations.0}}" title="{{$nav.delegations.3}}">{{$nav.delegations.1}}</a></li>{{/if}} -->
|
||||
{{if $nav.settings}}<li><a class="{{$nav.settings.2}}" href="{{$nav.settings.0}}" title="{{$nav.settings.3}}">{{$nav.settings.1}}</a></li>{{/if}}
|
||||
{{if $nav.admin}}<li><a class="{{$nav.admin.2}}" href="{{$nav.admin.0}}" title="{{$nav.admin.3}}" >{{$nav.admin.1}}</a></li>{{/if}}
|
||||
{{if $nav.settings}}<li><a class="{{$nav.settings.2}}" href="{{$nav.settings.0}}" title="{{$nav.settings.3}}">{{$nav.settings.1}}</a></li>{{/if}}
|
||||
{{if $nav.manage}}<li><a class="{{$nav.manage.2}}" href="{{$nav.manage.0}}" title="{{$nav.manage.3}}">{{$nav.manage.1}}</a></li>{{/if}}
|
||||
<li><a class="{{$nav.directory.2}}" href="{{$nav.directory.0}}" title="{{$nav.directory.3}}" >{{$nav.directory.1}}</a></li>
|
||||
{{if $nav.help}} <li><a class="{{$nav.help.2}}" target="friendica-help" href="{{$nav.help.0}}" title="{{$nav.help.3}}" >{{$nav.help.1}}</a></li>{{/if}}
|
||||
<!-- {{if $nav.delegations}}<li><a class="{{$nav.delegations.2}}" href="{{$nav.delegations.0}}" title="{{$nav.delegations.3}}">{{$nav.delegations.1}}</a></li>{{/if}} -->
|
||||
<li><a class="{{$nav.about.2}}" href="{{$nav.about.0}}" title="{{$nav.about.3}}" >{{$nav.about.1}}</a></li>
|
||||
|
||||
{{if $nav.logout}}<li><a class="menu-sep {{$nav.logout.2}}" href="{{$nav.logout.0}}" title="{{$nav.logout.3}}" >{{$nav.logout.1}}</a></li>{{/if}}
|
||||
|
|
Loading…
Reference in a new issue