if (count($_POST)) { $prev = (bool) $params->get('_preview'); $to = trim($params->get('to')); $subject = trim($params->get('subject')); $body = trim($params->get('body')); if (!$to) { $errorMessage = Flux::message('MailerEnterToAddress'); } elseif (!$subject) { $errorMessage = Flux::message('MailerEnterSubject'); } elseif (!$body) { $errorMessage = Flux::message('MailerEnterBodyText'); } elseif (!Flux_Security::csrfValidate('Mailer', $_POST, $error)) { $errorMessage = $error; } if (empty($errorMessage)) { if ($prev) { require_once 'markdown/markdown.php'; $preview = Markdown($body); } else { require_once 'Flux/Mailer.php'; $mail = new Flux_Mailer(); $opts = array('_ignoreTemplate' => true, '_useMarkdown' => true); if ($mail->send($to, $subject, $body, $opts)) { $session->setMessageData(sprintf(Flux::message('MailerEmailHasBeenSent'), $to)); $this->redirect(); } else { $errorMessage = Flux::message('MailerFailedToSend'); } } } }
} elseif (!$email) { $errorMessage = Flux::message('ResendEnterEmail'); } elseif (preg_match('/[^' . Flux::config('UsernameAllowedChars') . ']/', $userid)) { $errorMessage = sprintf(Flux::message('AccountInvalidChars'), Flux::config('UsernameAllowedChars')); } elseif (!preg_match('/^(.+?)@(.+?)$/', $email)) { $errorMessage = Flux::message('InvalidEmailAddress'); } else { if (!$groupName || !($loginAthenaGroup = Flux::getServerGroupByName($groupName))) { $loginAthenaGroup = $session->loginAthenaGroup; } $sql = "SELECT confirm_code FROM {$loginAthenaGroup->loginDatabase}.{$createTable} WHERE "; $sql .= "userid = ? AND email = ? AND confirmed = 0 AND confirm_expire > NOW() LIMIT 1"; $sth = $loginAthenaGroup->connection->getStatement($sql); $sth->execute(array($userid, $email)); $row = $sth->fetch(); if ($row) { require_once 'Flux/Mailer.php'; $code = $row->confirm_code; $name = $loginAthenaGroup->serverName; $link = $this->url('account', 'confirm', array('_host' => true, 'code' => $code, 'user' => $userid, 'login' => $name)); $mail = new Flux_Mailer(); $sent = $mail->send($email, 'Account Confirmation', 'confirm', array('AccountUsername' => $userid, 'ConfirmationLink' => htmlspecialchars($link))); } if (empty($sent)) { $errorMessage = Flux::message('ResendFailed'); } else { $session->setMessageData(Flux::message('ResendEmailSent')); $this->redirect(); } } }
$sth->execute(array($userid, $email)); $row = $sth->fetch(); if ($row) { if ($row->group_id >= Flux::config('NoResetPassLevel')) { $errorMessage = Flux::message('ResetPassDisallowed'); } else { $code = md5(rand() + $row->account_id); $sql = "INSERT INTO {$loginAthenaGroup->loginDatabase}.{$resetPassTable} "; $sql .= "(code, account_id, old_password, request_date, request_ip, reset_done) "; $sql .= "VALUES (?, ?, ?, NOW(), ?, 0)"; $sth = $loginAthenaGroup->connection->getStatement($sql); $res = $sth->execute(array($code, $row->account_id, $row->user_pass, $_SERVER['REMOTE_ADDR'])); if ($res) { require_once 'Flux/Mailer.php'; $name = $loginAthenaGroup->serverName; $link = $this->url('account', 'resetpw', array('_host' => true, 'code' => $code, 'account' => $row->account_id, 'login' => $name)); $mail = new Flux_Mailer(); $sent = $mail->send($email, 'Reset Password', 'resetpass', array('AccountUsername' => $userid, 'ResetLink' => htmlspecialchars($link))); } } } if (empty($errorMessage)) { if (empty($sent)) { $errorMessage = Flux::message('ResetPassFailed'); } else { $session->setMessageData(Flux::message('ResetPassEmailSent')); $this->redirect(); } } } }
if (empty($errorMessage)) { $code = md5(rand() + $session->account->account_id); $ip = $_SERVER['REMOTE_ADDR']; $fail = false; if (Flux::config('RequireChangeConfirm')) { $sql = "INSERT INTO {$server->loginDatabase}.{$emailChangeTable} "; $sql .= "(code, account_id, old_email, new_email, request_date, request_ip, change_done) "; $sql .= "VALUES (?, ?, ?, ?, NOW(), ?, 0)"; $sth = $server->connection->getStatement($sql); $res = $sth->execute(array($code, $session->account->account_id, $session->account->email, $email, $ip)); if ($res) { require_once 'Flux/Mailer.php'; $name = $session->loginAthenaGroup->serverName; $link = $this->url('account', 'confirmemail', array('_host' => true, 'code' => $code, 'account' => $session->account->account_id, 'login' => $name)); $mail = new Flux_Mailer(); $sent = $mail->send($email, 'Change E-mail', 'changemail', array('AccountUsername' => $session->account->userid, 'OldEmail' => $session->account->email, 'NewEmail' => $email, 'ChangeLink' => htmlspecialchars($link))); if ($sent) { $session->setMessageData(Flux::message('EmailChangeSent')); $this->redirect(); } else { $fail = true; } } else { $fail = true; } } else { $old = $session->account->email; $sql = "UPDATE {$server->loginDatabase}.login SET email = ? WHERE account_id = ?"; $sth = $server->connection->getStatement($sql); if ($sth->execute(array($email, $session->account->account_id))) { $sql = "INSERT INTO {$server->loginDatabase}.{$emailChangeTable} ";
<?php /* Contact Form Addon * Created and maintained by Akkarin * Current Version: 1.00.01 */ if (!defined('FLUX_ROOT')) { exit; } $this->loginRequired(); if (isset($_POST['body'])) { require_once 'Flux/Mailer.php'; $mail = new Flux_Mailer(); $sent = $mail->send(Flux::config('ContactFormEmail'), $_POST['subject'], 'contactform', array('AccountID' => $session->account->account_id, 'Name' => $session->account->userid, 'Email' => $session->account->email, 'Subject' => $_POST['subject'], 'Body' => $_POST['body'], 'IP' => $_POST['ip'])); if ($sent) { $session->setMessageData('Sua mensagem foi enviada.'); } else { $errorMessage = 'Envio do formulário falhou.'; } }
$newPassword = ''; $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; $characters = str_split($characters, 1); $passLength = intval(($len = Flux::config('RandomPasswordLength')) < 8 ? 8 : $len); for ($i = 0; $i < $passLength; ++$i) { $newPassword .= $characters[array_rand($characters)]; } $unhashedNewPassword = $newPassword; if ($loginAthenaGroup->loginServer->config->getUseMD5()) { $newPassword = Flux::hashPassword($newPassword); } if (!$sth->execute(array($_SERVER['REMOTE_ADDR'], $newPassword, $reset->id))) { $session->setMessageData(Flux::message('ResetPwFailed')); $this->redirect(); } $sql = "UPDATE {$loginAthenaGroup->loginDatabase}.login SET user_pass = ? WHERE account_id = ?"; $sth = $loginAthenaGroup->connection->getStatement($sql); if (!$sth->execute(array($newPassword, $account))) { $session->setMessageData(Flux::message('ResetPwFailed')); $this->redirect(); } require_once 'Flux/Mailer.php'; $mail = new Flux_Mailer(); $sent = $mail->send($acc->email, 'Password Has Been Reset', 'newpass', array('AccountUsername' => $acc->userid, 'NewPassword' => $unhashedNewPassword)); if ($sent) { $message = Flux::message('ResetPwDone'); } else { $message = Flux::message('ResetPwDone2'); } $session->setMessageData($message); $this->redirect();
$sth = $server->connection->getStatement("UPDATE {$server->loginDatabase}.{$tbl} SET status = 'Pending' WHERE ticket_id = ?"); $sth->execute(array($ticket_id)); if ($_POST['response'] == 'Leave as-is to skip text response.' || $_POST['response'] == '' || $_POST['response'] == NULL || !isset($_POST['response'])) { $text = '0'; } else { $text = addslashes($_POST['response']); } $action = 'Ticket Re-Opened by a member of the ' . Flux::message('SDGroup' . $staffsess->team) . ' group.'; $sql = "INSERT INTO {$server->loginDatabase}.{$tbla} (ticket_id, author, text, action, ip, isstaff)"; $sql .= "VALUES (?, ?, ?, ?, ?, 1)"; $sth = $server->connection->getStatement($sql); $sth->execute(array($ticket_id, $_POST['staff_reply_name'], $text, $action, $_SERVER['REMOTE_ADDR'])); require_once 'Flux/Mailer.php'; $name = $session->loginAthenaGroup->serverName; $mail = new Flux_Mailer(); $sent = $mail->send($email, 'Ticket Reply', 'ticketreply', array('TicketID' => $ticket_id, 'Staff' => $staffsess->prefered_name)); $sth = $server->connection->getStatement("UPDATE {$server->loginDatabase}.{$tbl} SET lastreply = 'Staff' WHERE ticket_id = ?"); $sth->execute(array($ticket_id)); $this->redirect($this->url('servicedesk', 'staffindex')); } } $tbl = Flux::config('FluxTables.ServiceDeskTable'); $tbla = Flux::config('FluxTables.ServiceDeskATable'); $sql = "SELECT * FROM {$server->loginDatabase}.{$tbl} WHERE ticket_id = {$ticket_id}"; $rep = $server->connection->getStatement($sql); $rep->execute(); $ticketlist = $rep->fetchAll(); if ($ticketlist) { foreach ($ticketlist as $trow) { $chid = $trow->char_id; $sql = "SELECT * FROM {$server->charMapDatabase}.char WHERE char_id = {$chid}";
} if ($_POST['videolink'] == NULL || $_POST['videolink'] == '') { $_POST['videolink'] = '0'; } else { $_POST['videolink'] = $_POST['videolink']; } $sql = "INSERT INTO {$server->loginDatabase}.{$tbl} (account_id, char_id, category, sslink, chatlink, videolink, subject, text, ip, curemail, lastreply)"; $sql .= "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0)"; $sth = $server->connection->getStatement($sql); $sth->execute(array($_POST['account_id'], $char_id, $category, $_POST['sslink'], $_POST['chatlink'], $_POST['videolink'], $subject, $text, $ip, $session->account->email)); // Send email to all staff with enable email setting. $sth = $server->connection->getStatement("SELECT * FROM {$server->loginDatabase}.{$tblsettings} WHERE emailalerts = 1"); $sth->execute(); $staff = $sth->fetchAll(); if ($staff) { foreach ($staff as $staffrow) { $catsql = $server->connection->getStatement("SELECT * FROM {$server->loginDatabase}.{$tblcat} WHERE cat_id = ?"); $catsql->execute(array($category)); $catlist = $catsql->fetch(); $stsql = $server->connection->getStatement("SELECT * FROM {$server->loginDatabase}.login WHERE account_id = ?"); $stsql->execute(array($staffrow->account_id)); $stlist = $stsql->fetch(); $email = $stlist->email; require_once 'Flux/Mailer.php'; $name = $session->loginAthenaGroup->serverName; $mail = new Flux_Mailer(); $sent = $mail->send($email, 'New Ticket Created', 'newticket', array('Category' => $catlist->name, 'Subject' => $subject, 'Text' => $text)); } } $this->redirect($this->url('servicedesk', 'index')); }