private function createAdminContent()
 {
     if ($this->actionType == TS_AACTION_ADD) {
         // New username
         $textArea = new TSTextInput(30, 5, 30, 3);
         $textArea->setId('adminUsername');
         $textArea->setTType($this->getTType());
         $textArea->setMaxLength(23);
         $textArea->setText('');
         $textArea->setOptions(TS_OPT_ISSELECTABLE | TS_OPT_ISEDITABLE);
         $textArea->setBorder(TS_BORDER_REGULAR);
         $textArea->setCaption('LFS Username (exact match)');
         $this->add($textArea);
         // New password
         $textArea = new TSTextInput(30, 9, 30, 3);
         $textArea->setId('adminPassword');
         $textArea->setTType($this->getTType());
         $textArea->setMaxLength(23);
         $textArea->setText('');
         $textArea->setOptions(TS_OPT_ISSELECTABLE | TS_OPT_ISEDITABLE);
         $textArea->setBorder(TS_BORDER_REGULAR);
         $textArea->setCaption('Prism Password');
         $this->add($textArea);
         // Admin flags
         $textArea = new TSTextInput(30, 13, 30, 3);
         $textArea->setId('adminFlags');
         $textArea->setTType($this->getTType());
         $textArea->setMaxLength(26);
         $textArea->setText('abcdetc');
         $textArea->setOptions(TS_OPT_ISSELECTABLE | TS_OPT_ISEDITABLE);
         $textArea->setBorder(TS_BORDER_REGULAR);
         $textArea->setCaption('Permission flags');
         $this->add($textArea);
         // Save
         $textArea = new TSTextArea(30, 17, 12, 3);
         $textArea->setId('adminSave');
         $textArea->setTType($this->getTType());
         $textArea->setText('Save admin');
         $textArea->setOptions(TS_OPT_ISSELECTABLE);
         $textArea->setBorder(TS_BORDER_REGULAR);
         $this->add($textArea);
     } else {
         // New password
         $textArea = new TSTextInput(30, 5, 30, 3);
         $textArea->setId('adminPassword');
         $textArea->setTType($this->getTType());
         $textArea->setText('');
         $textArea->setOptions(TS_OPT_ISSELECTABLE | TS_OPT_ISEDITABLE);
         $textArea->setBorder(TS_BORDER_REGULAR);
         $textArea->setCaption('Prism Password');
         $this->add($textArea);
         // Admin flags
         $textArea = new TSTextInput(30, 9, 30, 3);
         $textArea->setId('adminFlags');
         $textArea->setTType($this->getTType());
         $textArea->setText(flagsToString($this->userDetails['accessFlags']));
         $textArea->setOptions(TS_OPT_ISSELECTABLE | TS_OPT_ISEDITABLE);
         $textArea->setBorder(TS_BORDER_REGULAR);
         $textArea->setCaption('Permission flags');
         $this->add($textArea);
         // Save
         $textArea = new TSTextArea(30, 13, 12, 3);
         $textArea->setId('adminSave');
         $textArea->setTType($this->getTType());
         $textArea->setText('Save admin');
         $textArea->setOptions(TS_OPT_ISSELECTABLE);
         $textArea->setBorder(TS_BORDER_REGULAR);
         $this->add($textArea);
         // Delete
         $textArea = new TSTextArea(30, 17, 14, 3);
         $textArea->setId('adminDelete');
         $textArea->setTType($this->getTType());
         $textArea->setText('Delete admin');
         $textArea->setOptions(TS_OPT_ISSELECTABLE);
         $textArea->setBorder(TS_BORDER_REGULAR);
         $this->add($textArea);
     }
 }
Beispiel #2
0
 public function revokeAccessFlags($username, $flags, $store = true)
 {
     $username = strToLower($username);
     if (!isset($this->admins[$username])) {
         return false;
     }
     // Revoke the permissions
     $this->admins[$username]['accessFlags'] &= ~$flags;
     // Rewrite accessFlags line for user in admins.ini
     if ($store) {
         $this->rewriteLine($username, 'accessFlags', flagsToString($this->admins[$username]['accessFlags']));
     }
     return true;
 }