wiki
[ class tree: wiki ] [ index: wiki ] [ all elements ]

Source for file lookup_page_inc.php

Documentation is available at lookup_page_inc.php

  1. <?php
  2. /**
  3.  * Copyright (c) 2004 bitweaver.org
  4.  * Copyright (c) 2003 tikwiki.org
  5.  * Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
  6.  * All Rights Reserved. See below for details and a complete list of authors.
  7.  * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
  8.  *
  9.  * @package wiki
  10.  * @subpackage functions
  11.  */
  12.  
  13. /**
  14.  * required setup
  15.  */
  16. require_onceWIKI_PKG_PATH.'BitBook.php');
  17.  
  18. global $gContent;
  19. include_onceLIBERTY_PKG_PATH.'lookup_content_inc.php' );
  20.  
  21. // this is needed when the center module is applied to avoid abusing $_REQUEST
  22. ifempty$lookupHash )) {
  23.     $lookupHash &$_REQUEST;
  24. }
  25.  
  26. // if we already have a gContent, we assume someone else created it for us, and has properly loaded everything up.
  27. ifempty$gContent || !is_object$gContent || strtolowerget_class$gContent ) ) != 'bitpage' {
  28.     if!empty$lookupHash['page_id') )  {
  29.         $loadContentId BitPage::findContentIdByPageId$lookupHash['page_id');
  30.     elseif!empty$lookupHash['content_id') ) {
  31.         $loadContentId $lookupHash['content_id'];
  32.     elseif!empty$lookupHash['page') ) {
  33.         //handle legacy forms that use plain 'page' form variable name
  34.  
  35.         //if page had some special enities they were changed to HTML for for security reasons.
  36.         //now we deal only with string so convert it back - so we can support this case:
  37.         //You&Me --(detoxify in kernel)--> You&amp;Me --(now)--> You&Me
  38.         //we could do htmlspecialchars_decode but it allows <> marks here, so we just transform &amp; to & - it's not so scary.
  39.         $loadPage str_replace("&amp;""&"$lookupHash['page');
  40.         // Fix nignx mapping of '+' sign when doing rewrite
  41.         $loadPage str_replace("+"" "$loadPage );
  42.  
  43.         if$loadPage && $existsInfo BitPage::pageExists$loadPage ) ) {
  44.             if (count($existsInfo)) {
  45.                 if (count($existsInfo1{
  46.                     // Display page so user can select which wiki page they want (there are multiple that share this name)
  47.                     $gBitSmarty->assign'choose'$lookupHash['page');
  48.                     $gBitSmarty->assign('dupePages'$existsInfo);
  49.                     $gBitSystem->display('bitpackage:wiki/page_select.tpl'NULLarray'display_mode' => 'display' ));
  50.                     die;
  51.                 else {
  52.                     $loadPageId $existsInfo[0]['page_id'];
  53.                     $loadContentId $existsInfo[0]['content_id'];
  54.                 }
  55.             }
  56.         elseif$loadPage {
  57.             $gBitSmarty->assign('page'$loadPage);//to have the create page link in the error
  58.         }
  59.     }
  60.  
  61.     if!empty$loadContentId ) ) {
  62.         $gContent LibertyBase::getLibertyObject$loadContentId );
  63.     }
  64.  
  65.     ifempty$gContent || !is_object$gContent ) ) {
  66.         $gContent new BitPage();
  67.     }
  68. }
  69.  
  70. // we weren't passed a structure, but maybe this page belongs to one. let's check...
  71. if$gContent->isValid(&& empty$gStructure ) ) {
  72.     //Get the structures this page is a member of
  73.     if!empty($lookupHash['structure']) ) {
  74.         $structure=$lookupHash['structure'];
  75.     else {
  76.         $structure='';
  77.     }
  78.     $structs $gContent->getStructures();
  79.     if (count($structs)==1{
  80.         $gStructure new LibertyStructure$structs[0]['structure_id');
  81.         if$gStructure->load() ) {
  82.             $gStructure->loadNavigation();
  83.             $gStructure->loadPath();
  84.             $gBitSmarty->assign'structureInfo'$gStructure->mInfo );
  85.         }
  86.     else {
  87.         $gBitSmarty->assign('showstructs'$structs);
  88.     }
  89. }
  90.  
  91. $gBitSmarty->clear_assign'gContent' );
  92. $gBitSmarty->assign_by_ref'gContent'$gContent );
  93. ?>

Documentation generated on Wed, 29 Jul 2015 13:57:03 +0000 by phpDocumentor 1.5.0-lsces