Merge remote-tracking branch 'origin/develop'

This commit is contained in:
snipe 2022-07-01 11:26:46 -07:00
commit 9670ca3b8a

View file

@ -110,12 +110,7 @@ class AcceptanceController extends Controller
Storage::makeDirectory('private_uploads/signatures', 775); Storage::makeDirectory('private_uploads/signatures', 775);
} }
/**
* Check for the eula-pdfs directory
*/
if (! Storage::exists('private_uploads/eula-pdfs')) {
Storage::makeDirectory('private_uploads/eula-pdfs', 775);
}
$item = $acceptance->checkoutable_type::find($acceptance->checkoutable_id); $item = $acceptance->checkoutable_type::find($acceptance->checkoutable_id);
$display_model = ''; $display_model = '';
@ -126,19 +121,33 @@ class AcceptanceController extends Controller
if ($request->input('asset_acceptance') == 'accepted') { if ($request->input('asset_acceptance') == 'accepted') {
/**
* Check for the eula-pdfs directory
*/
if (! Storage::exists('private_uploads/eula-pdfs')) {
Storage::makeDirectory('private_uploads/eula-pdfs', 775);
}
if (Setting::getSettings()->require_accept_signature == '1') {
// Check if the signature directory exists, if not create it
if (!Storage::exists('private_uploads/signatures')) {
Storage::makeDirectory('private_uploads/signatures', 775);
}
// The item was accepted, check for a signature // The item was accepted, check for a signature
if ($request->filled('signature_output')) { if ($request->filled('signature_output')) {
$sig_filename = 'siglog-'.Str::uuid().'-'.date('Y-m-d-his').'.png'; $sig_filename = 'siglog-' . Str::uuid() . '-' . date('Y-m-d-his') . '.png';
$data_uri = $request->input('signature_output'); $data_uri = $request->input('signature_output');
$encoded_image = explode(',', $data_uri); $encoded_image = explode(',', $data_uri);
$decoded_image = base64_decode($encoded_image[1]); $decoded_image = base64_decode($encoded_image[1]);
Storage::put('private_uploads/signatures/'.$sig_filename, (string) $decoded_image); Storage::put('private_uploads/signatures/' . $sig_filename, (string)$decoded_image);
// No image data is present, kick them back. // No image data is present, kick them back.
// This mostly only applies to users on super-duper crapola browsers *cough* IE *cough* // This mostly only applies to users on super-duper crapola browsers *cough* IE *cough*
} else { } else {
return redirect()->back()->with('error', trans('general.shitty_browser')); return redirect()->back()->with('error', trans('general.shitty_browser'));
}
} }