Remove cutenews/yui, use twitter bootstrap css
[contractdashboard.git] / editcomments.mdu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<?PHP

if($member_db[1] > 2){ msg("error", "Access Denied", "You don't have permission to edit comments"); }
// ********************************************************************************
// Edit Comment
// ********************************************************************************
if($action == "editcomment")
{
    if($source == ""){ $all_comments = file("./data/comments.txt"); }
    else{ $all_comments = file("./data/archives/${source}.comments.arch"); }

        foreach($all_comments as $comment_line)
    {
            $comment_line_arr = explode("|>|", $comment_line);
        if($comment_line_arr[0] == $newsid)
        {
            $comment_arr = explode("||", $comment_line_arr[1]);
                foreach($comment_arr as $single_comment)
            {
                                $single_arr = explode("|", $single_comment);
                if($comid == $single_arr[0])
                {
                         break;
                }
            }
        }
    }

    $single_arr[4] = str_replace("<br />","\n",$single_arr[4]);
    $comdate            = date("D, d F Y h:i:s", $single_arr[0]);

    echo"<html>
    <head>
    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1251\">
    <title>Edit user</title>
    <style type=\"text/css\">
    <!--
       SELECT, option, textarea, input {
       BORDER-RIGHT: #808080 1px dotted;
       BORDER-TOP: #808080 1px dotted;
       BORDER-BOTTOM: #808080 1px dotted;
       BORDER-LEFT: #808080 1px dotted;
       COLOR: #000000;
       FONT-SIZE: 11px;
       FONT-FAMILY: Verdana; BACKGROUND-COLOR: #ffffff }
       TD {text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt;}
       BODY {text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 3pt;}
       .header { font-size : 16px; font-weight: bold; color: #808080; font-family: verdana; text-decoration: none; }
    -->
    </style>
    </head>
    <body bgcolor=\"#FFFFFF\">
    <form method=post action=\"$PHP_SELF\">
    <table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">
    <td width=\"1108\" height=\"8%\" colspan=\"2\">
    <div class=header>Edit Comment</div>
    <tr>
    <td height=20 valign=middle width=\"102\" bgcolor=\"#F9F8F7\">
    Poster
    <td height=20 valign=middle width=\"1002\" bgcolor=\"#F9F8F7\">
    <input type=text name=poster value=\"$single_arr[1]\">
    </tr>

    <tr>
    <td height=20 valign=middle valign=\"top\" width=\"102\">
    Email
    <td height=20 valign=middle width=\"1002\">
    <input type=text name=mail value=\"$single_arr[2]\">
    </tr>

    <tr>
    <td height=20 valign=middle valign=\"top\" width=\"102\" bgcolor=\"#F9F8F7\">
    IP
    <td height=20 valign=middle width=\"1002\" bgcolor=\"#F9F8F7\">
    <a href=\"http://www.ripe.net/perl/whois?searchtext=$single_arr[3]\" target=_blank title=\"Get more information about this ip\">$single_arr[3]</a>  &nbsp;
    <a href=\"$PHP_SELF?mod=ipban&action=quickadd&add_ip=$single_arr[3]\">[ban this ip]</a>
    </tr>

    <tr>
    <td height=20 valign=middle valign=\"top\" width=\"102\">
    Date
    <td height=20 valign=middle width=\"1002\">
    $comdate
    </tr>
    <tr>
    <td height=20 valign=middle  width=\"102\" bgcolor=\"#F9F8F7\">
    Comments&nbsp;
    <td  height=20 valign=middle width=\"1002\" bgcolor=\"#F9F8F7\">
    <textarea rows=\"8\" name=\"comment\" cols=\"45\">$single_arr[4]</textarea>
    </tr>
    <tr>
    <td  valign=\"top\" width=\"1104\" colspan=\"2\">
    <p align=\"left\"><br />
    <input type=submit value=\"Save Changes\" accesskey=\"s\">&nbsp; <input type=button value=Cencel onClick=\"window.close();\" accesskey=\"c\">
    <input type=hidden name=mod value=editcomments>
    <input type=hidden name=newsid value=$newsid>
    <input type=hidden name=comid value=$comid>
    <input type=hidden name=source value=$source>
    <input type=hidden name=action value=doeditcomment>
    </tr>
    </table>
    </form>
    </body>
    </html>";
}
// ********************************************************************************
// Do Save Comment
// ********************************************************************************
elseif($action == "doeditcomment")
{
        if(!$poster and !$deletecomment){ echo"<br /><br><br />The poster can not be blank !!!"; exit(); }
    if($mail == "" and !$deletecomment){ $mail = "none"; }
    if($poster == "" and !$deletecomment){ $poster = "Anonymous"; }
    if($comment == "" and !$deletecomment){ die("comment can not be blank"); }

    $comment = str_replace("\r\n","<br />",$comment);
    $comment = str_replace("|","I",$comment);

    if($source == ""){ $news_file = "./data/news.txt"; $com_file = "./data/comments.txt"; }
    else{ $news_file = "./data/archives/$source.news.arch"; $com_file = "./data/archives/$source.comments.arch";}

    $old_com = file("$com_file");
    $new_com = fopen("$com_file","w");

    foreach($old_com as $line)
    {
                $line_arr = explode("|>|",$line);
                if($line_arr[0] == $newsid)
                {
                        fwrite($new_com,"$line_arr[0]|>|");


                $comments = explode("||", $line_arr[1]);
                foreach($comments as $single_comment)
                {
                $single_comment = trim($single_comment);
                $comment_arr = explode("|", $single_comment);
                    if($comment_arr[0] == $comid and $comment_arr[0] != "" and $delcomid != "all")
                    {
                                        fwrite($new_com,"$comment_arr[0]|$poster|$mail|$comment_arr[3]|$comment||");
                    }
                elseif($delcomid[$comment_arr[0]] != 1 and $comment_arr[0] != ""  and $delcomid[all] != 1){
                        fwrite($new_com,"$single_comment||");
                }
                }
                fwrite($new_com,"\n");


        }
        else{ fwrite($new_com, "$line"); }
     }

     if(isset($deletecomment) and $delcomid[all] == 1){ msg("info", "Comments Deleted", "All comments were deleted.", "$PHP_SELF?mod=editnews&action=editnews&id=$newsid&source=$source"); }
     elseif(isset($deletecomment) and isset($delcomid)){ msg("info", "Comment Deleted", "The selected comment(s) has been deleted.", "$PHP_SELF?mod=editnews&action=editnews&id=$newsid&source=$source"); }
     else{ echo"<br /><br /><br /><br /><center><b>Comment is saved."; }
}

?>