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

Source for file slideshow.php

Documentation is available at slideshow.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_once( '../kernel/setup_inc.php' );
  17. require_once( 'BitPage.php' );
  18.  
  19. $gBitSystem->verifyPackage( 'wiki' );
  20. //print($GLOBALS["HTTP_REFERER"]);
  21.  
  22. if (!isset($_SESSION["thedate"])) {
  23.     $thedate = $gBitSystem->getUTCTime();
  24. } else {
  25.     $thedate = $_SESSION["thedate"];
  26. }
  27.  
  28. require_once ( WIKI_PKG_PATH.'lookup_page_inc.php' );
  29. // If the page doesn't exist then display an error
  30. if (!$gContent->isValid()) {
  31.     $gBitSystem->fatalError( tra("Page cannot be found"), NULL, NULL, HttpStatusCodes::HTTP_NOT_FOUND );
  32. }
  33.  
  34. // Now check permissions to access this page
  35. $gContent->verifyViewPermission();
  36.  
  37. // Get page data
  38. include( WIKI_PKG_PATH.'lookup_page_inc.php' );
  39. $info = $gContent->mInfo;
  40.  
  41. // If not locked and last version is user version then can undo
  42. $gBitSmarty->assign('canundo', 'n');
  43.  
  44. if ($info["flag"] != 'L' && (($gContent->hasUpdatePermission() && $info["user"] == $user) || ($gContent->hasUserPermission( 'p_wiki_remove_page' )))) {
  45.     $gBitSmarty->assign('canundo', 'y');
  46. }
  47.  
  48. if( $gContent->hasAdminPermission() ) {
  49.     $gBitSmarty->assign('canundo', 'y');
  50. }
  51.  
  52. //Now process the pages
  53. preg_match_all("/-=([^=]+)=-/", $info["data"], $reqs);
  54. $slides = split("-=[^=]+=-", $info["data"]);
  55.  
  56. if (count($slides) < 2) {
  57.     $slides = explode(defined('PAGE_SEP') ? PAGE_SEP : "...page...", $info["data"]);
  58.  
  59.     array_unshift($slides, '');
  60. }
  61.  
  62. if (!isset($_REQUEST["slide"])) {
  63.     $_REQUEST["slide"] = 0;
  64. }
  65.  
  66. $gBitSmarty->assign('prev_slide', $_REQUEST["slide"] - 1);
  67. $gBitSmarty->assign('next_slide', $_REQUEST["slide"] + 1);
  68.  
  69. if (isset($reqs[1][$_REQUEST["slide"]])) {
  70.     $slide_title = $reqs[1][$_REQUEST["slide"]];
  71. } else {
  72.     $slide_title = '';
  73. }
  74.  
  75. $slide_data = $gContent->parseData( $slides[$_REQUEST["slide"] + 1] );
  76.  
  77. if (isset($reqs[1][$_REQUEST["slide"] - 1])) {
  78.     $slide_prev_title = $reqs[1][$_REQUEST["slide"] - 1];
  79. } else {
  80.     $slide_prev_title = 'prev';
  81. }
  82.  
  83. if (isset($reqs[1][$_REQUEST["slide"] + 1])) {
  84.     $slide_next_title = $reqs[1][$_REQUEST["slide"] + 1];
  85. } else {
  86.     $slide_next_title = 'next';
  87. }
  88.  
  89. $gBitSmarty->assign('slide_prev_title', $slide_prev_title);
  90. $gBitSmarty->assign('slide_next_title', $slide_next_title);
  91.  
  92. $gBitSmarty->assign('slide_title', $slide_title);
  93. $gBitSmarty->assign('slide_data', $slide_data);
  94.  
  95. $total_slides = count($slides) - 1;
  96. $current_slide = $_REQUEST["slide"] + 1;
  97. $gBitSmarty->assign('total_slides', $total_slides);
  98. $gBitSmarty->assign('current_slide', $current_slide);
  99.  
  100. //$gBitSmarty->assign_by_ref('last_modified',date("l d of F, Y  [H:i:s]",$info["last_modified"]));
  101. $gBitSmarty->assign_by_ref('last_modified', $info["last_modified"]);
  102.  
  103. if (empty($info["user"])) {
  104.     $info["user"] = 'anonymous';
  105. }
  106.  
  107. $gBitSmarty->assign_by_ref('lastUser', $info["user"]);
  108. $gBitSmarty->display("bitpackage:wiki/slideshow.tpl");
  109. ?>

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