favicon.ico rotated 90 degrees CCW
[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; // this example will recompile even unchanged templates! XXX!!! FIXME!!! TODO!!!
41 // return true on success, false to generate failure notification
42 return true;
43 }
44
45 function db_get_secure($tpl_name, &$smarty_obj)
46 {
47 // assume all templates are secure
48 return true; //FIXME!!! TODO!!!
49 }
50
51 function db_get_trusted($tpl_name, &$smarty_obj)
52 {
53 // not used for templates
54 }
55
56 // register the resource name "kyberia"
57 $smarty->register_resource('kyberia', array('db_get_template',
58 'db_get_timestamp',
59 'db_get_secure',
60 'db_get_trusted'));
61
This page took 0.311049 seconds and 4 git commands to generate.