test3
[mirrors/Kyberia-bloodline.git] / trash / send2.inc
CommitLineData
51ff3226 1<?php
2// testing & develop for function send [multimail bugless send capatibility]
3 function send2() {
4 global $db;
5if (empty($_SESSION['user_id']) || empty($_SESSION['user_name'])) {
6global $error;
7$error=" poradi redtime:-))";
8return false;
9}
10
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'];
18
19
20
21 if (count($mail_to)==1) {
22 $q="select user_id from users where login='$mail_name'";
23 $result=$db->query($q);
24 $result->next();
25 $to=$result->getRecord();
26 if (!$to['user_id']) {
27 global $error;
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..]";
29 return false; }
30 else {$mail_to_id[]=$to['user_id'];}
31 }
32
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);
37 $result->next();
38 $to=$result->getRecord();
39 if (!$to['user_id']) {
40 global $error;
41 $error="Pravdepodobne si osobka $mail_to_exploded zmenila nick alebo mas niekde preklep. Skus to pravit a potom try again:-]";
42 return false; }
43 else {$mail_to_id[]=$to['user_id'];}
44 }
45 }
46
47
48 if (empty($mail_text)) {
49 global $error;
50 $error="Prilis kratka sprava. Syr vesela krava, student prava a ci
51dobra trava?";
52return false;
53 }
54
55 if ($mail_to_id) {
56
57 $mail_text=nodes::processContent($mail_text);
58global $htmlparse;
59if ($htmlparse) {
60$error=$htmlparse;
61return false;
62}
63foreach ($mail_to_id as $mail_to_id_send) {
64 $q="insert into mail set
65mail_user='$user_id',mail_read='no',
66mail_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',
70mail_read='no',mail_user='$mail_to_id_send',mail_from='$user_id',mail_text='$mail_text',
71mail_to='$mail_to_id_send',mail_timestamp=NOW()";
72 $result=$db->query($q);
73 $db->query("update users set user_mail=user_mail+1,
74user_mail_name='$user_name' where user_id='$mail_to_id_send'");
75 }
76 return true;
77
78 }
79
80 else {
81 global $error;
82 $error="user $mail_to does not exist";
83 return false;
84 }
85 }
86
87
88?>
This page took 0.382477 seconds and 4 git commands to generate.