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 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;
 }
/**
* 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);
}
 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);
 }
/**
* 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));
}
Пример #6
0
 public function getdownloadcontent()
 {
     ttheme::$vars['lang'] = tlocal::i('downloaditem');
     ttheme::$vars['post'] = $this;
     $theme = $this->theme;
     return $theme->parse($theme->templates['custom']['downloaditem']);
 }
 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;
 }
 private function editpingback($id)
 {
     $pingbacks = tpingbacks::i();
     $args = targs::i();
     $args->add($pingbacks->getitem($id));
     $args->formtitle = tlocal::i()->edit;
     return $this->html->adminform('
 [text=title]
 [text=url]
 ', $args);
 }
Пример #9
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);
 }
Пример #10
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);
 }
/**
* 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 tlinkswidgetInstall($self)
{
    if (get_class($self) != 'tlinkswidget') {
        return;
    }
    tlocal::usefile('admin');
    $lang = tlocal::i('installation');
    $self->add($lang->homeurl, $lang->homedescription, $lang->homename);
    $urlmap = turlmap::i();
    $urlmap->add($self->redirlink, get_class($self), null, 'get');
    $robots = trobotstxt::i();
    $robots->AddDisallow($self->redirlink);
    $robots->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 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();
}
 public function processform()
 {
     //  return dumpvar($_POST);
     extract($_POST, EXTR_SKIP);
     $posts = tposts::i();
     $this->basename = 'posts';
     $html = $this->html;
     if ($id == 0) {
         $forum = tforum::i();
         if (!$forum->moderate || litepublisher::$options->ingroup('editor')) {
             $status = 'published';
         } else {
             $status = 'draft';
             // if too many drafts then reject
             $hold = $posts->db->getcount('status = \'draft\' and author = ' . litepublisher::$options->user);
             if ($hold >= 3) {
                 return $html->manydrafts;
             }
         }
         if (empty($title)) {
             $lang = tlocal::i('editor');
             return $html->h4->emptytitle;
         }
     }
     $post = tpost::i((int) $id);
     $post->title = $title;
     $post->categories = array((int) $category);
     if ($post->author == 0) {
         $post->author = litepublisher::$options->user;
     }
     if (isset($files)) {
         $files = trim($files);
         $post->files = $files == '' ? array() : explode(',', $files);
     }
     $post->content = tcontentfilter::remove_scripts($raw);
     if ($id == 0) {
         $post->status = $status;
         $post->comstatus = $forum->comstatus;
         $post->idview = $forum->idview;
         $post->idperm = $forum->idperm;
         $post->url = tlinkgenerator::i()->addurl($post, 'forum');
         $id = $posts->add($post);
         $_GET['id'] = $id;
         $_POST['id'] = $id;
         $this->idpost = $id;
     } else {
         $posts->edit($post);
     }
     return $html->h4->successedit;
 }
/**
* 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();
}
Пример #15
0
 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);
 }
/**
* 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 tcontactformInstall($self)
{
    $html = tadminhtml::i();
    $html->section = 'contactform';
    tlocal::usefile('install');
    $lang = tlocal::i('contactform');
    $self->title = $lang->title;
    $self->subject = $lang->subject;
    $self->success = $html->success();
    $self->errmesg = $html->errmesg();
    $self->content = $html->form();
    $self->order = 10;
    $menus = tmenus::i();
    $menus->add($self);
}
 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));
 }
Пример #18
0
 public function getcontent()
 {
     $plugin = tblackip::i();
     $lang = tplugins::getlangabout('black-ip');
     $args = new targs();
     $args->ip = implode("\n", $plugin->ip);
     $args->words = implode("\n", $plugin->words);
     $args->ipstatus = tadminhtml::array2combo(tlocal::i()->ini['commentstatus'], $plugin->ipstatus);
     $args->wordstatus = tadminhtml::array2combo(tlocal::i()->ini['commentstatus'], $plugin->wordstatus);
     $tabs = new tuitabs();
     $tabs->add($lang->wordtitle, '[combo=wordstatus] [editor=words]');
     $tabs->add('IP', '[combo=ipstatus] [editor=ip]');
     $args->formtitle = $lang->formtitle;
     $html = tadminhtml::i();
     return tuitabs::gethead() . $html->adminform($tabs->get(), $args);
 }
/**
* 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');
}
Пример #20
0
 public function getcontent()
 {
     $plugin = tbackup2dropbox::i();
     $html = tadminhtml::i();
     $args = targs::i();
     $about = tplugins::getabout(tplugins::getname(__FILE__));
     tlocal::admin()->ini['dropbox'] = $about;
     $lang = tlocal::i('dropbox');
     $args->add($plugin->data);
     $args->formtitle = $about['head'];
     $form = $html->adminform('[text=email] [password=password] [text=dir] [checkbox=uploadfiles] [checkbox=onlychanged]] [checkbox=useshell]', $args);
     $form .= '<form name="createnowform" action="" method="post" >
 <input type="hidden" name="createnow" value="1" />
 <p><input type="submit" name="create_now" value="' . $lang->createnow . '"/></p>
 </form>';
     return $form;
 }
Пример #21
0
 public function getcontent()
 {
     $forum = tforum::i();
     $html = tadminhtml::i();
     $args = new targs();
     $html->section = 'editor';
     $lang = tlocal::i('editor');
     $args->comstatus = tadminhtml::array2combo(array('closed' => $lang->closed, 'reg' => $lang->reg, 'guest' => $lang->guest, 'comuser' => $lang->comuser), $forum->comstatus);
     $lang = tlocal::admin('forum');
     $args->rootcat = tposteditor::getcombocategories(array(), $forum->rootcat);
     $args->moderate = $forum->moderate;
     $args->formtitle = $lang->options;
     return $html->adminform('
 [combo=rootcat]
 [combo=comstatus]
 [checkbox=moderate]
 ' . tadminviews::getcomboview($forum->idview) . tadminperms::getcombo(0), $args);
 }
Пример #22
0
 public static function getsidebarsform()
 {
     $idview = (int) tadminhtml::getparam('idview', 1);
     $view = tview::i($idview);
     $widgets = twidgets::i();
     $html = tadminhtml::i();
     $html->section = 'widgets';
     $args = targs::i();
     $args->idview = $idview;
     $lang = tlocal::i('views');
     $args->customsidebar = $idview == 1 ? '' : $view->theme->parse($html->getcheckbox('customsidebar', true));
     $args->adminurl = tadminhtml::getadminlink('/admin/views/widgets/', 'idwidget');
     $lang = tlocal::i('widgets');
     $result = $html->formhead($args);
     $count = count($view->sidebars);
     $sidebarnames = self::getsidebarnames($view);
     foreach ($view->sidebars as $i => $sidebar) {
         $orders = range(1, count($sidebar));
         foreach ($sidebar as $j => $_item) {
             $id = $_item['id'];
             $item = $widgets->getitem($id);
             $args->id = $id;
             $args->ajax = $_item['ajax'];
             $args->inline = $_item['ajax'] === 'inline';
             $args->disabled = $item['cache'] == 'cache' || $item['cache'] == 'nocache' ? '' : 'disabled="disabled"';
             $args->add($item);
             $args->sidebarcombo = tadminhtml::getcombobox("sidebar-{$id}", $sidebarnames, $i);
             $args->ordercombo = tadminhtml::getcombobox("order-{$id}", $orders, $j);
             $result .= $html->item($args);
         }
     }
     $result .= $html->formfooter();
     //all widgets
     $args->id_view = $idview;
     $result .= $html->addhead($args);
     foreach ($widgets->items as $id => $item) {
         $args->id = $id;
         $args->add($item);
         $args->checked = tsidebars::getpos($view->sidebars, $id) ? false : true;
         $result .= $html->additem($args);
     }
     $result .= $html->addfooter();
     return $html->fixquote($result);
 }
Пример #23
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 tfoafInstall($self)
{
    $merger = tlocalmerger::i();
    $merger->addplugin(tplugins::getname(__FILE__));
    $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'resource' . DIRECTORY_SEPARATOR;
    $lang = tlocal::i('foaf');
    if ($self->dbversion) {
        $manager = tdbmanager::i();
        $manager->createtable($self->table, file_get_contents($dir . 'foaf.sql'));
    }
    $actions = TXMLRPCAction::i();
    $actions->lock();
    $actions->add('invatefriend', get_class($self), 'Invate');
    $actions->add('rejectfriend', get_class($self), 'Reject');
    $actions->add('acceptfriend', get_class($self), 'Accept');
    $actions->unlock();
    $urlmap = litepublisher::$urlmap;
    $urlmap->lock();
    $urlmap->add('/foaf.xml', get_class($self), null);
    $name = tplugins::getname(__FILE__);
    $classes = litepublisher::$classes;
    $classes->lock();
    $classes->add('tadminfoaf', 'admin.foaf.class.php', $name);
    $classes->add('tfoafutil', 'foaf.util.class.php', $name);
    $classes->add('tprofile', 'profile.class.php', $name);
    $classes->add('tfriendswidget', 'widget.friends.class.php', $name);
    $classes->unlock();
    $admin = tadminmenus::i();
    $admin->lock();
    $id = $admin->createitem(0, 'foaf', 'admin', 'tadminfoaf');
    $admin->createitem($id, 'profile', 'admin', 'tadminfoaf');
    $admin->createitem($id, 'profiletemplate', 'admin', 'tadminfoaf');
    $admin->unlock();
    $urlmap->unlock();
    $template = ttemplate::i();
    $template->addtohead('	<link rel="meta" type="application/rdf+xml" title="FOAF" href="$site.url/foaf.xml" />');
    $about = tplugins::getabout($name);
    $meta = tmetawidget::i();
    $meta->lock();
    $meta->add('foaf', '/foaf.xml', $about['name']);
    $meta->add('profile', '/profile.htm', $lang->profile);
    $meta->unlock();
    ttheme::clearcache();
}
 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);
 }
/**
* 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 tpermsInstall($self)
{
    tlocal::usefile('install');
    $lang = tlocal::i('initgroups');
    $self->lock();
    $single = new tsinglepassword();
    $single->name = $lang->single;
    $self->add($single);
    $self->addclass($single);
    $pwd = new tpermpassword();
    $pwd->name = $lang->pwd;
    $self->add($pwd);
    $self->addclass($pwd);
    $groups = new tpermgroups();
    $groups->name = $lang->groups;
    $self->add($groups);
    $self->addclass($groups);
    $self->unlock();
}
 public function getcontent()
 {
     $result = '';
     $html = $this->html;
     $lang = tlocal::i('users');
     $args = new targs();
     $args->formtitle = $lang->useroptions;
     $pages = tuserpages::i();
     $args->createpage = $pages->createpage;
     $args->lite = $pages->lite;
     $linkgen = tlinkgenerator::i();
     $args->linkschema = $linkgen->data['user'];
     $groups = tusergroups::i();
     $args->defaulthome = $groups->defaulthome;
     return $html->adminform('[checkbox=createpage]
 [checkbox=lite]
 [text=linkschema]
 [text=defaulthome]' . $html->h4->defaults . tadmingroups::getgroups($groups->defaults), $args);
 }
/**
* 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 ttemplateInstall($self)
{
    $self->heads = '<link rel="alternate" type="application/rss+xml" title="$site.name RSS Feed" href="$site.url/rss.xml" />
  <link rel="pingback" href="$site.url/rpc.xml" />
  <link rel="EditURI" type="application/rsd+xml" title="RSD" href="$site.url/rsd.xml" />
  <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="$site.url/wlwmanifest.xml" />
  <link rel="shortcut icon" type="image/x-icon" href="$site.files/favicon.ico" />
  <link rel="apple-touch-icon" href="$site.files/apple-touch-icon.png" />
  <meta name="generator" content="Lite Publisher $site.version" /> <!-- leave this for stats -->
  <meta name="keywords" content="$template.keywords" />
  <meta name="description" content="$template.description" />
  <link rel="sitemap" href="$site.url/sitemap.htm" />';
    //footer
    $html = tadminhtml::i();
    $html->section = 'installation';
    $lang = tlocal::i('installation');
    ttheme::$vars['lang'] = $lang;
    $theme = ttheme::i();
    $self->footer = $theme->parse($html->footer);
}
Пример #28
0
 public function getcontent()
 {
     $merger = $this->getmerger();
     $tabs = new tuitabs();
     $html = $this->html;
     $lang = tlocal::i('views');
     $args = targs::i();
     $args->formtitle = $this->title;
     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());
     }
     return $html->adminform($tabs->get(), $args);
 }
 public function getcontent()
 {
     $result = '';
     $pages = tstaticpages::i();
     $this->basename = 'staticpages';
     $html = $this->html;
     $lang = tlocal::i('staticpages');
     $id = $this->idget();
     if (!$pages->itemexists($id)) {
         $id = 0;
     }
     $args = targs::i();
     $args->id = $id;
     $args->adminurl = $this->adminurl;
     if ($id > 0) {
         $item = $pages->getitem($id);
         $args->add($item);
         if (isset($_GET['action']) && $_GET['action'] == 'delete') {
             if ($this->confirmed) {
                 $pages->delete($id);
                 $result .= $html->h3->successdeleted;
             } else {
                 $result .= $html->confirmdelete($id, $this->adminurl, sprintf('%s %s?', $lang->confirmdelete, $item['title']));
             }
         } else {
             $result .= $this->editform($args);
         }
     } else {
         $args->title = '';
         $args->description = '';
         $args->keywords = '';
         $args->rawcontent = '';
         $result .= $this->editform($args);
     }
     $result .= $html->buildtable($pages->items, array(array('left', $lang->title, '<a href="$site.url$url">$title</a>'), array('center', $lang->edit, "<a href='{$this->adminurl}=\$id'>{$lang->edit}</a>"), array('center', $lang->delete, "<a href='{$this->adminurl}=\$id&action=delete'>{$lang->delete}</a>")));
     return $html->fixquote($result);
 }
Пример #30
0
 public function getcontent()
 {
     $result = '';
     $users = tusers::i();
     $groups = tusergroups::i();
     $html = $this->html;
     $lang = tlocal::i('users');
     $args = targs::i();
     $id = $this->idget();
     switch ($this->action) {
         case 'edit':
             if (!$users->itemexists($id)) {
                 $result .= $this->notfound();
             } else {
                 $statuses = array();
                 foreach (array('approved', 'hold', 'comuser') as $name) {
                     $statuses[$name] = $lang->{$name};
                 }
                 $item = $users->getitem($id);
                 $args->add($item);
                 $args->registered = tuserpages::i()->getvalue($id, 'registered');
                 $args->formtitle = $item['name'];
                 $args->status = tadminhtml::array2combo($statuses, $item['status']);
                 $tabs = new tuitabs();
                 $tabs->add($lang->login, '[text=email] [password=password]');
                 $tabs->add($lang->groups, '[combo=status]' . tadmingroups::getgroups($item['idgroups']));
                 $tabs->add('Cookie', '[text=cookie] [text=expired] [text=registered] [text=trust]');
                 $args->password = '';
                 $result .= $html->adminform($tabs->get(), $args);
             }
             break;
         case 'delete':
             $result .= $html->confirm_delete($users, $this->adminurl);
             break;
         default:
             $args->formtitle = $lang->newuser;
             $args->email = '';
             $args->action = 'add';
             $tabs = new tuitabs();
             $tabs->add($lang->login, '[text=email] [password=password] [text=name] [hidden=action]');
             $tabs->add($lang->groups, tadmingroups::getgroups(array()));
             $result .= $html->adminform($tabs->get(), $args);
     }
     $args->search = '';
     //table
     $perpage = 20;
     $count = $users->count;
     $from = $this->getfrom($perpage, $count);
     $where = '';
     $params = '';
     if (!empty($_GET['idgroup'])) {
         $idgroup = (int) tadminhtml::getparam('idgroup', 0);
         if ($groups->itemexists($idgroup)) {
             $grouptable = litepublisher::$db->prefix . $users->grouptable;
             $where = "{$users->thistable}.id in (select iduser from {$grouptable} where idgroup = {$idgroup})";
             $params = "idgroup={$idgroup}";
         }
     } elseif ($search = trim(tadminhtml::getparam('search', ''))) {
         $params = 'search=' . urlencode($search);
         $args->search = $search;
         $search = litepublisher::$db->escape($search);
         $search = strtr($search, array('%' => '\\%', '_' => '\\_'));
         $where = "email like '%{$search}%' or name like '%{$search}%' ";
         $count = $users->db->getcount($where);
         $from = $this->getfrom($perpage, $count);
     }
     $items = $users->select($where, " order by id desc limit {$from}, {$perpage}");
     if (!$items) {
         $items = array();
     }
     $args->adminurl = $this->adminurl;
     $args->formtitle = $lang->userstable;
     $args->table = $html->items2table($users, $items, array($html->get_table_checkbox('user'), array('left', $lang->edit, sprintf('<a href="%s=$id&action=edit">$name</a>', $this->adminurl)), $html->get_table_item('status'), array('left', $lang->comments, sprintf('<a href="%s">%s</a>', tadminhtml::getadminlink('/admin/comments/', 'iduser=$id'), $lang->comments)), array('left', $lang->page, sprintf('<a href="%s">%s</a>', tadminhtml::getadminlink('/admin/users/pages/', 'id=$id'), $lang->page)), $html->get_table_link('delete', $this->adminurl)));
     $result .= $html->deletetable($args);
     $result = $html->fixquote($result);
     $theme = ttheme::i();
     $result .= $theme->getpages($this->url, litepublisher::$urlmap->page, ceil($count / $perpage), $params);
     $form = new adminform($args);
     $form->method = 'get';
     $form->inline = true;
     $form->items = '[text=search]';
     $form->submit = 'find';
     $result .= $form->get();
     return $result;
 }