'.(($id_cat == 1) ? 'Categories' : 'Subcategories').' '; } if ($subcategories_shw) { $subcategories_show = $subcategories_shw; } $rowsperpage = $lperpage; $screen = $curentpage; $start = $screen*$rowsperpage; $sql_order = $lorder == 2 ? " ORDER BY `title` " : " ORDER BY `date` DESC"; if (!empty($_GET["x"])) { $sql_search = " AND (`title` LIKE '%".$_GET['x']."%' OR `main_body` LIKE '%".$_GET['x']."%') "; } if ($adminapproval == 'yes') { $sql_admin = " AND `admin_confirm` = 'a' "; } if ($id_cat <> 1) { $sql_cat = " AND `id_parent` = ".$id_cat." "; $sql_order .= " LIMIT ".$start.",".$rowsperpage; } else { $sql_order = " ORDER BY `id` DESC LIMIT 3"; } $sql = "SELECT SQL_CALC_FOUND_ROWS * FROM ".$mysql_prefix."articles where status='v' ".$sql_cat.$sql_admin.$sql_search.$sql_order; $result = query($sql); list($totalrecords) = mysql_fetch_array(query("SELECT FOUND_ROWS()")); $pages = ceil($totalrecords/$rowsperpage); if($totalrecords > 0) { $cale_link_home = $cale_link; while($row = mysql_fetch_array($result)) { if ($id_cat == 1) { $cale_link_home = returncale($row["id_parent"]); } $rows.= ''. ''.$row["title"].'
'. ''.nl2br($row["summary"]).''; $rows .= "

"; } } else { if($_GET["x"]) { $rows="

No articles have been found in this category matching your search
"; } else { $rows="

No articles have been found in this category
"; } } $_SESSION["id_cat"] = $id_cat; $add_url = "
[ submit your article ]
"; if (empty($_GET["x"])||($_GET["x"]=='')) { $pager="page_"; $qs=''; } else { $pager="page_"; $qs="?x=".$_GET["x"]; } if ($id_cat <> 1) { $navigator = "
 "; if($screen>0) { $navigator.="".$pageprev." "; } $navigator .= ""; $begin = 0; $end = $pages; if($curentpage > 5 && $pages > 10) $begin = $curentpage-5; if($curentpage<$pages-5 && $pages>10) $end=$curentpage+5; for($page=$begin;$page<$end;$page++) { if($page!=$curentpage) { $navigator.="".($page+1)." | "; } else { $navigator.="".($page+1)." | "; } } $navigator = trim($navigator,' | '); $navigator .= " "; if($screen<$pages-1 && $totalrecords>0) { $navigator.="".$pagenext.""; } $navigator.="
"; } //generare caregorii principale + nr de link-uri $query = query("SELECT id,name FROM ".$mysql_prefix."categories where id_parent=1 and status='v' order by name"); $main_categories = "More Directory Categories:

"; $contor = 0; while ($r_tops = mysql_fetch_array($query)) { $x_num_list = 0; $contor++; if ($contor%2 != 0) { $main_categories.="";$pus=1; } $main_categories .= ""; $pus=0;} } if($pus) { $main_categories.=""; } $main_categories .= "
".$r_tops["name"].""; if ($contor%2) { $main_categories.="


"; $title_add = strtoupper($category_name); if($_GET["x"]) { $title_add = $id_cat <> 1 ? "Search Results in category ".strtoupper($category_name) : "Search Results"; } if($article == 0) { print_header($pagename); $tpl->assign("faction",$base_href1.$cale_link); $tpl->assign("category_name",$title_add); $tpl->assign("home_root",return_cale_afisare($calea_buna)); $tpl->assign("subcategories", ($subcategories_show <> '') ? '
'.$subcategories_show : '' ); $tpl->assign("rows",$rows); $tpl->assign("xvalue",$_GET["x"]); if(get_cat_status($id_cat)=='h'){$add_url='';} $tpl->assign("add_url",$add_url); if($pages>1){$nav=$navigator;} else{$nav='';} $tpl->assign("navigator",$nav); if($id_cat==1){ $main_categories=''; } $tpl->assign("main_categories",$main_categories); $tpl->assign("mainpage", html_entity_decode($mainpage , ENT_QUOTES)); $tpl->parse("main.ama"); print_footer(); } else { print_header($pagename); $sql=query("SELECT * FROM ".$mysql_prefix."articles where id='".$article."'") ; if(mysql_num_rows($sql)){ $row=mysql_fetch_array($sql); } $tpl->assign("faction",$base_href1.$cale_link); $tpl->assign("title",ucfirst($row["title"])); $tpl->assign("home_root",return_cale_afisare1($calea_buna)); $tpl->assign("author",$row["author"]); $date=strtotime($row["updated"]); $tpl->assign("updated",date("M, d Y H:i:s",$date)); $date=strtotime($row["date"]); $tpl->assign("created",date("M, d Y H:i:s",$date)); // transform all new lines into
$article_body = '

'.nl2br($row["main_body"]).'

'; // add resurce box $article_body .= '

'; $article_body .= $row["resourcebox"] <> '' ? 'About the Author:
'.transform_url($row["resourcebox"]).'

' : ''; $article_body .= $row["url"] <> '' ? 'Author\'s site: '.$row["url"].'' : ''; $tpl->assign("article" , $article_body); $tpl->parse("main.amaarticle"); print_footer(); } ?>