Go to the documentation of this file.00001 <?php
00002
00010 class Contact extends oxUBase
00011 {
00016 protected $_aUserData = null;
00017
00022 protected $_sContactSubject = null;
00023
00028 protected $_sContactMessage = null;
00029
00034 protected $_oCaptcha = null;
00035
00040 protected $_blContactSendStatus = null;
00041
00046 protected $_sThisTemplate = 'page/info/contact.tpl';
00047
00053 protected $_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
00054
00061 public function send()
00062 {
00063 $aParams = oxConfig::getParameter( 'editval' );
00064
00065
00066 if ( !oxUtils::getInstance()->isValidEmail( $aParams['oxuser__oxusername'] ) ) {
00067 oxUtilsView::getInstance()->addErrorToDisplay( 'EXCEPTION_INPUT_NOVALIDEMAIL' );
00068 return false;
00069 }
00070
00071
00072 $sMac = oxConfig::getParameter( 'c_mac' );
00073 $sMacHash = oxConfig::getParameter( 'c_mach' );
00074 $oCaptcha = $this->getCaptcha();
00075
00076 if ( !$oCaptcha->pass( $sMac, $sMacHash ) ) {
00077
00078 oxUtilsView::getInstance()->addErrorToDisplay( 'EXCEPTION_INPUT_WRONGCAPTCHA' );
00079 return false;
00080 }
00081
00082 $sSubject = oxConfig::getParameter( 'c_subject' );
00083 if ( !$aParams['oxuser__oxfname'] || !$aParams['oxuser__oxlname'] || !$aParams['oxuser__oxusername'] || !$sSubject ) {
00084
00085 oxUtilsView::getInstance()->addErrorToDisplay( 'EXCEPTION_INPUT_NOTALLFIELDS' );
00086 return false;
00087 }
00088
00089 $oLang = oxLang::getInstance();
00090 $sMessage = $oLang->translateString( 'CONTACT_FROM' ) . " " .
00091 $oLang->translateString( $aParams['oxuser__oxsal'] ) ." " .
00092 $aParams['oxuser__oxfname'] . " " .
00093 $aParams['oxuser__oxlname'] . "(" .$aParams['oxuser__oxusername'] . ")<br /><br />" .
00094 nl2br( oxConfig::getParameter( 'c_message' ) );
00095
00096 $oEmail = oxNew( 'oxemail' );
00097 if ( $oEmail->sendContactMail( $aParams['oxuser__oxusername'], $sSubject, $sMessage ) ) {
00098 $this->_blContactSendStatus = 1;
00099 }
00100 }
00101
00107 public function getUserData()
00108 {
00109 if ( $this->_oUserData === null ) {
00110 $this->_oUserData = oxConfig::getParameter( 'editval' );
00111 }
00112 return $this->_oUserData;
00113 }
00114
00120 public function getContactSubject()
00121 {
00122 if ( $this->_sContactSubject === null ) {
00123 $this->_sContactSubject = oxConfig::getParameter( 'c_subject' );
00124 }
00125 return $this->_sContactSubject;
00126 }
00127
00133 public function getContactMessage()
00134 {
00135 if ( $this->_sContactMessage === null ) {
00136 $this->_sContactMessage = oxConfig::getParameter( 'c_message' );
00137 }
00138 return $this->_sContactMessage;
00139 }
00140
00146 public function getCaptcha()
00147 {
00148 if ( $this->_oCaptcha === null ) {
00149 $this->_oCaptcha = oxNew('oxCaptcha');
00150 }
00151 return $this->_oCaptcha;
00152 }
00153
00159 public function getContactSendStatus()
00160 {
00161 return $this->_blContactSendStatus;
00162 }
00163
00169 public function getBreadCrumb()
00170 {
00171 $aPaths = array();
00172 $aPath = array();
00173
00174 $aPath['title'] = oxLang::getInstance()->translateString( 'PAGE_INFO_CONTACT_TITLECONTACT', oxLang::getInstance()->getBaseLanguage(), false );
00175 $aPath['link'] = $this->getLink();
00176 $aPaths[] = $aPath;
00177
00178 return $aPaths;
00179 }
00180 }