Copyright (C) 2005 James Grant This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ?> 'admin/volunteer.php'); break; case 'judge': $header_data = array('Judges Management' => 'admin/judges.php'); break; } if($_POST['action']=='confirm' && $email != '') { $header_data = array_merge($header_data, array("{$user_what[$type]} Invitations" => "admin/user_invite.php?type=$type")); send_header("{$user_what[$type]} Confirm", array_merge(array('Committee Main' => 'committee_main.php', 'Administration' => 'admin/index.php'), $header_data) ); } else { send_header("{$user_what[$type]} Invitations", array_merge(array('Committee Main' => 'committee_main.php', 'Administration' => 'admin/index.php'), $header_data) ); } $id = intval($_POST['id']); if($_POST['action']=='confirm' && $id > 0) { /* Add $type to their types */ $id = intval($_POST['id']); $u = user_load($id); $u = user_create($type, $u); echo happy(i18n("%1 has been added as a {$user_what[$type]}", array($email))); email_send("{$type}_add_invite", $email, array("FAIRNAME"=>$config['fairname']), array("FAIRNAME"=>$config['fairname'], "EMAIL"=>$email)); } if($_POST['action']=="invite" && $email != '') { $e = mysql_escape_string($email); $q = mysql_query("SELECT id,types FROM users WHERE email='$e' OR username='$e'"); if(mysql_num_rows($q) > 0) { /* Check the roles */ $r = mysql_fetch_object($q); $types = split(',', $r->types); if(in_array($type, $types)) { echo notice(i18n("%1 already exists and is already a {$user_what[$type]}", array($email))); } else { echo i18n("%1 already exists with the following roles:", array($email)); echo '
'; echo i18n("Instead of generating a new password and creating a new account, the role of {$user_what[$type]} will be added to this account."); echo "
"; echo "\n"; echo "id}\" />\n"; echo "\n"; echo "\n"; echo "
\n"; send_footer(); exit; } } else { /* They don't exist, create a new account */ $u = user_create($type); $u['username'] = $email; $u['password'] = generatePassword(12); $u['email'] = $email; user_save($u); email_send("{$type}_new_invite",$email, array("FAIRNAME"=>$config['fairname']), array("FAIRNAME"=>$config['fairname'], "EMAIL"=>$email, "PASSWORD"=>$u['password'])); echo happy(i18n("%1 has been invited to be a {$user_what[$type]}",array($email))); } } echo i18n("Enter the {$user_what[$type]} email address to invite them to be a {$user_what[$type]}"); echo "
\n"; echo "
\n"; echo "
\n"; echo "\n"; echo i18n("Email").": "; echo "\n"; echo "\n"; echo "
\n"; send_footer(); ?>