From: Thierry Parmentelat Date: Wed, 4 Feb 2009 10:17:34 +0000 (+0000) Subject: redirects X-Git-Tag: PLEWWW-4.3-1~62 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=305c3ccb1a65dc994558ec83e5fc3b877686e07f;p=plewww.git redirects --- diff --git a/planetlab/actions.php b/planetlab/actions.php index 437541a..b41dc5d 100644 --- a/planetlab/actions.php +++ b/planetlab/actions.php @@ -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)); } diff --git a/planetlab/css/plc_style.css b/planetlab/css/plc_style.css index cc99aef..7e21a05 100644 --- a/planetlab/css/plc_style.css +++ b/planetlab/css/plc_style.css @@ -38,6 +38,7 @@ h2.plc { } .plc-error { background: red; + font-weight:bold; } *.plc-warning a:link { text-decoration: none; color:white } diff --git a/planetlab/includes/plc_functions.php b/planetlab/includes/plc_functions.php index 29136c7..ff4afd7 100644 --- a/planetlab/includes/plc_functions.php +++ b/planetlab/includes/plc_functions.php @@ -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 "
Error " . $text . "
"; } -function plc_errors ($list) { - print( "
" ); - print( "

The following errors occured:

" ); - print("
\n" ); } function plc_warning_text ($text) { return "" . $text . "";} @@ -343,5 +345,10 @@ function plc_comon_button ($id_name, $id_value,$target="") { return $result; } +//////////////////// +function plc_redirect ($url) { + header ("Location: " . $url); + exit (); +} ?> diff --git a/planetlab/login.php b/planetlab/login.php index 4302edd..92c7767 100644 --- a/planetlab/login.php +++ b/planetlab/login.php @@ -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 { diff --git a/planetlab/logout.php b/planetlab/logout.php index b518ed1..d4b88bf 100644 --- a/planetlab/logout.php +++ b/planetlab/logout.php @@ -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 +?> diff --git a/planetlab/nodes/comon.php b/planetlab/nodes/comon.php index 2406c1c..5912eae 100644 --- a/planetlab/nodes/comon.php +++ b/planetlab/nodes/comon.php @@ -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); ?> diff --git a/planetlab/nodes/interfaces.php b/planetlab/nodes/interfaces.php index 9cbdca0..9715b56 100644 --- a/planetlab/nodes/interfaces.php +++ b/planetlab/nodes/interfaces.php @@ -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 '
' . $error . '.
'; } else { - Header( "Location: index.php?id=$node_id" ); - exit(); + plc_redirect(l_node($node_id)); } } diff --git a/planetlab/nodes/node_actions.php b/planetlab/nodes/node_actions.php index a5db54a..6de70c9 100644 --- a/planetlab/nodes/node_actions.php +++ b/planetlab/nodes/node_actions.php @@ -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 "". $error . "\n" ; echo "

Press back to retry

"; @@ -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 "
no such boot state " . $_POST['boot_state'] . "
"; @@ -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; } diff --git a/planetlab/nodes/setting_action.php b/planetlab/nodes/setting_action.php index 8576a96..1d04d10 100644 --- a/planetlab/nodes/setting_action.php +++ b/planetlab/nodes/setting_action.php @@ -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" ); } /* diff --git a/planetlab/nodes/sliver_action.php b/planetlab/nodes/sliver_action.php index cf0b347..77abdad 100644 --- a/planetlab/nodes/sliver_action.php +++ b/planetlab/nodes/sliver_action.php @@ -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)); } diff --git a/planetlab/persons/update.php b/planetlab/persons/update.php index cd7f99c..b1fd143 100644 --- a/planetlab/persons/update.php +++ b/planetlab/persons/update.php @@ -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(); } } diff --git a/planetlab/sites/delete_site.php b/planetlab/sites/delete_site.php index c5e8f5e..6273815 100644 --- a/planetlab/sites/delete_site.php +++ b/planetlab/sites/delete_site.php @@ -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']; diff --git a/planetlab/sites/pcu.php b/planetlab/sites/pcu.php index 3f5c229..ebd300a 100644 --- a/planetlab/sites/pcu.php +++ b/planetlab/sites/pcu.php @@ -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)); } diff --git a/planetlab/sites/site.php b/planetlab/sites/site.php index 117e29c..c4d64dc 100644 --- a/planetlab/sites/site.php +++ b/planetlab/sites/site.php @@ -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(); diff --git a/planetlab/sites/site_action.php b/planetlab/sites/site_action.php index f1dc4e8..0250a55 100644 --- a/planetlab/sites/site_action.php +++ b/planetlab/sites/site_action.php @@ -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; } diff --git a/planetlab/sites/switch_site.php b/planetlab/sites/switch_site.php index 5e5975d..87b8d9a 100644 --- a/planetlab/sites/switch_site.php +++ b/planetlab/sites/switch_site.php @@ -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']; diff --git a/planetlab/sites/update_site.php b/planetlab/sites/update_site.php index 80eaf69..9b0ef32 100644 --- a/planetlab/sites/update_site.php +++ b/planetlab/sites/update_site.php @@ -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 "
"; print_r( $fields ); echo "
"; + plc_redirect(l_site($site_id)); } } diff --git a/planetlab/slices/add_slice.php b/planetlab/slices/add_slice.php index 3a3ca8c..bed3f12 100644 --- a/planetlab/slices/add_slice.php +++ b/planetlab/slices/add_slice.php @@ -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(); diff --git a/planetlab/slices/delete_slice.php b/planetlab/slices/delete_slice.php index c398517..75ff980 100644 --- a/planetlab/slices/delete_slice.php +++ b/planetlab/slices/delete_slice.php @@ -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 diff --git a/planetlab/slices/index.php b/planetlab/slices/index.php index 1b35d03..5e90139 100644 --- a/planetlab/slices/index.php +++ b/planetlab/slices/index.php @@ -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 "

No slice found, or all are expired."; } 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 '

'; print_r( $api->trace() ) ; print '
'; - if ( ! $slice_info) { + if ( ! $slices) { echo "

No Slices on site, or all are expired.\n"; } else { echo "\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 { \n \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(""; diff --git a/planetlab/slices/renew_slice.php b/planetlab/slices/renew_slice.php index 88512c4..a106b17 100644 --- a/planetlab/slices/renew_slice.php +++ b/planetlab/slices/renew_slice.php @@ -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 diff --git a/planetlab/slices/slice_action.php b/planetlab/slices/slice_action.php index 98a7d67..007c7f9 100644 --- a/planetlab/slices/slice_action.php +++ b/planetlab/slices/slice_action.php @@ -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; } diff --git a/planetlab/slices/slice_nodes.php b/planetlab/slices/slice_nodes.php index 95566fe..72f0ae7 100644 --- a/planetlab/slices/slice_nodes.php +++ b/planetlab/slices/slice_nodes.php @@ -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()); } diff --git a/planetlab/slices/slice_users.php b/planetlab/slices/slice_users.php index 5fb2297..a07c63a 100644 --- a/planetlab/slices/slice_users.php +++ b/planetlab/slices/slice_users.php @@ -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()); } diff --git a/planetlab/slices/update_slice.php b/planetlab/slices/update_slice.php index 6605915..59c3f6a 100644 --- a/planetlab/slices/update_slice.php +++ b/planetlab/slices/update_slice.php @@ -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 +?> diff --git a/planetlab/sulogout.php b/planetlab/sulogout.php index c580579..1eaef9e 100644 --- a/planetlab/sulogout.php +++ b/planetlab/sulogout.php @@ -23,6 +23,6 @@ if ($plc->person) { } -Header("Location: /db/persons/index.php"); +plc_redirect(l_persons()); ?> diff --git a/planetlab/tags/tag_action.php b/planetlab/tags/tag_action.php index abd0781..7f66e4e 100644 --- a/planetlab/tags/tag_action.php +++ b/planetlab/tags/tag_action.php @@ -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" ); } diff --git a/planetlab/tags/tag_set.php b/planetlab/tags/tag_set.php index 69b7a0d..afb66ce 100644 --- a/planetlab/tags/tag_set.php +++ b/planetlab/tags/tag_set.php @@ -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'] ); diff --git a/planetlab/tags/tags.php b/planetlab/tags/tags.php index 8b768d7..298accb 100644 --- a/planetlab/tags/tags.php +++ b/planetlab/tags/tags.php @@ -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);
Description: $description
URL: $url
"); 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 "