} else { header('Location: http://' . get_server_name() . $globals['base_url']); die; } $link = new Link(); $link->id = $comment->link; if (!$link->read()) { header('Location: http://' . get_server_name() . $globals['base_url']); die; } //$globals['link']=$link; //$globals['link_id']=$link->id; if ($_POST['process'] == 'editcomment') { save_comment(); } else { print_edit_form(); } function print_edit_form() { global $link, $comment, $current_user, $site_key, $globals; if ($current_user->user_level != 'god' && time() - $comment->date > $globals['comment_edit_time'] || $current_user->user_level == 'god' && time() - $comment->date > 10800) { // Allow the admin die; } $rows = min(40, max(substr_count($comment->content, "\n") * 2, 8)); echo '<div id="commentform" align="left">' . "\n"; echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post" id="thisform" style="display:inline;">' . "\n"; echo '<fieldset><legend><span class="sign">' . _('editar comentario') . '</span></legend>' . "\n"; echo '<div style="float: right;">'; print_simpleformat_buttons('comment'); echo '</div>';
if (!$comment) { die; } $link_id = $comment->link; } $link = Link::from_db($link_id); if (!$link) { die; } if (!$current_user->authenticated || $current_user->user_karma < $globals['min_karma_for_comments'] || $current_user->user_date > $globals['now'] - $globals['min_time_for_comments'] && $current_user->user_id != $link->author) { die; } if ($_POST['process'] == 'editcomment') { save_comment($comment, $link); } else { print_edit_form($comment, $link); } function print_edit_form($comment, $link) { global $current_user, $site_key, $globals, $reply_to; $data = array(); $html = ''; if ($comment->id == 0) { $comment->randkey = rand(1000000, 100000000); } $html .= '<div class="commentform">'; $html .= '<form action="' . $globals['base_url'] . "comment_ajax?reply_to={$reply_to}&link={$link->id}&id={$comment->id}&user={$current_user->user_id}" . '" class="comment" method="post" enctype="multipart/form-data" id="c_edit_form">'; $html .= '<input type="hidden" name="randkey" value="' . $comment->randkey . '" />'; $html .= '<input type="hidden" name="process" value="editcomment" />'; $html .= '<input type="hidden" name="key" value="' . md5($comment->randkey . $site_key) . '" />'; $html .= '<input type="hidden" name="id" value="' . $comment->id . '" />';