update v1.0.7.5
This commit is contained in:
@@ -28,15 +28,14 @@ use Lang;
|
||||
*
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class EmailsController extends Controller
|
||||
{
|
||||
class EmailsController extends Controller {
|
||||
|
||||
/**
|
||||
* Defining constructor variables.
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('roles');
|
||||
}
|
||||
@@ -48,8 +47,7 @@ class EmailsController extends Controller
|
||||
*
|
||||
* @return type view
|
||||
*/
|
||||
public function index(Emails $email)
|
||||
{
|
||||
public function index(Emails $email) {
|
||||
try {
|
||||
// fetch all the emails from emails table
|
||||
$emails = $email->get();
|
||||
@@ -70,8 +68,7 @@ class EmailsController extends Controller
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function create(Department $department, Help_topic $help, Ticket_Priority $ticket_priority, MailboxProtocol $mailbox_protocol)
|
||||
{
|
||||
public function create(Department $department, Help_topic $help, Ticket_Priority $ticket_priority, MailboxProtocol $mailbox_protocol) {
|
||||
try {
|
||||
// fetch all the departments from the department table
|
||||
$departments = $department->get();
|
||||
@@ -96,17 +93,16 @@ class EmailsController extends Controller
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function validatingEmailSettings(Request $request)
|
||||
{
|
||||
public function validatingEmailSettings(Request $request) {
|
||||
$validator = \Validator::make(
|
||||
[
|
||||
'email_address' => $request->input('email_address'),
|
||||
'email_name' => $request->input('email_name'),
|
||||
'password' => $request->input('password'),
|
||||
'email_name' => $request->input('email_name'),
|
||||
'password' => $request->input('password'),
|
||||
], [
|
||||
'email_address' => 'required|email|unique:emails',
|
||||
'email_name' => 'required',
|
||||
'password' => 'required',
|
||||
'email_name' => 'required',
|
||||
'password' => 'required',
|
||||
]
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
@@ -177,8 +173,7 @@ class EmailsController extends Controller
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function store($request, $imap_check)
|
||||
{
|
||||
public function store($request, $imap_check) {
|
||||
$email = new Emails();
|
||||
try {
|
||||
// saving all the fields to the database
|
||||
@@ -260,8 +255,7 @@ class EmailsController extends Controller
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function edit($id, Department $department, Help_topic $help, Emails $email, Ticket_Priority $ticket_priority, MailboxProtocol $mailbox_protocol)
|
||||
{
|
||||
public function edit($id, Department $department, Help_topic $help, Emails $email, Ticket_Priority $ticket_priority, MailboxProtocol $mailbox_protocol) {
|
||||
try {
|
||||
$sys_email = \DB::table('settings_email')->select('sys_email')->where('id', '=', 1)->first();
|
||||
// dd($sys_email);
|
||||
@@ -292,17 +286,16 @@ class EmailsController extends Controller
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function validatingEmailSettingsUpdate($id, Request $request)
|
||||
{
|
||||
public function validatingEmailSettingsUpdate($id, Request $request) {
|
||||
$validator = \Validator::make(
|
||||
[
|
||||
'email_address' => $request->input('email_address'),
|
||||
'email_name' => $request->input('email_name'),
|
||||
'password' => $request->input('password'),
|
||||
'email_name' => $request->input('email_name'),
|
||||
'password' => $request->input('password'),
|
||||
], [
|
||||
'email_address' => 'email',
|
||||
'email_name' => 'required',
|
||||
'password' => 'required',
|
||||
'email_name' => 'required',
|
||||
'password' => 'required',
|
||||
]
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
@@ -375,8 +368,7 @@ class EmailsController extends Controller
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function update($id, $request, $imap_check)
|
||||
{
|
||||
public function update($id, $request, $imap_check) {
|
||||
try {
|
||||
// fetch the selected emails
|
||||
$emails = Emails::whereId($id)->first();
|
||||
@@ -426,12 +418,12 @@ class EmailsController extends Controller
|
||||
// $emails->password = Crypt::encrypt($request->input('password'));
|
||||
$emails->save();
|
||||
//dd($request->sys_email);
|
||||
if ($request->sys_email == 'on') {
|
||||
if($request->sys_email == 'on') {
|
||||
$system = \DB::table('settings_email')
|
||||
->where('id', '=', 1)
|
||||
->update(['sys_email' => $id]);
|
||||
} elseif ($request->input('count') <= 1 && $request->sys_email == null) {
|
||||
$system = \DB::table('settings_email')
|
||||
$system = \DB::table('settings_email')
|
||||
->where('id', '=', 1)
|
||||
->update(['sys_email' => null]);
|
||||
}
|
||||
@@ -453,8 +445,7 @@ class EmailsController extends Controller
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function destroy($id, Emails $email)
|
||||
{
|
||||
public function destroy($id, Emails $email) {
|
||||
// fetching the details on the basis of the $id passed to the function
|
||||
$default_system_email = Email::where('id', '=', '1')->first();
|
||||
if ($default_system_email->sys_email) {
|
||||
@@ -485,26 +476,25 @@ class EmailsController extends Controller
|
||||
*
|
||||
* @return type int
|
||||
*/
|
||||
public function getImapStream($request, $validate)
|
||||
{
|
||||
public function getImapStream($request, $validate) {
|
||||
$fetching_status = $request->input('fetching_status');
|
||||
$username = $request->input('email_address');
|
||||
$password = $request->input('password');
|
||||
$protocol_id = $request->input('mailbox_protocol');
|
||||
$fetching_protocol = '/'.$request->input('fetching_protocol');
|
||||
$fetching_encryption = '/'.$request->input('fetching_encryption');
|
||||
$fetching_protocol = '/' . $request->input('fetching_protocol');
|
||||
$fetching_encryption = '/' . $request->input('fetching_encryption');
|
||||
if ($fetching_encryption == '/none') {
|
||||
$fetching_encryption2 = '/novalidate-cert';
|
||||
$mailbox_protocol = $fetching_encryption2;
|
||||
$host = $request->input('fetching_host');
|
||||
$port = $request->input('fetching_port');
|
||||
$mailbox = '{'.$host.':'.$port.$mailbox_protocol.'}INBOX';
|
||||
$mailbox = '{' . $host . ':' . $port . $mailbox_protocol . '}INBOX';
|
||||
} else {
|
||||
$mailbox_protocol = $fetching_protocol.$fetching_encryption;
|
||||
$mailbox_protocol = $fetching_protocol . $fetching_encryption;
|
||||
$host = $request->input('fetching_host');
|
||||
$port = $request->input('fetching_port');
|
||||
$mailbox = '{'.$host.':'.$port.$mailbox_protocol.$validate.'}INBOX';
|
||||
$mailbox_protocol = $fetching_encryption.$validate;
|
||||
$mailbox = '{' . $host . ':' . $port . $mailbox_protocol . $validate . '}INBOX';
|
||||
$mailbox_protocol = $fetching_encryption . $validate;
|
||||
}
|
||||
try {
|
||||
$imap_stream = imap_open($mailbox, $username, $password);
|
||||
@@ -528,8 +518,7 @@ class EmailsController extends Controller
|
||||
*
|
||||
* @return type int
|
||||
*/
|
||||
public function checkImapStream($imap_stream)
|
||||
{
|
||||
public function checkImapStream($imap_stream) {
|
||||
$check_imap_stream = imap_check($imap_stream);
|
||||
if ($check_imap_stream) {
|
||||
$imap_stream = 1;
|
||||
@@ -547,8 +536,7 @@ class EmailsController extends Controller
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getSmtp($request)
|
||||
{
|
||||
public function getSmtp($request) {
|
||||
$sending_status = $request->input('sending_status');
|
||||
// cheking for the sending protocol
|
||||
if ($request->input('sending_protocol') == 'smtp') {
|
||||
@@ -564,8 +552,8 @@ class EmailsController extends Controller
|
||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
||||
$mail->SMTPOptions = [
|
||||
'ssl' => [
|
||||
'verify_peer' => false,
|
||||
'verify_peer_name' => false,
|
||||
'verify_peer' => false,
|
||||
'verify_peer_name' => false,
|
||||
'allow_self_signed' => true,
|
||||
],
|
||||
];
|
||||
@@ -597,8 +585,7 @@ class EmailsController extends Controller
|
||||
*
|
||||
* @return type string or null
|
||||
*/
|
||||
public function departmentValue($dept)
|
||||
{
|
||||
public function departmentValue($dept) {
|
||||
if ($dept) {
|
||||
$email_department = $dept;
|
||||
} else {
|
||||
@@ -615,8 +602,7 @@ class EmailsController extends Controller
|
||||
*
|
||||
* @return type string or null
|
||||
*/
|
||||
public function priorityValue($priority)
|
||||
{
|
||||
public function priorityValue($priority) {
|
||||
if ($priority) {
|
||||
$email_priority = $priority;
|
||||
} else {
|
||||
@@ -633,8 +619,7 @@ class EmailsController extends Controller
|
||||
*
|
||||
* @return type string or null
|
||||
*/
|
||||
public function helpTopicValue($help_topic)
|
||||
{
|
||||
public function helpTopicValue($help_topic) {
|
||||
if ($help_topic) {
|
||||
$email_help_topic = $help_topic;
|
||||
} else {
|
||||
@@ -643,4 +628,5 @@ class EmailsController extends Controller
|
||||
|
||||
return $email_help_topic;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user