Browse Source

Fix NOIPCHECK

Laurent Destailleur 7 years ago
parent
commit
decb93efa6
2 changed files with 23 additions and 14 deletions
  1. 12 9
      htdocs/document.php
  2. 11 5
      htdocs/viewimage.php

+ 12 - 9
htdocs/document.php

@@ -38,22 +38,25 @@ if (! defined('NOREQUIREHTML'))		define('NOREQUIREHTML','1');
 if (! defined('NOREQUIREAJAX'))		define('NOREQUIREAJAX','1');
 
 // For bittorent link, we don't need to load/check we are into a login session
-if (isset($_GET["modulepart"]) && $_GET["modulepart"] == 'bittorrent' && ! defined("NOLOGIN"))
+if (isset($_GET["modulepart"]) && $_GET["modulepart"] == 'bittorrent')
 {
-	define("NOLOGIN",1);
-	define("NOCSRFCHECK",1);	// We accept to go on this page from external web site.
+	if (! defined("NOLOGIN"))		define("NOLOGIN",1);
+	if (! defined("NOCSRFCHECK"))	define("NOCSRFCHECK",1);	// We accept to go on this page from external web site.
+	if (! defined("NOIPCHECK"))		define("NOIPCHECK",1);		// Do not check IP defined into conf $dolibarr_main_restrict_ip
 }
 // For direct external download link, we don't need to load/check we are into a login session
-if (isset($_GET["hashp"]) && ! defined("NOLOGIN"))
+if (isset($_GET["hashp"]))
 {
-	define("NOLOGIN",1);
-	define("NOCSRFCHECK",1);	// We accept to go on this page from external web site.
+	if (! defined("NOLOGIN"))		define("NOLOGIN",1);
+	if (! defined("NOCSRFCHECK"))	define("NOCSRFCHECK",1);	// We accept to go on this page from external web site.
+	if (! defined("NOIPCHECK"))		define("NOIPCHECK",1);		// Do not check IP defined into conf $dolibarr_main_restrict_ip
 }
 // Some value of modulepart can be used to get resources that are public so no login are required.
-if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'medias') && ! defined("NOLOGIN"))
+if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'medias'))
 {
-	define("NOLOGIN",1);
-	define("NOCSRFCHECK",1);	// We accept to go on this page from external web site.
+	if (! defined("NOLOGIN"))		define("NOLOGIN",1);
+	if (! defined("NOCSRFCHECK"))	define("NOCSRFCHECK",1);	// We accept to go on this page from external web site.
+	if (! defined("NOIPCHECK"))		define("NOIPCHECK",1);		// Do not check IP defined into conf $dolibarr_main_restrict_ip
 }
 
 /**

+ 11 - 5
htdocs/viewimage.php

@@ -37,19 +37,25 @@ if (! defined('NOREQUIREHTML'))		define('NOREQUIREHTML','1');
 if (! defined('NOREQUIREAJAX'))		define('NOREQUIREAJAX','1');
 
 // Some value of modulepart can be used to get resources that are public so no login are required.
-if ((isset($_GET["modulepart"]) && ($_GET["modulepart"] == 'mycompany' || $_GET["modulepart"] == 'companylogo')) && ! defined("NOLOGIN"))
+if ((isset($_GET["modulepart"]) && ($_GET["modulepart"] == 'mycompany' || $_GET["modulepart"] == 'companylogo')))
 {
-	define("NOLOGIN",'1');
+	if (! defined("NOLOGIN"))		define("NOLOGIN",1);
+	if (! defined("NOCSRFCHECK"))	define("NOCSRFCHECK",1);	// We accept to go on this page from external web site.
+	if (! defined("NOIPCHECK"))		define("NOIPCHECK",1);		// Do not check IP defined into conf $dolibarr_main_restrict_ip
 }
 // For direct external download link, we don't need to load/check we are into a login session
 if (isset($_GET["hashp"]) && ! defined("NOLOGIN"))
 {
-	define("NOLOGIN",1);
+	if (! defined("NOLOGIN"))		define("NOLOGIN",1);
+	if (! defined("NOCSRFCHECK"))	define("NOCSRFCHECK",1);	// We accept to go on this page from external web site.
+	if (! defined("NOIPCHECK"))		define("NOIPCHECK",1);		// Do not check IP defined into conf $dolibarr_main_restrict_ip
 }
 // Some value of modulepart can be used to get resources that are public so no login are required.
-if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'medias') && ! defined("NOLOGIN"))
+if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'medias'))
 {
-	define("NOLOGIN",'1');
+	if (! defined("NOLOGIN"))		define("NOLOGIN",1);
+	if (! defined("NOCSRFCHECK"))	define("NOCSRFCHECK",1);	// We accept to go on this page from external web site.
+	if (! defined("NOIPCHECK"))		define("NOIPCHECK",1);		// Do not check IP defined into conf $dolibarr_main_restrict_ip
 	// For multicompany
 	$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
 	if (is_numeric($entity)) define("DOLENTITY", $entity);