Changeset 106
- Timestamp:
- 31/05/05 14:03:11 (4 years ago)
- Files:
-
- admin.lib.php (modified) (4 diffs)
- admin.php (modified) (4 diffs)
- blog.lib.php (modified) (1 diff)
- feed.php (modified) (3 diffs)
- index.php (modified) (3 diffs)
- template.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
admin.lib.php
r102 r106 294 294 $this->printEntryForm($row,true,true); 295 295 } else { 296 error(2, _("Could not find the requested entry."));297 }296 error(2, _("Could not find the requested entry.")); 297 } 298 298 } 299 299 … … 443 443 function printEntries($amount=0, $title=TRUE) 444 444 { 445 $limit = ($amount > 0) ? " LIMIT $amount" : "";446 $result = db_query("SELECT shortsubject,timestamp,subject FROM entries WHERE user_id = '".$this->id."' ORDER BY timestamp DESC $limit;");447 if(db_num_rows($result)==0){448 error(5, _("No entries found."));449 } else {450 if($title){451 echo "<h2>"._("Edit Entries")."</h2>\n";452 }453 echo "<ul>\n";454 while($row = db_getrow($result)){455 echo "<li>".date("r", strtotime($row['timestamp']))." <a href=\"".$this->adminPath."update/".$row['shortsubject']."\">".$row['subject']."</a></li>\n";456 }457 echo "</ul>\n";458 }445 $limit = ($amount > 0) ? " LIMIT $amount" : ""; 446 $result = db_query("SELECT shortsubject,timestamp,subject FROM entries WHERE user_id = '".$this->id."' ORDER BY timestamp DESC $limit;"); 447 if(db_num_rows($result)==0){ 448 error(5, _("No entries found.")); 449 } else { 450 if($title){ 451 echo "<h2>"._("Edit Entries")."</h2>\n"; 452 } 453 echo "<ul>\n"; 454 while($row = db_getrow($result)){ 455 echo "<li>".date("r", strtotime($row['timestamp']))." <a href=\"".$this->adminPath."update/".$row['shortsubject']."\">".$row['subject']."</a></li>\n"; 456 } 457 echo "</ul>\n"; 458 } 459 459 } 460 460 … … 474 474 //if (check_auth($user)) {} 475 475 //sanitise username 476 if (isset($_POST['username']) && trim($_POST['username']) != "" && (int)$_POST['username'] == 0) {477 $username = $_POST['username'];478 } else {479 $this->inputError = _("Bad Input - Username");480 $err = 1;481 }476 if (isset($_POST['username']) && trim($_POST['username']) != "" && (int)$_POST['username'] == 0) { 477 $username = $_POST['username']; 478 } else { 479 $this->inputError = _("Bad Input - Username"); 480 $err = 1; 481 } 482 482 483 483 //sanitise password, assume it will be hashed before sending :) 484 if (isset($_POST['password']) && trim($_POST['password']) != "" && (int)$_POST['password'] == 0) {485 $password = $_POST['password'];486 } else {487 $this->inputError = _("Bad Input - Password");488 $err = 1;489 }484 if (isset($_POST['password']) && trim($_POST['password']) != "" && (int)$_POST['password'] == 0) { 485 $password = $_POST['password']; 486 } else { 487 $this->inputError = _("Bad Input - Password"); 488 $err = 1; 489 } 490 490 491 491 //sanitise type 492 if (isset($_POST['type']) && trim($_POST['type']) != "" && (int)$_POST['type'] > 0) {493 $type = (int)$_POST['type'];494 } else {495 $this->inputError = _("Bad Input - Type");496 $err = 1;497 }492 if (isset($_POST['type']) && trim($_POST['type']) != "" && (int)$_POST['type'] > 0) { 493 $type = (int)$_POST['type']; 494 } else { 495 $this->inputError = _("Bad Input - Type"); 496 $err = 1; 497 } 498 498 499 499 //sanitise name 500 if (isset($_POST['name']) && trim($_POST['name']) != "" && (int)$_POST['name'] == 0) {501 $name = addslashes(urldecode($_POST['name']));502 } else {503 $this->inputError = _("Bad Input - Realname");504 $err = 1;505 }500 if (isset($_POST['name']) && trim($_POST['name']) != "" && (int)$_POST['name'] == 0) { 501 $name = addslashes(urldecode($_POST['name'])); 502 } else { 503 $this->inputError = _("Bad Input - Realname"); 504 $err = 1; 505 } 506 506 507 507 //sanitise title 508 if (isset($_POST['title']) && trim($_POST['title']) != "" && (int)$_POST['title'] == 0) {509 $title = addslashes(urldecode($_POST['title']));510 } else {511 $this->inputError = _("Bad Input - Title");512 $err = 1;513 }508 if (isset($_POST['title']) && trim($_POST['title']) != "" && (int)$_POST['title'] == 0) { 509 $title = addslashes(urldecode($_POST['title'])); 510 } else { 511 $this->inputError = _("Bad Input - Title"); 512 $err = 1; 513 } 514 514 515 515 //sanitise description 516 if (isset($_POST['description']) && trim($_POST['description']) != "" && (int)$_POST['description'] == 0) {517 $description = addslashes(urldecode($_POST['description']));518 } else {519 $this->inputError = _("Bad Input - Description");520 $err = 1;521 }516 if (isset($_POST['description']) && trim($_POST['description']) != "" && (int)$_POST['description'] == 0) { 517 $description = addslashes(urldecode($_POST['description'])); 518 } else { 519 $this->inputError = _("Bad Input - Description"); 520 $err = 1; 521 } 522 522 523 523 //sanitise css 524 if (isset($_POST['css'])) { // if its not set its defaulted...524 if (isset($_POST['css'])) { // if its not set its defaulted... 525 525 if (trim($_POST['css']) != "" && (int)$_POST['css'] == 0 && is_file($_POST['css'])) { 526 $css = $_POST['css'];527 } else {528 $this->inputError = _("Bad Input - CSS location");529 $err = 1;530 }526 $css = $_POST['css']; 527 } else { 528 $this->inputError = _("Bad Input - CSS location"); 529 $err = 1; 530 } 531 531 } 532 532 533 533 //sanitise enabled -- not really sure about this. i think creation and enabling should be 534 534 // done seperately... ??? 535 /*if (isset($_POST['enabled'])) { // if its not set its defaulted...536 if (trim($_POST['enabled']) != "" && (int)$_POST['enabled'] == 0)) {537 $css = $_POST['enabled'];538 } else {539 $this->inputError = _("Bad Input - Enabled");540 $err = 1;541 }542 }*/535 /*if (isset($_POST['enabled'])) { // if its not set its defaulted... 536 if (trim($_POST['enabled']) != "" && (int)$_POST['enabled'] == 0)) { 537 $css = $_POST['enabled']; 538 } else { 539 $this->inputError = _("Bad Input - Enabled"); 540 $err = 1; 541 } 542 }*/ 543 543 544 544 if ($err == 0) { // and insert... … … 559 559 { 560 560 echo "<div class=\"adduser\">\n"; 561 if ($this->inputError != "") {562 echo "<p class=\"invalid\">*** " . $this->inputError . " ***</p>\n";561 if ($this->inputError != "") { 562 echo "<p class=\"invalid\">*** " . $this->inputError . " ***</p>\n"; 563 563 } 564 564 elseif (isset($_POST['submit'])) { admin.php
r97 r106 5 5 6 6 // Check if we're logging in or out - must be done before any HTML is displayed 7 switch ($request[0]) {7 switch ($request[0]) { 8 8 case "login": 9 9 $admin->login(); … … 12 12 $admin->logout(); 13 13 break; 14 }14 } 15 15 ?> 16 16 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> … … 24 24 <div id="container"> 25 25 <div id="toppanel"> 26 <h1><a href="<? echo $admin->adminPath;?>"><? echo _("SUCS Blogs"); ?></a></h1>26 <h1><a href="<? echo $admin->adminPath;?>"><? echo _("SUCS Blogs"); ?></a></h1> 27 27 <h2>Blog management</h2> 28 <h3> </h3>28 <h3> </h3> 29 29 </div> 30 30 <div id="content"> 31 <div id="sidepanel">32 <p class="sideblurb">33 <? if($_SESSION['userName']) $admin->menu(); ?><br />34 <a href="http://sucs.org"><img src="<? echo $admin->httpPath."img/sucspow.png"; ?>" alt="Powered by SUCS" height="13" width="80" /></a>35 </p>36 </div>37 <div id="maincontent"><?38 if($_SESSION['userName']) {31 <div id="sidepanel"> 32 <p class="sideblurb"> 33 <? if($_SESSION['userName']) $admin->menu(); ?><br /> 34 <a href="http://sucs.org"><img src="<? echo $admin->httpPath."img/sucspow.png"; ?>" alt="Powered by SUCS" height="13" width="80" /></a> 35 </p> 36 </div> 37 <div id="maincontent"><? 38 if($_SESSION['userName']) { 39 39 if ($_SESSION['userName']) echo "<div class=\"login\"><h3>"._("Hello")." {$admin->realName} (<a href=\"{$admin->adminPath}logout\">"._("Log out")."</a>)</h3></div>"; 40 40 switch (array_shift($request)) { … … 76 76 } 77 77 78 ?></div>78 ?></div> 79 79 </div> 80 80 <div id="bottompanel"> 81 <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>81 <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> 82 82 </div> 83 83 </div> blog.lib.php
r105 r106 187 187 $sqlNum = db_num_rows($sql); 188 188 if ($sqlNum > 0) { 189 while ($sqlRow = db_getrow($sql)) {189 while ($sqlRow = db_getrow($sql)) { 190 190 $this->printComment($sqlRow); 191 191 } feed.php
r31 r106 27 27 switch(array_shift($request)){ 28 28 case "category": 29 $extra = " AND category=".(int)array_shift($request);30 break;29 $extra = " AND category=".(int)array_shift($request); 30 break; 31 31 default: 32 $extra = "";32 $extra = ""; 33 33 } 34 34 … … 43 43 do { 44 44 $entrydate = date("r",strtotime($row['timestamp'])); 45 $entries .= " <item>\n";46 $entries .= " <title>" . $row['subject'] . "</title>\n";47 $entries .= " <description><![CDATA[" . substr(strip_tags($row['body']),0,150) . " [...]]]></description>\n";48 $entries .= " <link>".$user['link']."entry/".$row['id']."</link>\n";49 $entries .= " <pubDate>" . $entrydate . "</pubDate>\n";50 $entries .= " <dc:creator>".$user['name']."</dc:creator>\n";51 $entries .= " <content:encoded><![CDATA[" . str_replace("'", "’", $row['body']) . "]]></content:encoded>\n";52 $entries .= " </item>\n";45 $entries .= " <item>\n"; 46 $entries .= " <title>" . $row['subject'] . "</title>\n"; 47 $entries .= " <description><![CDATA[" . substr(strip_tags($row['body']),0,150) . " [...]]]></description>\n"; 48 $entries .= " <link>".$user['link']."entry/".$row['id']."</link>\n"; 49 $entries .= " <pubDate>" . $entrydate . "</pubDate>\n"; 50 $entries .= " <dc:creator>".$user['name']."</dc:creator>\n"; 51 $entries .= " <content:encoded><![CDATA[" . str_replace("'", "’", $row['body']) . "]]></content:encoded>\n"; 52 $entries .= " </item>\n"; 53 53 } while ($row = db_getrow($result)); 54 54 … … 63 63 > 64 64 <channel> 65 <title><?php print $user['title']?></title>66 <description><?php print $user['description']?></description>67 <link><?php print $user['link']?></link>68 <pubDate><?php echo $pubdate; ?></pubDate>69 <generator>wBlog @ sucs</generator>70 <language>en</language>71 <?php echo $entries; ?>65 <title><?php print $user['title']?></title> 66 <description><?php print $user['description']?></description> 67 <link><?php print $user['link']?></link> 68 <pubDate><?php echo $pubdate; ?></pubDate> 69 <generator>wBlog @ sucs</generator> 70 <language>en</language> 71 <?php echo $entries; ?> 72 72 </channel> 73 73 </rss> index.php
r105 r106 5 5 $blog = new blogs(array_shift($request)); 6 6 } else { 7 $blog = new bloglist();8 $request = array("list");7 $blog = new bloglist(); 8 $request = array("list"); 9 9 } 10 10 … … 21 21 <div id="container"> 22 22 <div id="toppanel"> 23 <h1><a href="<?php echo $blog->blogPath; ?>"><? echo $blog->title; ?></a></h1>23 <h1><a href="<?php echo $blog->blogPath; ?>"><? echo $blog->title; ?></a></h1> 24 24 <h2><? echo $blog->description; ?></h2> 25 25 <h3><? if ($blog->userName != "") echo _("A weblog by")." ".$blog->userName; ?></h3> 26 26 </div> 27 27 <div id="content"> 28 <div id="sidepanel">29 <p class="sideblurb">30 <?php $blog->menu(); ?>28 <div id="sidepanel"> 29 <p class="sideblurb"> 30 <?php $blog->menu(); ?> 31 31 <br /> 32 <a href="http://sucs.org"><img src="<? echo $blog->httpPath."img/sucspow.png"; ?>" alt="<? echo _("Powered by SUCS"); ?>" height="13" width="80" /></a>33 </p>34 </div>35 <div id="maincontent">36 <?32 <a href="http://sucs.org"><img src="<? echo $blog->httpPath."img/sucspow.png"; ?>" alt="<? echo _("Powered by SUCS"); ?>" height="13" width="80" /></a> 33 </p> 34 </div> 35 <div id="maincontent"> 36 <? 37 37 switch (array_shift($request)) { 38 38 case "entry": … … 46 46 break; 47 47 case "archive": 48 $blog->printArchive($request);49 break;48 $blog->printArchive($request); 49 break; 50 50 case "list": 51 $blog->listBlogs();52 break;51 $blog->listBlogs(); 52 break; 53 53 default: 54 54 $blog->printEntries(); 55 55 } 56 ?>57 </div>56 ?> 57 </div> 58 58 </div> 59 59 <div id="bottompanel"> 60 <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>60 <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> 61 61 </div> 62 62 </div> template.html
r9 r106 2 2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > 3 3 <head> 4 <title>SUCS Blog</title>5 <link rel="Stylesheet" href="blog.css" type="text/css" />4 <title>SUCS Blog</title> 5 <link rel="Stylesheet" href="blog.css" type="text/css" /> 6 6 </head> 7 7 <body> 8 8 <div id="container"> 9 <div id="toppanel">10 #toppanel11 </div>12 <div id="content">13 <div id="sidepanel">14 #sidepanel15 </div>16 <div id="maincontent">17 #maincontent18 </div>19 </div>20 <div id="bottompanel">21 #bottompanel22 </div>9 <div id="toppanel"> 10 #toppanel 11 </div> 12 <div id="content"> 13 <div id="sidepanel"> 14 #sidepanel 15 </div> 16 <div id="maincontent"> 17 #maincontent 18 </div> 19 </div> 20 <div id="bottompanel"> 21 #bottompanel 22 </div> 23 23 </div> 24 24 </body>
