public function import($s) { require_once litepublisher::$paths->lib . 'domrss.class.php'; $a = xml2array($s); $urlmap = turlmap::i(); $urlmap->lock(); $cats = tcategories::i(); $cats->lock(); $tags = ttags::i(); $tags->lock(); $posts = tposts::i(); $posts->lock(); foreach ($a['rss']['channel'][0]['item'] as $item) { if ($post = $this->add($item)) { $posts->add($post); if (isset($item['wp:comment']) && is_array($item['wp:comment'])) { $this->importcomments($item['wp:comment'], $post->id); } if (!tfilestorage::$disabled) { $post->free(); } } } $posts->unlock(); $tags->unlock(); $cats->unlock(); $urlmap->unlock(); }
function installClasses() { litepublisher::$urlmap = turlmap::i(); litepublisher::$urlmap->lock(); $posts = tposts::i(); $posts->lock(); $xmlrpc = TXMLRPC::i(); $xmlrpc->lock(); ttheme::$defaultargs = array(); $theme = ttheme::getinstance('default'); // $html = tadminhtml::i(); // $html->loadinstall(); foreach (litepublisher::$classes->items as $class => $item) { //echo "$class<br>\n"; if (preg_match('/^(titem|titem_storage|titemspostsowner|tcomment|IXR_Client|IXR_Server|tautoform|tchildpost|tchildposts|tlitememcache)$/', $class)) { continue; } $obj = getinstance($class); if (method_exists($obj, 'install')) { $obj->install(); } } $xmlrpc->unlock(); $posts->unlock(); litepublisher::$urlmap->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 tcommontagsInstall($self) { if ('tcommontags' == get_class($self)) { return; } $posts = tposts::i(); $posts->lock(); $posts->added = $self->postedited; $posts->edited = $self->postedited; $posts->deleted = $self->postdeleted; $posts->unlock(); $urlmap = turlmap::i(); $urlmap->add("/{$self->PermalinkIndex}/", get_class($self), 0); if (dbversion) { $manager = tdbmanager::i(); $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR; $manager->createtable($self->table, file_get_contents($dir . 'tags.sql')); $manager->createtable($self->itemsposts->table, file_get_contents($dir . 'items.posts.sql')); $manager->createtable($self->contents->table, file_get_contents($dir . 'tags.content.sql')); } else { $dir = litepublisher::$paths->data . $self->basename; @mkdir($dir, 0777); @chmod($dir, 0777); } }
public function install() { if ($this->services == '') { $this->services = file_get_contents(litepublisher::$paths->libinclude . 'pingservices.txt'); } $posts = tposts::i(); $posts->singlecron = $this->pingpost; }
/** * 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 tarchivesInstall($self) { $posts = tposts::i(); $posts->changed = $self->postschanged; if (!dbversion) { $self->postschanged(); } }
/** * 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 tpingbacksInstall($self) { $manager = tdbmanager::i(); $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR; $manager->CreateTable($self->table, file_get_contents($dir . 'comments.pingbacks.sql')); $posts = tposts::i(); $posts->deleted = $self->postdeleted; }
/** * 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 tpostcontentpluginInstall($self) { $posts = tposts::i(); $posts->lock(); $posts->beforecontent = $self->beforecontent; $posts->aftercontent = $self->aftercontent; $posts->unlock(); }
function tpollsmanUninstall($self) { tcontentfilter::i()->unbind($self); tcron::i()->deleteclass(get_class($self)); $posts = tposts::i(); $posts->syncmeta = false; $posts->unbind($self); litepublisher::$db->table = 'postsmeta'; litepublisher::$db->delete("name = 'poll'"); }
function texternallinksUninstall($self) { $filter = tcontentfilter::i(); $filter->unbind($self); $cron = tcron::i(); $cron->deleteclass(get_class($self)); turlmap::unsub($self); if (dbversion) { $manager = tdbmanager::i(); $manager->deletetable($self->table); } tposts::i()->addrevision(); }
/** * 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 tfilesInstall($self) { $manager = tdbmanager::i(); $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR; $manager->createtable($self->table, file_get_contents($dir . 'files.sql')); $manager->createtable($self->itemsposts->table, file_get_contents($dir . 'items.posts.sql')); $manager->createtable('imghashes', file_get_contents($dir . 'imghashes.sql')); $posts = tposts::i(); $posts->lock(); $posts->added = $self->postedited; $posts->edited = $self->postedited; $posts->deleted = $self->itemsposts->deletepost; $posts->unlock(); }
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 twikiwordsInstall($self) { if ($self->dbversion) { $manager = tdbmanager::i(); $manager->createtable($self->table, " `id` int(10) unsigned NOT NULL auto_increment,\n `word` text NOT NULL,\n PRIMARY KEY (`id`)"); $manager->createtable($self->itemsposts->table, file_get_contents(litepublisher::$paths->lib . 'install' . DIRECTORY_SEPARATOR . 'items.posts.sql')); } $filter = tcontentfilter::i(); $filter->beforecontent = $self->beforefilter; $posts = tposts::i(); $posts->deleted = $self->postdeleted; litepublisher::$classes->classes['wikiwords'] = get_class($self); litepublisher::$classes->save(); }
function tsamepostsUninstall($self) { tposts::unsub($self); twidgets::i()->deleteclass(get_class($self)); if (dbversion) { $manager = tdbmanager::i(); $manager->deletetable($self->table); } else { $posts = tposts::i(); $dir = litepublisher::$paths->data . 'posts' . DIRECTORY_SEPARATOR; foreach ($posts->items as $id => $item) { @unlink($dir . $id . DIRECTORY_SEPARATOR . 'same.php'); } } }
public function getlist() { $context = ttemplate::i()->context; if ($context instanceof tcommontags) { $list = $context->getidposts($context->id); } elseif (isset($context) && isset($context->idposts)) { $list = $context->idposts; } else { return false; } if (count($list) > 0) { tposts::i()->loaditems($list); return array_slice($list, 0, 3); } return false; }
/** * 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 tcodedocpluginInstall($self) { if (!dbversion) { die("Ticket system only for database version"); } $name = basename(dirname(__FILE__)); $language = litepublisher::$options->language; $about = tplugins::getabout($name); litepublisher::$classes->Add('tcodedocfilter', 'codedoc.filter.class.php', $name); litepublisher::$classes->Add('tcodedocmenu', 'codedoc.menu.class.php', basename(dirname(__FILE__))); $menu = tcodedocmenu::i(); $menu->url = '/doc/'; $menu->title = $about['menutitle']; $menus = tmenus::i(); $menus->add($menu); $merger = tlocalmerger::i(); $merger->lock(); $merger->add('codedoc', "plugins/{$name}/resource/{$language}.ini"); $merger->add('codedoc', "plugins/{$name}/resource/html.ini"); $merger->unlock(); $manager = tdbmanager::i(); $manager->CreateTable('codedoc', ' id int unsigned NOT NULL default 0, class varchar(32) NOT NULL, parentclass varchar(32) NOT NULL, methods text not null, props text not null, events text not null, KEY id (id), KEY parentclass (parentclass) '); $filter = tcontentfilter::i(); $filter->lock(); $filter->beforecontent = $self->filterpost; $filter->seteventorder('beforecontent', $self, 0); $plugins = tplugins::i(); if (!isset($plugins->items['wikiwords'])) { $plugins->add('wikiwords'); } $filter->beforecontent = $self->afterfilter; $filter->unlock(); $linkgen = tlinkgenerator::i(); $linkgen->data['codedoc'] = '/doc/[title].htm'; $linkgen->save(); tposts::i()->deleted = $self->postdeleted; }
/** * 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'); }
public function setenabled($value) { if ($this->enabled != $value) { $this->data['enabled'] = $value; $this->save(); $comments = tcomments::i(); if ($value) { tposts::i()->added = $this->postadded; $comments->lock(); $comments->added = $this->sendmail; $comments->onapproved = $this->sendmail; $comments->unlock(); } else { $comments->unbind($this); tposts::i()->delete_event_class('added', get_class($this)); } } }
public function getcontent() { $post = litepublisher::$urlmap->context; if (!$post instanceof tpost) { return ''; } if (count($post->categories) == 0) { return ''; } $idcat = $post->categories[0]; if ($idcat == 0) { return ''; } $table = litepublisher::$db->prefix . 'categoriesitems'; $order = $this->invertorder ? 'asc' : 'desc'; $posts = tposts::i(); $result = $posts->getlinks("{$posts->thistable}.id in\n (select {$table}.post from {$table} where {$table}.item = {$idcat})\n and {$posts->thistable}.id != {$post->id}\n order by {$posts->thistable}.posted {$order} limit {$this->maxcount}", $this->tml); return str_replace('$items', $result, $this->tmlitems); }
public function getcontent() { $result = ''; $html = $this->html; $lang = tlocal::admin(); $args = new targs(); if ($this->newreg) { $result .= $html->h4->newreg; } $subscribers = tsubscribers::i(); $items = $subscribers->getposts($this->iduser); if (count($items) == 0) { return $html->h4->nosubscribtions; } tposts::i()->loaditems($items); $args->default_subscribe = tuseroptions::i()->getvalue($this->iduser, 'subscribe') == 'enabled'; $args->formtitle = tusers::i()->getvalue($this->iduser, 'email') . ' ' . $lang->formhead; $result .= $html->adminform('[checkbox=default_subscribe]' . ($table = $html->tableposts($items, array(array('left', $lang->post, '<a href="$site.url$post.url" title="$post.title">$post.title</a>')))), $args); return $html->fixquote($result); }
public function setadddtopost($v) { $man = tpollsman::i(); if ($v == $man->addtopost) { return; } $man->data['addtopost'] = $v; $man->save(); $posts = tposts::i(); if ($v) { $posts->added = $man->postadded; $posts->deleted = $man->postdeleted; $posts->aftercontent = $man->afterpost; $posts->syncmeta = true; } else { $posts->delete_event_class('added', get_class($man)); $posts->delete_event_class('deleted', get_class($man)); $posts->delete_event_class('aftercontent', get_class($man)); } }
public function getcontent($id, $sidebar) { $post = $this->getcontext('tpost'); $posts = tposts::i(); if (dbversion) { $items = $posts->finditems("status = 'published' and posted < '{$post->sqldate}' ", ' order by posted desc limit ' . $this->maxcount); } else { $arch = array_keys($posts->archives); $i = array_search($post->id, $arch); if (!is_int($i)) { return ''; } $items = array_slice($arch, $i + 1, $this->maxcount); } if (count($items) == 0) { return ''; } $theme = ttheme::i(); return $theme->getpostswidgetcontent($items, $sidebar, ''); }
public function editpost(tpost $post) { extract($_POST, EXTR_SKIP); $posts = tposts::i(); $html = tadminhtml::i(); if ($this->checkspam && $id == 0) { $post->status = 'published'; $hold = $posts->db->getcount('status = \'draft\' and author = ' . litepublisher::$options->user); $approved = $posts->db->getcount('status = \'published\' and author = ' . litepublisher::$options->user); if ($approved < 3) { if ($hold - $approved >= 2) { return $this->norights; } $post->status = 'draft'; } } if ($this->insertsource) { $post->meta->sourceurl = $sourceurl; } $post->title = $title; $post->categories = tposteditor::processcategories(); if (litepublisher::$options->user > 1) { $post->author = litepublisher::$options->user; } if (isset($files)) { $files = trim($files); $post->files = $files == '' ? array() : explode(',', $files); } $post->content = tcontentfilter::remove_scripts($raw); if ($this->insertsource) { $post->filtered = sprintf($this->sourcetml, $post->meta->sourceurl) . $post->filtered; } if ($id == 0) { $id = $posts->add($post); $_GET['id'] = $id; $_POST['id'] = $id; } else { $posts->edit($post); } return $html->h4->successedit; }
public function getcontent() { $result = parent::getcontent(); $db = litepublisher::$db; $items = $db->res2items($db->query("select id, class from {$db->prefix}codedoc order by class")); if (count($items) == 0) { return $result; } tposts::i()->loaditems(array_keys($items)); $theme = tview::getview($this)->theme; $args = new targs(); $result .= '<ul class="doc_classes">'; $tml = '<li id="doc-class-$id"><a href="#">$class</a> $post.excerptcontent</li>'; foreach ($items as $id => $item) { $args->add($item); ttheme::$vars['post'] = tpost::i($id); $result .= $theme->parsearg($tml, $args); } $result .= '</ul>'; return $result; }
public function getmidleposts() { if (is_array($this->midleposts)) { return $this->midleposts; } $posts = tposts::i(); $p = $posts->thistable; $ci = litepublisher::$db->prefix . 'categoriesitems'; $this->midleposts = $posts->db->res2id($posts->db->query("select {$p}.id as id, {$ci}.post as post from {$p}, {$ci}\n where {$ci}.item = {$this->midlecat} and {$p}.id = {$ci}.post and {$p}.status = 'published'\n order by {$p}.posted desc limit " . litepublisher::$options->perpage)); if (count($this->midleposts)) { $posts->loaditems($this->midleposts); } return $this->midleposts; }
public function getposts() { return tposts::i(); }
public function processform() { //dumpvar($_POST); $result = ''; switch ($this->name) { case 'views': $views = tviews::i(); $idview = (int) tadminhtml::getparam('idview', 0); if (!$idview || !$views->itemexists($idview)) { return ''; } if ($this->action == 'delete') { if ($idview > 1) { $views->delete($idview); } return ''; } $view = tview::i($idview); if ($idview > 1) { $view->customsidebar = isset($_POST['customsidebar']); $view->disableajax = isset($_POST['disableajax']); } $view->name = trim($_POST['name']); $view->themename = trim($_POST['theme_idview']); $view->menuclass = $_POST['menu']; $view->hovermenu = isset($_POST['hovermenu']); $this->set_custom($idview); if ($idview == 1 || $view->customsidebar) { $widgets = twidgets::i(); foreach (range(0, 2) as $index) { $view->sidebars[$index] = array(); $idwidgets = explode(',', trim($_POST["sidebar{$index}"])); foreach ($idwidgets as $idwidget) { $idwidget = (int) trim($idwidget); if (!$widgets->itemexists($idwidget)) { continue; } $view->sidebars[$index][] = array('id' => $idwidget, 'ajax' => isset($_POST["inline{$idwidget}"]) ? 'inline' : isset($_POST["ajax{$idwidget}"])); } } } $view->save(); break; case 'addview': $name = trim($_POST['name']); if ($name != '') { $views = tviews::i(); $id = $views->add($name); } break; case 'spec': foreach (self::getspecclasses() as $classname) { $obj = getinstance($classname); $obj->lock(); $obj->setidview($_POST["idview-{$classname}"]); if (isset($obj->data['keywords'])) { $obj->keywords = $_POST["keywords-{$classname}"]; } if (isset($obj->data['description '])) { $obj->description = $_POST["description-{$classname}"]; } if (isset($obj->data['head'])) { $obj->head = $_POST["head-{$classname}"]; } $obj->unlock(); } break; case 'group': switch ($_POST['action']) { case 'posts': $posts = tposts::i(); $idview = (int) $_POST['postview']; if (dbversion) { $posts->db->update("idview = '{$idview}'", 'id > 0'); } else { foreach ($posts->items as $id => $item) { $post = tpost::i($id); $post->idview = $idview; $post->save(); $post->free(); } } break; case 'menus': $idview = (int) $_POST['menuview']; $menus = tmenus::i(); foreach ($menus->items as $id => $item) { $menu = tmenu::i($id); $menu->idview = $idview; $menu->save(); } break; case 'themes': $themename = $_POST['themeview']; $views = tviews::i(); $views->lock(); foreach ($views->items as $id => $item) { $view = tview::i($id); $view->themename = $themename; $view->save(); } $views->unlock(); break; } break; case 'defaults': $views = tviews::i(); foreach ($views->defaults as $name => $id) { $views->defaults[$name] = (int) $_POST[$name]; } $views->save(); break; case 'headers': $template = ttemplate::i(); $template->heads = $_POST['heads']; $template->save(); $adminmenus = tadminmenus::i(); $adminmenus->heads = $_POST['adminheads']; $adminmenus->save(); $ajax = tajaxposteditor::i(); $ajax->lock(); $ajax->ajaxvisual = isset($_POST['ajaxvisual']); $ajax->visual = trim($_POST['visual']); $ajax->unlock(); litepublisher::$options->show_file_perm = isset($_POST['show_file_perm']); break; case 'admin': return $this->adminoptionsform->processform(); } ttheme::clearcache(); }
public function getposts(array $items, $lite) { if (count($items) == 0) { return ''; } if (dbversion) { tposts::i()->loaditems($items); } $result = ''; self::$vars['lang'] = tlocal::i('default'); //$tml = $lite ? $this->templates['content.excerpts.lite.excerpt'] : $this->templates['content.excerpts.excerpt']; foreach ($items as $id) { $post = tpost::i($id); $result .= $post->getcontexcerpt($lite); // has $author.* tags in tml if (isset(self::$vars['author'])) { unset(self::$vars['author']); } } $tml = $lite ? $this->templates['content.excerpts.lite'] : $this->templates['content.excerpts']; if ($tml != '') { $result = str_replace('$excerpt', $result, $this->parse($tml)); } unset(self::$vars['post']); return $result; }
function clearposts() { $posts = tposts::i(); $posts->lock(); if (dbversion) { $items = $posts->select(litepublisher::$db->prefix . 'posts.id > 0', ''); foreach ($items as $id) { $posts->delete($id); } } else { foreach ($posts->items as $id => $item) { $posts->delete($id); } } $posts->unlock(); }
/** * Lite Publisher * Copyright (C) 2010, 2012 Vladimir Yushko http://litepublisher.com/ * Dual licensed under the MIT (mit.txt) * and GPL (gpl.txt) licenses. **/ function tlivejournalposterInstall($self) { $posts = tposts::i(); $posts->singlecron = $self->sendpost; }
function tsmilesUninstall($self) { tcontentfilter::i()->unbind($self); tposts::i()->addrevision(); }