Location: PHPKode > projects > Blogs manager > blogs/_comments_Report_report.php
<?php
ini_set("display_errors","1");
ini_set("display_startup_errors","1");
header("Expires: Thu, 01 Jan 1970 00:00:01 GMT"); 
set_magic_quotes_runtime(0);

include("include/dbcommon.php");
include("include/_comments_Report_variables.php");

if(!@$_SESSION["UserID"])
{ 
	$_SESSION["MyURL"]=$_SERVER["SCRIPT_NAME"]."?".$_SERVER["QUERY_STRING"];
	header("Location: login.php?message=expired"); 
	return;
}
if(!CheckSecurity(@$_SESSION["_".$strTableName."_OwnerID"],"Search"))
{
	echo "<p>"."You don't have permissions to access this table"." <a href=\"login.php\">"."Back to login page"."</a></p>";
	return;
}


include('libs/Smarty.class.php');
$smarty = new Smarty();

$conn=db_connect();

//	Before Process event
if(function_exists("BeforeProcessReport"))
	BeforeProcessReport($conn);


//	process reqest data, fill session variables

if(!count($_POST) && !count($_GET))
{
	$sess_unset = array();
	foreach($_SESSION as $key=>$value)
		if(substr($key,0,strlen($strTableName)+1)==$strTableName."_" &&
			strpos(substr($key,strlen($strTableName)+1),"_")===false)
			$sess_unset[] = $key;
	foreach($sess_unset as $key)
		unset($_SESSION[$key]);
}

if(@$_REQUEST["a"]=="advsearch")
{
	$_SESSION[$strTableName."_asearchnot"]=array();
	$_SESSION[$strTableName."_asearchopt"]=array();
	$_SESSION[$strTableName."_asearchfor"]=array();
	$_SESSION[$strTableName."_asearchfor2"]=array();
	$tosearch=0;
	$asearchfield = postvalue("asearchfield");
	$_SESSION[$strTableName."_asearchtype"] = postvalue("type");
	if(!$_SESSION[$strTableName."_asearchtype"])
		$_SESSION[$strTableName."_asearchtype"]="and";
	foreach($asearchfield as $field)
	{
		$gfield=GoodFieldName($field);
		$asopt=postvalue("asearchopt_".$gfield);
		$value1=postvalue("value_".$gfield);
		$type=postvalue("type_".$gfield);
		$value2=postvalue("value1_".$gfield);
		$not=postvalue("not_".$gfield);
		if($value1 || $asopt=='Empty')
		{
			$tosearch=1;
			$_SESSION[$strTableName."_asearchopt"][$field]=$asopt;
			if(!is_array($value1))
				$_SESSION[$strTableName."_asearchfor"][$field]=$value1;
			else
				$_SESSION[$strTableName."_asearchfor"][$field]=combinevalues($value1);
			$_SESSION[$strTableName."_asearchfortype"][$field]=$type;
			if($value2)
				$_SESSION[$strTableName."_asearchfor2"][$field]=$value2;
			$_SESSION[$strTableName."_asearchnot"][$field]=($not=="on");
		}
	}
	if($tosearch)
		$_SESSION[$strTableName."_search"]=2;
	else
		$_SESSION[$strTableName."_search"]=0;
	$_SESSION[$strTableName."_pagenumber"]=1;
}


if(@$_REQUEST["orderby"])
	$_SESSION[$strTableName."_orderby"]=@$_REQUEST["orderby"];

if(@$_REQUEST["pagesize"])
{
	$_SESSION[$strTableName."_pagesize"]=@$_REQUEST["pagesize"];
	$_SESSION[$strTableName."_pagenumber"]=1;
}

if(@$_REQUEST["goto"])
	$_SESSION[$strTableName."_pagenumber"]=@$_REQUEST["goto"];


//	process reqest data - end

$smarty->assign("includes",
"<script language=\"JavaScript\" src=\"include/jsfunctions.js\">".
"</script>".
"<script>".
"	var bSelected=false;".
"var TEXT_FIRST = \""."First"."\";".
"var TEXT_PREVIOUS = \""."Previous"."\";".
"var TEXT_NEXT = \""."Next"."\";".
"var TEXT_LAST = \""."Last"."\";".
"</script>");


//	process session variables
//	order by
$strOrderBy="";
$order_ind=-1;

$smarty->assign("order_dir_id","a");
$smarty->assign("order_dir_username","a");
$smarty->assign("order_dir_blogfirstline","a");
$smarty->assign("order_dir_date","a");
$smarty->assign("order_dir_time","a");
$smarty->assign("order_dir_rate","a");
$smarty->assign("order_dir_comment","a");

if(@$_SESSION[$strTableName."_orderby"])
{
	$order_field=substr($_SESSION[$strTableName."_orderby"],1);
	$order_dir=substr($_SESSION[$strTableName."_orderby"],0,1);
	$order_ind=GetFieldIndex($order_field);

	$smarty->assign("order_dir_id","a");
	if($order_field=="id")
	{
		if($order_dir=="a")
		{
			$smarty->assign("order_dir_id","d");
			$img="up";
		}
		else
			$img="down";
		$smarty->assign("order_image_id","<img src=\"images/".$img.".gif\" border=0>");
	}
	$smarty->assign("order_dir_username","a");
	if($order_field=="username")
	{
		if($order_dir=="a")
		{
			$smarty->assign("order_dir_username","d");
			$img="up";
		}
		else
			$img="down";
		$smarty->assign("order_image_username","<img src=\"images/".$img.".gif\" border=0>");
	}
	$smarty->assign("order_dir_blogfirstline","a");
	if($order_field=="blogfirstline")
	{
		if($order_dir=="a")
		{
			$smarty->assign("order_dir_blogfirstline","d");
			$img="up";
		}
		else
			$img="down";
		$smarty->assign("order_image_blogfirstline","<img src=\"images/".$img.".gif\" border=0>");
	}
	$smarty->assign("order_dir_date","a");
	if($order_field=="date")
	{
		if($order_dir=="a")
		{
			$smarty->assign("order_dir_date","d");
			$img="up";
		}
		else
			$img="down";
		$smarty->assign("order_image_date","<img src=\"images/".$img.".gif\" border=0>");
	}
	$smarty->assign("order_dir_time","a");
	if($order_field=="time")
	{
		if($order_dir=="a")
		{
			$smarty->assign("order_dir_time","d");
			$img="up";
		}
		else
			$img="down";
		$smarty->assign("order_image_time","<img src=\"images/".$img.".gif\" border=0>");
	}
	$smarty->assign("order_dir_rate","a");
	if($order_field=="rate")
	{
		if($order_dir=="a")
		{
			$smarty->assign("order_dir_rate","d");
			$img="up";
		}
		else
			$img="down";
		$smarty->assign("order_image_rate","<img src=\"images/".$img.".gif\" border=0>");
	}
	$smarty->assign("order_dir_comment","a");
	if($order_field=="comment")
	{
		if($order_dir=="a")
		{
			$smarty->assign("order_dir_comment","d");
			$img="up";
		}
		else
			$img="down";
		$smarty->assign("order_image_comment","<img src=\"images/".$img.".gif\" border=0>");
	}

	if($order_ind)
	{
		if($order_dir=="a")
			$strOrderBy="order by ".($order_ind)." asc";
		else 
			$strOrderBy="order by ".($order_ind)." desc";
	}
}
if(!$strOrderBy)
	$strOrderBy=$gstrOrderBy;

//	make sql "select" string

$strWhereClause="";
//$strSQL = $gstrSQL;

//	add search params

if(@$_SESSION[$strTableName."_search"]==2)
//	 advanced search
{
	$sWhere="";
	foreach(@$_SESSION[$strTableName."_asearchfor"] as $f => $sfor)
		{
			$strSearchFor=trim($sfor);
			$strSearchFor2="";
			$type=@$_SESSION[$strTableName."_asearchfortype"][$f];
			if(array_key_exists($f,@$_SESSION[$strTableName."_asearchfor2"]))
				$strSearchFor2=trim(@$_SESSION[$strTableName."_asearchfor2"][$f]);
			if($strSearchFor!="" || true)
			{
				if (!$sWhere) 
				{
					if($_SESSION[$strTableName."_asearchtype"]=="and")
						$sWhere="1=1";
					else
						$sWhere="1=0";
				}
				$strSearchOption=trim($_SESSION[$strTableName."_asearchopt"][$f]);
				if($where=StrWhereAdv($f, $strSearchFor, $strSearchOption, $strSearchFor2,$type))
				{
					if($_SESSION[$strTableName."_asearchnot"][$f])
						$where="not (".$where.")";
					if($_SESSION[$strTableName."_asearchtype"]=="and")
	   					$sWhere .= " and ".$where;
					else
	   					$sWhere .= " or ".$where;
				}
			}
		}
		$strWhereClause = whereAdd($strWhereClause,$sWhere);
//		$strSQL = AddWhere($strSQL,$sWhere);
	}


$strSQL = gSQLWhere($strWhereClause);

//	order by
$strSQL.=" ".trim($strOrderBy);


$groupno=0;

if(!$_SESSION[$strTableName."_pagenumber"])
	$_SESSION[$strTableName."_pagenumber"]=1;

if(!$_SESSION[$strTableName."_pagesize"])
	$_SESSION[$strTableName."_pagesize"]=5;

$PageSize=$_SESSION[$strTableName."_pagesize"];

$pagestart=($_SESSION[$strTableName."_pagenumber"]-1)*$_SESSION[$strTableName."_pagesize"]+1;
$pageend=$pagestart+$_SESSION[$strTableName."_pagesize"]-1;

// init totals

// group totals
$grouptotals_count = array();
$grouptotals_min = array();
$grouptotals_max = array();
$grouptotals_dispmin = array();
$grouptotals_dispmax = array();
$grouptotals_sum = array();
$grouptotals_sum["blogfirstline"]=array();
$grouptotals_min["blogfirstline"]=array();
$grouptotals_max["blogfirstline"]=array();
$grouptotals_dispmin["blogfirstline"]=array();
$grouptotals_dispmax["blogfirstline"]=array();
$grouptotals_count["blogfirstline"]=0;
$grouptotals_sum["blogfirstline"]["id"]=0;
$grouptotals_sum["blogfirstline"]["username"]=0;
$grouptotals_sum["blogfirstline"]["blogfirstline"]=0;
$grouptotals_sum["blogfirstline"]["date"]=0;
$grouptotals_sum["blogfirstline"]["time"]=0;
$grouptotals_sum["blogfirstline"]["rate"]=0;
$grouptotals_sum["blogfirstline"]["comment"]=0;

// page totals
$pagetotals_count = 0;
$pagetotals_min = array();
$pagetotals_max = array();
$pagetotals_dispmin = array();
$pagetotals_dispmax = array();
$pagetotals_sum = array();
$pagetotals_sum["id"]=0;
$pagetotals_sum["username"]=0;
$pagetotals_sum["blogfirstline"]=0;
$pagetotals_sum["date"]=0;
$pagetotals_sum["time"]=0;
$pagetotals_sum["rate"]=0;
$pagetotals_sum["comment"]=0;

// global totals
$globaltotals_count = 0;
$globaltotals_min = array();
$globaltotals_max = array();
$globaltotals_dispmin = array();
$globaltotals_dispmax = array();
$globaltotals_sum = array();
$globaltotals_sum["id"]=0;
$globaltotals_sum["username"]=0;
$globaltotals_sum["blogfirstline"]=0;
$globaltotals_sum["date"]=0;
$globaltotals_sum["time"]=0;
$globaltotals_sum["rate"]=0;
$globaltotals_sum["comment"]=0;

//	save SQL for use in "Export" and "Printer-friendly" pages

$_SESSION[$strTableName."_sql"] = $strSQL;
$_SESSION[$strTableName."_where"] = $strWhereClause;
$_SESSION[$strTableName."_order"] = $strOrderBy;

//	select all records

$strSQLbak = $strSQL;
if(function_exists("BeforeQueryReport"))
	BeforeQueryReport($strSQL,$strWhereClause,$strOrderBy);
if($strSQLbak == $strSQL)
{
	$strSQL = gSQLWhere($strWhereClause);
	$strSQL.=" ".trim($strOrderBy);
}


LogInfo($strSQL);
$rs=db_query($strSQL,$conn);

$start=true;

	$groupstart_blogfirstline=0;
	$groupvalue_blogfirstline="";

$rowinfo = array();

while($data=db_fetch_array($rs))
{
	$row=array();
//	check if starting new group
	$newgroup_blogfirstline=false;
	$newgroup=false;

			if($start || $groupstart_blogfirstline!=GetGroupStart("blogfirstline",$data["blogfirstline"]))
		{
			$newgroup_blogfirstline=true;
			$newgroup=true;
		}
		
//	close groups
	$rowclose=array();
	if(!$start && $newgroup_blogfirstline)
	{
		$rowclose["endgroup_blogfirstline"]=true;
		$rowclose["1blogfirstline_grval"]=$groupvalue_blogfirstline;
		$rowclose["groupblogfirstline_total_cnt"]=$grouptotals_count["blogfirstline"];
//		$rowclose["groupblogfirstline_totalrate_sum"]=$grouptotals_sum["blogfirstline"]["rate"];
		$sum=array("rate"=>$grouptotals_sum["blogfirstline"]["rate"]);
		$rowclose["groupblogfirstline_totalrate_sum"]=GetData($sum,"rate","");
			if($grouptotals_count["blogfirstline"])
		{
																																			$avg=array("rate"=>$grouptotals_sum["blogfirstline"]["rate"]/$grouptotals_count["blogfirstline"]);
			$rowclose["groupblogfirstline_totalrate_avg"]=GetData($avg,"rate","");
					$rowclose["groupblogfirstline_totalrate_min"]=$grouptotals_dispmin["blogfirstline"]["rate"];
					$rowclose["groupblogfirstline_totalrate_max"]=$grouptotals_dispmax["blogfirstline"]["rate"];
								}
	}
	if(($PageSize<0 || $groupno>=$pagestart && $groupno<=$pageend) && count($rowclose))
		$rowinfo[]=$rowclose;
	$start=false;
//	open new group
	if($newgroup_blogfirstline)
	{
			$groupno++;
		$row["newgroup_blogfirstline"]=true;

		$groupstart_blogfirstline = GetGroupStart("blogfirstline",$data["blogfirstline"]);
		$groupdisplay_blogfirstline = GetGroupStart("blogfirstline",$data["blogfirstline"]);
		$groupvalue_blogfirstline=GetGroupDisplay("blogfirstline",$data["blogfirstline"]);
		
		$row["1blogfirstline_grval"]=$groupvalue_blogfirstline;
		
		$grouptotals_count["blogfirstline"]=0;
		$grouptotals_sum["blogfirstline"]["id"]=0;
		$grouptotals_sum["blogfirstline"]["username"]=0;
		$grouptotals_sum["blogfirstline"]["blogfirstline"]=0;
		$grouptotals_sum["blogfirstline"]["date"]=0;
		$grouptotals_sum["blogfirstline"]["time"]=0;
		$grouptotals_sum["blogfirstline"]["rate"]=0;
		$grouptotals_sum["blogfirstline"]["comment"]=0;
	}

//	display data
	if($PageSize<0 || $groupno>=$pagestart && $groupno<=$pageend)
	{
		$row["havedata"]=true;
/////////////////////////////////
			$keylink="";
			$keylink.="&key1=".htmlspecialchars(rawurlencode($data["id"]));


//	blogfirstline - 
			$value="";
				$value = ProcessLargeText(GetData($data,"blogfirstline", ""),"field=blogfirstline".$keylink,"",MODE_LIST);
				$row["1blogfirstline_value"]=$value;
		
		if(@$row["newgroup_blogfirstline"])
		{
			$row["1blogfirstline_grval"]=$value;
			$groupvalue_blogfirstline=$value;
		}
	

//	id - 
			$value="";
				$value = ProcessLargeText(GetData($data,"id", ""),"field=id".$keylink,"",MODE_LIST);
				$row["1id_value"]=$value;

//	username - 
			$value="";
				$value = ProcessLargeText(GetData($data,"username", ""),"field=username".$keylink,"",MODE_LIST);
				$row["1username_value"]=$value;

//	date - Short Date
			$value="";
				$value = ProcessLargeText(GetData($data,"date", "Short Date"),"field=date".$keylink,"",MODE_LIST);
				$row["1date_value"]=$value;

//	time - Time
			$value="";
				$value = ProcessLargeText(GetData($data,"time", "Time"),"field=time".$keylink,"",MODE_LIST);
				$row["1time_value"]=$value;

//	rate - 
			$value="";
				$value = ProcessLargeText(GetData($data,"rate", ""),"field=rate".$keylink,"",MODE_LIST);
				$row["1rate_value"]=$value;

//	comment - 
			$value="";
				$value = ProcessLargeText(GetData($data,"comment", ""),"field=comment".$keylink,"",MODE_LIST);
				$row["1comment_value"]=$value;
//////////////////////////////////////////////////////////////	

//	update totals
		$grouptotals_sum["blogfirstline"]["rate"]+=$data["rate"];
			if(!$grouptotals_count["blogfirstline"])
		{
			$grouptotals_min["blogfirstline"]["rate"]=$data["rate"];
			$grouptotals_dispmin["blogfirstline"]["rate"]=GetData($data,"rate","");
			$grouptotals_max["blogfirstline"]["rate"]=$data["rate"];
			$grouptotals_dispmax["blogfirstline"]["rate"]=GetData($data,"rate","");
		}
		else
		{
																																				if($grouptotals_min["blogfirstline"]["rate"]>$data["rate"])
			{
				$grouptotals_min["blogfirstline"]["rate"]=$data["rate"];
				$grouptotals_dispmin["blogfirstline"]["rate"]=GetData($data,"rate","");
			}
						if($grouptotals_max["blogfirstline"]["rate"]<$data["rate"])
			{
				$grouptotals_max["blogfirstline"]["rate"]=$data["rate"];
				$grouptotals_dispmax["blogfirstline"]["rate"]=GetData($data,"rate","");
			}
								}
		$grouptotals_count["blogfirstline"]++;
		$pagetotals_sum["rate"]+=$data["rate"];
			if(!$pagetotals_count)
		{
			$pagetotals_min["rate"]=$data["rate"];
			$pagetotals_dispmin["rate"]=GetData($data,"rate","");
			$pagetotals_max["rate"]=$data["rate"];
			$pagetotals_dispmax["rate"]=GetData($data,"rate","");
		}
		else
		{
																																				if($pagetotals_min["rate"]>$data["rate"])
			{
				$pagetotals_min["rate"]=$data["rate"];
				$pagetotals_dispmin["rate"]=GetData($data,"rate","");
			}
						if($pagetotals_max["rate"]<$data["rate"])
			{
				$pagetotals_max["rate"]=$data["rate"];
				$pagetotals_dispmax["rate"]=GetData($data,"rate","");
			}
								}
		$pagetotals_count++;
		$rowinfo[]=$row;
	}
		$globaltotals_sum["rate"]+=$data["rate"];
			if(!$globaltotals_count)
		{
			$globaltotals_min["rate"]=$data["rate"];
			$globaltotals_dispmin["rate"]=GetData($data,"rate","");
			$globaltotals_max["rate"]=$data["rate"];
			$globaltotals_dispmax["rate"]=GetData($data,"rate","");
		}
		else
		{
																																				if($globaltotals_min["rate"]>$data["rate"])
			{
				$globaltotals_min["rate"]=$data["rate"];
				$globaltotals_dispmin["rate"]=GetData($data,"rate","");
			}
						if($globaltotals_max["rate"]<$data["rate"])
			{
				$globaltotals_max["rate"]=$data["rate"];
				$globaltotals_dispmax["rate"]=GetData($data,"rate","");
			}
								}
		$globaltotals_count++;
}

if($PageSize<0 || $groupno>=$pagestart && $groupno<=$pageend)
{
//	close groups
	$rowclose=array();
	$rowclose["endgroup_blogfirstline"]=true;
	$rowclose["1blogfirstline_grval"]=$groupvalue_blogfirstline;
	$rowclose["groupblogfirstline_total_cnt"]=$grouptotals_count["blogfirstline"];
//		$rowclose["groupblogfirstline_totalrate_sum"]=$grouptotals_sum["blogfirstline"]["rate"];
		$sum=array("rate"=>$grouptotals_sum["blogfirstline"]["rate"]);
		$rowclose["groupblogfirstline_totalrate_sum"]=GetData($sum,"rate","");
			if($grouptotals_count["blogfirstline"])
		{
																																			$avg=array("rate"=>$grouptotals_sum["blogfirstline"]["rate"]/$grouptotals_count["blogfirstline"]);
			$rowclose["groupblogfirstline_totalrate_avg"]=GetData($avg,"rate","");
					$rowclose["groupblogfirstline_totalrate_min"]=$grouptotals_dispmin["blogfirstline"]["rate"];
					$rowclose["groupblogfirstline_totalrate_max"]=$grouptotals_dispmax["blogfirstline"]["rate"];
							}
	if(count($rowclose))
		$rowinfo[]=$rowclose;
}

$smarty->assign("rowinfo",$rowinfo);

	$smarty->assign("page_total_cnt",$pagetotals_count);
																						//	$smarty->assign("page_totalrate_sum",$pagetotals_sum["rate"]);
	$sum=array("rate"=>$pagetotals_sum["rate"]);
	$smarty->assign("page_totalrate_sum",GetData($sum,"rate",""));
			if($pagetotals_count)
	{
				$avg=array("rate"=>$pagetotals_sum["rate"]/$pagetotals_count);
		$smarty->assign("page_totalrate_avg",GetData($avg,"rate",""));
				$smarty->assign("page_totalrate_min",$pagetotals_dispmin["rate"]);
				$smarty->assign("page_totalrate_max",$pagetotals_dispmax["rate"]);
	}
				
	$smarty->assign("global_total_cnt",$globaltotals_count);
																						//	$smarty->assign("global_totalrate_sum",$globaltotals_sum["rate"]);
	$sum=array("rate"=>$globaltotals_sum["rate"]);
	$smarty->assign("global_totalrate_sum",GetData($sum,"rate",""));
			if($globaltotals_count)
	{
				$avg=array("rate"=>$globaltotals_sum["rate"]/$globaltotals_count);
		$smarty->assign("global_totalrate_avg",GetData($avg,"rate",""));
				$smarty->assign("global_totalrate_min",$globaltotals_dispmin["rate"]);
				$smarty->assign("global_totalrate_max",$globaltotals_dispmax["rate"]);
	}
				
if($groupno)
	$smarty->assign("rowsfound",true);
	
$mypage=$_SESSION[$strTableName."_pagenumber"];
$maxpages=ceil($groupno/$PageSize);
//	write pagination
if($maxpages>1)
	$smarty->assign("pagination","<script language=\"JavaScript\">WritePagination(".$mypage.",".$maxpages.");
		function GotoPage(nPageNumber)
		{
			window.location='_comments_Report_report.php?goto='+nPageNumber;
		}
</script>");

$smarty->assign("gpp1_selected",($PageSize==1)?"selected":"");
$smarty->assign("gpp3_selected",($PageSize==3)?"selected":"");
$smarty->assign("gpp5_selected",($PageSize==5)?"selected":"");
$smarty->assign("gpp10_selected",($PageSize==10)?"selected":"");
$smarty->assign("gpp50_selected",($PageSize==50)?"selected":"");
$smarty->assign("gpp100_selected",($PageSize==100)?"selected":"");
$smarty->assign("gpp0_selected",($PageSize==-1)?"selected":"");

$smarty->assign("userid",htmlspecialchars($_SESSION["UserID"]));
$smarty->assign("guest",$_SESSION["AccessLevel"] == ACCESS_LEVEL_GUEST);


//	table selector
$strPerm = GetUserPermissions("_authors");
$smarty->assign("allow__authors",!(strpos($strPerm, "A")===false && strpos($strPerm, "S")===false));
$strPerm = GetUserPermissions("_blogs");
$smarty->assign("allow__blogs",!(strpos($strPerm, "A")===false && strpos($strPerm, "S")===false));
$strPerm = GetUserPermissions("_comments");
$smarty->assign("allow__comments",!(strpos($strPerm, "A")===false && strpos($strPerm, "S")===false));
$strPerm = GetUserPermissions("_category");
$smarty->assign("allow__category",!(strpos($strPerm, "A")===false && strpos($strPerm, "S")===false));
$strPerm = GetUserPermissions("_policy");
$smarty->assign("allow__policy",!(strpos($strPerm, "A")===false && strpos($strPerm, "S")===false));
$strPerm = GetUserPermissions("chosen authors");
$smarty->assign("allow_chosen_authors",!(strpos($strPerm, "A")===false && strpos($strPerm, "S")===false));
$strPerm = GetUserPermissions("_rate");
$smarty->assign("allow__rate",!(strpos($strPerm, "A")===false && strpos($strPerm, "S")===false));
$strPerm = GetUserPermissions("help");
$smarty->assign("allow_help",!(strpos($strPerm, "A")===false && strpos($strPerm, "S")===false));
$strPerm = GetUserPermissions("_comments Report");
$smarty->assign("allow__comments_Report",!(strpos($strPerm, "A")===false && strpos($strPerm, "S")===false));
$strPerm = GetUserPermissions("categoriesblogs");
$smarty->assign("allow_categoriesblogs",!(strpos($strPerm, "A")===false && strpos($strPerm, "S")===false));

	$smarty->assign("allow_export",CheckSecurity(@$_SESSION["_".$strTableName."_OwnerID"],"Export"));
	$smarty->assign("allow_search",CheckSecurity(@$_SESSION["_".$strTableName."_OwnerID"],"Search"));



$strSQL=$_SESSION[$strTableName."_sql"];

$templatefile = "_comments_Report_report.htm";
if(function_exists("BeforeShowReport"))
	BeforeShowReport($smarty,$templatefile);

$smarty->display($templatefile);

function GetGroupStart($field,$value)
{
	if($field=="blogfirstline")
	{
			return $value;
	}

}

function GetGroupDisplay($field,$value)
{
	global $locale_info;
	if($field=="blogfirstline")
	{
			return $value;
	}

}
?>
Return current item: Blogs manager