ŹŻĄćź示ćŻ谁ŻąŻĄ贴ć分żHACK


ą޸żźŁUTLanguage.pmŁŹpost_rate_x.cgiŁŹtopic_show.cgi
ó޸ĘżŻż

1Ąóż UTLanguage.pm

$lng{'topicEditedOn'} = "ąąźÓ";
ćźÓ
$lng{'topicRatedOn'} = "Ó";

2Ąó޸ĺó post_rate_x.cgi łłĄ

3Ąóż topic_show.cgi


my $editTimeStr = ($post->{'editTime'} && $post->{'editTime'} - $post->{'postTime'} > 60) ? "
$post->{'editedBy'} $lng{'topicEditedOn'} " . formatTime($post->{'editTime'}) . "
\n" : "";

ćźÓ

my $rateTimeStr = ($post->{'rateTime'} != "") ? "
$post->{'ratedBy'} $lng{'topicRatedOn'} " . formatTime($post->{'rateTime'}) . "
\n" : "";



"
$ip
$editTimeStr\n";
޸ł

"
$ip
$editTimeStr
$rateTimeStr\n";

4Ąó޸ĘżŻż ut_posts ą

editTime editedBy óćźÓś rateTime ratedBy
śĄąͲʿ朣ŹŁŃł

ź

#!/usr/bin/perl
#------------------------------------------------------------------------------
# UltraThreads
# Copyright (c) 2000 Kelvin Wu
#
# 2001.04
#------------------------------------------------------------------------------

use strict;

# Imports
use CGI::Carp qw(fatalsToBrowser);
use DBI;
use UTConfig;
use UTLanguage;
use UTMain;
use UTCGI;

#------------------------------------------------------------------------------

# Get user
connectDb();
my $user = authUser();

# Check if forum is closed
printMessage("$lng{'forumClosedLb'}", "$lng{'forumClosed'}")
if $cfg{'forumClosed'} && !$user->{'admin'};

# Print HTTP header
printHttpHeader();

# Check if request is coming from this site
checkReferer();

# Get CGI parameters
my $cgi = new UTCGI;
my $postId = int($cgi->param('pid'));
my $bpg = int($cgi->param('bpg')) || 1;
my $pg = int($cgi->param('pg')) || 1;
my $mode = $cgi->param('mode');
my $rate = int($cgi->param('rate'));
$postId or paramError($lng{'errPstIdMiss'});

# Check if post has been rated or not
my $query = "SELECT rating, userId, boardId, topicId FROM ut_posts WHERE id = $postId";
my $sth = query($query);
my ($rating, $userId, $boardId, $topicId) = $sth->fetchrow_array();
$userId or entryError($lng{'errPstNotFnd'});
$sth->finish;

# Check if user is forum/board admin
$user->{'admin'} || $user->{'superMod'} || boardAdmin($user->{'id'}, $boardId) or adminError();

# Quote texts
my $ratedByQ = quote($user->{'userName'});

# Update score/rating
if ($rating == 0) {
# Update post rating
$query = "UPDATE ut_posts SET rating = $rate WHERE id = $postId";
$dbh->do($query) or dbError();

# Update user score
$query = "UPDATE ut_users SET score = score + $rate WHERE id = $userId";
$dbh->do($query) or dbError();

# Update post
my $now = time();
$query = "UPDATE ut_posts SET
rateTime = $now,
ratedBy = $ratedByQ
WHERE id = $postId";
$dbh->do($query) or dbError();
}

# Redirect back
($mode eq "f")
? redirect("topic_show.cgi?id=$topicId&bpg=$bpg&pg=$pg")
: redirect("threaded_show.cgi?tid=$topicId&pid=$postId&bpg=$bpg");


Wyszukiwarka

Podobne podstrony:
zza
ZUS ZZA
Sąsiedzi zza miedzy, Zaolzie – fakty i mity

więcej podobnych podstron