예제 #1
0
파일: picture.php 프로젝트: 4Vs/oc-server3
            //try to save in db
            if (!$bError && $picture->save()) {
                if ($redirect == '') {
                    $redirect = $picture->getPageLink();
                }
                $tpl->redirect($redirect);
            } else {
                $tpl->assign('errorfile', ERROR_UPLOAD_UNKNOWN);
                $bError = true;
            }
        }
    }
} else {
    if ($action == 'edit' || $action == 'delete') {
        $uuid = isset($_REQUEST['uuid']) ? $_REQUEST['uuid'] : 0;
        $picture = picture::fromUUID($uuid);
        if ($picture === null) {
            $tpl->error(ERROR_PICTURE_NOT_EXISTS);
        }
        if ($redirect == '') {
            $redirect = $picture->getPageLink();
        }
        if ($picture->allowEdit() == false) {
            $tpl->error(ERROR_NO_ACCESS);
        }
        if ($action == 'edit') {
            if (isset($_REQUEST['ok'])) {
                // overwrite values
                $picture->setSpoiler(isset($_REQUEST['spoiler']) && $_REQUEST['spoiler'] == '1');
                $picture->setDisplay((isset($_REQUEST['notdisplay']) && $_REQUEST['notdisplay'] == '1') == false);
                $picture->setMapPreview(isset($_REQUEST['mappreview']) && $_REQUEST['mappreview'] == '1');