Просмотр файла FFDB/member.php

Размер файла: 4.53Kb
<?php
// +----------------------------------------------------------------------+
// |                      Fantastic File Database                         |
// +----------------------------------------------------------------------+
// |                          By Tony Baird                               |
// |                  Copyright (c) 2003 Fantastic Scripts                |
// |                          http://fscripts.com                         |
// +----------------------------------------------------------------------+
// | Fantastic File Database Can be modified freely as long as copyright  | 
// | is intact and this is left at the top of every source file           |
// +----------------------------------------------------------------------+
// | member.php                                                           |
// | Date Started: March 9, 2003                                          |
// | Last Modified: March 10, 2003                                        |
// +----------------------------------------------------------------------+
Class Member {
	//*************************************************/
    // Just seing what we are doing
    //*************************************************/
    function Member() {
        global $tpl,$mysql,$online,$ffdb;
		if ($_REQUEST['action']=="member") {
			$this->Profile();
		}elseif ($_REQUEST['action']=="send_email") {
			$this->SendEmailForm();
		} else {
			$ffdb->Error("Well you did something stupid to get this error :P");
		}
	}
	//*************************************************/
    // Users Profile we always want to see these don't
	// we?  Of course so!
    //*************************************************/
	function Profile() {
		global $tpl,$mysql,$online,$ffdb;
		$mysql->Query("SELECT * FROM ffdb_users WHERE user_id=".$_REQUEST['id']."");
		$show_user=mysql_fetch_array($mysql->result_id);
		$tpl->LoadTemplate("profile","templates/$online->skin/profile.tpl");
		if (empty($show_user[site_name])) {
			$show_user[site_url]="";
		}
		$profile_array = array(
			'username'=>$show_user[username],
			'num_comments'=>$show_user[num_comments],
			'num_ratings'=>$show_user[num_ratings],
			'num_downloads'=>$show_user[num_downloads],
			'user_title'=>$show_user[user_title],
			'site_name'=>$show_user[site_name],
			'site_url'=>$show_user[site_url],
			'interests'=>$show_user[interests],
			'location'=>$show_user[location],
			'icq'=>$show_user[icq],
			'aim'=>$show_user[aim],
			'msn'=>$show_user[msn],
			'user_id'=>$show_user[user_id]
		);
		$tpl->ParseTemplate("profile",$profile_array,"No");
		$tpl->PrintTemplate("profile");
	}
	
	//*************************************************/
    // Send Email Form
    //*************************************************/
	function SendEmailForm() {
		global $tpl,$mysql,$online,$ffdb;
		if ($online->user_id==$_CONFIG['guest_id']) {
			$ffdb->Error("You must be logged in to use this feature");
		}
		$mysql->Query("SELECT * FROM ffdb_users WHERE user_id=".$_REQUEST['id']."");
		$show_user=mysql_fetch_array($mysql->result_id);
		$tpl->LoadTemplate("send_email_form","templates/$online->skin/send_email_form.tpl");
		$send_email_form_array = array(
			'username'=>$show_user[username],
			'user_id'=>$show_user[user_id]
		);
		$tpl->ParseTemplate("send_email_form",$send_email_form_array,"No");
		$tpl->PrintTemplate("send_email_form");
	}
	//*************************************************/
    // Actually sending email
    //*************************************************/
	function SendEmail() {
		global $tpl,$mysql,$online,$ffdb;
		if ($online->user_id==$_CONFIG['guest_id']) {
			$ffdb->Error("You must be logged in to use this feature");
		}
		$tpl->LoadTemplate("send_email","templates/$online->skin/send_email.tpl");
		$mysql->Query("SELECT * FROM ffdb_users WHERE user_id=".$_REQUEST['id']."");
		$show_user=mysql_fetch_array($mysql->result_id);
		$send_email_array = array(
			'username'=>$show_user[username],
			'user_id'=>$show_user[user_id],
			'sender_user_id'=>$online->user_id,
			'sender_username'=>$online->username,
			'message'=>$_REQUEST['message']
		);
		$tpl->ParseTemplate("send_email",$send_email_array,"No");
		$message=$tpl->SaveTemplate("send_email");
		$subject="Email message from $online->username via ".$CONFIG['archive_name']."";
		$header="From: $online->email \nReply-To: $online->email";
		$email=new Mailer;
		$email->SendEmail($show_user[email],$subject,$message,$header);
		$ffdb->Success("Email Sent to friend");
	}
	
}
?>