Changeset 127

Show
Ignore:
Timestamp:
01/07/05 15:54:28 (4 years ago)
Author:
rollercow
Message:

$path changes..

admin points at admin.php
base points at index.php
blog points at index.php/username
http points at /

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • admin.lib.php

    r124 r127  
    2525        var $httpPath;          //http Path for files 
    2626        var $adminPath;         //path to admin 
     27        var $blogPath;          //path to blog for a specific user 
     28        var $basePath;          //path to the display blog bits 
    2729        var $blog;              //[temporary] holder for instance of blog class 
    2830                         
     
    4042                $this->httpPath = dirname($_SERVER['SCRIPT_NAME'])."/"; 
    4143                $this->adminPath = $this->httpPath."admin.php/"; 
     44                $this->basePath = $this->httpPath."index.php/"; 
    4245                if ($this->userName) { 
    4346                        $this->blog = new blogs($this->userName); 
     47                        $this->blogPath = $this->basePath.$this->userName."/"; 
    4448                } 
    4549        } 
     
    144148                echo "</a></li>\n"; 
    145149                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 that 
     150                        echo "<li><a href=\"".$this->blogPath."\">"._("My blog")."</a></li>\n"; 
    147151                } 
    148152                echo "</ul>\n"; 
     
    453457                echo "<div class=\"entry\">\n"; 
    454458                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"; 
    456460                echo "<p>\n"; 
    457461                echo "<input type=\"text\" name=\"name\" id=\"name\" value=\"" . $settings[name] . "\" size=\"30\" maxlength=\"60\" tabindex=\"1\" />\n"; 
     
    509513                while($r = db_getrow($result)) { 
    510514                        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"; 
    512516                        echo "\t\t<td><a href=\"mailto:{$r['email']}\" title=\"IP: {$r['host']}\">{$r['name']}</a></td>\n"; 
    513517                        echo "\t\t<td>{$r['body']}</td>\n"; 
     
    563567                        if(count($_POST['comment'])==0){ 
    564568                                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"; 
    566570                        } else { 
    567571                                $del = "("; 
     
    575579                                } else { 
    576580                                        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"; 
    578582                                } 
    579583                        } 
     
    825829                } 
    826830                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"; 
    828832                echo "<p>\n"; 
    829833                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  
    3737        var $httpPath;          //http Path for files 
    3838        var $blogPath;          //path to blog 
     39        var $basePath;          //path to the display blog bits 
     40        var $adminPath;         //path to blog admin page 
    3941        var $commentError;      //new comment errors 
    4042        var $entryError;        //new entry errors 
     
    6466                        $this->shortDateFormat = "%x %X"; 
    6567                        $this->longDateFormat = "%c"; 
     68                        //path for all http stuff.. ie images, css and so on 
    6669                        $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/"; 
    6876                        $this->commentError = ''; 
    6977                        $this->entryError = ''; 
     
    100108                echo " | Cat: <a href=\"".$this->blogPath."category/{$row['category']}\">".$this->categoryName($row['category'])."</a> "; 
    101109                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>"; 
    104112                } 
    105113                echo " ]</p>\n"; 
     
    196204                        $blogOwner = $this->checkSessionOwner(); 
    197205                        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"; 
    199207                        } 
    200208                        echo "<div id=\"comments\">\n"; 
     
    423431                echo "<li><a href=\"{$this->blogPath}\">"._("Blog Home")."</a></li>\n"; 
    424432                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"; 
    426435                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"; 
    428437                } 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"; 
    430439                } 
    431440                echo "</ul>\n"; 
     
    455464        var $description; 
    456465        var $httpPath; 
     466        var $listPath; 
     467        var $adminPath; 
    457468        var $cssFile; 
    458469 
     
    463474                $this->description = _("Swansea University Computer Society member web logs"); 
    464475                $this->httpPath = dirname($_SERVER['SCRIPT_NAME'])."/"; 
     476                $this->basePath = $this->httpPath."index.php/"; 
     477                $this->adminPath = $this->httpPath."admin.php/"; 
    465478                $this->cssFile = "blog.css"; 
    466479        } 
     
    469482        function listBlogs() 
    470483        { 
    471                 $baseurl = "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']."/"; 
    472484                $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;"); 
    473485                $sqlNum = db_num_rows($sql); 
     
    483495                                echo "<tr>\n"; 
    484496                                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"; 
    486498                                echo "    <td>".$this->timeDiff(strtotime($row['ts']))." ago</td>\n"; 
    487499                                echo "</tr>\n"; 
     
    529541        function menu() { 
    530542                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"; 
    532544                echo "</ul>\n"; 
    533545        } 
  • index.php

    r121 r127  
    22        include("blog.lib.php"); 
    33        $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       
    1010        ob_start(); 
    1111?>