51ff3226 |
1 | <?php |
2 | function configure() { |
3 | global $db,$error,$node; |
4 | $user_id=$_SESSION['user_id']; |
5 | |
6 | if ($node['node_permission']=='owner') { |
7 | |
8 | if (!empty($_FILES['description_image']['tmp_name'])) { |
9 | $image=$_FILES['description_image']['tmp_name']; |
10 | $image_name=$_FILES['description_image']['name']; |
11 | |
12 | if ($node['node_id']==$user_id) $width=50; |
13 | else $width=123; |
14 | |
15 | if (stristr($image_name,".jpg") || stristr($image_name,".jpeg") ){ |
16 | $cmd=UTILZ_DIR."/jpegtopnm $image |".UTILZ_DIR."/pnmscale -width=$width | ".UTILZ_DIR."ppmquant 256 |".UTILZ_DIR."ppmtogif >".SYSTEM_ROOT."images/nodes/".substr($node['node_id'],0,1)."/".substr($node['node_id'],1,1)."/".$node['node_id'].".gif"; |
17 | } |
18 | elseif (stristr($image_name,".gif")) { |
19 | $cmd=UTILZ_DIR."/gifsicle --resize ".$width."x_ $image > ".SYSTEM_ROOT."images/nodes/".substr($node['node_id'],0,1)."/".substr($node['node_id'],1,1)."/".$node['node_id'].".gif"; |
20 | } |
21 | if ($cmd) { |
22 | shell_exec($cmd); |
23 | } |
24 | echo $cmd; |
25 | } |
26 | |
27 | if (empty($_POST['node_creator'])) { |
28 | $owner_id=$node['node_creator']; |
29 | } |
30 | |
31 | else { |
46c0767c |
32 | $node_creator=intval($_POST['node_creator']); |
51ff3226 |
33 | $q="select user_id from users where login like '$node_creator'"; |
34 | $ownerset=$db->query($q); |
35 | if (!$ownerset->getNumRows()) { |
36 | $error="user $node_creator does not exist"; |
37 | return false; |
38 | } |
39 | else { |
40 | $ownerset->next(); |
41 | $owner_id=$ownerset->getString('user_id'); |
42 | } |
43 | } |
44 | |
46c0767c |
45 | $node_vector=mysql_real_escape_string($_POST['node_vector']); |
51ff3226 |
46 | $old_vector=$node['node_vector']; |
47 | if (is_numeric($_POST['template_id'])) $template_id=$_POST['template_id']; |
46c0767c |
48 | $node_parent=intval($_POST['node_parent']); |
49 | $node_created=mysql_real_escape_string($_POST['node_created']); |
51ff3226 |
50 | $node_id=$node['node_id']; |
51 | |
52 | |
53 | $permissions=permissions::checkPermissions($node_parent); |
54 | if (!$permissions['w']) { |
55 | $error="you don't have permissions for writing into $node_parent"; |
56 | return false; |
57 | } |
58 | |
59 | if ($node_parent) { |
60 | // $set=$db->query("select node_vector from nodes where node_id='$node_parent'"); |
61 | // $set->next(); |
62 | // $node_vector=$set->getString('node_vector'); |
63 | $parent_node=nodes::getNodeById($node_parent,$_SESSION['user_id']); |
64 | $node_vector=$parent_node['node_vector'].";".$parent_node['node_id'];; |
65 | } |
66 | |
46c0767c |
67 | $node_name=mysql_real_escape_string($_POST['node_name']); |
51ff3226 |
68 | |
46c0767c |
69 | $node_external_access=mysql_real_escape_string($_POST['node_external_access']); |
70 | $node_system_access=mysql_real_escape_string($_POST['node_system_access']); |
51ff3226 |
71 | |
e909f81b |
72 | require(INCLUDE_DIR.'htmlparse.inc'); |
51ff3226 |
73 | global $htmlparse; |
4ad7056d |
74 | htmlparser::htmlparse($node_name); |
51ff3226 |
75 | |
76 | if (!empty($htmlparse)) { |
77 | $error=$htmlparse; |
78 | return false; |
79 | } |
80 | |
81 | $node_id=$node['node_id']; |
82 | |
83 | //change also users table when changing users login |
84 | if ($node['node_type']=='user' && $node_name!=$node['node_name']) { |
85 | $node_name=strip_tags($node_name); |
86 | $s=$db->query("select user_id from users where login='$node_name'"); |
87 | if ($s->getNumRows()) { |
88 | $error="username $node_name already in use"; |
89 | return false; |
90 | } |
91 | else { |
92 | echo "update users set login='$node_name' where user_id='$user_id'"; |
93 | $db->query("update users set login='$node_name' where user_id='$user_id'"); |
94 | } |
95 | } |
96 | |
97 | $q="update nodes set template_id='$template_id',node_name='$node_name',node_system_access='$node_system_access',node_external_access='$node_external_access',node_creator='$owner_id' where node_id='$node_id'"; |
98 | $db->query($q); |
99 | |
100 | return true; |
101 | |
102 | } |
103 | |
104 | } |
e909f81b |
105 | ?> |