$files = docs_files::getDocsFiles(intval($_POST['dosc_id_f'])); if (count($files) == 0 && count($files_attache) == 0) { $error_add_file = 'Необходимо загрузить хотя бы один файл'; $error = true; } if (intval($_POST['dosc_id_f']) == 0) { $error_add_file = 'Ошибка'; $error = true; } if ($error !== false) { $docs = docs::getDocs(); $sections = docs_sections::getSections(); } else { docs::Update(intval($_POST['dosc_id_f']), $_POST['name'], $_POST['desc'], intval($_POST['section'])); foreach ($files_attache as $file) { docs_files::Add(intval($_POST['dosc_id_f']), $file->id, $file->original_name); } header('Location: ' . $_SERVER['REQUEST_URI']); } break; } } else { $docs = docs::getDocs(); $sections = docs_sections::getSections(); } if (!$docs) { $docs = array(); } if (!$sections) { $section = array(); }