public function getcontent()
 {
     if (!($id = $this->getidfile())) {
         return $this->notfound;
     }
     $result = '';
     $files = tfiles::i();
     $html = $this->html;
     $lang = tlocal::admin();
     $args = new targs();
     $item = $files->getitem($id);
     $idpreview = $item['preview'];
     if ($idpreview > 0) {
         $args->add($files->getitem($idpreview));
         $form = new adminform($args);
         $form->action = "{$this->adminurl}={$id}";
         $form->inline = true;
         $form->items = $html->p('<img src="$site.files/files/$filename" alt="thumbnail" />' . $lang->wantdelete);
         $form->submit = 'delete';
         $result .= $form->get();
     }
     $form = new adminform($args);
     $form->upload = true;
     $form->action = "{$this->adminurl}={$id}";
     $form->title = $lang->changethumb;
     $form->items = '[upload=filename]
 [checkbox=noresize]';
     $result .= $form->get();
     return $result;
 }
 private function getpingbackslist()
 {
     $result = '';
     $pingbacks = tpingbacks::i();
     $perpage = 20;
     $total = $pingbacks->getcount();
     $from = $this->getfrom($perpage, $total);
     $db = $pingbacks->db;
     $t = $pingbacks->thistable;
     $items = $db->res2assoc($db->query("select {$t}.*, {$db->posts}.title as posttitle, {$db->urlmap}.url as posturl\n    from {$t}, {$db->posts}, {$db->urlmap}\n    where {$t}.status <> 'deleted' and {$db->posts}.id = {$t}.post and {$db->urlmap}.id = {$db->posts}.idurl\n    order by {$t}.posted desc limit {$from}, {$perpage}"));
     $html = $this->html;
     $lang = tlocal::i();
     $args = new targs();
     $form = new adminform($args);
     $form->items = $html->getitemscount($from, $from + count($items), $total);
     ttheme::$vars['pingitem'] = new pingitem();
     $form->items .= $html->buildtable($items, array($html->get_table_checkbox('id'), array('left', $lang->date, '$pingitem.date'), array('left', $lang->status, '$pingitem.status'), array('left', $lang->title, '$title'), array('left', $lang->url, '<a href="$url">$url</a>'), array('left', 'IP', '$ip'), array('left', $lang->post, '<a href="$posturl">$posttitle</a>'), array('center', $lang->edit, "<a href='{$this->adminurl}=\$id&action=edit'>{$lang->edit}</a>")));
     unset(ttheme::$vars['pingitem']);
     $form->items .= $html->div($html->getsubmit('approve', 'hold', 'delete'));
     $form->submit = false;
     $result = $form->get();
     $theme = ttheme::i();
     $result .= $theme->getpages($this->url, litepublisher::$urlmap->page, ceil($total / $perpage));
     return $result;
 }
 public function getcontent()
 {
     $result = '';
     $html = $this->inihtml();
     $lang = tlocal::admin('downloaditems');
     $lang->ini['downloaditems'] = $lang->ini['downloaditem'] + $lang->ini['downloaditems'];
     $args = new targs();
     $args->adminurl = $this->adminurl;
     $editurl = tadminhtml::getadminlink('/admin/downloaditems/editor/', 'id');
     $args->editurl = $editurl;
     $downloaditems = tdownloaditems::i();
     $perpage = 20;
     $where = litepublisher::$options->group == 'downloaditem' ? ' and author = ' . litepublisher::$options->user : '';
     switch ($this->name) {
         case 'addurl':
             $args->formtitle = $lang->addurl;
             $args->url = tadminhtml::getparam('url', '');
             return $html->adminform('[text=url]', $args);
         case 'theme':
             $where .= " and type = 'theme' ";
             break;
         case 'plugin':
             $where .= " and type = 'plugin' ";
             break;
     }
     $count = $downloaditems->getchildscount($where);
     $from = $this->getfrom($perpage, $count);
     if ($count > 0) {
         $items = $downloaditems->select("status <> 'deleted' {$where}", " order by posted desc limit {$from}, {$perpage}");
         if (!$items) {
             $items = array();
         }
     } else {
         $items = array();
     }
     $result .= $html->editlink();
     $form = new adminform(new targs());
     $form->items = $html->getitemscount($from, $from + count($items), $count);
     $form->items .= $html->tableposts($items, array(array('right', $lang->downloads, '$post.downloads'), array('left', $lang->posttitle, '$post.bookmark'), array('left', $lang->status, '$ticket_status.status'), array('left', $lang->tags, '$post.tagnames'), array('center', $lang->edit, '<a href="' . $editurl . '=$post.id">' . $lang->edit . '</a>')));
     $form->items .= $html->div('[button=publish]
 [button=setdraft]
 [button=delete]');
     $form->submit = false;
     $result .= $form->get();
     $result = $html->fixquote($result);
     $theme = ttheme::i();
     $result .= $theme->getpages($this->url, litepublisher::$urlmap->page, ceil($count / $perpage));
     return $result;
 }
 public function gettable($posts, $where)
 {
     $perpage = 20;
     if ($this->isauthor) {
         $where .= ' and author = ' . litepublisher::$options->user;
     }
     $count = $posts->db->getcount($where);
     $from = $this->getfrom($perpage, $count);
     $items = $posts->select($where, " order by posted desc limit {$from}, {$perpage}");
     if (!$items) {
         $items = array();
     }
     $html = $this->html;
     $lang = tlocal::admin();
     $form = new adminform(new targs());
     $form->items = $html->getitemscount($from, $from + count($items), $count);
     $form->items .= $html->tableposts($items, array(array('center', $lang->date, '$post.date'), array('left', $lang->posttitle, '$post.bookmark'), array('left', $lang->category, '$post.category'), array('left', $lang->status, '$poststatus.status'), array('center', $lang->edit, '<a href="' . tadminhtml::getadminlink('/admin/posts/editor/', 'id') . '=$post.id">' . $lang->edit . '</a>'), array('center', $lang->delete, "<a class=\"confirm-delete-link\" href=\"{$this->adminurl}=\$post.id&action=delete\">{$lang->delete}</a>")));
     $form->items .= $html->div('[button=publish]
 [button=setdraft]
 [button=delete]');
     $form->submit = false;
     $result = $form->get();
     $result = $html->fixquote($result);
     $theme = ttheme::i();
     $result .= $theme->getpages('/admin/posts/', litepublisher::$urlmap->page, ceil($count / $perpage));
     return $result;
 }
 public function getcontent()
 {
     $result = '';
     $users = tusers::i();
     $groups = tusergroups::i();
     $html = $this->html;
     $lang = tlocal::i('users');
     $args = targs::i();
     $id = $this->idget();
     switch ($this->action) {
         case 'edit':
             if (!$users->itemexists($id)) {
                 $result .= $this->notfound();
             } else {
                 $statuses = array();
                 foreach (array('approved', 'hold', 'comuser') as $name) {
                     $statuses[$name] = $lang->{$name};
                 }
                 $item = $users->getitem($id);
                 $args->add($item);
                 $args->registered = tuserpages::i()->getvalue($id, 'registered');
                 $args->formtitle = $item['name'];
                 $args->status = tadminhtml::array2combo($statuses, $item['status']);
                 $tabs = new tuitabs();
                 $tabs->add($lang->login, '[text=email] [password=password]');
                 $tabs->add($lang->groups, '[combo=status]' . tadmingroups::getgroups($item['idgroups']));
                 $tabs->add('Cookie', '[text=cookie] [text=expired] [text=registered] [text=trust]');
                 $args->password = '';
                 $result .= $html->adminform($tabs->get(), $args);
             }
             break;
         case 'delete':
             $result .= $html->confirm_delete($users, $this->adminurl);
             break;
         default:
             $args->formtitle = $lang->newuser;
             $args->email = '';
             $args->action = 'add';
             $tabs = new tuitabs();
             $tabs->add($lang->login, '[text=email] [password=password] [text=name] [hidden=action]');
             $tabs->add($lang->groups, tadmingroups::getgroups(array()));
             $result .= $html->adminform($tabs->get(), $args);
     }
     $args->search = '';
     //table
     $perpage = 20;
     $count = $users->count;
     $from = $this->getfrom($perpage, $count);
     $where = '';
     $params = '';
     if (!empty($_GET['idgroup'])) {
         $idgroup = (int) tadminhtml::getparam('idgroup', 0);
         if ($groups->itemexists($idgroup)) {
             $grouptable = litepublisher::$db->prefix . $users->grouptable;
             $where = "{$users->thistable}.id in (select iduser from {$grouptable} where idgroup = {$idgroup})";
             $params = "idgroup={$idgroup}";
         }
     } elseif ($search = trim(tadminhtml::getparam('search', ''))) {
         $params = 'search=' . urlencode($search);
         $args->search = $search;
         $search = litepublisher::$db->escape($search);
         $search = strtr($search, array('%' => '\\%', '_' => '\\_'));
         $where = "email like '%{$search}%' or name like '%{$search}%' ";
         $count = $users->db->getcount($where);
         $from = $this->getfrom($perpage, $count);
     }
     $items = $users->select($where, " order by id desc limit {$from}, {$perpage}");
     if (!$items) {
         $items = array();
     }
     $args->adminurl = $this->adminurl;
     $args->formtitle = $lang->userstable;
     $args->table = $html->items2table($users, $items, array($html->get_table_checkbox('user'), array('left', $lang->edit, sprintf('<a href="%s=$id&action=edit">$name</a>', $this->adminurl)), $html->get_table_item('status'), array('left', $lang->comments, sprintf('<a href="%s">%s</a>', tadminhtml::getadminlink('/admin/comments/', 'iduser=$id'), $lang->comments)), array('left', $lang->page, sprintf('<a href="%s">%s</a>', tadminhtml::getadminlink('/admin/users/pages/', 'id=$id'), $lang->page)), $html->get_table_link('delete', $this->adminurl)));
     $result .= $html->deletetable($args);
     $result = $html->fixquote($result);
     $theme = ttheme::i();
     $result .= $theme->getpages($this->url, litepublisher::$urlmap->page, ceil($count / $perpage), $params);
     $form = new adminform($args);
     $form->method = 'get';
     $form->inline = true;
     $form->items = '[text=search]';
     $form->submit = 'find';
     $result .= $form->get();
     return $result;
 }
 public function getcontent()
 {
     $result = '';
     $views = tviews::i();
     $html = $this->html;
     $lang = tlocal::i('views');
     $args = new targs();
     switch ($this->name) {
         case 'views':
             $html->addsearch('views');
             $lang->addsearch('views');
             $id = tadminhtml::getparam('idview', 0);
             if (!$id || !$views->itemexists($id)) {
                 $adminurl = $this->adminurl . 'view';
                 return $html->h4($html->getlink($this->url . '/addview/', $lang->add)) . $html->buildtable($views->items, array(array('left', $lang->name, "<a href=\"{$adminurl}=\$id\">\$name</a>"), array('center', $lang->delete, "<a href=\"{$adminurl}=\$id&action=delete\" class=\"confirm-delete-link\">{$lang->delete}</a>")));
             }
             $result = self::getviewform($this->url);
             $tabs = new tuitabs();
             $menuitems = array();
             foreach ($views->items as $itemview) {
                 $class = $itemview['menuclass'];
                 $menuitems[$class] = $class == 'tmenus' ? $lang->stdmenu : ($class == 'tadminmenus' ? $lang->adminmenu : $class);
             }
             $itemview = $views->items[$id];
             $args->add($itemview);
             $tabs->add($lang->widgets, $this->get_view_sidebars($id, $html, $lang, $args));
             $args->menu = tadminhtml::array2combo($menuitems, $itemview['menuclass']);
             $tabs->add($lang->name, '[text=name]' . ($id == 1 ? '' : '[checkbox=customsidebar] [checkbox=disableajax]') . '[checkbox=hovermenu] [combo=menu]');
             $view = tview::i($id);
             $lang->firstsearch('themes');
             $tabs->add($lang->theme, tadminthemes::getlist($html->radiotheme, $view->theme->name));
             if (count($view->custom)) {
                 $tabs->add($lang->custom, $this->get_custom($view));
             }
             $result .= $html->h4->help;
             $form = new adminform($args);
             $form->id = 'admin-view-form';
             $form->title = $lang->edit;
             $form->items = $tabs->get();
             $result .= $form->get();
             $result .= ttemplate::i()->getjavascript(ttemplate::i()->jsmerger_adminviews);
             break;
         case 'addview':
             $args->formtitle = $lang->addview;
             $result .= $html->adminform('[text=name]', $args);
             break;
         case 'spec':
             $tabs = new tuitabs();
             $inputs = '';
             foreach (self::getspecclasses() as $classname) {
                 $obj = getinstance($classname);
                 $args->classname = $classname;
                 $name = substr($classname, 1);
                 $args->title = $lang->{$name};
                 $inputs = self::getcomboview($obj->idview, "idview-{$classname}");
                 if (isset($obj->data['keywords'])) {
                     $inputs .= $html->getedit("keywords-{$classname}", $obj->data['keywords'], $lang->keywords);
                 }
                 if (isset($obj->data['description'])) {
                     $inputs .= $html->getedit("description-{$classname}", $obj->data['description'], $lang->description);
                 }
                 if (isset($obj->data['head'])) {
                     $inputs .= $html->getinput('editor', "head-{$classname}", tadminhtml::specchars($obj->data['head']), $lang->head);
                 }
                 $tabs->add($lang->{$name}, $inputs);
             }
             $args->formtitle = $lang->defaults;
             $result .= tuitabs::gethead() . $html->adminform($tabs->get(), $args);
             break;
         case 'group':
             $args->formtitle = $lang->viewposts;
             $result .= $html->adminform(self::getcomboview($views->defaults['post'], 'postview') . '<input type="hidden" name="action" value="posts" />', $args);
             $args->formtitle = $lang->viewmenus;
             $result .= $html->adminform(self::getcomboview($views->defaults['menu'], 'menuview') . '<input type="hidden" name="action" value="menus" />', $args);
             $args->formtitle = $lang->themeviews;
             $view = tview::i();
             $list = tfiler::getdir(litepublisher::$paths->themes);
             sort($list);
             $themes = array_combine($list, $list);
             $result .= $html->adminform($html->getcombo('themeview', tadminhtml::array2combo($themes, $view->themename), $lang->themename) . '<input type="hidden" name="action" value="themes" />', $args);
             break;
         case 'defaults':
             $items = '';
             $theme = ttheme::i();
             $tml = $theme->templates['content.admin.combo'];
             foreach ($views->defaults as $name => $id) {
                 $args->name = $name;
                 $args->value = self::getcombo($id);
                 $args->data['$lang.$name'] = $lang->{$name};
                 $items .= $theme->parsearg($tml, $args);
             }
             $args->items = $items;
             $args->formtitle = $lang->defaultsform;
             $result .= $theme->parsearg($theme->content->admin->form, $args);
             break;
         case 'headers':
             $tabs = new tuitabs();
             $args->heads = ttemplate::i()->heads;
             $tabs->add($lang->headstitle, '[editor=heads]');
             $args->adminheads = tadminmenus::i()->heads;
             $tabs->add($lang->admin, '[editor=adminheads]');
             $ajax = tajaxposteditor::i();
             $args->ajaxvisual = $ajax->ajaxvisual;
             $args->visual = $ajax->visual;
             $args->show_file_perm = litepublisher::$options->show_file_perm;
             $tabs->add($lang->posteditor, '[checkbox=show_file_perm] [checkbox=ajaxvisual] [text=visual]');
             $args->formtitle = $lang->headstitle;
             $result = $html->adminform($tabs->get(), $args);
             $result .= tuitabs::gethead();
             break;
         case 'admin':
             return $this->adminoptionsform->getform();
     }
     return $html->fixquote($result);
 }
 public function getcontent()
 {
     $result = '';
     $files = tfiles::i();
     $html = $this->html;
     $lang = $this->lang;
     $args = new targs();
     if (!isset($_GET['action'])) {
         $args->add(array('uploadmode' => 'file', 'downloadurl' => '', 'title' => '', 'description' => '', 'keywords' => ''));
         $form = new adminform($args);
         $form->upload = true;
         $form->title = "<a id='files-source' href='#'>{$lang->switchlink}</a>";
         $form->items = '[upload=filename]
   [hidden=uploadmode]
   [text=downloadurl]
   [text=title]
   [text=description]
   [text=keywords]
   [checkbox=overwrite]';
         if (litepublisher::$options->show_file_perm) {
             $form->items .= tadminperms::getcombo(0, 'idperm');
         }
         $result .= $form->get();
     } else {
         $id = $this->idget();
         if (!$files->itemexists($id)) {
             return $this->notfound;
         }
         switch ($_GET['action']) {
             case 'delete':
                 if ($this->confirmed) {
                     if ('author' == litepublisher::$options->group && ($r = tauthor_rights::i()->candeletefile($id))) {
                         return $r;
                     }
                     $files->delete($id);
                     $result .= $html->h2->deleted;
                 } else {
                     $item = $files->getitem($id);
                     $args->add($item);
                     $args->id = $id;
                     $args->adminurl = $this->adminurl;
                     $args->action = 'delete';
                     $args->confirm = sprintf($this->lang->confirm, $item['filename']);
                     return $html->confirmform($args);
                 }
                 break;
             case 'edit':
                 $item = $files->getitem($id);
                 $args->add($item);
                 $args->title = tcontentfilter::unescape($item['title']);
                 $args->description = tcontentfilter::unescape($item['description']);
                 $args->keywords = tcontentfilter::unescape($item['keywords']);
                 $args->formtitle = $this->lang->editfile;
                 $result .= $html->adminform('[text=title] [text=description] [text=keywords]' . (litepublisher::$options->show_file_perm ? tadminperms::getcombo($item['idperm'], 'idperm') : ''), $args);
                 break;
         }
     }
     $perpage = 20;
     $type = $this->name == 'files' ? '' : $this->name;
     $sql = 'parent =0';
     $sql .= litepublisher::$options->user <= 1 ? '' : ' and author = ' . litepublisher::$options->user;
     $sql .= $type == '' ? " and media<> 'icon'" : " and media = '{$type}'";
     $count = $files->db->getcount($sql);
     $from = $this->getfrom($perpage, $count);
     $list = $files->select($sql, " order by posted desc limit {$from}, {$perpage}");
     if (!$list) {
         $list = array();
     }
     $result .= sprintf($html->h4->countfiles, $count, $from, $from + count($list));
     $args->adminurl = $this->adminurl;
     $result .= $html->buildtable($files->items, array(array('right', 'ID', '$id'), array('right', $lang->filename, '<a href="$site.files/files/$filename">$filename</a>'), array('left', $lang->title, $type != 'icon' ? '$title' : '<img src="$site.files/files/$filename" alt="$filename" />'), array('center', $lang->edit, "<a href=\"{$this->adminurl}=\$id&action=edit\">{$lang->edit}</a>"), array('center', $lang->thumbnail, '<a href="' . tadminhtml::getadminlink('/admin/files/thumbnail/', 'id=') . "\$id\" target=\"_blank\">{$lang->thumbnail}</a>"), array('center', $lang->delete, "<a href=\"{$this->adminurl}=\$id&action=delete\">{$lang->delete}</a>")));
     $theme = ttheme::i();
     $result .= $theme->getpages($this->url, litepublisher::$urlmap->page, ceil($count / $perpage));
     return $result;
 }
 public function getcontent()
 {
     $result = '';
     $html = $this->html;
     $args = targs::i();
     switch ($this->name) {
         case 'service':
             if (!dbversion) {
                 return $html->h2->noupdates;
             }
             $lang = $this->lang;
             $result .= $html->h3->info;
             $result .= $this->doupdate($_GET);
             $result .= $html->tableprops(array('postscount' => litepublisher::$classes->posts->count, 'commentscount' => litepublisher::$classes->commentmanager->count, 'version' => litepublisher::$site->version));
             $updater = tupdater::i();
             $islatest = $updater->islatest();
             if ($islatest === false) {
                 $result .= $html->h4->errorservice;
             } elseif ($islatest <= 0) {
                 $result .= $html->h4->islatest;
             } else {
                 $form = new adminform($args);
                 $form->title = tlocal::i()->requireupdate;
                 $form->items = $this->getloginform() . '[submit=autoupdate]';
                 $form->submit = 'manualupdate';
                 $result .= $form->get();
             }
             break;
         case 'backup':
             if (empty($_GET['action'])) {
                 $args->plugins = false;
                 $args->theme = false;
                 $args->lib = false;
                 $args->dbversion = dbversion ? '' : 'disabled="disabled"';
                 $args->saveurl = true;
                 $form = new adminform($args);
                 $form->upload = true;
                 $form->items = $html->h4->partialform;
                 $form->items .= $this->getloginform();
                 $form->items .= '[checkbox=plugins]
     [checkbox=theme]
     [checkbox=lib]
     [submit=downloadpartial]';
                 $form->items .= $html->p->notefullbackup;
                 $form->items .= '[submit=fullbackup]
     [submit=sqlbackup]';
                 $form->items .= $html->h4->uploadhead;
                 $form->items .= '[upload=filename]
     [checkbox=saveurl]';
                 $form->submit = 'restore';
                 $result = $form->get();
                 $result .= $this->getbackupfilelist();
             } else {
                 $filename = $_GET['id'];
                 if (strpbrk($filename, '/\\<>')) {
                     return $this->notfound;
                 }
                 if (!file_exists(litepublisher::$paths->backup . $filename)) {
                     return $this->notfound;
                 }
                 switch ($_GET['action']) {
                     case 'download':
                         if ($s = @file_get_contents(litepublisher::$paths->backup . $filename)) {
                             $this->sendfile($s, $filename);
                         } else {
                             return $this->notfound;
                         }
                         break;
                     case 'delete':
                         if ($this->confirmed) {
                             @unlink(litepublisher::$paths->backup . $filename);
                             return $html->h2->backupdeleted;
                         } else {
                             $args->adminurl = $this->adminurl;
                             $args->id = $_GET['id'];
                             $args->action = 'delete';
                             $args->confirm = sprintf('%s %s?', $this->lang->confirmdelete, $_GET['id']);
                             $result .= $html->confirmform($args);
                         }
                 }
             }
             break;
         case 'run':
             $args->formtitle = $this->lang->runhead;
             $args->content = isset($_POST['content']) ? $_POST['content'] : '';
             $result = $html->adminform('[editor=content]', $args);
             break;
         case 'upload':
             $args->url = str_replace('$mysite', rawurlencode(litepublisher::$site->url), tadminhtml::getparam('url', ''));
             $lang = tlocal::admin();
             $form = new adminform($args);
             $form->title = $lang->uploaditem;
             $form->upload = true;
             $form->items = '[text=url]
   [upload=filename]' . $this->getloginform();
             $result = $html->p->uploaditems;
             $result .= $form->get();
             break;
     }
     $result = str_replace("'", '"', $result);
     return $result;
 }
 public function getcontent()
 {
     if ($form = $this->getautoform($this->name)) {
         return $form->getform();
     }
     $options = litepublisher::$options;
     $template = ttemplate::i();
     ttheme::$vars['template'] = $template;
     $result = '';
     $args = new targs();
     $lang = tlocal::admin('options');
     $html = $this->html;
     switch ($this->name) {
         case 'options':
             $site = litepublisher::$site;
             $args->fixedurl = $site->fixedurl;
             $args->redirdom = litepublisher::$urlmap->redirdom;
             $args->url = $site->url;
             $args->name = $site->name;
             $args->description = $site->description;
             $args->keywords = $site->keywords;
             $args->author = $site->author;
             $args->footer = $template->footer;
             $args->formtitle = $lang->options;
             return $html->adminform('
   [checkbox=fixedurl]
   [checkbox=redirdom]
   [text=url]
   [text=name]
   [text=description]
   [text=keywords]
   [text=author]
   [editor=footer]
   ', $args);
         case 'home':
             $home = thomepage::i();
             $tabs = new tuitabs();
             $args->image = $home->image;
             $args->parsetags = $home->parsetags;
             $args->showmidle = $home->showmidle;
             $args->midlecat = tposteditor::getcombocategories(array(), $home->midlecat);
             $args->showposts = $home->showposts;
             $args->invertorder = $home->invertorder;
             $args->showpagenator = $home->showpagenator;
             $args->idhome = $home->id;
             $menus = tmenus::i();
             $args->homemenu = $menus->home;
             $tabs->add($lang->options, '
   [checkbox=homemenu]
   [text=image]
   [checkbox=parsetags]
   [checkbox=showmidle]
   [combo=midlecat]
   [checkbox=showposts]
   [checkbox=invertorder]
   [checkbox=showpagenator]
   ');
             $tabs->add($lang->includecats, $html->h4->includehome . tposteditor::getcategories($home->includecats));
             $tabs->add($lang->excludecats, $html->h4->excludehome . str_replace('category-', 'exclude_category-', tposteditor::getcategories($home->excludecats)));
             $args->formtitle = $lang->homeform;
             return tuitabs::gethead() . $html->adminform('<h4><a href="$site.url/admin/menu/edit/{$site.q}id=$idhome">$lang.hometext</a></h4>' . $tabs->get(), $args);
         case 'mail':
             $args->adminemail = $options->email;
             $args->fromemail = $options->fromemail;
             $args->mailer = $options->mailer == 'smtp';
             $subscribers = tsubscribers::i();
             $args->subscribeemail = $subscribers->fromemail;
             $mailer = TSMTPMailer::i();
             $args->host = $mailer->host;
             $args->smtplogin = $mailer->login;
             $args->password = $mailer->password;
             $args->port = $mailer->port;
             $args->formtitle = $lang->mailoptions;
             return $html->adminform('
   [text=adminemail]
   [text=fromemail]
   [text=subscribeemail]
   [checkbox=mailer]
   [text=host]
   [text=smtplogin]
   [password=password]
   [text=port]
   ', $args);
         case 'view':
             $args->perpage = $options->perpage;
             $filter = tcontentfilter::i();
             $args->usefilter = $filter->usefilter;
             $args->automore = $filter->automore;
             $args->automorelength = $filter->automorelength;
             $args->autolinks = $filter->autolinks;
             $args->commentautolinks = $filter->commentautolinks;
             $args->icondisabled = $options->icondisabled;
             $args->hidefilesonpage = $options->hidefilesonpage;
             $themeparser = tthemeparser::i();
             $args->replacelang = $themeparser->replacelang;
             $args->stylebefore = $themeparser->stylebefore;
             $args->formtitle = $lang->viewoptions;
             return $html->adminform('
   [text=perpage]
   [checkbox=usefilter]
   [checkbox=automore]
   [text=automorelength]
   [checkbox=autolinks]
   [checkbox=commentautolinks]
   [checkbox=hidefilesonpage]
   [checkbox=icondisabled]
   [checkbox=replacelang]
   [checkbox=stylebefore]
   ', $args);
             break;
         case 'files':
             $parser = tmediaparser::i();
             $args->enablepreview = $parser->enablepreview;
             $args->ratio = $parser->ratio;
             $args->clipbounds = $parser->clipbounds;
             $args->previewwidth = $parser->previewwidth;
             $args->previewheight = $parser->previewheight;
             $args->maxwidth = $parser->maxwidth;
             $args->maxheight = $parser->maxheight;
             $args->alwaysresize = $parser->alwaysresize;
             $args->quality_original = $parser->quality_original;
             $args->quality_snapshot = $parser->quality_snapshot;
             $args->audioext = $parser->audioext;
             $args->videoext = $parser->videoext;
             $args->video_width = litepublisher::$site->video_width;
             $args->video_height = litepublisher::$site->video_height;
             $args->formtitle = $lang->files;
             return $html->adminform('
   <h4>$lang.imagesize</h4>
   [checkbox=alwaysresize]
   [text=maxwidth]
   [text=maxheight]
   [text=quality_original]
   
   <h4>$lang.previewsize</h4>
   [checkbox=enablepreview]
   [checkbox=ratio]
   [checkbox=clipbounds]
   [text=previewwidth]
   [text=previewheight]
   [text=quality_snapshot]
   
   <h4>$lang.extfile</h4>
   [text=audioext]
   [text=videoext]
   
   [text=video_width]
   [text=video_height]
   ', $args);
             break;
         case 'links':
             $linkgen = tlinkgenerator::i();
             $args->urlencode = $linkgen->urlencode;
             $args->post = $linkgen->post;
             $args->menu = $linkgen->menu;
             $args->category = $linkgen->category;
             $args->tag = $linkgen->tag;
             $args->archive = $linkgen->archive;
             $args->formtitle = $lang->schemalinks;
             return $html->adminform('
   <p>$lang.taglinks</p>
   [checkbox=urlencode]
   [text=post]
   [text=menu]
   [text=category]
   [text=tag]
   [text=archive]
   ', $args);
         case 'cache':
             $args->enabledcache = $options->cache;
             $args->expiredcache = $options->expiredcache;
             $args->admincache = $options->admincache;
             $args->ob_cache = $options->ob_cache;
             $args->compress = $options->compress;
             $args->commentspull = $options->commentspull;
             $args->memcache_classes = litepublisher::$classes->memcache;
             $args->formtitle = $lang->optionscache;
             $result = $html->adminform('
   [checkbox=enabledcache]
   [text=expiredcache]
   [checkbox=ob_cache]
   [checkbox=admincache]
   [checkbox=commentspull]
   [checkbox=memcache_classes]
   ', $args);
             $form = new adminform($args);
             $form->submit = 'clearcache';
             $result .= $form->get();
             return $result;
         case 'catstags':
         case 'lite':
             //old version suports
             $args->litearch = litepublisher::$classes->archives->lite;
             $cats = litepublisher::$classes->categories;
             $args->litecats = $cats->lite;
             $args->parentcats = $cats->includeparents;
             $args->childcats = $cats->includechilds;
             $tags = litepublisher::$classes->tags;
             $args->litetags = $tags->lite;
             $args->parenttags = $tags->includeparents;
             $args->childtags = $tags->includechilds;
             $lang = tlocal::admin('options');
             $args->formtitle = $lang->catstags;
             $html = $this->html;
             return $html->adminform('[checkbox=litearch]
   [checkbox=litecats] [checkbox=parentcats] [checkbox=childcats]
   [checkbox=litetags] [checkbox=parenttags] [checkbox=childtags]', $args) . $html->p->notecatstags;
         case 'robots':
             $html = $this->html;
             $args->formtitle = 'robots.txt';
             $args->robots = trobotstxt::i()->text;
             $args->appcache = appcache_manifest::i()->text;
             $tabs = new tuitabs();
             $tabs->add('robots.txt', '[editor=robots]');
             $tabs->add('manifest.appcache', '[editor=appcache]');
             return tuitabs::gethead() . $html->adminform($tabs->get(), $args);
             break;
         case 'secure':
             $args->echoexception = $options->echoexception;
             $args->usersenabled = $options->usersenabled;
             $args->reguser = $options->reguser;
             $args->parsepost = $options->parsepost;
             $args->show_draft_post = $options->show_draft_post;
             $args->xxxcheck = $options->xxxcheck;
             $filter = tcontentfilter::i();
             $args->phpcode = $filter->phpcode;
             $args->removephp = tthemeparser::i()->removephp;
             $args->useshell = tupdater::i()->useshell;
             $backuper = tbackuper::i();
             $args->filertype = tadminhtml::array2combo(array('auto' => 'auto', 'file' => 'file', 'ftp' => 'ftp', 'ftpsocket' => 'ftpsocket'), $backuper->filertype);
             $args->formtitle = $lang->securehead;
             $result = $html->adminform('
   [checkbox=echoexception]
   [checkbox=xxxcheck]
   [checkbox=usersenabled]
   [checkbox=reguser]
   [checkbox=removephp]
   [checkbox=phpcode]
   [checkbox=parsepost]
   [checkbox=show_draft_post]
   [combo=filertype]
   [checkbox=useshell]
   ', $args);
             $form = new adminform($args);
             $form->title = $lang->changepassword;
             $args->oldpassword = '';
             $args->newpassword = '';
             $args->repassword = '';
             $form->items = '[password=oldpassword]
   [password=newpassword]
   [password=repassword]';
             $form->submit = 'changepassword';
             $result .= $form->get();
             return $result;
     }
     $result = $this->html->{$this->name}($args);
     return $this->html->fixquote($result);
 }
 public function getcontent()
 {
     $result = $this->widget;
     $result = str_replace('&amp;backurl=', '&backurl=', $result);
     if (!empty($_GET['backurl'])) {
         $result = str_replace('backurl=', 'backurl=' . urlencode($_GET['backurl']), $result);
         //support ulogin
         $result = str_replace('backurl%3D', 'backurl%3D' . urlencode(urlencode($_GET['backurl'])), $result);
     } else {
         $result = str_replace('&backurl=', '', $result);
         $result = str_replace('backurl=', '', $result);
         //support ulogin
         $result = str_replace('%3Fbackurl%3D', '', $result);
     }
     $html = $this->html;
     $args = new targs();
     if (litepublisher::$options->usersenabled && litepublisher::$options->reguser) {
         $lang = tlocal::admin('users');
         $form = new adminform($args);
         $form->action = litepublisher::$site->url . '/admin/reguser/';
         if (!empty($_GET['backurl'])) {
             $form->action .= '?backurl=' . urlencode($_GET['backurl']);
         }
         $form->title = $lang->regform;
         $args->email = '';
         $args->name = '';
         $form->items = '[text=email] [text=name]';
         $form->submit = 'signup';
         //fix id text-email
         $result .= str_replace('text-email', 'reg-email', $form->get());
     }
     $lang = tlocal::admin('login');
     $form = new adminform($args);
     $form->title = $lang->emailpass;
     $args->email = !empty($_POST['email']) ? strip_tags($_POST['email']) : '';
     $args->password = !empty($_POST['password']) ? strip_tags($_POST['password']) : '';
     $args->remember = isset($_POST['remember']);
     $form->items = '[text=email]
 [password=password]
 [checkbox=remember]';
     $form->submit = 'log_in';
     $result .= $form->get();
     $form = new adminform($args);
     $form->title = $lang->lostpass;
     $form->action = '$site.url/admin/password/';
     $form->target = '_blank';
     $form->inline = true;
     // double "text-email" input id
     $form->items = str_replace('text-email', 'lostpass-email', $html->getinput('text', 'email', '', 'E-Mail'));
     $form->submit = 'sendpass';
     $result .= $form->get();
     $this->callevent('oncontent', array(&$result));
     return $result;
 }