diff --git a/.gitignore b/.gitignore index bffac2c..51193cf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea/* application/config/* +logs/* \ No newline at end of file diff --git a/application/App.php b/application/App.php new file mode 100644 index 0000000..bcf65d9 --- /dev/null +++ b/application/App.php @@ -0,0 +1,49 @@ +guard = AuthorizationGuard::getInstance(); + $this->route = new Route(); + $request = new Request(); + } + + public static function getInstance() + { + if (is_null(self::$instance)) { + self::$instance = new self(); + } + + return self::$instance; + } + + public function run() + { + $this->isAuth = $this->guard->isAuthorized(); + + $this->route->start(); + } + +} \ No newline at end of file diff --git a/application/bootstrap.php b/application/bootstrap.php index 807f735..12089d6 100644 --- a/application/bootstrap.php +++ b/application/bootstrap.php @@ -9,12 +9,10 @@ use \application\core\Route; - - require_once 'core/BaseModel.php'; require_once 'core/BaseView.php'; require_once 'core/BaseController.php'; require_once 'core/Route.php'; - -Route::start(); // запускаем маршрутизатор \ No newline at end of file +$route = new Route(); +$route->start(); \ No newline at end of file diff --git a/application/components/AuthorizationGuard.php b/application/components/AuthorizationGuard.php new file mode 100644 index 0000000..d1366e2 --- /dev/null +++ b/application/components/AuthorizationGuard.php @@ -0,0 +1,138 @@ +security = new Security(); + $this->userRepository = new UserRepository(); + } + + // вот через этот метод мы будем получать инстанс + // если класс не был инстанцирован, делаем это + // если был, пропускаем этот шаш и сразу возвращаем инстанс + // итого: у нас всегда будет один и тот же экзмепляр этого класса + public static function getInstance() + { + if (is_null(self::$instance)) { + self::$instance = new self(); + } + + return self::$instance; + } + + // простой геттер + public function getCurrentUser() + { + return $this->currentUser; + } + + // простой сеттер + public function setCurrentUser(User $user) + { + return $this->currentUser = $user; + } + + // регистрация + public function registerUser(array $data) + { + $data['password'] = $this->security->encode($data['password']); + unset($data['password_check']); + if ($this->userRepository->add($data)) { + return true; + } else { + $this->errors[] = $this->userRepository->getError(); + return false; + } + } + + // авторизация + public function authUser(array $data = null) + { + if ($this->isAuthorized()) { + return true; + } + $user = new User(); + $passwordHash = $this->userRepository->get(['email' => $data['email']], 'password'); + $success = $this->security->checkPassword($data['password'], $passwordHash[0]['password']); + if (!$success) { + $this->errors['message'] = 'Неверный email или пароль'; + return false; + } + $user->getByEmail($data['email']); + $cookie = $this->security->encode($data['email'] . $passwordHash[0]['password']); + setcookie('isAuth', $cookie, strtotime('+30 days'), '/'); + $this->userRepository->edit($user->getId(), ['cookie' => $cookie]); + $this->setCurrentUser($user); + + return true; //smth|bool|User|че там надо; + } + + public function isAuthorized() + { + + $user = new User(); + + if (!isset($_COOKIE['isAuth'])) { + return false; + } + + $result = $this->userRepository->get(['cookie' => $_COOKIE['isAuth']]); + if (!empty($result)) { + $user->getByEmail($result[0]['email']); + $this->setCurrentUser($user); + return true; + } + + setcookie('isAuth', '', strtotime( '-1 days' ), '/'); + return false; + } + /** + * @return array + */ + public function getErrors(): array + { + return $this->errors; + } +} \ No newline at end of file diff --git a/application/components/Request.php b/application/components/Request.php new file mode 100644 index 0000000..059f496 --- /dev/null +++ b/application/components/Request.php @@ -0,0 +1,13 @@ + 'validateRequired', + 'email' => 'validateEmail', + 'string' => 'validateString', + 'phone' => 'validatePhone', + 'password' => 'validatePassword', + 'unique' => 'validateUnique' + ]; + + /** + * @param array $arrayOfData + * @param array $rules + * @return bool + */ + public function validate($arrayOfData, $rules) + { + // проверка совпадений паролей + if (array_key_exists('password', $arrayOfData) && array_key_exists('password_check', $arrayOfData)) { + $this->passwordCheck[] = $arrayOfData['password']; + $this->passwordCheck[] = $arrayOfData['password_check']; + } + foreach ($arrayOfData as $attribute => $value) { + if (array_key_exists($attribute, $rules)) { + $tmpRules = explode('|', $rules[$attribute]); + foreach ($tmpRules as $rule) { + if (!isset($this->validatorsMapping[$rule])) { + throw new InvalidValidatorException(); + } + + if ($rule == 'unique') { + $this->unique = $attribute; + } + $method = $this->validatorsMapping[$rule]; + if(!$this->$method($value)) { + // Если нет значения -> записываем, есть значение -> нет + if (!array_key_exists('attribute', $this->errorMessages)) { + $this->errorAttributes[] = $attribute; + } else { + if (!in_array($attribute, $this->errorAttributes)) { + $this->errorAttributes[] = $attribute; + } + } + } + } + } + } + if (!empty($this->errorMessages)) { + return false; + } + + return true; + } + + /** + * Проверка телефона + * @param $inputPhone + * @return bool + */ + protected function validatePhone($inputPhone) + { + $inputPhone = $this->clean($inputPhone); + $inputPhone = str_replace(['+', ' ', '(' , ')', '-'], '', $inputPhone); + // только ли цифры? + if (!is_numeric($inputPhone)) { + $this->errorMessages[] = 'Введен неверный формат телфона'; + return false; + } + // Длина телефона + if (!$this->checkLength($inputPhone,6,12)) { + $this->errorMessages[] = 'Телефон введен верно?'; + return false; + } + + return true; + } + + /** + * Обязательное поле. + * Не пустая ли значние + * @param $input + * @return bool + */ + protected function validateRequired($input) + { + if (empty($input)) { + // Если есть такая ошибка, больше не пишет данную ошибку + if (!in_array('Поля не должны быть пустыми', $this->errorMessages)) { + $this->errorMessages[] = 'Поля не должны быть пустыми'; + } + return false; + } + return true; + } + + /** + * Строковое значение + * @param $input + * @return bool + */ + protected function validateString($input) + { + $input = $this->clean($input); + return is_string($input); + } + + /** + * Проверка email + * @param $inputEmail + * @return bool + */ + protected function validateEmail($inputEmail) + { + $inputEmail = $this->clean($inputEmail); + if (!filter_var($inputEmail, FILTER_VALIDATE_EMAIL)) { + $this->errorMessages[] = 'Email введен неверно'; + return false; + } + + return true; + } + + /** + * проверка пароля + * @param $inputPassword + * @return bool + */ + protected function validatePassword($inputPassword) + { + if (!empty($this->passwordCheck) && $this->passwordCheck[0] != $this->passwordCheck[1]) { + $this->errorMessages[] = 'Введенные пароли не совпадают'; + return false; + } + $inputPassword = $this->clean($inputPassword); + if (!$this->checkLength($inputPassword, 6, 200)) { + $this->errorMessages[] = 'Пароль должен быть больше 6-ти символов'; + return false; + } + + return true; + } + + protected function validateUnique($input) + { + $repository = new UserRepository(); + if ($repository->get([$this->unique => $input], $this->unique)) { + $this->errorMessages[] = 'Пользователь с таким ' . $this->unique . ' уже существует'; + return false; + } + + return true; + } + + /** + * Возвращает массив с ошибками + * @return array + */ + public function getErrorsMessages() + { + return $this->errorMessages; + } + + /** + * Массив с атрибутами полей + * @return array + */ + public function getErrorsAttributes() + { + return $this->errorAttributes; + } + + public function getErrors() + { + return [ + 'errors' => $this->errorMessages, + 'attributes' => $this->errorAttributes + ]; + } + + /** + * Функция для проверки длины input'а + * @param string $value - input field + * @param $min + * @param $max + * @return bool + */ + protected function checkLength($value = "", $min, $max) + { + $result = (mb_strlen($value) < $min || mb_strlen($value) > $max); + return !$result; + } + + /** + * Отчиста данных от html и php тегов + * @param string $value + * @return string + */ + protected function clean($value = "") + { + $value = trim($value); + $value = stripslashes($value); + $value = strip_tags($value); + $value = htmlspecialchars($value); + + return $value; + } +} +?> \ No newline at end of file diff --git a/application/contracts/PasswordEncoder.php b/application/contracts/PasswordEncoder.php new file mode 100644 index 0000000..23622b9 --- /dev/null +++ b/application/contracts/PasswordEncoder.php @@ -0,0 +1,18 @@ +view->render('administration_view.php'); + } + +} \ No newline at end of file diff --git a/application/controllers/ControllerAuthorization.php b/application/controllers/ControllerAuthorization.php new file mode 100644 index 0000000..017dbc3 --- /dev/null +++ b/application/controllers/ControllerAuthorization.php @@ -0,0 +1,102 @@ +view->render('authorization_view.php','template_view.php'); + } + + /** + * ControllerLogin constructor. + */ + public function __construct() + { + parent::__construct(); + $this->guard = AuthorizationGuard::getInstance(); + } + + public function actionRegister() + { + if (!isset($_POST['registerForm'])) { + $this->view->render('register_view.php'); + throw new InvalidInputDataException(); + return false; + } + $data = $_POST['registerForm']; + $rules = [ + 'name' => 'string|required', + 'phone' => 'string|phone|unique', + 'email' => 'string|required|email|unique', + 'password' => 'string|required|password', + 'password_check' => 'string|required' + ]; + + // Валидация + $validation = new Validator(); + $formIsValid = $validation->validate($data, $rules); + if($formIsValid) { + if ($this->guard->registerUser($data)) { + $this->view->render('register_view.php', ['success' => 'Регистрация прошла успешно :)']); + return true; + } + + $this->view->render('register_view.php', ['errors' => 'Что-то пошло не так... Попробуйте позже :)']); + } else { + $this->view->render('register_view.php', $validation->getErrors()); + } + } + + /** + * + */ + public function actionLogin(){ + + if (!isset($_POST['loginForm'])) { + echo "error"; + } + $validation = new Validator(); + $rules = [ + 'email' => 'string|required|email', + 'password' => 'string|required|password' + ]; + $formIsValid = $validation->validate($_POST['loginForm'], $rules); + if ($formIsValid) { + if ($this->guard->authUser($_POST['loginForm'])) { +// header ('Location: /');*/ + $this->view->render("site_view.php"); + } else { + $errors = $this->guard->getErrors(); + $this->view->render('authorization_view.php', ['errors' => $errors['message']]); + } + } else { + $this->view->render('authorization_view.php', ['errors' => 'Некоректные значения.']); + } + } + + public function actionLogout() + { + setcookie('isAuth', '', strtotime( '-1 days' ), '/'); + header ('Location: /'); + } + + public function actionFormRegister() + { + $this->view->render('register_view.php','template_view.php'); + } + +} diff --git a/application/controllers/ControllerLogin.php b/application/controllers/ControllerLogin.php deleted file mode 100644 index 9a9f009..0000000 --- a/application/controllers/ControllerLogin.php +++ /dev/null @@ -1,38 +0,0 @@ -view->render('login_view.php','template_view.php'); - } - - - public function actionRegister() - { - $user = new User(); - if (!isset($_POST['submitted'])) { - $error = require_once '../application/views/error_view.php'; - } - $this->view->render('register_view.php','template_view.php',['error' => $error]); - //$user->checkInput($_POST); - // - } - - public function actionFormRegister() - { - $this->view->render('register_view.php','template_view.php'); - } - -} diff --git a/application/controllers/ControllerSite.php b/application/controllers/ControllerSite.php index 589db09..d240d79 100644 --- a/application/controllers/ControllerSite.php +++ b/application/controllers/ControllerSite.php @@ -7,16 +7,17 @@ */ namespace application\controllers; +use application\App; +use application\components\AuthorizationGuard; use application\core\BaseController; -use application\repositories; - +use application\repositories\CategoryRepository; class ControllerSite extends BaseController { function actionIndex() { - $categories = new \application\repositories\CategoryRepository(); + $categories = new CategoryRepository(); $data = $categories->getAllRows(); - $this->view->render('site_view.php', 'template_view.php',['categories' => $data]); + $this->view->render('site_view.php', ['categories' => $data]); } } \ No newline at end of file diff --git a/application/core/BaseController.php b/application/core/BaseController.php index f3d1b8d..8a10eae 100644 --- a/application/core/BaseController.php +++ b/application/core/BaseController.php @@ -7,10 +7,17 @@ */ namespace application\core; +use application\components\Validator; + class BaseController { + /** + * ХДЕ ПХПДОК КОММЕНТАРИИ??!!!! + */ + protected $view; + function __construct() { $this->view = new BaseView(); @@ -19,4 +26,9 @@ function __construct() function actionIndex() { } + + protected function validate() + { + $validate = new Validator(); + } } \ No newline at end of file diff --git a/application/core/BaseModel.php b/application/core/BaseModel.php index 78fe12b..da50035 100644 --- a/application/core/BaseModel.php +++ b/application/core/BaseModel.php @@ -16,7 +16,7 @@ class BaseModel /** * @var $repository экземпляр класса репозитория */ - protected $repository; + protected $table; public function getTable() { diff --git a/application/core/BaseView.php b/application/core/BaseView.php index 805e252..ceaf491 100644 --- a/application/core/BaseView.php +++ b/application/core/BaseView.php @@ -5,16 +5,33 @@ * Date: 01.08.17 * Time: 15:20 */ + namespace application\core; + class BaseView { - protected $templateView = "template_view.php"; // здесь можно указать общий вид по умолчанию. + /** + * Шаблон используемый по умолчанию + * @var $templateView + */ + protected $templateView = "template_view.php"; - function render($contentView, $templateView, $data = null) + /** + * @param $contentView контент + * @param $templateView шаблон + * @param $data массив с данными передаваемые в шаблон + */ + function render($contentView, $data = null, $templateView = null) { if (is_array($data)) { extract($data); } - include __DIR__.'/../views/'.$templateView; + + if (!is_null($templateView)) { + $this->templateView = $templateView; + } + + + require_once __DIR__.'/../views/layout/' . $this->templateView; } } diff --git a/application/core/Route.php b/application/core/Route.php index bd4cce7..2e8cd21 100644 --- a/application/core/Route.php +++ b/application/core/Route.php @@ -7,79 +7,57 @@ */ namespace application\core; - - - +use application\helpers\MyException; class Route { - // контроллер и действие по умолчанию - private static $modelName = 'model'; - private static $controllerName = 'Site'; - private static $actionName = 'index'; + protected $controllerName = 'Site'; + protected $actionName = 'index'; - - public static function start() + public function start() { $routes = explode('/', $_SERVER['REQUEST_URI']); // получаем имя контроллера if (!empty($routes[1])) { - self::$controllerName = ucfirst($routes[1]); + $this->controllerName = ucfirst($routes[1]); } // получаем имя экшена if (!empty($routes[2])) { - self::$actionName = $routes[2]; + $this->actionName = $routes[2]; } // добавляем префиксы - self::setPrefix(self::$controllerName,self::$actionName); - - // подцепляем файл с классом модели (файла модели может и не быть) - $modelFile = self::$modelName.'.php'; - $modelPath = "../application/models/".$modelFile; - - if (file_exists($modelPath)) { - require $modelPath; - } + $this->setPrefix($this->controllerName, $this->actionName); // подцепляем файл с классом контроллера - $controllerPath = '../application/controllers/'.self::$controllerName.'.php'; + $controllerPath = '../application/controllers/' . $this->controllerName . '.php'; if (file_exists($controllerPath)) { - require $controllerPath; + require_once $controllerPath; } else { - //self::ErrorPage404(); + } // создаем контроллер - $controllerName = '\\application\\controllers\\'.self::$controllerName; + $controllerName = '\\application\\controllers\\' . $this->controllerName; $controller = new $controllerName; - $action = self::$actionName; + $action = $this->actionName; if (method_exists($controller, $action)) { // вызываем действие контроллера $controller->$action(); } else { - //self::ErrorPage404(); + } } - private function setPrefix($controller, $action = null) + protected function setPrefix($controller, $action = null) { - self::$modelName = $controller; - self::$controllerName = 'Controller'.$controller; - self::$actionName = 'action'.$action; + $this->controllerName = 'Controller' . $controller; + $this->actionName = 'action' . $action; } - - private function ErrorPage404() - { - $host = 'http://'.$_SERVER['HTTP_HOST'].'/'; - header('HTTP/1.1 404 Not Found'); - header("Status: 404 Not Found"); - header('Location:'.$host.'404'); - } } diff --git a/application/dbal/Database.php b/application/dbal/Database.php index be1a69f..aa81981 100644 --- a/application/dbal/Database.php +++ b/application/dbal/Database.php @@ -8,14 +8,14 @@ namespace application\dbal; +use \Exception; use PDO; class Database { - /** - * ссылка на подключение к БД - * @var PDO - */ + + protected static $instance = null; + protected $pdo; /** @@ -24,16 +24,28 @@ class Database */ protected $error; - public function __construct() + private function __construct() { $this->pdo = $this->getDB(); } /** - * @param $data массив с входными данными + * @return PDO + */ + public static function getInstance() + { + if(is_null(self::$instance)) { + self::$instance = new self; + } + + return self::$instance; + } + + /** + * @param $data array * @return array [columns,values,anchors] */ - public function getPreparedData($data) + public function getPreparedData(array $data) { $columns = []; $values = []; @@ -41,7 +53,7 @@ public function getPreparedData($data) foreach ($data as $key => $value) { $columns[] = $key; $values[] = $value; - $anchors[] = ":".$key; + $anchors[] = ":" . $key; } return [ 'columns' => $columns, @@ -56,14 +68,13 @@ public function getPreparedData($data) */ public function getDB(){ if (is_null($this->pdo)) { - $database = require_once '../application/config/database.php'; - $this->pdo = new PDO( - 'mysql:host=' . $database['host'] . - ';dbname='. - $database['database'] .';charset=utf8;', - $database['user'], - $database['password'] - ); + try{ + $database = include '../application/config/database.php'; + $this->pdo = new PDO('mysql:host='.$database['host'].';dbname='. + $database['database'].';charset=utf8;', $database['user'], $database['password']); + } catch (Exception $exception) { + echo $exception->getMessage(); + } } return $this->pdo; } @@ -129,13 +140,12 @@ public function makeSelect($sql, $data = null) $this->error = $statement->errorInfo(); return false; } - } /** * Метод, который присваевает якорям их значения - * @param $statement - * @param $data [values[0], anchors[1]] + * @param $statement подготовленный sql запрос + * @param $data [array values[0], array anchors[1]] * @return mixed $statement */ protected function bindParams($statement, $data) @@ -145,9 +155,9 @@ protected function bindParams($statement, $data) if (is_array($values) and is_array($anchors)) { foreach ($values as $key => $value) { if (is_numeric($value)) { - $statement->bindValue($anchors[$key],$value,PDO::PARAM_INT); + $statement->bindValue($anchors[$key], $value, PDO::PARAM_INT); } else { - $statement->bindValue($anchors[$key],$value,PDO::PARAM_STR); + $statement->bindValue($anchors[$key], $value, PDO::PARAM_STR); } } } else { diff --git a/application/helpers/Log.php b/application/helpers/Log.php new file mode 100644 index 0000000..4cb4ebb --- /dev/null +++ b/application/helpers/Log.php @@ -0,0 +1,39 @@ +time = date("H:i:s"); + $this->message = $this->time . " "; + $this->message .= $message . PHP_EOL; + file_put_contents($this->file, $this->message, FILE_APPEND | LOCK_EX); + } +} \ No newline at end of file diff --git a/application/models/Cake.php b/application/models/Cake.php index 8872757..a6c5aa4 100644 --- a/application/models/Cake.php +++ b/application/models/Cake.php @@ -11,6 +11,9 @@ class Cake extends BaseModel { + /** + * Все эти методы должны обрабатываться контроллером тортиков + */ public function add() { diff --git a/application/models/User.php b/application/models/User.php index 75b4ae5..42057ec 100644 --- a/application/models/User.php +++ b/application/models/User.php @@ -9,34 +9,81 @@ use application\core\BaseModel; use application\repositories\UserRepository; - +use application\components\Security; class User extends BaseModel { - protected $repository; + protected $table = 'users'; - public function __construct() - { - $this->repository = new UserRepository(); - } + protected $id; + + protected $email; + + protected $isAdmin = false; + + protected $age; - public function checkInput($input) + + public function getByEmail($email) { - if (!isset($input['submitted'])) { - return false; + $repository = new UserRepository(); + $data = $repository->get(['email' => $email]); + if(!empty($data)) { + $this->setData($data[0]); + return true; } - return true; + return false; } - public function register($data) + protected function setData(array $data) { - var_dump($data); - if (!is_null($data)) { - if ($data['password'] === $data['password_check']) { - array_pop($data); - $this->repository->add($data); + foreach ($data as $key => $value) { + if (property_exists($this,$key)) { + $this->$key = $value; } } } + + /** + * @return mixed + */ + public function getId() + { + return $this->id; + } + + /** + * @return mixed + */ + public function getAge() + { + return $this->age; + } + + /** + * @param mixed $age + */ + public function setAge($age) + { + $this->age = $age; + } + + /** + * @return mixed + */ + public function getEmail() + { + return $this->email; + } + + /** + * @param mixed $email + */ + public function setEmail($email) + { + $this->email = $email; + } + + } diff --git a/application/repositories/BaseRepository.php b/application/repositories/BaseRepository.php index b9c91ce..7c012a2 100644 --- a/application/repositories/BaseRepository.php +++ b/application/repositories/BaseRepository.php @@ -8,8 +8,9 @@ namespace application\repositories; use application\dbal\Database; -abstract class BaseRepository{ +abstract class BaseRepository +{ /** * @var Database $connection */ @@ -23,13 +24,38 @@ abstract class BaseRepository{ public function __construct() { - $this->connection = new Database(); + $this->connection = Database::getInstance(); } /** - * Возвращает все торты из бд + * Возвращает массив с заданными параметрами + * @param array $parameters (example 'where $parameters') + * @param string|null $columns (example 'id,name') + * @return array + */ + public function get(array $parameters, $columns = null) + { + $dataToExecute = $this->connection->getPreparedData($parameters); + foreach ($dataToExecute['columns'] as $key => $value) { + $columnAndAnchor[] = $value . ' = ' . $dataToExecute['anchors'][$key]; + } + $columnAndAnchor = implode(' and ', $columnAndAnchor); + if ($columns) { + $sql = "SELECT $columns FROM $this->table WHERE $columnAndAnchor"; + } else { + $sql = "SELECT * FROM $this->table WHERE $columnAndAnchor"; + } + + if($result = $this->connection->makeSelect($sql,[$dataToExecute['values'],$dataToExecute['anchors']])) { + return $result; + } + return []; + } + + /** + * Изменение записи в бд + * @param $id * @param $data - * @return array|bool */ public function edit($id, $data) { @@ -45,42 +71,62 @@ public function edit($id, $data) $this->runQuery($sql,[$dataToExecute['values'], $dataToExecute['anchors']]); } + /** + * Добавление записи в таблицу + * @param $data + * @return bool + */ public function add($data) { $dataToExecute = $this->connection->getPreparedData($data); - $anchors = implode(',',$dataToExecute['anchors']); - $columns = implode(',',$dataToExecute['columns']); + $anchors = implode(',', $dataToExecute['anchors']); + $columns = implode(',', $dataToExecute['columns']); $sql = "INSERT INTO $this->table (". $columns . ") VALUES (" . $anchors . ')'; - $this->runQuery($sql, [$dataToExecute['values'], $dataToExecute['anchors']]); + $result = $this->runQuery($sql, [$dataToExecute['values'], $dataToExecute['anchors']]); + return $result; } + /** + * Все записи из таблицы $table + * @return array|bool + */ public function getAllRows() { $sql = "SELECT * FROM $this->table"; $data = $this->connection->makeSelect($sql); return $data; } + /** * Удаление из таблицы элемента по id * @param $id */ - public function deleteById($id) + public function delete($id) { $sql = "DELETE FROM $this->table WHERE id = :id"; $this->runQuery($sql,[[$id], [':id']]); } + public function getError() + { + return $this->connection->getError(); + } + /** * Проверка на выполнение запроса * Если запрос неудачный, показывает ошибку * @param $sql * @param null|array $values + * @return bool */ protected function runQuery($sql, $values = null) { if(!$this->connection->executeQuery($sql, $values)) { - var_dump($this->connection->getError()); + //var_dump($this->connection->getError()); + return false; } + return true; } + } \ No newline at end of file diff --git a/application/repositories/CakeRepository.php b/application/repositories/CakeRepository.php index 1a89f34..a84c904 100644 --- a/application/repositories/CakeRepository.php +++ b/application/repositories/CakeRepository.php @@ -11,26 +11,4 @@ class CakeRepository extends BaseRepository { protected $table = 'cakes'; - - - /** - * Возвращает массив с заданными параметрами - * @param array $parameters (example 'where $parameters') - * @param string|null $columns (example 'id,name') - * @return array|bool - */ - public function getCakes($parameters, $columns = null) - { - $dataToExecute = $this->connection->getPreparedData($parameters); - foreach ($dataToExecute['columns'] as $key => $value) { - $columnAndAnchor[] = $value . ' = ' . $dataToExecute['anchors'][$key]; - } - $columnAndAnchor = implode(' and ',$columnAndAnchor); - if ($columns) { - $sql = "SELECT $columns FROM $this->table WHERE $columnAndAnchor"; - } else { - $sql = "SELECT * FROM $this->table WHERE $columnAndAnchor"; - } - return $this->connection->makeSelect($sql,[$dataToExecute['values'],$dataToExecute['anchors']]); - } } \ No newline at end of file diff --git a/application/repositories/UserRepository.php b/application/repositories/UserRepository.php index 12bcfd2..06ee2df 100644 --- a/application/repositories/UserRepository.php +++ b/application/repositories/UserRepository.php @@ -11,21 +11,4 @@ class UserRepository extends BaseRepository { protected $table = 'users'; - public function add($data) - { - $data['password'] = $this->setPassword($data['password']); - parent::add($data); - } - - - public function editPassword() - { - - } - - - protected function setPassword($password) - { - return password_hash($password,PASSWORD_DEFAULT); - } } \ No newline at end of file diff --git a/application/views/administration_view.php b/application/views/administration_view.php new file mode 100644 index 0000000..e69de29 diff --git a/application/views/login_view.php b/application/views/authorization_view.php similarity index 54% rename from application/views/login_view.php rename to application/views/authorization_view.php index a4b1b9c..fd373a5 100644 --- a/application/views/login_view.php +++ b/application/views/authorization_view.php @@ -3,13 +3,16 @@
-
-

Login Form

+ +

Войти

+
- +
- +
diff --git a/application/views/error_view.php b/application/views/error_view.php index e826297..e69de29 100644 --- a/application/views/error_view.php +++ b/application/views/error_view.php @@ -1,7 +0,0 @@ -
-

1

-

2

-

3

-

4

-

5

-
\ No newline at end of file diff --git a/application/views/layout/template_view.php b/application/views/layout/template_view.php new file mode 100644 index 0000000..f576992 --- /dev/null +++ b/application/views/layout/template_view.php @@ -0,0 +1,24 @@ + + + + + Тестовая страница + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/application/views/register_view.php b/application/views/register_view.php index 59049e5..4d62ac6 100644 --- a/application/views/register_view.php +++ b/application/views/register_view.php @@ -1,35 +1,63 @@ - - - - -
-
- - -

Register Form

-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
- -
-
- +
+
+

Форма регистрации

+
+ + value="" value="" class="error" /> +
+
+ + value="" value="" class="error" /> +
+
+ + value="" value="" class="error" /> +
+
+ + class="error" /> +
+
+ +
+
+ +
+
+ + +
+

Упс! Ошибочки...

+
+ '; + } + ?> +
+
+ +
+

Теперь ты в наших рядах

+ +
+ +
+ + + diff --git a/application/views/site_view.php b/application/views/site_view.php index 03deb5c..6ce1827 100644 --- a/application/views/site_view.php +++ b/application/views/site_view.php @@ -8,16 +8,20 @@ - Добавить торт + Добавить торт
diff --git a/application/views/template_view.php b/application/views/template_view.php deleted file mode 100644 index 66826e2..0000000 --- a/application/views/template_view.php +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Тестовая страница - - - - - - - \ No newline at end of file diff --git a/logs/error.log b/logs/error.log new file mode 100644 index 0000000..f2fb2b5 --- /dev/null +++ b/logs/error.log @@ -0,0 +1,364 @@ +20:14:00 +20:14:49 Call to a member function prepare() on null +20:15:29 0 +20:15:29 0 +20:15:30 0 +20:15:30 0 +20:15:30 0 +20:15:30 0 +20:15:30 0 +20:15:30 0 +20:15:30 0 +20:15:30 0 +20:15:30 0 +20:15:30 0 +20:16:12 Call to a member function prepare() on null 0 +20:17:02 Call to a member function prepare() on null 0 +20:17:03 Call to a member function prepare() on null 0 +20:17:07 Call to a member function prepare() on null 0 +20:17:07 Call to a member function prepare() on null 0 +20:17:12 Call to a member function prepare() on null 0 +20:17:37 Call to a member function prepare() on null +20:24:42 Call to a member function prepare() on null +20:25:17 Call to a member function prepare() on null +20:26:16 Call to a member function prepare() on null +20:26:42 Call to a member function prepare() on null +20:26:54 Call to a member function prepare() on null +20:27:05 Call to a member function prepare() on null +20:27:11 Call to a member function prepare() on null +20:27:29 Call to a member function prepare() on null +20:28:00 Call to a member function prepare() on null +20:28:12 Call to a member function prepare() on null +20:28:26 Call to a member function prepare() on null +10:52:24 Class '\application\controllers\ControllerFavicon.ico' not found +10:52:31 Class '\application\controllers\ControllerRegestration' not found +10:52:44 Class '\application\controllers\ControllerRegistration' not found +10:52:58 Class '\application\controllers\ControllerRegister' not found +14:43:49 Class '\application\controllers\ControllerFavicon.ico' not found +19:26:27 Class '\application\controllers\ControllerFavicon.ico' not found +20:57:04 Class '\application\controllers\ControllerFavicon.ico' not found +20:57:08 Class '\application\controllers\ControllerFavicon.ico' not found +20:57:08 Class '\application\controllers\ControllerFavicon.ico' not found +21:18:41 Class '\application\controllers\ControllerFavicon.ico' not found +21:18:43 Class '\application\controllers\ControllerFavicon.ico' not found +21:18:46 Class '\application\controllers\ControllerFavicon.ico' not found +21:18:49 Class '\application\controllers\ControllerFavicon.ico' not found +21:20:24 Class '\application\controllers\ControllerFavicon.ico' not found +21:20:27 Class '\application\controllers\ControllerFavicon.ico' not found +21:20:28 Class '\application\controllers\ControllerFavicon.ico' not found +21:20:28 Class '\application\controllers\ControllerFavicon.ico' not found +21:20:34 Class '\application\controllers\ControllerFavicon.ico' not found +21:20:35 Class '\application\controllers\ControllerFavicon.ico' not found +21:20:36 Class '\application\controllers\ControllerFavicon.ico' not found +21:20:36 Class '\application\controllers\ControllerFavicon.ico' not found +21:20:38 Class '\application\controllers\ControllerFavicon.ico' not found +21:20:39 Class '\application\controllers\ControllerFavicon.ico' not found +21:21:09 Class '\application\controllers\ControllerFavicon.ico' not found +21:21:10 Class '\application\controllers\ControllerFavicon.ico' not found +21:21:10 Class '\application\controllers\ControllerFavicon.ico' not found +21:21:11 Class '\application\controllers\ControllerFavicon.ico' not found +21:21:11 Class '\application\controllers\ControllerFavicon.ico' not found +21:21:22 Class '\application\controllers\ControllerFavicon.ico' not found +21:21:23 Class '\application\controllers\ControllerFavicon.ico' not found +21:21:24 Class '\application\controllers\ControllerFavicon.ico' not found +21:21:25 Class '\application\controllers\ControllerFavicon.ico' not found +21:21:56 Class '\application\controllers\ControllerFavicon.ico' not found +21:21:56 Class '\application\controllers\ControllerFavicon.ico' not found +21:21:58 Class '\application\controllers\ControllerFavicon.ico' not found +21:25:36 Class '\application\controllers\ControllerFavicon.ico' not found +21:48:05 Class 'application\helpers\Validator' not found +21:48:05 Class '\application\controllers\ControllerFavicon.ico' not found +21:48:36 Class 'application\helpers\Validator' not found +21:48:36 Class '\application\controllers\ControllerFavicon.ico' not found +21:50:12 Class 'application\helpers\Validator' not found +21:50:12 Class '\application\controllers\ControllerFavicon.ico' not found +21:50:14 Class 'application\helpers\Validator' not found +21:50:14 Class '\application\controllers\ControllerFavicon.ico' not found +21:50:35 Class 'application\helpers\Validator' not found +21:50:35 Class '\application\controllers\ControllerFavicon.ico' not found +21:50:36 Class 'application\helpers\Validator' not found +21:50:36 Class '\application\controllers\ControllerFavicon.ico' not found +21:51:07 Class '\application\controllers\ControllerFavicon.ico' not found +22:04:35 Call to undefined method application\helpers\Validator::getErrors() +22:04:35 Class '\application\controllers\ControllerFavicon.ico' not found +22:05:28 Class '\application\controllers\ControllerFavicon.ico' not found +22:05:39 Class '\application\controllers\ControllerFavicon.ico' not found +22:05:40 Class '\application\controllers\ControllerFavicon.ico' not found +22:05:41 Class '\application\controllers\ControllerFavicon.ico' not found +22:05:42 Class '\application\controllers\ControllerFavicon.ico' not found +22:05:56 syntax error, unexpected 'foreach' (T_FOREACH) +22:05:56 Class '\application\controllers\ControllerFavicon.ico' not found +22:06:03 Class '\application\controllers\ControllerFavicon.ico' not found +22:06:46 Class '\application\controllers\ControllerFavicon.ico' not found +22:07:13 Class '\application\controllers\ControllerFavicon.ico' not found +22:08:45 Class '\application\controllers\ControllerFavicon.ico' not found +22:08:47 Class '\application\controllers\ControllerFavicon.ico' not found +22:12:22 Class '\application\controllers\ControllerFavicon.ico' not found +22:12:24 Class '\application\controllers\ControllerFavicon.ico' not found +22:12:33 Class '\application\controllers\ControllerFavicon.ico' not found +22:12:50 Class '\application\controllers\ControllerFavicon.ico' not found +22:13:02 Class '\application\controllers\ControllerFavicon.ico' not found +22:13:39 Class '\application\controllers\ControllerFavicon.ico' not found +22:13:40 Class '\application\controllers\ControllerFavicon.ico' not found +22:13:53 Class '\application\controllers\ControllerFavicon.ico' not found +22:13:54 Class '\application\controllers\ControllerFavicon.ico' not found +22:13:54 Class '\application\controllers\ControllerFavicon.ico' not found +22:13:55 Class '\application\controllers\ControllerFavicon.ico' not found +22:13:56 Class '\application\controllers\ControllerFavicon.ico' not found +22:13:56 Class '\application\controllers\ControllerFavicon.ico' not found +22:13:56 Class '\application\controllers\ControllerFavicon.ico' not found +22:14:20 Class '\application\controllers\ControllerFavicon.ico' not found +22:14:21 Class '\application\controllers\ControllerFavicon.ico' not found +22:14:23 Class '\application\controllers\ControllerFavicon.ico' not found +22:14:23 Class '\application\controllers\ControllerFavicon.ico' not found +22:14:24 Class '\application\controllers\ControllerFavicon.ico' not found +22:14:24 Class '\application\controllers\ControllerFavicon.ico' not found +22:14:27 Class '\application\controllers\ControllerFavicon.ico' not found +22:14:29 Class '\application\controllers\ControllerFavicon.ico' not found +22:14:35 Class '\application\controllers\ControllerFavicon.ico' not found +22:14:37 Class '\application\controllers\ControllerFavicon.ico' not found +22:14:52 Class '\application\controllers\ControllerFavicon.ico' not found +22:15:34 Class '\application\controllers\ControllerFavicon.ico' not found +23:06:18 Class 'application\helpers\InvalidValidatorException' not found +23:06:18 Class '\application\controllers\ControllerFavicon.ico' not found +23:06:29 Method name must be a string +23:06:29 Class '\application\controllers\ControllerFavicon.ico' not found +23:07:34 Method name must be a string +23:07:34 Class '\application\controllers\ControllerFavicon.ico' not found +23:11:14 Method name must be a string +23:11:14 Class '\application\controllers\ControllerFavicon.ico' not found +23:11:29 Method name must be a string +23:11:29 Class '\application\controllers\ControllerFavicon.ico' not found +23:12:02 Method name must be a string +23:12:02 Class '\application\controllers\ControllerFavicon.ico' not found +23:16:40 Method name must be a string +23:16:40 Class '\application\controllers\ControllerFavicon.ico' not found +23:17:06 Method name must be a string +23:17:06 Class '\application\controllers\ControllerFavicon.ico' not found +23:17:28 Method name must be a string +23:17:28 Class '\application\controllers\ControllerFavicon.ico' not found +23:17:45 Method name must be a string +23:17:45 Class '\application\controllers\ControllerFavicon.ico' not found +23:18:15 Method name must be a string +23:18:15 Class '\application\controllers\ControllerFavicon.ico' not found +23:18:30 Method name must be a string +23:18:30 Class '\application\controllers\ControllerFavicon.ico' not found +23:18:40 Method name must be a string +23:18:40 Class '\application\controllers\ControllerFavicon.ico' not found +23:19:13 Method name must be a string +23:19:13 Class '\application\controllers\ControllerFavicon.ico' not found +23:20:17 Method name must be a string +23:20:17 Class '\application\controllers\ControllerFavicon.ico' not found +23:20:43 Class '\application\controllers\ControllerFavicon.ico' not found +23:32:33 Class '\application\controllers\ControllerFavicon.ico' not found +23:33:25 Class '\application\controllers\ControllerFavicon.ico' not found +23:33:26 Class '\application\controllers\ControllerFavicon.ico' not found +23:33:27 Class '\application\controllers\ControllerFavicon.ico' not found +23:34:02 Class '\application\controllers\ControllerFavicon.ico' not found +23:34:18 Class '\application\controllers\ControllerFavicon.ico' not found +23:34:29 Class '\application\controllers\ControllerFavicon.ico' not found +23:34:37 Class '\application\controllers\ControllerFavicon.ico' not found +23:34:45 Class '\application\controllers\ControllerFavicon.ico' not found +23:35:07 Class '\application\controllers\ControllerFavicon.ico' not found +23:35:14 Class '\application\controllers\ControllerFavicon.ico' not found +23:35:40 Class '\application\controllers\ControllerFavicon.ico' not found +23:36:18 Class '\application\controllers\ControllerFavicon.ico' not found +23:45:11 Class '\application\controllers\ControllerFavicon.ico' not found +23:45:46 Class '\application\controllers\ControllerFavicon.ico' not found +23:45:59 Class '\application\controllers\ControllerFavicon.ico' not found +23:46:01 Class '\application\controllers\ControllerFavicon.ico' not found +23:46:17 Class '\application\controllers\ControllerFavicon.ico' not found +23:46:20 Class '\application\controllers\ControllerFavicon.ico' not found +23:46:31 Class '\application\controllers\ControllerFavicon.ico' not found +23:46:58 Class '\application\controllers\ControllerFavicon.ico' not found +23:47:11 Class '\application\controllers\ControllerFavicon.ico' not found +23:47:24 Class '\application\controllers\ControllerFavicon.ico' not found +23:47:27 Class '\application\controllers\ControllerFavicon.ico' not found +23:47:28 Class '\application\controllers\ControllerFavicon.ico' not found +23:47:28 Class '\application\controllers\ControllerFavicon.ico' not found +23:47:40 Class '\application\controllers\ControllerFavicon.ico' not found +23:48:19 Class '\application\controllers\ControllerFavicon.ico' not found +23:48:21 Class '\application\controllers\ControllerFavicon.ico' not found +23:49:25 Class '\application\controllers\ControllerFavicon.ico' not found +23:49:27 Class '\application\controllers\ControllerFavicon.ico' not found +23:49:44 syntax error, unexpected 'return' (T_RETURN), expecting ',' or ';' +23:49:44 Class '\application\controllers\ControllerFavicon.ico' not found +23:49:50 Class '\application\controllers\ControllerFavicon.ico' not found +23:49:55 Class '\application\controllers\ControllerFavicon.ico' not found +23:49:56 Class '\application\controllers\ControllerFavicon.ico' not found +23:50:28 Class '\application\controllers\ControllerFavicon.ico' not found +23:50:56 Class '\application\controllers\ControllerFavicon.ico' not found +23:51:09 Class '\application\controllers\ControllerFavicon.ico' not found +23:51:12 Class '\application\controllers\ControllerFavicon.ico' not found +23:51:29 Class '\application\controllers\ControllerFavicon.ico' not found +23:52:40 Class '\application\controllers\ControllerFavicon.ico' not found +23:52:41 Class '\application\controllers\ControllerFavicon.ico' not found +23:53:10 Class '\application\controllers\ControllerFavicon.ico' not found +23:53:40 Class '\application\controllers\ControllerFavicon.ico' not found +23:54:50 Class '\application\controllers\ControllerFavicon.ico' not found +23:55:51 Class '\application\controllers\ControllerFavicon.ico' not found +23:56:08 Class '\application\controllers\ControllerFavicon.ico' not found +23:56:33 Class '\application\controllers\ControllerFavicon.ico' not found +00:05:44 Class '\application\controllers\ControllerFavicon.ico' not found +00:05:59 Class '\application\controllers\ControllerFavicon.ico' not found +00:06:26 Class '\application\controllers\ControllerFavicon.ico' not found +00:06:27 Class '\application\controllers\ControllerFavicon.ico' not found +00:06:34 Class '\application\controllers\ControllerFavicon.ico' not found +00:06:52 Class '\application\controllers\ControllerFavicon.ico' not found +00:06:56 Class '\application\controllers\ControllerFavicon.ico' not found +00:07:00 Class '\application\controllers\ControllerFavicon.ico' not found +00:07:01 Class '\application\controllers\ControllerFavicon.ico' not found +00:07:12 Class '\application\controllers\ControllerFavicon.ico' not found +00:07:51 Class '\application\controllers\ControllerFavicon.ico' not found +00:07:54 Class '\application\controllers\ControllerFavicon.ico' not found +00:08:33 Class '\application\controllers\ControllerFavicon.ico' not found +00:08:58 Class '\application\controllers\ControllerFavicon.ico' not found +00:09:16 Class '\application\controllers\ControllerFavicon.ico' not found +00:09:24 Class '\application\controllers\ControllerFavicon.ico' not found +00:09:49 Class '\application\controllers\ControllerFavicon.ico' not found +00:09:51 Class '\application\controllers\ControllerFavicon.ico' not found +00:10:04 Class '\application\controllers\ControllerFavicon.ico' not found +00:10:09 Class '\application\controllers\ControllerFavicon.ico' not found +20:04:11 Class '\application\controllers\ControllerFavicon.ico' not found +20:04:11 Class '\application\controllers\ControllerFavicon.ico' not found +22:58:08 Class '\application\controllers\ControllerFavicon.ico' not found +22:58:08 Class '\application\controllers\ControllerFavicon.ico' not found +23:15:34 Class '\application\controllers\ControllerFavicon.ico' not found +11:08:44 Class '\application\controllers\ControllerFavicon.ico' not found +12:24:50 syntax error, unexpected '}' +12:31:06 [] operator not supported for strings +18:28:47 Class '\application\controllers\ControllerFavicon.ico' not found +12:11:08 Class '\application\controllers\ControllerFavicon.ico' not found +12:42:59 Class '\application\controllers\ControllerFavicon.ico' not found +12:43:00 Class '\application\controllers\ControllerFavicon.ico' not found +12:43:16 Class '\application\controllers\ControllerFavicon.ico' not found +12:45:14 Class '\application\controllers\ControllerFavicon.ico' not found +12:45:45 Class '\application\controllers\ControllerFavicon.ico' not found +12:50:01 Class '\application\controllers\ControllerFavicon.ico' not found +12:50:04 Class '\application\controllers\ControllerFavicon.ico' not found +12:50:13 Class '\application\controllers\ControllerFavicon.ico' not found +12:50:59 Class '\application\controllers\ControllerFavicon.ico' not found +12:51:08 Class '\application\controllers\ControllerFavicon.ico' not found +12:51:10 Class '\application\controllers\ControllerFavicon.ico' not found +12:51:25 Class '\application\controllers\ControllerFavicon.ico' not found +12:51:53 Class '\application\controllers\ControllerFavicon.ico' not found +12:52:20 Class '\application\controllers\ControllerFavicon.ico' not found +12:52:43 Class '\application\controllers\ControllerFavicon.ico' not found +12:52:48 Class '\application\controllers\ControllerFavicon.ico' not found +12:54:02 Class '\application\controllers\ControllerFavicon.ico' not found +12:54:11 Class '\application\controllers\ControllerFavicon.ico' not found +12:54:15 Class '\application\controllers\ControllerFavicon.ico' not found +12:54:41 Class '\application\controllers\ControllerFavicon.ico' not found +12:54:42 Class '\application\controllers\ControllerFavicon.ico' not found +12:54:55 Class '\application\controllers\ControllerFavicon.ico' not found +12:54:56 Class '\application\controllers\ControllerFavicon.ico' not found +12:54:57 Class '\application\controllers\ControllerFavicon.ico' not found +12:55:04 Class '\application\controllers\ControllerFavicon.ico' not found +12:55:32 Class '\application\controllers\ControllerFavicon.ico' not found +12:55:35 Class '\application\controllers\ControllerFavicon.ico' not found +12:55:37 Class '\application\controllers\ControllerFavicon.ico' not found +12:55:41 Class '\application\controllers\ControllerFavicon.ico' not found +12:55:44 Class '\application\controllers\ControllerFavicon.ico' not found +12:57:08 Class '\application\controllers\ControllerFavicon.ico' not found +12:57:11 Class '\application\controllers\ControllerFavicon.ico' not found +12:57:26 Class '\application\controllers\ControllerFavicon.ico' not found +12:57:34 Class '\application\controllers\ControllerFavicon.ico' not found +12:57:44 Class '\application\controllers\ControllerFavicon.ico' not found +12:57:53 Class '\application\controllers\ControllerFavicon.ico' not found +12:57:57 Class '\application\controllers\ControllerFavicon.ico' not found +12:58:01 Class '\application\controllers\ControllerFavicon.ico' not found +12:58:08 Class '\application\controllers\ControllerFavicon.ico' not found +13:00:19 Class '\application\controllers\ControllerFavicon.ico' not found +13:00:25 Call to a member function prepare() on null +13:00:25 Class '\application\controllers\ControllerFavicon.ico' not found +13:00:33 Call to a member function prepare() on null +13:00:33 Class '\application\controllers\ControllerFavicon.ico' not found +13:00:55 Call to a member function prepare() on null +13:00:55 Class '\application\controllers\ControllerFavicon.ico' not found +13:00:57 Class '\application\controllers\ControllerFavicon.ico' not found +13:01:03 Call to a member function prepare() on null +13:01:03 Class '\application\controllers\ControllerFavicon.ico' not found +13:02:00 Call to a member function prepare() on null +13:02:00 Class '\application\controllers\ControllerFavicon.ico' not found +13:02:15 Class '\application\controllers\ControllerFavicon.ico' not found +13:02:20 Class '\application\controllers\ControllerFavicon.ico' not found +13:02:26 Class '\application\controllers\ControllerFavicon.ico' not found +17:57:27 Class '\application\controllers\ControllerFavicon.ico' not found +17:59:16 syntax error, unexpected ';' +17:59:19 syntax error, unexpected ';' +17:59:21 syntax error, unexpected ';' +18:04:42 Call to undefined method application\models\User::getItem() +18:04:45 Call to undefined method application\models\User::getItem() +18:07:09 Argument 1 passed to application\dbal\Database::getPreparedData() must be of the type array, string given, called in /home/oleg/Sites/learn.php/application/repositories/BaseRepository.php on line 38 +18:07:10 Argument 1 passed to application\dbal\Database::getPreparedData() must be of the type array, string given, called in /home/oleg/Sites/learn.php/application/repositories/BaseRepository.php on line 38 +14:04:25 Class '\application\controllers\ControllerFavicon.ico' not found +12:59:53 Class '\application\controllers\ControllerFavicon.ico' not found +13:00:29 Argument 1 passed to application\components\Security::encode() must be of the type string, null given, called in /home/oleg/Sites/learn.php/application/models/User.php on line 29 +20:25:10 Class '\application\controllers\ControllerFavicon.ico' not found +20:25:10 Class '\application\controllers\ControllerFavicon.ico' not found +16:08:47 Class '\application\controllers\ControllerFavicon.ico' not found +16:08:47 Class '\application\controllers\ControllerFavicon.ico' not found +21:28:41 Class '\application\controllers\ControllerFavicon.ico' not found +21:28:41 Class '\application\controllers\ControllerFavicon.ico' not found +21:40:00 Class '\application\controllers\ControllerFavicon.ico' not found +21:40:00 Class '\application\controllers\ControllerFavicon.ico' not found +22:03:30 Call to undefined method application\repositories\UserRepository::addUser() +22:04:05 Call to undefined method application\repositories\UserRepository::getErrors() +22:07:29 Call to undefined method application\repositories\UserRepository::getErrors() +22:07:30 Call to undefined method application\repositories\UserRepository::getErrors() +22:07:49 Call to undefined method application\repositories\UserRepository::getErrors() +22:07:52 Call to undefined method application\repositories\UserRepository::getErrors() +22:08:46 Call to undefined method application\repositories\UserRepository::getErrors() +22:08:47 Call to undefined method application\repositories\UserRepository::getErrors() +22:09:00 Call to undefined method application\repositories\UserRepository::getErrors() +22:09:01 Call to undefined method application\repositories\UserRepository::getErrors() +17:14:37 Class '\application\controllers\ControllerFavicon.ico' not found +17:14:37 Class '\application\controllers\ControllerFavicon.ico' not found +17:14:37 syntax error, unexpected ')' +17:15:16 Call to undefined method application\components\AuthorizationGuard::getInstanse() +17:15:17 Call to undefined method application\components\AuthorizationGuard::getInstanse() +17:26:07 Call to a member function prepare() on null +17:27:28 Call to a member function prepare() on null +17:27:29 Call to a member function prepare() on null +17:27:30 Call to a member function prepare() on null +17:27:31 Call to a member function prepare() on null +17:27:32 Call to a member function prepare() on null +17:34:42 Class '\application\controllers\ControllerFavicon.ico' not found +17:34:42 Class '\application\controllers\ControllerFavicon.ico' not found +12:09:03 Class '\application\controllers\ControllerFavicon.ico' not found +13:29:21 Undefined class constant 'instance' +13:34:45 Call to a member function add() on null +13:35:56 Call to undefined method application\components\AuthorizationGuard::getError() +20:11:27 Class '\application\controllers\ControllerFavicon.ico' not found +20:32:06 Argument 1 passed to application\dbal\Database::getPreparedData() must be of the type array, string given, called in /home/oleg/Sites/learn.php/application/repositories/BaseRepository.php on line 38 +20:33:26 [] operator not supported for strings +20:34:25 Argument 1 passed to application\repositories\BaseRepository::get() must be of the type array, string given, called in /home/oleg/Sites/learn.php/application/components/Validator.php on line 167 +21:14:21 syntax error, unexpected end of file, expecting elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF) +21:28:41 syntax error, unexpected ':' +20:12:49 Class '\application\controllers\ControllerFavicon.ico' not found +20:12:49 Class '\application\controllers\ControllerFavicon.ico' not found +10:39:58 Class '\application\controllers\ControllerFavicon.ico' not found +10:39:58 Class '\application\controllers\ControllerFavicon.ico' not found +10:41:51 Argument 2 passed to application\components\Security::checkPassword() must be of the type string, array given, called in /home/oleg/Sites/learn.php/application/components/AuthorizationGuard.php on line 95 +10:42:04 Argument 2 passed to application\components\Security::checkPassword() must be of the type string, array given, called in /home/oleg/Sites/learn.php/application/components/AuthorizationGuard.php on line 95 +20:54:24 Class '\application\controllers\ControllerFavicon.ico' not found +20:54:24 Class '\application\controllers\ControllerFavicon.ico' not found +19:54:00 Class '\application\controllers\ControllerFavicon.ico' not found +19:32:15 Class '\application\controllers\ControllerFavicon.ico' not found +19:32:15 Class '\application\controllers\ControllerFavicon.ico' not found +20:14:52 syntax error, unexpected '->' (T_OBJECT_OPERATOR) +20:14:54 syntax error, unexpected '->' (T_OBJECT_OPERATOR) +20:31:22 syntax error, unexpected ')' +20:31:24 syntax error, unexpected ')' +21:23:59 Class '\application\controllers\ControllerFavicon.ico' not found +21:24:36 syntax error, unexpected ')' +11:07:19 syntax error, unexpected ')' +11:07:20 Class '\application\controllers\ControllerFavicon.ico' not found +11:07:20 Class '\application\controllers\ControllerFavicon.ico' not found +11:22:00 syntax error, unexpected ')' +11:22:01 syntax error, unexpected ')' +21:50:42 Class '\application\controllers\ControllerLogin' not found +21:50:45 Class '\application\controllers\ControllerLogin' not found +22:05:31 Argument 1 passed to application\components\Security::checkPassword() must be of the type string, null given, called in /home/oleg/Sites/learn.php/application/components/AuthorizationGuard.php on line 100 +22:05:48 Argument 1 passed to application\components\AuthorizationGuard::authUser() must be of the type array, string given, called in /home/oleg/Sites/learn.php/application/controllers/ControllerAuthorization.php on line 79 +22:58:35 Class '\application\controllers\ControllerAll-lots' not found diff --git a/www/.htaccess b/www/.htaccess new file mode 100644 index 0000000..8c060be --- /dev/null +++ b/www/.htaccess @@ -0,0 +1,4 @@ +RewriteEngine on +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule . / diff --git a/www/index.php b/www/index.php index 632cd6a..3dfe96a 100755 --- a/www/index.php +++ b/www/index.php @@ -1,26 +1,34 @@ writeLog($exception->getMessage()); + echo '
';
+    var_dump($exception);
+    echo '
'; +} function my_autoload($className) { - $className = str_replace('\\',DIRECTORY_SEPARATOR,$className); - $file = __DIR__.'/..'.DIRECTORY_SEPARATOR. $className . '.php'; + $className = str_replace('\\',DIRECTORY_SEPARATOR, $className); + $file = __DIR__.'/..'.DIRECTORY_SEPARATOR . $className . '.php'; if(file_exists($file)){ require_once $file; } } - // автозагрузка классов spl_autoload_register('my_autoload'); -require_once '../application/bootstrap.php'; - - +//обработчик ошибок +set_exception_handler('errorHandler'); +require_once '../application/App.php'; +$application = \application\App::getInstance(); +$application->run(); ?> diff --git a/www/styles/style_register.css b/www/styles/style_register.css index b499758..9120dd4 100644 --- a/www/styles/style_register.css +++ b/www/styles/style_register.css @@ -52,22 +52,22 @@ form:after { text-shadow: 0 1px 0 #fff; width: 400px; } -#content h1 { +#content > h1 { color: #7E7E7E; font: bold 25px Helvetica, Arial, sans-serif; letter-spacing: -0.05em; line-height: 20px; margin: 10px 0 30px; } -#content h1:before, -#content h1:after { +#content > h1:before, +#content > h1:after { content: ""; height: 1px; position: absolute; top: 10px; width: 27%; } -#content h1:after { +#content > h1:after { background: rgb(126,126,126); background: -moz-linear-gradient(left, rgba(126,126,126,1) 0%, rgba(255,255,255,1) 100%); background: -webkit-linear-gradient(left, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%); @@ -76,7 +76,7 @@ form:after { background: linear-gradient(left, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%); right: 0; } -#content h1:before { +#content > h1:before { background: rgb(126,126,126); background: -moz-linear-gradient(right, rgba(126,126,126,1) 0%, rgba(255,255,255,1) 100%); background: -webkit-linear-gradient(right, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%); @@ -86,7 +86,9 @@ form:after { left: 0; } #content:after, -#content:before { +#content:before, +#results:before, +#results:after{ background: #f9f9f9; background: -moz-linear-gradient(top, rgba(248,248,248,1) 0%, rgba(249,249,249,1) 100%); background: -webkit-linear-gradient(top, rgba(248,248,248,1) 0%,rgba(249,249,249,1) 100%); @@ -102,7 +104,7 @@ form:after { position: absolute; width: 100%; } -#content:after { +#content:after,#results:after { -webkit-transform: rotate(2deg); -moz-transform: rotate(2deg); -ms-transform: rotate(2deg); @@ -111,7 +113,7 @@ form:after { top: 0; z-index: -1; } -#content:before { +#content:before, #results:before { -webkit-transform: rotate(-3deg); -moz-transform: rotate(-3deg); -ms-transform: rotate(-3deg); @@ -148,19 +150,20 @@ form:after { } #content form input[type="text"]:focus, #content form input[type="password"]:focus { - -webkit-box-shadow: 0 0 2px #ed1c24 inset; - -moz-box-shadow: 0 0 2px #ed1c24 inset; - -ms-box-shadow: 0 0 2px #ed1c24 inset; - -o-box-shadow: 0 0 2px #ed1c24 inset; - box-shadow: 0 0 2px #ed1c24 inset; + -webkit-box-shadow: 0 0 2px #419c23 inset; + -moz-box-shadow: 0 0 2px #419c23 inset; + -ms-box-shadow: 0 0 2px #419c23 inset; + -o-box-shadow: 0 0 2px #419c23 inset; + box-shadow: 0 0 2px #419c23 inset; background-color: #fff; - border: 1px solid #ed1c24; + border: 1px solid #419c23; outline: none; } #username { background-position: 10px 10px !important } #password { background-position: 10px -53px !important } #content form input[type="submit"] { + transition: all .4s; background: rgb(254,231,154); background: -moz-linear-gradient(top, rgba(254,231,154,1) 0%, rgba(254,193,81,1) 100%); background: -webkit-linear-gradient(top, rgba(254,231,154,1) 0%,rgba(254,193,81,1) 100%); @@ -242,4 +245,66 @@ form:after { color: #00aeef; } +#results, #success{ + transition: all .9s ease-out .3s; + -webkit-transform: rotate(-3deg); + -moz-transform: rotate(-3deg); + -ms-transform: rotate(-3deg); + -o-transform: rotate(-3deg); + transform: rotate(-3deg); + top: 0; + z-index: -3; + border: 1px solid #c4c6ca; + font: 14px Arial; + background-color: #fff; + position: absolute; + width: 350px; + left: 0; +} +#results.active, #success.active{ + left: 110%; + transform: rotate(0deg); +} +#results h1, #success h1{ + color: #C65E5E; + font: bold 25px Helvetica, Arial, sans-serif; + letter-spacing: -0.05em; + line-height: 20px; + margin: 30px 0 0; +} +#success h1{ + color: #419c23; +} +.errors-wrapper, .success-wrapper{ + text-align: left; + padding: 20px 20px; + font: 17px Arial; +} +.success-wrapper a{ + color: #563D64; +} +.success-wrapper a:first-child{ + display: inline-block; + margin-top: 20px; + margin-right: 21px; +} +#content form input.error{ + -webkit-box-shadow: 0 0 2px #C65E5E inset; + -moz-box-shadow: 0 0 2px #C65E5E inset; + -ms-box-shadow: 0 0 2px #C65E5E inset; + -o-box-shadow: 0 0 2px #C65E5E inset; + box-shadow: 0 0 2px #C65E5E inset; + background-color: #fff; + border: 1px solid #C65E5E; +} + +#content form input:not(:placeholder-shown) ~ #content form input{ + -webkit-box-shadow: 0 0 2px #419c23 inset !important; + -moz-box-shadow: 0 0 2px #419c23 inset; + -ms-box-shadow: 0 0 2px #419c23 inset; + -o-box-shadow: 0 0 2px #419c23 inset; + box-shadow: 0 0 2px #419c23 inset; + background-color: #fff; + border: 1px solid #419c23 !important; +}