************************************************************************/
// Some security stuff...
-if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
-{
+if (!defined('__SECURITY')) {
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
require($INC);
-}
- elseif (!IS_LOGGED_IN())
-{
- LOAD_URL(URL."/modules.php?module=index");
-}
- elseif ((!EXT_IS_ACTIVE("support")) && (!IS_ADMIN()))
-{
- ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE, "support");
+} elseif (!IS_MEMBER()){
+ LOAD_URL("modules.php?module=index");
+} elseif ((!EXT_IS_ACTIVE("support")) && (!IS_ADMIN())) {
+ addFatalMessage(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), "support");
return;
}
// Add description as navigation point
-ADD_DESCR("member", basename(__FILE__));
+ADD_DESCR("member", __FILE__);
-if ((!isset($_POST['ok'])) || (empty($_POST['qsummary'])))
-{
+if ((!isset($_POST['ok'])) || (empty($_POST['qsummary']))) {
// Output form
LOAD_TEMPLATE("member_support_form");
-}
- else
-{
+} else {
// Load mail template based on your member's decision
- if (GET_EXT_VERSION("admins") >= "0.4.1")
- {
+ if (GET_EXT_VERSION("admins") >= "0.4.1") {
$a_tpl = "admin_support-".$_POST['qsummary'];
+ } else {
+ $msg_a = LOAD_EMAIL_TEMPLATE("admin_support-".$_POST['qsummary'], array('text' => $_POST['qdetails']), $GLOBALS['userid']);
}
- else
- {
- $msg_a = LOAD_EMAIL_TEMPLATE("admin_support-".$_POST['qsummary'], $_POST['qdetails'], $GLOBALS['userid']);
- }
- $msg_m = LOAD_EMAIL_TEMPLATE("member_support-".$_POST['qsummary'], $_POST['qdetails'], $GLOBALS['userid']);
+ $msg_m = LOAD_EMAIL_TEMPLATE("member_support-".$_POST['qsummary'], array('text' => $_POST['qdetails']), $GLOBALS['userid']);
// Select right subject
- switch ($_POST['qsummary'])
- {
- case "ordr" : $subj_a = SUPPORT_SUBJ_ADMIN_ORDER; $subj_m = SUPPORT_SUBJ_MEMBER_ORDER; break;
- case "reflink" : $subj_a = SUPPORT_SUBJ_ADMIN_REFLINK; $subj_m = SUPPORT_SUBJ_MEMBER_REFLINK; break;
- case "unconfirmed": $subj_a = SUPPORT_SUBJ_ADMIN_UNCONFIRMED; $subj_m = SUPPORT_SUBJ_MEMBER_UNCONFIRMED; break;
- }
+ switch ($_POST['qsummary']) {
+ case "ordr":
+ $subj_a = getMessage('SUPPORT_SUBJ_ADMIN_ORDER');
+ $subj_m = getMessage('SUPPORT_SUBJ_MEMBER_ORDER');
+ break;
- // Send mails away
- if (GET_EXT_VERSION("admins") >= "0.4.1")
- {
- SEND_ADMIN_EMAILS_PRO($subj_a, $a_tpl, $_POST['qdetails'], $GLOBALS['userid']);
- }
- else
- {
- SEND_ADMIN_EMAILS($subj_a, $msg_a);
- }
+ case "reflink":
+ $subj_a = getMessage('SUPPORT_SUBJ_ADMIN_REFLINK');
+ $subj_m = getMessage('SUPPORT_SUBJ_MEMBER_REFLINK');
+ break;
+
+ case "unconfirmed":
+ $subj_a = getMessage('SUPPORT_SUBJ_ADMIN_UNCONFIRMED');
+ $subj_m = getMessage('SUPPORT_SUBJ_MEMBER_UNCONFIRMED');
+ break;
+ } // END - switch
+
+ // Send mail to admin
+ SEND_ADMIN_NOTIFICATION($subj_a, $a_tpl, array('text' => $_POST['qdetails']), $GLOBALS['userid']);
+ // Send mail to user
SEND_EMAIL($GLOBALS['userid'], $subj_m, $msg_m);
// Drop a message in the admin's area
- $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_task_system (userid, assigned_admin, status, task_type, subject, text, task_created) VALUES ('%s', '0', 'NEW', 'SUPPORT_MEMBER', '%s', '%s', UNIX_TIMESTAMP())",
- array($GLOBALS['userid'], addslashes($subj_a), addslashes($_POST['qsummary'].":".$_POST['qdetails'])), __FILE__, __LINE__);
+ SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (userid, assigned_admin, status, task_type, subject, text, task_created) VALUES ('%s','0','NEW','SUPPORT_MEMBER','%s','%s', UNIX_TIMESTAMP())",
+ array($GLOBALS['userid'], $subj_a, $_POST['qsummary'].":".array('text' => $_POST['qdetails'])), __FILE__, __LINE__);
// Form sent
LOAD_TEMPLATE("member_support_contcted");