Advanced PN-Mod rückgängig machen
Verfasst: 23.08.2004 17:43
Hi folks,
wer kann mir helfen .....
ich habe seit einiger Zeit folgenden Mod am laufen , der nun probleme macht:
Ich möchte ihn wieder ausbauen , da es kein Support hierfür gibt und
er nicht aus den Kinderschuhe kommt.
Beim einbau gab es dieses Tool , was ich nun anders rum benötige.
Da war der Hacken mit PHP bin ich nicht so bewandert und evt. kann mir hier jemand helfen.
Gruß in die Runde Jörg
wer kann mir helfen .....
ich habe seit einiger Zeit folgenden Mod am laufen , der nun probleme macht:
Code: Alles auswählen
##############################################################
## MOD Title: Advanced Private Messages
## MOD Author: Ptirhiik < ptirhiik@clanmckeen.com > (Pierre) http://rpgnet.clanmckeen.com
## MOD Description:
## This mod brings a new private message system
## MOD Version: 0.0.6 - beta
##
## Installation Level: Easy
## Installation Time: 15 Minutes
## Files To Edit:
er nicht aus den Kinderschuhe kommt.
Beim einbau gab es dieses Tool , was ich nun anders rum benötige.
Da war der Hacken mit PHP bin ich nicht so bewandert und evt. kann mir hier jemand helfen.
Gruß in die Runde Jörg
Code: Alles auswählen
<?php
/***************************************************************************
* upgrade_to_privmsga.php
* -----------------------
* begin : 04/12/2003
* copyright : Ptirhiik
* email : ptirhiik@clanmckeen.com
*
* version : 0.0.3
*
***************************************************************************/
/***************************************************************************
*
* 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);
define('IN_PRIVMSG', 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_PRIVMSGS);
init_userprefs($userdata);
//
// End session management
//
// only admin
if ( !$userdata['session_logged_in'] || ($userdata['user_level'] != ADMIN) )
{
message_die(CRITICAL_MESSAGE, $lang['Not_authorized']);
}
function a($key)
{
global $privmsg;
return str_replace('\"', '"', str_replace("\'", "''", addslashes(stripslashes($privmsg[$key]))));
}
function n($key)
{
global $privmsg;
return intval($privmsg[$key]);
}
// process
$sql = "SELECT p.*, pt.*
FROM " . PRIVMSGS_TABLE . " p, " . PRIVMSGS_TEXT_TABLE . " pt
WHERE pt.privmsgs_text_id = p.privmsgs_id
ORDER BY p.privmsgs_date";
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not query private message informations', '', __LINE__, __FILE__, $sql);
}
while ( $privmsg = $db->sql_fetchrow($result) )
{
echo "*" . $privmsg['privmsgs_id'];
// message already processed ?
$sql = "SELECT *
FROM " . PRIVMSGA_TABLE . " p, " . PRIVMSGA_RECIPS_TABLE . " pr, " . PRIVMSGA_RECIPS_TABLE . " pa
WHERE p.privmsg_time = " . n('privmsgs_date') . "
AND pr.privmsg_id = p.privmsg_id
AND pa.privmsg_id = p.privmsg_id
AND pa.privmsg_user_id = " . n('privmsgs_from_userid') . " AND pa.privmsg_direct = 0
AND pr.privmsg_user_id = " . n('privmsgs_to_userid') . " AND pr.privmsg_direct = 1
AND p.privmsg_subject = '" . a('privmsgs_subject') . "'
AND p.privmsg_bbcode_uid = '" . a('privmsgs_bbcode_uid') . "'";
if ( !$wresult = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not check the exitence of the pm', '', __LINE__, __FILE__, $sql);
}
if ( !$row = $db->sql_fetchrow($wresult) )
{
// the pm doesn't exists yet
$sql = "SELECT p.privmsgs_type, p.privmsgs_id
FROM " . PRIVMSGS_TABLE . " p
WHERE p.privmsgs_date = " . n('privmsgs_date') . "
AND p.privmsgs_subject = '" . a('privmsgs_subject') . "'
AND p.privmsgs_from_userid = " . n('privmsgs_from_userid') . "
AND p.privmsgs_to_userid = " . n('privmsgs_to_userid');
if ( !$wresult = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not check the exitence of the pm', '', __LINE__, __FILE__, $sql);
}
$types = array();
$ids = array();
while ( $row = $db->sql_fetchrow($wresult) )
{
$types[] = $row['privmsgs_type'];
$ids[] = $row['privmsgs_id'];
}
// types
$box_aut = 0;
$box_rec = 0;
$sts_aut = 0;
$sts_rec = 0;
$read_aut = 0;
$read_rec = 0;
for ( $i = 0; $i < count($types); $i++ )
{
switch ( $types[$i] )
{
case PRIVMSGS_NEW_MAIL:
$box_rec = INBOX;
$sts_rec = STS_TRANSIT;
$read_rec = NEW_MAIL;
if ( count($types) < 2 )
{
$box_aut = OUTBOX;
$sts_aut = STS_TRANSIT;
$read_aut = NEW_MAIL;
}
break;
case PRIVMSGS_UNREAD_MAIL:
$box_rec = INBOX;
$sts_rec = STS_TRANSIT;
$read_rec = UNREAD_MAIL;
if ( count($types) < 2 )
{
$box_aut = OUTBOX;
$sts_aut = STS_TRANSIT;
$read_aut = UNREAD_MAIL;
}
break;
case PRIVMSGS_READ_MAIL:
$box_rec = INBOX;
$sts_rec = STS_TRANSIT;
$read_rec = READ_MAIL;
if ( count($types) < 2 )
{
$box_aut = OUTBOX;
$sts_aut = STS_DELETED;
$read_aut = READ_MAIL;
}
break;
case PRIVMSGS_SENT_MAIL:
$box_aut = SENTBOX;
$sts_aut = STS_TRANSIT;
$read_aut = READ_MAIL;
if ( count($types) < 2 )
{
$box_rec = INBOX;
$sts_rec = STS_DELETED;
$read_rec = READ_MAIL;
}
break;
case PRIVMSGS_SAVED_IN_MAIL:
$box_rec = SAVEBOX;
$sts_rec = STS_SAVED;
$read_rec = READ_MAIL;
if ( count($types) < 2 )
{
$box_aut = SENTBOX;
$sts_aut = STS_DELETED;
$read_aut = READ_MAIL;
}
break;
case PRIVMSGS_SAVED_OUT_MAIL:
$box_aut = SAVEBOX;
$sts_aut = STS_SAVED;
$read_aut = READ_MAIL;
if ( count($types) < 2 )
{
$box_rec = INBOX;
$sts_rec = STS_DELETED;
$read_rec = READ_MAIL;
}
break;
}
}
// generate a copy of the message
$sql = "INSERT INTO " . PRIVMSGA_TABLE . "
(
privmsg_subject, privmsg_text, privmsg_bbcode_uid, privmsg_time,
privmsg_enable_bbcode, privmsg_enable_html, privmsg_enable_smilies, privmsg_attach_sig
)
VALUES(
'" . a('privmsgs_subject') . "', '" . a('privmsgs_text') . "', '" . a('privmsgs_bbcode_uid') . "', " . n('privmsgs_date') . ", " .
n('privmsgs_enable_bbcode') . ", " . n('privmsg_enable_html') . ", " . n('privmsg_enable_smilies') . ", " . n('privmsg_attach_sig') . "
)";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could insert pm text', '', __LINE__, __FILE__, $sql);
}
$privmsg_id = $db->sql_nextid();
echo "-";
// author
$wbox_aut = $box_aut;
$wsts_aut = $sts_aut;
$wread_aut = $read_aut;
if ( ($sts_rec == STS_SAVED) || empty($sts_aut) )
{
$wbox_aut = OUTBOX;
$wsts_aut = STS_DELETED;
$wread_aut = READ_MAIL;
}
$sql = "INSERT INTO " . PRIVMSGA_RECIPS_TABLE . "
(
privmsg_id, privmsg_direct, privmsg_user_id, privmsg_ip, privmsg_distrib,
privmsg_folder_id, privmsg_read, privmsg_status
)
VALUES(
$privmsg_id, 0, " . n('privmsgs_from_userid') . ", '" . a('privmsgs_ip') . "', 1, " .
$wbox_aut . ", " . $wread_aut . ", " . $wsts_aut . "
)";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could insert pm author', '', __LINE__, __FILE__, $sql);
}
echo ".";
// recipient
$wbox_rec = $box_rec;
$wsts_rec = $sts_rec;
$wread_rec = $read_rec;
if ( ($sts_aut == STS_SAVED) || empty($sts_aut) )
{
$wbox_rec = INBOX;
$wsts_rec = STS_DELETED;
$wread_rec = READ_MAIL;
}
$sql = "INSERT INTO " . PRIVMSGA_RECIPS_TABLE . "
(
privmsg_id, privmsg_direct, privmsg_user_id, privmsg_ip, privmsg_distrib,
privmsg_folder_id, privmsg_read, privmsg_status
)
VALUES(
$privmsg_id, 1, " . n('privmsgs_to_userid') . ", '" . a('privmsgs_ip') . "', 1, " .
$wbox_rec . ", " . $wread_rec . ", " . $wsts_rec . "
)";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could insert pm recipient', '', __LINE__, __FILE__, $sql);
}
echo ".";
// the message generated was a saved one : is there a living one ?
if (($sts_rec != $sts_aut) && ( (($sts_rec == STS_SAVED) && !empty($sts_aut)) || (($sts_aut == STS_SAVED) && !empty($sts_aut)) ))
{
// generate a new copy of the message
$sql = "INSERT INTO " . PRIVMSGA_TABLE . "
(
privmsg_subject, privmsg_text, privmsg_bbcode_uid, privmsg_time,
privmsg_enable_bbcode, privmsg_enable_html, privmsg_enable_smilies, privmsg_attach_sig
)
VALUES(
'" . a('privmsgs_subject') . "', '" . a('privmsgs_text') . "', '" . a('privmsgs_bbcode_uid') . "', " . n('privmsgs_date') . ", " .
n('privmsgs_enable_bbcode') . ", " . n('privmsg_enable_html') . ", " . n('privmsg_enable_smilies') . ", " . n('privmsg_attach_sig') . "
)";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could insert pm text', '', __LINE__, __FILE__, $sql);
}
$privmsg_id = $db->sql_nextid();
echo "-";
// author
$wbox_aut = $box_aut;
$wsts_aut = $sts_aut;
$wread_aut = $read_aut;
if ( $sts_auth == STS_SAVED )
{
$wbox_aut = OUTBOX;
$wsts_aut = STS_DELETED;
$wread_aut = READ_MAIL;
}
$sql = "INSERT INTO " . PRIVMSGA_RECIPS_TABLE . "
(
privmsg_id, privmsg_direct, privmsg_user_id, privmsg_ip, privmsg_distrib,
privmsg_folder_id, privmsg_read, privmsg_status
)
VALUES(
$privmsg_id, 0, " . n('privmsgs_from_userid') . ", '" . a('privmsgs_ip') . "', 1, " .
$wbox_aut . ", " . $wread_aut . ", " . $wsts_aut . "
)";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could insert pm author', '', __LINE__, __FILE__, $sql);
}
echo ".";
// recipient
$wbox_rec = $box_rec;
$wsts_rec = $sts_rec;
$wread_rec = $read_rec;
if ( $sts_rec == STS_SAVED )
{
$wbox_rec = INBOX;
$wsts_rec = STS_DELETED;
$wread_rec = READ_MAIL;
}
$sql = "INSERT INTO " . PRIVMSGA_RECIPS_TABLE . "
(
privmsg_id, privmsg_direct, privmsg_user_id, privmsg_ip, privmsg_distrib,
privmsg_folder_id, privmsg_read, privmsg_status
)
VALUES(
$privmsg_id, 1, " . n('privmsgs_to_userid') . ", '" . a('privmsgs_ip') . "', 1, " .
$wbox_rec . ", " . $wread_rec . ", " . $wsts_rec . "
)";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could insert pm recipient', '', __LINE__, __FILE__, $sql);
}
echo ".";
}
}
flush();
}
echo "<hr />process ended<hr />";
flush();
?>