public static function getlist($tml, $selected) { $result = ''; if (!is_array($selected)) { $selected = array((string) $selected); } $html = tadminhtml::i(); $html->section = 'themes'; $args = targs::i(); $list = tfiler::getdir(litepublisher::$paths->themes); sort($list); $args->filesurl = tadminhtml::getadminlink('/admin/views/themefiles/', 'theme'); $parser = tthemeparser::i(); foreach ($list as $name) { if ($about = $parser->getabout($name)) { $about['name'] = $name; if (!isset($about['screenshot'])) { $about['screenshot'] = 'screenshot.png'; } $args->add($about); $args->checked = in_array($name, $selected); $result .= $html->parsearg($tml, $args); } } return $result; }
public function getcontent() { $redir = tredirector::i(); $html = $this->html; $lang = $this->lang; $args = targs::i(); $from = tadminhtml::getparam('from', ''); if (isset($redir->items[$from])) { $args->from = $from; $args->to = $redir->items[$from]; } else { $args->from = ''; $args->to = ''; } $args->action = 'edit'; $args->formtitle = $lang->edit; $result = $html->adminform('[text=from] [text=to] [hidden=action]', $args); $id = 1; $items = array(); foreach ($redir->items as $from => $to) { $items[] = array('id' => $id++, 'from' => $from, 'to' => $to); } $adminurl = tadminhtml::getadminlink($this->url, 'from'); $args->table = $html->buildtable($items, array(array('center', '+', '<input type="checkbox" name="checkbox_$id" id="checkbox_$id" value="$from" />'), array('left', $lang->from, '<a href="$site.url$from" title="$from">$from</a>'), array('left', $lang->to, '<a href="$site.url$to" title="$to">$to</a>'), array('center', $lang->edit, "<a href=\"{$adminurl}=\$from\">{$lang->edit}</a>"))); $args->action = 'delete'; $result .= $html->parsearg('<form name="deleteform" action="" method="post"> [hidden=action] $table <p><input type="submit" name="delete" value="$lang.delete" /></p> </form>', $args); $result = $html->fixquote($result); return $result; }
public function processform() { $downloaditems = tdownloaditems::i(); if ($this->name == 'addurl') { $url = trim($_POST['url']); if ($url == '') { return ''; } if ($downloaditem = taboutparser::parse($url)) { $id = $downloaditems->add($downloaditem); litepublisher::$urlmap->redir(tadminhtml::getadminlink('/admin/downloaditems/editor/', "id={$id}")); } return ''; } $status = isset($_POST['publish']) ? 'published' : (isset($_POST['setdraft']) ? 'draft' : 'delete'); foreach ($_POST as $key => $id) { if (!is_numeric($id)) { continue; } $id = (int) $id; if ($status == 'delete') { $downloaditems->delete($id); } else { $downloaditem = tdownloaditem::i($id); $downloaditem->status = $status; $downloaditems->edit($downloaditem); } } }
public function getcontent() { $result = ''; $this->basename = 'authors'; $users = tusers::i(); $lang = $this->lang; $html = $this->html; if ('delete' == $this->action) { $id = $this->idget(); if (!$users->itemexists($id)) { return $this->notfound(); } if (!$this->confirmed) { return $html->confirmdelete($id, $this->adminurl, $lang->confirmdelete); } if (!$this->deleteauthor($id)) { return $this->notfount; } $result .= $html->h4->deleted; } $args = new targs(); $perpage = 20; $total = $users->db->getcount("status = 'comuser'"); $from = $this->getfrom($perpage, $total); $res = $users->db->query("select * from {$users->thistable} where status = 'comuser' order by id desc limit {$from}, {$perpage}"); $items = litepublisher::$db->res2assoc($res); $result .= sprintf($html->h4->listhead, $from, $from + count($items), $total); $adminurl = $this->adminurl; $editurl = tadminhtml::getadminlink('/admin/users/', 'id'); $result .= $html->buildtable($items, array(array('left', $lang->author, '$name'), array('left', 'E-Mail', '$email'), array('left', $lang->website, '$website'), array('center', $lang->edit, "<a href='{$editurl}=\$id&action=edit'>{$lang->edit}</a>"), array('center', $lang->delete, "<a href='{$adminurl}=\$id&action=delete'>{$lang->delete}</a>"))); $theme = ttheme::i(); $result .= $theme->getpages($this->url, litepublisher::$urlmap->page, ceil($total / $perpage)); return $result; }
public function getpluginsmenu() { $result = ''; $link = tadminhtml::getadminlink($this->url, 'plugin='); $plugins = tplugins::i(); foreach ($this->names as $name) { $about = tplugins::getabout($name); if (isset($plugins->items[$name]) && !empty($about['adminclassname'])) { $result .= sprintf('<li><a href="%s%s">%s</a></li>', $link, $name, $about['name']); } } return sprintf('<ul>%s</ul>', $result); }
public function getwidget($id, $sidebar) { $links = ''; $theme = ttheme::i(); $tml = $theme->getwidgetitem('widget', $sidebar); tlocal::usefile('admin'); if (litepublisher::$urlmap->context instanceof tpost) { $post = litepublisher::$urlmap->context; $lang = tlocal::i('posts'); $title = $lang->adminpost; $action = tadminhtml::getadminlink('/admin/posts/', "id={$post->id}&action"); $links = $this->getitem($tml, tadminhtml::getadminlink('/admin/posts/editor/', 'id=' . $post->id), $lang->edit); $links .= $this->getitem($tml, "{$action}=delete", $lang->delete); } else { switch (get_class(litepublisher::$urlmap->context)) { case 'tcategories': case 'ttags': $tags = litepublisher::$urlmap->context; $name = $tags instanceof ttags ? 'tags' : 'categories'; $adminurl = litepublisher::$site->url . "/admin/posts/{$name}/"; $lang = tlocal::i('tags'); $title = $lang->{$name}; $links = $this->getitem($tml, $adminurl, $lang->add); $adminurl .= litepublisher::$site->q . "id={$tags->id}"; $links .= $this->getitem($tml, $adminurl, $lang->edit); $links .= $this->getitem($tml, "{$adminurl}&action=delete", $lang->delete); $links .= $this->getitem($tml, "{$adminurl}&full=1", $lang->fulledit); break; case 'thomepage': $lang = tlocal::i('options'); $title = $lang->home; $links .= $this->getitem($tml, "/admin/options/home/", $lang->title); break; } if (litepublisher::$urlmap->context instanceof tmenu && !litepublisher::$urlmap->context instanceof tadminmenu) { $menu = litepublisher::$urlmap->context; $lang = tlocal::i('menu'); $title = $lang->title; $adminurl = litepublisher::$site->url . "/admin/menu/edit/"; $links .= $this->getitem($tml, $adminurl, $lang->addmenu); $links .= $this->getitem($tml, $adminurl . litepublisher::$site->q . "id={$menu->id}", $lang->edit); } } if ($links == '') { return ''; } $links .= $this->getitem($tml, '/admin/logout/', tlocal::get('login', 'logout')); $links = $theme->getwidgetcontent($links, 'widget', $sidebar); return $theme->getwidget($this->gettitle($id), $links, 'widget', $sidebar); }
public function getcontent() { $result = ''; $tickets = ttickets::i(); $perpage = 20; $where = litepublisher::$options->group == 'ticket' ? ' and author = ' . litepublisher::$options->user : ''; switch ($this->name) { case 'opened': $where .= " and state = 'opened' "; break; case 'fixed': $where .= " and state = 'fixed' "; break; } $count = $tickets->getchildscount($where); $from = $this->getfrom($perpage, $count); if ($count > 0) { $items = $tickets->select("status <> 'deleted' {$where}", " order by posted desc limit {$from}, {$perpage}"); if (!$items) { $items = array(); } } else { $items = array(); } $html = $this->inihtml(); $lang = tlocal::admin('tickets'); $lang->addsearch('ticket'); $result .= $html->editlink(); $result .= $html->getitemscount($from, $from + count($items), $count); ttheme::$vars['poststatus'] = new poststatus(); $table = $html->tableposts($items, array(array('center', $lang->date, '$post.date'), array('left', $lang->posttitle, '$post.bookmark'), array('left', $lang->author, '$post.authorlink'), array('left', $lang->status, '$poststatus.status'), array('left', $lang->category, '$post.category'), array('left', $lang->state, '$poststatus.state'), array('center', $lang->edit, '<a href="' . tadminhtml::getadminlink('/admin/tickets/editor/', 'id') . '=$post.id">' . $lang->edit . '</a>'))); unset(ttheme::$vars['poststatus']); //wrap form if (litepublisher::$options->group != 'ticket') { $args = new targs(); $args->table = $table; $result .= $html->tableform($args); } else { $result .= $table; } $result = $html->fixquote($result); $theme = ttheme::i(); $result .= $theme->getpages($this->url, litepublisher::$urlmap->page, ceil($count / $perpage)); return $result; }
public static function getsidebarsform() { $idview = (int) tadminhtml::getparam('idview', 1); $view = tview::i($idview); $widgets = twidgets::i(); $html = tadminhtml::i(); $html->section = 'widgets'; $args = targs::i(); $args->idview = $idview; $lang = tlocal::i('views'); $args->customsidebar = $idview == 1 ? '' : $view->theme->parse($html->getcheckbox('customsidebar', true)); $args->adminurl = tadminhtml::getadminlink('/admin/views/widgets/', 'idwidget'); $lang = tlocal::i('widgets'); $result = $html->formhead($args); $count = count($view->sidebars); $sidebarnames = self::getsidebarnames($view); foreach ($view->sidebars as $i => $sidebar) { $orders = range(1, count($sidebar)); foreach ($sidebar as $j => $_item) { $id = $_item['id']; $item = $widgets->getitem($id); $args->id = $id; $args->ajax = $_item['ajax']; $args->inline = $_item['ajax'] === 'inline'; $args->disabled = $item['cache'] == 'cache' || $item['cache'] == 'nocache' ? '' : 'disabled="disabled"'; $args->add($item); $args->sidebarcombo = tadminhtml::getcombobox("sidebar-{$id}", $sidebarnames, $i); $args->ordercombo = tadminhtml::getcombobox("order-{$id}", $orders, $j); $result .= $html->item($args); } } $result .= $html->formfooter(); //all widgets $args->id_view = $idview; $result .= $html->addhead($args); foreach ($widgets->items as $id => $item) { $args->id = $id; $args->add($item); $args->checked = tsidebars::getpos($view->sidebars, $id) ? false : true; $result .= $html->additem($args); } $result .= $html->addfooter(); return $html->fixquote($result); }
public function getcontent() { $groups = tusergroups::i(); $html = $this->html; $lang = tlocal::admin('users'); $args = targs::i(); $adminurl = $this->adminurl; $result = "<h4><a href='{$adminurl}=0&action=add'>{$lang->addgroup}</a></h4>"; $id = $this->idget(); switch ($this->action) { case 'add': $result .= $html->p->notegroup; $args->name = ''; $args->title = ''; $args->home = ''; $args->action = 'add'; $args->formtitle = $lang->editgroup; $result .= $html->adminform(' [text=title] [text=name] [text=home] [hidden=action]' . $html->h4->parentgroups . self::getgroups(array()), $args); break; case 'edit': $result .= $html->p->notegroup; $args->add($groups->items[$id]); $args->id = $id; $args->action = 'edit'; $args->formtitle = $lang->editgroup; $result .= $html->adminform(' [text=title] [text=name] [text=home] [hidden=id] [hidden=action]' . $html->h4->parentgroups . self::getgroups($groups->items[$id]['parents']), $args); break; case 'delete': $result .= $html->confirm_delete($groups, $this->adminurl); break; } $result .= $html->h4->grouptable; $result .= $html->buildtable($groups->items, array(array('left', $lang->name, '<a href="' . $adminurl . '=$id&action=edit" title="$title">$title</a>'), array('left', $lang->users, sprintf('<a href="%s">%s</a>', tadminhtml::getadminlink('/admin/users/', 'idgroup=$id'), $lang->users)), $html->get_table_link('delete', $adminurl))); return $result; }
public function getcontent() { $result = ''; $this->basename = 'tickets'; $ticket = tticket::i($this->idpost); ttheme::$vars['ticket'] = $ticket; ttheme::$vars['post'] = $ticket; $args = new targs(); $args->id = $this->idpost; $args->title = tcontentfilter::unescape($ticket->title); $args->ajax = tadminhtml::getadminlink('/admin/ajaxposteditor.htm', "id={$ticket->id}&get"); $ajaxeditor = tajaxposteditor::i(); $args->raw = $ajaxeditor->geteditor('raw', $ticket->rawcontent, true); $html = $this->inihtml('tickets'); $lang = tlocal::admin('tickets'); $lang->ini['tickets'] = $lang->ini['ticket'] + $lang->ini['tickets']; $args->code = $html->getinput('editor', 'code', tadminhtml::specchars($ticket->code), $lang->codetext); $args->fixed = $ticket->state == 'fixed'; $tickets = ttickets::i(); $args->catcombo = tposteditor::getcombocategories($tickets->cats, count($ticket->categories) ? $ticket->categories[0] : $tickets->cats[0]); $states = array(); foreach (array('fixed', 'opened', 'wontfix', 'invalid', 'duplicate', 'reassign') as $state) { $states[$state] = $lang->{$state}; } $args->statecombo = $html->array2combo($states, $ticket->state); $prio = array(); foreach (array('trivial', 'minor', 'major', 'critical', 'blocker') as $p) { $prio[$p] = $lang->{$p}; } $args->priocombo = $html->array2combo($prio, $ticket->prio); if ($ticket->id > 0) { $result .= $html->headeditor(); } $result .= $html->form($args); $result = $html->fixquote($result); 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() { $result = ''; $istags = $this->name == 'tags' || $this->name == 'addtag'; $tags = $istags ? litepublisher::$classes->tags : litepublisher::$classes->categories; if (dbversion) { $tags->loadall(); } $parents = array(0 => '-----'); foreach ($tags->items as $id => $item) { $parents[$id] = $item['title']; } $this->basename = 'tags'; $html = $this->html; $lang = tlocal::i('tags'); $id = $this->idget(); $args = new targs(); $args->id = $id; $args->adminurl = $this->adminurl; $ajax = tadminhtml::getadminlink('/admin/ajaxtageditor.htm', sprintf('id=%d&type=%s&get', $id, $istags ? 'tags' : 'categories')); $args->ajax = $ajax; if (isset($_GET['action']) && $_GET['action'] == 'delete' && $tags->itemexists($id)) { if ($this->confirmed) { $tags->delete($id); $result .= $html->h4->successdeleted; } else { return $html->confirmdelete($id, $this->adminurl, $lang->confirmdelete); } } $result .= $html->h4(tadminhtml::getlink('/admin/posts/' . ($istags ? 'addtag' : 'addcat') . '/', $lang->add)); $item = false; if ($id && $tags->itemexists($id)) { $item = $tags->getitem($id); $args->formtitle = $lang->edit; } elseif ($this->name == 'addcat' || $this->name == 'addtag') { $id = 0; $item = array('id' => 0, 'title' => '', 'parent' => 0, 'customorder' => 0); $args->formtitle = $lang->add; } if ($item) { $args->add($item); $args->parent = tadminhtml::array2combo($parents, $item['parent']); $args->order = tadminhtml::array2combo(array_combine(range(0, 9), range(1, 10)), $item['customorder']); $tabs = new tuitabs(); $tabs->add($lang->title, ' [text=title] [combo=parent] [combo=order] [hidden=id]' . $html->p->ordernote); $tabs->ajax($lang->text, "{$ajax}=text"); $tabs->ajax($lang->view, "{$ajax}=view"); $tabs->ajax('SEO', "{$ajax}=seo"); $form = new adminform($args); $result .= $html->adminform($tabs->get(), $args) . tuitabs::gethead(); } //table $perpage = 20; $count = $tags->count; $from = $this->getfrom($perpage, $count); if ($tags->dbversion) { $iditems = $tags->db->idselect("id > 0 order by parent asc, title asc limit {$from}, {$perpage}"); } else { $iditems = array_slice(array_keys($tags->items), $from, $perpage); } $items = array(); foreach ($iditems as $id) { $item = $tags->items[$id]; $item['parentname'] = $parents[$item['parent']]; $items[] = $item; } $result .= $html->buildtable($items, array(array('right', $lang->count2, '$itemscount'), array('left', $lang->title, '<a href="$link" title="$title">$title</a>'), array('left', $lang->parent, '$parentname'), array('center', $lang->edit, "<a href=\"{$this->adminurl}=\$id\">{$lang->edit}</a>"), array('center', $lang->delete, "<a class=\"confirm-delete-link\" href=\"{$this->adminurl}=\$id&action=delete\">{$lang->delete}</a>"))); $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; }
private function get_view_sidebars($idview, $html, $lang, $args) { $view = tview::i($idview); $widgets = twidgets::i(); $args->idview = $idview; $args->adminurl = tadminhtml::getadminlink('/admin/views/widgets/', 'idwidget'); $count = count($view->sidebars); $sidebarnames = range(1, 3); $about = tthemeparser::i()->getabout($view->theme->name); foreach ($sidebarnames as $k => $v) { if (isset($about["sidebar{$k}"])) { $sidebarnames[$k] = $about["sidebar{$k}"]; } } $sidebars = ''; if ($idview > 1 && !$view->customsidebar) { $view = tview::i(1); } $sitems = array(); foreach ($view->sidebars as $index => $sidebar) { $args->index = $index; $widgetlist = ''; $idwidgets = array(); foreach ($sidebar as $_item) { $id = $_item['id']; $idwidgets[] = $id; $sitems[$id] = $_item; $args->id = $id; $args->add($widgets->items[$id]); $widgetlist .= $html->widgetitem($args); } $args->sidebarname = $sidebarnames[$index]; $args->widgetlist = $widgetlist; $args->idwidgets = implode(',', $idwidgets); $sidebars .= $html->sidebar($args); } $woptions = ''; $allwidgets = ''; foreach ($widgets->items as $id => $item) { $args->id = $id; $args->add($item); $enabled = $item['cache'] == 'cache' || $item['cache'] == 'nocache'; $args->enabled = $enabled ? 'enabled' : 'disabled'; if (isset($sitems[$id])) { $sitem = $sitems[$id]; } else { $allwidgets .= $html->widgetitem($args); $sitem = array('ajax' => $enabled ? 'inline' : false); } $args->add($sitem); $args->controls = $html->getinput('checkbox', "ajax{$id}", $sitem['ajax'] ? 'checked="checked"' : '', $lang->ajax) . $html->getinput('checkbox', "inline{$id}", ($enabled ? '' : 'disabled="disabled" ') . ($sitem['ajax'] === 'inline' ? 'checked="checked"' : ''), $lang->inline) . $html->getinput('submit', "delete{$id}", '', $lang->widget_delete); $woptions .= $html->woptions($args); } $args->sidebars = $sidebars; $args->woptions = $woptions; $args->allwidgets = $allwidgets; return $html->sidebars($args); }
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)); } } }
public function getpostargs(tpost $post, targs $args) { $args->id = $post->id; $args->ajax = tadminhtml::getadminlink('/admin/ajaxposteditor.htm', "id={$post->id}&get"); $args->title = tcontentfilter::unescape($post->title); $args->categories = $this->getpostcategories($post); $args->date = $post->posted; $args->url = $post->url; $args->title2 = $post->title2; $args->keywords = $post->keywords; $args->description = $post->description; $args->head = $post->rawhead; $args->raw = $post->rawcontent; $args->filtered = $post->filtered; $args->excerpt = $post->excerpt; $args->rss = $post->rss; $args->more = $post->moretitle; $args->upd = ''; }
public function processform() { $plugin = titemsreplacer::i(); if (!empty($_GET['id'])) { $id = (int) $_GET['id']; if (isset($plugin->items[$id])) { $plugin->lock(); $i = 0; foreach ($plugin->items[$id] as $tag => $replace) { $k = "replace-{$i}"; if (!isset($_POST[$k])) { continue; } $v = trim($_POST[$k]); if ($v) { $plugin->items[$id][$tag] = $v; } else { unset($plugin->items[$id][$tag]); } $i++; } if (!empty($_POST['addtag'])) { $tag = trim($_POST['addtag']); $theme = tview::i(tviews::i()->defaults['admin'])->theme; if (isset($theme->templates[$tag])) { $plugin->items[$id][$tag] = trim($_POST['addreplace']); } } $plugin->unlock(); } } if (isset($_GET['action']) && 'add' == $_GET['action']) { $views = tviews::i(); $view = new tviewthemereplacer(); $view->name = trim($_POST['viewname']); $id = $views->addview($view); $plugin->add($id); $view->themename = tview::i(1)->themename; $adminurl = tadminhtml::getadminlink('/admin/plugins/', 'plugin=' . basename(dirname(__FILE__))); return litepublisher::$urlmap->redir("{$adminurl}&id={$id}"); } ttheme::clearcache(); return ''; }
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 = ''; 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); } }