/**
* 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));
}
/**
* 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 tcommentmanagerInstall($self)
{
    $self->data['filterstatus'] = true;
    $self->data['checkduplicate'] = true;
    $self->data['defstatus'] = 'approved';
    $self->data['sendnotification'] = true;
    $self->data['trustlevel'] = 2;
    $self->data['hidelink'] = false;
    $self->data['redir'] = true;
    $self->data['nofollow'] = false;
    $self->data['canedit'] = true;
    $self->data['candelete'] = true;
    $self->data['confirmlogged'] = false;
    $self->data['confirmguest'] = true;
    $self->data['confirmcomuser'] = true;
    $self->data['confirmemail'] = false;
    $self->data['comuser_subscribe'] = true;
    $self->data['idguest'] = 0;
    //create user in installer after create users table
    $groups = litepublisher::$options->groupnames;
    $self->data['idgroups'] = array($groups['admin'], $groups['editor'], $groups['moderator'], $groups['author'], $groups['commentator']);
    $self->save();
    $comments = tcomments::i();
    $comments->lock();
    $comments->changed = $self->changed;
    $comments->added = $self->sendmail;
    $comments->unlock();
    litepublisher::$urlmap->addget('/comusers.htm', get_class($self));
    trobotstxt::i()->AddDisallow('/comusers.htm');
}
/**
* 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 tdownloaditemcounterInstall($self)
{
    $cron = tcron::i();
    $cron->add('hour', get_class($self), 'updatestat');
    litepublisher::$urlmap->addget('/downloaditem.htm', get_class($self));
    $robot = trobotstxt::i();
    $robot->AddDisallow('/downloaditem.htm');
}
function twidgetsInstall($self)
{
    litepublisher::$urlmap->addget('/getwidget.htm', get_class($self));
    $robot = trobotstxt::i();
    $robot->AddDisallow('/getwidget.htm');
    $xmlrpc = TXMLRPC::i();
    $xmlrpc->add('litepublisher.getwidget', 'xmlrpcgetwidget', get_class($self));
    install_std_widgets($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 tsitemapInstall($self)
{
    tcron::i()->addnightly(get_class($self), 'Cron', null);
    litepublisher::$urlmap->add('/sitemap.xml', get_class($self), 'xml');
    litepublisher::$urlmap->add('/sitemap.htm', get_class($self), null);
    $robots = trobotstxt::i();
    array_splice($robots->items, 1, 0, "Sitemap: " . litepublisher::$site->url . "/sitemap.xml");
    $robots->save();
    $self->add('/sitemap.htm', 4);
    $self->createfiles();
    $meta = tmetawidget::i();
    $meta->add('sitemap', '/sitemap.htm', tlocal::get('default', 'sitemap'));
}
/**
* 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();
}
Beispiel #7
0
function ExportOptions()
{
    $options = litepublisher::$options;
    $options->lock();
    litepublisher::$site->name = get_option('blogname');
    litepublisher::$site->description = get_option('blogdescription');
    $options->email = get_option('admin_email');
    $options->unlock();
    $robots = trobotstxt::i();
    $robots->AddDisallow('/feed/');
    $redir = tredirector::i();
    $redir->items['/feed/'] = '/rss.xml';
    $redir->items['/feed'] = '/rss.xml';
    $redir->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 install()
 {
     if (!file_exists(litepublisher::$paths->home . 'mobile' . DIRECTORY_SEPARATOR . 'index.php')) {
         die("folder 'mobile' with requried files not exists. Please copy required folder from plugin.");
     }
     $about = tplugins::getabout(tplugins::getname(__FILE__));
     $views = tviews::i();
     if (!isset($views->defaults['mobile'])) {
         $views->defaults['mobile'] = $views->add($about['menutitle']);
     }
     $idview = $views->defaults['mobile'];
     $view = tview::i($idview);
     if ($view->themename != 'pda') {
         $view->themename = 'pda';
         $view->disableajax = true;
         $view->save();
     }
     $menus = tmenus::i();
     $menus->addfake('/mobile/', $about['menutitle']);
     $robot = trobotstxt::i();
     $robot->AddDisallow('/mobile/');
     litepublisher::$urlmap->clearcache();
 }
/**
* 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 texternallinksInstall($self)
{
    if (dbversion) {
        $manager = tdbmanager::i();
        $manager->createtable($self->table, 'id int UNSIGNED NOT NULL auto_increment,
    clicked int UNSIGNED NOT NULL default 0,
    url varchar(255)not null,
    PRIMARY KEY(id),
    key url (url)
    ');
    } else {
    }
    $filter = tcontentfilter::i();
    $filter->lock();
    $filter->afterfilter = $self->filter;
    $filter->onaftercomment = $self->filter;
    $filter->unlock();
    $cron = tcron::i();
    $cron->add('hour', get_class($self), 'updatestat');
    litepublisher::$urlmap->addget('/externallink.htm', get_class($self));
    $robot = trobotstxt::i();
    $robot->AddDisallow('/externallink.htm');
    tposts::i()->addrevision();
}
 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 '';
 }