rino: settings in admin, choose lowest common on notify

This commit is contained in:
Fabrixxm 2015-06-23 17:36:26 +02:00
parent 6fbb02fb93
commit 511c2d2c91
4 changed files with 29 additions and 14 deletions

View file

@ -1987,12 +1987,8 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
$rino = get_config('system','rino_encrypt');
$rino = intval($rino);
if(! $rino) {
$rino = 0;
} else {
$rino = 2;
}
@ -2104,6 +2100,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
if($page)
$postvars['page'] = $page;
if($rino>0 && $rino_remote_version>0 && (! $dissolve)) {
logger('rino version: '. $rino_remote_version);

View file

@ -379,6 +379,8 @@ function admin_page_site_post(&$a){
$proxy_disabled = ((x($_POST,'proxy_disabled')) ? True : False);
$old_pager = ((x($_POST,'old_pager')) ? True : False);
$only_tag_search = ((x($_POST,'only_tag_search')) ? True : False);
$rino = ((x($_POST,'rino')) ? intval($_POST['rino']) : 0);
if($ssl_policy != intval(get_config('system','ssl_policy'))) {
if($ssl_policy == SSL_POLICY_FULL) {
@ -432,6 +434,7 @@ function admin_page_site_post(&$a){
set_config('system','suppress_tags',$suppress_tags);
set_config('system','shortcut_icon',$shortcut_icon);
set_config('system','touch_icon',$touch_icon);
if ($banner==""){
// don't know why, but del_config doesn't work...
q("DELETE FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1",
@ -515,6 +518,9 @@ function admin_page_site_post(&$a){
set_config('system','old_pager', $old_pager);
set_config('system','only_tag_search', $only_tag_search);
set_config('system','rino_encrypt', $rino);
info( t('Site settings updated.') . EOL);
goaway($a->get_baseurl(true) . '/admin/site' );
return; // NOTREACHED
@ -695,6 +701,9 @@ function admin_page_site(&$a) {
'$only_tag_search' => array('only_tag_search', t("Only search in tags"), get_config('system','only_tag_search'), t("On large systems the text search can slow down the system extremely.")),
'$relocate_url' => array('relocate_url', t("New base url"), $a->get_baseurl(), "Change base url for this server. Sends relocate message to all DFRN contacts of all users."),
'$rino' => array('rino', t("RINO Encription"), intval(get_config('system','rino_encrypt')), t("Encription layer between nodes."), array("Disabled", "RINO1 (deprecated)", "RINO2")),
'$form_security_token' => get_form_security_token("admin_site")
));

View file

@ -134,6 +134,14 @@ function dfrn_notify_post(&$a) {
if(strlen($key)) {
// if local rino is lower than remote rino, abort: should not happen!
// but only for $remote_rino > 1, because old code did't send rino version
if ($rino_remote_version > 1 && $rino < $rino_remote) {
logger("rino version '$rino_remote' is lower than supported '$rino'");
xml_status(0,"rino version '$rino_remote' is lower than supported '$rino'");
}
$rawkey = hex2bin(trim($key));
logger('rino: md5 raw key: ' . md5($rawkey));
$final_key = '';
@ -208,6 +216,7 @@ function dfrn_notify_content(&$a) {
$dfrn_id = notags(trim($_GET['dfrn_id']));
$dfrn_version = (float) $_GET['dfrn_version'];
$rino_remote = ((x($_GET,'rino')) ? intval($_GET['rino']) : 0);
$type = "";
$last_update = "";
@ -288,12 +297,11 @@ function dfrn_notify_content(&$a) {
$rino = get_config('system','rino_encrypt');
$rino = intval($rino);
if(! $rino){
$rino = 0;
} else {
$rino = 2;
}
// if requested rino is lower than enabled local rino, lower local rino version
// if requested rino is higher than enabled local rino, reply with local rino
if ($rino_remote < $rino) $rino = $rino_remote;
if((($r[0]['rel']) && ($r[0]['rel'] != CONTACT_IS_SHARING)) || ($r[0]['page-flags'] == PAGE_COMMUNITY)) {
$perm = 'rw';

View file

@ -99,6 +99,7 @@
<div class="submit"><input type="submit" name="page_site" value="{{$submit|escape:'html'}}" /></div>
<h3>{{$advanced}}</h3>
{{include file="field_select.tpl" field=$rino}}
{{include file="field_checkbox.tpl" field=$no_utf}}
{{include file="field_checkbox.tpl" field=$verifyssl}}
{{include file="field_input.tpl" field=$proxy}}