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