function plugin_comment_convert() { global $vars, $digest, $_comment_messages; //, $_btn_comment, $_btn_name, $_msg_comment; static $numbers = array(); static $all_numbers = 0; static $comment_cols = PLUGIN_COMMENT_SIZE_MSG; if (!isset($vars['page'])) { return ''; } $ret = array(); if (PKWK_READONLY === Auth::ROLE_AUTH) { exist_plugin('login'); $ret[] = do_plugin_inline('login'); $ret[] = '<br />'; } if (Auth::check_role('readonly')) { return $auth_guide; } if (!isset($numbers[$vars['page']])) { $numbers[$vars['page']] = 0; } $options = func_num_args() ? func_get_args() : array(); list($user, $link, $disabled) = plugin_comment_get_nick(); // $refpage = ''; $ret[] = '<form action="' . get_script_uri() . '" method="post" class="plugin-comment-form row">'; $ret[] = '<input type="hidden" name="cmd" value="comment" />'; $ret[] = '<input type="hidden" name="refer" value="' . Utility::htmlsc($vars['page']) . '" />'; // $ret[] = '<input type="hidden" name="refpage" value="' . $refpage . '" />'; $ret[] = '<input type="hidden" name="comment_no" value="' . $numbers[$vars['page']]++ . '" />'; $ret[] = '<input type="hidden" name="nodate" value="' . (in_array('nodate', $options) ? '1' : '0') . '" />'; $ret[] = '<input type="hidden" name="above" value="' . (in_array('above', $options) ? '1' : (in_array('below', $options) ? '0' : PLUGIN_COMMENT_DIRECTION_DEFAULT)) . '" />'; $comment_all_no = $all_numbers++; if (!in_array('noname', $options)) { $ret[] = '<div class="col-md-3">'; $ret[] = '<input type="text" class="form-control" name="name" id="p_comment_name_' . $comment_all_no . '" size="' . PLUGIN_COMMENT_SIZE_NAME . '" value="' . $user . '"' . $disabled . ' placeholder="' . $_comment_messages['label_name'] . '" />'; $ret[] = '</div>'; $ret[] = '<div class="col-md-9">'; } else { $ret[] = '<div class="col-md-12">'; } $ret[] = '<div class="input-group">'; $ret[] = '<textarea name="msg" class="form-control" id="p_comment_comment_' . $comment_all_no . '" rows="1" placeholder="' . $_comment_messages['label_comment'] . '"></textarea>'; $ret[] = '<span class="input-group-btn">'; $ret[] = '<button type="submit" class="btn btn-primary" /><span class="fa fa-comment-o"></span>' . $_comment_messages['label_post'] . '</button>'; $ret[] = '</span>'; $ret[] = '</div>'; $ret[] = '</div>'; $ret[] = '</form>'; $string = join("\n", $ret); return IS_MOBILE ? '<div data-role="collapsible" data-collapsed="true" data-theme="b" data-content-theme="d"><h4>' . $_comment_messages['label_comment'] . '</h4>' . $string . '</div>' : $string; }
function plugin_comment_convert() { global $vars, $digest, $script; //, $_btn_comment, $_btn_name, $_msg_comment; static $numbers = array(); static $all_numbers = 0; static $comment_cols = PLUGIN_COMMENT_SIZE_MSG; $_btn_name = _("Name: "); $_btn_comment = _("Post Comment"); $_msg_comment = _("Comment: "); $auth_guide = ''; if (PKWK_READONLY == ROLE_AUTH) { exist_plugin('login'); $auth_guide = do_plugin_inline('login'); } // if (PKWK_READONLY) return ''; // Show nothing if (auth::check_role('readonly')) { return $auth_guide; } if (!isset($numbers[$vars['page']])) { $numbers[$vars['page']] = 0; } $comment_no = $numbers[$vars['page']]++; $comment_all_no = $all_numbers++; $options = func_num_args() ? func_get_args() : array(); list($user, $link, $disabled) = plugin_comment_get_nick(); if (in_array('noname', $options)) { $nametags = '<label for="_p_comment_comment_' . $comment_all_no . '">' . $_msg_comment . '</label>'; } else { $nametags = '<label for="_p_comment_name_' . $comment_all_no . '">' . $_btn_name . '</label>' . '<input type="text" name="name" id="_p_comment_name_' . $comment_all_no . '" size="' . PLUGIN_COMMENT_SIZE_NAME . '" value="' . htmlspecialchars($user) . '"' . $disabled . ' />' . "\n"; } $helptags = edit_form_assistant(); $nodate = in_array('nodate', $options) ? '1' : '0'; $above = in_array('above', $options) ? '1' : (in_array('below', $options) ? '0' : PLUGIN_COMMENT_DIRECTION_DEFAULT); $refpage = ''; $s_page = htmlspecialchars($vars['page']); $ticket = md5(MUTIME); if (function_exists('pkwk_session_start') && pkwk_session_start() != 0) { $keyword = $ticket; $_SESSION[$keyword] = md5(get_ticket() . $digest); } $string = <<<EOD <br /> {$auth_guide} <form action="{$script}" method="post"> <div class="commentform" onmouseup="pukiwiki_pos()" onkeyup="pukiwiki_pos()"> <input type="hidden" name="refpage" value="{$refpage}" /> <input type="hidden" name="plugin" value="comment" /> <input type="hidden" name="refer" value="{$s_page}" /> <input type="hidden" name="comment_no" value="{$comment_no}" /> <input type="hidden" name="nodate" value="{$nodate}" /> <input type="hidden" name="above" value="{$above}" /> <input type="hidden" name="digest" value="{$digest}" /> <input type="hidden" name="ticket" value="{$ticket}" /> {$nametags} <input type="text" name="msg" id="_p_comment_comment_{$comment_all_no}" size="{$comment_cols}" /> <input type="submit" name="comment" value="{$_btn_comment}" /> {$helptags} </div> </form> EOD; return $string; }