Location: PHPKode > projects > News Manager - RSS aggregator > newsmanager/rssexist.php
<?php

$qry_en="select * from rssurl_newsitem where language='en'";
$qry_en_res=$pg_sql->query_pass($qry_en,"4");

$qry_new_en="select * from new_newsitem where language='en'";
$qry_new_en_res=$pg_sql->query_pass($qry_new_en,"4");

$cnt_en=count($qry_en_res)+count($qry_new_en_res);

$spotcatname_en="select * from category where position='Center' and language='en'";
$spotcatname_en_res = $pg_sql->query_pass($spotcatname_en,"4");


if($_REQUEST['cat_id']!=""&& $_REQUEST['subcat_id']=="")
  $spotcatid_="where category_id=".$_REQUEST['cat_id'];
elseif($_REQUEST['cat_id']!=""&& $_REQUEST['subcat_id']!="")
  $spotcatid_="where subcategory_id=".$_REQUEST['subcat_id'];
else{
   if($spotcatname_en_res[0]['category_id']!="")
      $spotcatid_="where category_id=".$spotcatname_en_res[0]['category_id'];
 }

if($spotcatid_!="")
{
	$spot_qry_en="select * from newsitem_category $spotcatid_ ";
	$spot_res_en=$pg_sql->query_pass($spot_qry_en,"4");

}

$readcatname_en="select * from category where position='Right' and language='en'";
$readcatname_en_res = $pg_sql->query_pass($readcatname_en,"4");


if($_REQUEST['cat_id']!=""&& $_REQUEST['subcat_id']=="")
  $readcatid_="where category_id=".$_REQUEST['cat_id'];
elseif($_REQUEST['cat_id']!=""&& $_REQUEST['subcat_id']!="")
  $readcatid_="where subcategory_id=".$_REQUEST['subcat_id'];
else{
   if($readcatname_en_res[0]['category_id']!="")
      $readcatid_="where category_id=".$readcatname_en_res[0]['category_id'];
 }

if($readcatid_!="")
{
	$read_qry_en="select * from newsitem_category $readcatid_ ";
	$read_res_en=$pg_sql->query_pass($read_qry_en,"4");
}


if($cnt_en>0)
{
    if(count($spot_res_en)>0)
    {
        for($sp=0;$sp<count($spot_res_en);$sp++)
        {
         	$spot_news="select * from rssurl_newsitem where language='en' and url_newsitem_id=".$spot_res_en[$sp]['newsitem_id'];
        	$spot_news_res=$pg_sql->query_pass($spot_news,"4");

            $spot_new_news="select * from new_newsitem where language='en' and newsitem_id=".$spot_res_en[$sp]['newsitem_id'];
        	$spot_new_news_res=$pg_sql->query_pass($spot_new_news,"4");


        	$tot_spot_en=count($spot_news_res)+count($spot_new_news_res);
            if($tot_spot_en>0)
              $spot_exist_en[]=$tot_spot_en;
    	 }

    	 if(count($spot_exist_en)>0)
		     $spot_en='<a href="xml_view.php?lang=en'.$flag__.'&link=spot'.$theme_name.'" class="headlink" target="_new" title="RSS-EN">EN</a>';
		 else
    	     $spot_en='<font class="linkrss">EN</font>';


    }else{
        $spot_en='<font class="linkrss">EN</font>';
    }
    if(count($read_res_en)>0)
    {
      for($rd=0;$rd<count($read_res_en);$rd++)
	          {
	          	$read_news="select * from rssurl_newsitem where language='en' and url_newsitem_id=".$read_res_en[$rd]['newsitem_id'];
	          	$read_news_res=$pg_sql->query_pass($read_news,"4");

	            $read_new_news="select * from new_newsitem where language='en' and newsitem_id=".$read_res_en[$rd]['newsitem_id'];
	          	$read_new_news_res=$pg_sql->query_pass($read_new_news,"4");


	          	$tot_read_en=count($read_news_res)+count($read_new_news_res);
	              if($tot_read_en>0)
	                $read_exist_en[]=$tot_read_en;
	      	 }

    	 if(count($read_exist_en)>0)
      		$read_en='<a href="xml_view.php?lang=en'.$flag__.'&link=read'.$theme_name.'" class="headlink" target="_new" title="RSS-EN">EN</a>';
      	 else
             $read_en='<font class="linkrss">EN</font>';
    }else{
      $read_en='<font class="linkrss">EN</font>';
    }
    if(count($spot_exist_en)>0 || count($read_exist_en)>0 || $lang=="en")
      $all_en='<a href="xml_view.php?lang=en'.$flag__.'&link=all'.$theme_name.'" class="headlink" target="_new" title="RSS-EN">EN</a>';
    else
      $all_en='<font class="linkrss">EN</font>';
}else{
	$spot_en='<font class="linkrss">EN</font>';
	$read_en='<font class="linkrss">EN</font>';
	$all_en='<font class="linkrss">EN</font>';
}

//****************************

$qry_fr="select * from rssurl_newsitem where language='fr'";
$qry_fr_res=$pg_sql->query_pass($qry_fr,"4");

$qry_new_fr="select * from new_newsitem where language='fr'";
$qry_new_fr_res=$pg_sql->query_pass($qry_new_fr,"4");

$cnt_fr=count($qry_fr_res)+count($qry_new_fr_res);

$spotcatname_fr="select * from category where position='Center' and language='fr'";
$spotcatname_fr_res = $pg_sql->query_pass($spotcatname_fr,"4");

if($_REQUEST['cat_id']!=""&& $_REQUEST['subcat_id']=="")
  $spotcatid_fr="where category_id=".$_REQUEST['cat_id'];
elseif($_REQUEST['cat_id']!=""&& $_REQUEST['subcat_id']!="")
  $spotcatid_fr="where subcategory_id=".$_REQUEST['subcat_id'];
else{
   if($spotcatname_fr_res[0]['category_id']!="")
      $spotcatid_fr="where category_id=".$spotcatname_fr_res[0]['category_id'];
 }

if($spotcatid_fr!="")
{
	$spot_qry_fr="select * from newsitem_category $spotcatid_fr ";
	$spot_res_fr=$pg_sql->query_pass($spot_qry_fr,"4");
}

$readcatname_fr="select * from category where position='Right' and language='fr'";
$readcatname_fr_res = $pg_sql->query_pass($readcatname_fr,"4");

if($_REQUEST['cat_id']!=""&& $_REQUEST['subcat_id']=="")
  $readcatid_fr="where category_id=".$_REQUEST['cat_id'];
elseif($_REQUEST['cat_id']!=""&& $_REQUEST['subcat_id']!="")
  $readcatid_fr="where subcategory_id=".$_REQUEST['subcat_id'];
else{
   if($readcatname_fr_res[0]['category_id']!="")
      $readcatid_fr="where category_id=".$readcatname_fr_res[0]['category_id'];
 }

if($readcatid_fr!="")
{
	$read_qry_fr="select * from newsitem_category $readcatid_fr";
	$read_res_fr=$pg_sql->query_pass($read_qry_fr,"4");
}

if($cnt_fr>0)
{
  if(count($spot_res_fr)>0)
  {
    for($fs=0;$fs<count($spot_res_fr);$fs++)
		          {
		          	$spot_news_fr="select * from rssurl_newsitem where language='fr' and url_newsitem_id=".$spot_res_fr[$fs]['newsitem_id'];
		          	$spot_news_res_fr=$pg_sql->query_pass($spot_news_fr,"4");

		            $spot_new_news_fr="select * from new_newsitem where language='fr' and newsitem_id=".$spot_res_fr[$fs]['newsitem_id'];
		          	$spot_new_news_res_fr=$pg_sql->query_pass($spot_new_news_fr,"4");


		          	$tot_spot_fr=count($spot_news_res_fr)+count($spot_new_news_res_fr);
		              if($tot_spot_fr>0)
		                $spot_exist_fr[]=$tot_spot_fr;
		      	 }

    	 if(count($spot_exist_fr)>0)
    		$spot_fr='<a href="xml_view.php?lang=fr'.$flag__.'&link=spot'.$theme_name.'" class="headlink" target="_new" title="RSS-FR">FR</a>';
    	 else
    	    $spot_fr='<font class="linkrss">FR</font>';
  }else{
     $spot_fr='<font class="linkrss">FR</font>';
  }
  if(count($read_res_fr)>0)
  {
   for($fr=0;$fr<count($read_res_fr);$fr++)
  	          {
  	          	$read_news_fr="select * from rssurl_newsitem where language='fr' and url_newsitem_id=".$read_res_fr[$fr]['newsitem_id'];
  	          	$read_news_res_fr=$pg_sql->query_pass($read_news_fr,"4");

  	            $read_new_news_fr="select * from new_newsitem where language='fr' and newsitem_id=".$read_res_fr[$fr]['newsitem_id'];
  	          	$read_new_news_res_fr=$pg_sql->query_pass($read_new_news_fr,"4");


  	          	$tot_read_fr=count($read_news_res_fr)+count($read_new_news_res_fr);
  	              if($tot_read_fr>0)
  	                $read_exist_fr[]=$tot_read_fr;
  	      	 }

    	 if(count($read_exist_fr)>0)
  			$read_fr='<a href="xml_view.php?lang=fr'.$flag__.'&link=read'.$theme_name.'" class="headlink" target="_new" title="RSS-FR">FR</a>';
  		  else
  			$read_fr='<font class="linkrss">FR</font>';
  }else{
    $read_fr='<font class="linkrss">FR</font>';
  }
  if(count($spot_exist_fr)>0 || count($read_exist_fr)>0 || $lang=="fr")
      $all_fr='<a href="xml_view.php?lang=fr'.$flag__.'&link=all'.$theme_name.'" class="headlink" target="_new" title="RSS-FR">FR</a>';
   else
     $all_fr='<font class="linkrss">FR</font>';
}else{
	$spot_fr='<font class="linkrss">FR</font>';
	$read_fr='<font class="linkrss">FR</font>';
	$all_fr='<font class="linkrss">FR</font>';
}

//****************************


$qry_nl="select * from rssurl_newsitem where language='nl'";
$qry_nl_res=$pg_sql->query_pass($qry_nl,"4");

$qry_new_nl="select * from new_newsitem where language='nl'";
$qry_new_nl_res=$pg_sql->query_pass($qry_new_nl,"4");

$cnt_nl=count($qry_nl_res)+count($qry_new_nl_res);

$spotcatname_nl="select * from category where position='Center' and language='nl'";
$spotcatname_nl_res = $pg_sql->query_pass($spotcatname_nl,"4");

if($_REQUEST['cat_id']!=""&& $_REQUEST['subcat_id']=="")
  $spotcatid_nl="where category_id=".$_REQUEST['cat_id'];
elseif($_REQUEST['cat_id']!=""&& $_REQUEST['subcat_id']!="")
  $spotcatid_nl="where subcategory_id=".$_REQUEST['subcat_id'];
else{
   if($spotcatname_nl_res[0]['category_id']!="")
      $spotcatid_nl="where category_id=".$spotcatname_nl_res[0]['category_id'];
 }


if($spotcatid_nl!="")
{
	$spot_qry_nl="select * from newsitem_category $spotcatid_nl";
	$spot_res_nl=$pg_sql->query_pass($spot_qry_nl,"4");
}

$readcatname_nl="select * from category where position='Right' and language='nl'";
$readcatname_nl_res = $pg_sql->query_pass($readcatname_nl,"4");

if($_REQUEST['cat_id']!=""&& $_REQUEST['subcat_id']=="")
  $readcatid_nl="where category_id=".$_REQUEST['cat_id'];
elseif($_REQUEST['cat_id']!=""&& $_REQUEST['subcat_id']!="")
  $readcatid_nl="where subcategory_id=".$_REQUEST['subcat_id'];
else{
   if($readcatname_nl_res[0]['category_id']!="")
      $readcatid_nl="where category_id=".$readcatname_nl_res[0]['category_id'];
 }

if($readcatid_nl!="")
{
	$read_qry_nl="select * from newsitem_category $readcatid_nl";
	$read_res_nl=$pg_sql->query_pass($read_qry_nl,"4");
}


if($cnt_nl>0)
{
  if(count($spot_res_nl)>0)
  {
    for($ns=0;$ns<count($spot_res_nl);$ns++)
			          {
			          	$spot_news_nl="select * from rssurl_newsitem where language='nl' and url_newsitem_id=".$spot_res_nl[$ns]['newsitem_id'];
			          	$spot_news_res_nl=$pg_sql->query_pass($spot_news_nl,"4");

			            $spot_new_news_nl="select * from new_newsitem where language='nl' and newsitem_id=".$spot_res_nl[$ns]['newsitem_id'];
			          	$spot_new_news_res_nl=$pg_sql->query_pass($spot_new_news_nl,"4");

			          	$tot_spot_nl=count($spot_news_res_nl)+count($spot_new_news_res_nl);
			              if($tot_spot_nl>0)
			                $spot_exist_nl[]=$tot_spot_nl;
			      	 }

    	 if(count($spot_exist_nl)>0)
  			  $spot_nl='<a href="xml_view.php?lang=nl'.$flag__.'&link=spot'.$theme_name.'" class="headlink" target="_new" title="RSS-NL">NL</a>';
  		 else
    		$spot_nl='<font class="linkrss">NL</font>';
  }else{
    $spot_nl='<font class="linkrss">NL</font>';
   }
  if(count($read_res_nl)>0)
  {
   for($nr=0;$nr<count($read_res_nl);$nr++)
     	          {
     	          	$read_news_nl="select * from rssurl_newsitem where language='nl' and url_newsitem_id=".$read_res_nl[$nr]['newsitem_id'];
     	          	$read_news_res_nl=$pg_sql->query_pass($read_news_nl,"4");

     	            $read_new_news_nl="select * from new_newsitem where language='nl' and newsitem_id=".$read_res_nl[$nr]['newsitem_id'];
     	          	$read_new_news_res_nl=$pg_sql->query_pass($read_new_news_nl,"4");

     	          	$tot_read_nl=count($read_news_res_nl)+count($read_new_news_res_nl);
     	              if($tot_read_nl>0)
     	                $read_exist_nl[]=$tot_read_nl;
     	      	 }

    	 if(count($read_exist_nl)>0)
    		$read_nl='<a href="xml_view.php?lang=nl'.$flag__.'&link=read'.$theme_name.'" class="headlink" target="_new" title="RSS-NL">NL</a>';
         else
           $read_nl='<font class="linkrss">NL</font>';
   }else{
     $read_nl='<font class="linkrss">NL</font>';
   }

  if(count($spot_exist_nl)>0 || count($read_exist_nl)>0 || $lang=="nl")
    $all_nl='<a href="xml_view.php?lang=nl'.$flag__.'&link=all'.$theme_name.'" class="headlink" target="_new" title="RSS-NL">NL</a>';
  else
    $all_nl='<font class="linkrss">NL</font>';
}else{
	$spot_nl='<font class="linkrss">NL</font>';
	$read_nl='<font class="linkrss">NL</font>';
	$all_nl='<font class="linkrss">NL</font>';
}

//****************************

$qry_de="select * from rssurl_newsitem where language='de'";
$qry_de_res=$pg_sql->query_pass($qry_de,"4");

$qry_new_de="select * from new_newsitem where language='de'";
$qry_new_de_res=$pg_sql->query_pass($qry_new_de,"4");

$cnt_de=count($qry_de_res)+count($qry_new_de_res);

$spotcatname_de="select * from category where position='Center' and language='de'";
$spotcatname_de_res = $pg_sql->query_pass($spotcatname_de,"4");

if($_REQUEST['cat_id']!=""&& $_REQUEST['subcat_id']=="")
  $spotcatid_de="where category_id=".$_REQUEST['cat_id'];
elseif($_REQUEST['cat_id']!=""&& $_REQUEST['subcat_id']!="")
  $spotcatid_de="where subcategory_id=".$_REQUEST['subcat_id'];
else{
   if($spotcatname_de_res[0]['category_id']!="")
      $spotcatid_de="where category_id=".$spotcatname_de_res[0]['category_id'];
 }


if($spotcatid_de!="")
{
	$spot_qry_de="select * from newsitem_category $spotcatid_de";
	$spot_res_de=$pg_sql->query_pass($spot_qry_de,"4");
}

$readcatname_de="select * from category where position='Right' and language='de'";
$readcatname_de_res = $pg_sql->query_pass($readcatname_de,"4");

if($_REQUEST['cat_id']!=""&& $_REQUEST['subcat_id']=="")
  $readcatid_de="where category_id=".$_REQUEST['cat_id'];
elseif($_REQUEST['cat_id']!=""&& $_REQUEST['subcat_id']!="")
  $readcatid_de="where subcategory_id=".$_REQUEST['subcat_id'];
else{
   if($readcatname_de_res[0]['category_id']!="")
      $readcatid_de="where category_id=".$readcatname_de_res[0]['category_id'];
 }

if($readcatid_de!="")
{
	$read_qry_de="select * from newsitem_category $readcatid_de";
	$read_res_de=$pg_sql->query_pass($read_qry_de,"4");
}



if($cnt_de>0)
{
 if(count($spot_res_de)>0)
 {
   for($ds=0;$ds<count($spot_res_de);$ds++)
  			          {
  			          	$spot_news_de="select * from rssurl_newsitem where language='de' and url_newsitem_id=".$spot_res_de[$ds]['newsitem_id'];
  			          	$spot_news_res_de=$pg_sql->query_pass($spot_news_de,"4");

  			            $spot_new_news_de="select * from new_newsitem where language='de' and newsitem_id=".$spot_res_de[$ds]['newsitem_id'];
  			          	$spot_new_news_res_de=$pg_sql->query_pass($spot_new_news_de,"4");

  			          	$tot_spot_de=count($spot_news_res_de)+count($spot_new_news_res_de);
  			              if($tot_spot_de>0)
  			                $spot_exist_de[]=$tot_spot_de;
  			      	 }

    	 if(count($spot_exist_de)>0)
            $spot_de='<a href="xml_view.php?lang=de'.$flag__.'&link=spot'.$theme_name.'" class="headlink" target="_new" title="RSS-DE">DE</a>';
         else
            $spot_de='<font class="linkrss">DE</font>';
 }else{
	$spot_de='<font class="linkrss">DE</font>';
 }
 if(count($read_res_de)>0)
 {
  for($dr=0;$dr<count($read_res_de);$dr++)
       	          {
       	          	$read_news_de="select * from rssurl_newsitem where language='de' and url_newsitem_id=".$read_res_de[$dr]['newsitem_id'];
       	          	$read_news_res_de=$pg_sql->query_pass($read_news_de,"4");

       	            $read_new_news_de="select * from new_newsitem where language='de' and newsitem_id=".$read_res_de[$dr]['newsitem_id'];
       	          	$read_new_news_res_de=$pg_sql->query_pass($read_new_news_de,"4");

       	          	$tot_read_de=count($read_news_res_de)+count($read_new_news_res_de);
       	              if($tot_read_de>0)
       	                $read_exist_de[]=$tot_read_de;
       	      	 }

    	 if(count($read_exist_de)>0)
 	 	     $read_de='<a href="xml_view.php?lang=de'.$flag__.'&link=read'.$theme_name.'" class="headlink" target="_new" title="RSS-DE">DE</a>';
 		  else
 		    $read_de='<font class="linkrss">DE</font>';
 }else{
 	$read_de='<font class="linkrss">DE</font>';
  }
   if(count($spot_exist_de) > 0 || count($read_exist_de)>0 || $lang=="de")
     $all_de='<a href="xml_view.php?lang=de'.$flag__.'&link=all'.$theme_name.'" class="headlink" target="_new" title="RSS-DE">DE</a>';
   else
     $all_de='<font class="linkrss">DE</font>';
}else{
	$spot_de='<font class="linkrss">DE</font>';
	$read_de='<font class="linkrss">DE</font>';
	$all_de='<font class="linkrss">DE</font>';
}


?>
Return current item: News Manager - RSS aggregator