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();
 }
 private function redirect()
 {
     $redirect = '/dashboard';
     if (isset($_GET['redirect'])) {
         $redirect = $_GET['redirect'];
     }
     header("Location: " . Auth::getProtocol() . $_SERVER["HTTP_HOST"] . $redirect);
     exit;
 }
 public function GET__0()
 {
     Auth::forceSSL();
     $lastModified = 0;
     $now = time();
     $t3daysAgo = $now - 3 * 24 * 60 * 60;
     $date = date('Y-m-d', $t3daysAgo);
     $newsService = new NewsService();
     $template = $this->includeTemplate('dashboard/home');
     $template->news = $newsService->getNews($date, $lastModified);
     $template->now = $now;
     $template->render();
 }
 public function GET_bells_0()
 {
     Auth::forceLoggingIn();
     // angularjs based view
     $this->includeTemplate('dashboard/timetable_bells')->render();
 }
 public function GET_run_cron_0()
 {
     Auth::forceLoggingIn();
     header('Content-Type: text');
     header('Access-Control-Allow-Origin: *');
     $task = new CronTask();
     $task->run();
 }
Exemple #6
0
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL | E_STRICT);
require 'autoloader.php';
require 'config.php';
use pjanczyk\lo1olkusz\Auth;
use pjanczyk\lo1olkusz\Database;
use pjanczyk\lo1olkusz\Router;
use pjanczyk\lo1olkusz\Config;
date_default_timezone_set('Europe/Warsaw');
session_start();
Database::init(Config::getInstance()->getDatabaseConfig());
Auth::$disableSSL = true;
Auth::init();
$route = ['' => 'HomeController', 'contact' => 'ContactController', 'download' => 'DownloadController', 'dashboard' => ['' => 'Dashboard\\HomeController', 'login' => 'Dashboard\\LoginController', 'replacements' => 'Dashboard\\ReplacementController', 'lucky-numbers' => 'Dashboard\\LuckyNumberController', 'settings' => 'Dashboard\\SettingController', 'timetables' => 'Dashboard\\TimetableController', 'cron' => 'Dashboard\\CronController'], 'api' => 'ApiController'];
$path = isset($_GET['p']) ? $_GET['p'] : '';
Router::newInstance()->setNamespace('pjanczyk\\lo1olkusz\\Controller\\')->setControllerMap($route)->setErrorCallback(function () {
    header('HTTP/1.0 404 Not Found');
    include '404.html';
    exit;
})->route($path);
 public function GET__0()
 {
     Auth::forceLoggingIn();
     $this->includeTemplate('dashboard/cron')->render();
 }
 public function __construct()
 {
     Auth::forceSSL();
 }
    echo $menuItem[1];
    ?>
</a></li>
                <?php 
}
?>
            </ul>
        </div><!--/.nav-collapse -->
    </div>
</nav>

<div class="container <?php 
echo isset($wideContainer) ? '' : 'container-narrow';
?>
" role="main">



<?php 
$authenticated = \pjanczyk\lo1olkusz\Auth::isAuthenticated();
function formatTimestamp($timestamp)
{
    return date("Y-m-d H:i", $timestamp);
}
?>

<script>var authenticated = <?php 
echo $authenticated ? 'true' : 'false';
?>
;</script>