Trasovatelnejsi templaty
[mirrors/Kyberia-bloodline.git] / cron / ps.php
CommitLineData
ae9f7457 1#!/usr/bin/php
b42b2bf9 2<?php
a3be90c6 3
4/*
5 * Script that XXX
6 * Called XXX
7 */
8
9
b42b2bf9
H
10//registration question specification
11$requests[] = array("senate_request"=>2228983,
12"function"=>"update_template",
13"params"=>array("change_node_id"=>791946));
14
15function 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
a3be90c6 27// Use relative address of config file
28// Change this, if you move you cron directory.
29$dir=substr(__FILE__, 0, strrpos(__FILE__, '/'));
ccb9c667 30require_once($dir.'/../wwwroot/config/config.inc');
a3be90c6 31
b42b2bf9 32//connecting to database and creating universal $db object
ccb9c667 33require_once(INCLUDE_DIR.'/log.inc');
34require_once(INCLUDE_DIR.'/database.inc');
35require_once(INCLUDE_DIR.'/nodes.inc');
b42b2bf9
H
36$db=new CLASS_DATABASE();
37
38foreach ($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
a3be90c6 48?>
This page took 0.42347 seconds and 4 git commands to generate.