<?php require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'bootstrap.php'; // we should include header before other PHP logic because of it's search functionality $pageTitle = 'BkShp| Описание'; include dirname(__DIR__) . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . 'header.php'; // check if there is query string with book id and if it's valid. Load book data. if (Input::exists('get') && Input::found('id')) { $bookManager = new BookSelect(); $id = Input::get('id'); $book = $bookManager->getBook($id); if ($book === false) { Session::flash('home', 'Книги с указанным id(' . Input::get('id') . ') не существует'); Redirect::to('index.php'); } } else { Session::flash('home', 'Книга не указана'); Redirect::to('index.php'); } // we will check this confuguration in a few places across the page so it's better to call it once $recaptchaEnabled = Config::get('google_recaptcha/enabled') === '1' ? true : null; if ($recaptchaEnabled) { // include reCAPTCHA API echo '<script src="https://www.google.com/recaptcha/api.js?hl=ru"></script>'; // include a library that handles calling Google reCAPTCHA require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'libs' . DIRECTORY_SEPARATOR . 'recaptcha.php'; } /** * establish error handler outside the following if block because * of a need to output error information to the user **/
<?php require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'bootstrap.php'; // we need to include header first because of search functionality $pageTitle = 'BkShp| Изменить'; include dirname(__DIR__) . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . 'header.php'; // check if there is query string with book id and if it's valid. Load book data. if (Input::exists('get') && Input::found('id')) { $bookSelector = new BookSelect(); $id = Input::get('id'); $book = $bookSelector->getBook($id, true); if ($book === false) { Session::flash('home', 'Книги с указанным id(' . Input::get('id') . ') не существует'); Redirect::to('manage.php'); } } else { Session::flash('home', 'Не указана книга для редактирования'); Redirect::to('manage.php'); } /** * There isn't a way to properly check if uploaded file exceeds post_max_size * limit in php.ini, so we validate $_SERVER['CONTENT_LENGTH'] to avoid unnecessary * warnings and to make overall experience a bit more user friendly **/ $postMaxSize = Info::convertToBytes(ini_get('post_max_size')); if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['CONTENT_LENGTH'] > $postMaxSize) { Session::flash('home', 'Вы пытаетесь загрузить слишком большой файл.'); Redirect::to(); } $errorHandler = new ErrorHandler(); if (Input::exists()) {