add/remove node actions were missing
[plewww.git] / planetlab / common / actions.php
1 <?php
2
3 // Require login
4 require_once 'plc_login.php';
5
6 // Get session and API handles
7 require_once 'plc_session.php';
8 global $plc, $api;
9
10 //print header
11 require_once 'plc_drupal.php';
12
13 // Common functions
14 require_once 'plc_functions.php';
15
16 $known_actions=array();
17 ////////////////////////////////////////////////////////////
18 // interface :
19 // (*) use POST 
20 // (*) set 'action' to one of the following
21 //////////////////////////////////////// persons
22 $known_actions []= "add-person-to-site";
23 //      expects:        person_id & site_id
24 $known_actions []= "remove-person-from-sites";
25 //      expects:        person_id & site_ids
26 $known_actions []= "remove-roles-from-person";
27 //      expects:        person_id & role_ids
28 $known_actions []= "add-role-to-person";
29 //      expects:        role_person_id & id
30 $known_actions []= "enable-person";
31 //      expects:        person_id
32 $known_actions []= "disable-person";
33 //      expects:        person_id
34 $known_actions []= "become-person";
35 //      expects:        person_id
36 $known_actions []= "delete-person";
37 //      expects:        person_id
38 $known_actions []= "delete-keys";
39 //      expects:        key_ids & person_id (for redirecting to the person's page)
40 $known_actions []= "upload-key";
41 //      expects:        person_id & $_FILES['key']
42 $known_actions []= "update-person";
43 //      expects:        person_id & first_name last_name title email phone url bio + [password1 password2]
44
45 //////////////////////////////////////// nodes
46 $known_actions []= "node-boot-state";   
47 //      expects:        node_id boot_state
48 $known_actions []= "delete-node";       
49 //      expects:        node_id
50 $known_actions []= "update-node";       
51 //      expects:        node_id, hostname, model
52
53 //////////////////////////////////////// interfaces
54 $known_actions []= "delete-interfaces"; 
55 //      expects:        interface_ids
56 $known_actions []="add-interface";
57 //      expects:        node_id & interface details
58 $known_actions []="update-interface";
59 //      expects:        interface_id & interface details
60
61 //////////////////////////////////////// sites
62 $known_actions []= "delete-site";       
63 //      expects:        site_id
64 $known_actions []= "expire-all-slices-in-site";
65 //      expects:        slice_ids
66 $known_actions []= "update-site";
67 //      expects:        site_id & name abbreviated_name url latitude longitude [login_base max_slices]
68
69 //////////////////////////////////////// slices
70 $known_actions []= "update-slice";      
71 //      expects:        slice_id, name, description, url
72 $known_actions []= "renew-slice";
73 //      expects:        slice_id & expires
74 $known_actions []= 'remove-persons-from-slice';
75 //      expects:        slice_id & person_ids
76 $known_actions []= 'add-persons-in-slice';
77 //      expects:        slice_id & person_ids
78 $known_actions []= 'remove-nodes-from-slice';
79 //      expects:        slice_id & node_ids
80 $known_actions []= 'add-nodes-in-slice';
81 //      expects:        slice_id & node_ids
82
83 //////////////////////////////////////// tag types
84 $known_actions []= "update-tag-type";
85 //      expects:        tag_type_id & name & description & category & min_role_id  
86 $known_actions []= "add-tag-type";
87 //      expects:        tag_type_id & tagname & description & category & min_role_id  
88 $known_actions []= "delete-tag-types";
89 //      expects:        tag_type_ids
90
91 //////////////////////////////////////// tags
92 $known_actions []= "set-tag-on-node";
93 //      expects:        node_id tagname value
94 $known_actions []= "set-tag-on-interface";
95 //      expects:        interface_id tagname value
96 $known_actions []= "delete-node-tags";
97 //      expects:        node_id & node_tag_ids
98 $known_actions []= "delete-interface-tags";
99 //      expects:        interface_id & interface_tag_ids
100
101 ////////////////////////////////////////////////////////////
102 $interface_details= array ('method','type', 'ip', 'gateway', 'network', 
103                            'broadcast', 'netmask', 'dns1', 'dns2', 
104                            'hostname', 'mac', 'bwlimit' );
105
106 //////////////////////////////
107 // sometimes we don't set 'action', but use the submit button name instead
108 // so if 'action' not set, see if $_POST has one of the actions as a key
109 if ($_POST['action']) 
110   $action=$_POST['action'];
111 else 
112   foreach ($known_actions as $known_action) 
113     if ($_POST[$known_action]) {
114       $action=$known_action;
115       break;
116     }
117
118 //uncomment for debugging incoming data
119 //$action='debug';
120
121 $person_id = $_POST['person_id'];       // usually needed
122
123 if ( ! $action ) {
124   drupal_set_message ("actions.php: action not set or not in known_actions");
125   plc_debug('POST',$_POST);
126   return;
127  }
128
129 switch ($action) {
130
131  case 'add-person-to-site': {
132    $site_id = $_POST['site_id'];
133    $api->AddPersonToSite( intval( $person_id ), intval( $site_id ) );
134    plc_redirect (l_person($person_id));
135  }
136
137  case 'remove-person-from-sites': {
138    $site_ids = $_POST['site_ids'];
139    if ( ! $site_ids) {
140      drupal_set_message("action=$action - No site selected");
141      return;
142    }
143    foreach ( $site_ids as $site_id ) {
144      $api->DeletePersonFromSite( intval( $person_id ), intval( $site_id ) );
145    }
146    plc_redirect (l_person($person_id));
147  }
148
149  case 'remove-roles-from-person' : {
150    $role_ids=$_POST['role_ids'];
151    if ( ! $role_ids) {
152      drupal_set_message("action=$action - No role selected");
153      return;
154    }
155    foreach( $role_ids as $role_id)  {
156      $api->DeleteRoleFromPerson( intval( $role_id ), intval( $person_id ) );
157    }
158    plc_redirect (l_person($person_id));
159  }
160      
161  case 'add-role-to-person' : {
162    $role_id=$_POST['role_id'];
163    $api->AddRoleToPerson( intval( $role_id ), intval( $person_id ) );
164    plc_redirect (l_person($person_id));
165  }
166
167  case 'enable-person' : {
168    $fields = array( "enabled"=>true );
169    $api->UpdatePerson( intval( $person_id ), $fields );
170    plc_redirect (l_person($person_id));
171  }
172
173  case 'disable-person' : {
174    $fields = array( "enabled"=>false );
175    $api->UpdatePerson( intval( $person_id ), $fields );
176    plc_redirect (l_person($person_id));
177  }
178
179  case 'become-person' : {
180    $plc->BecomePerson (intval($person_id));
181    plc_redirect (l_persons());
182  }
183
184  case 'delete-person' : {
185   $api->DeletePerson( intval( $person_id ) );
186    plc_redirect (l_persons());
187  }
188
189  case 'delete-keys' : {
190    $key_ids=$_POST['key_ids'];
191    if ( ! $key_ids) {
192      drupal_set_message("action=$action - No key selected");
193      return;
194    }
195    $success=true;
196    $counter=0;
197    foreach( $key_ids as $key_id ) {
198      if ($api->DeleteKey( intval( $key_id )) != 1) 
199        $success=false;
200      else
201        $counter++;
202    }
203    if ($success) 
204      drupal_set_message ("Deleted $counter key(s)");
205    else
206      drupal_set_error ("Could not delete all selected keys, only $counter were removed");
207    plc_redirect(l_person($person_id));
208  }
209
210
211  case 'upload-key' : {
212    if ( ! isset( $_FILES['key'] ) ) {
213      drupal_set_message ("action=$action, no key file set");
214      return;
215    }
216    
217    $key_file= $_FILES['key']['tmp_name'];
218    if ( ! $key_file ) {
219      plc_error("Please select a valid SSH key file to upload");
220      return;
221    } 
222    $fp = fopen( $key_file, "r" );
223    $key = "";
224    if( ! $fp ) {
225      plc_error("Unable to open key file $key_file");
226      return;
227    }
228    // opened the key file, read the one line of contents
229    // The POST operation always creates a file even if the filename
230    // the user specified was garbage.  If there was some problem
231    // with the source file, we'll get a zero length read here.
232    $key = fread($fp, filesize($key_file));
233    fclose($fp);
234    
235    $key_id = $api->AddPersonKey( intval( $person_id ), array( "key_type"=> 'ssh', "key"=> $key ) );
236    
237    if ( $key_id == 1) 
238      drupal_set_message ("New key added");
239    else
240      drupal_set_error("Could not add key, please verify your SSH file content\n" . $api->error());
241    
242    plc_redirect(l_person($person_id));
243  }
244
245  case 'update-person': {
246    $person_id=$_POST['person_id'];
247    // attempt to update this person
248    $first_name= $_POST['first_name'];
249    $last_name= $_POST['last_name'];
250    $title= $_POST['title'];
251    $email= $_POST['email'];
252    $phone= $_POST['phone'];
253    $url= $_POST['url'];
254    $bio= str_replace("\r", "", $_POST['bio']);
255    $password1= $_POST['password1'];
256    $password2= $_POST['password2'];
257
258    if( $password1 != $password2 ) {
259      drupal_set_error ("The passwords do not match");
260      plc_redirect(l_person($person_id));
261   }
262
263    $fields= array();
264    $fields['first_name']= $first_name;
265    $fields['last_name']= $last_name;
266    $fields['title']= $title;
267    $fields['email']= $email;
268    $fields['phone']= $phone;
269    $fields['url']= $url;
270    $fields['bio']= $bio;
271                 
272    if ( $password1 != "" )
273      $fields['password']= $password1;
274     
275     if ( $api->UpdatePerson( intval( $person_id ), $fields) == 1 )
276       drupal_set_message("$first_name $last_name updated");
277     else 
278       drupal_set_error ("Could not update person $person_id" . $api->error());
279
280     plc_redirect(l_person($person_id));
281     break;
282   }
283
284 //////////////////////////////////////////////////////////// nodes
285  case 'node-boot-state': {
286    $node_id=intval($_POST['node_id']);
287    $boot_state=$_POST['boot_state'];
288    $result=$api->UpdateNode( $node_id, array( "boot_state" => $boot_state ) );
289    if ($result==1) {
290      drupal_set_message("boot state updated");
291      plc_redirect (l_node($node_id));
292    } else {
293      drupal_set_error("Could not set boot_state '$boot_state'");
294    }
295    break;
296  }
297
298  case 'delete-node': {
299    $node_id=intval($_POST['node_id']);
300    $result=$api->DeleteNode( intval( $node_id ) );
301    if ($api==1) {
302      drupal_set_message("Node $node_id deleted");
303      plc_redirect (l_nodes());
304    } else {
305      drupal_set_error ("Could not delete node $node_id");
306    }
307    break;
308  }
309
310  case 'update-node': {
311    $hostname= $_POST['hostname'];
312    $model= $_POST['model'];
313
314    $fields= array( "hostname"=>$hostname, "model"=>$model );
315    $api->UpdateNode( intval( $node_id ), $fields );
316    $error= $api->error();
317
318    if( empty( $error ) ) {
319      drupal_set_message("Update node $hostname");
320      plc_redirect(l_node($node_id));
321    } else {
322      drupal_set_error($error);
323    }
324    break;
325  }
326
327 //////////////////////////////////////////////////////////// interfaces
328  case 'delete-interfaces' : {
329    $interface_ids=$_POST['interface_ids'];
330    if ( ! $interface_ids) {
331      drupal_set_message("action=$action - No interface selected");
332      return;
333    }
334    $success=true;
335    $counter=0;
336    foreach( $interface_ids as $interface_id ) {
337      if ($api->DeleteInterface( intval( $interface_id )) != 1) 
338        $success=false;
339      else
340        $counter++;
341    }
342    if ($success) 
343      drupal_set_message ("Deleted $counter interface(s)");
344    else
345      drupal_set_error ("Could not delete all selected interfaces, only $counter were removed");
346    plc_redirect(l_node($_POST['node_id']));
347  }
348
349  case 'add-interface': {
350    $node_id=$_POST['node_id'];
351    foreach ($interface_details as $field) {
352      $interface[$field]= $_POST[$field];
353      if( in_array( $field, array( 'bwlimit', 'node_id' ) ) ) {
354        $interface[$field]= intval( $interface[$field] );
355      }
356    }
357    $result=$api->AddInterface( intval( $node_id ), $interface );
358    if ($result >0 ) 
359      drupal_set_message ("Interface $result added into node $node_id");
360    else
361      drupal_set_error ("Could not create interface");
362    plc_redirect (l_node($node_id));
363  }
364    
365  case 'update-interface': {
366    $interface_id=$_POST['interface_id'];
367    foreach ($interface_details as $field) {
368      $interface[$field]= $_POST[$field];
369      if( in_array( $field, array( 'bwlimit', 'node_id' ) ) ) {
370        $interface[$field]= intval( $interface[$field] );
371      }
372    }
373    $result=$api->UpdateInterface( intval( $interface_id ), $interface );
374    if ($result == 1 ) 
375      drupal_set_message ("Interface $interface_id updated");
376    else
377      drupal_set_error ("Could not update interface");
378    plc_redirect (l_interface($interface_id));
379  }
380    
381 //////////////////////////////////////////////////////////// sites
382  case 'delete-site': {
383    $site_id = intval($_POST['site_id']);
384    if ($api->DeleteSite($site_id) ==1) 
385      drupal_set_message ("Site $site_id deleted");
386    else
387      drupal_set_error("Failed to delete site $site_id");
388    plc_redirect (l_sites());
389    break;
390  }
391
392  case 'expire-all-slices-in-site': {
393    // xxx todo
394    drupal_set_message("action $action not implemented in actions.php -- need tweaks and test");
395    return;
396
397    //// old code from sites/expire.php
398    $sites = $api->GetSites( array( intval( $site_id )));
399    $site=$sites[0];
400    // xxx why not 'now?'
401    $expiration= strtotime( $_POST['expires'] );
402    // loop through all slices for site
403    foreach ($site['slice_ids'] as $slice_id) {
404      $api->UpdateSlice( $slice_id, array( "expires" => $expiration ) );
405    }
406    // update site to not allow slice creation or renewal
407    $api->UpdateSite( $site_id, array( "max_slices" => 0 )) ;
408    plc_redirect (l_site($site_id));
409    break;
410  }
411
412  case 'update-site': {
413    $site_id=intval($_POST['site_id']);
414    $name= $_POST['name'];
415    $abbreviated_name= $_POST['abbreviated_name'];
416    $url= $_POST['url'];
417    $latitude= floatval($_POST['latitude']);
418    $longitude= floatval($_POST['longitude']);
419    //$max_slivers= $_POST['max_slivers'];
420    
421    $fields= array( "name" => $name, 
422                    "abbreviated_name" => $abbreviated_name, 
423                    "url" => $url, 
424                    "latitude" => floatval( $latitude ), 
425                    "longitude" => floatval( $longitude ));
426
427    if ($_POST['login_base']) 
428      $fields['login_base'] = $_POST['login_base'];
429    if ($_POST['max_slices']) 
430      $fields['max_slices'] = intval($_POST['max_slices']);
431    
432    $retcod=$api->UpdateSite( intval( $site_id ), $fields );
433    if ($retcod == 1) 
434      drupal_set_message("Site $name updated");
435    else 
436      drupal_set_error ("Could not update site $site_id");
437      
438    plc_redirect(l_site($site_id));
439    break;
440  }
441
442 //////////////////////////////////////////////////////////// slices
443  case 'update-slice': {
444    $slice_id = $_POST['slice_id'];
445    $name = $_POST['name'];
446    $description= $_POST['description'];
447    $url= $_POST['url'];
448
449    $fields= array( "description"=>$description, "url"=>$url );
450    $api->UpdateSlice( intval( $slice_id ), $fields );
451    $error= $api->error();
452
453    if( empty( $error ) ) {
454      drupal_set_message("Update slice $name");
455      plc_redirect(l_slice($slice_id));
456    } else {
457      drupal_set_error($error);
458    }
459    break;
460  }
461
462  case 'renew-slice': {
463    $slice_id = intval ($_POST['slice_id']);     
464    $expires = intval ($_POST['expires']);
465    // 8 weeks from now
466    // xxx
467    $now=mktime();
468    $WEEK=7*24*3600;
469    $WEEKS=8;
470    $MAX_FUTURE=$WEEKS*$WEEK;
471    if ( ($expires-$now) > $MAX_FUTURE) {
472      drupal_set_error("Cannot renew slice that far in the future, max is $WEEKS weeks from now");
473      plc_redirect(l_slice($slice_id));
474    }
475    plc_debug('slice_id',$slice_id);
476    plc_debug('expires',$expires);
477    if ($api->UpdateSlice ($slice_id, array('expires'=>$expires)) == 1)
478      drupal_set_message("Slice renewed");
479    else
480      drupal_set_error("Could not update slice $slice_id");
481    plc_redirect(l_slice($slice_id));
482    break;
483  }
484
485  case 'remove-persons-from-slice': {
486    $slice_id = intval ($_POST['slice_id']);     
487    $person_ids = $_POST['person_ids'];
488    
489    $success=true;
490    $counter=0;
491    foreach( $person_ids as $person_id ) {
492      if ($api->DeletePersonFromSlice(intval($person_id),$slice_id) != 1) 
493        $success=false;
494      else
495        $counter++;
496    }
497    if ($success) 
498      drupal_set_message ("Deleted $counter person(s)");
499    else
500      drupal_set_error ("Could not delete all selected persons, only $counter were removed");
501    plc_redirect(l_slice($slice_id) . " &show_persons=true");
502    break;
503  }
504
505  case 'add-persons-in-slice': {
506    $slice_id = intval ($_POST['slice_id']);     
507    $person_ids = $_POST['person_ids'];
508    
509    $success=true;
510    $counter=0;
511    foreach ($person_ids as $person_id) {
512      if ($api->AddPersonToSlice(intval($person_id),$slice_id) != 1) 
513        $success=false;
514      else
515        $counter++;
516    }
517    if ($success) 
518      drupal_set_message ("Added $counter person(s)");
519    else
520      drupal_set_error ("Could not add all selected persons, only $counter were added");
521    plc_redirect(l_slice($slice_id) . "&show_persons=true" );
522    break;
523  }
524
525  case 'remove-nodes-from-slice': {
526    $slice_id = intval ($_POST['slice_id']);     
527    $node_ids = array_map("intval",$_POST['node_ids']);
528    $count=count($node_ids);
529    
530    if ($api->DeleteSliceFromNodes($slice_id,$node_ids) == 1) 
531      drupal_set_message ("Removed $count node(s)");
532    else
533      drupal_set_error ("Could not remove selected nodes");
534    plc_redirect(l_slice($slice_id) . " &show_nodes=true");
535    break;
536  }
537
538  case 'add-nodes-in-slice': {
539    $slice_id = intval ($_POST['slice_id']);     
540    $node_ids = array_map("intval",$_POST['node_ids']);
541    $count=count($node_ids);
542    if ($api->AddSliceToNodes($slice_id,$node_ids) == 1) 
543      drupal_set_message ("Added $count node(s)");
544    else
545      drupal_set_error ("Could not add all selected nodes");
546    plc_redirect(l_slice($slice_id) . "&show_nodes=true" );
547    break;
548  }
549
550 //////////////////////////////////////////////////////////// tag types
551
552  case 'update-tag-type': {
553   // get post vars 
554    $tag_type_id= intval( $_POST['tag_type_id'] );
555    $tagname = $_POST['tagname'];
556    $min_role_id= intval( $_POST['min_role_id'] );
557    $description= $_POST['description'];  
558    $category= $_POST['category'];  
559   
560    // make tag_type_fields dict
561    $tag_type_fields= array( "min_role_id" => $min_role_id, 
562                             "tagname" => $tagname, 
563                             "description" => $description,
564                             "category" => $category,
565                             );
566
567    if ($api->UpdateTagType( $tag_type_id, $tag_type_fields ) == 1) 
568      drupal_set_message ("Tag type $tagname updated");
569    else 
570      drupal_set_error ("Could not update tag type $tag_type_id\n".$api->error());
571    plc_redirect(l_tag($tag_type_id));
572  }
573
574  case 'add-tag-type': {
575   // get post vars 
576    $tagname = $_POST['tagname'];
577    $min_role_id= intval( $_POST['min_role_id'] );
578    $description= $_POST['description'];  
579    $category= $_POST['category'];  
580   
581    // make tag_type_fields dict
582    $tag_type_fields= array( "min_role_id" => $min_role_id, 
583                             "tagname" => $tagname, 
584                             "description" => $description,
585                             "category" => $category,
586                             );
587
588   // Add it!
589    $tag_type_id=$api->AddTagType( $tag_type_fields );
590    if ($tag_type_id > 0) 
591      drupal_set_message ("tag type $tag_type_id created");
592    else
593      drupal_set_error ("Could not create tag type $tagname");
594    plc_redirect( l_tags());
595  }
596
597  case 'delete-tag-types': {
598    $tag_type_ids = $_POST['tag_type_ids'];
599    if ( ! $tag_type_ids) {
600      drupal_set_message("action=$action - No tag selected");
601      return;
602    }
603    $success=true;
604    $counter=0;
605    foreach ($tag_type_ids as $tag_type_id) 
606      if ($api->DeleteTagType(intval($tag_type_id)) != 1) 
607        $success=false;
608      else
609        $counter++;
610    if ($success) 
611      drupal_set_message ("Deleted $counter tag(s)");
612    else
613      drupal_set_error ("Could not delete all selected tags, only $counter were removed");
614    plc_redirect (l_tags());
615    break;
616  }
617
618 //////////////////////////////////////// tags   
619  case 'set-tag-on-node': 
620  case 'set-tag-on-interface': {
621    
622    $node_mode = false;
623    if ($action == 'set-tag-on-node') $node_mode=true;
624
625    if ($node_mode)
626      $node_id = intval($_POST['node_id']);
627    else 
628      $interface_id=intval($_POST['interface_id']);
629    $tag_type_id = intval($_POST['tag_type_id']);
630    $value = $_POST['value'];
631
632    $tag_types=$api->GetTagTypes(array($tag_type_id));
633    if (count ($tag_types) != 1) {
634      drupal_set_error ("Could not locate tag_type_id $tag_type_id </br> Tag not set.");
635    } else {
636      if ($node_mode) 
637        $tags = $api->GetNodeTags (array('node_id'=>$node_id, 'tag_type_id'=> $tag_type_id));
638      else
639        $tags = $api->GetInterfaceTags (array('interface_id'=>$interface_id, 'tag_type_id'=> $tag_type_id));
640      if ( count ($tags) == 1) {
641        $tag=$tags[0];
642        if ($node_mode) {
643          $tag_id=$tag['node_tag_id'];
644          $result=$api->UpdateNodeTag($tag_id,$value);
645        } else {
646          $tag_id=$tag['interface_tag_id'];
647          $result=$api->UpdateInterfaceTag($tag_id,$value);
648        }
649        if ($result == 1) 
650          drupal_set_message ("Updated tag, new value = $value");
651        else
652          drupal_set_error ("Could not update tag");
653      } else {
654        if ($node_mode)
655          $tag_id = $api->AddNodeTag($node_id,$tag_type_id,$value);
656        else
657          $tag_id = $api->AddInterfaceTag($interface_id,$tag_type_id,$value);
658        if ($tag_id) 
659          drupal_set_message ("Created tag, new value = $value");
660        else
661          drupal_set_error ("Could not create tag");
662      }
663    }
664    
665    if ($node_mode)
666      plc_redirect (l_node($node_id));
667    else
668      plc_redirect (l_interface($interface_id));
669  }
670
671  case 'delete-node-tags' : 
672  case 'delete-interface-tags' : {
673
674    $node_mode = false;
675    if ($action == 'delete-node-tags') $node_mode=true;
676
677    if ($node_mode)
678      $tag_ids=$_POST['node_tag_ids'];
679    else
680      $tag_ids=$_POST['interface_tag_ids'];
681
682    if ( ! $tag_ids) {
683      drupal_set_message("action=$action - No tag selected");
684      return;
685    }
686    $success=true;
687    $counter=0;
688    foreach( $tag_ids as $tag_id ) {
689      if ($node_mode)
690        $retcod = $api->DeleteNodeTag( intval( $tag_id ));
691      else
692        $retcod = $api->DeleteInterfaceTag( intval( $tag_id ));
693      if ($retcod != 1) 
694        $success=false;
695      else
696        $counter++;
697    }
698    if ($success) 
699      drupal_set_message ("Deleted $counter tag(s)");
700    else
701      drupal_set_error ("Could not delete all selected tags, only $counter were removed");
702    if ($node_mode)
703      plc_redirect(l_node($_POST['node_id']));
704    else
705      plc_redirect(l_interface($_POST['interface_id']));
706  }
707
708
709 ////////////////////////////////////////
710
711  case 'debug': {
712    plc_debug('GET',$_GET);
713    plc_debug('POST',$_POST);
714    plc_debug('FILES',$_FILES);
715    return;
716  }
717
718  default: {
719    plc_error ("Unknown action $action in actions.php");
720    return;
721  }
722
723  }
724
725 ?>