Changeset 138
- Timestamp:
- 04/07/05 14:56:13 (4 years ago)
- Files:
-
- admin.lib.php (modified) (2 diffs)
- admin.php (modified) (4 diffs)
- blog.css (modified) (1 diff)
- blog.lib.php (modified) (1 diff)
- index.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
admin.lib.php
r135 r138 156 156 } 157 157 158 //destroys the session and presents you with a login screen158 //destroys the session 159 159 function logout () 160 160 { … … 166 166 function printLoginForm() 167 167 { 168 echo "<div class=\"login\"><h3>"._("Not logged in")."</h3>\n";169 168 echo "<h2>"._("Login")."</h2>\n"; 170 169 echo "<div class=\"td\">\n"; admin.php
r137 r138 1 1 <?php 2 $DEBUG = FALSE; 3 2 //include our admin functions 4 3 include("admin.lib.php"); 5 $request=explode('/',substr($_SERVER[PATH_INFO], 1));6 4 $admin = new admin(); 7 5 8 // Check if we're logging in or out - must be done before any HTML is displayed 6 //make our command list from the path 7 $request=explode('/',substr($_SERVER[PATH_INFO], 1)); 8 9 // Check if we're logging in or out - must be done before any HTML is displayed 9 10 switch ($request[0]) { 10 case "login": 11 $admin->login(); 12 $admin = new admin(); 13 break; 14 case "logout": 15 $admin->logout(); 16 break; 11 case "login": 12 $admin->login(); 13 //why? 14 $admin = new admin(); 15 break; 16 case "logout": 17 $admin->logout(); 18 break; 17 19 } 18 20 ?> … … 35 37 <div id="content"> 36 38 <div id="sidepanel"> 39 <? if($_SESSION['userName']) $admin->menu(); else echo "<ul class=\"side-menu\">\n<li><a href=\"{$admin->basePath}\">".("View blogs")."</a></li>\n</ul>" ?><br /> 37 40 <p class="sideblurb"> 38 <? if($_SESSION['userName']) $admin->menu(); ?><br />39 41 <a href="http://sucs.org"><img src="<? echo $admin->httpPath."img/sucspow.png"; ?>" alt="Powered by SUCS" height="13" width="80" /></a> 40 42 </p> 41 43 </div> 42 44 <div id="maincontent"><? 45 //alter the debuging state on request 46 if ($request[0] == "debug") { 47 $_SESSION[debug] = $request[1]; 48 } 49 //if loged in 43 50 if($_SESSION['userName']) { 44 if ($_SESSION['userName']) echo "<div class=\"login\"><h3>"._("Hello")." {$admin->realName} (<a href=\"{$admin->adminPath}logout\">"._("Log out")."</a>)</h3></div>"; 51 echo "<div class=\"login\"><h3>"._("Hello")." {$admin->realName} (<a href=\"{$admin->adminPath}logout\">"._("Log out")."</a>)</h3></div>"; 52 //call appropriate functions.. 45 53 switch (array_shift($request)) { 46 54 case "newentry": … … 91 99 } 92 100 } 101 //else offer login box 93 102 else { 103 echo "<div class=\"login\"><h3>"._("Not logged in")."</h3>\n"; 94 104 $admin->printLoginForm(); 95 105 } … … 98 108 </div> 99 109 <div id="bottompanel"> 100 <p> Validate: <a href="http://validator.w3.org/check?uri=referer">XHTML</a> / <a href="http://jigsaw.w3.org/css-validator/check/referer/">CSS</a></p>110 <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></p> 101 111 </div> 102 112 </div> 103 113 <div id="botbot"></div> 104 114 <?php 105 if($DEBUG){ 106 echo "<pre>\n"; 107 print_r($_SESSION); 108 print_r($_POST); 109 echo "</pre>"; 110 } 115 //if we are in debug mode display a bunch of stuff 116 if($_SESSION[debug]){ 117 echo "<div class=\"debug\"><h2>"._("Debug Info")."</h2><pre>\n"; 118 echo "**"._("Session")."**\n"; 119 print_r($_SESSION); 120 echo "**"._("Request")."**\n"; 121 print_r($_REQUEST); 122 echo "**"._("Class")."**\n"; 123 print_r($admin); 124 echo "</pre></div>"; 125 } 111 126 ?> 112 127 </body> blog.css
r134 r138 296 296 text-align: left; 297 297 } 298 299 .debug { 300 border: solid 1px black; 301 background-color: white; 302 padding: 3px; 303 font-size: 12px; 304 text-align: left; 305 } blog.lib.php
r129 r138 485 485 $this->adminPath = $this->httpPath."admin.php/"; 486 486 $this->cssFile = "blog.css"; 487 488 // setup the session purely so we get the debug bits.. 489 session_name("BlogSession"); 490 session_start(); 487 491 } 488 492 index.php
r134 r138 1 1 <?php 2 $DEBUG = FALSE; 3 2 //include our blog functions 4 3 include("blog.lib.php"); 4 //make our command list 5 5 $request=explode('/',substr($_SERVER[PATH_INFO], 1)); 6 //if we have something which might be a username start a blogs instance 6 7 if($request[0] != "" and $request[0] != "list"){ 7 8 $blog = new blogs(array_shift($request)); 8 } else { 9 } 10 //otherwise start a bloglist instance 11 else { 9 12 $blog = new bloglist(); 10 13 $request = array("list"); … … 17 20 <title><? echo $blog->title; ?></title> 18 21 <link rel="stylesheet" href="<? echo $blog->httpPath.$blog->cssFile; ?>" type="text/css" /> 19 <? 20 //check we have a valid username before offering a RSS feed 21 if($blog->userName) { ?> 22 <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<? echo "http://".$_SERVER['HTTP_HOST'].$blog->httpPath."feed.php/".$blog->userName.(($request[0]=="category")?"/category/".(int)$request[1]:""); ?>" /> 23 <? } ?> 22 <?php 23 //check we have a valid username before offering a RSS feed 24 if($blog->userName) { 25 echo " <link rel=\"alternate\" type=\"application/rss+xml\" title=\"{$blog->title}\" href=\"http://{$_SERVER['HTTP_HOST']}{$blog->httpPath}feed.php/{$blog->userName}".(($request[0]=="category")?"/category/".(int)$request[1]:"")."\"/>\n"; 26 } 27 ?> 24 28 <script type="text/javascript" src="<?php echo $blog->httpPath; ?>xmlhttp.js"></script> 25 29 </head> … … 34 38 <div id="content"> 35 39 <div id="sidepanel"> 36 37 40 <?php $blog->menu(); ?> 38 41 <p class="sideblurb"> … … 43 46 <div id="maincontent"> 44 47 <? 45 if ($_SESSION['userName']) echo "<div class=\"login\"><h3>"._("Hello")." {$_SESSION[realName]} (<a href=\"{$blog->adminPath}logout\">"._("Log out")."</a>)</h3></div>"; 46 else echo "<div class=\"login\"><h3>"._("Not logged in")." {$_SESSION[realName]} (<a href=\"{$blog->adminPath}\">"._("Log in")."</a>)</h3></div>"; 48 //display login/logout messages 49 if ($_SESSION['userName']) { 50 echo "<div class=\"login\"><h3>"._("Hello")." {$_SESSION[realName]} (<a href=\"{$blog->adminPath}logout\">"._("Log out")."</a>)</h3></div>"; 51 } 52 else { 53 echo "<div class=\"login\"><h3>"._("Not logged in")." {$_SESSION[realName]} (<a href=\"{$blog->adminPath}\">"._("Log in")."</a>)</h3></div>"; 54 } 55 //run the appropriate command 47 56 switch (array_shift($request)) { 48 57 case "entry": … … 69 78 <div id="bottompanel"> 70 79 <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> / 71 <?if($blog->userName) {?> 72 <a href="http://feedvalidator.org/check.cgi?url=<? echo "http://".$_SERVER['HTTP_HOST'].$blog->httpPath."feed.php/".$blog->userName.(($request[0]=="category")?"/category/".(int)$request[1]:""); ?>">RSS</a> 73 <?} 80 <? 81 if($blog->userName) { 82 echo "<a href=http://feedvalidator.org/check.cgi?url=http://{$_SERVER['HTTP_HOST']}{$blog->httpPath}feed.php/{$blog->userName}".(($request[0]=="category")?"/category/".(int)$request[1]:"").">RSS</a>"; 83 } 74 84 else { 75 85 echo "RSS"; 76 }?> 86 } 87 ?> 77 88 </p> 78 89 </div> … … 80 91 <div id="botbot"></div> 81 92 <?php 82 if($DEBUG) { 83 echo "<pre>"; 84 print_r($_SESSION); 85 print_r($_COOKIE); 86 print_r($blog); 87 echo "</pre>"; 88 } 93 //display debuing info as required 94 if($_SESSION[debug]){ 95 echo "<div class=\"debug\"><h2>"._("Debug Info")."</h2><pre>\n"; 96 echo "**"._("Session")."**\n"; 97 print_r($_SESSION); 98 echo "**"._("Request")."**\n"; 99 print_r($_REQUEST); 100 echo "**"._("Class")."**\n"; 101 print_r($blog); 102 echo "</pre></div>"; 103 } 89 104 ?> 90 105 </body>
