// Common functions
require_once 'plc_functions.php';
-require_once 'plc_sorts.php';
// find person roles
$_person= $plc->person;
$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();
$api->DeleteNodeFromPCU( intval( $rem_id ), $pcu_id );
- header( "Location: /db/sites/pcu.php?id=$pcu_id" );
- exit();
+ plc_redirect (l_pcu ($pcu_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));
}
+ if( in_array( 10, $_roles) ) {
+ $is_admin= true;
+ } else {
+ $is_admin = false;
+ }
+
if( in_array( 10, $_roles ) || ( in_array( 20, $_roles ) && in_array( $pcu_info[0]['site_id'], $_person['site_ids'] ) ) || ( in_array( 40, $_roles ) && in_array( $pcu_info[0]['site_id'], $_person['site_ids'] ) ) )
$pcu_controller= true;
echo "</td></tr>\n
<tr><th>Model: </th><td>";
- if( $pcu_controller )
+ // NOTE: in general, this value should not be edited, so only allow admins.
+ if( $pcu_controller && $is_admin )
echo "<input type=text name='model' value='";
echo $pcu_info[0]['model'];
- if( $pcu_controller )
+ if( $pcu_controller && $is_admin )
echo "'>";
echo "</td></tr>\n