template_dir='../xpl_templates'; $smarty->compile_dir='../xpl_templates/compile'; $smarty->register_modifier('esch','esch'); $fav1=explode(',',$_COOKIE['favorites']); $fav=$fav1; $fav_list=''; if (is_array($fav1)) { for (reset($fav1); list($idx,$id)=each($fav1);) { $id=intval($id); if ($id<=0) { unset($fav[$idx]); } else { $fav[$idx]=$id; } } $fav_list=implode(',',$fav); } $stats=array(); $stats['year']=date('Y'); if ($fav_list!='') { $sql="SELECT i.id,i.rating_admin,ROUND(i.rating_user) AS rating_user,i.rating_user_votes,i.pos, ndate,DATE_FORMAT(i.ndate,'{$date_format}') AS `date`,i.name AS title,i.url,i.spare1,i.spare2,i.thumbnail,i.description, c.text_id AS category_text_id, c.name AS category_name, s.name AS section_name, t.name AS type_name, t.description AS type_description, t.spare1 AS type_spare1, t.spare2 AS type_spare2, t.display AS type_display FROM ".DB_PREFIX."items i INNER JOIN ".DB_PREFIX."categories c ON i.ref_id_categories=c.id INNER JOIN ".DB_PREFIX."sections s ON c.ref_id_sections=s.id INNER JOIN ".DB_PREFIX."link_types t ON i.ref_id_link_types=t.id LEFT OUTER JOIN ".DB_PREFIX."submit submit ON i.id=submit.id WHERE (submit.status IS NULL OR submit.status='approved') AND i.id IN ({$fav_list})"; $items_common=$db->Select($sql); $stats['links_local']=count($items_common); } else { $items_common=array(); $stats['links_local']=0; } $categories=$db->Select("SELECT c.id,c.text_id,c.name,c.title_text,c.header_text,c.field1,c.field2,c.field3,s.id AS section_id,s.name AS section FROM ".DB_PREFIX."categories c INNER JOIN ".DB_PREFIX."sections s ON c.ref_id_sections=s.id ORDER BY s.pos,c.name"); for (reset($categories); list($idx,$category)=each($categories);) { $categories[$idx]['url']=getCategoryURL($category['text_id'],false); } $sql_sponsored="SELECT i.id,i.rating_admin,ROUND(i.rating_user) AS rating_user,i.rating_user_votes,i.pos, DATE_FORMAT(i.ndate,'{$date_format}') AS `date`,i.name AS title,i.url,i.spare1,i.spare2,i.thumbnail,i.description, c.text_id AS category_text_id, c.name AS category_name, s.name AS section_name, t.name AS type_name, t.description AS type_description, t.spare1 AS type_spare1, t.spare2 AS type_spare2, t.display AS type_display FROM ".DB_PREFIX."items i INNER JOIN ".DB_PREFIX."categories c ON i.ref_id_categories=c.id INNER JOIN ".DB_PREFIX."sections s ON c.ref_id_sections=s.id INNER JOIN ".DB_PREFIX."link_types t ON i.ref_id_link_types=t.id WHERE sponsored_link='y'"; $sponsored_links=$db->Select($sql_sponsored); $sponsored_count=count($sponsored_links); if ($sponsored_count<=$GLOBALS['sysctl']['frontend.ipp.favorites_sponsored']) { $items_sponsored=$sponsored_links; shuffle($items_sponsored); } else { $items_sponsored=getSponsoredLinks($sponsored_links,$GLOBALS['sysctl']['frontend.ipp.favorites_sponsored']); } $l=$GLOBALS['sysctl']['frontend.max_news']>0?" LIMIT ".$GLOBALS['sysctl']['frontend.max_news']:''; $news=$db->Select("SELECT id,ndate,descr,content FROM ".DB_PREFIX."news ORDER BY id DESC".$l); addThumbs($items_common); addThumbs($items_sponsored); $smarty->clear_all_assign(); $smarty->assign('categories',$categories); $smarty->assign('news',$news); $smarty->assign('stats',$stats); $smarty->assign('items_common',$items_common); $smarty->assign('items_sponsored',$items_sponsored); $smarty->display('favorites.tpl'); ?>