diff --git a/common.inc.php b/common.inc.php index 8eeb5022..a0d433d9 100644 --- a/common.inc.php +++ b/common.inc.php @@ -386,5 +386,56 @@ function outputStatus($status) } +function email_send($val,$to,$sub_subject=array(),$sub_body=array()) +{ + $q=mysql_query("SELECT * FROM emails WHERE val='$val'"); + if($r=mysql_fetch_object($q)) + { + $subject=i18n($r->subject); + $body=i18n($r->body); + + if(count($sub_subject)) + { + foreach($sub_subject AS $sub_k=>$sub_v) + { + $subject=ereg_replace("\[$sub_k\]",$sub_v,$subject); + } + } + if(count($sub_body)) + { + foreach($sub_body AS $sub_k=>$sub_v) + { + $body=ereg_replace("\[$sub_k\]",$sub_v,$body); + } + } + + //now word-wrap the body to 79 chars + //hmm forget the wordwrap for now, its not really needed, but could be done later if need be. + //i'll leave in the start of the function, but its not nearly complete + /* + $MAXCHARS=79; + $c=0; + $lastspace=0; + for($x=0;$x$MAXCHARS) + { + + } + } + */ + + + mail($to,$subject,$body,"From: $r->from\r\nReply-To: $r->from"); + } + else + { + echo error(i18n("CRITICAL ERROR: email '%1' not found",array($val))); + } +} + ?> diff --git a/register_judges.php b/register_judges.php index 36cb8174..839a09dd 100644 --- a/register_judges.php +++ b/register_judges.php @@ -59,7 +59,7 @@ { if($_POST['pass']) { - $q=mysql_query("SELECT * FROM judges WHERE email='".$_SESSION['email']."' AND password='".$_POST['pass']."'"); + $q=mysql_query("SELECT * FROM judges WHERE email='".$_SESSION['email']."' AND password='".$_POST['pass']."' AND deleted='no'"); if(mysql_num_rows($q)==1) { $r=mysql_fetch_object($q); @@ -102,7 +102,7 @@ $allownew=true; //first, check if they have any registrations waiting to be opened - $q=mysql_query("SELECT * FROM judges WHERE email='".$_SESSION['email']."'"); + $q=mysql_query("SELECT * FROM judges WHERE email='".$_SESSION['email']."' AND deleted='no'"); if(mysql_num_rows($q)>0) { echo i18n("Please enter your password to login"); diff --git a/register_judges_expertise.php b/register_judges_expertise.php index 8c6e042b..a69d075c 100644 --- a/register_judges_expertise.php +++ b/register_judges_expertise.php @@ -66,7 +66,15 @@ mysql_query("INSERT INTO judges_expertise (judges_id, projectsubdivisions_id, val, year) VALUES ('".$_SESSION['judges_id']."','$key','$val','".$config['FAIRYEAR']."')"); } + if($_POST['expertise_other']) + { + mysql_query("UPDATE judges SET expertise_other='".mysql_escape_string(stripslashes($_POST['expertise_other']))."' WHERE id='".$_SESSION['judges_id']."'"); + } + else + { + mysql_query("UPDATE judges SET expertise_other=NULL WHERE id='".$_SESSION['judges_id']."'"); + } echo notice(i18n("Areas of Expertise successfully saved")); } $q=mysql_query("SELECT * FROM judges WHERE email='".$_SESSION['email']."' AND id='".$_SESSION['judges_id']."'"); @@ -110,6 +118,7 @@ else echo ""; for($x=1;$x<=5;$x++) echo "$x"; + echo ""; echo ""; echo "".i18n($r->division).""; @@ -120,6 +129,7 @@ else echo "id]\" value=\"$x\" />"; } + echo ""; echo ""; //only show the sub-divisions if the 'main' division is scored >=3 @@ -134,18 +144,25 @@ else if($subexpertise[$subr->id]) $ch="checked=\"checked\""; else $ch=""; echo "id]\" value=\"1\" />"; - echo ""; + echo ""; echo "$subr->subdivision"; echo ""; echo ""; } } - echo " "; + echo " "; } echo ""; echo "
"; + echo "

Other Areas of Expertise not listed above

"; + $q=mysql_query("SELECT expertise_other FROM judges WHERE id='".$_SESSION['judges_id']."'"); + $judgeinfo=mysql_fetch_object($q); + echo ""; + echo "
"; + echo "
"; + echo "\n"; echo ""; diff --git a/register_judges_main.php b/register_judges_main.php index b2056562..8d140493 100644 --- a/register_judges_main.php +++ b/register_judges_main.php @@ -32,7 +32,7 @@ exit; } - $q=mysql_query("SELECT * FROM judges WHERE email='".$_SESSION['email']."' AND id='".$_SESSION['judges_id']."'"); + $q=mysql_query("SELECT * FROM judges WHERE email='".$_SESSION['email']."' AND id='".$_SESSION['judges_id']."' AND deleted='no'"); echo mysql_error(); if(mysql_num_rows($q)==0) @@ -54,6 +54,18 @@ echo happy(i18n("Judge profile for %1 successfully deactivated",array($config['FAIRYEAR']))); } + if($_GET['action']=="delete") + { + //okay here we go, lets get rid of them completely, since this is what theyve asked for + echo happy(i18n("Judge account successfully deactivated. Goodbye!",array($config['FAIRYEAR']))); + mysql_query("UPDATE judges SET deleted='Y', deleteddatetime=NOW() WHERE id='".$_SESSION['judges_id']."'"); + + unset($_SESSION['judges_id']); + unset($_SESSION['email']); + send_footer(); + exit; + } + //only display the named greeting if we have their name if($judgeinfo->firstname) { @@ -68,12 +80,18 @@ $q=mysql_query("SELECT * FROM judges_years WHERE judges_id='".$_SESSION['judges_id']."' AND year='".$config['FAIRYEAR']."'"); if(!mysql_num_rows($q)) { - echo i18n("If you would like to participate as a judge in the %1 %2 please click the activate button below to activate your judges account for the fair",array($config['FAIRYEAR'],$config['fairname'])); + echo i18n("If you would like to participate as a judge for the %1 %2 please click the 'Activate %3 Judge Profile' button below to activate your judges account for the fair",array($config['FAIRYEAR'],$config['fairname'],$config['FAIRYEAR'])); + echo "
"; + echo "
"; + echo i18n("If you can not judge this year, but would like to remain on our mailing list for future years, no action is necessary"); + echo "
"; + echo "
"; + echo i18n("If you would like to be completely removed from our judges mailing list, please click the 'Delete Judge Account' button below"); echo "
"; echo "
"; echo "
"; echo "\n"; - echo ""; + echo ""; echo "
"; } @@ -132,12 +150,17 @@ echo "
"; echo "
"; echo "\n"; - echo ""; + echo ""; echo "
"; - } +echo "
"; +echo "
"; +echo "\n"; +echo ""; +echo "
"; + echo "
"; echo "".i18n("Logout").""; diff --git a/register_participants.php b/register_participants.php index cacf8ca6..bc4acaca 100644 --- a/register_participants.php +++ b/register_participants.php @@ -78,14 +78,7 @@ $q=mysql_query("SELECT registrations.num FROM registrations, students WHERE students.email='".$_SESSION['email']."' AND students.registrations_id=registrations.id"); $r=mysql_fetch_object($q); - $mailbody= "We have received a request for the retrieval\n". - "if your registration number from this email\n". - "address. Please find your existing registration\n". - "number below:\n\n". - "\n". - "Registration Number: $r->num\n". - "\n"; - mail($_SESSION['email'],i18n("Registration for %1",array(i18n($config['fairname']))),$mailbody); + email_send("register_participants_resend_regnum",$_SESSION['email'],array("FAIRNAME"=>i18n($config['fairname'])),array("REGNUM"=>$r->num)); send_header("Participant Registration"); echo notice(i18n("Your registration number has been resent to your email addess %1",array($_SESSION['email'])));