include_once '../DAO/RemessaDAO.php'; include_once '../Remessa.class.php'; checkUserAuth(EXTERNAL_ROOT_PORTAL . '/index.php?error=true'); include_once '../../head.php'; $remessa = new Remessa(); $DAO = new RemessaDAO(); $remessa->setId(limpaTexto($_GET['lista'])); if (!in_array(235, listarAcesso())) { echo '<script language= "JavaScript">location.href="' . EXTERNAL_ROOT_PORTAL . '/modulos.php";</script>'; } if (!empty($_POST['cmd']) && $_POST['cmd'] == 'editar') { $msg_erro = NULL; $msg_sucesso = NULL; $file = $_FILES['file']; $remessa->setFile($file['name']); $remessa->setTitulo($_POST['titulo']); $remessa->setIdArquivo($_POST['id']); if ($file['error'] == UPLOAD_ERR_NO_FILE) { $res = $DAO->Listar("SELECT * FROM " . MYSQL_BASE_REMESSA_ARQUIVOS . " WHERE id = " . $remessa->getIdArquivo()); foreach ($res as $item) { $remessa->setFile($item['file']); } $num = 1; } else { $res = $DAO->Listar("SELECT * FROM " . MYSQL_BASE_REMESSA_ARQUIVOS . " WHERE file = '" . $file['name'] . "' AND excluido IS NULL"); $num = $res->rowCount(); } if ($num > 0) { $uploadDir = '../../arquivos/remessa/'; $name = $file['name']; $uploadFile = $uploadDir . $name;