9 // Use relative address of config file
10 // Change this, if you move you cron directory.
11 $dir=substr(__FILE__
, 0, strrpos(__FILE__
, '/'));
12 require_once($dir.'/../wwwroot/config/config.inc');
15 //connecting to database and creating universal $db object
16 require_once(INCLUDE_DIR
.'/log.inc');
17 require_once(INCLUDE_DIR
.'/database.inc');
18 require_once(INCLUDE_DIR
.'/nodes.inc');
19 require_once(INCLUDE_DIR
.'/permissions.inc');
20 require_once(INCLUDE_DIR
.'/ubik.inc');
22 $_SESSION['user_id']=UBIK_ID
;
24 $db=new CLASS_DATABASE();
26 $set=$db->query("select * from node_access where
27 node_id='1961061' and node_permission='execute'");
28 $citizens=$set->getNumRows();
30 $set2=$db->query("select k,node_id,node_creator,login from nodes
31 left join users on nodes.node_creator=users.user_id where
32 node_name='request for citizenship'");
34 echo "TOTAL $citizens citizens \n";
36 while ($set2->next()) {
37 $request_id=$set2->getString('node_id');
38 $votes=$set2->getString('k');
39 $login=$set2->getString('login');
40 $citizen=$set2->getString('node_creator');
41 echo "citizen $citizen - $login has $votes needs ".floor(log($citizens,"1.42"))." \n";
43 if (($citizens<66 && $votes>=floor($citizens/6)) ||
44 ($citizens>=66 && $votes>floor(log($citizens,"1.42")))) {
46 $params['node_parent']=$request_id;
47 $params['node_creator']=UBIK_ID
;
48 $params['node_content']="request of user $login approved by $votes citizens";
49 $params['node_name']="citizen $citizen approved";
51 echo $votes.$citizen."\n";
52 nodes
::addNode($params);
53 $t1=$db->query("select * from node_access where
56 and node_permission='execute'");
57 if (!$t1->getNumRows()) {
58 $db->query("insert into node_access set
61 node_permission='execute'");
63 $t1=$db->query("select * from node_access where
65 user_id='$citizen' and
66 node_permission='execute'");
67 if (!$t1->getNumRows()) {
68 $db->query("insert into node_access set
71 node_permission='execute'");
73 $t1=$db->query("select * from node_access where
75 user_id='$citizen' and
76 node_permission='execute'");
77 if (!$t1->getNumRows()) {
78 $db->query("insert into node_access set
81 node_permission='execute'");
83 $db->query("update nodes set node_name='approved citizenship request'
84 where node_id='$request_id'");
85 $params['mail_to']=$citizen;
86 $params['mail_text']="you have become a citizen";
88 ubik
::ubikMail($params);
This page took 0.849592 seconds and 4 git commands to generate.