public function forum_category_lict_byId_Details()
 {
     global $dbObj, $common;
     $action = $common->replaceEmpty('action', '');
     if ($action = 'forumcategorylistByid') {
         //echo  "SELECT * FROM ras_kunena_topics  where category_id = '".$_REQUEST['forumId']."' ";
         $rs123 = $dbObj->runQuery("SELECT * FROM ras_kunena_topics  where category_id = '" . $_REQUEST['forumId'] . "' ORDER BY first_post_time DESC ");
         if (mysql_num_rows($rs123) > 0) {
             while ($data123 = mysql_fetch_assoc($rs123)) {
                 $tempArray = array();
                 $tempArray['category_id'] = $data123['category_id'];
                 $tempArray['topic_id'] = $data123['id'];
                 $tempArray['subject'] = $data123['subject'];
                 //$tempArray['reply_count'] 			=  $data123['posts'] -1;
                 //$tempArray['posts'] 				= $tempArray['reply_count'];
                 // $tempArray['reply_count']                    = $tempArray['posts'];
                 $tempArray['hits'] = $data123['hits'];
                 $tempArray['first_post_id'] = $data123['first_post_id'];
                 //$tempArray['first_post_time'] 		=  $data123['first_post_time'];
                 $tempArray['first_post_time'] = ssss(date("Y-m-d H:i:s", $data123['first_post_time']));
                 $tempArray['first_post_userid'] = $data123['first_post_userid'];
                 $tempArray['first_post_message'] = $data123['first_post_message'];
                 $tempArray['first_post_guest_name'] = $data123['first_post_guest_name'];
                 $tempArray['last_post_id'] = $data123['last_post_id'];
                 $tempArray['last_post_time'] = ssss(date("Y-m-d H:i:s", $data123['last_post_time']));
                 $tempArray['last_post_userid'] = $data123['last_post_userid'];
                 $tempArray['last_post_message'] = $data123['last_post_message'];
                 $tempArray['last_post_guest_name'] = $data123['last_post_guest_name'];
                 ############ For Message Count ##################
                 $rs_replyCount = $dbObj->runQuery("SELECT count( * ) as replycount\nFROM `ras_kunena_messages` WHERE `thread` ='" . $tempArray['topic_id'] . "' AND `catid` ='" . $tempArray['category_id'] . "'  ");
                 $dataReply = mysql_fetch_assoc($rs_replyCount);
                 $tempArray['posts'] = $dataReply['replycount'];
                 ###########End Here ###################
                 $FullfinalArray[] = $tempArray;
                 //array_push($FullfinalArray11,$FullfinalArray);
             }
             $data = array('status' => '1', 'result' => $FullfinalArray);
             echo json_encode($data);
             exit;
         } else {
             $data = array('status' => '0', 'result' => '');
             echo json_encode($data);
             exit;
         }
     }
 }
 public function forum_subcategory_list_byId_Details()
 {
     global $dbObj, $common;
     $action = $common->replaceEmpty('action', '');
     $threadId = $common->replaceEmpty('threadId', '');
     if ($action = 'forumsubcategorylistByid') {
         $rs123 = $dbObj->runQuery("SELECT * FROM ras_kunena_messages  where thread = '" . $threadId . "' order by id desc");
         if (mysql_num_rows($rs123) > 0) {
             while ($data123 = mysql_fetch_assoc($rs123)) {
                 $tempArray = array();
                 $tempArray['msgId'] = $data123['id'];
                 $rs1234 = $dbObj->runQuery("SELECT * FROM ras_kunena_messages_text  where mesid = '" . $data123['id'] . "'  ");
                 $data1234 = mysql_fetch_assoc($rs1234);
                 $tempArray['message'] = $data1234['message'];
                 $tempArray['thread'] = $data123['thread'];
                 $tempArray['parent'] = $data123['parent'];
                 $tempArray['catid'] = $data123['catid'];
                 $tempArray['name'] = $data123['name'];
                 $tempArray['userid'] = $data123['userid'];
                 $tempArray['email'] = $data123['email'];
                 $tempArray['subject'] = $data123['subject'];
                 $tempArray['time'] = ssss(date("Y-m-d H:i:s", $data123['time']));
                 $FullfinalArray[] = $tempArray;
             }
             ######### get Current Topic Title#########
             $sql_cate1 = "  SELECT subject as topic_name FROM `ras_kunena_topics` WHERE `id` = '" . $threadId . "'  ";
             $rs_username_cat1 = mysql_query($sql_cate1);
             $data_cat1 = mysql_fetch_assoc($rs_username_cat1);
             $category_name = $data_cat1['topic_name'];
             ########## End Here ####################
             $data = array('status' => '1', 'category_name' => $category_name, 'result' => $FullfinalArray);
             echo json_encode($data);
             exit;
         } else {
             $data = array('status' => '0', 'category_name' => $category_name, 'result' => '');
             echo json_encode($data);
             exit;
         }
     }
     //action close
 }
 public function forum_subcategory_list_byId_Details()
 {
     global $dbObj, $common;
     $action = $common->replaceEmpty('action', '');
     $threadId = $common->replaceEmpty('threadId', '');
     if ($action = 'forumsubcategorylistByid') {
         //echo "SELECT * FROM ras_kunena_messages  where thread = '".$threadId."' and parent != '0' order by time desc";
         $rs123 = $dbObj->runQuery("SELECT * FROM ras_kunena_messages  where thread = '" . $threadId . "' order by id desc");
         if (mysql_num_rows($rs123) > 0) {
             while ($data123 = mysql_fetch_assoc($rs123)) {
                 $tempArray = array();
                 $tempArray['msgId'] = $data123['id'];
                 $rs1234 = $dbObj->runQuery("SELECT * FROM ras_kunena_messages_text  where mesid = '" . $data123['id'] . "'");
                 $data1234 = mysql_fetch_assoc($rs1234);
                 $tempArray['message'] = $data1234['message'];
                 $tempArray['thread'] = $data123['thread'];
                 $tempArray['parent'] = $data123['parent'];
                 $tempArray['catid'] = $data123['catid'];
                 $tempArray['name'] = $data123['name'];
                 $tempArray['userid'] = $data123['userid'];
                 $tempArray['email'] = $data123['email'];
                 $tempArray['subject'] = $data123['subject'];
                 $tempArray['time'] = ssss(date("Y-m-d H:i:s", $data123['time']));
                 $FullfinalArray[] = $tempArray;
             }
             $data = array('status' => '1', 'result' => $FullfinalArray);
             echo json_encode($data);
             exit;
         } else {
             $data = array('status' => '0', 'result' => '');
             echo json_encode($data);
             exit;
         }
     }
     //action close
 }
 $sql = "SELECT * FROM ras_kunena_topics  where category_id = '" . $_REQUEST['forumId'] . "'  and hold='0' ORDER BY last_post_time DESC";
 $rs_username = mysql_query($sql);
 if (mysql_num_rows($rs_username) > 0) {
     while ($data = mysql_fetch_assoc($rs_username)) {
         $tempArray = array();
         $tempArray['category_id'] = $data['category_id'];
         $tempArray['topic_id'] = $data['id'];
         $tempArray['subject'] = $data['subject'];
         $tempArray['hits'] = $data['hits'];
         $tempArray['first_post_id'] = $data['first_post_id'];
         $tempArray['first_post_time'] = ssss(date("Y-m-d H:i:s", $data['first_post_time']));
         $tempArray['first_post_userid'] = $data['first_post_userid'];
         $tempArray['first_post_message'] = $data['first_post_message'];
         $tempArray['first_post_guest_name'] = $data['first_post_guest_name'];
         $tempArray['last_post_id'] = $data['last_post_id'];
         $tempArray['last_post_time'] = ssss(date("Y-m-d H:i:s", $data['last_post_time']));
         $tempArray['last_post_userid'] = $data['last_post_userid'];
         $tempArray['last_post_message'] = $data['last_post_message'];
         $tempArray['last_post_guest_name'] = $data['last_post_guest_name'];
         #######################################################################
         $rs_replyCount = mysql_query("SELECT count( * ) as replycount\n\t\t\t\t\t                 FROM ras_kunena_messages WHERE thread ='" . $tempArray['topic_id'] . "' AND\n\t\t\t\t\t\t\t\t\t catid ='" . $tempArray['category_id'] . "'  ");
         $dataReply = mysql_fetch_assoc($rs_replyCount);
         $tempArray['posts'] = $dataReply['replycount'];
         ###########End Here ###################
         $finalArray[] = $tempArray;
     }
     ######### get Current Topic Title#########
     $sql_cate = "SELECT b.name as category_name,b.id,a.id as topic_id FROM ras_kunena_topics as a left join ras_kunena_categories as  b on a.category_id=b.id where a.category_id = '" . $_REQUEST['forumId'] . "'  group by b.id ORDER BY b.id ASC  ";
     $rs_username_cat = mysql_query($sql_cate);
     $data_cat = mysql_fetch_assoc($rs_username_cat);
     $category_name = $data_cat['category_name'];