Changeset 89 for trunk/admin

Show
Ignore:
Timestamp:
04/04/06 21:48:13 (3 years ago)
Author:
michiel
Message:

came up with a nicer way to prevent the plugins from being loaded in rss and admin.

On nieke's and Sofie's request, altered the way we handle comments in the backend.
An admin can now delete a comment, which will mark it as deleted and shows a default text
on the public site. An admin can later even recover the comment.

Re #52 and Fixes #41

Location:
trunk/admin
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/admin/index.php

    r86 r89  
    1717 */ 
    1818 
    19 $adminmode = 1; 
    2019require("../common/functions_blog.php"); 
    2120//----------------------------- 
     
    10041003                <div class="log_post"> 
    10051004                        <div class="log_head"> 
    1006                                 <span class="log_subject"> 
     1005                                <span class="log_subject<?=($row["deleted"]?" log_deleted":"")?>"> 
    10071006                                        <?=$row["title"]?> (<?=$articles[$row["articles_id"]]?>) 
    10081007                                        <span class="log_cat"><br /> 
     
    10121011                                </span> 
    10131012                        </div> 
    1014                         <div class="log_contents"> 
     1013                        <div class="log_contents<?=($row["deleted"]?" log_deleted":"")?>"> 
    10151014                                <?=$row["comment"]?> 
    10161015                        </div> 
     
    10191018                                <? if (trim($row["ip"])) { ?><a href="index.php?action=blacklist_ip&commentid=<?=$row["id"]?>">blacklist ip</a><? } ?>&nbsp;&nbsp; 
    10201019                                --> 
    1021                                 <a href="index.php?action=delete_comment&id=<?=$row["id"]?>">delete</a> 
     1020                                <? if (!$row["deleted"]) { ?> 
     1021                                        <a href="index.php?action=delete_comment&id=<?=$row["id"]?>">delete</a> 
     1022                                <? } else { ?> 
     1023                                        <a href="index.php?action=recover_comment&id=<?=$row["id"]?>">recover</a> 
     1024                                <? } ?> 
    10221025                        </div> 
    10231026                </div> 
     
    10471050//----------------------------------------------------------- 
    10481051function delete_comment($id) { 
    1049         global $db; 
    1050         $sql = sprintf("DELETE FROM comments WHERE id = %d", $id); 
    1051         $res = $db->query($sql); 
     1052        $sql = sprintf("UPDATE comments set deleted = %d WHERE id = %d", mktime(), $id); 
     1053        $res = $GLOBALS["db"]->query($sql); 
     1054        header("Location: index.php?action=show_comments"); 
     1055} 
     1056 
     1057//}}}------------------------------------------------------------------ 
     1058//{{{ recover_comment($id): Recover a deleted comment from the database 
     1059//--------------------------------------------------------------------- 
     1060function recover_comment($id) { 
     1061        $sql = sprintf("UPDATE comments set deleted=0 WHERE id = %d", $id); 
     1062        $res = $GLOBALS["db"]->query($sql); 
    10521063        header("Location: index.php?action=show_comments"); 
    10531064} 
     
    10901101                        <a class="if_menu_item<? if ($_REQUEST["action"] == "show_comments") { echo "_act"; } ?>" href="./index.php?action=show_comments">comments</a>&nbsp; 
    10911102                        <a class="if_menu_item<? if ($_REQUEST["action"] == "show_posts") { echo "_act"; } ?>" href="./index.php?action=show_posts">posts</a>&nbsp; 
    1092                         <a class="if_menu_item<? if ($_REQUEST["action"] == "show_acro") { echo "_act"; } ?>" href="./index.php?action=show_acro">acronyms</a>&nbsp; 
     1103                        <!-- this one should move to plugins --><a class="if_menu_item<? if ($_REQUEST["action"] == "show_acro") { echo "_act"; } ?>" href="./index.php?action=show_acro">acronyms</a>&nbsp; 
    10931104<!--                    <a class="if_menu_item<? if ($_REQUEST["action"] == "show_pages") { echo "_act"; } ?>" href="./index.php?action=show_pages">&nbsp;pages</a>&nbsp; 
    10941105--> 
     
    11251136                                case "show_comments"  : show_comments($_REQUEST["options"]);  break; 
    11261137                                case "delete_comment" : delete_comment($_REQUEST["id"]);      break; 
     1138                                case "recover_comment": recover_comment($_REQUEST["id"]);     break; 
    11271139                                default               : show_index();                         break; 
    11281140                        } 
  • trunk/admin/login.php

    r86 r89  
    1616 * at the top of the source tree. 
    1717 */ 
    18 $adminmode = 1; 
     18 
    1919require("../common/functions_blog.php"); 
    2020 
  • trunk/admin/style/index.css

    r1 r89  
    455455        } 
    456456 
     457#if_page span.log_deleted,div.log_deleted 
     458        { 
     459                text-decoration: line-through; 
     460        } 
     461         
    457462#if_page div.log_panel 
    458463        {