$data = $db->where('country_id', $country['id']); $data = $db->delete('Country_point'); } if (is_numeric($_POST['modal_point']) and $_GET['editfile'] == 1) { $file = new PostFile($_POST['modal_point']); if ($_FILES["file"]["name"]) { //замена центральной фотки if (!$file->upload($_FILES)) { $loc = $country['name'] . "?error=" . $file->getErrorMsg(); header("Location: {$loc}"); } else { $loc = $country['name'] . "?add_point=" . $_POST['modal_point'] . '#Point' . $_POST['modal_point']; header("Location: {$loc}"); } } elseif ($_POST['file_url']) { if ($file->uploadFromurl($_POST['file_url'])) { $loc = $country['name'] . "?add_point=" . $_POST['modal_point'] . '#Point' . $_POST['modal_point']; header("Location: {$loc}"); } else { $loc = $country['name'] . "?error=" . $file->getErrorMsg(); header("Location: {$loc}"); } } } elseif ($_POST and $_GET['add'] == 1) { //Добавление новой точки $View = new PostView($country['id'], $_POST); $View->insert(); } elseif ($_POST and $_GET['edit'] == 1 and $_POST['Point_id']) { //редактирвоание записи $View = new PostView($country['id'], $_POST); $View->update($_POST['Point_id']);