Changeset 127
- Timestamp:
- 01/07/05 15:54:28 (4 years ago)
- Files:
-
- admin.lib.php (modified) (8 diffs)
- blog.lib.php (modified) (10 diffs)
- index.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
admin.lib.php
r124 r127 25 25 var $httpPath; //http Path for files 26 26 var $adminPath; //path to admin 27 var $blogPath; //path to blog for a specific user 28 var $basePath; //path to the display blog bits 27 29 var $blog; //[temporary] holder for instance of blog class 28 30 … … 40 42 $this->httpPath = dirname($_SERVER['SCRIPT_NAME'])."/"; 41 43 $this->adminPath = $this->httpPath."admin.php/"; 44 $this->basePath = $this->httpPath."index.php/"; 42 45 if ($this->userName) { 43 46 $this->blog = new blogs($this->userName); 47 $this->blogPath = $this->basePath.$this->userName."/"; 44 48 } 45 49 } … … 144 148 echo "</a></li>\n"; 145 149 if ($this->userName) { 146 echo "<li><a href=\"".$this-> httpPath."index.php/".$this->userName."\">"._("My blog")."</a></li>\n"; //index.php will need removing when we fix that150 echo "<li><a href=\"".$this->blogPath."\">"._("My blog")."</a></li>\n"; 147 151 } 148 152 echo "</ul>\n"; … … 453 457 echo "<div class=\"entry\">\n"; 454 458 echo "<h2>"._("Blog Settings")."</h2>\n"; 455 echo "<form action=\"".$this-> blogPath."postsettings\" method=\"post\" id=\"settingsform\">\n";459 echo "<form action=\"".$this->adminPath."postsettings\" method=\"post\" id=\"settingsform\">\n"; 456 460 echo "<p>\n"; 457 461 echo "<input type=\"text\" name=\"name\" id=\"name\" value=\"" . $settings[name] . "\" size=\"30\" maxlength=\"60\" tabindex=\"1\" />\n"; … … 509 513 while($r = db_getrow($result)) { 510 514 echo "\t<tr>\n"; 511 echo "\t\t<td><a href=\"{$this-> httpPath}index.php/{$this->userName}/entry/{$r['shortsubject']}\">{$r['subject']}</a></td>\n";515 echo "\t\t<td><a href=\"{$this->blogPath}entry/{$r['shortsubject']}\">{$r['subject']}</a></td>\n"; 512 516 echo "\t\t<td><a href=\"mailto:{$r['email']}\" title=\"IP: {$r['host']}\">{$r['name']}</a></td>\n"; 513 517 echo "\t\t<td>{$r['body']}</td>\n"; … … 563 567 if(count($_POST['comment'])==0){ 564 568 error(5, _("No comments selected for deletion.")); 565 echo "<a href=\"{$this->blog ->blogPath}entry/$entry\">"._("Return to blog entry")."</a>\n";569 echo "<a href=\"{$this->blogPath}entry/$entry\">"._("Return to blog entry")."</a>\n"; 566 570 } else { 567 571 $del = "("; … … 575 579 } else { 576 580 echo "<div class=\"updateinfo\">".count($_POST['comment'])._(" comment(s) deleted.")."</div>\n"; 577 echo "<a href=\"{$this->blog ->blogPath}entry/$entry\">"._("Return to blog entry")."</a>\n";581 echo "<a href=\"{$this->blogPath}entry/$entry\">"._("Return to blog entry")."</a>\n"; 578 582 } 579 583 } … … 825 829 } 826 830 echo "<h2>"._("Add User")."</h2>\n"; 827 echo "<form action=\"".$this-> blogPath."adduser\" method=\"post\" id=\"adduserform\">\n";831 echo "<form action=\"".$this->adminPath."adduser\" method=\"post\" id=\"adduserform\">\n"; 828 832 echo "<p>\n"; 829 833 echo "<input type=\"text\" name=\"username\" id=\"username\" value=\"" . (($this->inputError != "") ? strip_tags(trim($_POST['username'])) : "") . "\" size=\"22\" maxlength=\"50\" tabindex=\"1\" />\n"; blog.lib.php
r123 r127 37 37 var $httpPath; //http Path for files 38 38 var $blogPath; //path to blog 39 var $basePath; //path to the display blog bits 40 var $adminPath; //path to blog admin page 39 41 var $commentError; //new comment errors 40 42 var $entryError; //new entry errors … … 64 66 $this->shortDateFormat = "%x %X"; 65 67 $this->longDateFormat = "%c"; 68 //path for all http stuff.. ie images, css and so on 66 69 $this->httpPath = dirname($_SERVER['SCRIPT_NAME'])."/"; 67 $this->blogPath = $this->httpPath."index.php/".$this->userName."/"; 70 //path for the blog viewer with no user 71 $this->basePath = $this->httpPath."index.php/"; 72 //path to this blog 73 $this->blogPath = $this->basePath.$this->userName."/"; 74 //path to the admin bits 75 $this->adminPath = $this->httpPath."admin.php/"; 68 76 $this->commentError = ''; 69 77 $this->entryError = ''; … … 100 108 echo " | Cat: <a href=\"".$this->blogPath."category/{$row['category']}\">".$this->categoryName($row['category'])."</a> "; 101 109 if($this->checkSessionOwner()){ 102 echo "| <a href=\"".$this-> httpPath."admin.php/update/{$row['shortsubject']}\">"._("Edit")."</a> ";103 //echo "| <a href=\"".$this-> httpPath."admin.php/deleteentry/{$row['shortsubject']}\">"._("Delete")."</a>";110 echo "| <a href=\"".$this->adminPath."update/{$row['shortsubject']}\">"._("Edit")."</a> "; 111 //echo "| <a href=\"".$this->adminPath."deleteentry/{$row['shortsubject']}\">"._("Delete")."</a>"; 104 112 } 105 113 echo " ]</p>\n"; … … 196 204 $blogOwner = $this->checkSessionOwner(); 197 205 if($blogOwner) { 198 echo "<form name=\"deletecomments\" id=\"deletecomments\" method=\"post\" action=\"{$this-> httpPath}admin.php/deletecomments/{$this->currentEntry}\">\n";206 echo "<form name=\"deletecomments\" id=\"deletecomments\" method=\"post\" action=\"{$this->adminPath}deletecomments/{$this->currentEntry}\">\n"; 199 207 } 200 208 echo "<div id=\"comments\">\n"; … … 423 431 echo "<li><a href=\"{$this->blogPath}\">"._("Blog Home")."</a></li>\n"; 424 432 echo "<li><a href=\"{$this->blogPath}archive/\">"._("Archive")."</a></li>\n"; 425 echo "<li><a href=\"{$this->httpPath}\">"._("Other Bloggers")."</a></li>\n"; 433 //put the path back together, and dont forget the tailing slash 434 echo "<li><a href=\"{$this->basePath}\">"._("Other Bloggers")."</a></li>\n"; 426 435 if ($this->checkSessionOwner()){ 427 echo "<li><a href=\"{$this-> httpPath}admin.php\">"._("Blog admin")."</a></li>\n";436 echo "<li><a href=\"{$this->adminPath}\">"._("Blog admin")."</a></li>\n"; 428 437 } elseif (!isset($_SESSION['userName'])) { 429 echo "<li><a href=\"{$this-> httpPath}admin.php\">"._("Log in")."</a></li>\n";438 echo "<li><a href=\"{$this->adminPath}\">"._("Log in")."</a></li>\n"; 430 439 } 431 440 echo "</ul>\n"; … … 455 464 var $description; 456 465 var $httpPath; 466 var $listPath; 467 var $adminPath; 457 468 var $cssFile; 458 469 … … 463 474 $this->description = _("Swansea University Computer Society member web logs"); 464 475 $this->httpPath = dirname($_SERVER['SCRIPT_NAME'])."/"; 476 $this->basePath = $this->httpPath."index.php/"; 477 $this->adminPath = $this->httpPath."admin.php/"; 465 478 $this->cssFile = "blog.css"; 466 479 } … … 469 482 function listBlogs() 470 483 { 471 $baseurl = "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']."/";472 484 $sql = db_query("SELECT max(entries.timestamp) AS ts, users.username, users.description, users.name, users.title FROM entries LEFT JOIN users ON entries.user_id = users.id GROUP BY users.username, users.name, users.title, users.description ORDER BY ts DESC;"); 473 485 $sqlNum = db_num_rows($sql); … … 483 495 echo "<tr>\n"; 484 496 echo " <td>".$row['name']."</td>\n"; 485 echo " <td><a href=\"".$ baseurl.$row['username']."\" title=\"".$row['description']."\">".$row['title']."</a></td>\n";497 echo " <td><a href=\"".$this->basePath.$row['username']."\" title=\"".$row['description']."\">".$row['title']."</a></td>\n"; 486 498 echo " <td>".$this->timeDiff(strtotime($row['ts']))." ago</td>\n"; 487 499 echo "</tr>\n"; … … 529 541 function menu() { 530 542 echo "<ul class=\"side-menu\">\n"; 531 echo "<li><a href=\"{$this-> httpPath}admin.php\">"._("Blog admin")."</a></li>\n";543 echo "<li><a href=\"{$this->adminPath}\">"._("Blog admin")."</a></li>\n"; 532 544 echo "</ul>\n"; 533 545 } index.php
r121 r127 2 2 include("blog.lib.php"); 3 3 $request=explode('/',substr($_SERVER[PATH_INFO], 1)); 4 if($request[0] != "" and $request[0] != "list"){5 $blog = new blogs(array_shift($request));6 } else {7 $blog = new bloglist();8 $request = array("list");9 }4 if($request[0] != "" and $request[0] != "list"){ 5 $blog = new blogs(array_shift($request)); 6 } else { 7 $blog = new bloglist(); 8 $request = array("list"); 9 } 10 10 ob_start(); 11 11 ?>
