//
// ------------------------------------------------------------------------- //
// Original Author: Half-Dead
// Author Website : http://www.e-xoops.com
// License Type : GPL: See /manual/LICENSES/GPL.txt
// ------------------------------------------------------------------------- //
include_once('header.php');
$bcoosConfig['title'] .= " - "._MI_CONTACT_NAME;
if (empty($_POST['submit'])) {
if ($bcoosConfig['startpage'] == 'contact') {
$xoopsOption['show_rblock'] = 1;
include_once(XOOPS_ROOT_PATH.'/header.php');
make_cblock();
echo '
';
} else {
$xoopsOption['show_rblock'] = 0;
include_once(XOOPS_ROOT_PATH.'/header.php');
}
}
//---------------------------------------------------------------------------------------//
/**
* Description
*
* @param type $var description
* @return type description
*/
function admin_editlink($op, $anchor='') {
global $xoopsUser, $xoopsModule,$bcoosConfig;
if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid())) {
echo " ";
}
}
//---------------------------------------------------------------------------------------//
/**
* Description
*
* @param type $var description
* @return type description
*/
function show_contact() {
global $db, $myts, $xoopsUser, $bcoosConfig,$_POST, $_FILES;
include_once("./cache/config.php");
if ( empty($_POST['submit']) ) {
OpenTable();
$user_comments = '';
$company_name = '';
$company_location = !empty($xoopsUser) ? $xoopsUser->getVar("user_from", "E") : "";
$user_name = !empty($xoopsUser) ? $xoopsUser->getVar("uname", "E") : "";
$user_email = !empty($xoopsUser) ? $xoopsUser->getVar("email", "E") : "";
$user_url = !empty($xoopsUser) ? $xoopsUser->getVar("url", "E") : "";
if ($xoopsUser) {
if ($xoopsUser->getVar("user_icq")) {
$user_im = 'ICQ';
$user_im_details = $xoopsUser->getVar("user_icq", "E");
} elseif ($xoopsUser->getVar("user_aim")) {
$user_im = 'AIM';
$user_im_details = $xoopsUser->getVar("user_aim", "E");
} elseif ($xoopsUser->getVar("user_yim")) {
$user_im = 'YIM';
$user_im_details = $xoopsUser->getVar("user_yim", "E");
} elseif ($xoopsUser->getVar("user_msnm")) {
$user_im = 'MSNM';
$user_im_details = $xoopsUser->getVar("user_msnm", "E");
}
}
$query = $db->query("SELECT contact_text, contact_options, contact_reasons FROM ".$db->prefix("contact")."");
list($contact_text, $contact_options, $contact_reason) = $db->fetchRow($query);
if ($contact_text) {
$contact_options = explode('|', $contact_options);
$allow_html = $contact_options[0];
$allow_smileys = $contact_options[1];
$allow_bbcode = $contact_options[2];
admin_editlink('edit_contact');
$myts->setType('admin');
OpenTable();
echo $myts->makeTareaData4Show($contact_text, $allow_html, $allow_smileys, $allow_bbcode);
CloseTable();
}
include_once('include/contactform.php');
CloseTable();
include_once(XOOPS_ROOT_PATH.'/footer.php');
} else {
$company_name = $myts->oopsStripSlashesGPC($_POST['company_name']);
$company_location = $myts->oopsStripSlashesGPC($_POST['company_location']);
$contact_reason = $myts->oopsStripSlashesGPC($_POST['contact_reason']);
$user_comments = $myts->oopsStripSlashesGPC($_POST['user_comments']);
$user_name = $myts->oopsStripSlashesGPC($_POST['user_name']);
$user_email = $myts->oopsStripSlashesGPC($_POST['user_email']);
$user_url = $myts->oopsStripSlashesGPC($_POST['user_url']);
$user_im = $myts->oopsStripSlashesGPC($_POST['user_im']);
$user_im_details = $myts->oopsStripSlashesGPC($_POST['user_im_details']);
$xoopsMailer =& getMailer();
$xoopsMailer->useMail();
$xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH.'/modules/contact/');
$xoopsMailer->setTemplate('contact.tpl');
$xoopsMailer->setToEmails($bcoosConfig['adminmail']);
$xoopsMailer->setToEmails(explode(',', $contactConfig['bcc_to']));
$xoopsMailer->setFromEmail($user_email);
$xoopsMailer->setFromName($user_name);
$xoopsMailer->setSubject(_CT_CONTACT." - ".$contact_reason);
$xoopsMailer->setPriority($_POST['mail_priority']);
$xoopsMailer->assign("COMPANY", $company_name);
$xoopsMailer->assign("LOCATION", $company_location);
$xoopsMailer->assign("URL", $user_url);
$xoopsMailer->assign("IM", $user_im);
$xoopsMailer->assign("IMNO", $user_im_details);
$xoopsMailer->assign("NAME", $user_name);
$xoopsMailer->assign("EMAIL", $user_email);
$xoopsMailer->assign("REASON", $contact_reason);
$xoopsMailer->assign("COMMENTS", $user_comments);
$xoopsMailer->assign("AGENT", _HTTP_USER_AGENT);
$xoopsMailer->assign("IP", _REMOTE_ADDR);
$xoopsMailer->assign("TIME", formatTimestamp(time(), 'm'));
if ( !empty($_POST['mail_reciept']) ) {
$xoopsMailer->setReciept($user_email);
}
if ( $contactConfig['allow_attachment'] && !empty($_FILES['mail_attachment']['name']) ) {
if ($xoopsUser || $contactConfig['annon_attachment']) {
include_once(XOOPS_ROOT_PATH.'/class/upload.class.php');
$upload = new Upload();
$upload->setUploadPath(XOOPS_ROOT_PATH.'/modules/contact/cache');
$upload->setDestinationFileName('mail_attachment');
$upload->setAllowedMimeTypes(".gif|.jpeg|.jpg|.png");
$upload->setMaxFileSize($contactConfig['max_file_size']);
$result = $upload->doUpload();
if ($result) {
$xoopsMailer->attachFile(XOOPS_ROOT_PATH.'/modules/contact/cache/'.$upload->HTTP_POST_FILES[$upload->uploadFieldName]['name'], $upload->HTTP_POST_FILES[$upload->uploadFieldName]['type']);
@unlink(XOOPS_ROOT_PATH.'/modules/contact/cache/'.$upload->HTTP_POST_FILES[$upload->uploadFieldName]['name']);
} else {
$message_errors = $upload->errors(0);
}
}
}
$xoopsMailer->send();
$message_errors .= $xoopsMailer->getErrors();
if ($contactConfig['send_confirmation'] == 1) {
$xoopsMailer =& getMailer();
$xoopsMailer->useMail();
$xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH.'/modules/contact/');
$xoopsMailer->setTemplate('confirmation.tpl');
$xoopsMailer->setToEmails($user_email);
$xoopsMailer->setFromEmail($bcoosConfig['adminmail']);
$xoopsMailer->setFromName($bcoosConfig['title']);
$xoopsMailer->setSubject(_CT_RECIEVED);
$xoopsMailer->assign("NAME", $user_name);
$xoopsMailer->assign("SIGNATURE", $bcoosConfig['adminmail']);
$xoopsMailer->assign("SITENAME", $bcoosConfig['title']);
$xoopsMailer->send();
$message_errors .= $xoopsMailer->getErrors();
}
$messagesent = _CT_MESSAGESENT."
".$message_errors."";
redirect_header(XOOPS_URL.'/index.php', 2, $messagesent);
}
exit();
}
//---------------------------------------------------------------------------------------//
/**
* Description
*
* @param type $var description
* @return type description
*/
function show_link() {
global $db, $myts;
$sql = "
SELECT
intro_text,
intro_options,
text_caption,
text_alt,
text_custom,
logo_img,
logo_alt,
logo_custom,
button_img,
button_alt,
button_custom,
banner_img,
banner_alt,
banner_custom
FROM ".$db->prefix("contact")."";
$query = $db->query($sql);
list($intro_text, $intro_options, $text_caption, $text_alt, $text_custom, $logo_img, $logo_alt, $logo_custom, $button_img, $button_alt, $button_custom, $banner_img, $banner_alt, $banner_custom) = $db->fetchRow($query);
if ($text_caption || $text_custom || $logo_img || $logo_custom || $button_img || $button_custom || $banner_img || $banner_custom) {
OpenTable();
if ($intro_text) {
$intro_options = explode('|', $intro_options);
$allow_html = $intro_options[0];
$allow_smileys = $intro_options[1];
$allow_bbcode = $intro_options[2];
$myts->setType('admin');
admin_editlink('edit_link');
OpenTable();
echo $myts->makeTareaData4Show($intro_text, $allow_html, $allow_smileys, $allow_bbcode);
CloseTable();
}
if ($text_custom) {
?>