forked from science-ation/science-ation
- Link in the user invite page for judges and volunteers
- Delete the old invite page.
This commit is contained in:
parent
dd5eae506f
commit
548a37ae16
@ -33,10 +33,7 @@
|
||||
);
|
||||
echo "<br />";
|
||||
echo '<b>'.i18n('Judges').'</b><ul>';
|
||||
if($config['judge_registration_type']=="invite")
|
||||
{
|
||||
echo "<li><a href=\"judges_invite.php\">".i18n("Invite Judges")."</a></li></li>";
|
||||
}
|
||||
echo "<li><a href=\"../user_invite.php?type=judge\">".i18n("Invite Judges")."</a></li></li>";
|
||||
echo "<li><a href=\"judges_manager.php\">".i18n("Manage Judges")."</a> - ".i18n("Add, Delete, Edit, and List judges").'</li>';
|
||||
echo "<li><a href=\"judges_judges.php\">".i18n("List Judges")."</a></li>";
|
||||
echo '</ul>';
|
||||
|
@ -1,136 +0,0 @@
|
||||
<?
|
||||
/*
|
||||
This file is part of the 'Science Fair In A Box' project
|
||||
SFIAB Website: http://www.sfiab.ca
|
||||
|
||||
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
|
||||
Copyright (C) 2005 James Grant <james@lightbox.org>
|
||||
|
||||
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.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
require_once("../common.inc.php");
|
||||
require_once("../user.inc.php");
|
||||
user_auth_required('committee', 'admin');
|
||||
|
||||
$email = stripslashes($_POST['email']);
|
||||
|
||||
$type = $_GET['type'];
|
||||
if(!in_array($type, $user_types)) {
|
||||
send_header("Registration");
|
||||
echo i18n("Invalid new registration\n");
|
||||
send_footer();
|
||||
exit;
|
||||
}
|
||||
|
||||
switch($type) {
|
||||
case 'volunteer':
|
||||
$header_data = array('Volunteer Management' => '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 '<br /><ul>';
|
||||
foreach($types as $t) {
|
||||
echo '<li>'.i18n($user_what[$t]).'</li>';
|
||||
}
|
||||
echo '</ul>';
|
||||
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 "<form method=\"post\" action=\"user_invite.php?type=$type\">";
|
||||
echo "<input type=\"hidden\" name=\"action\" value=\"confirm\" />\n";
|
||||
echo "<input type=\"hidden\" name=\"id\" value=\"{$r->id}\" />\n";
|
||||
echo "<input type=\"hidden\" name=\"email\" value=\"$e\" />\n";
|
||||
echo "<input type=\"submit\" value=\"".i18n("Add Role of {$user_what[$type]}")."\" />\n";
|
||||
echo "</form>\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 "<br />\n";
|
||||
echo "<br />\n";
|
||||
echo "<form method=\"post\" action=\"user_invite.php?type=$type\">\n";
|
||||
echo "<input type=\"hidden\" name=\"action\" value=\"invite\" />\n";
|
||||
echo i18n("Email").": ";
|
||||
echo "<input type=\"text\" name=\"email\" size=\"40\" />\n";
|
||||
echo "<input type=\"submit\" value=\"".i18n("Invite {$user_what[$type]}")."\" />\n";
|
||||
echo "</form>\n";
|
||||
|
||||
send_footer();
|
||||
?>
|
@ -32,11 +32,8 @@
|
||||
"volunteer_management"
|
||||
);
|
||||
echo "<br />";
|
||||
if($config['volunteer_registration_type']=="invite")
|
||||
{
|
||||
echo "<a href=\"user_invite.php?type=volunteer\">".i18n("Invite Volunteers")."</a><br />";
|
||||
}
|
||||
echo "<a href=\"volunteer_positions_manager.php\">".i18n("Volunteer Position Management")."</a> <br />";
|
||||
echo "<a href=\"../user_invite.php?type=volunteer\">".i18n("Invite Volunteers")."</a><br />";
|
||||
echo "<a href=\"volunteer_positions_manager.php\">".i18n("Volunteer Position Management")."</a> <br />";
|
||||
|
||||
send_footer();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user