comments completely usable
git-svn-id: http://yolanda.mister-muffin.de/svn@125 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
parent
99165b3be3
commit
f4de6ea494
3 changed files with 27 additions and 2 deletions
|
@ -142,7 +142,7 @@ $dbh->do(qq{create table
|
||||||
id int auto_increment not null,
|
id int auto_increment not null,
|
||||||
userid int not null,
|
userid int not null,
|
||||||
videoid int not null,
|
videoid int not null,
|
||||||
message varchar(255) not null,
|
text varchar(255) not null,
|
||||||
primary key (id)
|
primary key (id)
|
||||||
)
|
)
|
||||||
}) or die $dbh->errstr;
|
}) or die $dbh->errstr;
|
||||||
|
|
|
@ -70,7 +70,7 @@ if($query->param('title') or $query->param('id'))
|
||||||
#check if a comment is about to be created and the user is logged in
|
#check if a comment is about to be created and the user is logged in
|
||||||
if($query->param('comment') and $userid = get_userid_from_sid($session->id))
|
if($query->param('comment') and $userid = get_userid_from_sid($session->id))
|
||||||
{
|
{
|
||||||
$dbh->do(qq{insert into comments (userid, videoid, message) values (?, ?, ?)}, undef, $userid, $id, $query->param('comment')) or die $dbh->errstr;
|
$dbh->do(qq{insert into comments (userid, videoid, text) values (?, ?, ?)}, undef, $userid, $id, $query->param('comment')) or die $dbh->errstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if referer is not the local site update referer table
|
#if referer is not the local site update referer table
|
||||||
|
@ -127,6 +127,18 @@ if($query->param('title') or $query->param('id'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#get comments
|
||||||
|
$sth = $dbh->prepare(qq{select comments.text, users.username from comments, users where
|
||||||
|
comments.videoid=? and users.id=comments.userid});
|
||||||
|
$sth->execute($id);
|
||||||
|
while (my ($text, $username) = $sth->fetchrow_array())
|
||||||
|
{
|
||||||
|
push @{ $page->{'comments'}->{'comment'} }, {
|
||||||
|
'text' => decode_utf8($text),
|
||||||
|
'user' => $username
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -501,6 +501,19 @@
|
||||||
<input type="submit" name="send" />
|
<input type="submit" name="send" />
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<table class="videometadata">
|
||||||
|
<xsl:for-each select="/page/comments/comment">
|
||||||
|
<tr>
|
||||||
|
<td class="leftcell">
|
||||||
|
<xsl:value-of select="@user" />
|
||||||
|
</td>
|
||||||
|
<td class="rightcell">
|
||||||
|
<xsl:value-of select="@text" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</xsl:for-each>
|
||||||
|
</table>
|
||||||
|
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue