AddSite($site); $api_error .= $adm->error(); if (empty($api_error)) { $verboses [] = "Site created as disabled, with ext_consortium_id=".$PENDING_CONSORTIUM_ID; } else { $error .= $api_error; } } if (empty($error)) { // Thierry on august 22 2007 // use NotifySupport to send this message, and get rid of the fake account $subject = "Site registration form : new site " . $site['name']; // should use GetMessages and stuff, but I do not trust the way // templates are created in db-config, for upgrades notably $template = <<< EOF We received a site registration form for site name %s To review, please visit https://%s:%d/db/sites/join_request.php?review=t&site_id=%d. EOF; $body=sprintf($template,$site['name'],PLC_WWW_HOST,PLC_WWW_SSL_PORT,$site_id); $adm->NotifySupport($subject,$body); $messages [] = "Your registration request has been received."; $messages [] = "A mail was sent to the operations team, your application should be processed shortly."; $messages [] = "Upon approval, the PI will receive an information e-mail"; $messages [] = "Please send a message to " . PLC_MAIL_SUPPORT_ADDRESS . " if this request is not instructed within a few days."; // creating address if (non_empty_address($address)) { $adm->AddSiteAddress($site_id,$address); $api_error = $adm->error(); if (empty($api_error)) { $verboses [] = "Address created"; } else { $error .= $api_error; } } // creating PI // Thierry 23 august 2007 // avoid using a pre-existing federated account $known_pi = $adm->GetPersons(array("email"=>$pi['email'], "peer_id"=>NULL), array("person_id")); if ($known_pi) { $messages [] = " Note: PI was already known"; $pi_id=$known_pi[0]['person_id']; } else { $pi['enabled']=FALSE; $pi_id=$adm->AddPerson($pi); $api_error = $adm->error(); if (empty($api_error)) { $verboses [] = "PI created as disabled

"; } else { $error .= $api_error; } } if ($adm->AddPersonToSite($pi_id,$site_id)) { $verboses [] = "PI attached to new site"; } if ($adm->AddRoleToPerson('pi',$pi_id)) { $verboses [] = $pi['email'] . " granted PI role

"; } if ($pi['email'] == $tech['email']) { // need to assign tech role so the registration request gets filled properly if ($adm->AddRoleToPerson('tech',$pi_id)) { $verboses [] = $pi['email'] . " granted Tech role

"; } } else { // creating TECH $known_tech = $adm->GetPersons(array("email"=>$tech['email'], "peer_id"=>NULL), array("person_id")); // jan-2013 with improvements in plcapi-5.1-6 about managing persons and tags, // AddPerson has gone more picky and we need to remove some fields // that no longer are silently ignored by AddPerson $user_role_required=$tech['user-role']; unset($tech['user-role']); if ($known_tech) { $messages [] = " Note: Tech was already known"; $tech_id=$known_tech[0]['person_id']; } else { $tech['enabled']=FALSE; $tech_id=$adm->AddPerson($tech); $api_error = $adm->error(); if (empty($api_error)) { $verboses [] = "Tech created as disabled

"; } else { $error .= $api_error; } } if ($adm->AddPersonToSite($tech_id,$site_id)) { $verboses [] = "Tech attached to new site"; } if ($adm->AddRoleToPerson('tech',$tech_id)) { $verboses [] = $tech['email'] . " granted Tech role"; } if ( $user_role_required && $adm->AddRoleToPerson('user',$tech_id) ) { $verboses [] = $tech['email'] . " granted User role"; } } } // Show messages if (!empty($messages)) { print '
"; } if ($verbose && !empty($verboses)) { print '
"; } if (!empty($error)) { print '
' . $error . '
'; } else { // to prevent resubmit $site['site_id']="XXX"; } } $self = $_SERVER['PHP_SELF']; if (!empty($_SERVER['QUERY_STRING'])) { $self .= "?" . $_SERVER['QUERY_STRING']; } print <<
EOF; $nifty=new PlekitNifty ('register','site-register','medium'); $nifty->start(); $details = new PlekitDetails(TRUE); $details -> start(); $register_button=''; // Do not allow resubmits if (empty($site['site_id'])) { $details->tr($register_button,'center'); } form_render_details ($details, $site_form, $input, ! $empty_form); // Do not allow resubmits if (empty($site['site_id'])) { // some space $details->space(); $details->tr($register_button,'center'); } $details -> end(); $nifty->end(); print "
"; include 'plc_footer.php'; ?>