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;
 }
 public function request($arg)
 {
     $this->cache = false;
     //tfiler::log(var_export($_GET, true) . var_export($_POST, true) . var_export($_FILES, true));
     if ($err = self::auth()) {
         return $err;
     }
     $this->idpost = tadminhtml::idparam();
     $this->isauthor = litepublisher::$options->ingroup('author');
     if ($this->idpost > 0) {
         $posts = tposts::i();
         if (!$posts->itemexists($this->idpost)) {
             return self::error403();
         }
         if (!litepublisher::$options->hasgroup('editor')) {
             if (litepublisher::$options->hasgroup('author')) {
                 $this->isauthor = true;
                 $post = tpost::i($this->idpost);
                 if (litepublisher::$options->user != $post->author) {
                     return self::error403();
                 }
             }
         }
     }
     return $this->getcontent();
 }
 public function getcontent()
 {
     $result = '';
     switch ($this->name) {
         case 'menu':
             if (isset($_GET['action']) && in_array($_GET['action'], array('delete', 'setdraft', 'publish'))) {
                 $result .= $this->doaction($this->idget(), $_GET['action']);
             }
             $result .= $this->getmenulist();
             return $result;
         case 'edit':
         case 'editfake':
             $id = tadminhtml::idparam();
             $menus = tmenus::i();
             $parents = array(0 => '-----');
             foreach ($menus->items as $item) {
                 $parents[$item['id']] = $item['title'];
             }
             $html = $this->html;
             $lang = tlocal::i('menu');
             $args = new targs();
             $args->adminurl = $this->adminurl;
             $args->ajax = tadminhtml::getadminlink('/admin/ajaxmenueditor.htm', "id={$id}&get");
             $args->editurl = tadminhtml::getadminlink('/admin/menu/edit', 'id');
             if ($id == 0) {
                 $args->id = 0;
                 $args->title = '';
                 $args->parent = tadminhtml::array2combo($parents, 0);
                 $args->order = tadminhtml::array2combo(range(0, 10), 0);
                 $status = 'published';
             } else {
                 if (!$menus->itemexists($id)) {
                     return $this->notfound;
                 }
                 $menuitem = tmenu::i($id);
                 $args->id = $id;
                 $args->title = $menuitem->getownerprop('title');
                 $args->parent = tadminhtml::array2combo($parents, $menuitem->parent);
                 $args->order = tadminhtml::array2combo(range(0, 10), $menuitem->order);
                 $status = $menuitem->status;
             }
             $args->status = tadminhtml::array2combo(array('draft' => $lang->draft, 'published' => $lang->published), $status);
             if ($this->name == 'editfake' || $id > 0 && $menuitem instanceof tfakemenu) {
                 $args->url = $id == 0 ? '' : $menuitem->url;
                 $args->type = 'fake';
                 $args->formtitle = $lang->faketitle;
                 return $html->adminform('[text=title]
     [text=url]
     [combo=parent]
     [combo=order]
     [combo=status]
     [hidden=type]
     [hidden=id]', $args);
             }
             $tabs = new tuitabs();
             $tabs->add($lang->title, '
   [text=title]
   [combo=parent]
   [combo=order]
   [combo=status]
   [hidden=id]
   ');
             $ajaxurl = tadminhtml::getadminlink('/admin/ajaxmenueditor.htm', "id={$id}&get");
             $tabs->ajax($lang->view, "{$ajaxurl}=view");
             $tabs->ajax('SEO', "{$ajaxurl}=seo");
             $ajaxeditor = tajaxmenueditor::i();
             $args->formtitle = $lang->edit;
             return tuitabs::gethead() . $html->adminform($tabs->get() . sprintf('<div>%s</div>', $ajaxeditor->geteditor('raw', $id == 0 ? '' : $menuitem->rawcontent, true)), $args);
     }
 }