51ff3226 |
1 | <?php function addAjax() { |
2 | global $db,$error,$node, $error_messages; |
3 | $add_ajax_id=$_POST['add_ajax_id']; if (!is_numeric($add_ajax_id)) { |
4 | $error=$error_messages['NOT_NUMERIC']; |
5 | return false; } |
6 | $set=$db->query("select node_content,node_name from nodes left join node_content on node_content.node_id=nodes.node_id where nodes.node_id='$add_ajax_id'"); |
7 | $set->next(); |
8 | $node_content=$set->getString('node_content'); |
9 | $class_name=$set->getString('node_name'); |
10 | $fp = fopen (AJAX_DIR.$class_name.".php","w+"); |
11 | fwrite($fp,$node_content); |
12 | fclose($fp); |
13 | chown(AJAX_DIR.$class_name,"www"); |
14 | $q="update nodes set external_link='' where node_name='$class_name' and external_link='ajax://$class_name'"; |
15 | $db->query($q); |
16 | $q="update nodes set external_link='ajax://$class_name' where node_id='".$add_ajax_id."'"; |
17 | $db->query($q); |
18 | return true; } |
19 | ?> |