Esempio n. 1
0
function data_include($data, $params)
{
    $ret = "<p>Please enter a valid 'page_name', 'page_id' or 'content_id' to include in this page.</p>";
    // load page by page_id
    if (isset($params['page_id']) && is_numeric($params['page_id'])) {
        require_once WIKI_PKG_PATH . 'BitPage.php';
        $wp = new BitPage($params['page_id']);
        if ($wp->load()) {
            $ret = $wp->parseData($wp->mInfo);
        }
        // load page by content_id
    } elseif (isset($params['content_id']) && is_numeric($params['content_id'])) {
        if ($obj = LibertyBase::getLibertyObject($params['content_id'])) {
            $ret = $obj->parseData();
        }
        // load page by page_name
    } elseif (isset($params['page_name'])) {
        $ret = "page_name isn't working yet, please use page_id or content_id";
    }
    // if $ret is empty, we need to make sure there is at least a space that we get rid of the {}
    if (empty($ret)) {
        $ret = ' ';
    }
    return $ret;
}
function smarty_function_include_wiki_page_content($params, &$gBitSmarty)
{
    global $debugger;
    //
    $pageName = !empty($params['page']) ? $params['page'] : (!empty($params['page_default']) ? $params['page_default'] : NULL);
    $transclusion_parsed = '';
    include_once WIKI_PKG_PATH . 'BitPage.php';
    $transclusion_bitpage = new BitPage();
    if ($transclusion_page_id = $transclusion_bitpage->findByPageName($pageName)) {
        $transclusion_bitpage->mPageId = $transclusion_page_id;
        if ($transclusion_bitpage->load()) {
            $transclusion_full_page_data = $transclusion_bitpage->mInfo['data'];
            $transclusion_parsed = $transclusion_bitpage->parseData($transclusion_full_page_data, isset($transclusion_bitpage->mInfo['format_guid']) ? $transclusion_bitpage->mInfo['format_guid'] : 'tikiwiki');
        }
    }
    return $transclusion_parsed;
}
Esempio n. 3
0
 *
 * @package wiki
 * @subpackage functions
 */
/**
 * required setup
 */
require_once '../kernel/setup_inc.php';
require_once WIKI_PKG_PATH . 'BitPage.php';
$gBitSystem->verifyFeature('wiki_multiprint');
if (!isset($_REQUEST["printpages"])) {
    $gBitSystem->fatalError(tra("No pages indicated"), NULL, NULL, HttpStatusCodes::HTTP_NOT_FOUND);
} else {
    $printpages = unserialize(urldecode($_REQUEST["printpages"]));
}
if (isset($_REQUEST["print"])) {
    // Create XMLRPC object
    $pages = array();
    foreach ($printpages as $contentId) {
        $page = new BitPage(NULL, $contentId);
        if ($page->load()) {
            $page->verifyViewPermission();
            $page_info = $page->mInfo;
            $page_info["parsed"] = $page->parseData($page_info);
            $pages[] = $page_info;
        }
    }
}
$gBitSmarty->assignByRef('pages', $pages);
// Display the template
$gBitSmarty->display("bitpackage:wiki/print_multi_pages.tpl");
Esempio n. 4
0
$rss->title = $gBitSystem->getConfig('wiki_rss_title', $gBitSystem->getConfig('site_title') . ' - ' . tra('Wiki'));
$rss->description = $gBitSystem->getConfig('wiki_rss_description', $gBitSystem->getConfig('site_title') . ' - ' . tra('RSS Feed'));
// check permission to view wiki pages
if (!$gBitUser->hasPermission('p_wiki_view_page')) {
    require_once RSS_PKG_PATH . "rss_error.php";
} else {
    // check if we want to use the cache file
    $cacheFile = TEMP_PKG_PATH . RSS_PKG_NAME . '/' . WIKI_PKG_NAME . '/' . $cacheFileTail;
    $rss->useCached($rss_version_name, $cacheFile, $gBitSystem->getConfig('rssfeed_cache_time'));
    $wiki = new BitPage();
    $listHash = array('max_records' => $gBitSystem->getConfig('wiki_rss_max_records', 10), 'sort_mode' => 'last_modified_desc', 'get_data' => TRUE);
    $feeds = $wiki->getList($listHash);
    // set the rss link
    $rss->link = 'http://' . $_SERVER['HTTP_HOST'] . WIKI_PKG_URL;
    // get all the data ready for the feed creator
    foreach ($feeds as $feed) {
        $item = new FeedItem();
        $item->title = $feed['title'];
        $item->link = BIT_BASE_URI . $wiki->getDisplayUrl($feed['title']);
        $item->description = $wiki->parseData($feed);
        $item->date = (int) $feed['last_modified'];
        $item->source = 'http://' . $_SERVER['HTTP_HOST'] . BIT_ROOT_URL;
        $item->author = $gBitUser->getDisplayName(FALSE, array('real_name' => $feed['modifier_real_name'], 'login' => $feed['modifier_user']));
        $item->descriptionTruncSize = $gBitSystem->getConfig('rssfeed_truncate', 5000);
        $item->descriptionHtmlSyndicated = FALSE;
        // pass the item on to the rss feed creator
        $rss->addItem($item);
    }
    // finally we are ready to serve the data
    echo $rss->saveFeed($rss_version_name, $cacheFile);
}