merge dev

This commit is contained in:
Mario Vavti 2017-02-06 10:08:05 +01:00
commit e70c87ed41
10 changed files with 101 additions and 59 deletions

View File

@ -491,7 +491,7 @@ END
print_info "letsenrypt exists already (nothing downloaded > no certificate created and registered)"
return 0
fi
git clone https://github.com/lukas2511/letsencrypt.sh $le_dir
git clone https://github.com/lukas2511/dehydrated $le_dir
cd $le_dir
# create config file for letsencrypt.sh
echo "WELLKNOWN=$le_dir" > $le_dir/config.sh
@ -511,9 +511,9 @@ END
then
die "Failed to load $url_http"
fi
# run letsencrypt.sh
# run script dehydrated
#
./letsencrypt.sh --cron --config $le_dir/config.sh
./dehydrated --cron --config $le_dir/config.sh
}
function configure_apache_for_https {
@ -730,8 +730,8 @@ echo "#" >> /var/www/$hubzilladaily
echo "echo \" \"" >> /var/www/$hubzilladaily
echo "echo \"+++ \$(date) +++\"" >> /var/www/$hubzilladaily
echo "echo \" \"" >> /var/www/$hubzilladaily
echo "echo \"\$(date) - renew certificat...\"" >> /var/www/$hubzilladaily
echo "bash $le_dir/letsencrypt.sh --cron --config $le_dir/config.sh" >> /var/www/$hubzilladaily
echo "echo \"\$(date) - renew certificate...\"" >> /var/www/$hubzilladaily
echo "bash $le_dir/dehydrated --cron --config $le_dir/config.sh" >> /var/www/$hubzilladaily
echo "#" >> /var/www/$hubzilladaily
echo "# stop hubzilla" >> /var/www/$hubzilladaily
echo "echo \"\$(date) - stoping apache and mysql...\"" >> /var/www/$hubzilladaily
@ -798,7 +798,7 @@ echo "echo \"\$(date) - db size...\"" >> /var/www/$hubzilladaily
echo "du -h /var/cache/rsnapshot/ | grep mysql/hubzilla" >> /var/www/$hubzilladaily
echo "#" >> /var/www/$hubzilladaily
echo "# update" >> /var/www/$hubzilladaily
echo "echo \"\$(date) - updating letsencrypt.sh...\"" >> /var/www/$hubzilladaily
echo "echo \"\$(date) - updating dehydrated...\"" >> /var/www/$hubzilladaily
echo "git -C /var/www/letsencrypt/ pull" >> /var/www/$hubzilladaily
echo "echo \"\$(date) - updating hubhilla core...\"" >> /var/www/$hubzilladaily
echo "git -C /var/www/html/ pull" >> /var/www/$hubzilladaily

View File

@ -70,13 +70,12 @@ class Rmagic extends \Zotlabs\Web\Controller {
function get() {
$o = replace_macros(get_markup_template('rmagic.tpl'),array(
'$title' => t('Remote Authentication'),
'$desc' => t('Enter your channel address (e.g. channel@example.com)'),
'$submit' => t('Authenticate')
));
return $o;
return replace_macros(get_markup_template('rmagic.tpl'),
[
'$title' => t('Remote Authentication'),
'$address' => [ 'address', t('Enter your channel address (e.g. channel@example.com)'), '', '' ],
'$submit' => t('Authenticate')
]
);
}
}

View File

@ -110,6 +110,39 @@ function diaspora_mention_callback($matches) {
}
function diaspora_mention_callback2($matches) {
$webbie = $matches[1] . '@' . $matches[2];
$link = '';
if($webbie) {
$r = q("select * from hubloc left join xchan on hubloc_hash = xchan_hash where hubloc_addr = '%s' limit 1",
dbesc($webbie)
);
if(! $r) {
$x = discover_by_webbie($webbie);
if($x) {
$r = q("select * from hubloc left join xchan on hubloc_hash = xchan_hash where hubloc_addr = '%s' limit 1",
dbesc($webbie)
);
}
}
if($r)
$link = $r[0]['xchan_url'];
}
$name = (($r) ? $r[0]['xchan_name'] : $matches[1]);
if(! $link)
$link = 'https://' . $matches[2] . '/u/' . $matches[1];
if($r && $r[0]['hubloc_network'] === 'zot')
return '@[zrl=' . $link . ']' . trim($name) . ((substr($matches[0],-1,1) === '+') ? '+' : '') . '[/zrl]' ;
else
return '@[url=' . $link . ']' . trim($name) . ((substr($matches[0],-1,1) === '+') ? '+' : '') . '[/url]' ;
}
/**
* @brief
@ -141,9 +174,11 @@ function markdown_to_bb($s, $use_zrl = false) {
// first try plustags
$s = preg_replace_callback('/\@\{(.+?)\; (.+?)\@(.+?)\}\+/','diaspora_mention_callback',$s);
$s = preg_replace_callback('/\@\{(.+?)\; (.+?)\@(.+?)\}/','diaspora_mention_callback',$s);
$s = preg_replace_callback('/\@\{(.+?)\@(.+?)\}\+/','diaspora_mention_callback2',$s);
$s = preg_replace_callback('/\@\{(.+?)\@(.+?)\}/','diaspora_mention_callback2',$s);
// Escaping the hash tags - doesn't always seem to work
// $s = preg_replace('/\#([^\s\#])/','\\#$1',$s);
// This seems to work

View File

@ -76,6 +76,20 @@ EOT;
$userinfo = null;
$nav['loginmenu']=array();
if($observer) {
$userinfo = array(
'icon' => $observer['xchan_photo_m'],
'name' => $observer['xchan_addr'],
);
}
elseif(! $_SESSION['authenticated']) {
$nav['remote_login'] = remote_login();
$nav['loginmenu'][] = Array('rmagic',t('Remote authentication'),'',t('Click to authenticate to your home hub'),'rmagic_nav_btn');
}
if(local_channel()) {
@ -114,6 +128,13 @@ EOT;
if(! get_account_id()) {
$nav['login'] = login(true,'main-login',false,false);
$nav['loginmenu'][] = Array('login',t('Login'),'',t('Sign in'),'login_nav_btn');
App::$page['content'] .= replace_macros(get_markup_template('nav_login.tpl'),
[
'$nav' => $nav,
'userinfo' => $userinfo
]
);
}
else
$nav['alogout'] = Array('logout',t('Logout'), "", t('End this session'),'logout_nav_btn');
@ -121,17 +142,6 @@ EOT;
}
if($observer) {
$userinfo = array(
'icon' => $observer['xchan_photo_m'],
'name' => $observer['xchan_addr'],
);
}
elseif(! $_SESSION['authenticated']) {
$nav['remote_login'] = remote_login();
$nav['loginmenu'][] = Array('rmagic',t('Remote authentication'),'',t('Click to authenticate to your home hub'),'rmagic_nav_btn');
}
$homelink = get_my_url();
if(! $homelink) {

View File

@ -3,8 +3,3 @@
margin-bottom: 50px;
}
#login-main {
max-width: 400px;
margin-left: auto;
margin-right: auto;
}

View File

@ -1,5 +0,0 @@
#login-main {
max-width: 400px;
margin-left: auto;
margin-right: auto;
}

View File

@ -2107,7 +2107,9 @@ dl.bb-dl > dd > li {
text-align: center;
}
#nav-login {
padding: 10px;
min-width: 300px;
}
#login-main, .rmagic-button {
max-width: 400px;
margin-top: 20px;
margin-left: auto;
margin-right: auto;
}

View File

@ -145,14 +145,8 @@
</li>
{{/if}}
{{if $nav.login && !$userinfo}}
<li class="hidden-xs">
<a href="#" title="{{$nav.loginmenu.0.3}}" id="{{$nav.loginmenu.0.4}}" onclick="openClose('nav-login'); return false;">{{$nav.loginmenu.0.1}} <span class="caret" id="loginmenu-caret"></span></a>
<div id="nav-login" class="dropdown-menu">
<div class="form-group">
{{$nav.login}}
</div>
{{$nav.remote_login}}
</div>
<li class="">
<a href="#" title="{{$nav.loginmenu.1.3}}" id="{{$nav.loginmenu.1.4}}" data-toggle="modal" data-target="#nav-login">{{$nav.loginmenu.1.1}}</a>
</li>
{{/if}}
{{if $nav.register}}
@ -186,6 +180,7 @@
{{$navapps}}
</ul>
</div>
{{if $nav.help.6}}
<div id="contextual-help-content" class="contextual-help-content">
{{$nav.help.5}}

15
view/tpl/nav_login.tpl Normal file
View File

@ -0,0 +1,15 @@
{{if $nav.login && !$userinfo}}
<div id="nav-login" class="modal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header"><h3>{{$nav.loginmenu.1.1}}</h3></div>
<div class="modal-body">
<div class="form-group">
{{$nav.login}}
{{$nav.remote_login}}
</div>
</div>
</div>
</div>
</div>
{{/if}}

View File

@ -1,13 +1,9 @@
<div class="generic-content-wrapper-styled">
<h3>{{$title}}</h3>
<form action="rmagic" method="post" >
<label for="rmagic-address" id="label-rmagic-address" class="rmagic-label">{{$desc}}</label>
<input type="text" maxlength="255" size="32" name="address" id="rmagic-address" class="rmagic-input" value="" />
<input type="submit" name="submit" id="rmagic-submit-button" value="{{$submit}}" />
<div id="rmagic-submit-end" class="rmagic-field-end"></div>
</form>
<h3>{{$title}}</h3>
<form action="rmagic" method="post" >
<div class="form-group">
{{include file="field_input.tpl" field=$address}}
<input class="btn btn-primary" type="submit" name="submit" id="rmagic-submit-button" value="{{$submit}}" />
</div>
</form>
</div>