| 1 | #!/usr/bin/php |
| 2 | <?php |
| 3 | /* |
| 4 | * Script that XXX ? create template files from sql ? |
| 5 | * Called XXX |
| 6 | */ |
| 7 | |
| 8 | |
| 9 | // Use relative address of config file |
| 10 | // Change this, if you move you cron directory. |
| 11 | $dir=substr(__FILE__, 0, strrpos(__FILE__, '/')); |
| 12 | require($dir.'/../wwwroot/config/config.inc'); |
| 13 | |
| 14 | //connecting to database and creating universal $db object |
| 15 | require(INCLUDE_DIR.'/log.inc'); |
| 16 | require(INCLUDE_DIR.'/database.inc'); |
| 17 | require(INCLUDE_DIR.'/nodes.inc'); |
| 18 | $db=new CLASS_DATABASE(); |
| 19 | |
| 20 | $set=$db->query("select nodes.*,node_content.*,nodes.node_id as node_id from nodes |
| 21 | left join node_content on nodes.node_id=node_content.node_id |
| 22 | where node_type='14'"); |
| 23 | |
| 24 | while ($set->next()) { |
| 25 | $node_content=$set->getString('node_content'); |
| 26 | $template_id=$set->getString('node_id'); |
| 27 | $fp = fopen (OWN_TEMPLATE_DIR.$template_id.".tpl", "w+"); |
| 28 | fwrite($fp,$node_content); |
| 29 | fclose($fp); |
| 30 | chown(OWN_TEMPLATE_DIR.$template_id.".tpl","www"); |
| 31 | } |
| 32 | |
| 33 | ?> |