standards

This commit is contained in:
Tobias Diekershoff 2017-04-25 18:57:50 +02:00
parent eeb72bd879
commit f146c85e75
2 changed files with 16 additions and 16 deletions

View File

@ -274,11 +274,11 @@ function admin_page_blocklist(App $a) {
$blocklist = Config::get('system', 'blocklist'); $blocklist = Config::get('system', 'blocklist');
$blocklistform = array(); $blocklistform = array();
if (is_array($blocklist)) { if (is_array($blocklist)) {
foreach($blocklist as $id =>$b) { foreach($blocklist as $id => $b) {
$blocklistform[] = Array( $blocklistform[] = array(
'url' => Array("url[$id]", t('Blocked URL'), $b['URL'], '', t('The blocked URL'), 'required', '', ''), 'url' => array("url[$id]", t('Blocked URL'), $b['URL'], '', t('The blocked URL'), 'required', '', ''),
'reason' => Array("reason[$id]", t("Reason for the block"), $b['reason'], t('The reason why you blocked this URL.').'('.$b['URL'].')', 'required', '', ''), 'reason' => array("reason[$id]", t("Reason for the block"), $b['reason'], t('The reason why you blocked this URL.').'('.$b['URL'].')', 'required', '', ''),
'delete' => Array("delete[$id]", t("Delete UFL").' ('.$b['URL'].')', False , "Check to delete this entry from the blocklist") 'delete' => array("delete[$id]", t("Delete UFL").' ('.$b['URL'].')', False , "Check to delete this entry from the blocklist")
); );
} }
} }
@ -289,8 +289,8 @@ function admin_page_blocklist(App $a) {
'$intro' => t('This page can be used to define a black list of servers from the federated network that are not allowed to interact with your node. For all entered URLs you should also give a reason, why you have blocked the remote server.'), '$intro' => t('This page can be used to define a black list of servers from the federated network that are not allowed to interact with your node. For all entered URLs you should also give a reason, why you have blocked the remote server.'),
'$public' => t('The list of blocked servers will be made publically available on the /friendica page so that your users and people investigating communication problems can find the reason easily.'), '$public' => t('The list of blocked servers will be made publically available on the /friendica page so that your users and people investigating communication problems can find the reason easily.'),
'$addtitle' => t('Add new entry to block list'), '$addtitle' => t('Add new entry to block list'),
'$newurl' => Array('newentry_url', t('Server URL'), '', t('The URL of the new server to add to the block list. Do not include the protocol to the URL.'), 'required', '', ''), '$newurl' => array('newentry_url', t('Server URL'), '', t('The URL of the new server to add to the block list. Do not include the protocol to the URL.'), 'required', '', ''),
'$newreason' => Array('newentry_reason', t('Block reason'), '', t('The reason why you blocked this URL.'), 'required', '', ''), '$newreason' => array('newentry_reason', t('Block reason'), '', t('The reason why you blocked this URL.'), 'required', '', ''),
'$submit' => t('Add Entry'), '$submit' => t('Add Entry'),
'$savechanges' => t('Save changes to the blocklist'), '$savechanges' => t('Save changes to the blocklist'),
'$currenttitle' => t('Current Entries in the Blocklist'), '$currenttitle' => t('Current Entries in the Blocklist'),
@ -299,7 +299,7 @@ function admin_page_blocklist(App $a) {
'$delentry' => t('Delete entry from blocklist'), '$delentry' => t('Delete entry from blocklist'),
'$entries' => $blocklistform, '$entries' => $blocklistform,
'$baseurl' => App::get_baseurl(true), '$baseurl' => App::get_baseurl(true),
'$confirm_delete' => t('Delete entriy from blocklist?'), '$confirm_delete' => t('Delete entry from blocklist?'),
'$form_security_token' => get_form_security_token("admin_blocklist") '$form_security_token' => get_form_security_token("admin_blocklist")
)); ));
} }
@ -319,7 +319,7 @@ function admin_page_blocklist_post(App $a) {
if (x($_POST['page_blocklist_save'])) { if (x($_POST['page_blocklist_save'])) {
// Add new item to blocklist // Add new item to blocklist
$blocklist = get_config('system', 'blocklist'); $blocklist = get_config('system', 'blocklist');
$blocklist[] = Array( $blocklist[] = array(
'URL' => notags(trim($_POST['newentry_url'])), 'URL' => notags(trim($_POST['newentry_url'])),
'reason' => notags(trim($_POST['newentry_reason'])) 'reason' => notags(trim($_POST['newentry_reason']))
); );
@ -332,7 +332,7 @@ function admin_page_blocklist_post(App $a) {
$URL = notags(trim($URL)); $URL = notags(trim($URL));
$reason = notags(trim($_POST['reason'][$id])); $reason = notags(trim($_POST['reason'][$id]));
if (!x($_POST['delete'][$id])) { if (!x($_POST['delete'][$id])) {
$blocklist[] = Array( $blocklist[] = array(
'URL' => $URL, 'URL' => $URL,
'reason' => $reason 'reason' => $reason
); );

View File

@ -1,16 +1,16 @@
<script> <script>
function confirm_delete(uname){ function confirm_delete(uname){
return confirm( "{{$confirm_delete}}".format(uname)); return confirm("{{$confirm_delete}}".format(uname));
} }
</script> </script>
<div id="adminpage"> <div id="adminpage">
<h1>{{$title}} - {{$page}}</h1> <h1>{{$title}} - {{$page}}</h1>
<p>{{$intro}}</p> <p>{{$intro}}</p>
<p>{{$public}}</p> <p>{{$public}}</p>
<h2>{{$addtitle}}</h2> <h2>{{$addtitle}}</h2>
<form action="{{$baseurl}}/admin/blocklist" method="post"> <form action="{{$baseurl}}/admin/blocklist" method="post">
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'> <input type="hidden" name="form_security_token" value="{{$form_security_token}}">
{{include file="field_input.tpl" field=$newurl}} {{include file="field_input.tpl" field=$newurl}}
{{include file="field_input.tpl" field=$newreason}} {{include file="field_input.tpl" field=$newreason}}
<div class="submit"><input type="submit" name="page_blocklist_save" value="{{$submit}}" /></div> <div class="submit"><input type="submit" name="page_blocklist_save" value="{{$submit}}" /></div>
@ -20,7 +20,7 @@
<h2>{{$currenttitle}}</h2> <h2>{{$currenttitle}}</h2>
<p>{{$currentintro}}</p> <p>{{$currentintro}}</p>
<form action="{{$baseurl}}/admin/blocklist" method="post"> <form action="{{$baseurl}}/admin/blocklist" method="post">
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'> <input type="hidden" name="form_security_token" value="{{$form_security_token}}">
{{foreach $entries as $e}} {{foreach $entries as $e}}
{{include file="field_input.tpl" field=$e.url}} {{include file="field_input.tpl" field=$e.url}}
{{include file="field_input.tpl" field=$e.reason}} {{include file="field_input.tpl" field=$e.reason}}
@ -29,5 +29,5 @@
<div class="submit"><input type="submit" name="page_blocklist_edit" value="{{$savechanges}}" /></div> <div class="submit"><input type="submit" name="page_blocklist_edit" value="{{$savechanges}}" /></div>
{{/if}} {{/if}}
</form> </form>
</div> </div>