} /* set the email author */ $userFetch = "SELECT crew.crewid, crew.firstName, crew.lastName, crew.email, rank.rankShortName "; $userFetch .= "FROM sms_crew AS crew, sms_ranks AS rank "; $userFetch .= "WHERE crew.crewid = {$emailAuthor} AND crew.rankid = rank.rankid LIMIT 1"; $userFetchResult = mysql_query($userFetch); while ($userFetchArray = mysql_fetch_array($userFetchResult)) { extract($userFetchArray, EXTR_OVERWRITE); } $firstName = str_replace("'", "", $firstName); $lastName = str_replace("'", "", $lastName); $from = $rankShortName . " " . $firstName . " " . $lastName . " < " . $email . " >"; /* define the variables */ $to = getCrewEmails("emailPosts"); $subject = $emailSubject . " " . printMissionTitle($postMission) . " - " . $postTitle; $message = "A Post By " . displayEmailAuthors($postAuthors, 'noLink') . "\r\n"; $message .= "Location: " . stripslashes($postLocation) . "\r\n"; $message .= "Timeline: " . stripslashes($postTimeline) . "\r\n"; $message .= "Tag: " . stripslashes($postTag) . "\r\n\r\n"; $message .= stripslashes($postContent); /* send the email */ mail($to, $subject, $message, "From: " . $from . "\nX-Mailer: PHP/" . phpversion()); } } ?> <script type="text/javascript"> $(document).ready(function() { $('#participants').change(function(){ var number = $(this).val();
${$k} = $v; } switch ($postStatus) { case 'activated': $to = getCrewEmails("emailPosts"); $subject = $emailSubject . " " . printMissionTitle($postMission) . " - " . $postTitle; $message = "A Post By " . displayEmailAuthors($sessionCrewid, 'noLink') . "\r\n"; $message .= "Location: " . stripslashes($postLocation) . "\r\n"; $message .= "Timeline: " . stripslashes($postTimeline) . "\r\n"; $message .= "Tag: " . stripslashes($postTag) . "\r\n\r\n"; $message .= stripslashes($postContent); break; case 'pending': $to = printCOEmail(); $subject = $emailSubject . " " . printMissionTitle($postMission) . " - " . $postTitle . " (Awaiting Approval)"; $message = "A Post By " . displayEmailAuthors($sessionCrewid, 'noLink') . "\r\n"; $message .= "Location: " . stripslashes($postLocation) . "\r\n"; $message .= "Timeline: " . stripslashes($postTimeline) . "\r\n"; $message .= "Tag: " . stripslashes($postTag) . "\r\n\r\n"; $message .= stripslashes($postContent) . "\r\n\r\n"; $message .= "Please log in to approve this post. " . $webLocation . "login.php?action=login"; break; } /* send the email */ mail($to, $subject, $message, "From: " . $from . "\nX-Mailer: PHP/" . phpversion()); } elseif (isset($_POST['action_save_x'])) { if (!isset($id)) { $insert = "INSERT INTO sms_posts (postAuthor, postTitle, postLocation, postTimeline, postContent, postPosted, postMission, "; $insert .= "postStatus, postTag) VALUES (%d, %s, %s, %s, %s, %d, %d, %s, %s)"; $query = sprintf($insert, escape_string($sessionCrewid), escape_string($_POST['postTitle']), escape_string($_POST['postLocation']), escape_string($_POST['postTimeline']), escape_string($_POST['postContent']), escape_string($today[0]), escape_string($_POST['postMission']), escape_string('saved'), escape_string($_POST['postTag'])); } else {
$authors_string = implode(",", $authors_array); /* set the email author */ $userFetch = "SELECT crew.crewid, crew.firstName, crew.lastName, crew.email, rank.rankShortName "; $userFetch .= "FROM sms_crew AS crew, sms_ranks AS rank "; $userFetch .= "WHERE crew.crewid = {$sessionCrewid} AND crew.rankid = rank.rankid LIMIT 1"; $userFetchResult = mysql_query($userFetch); while ($userFetchArray = mysql_fetch_array($userFetchResult)) { extract($userFetchArray, EXTR_OVERWRITE); } $firstName = str_replace("'", "", $firstName); $lastName = str_replace("'", "", $lastName); $from = $rankShortName . " " . $firstName . " " . $lastName . " < " . $email . " >"; /* define the variables */ $to = $authors_string; $subject = $emailSubject . " Saved Post Deletion Notification"; $message = "This email is to notify you that your joint post, " . stripslashes($authorFetch[1]) . ", has been deleted by " . displayEmailAuthors($sessionCrewid, 'noLink') . "."; /* send the email */ mail($to, $subject, $message, "From: " . $from . "\nX-Mailer: PHP/" . phpversion()); } ?> <div class="body"> <?php /* set the type */ if (isset($delete) || isset($add)) { $type = "joint post author"; } else { $type = "joint mission post"; } $check = new QueryCheck(); $check->checkQuery($result, $query);
$fetchPost = mysql_fetch_assoc($getPostContentsResult); /* set the email author */ $userFetch = "SELECT crew.crewid, crew.firstName, crew.lastName, crew.email, "; $userFetch .= "rank.rankShortName FROM sms_crew AS crew, sms_ranks AS rank WHERE "; $userFetch .= "crew.crewid = '{$fetchPost['postAuthor']}' AND crew.rankid = rank.rankid LIMIT 1"; $userFetchResult = mysql_query($userFetch); while ($userFetchArray = mysql_fetch_array($userFetchResult)) { extract($userFetchArray, EXTR_OVERWRITE); } $firstName = str_replace("'", "", $firstName); $lastName = str_replace("'", "", $lastName); $from = $rankShortName . " " . $firstName . " " . $lastName . " < " . $email . " >"; /* define the variables */ $to = getCrewEmails("emailPosts"); $subject = $emailSubject . " " . printMissionTitle($fetchPost['postMission']) . " - " . $fetchPost['postTitle']; $message = "A Post By " . displayEmailAuthors($fetchPost['postAuthor'], 'noLink') . "\r\n"; $message .= "Location: " . stripslashes($fetchPost['postLocation']) . "\r\n"; $message .= "Timeline: " . stripslashes($fetchPost['postTimeline']) . "\r\n"; $message .= "Tag: " . stripslashes($fetchPost['postTag']) . "\r\n\r\n"; $message .= stripslashes($fetchPost['postContent']); /* send the email */ mail($to, $subject, $message, "From: " . $from . "\nX-Mailer: PHP/" . phpversion()); break; case 'delete': $query = "DELETE FROM sms_posts WHERE postid = {$action_id} LIMIT 1"; $result = mysql_query($query); /* optimize the table */ optimizeSQLTable("sms_posts"); break; } }