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();
 }
 public function processform()
 {
     $widget = tpostcatwidget::i();
     if (isset($_POST['mode'])) {
         extract($_POST, EXTR_SKIP);
         switch ($mode) {
             case 'add':
                 $_GET['idwidget'] = $widget->add($widgettitle, $content, $template, tposteditor::processcategories());
                 break;
             case 'edit':
                 $id = isset($_GET['idwidget']) ? (int) $_GET['idwidget'] : 0;
                 if ($id == 0) {
                     $id = isset($_POST['idwidget']) ? (int) $_POST['idwidget'] : 0;
                 }
                 $item = $widget->items[$id];
                 $item['title'] = $widgettitle;
                 $item['content'] = $content;
                 $item['template'] = $template;
                 $item['cats'] = tposteditor::processcategories();
                 $widget->items[$id] = $item;
                 $widget->save();
                 $widgets = twidgets::i();
                 $widgets->items[$id]['title'] = $widgettitle;
                 $widgets->save();
                 break;
         }
     } else {
         $this->deletewidgets($widget);
     }
 }
 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();
 }
 public function gettitle()
 {
     if ($this->idpost == 0) {
         return parent::gettitle();
     } else {
         return tlocal::admin('downloaditems')->editor;
     }
 }
 public function getcontent()
 {
     $plugin = tcategoriesmenu::i();
     $about = tplugins::getabout(tplugins::getname(__FILE__));
     $args = targs::i();
     $args->cats = tposteditor::getcategories($plugin->exitems);
     $args->formtitle = $about['formtitle'];
     //    $args->data['$lang.before'] = $about['before'];
     $html = tadminhtml::i();
     return $html->adminform('$cats', $args);
 }
 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 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 = '';
     $this->basename = 'forum';
     $posts = tposts::i();
     $html = $this->html;
     $html->section = 'editor';
     $lang = tlocal::admin('editor');
     if ($this->idpost == 0) {
         $forum = tforum::i();
         if ($forum->moderate && !litepublisher::$options->ingroup('editor')) {
             // if too many drafts then reject
             $hold = $posts->db->getcount('status = \'draft\' and author = ' . litepublisher::$options->user);
             if ($hold >= 3) {
                 $lang = tlocal::admin('forum');
                 return $html->manydrafts;
             }
         }
     }
     $post = tpost::i($this->idpost);
     ttheme::$vars['post'] = $post;
     $args = new targs();
     $args->id = $this->idpost;
     $args->title = tcontentfilter::unescape($post->title);
     $args->raw = $post->rawcontent;
     $cats = tcategories::i();
     $cats->loadall();
     $args->category = tposteditor::getcombocategories($cats->getchilds(tforum::i()->rootcat), $post->idcat);
     if ($post->id > 0) {
         $result .= $html->h4($lang->formhead . ' ' . $post->bookmark);
     }
     $html->section = 'forum';
     $result .= $html->editor($args);
     $result = $html->fixquote($result);
     return $result;
 }
 public function processform()
 {
     $tickets = ttickets::i();
     $tickets->cats = tposteditor::processcategories();
     $tickets->save();
 }
 public function getcont()
 {
     $editor = tposteditor::i();
     return $editor->getexternal();
 }
 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);
 }
Example #12
0
 public function editpost(tpost $post)
 {
     extract($_POST, EXTR_SKIP);
     $posts = tposts::i();
     $html = tadminhtml::i();
     if ($this->checkspam && $id == 0) {
         $post->status = 'published';
         $hold = $posts->db->getcount('status = \'draft\' and author = ' . litepublisher::$options->user);
         $approved = $posts->db->getcount('status = \'published\' and author = ' . litepublisher::$options->user);
         if ($approved < 3) {
             if ($hold - $approved >= 2) {
                 return $this->norights;
             }
             $post->status = 'draft';
         }
     }
     if ($this->insertsource) {
         $post->meta->sourceurl = $sourceurl;
     }
     $post->title = $title;
     $post->categories = tposteditor::processcategories();
     if (litepublisher::$options->user > 1) {
         $post->author = litepublisher::$options->user;
     }
     if (isset($files)) {
         $files = trim($files);
         $post->files = $files == '' ? array() : explode(',', $files);
     }
     $post->content = tcontentfilter::remove_scripts($raw);
     if ($this->insertsource) {
         $post->filtered = sprintf($this->sourcetml, $post->meta->sourceurl) . $post->filtered;
     }
     if ($id == 0) {
         $id = $posts->add($post);
         $_GET['id'] = $id;
         $_POST['id'] = $id;
     } else {
         $posts->edit($post);
     }
     return $html->h4->successedit;
 }