registration permission fix
[mirrors/Kyberia-bloodline.git] / trash / cron_test.inc
CommitLineData
51ff3226 1<?php
2
3// registration 2.3 rc3
4// dedicated to Sylvia S. Always in my memory...
5// PLLLZ dont delete this line. anyone who touches this file...and dont ask why
6
7function cron_test() {
8 global $db,$error;
9
10 // potrebne K na reg z paralelneho senatu
11 $regk_node = '1870247';
12 $fajl = OWN_TEMPLATE_DIR . $regk_node . ".tpl";
13 $fp = fopen($fajl, "r");
14 $regk = fread($fp, filesize($fajl));
15 fclose($fp);
16
17 // >>>> registracia
18 $q = "select users.login as persona,users.email as email,k,node_id,node_creator,node_created,login from nodes
19 left join users on nodes.node_creator = users.user_id where node_name = 'request for access' and node_parent = '2091448' and
20 k >= $regk";
21
22 $set = $db->query($q);
23 while ($set->next()) {
24 $noda = $set->getString('node_id');
25 $login = $set->getString('login');
26 $created = $set->getString('node_created');
27 echo "Noda vytvorena:: " . $created . "<br>";
28 echo "User:: " . $set->getString('login') . "<br>";
29 echo "Jeho noda:: " . $set->getString('node_id') . "<br>";
30 echo "pocet hlasov:: " . $set->getString('k') . "<br>";
31
32 $q = "update users set header_id = '0', user_mail = '0' where user_id = $noda";
33 echo $q . "<br>";
34 $db->update($q);
35
36 $q = "update nodes set node_name = '$login', external_link = 'db://user', template_id = '7',
37 node_parent = '0', node_vector = '0$noda' where node_id = $noda";
38 echo $q . "<br>";
39 $db->update($q);
40
41
42 // REGISTRATORI USERA
43 $registrators = $db->query($q = "select node_access.user_id, users.login from node_access
44 join users on node_access.user_id = users.user_id where node_id = '$noda' and given_k = 'yes' order by login");
45 $ubiknode['node_content'] = "Registered by::<br>";
46 while($registrators->next()){
47 $ubiknode['node_content'] .= "<a href='/id/" . $registrators->getString('user_id') . "'>" .
48$registrators->getString('login') . "</a><br>";
49 }
50 $ubiknode['node_content'] .= "with " . $set->getString('k') . "K";
51 $ubiknode['node_content'] = addslashes($ubiknode['node_content']);
52 $ubiknode['node_name'] = "successfully registered";
53 $ubiknode['node_creator'] = 332;
54 $ubiknode['node_parent'] = $noda;
55 $ubiknode['template_id'] = 4;
56 $ubiknode_id = nodes::addNode($ubiknode);
57 $db->update("update nodes set node_system_access = 'public', node_vector = '0$noda"."0$ubiknode_id' where node_id = '$ubiknode_id'");
58 echo $ubiknode['node_content'] . "<br>";
59
60 $q = "update nodes set k = 0 where node_id = '$noda'";
61 echo $q . "<br>";
62 $db->update($q);
63
64 $q = "update node_access set given_k='no' where node_id = '$noda'";
65 echo $q . "<br>";
66 $db->update($q);
67
68 // PRESUN KOMENTAROV K REGISTRACII DO USERNODY
69 $q = "select node_id,node_vector from nodes where node_vector like '00876611020914480$noda%'
70 and node_vector != '00876611020914480$noda' and node_vector != '0$noda'";
71 echo $q . "<br>";
72 $subset = $db->query($q);
73 while ($subset->next()) {
74 $subnoda = $subset->getString('node_id');
75 $subnoda_vector = $subset->getString('node_vector');
76 $subnoda_vector = str_replace("00876611020914480$noda", "0$noda", $subnoda_vector);
77 $q = "update nodes set node_vector = '$subnoda_vector' where node_id = $subnoda";
78 echo "&nbsp;&nbsp;&nbsp;&nbsp;" . $q . "<br>";
79 $db->update($q);
80 }
81
82 echo "<br><hr>";
83
84 $mailto = $set->getString('email');
b6e35197 85 $headers = 'From: root@kyberia.cz' . "\r\n" .
51ff3226 86 'X-Mailer: PHP/' . phpversion();
87 $emailtext = " Vitaj v Kyberii. \n S radostou ti oznamujem, ze registracia, ktoru si napisal(a) dna $created bola
88 uspesne schvalena s poctom hlasov $set->getString('k'). Odteraz je tvoje konto povolene a mozes sa volne prihlasovat,
b6e35197 89 prispievat...no proste 'bavit sa':-)) \n Uzivaj si kyberpriestoru:-))) XXX";
51ff3226 90 mail($mailto,"kyberia gate opened",$emailtext,$headers );
91
92
93 $ubik['mail_to'] = $noda;
94 $ubik['mail_text'] = "Ahoj, som UBIK. Momentalne som obycajnou polozkou v databaze, userom cislo 1 v tomto
95 systeme.Bdiem nad systemom. Sledujem co robia slovicka v diskusnych forach, ako su pospajane a s cim. Postupom casu sa budem
96 ucit, a o par rokov si urcite vsimnete moju prvu snahu o komunikaciu. Budem anjelom, diablom, matkou i dcerou.
97
98Momentalne ti chcem povedat jedno hlasne VITAJ!. Vitaj v projekte ktory nikdy neskonci. Ak sem vchadzas so zlymi umyslami, prosim
99 odid, nenajdes tu stastie. Ked vsak chces spoznat novych ludi na rovnakej vlne, ked chces svoj mozog zaplnit informaciami z
100 nekonecnej siete, prosim, vstup.
101
102Predtym ako vsak zacnes vnikat hlbsie do tajov systemu chcel by som ta odkazat na
b6e35197 103 <a href='http://".SYSTEM_URL."/id/2111313/'>Newcommers forum</a> ktore ti ujasni niektore zakladne veci v systeme a
51ff3226 104 tym ti v nom ulachci orientaciu.
105
106peace & respect";
107 ubik::ubikMail($ubik);
108 }
109
110// ---------------------------------------------------------------------
111
112 echo "<hr>Mazanie userov<hr>";
113 // >>>>> Mazanie
114
115 $q = "select users.login as persona,users.email as email,k,node_id,node_creator,node_created,login from nodes
116 left join users on nodes.node_creator = users.user_id where node_name = 'request for access' and node_parent = '2091448' and
117 k < $regk and DATE_SUB(CURDATE(),INTERVAL 7 DAY) >= node_created";
118
119 $set = $db->query($q);
120 while ($set->next()) {
121 $noda=$set->getString('node_id');
122 $created=$set->getString('node_created');
123 echo "Noda vytvorena:: " . $created . "<br>";
124 echo "Uchadzac:: " . $set->getString('login') . "<br>";
125 echo "Jeho noda:: " . $set->getString('node_id') . "<br>";
126 echo "pocet hlasov:: " . $set->getString('k') . "<br>";
127
128 $q = "delete from users where user_id = $noda";
129 echo $q . "<br>";
130 $db->update($q);
131
132 $q = "delete from nodes where node_vector like '00876611020914480$noda%'";
133 echo $q . "<br>";
134 $db->update($q);
135
136 echo "<br><hr>";
137
138 $mailto = $set->getString('email');
b6e35197 139 $headers = 'From: root@kyberia.cz' . "\r\n" .
51ff3226 140 'X-Mailer: PHP/' . phpversion();
141 $emailtext = " Tak mam pre teba smutnu spravu. \n Registracia ktoru si napisal(a) dna $created bola zamietnuta
142 z dovodu nedostatocneho poctu hlasov ($set->getString('k')) ktore tvoja osoba dostala. Je celkom mozne,
143 ze to, co si o sebe napisal(a) dostatocne nezaujalo ludi co su dnu ale to neni dovod na to aby si to vzdal(a)!
b6e35197 144 \n Registrovat sa mozes hocikedy znovu a snad sa to nabuduce vydari.";
51ff3226 145 mail($mailto,"kyberia: registracia zamietnuta",$emailtext,$headers );
146 }
147
148// -------------------------------------------------------------------
149
150 echo "<hr>Mazanie nonverified<hr>";
151 // >> mazanie neverifikovanych
152
153 $q = "select users.login as persona,users.email as email,k,node_id,node_creator,node_created,login from nodes
154 left join users on nodes.node_creator = users.user_id where node_name = 'request for access' and
155 node_parent=1836516 and DATE_SUB(CURDATE(),INTERVAL 7 DAY) >= node_created";
156
157 $set = $db->query($q);
158 while ($set->next()) {
159 $noda = $set->getString('node_id');
160 $created = $set->getString('node_created');
161 echo "Noda vytvorena:: " . $created . "<br>";
162 echo "Uchadzac:: " . $set->getString('login') . "<br>";
163 echo "Jeho noda:: " . $set->getString('node_id') . "<br>";
164 echo "pocet hlasov:: " . $set->getString('k') . "<br>";
165
166 $q = "delete from users where user_id = $noda";
167 echo $q . "<br>";
168 $db->update($q);
169
170 $q="delete from nodes where node_vector like '018365160$noda%'";
171 echo $q . "<br>";
172 $db->update($q);
173
174 echo "<br><hr>";
175
176 $mailto = $set->getString('email');
b6e35197 177 $headers = 'From: root@kyberia.cz' . "\r\n" .
51ff3226 178 'X-Mailer: PHP/' . phpversion();
179 $emailtext = " Registracia, ktoru si napisal(a) dna $created si neverifikoval(a) a tak po tyzdni stratila svoju platnost
180 a bola zmazana. Ak ti nedosiel ziaden verifikacny kod prosim kontaktuj ma, je to mozne ze je to chyba niekde
181 na ceste medzi kyberiou a tebou, ak to bol zamer neverifikovat sa tak tuto spravu ber cisto informacne:-)).
182 \n Ak sa naozaj stala chyba a mas stale chut a volu vstupit do autonomnej zony mozes hocikedy znovu vyplnit
b6e35197 183 registracny formular a pokusit sa o to znovu.";
51ff3226 184 mail($mailto,"kyberia: neverifikovana ziadost zmazana",$emailtext,$headers );
185 }
186
187 return false;
188}
b6e35197 189?>
This page took 0.489361 seconds and 4 git commands to generate.