public function getcontent() { $result = ''; $files = tfiles::i(); $icons = ticons::i(); $html = $this->html; $lang = tlocal::admin('files'); $args = targs::i(); $a = array(); //добавить 0 для отсутствия иконки $a[0] = $lang->noicon; $allicons = self::getallicons(); foreach ($allicons as $id) { $args->id = $id; $item = $files->getitem($id); $args->add($item); $a[$id] = $html->comboitem($args); } $list = ''; foreach ($icons->items as $name => $id) { $args->name = $name; $title = $lang->{$name}; if ($title == '') { $title = tlocal::usefile('install')->{$name}; } $args->title = $title; $args->combo = $html->array2combo($a, $id); $list .= $html->iconitem($args); } $args->formtitle = $lang->iconheader; $result .= $html->adminform($list, $args); return $html->fixquote($result); }
/** * 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); }
/** * 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 request($arg) { $this->cache = false; tlocal::usefile('admin'); $this->formresult = ''; if (tguard::post()) { $this->formresult = $this->processform(); } }
private function sendmail() { $args = new targs(); $args->url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $args->ref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; tlocal::usefile('mail'); $lang = tlocal::i('notfound'); $theme = ttheme::i(); $subject = $theme->parsearg($lang->subject, $args); $body = $theme->parsearg($lang->body, $args); tmailer::sendtoadmin($subject, $body, true); }
private function notify(tticket $ticket) { ttheme::$vars['ticket'] = $ticket; $args = new targs(); $args->adminurl = litepublisher::$site->url . '/admin/tickets/editor/' . litepublisher::$site->q . 'id=' . $ticket->id; tlocal::usefile('mail'); $lang = tlocal::i('mailticket'); $lang->addsearch('ticket'); $theme = ttheme::i(); $subject = $theme->parsearg($lang->subject, $args); $body = $theme->parsearg($lang->body, $args); tmailer::sendtoadmin($subject, $body); }
public 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; }
/** * 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(); }
/** * 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(); }
public function request($id) { if ($s = tguard::checkattack()) { return $s; } if (!litepublisher::$options->user) { return litepublisher::$urlmap->redir('/admin/login/' . litepublisher::$site->q . 'backurl=' . urlencode(litepublisher::$urlmap->url)); } if (!litepublisher::$options->hasgroup('editor')) { $url = tusergroups::i()->gethome(litepublisher::$options->group); return litepublisher::$urlmap->redir($url); } tlocal::usefile('admin'); }
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); }
/** * 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(); }
private function sendmail($id) { $item = $this->getitem($id); $args = targs::i(); $args->add($item); $args->id = $id; $status = dbversion ? $item['status'] : ($item['approved'] ? 'approved' : 'hold'); $args->localstatus = tlocal::get('commentstatus', $status); $args->adminurl = litepublisher::$site->url . '/admin/comments/pingback/' . litepublisher::$site->q . "id={$id}&post={$item['post']}&action"; $post = tpost::i($item['post']); $args->posttitle = $post->title; $args->postlink = $post->link; tlocal::usefile('mail'); $lang = tlocal::i('mailcomments'); $theme = ttheme::i(); $subject = $theme->parsearg($lang->pingbacksubj, $args); $body = $theme->parsearg($lang->pingbackbody, $args); tmailer::sendmail(litepublisher::$site->name, litepublisher::$options->fromemail, 'admin', litepublisher::$options->email, $subject, $body); }
public function request($arg) { //$this->parseselectors(); if (isset($_GET['type'])) { $this->type = trim($_GET['type']) == 'left' ? 'left' : 'right'; } tlocal::usefile('themegenerator'); $lang = tlocal::i('themegenerator'); $this->colors = $lang->ini['themecolors']; parent::request($arg); if (isset($_POST['formtype']) && ($_POST['formtype'] == 'headerurl' || $_POST['formtype'] == 'logourl')) { return $this->formresult; } }
public function translit($s) { tlocal::usefile('translit'); return strtr($s, tlocal::$self->ini['translit']); }
public function processform() { $datadir = litepublisher::$paths->data . 'keywords' . DIRECTORY_SEPARATOR; if (isset($_POST['optionsform'])) { extract($_POST, EXTR_SKIP); $plugin = tkeywordsplugin::i(); $widget = tkeywordswidget::i(); $widgets = twidgets::i(); $idwidget = $widgets->find($widget); $widget->lock(); $widget->settitle($idwidget, $title); $widget->count = (int) $count; $widget->notify = isset($notify); $trace = isset($trace); if ($widget->trace != $trace) { if ($trace) { litepublisher::$urlmap->afterrequest = $plugin->parseref; } else { litepublisher::$urlmap->delete_event_class('afterrequest', get_class($plugin)); } } $widget->trace = $trace; $widget->unlock(); $plugin->blackwords = array(); $words = strtoarray($blackwords); if (litepublisher::$options->language != 'en') { tlocal::usefile('translit'); foreach ($words as $word) { $word = strtr($word, tlocal::$self->ini['translit']); $word = trim($word); if (empty($word)) { continue; } $plugin->blackwords[] = strtolower($word); } } $plugin->save(); return; } if (isset($_GET['filename'])) { $filename = str_replace('_', '.', $_GET['filename']); $content = trim($_POST['content']); if ($content == '') { @unlink($datadir . $filename); } else { file_put_contents($datadir . $filename, $content); } return; } foreach ($_POST as $filename => $value) { $filename = str_replace('_', '.', $filename); if (preg_match('/^\\d+?\\.\\d+?\\.php$/', $filename)) { unlink($datadir . $filename); } } }
public function send_mail($id) { $comments = tcomments::i(); $comment = $comments->getcomment($id); //ignore admin comments if ($comment->author == 1) { return; } ttheme::$vars['comment'] = $comment; $args = new targs(); $adminurl = litepublisher::$site->url . '/admin/comments/' . litepublisher::$site->q . "id={$id}"; $ref = md5(litepublisher::$secret . $adminurl . litepublisher::$options->solt); $adminurl .= "&ref={$ref}&action"; $args->adminurl = $adminurl; tlocal::usefile('mail'); $lang = tlocal::i('mailcomments'); $theme = ttheme::i(); $subject = $theme->parsearg($lang->subject, $args); $body = $theme->parsearg($lang->body, $args); return tmailer::sendtoadmin($subject, $body, false); }
private function sendmail($id, $event) { $item = $this->getitem($id); $args = targs::i(); $args->add($item); $lang = tlocal::i('foaf'); $event = 'mail' . $event; $args->event = $lang->{$event}; tlocal::usefile('mail'); $lang = tlocal::i('mailfoaf'); $theme = ttheme::i(); $subject = $theme->parsearg($lang->subject, $args); $body = $theme->parsearg($lang->body, $args); tmailer::sendtoadmin($subject, $body); }
public function restore($email) { $lang = tlocal::admin('password'); $email = strtolower(trim($email)); if (empty($email)) { return $this->error($lang->error); } $id = $this->getiduser($email); if (!$id) { return $this->error($lang->error); } $args = new targs(); tsession::start('password-restore-' . md5(litepublisher::$options->hash($email))); if (!isset($_SESSION['count'])) { $_SESSION['count'] = 1; } else { if ($_SESSION['count']++ > 3) { return $this->error($lang->outofcount); } } $_SESSION['email'] = $email; $password = md5uniq(); $_SESSION['password'] = $password; $_SESSION['confirm'] = md5rand(); $args->confirm = $_SESSION['confirm']; session_write_close(); $args->email = urlencode($email); if ($id == 1) { $name = litepublisher::$site->author; } else { $item = tusers::i()->getitem($id); $args->add($item); $name = $item['name']; } $args->password = $password; tlocal::usefile('mail'); $lang = tlocal::i('mailpassword'); $theme = ttheme::i(); $subject = $theme->parsearg($lang->subject, $args); $body = $theme->parsearg($lang->body, $args); tmailer::sendmail(litepublisher::$site->name, litepublisher::$options->fromemail, $name, $email, $subject, $body); return true; }
public function cronsendmail($id) { $comments = tcomments::i(); try { $item = $comments->getitem($id); } catch (Exception $e) { return; } $subscribers = $this->getitems($item['post']); if (!$subscribers || count($subscribers) == 0) { return; } $comment = $comments->getcomment($id); ttheme::$vars['comment'] = $comment; tlocal::usefile('mail'); $lang = tlocal::i('mailcomments'); $theme = ttheme::i(); $args = new targs(); $subject = $theme->parsearg($lang->subscribesubj, $args); $body = $theme->parsearg($lang->subscribebody, $args); $body .= "\n"; $adminurl = litepublisher::$site->url . '/admin/subscribers/'; $users = tusers::i(); $users->loaditems($subscribers); $list = array(); foreach ($subscribers as $uid) { $user = $users->getitem($uid); if ($user['status'] == 'hold') { continue; } $email = $user['email']; if (empty($email)) { continue; } if ($email == $comment->email) { continue; } if (in_array($email, $this->blacklist)) { continue; } $admin = $adminurl; if ('comuser' == $user['status']) { $admin .= litepublisher::$site->q . 'auth='; if (empty($user['cookie'])) { $user['cookie'] = md5uniq(); $users->setvalue($user['id'], 'cookie', $user['cookie']); } $admin .= rawurlencode($user['cookie']); } $list[] = array('fromname' => litepublisher::$site->name, 'fromemail' => $this->fromemail, 'toname' => $user['name'], 'toemail' => $email, 'subject' => $subject, 'body' => $body . $admin); } if (count($list)) { tmailer::sendlist($list); } }
public function check() { $result = ''; $lang = tlocal::i('foaf'); $foaf = tfoaf::i(); $items = $foaf->getapproved(0); foreach ($items as $id) { $item = $foaf->getitem($item); if (!$this->checkfriend($item['foafurl'])) { $result .= sprintf($lang->mailerror, $item['nick'], $item['blog'], $item['url']); $foaf->lock(); $foaf->setvalue($id, 'errors', ++$item['errors']); if ($item['errors'] > 3) { $foaf->setstatus($id, 'error'); $result .= sprintf($lang->manyerrors, $item['errors']); } $foaf->unlock(); } } if ($result != '') { $result = $lang->founderrors . $result; $result = str_replace('\\n', "\n", $result); $args = targs::i(); $args->errors = $result; tlocal::usefile('mail'); $lang = tlocal::i('mailfoaf'); $theme = ttheme::i(); $subject = $theme->parsearg($lang->errorsubj, $args); $body = $theme->parsearg($lang->errorbody, $args); tmailer::sendtoadmin($subject, $body); } }
public function loadinstall() { if (isset($this->ini['installation'])) { return; } tlocal::usefile('install'); if ($v = parse_ini_file(litepublisher::$paths->languages . 'install.ini', true)) { $this->ini = $v + $this->ini; } }
public function reguser($email, $name) { $email = strtolower(trim($email)); if (!tcontentfilter::ValidateEmail($email)) { return $this->error(tlocal::get('comment', 'invalidemail')); } if (substr_count($email, '.', 0, strpos($email, '@')) > 2) { return $this->error(tlocal::get('comment', 'invalidemail')); } $users = tusers::i(); if ($id = $users->emailexists($email)) { if ('comuser' != $users->getvalue($id, 'status')) { return $this->error(tlocal::i()->invalidregdata); } } tsession::start('reguser-' . md5(litepublisher::$options->hash($email))); $_SESSION['email'] = $email; $_SESSION['name'] = $name; $confirm = md5rand(); $_SESSION['confirm'] = $confirm; $password = md5uniq(); $_SESSION['password'] = $password; $_SESSION['backurl'] = isset($_GET['backurl']) ? $_GET['backurl'] : ''; session_write_close(); $args = new targs(); $args->name = $name; $args->email = $email; $args->confirm = $confirm; $args->password = $password; $args->confirmurl = litepublisher::$site->url . '/admin/reguser/' . litepublisher::$site->q . 'email=' . urlencode($email); tlocal::usefile('mail'); $lang = tlocal::i('mailusers'); $theme = ttheme::i(); $subject = $theme->parsearg($lang->subject, $args); $body = $theme->parsearg($lang->body, $args); tmailer::sendmail(litepublisher::$site->name, litepublisher::$options->fromemail, $name, $email, $subject, $body); return true; }
public function request($id) { error_reporting(E_ALL | E_NOTICE | E_STRICT | E_WARNING); ini_set('display_errors', 1); if (is_null($id)) { $id = $this->owner->class2id(get_class($this)); } $this->data['id'] = (int) $id; if ($id > 0) { $this->basename = $this->parent == 0 ? $this->name : $this->owner->items[$this->parent]['name']; } if ($s = self::auth($this->group)) { return $s; } tlocal::usefile('admin'); $this->arg = litepublisher::$urlmap->argtree; if ($s = $this->canrequest()) { return $s; } $this->doprocessform(); }
public function inblack($s) { if (litepublisher::$options->language != 'en') { tlocal::usefile('translit'); $s = strtr($s, tlocal::$self->ini['translit']); } $s = strtolower($s); foreach ($this->blackwords as $word) { if (false !== strpos($s, $word)) { return true; } } return false; }