Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
alright well what ive been trying to in this php script is strip the bbcode off a message which i did successfully, and now im trying to strip the quote bbcode aswell as the quoted text, and only leave the rest of the message, so far ive been unsuccessful with the quoted message, but i have removed the quote bbcode please help i desperately need it.
NOTE: THERE ARE SOME TCL COLOR CODES IN HERE, BECAUSE THIS SCRIPT RELAYS THE DATA TO AN IRC EGGDROP SO PLEASE IGNORE THE COLOR CODES eg: /00309,01Code: Select all
<?php
$bb2egg['channel'] = "#zex";
$bb2egg['ids'] = "9 20 21 22 23 24 19";
$bb2egg['botip'] = "61.22.33.60";
$bb2egg['botport'] = "1337";
$bb2egg['boardurl'] = "http://teamzex.net/forum";
$bb2egg['pass'] = "password";
function send2egg($mode, $forumid, $topic_id, $user_id, $subject, $message, $poll_title, $forum_name, $post_id)
{
global $userdata, $bb2egg;
if ( check_id($forumid) == 0 )
{
return;
}
$nick = $userdata['username'];
$message = preg_replace("#\[(.*?)]#si", "", $message);
$message = str_replace('<br />', "\n", $message);
$message = str_replace('<center>', "", $message);
$message = str_replace("\n", "", $message);
$message = preg_replace('/\[quote="(.*?)"](.*?)quote]/','',$message);
if (strlen($message) > 50) { $text = substr($message,0,50)."..."; }
else { $text = $message; }
switch( $mode )
{
case 'newtopic':
if ( $poll_title != '' )
{
$text2 = "\00309,01\002[»]\00314,01\002 New Poll Started By:\00300,01\002 $nick\00314,01\002 in\00300,01\002 $forum_name \00309,01[«]\002<br>";
}
else {
$text2 = "\00309,01\002[»]\00314,01\002 New Topic Posted By: \00300,01\002 $nick \00309,01[«]\002<br>";
}
break;
case 'reply':
$text2 = "\002\00309,01[»]\00314,01\002 New Reply Posted By:\00300,01\002 $nick \00309,01[«]\002<br>";
break;
default:
break;
}
if ( $subject != '' )
{
$text2 .= "\002\00309,01[»]\002 \00314,01Subject:\002\00300,01 $subject \00309,01[«]\002 <br>";
$text2 .= "\002\00309,01[»]\002 \00314,01Message:\002\00300,01 $text \00309,01[«]\002 <br>";
}
else
{
$text2 .= "\002\00309,01[»]\002 \00314,01Message:\002\00300,01 $text \00309,01[«]\002<br>";
}
$text2 .= "\002\00309,01[»]\002 \00314,01Link:\00300,01\002 \00300,01" . $bb2egg['boardurl'] . "/viewtopic.php?t=$topic_id#$post_id \00309,01[«]\002";
if ( $message == "" ) {
$text2 = "";
}
phpbb2egg($text2);
}
function phpbb2egg($text)
{
global $bb2egg;
if ( $text == '') {
return;
}
$text = ereg_replace(";", ":", $text);
$text = ereg_replace("<br>", ";", $text);
$fp = fsockopen($bb2egg['botip'], $bb2egg['botport'], $errno, $errstr, 30);
if ($fp) {
fputs($fp, md5($bb2egg['pass']) ." ". $bb2egg['channel'] ." $text\n");
sleep(2);
fclose($fp);
}
}
function check_id($current)
{
global $bb2egg;
$forumids=explode(" ", $bb2egg['ids']);
while ( list($n, $id) = each($forumids))
{
if ($id == $current)
{
return 1;
}
}
return 0;
}
?>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]