";
$root_element = "homepage";
$xml .= "<$root_element>";
error_reporting(0);
require '../include/asset.php';
require '../include/Conn.php';
require '../include/config.php';
$main_img_path = "393x213";
//$thumb_img_path="155x81";
$thumb_img_path = "150x81";
$xml .= "";
$i = 0;
$query = "
SELECT news.ID,news.fb_country,news.fb_cont,news.fb_comp,news.fb_teams,news.pdate,news.title,news.sData,news.nWriter,news.mStatus,news.mCat,news.picture,news.userInserted,news.sCat,news.smalltitle,news.picPath,news.scroll,news.udate,news.stnews,news.links,news.mLocation,news.erea,news.searchtags,news.mobilevideo,news.articleviews, ncategories2.Name as subcat
FROM news
LEFT JOIN ncategories ncategories2 ON news.sCat = ncategories2.ID
WHERE mLocation > 0 AND mLocation < 14
LIMIT 13";
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_assoc($result))
{
$sdata = $row['sData'];
if ($row['links'])
{
$goto = htmlspecialchars($row['links']);
$target = "target=\"_blank\"";
}
else
{
$goto = "/Article/" . $row['ID'];
$target = "target=\"_self\"";
}
$txt = "no";
//$row['smalltitle']=htmlentities($row['smalltitle']);
//$row['title']=htmlentities($row['title']);
//$row['sData']=htmlentities($row['sData']);
$thumb = "https://images.alarab.com/data/news/{$row['picPath']}/Croped/{$thumb_img_path}/{$row['picture']}";
$image = "https://images.alarab.com/data/news/{$row['picPath']}/Croped/{$row['picture']}";
$image125 = "https://images.alarab.com/data/news/{$row['picPath']}/Croped/{$row['picture']}?auto_optimize=high&aspect_ratio=12:9&width=125";
$image43 = "https://images.alarab.com/data/news/{$row['picPath']}/Croped/{$row['picture']}?auto_optimize=high&aspect_ratio=4:3h&width=120";
$thumb = "https://images.alarab.com/data/news/{$row['picPath']}/Croped/{$row['picture']}?auto_optimize=high&aspect_ratio=12:9";
$image = str_replace("//", "/", $image);
$image = str_replace(":/", "://", $image);
$thumb = str_replace("//", "/", $thumb);
$thumb = str_replace(":/", "://", $thumb);
$thumb = str_replace("//", "/", $thumb);
$thumb = str_replace(":/", "://", $thumb);
$txt = "no";
if ($row['stnews'] == 3)
{
$txt = "خبر عاجل";
}
if ($row['stnews'] == 2)
{
$txt = "خبر حصري";
}
if ($row['stnews'] == 1)
{
$txt = "نشر اول";
}
if ($row['stnews'] == 4)
{
$txt = "بث مباشر";
}
/*if($row[mobilevideo]!=""){
if (strpos($row[mobilevideo], 'youtube') !== false) {
$row[mobilevideo]=$row[mobilevideo];
}else{
$mp4file=basename($row[mobilevideo]);
$mp4file=str_replace(".mp4","",$mp4file);
$mp4file=str_replace(" ","",$mp4file);
if($mp4file < 122212) {
$v= "https://cdn.alarab.com/str1,,,/".$mp4file.".mp4.urlset/playlist.m3u8";
}
if($mp4file > 122211 AND $mp4file < 150000) {
$v= "https://cdn.alarab.com/vod,6,15,00/".$mp4file.".mp4.urlset/playlist.m3u8";
}
if($mp4file > 150000) {
$url='http://185.152.65.131/t/indicator.php?id='.$mp4file;
//file_get_contents() reads remote webpage content
$lines_string=file_get_contents($url);
//output, you can also save it locally on the server
htmlspecialchars($lines_string);
$lines_string=preg_replace('/\s+/', ' ', $lines_string);
$data=explode(":",$lines_string);
$renderations=str_replace(" ","",$data[0]);
$renderations=str_replace("0p","",$renderations);
$v= "https://cdn.alarab.com/vod/".$mp4file."_,".$renderations.",0p.mp4.urlset/playlist.m3u8";
if($renderations=="SD"){
$v= "https://cdn.alarab.com/vod/".$mp4file."_".$renderations.",,,.mp4.urlset/playlist.m3u8";
}
}
}
}else{
$v="no";
}*/
if ($row[mobilevideo] != "")
{
if (strpos($row[mobilevideo], 'youtube') !== false)
{
$row[mobilevideo] = $row[mobilevideo];
}
else
{
$mp4file = basename($row[mobilevideo]);
$mp4file = str_replace(".mp4", "", $mp4file);
$mp4file = str_replace(" ", "", $mp4file);
if ($mp4file < 122212)
{
$v = "https://cdn.alarab.com/str1,,,/" . $mp4file . ".mp4.urlset/playlist.m3u8";
$v = "https://cdn.alarab.com/" . $mp4file . ".mp4/index-v1-a1.m3u8";
}
if ($mp4file > 122211 and $mp4file < 150000)
{
$v = "https://cdn.alarab.com/vod,6,15,00/" . $mp4file . ".mp4.urlset/playlist.m3u8";
$v = "https://cdn.alarab.com/" . $mp4file . ".mp4/index-v1-a1.m3u8";
}
if ($mp4file > 150001 and $mp4file < 151497)
{
$v = "https://cdn.alarab.com/vod,6,15,00/" . $mp4file . ".mp4.urlset/playlist.m3u8";
}
if ($mp4file > 151496)
{
$url = 'http://render.alarab.com:8099/indicator.php?id=' . $mp4file;
//file_get_contents() reads remote webpage content
$lines_string = file_get_contents($url);
//output, you can also save it locally on the server
htmlspecialchars($lines_string);
$lines_string = preg_replace('/\s+/', ' ', $lines_string);
$data = explode(":", $lines_string);
$renderations = str_replace(" ", "", $data[0]);
$renderations = str_replace("0p", "", $renderations);
//$v= "https://cdn.alarab.com/vod/".$mp4file."_,".$renderations.",0p.mp4.urlset/playlist.m3u8";
$v = "https://cdn.alarab.com/h264/" . $mp4file . "_," . $renderations . ",0p.mp4.urlset/playlist.m3u8";
if ($renderations == "SD")
{
$v = "https://cdn.alarab.com/h264/" . $mp4file . "_" . $renderations . ",,,.mp4.urlset/playlist.m3u8";
}
}
}
}
else
{
$v = "no";
}
$xml .= "
{$row['ID']}
{$row['title']}
{$row['smalltitle']}
{$row['sData']}
{$image}
{$thumb}
{$image125}
{$image43}
{$goto}
{$target}
{$row['mLocation']}
{$txt}
{$row['mCat']}
{$row['subcat']}
/{$row['mCat']}/
{$row['ID']}
/Archive/{$row['sCat']}/1
{$row['subcat']}
{$row['articleviews']}
{$row['erea']}
{$row['udate']}
{$row['pdate']}
{$row['nWriter']}
{$row['searchtags']}
";
$i++;
}
$xml .= "";
$xml .= "";
$query = "SELECT title,ID,pdate,udate FROM news WHERE (scroll=1 AND mStatus=1) OR (mCat=2235 AND mStatus=1) ORDER BY udate DESC LIMIT 35";
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_assoc($result))
{
//$row['smalltitle']=htmlentities($row['smalltitle']);
//$row['title']=htmlentities($row['title']);
//$row['sData']=htmlentities($row['sData']);
$sdata = text_summarise($row['title'], 19);
$xml .= "
{$row['ID']}
{$row['title']}
" . date("H:i", strtotime($row['udate'])) . "
";
}
$xml .= "";
$xml .= "";
$query = "SELECT title,ID,pdate,udate,nWriter,articleviews FROM news WHERE YEARWEEK(`pdate`, 1) = YEARWEEK(CURDATE(), 1) AND mStatus=1 ORDER BY articleviews DESC LIMIT 6";
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_assoc($result))
{
//$row['smalltitle']=htmlentities($row['smalltitle']);
//$row['title']=htmlentities($row['title']);
//$row['sData']=htmlentities($row['sData']);
$sdata = text_summarise($row['title'], 19);
$xml .= "
{$row['ID']}
{$row['title']}
" . date("H:i", strtotime($row['udate'])) . "
" . $row['nWriter'] . "
" . $row['articleviews'] . "
";
}
$xml .= "";
$main_cats = array(
1,
8,
4351,
6,
3,
/* 192,*/
211,
172,
7,
12,
4382,
"الناصرة",
"أوكرانيا",
"تركيا",
"روسيا",
"الولايات المتحدة",
"الدوري الاسباني",
"الدوري الانجليزي",
192,
10,
11,
4,
16,
3308
);
$sqls = array(
"m",
"s",
"s",
"m",
"m",
/* "s",*/
"m",
"m",
"m",
"m",
"s",
"q",
"q",
"q",
"q",
"q",
"q",
"q",
"s",
"m",
"m",
"m",
"m",
"s",
);
//$main_cats=array(3,1);
$xml .= "";
for ($i = 0;$i < count($main_cats);$i++)
{
if ($sqls[$i] != "q")
{
$q = "SELECT ID,Name,MainCat FROM ncategories WHERE ID={$main_cats[$i]} ORDER BY ID DESC LIMIT 1";
$r = mysql_query($q) or die(mysql_error());
$w = mysql_fetch_assoc($r);
$id = $w['ID'];
if($w['MainCat']==0) {
$url = "/" . $w['ID'] . "/";
}else{
$url = "/Archive/" . $w['ID'] . "/1";
}
$xml .= "";
$xml .= "
{$w['Name']}
{$url}
{$id}
";
if ($sqls[$i] == "m")
{
$sub = "SELECT ID,Name FROM ncategories WHERE MainCat='$id' AND ID!=2235 ORDER BY ID DESC LIMIT 6";
}
if ($sqls[$i] == "s")
{
$sub = "SELECT ID,Name FROM ncategories WHERE ID='$id' AND ID!=2235 ORDER BY ID DESC LIMIT 6";
}
$sresult = mysql_query($sub) or die(mysql_error());
while ($srow = mysql_fetch_assoc($sresult))
{
$srow['Name'] = text_summarise($srow['Name'], 2);
$sqqql = "OR srow={$row[ID]} ";
$xml .= "{$srow['Name']}/Archive/" . $srow['ID'] . "/1";
}
}
else
{
$keywordencoded = str_replace(" ", "-", $main_cats[$i]);
$xml .= "";
$xml .= "
{$main_cats[$i]}
/tag/{$keywordencoded}
{$id}
";
}
if ($sqls[$i] == "m")
{
if($sqls[$i] == 1)
{
$query = "SELECT ID,title,sData,picture,picPath,links,mobilevideo,nWriter,pdate,searchtags ,smalltitle,stnews FROM news where mStatus=1 AND mCat=$id AND sCat!=2235 AND sCat!=8 AND mLocation > 6 ORDER BY udate DESC limit 4";
}else{
$query = "SELECT ID,title,sData,picture,picPath,links,mobilevideo,nWriter,pdate,searchtags ,smalltitle,stnews FROM news where mStatus=1 AND mCat=$id AND sCat!=2235 AND mLocation > 6 ORDER BY udate DESC limit 4";
}
}
if ($sqls[$i] == "s")
{
$query = "SELECT ID,title,sData,picture,picPath,links,mobilevideo,nWriter,pdate,searchtags ,smalltitle,stnews FROM news where mStatus=1 AND sCat=$id AND mLocation > 6 ORDER BY udate DESC limit 6";
}
if ($sqls[$i] == "q")
{
$query = "
SELECT news.ID,news.fb_country,news.fb_cont,news.fb_comp,news.fb_teams,news.pdate,news.title,news.sData,news.nWriter,news.mStatus,news.mCat,news.picture,news.userInserted,news.sCat,
news.smalltitle,news.picPath,news.scroll,news.udate,news.stnews,news.links,news.mLocation,news.erea,news.searchtags,news.mobilevideo,news.articleviews,
ncategories.Name, ncategories2.Name as subcat
FROM news
INNER JOIN `ncategories` ON news.mCat = ncategories.ID
LEFT JOIN ncategories ncategories2 ON news.sCat = ncategories2.ID
WHERE news.sCat!=2235 AND MATCH(news.title) AGAINST ('{$main_cats[$i]}' IN NATURAL LANGUAGE MODE) AND title like '%{$main_cats[$i]}%' AND mStatus=1 AND mLocation > 6 ORDER BY ID DESC LIMIT 6";
}
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_assoc($result))
{
//$row['smalltitle']=htmlentities($row['smalltitle']);
//$row['title']=htmlentities($row['title']);
//$row['sData']=htmlentities($row['sData']);
$sdata = $row['sData'];
if ($row['links'])
{
$goto = htmlspecialchars($row['links']);
$target = "target=\"_blank\"";
}
else
{
$goto = "/Article/" . $row['ID'];
$target = "target=\"_self\"";
}
$image = "https://images.alarab.com/data/news/{$row['picPath']}/Croped/{$main_img_path}/{$row['picture']}";
$thumb = "https://images.alarab.com/data/news/{$row['picPath']}/Croped/{$thumb_img_path}/{$row['picture']}";
$image = "https://images.alarab.com/data/news/{$row['picPath']}/Croped/{$row['picture']}?aspect_ratio=140:105&auto_optimize=high";
//$thumb="https://images.alarab.com/cdn-cgi/image/fit=cover,width=150,height=81,quality=100/data/news/{$row['picPath']}{$row['picture']}";
$thumb = "https://images.alarab.com/data/news/{$row['picPath']}/Croped/{$row['picture']}?auto_optimize=high&aspect_ratio=140:105";
$thumb43 = "https://images.alarab.com/data/news/{$row['picPath']}/Croped/{$row['picture']}?auto_optimize=high&aspect_ratio=4:3&width=120";
$image = str_replace("//", "/", $image);
$image = str_replace(":/", "://", $image);
$image = "https://images.alarab.com/data/news/{$row['picPath']}/Croped/{$row['picture']}";
$rounded = "https://images.alarab.com/data/news/{$row['picPath']}/Croped/{$row['picture']}?auto_optimize=high&aspect_ratio=1:1&width=100";
$thumb = str_replace("//", "/", $thumb);
$thumb = str_replace(":/", "://", $thumb);
$thumb = str_replace("//", "/", $thumb);
$thumb = str_replace(":/", "://", $thumb);
if ($row[mobilevideo] != "")
{
if (strpos($row[mobilevideo], 'youtube') !== false)
{
$row[mobilevideo] = $row[mobilevideo];
}
else
{
$mp4file = basename($row[mobilevideo]);
$mp4file = str_replace(".mp4", "", $mp4file);
$mp4file = str_replace(" ", "", $mp4file);
if ($mp4file < 122212)
{
$v = "https://cdn.alarab.com/str1,,,/" . $mp4file . ".mp4.urlset/playlist.m3u8";
$v = "https://cdn.alarab.com/" . $mp4file . ".mp4/index-v1-a1.m3u8";
}
if ($mp4file > 122211 and $mp4file < 150000)
{
$v = "https://cdn.alarab.com/vod,6,15,00/" . $mp4file . ".mp4.urlset/playlist.m3u8";
$v = "https://cdn.alarab.com/" . $mp4file . ".mp4/index-v1-a1.m3u8";
}
if ($mp4file > 150001 and $mp4file < 151497)
{
$v = "https://cdn.alarab.com/vod,6,15,00/" . $mp4file . ".mp4.urlset/playlist.m3u8";
}
if ($mp4file > 151496)
{
$url = 'http://render.alarab.com:8099/indicator.php?id=' . $mp4file;
//file_get_contents() reads remote webpage content
$lines_string = file_get_contents($url);
//output, you can also save it locally on the server
htmlspecialchars($lines_string);
$lines_string = preg_replace('/\s+/', ' ', $lines_string);
$data = explode(":", $lines_string);
$renderations = str_replace(" ", "", $data[0]);
$renderations = str_replace("0p", "", $renderations);
//$v= "https://cdn.alarab.com/vod/".$mp4file."_,".$renderations.",0p.mp4.urlset/playlist.m3u8";
$v = "https://cdn.alarab.com/h264/" . $mp4file . "_," . $renderations . ",0p.mp4.urlset/playlist.m3u8";
if ($renderations == "SD")
{
$v = "https://cdn.alarab.com/h264/" . $mp4file . "_" . $renderations . ",,,.mp4.urlset/playlist.m3u8";
}
}
}
}
else
{
$v = "no";
}
$tags = $row['searchtags'];
$word = "";
$keywords = str_replace("،", ",", $tags);
$keywords_array = explode(',', $keywords);
$word = ltrim($keywords_array[0]);
$word = ltrim($word);
$word = rtrim($word);
$word = str_replace(' ', '-', $word);
if ($word)
{
$tag = $word;
}
else
{
$tag = "alarab";
}
$txt = "no";
if ($row['stnews'] == 3)
{
$txt = "خبر عاجل";
}
if ($row['stnews'] == 2)
{
$txt = "خبر حصري";
}
if ($row['stnews'] == 1)
{
$txt = "نشر اول";
}
if ($row['stnews'] == 4)
{
$txt = "بث مباشر";
}
$xml .= "
{$row['ID']}
{$row['smalltitle']}
{$row['title']}
{$row['sData']}
{$image}
{$thumb}
{$thumb43}
{$txt}
{$row['pdate']}
{$goto}
{$target}
{$row['nWriter']}
{$tag}
{$rounded}
";
}
$xml .= "";
}
$xml .= "";
$xml .= "";
$q = "SELECT id,video FROM arabtv ORDER BY video DESC limit 10";
$res = mysql_query($q) or die(mysql_error());
while ($ids = mysql_fetch_array($res, MYSQL_ASSOC))
{
$artid = $ids['video'];
$query = "SELECT ID,title,smalltitle,picPath,picture,stnews,sData,mobilevideo,pdate,udate,articleviews FROM news WHERE ID=$artid AND mStatus=1 ORDER by id desc";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_assoc($result);
$image = "https://images.alarab.com/data/news/{$row['picPath']}/Croped/{$main_img_path}/{$row['picture']}";
$thumb = "https://images.alarab.com/data/news/{$row['picPath']}/Croped/{$thumb_img_path}/{$row['picture']}";
$image = "https://images.alarab.com/data/news/{$row['picPath']}/Croped/{$row['picture']}";
//$thumb="https://images.alarab.com/cdn-cgi/image/fit=cover,width=150,height=81,quality=100/data/news/{$row['picPath']}{$row['picture']}";
$thumb = "https://images.alarab.com/data/news/{$row['picPath']}/Croped/{$row['picture']}?aspect_ratio=140:105&auto_optimize=high";
$image = str_replace("//", "/", $image);
$image = str_replace(":/", "://", $image);
$thumb = str_replace("//", "/", $thumb);
$thumb = str_replace(":/", "://", $thumb);
$thumb = str_replace("//", "/", $thumb);
$thumb = str_replace(":/", "://", $thumb);
$sdata = text_summarise($row['sData'], 3);
$title = text_summarise($row['smalltitle'], 6);
$aLink = GenerateLinks("Article", $row['title'], $row['ID'], true);
if ($row['mobilevideo'] != '')
{
$v = str_replace('&', '&', $row['mobilevideo']);
}
else
{
$v = "no";
}
$xml .= "
{$row['ID']}
{$row['smalltitle']}
{$row['title']}
{$row['sData']}
{$row['pdate']}
{$row['articleviews']}
{$thumb}
{$goto}
{$target}
";
}
$xml .= "";
$xml .= "$root_element>";
header('Content-type: application/xml');
echo $xml;
mysql_close($conn);