예제 #1
0
 function CommentForm($template)
 {
     global $UserDB;
     $UserDB->verify("headers_sent");
     $output = '<form method="post" action="" id="' . SCRIPT_TITLE . '_addcommentform" name="comment">';
     $output .= $template[commentform];
     $output = preg_replace("/\\[save\\=\"(.*)\"\\]/ui", "<input name=\"comment[save]\" type=\"submit\" value=\"\\1\" />", $output);
     $output = preg_replace("/\\[preview\\=\"(.*)\"\\]/ui", "<input name=\"comment[preview]\" type=\"submit\" value=\"\\1\" />", $output);
     $output = str_replace("{allowedtags}", kses_filter("gettags"), $output);
     if ($UserDB->username) {
         $output = str_replace("{cookiename}", $UserDB->nickname, $output);
         $output = str_replace("{cookiemail}", $UserDB->email, $output);
         $output = str_replace("{cookieurl}", $UserDB->url, $output);
     } else {
         $output = str_replace("{cookiename}", '', $output);
         $output = str_replace("{cookiemail}", '', $output);
         $output = str_replace("{cookieurl}", '', $output);
     }
     $output .= '</form>';
     return $output;
 }
예제 #2
0
function kses_printtags($output, $hook)
{
    $output = str_replace("{allowedtags}", kses_filter("gettags", "no-hook"), $output);
    return $output;
}
                if ($Userclass->username) {
                    $_POST[comment][name] = $match[name];
                    # No error, we're good to go
                } else {
                    $errors .= $userverifymessage;
                }
            } else {
                $errors .= $userverifymessage;
            }
        }
    }
    if (!$errors) {
        $newcommentid = time();
        $savecomment = array('parentcid' => stripslashes($_GET[replyto]), 'name' => stripslashes($_POST[comment][name]), 'email' => stripslashes($_POST[comment][email]), 'url' => stripslashes($_POST[comment][url]), 'ip' => '127.0.0.1', 'browser' => $_SERVER["HTTP_USER_AGENT"], 'content' => stripslashes($_POST[comment][content]));
        $commentsclass = new CommentStorage('comments');
        $commentsclass->settings[$date][$newcommentid] = $savecomment;
        $commentsclass->save();
        #FIXME: Redirect javascript doesn't work on all servers
        echo "<script type=\"text/javascript\">self.location.href='http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}';</script>";
    } else {
        echo "<div id=\"Commentposterrors\"><h1>" . i18n("generic_error") . "</h1><p>" . i18n("visible_comment_error_info") . "</p><ol>{$errors}</ol></div>";
    }
}
#
#	Show the comment form
#
$output = '<form method="post" action="">';
$output .= $template[commentform];
$output = str_replace("{allowedtags}", kses_filter("gettags"), $output);
$output .= '</form>';
echo $output;