connect(); $Valid = new Validator(); /********************************************************************************************** * **********************************************************************************************/ if (!isset($post["action"])) $post["action"] = ""; /********************************************************************************************** * SWITCH **********************************************************************************************/ switch ($post["action"]) { case "home" : $data = home(); break; default : $data = home(); break; } /********************************************************************************************** * END SWITCH **********************************************************************************************/ $db -> disconnect(); print $data; /********************************************************************************************** * FUNCTION **********************************************************************************************/ function home() { global $post,$db; $template =& new Template(SITE_PATH."/".TPL_PATH."/".LANG."/index.tpl"); $_tpl =& new Template(SITE_PATH."/".TPL_PATH."/".LANG."/tab_search.tpl"); $_tpl->AddParam("color","blubox"); $params['index_search']= $_tpl->Output(); $_tpl =& new Template(SITE_PATH."/".TPL_PATH."/".LANG."/tab_news.tpl"); $_tpl->AddParam("color","blubox"); $params['index_news']= $_tpl->Output(); $_tpl =& new Template(SITE_PATH."/".TPL_PATH."/".LANG."/tab_banner.tpl"); $_tpl->AddParam("color","blubox"); $params['index_banner']= $_tpl->Output(); $sql="select * from category"; $sql_data=$db->executeAssoc($sql); $all_links=get_all_links($sql_data); $template->AddParam($all_links); $template->AddParam($params); return getUserMain("Beursstart.nl","Beursstart.nl","Sub Title Area",$template->Output(),LANG."/main.tpl",array()); } /********************************************************************************************** * **********************************************************************************************/ function get_all_links($data) { global $db; foreach ($data as $category){ $sql="select id, url, title, count_click/(if(TO_DAYS(NOW()) - TO_DAYS(date_create)<=0,1,TO_DAYS(NOW()) - TO_DAYS(date_create))) as rating from links where category='".$db->prepare($category['id'])."' order by rating DESC limit 0,".LINKS_COUNT; $sql_data=$db->executeAssoc($sql); if (count($sql_data)executeAssoc($sql); $return['top_links']=$sql_data; return ($return); } /********************************************************************************************** * **********************************************************************************************/ ?>