mirror of
https://github.com/UnickSoft/graphonline.git
synced 2025-08-17 00:26:30 +00:00
Added cross domain grap loading.
This commit is contained in:
parent
7848441c56
commit
53ed898c68
18
backend/crossDomain.php
Normal file
18
backend/crossDomain.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
Function to save/open graph
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Domains of service.
|
||||||
|
$domains = array(
|
||||||
|
"graphonline.ru",
|
||||||
|
"graphonline.top",
|
||||||
|
);
|
||||||
|
|
||||||
|
function isCurrentDomain($domain)
|
||||||
|
{
|
||||||
|
return strtolower($domain) == strtolower($_SERVER['SERVER_NAME']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
@ -2,12 +2,33 @@
|
|||||||
|
|
||||||
include ("../core/config/main.php");
|
include ("../core/config/main.php");
|
||||||
include ("saveGraphHelpers.php");
|
include ("saveGraphHelpers.php");
|
||||||
|
include ("crossDomain.php");
|
||||||
|
|
||||||
$name = $_GET["name"];
|
$name = $_GET["name"];
|
||||||
|
$log = "";
|
||||||
if (isValidName($name))
|
if (isValidName($name))
|
||||||
{
|
{
|
||||||
echo (gzuncompress(file_get_contents(getXMLFileName($name))));
|
$content = file_get_contents(getXMLFileName($name));
|
||||||
|
// Try to find on extarnal domains
|
||||||
|
if (false === $content)
|
||||||
|
{
|
||||||
|
foreach ($domains as $domain)
|
||||||
|
{
|
||||||
|
if (!isCurrentDomain($domain))
|
||||||
|
{
|
||||||
|
$log .= "<!-- Search in $domain -->\n";
|
||||||
|
$content = file_get_contents("https://" . $domain . "/" . getXMLFileName($name, true));
|
||||||
|
if (false !== $content)
|
||||||
|
{
|
||||||
|
$content = $content;
|
||||||
|
$log .= "<!-- Got from $domain -->\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo (gzuncompress($content) . $log);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo ("");
|
echo ("");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user