Exemplo n.º 1
0
$action = isset($_REQUEST['action']) ? mb_strtolower($_REQUEST['action']) : '';
$redirect = isset($_REQUEST['redirect']) ? $_REQUEST['redirect'] : '';
$redirect = $tpl->checkTarget($redirect, '');
$tpl->assign('action', $action);
$tpl->assign('redirect', $redirect);
if ($action == 'add') {
    $podcast = new podcast();
    if (isset($_REQUEST['cacheuuid'])) {
        $cache = cache::fromUUID($_REQUEST['cacheuuid']);
        if ($cache === null) {
            $tpl->error(ERROR_CACHE_NOT_EXISTS);
        }
        if ($cache->allowEdit() == false) {
            $tpl->error(ERROR_NO_ACCESS);
        }
        $podcast->setCacheId($cache->getCacheId());
        $cache = null;
    } else {
        $tpl->error(ERROR_INVALID_OPERATION);
    }
    // uploaded file ok?
    if (isset($_REQUEST['ok'])) {
        $bError = false;
        $title = isset($_REQUEST['title']) ? $_REQUEST['title'] : '';
        if ($title == '') {
            $tpl->assign('errortitle', true);
            $bError = true;
        } else {
            $podcast->setTitle($title);
        }
        if (!isset($_FILES['file'])) {