| 1 | <?php |
| 2 | /* This program is free software. It comes without any warranty, to |
| 3 | * the extent permitted by applicable law. You can redistribute it |
| 4 | * and/or modify it under the terms of the Do What The Fuck You Want |
| 5 | * To Public License, Version 2, as published by Sam Hocevar. See |
| 6 | * http://sam.zoy.org/wtfpl/COPYING for more details. */ |
| 7 | |
| 8 | function configure_content() { |
| 9 | |
| 10 | global $db,$error,$node; |
| 11 | $node_id=$node['node_id']; |
| 12 | |
| 13 | if ($node['node_permission']!=('owner' OR 'master' OR 'op')) { |
| 14 | $error=$error_messages['EVENT_PERMISSION_ERROR']; |
| 15 | return false; |
| 16 | } |
| 17 | |
| 18 | |
| 19 | |
| 20 | //warning - not forget!!! - if self-presentation of content (template form) than save as file into OWN_TEMPLATE folder |
| 21 | if ($node['template_id']==$node['node_id']) { |
| 22 | $node_content=stripslashes($_POST['node_content']); |
| 23 | $template_id=$node['template_id']; |
| 24 | $fp = fopen (OWN_TEMPLATE_DIR.$template_id.".tpl", "w+"); |
| 25 | fwrite($fp,$node_content); |
| 26 | fclose($fp); |
| 27 | $external_link=OWN_TEMPLATE_DIR.$template_id.".tpl"; |
| 28 | chown(OWN_TEMPLATE_DIR.$template_id.".tpl","www"); |
| 29 | $q="update nodes set external_link='$external_link' where node_id='".$node['node_id']."'"; |
| 30 | $db->query($q); |
| 31 | } |
| 32 | |
| 33 | $node_content=nodes::processContent($_POST['node_content']); |
| 34 | |
| 35 | if (!$node_content) { |
| 36 | return false; |
| 37 | } |
| 38 | $db->update("update nodes set node_updated=NOW() where node_id='$node_id'"); |
| 39 | |
| 40 | $result=$db->update("update node_content set node_content='$node_content' where node_id='$node_id'"); |
| 41 | if (!$result) { |
| 42 | $result=$db->query("insert into node_content set node_content='$node_content',node_id='$node_id'"); |
| 43 | return true; |
| 44 | } |
| 45 | else return true; |
| 46 | } |
| 47 | ?> |