<?php
/*******************************************************************************
** File : readlsoqry.php **
** Author : G.Ramkumar **
** Description : right navigation menu query **
** Date : 14/07/2005 **
** Last Modified : 02/08/2005 **
** PHP Version : 5.0.3 **
** **
*******************************************************************************/
$comdate=date("Y-m-d")." ".date("H:i:s");
$read_catname="select * from category where category_name='$readalso_' and type!='D' and language='$lang'";
$read_catname_res=$pg_sql->query_pass($read_catname,"4");
$newcomp_id=trim($comp_id,",");
if($newcomp_id!="")
{
$rssurl="and url_newsitem_id not in ($newcomp_id)";
$new_news="and newsitem_id not in ($newcomp_id)";
$new_news_r="where newsitem_id not in ($newcomp_id)";
}else{
$rssurl="";
$new_news="";
$new_news_r="";
}
if($_REQUEST['cat_id']!="" && $_REQUEST['subcat_id']=="")
{
if($new_news_r!="")
$catid_r="and flag='Y' and category_id=".$_REQUEST['cat_id'];
else
$catid_r="where flag='Y' and category_id=".$_REQUEST['cat_id'];
$readrsscat_qry="select * from category where category_id=".$_REQUEST['cat_id'];
$readrsscat_qry_result=$pg_sql->query_pass($readrsscat_qry,"4");
$readrss_cat_name="theme=".strtolower($readrsscat_qry_result[0]['category_name'])."&";
}
elseif($_REQUEST['cat_id']!="" && $_REQUEST['subcat_id']!="")
{
if($new_news_r!="")
$catid_r="and flag='Y' and subcategory_id=".$_REQUEST['subcat_id'];
else
$catid_r="where flag='Y' and subcategory_id=".$_REQUEST['subcat_id'];
$readsubrsscat_qry="select * from subcategory where subcategory_id=".$_REQUEST['subcat_id'];
$readsubrsscat_qry_result=$pg_sql->query_pass($readsubrsscat_qry,"4");
$readrss_cat_name="theme=".strtolower($readsubrsscat_qry_result[0]['subcategory_name'])."&";
}
else
{
if($read_catname_res[0]['category_id']!="")
{
if($new_news_r !="")
$catid_r="and flag='Y' and category_id=".$read_catname_res[0]['category_id'];
else
$catid_r="where flag='Y' and category_id=".$read_catname_res[0]['category_id'];
}
}
if($catid_r!="")
{
$readalso_qry="select * from newsitem_category $new_news_r $catid_r and pubdate <='$comdate' order by pubdate desc";
$readalso_res=$pg_sql->query_pass($readalso_qry,"4");
}
$readalsocnt=count($readalso_res);
// for Getting Xml _id
for($r=0;$r<$readalsocnt;$r++)
{
$id_=$readalso_res[$r][newsitem_id];
$xml_readalso_news="select * from rssurl_newsitem where url_newsitem_id=$id_ and frontend_export='Y' and language='$lang'";
$xml_readalsonews_res=$pg_sql->query_pass($xml_readalso_news,"4");
$xml_readalso_new_news="select * from new_newsitem where newsitem_id=$id_ and frontend='Y' and language='$lang'";
$xml_readalsonew_news_res=$pg_sql->query_pass($xml_readalso_new_news,"4");
if(count($cnt_xml)<5)
{
if($xml_readalsonews_res[0]['url_newsitem_id']!="")
{
$xml_exist=0;
$xml_id_r .=$xml_readalsonews_res[0]['url_newsitem_id'].",";
$cnt_xml[] =$xml_exist;
}
if($xml_readalsonew_news_res[0]['newsitem_id']!="")
{
$xml_exist=0;
$xml_id .=$xml_readalsonew_news_res[0]['newsitem_id'].",";
$xml_id_new_r .=$xml_readalsonew_news_res[0]['newsitem_id'].",";
$cnt_xml[] = $xml_exist;
}
}
}
?>