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

Source for file display_bitpage_inc.php

Documentation is available at display_bitpage_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. include_onceWIKI_PKG_PATH.'BitBook.php');
  17.  
  18. $gBitSystem->verifyPackage'wiki' );
  19.  
  20. $gContent->verifyViewPermission();
  21.  
  22. // Check permissions to access this page
  23. if!$gContent->isValid(|| !is_a$gContent'BitPage' ) ) {
  24.     $gBitSystem->fatalErrortra'Page cannot be found' )NULLNULLHttpStatusCodes::HTTP_GONE );
  25. }
  26.  
  27. $displayHash array'perm_name' => 'p_wiki_view_page' );
  28. $gContent->invokeServices'content_display_function'$displayHash );
  29.  
  30. // Let creator set permissions
  31. // does this work with setPreference()??? - xing - Tuesday Oct 07, 2008   17:51:38 CEST
  32. if$gBitSystem->isFeatureActive'wiki_creator_admin' && $gContent->isOwner() ) {
  33.     $gBitUser->setPreference'p_wiki_admin'TRUE );
  34. }
  35.  
  36. // doesn't seem to be used - xing - Tuesday Oct 07, 2008   17:52:42 CEST
  37. //if( isset( $_REQUEST["copyrightpage"] )) {
  38. //    $gBitSmarty->assign_by_ref( 'copyrightpage', $_REQUEST["copyrightpage"] );
  39. //}
  40.  
  41. // Get the backlinks for the page "page"
  42. if$gBitSystem->isFeatureActive'wiki_backlinks' )) {
  43.     $gBitSmarty->assign'backlinks'$gContent->getBacklinks() );
  44. }
  45.  
  46. // Now increment page hits since we are visiting this page
  47. $gContent->addHit();
  48.  
  49. // Check if we have to lock / unlock this page
  50. if!empty$_REQUEST["action"&& $_REQUEST["action"== 'lock' || $_REQUEST["action"== 'unlock' )
  51.     && $gContent->hasAdminPermission(|| ($gContent->hasUserPermission'p_wiki_lock_page' && $gBitSystem->isFeatureActive'wiki_usrlock' )) ) ) {
  52.     $gContent->setLock$_REQUEST["action"== 'lock' 'L' NULL );
  53. }
  54.  
  55. // Process an undo here
  56. if!empty$_REQUEST["undo"&& !$gContent->isLocked(&& $gContent->hasUpdatePermission(|| $gContent->hasUserPermission'p_wiki_rollback' ))) {
  57.     // Remove the last version
  58.     $gContent->removeLastVersion();
  59. }
  60.  
  61. // work out if this page has slides
  62. if$gBitSystem->isFeatureActive'wiki_uses_slides' )) {
  63.     $slides split"-=[^=]+=-"$gContent->mInfo["data");
  64.     ifcount$slides <= {
  65.         $slides explodedefined'PAGE_SEP' PAGE_SEP "...page..."$gContent->mInfo["data");
  66.     }
  67.  
  68.     // if we have more than on slide, we let the templates know about it
  69.     ifcount$slides {
  70.         $gBitSmarty->assign'show_slideshow''y' );
  71.     }
  72. }
  73.  
  74. // ...page... stuff - TODO: this is cumbersome and should be cleaned up
  75. $pages $gContent->countSubPages$gContent->getField'parsed_data' ) );
  76. if$pages {
  77.     if!isset$_REQUEST['pagenum')) {
  78.         $_REQUEST['pagenum'1;
  79.     }
  80.     $gContent->mInfo['parsed_data'$gContent->getSubPage$gContent->mInfo['parsed_data']$_REQUEST['pagenum');
  81.     $gBitSmarty->assign'pages'$pages );
  82.     if$pages $_REQUEST['pagenum'{
  83.         $gBitSmarty->assign('next_page'$_REQUEST['pagenum');
  84.     else {
  85.         $gBitSmarty->assign'next_page'$_REQUEST['pagenum');
  86.     }
  87.     if$_REQUEST['pagenum'{
  88.         $gBitSmarty->assign'prev_page'$_REQUEST['pagenum');
  89.     else {
  90.         $gBitSmarty->assign'prev_page');
  91.     }
  92.     $gBitSmarty->assign'first_page');
  93.     $gBitSmarty->assign'last_page'$pages );
  94.     $gBitSmarty->assign'pagenum'$_REQUEST['pagenum');
  95. }
  96.  
  97. // Comments engine!
  98. if$gBitSystem->isFeatureActive'wiki_comments' )) {
  99.     $comments_vars array'page' );
  100.     $comments_prefix_var 'wiki page:';
  101.     $comments_object_var 'page';
  102.     $commentsParentId $gContent->mContentId;
  103.     $comments_return_url WIKI_PKG_URL.'index.php?page_id='.$gContent->mPageId;
  104.     # Support displaying comments on their own page instead of on content page
  105.     ifisset$_REQUEST["comments_page"&& $_REQUEST["comments_page"== '1' || !empty$_REQUEST['view_comment_id')) {
  106.         $gBitSmarty->assign'comments_page');
  107.         $comments_on_separate_page 1;
  108.         $comments_return_url WIKI_PKG_URL.'index.php?page_id='.$gContent->mPageId.'&amp;comments_page=1';
  109.         if !empty($_REQUEST['view_comment_id']) ) {
  110.             $comments_return_url .= '&amp;comments_maxComments=1';
  111.         }
  112.     }
  113.     include_onceLIBERTY_PKG_PATH.'comments_inc.php' );
  114. }
  115.  
  116. // Footnotes
  117. if$gBitSystem->isFeatureActive'wiki_footnotes' && $gBitUser->isValid() ) {
  118.     if$footnote $gContent->getFootnote$gBitUser->mUserId ) ) {
  119.         $gBitSmarty->assign'footnote'$gContent->parseData$footnote ) );
  120.     }
  121. }
  122.  
  123. // Copyrights
  124. if$gBitSystem->isFeatureActive'wiki_copyrights' ) ) {
  125.     require_onceWIKI_PKG_PATH.'copyrights_lib.php' );
  126.     $copyrights $copyrightslib->list_copyrights$gContent->mPageId );
  127.     $gBitSmarty->assign('pageCopyrights'$copyrights["data"]);
  128. }
  129.  
  130. // Watches
  131. if$gBitSystem->isFeatureActive'users_watches' ) ) {
  132.     if!empty$_REQUEST['watch_event') ) {
  133.         if$gBitUser->isRegistered() ) {
  134.             if$_REQUEST['watch_action']=='add' {
  135.                 $gBitUser->storeWatch$_REQUEST['watch_event']$_REQUEST['watch_object']$gContent->mContentTypeGuid$gContent->mPageName$gContent->getDisplayUrl() );
  136.             else {
  137.                 $gBitUser->expungeWatch$_REQUEST['watch_event']$_REQUEST['watch_object');
  138.             }
  139.         else {
  140.             $gBitSystem->fatalErrortra"This feature requires a registered user. ").": users_watches" );
  141.         }
  142.     }
  143.  
  144.     if$watch $gBitUser->getEventWatches'wiki_page_changed'$gContent->mPageId ) ) {
  145.         $gBitSmarty->assign'user_watching_page''y' );
  146.     }
  147. }
  148.  
  149. if$gContent->isValid(&& $gBitSystem->isPackageActive'stickies' ) ) {
  150.     require_onceSTICKIES_PKG_PATH.'BitSticky.php' );
  151.     global $gNote;
  152.     $gNote new BitStickyNULLNULL$gContent->mContentId );
  153.     $gNote->load();
  154.     $gBitSmarty->assign_by_ref'stickyInfo'$gNote->mInfo );
  155. }
  156.  
  157. // Display the Index Template
  158. $gBitSmarty->assign_by_ref'pageInfo'$gContent->mInfo );
  159.  
  160. // S5 slideshows
  161. ifisset$_REQUEST['s5')) {
  162.     include_onceWIKI_PKG_PATH.'s5.php');
  163. }
  164.  
  165. $gBitSystem->display'bitpackage:wiki/show_page.tpl'$gContent->mInfo['title']array'display_mode' => 'display' ));
  166. ?>

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