Пример #1
0
function eventEmail($eventNo, $type)
{
    global $BASEURL, $CHOIR;
    $sql = "select * from `eventType` where `id` = '{$type}'";
    $eventType = mysql_fetch_array(mysql_query($sql));
    $typeName = $eventType['name'];
    $eventResults = mysql_fetch_array(mysql_query("SELECT * from `event` where `eventNo` = '{$eventNo}'"));
    $eventName = $eventResults['name'];
    $eventType = $eventResults['type'];
    $eventTime = $eventResults['callTime'];
    $eventReleaseTime = $eventResults['releaseTime'];
    $eventComments = $eventResults['comments'];
    $eventLocation = $eventResults['location'];
    $gigResults = mysql_fetch_array(mysql_query("select * from `gig` where `eventNo` = '{$eventNo}'"));
    $uniformCode = $gigResults['uniform'];
    $uniformResults = mysql_fetch_array(mysql_query("select `name` from `uniform` where `id` = '{$uniformCode}'"));
    $eventUniform = $uniformResults['name'];
    $eventTime = strtotime($eventTime);
    $eventTimeDisplay = date("D, M d g:i a", $eventTime);
    $eventReleaseTime = strtotime($eventReleaseTime);
    $eventReleaseTimeDisplay = date("D, M d g:i a", $eventReleaseTime);
    $typeResults = mysql_fetch_array(mysql_query("SELECT * from `eventType` where `id` = '{$eventType}`"));
    $eventType = $typeResults['name'];
    $redirectURL = "{$BASEURL}/php/fromEmail.php";
    $eventUrl = "{$BASEURL}/#event:{$eventNo}";
    if (!$CHOIR) {
        die("Choir not set");
    }
    $row = mysql_fetch_array(mysql_query("select `admin`, `list` from `choir` where `id` = '{$CHOIR}'"));
    $sender = $row['admin'];
    $recipient = $row['list'];
    //$recipient = "Matthew Schauer <awesome@gatech.edu>";
    $choirname = choirname($CHOIR);
    $subject = "New {$choirname} Event";
    $headers = "Content-type:text/html;\n" . "Reply-To: {$sender}\n" . "From: {$sender}\n" . 'X-Mailer: PHP/' . phpversion();
    $message = "<html><head></head><body>\n\t\t<h2><a href='{$eventUrl}'>{$eventName}</a></h2>\n\t\t<p><b>{$typeName}</b> from <b>{$eventTimeDisplay}</b> to {$eventReleaseTimeDisplay} at <b>{$eventLocation}</b></p>\n\t\t<p>Uniform:  {$eventUniform}</p>\n\t\t<p>{$eventComments}</p>";
    $message .= "<form action='{$redirectURL}' method='get'><input type='hidden' value='{$eventNo}' name='id' />";
    if ($typeName == "Volunteer Gig") {
        $confirm = "I will attend";
    } else {
        if ($typeName == "Tutti Gig") {
            $confirm = "Confirm I will attend";
        }
    }
    $yesform = "<button type='submit' value='true' name='attend'>{$confirm}</button>";
    $noform = "<button type='submit' value='false' name='attend'>I will not attend</button>";
    if ($typeName == "Volunteer Gig") {
        $message .= $yesform . $noform;
    } else {
        if ($typeName == "Tutti Gig") {
            $message .= $yesform;
        }
    }
    $message .= '</form></body></html>';
    if (!mail($recipient, $subject, $message, $headers)) {
        die("Failed to send event email");
    }
}
Пример #2
0
    $count = 0;
    foreach ($emailArr as $email) {
        if ($email == '') {
            continue;
        }
        // Ignore transactions with nobody
        if (!mysql_query("insert into transaction (memberID, choir, amount, description, semester, type) values ('" . mysql_escape_string($email) . "', '{$CHOIR}', '" . mysql_escape_string($amountArr[$count]) . "','" . mysql_escape_string($descriptionArr[$count]) . "', '" . mysql_escape_string($semArr[$count]) . "', '" . mysql_escape_string($typeArr[$count]) . "')")) {
            die(mysql_error());
        }
        if ($sendArr[$count]) {
            $name = fullNameFromEmail(mysql_real_escape_string($email));
            $msg = "Keep this receipt for your records.";
            $msg .= "<br />Name: " . $name;
            $msg .= "<br />Semester:  " . $semArr[$count];
            $result = mysql_fetch_array(mysql_query("select `name` from `transacType` where `id` = '" . $typeArr[$count] . "'"));
            $msg .= "<br />Category:  " . $result['name'];
            $msg .= "<br />Amount: " . $amountArr[$count];
            $msg .= "<br />Description: " . $descriptionArr[$count];
            $msg .= "<br />Date: " . date('l jS \\of F Y');
            //$msg .= "<br />Hash (for Treasurer's use): " . encrypt($d);
            $title = choirname($CHOIR) . " Receipt";
            $headers = 'MIME-Version: 1.0' . "\n";
            $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";
            mail($treasurerEmail . ', ' . $email, $title, $msg, $headers);
        }
        $count++;
    }
    echo "OK";
} else {
    echo "ERR";
}
Пример #3
0
                                $subcondarr[] = "(select sum(`transaction`.`amount`) from `transaction` where `transaction`.`semester` = '{$SEMESTER}' and `transaction`.`type` = 'dues' and `transaction`.`memberID` = `member`.`email`) < 0";
                            }
                        }
                    }
                }
            }
        }
    }
    $condarr[] = join(' or ', $subcondarr);
}
$condstr = '(' . join(") and (", $condarr) . ')';
if (!isOfficer($USER)) {
    $condstr = "exists (select * from `activeSemester` where `activeSemester`.`semester` = '{$SEMESTER}' and `activeSemester`.`member` = `member`.`email`)";
}
if ($_POST['type'] == "print") {
    $choirname = choirname($CHOIR);
    echo "<html><head><meta charset='UTF-8'><title>{$choirname} Roster</title></head><body>{$style}";
    echo member_table($condstr, "print");
    echo "</body></html>";
} else {
    if ($_POST['type'] == "csv") {
        //header("Content-type: text/csv");
        echo member_csv($condstr);
    } else {
        if ($_POST['type'] == "normal") {
            echo $style;
            echo member_table($condstr, "normal");
        } else {
            die("Unknown type");
        }
    }
Пример #4
0
function info($userEmail)
{
    global $SEMESTER, $CHOIR;
    $html = "";
    $sql = "select sum(`amount`) as `balance` from `transaction` where `memberID` = '{$userEmail}' and `type` = 'dues' and `semester` = '{$SEMESTER}'";
    $result = mysql_fetch_array(mysql_query($sql));
    $dues = $result['balance'];
    if ($dues == '') {
        $dues = 0;
    }
    $sql = "select sum(`amount`) as `balance` from `transaction` where `memberID` = '{$userEmail}' and `type` = 'deposit'";
    $result = mysql_fetch_array(mysql_query($sql));
    $tie = $result['balance'];
    if ($tie == '') {
        $tie = 0;
    }
    $html .= "<table><tr><td>";
    if ($dues >= 0) {
        $html .= "<span class='color: green'><i class='icon-ok'></i></span>";
    } else {
        $html .= "<span class='color: red'><i class='icon-remove'></i></span>";
    }
    $html .= "</td><td>Dues</td></tr><tr><td>";
    if ($tie >= fee("tie")) {
        $html .= "<span class='color: green'><i class='icon-ok'></i></span>";
    } else {
        $html .= "<span class='color: red'><i class='icon-remove'></i></span>";
    }
    $html .= "</td><td>Tie Deposit</td></tr></table><br>";
    $sql = "select `tie` from `tieBorrow` where `member` = '{$userEmail}' and `dateIn` is null";
    $query = mysql_query($sql);
    if (mysql_num_rows($query) == 0) {
        $html .= "You do <b>not</b> have a tie checked out.";
    } else {
        $result = mysql_fetch_array($query);
        $html .= "You have tie <b>" . $result['tie'] . "</b> checked out.";
    }
    $html .= "<br>";
    $balance = balance($userEmail);
    $choir = choirname($CHOIR);
    if ($balance > 0) {
        $html .= "{$choir} owes you <span style='font-weight: bold; color: blue'>\${$balance}</span>.";
    } else {
        if ($balance < 0) {
            $balance *= -1;
            $html .= "You owe {$choir} <span style='font-weight: bold; color: red'>\${$balance}</span>.";
        } else {
            $html .= "Your {$choir} balance is <span style='font-weight: bold'>\$0</span>.";
        }
    }
    $html .= "<br><br>" . user_money_table($userEmail);
    return "{$html}";
}