Skip to content

Commit

Permalink
Merge branch 'master' of github.com:freescout-helpdesk/freescout into…
Browse files Browse the repository at this point in the history
… dist
  • Loading branch information
freescout-help-desk committed Jun 19, 2024
2 parents 755e4f0 + f90ba3d commit 7c3e57a
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 17 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

<div align="center">

<img src="https://raw.githubusercontent.com/freescout-helpdesk/freescout/master/public/img/logo-300.png" width="180" height="180" />
<img src="https://raw.githubusercontent.com/freescout-help-desk/freescout/master/public/img/logo-300.png" width="180" height="180" />
<br/><br/>

[![PHP version](https://freescout-helpdesk.github.io/img/badges/PHP-7.1%2B-blue.svg)](https://github.com/freescout-helpdesk/freescout#requirements) [![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Ffreescout-helpdesk%2Ffreescout&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://hits.seeyoufarm.com)
[![PHP version](https://freescout-helpdesk.github.io/img/badges/PHP-7.1%2B-blue.svg)](https://github.com/freescout-help-desk/freescout#requirements) [![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Ffreescout-helpdesk%2Ffreescout&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://hits.seeyoufarm.com)

</div>

Expand Down Expand Up @@ -81,15 +81,15 @@ There are no minimum system requirements (CPU / RAM) – FreeScout will run on a

## Installation

[Installation Guide](https://github.com/freescout-helpdesk/freescout/wiki/Installation-Guide)
[Installation Guide](https://github.com/freescout-help-desk/freescout/wiki/Installation-Guide)

Images & one-click installs:

* [Docker Image](http://freescout.net/docker/)
* [Softaculous](http://www.softaculous.com/apps/customersupport/FreeScout) (cPanel, Plesk, ISPmanager, H-Sphere, DirectAdmin, InterWorx)
* [Fantastico](http://ff3.netenberg.com/visitors/scripts/freescout/view) (cPanel, DirectAdmin, ISP Manager, ISP Config)
* [Cloudron](https://cloudron.io/store/net.freescout.cloudronapp.html)
* [Ubuntu](https://github.com/freescout-helpdesk/freescout/wiki/Installation-Guide#interactive-installation-bash-script-ubuntu) (bash script)
* [Ubuntu](https://github.com/freescout-help-desk/freescout/wiki/Installation-Guide#interactive-installation-bash-script-ubuntu) (bash script)

## Cloud Hosted

Expand All @@ -115,10 +115,10 @@ Don't miss news, updates and new modules!

## Contributing

* [Support the project by leaving a feedback](https://github.com/freescout-helpdesk/freescout/issues/288)
* [Development Guide](https://github.com/freescout-helpdesk/freescout/wiki/Development-Guide)
* [Todo list](https://github.com/freescout-helpdesk/freescout/labels/help%20wanted)
* [Translate](https://github.com/freescout-helpdesk/freescout/wiki/Translate)
* [Support the project by leaving a feedback](https://github.com/freescout-help-desk/freescout/issues/288)
* [Development Guide](https://github.com/freescout-help-desk/freescout/wiki/Development-Guide)
* [Todo list](https://github.com/freescout-help-desk/freescout/labels/help%20wanted)
* [Translate](https://github.com/freescout-help-desk/freescout/wiki/Translate)

## Screenshots

Expand Down
7 changes: 7 additions & 0 deletions app/Mailbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,13 @@ public function oauthGetParam($param)
return $this->meta['oauth'][$param] ?? '';
}

public function outOauthEnabled()
{
return $this->oauthEnabled()
&& !strstr($this->out_username, '@')
&& stristr($this->out_server, '.office365.com');
}

public function setEmailAttribute($value)
{
if ($value) {
Expand Down
4 changes: 4 additions & 0 deletions app/Misc/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1970,6 +1970,10 @@ public static function checkRequiredFunctions()
'fpassthru (PHP)' => function_exists('fpassthru'),
'symlink (PHP)' => function_exists('symlink'),
'iconv (PHP)' => function_exists('iconv'),
// If posix_isatty() function is not enabled on the server the question in the
// console command makes it wait infinitely and be aborted.
// Commands should avoid using interctive functions or use special flags.
//'posix_isatty (PHP)' => function_exists('posix_isatty'),
'pcntl_signal (console PHP)' => function_exists('shell_exec') ? (int)\Helper::shellExec('php -r "echo (int)function_exists(\'pcntl_signal\');"') : false,
'ps (shell)' => function_exists('shell_exec') ? \Helper::shellExec('ps') : false,
];
Expand Down
6 changes: 3 additions & 3 deletions app/Misc/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ public static function setMailDriver($mailbox = null, $user_from = null, $conver
{
if ($mailbox) {
// Configure mail driver according to Mailbox settings.
$oauth = $mailbox->oauthEnabled();
$oauth = $mailbox->outOauthEnabled();

// Refresh Access Token.
if ($oauth && !strstr($mailbox->out_username, '@')) {
if ($oauth) {
if ((strtotime($mailbox->oauthGetParam('issued_on')) + (int)$mailbox->oauthGetParam('expires_in')) < time()) {
// Try to get an access token (using the authorization code grant)
$token_data = \MailHelper::oauthGetAccessToken(\MailHelper::OAUTH_PROVIDER_MICROSOFT, [
Expand Down Expand Up @@ -134,7 +134,7 @@ public static function setMailDriver($mailbox = null, $user_from = null, $conver
if ($mailbox->out_method == Mailbox::OUT_METHOD_SMTP) {
\Config::set('mail.host', $mailbox->out_server);
\Config::set('mail.port', $mailbox->out_port);
if ($oauth && !strstr($mailbox->out_username, '@')) {
if ($oauth) {
\Config::set('mail.auth_mode', 'XOAUTH2');
\Config::set('mail.username', $mailbox->email);
\Config::set('mail.password', $mailbox->oauthGetParam('a_token'));
Expand Down
2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
| or any other location as required by the application or its packages.
*/

'version' => '1.8.144',
'version' => '1.8.145',

/*
|--------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddIndexToThreadsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// https://github.com/freescout-help-desk/freescout/issues/4069#issuecomment-2175476858
Schema::table('threads', function (Blueprint $table) {
$table->index(['created_at']);
});
// Schema::table('conversations', function (Blueprint $table) {
// $table->index(['mailbox_id', 'state', 'status'], 'conversations_id_state_status');
// });
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('threads', function (Blueprint $table) {
$table->dropIndex(['created_at']);
});
// Schema::table('conversations', function (Blueprint $table) {
// $table->dropIndex('conversations_id_state_status');
// });
}
}
10 changes: 5 additions & 5 deletions resources/views/mailboxes/connection.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@
</div>
</div>
@php
$oauth_fully_enabled = ($mailbox->oauthEnabled() && strstr($mailbox->out_username, '@'));
$out_oauth_enabled = $mailbox->outOauthEnabled();
@endphp
<div class="form-group{{ $errors->has('out_username') ? ' has-error' : '' }}">
<label for="out_username" class="col-sm-2 control-label">{{ __('Username') }}</label>

<div class="col-sm-6">
<input id="out_username" type="text" class="form-control input-sized @if ($oauth_fully_enabled) disabled @endif" name="out_username" value="{{ old('out_username', $mailbox->out_username) }}" maxlength="100" @if ($mailbox->out_method == App\Mailbox::OUT_METHOD_SMTP) @endif autofocus {{-- This added to prevent autocomplete in Chrome --}}autocomplete="new-password" @if ($oauth_fully_enabled) readonly @endif>
<input id="out_username" type="text" class="form-control input-sized @if ($out_oauth_enabled) disabled @endif" name="out_username" value="{{ old('out_username', $mailbox->out_username) }}" maxlength="100" @if ($mailbox->out_method == App\Mailbox::OUT_METHOD_SMTP) @endif autofocus {{-- This added to prevent autocomplete in Chrome --}}autocomplete="new-password" @if ($out_oauth_enabled) readonly @endif>

@include('partials/field_error', ['field'=>'out_username'])
</div>
Expand All @@ -100,15 +100,15 @@
<label for="out_password" class="col-sm-2 control-label">{{ __('Password') }}</label>

<div class="col-sm-6">
<input id="out_password" type="password" class="form-control input-sized @if ($oauth_fully_enabled) disabled @endif" name="out_password" value="{{ old('out_password', $mailbox->outPasswordSafe()) }}" maxlength="255" @if ($mailbox->out_method == App\Mailbox::OUT_METHOD_SMTP) @endif autofocus {{-- This added to prevent autocomplete in Chrome --}}autocomplete="new-password" @if ($oauth_fully_enabled) readonly @endif>
<input id="out_password" type="password" class="form-control input-sized @if ($out_oauth_enabled) disabled @endif" name="out_password" value="{{ old('out_password', $mailbox->outPasswordSafe()) }}" maxlength="255" @if ($mailbox->out_method == App\Mailbox::OUT_METHOD_SMTP) @endif autofocus {{-- This added to prevent autocomplete in Chrome --}}autocomplete="new-password" @if ($out_oauth_enabled) readonly @endif>

<p class="form-help">
<small @if ($mailbox->oauthGetParam('provider') == \MailHelper::OAUTH_PROVIDER_MICROSOFT) class="text-success" @endif>Microsoft Exchange</small>
<small @if ($mailbox->oauthGetParam('provider') == \MailHelper::OAUTH_PROVIDER_MICROSOFT && $out_oauth_enabled) class="text-success" @endif>Microsoft Exchange</small>
@if (!$mailbox->oauthEnabled())
@if ($mailbox->out_username && $mailbox->out_password && !strstr($mailbox->out_username, '@'))
– <a href="{{ route('mailboxes.oauth', ['id' => $mailbox->id, 'provider' => \MailHelper::OAUTH_PROVIDER_MICROSOFT, 'in_out' => 'out']) }}" target="_blank">{{ __('Connect') }}</a>
@endif
@elseif ($mailbox->oauthGetParam('provider') == \MailHelper::OAUTH_PROVIDER_MICROSOFT && $oauth_fully_enabled)
@elseif ($mailbox->oauthGetParam('provider') == \MailHelper::OAUTH_PROVIDER_MICROSOFT && $out_oauth_enabled)
– <a href="{{ route('mailboxes.oauth_disconnect', ['id' => $mailbox->id, 'provider' => \MailHelper::OAUTH_PROVIDER_MICROSOFT, 'in_out' => 'out']) }}">{{ __('Disconnect') }}</a>
@endif
<small>(<a href="{{ config('app.freescout_repo') }}/wiki/Connect-FreeScout-to-Microsoft-365-Exchange-via-oAuth" target="_blank">{{ __('Help') }}</a>)</small>
Expand Down

0 comments on commit 7c3e57a

Please sign in to comment.