root/index.php

Revision 205, 4.1 kB (checked in by dez, 2 years ago)

Resolves conflict in blog.lib.php
Applies updates made to the live copy that weren't in SVN

  • Property svn:executable set to *
Line 
1 <?php
2     //include our blog functions
3     include("blog.lib.php");
4     //make our command list
5     $request=explode('/',substr($_SERVER['PATH_INFO'], 1));
6     //if we have something which might be a username start a blogs instance
7     if($request[0] != "" and $request[0] != "list"){
8         $blogsingle = new blogs(array_shift($request));
9     }
10     //otherwise, or if there was no such user, start a bloglist instance
11     if (!isset($blogsingle) || !isset($blogsingle->id)) {
12         $bloglist = new bloglist();
13         $request = array("list");
14     }
15     $blog = isset($bloglist) ? $bloglist : $blogsingle;
16     ob_start();
17 ?>
18 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
19 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
20 <head>
21     <title><? echo $blog->title; ?></title>
22     <link rel="stylesheet" href="<? echo $blog->httpPath.$blog->cssFile; ?>" type="text/css" />
23 <?php
24     //check we have a valid username before offering a RSS feed
25     if($blog->userName) {
26         $rss_url = "http://{$_SERVER['HTTP_HOST']}{$blog->httpPath}feed/rss/{$blog->userName}".(($request[0]=="category")?"/category/".(int)$request[1]:"");
27         $atom_url = "http://{$_SERVER['HTTP_HOST']}{$blog->httpPath}feed/atom/{$blog->userName}".(($request[0]=="category")?"/category/".(int)$request[1]:"");
28         echo "    <link rel=\"alternate\" type=\"application/rss+xml\" title=\"{$blog->title}\" href=\"$rss_url\"/>\n";
29         echo "    <link rel=\"alternate\" type=\"application/atom+xml\" title=\"{$blog->title}\" href=\"$atom_url\"/>\n";
30     }
31 ?>
32     <script type="text/javascript" src="<?php echo $blog->httpPath; ?>xmlhttp.js"></script>
33 </head>
34 <body>
35 <div id="toptop"></div>
36 <div id="container">
37     <div id="toppanel">
38     <h1><a href="<?php echo $blog->blogPath; ?>"><? echo $blog->title; ?></a></h1>
39     <h2><? echo $blog->description; ?></h2>
40     <h3><? if ($blog->realName != "") echo _("A weblog by")." ".$blog->realName; ?></h3>
41     </div>
42     <div id="content">
43     <div id="sidepanel">
44         <?php $blog->menu(); ?>
45         <p class="sideblurb">
46         <br />
47         <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>
48         </p>
49     </div>
50     <div id="maincontent">
51         <?
52         //display login/logout messages
53             if ($_SESSION['userName']) {
54                 echo "<div class=\"login\"><h3>"._("Hello")." {$_SESSION[realName]} (<a href=\"{$blog->adminPath}logout\">"._("Log out")."</a>)</h3></div>";
55             }
56             else {
57                 echo "<div class=\"login\"><h3>"._("Not logged in")." {$_SESSION[realName]} (<a href=\"{$blog->adminPath}\">"._("Log in")."</a>)</h3></div>";
58             }
59         // if there was an error, print it here
60         if (isset($blogsingle) && !isset($blogsingle->id)) {
61             error_exc($blogsingle);
62         }
63             //run the appropriate command
64         switch (array_shift($request)) {
65             case "entry":
66                 $blog->printEntryAndComments(array_shift($request));
67                 break;
68             case "category":
69                 $blog->printEntries(0,15,'and category = '.(int)array_shift($request));
70                 break;
71             case "postcomment":
72                 $blog->newComment((int)array_shift($request)) ;
73                 break;
74             case "archive":
75                 $blog->printArchive($request);
76                 break;
77             case "list":
78                 $blog->listBlogs();
79                 break;
80             default:
81                 $blog->printEntries();
82         }
83          ?>
84     </div>
85     </div>
86     <div id="bottompanel">
87     <p><? echo _("Validate"); ?> : <a href="http://validator.w3.org/check?uri=referer">XHTML</a> / <a href="http://jigsaw.w3.org/css-validator/check/referer/">CSS</a> /
88 <?
89     if($blog->userName) {
90         echo "<a href=\"http://feedvalidator.org/check.cgi?url=$rss_url\">RSS</a> / <a href=\"http://feedvalidator.org/check.cgi?url=$atom_url\">ATOM</a>";
91     }
92     else {
93         echo "RSS / ATOM";
94     }
95     echo " :: <a href=\"http://projects.sucs.org/projects/blog/\">"._("SUCS Blogs Version ")."</a>".$blog->svnRevision;
96 ?>
97     </p>
98     </div>
99 </div>
100 <div id="botbot"></div>
101 <?php
102     //display debuing info as required
103     if($_SESSION[debug]){
104         echo "<div class=\"debug\"><h2>"._("Debug Info")."</h2><pre>\n";
105         echo "**"._("Session")."**\n";
106         print_r($_SESSION);
107         echo "**"._("Request")."**\n";
108         print_r($_REQUEST);
109         echo "**"._("Class")."**\n";
110         print_r($blog);
111         echo "</pre></div>";
112     }
113 ?>
114 </body>
115 </html>
116
Note: See TracBrowser for help on using the browser.