Пример #1
0
 public function request($id)
 {
     $files = tfiles::i();
     if (!$files->itemexists($id)) {
         return 404;
     }
     $item = $files->getitem($id);
     $filename = '/files/' . $item['filename'];
     if ((int) $item['idperm'] == 0) {
         if ($filename == litepublisher::$urlmap->url) {
             header('HTTP/1.1 500 Internal Server Error', true, 500);
             exit;
         }
         return litepublisher::$urlmap->redir($filename);
     }
     $this->id = $id;
     $this->item = $item;
     $result = '<?php
 Header(\'Cache-Control: no-cache, must-revalidate\');
 Header(\'Pragma: no-cache\');
 ?>';
     $perm = tperm::i($item['idperm']);
     $result .= $perm->getheader($this);
     $result .= sprintf('<?php %s::sendfile(%s); ?>', get_class($this), var_export($item, true));
     //die(htmlspecialchars($result));
     return $result;
 }
Пример #2
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;
     }
 }
 protected function create()
 {
     parent::create();
     $this->adminclass = 'tadminpermpassword';
     $this->data['password'] = '';
     $this->data['login'] = '';
 }
Пример #4
0
 protected function create()
 {
     parent::create();
     $this->adminclass = 'tadminpermgroups';
     $this->data['author'] = false;
     $this->data['groups'] = array();
 }
Пример #5
0
 public function request($arg)
 {
     $result = '';
     if ($arg == 'posts' && $this->feedburner != '') {
         $result .= "<?php\n      if (!preg_match('/feedburner|feedvalidator/i', \$_SERVER['HTTP_USER_AGENT'])) {\n        return litepublisher::\$urlmap->redir('{$this->feedburner}', 307);\n      }\n      ?>";
     } elseif ($arg == 'comments' && $this->feedburnercomments != '') {
         $result .= "<?php\n      if (!preg_match('/feedburner|feedvalidator/i', \$_SERVER['HTTP_USER_AGENT'])) {\n        return litepublisher::\$urlmap->redir('{$this->feedburnercomments}', 307);\n      }\n      ?>";
     }
     $result .= '<?php turlmap::sendxml(); ?>';
     $this->domrss = new tdomrss();
     switch ($arg) {
         case 'posts':
             $this->getrecentposts();
             break;
         case 'comments':
             $this->GetRecentComments();
             break;
         case 'categories':
         case 'tags':
             if (!preg_match('/\\/(\\d*?)\\.xml$/', litepublisher::$urlmap->url, $match)) {
                 return 404;
             }
             $id = (int) $match[1];
             $tags = $arg == 'categories' ? tcategories::i() : ttags::i();
             if (!$tags->itemexists($id)) {
                 return 404;
             }
             $tags->id = $id;
             if (isset($tags->idperm) && ($idperm = $tags->idperm)) {
                 $perm = tperm::i($idperm);
                 if ($header = $perm->getheader($tags)) {
                     $result = $header . $result;
                 }
             }
             $this->gettagrss($tags, $id);
             break;
         default:
             if (!preg_match('/\\/(\\d*?)\\.xml$/', litepublisher::$urlmap->url, $match)) {
                 return 404;
             }
             $idpost = (int) $match[1];
             $posts = tposts::i();
             if (!$posts->itemexists($idpost)) {
                 return 404;
             }
             $post = tpost::i($idpost);
             if ($post->status != 'published') {
                 return 404;
             }
             if (isset($post->idperm) && $post->idperm > 0) {
                 $perm = tperm::i($post->idperm);
                 if ($header = $perm->getheader($post)) {
                     $result = $header . $result;
                 }
             }
             $this->GetRSSPostComments($idpost);
     }
     $result .= $this->domrss->GetStripedXML();
     return $result;
 }
Пример #6
0
 public function getpermheader(array $shortpost)
 {
     $urlmap = litepublisher::$urlmap;
     $url = $urlmap->url;
     $saveitem = $urlmap->itemrequested;
     $urlmap->itemrequested = $urlmap->getitem($shortpost['idurl']);
     $urlmap->url = $urlmap->itemrequested['url'];
     $post = tpost::i((int) $shortpost['id']);
     $perm = tperm::i($post->idperm);
     // not restore values because perm will be used this values
     return $perm->getheader($post);
 }
 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));
             }
     }
 }
Пример #8
0
 protected function httpheader()
 {
     $ctx = $this->context;
     if (method_exists($ctx, 'httpheader')) {
         $result = $ctx->httpheader();
         if (!empty($result)) {
             return $result;
         }
     }
     if (isset($ctx->idperm) && ($idperm = $ctx->idperm)) {
         $perm = tperm::i($idperm);
         if ($result = $perm->getheader($ctx)) {
             return $result . turlmap::htmlheader($ctx->cache);
         }
     }
     return turlmap::htmlheader($ctx->cache);
 }