gibt es ein deltread addon welchen man ausführen kann mit anzahl tage wo dann automatisch der tread gelöscht wird ?
siehe http://www.rootforum.de/forum/viewtopic ... ght=strato
Dirk
deltread addon ?
Forumsregeln
phpBB 2.0 hat das Ende seiner Lebenszeit überschritten
phpBB 2.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 2.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf phpBB 3.1, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
phpBB 2.0 hat das Ende seiner Lebenszeit überschritten
phpBB 2.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 2.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf phpBB 3.1, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
-
- Mitglied
- Beiträge: 253
- Registriert: 04.02.2004 22:40
- Wohnort: Bochum
-
- Mitglied
- Beiträge: 253
- Registriert: 04.02.2004 22:40
- Wohnort: Bochum
Habe es gefunden:
Dirk
Code: Alles auswählen
<?
// phpbb_massdel
// (c) by Tobias Lohner, tobias@lohner-net.de
//
// Steht unter der GPL:
// http://www.gnu.org/licenses/gpl.html
//
// Haftung bei Schäden wird natürlich nicht übernommen :-)
//
function create_time($datum, $time=0) {
$day_time = explode(" ", $datum, 2);
if ($day_time[0][0] == "+") {
$plus = strrev($day_time[0]);
if ($plus[0] == "h") {
$i = strtr(strtr($day_time[0], "+", " "), "h", " ");
$i = $i*3600;
} else if ($plus[0] == "d") {
$i = strtr(strtr($day_time[0], "+", " "), "d", " ");
$i = $i*3600*24;
}
$ts = $time+$i;
} else {
if (substr_count($day_time[0], ":") == 0) {
$d_m_y = explode(".", $day_time[0], 3);
$h_m_s = explode(":", $day_time[1], 3);
} else if (substr_count($day_time[0], ":") > 0) {
$h_m_s = explode(":", $day_time[0], 3);
}
if ($d_m_y[0] == "") $d_m_y[0] = date("d", $time);
if ($d_m_y[1] == "") $d_m_y[1] = date("m", $time);
if ($d_m_y[2] == "") $d_m_y[2] = date("Y", $time);
$ts = mktime ($h_m_s[0], $h_m_s[1], $h_m_s[2], $d_m_y[1], $d_m_y[0], $d_m_y[2]);
}
return $ts;
}
function delete ($topic_id, $forum_id) {
if ($topic_id==0) unset($topic_id);
if ($forum_id==0) unset($forum_id);
global $db;
global $phpEx;
global $phpbb_root_path;
include ($phpbb_root_path . 'config.'.$phpEx);
include ($phpbb_root_path . 'includes/constants.'.$phpEx);
// Check ob Topic wirklich existiert
if ( !empty($topic_id) )
{
$sql = "SELECT f.forum_id, f.forum_name, f.forum_topics
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
WHERE t.topic_id = " . $topic_id . "
AND f.forum_id = t.forum_id";
if ( !($result = $db->sql_query($sql)) )
{
// message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
die("Topic_post_not_exist");
}
$topic_row = $db->sql_fetchrow($result);
$forum_topics = ( $topic_row['forum_topics'] == 0 ) ? 1 : $topic_row['forum_topics'];
$forum_id = $topic_row['forum_id'];
$forum_name = $topic_row['forum_name'];
}
else if ( !empty($forum_id) )
{
$sql = "SELECT forum_name, forum_topics
FROM " . FORUMS_TABLE . "
WHERE forum_id = " . $forum_id;
if ( !($result = $db->sql_query($sql)) )
{
// message_die(GENERAL_MESSAGE, 'Forum_not_exist');
die ("Forum_not_exist");
}
$topic_row = $db->sql_fetchrow($result);
$forum_topics = ( $topic_row['forum_topics'] == 0 ) ? 1 : $topic_row['forum_topics'];
$forum_name = $topic_row['forum_name'];
}
else
{
// message_die(GENERAL_MESSAGE, 'Forum_not_exist');
die("Forum_not_exist");
}
// Thread löschen
$topics = array($topic_id);
$topic_id_sql = '';
for($i = 0; $i < count($topics); $i++)
{
$topic_id_sql .= ( ( $topic_id_sql != '' ) ? ', ' : '' ) . $topics[$i];
}
$sql = "SELECT poster_id, COUNT(post_id) AS posts
FROM " . POSTS_TABLE . "
WHERE topic_id IN ($topic_id_sql)
GROUP BY poster_id";
if ( !($result = $db->sql_query($sql)) )
{
// message_die(GENERAL_ERROR, 'Could not get poster id information', '', __LINE__, __FILE__, $sql);
die ("Could not get poster id information: ".$sql);
}
$count_sql = array();
while ( $row = $db->sql_fetchrow($result) )
{
$count_sql[] = "UPDATE " . USERS_TABLE . "
SET user_posts = user_posts - " . $row['posts'] . "
WHERE user_id = " . $row['poster_id'];
}
$db->sql_freeresult($result);
if ( sizeof($count_sql) )
{
for($i = 0; $i < sizeof($count_sql); $i++)
{
if ( !$db->sql_query($count_sql[$i]) )
{
// message_die(GENERAL_ERROR, 'Could not update user post count information', '', __LINE__, __FILE__, $sql);
die ("Could not update user post count information: ".$sql);
}
}
}
$sql = "SELECT post_id
FROM " . POSTS_TABLE . "
WHERE topic_id IN ($topic_id_sql)";
if ( !($result = $db->sql_query($sql)) )
{
// message_die(GENERAL_ERROR, 'Could not get post id information', '', __LINE__, __FILE__, $sql);
die ("Could not get post id information: ".$sql);
}
$post_id_sql = '';
while ( $row = $db->sql_fetchrow($result) )
{
$post_id_sql .= ( ( $post_id_sql != '' ) ? ', ' : '' ) . $row['post_id'];
}
$db->sql_freeresult($result);
$sql = "SELECT vote_id
FROM " . VOTE_DESC_TABLE . "
WHERE topic_id IN ($topic_id_sql)";
if ( !($result = $db->sql_query($sql)) )
{
// message_die(GENERAL_ERROR, 'Could not get vote id information', '', __LINE__, __FILE__, $sql);
die ("Could not get vote id information: ".$sql);
}
$vote_id_sql = '';
while ( $row = $db->sql_fetchrow($result) )
{
$vote_id_sql .= ( ( $vote_id_sql != '' ) ? ', ' : '' ) . $row['vote_id'];
}
$db->sql_freeresult($result);
//
// Got all required info so go ahead and start deleting everything
//
$sql = "DELETE
FROM " . TOPICS_TABLE . "
WHERE topic_id IN ($topic_id_sql)
OR topic_moved_id IN ($topic_id_sql)";
if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
{
// message_die(GENERAL_ERROR, 'Could not delete topics', '', __LINE__, __FILE__, $sql);
die ("Could not delete topics: ".$sql);
}
if ( $post_id_sql != '' )
{
$sql = "DELETE
FROM " . POSTS_TABLE . "
WHERE post_id IN ($post_id_sql)";
if ( !$db->sql_query($sql) )
{
// message_die(GENERAL_ERROR, 'Could not delete posts', '', __LINE__, __FILE__, $sql);
die ("Could not delete posts: ".$sql);
}
$sql = "DELETE
FROM " . POSTS_TEXT_TABLE . "
WHERE post_id IN ($post_id_sql)";
if ( !$db->sql_query($sql) )
{
// message_die(GENERAL_ERROR, 'Could not delete posts text', '', __LINE__, __FILE__, $sql);
die ("Could not delete posts text: ".$sql);
}
remove_search_post($post_id_sql);
}
if ( $vote_id_sql != '' )
{
$sql = "DELETE
FROM " . VOTE_DESC_TABLE . "
WHERE vote_id IN ($vote_id_sql)";
if ( !$db->sql_query($sql) )
{
// message_die(GENERAL_ERROR, 'Could not delete vote descriptions', '', __LINE__, __FILE__, $sql);
die ("Could not delete vote descriptions: ".$sql);
}
$sql = "DELETE
FROM " . VOTE_RESULTS_TABLE . "
WHERE vote_id IN ($vote_id_sql)";
if ( !$db->sql_query($sql) )
{
// message_die(GENERAL_ERROR, 'Could not delete vote results', '', __LINE__, __FILE__, $sql);
die ("Could not delete vote results: ".$sql);
}
$sql = "DELETE
FROM " . VOTE_USERS_TABLE . "
WHERE vote_id IN ($vote_id_sql)";
if ( !$db->sql_query($sql) )
{
// message_die(GENERAL_ERROR, 'Could not delete vote users', '', __LINE__, __FILE__, $sql);
die ("Could not delete vote users: ".$sql);
}
}
$sql = "DELETE
FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id IN ($topic_id_sql)";
if ( !$db->sql_query($sql, END_TRANSACTION) )
{
// message_die(GENERAL_ERROR, 'Could not delete watched post list', '', __LINE__, __FILE__, $sql);
die ("Could not delete watched post list: ".$sql);
}
sync('forum', $forum_id);
// if ( !empty($topic_id) )
// {
// $redirect_page = "viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&sid=" . $userdata['session_id'];
// $l_redirect = sprintf($lang['Click_return_forum'], '<a href="' . $redirect_page . '">', '</a>');
// }
// else
// {
// $redirect_page = "modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id&sid=" . $userdata['session_id'];
// $l_redirect = sprintf($lang['Click_return_modcp'], '<a href="' . $redirect_page . '">', '</a>');
// }
// $template->assign_vars(array(
// 'META' => '<meta http-equiv="refresh" content="3;url=' . $redirect_page . '">')
// );
// message_die(GENERAL_MESSAGE, $lang['Topics_Removed'] . '<br /><br />' . $l_redirect);
}
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'config.'.$phpEx);
//include($phpbb_root_path . 'common.'.$phpEx);
//include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
include($phpbb_root_path . 'includes/db.'.$phpEx);
//include($phpbb_root_path . 'includes/functions.'.$phpEx);
include($phpbb_root_path . 'includes/functions_search.'.$phpEx);
$pre = $table_prefix;
// $db = mysql_connect ($dbhost, $dbuser, $dbpasswd);
// mysql_select_db($dbname, $db);
$res = mysql_query ("SELECT ".$pre."posts_text.post_id, ".$pre."posts_text.post_text, ".$pre."posts.topic_id, ".$pre."posts.post_time, ".$pre."posts.forum_id FROM ".$pre."posts_text, ".$pre."posts, ".$pre."auth_access, ".$pre."user_group WHERE ".$pre."posts_text.post_text LIKE '[DEL%' AND ".$pre."posts.post_id=".$pre."posts_text.post_id AND ".$pre."user_group.user_id=".$pre."posts.poster_id AND ".$pre."auth_access.group_id=".$pre."user_group.group_id AND ".$pre."auth_access.forum_id=".$pre."posts.forum_id AND (".$pre."auth_access.auth_mod=1 OR ".$pre."auth_access.auth_delete=1)");
// mysql_close($db);
while ($myrow = mysql_fetch_array($res)) {
$post_time=$myrow["post_time"];
$del_str = explode("]", $myrow["post_text"], 2);
$datum = explode(" ", strtolower($del_str[0]), 2);
// if ($datum[0] == "[delpost") {
// $date = create_time($datum[1], $post_time);
// echo "POSTING: ".date("Y-m-d H:i:s", $date)." ".$myrow["post_text"]."<br>";
// }
// echo $datum[0];
// echo $datum[1];
// echo " <br>".$del_str[0]." ";
if ($datum[0] == "[deltopic" || $datum[0] == "[delthread") {
$date = create_time($datum[1], $post_time);
if (time() >= $date) {
echo "deleting topic_id ".$myrow['topic_id']."...";
delete ($myrow["topic_id"], $myrow["forum_id"]);
echo "deleted...\n";
}
}
}
?>
-
- Mitglied
- Beiträge: 253
- Registriert: 04.02.2004 22:40
- Wohnort: Bochum
-
- Mitglied
- Beiträge: 253
- Registriert: 04.02.2004 22:40
- Wohnort: Bochum
Re: deltread addon ?
läuft leider nicht mehr auf neuen Server mit Suse 10.3 und php 5
jemand eine idee ?
Dirk
jemand eine idee ?
Dirk
Aktuell PhpBB Live Forum 3.2.11 Testforum nach Update von 3.2.11 ist nun 3.3.3