"; $topViewed = "data-query=\"{$identifier}\" data-action=\"{$action}\" data-status=\"false\""; //echo $url; if($action=="search") { $identifier=str_replace(" ","-",$_GET['identifier']); $q=$identifier; $url = "https://apiv3.alarab.com/api/search/".urlencode($identifier)."/".$page; } if($action == "today") { $identifier=$_GET['identifier']; $url = "https://api.alarab.com/api/".$action."/news/".$page; } if($action == "category") { $identifier=$_GET['identifier']; $url = "https://apiv3.alarab.com/api/".$action."/".$identifier."/".$page; } if($action == "mothercategory") { $identifier=$_GET['identifier']; $url = "https://apiv3.alarab.com/api/".$action."/".$identifier."/".$page; } if($action == "blog") { $identifier=$_GET['identifier']; $url = "https://apiv3.alarab.com/api/".$action."/".$identifier."/".$page; } if($action == "copywriter") { $identifier=$_GET['identifier']; $url = "https://apiv3.alarab.com/api/".$action."/".urlencode($identifier)."/".$page; $auth=1; } if($action == "topvisitedToday") { $identifier=$_GET['identifier']; $url = "https://apiv3.alarab.com/api/".$action."/".$identifier."/01"; } echo $url; $response = getJson($url); if($identifier==4385) {$cams=1;} $result = json_decode($response); $taginfo = json_decode(json_encode($result), True); $news_arr = json_decode(json_encode($result->data), True); $ps = json_decode(json_encode($result->page_suggestions), True); $ps_table_id = json_decode(json_encode($result->standings), True); $ps_table_id =$ps_table_id[0]; if($taginfo['status_message']=="redirect" AND $taginfo['status']==200){ header("HTTP/1.1 301 Moved Permanently"); header("Location: ".$taginfo['url']); exit(); } $subMenus = json_decode(json_encode($result->filters), True); /* usort($news_arr, function ($a, $b) {return $a['articleviews'] < $b['articleviews'];}); */ if(count($news_arr)==1){ // echo "should redirect to " . $news_arr[0][url]; // Permanent 301 redirection header("HTTP/1.1 301 Moved Permanently"); header("Location: {$news_arr[0][url]}"); exit(); }/* if(count($news_arr)==0){ // echo "should redirect to " . $news_arr[0][url]; // Permanent 301 redirection header("HTTP/1.1 301 Moved Permanently"); header("Location: /explore"); exit(); }*/ $pagetitle = $result->pageTtitle; $image=$storage.$news_arr[picPath].$news_arr[picture]; $thumb=$storage.$news_arr[picPath]."/150x81/".$news_arr[picture]; $top_viewd=array(); $subcat=""; $notfit=0; $fits=0; $overallvisits=0; for($fn=0;$fn 500) { $top_viewd[]=$news_arr[$fn]; $news_arr[$fn][hot] = 1; for($s=0;$s". $news_arr[$fn][subcat].""; } } }else{ $news_arr[$fn][hot] = 0; } $news_arr[$fn][mLocation] = (int) $news_arr[$fn][mLocation] ; if($news_arr[$fn][mLocation] < 14 AND $news_arr[$fn][mLocation] > 0){ $mainews_array[]= $news_arr[$fn][ID]; $mainews_indexes[]= $fn; } } //echo "articles fit to first: " . $fits ." article doesn't fit to first : ".$notfit ." term: {$subcattext}" , $subcat; if($fits > 14 ) { $pagebreadcrumb = "
  • {$subcattext}
  • "; } // print_r($top_viewd); /* echo "page main news: " ; print_r($mainews_indexes); print_r($mainews_array); echo "page topviewd news: " ; print_r($top_viewd); echo "page news_arr news: " ; print_r($news_arr); */ if($_GET['identifier']=="حالة-الطقس" ) { $weather ="on"; } $shareimage=$news_arr[0][image]; $shareimage=str_replace("15:8","168:100",$shareimage); $shareimage=str_replace("auto_optimize=high&","",$shareimage); $shareimage=str_replace("amp;","",$shareimage); $preloadimage = $shareimage ; $mainimageopt = "&quality=90&width=168"; $smainimageopt = "&width=167"; $vsmainimageopt = "&width=167"; $mainstream_cats = array_unique($mainstream_cats); for($i=0;$i< 20;$i++){ $mainstreamBuild[] = $mainstream_cats[$i]; } for($z=0;$z{$pagesuggestion[$i]}"; $sugg3 .= ""; } for($i=0;$i< count($pagesuggestion);$i++){ $url = "/tag/".str_replace(" ","-",$pagesuggestion[$i]); echo array_count_values($final)[$i]; $sugg2 .= ""; } $cca= array(); $cca[maincatname] = $result->maincatname; $cca[maincatnameURL] = $result->maincatnameURL; $cca[smallcatname] = $result->pageTitle; $cca[smallcatnameURL] = $_SERVER[SCRIPT_NAME]; $php_file=$_SERVER['SCRIPT_NAME'] ; $settings[pageheading] = $result->pageTitle; switch ($php_file) { case "/api_based.php": $a = $_GET; $action = $a['action']; $id = $a['identifier']; switch ($action) { case "search": $settings[breadcrumb] = $pagebreadcrumb; $keywordforHREF = str_replace("-"," ",$a['identifier']); $settings[breadcrumb] .= "
  • {$keywordforHREF}
  • "; // print_r($a); break; case "copywriter": $settings[breadcrumb] = $pagebreadcrumb; $keywordforHREF = str_replace("-"," ",$a['identifier']); $settings[breadcrumb] .= "
  • {$keywordforHREF}
  • "; // print_r($a); break; case "mothercategory": $name=$cca[maincatname]; $ssurl=$cca[maincatnameURL]; $name2=$cca[smallcatname]; $ssurl2=$_SERVER['REQUEST_URI']; $settings[loadTpVisitedCarousel] = true; $settings[loadTpVisitedLeft] = true; $settings[breadcrumb] .= "
  • {$name2}
  • "; break; case "category": $name=$cca[maincatname]; $ssurl=$cca[maincatnameURL]; $name2=$cca[smallcatname]; $ssurl2=$_SERVER['REQUEST_URI']; $settings[loadTpVisitedCarousel] = true; $settings[loadTpVisitedLeft] = true; $settings[breadcrumb] .= "
  • {$name}
  • "; $settings[breadcrumb] .= "
  • {$name2}
  • "; break; case "city": $name=$cca[maincatname]; $ssurl=$cca[maincatnameURL]; $name2=$cca[smallcatname]; $ssurl2=$_SERVER['REQUEST_URI']; $settings[breadcrumb] .= "
  • اخبار
  • "; $settings[breadcrumb] .= "
  • اخبار محلية
  • "; $settings[breadcrumb] .= "
  • {$name2}
  • "; $settings[loadWeather] = true; $settings[loadTpVisitedCarousel] = true; break; default: // echo "error"; } break; default: //echo "Your favorite color is neither red, blue, nor green!"; } ?> <?=$settings[pageheading]?> | كل العرب alarab " />