File size: 945B
<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/system/App.php');
echo "💩";
if ($sys->isAjax())
{
if (empty($me['cache_file'])) Base::update('user', $me['id'], ['cache_file' => $core->hash(20).'.dat']);
$cacheFile = ROOT.'/system/cache/dialogs/'.$me['cache_file'];
if (!file_exists($cacheFile)) file_put_contents($cacheFile, time(), LOCK_EX);
$lastAjaxCall = isset($_GET['timestap']) ? (int) $_GET['timestap'] : 0;
$lastChangeFile = filemtime($cacheFile);
while ($lastChangeFile <= $lastAjaxCall)
{
usleep(10000);
clearstatcache();
$lastChangeFile = filemtime($cacheFile);
}
$dataSourceFile = file_get_contents($cacheFile);
$json = [
'success' => 1,
'comment' => 'INFO: '.$dataSourceFile,
'timestap' => $lastChangeFile,
];
}
else
{
$json = [
'error' => 1,
'comment' => '404 Bad Request',
];
}
echo json_encode($json, JSON_UNESCAPED_UNICODE);