forked from science-ation/science-ation
Re-implement award_contacts as sponsor_contacts, will full editor using the new user system
This commit is contained in:
parent
4316d2bb71
commit
0f3f5dd26c
@ -4,7 +4,7 @@
|
||||
SFIAB Website: http://www.sfiab.ca
|
||||
|
||||
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
|
||||
Copyright (C) 2005 James Grant <james@lightbox.org>
|
||||
Copyright (C) 2005-2008 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
|
||||
@ -26,29 +26,28 @@
|
||||
require_once("../user.inc.php");
|
||||
user_auth_required('committee', 'admin');
|
||||
|
||||
send_header("Award Contacts",
|
||||
send_header("Sponsor Contacts",
|
||||
array('Committee Main' => 'committee_main.php',
|
||||
'Administration' => 'admin/index.php',
|
||||
'Awards Main' => 'admin/awards.php',
|
||||
'Awards Sponsors' => 'admin/award_sponsors.php'));
|
||||
'Sponsors' => 'admin/sponsors.php'));
|
||||
|
||||
if($_GET['award_sponsors_id'])
|
||||
$award_sponsors_id=$_GET['award_sponsors_id'];
|
||||
else if($_POST['award_sponsors_id'])
|
||||
$award_sponsors_id=$_POST['award_sponsors_id'];
|
||||
if($_GET['sponsors_id'])
|
||||
$sponsors_id=$_GET['sponsors_id'];
|
||||
else if($_POST['sponsors_id'])
|
||||
$sponsors_id=$_POST['sponsors_id'];
|
||||
?>
|
||||
|
||||
<?
|
||||
$q=mysql_query("SELECT id,organization FROM award_sponsors ORDER BY organization");
|
||||
echo "<form method=\"get\" action=\"award_contacts.php\" name=\"sponsorchange\">";
|
||||
echo "<select name=\"award_sponsors_id\" onchange=\"document.forms.sponsorchange.submit()\">";
|
||||
$q=mysql_query("SELECT id,organization FROM sponsors ORDER BY organization");
|
||||
echo "<form method=\"get\" action=\"sponsor_contacts.php\" name=\"sponsorchange\">";
|
||||
echo "<select name=\"sponsors_id\" onchange=\"document.forms.sponsorchange.submit()\">";
|
||||
echo "<option value=\"\">".i18n("Choose a sponsor to view contacts")."</option>";
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
if($r->id == $award_sponsors_id)
|
||||
if($r->id == $sponsors_id)
|
||||
{
|
||||
$sel="selected=\"selected\"";
|
||||
$award_sponsors_organization=$r->organization;
|
||||
$sponsors_organization=$r->organization;
|
||||
}
|
||||
else
|
||||
$sel="";
|
||||
@ -57,107 +56,107 @@
|
||||
echo "</select>";
|
||||
echo "</form>";
|
||||
|
||||
if($award_sponsors_id)
|
||||
if($sponsors_id)
|
||||
{
|
||||
|
||||
|
||||
if($_POST['save']=="edit" || $_POST['save']=="add")
|
||||
{
|
||||
$p = ($_POST['primary']=='yes')?'yes':'no';
|
||||
|
||||
if($_POST['save']=="add")
|
||||
{
|
||||
$q=mysql_query("INSERT INTO award_contacts (award_sponsors_id,year) VALUES ('$award_sponsors_id','".$config['FAIRYEAR']."')");
|
||||
$id=mysql_insert_id();
|
||||
if($_POST['save']=="add") {
|
||||
$u=user_create("sponsor");
|
||||
$id=$u['id'];
|
||||
}
|
||||
else
|
||||
else {
|
||||
$u=user_load($_POST['id']);
|
||||
$id=intval($_POST['id']);
|
||||
}
|
||||
|
||||
if($p == 'no') {
|
||||
/* Make sure this sponsor ($award_sponsors_id) has a primary */
|
||||
$q = mysql_query("SELECT id FROM award_contacts WHERE
|
||||
award_sponsors_id='$award_sponsors_id'
|
||||
AND year={$config['FAIRYEAR']}
|
||||
/* Make sure this sponsor ($sponsors_id) has a primary */
|
||||
$q = mysql_query("SELECT users_id
|
||||
FROM users_sponsor, users
|
||||
WHERE
|
||||
users_sponsor.users_id=users.id
|
||||
AND sponsors_id='$sponsors_id'
|
||||
AND `primary`='yes'
|
||||
AND id!='$id'");
|
||||
AND year='".$config['FAIRYEAR']."'
|
||||
AND users_id!='$id'");
|
||||
if(mysql_num_rows($q) == 0) {
|
||||
/* This must be the primary */
|
||||
$p = 'yes';
|
||||
}
|
||||
} else {
|
||||
/* Unset all other primaries */
|
||||
mysql_query("UPDATE award_contacts SET `primary`='no'
|
||||
WHERE award_sponsors_id='$award_sponsors_id'
|
||||
AND year={$config['FAIRYEAR']}");
|
||||
mysql_query("UPDATE users_sponsor SET `primary`='no'
|
||||
WHERE sponsors_id='$sponsors_id'");
|
||||
}
|
||||
|
||||
$exec="UPDATE award_contacts SET ".
|
||||
"salutation='".mysql_escape_string(stripslashes($_POST['salutation']))."', ".
|
||||
"firstname='".mysql_escape_string(stripslashes($_POST['firstname']))."', ".
|
||||
"lastname='".mysql_escape_string(stripslashes($_POST['lastname']))."', ".
|
||||
"position='".mysql_escape_string(stripslashes($_POST['position']))."', ".
|
||||
"phonework='".mysql_escape_string(stripslashes($_POST['phonework']))."', ".
|
||||
"phonecell='".mysql_escape_string(stripslashes($_POST['phonecell']))."', ".
|
||||
"phonehome='".mysql_escape_string(stripslashes($_POST['phonehome']))."', ".
|
||||
"fax='".mysql_escape_string(stripslashes($_POST['fax']))."', ".
|
||||
"email='".mysql_escape_string(stripslashes($_POST['email']))."', ".
|
||||
"notes='".mysql_escape_string(stripslashes($_POST['notes']))."', ".
|
||||
"`primary`='$p' ".
|
||||
"WHERE id='$id'";
|
||||
mysql_query($exec);
|
||||
$u['primary']=$p;
|
||||
$u['salutation']=$_POST['salutation'];
|
||||
$u['firstname']=$_POST['firstname'];
|
||||
$u['lastname']=$_POST['lastname'];
|
||||
$u['position']=$_POST['position'];
|
||||
$u['phonework']=$_POST['phonework'];
|
||||
$u['phonecell']=$_POST['phonecell'];
|
||||
$u['phonehome']=$_POST['phonehome'];
|
||||
$u['fax']=$_POST['fax'];
|
||||
$u['email']=$_POST['email'];
|
||||
$u['notes']=$_POST['notes'];
|
||||
$u['sponsors_id']=$sponsors_id;
|
||||
user_save($u);
|
||||
|
||||
if($_POST['save']=="add")
|
||||
echo happy("Contact successfully added");
|
||||
echo happy(i18n("Contact successfully added"));
|
||||
else
|
||||
echo happy("Successfully saved changes to contact");
|
||||
echo happy(i18n("Successfully saved changes to contact"));
|
||||
}
|
||||
|
||||
if($_GET['action']=="delete" && $_GET['delete'])
|
||||
{
|
||||
mysql_query("DELETE FROM award_contacts WHERE id='".$_GET['delete']."'");
|
||||
if($_GET['action']=="delete" && $_GET['delete']) {
|
||||
user_delete(intval($_GET['delete']));
|
||||
echo happy("Contact successfully deleted");
|
||||
}
|
||||
|
||||
if($_GET['action']=="edit" || $_GET['action']=="add")
|
||||
{
|
||||
|
||||
echo "<a href=\"award_contacts.php?award_sponsors_id=$award_sponsors_id\"><< ".i18n("Back to %1 Contacts",array($award_sponsors_organization))."</a>\n";
|
||||
echo "<a href=\"sponsor_contacts.php?sponsors_id=$sponsors_id\"><< ".i18n("Back to %1 Contacts",array($sponsors_organization))."</a>\n";
|
||||
if($_GET['action']=="edit")
|
||||
{
|
||||
echo "<h3>".i18n("Edit %1 Contact",array($award_sponsors_organization))."</h3>\n";
|
||||
echo "<h3>".i18n("Edit %1 Contact",array($sponsors_organization))."</h3>\n";
|
||||
$buttontext="Save Contact";
|
||||
$q=mysql_query("SELECT * FROM award_contacts WHERE id='".$_GET['edit']."'");
|
||||
$r=mysql_fetch_object($q);
|
||||
// $q=mysql_query("SELECT * FROM sponsor_contacts WHERE id='".$_GET['edit']."'");
|
||||
// $r=mysql_fetch_object($q);
|
||||
$u=user_load(intval($_GET['edit']));
|
||||
}
|
||||
else if($_GET['action']=="add")
|
||||
{
|
||||
echo "<h3>".i18n("Add %1 Contact",array($award_sponsors_organization))."</h3>\n";
|
||||
echo "<h3>".i18n("Add %1 Contact",array($sponsors_organization))."</h3>\n";
|
||||
$buttontext="Add Contact";
|
||||
}
|
||||
$buttontext=i18n($buttontext);
|
||||
|
||||
echo "<form method=\"post\" action=\"award_contacts.php\">\n";
|
||||
echo "<input type=\"hidden\" name=\"award_sponsors_id\" value=\"$award_sponsors_id\">\n";
|
||||
echo "<form method=\"post\" action=\"sponsor_contacts.php\">\n";
|
||||
echo "<input type=\"hidden\" name=\"sponsors_id\" value=\"$sponsors_id\">\n";
|
||||
echo "<input type=\"hidden\" name=\"save\" value=\"".$_GET['action']."\">\n";
|
||||
|
||||
if($_GET['action']=="edit")
|
||||
echo "<input type=\"hidden\" name=\"id\" value=\"".$_GET['edit']."\">\n";
|
||||
|
||||
echo "<table>\n";
|
||||
echo "<tr><td>".i18n("Salutation")."</td><td><input type=\"text\" name=\"salutation\" value=\"".htmlspecialchars($r->salutation)."\" size=\"4\" maxlength=\"8\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("First Name")."</td><td><input type=\"text\" name=\"firstname\" value=\"".htmlspecialchars($r->firstname)."\" size=\"32\" maxlength=\"32\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Last Name")."</td><td><input type=\"text\" name=\"lastname\" value=\"".htmlspecialchars($r->lastname)."\" size=\"32\" maxlength=\"32\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Position")."</td><td><input type=\"text\" name=\"position\" value=\"".htmlspecialchars($r->position)."\" size=\"60\" maxlength=\"64\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Phone (Work)")."</td><td><input type=\"text\" name=\"phonework\" value=\"".htmlspecialchars($r->phonework)."\" size=\"16\" maxlength=\"32\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Phone (Cell)")."</td><td><input type=\"text\" name=\"phonecell\" value=\"".htmlspecialchars($r->phonecell)."\" size=\"16\" maxlength=\"32\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Phone (Home)")."</td><td><input type=\"text\" name=\"phonehome\" value=\"".htmlspecialchars($r->phonehome)."\" size=\"16\" maxlength=\"32\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Fax")."</td><td><input type=\"text\" name=\"fax\" value=\"".htmlspecialchars($r->fax)."\" size=\"16\" maxlength=\"32\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Email")."</td><td><input type=\"text\" name=\"email\" value=\"".htmlspecialchars($r->email)."\" size=\"60\" maxlength=\"128\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Notes")."</td><td><textarea name=\"notes\" rows=\"8\" cols=\"60\">".htmlspecialchars($r->notes)."</textarea></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Salutation")."</td><td><input type=\"text\" name=\"salutation\" value=\"".htmlspecialchars($u['salutation'])."\" size=\"4\" maxlength=\"8\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("First Name")."</td><td><input type=\"text\" name=\"firstname\" value=\"".htmlspecialchars($u['firstname'])."\" size=\"32\" maxlength=\"32\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Last Name")."</td><td><input type=\"text\" name=\"lastname\" value=\"".htmlspecialchars($u['lastname'])."\" size=\"32\" maxlength=\"32\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Position")."</td><td><input type=\"text\" name=\"position\" value=\"".htmlspecialchars($u['position'])."\" size=\"60\" maxlength=\"64\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Phone (Work)")."</td><td><input type=\"text\" name=\"phonework\" value=\"".htmlspecialchars($u['phonework'])."\" size=\"16\" maxlength=\"32\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Phone (Cell)")."</td><td><input type=\"text\" name=\"phonecell\" value=\"".htmlspecialchars($u['phonecell'])."\" size=\"16\" maxlength=\"32\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Phone (Home)")."</td><td><input type=\"text\" name=\"phonehome\" value=\"".htmlspecialchars($u['phonehome'])."\" size=\"16\" maxlength=\"32\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Fax")."</td><td><input type=\"text\" name=\"fax\" value=\"".htmlspecialchars($u['fax'])."\" size=\"16\" maxlength=\"32\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Email")."</td><td><input type=\"text\" name=\"email\" value=\"".htmlspecialchars($u['email'])."\" size=\"60\" maxlength=\"128\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Notes")."</td><td><textarea name=\"notes\" rows=\"8\" cols=\"60\">".htmlspecialchars($u['notes'])."</textarea></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Primary Contact")."</td><td><select name=\"primary\">";
|
||||
$sel = ($r->primary == 'yes') ? 'selected="selected"': '';
|
||||
$sel = ($u['primary'] == 'yes') ? 'selected="selected"': '';
|
||||
echo "<option value=\"yes\" $sel>".i18n('Yes')."</option>";
|
||||
$sel = ($r->primary == 'no') ? 'selected="selected"': '';
|
||||
$sel = ($u['primary'] == 'no') ? 'selected="selected"': '';
|
||||
echo "<option value=\"no\" $sel>".i18n('No')."</option>";
|
||||
echo "</select></td></tr>\n";
|
||||
echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"$buttontext\" /></td></tr>\n";
|
||||
@ -169,14 +168,16 @@
|
||||
{
|
||||
|
||||
echo "<br />";
|
||||
echo "<a href=\"award_contacts.php?award_sponsors_id=$award_sponsors_id&action=add\">".i18n("Add New Contact to %1",array($award_sponsors_organization))."</a>\n";
|
||||
echo "<a href=\"sponsor_contacts.php?sponsors_id=$sponsors_id&action=add\">".i18n("Add New Contact to %1",array($sponsors_organization))."</a>\n";
|
||||
echo "<br />";
|
||||
|
||||
$q=mysql_query("SELECT * FROM award_contacts WHERE year='".$config['FAIRYEAR']."' AND award_sponsors_id='$award_sponsors_id' ORDER BY lastname,firstname");
|
||||
$q=mysql_query("SELECT * FROM users LEFT JOIN users_sponsor ON users_sponsor.users_id=users.id
|
||||
WHERE year='".$config['FAIRYEAR']."' AND sponsors_id='$sponsors_id' ORDER BY lastname,firstname");
|
||||
echo mysql_Error();
|
||||
|
||||
if(mysql_num_rows($q))
|
||||
{
|
||||
echo "<table class=\"summarytable\">";
|
||||
echo "<table class=\"tableview\">";
|
||||
echo "<tr>";
|
||||
echo " <th>".i18n("Name")."</th>";
|
||||
echo " <th>".i18n("Email")."</th>";
|
||||
@ -194,35 +195,31 @@
|
||||
if($r->salutation) echo $r->salutation." ";
|
||||
echo "$r->firstname $r->lastname</td>\n";
|
||||
echo " <td>";
|
||||
if($r->email)
|
||||
{
|
||||
if($r->email) {
|
||||
list($eb,$ea)=split("@",$r->email);
|
||||
echo "<script language=\"javascript\" type=\"text/javascript\">em('$eb','$ea')</script>";
|
||||
}
|
||||
else
|
||||
echo " ";
|
||||
|
||||
echo "</td>";
|
||||
echo " </td>";
|
||||
echo " <td>$r->phonework</td>\n";
|
||||
echo " <td>$r->phonecell</td>\n";
|
||||
$p = i18n(($r->primary=='yes')?'Yes':'');
|
||||
$p = i18n(($r->primary=='yes')?'Yes':'No');
|
||||
echo " <td>$p</td>\n";
|
||||
echo " <td align=\"center\">";
|
||||
echo "<a href=\"award_contacts.php?award_sponsors_id=$award_sponsors_id&action=edit&edit=$r->id\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/edit.".$config['icon_extension']."\"></a>";
|
||||
//FIXME: should we just go to /user_personal.php here instead?
|
||||
echo "<a href=\"sponsor_contacts.php?sponsors_id=$sponsors_id&action=edit&edit=$r->id\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/edit.".$config['icon_extension']."\"></a>";
|
||||
echo " ";
|
||||
echo "<a onclick=\"return confirmClick('Are you sure you want to remove this contact?')\" href=\"award_contacts.php?award_sponsors_id=$award_sponsors_id&action=delete&delete=$r->id\"><img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>";
|
||||
|
||||
|
||||
echo "<a onclick=\"return confirmClick('Are you sure you want to remove this contact?')\" href=\"sponsor_contacts.php?sponsors_id=$sponsors_id&action=delete&delete=$r->id\"><img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
echo "</table>\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
send_footer();
|
||||
|
@ -148,6 +148,7 @@
|
||||
echo "<table class=\"tableview\">";
|
||||
echo "<tr>";
|
||||
echo " <th>Organization</th>";
|
||||
echo " <th># of Sponsorships</th>";
|
||||
echo " <th># of Awards</th>";
|
||||
echo " <th># of Contacts</th>";
|
||||
echo " <th>Action</th>";
|
||||
@ -159,36 +160,34 @@
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
echo "<tr>\n";
|
||||
/*
|
||||
echo "<td align=\"center\">\n";
|
||||
if($r->confirmed=='yes')
|
||||
{
|
||||
echo "<a href=\"sponsors.php?action=unconfirm&unconfirm=$r->id\"><img border=\"0\" alt=\"ok_alt\" src=\"".$config['SFIABDIRECTORY']."/images/16/ok.".$config['icon_extension']."\"></a>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<a title=\"click here to mark this sponsor as confirmed\" href=\"sponsors.php?action=confirm&confirm=$r->id\">confirm</a>";
|
||||
}
|
||||
echo "</td>\n";
|
||||
*/
|
||||
echo " <td>$r->organization</td>\n";
|
||||
|
||||
$numq=mysql_query("SELECT COUNT(id) AS num FROM award_awards WHERE year='".$config['FAIRYEAR']."' AND sponsors_id='$r->id'");
|
||||
$numr=mysql_fetch_object($numq);
|
||||
$numawards=$numr->num;
|
||||
|
||||
$numq=mysql_query("SELECT COUNT(id) AS num FROM sponsorships WHERE year='".$config['FAIRYEAR']."' AND sponsors_id='$r->id'");
|
||||
$numr=mysql_fetch_object($numq);
|
||||
$numsponsorships=$numr->num;
|
||||
|
||||
$numq=mysql_query("SELECT COUNT(users_id) AS num FROM users_sponsor WHERE sponsors_id='$r->id'");
|
||||
$numr=mysql_fetch_object($numq);
|
||||
$numcontacts=$numr->num;
|
||||
|
||||
|
||||
echo " <td align=\"center\" valign=\"top\">";
|
||||
echo "$numsponsorships ";
|
||||
echo "<a href=\"fundraising.php?sponsors_id=$r->id\"><img alt=\"view\" border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/viewmag.".$config['icon_extension']."\"></a>";
|
||||
echo "</td>";
|
||||
|
||||
echo " <td align=\"center\" valign=\"top\">";
|
||||
echo "$numawards ";
|
||||
echo "<a href=\"award_awards.php?sponsors_id=$r->id\"><img alt=\"view\" border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/viewmag.".$config['icon_extension']."\"></a>";
|
||||
echo "</td>";
|
||||
|
||||
echo " <td align=\"center\" valign=\"top\">";
|
||||
echo "$numcontacts ";
|
||||
echo "<a href=\"award_contacts.php?sponsors_id=$r->id\"><img alt=\"view\" border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/viewmag.".$config['icon_extension']."\"></a>";
|
||||
echo "<a href=\"sponsor_contacts.php?sponsors_id=$r->id\"><img alt=\"view\" border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/viewmag.".$config['icon_extension']."\"></a>";
|
||||
echo "</td>";
|
||||
echo " <td align=\"center\">";
|
||||
echo "<a href=\"sponsors.php?action=edit&edit=$r->id\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/edit.".$config['icon_extension']."\"></a>";
|
||||
|
23
user.inc.php
23
user.inc.php
@ -102,14 +102,16 @@ function user_load_committee(&$u)
|
||||
|
||||
function user_load_volunteer(&$u)
|
||||
{
|
||||
$u['volunteer_active'] = ($u['>volunteer_active'] == 'yes') ? 'yes' : 'no';
|
||||
$u['volunteer_complete'] = ($u['>volunteer_complete'] == 'yes') ? 'yes' : 'no';
|
||||
$u['volunteer_active'] = ($u['volunteer_active'] == 'yes') ? 'yes' : 'no';
|
||||
$u['volunteer_complete'] = ($u['volunteer_complete'] == 'yes') ? 'yes' : 'no';
|
||||
return true;
|
||||
}
|
||||
|
||||
function user_load_sponsor($u)
|
||||
{
|
||||
$u['sponsors_id'] = intval($u['sponsors_id']);
|
||||
$u['sponsor_complete'] = ($u['sponsor_complete'] == 'yes') ? 'yes' : 'no';
|
||||
$u['sponsor_active'] = ($u['sponsor_active'] == 'yes') ? 'yes' : 'no';
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -234,12 +236,15 @@ function user_save_type_list($u, $db, $fields)
|
||||
else
|
||||
$data = mysql_escape_string(stripslashes($u[$f]));
|
||||
|
||||
$set .= "$f='$data'";
|
||||
$set .= "`$f`='$data'";
|
||||
}
|
||||
if($set != "") {
|
||||
$query = "UPDATE $db SET $set WHERE users_id='{$u['id']}'";
|
||||
mysql_query($query);
|
||||
echo mysql_error();
|
||||
if(mysql_error()) {
|
||||
echo mysql_error();
|
||||
echo error("Full query: $query");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -279,11 +284,13 @@ function user_save_fair($u)
|
||||
|
||||
function user_save_sponsor($u)
|
||||
{
|
||||
$fields = array('sponsors_id','sponsor_active','sponsor_complete','primary','position','notes');
|
||||
user_save_type_list($u, 'users_sponsor', $fields);
|
||||
}
|
||||
|
||||
function user_save($u)
|
||||
{
|
||||
$fields = array('firstname','lastname','username',
|
||||
$fields = array('salutation','firstname','lastname','username',
|
||||
'email',
|
||||
'phonehome','phonework','phonecell','fax','organization',
|
||||
'address','address2','city','province','postalcode','sex',
|
||||
@ -526,10 +533,12 @@ function user_add_role_allowed($type, $u)
|
||||
|
||||
function user_create($type, $u = NULL)
|
||||
{
|
||||
global $config;
|
||||
if(!is_array($u)) {
|
||||
mysql_query("INSERT INTO users (`types`,`passwordset`,`created`)
|
||||
VALUES ('$type', '0000-00-00', NOW())");
|
||||
mysql_query("INSERT INTO users (`types`,`passwordset`,`created`,`year`)
|
||||
VALUES ('$type', '0000-00-00', NOW(), '{$config['FAIRYEAR']}')");
|
||||
$uid = mysql_insert_id();
|
||||
mysql_query("UPDATE users SET uid='$uid' WHERE id='$uid'");
|
||||
user_set_password($uid, NULL);
|
||||
} else {
|
||||
/* The user has been specified and already exists,
|
||||
|
Loading…
x
Reference in New Issue
Block a user