Пример #1
0
        $formHash['delete'] = TRUE;
        $formHash['submit_mult'] = 'remove_stencils';
        foreach ($_REQUEST["checked"] as $del) {
            $tmpPage = new BitStencil($del);
            if ($tmpPage->load() && !empty($tmpPage->mInfo['title'])) {
                $info = $tmpPage->mInfo['title'];
            } else {
                $info = $del;
            }
            $formHash['input'][] = '<input type="hidden" name="checked[]" value="' . $del . '"/>' . $info;
        }
        $gBitSystem->confirmDialog($formHash, array('warning' => tra('Are you sure you want to delete these stencils?') . ' (' . tra('Count: ') . count($_REQUEST["checked"]) . ')', 'error' => tra('This cannot be undone!')));
    } else {
        foreach ($_REQUEST["checked"] as $deleteId) {
            $tmpPage = new BitStencil($deleteId);
            if (!$tmpPage->load() || !$tmpPage->expunge()) {
                array_merge($errors, array_values($tmpPage->mErrors));
            }
        }
        if (!empty($errors)) {
            $gBitSmarty->assign_by_ref('errors', $errors);
        }
    }
}
// create new stencil object
$stencil = new BitStencil();
$stencilsList = $stencil->getList($_REQUEST);
$gBitSmarty->assign_by_ref('stencilsList', $stencilsList);
// getList() has now placed all the pagination information in $_REQUEST['listInfo']
$gBitSmarty->assign_by_ref('listInfo', $_REQUEST['listInfo']);
// Display the template
Пример #2
0
<?php

global $gContent;
require_once STENCIL_PKG_PATH . 'BitStencil.php';
require_once LIBERTY_PKG_PATH . 'lookup_content_inc.php';
// if we already have a gContent, we assume someone else created it for us, and has properly loaded everything up.
if (empty($gContent) || !is_object($gContent) || !$gContent->isValid()) {
    if (@BitBase::verifyId($_REQUEST['stencil_id'])) {
        // if stencil_id supplied, use that
        $gContent = new BitStencil($_REQUEST['stencil_id']);
    } elseif (@BitBase::verifyId($_REQUEST['content_id'])) {
        // if content_id supplied, use that
        $gContent = new BitStencil(NULL, $_REQUEST['content_id']);
    } elseif (@BitBase::verifyId($_REQUEST['stencil']['stencil_id'])) {
        $gContent = new BitStencil($_REQUEST['stencil']['stencil_id']);
    } else {
        // otherwise create new object
        $gContent = new BitStencil();
    }
    $gContent->load();
    $gBitSmarty->assign_by_ref("gContent", $gContent);
}