<?php
//--------------class ForumsTopicsFormHandler--------------->>>//
/**
 * @category	Anova
 * @package		ForumsTopicsFormHandler
 * @author 		shankar_76ag08
 * @copyright	Copyright (c) 2009 {@link http://www.agriya.com Agriya Infoway}
 * @license		http://www.agriya.com Agriya Infoway Licence
 * @version		Release: @package_version@
 * @since 		2008-12-22
 **/
class ForumsTopicsFormHandler extends ForumHandler
	{
		//Variable to store forum details
		public $forum_details_arr;

		/**
		 * set the condition
		 *
		 * @access public
		 * @return void
		 **/
		public function buildConditionQuery($condition='')
			{
				$this->sql_condition = $condition;

			}
		/**
		 * To sort the query
		 *
		 * @access public
		 * @return void
		 **/
		public function checkSortQuery($field, $sort='asc')
			{
				if(!($this->sql_sort))
				{
					$this->sql_sort = $field . ' ' . $sort;
				}
			}

		/**
		 * ViewPhoto::populateRatingImages()
		 *
		 * param $rating
		 * @return
		 **/
		public function populateRatingImages($rating = 0)
			{
				$rating_total = 10;
			}

		/**
		 *
		 * @access public
		 * @return void
		 **/
		public function getUnpublishedResponses($topic_id)
			{
				$sql = 'SELECT count(response_id) as total_unpublished_responses '.
						'FROM '.$this->CFG['db']['tbl']['forum_response'].' '.
						'WHERE topic_id = '.$this->dbObj->Param($topic_id).' '.
						'AND response_status = \'ToActivate\'';

				$stmt = $this->dbObj->Prepare($sql);
				$rs = $this->dbObj->Execute($stmt, array($topic_id));
				if (!$rs)
				        trigger_db_error($this->dbObj);
				$row = $rs->FetchRow();
				return $row;
			}

		/**
		 * To display the forums titles
		 *
		 * @access public
		 * @return void
		 **/
		public function showForumTopics()
			{
				if(!$this->isResultsFound())
					{
						return ;
					}
				$showForumTopics_arr = array();
				$inc=1;

				while($row = $this->fetchResultRecord())
					{
						$topicUserDetails['user_id'] 			= $row['topic_user_id'];
						if(isset($row['topic_display_name']) && $row['topic_display_name'])
							$topicUserDetails['display_name'] 		= $row['topic_display_name'];
						else
							$topicUserDetails['display_name'] 	= '';
						$topicUserDetails['name'] 				= $row['topic_user_name'];
						if(isset($row['topic_user_image_path']) && $row['topic_user_image_path'])
							$topicUserDetails['image_path'] 	= $row['topic_user_image_path'];
						else
							$topicUserDetails['image_path'] 	= '';

						$topicUserDetails['gender'] 			= $row['topic_user_gender'];
						$topicUserDetails['img_user_id'] 		= $row['topic_img_user_id'];
						$topicUserDetails['t_width'] 			= $row['topic_t_width'];
						$topicUserDetails['t_height']			= $row['topic_t_height'];
						$topicUserDetails['s_width'] 			= $row['topic_s_width'];
						$topicUserDetails['s_height']			= $row['topic_s_height'];
						$topicUserDetails['photo_server_url']	= $row['topic_photo_server_url'];
						$topicUserDetails['photo_ext']			= $row['topic_photo_ext'];

						$lastPostUserDetails['user_id'] 		= $row['last_user_id'];
						if(isset($row['last_display_name']) && $row['last_display_name'])
							$lastPostUserDetails['display_name'] 	= $row['last_display_name'];
						else
							$lastPostUserDetails['display_name'] 	= '';
						$lastPostUserDetails['name'] 			= $row['last_user_name'];
						if(isset($row['last_user_image_path']) && $row['last_user_image_path'])
							$lastPostUserDetails['image_path'] 		= $row['last_user_image_path'];
						$lastPostUserDetails['gender'] 			= $row['last_user_gender'];
						$lastPostUserDetails['img_user_id'] 	= $row['last_img_user_id'];
						$lastPostUserDetails['t_width'] 		= $row['last_t_width'];
						$lastPostUserDetails['t_height']		= $row['last_t_height'];
						$lastPostUserDetails['s_width'] 		= $row['last_s_width'];
						$lastPostUserDetails['s_height']		= $row['last_s_height'];
						$lastPostUserDetails['photo_server_url']= $row['last_photo_server_url'];
						$lastPostUserDetails['photo_ext']		= $row['last_photo_ext'];

						$showForumTopics_arr[$inc]['record'] = $row;
						$showForumTopics_arr[$inc]['topicUserDetails'] = $topicUserDetails;
						$showForumTopics_arr[$inc]['lastPostUserDetails'] = $lastPostUserDetails;
						$showForumTopics_arr[$inc]['forum_details'] = $this->forumRelatedDetails($row['forum_id']);
						$showForumTopics_arr[$inc]['myanswers_user']['url'] = getMemberUrl($topicUserDetails['user_id'], $topicUserDetails['name']);
                        $showForumTopics_arr[$inc]['myanswers_user']['title'] = stripString($topicUserDetails['display_name'], $this->CFG['username']['short_length']);
						$showForumTopics_arr[$inc]['forum_responses']['url'] = getForumsUrl('forumsresponses', '?title='.$this->forum_details_arr['seo_title'].'&amp;topic_title='.$row['seo_title'].'&amp;task=1', $this->forum_details_arr['seo_title'].'/'.$row['seo_title'].'/?task=1');
                        $showForumTopics_arr[$inc]['forum_responses']['title'] = wordWrapManual($row['forum_topic'], 15, $this->CFG['admin']['forum']['line_length']);

						if ($row['rating_count'] && $row['rating_total'])
							{
								$showForumTopics_arr[$inc]['average_rating'] = round($row['rating_total']/$row['rating_count']);
						    }
						if($row['user_id'] == $this->CFG['user']['user_id'] and ($this->fields_arr['my']))
							{
								$publish_details = $this->getUnpublishedResponses($row['topic_id']);
								$showForumTopics_arr[$inc]['publish_details']['content'] = $this->LANG['forumstopics_unpublished_responses'].'<a href="'.getForumsUrl('forumsresponses', '?title='.$this->forum_details_arr['seo_title'].'&amp;topic_title='.$row['seo_title'].'&amp;task=1&pbl=1', $this->forum_details_arr['seo_title'].'/'.$row['seo_title'].'/?task=1&pbl=1').'">'.$publish_details['total_unpublished_responses'].'</a>';
							}

						$showForumTopics_arr[$inc]['myanswers_last_post_user']['url'] = getMemberUrl($lastPostUserDetails['user_id'], $lastPostUserDetails['name']);
                        $showForumTopics_arr[$inc]['myanswers_last_post_user']['title'] = stripString($lastPostUserDetails['display_name'], $this->CFG['username']['short_length']);
						$inc++;
					}
				return $showForumTopics_arr;
			}

		/**
		 * ForumsTopicsFormHandler::publishTopic()
		 *
		 * @return
		 */
		public function publishTopic()
	    	{
				$update_sql = 'UPDATE '.$this->CFG['db']['tbl']['forums'].
						' SET last_post_user_id = '.$this->dbObj->Param('user_id').
						', last_post_date = now()'.
						', total_topics = total_topics + 1'.
						', total_response = total_response + 1'.
						' WHERE forum_id = '.$this->dbObj->Param('forum_id');

				$update_stmt = $this->dbObj->Prepare($update_sql);
				$update_rs = $this->dbObj->Execute($update_stmt, array($this->fields_arr['topic_userid'], $this->fields_arr['forum_id']));
					if (!$update_rs)
				      			trigger_db_error($this->dbObj);

				$sql = 'UPDATE '.$this->CFG['db']['tbl']['forum_topics'].' SET topic_status=\'Yes\' WHERE topic_id='.$this->dbObj->Param('aid');
				$stmt = $this->dbObj->Prepare($sql);
				$rs = $this->dbObj->Execute($stmt, array($this->fields_arr['topic_id']));
				if (!$rs)
					    trigger_db_error($this->dbObj);

				if ($this->dbObj->Affected_Rows())
					{
						// To increase the total answer count for that answerer
						$usr_sql = 'SELECT a.forum_topic, a.user_id, a.seo_title, '.$this->getUserTableFields(array('email', 'display_name'), false).
								' a.topic_status FROM '.$this->CFG['db']['tbl']['forum_topics'].' AS a, '.$this->CFG['db']['tbl']['users'].' AS u'.
								' WHERE a.user_id=u.'.$this->getUserTableField('user_id').
								' AND u.'.$this->getUserTableField('usr_status').'=\'Ok\''.
								' AND a.forum_id='.$this->dbObj->Param('forum_id').
								' AND a.topic_id='.$this->dbObj->Param('topic_id').
								' ORDER BY a.topic_id DESC';

						//die($usr_sql);
						$usr_stmt = $this->dbObj->Prepare($usr_sql);
						$usr_rs = $this->dbObj->Execute($usr_stmt, array($this->fields_arr['forum_id'], $this->fields_arr['topic_id']));
						if (!$usr_rs)
						        trigger_db_error($this->dbObj);

						$row = $usr_rs->FetchRow();
				        	// To send email alert for published users..
						$this->sendPublishedMailAlert($row['email'], $row['display_name'], $row['forum_topic'], $row['seo_title']);

					}
	    	}

		/**
		 * ForumsTopicsFormHandler::sendPublishedMailAlert()
		 *
		 * @param mixed $toEmail
		 * @param mixed $reciever_name
		 * @param mixed $content
		 * @param mixed $content_seo
		 * @return
		 */
		public function sendPublishedMailAlert($toEmail, $reciever_name, $content, $content_seo)
			{
				$site_link = "<a target=\"_blank\" href=\"".URL($this->CFG['site']['url'])."\">".URL($this->CFG['site']['url'])."</a>";
				$url_link = getForumsUrl('forumsresponses', '?title='.$this->forum_details_arr['seo_title'].'&amp;topic_title='.$content_seo, $this->forum_details_arr['seo_title'].'/'.$content_seo.'/', 'root');
				$topic_link = "<a target=\"_blank\" href=\"".$url_link."\"><strong>".$content."</strong></a>";
				$subject = $this->getMailContent($this->LANG['forum_topic_publish_subject'], array('VAR_USERNAME'=>$reciever_name, 'VAR_SITENAME'=>$this->CFG['site']['name'], 'VAR_FORUM'=>$topic_link, 'VAR_LINK'=>$site_link));
				$content = $this->getMailContent($this->LANG['forum_topic_publish_message'], array('VAR_USERNAME'=>$reciever_name, 'VAR_SITENAME'=>$this->CFG['site']['name'], 'VAR_FORUM'=>$topic_link, 'VAR_LINK'=>$site_link));

				$this->_sendMail($toEmail,
								$subject,
								$content,
								$this->CFG['site']['noreply_name'],
								$this->CFG['site']['noreply_email']);
			}

		/**
		 * ForumsTopicsFormHandler::_sendMail()
		 *
		 * @param mixed $to_email
		 * @param mixed $subject
		 * @param mixed $body
		 * @param mixed $sender_name
		 * @param mixed $sender_email
		 * @return
		 */
		private function _sendMail($to_email, $subject, $body, $sender_name, $sender_email)
			{
				$this->buildEmailTemplate($subject, $body, false, true);

				$EasySwift = new EasySwift($this->getSwiftConnection());
				$EasySwift->flush();
				$EasySwift->addPart($this->getEmailContent(), "text/html");
				$from_address = $sender_name.'<'.$sender_email.'>';
				return $EasySwift->send($to_email, $from_address, $this->getEmailSubject());

			}
	}
//<<<<<<<--------------class ForumsTopicsFormHandler---------------//

//--------------------Code begins-------------->>>>>//
$forumstopics = new ForumsTopicsFormHandler();
if(!chkIsAllowedModule(array('forums')))
	Redirect2URL(getUrl($CFG['redirect']['dsabled_module_url']['file_name']));
$forumstopics->setPageBlockNames(array('form_advanced_search', 'form_forum_title', 'form_show_topics', 'form_confirm'));

$forumstopics->setAllPageBlocksHide();
//default form fields and values...
$forumstopics->setFormField('forum_id', '');
$forumstopics->setFormField('title', '');
$forumstopics->setFormField('search_forum_topic', '');
$forumstopics->setFormField('uname', '');
$forumstopics->setFormField('forum_topic', '');
$forumstopics->setFormField('date_added_from', '');
$forumstopics->setFormField('date_added_from_day', '');
$forumstopics->setFormField('date_added_from_month', '');
$forumstopics->setFormField('date_added_from_year', '');
$forumstopics->setFormField('date_added_to', '');
$forumstopics->setFormField('date_added_to_day', '');
$forumstopics->setFormField('date_added_to_month', '');
$forumstopics->setFormField('date_added_to_year', '');
$forumstopics->setFormField('adv_search', '');
$forumstopics->setFormField('so', 'min');
$forumstopics->setFormField('topic_userid', '');
$forumstopics->setFormField('topic_id', '');
$forumstopics->setFormField('msg', '');
$forumstopics->setFormField('my', '');
$forumstopics->setFormField('pbl', '');

$forumstopics->setFormField('numpg',0);
$forumstopics->setFormField('start',0);
/***********set form field for navigation****/
$forumstopics->setFormField('asc', 'ft.forum_topic');
$forumstopics->setFormField('dsc', '');
/*************Start navigation******/
//fetch number of records show in the result--numpg
$condition = $my_condition = '';
$forumstopics->alter_link = $forumstopics->mytext = '';
$forumstopics->numpg = $CFG['data_tbl']['numpg'];
$forumstopics->setFormField('start', 0);
$forumstopics->setFormField('numpg', $CFG['data_tbl']['numpg']);
//$forumstopics->setFormField('numpg', 2);

$forumstopics->setMinRecordSelectLimit($CFG['data_tbl']['min_record_select_limit']);
$forumstopics->setMaxRecordSelectLimit($CFG['data_tbl']['max_record_select_limit']);
$forumstopics->setNumPerPageListArr($CFG['data_tbl']['numperpage_list_arr']);
//Set tables and fields to return
$forumstopics->setTableNames(array());
$forumstopics->setReturnColumns(array());

$forumstopics->sanitizeFormInputs($_REQUEST);

$forumstopics->LANG['page_title'] = $LANG['forumlistall_title_index'];
if(isMember())
	{
		$forumstopics->alter_link = '<a href="'.getForumsUrl('forumstopics', '?title='.$forumstopics->getFormField('title').'&amp;my=1', $forumstopics->getFormField('title').'/?my=1', 'members').'">'.$LANG['forumstopics_mytopics'].'</a>';
	}

/*************End navigation******/
if ($forumstopics->isFormGETed($_GET, 'title'))
	{
		$forumstopics->chkIsNotEmpty('title', $LANG['err_tip_compulsory']) and
			$forumstopics->isValidForumId($forumstopics->getFormField('title'), $LANG['forums_err_tip_invalid_forum_id']);

		if($CFG['html']['meta']['appendable'])
			{
				$forumstopics->appendMetaDetails(html_entity_decode($forumstopics->forum_details_arr['forum_title']), '');
			}
	}
else
	{
		//now redirect to forums main page...
		Redirect2URL(getForumsUrl('forums'));
	}
$forumstopics->setPageBlockShow('form_show_topics');
$forumstopics->displaytabs['allTopicsLI'] = $forumstopics->displaytabs['myTopicsLI'] = '';
$clsLeftActiveQuestionsLink = 'clsLeftActiveQuestionsLink';
$forumstopics->mytopics_link = getForumsUrl('forumstopics', '?title='.$forumstopics->getFormField('title').'&amp;my=1', $forumstopics->getFormField('title').'/?my=1', 'members');
$forumstopics->alltopics_link = getForumsUrl('forumstopics', '?title='.$forumstopics->getFormField('title'), $forumstopics->getFormField('title').'/');
if ($forumstopics->isValidFormInputs())
	{
		if ($forumstopics->isFormPOSTed($_GET, 'my') and !isMember())
			{
				$_SESSION['url'] = getForumsUrl('forumstopics', '?title='.$forumstopics->getFormField('title').'&my=1', $forumstopics->getFormField('title').'/?my=1', 'members');
				$_SESSION['login_error'] = 'login_err_authorization_required';
				Redirect2URL(getUrl('login'));
			}
		elseif ($forumstopics->isFormPOSTed($_GET, 'my') and isMember())
			{
				$my_condition .= ' AND ft.user_id ='.$CFG['user']['user_id'];
				$forumstopics->LANG['page_title'] = $LANG['forumstopics_mytopics'];
				$forumstopics->mytext = ' - '.$LANG['forumstopics_mytopics'];
				$forumstopics->alter_link = '<a href="'.getForumsUrl('forumstopics', '?title='.$forumstopics->getFormField('title'), $forumstopics->getFormField('title').'/', 'members').'">'.$LANG['forumstopics_alltopics'].'</a>';
				$forumstopics->displaytabs['myTopicsLI'] = $clsLeftActiveQuestionsLink;
			}
		else
			{
				$forumstopics->displaytabs['allTopicsLI'] = 'clsFirstQuestionLink '.$clsLeftActiveQuestionsLink;
			}

		if ($forumstopics->isFormPOSTed($_GET, 'pbl') and isMember())
			{
				$forumstopics->LANG['page_title'] = $LANG['forumstopics_unpublishedtopics'];
				$forumstopics->mytext = ' - '.$LANG['forumstopics_unpublishedtopics'];
				$forumstopics->alter_link = '<a href="'.getForumsUrl('forumstopics', '?title='.$forumstopics->getFormField('title'), $forumstopics->getFormField('title').'/').'">'.$LANG['forumstopics_alltopics'].'</a>';
			}

		$forumstopics->LANG['page_title'] .= ' - '.$forumstopics->forum_details_arr['forum_title'];
		if ($forumstopics->isFormPOSTed($_POST, 'confirm'))
			{
				$forumstopics->publishTopic();
				$forumstopics->setFormField('topic_id', '');
			}
$return_fields = array('ft.forum_id', 'ft.topic_id', 'ft.forum_topic', 'ft.seo_title', 'ft.user_id', 'ft.total_response', 'ft.total_views', 'ft.last_post_user_id', 'ft.last_post_date', 'ft.rating_total', 'ft.rating_count', 'ft.topic_status', 'DATE_FORMAT(ft.date_added, \''.$CFG['format']['date'].'\') AS date_add');
if($forumstopics->getUserTableField('user_id'))
	{
		$return_fields[] = 'u.'.$forumstopics->getUserTableField('user_id').' AS topic_user_id';
		$return_fields[] = 'u.'.$forumstopics->getUserTableField('user_id').' AS topic_img_user_id';
		$return_fields[] = 'u1.'.$forumstopics->getUserTableField('user_id').' AS last_user_id';
		$return_fields[] = 'u1.'.$forumstopics->getUserTableField('user_id').' AS last_img_user_id';
	}
if($forumstopics->getUserTableField('display_name'))
	{
		$return_fields[] = 'u.'.$forumstopics->getUserTableField('display_name').' AS topic_display_name';
		$return_fields[] = 'u1.'.$forumstopics->getUserTableField('display_name').' AS last_display_name';
	}
if($forumstopics->getUserTableField('name'))
	{
		$return_fields[] = 'u.'.$forumstopics->getUserTableField('name').' AS topic_user_name';
		$return_fields[] = 'u1.'.$forumstopics->getUserTableField('name').' AS last_user_name';
	}
if($forumstopics->getUserTableField('image_path'))
	{
		$return_fields[] = 'u.'.$forumstopics->getUserTableField('image_path').' AS topic_user_image_path';
		$return_fields[] = 'u1.'.$forumstopics->getUserTableField('image_path').' AS last_user_image_path';
	}
if($forumstopics->getUserTableField('gender'))
	{
		$return_fields[] = 'u.'.$forumstopics->getUserTableField('gender').' AS topic_user_gender';
		$return_fields[] = 'u1.'.$forumstopics->getUserTableField('gender').' AS last_user_gender';
	}
if($forumstopics->getUserTableField('t_height'))
	{
		$return_fields[] = 'u.'.$forumstopics->getUserTableField('t_height').' AS topic_t_height';
		$return_fields[] = 'u1.'.$forumstopics->getUserTableField('t_height').' AS last_t_height';
	}
if($forumstopics->getUserTableField('t_width'))
	{
		$return_fields[] = 'u.'.$forumstopics->getUserTableField('t_width').' AS topic_t_width';
		$return_fields[] = 'u1.'.$forumstopics->getUserTableField('t_width').' AS last_t_width';
	}
if($forumstopics->getUserTableField('s_height'))
	{
		$return_fields[] = 'u.'.$forumstopics->getUserTableField('s_height').' AS topic_s_height';
		$return_fields[] = 'u1.'.$forumstopics->getUserTableField('s_height').' AS last_s_height';
	}
if($forumstopics->getUserTableField('s_width'))
	{
		$return_fields[] = 'u.'.$forumstopics->getUserTableField('s_width').' AS topic_s_width';
		$return_fields[] = 'u1.'.$forumstopics->getUserTableField('s_width').' AS last_s_width';
	}
if($forumstopics->getUserTableField('photo_server_url'))
	{
		$return_fields[] = 'u.'.$forumstopics->getUserTableField('photo_server_url').' AS topic_photo_server_url';
		$return_fields[] = 'u1.'.$forumstopics->getUserTableField('photo_server_url').' AS last_photo_server_url';
	}
if($forumstopics->getUserTableField('photo_ext'))
	{
		$return_fields[] = 'u.'.$forumstopics->getUserTableField('photo_ext').' AS topic_photo_ext';
		$return_fields[] = 'u1.'.$forumstopics->getUserTableField('photo_ext').' AS last_photo_ext';
	}
		if ($forumstopics->isShowPageBlock('form_show_topics'))
			{
				/*************Start navigation******/
				//Set tables and fields to return
				$forumstopics->setTableNames(array($CFG['db']['tbl']['forum_topics'].' as ft LEFT JOIN '.$CFG['db']['tbl']['users'].' AS u1 ON ft.last_post_user_id = u1.'.$forumstopics->getUserTableField('user_id'), $CFG['db']['tbl']['users'].' as u'));
				$forumstopics->setReturnColumns($return_fields);
				//Condition of the query
				$condition = 'ft.user_id = u.'.$forumstopics->getUserTableField('user_id').' AND u.'.$forumstopics->getUserTableField('usr_status').' = \'Ok\' AND ft.forum_id = \''.$forumstopics->getFormField('forum_id').'\'';
				if($forumstopics->getFormField('forum_userid') == $CFG['user']['user_id'])
					{
						if($forumstopics->getFormField('pbl'))
							$condition .= ' AND topic_status = \'ToActivate\'';
						else
							$condition .= ' AND topic_status != \'No\'';
					}
				else
					{
						$condition .= ' AND topic_status = \'Yes\'';
					}

				if ($CFG['admin']['ignore_user'])
					{
						$condition .= ' AND NOT EXISTS (SELECT 1 FROM '.$CFG['db']['tbl']['user_ignored'].' AS ui WHERE ui.user_id='.$CFG['user']['user_id'].' AND ui.ignored_id=ft.user_id)';
					}
				$condition .= $my_condition;

				$forumstopics->buildSelectQuery();
				$forumstopics->buildConditionQuery($condition);
				$forumstopics->buildSortQuery();
				$forumstopics->checkSortQuery('ft.forum_topic', $CFG['admin']['forums']['order']);
				$forumstopics->buildQuery();
				$forumstopics->executeQuery();

				/*************End navigation******/
				$forumstopics->form_show_topics_arr = $forumstopics->showForumTopics();
				$forumstopics->setPageBlockShow('form_forum_title');
				$paging_arr = array();
				if ($forumstopics->isResultsFound())
					{
						$smartyObj->assign('smarty_paging_list', $forumstopics->populatePageLinksGET($forumstopics->getFormField('start'),  array('title')));
					}
				}
		}
	else
		{
			$forumstopics->setPageBlockShow('block_msg_form_error');
			//now redirect to forums main page...
			Redirect2URL(getForumsUrl('forums'));
		}

if ($forumstopics->isFormPOSTed($_GET, 'msg'))
	{
		if($forumstopics->getFormField('msg') == 'approve')
			$forumstopics->setCommonSuccessMsg($LANG['forums_topic_waiting_for_publish']);
		else
			$forumstopics->setCommonSuccessMsg($LANG['forums_topic_created_successfully']);

		$forumstopics->setPageBlockShow('block_msg_form_success');
	}

//$forumstopics->LANG['page_title'] = nl2br(substr(wordWrapManual($LANG['forumlistall_title_index'].' - '.$forumstopics->forum_details_arr['forum_title'], 15),14));
$forumstopics->LANG['page_title'] = $forumstopics->forum_details_arr['forum_title'];
$forumstopics->forumstopiccreate_url = getForumsUrl('forumstopiccreate', '?title='.$forumstopics->forum_details_arr['seo_title'], $forumstopics->forum_details_arr['seo_title'].'/', 'members');
$forumstopics->login_url = getUrl('login', '?light_url='.$forumstopics->forumstopiccreate_url, '?light_url='.$forumstopics->forumstopiccreate_url, 'root');
$forumstopics->login_mytopics_url = getUrl('login', '?light_url='.$forumstopics->mytopics_link, '?light_url='.$forumstopics->mytopics_link, 'root');
$forumstopics->confirmForm_hidden_arr = array('start', 'forum_id');

//<<<<--------------------Code Ends----------------------//
$CFG['site']['title'] = $LANG['page_title'].' - '.$CFG['site']['title'];
//--------------------Page block templates begins-------------------->>>>>//
//include the header file
$forumstopics->includeHeader();
//include the content of the page
setTemplateFolder('general/', $CFG['admin']['index']['forum_module']);
$smartyObj->display('forumsTopics.tpl');
//include the footer of the page
//<<<<<<--------------------Page block templates Ends--------------------//
?>
<script language="javascript" type="text/javascript">
	var block_arr= new Array('selMsgConfirm');
</script>
<?php
$forumstopics->includeFooter();
?>
