# Copyright (C) 2001 Craig Small # Copyright (C) 2001, 2002, 2003, 2004, 2005 Martin Michlmayr # This file may be distributed under the GPL v2 or higher. "; echo "SQL was: $sql
\n"; return FALSE; } if (pg_NumRows($result) == 0) { echo "Cannot find mananger in database.
\n"; echo "SQL was: $sql
\n"; return FALSE; } $row = pg_Fetch_Array($result, 0); $body = "Hello " . $row["name"] . ",\n\n"; $body .= "This is an automatic message from the New Maintainer website found at\n"; $body .= "http://nm.debian.org/ The Front Desk has assigned a new applicant to you:\n"; $body .= "$forename $surname <" . $aemail . ">. Please remember to visit the\n"; $body .= "website to inform the front desk whether or not you accept this applicant.\n\n"; $body .= " - New Maintainer Website.\n"; $headers = "From: NM Front Desk \n"; $headers .= "Reply-To: $forename $surname <" . $aemail . ">\n"; $headers .= "Content-Type: text/plain; charset=iso-8859-1\n"; $headers .= "X-Mailer: PHP/" . phpversion(); mail($row["email"], "New Debian Maintainer: $aemail", $body, $headers); return TRUE; } function email_manager_approved($db, $login, $forename, $surname, $aemail) { $sql = "SELECT * FROM manager WHERE login = '$login'"; if (! ($result = pg_exec($db, $sql))) { echo "Problem with query: ", pg_ErrorMessage($db), "
"; echo "SQL was: $sql
\n"; return FALSE; } if (pg_NumRows($result) == 0) { echo "Cannot find mananger in database.
\n"; echo "SQL was: $sql
\n"; return FALSE; } $row = pg_Fetch_Array($result, 0); $body = "Hello " . $row["name"] . ",\n\n"; $body .= "This is an automatic message from the New Maintainer website found at\n"; $body .= "http://nm.debian.org/ It seems that the DAM has approved your applicant\n"; $body .= "$forename $surname <" . $aemail . ">. Please remember that nm.d.o is\n"; $body .= "not authoritative and this mail may be an error! Make sure to use finger\n"; $body .= "on a .d.o host to check whether an account is really there (also\n"; $body .= "remember that the account information on .d.o is only updated every 15\n"; $body .= "minutes and can take up to an hour).\n"; $body .= "\n"; $body .= "\n"; $body .= "Thanks for going through the NM process with $forename.\n"; $body .= "\n"; $body .= " - New Maintainer Website.\n"; $headers = "From: NM Front Desk \n"; $headers .= "Reply-To: $forename $surname <" . $aemail . ">\n"; $headers .= "Content-Type: text/plain; charset=iso-8859-1\n"; $headers .= "X-Mailer: PHP/" . phpversion(); mail($row["email"], "New Debian Developer: $aemail", $body, $headers); return TRUE; } function check_manager($db, $manager, $aemail) { $sql = "SELECT * FROM applicant WHERE email ='$aemail'"; if (! ($result = pg_exec($db, $sql))) { echo "Problem with query: ", pg_ErrorMessage($db), "
"; echo "SQL was: $sql
\n"; return FALSE; } if (pg_NumRows($result) == 0) { echo "Could not find applicant $aemail in the database.
\n"; echo "SQL was: $sql
\n"; return FALSE; } $row = pg_Fetch_Array($result, 0); if (trim($row["manager"]) != $manager) { if ($manager != "") { echo "

Old manager was '", $row["manager"], "' new one is '$manager'. Emailling new manager.\n"; return (email_manager($db, $manager, $row['forename'], $row['surname'],$aemail)); } else { echo "

Old manager was '", $row["manager"], "' new one is blank.\n"; return TRUE; } } return TRUE; } #check manager function find_manager($db, $login) { $sql = "SELECT * FROM manager WHERE login = '$login'"; if (! ($result = pg_exec($db, $sql))) { echo "Problem with query", pg_ErrorMessage($db), "
"; return TRUE; } if (pg_NumRows($result) == 0) { return FALSE; } return TRUE; } function update_db($db, $sql) { if (! ($result = pg_exec($db, $sql))) { echo "Problem with query", pg_ErrorMessage($db), "
"; return -1; } if (($tuples = pg_CmdTuples($result)) != 1) { echo "Only one row should be effected but $tuples rows were
\n"; } return $tuples; } function get_text($name, $value) { if ($value == "" ) { $str = $name . "= null"; } else { if (trim($value) == "today") { $str = $name . "= CURRENT_DATE"; } else { $str = $name . "='" . trim(strip_tags($value)) . "'"; } } return $str; } function get_bool($name, $value) { if ($value == 't') { $str = $name . "= true "; } else if ($value == 'f') { $str = $name . " = false "; } else { $str = $name . " = null "; } return $str; } function get_textarea($name, $value) { if ($value == "" ) { $str = $name . "= null"; } else { $str = $name . "='" . trim(strip_tags($value)) . "'"; } return $str; } ?> #use wml::nmpage title="Debian New Maintainer - Applicant Status Update" You should not be here!

Debian New Maintainer


Updating Applicant's status

Blank old email address, problem with script!"; } if ($_SESSION['s_isdam'] == 't' || $_SESSION['s_isfd'] == 't') { if ($_REQUEST['email'] == "") { $errors .= "
  • No new email address.\n"; } if ($_REQUEST['forename'] == "") { $errors .= "
  • You must have a first name entered.\n"; } if ($_REQUEST['surname'] == "") { $errors .= "
  • You must have a surname entered.\n"; } if ($_REQUEST['apply_date'] == "") { $errors .= "
  • You must have a date of application.\n"; } if ($_REQUEST['manager'] != "" && $_REQUEST['manager_date'] == "") { _REQUEST['manager_date'] = "today"; $warnings .= "
  • A manager has been assigned but with no date.\n"; } if ($_REQUEST['manager'] == "" && $_REQUEST['manager_date'] != "") { $errors .= "
  • A manager has not been assigned but there is a manager assigned date.\n"; } if ($_REQUEST['advocate_ok'] != "n" && $_REQUEST['advocate_checked'] == "") { $_REQUEST['advocate_checked'] = "today"; $warnings .= "
  • Advocate check entered but no date given.\n"; } if ($_REQUEST['advocate_ok'] == "n" && $_REQUEST['advocate_checked'] != "") { $errors .= "
  • Advocate Check Date given but Advocate check not changed.\n"; } if ($_REQUEST['da_phone_required'] != "n" && $_REQUEST['da_phone'] == "") { $_REQUEST['da_phone'] = "today"; $warnings .= "
  • DAM phone requirement set but no date given.\n"; } if ($_REQUEST['da_approved'] != "n" && $_REQUEST['da_approved_date'] == "") { $_REQUEST['da_approved_date'] = "today"; $warnings .= "
  • DAM checked report but no date given.\n"; } } # end of fd or dam if ($_SESSION['s_isfd'] == 't') { if ($_REQUEST['application_ok'] != "n" && $_REQUEST['application_ok_date'] == "") { $_REQUEST['application_ok_date'] = "today"; $warnings .= "
  • FD has checked report but there is no date.\n"; } if ($_REQUEST['application_ok'] != "n" && $_REQUEST['fd_member'] == "") { $errors .= "
  • FD has checked report but not specified their login (FD member).\n"; } } # end of fd only if ($_REQUEST['am_confirm'] != "n" && $_REQUEST['am_confirm_date'] == "") { $_REQUEST['am_confirm_date'] = "today"; $warnings .= "
  • AM has confirmed applicant but not put a date in.\n"; } if ($_REQUEST['am_confirm'] == "n" && $_REQUEST['am_confirm_date'] != "") { $errors .= "
  • AM has not confirmed applicant but there is a date set.\n"; } if ($_REQUEST['id_ok'] != "n" && $_REQUEST['id_checked'] == "") { $_REQUEST['id_checked'] = "today"; $warnings .= "
  • ID has been checked but there is no date of checking.\n"; } if ($_REQUEST['id_ok'] == "n" && $_REQUEST['id_checked'] != "") { $errors .= "
  • ID has not been checked but there is a date of checking.\n"; } if ($_REQUEST['pnp_ok'] != "n" && $_REQUEST['pnp_checked'] == "") { $_REQUEST['pnp_checked'] = "today"; $warnings .= "
  • Philosophy and Procedures have been checked but there is no date of checking.\n"; } if ($_REQUEST['pnp_ok'] == "n" && $_REQUEST['pnp_checked'] != "") { $errors .= "
  • Philosophy and Procedures have not been checked but there is a date of checking.\n"; } if ($_REQUEST['tns_ok'] != "n" && $_REQUEST['tns_checked'] == "") { $_REQUEST['tns_checked'] = "today"; $warnings .= "
  • Tasks and Skills have been checked but there is no date of checking.\n"; } if ($_REQUEST['tns_ok'] == "n" && $_REQUEST['tns_checked'] != "") { $errors .= "
  • Tasks and Skills have not been checked but there is a date of checking.\n"; } if ($_REQUEST['approved'] != "n" && $_REQUEST['decision'] == "") { $_REQUEST['decision'] = "today"; $warnings .= "
  • AM has approved applicant but there is no date.\n"; } if ($_REQUEST['approved'] == "n" && $_REQUEST['decision'] != "") { $errors .= "
  • AM has not yet approved applicant but there is a date.\n"; } if (($_REQUEST['manager'] != "") && !(find_manager($db, $_REQUEST['manager']))) { $errors .= "
  • I cannot find Application Manager $manager in the database.\n"; } # Possibly more checks later if ($errors != "") { echo "

    There have been some problems with what you entered, please hit ", "the back button and correct the following errors:", "

      $errors
    \n"; } else { if ($warninngs != "") { echo "

    There were several problems but they have been dealt with:\n"; echo "

      $warnings
    \n"; } else { echo "

    Submission has passed sanity checks.
    \n"; } if ($_SESSION['s_isdam'] == 't') { $sql = "SELECT * FROM applicant WHERE email ='" . $_REQUEST['emailkey'] . "'"; if (! ($result = pg_exec($db, $sql))) { echo "Problem with query: ", pg_ErrorMessage($db), "
    "; echo "SQL was: $sql
    \n"; return FALSE; } if (pg_NumRows($result) == 0) { echo "Could not find applicant $emailkey in the database.
    \n"; echo "SQL was: $sql
    \n"; return FALSE; } $row = pg_Fetch_Array($result, 0); $old_newmaint = trim($row["newmaint"]); } $sql = "UPDATE applicant SET "; if ($_SESSION['s_isdam'] == 't' || $_SESSION['s_isfd'] == 't') { $sql .= get_text("surname", $_REQUEST['surname']) . ", " . get_text("email", $_REQUEST['email']) . ", " . get_text("forename", $_REQUEST['forename']) . ", " . get_text("apply_date", $_REQUEST['apply_date']) . ", " . get_text("advocate", $_REQUEST['advocate']) . ", " . get_text("advocate_date", $_REQUEST['advocate_date']) . ", " . get_bool("advocate_ok", $_REQUEST['advocate_ok']) . ", " . get_text("advocate_checked", $_REQUEST['advocate_checked']) . ", " . get_text("manager", $_REQUEST['manager']) . ", " . get_text("manager_date", $_REQUEST['manager_date']) . ", " . get_bool("application_ok", $_REQUEST['application_ok']) . ", " . get_text("application_ok_date", $_REQUEST['application_ok_date']) . ", " . get_text("fd_member", $_REQUEST['fd_member']) . ", " . get_textarea("da_comment", $_REQUEST['da_comment']) . ", " ; } $sql .= get_bool("am_confirm", $_REQUEST['am_confirm']) . ", " . get_text("am_confirm_date", $_REQUEST['am_confirm_date']) . ", " . get_text("am_contact", $_REQUEST['am_contact']) . ", " . get_bool("id_ok", $_REQUEST['id_ok']) . ", " . get_text("id_checked", $_REQUEST['id_checked']) . ", " . get_bool("pnp_ok", $_REQUEST['pnp_ok']) . ", " . get_text("pnp_checked", $_REQUEST['pnp_checked']) . ", " . get_bool("tns_ok", $_REQUEST['tns_ok']) . ", " . get_text("tns_checked", $_REQUEST['tns_checked']) . ", " . get_bool("approved", $_REQUEST['approved']) . ", " . get_text("decision", $_REQUEST['decision']) . ", " . get_textarea("man_comment", $_REQUEST['man_comment']) ; if ($_SESSION['s_isdam'] == 't') { $sql .= ", " . get_bool("da_phone_required", $_REQUEST['da_phone_required']) . ", " . get_text("da_phone", $_REQUEST['da_phone']) . ", " . get_bool("da_approved", $_REQUEST['da_approved']) . ", " . get_text("da_approved_date", $_REQUEST['da_approved_date']) . ", " . get_text("da_member", $_REQUEST['da_member']) . ", " . get_text("newmaint", $_REQUEST['newmaint']) ; } $sql .= " WHERE email = '" . $_REQUEST['emailkey'] . "'"; if ($_SESSION['s_isfd'] == 't') { if (!(check_manager($db, trim($_REQUEST['manager']), $_REQUEST['email']))) { echo "

    Problem emailling manager.\n"; } } if (($erows = update_db($db, $sql)) > 0) { echo "

    $erows rows updated in database.
    \n"; if ($_SESSION['s_isdam'] == 't') { if ($_REQUEST['newmaint'] != '' && $_REQUEST['old_newmaint'] == '') { $manager = trim($_REQUEST['manager']); echo "Applicant got approved, mailing manager $manager

    "; email_manager_approved($db, $manager, $_REQUEST['forename'], $_REQUEST['surname'], $_REQUEST['emailkey']); } } } } ?>