ICQ / AIM / EMAIL functions
| > Module written by Matt Mecham
| > Date started: 28th February 2002
|
| > Module Version Number: 1.0.0
+--------------------------------------------------------------------------
*/
$idx = new Contact;
class Contact {
var $output = "";
var $base_url = "";
var $html = "";
var $nav = array();
var $page_title= "";
var $email = "";
var $forum = "";
var $email = "";
/***********************************************************************************/
//
// Our constructor, load words, load skin
//
/***********************************************************************************/
function Contact() {
global $ibforums, $DB, $std, $print, $skin_universal;
// What to do?
switch($ibforums->input['act']) {
case 'Mail':
$this->mail_member();
break;
case 'AOL':
$this->show_aim();
break;
case 'ICQ':
$this->show_icq();
break;
case 'MSN':
$this->show_msn();
break;
case 'YAHOO':
$this->show_yahoo();
break;
case 'Invite':
$this->invite_member();
break;
case 'report':
if ($ibforums->input['send'] != 1)
{
$this->report_form();
}
else
{
$this->send_report();
}
break;
default:
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'invalid_use' ) );
break;
}
$print->add_output("$this->output");
$print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 0, NAV => $this->nav ) );
}
//****************************************************************/
// REPORT POST FORM:
//
//****************************************************************/
function report_form() {
global $ibforums, $DB, $std, $print;
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_emails', $ibforums->lang_id );
$this->html = $std->load_template('skin_emails');
$pid = intval($ibforums->input['p']);
$tid = intval($ibforums->input['t']);
$fid = intval($ibforums->input['f']);
$st = intval($ibforums->input['st']);
if ( (!$pid) and (!$tid) and (!$fid) )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files') );
}
// Do we have permission to do stuff in this forum? Lets hope so eh?!
$this->check_access($fid, $tid);
$this->output .= $this->html->report_form($fid, $tid, $pid, $st, $this->forum['topic_title']);
$this->nav[] = "{$this->forum['cat_name']}";
$this->nav[] = "{$this->forum['name']}";
$this->nav[] = $ibforums->lang['report_title'];
$this->page_title = $ibforums->lang['report_title'];
}
function send_report()
{
global $ibforums, $DB, $std, $print, $HTTP_POST_VARS;
$ibforums->lang = $std->load_words($ibforums->lang, 'lang_emails', $ibforums->lang_id );
$this->html = $std->load_template('skin_emails');
$pid = intval($ibforums->input['p']);
$tid = intval($ibforums->input['t']);
$fid = intval($ibforums->input['f']);
$st = intval($ibforums->input['st']);
if ( (!$pid) and (!$tid) and (!$fid) )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files') );
}
//--------------------------------------------
// Make sure we came in via a form.
//--------------------------------------------
if ($HTTP_POST_VARS['message'] == "")
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'complete_form') );
}
//--------------------------------------------
// Get the topic title
//--------------------------------------------
$DB->query("SELECT title FROM ibf_topics WHERE tid='$tid'");
$topic = $DB->fetch_row();
if ( ! $topic['title'] )
{
$std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files') );
}
//--------------------------------------------
// Do we have permission to do stuff in this forum? Lets hope so eh?!
//--------------------------------------------
$this->check_access($fid, $tid);
$mods = array();
// Check for mods in this forum
$DB->query("SELECT m.name, m.email, mod.member_id FROM ibf_moderators mod, ibf_members m WHERE mod.forum_id='$fid' and mod.member_id=m.id");
if ( $DB->get_num_rows() )
{
while( $r = $DB->fetch_row() )
{
$mods[] = array(
'name' => $r['name'],
'email' => $r['email']
);
}
}
else
{
//--------------------------------------------
// No mods? Get those with control panel access
//--------------------------------------------
$DB->query("SELECT m.id, m.name, m.email FROM ibf_members m, ibf_groups g WHERE g.g_access_cp=1 AND m.mgroup=g.g_id");
while( $r = $DB->fetch_row() )
{
$mods[] = array(
'name' => $r['name'],
'email' => $r['email']
);
}
}
//--------------------------------------------
// Get the emailer module
//--------------------------------------------
require "./sources/lib/emailer.php";
$this->email = new emailer();
//--------------------------------------------
// Loop and send the mail
//--------------------------------------------
$report = trim(stripslashes($HTTP_POST_VARS['message']));
$report = str_replace( "" , "" , $report );
$report = str_replace( "