// Display total replys echo " <table border='0' cellpadding='0' cellspacing='0'><tr><td width='100px'> "; // Display total topic replys total_topic_replys_display_a($f_p_id); echo " </td><td align='right'> "; // Display total views total_topic_views($f_p_id, NULL, 'views', 'forum'); echo "</td></tr></table>"; // Get last reply date from database $query33 = "SELECT * FROM " . $db_table_prefix . "forum_posts_replys WHERE `fpr_post_id`='{$f_p_id}' ORDER BY id DESC LIMIT 1"; $result33 = $mysqli->query($query33); $arr33 = $result33->fetch_all(MYSQLI_BOTH); foreach ($arr33 as $row33) { $rp_user_id2 = $row33['fpr_user_id']; $rp_timestamp2 = $row33['fpr_timestamp']; $rp_user_name2 = get_user_name_2($rp_user_id2); //Display how long ago this was posted $timestart = "{$rp_timestamp2}"; //Time of post require_once "models/timediff.php"; echo " Last Reply By <a href='{$site_url_link}member/{$rp_user_id2}/'>{$rp_user_name2}</a> <font color=green> " . dateDiff("now", "{$timestart}", 1) . " ago</font> "; //echo "($rp_timestamp2)"; // Test timestamp unset($timestart, $rp_timestamp2); } echo "</td></tr></table>"; echo "</td></tr></table>"; } // End query } // End query check echo "</td></tr></table>";
$thetotal = "{$thetotal3}"; } echo "Showing {$offset}-{$thetotal} of {$total} Replys"; echo "</td></tr></table>"; echo "</td></tr></table>"; } // End of pages check foreach ($arr3 as $row3) { $rf_p_main_id = $row3['id']; $rf_p_id = $row3['fpr_post_id']; $rf_p_id_cat = $row3['fpr_id']; $rf_p_content = $row3['fpr_content']; $rf_p_edit_date = $row3['fpr_edit_date']; $rf_p_timestamp = $row3['fpr_timestamp']; $rf_p_user_id = $row3['fpr_user_id']; $rf_p_user_name = get_user_name_2($rf_p_user_id); $rf_p_content = stripslashes($rf_p_content); echo "<a class='anchor' name='topicreply{$rf_p_main_id}'></a>"; echo "<table width='100%' border='0' cellspacing='0' cellpadding='0'>"; echo "<tr><td class='forum_title_body_b' width='100' valign='top'>"; echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'><tr>"; echo "<td align='center'>"; // Show user main pic $ID02 = $rf_p_user_id; echo "<br><a href='{$site_url_link}member/{$rf_p_user_id}/'>{$rf_p_user_name}</a> "; //Show user's membership status $up_get_mem_status = get_up_info_mem_status($rf_p_user_id); echo "<br> {$up_get_mem_status} "; // Display how long ago this was posted $timestart = "{$rf_p_timestamp}"; //Time of post
public function RecentForumPosts() { // Which database do we use $stc_page_sel = "forum"; $site_forum_title = "Forum"; echo "<div class='panel panel-default'>"; echo "<div class='panel-heading' style='font-weight: bold'>"; echo "Forum Recent Posts"; echo "</div>"; echo "<ul class='list-group'>"; // Recent forum post limits if (isUserLoggedIn()) { // How many recent posts to show if user is logged in $rp_limit = 10; } else { // How many recent posts to show if user is not logged in $rp_limit = 5; } // Get all Sub Categories for current category //$query = "SELECT * FROM ".$db_table_prefix."forum_posts WHERE `forum_id`='$f_id' ORDER BY forum_timestamp DESC"; $query = "\n\t\t\t\t\tSELECT sub.*\n\t\t\t\t\tFROM\n\t\t\t\t\t(SELECT \n\t\t\t\t\t\tfp.forum_post_id as forum_post_id, fp.forum_id as forum_id, \n\t\t\t\t\t\tfp.forum_user_id as forum_user_id, fp.forum_title as forum_title, \n\t\t\t\t\t\tfp.forum_content as forum_content, fp.forum_edit_date as forum_edit_date,\n\t\t\t\t\t\tfp.forum_timestamp as forum_timestamp, fpr.id as id,\n\t\t\t\t\t\tfpr.fpr_post_id as fpr_post_id, fpr.fpr_id as fpr_id,\n\t\t\t\t\t\tfpr.fpr_user_id as fpr_user_id, fpr.fpr_title as fpr_title,\n\t\t\t\t\t\tfpr.fpr_content as fpr_content, fpr.fpr_edit_date as fpr_edit_date,\n\t\t\t\t\t\tfpr.fpr_timestamp as fpr_timestamp,\t\t\n\t\t\t\t\t\tGREATEST(fp.forum_timestamp, COALESCE(fpr.fpr_timestamp, '00-00-00 00:00:00')) AS tstamp\n\t\t\t\t\t\tFROM " . $db_table_prefix . "forum_posts fp\n\t\t\t\t\t\tLEFT JOIN " . $db_table_prefix . "forum_posts_replys fpr\n\t\t\t\t\t\tON fp.forum_post_id = fpr.fpr_post_id\n\t\t\t\t\t\tORDER BY tstamp DESC\n\t\t\t\t\t) sub\n\t\t\t\t\t\n\t\t\t\t\tGROUP BY forum_post_id\n\t\t\t\t\tORDER BY tstamp DESC\n\t\t\t\t\tLIMIT {$rp_limit}\n\t\t\t\t"; if ($result = $mysqli->query($query)) { $arr2 = $result->fetch_all(MYSQLI_BOTH); foreach ($arr2 as $row2) { $f_p_id = $row2['forum_post_id']; $f_p_id_cat = $row2['forum_id']; $f_p_title = $row2['forum_title']; $f_p_timestamp = $row2['forum_timestamp']; $f_p_user_id = $row2['forum_user_id']; $tstamp = $row2['tstamp']; $f_p_user_name = get_user_name_2($f_p_user_id); $f_p_title = stripslashes($f_p_title); //Reply information $rp_user_id2 = $row2['fpr_user_id']; $rp_timestamp2 = $row2['fpr_timestamp']; // Set the incrament of each post if (isset($vm_id_a_rp)) { $vm_id_a_rp++; } else { $vm_id_a_rp = "1"; } //echo "$vm_id_a_rp"; $f_p_title = strlen($f_p_title) > 30 ? substr($f_p_title, 0, 30) . ".." : $f_p_title; //If no reply show created by if ($rp_timestamp2 == NULL) { echo "<ul class='list-group-item'>"; //echo "($tstamp)"; // Test timestamp echo "<a href='{$site_url_link}member/{$f_p_user_id}/'>{$f_p_user_name}</a> created.. <br>"; echo "<strong>"; echo "<a href='{$site_url_link}{$site_forum_title}/display_topic/{$f_p_id}/' title='{$f_p_title}' ALT='{$f_p_title}'>{$f_p_title}</a>"; echo "</strong>"; echo "<br>"; //Display how long ago this was posted $timestart = "{$f_p_timestamp}"; //Time of post require_once "external/timediff.php"; echo " <font color=green> " . dateDiff("now", "{$timestart}", 1) . " ago</font> "; //echo "($f_p_timestamp)"; // Test timestamp echo "</ul>"; } else { $rp_user_name2 = get_user_name_2($rp_user_id2); //If reply show the following echo "<ul class='list-group-item'>"; //echo "($tstamp)"; // Test timestamp echo "<a href='{$site_url_link}member/{$rp_user_id2}/'>{$rp_user_name2}</a> posted on.. <br>"; echo "<strong>"; echo "<a href='{$site_url_link}{$site_forum_title}/display_topic/{$f_p_id}/' title='{$f_p_title}' ALT='{$f_p_title}'>{$f_p_title}</a>"; echo "</strong>"; //Display how long ago this was posted $timestart = "{$rp_timestamp2}"; //Time of post require_once "external/timediff.php"; echo "<br><font color=green> " . dateDiff("now", "{$timestart}", 1) . " ago</font> "; //echo "($rp_timestamp2)"; // Test timestamp unset($timestart, $rp_timestamp2); echo "</ul>"; } // End reply check } // End query } // End query check echo "</ul></div>"; }
$forum_title = stripslashes($forum_title); $f_cur_topic_title = $forum_title; echo "<hr>"; //For Testing echo "List of users that have posted in this topic along with thier emails<br><br>"; //Get User Ids based on forum topic id //Only sends one email per user except the user currently posting //Use Join to get the original posters email $query_get_uids = "\n\t\t\t\t\tSELECT * FROM (\n\t\t\t\t\t\t(\n\t\t\t\t\t\tSELECT fpr_user_id AS F_UID\n\t\t\t\t\t\tFROM " . $db_table_prefix . "forum_posts_replys \n\t\t\t\t\t\tWHERE fpr_post_id = '{$f_topic_id}' \n\t\t\t\t\t\tAND subcribe_email = 'YES'\n\t\t\t\t\t\tAND NOT fpr_user_id = '{$f_cur_usr_id}'\n\t\t\t\t\t\tGROUP BY fpr_user_id\n\t\t\t\t\t\tORDER BY fpr_timestamp DESC\n\t\t\t\t\t\t)\n\t\t\t\t\t\tUNION ALL\n\t\t\t\t\t\t(\n\t\t\t\t\t\tSELECT forum_user_id AS F_UID\n\t\t\t\t\t\tFROM " . $db_table_prefix . "forum_posts\n\t\t\t\t\t\tWHERE forum_post_id = '{$f_topic_id}'\n\t\t\t\t\t\tAND subcribe_email = 'YES'\n\t\t\t\t\t\tAND NOT forum_user_id = '{$f_cur_usr_id}'\n\t\t\t\t\t\tGROUP BY forum_user_id\n\t\t\t\t\t\tORDER BY forum_timestamp DESC\n\t\t\t\t\t\t) \n ) AS uniontable\n\t\t\t\t\tGROUP BY `F_UID`\n ORDER BY `F_UID` ASC\n\t\t\t\t"; if ($result_get_uids = $mysqli->query($query_get_uids)) { $arr_get_uids = $result_get_uids->fetch_all(MYSQLI_BOTH); foreach ($arr_get_uids as $row_get_uids) { $f_topic_get_user_id = $row_get_uids['F_UID']; $f_topic_get_user_name = get_user_name_2($f_topic_get_user_id); $f_topic_get_email = get_user_email($f_topic_get_user_id); $f_cur_user_name = get_user_name_2($userIdme); //Format the content with bbcode require_once 'models/bbParser.php'; $parser = new bbParser(); $forum_content = $parser->getHtml($forum_content); echo "Username: {$f_topic_get_user_name} AND UserID: {$f_topic_get_user_id} AND UserEmail: OK"; //Send user an email notification //Start of mail $adminmail = $f_topic_get_email; $usersub = "{$websiteName} - Forum - {$f_cur_user_name} replied to {$f_cur_topic_title}"; $usermsg = "{$websiteName} - Forum Notification\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tCategory: {$f_cur_topic_cat}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tTopic: {$f_cur_topic_title}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tReply by: {$f_cur_user_name}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<br><br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tReply Content:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t************************<br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{$forum_content}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<br>************************"; $usermsg2 = " You may check the reply at <a href={$redir_link_url}>{$redir_link_url}</a>"; $username = "******"; //Mail file that setup the email and sends it based on input above require "models/mail.php"; //End of mail
<?php if (isUserLoggedIn()) { global $mysqli, $site_url_link, $site_forum_title, $userIdme, $db_table_prefix; echo "<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td class='forum_title_body' valign='top' width='100'>"; echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'><tr>"; echo "<td align='center'>"; // Show user main pic $get_user_name_323 = get_user_name_2($userIdme); echo "<br><a href='{$site_url_link}member/{$userIdme}/'>{$get_user_name_323}</a> "; //Show user's membership status $up_get_mem_status = get_up_info_mem_status($userIdme); echo "<br> {$up_get_mem_status} "; echo "<br>"; echo "</td></tr></table>"; echo "</td><td class='forum_title_body' valign='top'>"; echo "<form enctype=\"multipart/form-data\" action=\"{$site_url_link}{$site_forum_main}?1=save_topic&2={$f_p_id_cat}/\" method=\"POST\" onsubmit=\"submitmystat.disabled = true; return true;\" >"; // create multi sessions if (isset($session_token_num)) { $session_token_num = $session_token_num + 1; } else { $session_token_num = "1"; } form_token(); //echo "<br>-($usr_email_subcribe)-<br>"; //Checks if user is subscribed to email or not //Then checks or un-checks box if ($usr_email_subcribe == "NO") { $usr_subsc_check = ""; } else { $usr_subsc_check = "checked=checked";