Changeset 122
- Timestamp:
- 15/06/05 23:28:17 (4 years ago)
- Files:
-
- admin.lib.php (modified) (1 diff)
- admin.php (modified) (1 diff)
- blog.css (modified) (1 diff)
- blog.lib.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
admin.lib.php
r121 r122 557 557 $this->printComments(); 558 558 $this->printAuthorisedUsers(); 559 } 560 561 function deleteComments($entry) { 562 if(isset($_POST['submit'])) { 563 if(count($_POST['comment'])==0){ 564 error(5, _("No comments selected for deletion.")); 565 echo "<a href=\"{$this->blog->blogPath}entry/$entry\">"._("Return to blog entry")."</a>\n"; 566 } else { 567 $del = "("; 568 foreach($_POST['comment'] as $c) { 569 $del .= "id = $c OR "; 570 } 571 $del = substr($del, 0, -4).")"; 572 $sql = "DELETE FROM comments WHERE $del"; 573 if(!db_query($sql)) { 574 error(2, _("Database commit error.")); 575 } else { 576 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"; 578 } 579 } 580 } 559 581 } 560 582 admin.php
r121 r122 73 73 $admin->updateComments(); 74 74 break; 75 case "deletecomments": 76 $admin->deleteComments(array_shift($request)); 77 break; 75 78 case "updateauthusers": 76 79 $admin->updateAuthorisedUsers(); blog.css
r121 r122 279 279 font-size: 12px; 280 280 } 281 .errorinfo { 282 border: solid 1px red; 283 background-color: #FF8074; 284 padding: 3px; 285 font-size: 12px; 286 } 287 288 input.smallcheckbox { 289 padding: 0; 290 margin: 0; 291 } blog.lib.php
r121 r122 22 22 */ 23 23 function error($level, $error) { 24 echo(" Level ".$level." error - ".$error);24 echo("<p class=\"errorinfo\">"._("Level ").$level._(" error - ").$error."</p>"); 25 25 } 26 26 … … 40 40 var $entryError; //new entry errors 41 41 var $entryTags; //what we allow in the entry 42 42 var $currentEntry; // the shortsubject of the current entry (where applicable) 43 43 44 //Constructor - checks we've been given a valid username, and pulls in generic blog info 44 45 function blogs($user) … … 69 70 $this->comment_moderation = ($sqlRow['moderate']=='t') ? TRUE : FALSE; 70 71 $this->entryTags = array('<b>','<i>','<strong>','<em>','<p>','<a>','<img>','<hr>','<br>'); 72 $this->currentEntry = ""; 71 73 72 74 // setup the session … … 179 181 else { 180 182 $sqlRow = db_getrow($sql); 183 $this->currentEntry = $sqlRow['shortsubject']; 181 184 $this->printEntry($sqlRow, false, false); 182 185 $this->printComments($sqlRow['id']); … … 188 191 function printComments($postid, $offset=0, $limit=15) 189 192 { 190 $sql = db_query("SELECT timestamp, name, email, body, host FROM comments WHERE post = ".$postid." and moderated = true ORDER BY timestamp ASC limit ".$limit." OFFSET ".$offset.";"); 191 $sqlNum = db_num_rows($sql); 193 $sql = db_query("SELECT timestamp, name, email, body, host, id FROM comments WHERE post = ".$postid." and moderated = true ORDER BY timestamp ASC limit ".$limit." OFFSET ".$offset.";"); 194 $sqlNum = db_num_rows($sql); 195 $blogOwner = $this->checkSessionOwner(); 196 $count=0; 197 if($blogOwner) { 198 echo "<form name=\"deletecomments\" id=\"deletecomments\" method=\"post\" action=\"{$this->httpPath}admin.php/deletecomments/{$this->currentEntry}\">\n"; 199 } 192 200 echo "<div id=\"comments\">\n"; 193 201 if ($sqlNum > 0) { 194 202 while ($sqlRow = db_getrow($sql)) { 195 $this->printComment($sqlRow );203 $this->printComment($sqlRow, $blogOwner, $count++); 196 204 } 197 205 } 198 206 echo "</div>\n"; 207 if($blogOwner) { 208 echo "<div style=\"width: 100%; text-align: right\">\n"; 209 echo "<input type=\"submit\" name=\"submit\" value=\"Delete Comments\" />\n"; 210 echo "</div>\n"; 211 echo "</form>\n"; 212 } 199 213 } 200 214 201 215 //print a comment 202 function printComment($row )216 function printComment($row, $printCheckBox=FALSE, $checkBoxNum=0) 203 217 { 204 218 echo "<div class=\"blogcomment\">\n"; 205 219 echo "<h3>" . $row['name'] . " writes:</h3>"; 206 220 echo "<p>" . $row['body'] . "</p>\n"; 207 echo "<p class=\"entryfoot\">[ " .strftime($this->longDateFormat,strtotime($row['timestamp'])). " ]</p>\n"; 221 echo "<p class=\"entryfoot\">[ " .strftime($this->longDateFormat,strtotime($row['timestamp'])); 222 if($printCheckBox){ 223 echo " | <input class=\"smallcheckbox\" type=\"checkbox\" id=\"comment{$checkBoxNum}\" name=\"comment[{$checkBoxNum}]\" value=\"{$row['id']}\" />\n"; 224 echo "<label for=\"comment{$checkBoxNum}\">Delete</label>\n"; 225 } 226 echo " ]</p>\n"; 208 227 echo "</div>\n"; 209 228 } … … 348 367 else { 349 368 if(!$moderated) { 350 echo "<p class=\"updateinfo\"> *** "._("Your comment has been added, but before it appears here it must be accepted by the blog owner.")." ***</p>";369 echo "<p class=\"updateinfo\">"._("Your comment has been added, but before it appears here it must be accepted by the blog owner.")."</p>"; 351 370 } elseif(!$printentry) { 352 371 echo "<div class=\"blogcomment\">\n";
