Commit a999eb37 authored by Cédric Anne's avatar Cédric Anne
Browse files

Merge branch '9.5/bugfixes'

parents 5e18fc72 a845204b
......@@ -53,7 +53,7 @@ jobs:
if: ${{ steps.updated.outputs.build == 'yes' }}
run: |
REF_NAME=$(echo ${{ matrix.branch }} | sed -E 's|/|-|')
echo "::set-output name=base::$REF_NAME"
echo "::set-output name=basename::$REF_NAME"
SHA=$(git rev-parse --short HEAD)
echo "release_name=$REF_NAME.$SHA" >> $GITHUB_ENV
- name: "Build"
......
......@@ -43,46 +43,48 @@ trait MapGeolocation {
* get openstreetmap
*/
public function showMap() {
echo "<div id='setlocation_container'></div>";
$js = "var map_elt, _marker;
var _setLocation = function(lat, lng) {
if (_marker) {
map_elt.removeLayer(_marker);
}
_marker = L.marker([lat, lng]).addTo(map_elt);
map_elt.fitBounds(
L.latLngBounds([_marker.getLatLng()]), {
padding: [50, 50],
maxZoom: 10
$rand = mt_rand();
echo "<div id='setlocation_container_{$rand}'></div>";
$js = "
$(function(){
var map_elt, _marker;
var _setLocation = function(lat, lng) {
if (_marker) {
map_elt.removeLayer(_marker);
}
);
};
var _autoSearch = function() {
var _tosearch = '';
var _address = $('*[name=address]').val();
var _town = $('*[name=town]').val();
var _country = $('*[name=country]').val();
if (_address != '') {
_tosearch += _address;
}
if (_town != '') {
_marker = L.marker([lat, lng]).addTo(map_elt);
map_elt.fitBounds(
L.latLngBounds([_marker.getLatLng()]), {
padding: [50, 50],
maxZoom: 10
}
);
};
var _autoSearch = function() {
var _tosearch = '';
var _address = $('*[name=address]').val();
var _town = $('*[name=town]').val();
var _country = $('*[name=country]').val();
if (_address != '') {
_tosearch += ' ';
_tosearch += _address;
}
_tosearch += _town;
}
if (_country != '') {
if (_address != '' || _town != '') {
_tosearch += ' ';
if (_town != '') {
if (_address != '') {
_tosearch += ' ';
}
_tosearch += _town;
}
if (_country != '') {
if (_address != '' || _town != '') {
_tosearch += ' ';
}
_tosearch += _country;
}
_tosearch += _country;
}
$('.leaflet-control-geocoder-form > input[type=text]').val(_tosearch);
}
$(function(){
$('.leaflet-control-geocoder-form > input[type=text]').val(_tosearch);
}
var finalizeMap = function() {
var osmGeocoder = new L.Control.OSMGeocoder({
collapsed: false,
......@@ -91,7 +93,7 @@ trait MapGeolocation {
});
map_elt.addControl(osmGeocoder);
_autoSearch();
function onMapClick(e) {
var popup = L.popup();
popup
......@@ -99,18 +101,18 @@ trait MapGeolocation {
.setContent('SELECTPOPUP')
.openOn(map_elt);
}
map_elt.on('click', onMapClick);
map_elt.on('popupopen', function(e){
var _popup = e.popup;
var _container = $(_popup._container);
var _clat = _popup._latlng.lat.toString();
var _clng = _popup._latlng.lng.toString();
_popup.setContent('<p><a href=\'#\'>".__s('Set location here')."</a></p>');
$(_container).find('a').on('click', function(e){
e.preventDefault();
_popup.remove();
......@@ -118,18 +120,18 @@ trait MapGeolocation {
$('*[name=longitude]').val(_clng).trigger('change');
});
});
var _curlat = $('*[name=latitude]').val();
var _curlng = $('*[name=longitude]').val();
if (_curlat && _curlng) {
_setLocation(_curlat, _curlng);
}
$('*[name=latitude],*[name=longitude]').on('change', function(){
var _curlat = $('*[name=latitude]').val();
var _curlng = $('*[name=longitude]').val();
if (_curlat && _curlng) {
_setLocation(_curlat, _curlng);
}
......@@ -151,16 +153,16 @@ trait MapGeolocation {
// High accuracy
var zoom = 20;
}
map_elt = initMap($('#setlocation_container'), 'setlocation', '200px', {
map_elt = initMap($('#setlocation_container_{$rand}'), 'setlocation_{$rand}', '200px', {
position: [pos.coords.latitude, pos.coords.longitude],
zoom: zoom
});
finalizeMap();
}, function() {
map_elt = initMap($('#setlocation_container'), 'setlocation', '200px');
map_elt = initMap($('#setlocation_container_{$rand}'), 'setlocation_{$rand}', '200px');
finalizeMap();
}, {enableHighAccuracy: true});
});";
echo Html::scriptBlock($js);
}
......
......@@ -30,6 +30,8 @@
* ---------------------------------------------------------------------
*/
use PHPMailer\PHPMailer\PHPMailer;
if (!defined('GLPI_ROOT')) {
die("Sorry. You can't access this file directly");
}
......@@ -365,9 +367,19 @@ class NotificationEventMailing extends NotificationEventAbstract implements Noti
'mail'
);
}
$encoding = PHPMailer::ENCODING_BASE64;
$mime = mime_content_type($path);
if ($mime == "message/rfc822") {
// messages/rfc822 can't be encoded in base64 according to RFC2046
// https://datatracker.ietf.org/doc/html/rfc2046
$encoding = PHPMailer::ENCODING_8BIT;
}
$mmail->addAttachment(
$path,
$document->fields['filename']
$document->fields['filename'],
$encoding
);
}
}
......
......@@ -350,17 +350,32 @@ class Plugin extends CommonDBTM {
);
}
$mofile = str_replace($locales_dir, GLPI_LOCAL_I18N_DIR . '/'.$plugin_key . '/', $mofile);
$phpfile = str_replace('.mo', '.php', $mofile);
$plugin_folders = scandir(GLPI_LOCAL_I18N_DIR);
$plugin_folders = array_filter($plugin_folders, function($dir) use ($plugin_key) {
if (!is_dir(GLPI_LOCAL_I18N_DIR . "/$dir")) {
return false;
}
// Load local PHP file if it exists
if (file_exists($phpfile)) {
$TRANSLATE->addTranslationFile('phparray', $phpfile, $plugin_key, $coretrytoload);
}
if ($dir == $plugin_key) {
return true;
}
// Load local MO file if it exists -- keep last so it gets precedence
if (file_exists($mofile)) {
$TRANSLATE->addTranslationFile('gettext', $mofile, $plugin_key, $coretrytoload);
return Toolbox::startsWith($dir, $plugin_key . '_');
});
foreach ($plugin_folders as $plugin_folder) {
$mofile = str_replace($locales_dir, GLPI_LOCAL_I18N_DIR . '/'. $plugin_folder . '/', $mofile);
$phpfile = str_replace('.mo', '.php', $mofile);
// Load local PHP file if it exists
if (file_exists($phpfile)) {
$TRANSLATE->addTranslationFile('phparray', $phpfile, $plugin_key, $coretrytoload);
}
// Load local MO file if it exists -- keep last so it gets precedence
if (file_exists($mofile)) {
$TRANSLATE->addTranslationFile('gettext', $mofile, $plugin_key, $coretrytoload);
}
}
}
......
......@@ -642,17 +642,32 @@ class Session {
$TRANSLATE->addTranslationFile('gettext', GLPI_I18N_DIR.$newfile, 'glpi', $trytoload);
$mofile = GLPI_LOCAL_I18N_DIR . '/core/' . $newfile;
$phpfile = str_replace('.mo', '.php', $mofile);
$core_folders = scandir(GLPI_LOCAL_I18N_DIR);
$core_folders = array_filter($core_folders, function($dir) {
if (!is_dir(GLPI_LOCAL_I18N_DIR . "/$dir")) {
return false;
}
// Load local PHP file if it exists
if (file_exists($phpfile)) {
$TRANSLATE->addTranslationFile('phparray', $phpfile, 'glpi', $trytoload);
}
if ($dir == 'core') {
return true;
}
// Load local MO file if it exists -- keep last so it gets precedence
if (file_exists($mofile)) {
$TRANSLATE->addTranslationFile('gettext', $mofile, 'glpi', $trytoload);
return Toolbox::startsWith($dir, 'core_');
});
foreach ($core_folders as $core_folder) {
$mofile = GLPI_LOCAL_I18N_DIR . "/$core_folder/" . $newfile;
$phpfile = str_replace('.mo', '.php', $mofile);
// Load local PHP file if it exists
if (file_exists($phpfile)) {
$TRANSLATE->addTranslationFile('phparray', $phpfile, 'glpi', $trytoload);
}
// Load local MO file if it exists -- keep last so it gets precedence
if (file_exists($mofile)) {
$TRANSLATE->addTranslationFile('gettext', $mofile, 'glpi', $trytoload);
}
}
// Load plugin dicts
......
......@@ -36,8 +36,8 @@ layout: default
title: GLPI Nightly Builds
---
Built on $( date -u +'%F %H:%M:%S UTC' )
Version|Archive|Build date|Size
---|---|---|---
HEADER
for file in $*
......@@ -45,12 +45,14 @@ do
NAME="${file#glpi/}"
BRANCH="${NAME%.*.tar.gz}"
SIZE=$( stat -c %s "$file" )
read DATE TIME TZ <<<$(git log -n1 --pretty=%ci -- $file)
[ "$TZ" == "+0000" ] && TZ="UTC"
cat <<DESCRIPTION
## $BRANCH
Archive|Size
---|---
[$NAME]($NAME)|$SIZE
$BRANCH|[$NAME]($NAME)|$DATE $TIME $TZ|$SIZE
DESCRIPTION
done
cat <<FOOTER
<font size="1">Page generated on $( date -u +'%F %H:%M:%S UTC' )</font>
FOOTER
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment