fixed bug in permissions (node was displayed even with external_access=no)
[mirrors/Kyberia-bloodline.git] / cron / ps.php
1 #!/usr/bin/php
2 <?php
3
4 /*
5 * Script that XXX
6 * Called XXX
7 */
8
9
10 //registration question specification
11 $requests[] = array("senate_request"=>2228983,
12 "function"=>"update_template",
13 "params"=>array("change_node_id"=>791946));
14
15 function update_template($params) {
16 global $db;
17 $node_id = $params['change_node_id'];
18 if (!is_numeric($node_id)) return false;
19 $q = "update node_content set node_content = '".$params['content']."' where node_id=$node_id";
20 $db->query($q);
21 $fp = fopen (OWN_TEMPLATE_DIR.$node_id.".tpl", "w+");
22 fwrite($fp,$params['content']);
23 fclose($fp);
24 chown(OWN_TEMPLATE_DIR.$node_id.".tpl","www");
25 }
26
27 // Use relative address of config file
28 // Change this, if you move you cron directory.
29 $dir=substr(__FILE__, 0, strrpos(__FILE__, '/'));
30 require_once($dir.'/../wwwroot/config/config.inc');
31
32 //connecting to database and creating universal $db object
33 require_once(INCLUDE_DIR.'/log.inc');
34 require_once(INCLUDE_DIR.'/database.inc');
35 require_once(INCLUDE_DIR.'/nodes.inc');
36 $db=new CLASS_DATABASE();
37
38 foreach ($requests as $request) {
39 $request_id = $request['senate_request'];
40 $set = $db->query("select node_content from nodes left join node_content on nodes.node_id = node_content.node_id where node_parent='$request_id' order by k desc limit 1");
41 $set->next();
42 $params = $request['params'];
43 $params['content'] = addslashes($set->getString('node_content'));
44 $request["function"]($params);
45 }
46
47
48 ?>
This page took 0.271908 seconds and 4 git commands to generate.