dc77b4fa55a67fc482f8390506a5e78af9bce77b
[mirrors/Kyberia-bloodline.git] / wwwroot / inc / smarty / resource.kyberia.php
1 <?php
2
3 function db_get_template ($tpl_name, &$tpl_source, &$smarty_obj) {
4
5 global $db,$error,$node, $error_messages;
6 $add_template_id = preg_replace('/\.tpl$/', '', $tpl_name);
7
8 if (!is_numeric($add_template_id)) {
9 $error = $error_messages['NOT_NUMERIC'];
10 return false;
11 }
12
13 /*
14 //logging of every template for security reasons FIXME!!! TODO!!!
15 $params['node_creator'] = UBIK_ID;
16 $params['node_parent'] = 2029360;
17 $params['node_name'] = "addTemplate execute: node $add_template_id";
18 $params['node_content'] = mysql_real_escape_string("addTemplate execute: node <a href='$add_template_id'>$add_template_id</a> by user ".$_SESSION['user_name']);
19 nodes::addNode($params);
20 */
21 /*
22 if(!($set=$db->query("select node_content from nodes where node_id='$add_template_id'"))) return false;
23 $set->next();
24 */
25 // populating $tpl_source with actual template contents
26 //$tpl_source = stripslashes($set->getString('node_content'));
27 $tpl_source = nodes::getNodeById($add_template_id,$user_id);
28 $tpl_source = $tpl_source['node_content'];
29 // return true on success, false to generate failure notification
30 return true;
31 }
32
33
34 function db_get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj)
35 {
36 // do database call here to populate $tpl_timestamp
37 // with unix epoch time value of last template modification.
38 // This is used to determine if recompile is necessary.
39 $recompile = 100; //recompile every N seconds
40 $tpl_timestamp = floor(time()/$recompile)*$recompile;
41 // this example will recompile even unchanged templates! XXX!!! FIXME!!! TODO!!!
42 // return true on success, false to generate failure notification
43 return true;
44 }
45
46 function db_get_secure($tpl_name, &$smarty_obj)
47 {
48 // assume all templates are secure
49 return true; //FIXME!!! TODO!!!
50 }
51
52 function db_get_trusted($tpl_name, &$smarty_obj)
53 {
54 // not used for templates
55 }
56
57 // register the resource name "kyberia"
58 $smarty->register_resource('kyberia', array('db_get_template',
59 'db_get_timestamp',
60 'db_get_secure',
61 'db_get_trusted'));
62
This page took 0.298424 seconds and 3 git commands to generate.