| 16 |
return FALSE; |
return FALSE; |
| 17 |
} |
} |
| 18 |
$row = pg_Fetch_Array($result, 0); |
$row = pg_Fetch_Array($result, 0); |
| 19 |
$body = "Hello " . $row["name"] . ",\n"; |
$body = "Hello " . $row["name"] . ",\n\n"; |
| 20 |
$body .= "This is an automatic message from the New Maintainer website found at\n"; |
$body .= "This is an automatic message from the New Maintainer website found at\n"; |
| 21 |
$body .= "http://nm.debian.org/ The Front Desk has assigned a new applicant to you:\n"; |
$body .= "http://nm.debian.org/ The Front Desk has assigned a new applicant to you:\n"; |
| 22 |
$body .= "$forename $surname <" . $aemail . ">. Please remember to visit the\n"; |
$body .= "$forename $surname <" . $aemail . ">. Please remember to visit the\n"; |
| 23 |
$body .= "website to inform the front desk wether or not you accept this applicant.\n\n"; |
$body .= "website to inform the front desk whether or not you accept this applicant.\n\n"; |
| 24 |
$body .= " - New Maintainer Website.\n"; |
$body .= " - New Maintainer Website.\n"; |
| 25 |
$headers = "From: new-maintainer@debian.org\nReply-To: $forename $surname <" . $aemail . ">\nX-Mailer: PHP/" . phpversion(); |
$headers = "From: NM Front Desk <new-maintainer@debian.org>\n"; |
| 26 |
|
$headers .= "Reply-To: Reply-To: $forename $surname <" . $aemail . ">\n"; |
| 27 |
|
$headers .= "Content-Type: text/plain; charset=iso-8859-1\n"; |
| 28 |
|
$headers .= "X-Mailer: PHP/" . phpversion(); |
| 29 |
mail($row["email"], "New Debian Maintainer: $aemail", $body, $headers); |
mail($row["email"], "New Debian Maintainer: $aemail", $body, $headers); |
| 30 |
return TRUE; |
return TRUE; |
| 31 |
} |
} |
| 32 |
|
|
| 33 |
|
function email_manager_approved($db, $login, $forename, $surname, $aemail) { |
| 34 |
|
$sql = "SELECT * FROM manager WHERE login = '$login'"; |
| 35 |
|
if (! ($result = pg_exec($db, $sql))) { |
| 36 |
|
echo "Problem with query: ", pg_ErrorMessage($db), "<BR>"; |
| 37 |
|
echo "SQL was: $sql <BR>\n"; |
| 38 |
|
return FALSE; |
| 39 |
|
} |
| 40 |
|
if (pg_NumRows($result) == 0) { |
| 41 |
|
echo "Cannot find mananger in database.<BR>\n"; |
| 42 |
|
echo "SQL was: $sql <BR>\n"; |
| 43 |
|
return FALSE; |
| 44 |
|
} |
| 45 |
|
$row = pg_Fetch_Array($result, 0); |
| 46 |
|
$body = "Hello " . $row["name"] . ",\n\n"; |
| 47 |
|
$body .= "This is an automatic message from the New Maintainer website found at\n"; |
| 48 |
|
$body .= "http://nm.debian.org/ It seems that the DAM has approved your applicant\n"; |
| 49 |
|
$body .= "$forename $surname <" . $aemail . ">. Please remember that nm.d.o is\n"; |
| 50 |
|
$body .= "not authoritative and this mail may be an error! Make sure to use finger\n"; |
| 51 |
|
$body .= "on a .d.o host to check whether an account is really there (also\n"; |
| 52 |
|
$body .= "remember that the account information on .d.o is only updated every 15\n"; |
| 53 |
|
$body .= "minutes and can take up to an hour).\n"; |
| 54 |
|
$body .= "\n"; |
| 55 |
|
$body .= "\n"; |
| 56 |
|
$body .= "Thanks for going through the NM process with $forename.\n"; |
| 57 |
|
$body .= "\n"; |
| 58 |
|
$body .= " - New Maintainer Website.\n"; |
| 59 |
|
$headers = "From: NM Front Desk <new-maintainer@debian.org>\n"; |
| 60 |
|
$headers .= "Reply-To: Reply-To: $forename $surname <" . $aemail . ">\n"; |
| 61 |
|
$headers .= "Content-Type: text/plain; charset=iso-8859-1\n"; |
| 62 |
|
$headers .= "X-Mailer: PHP/" . phpversion(); |
| 63 |
|
mail($row["email"], "New Debian Developer: $aemail", $body, $headers); |
| 64 |
|
return TRUE; |
| 65 |
|
} |
| 66 |
|
|
| 67 |
function check_manager($db, $manager, $aemail) |
function check_manager($db, $manager, $aemail) |
| 68 |
{ |
{ |
| 69 |
$sql = "SELECT * FROM applicant WHERE email ='$aemail'"; |
$sql = "SELECT * FROM applicant WHERE email ='$aemail'"; |
| 109 |
return -1; |
return -1; |
| 110 |
} |
} |
| 111 |
if (($tuples = pg_CmdTuples($result)) != 1) { |
if (($tuples = pg_CmdTuples($result)) != 1) { |
| 112 |
echo "Only one row should be effected but $tuple rows were<BR>\n"; |
echo "Only one row should be effected but $tuples rows were<BR>\n"; |
| 113 |
} |
} |
| 114 |
return $tuples; |
return $tuples; |
| 115 |
} |
} |
| 118 |
if ($value == "" ) { |
if ($value == "" ) { |
| 119 |
$str = $name . "= null"; |
$str = $name . "= null"; |
| 120 |
} else { |
} else { |
| 121 |
$str = $name . "='" . trim(strip_tags($value)) . "'"; |
if (trim($value) == "today") { |
| 122 |
|
$str = $name . "= CURRENT_DATE"; |
| 123 |
|
} else { |
| 124 |
|
$str = $name . "='" . trim(strip_tags($value)) . "'"; |
| 125 |
|
} |
| 126 |
} |
} |
| 127 |
return $str; |
return $str; |
| 128 |
} |
} |
| 153 |
if (!session_is_registered("s_username") || !session_is_registered("s_isam")) { |
if (!session_is_registered("s_username") || !session_is_registered("s_isam")) { |
| 154 |
?> |
?> |
| 155 |
<STRONG> |
<STRONG> |
| 156 |
You should not be here!!</STRONG> |
You should not be here!</STRONG> |
| 157 |
<? } else { |
<? } else { |
| 158 |
session_register("s_username"); |
session_register("s_username"); |
| 159 |
session_register("s_isfd"); |
session_register("s_isfd"); |
| 177 |
{ $errors .= "<LI>A manager has been assigned but with no date.\n"; } |
{ $errors .= "<LI>A manager has been assigned but with no date.\n"; } |
| 178 |
if ($manager == "" && $manager_date != "") |
if ($manager == "" && $manager_date != "") |
| 179 |
{ $errors .= "<LI>A manager has not been assigned but there is a manager assigned date.\n"; } |
{ $errors .= "<LI>A manager has not been assigned but there is a manager assigned date.\n"; } |
| 180 |
} |
if ($advocate_ok != "n" && $advocate_checked == "") |
| 181 |
|
{ $errors .= "<LI>Advocate check entered but no date given.\n"; } |
| 182 |
|
if ($advocate_ok == "n" && $advocate_checked != "") |
| 183 |
|
{ $errors .= "<LI>Advocate Check Date given but Advocate check not changed.\n"; } |
| 184 |
|
} # end of fd or dam |
| 185 |
|
|
| 186 |
|
if ($s_isfd == 't') { |
| 187 |
|
if ($application_ok != "n" && $application_ok_date == "") |
| 188 |
|
{ $errors .= "<LI>FD has checked report but there is no date.\n"; } |
| 189 |
|
if ($application_ok != "n" && $fd_member == "") |
| 190 |
|
{ $errors .= "<LI>FD has checked report but not specified their login (FD member).\n"; } |
| 191 |
|
} # end of fd only |
| 192 |
|
|
| 193 |
|
if ($am_confirm != "n" && $am_confirm_date == "") |
| 194 |
|
{ $errors .= "<LI>AM has confirmed applicant but not put a date in.\n"; } |
| 195 |
|
if ($am_confirm == "n" && $am_confirm_date != "") |
| 196 |
|
{ $errors .= "<LI>AM has not confirmed applicant but there is a date set.\n"; } |
| 197 |
|
|
| 198 |
if ($id_ok != "n" && $id_checked == "") |
if ($id_ok != "n" && $id_checked == "") |
| 199 |
{ $errors .= "<LI>ID has been checked but there is no date of checking.\n"; } |
{ $errors .= "<LI>ID has been checked but there is no date of checking.\n"; } |
| 200 |
if ($id_ok == "n" && $id_checked != "") |
if ($id_ok == "n" && $id_checked != "") |
| 201 |
{ $errors .= "<LI>ID has not been checked but there is a date of checking.\n"; } |
{ $errors .= "<LI>ID has not been checked but there is a date of checking.\n"; } |
| 202 |
if ($pnp_ok != "n" && $pnp_checked == "") |
if ($pnp_ok != "n" && $pnp_checked == "") |
| 203 |
{ $errors .= "<LI>Policy and Procedures have been checked but there is no date of checking.\n"; } |
{ $errors .= "<LI>Philosophy and Procedures have been checked but there is no date of checking.\n"; } |
| 204 |
if ($pnp_ok == "n" && $pnp_checked != "") |
if ($pnp_ok == "n" && $pnp_checked != "") |
| 205 |
{ $errors .= "<LI>Policy and Procedures have not been checked but there is a date of checking.\n"; } |
{ $errors .= "<LI>Philosophy and Procedures have not been checked but there is a date of checking.\n"; } |
| 206 |
if ($tns_ok != "n" && $tns_checked == "") |
if ($tns_ok != "n" && $tns_checked == "") |
| 207 |
{ $errors .= "<LI>Tasks and Skills have been checked but there is no date of checking.\n"; } |
{ $errors .= "<LI>Tasks and Skills have been checked but there is no date of checking.\n"; } |
| 208 |
if ($tns_ok == "n" && $tns_checked != "") |
if ($tns_ok == "n" && $tns_checked != "") |
| 209 |
{ $errors .= "<LI>Tasks and Skills have not been checked but there is a date of checking.\n"; } |
{ $errors .= "<LI>Tasks and Skills have not been checked but there is a date of checking.\n"; } |
| 210 |
if ($approved != "n" && $decision == "") |
if ($approved != "n" && $decision == "") |
| 211 |
{ $errors .= "<LI>AM has approved applicant but there is not date.\n"; } |
{ $errors .= "<LI>AM has approved applicant but there is no date.\n"; } |
| 212 |
if ($approved == "n" && $decision != "") |
if ($approved == "n" && $decision != "") |
| 213 |
{ $errors .= "<LI>AM has not yet approved applicant but there is a date.\n"; } |
{ $errors .= "<LI>AM has not yet approved applicant but there is a date.\n"; } |
| 214 |
if (($manager != "") && !(find_manager($db, $manager))) |
if (($manager != "") && !(find_manager($db, $manager))) |
| 221 |
"<UL>$errors</UL>\n"; |
"<UL>$errors</UL>\n"; |
| 222 |
} else { |
} else { |
| 223 |
echo "<P>Submission has passed sanity checks.<BR>\n"; |
echo "<P>Submission has passed sanity checks.<BR>\n"; |
| 224 |
|
|
| 225 |
|
|
| 226 |
|
if ($s_isdam == 't') { |
| 227 |
|
$sql = "SELECT * FROM applicant WHERE email ='$emailkey'"; |
| 228 |
|
if (! ($result = pg_exec($db, $sql))) { |
| 229 |
|
echo "Problem with query: ", pg_ErrorMessage($db), "<BR>"; |
| 230 |
|
echo "SQL was: $sql <BR>\n"; |
| 231 |
|
return FALSE; |
| 232 |
|
} |
| 233 |
|
if (pg_NumRows($result) == 0) { |
| 234 |
|
echo "Could not find applicant $emailkey in the database.<BR>\n"; |
| 235 |
|
echo "SQL was: $sql <BR>\n"; |
| 236 |
|
return FALSE; |
| 237 |
|
} |
| 238 |
|
$row = pg_Fetch_Array($result, 0); |
| 239 |
|
$old_newmaint = trim($row["newmaint"]); |
| 240 |
|
} |
| 241 |
|
|
| 242 |
$sql = "UPDATE applicant SET "; |
$sql = "UPDATE applicant SET "; |
| 243 |
if ($s_isdam == 't' || $s_isfd == 't') { |
if ($s_isdam == 't' || $s_isfd == 't') { |
| 244 |
$sql .= get_text("surname", $surname) . |
$sql .= get_text("surname", $surname) . |
| 245 |
", " . get_text("email", $email) . |
", " . get_text("email", $email) . |
| 246 |
", " . get_text("forename", $forename) . |
", " . get_text("forename", $forename) . |
| 247 |
", " . get_text("apply_date", $apply_date) . |
", " . get_text("apply_date", $apply_date) . |
| 248 |
|
", " . get_text("advocate", $advocate) . |
| 249 |
|
", " . get_text("advocate_date", $advocate_date) . |
| 250 |
|
", " . get_bool("advocate_ok", $advocate_ok) . |
| 251 |
|
", " . get_text("advocate_checked", $advocate_checked) . |
| 252 |
", " . get_text("manager", $manager) . |
", " . get_text("manager", $manager) . |
| 253 |
", " . get_text("manager_date", $manager_date) . ", "; |
", " . get_text("manager_date", $manager_date) . |
| 254 |
|
", " . get_bool("application_ok", $application_ok) . |
| 255 |
|
", " . get_text("application_ok_date", $application_ok_date) . |
| 256 |
|
", " . get_text("fd_member", $fd_member) . |
| 257 |
|
", " . get_textarea("da_comment", $da_comment) . ", " ; |
| 258 |
} |
} |
| 259 |
$sql .= get_bool("am_confirm", $am_confirm) . |
$sql .= get_bool("am_confirm", $am_confirm) . |
| 260 |
", " . get_text("am_confirm_date", $am_confirm_date) . |
", " . get_text("am_confirm_date", $am_confirm_date) . |
| 269 |
", " . get_text("decision", $decision) . |
", " . get_text("decision", $decision) . |
| 270 |
", " . get_textarea("man_comment", $man_comment) ; |
", " . get_textarea("man_comment", $man_comment) ; |
| 271 |
if ($s_isdam == 't') { |
if ($s_isdam == 't') { |
| 272 |
$sql .= ", " . get_bool("application_ok", $application_ok) . |
$sql .= ", " . get_bool("da_phone_required", $da_phone_required) . |
|
", " . get_bool("da_phone_required", $da_phone_required) . |
|
| 273 |
", " . get_text("da_phone", $da_phone) . |
", " . get_text("da_phone", $da_phone) . |
| 274 |
", " . get_bool("da_approved", $da_approved) . |
", " . get_bool("da_approved", $da_approved) . |
| 275 |
", " . get_text("newmaint", $newmaint) . |
", " . get_text("da_approved_date", $da_approved_date) . |
| 276 |
", " . get_textarea("da_comment", $da_comment) ; |
", " . get_text("da_member", $da_member) . |
| 277 |
|
", " . get_text("newmaint", $newmaint) ; |
| 278 |
} |
} |
| 279 |
$sql .= " WHERE email = '$emailkey'"; |
$sql .= " WHERE email = '$emailkey'"; |
| 280 |
if ($s_isfd == 't') { |
if ($s_isfd == 't') { |
| 285 |
if (($erows = update_db($db, $sql)) > 0) |
if (($erows = update_db($db, $sql)) > 0) |
| 286 |
{ |
{ |
| 287 |
echo "<P>$erows rows updated in database.<BR>\n"; |
echo "<P>$erows rows updated in database.<BR>\n"; |
| 288 |
|
if ($s_isdam == 't') { |
| 289 |
|
if ($newmaint != '' && $old_newmaint == '') { |
| 290 |
|
$manager = trim($manager); |
| 291 |
|
echo "Applicant got approved, mailing manager $manager<p>"; |
| 292 |
|
email_manager_approved($db, $manager, $forename, |
| 293 |
|
$surname, $emailkey); |
| 294 |
|
} |
| 295 |
|
} |
| 296 |
} |
} |
| 297 |
} |
} |
| 298 |
?> |
?> |