<?php 







class ControllerForums extends Controller {







	function index() {  







		$config   =& $this->locator->get('config');







		$currency =& $this->locator->get('currency');







		$database =& $this->locator->get('database');







		$language =& $this->locator->get('language');







		$image    =& $this->locator->get('image');







		$module   =& $this->locator->get('module');







		$request  =& $this->locator->get('request');







		$response =& $this->locator->get('response');







		$session  =& $this->locator->get('session');







		$tax      =& $this->locator->get('tax');







		$template =& $this->locator->get('template');







		$url      =& $this->locator->get('url');	    







  		$view = $this->locator->create('template');  







  		$template->set('title', 'beststoreitems Forums');







  		$view->set('heading_title', '');     		







        $forums_cate_list=$database->getRows("select fc.forums_category_id,fc.parent_id,fcv.cate_name from forums_category fc left join forums_category_value fcv on fc.forums_category_id=fcv.forums_category_id where fc.parent_id=0 order by fcv.sort asc");







	    if(is_array($forums_cate_list)){







	    	foreach($forums_cate_list as $k=>$v){







	    		$forums_cate_list[$k]['child']=$database->getRows("select fc.forums_category_id,fc.parent_id,fcv.cate_name from forums_category  fc left join forums_category_value fcv on fc.forums_category_id=fcv.forums_category_id where fc.parent_id='".$v['forums_category_id']."' order by fcv.sort asc");







	    	}







	    }







	    







	    $topic_list = $database->getRows($database->splitQuery("select forums_topics_id,product_id,forums_category_id,subject,views,reply_times,customer_id,date_added from `forums_topics` order by forums_topics_id desc", ($request->has('path') ? $session->get('forums.' . $request->get('path') . '.page') : $session->get('forums.page')),30));







     







	    $topic_data=array();







        foreach ($topic_list as $tl){







        	$forums_cate_info=$database->getRow("select cate_name from forums_category_value where forums_category_id='".$tl['forums_category_id']."'");







        	$customer_info=$database->getRow("select firstname,lastname,nickname from customer where customer_id='".$tl['customer_id']."'");







        	$forums_topics_reply=$database->getRow("select relier_customer_id,date_added from forums_topics_reply where forums_topics_id='".$tl['forums_topics_id']."' order by forums_topics_reply_id desc");







        	if($forums_topics_reply){







        		$reply_customer_info=$database->getRow("select firstname,lastname,nickname from customer where customer_id='".$forums_topics_reply['relier_customer_id']."'");







        	    $reply_author=!empty($reply_customer_info['nickname'])?$reply_customer_info['nickname']:$reply_customer_info['firstname'].' '.$reply_customer_info['lastname'];







        	}else{







        		$reply_author=!empty($customer_info['nickname'])?$customer_info['nickname']:$customer_info['firstname'].' '.$customer_info['lastname'];







        	}







        	$image_info=array();







        	if($tl['product_id']>0){        		







        		$product_info=$database->getRow("select product_id,image_id from product where product_id='".$tl['product_id']."'");







        		$image_info=$database->getRow("select filename from image where image_id='".$product_info['image_id']."'");   







        		   	







        	}







        	$topic_data[]=array(







        	   'forums_topics_id'=>$tl['forums_topics_id'],







        	   'forums_category_id'=>$tl['forums_category_id'],







        	   'subject'=>$tl['subject'],







        	   'views'=>$tl['views'],







        	   'reply_times'=>$tl['reply_times'],







        	   'date_added'=>date('m/d/Y',strtotime($tl['date_added'])),







        	   'cate_name'=>$forums_cate_info['cate_name'],







        	   'author'=>!empty($customer_info['nickname'])?$customer_info['nickname']:$customer_info['firstname'].' '.$customer_info['lastname'],







        	   'last_relier'=>$reply_author,







        	   'last_date'=>!empty($forums_topics_reply)?date('m/d/Y',strtotime($forums_topics_reply['date_added'])):date('m/d/Y',strtotime($tl['date_added'])),







        	   'thumb' => !empty($image_info)?$image->resize($image_info['filename'], 64, 64):0,







        	);







        }  







     







        if(($request->has('path') ? $session->get('forums.' . $request->get('path') . '.page') : $session->get('forums.page'))==null)







		{    







			$page = 1;







		}else{







			$page = ($request->has('path') ? $session->get('forums.' . $request->get('path') . '.page') : $session->get('forums.page'));







		}







		$view->set('text_results', "<dt><b>".$database->getTotal()."</b> Records</dt>");







  		$view->set('entry_page', $language->get('entry_page'));      			







		$view->set('action', $url->href('forums', 'pagelist', array('path' => $request->get('path'))));







		$view->set('page', ($request->has('path') ? $session->get('forums.' . $request->get('path') . '.page') : $session->get('forums.page')));							







		$page_data = array();







		for ($i = 1; $i <= $database->getPages(); $i++) {







			$page_data[] = array(







  				'text'  => $language->get('text_pages', $i, $database->getPages()),







  				'value' => $i







			);







		}







		$view->set('pages', $page_data);	







		$view->set('path', $request->get('path'));	        







	    $view->set('forums_cate_list',$forums_cate_list);







	    $view->set('topic_data',$topic_data);







  		$template->set('content', $view->fetch('content/forums.tpl'));







  







  		$template->set($module->fetchPublic());















  		$response->set($template->fetch('layout.tpl'));   







    	







  	}







	function topic_category(){







		$config   =& $this->locator->get('config');







		$currency =& $this->locator->get('currency');







		$database =& $this->locator->get('database');







		$language =& $this->locator->get('language');







		$image    =& $this->locator->get('image');







		$module   =& $this->locator->get('module');







		$request  =& $this->locator->get('request');







		$response =& $this->locator->get('response');







		$session  =& $this->locator->get('session');







		$tax      =& $this->locator->get('tax');







		$template =& $this->locator->get('template');







		$url      =& $this->locator->get('url');	  







		$customer =& $this->locator->get('customer');       







  		$view = $this->locator->create('template');  







  		$template->set('title', '');







  		$view->set('heading_title', '');   







	  	$view->set('customer_id',!$customer->isLogged()?0:1);   







	  	if($request->isPost()){







	  		$from=$request->get('from','post');







	  		$sql="insert into forums_topics set forums_category_id = '?', subject = '?', content = '?', customer_id = '?',product_id='?',date_added=now()";   







	  		$database->query($database->parse($sql,$request->get('forums_category_id','post'),$request->get('subject','post'),$request->get('content','post'),$customer->getId(),$request->get('product_id','post')));







	  	    echo '<script>alert("Submit sucessfully");window.location="'.$from.'";</script>';







	  	} 







	  	$currently_forums_cate_info=$database->getRow("select cate_name from forums_category_value where forums_category_id='".$request->get('fcid', 'get')."'");	  







        $forums_cate_list=$database->getRows("select fc.forums_category_id,fc.parent_id,fcv.cate_name from forums_category fc left join forums_category_value fcv on fc.forums_category_id=fcv.forums_category_id where fc.parent_id=0 order by fcv.sort asc");







	    if(is_array($forums_cate_list)){







	    	foreach($forums_cate_list as $k=>$v){







	    		$forums_cate_list[$k]['child']=$database->getRows("select fc.forums_category_id,fc.parent_id,fcv.cate_name from forums_category  fc left join forums_category_value fcv on fc.forums_category_id=fcv.forums_category_id where fc.parent_id='".$v['forums_category_id']."' order by fcv.sort asc");







	    	}







	    }







	    $product_info_data=array();







	    if($request->get('product_id')){







        	$product_id=$request->get('product_id');







        	$product_info=$database->getRow("select product_id,image_id,price,sku,tax_class_id from product where product_id='".$product_id."'");







    		$product_desc_info=$database->getRow("select name from product_description where product_id='".$product_info['product_id']."'");







    		$image_info=$database->getRow("select filename from image where image_id='".$product_info['image_id']."'");    		   	







    	    $product_info_data= array(







	           'product_id'=>$product_info['product_id'],







	           'name'=>$product_desc_info['name'],







	           'product_id'=>$product_info['product_id'],







	           'price'=>$currency->format($tax->calculate($product_info['price'], $product_info['tax_class_id'])),







	           'thumb'=>!empty($image_info)?$image->resize($image_info['filename'], 100, 100):0,







            );







        	$topic_list = $database->getRows($database->splitQuery("select forums_topics_id,product_id,forums_category_id,subject,views,reply_times,customer_id,date_added from `forums_topics` where forums_category_id='".$request->get('fcid','get')."' and product_id='".$request->get('product_id','get')."' order by forums_topics_id desc", ($request->has('path') ? $session->get('topic_category.' . $request->get('path') . '.page') : $session->get('topic_category.page')),20));







        }else{







        	$product_id=0;







        	$topic_list = $database->getRows($database->splitQuery("select forums_topics_id,product_id,forums_category_id,subject,views,reply_times,customer_id,date_added from `forums_topics` where forums_category_id='".$request->get('fcid','get')."' order by forums_topics_id desc", ($request->has('path') ? $session->get('topic_category.' . $request->get('path') . '.page') : $session->get('topic_category.page')),20));







        }







        $topic_data=array();







        foreach ($topic_list as $tl){







        	$forums_cate_info=$database->getRow("select cate_name from forums_category_value where forums_category_id='".$tl['forums_category_id']."'");







        	$customer_info=$database->getRow("select firstname,lastname,nickname from customer where customer_id='".$tl['customer_id']."'");







        	$forums_topics_reply=$database->getRow("select relier_customer_id,date_added from forums_topics_reply where forums_topics_id='".$tl['forums_topics_id']."' order by forums_topics_reply_id desc");







        	if($forums_topics_reply){







        		$reply_customer_info=$database->getRow("select firstname,lastname,nickname from customer where customer_id='".$forums_topics_reply['relier_customer_id']."'");







        	    $reply_author=!empty($reply_customer_info['nickname'])?$reply_customer_info['nickname']:$reply_customer_info['firstname'].' '.$reply_customer_info['lastname'];







        	}else{







        		$reply_author=!empty($customer_info['nickname'])?$customer_info['nickname']:$customer_info['firstname'].' '.$customer_info['lastname'];







        	}







        	$image_info=array();







        	if($tl['product_id']>0){        		







        		$product_info=$database->getRow("select product_id,image_id from product where product_id='".$tl['product_id']."'");







        		$image_info=$database->getRow("select filename from image where image_id='".$product_info['image_id']."'");        		   	







        	}







        	$topic_data[]=array(







        	   'forums_topics_id'=>$tl['forums_topics_id'],







        	   'forums_category_id'=>$tl['forums_category_id'],







        	   'subject'=>$tl['subject'],







        	   'views'=>$tl['views'],







        	   'reply_times'=>$tl['reply_times'],







        	   'date_added'=>date('m/d/Y',strtotime($tl['date_added'])),







        	   'cate_name'=>$forums_cate_info['cate_name'],







        	   'author'=>!empty($customer_info['nickname'])?$customer_info['nickname']:$customer_info['firstname'].' '.$customer_info['lastname'],







        	   'last_relier'=>$reply_author,







        	   'last_date'=>!empty($forums_topics_reply)?date('m/d/Y',strtotime($forums_topics_reply['date_added'])):date('m/d/Y',strtotime($tl['date_added'])),







        	   'thumb' => !empty($image_info)?$image->resize($image_info['filename'], 64, 64):0,







        	);







        }  







        







        if(($request->has('path') ? $session->get('topic_category.' . $request->get('path') . '.page') : $session->get('topic_category.page'))==null)







		{    







			$page = 1;







		}else{







			$page = ($request->has('path') ? $session->get('topic_category.' . $request->get('path') . '.page') : $session->get('topic_category.page'));







		}







	







	







		$view->set('text_results', "<dt><b>".$database->getTotal()."</b> Topics</dt>");







  		$view->set('entry_page', $language->get('entry_page'));      			







		$view->set('action', $url->href('forums', 'page', array('topic_category' => $request->get('topic_category'),'fcid' => $request->get('fcid'))));







		$view->set('page', ($request->has('path') ? $session->get('topic_category.' . $request->get('path') . '.page') : $session->get('topic_category.page')));							







		$page_data = array();







		for ($i = 1; $i <= $database->getPages(); $i++) {







			$page_data[] = array(







  				'text'  => $language->get('text_pages', $i, $database->getPages()),







  				'value' => $i







			);







		}







        if($request->get('product_id')){







        	$product_id=$request->get('product_id');







        }else{







        	$product_id=0;







        }







	







		$view->set('pages', $page_data);	







		$view->set('path', $request->get('path'));		







		$view->set('product_info_data',$product_info_data);







		$view->set('product_id',$product_id);







	    $view->set('forums_cate_list',$forums_cate_list);







	    $view->set('topic_data',$topic_data);







	    $view->set('currently_forums_cate_info',$currently_forums_cate_info);







	    $view->set('forums_cate_id',$request->get('fcid', 'get'));







	    $view->set('from','index.php?'.$_SERVER["QUERY_STRING"]);







  		$template->set('content', $view->fetch('content/topic_category.tpl'));







  







  		$template->set($module->fetchPublic());















  		$response->set($template->fetch('layout.tpl'));  







	}







	function topic_threadid(){







		$config   =& $this->locator->get('config');







		$currency =& $this->locator->get('currency');







		$database =& $this->locator->get('database');







		$language =& $this->locator->get('language');







		$image    =& $this->locator->get('image');







		$module   =& $this->locator->get('module');







		$request  =& $this->locator->get('request');







		$response =& $this->locator->get('response');







		$session  =& $this->locator->get('session');







		$tax      =& $this->locator->get('tax');







		$template =& $this->locator->get('template');







		$url      =& $this->locator->get('url');	







		$customer =& $this->locator->get('customer');     







  		$view = $this->locator->create('template');  







  		if($request->isPost()){







	  		$sql="insert into forums_topics_reply set forums_topics_id = '?', content = '?', relier_customer_id= '?',date_added=now()";   







	  		$database->query($database->parse($sql,$request->get('forums_topics_id','post'),$request->get('content','post'),$customer->getId()));







	  		 $database->query("update forums_topics set reply_times=reply_times+1 where forums_topics_id='".$request->get('forums_topics_id','post')."'");







	  	    echo '<script>alert("Submit sucessfully");window.location="https://www.beststoreitems.com/index.php?controller=forums&action=topic_threadid&ftid='.$request->get('forums_topics_id','post').'";</script>';







	  	} 







	  	$forums_cate_list=$database->getRows("select fc.forums_category_id,fc.parent_id,fcv.cate_name from forums_category fc left join forums_category_value fcv on fc.forums_category_id=fcv.forums_category_id where fc.parent_id=0 order by fcv.sort asc");







	    if(is_array($forums_cate_list)){







	    	foreach($forums_cate_list as $k=>$v){







	    		$forums_cate_list[$k]['child']=$database->getRows("select fc.forums_category_id,fc.parent_id,fcv.cate_name from forums_category  fc left join forums_category_value fcv on fc.forums_category_id=fcv.forums_category_id where fc.parent_id='".$v['forums_category_id']."' order by fcv.sort asc");







	    	}







	    }







  		$topic_detail=$database->getRow("select forums_topics_id,product_id,forums_category_id,customer_id,subject,content,date_added from forums_topics where forums_topics_id='".$request->get('ftid','get')."'");







  		if($topic_detail){







  			$customer_info=$database->getRow("select firstname,lastname,nickname from customer where customer_id='".$topic_detail['customer_id']."'");







  		    $topic_detail['author']=!empty($customer_info['nickname'])?$customer_info['nickname']:$customer_info['firstname'].' '.$customer_info['lastname'];







  		}







  		   //product info start







    	$image_info=array();







    	if($topic_detail['product_id']>0){        		







    		$product_info=$database->getRow("select product_id,image_id,price,sku,tax_class_id from product where product_id='".$topic_detail['product_id']."'");







    		$product_desc_info=$database->getRow("select name from product_description where product_id='".$product_info['product_id']."'");







    		$image_info=$database->getRow("select filename from image where image_id='".$product_info['image_id']."'");    		   	







    	    $topic_detail['product_info'] = array(







	           'product_id'=>$product_info['product_id'],







	           'name'=>$product_desc_info['name'],







	           'product_id'=>$product_info['product_id'],







	           'price'=>$currency->format($tax->calculate($product_info['price'], $product_info['tax_class_id'])),







	           'thumb'=>!empty($image_info)?$image->resize($image_info['filename'], 100, 100):0,







            );







    	}







        //product info end







        $topic_detail['posts']=$database->countRows("select forums_topics_reply_id from forums_topics_reply where forums_topics_id='".$request->get('ftid','get')."'");







    







        $currently_forums_cate_info=$database->getRow("select forums_category_id,cate_name from forums_category_value where forums_category_id='".$topic_detail['forums_category_id']."'");







     







        $database->query("update forums_topics set views=views+1 where forums_topics_id='".$request->get('ftid','get')."'");







        $reply_topic_list = $database->getRows($database->splitQuery("select forums_topics_reply_id,forums_topics_id,content,relier_customer_id,date_added from `forums_topics_reply` where forums_topics_id='".$request->get('ftid','get')."' order by forums_topics_reply_id desc", ($request->has('path') ? $session->get('topic_threadid.' . $request->get('path') . '.page') : $session->get('topic_threadid.page')),20));







        $reply_topic_data=array();







        foreach ($reply_topic_list as $rtl){        	







        	$customer_info=$database->getRow("select firstname,lastname,nickname from customer where customer_id='".$rtl['relier_customer_id']."'");      







        	$reply_author=!empty($customer_info['nickname'])?$customer_info['nickname']:$customer_info['firstname'].' '.$customer_info['lastname'];        	







        	$reply_topic_data[]=array(







        	   'forums_topics_reply_id'=>$rtl['forums_topics_reply_id'],







        	   'forums_topics_id'=>$rtl['forums_topics_id'],







        	   'content'=>$rtl['content'],







        	   'date_added'=>$rtl['date_added'],        	   







        	   'author'=>!empty($customer_info['nickname'])?$customer_info['nickname']:$customer_info['firstname'].' '.$customer_info['lastname'],        	   







        	);







        }







        if(($request->has('path') ? $session->get('topic_threadid.' . $request->get('path') . '.page') : $session->get('topic_threadid.page'))==null)







		{    







			$page = 1;







		}else{







			$page = ($request->has('path') ? $session->get('topic_threadid.' . $request->get('path') . '.page') : $session->get('topic_threadid.page'));







		}







	







	







		$view->set('text_results', "<dt><b style='color:#F38514;'>".$database->getTotal()."</b> Topics</dt>");







  		$view->set('entry_page', $language->get('entry_page'));      			







		$view->set('action', $url->href('forums', 'pagereply', array('topic_threadid' => $request->get('topic_threadid'),'ftid' => $request->get('ftid'))));







		$view->set('page', ($request->has('path') ? $session->get('topic_threadid.' . $request->get('path') . '.page') : $session->get('topic_threadid.page')));							







		$page_data = array();







		for ($i = 1; $i <= $database->getPages(); $i++) {







			$page_data[] = array(







  				'text'  => $language->get('text_pages', $i, $database->getPages()),







  				'value' => $i







			);







		}







		$view->set('pages', $page_data);	







		$view->set('path', $request->get('path'));







        







  		$template->set('title', '');







  		$view->set('heading_title', '');     	







  		$view->set('forums_cate_list', $forums_cate_list); 	







        $view->set('topic_detail', $topic_detail);  







        $view->set('reply_topic_data', $reply_topic_data); 







        $view->set('currently_forums_cate_info', $currently_forums_cate_info); 







        $view->set('customer_id',!$customer->isLogged()?0:1);  







  		$template->set('content', $view->fetch('content/topic_threadid.tpl'));







  







  		$template->set($module->fetchPublic());















  		$response->set($template->fetch('layout.tpl'));  







	}







	function topic_search(){







		$config   =& $this->locator->get('config');







		$currency =& $this->locator->get('currency');







		$database =& $this->locator->get('database');







		$language =& $this->locator->get('language');







		$image    =& $this->locator->get('image');







		$module   =& $this->locator->get('module');







		$request  =& $this->locator->get('request');







		$response =& $this->locator->get('response');







		$session  =& $this->locator->get('session');







		$tax      =& $this->locator->get('tax');







		$template =& $this->locator->get('template');







		$url      =& $this->locator->get('url');	    







  		$view = $this->locator->create('template');







  		if ($request->get('keyword')||$request->get('forums_category_id')) {  	







  			$keyword=$request->get('keyword')!='Search Post...'?trim($request->get('keyword')):null;







  			$forums_category_id=$request->get('forums_category_id');  







  			$condition='';		







  			if($forums_category_id>0){







  				$condition.=" where forums_category_id='".$forums_category_id."'";







  			}







  			if($forums_category_id>0&$keyword!=null){







  				$condition.=' and ';







  			}







  			if($forums_category_id<=0&$keyword!=null) {







  				$condition.=' where ';







  			}







  			if($keyword!=null){







  				$condition.=" subject like '%".$keyword."%' or content like '%".$keyword."%'";







  			}	







  		







  		   $topic_list = $database->getRows($database->splitQuery("select forums_topics_id,forums_category_id,subject,views,reply_times,customer_id,date_added from `forums_topics` $condition order by forums_topics_id desc", ($request->has('path') ? $session->get('topic_search.' . $request->get('path') . '.page') : $session->get('topic_search.page')),20));







  		







  		







	        $topic_data=array();







	        foreach ($topic_list as $tl){







	        	$forums_cate_info=$database->getRow("select cate_name from forums_category_value where forums_category_id='".$tl['forums_category_id']."'");







	        	$customer_info=$database->getRow("select firstname,lastname,nickname from customer where customer_id='".$tl['customer_id']."'");







	        	$forums_topics_reply=$database->getRow("select relier_customer_id,date_added from forums_topics_reply where forums_topics_id='".$tl['forums_topics_id']."'");







	        	if($forums_topics_reply){







	        		$reply_customer_info=$database->getRow("select firstname,lastname,nickname from customer where customer_id='".$forums_topics_reply['relier_customer_id']."'");







	        	    $reply_author=!empty($reply_customer_info['nickname'])?$reply_customer_info['nickname']:$reply_customer_info['firstname'].' '.$reply_customer_info['lastname'];







	        	}else{







	        		$reply_author=!empty($customer_info['nickname'])?$customer_info['nickname']:$customer_info['firstname'].' '.$customer_info['lastname'];







	        	}







	        	$topic_data[]=array(







	        	   'forums_topics_id'=>$tl['forums_topics_id'],







	        	   'forums_category_id'=>$tl['forums_category_id'],







	        	   'subject'=>$tl['subject'],







	        	   'views'=>$tl['views'],







	        	   'reply_times'=>$tl['reply_times'],







	        	   'date_added'=>date('m/d/Y',strtotime($tl['date_added'])),







	        	   'cate_name'=>$forums_cate_info['cate_name'],







	        	   'author'=>!empty($customer_info['nickname'])?$customer_info['nickname']:$customer_info['firstname'].' '.$customer_info['lastname'],







	        	   'last_relier'=>$reply_author,







	        	   'last_date'=>!empty($forums_topics_reply)?date('m/d/Y',strtotime($forums_topics_reply['date_added'])):date('m/d/Y',strtotime($tl['date_added']))







	        	);







	        }  







	        







	        if(($request->has('path') ? $session->get('topic_search.' . $request->get('path') . '.page') : $session->get('topic_search.page'))==null)







			{    







				$page = 1;







			}else{







				$page = ($request->has('path') ? $session->get('topic_search.' . $request->get('path') . '.page') : $session->get('topic_search.page'));







			}







			$view->set('text_results', "<dt><b>".$database->getTotal()."</b> Records</dt>");







	  		$view->set('entry_page', $language->get('entry_page'));      			







			$view->set('action', $url->href('forums', 'pagesearch', array('topic_search' => $request->get('topic_search'),'keyword' => $request->get('keyword'),'forums_category_id' => $request->get('forums_category_id'))));







			$view->set('page', ($request->has('path') ? $session->get('topic_search.' . $request->get('path') . '.page') : $session->get('topic_search.page')));							







			$page_data = array();







			for ($i = 1; $i <= $database->getPages(); $i++) {







				$page_data[] = array(







	  				'text'  => $language->get('text_pages', $i, $database->getPages()),







	  				'value' => $i







				);







			}







			$view->set('pages', $page_data);	







			$view->set('path', $request->get('path'));	   







  		}







  		$forums_cate_list=$database->getRows("select fc.forums_category_id,fc.parent_id,fcv.cate_name from forums_category fc left join forums_category_value fcv on fc.forums_category_id=fcv.forums_category_id where fc.parent_id=0 order by fcv.sort asc");







	    if(is_array($forums_cate_list)){







	    	foreach($forums_cate_list as $k=>$v){







	    		$forums_cate_list[$k]['child']=$database->getRows("select fc.forums_category_id,fc.parent_id,fcv.cate_name from forums_category  fc left join forums_category_value fcv on fc.forums_category_id=fcv.forums_category_id where fc.parent_id='".$v['forums_category_id']."' order by fcv.sort asc");







	    	}







	    }  







  		$template->set('title', '');







  		$view->set('heading_title', '');     		







        $view->set('forums_cate_list', $forums_cate_list);  







        $view->set('topic_data', $topic_data);  







        $view->set('keyword',$keyword);







        $view->set('forums_category_id',$forums_category_id);







  		$template->set('content', $view->fetch('content/topic_search.tpl'));







  







  		$template->set($module->fetchPublic());















  		$response->set($template->fetch('layout.tpl')); 







	}







    function page() {







		$request  =& $this->locator->get('request');







		$response =& $this->locator->get('response');







		$session  =& $this->locator->get('session');







		$url      =& $this->locator->get('url');







		







		if ($request->has('page', 'post')) {







			$session->set(($request->has('path') ? 'topic_category.' . $request->get('path') . '.page' : 'topic_category.page'), $request->get('page', 'post'));







		}    







		$response->redirect($url->ssl('forums&action=topic_category', FALSE, array('topic_category' => $request->get('topic_category'),'fcid' => $request->get('fcid'))));







	}







	function pagereply() {







		$request  =& $this->locator->get('request');







		$response =& $this->locator->get('response');







		$session  =& $this->locator->get('session');







		$url      =& $this->locator->get('url');







		







		if ($request->has('page', 'post')) {







			$session->set(($request->has('path') ? 'topic_threadid.' . $request->get('path') . '.page' : 'topic_threadid.page'), $request->get('page', 'post'));







		}    







		$response->redirect($url->ssl('forums&action=topic_threadid', FALSE, array('topic_threadid' => $request->get('topic_threadid'),'ftid' => $request->get('ftid'))));







	}







	function pagesearch() {







		$request  =& $this->locator->get('request');







		$response =& $this->locator->get('response');







		$session  =& $this->locator->get('session');







		$url      =& $this->locator->get('url');







		







		if ($request->has('page', 'post')) {







			$session->set(($request->has('path') ? 'topic_search.' . $request->get('path') . '.page' : 'topic_search.page'), $request->get('page', 'post'));







		}    







		$response->redirect($url->ssl('forums&action=topic_search', FALSE, array('topic_search' => $request->get('topic_search'),'keyword' => $request->get('keyword'),'forums_category_id' => $request->get('forums_category_id'))));







	}







	function pagelist() {







		$request  =& $this->locator->get('request');







		$response =& $this->locator->get('response');







		$session  =& $this->locator->get('session');







		$url      =& $this->locator->get('url');







		







		if ($request->has('page', 'post')) {







			$session->set(($request->has('path') ? 'forums.' . $request->get('path') . '.page' : 'forums.page'), $request->get('page', 'post'));







		}















		$response->redirect($url->ssl('forums', FALSE, array('path' => $request->get('path'))));







	}







}







?>







