Fehler in der functions_post.php

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.
Antworten
Benutzeravatar
Mihil
Mitglied
Beiträge: 1355
Registriert: 07.05.2005 20:09

Fehler in der functions_post.php

Beitrag von Mihil »

Ich habe soeben in mein Hauptforum den Willkommens Nachricht PN MOD eingebaut. (http://www.vitrax.org/dload.php?action=file&file_id=13)

Nun kommt beim Posten, bearbeiten, beim klick auf "Private Nachrichten" sowie bei der Eventliste folgender Fehler:

Code: Alles auswählen

Parse error: parse error, unexpected T_STRING in /home/www/web16/html/forum/includes/functions_post.php on line 157
Bei der Installation kam folgender Fehler, wahrscheinlich liegt es daran:


# DROP TABLE phpbb_wpm
+++ Error: Unknown table 'phpbb_wpm'

# CREATE TABLE phpbb_wpm (name varchar(255) NOT NULL default '', value text NOT NULL) TYPE=MyISAM
+++ Successfull

# INSERT INTO phpbb_wpm VALUES ('wpm_version', '1.0.8')
+++ Successfull

# INSERT INTO phpbb_wpm VALUES ('active_wpm', '1')
+++ Successfull

# INSERT INTO phpbb_wpm VALUES ('wpm_username', 'Anonymous')
+++ Successfull

# INSERT INTO phpbb_wpm VALUES ('wpm_userid', '-1')
+++ Successfull

# INSERT INTO phpbb_wpm VALUES ('wpm_subject', 'Welcome to [sitename]!')
+++ Successfull

# INSERT INTO phpbb_wpm VALUES ('wpm_message', 'Hi, there [username]!')
+++ Successfull





functions_post.php an der Stelle (Sorry, kann momentan nicht verlinken):

$unhtml_specialchars_match = array('#>#', '#<#', '#"#', '#&#');
$unhtml_specialchars_replace = array('>', '<', '"', '&');

//
// This function will prepare a posted message for

// entry into the database.
//

// start wpm
function wpm_send_pm($user_to_id, $wpm_subject, $wpm_message, $send_email)
{
global $board_config, $swpm_config, $lang, $db, $phpbb_root_path, $phpEx;

$sql = "SELECT *
FROM " . USERS_TABLE . "
WHERE user_id = " . $user_to_id . "
AND user_id <> " . ANONYMOUS;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, $lang['non_existing_user'], '', __LINE__, __FILE__, $sql);
}
$usertodata = $db->sql_fetchrow($result);

// prepare wpm message
$bbcode_uid = make_bbcode_uid();
$wpm_message = str_replace("'", "''", $wpm_message);

if(empty($wpm_message))
{
$wpm_message = $lang['No_entry_wpm'];
}
$wpm_message = prepare_message(trim($wpm_message), 0, 1, 1, $bbcode_uid);

$msg_time = time();

// Do inbox limit stuff
$sql = "SELECT COUNT(privmsgs_id) AS inbox_items, MIN(privmsgs_date) AS oldest_post_time
FROM " . PRIVMSGS_TABLE . "
WHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
OR privmsgs_type = " . PRIVMSGS_READ_MAIL . "
OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )
AND privmsgs_to_userid = " . $usertodata['user_id'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_MESSAGE, $lang['No_such_user']);
}

$sql_priority = ( SQL_LAYER == 'mysql' ) ? 'LOW_PRIORITY' : '';

if ( $inbox_info = $db->sql_fetchrow($result) )
{
if ( $inbox_info['inbox_items'] >= $board_config['max_inbox_privmsgs'] )
{
$sql = "DELETE $sql_priority FROM " . PRIVMSGS_TABLE . "
WHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
OR privmsgs_type = " . PRIVMSGS_READ_MAIL . "
OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )
AND privmsgs_date = " . $inbox_info['oldest_post_time'] . "
AND privmsgs_to_userid = " . $usertodata['user_id'];
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, $lang['not_delete_pm'], '', __LINE__, __FILE__, $sql);
}
}
}

$sql_info = "INSERT INTO " . PRIVMSGS_TABLE . " (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies, privmsgs_attach_sig)
VALUES (" . PRIVMSGS_NEW_MAIL . ", '" . str_replace("\'", "''", $wpm_subject) . "', " . $swpm_config['wpm_userid'] . ", " . $usertodata['user_id'] . ", $msg_time, '$user_ip', 0, 1, 1, 1)";

if ( !($result = $db->sql_query($sql_info, BEGIN_TRANSACTION)) )
{
message_die(GENERAL_ERROR, $lang['no_sent_pm_insert'], "", __LINE__, __FILE__, $sql_info);
}

$privmsg_sent_id = $db->sql_nextid();

$sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text)
VALUES ($privmsg_sent_id, '" . $bbcode_uid . "', '" . str_replace("\'", "''", $wpm_message) . "')";

if ( !$db->sql_query($sql, END_TRANSACTION) )
{
message_die(GENERAL_ERROR, $lang['no_sent_pm_insert'], "", __LINE__, __FILE__, $sql_info);
}

// Add to the users new pm counter
$sql = "UPDATE " . USERS_TABLE . "
SET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = '9999999999'
WHERE user_id = " . $usertodata['user_id'];
if ( !$status = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, $lang['no_sent_pm_insert'], '', __LINE__, __FILE__, $sql);
}

if ( $send_email && $usertodata['user_notify_pm'] && !empty($usertodata['user_email']) && $usertodata['user_active'] )
{
$email_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\r\n";

$script_name = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($board_config['script_path']));
$script_name = ( $script_name != '' ) ? $script_name . '/privmsg.'.$phpEx : 'privmsg.'.$phpEx;
$server_name = trim($board_config['server_name']);
$server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';
$server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/';

include($phpbb_root_path . 'includes/emailer.'.$phpEx);
$emailer = new emailer($board_config['smtp_delivery']);

$emailer->use_template('privmsg_notify', $usertodata['user_lang']);
$emailer->extra_headers($email_headers);
$emailer->email_address($usertodata['user_email']);
$emailer->set_subject(); //$lang['Notification_subject']

$emailer->assign_vars(array(
'USERNAME' => $usertodata['username'],
'SITENAME' => $board_config['sitename'],
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),

'U_INBOX' => $server_protocol . $server_name . $server_port . $script_name . '?folder=inbox')
);

$emailer->send();
$emailer->reset();
}

return;
}
// end wpm

modfunction prepare_message($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid = 0)
{
global $board_config, $html_entities_match, $html_entities_replace;

//
// Clean up the message
//
$message = trim($message);

if ($html_on)
{
$allowed_html_tags = split(',', $board_config['allow_html_tags']);

$end_html = 0;
$start_html = 1;
$tmp_message = '';
$message = ' ' . $message . ' ';

while ($start_html = strpos($message, '<', $start_html))
{
$tmp_message .= preg_replace($html_entities_match, $html_entities_replace, substr($message, $end_html + 1, ($start_html - $end_html - 1)));
Benutzeravatar
Mihil
Mitglied
Beiträge: 1355
Registriert: 07.05.2005 20:09

Beitrag von Mihil »

*push*
modbo
Mitglied
Beiträge: 451
Registriert: 10.12.2004 11:12

Beitrag von modbo »

# DROP TABLE phpbb_wpm
+++ Error: Unknown table 'phpbb_wpm'
Es sollte eine Tabelle gelöscht werden, die nicht existierte. Kein Problem.

Der Code in der functions_post.php ist nicht korrekt eingefügt
// end wpm
modfunction prepare_message($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid = 0)
{
global $board_config, $html_entities_match, $html_entities_replace;
Müsste so aussehen
// end wpm mod

//
// This function will prepare a posted message for
// entry into the database.
//
function prepare_message($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid = 0)
{
global $board_config, $html_entities_match, $html_entities_replace;
Kontrollier den Einbau noch einmal.
Antworten

Zurück zu „phpBB 2.0: Mod Support“