phpbb2 Export users to MSN contact list

By.

min read

Share

I was asked the other day to create a hack for phpbb2 to export all current members to an MSN xml list.

This is the MSN syntax: ( save as ctt file )

[code:1:e02d936a34]<?xml version="1.0"?>
<messenger>
<service name=".NET Messenger Service">
<contactlist>
<contact>first_contact@some_domain.com</contact>
<contact>second_contact@some_domain.com</contact>
<contact>third_contact@some_domain.com</contact>
<contact>last_contact@some_domain.com</contact>
</contactlist>
</service>
</messenger>[/code:1:e02d936a34]

Here it is 🙂

[code:1:e02d936a34]<?php
/***************************************************************************
* phpbb_export_to_msn.php
* ——————-
* begin : 14, 10, 2007
* copyright : (C) Ramon Fincken
* website : http://www.websitefreelancers.nl http://www.ramonfincken.com
***************************************************************************/

/***************************************************************************
*
* 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);

include($phpbb_root_path . ‘includes/bbcode.’.$phpEx);
include($phpbb_root_path . ‘includes/functions_post.’.$phpEx);

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

//
// Lets build a page …
//
$page_title = ‘MSN ctt export by Ramon Fincken WebsiteFreelancers.nl RamonFincken.com’;
include($phpbb_root_path . ‘includes/page_header.’.$phpEx);
$message = ‘[code]
<?xml version="1.0"?>
<messenger>
<service name=".NET Messenger Service">
<contactlist>
‘;

$sql = ‘SELECT user_email FROM ‘ . USERS_TABLE.’ WHERE user_id <> ‘ . ANONYMOUS . ‘ ORDER BY user_email ASC’;
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, ‘Could not query users’, ”, __LINE__, __FILE__, $sql);
}

while ( $row = $db->sql_fetchrow($result) )
{
$message .= "<contact>".$row[’user_email’]."</contact>nr";
}
$db->sql_freeresult($result);

$message .= ‘
</contactlist>
</service>
</messenger>[/code]’;

$paypal = ‘https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=advertentie%40creativepulses%2enl&’;
$paypal .= ‘item_name=Phpbb2%20export%20to%20MSN%20contactlist&page_style=Primary&no_shipping=1&return=’;
$paypal .= ‘http%3a%2f%2fwww%2ephpbbantispam%2ecom%2fthankyou%2ephp&no_note=1&tax=0&currency_code=USD&lc=GB&bn=PP%2dDonationsBF&charset=UTF%2d8’;

echo ‘Provided by Ramon Fincken, Freelance programmer. <a href="http://www.websitefreelancers.nl" target="_blank">WebsiteFreelancers.nl</a> <a href="http://www.ramonfincken.com" target="_blank">RamonFincken.com</a> ‘;
echo ‘<a href="’.$paypal.’" target="_blank">Like this mod? Donate !</a><br/><br/>’;

echo bbencode_second_pass(bbencode_first_pass($message, ”),”);

include($phpbb_root_path . ‘includes/page_tail.’.$phpEx);

?>[/code:1:e02d936a34]

Leave a Reply

Your email address will not be published. Required fields are marked *