cvs: pres2 / XML_Presentation.php XML_Slide.php display.php getwidth.php index.php keyboard.js.php show.php
| From: | Derick Rethans | Date: | Thu, 03 May 2007 11:28:39 +0000 |
| Subject: | cvs: pres2 / XML_Presentation.php XML_Slide.php display.php getwidth.php index.php keyboard.js.php show.php | ||
| Groups: | php.pres | ||
| Request: | Send a blank email to pres+get-1399@lists.php.net to get a copy of this message | ||
derick Thu May 3 11:28:39 2007 UTC
Modified files:
/pres2 XML_Presentation.php XML_Slide.php display.php getwidth.php
index.php keyboard.js.php show.php
Log:
- XHTML fixes (that was need to make Firefox work with my new CSS correctly).
- Fixed some call-time-pass-by-reference warnings.
- Allow a new tag "div" , on which effect=slide works as well.
- Changed how body tags are added, so that we can pick a CSS class for the
body tag dependent on the template.
- Changed some of the ways on how slide XML is opened, related to incomplete
PHP 6 implementations of functions.
#- Rasmus, I tested those changes with a few of your talks as well, they look
# fine here, but you might want to double check.
http://cvs.php.net/viewvc.cgi/pres2/XML_Presentation.php?r1=1.4&r2=1.5&diff_format=u Index: pres2/XML_Presentation.php diff -u pres2/XML_Presentation.php:1.4 pres2/XML_Presentation.php:1.5 --- pres2/XML_Presentation.php:1.4 Tue Nov 22 17:29:37 2005 +++ pres2/XML_Presentation.php Thu May 3 11:28:39 2007 @@ -17,7 +17,7 @@ // | Authors: Rasmus Lerdorf <rasmus@php.net> | // +----------------------------------------------------------------------+ // -// $Id: XML_Presentation.php,v 1.4 2005/11/22 17:29:37 rasmus Exp $ +// $Id: XML_Presentation.php,v 1.5 2007/05/03 11:28:39 derick Exp $ // }}} require_once 'XML/Parser.php'; @@ -29,7 +29,7 @@ * This class is a parser for the .pres files * * @author Rasmus Lerdorf <rasmus@php.net> - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ * @access public */ class XML_Presentation extends XML_Parser @@ -106,7 +106,7 @@ * @param array Attributes of XML tag * @return void */ - function startHandler($parser, $element, $attribs) + function startHandler($parser, $element, &$attribs) { switch ($element) { /* These tags can have other tags inside */ http://cvs.php.net/viewvc.cgi/pres2/XML_Slide.php?r1=1.12&r2=1.13&diff_format=u Index: pres2/XML_Slide.php diff -u pres2/XML_Slide.php:1.12 pres2/XML_Slide.php:1.13 --- pres2/XML_Slide.php:1.12 Mon Oct 23 06:25:28 2006 +++ pres2/XML_Slide.php Thu May 3 11:28:39 2007 @@ -17,7 +17,7 @@ // | Authors: Rasmus Lerdorf <rasmus@php.net> | // +----------------------------------------------------------------------+ // -// $Id: XML_Slide.php,v 1.12 2006/10/23 06:25:28 rasmus Exp $ +// $Id: XML_Slide.php,v 1.13 2007/05/03 11:28:39 derick Exp $ // }}} require_once 'XML/Parser.php'; @@ -29,7 +29,7 @@ * This class is a parser for a made up presentation slide format * * @author Rasmus Lerdorf <rasmus@php.net> - * @version $Revision: 1.12 $ + * @version $Revision: 1.13 $ * @access public */ class XML_Slide extends XML_Parser @@ -77,7 +77,6 @@ function XML_Slide($handle = '') { $this->XML_Parser(); - if (@is_resource($handle)) { $this->setInput($handle); } elseif ($handle != '') { @@ -99,7 +98,7 @@ * @param array Attributes of XML tag * @return void */ - function startHandler($parser, $element, $attribs) + function startHandler($parser, $element, &$attribs) { switch ($element) { /* These tags can have other tags inside */ @@ -121,6 +120,15 @@ $this->activeTag = 'text'; break; + case 'DIV': + $cl = '_'.strtolower($element); + $this->objects[++$this->coid] = new $cl(); + $this->stack[] = $this->coid; + $this->insideTag = $element; + $this->_add_attribs($this->objects[$this->coid], $attribs); + $this->activeTag = 'text'; + break; + /* Divider for indicating where to switch areas for layouts */ case 'DIVIDE': $cl = '_'.strtolower($element); @@ -181,7 +189,7 @@ switch ($element) { case 'SLIDE': - $this->objects[++$this->coid] = new _footer(); + $this->objects[] = new _footer(); /* fall-through */ case 'BLURB': case 'IMAGE': @@ -190,7 +198,10 @@ case 'LINK': case 'PHP': case 'DIVIDE': - case 'TABLE': + $this->coid = array_pop($this->stack); + break; + case 'DIV': + $this->objects[++$this->coid] = new _div_end(); $this->coid = array_pop($this->stack); break; case 'BULLET': http://cvs.php.net/viewvc.cgi/pres2/display.php?r1=1.39&r2=1.40&diff_format=u Index: pres2/display.php diff -u pres2/display.php:1.39 pres2/display.php:1.40 --- pres2/display.php:1.39 Mon Oct 23 17:27:57 2006 +++ pres2/display.php Thu May 3 11:28:39 2007 @@ -57,7 +57,7 @@ echo <<<HEADER <html> <head> -<base href="http://$_SERVER[HTTP_HOST]$this->baseDir"> +<base href="http://$_SERVER[HTTP_HOST]$this->baseDir"/> <title>{$presentation->title}</title> HEADER; switch($presentation->template) { @@ -71,6 +71,7 @@ $body_style = "margin-top: " . ($browser_is_IE ? "0px" : "8em") . ";"; break; } + $this->body_style = $body_style; include 'getwidth.php'; include $presentation->stylesheet; /* the following includes scripts necessary for various animations */ @@ -79,17 +80,22 @@ if($this->slideNum) echo '<link rel="prev" href="'.$this->presentationDir.'/'.$presentation->slides[$this->prevSlideNum]->filename."\" />\n"; if($this->nextSlideNum) echo '<link rel="next" href="'.$this->presentationDir.'/'.$presentation->slides[$this->nextSlideNum]->filename."\" />\n"; echo '</head>'; - echo "<body onResize=\"get_dims();\" style=\"".$body_style."\">\n"; while(list($this->coid,$obj) = each($this->objs)) { $obj->display(); } echo <<<FOOTER -</body> </html> FOOTER; } function _slide(&$slide) { + $body_style = $this->body_style; + $class = ''; + if ($this->pres->template != 'php') + { + $class = " class='{$slide->template}'"; + } + echo "<body onResize=\"get_dims();\" style=\"".$body_style."\"$class>\n"; $currentPres = $_SESSION['currentPres']; $navsize = $slide->navsize; @@ -117,7 +123,7 @@ break; case 'php2': - echo "<div id=\"stickyBar\" class=\"sticky\" align=\"$slide->titleAlign\" style=\"width: 100%\"><div class=\"navbar\">"; + echo "<div id=\"stickyBar\" class=\"sticky\" align=\"$slide->titleAlign\" style=\"align: {$slide->titleAlign}; width: 100%\"><div class=\"navbar\">"; echo "<table style=\"float: left;\" width=\"60%\" border=\"0\" cellpadding=0 cellspacing=0><tr>\n"; if(!empty($slide->logo1)) $logo1 = $slide->logo1; else $logo1 = $this->pres->logo1; @@ -229,7 +235,8 @@ echo "<div style=\"float: left; margin: -0.2em 2em 0 0; font-size: $navsize;\"><a href=\"http://$_SERVER[HTTP_HOST]$this->baseDir$this->showScript/$currentPres/$prev\" style=\"text-decoration: none; color: $slide->navcolor;\">".markup_text($this->prevTitle)."</a></div>"; echo "<div style=\"float: right; margin: -0.2em 2em 0 0; color: $slide->navcolor; font-size: $navsize;\"><a href=\"http://$_SERVER[HTTP_HOST]$this->baseDir$this->showScript/$currentPres/$next\" style=\"text-decoration: none; color: $slide->navcolor;\">".markup_text($this->nextTitle)."</a></div>"; } - echo '</div></div><div class="mainarea">'; + echo "</div></div>\n"; + echo "<div class=\"mainarea\">\n"; break; case 'php': @@ -340,7 +347,9 @@ function _image(&$image) { $effect = ''; $class = ''; + $alt = ' alt=""'; if($image->effect) $effect = "effect=\"$#image->effect\""; + if(isset($image->alt)) $alt = " alt='{$image->title}'"; if(isset($image->title)) echo "<h1 align=\"{$image->talign}\">".markup_text($image->title)."</h1>\n"; if ($image->width) { $size = "width=\"{$image->width}\" height=\"{$image->height}\""; @@ -359,7 +368,7 @@ } ?> <div <?php echo $effect?> align="<?php echo $image->align?>" style="margin-left: <?php echo $image->marginleft?>; margin-right: <?php echo $image->marginright?>;"> -<img align="<?php echo $image->align?>" src="<?php echo $this->slideDir.$image->filename?>" <?php echo $size?><?php echo $class?>> +<img align="<?php echo $image->align?>" src="<?php echo $this->slideDir.$image->filename?>" <?php echo $size?><?php echo $class?><?php echo $alt?>/> </div> <?php if(isset($image->clear)) echo "<br clear=\"".$image->clear."\"/>\n"; @@ -670,16 +679,16 @@ if (isset($bullet->class)) { $class = $bullet->class; } else { - $class = "pres_bullet'"; + $class = "pres_bullet"; } $attrs = ''; if (isset($bullet->effect) && !empty($bullet->effect)) { $attrs = " style='' effect='{$bullet->effect}'"; } if ($symbol != '•') - echo "\n<div $attrs><li class='$class' style='list-style-type: none;'><tt>{$symbol}</tt> $markedText</li></div>"; + echo "\n<li class='$class' style='list-style-type: none;'><div $attrs><tt>{$symbol}</tt> $markedText</div></li>"; else - echo "\n<div $attrs><li class='$class'>$markedText</li></div>"; + echo "\n<li class='$class'><div $attrs>$markedText</div></li>"; } else { echo "\n<div $eff_str style=\"position: relative;\"><li style=\"$style\">".'<tt>'.$symbol.'</tt> '.$markedText."</li></div>\n"; } @@ -751,7 +760,7 @@ else $leader=''; if (empty($link->target)) $link->target = '_self'; if(!empty($link->text)) { - if ($this->pres->template == 'css') { + if ($this->pres->template == 'css') { $class = ''; if (empty($link->class)) $link->class = 'link'; echo "<div class='{$link->class}'>".markup_text($leader)."<a href='{$link->href}' target='{$link->target}'>".markup_text($link->text)."</a></div>\n"; @@ -815,6 +824,9 @@ <?php } break; + case 'css': + echo "</div>\n"; + /* (this seemed too intrusive) case 'php2': if($this->nextTitle) { @@ -827,6 +839,7 @@ break; */ } + echo "</body>\n"; } } @@ -1298,10 +1311,11 @@ pdf_set_info($this->pdf, "Subject", isset($presentation->topic)?$presentation->topic:""); while(list($this->slideNum,$slide) = each($presentation->slides)) { - // testing hack - $slideDir = dirname($this->presentationDir.'/'.$presentation->slides[$this->slideNum]->filename).'/'; - $fn = $this->presentationDir.'/'.$presentation->slides[$this->slideNum]->filename; - $r =& new XML_Slide($fn); + // testing hack + $slideDir = dirname($this->presentationDir.'/'.$presentation->slides[$this->slideNum]->filename).'/'; + $fn = $this->presentationDir.'/'.$presentation->slides[$this->slideNum]->filename; + $fh = fopen($fn, "rb"); + $r =& new XML_Slide($fh); $r->setErrorHandling(PEAR_ERROR_DIE,"%s ($fn)\n"); $r->parse(); http://cvs.php.net/viewvc.cgi/pres2/getwidth.php?r1=1.5&r2=1.6&diff_format=u Index: pres2/getwidth.php diff -u pres2/getwidth.php:1.5 pres2/getwidth.php:1.6 --- pres2/getwidth.php:1.5 Sun Apr 27 20:45:05 2003 +++ pres2/getwidth.php Thu May 3 11:28:39 2007 @@ -1,4 +1,4 @@ -<?/* +<?php /* A bit of fancy footwork to get the browser's inside dimensions in pixels. Should work on both NS4+ and IE4+. If it doesn't we default it to something sane. The dimensions are returned to the server via @@ -6,7 +6,7 @@ function is called if we don't have the dimensions already, or on a resize event to fetch the new window dimensions. */?> -<script language="JavaScript" defer="defer"> +<script type="text/javascript" language="JavaScript" defer="defer"> <!-- function get_dims() { var winW = 1024; http://cvs.php.net/viewvc.cgi/pres2/index.php?r1=1.46&r2=1.47&diff_format=u Index: pres2/index.php diff -u pres2/index.php:1.46 pres2/index.php:1.47 --- pres2/index.php:1.46 Tue Nov 22 17:29:38 2005 +++ pres2/index.php Thu May 3 11:28:39 2007 @@ -32,8 +32,8 @@ $i = 0; foreach($ps as $pres_id=>$filename) { - - $p = &new XML_Presentation($filename); + $fh = fopen($filename, "rb"); + $p = &new XML_Presentation($fh); $p->setErrorHandling(PEAR_ERROR_DIE,"%s\n"); $p->parse(); $pres = $p->getObjects(); @@ -75,7 +75,7 @@ unset($pres); // default options for the file.. - $p = &new XML_Presentation("index.xml"); + $p = &new XML_Presentation(fopen("index.xml", "rb")); $p->setErrorHandling(PEAR_ERROR_DIE,"%s\n"); $p->parse(); $pres = $p->getObjects(); @@ -87,7 +87,7 @@ <base href="<?php echo "http://".$_SERVER['HTTP_HOST'].$baseDir?>"> <title>PHP Presents</title> <?php include("css.php"); ?> -<script language="JavaScript1.2"> +<script language="JavaScript1.2" type="text/javascript"> <!-- function change_mode() { document.cookie="display_mode="+document.modes_form.modes.options[document.modes_form.modes.selectedIndex].value+"|"+document.modes_form.speaker.checked; http://cvs.php.net/viewvc.cgi/pres2/keyboard.js.php?r1=1.19&r2=1.20&diff_format=u Index: pres2/keyboard.js.php diff -u pres2/keyboard.js.php:1.19 pres2/keyboard.js.php:1.20 --- pres2/keyboard.js.php:1.19 Sat Apr 22 10:31:37 2006 +++ pres2/keyboard.js.php Thu May 3 11:28:39 2007 @@ -1,6 +1,6 @@ <script type="text/javascript" language="javascript" src="1k.js"></script> <script type="text/javascript" language="javascript" src="slide.js"></script> -<script language="JavaScript1.2"> +<script type="text/javascript" language="JavaScript1.2"> <!-- if(!document.all) { window.captureEvents(Event.KEYUP); http://cvs.php.net/viewvc.cgi/pres2/show.php?r1=1.60&r2=1.61&diff_format=u Index: pres2/show.php diff -u pres2/show.php:1.60 pres2/show.php:1.61 --- pres2/show.php:1.60 Mon Oct 23 06:25:28 2006 +++ pres2/show.php Thu May 3 11:28:39 2007 @@ -1,5 +1,5 @@ <?php - error_reporting(E_ALL); +/// error_reporting(E_ALL); require_once 'config.php'; $c = compact('presentationDir', 'baseDir', 'showScript', 'helpPage', 'baseFontSize', @@ -22,7 +22,8 @@ session_start(); // Figure out which presentation file to read and slide to show - $presFile = trim(trim($_SERVER['PATH_INFO']),'/'); + $presFile = trim($_SERVER['PATH_INFO']); + $presFile = trim($presFile ,'/'); if (substr($presFile,-4) == ".pdf") { $navmode = 'pdfus'; $presFile = substr($presFile, 0, -4); @@ -36,7 +37,7 @@ Adding support for URLs such as http://shiflett.org/talks/oscon2004/php-security */ - $urlArray = explode('/', $presFile); + $urlArray = explode('/', (string) $presFile); $slideNumIndex = sizeof($urlArray) - 1; if ($urlArray[$slideNumIndex] == strval(intval($urlArray[$slideNumIndex]))) { $slideNum = $urlArray[$slideNumIndex]; @@ -53,11 +54,12 @@ */ if(!isset($_SESSION['titlesLoaded'])) $_SESSION['titlesLoaded'] = 0; - $presFile = str_replace('..','',$_SESSION['currentPres']); // anti-hack + $presFile = str_replace('..','',(string)$_SESSION['currentPres']); // anti-hack $presFile = "$presentationDir/$presFile".'.xml'; // Load in the presentation - $p =& new XML_Presentation($presFile); + $fh = fopen($presFile, "rb"); + $p =& new XML_Presentation($fh); $p->setErrorHandling(PEAR_ERROR_DIE,"%s\n"); $p->parse(); $pres = $p->getObjects(); @@ -117,7 +119,8 @@ // Load the slide $mode->slideDir = dirname($presentationDir.'/'.$pres->slides[$mode->slideNum]->filename).'/'; - $r =& new XML_Slide($presentationDir.'/'.$pres->slides[$mode->slideNum]->filename); + $fh = fopen($presentationDir.'/'.$pres->slides[$mode->slideNum]->filename, "rb"); + $r =& new XML_Slide($fh); $r->setErrorHandling(PEAR_ERROR_DIE,"%s\n"); $r->parse(); // Display slide @@ -128,9 +131,10 @@ function get_all_titles($pres) { global $presentationDir; - reset($pres); while(list($slideNum,$slide) = each($pres->slides)) { - $r =& new XML_Slide($presentationDir.'/'.$pres->slides[$slideNum]->filename); +// $r =& new XML_Slide($presentationDir.'/'.$pres->slides[$slideNum]->filename); + $fh = fopen($presentationDir.'/'.$pres->slides[$slideNum]->filename, "rb"); + $r =& new XML_Slide($fh); $r->parse(); $objs = $r->getObjects();
http://cvs.php.net/viewvc.cgi/pres2/XML_Presentation.php?r1=1.4&r2=1.5&diff_format=u Index: pres2/XML_Presentation.php diff -u pres2/XML_Presentation.php:1.4 pres2/XML_Presentation.php:1.5 --- pres2/XML_Presentation.php:1.4 Tue Nov 22 17:29:37 2005 +++ pres2/XML_Presentation.php Thu May 3 11:28:39 2007 @@ -17,7 +17,7 @@ // | Authors: Rasmus Lerdorf <rasmus@php.net> | // +----------------------------------------------------------------------+ // -// $Id: XML_Presentation.php,v 1.4 2005/11/22 17:29:37 rasmus Exp $ +// $Id: XML_Presentation.php,v 1.5 2007/05/03 11:28:39 derick Exp $ // }}} require_once 'XML/Parser.php'; @@ -29,7 +29,7 @@ * This class is a parser for the .pres files * * @author Rasmus Lerdorf <rasmus@php.net> - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ * @access public */ class XML_Presentation extends XML_Parser @@ -106,7 +106,7 @@ * @param array Attributes of XML tag * @return void */ - function startHandler($parser, $element, $attribs) + function startHandler($parser, $element, &$attribs) { switch ($element) { /* These tags can have other tags inside */ http://cvs.php.net/viewvc.cgi/pres2/XML_Slide.php?r1=1.12&r2=1.13&diff_format=u Index: pres2/XML_Slide.php diff -u pres2/XML_Slide.php:1.12 pres2/XML_Slide.php:1.13 --- pres2/XML_Slide.php:1.12 Mon Oct 23 06:25:28 2006 +++ pres2/XML_Slide.php Thu May 3 11:28:39 2007 @@ -17,7 +17,7 @@ // | Authors: Rasmus Lerdorf <rasmus@php.net> | // +----------------------------------------------------------------------+ // -// $Id: XML_Slide.php,v 1.12 2006/10/23 06:25:28 rasmus Exp $ +// $Id: XML_Slide.php,v 1.13 2007/05/03 11:28:39 derick Exp $ // }}} require_once 'XML/Parser.php'; @@ -29,7 +29,7 @@ * This class is a parser for a made up presentation slide format * * @author Rasmus Lerdorf <rasmus@php.net> - * @version $Revision: 1.12 $ + * @version $Revision: 1.13 $ * @access public */ class XML_Slide extends XML_Parser @@ -77,7 +77,6 @@ function XML_Slide($handle = '') { $this->XML_Parser(); - if (@is_resource($handle)) { $this->setInput($handle); } elseif ($handle != '') { @@ -99,7 +98,7 @@ * @param array Attributes of XML tag * @return void */ - function startHandler($parser, $element, $attribs) + function startHandler($parser, $element, &$attribs) { switch ($element) { /* These tags can have other tags inside */ @@ -121,6 +120,15 @@ $this->activeTag = 'text'; break; + case 'DIV': + $cl = '_'.strtolower($element); + $this->objects[++$this->coid] = new $cl(); + $this->stack[] = $this->coid; + $this->insideTag = $element; + $this->_add_attribs($this->objects[$this->coid], $attribs); + $this->activeTag = 'text'; + break; + /* Divider for indicating where to switch areas for layouts */ case 'DIVIDE': $cl = '_'.strtolower($element); @@ -181,7 +189,7 @@ switch ($element) { case 'SLIDE': - $this->objects[++$this->coid] = new _footer(); + $this->objects[] = new _footer(); /* fall-through */ case 'BLURB': case 'IMAGE': @@ -190,7 +198,10 @@ case 'LINK': case 'PHP': case 'DIVIDE': - case 'TABLE': + $this->coid = array_pop($this->stack); + break; + case 'DIV': + $this->objects[++$this->coid] = new _div_end(); $this->coid = array_pop($this->stack); break; case 'BULLET': http://cvs.php.net/viewvc.cgi/pres2/display.php?r1=1.39&r2=1.40&diff_format=u Index: pres2/display.php diff -u pres2/display.php:1.39 pres2/display.php:1.40 --- pres2/display.php:1.39 Mon Oct 23 17:27:57 2006 +++ pres2/display.php Thu May 3 11:28:39 2007 @@ -57,7 +57,7 @@ echo <<<HEADER <html> <head> -<base href="http://$_SERVER[HTTP_HOST]$this->baseDir"> +<base href="http://$_SERVER[HTTP_HOST]$this->baseDir"/> <title>{$presentation->title}</title> HEADER; switch($presentation->template) { @@ -71,6 +71,7 @@ $body_style = "margin-top: " . ($browser_is_IE ? "0px" : "8em") . ";"; break; } + $this->body_style = $body_style; include 'getwidth.php'; include $presentation->stylesheet; /* the following includes scripts necessary for various animations */ @@ -79,17 +80,22 @@ if($this->slideNum) echo '<link rel="prev" href="'.$this->presentationDir.'/'.$presentation->slides[$this->prevSlideNum]->filename."\" />\n"; if($this->nextSlideNum) echo '<link rel="next" href="'.$this->presentationDir.'/'.$presentation->slides[$this->nextSlideNum]->filename."\" />\n"; echo '</head>'; - echo "<body onResize=\"get_dims();\" style=\"".$body_style."\">\n"; while(list($this->coid,$obj) = each($this->objs)) { $obj->display(); } echo <<<FOOTER -</body> </html> FOOTER; } function _slide(&$slide) { + $body_style = $this->body_style; + $class = ''; + if ($this->pres->template != 'php') + { + $class = " class='{$slide->template}'"; + } + echo "<body onResize=\"get_dims();\" style=\"".$body_style."\"$class>\n"; $currentPres = $_SESSION['currentPres']; $navsize = $slide->navsize; @@ -117,7 +123,7 @@ break; case 'php2': - echo "<div id=\"stickyBar\" class=\"sticky\" align=\"$slide->titleAlign\" style=\"width: 100%\"><div class=\"navbar\">"; + echo "<div id=\"stickyBar\" class=\"sticky\" align=\"$slide->titleAlign\" style=\"align: {$slide->titleAlign}; width: 100%\"><div class=\"navbar\">"; echo "<table style=\"float: left;\" width=\"60%\" border=\"0\" cellpadding=0 cellspacing=0><tr>\n"; if(!empty($slide->logo1)) $logo1 = $slide->logo1; else $logo1 = $this->pres->logo1; @@ -229,7 +235,8 @@ echo "<div style=\"float: left; margin: -0.2em 2em 0 0; font-size: $navsize;\"><a href=\"http://$_SERVER[HTTP_HOST]$this->baseDir$this->showScript/$currentPres/$prev\" style=\"text-decoration: none; color: $slide->navcolor;\">".markup_text($this->prevTitle)."</a></div>"; echo "<div style=\"float: right; margin: -0.2em 2em 0 0; color: $slide->navcolor; font-size: $navsize;\"><a href=\"http://$_SERVER[HTTP_HOST]$this->baseDir$this->showScript/$currentPres/$next\" style=\"text-decoration: none; color: $slide->navcolor;\">".markup_text($this->nextTitle)."</a></div>"; } - echo '</div></div><div class="mainarea">'; + echo "</div></div>\n"; + echo "<div class=\"mainarea\">\n"; break; case 'php': @@ -340,7 +347,9 @@ function _image(&$image) { $effect = ''; $class = ''; + $alt = ' alt=""'; if($image->effect) $effect = "effect=\"$#image->effect\""; + if(isset($image->alt)) $alt = " alt='{$image->title}'"; if(isset($image->title)) echo "<h1 align=\"{$image->talign}\">".markup_text($image->title)."</h1>\n"; if ($image->width) { $size = "width=\"{$image->width}\" height=\"{$image->height}\""; @@ -359,7 +368,7 @@ } ?> <div <?php echo $effect?> align="<?php echo $image->align?>" style="margin-left: <?php echo $image->marginleft?>; margin-right: <?php echo $image->marginright?>;"> -<img align="<?php echo $image->align?>" src="<?php echo $this->slideDir.$image->filename?>" <?php echo $size?><?php echo $class?>> +<img align="<?php echo $image->align?>" src="<?php echo $this->slideDir.$image->filename?>" <?php echo $size?><?php echo $class?><?php echo $alt?>/> </div> <?php if(isset($image->clear)) echo "<br clear=\"".$image->clear."\"/>\n"; @@ -670,16 +679,16 @@ if (isset($bullet->class)) { $class = $bullet->class; } else { - $class = "pres_bullet'"; + $class = "pres_bullet"; } $attrs = ''; if (isset($bullet->effect) && !empty($bullet->effect)) { $attrs = " style='' effect='{$bullet->effect}'"; } if ($symbol != '•') - echo "\n<div $attrs><li class='$class' style='list-style-type: none;'><tt>{$symbol}</tt> $markedText</li></div>"; + echo "\n<li class='$class' style='list-style-type: none;'><div $attrs><tt>{$symbol}</tt> $markedText</div></li>"; else - echo "\n<div $attrs><li class='$class'>$markedText</li></div>"; + echo "\n<li class='$class'><div $attrs>$markedText</div></li>"; } else { echo "\n<div $eff_str style=\"position: relative;\"><li style=\"$style\">".'<tt>'.$symbol.'</tt> '.$markedText."</li></div>\n"; } @@ -751,7 +760,7 @@ else $leader=''; if (empty($link->target)) $link->target = '_self'; if(!empty($link->text)) { - if ($this->pres->template == 'css') { + if ($this->pres->template == 'css') { $class = ''; if (empty($link->class)) $link->class = 'link'; echo "<div class='{$link->class}'>".markup_text($leader)."<a href='{$link->href}' target='{$link->target}'>".markup_text($link->text)."</a></div>\n"; @@ -815,6 +824,9 @@ <?php } break; + case 'css': + echo "</div>\n"; + /* (this seemed too intrusive) case 'php2': if($this->nextTitle) { @@ -827,6 +839,7 @@ break; */ } + echo "</body>\n"; } } @@ -1298,10 +1311,11 @@ pdf_set_info($this->pdf, "Subject", isset($presentation->topic)?$presentation->topic:""); while(list($this->slideNum,$slide) = each($presentation->slides)) { - // testing hack - $slideDir = dirname($this->presentationDir.'/'.$presentation->slides[$this->slideNum]->filename).'/'; - $fn = $this->presentationDir.'/'.$presentation->slides[$this->slideNum]->filename; - $r =& new XML_Slide($fn); + // testing hack + $slideDir = dirname($this->presentationDir.'/'.$presentation->slides[$this->slideNum]->filename).'/'; + $fn = $this->presentationDir.'/'.$presentation->slides[$this->slideNum]->filename; + $fh = fopen($fn, "rb"); + $r =& new XML_Slide($fh); $r->setErrorHandling(PEAR_ERROR_DIE,"%s ($fn)\n"); $r->parse(); http://cvs.php.net/viewvc.cgi/pres2/getwidth.php?r1=1.5&r2=1.6&diff_format=u Index: pres2/getwidth.php diff -u pres2/getwidth.php:1.5 pres2/getwidth.php:1.6 --- pres2/getwidth.php:1.5 Sun Apr 27 20:45:05 2003 +++ pres2/getwidth.php Thu May 3 11:28:39 2007 @@ -1,4 +1,4 @@ -<?/* +<?php /* A bit of fancy footwork to get the browser's inside dimensions in pixels. Should work on both NS4+ and IE4+. If it doesn't we default it to something sane. The dimensions are returned to the server via @@ -6,7 +6,7 @@ function is called if we don't have the dimensions already, or on a resize event to fetch the new window dimensions. */?> -<script language="JavaScript" defer="defer"> +<script type="text/javascript" language="JavaScript" defer="defer"> <!-- function get_dims() { var winW = 1024; http://cvs.php.net/viewvc.cgi/pres2/index.php?r1=1.46&r2=1.47&diff_format=u Index: pres2/index.php diff -u pres2/index.php:1.46 pres2/index.php:1.47 --- pres2/index.php:1.46 Tue Nov 22 17:29:38 2005 +++ pres2/index.php Thu May 3 11:28:39 2007 @@ -32,8 +32,8 @@ $i = 0; foreach($ps as $pres_id=>$filename) { - - $p = &new XML_Presentation($filename); + $fh = fopen($filename, "rb"); + $p = &new XML_Presentation($fh); $p->setErrorHandling(PEAR_ERROR_DIE,"%s\n"); $p->parse(); $pres = $p->getObjects(); @@ -75,7 +75,7 @@ unset($pres); // default options for the file.. - $p = &new XML_Presentation("index.xml"); + $p = &new XML_Presentation(fopen("index.xml", "rb")); $p->setErrorHandling(PEAR_ERROR_DIE,"%s\n"); $p->parse(); $pres = $p->getObjects(); @@ -87,7 +87,7 @@ <base href="<?php echo "http://".$_SERVER['HTTP_HOST'].$baseDir?>"> <title>PHP Presents</title> <?php include("css.php"); ?> -<script language="JavaScript1.2"> +<script language="JavaScript1.2" type="text/javascript"> <!-- function change_mode() { document.cookie="display_mode="+document.modes_form.modes.options[document.modes_form.modes.selectedIndex].value+"|"+document.modes_form.speaker.checked; http://cvs.php.net/viewvc.cgi/pres2/keyboard.js.php?r1=1.19&r2=1.20&diff_format=u Index: pres2/keyboard.js.php diff -u pres2/keyboard.js.php:1.19 pres2/keyboard.js.php:1.20 --- pres2/keyboard.js.php:1.19 Sat Apr 22 10:31:37 2006 +++ pres2/keyboard.js.php Thu May 3 11:28:39 2007 @@ -1,6 +1,6 @@ <script type="text/javascript" language="javascript" src="1k.js"></script> <script type="text/javascript" language="javascript" src="slide.js"></script> -<script language="JavaScript1.2"> +<script type="text/javascript" language="JavaScript1.2"> <!-- if(!document.all) { window.captureEvents(Event.KEYUP); http://cvs.php.net/viewvc.cgi/pres2/show.php?r1=1.60&r2=1.61&diff_format=u Index: pres2/show.php diff -u pres2/show.php:1.60 pres2/show.php:1.61 --- pres2/show.php:1.60 Mon Oct 23 06:25:28 2006 +++ pres2/show.php Thu May 3 11:28:39 2007 @@ -1,5 +1,5 @@ <?php - error_reporting(E_ALL); +/// error_reporting(E_ALL); require_once 'config.php'; $c = compact('presentationDir', 'baseDir', 'showScript', 'helpPage', 'baseFontSize', @@ -22,7 +22,8 @@ session_start(); // Figure out which presentation file to read and slide to show - $presFile = trim(trim($_SERVER['PATH_INFO']),'/'); + $presFile = trim($_SERVER['PATH_INFO']); + $presFile = trim($presFile ,'/'); if (substr($presFile,-4) == ".pdf") { $navmode = 'pdfus'; $presFile = substr($presFile, 0, -4); @@ -36,7 +37,7 @@ Adding support for URLs such as http://shiflett.org/talks/oscon2004/php-security */ - $urlArray = explode('/', $presFile); + $urlArray = explode('/', (string) $presFile); $slideNumIndex = sizeof($urlArray) - 1; if ($urlArray[$slideNumIndex] == strval(intval($urlArray[$slideNumIndex]))) { $slideNum = $urlArray[$slideNumIndex]; @@ -53,11 +54,12 @@ */ if(!isset($_SESSION['titlesLoaded'])) $_SESSION['titlesLoaded'] = 0; - $presFile = str_replace('..','',$_SESSION['currentPres']); // anti-hack + $presFile = str_replace('..','',(string)$_SESSION['currentPres']); // anti-hack $presFile = "$presentationDir/$presFile".'.xml'; // Load in the presentation - $p =& new XML_Presentation($presFile); + $fh = fopen($presFile, "rb"); + $p =& new XML_Presentation($fh); $p->setErrorHandling(PEAR_ERROR_DIE,"%s\n"); $p->parse(); $pres = $p->getObjects(); @@ -117,7 +119,8 @@ // Load the slide $mode->slideDir = dirname($presentationDir.'/'.$pres->slides[$mode->slideNum]->filename).'/'; - $r =& new XML_Slide($presentationDir.'/'.$pres->slides[$mode->slideNum]->filename); + $fh = fopen($presentationDir.'/'.$pres->slides[$mode->slideNum]->filename, "rb"); + $r =& new XML_Slide($fh); $r->setErrorHandling(PEAR_ERROR_DIE,"%s\n"); $r->parse(); // Display slide @@ -128,9 +131,10 @@ function get_all_titles($pres) { global $presentationDir; - reset($pres); while(list($slideNum,$slide) = each($pres->slides)) { - $r =& new XML_Slide($presentationDir.'/'.$pres->slides[$slideNum]->filename); +// $r =& new XML_Slide($presentationDir.'/'.$pres->slides[$slideNum]->filename); + $fh = fopen($presentationDir.'/'.$pres->slides[$slideNum]->filename, "rb"); + $r =& new XML_Slide($fh); $r->parse(); $objs = $r->getObjects();