Browse Source

FIX Disable svg as supported image by default. Set
MAIN_ALLOW_SVG_FILES_AS_IMAGES to 1 to have svg working.

Laurent Destailleur 5 years ago
parent
commit
c6ee80eefd
3 changed files with 8 additions and 2 deletions
  1. 1 0
      htdocs/bookmarks/card.php
  2. 1 1
      htdocs/bookmarks/list.php
  3. 6 1
      htdocs/core/lib/images.lib.php

+ 1 - 0
htdocs/bookmarks/card.php

@@ -151,6 +151,7 @@ if ($action == 'create')
 	print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">'."\n";
 	print '<input type="hidden" name="token" value="'.newToken().'">';
 	print '<input type="hidden" name="action" value="add">';
+	print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
 
 	print load_fiche_titre($langs->trans("NewBookmark"));
 

+ 1 - 1
htdocs/bookmarks/list.php

@@ -158,7 +158,7 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
 
 $newcardbutton = '';
-$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create', '', !empty($user->rights->bookmark->creer));
+$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create&backtopage='.urlencode(DOL_URL_ROOT.'/bookmarks/list.php'), '', !empty($user->rights->bookmark->creer));
 
 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bookmark', 0, $newcardbutton, '', $limit, 0, 0, 1);
 

+ 6 - 1
htdocs/core/lib/images.lib.php

@@ -37,7 +37,12 @@ $quality = 80;
  */
 function image_format_supported($file)
 {
-    $regeximgext = '\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.webp|\.xpm|\.xbm|\.svg'; // See also into product.class.php
+	global $conf;
+
+    $regeximgext = '\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.webp|\.xpm|\.xbm'; // See also into product.class.php
+    if (! empty($conf->global->MAIN_ALLOW_PREVIEW_OF_UPLOADED_SVG_FILES)) {
+    	$regeximgext .= '|\.svg';		// Not allowed by default. SVG can contains javascript
+    }
 
     // Case filename is not a format image
     $reg = array();