Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions core/components/quip/controllers/web/ThreadReply.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
/**
* Returns the number of comments a given thread/user/family has
*
*
* @package quip
* @subpackage controllers
*/
Expand Down Expand Up @@ -133,25 +133,25 @@ public function process() {
$p = $this->modx->request->getParameters();
unset($p['reported'],$p['quip_approved']);
$this->setPlaceholder('url',$this->modx->makeUrl($this->modx->resource->get('id'),'',$p));

$this->setPlaceholder('parent',$this->parentThread);
$this->setPlaceholder('thread',$this->thread->get('name'));
$this->setPlaceholder('idprefix',$this->thread->get('idprefix'));

/* handle POST */
$this->hasPreview = false;
if (!empty($_POST)) {
$this->handlePost();
}

/* display moderated success message */
$this->checkForModeration();

$this->checkForUnSubscribe();

/* if using recaptcha, load recaptcha html if user is not logged in */
$this->loadReCaptcha();

/* build reply form */
$isOpen = $this->isOpen();
if ($this->hasAuth && $isOpen) {
Expand All @@ -161,7 +161,7 @@ public function process() {
} else {
$replyForm = $this->quip->getChunk($this->getProperty('tplLoginToComment','quipLoginToComment'),$this->getPlaceholders());
}

/* output or set to placeholder */
$toPlaceholder = $this->getProperty('toPlaceholder',false);
if ($toPlaceholder) {
Expand All @@ -180,6 +180,15 @@ public function getReplyForm() {
$this->setPlaceholder('username',$this->modx->user->get('username'));
$this->setPlaceholder('unsubscribe','');

$fields = array();
foreach ($_POST as $k => $v) {
$fields[$k] = str_replace(array('[',']'),array('[',']'),$v);
}

$fields['name'] = strip_tags($fields['name']);
$fields['email'] = strip_tags($fields['email']);
$fields['website'] = strip_tags($fields['website']);

/* prefill fields */
$profile = $this->modx->user->getOne('Profile');
if ($profile) {
Expand Down Expand Up @@ -250,7 +259,7 @@ public function handlePost() {
$params = $this->modx->request->getParameters();
unset($params[$this->getProperty('postAction')],$params['quip_parent'],$params['quip_thread']);
$params['quip_approved'] = $comment->get('approved') ? 1 : 0;

/* redirect urls for custom FURL scheme */
$redirectToUrl = $this->getProperty('redirectToUrl','');
$redirectTo = $this->getProperty('redirectTo','');
Expand Down