function categorize_page($pContentId, $categId) { require_once WIKI_PKG_PATH . 'BitPage.php'; // Check if we already have this object in the categories_objects page $cat_object_id = $this->is_categorized(BITPAGE_CONTENT_TYPE_GUID, $pContentId); if (!$cat_object_id) { // The page is not cateorized $catPage = new BitPage(NULL, $pContentId); if ($catPage->load()) { $cat_object_id = $this->add_categorized_object(BITPAGE_CONTENT_TYPE_GUID, $pContentId, substr($catPage->mInfo["description"], 0, 200), substr($catPage->mInfo["title"], 0, 200), $catPage->getDisplayUrl()); } } $this->categorize($cat_object_id, $categId); }
function data_attachment($pData, $pParams, $pCommonObject, $pParseHash) { require_once LIBERTY_PKG_PATH . 'LibertyMime.php'; // at a minimum, return blank string (not empty) so we still replace the tag $ret = ' '; // The Manditory Parameter is missing. we are not gonna trow an error, and // just return empty since many sites use the old style required second // "closing" empty tag if (empty($pParams['id'])) { return $ret; } if (!($att = $pCommonObject->getAttachment($pParams['id'], $pParams))) { $ret = tra("The attachment id given is not valid."); return $ret; } global $gBitSmarty, $gLibertySystem, $gContent; // convert parameters into display properties $wrapper = liberty_plugins_wrapper_style($pParams); // work out custom display_url if there is one if (@BitBase::verifyId($pParams['page_id'])) { // link to page by page_id // avoid endless loops require_once WIKI_PKG_PATH . 'BitPage.php'; $wp = new BitPage($pParams['page_id']); if ($wp->load()) { $wrapper['display_url'] = $wp->getDisplayUrl(); } } elseif (@BitBase::verifyId($pParams['content_id'])) { // link to any content by content_id if ($obj = LibertyBase::getLibertyObject($pParams['content_id'])) { $wrapper['display_url'] = $obj->getDisplayUrl(); } } elseif (!empty($pParams['page_name'])) { // link to page by page_name require_once WIKI_PKG_PATH . 'BitPage.php'; $wp = new BitPage(); $wrapper['display_url'] = $wp->getDisplayUrl($pParams['page_name']); } elseif (!empty($pParams['link']) && $pParams['link'] == 'false') { // no link } elseif (!empty($pParams['link'])) { // Allow the use of icon, avatar, small, medium and large to link to certain size of image directly if (!empty($att['thumnail_url'][$pParams['link']])) { $pParams['link'] = $att['thumnail_url'][$pParams['link']]; // Allow the use of 'original' to link to original file directly } elseif ($pParams['link'] == 'original' && !empty($att['source_url'])) { $pParams['link'] = $att['source_url']; // Allow the use of 'download' to link to download link. this will allow us to count downloads } elseif ($pParams['link'] == 'download' && !empty($att['download_url'])) { $pParams['link'] = $att['download_url']; // Adjust class name if we are leaving this server } elseif (!strstr($pParams['link'], $_SERVER["SERVER_NAME"]) && strstr($pParams['link'], '//')) { $wrapper['href_class'] = 'class="external"'; } $wrapper['display_url'] = $pParams['link']; } elseif (!empty($att['display_url'])) { $wrapper['display_url'] = $att['display_url']; } if (!empty($wrapper['description'])) { $parseHash['content_id'] = $pParseHash['content_id']; $parseHash['user_id'] = $pParseHash['user_id']; $parseHash['no_cache'] = TRUE; $parseHash['data'] = $wrapper['description']; $wrapper['description_parsed'] = $pCommonObject->parseData($parseHash); } // pass stuff to the template $gBitSmarty->assign('attachment', $att); $gBitSmarty->assign('wrapper', $wrapper); $gBitSmarty->assign('thumbsize', !empty($pParams['size']) && ($pParams['size'] == 'original' || !empty($att['thumbnail_url'][$pParams['size']])) ? $pParams['size'] : 'medium'); //Carry only these attributes to the image tags $width = !empty($pParams['width']) ? $pParams['width'] : ''; $gBitSmarty->assign('width', $width); $height = !empty($pParams['height']) ? $pParams['height'] : ''; $gBitSmarty->assign('height', $height); $mimehandler = !empty($wrapper['output']) && $wrapper['output'] == 'thumbnail' ? LIBERTY_DEFAULT_MIME_HANDLER : $att['attachment_plugin_guid']; $ret = $gBitSmarty->fetch($gLibertySystem->getMimeTemplate('attachment', $mimehandler)); return $ret; }
if (empty($_REQUEST['add_public_role'])) { $errorMsg[] = tra("You can't join this role."); } else { $errorMsg[] = tra("You can't leave this role."); } } elseif (!empty($_REQUEST['add_public_role'])) { $gBitUser->addUserToRole($gBitUser->mUserId, $_REQUEST['public_role_id']); } elseif (!empty($_REQUEST['remove_public_role'])) { $gBitUser->removeUserFromRole($gBitUser->mUserId, $_REQUEST['public_role_id']); } $gBitUser->loadPermissions(); if (!empty($_REQUEST['add_public_role']) && !empty($roleInfo['after_registration_page'])) { if ($gBitUser->verifyId($roleInfo['after_registration_page'])) { $url = BIT_ROOT_URL . "index.php?content_id=" . $roleInfo['after_registration_page']; } elseif (strpos($roleInfo['after_registration_page'], '/') === FALSE) { $url = BitPage::getDisplayUrl($roleInfo['after_registration_page']); } else { $url = $roleInfo['after_registration_page']; } header('Location: ' . $url); exit; } } /* Load up public roles and check if the user can join or leave them */ $systemRoles = $gBitUser->getRoles($gBitUser->mUserId, TRUE); $gBitSmarty->assignByRef('systemRoles', $systemRoles); $listHash = array('is_public' => 'y', 'sort_mode' => array('is_default_asc', 'role_desc_asc')); $publicRoles = $gBitUser->getAllRoles($listHash); if (count($publicRoles)) { foreach ($systemRoles as $roleId => $roleInfo) { foreach ($publicRoles as $key => $publicRole) {
$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); }