Exemplo n.º 1
0
 public function gettable($posts, $where)
 {
     $perpage = 20;
     if ($this->isauthor) {
         $where .= ' and author = ' . litepublisher::$options->user;
     }
     $count = $posts->db->getcount($where);
     $from = $this->getfrom($perpage, $count);
     $items = $posts->select($where, " order by posted desc limit {$from}, {$perpage}");
     if (!$items) {
         $items = array();
     }
     $html = $this->html;
     $lang = tlocal::admin();
     $form = new adminform(new targs());
     $form->items = $html->getitemscount($from, $from + count($items), $count);
     $form->items .= $html->tableposts($items, array(array('center', $lang->date, '$post.date'), array('left', $lang->posttitle, '$post.bookmark'), array('left', $lang->category, '$post.category'), array('left', $lang->status, '$poststatus.status'), array('center', $lang->edit, '<a href="' . tadminhtml::getadminlink('/admin/posts/editor/', 'id') . '=$post.id">' . $lang->edit . '</a>'), array('center', $lang->delete, "<a class=\"confirm-delete-link\" href=\"{$this->adminurl}=\$post.id&action=delete\">{$lang->delete}</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('/admin/posts/', litepublisher::$urlmap->page, ceil($count / $perpage));
     return $result;
 }
Exemplo n.º 2
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 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 createtable()
 {
     $lang = tlocal::admin('comments');
     $table = new ttablecolumns();
     $table->index = 1;
     $table->checkboxes[] = $this->html->tablecolumns();
     $table->add('$id', 'ID', 'right', $this->showcolumn($table->index + 1, true));
     $table->add('$comment.date', $lang->date, 'left', $this->showcolumn($table->index + 1, false));
     $table->add('$comment.localstatus', $lang->status, 'left', $this->showcolumn($table->index + 1, false));
     $table->add('<a href="$site.url/admin/users/{$site.q}id=$comment.author&action=edit">$comment.name</a>', $lang->author, 'left', $this->showcolumn($table->index + 1, true));
     $table->add('$email', 'E-Mail', 'left', $this->showcolumn($table->index + 1, true));
     $table->add('$website', $lang->website, 'left', $this->showcolumn($table->index + 1, false));
     $table->checkboxes[] = "<br />{$lang->content}: ";
     $table->add('<a href="$comment.url">$comment.posttitle</a>', $lang->post, 'left', $this->showcolumn($table->index + 1, false));
     $table->add('$excerpt', $lang->content, 'left', $this->showcolumn($table->index + 1, true));
     $table->add('$comment.ip', 'IP', 'left', $this->showcolumn($table->index + 1, false));
     $table->checkboxes[] = "<br />{$lang->moderate}: ";
     $table->add('<a href="$adminurl=$comment.id&action=reply">$lang.reply</a>', $lang->reply, 'left', $this->showcolumn($table->index + 1, false));
     $table->add('<a href="$adminurl=$comment.id&action=approve">$lang.approve</a>', $lang->approve, 'left', $this->showcolumn($table->index + 1, false));
     $table->add('<a href="$adminurl=$comment.id&action=hold">$lang.hold</a>', $lang->hold, 'left', $this->showcolumn($table->index + 1, false));
     $table->add('<a class="confirm-delete-link" href="$adminurl=$comment.id&action=delete">$lang.delete</a>', $lang->delete, 'left', $this->showcolumn($table->index + 1, false));
     $table->add('<a href="$adminurl=$comment.id&action=edit">$lang.edit</a>', $lang->edit, 'left', $this->showcolumn($table->index + 1, false));
     $table->body = '<tr>
 <td align ="center"><input type="checkbox" name="checkbox-item-$id" id="checkbox-item-$id" value="$id" $onhold /></td>' . $table->body . '</tr>';
     $table->checkboxes[] = '</p>-->';
     return $table;
 }
 public function getcontent()
 {
     $html = tadminhtml::i();
     $lang = tlocal::admin('polls');
     $args = new targs();
     //note to open admin menus
     $result = $html->h3->noteoptions;
     $polls = tpolls::i();
     $man = tpollsman::i();
     $args->addtopost = $man->addtopost;
     $items = array();
     $polls->loadall_tml();
     foreach ($polls->tml_items as $id => $tml) {
         $items[$id] = $tml['name'];
     }
     $args->pollpost = tadminhtml::array2combo($items, $man->pollpost);
     $args->lifetime = $man->lifetime;
     $args->formtitle = $lang->Options;
     $result .= $html->adminform('
 [checkbox=addtopost]
 [combo=pollpost]
 [text=lifetime]
 ', $args);
     return $result;
 }
 public function getcontent()
 {
     $merger = tlocalmerger::i();
     $tabs = new tuitabs();
     $html = $this->html;
     $lang = tlocal::i('options');
     $args = targs::i();
     foreach ($merger->items as $section => $items) {
         $tab = new tuitabs();
         $tab->add($lang->files, $html->getinput('editor', $section . '_files', tadminhtml::specchars(implode("\n", $items['files'])), $lang->files));
         $tabtext = new tuitabs();
         foreach ($items['texts'] as $key => $text) {
             $tabtext->add($key, $html->getinput('editor', $section . '_text_' . $key, tadminhtml::specchars($text), $key));
         }
         $tab->add($lang->text, $tabtext->get());
         $tabs->add($section, $tab->get());
     }
     $tabs->add('HTML', $html->getinput('editor', 'adminhtml_files', tadminhtml::specchars(implode("\n", $merger->html)), $lang->files));
     $args->formtitle = $lang->optionslocal;
     $args->dateformat = litepublisher::$options->dateformat;
     $dirs = tfiler::getdir(litepublisher::$paths->languages);
     $args->language = tadminhtml::array2combo(array_combine($dirs, $dirs), litepublisher::$options->language);
     $zones = timezone_identifiers_list();
     $args->timezone = tadminhtml::array2combo(array_combine($zones, $zones), litepublisher::$options->timezone);
     return $html->adminform('[text=dateformat]
 [combo=language]
 [combo=timezone]' . $tabs->get(), $args);
 }
Exemplo n.º 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;
 }
/**
* 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();
}
/**
* 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 processform()
 {
     /*
     echo "<pre>\n";
     var_dump($_POST);
     echo "</pre>\n";
     return;
     */
     extract($_POST, EXTR_SKIP);
     $this->basename = 'downloaditems';
     $html = $this->html;
     $lang = tlocal::i('editor');
     if (empty($_POST['title'])) {
         return $html->h2->emptytitle;
     }
     $downloaditem = tdownloaditem::i((int) $id);
     $this->set_post($downloaditem);
     $downloaditem->version = $version;
     $downloaditem->type = $type;
     $downloaditem->downloadurl = $downloadurl;
     $downloaditem->authorname = $authorname;
     $downloaditem->authorurl = $authorurl;
     $downloaditems = tdownloaditems::i();
     if ($downloaditem->id == 0) {
         $id = $downloaditems->add($downloaditem);
         $_GET['id'] = $id;
         $_POST['id'] = $id;
     } else {
         $downloaditems->edit($downloaditem);
     }
     $lang = tlocal::i('downloaditems');
     return $html->h2->successedit;
 }
Exemplo n.º 10
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;
 }
/**
* 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 get_themegen_content($self)
{
    $result = '';
    tlocal::usefile('themegenerator');
    $lang = tlocal::i('themegenerator');
    $self->colors = $lang->ini['themecolors'];
    $tml = '<p>
  <input type="button" name="colorbutton-$name" id="colorbutton-$name" rel="$name" value="' . $lang->selectcolor . '" />
  <input type="hidden" name="color_$name" id="text-color-$name" value="$value" />
  <strong>$label</strong></p>';
    $theme = tview::i($self->idview)->theme;
    $args = new targs();
    $a = new targs();
    foreach ($self->colors as $name => $value) {
        $args->name = $name;
        $args->value = $value;
        $args->label = $lang->{$name};
        $a->{$name} = $theme->parsearg($tml, $args);
    }
    $a->headerurl = $self->colors['headerurl'];
    $a->logourl = $self->colors['logourl'];
    $form = file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'res' . DIRECTORY_SEPARATOR . 'form.tml');
    $result .= $theme->parsearg($form, $a);
    return sprintf('[html]%s[/html]', $result);
}
Exemplo n.º 12
0
 public function getcontent()
 {
     $result = '';
     $types = tpolltypes::i();
     $html = tadminhtml::i();
     $lang = tlocal::admin('polls');
     $args = new targs();
     $type = isset($_GET['type']) ? $_GET['type'] : '';
     if (isset($types->items[$type])) {
         $args->type = $type;
         $tabs = new tuitabs();
         foreach ($types->items[$type] as $name => $value) {
             $args->{$name} = $value;
             $tabs->add($lang->{$name}, "[editor={$name}]");
         }
         $args->formtitle = $lang->edittype;
         $result .= $html->adminform($tabs->get(), $args);
     }
     $result .= $html->h4->alltypes;
     $result .= '<ul>';
     $adminurl = $html->getadminlink($this->url, 'type=');
     foreach ($types->items as $type => $item) {
         $result .= sprintf('<li><a href="%s%2$s" title="%2$s">%2$s</a></li>', $adminurl, $type);
     }
     $result .= '</ul>';
     return $result;
 }
Exemplo n.º 13
0
 public function createpoll()
 {
     $lang = tlocal::admin('downloaditems');
     $items = explode(',', $lang->pollitems);
     $polls = tpolls::i();
     return $polls->add('', 'opened', 'button', $items);
 }
Exemplo n.º 14
0
 public function getcontent()
 {
     $widget = tsubcatwidget::i();
     $about = tplugins::getabout(tplugins::getname(__FILE__));
     $html = $this->html;
     $args = targs::i();
     $id = (int) tadminhtml::getparam('idwidget', 0);
     if (isset($widget->items[$id])) {
         $args->add($widget->items[$id]);
         $args->sort = tadminhtml::array2combo(tlocal::admin()->ini['sortnametags'], $widget->items[$id]['sortname']);
         $args->idwidget = $id;
         $args->data['$lang.invertorder'] = $about['invertorder'];
         $args->formtitle = $widget->gettitle($id);
         return $html->adminform('
   [combo=sort]
   [checkbox=showsubitems]
   [checkbox=showcount]
   [text=maxcount]
   [hidden=idwidget]', $args);
     }
     $tags = array();
     foreach ($widget->items as $id => $item) {
         $tags[] = $item['idtag'];
     }
     $args->formtitle = $about['formtitle'];
     return $html->adminform(tposteditor::getcategories($tags), $args);
 }
Exemplo n.º 15
0
 public function gethtml()
 {
     $result = tadminhtml::i();
     $result->section = $this->section;
     $lang = tlocal::admin($this->section);
     return $result;
 }
 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;
 }
Exemplo n.º 17
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;
 }
Exemplo n.º 18
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);
 }
Exemplo n.º 19
0
 public static function getnamelang($name)
 {
     $about = self::getabout($name);
     $lang = tlocal::admin();
     $lang->ini[$name] = $about;
     $lang->section = $name;
     return $lang;
 }
Exemplo n.º 20
0
 public function getcontent()
 {
     $lang = tlocal::admin('tickets');
     $args = new targs();
     $args->formtitle = $lang->admincats;
     $tickets = ttickets::i();
     return $this->html->adminform(tposteditor::getcategories($tickets->cats), $args);
 }
Exemplo n.º 21
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;
 }
Exemplo n.º 22
0
 public function email_reg(array $args)
 {
     if (!litepublisher::$options->usersenabled || !litepublisher::$options->reguser) {
         return array('error' => tlocal::admin('users')->regdisabled);
     }
     try {
         return tadminreguser::i()->reguser($args['email'], $args['name']);
     } catch (Exception $e) {
         return array('error' => $e->getMessage());
     }
 }
Exemplo n.º 23
0
 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);
 }
Exemplo n.º 24
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'));
}
Exemplo n.º 25
0
 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;
 }
Exemplo n.º 26
0
 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);
 }
Exemplo n.º 27
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 tpollsInstall($self)
{
    $name = basename(dirname(__FILE__));
    $res = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'resource' . DIRECTORY_SEPARATOR;
    $dir = litepublisher::$paths->data . 'polls';
    @mkdir($dir, 0777);
    @chmod($dir, 0777);
    $manager = tdbmanager::i();
    $manager->createtable($self->table, file_get_contents($res . 'polls.sql'));
    $manager->createtable($self->users1, file_get_contents($res . 'users.sql'));
    $manager->createtable($self->users2, file_get_contents($res . 'users.sql'));
    $manager->createtable($self->votes, file_get_contents($res . 'votes.sql'));
    tlocalmerger::i()->addplugin($name);
    $lang = tlocal::admin('poll');
    tjsonserver::i()->addevent('polls_sendvote', get_class($self), 'polls_sendvote');
    $jsmerger = tjsmerger::i();
    $jsmerger->lock();
    $jsmerger->add('default', '/plugins/polls/polls.client.min.js');
    $jsmerger->addtext('default', 'poll', sprintf('var lang = $.extend(true, lang, {poll: %s});', json_encode(array('voted' => $lang->voted))));
    $jsmerger->unlock();
    tcssmerger::i()->addstyle(dirname(__FILE__) . '/stars.min.css');
    $lang = tlocal::admin('polls');
    litepublisher::$classes->add('tpolltypes', 'poll.types.php', $name);
    litepublisher::$classes->add('tpollsman', 'polls.man.php', $name);
    litepublisher::$classes->add('tpullpolls', 'pullpolls.class.php', $name);
    litepublisher::$classes->add('tadminpolltemplates', 'admin.poll.templates.php', $name);
    litepublisher::$classes->add('tadminpolltypes', 'admin.poll.types.php', $name);
    litepublisher::$classes->add('tadminpolloptions', 'admin.polloptions.class.php', $name);
    litepublisher::$classes->add('tadminpolls', 'admin.polls.class.php', $name);
    $adminmenus = tadminmenus::i();
    $adminmenus->lock();
    $parent = $adminmenus->createitem($adminmenus->url2id('/admin/plugins/'), 'polls', 'editor', 'tadminpolls');
    $adminmenus->items[$parent]['title'] = $lang->polls;
    $idmenu = $adminmenus->createitem($parent, 'templates', 'editor', 'tadminpolltemplates');
    $adminmenus->items[$idmenu]['title'] = $lang->templates;
    $idmenu = $adminmenus->createitem($parent, 'prototypes', 'editor', 'tadminpolltypes');
    $adminmenus->items[$idmenu]['title'] = $lang->prototypes;
    $idmenu = $adminmenus->createitem($parent, 'options', 'admin', 'tadminpolloptions');
    $adminmenus->items[$idmenu]['title'] = $lang->options;
    $adminmenus->unlock();
    //add sample templates
    $man = tpollsman::i();
    $man->lock();
    $man->fivestars = $self->add_tml('star', $lang->fivestars, $lang->poll, array(1, 2, 3, 4, 5));
    $man->pollpost = $man->fivestars;
    $btn = $self->add_tml('bigbutton', $lang->likepoll, $lang->poll, array($lang->like, $lang->unlike));
    if (litepublisher::$classes->exists('ttickets')) {
        $man->pollpost = $btn;
    }
    $man->unlock();
}
/**
* 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 ttemplatecommentsInstall($self)
{
    tlocal::usefile('install');
    $lang = tlocal::i('beforecommentsform');
    $login = '******' . $lang->log_in . '</a>';
    $self->data['logged'] = sprintf($lang->logged, '<?php echo litepublisher::$site->getuserlink(); ?>', ' <a class="logout" href="$site.url/admin/logout/{$site.q}backurl=">' . $lang->logout . '</a> ');
    $self->data['adminpanel'] = sprintf($lang->adminpanel, '<a class="admin-panel" href="$site.url/admin/comments/">' . $lang->controlpanel . '</a>');
    $self->data['reqlogin'] = sprintf($lang->reqlogin, $login);
    $self->data['guest'] = sprintf($lang->guest, $login);
    $self->data['regaccount'] = sprintf($lang->regaccount, '<a class="registration" href="$site.url/admin/reguser/{$site.q}backurl=">' . $lang->signup . '</a>');
    $self->data['comuser'] = sprintf($lang->comuser, $login);
    $self->data['loadhold'] = sprintf('<h4>%s</h4>', sprintf($lang->loadhold, '<a class="loadhold " href="$site.url/admin/comments/hold/">' . $lang->loadhold . '</a>'));
    $self->save();
}
/**
* 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 tusergroupsInstall($self)
{
    tlocal::usefile('install');
    $lang = tlocal::i('initgroups');
    $self->lock();
    $admin = $self->add('admin', $lang->admin, '/admin/');
    $editor = $self->add('editor', $lang->editor, '/admin/posts/');
    $author = $self->add('author', $lang->author, '/admin/posts/');
    $moder = $self->add('moderator', $lang->moderator, '/admin/comments/');
    $commentator = $self->add('commentator', $lang->commentator, '/admin/comments/');
    $self->items[$author]['parents'] = array($editor);
    $self->items[$commentator]['parents'] = array($moder, $author);
    $self->unlock();
}
Exemplo n.º 30
0
 public function getposteditor($post, $args)
 {
     $args->data['$lang.sourceurl'] = tlocal::admin()->get('usernews', 'sourceurl');
     if ($this->insertsource) {
         $args->sourceurl = isset($post->meta->sourceurl) ? $post->meta->sourceurl : '';
     }
     $form = tfilestorage::getfile(litepublisher::$paths->plugins . $this->dir . DIRECTORY_SEPARATOR . $this->editorfile);
     $args->raw = $post->rawcontent;
     $html = tadminhtml::i();
     $result = $post->id == 0 ? '' : $html->h2->formhead . $post->bookmark;
     $result .= $html->parsearg($form, $args);
     unset(ttheme::$vars['post']);
     return $html->fixquote($result);
 }