return sprintf($format, $string); }], 'e_html'); try { $cfg = new Config('lib/database.ini'); $driver = '\\Snabb\\Database\\Drivers\\' . $cfg['Database']['use'] . '\\Connection'; if (strpos(strtolower($cfg['Database']['use']), 'sqlite') !== false) { $db = new $driver($cfg[$cfg['Database']['use']]['file']); } else { if (isset($cfg[$cfg['Database']['use']]['port'])) { $db = new $driver($cfg[$cfg['Database']['use']]['host'], $cfg[$cfg['Database']['use']]['user'], $cfg[$cfg['Database']['use']]['password'], $cfg[$cfg['Database']['use']]['database'], $cfg[$cfg['Database']['use']]['port']); } else { $db = new $driver($cfg[$cfg['Database']['use']]['host'], $cfg[$cfg['Database']['use']]['user'], $cfg[$cfg['Database']['use']]['password'], $cfg[$cfg['Database']['use']]['database']); } } } catch (\Snabb\Database\Exception $e) { $tmpl->renderTop('Připojení s databází selhalo'); $tmpl->addMessage('Připojení s databází selhalo.', Template::MESSAGE_ERROR); $tmpl->renderBottom(); exit; } $user = false; if (isset($_COOKIE[USER_COOKIE_NAME])) { if (sha1($_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT']) === substr($_COOKIE[USER_COOKIE_NAME], 40) and $auth = $db->query('SELECT user_id, nick, email, app_admin_from FROM users WHERE password = '******'./lib/RouterTable.php'; $router = new Snabb\Routing\PrivilegedRouter($table, 'pages/', 'errors/not_found.php', 'errors/access_denied.php'); $to_require = $router->findRoute(function ($routePrivilege) use($user) {