Completed
Branch develop (88253b)
by
unknown
18:45
created
htdocs/admin/oauth.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
 
137 137
 
138 138
 				$sql = "UPDATE ".MAIN_DB_PREFIX."oauth_token";
139
-				$sql.= " SET service = '".$db->escape($oldprovider."-".$newlabel)."'";
140
-				$sql.= " WHERE  service = '".$db->escape($oldprovider."-".$oldlabel)."'";
139
+				$sql .= " SET service = '".$db->escape($oldprovider."-".$newlabel)."'";
140
+				$sql .= " WHERE  service = '".$db->escape($oldprovider."-".$oldlabel)."'";
141 141
 
142 142
 
143 143
 				$resql = $db->query($sql);
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 			$provider.'_NAME',
301 301
 			$provider.'_ID',
302 302
 			$provider.'_SECRET',
303
-			$provider.'_URL',	// For custom oauth links
303
+			$provider.'_URL', // For custom oauth links
304 304
 			$provider.'_SCOPE'	// For custom oauth links
305 305
 		);
306 306
 	}
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 	// $list is defined into oauth.lib.php to the list of supporter OAuth providers.
320 320
 	foreach ($listinsetup as $key) {
321 321
 		$supported = 0;
322
-		$keyforsupportedoauth2array = $key[0];						// May be OAUTH_GOOGLE_NAME or OAUTH_GOOGLE_xxx_NAME
322
+		$keyforsupportedoauth2array = $key[0]; // May be OAUTH_GOOGLE_NAME or OAUTH_GOOGLE_xxx_NAME
323 323
 		$keyforsupportedoauth2array = preg_replace('/^OAUTH_/', '', $keyforsupportedoauth2array);
324 324
 		$keyforsupportedoauth2array = preg_replace('/_NAME$/', '', $keyforsupportedoauth2array);
325 325
 		if (preg_match('/^.*-/', $keyforsupportedoauth2array)) {
Please login to merge, or discard this patch.
htdocs/admin/fediverse.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -236,7 +236,7 @@
 block discarded – undo
236 236
 		print '<table class="noborder centpercent">'."\n";
237 237
 
238 238
 		print '<tr class="liste_titre">';
239
-		print "<td>".$langs->trans("SocialNetworks")." ".($i+1)."</td>";
239
+		print "<td>".$langs->trans("SocialNetworks")." ".($i + 1)."</td>";
240 240
 		print '<td class="right">';
241 241
 		print '<a class="viewfielda reposition marginleftonly marginrighttonly showInputBtn" href="'.$_SERVER["PHP_SELF"].'?action=editsocialnetwork&token='.newToken().'&key='.urlencode($key).'">'.img_edit().'</a>';
242 242
 		print '<a class="deletefielda reposition marginleftonly right" href="'.$_SERVER["PHP_SELF"].'?action=deletesocialnetwork&token='.newToken().'&key='.urlencode($key).'">'.img_delete().'</a>';
Please login to merge, or discard this patch.
htdocs/admin/oauthlogintokens.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -166,13 +166,13 @@  discard block
 block discarded – undo
166 166
 		if ($apiService instanceof OAuth\OAuth2\Service\AbstractService || $apiService instanceof OAuth\OAuth1\Service\AbstractService) {
167 167
 			// ServiceInterface does not provide refreshAccessToekn, AbstractService does
168 168
 			dol_syslog("oauthlogintokens.php: call refreshAccessToken to get the new access token");
169
-			$tokenobj = $apiService->refreshAccessToken($tokenobj);		// This call refresh and store the new token (but does not include the refresh token)
169
+			$tokenobj = $apiService->refreshAccessToken($tokenobj); // This call refresh and store the new token (but does not include the refresh token)
170 170
 
171 171
 			dol_syslog("oauthlogintokens.php: call setRefreshToken");
172
-			$tokenobj->setRefreshToken($refreshtoken);	// Restore the refresh token
172
+			$tokenobj->setRefreshToken($refreshtoken); // Restore the refresh token
173 173
 
174 174
 			dol_syslog("oauthlogintokens.php: call storeAccessToken to save the new access token + the old refresh token");
175
-			$storage->storeAccessToken($OAUTH_SERVICENAME, $tokenobj);	// This save the new token including the refresh token
175
+			$storage->storeAccessToken($OAUTH_SERVICENAME, $tokenobj); // This save the new token including the refresh token
176 176
 
177 177
 			if ($expire) {
178 178
 				setEventMessages($langs->trans("OldTokenWasExpiredItHasBeenRefresh"), null, 'mesgs');
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 				$provider.'_NAME',
232 232
 				$provider.'_ID',
233 233
 				$provider.'_SECRET',
234
-				$provider.'_URL',			// For custom oauth links
234
+				$provider.'_URL', // For custom oauth links
235 235
 				$provider.'_SCOPE'			// For custom oauth links
236 236
 			);
237 237
 		}
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	if (!empty($listinsetup)) {
244 244
 		foreach ($listinsetup as $key) {
245 245
 			$supported = 0;
246
-			$keyforsupportedoauth2array = $key[0];						// May be OAUTH_GOOGLE_NAME or OAUTH_GOOGLE_xxx_NAME
246
+			$keyforsupportedoauth2array = $key[0]; // May be OAUTH_GOOGLE_NAME or OAUTH_GOOGLE_xxx_NAME
247 247
 			$keyforsupportedoauth2array = preg_replace('/^OAUTH_/', '', $keyforsupportedoauth2array);
248 248
 			$keyforsupportedoauth2array = preg_replace('/_NAME$/', '', $keyforsupportedoauth2array);
249 249
 			if (preg_match('/^.*-/', $keyforsupportedoauth2array)) {
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 			if (getDolGlobalString($key[4])) {
264 264
 				$shortscope = getDolGlobalString($key[4]);
265 265
 			}
266
-			$state = $shortscope;	// TODO USe a better state
266
+			$state = $shortscope; // TODO USe a better state
267 267
 
268 268
 			$urltorefresh = $_SERVER["PHP_SELF"].'?action=refreshtoken&token='.newToken();
269 269
 
Please login to merge, or discard this patch.
htdocs/contrat/card.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 $permissionnote = $user->hasRight('contrat', 'creer'); // Used by the include of actions_setnotes.inc.php
111 111
 $permissiondellink = $user->hasRight('contrat', 'creer'); // Used by the include of actions_dellink.inc.php
112 112
 $permissiontodelete = ($user->hasRight('contrat', 'creer') && $object->statut == $object::STATUS_DRAFT) || $user->hasRight('contrat', 'supprimer');
113
-$permissiontoadd   = $user->hasRight('contrat', 'creer');     //  Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
113
+$permissiontoadd   = $user->hasRight('contrat', 'creer'); //  Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
114 114
 $permissiontoedit = $permissiontoadd;
115 115
 $permissiontoactivate = $user->hasRight('contrat', 'activer');
116 116
 $error = 0;
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
 	include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once'
157 157
 
158
-	include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php';  // Must be 'include', not 'include_once'
158
+	include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be 'include', not 'include_once'
159 159
 
160 160
 	if ($action == 'confirm_active' && $confirm == 'yes' && $permissiontoactivate) {
161 161
 		$date_start = '';
@@ -533,8 +533,8 @@  discard block
 block discarded – undo
533 533
 					$result = $prodcustprice->fetchAll('', '', 0, 0, $filter);
534 534
 					if ($result) {
535 535
 						if (count($prodcustprice->lines) > 0) {
536
-							$price_min =  price($prodcustprice->lines[0]->price_min);
537
-							$price_min_ttc =  price($prodcustprice->lines[0]->price_min_ttc);
536
+							$price_min = price($prodcustprice->lines[0]->price_min);
537
+							$price_min_ttc = price($prodcustprice->lines[0]->price_min_ttc);
538 538
 							/*$tva_tx = $prodcustprice->lines[0]->tva_tx;
539 539
 							if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) {
540 540
 								$tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 			// update price_ht with discount
768 768
 			// TODO Use object->updateline instead objectline->update
769 769
 
770
-			$price_ht =  price2num(GETPOST('elprice'), 'MU');
770
+			$price_ht = price2num(GETPOST('elprice'), 'MU');
771 771
 			$remise_percent = price2num(GETPOST('elremise_percent'), '', 2);
772 772
 			if ($remise_percent > 0) {
773 773
 				$remise = round(((float) $price_ht * (float) $remise_percent / 100), 2);
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
 	} elseif ($action == 'confirm_activate' && $confirm == 'yes' && $user->hasRight('contrat', 'creer')) {
875 875
 		$date_start = dol_mktime(12, 0, 0, GETPOST('d_startmonth'), GETPOST('d_startday'), GETPOST('d_startyear'));
876 876
 		$date_end   = dol_mktime(12, 0, 0, GETPOST('d_endmonth'), GETPOST('d_endday'), GETPOST('d_endyear'));
877
-		$comment      = GETPOST('comment', 'alpha');
877
+		$comment = GETPOST('comment', 'alpha');
878 878
 		$result = $object->activateAll($user, $date_start, 0, $comment, $date_end);
879 879
 		if ($result < 0) {
880 880
 			setEventMessages($object->error, $object->errors, 'errors');
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
 		$morehtmlref .= '<div class="refidno">';
1409 1409
 		// Ref customer
1410 1410
 		$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->hasRight('contrat', 'creer'), 'string', '', 0, 1);
1411
-		$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->hasRight('contrat', 'creer'), 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':' . getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1, 'getFormatedCustomerRef');
1411
+		$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->hasRight('contrat', 'creer'), 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1, 'getFormatedCustomerRef');
1412 1412
 		// Ref supplier
1413 1413
 		$morehtmlref .= '<br>';
1414 1414
 		$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->hasRight('contrat', 'creer'), 'string', '', 0, 1);
@@ -1502,7 +1502,7 @@  discard block
 block discarded – undo
1502 1502
 		}
1503 1503
 
1504 1504
 
1505
-		$arrayothercontracts = $object->getListOfContracts('others');	// array or -1 if technical error
1505
+		$arrayothercontracts = $object->getListOfContracts('others'); // array or -1 if technical error
1506 1506
 
1507 1507
 		/*
1508 1508
 		 * Lines of contracts
@@ -1740,7 +1740,7 @@  discard block
 block discarded – undo
1740 1740
 					// Ligne carac
1741 1741
 					print '<tr class="oddeven">';
1742 1742
 					print '<td>';
1743
-					$currentLineProductId=GETPOSTISSET('idprod')?GETPOST('idprod'):(!empty($object->lines[$cursorline - 1]->fk_product) ? $object->lines[$cursorline - 1]->fk_product : 0);
1743
+					$currentLineProductId = GETPOSTISSET('idprod') ?GETPOST('idprod') : (!empty($object->lines[$cursorline - 1]->fk_product) ? $object->lines[$cursorline - 1]->fk_product : 0);
1744 1744
 					if ($objp->fk_product > 0) {
1745 1745
 						$canchangeproduct = 1;
1746 1746
 
@@ -1754,7 +1754,7 @@  discard block
 block discarded – undo
1754 1754
 							print $objp->label ? ' - '.dol_trunc($objp->label, 32) : '';
1755 1755
 							print '<input type="hidden" name="idprod" value="'.$currentLineProductId.'">';
1756 1756
 						} else {
1757
-							$senderissupplier = 0;	// @TODO Option to allow purchased products ?
1757
+							$senderissupplier = 0; // @TODO Option to allow purchased products ?
1758 1758
 							if (empty($senderissupplier)) {
1759 1759
 								print $form->select_produits($currentLineProductId, 'idprod', '', 0, 0, 1, 2, '', 0, array(), 0, 1, 0, 'minwidth250onall maxwidth500 widthcentpercentminusx');
1760 1760
 							} else {
@@ -1773,7 +1773,7 @@  discard block
 block discarded – undo
1773 1773
 					if (getDolGlobalString('MAIN_INPUT_DESC_HEIGHT')) {
1774 1774
 						$nbrows = getDolGlobalString('MAIN_INPUT_DESC_HEIGHT');
1775 1775
 					}
1776
-					$doleditor = new DolEditor('product_desc', (GETPOSTISSET('product_desc')?GETPOST('product_desc'):$objp->description), '', 92, 'dolibarr_details', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_DETAILS'), $nbrows, '90%');
1776
+					$doleditor = new DolEditor('product_desc', (GETPOSTISSET('product_desc') ?GETPOST('product_desc') : $objp->description), '', 92, 'dolibarr_details', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_DETAILS'), $nbrows, '90%');
1777 1777
 					$doleditor->Create();
1778 1778
 
1779 1779
 					print '</td>';
@@ -1784,7 +1784,7 @@  discard block
 block discarded – undo
1784 1784
 					print '</td>';
1785 1785
 
1786 1786
 					// Price
1787
-					print '<td class="right"><input class="width50" type="text" name="elprice" value="'.(GETPOSTISSET('elprice')?GETPOST('elprice'):price($objp->subprice)).'"></td>';
1787
+					print '<td class="right"><input class="width50" type="text" name="elprice" value="'.(GETPOSTISSET('elprice') ?GETPOST('elprice') : price($objp->subprice)).'"></td>';
1788 1788
 
1789 1789
 					// Price multicurrency
1790 1790
 					/*if (isModEnabled("multicurrency")) {
@@ -1792,24 +1792,24 @@  discard block
 block discarded – undo
1792 1792
 					 }*/
1793 1793
 
1794 1794
 					// Quantity
1795
-					print '<td class="center"><input size="2" type="text" name="elqty" value="'.(GETPOSTISSET('elqty')?GETPOST('elqty'):$objp->qty).'"></td>';
1795
+					print '<td class="center"><input size="2" type="text" name="elqty" value="'.(GETPOSTISSET('elqty') ?GETPOST('elqty') : $objp->qty).'"></td>';
1796 1796
 
1797 1797
 					// Unit
1798 1798
 					if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
1799 1799
 						print '<td class="left">';
1800
-						print $form->selectUnits((GETPOSTISSET('unit')?GETPOST('unit'):$objp->fk_unit), "unit");
1800
+						print $form->selectUnits((GETPOSTISSET('unit') ?GETPOST('unit') : $objp->fk_unit), "unit");
1801 1801
 						print '</td>';
1802 1802
 					}
1803 1803
 
1804 1804
 					// Discount
1805
-					print '<td class="nowraponall right"><input size="1" type="text" name="elremise_percent" value="'.(GETPOSTISSET('elremise_percent')?GETPOST('elremise_percent'):$objp->remise_percent).'">%</td>';
1805
+					print '<td class="nowraponall right"><input size="1" type="text" name="elremise_percent" value="'.(GETPOSTISSET('elremise_percent') ?GETPOST('elremise_percent') : $objp->remise_percent).'">%</td>';
1806 1806
 
1807 1807
 					if (!empty($usemargins)) {
1808 1808
 						print '<td class="right">';
1809 1809
 						if ($objp->fk_product) {
1810 1810
 							print '<select id="fournprice" name="fournprice"></select>';
1811 1811
 						}
1812
-						print '<input id="buying_price" type="text" class="width50" name="buying_price" value="'.price((GETPOSTISSET('buying_price')?GETPOST('buying_price'):$objp->pa_ht), 0, '', 0).'"></td>';
1812
+						print '<input id="buying_price" type="text" class="width50" name="buying_price" value="'.price((GETPOSTISSET('buying_price') ?GETPOST('buying_price') : $objp->pa_ht), 0, '', 0).'"></td>';
1813 1813
 					}
1814 1814
 					print '<td class="center">';
1815 1815
 					print '<input type="submit" class="button margintoponly marginbottomonly" name="save" value="'.$langs->trans("Modify").'">';
Please login to merge, or discard this patch.
htdocs/ticket/class/ticket.class.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -261,14 +261,14 @@  discard block
 block discarded – undo
261 261
 	/**
262 262
 	 * Status
263 263
 	 */
264
-	const STATUS_NOT_READ = 0;			// Draft. Not take into account yet.
265
-	const STATUS_READ = 1;				// Ticket was read.
266
-	const STATUS_ASSIGNED = 2;			// Ticket was just assigned to someone. Not in progress yet.
267
-	const STATUS_IN_PROGRESS = 3;		// In progress
268
-	const STATUS_NEED_MORE_INFO = 5;	// Waiting requester feedback
269
-	const STATUS_WAITING = 7;			// On hold
270
-	const STATUS_CLOSED = 8;			// Closed - Solved
271
-	const STATUS_CANCELED = 9;			// Closed - Not solved
264
+	const STATUS_NOT_READ = 0; // Draft. Not take into account yet.
265
+	const STATUS_READ = 1; // Ticket was read.
266
+	const STATUS_ASSIGNED = 2; // Ticket was just assigned to someone. Not in progress yet.
267
+	const STATUS_IN_PROGRESS = 3; // In progress
268
+	const STATUS_NEED_MORE_INFO = 5; // Waiting requester feedback
269
+	const STATUS_WAITING = 7; // On hold
270
+	const STATUS_CLOSED = 8; // Closed - Solved
271
+	const STATUS_CANCELED = 9; // Closed - Not solved
272 272
 
273 273
 
274 274
 	/**
@@ -1597,9 +1597,9 @@  discard block
 block discarded – undo
1597 1597
 		}
1598 1598
 		// show categories for this record only in ajax to not overload lists
1599 1599
 		if (isModEnabled('category') && !$nofetch) {
1600
-			require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
1600
+			require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
1601 1601
 			$form = new Form($this->db);
1602
-			$datas['categories'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_TICKET, 1);
1602
+			$datas['categories'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_TICKET, 1);
1603 1603
 		}
1604 1604
 
1605 1605
 		return $datas;
@@ -1838,7 +1838,7 @@  discard block
 block discarded – undo
1838 1838
 		// Insert entry into agenda with code 'TICKET_MSG'
1839 1839
 		include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
1840 1840
 		$actioncomm = new ActionComm($this->db);
1841
-		$actioncomm->type_code = 'AC_OTH_AUTO';	// This is not an entry that must appears into manual calendar but only into CRM calendar
1841
+		$actioncomm->type_code = 'AC_OTH_AUTO'; // This is not an entry that must appears into manual calendar but only into CRM calendar
1842 1842
 		$actioncomm->code = 'TICKET_MSG';
1843 1843
 		if ($this->private) {
1844 1844
 			$actioncomm->code = 'TICKET_MSG_PRIVATE';
@@ -1852,7 +1852,7 @@  discard block
 block discarded – undo
1852 1852
 		$actioncomm->socid = $this->socid;
1853 1853
 		$actioncomm->label = $this->subject;
1854 1854
 		$actioncomm->note_private = $this->message;
1855
-		$actioncomm->userassigned = array($user->id => array('id' => $user->id,'transparency' => 0));
1855
+		$actioncomm->userassigned = array($user->id => array('id' => $user->id, 'transparency' => 0));
1856 1856
 		$actioncomm->userownerid = $user->id;
1857 1857
 		$actioncomm->datep = $now;
1858 1858
 		$actioncomm->percentage = -1; // percentage is not relevant for punctual events
@@ -1900,7 +1900,7 @@  discard block
 block discarded – undo
1900 1900
 					if (dol_mkdir($destdir) >= 0) {
1901 1901
 						require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
1902 1902
 						dol_move($filespath, $destfile);
1903
-						if (in_array($actioncomm->code,  array('TICKET_MSG', 'TICKET_MSG_SENTBYMAIL'))) {
1903
+						if (in_array($actioncomm->code, array('TICKET_MSG', 'TICKET_MSG_SENTBYMAIL'))) {
1904 1904
 							$ecmfile = new EcmFiles($this->db);
1905 1905
 							$destdir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $destdir);
1906 1906
 							$destdir = preg_replace('/[\\/]$/', '', $destdir);
@@ -2427,7 +2427,7 @@  discard block
 block discarded – undo
2427 2427
 						'email' => $obj->email,
2428 2428
 						'rowid' => $obj->rowid,
2429 2429
 						'code' => $obj->code,
2430
-						'libelle' => $labelType,		// deprecated, replaced with labeltype
2430
+						'libelle' => $labelType, // deprecated, replaced with labeltype
2431 2431
 						'labeltype' => $labelType,
2432 2432
 						'status' => $obj->statuslink,
2433 2433
 						'statuscontact' => $obj->statuscontact,
@@ -2512,7 +2512,7 @@  discard block
 block discarded – undo
2512 2512
 			if (is_resource($handle)) {
2513 2513
 				while (($file = readdir($handle)) !== false) {
2514 2514
 					if (!utf8_check($file)) {
2515
-						$file = mb_convert_encoding($file, 'UTF-8', 'ISO-8859-1');	// To be sure data is stored in UTF8 in memory
2515
+						$file = mb_convert_encoding($file, 'UTF-8', 'ISO-8859-1'); // To be sure data is stored in UTF8 in memory
2516 2516
 					}
2517 2517
 					if (dol_is_file($dir.$file)) {
2518 2518
 						return true;
@@ -2550,7 +2550,7 @@  discard block
 block discarded – undo
2550 2550
 		$formmail->trackid = (is_null($forcetrackid) ? 'tic'.$this->id : '');
2551 2551
 		$attachedfiles = $formmail->get_attached_files();
2552 2552
 
2553
-		$filepath = $attachedfiles['paths'];	// path is for example user->dir_temp.'/'.$user->id.'/'...
2553
+		$filepath = $attachedfiles['paths']; // path is for example user->dir_temp.'/'.$user->id.'/'...
2554 2554
 		$filename = $attachedfiles['names'];
2555 2555
 		$mimetype = $attachedfiles['mimes'];
2556 2556
 
@@ -2940,7 +2940,7 @@  discard block
 block discarded – undo
2940 2940
 
2941 2941
 								// If public interface is not enable, use link to internal page into mail
2942 2942
 								$url_public_ticket = (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE') ?
2943
-										(getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE') !== '' ? getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE') . '/view.php' : dol_buildpath('/public/ticket/view.php', 2)) : dol_buildpath('/ticket/card.php', 2)).'?track_id='.urlencode($object->track_id);
2943
+										(getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE') !== '' ? getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE').'/view.php' : dol_buildpath('/public/ticket/view.php', 2)) : dol_buildpath('/ticket/card.php', 2)).'?track_id='.urlencode($object->track_id);
2944 2944
 
2945 2945
 								$message .= '<br>'.$langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer').' : <a href="'.$url_public_ticket.'">'.$object->track_id.'</a><br>';
2946 2946
 
@@ -2977,7 +2977,7 @@  discard block
 block discarded – undo
2977 2977
 									if ($result) {
2978 2978
 										// update last_msg_sent date (for last message sent to external users)
2979 2979
 										$this->date_last_msg_sent = dol_now();
2980
-										$this->update($user, 1);	// disable trigger when updating date_last_msg_sent. sendTicketMessageByEmail already create an event in actioncomm table.
2980
+										$this->update($user, 1); // disable trigger when updating date_last_msg_sent. sendTicketMessageByEmail already create an event in actioncomm table.
2981 2981
 									}
2982 2982
 								}
2983 2983
 							}
Please login to merge, or discard this patch.
htdocs/includes/OAuth/OAuth2/Service/Generic.php 2 patches
Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -19,150 +19,150 @@
 block discarded – undo
19 19
 	const SCOPE_WRITE = 'write';
20 20
 
21 21
 
22
-    public function __construct(
23
-        CredentialsInterface $credentials,
24
-        ClientInterface $httpClient,
25
-        TokenStorageInterface $storage,
26
-        $scopes = array(),
27
-        UriInterface $baseApiUri = null
28
-    ) {
29
-        parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
30
-        if ($baseApiUri === null) {
31
-        	$url = getDolGlobalString('OAUTH_GENERIC-'.$storage->getKeyForProvider().'_URL');
32
-        	//$url = 'https://aaaaa.com';
33
-        	if (!empty($url)) {
22
+	public function __construct(
23
+		CredentialsInterface $credentials,
24
+		ClientInterface $httpClient,
25
+		TokenStorageInterface $storage,
26
+		$scopes = array(),
27
+		UriInterface $baseApiUri = null
28
+	) {
29
+		parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
30
+		if ($baseApiUri === null) {
31
+			$url = getDolGlobalString('OAUTH_GENERIC-'.$storage->getKeyForProvider().'_URL');
32
+			//$url = 'https://aaaaa.com';
33
+			if (!empty($url)) {
34 34
 				$this->baseApiUri = new Uri($url);
35
-        	}
36
-        }
37
-    }
38
-
39
-    /**
40
-     * Return the private property $this->baseApiUri
41
-     */
42
-    public function getBaseApiUri()
43
-    {
44
-    	return $this->baseApiUri;
45
-    }
46
-
47
-    /**
48
-     * {@inheritdoc}
49
-     */
50
-    public function getRequestTokenEndpoint()
51
-    {
52
-    	return new Uri($this->baseApiUri.'/oauth/request');
53
-    }
54
-
55
-    /**
56
-     * {@inheritdoc}
57
-     */
58
-    public function getAuthorizationEndpoint()
59
-    {
60
-    	return new Uri($this->baseApiUri.'/oauth/authorize');
61
-    }
62
-
63
-    /**
64
-     * {@inheritdoc}
65
-     */
66
-    public function getAccessTokenEndpoint()
67
-    {
68
-    	return new Uri($this->baseApiUri.'/oauth/authorize');
69
-    }
70
-
71
-    /**
72
-     * {@inheritdoc}
73
-     */
74
-    public function getAuthorizationUri(array $additionalParameters = array())
75
-    {
76
-        $parameters = array_merge(
77
-            $additionalParameters,
78
-            array(
79
-                'redirect_uri' => $this->credentials->getCallbackUrl(),
80
-            )
81
-        );
82
-
83
-        // Build the url
84
-        $url = clone $this->getAuthorizationEndpoint();
85
-        foreach ($parameters as $key => $val) {
86
-            $url->addToQuery($key, $val);
87
-        }
88
-
89
-        return $url;
90
-    }
91
-
92
-    /**
93
-     * {@inheritdoc}
94
-     */
95
-    public function requestRequestToken()
96
-    {
97
-        $responseBody = $this->httpClient->retrieveResponse(
98
-            $this->getRequestTokenEndpoint(),
99
-            array(
100
-                'consumer_key' => $this->credentials->getConsumerId(),
101
-                'redirect_uri' => $this->credentials->getCallbackUrl(),
102
-            )
103
-        );
104
-
105
-        $code = $this->parseRequestTokenResponse($responseBody);
106
-
107
-        return $code;
108
-    }
109
-
110
-    /**
111
-     * {@inheritdoc}
112
-     */
113
-    protected function parseRequestTokenResponse($responseBody)
114
-    {
115
-        parse_str($responseBody, $data);
116
-
117
-        if (null === $data || !is_array($data)) {
118
-            throw new TokenResponseException('Unable to parse response.');
119
-        } elseif (!isset($data['code'])) {
120
-            throw new TokenResponseException('Error in retrieving code.');
121
-        }
122
-        return $data['code'];
123
-    }
124
-
125
-    /**
126
-     * {@inheritdoc}
127
-     */
128
-    public function requestAccessToken($code, $state = null)
129
-    {
130
-        $bodyParams = array(
131
-            'consumer_key'     => $this->credentials->getConsumerId(),
132
-            'code'             => $code,
133
-        );
134
-
135
-        $responseBody = $this->httpClient->retrieveResponse(
136
-            $this->getAccessTokenEndpoint(),
137
-            $bodyParams,
138
-            $this->getExtraOAuthHeaders()
139
-        );
140
-        $token = $this->parseAccessTokenResponse($responseBody);
141
-        $this->storage->storeAccessToken($this->service(), $token);
142
-
143
-        return $token;
144
-    }
145
-
146
-    /**
147
-     * {@inheritdoc}
148
-     */
149
-    protected function parseAccessTokenResponse($responseBody)
150
-    {
151
-        parse_str($responseBody, $data);
152
-
153
-        if ($data === null || !is_array($data)) {
154
-            throw new TokenResponseException('Unable to parse response.');
155
-        } elseif (isset($data['error'])) {
156
-            throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"');
157
-        }
158
-
159
-        $token = new StdOAuth2Token();
160
-        #$token->setRequestToken($data['access_token']);
161
-        $token->setAccessToken($data['access_token']);
162
-        $token->setEndOfLife(StdOAuth2Token::EOL_NEVER_EXPIRES);
163
-        unset($data['access_token']);
164
-        $token->setExtraParams($data);
165
-
166
-        return $token;
167
-    }
35
+			}
36
+		}
37
+	}
38
+
39
+	/**
40
+	 * Return the private property $this->baseApiUri
41
+	 */
42
+	public function getBaseApiUri()
43
+	{
44
+		return $this->baseApiUri;
45
+	}
46
+
47
+	/**
48
+	 * {@inheritdoc}
49
+	 */
50
+	public function getRequestTokenEndpoint()
51
+	{
52
+		return new Uri($this->baseApiUri.'/oauth/request');
53
+	}
54
+
55
+	/**
56
+	 * {@inheritdoc}
57
+	 */
58
+	public function getAuthorizationEndpoint()
59
+	{
60
+		return new Uri($this->baseApiUri.'/oauth/authorize');
61
+	}
62
+
63
+	/**
64
+	 * {@inheritdoc}
65
+	 */
66
+	public function getAccessTokenEndpoint()
67
+	{
68
+		return new Uri($this->baseApiUri.'/oauth/authorize');
69
+	}
70
+
71
+	/**
72
+	 * {@inheritdoc}
73
+	 */
74
+	public function getAuthorizationUri(array $additionalParameters = array())
75
+	{
76
+		$parameters = array_merge(
77
+			$additionalParameters,
78
+			array(
79
+				'redirect_uri' => $this->credentials->getCallbackUrl(),
80
+			)
81
+		);
82
+
83
+		// Build the url
84
+		$url = clone $this->getAuthorizationEndpoint();
85
+		foreach ($parameters as $key => $val) {
86
+			$url->addToQuery($key, $val);
87
+		}
88
+
89
+		return $url;
90
+	}
91
+
92
+	/**
93
+	 * {@inheritdoc}
94
+	 */
95
+	public function requestRequestToken()
96
+	{
97
+		$responseBody = $this->httpClient->retrieveResponse(
98
+			$this->getRequestTokenEndpoint(),
99
+			array(
100
+				'consumer_key' => $this->credentials->getConsumerId(),
101
+				'redirect_uri' => $this->credentials->getCallbackUrl(),
102
+			)
103
+		);
104
+
105
+		$code = $this->parseRequestTokenResponse($responseBody);
106
+
107
+		return $code;
108
+	}
109
+
110
+	/**
111
+	 * {@inheritdoc}
112
+	 */
113
+	protected function parseRequestTokenResponse($responseBody)
114
+	{
115
+		parse_str($responseBody, $data);
116
+
117
+		if (null === $data || !is_array($data)) {
118
+			throw new TokenResponseException('Unable to parse response.');
119
+		} elseif (!isset($data['code'])) {
120
+			throw new TokenResponseException('Error in retrieving code.');
121
+		}
122
+		return $data['code'];
123
+	}
124
+
125
+	/**
126
+	 * {@inheritdoc}
127
+	 */
128
+	public function requestAccessToken($code, $state = null)
129
+	{
130
+		$bodyParams = array(
131
+			'consumer_key'     => $this->credentials->getConsumerId(),
132
+			'code'             => $code,
133
+		);
134
+
135
+		$responseBody = $this->httpClient->retrieveResponse(
136
+			$this->getAccessTokenEndpoint(),
137
+			$bodyParams,
138
+			$this->getExtraOAuthHeaders()
139
+		);
140
+		$token = $this->parseAccessTokenResponse($responseBody);
141
+		$this->storage->storeAccessToken($this->service(), $token);
142
+
143
+		return $token;
144
+	}
145
+
146
+	/**
147
+	 * {@inheritdoc}
148
+	 */
149
+	protected function parseAccessTokenResponse($responseBody)
150
+	{
151
+		parse_str($responseBody, $data);
152
+
153
+		if ($data === null || !is_array($data)) {
154
+			throw new TokenResponseException('Unable to parse response.');
155
+		} elseif (isset($data['error'])) {
156
+			throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"');
157
+		}
158
+
159
+		$token = new StdOAuth2Token();
160
+		#$token->setRequestToken($data['access_token']);
161
+		$token->setAccessToken($data['access_token']);
162
+		$token->setEndOfLife(StdOAuth2Token::EOL_NEVER_EXPIRES);
163
+		unset($data['access_token']);
164
+		$token->setExtraParams($data);
165
+
166
+		return $token;
167
+	}
168 168
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@
 block discarded – undo
136 136
         if ($data === null || !is_array($data)) {
137 137
             throw new TokenResponseException('Unable to parse response.');
138 138
         } elseif (isset($data['error'])) {
139
-            throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"');
139
+            throw new TokenResponseException('Error in retrieving token: "'.$data['error'].'"');
140 140
         }
141 141
 
142 142
         $token = new StdOAuth2Token();
Please login to merge, or discard this patch.
htdocs/includes/OAuth/Common/Http/Client/CurlClient.php 2 patches
Indentation   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -10,142 +10,142 @@
 block discarded – undo
10 10
  */
11 11
 class CurlClient extends AbstractClient
12 12
 {
13
-    /**
14
-     * If true, explicitly sets cURL to use SSL version 3. Use this if cURL
15
-     * compiles with GnuTLS SSL.
16
-     *
17
-     * @var bool
18
-     */
19
-    private $forceSSL3 = false;
20
-
21
-    /**
22
-     * Additional parameters (as `key => value` pairs) to be passed to `curl_setopt`
23
-     *
24
-     * @var array
25
-     */
26
-    private $parameters = array();
27
-
28
-    /**
29
-     * Additional `curl_setopt` parameters
30
-     *
31
-     * @param array $parameters
32
-     */
33
-    public function setCurlParameters(array $parameters)
34
-    {
35
-        $this->parameters = $parameters;
36
-    }
37
-
38
-    /**
39
-     * @param bool $force
40
-     *
41
-     * @return CurlClient
42
-     */
43
-    public function setForceSSL3($force)
44
-    {
45
-        $this->forceSSL3 = $force;
46
-
47
-        return $this;
48
-    }
49
-
50
-    /**
51
-     * Any implementing HTTP providers should send a request to the provided endpoint with the parameters.
52
-     * They should return, in string form, the response body and throw an exception on error.
53
-     *
54
-     * @param UriInterface $endpoint
55
-     * @param mixed        $requestBody
56
-     * @param array        $extraHeaders
57
-     * @param string       $method
58
-     *
59
-     * @return string
60
-     *
61
-     * @throws TokenResponseException
62
-     * @throws \InvalidArgumentException
63
-     */
64
-    public function retrieveResponse(
65
-        UriInterface $endpoint,
66
-        $requestBody,
67
-        array $extraHeaders = array(),
68
-        $method = 'POST'
69
-    ) {
70
-        // Normalize method name
71
-        $method = strtoupper($method);
72
-
73
-        $this->normalizeHeaders($extraHeaders);
74
-
75
-        if ($method === 'GET' && !empty($requestBody)) {
76
-            throw new \InvalidArgumentException('No body expected for "GET" request.');
77
-        }
78
-
79
-        if (!isset($extraHeaders['Content-Type']) && $method === 'POST' && is_array($requestBody)) {
80
-            $extraHeaders['Content-Type'] = 'Content-Type: application/x-www-form-urlencoded';
81
-        }
82
-
83
-        $extraHeaders['Host']       = 'Host: '.$endpoint->getHost();
84
-        $extraHeaders['Connection'] = 'Connection: close';
85
-
86
-        $ch = curl_init();
87
-
88
-        curl_setopt($ch, CURLOPT_URL, $endpoint->getAbsoluteUri());
89
-
90
-        if ($method === 'POST' || $method === 'PUT') {
91
-            if ($requestBody && is_array($requestBody)) {
92
-                $requestBody = http_build_query($requestBody, '', '&');
93
-            }
94
-
95
-            if ($method === 'PUT') {
96
-                curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
97
-            } else {
98
-                curl_setopt($ch, CURLOPT_POST, true);
99
-            }
100
-
101
-            curl_setopt($ch, CURLOPT_POSTFIELDS, $requestBody);
102
-        } else {
103
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
104
-        }
105
-
106
-        if ($this->maxRedirects > 0) {
107
-            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
108
-            curl_setopt($ch, CURLOPT_MAXREDIRS, $this->maxRedirects);
109
-        }
110
-
111
-        curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
112
-        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
113
-        curl_setopt($ch, CURLOPT_HEADER, false);
114
-        curl_setopt($ch, CURLOPT_HTTPHEADER, $extraHeaders);
115
-        curl_setopt($ch, CURLOPT_USERAGENT, $this->userAgent);
116
-
117
-        foreach ($this->parameters as $key => $value) {
118
-            curl_setopt($ch, $key, $value);
119
-        }
120
-
121
-        if ($this->forceSSL3) {
122
-            curl_setopt($ch, CURLOPT_SSLVERSION, 3);
123
-        }
124
-
125
-        // @CHANGE DOL_LDR Add log
126
-        if (function_exists('getDolGlobalString') && getDolGlobalString('OAUTH_DEBUG')) {
127
-        	file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $endpoint->getAbsoluteUri()."\n", FILE_APPEND);
128
-        	file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $requestBody."\n", FILE_APPEND);
129
-        	file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $method."\n", FILE_APPEND);
130
-        	file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", var_export($extraHeaders, true)."\n", FILE_APPEND);
131
-        	@chmod(DOL_DATA_ROOT . "/dolibarr_oauth.log", octdec(empty($conf->global->MAIN_UMASK)?'0664':$conf->global->MAIN_UMASK));
132
-        }
133
-
134
-        $response     = curl_exec($ch);
135
-        $responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
136
-
137
-        if (false === $response) {
138
-            $errNo  = curl_errno($ch);
139
-            $errStr = curl_error($ch);
140
-            curl_close($ch);
141
-            if (empty($errStr)) {
142
-                throw new TokenResponseException('Failed to request resource.', $responseCode);
143
-            }
144
-            throw new TokenResponseException('cURL Error # '.$errNo.': '.$errStr, $responseCode);
145
-        }
146
-
147
-        curl_close($ch);
148
-
149
-        return $response;
150
-    }
13
+	/**
14
+	 * If true, explicitly sets cURL to use SSL version 3. Use this if cURL
15
+	 * compiles with GnuTLS SSL.
16
+	 *
17
+	 * @var bool
18
+	 */
19
+	private $forceSSL3 = false;
20
+
21
+	/**
22
+	 * Additional parameters (as `key => value` pairs) to be passed to `curl_setopt`
23
+	 *
24
+	 * @var array
25
+	 */
26
+	private $parameters = array();
27
+
28
+	/**
29
+	 * Additional `curl_setopt` parameters
30
+	 *
31
+	 * @param array $parameters
32
+	 */
33
+	public function setCurlParameters(array $parameters)
34
+	{
35
+		$this->parameters = $parameters;
36
+	}
37
+
38
+	/**
39
+	 * @param bool $force
40
+	 *
41
+	 * @return CurlClient
42
+	 */
43
+	public function setForceSSL3($force)
44
+	{
45
+		$this->forceSSL3 = $force;
46
+
47
+		return $this;
48
+	}
49
+
50
+	/**
51
+	 * Any implementing HTTP providers should send a request to the provided endpoint with the parameters.
52
+	 * They should return, in string form, the response body and throw an exception on error.
53
+	 *
54
+	 * @param UriInterface $endpoint
55
+	 * @param mixed        $requestBody
56
+	 * @param array        $extraHeaders
57
+	 * @param string       $method
58
+	 *
59
+	 * @return string
60
+	 *
61
+	 * @throws TokenResponseException
62
+	 * @throws \InvalidArgumentException
63
+	 */
64
+	public function retrieveResponse(
65
+		UriInterface $endpoint,
66
+		$requestBody,
67
+		array $extraHeaders = array(),
68
+		$method = 'POST'
69
+	) {
70
+		// Normalize method name
71
+		$method = strtoupper($method);
72
+
73
+		$this->normalizeHeaders($extraHeaders);
74
+
75
+		if ($method === 'GET' && !empty($requestBody)) {
76
+			throw new \InvalidArgumentException('No body expected for "GET" request.');
77
+		}
78
+
79
+		if (!isset($extraHeaders['Content-Type']) && $method === 'POST' && is_array($requestBody)) {
80
+			$extraHeaders['Content-Type'] = 'Content-Type: application/x-www-form-urlencoded';
81
+		}
82
+
83
+		$extraHeaders['Host']       = 'Host: '.$endpoint->getHost();
84
+		$extraHeaders['Connection'] = 'Connection: close';
85
+
86
+		$ch = curl_init();
87
+
88
+		curl_setopt($ch, CURLOPT_URL, $endpoint->getAbsoluteUri());
89
+
90
+		if ($method === 'POST' || $method === 'PUT') {
91
+			if ($requestBody && is_array($requestBody)) {
92
+				$requestBody = http_build_query($requestBody, '', '&');
93
+			}
94
+
95
+			if ($method === 'PUT') {
96
+				curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
97
+			} else {
98
+				curl_setopt($ch, CURLOPT_POST, true);
99
+			}
100
+
101
+			curl_setopt($ch, CURLOPT_POSTFIELDS, $requestBody);
102
+		} else {
103
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
104
+		}
105
+
106
+		if ($this->maxRedirects > 0) {
107
+			curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
108
+			curl_setopt($ch, CURLOPT_MAXREDIRS, $this->maxRedirects);
109
+		}
110
+
111
+		curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
112
+		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
113
+		curl_setopt($ch, CURLOPT_HEADER, false);
114
+		curl_setopt($ch, CURLOPT_HTTPHEADER, $extraHeaders);
115
+		curl_setopt($ch, CURLOPT_USERAGENT, $this->userAgent);
116
+
117
+		foreach ($this->parameters as $key => $value) {
118
+			curl_setopt($ch, $key, $value);
119
+		}
120
+
121
+		if ($this->forceSSL3) {
122
+			curl_setopt($ch, CURLOPT_SSLVERSION, 3);
123
+		}
124
+
125
+		// @CHANGE DOL_LDR Add log
126
+		if (function_exists('getDolGlobalString') && getDolGlobalString('OAUTH_DEBUG')) {
127
+			file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $endpoint->getAbsoluteUri()."\n", FILE_APPEND);
128
+			file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $requestBody."\n", FILE_APPEND);
129
+			file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $method."\n", FILE_APPEND);
130
+			file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", var_export($extraHeaders, true)."\n", FILE_APPEND);
131
+			@chmod(DOL_DATA_ROOT . "/dolibarr_oauth.log", octdec(empty($conf->global->MAIN_UMASK)?'0664':$conf->global->MAIN_UMASK));
132
+		}
133
+
134
+		$response     = curl_exec($ch);
135
+		$responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
136
+
137
+		if (false === $response) {
138
+			$errNo  = curl_errno($ch);
139
+			$errStr = curl_error($ch);
140
+			curl_close($ch);
141
+			if (empty($errStr)) {
142
+				throw new TokenResponseException('Failed to request resource.', $responseCode);
143
+			}
144
+			throw new TokenResponseException('cURL Error # '.$errNo.': '.$errStr, $responseCode);
145
+		}
146
+
147
+		curl_close($ch);
148
+
149
+		return $response;
150
+	}
151 151
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -124,11 +124,11 @@
 block discarded – undo
124 124
 
125 125
         // @CHANGE DOL_LDR Add log
126 126
         if (function_exists('getDolGlobalString') && getDolGlobalString('OAUTH_DEBUG')) {
127
-        	file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $endpoint->getAbsoluteUri()."\n", FILE_APPEND);
128
-        	file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $requestBody."\n", FILE_APPEND);
129
-        	file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $method."\n", FILE_APPEND);
130
-        	file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", var_export($extraHeaders, true)."\n", FILE_APPEND);
131
-        	@chmod(DOL_DATA_ROOT . "/dolibarr_oauth.log", octdec(empty($conf->global->MAIN_UMASK)?'0664':$conf->global->MAIN_UMASK));
127
+        	file_put_contents(DOL_DATA_ROOT."/dolibarr_oauth.log", $endpoint->getAbsoluteUri()."\n", FILE_APPEND);
128
+        	file_put_contents(DOL_DATA_ROOT."/dolibarr_oauth.log", $requestBody."\n", FILE_APPEND);
129
+        	file_put_contents(DOL_DATA_ROOT."/dolibarr_oauth.log", $method."\n", FILE_APPEND);
130
+        	file_put_contents(DOL_DATA_ROOT."/dolibarr_oauth.log", var_export($extraHeaders, true)."\n", FILE_APPEND);
131
+        	@chmod(DOL_DATA_ROOT."/dolibarr_oauth.log", octdec(empty($conf->global->MAIN_UMASK) ? '0664' : $conf->global->MAIN_UMASK));
132 132
         }
133 133
 
134 134
         $response     = curl_exec($ch);
Please login to merge, or discard this patch.
htdocs/includes/OAuth/Common/Http/Client/StreamClient.php 2 patches
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -10,96 +10,96 @@
 block discarded – undo
10 10
  */
11 11
 class StreamClient extends AbstractClient
12 12
 {
13
-    /**
14
-     * Any implementing HTTP providers should send a request to the provided endpoint with the parameters.
15
-     * They should return, in string form, the response body and throw an exception on error.
16
-     *
17
-     * @param UriInterface $endpoint
18
-     * @param mixed        $requestBody
19
-     * @param array        $extraHeaders
20
-     * @param string       $method
21
-     *
22
-     * @return string
23
-     *
24
-     * @throws TokenResponseException
25
-     * @throws \InvalidArgumentException
26
-     */
27
-    public function retrieveResponse(
28
-        UriInterface $endpoint,
29
-        $requestBody,
30
-        array $extraHeaders = array(),
31
-        $method = 'POST'
32
-    ) {
33
-        // Normalize method name
34
-        $method = strtoupper($method);
13
+	/**
14
+	 * Any implementing HTTP providers should send a request to the provided endpoint with the parameters.
15
+	 * They should return, in string form, the response body and throw an exception on error.
16
+	 *
17
+	 * @param UriInterface $endpoint
18
+	 * @param mixed        $requestBody
19
+	 * @param array        $extraHeaders
20
+	 * @param string       $method
21
+	 *
22
+	 * @return string
23
+	 *
24
+	 * @throws TokenResponseException
25
+	 * @throws \InvalidArgumentException
26
+	 */
27
+	public function retrieveResponse(
28
+		UriInterface $endpoint,
29
+		$requestBody,
30
+		array $extraHeaders = array(),
31
+		$method = 'POST'
32
+	) {
33
+		// Normalize method name
34
+		$method = strtoupper($method);
35 35
 
36
-        $this->normalizeHeaders($extraHeaders);
36
+		$this->normalizeHeaders($extraHeaders);
37 37
 
38
-        if ($method === 'GET' && !empty($requestBody)) {
39
-            throw new \InvalidArgumentException('No body expected for "GET" request.');
40
-        }
38
+		if ($method === 'GET' && !empty($requestBody)) {
39
+			throw new \InvalidArgumentException('No body expected for "GET" request.');
40
+		}
41 41
 
42
-        if (!isset($extraHeaders['Content-Type']) && $method === 'POST' && is_array($requestBody)) {
43
-            $extraHeaders['Content-Type'] = 'Content-Type: application/x-www-form-urlencoded';
44
-        }
42
+		if (!isset($extraHeaders['Content-Type']) && $method === 'POST' && is_array($requestBody)) {
43
+			$extraHeaders['Content-Type'] = 'Content-Type: application/x-www-form-urlencoded';
44
+		}
45 45
 
46
-        $host = 'Host: '.$endpoint->getHost();
47
-        // Append port to Host if it has been specified
48
-        if ($endpoint->hasExplicitPortSpecified()) {
49
-            $host .= ':'.$endpoint->getPort();
50
-        }
46
+		$host = 'Host: '.$endpoint->getHost();
47
+		// Append port to Host if it has been specified
48
+		if ($endpoint->hasExplicitPortSpecified()) {
49
+			$host .= ':'.$endpoint->getPort();
50
+		}
51 51
 
52
-        $extraHeaders['Host']       = $host;
53
-        $extraHeaders['Connection'] = 'Connection: close';
52
+		$extraHeaders['Host']       = $host;
53
+		$extraHeaders['Connection'] = 'Connection: close';
54 54
 
55
-        if (is_array($requestBody)) {
56
-            $requestBody = http_build_query($requestBody, '', '&');
57
-        }
58
-        $extraHeaders['Content-length'] = 'Content-length: '.strlen($requestBody);
55
+		if (is_array($requestBody)) {
56
+			$requestBody = http_build_query($requestBody, '', '&');
57
+		}
58
+		$extraHeaders['Content-length'] = 'Content-length: '.strlen($requestBody);
59 59
 
60
-        //var_dump($requestBody); var_dump($extraHeaders);var_dump($method);exit;
61
-        $context = $this->generateStreamContext($requestBody, $extraHeaders, $method);
60
+		//var_dump($requestBody); var_dump($extraHeaders);var_dump($method);exit;
61
+		$context = $this->generateStreamContext($requestBody, $extraHeaders, $method);
62 62
 
63 63
 		// @CHANGE DOL_LDR Add log
64
-        if (function_exists('getDolGlobalString') && getDolGlobalString('OAUTH_DEBUG')) {
65
-        	file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $endpoint->getAbsoluteUri()."\n", FILE_APPEND);
66
-        	file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $requestBody."\n", FILE_APPEND);
67
-        	file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $method."\n", FILE_APPEND);
68
-        	file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", var_export($extraHeaders, true)."\n", FILE_APPEND);
69
-        	@chmod(DOL_DATA_ROOT . "/dolibarr_oauth.log", octdec(empty($conf->global->MAIN_UMASK)?'0664':$conf->global->MAIN_UMASK));
70
-        }
64
+		if (function_exists('getDolGlobalString') && getDolGlobalString('OAUTH_DEBUG')) {
65
+			file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $endpoint->getAbsoluteUri()."\n", FILE_APPEND);
66
+			file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $requestBody."\n", FILE_APPEND);
67
+			file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $method."\n", FILE_APPEND);
68
+			file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", var_export($extraHeaders, true)."\n", FILE_APPEND);
69
+			@chmod(DOL_DATA_ROOT . "/dolibarr_oauth.log", octdec(empty($conf->global->MAIN_UMASK)?'0664':$conf->global->MAIN_UMASK));
70
+		}
71 71
 
72
-        $level = error_reporting(0);
73
-        $response = file_get_contents($endpoint->getAbsoluteUri(), false, $context);
74
-        error_reporting($level);
75
-        if (false === $response) {
76
-            $lastError = error_get_last();
77
-            if (is_null($lastError)) {
78
-                throw new TokenResponseException(
79
-                    'Failed to request resource. HTTP Code: ' .
80
-                    ((isset($http_response_header[0]))?$http_response_header[0]:'No response')
81
-                );
82
-            }
83
-            throw new TokenResponseException($lastError['message']);
84
-        }
72
+		$level = error_reporting(0);
73
+		$response = file_get_contents($endpoint->getAbsoluteUri(), false, $context);
74
+		error_reporting($level);
75
+		if (false === $response) {
76
+			$lastError = error_get_last();
77
+			if (is_null($lastError)) {
78
+				throw new TokenResponseException(
79
+					'Failed to request resource. HTTP Code: ' .
80
+					((isset($http_response_header[0]))?$http_response_header[0]:'No response')
81
+				);
82
+			}
83
+			throw new TokenResponseException($lastError['message']);
84
+		}
85 85
 
86
-        return $response;
87
-    }
86
+		return $response;
87
+	}
88 88
 
89
-    private function generateStreamContext($body, $headers, $method)
90
-    {
91
-        return stream_context_create(
92
-            array(
93
-                'http' => array(
94
-                    'method'           => $method,
95
-                    'header'           => implode("\r\n", array_values($headers)),
96
-                    'content'          => $body,
97
-                    'protocol_version' => '1.1',
98
-                    'user_agent'       => $this->userAgent,
99
-                    'max_redirects'    => $this->maxRedirects,
100
-                    'timeout'          => $this->timeout
101
-                ),
102
-            )
103
-        );
104
-    }
89
+	private function generateStreamContext($body, $headers, $method)
90
+	{
91
+		return stream_context_create(
92
+			array(
93
+				'http' => array(
94
+					'method'           => $method,
95
+					'header'           => implode("\r\n", array_values($headers)),
96
+					'content'          => $body,
97
+					'protocol_version' => '1.1',
98
+					'user_agent'       => $this->userAgent,
99
+					'max_redirects'    => $this->maxRedirects,
100
+					'timeout'          => $this->timeout
101
+				),
102
+			)
103
+		);
104
+	}
105 105
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 
63 63
 		// @CHANGE DOL_LDR Add log
64 64
         if (function_exists('getDolGlobalString') && getDolGlobalString('OAUTH_DEBUG')) {
65
-        	file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $endpoint->getAbsoluteUri()."\n", FILE_APPEND);
66
-        	file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $requestBody."\n", FILE_APPEND);
67
-        	file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $method."\n", FILE_APPEND);
68
-        	file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", var_export($extraHeaders, true)."\n", FILE_APPEND);
69
-        	@chmod(DOL_DATA_ROOT . "/dolibarr_oauth.log", octdec(empty($conf->global->MAIN_UMASK)?'0664':$conf->global->MAIN_UMASK));
65
+        	file_put_contents(DOL_DATA_ROOT."/dolibarr_oauth.log", $endpoint->getAbsoluteUri()."\n", FILE_APPEND);
66
+        	file_put_contents(DOL_DATA_ROOT."/dolibarr_oauth.log", $requestBody."\n", FILE_APPEND);
67
+        	file_put_contents(DOL_DATA_ROOT."/dolibarr_oauth.log", $method."\n", FILE_APPEND);
68
+        	file_put_contents(DOL_DATA_ROOT."/dolibarr_oauth.log", var_export($extraHeaders, true)."\n", FILE_APPEND);
69
+        	@chmod(DOL_DATA_ROOT."/dolibarr_oauth.log", octdec(empty($conf->global->MAIN_UMASK) ? '0664' : $conf->global->MAIN_UMASK));
70 70
         }
71 71
 
72 72
         $level = error_reporting(0);
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
             $lastError = error_get_last();
77 77
             if (is_null($lastError)) {
78 78
                 throw new TokenResponseException(
79
-                    'Failed to request resource. HTTP Code: ' .
80
-                    ((isset($http_response_header[0]))?$http_response_header[0]:'No response')
79
+                    'Failed to request resource. HTTP Code: '.
80
+                    ((isset($http_response_header[0])) ? $http_response_header[0] : 'No response')
81 81
                 );
82 82
             }
83 83
             throw new TokenResponseException($lastError['message']);
Please login to merge, or discard this patch.
htdocs/core/multicompany_page.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 $title = $langs->trans("Multicompanies");
86 86
 
87 87
 // URL http://mydolibarr/core/multicompany_page?dol_use_jmobile=1 can be used for tests
88
-$head = '<!-- Multicompany selection -->'."\n";	// This is used by DoliDroid to know page is a multicompany selection page
88
+$head = '<!-- Multicompany selection -->'."\n"; // This is used by DoliDroid to know page is a multicompany selection page
89 89
 $arrayofjs = array();
90 90
 $arrayofcss = array();
91 91
 top_htmlhead($head, $title, 0, 0, $arrayofjs, $arrayofcss);
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	$multicompanyList .= '<ul class="ullistonly left" style="list-style: none; padding: 0">';
121 121
 	foreach ($listofentities as $entityid => $entitycursor) {
122 122
 		// Check if the user has the right to access the entity
123
-		if (getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE')	&& !empty($user->entity) && $mc->checkRight($user->id, $entityid) < 0) {
123
+		if (getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && !empty($user->entity) && $mc->checkRight($user->id, $entityid) < 0) {
124 124
 			continue;
125 125
 		}
126 126
 		$url = DOL_URL_ROOT.'/core/multicompany_page.php?action=switchentity&token='.newToken().'&entity='.((int) $entityid).($backtourl ? '&backtourl='.urlencode($backtourl) : '');
Please login to merge, or discard this patch.