| 1 | <?php |
|---|
| 2 | include_once('.'.DIRECTORY_SEPARATOR.'auth.php'); |
|---|
| 3 | define("JLOG_ADMIN", true); |
|---|
| 4 | define("JLOG_COMMENTS", true); |
|---|
| 5 | require_once('..'.DIRECTORY_SEPARATOR.'scripts'.DIRECTORY_SEPARATOR.'prepend.inc.php'); |
|---|
| 6 | require(JLOG_BASEPATH.'admin'.DIRECTORY_SEPARATOR.'blog.func.php'); |
|---|
| 7 | |
|---|
| 8 | $get = strip($_GET); |
|---|
| 9 | $data = strip($_POST); |
|---|
| 10 | $mysql_id = escape_for_mysql($get['id']); |
|---|
| 11 | |
|---|
| 12 | $c['meta']['title'] = $l['admin']['kill_c_topic']; |
|---|
| 13 | $c['main'] = output_admin_menu(); |
|---|
| 14 | |
|---|
| 15 | if($get['action'] == 'trash' AND $data['trash'] == $l['admin']['yes']) { |
|---|
| 16 | |
|---|
| 17 | ### Plugin Hook |
|---|
| 18 | $get['id'] = $plugins->callHook('deleteComment', $get['id']); |
|---|
| 19 | |
|---|
| 20 | if( trash($get['id'], JLOG_DB_COMMENTS ) == true) { |
|---|
| 21 | $c['main'] .= $l['admin']['kill_c_killed']; |
|---|
| 22 | include_once(JLOG_BASEPATH.'scripts'.DIRECTORY_SEPARATOR.'update.php'); |
|---|
| 23 | } |
|---|
| 24 | } |
|---|
| 25 | elseif ($get['action'] == 'trash' AND empty($data['trash'])) { |
|---|
| 26 | $c['main'] .= " |
|---|
| 27 | <form method='post' id='entryform' action='comments.php?id=".$get['id']."&action=trash' accept-charset='UTF-8'> |
|---|
| 28 | <p>".$l['admin']['kill_c_sure']." |
|---|
| 29 | <input class='send' type='submit' name='trash' value='".$l['admin']['yes']."' /> |
|---|
| 30 | ".add_session_id_input_tag()." |
|---|
| 31 | <a href='".add_session_id_to_url("comments.php")."'>".$l['admin']['no']."</a></p> |
|---|
| 32 | </form>"; |
|---|
| 33 | |
|---|
| 34 | $sql = 'SELECT id, sid, name, city, email, homepage, content, ' . |
|---|
| 35 | 'date, reference, mail_by_comment, type FROM ' . |
|---|
| 36 | JLOG_DB_COMMENTS." |
|---|
| 37 | WHERE id = ".$mysql_id." |
|---|
| 38 | ORDER BY id DESC LIMIT 1;"; |
|---|
| 39 | |
|---|
| 40 | $comment = new Query($sql); |
|---|
| 41 | if($comment->error()) { |
|---|
| 42 | echo "<pre>\n"; |
|---|
| 43 | echo $comment->getError(); |
|---|
| 44 | echo "</pre>\n"; |
|---|
| 45 | die(); |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | $daten = $comment->fetch(); |
|---|
| 49 | $c['main'] .= "<ul class='comments'>".do_comment($daten, "x")."</ul>"; |
|---|
| 50 | |
|---|
| 51 | } |
|---|
| 52 | elseif($get['action'] == 'change' AND !empty($get['id'])) { |
|---|
| 53 | |
|---|
| 54 | $l["comments_comment_topic"] = $l['admin']["comments_comment_topic"]; |
|---|
| 55 | $l["comments_by"] = $l['admin']["comments_by"]; |
|---|
| 56 | $l["comments_name"] = $l['admin']["comments_name"]; |
|---|
| 57 | $l["comments_city"] = $l['admin']["comments_city"]; |
|---|
| 58 | $l["comments_email"] = $l['admin']["comments_email"]; |
|---|
| 59 | $l["comments_homepage"] = $l['admin']["comments_homepage"]; |
|---|
| 60 | $l["comments_bbcode"] = $l['admin']["comments_bbcode"]; |
|---|
| 61 | $l["comments_send"] = $l['admin']["comments_send"]; |
|---|
| 62 | $l["comments_preview"] = $l['admin']["comments_preview"]; |
|---|
| 63 | $l["comments_no_sid"] = $l['admin']["comments_no_sid"]; |
|---|
| 64 | $l["comments_false_mail"] = $l['admin']["comments_false_mail"]; |
|---|
| 65 | $l["comments_notext"] = $l['admin']["comments_notext"]; |
|---|
| 66 | $l["comments_false_hp"] = $l['admin']["comments_false_hp"]; |
|---|
| 67 | $l["comments_anonym"] = $l['admin']["comments_anonym"]; |
|---|
| 68 | $l["comments_permalink"] = $l['admin']["comments_permalink"]; |
|---|
| 69 | $l["comments_from"] = $l['admin']["comments_from"]; |
|---|
| 70 | $l["comments_posted"] = $l['admin']["comments_posted"]; |
|---|
| 71 | $l["comments_entryform"] = $l['admin']["comments_entryform"]; |
|---|
| 72 | $l["comments_mail_by_comment"] = $l['admin']["comments_mail_by_comment"]; |
|---|
| 73 | $l["comments_thx"] = $l['admin']["comments_thx"]; |
|---|
| 74 | $l["comments_preview"] = $l['admin']["comments_preview"]; |
|---|
| 75 | $l["comments_send"] = $l['admin']["comments_send"]; |
|---|
| 76 | $l["comments_bold"] = $l['admin']["comments_bold"]; |
|---|
| 77 | $l["comments_italic"] = $l['admin']["comments_italic"]; |
|---|
| 78 | $l["comments_quote"] = $l['admin']["comments_quote"]; |
|---|
| 79 | $l["comments_url"] = $l['admin']["comments_url"]; |
|---|
| 80 | $l["comments_plz_format_txt"] = $l['admin']["comments_plz_format_txt"]; |
|---|
| 81 | $l["comments_url_href"] = $l['admin']["comments_url_href"]; |
|---|
| 82 | $l["comments_url_node"] = $l['admin']["comments_url_node"]; |
|---|
| 83 | |
|---|
| 84 | if($data['form_submitted'] == $l['comments_preview']) { |
|---|
| 85 | $c['main'] .= "\n <h2>".$l['admin']['comments_change_h']."</h2> |
|---|
| 86 | <ul class='comments' id='preview'> |
|---|
| 87 | ".do_comment($data, 1)." |
|---|
| 88 | </ul>".com_form_output($data).com_javascript_variables(); |
|---|
| 89 | } |
|---|
| 90 | elseif($data['form_submitted'] == $l['comments_send']) { |
|---|
| 91 | if(count($errors = com_check_errors($data)) > 0) $c['main'] .= "\n <h2>".$l['admin']['comments_change_h']."</h2>\n".error_output($error).com_form_output($data).com_javascript_variables(); |
|---|
| 92 | else { |
|---|
| 93 | |
|---|
| 94 | $data = com_clean_data($data); |
|---|
| 95 | |
|---|
| 96 | ### Plugin Hook |
|---|
| 97 | $data = $plugins->callHook('updateComment', $data); |
|---|
| 98 | |
|---|
| 99 | $data = escape_for_mysql($data); |
|---|
| 100 | |
|---|
| 101 | $sql = "UPDATE ".JLOG_DB_COMMENTS." |
|---|
| 102 | SET |
|---|
| 103 | name = '".$data['name']."', |
|---|
| 104 | city = '".$data['city']."', |
|---|
| 105 | email = '".$data['email']."', |
|---|
| 106 | homepage = '".$data['homepage']."', |
|---|
| 107 | content = '".$data['content']."', |
|---|
| 108 | mail_by_comment = '".$data['mail_by_comment']."' |
|---|
| 109 | WHERE id = '".$data['id']."' LIMIT 1;"; |
|---|
| 110 | |
|---|
| 111 | $updatecomment = new Query($sql); |
|---|
| 112 | if($updatecomment->error()) { |
|---|
| 113 | echo "<pre>\n"; |
|---|
| 114 | echo $updatecomment->getError(); |
|---|
| 115 | echo "</pre>\n"; |
|---|
| 116 | die(); |
|---|
| 117 | } |
|---|
| 118 | $c['main'] .= "\n <h2>".$l['admin']['comments_change_h']."</h2>\n".$l['admin']['comments_updated']." <a href='".add_session_id_to_url("comments.php")."'>".$l['admin']['comments_admin']."</a>"; |
|---|
| 119 | include_once(JLOG_BASEPATH.'scripts'.DIRECTORY_SEPARATOR.'update.php'); |
|---|
| 120 | } |
|---|
| 121 | } |
|---|
| 122 | else { |
|---|
| 123 | $sql = 'SELECT id, sid, name, city, email, homepage, content, ' . |
|---|
| 124 | 'UNIX_TIMESTAMP(date) AS date, reference, ' . |
|---|
| 125 | 'mail_by_comment, type FROM '.JLOG_DB_COMMENTS." |
|---|
| 126 | WHERE id = ".$mysql_id." |
|---|
| 127 | ORDER BY id DESC LIMIT 1;"; |
|---|
| 128 | |
|---|
| 129 | $comment = new Query($sql); |
|---|
| 130 | if($comment->error()) { |
|---|
| 131 | echo "<pre>\n"; |
|---|
| 132 | echo $comment->getError(); |
|---|
| 133 | echo "</pre>\n"; |
|---|
| 134 | die(); |
|---|
| 135 | } |
|---|
| 136 | |
|---|
| 137 | $data = $comment->fetch(); |
|---|
| 138 | if(empty($data['name'])) $data['name'] = $l['comments_name']; |
|---|
| 139 | if(empty($data['city'])) $data['city'] = $l['comments_city']; |
|---|
| 140 | if(empty($data['email'])) $data['email'] = $l['comments_email']; |
|---|
| 141 | if(empty($data['homepage'])) $data['homepage'] = $l['comments_homepage']; |
|---|
| 142 | |
|---|
| 143 | $c['main'] .= "\n <h2>".$l['admin']['comments_change_h']."</h2> |
|---|
| 144 | <ul class='comments' id='preview'> |
|---|
| 145 | ".do_comment($data, 1)." |
|---|
| 146 | </ul>".com_form_output($data).com_javascript_variables(); |
|---|
| 147 | } |
|---|
| 148 | } |
|---|
| 149 | else { |
|---|
| 150 | $yl = new Year_Links($get['y'], JLOG_START_YEAR, add_session_id_to_url(JLOG_PATH."/admin/comments.php"), $l['admin']); |
|---|
| 151 | |
|---|
| 152 | $c['main'] .= " |
|---|
| 153 | <h2>".$l['admin']['kill_c_topic']."</h2> |
|---|
| 154 | <p>".$l['admin']['kill_c_description']."</p> |
|---|
| 155 | <p>".$yl->get_admin_linklist()."</p> |
|---|
| 156 | <table> |
|---|
| 157 | <tr> |
|---|
| 158 | <th>".$l['admin']['change']."</th><th>".$l['admin']['delete']."</th><th>ID</th><th>".$l['comments_name']."</th><th>".$l['comments_posted']."</th><th>".$l['admin']['kill_c_entry']."</th> |
|---|
| 159 | </tr>"; |
|---|
| 160 | |
|---|
| 161 | $sql = "SELECT |
|---|
| 162 | ".JLOG_DB_COMMENTS.".id AS id, |
|---|
| 163 | ".JLOG_DB_CONTENT.".url AS url, |
|---|
| 164 | UNIX_TIMESTAMP(".JLOG_DB_CONTENT.".date) AS reference_date, |
|---|
| 165 | UNIX_TIMESTAMP(".JLOG_DB_COMMENTS.".date) AS date, |
|---|
| 166 | ".JLOG_DB_COMMENTS.".name AS name, |
|---|
| 167 | ".JLOG_DB_CONTENT.".topic AS topic, |
|---|
| 168 | ".JLOG_DB_COMMENTS.".email AS email, |
|---|
| 169 | ".JLOG_DB_COMMENTS.".type AS type |
|---|
| 170 | FROM ".JLOG_DB_COMMENTS.", ".JLOG_DB_CONTENT." |
|---|
| 171 | WHERE ".JLOG_DB_COMMENTS.".reference = ".JLOG_DB_CONTENT.".id |
|---|
| 172 | AND YEAR(".JLOG_DB_COMMENTS.".date) = '".$yl->get_selected_year()."' |
|---|
| 173 | ORDER BY id DESC;"; |
|---|
| 174 | |
|---|
| 175 | $comments = new Query($sql); |
|---|
| 176 | if($comments->error()) { |
|---|
| 177 | echo "<pre>\n"; |
|---|
| 178 | echo $comments->getError(); |
|---|
| 179 | echo "</pre>\n"; |
|---|
| 180 | die(); |
|---|
| 181 | } |
|---|
| 182 | |
|---|
| 183 | while ($daten = $comments->fetch()) { |
|---|
| 184 | |
|---|
| 185 | if(empty($daten['name'])) $daten['name'] = $l['comments_anonym']; |
|---|
| 186 | elseif($daten['type'] != 'pingback') $daten['name'] = htmlspecialchars($daten['name'], ENT_QUOTES); |
|---|
| 187 | |
|---|
| 188 | if(!empty($daten['email'])) { |
|---|
| 189 | $email_a = "<a href='mailto:".$daten['email']."'>"; |
|---|
| 190 | $email_b = "</a>"; |
|---|
| 191 | } |
|---|
| 192 | else { |
|---|
| 193 | $email_a = ""; |
|---|
| 194 | $email_b = ""; |
|---|
| 195 | } |
|---|
| 196 | $comment = " |
|---|
| 197 | <tr> |
|---|
| 198 | <td><a href='".add_session_id_to_url("?id=".$daten['id']."&action=change")."'><img src='".JLOG_PATH."/img/JLOG_edit.png' alt='".$l['admin']['change']."' /></a></td> |
|---|
| 199 | <td><a href='".add_session_id_to_url("?id=".$daten['id']."&action=trash")."'><img src='".JLOG_PATH."/img/JLOG_trash.png' alt='".$l['admin']['delete']."' /></a></td> |
|---|
| 200 | <td><a href='".blog($daten['reference_date'], $daten['url'])."#c".$daten['id']."'>".$daten['id']."</a></td> |
|---|
| 201 | <td>".$email_a.$daten['name'].$email_b."</td> |
|---|
| 202 | <td>".strftime(JLOG_DATE_COMMENT, $daten['date'])."</td> |
|---|
| 203 | <td>".$daten['topic']."</td> |
|---|
| 204 | </tr>"; |
|---|
| 205 | |
|---|
| 206 | ### Plugin Hook |
|---|
| 207 | $c['main'] .= $plugins->callHook('commentAdminList', $comment, $daten); |
|---|
| 208 | |
|---|
| 209 | } |
|---|
| 210 | |
|---|
| 211 | $c['main'] .= " |
|---|
| 212 | </table>"; |
|---|
| 213 | } |
|---|
| 214 | |
|---|
| 215 | require(JLOG_BASEPATH.'scripts'.DIRECTORY_SEPARATOR.'do_template.php'); |
|---|
| 216 | echo $body; |
|---|
| 217 | ?> |
|---|