Exemplo n.º 1
0
 public function request($arg)
 {
     $this->cache = false;
     if (!tguard::post()) {
         return;
     }
     $antispam = isset($_POST['antispam']) ? $_POST['antispam'] : '';
     if (!$this->checkspam($antispam)) {
         return 403;
     }
     $password = isset($_POST['password']) ? trim($_POST['password']) : '';
     if ($password == '') {
         return;
     }
     if (!isset($this->perm)) {
         $idperm = isset($_GET['idperm']) ? (int) $_GET['idperm'] : 0;
         $perms = tperms::i();
         if (!$perms->itemexists($idperm)) {
             return 403;
         }
         $this->perm = tperm::i($idperm);
     }
     $backurl = isset($_GET['backurl']) ? $_GET['backurl'] : '';
     if ($this->perm->checkpassword($password)) {
         if ($backurl != '') {
             litepublisher::$urlmap->redir($backurl);
         }
     } else {
         $this->formresult = $this->invalidpassword;
     }
 }
Exemplo n.º 2
0
 public function getowner()
 {
     return tperms::i();
 }
 public function processform()
 {
     $perms = tperms::i();
     if (!($action = $this->action)) {
         $action = 'perms';
     }
     switch ($action) {
         case 'perms':
             $perms->lock();
             foreach ($_POST as $name => $val) {
                 if (!is_numeric($value)) {
                     continue;
                 }
                 $id = (int) $val;
                 $perms->delete($id);
             }
             $perms->unlock();
             return;
         case 'edit':
             $id = $this->idget();
             if (!$perms->itemexists($id)) {
                 return $this->notfound();
             }
             $perm = tperm::i($id);
             return $perm->admin->processform();
         case 'add':
             $class = tadminhtml::getparam('class', '');
             if (isset($perms->classes[$class])) {
                 $perm = new $class();
                 $id = tperms::i()->add($perm);
                 $perm->admin->processform();
                 return litepublisher::$urlmap->redir(tadminhtml::getadminlink($this->url, 'action=edit&id=' . $id));
             }
     }
 }