Exemple #1
0
 function export_wiki_page($page_id, $nversions = 1)
 {
     global $gBitSystem;
     $head = '';
     $head .= "Date: " . $gBitSystem->mServerTimestamp->get_rfc2822_datetime() . "\r\n";
     $head .= sprintf("Mime-Version: 1.0 (Produced by Tiki)\r\n");
     $iter = $this->get_page_history($page_id);
     $gWikiPage = new BitPage($page_id);
     $gWikiPage->load();
     $info = $gWikiPage->mInfo;
     $parts = array();
     $parts[] = MimeifyPageRevision($info);
     if ($nversions > 1 || $nversions == 0) {
         foreach ($iter as $revision) {
             $parts[] = MimeifyPageRevision($revision);
             if ($nversions > 0 && count($parts) >= $nversions) {
                 break;
             }
         }
     }
     if (count($parts) > 1) {
         return $head . MimeMultipart($parts);
     }
     assert($parts);
     return $head . $parts[0];
 }
Exemple #2
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;
}
Exemple #4
0
 function __construct($pPageId = NULL, $pContentId = NULL)
 {
     parent::__construct($pPageId, $pContentId);
     $this->registerContentType(BITBOOK_CONTENT_TYPE_GUID, array('content_type_guid' => BITBOOK_CONTENT_TYPE_GUID, 'content_name' => 'Wiki Book', 'handler_class' => 'BitBook', 'handler_package' => 'wiki', 'handler_file' => 'BitBook.php', 'maintainer_url' => 'http://www.bitweaver.org'));
     $this->mContentTypeGuid = BITBOOK_CONTENT_TYPE_GUID;
     // Permission setup
     $this->mCreateContentPerm = 'p_wiki_create_book';
     $this->mUpdateContentPerm = 'p_wiki_update_book';
     $this->mAdminContentPerm = 'p_wiki_admin_book';
 }
Exemple #5
0
function data_alias($pData, $pParams, $pCommonObject)
{
    $page = '';
    require_once WIKI_PKG_PATH . "BitPage.php";
    foreach ($pParams as $key => $value) {
        if (!empty($value)) {
            switch ($key) {
                case 'page':
                    $page = $value;
                    break;
                default:
                    break;
            }
        }
    }
    return tra("This page is an alias for:") . '&nbsp;' . BitPage::getPageLink($page, LibertyContent::pageExists($page));
}
Exemple #6
0
require_once "../kernel/setup_inc.php";
$gBitSystem->verifyPackage('wiki');
$gBitSystem->verifyPackage('rss');
$gBitSystem->verifyFeature('wiki_rss');
require_once WIKI_PKG_PATH . "BitPage.php";
require_once RSS_PKG_PATH . "rss_inc.php";
$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;
Exemple #7
0
!Viewing the Wiki Book
Now that we have created a Wiki Book, we want to view it and see what all this work was for. If you click on the __Wiki Books__ in your left menu, you will see the ===bitweaver Help=== book. Please click on the book, which will take you to a page, where you can see the Wiki Book you just created. The special aspect of these books, is the easy navigation that comes with the hierarchial structuring of the pages. Above the wiki page, you can now see links that allow you to move forwards, backwards and up one level using those simple navigational links.
'), array('title' => 'How to set your Wiki Homepage', 'description' => 'How to set a specific wikipage as home', 'edit' => 'This page will guide you through the process of defining a particular wikipage as you Wiki HomePage.

' . $tutorial_intro . '

!Where is the Wiki HomePage setting?
' . $admin_link . '__Wiki__ --> __Wiki Settings__

Clicking this link will take you to a page with a massive number of options. The one we are interested in, are all in the __Wiki Settings__ tab. The topmost setting is the one we want. The name of the page you enter here, will be the one tha is first shown when clicking on the __Wiki Home__ link in the ===Application Menu=== or the __Wiki__ link in the ===top bar menu===.
'), array('title' => 'bitweaver Glossary', 'description' => 'Definition of Frequently used Terms', 'edit' => ';Package:A Package is a part of bitweaver that can manipulate, store and/or display information. Packages are always self-contained entities that can be installed, or uninstalled should require additional functionality. A list of currently available packages can be found on [http://www.bitweaver.org|bitweaver]. bitweaver differentiates between internal and foreign packages. Internal packages are packages that have been created inhouse and are meant to work with bitweaver from the ground up and will probably not work with any other application. a Foreign Package is usually a standalone application that has been modified in a way to fit into bitweaver. We try and keep these modifications to a minimum, allowing for easy upgrades to new versions.
;Plugin:Enable or disable pluggable features. These plugins are more powerful than regular features and usually allow manipulation of content.
;Feature:Packages usually contain various features that can be activated or deactivated. All these features can be set from the [' . KERNEL_PKG_URL . 'admin/index.php|Administration Screen]. The number of features can be daunting to begin with, but we are sure you will soon work out what they all do. most features have some short description of what you expect from the setting once turned on or off.
;Module:A module is one of the small boxes in one of the outer columns. You can select what modules and where you want to display these from the [' . KERNEL_PKG_URL . 'admin/index.php?page=layout|Layout Screen].
;Group:In bitweaver groups are given permissions. You can then assign users to various groups. this makes it easy to allow a set of users to edit wiki pages but not edit blogs or vice versa.
;User:When a user registers with your site, that user is added to your database. every user has a defined set of permissions that allow them to access particular parts of your site. to manage these permissions, you have to first define groups and allocate permissions to them.
;Content:Content is any text that is intered into bitweaver that is stored in the central liberty tables. storing the content in one place makes it accesible from various different places allowing users to mix and match such content as they see fit. This makes it possible to easily display images in a wiki text or even display a blog post in an article since they are all considered to be the same.
'));
foreach ($pageHash as $page) {
    // common settings for all of these pages
    $page['fSavePage'] = TRUE;
    $page['user_id'] = ROOT_USER_ID;
    $page['format_guid'] = 'tikiwiki';
    $newPage = new BitPage();
    if ($newPage->store($page)) {
        $pumpedData['Wiki'][] = $page['title'];
    } else {
        $error = $newPage->mErrors;
        $gBitSmarty->assign('error', $error);
    }
}
Exemple #8
0
 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);
 }
Exemple #9
0
<?php

/**
 * 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 modules
 */
/**
 * required setup
 */
require_once WIKI_PKG_PATH . 'BitPage.php';
global $gQueryUser, $module_rows, $module_params;
extract($moduleParams);
if ($gBitUser->hasPermission('p_wiki_view_page')) {
    $modWiki = new BitPage();
    $listHash = array('max_records' => $module_rows, 'sort_mode' => 'hits_desc', 'user_id' => !empty($module_params['user_pages']) ? $gQueryUser->mUserId : NULL);
    $modRank = $modWiki->getList($listHash);
    $_template->tpl_vars['modTopPages'] = new Smarty_variable($modRank);
}
Exemple #10
0
 /**
  * convert wiki links to html links
  *
  * @param string $pData
  * @param array $pParamHash
  * @param object $pObject
  * @access public
  * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
  */
 function parseLinks($pData, $pParamHash, $pObject)
 {
     global $gBitSystem;
     // if wiki isn't active, there isn't much we can do here
     if (!$gBitSystem->isPackageActive('wiki')) {
         return $pData;
     }
     // fetch BitPage in case it hasn't been loaded yet
     require_once WIKI_PKG_PATH . 'BitPage.php';
     // We need to remove ))WikiWords(( before links get made.
     // users just need to be strict about not inserting spaces between
     // words and brackets
     preg_match_all("!\\){2}(" . WIKI_WORDS_REGEX . ")\\({2}!", $pData, $protected);
     // this array is used to fill the text with temporary placeholders that get replaced back in further down
     $replacements = array();
     if (!empty($protected)) {
         foreach ($protected[0] as $i => $prot) {
             $key = md5(mt_rand());
             $replacements[$key] = $protected[1][$i];
             $pData = str_replace($prot, $key, $pData);
         }
     }
     // Process ((Wiki Page|Wiki Page Description)) type links first. Here
     // we don't handle plurals and the like since the user should know what
     // he's linking to when using these links
     preg_match_all("/\\({2}({$this->mWikiWordRegex})\\|(.+?)\\){2}/", $pData, $pages);
     for ($i = 0; $i < count($pages[1]); $i++) {
         $page = str_replace($pages[5][$i], "", $pages[1][$i]);
         $exists = $this->pageExists($page, $pObject, $pParamHash['content_id']);
         // anchor
         if (!empty($pages[5][$i])) {
             $repl = preg_replace('!href="([^"]*)"!', "href=\"\$1{$pages[5][$i]}\"", BitPage::getPageLink($page, $exists));
         } else {
             $repl = BitPage::getPageLink($page, $exists);
         }
         // alternate title
         if (strlen(trim($pages[6][$i])) > 0) {
             $repl = str_replace($page . "</a>", "{$pages[6][$i]}</a>", $repl);
         }
         $key = md5(mt_rand());
         $replacements[$key] = $repl;
         $pData = str_replace($pages[0][$i], $key, $pData);
     }
     // Process the simpler ((Wiki Page)) type links without the description
     preg_match_all("/\\({2}({$this->mWikiWordRegex})\\){2}/", $pData, $pages);
     foreach (array_unique($pages[1]) as $i => $page) {
         $page = str_replace($pages[5][$i], "", $pages[1][$i]);
         $exists = $this->pageExists($page, $pObject, $pParamHash['content_id']);
         if (!empty($pages[5][$i])) {
             $repl = preg_replace('!href="([^"]*)"!', "href=\"\$1{$pages[5][$i]}\"", BitPage::getPageLink($page, $exists));
         } else {
             $repl = BitPage::getPageLink($page, $exists);
         }
         $key = md5(mt_rand());
         $replacements[$key] = $repl;
         $pData = str_replace("(({$pages[1][$i]}))", $key, $pData);
     }
     // Finally we deal with WikiWord links
     if ($gBitSystem->isFeatureActive('wiki_words')) {
         $pages = $this->extractWikiWords($pData);
         foreach ($pages as $page) {
             if ($exists = $this->pageExists($page, $pObject, $pParamHash['content_id'])) {
                 $repl = BitPage::getPageLink($page, $exists);
             } elseif ($gBitSystem->isFeatureActive('wiki_plurals') && $this->getLocale() == 'en_US') {
                 // Link plural topic names to singular topic names if the plural
                 // doesn't exist, and the language is english
                 $plural_tmp = $page;
                 // Plurals like policy / policies
                 $plural_tmp = preg_replace("/ies\$/", "y", $plural_tmp);
                 // Plurals like address / addresses
                 $plural_tmp = preg_replace("/sses\$/", "ss", $plural_tmp);
                 // Plurals like box / boxes
                 $plural_tmp = preg_replace("/([Xx])es\$/", "\$1", $plural_tmp);
                 // Others, excluding ending ss like address(es)
                 $plural_tmp = preg_replace("/([A-Za-rt-z])s\$/", "\$1", $plural_tmp);
                 // prevent redundant pageExists calls if plurals are on, and plural is same as original word
                 if ($page != $plural_tmp) {
                     $exists = $this->pageExists($plural_tmp, $pObject, $pParamHash['content_id']);
                 }
                 $repl = BitPage::getPageLink($plural_tmp, $exists);
             } else {
                 $repl = BitPage::getPageLink($page, $exists);
             }
             // old code
             //$slashed = preg_replace( "/([\/\[\]\(\)])/", "\\\\$1", $page_parse );
             //$data = preg_replace( "#([\s\,\;])\b$slashed\b([\s\,\;\.])#", "$1 ".$repl."$2", $data);
             // new code
             // i never understood why the simple stuff never worked but it
             // seems to work now - xing - Sunday Jul 22, 2007   17:37:17 CEST
             $pData = preg_replace("/\\b" . preg_quote($page, "/") . "\\b/", $repl, $pData);
         }
     }
     // replace protection keys with original words
     foreach ($replacements as $key => $replace) {
         $pData = str_replace($key, $replace, $pData);
     }
     return $pData;
 }
Exemple #11
0
<?php

/**
 * 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 modules
 */
/**
 * Required files
 */
require_once WIKI_PKG_PATH . 'BitPage.php';
$wp = new BitPage();
if ($gBitUser->hasPermission('p_wiki_view_page')) {
    $listHash = array('sort_mode' => 'random', 'max_records' => $moduleParams['module_rows']);
    $pages = $wp->getList($listHash);
    $_template->tpl_vars['modRandomPages'] = new Smarty_variable($pages);
}
Exemple #12
0
 /**
  * getIndexPage
  *
  * Returns the page for the given type
  * defaults to the site homepage
  *
  * @access public
  * @return URL of page by index type
  */
 function getIndexPage($pIndexType = NULL)
 {
     global $userlib, $gBitUser, $gBitSystem;
     $pIndexType = !is_null($pIndexType) ? $pIndexType : $this->getConfig("bit_index");
     $url = '';
     if ($pIndexType == 'role_home') {
         // See if we have first a user assigned default group id, and second a group default system preference
         if (!$gBitUser->isRegistered() && ($role_home = $gBitUser->getHomeRole(ANONYMOUS_TEAM_ID))) {
         } elseif (@$this->verifyId($gBitUser->mInfo['default_role_id']) && ($role_home = $gBitUser->getHomeRole($gBitUser->mInfo['default_role_id']))) {
         } elseif ($this->getConfig('default_home_role') && ($role_home = $gBitUser->getHomeRole($this->getConfig('default_home_role')))) {
         }
         if (!empty($role_home)) {
             if ($this->verifyId($role_home)) {
                 $url = BIT_ROOT_URL . "index.php" . (!empty($role_home) ? "?content_id=" . $role_home : "");
                 // wiki dependence - NO bad idea
                 // } elseif( strpos( $group_home, '/' ) === FALSE ) {
                 // 	$url = BitPage::getDisplayUrl( $group_home );
             } elseif (strpos($role_home, 'http://') === FALSE) {
                 $url = BIT_ROOT_URL . $role_home;
             } else {
                 $url = $role_home;
             }
         }
     } elseif ($pIndexType == 'group_home') {
         // See if we have first a user assigned default group id, and second a group default system preference
         if (!$gBitUser->isRegistered() && ($group_home = $gBitUser->getGroupHome(ANONYMOUS_GROUP_ID))) {
         } elseif (@$this->verifyId($gBitUser->mInfo['default_group_id']) && ($group_home = $gBitUser->getGroupHome($gBitUser->mInfo['default_group_id']))) {
         } elseif ($this->getConfig('default_home_group') && ($group_home = $gBitUser->getGroupHome($this->getConfig('default_home_group')))) {
         }
         if (!empty($group_home)) {
             if ($this->verifyId($group_home)) {
                 $url = BIT_ROOT_URL . "index.php" . (!empty($group_home) ? "?content_id=" . $group_home : "");
                 // wiki dependence - NO bad idea
                 // } elseif( strpos( $group_home, '/' ) === FALSE ) {
                 // 	$url = BitPage::getDisplayUrl( $group_home );
             } elseif (strpos($group_home, 'http://') === FALSE) {
                 $url = BIT_ROOT_URL . $group_home;
             } else {
                 $url = $group_home;
             }
         }
     } elseif ($pIndexType == 'my_page' || $pIndexType == 'my_home' || $pIndexType == 'user_home') {
         // TODO: my_home is deprecated, but was the default for BWR1. remove in DILLINGER - spiderr
         if ($gBitUser->isRegistered()) {
             if (!$gBitUser->isRegistered()) {
                 $url = USERS_PKG_URL . 'login.php';
             } else {
                 if ($pIndexType == 'my_page') {
                     $url = $gBitSystem->getConfig('users_login_homepage', USERS_PKG_URL . 'my.php');
                     if ($url != USERS_PKG_URL . 'my.php' && strpos($url, 'http://') === FALSE) {
                         // the safe assumption is that a custom path is a subpath of the site
                         // append the root url unless we have a fully qualified uri
                         $url = BIT_ROOT_URL . $url;
                     }
                 } elseif ($pIndexType == 'user_home') {
                     $url = $gBitUser->getDisplayUrl();
                 } else {
                     $users_homepage = $gBitUser->getPreference('users_homepage');
                     if (isset($users_homepage) && !empty($users_homepage)) {
                         if (strpos($users_homepage, '/') === FALSE) {
                             $url = BitPage::getDisplayUrlFromHash(array('title' => $users_homepage));
                         } else {
                             $url = $users_homepage;
                         }
                     }
                 }
             }
         } else {
             $url = USERS_PKG_URL . 'login.php';
         }
     } elseif (in_array($pIndexType, array_keys($gBitSystem->mPackages))) {
         $work = strtoupper($pIndexType) . '_PKG_URL';
         if (defined("{$work}")) {
             $url = constant($work);
         }
         /* this was commented out with the note that this can send requests to inactive packages -
          * that should only happen if the admin chooses to point to an inactive pacakge.
          * commenting this out however completely breaks the custom uri home page feature, so its
          * turned back on and caviate admin - if the problem is more severe than it seems then
          * get in touch on irc and we'll work out a better solution than commenting things on and off -wjames5
          */
     } elseif (!empty($pIndexType)) {
         $url = BIT_ROOT_URL . $pIndexType;
     }
     // if no special case was matched above, default to users' my page
     if (empty($url)) {
         if ($this->isPackageActive('wiki')) {
             $url = WIKI_PKG_URL;
         } elseif (!$gBitUser->isRegistered()) {
             $url = USERS_PKG_URL . 'login.php';
         } else {
             $url = USERS_PKG_URL . 'my.php';
         }
     }
     if (strpos($url, 'http://') === FALSE) {
         $url = preg_replace("#//#", "/", $url);
     }
     return $url;
 }
Exemple #13
0
            // registration login, fake the cookie so the session gets updated properly.
            if (empty($_COOKIE[$gBitUser->getSiteCookieName()])) {
                $_COOKIE[$gBitUser->getSiteCookieName()] = session_id();
            }
            // login with email since login is not technically required in the form, as it can be auto generated during store
            $afterRegDefault = $newUser->login($reg['email'], $reg['password'], FALSE, FALSE);
            $url = $gBitSystem->getConfig('after_reg_url') ? BIT_ROOT_URI . $gBitSystem->getConfig('after_reg_url') : $afterRegDefault;
            // return to referring page
            if (!empty($_SESSION['returnto'])) {
                $url = $_SESSION['returnto'];
                // forward to group post-registration page
            } elseif (!empty($_REQUEST['group']) && !empty($groupInfo['after_registration_page'])) {
                if ($newUser->verifyId($groupInfo['after_registration_page'])) {
                    $url = BIT_ROOT_URI . "index.php?content_id=" . $groupInfo['after_registration_page'];
                } elseif (strpos($groupInfo['after_registration_page'], '/') === FALSE) {
                    $url = BitPage::getDisplayUrlFromHash($groupInfo['after_registration_page']);
                } else {
                    $url = $groupInfo['after_registration_page'];
                }
            }
            header('Location: ' . $url);
            exit;
        }
    } else {
        $gBitSystem->setHttpStatus(HttpStatusCodes::HTTP_BAD_REQUEST);
        $gBitSmarty->assignByRef('errors', $newUser->mErrors);
    }
    $gBitSmarty->assignByRef('reg', $reg);
} else {
    if ($gBitSystem->isFeatureActive('custom_user_fields')) {
        $fields = explode(',', $gBitSystem->getConfig('custom_user_fields'));
Exemple #14
0
 /**
  * see if the documentation page exists, if not create it and return the appropriate content_id
  * 
  * @param array $pPackage 
  * @access public
  * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
  */
 function getDocumentionPage($pPackage = NULL)
 {
     global $gBitUser, $gBitSystem;
     $ret = FALSE;
     if (empty($pPackage) && $this->isValid()) {
         $pPackage = $this->mPackage;
     }
     if (!empty($pPackage)) {
         $page = ucfirst($pPackage) . "Package";
         require_once LIBERTY_PKG_PATH . "LibertyContent.php";
         $lc = new LibertyContent();
         $ret = $lc->pageExists($page);
         if ($gBitSystem->isPackageActive('wiki') && !$ret && $gBitUser->hasPermission('p_wiki_edit_page')) {
             require_once WIKI_PKG_PATH . "BitPage.php";
             $wp = new BitPage();
             $create = array('title' => $page, 'creator_user_id' => $gBitUser->mUserId, 'modifier_user_id' => $gBitUser->mUserId, 'edit' => "This page contains information about {$pPackage}");
             // get some rudimentary page details
             if ($wp->store($create)) {
                 $ret = $lc->pageExists($page);
             }
         }
     }
     return $ret;
 }
Exemple #15
0
        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) {
Exemple #16
0
/**
 * required setup
 */
require_once '../kernel/setup_inc.php';
$gBitSystem->verifyPackage('wiki');
require_once WIKI_PKG_PATH . 'BitPage.php';
if (!empty($_REQUEST['structure_id'])) {
    include LIBERTY_PKG_PATH . 'display_structure_inc.php';
} else {
    // if no page set
    if (!isset($_REQUEST['page']) and !isset($_REQUEST['page_id'])) {
        // if auto create home page disabled just get a list
        if ($gBitSystem->isFeatureActive('wiki_disable_auto_home')) {
            include WIKI_PKG_PATH . 'list_pages.php';
            die;
        }
        // auto fetch/create default home page
        $_REQUEST['page'] = $gBitSystem->getConfig('wiki_home_page', 'HomePage');
    }
    $gHome = new BitPage();
    $wikiHome = $gBitSystem->getConfig("wiki_home_page", 'HomePage');
    if (!$gHome->pageExists($wikiHome)) {
        $homeHash = array('title' => isset($wikiHome) ? $wikiHome : 'HomePage', 'creator_user_id' => ROOT_USER_ID, 'modifier_user_id' => ROOT_USER_ID, 'edit' => 'Welcome to ' . $gBitSystem->getConfig('site_title', 'our site'));
        $gHome->store($homeHash);
    }
    include WIKI_PKG_PATH . 'lookup_page_inc.php';
    if ($gContent->isValid()) {
        $gBitSystem->setCanonicalLink($gContent->getDisplayUrl());
    }
    include WIKI_PKG_PATH . 'display_bitpage_inc.php';
}
Exemple #17
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");
Exemple #18
0
* Pdf system class for outputing pdf file images
*
* @author   
* @version  $Revision$
* @package  pdf
*/
// 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.
/**
* required setup
*/
require_once '../kernel/setup_inc.php';
include_once STRUCTURES_PKG_PATH . 'struct_lib.php';
include_once WIKI_PKG_PATH . 'BitPage.php';
$gContent = new BitPage();
// Create the HomePage if it doesn't exist
if (!$gContent->pageExists($wiki_home_page)) {
    $gContent->create_page($wiki_home_page, 0, '', $gBitSystem->getUTCTime(), 'bitweaver initialization');
}
if (!isset($_SESSION["thedate"])) {
    $thedate = $gBitSystem->getUTCTime();
} else {
    $thedate = $_SESSION["thedate"];
}
// Get the page from the request var or default it to HomePage
if (!isset($_REQUEST["page"])) {
    $page = $wiki_home_page;
    $gBitSmarty->assign('page', $wiki_home_page);
} else {
    $page = $_REQUEST["page"];
Exemple #19
0
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;
}
Exemple #20
0
 /**
  * Returns HTML link to display a page if it exists, or to create if not
  * @param pExistsHash the hash that was returned by LibertyContent::pageExists
  * @return the link to display the page.
  */
 public static function getPageLink($pLinkText = NULL, $pMixed = NULL, $pAnchor = NULL)
 {
     global $gBitSystem, $gBitUser;
     $ret = $pLinkText;
     if ($gBitSystem->isPackageActive('wiki')) {
         if (!empty($pMixed) && is_array($pMixed)) {
             if (is_array(current($pMixed))) {
                 $exists = $pMixed[0];
                 $multiple = TRUE;
             } else {
                 $exists = $pMixed;
                 $multiple = FALSE;
             }
             // we have a multi-demensional array (likely returned from LibertyContent::pageExists() ) - meaning we potentially have multiple pages with the same name
             if ($multiple) {
                 $desc = tra('Multiple pages with this name');
             } else {
                 $desc = empty($exists['summary']) ? $exists['title'] : $exists['summary'];
             }
             $ret = '<a title="' . htmlspecialchars($desc) . '" href="' . BitPage::getDisplayUrlFromHash($exists) . '">' . htmlspecialchars($exists['title']) . '</a>';
         } else {
             if ($gBitUser->hasPermission('p_wiki_create_page')) {
                 $ret = '<a title="' . tra("Create the page") . ': ' . htmlspecialchars($pLinkText) . '" href="' . WIKI_PKG_URL . 'edit.php?page=' . urlencode($pLinkText) . '" class="create">' . htmlspecialchars($pLinkText) . '</a>';
             } else {
                 $ret = $pLinkText;
             }
         }
     }
     return $ret;
 }
Exemple #21
0
<?php

global $moduleParams, $gBitSmarty;
// Load up the correct wiki page
$lookupHash['page_id'] = !empty($moduleParams['module_params']['page_id']) ? $moduleParams['module_params']['page_id'] : NULL;
$lookupHash['content_id'] = !empty($moduleParams['module_params']['content_id']) ? $moduleParams['module_params']['content_id'] : NULL;
$lookupHash['page'] = !empty($moduleParams['module_params']['page']) ? $moduleParams['module_params']['page'] : NULL;
require_once WIKI_PKG_PATH . "BitPage.php";
$modulePage = BitPage::lookupObject($lookupHash);
$showTitle = TRUE;
if (!empty($moduleParams['module_params']['notitle'])) {
    $showTitle = FALSE;
} elseif (!empty($moduleParams['title'])) {
    $modulePage->mInfo['title'] = $moduleParams['title'];
}
$_template->tpl_vars['showTitle'] = new Smarty_variable($showTitle);
$_template->tpl_vars['wikiPage'] = new Smarty_variable($modulePage);
<?php

/**
 * 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 modules
 */
global $gQueryUserId, $moduleParams;
$params = $moduleParams['module_params'];
/**
 * required setup
 */
if ($gBitUser->hasPermission('p_wiki_view_page')) {
    require_once WIKI_PKG_PATH . 'BitPage.php';
    $wp = new BitPage();
    $listHash = array('max_records' => $moduleParams['module_rows'], 'sort_mode' => 'last_modified_desc', 'user_id' => $gQueryUserId);
    $modLastModif = $wp->getList($listHash);
    $_template->tpl_vars['modLastModif'] = new Smarty_variable($modLastModif);
    $_template->tpl_vars['maxlen'] = new Smarty_variable(isset($params["maxlen"]));
}
Exemple #23
0
                    die;
                } else {
                    $loadPageId = $existsInfo[0]['page_id'];
                    $loadContentId = $existsInfo[0]['content_id'];
                }
            }
        } elseif ($loadPage) {
            $gBitSmarty->assign('page', $loadPage);
            //to have the create page link in the error
        }
    }
    if (!empty($loadContentId)) {
        $gContent = BitPage::getLibertyObject($loadContentId);
    }
    if (empty($gContent) || !is_object($gContent)) {
        $gContent = new BitPage();
    }
}
// we weren't passed a structure, but maybe this page belongs to one. let's check...
if ($gContent->isValid() && empty($gStructure)) {
    //Get the structures this page is a member of
    if (!empty($lookupHash['structure'])) {
        $structure = $lookupHash['structure'];
    } else {
        $structure = '';
    }
    $structs = $gContent->getStructures();
    if (count($structs) == 1) {
        $gStructure = new LibertyStructure($structs[0]['structure_id']);
        if ($gStructure->load()) {
            $gStructure->loadNavigation();
Exemple #24
0
    } elseif (empty($_REQUEST['confirm'])) {
        $formHash['delete'] = TRUE;
        $formHash['batch_submit'] = 'remove_pages';
        foreach ($_REQUEST["checked"] as $del) {
            $tmpPage = new BitPage($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 pages?') . ' (' . tra('Count: ') . count($_REQUEST["checked"]) . ')', 'error' => tra('This cannot be undone!')));
    } else {
        foreach ($_REQUEST["checked"] as $deletepage) {
            $tmpPage = new BitPage($deletepage);
            if (!$tmpPage->load() || !$tmpPage->expunge()) {
                array_merge($errors, array_values($tmpPage->mErrors));
            }
        }
        if (!empty($errors)) {
            $gBitSmarty->assignByRef('errors', $errors);
        }
    }
}
$gBitSmarty->assignByRef("gContent", $gContent);
if (!empty($_REQUEST['sort_mode'])) {
    $listHash['sort_mode'] = preg_replace('/^user_/', 'creator_user_', $_REQUEST['sort_mode']);
}
$listHash = $_REQUEST;
$listHash['extras'] = TRUE;
Exemple #25
0
 if (!isset($structure_id)) {
     $gBitSmarty->assign('msg', $_REQUEST['name'] . " " . tra("page not added (Exists)"));
     $gBitSystem->display('error.tpl', NULL, array('display_mode' => 'edit'));
     die;
 }
 $chapters = explode("\n", $_REQUEST["chapters"]);
 foreach ($chapters as $chapter) {
     $chapterName = trim($chapter);
     if (!empty($chapterName)) {
         unset($params);
         unset($nodeHash);
         $nodeHash['parent_id'] = $structure_id;
         $nodeHash['root_structure_id'] = $structure_id;
         $nodeHash['level'] = 1;
         //try to add a new structure
         $nodePage = new BitPage();
         $pageId = $nodePage->findByPageName($chapterName);
         if ($pageId) {
             $nodePage->mPageId = $pageId;
             $nodePage->load();
         } else {
             $params['title'] = trim($chapterName);
             $params['edit'] = '';
             if (!$nodePage->store($params)) {
                 $gBitSystem->fatalError("There was an error storing the page: " . vc($gContent->mErrors));
             }
         }
         $nodeHash['content_id'] = $nodePage->mContentId;
         $nodeHash['after_ref_id'] = $gStructure->storeNode($nodeHash);
     }
 }