diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2013-01-21 21:25:38 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2013-01-21 21:25:38 +0100 |
commit | 3ed7d5d5215de51294cff53c0f9c30cfc2484a4f (patch) | |
tree | 7f990ac9dcad33655cd8847449ee08fdc3ebaf29 | |
parent | 39da6f816600d18ece6f7dd7b9e72ef90f83586e (diff) | |
download | nextcloud-server-3ed7d5d5215de51294cff53c0f9c30cfc2484a4f.tar.gz nextcloud-server-3ed7d5d5215de51294cff53c0f9c30cfc2484a4f.zip |
Move isadmin to external file
-rw-r--r-- | settings/js/isadmin.php | 20 | ||||
-rw-r--r-- | settings/routes.php | 2 | ||||
-rw-r--r-- | settings/templates/users.php | 6 |
3 files changed, 25 insertions, 3 deletions
diff --git a/settings/js/isadmin.php b/settings/js/isadmin.php new file mode 100644 index 00000000000..8b31f8a7cf9 --- /dev/null +++ b/settings/js/isadmin.php @@ -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;"); +}
\ No newline at end of file diff --git a/settings/routes.php b/settings/routes.php index 9b5bf809230..bac1f61fc50 100644 --- a/settings/routes.php +++ b/settings/routes.php @@ -60,3 +60,5 @@ $this->create('settings_ajax_setloglevel', '/settings/ajax/setloglevel.php') ->actionInclude('settings/ajax/setloglevel.php'); $this->create('settings_ajax_setsecurity', '/settings/ajax/setsecurity.php') ->actionInclude('settings/ajax/setsecurity.php'); +$this->create('isadmin', '/settings/js/isadmin.js') + ->actionInclude('settings/js/isadmin.php'); diff --git a/settings/templates/users.php b/settings/templates/users.php index 6cbbca24049..5e588f9ead7 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -13,9 +13,9 @@ $items = array_flip($_['subadmingroups']); unset($items['admin']); $_['subadmingroups'] = array_flip($items); ?> -<script> -var isadmin = <?php echo $_['isadmin']?'true':'false'; ?>; -</script> + +<script type="text/javascript" src="<?php echo OC_Helper::linkToRoute('isadmin');?>"></script> + <div id="controls"> <form id="newuser" autocomplete="off"> <input id="newusername" type="text" placeholder="<?php echo $l->t('Name')?>" /> <input |