public function GET__0()
 {
     $settings = new SettingRepository();
     $apkPath = Config::getInstance()->getApkFilePath();
     $alerts = [];
     if (isset($_FILES['apk']) && $_FILES['apk']['error'] == UPLOAD_ERR_OK) {
         Auth::forceLoggingIn();
         $tempPath = $_FILES['apk']["tmp_name"];
         if (move_uploaded_file($tempPath, $apkPath)) {
             $alerts[] = 'Zaktualizowano plik APK';
         }
     }
     if (isset($_POST['version'])) {
         Auth::forceLoggingIn();
         if ($settings->setVersion($_POST['version'])) {
             $alerts[] = 'Zaktualizowano wersję aplikacji';
         }
     }
     $statistics = new StatisticRepository();
     $template = $this->includeTemplate('dashboard/settings');
     $template->alerts = $alerts;
     $template->version = $settings->getVersion();
     $template->statRest = $statistics->getStatistics(StatisticRepository::REST_API, 14);
     $template->statDownload = $statistics->getStatistics(StatisticRepository::DOWNLOAD, 14);
     $template->statHome = $statistics->getStatistics(StatisticRepository::HOME_PAGE, 14);
     if (file_exists($apkPath)) {
         $template->apkMd5 = md5_file($apkPath);
         $template->apkLastModified = filemtime($apkPath);
     }
     $template->render();
 }
 public function __construct()
 {
     function getParameter($name, $defaultValue)
     {
         if (isset($_GET[$name])) {
             return urldecode($_GET[$name]);
         } else {
             return $defaultValue;
         }
     }
     $version = intval(getParameter('v', '0'));
     $androidId = getParameter('aid', '');
     $statistics = new StatisticRepository();
     $statistics->increaseVisits(StatisticRepository::REST_API, date('Y-m-d'), $version, $androidId);
 }
 public function GET__0()
 {
     $settings = new SettingRepository();
     $version = $settings->getVersion();
     $statistics = new StatisticRepository();
     $statistics->increaseVisits(StatisticRepository::DOWNLOAD, date('Y-m-d'), $version, '');
     $path = Config::getInstance()->getApkFilePath();
     if (file_exists($path)) {
         header('Content-Type: application/vnd.android.package-archive');
         header('Content-Disposition: attachment; filename="lo1olkusz-app.apk"');
         readfile($path);
     } else {
         header('HTTP/1.0 404 Not Found');
         readfile('html/404.html');
     }
 }
 public function GET__0()
 {
     $statistics = new StatisticRepository();
     $statistics->increaseVisits(StatisticRepository::HOME_PAGE, date('Y-m-d'), 0, '');
     $this->includeTemplate('home')->render();
 }