Move isadmin to external file
This commit is contained in:
parent
39da6f8166
commit
3ed7d5d521
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2013 Lukas Reschke <lukas@statuscode.ch>
|
||||||
|
* This file is licensed under the Affero General Public License version 3 or
|
||||||
|
* later.
|
||||||
|
* See the COPYING-README file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Set the content type to Javascript
|
||||||
|
header("Content-type: text/javascript");
|
||||||
|
|
||||||
|
// Disallow caching
|
||||||
|
header("Cache-Control: no-cache, must-revalidate");
|
||||||
|
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
|
||||||
|
|
||||||
|
if (OC_User::isAdminUser(OC_User::getUser())) {
|
||||||
|
echo("var isadmin = true;");
|
||||||
|
} else {
|
||||||
|
echo("var isadmin = false;");
|
||||||
|
}
|
|
@ -60,3 +60,5 @@ $this->create('settings_ajax_setloglevel', '/settings/ajax/setloglevel.php')
|
||||||
->actionInclude('settings/ajax/setloglevel.php');
|
->actionInclude('settings/ajax/setloglevel.php');
|
||||||
$this->create('settings_ajax_setsecurity', '/settings/ajax/setsecurity.php')
|
$this->create('settings_ajax_setsecurity', '/settings/ajax/setsecurity.php')
|
||||||
->actionInclude('settings/ajax/setsecurity.php');
|
->actionInclude('settings/ajax/setsecurity.php');
|
||||||
|
$this->create('isadmin', '/settings/js/isadmin.js')
|
||||||
|
->actionInclude('settings/js/isadmin.php');
|
||||||
|
|
|
@ -13,9 +13,9 @@ $items = array_flip($_['subadmingroups']);
|
||||||
unset($items['admin']);
|
unset($items['admin']);
|
||||||
$_['subadmingroups'] = array_flip($items);
|
$_['subadmingroups'] = array_flip($items);
|
||||||
?>
|
?>
|
||||||
<script>
|
|
||||||
var isadmin = <?php echo $_['isadmin']?'true':'false'; ?>;
|
<script type="text/javascript" src="<?php echo OC_Helper::linkToRoute('isadmin');?>"></script>
|
||||||
</script>
|
|
||||||
<div id="controls">
|
<div id="controls">
|
||||||
<form id="newuser" autocomplete="off">
|
<form id="newuser" autocomplete="off">
|
||||||
<input id="newusername" type="text" placeholder="<?php echo $l->t('Name')?>" /> <input
|
<input id="newusername" type="text" placeholder="<?php echo $l->t('Name')?>" /> <input
|
||||||
|
|
Loading…
Reference in New Issue