} // Plugin Filter before receiving comment $app->plugin->doAction('before-receive-comment', $referId); // Spam Blocking if (preg_match('/.*<\\/?(?: ' . $config['block_tags'] . ')/i', $_POST['comment']) || preg_match('/.*(' . $config['block_keywords'] . ')/i', $_POST['comment']) || $config['block_ascii_only_text'] == 'yes' && !preg_match('/.*[\\x80-\\xff]/', $_POST['comment']) || preg_match('/.*<\\/?(?:' . $config['block_tags'] . ')/i', $_POST['title']) || $receiveComment == 'not_allowed') { header('Location: ' . $pathToIndex . '/index.php?id=' . $referId . '#comments'); } else { if ($title == '') { $title = 'Re:'; } // Get user's remote host info $remoteHost = !isset($_SERVER['REMOTE_HOST']) ? @gethostbyaddr($_SERVER['REMOTE_ADDR']) : $_SERVER['REMOTE_HOST']; $userUri = isset($_POST['user_uri']) ? $_POST['user_uri'] : ''; $app->db->beginTransaction(); $fdate = gmdate('Y-m-d H:i:s', time() + $config['tz'] * 3600); $cmod = gmdate('Y-m-d H:i:s', time() + $config['tz'] * 3600); $sql = 'INSERT INTO ' . COMMENT_TABLE . ' ' . '(' . '`parent_key`, ' . '`title`, ' . '`comment`, ' . '`user_name`, ' . '`user_pass`, ' . '`user_uri`, ' . '`date`, ' . '`mod`, ' . '`user_ip`, ' . '`refer_id`' . ') ' . 'VALUES' . '(' . ':parent_key, ' . ':title, ' . ':comment, ' . ':user_name, ' . ':user_pass, ' . ':user_uri, ' . ':date, ' . ':mod, ' . ':user_ip, ' . ':refer_id' . ')'; $sql = $app->setDelimitedIdentifier($sql); $stmt = $app->db->prepare($sql); $res = $stmt->execute(array(':parent_key' => $parentKey, ':title' => $title, ':comment' => $comment, ':user_name' => $userName, ':user_pass' => $userPass, ':user_uri' => $userUri, ':date' => $fdate, ':mod' => $cmod, ':user_ip' => $remoteHost, ':refer_id' => $referId)); $app->db->commit(); header('Location: ' . $pathToIndex . '/index.php?id=' . $referId . '#comments'); } } else { $sessionState = $app->getSessionState(); $additionalTitle = 'Not Allowed'; $content = "<h2>Request Not Allowed</h2>\n"; $item = array('title' => $app->setTitle($additionalTitle), 'contents' => $content, 'result' => '', 'pager' => ''); $app->display($item, $sessionState); exit; }