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 getcontent() { $forum = tforum::i(); $html = tadminhtml::i(); $args = new targs(); $html->section = 'editor'; $lang = tlocal::i('editor'); $args->comstatus = tadminhtml::array2combo(array('closed' => $lang->closed, 'reg' => $lang->reg, 'guest' => $lang->guest, 'comuser' => $lang->comuser), $forum->comstatus); $lang = tlocal::admin('forum'); $args->rootcat = tposteditor::getcombocategories(array(), $forum->rootcat); $args->moderate = $forum->moderate; $args->formtitle = $lang->options; return $html->adminform(' [combo=rootcat] [combo=comstatus] [checkbox=moderate] ' . tadminviews::getcomboview($forum->idview) . tadminperms::getcombo(0), $args); }
public function files_getpost(array $args) { $idpost = (int) $args['idpost']; if (!$this->auth($idpost)) { return $this->forbidden(); } $result = array(); $where = litepublisher::$options->ingroup('editor') ? '' : ' and author = ' . litepublisher::$options->user; $files = tfiles::i(); $result['count'] = (int) ceil($files->db->getcount(" parent = 0 {$where}") / 20); $result['files'] = array(); if ($idpost) { $list = $files->itemsposts->getitems($idpost); if (count($list)) { $items = implode(',', $list); $result['files'] = $files->db->res2items($files->db->query("select * from {$files->thistable} where id in ({$items}) or parent in ({$items})")); } } if (litepublisher::$options->show_file_perm) { $theme = ttheme::getinstance('default'); $result['fileperm'] = tadminperms::getcombo(0, 'idperm_upload'); } return $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() { $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; }
public function getfileperm() { return litepublisher::$options->show_file_perm ? tadminperms::getcombo(0, 'idperm_upload') : ''; }