Seite 1 von 1

Mach MOD-Einbau Fehlermeldungen

Verfasst: 15.10.2005 22:30
von DreamPromise
Moin moin

ich hab die MOD post_move_instead_deleting_1_0_0 eingebaut.

Code: Alles auswählen

##############################################################
## MOD Title:		Post move instead deleting
## MOD Author: oxpus < webmaster@oxpus.de > (Karsten Ude) http://www.oxpus.de
## MOD Description:	This mod will move posts to a hidden forum instead deleting them by an user or mod.
##			The admin can alltimes delete and mods if they are allowed to, too.
## MOD Version:		1.0.0
##
## Installation Level:	Intermediate
## Installation Time:	5-10 min
## Files To Edit:	7
##			admin/admin_boards.php
##			includes/functions_post.php
##			language/lang_german/lang_admin.php
##			language/lang_german/lang_main.php
##			templates/subSilver/admin/board_config_body.tpl
## Included Files:	n/a
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MODs not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
##############################################################
## Author Notes:
##
## Upload the file
## 		db_update.php
## to your phpbb root directory and run this with your browser.
## This file will do all nessassary changes in the database for you.
## After using this file, please delete it to avoid errors.
##
##############################################################
## MOD History:
##
##   2005-02-26 - Version 1.0.0
##	- History point
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ OPEN ]------------------------------------------
#
admin/admin_board.php

#
#-----[ FIND ]------------------------------------------
#
$namechange_yes = ( $new['allow_namechange'] ) ? "checked=\"checked\"" : "";
$namechange_no = ( !$new['allow_namechange'] ) ? "checked=\"checked\"" : "";

#
#-----[ AFTER, ADD ]------------------------------------------
#
$mod_allow_delete_post_yes = ( $new['mod_allow_delete_post'] ) ? "checked=\"checked\"" : "";
$mod_allow_delete_post_no = ( !$new['mod_allow_delete_post'] ) ? "checked=\"checked\"" : "";

#
#-----[ FIND ]------------------------------------------
#
	"L_RESET" => $lang['Reset'],

#
#-----[ AFTER, ADD ]------------------------------------------
#
	"L_DELETE_POST_FORUM" => $lang['Delete_post_forum'],
	"L_DELETE_POST_FORUM_EXPLAIN" => $lang['Delete_post_forum_explain'],
	"L_MOD_ALLOW_DELETE_POST" => $lang['Mod_allow_delete_post'],
	"L_MOD_ALLOW_DELETE_POST_EXPLAIN" => $lang['Mod_allow_delete_post_explain'],
	"DELETE_POST_FORUM" => $new['delete_post_forum'],
	"MOD_ALLOW_DELETE_POST_YES" => $mod_allow_delete_post_yes,
	"MOD_ALLOW_DELETE_POST_NO" => $mod_allow_delete_post_no,

#
#-----[ OPEN ]------------------------------------------
#
includes/functions_post.php

function delete_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id)
{
	global $board_config, $lang, $db, $phpbb_root_path, $phpEx;
	global $userdata, $user_ip;

#
#-----[ AFTER, ADD ]------------------------------------------
#
	if (intval($board_config['delete_post_forum']) != 0)
	{
		$sql = "SELECT * FROM " . FORUMS_TABLE . "
			WHERE forum_id = " . $board_config['delete_post_forum'];
		if (!$result = $db->sql_query($sql))
		{
			message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
		}
		$forum_count = $db->sql_numrows($result);
		$db->sql_freeresult($result);

		$forum_check = ($forum_count != 0) ? TRUE : 0;
	}
	else
	{
		$forum_check = 0;
	}

#
#-----[ FIND ]------------------------------------------
#
	if ($mode != 'poll_delete')
	{
		include($phpbb_root_path . 'includes/functions_search.'.$phpEx);

#
#-----[ AFTER, ADD ]------------------------------------------
#
		if (($userdata['user_level'] == ADMIN || ($userdata['user_level'] == MOD && $board_config['mod_allow_delete_post'] == 1)) && $forum_check == TRUE)
		{

#
#-----[ FIND ]------------------------------------------
#
		$sql = "DELETE FROM " . POSTS_TEXT_TABLE . "
			WHERE post_id = $post_id";
		if (!$db->sql_query($sql))
		{
			message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
		}

#
#-----[ AFTER, ADD ]------------------------------------------
#
		}
		else if ($post_data['first_post'] == '')
		{
			$sql = "INSERT INTO " . TOPICS_TABLE . "
				(forum_id, topic_title, topic_poster, topic_time, topic_views, topic_replies, topic_status, topic_vote, topic_type, topic_first_post_id, topic_last_post_id, topic_moved_id)
				VALUES (".$board_config['delete_post_forum'].", '".sprintf($lang['Deleted_post_from_topic'], $topic_id)."', ".$post_data['poster_id'].", ".time().", 0, 0, ".TOPIC_UNLOCKED.", 0, ".POST_NORMAL.", $post_id, $post_id, 0)";
			if (!$db->sql_query($sql))
			{
				message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
			}
			$new_topic_id = $db->sql_nextid();

			$sql = "UPDATE " . POSTS_TABLE . "
				SET topic_id = $new_topic_id, forum_id = ".$board_config['delete_post_forum']."
				WHERE post_id = $post_id";
			if (!$db->sql_query($sql))
			{
				message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
			}
		}

#
#-----[ FIND ]------------------------------------------
#
				$forum_update_sql .= ', forum_topics = forum_topics - 1';
				$sql = "DELETE FROM " . TOPICS_TABLE . "
					WHERE topic_id = $topic_id
						OR topic_moved_id = $topic_id";
				if (!$db->sql_query($sql))
				{
					message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
				}

#
#-----[ REPLACE WITH ]------------------------------------------
#
				if (($userdata['user_level'] == ADMIN || ($userdata['user_level'] == MOD && $board_config['mod_allow_delete_post'] == 1)) && $forum_check == TRUE)
				{
					$sql = "DELETE FROM " . TOPICS_TABLE . "
						WHERE topic_id = $topic_id
							OR topic_moved_id = $topic_id";
					if (!$db->sql_query($sql))
					{
						message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
					}
				}
				else
				{
					$sql = "UPDATE " . TOPICS_TABLE . "
						SET forum_id = " . $board_config['delete_post_forum'] . "
						WHERE topic_id = $topic_id";
					if (!$db->sql_query($sql))
					{
						message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
					}

					$sql = "UPDATE " . POSTS_TABLE . "
						SET forum_id = " . $board_config['delete_post_forum'] . "
						WHERE topic_id = $topic_id";
					if ( !$db->sql_query($sql) )
					{
						message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
					}
				}

#
#-----[ OPEN ]------------------------------------------
#
language/lang_german/lang_main.php

#
#-----[ FIND ]------------------------------------------
#
?>

#
#-----[ FIND ]------------------------------------------
#
$lang['Deleted_post_from_topic'] = 'Gelöschter Beitrag von Topic-ID %s';

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/board_config_body.tpl

#
#-----[ FIND ]------------------------------------------
#
	<tr>
		<td class="row1">{L_ENABLE_PRUNE}</td>
		<td class="row2"><input type="radio" name="prune_enable" value="1" {PRUNE_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="prune_enable" value="0" {PRUNE_NO} /> {L_NO}</td>
	</tr>

#
#-----[ AFTER, ADD ]------------------------------------------
#
	<tr>
		<td class="row1">{L_DELETE_POST_FORUM}<br /><span class="gensmall">{L_DELETE_POST_FORUM_EXPLAIN}</span></td>
		<td class="row2"><input type="text" class="post" name="delete_post_forum" size="4" maxlength="4" value="{DELETE_POST_FORUM}" /></td>
	</tr>
	<tr>
		<td class="row1">{L_MOD_ALLOW_DELETE_POST}<br /><span class="gensmall">{L_MOD_ALLOW_DELETE_POST_EXPLAIN}</span></td>
		<td class="row2"><input type="radio" name="mod_allow_delete_post" value="1" {MOD_ALLOW_DELETE_POST_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="mod_allow_delete_post" value="0" {MOD_ALLOW_DELETE_POST_NO} /> {L_NO}</td>
	</tr>


#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Und bekommen eine Fehlermeldung wenn ich einen neuer Beitrag schreiben will.

if (intval($board_config['delete_post_forum']) != 0) { $sql = "SELECT * FROM " . FORUMS_TABLE . " WHERE forum_id = " . $board_config['delete_post_forum']; if (!$result = $db->sql_query($sql)) { message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql); } $forum_count = $db->sql_numrows($result); $db->sql_freeresult($result); $forum_check = ($forum_count != 0) ? TRUE : 0; } else { $forum_check = 0; }
Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/w0056704/includes/functions_post.php:12) in /www/htdocs/w0056704/includes/page_header.php on line 537

Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/w0056704/includes/functions_post.php:12) in /www/htdocs/w0056704/includes/page_header.php on line 539

Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/w0056704/includes/functions_post.php:12) in /www/htdocs/w0056704/includes/page_header.php on line 540
Wenn ich aber die DB-Update starte

Code: Alles auswählen

<?php
/***************************************************************************
 *                               db_update.php
 *                            -------------------
 *
 *   copyright            : ©2003 Freakin' Booty ;-P & Antony Bailey
 *   project              : http://sourceforge.net/projects/dbgenerator
 *   Website              : http://freakingbooty.no-ip.com/ & http://www.rapiddr3am.net
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   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.
 *
 ***************************************************************************/

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//


if( !$userdata['session_logged_in'] )
{
	$header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
	header($header_location . append_sid("login.$phpEx?redirect=db_update.$phpEx", true));
	exit;
}

if( $userdata['user_level'] != ADMIN )
{
	message_die(GENERAL_MESSAGE, 'You are not authorised to access this page');
}


$page_title = 'Updating the database';
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

echo '<table width="100%" cellspacing="1" cellpadding="2" border="0" class="forumline">';
echo '<tr><th>Updating the database</th></tr><tr><td><span class="genmed"><ul type="circle">';


$sql = array();
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('delete_post_forum', '0')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('mod_allow_delete_post', '0')";

for( $i = 0; $i < count($sql); $i++ )
{
	if( !$result = $db->sql_query ($sql[$i]) )
	{
		$error = $db->sql_error();

		echo '<li>' . $sql[$i] . '<br /> +++ <font color="#FF0000"><b>Error:</b></font> ' . $error['message'] . '</li><br />';
	}
	else
	{
		echo '<li>' . $sql[$i] . '<br /> +++ <font color="#00AA00"><b>Successfull</b></font></li><br />';
	}
}


echo '</ul></span></td></tr><tr><td class="catBottom" height="28">&nbsp;</td></tr>';

echo '<tr><th>End</th></tr><tr><td><span class="genmed">Installation is now finished. Please be sure to delete this file now.<br />If you have run into any errors, please visit the <a href="http://www.phpbbsupport.co.uk" target="_phpbbsupport">phpBBSupport.co.uk</a> and ask someone for help.</span></td></tr>';
echo '<tr><td class="catBottom" height="28" align="center"><span class="genmed"><a href="' . append_sid("index.$phpEx") . '">Have a nice day</a></span></td></table>';

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>
kommt:

Code: Alles auswählen

Warning: main( extension.inc) [function.main]: failed to create stream: No such file or directory in /www/htdocs/w0056704/admin/mods/post_move_instead_deleting_1_0_0/db_update.php on line 23

Warning: main( extension.inc) [function.main]: failed to create stream: No such file or directory in /www/htdocs/w0056704/admin/mods/post_move_instead_deleting_1_0_0/db_update.php on line 23

Warning: main() [function.main]: Failed opening ' extension.inc' for inclusion (include_path='.:/usr/share/php:..') in /www/htdocs/w0056704/admin/mods/post_move_instead_deleting_1_0_0/db_update.php on line 23

Warning: main( common.) [function.main]: failed to create stream: No such file or directory in /www/htdocs/w0056704/admin/mods/post_move_instead_deleting_1_0_0/db_update.php on line 24

Warning: main( common.) [function.main]: failed to create stream: No such file or directory in /www/htdocs/w0056704/admin/mods/post_move_instead_deleting_1_0_0/db_update.php on line 24

Warning: main() [function.main]: Failed opening ' common.' for inclusion (include_path='.:/usr/share/php:..') in /www/htdocs/w0056704/admin/mods/post_move_instead_deleting_1_0_0/db_update.php on line 24

Fatal error: Call to undefined function: session_pagestart() in /www/htdocs/w0056704/admin/mods/post_move_instead_deleting_1_0_0/db_update.php on line 29
Habt ihr ne Idee wie ich das Problem lösen kann ???

Danke schon mal

DP

Verfasst: 15.10.2005 23:48
von fanrpg
liegt die db_update.php im Root Verzeichniss?

Verfasst: 15.10.2005 23:53
von DreamPromise
Moin moin

ok...Fehler gefunden...lag daran das die Datei nicht im Root lag...

Aber wenn ich nun ein Beitrag als Admin löschen will kommt folgendes:

Code: Alles auswählen

Error in deleting post

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE topic_id = 304' at line 3

UPDATE forum_topics SET forum_id = WHERE topic_id = 304

Line : 415
File : functions_post.php

/edit:

Aber der Beitrag wird gelöscht