public function getcontent()
 {
     $id = tadminhtml::idparam();
     $menus = tmenus::i();
     if ($id != 0 && !$menus->itemexists($id)) {
         return self::error403();
     }
     $menu = tmenu::i($id);
     if (litepublisher::$options->group == 'author' && litepublisher::$options->user != $menu->author) {
         return self::error403();
     }
     if ($id > 0 && !$menus->itemexists($id)) {
         return self::error403();
     }
     $views = tviews::i();
     $theme = tview::i($views->defaults['admin'])->theme;
     $html = tadminhtml::i();
     $html->section = 'menu';
     switch ($_GET['get']) {
         case 'view':
             $result = tadminviews::getcomboview($id == 0 ? $views->defaults['menu'] : $menu->idview);
             break;
         case 'seo':
             $args = targs::i();
             $args->url = $menu->url;
             $args->keywords = $menu->keywords;
             $args->description = $menu->description;
             $args->head = $menu->data['head'];
             $result = $html->parsearg('[text=url] [text=description] [text=keywords] [editor=head]', $args);
             break;
         default:
             $result = var_export($_GET, true);
     }
     return turlmap::htmlheader(false) . $result;
 }
 public function getcontent()
 {
     $type = tadminhtml::getparam('type', 'tags') == 'tags' ? 'tags' : 'categories';
     $tags = $type == 'tags' ? ttags::i() : tcategories::i();
     if ($err = self::auth()) {
         return $err;
     }
     $id = tadminhtml::idparam();
     if ($id > 0 && !$tags->itemexists($id)) {
         return self::error403();
     }
     $theme = tview::i(tviews::i()->defaults['admin'])->theme;
     $html = tadminhtml::i();
     $html->section = 'tags';
     $lang = tlocal::i('tags');
     if ($id == 0) {
         $views = tviews::i();
         $name = $type == 'tags' ? 'tag' : 'category';
         $item = array('title' => '', 'idview' => isset($views->defaults[$name]) ? $views->defaults[$name] : 1, 'idperm' => 0, 'icon' => 0, 'includechilds' => $tags->includechilds, 'includeparents' => $tags->includeparents, 'invertorder' => false, 'lite' => $tags->lite, 'liteperpage' => 1000, 'url' => '', 'keywords' => '', 'description' => '', 'head' => '');
     } else {
         $item = $tags->getitem($id);
     }
     switch ($_GET['get']) {
         case 'view':
             if ($id > 0) {
                 foreach (array('includechilds', 'includeparents', 'invertorder', 'lite') as $prop) {
                     $item[$prop] = (int) $item[$prop] > 0;
                 }
             }
             $args = new targs();
             $args->add($item);
             $result = $html->parsearg('[checkbox=includechilds] [checkbox=includeparents] [checkbox=invertorder] [checkbox=lite] [text=liteperpage]', $args);
             $result .= $this->getviewicon($item['idview'], $item['icon']);
             $result .= tadminperms::getcombo($item['idperm']);
             break;
         case 'seo':
             $args = targs::i();
             if ($id == 0) {
                 $args->url = '';
                 $args->keywords = '';
                 $args->description = '';
                 $args->head = '';
             } else {
                 $args->add($tags->contents->getitem($id));
                 $args->url = $tags->items[$id]['url'];
             }
             $result = $html->parsearg('[text=url] [text=description] [text=keywords] [editor=head]', $args);
             break;
         case 'text':
             $result = $this->geteditor('raw', $id == 0 ? '' : $tags->contents->getcontent($id), true);
             $result .= $this->gethead();
             break;
         default:
             $result = var_export($_GET, true);
     }
     return turlmap::htmlheader(false) . $result;
 }
Esempio n. 3
0
 public function request($arg)
 {
     $this->cache = false;
     $id = self::getget('id');
     $sidebar = self::getget('sidebar');
     $this->idurlcontext = self::getget('idurl');
     if ($id === false || $sidebar === false || !$this->itemexists($id)) {
         return $this->error_request('Invalid params');
     }
     $themename = isset($_GET['themename']) ? trim($_GET['themename']) : tview::i(1)->themename;
     if (!preg_match('/^\\w[\\w\\.\\-_]*+$/', $themename) || !ttheme::exists($themename)) {
         $themename = tviews::i(1)->themename;
     }
     $theme = ttheme::getinstance($themename);
     try {
         $result = $this->getwidgetcontent($id, $sidebar);
         return turlmap::htmlheader(false) . $result;
     } catch (Exception $e) {
         return $this->error_request('Cant get widget content');
     }
 }
Esempio n. 4
0
 public function processform()
 {
     switch ($_POST['formtype']) {
         case 'colors':
             foreach ($_POST as $name => $value) {
                 if (strbegin($name, 'color_')) {
                     $name = substr($name, strlen('color_'));
                     $this->setcolor($name, $value);
                 }
             }
             $this->sendfile();
             break;
         case 'uploadcolors':
             if (isset($_FILES['filename'])) {
                 if (isset($_FILES['filename']['error']) && $_FILES['filename']['error'] > 0) {
                     $lang = tlocal::admin('uploaderrors');
                     return sprintf('<h4>%s</h4>', $lang->__get($_FILES['filename']['error']));
                 } elseif (!is_uploaded_file($_FILES['filename']['tmp_name'])) {
                     return sprintf('<h4>%s</h4>', $lng['attack']);
                 } else {
                     $this->colorsuploaded = true;
                     $colors = parse_ini_file($_FILES['filename']['tmp_name']);
                     foreach ($colors as $name => $value) {
                         $this->setcolor($name, $value);
                     }
                 }
             }
             break;
         case 'headerurl':
             if (!isset($_FILES['Filedata']) || !is_uploaded_file($_FILES['Filedata']['tmp_name']) || $_FILES['Filedata']['error'] != 0) {
                 return 403;
             }
             if ($result = $this->imageresize($_FILES['Filedata']['name'], $_FILES['Filedata']['tmp_name'], $this->colors['headerwidth'], $this->colors['headerheight'])) {
                 return turlmap::htmlheader(false) . $result;
             }
             return 403;
         case 'logourl':
             if (!isset($_FILES['Filedata']) || !is_uploaded_file($_FILES['Filedata']['tmp_name']) || $_FILES['Filedata']['error'] != 0) {
                 return 403;
             }
             if ($result = $this->uploadlogo($_FILES['Filedata']['name'], $_FILES['Filedata']['tmp_name'], $this->colors['logopadding'], $this->colors['logoheight'])) {
                 return turlmap::htmlheader(false) . json_encode($result);
             }
             return 403;
     }
     return '';
 }
 public function httpheader()
 {
     return turlmap::htmlheader(false);
 }
 public function getcontent()
 {
     $theme = tview::i(tviews::i()->defaults['admin'])->theme;
     $html = tadminhtml::i();
     $html->section = 'editor';
     $lang = tlocal::i('editor');
     $post = tpost::i($this->idpost);
     ttheme::$vars['post'] = $post;
     switch ($_GET['get']) {
         case 'tags':
             $result = $html->getedit('tags', $post->tagnames, $lang->tags);
             $lang->section = 'editor';
             $result .= $html->h4->addtags;
             $items = array();
             $tags = $post->factory->tags;
             $list = $tags->getsorted(-1, 'name', 0);
             foreach ($list as $id) {
                 $items[] = '<a href="" class="posteditor-tag">' . $tags->items[$id]['title'] . "</a>";
             }
             $result .= sprintf('<p>%s</p>', implode(', ', $items));
             break;
         case 'status':
             $args = new targs();
             $args->comstatus = tadminhtml::array2combo(array('closed' => $lang->closed, 'reg' => $lang->reg, 'guest' => $lang->guest, 'comuser' => $lang->comuser), $post->comstatus);
             $args->pingenabled = $post->pingenabled;
             $args->status = tadminhtml::array2combo(array('published' => $lang->published, 'draft' => $lang->draft), $post->status);
             $args->perms = tadminperms::getcombo($post->idperm);
             $args->password = $post->password;
             $result = $html->parsearg('[combo=comstatus]
   [checkbox=pingenabled]
   [combo=status]
   $perms
   [password=password]
   <p>$lang.notepassword</p>', $args);
             break;
         case 'view':
             $result = $this->getviewicon($post->idview, $post->icon);
             break;
         default:
             $result = var_export($_GET, true);
     }
     //tfiler::log($result);
     return turlmap::htmlheader(false) . $result;
 }
Esempio n. 7
0
 public function httpheader()
 {
     return "<?php Header( 'HTTP/1.0 404 Not Found'); ?>" . turlmap::htmlheader(false);
 }
Esempio n. 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);
 }