redirects
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 4 Feb 2009 10:17:34 +0000 (10:17 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 4 Feb 2009 10:17:34 +0000 (10:17 +0000)
29 files changed:
planetlab/actions.php
planetlab/css/plc_style.css
planetlab/includes/plc_functions.php
planetlab/login.php
planetlab/logout.php
planetlab/nodes/comon.php
planetlab/nodes/interfaces.php
planetlab/nodes/node_actions.php
planetlab/nodes/setting_action.php
planetlab/nodes/sliver_action.php
planetlab/persons/update.php
planetlab/sites/delete_site.php
planetlab/sites/pcu.php
planetlab/sites/site.php
planetlab/sites/site_action.php
planetlab/sites/switch_site.php
planetlab/sites/update_site.php
planetlab/slices/add_slice.php
planetlab/slices/delete_slice.php
planetlab/slices/index.php
planetlab/slices/renew_slice.php
planetlab/slices/slice_action.php
planetlab/slices/slice_nodes.php
planetlab/slices/slice_users.php
planetlab/slices/update_slice.php
planetlab/sulogout.php
planetlab/tags/tag_action.php
planetlab/tags/tag_set.php
planetlab/tags/tags.php

index 437541a..b41dc5d 100644 (file)
@@ -77,8 +77,7 @@ switch ($action) {
  case 'add-person-to-site': {
    $site_id = $_POST['site_id'];
    $api->AddPersonToSite( intval( $person_id ), intval( $site_id ) );
-   header( "location: " . l_person($person_id));
-   exit();
+   plc_redirect (l_person($person_id));
  }
 
  case 'remove-person-from-sites': {
@@ -90,8 +89,7 @@ switch ($action) {
    foreach ( $site_ids as $site_id ) {
      $api->DeletePersonFromSite( intval( $person_id ), intval( $site_id ) );
    }
-   header( "location: " . l_person($person_id));
-   exit();
+   plc_redirect (l_person($person_id));
  }
 
  case 'remove-roles-from-person' : {
@@ -103,41 +101,35 @@ switch ($action) {
    foreach( $role_ids as $role_id)  {
      $api->DeleteRoleFromPerson( intval( $role_id ), intval( $person_id ) );
    }
-   header( "location: " . l_person($person_id));
-   exit();
+   plc_redirect (l_person($person_id));
  }
      
  case 'add-role-to-person' : {
    $role_id=$_POST['role_id'];
    $api->AddRoleToPerson( intval( $role_id ), intval( $person_id ) );
-   header( "location: " . l_person($person_id));
-   exit();
+   plc_redirect (l_person($person_id));
  }
 
  case 'enable-person' : {
    $fields = array( "enabled"=>true );
    $api->UpdatePerson( intval( $person_id ), $fields );
-   header( "location: " . l_person($person_id));
-   exit();
+   plc_redirect (l_person($person_id));
  }
 
  case 'disable-person' : {
    $fields = array( "enabled"=>false );
    $api->UpdatePerson( intval( $person_id ), $fields );
-   header( "location: " . l_person($person_id));
-   exit();
+   plc_redirect (l_person($person_id));
  }
 
  case 'become-person' : {
    $plc->BecomePerson (intval($person_id));
-   header ("location: " . l_persons());
-   exit();
+   plc_redirect (l_persons());
  }
 
  case 'delete-person' : {
   $api->DeletePerson( intval( $person_id ) );
-  header( "location: " . l_persons() );
-  exit();
+   plc_redirect (l_persons());
  }
 
  case 'delete-keys' : {
@@ -149,8 +141,7 @@ switch ($action) {
    foreach( $key_ids as $key_id ) {
      $api->DeleteKey( intval( $key_id ) );
    }
-   header( "location: " . l_person($person_id));
-   exit();
+   plc_redirect(l_person($person_id));
  }
 
  case 'upload-key' : {
@@ -185,8 +176,7 @@ switch ($action) {
      plc_error("Please verify your SSH  file content");
      return;
    }
-   header( "location: " . l_person($person_id));
-   exit();
+   plc_redirect(l_person($person_id));
  }
 
  case 'update-tag-type': {
@@ -207,8 +197,7 @@ switch ($action) {
    // Update it!
    $api->UpdateTagType( $tag_type_id, $tag_type_fields );
    
-   header( "location: " . l_tag($tag_type_id));
-   exit();
+   plc_redirect(l_tag($tag_type_id));
  }
 
  case 'add-tag-type': {
@@ -229,8 +218,7 @@ switch ($action) {
    $id=$api->AddTagType( $tag_type_fields );
    drupal_set_message ("tag type $id created");
   
-   header( "location: " . l_tag($id));
-   exit();
+   plc_redirect( l_tag($id));
  }
 
  case 'delete-site': {
@@ -239,8 +227,7 @@ switch ($action) {
      drupal_set_message ("Site $site_id deleted");
    else
      drupal_set_error("Failed to delete site $site_id");
-   header ("location: " . l_sites());
-   exit();
+   plc_redirect (l_sites());
  }
 
  case 'expire-all-slices-in-site': {
@@ -259,8 +246,7 @@ switch ($action) {
    }
    // update site to not allow slice creation or renewal
    $api->UpdateSite( $site_id, array( "max_slices" => 0 )) ;
-   header ("location: " . l_site($site_id));
-   exit(0);
+   plc_redirect (l_site($site_id));
  }
 
  case 'set-tag-on-node': {
@@ -291,8 +277,7 @@ switch ($action) {
      }
    }
    
-   header ("location: " . l_node($node_id));
-   exit();
+   plc_redirect (l_node($node_id));
  }
 
 
index cc99aef..7e21a05 100644 (file)
@@ -38,6 +38,7 @@ h2.plc {
 }
 .plc-error {
     background: red;
+    font-weight:bold;
 }
 
 *.plc-warning a:link { text-decoration: none; color:white }
index 29136c7..ff4afd7 100644 (file)
@@ -109,6 +109,7 @@ function l_doc_plcapi()                     { return "/db/doc/PLCAPI.php"; }
 function l_doc_nmapi()                 { return "/db/doc/NMAPI.php"; }
 function l_admin()                     { return "/db/adminsearch.php"; }
 
+function l_login()                     { return "/db/login.php"; }
 function l_logout()                    { return "/planetlab/logout.php"; }
 function l_sulogout()                  { return "/planetlab/sulogout.php"; }
 function l_reset_password()            { return "/db/persons/reset_password.php"; }
@@ -275,14 +276,15 @@ function plc_error ($text) {
   print "<div class='plc-error'> Error " . $text . "</div>";
 }
 
-function plc_errors ($list) {
-  print( "<div class='plc-error'>" );
-  print( "<p style='font-weight:bold'>The following errors occured:</p>" );
-  print("<ul>");
-  foreach( $errors as $err ) {
-    print( "<li>$err</li>\n" );
+function plc_errors ($errors) {
+  if ($errors) {
+    print( "<div class='plc-error'>" );
+    print( "<p>The following errors occured:</p>" );
+    print("<ul>");
+    foreach( $errors as $error ) 
+      print( "<li>$error</li>\n" );
+    print( "</ul></div>\n" );
   }
-  print( "</ul></div>\n" );
 }
 
 function plc_warning_text ($text)      { return "<span class='plc-warning'>" . $text . "</span>";}
@@ -343,5 +345,10 @@ function plc_comon_button ($id_name, $id_value,$target="") {
   return $result;
 }
 
+////////////////////
+function plc_redirect ($url) {
+  header ("Location: " . $url);
+  exit ();
+}
 
 ?>
index 4302edd..92c7767 100644 (file)
@@ -31,7 +31,7 @@ if (!empty($_REQUEST['email']) &&
 
     if (empty($_REQUEST['url'])) {
       // XXX Redirect to default home page
-      Header("Location: /");
+      header("Location: /");
       exit();
     } else {
       // Make sure that redirections are always local
@@ -39,7 +39,7 @@ if (!empty($_REQUEST['email']) &&
       if ($url[0] != "/") {
        $url = "/$url";
       }
-      Header("Location: $url");
+      header("Location: $url");
       exit();
     }
   } else {
index b518ed1..d4b88bf 100644 (file)
@@ -25,6 +25,6 @@ if ($plc->person) {
 // Destroy PHP session
 session_destroy();
 
-Header("Location: /db/login.php");
+plc_redirect(l_login());
 
-?>
\ No newline at end of file
+?>
index 2406c1c..5912eae 100644 (file)
@@ -111,6 +111,6 @@ $url = plc_comon_url_from_ips("http://comon.cs.princeton.edu",$all_ips);
 
 
 // redirect to comon
-header("Location: " . $url);
+plc_redirect($url);
 
 ?>
index 9cbdca0..9715b56 100644 (file)
@@ -50,8 +50,8 @@ foreach( array( 'method', 'type', 'ip', 'gateway', 'network', 'broadcast', 'netm
 
 // Either interface_id or node_id must be specified in URL
 if( !isset( $_GET['node_id'] ) && !( $nodes= $api->GetNodes( array( intval($node_id) ), array( 'node_id', 'hostname', 'site_id' ) ) ) ) {
-  Header( "Location: index.php" );
-  exit();
+  drupal_set_error ("Malformed URL");
+  plc_redirect(l_nodes());
 }
 
 
@@ -72,8 +72,7 @@ if( $can_update && (isset( $_POST['submitted'] ) || isset ($_GET['submitted']))
   elseif ( isset( $_POST['delete'] ) || isset( $_GET['delete']) || isset( $_POST['update'] ) ) {
     // interface_id must be specified in URL
     if( !isset( $id ) ) {
-      Header( "Location: index.php?id=$node_id" );
-      exit();
+      plc_redirect(l_node($node_id));
     }
     if( isset( $_POST['delete'] ) || isset ($_GET['delete']) ) {
       $api->DeleteInterface( $id );
@@ -88,8 +87,7 @@ if( $can_update && (isset( $_POST['submitted'] ) || isset ($_GET['submitted']))
   if( !empty( $error ) ) {
     echo '<div class="plc-warning">' . $error . '.</div>';
   } else {
-    Header( "Location: index.php?id=$node_id" );
-    exit();
+    plc_redirect(l_node($node_id));
   }
   
 }
index a5db54a..6de70c9 100644 (file)
@@ -129,8 +129,7 @@ function show_download_confirm_button ($api, $node_id, $action, $can_gen_config,
 // check arguments
 
 if (empty($_POST['node_id'])) {
-  header ('location:index.php');
-  exit();
+  plc_redirect (l_nodes());
  } else {
   $node_id = intval($_POST['node_id']);
 }
@@ -176,8 +175,7 @@ switch ($action) {
    $error= $api->error();
 
    if( empty( $error ) ) {
-     header( "location: index.php?id=$node_id" );
-     exit();
+     plc_redirect(l_node($node_id));
    } else {
      echo "<font color=red>". $error . "</font>\n" ;
      echo "<p> Press back to retry</p>";
@@ -189,8 +187,7 @@ switch ($action) {
    // from former node_actions.php
  case "delete":
    $api->DeleteNode( intval( $node_id ) );
-   header( "location: index.php" );
-   exit();
+   plc_redirect(l_nodes());
    break;
 
    // ACTION: boot-state
@@ -204,8 +201,7 @@ switch ($action) {
    case 'rcnf':
    case 'new':
      $api->UpdateNode( intval( $node_id ), array( "boot_state" => $_POST['boot_state'] ) );
-     header( "location: index.php?id=$node_id" );
-     exit();
+     plc_redirect (l_node($node_id));
      break;
    default:
      print "<div class='plc-error'> no such boot state " . $_POST['boot_state'] . "</div>";
@@ -420,8 +416,7 @@ if( $has_primary ) {
  
  default:
    echo "Unkown action <$action>.";
-   header("location:index.php?id=" . $node_id);
-   exit();
+   plc_redirect (l_node($node_id));
    break;
  }
 
index 8576a96..1d04d10 100644 (file)
@@ -36,8 +36,7 @@ if( $_POST['edit_type'] ) {
   }
   
   // xxx check the destination page
-  header( "location: settings.php" );
-  exit();
+  plc_redirect ("settings.php");
 }
 
 // tag type adds
@@ -50,8 +49,7 @@ if( $_POST['add_type'] ) {
   $api->AddTagType( $setting_type );
 
   // xxx check the destination page
-  header( "location: settings.php" );
-  exit();
+  plc_redirect ("settings.php");
 }
   
 
@@ -67,8 +65,7 @@ if( $_GET['rem_id'] ) {
   // delete the tag
   $api->DeleteInterfaceTag( $setting_id );
 
-  header( "location: interfaces.php?id=$interface_id" );
-  exit();
+  plc_redirect (l_interface($interface_id));
 }
 
 // tag adds
@@ -81,8 +78,7 @@ if( $_POST['add_setting'] ) {
   // add it!
   $api->AddInterfaceTag( $interface_id, $interface_tag_type_id, $value );
 
-  header( "location: interfaces.php?id=$interface_id" );
-  exit();
+  plc_redirect (l_interface($interface_id));
 }
 
 // tag updates
@@ -95,8 +91,7 @@ if( $_POST['edit_setting'] ) {
   // update it!
   $api->UpdateInterfaceTag($setting_id, $value );
 
-  header( "location: interfaces.php?id=$interface_id" );
-  exit();
+  plc_redirect (l_interface($interface_id));
 }
 
 // Settings -------------------------------------------------
@@ -112,8 +107,7 @@ if( $_GET['del_type'] ) {
   $api->DeleteTagType( $type_id );
   
   // xxx check the destination page
-  header( "location: settings.php" );
-  exit();
+  plc_redirect ("settings.php" );
 }
   
 /*
index cf0b347..77abdad 100644 (file)
@@ -31,9 +31,9 @@ if( !empty( $_POST['add_sub'] ) ) {
 
   $api->AddSliceTag( intval( $slice_id ), intval( $tag_type ), $value, intval( $node_id ) );
 
-  header( "location: slivers.php?slice=$slice_id&node=$node_id" );
-  exit();
-  
+  // xxx l_sliver ?
+  plc_redirect (l_sliver ($node_id,$slice_id));
+  //header( "location: slivers.php?slice=$slice_id&node=$node_id" );
 }
 
 
@@ -42,13 +42,14 @@ if( $_GET['rem_id'] ) {
   $tag_id= $_GET['rem_id'];
   
   // get the slivers for this node
-  $sliver_info= $api->GetSliceTags( array( "slice_tag_id"=>intval( $tag_id ) ), array( "slice_id", "node_id" ) );
+  $slivers= $api->GetSliceTags( array( "slice_tag_id"=>intval( $tag_id ) ), array( "slice_id", "node_id" ) );
+  $sliver=$slivers[0];
   
   $api->DeleteSliceTag( intval( $tag_id ) );
 
-  header( "location: slivers.php?slice=". $sliver_info[0]['slice_id'] ."&node=". $sliver_info[0]['node_id'] );
-  exit();
-  
+  $node_id=$sliver['node_id'];
+  $slice_id=$sliver['slice_id'];
+  plc_redirect (l_sliver ($node_id,$slice_id));
 }
 
   
index cd7f99c..b1fd143 100644 (file)
@@ -22,8 +22,7 @@ $is_submitted= isset($_POST['submitted']) ? $_POST['submitted'] : 0;
 if( isset($_GET['id']) && is_numeric($_GET['id']) ) {
   $person_id= intval($_GET['id']);
  } else {
-  header( "location: index.php" );
-  exit();
+  plc_redirect (l_sites());
  }
 
 $errors= array();
@@ -59,11 +58,9 @@ if( $is_submitted ) {
     
     $rc= $api->UpdatePerson( intval( $person_id ), $update_vals);
     
-    if( $rc == 1 ) {
-      Header( "Location: /db/persons/index.php?id=$person_id" );
-      exit();
-    }
-    elseif ($rc === NULL) {
+    if ( $rc == 1 ) {
+      plc_redirect(l_person($person_id));
+    } elseif ($rc === NULL) {
       $errors[] = $api->error();
     }
   }
index c5e8f5e..6273815 100644 (file)
@@ -24,10 +24,8 @@ $_roles= $_person['role_ids'];
 
 
 // if no id redirect
-if( !$_GET['id'] ) {
-  header( "location: index.php" );
-  exit();
- }
+if( !$_GET['id'] ) 
+  plc_redirect (l_sites());
 
 // set the site_id
 $site_id= $_GET['id'];
index 3f5c229..ebd300a 100644 (file)
@@ -34,7 +34,8 @@ if( !$_GET['id'] ) {
     $pcu_id= $api->AddPCU( $site_id, $fields );
     
     if( $pcu_id != 0 ) {
-      header( "location: /db/sites/pcu.php?id=$pcu_id" );
+      // xxx is l_pcu defined & effective ?
+      plc_redirect( l_pcu($pcu_id));
       exit();
     } else {
       $error= $api->error();
@@ -67,8 +68,7 @@ if( !$_GET['id'] ) {
     
     $api->DeleteNodeFromPCU( intval( $rem_id ), $pcu_id );
     
-    header( "Location: /db/sites/pcu.php?id=$pcu_id" );
-    exit();
+    plc_redirect (l_pcu ($pcu_id));
     
   }
   
@@ -84,8 +84,7 @@ if( !$_GET['id'] ) {
     
     $api->UpdatePCU( $pcu_id, array( "protocol"=>$protocol, "hostname"=>$hostname, "model"=>$model, "password"=>$password, "notes"=>$notes, "ip"=>$ipaddress ) );
                
-    header( "Location: /db/sites/pcu.php?id=$pcu_id" );
-    exit();
+    plc_redirect (l_pcu($pcu_id));
                
   }
        
index 117e29c..c4d64dc 100644 (file)
@@ -153,22 +153,6 @@ plc_details_line("Peer",$peers->peer_link($peer_id));
 
 if ( $local_peer ) {
 
-  // Addresses
-  if ($addresses) {
-    plc_details_space_line();
-    plc_details_line("Addresses","");
-    foreach ($addresses as $address) {
-      plc_details_line(plc_vertical_table($address['address_types']),
-                      plc_vertical_table(array($address['line1'],
-                                               $address['line2'],
-                                               $address['line3'],
-                                               $address['city'],
-                                               $address['state'],
-                                               $address['postalcode'],
-                                               $address['country'])));
-    }
-  }
-
   // Nodes
   plc_details_space_line();
   $nb_boot = 0;
@@ -179,6 +163,7 @@ if ( $local_peer ) {
   $nodes_text= plc_vertical_table(array_map ("n_link",$nodes));
   plc_details_line ("hostnames",$nodes_text);
                   
+
   // Users
   plc_details_space_line();
   $user_text = count($person_ids) . " total / " .
@@ -195,6 +180,7 @@ if ( $local_peer ) {
   $tech_text = plc_vertical_table (array_map ("p_link",$techs));
   plc_details_line("techs's",$tech_text);
 
+
   // Slices
   plc_details_space_line();
   // summary on # slices
@@ -205,6 +191,22 @@ if ( $local_peer ) {
      plc_details_line($slice['instantiation'],l_slice_text($slice));
 
 
+  // Addresses
+  if ($addresses) {
+    plc_details_space_line();
+    plc_details_line("Addresses","");
+    foreach ($addresses as $address) {
+      plc_details_line(plc_vertical_table($address['address_types']),
+                      plc_vertical_table(array($address['line1'],
+                                               $address['line2'],
+                                               $address['line3'],
+                                               $address['city'],
+                                               $address['state'],
+                                               $address['postalcode'],
+                                               $address['country'])));
+    }
+  }
+
  }
 
 plc_details_end();
index f1dc4e8..0250a55 100644 (file)
@@ -30,16 +30,13 @@ if( $_POST['actions'] ) {
   // depending on action, run function
   switch( $_POST['actions'] ) {
     case "update":
-      header( "location: update_site.php?id=$site_id" );
-      exit();
+      plc_redirect( "update_site.php?id=$site_id" );
       break;
     case "delete":
-      header( "location: delete_site.php?id=$site_id" );
-      exit();
+      plc_redirect( "delete_site.php?id=$site_id" );
       break;
     case "expire":
-      header( "location: expire.php?id=$site_id" );
-      exit();
+      plc_redirect( "expire.php?id=$site_id" );
       break;
      
   }
index 5e5975d..87b8d9a 100644 (file)
@@ -18,10 +18,8 @@ $_roles= $_person['role_ids'];
 
 
 // if no site id redirect
-if( !$_GET['id'] ) {
-  header( "location: index.php" );
-  exit();
- }
+if( !$_GET['id'] ) 
+  plc_redirect(l_sites());
 
 // get site_id
 $site_id= $_GET['id'];
index 80eaf69..9b0ef32 100644 (file)
@@ -69,8 +69,7 @@ if( $_POST['submitted'] ) {
     $fields= array( "name" => $name, "url" => $url, "longitude" => floatval( $longitude ), "login_base" => $login_base, "latitude" => floatval( $latitude ), "is_public" => true, "abbreviated_name" => $abbrev_name, "max_slices" => intval( $max_slices ) );
     $api->UpdateSite( intval( $site_id ), $fields );
     // Thierry aug 31 07 - redirect to the site's details page
-    header("location: index.php?id=$site_id");
-    //echo "<pre>"; print_r( $fields ); echo "</pre>";
+    plc_redirect(l_site($site_id));
   }
   
 }
index 3a3ca8c..bed3f12 100644 (file)
@@ -64,7 +64,7 @@ if( $_POST['add'] ) {
     $slice_new_id= $api->AddSlice( $fields );
 
     if( $slice_new_id ) {
-      header( "location: index.php?id=$slice_new_id" );
+      plc_redirect( "index.php?id=$slice_new_id" );
       exit();
     } else {
       $error['api']= $api->error();
index c398517..75ff980 100644 (file)
@@ -27,9 +27,7 @@ $slice_id= $_GET['id'];
 // delete it!
 if( $_POST['delete'] ) {
   $api->DeleteSlice( intval( $slice_id ) );
-  
-  header( "location: index.php" );
-  exit();
+  plc_redirect(l_slices());
 }
 
 // Print header
index 1b35d03..5e90139 100644 (file)
@@ -33,10 +33,11 @@ $_roles= $_person['role_ids'];
 if( $_POST['slicename'] ) {
   $slicename= $_POST['slicename'];
 
-  $slice_info= $api->GetSlices( array( $slicename ), array( "slice_id" ) );
+  $slices= $api->GetSlices( array( $slicename ), array( "slice_id" ) );
+  $slice=$slices[0];
+  $slice_id=$slice['slice_id'];
 
-  header( "location: index.php?id=". $slice_info[0]['slice_id'] );
-  exit();
+  plc_redirect(l_slice($slice_id));
 
 }
 
@@ -122,10 +123,11 @@ if( !$_GET['id'] ) {
     echo "<p><strong>No slice found, or all are expired.</strong>";
   } else {
   
-    $slice_info= $api->GetSlices( $slice_ids, array( "slice_id", "name", "site_id", "person_ids", "expires", "peer_id" ) );
+    $slices= $api->GetSlices( $slice_ids, array( "slice_id", "name", "site_id", "person_ids", "expires", "peer_id" ) );
+    $slice=$slices[0];
     //print '<pre>'; print_r( $api->trace() ) ; print '</pre>';
 
-    if ( ! $slice_info) {
+    if ( ! $slices) {
       echo "<p><strong>No Slices on site, or all are expired.</strong>\n";
     } else  {
       echo "<table class='list_set' border=0 cellpadding=2>\n";
@@ -137,7 +139,7 @@ if( !$_GET['id'] ) {
       
       // create a list of person_ids
       $person_ids = array();
-      foreach( $slice_info as $slice ) {
+      foreach( $slices as $slice ) {
          if ( !empty($slice['person_ids']) )
            $person_ids = array_merge($person_ids, $slice['person_ids']);
        }
@@ -150,7 +152,7 @@ if( !$_GET['id'] ) {
          $persons[$person['person_id']] = $person;
        }
       
-      foreach( $slice_info as $slice ) {
+      foreach( $slices as $slice ) {
        $slice_id= $slice['slice_id'];
        $slice_name= $slice['name'];
        $slice_expires= date( "M j, Y", $slice['expires'] );
@@ -200,30 +202,28 @@ else {
   $slice_id= intval( $_GET['id'] );
 
   // GetSlices API call
-  $slice_info= $api->GetSlices( array( $slice_id ) );
+  $slices= $api->GetSlices( array( $slice_id ) );
 
-  if( empty( $slice_info ) ) {
-    header( "location: index.php" );
-    exit();
-  }
+  if( empty( $slices ) ) 
+    plc_redirect(l_slices());
 
   // pull all slice info to vars
-  $instantiation= $slice_info[0]['instantiation'];
-  $name= $slice_info[0]['name'];
-  $url= $slice_info[0]['url'];
-  $expires= date( "M j, Y", $slice_info[0]['expires'] );
-  $site_id= $slice_info[0]['site_id'];
-  $description= $slice_info[0]['description'];
-  $max_nodes= $slice_info[0]['max_nodes'];
-  $node_ids=$slice_info[0]['node_ids'];
-  $person_ids=$slice_info[0]['node_ids'];
+  $instantiation= $slice['instantiation'];
+  $name= $slice['name'];
+  $url= $slice['url'];
+  $expires= date( "M j, Y", $slice['expires'] );
+  $site_id= $slice['site_id'];
+  $description= $slice['description'];
+  $max_nodes= $slice['max_nodes'];
+  $node_ids=$slice['node_ids'];
+  $person_ids=$slice['node_ids'];
 
   // get peer id
-  $peer_id= $slice_info[0]['peer_id'];
+  $peer_id= $slice['peer_id'];
 
-  $person_ids= $slice_info[0]['person_ids'];
-  $node_ids= $slice_info[0]['node_ids'];
-  $slice_tag_ids= $slice_info[0]['slice_tag_ids'];
+  $person_ids= $slice['person_ids'];
+  $node_ids= $slice['node_ids'];
+  $slice_tag_ids= $slice['slice_tag_ids'];
 
 
   // node info
@@ -329,7 +329,7 @@ else {
        <tr><th>Description: </th><td> $description </td></tr>\n
         <tr><th>URL: </th><td> <a href='$url'>$url</a> </td></tr>\n";
        
-  if( gmmktime() > $slice_info[0]['expires'] ) { 
+  if( gmmktime() > $slice['expires'] ) { 
     $class1= ' style="color:red;"'; 
     $msg1= '(slice is expired)'; 
   }
@@ -407,6 +407,7 @@ else {
         if( $is_admin ) {
          printf("<td>");
          sprintf($label,"\\n [ %s = %s] \\n from %s",$tag['tagname'],$tag['value'],$name);
+         // xxx this is deprecated
          echo plc_delete_link_button ('tag_action.php?rem_id=' . $tag['slice_tag_id'],
                                       $label);
          echo "</td>";
index 88512c4..a106b17 100644 (file)
@@ -54,8 +54,7 @@ if( $_POST['submitted'] ) {
     // Update it!
     $api->UpdateSlice( $slice_id, $slice_fields );
     
-    header( "location: index.php?id=$slice_id" );
-    exit();
+    plc_redirect( l_slice($slice_id));
     
   }
   
@@ -63,8 +62,7 @@ if( $_POST['submitted'] ) {
 
 // if no id is set redirect back to slice index
 if( !$_POST['id'] && !$_GET['id'] ) {
-  header( "location: index.php" );
-  exit();
+  plc_redirect( l_slices());
  }
 
 // Print header
index 98a7d67..007c7f9 100644 (file)
@@ -35,20 +35,16 @@ if( $_POST['actions'] ) {
   // depending on action, run function
   switch( $_POST['actions'] ) {
     case "renew":
-      header( "location: renew_slice.php?id=$slice_id" );
-      exit();
+      plc_redirect("renew_slice.php?id=$slice_id" );
       break;
     case "delete":
-      header( "location: delete_slice.php?id=$slice_id" );
-      exit();
+      plc_redirect( "delete_slice.php?id=$slice_id" );
       break;
     case "nodes":
-      header( "location: slice_nodes.php?id=$slice_id" );
-      exit();
+      plc_redirect( "slice_nodes.php?id=$slice_id" );
       break;
     case "users":
-      header( "location: slice_users.php?id=$slice_id" );
-      exit();
+      plc_redirect( "slice_users.php?id=$slice_id" );
       break;
      
   }
index 95566fe..72f0ae7 100644 (file)
@@ -32,8 +32,7 @@ $_roles= $_person['role_ids'];
 
 // if no id ... redirect to slice index
 if( !$_GET['id'] && !$_POST['id'] ) {
-  header( "location: index.php" );
-  exit();
+  plc_redirect( l_slices());
  }
 
 
index 5fb2297..a07c63a 100644 (file)
@@ -31,8 +31,7 @@ $_roles= $_person['role_ids'];
 
 // if no id ... redirect to slice index
 if( !$_GET['id'] && !$_POST['id'] ) {
-  header( "location: index.php" );
-  exit();
+  plc_redirect(l_slices());
  }
 
   
index 6605915..59c3f6a 100644 (file)
@@ -27,8 +27,7 @@ if( !empty( $_GET['id'] ) ) {
 
 // Invalid slice name
 if( !isset( $slice ) ) {
-  Header( "Location: index.php" );
-  exit();
+  plc_redirect( l_slices());
 }
 
 // Defaults
@@ -50,8 +49,7 @@ if( isset( $_POST['submitted'] ) ) {
     // Update the slice URL and description
     $fields= array( "description"=>$slice['description'], "url"=>$slice['url'] );
     $api->UpdateSlice( intval( $slice_id ), $fields );
-    Header( "Location: index.php?id=$slice_id" );
-    exit();
+    plc_redirect(l_slice($slice_id));
   }
 }
 
@@ -108,4 +106,4 @@ EOF;
 // Print footer
 include 'plc_footer.php';
 
-?>
\ No newline at end of file
+?>
index c580579..1eaef9e 100644 (file)
@@ -23,6 +23,6 @@ if ($plc->person) {
 }
 
 
-Header("Location: /db/persons/index.php");
+plc_redirect(l_persons());
 
 ?>
index abd0781..7f66e4e 100644 (file)
@@ -23,6 +23,10 @@ $_person= $plc->person;
 $_roles= $_person['role_ids'];
 
 
+drupal_set_message ("xxx tag_action.php is deprecated - use planetlab/actions.php instead");
+return;
+
+
 // TAGS -------------------------------------------------
 
 // tag deletion
@@ -37,9 +41,7 @@ if( $_GET['rem_id'] ) {
   // delete the tag
   $api->DeleteSliceTag( $tag_id );
 
-
-  header( "location: index.php?id=$slice_id" );
-  exit();
+  plc_redirect( "index.php?id=$slice_id" );
 }
 
 
@@ -53,8 +55,7 @@ if( $_POST['edit_tag'] ) {
   // update it!
   $api->UpdateSliceTag( $tag_id, $value );
 
-  header( "location: index.php?id=$slice_id" );
-  exit();
+  plc_redirect( "index.php?id=$slice_id" );
 }
 
 
@@ -68,8 +69,7 @@ if( $_POST['add_tag'] ) {
   // add it!
   $api->AddSliceTag( $slice_id, $tag_type_id, $value );
 
-  header( "location: index.php?id=$slice_id" );
-  exit();
+  plc_redirect( "index.php?id=$slice_id" );
 }
 
 // TAG TYPES ---------------------------------------------------
@@ -90,8 +90,7 @@ if( $_POST['add_type'] ) {
   // add it!!
   $api->AddTagType( $tag_type_fields );
 
-  header( "location: tags.php?type=slice" );
-  exit();
+  plc_redirect( "tags.php?type=slice" );
 }
   
 
@@ -109,8 +108,7 @@ if( $_POST['edit_type'] ) {
   // Update it!
   $api->UpdateTagType( $tag_type_id, $tag_type_fields );
   
-  header( "location: tags.php?type=slice" );
-  exit();
+  plc_redirect( "tags.php?type=slice" );
 }
 
 
@@ -122,8 +120,7 @@ if( $_GET['del_type'] ) {
   // delete it!
   $api->DeleteTagType( $type_id );
   
-  header( "location: tags.php?type=slice" );
-  exit();
+  plc_redirect( "tags.php?type=slice" );
 }
 
   
index 69b7a0d..afb66ce 100644 (file)
@@ -18,6 +18,10 @@ require_once 'plc_functions.php';
 require_once 'plc_minitabs.php';
 require_once 'plc_tables.php';
 
+drupal_set_message ("xxx tag_set.php is deprecated - use planetlab/actions.php instead");
+return;
+
+
   // get slice id from GET
   $slice_id= intval( $_GET['add'] );
   
index 8b768d7..298accb 100644 (file)
@@ -64,6 +64,7 @@ foreach( $tag_types as $tag_type ) {
   plc_table_row_start();
   $id=$tag_type['tag_type_id'];
   if (plc_is_admin()) 
+    // xxx this is deprecated
     plc_table_cell(plc_delete_link_button ('tag_action.php?del_type='. $id,
                                           $tag_type['tagname']));
   plc_table_cell($id);