source: temp/test-xoops.ec-cube.net/html/modules/contact/index.php @ 405

Revision 405, 5.6 KB checked in by root, 20 years ago (diff)
Line 
1<?php
2// $Id: index.php,v 1.6 2005/10/24 11:44:17 onokazu Exp $
3//  ------------------------------------------------------------------------ //
4//                XOOPS - PHP Content Management System                      //
5//                    Copyright (c) 2000 XOOPS.org                           //
6//                       <http://www.xoops.org/>                             //
7// ------------------------------------------------------------------------- //
8//  This program is free software; you can redistribute it and/or modify     //
9//  it under the terms of the GNU General Public License as published by     //
10//  the Free Software Foundation; either version 2 of the License, or        //
11//  (at your option) any later version.                                      //
12//                                                                           //
13//  You may not change or alter any portion of this comment or credits       //
14//  of supporting developers from this source code or any supporting         //
15//  source code which is considered copyrighted (c) material of the          //
16//  original comment or credit authors.                                      //
17//                                                                           //
18//  This program is distributed in the hope that it will be useful,          //
19//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
20//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
21//  GNU General Public License for more details.                             //
22//                                                                           //
23//  You should have received a copy of the GNU General Public License        //
24//  along with this program; if not, write to the Free Software              //
25//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
26//  ------------------------------------------------------------------------ //
27
28include "header.php";
29if ( empty($_POST['submit']) ) {
30    $xoopsOption['template_main'] = 'contact_contactusform.html';
31    include XOOPS_ROOT_PATH."/header.php";
32    include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php";
33    $company_v = "";
34    $name_v = !empty($xoopsUser) ? $xoopsUser->getVar("uname", "E") : "";
35    $email_v = !empty($xoopsUser) ? $xoopsUser->getVar("email", "E") : "";
36    $url_v = !empty($xoopsUser) ? $xoopsUser->getVar("url", "E") : "";
37    $icq_v = !empty($xoopsUser) ? $xoopsUser->getVar("user_icq", "E") : "";
38    $location_v = !empty($xoopsUser) ? $xoopsUser->getVar("user_from", "E") : "";
39    $comment_v = "";
40    include "contactform.php";
41    $contact_form->assign($xoopsTpl);
42    include XOOPS_ROOT_PATH."/footer.php";
43} else {
44    $myts =& MyTextSanitizer::getInstance();
45    $usersEmail = $myts->stripSlashesGPC($_POST['usersEmail']);
46    if(!checkEmail($usersEmail)) {
47        // ToDo: use message catalog
48        redirect_header(XOOPS_URL."/modules/".$xoopsModule->getVar('dirname')."/index.php",2,"EMAIL ERROR");
49        exit();
50    }
51
52    $usersCompanyName = $myts->stripSlashesGPC($_POST['usersCompanyName']);
53    $usersCompanyLocation = $myts->stripSlashesGPC($_POST['usersCompanyLocation']);
54    $usersComments = $myts->stripSlashesGPC($_POST['usersComments']);
55    $usersName = $myts->stripSlashesGPC($_POST['usersName']);
56
57    $adminMessage = sprintf(_CT_SUBMITTED,$usersName);
58    $adminMessage .= "\n";
59    $adminMessage .= ""._CT_EMAIL." $usersEmail\n";
60    if ( !empty($_POST['usersSite']) ) {
61        $adminMessage .= _CT_URL." ".$myts->stripSlashesGPC($_POST['usersSite'])."\n";
62    }
63    if ( !empty($_POST['usersICQ']) ) {
64        $adminMessage .= _CT_ICQ." ".$myts->stripSlashesGPC($_POST['usersICQ'])."\n";
65    }
66    if ( !empty($usersCompanyName) ) {
67        $adminMessage .= _CT_COMPANY. " $usersCompanyName\n";
68    }
69    if ( !empty($usersCompanyLocation) ) {
70        $adminMessage .= _CT_LOCATION." $usersCompanyLocation\n";
71    }
72    $adminMessage .= _CT_COMMENTS."\n";
73    $adminMessage .= "\n$usersComments\n";
74    $adminMessage .= "\n".$_SERVER['HTTP_USER_AGENT']."\n";
75    $subject = $xoopsConfig['sitename']." - "._CT_CONTACTFORM;
76    $xoopsMailer =& getMailer();
77    $xoopsMailer->useMail();
78    $xoopsMailer->setToEmails($xoopsConfig['adminmail']);
79    $xoopsMailer->setFromEmail($usersEmail);
80    $xoopsMailer->setFromName($xoopsConfig['sitename']);
81    $xoopsMailer->setSubject($subject);
82    $xoopsMailer->setBody($adminMessage);
83    $xoopsMailer->send();
84    $messagesent = sprintf(_CT_MESSAGESENT,$xoopsConfig['sitename'])."<br />"._CT_THANKYOU."";
85
86    // uncomment the following lines if you want to send confirmation mail to the user
87    /*
88    $conf_subject = _CT_THANKYOU;
89    $userMessage = sprintf(_CT_HELLO,$usersName);
90    $userMessage .= "\n\n";
91    $userMessage .= sprintf(_CT_THANKYOUCOMMENTS,$xoopsConfig['sitename']);
92    $userMessage .= "\n";
93    $userMessage .= sprintf(_CT_SENTTOWEBMASTER,$xoopsConfig['sitename']);
94    $userMessage .= "\n";
95    $userMessage .= _CT_YOURMESSAGE."\n";
96    $userMessage .= "\n$usersComments\n\n";
97    $userMessage .= "--------------\n";
98    $userMessage .= "".$xoopsConfig['sitename']." "._CT_WEBMASTER."\n";
99    $userMessage .= "".$xoopsConfig['adminmail']."";
100    $xoopsMailer =& getMailer();
101    $xoopsMailer->useMail();
102    $xoopsMailer->setToEmails($usersEmail);
103    $xoopsMailer->setFromEmail($usersEmail);
104    $xoopsMailer->setFromName($xoopsConfig['sitename']);
105    $xoopsMailer->setSubject($conf_subject);
106    $xoopsMailer->setBody($userMessage);
107    $xoopsMailer->send();
108    $messagesent .= sprintf(_CT_SENTASCONFIRM,$usersEmail);
109    */
110
111    redirect_header(XOOPS_URL."/index.php",2,$messagesent);
112}
113?>
Note: See TracBrowser for help on using the repository browser.