/** * Lite Publisher * Copyright (C) 2010 - 2015 Vladimir Yushko http://litepublisher.ru/ http://litepublisher.com/ * Dual licensed under the MIT (mit.txt) * and GPL (gpl.txt) licenses. **/ function tpasswordpageInstall($self) { litepublisher::$urlmap->delete('/check-password.php'); tlocal::usefile('install'); $lang = tlocal::i('passwordpage'); $form = '<h3>$lang.formtitle</h3> <form name="form" action="" method="post" > <p><input type="password" name="password" id="password-password" value="" size="22" /> <label for="password-password"><strong>$lang.password</strong></label></p> <p><input type="checkbox" name="remember" id="checkbox-remember" $remember /> <label for="checkbox-remember"><strong>$lang.remember</strong></label></p> <p> <input type="hidden" name="antispam" id="hidden-antispam" value="$antispam" /> <input type="submit" name="submitbutton" id="submitbutton" value="$lang.send" /> </p> </form>'; $self->data['form'] = ttheme::i()->parse($form); $self->data['title'] = $lang->reqpassword; $self->data['invalidpassword'] = $lang->invalidpassword; $self->save(); trobotstxt::i()->AddDisallow('/check-password.php'); litepublisher::$urlmap->addget('/check-password.php', get_class($self)); }
public function getcont() { $result = ''; $theme = ttheme::i(); if (litepublisher::$urlmap->page == 1 && $this->content != '') { $result .= $theme->simple($theme->parse($this->rawcontent)); } $perpage = litepublisher::$options->perpage; $downloaditems = tdownloaditems::i(); $d = litepublisher::$db->prefix . $downloaditems->childtable; $p = litepublisher::$db->posts; $where = $this->type == '' ? '' : " and {$d}.type = '{$this->type}'"; $count = $downloaditems->getchildscount($where); $from = (litepublisher::$urlmap->page - 1) * $perpage; if ($from <= $count) { $items = $downloaditems->select("{$p}.status = 'published' {$where}", " order by {$p}.posted desc limit {$from}, {$perpage}"); ttheme::$vars['lang'] = tlocal::i('downloaditem'); $tml = $theme->templates['custom']['downloadexcerpt']; if (count($items) > 0) { $result .= $theme->templates['custom']['siteform']; foreach ($items as $id) { ttheme::$vars['post'] = tdownloaditem::i($id); $result .= $theme->parse($tml); } } } $result .= $theme->getpages($this->url, litepublisher::$urlmap->page, ceil($count / $perpage)); return $result; }
public function getcontent($id, $sidebar) { if (litepublisher::$urlmap->is404 || litepublisher::$urlmap->adminpanel || strbegin(litepublisher::$urlmap->url, '/croncron.php') || strend(litepublisher::$urlmap->url, '.xml')) { return ''; } $id = litepublisher::$urlmap->itemrequested['id']; $filename = litepublisher::$paths->data . 'keywords' . DIRECTORY_SEPARATOR . $id . '.' . litepublisher::$urlmap->page . '.php'; if (@file_exists($filename)) { $links = file_get_contents($filename); } else { if (count($this->links) < $this->count) { return ''; } $arlinks = array_splice($this->links, 0, $this->count); $this->save(); //$links = "\n<li>" . implode("</li>\n<li>", $arlinks) . "</li>"; $links = ''; $text = ''; foreach ($arlinks as $link) { $links .= sprintf('<li><a href="%s">%s</a></li>', $link['url'], $link['text']); $text .= $link['text'] . "\n"; } file_put_contents($filename, $links); if ($this->notify) { $plugin = tkeywordsplugin::i(); $plugin->added($filename, $text); } } $theme = ttheme::i(); return $theme->getwidgetcontent($links, $this->template, $sidebar); }
private function getlist() { $foaf = tfoaf::i(); $perpage = 20; $total = $foaf->getcount(); $from = $this->getfrom($perpage, $total); if ($foaf->dbversion) { $items = $foaf->select('', " order by status asc, added desc limit {$from}, {$perpage}"); if (!$items) { $items = array(); } } else { $items = array_slice(array_keys($foaf->items), $from, $perpage); } $html = $this->html; $result = $html->tableheader(); $args = targs::i(); $args->adminurl = $this->adminurl; foreach ($items as $id) { $item = $foaf->getitem($id); $args->add($item); $args->id = $id; $args->status = tlocal::get('foaf', $item['status']); $result .= $html->itemlist($args); } $result .= $html->tablefooter(); $theme = ttheme::i(); $result .= $theme->getpages('/admin/foaf/', litepublisher::$urlmap->page, ceil($total / $perpage)); return $result; }
private function getpingbackslist() { $result = ''; $pingbacks = tpingbacks::i(); $perpage = 20; $total = $pingbacks->getcount(); $from = $this->getfrom($perpage, $total); $db = $pingbacks->db; $t = $pingbacks->thistable; $items = $db->res2assoc($db->query("select {$t}.*, {$db->posts}.title as posttitle, {$db->urlmap}.url as posturl\n from {$t}, {$db->posts}, {$db->urlmap}\n where {$t}.status <> 'deleted' and {$db->posts}.id = {$t}.post and {$db->urlmap}.id = {$db->posts}.idurl\n order by {$t}.posted desc limit {$from}, {$perpage}")); $html = $this->html; $lang = tlocal::i(); $args = new targs(); $form = new adminform($args); $form->items = $html->getitemscount($from, $from + count($items), $total); ttheme::$vars['pingitem'] = new pingitem(); $form->items .= $html->buildtable($items, array($html->get_table_checkbox('id'), array('left', $lang->date, '$pingitem.date'), array('left', $lang->status, '$pingitem.status'), array('left', $lang->title, '$title'), array('left', $lang->url, '<a href="$url">$url</a>'), array('left', 'IP', '$ip'), array('left', $lang->post, '<a href="$posturl">$posttitle</a>'), array('center', $lang->edit, "<a href='{$this->adminurl}=\$id&action=edit'>{$lang->edit}</a>"))); unset(ttheme::$vars['pingitem']); $form->items .= $html->div($html->getsubmit('approve', 'hold', 'delete')); $form->submit = false; $result = $form->get(); $theme = ttheme::i(); $result .= $theme->getpages($this->url, litepublisher::$urlmap->page, ceil($total / $perpage)); return $result; }
public function getcontent($id, $sidebar) { if (litepublisher::$urlmap->is404) { return ''; } $result = ''; $a = array('$url' => urlencode(litepublisher::$site->url . litepublisher::$urlmap->url), '$title' => urlencode(ttemplate::i()->title)); $redirlink = litepublisher::$site->url . $this->redirlink . litepublisher::$site->q . strtr('url=$url&title=$title&id=', $a); $iconurl = litepublisher::$site->files . '/plugins/bookmarks/icons/'; $theme = ttheme::i(); $tml = $theme->getwidgetitem('links', $sidebar); $args = targs::i(); $args->subcount = ''; $args->subitems = ''; $args->rel = 'link bookmark'; foreach ($this->items as $id => $item) { $args->id = $id; $args->title = $item['title']; $args->text = $item['title']; if ($this->redir) { $args->link = $redirlink . $id; } else { $args->link = strtr($item['url'], $a); } $args->icon = $item['text'] == '' ? '' : sprintf('<img src="%s%s" alt="%s" />', $iconurl, $item['text'], $item['title']); $result .= $theme->parsearg($tml, $args); } return $theme->getwidgetcontent($result, 'links', $sidebar); }
public function getcont() { $result = $this->formresult; $result .= $this->getcontent(); $theme = ttheme::i(); return $theme->simple($result); }
public function getcontent($id, $sidebar) { $result = ''; $theme = ttheme::i(); $tml = $theme->getwidgetitem('meta', $sidebar); $metaclasses = $theme->getwidgettml($sidebar, 'meta', 'classes'); $args = targs::i(); foreach ($this->items as $name => $item) { if (!$item['enabled']) { continue; } $args->add($item); $args->icon = ''; $args->subcount = ''; $args->subitems = ''; $args->rel = $name; if ($name == 'profile') { $args->rel = 'author profile'; } $args->class = isset($metaclasses[$name]) ? $metaclasses[$name] : ''; $result .= $theme->parsearg($tml, $args); } if ($result == '') { return ''; } return $theme->getwidgetcontent($result, 'meta', $sidebar); }
/** * Lite Publisher * Copyright (C) 2010 - 2015 Vladimir Yushko http://litepublisher.ru/ http://litepublisher.com/ * Dual licensed under the MIT (mit.txt) * and GPL (gpl.txt) licenses. **/ function tpolltypesInstall($self) { $lang = tlocal::admin('polls'); $theme = ttheme::i(); $res = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'resource' . DIRECTORY_SEPARATOR; $self->data['closed'] = $theme->replacelang(file_get_contents($res . 'microformat.tml'), $lang); $self->data['itemclosed'] = ''; $ini = parse_ini_file($res . 'types.ini', true); foreach ($ini as $type => $item) { foreach ($item as $k => $v) { $item[$k] = str_replace("'", '"', $v); } $item['type'] = $type; $item['item'] = $theme->replacelang($item['item'], $lang); $item['opened'] = $theme->replacelang($item['opened'], $lang); if (isset($item['closed'])) { $item['closed'] = $theme->replacelang($item['closed'], $lang); } if (isset($item['itemclosed'])) { $item['itemclosed'] = $theme->replacelang($item['itemclosed'], $lang); } $self->add($item); } $self->save(); }
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 getcontent($id, $sidebar) { $foaf = tfoaf::i(); $items = $foaf->getapproved($this->maxcount); if (count($items) == 0) { return ''; } $result = ''; $url = litepublisher::$site->url; $redirlink = litepublisher::$site->url . $this->redirlink . litepublisher::$site->q . 'id='; $theme = ttheme::i(); $tml = $theme->getwidgetitem('friends', $sidebar); $args = targs::i(); $args->subcount = ''; $args->subitems = ''; $args->{$icon} = ''; $args->rel = 'friend'; foreach ($items as $id) { $item = $foaf->getitem($id); $args->add($item); $args->anchor = $item['title']; if ($this->redir && !strbegin($item['url'], $url)) { $args->url = $redirlink . $id; } $result .= $theme->parsearg($tml, $args); } return $theme->getwidgetcontent($result, 'friends', $sidebar); }
public function getcontent($id, $sidebar) { if (count($this->items) == 0) { return ''; } $result = ''; $theme = ttheme::i(); $tml = $theme->getwidgetitem('links', $sidebar); $redirlink = litepublisher::$site->url . $this->redirlink . litepublisher::$site->q . 'id='; $url = litepublisher::$site->url; $args = targs::i(); $args->subcount = ''; $args->subitems = ''; $args->icon = ''; $args->rel = 'link'; foreach ($this->items as $id => $item) { $args->add($item); $args->id = $id; if ($this->redir && !strbegin($item['url'], $url)) { $args->link = $redirlink . $id; } else { $args->link = $item['url']; } $result .= $theme->parsearg($tml, $args); } return $theme->getwidgetcontent($result, 'links', $sidebar); }
protected function optionsform($widgettitle, $content) { $args = targs::i(); $args->formtitle = $widgettitle . ' ' . $this->lang->widget; $args->title = $widgettitle; $args->items = $this->html->getedit('title', $widgettitle, $this->lang->widgettitle) . $content; return $this->html->parsearg(ttheme::i()->templates['content.admin.form'], $args); }
public function getcont() { $dir = $this->item['dir']; $filename = $this->item['filename']; $updir = $filename == '' ? '' : ($dir == '' ? '' : sprintf('<ul><li><a href="%1$s/source/%2$s/" title="%2$s">..</a></li></ul>', litepublisher::$site->url, $dir)); $theme = ttheme::i(); return $theme->simple($updir . $this->getcachecontent($dir, $filename)); }
public function getcontent($id, $sidebar) { if (!isset($this->items[$id])) { return ''; } $item = $this->items[$id]; $theme = ttheme::i(); return $this->tags->getsortedcontent(array('item' => $theme->getwidgetitem($item['template'], $sidebar), 'subcount' => $theme->getwidgettml($sidebar, $item['template'], 'subcount'), 'subitems' => $item['showsubitems'] ? $theme->getwidgettml($sidebar, $item['template'], 'subitems') : ''), $item['idtag'], $item['sortname'], $item['maxcount'], $item['showcount']); }
public function sendpost($id) { if ($this->host == '' || $this->login == '') { return false; } $post = tpost::i($id); ttheme::$vars['post'] = $post; $theme = ttheme::i(); $content = $theme->parse($this->template); $date = getdate($post->posted); if ($post->status != 'published') { return; } $meta = $post->meta; $client = new IXR_Client($this->host, '/interface/xmlrpc'); //$client = new IXR_Client($this->host, '/rpc.xml'); if (!$client->query('LJ.XMLRPC.getchallenge')) { if (litepublisher::$debug) { tfiler::log('live journal: error challenge'); } return false; } $response = $client->getResponse(); $challenge = $response['challenge']; $args = array('username' => $this->login, 'auth_method' => 'challenge', 'auth_challenge' => $challenge, 'auth_response' => md5($challenge . md5($this->password)), 'ver' => "1", 'event' => $content, 'subject' => $post->title, 'year' => $date['year'], 'mon' => $date['mon'], 'day' => $date['mday'], 'hour' => $date['hours'], 'min' => $date['minutes'], 'props' => array('opt_nocomments' => !$post->commentsenabled, 'opt_preformatted' => true, 'taglist' => $post->tagnames)); switch ($this->privacy) { case "public": $args['security'] = "public"; break; case "private": $args['security'] = "private"; break; case "friends": $args['security'] = "usemask"; $args['allowmask'] = 1; } if ($this->community != '') { $args['usejournal'] = $this->community; } if (isset($meta->ljid)) { $method = 'LJ.XMLRPC.editevent'; $args['itemid'] = $meta->ljid; } else { $method = 'LJ.XMLRPC.postevent'; } if (!$client->query($method, $args)) { if (litepublisher::$debug) { tfiler::log('Something went wrong - ' . $client->getErrorCode() . ' : ' . $client->getErrorMessage()); } return false; } if (!isset($meta->ljid)) { $response = $client->getResponse(); $meta->ljid = $response['itemid']; } return $meta->ljid; }
public function request($arg) { $s = '<?php header(\'Content-Type: text/cache-manifest\'); header(\'Last-Modified: ' . date('r') . '\'); ?>'; $s .= "CACHE MANIFEST\r\n"; $s .= ttheme::i()->parse($this->text); return $s; }
public static function getcombo($idperm, $name = 'idperm') { $lang = tlocal::admin(); $section = $lang->section; $lang->section = 'perms'; $theme = ttheme::i(); $result = strtr($theme->templates['content.admin.combo'], array('$lang.$name' => $lang->perm, '$name' => $name, '$value' => self::getcomboitems($idperm))); $lang->section = $section; return $result; }
public function getwidget($id, $sidebar) { if (!isset($this->items[$id])) { return ''; } $item = $this->items[$id]; if ($item['template'] == '') { return $item['content']; } $theme = ttheme::i(); return $theme->getwidget($item['title'], $item['content'], $item['template'], $sidebar); }
private function sendmail() { $args = new targs(); $args->url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $args->ref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; tlocal::usefile('mail'); $lang = tlocal::i('notfound'); $theme = ttheme::i(); $subject = $theme->parsearg($lang->subject, $args); $body = $theme->parsearg($lang->body, $args); tmailer::sendtoadmin($subject, $body, true); }
private function notify(tticket $ticket) { ttheme::$vars['ticket'] = $ticket; $args = new targs(); $args->adminurl = litepublisher::$site->url . '/admin/tickets/editor/' . litepublisher::$site->q . 'id=' . $ticket->id; tlocal::usefile('mail'); $lang = tlocal::i('mailticket'); $lang->addsearch('ticket'); $theme = ttheme::i(); $subject = $theme->parsearg($lang->subject, $args); $body = $theme->parsearg($lang->body, $args); tmailer::sendtoadmin($subject, $body); }
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; }
public function getcontent() { $result = ''; $items = $this->db->getitems("post = {$this->pid} and status = 'approved' order by posted"); $pingback = new tarray2prop(); ttheme::$vars['pingback'] = $pingback; $lang = tlocal::i('comment'); $theme = ttheme::i(); $tml = $theme->content->post->templatecomments->pingbacks->pingback; foreach ($items as $item) { $pingback->array = $item; $result .= $theme->parse($tml); } return str_replace('$pingback', $result, $theme->parse($theme->content->post->templatecomments->pingbacks)); }
public function getwidget($id, $sidebar) { if (!isset($this->items[$id])) { return ''; } $item = $this->items[$id]; $post = $this->getcontext('tpost'); if (0 == count(array_intersect($item['cats'], $post->categories))) { return ''; } if ($item['template'] == '') { return $item['content']; } $theme = ttheme::i(); return $theme->getwidget($item['title'], $item['content'], $item['template'], $sidebar); }
public static function getgroups(array $idgroups) { $result = ''; $groups = tusergroups::i(); $tml = '<li><input type="checkbox" name="idgroup-$id" id="checkbox-idgroup-$id" value="$id" $checked /> <label for="checkbox-idgroup-$id"><strong>$title</strong></label></li>'; $theme = ttheme::i(); $args = new targs(); foreach ($groups->items as $id => $item) { $args->add($item); $args->id = $id; $args->checked = in_array($id, $idgroups); $result .= strtr($tml, $args->data); } return sprintf('<ul>%s</ul>', $result); }
/** * Lite Publisher * Copyright (C) 2010 - 2015 Vladimir Yushko http://litepublisher.ru/ http://litepublisher.com/ * Dual licensed under the MIT (mit.txt) * and GPL (gpl.txt) licenses. **/ function tcontactsiteInstall($self) { $theme = ttheme::i(); $args = targs::i(); $about = tplugins::getabout(tplugins::getname(__FILE__)); $args->add($about); $self->title = $about['title']; $self->subject = $about['subject']; $self->success = $theme->parsearg('<p><strong>$success</strong></p>', $args); $self->errmesg = $theme->parsearg('<p><strong>$errmesg</strong></p>', $args); $form = $theme->parsearg(file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'form.tml'), $args); $self->data['content'] = $form; $self->data['rawcontent'] = $form; $self->order = 9; $menus = tmenus::i(); $menus->add($self); }
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; }
private function sendmail($id) { $item = $this->getitem($id); $args = targs::i(); $args->add($item); $args->id = $id; $status = dbversion ? $item['status'] : ($item['approved'] ? 'approved' : 'hold'); $args->localstatus = tlocal::get('commentstatus', $status); $args->adminurl = litepublisher::$site->url . '/admin/comments/pingback/' . litepublisher::$site->q . "id={$id}&post={$item['post']}&action"; $post = tpost::i($item['post']); $args->posttitle = $post->title; $args->postlink = $post->link; tlocal::usefile('mail'); $lang = tlocal::i('mailcomments'); $theme = ttheme::i(); $subject = $theme->parsearg($lang->pingbacksubj, $args); $body = $theme->parsearg($lang->pingbackbody, $args); tmailer::sendmail(litepublisher::$site->name, litepublisher::$options->fromemail, 'admin', litepublisher::$options->email, $subject, $body); }
public static function getcontent($holder, $menu) { $result = ''; $html = $menu->html; $lang = tlocal::admin(); $id = (int) tadminhtml::getparam('id', 0); $args = new targs(); $args->id = $id; $args->adminurl = $menu->adminurl; if (isset($_GET['action']) && $_GET['action'] == 'delete' && $tags->itemexists($id)) { if (isset($_REQUEST['confirm']) && $_REQUEST['confirm'] == 1) { $holder->delete($id); $result .= $html->h4->deleted; } else { return $html->confirmdelete($id, $menu->adminurl, $lang->confirmdelete); } } if ($id == 0) { $item = $menu->defaultitem; } elseif ($holder->itemexists($id)) { $item = $holder->getitem($id); } else { $item = false; } if ($item) { $args->add($item); $menu->editargs($item, $args); $result .= $html->adminform($menu->editform, $args); } //table $perpage = 20; $count = $holder->count; $from = $menu->getfrom($perpage, $count); $items = $holder->select($menu->where, " order by id desc limit {$from}, {$perpage}"); if (!$items) { $items = array(); } $result .= $html->buildtable($items, $menu->table); $result = $html->fixquote($result); $theme = ttheme::i(); $result .= $theme->getpages($menu->url, litepublisher::$urlmap->page, ceil($count / $perpage)); return $result; }
public function getcontent($id, $sidebar) { $recent = $this->getrecent($this->maxcount); if (count($recent) == 0) { return ''; } $result = ''; $theme = ttheme::i(); $tml = $theme->getwidgetitem('comments', $sidebar); $url = litepublisher::$site->url; $args = targs::i(); $args->onrecent = tlocal::get('comment', 'onrecent'); foreach ($recent as $item) { $args->add($item); $args->link = $url . $item['posturl']; $args->content = tcontentfilter::getexcerpt($item['content'], 120); $result .= $theme->parsearg($tml, $args); } return $theme->getwidgetcontent($result, 'comments', $sidebar); }