コード例 #1
0
 public function filterpost(tpost $post, $s)
 {
     $cancel = false;
     $this->callevent('beforecontent', array($post, &$s, &$cancel));
     if ($cancel) {
         return $this->aftercontent($post);
     }
     $moretag = ' <!--more-->';
     if (preg_match('/<!--more(.*?)?-->/', $s, $matches) || preg_match('/\\[more(.*?)?\\]/', $s, $matches) || preg_match('/\\[cut(.*?)?\\]/', $s, $matches)) {
         $parts = explode($matches[0], $s, 2);
         $excerpt = $this->filter(trim($parts[0]) . $moretag);
         $post->filtered = $excerpt . $this->extract_pages($post, trim($parts[1]));
         $this->setexcerpt($post, $excerpt, self::gettitle($matches[1]));
         if ($post->moretitle == '') {
             $post->moretitle = tlocal::get('default', 'more');
         }
     } else {
         if ($this->automore) {
             $post->filtered = $this->extract_pages($post, $s);
             $this->setexcerpt($post, $this->filter(trim(self::GetExcerpt($post->pagescount == 1 ? $s : $post->filtered, $this->automorelength)) . $moretag), tlocal::get('default', 'more'));
         } else {
             $post->filtered = $this->extract_pages($post, $s);
             $this->setexcerpt($post, $post->filtered, '');
         }
     }
     $post->description = self::getpostdescription($post->excerpt);
     $this->aftercontent($post);
 }
コード例 #2
0
 public static function autherror($email, $password)
 {
     tlocal::admin();
     if (empty($email) || empty($password)) {
         return tlocal::get('login', 'empty');
     }
     $iduser = litepublisher::$options->emailexists($email);
     if (!$iduser) {
         if (self::confirm_reg($email, $password)) {
             return;
         }
         return tlocal::get('login', 'unknownemail');
     }
     if (litepublisher::$options->authpassword($iduser, $password)) {
         return;
     }
     if (self::confirm_restore($email, $password)) {
         return;
     }
     //check if password is empty and neet to restore password
     if ($iduser == 1) {
         if (!litepublisher::$options->password) {
             return tlocal::get('login', 'torestorepass');
         }
     } else {
         if (!tusers::i()->getpassword($iduser)) {
             return tlocal::get('login', 'torestorepass');
         }
     }
     return tlocal::get('login', 'error');
 }
コード例 #3
0
 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;
 }
コード例 #4
0
 public function getcont()
 {
     $result = '<h4>' . tlocal::get('default', 'sitemap') . '</h4><ul>';
     $theme = $this->view->theme;
     $perpage = 1000;
     $count = 0;
     $from = (litepublisher::$urlmap->page - 1) * $perpage;
     $siteurl = litepublisher::$site->url;
     $classes = litepublisher::$urlmap->page == 1 ? $this->classes : 'tposts';
     foreach ($classes as $class) {
         $instance = getinstance($class);
         $links = $instance->getsitemap($from, $perpage - $count);
         $count += count($links);
         foreach ($links as $item) {
             $pages = '';
             if ($item['pages'] > 1) {
                 $url = rtrim($item['url'], '/');
                 for ($i = 2; $i < $link['pages']; $i++) {
                     $pages = "<a href=\"{$siteurl}{$url}/page/{$i}/\">{$i}</a>,";
                 }
             }
             $result .= "<li><a href=\"{$siteurl}{$item['url']}\" title=\"{$item['title']}\">{$item['title']}</a>{$pages}</li>";
         }
         if ($count > $perpage) {
             break;
         }
     }
     $result .= '</ul>';
     //    $result .=$theme->getpages('/sitemap.htm', litepublisher::$urlmap->page, ceil($posts->archivescount / $perpage));
     return $result;
 }
コード例 #5
0
 public function getcontent()
 {
     $result = '';
     $this->basename = 'downloaditems';
     $html = $this->inihtml();
     $lang = tlocal::admin('downloaditems');
     $lang->ini['downloaditems'] = $lang->ini['downloaditem'] + $lang->ini['downloaditems'];
     $html->push_section('editor');
     $downloaditem = tdownloaditem::i($this->idpost);
     ttheme::$vars['downloaditem'] = $downloaditem;
     $args = new targs();
     $this->getpostargs($downloaditem, $args);
     $html->pop_section();
     $args->downloadurl = $downloaditem->downloadurl;
     $args->authorname = $downloaditem->authorname;
     $args->authorurl = $downloaditem->authorurl;
     $args->version = $downloaditem->version;
     $types = array('theme' => tlocal::get('downloaditem', 'theme'), 'plugin' => tlocal::get('downloaditem', 'plugin'));
     $args->type = tadminhtml::array2combo($types, $downloaditem->type);
     if ($downloaditem->id > 0) {
         $result .= $html->headeditor();
     }
     $result .= $html->form($args);
     $result = $html->fixquote($result);
     unset(ttheme::$vars['downloaditem']);
     return $result;
 }
コード例 #6
0
 public function processform()
 {
     if (!isset($_POST['contactvalue'])) {
         return '';
     }
     $time = substr($_POST['contactvalue'], strlen('_contactform'));
     if (time() > $time) {
         return $this->errmesg;
     }
     $email = trim($_POST['email']);
     if (!tcontentfilter::ValidateEmail($email)) {
         return sprintf('<p><strong>%s</strong></p>', tlocal::get('comment', 'invalidemail'));
     }
     $url = trim($_POST['site']);
     if (empty($url) || strbegin($url, litepublisher::$site->url)) {
         return $this->errmesg;
     }
     if ($s = http::get($url)) {
         if (!strpos($s, '<meta name="generator" content="Lite Publisher')) {
             return $this->errmesg;
         }
     } else {
         return $this->errmesg;
     }
     $content = trim($_POST['content']);
     if (strlen($content) <= 15) {
         return sprintf('<p><strong>%s</strong></p>', tlocal::get('comment', 'emptycontent'));
     }
     $content = "{$url}\n" . $_POST['sitetitle'] . "\n\n" . $content;
     tmailer::sendmail('', $email, '', litepublisher::$options->email, $this->subject, $content);
     return $this->success;
 }
コード例 #7
0
/**
* 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 tlocalmergerInstall($self)
{
    $dir = litepublisher::$paths->data . 'languages';
    if (!is_dir($dir)) {
        @mkdir($dir, 0777);
    }
    @chmod($dir, 0777);
    $lang = litepublisher::$options->language;
    $self->lock();
    $self->add('default', "lib/languages/{$lang}/default.ini");
    $self->add('admin', "lib/languages/{$lang}/admin.ini");
    $self->add('mail', "lib/languages/{$lang}/mail.ini");
    if (litepublisher::$options->language != 'en') {
        $self->add('translit', "lib/languages/{$lang}/translit.ini");
    } else {
        $self->items['translit'] = array('files' => array(), 'texts' => array());
    }
    $self->add('install', "lib/languages/{$lang}/install.ini");
    $self->addhtml('lib/languages/adminhtml.ini');
    $self->addhtml('lib/languages/posteditor.ini');
    $self->unlock();
    //after install
    litepublisher::$options->timezone = tlocal::get('installation', 'timezone');
    date_default_timezone_set(tlocal::get('installation', 'timezone'));
    $html = tadminhtml::i();
    $html->loadinstall();
}
コード例 #8
0
 public function processform()
 {
     if (!isset($_POST['contactvalue'])) {
         return '';
     }
     $time = substr($_POST['contactvalue'], strlen('_contactform'));
     if (time() > $time) {
         return $this->errmesg;
     }
     $email = trim($_POST['email']);
     if (!tcontentfilter::ValidateEmail($email)) {
         return sprintf('<p><strong>%s</strong></p>', tlocal::get('comment', 'invalidemail'));
     }
     $content = trim($_POST['content']);
     if (strlen($content) <= 10) {
         return sprintf('<p><strong>%s</strong></p>', tlocal::get('comment', 'emptycontent'));
     }
     if (false !== strpos($content, '<a href')) {
         return $this->errmesg;
     }
     foreach ($this->data['extra'] as $name => $title) {
         if (isset($_POST[$name])) {
             $content .= sprintf("\n\n%s:\n%s", $title, trim($_POST[$name]));
         }
     }
     tmailer::sendmail('', $email, '', litepublisher::$options->email, $this->subject, $content);
     return $this->success;
 }
コード例 #9
0
 public static function getcomboitems($idperm)
 {
     $result = sprintf('<option value="0" %s>%s</option>', $idperm == 0 ? 'selected="selected"' : '', tlocal::get('perms', 'nolimits'));
     $perms = tperms::i();
     foreach ($perms->items as $id => $item) {
         $result .= sprintf('<option value="%d" %s>%s</option>', $id, $idperm == $id ? 'selected="selected"' : '', $item['name']);
     }
     return $result;
 }
コード例 #10
0
ファイル: guard.class.php プロジェクト: laiello/litepublisher
 public static function checkattack()
 {
     if (litepublisher::$options->xxxcheck && self::is_xxx()) {
         tlocal::usefile('admin');
         if ($_POST) {
             die(tlocal::get('login', 'xxxattack'));
         }
         if ($_GET) {
             die(tlocal::get('login', 'confirmxxxattack') . sprintf(' <a href="%1$s">%1$s</a>', $_SERVER['REQUEST_URI']));
         }
     }
     return false;
 }
コード例 #11
0
/**
* 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 tsitemapInstall($self)
{
    tcron::i()->addnightly(get_class($self), 'Cron', null);
    litepublisher::$urlmap->add('/sitemap.xml', get_class($self), 'xml');
    litepublisher::$urlmap->add('/sitemap.htm', get_class($self), null);
    $robots = trobotstxt::i();
    array_splice($robots->items, 1, 0, "Sitemap: " . litepublisher::$site->url . "/sitemap.xml");
    $robots->save();
    $self->add('/sitemap.htm', 4);
    $self->createfiles();
    $meta = tmetawidget::i();
    $meta->add('sitemap', '/sitemap.htm', tlocal::get('default', 'sitemap'));
}
コード例 #12
0
ファイル: adminlinks.php プロジェクト: laiello/litepublisher
 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);
 }
コード例 #13
0
/**
* Lite Publisher
* Copyright (C) 2010 - 2013 Vladimir Yushko http://litepublisher.ru/ http://litepublisher.com/
* Dual licensed under the MIT (mit.txt)
* and GPL (gpl.txt) licenses.
**/
function tforumInstall($self)
{
    litepublisher::$options->reguser = true;
    tadminoptions::i()->usersenabled = true;
    $name = basename(dirname(__FILE__));
    tlocalmerger::i()->addplugin($name);
    $lang = tlocal::admin('forum');
    //prevent double create view
    $idview = 0;
    $views = tviews::i();
    foreach ($views->items as $id => $item) {
        if ('forum' == $item['themename']) {
            $idview = $id;
            break;
        }
    }
    if (!$idview) {
        $view = new tview();
        $view->name = $lang->forum;
        $view->themename = 'forum';
        $idview = $views->addview($view);
    }
    $lang->section = 'forum';
    $cats = tcategories::i();
    $idcat = $cats->add(0, $lang->forum);
    $cats->setvalue($idcat, 'includechilds', 1);
    $cats->setvalue($idcat, 'idview', $idview);
    $cats->contents->setcontent($idcat, $lang->intro . sprintf(' <a href="%s/admin/plugins/forum/">%s</a>', litepublisher::$site->url, tlocal::get('names', 'adminpanel')));
    $self->rootcat = $idcat;
    $self->idview = $idview;
    $self->categories_changed();
    $self->save();
    $cat = $cats->getitem($idcat);
    tmenus::i()->addfake($cat['url'], $cat['title']);
    tjsmerger::i()->add('default', '/plugins/forum/forum.min.js');
    $linkgen = tlinkgenerator::i();
    $linkgen->data['forum'] = '/forum/[title].htm';
    $linkgen->save();
    $cats = tcategories::i();
    $cats->lock();
    $cats->changed = $self->categories_changed;
    $cats->added = $self->catadded;
    $cats->unlock();
    tthemeparser::i()->parsed = $self->themeparsed;
    ttheme::clearcache();
    litepublisher::$classes->add('tforumeditor', 'admin.forumeditor.class.php', $name);
    $adminmenus = tadminmenus::i();
    $adminmenus->createitem($adminmenus->url2id('/admin/plugins/'), 'forum', 'author', 'tforumeditor');
}
コード例 #14
0
/**
* 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 trssInstall($self)
{
    litepublisher::$urlmap->add('/rss.xml', get_class($self), 'posts');
    $self->idcomments = litepublisher::$urlmap->add('/comments.xml', get_class($self), 'comments');
    $self->idpostcomments = litepublisher::$urlmap->add('/comments/', get_class($self), null, 'tree');
    litepublisher::$urlmap->add('/rss/categories/', get_class($self), 'categories', 'tree');
    litepublisher::$urlmap->add('/rss/tags/', get_class($self), 'tags', 'tree');
    tcomments::i()->changed = $self->commentschanged;
    $self->save();
    $meta = tmetawidget::i();
    $meta->lock();
    $meta->add('rss', '/rss.xml', tlocal::get('default', 'rss'));
    $meta->add('comments', '/comments.xml', tlocal::get('default', 'rsscomments'));
    $meta->unlock();
}
コード例 #15
0
/**
* 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 trssMultimediaInstall($self)
{
    $urlmap = turlmap::i();
    $urlmap->lock();
    $urlmap->add('/rss/multimedia.xml', get_class($self), '');
    $urlmap->add('/rss/images.xml', get_class($self), 'image');
    $urlmap->add('/rss/audio.xml', get_class($self), 'audio');
    $urlmap->add('/rss/video.xml', get_class($self), 'video');
    $urlmap->unlock();
    $files = tfiles::i();
    $files->changed = $self->fileschanged;
    $self->save();
    $meta = tmetawidget::i();
    $meta->add('media', '/rss/multimedia.xml', tlocal::get('default', 'rssmedia'));
}
コード例 #16
0
function preloadlanguage($lang, $language)
{
    $dir = litepublisher::$paths->languages . $language . DIRECTORY_SEPARATOR;
    foreach (array('default', 'admin', 'install') as $name) {
        $ini = parse_ini_file($dir . $name . '.ini', true);
        $lang->ini = $ini + $lang->ini;
        $lang->loaded[] = $name;
    }
    date_default_timezone_set(tlocal::get('installation', 'timezone'));
    $html = new tadminhtml();
    litepublisher::$classes->instances['tadminhtml'] = $html;
    $ini = parse_ini_file(litepublisher::$paths->languages . 'adminhtml.ini', true);
    $html->ini = $ini + $html->ini;
    $ini = parse_ini_file(litepublisher::$paths->languages . 'install.ini', true);
    $html->ini = $ini + $html->ini;
}
コード例 #17
0
 public function processform()
 {
     if (!($id = $this->getidfile())) {
         return $this->notfound;
     }
     $files = tfiles::i();
     $item = $files->getitem($id);
     if (isset($_POST['delete'])) {
         $files->delete($item['preview']);
         $files->setvalue($id, 'preview', 0);
         return $this->html->h4->deleted;
     }
     $isauthor = 'author' == litepublisher::$options->group;
     if (isset($_FILES['filename']['error']) && $_FILES['filename']['error'] > 0) {
         $error = tlocal::get('uploaderrors', $_FILES["filename"]["error"]);
         return "<h3>{$error}</h3>\n";
     }
     if (!is_uploaded_file($_FILES['filename']['tmp_name'])) {
         return sprintf($this->html->h4red->attack, $_FILES["filename"]["name"]);
     }
     if ($isauthor && ($r = tauthor_rights::i()->canupload())) {
         return $r;
     }
     $filename = $_FILES['filename']['name'];
     $tempfilename = $_FILES['filename']['tmp_name'];
     $parser = tmediaparser::i();
     $filename = tmediaparser::linkgen($filename);
     $parts = pathinfo($filename);
     $newtemp = $parser->gettempname($parts);
     if (!move_uploaded_file($tempfilename, litepublisher::$paths->files . $newtemp)) {
         return sprintf($this->html->h4->attack, $_FILES["filename"]["name"]);
     }
     $resize = !isset($_POST['noresize']);
     $idpreview = $parser->add(array('filename' => $filename, 'tempfilename' => $newtemp, 'enabledpreview' => $resize, 'ispreview' => $resize));
     if ($idpreview) {
         if ($item['preview'] > 0) {
             $files->delete($item['preview']);
         }
         $files->setvalue($id, 'preview', $idpreview);
         $files->setvalue($idpreview, 'parent', $id);
         if ($item['idperm'] > 0) {
             $files->setvalue($idpreview, 'idperm', $item['idperm']);
             tprivatefiles::i()->setperm($idpreview, (int) $item['idperm']);
         }
         return $this->html->h4->success;
     }
 }
コード例 #18
0
/**
* 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 thomepageInstall($self)
{
    litepublisher::$site->home = '/';
    $menus = tmenus::i();
    $menus->lock();
    $self->lock();
    $self->url = '/';
    $self->title = tlocal::i()->home;
    $self->idview = tviews::i()->add(tlocal::get('adminmenus', 'home'));
    $homeview = tview::i($self->idview);
    $homeview->disableajax = true;
    $homeview->save();
    $menus->idhome = $menus->add($self);
    $self->unlock();
    $menus->unlock();
    tposts::i()->addevent('changed', get_class($self), 'postschanged');
}
コード例 #19
0
 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);
 }
コード例 #20
0
 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);
 }
コード例 #21
0
 private function dogetholdcomments($rss)
 {
     $rss->domrss->CreateRoot(litepublisher::$site->url . $this->url, tlocal::get('comment', 'onrecent') . ' ' . litepublisher::$site->name);
     $db = litepublisher::$db;
     $author = litepublisher::$options->ingroup('moderator') ? '' : sprintf('%s.author = %d and ', $db->comments, litepublisher::$options->user);
     $recent = $db->res2assoc($db->query("select {$db->comments}.*,\n    {$db->users}.name as name, {$db->users}.email as email, {$db->users}.website as website,\n    {$db->posts}.title as title, {$db->posts}.commentscount as commentscount,\n    {$db->urlmap}.url as posturl\n    from {$db->comments}, {$db->users}, {$db->posts}, {$db->urlmap}\n    where {$db->comments}.status = 'hold' and {$author}\n    {$db->users}.id = {$db->comments}.author and\n    {$db->posts}.id = {$db->comments}.post and\n    {$db->urlmap}.id = {$db->posts}.idurl and\n    {$db->posts}.status = 'published'\n    order by {$db->comments}.posted desc limit {$this->count}"));
     $title = tlocal::get('comment', 'onpost') . ' ';
     $comment = new tarray2prop();
     ttheme::$vars['comment'] = $comment;
     $theme = ttheme::i();
     $tml = str_replace('$adminurl', '/admin/comments/' . litepublisher::$site->q . 'id=$comment.id&action', $this->template);
     $lang = tlocal::admin('comments');
     foreach ($recent as $item) {
         if ($item['website']) {
             $item['website'] = sprintf('<a href="%1$s">%1$s</a>', $item['website']);
         }
         $comment->array = $item;
         $comment->content = $theme->parse($tml);
         $rss->AddRSSComment($comment, $title . $comment->title);
     }
 }
コード例 #22
0
 public function setvisual($url)
 {
     if ($url == $this->visual) {
         return;
     }
     $js = tjsmerger::i();
     $js->lock();
     $js->deletefile('posteditor', $this->visual);
     $js->deletetext('posteditor', 'visual');
     if ($url) {
         if ($this->ajaxvisual) {
             $js->addtext('posteditor', 'visual', sprintf('$(document).ready(function() {
       litepubl.posteditor.init_visual_link("%s", %s);
     });', litepublisher::$site->files . $url, json_encode(tlocal::get('editor', 'loadvisual'))));
         } else {
             $js->add('posteditor', $url);
         }
     }
     $js->unlock();
     $this->data['visual'] = $url;
     $this->save();
 }
コード例 #23
0
 private function cancel()
 {
     return tsimplecontent::html(tlocal::get('openidserver', 'canceled'));
 }
コード例 #24
0
 public function processform()
 {
     $files = tfiles::i();
     $html = $this->html;
     if (empty($_GET['action'])) {
         $isauthor = 'author' == litepublisher::$options->group;
         if ($_POST['uploadmode'] == 'file') {
             if (isset($_FILES['filename']['error']) && $_FILES['filename']['error'] > 0) {
                 return $html->h4(tlocal::get('uploaderrors', $_FILES['filename']['error']));
             }
             if (!is_uploaded_file($_FILES['filename']['tmp_name'])) {
                 return sprintf($this->html->h4red->attack, $_FILES["filename"]["name"]);
             }
             if ($isauthor && ($r = tauthor_rights::i()->canupload())) {
                 return $r;
             }
             $overwrite = isset($_POST['overwrite']);
             $parser = tmediaparser::i();
             $id = $parser->uploadfile($_FILES['filename']['name'], $_FILES['filename']['tmp_name'], $_POST['title'], $_POST['description'], $_POST['keywords'], $overwrite);
         } else {
             //downloadurl
             $content = http::get($_POST['downloadurl']);
             if ($content == false) {
                 return $this->html->h2->errordownloadurl;
             }
             $filename = basename(trim($_POST['downloadurl'], '/'));
             if ($filename == '') {
                 $filename = 'noname.txt';
             }
             if ($isauthor && ($r = tauthor_rights::i()->canupload())) {
                 return $r;
             }
             $overwrite = isset($_POST['overwrite']);
             $parser = tmediaparser::i();
             $id = $parser->upload($filename, $content, $_POST['title'], $_POST['description'], $_POST['keywords'], $overwrite);
         }
         if (isset($_POST['idperm'])) {
             tprivatefiles::i()->setperm($id, (int) $_POST['idperm']);
         }
         return $this->html->h4->success;
     } elseif ($_GET['action'] == 'edit') {
         $id = $this->idget();
         if (!$files->itemexists($id)) {
             return $this->notfound;
         }
         $files->edit($id, $_POST['title'], $_POST['description'], $_POST['keywords']);
         if (isset($_POST['idperm'])) {
             tprivatefiles::i()->setperm($id, (int) $_POST['idperm']);
         }
         return $this->html->h4->edited;
     }
     return '';
 }
コード例 #25
0
 public static function compress(ttheme $theme, $dir = '')
 {
     if ($theme->name == 'default') {
         return false;
     }
     $result = '';
     if ($dir == '') {
         $dir = litepublisher::$paths->themes . $theme->name . DIRECTORY_SEPARATOR;
     }
     $parent = ttheme::getinstance($theme->parent == '' ? 'default' : $theme->parent);
     if ($theme->templates['index'] != $parent->templates['index']) {
         if (file_put_contents($dir . 'index.tml', $theme->templates['index']) === false) {
             return false;
         }
         $result .= '$template = {@import(index.tml)}';
         $result .= "\n\n";
     }
     foreach ($theme->templates as $name => $value) {
         if ($name == 'index') {
             continue;
         }
         if (is_array($value)) {
             continue;
         }
         $value = trim($value);
         if ($value == trim($parent->templates[$name])) {
             continue;
         }
         if (strend($name, '.date')) {
             if ($value == '' || $value == litepublisher::$options->dateformat || $value == tlocal::get('datetime', 'dateformat')) {
                 continue;
             }
         }
         $result .= "\$template.{$name} = [{$value}]\n\n";
     }
     for ($i = 0; $i < count($theme->templates['sidebars']); $i++) {
         $sidebar =& $theme->templates['sidebars'][$i];
         $parentsidebar =& $parent->templates['sidebars'][$i];
         foreach ($sidebar as $name => $value) {
             if (is_string($value)) {
                 $value = trim($value);
                 if ($value == trim($parentsidebar[$name])) {
                     continue;
                 }
             } else {
                 if (count(array_diff_assoc($value, $parentsidebar[$name])) == 0) {
                     continue;
                 }
                 $a = array_map(create_function('$k, $v', 'return "$k=$v";'), array_keys($value), array_values($value));
                 $value = implode(',', $a);
             }
             $result .= $i == 0 ? 'sidebar.' : "sidebar{$i}.";
             $result .= "{$name} = [{$value}]\n\n";
         }
     }
     return file_put_contents($dir . 'theme.txt', $result);
 }
コード例 #26
0
 public function Getlocalstatus()
 {
     return tlocal::get('commentstatus', $this->status);
 }
コード例 #27
0
 public function getdeftitle()
 {
     return tlocal::get('default', 'subscribe');
 }
コード例 #28
0
 public function __get($name)
 {
     $item = ttheme::$vars['item'];
     switch ($name) {
         case 'status':
             return tlocal::get('commentstatus', $item['status']);
         case 'date':
             return tlocal::date(strtotime($item['posted']));
     }
     return '';
 }
コード例 #29
0
 public function getdeftitle()
 {
     return tlocal::get('default', 'links');
 }
コード例 #30
0
 public function gettitle()
 {
     return tlocal::get('common', 'board');
 }