3 function db_get_template ($tpl_name, &$tpl_source, &$smarty_obj) {
5 global $db,$error,$node, $error_messages;
6 $template_id = preg_replace('/\.tpl$/', '', $tpl_name);
8 //from now on module names need not to be numeric!
9 if (!is_numeric($template_id)) {
10 $template_id=nodes
::getNodeIdByName($tpl_name);
11 if (!is_numeric($template_id)) {
12 $error = $error_messages['NOT_NUMERIC'];
17 if (is_numeric($template_id)) {
18 $tpl_source = nodes
::getNodeById($template_id,empty($_SESSION['user_id']) ?
"" : $_SESSION['user_id']);
20 $template_name = $tpl_source['node_name'];
21 $template_signature = 'TEMPLATE /k/'.base_convert($template_id,10,36).' /id/'.$template_id.' ['.$template_name.']';
22 $tpl_source = "\n\n<!-- BEGIN $template_signature -->\n\n".
23 $tpl_source['node_content'].
24 "\n\n<!-- END $template_signature -->\n\n";
26 // return true on success, false to generate failure notification
27 return (bool)$tpl_source;
31 function db_get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj)
33 // do database call here to populate $tpl_timestamp
34 // with unix epoch time value of last template modification.
35 // This is used to determine if recompile is necessary.
36 $recompile = 10; //recompile every N seconds
37 $tpl_timestamp = floor(time()/$recompile)*$recompile;
38 // this example will recompile even unchanged templates! XXX!!! FIXME!!! TODO!!!
39 // return true on success, false to generate failure notification
43 function db_get_secure($tpl_name, &$smarty_obj)
45 // assume all templates are secure
46 return true; //FIXME!!! TODO!!!
49 function db_get_trusted($tpl_name, &$smarty_obj)
51 // not used for templates
54 // register the resource name "kyberia"
55 $smarty->register_resource('kyberia', array('db_get_template',
This page took 0.3043 seconds and 4 git commands to generate.