php warning removed
[mirrors/Kyberia-bloodline.git] / wwwroot / inc / smarty / resource.kyberia.php
index 3a08f08e1b4bfdbedc888278862a3254a0352139..1e4a7c1cc79ed32aaa2d0a06ab85115adb84e73b 100644 (file)
@@ -3,7 +3,7 @@
 function db_get_template ($tpl_name, &$tpl_source, &$smarty_obj) {
 
         global $db,$error,$node, $error_messages;
-                               $add_template_id = $tpl_name;
+                               $add_template_id = preg_replace('/\.tpl$/', '', $tpl_name);
 
         if (!is_numeric($add_template_id)) {
             $error = $error_messages['NOT_NUMERIC'];
@@ -18,11 +18,14 @@ function db_get_template ($tpl_name, &$tpl_source, &$smarty_obj) {
         $params['node_content'] = mysql_real_escape_string("addTemplate execute: node <a href='$add_template_id'>$add_template_id</a> by user ".$_SESSION['user_name']);
         nodes::addNode($params);
                                */
-
+                               /*
         if(!($set=$db->query("select node_content from nodes where node_id='$add_template_id'"))) return false;
         $set->next();
+                               */
     // populating $tpl_source with actual template contents
-    $tpl_source = stripslashes($set->getString('node_content'));
+       //$tpl_source = stripslashes($set->getString('node_content'));
+       $tpl_source = nodes::getNodeById($add_template_id,$_SESSION['user_id']);
+       $tpl_source = $tpl_source['node_content'];
     // return true on success, false to generate failure notification
     return true;
 }
@@ -33,7 +36,9 @@ function db_get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj)
     // do database call here to populate $tpl_timestamp
     // with unix epoch time value of last template modification.
     // This is used to determine if recompile is necessary.
-    $tpl_timestamp = time(); // this example will always recompile! FIXME!!! TODO!!!
+       $recompile = 100; //recompile every N seconds
+       $tpl_timestamp = floor(time()/$recompile)*$recompile; 
+       // this example will recompile even unchanged templates! XXX!!! FIXME!!! TODO!!!
     // return true on success, false to generate failure notification
     return true;
 }
This page took 0.125843 seconds and 4 git commands to generate.