function DisplayItem Id Page Edit TRUE Delete TRUE global Language if

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
function DisplayItem($Id, $Page, $Edit = TRUE, $Delete = TRUE)
{
global $Language;
if($this->Exists($Id))
{
$Comments = $this->Get($Id);
OpenTable();
if(!empty($this->Authors[$Comments['author']]))
{
$Author['email'] = $this->Authors[$Comments['author']]['email'];
$Author['icq'] = $this->Authors[$Comments['author']]['icq'];
$Author['status'] = $this->Authors[$Comments['author']]['status'];
$Author['signature'] = $this->Authors[$Comments['author']]['signature'];
$Author['avatar'] = $this->Authors[$Comments['author']]['avatar'];
echo "<table width=\"100%\"><tr>\n<td align=\"left\"><img src=\"images/modules/comment.png\" align=\"absmiddle\"> ";
echo "<a href=\"?module=profiles&user=".$Comments['author']."\">".$Comments['author']."</a>
| <img src=\"images/modules/date.png\" align=\"absmiddle\"> ".date('j.m.y G:i', $Comments['date']);
if($this->Rating)
{
echo " | <span id=\"CommentRating".$Id."\"><b>".$Comments['rating'];
if(!empty($_SESSION['Login']) && IsUser($_SESSION['Login'], $_SESSION['Password']) && $_SESSION['Login'] != $Comments['author'] && !in_array($Id, $_SESSION['CommentsVotes']) && $this->Rating)
{
echo " <a href=\"#\" onClick=\"SetRating('".$Id."', 1); return false;\"><img src=\"images/modules/good.png\" border=\"0\" align=\"absmiddle\" title=\"$Language[142]\" alt=\"$Language[142]\"></a>
<a href=\"#\" onClick=\"SetRating('".$Id."', 2); return false;\"><img src=\"images/modules/bad.png\" border=\"0\" align=\"absmiddle\" title=\"$Language[143]\" alt=\"$Language[143]\"></a>";
}
}
echo "</b></span>
</td>
<td align=\"right\">\n";
if(!empty($_SESSION['Login']) && IsUser($_SESSION['Login'], $_SESSION['Password']) && $_SESSION['Login'] != $Comments['author'])
{
echo "<a href=\"?module=profiles&action=messages&do=new&to=".$Comments['author']."\"><img src=\"images/modules/inbox.png\" border=\"0\" title=\"$Language[96]\"></a>\n";
}
if(UTF8::strwidth($Author['email']) > 0)
{
echo " <a href=\"?module=contact&user=".$Comments['author']."\"><img src=\"images/modules/mail.png\" title=\"$Language[23]\"></a>\n";
}
if(UTF8::strwidth($Author['icq']) > 0)
{
echo " <a href=\"http://www.icq.com/people/about_me.php?uin=".$Author['icq']."\"><img src=\"images/modules/icq.png\" title=\"".$Author['icq']."\"></a>\n";
}
if (UTF8::strwidth($Author['status']) > 0)
{
echo " <img src=\"images/modules/status.png\" title=\"".$Author['status']."\">\n";
}
if (UTF8::strwidth($Author['signature']) > 0)
{
echo " <img src=\"images/modules/text.png\" title=\"".$Author['signature']."\">\n";
}
echo "</td></tr>\n</table>\n";
echo "<hr>\n";
if(!empty($Author['avatar']) && $Author['avatar'] !== 0 && file_exists($Author['avatar']))
{
echo "<img src=\"".$Author['avatar']."\" align=\"left\"> \n";
} else {
echo "<img src=\"images/modules/user.png\" align=\"left\"> \n";
}
} else {
echo "<img src=\"images/modules/comment.png\" align=\"absmiddle\">\n <b>".$Comments['author']." : </b>\n <img src=\"images/modules/date.png\" align=\"absmiddle\">\n ".date('j.m.y G:i', $Comments['date']);
if($this->Rating)
{
echo " | <span id=\"CommentRating".$Id."\"><b>".$Comments['rating'];
if(!empty($_SESSION['Login']) && IsUser($_SESSION['Login'], $_SESSION['Password']) && $_SESSION['Login'] != $Comments['author'] && !in_array($Id, $_SESSION['CommentsVotes']))
{
echo " <a href=\"#\" onClick=\"SetRating('".$Id."', 1); return false;\"><img src=\"images/modules/good.png\" border=\"0\" align=\"absmiddle\" title=\"$Language[142]\" alt=\"$Language[142]\"></a>
<a href=\"#\" onClick=\"SetRating('".$Id."', 2); return false;\"><img src=\"images/modules/bad.png\" border=\"0\" align=\"absmiddle\" title=\"$Language[143]\" alt=\"$Language[143]\"></a>";
}
}
echo "</b></span>
<hr>";
}
echo ParseBb($Comments['text']);
if($this->IsOwner($Id))
{
echo "<hr>";
$Toolbar = new Toolbar();
if($Edit)
{
$Toolbar->Add('?module=edit&where='.$this->Module .'&id='.$this->Item .'&edit='.$Comments['id'], '', 'images/modules/edit.png', $Language[17]);
}
if($Delete)
{
$Toolbar->Add(preg_replace('/(\&|\?)?delete=[\x21-\x7E]+/i' , '', $_SERVER['REQUEST_URI']).'&delete='.$Comments['id'], '', 'images/modules/delete.png', $Language[66]);
$Toolbar->Display('right');
}
}
echo "<hr>";
CloseTable();
}
}