<?php
header("Content-Type: text/html; charset=utf-8");
include("includes/function.php");
if($allw_save_word == 1){
include("includes/ayat.php");

$sorax = intval($_GET['sora']);
$ayax = intval($_GET['aya']);
$typex = intval($_GET['type']);

function select($sora,$aya,$type){
global $q,$quran_type_view,$htmlorphp,$QURAN,$Q_W,$siteurl;

if(!isset($type) OR $type == 0){ $type = 1; }

if(file_exists(include_tafseerfilse($sora,$aya,$type))){
include(include_tafseerfilse($sora,$aya,$type));
}else{
$err = $Q_W[34];
}

$text_tafseer = $TAFSEER[$type][$sora][$aya];
$ayatext = $QURAN[$sora][$aya];
$ayaorders = $aya;

if($text_tafseer == ""){
$text = $Q_W[27];
}else{
$text = nl2br($text_tafseer);
}

$s = '<p>'.$ayatext.' <a href="'.$siteurl.'/'.url(9,$sora,"").'"><span>('.$ayaorders.') ('.$q[$sora].')</span></a></p>
<p>'.$err.''.$text.'</p>';

return $s;
}

if(isset($sorax) AND $sorax != 0 AND $sorax <= 114){
$sora = $sorax;
$soratitle = '&raquo; '.$q[$sora].'';
}else{
$sora = 1;
$soratitle = '';
}

if(isset($ayax) AND $ayax != 0){
$aya = $ayax;
}else{
$aya = 1;
}

if(isset($typex) AND $typex != 0 AND isset($sorax) AND $sorax != 0){
$type = $typex;
$txt = select($sora,$aya,$type);
$soratitle = '&raquo; <a href="'.url(6,$type,"").'">'.$tafseers[$type].'</a> '.$Q_W[29].' '.$q[$sora].'';
}else{

if(isset($typex) AND $typex != 0){
$type = $typex;
if($typex > count($tafseers)-1){
$type = 1;
}
$txt = all_sora_loop_tafseer(6,$type);
$soratitle = '&raquo; '.$tafseers[$type].'';
}else{
$type = 1;
$txt = all_sora_loop_tafseer(6,$type);
$soratitle = '&raquo; '.$tafseers[$type].'';
}
}

if ($htmlorphp=="1"){
$linksp = "".$siteurl."/t-".$sora."-".$type."-".$aya.".html";
}else{
$linksp = "".$siteurl."/tafseer.php?sora=".$sora."&type=".$type."&aya=".$aya."";
}

$titlepage = "".$tafseers[$type]." ".$Q_W[26]." ".$q[$sora]."";
$titlepage_en = "".$tafseers_en[$type]." Surat ".$q_english[$sora]." Aya ".$aya."";
//$nameflie = str_replace(" ","_",$titlepage_en);
header('(anti-spam-(anti-spam-content-type:)) application/msword');
header('Content-Disposition: attachment; filename="'.$titlepage_en.'.doc"');
echo '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">';
echo save4doc($titlepage,$txt,$linksp);
}else{
echo '<p align="center">not allow</p>';
}
?>