/** * 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(); }
/** * 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 tforumInstall($self) { litepublisher::$options->reguser = true; tadminoptions::i()->usersenabled = true; $name = basename(dirname(__FILE__)); tlocalmerger::i()->addplugin($name); $lang = tlocal::admin('forum'); //prevent double create view $idview = 0; $views = tviews::i(); foreach ($views->items as $id => $item) { if ('forum' == $item['themename']) { $idview = $id; break; } } if (!$idview) { $view = new tview(); $view->name = $lang->forum; $view->themename = 'forum'; $idview = $views->addview($view); } $lang->section = 'forum'; $cats = tcategories::i(); $idcat = $cats->add(0, $lang->forum); $cats->setvalue($idcat, 'includechilds', 1); $cats->setvalue($idcat, 'idview', $idview); $cats->contents->setcontent($idcat, $lang->intro . sprintf(' <a href="%s/admin/plugins/forum/">%s</a>', litepublisher::$site->url, tlocal::get('names', 'adminpanel'))); $self->rootcat = $idcat; $self->idview = $idview; $self->categories_changed(); $self->save(); $cat = $cats->getitem($idcat); tmenus::i()->addfake($cat['url'], $cat['title']); tjsmerger::i()->add('default', '/plugins/forum/forum.min.js'); $linkgen = tlinkgenerator::i(); $linkgen->data['forum'] = '/forum/[title].htm'; $linkgen->save(); $cats = tcategories::i(); $cats->lock(); $cats->changed = $self->categories_changed; $cats->added = $self->catadded; $cats->unlock(); tthemeparser::i()->parsed = $self->themeparsed; ttheme::clearcache(); litepublisher::$classes->add('tforumeditor', 'admin.forumeditor.class.php', $name); $adminmenus = tadminmenus::i(); $adminmenus->createitem($adminmenus->url2id('/admin/plugins/'), 'forum', 'author', 'tforumeditor'); }
/** * 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(); }