') $offset+=$limit; if ($event=='<') $offset-=$limit; if ($event=='<<') $offset='0'; if ($event=='>>') $offset=$count-$limit; if ($offset<0) $offset=0; if ($offset+$limit>$count AND $limit<$count) $offset=$count-$limit; elseif ($offset+$limit>$count AND $limit>$count) $offset=0; // koniec sofistikovanej bitch if ($user_mail>0) { $kyberia->query("update user set user_mail='0' where id=$user_id"); $set=$kyberia->query("select * from mail2 where mail_to='$user_id' and mail_read='no'"); while($set->next()) { $kyberia->query("update mail2 set mail_read='yes' where mail_id='".$set->getString('mail_duplicate_id')."'"); } } $q="select date_format(mail2.mail_timestamp,\"%e.%c. %k:%i:%s\") as cas ,locationfrom.user_action as locationfrom_action,locationfrom.user_action_name as locationfrom_action_name,locationfrom.user_action_id as locationfrom_action_id,locationto.user_action as locationto_action,locationto.user_action_name as locationto_action_name,locationto.user_action_id 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 "; $q.="where mail_user='$user_id' "; if ($event=="hladat") $q.=" and (mail_text like '%$mail_text%') "; if (is_numeric($_GET['from'])) { $q .= " and (mail_from={$_GET[from]} || mail_to={$_GET[from]}) "; } $q.="order by mail_id desc limit $offset,$limit"; $result=$kyberia->query($q); if ($_GET['mail_name']) $mail_name=$_GET['mail_name']; ?>