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.  * $Header: /cvsroot/bitweaver/_bit_wiki/display_bitpage_inc.php,v 1.29 2006/12/23 15:44:22 squareing Exp $
  4.  *
  5.  * Copyright (c) 2004 bitweaver.org
  6.  * Copyright (c) 2003 tikwiki.org
  7.  * Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
  8.  * All Rights Reserved. See copyright.txt for details and a complete list of authors.
  9.  * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
  10.  *
  11.  * $Id: display_bitpage_inc.php,v 1.29 2006/12/23 15:44:22 squareing Exp $
  12.  * @package wiki
  13.  * @subpackage functions
  14.  */
  15.  
  16. /**
  17.  * required setup
  18.  */
  19. include_onceWIKI_PKG_PATH.'BitBook.php');
  20.  
  21. $gBitSystem->verifyPackage'wiki' );
  22.  
  23. $gBitSystem->verifyPermission'p_wiki_view_page' );
  24.  
  25. // Check permissions to access this page
  26. if!$gContent->isValid() ) {
  27.     $gBitSystem->fatalError'Page cannot be found' );
  28. }
  29.  
  30. $displayHash array'perm_name' => 'p_wiki_view_page' );
  31. $gContent->invokeServices'content_display_function'$displayHash );
  32.  
  33. /*
  34. $gBitSmarty->assign('structure','n');
  35. //Has a structure page been requested
  36. if (isset($_REQUEST["structure_id"])) {
  37.     $structure_id = $_REQUEST["structure_id"];
  38. } else {
  39.     //if not then check if page is the head of a structure
  40.     $structure_id = $structlib->get_struct_ref_if_head( $gContent->mPageName );
  41. }
  42. $gBitSmarty->assign_by_ref('page',$gContent->mInfo['title']);
  43. */
  44.  
  45. require_onceWIKI_PKG_PATH.'page_setup_inc.php' );
  46. // Let creator set permissions
  47. if($gBitSystem->isFeatureActive'wiki_creator_admin' )) {
  48.     if$gContent->isOwner() ) {
  49.         $gBitUser->setPreference'p_wiki_admin'TRUE );
  50.     }
  51. }
  52. if(isset($_REQUEST["copyrightpage"])) {
  53.     $gBitSmarty->assign_by_ref('copyrightpage',$_REQUEST["copyrightpage"]);
  54. }
  55. if$gBitSystem->isFeatureActive'wiki_backlinks' ) ) {
  56.     // Get the backlinks for the page "page"
  57.     $backlinks $gContent->getBacklinks();
  58.     $gBitSmarty->assign_by_ref('backlinks'$backlinks);
  59. }
  60.  
  61. // Update the pagename with the canonical name.  This makes it
  62. // possible to link to a page using any case, but the page is still
  63. // displayed with the original capitalization.  So if there's a page
  64. // called 'About Me', then one can conveniently make a link to it in
  65. // the text as '... learn more ((about me)).'.  When the link is
  66. // followed,
  67.  
  68. $gBitSystem->setBrowserTitle$gContent->mInfo['title');
  69. // BreadCrumbNavigation here
  70. // Get the number of pages from the default or userPreferences
  71. // Remember to reverse the array when posting the array
  72.  
  73. $anonpref $wikilib->getPreference('users_bread_crumb',4);
  74. if(!empty($user)) {
  75.   $users_bread_crumb $gBitUser->getPreference'users_bread_crumb'$anonpref );
  76. else {
  77.   $users_bread_crumb $anonpref;
  78. }
  79. if(!isset($_SESSION["breadCrumb"])) {
  80.   $_SESSION["breadCrumb"]=Array();
  81. }
  82. if(!in_array($gContent->mInfo['title'],$_SESSION["breadCrumb"])) {
  83.   if(count($_SESSION["breadCrumb"])>$users_bread_crumb{
  84.     array_shift($_SESSION["breadCrumb"]);
  85.   }
  86.   array_push($_SESSION["breadCrumb"],$gContent->mInfo['title']);
  87. else {
  88.   // If the page is in the array move to the last position
  89.   $pos array_search($gContent->mInfo['title']$_SESSION["breadCrumb"]);
  90.   unset($_SESSION["breadCrumb"][$pos]);
  91.   array_push($_SESSION["breadCrumb"],$gContent->mInfo['title']);
  92. }
  93. //print_r($_SESSION["breadCrumb"]);
  94. // Now increment page hits since we are visiting this page
  95.  
  96. if$gBitSystem->isFeatureActive'users_count_admin_pageviews' || !$gBitUser->isAdmin() ) {
  97.   $gContent->addHit();
  98. }
  99. // Check if we have to perform an action for this page
  100. // for example lock/unlock
  101.  
  102. ifisset$_REQUEST["action"&& (($_REQUEST["action"== 'lock' || $_REQUEST["action"]=='unlock' &&
  103.     ($gBitUser->hasPermission'p_wiki_admin' )) || ($user and ($gBitUser->hasPermission'p_wiki_lock_page' )) and ($gBitSystem->isFeatureActive'wiki_usrlock' )))) ) {
  104.     $gContent->setLock( ($_REQUEST["action"== 'lock' 'L' NULL ) );
  105.     $gBitSmarty->assign('lock'($_REQUEST["action"== 'lock') );
  106. }
  107.  
  108.  
  109. // Save to notepad if user wants to
  110. if$gBitSystem->isPackageActive'notepad' && $gBitUser->isValid(&& $gBitUser->hasPermission'bit_p_notepad' && isset($_REQUEST['savenotepad'])) {
  111.  
  112.     require_onceNOTEPAD_PKG_PATH.'notepad_lib.php' );
  113.     $notepadlib->replace_note$user0$gContent->mPageName$gContent->mInfo['data');
  114. }
  115. // Assign lock status
  116. $gBitSmarty->assign('lock'$gContent->isLocked() );
  117. // Process an undo here
  118. if(isset($_REQUEST["undo"])) {
  119.  
  120.     if!$gContent->isLocked(&& ( ($gBitUser->hasPermission'p_wiki_edit_page' && $gContent->isOwner())||($gContent->hasUserPermission'p_wiki_rollback' ))) ) {
  121.         // Remove the last version
  122.         $gContent->removeLastVersion();
  123.     }
  124. }
  125. if ($gBitSystem->isFeatureActive'wiki_uses_slides' )) {
  126.     $slides split("-=[^=]+=-",$gContent->mInfo["data"]);
  127.     if(count($slides)>1{
  128.         $gBitSmarty->assign('show_slideshow','y');
  129.     else {
  130.         $slides explode(defined('PAGE_SEP'PAGE_SEP "...page...",$gContent->mInfo["data"]);
  131.         if(count($slides)>1{
  132.             $gBitSmarty->assign('show_slideshow','y');
  133.         else {
  134.             $gBitSmarty->assign('show_slideshow','n');
  135.         }
  136.     }
  137. else {
  138.     $gBitSmarty->assign('show_slideshow','n');
  139. }
  140. if(isset($_REQUEST['refresh'])) {
  141.  
  142.   $gContent->invalidateCache();
  143. }
  144. // Here's where the data is parsed
  145. // if using cache
  146. //
  147. // get cache information
  148. // if cache is valid then pdata is cache
  149. // else
  150. // pdata is parse_data
  151. //   if using cache then update the cache
  152. // assign_by_ref
  153.  
  154.  
  155.  
  156. $pages $wikilib->countPages($gContent->mInfo['parsed_data']);
  157. if$pages {
  158.     if(!isset($_REQUEST['pagenum'])) {
  159.         $_REQUEST['pagenum']=1;
  160.     }
  161.     $gContent->mInfo['parsed_data']=$wikilib->get_page($gContent->mInfo['parsed_data'],$_REQUEST['pagenum']);
  162.     $gBitSmarty->assign('pages',$pages);
  163.     if($pages>$_REQUEST['pagenum']{
  164.         $gBitSmarty->assign('next_page',$_REQUEST['pagenum']+1);
  165.     else {
  166.         $gBitSmarty->assign('next_page',$_REQUEST['pagenum']);
  167.     }
  168.     if($_REQUEST['pagenum']>1{
  169.         $gBitSmarty->assign('prev_page',$_REQUEST['pagenum']-1);
  170.     else {
  171.         $gBitSmarty->assign('prev_page',1);
  172.     }
  173.     $gBitSmarty->assign('first_page',1);
  174.     $gBitSmarty->assign('last_page',$pages);
  175.     $gBitSmarty->assign('pagenum',$_REQUEST['pagenum']);
  176. }
  177. //$gBitSmarty->assign_by_ref('last_modified',date("l d of F, Y  [H:i:s]",$gContent->mInfo["last_modified"]));
  178. $gBitSmarty->assign_by_ref('last_modified',$gContent->mInfo["last_modified"]);
  179. if(empty($gContent->mInfo["user"])) {
  180.     $gContent->mInfo["user"]='anonymous';
  181. }
  182. $gBitSmarty->assign_by_ref('lastUser',$gContent->mInfo["user"]);
  183. $gBitSmarty->assign_by_ref('description',$gContent->mInfo["description"]);
  184.  
  185. // Comments engine!
  186. if$gBitSystem->isFeatureActive'wiki_comments' ) ) {
  187.     $comments_vars Array('page');
  188.     $comments_prefix_var='wiki page:';
  189.     $comments_object_var='page';
  190.     $commentsParentId $gContent->mContentId;
  191.     $comments_return_url WIKI_PKG_URL.'index.php?page_id='.$gContent->mPageId;
  192.     include_onceLIBERTY_PKG_PATH.'comments_inc.php' );
  193. }
  194.  
  195. if$gBitSystem->isFeatureActive'wiki_attachments' ) ) {
  196.     $gBitSmarty->assign('atts',$gContent->mStorage);
  197.     $gBitSmarty->assign('atts_count',count($gContent->mStorage));
  198. }
  199.  
  200. if$gBitSystem->isFeatureActive'wiki_footnotes' && $gBitUser->isValid() ) {
  201.     if$footnote $gContent->getFootnote$gBitUser->mUserId ) ) {
  202.         $gBitSmarty->assign'footnote'$gContent->parseData$footnote ) );
  203.     }
  204. }
  205.  
  206. if$gBitSystem->isFeatureActive'wiki_copyrights' ) ) {
  207.     require_onceWIKI_PKG_PATH.'copyrights_lib.php' );
  208.     $copyrights $copyrightslib->list_copyrights$gContent->mPageId );
  209.     $gBitSmarty->assign('pageCopyrights'$copyrights["data"]);
  210. }
  211.  
  212. // Watches
  213. if$gBitSystem->isFeatureActive'users_watches' ) ) {
  214.     ifisset$_REQUEST['watch_event') ) {
  215.         if$gBitUser->isRegistered() ) {
  216.             if($_REQUEST['watch_action']=='add'{
  217.                 $gBitUser->storeWatch$_REQUEST['watch_event']$_REQUEST['watch_object']$gContent->mContentTypeGuid$gContent->mPageName$gContent->getDisplayUrl() );
  218.             else {
  219.                 $gBitUser->expungeWatch$_REQUEST['watch_event']$_REQUEST['watch_object');
  220.             }
  221.         else {
  222.             $gBitSmarty->assign('msg'tra("This feature requires a registered user.").": users_watches");
  223.             $gBitSystem->display'error.tpl' );
  224.             die;
  225.         }
  226.     }
  227.     $gBitSmarty->assign('user_watching_page','n');
  228.     if$watch $gBitUser->getEventWatches'wiki_page_changed'$gContent->mPageId ) ) {
  229.         $gBitSmarty->assign('user_watching_page','y');
  230.     }
  231. }
  232. $sameurl_elements=Array('title','page');
  233.  
  234. // Display the Index Template
  235. $gBitSmarty->assign_by_ref'pageInfo'$gContent->mInfo );
  236.  
  237. ifisset$_REQUEST['s5') ) {
  238.     include_onceWIKI_PKG_PATH.'s5.php');
  239. }
  240.  
  241. $gBitSystem->display('bitpackage:wiki/show_page.tpl');
  242. // xdebug_dump_function_profile(XDEBUG_PROFILER_CPU);
  243. ?>

Documentation generated on Thu, 15 Feb 2007 20:37:58 +0000 by phpDocumentor 1.3.0