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. */ ?> 'committee_main.php', 'Administration' => 'admin/index.php' ) ); require_once('ajax.inc.php'); ?> "; $allowed_types = array('judge', 'volunteer'); $type = $_POST['type']; if($type == '') $type = $_GET['type']; if($type != '') { if(!in_array($type, $allowed_types)) { echo "Type $type not allowed for invite

"; exit; } } if($_POST['action']!="" && $_POST['email'] && $type != '') { $allowed_actions = array('notexist','norole','noyear'); $email = stripslashes($_POST['email']); $action = $_POST['action']; if(!in_array($action, $allowed_actions)) exit; $q = mysql_query("SELECT id FROM users WHERE email='$email' ORDER BY year DESC"); if(mysql_num_rows($q) > 0) { $u = mysql_fetch_assoc($q); $u = user_load($u['id']); } else { $u = NULL; } switch($action) { case 'notexist': /* Create the user */ $u = user_create($type, $email); $u['email'] = $email; user_save($u); email_send("{$type}_new_invite",$u['email'], array("FAIRNAME"=>$config['fairname']), array("FAIRNAME"=>$config['fairname'], "EMAIL"=>$u['email'], "PASSWORD"=>$u['password'])); echo happy(i18n('%1 has been invited to be a %2', array($u['email'], $user_what[$type]))); echo happy(i18n('An email has been sent to %1', array($u['email']))); break; case 'norole': /* Add role to the existing user */ user_create($type, $u['username'], $u); email_send("{$type}_add_invite",$u['email'], array("FAIRNAME"=>$config['fairname']), array("FAIRNAME"=>$config['fairname'])); echo happy(i18n('%1 is now also a %2', array($u['email'], $user_what[$type]))); echo happy(i18n('An email has been sent to %1', array($u['email']))); break; case 'noyear': /* Send a reminder email */ email_send("{$type}_activate_reminder",$u['email'], array("FAIRNAME"=>$config['fairname']), array("FAIRNAME"=>$config['fairname'], "EMAIL"=>$u['email'])); echo happy(i18n('An email has been sent to %1', array($u['email']))); break; } } echo "
\n"; echo "
\n"; echo "\n"; echo "
"; echo i18n("Select a Role: "); echo "
"; echo i18n("Enter an Email: "); echo ""; echo "
"; echo "
\n"; echo "
".i18n('Select a role and enter an email address')."
"; echo "
\n"; echo "\n"; echo "
\n"; send_footer(); ?>