Skip to content

Commit

Permalink
Merge branch 'master' of github.com:freescout-helpdesk/freescout
Browse files Browse the repository at this point in the history
  • Loading branch information
freescout-helpdesk committed Nov 27, 2018
2 parents b1f87e6 + 32662c4 commit 0c41326
Show file tree
Hide file tree
Showing 13 changed files with 399 additions and 397 deletions.
18 changes: 10 additions & 8 deletions app/Http/Controllers/SettingsController.php
Expand Up @@ -60,7 +60,7 @@ public function getTemplateVars($section, $template_vars)
$section_vars = $this->getSectionParams($section, 'template_vars');

if ($section_vars && is_array($section_vars)) {
return array_merge($template_vars, $section_vars);
return array_merge($template_vars, $section_vars);
} else {
return $template_vars;
}
Expand All @@ -71,9 +71,11 @@ public function getTemplateVars($section, $template_vars)
*
* If in settings parameter `env` is set, option will be saved into .env file
* instead of DB.
* @param [type] $section [description]
* @param string $param [description]
* @return [type] [description]
*
* @param [type] $section [description]
* @param string $param [description]
*
* @return [type] [description]
*/
public function getSectionParams($section, $param = '')
{
Expand All @@ -88,7 +90,7 @@ public function getSectionParams($section, $param = '')
'mail' => __("PHP's mail() function"),
'sendmail' => __('Sendmail'),
'smtp' => 'SMTP',
]
],
],
'validator_rules' => [
'settings.mail_from' => 'required|email',
Expand All @@ -99,10 +101,10 @@ public function getSectionParams($section, $param = '')
$params = [
'settings' => [
'locale' => [
'env' => 'APP_LOCALE'
'env' => 'APP_LOCALE',
],
'timezone' => [
'env' => 'APP_TIMEZONE'
'env' => 'APP_TIMEZONE',
],
],
];
Expand All @@ -116,7 +118,7 @@ public function getSectionParams($section, $param = '')
if (isset($params[$param])) {
return $params[$param];
} else {
return null;
return;
}
} else {
return $params;
Expand Down
11 changes: 7 additions & 4 deletions app/Http/Controllers/TranslateController.php
Expand Up @@ -8,6 +8,7 @@ class TranslateController extends BaseController
{
/**
* Send translations to FreeScout team.
*
* @return [type] [description]
*/
public function postSend()
Expand Down Expand Up @@ -35,17 +36,19 @@ public function postSend()

/**
* Remove all translations which has not been published yet.
*
* @return [type] [description]
*/
public function postRemoveUnpublished()
{
\Barryvdh\TranslationManager\Models\Translation::truncate();

return ['status' => 'ok'];
}

/**
* Download as ZIP.
*
*
* @return [type] [description]
*/
public function postDownload()
Expand All @@ -54,13 +57,13 @@ public function postDownload()
$file_name = 'lang.zip';
// Archive langs folder
$archive_path = \Helper::createZipArchive(base_path().DIRECTORY_SEPARATOR.'resources/lang', $file_name, 'lang');
$public_path = storage_path('app/public/'.$file_name);
$public_path = storage_path('app/public/'.$file_name);

\File::copy($archive_path, $public_path);

$headers = array(
$headers = [
'Content-Type: application/zip',
);
];

return \Response::download($public_path, $file_name, $headers);
}
Expand Down
7 changes: 4 additions & 3 deletions app/Http/Middleware/Localize.php
Expand Up @@ -9,14 +9,15 @@ class Localize
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
// Interface language is set automatically, as locale is stored in .env file.

// Set user language if user logged in.
$user_locale = session('user_locale');
if ($user_locale) {
Expand Down

0 comments on commit 0c41326

Please sign in to comment.