encode/decode previous initscript code
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 23 Mar 2011 10:54:34 +0000 (11:54 +0100)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 23 Mar 2011 10:54:34 +0000 (11:54 +0100)
planetlab/common/actions.php
planetlab/slices/slice.php

index 9950d5b..c4290af 100644 (file)
@@ -714,7 +714,7 @@ Our support team will be glad to answer any question that you might have.
    $slice_id = intval ($_POST['slice_id']);    
    $previous_initscript=$_POST['previous-initscript'];
    $initscript=$_POST['initscript'];
-   $previous_initscript_code=$_POST['previous-initscript-code'];
+   $previous_initscript_code=html_entity_decode($_POST['previous-initscript-code']);
    $initscript_code=$_POST['initscript-code'];
 
    $changes=FALSE;
index 2c87bca..d5e743d 100644 (file)
@@ -930,11 +930,17 @@ if ($local_peer) {
   $toggle->start();
 
   $details=new PlekitDetails(TRUE);
+  // we expose the previous values so that actions.php can know if changes are really needed
+  // the code needs to be encoded as it may contain any character
+  // as far as the code, this does not work too well b/c what actions.php receives
+  // seems to have spurrious \r chars, and the comparison between old and new values 
+  // is not reliable, which results in changes being made although the code hasn't changed
+  // hve spent too much time on this, good enough for now...
   $details->form_start(l_actions(),array('action'=>'update-initscripts',
                                         'slice_id'=>$slice_id,
                                         'name'=>$name,
                                         'previous-initscript'=>$initscript,
-                                        'previous-initscript-code'=>$initscript_code));
+                                        'previous-initscript-code'=>htmlentities($initscript_code)));
   $details->start();
   // comppute a pulldown with available names
   $selectors=array();