diff --git a/Rocksolid_Light/rocksolid/newsportal.php b/Rocksolid_Light/rocksolid/newsportal.php
index bff00e3..8e0fa95 100644
--- a/Rocksolid_Light/rocksolid/newsportal.php
+++ b/Rocksolid_Light/rocksolid/newsportal.php
@@ -707,12 +707,14 @@ function groups_show($gruppen)
$lastarticleinfo['name'] = $poster[0]['mailbox'];
}
$fromoutput[0] = $poster[0]['mailbox'] . "@" . $poster[0]['host'];
+ $groupdisplay .= get_date_interval(date("D, j M Y H:i T", $lastarticleinfo['date']));
+ $groupdisplay .= '
';
+ $groupdisplay .= 'by: ';
+ $groupdisplay .= create_name_link(mb_decode_mimeheader(html_entity_decode($lastarticleinfo['name'])), $lastarticleinfo['from']);
+ $groupdisplay .= ' |
';
+ } else {
+ unset($lastarticleinfo);
}
- $groupdisplay .= get_date_interval(date("D, j M Y H:i T", $lastarticleinfo['date']));
- $groupdisplay .= '';
- $groupdisplay .= 'by: ';
- $groupdisplay .= create_name_link(mb_decode_mimeheader(html_entity_decode($lastarticleinfo['name'])), $lastarticleinfo['from']);
- $groupdisplay .= ' |
';
}
if (isset($groupdisplay)) {
$groupdisplay .= "\n";
@@ -2227,3 +2229,91 @@ function send_admin_message($admin, $from, $subject, $message)
$dbh = null;
return true;
}
+function delete_message($messageid, $group, $overview_dbh)
+{
+ global $logfile, $config_dir, $spooldir, $CONFIG, $webserver_group;
+ /* Find section */
+ $menulist = file($config_dir . "menu.conf", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
+ foreach ($menulist as $menu) {
+ if ($menu[0] == '#') {
+ continue;
+ }
+ $menuitem = explode(':', $menu);
+ $glfp = fopen($config_dir . $menuitem[0] . "/groups.txt", 'r');
+ while ($gl = fgets($glfp)) {
+ $group_name = preg_split("/( |\t)/", $gl, 2);
+ if (strtolower(trim($group)) == strtolower(trim($group_name[0]))) {
+ $config_name = $menuitem[0];
+ echo "\nFOUND: " . $group . " IN: " . $config_name;
+ file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " FOUND: " . $group . " IN: " . $config_name, FILE_APPEND);
+ break 2;
+ }
+ }
+ }
+
+ if ($CONFIG['article_database'] == '1') {
+ $database = $spooldir . '/' . $group . '-articles.db3';
+ if (is_file($database)) {
+ $articles_dbh = article_db_open($database);
+ $articles_stmt = $articles_dbh->prepare('DELETE FROM articles WHERE msgid=:messageid');
+ $articles_stmt->execute([
+ 'messageid' => $messageid
+ ]);
+ $articles_dbh = null;
+ }
+ }
+ // Handle overview and history
+ $overview_stmt_del = $overview_dbh->prepare('DELETE FROM overview WHERE newsgroup=:newsgroup AND msgid=:msgid');
+ $overview_query = $overview_dbh->prepare('SELECT * FROM overview WHERE newsgroup=:newsgroup AND msgid=:msgid');
+ $overview_query->execute([
+ ':newsgroup' => $group,
+ ':msgid' => $messageid
+ ]);
+ $grouppath = preg_replace('/\./', '/', $group);
+ $status = "deleted";
+ $statusdate = time();
+ $statusreason = "nocem";
+ $statusnotes = null;
+ while ($row = $overview_query->fetch()) {
+ if (isset($row['number'])) {
+ echo "\nFOUND: " . $messageid . " IN: " . $group;
+ file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " DELETING: " . $messageid . " IN: " . $group, FILE_APPEND);
+ }
+ if (is_file($spooldir . '/articles/' . $grouppath . '/' . $row['number'])) {
+ unlink($spooldir . '/articles/' . $grouppath . '/' . $row['number']);
+ }
+ delete_message_from_overboard($config_name, $group, $messageid);
+ add_to_history($group, $row['number'], $row['msgid'], $status, $statusdate, $statusreason, $statusnotes);
+ thread_cache_removearticle($group, $row['number']);
+ $overview_stmt_del->execute([
+ ':newsgroup' => $group,
+ ':msgid' => $messageid
+ ]);
+ }
+ return;
+}
+
+function delete_message_from_overboard($config_name, $group, $messageid)
+{
+ GLOBAL $spooldir;
+ $cachefile = $spooldir . "/" . $config_name . "-overboard.dat";
+ if (is_file($cachefile)) {
+ $cached_overboard = unserialize(file_get_contents($cachefile));
+ if ($target = $cached_overboard['msgids'][$messageid]) {
+ unset($cached_overboard['threads'][$target['date']]);
+ unset($cached_overboard['msgids'][$messageid]);
+ unset($cached_overboard['threadlink'][$messageid]);
+ file_put_contents($cachefile, serialize($cached_overboard));
+ }
+ }
+ $cachefile = $spooldir . "/" . $group . "-overboard.dat";
+ if (is_file($cachefile)) {
+ $cached_overboard = unserialize(file_get_contents($cachefile));
+ if ($target = $cached_overboard['msgids'][$messageid]) {
+ unset($cached_overboard['threads'][$target['date']]);
+ unset($cached_overboard['msgids'][$messageid]);
+ unset($cached_overboard['threadlink'][$messageid]);
+ file_put_contents($cachefile, serialize($cached_overboard));
+ }
+ }
+}