mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
commit
7b656b91de
@ -1 +1 @@
|
|||||||
5.8.56
|
5.8.57
|
@ -167,11 +167,11 @@ class ImportController extends Controller
|
|||||||
private function convertEncoding($data)
|
private function convertEncoding($data)
|
||||||
{
|
{
|
||||||
|
|
||||||
$enc = mb_detect_encoding($data, mb_list_encodings(), true);
|
// $enc = mb_detect_encoding($data, mb_list_encodings(), true);
|
||||||
|
|
||||||
if($enc !== false) {
|
// if($enc !== false) {
|
||||||
$data = mb_convert_encoding($data, "UTF-8", $enc);
|
// $data = mb_convert_encoding($data, "UTF-8", $enc);
|
||||||
}
|
// }
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
@ -233,8 +233,50 @@ class ImportController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->convertData($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private function convertData(array $data): array
|
||||||
|
{
|
||||||
|
|
||||||
|
// List of encodings to check against
|
||||||
|
$encodings = [
|
||||||
|
'UTF-8',
|
||||||
|
'ISO-8859-1', // Latin-1
|
||||||
|
'ISO-8859-2', // Latin-2
|
||||||
|
'WINDOWS-1252', // CP1252
|
||||||
|
'SHIFT-JIS',
|
||||||
|
'EUC-JP',
|
||||||
|
'GB2312',
|
||||||
|
'GBK',
|
||||||
|
'BIG5',
|
||||||
|
'ISO-2022-JP',
|
||||||
|
'KOI8-R',
|
||||||
|
'KOI8-U',
|
||||||
|
'WINDOWS-1251', // CP1251
|
||||||
|
'UTF-16',
|
||||||
|
'UTF-32',
|
||||||
|
'ASCII'
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($data as $key => $value) {
|
||||||
|
// Only process strings
|
||||||
|
if (is_string($value)) {
|
||||||
|
// Detect the encoding of the string
|
||||||
|
$detectedEncoding = mb_detect_encoding($value, $encodings, true);
|
||||||
|
|
||||||
|
// If encoding is detected and it's not UTF-8, convert it to UTF-8
|
||||||
|
if ($detectedEncoding && $detectedEncoding !== 'UTF-8') {
|
||||||
|
$array[$key] = mb_convert_encoding($value, 'UTF-8', $detectedEncoding);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the best delimiter
|
* Returns the best delimiter
|
||||||
|
@ -937,4 +937,44 @@ class BaseImport
|
|||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function convertData(array $data): array
|
||||||
|
{
|
||||||
|
|
||||||
|
// List of encodings to check against
|
||||||
|
$encodings = [
|
||||||
|
'UTF-8',
|
||||||
|
'ISO-8859-1', // Latin-1
|
||||||
|
'ISO-8859-2', // Latin-2
|
||||||
|
'WINDOWS-1252', // CP1252
|
||||||
|
'SHIFT-JIS',
|
||||||
|
'EUC-JP',
|
||||||
|
'GB2312',
|
||||||
|
'GBK',
|
||||||
|
'BIG5',
|
||||||
|
'ISO-2022-JP',
|
||||||
|
'KOI8-R',
|
||||||
|
'KOI8-U',
|
||||||
|
'WINDOWS-1251', // CP1251
|
||||||
|
'UTF-16',
|
||||||
|
'UTF-32',
|
||||||
|
'ASCII'
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($data as $key => $value) {
|
||||||
|
// Only process strings
|
||||||
|
if (is_string($value)) {
|
||||||
|
// Detect the encoding of the string
|
||||||
|
$detectedEncoding = mb_detect_encoding($value, $encodings, true);
|
||||||
|
|
||||||
|
// If encoding is detected and it's not UTF-8, convert it to UTF-8
|
||||||
|
if ($detectedEncoding && $detectedEncoding !== 'UTF-8') {
|
||||||
|
$array[$key] = mb_convert_encoding($value, 'UTF-8', $detectedEncoding);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -77,8 +77,6 @@ class NinjaMailerJob implements ShouldQueue
|
|||||||
/*Set the correct database*/
|
/*Set the correct database*/
|
||||||
MultiDB::setDb($this->nmo->company->db);
|
MultiDB::setDb($this->nmo->company->db);
|
||||||
|
|
||||||
nlog("nn");
|
|
||||||
|
|
||||||
/* Serializing models from other jobs wipes the primary key */
|
/* Serializing models from other jobs wipes the primary key */
|
||||||
$this->company = Company::query()->where('company_key', $this->nmo->company->company_key)->first();
|
$this->company = Company::query()->where('company_key', $this->nmo->company->company_key)->first();
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ class TemplateService
|
|||||||
$allowedTags = ['if', 'for', 'set', 'filter'];
|
$allowedTags = ['if', 'for', 'set', 'filter'];
|
||||||
$allowedFilters = ['escape', 'e', 'upper', 'lower', 'capitalize', 'filter', 'length', 'merge','format_currency','map', 'join', 'first', 'date','sum'];
|
$allowedFilters = ['escape', 'e', 'upper', 'lower', 'capitalize', 'filter', 'length', 'merge','format_currency','map', 'join', 'first', 'date','sum'];
|
||||||
$allowedFunctions = ['range', 'cycle', 'constant', 'date',];
|
$allowedFunctions = ['range', 'cycle', 'constant', 'date',];
|
||||||
$allowedProperties = [];
|
$allowedProperties = ['type_id'];
|
||||||
$allowedMethods = ['img','t'];
|
$allowedMethods = ['img','t'];
|
||||||
|
|
||||||
$policy = new \Twig\Sandbox\SecurityPolicy($allowedTags, $allowedFilters, $allowedFunctions, $allowedProperties, $allowedMethods);
|
$policy = new \Twig\Sandbox\SecurityPolicy($allowedTags, $allowedFilters, $allowedFunctions, $allowedProperties, $allowedMethods);
|
||||||
@ -605,7 +605,7 @@ class TemplateService
|
|||||||
$item->tax_amount = Number::formatMoney($item->tax_amount_raw, $client_or_vendor);
|
$item->tax_amount = Number::formatMoney($item->tax_amount_raw, $client_or_vendor);
|
||||||
$item->product_cost = Number::formatMoney($item->product_cost_raw, $client_or_vendor);
|
$item->product_cost = Number::formatMoney($item->product_cost_raw, $client_or_vendor);
|
||||||
|
|
||||||
return $item;
|
return (array)$item;
|
||||||
|
|
||||||
})->toArray();
|
})->toArray();
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,8 @@ return [
|
|||||||
'require_https' => env('REQUIRE_HTTPS', true),
|
'require_https' => env('REQUIRE_HTTPS', true),
|
||||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||||
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
||||||
'app_version' => env('APP_VERSION', '5.8.56'),
|
'app_version' => env('APP_VERSION', '5.8.57'),
|
||||||
'app_tag' => env('APP_TAG', '5.8.56'),
|
'app_tag' => env('APP_TAG', '5.8.57'),
|
||||||
'minimum_client_version' => '5.0.16',
|
'minimum_client_version' => '5.0.16',
|
||||||
'terms_version' => '1.0.1',
|
'terms_version' => '1.0.1',
|
||||||
'api_secret' => env('API_SECRET', false),
|
'api_secret' => env('API_SECRET', false),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user