global $ks_commentdata;
        if (isset($ks_commentdata['message']) && $ks_commentdata['message']) {
            $comment_author = $ks_commentdata['author'];
            $comment_author_email = $ks_commentdata['email'];
            $comment_author_url = $ks_commentdata['url'];
            $comment_content = $ks_commentdata['content'];
            ?>
<p><font color="red">
			<?php 
            echo implode("<br />", array_map('esc_html', explode("\n", $ks_commentdata['message'])));
            ?>
			</font></p> 
		<?php 
        }
        ks_require_term_id_form(ks_plugin_url(KTAI_NOT_ECHO) . 'comments-post.php');
        ks_fix_encoding_form();
        if (is_user_logged_in()) {
            ks_session_id_form();
            ?>
			<p><?php 
            printf(__('Logged in as %s.', 'ktai_style'), esc_html($user_identity));
            ?>
 [<a href="<?php 
            echo esc_url(ks_get_logout_url(KTAI_NOT_ECHO, ks_comments_post_url()));
            ?>
"><?php 
            _e('Log out');
            ?>
</a>]<br /><?php 
            if (!ks_cookie_available()) {
                ?>
    private function edit_form()
    {
        global $user_ID, $title;
        $comment = intval($_GET['c']);
        if (!($comment = get_comment($comment))) {
            $this->base->ks_die(__('Oops, no comment with this ID.'));
        }
        if (!current_user_can('edit_post', $comment->comment_post_ID)) {
            $this->base->ks_die(__('You are not allowed to edit comments on this post.'));
        }
        $comment = get_comment_to_edit($comment);
        $title = sprintf(__('Editing Comment # %s'), $comment->comment_ID);
        include dirname(__FILE__) . '/admin-header.php';
        $submitbutton_text = __('Edit Comment');
        $form_action = 'editedcomment';
        $form_extra = '<input type="hidden" name="comment_ID" value="' . $comment->comment_ID . '" /><input type="hidden" name="comment_post_ID" value="' . $comment->comment_post_ID . '" />';
        ?>
<form action="comment.php" method="post">
<?php 
        $this->admin->sid_field();
        ks_fix_encoding_form();
        wp_nonce_field('update-comment_' . $comment->comment_ID, "_wpnonce", false);
        ?>
<input type="hidden" name="user_ID" value="<?php 
        echo intval($user_ID);
        ?>
" />
<input type="hidden" name="action" value="<?php 
        echo $form_action;
        ?>
" /><?php 
        echo $form_extra;
        ?>
<div><?php 
        _e('Name');
        ?>
<br />
<input type="text" name="newcomment_author" size="24" maxlength="99" value="<?php 
        echo $comment->comment_author;
        ?>
" tabindex="1" /><br />
<?php 
        _e('E-mail');
        ?>
<br />
<input type="text" name="newcomment_author_email" size="30" maxlength="128" value="<?php 
        echo $comment->comment_author_email;
        ?>
" tabindex="2" /><br />
<?php 
        _e('URL');
        ?>
<br />
<input type="text" name="newcomment_author_url" size="36" maxlength="256" value="<?php 
        echo $comment->comment_author_url;
        ?>
" tabindex="3" /><br />
<?php 
        _e('Content', 'ktai_style');
        ?>
<br />
<?php 
        $this->admin->the_editor($comment->comment_content, 6, 4);
        $id = $this->base->ktai->read_term_id($comment);
        if (count($id)) {
            if ($id[0]) {
                echo '<img localsrc="161" alt="&middot;"/>' . sprintf(__('Term ID: %s', 'ktai_style'), esc_attr($id[0])) . '<br />';
            }
            if ($id[1]) {
                echo '<img localsrc="56" alt="&middot;"/>' . sprintf(__('USIM ID: %s', 'ktai_style'), esc_attr($id[1])) . '<br />';
            }
            if ($id[2]) {
                echo '<img localsrc="d170" alt="&middot;"/>' . sprintf(__('Sub ID: %s', 'ktai_style'), esc_attr($id[2])) . '<br />';
            }
        }
        _e('Approval Status', 'ktai_style');
        ?>
<br />
<input name="comment_status" type="radio" value="1" <?php 
        checked($comment->comment_approved, '1');
        ?>
 /> <?php 
        printf(__('<font color="%s">Approved</font>', 'ktai_style'), 'green');
        ?>
<input name="comment_status" type="radio" value="0" <?php 
        checked($comment->comment_approved, '0');
        ?>
 /> <?php 
        printf(__('<font color="%s">Pending</font>', 'ktai_style'), '#ff9900');
        ?>
<input name="comment_status" type="radio" value="spam" <?php 
        checked($comment->comment_approved, 'spam');
        ?>
 /> <?php 
        printf(__('<font color="%s">Spam</font>', 'ktai_style'), 'red');
        ?>
<br />
<?php 
        $referer = $this->base->strip_host($this->referer);
        if ($referer) {
            printf(__('<a href="%s">Cancel Edit</a>', 'ktai_style'), esc_attr($referer));
            ?>
<input name="referredby" type="hidden" value="<?php 
            echo esc_attr($referer);
            ?>
" /><?php 
            $orig_referer = '&_wp_original_http_referer=' . urlencode($referer);
        } else {
            $orig_referer = '';
        }
        ?>
 <input type="submit" name="editcomment" value="<?php 
        echo $submitbutton_text;
        ?>
" /><br /><?php 
        if (function_exists('wp_trash_comment') && EMPTY_TRASH_DAYS) {
            $button = __('Move to Trash');
            $delete_url = sprintf('comment.php?action=trashcomment&c=%d%s', $comment->comment_ID, $orig_referer);
            $delete_url = wp_nonce_url($delete_url, 'delete-comment_' . $comment->comment_ID);
        } else {
            $button = __('Delete Comment');
            $delete_url = sprintf('comment.php?action=deletecomment&c=%d%s', $comment->comment_ID, $orig_referer);
        }
        ?>
<img localsrc="61" /><a href="<?php 
        echo esc_attr($delete_url);
        ?>
"><font color="fuchsia"><?php 
        echo $button;
        ?>
</font></a>
<input type="hidden" name="c" value="<?php 
        echo intval($comment->comment_ID);
        ?>
" />
<input type="hidden" name="p" value="<?php 
        echo intval($comment->comment_post_ID);
        ?>
" />
<input type="hidden" name="noredir" value="1" />
</div>
</form>
<?php 
        include dirname(__FILE__) . '/admin-footer.php';
    }
 function ks_add_fix_encoding_form($form)
 {
     return $form . ks_fix_encoding_form(false);
 }
    public function output()
    {
        global $action, $post_ID, $temp_ID, $post, $post_referredby;
        $notice = false;
        if (0 == $post_ID) {
            $temp_ID = -1 * time();
            // don't change this formula without looking at wp_write_post()
            $form_action = 'post';
            $nonce_action = 'add-page';
            $slug_optional = ' ' . __('(Optional)', 'ktai_style');
            $form_extra = '<input type="hidden" name="temp_ID" value="' . intval($temp_ID) . '" />';
        } else {
            $form_action = 'editpost';
            $nonce_action = 'update-page_' . $post_ID;
            $slug_optional = '';
            $form_extra = '<input type="hidden" name="post_ID" value="' . intval($post_ID) . '" />';
        }
        $can_publish = current_user_can('publish_pages');
        include dirname(__FILE__) . '/admin-header.php';
        if ($notice) {
            ?>
<p><font color="red"><?php 
            echo $notice;
            ?>
</font></p>
<?php 
        }
        if (isset($this->message)) {
            ?>
<p><font color="teal"><?php 
            echo $this->messages[$this->message];
            ?>
</font></p>
<?php 
        }
        ?>
<form method="post" action="page.php"><div>
<?php 
        $this->admin->sid_field();
        ks_fix_encoding_form();
        wp_nonce_field($nonce_action, "_wpnonce", false);
        ?>
<input type="hidden" name="action" value='<?php 
        echo $form_action;
        ?>
' />
<input type="hidden" name="originalaction" value="<?php 
        echo $form_action;
        ?>
" />
<input type="hidden" name="post_author" value="<?php 
        echo $post->post_author;
        ?>
" />
<input type="hidden" name="referredby" value="<?php 
        echo esc_attr($post_referredby);
        ?>
" />
<?php 
        if ('draft' != $post->post_status) {
            ?>
<input type="hidden" name="_wp_original_http_referer" value="<?php 
            echo esc_attr($this->orig_referer);
            ?>
" />
<?php 
        }
        echo $form_extra;
        _e('Title');
        ?>
<br />
<input type="text" name="post_title" size="32" maxlength="999" tabindex="1" value="<?php 
        echo $post->post_title;
        ?>
" /><br />
<?php 
        if ($can_publish) {
            _e('Slug');
            echo esc_html($slug_optional);
            ?>
<br />
<input type="text" name="post_name" size="24" maxlength="999" istyle="3" mode="alphabet" tabindex="2" value="<?php 
            echo $post->post_name;
            ?>
" /><br />
<?php 
        }
        _e('Content', 'ktai_style');
        ?>
<br />
<?php 
        $this->admin->the_editor($post->post_content);
        ?>
<div><label><input type="checkbox" name="comment_status" tabindex="6" value="open" <?php 
        checked($post->comment_status, 'open');
        ?>
 /><?php 
        _e('Allow Comments');
        ?>
</label><br />
<label><input type="checkbox" name="ping_status" tabindex="7" value="open" <?php 
        checked($post->ping_status, 'open');
        ?>
 /> <?php 
        _e('Allow Pings');
        ?>
</label></div>
<?php 
        $referer = $this->orig_referer ? $this->orig_referer : $post_referredby;
        if ($referer && $referer != 'redo') {
            if (preg_match('!/page(-new)?\\.php(\\?|$)!', $referer)) {
                $referer = 'edit-pages.php';
            }
            if ($this->message) {
                printf(__('<a href="%s">Back to lists</a>', 'ktai_style'), esc_attr($referer));
            } else {
                printf(__('<a href="%s">Cancel Edit</a>', 'ktai_style'), esc_attr($referer));
            }
        }
        ?>
 <input type="submit" name="save" tabindex="8" value="<?php 
        _e('Save');
        ?>
" />
<?php 
        if (!in_array($post->post_status, array('publish', 'future', 'private')) || 0 == $post->ID) {
            if ($can_publish) {
                ?>
<input type="submit" name="publish" tabindex="9" value="<?php 
                _e('Publish');
                ?>
" /><?php 
            } else {
                ?>
<input type="submit" name="publish" tabindex="p" value="<?php 
                _e('Submit for Review');
                ?>
" /><?php 
            }
        }
        if ('edit' == $action && current_user_can('delete_page', $post->ID)) {
            if (function_exists('wp_trash_post') && EMPTY_TRASH_DAYS) {
                $delete_url = sprintf('page.php?action=trash&post=%d', $post->ID);
                $delete_url = wp_nonce_url($delete_url, "trash-page_{$post->ID}");
                $delete_text = __('Move to Trash');
            } else {
                $delete_url = sprintf('page.php?action=delete&post=%d', $post->ID);
                $delete_text = __('Delete');
            }
            ?>
<br /><img localsrc="61" /><a href="<?php 
            echo esc_attr($delete_url);
            ?>
"><font color="fuchsia"><?php 
            echo $delete_text;
            ?>
</font></a><?php 
        }
        ?>
<hr />
<?php 
        if ('publish' == $post->post_status || 'private' == $post->post_status || $can_publish) {
            _e('Status');
            ?>
: 
<select name="post_status">
<?php 
            if ('publish' == $post->post_status) {
                ?>
<option<?php 
                selected($post->post_status, 'publish');
                ?>
 value='publish'><?php 
                _e('Published');
                ?>
</option>
<?php 
            } elseif ('private' == $post->post_status) {
                ?>
<option<?php 
                selected($post->post_status, 'private');
                ?>
 value='publish'><?php 
                _e('Privately Published', 'ktai_style');
                ?>
</option>
<?php 
            } elseif ('future' == $post->post_status) {
                ?>
<option<?php 
                selected($post->post_status, 'future');
                ?>
 value='future'><?php 
                _e('Scheduled');
                ?>
</option>
<?php 
            }
            ?>
<option<?php 
            selected($post->post_status, 'pending');
            ?>
 value='pending'><?php 
            _e('Pending Review');
            ?>
</option>
<option<?php 
            selected($post->post_status, 'draft');
            ?>
 value='draft'><?php 
            _e('Draft');
            ?>
</option>
</select>
<br />
<?php 
        }
        _e('Visibility:', 'ktai_style');
        ?>
 <?php 
        if ('private' == $post->post_status) {
            $post->post_password = '';
            $visibility = 'private';
            $visibility_trans = __('Private');
        } elseif (!empty($post->post_password)) {
            $visibility = 'password';
            $visibility_trans = __('Password protected', 'ktai_style');
        } else {
            $visibility = 'public';
            $visibility_trans = __('Public', 'ktai_style');
        }
        echo esc_html($visibility_trans);
        ?>
<br /><?php 
        if ($can_publish) {
            ?>
<label><input type="checkbox" name="visibility" tabindex="10" value="private" <?php 
            checked($visibility, 'private');
            ?>
 /><?php 
            _e('Turn to private', 'ktai_style');
            ?>
</label><br /><?php 
        }
        ?>
<label for="parent_id"><?php 
        _e('Parent Page:', 'ktai_style');
        ?>
</label><br />
<?php 
        wp_dropdown_pages(array('exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('Main Page (no parent)'), 'sort_column' => 'menu_order, post_title'));
        ?>
<br />
<label for="menu_order"><?php 
        _e('Page Order:', 'ktai_style');
        ?>
</label>
<input name="menu_order" type="text" size="4" value="<?php 
        echo $post->menu_order;
        ?>
" />
<?php 
        if ($post_ID) {
            echo '<br />';
            if ($last_id = get_post_meta($post_ID, '_edit_last', true)) {
                $last_user = get_userdata($last_id);
                printf(__('Last edited by %1$s on %2$s at %3$s'), esc_html($last_user->display_name), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
            } else {
                printf(__('Last edited on %1$s at %2$s'), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
            }
        }
        ?>
</div></form>
<?php 
        include dirname(__FILE__) . '/admin-footer.php';
    }
    private function show_form($errors = array())
    {
        global $user_ID, $title, $comment, $id;
        $comment = intval($_GET['replytocom']);
        if (!($comment = get_comment($comment))) {
            $this->base->ks_die(__('Oops, no comment with this ID.'));
        }
        $title = __('Comment Reply', 'ktai_style');
        include dirname(__FILE__) . '/admin-header.php';
        $id = $comment->comment_post_ID;
        echo '<h2>' . sprintf(__('Comments for %s', 'ktai_style'), get_the_title($id)) . '</h2>';
        ?>
<img localsrc="<?php 
        comment_type(68, 112, 112);
        ?>
" alt="" /><?php 
        ks_comment_author_link();
        ?>
<img localsrc="46" alt=" @ " /><font color="<?php 
        echo ks_option('ks_date_color');
        ?>
"><?php 
        ks_comment_datetime();
        ?>
</font><br />
	<?php 
        comment_text();
        ?>
	<hr />
	<h3><?php 
        _e('Reply to the above comment', 'ktai_style');
        ?>
</h3>
	<?php 
        if ($errors) {
            ?>
<p><font color="red"><?php 
            echo implode('<br />', array_map('wp_specialchars', $errors));
            ?>
</font></p>
	<?php 
        }
        ?>
<form action="" method="post">
<input type="hidden" name="action" value="post" />
<input type="hidden" name="redirect_to" value="<?php 
        echo esc_attr($this->admin->get_referer());
        ?>
" />
<?php 
        $this->admin->sid_field();
        ks_fix_encoding_form();
        ?>
	<p><?php 
        _e('Comment', 'ktai_style');
        if (ks_option('ks_allow_pictograms')) {
            _e('(Pictograms Available)', 'ktai_style');
        }
        ?>
<br />
	<textarea name="content" cols="100%" rows="4"></textarea><br />
	<a href="<?php 
        echo esc_attr($this->admin->get_referer());
        ?>
"><?php 
        _e('Cancel reply', 'ktai_style');
        ?>
</a><br />
	<input type="submit" name="submit" value="<?php 
        _e('Say It!');
        ?>
" />
	<?php 
        if (function_exists('comment_id_fields')) {
            comment_id_fields($id);
        } else {
            ?>
		<input type="hidden" name="comment_post_ID" value="<?php 
            echo intval($id);
            ?>
" />
	<?php 
        }
        ks_do_comment_form_action();
        ?>
	</p></form>
<?php 
        include dirname(__FILE__) . '/admin-footer.php';
    }