Файл: billing/_rootbill/_maillogs.inc.php
Строк: 87
<?
_head('utf-8',$_lang[MailLogsTitle]);
if ($sub == "delete" and $id and GetSetting('mailLogUserDelete')) {
$r=@mysql_query("select * from mail_logs where id='$id' and uid=".$_SESSION["userId"]) or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (mysql_num_rows($r) > 0) {
@mysql_query("delete from mail_logs where id='$id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
print $_lang[MailLogsDeleteSuccess]."<br><br>";
}
$sub = "";
}
if ($sub == "view") {
if (!$id) {print "<font color=red>".$_lang[ErrorBadId]."</font><br><br>";}
else {
$r=@mysql_query("select * from mail_logs where id='$id' and uid='".$_SESSION["userId"]."'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if (mysql_num_rows($r) == 0) {print "<font color=red>".$_lang[MailLogsErrorNoMail]."</font><br><br>";}
else {
$rr = mysql_fetch_object($r);
$mailLogUserDelete = GetSetting('mailLogUserDelete');
print "<table class='rpTable' cellpadding=3 border=1>";
$rr->subject = htmlDecode($rr->subject);
print "<tr><th align=center>".$_lang[MailLogsSubject].": <B>".$rr->subject."</b></th></tr>";
$rr->message = preg_replace("/rn/ui", "<BR>", htmlDecode($rr->message));
$rr->message = preg_replace("/n/ui", "<BR>", htmlDecode($rr->message));
$rr->message = preg_replace("/&/ui", "&", htmlDecode($rr->message));
if ($mailLogUserDelete) {
$delete="<A class=rootlink href=?do=$do&sub=delete&id=$rr->id onclick="javascript: return confirm('".$_lang[MailLogsDeleteAlert]."');"><img src=./_rootimages/del.gif border=0 alt='".$_lang[MailLogsDelete]."'>".$_lang[MailLogsDelete]."</a>";
} else {
$delete="";
}
print "<tr><th>".$_lang[MailLogsDate].": $rr->dt</th></tr>";
print "<tr bgcolor=$font_row1><td valign=top>$rr->message<Br><br></td></tr>";
print "<tr align=center><th valign=top>$delete</th></tr>";
print "</table>";
}
}
}
if (!$sub) {
$r=@mysql_query("select * from mail_logs where uid='".$_SESSION["userId"]."' order by id desc") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$rows = mysql_num_rows($r);
list($start, $perPage, $txt) = MakePages($page, $rows);
?>
<table class='rpTable' cellpadding=3 width=95% border=1>
<tr align=center><th>#</th><th><?=$_lang[MailLogsDate]?></th><th><?=$_lang[MailLogsSubject]?></th><th><?=$_lang[Option]?></th></tr>
<?
$r=@mysql_query("select * from mail_logs where uid='".$_SESSION["userId"]."' order by id desc LIMIT $start,$perPage") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$mailLogUserDelete = GetSetting('mailLogUserDelete');
$cnt=0;
while ($rr = @mysql_fetch_object($r)) {
getfont();
$cnt++;
if ($mailLogUserDelete) {
$delete="<A class=rootlink href=?do=$do&sub=delete&id=$rr->id onclick="javascript: return confirm('".$_lang[MailLogsDeleteAlert]."');"><img src=./_rootimages/del.gif border=0 alt='".$_lang[MailLogsDelete]."'></a>";
} else {
$delete="";
}
$rr->subject = htmlDecode($rr->subject);
?>
<tr bgcolor="<?=$font_row?>" height=30>
<td valign=middle> <?=$cnt?> </td>
<td> <?=$rr->dt?> </td>
<td> <a class=rootlink href=?do=<?=$do?>&sub=view&id=<?=$rr->id?>><?=$rr->subject?></a> </td>
<td align=center><?=$delete?></td>
</tr>
<?
}
?>
<tr><th colspan=4><?=$_lang[MailLogsTotalMail]?>: <?=$rows?>, <?=$_lang[MailLogsOnPage]?>: <?=$cnt?></th></tr>
<tr><th colspan=10 align=right><?=$txt?></th></tr>
</table><br>
<?
}
_foot('utf-8');
?>