Test Failed
Push — master ( bff6d4...ed0f4f )
by Alxarafe
44:30
created
dolibarr/htdocs/core/class/html.form.class.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1995,28 +1995,28 @@
 block discarded – undo
1995 1995
 
1996 1996
                     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
1997 1997
                     /**
1998
-     * 	Return list of products for a customer
1999
-     *
2000
-     * 	@param      int		$selected           Preselected product
2001
-     * 	@param      string	$htmlname           Name of select html
2002
-     *  @param		string	$filtertype         Filter on product type (''=nofilter, 0=product, 1=service)
2003
-     * 	@param      int		$limit              Limit on number of returned lines
2004
-     * 	@param      int		$price_level        Level of price to show
2005
-     * 	@param      string	$filterkey          Filter on product
2006
-     * 	@param		int		$status             -1=Return all products, 0=Products not on sell, 1=Products on sell
2007
-     *  @param      int		$finished           Filter on finished field: 2=No filter
2008
-     *  @param      int		$outputmode         0=HTML select string, 1=Array
2009
-     *  @param      int		$socid     		    Thirdparty Id (to get also price dedicated to this customer)
2010
-     *  @param		string	$showempty		    '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.
2011
-     * 	@param		int		$forcecombo		    Force to use combo box
2012
-     *  @param      string  $morecss            Add more css on select
2013
-     *  @param      int     $hidepriceinlabel   1=Hide prices in label
2014
-     *  @param      string  $warehouseStatus    warehouse status filter, following comma separated filter options can be used
2015
-     * 										    'warehouseopen' = select products from open warehouses,
2016
-     * 										    'warehouseclosed' = select products from closed warehouses,
2017
-     * 										    'warehouseinternal' = select products from warehouses for internal correct/transfer only
2018
-     *  @return     array    				    Array of keys for json
2019
-     */
1998
+                     * 	Return list of products for a customer
1999
+                     *
2000
+                     * 	@param      int		$selected           Preselected product
2001
+                     * 	@param      string	$htmlname           Name of select html
2002
+                     *  @param		string	$filtertype         Filter on product type (''=nofilter, 0=product, 1=service)
2003
+                     * 	@param      int		$limit              Limit on number of returned lines
2004
+                     * 	@param      int		$price_level        Level of price to show
2005
+                     * 	@param      string	$filterkey          Filter on product
2006
+                     * 	@param		int		$status             -1=Return all products, 0=Products not on sell, 1=Products on sell
2007
+                     *  @param      int		$finished           Filter on finished field: 2=No filter
2008
+                     *  @param      int		$outputmode         0=HTML select string, 1=Array
2009
+                     *  @param      int		$socid     		    Thirdparty Id (to get also price dedicated to this customer)
2010
+                     *  @param		string	$showempty		    '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.
2011
+                     * 	@param		int		$forcecombo		    Force to use combo box
2012
+                     *  @param      string  $morecss            Add more css on select
2013
+                     *  @param      int     $hidepriceinlabel   1=Hide prices in label
2014
+                     *  @param      string  $warehouseStatus    warehouse status filter, following comma separated filter options can be used
2015
+                     * 										    'warehouseopen' = select products from open warehouses,
2016
+                     * 										    'warehouseclosed' = select products from closed warehouses,
2017
+                     * 										    'warehouseinternal' = select products from warehouses for internal correct/transfer only
2018
+                     *  @return     array    				    Array of keys for json
2019
+                     */
2020 2020
     function select_produits_list($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 20, $price_level = 0, $filterkey = '', $status = 1, $finished = 2, $outputmode = 0, $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '')
2021 2021
     {
2022 2022
         // phpcs:enable
Please login to merge, or discard this patch.
dolibarr/htdocs/viewimage.php 1 patch
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -40,23 +40,23 @@  discard block
 block discarded – undo
40 40
 // Note that only directory logo is free to access without login.
41 41
 if (isset($_GET["modulepart"]) && $_GET["modulepart"] == 'mycompany' && preg_match('/^\/?logos\//', $_GET['file']))
42 42
 {
43
-	if (! defined("NOLOGIN"))		define("NOLOGIN",1);
44
-	if (! defined("NOCSRFCHECK"))	define("NOCSRFCHECK",1);	// We accept to go on this page from external web site.
45
-	if (! defined("NOIPCHECK"))		define("NOIPCHECK",1);		// Do not check IP defined into conf $dolibarr_main_restrict_ip
43
+    if (! defined("NOLOGIN"))		define("NOLOGIN",1);
44
+    if (! defined("NOCSRFCHECK"))	define("NOCSRFCHECK",1);	// We accept to go on this page from external web site.
45
+    if (! defined("NOIPCHECK"))		define("NOIPCHECK",1);		// Do not check IP defined into conf $dolibarr_main_restrict_ip
46 46
 }
47 47
 // For direct external download link, we don't need to load/check we are into a login session
48 48
 if (isset($_GET["hashp"]) && ! defined("NOLOGIN"))
49 49
 {
50
-	if (! defined("NOLOGIN"))		define("NOLOGIN",1);
51
-	if (! defined("NOCSRFCHECK"))	define("NOCSRFCHECK",1);	// We accept to go on this page from external web site.
52
-	if (! defined("NOIPCHECK"))		define("NOIPCHECK",1);		// Do not check IP defined into conf $dolibarr_main_restrict_ip
50
+    if (! defined("NOLOGIN"))		define("NOLOGIN",1);
51
+    if (! defined("NOCSRFCHECK"))	define("NOCSRFCHECK",1);	// We accept to go on this page from external web site.
52
+    if (! defined("NOIPCHECK"))		define("NOIPCHECK",1);		// Do not check IP defined into conf $dolibarr_main_restrict_ip
53 53
 }
54 54
 // Some value of modulepart can be used to get resources that are public so no login are required.
55 55
 if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'medias'))
56 56
 {
57
-	if (! defined("NOLOGIN"))		define("NOLOGIN",1);
58
-	if (! defined("NOCSRFCHECK"))	define("NOCSRFCHECK",1);	// We accept to go on this page from external web site.
59
-	if (! defined("NOIPCHECK"))		define("NOIPCHECK",1);		// Do not check IP defined into conf $dolibarr_main_restrict_ip
57
+    if (! defined("NOLOGIN"))		define("NOLOGIN",1);
58
+    if (! defined("NOCSRFCHECK"))	define("NOCSRFCHECK",1);	// We accept to go on this page from external web site.
59
+    if (! defined("NOIPCHECK"))		define("NOIPCHECK",1);		// Do not check IP defined into conf $dolibarr_main_restrict_ip
60 60
 }
61 61
 
62 62
 // For multicompany
@@ -125,43 +125,43 @@  discard block
 block discarded – undo
125 125
 // If we have a hash public (hashp), we guess the original_file.
126 126
 if (! empty($hashp))
127 127
 {
128
-	include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
129
-	$ecmfile=new EcmFiles($db);
130
-	$result = $ecmfile->fetch(0, '', '', '', $hashp);
131
-	if ($result > 0)
132
-	{
133
-		$tmp = explode('/', $ecmfile->filepath, 2);		// $ecmfile->filepath is relative to document directory
134
-		// filepath can be 'users/X' or 'X/propale/PR11111'
135
-		if (is_numeric($tmp[0])) // If first tmp is numeric, it is subdir of company for multicompany, we take next part.
136
-		{
137
-			$tmp = explode('/', $tmp[1], 2);
138
-		}
139
-		$moduleparttocheck = $tmp[0];	// moduleparttocheck is first part of path
140
-
141
-		if ($modulepart)	// Not required, so often not defined, for link using public hashp parameter.
142
-		{
143
-			if ($moduleparttocheck == $modulepart)
144
-			{
145
-				// We remove first level of directory
146
-				$original_file = (($tmp[1]?$tmp[1].'/':'').$ecmfile->filename);		// this is relative to module dir
147
-				//var_dump($original_file); exit;
148
-			}
149
-			else
150
-			{
151
-				accessforbidden('Bad link. File is from another module part.',0,0,1);
152
-			}
153
-		}
154
-		else
155
-		{
156
-			$modulepart = $moduleparttocheck;
157
-			$original_file = (($tmp[1]?$tmp[1].'/':'').$ecmfile->filename);		// this is relative to module dir
158
-		}
159
-	}
160
-	else
161
-	{
162
-		$langs->load("errors");
163
-		accessforbidden($langs->trans("ErrorFileNotFoundWithSharedLink"),0,0,1);
164
-	}
128
+    include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
129
+    $ecmfile=new EcmFiles($db);
130
+    $result = $ecmfile->fetch(0, '', '', '', $hashp);
131
+    if ($result > 0)
132
+    {
133
+        $tmp = explode('/', $ecmfile->filepath, 2);		// $ecmfile->filepath is relative to document directory
134
+        // filepath can be 'users/X' or 'X/propale/PR11111'
135
+        if (is_numeric($tmp[0])) // If first tmp is numeric, it is subdir of company for multicompany, we take next part.
136
+        {
137
+            $tmp = explode('/', $tmp[1], 2);
138
+        }
139
+        $moduleparttocheck = $tmp[0];	// moduleparttocheck is first part of path
140
+
141
+        if ($modulepart)	// Not required, so often not defined, for link using public hashp parameter.
142
+        {
143
+            if ($moduleparttocheck == $modulepart)
144
+            {
145
+                // We remove first level of directory
146
+                $original_file = (($tmp[1]?$tmp[1].'/':'').$ecmfile->filename);		// this is relative to module dir
147
+                //var_dump($original_file); exit;
148
+            }
149
+            else
150
+            {
151
+                accessforbidden('Bad link. File is from another module part.',0,0,1);
152
+            }
153
+        }
154
+        else
155
+        {
156
+            $modulepart = $moduleparttocheck;
157
+            $original_file = (($tmp[1]?$tmp[1].'/':'').$ecmfile->filename);		// this is relative to module dir
158
+        }
159
+    }
160
+    else
161
+    {
162
+        $langs->load("errors");
163
+        accessforbidden($langs->trans("ErrorFileNotFoundWithSharedLink"),0,0,1);
164
+    }
165 165
 }
166 166
 
167 167
 // Define mime type
@@ -185,50 +185,50 @@  discard block
 block discarded – undo
185 185
 
186 186
 if (! empty($hashp))
187 187
 {
188
-	$accessallowed = 1;					// When using hashp, link is public so we force $accessallowed
189
-	$sqlprotectagainstexternals = '';
188
+    $accessallowed = 1;					// When using hashp, link is public so we force $accessallowed
189
+    $sqlprotectagainstexternals = '';
190 190
 }
191 191
 else
192 192
 {
193
-	// Basic protection (against external users only)
194
-	if ($user->societe_id > 0)
195
-	{
196
-		if ($sqlprotectagainstexternals)
197
-		{
198
-			$resql = $db->query($sqlprotectagainstexternals);
199
-			if ($resql)
200
-			{
201
-				$num=$db->num_rows($resql);
202
-				$i=0;
203
-				while ($i < $num)
204
-				{
205
-					$obj = $db->fetch_object($resql);
206
-					if ($user->societe_id != $obj->fk_soc)
207
-					{
208
-						$accessallowed=0;
209
-						break;
210
-					}
211
-					$i++;
212
-				}
213
-			}
214
-		}
215
-	}
193
+    // Basic protection (against external users only)
194
+    if ($user->societe_id > 0)
195
+    {
196
+        if ($sqlprotectagainstexternals)
197
+        {
198
+            $resql = $db->query($sqlprotectagainstexternals);
199
+            if ($resql)
200
+            {
201
+                $num=$db->num_rows($resql);
202
+                $i=0;
203
+                while ($i < $num)
204
+                {
205
+                    $obj = $db->fetch_object($resql);
206
+                    if ($user->societe_id != $obj->fk_soc)
207
+                    {
208
+                        $accessallowed=0;
209
+                        break;
210
+                    }
211
+                    $i++;
212
+                }
213
+            }
214
+        }
215
+    }
216 216
 }
217 217
 
218 218
 // Security:
219 219
 // Limit access if permissions are wrong
220 220
 if (! $accessallowed)
221 221
 {
222
-	accessforbidden();
222
+    accessforbidden();
223 223
 }
224 224
 
225 225
 // Security:
226 226
 // On interdit les remontees de repertoire ainsi que les pipe dans les noms de fichiers.
227 227
 if (preg_match('/\.\./',$fullpath_original_file) || preg_match('/[<>|]/',$fullpath_original_file))
228 228
 {
229
-	dol_syslog("Refused to deliver file ".$fullpath_original_file);
230
-	print "ErrorFileNameInvalid: ".$original_file;
231
-	exit;
229
+    dol_syslog("Refused to deliver file ".$fullpath_original_file);
230
+    print "ErrorFileNameInvalid: ".$original_file;
231
+    exit;
232 232
 }
233 233
 
234 234
 
Please login to merge, or discard this patch.