51ff3226 |
1 | <?php |
2 | |
3 | function remove_users() { |
4 | global $permissions,$node,$db,$error; |
5 | $user_id=$_SESSION['user_id']; |
6 | $user_name=$_SESSION['user_name']; |
7 | |
0c936d6e |
8 | // XXX rewrite |
9 | |
e909f81b |
10 | require(INCLUDE_DIR."phpmailer.inc"); |
51ff3226 |
11 | $mail = new PHPMailer(); |
b6e35197 |
12 | $mail->IsSMTP(); // send via SMTP |
13 | $mail->Host = "molly.kyberia.cz"; // SMTP servers |
14 | $mail->From = "root@kyberia.cz"; |
15 | $mail->FromName = "kyberia.cz admin"; |
16 | $mail->WordWrap = 50; // set word wrap |
17 | $mail->Subject = "kyberia.cz neuspesna registracia"; |
51ff3226 |
18 | |
19 | |
20 | if (!$permissions['w']) { |
21 | $error="you don't have permissions for performing this event"; |
22 | return false; |
23 | } |
24 | |
25 | foreach ($_POST['waiting'] as $user =>$value) { |
26 | |
27 | $set=$db->query("select email,login,node_creator from users left join nodes on nodes.node_id=users.user_id where user_id='$user'"); |
28 | $set->next(); |
29 | $email=$set->getString('email'); |
30 | $login=$set->getString('login'); |
31 | |
32 | $application_id=$set->getString('node_creator'); |
51ff3226 |
33 | |
34 | $params['node_creator']=$user_id; |
35 | $params['node_parent']=$application_id; |
36 | $params['node_name']="$login refused"; |
37 | $params['node_content']="user $login was refused by $user_name"; |
38 | nodes::addNode($params); |
39 | |
40 | $db->query("delete from users where user_id='$user' and user_status='waiting'"); |
41 | $db->query("delete from nodes where node_id='$user' and node_type=7"); |
42 | $db->query("delete from node_content where node_id='$user'"); |
43 | |
44 | |
45 | |
46 | $mail->ClearAddresses(); |
47 | $mail->AddAddress($email); |
b6e35197 |
48 | $mail->AltBody = "bohuzial si nebol zaregistrovany na ".SYSTEM_URL.". ked chces skus znovu"; |
51ff3226 |
49 | if(!$mail->Send()) |
50 | { |
51 | $error="could not sent mail"; |
52 | return false; |
53 | } |
54 | |
55 | |
56 | } |
57 | return true; |
58 | } |
59 | ?> |