Esempio n. 1
0
 public function escape(array $item)
 {
     foreach (array('title', 'description', 'keywords') as $name) {
         $item[$name] = tcontentfilter::escape(tcontentfilter::unescape($item[$name]));
     }
     return $item;
 }
 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;
 }
Esempio n. 4
0
 public function settitle($title)
 {
     $this->data['title'] = tcontentfilter::escape(tcontentfilter::unescape($title));
 }
Esempio n. 5
0
 public function files_setprops(array $args)
 {
     if (!litepublisher::$options->hasgroup('author')) {
         return $this->forbidden();
     }
     $id = (int) $args['idfile'];
     $files = tfiles::i();
     if (!$files->itemexists($id)) {
         return $this->forbidden();
     }
     $item = $files->getitem($id);
     $item['title'] = tcontentfilter::escape(tcontentfilter::unescape($args['title']));
     $item['description'] = tcontentfilter::escape(tcontentfilter::unescape($args['description']));
     $item['keywords'] = tcontentfilter::escape(tcontentfilter::unescape($args['keywords']));
     $this->callevent('onprops', array(&$item));
     $item = $files->escape($item);
     $files->db->updateassoc($item);
     return array('item' => $item);
 }
 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 = '';
     $polls = tpolls::i();
     $html = tadminhtml::i();
     $lang = tlocal::admin('polls');
     $args = new targs();
     $dir = litepublisher::$paths->data . 'polls';
     $adminurl = $this->adminurl;
     if ($action = $this->action) {
         $id = $this->idget();
         switch ($action) {
             case 'delete':
                 $man = tpollsman::i();
                 if ($id == $man->pollpost) {
                     return $html->h4->deletepullpost;
                 }
                 if ($this->confirmed) {
                     tfilestorage::delete($dir . DIRECTORY_SEPARATOR . "{$id}.php");
                     tfilestorage::delete($dir . DIRECTORY_SEPARATOR . "{$id}.bak.php");
                     unset($polls->tml_items[$id]);
                     $polls->db->update('id_tml = ' . $man->pollpost, "id_tml = {$id}");
                     $result .= $html->h4->deleted;
                 } else {
                     $result .= $html->confirmdelete($id, $adminurl, $lang->confirmdelete);
                 }
                 break;
             case 'edit':
                 if ($tml = $polls->get_tml($id)) {
                     $args->add($tml);
                     $args->id = $id;
                     $args->name = tcontentfilter::unescape($tml['name']);
                     $args->title = tcontentfilter::unescape($tml['title']);
                     //$args->items = implode("\n", $tml['items']);
                     $tabs = new tuitabs();
                     //$tabs->add($lang->pollitems, "[editor=items]");
                     $tabs->add($lang->opened, "[editor=opened]");
                     $tabs->add($lang->closed, "[editor=closed]");
                     $args->formtitle = $lang->edittemplate;
                     $result .= $html->adminform('
       [text=name]
       [text=title]' . $tabs->get(), $args);
                 }
                 break;
             case 'add':
                 $types = array_keys(tpolltypes::i()->items);
                 $args->type = tadminhtml::array2combo(array_combine($types, $types), $types[0]);
                 $args->name = '';
                 $args->title = '';
                 $args->newitems = '';
                 $args->formtitle = $lang->newtemplate;
                 $result .= $html->adminform('[text=name]
     [text=title]
     [combo=type]
     [editor=newitems]', $args);
                 break;
         }
     }
     $result .= $html->h3("<a href='{$adminurl}=0&amp;action=add'>{$lang->addtemplate}</a>");
     $result .= $html->h4->alltemplates;
     $args->adminurl = $adminurl;
     $table = '';
     $tr = '<tr>
 <td><a href="$adminurl=$id&amp;action=edit">$name</a></td>
 <td><a href="$adminurl=$id&amp;action=delete">$lang.delete</a></td>
 </tr>';
     $polls->loadall_tml();
     foreach ($polls->tml_items as $id => $tml) {
         $args->id = $id;
         $args->name = $tml['name'];
         $args->title = $tml['title'];
         $table .= $html->parsearg($tr, $args);
     }
     $head = "<tr>\n    <th>{$lang->edit}</th>\n    <th>{$lang->delete}</th>\n    </tr>";
     $result .= $html->gettable($head, $table);
     return $result;
 }
Esempio n. 8
0
 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 = '';
 }