Changeset 151
- Timestamp:
- 20/07/05 19:08:12 (3 years ago)
- Files:
-
- blog.lib.php (modified) (5 diffs)
- index.php (modified) (2 diffs)
- miscfunctions.lib.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
blog.lib.php
r149 r151 12 12 // Some useful validation functions 13 13 require_once("validation.lib.php"); 14 15 // Some useful miscellaneous functions 16 require_once("miscfunctions.lib.php"); 14 17 15 18 /* a stub of an error handler … … 44 47 var $entryTags; //what we allow in the entry 45 48 var $currentEntry; // the shortsubject of the current entry (where applicable) 49 var $svnRevision; // the SVN revision number of the currently running blog 46 50 47 51 //Constructor - checks we've been given a valid username, and pulls in generic blog info … … 85 89 $this->entryTags = array('<b>','<i>','<strong>','<em>','<p>','<a>','<img>','<hr>','<br>'); 86 90 $this->currentEntry = ""; 91 $this->svnRevision = getSVNRevision(); 87 92 88 93 // setup the session … … 473 478 var $adminPath; 474 479 var $cssFile; 480 var $svnRevision; // the SVN revision number of the currently running blog 475 481 476 482 // don't do anything apart from setting up default variables … … 486 492 $this->adminPath = $this->httpPath."admin.php/"; 487 493 $this->cssFile = "blog.css"; 494 $this->svnRevision = getSVNRevision(); 488 495 489 496 // setup the session purely so we get the debug bits.. index.php
r145 r151 42 42 <p class="sideblurb"> 43 43 <br /> 44 <a href="http://sucs.org"><img src="<? echo $blog->httpPath."img/sucspow.png"; ?>" alt="<? echo _("Powered by SUCS"); ?>" height="13" width="80" /></a>44 <a href="http://sucs.org"><img alt="<?php echo _("Powered by SUCS Blog r").$blog->svnRevision; ?>" src="<? echo $blog->httpPath."img/sucspow.png"; ?>" height="13" width="80" /></a> 45 45 </p> 46 46 </div> … … 86 86 echo "RSS"; 87 87 } 88 echo " :: "._("SUCS Blog version ").$blog->svnRevision; 88 89 ?> 89 90 </p> miscfunctions.lib.php
r148 r151 39 39 } 40 40 41 $revision = "unknown"; 42 function startElement($parser, $name, $attrs) 43 { 44 global $revision; 45 if($name=="ENTRY" && $attrs['NAME']=="") { 46 $revision = $attrs['REVISION']; 47 } 48 } 49 50 function endElement($parser, $name){} 51 52 function getSVNRevision() 53 { 54 global $revision; 55 $xml_parser = xml_parser_create(); 56 xml_set_element_handler($xml_parser, "startElement", "endElement"); 57 if (!($fp = fopen(".svn/entries", "r"))) { 58 return "unknown - couldn't open SVN XML file."; 59 } 60 while(($data = fread($fp, 1024)) && $revision=="unknown") { 61 if (!xml_parse($xml_parser, $data, feof($fp))) { 62 return "unknown - couldn't parse SVN XML file"; 63 } 64 } 65 xml_parser_free($xml_parser); 66 return $revision; 67 } 41 68 ?>
