summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspiderr <spider@viovio.com>2011-02-27 21:00:12 -0500
committerspiderr <spider@viovio.com>2011-02-27 21:00:12 -0500
commit00e4ce554acecec44783ff3a038bc01917c4e6b5 (patch)
tree926bd0772e1217e6ae590440f4860b45fefc74da
parente201fe972450cd316a075bed7f5b9a9ea2115edc (diff)
downloadwiki-00e4ce554acecec44783ff3a038bc01917c4e6b5.tar.gz
wiki-00e4ce554acecec44783ff3a038bc01917c4e6b5.tar.bz2
wiki-00e4ce554acecec44783ff3a038bc01917c4e6b5.zip
use ::getLibertyObject() to get page object
-rw-r--r--lookup_page_inc.php25
1 files changed, 14 insertions, 11 deletions
diff --git a/lookup_page_inc.php b/lookup_page_inc.php
index 1babd96..a687456 100644
--- a/lookup_page_inc.php
+++ b/lookup_page_inc.php
@@ -25,19 +25,20 @@ if( empty( $lookupHash )) {
// 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' ) {
- $gContent = new BitPage( @BitBase::verifyId( $lookupHash['page_id'] ) ? $lookupHash['page_id'] : NULL, @BitBase::verifyId( $lookupHash['content_id'] ) ? $lookupHash['content_id'] : NULL );
-
- $loadPage = (!empty( $lookupHash['page'] ) ? $lookupHash['page'] : NULL);
- if( empty( $gContent->mPageId ) && empty( $gContent->mContentId ) ) {
+ 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&amp;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;", "&", $loadPage );
+ $loadPage = str_replace("&amp;", "&", $lookupHash['page'] );
- if( $loadPage && $existsInfo = $gContent->pageExists( $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)
@@ -46,8 +47,8 @@ if( empty( $gContent ) || !is_object( $gContent ) || strtolower( get_class( $gCo
$gBitSystem->display('bitpackage:wiki/page_select.tpl', NULL, array( 'display_mode' => 'display' ));
die;
} else {
- $gContent->mPageId = $existsInfo[0]['page_id'];
- $gContent->mContentId = $existsInfo[0]['content_id'];
+ $loadPageId = $existsInfo[0]['page_id'];
+ $loadContentId = $existsInfo[0]['content_id'];
}
}
} elseif( $loadPage ) {
@@ -55,10 +56,12 @@ if( empty( $gContent ) || !is_object( $gContent ) || strtolower( get_class( $gCo
}
}
- $parse = ( !isset( $lookupHash['parse'] ) or $lookupHash['parse'] ) ? true : false;
- if( $gContent->load( $parse ) && $loadPage ) {
- $gContent->mInfo['title'] = $loadPage;
+ if( !empty( $loadContentId ) ) {
+ $gContent = LibertyBase::getLibertyObject( $loadContentId );
+ } else {
+ $gContent = new BitPage();
}
+
}
// we weren't passed a structure, but maybe this page belongs to one. let's check...