Cheetah
All Classes Namespaces Files Functions Variables Pages
contact.php
Go to the documentation of this file.
1 <?php
2 
8 require_once( 'inc/header.inc.php' );
9 require_once( CH_DIRECTORY_PATH_INC . 'design.inc.php' );
10 require_once( CH_DIRECTORY_PATH_INC . 'utils.inc.php' );
11 
12 // --------------- page variables and login
13 
14 $_page['name_index'] = 16;
15 
16 check_logged();
17 
18 $_page['header'] = _t( "_CONTACT_H" );
19 $_page['header_text'] = _t( "_CONTACT_H1" );
20 
21 // --------------- page components
22 
23 $showForm = getParam('enable_contact_form') == 'on' ? true : false ;
24 
25 $_ni = $_page['name_index'];
26 
27 if( $showForm ) {
28  $_page_cont[$_ni]['page_main_code'] = PageCompPageMainCodeWithForm();
29 } else {
30  $_page_cont[$_ni]['page_main_code'] = PageCompPageMainCode();
31 }
32 
33 // --------------- [END] page components
34 
35 PageCode();
36 
37 // --------------- page components functions
38 
43 {
45  return DesignBoxContent( _t('_CONTACT_H1'), MsgBox(_t('_CONTACT')), $oTemplConfig->PageCompThird_db_num);
46 }
47 
49 {
51 
52  $aForm = array(
53  'form_attrs' => array(
54  'id' => 'post_us_form',
55  'action' => CH_WSB_URL_ROOT . 'contact.php',
56  'method' => 'post',
57  ),
58  'params' => array (
59  'db' => array(
60  'submit_name' => 'do_submit',
61  ),
62  ),
63  'inputs' => array(
64  'name' => array(
65  'type' => 'text',
66  'name' => 'name',
67  'caption' => _t('_Your name'),
68  'required' => true,
69  'checker' => array(
70  'func' => 'length',
71  'params' => array(1, 150),
72  'error' => _t( '_Name is required' )
73  ),
74  ),
75  'email' => array(
76  'type' => 'text',
77  'name' => 'email',
78  'caption' => _t('_Your email'),
79  'required' => true,
80  'checker' => array(
81  'func' => 'email',
82  'error' => _t( '_Incorrect Email' )
83  ),
84  ),
85  'message_subject' => array(
86  'type' => 'text',
87  'name' => 'subject',
88  'caption' => _t('_message_subject'),
89  'required' => true,
90  'checker' => array(
91  'func' => 'length',
92  'params' => array(5, 300),
93  'error' => _t( '_ps_ferr_incorrect_length' )
94  ),
95  ),
96  'message_text' => array(
97  'type' => 'textarea',
98  'name' => 'body',
99  'caption' => _t('_Message text'),
100  'required' => true,
101  'checker' => array(
102  'func' => 'length',
103  'params' => array(10, 5000),
104  'error' => _t( '_ps_ferr_incorrect_length' )
105  ),
106  ),
107  'captcha' => array(
108  'type' => 'captcha',
109  'caption' => _t('_Enter what you see'),
110  'name' => 'securityImageValue',
111  'required' => true,
112  'checker' => array(
113  'func' => 'captcha',
114  'error' => _t( '_Incorrect Captcha' ),
115  ),
116  ),
117  'submit' => array(
118  'type' => 'submit',
119  'name' => 'do_submit',
120  'value' => _t('_Submit'),
121  ),
122  ),
123  );
124 
126  $sForm = $oForm->getCode();
127  $oForm->initChecker();
128  if ( $oForm->isSubmittedAndValid() ) {
129  $sSenderName = process_pass_data($_POST['name'], CH_TAGS_STRIP);
130  $sSenderEmail = process_pass_data($_POST['email'], CH_TAGS_STRIP);
131  $sLetterSubject = process_pass_data($_POST['subject'], CH_TAGS_STRIP);
132  $sLetterBody = process_pass_data($_POST['body'], CH_TAGS_STRIP);
133 
134  $sLetterBody = $sLetterBody . "\r\n" . '============' . "\r\n" . _t('_from') . ' ' . $sSenderName . "\r\n" . 'with email ' . $sSenderEmail;
135 
136  if (sendMail($site['email'], $sLetterSubject, $sLetterBody)) {
137  $sActionKey = '_ADM_PROFILE_SEND_MSG';
138  } else {
139  $sActionKey = '_Email sent failed';
140  }
141  $sActionText = MsgBox(_t($sActionKey));
142  $sForm = $sActionText . $sForm;
143  }
144  else
145  $sForm = $oForm->getCode();
146  return DesignBoxContent(_t('_CONTACT_H1'), $sForm, $oTemplConfig->PageCompThird_db_num);
147 }
ChTemplFormView
Definition: ChTemplFormView.php:11
true
if(!defined("TRUE_VAL")) define("TRUE_VAL" true
Definition: constants.inc.php:8
MsgBox
MsgBox($sText, $iTimer=0)
Definition: design.inc.php:175
check_logged
check_logged()
Definition: admin.inc.php:238
$_page_cont
$_page_cont[$_ni]['page_main_code']
Definition: about_us.php:24
sendMail
sendMail( $sRecipientEmail, $sMailSubject, $sMailBody, $iRecipientID=0, $aPlus=array(), $sEmailFlag='html', $isDisableAlert=false, $bForceSend=false)
Definition: utils.inc.php:461
php
$_page
$_page['name_index']
Definition: contact.php:14
$oForm
$oForm
Definition: host_tools.php:42
getParam
getParam($sParamName, $bUseCache=true)
Definition: db.inc.php:130
$site
$site['ver']
Definition: version.inc.php:8
PageCompPageMainCode
PageCompPageMainCode()
Definition: contact.php:42
global
if(!defined("GLOBAL_MODULE")) define("GLOBAL_MODULE" global
Definition: header.inc.php:25
$showForm
$showForm
Definition: contact.php:23
_t
_t($key, $arg0="", $arg1="", $arg2="")
Definition: languages.inc.php:509
PageCode
PageCode($oTemplate=null)
Definition: design.inc.php:91
CH_TAGS_STRIP
const CH_TAGS_STRIP
Definition: utils.inc.php:22
PageCompPageMainCodeWithForm
PageCompPageMainCodeWithForm()
Definition: contact.php:48
process_pass_data
process_pass_data($text, $strip_tags=0)
Definition: utils.inc.php:290
$aForm
$aForm
Definition: forgot.php:43
$_ni
$_ni
Definition: contact.php:25
$sForm
$sForm
Definition: forgot.php:118
DesignBoxContent
DesignBoxContent($title, $content, $db_num=0, $caption_item='', $bottom_item='')
Definition: design.inc.php:78
$oTemplConfig
$oTemplConfig
Definition: params.inc.php:90
false
if(!defined("FALSE_VAL")) define("FALSE_VAL" false
Definition: constants.inc.php:9