'', 'body'=>''); // Do nothing
$vars['msg'] = str_replace("\n", '', $vars['msg']); // Cut LFs
$head = '';
$match = array();
if (preg_match('/^(-{1,2})-*\s*(.*)/', $vars['msg'], $match)) {
$head = & $match[1];
$vars['msg'] = & $match[2];
}
if ($vars['msg'] == '') return array('msg'=>'', 'body'=>''); // Do nothing
$comment = str_replace('$msg', $vars['msg'], PLUGIN_RESPONSE_FORMAT_MSG);
if(isset($vars['name']) || ($vars['nodate'] != '1')) {
$_name = (! isset($vars['name']) || $vars['name'] == '') ? $_no_name : $vars['name'];
$_name = ($_name == '') ? '' : str_replace('$name', $_name, PLUGIN_RESPONSE_FORMAT_NAME);
$_now = ($vars['nodate'] == '1') ? '' :
str_replace('$now', $now, PLUGIN_RESPONSE_FORMAT_NOW);
$comment = str_replace("\x08MSG\x08", $comment, PLUGIN_RESPONSE_FORMAT_STRING);
$comment = str_replace("\x08NAME\x08", $_name, $comment);
$comment = str_replace("\x08NOW\x08", $_now, $comment);
}
$comment = '-' . $head . ' ' . $comment;
$postdata = '';
$response_no = 0;
$above = (isset($vars['above']) && $vars['above'] == '1');
/*
foreach (get_source($vars['refer']) as $line) {
if (! $above) $postdata .= $line;
if (preg_match('/^#comment/i', $line) && $comment_no++ == $vars['comment_no']) {
if ($above) {
$postdata = rtrim($postdata) . "\n" .
$comment . "\n" .
"\n"; // Insert one blank line above #commment, to avoid indentation
} else {
$postdata = rtrim($postdata) . "\n" .
$comment . "\n"; // Insert one blank line below #commment
}
}
if ($above) $postdata .= $line;
}
*/
// ---------- Add From Here ----------
require(PLUGIN_DIR . 'article' . '.inc.php');
$before_article = '';
$after_response = '';
$move_thread = '';
$response_thread = '';
$article_flag = false;
$response_flag = false;
foreach (get_source($vars['refer']) as $line) {
if ($response_flag) {
$after_response .= $line;
} else {
if (preg_match('/^#article/i', $line)) {
$move_thread .= $response_thread;
$before_article .= $move_thread . $line;
$move_thread = '';
$response_thread = '';
$article_flag = true;
} else {
if (preg_match('/^\*\*/i', $line)){
// This is not good matching.
$move_thread .= $response_thread;
$response_thread = $line;
} else {
if (preg_match('/^#response/i', $line) && $response_no++ == $vars['response_no']) {
$response_flag = true;
if ($above) {
$response_thread = rtrim($response_thread);
$response_thread .= "\n" . $comment . "\n\n" . $line;
} else {
$response_thread .= $line . $comment . "\n";
}
} else {
$response_thread .= $line;
}
}
}
}
}
if (!PLUGIN_ARTICLE_INS && $above && $article_flag) {
$postdata .= $before_article . $response_thread . $move_thread . $after_response;
} else {
$postdata .= $before_article . $move_thread . $response_thread . $after_response;
}
// ---------- Add To Here ----------
$title = $_title_updated;
$body = '';
if (md5(@join('', get_source($vars['refer']))) != $vars['digest']) {
$title = $_title_comment_collided;
$body = $_msg_comment_collided . make_pagelink($vars['refer']);
}
page_write($vars['refer'], $postdata);
$retvars['msg'] = $title;
$retvars['body'] = $body;
$vars['page'] = $vars['refer'];
return $retvars;
}
function plugin_response_convert()
{
global $vars, $digest, $_btn_comment, $_btn_name, $_msg_comment;
static $numbers = array();
static $comment_cols = PLUGIN_RESPONSE_SIZE_MSG;
if (PKWK_READONLY) return ''; // Show nothing
if (! isset($numbers[$vars['page']])) $numbers[$vars['page']] = 0;
$response_no = $numbers[$vars['page']]++;
$options = func_num_args() ? func_get_args() : array();
if (in_array('noname', $options)) {
$nametags = '';
} else {
$nametags = '' .
'' . "\n";
}
$nodate = in_array('nodate', $options) ? '1' : '0';
$above = in_array('above', $options) ? '1' :
(in_array('below', $options) ? '0' : PLUGIN_RESPONSE_DIRECTION_DEFAULT);
$script = get_script_uri();
$s_page = htmlspecialchars($vars['page']);
$string = <<