aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib/plugins/acl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/plugins/acl')
-rw-r--r--lib/plugins/acl/action.php46
-rw-r--r--lib/plugins/acl/admin.php435
-rw-r--r--lib/plugins/acl/lang/ar/lang.php3
-rw-r--r--lib/plugins/acl/lang/bg/lang.php2
-rw-r--r--lib/plugins/acl/lang/ca/lang.php6
-rw-r--r--lib/plugins/acl/lang/da/lang.php5
-rw-r--r--lib/plugins/acl/lang/el/lang.php2
-rw-r--r--lib/plugins/acl/lang/fa/lang.php3
-rw-r--r--lib/plugins/acl/lang/fi/lang.php5
-rw-r--r--lib/plugins/acl/lang/id/lang.php2
-rw-r--r--lib/plugins/acl/lang/is/lang.php3
-rw-r--r--lib/plugins/acl/lang/ja/lang.php6
-rw-r--r--lib/plugins/acl/lang/km/lang.php8
-rw-r--r--lib/plugins/acl/lang/lt/lang.php4
-rw-r--r--lib/plugins/acl/lang/no/lang.php3
-rw-r--r--lib/plugins/acl/lang/pt/help.txt11
-rw-r--r--lib/plugins/acl/lang/pt/lang.php31
-rw-r--r--lib/plugins/acl/lang/ro/lang.php5
-rw-r--r--lib/plugins/acl/lang/sr/lang.php3
-rw-r--r--lib/plugins/acl/lang/th/lang.php3
-rw-r--r--lib/plugins/acl/lang/tr/lang.php4
-rw-r--r--lib/plugins/acl/lang/vi/help.txt14
-rw-r--r--lib/plugins/acl/lang/vi/lang.php33
-rw-r--r--lib/plugins/acl/remote.php53
-rw-r--r--lib/plugins/acl/script.js4
25 files changed, 373 insertions, 321 deletions
diff --git a/lib/plugins/acl/action.php b/lib/plugins/acl/action.php
index a7226f598..86e587093 100644
--- a/lib/plugins/acl/action.php
+++ b/lib/plugins/acl/action.php
@@ -6,13 +6,11 @@
* @author Andreas Gohr <andi@splitbrain.org>
*/
-// must be run within Dokuwiki
-if(!defined('DOKU_INC')) die();
-
/**
* Register handler
*/
-class action_plugin_acl extends DokuWiki_Action_Plugin {
+class action_plugin_acl extends DokuWiki_Action_Plugin
+{
/**
* Registers a callback function for a given event
@@ -20,10 +18,10 @@ class action_plugin_acl extends DokuWiki_Action_Plugin {
* @param Doku_Event_Handler $controller DokuWiki's event controller object
* @return void
*/
- public function register(Doku_Event_Handler $controller) {
-
- $controller->register_hook('AJAX_CALL_UNKNOWN', 'BEFORE', $this, 'handle_ajax_call_acl');
+ public function register(Doku_Event_Handler $controller)
+ {
+ $controller->register_hook('AJAX_CALL_UNKNOWN', 'BEFORE', $this, 'handleAjaxCallAcl');
}
/**
@@ -33,9 +31,9 @@ class action_plugin_acl extends DokuWiki_Action_Plugin {
* @param mixed $param empty
* @return void
*/
-
- public function handle_ajax_call_acl(Doku_Event &$event, $param) {
- if($event->data !== 'plugin_acl') {
+ public function handleAjaxCallAcl(Doku_Event $event, $param)
+ {
+ if ($event->data !== 'plugin_acl') {
return;
}
$event->stopPropagation();
@@ -44,44 +42,44 @@ class action_plugin_acl extends DokuWiki_Action_Plugin {
global $ID;
global $INPUT;
- if(!auth_isadmin()) {
+ /** @var $acl admin_plugin_acl */
+ $acl = plugin_load('admin', 'acl');
+ if (!$acl->isAccessibleByCurrentUser()) {
echo 'for admins only';
return;
}
- if(!checkSecurityToken()) {
+ if (!checkSecurityToken()) {
echo 'CRSF Attack';
return;
}
$ID = getID();
-
- /** @var $acl admin_plugin_acl */
- $acl = plugin_load('admin', 'acl');
$acl->handle();
$ajax = $INPUT->str('ajax');
header('Content-Type: text/html; charset=utf-8');
- if($ajax == 'info') {
- $acl->_html_info();
- } elseif($ajax == 'tree') {
-
+ if ($ajax == 'info') {
+ $acl->printInfo();
+ } elseif ($ajax == 'tree') {
$ns = $INPUT->str('ns');
- if($ns == '*') {
+ if ($ns == '*') {
$ns = '';
}
$ns = cleanID($ns);
$lvl = count(explode(':', $ns));
$ns = utf8_encodeFN(str_replace(':', '/', $ns));
- $data = $acl->_get_tree($ns, $ns);
+ $data = $acl->makeTree($ns, $ns);
- foreach(array_keys($data) as $item) {
+ foreach (array_keys($data) as $item) {
$data[$item]['level'] = $lvl + 1;
}
echo html_buildlist(
- $data, 'acl', array($acl, '_html_list_acl'),
- array($acl, '_html_li_acl')
+ $data,
+ 'acl',
+ array($acl, 'makeTreeItem'),
+ array($acl, 'makeListItem')
);
}
}
diff --git a/lib/plugins/acl/admin.php b/lib/plugins/acl/admin.php
index 6edc6c621..02842fd4b 100644
--- a/lib/plugins/acl/admin.php
+++ b/lib/plugins/acl/admin.php
@@ -7,16 +7,15 @@
* @author Anika Henke <anika@selfthinker.org> (concepts)
* @author Frank Schubert <frank@schokilade.de> (old version)
*/
-// must be run within Dokuwiki
-if(!defined('DOKU_INC')) die();
/**
* All DokuWiki plugins to extend the admin function
* need to inherit from this class
*/
-class admin_plugin_acl extends DokuWiki_Admin_Plugin {
- var $acl = null;
- var $ns = null;
+class admin_plugin_acl extends DokuWiki_Admin_Plugin
+{
+ public $acl = null;
+ protected $ns = null;
/**
* The currently selected item, associative array with id and type.
* Populated from (in this order):
@@ -25,22 +24,24 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
* $ns
* $ID
*/
- var $current_item = null;
- var $who = '';
- var $usersgroups = array();
- var $specials = array();
+ protected $current_item = null;
+ protected $who = '';
+ protected $usersgroups = array();
+ protected $specials = array();
/**
* return prompt for admin menu
*/
- function getMenuText($language) {
+ public function getMenuText($language)
+ {
return $this->getLang('admin_acl');
}
/**
* return sort order for position in admin menu
*/
- function getMenuSort() {
+ public function getMenuSort()
+ {
return 1;
}
@@ -51,7 +52,8 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
- function handle() {
+ public function handle()
+ {
global $AUTH_ACL;
global $ID;
global $auth;
@@ -62,9 +64,9 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
$AUTH_ACL = file($config_cascade['acl']['default']);
// namespace given?
- if($INPUT->str('ns') == '*'){
+ if ($INPUT->str('ns') == '*') {
$this->ns = '*';
- }else{
+ } else {
$this->ns = cleanID($INPUT->str('ns'));
}
@@ -80,78 +82,78 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
// user or group choosen?
$who = trim($INPUT->str('acl_w'));
- if($INPUT->str('acl_t') == '__g__' && $who){
- $this->who = '@'.ltrim($auth->cleanGroup($who),'@');
- }elseif($INPUT->str('acl_t') == '__u__' && $who){
- $this->who = ltrim($who,'@');
- if($this->who != '%USER%' && $this->who != '%GROUP%'){ #keep wildcard as is
+ if ($INPUT->str('acl_t') == '__g__' && $who) {
+ $this->who = '@'.ltrim($auth->cleanGroup($who), '@');
+ } elseif ($INPUT->str('acl_t') == '__u__' && $who) {
+ $this->who = ltrim($who, '@');
+ if ($this->who != '%USER%' && $this->who != '%GROUP%') { #keep wildcard as is
$this->who = $auth->cleanUser($this->who);
}
- }elseif($INPUT->str('acl_t') &&
+ } elseif ($INPUT->str('acl_t') &&
$INPUT->str('acl_t') != '__u__' &&
- $INPUT->str('acl_t') != '__g__'){
+ $INPUT->str('acl_t') != '__g__') {
$this->who = $INPUT->str('acl_t');
- }elseif($who){
+ } elseif ($who) {
$this->who = $who;
}
// handle modifications
- if($INPUT->has('cmd') && checkSecurityToken()){
+ if ($INPUT->has('cmd') && checkSecurityToken()) {
$cmd = $INPUT->extract('cmd')->str('cmd');
// scope for modifications
- if($this->ns){
- if($this->ns == '*'){
+ if ($this->ns) {
+ if ($this->ns == '*') {
$scope = '*';
- }else{
+ } else {
$scope = $this->ns.':*';
}
- }else{
+ } else {
$scope = $ID;
}
- if($cmd == 'save' && $scope && $this->who && $INPUT->has('acl')){
+ if ($cmd == 'save' && $scope && $this->who && $INPUT->has('acl')) {
// handle additions or single modifications
- $this->_acl_del($scope, $this->who);
- $this->_acl_add($scope, $this->who, $INPUT->int('acl'));
- }elseif($cmd == 'del' && $scope && $this->who){
+ $this->deleteACL($scope, $this->who);
+ $this->addOrUpdateACL($scope, $this->who, $INPUT->int('acl'));
+ } elseif ($cmd == 'del' && $scope && $this->who) {
// handle single deletions
- $this->_acl_del($scope, $this->who);
- }elseif($cmd == 'update'){
+ $this->deleteACL($scope, $this->who);
+ } elseif ($cmd == 'update') {
$acl = $INPUT->arr('acl');
// handle update of the whole file
- foreach($INPUT->arr('del') as $where => $names){
+ foreach ($INPUT->arr('del') as $where => $names) {
// remove all rules marked for deletion
- foreach($names as $who)
+ foreach ($names as $who)
unset($acl[$where][$who]);
}
// prepare lines
$lines = array();
// keep header
- foreach($AUTH_ACL as $line){
- if($line{0} == '#'){
+ foreach ($AUTH_ACL as $line) {
+ if ($line[0] == '#') {
$lines[] = $line;
- }else{
+ } else {
break;
}
}
// re-add all rules
- foreach($acl as $where => $opt){
- foreach($opt as $who => $perm){
+ foreach ($acl as $where => $opt) {
+ foreach ($opt as $who => $perm) {
if ($who[0]=='@') {
if ($who!='@ALL') {
- $who = '@'.ltrim($auth->cleanGroup($who),'@');
+ $who = '@'.ltrim($auth->cleanGroup($who), '@');
}
- } elseif ($who != '%USER%' && $who != '%GROUP%'){ #keep wildcard as is
+ } elseif ($who != '%USER%' && $who != '%GROUP%') { #keep wildcard as is
$who = $auth->cleanUser($who);
}
- $who = auth_nameencode($who,true);
+ $who = auth_nameencode($who, true);
$lines[] = "$where\t$who\t$perm\n";
}
}
// save it
- io_saveFile($config_cascade['acl']['default'], join('',$lines));
+ io_saveFile($config_cascade['acl']['default'], join('', $lines));
}
// reload ACL config
@@ -159,7 +161,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
}
// initialize ACL array
- $this->_init_acl_config();
+ $this->initAclConfig();
}
/**
@@ -171,29 +173,30 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
* @author Frank Schubert <frank@schokilade.de>
* @author Andreas Gohr <andi@splitbrain.org>
*/
- function html() {
+ public function html()
+ {
echo '<div id="acl_manager">'.NL;
echo '<h1>'.$this->getLang('admin_acl').'</h1>'.NL;
echo '<div class="level1">'.NL;
echo '<div id="acl__tree">'.NL;
- $this->_html_explorer();
+ $this->makeExplorer();
echo '</div>'.NL;
echo '<div id="acl__detail">'.NL;
- $this->_html_detail();
+ $this->printDetail();
echo '</div>'.NL;
echo '</div>'.NL;
echo '<div class="clearer"></div>';
echo '<h2>'.$this->getLang('current').'</h2>'.NL;
echo '<div class="level2">'.NL;
- $this->_html_table();
+ $this->printAclTable();
echo '</div>'.NL;
echo '<div class="footnotes"><div class="fn">'.NL;
echo '<sup><a id="fn__1" class="fn_bot" href="#fnt__1">1)</a></sup>'.NL;
- echo $this->getLang('p_include');
+ echo '<div class="content">'.$this->getLang('p_include').'</div>';
echo '</div></div>';
echo '</div>'.NL;
@@ -204,15 +207,16 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
- function _get_opts($addopts=null){
+ protected function getLinkOptions($addopts = null)
+ {
$opts = array(
'do'=>'admin',
'page'=>'acl',
);
- if($this->ns) $opts['ns'] = $this->ns;
- if($this->who) $opts['acl_w'] = $this->who;
+ if ($this->ns) $opts['ns'] = $this->ns;
+ if ($this->who) $opts['acl_w'] = $this->who;
- if(is_null($addopts)) return $opts;
+ if (is_null($addopts)) return $opts;
return array_merge($opts, $addopts);
}
@@ -221,54 +225,61 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
- function _html_explorer(){
+ protected function makeExplorer()
+ {
global $conf;
global $ID;
global $lang;
$ns = $this->ns;
- if(empty($ns)){
- $ns = dirname(str_replace(':','/',$ID));
- if($ns == '.') $ns ='';
- }elseif($ns == '*'){
+ if (empty($ns)) {
+ $ns = dirname(str_replace(':', '/', $ID));
+ if ($ns == '.') $ns ='';
+ } elseif ($ns == '*') {
$ns ='';
}
- $ns = utf8_encodeFN(str_replace(':','/',$ns));
+ $ns = utf8_encodeFN(str_replace(':', '/', $ns));
- $data = $this->_get_tree($ns);
+ $data = $this->makeTree($ns);
// wrap a list with the root level around the other namespaces
array_unshift($data, array( 'level' => 0, 'id' => '*', 'type' => 'd',
'open' =>'true', 'label' => '['.$lang['mediaroot'].']'));
- echo html_buildlist($data,'acl',
- array($this,'_html_list_acl'),
- array($this,'_html_li_acl'));
-
+ echo html_buildlist(
+ $data,
+ 'acl',
+ array($this, 'makeTreeItem'),
+ array($this, 'makeListItem')
+ );
}
/**
* get a combined list of media and page files
*
+ * also called via AJAX
+ *
* @param string $folder an already converted filesystem folder of the current namespace
- * @param string $limit limit the search to this folder
+ * @param string $limit limit the search to this folder
+ * @return array
*/
- function _get_tree($folder,$limit=''){
+ public function makeTree($folder, $limit = '')
+ {
global $conf;
// read tree structure from pages and media
$data = array();
- search($data,$conf['datadir'],'search_index',array('ns' => $folder),$limit);
+ search($data, $conf['datadir'], 'search_index', array('ns' => $folder), $limit);
$media = array();
- search($media,$conf['mediadir'],'search_index',array('ns' => $folder, 'nofiles' => true),$limit);
- $data = array_merge($data,$media);
+ search($media, $conf['mediadir'], 'search_index', array('ns' => $folder, 'nofiles' => true), $limit);
+ $data = array_merge($data, $media);
unset($media);
// combine by sorting and removing duplicates
- usort($data,array($this,'_tree_sort'));
+ usort($data, array($this, 'treeSort'));
$count = count($data);
- if($count>0) for($i=1; $i<$count; $i++){
- if($data[$i-1]['id'] == $data[$i]['id'] && $data[$i-1]['type'] == $data[$i]['type']) {
+ if ($count>0) for ($i=1; $i<$count; $i++) {
+ if ($data[$i-1]['id'] == $data[$i]['id'] && $data[$i-1]['type'] == $data[$i]['type']) {
unset($data[$i]);
$i++; // duplicate found, next $i can't be a duplicate, so skip forward one
}
@@ -281,7 +292,8 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
*
* Sorts the combined trees of media and page files
*/
- function _tree_sort($a,$b){
+ public function treeSort($a, $b)
+ {
// handle the trivial cases first
if ($a['id'] == '') return -1;
if ($b['id'] == '') return 1;
@@ -315,6 +327,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
// before that other part.
if (empty($a_ids)) return ($a['type'] == 'd') ? -1 : 1;
if (empty($b_ids)) return ($b['type'] == 'd') ? 1 : -1;
+ return 0; //shouldn't happen
}
/**
@@ -323,20 +336,21 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
- function _html_detail(){
+ protected function printDetail()
+ {
global $ID;
echo '<form action="'.wl().'" method="post" accept-charset="utf-8"><div class="no">'.NL;
echo '<div id="acl__user">';
echo $this->getLang('acl_perms').' ';
- $inl = $this->_html_select();
- echo '<input type="text" name="acl_w" class="edit" value="'.(($inl)?'':hsc(ltrim($this->who,'@'))).'" />'.NL;
+ $inl = $this->makeSelect();
+ echo '<input type="text" name="acl_w" class="edit" value="'.(($inl)?'':hsc(ltrim($this->who, '@'))).'" />'.NL;
echo '<button type="submit">'.$this->getLang('btn_select').'</button>'.NL;
echo '</div>'.NL;
echo '<div id="acl__info">';
- $this->_html_info();
+ $this->printInfo();
echo '</div>';
echo '<input type="hidden" name="ns" value="'.hsc($this->ns).'" />'.NL;
@@ -349,23 +363,26 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
/**
* Print info and editor
+ *
+ * also loaded via Ajax
*/
- function _html_info(){
+ public function printInfo()
+ {
global $ID;
- if($this->who){
- $current = $this->_get_exact_perm();
+ if ($this->who) {
+ $current = $this->getExactPermisson();
// explain current permissions
- $this->_html_explain($current);
+ $this->printExplanation($current);
// load editor
- $this->_html_acleditor($current);
- }else{
+ $this->printAclEditor($current);
+ } else {
echo '<p>';
- if($this->ns){
- printf($this->getLang('p_choose_ns'),hsc($this->ns));
- }else{
- printf($this->getLang('p_choose_id'),hsc($ID));
+ if ($this->ns) {
+ printf($this->getLang('p_choose_ns'), hsc($this->ns));
+ } else {
+ printf($this->getLang('p_choose_id'), hsc($ID));
}
echo '</p>';
@@ -378,21 +395,22 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
- function _html_acleditor($current){
+ protected function printAclEditor($current)
+ {
global $lang;
echo '<fieldset>';
- if(is_null($current)){
+ if (is_null($current)) {
echo '<legend>'.$this->getLang('acl_new').'</legend>';
- }else{
+ } else {
echo '<legend>'.$this->getLang('acl_mod').'</legend>';
}
- echo $this->_html_checkboxes($current,empty($this->ns),'acl');
+ echo $this->makeCheckboxes($current, empty($this->ns), 'acl');
- if(is_null($current)){
+ if (is_null($current)) {
echo '<button type="submit" name="cmd[save]">'.$lang['btn_save'].'</button>'.NL;
- }else{
+ } else {
echo '<button type="submit" name="cmd[save]">'.$lang['btn_update'].'</button>'.NL;
echo '<button type="submit" name="cmd[del]">'.$lang['btn_delete'].'</button>'.NL;
}
@@ -405,7 +423,8 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
- function _html_explain($current){
+ protected function printExplanation($current)
+ {
global $ID;
global $auth;
@@ -413,69 +432,69 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
$ns = $this->ns;
// prepare where to check
- if($ns){
- if($ns == '*'){
+ if ($ns) {
+ if ($ns == '*') {
$check='*';
- }else{
+ } else {
$check=$ns.':*';
}
- }else{
+ } else {
$check = $ID;
}
// prepare who to check
- if($who{0} == '@'){
+ if ($who[0] == '@') {
$user = '';
- $groups = array(ltrim($who,'@'));
- }else{
+ $groups = array(ltrim($who, '@'));
+ } else {
$user = $who;
$info = $auth->getUserData($user);
- if($info === false){
+ if ($info === false) {
$groups = array();
- }else{
+ } else {
$groups = $info['grps'];
}
}
// check the permissions
- $perm = auth_aclcheck($check,$user,$groups);
+ $perm = auth_aclcheck($check, $user, $groups);
// build array of named permissions
$names = array();
- if($perm){
- if($ns){
- if($perm >= AUTH_DELETE) $names[] = $this->getLang('acl_perm16');
- if($perm >= AUTH_UPLOAD) $names[] = $this->getLang('acl_perm8');
- if($perm >= AUTH_CREATE) $names[] = $this->getLang('acl_perm4');
+ if ($perm) {
+ if ($ns) {
+ if ($perm >= AUTH_DELETE) $names[] = $this->getLang('acl_perm16');
+ if ($perm >= AUTH_UPLOAD) $names[] = $this->getLang('acl_perm8');
+ if ($perm >= AUTH_CREATE) $names[] = $this->getLang('acl_perm4');
}
- if($perm >= AUTH_EDIT) $names[] = $this->getLang('acl_perm2');
- if($perm >= AUTH_READ) $names[] = $this->getLang('acl_perm1');
+ if ($perm >= AUTH_EDIT) $names[] = $this->getLang('acl_perm2');
+ if ($perm >= AUTH_READ) $names[] = $this->getLang('acl_perm1');
$names = array_reverse($names);
- }else{
+ } else {
$names[] = $this->getLang('acl_perm0');
}
// print permission explanation
echo '<p>';
- if($user){
- if($ns){
- printf($this->getLang('p_user_ns'),hsc($who),hsc($ns),join(', ',$names));
- }else{
- printf($this->getLang('p_user_id'),hsc($who),hsc($ID),join(', ',$names));
+ if ($user) {
+ if ($ns) {
+ printf($this->getLang('p_user_ns'), hsc($who), hsc($ns), join(', ', $names));
+ } else {
+ printf($this->getLang('p_user_id'), hsc($who), hsc($ID), join(', ', $names));
}
- }else{
- if($ns){
- printf($this->getLang('p_group_ns'),hsc(ltrim($who,'@')),hsc($ns),join(', ',$names));
- }else{
- printf($this->getLang('p_group_id'),hsc(ltrim($who,'@')),hsc($ID),join(', ',$names));
+ } else {
+ if ($ns) {
+ printf($this->getLang('p_group_ns'), hsc(ltrim($who, '@')), hsc($ns), join(', ', $names));
+ } else {
+ printf($this->getLang('p_group_id'), hsc(ltrim($who, '@')), hsc($ID), join(', ', $names));
}
}
echo '</p>';
// add note if admin
- if($perm == AUTH_ADMIN){
+ if ($perm == AUTH_ADMIN) {
echo '<p>'.$this->getLang('p_isadmin').'</p>';
- }elseif(is_null($current)){
+ } elseif (is_null($current)) {
echo '<p>'.$this->getLang('p_inherited').'</p>';
}
}
@@ -488,46 +507,57 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
- function _html_list_acl($item){
+ public function makeTreeItem($item)
+ {
$ret = '';
// what to display
- if(!empty($item['label'])){
+ if (!empty($item['label'])) {
$base = $item['label'];
- }else{
+ } else {
$base = ':'.$item['id'];
- $base = substr($base,strrpos($base,':')+1);
+ $base = substr($base, strrpos($base, ':')+1);
}
// highlight?
- if( ($item['type']== $this->current_item['type'] && $item['id'] == $this->current_item['id'])) {
+ if (($item['type']== $this->current_item['type'] && $item['id'] == $this->current_item['id'])) {
$cl = ' cur';
} else {
$cl = '';
}
// namespace or page?
- if($item['type']=='d'){
- if($item['open']){
+ if ($item['type']=='d') {
+ if ($item['open']) {
$img = DOKU_BASE.'lib/images/minus.gif';
$alt = '−';
- }else{
+ } else {
$img = DOKU_BASE.'lib/images/plus.gif';
$alt = '+';
}
$ret .= '<img src="'.$img.'" alt="'.$alt.'" />';
- $ret .= '<a href="'.wl('',$this->_get_opts(array('ns'=>$item['id'],'sectok'=>getSecurityToken()))).'" class="idx_dir'.$cl.'">';
+ $ret .= '<a href="'.
+ wl('', $this->getLinkOptions(array('ns'=> $item['id'], 'sectok'=>getSecurityToken()))).
+ '" class="idx_dir'.$cl.'">';
$ret .= $base;
$ret .= '</a>';
- }else{
- $ret .= '<a href="'.wl('',$this->_get_opts(array('id'=>$item['id'],'ns'=>'','sectok'=>getSecurityToken()))).'" class="wikilink1'.$cl.'">';
+ } else {
+ $ret .= '<a href="'.
+ wl('', $this->getLinkOptions(array('id'=> $item['id'], 'ns'=>'', 'sectok'=>getSecurityToken()))).
+ '" class="wikilink1'.$cl.'">';
$ret .= noNS($item['id']);
$ret .= '</a>';
}
return $ret;
}
-
- function _html_li_acl($item){
+ /**
+ * List Item formatter
+ *
+ * @param array $item
+ * @return string
+ */
+ public function makeListItem($item)
+ {
return '<li class="level' . $item['level'] . ' ' .
($item['open'] ? 'open' : 'closed') . '">';
}
@@ -538,7 +568,8 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
- function _init_acl_config(){
+ public function initAclConfig()
+ {
global $AUTH_ACL;
global $conf;
$acl_config=array();
@@ -547,20 +578,24 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
// get special users and groups
$this->specials[] = '@ALL';
$this->specials[] = '@'.$conf['defaultgroup'];
- if($conf['manager'] != '!!not set!!'){
- $this->specials = array_merge($this->specials,
- array_map('trim',
- explode(',',$conf['manager'])));
+ if ($conf['manager'] != '!!not set!!') {
+ $this->specials = array_merge(
+ $this->specials,
+ array_map(
+ 'trim',
+ explode(',', $conf['manager'])
+ )
+ );
}
$this->specials = array_filter($this->specials);
$this->specials = array_unique($this->specials);
sort($this->specials);
- foreach($AUTH_ACL as $line){
- $line = trim(preg_replace('/#.*$/','',$line)); //ignore comments
- if(!$line) continue;
+ foreach ($AUTH_ACL as $line) {
+ $line = trim(preg_replace('/#.*$/', '', $line)); //ignore comments
+ if (!$line) continue;
- $acl = preg_split('/[ \t]+/',$line);
+ $acl = preg_split('/[ \t]+/', $line);
//0 is pagename, 1 is user, 2 is acl
$acl[1] = rawurldecode($acl[1]);
@@ -568,7 +603,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
// store non-special users and groups for later selection dialog
$ug = $acl[1];
- if(in_array($ug,$this->specials)) continue;
+ if (in_array($ug, $this->specials)) continue;
$usersgroups[] = $ug;
}
@@ -585,14 +620,15 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
- function _html_table(){
+ protected function printAclTable()
+ {
global $lang;
global $ID;
echo '<form action="'.wl().'" method="post" accept-charset="utf-8"><div class="no">'.NL;
- if($this->ns){
+ if ($this->ns) {
echo '<input type="hidden" name="ns" value="'.hsc($this->ns).'" />'.NL;
- }else{
+ } else {
echo '<input type="hidden" name="id" value="'.hsc($ID).'" />'.NL;
}
echo '<input type="hidden" name="acl_w" value="'.hsc($this->who).'" />'.NL;
@@ -607,29 +643,29 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
echo '<th>'.$this->getLang('perm').'<sup><a id="fnt__1" class="fn_top" href="#fn__1">1)</a></sup></th>';
echo '<th>'.$lang['btn_delete'].'</th>';
echo '</tr>';
- foreach($this->acl as $where => $set){
- foreach($set as $who => $perm){
+ foreach ($this->acl as $where => $set) {
+ foreach ($set as $who => $perm) {
echo '<tr>';
echo '<td>';
- if(substr($where,-1) == '*'){
+ if (substr($where, -1) == '*') {
echo '<span class="aclns">'.hsc($where).'</span>';
$ispage = false;
- }else{
+ } else {
echo '<span class="aclpage">'.hsc($where).'</span>';
$ispage = true;
}
echo '</td>';
echo '<td>';
- if($who{0} == '@'){
+ if ($who[0] == '@') {
echo '<span class="aclgroup">'.hsc($who).'</span>';
- }else{
+ } else {
echo '<span class="acluser">'.hsc($who).'</span>';
}
echo '</td>';
echo '<td>';
- echo $this->_html_checkboxes($perm,$ispage,'acl['.$where.']['.$who.']');
+ echo $this->makeCheckboxes($perm, $ispage, 'acl['.$where.']['.$who.']');
echo '</td>';
echo '<td class="check">';
@@ -655,21 +691,22 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
- function _get_exact_perm(){
+ protected function getExactPermisson()
+ {
global $ID;
- if($this->ns){
- if($this->ns == '*'){
+ if ($this->ns) {
+ if ($this->ns == '*') {
$check = '*';
- }else{
+ } else {
$check = $this->ns.':*';
}
- }else{
+ } else {
$check = $ID;
}
- if(isset($this->acl[$check][$this->who])){
+ if (isset($this->acl[$check][$this->who])) {
return $this->acl[$check][$this->who];
- }else{
+ } else {
return null;
}
}
@@ -679,13 +716,17 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
*
* @author Frank Schubert <frank@schokilade.de>
*/
- function _acl_add($acl_scope, $acl_user, $acl_level){
+ public function addOrUpdateACL($acl_scope, $acl_user, $acl_level)
+ {
global $config_cascade;
- $acl_user = auth_nameencode($acl_user,true);
+
+ // first make sure we won't end up with 2 lines matching this user and scope. See issue #1115
+ $this->deleteACL($acl_scope, $acl_user);
+ $acl_user = auth_nameencode($acl_user, true);
// max level for pagenames is edit
- if(strpos($acl_scope,'*') === false) {
- if($acl_level > AUTH_EDIT) $acl_level = AUTH_EDIT;
+ if (strpos($acl_scope, '*') === false) {
+ if ($acl_level > AUTH_EDIT) $acl_level = AUTH_EDIT;
}
$new_acl = "$acl_scope\t$acl_user\t$acl_level\n";
@@ -698,11 +739,12 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
*
* @author Frank Schubert <frank@schokilade.de>
*/
- function _acl_del($acl_scope, $acl_user){
+ public function deleteACL($acl_scope, $acl_user)
+ {
global $config_cascade;
- $acl_user = auth_nameencode($acl_user,true);
+ $acl_user = auth_nameencode($acl_user, true);
- $acl_pattern = '^'.preg_quote($acl_scope,'/').'[ \t]+'.$acl_user.'[ \t]+[0-8].*$';
+ $acl_pattern = '^'.preg_quote($acl_scope, '/').'[ \t]+'.$acl_user.'[ \t]+[0-8].*$';
return io_deleteFromFile($config_cascade['acl']['default'], "/$acl_pattern/", true);
}
@@ -713,15 +755,16 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
* @author Frank Schubert <frank@schokilade.de>
* @author Andreas Gohr <andi@splitbrain.org>
*/
- function _html_checkboxes($setperm,$ispage,$name){
+ protected function makeCheckboxes($setperm, $ispage, $name)
+ {
global $lang;
static $label = 0; //number labels
$ret = '';
- if($ispage && $setperm > AUTH_EDIT) $setperm = AUTH_EDIT;
+ if ($ispage && $setperm > AUTH_EDIT) $setperm = AUTH_EDIT;
- foreach(array(AUTH_NONE,AUTH_READ,AUTH_EDIT,AUTH_CREATE,AUTH_UPLOAD,AUTH_DELETE) as $perm){
+ foreach (array(AUTH_NONE,AUTH_READ,AUTH_EDIT,AUTH_CREATE,AUTH_UPLOAD,AUTH_DELETE) as $perm) {
$label += 1;
//general checkbox attributes
@@ -730,11 +773,11 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
'name' => $name,
'value' => $perm );
//dynamic attributes
- if(!is_null($setperm) && $setperm == $perm) $atts['checked'] = 'checked';
- if($ispage && $perm > AUTH_EDIT){
+ if (!is_null($setperm) && $setperm == $perm) $atts['checked'] = 'checked';
+ if ($ispage && $perm > AUTH_EDIT) {
$atts['disabled'] = 'disabled';
$class = ' class="disabled"';
- }else{
+ } else {
$class = '';
}
@@ -752,21 +795,21 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
- function _html_select(){
+ protected function makeSelect()
+ {
$inlist = false;
$usel = '';
$gsel = '';
- if($this->who &&
- !in_array($this->who,$this->usersgroups) &&
- !in_array($this->who,$this->specials)){
-
- if($this->who{0} == '@'){
+ if ($this->who &&
+ !in_array($this->who, $this->usersgroups) &&
+ !in_array($this->who, $this->specials)) {
+ if ($this->who[0] == '@') {
$gsel = ' selected="selected"';
- }else{
+ } else {
$usel = ' selected="selected"';
}
- }else{
+ } else {
$inlist = true;
}
@@ -775,17 +818,17 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
echo ' <option value="__u__" class="acluser"'.$usel.'>'.$this->getLang('acl_user').'</option>'.NL;
if (!empty($this->specials)) {
echo ' <optgroup label="&#160;">'.NL;
- foreach($this->specials as $ug){
- if($ug == $this->who){
+ foreach ($this->specials as $ug) {
+ if ($ug == $this->who) {
$sel = ' selected="selected"';
$inlist = true;
- }else{
+ } else {
$sel = '';
}
- if($ug{0} == '@'){
+ if ($ug[0] == '@') {
echo ' <option value="'.hsc($ug).'" class="aclgroup"'.$sel.'>'.hsc($ug).'</option>'.NL;
- }else{
+ } else {
echo ' <option value="'.hsc($ug).'" class="acluser"'.$sel.'>'.hsc($ug).'</option>'.NL;
}
}
@@ -793,17 +836,17 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
}
if (!empty($this->usersgroups)) {
echo ' <optgroup label="&#160;">'.NL;
- foreach($this->usersgroups as $ug){
- if($ug == $this->who){
+ foreach ($this->usersgroups as $ug) {
+ if ($ug == $this->who) {
$sel = ' selected="selected"';
$inlist = true;
- }else{
+ } else {
$sel = '';
}
- if($ug{0} == '@'){
+ if ($ug[0] == '@') {
echo ' <option value="'.hsc($ug).'" class="aclgroup"'.$sel.'>'.hsc($ug).'</option>'.NL;
- }else{
+ } else {
echo ' <option value="'.hsc($ug).'" class="acluser"'.$sel.'>'.hsc($ug).'</option>'.NL;
}
}
diff --git a/lib/plugins/acl/lang/ar/lang.php b/lib/plugins/acl/lang/ar/lang.php
index 89fe27a76..da16a8e90 100644
--- a/lib/plugins/acl/lang/ar/lang.php
+++ b/lib/plugins/acl/lang/ar/lang.php
@@ -2,11 +2,10 @@
/**
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
- *
+ *
* @author Mostafa Hussein <mostafa@gmail.com>
* @author Yaman Hokan <always.smile.yh@hotmail.com>
* @author Usama Akkad <uahello@gmail.com>
- * @author uahello@gmail.com
*/
$lang['admin_acl'] = 'إدارة قوائم التحكم بالدخول';
$lang['acl_group'] = 'مجموعة:';
diff --git a/lib/plugins/acl/lang/bg/lang.php b/lib/plugins/acl/lang/bg/lang.php
index 648b91ef4..5e250bc19 100644
--- a/lib/plugins/acl/lang/bg/lang.php
+++ b/lib/plugins/acl/lang/bg/lang.php
@@ -2,7 +2,7 @@
/**
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
- *
+ *
* @author Nikolay Vladimirov <nikolay@vladimiroff.com>
* @author Viktor Usunov <usun0v@mail.bg>
* @author Kiril <neohidra@gmail.com>
diff --git a/lib/plugins/acl/lang/ca/lang.php b/lib/plugins/acl/lang/ca/lang.php
index 0c882962d..b697c371b 100644
--- a/lib/plugins/acl/lang/ca/lang.php
+++ b/lib/plugins/acl/lang/ca/lang.php
@@ -4,10 +4,8 @@
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*
* @author Carles Bellver <carles.bellver@cent.uji.es>
- * @author Carles Bellver <carles.bellver@gmail.com>
- * @author carles.bellver@gmail.com
- * @author carles.bellver@cent.uji.es
- * @author daniel@6temes.cat
+ * @author carles.bellver <carles.bellver@gmail.com>
+ * @author daniel <daniel@6temes.cat>
*/
$lang['admin_acl'] = 'Gestió de la Llista de Control d\'Accés';
$lang['acl_group'] = 'Grup:';
diff --git a/lib/plugins/acl/lang/da/lang.php b/lib/plugins/acl/lang/da/lang.php
index 5209b7b10..103a867ee 100644
--- a/lib/plugins/acl/lang/da/lang.php
+++ b/lib/plugins/acl/lang/da/lang.php
@@ -3,6 +3,7 @@
/**
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*
+ * @author Jacob Palm <mail@jacobpalm.dk>
* @author koeppe <koeppe@kazur.dk>
* @author Jon Bendtsen <bendtsen@diku.dk>
* @author Lars Næsbye Christensen <larsnaesbye@stud.ku.dk>
@@ -38,7 +39,7 @@ $lang['acl_perm0'] = 'Ingen';
$lang['acl_perm1'] = 'Læs';
$lang['acl_perm2'] = 'Skriv';
$lang['acl_perm4'] = 'Opret';
-$lang['acl_perm8'] = 'Overføre';
+$lang['acl_perm8'] = 'Overfør';
$lang['acl_perm16'] = 'Slet';
$lang['acl_new'] = 'Tilføj ny post';
-$lang['acl_mod'] = 'Ændre post';
+$lang['acl_mod'] = 'Redigér post';
diff --git a/lib/plugins/acl/lang/el/lang.php b/lib/plugins/acl/lang/el/lang.php
index 75cc41501..fe2dd083d 100644
--- a/lib/plugins/acl/lang/el/lang.php
+++ b/lib/plugins/acl/lang/el/lang.php
@@ -11,7 +11,7 @@
* @author Konstantinos Koryllos <koryllos@gmail.com>
* @author George Petsagourakis <petsagouris@gmail.com>
* @author Petros Vidalis <pvidalis@gmail.com>
- * @author Vasileios Karavasilis vasileioskaravasilis@gmail.com
+ * @author Vasileios Karavasilis <vasileioskaravasilis@gmail.com>
*/
$lang['admin_acl'] = 'Διαχείριση Δικαιωμάτων Πρόσβασης';
$lang['acl_group'] = 'Ομάδα:';
diff --git a/lib/plugins/acl/lang/fa/lang.php b/lib/plugins/acl/lang/fa/lang.php
index 2938e1bb2..46db20893 100644
--- a/lib/plugins/acl/lang/fa/lang.php
+++ b/lib/plugins/acl/lang/fa/lang.php
@@ -5,8 +5,7 @@
*
* @author behrad eslamifar <behrad_es@yahoo.com)
* @author Mohsen Firoozmandan <info@mambolearn.com>
- * @author omidmr@gmail.com
- * @author Omid Mottaghi <omidmr@gmail.com>
+ * @author omidmr <omidmr@gmail.com>
* @author Mohammad Reza Shoaei <shoaei@gmail.com>
* @author Milad DZand <M.DastanZand@gmail.com>
* @author AmirH Hassaneini <mytechmix@gmail.com>
diff --git a/lib/plugins/acl/lang/fi/lang.php b/lib/plugins/acl/lang/fi/lang.php
index 2dfc35801..f680f2905 100644
--- a/lib/plugins/acl/lang/fi/lang.php
+++ b/lib/plugins/acl/lang/fi/lang.php
@@ -2,9 +2,8 @@
/**
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
- *
- * @author otto@valjakko.net
- * @author Otto Vainio <otto@valjakko.net>
+ *
+ * @author otto <otto@valjakko.net>
* @author Teemu Mattila <ghcsystems@gmail.com>
* @author Sami Olmari <sami@olmari.fi>
*/
diff --git a/lib/plugins/acl/lang/id/lang.php b/lib/plugins/acl/lang/id/lang.php
index 3b0ecf446..93e3f4125 100644
--- a/lib/plugins/acl/lang/id/lang.php
+++ b/lib/plugins/acl/lang/id/lang.php
@@ -2,7 +2,7 @@
/**
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
- *
+ *
* @author mubaidillah <mubaidillah@gmail.com>
* @author Yustinus Waruwu <juswaruwu@gmail.com>
*/
diff --git a/lib/plugins/acl/lang/is/lang.php b/lib/plugins/acl/lang/is/lang.php
index 13ed7bfd7..6715c2700 100644
--- a/lib/plugins/acl/lang/is/lang.php
+++ b/lib/plugins/acl/lang/is/lang.php
@@ -1,5 +1,8 @@
<?php
+
/**
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ *
* Icelandic language file
*
* @author Hrannar Baldursson <hrannar.baldursson@gmail.com>
diff --git a/lib/plugins/acl/lang/ja/lang.php b/lib/plugins/acl/lang/ja/lang.php
index 24a36391b..0963d2b63 100644
--- a/lib/plugins/acl/lang/ja/lang.php
+++ b/lib/plugins/acl/lang/ja/lang.php
@@ -3,8 +3,8 @@
/**
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*
+ * @author HokkaidoPerson <dosankomali@yahoo.co.jp>
* @author Davilin(Yuji Takenaka) <webmaster@davilin.com>
- * @author Yuji Takenaka <webmaster@davilin.com>
* @author Ikuo Obataya <i.obataya@gmail.com>
* @author Daniel Dupriest <kououken@gmail.com>
* @author Kazutaka Miyasaka <kazmiya@gmail.com>
@@ -22,8 +22,8 @@ $lang['p_user_id'] = 'ユーザー <b class="acluser">%s</b> は、
$lang['p_user_ns'] = 'ユーザー <b class="acluser">%s</b> は、名前空間 <b class="aclns">%s</b> に対して次の権限を持っています: <i>%s</i>';
$lang['p_group_id'] = 'グループ <b class="aclgroup">%s</b> のメンバーは、ページ <b class="aclpage">%s</b> に対して次の権限を持っています: <i>%s</i>';
$lang['p_group_ns'] = 'グループ <b class="aclgroup">%s</b> のメンバーは、名前空間 <b class="aclns">%s</b> に対して次の権限を持っています: <i>%s</i>';
-$lang['p_choose_id'] = 'ページ <b class="aclpage">%s</b> にセットされた権限を閲覧・編集するためには、上記のフォームに<b>ユーザー名もしくはグループ名を入力して下さい</b>。';
-$lang['p_choose_ns'] = '名前空間 <b class="aclns">%s</b> にセットされた権限を閲覧・編集するためには、上記のフォームに<b>ユーザー名もしくはグループ名を入力して下さい</b>。';
+$lang['p_choose_id'] = 'ページ <b class="aclpage">%s</b> にセットされた権限を閲覧・編集するには、上記のフォームに<b>ユーザー名もしくはグループ名を入力して下さい</b>。';
+$lang['p_choose_ns'] = '名前空間 <b class="aclns">%s</b> にセットされた権限を閲覧・編集するには、上記のフォームに<b>ユーザー名もしくはグループ名を入力して下さい</b>。';
$lang['p_inherited'] = '注意:これらの権限は明示されていませんが、他のグループもしくは上位の名前空間の権限を継承します。';
$lang['p_isadmin'] = '注意:選択したグループもしくはユーザーはスーパーユーザーであるため、全ての権限があります。';
$lang['p_include'] = '高次の権限は、それより低次の権限を含みます。作成・アップロード・削除の権限は、ページではなく名前空間のみに適用されます。';
diff --git a/lib/plugins/acl/lang/km/lang.php b/lib/plugins/acl/lang/km/lang.php
new file mode 100644
index 000000000..1b7f7da94
--- /dev/null
+++ b/lib/plugins/acl/lang/km/lang.php
@@ -0,0 +1,8 @@
+<?php
+
+/**
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ *
+ * @author no credits taken <someone@cambodia.kh>
+ */
+$lang['where'] = 'ទំព័រ/ដ្ឋាននាម';
diff --git a/lib/plugins/acl/lang/lt/lang.php b/lib/plugins/acl/lang/lt/lang.php
index 2a1748abc..5bf5981a3 100644
--- a/lib/plugins/acl/lang/lt/lang.php
+++ b/lib/plugins/acl/lang/lt/lang.php
@@ -2,9 +2,9 @@
/**
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
- *
+ *
* @author Linas Valiukas <shirshegsm@gmail.com>
- * @author audrius.klevas@gmail.com
+ * @author audrius.klevas <audrius.klevas@gmail.com>
* @author Arunas Vaitekunas <aras@fan.lt>
*/
$lang['admin_acl'] = 'Priėjimo Kontrolės Sąrašų valdymas';
diff --git a/lib/plugins/acl/lang/no/lang.php b/lib/plugins/acl/lang/no/lang.php
index 13770f498..218ea7516 100644
--- a/lib/plugins/acl/lang/no/lang.php
+++ b/lib/plugins/acl/lang/no/lang.php
@@ -14,8 +14,7 @@
* @author Knut Staring <knutst@gmail.com>
* @author Lisa Ditlefsen <lisa@vervesearch.com>
* @author Erik Pedersen <erik.pedersen@shaw.ca>
- * @author Erik Bjørn Pedersen <erik.pedersen@shaw.ca>
- * @author Rune Rasmussen syntaxerror.no@gmail.com
+ * @author Rune Rasmussen <syntaxerror.no@gmail.com>
* @author Jon Bøe <jonmagneboe@hotmail.com>
* @author Egil Hansen <egil@rosetta.no>
*/
diff --git a/lib/plugins/acl/lang/pt/help.txt b/lib/plugins/acl/lang/pt/help.txt
index cf4619deb..6b076698d 100644
--- a/lib/plugins/acl/lang/pt/help.txt
+++ b/lib/plugins/acl/lang/pt/help.txt
@@ -1,9 +1,8 @@
=== Auxílio Rápido ===
-Nesta página podes adicionar e remover permissões para espaço de nomes e páginas no seu wiki.
+Nesta página pode adicionar e remover permissões para namespace e páginas no seu wiki.
+ * O painel esquerdo exibe todos os namespaces e páginas.´
+ * O formulário acima permite a ver e modificar as permissões de um usuário ou grupo selecionado.
+ * Na tabela abaixo são exibidas todas as regras de controle de acesso atuais. Podes utilizá-la para excluir ou mudar rapidamente várias regras ao mesmo tempo.
-O painel esquerdo exibe todos os espaço de nomes e páginas. O formulario acima permite a visualização e modificar as permissões de um selecionado utilizador ou grupo.
-
-Na tabela inferior são exibidas todas as actuais regras de controle de acesso. Podes utilisá-la para excluir ou mudar rapidamente várias regras ao mesmo tempo.
-
-A leitura da [[doku>acl|documentação oficial acerca ACL]] pode ajudar a compreender melhor como o controle de acessos funciona no DokuWiki.
+A leitura da [[doku>acl|documentação oficial sobre ACL]] pode ajudar a compreender melhor como o controle de acessos funciona no DokuWiki.
diff --git a/lib/plugins/acl/lang/pt/lang.php b/lib/plugins/acl/lang/pt/lang.php
index eb77cba5c..e30ce9726 100644
--- a/lib/plugins/acl/lang/pt/lang.php
+++ b/lib/plugins/acl/lang/pt/lang.php
@@ -3,32 +3,33 @@
/**
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*
+ * @author Paulo Schopf <pschopf@gmail.com>
* @author José Carlos Monteiro <jose.c.monteiro@netcabo.pt>
* @author José Monteiro <Jose.Monteiro@DoWeDo-IT.com>
* @author Enrico Nicoletto <liverig@gmail.com>
* @author Fil <fil@meteopt.com>
* @author André Neves <drakferion@gmail.com>
- * @author José Campos zecarlosdecampos@gmail.com
+ * @author José Campos <zecarlosdecampos@gmail.com>
*/
-$lang['admin_acl'] = 'Gestão de ACLs';
+$lang['admin_acl'] = 'Gerenciamento de ACLs';
$lang['acl_group'] = 'Grupo:';
-$lang['acl_user'] = 'Utilizador:';
+$lang['acl_user'] = 'Usuário:';
$lang['acl_perms'] = 'Permissão para';
-$lang['page'] = 'Documento';
+$lang['page'] = 'Página';
$lang['namespace'] = 'Namespace';
$lang['btn_select'] = 'Selecionar';
$lang['p_user_id'] = 'O utilizador <b class="acluser">%s</b> tem as seguintes permissões na página <b class="aclpage">%s</b>: <i>%s</i>.';
-$lang['p_user_ns'] = 'O utilizador <b class="acluser">%s</b> tem as seguintes permissões no espaço de nomes <b class="aclns">%s</b>: <i>%s</i>.';
+$lang['p_user_ns'] = 'O utilizador <b class="acluser">%s</b> tem as seguintes permissões no namespace <b class="aclns">%s</b>: <i>%s</i>.';
$lang['p_group_id'] = 'Os membros do grupo <b class="aclgroup">%s</b> têm as seguintes permissões na página <b class="aclpage">%s</b>: <i>%s</i>.';
-$lang['p_group_ns'] = 'Os membros do grupo <b class="aclgroup">%s</b> têm as seguintes permissões no espaço de nomes <b class="aclpage">%s</b>: <i>%s</i>.';
-$lang['p_choose_id'] = 'Por favor <b>digite um utilizador ou grupo</b> no formulário acima para ver ou editar as permissões para a página <b class="aclpage">%s</b>.';
-$lang['p_choose_ns'] = 'Por favor <b>digite um utilizador ou grupo</b> no formulário acima para ver ou editar as permissões para o espaço de nomes <b class="aclpage">%s</b>.';
-$lang['p_inherited'] = 'Nota: Essas permissões não foram definidas explicitamente, mas sim herdadas de outros grupos ou espaço de nomes superiores.';
-$lang['p_isadmin'] = 'Nota: O grupo ou utilizador seleccionado tem sempre permissões completas, porque ele está configurado como superutilizador.';
-$lang['p_include'] = 'As permissões superiores incluem as inferiores. Permissões para Criar, Enviar e Apagar aplicam-se apenas aos espaços de nomes e não às páginas.';
-$lang['current'] = 'Regras Actuais ACL';
-$lang['where'] = 'Página/Espaço de Nomes';
-$lang['who'] = 'Utilizador/Grupo';
+$lang['p_group_ns'] = 'Os membros do grupo <b class="aclgroup">%s</b> têm as seguintes permissões no namespace <b class="aclpage">%s</b>: <i>%s</i>.';
+$lang['p_choose_id'] = 'Por favor <b>digite um usuário ou grupo</b> no formulário acima para ver ou editar as permissões para a página <b class="aclpage">%s</b>.';
+$lang['p_choose_ns'] = 'Por favor <b>digite um usuário ou grupo</b> no formulário acima para ver ou editar as permissões para o namespace <b class="aclpage">%s</b>.';
+$lang['p_inherited'] = 'Nota: Essas permissões não foram definidas explicitamente, mas sim herdadas de outros grupos ou namespaces superiores.';
+$lang['p_isadmin'] = 'Nota: O grupo ou utilizador seleccionado tem sempre permissões completas, porque ele está configurado como superusuário.';
+$lang['p_include'] = 'As permissões superiores incluem as inferiores. Permissões para Criar, Enviar e Excluir aplicam-se apenas aos namespaces e não às páginas.';
+$lang['current'] = 'Regras ACL Atuais';
+$lang['where'] = 'Página/Namespace';
+$lang['who'] = 'Usuário/Grupo';
$lang['perm'] = 'Permissões';
$lang['acl_perm0'] = 'Nenhum';
$lang['acl_perm1'] = 'Ler';
@@ -36,5 +37,5 @@ $lang['acl_perm2'] = 'Editar';
$lang['acl_perm4'] = 'Criar';
$lang['acl_perm8'] = 'Carregar';
$lang['acl_perm16'] = 'Remover';
-$lang['acl_new'] = 'Adicionar nova entrada';
+$lang['acl_new'] = 'Adicionar nova Entrada';
$lang['acl_mod'] = 'Modificar Entrada';
diff --git a/lib/plugins/acl/lang/ro/lang.php b/lib/plugins/acl/lang/ro/lang.php
index 804bc80c8..3c55a1276 100644
--- a/lib/plugins/acl/lang/ro/lang.php
+++ b/lib/plugins/acl/lang/ro/lang.php
@@ -4,14 +4,9 @@
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*
* @author Sergiu Baltariu <s_baltariu@yahoo.com>
- * @author s_baltariu@yahoo.com
* @author Emanuel-Emeric Andrasi <n30@mandrivausers.ro>
- * @author Emanuel-Emeric Andrași <n30@mandrivausers.ro>
* @author Emanuel-Emeric Andraşi <em.andrasi@mandrivausers.ro>
- * @author Emanuel-Emeric Andrasi <em.andrasi@mandrivausers.ro>
* @author Marius OLAR <olarmariusalex@gmail.com>
- * @author Marius Olar <olarmariusalex@yahoo.com>
- * @author Emanuel-Emeric Andrași <em.andrasi@mandrivausers.ro>
*/
$lang['admin_acl'] = 'Managementul Listei de Control a Accesului';
$lang['acl_group'] = 'Grup:';
diff --git a/lib/plugins/acl/lang/sr/lang.php b/lib/plugins/acl/lang/sr/lang.php
index 0ba322a5e..f2c95484d 100644
--- a/lib/plugins/acl/lang/sr/lang.php
+++ b/lib/plugins/acl/lang/sr/lang.php
@@ -4,8 +4,7 @@
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*
* @author Filip Brcic <brcha@users.sourceforge.net>
- * @author Иван Петровић petrovicivan@ubuntusrbija.org
- * @author Ivan Petrovic <petrovicivan@ubuntusrbija.org>
+ * @author Иван Петровић <petrovicivan@ubuntusrbija.org>
* @author Miroslav Šolti <solti.miroslav@gmail.com>
*/
$lang['admin_acl'] = 'Управљање листом контроле приступа';
diff --git a/lib/plugins/acl/lang/th/lang.php b/lib/plugins/acl/lang/th/lang.php
index 55b707b5c..24694ac2d 100644
--- a/lib/plugins/acl/lang/th/lang.php
+++ b/lib/plugins/acl/lang/th/lang.php
@@ -2,9 +2,8 @@
/**
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
- *
+ *
* @author Komgrit Niyomrath <n.komgrit@gmail.com>
- * @author Kittithat Arnontavilas mrtomyum@gmail.com
* @author Kittithat Arnontavilas <mrtomyum@gmail.com>
* @author Thanasak Sompaisansin <jombthep@gmail.com>
*/
diff --git a/lib/plugins/acl/lang/tr/lang.php b/lib/plugins/acl/lang/tr/lang.php
index 3c3e3dbc1..1f81da0eb 100644
--- a/lib/plugins/acl/lang/tr/lang.php
+++ b/lib/plugins/acl/lang/tr/lang.php
@@ -2,13 +2,13 @@
/**
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
- *
+ *
* @author Selim Farsakoğlu <farsakogluselim@yahoo.de>
* @author Aydın Coşkuner <aydinweb@gmail.com>
* @author Cihan Kahveci <kahvecicihan@gmail.com>
* @author Yavuz Selim <yavuzselim@gmail.com>
* @author Caleb Maclennan <caleb@alerque.com>
- * @author farukerdemoncel@gmail.com
+ * @author farukerdemoncel <farukerdemoncel@gmail.com>
*/
$lang['admin_acl'] = 'Erişim Kontrol Listesi (ACL) Yönetimi';
$lang['acl_group'] = 'Grup:';
diff --git a/lib/plugins/acl/lang/vi/help.txt b/lib/plugins/acl/lang/vi/help.txt
index 816e5ee71..d657c2e23 100644
--- a/lib/plugins/acl/lang/vi/help.txt
+++ b/lib/plugins/acl/lang/vi/help.txt
@@ -1,12 +1,8 @@
=== Trợ giúp nhanh: ===
-Trang này giúp bạn thêm hoặc xóa quyền được cấp cho 1 thư mục hoặc trang wiki của bạn.
-
-Của sổ bên trái hiển thị tất cả các thư mục và trang văn bản.
-
-Khung trên đây cho phép bạn xem và sửa quyền của một nhóm hoặc thành viên đã chọn.
-
-Bảng bên dưới hiển thị tất cả các quyền được cấp. Bạn có thể sửa hoặc hóa các quyền đó một cách nhanh chóng.
-
-Đọc [[doku>acl|tài liệu chính thức về ACL]] sẽ giúp bạn hiểu hơn về cách phân quyền ở DokuWiki.
+Trên trang này, bạn có thể thêm và xóa quyền cho không gian tên và trang trong wiki của bạn.
+ * Khung bên trái hiển thị tất cả các không gian tên và trang có sẵn
+ * Biểu mẫu trên cho phép bạn xem và sửa đổi các quyền của thành viên hoặc nhóm đã chọn.
+ * Bảng dưới đây hiện thị tất cả các quy tắc kiểm soát truy cập. Bạn có thể sử dụng nó để nhanh chóng xóa hoặc thay đổi nhiều quy tắc.
+Đọc [[doku>acl|tài liệu chính thức về ACL]] có thể giúp bạn hiểu đầy đủ cách thức kiểm soát hoạt động truy cập trong DokuWiki. \ No newline at end of file
diff --git a/lib/plugins/acl/lang/vi/lang.php b/lib/plugins/acl/lang/vi/lang.php
index 8ca888cae..fb4d3b1ff 100644
--- a/lib/plugins/acl/lang/vi/lang.php
+++ b/lib/plugins/acl/lang/vi/lang.php
@@ -2,34 +2,35 @@
/**
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
- *
+ *
+ * @author Thien Hau <thienhausoftware@gmail.com>
* @author NukeViet <admin@nukeviet.vn>
*/
$lang['admin_acl'] = 'Quản lý danh sách quyền truy cập';
$lang['acl_group'] = 'Nhóm:';
$lang['acl_user'] = 'Thành viên:';
-$lang['acl_perms'] = 'Cấp phép cho';
+$lang['acl_perms'] = 'Cấp quyền cho';
$lang['page'] = 'Trang';
-$lang['namespace'] = 'Thư mục';
+$lang['namespace'] = 'Không gian tên';
$lang['btn_select'] = 'Chọn';
-$lang['p_user_id'] = 'Thành viên <b class="acluser">%s</b> hiện tại được cấp phép cho trang <b class="aclpage">%s</b>: <i>%s</i>.';
-$lang['p_user_ns'] = 'Thành viên <b class="acluser">%s</b> hiện tại được cấp phép cho thư mục <b class="aclns">%s</b>: <i>%s</i>.';
-$lang['p_group_id'] = 'Thành viên trong nhóm <b class="aclgroup">%s</b> hiện tại được cấp phép cho trang <b class="aclpage">%s</b>: <i>%s</i>.';
-$lang['p_group_ns'] = 'Thành viên trong nhóm <b class="aclgroup">%s</b> hiện tại được cấp phép cho thư mục <b class="aclns">%s</b>: <i>%s</i>.';
-$lang['p_choose_id'] = 'Hãy <b>nhập tên thành viên hoặc nhóm</b> vào ô trên đây để xem hoặc sửa quyền đã thiết đặt cho trang <b class="aclpage">%s</b>.';
-$lang['p_choose_ns'] = 'Hãy <b>nhập tên thành viên hoặc nhóm</b> vào ô trên đây để xem hoặc sửa quyền đã thiết đặt cho thư mục <b class="aclns">%s</b>.';
-$lang['p_inherited'] = 'Ghi chú: Có những quyền không được thể hiện ở đây nhưng nó được cấp phép từ những nhóm hoặc thư mục cấp cao.';
-$lang['p_isadmin'] = 'Ghi chú: Nhóm hoặc thành viên này luôn được cấp đủ quyền vì họ là Quản trị tối cao';
-$lang['p_include'] = 'Một số quyền thấp được thể hiện ở mức cao hơn. Quyền tạo, tải lên và xóa chỉ dành cho thư mục, không dành cho trang.';
+$lang['p_user_id'] = 'Thành viên <b class="acluser">%s</b> hiện có các quyền sau trên trang <b class="aclpage">%s</b>: <i>%s</i>.';
+$lang['p_user_ns'] = 'Thành viên <b class="acluser">%s</b> hiện có các quyền sau trong không gian tên <b class="aclns">%s</b>: <i>%s</i>.';
+$lang['p_group_id'] = 'Thành viên trong nhóm <b class="aclgroup">%s</b> hiện có các quyền sau trên trang <b class="aclpage">%s</b>: <i>%s</i>.';
+$lang['p_group_ns'] = 'Thành viên trong nhóm <b class="aclgroup">%s</b> hiện có các quyền sau trong không gian tên<b class="aclns">%s</b>: <i>%s</i>.';
+$lang['p_choose_id'] = 'Hãy <b>nhập tên thành viên hoặc nhóm</b> vào ô trên đây để xem hoặc sửa đổi quyền đã thiết đặt cho trang <b class="aclpage">%s</b>.';
+$lang['p_choose_ns'] = 'Hãy <b>nhập tên thành viên hoặc nhóm</b> vào ô trên đây để xem hoặc sửa đổi quyền đã thiết đặt cho thư mục <b class="aclns">%s</b>.';
+$lang['p_inherited'] = 'Ghi chú: Có những quyền không được thể hiện ở đây nhưng nó được cấp phép từ những nhóm hoặc không gian tên cao hơn.';
+$lang['p_isadmin'] = 'Ghi chú: Nhóm hoặc thành viên này luôn được cấp đủ quyền vì họ được đặt là Siêu thành viên';
+$lang['p_include'] = 'Các quyền cao hơn bao gồm những quyền thấp hơn. Quyền Tạo, Tải lên và Xóa chỉ áp dụng cho không gian tên, không phải trang.';
$lang['current'] = 'Danh sách quyền truy cập hiện tại';
-$lang['where'] = 'Trang/Thư mục';
+$lang['where'] = 'Trang/Không gian tên';
$lang['who'] = 'Thành viên/Nhóm';
$lang['perm'] = 'Quyền';
$lang['acl_perm0'] = 'Không';
$lang['acl_perm1'] = 'Đọc';
-$lang['acl_perm2'] = 'Sửa';
+$lang['acl_perm2'] = 'Sửa đổi';
$lang['acl_perm4'] = 'Tạo';
$lang['acl_perm8'] = 'Tải lên';
$lang['acl_perm16'] = 'Xóa';
-$lang['acl_new'] = 'Thêm mục mới';
-$lang['acl_mod'] = 'Sửa';
+$lang['acl_new'] = 'Thêm mục nhập mới';
+$lang['acl_mod'] = 'Sửa đổi mục nhập';
diff --git a/lib/plugins/acl/remote.php b/lib/plugins/acl/remote.php
index 27c5c162a..8d19add72 100644
--- a/lib/plugins/acl/remote.php
+++ b/lib/plugins/acl/remote.php
@@ -1,16 +1,20 @@
<?php
+use dokuwiki\Remote\AccessDeniedException;
+
/**
* Class remote_plugin_acl
*/
-class remote_plugin_acl extends DokuWiki_Remote_Plugin {
+class remote_plugin_acl extends DokuWiki_Remote_Plugin
+{
/**
* Returns details about the remote plugin methods
*
- * @return array Information about all provided methods. {@see RemoteAPI}
+ * @return array Information about all provided methods. {@see dokuwiki\Remote\RemoteAPI}
*/
- public function _getMethods() {
+ public function _getMethods()
+ {
return array(
'listAcls' => array(
'args' => array(),
@@ -34,16 +38,20 @@ class remote_plugin_acl extends DokuWiki_Remote_Plugin {
/**
* List all ACL config entries
*
- * @throws RemoteAccessDeniedException
+ * @throws AccessDeniedException
* @return dictionary {Scope: ACL}, where ACL = dictionnary {user/group: permissions_int}
*/
- public function listAcls(){
- if(!auth_isadmin()) {
- throw new RemoteAccessDeniedException('You are not allowed to access ACLs, superuser permission is required', 114);
+ public function listAcls()
+ {
+ if (!auth_isadmin()) {
+ throw new AccessDeniedException(
+ 'You are not allowed to access ACLs, superuser permission is required',
+ 114
+ );
}
/** @var admin_plugin_acl $apa */
$apa = plugin_load('admin', 'acl');
- $apa->_init_acl_config();
+ $apa->initAclConfig();
return $apa->acl;
}
@@ -53,17 +61,21 @@ class remote_plugin_acl extends DokuWiki_Remote_Plugin {
* @param string $scope
* @param string $user
* @param int $level see also inc/auth.php
- * @throws RemoteAccessDeniedException
+ * @throws AccessDeniedException
* @return bool
*/
- public function addAcl($scope, $user, $level){
- if(!auth_isadmin()) {
- throw new RemoteAccessDeniedException('You are not allowed to access ACLs, superuser permission is required', 114);
+ public function addAcl($scope, $user, $level)
+ {
+ if (!auth_isadmin()) {
+ throw new AccessDeniedException(
+ 'You are not allowed to access ACLs, superuser permission is required',
+ 114
+ );
}
/** @var admin_plugin_acl $apa */
$apa = plugin_load('admin', 'acl');
- return $apa->_acl_add($scope, $user, $level);
+ return $apa->addOrUpdateACL($scope, $user, $level);
}
/**
@@ -71,17 +83,20 @@ class remote_plugin_acl extends DokuWiki_Remote_Plugin {
*
* @param string $scope
* @param string $user
- * @throws RemoteAccessDeniedException
+ * @throws AccessDeniedException
* @return bool
*/
- public function delAcl($scope, $user){
- if(!auth_isadmin()) {
- throw new RemoteAccessDeniedException('You are not allowed to access ACLs, superuser permission is required', 114);
+ public function delAcl($scope, $user)
+ {
+ if (!auth_isadmin()) {
+ throw new AccessDeniedException(
+ 'You are not allowed to access ACLs, superuser permission is required',
+ 114
+ );
}
/** @var admin_plugin_acl $apa */
$apa = plugin_load('admin', 'acl');
- return $apa->_acl_del($scope, $user);
+ return $apa->deleteACL($scope, $user);
}
}
-
diff --git a/lib/plugins/acl/script.js b/lib/plugins/acl/script.js
index 86badffdd..95621a255 100644
--- a/lib/plugins/acl/script.js
+++ b/lib/plugins/acl/script.js
@@ -15,8 +15,8 @@ var dw_acl = {
return;
}
- jQuery('#acl__user select').change(dw_acl.userselhandler);
- jQuery('#acl__user button').click(dw_acl.loadinfo);
+ jQuery('#acl__user select').on('change', dw_acl.userselhandler);
+ jQuery('#acl__user button').on('click', dw_acl.loadinfo);
$tree = jQuery('#acl__tree');
$tree.dw_tree({toggle_selector: 'img',