From 6e488966ff3e6a7c5e4c1a32ef43260b8608705e Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Thu, 26 Nov 2015 23:08:05 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B2=D0=B5=D0=BB=D0=B8=D1=87=D0=B8?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B4=D0=BB=D0=B8=D0=BD=D0=BD=D0=B0=20=D0=BC?= =?UTF-8?q?=D0=B8=D0=BD=D0=B8=D0=BC=D0=B0=D0=BB=D1=8C=D0=BD=D0=BE=D0=B3?= =?UTF-8?q?=D0=BE=20=D0=BE=D0=BF=D0=B8=D1=81=D0=B0=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D1=82=D0=BE=D1=87=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ground/controllers/JsonController.php | 29 ++++++++++++++++++++------- ground/views/modals/addPoint.php | 6 +++--- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/ground/controllers/JsonController.php b/ground/controllers/JsonController.php index 9b3cfa9..be88000 100644 --- a/ground/controllers/JsonController.php +++ b/ground/controllers/JsonController.php @@ -226,20 +226,35 @@ class JsonController extends Controller $_POST['description'] = strip_tags($_POST['description']); } - if (!( isset($_POST['name']) && $_POST['name'] && strlen($_POST['name']) > 1 )) + if (!( isset($_POST['name']) && $_POST['name'] && strlen($_POST['name']) > 5 )) { $errors[1] = 'Неверное название точки'; - if (!( isset($_POST['img']) && (int) $_POST['img'])) + } + + if (!( isset($_POST['img']) && (int) $_POST['img'])) { $errors[2] = 'Плохая ссылка на изображение'; - if (!( isset($_POST['description']) && $_POST['description'] && strlen($_POST['description']) > 25 )) + } + + $discriptionLimit = (App::$user && App::$user->isAdmin) ? 20 : 500; + App::log('user', App::$user); + if (!( isset($_POST['description']) && $_POST['description'] && strlen($_POST['description']) > $discriptionLimit )) { $errors[3] = 'Слишком короткое описание'; - if (!( isset($_POST['categoryId']) && $_POST['categoryId'] )) + } + + if (!( isset($_POST['categoryId']) && $_POST['categoryId'] )) { $errors[4] = 'Не задана категория точки'; - if (!( isset($_POST['source']) )) + } + + if (!( isset($_POST['source']) )) { $errors[5] = 'Не передано поле источкика информации. Допускается пустое значение.'; - if (!( isset($_POST['lat']) && $_POST['lat'] )) + } + + if (!( isset($_POST['lat']) && $_POST['lat'] )) { $errors[6] = 'Ошибочное значение широты'; - if (!( isset($_POST['lng']) && $_POST['lng'] )) + } + + if (!( isset($_POST['lng']) && $_POST['lng'] )) { $errors[7] = 'Ошибочное значение долготы'; + } if (!empty($errors)) { header("HTTP/1.0 400 Bad Request"); diff --git a/ground/views/modals/addPoint.php b/ground/views/modals/addPoint.php index 0a9e180..81830ea 100644 --- a/ground/views/modals/addPoint.php +++ b/ground/views/modals/addPoint.php @@ -10,14 +10,14 @@
- +
- - + +