<?php
include("connect.php");
include("includes/func_quran.php");
$folder=$folderquran;
$action = $_GET['action'];
if(!isset($action)) $action = "home";

IF ($action=="home"){
$m1=$d1;
$m2=$k1;
tpl_header($LANGAUGE[53]);
bar($namelinks1,$LANGAUGE[53],"","");
table($LANGAUGE[53],telawat_cats(),1);
tpl_footer();

}ELSEIF ($action=="telawat"){
$id = intval($_GET["id"]);

$sql = @mysql_query("select * from telawat_cat where id='$id' AND active='1'");
$Row = @mysql_fetch_array($sql);
if (!$Row)
{
error();
exit;
}
$Row['name_cat'] = text(3,$Row['name_cat']);
$m1 = text(3,$Row['description']);
$m2 = text(3,$Row['keywords']);

tpl_header($Row['name_cat']);
bar($namelinks1,$namelinks4,$Row['name_cat'],"");

table($Row['name_cat'],telawats(),1);

tpl_footer();

}ELSEIF ($action=="telawat_show"){

$id = intval($_GET["id"]);
$id = clean_value($id);

$sql = @mysql_query("select * from telawat where id='$id' AND active='1'");
$Row = @mysql_fetch_array($sql);
if (!$Row)
{
error();
exit;
}

$nametelawat    = text(3,$Row['name']);
$url            = text(3,$Row['url']);
$vis            = $Row['vis'];
$cat            = $Row['cat'];

$sql2 = @mysql_query("SELECT * FROM telawat_cat where id='$cat'") or die ("Query failed3");
$cats = @mysql_fetch_array($sql2);
$catnamef = text(3,$cats['name_cat']);
if ($htmlorphp=="1"){
$xxcat = "<a href='telawat_cat-$cat.html'>$catnamef</a>";
}else{
$xxcat = "<a href='quran.php?action=telawat&id=$cat'>$catnamef</a>";
}

$sql3 = @mysql_query("update telawat set vis=vis+1 where id='$id'") or die ("Query failed4");

$F = "<div align='center'>".embed($url,300,60)."</div>";
$F .= "<br />";
$F .= "<div style='padding:10px;'>
<table class='xtable' width='100%' id='Auber1f5'>
    <tr>
      <td width='30%' class='xtr'>".$LANGAUGE[148]." :</td>
      <td width='70%' class='xtd'>".$q[$nametelawat]."</td>
    </tr>
    <tr>
      <td width='30%' class='xtr'>".$LANGAUGE[145]." :</td>
      <td width='70%' class='xtd'><a href='$url'>".$LANGAUGE[89]."</a></td>
    </tr>
    <tr>
      <td width='30%' class='xtr'>".$LANGAUGE[146]." :</a></td>
      <td width='70%' class='xtd'>$catnamef</td>
    </tr>
    <tr>
      <td width='30%' class='xtr'>".$LANGAUGE[93]."</td>
      <td width='70%' class='xtd'>$vis</td>
    </tr>
  </table></div>";

//tpl_header($q[$nametelawat]);
//bar($namelinks1,$namelinks4,$xxcat,$q[$nametelawat]);

//table($q[$nametelawat],$F,1);

//tpl_footer();

echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>'.$q[$nametelawat].'</title>
<META http-equiv=Content-Type content="text/html; charset=windows-1256" />
<link rel="stylesheet" href="'.$folder.'/style.css" type="text/css" media="screen" />
</head>

<body>
<br />
<div>'.$F.'</div>
</body>
</html>';
}
?>