Commit | Line | Data |
---|---|---|
b42b2bf9 H |
1 | <?php |
2 | function addPlugin() { | |
3 | ||
4 | global $db,$error,$node, $error_messages; | |
5 | $add_plugin_id=$_POST['add_plugin_id']; | |
6 | ||
7 | if (!is_numeric($add_plugin_id)) { | |
8 | $error=$error_messages['NOT_NUMERIC']; | |
9 | return false; | |
10 | } | |
11 | ||
12 | ||
13 | $set=$db->query("select node_parent, node_system_access, node_creator, template_id, node_content, node_name from nodes where nodes.node_id='$add_plugin_id'"); | |
14 | $set->next(); | |
15 | $node_parent=$set->getString('node_parent'); | |
16 | $node_system_access=$set->getString('node_system_access'); | |
17 | $node_creator=$set->getString('node_creator'); | |
18 | $node_template=$set->getString('template_id'); | |
19 | $node_content=$set->getString('node_content'); | |
20 | $plugin_name=$set->getString('node_name'); | |
21 | $fp = fopen (SMARTY_PLUGIN_DIR."function.".$plugin_name.".php","w+"); | |
22 | fwrite($fp,$node_content); | |
23 | fclose($fp); | |
24 | chown(SMARTY_PLUGIN_DIR.$plugin_name.".php","www"); | |
25 | $q="update nodes set external_link='plugin://$plugin_name' where node_id='".$add_plugin_id."'"; | |
26 | $db->query($q); | |
27 | ||
28 | //logging of every plugin for security reasons | |
29 | $params['node_creator']=UBIK_ID; | |
30 | $params['node_parent']=2019772; | |
31 | $params['node_name']="addPlugin execute: node $add_plugin_id"; | |
32 | $params['node_content']="addPlugin execute: node <a href='$add_plugin_id'>$add_plugin_id</a> by user ".$_SESSION['user_name']; | |
33 | $params['node_content'].="<br />plugin_name: ".$plugin_name; | |
34 | $params['node_content'].="<br />template_id: <a href='$node_template'>".$node_template."</a>"; | |
35 | $params['node_content'].="<br />node_parent: <a href='$node_parent'>".$node_parent."</a>"; | |
36 | $params['node_content'].="<br />node_system_access: ".$node_system_access; | |
37 | $params['node_content'].="<br />node_creator: <a href='$node_creator'>".$node_creator."</a>"; | |
38 | $params['node_content']=addslashes($params['node_content']); | |
39 | nodes::addNode($params); | |
40 | ||
41 | return true; | |
42 | } | |
43 | ||
44 | ?> | |
45 | ||
46 |