コード例 #1
0
 public function getcontent()
 {
     $widget = tpostcatwidget::i();
     $about = tplugins::getabout(tplugins::getname(__FILE__));
     $args = targs::i();
     $id = (int) tadminhtml::getparam('idwidget', 0);
     if (isset($widget->items[$id])) {
         $item = $widget->items[$id];
         $args->mode = 'edit';
         $args->idwidget = $id;
     } else {
         $item = array('title' => '', 'content' => '', 'template' => 'widget', 'cats' => array());
         $args->mode = 'add';
         $args->idwidget = 0;
     }
     $cats = tposteditor::getcategories($item['cats']);
     $html = $this->html;
     $html->section = 'widgets';
     $args->add($item);
     $args->widgettitle = $item['title'];
     $args->template = tadminhtml::array2combo(self::gettemplates(), $item['template']);
     $args->formtitle = $item['title'] == '' ? $this->lang->widget : $item['title'];
     $result = $html->adminform('
 [text=widgettitle]
 [editor=content]
 [combo=template]
 [hidden=idwidget]
 [hidden=mode]' . sprintf('<h4>%s</h4>', $about['cats']) . $cats, $args);
     $result .= $this->getlist($widget);
     return $result;
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 public function processform()
 {
     $result = '';
     $idview = tadminhtml::getparam('idview', 1);
     $view = tview::i($idview);
     if (isset($_POST['reparse'])) {
         $parser = tthemeparser::i();
         try {
             $parser->reparse($view->theme->name);
         } catch (Exception $e) {
             $result = $e->getMessage();
         }
     } else {
         if (empty($_POST['selection'])) {
             return '';
         }
         try {
             $view->themename = $_POST['selection'];
             $result = $this->html->h2->success;
         } catch (Exception $e) {
             $view->themename = 'default';
             $result = $e->getMessage();
         }
     }
     ttheme::clearcache();
     return $result;
 }
コード例 #4
0
 public static function processform($holder, $menu)
 {
     $id = (int) tadminhtml::getparam('id', 0);
     if ($id == 0) {
         $item = $menu->defaultitem;
         foreach ($item as $k => $v) {
             if (isset($_POST[$k])) {
                 $item[$k] = $_POST[$k];
             }
         }
         $id = $holder->db->add($item);
         $item['id'] = $id;
         $_POST['id'] = $id;
         $_GET['id'] = $id;
     } else {
         $item = $holder->getitem($id);
         foreach ($item as $k => $v) {
             if (isset($_POST[$k])) {
                 $item[$k] = $_POST[$k];
             }
         }
         $item['id'] = $id;
         $holder->db->update($item);
     }
     $holder->items[$id] = $item;
 }
コード例 #5
0
 public function processform()
 {
     $widget = texcerptslide::i();
     $id = (int) tadminhtml::getparam('idwidget', 0);
     if (isset($widget->items[$id])) {
         $widget->items[$id]['maxcount'] = (int) $_POST['maxcount'];
         $widget->items[$id]['invertorder'] = isset($_POST['invertorder']);
         $widget->save();
         litepublisher::$urlmap->clearcache();
         return '';
     }
     $tags = array();
     foreach ($widget->items as $id => $item) {
         $tags[] = $item['idtag'];
     }
     $list = tposteditor::processcategories();
     $add = array_diff($list, $tags);
     $delete = array_diff($tags, $list);
     if (count($add) == 0 && count($delete) == 0) {
         return '';
     }
     $widget->lock();
     foreach ($delete as $idtag) {
         $widget->tagdeleted($idtag);
     }
     foreach ($add as $idtag) {
         $widget->add($idtag);
     }
     $widget->unlock();
     litepublisher::$urlmap->clearcache();
 }
コード例 #6
0
 public function processform()
 {
     $widget = tsubcatwidget::i();
     $id = (int) tadminhtml::getparam('idwidget', 0);
     if (isset($widget->items[$id])) {
         $item = $widget->items[$id];
         extract($_POST, EXTR_SKIP);
         $item['maxcount'] = (int) $maxcount;
         $item['showcount'] = isset($showcount);
         $item['showsubitems'] = isset($showsubitems);
         $item['sortname'] = $sort;
         $widget->items[$id] = $item;
         $widget->save();
         return '';
     }
     $tags = array();
     foreach ($widget->items as $id => $item) {
         $tags[] = $item['idtag'];
     }
     $list = tposteditor::processcategories();
     $add = array_diff($list, $tags);
     $delete = array_diff($tags, $list);
     if (count($add) == 0 && count($delete) == 0) {
         return '';
     }
     $widget->lock();
     foreach ($delete as $idtag) {
         $widget->tagdeleted($idtag);
     }
     foreach ($add as $idtag) {
         $widget->add($idtag);
     }
     $widget->unlock();
 }
コード例 #7
0
 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;
 }
コード例 #8
0
 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;
 }
コード例 #9
0
 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;
 }
コード例 #10
0
 public function processform()
 {
     //dumpvar($_POST);
     $result = '';
     switch ($this->name) {
         case 'views':
             $views = tviews::i();
             $idview = (int) tadminhtml::getparam('idview', 0);
             if (!$idview || !$views->itemexists($idview)) {
                 return '';
             }
             if ($this->action == 'delete') {
                 if ($idview > 1) {
                     $views->delete($idview);
                 }
                 return '';
             }
             $view = tview::i($idview);
             if ($idview > 1) {
                 $view->customsidebar = isset($_POST['customsidebar']);
                 $view->disableajax = isset($_POST['disableajax']);
             }
             $view->name = trim($_POST['name']);
             $view->themename = trim($_POST['theme_idview']);
             $view->menuclass = $_POST['menu'];
             $view->hovermenu = isset($_POST['hovermenu']);
             $this->set_custom($idview);
             if ($idview == 1 || $view->customsidebar) {
                 $widgets = twidgets::i();
                 foreach (range(0, 2) as $index) {
                     $view->sidebars[$index] = array();
                     $idwidgets = explode(',', trim($_POST["sidebar{$index}"]));
                     foreach ($idwidgets as $idwidget) {
                         $idwidget = (int) trim($idwidget);
                         if (!$widgets->itemexists($idwidget)) {
                             continue;
                         }
                         $view->sidebars[$index][] = array('id' => $idwidget, 'ajax' => isset($_POST["inline{$idwidget}"]) ? 'inline' : isset($_POST["ajax{$idwidget}"]));
                     }
                 }
             }
             $view->save();
             break;
         case 'addview':
             $name = trim($_POST['name']);
             if ($name != '') {
                 $views = tviews::i();
                 $id = $views->add($name);
             }
             break;
         case 'spec':
             foreach (self::getspecclasses() as $classname) {
                 $obj = getinstance($classname);
                 $obj->lock();
                 $obj->setidview($_POST["idview-{$classname}"]);
                 if (isset($obj->data['keywords'])) {
                     $obj->keywords = $_POST["keywords-{$classname}"];
                 }
                 if (isset($obj->data['description '])) {
                     $obj->description = $_POST["description-{$classname}"];
                 }
                 if (isset($obj->data['head'])) {
                     $obj->head = $_POST["head-{$classname}"];
                 }
                 $obj->unlock();
             }
             break;
         case 'group':
             switch ($_POST['action']) {
                 case 'posts':
                     $posts = tposts::i();
                     $idview = (int) $_POST['postview'];
                     if (dbversion) {
                         $posts->db->update("idview = '{$idview}'", 'id > 0');
                     } else {
                         foreach ($posts->items as $id => $item) {
                             $post = tpost::i($id);
                             $post->idview = $idview;
                             $post->save();
                             $post->free();
                         }
                     }
                     break;
                 case 'menus':
                     $idview = (int) $_POST['menuview'];
                     $menus = tmenus::i();
                     foreach ($menus->items as $id => $item) {
                         $menu = tmenu::i($id);
                         $menu->idview = $idview;
                         $menu->save();
                     }
                     break;
                 case 'themes':
                     $themename = $_POST['themeview'];
                     $views = tviews::i();
                     $views->lock();
                     foreach ($views->items as $id => $item) {
                         $view = tview::i($id);
                         $view->themename = $themename;
                         $view->save();
                     }
                     $views->unlock();
                     break;
             }
             break;
         case 'defaults':
             $views = tviews::i();
             foreach ($views->defaults as $name => $id) {
                 $views->defaults[$name] = (int) $_POST[$name];
             }
             $views->save();
             break;
         case 'headers':
             $template = ttemplate::i();
             $template->heads = $_POST['heads'];
             $template->save();
             $adminmenus = tadminmenus::i();
             $adminmenus->heads = $_POST['adminheads'];
             $adminmenus->save();
             $ajax = tajaxposteditor::i();
             $ajax->lock();
             $ajax->ajaxvisual = isset($_POST['ajaxvisual']);
             $ajax->visual = trim($_POST['visual']);
             $ajax->unlock();
             litepublisher::$options->show_file_perm = isset($_POST['show_file_perm']);
             break;
         case 'admin':
             return $this->adminoptionsform->processform();
     }
     ttheme::clearcache();
 }
コード例 #11
0
 public static function setsidebars()
 {
     $idview = (int) tadminhtml::getparam('idview', 1);
     $view = tview::i($idview);
     switch ($_POST['action']) {
         case 'options':
             $view->disableajax = isset($_POST['disableajax']);
             $view->customsidebar = isset($_POST['customsidebar']);
             break;
         case 'edit':
             if ($view->id > 1 && !isset($_POST['customsidebar'])) {
                 $view->customsidebar = false;
             } else {
                 self::editsidebars($view->sidebars);
             }
             break;
         case 'add':
             $idview = (int) tadminhtml::getparam('id_view', 1);
             $_GET['idview'] = $idview;
             $view = tview::i($idview);
             $widgets = twidgets::i();
             foreach ($_POST as $key => $value) {
                 if (strbegin($key, 'addwidget-')) {
                     $id = (int) $value;
                     if (!$widgets->itemexists($id) || $widgets->subclass($id)) {
                         continue;
                     }
                     $view->sidebars[0][] = array('id' => $id, 'ajax' => false);
                 }
             }
     }
     $view->save();
 }
コード例 #12
0
 public function getloginform()
 {
     $backuper = tbackuper::i();
     //$backuper->filertype = 'ftp';
     if ($backuper->filertype == 'file') {
         return '';
     }
     $html = $this->html;
     $args = targs::i();
     $acc = $backuper->filertype == 'ssh2' ? $html->h3->ssh2account : $html->h3->ftpaccount;
     $args->host = tadminhtml::getparam('host', '');
     $args->login = tadminhtml::getparam('login', '');
     $args->password = tadminhtml::getparam('pasword', '');
     return $acc . $html->parsearg('[text=host] [text=login] [password=password]', $args);
 }
コード例 #13
0
 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));
             }
     }
 }
コード例 #14
0
 public static function idget()
 {
     return (int) tadminhtml::getparam('id', 0);
 }
コード例 #15
0
 public function getcontent()
 {
     $widget = $this->widget;
     $args = new targs();
     $id = (int) tadminhtml::getparam('idwidget', 0);
     if (isset($widget->items[$id])) {
         $item = $widget->items[$id];
         $args->mode = 'edit';
         $viewcombo = '';
     } else {
         $id = 0;
         $viewcombo = tadminviews::getcomboview(1);
         $args->mode = 'add';
         $item = array('title' => '', 'content' => '', 'template' => 'widget');
     }
     $args->idwidget = $id;
     $html = $this->html;
     $args->text = $item['content'];
     $args->template = tadminhtml::array2combo(self::gettemplates(), $item['template']);
     $result = $this->optionsform($item['title'], $viewcombo . $html->parsearg('[editor=text]
 [combo=template]
 [hidden=mode]
 [hidden=idwidget]', $args));
     $lang = tlocal::i();
     $args->formtitle = $lang->widgets;
     $args->table = $html->buildtable($widget->items, array($html->get_table_checkbox('widgetcheck'), array('left', $lang->widgettitle, "<a href=\"{$this->adminurl}\$id\" title=\"\$title\">\$title</a>")));
     $result .= $html->deletetable($args);
     return $result;
 }