Pārlūkot izejas kodu

code syntax datapolicy dav debugbar directories

Frédéric FRANCE 4 gadi atpakaļ
vecāks
revīzija
ef28a76ad0

+ 8 - 11
htdocs/datapolicy/admin/setup.php

@@ -33,7 +33,9 @@ $langs->load('members');
 $langs->load('datapolicy@datapolicy');
 
 // Access control
-if (!$user->admin) accessforbidden();
+if (!$user->admin) {
+	accessforbidden();
+}
 
 // Parameters
 $action = GETPOST('action', 'aZ09');
@@ -104,8 +106,7 @@ print dol_get_fiche_head($head, 'settings', '', -1, "datapolicy@datapolicy");
 echo '<span class="opacitymedium">'.$langs->trans("datapolicySetupPage").'</span><br><br>';
 
 
-if ($action == 'edit')
-{
+if ($action == 'edit') {
 	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
 	print '<input type="hidden" name="token" value="'.newToken().'">';
 	print '<input type="hidden" name="action" value="update">';
@@ -113,11 +114,9 @@ if ($action == 'edit')
 	print '<table class="noborder centpercent">';
 	print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
 
-	foreach ($arrayofparameters as $title => $tab)
-	{
+	foreach ($arrayofparameters as $title => $tab) {
 		print '<tr class="trforbreak"><td class="titlefield trforbreak" colspan="2">'.$langs->trans($title).'</td></tr>';
-		foreach ($tab as $key => $val)
-		{
+		foreach ($tab as $key => $val) {
 			print '<tr class="oddeven"><td>';
 			print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
 			print '</td><td>';
@@ -144,11 +143,9 @@ if ($action == 'edit')
 	print '<table class="noborder centpercent">';
 	print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
 
-	foreach ($arrayofparameters as $title => $tab)
-	{
+	foreach ($arrayofparameters as $title => $tab) {
 		print '<tr class="trforbreak"><td class="titlefield trforbreak" colspan="2">'.$langs->trans($title).'</td></tr>';
-		foreach ($tab as $key => $val)
-		{
+		foreach ($tab as $key => $val) {
 			print '<tr class="oddeven"><td>';
 			print $form->textwithpicto($langs->trans($key), $langs->trans('DATAPOLICY_Tooltip_SETUP'));
 			print '</td><td>'.($conf->global->$key == '' ? $langs->trans('None') : $valTab[$conf->global->$key]).'</td></tr>';

+ 4 - 2
htdocs/datapolicy/admin/setupmail.php

@@ -39,8 +39,9 @@ if (GETPOST('l')) {
 	$l = $langs->defaultlang;
 }
 // Access control
-if (!$user->admin)
+if (!$user->admin) {
 	accessforbidden();
+}
 
 /*
  * Actions
@@ -62,8 +63,9 @@ if ($action == 'setvalue' && $user->admin) {
 	$result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity);
 	$sub = "DATAPOLICIESREFUSE_".$l;
 	$result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity);
-	if (!$result > 0)
+	if (!$result > 0) {
 		$error++;
+	}
 	if (!$error) {
 		$db->commit();
 		setEventMessage($langs->trans("SetupSaved"));

+ 1 - 2
htdocs/datapolicy/class/actions_datapolicy.class.php

@@ -332,8 +332,7 @@ class ActionsDatapolicy
 		global $conf, $user, $langs;
 		$langs->load('datapolicy@datapolicy');
 
-		if (!empty($conf->global->DATAPOLICIES_ENABLE_EMAILS))
-		{
+		if (!empty($conf->global->DATAPOLICIES_ENABLE_EMAILS)) {
 			$dialog = '<div id="dialogdatapolicy" style="display:none;" title="'.$langs->trans('DATAPOLICIES_PORTABILITE_TITLE').'">';
 			$dialog .= '<div class="confirmmessage">'.img_help('', '').' '.$langs->trans('DATAPOLICIES_PORTABILITE_CONFIRMATION').'</div>';
 			$dialog .= "</div>";

+ 2 - 1
htdocs/datapolicy/class/datapolicy.class.php

@@ -194,8 +194,9 @@ class DataPolicy
 		$actiontypecode = 'AC_EMAIL';
 		$actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto;
 		if ($message) {
-			if ($sendtocc)
+			if ($sendtocc) {
 				$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc').": ".$sendtocc);
+			}
 				$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic').": ".$subject);
 				$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody').":");
 				$actionmsg = dol_concatdesc($actionmsg, $message);

+ 9 - 18
htdocs/datapolicy/class/datapolicycron.class.php

@@ -464,43 +464,36 @@ class DataPolicyCron
 
 		$this->db->begin();
 
-		foreach ($arrayofparameters as $key => $params)
-		{
-			if ($conf->global->$key != '' && is_numeric($conf->global->$key) && (int) $conf->global->$key > 0)
-			{
+		foreach ($arrayofparameters as $key => $params) {
+			if ($conf->global->$key != '' && is_numeric($conf->global->$key) && (int) $conf->global->$key > 0) {
 				$sql = sprintf($params['sql'], (int) $conf->entity, (int) $conf->global->$key, (int) $conf->global->$key);
 
 				$resql = $this->db->query($sql);
 
-				if ($resql && $this->db->num_rows($resql) > 0)
-				{
+				if ($resql && $this->db->num_rows($resql) > 0) {
 					$num = $this->db->num_rows($resql);
 					$i = 0;
 
 					require_once $params['file'];
 					$object = new $params['class']($this->db);
 
-					while ($i < $num && !$error)
-					{
+					while ($i < $num && !$error) {
 						$obj = $this->db->fetch_object($resql);
 
 						$object->fetch($obj->rowid);
 						$object->id = $obj->rowid;
 
-						if ($object->isObjectUsed($obj->rowid) > 0)			// If object to clean is used
-						{
+						if ($object->isObjectUsed($obj->rowid) > 0) {			// If object to clean is used
 							foreach ($params['fields_anonym'] as $fields => $val) {
 								$object->$fields = $val;
 							}
 							$result = $object->update($obj->rowid, $user);
-							if ($result > 0)
-							{
+							if ($result > 0) {
 								if ($params['class'] == 'Societe') {
 									// We delete contacts of thirdparty
 									$sql = "DELETE FROM ".MAIN_DB_PREFIX."socpeople WHERE fk_soc = ".$obj->rowid;
 									$result = $this->db->query($sql);
-									if ($result < 0)
-									{
+									if ($result < 0) {
 										$errormsg = $this->db->lasterror();
 										$error++;
 									}
@@ -516,8 +509,7 @@ class DataPolicyCron
 							} else {
 								$result = $object->delete($user);
 							}
-							if ($result < 0)
-							{
+							if ($result < 0) {
 								$errormsg = $object->error;
 								$error++;
 							}
@@ -533,8 +525,7 @@ class DataPolicyCron
 
 		$this->db->commit();
 
-		if (!$error)
-		{
+		if (!$error) {
 			$this->output = $nbupdated.' record updated, '.$nbdeleted.' record deleted';
 		} else {
 			$this->error = $errormsg;

+ 8 - 8
htdocs/datapolicy/mailing.php

@@ -29,13 +29,13 @@ require_once DOL_DOCUMENT_ROOT.'/datapolicy/class/datapolicy.class.php';
 $idcontact = GETPOST('idc');
 
 if (!empty($idcontact)) {
-    $contact = new Contact($db);
-    $contact->fetch($idcontact);
-    DataPolicy::sendMailDataPolicyContact($contact);
+	$contact = new Contact($db);
+	$contact->fetch($idcontact);
+	DataPolicy::sendMailDataPolicyContact($contact);
 } else {
-    $contacts = new DataPolicy($db);
-    $contacts->getAllContactNotInformed();
-    $contacts->getAllCompaniesNotInformed();
-    $contacts->getAllAdherentsNotInformed();
-    echo $langs->trans('AllAgreementSend');
+	$contacts = new DataPolicy($db);
+	$contacts->getAllContactNotInformed();
+	$contacts->getAllCompaniesNotInformed();
+	$contacts->getAllAdherentsNotInformed();
+	echo $langs->trans('AllAgreementSend');
 }

+ 6 - 3
htdocs/datapolicy/public/index.php

@@ -22,12 +22,15 @@
  * \brief   datapolicy setup page.
  */
 
-if (!defined('NOLOGIN'))
+if (!defined('NOLOGIN')) {
 	define("NOLOGIN", 1); // This means this output page does not require to be logged.
-if (!defined('NOCSRFCHECK'))
+}
+if (!defined('NOCSRFCHECK')) {
 	define('NOCSRFCHECK', '1'); // Do not check anti CSRF attack test
-if (!defined('NOREQUIREMENU'))
+}
+if (!defined('NOREQUIREMENU')) {
 	define('NOREQUIREMENU', '1');
+}
 
 require '../../main.inc.php';
 require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';

+ 53 - 45
htdocs/dav/dav.class.php

@@ -82,8 +82,7 @@ class CdavLib
 						LEFT OUTER JOIN '.MAIN_DB_PREFIX.'user AS u ON (u.rowid=fk_element)
 						WHERE ar.element_type=\'user\' AND fk_actioncomm=a.id) AS other_users
 				FROM '.MAIN_DB_PREFIX.'actioncomm AS a';
-		if (!$this->user->rights->societe->client->voir)//FIXME si 'voir' on voit plus de chose ?
-		{
+		if (!$this->user->rights->societe->client->voir) {//FIXME si 'voir' on voit plus de chose ?
 			$sql .= ' LEFT OUTER JOIN '.MAIN_DB_PREFIX.'societe_commerciaux AS sc ON (a.fk_soc = sc.fk_soc AND sc.fk_user='.$this->user->id.')
 					LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON (s.rowid = sc.fk_soc)
 					LEFT JOIN '.MAIN_DB_PREFIX.'socpeople AS sp ON (sp.fk_soc = sc.fk_soc AND sp.rowid = a.fk_contact)
@@ -100,8 +99,7 @@ class CdavLib
 						AND a.code IN (SELECT cac.code FROM '.MAIN_DB_PREFIX.'c_actioncomm cac WHERE cac.type<>\'systemauto\')
 						AND a.entity IN ('.getEntity('societe', 1).')';
 		if ($oid !== false) {
-			if ($ouri === false)
-			{
+			if ($ouri === false) {
 				$sql .= ' AND a.id = '.intval($oid);
 			} else {
 				$sql .= ' AND (a.id = '.intval($oid).' OR ac.uuidext = \''.$this->db->escape($ouri).'\')';
@@ -130,8 +128,7 @@ class CdavLib
 		$location = $obj->location;
 
 		// contact address
-		if (empty($location) && !empty($obj->address))
-		{
+		if (empty($location) && !empty($obj->address)) {
 			$location = trim(str_replace(array("\r", "\t", "\n"), ' ', $obj->address));
 			$location = trim($location.', '.$obj->zip);
 			$location = trim($location.' '.$obj->town);
@@ -139,8 +136,7 @@ class CdavLib
 		}
 
 		// contact address
-		if (empty($location) && !empty($obj->soc_address))
-		{
+		if (empty($location) && !empty($obj->soc_address)) {
 			$location = trim(str_replace(array("\r", "\t", "\n"), ' ', $obj->soc_address));
 			$location = trim($location.', '.$obj->soc_zip);
 			$location = trim($location.' '.$obj->soc_town);
@@ -148,16 +144,17 @@ class CdavLib
 		}
 
 		$address = explode("\n", $obj->address, 2);
-		foreach ($address as $kAddr => $vAddr)
-		{
+		foreach ($address as $kAddr => $vAddr) {
 			$address[$kAddr] = trim(str_replace(array("\r", "\t"), ' ', str_replace("\n", ' | ', trim($vAddr))));
 		}
 		$address[] = '';
 		$address[] = '';
 
-		if ($obj->percent == -1 && trim($obj->datep) != '')
+		if ($obj->percent == -1 && trim($obj->datep) != '') {
 			$type = 'VEVENT';
-		else $type = 'VTODO';
+		} else {
+			$type = 'VTODO';
+		}
 
 		$timezone = date_default_timezone_get();
 
@@ -169,60 +166,72 @@ class CdavLib
 		$caldata .= "CREATED:".gmdate('Ymd\THis', strtotime($obj->datec))."Z\n";
 		$caldata .= "LAST-MODIFIED:".gmdate('Ymd\THis', strtotime($obj->lastupd))."Z\n";
 		$caldata .= "DTSTAMP:".gmdate('Ymd\THis', strtotime($obj->lastupd))."Z\n";
-		if ($obj->sourceuid == '')
+		if ($obj->sourceuid == '') {
 			$caldata .= "UID:".$obj->id.'-ev-'.$calid.'-cal-'.constant('CDAV_URI_KEY')."\n";
-		else $caldata .= "UID:".$obj->sourceuid."\n";
+		} else {
+			$caldata .= "UID:".$obj->sourceuid."\n";
+		}
 		$caldata .= "SUMMARY:".$obj->label."\n";
 		$caldata .= "LOCATION:".$location."\n";
 		$caldata .= "PRIORITY:".$obj->priority."\n";
-		if ($obj->fulldayevent)
-		{
+		if ($obj->fulldayevent) {
 			$caldata .= "DTSTART;VALUE=DATE:".date('Ymd', strtotime($obj->datep))."\n";
-			if ($type == 'VEVENT')
-			{
-				if (trim($obj->datep2) != '')
+			if ($type == 'VEVENT') {
+				if (trim($obj->datep2) != '') {
 					$caldata .= "DTEND;VALUE=DATE:".date('Ymd', strtotime($obj->datep2) + 1)."\n";
-				else $caldata .= "DTEND;VALUE=DATE:".date('Ymd', strtotime($obj->datep) + (25 * 3600))."\n";
-			} elseif (trim($obj->datep2) != '')
+				} else {
+					$caldata .= "DTEND;VALUE=DATE:".date('Ymd', strtotime($obj->datep) + (25 * 3600))."\n";
+				}
+			} elseif (trim($obj->datep2) != '') {
 				$caldata .= "DUE;VALUE=DATE:".date('Ymd', strtotime($obj->datep2) + 1)."\n";
+			}
 		} else {
 			$caldata .= "DTSTART;TZID=".$timezone.":".strtr($obj->datep, array(" "=>"T", ":"=>"", "-"=>""))."\n";
-			if ($type == 'VEVENT')
-			{
-				if (trim($obj->datep2) != '')
+			if ($type == 'VEVENT') {
+				if (trim($obj->datep2) != '') {
 					$caldata .= "DTEND;TZID=".$timezone.":".strtr($obj->datep2, array(" "=>"T", ":"=>"", "-"=>""))."\n";
-				else $caldata .= "DTEND;TZID=".$timezone.":".strtr($obj->datep, array(" "=>"T", ":"=>"", "-"=>""))."\n";
-			} elseif (trim($obj->datep2) != '')
+				} else {
+					$caldata .= "DTEND;TZID=".$timezone.":".strtr($obj->datep, array(" "=>"T", ":"=>"", "-"=>""))."\n";
+				}
+			} elseif (trim($obj->datep2) != '') {
 				$caldata .= "DUE;TZID=".$timezone.":".strtr($obj->datep2, array(" "=>"T", ":"=>"", "-"=>""))."\n";
+			}
 		}
 		$caldata .= "CLASS:PUBLIC\n";
-		if ($obj->transparency == 1)
+		if ($obj->transparency == 1) {
 			$caldata .= "TRANSP:TRANSPARENT\n";
-		else $caldata .= "TRANSP:OPAQUE\n";
+		} else {
+			$caldata .= "TRANSP:OPAQUE\n";
+		}
 
-		if ($type == 'VEVENT')
+		if ($type == 'VEVENT') {
 			$caldata .= "STATUS:CONFIRMED\n";
-		elseif ($obj->percent == 0)
+		} elseif ($obj->percent == 0) {
 			$caldata .= "STATUS:NEEDS-ACTION\n";
-		elseif ($obj->percent == 100)
+		} elseif ($obj->percent == 100) {
 			$caldata .= "STATUS:COMPLETED\n";
-		else {
+		} else {
 			$caldata .= "STATUS:IN-PROCESS\n";
 			$caldata .= "PERCENT-COMPLETE:".$obj->percent."\n";
 		}
 
 		$caldata .= "DESCRIPTION:";
 		$caldata .= strtr($obj->note, array("\n"=>"\\n", "\r"=>""));
-		if (!empty($obj->soc_nom))
+		if (!empty($obj->soc_nom)) {
 			$caldata .= "\\n*DOLIBARR-SOC: ".$obj->soc_nom;
-		if (!empty($obj->soc_phone))
+		}
+		if (!empty($obj->soc_phone)) {
 			$caldata .= "\\n*DOLIBARR-SOC-TEL: ".$obj->soc_phone;
-		if (!empty($obj->firstname) || !empty($obj->lastname))
+		}
+		if (!empty($obj->firstname) || !empty($obj->lastname)) {
 			$caldata .= "\\n*DOLIBARR-CTC: ".trim($obj->firstname.' '.$obj->lastname);
-		if (!empty($obj->phone) || !empty($obj->phone_perso) || !empty($obj->phone_mobile))
+		}
+		if (!empty($obj->phone) || !empty($obj->phone_perso) || !empty($obj->phone_mobile)) {
 			$caldata .= "\\n*DOLIBARR-CTC-TEL: ".trim($obj->phone.' '.$obj->phone_perso.' '.$obj->phone_mobile);
-		if (strpos($obj->other_users, ',')) // several
+		}
+		if (strpos($obj->other_users, ',')) { // several
 			$caldata .= "\\n*DOLIBARR-USR: ".$obj->other_users;
+		}
 		$caldata .= "\n";
 
 		$caldata .= "END:".$type."\n";
@@ -243,24 +252,23 @@ class CdavLib
 		$calid = ($calendarId * 1);
 		$calevents = array();
 
-		if (!$this->user->rights->agenda->myactions->read)
+		if (!$this->user->rights->agenda->myactions->read) {
 			return $calevents;
+		}
 
-		if ($calid != $this->user->id && (!isset($this->user->rights->agenda->allactions->read) || !$this->user->rights->agenda->allactions->read))
+		if ($calid != $this->user->id && (!isset($this->user->rights->agenda->allactions->read) || !$this->user->rights->agenda->allactions->read)) {
 			return $calevents;
+		}
 
 		$sql = $this->getSqlCalEvents($calid);
 
 		$result = $this->db->query($sql);
 
-		if ($result)
-		{
-			while ($obj = $this->db->fetch_object($result))
-			{
+		if ($result) {
+			while ($obj = $this->db->fetch_object($result)) {
 				$calendardata = $this->toVCalendar($calid, $obj);
 
-				if ($bCalendarData)
-				{
+				if ($bCalendarData) {
 					$calevents[] = array(
 						'calendardata' => $calendardata,
 						'uri' => $obj->id.'-ev-'.constant('CDAV_URI_KEY'),

+ 10 - 8
htdocs/dav/dav.lib.php

@@ -22,19 +22,21 @@
  */
 
 // define CDAV_CONTACT_TAG if not
-if (!defined('CDAV_CONTACT_TAG'))
-{
-	if (isset($conf->global->CDAV_CONTACT_TAG))
+if (!defined('CDAV_CONTACT_TAG')) {
+	if (isset($conf->global->CDAV_CONTACT_TAG)) {
 		define('CDAV_CONTACT_TAG', $conf->global->CDAV_CONTACT_TAG);
-	else define('CDAV_CONTACT_TAG', '');
+	} else {
+		define('CDAV_CONTACT_TAG', '');
+	}
 }
 
 // define CDAV_URI_KEY if not
-if (!defined('CDAV_URI_KEY'))
-{
-	if (isset($conf->global->CDAV_URI_KEY))
+if (!defined('CDAV_URI_KEY')) {
+	if (isset($conf->global->CDAV_URI_KEY)) {
 		define('CDAV_URI_KEY', $conf->global->CDAV_URI_KEY);
-	else define('CDAV_URI_KEY', substr(md5($_SERVER['HTTP_HOST']), 0, 8));
+	} else {
+		define('CDAV_URI_KEY', substr(md5($_SERVER['HTTP_HOST']), 0, 8));
+	}
 }
 
 

+ 46 - 36
htdocs/dav/fileserver.php

@@ -25,12 +25,24 @@
  *      \brief      Server DAV
  */
 
-if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
-if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1'); // If there is no menu to show
-if (!defined('NOREQUIREHTML'))  define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
-if (!defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
-if (!defined('NOLOGIN'))  		 define("NOLOGIN", 1); // This means this output page does not require to be logged.
-if (!defined('NOCSRFCHECK'))  	 define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
+if (!defined('NOTOKENRENEWAL')) {
+	define('NOTOKENRENEWAL', '1');
+}
+if (!defined('NOREQUIREMENU')) {
+	define('NOREQUIREMENU', '1'); // If there is no menu to show
+}
+if (!defined('NOREQUIREHTML')) {
+	define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
+}
+if (!defined('NOREQUIREAJAX')) {
+	define('NOREQUIREAJAX', '1');
+}
+if (!defined('NOLOGIN')) {
+	define("NOLOGIN", 1); // This means this output page does not require to be logged.
+}
+if (!defined('NOCSRFCHECK')) {
+	define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
+}
 
 require "../main.inc.php";
 require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
@@ -41,8 +53,7 @@ require_once DOL_DOCUMENT_ROOT.'/includes/sabre/autoload.php';
 
 
 $user = new User($db);
-if (isset($_SERVER['PHP_AUTH_USER']) && $_SERVER['PHP_AUTH_USER'] != '')
-{
+if (isset($_SERVER['PHP_AUTH_USER']) && $_SERVER['PHP_AUTH_USER'] != '') {
 	$user->fetch('', $_SERVER['PHP_AUTH_USER']);
 	$user->getrights();
 }
@@ -51,17 +62,16 @@ if (isset($_SERVER['PHP_AUTH_USER']) && $_SERVER['PHP_AUTH_USER'] != '')
 $langs->loadLangs(array("main", "other"));
 
 
-if (empty($conf->dav->enabled))
+if (empty($conf->dav->enabled)) {
 	accessforbidden();
+}
 
 
 // Restrict API to some IPs
-if (!empty($conf->global->DAV_RESTRICT_ON_IP))
-{
+if (!empty($conf->global->DAV_RESTRICT_ON_IP)) {
 	$allowedip = explode(' ', $conf->global->DAV_RESTRICT_ON_IP);
 	$ipremote = getUserRemoteIP();
-	if (!in_array($ipremote, $allowedip))
-	{
+	if (!in_array($ipremote, $allowedip)) {
 		dol_syslog('Remote ip is '.$ipremote.', not into list '.$conf->global->DAV_RESTRICT_ON_IP);
 		print 'DAV not allowed from the IP '.$ipremote;
 		header('HTTP/1.1 503 DAV not allowed from your IP '.$ipremote);
@@ -87,31 +97,30 @@ $authBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack(function ($username, $p
 	global $conf;
 	global $dolibarr_main_authentication, $dolibarr_auto_user;
 
-	if (empty($user->login))
-	{
+	if (empty($user->login)) {
 		dol_syslog("Failed to authenticate to DAV, login is not provided", LOG_WARNING);
 		return false;
 	}
-	if ($user->socid > 0)
-	{
+	if ($user->socid > 0) {
 		dol_syslog("Failed to authenticate to DAV, use is an external user", LOG_WARNING);
 		return false;
 	}
-	if ($user->login != $username)
-	{
+	if ($user->login != $username) {
 		dol_syslog("Failed to authenticate to DAV, login does not match the login of loaded user", LOG_WARNING);
 		return false;
 	}
 
 	// Authentication mode
-	if (empty($dolibarr_main_authentication)) $dolibarr_main_authentication = 'dolibarr';
+	if (empty($dolibarr_main_authentication)) {
+		$dolibarr_main_authentication = 'dolibarr';
+	}
 
 	// Authentication mode: forceuser
-	if ($dolibarr_main_authentication == 'forceuser')
-	{
-		if (empty($dolibarr_auto_user)) $dolibarr_auto_user = 'auto';
-		if ($dolibarr_auto_user != $username)
-		{
+	if ($dolibarr_main_authentication == 'forceuser') {
+		if (empty($dolibarr_auto_user)) {
+			$dolibarr_auto_user = 'auto';
+		}
+		if ($dolibarr_auto_user != $username) {
 			dol_syslog("Warning: your instance is set to use the automatic forced login '".$dolibarr_auto_user."' that is not the requested login. DAV usage is forbidden in this mode.");
 			return false;
 		}
@@ -120,8 +129,9 @@ $authBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack(function ($username, $p
 	$authmode = explode(',', $dolibarr_main_authentication);
 	$entity = (GETPOST('entity', 'int') ? GETPOST('entity', 'int') : (!empty($conf->entity) ? $conf->entity : 1));
 
-	if (checkLoginPassEntity($username, $password, $entity, $authmode, 'dav') != $username)
+	if (checkLoginPassEntity($username, $password, $entity, $authmode, 'dav') != $username) {
 		return false;
+	}
 
 	return true;
 });
@@ -142,15 +152,13 @@ $nodes = array();
 
 // Enable directories and features according to DAV setup
 // Public dir
-if (!empty($conf->global->DAV_ALLOW_PUBLIC_DIR))
-{
+if (!empty($conf->global->DAV_ALLOW_PUBLIC_DIR)) {
 	$nodes[] = new \Sabre\DAV\FS\Directory($publicDir);
 }
 // Private dir
 $nodes[] = new \Sabre\DAV\FS\Directory($privateDir);
 // ECM dir
-if (!empty($conf->ecm->enabled) && !empty($conf->global->DAV_ALLOW_ECM_DIR))
-{
+if (!empty($conf->ecm->enabled) && !empty($conf->global->DAV_ALLOW_ECM_DIR)) {
 	$nodes[] = new \Sabre\DAV\FS\Directory($ecmDir);
 }
 
@@ -175,14 +183,15 @@ $server = new \Sabre\DAV\Server($nodes);
 // If you want to run the SabreDAV server in a custom location (using mod_rewrite for instance)
 // You can override the baseUri here.
 $baseUri = DOL_URL_ROOT.'/dav/fileserver.php/';
-if (isset($baseUri)) $server->setBaseUri($baseUri);
+if (isset($baseUri)) {
+	$server->setBaseUri($baseUri);
+}
 
 // Add authentication function
 if ((empty($conf->global->DAV_ALLOW_PUBLIC_DIR)
 	|| !preg_match('/'.preg_quote(DOL_URL_ROOT.'/dav/fileserver.php/public', '/').'/', $_SERVER["PHP_SELF"]))
 	&& !preg_match('/^sabreAction=asset&assetName=[a-zA-Z0-9%\-\/]+\.(png|css|woff|ico|ttf)$/', $_SERVER["QUERY_STRING"])	// URL for Sabre browser resources
-	)
-{
+	) {
 	//var_dump($_SERVER["QUERY_STRING"]);exit;
 	$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend));
 }
@@ -192,8 +201,7 @@ $lockPlugin = new \Sabre\DAV\Locks\Plugin($lockBackend);
 $server->addPlugin($lockPlugin);
 
 // Support for html frontend
-if (empty($conf->global->DAV_DISABLE_BROWSER))
-{
+if (empty($conf->global->DAV_DISABLE_BROWSER)) {
 	$browser = new \Sabre\DAV\Browser\Plugin();
 	$server->addPlugin($browser);
 }
@@ -213,4 +221,6 @@ $server->addPlugin($tempFF);
 // And off we go!
 $server->exec();
 
-if (is_object($db)) $db->close();
+if (is_object($db)) {
+	$db->close();
+}

+ 3 - 4
htdocs/debugbar/class/DataCollector/DolLogsCollector.php

@@ -2,6 +2,7 @@
 
 use DebugBar\DataCollector\MessagesCollector;
 use Psr\Log\LogLevel;
+
 //use ReflectionClass;
 
 /**
@@ -74,15 +75,13 @@ class DolLogsCollector extends MessagesCollector
 
 		$uselogfile = $conf->global->DEBUGBAR_USE_LOGFILE;
 
-		if ($uselogfile)
-		{
+		if ($uselogfile) {
 			$this->getStorageLogs($this->path);
 		} else {
 			$log_levels = $this->getLevels();
 
 			foreach ($conf->logbuffer as $line) {
-				if ($this->nboflines >= $this->maxnboflines)
-				{
+				if ($this->nboflines >= $this->maxnboflines) {
 					break;
 				}
 				foreach ($log_levels as $level_key => $level) {

+ 5 - 5
htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php

@@ -22,11 +22,11 @@ class DolRequestDataCollector extends RequestDataCollector
 			if (isset($GLOBALS[$var])) {
 				$arrayofvalues = $GLOBALS[$var];
 
-				if ($var == '_COOKIE')
-				{
-					foreach ($arrayofvalues as $key => $val)
-					{
-						if (preg_match('/^DOLSESSID_/', $key)) $arrayofvalues[$key] = '*****hidden*****';
+				if ($var == '_COOKIE') {
+					foreach ($arrayofvalues as $key => $val) {
+						if (preg_match('/^DOLSESSID_/', $key)) {
+							$arrayofvalues[$key] = '*****hidden*****';
+						}
 					}
 					//var_dump($arrayofvalues);
 				}

+ 0 - 1
htdocs/debugbar/class/DataCollector/DolTimeDataCollector.php

@@ -2,7 +2,6 @@
 
 use \DebugBar\DataCollector\TimeDataCollector;
 
-
 /**
  * DolTimeDataCollector class
  */

+ 1 - 0
htdocs/debugbar/class/DebugBar.php

@@ -4,6 +4,7 @@ dol_include_once('/debugbar/class/autoloader.php');
 
 use \DebugBar\DebugBar;
 use \DebugBar\DataCollector\PhpInfoCollector;
+
 dol_include_once('/debugbar/class/DataCollector/DolMessagesCollector.php');
 dol_include_once('/debugbar/class/DataCollector/DolRequestDataCollector.php');
 dol_include_once('/debugbar/class/DataCollector/DolConfigCollector.php');