<div class="content form_create"> <article> <header> <h1>Criar Videos do youtube:</h1> </header> <?php $tube = filter_input_array(INPUT_POST, FILTER_DEFAULT); if (isset($tube) && $tube['SendPostForm']) { $tube['youtube_status'] = $tube['SendPostForm'] == 'Cadastrar' ? '0' : '1'; unset($tube['SendPostForm']); require '_models/AdminYoutube.class.php'; $cadastra = new AdminYoutube(); $cadastra->ExeCreate($tube); if ($cadastra->getResult()) { header('Location: painel.php?exe=youtube/update&create=true&tubeId=' . $cadastra->getResult()); } else { WSErro($cadastra->getError()[0], $cadastra->getError()[1]); } } ?> <form name="PostForm" action="" method="post" enctype="multipart/form-data"> <label class="label"> <span class="field">Titulo:</span> <input type="text" name="youtube_title" value="<?php if (isset($tube['youtube_title'])) { echo $tube['youtube_title'];
<div class="content list_content"> <section> <h1>Videos:</h1> <?php $empty = filter_input(INPUT_GET, 'empty', FILTER_VALIDATE_BOOLEAN); if ($empty) { WSErro("Oppss: você tentou editar um video que não existe no sistema!", WS_INFOR); } $action = filter_input(INPUT_GET, 'action', FILTER_DEFAULT); if ($action) { require_once '_models/AdminYoutube.class.php'; $tubeAction = filter_input(INPUT_GET, 'post', FILTER_VALIDATE_INT); $tubeUpdate = new AdminYoutube(); switch ($action) { case 'active': $tubeUpdate->ExeStatus($tubeAction, '1'); WSErro("O status do video foi atualizado para <b>ativo</b>. Video publicado!", WS_ACCEPT); break; case 'inative': $tubeUpdate->ExeStatus($tubeAction, '0'); WSErro("O status do video foi atualizado para <b>inativo</b>. Video agora é um rascunho!", WS_ACCEPT); break; case 'delete': $tubeUpdate->ExeDelete($tubeAction); WSErro($tubeUpdate->getError()[0], $tubeUpdate->getError()[1]); break; default: WSErro("Ação não foi identificada pelo sistema, favor utilize os botões", WS_ERROR);
<div class="content form_create"> <article> <header> <h1>Atualizar Post:</h1> </header> <?php $tube = filter_input_array(INPUT_POST, FILTER_DEFAULT); $tubeId = filter_input(INPUT_GET, 'tubeId', FILTER_VALIDATE_INT); if (isset($tube) && $tube['SendPostForm']) { $tube['youtube_status'] = $tube['SendPostForm'] == 'Atualizar' ? '0' : '1'; unset($tube['SendPostForm']); require_once '_models/AdminYoutube.class.php'; $cadastra = new AdminYoutube(); $cadastra->ExeUpdate($tubeId, $tube); WSErro($cadastra->getError()[0], $cadastra->getError()[1]); } else { $Read = new AppYoutube(); $Read->setYoutube_id($tubeId); $Read->Execute()->find(); if (!$Read->Execute()->getResult()) { header('Location: painel.php?exe=youtube/index&empty=true'); } else { $tube = (array) $Read->Execute()->getResult(); $tube['youtube_date'] = date('d/m/Y H:i:s', strtotime($tube['youtube_date'])); } } $checkCreate = filter_input(INPUT_GET, 'create', FILTER_VALIDATE_BOOLEAN); if ($checkCreate && empty($cadastra)) {