| 1 | <?php |
| 2 | // navigacia! sofistikovana bitch |
| 3 | |
| 4 | if ($limit) $limit=$limit; |
| 5 | else $limit=$user_amount; |
| 6 | |
| 7 | if (empty($offset)) $offset=0; |
| 8 | if ($event=='>') $offset+=$limit; |
| 9 | if ($event=='<') $offset-=$limit; |
| 10 | if ($event=='<<') $offset='0'; |
| 11 | if ($event=='>>') $offset=$count-$limit; |
| 12 | if ($offset<0) $offset=0; |
| 13 | if ($offset+$limit>$count AND $limit<$count) $offset=$count-$limit; |
| 14 | elseif ($offset+$limit>$count AND $limit>$count) $offset=0; |
| 15 | // koniec sofistikovanej bitch |
| 16 | |
| 17 | |
| 18 | if ($user_mail>0) { |
| 19 | $kyberia->query("update user set user_mail='0' where id=$user_id"); |
| 20 | $set=$kyberia->query("select * from mail2 where mail_to='$user_id' and mail_read='no'"); |
| 21 | while($set->next()) { |
| 22 | $kyberia->query("update mail2 set mail_read='yes' where mail_id='".$set->getString('mail_duplicate_id')."'"); |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | $q="select date_format(mail2.mail_timestamp,\"%e.%c. %k:%i:%s\") as cas ,locationfrom.user_action as locationfrom_action,locationfrom.user_action_name |
| 27 | as locationfrom_action_name,locationfrom.user_action_id as locationfrom_action_id,locationto.user_action |
| 28 | as locationto_action,locationto.user_action_name as locationto_action_name,locationto.user_action_id |
| 29 | as locationto_action_id,userto.login as mail_to_name,userfrom.login as mail_from_name,locationfrom.user_name,mail2.* from mail2 left join user as userfrom on mail_from=userfrom.id left join user as userto on mail_to=userto.id left join session as locationto on mail_to=locationto.user_id left join session as locationfrom on mail_from=locationfrom.user_id "; |
| 30 | $q.="where mail_user='$user_id' "; |
| 31 | |
| 32 | if ($event=="hladat") $q.=" and (mail_text like '%$mail_text%') "; |
| 33 | |
| 34 | if (is_numeric($_GET['from'])) { |
| 35 | $q .= " and (mail_from={$_GET[from]} || mail_to={$_GET[from]}) "; |
| 36 | } |
| 37 | |
| 38 | $q.="order by mail_id desc limit $offset,$limit"; |
| 39 | $result=$kyberia->query($q); |
| 40 | |
| 41 | if ($_GET['mail_name']) $mail_name=$_GET['mail_name']; |
| 42 | ?> |
| 43 | <form name='posta' action='' method='post'> |
| 44 | <table><tr> |
| 45 | <td valign='top'> |
| 46 | <img src="/images/users/<?=$mail_name;?>.gif" name="fricon" border='0'><br> |
| 47 | <input type="text" class='textinput' value="<?=$mail_name?>" name="mail_to" size="8" onmouseout="vymena()"> |
| 48 | <br> |
| 49 | </td> |
| 50 | <td valign='top'><textarea style="width:510pt; height: 50pt;" name='mail_text' cols='66' rows='8'><?=$mail_text?></textarea> |
| 51 | <br clear='all'> |
| 52 | <?php Showz::showNav(); ?> |
| 53 | <br> |
| 54 | Zobrazit iba od: <input type="text" size="15" name="mail_from"> <input type="submit" value="filtrovat" name="event"><br> |
| 55 | <input type="submit" name="event" value="vymaz vsetko" style="width: 100px" onClick="return confirm('Chces si naozaj vymazat celu post?')"> |
| 56 | </td> |
| 57 | |
| 58 | </tr> |
| 59 | <?php |
| 60 | /* showing mail */ |
| 61 | |
| 62 | while ($result->next()) { |
| 63 | $mail=$result->getRecord(); |
| 64 | echo "<table class='bigitem'>"; |
| 65 | echo "<tr><td class='icon'>"; |
| 66 | echo "<img alt='",$mail['mail_from_name'],"' src='/images/users/",strtolower($mail['mail_from_name']),".gif'>"; |
| 67 | echo "</td>"; |
| 68 | echo "<td class='item'><table class='item'><tr class='header'>"; |
| 69 | echo "<td class='header'><a href=\"javascript:chngto('",$mail['mail_from_name'],"')\">",$mail['mail_from_name'],"</a>"; |
| 70 | //if (!empty($mail['locationfrom_action']) && $mail['mail_from']!=$user_id) Showz::showLocation($mail['locationfrom_action'],$mail['locationfrom_action_id'],$mail['locationfrom_action_name']); |
| 71 | if ($mail['mail_from']!=$user_id AND ($mail['locationfrom_action'])) { |
| 72 | echo " [lokacia:<a class='location' href='?action=",$mail['locationfrom_action']; |
| 73 | if ($mail['locationfrom_action']=="forum" OR $mail['locationfrom_action']=="journaux" OR $mail['locationfrom_action']=="article") echo "&node_id=".$mail['locationfrom_action_id']."'>",$mail['locationfrom_action_name']; |
| 74 | else echo "'>".$mail['locationfrom_action']; |
| 75 | echo "</a>] "; |
| 76 | } |
| 77 | echo " --> <a href=\"javascript:chngto('",$mail['mail_to_name'],"')\">",$mail['mail_to_name'],"</a>"; |
| 78 | |
| 79 | //if (!empty($mail['locationto_action']) && $mail['mail_to']!=$user_id) Showz::showLocation($mail['locationto_action'],$mail['locationto_action_id'],$mail['locationto_action_name']); |
| 80 | if ($mail['mail_to']!=$user_id AND ($mail['locationto_action'])) { |
| 81 | echo " [lokacia:<a class='location' href='?action=",$mail['locationto_action']; |
| 82 | if ($mail['locationto_action']=="forum" OR $mail['locationto_action']=="journaux" OR $mail['locationto_action']=="article") echo "&node_id=".$mail['locationto_action_id']."'>",$mail['locationto_action_name']; |
| 83 | else echo "'>".$mail['locationto_action']; |
| 84 | echo "</a>] "; |
| 85 | } |
| 86 | echo " -- <input class='delete' type='checkbox' name='delete[]' value='",$mail['mail_id'],"'>"; |
| 87 | echo $mail['cas']; |
| 88 | if ($mail['mail_read']=='no') { |
| 89 | echo " <font class='alert'>"; |
| 90 | if ($mail['mail_to']==$user_id) echo "NEW"; |
| 91 | elseif ($mail['mail_from']==$user_id) echo "UNDELIVERED"; |
| 92 | } |
| 93 | |
| 94 | echo "</td></tr><tr class='content'><td class='content'>"; |
| 95 | echo StripSlashes($mail['mail_text']); |
| 96 | echo "</tr></td>"; |
| 97 | echo "</table></tr></td></table>"; |
| 98 | |
| 99 | } |
| 100 | |
| 101 | if ($user_mail>0) { |
| 102 | $kyberia->query("update mail2 set mail_read='yes' where mail_to='$user_id' and mail_read='no'"); |
| 103 | } |
| 104 | |
| 105 | ?> |
| 106 | </table> |
| 107 | <form> |