1 | <?php
|
---|
2 |
|
---|
3 | /***************************************************************************
|
---|
4 | * Dolphin Smart Community Builder
|
---|
5 | * -----------------
|
---|
6 | * begin : Mon Mar 23 2006
|
---|
7 | * copyright : (C) 2006 BoonEx Group
|
---|
8 | * website : http://www.boonex.com/
|
---|
9 | * This file is part of Dolphin - Smart Community Builder
|
---|
10 | *
|
---|
11 | * Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License.
|
---|
12 | * http://creativecommons.org/licenses/by/3.0/
|
---|
13 | *
|
---|
14 | * Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
---|
15 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
---|
16 | * See the Creative Commons Attribution 3.0 License for more details.
|
---|
17 | * You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin,
|
---|
18 | * see license.txt file; if not, write to marketing@boonex.com
|
---|
19 | ***************************************************************************/
|
---|
20 |
|
---|
21 | require_once( 'inc/header.inc.php' );
|
---|
22 | require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
|
---|
23 | require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' );
|
---|
24 |
|
---|
25 | // --------------- page variables and login
|
---|
26 |
|
---|
27 | $_page['name_index'] = 16;
|
---|
28 | $_page['css_name'] = 'contact.css';
|
---|
29 |
|
---|
30 | check_logged();
|
---|
31 |
|
---|
32 | $_page['header'] = _t( "_CONTACT_H" );
|
---|
33 | $_page['header_text'] = _t( "_CONTACT_H1" );
|
---|
34 |
|
---|
35 | // --------------- page components
|
---|
36 |
|
---|
37 | $showForm = getParam('enable_contact_form') == 'on' ? true : false ;
|
---|
38 |
|
---|
39 | $_ni = $_page['name_index'];
|
---|
40 |
|
---|
41 | if( $showForm ) {
|
---|
42 | $_page_cont[$_ni]['page_main_code'] = PageCompPageMainCodeWithForm();
|
---|
43 | } else {
|
---|
44 | $_page_cont[$_ni]['page_main_code'] = PageCompPageMainCode();
|
---|
45 | }
|
---|
46 |
|
---|
47 | // --------------- [END] page components
|
---|
48 |
|
---|
49 | PageCode();
|
---|
50 |
|
---|
51 | // --------------- page components functions
|
---|
52 |
|
---|
53 | /**
|
---|
54 | * page code function
|
---|
55 | */
|
---|
56 | function PageCompPageMainCode() {
|
---|
57 | global $oTemplConfig;
|
---|
58 | return DesignBoxContent( _t('_CONTACT_H1'), MsgBox(_t('_CONTACT')), $oTemplConfig->PageCompThird_db_num);
|
---|
59 | }
|
---|
60 |
|
---|
61 | function PageCompPageMainCodeWithForm() {
|
---|
62 | global $oTemplConfig, $site;
|
---|
63 |
|
---|
64 | $sActionText = '';
|
---|
65 |
|
---|
66 | $aForm = array(
|
---|
67 | 'form_attrs' => array(
|
---|
68 | 'id' => 'post_us_form',
|
---|
69 | 'action' => $_SERVER['PHP_SELF'],
|
---|
70 | 'method' => 'post',
|
---|
71 | ),
|
---|
72 | 'params' => array (
|
---|
73 | 'db' => array(
|
---|
74 | 'submit_name' => 'do_submit',
|
---|
75 | ),
|
---|
76 | ),
|
---|
77 | 'inputs' => array(
|
---|
78 | 'name' => array(
|
---|
79 | 'type' => 'text',
|
---|
80 | 'name' => 'name',
|
---|
81 | 'caption' => _t('_Your name'),
|
---|
82 | 'required' => true,
|
---|
83 | ),
|
---|
84 | 'email' => array(
|
---|
85 | 'type' => 'text',
|
---|
86 | 'name' => 'email',
|
---|
87 | 'caption' => _t('_Your email'),
|
---|
88 | 'required' => true,
|
---|
89 | 'checker' => array(
|
---|
90 | 'func' => 'email',
|
---|
91 | 'error' => _t( '_Incorrect Email' )
|
---|
92 | ),
|
---|
93 | ),
|
---|
94 | 'message_subject' => array(
|
---|
95 | 'type' => 'text',
|
---|
96 | 'name' => 'subject',
|
---|
97 | 'caption' => _t('_message_subject'),
|
---|
98 | 'required' => true,
|
---|
99 | ),
|
---|
100 | 'message_text' => array(
|
---|
101 | 'type' => 'textarea',
|
---|
102 | 'name' => 'body',
|
---|
103 | 'caption' => _t('_Message text'),
|
---|
104 | 'required' => true,
|
---|
105 | ),
|
---|
106 | 'captcha' => array(
|
---|
107 | 'type' => 'captcha',
|
---|
108 | 'caption' => _t('_Enter what you see:'),
|
---|
109 | 'name' => 'securityImageValue',
|
---|
110 | 'required' => true,
|
---|
111 | 'checker' => array(
|
---|
112 | 'func' => 'captcha',
|
---|
113 | 'error' => _t( '_Incorrect Captcha' ),
|
---|
114 | ),
|
---|
115 | ),
|
---|
116 | 'submit' => array(
|
---|
117 | 'type' => 'submit',
|
---|
118 | 'name' => 'do_submit',
|
---|
119 | 'value' => _t('_Submit'),
|
---|
120 | ),
|
---|
121 | ),
|
---|
122 | );
|
---|
123 |
|
---|
124 | $oForm = new BxTemplFormView($aForm);
|
---|
125 | $oForm->initChecker();
|
---|
126 | if ( $oForm->isSubmittedAndValid() ) {
|
---|
127 | $sSenderName = process_pass_data( $_POST['name'], 1 );
|
---|
128 | $sSenderEmail = process_pass_data( $_POST['email'], 1 );
|
---|
129 | $sLetterSubject = process_pass_data( $_POST['subject'], 1 );
|
---|
130 | $sLetterBody = process_pass_data( $_POST['body'], 1 );
|
---|
131 |
|
---|
132 | $sLetterBody = $sLetterBody . "\r\n" . '============' . "\r\n" . _t('_from') . ' ' . $sSenderName . "\r\n" . 'with email ' . $sSenderEmail;
|
---|
133 |
|
---|
134 | if (sendMail($site['email'], $sLetterSubject, $sLetterBody)) {
|
---|
135 | $sActionText = MsgBox( _t('_ADM_PROFILE_SEND_MSG') );
|
---|
136 | } else {
|
---|
137 | $sActionText = MsgBox( _t('_Email sent failed') );
|
---|
138 | }
|
---|
139 | }
|
---|
140 |
|
---|
141 | $sForm = $sActionText . $oForm->getCode();
|
---|
142 | return DesignBoxContent(_t('_CONTACT_H1'), $sForm, $oTemplConfig->PageCompThird_db_num);
|
---|
143 | }
|
---|
144 |
|
---|
145 | ?>
|
---|