[2.0.x] Pruning: Verschieben / Schließen *emc

Du hast Probleme beim Einbau oder bei der Benutzung eines Mods? In diesem Forum bist du richtig.
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.0, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
Dwing
Ehrenadmin
Beiträge: 1965
Registriert: 17.06.2001 02:00

[2.0.x] Pruning: Verschieben / Schließen *emc

Beitrag von Dwing »

MOD Name: Pruning: Verschieben / Schließen
Autor: QCO, Simon Englisch, simon@httpsmog.de
Beschreibung: Der Mod fügt für jedes Form die Einstellungsmöglichkeit hinzu, anstatt automatisch alte Post zu löschen (Pruning), diese auch wahlweise einfach zu schließen oder sie in eine anderes Forum zu verschieben.
Installationsgrad: normal
Download: Pruning: Verschieben / Scgließen

Zusätzliche Infos:
Mit diesem Mod kann man seinen Usern die Möglichkeit geben, alte Themen noch zu lesen, bevor sie später gelöscht werden.
Obstel
Mitglied
Beiträge: 54
Registriert: 29.04.2004 10:05
Kontaktdaten:

Beitrag von Obstel »

sry wenn ich noch nicht abstimme, aber ich muss noch 2 fehler beseitigen.

Ich benutze die Version 2.0.8 mit dem sub-forum hack und ich hab 2 Parse Errors, die ich nicht wegbekomme.

1. Parse Error in der admin_forums.php im admin ordner

Code: Alles auswählen

// start forum prune stuff.
				//
				if( $row['prune_enable'] )
				{
					$prune_enabled = "checked=\"checked\"";
					$sql = "SELECT *
               			FROM " . PRUNE_TABLE . "
               			WHERE forum_id = $forum_id";
					if(!$pr_result = $db->sql_query($sql))
					{
						 message_die(GENERAL_ERROR, "Auto-Prune: Couldn't read auto_prune table.", __LINE__, __FILE__);
        			}

					$pr_row = $db->sql_fetchrow($pr_result);
					$prune_loc$prune_lock = ( $pr_row['prune_type'] == PRUNE_LOCK ) ? 'checked="checked" ' : '';
					$prune_move = ( $pr_row['prune_type'] == PRUNE_MOVE ) ? 'checked="checked" ' : '';
					$prune_del = ( $pr_row['prune_type'] == PRUNE_DELETE ) ? 'checked="checked" ' : '';
				}
				else
				{
					$prune_enabled = '';

					$prune_lock = $prune_move = '';
					$prune_del = 'checked="checked" ';
				}
				$prune_move_to = get_list('forum', ( isset($pr_row['move_to']) ) ? $pr_row['move_to'] : -1, true);
			}
Der Fehler tritt um den Zeilencode: $pr_row = $db->sql_fetchrow($pr_result); auf.

Der 2. Parse Error tritt hier auf /includes/prune.php

Code: Alles auswählen

// the auto_prune table and call the prune function with the necessary info.
//
function auto_prune($forum_id = 0)
{
	global $db, $lang;

	$sql = "SELECT *
		FROM " . PRUNE_TABLE . "
		WHERE forum_id = $forum_id";
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not read auto_prune table', '', __LINE__, __FILE__, $sql);
	}

	if ( $row = $db->sql_fetchrow($result) )
	{
		if ( $row['prune_freq'] && $row['prune_days'] )
		{
			$prune_date = time() - ( $row['prune_days'] * 86400 );
			$next_prune = time() + ( $row['prune_freq'] * 86400 );

			prune($forum_id, $prune_date);
			sync('forum', $forum_id);

			$sql = "UPDATE " . FORUMS_TABLE . " 
				SET prune_next = $next_prune 
				WHERE forum_id = $forum_id";
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not update forum table', '', __LINE__, __FILE__, $sql);
			}
		}
	}

	return;
}

?>
Lustigerweise tritt der fehler bei ?> auf und ich find ihn einfach nicht.[/quote]
Benutzeravatar
Markus67
Ehrenadmin
Beiträge: 28346
Registriert: 12.01.2004 16:02
Wohnort: Neuss
Kontaktdaten:

Beitrag von Markus67 »

Hi Obstel,

kannst du denn mal bitte die genaue Fehlermeldung posten ...

und die beiden Dateien als txt-Datei verlinken ...

Markus
Benutzeravatar
QCO
Mitglied
Beiträge: 708
Registriert: 15.03.2003 12:30
Wohnort: Leipzig

Beitrag von QCO »

Also 100% kann ich dir auch nicht helfen, aber folgendes

$prune_loc$prune_lock = ( $pr_row['prune_type'] == PRUNE_LOCK ) ? 'checked="checked" ' : '';

ist auf jeden Fall falsch.
An der von dir hier zitierten Funktion ändert der Mod nichts.

Ich muss jetzt leider erstmal wieder in die Schule... ich schau heute Abend nochmal-
Schnelle direkte Hilfe? Modeinbau? Umfassender, persönlicher Support? Ein individuelles Design/Template?
Ich bin käuflich und löse zu kleinen Preisen Deine Probleme. Anfragen bitte per PN oder Mail.
Obstel
Mitglied
Beiträge: 54
Registriert: 29.04.2004 10:05
Kontaktdaten:

Beitrag von Obstel »

jup, kein thema

danke für den ersten Fehlerhinweis, muss wohl bisl blind gewesen sein, so einen offensichtlichen fehler zu übersehen.

es sind beides parse errors, also reine tippfehler nehme ich an, doch alle änderungen führten nicht zum erfolg.

die textdateien, die ich gelinkt hab, waren die originaldateien, mit dem erstversuch der installation von deinem mod.


1. Fehlermeldung, wenn ich im ACP auf autom. Löschen gehe: Parse error: parse error in /var/www/web2/html/phpBB2/includes/prune.php on line 218

http://www.freelancerfan.de/prune.txt
Benutzeravatar
Markus67
Ehrenadmin
Beiträge: 28346
Registriert: 12.01.2004 16:02
Wohnort: Neuss
Kontaktdaten:

Beitrag von Markus67 »

Hi ...

fangen wir mal an mit der admin_forums.php

suche:

Code: Alles auswählen

					$prune_loc$prune_lock = ( $pr_row['prune_type'] == PRUNE_LOCK ) ? 'checked="checked" ' : '';
ersetze mit:

Code: Alles auswählen

					$prune_lock = ( $pr_row['prune_type'] == PRUNE_LOCK ) ? 'checked="checked" ' : '';
und dann noch die Leerzeilen ganz am Schluss raus ....
nach diesem Zeichen ...
Die prune.php speicherst du dir ab als Sicherungskopie ....

Ersetze die komplette prune.php mit diesem Code hier:


Code: Alles auswählen

<?php
/***************************************************************************
*                                 prune.php
*                            -------------------
*   begin                : Thursday, June 14, 2001
*   copyright            : (C) 2001 The phpBB Group
*   email                : support@phpbb.com
*
*   $Id: prune.php,v 1.19.2.6 2003/03/18 23:23:57 acydburn Exp $
*
*
***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

if ( !defined('IN_PHPBB') )
{
   die("Hacking attempt");
}

require($phpbb_root_path . 'includes/functions_search.'.$phpEx);

function prune($forum_id, $prune_date, $prune_all = false)
{
	global $db, $lang;

	$sql = "SELECT *
		FROM " . PRUNE_TABLE . "
		WHERE forum_id = $forum_id";
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not read auto_prune table', '', __LINE__, __FILE__, $sql);
	}

	$row = $db->sql_fetchrow($result);

	$prune_type = ( $prune_all ) ? PRUNE_DELETE : $row['prune_type'];
	$move_to = $row['move_to'];

	$prune_all = ($prune_all) ? '' : 'AND t.topic_vote = 0 AND t.topic_type <> ' . POST_ANNOUNCE;
	//
	// Those without polls and announcements ... unless told otherwise!
	//
	$sql = "SELECT t.topic_id 
		FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t
		WHERE t.forum_id = $forum_id
			$prune_all 
			AND ( p.post_id = t.topic_last_post_id 
				OR t.topic_last_post_id = 0 )";
	if ( $prune_date != '' )
	{
		$sql .= " AND p.post_time < $prune_date";
	}

	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not obtain lists of topics to prune', '', __LINE__, __FILE__, $sql);
	}

	$sql_topics = '';
	while( $row = $db->sql_fetchrow($result) )
	{
		$sql_topics .= ( ( $sql_topics != '' ) ? ', ' : '' ) . $row['topic_id'];
	}
	$db->sql_freeresult($result);
		
	if( $sql_topics != '' )
	{
		if ( $prune_type == PRUNE_MOVE || $prune_type == PRUNE_LOCK )
		{
			$move_sql = ( $prune_type == PRUNE_MOVE ) ? "forum_id = $move_to," : '';

			$sql = "UPDATE " . TOPICS_TABLE . "
				SET $move_sql topic_status = " . TOPIC_LOCKED . "
				WHERE forum_id = $forum_id
					AND topic_id IN ($sql_topics)";
			if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
			{
				message_die(GENERAL_ERROR, 'Could not move/lock topics during prune', '', __LINE__, __FILE__, $sql);
			}

			$pruned_topics = $db->sql_affectedrows();
            
			if ( $prune_type == PRUNE_MOVE )
			{
                $sql = "UPDATE " . POSTS_TABLE . "
                    SET forum_id = $move_to
                    WHERE forum_id = $forum_id
                        AND topic_id IN ($sql_topics)";
                if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
                {
                    message_die(GENERAL_ERROR, 'Could not move posts during prune', '', __LINE__, __FILE__, $sql);
                }

                $pruned_posts = $db->sql_affectedrows();

				sync('forum', $move_to);
			}

            return array ('topics' => $pruned_topics, 'posts' => $pruned_posts);
		}
		else
		{
            $sql = "SELECT post_id
                FROM " . POSTS_TABLE . "
                WHERE forum_id = $forum_id
                    AND topic_id IN ($sql_topics)";
            if ( !($result = $db->sql_query($sql)) )
            {
                message_die(GENERAL_ERROR, 'Could not obtain list of posts to prune', '', __LINE__, __FILE__, $sql);
            }

            $sql_post = '';
            while ( $row = $db->sql_fetchrow($result) )
            {
                $sql_post .= ( ( $sql_post != '' ) ? ', ' : '' ) . $row['post_id'];
            }
            $db->sql_freeresult($result);

            if ( $sql_post != '' )
            {
                $sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "
                    WHERE topic_id IN ($sql_topics)";
                if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
                {
                    message_die(GENERAL_ERROR, 'Could not delete watched topics during prune', '', __LINE__, __FILE__, $sql);
                }

                $sql = "DELETE FROM " . TOPICS_TABLE . "
                    WHERE topic_id IN ($sql_topics)";
                if ( !$db->sql_query($sql) )
                {
                    message_die(GENERAL_ERROR, 'Could not delete topics during prune', '', __LINE__, __FILE__, $sql);
                }

                $pruned_topics = $db->sql_affectedrows();

                $sql = "DELETE FROM " . POSTS_TABLE . "
                    WHERE post_id IN ($sql_post)";
                if ( !$db->sql_query($sql) )
                {
                    message_die(GENERAL_ERROR, 'Could not delete post_text during prune', '', __LINE__, __FILE__, $sql);
                }

                $pruned_posts = $db->sql_affectedrows();

                $sql = "DELETE FROM " . POSTS_TEXT_TABLE . "
                    WHERE post_id IN ($sql_post)";
                if ( !$db->sql_query($sql) )
                {
                    message_die(GENERAL_ERROR, 'Could not delete post during prune', '', __LINE__, __FILE__, $sql);
                }

                remove_search_post($sql_post);

                return array ('topics' => $pruned_topics, 'posts' => $pruned_posts);
            }
    	}
		}
	}

	return array('topics' => 0, 'posts' => 0);
}

//
// Function auto_prune(), this function will read the configuration data from
// the auto_prune table and call the prune function with the necessary info.
//
function auto_prune($forum_id = 0)
{
	global $db, $lang;

	$sql = "SELECT *
		FROM " . PRUNE_TABLE . "
		WHERE forum_id = $forum_id";
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not read auto_prune table', '', __LINE__, __FILE__, $sql);
	}

	if ( $row = $db->sql_fetchrow($result) )
	{
		if ( $row['prune_freq'] && $row['prune_days'] )
		{
			$prune_date = time() - ( $row['prune_days'] * 86400 );
			$next_prune = time() + ( $row['prune_freq'] * 86400 );

			prune($forum_id, $prune_date);
			sync('forum', $forum_id);

			$sql = "UPDATE " . FORUMS_TABLE . " 
				SET prune_next = $next_prune 
				WHERE forum_id = $forum_id";
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not update forum table', '', __LINE__, __FILE__, $sql);
			}
		}
	}

	return;
}

?>
So jetzt müsste alles klappen :-)

Markus
Obstel
Mitglied
Beiträge: 54
Registriert: 29.04.2004 10:05
Kontaktdaten:

Beitrag von Obstel »

jap hat alles soweit geklappt, nur noch ein fehler in zeile 170, ich nehme an eine } zuviel ?
Benutzeravatar
Markus67
Ehrenadmin
Beiträge: 28346
Registriert: 12.01.2004 16:02
Wohnort: Neuss
Kontaktdaten:

Beitrag von Markus67 »

Hi ....

wo in der prune.php ?

Versuchs einfach mal :D

Markus
Obstel
Mitglied
Beiträge: 54
Registriert: 29.04.2004 10:05
Kontaktdaten:

Beitrag von Obstel »

nach return array ('topics' => $pruned_topics, 'posts' => $pruned_posts);

Code: Alles auswählen

<?php
/***************************************************************************
*                                 prune.php
*                            -------------------
*   begin                : Thursday, June 14, 2001
*   copyright            : (C) 2001 The phpBB Group
*   email                : support@phpbb.com
*
*   $Id: prune.php,v 1.19.2.6 2003/03/18 23:23:57 acydburn Exp $
*
*
***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

if ( !defined('IN_PHPBB') )
{
   die("Hacking attempt");
}

require($phpbb_root_path . 'includes/functions_search.'.$phpEx);

function prune($forum_id, $prune_date, $prune_all = false)
{
   global $db, $lang;

   $sql = "SELECT *
      FROM " . PRUNE_TABLE . "
      WHERE forum_id = $forum_id";
   if ( !($result = $db->sql_query($sql)) )
   {
      message_die(GENERAL_ERROR, 'Could not read auto_prune table', '', __LINE__, __FILE__, $sql);
   }

   $row = $db->sql_fetchrow($result);

   $prune_type = ( $prune_all ) ? PRUNE_DELETE : $row['prune_type'];
   $move_to = $row['move_to'];

   $prune_all = ($prune_all) ? '' : 'AND t.topic_vote = 0 AND t.topic_type <> ' . POST_ANNOUNCE;
   //
   // Those without polls and announcements ... unless told otherwise!
   //
   $sql = "SELECT t.topic_id
      FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t
      WHERE t.forum_id = $forum_id
         $prune_all
         AND ( p.post_id = t.topic_last_post_id
            OR t.topic_last_post_id = 0 )";
   if ( $prune_date != '' )
   {
      $sql .= " AND p.post_time < $prune_date";
   }

   if ( !($result = $db->sql_query($sql)) )
   {
      message_die(GENERAL_ERROR, 'Could not obtain lists of topics to prune', '', __LINE__, __FILE__, $sql);
   }

   $sql_topics = '';
   while( $row = $db->sql_fetchrow($result) )
   {
      $sql_topics .= ( ( $sql_topics != '' ) ? ', ' : '' ) . $row['topic_id'];
   }
   $db->sql_freeresult($result);
      
   if( $sql_topics != '' )
   {
      if ( $prune_type == PRUNE_MOVE || $prune_type == PRUNE_LOCK )
      {
         $move_sql = ( $prune_type == PRUNE_MOVE ) ? "forum_id = $move_to," : '';

         $sql = "UPDATE " . TOPICS_TABLE . "
            SET $move_sql topic_status = " . TOPIC_LOCKED . "
            WHERE forum_id = $forum_id
               AND topic_id IN ($sql_topics)";
         if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
         {
            message_die(GENERAL_ERROR, 'Could not move/lock topics during prune', '', __LINE__, __FILE__, $sql);
         }

         $pruned_topics = $db->sql_affectedrows();
           
         if ( $prune_type == PRUNE_MOVE )
         {
                $sql = "UPDATE " . POSTS_TABLE . "
                    SET forum_id = $move_to
                    WHERE forum_id = $forum_id
                        AND topic_id IN ($sql_topics)";
                if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
                {
                    message_die(GENERAL_ERROR, 'Could not move posts during prune', '', __LINE__, __FILE__, $sql);
                }

                $pruned_posts = $db->sql_affectedrows();

            sync('forum', $move_to);
         }

            return array ('topics' => $pruned_topics, 'posts' => $pruned_posts);
      }
      else
      {
            $sql = "SELECT post_id
                FROM " . POSTS_TABLE . "
                WHERE forum_id = $forum_id
                    AND topic_id IN ($sql_topics)";
            if ( !($result = $db->sql_query($sql)) )
            {
                message_die(GENERAL_ERROR, 'Could not obtain list of posts to prune', '', __LINE__, __FILE__, $sql);
            }

            $sql_post = '';
            while ( $row = $db->sql_fetchrow($result) )
            {
                $sql_post .= ( ( $sql_post != '' ) ? ', ' : '' ) . $row['post_id'];
            }
            $db->sql_freeresult($result);

            if ( $sql_post != '' )
            {
                $sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "
                    WHERE topic_id IN ($sql_topics)";
                if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
                {
                    message_die(GENERAL_ERROR, 'Could not delete watched topics during prune', '', __LINE__, __FILE__, $sql);
                }

                $sql = "DELETE FROM " . TOPICS_TABLE . "
                    WHERE topic_id IN ($sql_topics)";
                if ( !$db->sql_query($sql) )
                {
                    message_die(GENERAL_ERROR, 'Could not delete topics during prune', '', __LINE__, __FILE__, $sql);
                }

                $pruned_topics = $db->sql_affectedrows();

                $sql = "DELETE FROM " . POSTS_TABLE . "
                    WHERE post_id IN ($sql_post)";
                if ( !$db->sql_query($sql) )
                {
                    message_die(GENERAL_ERROR, 'Could not delete post_text during prune', '', __LINE__, __FILE__, $sql);
                }

                $pruned_posts = $db->sql_affectedrows();

                $sql = "DELETE FROM " . POSTS_TEXT_TABLE . "
                    WHERE post_id IN ($sql_post)";
                if ( !$db->sql_query($sql) )
                {
                    message_die(GENERAL_ERROR, 'Could not delete post during prune', '', __LINE__, __FILE__, $sql);
                }

                remove_search_post($sql_post);

                return array ('topics' => $pruned_topics, 'posts' => $pruned_posts);
            }
       }
      
   }

   return array('topics' => 0, 'posts' => 0);
}

//
// Function auto_prune(), this function will read the configuration data from
// the auto_prune table and call the prune function with the necessary info.
//
function auto_prune($forum_id = 0)
{
   global $db, $lang;

   $sql = "SELECT *
      FROM " . PRUNE_TABLE . "
      WHERE forum_id = $forum_id";
   if ( !($result = $db->sql_query($sql)) )
   {
      message_die(GENERAL_ERROR, 'Could not read auto_prune table', '', __LINE__, __FILE__, $sql);
   }

   if ( $row = $db->sql_fetchrow($result) )
   {
      if ( $row['prune_freq'] && $row['prune_days'] )
      {
         $prune_date = time() - ( $row['prune_days'] * 86400 );
         $next_prune = time() + ( $row['prune_freq'] * 86400 );

         prune($forum_id, $prune_date);
         sync('forum', $forum_id);

         $sql = "UPDATE " . FORUMS_TABLE . "
            SET prune_next = $next_prune
            WHERE forum_id = $forum_id";
         if ( !$db->sql_query($sql) )
         {
            message_die(GENERAL_ERROR, 'Could not update forum table', '', __LINE__, __FILE__, $sql);
         }
      }
   }

   return;
}

?> 
das ist nun die richtige prune.php

danke vielmals für die unterstützung.
Zuletzt geändert von Obstel am 29.04.2004 14:55, insgesamt 1-mal geändert.
Benutzeravatar
Markus67
Ehrenadmin
Beiträge: 28346
Registriert: 12.01.2004 16:02
Wohnort: Neuss
Kontaktdaten:

Beitrag von Markus67 »

Hi ...

suche in der prune.php

Code: Alles auswählen

    return array('topics' => 0, 'posts' => 0); 
} 

// 
// Function auto_prune(), this function will read the configuration data from 
// the auto_prune table and call the prune function with the necessary info. 
die geschweifte Klammer rausnehmen ....

Markus
Antworten

Zurück zu „phpBB 2.0: Mod Support“