public function add($title, $description, $keywords, $content) { $filter = tcontentfilter::i(); $title = tcontentfilter::escape($title); $linkgen = tlinkgenerator::i(); $url = $linkgen->createurl($title, 'menu', true); $urlmap = turlmap::i(); $this->items[++$this->autoid] = array('idurl' => $urlmap->add($url, get_class($this), $this->autoid), 'url' => $url, 'title' => $title, 'filtered' => $filter->filter($content), 'rawcontent' => $content, 'description' => tcontentfilter::escape($description), 'keywords' => tcontentfilter::escape($keywords), 'idview' => 1); $this->save(); return $this->autoid; }
public function processform() { $pages = tuserpages::i(); $pages->createpage = isset($_POST['createpage']); $pages->lite = isset($_POST['lite']); $pages->save(); $groups = tusergroups::i(); $groups->defaults = tadminhtml::check2array('idgroup-'); $groups->defaulthome = trim($_POST['defaulthome']); $groups->save(); $linkgen = tlinkgenerator::i(); $linkgen->data['user'] = $_POST['linkschema']; $linkgen->save(); }
public function postschanged() { $posts = tposts::i(); $this->lock(); $this->items = array(); //sort archive by months $linkgen = tlinkgenerator::i(); $db = litepublisher::$db; $res = $db->query("SELECT YEAR(posted) AS 'year', MONTH(posted) AS 'month', count(id) as 'count' FROM {$db->posts}\n where status = 'published' GROUP BY YEAR(posted), MONTH(posted) ORDER BY posted DESC "); while ($r = $db->fetchassoc($res)) { $this->date = mktime(0, 0, 0, $r['month'], 1, $r['year']); $this->items[$this->date] = array('idurl' => 0, 'url' => $linkgen->Createlink($this, 'archive', false), 'title' => tlocal::date($this->date, 'F Y'), 'year' => $r['year'], 'month' => $r['month'], 'count' => $r['count']); } $this->CreatePageLinks(); $this->unlock(); }
/** * 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; }
function tforumUninstall($self) { tcategories::i()->unbind($self); tthemeparser::i()->unbind($self); ttheme::clearcache(); tlocalmerger::i()->deleteplugin(basename(dirname(__FILE__))); tjsmerger::i()->deletefile('default', '/plugins/forum/forum.min.js'); $item = tcategories::i()->getitem($self->rootcat); $menus = tmenus::i(); while ($menus->deleteurl($item['url'])) { } $adminmenus = tadminmenus::i(); $adminmenus->deletetree($adminmenus->url2id('/admin/plugins/forum/')); litepublisher::$classes->delete('tforumeditor'); $linkgen = tlinkgenerator::i(); unset($linkgen->data['forum']); $linkgen->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 tuserpagesInstall($self) { if ($self->dbversion) { $manager = tdbmanager::i(); $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR; $manager->CreateTable($self->table, file_get_contents($dir . 'userpage.sql')); } $v = $self->createpage; $self->lock(); $self->createpage = false; $self->add(1, 'Admin', litepublisher::$options->email, litepublisher::$site->url . '/'); $itemurl = litepublisher::$urlmap->findurl('/'); $self->setvalue(1, 'idurl', $itemurl['id']); $self->createpage = $v; $self->unlock(); $linkgen = tlinkgenerator::i(); $linkgen->data['user'] = '******'; $linkgen->save(); litepublisher::$urlmap->add('/users.htm', get_class($self), 'url', 'get'); $robots = trobotstxt::i(); $robots->AddDisallow('/users.htm'); }
public function sendfile() { $themename = isset($_POST['themename']) ? trim($_POST['themename']) : ''; if ($themename != '') { $themename = tlinkgenerator::i()->filterfilename($themename); } if ($themename == '') { $themename = time(); } $path = "themes/generator-{$themename}/"; litepublisher::$classes->include_file(litepublisher::$paths->libinclude . 'zip.lib.php'); $zip = new zipfile(); $themedir = litepublisher::$paths->plugins . 'themegenerator' . DIRECTORY_SEPARATOR . $this->type . DIRECTORY_SEPARATOR; $args = new targs(); $colors = "[themecolors]\nthemename = \"{$themename}\"\n"; foreach ($this->colors as $name => $value) { $colors .= "{$name} = \"{$value}\"\n"; $args->{$name} = $value; } foreach (array('headerurl', 'logourl') as $name) { if (strbegin($this->colors[$name], 'http://')) { $basename = substr($this->colors[$name], strrpos($this->colors[$name], '/') + 1); $filename = litepublisher::$paths->files . 'themegen' . DIRECTORY_SEPARATOR . $basename; $zip->addFile(file_get_contents($filename), $path . 'images/' . $basename); $args->{$name} = 'images/' . $basename; } } $res = $this->res; $css = strtr(tfilestorage::getfile($res . 'scheme.tml'), $args->data); $zip->addFile($colors, $path . 'colors.ini'); $filelist = tfiler::getfiles($themedir); foreach ($filelist as $filename) { $content = tfilestorage::getfile($themedir . $filename); switch ($filename) { case 'style.css': $content .= $css; break; case 'about.ini': $content = str_replace('name = generator', "name = generator-{$themename}", $content); break; } $zip->addFile($content, $path . $filename); } $result = $zip->file(); if (ob_get_level()) { @ob_end_clean(); } header('HTTP/1.1 200 OK', true, 200); header('Content-type: application/octet-stream'); header('Content-Disposition: attachment; filename=generator.theme.' . $themename . '.zip'); header('Content-Length: ' . strlen($result)); header('Last-Modified: ' . date('r')); Header('Cache-Control: no-cache, must-revalidate'); Header('Pragma: no-cache'); echo $result; exit; }
public function edit($id, $title, $url) { $item = $this->getitem($id); if ($item['title'] == $title && $item['url'] == $url) { return; } $item['title'] = $title; if ($this->dbversion) { $this->db->updateassoc(array('id' => $id, 'title' => $title)); } $linkgen = tlinkgenerator::i(); $url = trim($url); // try rebuild url if ($url == '') { $url = $linkgen->createurl($title, $this->PermalinkIndex, false); } if ($item['url'] != $url) { if (($urlitem = litepublisher::$urlmap->finditem($url)) && $urlitem['id'] != $item['idurl']) { $url = $linkgen->MakeUnique($url); } litepublisher::$urlmap->setidurl($item['idurl'], $url); litepublisher::$urlmap->addredir($item['url'], $url); $item['url'] = $url; } $this->items[$id] = $item; $this->save(); $this->changed(); litepublisher::$urlmap->clearcache(); }
/** * 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 tdownloaditemsInstall($self) { if (!dbversion) { die("Downloads require database"); } $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'resource' . DIRECTORY_SEPARATOR; $manager = tdbmanager::i(); $manager->CreateTable($self->childtable, file_get_contents($dir . 'downloaditem.sql')); $manager->addenum('posts', 'class', 'tdownloaditem'); $optimizer = tdboptimizer::i(); $optimizer->lock(); $optimizer->childtables[] = 'downloaditems'; $optimizer->addevent('postsdeleted', get_class($self), 'postsdeleted'); $optimizer->unlock(); tlocalmerger::i()->add('default', "plugins/" . basename(dirname(__FILE__)) . "/resource/" . litepublisher::$options->language . ".ini"); $ini = parse_ini_file($dir . litepublisher::$options->language . '.install.ini', false); $tags = ttags::i(); litepublisher::$options->downloaditem_themetag = $tags->add(0, $ini['themetag']); litepublisher::$options->downloaditem_plugintag = $tags->add(0, $ini['plugintag']); $base = basename(dirname(__FILE__)); $classes = litepublisher::$classes; $classes->lock(); /* //install polls if its needed $plugins = tplugins::i(); if (!isset($plugins->items['polls'])) $plugins->add('polls'); $polls = tpolls::i(); $polls->garbage = false; $polls->save(); */ $classes->Add('tdownloaditem', 'downloaditem.class.php', $base); $classes->Add('tdownloaditemsmenu', 'downloaditems.menu.class.php', $base); $classes->Add('tdownloaditemeditor', 'admin.downloaditem.editor.class.php', $base); $classes->Add('tadmindownloaditems', 'admin.downloaditems.class.php', $base); $classes->Add('tdownloaditemcounter', 'downloaditem.counter.class.php', $base); $classes->Add('taboutparser', 'about.parser.class.php', $base); $classes->unlock(); tadminhtml::i()->inidir(dirname(__FILE__) . '/resource/'); $lang = tlocal::i('downloaditems'); $lang->ini['downloaditems'] = $lang->ini['downloaditem'] + $lang->ini['downloaditems']; $adminmenus = tadminmenus::i(); $adminmenus->lock(); $parent = $adminmenus->createitem(0, 'downloaditems', 'editor', 'tadmindownloaditems'); $adminmenus->items[$parent]['title'] = $lang->downloaditems; $idmenu = $adminmenus->createitem($parent, 'addurl', 'editor', 'tadmindownloaditems'); $adminmenus->items[$idmenu]['title'] = $lang->addurl; $idmenu = $adminmenus->createitem($parent, 'editor', 'editor', 'tdownloaditemeditor'); $adminmenus->items[$idmenu]['title'] = $lang->add; $idmenu = $adminmenus->createitem($parent, 'theme', 'editor', 'tadmindownloaditems'); $adminmenus->items[$idmenu]['title'] = $lang->themes; $idmenu = $adminmenus->createitem($parent, 'plugin', 'editor', 'tadmindownloaditems'); $adminmenus->items[$idmenu]['title'] = $lang->plugins; $adminmenus->unlock(); $menus = tmenus::i(); $menus->lock(); $menu = tdownloaditemsmenu::i(); $menu->type = ''; $menu->url = '/downloads.htm'; $menu->title = $ini['downloads']; $menu->content = ''; $id = $menus->add($menu); litepublisher::$urlmap->db->setvalue($menu->idurl, 'type', 'get'); foreach (array('theme', 'plugin') as $type) { $menu = tdownloaditemsmenu::i(); $menu->type = $type; $menu->parent = $id; $menu->url = sprintf('/downloads/%ss.htm', $type); $menu->title = $lang->__get($type . 's'); $menu->content = ''; $menus->add($menu); litepublisher::$urlmap->db->setvalue($menu->idurl, 'type', 'get'); } $menus->unlock(); tjsmerger::i()->add('default', '/plugins/downloaditem/downloaditem.min.js'); $parser = tthemeparser::i(); $parser->parsed = $self->themeparsed; ttheme::clearcache(); $linkgen = tlinkgenerator::i(); $linkgen->data['downloaditem'] = '/[type]/[title].htm'; $linkgen->save(); litepublisher::$options->savemodified(); }
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 ''; }
public function uploadthumbnail($filename, $content) { if (!preg_match('/\\.(jpg|jpeg|gif|png|bmp)$/i', $filename)) { return false; } $linkgen = tlinkgenerator::i(); $filename = $linkgen->filterfilename($filename); $tempfilename = $this->doupload($filename, $content); return $this->add(array('filename' => $filename, 'tempfilename' => $tempfilename, 'enabledpreview' => 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 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(); }
private function addurl(array $item) { if ($item['id'] == 1) { return $item; } $item['url'] = ''; $linkitem = tusers::i()->getitem($item['id']) + $item; $linkgen = tlinkgenerator::i(); $item['url'] = $linkgen->addurl(new tarray2prop($linkitem), 'user'); $item['idurl'] = litepublisher::$urlmap->add($item['url'], get_class($this), $item['id']); return $item; }
public function edit(tmenu $item) { if (!($item instanceof thomepage || $item instanceof tfakemenu)) { $linkgen = tlinkgenerator::i(); $linkgen->editurl($item, 'menu'); } $this->lock(); $this->sort(); $item->save(); $this->unlock(); $this->edited($item->id); litepublisher::$urlmap->clearcache(); }
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; }