Changeset 129
- Timestamp:
- 01/07/05 19:32:36 (4 years ago)
- Files:
-
- admin.lib.php (modified) (2 diffs)
- blog.lib.php (modified) (8 diffs)
- feed.php (modified) (2 diffs)
- index.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
admin.lib.php
r127 r129 40 40 $this->shortDateFormat = "Y-m-d"; 41 41 $this->longDateFormat = "r"; 42 $this->httpPath = dirname($_SERVER['SCRIPT_NAME'])."/"; 42 $this->httpPath = dirname($_SERVER['SCRIPT_NAME']); 43 if($this->httpPath[strlen($this->httpPath)-1]!="/") { 44 $this->httpPath .= "/"; 45 } 43 46 $this->adminPath = $this->httpPath."admin.php/"; 44 47 $this->basePath = $this->httpPath."index.php/"; … … 439 442 echo "</p>\n"; 440 443 echo "<p>\n"; 441 echo "<textarea name=\"body\" id=\"body\" cols=\" 50\" rows=\"10\" tabindex=\"3\">" . (($show) ? br2nl($row['body']) : "") . "</textarea>\n";444 echo "<textarea name=\"body\" id=\"body\" cols=\"75\" rows=\"30\" tabindex=\"3\">" . (($show) ? br2nl($row['body']) : "") . "</textarea>\n"; 442 445 echo "</p>\n"; 443 446 echo "<p>\n"; blog.lib.php
r127 r129 1 1 <?php 2 /* vim: set tabstop=4: */ 2 3 /* 3 4 * blogs class - provides functions for blogs … … 67 68 $this->longDateFormat = "%c"; 68 69 //path for all http stuff.. ie images, css and so on 69 $this->httpPath = dirname($_SERVER['SCRIPT_NAME'])."/"; 70 $this->httpPath = dirname($_SERVER['SCRIPT_NAME']); 71 // make the httpPath work nicely if we're not in a subdir 72 if(substr($this->httpPath, -1)!="/") { 73 $this->httpPath .= "/"; 74 } 70 75 //path for the blog viewer with no user 71 76 $this->basePath = $this->httpPath."index.php/"; … … 201 206 $sql = db_query("SELECT timestamp, name, email, body, host, id FROM comments WHERE post = ".$postid." and moderated = true ORDER BY timestamp ASC limit ".$limit." OFFSET ".$offset.";"); 202 207 $sqlNum = db_num_rows($sql); 208 echo "<div id=\"comments\">\n"; 203 209 if ($sqlNum > 0) { 204 210 $blogOwner = $this->checkSessionOwner(); … … 206 212 echo "<form name=\"deletecomments\" id=\"deletecomments\" method=\"post\" action=\"{$this->adminPath}deletecomments/{$this->currentEntry}\">\n"; 207 213 } 208 echo "<div id=\"comments\">\n";209 214 210 215 $count=0; … … 213 218 } 214 219 215 echo "</div>\n";216 220 217 221 if($blogOwner) { … … 222 226 } 223 227 } 228 echo "</div>\n"; 224 229 } 225 230 … … 432 437 echo "<li><a href=\"{$this->blogPath}archive/\">"._("Archive")."</a></li>\n"; 433 438 //put the path back together, and dont forget the tailing slash 434 echo "<li><a href=\"{$this->basePath} \">"._("Other Bloggers")."</a></li>\n";439 echo "<li><a href=\"{$this->basePath}list/\">"._("Other Bloggers")."</a></li>\n"; 435 440 if ($this->checkSessionOwner()){ 436 441 echo "<li><a href=\"{$this->adminPath}\">"._("Blog admin")."</a></li>\n"; … … 473 478 $this->title = _("SUCS Blogs"); 474 479 $this->description = _("Swansea University Computer Society member web logs"); 475 $this->httpPath = dirname($_SERVER['SCRIPT_NAME'])."/"; 480 $this->httpPath = dirname($_SERVER['SCRIPT_NAME']); 481 if(substr($this->httpPath, -1)!="/") { 482 $this->httpPath .= "/"; 483 } 476 484 $this->basePath = $this->httpPath."index.php/"; 477 485 $this->adminPath = $this->httpPath."admin.php/"; feed.php
r128 r129 19 19 if(db_num_rows($result)!=1){ 20 20 error(1, "No such user"); 21 } 21 } 22 22 else { 23 23 //fetch the users info from the db 24 24 $row = db_getrow($result); 25 25 $user = $row; 26 $user['link'] = "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME'])."/index.php/".$user['username']."/"; 26 if(substr(dirname($_SERVER['SCRIPT_NAME']), -1)=="/"){ 27 $user['link'] = "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME'])."index.php/".$user['username']."/"; 28 } 29 else { 30 $user['link'] = "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME'])."/index.php/".$user['username']."/"; 31 } 27 32 } 28 33 … … 44 49 $row = db_getrow($result); 45 50 $pubdate = date("r",strtotime($row['timestamp'])); 46 47 51 $entries = ""; 48 52 //output this entry index.php
r128 r129 1 1 <?php 2 $DEBUG = FALSE; 3 2 4 include("blog.lib.php"); 3 5 $request=explode('/',substr($_SERVER[PATH_INFO], 1)); … … 28 30 <h1><a href="<?php echo $blog->blogPath; ?>"><? echo $blog->title; ?></a></h1> 29 31 <h2><? echo $blog->description; ?></h2> 30 <h3><? if ($blog-> userName != "") echo _("A weblog by")." ".$blog->userName; ?></h3>32 <h3><? if ($blog->realName != "") echo _("A weblog by")." ".$blog->realName; ?></h3> 31 33 </div> 32 34 <div id="content"> … … 75 77 </div> 76 78 <div id="botbot"></div> 77 <pre><?php print_r($_SESSION); print_r($_COOKIE); ?></pre> 79 <?php 80 if($DEBUG) { 81 echo "<pre>"; 82 print_r($_SESSION); 83 print_r($_COOKIE); 84 print_r($blog); 85 echo "</pre>"; 86 } 87 ?> 78 88 </body> 79 89 </html>
