fobject();
$dmv->exec("UPDATE member_messages SET b_viewed = 't' WHERE i_recipientid = $userInfo->i_memberid AND i_messageid = $data->i_messageid;");
$result = $dmv->exec("SELECT i_messageid FROM member_messages WHERE b_viewed = 'f' AND i_recipientid = $userInfo->i_memberid;");
$count = $dmv->RecordCount();
echo "Incoming Message \n";
echo "
\n";
$_GET[mode] = "read";
}
if ( $_GET[mode] == "users" )
{
echo "Users Online \n";
if ( $userInfo->b_away == "f" )
echo "Mark yourself as away/busy \n";
if ( $userInfo->b_away == "t" )
{
$subresult = $dmv->exec("SELECT i_messageid FROM member_messages WHERE b_viewed = 'f'AND i_recipientid = $userInfo->i_memberid;");
$count = $dmv->RecordCount();
pg_FreeResult($subresult);
echo "Marked as Away with $count message(s). \n";
}
echo "
\n";
echo " table_header_color_bg>\n";
echo " \n";
echo " table_header_color_font\"> Name \n";
echo " \n";
echo " table_header_color_font\">Last Activity \n";
echo " \n";
$threshold = $pageStart - 240;
$result = pg_Query($conn, "SELECT i_memberid, c_fname, c_middle, c_lname, c_suffix, c_title, i_timestamp, b_away FROM members WHERE i_timestamp > $threshold ORDER BY c_lname, c_fname;");
$rows = pg_NumRows($result);
$bgcolor = $theme->table_row_color_bg;
for ( $y = 0; $y < $rows; $y++ )
{
$data = pg_Fetch_Object($result, $y);
$subresult = pg_Exec($conn, "SELECT (now() - max(t_posted)) AS diff FROM poetry WHERE i_memberid = $data->i_memberid;");
$diff = pg_Result($subresult, 0, 0);
pg_FreeResult($subresult);
echo " \n";
if ( $userInfo->i_memberid != $data->i_memberid )
echo " i_memberid\"> theme_name/sendMessage.gif\" WIDTH=16 HEIGHT=16 ALT=\"Send Message\" BORDER=0> \n";
else
echo " ";
echo " ";
$temp = Trim(substr($diff, strpos($diff, "@") + 2, 10));
if ( ( substr($temp, strpos($temp, " ") + 1, 1) == "h" ) || ( substr($temp, strpos($temp, " ") + 1, 3) == "min" ) )
$diff = 1;
else
$diff = substr($temp, 0, strpos($temp, " "));
if ( $diff < 5 ) echo " theme_name/new.gif\" WIDTH=10 HEIGHT=10 ALT=\"New Poetry\"> ";
echo "" . returnDisplayName(returnName($data)) . " ";
if ( $data->b_away == "t" ) echo " - Away ";
echo " \n";
if ( $userInfo->i_memberid != $data->i_memberid )
echo " i_memberid\" onClick=\"return confirm('$_LANG[add_friend_confirm]');\"> theme_name/addfriend.gif\" WIDTH=16 HEIGHT=16 ALT=\"Add Friend\" BORDER=0> \n";
else
echo " ";
echo " " . strftime("%I:%M %p", $data->i_timestamp) . " \n";
echo " \n";
if ( $bgcolor == $theme->table_row_color_bg )
$bgcolor = $theme->table_row_color_altbg;
else
$bgcolor = $theme->table_row_color_bg;
}
echo " table_header_color_bg>\n";
echo " table_header_color_font\">$rows Users Currently Online \n";
echo " \n";
echo "
\n";
echo "
Legend: \n";
echo " theme_name/sendMessage.gif\"> Send Message \n";
echo " theme_name/new.gif\"> Has New Poetry \n";
echo " theme_name/addfriend.gif\"> Add Friend \n";
echo "
\n";
}
if ( $_GET[mode] == "history" )
{
$result = pg_Query($conn, "SELECT count(i_messageid) as count FROM member_messages WHERE i_recipientid = $userInfo->i_memberid;");
$count = pg_Result($result, 0);
pg_FreeResult($result);
if ( $count > ( $_GET[offset] + 25 ))
{
$next = $_GET[offset] + 25;
$last = $count - 25;
} else {
$next = 0;
$last = 0;
}
if ( $_GET[offset] > 24 )
{
$prev = $_GET[offset] - 25;
if ( $prev < 0 ) $prev = 0;
} else {
$prev = -1;
}
echo "Your Incoming Message History \n";
$result = pg_Query($conn, "SELECT i_messageid, t_sent FROM member_messages WHERE i_recipientid = $userInfo->i_memberid ORDER BY t_sent DESC LIMIT 1;");
$messageid = pg_Result($result, 0, 0);
pg_FreeResult($result);
echo "Purge Message History
\n";
echo "[";
if ($prev>-1)
{
echo "First Page |\n";
echo "Previous Messages |\n";
}
if ($next>1) {
echo "Next Messages | ";
echo "Last Page ";
}
echo "]
\n";
$result = pg_Exec($conn, "SELECT a.*, b.c_fname, b.c_lname, b.c_middle, b.c_suffix FROM member_messages AS a, members AS b WHERE b.i_memberid = a.i_senderid AND a.i_recipientid = $userInfo->i_memberid AND a.b_viewed = 't' ORDER BY t_sent DESC OFFSET $_GET[offset] LIMIT 25;");
$rows = pg_NumRows($result);
for ( $y = 0; $y < $rows; $y++ )
{
echo "
\n";
}
pg_FreeResult($result);
}
if ( $_GET[mode] == "friends" )
{
echo "Your Friends List
\n";
echo "
\n";
echo " table_header_color_bg>\n";
echo " \n";
echo " table_header_color_font\"> Name \n";
echo " table_header_color_font\">Last On \n";
echo " table_header_color_font\">Last Post \n";
echo " \n";
echo " \n";
$result = $dmv->exec("SELECT a.i_friendid, b.c_fname, b.c_middle, b.c_lname, b.c_suffix, b.c_title, b.i_timestamp FROM member_friends AS a JOIN members AS b ON a.i_friendid = b.i_memberid WHERE a.i_memberid = $userInfo->i_memberid ORDER BY b.c_lname, b.c_fname;");
$rows = $dmv->RecordCount();
$bgcolor = $theme->table_row_color_bg;
for ( $y = 0; $y < $rows; $y++ )
{
$data = pg_Fetch_Object($result, $y);
$subresult = pg_Exec($conn, "SELECT date(max(t_posted)), (now() - max(t_posted)) AS diff FROM poetry WHERE i_memberid = $data->i_friendid;");
$last = pg_Result($subresult, 0, 0);
$diff = pg_Result($subresult, 0, 1);
pg_FreeResult($subresult);
echo " \n";
echo " i_friendid\"> theme_name/sendMessage.gif\" WIDTH=16 HEIGHT=16 ALT=\"Send Message\" BORDER=0> \n";
echo " ";
$temp = Trim(substr($diff, strpos($diff, "@") + 2, 10));
if ( ( substr($temp, strpos($temp, " ") + 1, 1) == "h" ) || ( substr($temp, strpos($temp, " ") + 1, 3) == "min" ) )
$diff = 1;
else
$diff = substr($temp, 0, strpos($temp, " "));
if ( $diff < 5 ) echo " theme_name/new.gif\" WIDTH=10 HEIGHT=10 ALT=\"New Entry\"> ";
echo "" . returnDisplayName(returnName($data)) . " ";
echo " " . strftime("%I:%M %p %m/%d/%y", $data->i_timestamp) . " \n";
echo " $last \n";
echo " i_friendid\" onClick=\"return confirm('$_LANG[all_delete_confirm]');\"> theme_name/deleteSM.gif\" WIDTH=16 HEIGHT=16 ALT=\"Delete Friend\" BORDER=0> \n";
echo " \n";
if ( $bgcolor == $theme->table_row_color_bg )
$bgcolor = $theme->table_row_color_altbg;
else
$bgcolor = $theme->table_row_color_bg;
}
pg_FreeResult($result);
}
if ( $_GET[mode] == "options" )
{
echo "Configuration Options \n";
echo "Coming Soon!";
}
if (( $_GET[mode] == "send" ))
{
$sql = "SELECT c_fname, c_lname, c_middle, c_suffix, b_away FROM members WHERE i_memberid=$_GET[i_recipientid];";
$dmv->exec($sql);
$data = $dmv->fobject();
echo "Send Message to " . returnDisplayName(returnName($data)) . "
\n";
if ( $data->b_away == "t" ) echo "This user is currently marked as away and will not receive notification of the message sent until they return.
\n";
echo " \n";
}
if ( ( $_GET[mode] == "sendAll" ) and (( $userInfo->member_type == 1 ) OR ( $userInfo->member_type ==8 ) OR ( $userInfo->member_type ==7 )))
{
$title = "All Members";
if ( isset($_GET[filter]) )
$title = UCWords(strtolower($_GET[filter]));
echo "Send Message to $title \n";
echo "
\n";
echo "";
echo " \n";
echo " \n";
if ( isset($_GET[filter]) ) echo " \n";
echo "
\n";
}
$diff = time() - $pageStart;
?>
i_memberstate > 3 )
{
echo "";
echo "\n\n";
echo " \n";
echo " i_senderid\">\n";
echo " \n";
echo " ";
echo " ";
echo "";
echo "\n\n";
echo " \n";
echo " \n";
echo " i_senderid\">\n";
echo " \n";
echo " ";
echo " ";
}
if ( $userInfo->i_memberstate > 1 )
{
echo "";
echo "\n\n";
echo " \n";
echo " \n";
echo " i_senderid\">\n";
echo " \n";
echo " ";
echo " ";
echo "";
echo "\n\n";
echo " \n";
echo " \n";
echo " i_senderid\">\n";
echo " \n";
echo " ";
echo " ";
}
if (( $userInfo->member_type == 1 ) or ( $userInfo->member_type == 7 ) or ( $userInfo->member_type == 8 ))
{
echo "";
echo "\n\n";
echo " \n";
echo " \n";
echo " i_senderid\">\n";
echo " \n";
echo " ";
echo " "; }
echo "Page Generated in $diff Seconds"; ?>Terms and Conditions