public function processform() { return ''; $result = ''; if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit') { $id = $this->idget(); $subscribers = tsubscribers::i(); $subscribed = $subscribers->getposts($id); $checked = array(); foreach ($_POST as $idpost => $value) { if (!is_numeric($idpost)) { continue; } $checked[] = $idpost; } $unsub = array_diff($subscribed, $checked); if (count($unsub)) { foreach ($unsub as $idpost) { $subscribers->delete($idpost, $id); } } $result = $this->html->h2->authoredited; } }
public function processform(array $values, $confirmed) { $lang = tlocal::i('comment'); if (trim($values['content']) == '') { return $this->geterrorcontent($lang->emptycontent); } if (!$this->checkspam(isset($values['antispam']) ? $values['antispam'] : '')) { return $this->geterrorcontent($lang->spamdetected); } $shortpost = $this->getshortpost(isset($values['postid']) ? (int) $values['postid'] : 0); if ($err = $this->invalidate($shortpost)) { return $err; } if ((int) $shortpost['idperm']) { $post = tpost::i((int) $shortpost['id']); $perm = tperm::i($post->idperm); if (!$perm->hasperm($post)) { return 403; } } $cm = tcommentmanager::i(); if ($cm->checkduplicate && $cm->is_duplicate($shortpost['id'], $values['content'])) { return $this->geterrorcontent($lang->duplicate); } unset($values['submitbutton']); if (!$confirmed) { $values['ip'] = preg_replace('/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR']); } if (litepublisher::$options->ingroups($cm->idgroups)) { if (!$confirmed && $cm->confirmlogged) { return $this->request_confirm($values, $shortpost); } $iduser = litepublisher::$options->user; } else { switch ($shortpost['comstatus']) { case 'reg': return $this->geterrorcontent($lang->reg); case 'guest': if (!$confirmed && $cm->confirmguest) { return $this->request_confirm($values, $shortpost); } $iduser = $cm->idguest; break; case 'comuser': //hook in regservices social plugin if ($r = $this->oncomuser($values, $confirmed)) { return $r; } if (!$confirmed && $cm->confirmcomuser) { return $this->request_confirm($values, $shortpost); } if ($err = $this->processcomuser($values)) { return $err; } $users = tusers::i(); if ($iduser = $users->emailexists($values['email'])) { if ('comuser' != $users->getvalue($iduser, 'status')) { return $this->geterrorcontent($lang->emailregistered); } } else { $iduser = $cm->addcomuser($values['name'], $values['email'], $values['url'], $values['ip']); } $cookies = array(); foreach (array('name', 'email', 'url') as $field) { $cookies["comuser_{$field}"] = $values[$field]; } break; } } $user = tusers::i()->getitem($iduser); if ('hold' == $user['status']) { return $this->geterrorcontent($lang->holduser); } if (!$cm->canadd($iduser)) { return $this->geterrorcontent($lang->toomany); } if (!$cm->add($shortpost['id'], $iduser, $values['content'], $values['ip'])) { return $this->geterrorcontent($lang->spamdetected); } //subscribe by email switch ($user['status']) { case 'approved': if ($user['email'] != '') { // subscribe if its first comment if (1 == tcomments::i()->db->getcount("post = {$shortpost['id']} and author = {$iduser}")) { if ('enabled' == tuseroptions::i()->getvalue($iduser, 'subscribe')) { tsubscribers::i()->update($shortpost['id'], $iduser, true); } } } break; case 'comuser': if ('comuser' == $shortpost['comstatus'] && $cm->comuser_subscribe) { tsubscribers::i()->update($shortpost['id'], $iduser, $values['subscribe']); } break; } //$post->lastcommenturl; $shortpost['commentscount']++; if (!litepublisher::$options->commentpages || $shortpost['commentscount'] <= litepublisher::$options->commentsperpage) { $c = 1; } else { $c = ceil($shortpost['commentscount'] / litepublisher::$options->commentsperpage); } $url = litepublisher::$urlmap->getvalue($shortpost['idurl'], 'url'); if ($c > 1 && !litepublisher::$options->comments_invert_order) { $url = rtrim($url, '/') . "/page/{$c}/"; } litepublisher::$urlmap->setexpired($shortpost['idurl']); return $this->sendresult(litepublisher::$site->url . $url, isset($cookies) ? $cookies : array()); }
public function processform() { extract($_POST, EXTR_SKIP); $options = litepublisher::$options; $cm = tcommentmanager::i(); $cm->lock(); $options->comstatus = $comstatus; $cm->filterstatus = isset($filterstatus); $cm->defstatus = isset($commentsapproved) ? 'approved' : 'hold'; $cm->checkduplicate = isset($checkduplicate); $useroptions = tuseroptions::i(); $useroptions->defvalues['subscribe'] = isset($defaultsubscribe) ? 'enabled' : 'disabled'; $useroptions->defvalues['authorpost_subscribe'] = isset($authorpost_subscribe) ? 'enabled' : 'disabled'; $useroptions->save(); $options->commentsdisabled = isset($commentsdisabled); $options->pingenabled = isset($pingenabled); $options->commentpages = isset($commentpages); $options->commentsperpage = (int) trim($commentsperpage); $options->comments_invert_order = isset($comments_invert_order); $cm->sendnotification = isset($sendnotification); $cm->hidelink = isset($hidelink); $cm->redir = isset($redir); $cm->nofollow = isset($nofollow); $cm->comuser_subscribe = isset($comuser_subscribe); $cm->unlock(); $tc = ttemplatecomments::i(); foreach (array('logged', 'reqlogin', 'regaccount', 'guest', 'comuser', 'loadhold') as $name) { $tc->{$name} = $_POST[$name]; } $tc->save(); $subscr = tsubscribers::i(); $subscr->lock(); $subscr->locklist = $locklist; $subscr->enabled = isset($subscribe_enabled); $subscr->unlock(); $rss = trssholdcomments::i(); $rss->count = $rsscount; $rss->template = $rsstemplate; $rss->save(); }
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 processform() { tuseroptions::i()->setvalue($this->iduser, 'subscribe', isset($_POST['default_subscribe']) ? 'enabled' : 'disabled'); $subscribers = tsubscribers::i(); foreach ($_POST as $name => $value) { if (strbegin($name, 'checkbox-')) { $subscribers->remove((int) $value, $this->iduser); } } return $this->html->h4->unsubscribed; }