Ejemplo n.º 1
0
 /**
  * see if page has already been created and stored
  *
  * @param array $pTitle title of the page
  * @param array $pObject current object
  * @param array $pContentId content_id of the current page - sometimes we don't have the object but a content_id to work with
  * @access public
  * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
  */
 function pageExists($pTitle, $pObject, $pContentId)
 {
     global $gBitSystem;
     // only update this hash once - this is initiated as NULL and will be set to at least array after first call
     if ($this->mLinks === NULL) {
         $this->mLinks = $this->getAllPages($pContentId);
     }
     $ret = FALSE;
     if (!empty($pTitle) && !empty($this->mLinks)) {
         if (array_key_exists(strtolower($pTitle), $this->mLinks)) {
             $ret = $this->mLinks[strtolower($pTitle)];
         }
     }
     // final attempt to get page details
     if (empty($ret) && !empty($pObject) && $gBitSystem->isPackageActive('wiki')) {
         require_once WIKI_PKG_PATH . 'BitPage.php';
         if ($ret = BitPage::pageExists($pTitle, FALSE, $pContentId)) {
             if (count($ret) > 1) {
                 $ret[0]['description'] = tra('Multiple pages with this name');
             }
             $ret = $ret[0];
         }
     }
     return $ret;
 }
Ejemplo n.º 2
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';
}
Ejemplo n.º 3
0
// 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) || strtolower(get_class($gContent)) != 'bitpage') {
    if (!empty($lookupHash['page_id'])) {
        $loadContentId = BitPage::findContentIdByPageId($lookupHash['page_id']);
    } elseif (!empty($lookupHash['content_id'])) {
        $loadContentId = $lookupHash['content_id'];
    } elseif (!empty($lookupHash['page'])) {
        //handle legacy forms that use plain 'page' form variable name
        //if page had some special enities they were changed to HTML for for security reasons.
        //now we deal only with string so convert it back - so we can support this case:
        //You&Me --(detoxify in kernel)--> You&Me --(now)--> You&Me
        //we could do htmlspecialchars_decode but it allows <> marks here, so we just transform &amp; to & - it's not so scary.
        $loadPage = str_replace("&amp;", "&", $lookupHash['page']);
        // Fix nignx mapping of '+' sign when doing rewrite
        $loadPage = str_replace("+", " ", $loadPage);
        if ($loadPage && ($existsInfo = BitPage::pageExists($loadPage))) {
            if (count($existsInfo)) {
                if (count($existsInfo) > 1) {
                    // Display page so user can select which wiki page they want (there are multiple that share this name)
                    $gBitSmarty->assign('choose', $lookupHash['page']);
                    $gBitSmarty->assign('dupePages', $existsInfo);
                    $gBitSystem->display('bitpackage:wiki/page_select.tpl', NULL, array('display_mode' => 'display'));
                    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
Ejemplo n.º 4
0
* @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"];
    $gBitSmarty->assignByRef('page', $_REQUEST["page"]);
}