2 // testing & develop for function send [multimail bugless send capatibility]
5 if (empty($_SESSION['user_id']) || empty($_SESSION['user_name'])) {
7 $error=" poradi redtime:-))";
11 $user_id=$_SESSION['user_id'];
12 $user_name=$_SESSION['user_name'];
13 $mail_name=$_POST['mail_to'];
14 $mail_name=mysql_escape_string($mail_name);
15 $mail_to=explode(";",$mail_name);
16 $mail_text=$_POST['mail_text'];
17 $nohtml=$_POST['nohtml'];
21 if (count($mail_to)==1) {
22 $q="select user_id from users where login='$mail_name'";
23 $result=$db->query($q);
25 $to=$result->getRecord();
26 if (!$to['user_id']) {
28 $error="Dana osobka ktorej by si chcel poslat spravicku si bud zmenila nick alebo robis preklepy.[dosla mi fantazia pri vymyslani err msg...na picu..]";
30 else {$mail_to_id[]=$to['user_id'];}
33 elseif (count($mail_to)>1) {
34 foreach ($mail_to as $mail_to_exploded) {
35 $q="select user_id from users where login='$mail_to_exploded'";
36 $result=$db->query($q);
38 $to=$result->getRecord();
39 if (!$to['user_id']) {
41 $error="Pravdepodobne si osobka $mail_to_exploded zmenila nick alebo mas niekde preklep. Skus to pravit a potom try again:-]";
43 else {$mail_to_id[]=$to['user_id'];}
48 if (empty($mail_text)) {
50 $error="Prilis kratka sprava. Syr vesela krava, student prava a ci
57 $mail_text=nodes::processContent($mail_text);
63 foreach ($mail_to_id as $mail_to_id_send) {
64 $q="insert into mail set
65 mail_user='$user_id',mail_read='no',
66 mail_from='$user_id',mail_text='$mail_text',mail_to='$mail_to_id_send',mail_timestamp=NOW()";
67 $result=$db->query($q);
68 $duplicate_id=$db->getLastInsertId();
69 $q="insert into mail set mail_duplicate_id='$duplicate_id',
70 mail_read='no',mail_user='$mail_to_id_send',mail_from='$user_id',mail_text='$mail_text',
71 mail_to='$mail_to_id_send',mail_timestamp=NOW()";
72 $result=$db->query($q);
73 $db->query("update users set user_mail=user_mail+1,
74 user_mail_name='$user_name' where user_id='$mail_to_id_send'");
82 $error="user $mail_to does not exist";