﻿<?php

///////// Configuration ////////

require 'config.inc';


///////// Script Code /////////

 header('Cache-Control: no-cache');
 header('Pragma: no-cache');
 header('Content-Type: text/json; charset=utf-8');
 header('Expires: -1');

$param_URI = str_replace('/1.0/UpgradeCheck','',$_SERVER['REQUEST_URI']);

$i=1;
foreach ( explode('/',$param_URI) as $pair ) {
$param[$i] = $pair;
$i++;
}

 $countFilePath = $_SERVER["DOCUMENT_ROOT"].'/downloads/count_'.$KoboUpdateFile.'.txt';
 $count = file_exists($countFilePath) ? file_get_contents($countFilePath) : 0;

if ($count > 0) {
	echo '{"UpgradeType":0,"UpgradeURL":null,"ReleaseNoteURL":null,"Data":null}';
} else {
	echo '{"UpgradeType":'.$UpgradeType.',"UpgradeURL":"http://'.gethostname().'/1.0/firmwares/'.$KoboUpdateFile.'","ReleaseNoteURL":"http://'.gethostname().'/downloads/release-notes.html","Data":null}';


}

?>