~yoboy-leguesh/ubuntu-fr-doc/maj20150810a

« back to all changes in this revision

Viewing changes to lib/plugins/acl/admin.php

  • Committer: YoBoY
  • Date: 2012-10-24 19:05:18 UTC
  • mfrom: (114.1.3 maj-AdoraBelle)
  • Revision ID: yoboy.leguesh@gmail.com-20121024190518-bgtic5m3dt8gnzfn
Mise à jour de Dokuwiki 2012-10-13 "Adora Belle"
Application des patch ubuntu-fr d'optimisation
Ajout des thèmes ubuntu-fr
Ajout des plugins
Mise à jour des plugins box, orphanswanted, pageredirect, tag, cloud, forcepreview, pagelist
Désactivation de la nouvelle option d'envoie de notifications mail en html
Application des derniers patchs correctifs de Dokuwiki.

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
        global $ID;
57
57
        global $auth;
58
58
        global $config_cascade;
 
59
        global $INPUT;
59
60
 
60
61
        // fresh 1:1 copy without replacements
61
62
        $AUTH_ACL = file($config_cascade['acl']['default']);
62
63
 
63
64
 
64
65
        // namespace given?
65
 
        if($_REQUEST['ns'] == '*'){
 
66
        if($INPUT->str('ns') == '*'){
66
67
            $this->ns = '*';
67
68
        }else{
68
 
            $this->ns = cleanID($_REQUEST['ns']);
 
69
            $this->ns = cleanID($INPUT->str('ns'));
69
70
        }
70
71
 
71
 
        if ($_REQUEST['current_ns']) {
72
 
            $this->current_item = array('id' => cleanID($_REQUEST['current_ns']), 'type' => 'd');
73
 
        } elseif ($_REQUEST['current_id']) {
74
 
            $this->current_item = array('id' => cleanID($_REQUEST['current_id']), 'type' => 'f');
 
72
        if ($INPUT->str('current_ns')) {
 
73
            $this->current_item = array('id' => cleanID($INPUT->str('current_ns')), 'type' => 'd');
 
74
        } elseif ($INPUT->str('current_id')) {
 
75
            $this->current_item = array('id' => cleanID($INPUT->str('current_id')), 'type' => 'f');
75
76
        } elseif ($this->ns) {
76
77
            $this->current_item = array('id' => $this->ns, 'type' => 'd');
77
78
        } else {
79
80
        }
80
81
 
81
82
        // user or group choosen?
82
 
        $who = trim($_REQUEST['acl_w']);
83
 
        if($_REQUEST['acl_t'] == '__g__' && $who){
 
83
        $who = trim($INPUT->str('acl_w'));
 
84
        if($INPUT->str('acl_t') == '__g__' && $who){
84
85
            $this->who = '@'.ltrim($auth->cleanGroup($who),'@');
85
 
        }elseif($_REQUEST['acl_t'] == '__u__' && $who){
 
86
        }elseif($INPUT->str('acl_t') == '__u__' && $who){
86
87
            $this->who = ltrim($who,'@');
87
 
            if($this->who != '%USER%'){ #keep wildcard as is
 
88
            if($this->who != '%USER%' && $this->who != '%GROUP%'){ #keep wildcard as is
88
89
                $this->who = $auth->cleanUser($this->who);
89
90
            }
90
 
        }elseif($_REQUEST['acl_t'] &&
91
 
                $_REQUEST['acl_t'] != '__u__' &&
92
 
                $_REQUEST['acl_t'] != '__g__'){
93
 
            $this->who = $_REQUEST['acl_t'];
 
91
        }elseif($INPUT->str('acl_t') &&
 
92
                $INPUT->str('acl_t') != '__u__' &&
 
93
                $INPUT->str('acl_t') != '__g__'){
 
94
            $this->who = $INPUT->str('acl_t');
94
95
        }elseif($who){
95
96
            $this->who = $who;
96
97
        }
97
98
 
98
99
        // handle modifications
99
 
        if(isset($_REQUEST['cmd']) && checkSecurityToken()){
 
100
        if($INPUT->has('cmd') && checkSecurityToken()){
 
101
            $cmd = $INPUT->extract('cmd')->str('cmd');
100
102
 
101
103
            // scope for modifications
102
104
            if($this->ns){
109
111
                $scope = $ID;
110
112
            }
111
113
 
112
 
            if(isset($_REQUEST['cmd']['save']) && $scope && $this->who && isset($_REQUEST['acl'])){
 
114
            if($cmd == 'save' && $scope && $this->who && $INPUT->has('acl')){
113
115
                // handle additions or single modifications
114
116
                $this->_acl_del($scope, $this->who);
115
 
                $this->_acl_add($scope, $this->who, (int) $_REQUEST['acl']);
116
 
            }elseif(isset($_REQUEST['cmd']['del']) && $scope && $this->who){
 
117
                $this->_acl_add($scope, $this->who, $INPUT->int('acl'));
 
118
            }elseif($cmd == 'del' && $scope && $this->who){
117
119
                // handle single deletions
118
120
                $this->_acl_del($scope, $this->who);
119
 
            }elseif(isset($_REQUEST['cmd']['update'])){
 
121
            }elseif($cmd == 'update'){
 
122
                $acl = $INPUT->arr('acl');
 
123
 
120
124
                // handle update of the whole file
121
 
                foreach((array) $_REQUEST['del'] as $where => $names){
 
125
                foreach($INPUT->arr('del') as $where => $names){
122
126
                    // remove all rules marked for deletion
123
127
                    foreach($names as $who)
124
 
                        unset($_REQUEST['acl'][$where][$who]);
 
128
                        unset($acl[$where][$who]);
125
129
                }
126
130
                // prepare lines
127
131
                $lines = array();
134
138
                    }
135
139
                }
136
140
                // re-add all rules
137
 
                foreach((array) $_REQUEST['acl'] as $where => $opt){
 
141
                foreach($acl as $where => $opt){
138
142
                    foreach($opt as $who => $perm){
139
143
                        if ($who[0]=='@') {
140
144
                            if ($who!='@ALL') {
141
145
                                $who = '@'.ltrim($auth->cleanGroup($who),'@');
142
146
                            }
143
 
                        } elseif ($who != '%USER%'){ #keep wildcard as is
 
147
                        } elseif ($who != '%USER%' && $who != '%GROUP%'){ #keep wildcard as is
144
148
                            $who = $auth->cleanUser($who);
145
149
                        }
146
150
                        $who = auth_nameencode($who,true);
191
195
        echo '</div>'.NL;
192
196
 
193
197
        echo '<div class="footnotes"><div class="fn">'.NL;
194
 
        echo '<sup><a id="fn__1" class="fn_bot" name="fn__1" href="#fnt__1">1)</a></sup>'.NL;
 
198
        echo '<sup><a id="fn__1" class="fn_bot" href="#fnt__1">1)</a></sup>'.NL;
195
199
        echo $this->getLang('p_include');
196
200
        echo '</div></div>';
197
201
 
507
511
        if($item['type']=='d'){
508
512
            if($item['open']){
509
513
                $img   = DOKU_BASE.'lib/images/minus.gif';
510
 
                $alt   = '&minus;';
 
514
                $alt   = '−';
511
515
            }else{
512
516
                $img   = DOKU_BASE.'lib/images/plus.gif';
513
517
                $alt   = '+';
597
601
        echo '<input type="hidden" name="do" value="admin" />'.NL;
598
602
        echo '<input type="hidden" name="page" value="acl" />'.NL;
599
603
        echo '<input type="hidden" name="sectok" value="'.getSecurityToken().'" />'.NL;
 
604
        echo '<div class="table">';
600
605
        echo '<table class="inline">';
601
606
        echo '<tr>';
602
607
        echo '<th>'.$this->getLang('where').'</th>';
603
608
        echo '<th>'.$this->getLang('who').'</th>';
604
 
        echo '<th>'.$this->getLang('perm').'<sup><a id="fnt__1" class="fn_top" name="fnt__1" href="#fn__1">1)</a></sup></th>';
 
609
        echo '<th>'.$this->getLang('perm').'<sup><a id="fnt__1" class="fn_top" href="#fn__1">1)</a></sup></th>';
605
610
        echo '<th>'.$lang['btn_delete'].'</th>';
606
611
        echo '</tr>';
607
612
        foreach($this->acl as $where => $set){
629
634
                echo $this->_html_checkboxes($perm,$ispage,'acl['.$where.']['.$who.']');
630
635
                echo '</td>';
631
636
 
632
 
                echo '<td align="center">';
 
637
                echo '<td class="check">';
633
638
                echo '<input type="checkbox" name="del['.hsc($where).'][]" value="'.hsc($who).'" />';
634
639
                echo '</td>';
635
640
                echo '</tr>';
637
642
        }
638
643
 
639
644
        echo '<tr>';
640
 
        echo '<th align="right" colspan="4">';
 
645
        echo '<th class="action" colspan="4">';
641
646
        echo '<input type="submit" value="'.$lang['btn_update'].'" name="cmd[update]" class="button" />';
642
647
        echo '</th>';
643
648
        echo '</tr>';
644
649
        echo '</table>';
 
650
        echo '</div>';
645
651
        echo '</div></form>'.NL;
646
652
    }
647
653
 
744
750
            }
745
751
 
746
752
            //build code
747
 
            $ret .= '<label for="pbox'.$label.'" title="'.$this->getLang('acl_perm'.$perm).'"'.$class.'>';
748
 
            $ret .= '<input '.buildAttributes($atts).' />&nbsp;';
 
753
            $ret .= '<label for="pbox'.$label.'"'.$class.'>';
 
754
            $ret .= '<input '.buildAttributes($atts).' />&#160;';
749
755
            $ret .= $this->getLang('acl_perm'.$perm);
750
756
            $ret .= '</label>'.NL;
751
757
        }
781
787
        echo '  <option value="__g__" class="aclgroup"'.$gsel.'>'.$this->getLang('acl_group').':</option>'.NL;
782
788
        echo '  <option value="__u__"  class="acluser"'.$usel.'>'.$this->getLang('acl_user').':</option>'.NL;
783
789
        if (!empty($this->specials)) {
784
 
            echo '  <optgroup label="&nbsp;">'.NL;
 
790
            echo '  <optgroup label="&#160;">'.NL;
785
791
            foreach($this->specials as $ug){
786
792
                if($ug == $this->who){
787
793
                    $sel    = ' selected="selected"';
799
805
            echo '  </optgroup>'.NL;
800
806
        }
801
807
        if (!empty($this->usersgroups)) {
802
 
            echo '  <optgroup label="&nbsp;">'.NL;
 
808
            echo '  <optgroup label="&#160;">'.NL;
803
809
            foreach($this->usersgroups as $ug){
804
810
                if($ug == $this->who){
805
811
                    $sel    = ' selected="selected"';