summaryrefslogtreecommitdiff
path: root/contact.php
blob: 40ff568839e18874147cbab27127127b3148b510 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* message package modules
*
* @author   
* @version  $Header: /cvsroot/bitweaver/_bit_messages/contact.php,v 1.5 2006/01/31 21:27:55 bitweaver Exp $
* @package  messages
* @subpackage functions
*/

// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.

/**
 * required setup
 */
require_once( '../bit_setup_inc.php' );

if( !$gBitSystem->isFeatureActive( 'feature_contact' ) ) {
	$gBitSystem->fatalError( "The Contact feature is disabled." );
}

include_once( MESSU_PKG_PATH.'messages_lib.php' );

$userInfo = $gBitUser->getUserInfo( array( 'login' => $gBitSystem->getPreference( 'contact_user' ) ) );
$email = $userInfo['email'];
if( empty( $email ) ) {
	$gBitSystem->fatalError( "This feature is not correctly set up. The email address is missing." );
} else {
	$gBitSmarty->assign( 'email', $email );
}

if( $gBitSystem->isPackageActive( 'quicktags' ) ) {
	include_once( QUICKTAGS_PKG_PATH.'quicktags_inc.php' );
}

if (!empty($_REQUEST['send'])) {
	if( empty( $_REQUEST['subject'] ) && empty( $_REQUEST['body'] ) ) {
		$gBitSystem->fatalError( "Either a subject or a message body is required." );
	}
	$messulib->post_message( $userInfo['login'], $gBitUser->mUsername, $_REQUEST['to'], '', $_REQUEST['subject'], $_REQUEST['body'], $_REQUEST['priority']);
	$feedback['success'] = tra( 'Your message was sent to' ).': '.( !empty( $userInfo['real_name'] ) ? $userInfo['real_name'] : $userInfo['login'] );
	$gBitSmarty->assign( 'feedback', $feedback );
}

$gBitSystem->display( 'bitpackage:messu/contact.tpl');
?>