コード例 #1
0
ファイル: books.php プロジェクト: bitweaver/wiki
 * Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
 * All Rights Reserved. See below for details and a complete list of authors.
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
 *
 * @package wiki
 * @subpackage functions
 */
/**
 * required setup
 */
require_once '../kernel/setup_inc.php';
include_once WIKI_PKG_PATH . 'BitBook.php';
// verify stuff
$gBitSystem->verifyPackage('wiki');
$gBitSystem->verifyPermission('p_wiki_list_pages');
$book = new BitBook();
$listHash = array();
$listHash['content_type_guid'] = BITBOOK_CONTENT_TYPE_GUID;
$channels = $book->getList($listHash);
$cant_pages = ceil($channels["cant"] / $listHash['max_records']);
$gBitSmarty->assignByRef('cant_pages', $cant_pages);
$gBitSmarty->assign('actual_page', 1 + $listHash['offset'] / $listHash['max_records']);
if ($channels["cant"] > $listHash['offset'] + $listHash['max_records']) {
    $gBitSmarty->assign('next_offset', $listHash['offset'] + $listHash['max_records']);
} else {
    $gBitSmarty->assign('next_offset', -1);
}
// If offset is > 0 then prev_offset
if ($listHash['offset'] > 0) {
    $gBitSmarty->assign('prev_offset', $listHash['offset'] - $listHash['max_records']);
} else {
コード例 #2
0
ファイル: sitemap.php プロジェクト: bitweaver/wiki
/**
 * Copyright (c) 2004 bitweaver.org
 * Copyright (c) 2003 tikwiki.org
 * Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
 * All Rights Reserved. See below for details and a complete list of authors.
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
 *
 * @package wiki
 * @subpackage functions
 */
/**
 * required setup
 */
require_once '../kernel/setup_inc.php';
require_once WIKI_PKG_PATH . 'BitBook.php';
$book = new BitBook();
$gSiteMapHash = array();
$listHash = array();
if ($bookList = $book->getList($listHash)) {
    foreach ($bookList['data'] as $bookHash) {
        $bookStructure = new LibertyStructure($bookHash['structure_id']);
        $listBook = $bookStructure->buildTreeToc($bookHash['structure_id']);
        process_book_list($listBook);
    }
}
function process_book_list($pList, $pDepth = 1)
{
    global $gSiteMapHash;
    foreach (array_keys($pList) as $key) {
        if (!empty($pList[$key]['display_url'])) {
            $hash = array();
コード例 #3
0
ファイル: edit_book.php プロジェクト: bitweaver/wiki
}
// end overly elaborate lookup now we can check the permission on the book.
// this is what we're really interested in doing check if we can edit the book or create one
if ($gContent->isValid()) {
    $gContent->verifyUpdatePermission();
} else {
    $gContent->verifyCreatePermission();
}
if (isset($_REQUEST["createstructure"])) {
    if (empty($_REQUEST['name'])) {
        $gBitSmarty->assign('msg', tra("You must specify a name."));
        $gBitSystem->display('error.tpl', NULL, array('display_mode' => 'edit'));
        die;
    }
    //try to add a new structure
    $gContent = new BitBook();
    $pageId = $gContent->findByPageName($_REQUEST['name']);
    if ($pageId) {
        $gContent->mPageId = $pageId;
        $gContent->load();
    } else {
        $params['title'] = $_REQUEST['name'];
        $params['edit'] = '{toc}';
        $gContent->store($params);
    }
    if ($gContent->isValid()) {
        $gStructure = new LibertyStructure();
        // alias => '' is a temporary setting until alias stuff has been removed
        $structureHash = array('content_id' => $gContent->mContentId, 'alias' => '');
        $structure_id = $gStructure->storeNode($structureHash);
        //Cannot create a structure if a structure already exists