diff options
| author | bitweaver.org <bitweaver@users.sourceforge.net> | 2005-06-19 06:12:45 +0000 |
|---|---|---|
| committer | bitweaver.org <bitweaver@users.sourceforge.net> | 2005-06-19 06:12:45 +0000 |
| commit | 850713ed26ff34d8fe37feed30bb94de4adc957c (patch) | |
| tree | 7ceb5eaad8a84eb8796fd2d53ed62f17052acc35 /lookup_page_inc.php | |
| download | wiki-850713ed26ff34d8fe37feed30bb94de4adc957c.tar.gz wiki-850713ed26ff34d8fe37feed30bb94de4adc957c.tar.bz2 wiki-850713ed26ff34d8fe37feed30bb94de4adc957c.zip | |
IMPORT TikiPro CLYDE FINAL
Diffstat (limited to 'lookup_page_inc.php')
| -rw-r--r-- | lookup_page_inc.php | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/lookup_page_inc.php b/lookup_page_inc.php new file mode 100644 index 0000000..441c839 --- /dev/null +++ b/lookup_page_inc.php @@ -0,0 +1,118 @@ +<?php + require_once( WIKI_PKG_PATH.'BitBook.php'); + + global $gContent, $wikilib; + include_once( LIBERTY_PKG_PATH.'lookup_content_inc.php' ); + + // 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 ) ) { + $gContent = new BitPage( !empty( $_REQUEST['page_id'] ) ? $_REQUEST['page_id'] : NULL, !empty( $_REQUEST['content_id'] ) ? $_REQUEST['content_id'] : NULL ); + + $loadPage = (!empty( $_REQUEST['page'] ) ? $_REQUEST['page'] : NULL); + if( empty( $gContent->mPageId ) && empty( $gContent->mContentId ) ) { + //handle legacy forms that use plain 'page' form variable name + + if( $loadPage && $existsInfo = $wikilib->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) + $smarty->assign( 'choose', $_REQUEST['page'] ); + $smarty->assign('dupePages', $existsInfo); + $gBitSystem->display('bitpackage:wiki/page_select.tpl'); + die; + } else { + $gContent->mPageId = $existsInfo[0]['page_id']; + } + } + } + } + if( !$gContent->load() && $loadPage ) { + $gContent->mInfo['title'] = $loadPage; + } + $smarty->assign_by_ref( 'gContent', $gContent ); + $smarty->assign_by_ref( 'pageInfo', $gContent->mInfo ); + } + + // we weren't passed a structure, but maybe this page belongs to one. let's check... + if( empty( $gStructure ) ) { + //Get the structures this page is a member of + if( !empty($_REQUEST['structure']) ) { + $structure=$_REQUEST['structure']; + } else { + $structure=''; + } + $structs = $gContent->getStructures(); + if (count($structs)==1) { + $gStructure = new LibertyStructure( $structs[0]['structure_id'] ); + if( $gStructure->load() ) { + $gStructure->loadNavigation(); + $gStructure->loadPath(); + $smarty->assign( 'structureInfo', $gStructure->mInfo ); + } + } else { + $smarty->assign('showstructs', $structs); + } + } + + if( $gContent->isValid() && $gBitSystem->isPackageActive( 'stickies' ) ) { + require_once( STICKIES_PKG_PATH.'BitSticky.php' ); + global $gNote; + $gNote = new BitSticky( NULL, NULL, $gContent->mContentId ); + $gNote->load(); + $smarty->assign_by_ref( 'stickyInfo', $gNote->mInfo ); + } + + // if we are looking up a page + if( $gBitSystem->isFeatureActive( 'feature_warn_on_edit' ) && $gContent->isValid() ) { + // Notice if a page is being edited or if it was being edited and not anymore + // print($GLOBALS["HTTP_REFERER"]); + // IF isset the referer and if the referer is editpage then unset taking the pagename from the + // query or homepage if not query + if (isset($_SERVER['HTTP_REFERER']) && (strstr($_SERVER['HTTP_REFERER'], WIKI_PKG_URL.'edit') ) ) { + $purl = parse_url($_SERVER['HTTP_REFERER']); + + if (!isset($purl["query"])) { + $purl["query"] = ''; + } + + parse_str($purl["query"], $purlquery); + + if (!isset($purlquery["page"])) { + $purlquery["page"] = $wikiHomePage; + } + + if (isset($_SESSION["edit_lock"])) { + $gBitUser->expungeSemaphore($purlquery["page"], $_SESSION["edit_lock"]); + } + } + + if (strstr($_SERVER['REQUEST_URI'], WIKI_PKG_URL . 'edit')) { + $purl = parse_url($_SERVER['REQUEST_URI']); + + if (!isset($purl["query"])) { + $purl["query"] = ''; + } + + parse_str($purl["query"], $purlquery); + + // When WIKI_PKG_URL.'edit.php' is loading, check to see if there is an editing conflict + if( $gBitUser->hasSemaphoreConflict( $gContent->mContentId, $gBitSystem->mPrefs['warn_on_edit_time'] * 60 ) ) { + $smarty->assign('editpageconflict', 'y'); + } else { + if (!(isset($_REQUEST['save'])) && $gContent->isValid() ) { + $_SESSION["edit_lock"] = $gBitUser->storeSemaphore( $gContent->mContentId ); + $smarty->assign('editpageconflict', 'n'); + } + } + } + + if( $semUser = $gBitUser->hasSemaphoreConflict( $gContent->mContentId, $gBitSystem->mPrefs['warn_on_edit_time'] * 60 ) ) { + $gContent->mErrors['edit_conflict'] = 'This page is being edited by '.$gBitUser->getDisplayName( TRUE, $semUser ).'. Proceed at your own peril'; + $smarty->assign( 'semUser', $semUser ); + $beingedited = 'y'; + } else { + $beingedited = 'n'; + } + $smarty->assign('beingEdited', $beingedited); + } +?> |
