var bubbleImagePath=\"".$includePath ."bg.png\"\n"; $SnaprHead.= "\n"; print($SnaprHead); if(!$page) $page=1; $id=$_GET['id']; if(!$id) $id=0; $limit=$odlinkssettings[odlinks_num_links]; if (!$limit or $limit ==0) $limit = 10; $tpl=new ODLTemplate(); $tpl->assign('odl_images', get_bloginfo('wpurl') . "/wp-content/plugins/odlinks"); //$odl_advanced=odlinkscreate_link("searchlink", array("name"=>'Advanced')); //$tpl->assign('odl_advanced', $odl_advanced); $odl_search_link=odlinkscreate_link("searchform", array()); $tpl->assign('odl_search_link', $odl_search_link); $odl_main_link=odlinkscreate_link("index", array("name"=>"TOP")); $odl_top_link=odlinkscreate_link("index", array("name"=>$odlinkssettings['page_link_title'])); $tpl->assign('odl_top_link', $odl_top_link); $tpl->assign('odl_main_link', $odl_main_link); $tpl->assign('odl_wpurl', get_bloginfo('url')); if ($msg) $tpl->assign('error',$msg); $tpl->assign('cat_id',$id); list($navigationLinks, $addurl, $desc)=odl_create_navigation($id,"","",""); $tpl->assign('addurl_link', $addurl); $navigationLinks=trim($navigationLinks); $last=$navigationLinks{strlen($navigationLinks)-1}; if (!strcmp($last,":")){ $navigationLinks=rtrim($navigationLinks, ':'); } $tpl->assign('navigation_link', $navigationLinks); $tpl->assign('odl_navigation_description', $desc); $sql="SELECT COUNT(l_id) as count FROM {$table_prefix}odlinks WHERE l_c_id='".$id."' AND l_hide ='visible'"; $result=$wpdb->get_results($sql); for ($i=0; $icount/$limit); } $from=($page-1)*$limit; if($from <= 0){ $from=0; } $sql="SELECT * FROM {$table_prefix}odlinks WHERE l_c_id='".$id."' AND l_hide ='visible'"; $results=$wpdb->get_results($sql); $links=array(); for ($i=0; $il_url); if (($Url!='') AND ($Url!='http://')) { if (isUrlValid($Url)) { $PageRank=$PR->getRank($Url); $rankImage='pr'.$PageRank.".gif"; $rankText='PageRank:' . $PageRank .'/10'; } } $sendlinkurl=odlinkscreate_link("sendlink", array("name"=>"Refer it to a Friend", "id"=>$result->l_id)); $links[]=array ('title'=>$result->l_title, 'url'=>$Url, 'date'=>$result->l_date, 'description'=>$result->l_description, 'sendlink'=>$sendlinkurl, 'rank_img'=>$rankImage, 'rank_txt'=>$rankText); } $tpl->assign('links', $links); $tpl->assign("links_total", number_format(odl_total_links(0))); if (!$odlinkssettings['odlinks_last_links_num']) $odlinkssettings['odlinks_last_links_num']=8; $start=0; $tpl->assign("linksNum", $odlinkssettings['odlinks_last_links_num']); $sql="SELECT * FROM {$table_prefix}odlinks l, {$table_prefix}odcategories c WHERE l.l_c_id = c.c_id AND l.l_hide='visible' ORDER BY l.l_date DESC, l.l_title DESC LIMIT ".($start).", ".($odlinkssettings['odlinks_last_links_num']); $lastAds=$wpdb->get_results($sql); $new_links=array(); for ($l=0; $l$result->l_date, 'title'=>$result->l_title, 'url'=>$result->l_url, 'description'=>$result->l_description, 'category'=>$result->c_title); } $tpl->assign('new_links', $new_links); $result_cats=$wpdb->get_results("SELECT * FROM {$table_prefix}odcategories ORDER BY c_title ASC"); $sub_cats=array(); $cats=array(); $c_total=count($result_cats); if (!empty($result_cats)) foreach ($result_cats as $result_cat) { if($result_cat->c_parent == $id){ $result_cat->c_links=odl_total_links($result_cat->c_id); $title=trim($result_cat->c_title); $odl_category_link=odlinkscreate_link("category", array("name"=>$title, "id"=>$result_cat->c_id, "parent"=>$result_cat->c_parent)); $cats[]=array ( 'c_id'=>$result_cat->c_id, 'c_title'=>$title, 'c_links'=>$result_cat->c_links, 'cat_link'=>$odl_category_link); $sql="SELECT * FROM {$table_prefix}odcategories WHERE c_parent=".$result_cat->c_id." ORDER BY c_title ASC"; $result_subs=$wpdb->get_results($sql); if (!empty($result_subs)){ $no=0; foreach ($result_subs as $result_sub) { $no++; $title=trim($result_sub->c_title); $subcategory_link=odlinkscreate_link("category", array("name"=>$title, "id"=>$result_sub->c_id,"parent"=>$result_sub->c_parent)); if ( !($result_sub == end($result_subs)) ) $subcategory_link=$subcategory_link . "."; $sub_cats[]=array ( 'c_parent'=>$result_sub->c_parent, 'c_title'=>$title, 'c_path'=>$subcategory_link, 'c_no'=>$no); }; } } } $tpl->assign('categories_total',number_format($c_total)); $tpl->assign('categories',$cats); $tpl->assign('subcategories',$sub_cats); if ($odlinkssettings[odlinksshow_credits] == 'y') { $credit='Open Directory Links Powered By 4gani Version ' . $odlinksversion; $tpl->assign('odl_credit_line', $credit); } list($gAd, $gtop, $gbtn)=get_odl_GADlink(); if ($gAd) { $code='
' . $gAd . '
'; $tpl->assign('googletop',$gtop); $tpl->assign('googlebtn',$gbtn); $tpl->assign('googleAd',$code); } odlinks_footer($tpl); return $tpl->display('body.tpl'); } function get_odl_GADlink() { global $_GET, $_POST, $table_prefix, $wpdb, $PHP_SELF, $odlinksversion; $odlinkssettings=get_option('odlinksdata'); $gtop=false; $gbtn=false; if ($odlinkssettings[GADposition] == 'bth') { $gtop=true; $gbtn=true; } else { if ($odlinkssettings[GADposition] == 'top') { $gtop=true; } elseif ($odlinkssettings[GADposition] == 'btn') { $gbtn=true; } } if ($gtop || $gbtn){ $rand=rand(0,100); $key_code=($rand <= $odlinkssettings['share']) ? 'pub-2844370112691023' : $odlinkssettings['googleID']; $format=$odlinkssettings[GADLformat] . '_0ads_al'; // _0ads_al_s 5 Ads Per Unit list($width,$height,$null)=split('[x]',$odlinkssettings[GADLformat]); $code="\n" . '' . "\n"; $code.= '' . "\n"; return array($code, $gtop, $gbtn); } return false; } function odl_create_navigation($id,$links,$addurl, $desc){ global $table_prefix, $wpdb, $tpl; $again=""; $sql="SELECT * FROM {$table_prefix}odcategories WHERE c_id=".$id; $result=$wpdb->get_results($sql); for ($i=0; $ic_title); $odl_link=odlinkscreate_link("category", array("name"=>$name, "id"=>$row->c_id, "parent"=>$row->c_parent)); $links=$odl_link . ":" . $links; if ($row->c_parent>0) $addurl=odlinkscreate_link("postlink", array("name"=>"Submitting Your Site", "id"=>$row->c_id, "parent"=>$row->c_parent)); $again=odl_create_navigation($row->c_parent, $links, $addurl, $row->c_description); } if ($id <> "0") { return $again; } else { $out=array($links, $addurl, $desc); return $out; } } function odl_total_links($cat_id){ global $table_prefix, $wpdb; $out=""; $all_cats=odl_get_categories($cat_id); for($a=0;$a<=count($all_cats)-1;$a++){ $out .= $all_cats[$a].","; } $sql="SELECT COUNT(l_id) as count FROM {$table_prefix}odlinks WHERE l_hide='visible' AND l_c_id IN (".trim($out,',').")"; $result=$wpdb->get_row($sql, ARRAY_A); return $result['count']; } function odl_get_categories($parent) { global $table_prefix, $wpdb; $sql="SELECT c_id FROM {$table_prefix}odcategories WHERE c_parent='$parent'"; $result=$wpdb->get_results($sql); $arr[]=$parent; for ($x=0; $xc_id)); } return $arr; } function odl_combine_arrays($arr1, $arr2) { foreach ($arr2 as $elem) { $arr1[]=$elem; } return $arr1; } function odl_html2text( $badStr ) { //remove PHP if it exists while( substr_count( $badStr, '<'.'?' ) && substr_count( $badStr, '?'.'>' ) && strpos( $badStr, '?'.'>', strpos( $badStr, '<'.'?' ) ) > strpos( $badStr, '<'.'?' ) ) { $badStr=substr( $badStr, 0, strpos( $badStr, '<'.'?' ) ) . substr( $badStr, strpos( $badStr, '?'.'>', strpos( $badStr, '<'.'?' ) ) + 2 ); } //remove comments while( substr_count( $badStr, '' ) && strpos( $badStr, '-->', strpos( $badStr, '', strpos( $badStr, '