Merge remote-tracking branch 'origin/develop'
Some checks are pending
CodeQL Security Scan / CodeQL Security Scan (javascript) (push) Waiting to run
Codacy Security Scan / Codacy Security Scan (push) Waiting to run
Docker images (Alpine) / docker (push) Waiting to run
Docker images / docker (push) Waiting to run
Tests in MySQL / PHP ${{ matrix.php-version }} (8.1) (push) Waiting to run
Tests in MySQL / PHP ${{ matrix.php-version }} (8.2) (push) Waiting to run
Tests in MySQL / PHP ${{ matrix.php-version }} (8.3) (push) Waiting to run
Tests in SQLite / PHP ${{ matrix.php-version }} (8.1.1) (push) Waiting to run

This commit is contained in:
snipe 2024-08-21 12:24:13 +01:00
commit c54bff0f83
3 changed files with 36 additions and 8 deletions

View file

@ -559,7 +559,6 @@ return [
'expires' => 'Expires',
'map_fields'=> 'Map :item_type Field',
'remaining_var' => ':count Remaining',
'assets_in_var' => 'Assets in :name :type',
'label' => 'Label',
'import_asset_tag_exists' => 'An asset with the asset tag :asset_tag already exists and an update was not requested. No change was made.',

View file

@ -3,7 +3,7 @@
{{-- Page title --}}
@section('title')
{{ trans('general.assets_in_var', ['name'=> $category->name, 'type' => trans('general.category')]) }}
{{ $category->name }}
@parent
@stop
@ -36,7 +36,19 @@
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li class="active">
<a href="#items" data-toggle="tab" title="{{ trans('general.items') }}"> {{ ucwords($category_type_route) }}
<a href="#items" data-toggle="tab" title="{{ trans('general.items') }}">
@if ($category->category_type=='asset')
{{ trans('general.assets') }}
@elseif ($category->category_type=='accessory')
{{ trans('general.accessories') }}
@elseif ($category->category_type=='license')
{{ trans('general.licenses') }}
@elseif ($category->category_type=='consumable')
{{ trans('general.consumables') }}
@elseif ($category->category_type=='component')
{{ trans('general.components') }}
@endif
@if ($category->category_type=='asset')
<badge class="badge badge-secondary"> {{ $category->showableAssets()->count() }}</badge>
@endif
@ -44,7 +56,8 @@
</li>
@if ($category->category_type=='asset')
<li>
<a href="#models" data-toggle="tab" title="{{ trans('general.asset_models') }}">{{ trans('general.asset_models') }}
<a href="#models" data-toggle="tab" title="{{ trans('general.asset_models') }}">
{{ trans('general.asset_models') }}
<badge class="badge badge-secondary"> {{ $category->models->count()}}</badge>
</a>
</li>

View file

@ -1,9 +1,14 @@
<?php
(PHP_SAPI !== 'cli' || isset($_SERVER['HTTP_USER_AGENT'])) && die('Access denied.');
// We define this because we can't reliable use file_get_contents because some
// We define this because we can't reliably use file_get_contents because some
// machines don't allow URL access via allow_url_fopen being set to off
function url_get_contents ($Url) {
$results = file_get_contents($Url);
if ($results) {
return $results;
}
print("file_get_contents() failed, trying curl instead.\n");
if (!function_exists('curl_init')){
die("cURL is not installed!\nThis is required for Snipe-IT as well as the upgrade script, so you will need to fix this before continuing.\nAborting upgrade...\n");
}
@ -13,11 +18,18 @@ function url_get_contents ($Url) {
// If we're on windows, make sure we can load intermediate certificates in
// weird corporate environments.
// See: https://github.com/curl/curl/commit/2d6333101a71129a6a802eb93f84a5ac89e34479
if (PHP_OS == "WINNT"){
// this will _probably_ only work if your libcurl has been linked to Schannel, the native Windows SSL implementation
if (PHP_OS == "WINNT" && defined("CURLOPT_SSL_OPTIONS") && defined("CURLSSLOPT_NATIVE_CA")) {
curl_setopt($ch, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA);
}
$output = curl_exec($ch);
curl_close($ch);
if ($output === false) {
print("Error retrieving PHP requirements!\n");
print("Error was: " . curl_error($ch) . "\n");
print("Try enabling allow_url_fopen in php.ini, or fixing your curl/OpenSSL setup, or try rerunning with --skip-php-compatibility-checks");
return '{}';
}
return $output;
}
@ -72,7 +84,7 @@ if (! $upgrade_requirements) {
echo "\nERROR: Failed to retrieve remote requirements from $remote_requirements_file\n\n";
if ($branch_override){
echo "NOTE: You passed a custom branch: $branch\n";
echo " If the above URL doesn't work, that may be why. Please check you branch spelling/extistance\n\n";
echo " If the above URL doesn't work, that may be why. Please check you branch spelling/existence\n\n";
}
if (json_last_error()) {
@ -149,7 +161,11 @@ foreach ($env as $line_num => $line) {
if ((strlen($line) > 1) && (strpos($line, "#") !== 0)) {
list ($env_key, $env_value) = $env_line = explode('=', $line);
$env_line = explode('=', $line, 2);
if (count($env_line) != 2) {
continue;
}
list ($env_key, $env_value) = $env_line;
// The array starts at 0
$show_line_num = $line_num+1;