## Wrap up the mail function so we can prepend a tag to the subject# line that indicates what testbed. Useful when multiple testbed# email to the same list.## functionTBMAIL($to,$subject,$message,$headers=0){global$THISHOMEBASE;$subject=strtoupper($THISHOMEBASE).": $subject";if($headers)returnmail($to,$subject,$message,$headers);elsereturnmail($to,$subject,$message);}

## Complication. User might not have an actual account if setting or# changing his own pubkeys. webonly, unapproved, and unverified users# can still muck with their personal info. So, just invoke as user# nobody. We will get audit email in case we need to track what has# happened. #if(!HASREALACCOUNT($uid)){$uid="nobody";}returnSUEXEC($uid,nobody,$cmdandargs,0);}

## Complication. User might not have an actual account if operating on# his own personal info. webonly, unapproved, and unverified users# can still muck with their personal info. But, no point in running# mkacct since by definition there is no real accounts locally to# mess with. Just silently do nothing.#if(!HASREALACCOUNT($uid)){return0;}returnSUEXEC($uid,nobody,$cmdandargs,0);

## Verify a URL.#functionCHECKURL($url,&$error){global$HTTPTAG;if(strlen($url)){if(strstr($url," ")){$error="URL is malformed; spaces are not allowed!";return0;}if(strcmp($HTTPTAG,substr($url,0,strlen($HTTPTAG)))){$error="URL is malformed; must begin with $HTTPTAG!";return0;}

for($i=0;$i<count($http_response_header);$i++){if(!strcmp("Location:",substr($http_response_header[$i],0,9))){$is_redirect=1;}}if(!$is_redirect){$error="URL is not valid; Cannot be accessed!";return0;}}else{fclose($fp);