$category = mysql_fetch_assoc($getCategoryResult); /* 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 = '{$fetchNews['newsAuthor']}' 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("emailNews"); $subject = $emailSubject . " " . stripslashes($category['catName']) . " - " . stripslashes($fetchNews['newsTitle']); $message = "A News Item Posted By " . printCrewNameEmail($fetchNews['newsAuthor']) . "\r\n\r\n"; $message .= stripslashes($fetchNews['newsContent']); /* send the email */ mail($to, $subject, $message, "From: " . $from . "\nX-Mailer: PHP/" . phpversion()); break; case 'delete': $query = "DELETE FROM sms_news WHERE newsid = {$action_id} LIMIT 1"; $result = mysql_query($query); /* optimize the table */ optimizeSQLTable("sms_news"); break; } } if ($action_category == 'award' && in_array('m_giveaward', $sessionAccess)) { switch ($action_type) { case 'accept':
function messages($crew) { $countMessages = "SELECT pmid, pmSubject, pmAuthor FROM sms_privatemessages "; $countMessages .= "WHERE pmRecipient = '{$crew}' AND pmStatus = 'unread' "; $countMessages .= "AND pmRecipientDisplay = 'y'"; $countMessagesResult = mysql_query($countMessages); $countMessagesFinal = mysql_num_rows($countMessagesResult); /* do some logic to determine the plurality */ if ($countMessagesFinal == 1) { $countPlural = "message"; } elseif ($countMessagesFinal > 1) { $countPlural = "messages"; } if ($countMessagesFinal > 0) { $this->output_array[3][1] = "<div class='notify-orange'>"; $this->output_array[3][1] .= "<b class='orange case'>" . $countMessagesFinal . " unread private " . $countPlural . "</b> "; $this->output_array[3][1] .= "<span class='fontNormal'>— <a href='" . WEBLOC . "admin.php?page=user&sub=inbox'>Go to Inbox</a></span><br />"; $this->output_array[3][1] .= "<table>"; while ($msgFetch = mysql_fetch_array($countMessagesResult)) { extract($msgFetch, EXTR_OVERWRITE); $this->output_array[3][1] .= "<tr>"; $this->output_array[3][1] .= "<td class='fontNormal'><a href='" . WEBLOC . "admin.php?page=user&sub=message&id=" . $msgFetch['pmid'] . "'>"; if (!empty($msgFetch['pmSubject'])) { $this->output_array[3][1] .= $msgFetch['pmSubject']; } else { $this->output_array[3][1] .= "<i>[ No Subject ]</i>"; } $this->output_array[3][1] .= "</a> from " . printCrewNameEmail($msgFetch['pmAuthor'], "rank", "noLink") . "</td>"; $this->output_array[3][1] .= "</tr>"; } $this->output_array[3][1] .= "</table>"; $this->output_array[3][1] .= "</div>"; } }
/** Function that displays the about information regarding SMS **/ function checkUnreadMessages($crew) { /* count the posts */ $countMessages = "SELECT pmid, pmSubject, pmAuthor FROM sms_privatemessages "; $countMessages .= "WHERE pmRecipient = '{$crew}' AND pmStatus = 'unread' "; $countMessages .= "AND pmRecipientDisplay = 'y'"; $countMessagesResult = mysql_query($countMessages); $countMessagesFinal = mysql_num_rows($countMessagesResult); /* do some logic to determine the plurality */ if ($countMessagesFinal == "1") { $countPlural = "message"; } elseif ($countMessagesFinal > "1") { $countPlural = "messages"; } if ($countMessagesFinal > "0") { echo "<br />"; echo "<div class='update'>"; echo "<img src='" . WEBLOC . "images/messages-unread.png' border='0' alt='' style='float:left; padding: 0 12px 0 0;' />"; echo "<span class='fontTitle'>" . $countMessagesFinal . " Unread Private " . ucwords($countPlural) . "</span>"; echo "<br /><br />"; echo "<table>"; while ($msgFetch = mysql_fetch_array($countMessagesResult)) { extract($msgFetch, EXTR_OVERWRITE); echo "<tr>"; echo "<td class='fontNormal'><a href='" . WEBLOC . "admin.php?page=user&sub=message&id=" . $msgFetch['pmid'] . "'>"; if (!empty($msgFetch['pmSubject'])) { echo $msgFetch['pmSubject']; } else { echo "<i>[ No Subject ]</i>"; } echo "</a> from " . printCrewNameEmail($msgFetch['pmAuthor'], "rank", "noLink") . "</td>"; echo "</tr>"; } echo "</table>"; echo "<br />"; echo "<a href='" . WEBLOC . "admin.php?page=user&sub=inbox'>Go to Inbox »</a>"; echo "</div>"; } }
<td> <input type="image" src="<?php echo path_userskin; ?> buttons/send.png" name="action_send" value="Send" class="button" /> </td> </tr> </table> </form> <?php /* display the previous message if you're replying */ if (isset($reply)) { $get = "SELECT * FROM sms_privatemessages WHERE pmid = {$reply} LIMIT 1"; $getR = mysql_query($get); $fetch = mysql_fetch_assoc($getR); echo "<br />"; echo "<div class='update notify-normal'>"; echo "<strong class='blue'>On " . dateFormat('long', $fetch['pmDate']) . " " . printCrewNameEmail($id) . " wrote:</strong><br /><br />"; printText($fetch['pmContent']); echo "</div>"; } ?> </div> </div> </div> <?php } else { errorMessage("private message inbox"); }
$userFetch .= "WHERE crew.crewid = {$newsAuthor} 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 . " >"; } /* pull the category name */ $getCategory = "SELECT catName FROM sms_news_categories WHERE catid = {$newsCat} LIMIT 1"; $getCategoryResult = mysql_query($getCategory); $category = mysql_fetch_assoc($getCategoryResult); /* define the variables */ $to = getCrewEmails("emailNews"); $subject = $emailSubject . " " . stripslashes($category['catName']) . " - " . stripslashes($newsTitle); $message = "A News Item Posted By " . printCrewNameEmail($newsAuthor) . "\r\n\r\n"; $message .= stripslashes($newsContent); /* send the email */ mail($to, $subject, $message, "From: " . $from . "\nX-Mailer: PHP/" . phpversion()); } } ?> <div class="body"> <?php $check = new QueryCheck(); $check->checkQuery($result, $query); if (!empty($check->query)) { $check->message("news item", "add"); $check->display(); }
} /* pull the category name */ $getCategory = "SELECT catName FROM sms_news_categories WHERE catid = {$newsCat} LIMIT 1"; $getCategoryResult = mysql_query($getCategory); $category = mysql_fetch_assoc($getCategoryResult); switch ($newsStatus) { case 'activated': $to = getCrewEmails("emailNews"); $subject = $emailSubject . " " . stripslashes($category['catName']) . " - " . stripslashes($newsTitle); $message = "A News Item Posted By " . printCrewNameEmail($sessionCrewid) . "\r\n\r\n"; $message .= stripslashes($newsContent); break; case 'pending': $to = printCOEmail(); $subject = $emailSubject . " " . stripslashes($category['catName']) . " - " . stripslashes($newsTitle) . " (Awaiting Approval)"; $message = "A News Item Posted By " . printCrewNameEmail($sessionCrewid) . "\r\n\r\n"; $message .= stripslashes($newsContent) . "\r\n\r\n"; $message .= "Please log in to approve this news item. " . $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_news (newsCat, newsAuthor, newsPosted, newsTitle, newsContent, newsStatus, newsPrivate) "; $insert .= "VALUES (%d, %d, %d, %s, %s, %s, %s)"; $query = sprintf($insert, escape_string($_POST['newsCat']), escape_string($sessionCrewid), escape_string($today[0]), escape_string($_POST['newsTitle']), escape_string($_POST['newsContent']), escape_string('saved'), escape_string($_POST['newsPrivate'])); } else { $update = "UPDATE sms_news SET newsCat = %d, newsPosted = %d, newsTitle = %s, newsContent = %s, newsStatus = %s, "; $update .= "newsPrivate = %s WHERE newsid = {$id} LIMIT 1"; $query = sprintf($update, escape_string($_POST['newsCat']), escape_string($today[0]), escape_string($_POST['newsTitle']), escape_string($_POST['newsContent']), escape_string('saved'), escape_string($_POST['newsPrivate']));
} /* if there isn't anything in the email array, put the CO into the string */ if (count($email_array) == 0) { $to = printCOEmail(); } else { $to = implode(",", $email_array); } /* set the other variables */ $nominee = FALSE; $nominated_by = FALSE; $award = FALSE; if (is_numeric($_POST['crew'])) { $nominee = printCrewNameEmail($_POST['crew']); } if (is_numeric($_POST['nominator'])) { $nominated_by = printCrewNameEmail($_POST['nominator']); } if (is_numeric($_POST['award'])) { $get = "SELECT awardName FROM sms_awards WHERE awardid = {$_POST['award']} LIMIT 1"; $getR = mysql_query($get); $fetch = mysql_fetch_array($getR); $award = $fetch[0]; } $reason = $_POST['reason']; $subject = $emailSubject . " Crew Award Nomination"; $message = "A member of your crew has nominated a character for an award. The award has been added to the queue and is available for review and activation from the control panel. The nomination is available below for reference.\n\t\t\n==========\n\t\t\nNominee: " . $nominee . "\nAward: " . $award . "\nNominated By: " . $nominated_by . "\n\nReason: " . $reason . "\n\n==========\n\nLogin to your control panel at " . $webLocation . "login.php?action=login to approve or deny this award."; /* send the nomination email */ mail($to, $subject, $message, "From: " . $from . "\nX-Mailer: PHP/" . phpversion()); } /* find out how many IC awards there are */ $ic = "SELECT awardid, awardCat FROM sms_awards";