HomeHelpTrac

source: tags/6.1/contact.php @ 10242

Revision 10242, 4.6 KB checked in by Alexander Trofimov, 3 years ago (diff)

dolphin 6.1.5, initial commit

Line 
1<?
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
21require_once( 'inc/header.inc.php' );
22require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
23require_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
30if ( !( $logged['admin'] = member_auth( 1, false ) ) )
31{
32    if ( !( $logged['member'] = member_auth( 0, false ) ) )
33    {
34        if ( !( $logged['aff'] = member_auth( 2, false )) )
35        {
36            $logged['moderator'] = member_auth( 3, false );
37        }
38    }
39}
40
41$_page['header'] = _t( "_CONTACT_H" );
42$_page['header_text'] = _t( "_CONTACT_H1" );
43
44// --------------- page components
45
46$showForm = getParam('enable_contact_form') == 'on' ? true : false ;
47
48$_ni = $_page['name_index'];
49
50if( $showForm )
51{
52    $_page_cont[$_ni]['page_main_code'] = PageCompPageMainCodeWithForm();
53}
54else
55{
56    $_page_cont[$_ni]['page_main_code'] = PageCompPageMainCode();
57}
58
59
60// --------------- [END] page components
61
62PageCode();
63
64// --------------- page components functions
65
66/**
67 * page code function
68 */
69function PageCompPageMainCode()
70{
71    global $oTemplConfig;
72    return DesignBoxContent( _t( "_CONTACT_H1" ), _t( "_CONTACT" ), $oTemplConfig -> PageCompThird_db_num);
73}
74
75function PageCompPageMainCodeWithForm()
76{
77    global $oTemplConfig;
78    global $site;
79
80    $sActionText = '';
81    if( isset($_POST['do_submit']) )
82    {
83        if (!isset($_POST['securityImageValue']) || !isset($_COOKIE['strSec']) || md5($_POST['securityImageValue']) != $_COOKIE['strSec'])
84        {
85            $sActionText = _t_err( '_SIMG_ERR' );
86        }
87        else
88        {
89            $sSenderName    = process_pass_data( $_POST['name'] );
90            $sSenderEmail   = process_pass_data( $_POST['email'] );
91            $sLetterSubject = process_pass_data( $_POST['subject'] );
92            $sLetterBody    = process_pass_data( $_POST['body'] );
93
94            $sLetterBody = $sLetterBody . "\r\n" . '============' . "\r\n" . _t('_from') . ' ' . $sSenderName . "\r\n" . 'with email ' .  $sSenderEmail;
95
96            if( sendMail( $site['email'], $sLetterSubject, $sLetterBody ) )
97            {
98                $sActionText = _t_action('_ADM_PROFILE_SEND_MSG');
99            }
100            else
101            {
102                $sActionText = _t_err( '_Email sent failed' );
103            }
104        }
105    }
106   
107    ob_start();
108   
109    echo $sActionText;
110    ?>
111    <form action="<?= $_SERVER['PHP_SELF'] ?>" method="post">
112        <table class="messageBlock">
113            <tr>
114                <td class="contact_label"><?= _t('_Your name') ?>:</td>
115                <td class="contact_value"><input type="text" name="name" value="" class="inputText" /></td>
116            </tr>
117            <tr>
118                <td class="contact_label"><?= _t('_Your email') ?>:</td>
119                <td class="contact_value"><input type="text" name="email" value="" class="inputText"  onkeyup="if( emailCheck( this.value ) ) this.form.do_submit.disabled=false; else this.form.do_submit.disabled=true;" /></td>
120            </tr>
121            <tr>
122                <td class="contact_label"><?= _t('_message_subject') ?>:</td>
123                <td class="contact_value"><input type="text" name="subject" value="" class="inputText" /></td>
124            </tr>
125            <tr>
126                <td class="contact_label"><?= _t('_Message text') ?>:</td>
127                <td class="contact_value"><textarea name="body" class="inputTextarea"></textarea></td>
128            </tr>
129            <tr>
130                <td class="contact_label"><?= _t( "_Enter what you see:" ) ?></div>
131                <td class="contact_value">
132                    <img alt="Security Image" src="<?= $site['url'] ?>simg/simg.php" /><br />
133                    <input name="securityImageValue" type="text" size="15" />
134                </td>
135            </tr>
136            <tr>
137                <td colspan="2" class="contact_submit"><input type="submit" name="do_submit" value="<?= _t('_Submit') ?>" disabled="disabled"/></td>
138            </tr>
139        </table>
140    </form>
141    <?
142    $ret = ob_get_clean();
143
144    return DesignBoxContent( _t( "_CONTACT_H1" ), $ret, $oTemplConfig -> PageCompThird_db_num);
145}
146
147?>
Note: See TracBrowser for help on using the repository browser.