/** * 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 tusernewsInstall($self) { $name = basename(dirname(__FILE__)); $self->data['dir'] = $name; $self->save(); tlocalmerger::i()->addplugin($name); $filter = tcontentfilter::i(); $filter->phpcode = true; $filter->save(); litepublisher::$options->parsepost = false; litepublisher::$options->reguser = true; $adminoptions = tadminoptions::i(); $adminoptions->usersenabled = true; $groups = tusergroups::i(); $groups->defaults = array($groups->getidgroup('author')); $groups->save(); $rights = tauthor_rights::i(); $rights->lock(); $rights->gethead = $self->gethead; $rights->getposteditor = $self->getposteditor; $rights->editpost = $self->editpost; $rights->changeposts = $self->changeposts; $rights->canupload = $self->canupload; $rights->candeletefile = $self->candeletefile; $rights->unlock(); }
public function add($url, $title) { $filter = tcontentfilter::i(); $title = $filter->gettitle($title); $id = $this->doadd($url, $title); $this->added($id); $this->sendmail($id); return $id; }
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'"); }
public function edit($id, $title, $description, $keywords, $content) { if (!$this->itemexists($id)) { return false; } $filter = tcontentfilter::i(); $item = $this->items[$id]; $this->items[$id] = array('idurl' => $item['idurl'], 'url' => $item['url'], 'title' => $title, 'filtered' => $filter->filter($content), 'rawcontent' => $content, 'description' => tcontentfilter::escape($description), 'keywords' => tcontentfilter::escape($keywords), 'idview' => $item['idview']); $this->save(); litepublisher::$urlmap->clearcache(); }
function ExportPages() { global $wpdb; $menus = tmenus::i(); $menus->lock(); litepublisher::$urlmap->lock(); $r = $wpdb->get_results("SELECT max(ID) as autoid FROM {$wpdb->posts} WHERE post_type = 'page'"); $autoid = (int) $r[0]->autoid; $menus->autoid = $autoid; $filter = tcontentfilter::i(); $list = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE post_type = 'page'"); foreach ($list as $item) { $id = (int) $item->ID; if ($id == 1) { $id = ++$menus->autoid; } if ($id == $menus->idhome) { $id = ++$menus->autoid; } $menu = new tmenu(); $menu->data['id'] = 0; $menu->data['title'] = $item->post_title; $menu->data['rawcontent'] = $item->post_content; $menu->data['content'] = $filter->filter($item->post_content); $menu->data['status'] = 'published'; $menu->data['order'] = (int) $item->menu_order; $menu->data['parent'] = (int) $item->post_parent; $url = @get_permalink($item->ID); $UrlArray = parse_url($url); $url = $UrlArray['path']; if (!empty($UrlArray['query'])) { $url .= '?' . $UrlArray['query']; } $menu->data['url'] = $url; //$menu->data['idurl'] = litepublisher::$urlmap->add($url, get_class($menu), $id); $menus->items[$id] = array('id' => $id, 'class' => get_class($menu)); //move props foreach (tmenu::$ownerprops as $prop) { $menus->items[$id][$prop] = $menu->{$prop}; if (array_key_exists($prop, $menu->data)) { unset($menu->data[$prop]); } } $menu->id = $id; $menu->idurl = litepublisher::$urlmap->add($url, get_class($menu), $id); $menu->save(); echo "menu {$menu->id}\n"; flush(); } $menus->sort(); $menus->unlock(); litepublisher::$urlmap->unlock(); }
function twikiwordsUninstall($self) { unset(litepublisher::$classes->classes['wikiword']); litepublisher::$classes->save(); $filter = tcontentfilter::i(); $filter->unbind($self); tposts::unsub($self); if ($self->dbversion) { $manager = tdbmanager::i(); $manager->deletetable($self->table); $manager->deletetable($self->itemsposts->table); } }
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(); }
public function updatefiltered() { $result = $this->getticketcontent(); $filter = tcontentfilter::i(); $filter->filterpost($this, $this->rawcontent); $result .= $this->filtered; if (!empty($this->childdata['code'])) { $lang = tlocal::i('ticket'); $result .= sprintf('<h2>%s</h2>', $lang->code); $result .= highlight_string($this->code, true); } $this->filtered = $result; }
function tcodedocpluginUninstall($self) { //die("Warning! You can lost all tickets!"); tposts::unsub($self); $menus = tmenus::i(); $menus->deleteurl('/doc/'); litepublisher::$classes->delete('tcodedocmenu'); litepublisher::$classes->delete('tcodedocfilter'); $filter = tcontentfilter::i(); $filter->unbind($self); $merger = tlocalmerger::i(); $merger->delete('codedoc'); $manager = tdbmanager::i(); $manager->deletetable('codedoc'); }
public function processform() { extract($_POST, EXTR_SKIP); if (!($id = $this->getiduser())) { return; } $item = array('rawcontent' => trim($rawcontent), 'content' => tcontentfilter::i()->filter($rawcontent)); if ('admin' == litepublisher::$options->group) { $item['idview'] = (int) $idview; $item['url'] = $url; $item['head'] = $head; $item['keywords'] = $keywords; $item['description'] = $description; } $pages = tuserpages::i(); $pages->edit($id, $item); tusers::i()->edit($id, array('name' => $name, 'website' => tcontentfilter::clean_website($website))); $useroptions = tuseroptions::i(); $useroptions->setvalue($id, 'subscribe', isset($subscribe) ? 'enabled' : 'disabled'); $useroptions->setvalue($id, 'authorpost_subscribe', isset($authorpost_subscribe) ? 'enabled' : 'disabled'); }
public function convert($content) { $result = ''; $content = str_replace(array("\r\n", "\r"), "\n", trim($content)); $lines = explode("\n", $content); $q = array(); $a = array(); $filter = tcontentfilter::i(); foreach ($lines as $s) { $s = trim($s); if (strbegin($s, 'q:') || strbegin($s, 'Q:')) { $q[] = trim(substr($s, 2)); } elseif (strbegin($s, 'a:') || strbegin($s, 'A:')) { $a[] = trim(substr($s, 2)); } elseif ($s != '') { $result .= $this->createlist($q, $a); $q = array(); $a = array(); $result .= $filter->simplefilter($s); } } $result .= $this->createlist($q, $a); return $result; }
public function setcontent($id, $content) { $item = $this->getitem($id); $filter = tcontentfilter::i(); $item['rawcontent'] = $content; $item['content'] = $filter->filterpages($content); $item['description'] = tcontentfilter::getexcerpt($content, 80); $this->setitem($id, $item); }
public function uninstall() { $filter = tcontentfilter::i(); $filter->unbind($this); }
define('litepublisher_mode', 'xmlrpc'); include 'index.php'; set_time_limit(600); echo "<pre>\n"; $posts = tposts::i(); echo "{$posts->revision}\n"; $db = litepublisher::$db; $r = $db->res2id($db->query("select max(revision) from {$db->posts}")); $revision = (int) $r[0]; if ($posts->revision <= $revision) { $posts->revision = $revision; } $posts->addrevision(); echo "{$posts->revision}\n"; litepublisher::$options->savemodified(); $filter = tcontentfilter::i(); $from = 0; while ($a = $db->res2assoc($db->query("select id, rawcontent from {$db->rawcomments} where id > {$from} limit 600"))) { $db->table = 'comments'; foreach ($a as $item) { $s = $filter->filtercomment($item['rawcontent']); $db->setvalue($item['id'], 'content', $s); $from = max($from, $item['id']); } unset($a); echo "{$from}\n"; flush(); } echo "{$from}\n"; echo round(memory_get_usage() / 1024 / 1024, 2), "MB\n"; echo round(memory_get_peak_usage(true) / 1024 / 1024, 2), "MB\n";
function tsmilesUninstall($self) { tcontentfilter::i()->unbind($self); tposts::i()->addrevision(); }
public function uninstall() { tcontentfilter::i()->unbind($this); }
public function processform() { if (empty($_POST['title'])) { return ''; } extract($_POST, EXTR_SKIP); $istags = $this->name == 'tags' || $this->name == 'addtag'; $tags = $istags ? litepublisher::$classes->tags : litepublisher::$classes->categories; $tags->lock(); $id = $this->idget(); if ($id == 0) { $id = $tags->add((int) $parent, $title); if (isset($order)) { $tags->setvalue($id, 'customorder', (int) $order); } if (isset($url)) { $tags->edit($id, $title, $url); } if (isset($idview)) { $item = $tags->getitem($id); $item = $this->set_view($item); $tags->items[$id] = $item; $item['id'] = $id; unset($item['url']); if ($tags->dbversion) { $tags->db->updateassoc($item); } } } else { $item = $tags->getitem($id); $item['title'] = $title; if (isset($parent)) { $item['parent'] = (int) $parent; } if (isset($order)) { $item['customorder'] = (int) $order; } if (isset($idview)) { $item = $this->set_view($item); } $tags->items[$id] = $item; if (!empty($url) && $url != $item['url']) { $tags->edit($id, $title, $url); } $tags->items[$id] = $item; if (dbversion) { unset($item['url']); $tags->db->updateassoc($item); } } if (isset($raw) || isset($keywords)) { $item = $tags->contents->getitem($id); if (isset($raw)) { $filter = tcontentfilter::i(); $item['rawcontent'] = $raw; $item['content'] = $filter->filterpages($raw); } if (isset($keywords)) { $item['keywords'] = $keywords; $item['description'] = $description; $item['head'] = $head; } $tags->contents->setitem($id, $item); } $tags->unlock(); $_GET['id'] = $_POST['id'] = $id; return sprintf($this->html->h2->success, $title); }
public function edit($id, array $values) { if (!$this->itemexists($id)) { return false; } $item = $this->getitem($id); $url = isset($values['url']) ? $values['url'] : ''; unset($values['url'], $values['idurl'], $values['id']); foreach ($item as $k => $v) { if (isset($values[$k])) { $item[$k] = $values[$k]; } } $item['id'] = $id; $item['content'] = tcontentfilter::i()->filter($item['rawcontent']); if ($url && $url != $item['url']) { if ($item['idurl'] == 0) { $item['idurl'] = litepublisher::$urlmap->add($url, get_class($this), $id); } else { litepublisher::$urlmap->addredir($item['url'], $url); litepublisher::$urlmap->setidurl($item['idurl'], $url); } $item['url'] = $url; } $this->items[$id] = $item; unset($item['url']); $this->db->updateassoc($item); }
public static function refilter() { $db = litepublisher::$db; $filter = tcontentfilter::i(); $from = 0; while ($a = $db->res2assoc($db->query("select id, rawcontent from {$db->rawcomments} where id > {$from} limit 500"))) { $db->table = 'comments'; foreach ($a as $item) { $s = $filter->filtercomment($item['rawcontent']); $db->setvalue($item['id'], 'content', $s); $from = max($from, $item['id']); } unset($a); } }
public function updatefiltered() { tcontentfilter::i()->filterpost($this, $this->rawcontent); }
public function processform() { if ($form = $this->getautoform($this->name)) { return $form->processform(); } extract($_POST, EXTR_SKIP); $options = litepublisher::$options; switch ($this->name) { case 'options': litepublisher::$urlmap->redirdom = isset($redirdom); $site = litepublisher::$site; $site->fixedurl = isset($fixedurl); $site->url = $url; $site->name = $name; $site->description = $description; $site->keywords = $keywords; $site->author = $author; $this->getdb('users')->setvalue(1, 'name', $author); ttemplate::i()->footer = $footer; break; case 'home': $home = thomepage::i(); $home->lock(); $home->image = $image; $home->parsetags = isset($parsetags); $home->showmidle = isset($showmidle); $home->midlecat = (int) $midlecat; $home->showposts = isset($showposts); $home->invertorder = isset($invertorder); $home->includecats = tadminhtml::check2array('category-'); $home->excludecats = tadminhtml::check2array('exclude_category-'); $home->showpagenator = isset($showpagenator); $home->postschanged(); $home->unlock(); $menus = tmenus::i(); $menus->home = isset($homemenu); $menus->save(); break; case 'mail': if (!empty($adminemail)) { $options->email = $adminemail; $this->getdb('users')->setvalue(1, 'email', $adminemail); } if (!empty($fromemail)) { $options->fromemail = $fromemail; } $options->mailer = empty($mailer) ? '' : 'smtp'; if (!empty($subscribeemail)) { $subscribe = tsubscribers::i(); $subscribe->fromemail = $subscribeemail; $subscribe->save(); $options->fromemail = $subscribeemail; } $mailer = TSMTPMailer::i(); $mailer->lock(); $mailer->host = $host; $mailer->login = $smtplogin; $mailer->password = $password; $mailer->port = (int) $port; $mailer->unlock(); break; case 'view': $options->icondisabled = isset($icondisabled); if (!empty($perpage)) { $options->perpage = (int) $perpage; } $options->hidefilesonpage = isset($hidefilesonpage); $filter = tcontentfilter::i(); $filter->usefilter = isset($usefilter); $filter->automore = isset($automore); $filter->automorelength = (int) $automorelength; $filter->autolinks = isset($autolinks); $filter->commentautolinks = isset($commentautolinks); $filter->save(); $themeparser = tthemeparser::i(); $themeparser->replacelang = isset($replacelang); $themeparser->stylebefore = isset($stylebefore); $themeparser->save(); // restore style after if (!$themeparser->stylebefore) { $css = '<link type="text/css" href="$site.files$template.cssmerger_default" rel="stylesheet" />'; $t = ttemplate::i(); if (false !== strpos($t->heads, "<!--{$css}-->")) { $t->heads = str_replace("<!--{$css}-->", $css, $t->heads); $t->save(); } } break; case 'files': $parser = tmediaparser::i(); $parser->enablepreview = isset($enablepreview); $parser->ratio = isset($ratio); $parser->clipbounds = isset($clipbounds); $parser->previewwidth = (int) trim($previewwidth); $parser->previewheight = (int) trim($previewheight); $parser->maxwidth = (int) trim($maxwidth); $parser->maxheight = (int) trim($maxheight); $parser->alwaysresize = isset($alwaysresize); $parser->quality_snapshot = (int) trim($quality_snapshot); $parser->quality_original = (int) trim($quality_original); $parser->audioext = trim($audioext); $parser->videoext = trim($videoext); $parser->save(); litepublisher::$site->video_width = $video_width; litepublisher::$site->video_height = $video_height; break; case 'links': $linkgen = tlinkgenerator::i(); $linkgen->urlencode = isset($urlencode); if (!empty($post)) { $linkgen->post = $post; } if (!empty($menu)) { $linkgen->menu = $menu; } if (!empty($category)) { $linkgen->category = $category; } if (!empty($tag)) { $linkgen->tag = $tag; } if (!empty($archive)) { $linkgen->archive = $archive; } $linkgen->save(); break; case 'cache': if (isset($clearcache)) { ttheme::clearcache(); } else { $classes = litepublisher::$classes; if ($classes->memcache != isset($memcache_classes)) { if (isset($memcache_classes)) { $classes->revision_memcache++; } $classes->memcache = isset($memcache_classes); $classes->save(); } $options->lock(); $options->cache = isset($enabledcache); $options->admincache = isset($admincache); if (!empty($expiredcache)) { $options->expiredcache = (int) $expiredcache; } $options->ob_cache = isset($ob_cache); $options->compress = isset($compress); $options->commentspull = isset($commentspull); $options->unlock(); } break; case 'lite': case 'catstags': litepublisher::$classes->archives->lite = isset($litearch); $cats = litepublisher::$classes->categories; $cats->lite = isset($litecats); $cats->includeparents = isset($parentcats); $cats->includechilds = isset($childcats); $cats->save(); $tags = litepublisher::$classes->tags; $tags->lite = isset($litetags); $tags->includeparents = isset($parenttags); $tags->includechilds = isset($childtags); $tags->save(); break; case 'robots': $robo = trobotstxt::i(); $robo->text = $robots; $robo->save(); $appcache_manifest = appcache_manifest::i(); $appcache_manifest->text = $appcache; $appcache_manifest->save(); break; case 'secure': if (isset($_POST['oldpassword'])) { $h2 = $this->html->h2; if ($oldpassword == '') { return $h2->badpassword; } if ($newpassword == '' || $newpassword != $repassword) { return $h2->difpassword; } if (!$options->auth($options->email, $oldpassword)) { return $h2->badpassword; } $options->changepassword($newpassword); $options->logout(); return $h4->passwordchanged; } else { $options->echoexception = isset($echoexception); $options->reguser = isset($reguser); $this->usersenabled = isset($usersenabled); $options->parsepost = isset($parsepost); $options->show_draft_post = isset($show_draft_post); $options->xxxcheck = isset($xxxcheck); $filter = tcontentfilter::i(); $filter->phpcode = isset($phpcode); $filter->save(); $parser = tthemeparser::i(); $parser->removephp = isset($removephp); $parser->save(); $backuper = tbackuper::i(); if ($backuper->filertype != $filertype) { $backuper->filertype = $filertype; $backuper->save(); } $useshell = isset($useshell); $updater = tupdater::i(); if ($useshell !== $updater->useshell) { $updater->useshell = $useshell; $updater->save(); } } break; } return ''; }
function tshortcodeUninstall($self) { tcontentfilter::i()->unbind($self); }
/** * 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 tticketsInstall($self) { if (version_compare(PHP_VERSION, '5.3', '<')) { die('Ticket system requires PHP 5.3 or later. You are using PHP ' . PHP_VERSION); } $dirname = basename(dirname(__FILE__)); $l = tlocalmerger::i(); $l->lock(); $l->add('default', "plugins/{$dirname}/resource/" . litepublisher::$options->language . ".ini"); $l->add('mail', "plugins/{$dirname}/resource/" . litepublisher::$options->language . ".mail.ini"); $l->unlock(); tadminhtml::i()->inidir(dirname(__FILE__) . '/resource/'); $lang = tlocal::admin('tickets'); $lang->addsearch('ticket', 'tickets'); $self->data['cats'] = array(); $self->data['idcomauthor'] = tusers::i()->add(array('email' => '', 'name' => tlocal::get('ticket', 'comname'), 'status' => 'approved', 'idgroups' => 'commentator')); $self->save(); $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'resource' . DIRECTORY_SEPARATOR; $filter = tcontentfilter::i(); $filter->phpcode = true; $filter->save(); litepublisher::$options->parsepost = false; $manager = tdbmanager::i(); $manager->CreateTable($self->childtable, file_get_contents($dir . 'ticket.sql')); $manager->addenum('posts', 'class', 'tticket'); $optimizer = tdboptimizer::i(); $optimizer->lock(); $optimizer->childtables[] = 'tickets'; $optimizer->addevent('postsdeleted', 'ttickets', 'postsdeleted'); $optimizer->unlock(); litepublisher::$classes->lock(); //install polls if its needed $plugins = tplugins::i(); if (!isset($plugins->items['polls'])) { $plugins->add('polls'); } litepublisher::$classes->Add('tticket', 'ticket.class.php', $dirname); //litepublisher::$classes->Add('tticketsmenu', 'tickets.menu.class.php', $dirname); litepublisher::$classes->Add('tticketeditor', 'admin.ticketeditor.class.php', $dirname); litepublisher::$classes->Add('tadmintickets', 'admin.tickets.class.php', $dirname); litepublisher::$classes->Add('tadminticketoptions', 'admin.tickets.options.php', $dirname); litepublisher::$options->reguser = true; $adminoptions = tadminoptions::i(); $adminoptions->usersenabled = true; $adminmenus = tadminmenus::i(); $adminmenus->lock(); $parent = $adminmenus->createitem(0, 'tickets', 'ticket', 'tadmintickets'); $adminmenus->items[$parent]['title'] = tlocal::get('tickets', 'tickets'); $idmenu = $adminmenus->createitem($parent, 'editor', 'ticket', 'tticketeditor'); $adminmenus->items[$idmenu]['title'] = tlocal::get('tickets', 'editortitle'); $idmenu = $adminmenus->createitem($parent, 'opened', 'ticket', 'tadmintickets'); $adminmenus->items[$idmenu]['title'] = tlocal::get('ticket', 'opened'); $idmenu = $adminmenus->createitem($parent, 'fixed', 'ticket', 'tadmintickets'); $adminmenus->items[$idmenu]['title'] = tlocal::get('ticket', 'fixed'); $idmenu = $adminmenus->createitem($parent, 'options', 'admin', 'tadminticketoptions'); $adminmenus->items[$idmenu]['title'] = tlocal::i()->options; $adminmenus->onexclude = $self->onexclude; $adminmenus->unlock(); /* $menus = tmenus::i(); $menus->lock(); $ini = parse_ini_file($dir . litepublisher::$options->language . '.install.ini', false); $menu = tticketsmenu::i(); $menu->type = 'tickets'; $menu->url = '/tickets/'; $menu->title = $ini['tickets']; $menu->content = $ini['contenttickets']; $id = $menus->add($menu); foreach (array('bug', 'feature', 'support', 'task') as $type) { $menu = tticketsmenu::i(); $menu->type = $type; $menu->parent = $id; $menu->url = "/$type/"; $menu->title = $ini[$type]; $menu->content = ''; $menus->add($menu); } $menus->unlock(); */ litepublisher::$classes->unlock(); $linkgen = tlinkgenerator::i(); $linkgen->data['ticket'] = '/tickets/[title].htm'; $linkgen->save(); $groups = tusergroups::i(); $groups->lock(); $idticket = $groups->add('ticket', 'Tickets', '/admin/tickets/editor/'); $groups->defaults = array($idticket, $groups->getidgroup('author')); $groups->items[litepublisher::$options->groupnames['author']]['parents'][] = $idticket; $groups->items[litepublisher::$options->groupnames['commentator']]['parents'][] = $idticket; $groups->unlock(); }
function ttoptextuninstall($self) { $filter = tcontentfilter::i(); $filter->unbind($self); }
public function setrawcontent($s) { $this->data['rawcontent'] = $s; $filter = tcontentfilter::i(); $this->data['content'] = $filter->filtercomment($s); }
function ttidyfilterUninstall($self) { $filter = tcontentfilter::i(); $filter->unbind($self); }
public function setcontent($s) { if (!is_string($s)) { $this->error('Error! Page content must be string'); } if ($s != $this->rawcontent) { $this->rawcontent = $s; $filter = tcontentfilter::i(); $this->data['content'] = $filter->filter($s); } }