Added rudimentary transport support to get_threaded_children
[mirrors/Kyberia-bloodline.git] / wwwroot / inc / eventz / send.inc
CommitLineData
51ff3226 1<?php
2// [multimail buless send capatibility]
3 function send() {
4 global $db;
5if (empty($_SESSION['user_id']) || empty($_SESSION['user_name'])) {
6global $error;
7$error="Ak sa toto stane a citas tuto spravu chod navstivit buglist....ak robis picoviny a vidis tuto spravu tak ti uz ani buglist nepomoze a chod sa odjebat hackere:-)";
8return false;
9}
10
11 $user_id=mysql_real_escape_string($_SESSION['user_id']);
12 $user_name=mysql_real_escape_string($_SESSION['user_name']);
13 $mail_name=mysql_real_escape_string($_POST['mail_to']);
14
15 if (!$mail_name) {
16 global $error;
17 $error="Posta sa len tak nikomu neposiela.Co takto zadat aspon adresata??hm??";
18 return false;}
19 $mail_to=explode(";",$mail_name);
20 $mail_text=$_POST['mail_text'];
21 $nohtml=$_POST['nohtml'];
22
23 if (count($mail_to)==1) {
24 $q="select user_id from users where login='".$mail_name."'";
25 $result=$db->query($q);
26 $result->next();
27 $to=$result->getRecord();
28 if (!$to['user_id']) {
29 global $error;
30 $error="Dana osobka ktorej by si chcel poslat spravicku si bud zmenila nick alebo robis preklepy.";
31 return false;
32 }
096a21e4 33 /* // fuck off toth
51ff3226 34 elseif ($user_id == 1859269 && $to['user_id'] == 2334) {
35 global $error;
36 $error = 'fuck you!';
37 return false;
096a21e4 38 } */
51ff3226 39 else {
40 $mail_to_id[]=$to['user_id'];
41 }
42 }
43
44 elseif (count($mail_to)>1) {
45 foreach ($mail_to as $mail_to_exploded) {
46 $q="select user_id from users where login='$mail_to_exploded'";
47 $result=$db->query($q);
48 $result->next();
49 $to=$result->getRecord();
50 if (!$to['user_id']) {
51 global $error;
52 $error="Pravdepodobne si osobka $mail_to_exploded zmenila nick alebo mas niekde preklep. Skus to opravit a potom try again:-]";
53 return false; }
096a21e4 54 /* // fuck off toth
51ff3226 55 elseif ($user_id == 1859269 && $to['user_id'] == 2334) {
56 global $error;
57 $error = 'fuck you!';
58 return false;
096a21e4 59 } */
51ff3226 60 else {$mail_to_id[]=$to['user_id'];}
61 }
62 }
63
64 if (empty($mail_text)) {
65 global $error;
66 $error="Prilis kratka sprava. Syr vesela krava, student prava a ci
67dobra trava?";
68return false;
69 }
70
71 if ($mail_to_id) {
72
742ed94c 73 $mail_text=mysql_real_escape_string(nodes::processContent($mail_text));
51ff3226 74global $htmlparse;
75if ($htmlparse) {
76$error=$htmlparse;
77return false;
78}
79foreach ($mail_to_id as $mail_to_id_send) {
80 $q="insert into mail set
81mail_user='$user_id',mail_read='no',
82mail_from='$user_id',mail_text='$mail_text',mail_to='$mail_to_id_send',mail_timestamp=NOW()";
83 $result=$db->query($q);
84 $duplicate_id=$db->getLastInsertId();
85 $q="insert into mail set mail_duplicate_id='$duplicate_id',
86mail_read='no',mail_user='$mail_to_id_send',mail_from='$user_id',mail_text='$mail_text',
87mail_to='$mail_to_id_send',mail_timestamp=NOW()";
cb7733d8
H
88 $result=$db->query($q);
89 $db->query("update users set user_mail=user_mail+1,".
90 //"user_mail_name='$user_name',". //Not in DB yet!
91 "user_mail_id='".mysql_real_escape_string($_SESSION['user_id'])."' where user_id='$mail_to_id_send'");
51ff3226 92 }
93 return true;
94
95 }
96
97 else {
98 global $error;
99 $error="user $mail_to does not exist";
100 return false;
101 }
102 }
103
104
096a21e4 105?>
This page took 1.153946 seconds and 4 git commands to generate.