@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | if (getDolGlobalString('MEMBER_IMAGE_PUBLIC_REGISTRATION')) { |
| 149 | 149 | print '<div class="backimagepublicregistration">'; |
| 150 | - print '<img id="idEVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE" src="' . getDolGlobalString('MEMBER_IMAGE_PUBLIC_REGISTRATION').'">'; |
|
| 150 | + print '<img id="idEVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE" src="'.getDolGlobalString('MEMBER_IMAGE_PUBLIC_REGISTRATION').'">'; |
|
| 151 | 151 | print '</div>'; |
| 152 | 152 | } |
| 153 | 153 | |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | $to = $adh->makeSubstitution($conf->global->MAIN_INFO_SOCIETE_MAIL); |
| 413 | 413 | $from = getDolGlobalString('ADHERENT_MAIL_FROM'); |
| 414 | 414 | $mailfile = new CMailFile( |
| 415 | - '['.$appli.'] ' . getDolGlobalString('ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT'), |
|
| 415 | + '['.$appli.'] '.getDolGlobalString('ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT'), |
|
| 416 | 416 | $to, |
| 417 | 417 | $from, |
| 418 | 418 | $adh->makeSubstitution($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL), |
@@ -598,7 +598,7 @@ discard block |
||
| 598 | 598 | print '</td></tr>'."\n"; |
| 599 | 599 | } else { |
| 600 | 600 | $adht->fetch(getDolGlobalInt('MEMBER_NEWFORM_FORCETYPE')); |
| 601 | - print '<input type="hidden" id="typeid" name="typeid" value="' . getDolGlobalString('MEMBER_NEWFORM_FORCETYPE').'">'; |
|
| 601 | + print '<input type="hidden" id="typeid" name="typeid" value="'.getDolGlobalString('MEMBER_NEWFORM_FORCETYPE').'">'; |
|
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | // Moral/Physic attribute |
@@ -611,7 +611,7 @@ discard block |
||
| 611 | 611 | print '</td></tr>'."\n"; |
| 612 | 612 | } else { |
| 613 | 613 | //print $morphys[$conf->global->MEMBER_NEWFORM_FORCEMORPHY]; |
| 614 | - print '<input type="hidden" id="morphy" name="morphy" value="' . getDolGlobalString('MEMBER_NEWFORM_FORCEMORPHY').'">'; |
|
| 614 | + print '<input type="hidden" id="morphy" name="morphy" value="'.getDolGlobalString('MEMBER_NEWFORM_FORCEMORPHY').'">'; |
|
| 615 | 615 | } |
| 616 | 616 | |
| 617 | 617 | // Company // TODO : optional hide |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | } |
| 710 | 710 | |
| 711 | 711 | // Other attributes |
| 712 | - $parameters['tpl_context'] = 'public'; // define template context to public |
|
| 712 | + $parameters['tpl_context'] = 'public'; // define template context to public |
|
| 713 | 713 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; |
| 714 | 714 | |
| 715 | 715 | // Comments |
@@ -770,7 +770,7 @@ discard block |
||
| 770 | 770 | $adht = new AdherentType($db); |
| 771 | 771 | $adht->fetch($typeid); |
| 772 | 772 | $caneditamount = $adht->caneditamount; |
| 773 | - $amountbytype = $adht->amountByType(1); // Load the array of amount per type |
|
| 773 | + $amountbytype = $adht->amountByType(1); // Load the array of amount per type |
|
| 774 | 774 | |
| 775 | 775 | // Set amount for the subscription from the the type and options: |
| 776 | 776 | // - First check the amount of the member type. |
@@ -792,7 +792,7 @@ discard block |
||
| 792 | 792 | // $conf->global->MEMBER_NEWFORM_PAYONLINE is 'paypal', 'paybox' or 'stripe' |
| 793 | 793 | print '<tr><td>'.$langs->trans("Subscription"); |
| 794 | 794 | if (getDolGlobalString('MEMBER_EXT_URL_SUBSCRIPTION_INFO')) { |
| 795 | - print ' - <a href="' . getDolGlobalString('MEMBER_EXT_URL_SUBSCRIPTION_INFO').'" rel="external" target="_blank" rel="noopener noreferrer">'.$langs->trans("SeeHere").'</a>'; |
|
| 795 | + print ' - <a href="'.getDolGlobalString('MEMBER_EXT_URL_SUBSCRIPTION_INFO').'" rel="external" target="_blank" rel="noopener noreferrer">'.$langs->trans("SeeHere").'</a>'; |
|
| 796 | 796 | } |
| 797 | 797 | print '</td><td class="nowrap">'; |
| 798 | 798 | |
@@ -888,10 +888,10 @@ discard block |
||
| 888 | 888 | |
| 889 | 889 | $i = 0; |
| 890 | 890 | while ($i < $num) { |
| 891 | - $objp = $db->fetch_object($result); // Load the member type and information on it |
|
| 891 | + $objp = $db->fetch_object($result); // Load the member type and information on it |
|
| 892 | 892 | |
| 893 | 893 | $caneditamount = $objp->caneditamount; |
| 894 | - $amountbytype = $adht->amountByType(1); // Load the array of amount per type |
|
| 894 | + $amountbytype = $adht->amountByType(1); // Load the array of amount per type |
|
| 895 | 895 | |
| 896 | 896 | print '<tr class="oddeven">'; |
| 897 | 897 | // Label |
@@ -147,9 +147,9 @@ discard block |
||
| 147 | 147 | $paramcreditor = 'ONLINE_PAYMENT_CREDITOR'; |
| 148 | 148 | $paramcreditorlong = 'ONLINE_PAYMENT_CREDITOR_'.$suffix; |
| 149 | 149 | if (getDolGlobalString($paramcreditorlong)) { |
| 150 | - $creditor = getDolGlobalString($paramcreditorlong); // use label long of the seller to show |
|
| 150 | + $creditor = getDolGlobalString($paramcreditorlong); // use label long of the seller to show |
|
| 151 | 151 | } elseif (getDolGlobalString($paramcreditor)) { |
| 152 | - $creditor = getDolGlobalString($paramcreditor); // use label short of the seller to show |
|
| 152 | + $creditor = getDolGlobalString($paramcreditor); // use label short of the seller to show |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | $head = ''; |
| 200 | 200 | if (getDolGlobalString('ONLINE_PAYMENT_CSS_URL')) { |
| 201 | - $head = '<link rel="stylesheet" type="text/css" href="' . getDolGlobalString('ONLINE_PAYMENT_CSS_URL').'?lang='.$langs->defaultlang.'">'."\n"; |
|
| 201 | + $head = '<link rel="stylesheet" type="text/css" href="'.getDolGlobalString('ONLINE_PAYMENT_CSS_URL').'?lang='.$langs->defaultlang.'">'."\n"; |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | $conf->dol_hide_topmenu = 1; |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | } |
| 259 | 259 | if (getDolGlobalString('MAIN_IMAGE_PUBLIC_PAYMENT')) { |
| 260 | 260 | print '<div class="backimagepublicpayment">'; |
| 261 | - print '<img id="idMAIN_IMAGE_PUBLIC_PAYMENT" src="' . getDolGlobalString('MAIN_IMAGE_PUBLIC_PAYMENT').'">'; |
|
| 261 | + print '<img id="idMAIN_IMAGE_PUBLIC_PAYMENT" src="'.getDolGlobalString('MAIN_IMAGE_PUBLIC_PAYMENT').'">'; |
|
| 262 | 262 | print '</div>'; |
| 263 | 263 | } |
| 264 | 264 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | // Set by newpayment.php |
| 279 | 279 | $currencyCodeType = $_SESSION['currencyCodeType']; |
| 280 | 280 | $FinalPaymentAmt = $_SESSION["FinalPaymentAmt"]; |
| 281 | - $paymentType = $_SESSION['PaymentType']; // Value can be 'Mark', 'Sole', 'Sale' for example |
|
| 281 | + $paymentType = $_SESSION['PaymentType']; // Value can be 'Mark', 'Sole', 'Sale' for example |
|
| 282 | 282 | // From env |
| 283 | 283 | $ipaddress = $_SESSION['ipaddress']; |
| 284 | 284 | |
@@ -381,10 +381,10 @@ discard block |
||
| 381 | 381 | $ipaddress = $_SESSION['ipaddress']; |
| 382 | 382 | } |
| 383 | 383 | if (empty($TRANSACTIONID)) { |
| 384 | - $TRANSACTIONID = empty($_SESSION['TRANSACTIONID']) ? '' :$_SESSION['TRANSACTIONID']; // pi_... or ch_... |
|
| 384 | + $TRANSACTIONID = empty($_SESSION['TRANSACTIONID']) ? '' : $_SESSION['TRANSACTIONID']; // pi_... or ch_... |
|
| 385 | 385 | if (empty($TRANSACTIONID) && GETPOST('payment_intent', 'alphanohtml')) { |
| 386 | 386 | // For the case we use STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 2 |
| 387 | - $TRANSACTIONID = GETPOST('payment_intent', 'alphanohtml'); |
|
| 387 | + $TRANSACTIONID = GETPOST('payment_intent', 'alphanohtml'); |
|
| 388 | 388 | } |
| 389 | 389 | } |
| 390 | 390 | if (empty($FinalPaymentAmt)) { |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | if (empty($adht->caneditamount)) { // If we didn't allow members to choose their membership amount (if the amount is allowed in edit mode, no need to check) |
| 487 | 487 | if ($object->status == $object::STATUS_DRAFT) { // If the member is not yet validated, we check that the amount is the same as expected. |
| 488 | 488 | $typeid = $object->typeid; |
| 489 | - $amountbytype = $adht->amountByType(1); // Load the array of amount per type |
|
| 489 | + $amountbytype = $adht->amountByType(1); // Load the array of amount per type |
|
| 490 | 490 | |
| 491 | 491 | // Set amount for the subscription: |
| 492 | 492 | // - First check the amount of the member type. |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | if (getDolGlobalInt('MEMBER_MIN_AMOUNT')) { |
| 517 | 517 | if ($FinalPaymentAmt < getDolGlobalInt('MEMBER_MIN_AMOUNT')) { |
| 518 | 518 | $error++; |
| 519 | - $errmsg = 'Value of FinalPayment ('.$FinalPaymentAmt.') is lower than the minimum allowed (' . getDolGlobalString('MEMBER_MIN_AMOUNT').'). May be a hack to try to pay a different amount ?'; |
|
| 519 | + $errmsg = 'Value of FinalPayment ('.$FinalPaymentAmt.') is lower than the minimum allowed ('.getDolGlobalString('MEMBER_MIN_AMOUNT').'). May be a hack to try to pay a different amount ?'; |
|
| 520 | 520 | $postactionmessages[] = $errmsg; |
| 521 | 521 | $ispostactionok = -1; |
| 522 | 522 | dol_syslog("Failed to validate member (amount propagated from payment page is lower than allowed minimum): ".$errmsg, LOG_ERR, 0, '_payment'); |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | dol_syslog("Failed to validate member (bad currency check): ".$errmsg, LOG_ERR, 0, '_payment'); |
| 533 | 533 | } |
| 534 | 534 | |
| 535 | - if (! $error) { |
|
| 535 | + if (!$error) { |
|
| 536 | 536 | // We validate the member (no effect if it is already validated) |
| 537 | 537 | $result = ($object->status == $object::STATUS_EXCLUDED) ? -1 : $object->validate($user); // if membre is excluded (status == -2) the new validation is not possible |
| 538 | 538 | if ($result < 0 || empty($object->datevalid)) { |
@@ -696,7 +696,7 @@ discard block |
||
| 696 | 696 | $thirdparty = new Societe($db); |
| 697 | 697 | $thirdparty->fetch($thirdparty_id); |
| 698 | 698 | |
| 699 | - include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; // This also set $stripearrayofkeysbyenv |
|
| 699 | + include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; // This also set $stripearrayofkeysbyenv |
|
| 700 | 700 | $stripe = new Stripe($db); |
| 701 | 701 | //$stripeacc = $stripe->getStripeAccount($service); Already defined previously |
| 702 | 702 | |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | |
| 712 | 712 | if (preg_match('/^pi_/', $TRANSACTIONID)) { |
| 713 | 713 | // This may throw an error if not found. |
| 714 | - $chpi = \Stripe\PaymentIntent::retrieve($TRANSACTIONID); // payment_intent (pi_...) |
|
| 714 | + $chpi = \Stripe\PaymentIntent::retrieve($TRANSACTIONID); // payment_intent (pi_...) |
|
| 715 | 715 | } else { |
| 716 | 716 | // This throw an error if not found |
| 717 | 717 | $chpi = \Stripe\Charge::retrieve($TRANSACTIONID); // old method, contains the charge id (ch_...) |
@@ -770,7 +770,7 @@ discard block |
||
| 770 | 770 | // Create external user |
| 771 | 771 | if (getDolGlobalString('ADHERENT_CREATE_EXTERNAL_USER_LOGIN')) { |
| 772 | 772 | $nuser = new User($db); |
| 773 | - $tmpuser = dol_clone($object, 0); // $object is type Adherent |
|
| 773 | + $tmpuser = dol_clone($object, 0); // $object is type Adherent |
|
| 774 | 774 | |
| 775 | 775 | // Check if a user login already exists for this member or not |
| 776 | 776 | $found = 0; |
@@ -935,7 +935,7 @@ discard block |
||
| 935 | 935 | $paiement->paiementid = $paymentTypeId; |
| 936 | 936 | $paiement->num_payment = ''; |
| 937 | 937 | $paiement->note_public = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress; |
| 938 | - $paiement->ext_payment_id = $TRANSACTIONID; // TODO LDR May be we should store py_... instead of pi_... but we started with pi_... so we continue. |
|
| 938 | + $paiement->ext_payment_id = $TRANSACTIONID; // TODO LDR May be we should store py_... instead of pi_... but we started with pi_... so we continue. |
|
| 939 | 939 | //$paiement->ext_payment_id = $TRANSACTIONID.':'.$customer->id.'@'.$stripearrayofkeysbyenv[$servicestatus]['publishable_key']; // TODO LDR It would be better if we could store this. Do we have customer->id and publishable_key ? |
| 940 | 940 | $paiement->ext_payment_site = $service; |
| 941 | 941 | |
@@ -1007,7 +1007,7 @@ discard block |
||
| 1007 | 1007 | $ispostactionok = -1; |
| 1008 | 1008 | } |
| 1009 | 1009 | } elseif (array_key_exists('ORD', $tmptag) && $tmptag['ORD'] > 0) { |
| 1010 | - include_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php'; |
|
| 1010 | + include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; |
|
| 1011 | 1011 | $object = new Commande($db); |
| 1012 | 1012 | $result = $object->fetch((int) $tmptag['ORD']); |
| 1013 | 1013 | if ($result) { |
@@ -1042,14 +1042,14 @@ discard block |
||
| 1042 | 1042 | // Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time) |
| 1043 | 1043 | if (isModEnabled('invoice')) { |
| 1044 | 1044 | if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) { |
| 1045 | - include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; |
|
| 1045 | + include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
|
| 1046 | 1046 | $invoice = new Facture($db); |
| 1047 | 1047 | $result = $invoice->createFromOrder($object, $user); |
| 1048 | 1048 | if ($result > 0) { |
| 1049 | 1049 | $object->classifyBilled($user); |
| 1050 | 1050 | $invoice->validate($user); |
| 1051 | 1051 | // Creation of payment line |
| 1052 | - include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php'; |
|
| 1052 | + include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; |
|
| 1053 | 1053 | $paiement = new Paiement($db); |
| 1054 | 1054 | $paiement->datepaye = $now; |
| 1055 | 1055 | if ($currencyCodeType == $conf->currency) { |
@@ -1063,14 +1063,14 @@ discard block |
||
| 1063 | 1063 | } |
| 1064 | 1064 | $paiement->paiementid = $paymentTypeId; |
| 1065 | 1065 | $paiement->num_payment = ''; |
| 1066 | - $paiement->note_public = 'Online payment ' . dol_print_date($now, 'standard') . ' from ' . $ipaddress; |
|
| 1067 | - $paiement->ext_payment_id = $TRANSACTIONID; // pi_... for Stripe, ... |
|
| 1068 | - $paiement->ext_payment_site = $service; // 'StripeLive' or 'Stripe', or ... |
|
| 1066 | + $paiement->note_public = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress; |
|
| 1067 | + $paiement->ext_payment_id = $TRANSACTIONID; // pi_... for Stripe, ... |
|
| 1068 | + $paiement->ext_payment_site = $service; // 'StripeLive' or 'Stripe', or ... |
|
| 1069 | 1069 | |
| 1070 | 1070 | if (!$error) { |
| 1071 | 1071 | $paiement_id = $paiement->create($user, 1); // This include closing invoices and regenerating documents |
| 1072 | 1072 | if ($paiement_id < 0) { |
| 1073 | - $postactionmessages[] = $paiement->error . ' ' . implode("<br>\n", $paiement->errors); |
|
| 1073 | + $postactionmessages[] = $paiement->error.' '.implode("<br>\n", $paiement->errors); |
|
| 1074 | 1074 | $ispostactionok = -1; |
| 1075 | 1075 | $error++; |
| 1076 | 1076 | } else { |
@@ -1107,7 +1107,7 @@ discard block |
||
| 1107 | 1107 | } |
| 1108 | 1108 | $result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, '', ''); |
| 1109 | 1109 | if ($result < 0) { |
| 1110 | - $postactionmessages[] = $paiement->error . ' ' . implode("<br>\n", $paiement->errors); |
|
| 1110 | + $postactionmessages[] = $paiement->error.' '.implode("<br>\n", $paiement->errors); |
|
| 1111 | 1111 | $ispostactionok = -1; |
| 1112 | 1112 | $error++; |
| 1113 | 1113 | } else { |
@@ -1115,7 +1115,7 @@ discard block |
||
| 1115 | 1115 | $ispostactionok = 1; |
| 1116 | 1116 | } |
| 1117 | 1117 | } else { |
| 1118 | - $postactionmessages[] = 'Setup of bank account to use in module ' . $paymentmethod . ' was not set. No way to record the payment.'; |
|
| 1118 | + $postactionmessages[] = 'Setup of bank account to use in module '.$paymentmethod.' was not set. No way to record the payment.'; |
|
| 1119 | 1119 | $ispostactionok = -1; |
| 1120 | 1120 | $error++; |
| 1121 | 1121 | } |
@@ -1127,11 +1127,11 @@ discard block |
||
| 1127 | 1127 | $db->rollback(); |
| 1128 | 1128 | } |
| 1129 | 1129 | } else { |
| 1130 | - $postactionmessages[] = 'Failed to create invoice form order ' . $tmptag['ORD'] . '.'; |
|
| 1130 | + $postactionmessages[] = 'Failed to create invoice form order '.$tmptag['ORD'].'.'; |
|
| 1131 | 1131 | $ispostactionok = -1; |
| 1132 | 1132 | } |
| 1133 | 1133 | } else { |
| 1134 | - $postactionmessages[] = 'Failed to get a valid value for "amount paid" (' . $FinalPaymentAmt . ') or "payment type id" (' . $paymentTypeId . ') to record the payment of order ' . $tmptag['ORD'] . '. May be payment was already recorded.'; |
|
| 1134 | + $postactionmessages[] = 'Failed to get a valid value for "amount paid" ('.$FinalPaymentAmt.') or "payment type id" ('.$paymentTypeId.') to record the payment of order '.$tmptag['ORD'].'. May be payment was already recorded.'; |
|
| 1135 | 1135 | $ispostactionok = -1; |
| 1136 | 1136 | } |
| 1137 | 1137 | } else { |
@@ -1139,7 +1139,7 @@ discard block |
||
| 1139 | 1139 | $ispostactionok = -1; |
| 1140 | 1140 | } |
| 1141 | 1141 | } else { |
| 1142 | - $postactionmessages[] = 'Order paid ' . $tmptag['ORD'] . ' was not found'; |
|
| 1142 | + $postactionmessages[] = 'Order paid '.$tmptag['ORD'].' was not found'; |
|
| 1143 | 1143 | $ispostactionok = -1; |
| 1144 | 1144 | } |
| 1145 | 1145 | } elseif (array_key_exists('DON', $tmptag) && $tmptag['DON'] > 0) { |
@@ -1196,7 +1196,7 @@ discard block |
||
| 1196 | 1196 | $paiement->datep = $now; |
| 1197 | 1197 | $paiement->paymenttype = $paymentTypeId; |
| 1198 | 1198 | $paiement->num_payment = ''; |
| 1199 | - $paiement->note_public = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress; |
|
| 1199 | + $paiement->note_public = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress; |
|
| 1200 | 1200 | $paiement->ext_payment_id = $TRANSACTIONID; |
| 1201 | 1201 | $paiement->ext_payment_site = $service; |
| 1202 | 1202 | |
@@ -1413,7 +1413,7 @@ discard block |
||
| 1413 | 1413 | $db->rollback(); |
| 1414 | 1414 | } |
| 1415 | 1415 | |
| 1416 | - if (! $error) { |
|
| 1416 | + if (!$error) { |
|
| 1417 | 1417 | // Sending mail |
| 1418 | 1418 | $thirdparty = new Societe($db); |
| 1419 | 1419 | $resultthirdparty = $thirdparty->fetch($attendeetovalidate->fk_soc); |
@@ -1431,7 +1431,7 @@ discard block |
||
| 1431 | 1431 | // Get email content from template |
| 1432 | 1432 | $arraydefaultmessage = null; |
| 1433 | 1433 | |
| 1434 | - $idoftemplatetouse = getDolGlobalString('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'); // Email to send for Event organization registration |
|
| 1434 | + $idoftemplatetouse = getDolGlobalString('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'); // Email to send for Event organization registration |
|
| 1435 | 1435 | |
| 1436 | 1436 | if (!empty($idoftemplatetouse)) { |
| 1437 | 1437 | $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $idoftemplatetouse, 1, ''); |
@@ -1633,18 +1633,18 @@ discard block |
||
| 1633 | 1633 | } else { |
| 1634 | 1634 | $booth->status = ConferenceOrBooth::STATUS_SUGGESTED; |
| 1635 | 1635 | $resultboothupdate = $booth->update($user); |
| 1636 | - if ($resultboothupdate<0) { |
|
| 1636 | + if ($resultboothupdate < 0) { |
|
| 1637 | 1637 | // Finding the thirdparty by getting the invoice |
| 1638 | 1638 | $invoice = new Facture($db); |
| 1639 | 1639 | $resultinvoice = $invoice->fetch($ref); |
| 1640 | - if ($resultinvoice<0) { |
|
| 1640 | + if ($resultinvoice < 0) { |
|
| 1641 | 1641 | $postactionmessages[] = 'Could not find the associated invoice.'; |
| 1642 | 1642 | $ispostactionok = -1; |
| 1643 | 1643 | $error++; |
| 1644 | 1644 | } else { |
| 1645 | 1645 | $thirdparty = new Societe($db); |
| 1646 | 1646 | $resultthirdparty = $thirdparty->fetch($invoice->socid); |
| 1647 | - if ($resultthirdparty<0) { |
|
| 1647 | + if ($resultthirdparty < 0) { |
|
| 1648 | 1648 | $error++; |
| 1649 | 1649 | setEventMessages(null, $thirdparty->errors, "errors"); |
| 1650 | 1650 | } else { |
@@ -1660,7 +1660,7 @@ discard block |
||
| 1660 | 1660 | // Get email content from template |
| 1661 | 1661 | $arraydefaultmessage = null; |
| 1662 | 1662 | |
| 1663 | - $idoftemplatetouse = getDolGlobalString('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH'); // Email sent after registration for a Booth |
|
| 1663 | + $idoftemplatetouse = getDolGlobalString('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH'); // Email sent after registration for a Booth |
|
| 1664 | 1664 | |
| 1665 | 1665 | if (!empty($idoftemplatetouse)) { |
| 1666 | 1666 | $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $idoftemplatetouse, 1, ''); |
@@ -1716,7 +1716,7 @@ discard block |
||
| 1716 | 1716 | $ispostactionok = -1; |
| 1717 | 1717 | } |
| 1718 | 1718 | } elseif (array_key_exists('CON', $tmptag) && $tmptag['CON'] > 0) { |
| 1719 | - include_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; |
|
| 1719 | + include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
|
| 1720 | 1720 | $object = new Contrat($db); |
| 1721 | 1721 | $result = $object->fetch((int) $tmptag['CON']); |
| 1722 | 1722 | if ($result) { |
@@ -1754,14 +1754,14 @@ discard block |
||
| 1754 | 1754 | // Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time) |
| 1755 | 1755 | if (isModEnabled('invoice')) { |
| 1756 | 1756 | if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) { |
| 1757 | - include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; |
|
| 1757 | + include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
|
| 1758 | 1758 | $invoice = new Facture($db); |
| 1759 | 1759 | $result = $invoice->createFromContract($object, $user, array((int) $contract_lines)); |
| 1760 | 1760 | if ($result > 0) { |
| 1761 | 1761 | // $object->classifyBilled($user); |
| 1762 | 1762 | $invoice->validate($user); |
| 1763 | 1763 | // Creation of payment line |
| 1764 | - include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php'; |
|
| 1764 | + include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; |
|
| 1765 | 1765 | $paiement = new Paiement($db); |
| 1766 | 1766 | $paiement->datepaye = $now; |
| 1767 | 1767 | if ($currencyCodeType == $conf->currency) { |
@@ -1775,14 +1775,14 @@ discard block |
||
| 1775 | 1775 | } |
| 1776 | 1776 | $paiement->paiementid = $paymentTypeId; |
| 1777 | 1777 | $paiement->num_payment = ''; |
| 1778 | - $paiement->note_public = 'Online payment ' . dol_print_date($now, 'standard') . ' from ' . $ipaddress; |
|
| 1779 | - $paiement->ext_payment_id = $TRANSACTIONID; // pi_... for Stripe, ... |
|
| 1780 | - $paiement->ext_payment_site = $service; // 'StripeLive' or 'Stripe', or ... |
|
| 1778 | + $paiement->note_public = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress; |
|
| 1779 | + $paiement->ext_payment_id = $TRANSACTIONID; // pi_... for Stripe, ... |
|
| 1780 | + $paiement->ext_payment_site = $service; // 'StripeLive' or 'Stripe', or ... |
|
| 1781 | 1781 | |
| 1782 | 1782 | if (!$error) { |
| 1783 | 1783 | $paiement_id = $paiement->create($user, 1); // This include closing invoices and regenerating documents |
| 1784 | 1784 | if ($paiement_id < 0) { |
| 1785 | - $postactionmessages[] = $paiement->error . ' ' . implode("<br>\n", $paiement->errors); |
|
| 1785 | + $postactionmessages[] = $paiement->error.' '.implode("<br>\n", $paiement->errors); |
|
| 1786 | 1786 | $ispostactionok = -1; |
| 1787 | 1787 | $error++; |
| 1788 | 1788 | } else { |
@@ -1819,7 +1819,7 @@ discard block |
||
| 1819 | 1819 | } |
| 1820 | 1820 | $result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, '', ''); |
| 1821 | 1821 | if ($result < 0) { |
| 1822 | - $postactionmessages[] = $paiement->error . ' ' . implode("<br>\n", $paiement->errors); |
|
| 1822 | + $postactionmessages[] = $paiement->error.' '.implode("<br>\n", $paiement->errors); |
|
| 1823 | 1823 | $ispostactionok = -1; |
| 1824 | 1824 | $error++; |
| 1825 | 1825 | } else { |
@@ -1827,7 +1827,7 @@ discard block |
||
| 1827 | 1827 | $ispostactionok = 1; |
| 1828 | 1828 | } |
| 1829 | 1829 | } else { |
| 1830 | - $postactionmessages[] = 'Setup of bank account to use in module ' . $paymentmethod . ' was not set. No way to record the payment.'; |
|
| 1830 | + $postactionmessages[] = 'Setup of bank account to use in module '.$paymentmethod.' was not set. No way to record the payment.'; |
|
| 1831 | 1831 | $ispostactionok = -1; |
| 1832 | 1832 | $error++; |
| 1833 | 1833 | } |
@@ -1839,15 +1839,15 @@ discard block |
||
| 1839 | 1839 | $db->rollback(); |
| 1840 | 1840 | } |
| 1841 | 1841 | } else { |
| 1842 | - $msg = 'Failed to create invoice form contract ' . $tmptag['CON']; |
|
| 1842 | + $msg = 'Failed to create invoice form contract '.$tmptag['CON']; |
|
| 1843 | 1843 | if (!empty($cols)) { |
| 1844 | - $msg .= ' and col '. $cols .'.'; |
|
| 1844 | + $msg .= ' and col '.$cols.'.'; |
|
| 1845 | 1845 | } |
| 1846 | 1846 | $postactionmessages[] = $msg; |
| 1847 | 1847 | $ispostactionok = -1; |
| 1848 | 1848 | } |
| 1849 | 1849 | } else { |
| 1850 | - $postactionmessages[] = 'Failed to get a valid value for "amount paid" (' . $FinalPaymentAmt . ') or "payment type id" (' . $paymentTypeId . ') to record the payment of contract ' . $tmptag['CON'] .'. Maybe payment was already recorded.'; |
|
| 1850 | + $postactionmessages[] = 'Failed to get a valid value for "amount paid" ('.$FinalPaymentAmt.') or "payment type id" ('.$paymentTypeId.') to record the payment of contract '.$tmptag['CON'].'. Maybe payment was already recorded.'; |
|
| 1851 | 1851 | $ispostactionok = -1; |
| 1852 | 1852 | } |
| 1853 | 1853 | } else { |
@@ -1855,9 +1855,9 @@ discard block |
||
| 1855 | 1855 | $ispostactionok = -1; |
| 1856 | 1856 | } |
| 1857 | 1857 | } else { |
| 1858 | - $msg = 'Contract paid ' . $tmptag['CON'] . ' was not found'; |
|
| 1858 | + $msg = 'Contract paid '.$tmptag['CON'].' was not found'; |
|
| 1859 | 1859 | if (!empty($cols)) { |
| 1860 | - $msg .= ' for col '.$tmptag['COL'] .'.'; |
|
| 1860 | + $msg .= ' for col '.$tmptag['COL'].'.'; |
|
| 1861 | 1861 | } |
| 1862 | 1862 | $postactionmessages[] = $msg; |
| 1863 | 1863 | $ispostactionok = -1; |
@@ -1873,8 +1873,8 @@ discard block |
||
| 1873 | 1873 | $payerID = empty($PAYPALPAYERID) ? $_SESSION['payerID'] : $PAYPALPAYERID; |
| 1874 | 1874 | // Set by newpayment.php |
| 1875 | 1875 | $currencyCodeType = empty($_SESSION['currencyCodeType']) ? '' : $_SESSION['currencyCodeType']; |
| 1876 | - $FinalPaymentAmt = empty($_SESSION["FinalPaymentAmt"]) ? '': $_SESSION["FinalPaymentAmt"]; |
|
| 1877 | - $paymentType = empty($_SESSION['PaymentType']) ? '' : $_SESSION['PaymentType']; // Seems used by paypal only |
|
| 1876 | + $FinalPaymentAmt = empty($_SESSION["FinalPaymentAmt"]) ? '' : $_SESSION["FinalPaymentAmt"]; |
|
| 1877 | + $paymentType = empty($_SESSION['PaymentType']) ? '' : $_SESSION['PaymentType']; // Seems used by paypal only |
|
| 1878 | 1878 | |
| 1879 | 1879 | if (is_object($object) && method_exists($object, 'call_trigger')) { |
| 1880 | 1880 | // Call trigger |
@@ -2111,7 +2111,7 @@ discard block |
||
| 2111 | 2111 | // Redirect to a success page |
| 2112 | 2112 | // Paymentok page must be created for the specific website |
| 2113 | 2113 | $ext_urlok = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentok&fulltag='.$FULLTAG; |
| 2114 | - print "<script>window.top.location.href = '".dol_escape_js($ext_urlok) ."';</script>"; |
|
| 2114 | + print "<script>window.top.location.href = '".dol_escape_js($ext_urlok)."';</script>"; |
|
| 2115 | 2115 | } else { |
| 2116 | 2116 | // Redirect to an error page |
| 2117 | 2117 | // Paymentko page must be created for the specific website |
@@ -306,10 +306,10 @@ discard block |
||
| 306 | 306 | if (getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) { |
| 307 | 307 | if ($tmpsource && $REF) { |
| 308 | 308 | // Use the source in the hash to avoid duplicates if the references are identical |
| 309 | - $tokenisok = dol_verifyHash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $tmpsource.$REF, $SECUREKEY, '2'); |
|
| 309 | + $tokenisok = dol_verifyHash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$tmpsource.$REF, $SECUREKEY, '2'); |
|
| 310 | 310 | // Do a second test for retro-compatibility (token may have been hashed with membersubscription in external module) |
| 311 | 311 | if ($tmpsource != $source) { |
| 312 | - $tokenisok = dol_verifyHash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $source.$REF, $SECUREKEY, '2'); |
|
| 312 | + $tokenisok = dol_verifyHash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$source.$REF, $SECUREKEY, '2'); |
|
| 313 | 313 | } |
| 314 | 314 | } else { |
| 315 | 315 | $tokenisok = dol_verifyHash($conf->global->PAYMENT_SECURITY_TOKEN, $SECUREKEY, '2'); |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | $tokenisok = ($conf->global->PAYMENT_SECURITY_TOKEN == $SECUREKEY); |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - if (! $tokenisok) { |
|
| 321 | + if (!$tokenisok) { |
|
| 322 | 322 | if (!getDolGlobalString('PAYMENT_SECURITY_ACCEPT_ANY_TOKEN')) { |
| 323 | 323 | $valid = false; // PAYMENT_SECURITY_ACCEPT_ANY_TOKEN is for backward compatibility |
| 324 | 324 | } else { |
@@ -347,9 +347,9 @@ discard block |
||
| 347 | 347 | $paramcreditor = 'ONLINE_PAYMENT_CREDITOR'; |
| 348 | 348 | $paramcreditorlong = 'ONLINE_PAYMENT_CREDITOR_'.$suffix; |
| 349 | 349 | if (getDolGlobalString($paramcreditorlong)) { |
| 350 | - $creditor = getDolGlobalString($paramcreditorlong); // use label long of the seller to show |
|
| 350 | + $creditor = getDolGlobalString($paramcreditorlong); // use label long of the seller to show |
|
| 351 | 351 | } elseif (getDolGlobalString($paramcreditor)) { |
| 352 | - $creditor = getDolGlobalString($paramcreditor); // use label short of the seller to show |
|
| 352 | + $creditor = getDolGlobalString($paramcreditor); // use label short of the seller to show |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | $mesg = ''; |
@@ -797,8 +797,8 @@ discard block |
||
| 797 | 797 | $remoteip = getUserRemoteIP(); |
| 798 | 798 | |
| 799 | 799 | $_SESSION["onlinetoken"] = $stripeToken; |
| 800 | - $_SESSION["FinalPaymentAmt"] = $amount; // amount really paid (coming from Stripe). Will be used for check in paymentok.php. |
|
| 801 | - $_SESSION["currencyCodeType"] = $currency; // currency really used for payment (coming from Stripe). Will be used for check in paymentok.php. |
|
| 800 | + $_SESSION["FinalPaymentAmt"] = $amount; // amount really paid (coming from Stripe). Will be used for check in paymentok.php. |
|
| 801 | + $_SESSION["currencyCodeType"] = $currency; // currency really used for payment (coming from Stripe). Will be used for check in paymentok.php. |
|
| 802 | 802 | $_SESSION["paymentType"] = ''; |
| 803 | 803 | $_SESSION['ipaddress'] = ($remoteip ? $remoteip : 'unknown'); // Payer ip |
| 804 | 804 | $_SESSION['payerID'] = is_object($customer) ? $customer->id : ''; |
@@ -844,7 +844,7 @@ discard block |
||
| 844 | 844 | |
| 845 | 845 | $head = ''; |
| 846 | 846 | if (getDolGlobalString('ONLINE_PAYMENT_CSS_URL')) { |
| 847 | - $head = '<link rel="stylesheet" type="text/css" href="' . getDolGlobalString('ONLINE_PAYMENT_CSS_URL').'?lang='.(!empty($getpostlang) ? $getpostlang : $langs->defaultlang).'">'."\n"; |
|
| 847 | + $head = '<link rel="stylesheet" type="text/css" href="'.getDolGlobalString('ONLINE_PAYMENT_CSS_URL').'?lang='.(!empty($getpostlang) ? $getpostlang : $langs->defaultlang).'">'."\n"; |
|
| 848 | 848 | } |
| 849 | 849 | |
| 850 | 850 | $conf->dol_hide_topmenu = 1; |
@@ -969,7 +969,7 @@ discard block |
||
| 969 | 969 | if (preg_match('/^\((.*)\)$/', $conf->global->PAYMENT_NEWFORM_TEXT, $reg)) { |
| 970 | 970 | $text .= $langs->trans($reg[1])."<br>\n"; |
| 971 | 971 | } else { |
| 972 | - $text .= getDolGlobalString('PAYMENT_NEWFORM_TEXT') . "<br>\n"; |
|
| 972 | + $text .= getDolGlobalString('PAYMENT_NEWFORM_TEXT')."<br>\n"; |
|
| 973 | 973 | } |
| 974 | 974 | $text = '<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n"; |
| 975 | 975 | } |
@@ -980,7 +980,7 @@ discard block |
||
| 980 | 980 | print $text; |
| 981 | 981 | |
| 982 | 982 | // Output payment summary form |
| 983 | -print '<tr><td align="center">'; // class=center does not have the payment button centered so we keep align here. |
|
| 983 | +print '<tr><td align="center">'; // class=center does not have the payment button centered so we keep align here. |
|
| 984 | 984 | print '<table class="centpercent left" id="tablepublicpayment">'; |
| 985 | 985 | print '<tr class="hideonsmartphone"><td colspan="2" align="left" class="opacitymedium">'.$langs->trans("ThisIsInformationOnPayment").' :</td></tr>'."\n"; |
| 986 | 986 | |
@@ -1020,7 +1020,7 @@ discard block |
||
| 1020 | 1020 | // Currency |
| 1021 | 1021 | print ' <b>'.$langs->trans("Currency".$currency).'</b>'; |
| 1022 | 1022 | } else { |
| 1023 | - print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
| 1023 | + print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
| 1024 | 1024 | print '<input type="hidden" name="amount" value="'.$amount.'">'; |
| 1025 | 1025 | print '<input type="hidden" name="newamount" value="'.$amount.'">'; |
| 1026 | 1026 | } |
@@ -1121,7 +1121,7 @@ discard block |
||
| 1121 | 1121 | // Currency |
| 1122 | 1122 | print ' <b>'.$langs->trans("Currency".$currency).'</b>'; |
| 1123 | 1123 | } else { |
| 1124 | - print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
| 1124 | + print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
| 1125 | 1125 | print '<input type="hidden" name="amount" value="'.$amount.'">'; |
| 1126 | 1126 | print '<input type="hidden" name="newamount" value="'.$amount.'">'; |
| 1127 | 1127 | } |
@@ -1253,12 +1253,12 @@ discard block |
||
| 1253 | 1253 | print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount", "alpha"), 'MT').'">'; |
| 1254 | 1254 | print ' <b>'.$langs->trans("Currency".$currency).'</b>'; |
| 1255 | 1255 | } else { |
| 1256 | - print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
| 1256 | + print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
| 1257 | 1257 | print '<input type="hidden" name="amount" value="'.$amount.'">'; |
| 1258 | 1258 | print '<input type="hidden" name="newamount" value="'.$amount.'">'; |
| 1259 | 1259 | } |
| 1260 | 1260 | } else { |
| 1261 | - print '<b class="amount">'.price($object->total_ttc, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
| 1261 | + print '<b class="amount">'.price($object->total_ttc, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
| 1262 | 1262 | } |
| 1263 | 1263 | print '<input type="hidden" name="currency" value="'.$currency.'">'; |
| 1264 | 1264 | print '</td></tr>'."\n"; |
@@ -1462,7 +1462,7 @@ discard block |
||
| 1462 | 1462 | // Currency |
| 1463 | 1463 | print ' <b>'.$langs->trans("Currency".$currency).'</b>'; |
| 1464 | 1464 | } else { |
| 1465 | - print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
| 1465 | + print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
| 1466 | 1466 | print '<input type="hidden" name="amount" value="'.$amount.'">'; |
| 1467 | 1467 | print '<input type="hidden" name="newamount" value="'.$amount.'">'; |
| 1468 | 1468 | } |
@@ -1629,7 +1629,7 @@ discard block |
||
| 1629 | 1629 | $newtypeid = (int) (GETPOSTISSET("typeid") ? GETPOSTINT("typeid") : $member->typeid); |
| 1630 | 1630 | if (getDolGlobalString('MEMBER_ALLOW_CHANGE_OF_TYPE')) { |
| 1631 | 1631 | $typeid = $newtypeid; |
| 1632 | - $adht->fetch($typeid); // Reload with the new type id |
|
| 1632 | + $adht->fetch($typeid); // Reload with the new type id |
|
| 1633 | 1633 | } |
| 1634 | 1634 | |
| 1635 | 1635 | $caneditamount = $adht->caneditamount; |
@@ -1685,7 +1685,7 @@ discard block |
||
| 1685 | 1685 | print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Amount"); |
| 1686 | 1686 | // This place no longer allows amount edition |
| 1687 | 1687 | if (getDolGlobalString('MEMBER_EXT_URL_SUBSCRIPTION_INFO')) { |
| 1688 | - print ' - <a href="' . getDolGlobalString('MEMBER_EXT_URL_SUBSCRIPTION_INFO').'" rel="external" target="_blank" rel="noopener noreferrer">'.$langs->trans("SeeHere").'</a>'; |
|
| 1688 | + print ' - <a href="'.getDolGlobalString('MEMBER_EXT_URL_SUBSCRIPTION_INFO').'" rel="external" target="_blank" rel="noopener noreferrer">'.$langs->trans("SeeHere").'</a>'; |
|
| 1689 | 1689 | } |
| 1690 | 1690 | print '</td><td class="CTableRow2">'; |
| 1691 | 1691 | |
@@ -1699,9 +1699,9 @@ discard block |
||
| 1699 | 1699 | print '<input type="text" class="width75" name="newamount" value="'.price($amount, 1, $langs, 1, -1, -1).'">'; |
| 1700 | 1700 | } |
| 1701 | 1701 | } else { |
| 1702 | - print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
| 1702 | + print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
| 1703 | 1703 | if ($minimumamount > $amount) { |
| 1704 | - print ' <span class="opacitymedium small">'. $langs->trans("AmountIsLowerToMinimumNotice", price($minimumamount, 1, $langs, 1, -1, -1, $currency)).'</span>'; |
|
| 1704 | + print ' <span class="opacitymedium small">'.$langs->trans("AmountIsLowerToMinimumNotice", price($minimumamount, 1, $langs, 1, -1, -1, $currency)).'</span>'; |
|
| 1705 | 1705 | } |
| 1706 | 1706 | print '<input type="hidden" name="newamount" value="'.$amount.'">'; |
| 1707 | 1707 | } |
@@ -1822,7 +1822,7 @@ discard block |
||
| 1822 | 1822 | print ' ('.$langs->trans("ToComplete"); |
| 1823 | 1823 | } |
| 1824 | 1824 | if (getDolGlobalString('DONATION_EXT_URL_SUBSCRIPTION_INFO')) { |
| 1825 | - print ' - <a href="' . getDolGlobalString('DONATION_EXT_URL_SUBSCRIPTION_INFO').'" rel="external" target="_blank" rel="noopener noreferrer">'.$langs->trans("SeeHere").'</a>'; |
|
| 1825 | + print ' - <a href="'.getDolGlobalString('DONATION_EXT_URL_SUBSCRIPTION_INFO').'" rel="external" target="_blank" rel="noopener noreferrer">'.$langs->trans("SeeHere").'</a>'; |
|
| 1826 | 1826 | } |
| 1827 | 1827 | if (!getDolGlobalString('DONATION_NEWFORM_AMOUNT')) { |
| 1828 | 1828 | print ')'; |
@@ -1860,7 +1860,7 @@ discard block |
||
| 1860 | 1860 | $valtoshow = max(getDolGlobalString('DONATION_MIN_AMOUNT'), $valtoshow); |
| 1861 | 1861 | $amount = $valtoshow; |
| 1862 | 1862 | } |
| 1863 | - print '<b class="amount">'.price($valtoshow, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
| 1863 | + print '<b class="amount">'.price($valtoshow, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
| 1864 | 1864 | print '<input type="hidden" name="amount" value="'.$valtoshow.'">'; |
| 1865 | 1865 | print '<input type="hidden" name="newamount" value="'.$valtoshow.'">'; |
| 1866 | 1866 | } |
@@ -1936,7 +1936,7 @@ discard block |
||
| 1936 | 1936 | print '</b>'; |
| 1937 | 1937 | print '</td></tr>'."\n"; |
| 1938 | 1938 | |
| 1939 | - if (! is_object($attendee->project)) { |
|
| 1939 | + if (!is_object($attendee->project)) { |
|
| 1940 | 1940 | $text = 'ErrorProjectNotFound'; |
| 1941 | 1941 | } else { |
| 1942 | 1942 | $text = $langs->trans("PaymentEvent").' - '.$attendee->project->title; |
@@ -1953,7 +1953,7 @@ discard block |
||
| 1953 | 1953 | print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Amount"); |
| 1954 | 1954 | print '</td><td class="CTableRow2">'; |
| 1955 | 1955 | $valtoshow = $amount; |
| 1956 | - print '<b class="amount">'.price($valtoshow, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
| 1956 | + print '<b class="amount">'.price($valtoshow, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
| 1957 | 1957 | print '<input type="hidden" name="amount" value="'.$valtoshow.'">'; |
| 1958 | 1958 | print '<input type="hidden" name="newamount" value="'.$valtoshow.'">'; |
| 1959 | 1959 | print '<input type="hidden" name="currency" value="'.$currency.'">'; |
@@ -2037,7 +2037,7 @@ discard block |
||
| 2037 | 2037 | print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Amount"); |
| 2038 | 2038 | print '</td><td class="CTableRow2">'; |
| 2039 | 2039 | $valtoshow = $amount; |
| 2040 | - print '<b class="amount">'.price($valtoshow, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
| 2040 | + print '<b class="amount">'.price($valtoshow, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
| 2041 | 2041 | print '<input type="hidden" name="amount" value="'.$valtoshow.'">'; |
| 2042 | 2042 | print '<input type="hidden" name="newamount" value="'.$valtoshow.'">'; |
| 2043 | 2043 | print '<input type="hidden" name="currency" value="'.$currency.'">'; |
@@ -2288,7 +2288,7 @@ discard block |
||
| 2288 | 2288 | |
| 2289 | 2289 | //print '<br>'; |
| 2290 | 2290 | |
| 2291 | - print '<!-- Show Stripe form payment-form STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = ' . getDolGlobalString('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION').' STRIPE_USE_NEW_CHECKOUT = ' . getDolGlobalString('STRIPE_USE_NEW_CHECKOUT').' -->'."\n"; |
|
| 2291 | + print '<!-- Show Stripe form payment-form STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = '.getDolGlobalString('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION').' STRIPE_USE_NEW_CHECKOUT = '.getDolGlobalString('STRIPE_USE_NEW_CHECKOUT').' -->'."\n"; |
|
| 2292 | 2292 | print '<form action="'.$_SERVER['REQUEST_URI'].'" method="POST" id="payment-form">'."\n"; |
| 2293 | 2293 | |
| 2294 | 2294 | print '<input type="hidden" name="token" value="'.newToken().'">'."\n"; |
@@ -62,15 +62,15 @@ discard block |
||
| 62 | 62 | function getArrayOfEmoji() |
| 63 | 63 | { |
| 64 | 64 | $arrayofcommonemoji = array( |
| 65 | - 'misc' => array('2600', '26FF'), // Miscellaneous Symbols |
|
| 66 | - 'ding' => array('2700', '27BF'), // Dingbats |
|
| 67 | - '????' => array('9989', '9989'), // Variation Selectors |
|
| 68 | - 'vars' => array('FE00', 'FE0F'), // Variation Selectors |
|
| 69 | - 'pict' => array('1F300', '1F5FF'), // Miscellaneous Symbols and Pictographs |
|
| 70 | - 'emot' => array('1F600', '1F64F'), // Emoticons |
|
| 71 | - 'tran' => array('1F680', '1F6FF'), // Transport and Map Symbols |
|
| 72 | - 'flag' => array('1F1E0', '1F1FF'), // Flags (note: may be 1F1E6 instead of 1F1E0) |
|
| 73 | - 'supp' => array('1F900', '1F9FF'), // Supplemental Symbols and Pictographs |
|
| 65 | + 'misc' => array('2600', '26FF'), // Miscellaneous Symbols |
|
| 66 | + 'ding' => array('2700', '27BF'), // Dingbats |
|
| 67 | + '????' => array('9989', '9989'), // Variation Selectors |
|
| 68 | + 'vars' => array('FE00', 'FE0F'), // Variation Selectors |
|
| 69 | + 'pict' => array('1F300', '1F5FF'), // Miscellaneous Symbols and Pictographs |
|
| 70 | + 'emot' => array('1F600', '1F64F'), // Emoticons |
|
| 71 | + 'tran' => array('1F680', '1F6FF'), // Transport and Map Symbols |
|
| 72 | + 'flag' => array('1F1E0', '1F1FF'), // Flags (note: may be 1F1E6 instead of 1F1E0) |
|
| 73 | + 'supp' => array('1F900', '1F9FF'), // Supplemental Symbols and Pictographs |
|
| 74 | 74 | ); |
| 75 | 75 | |
| 76 | 76 | return $arrayofcommonemoji; |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | //print "before decoding $val\n"; |
| 133 | 133 | do { |
| 134 | 134 | $oldval = $val; |
| 135 | - $val = html_entity_decode($val, ENT_QUOTES | ENT_HTML5); // Decode ':', ''', '	', '&NewLine', ... |
|
| 135 | + $val = html_entity_decode($val, ENT_QUOTES | ENT_HTML5); // Decode ':', ''', '	', '&NewLine', ... |
|
| 136 | 136 | // Sometimes we have entities without the ; at end so html_entity_decode does not work but entities is still interpreted by browser. |
| 137 | 137 | $val = preg_replace_callback( |
| 138 | 138 | '/&#(x?[0-9][0-9a-f]+;?)/i', |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * @param string[] $m |
| 141 | 141 | * @return string |
| 142 | 142 | */ |
| 143 | - static function ($m) { |
|
| 143 | + static function($m) { |
|
| 144 | 144 | // Decode 'n', ... |
| 145 | 145 | return realCharForNumericEntities($m); |
| 146 | 146 | }, |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | $inj += preg_match('/user\s*\(/i', $val); // avoid to use function user() or mysql_user() that return current database login |
| 182 | 182 | $inj += preg_match('/information_schema/i', $val); // avoid to use request that read information_schema database |
| 183 | 183 | $inj += preg_match('/<svg/i', $val); // <svg can be allowed in POST |
| 184 | - $inj += preg_match('/update[^&=\w].*set.+=/i', $val); // the [^&=\w] test is to avoid error when request is like action=update&...set... or &updatemodule=...set... |
|
| 184 | + $inj += preg_match('/update[^&=\w].*set.+=/i', $val); // the [^&=\w] test is to avoid error when request is like action=update&...set... or &updatemodule=...set... |
|
| 185 | 185 | $inj += preg_match('/union.+select/i', $val); |
| 186 | 186 | } |
| 187 | 187 | if ($type == 3) { |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | session_set_cookie_params($sessioncookieparams); |
| 429 | 429 | } |
| 430 | 430 | session_name($sessionname); |
| 431 | - dol_session_start(); // This call the open and read of session handler |
|
| 431 | + dol_session_start(); // This call the open and read of session handler |
|
| 432 | 432 | //exit; // this exist generates a call to write and close |
| 433 | 433 | } |
| 434 | 434 | |
@@ -456,11 +456,11 @@ discard block |
||
| 456 | 456 | if (!$ok) { |
| 457 | 457 | if (session_id() && isset($_SESSION["dol_login"]) && !in_array($_SESSION["dol_login"], explode(';', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')))) { |
| 458 | 458 | print 'Sorry, your application is offline.'."\n"; |
| 459 | - print 'You are logged with user "'.$_SESSION["dol_login"].'" and only administrator users (' . str_replace(';', ', ', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')).') is allowed to connect for the moment.'."\n"; |
|
| 459 | + print 'You are logged with user "'.$_SESSION["dol_login"].'" and only administrator users ('.str_replace(';', ', ', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')).') is allowed to connect for the moment.'."\n"; |
|
| 460 | 460 | $nexturl = DOL_URL_ROOT.'/user/logout.php?token='.newToken(); |
| 461 | 461 | print 'Please try later or <a href="'.$nexturl.'">click here to disconnect and change login user</a>...'."\n"; |
| 462 | 462 | } else { |
| 463 | - print 'Sorry, your application is offline. Only administrator users (' . str_replace(';', ', ', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')).') is allowed to connect for the moment.'."\n"; |
|
| 463 | + print 'Sorry, your application is offline. Only administrator users ('.str_replace(';', ', ', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')).') is allowed to connect for the moment.'."\n"; |
|
| 464 | 464 | $nexturl = DOL_URL_ROOT.'/'; |
| 465 | 465 | print 'Please try later or <a href="'.$nexturl.'">click here to change login user</a>...'."\n"; |
| 466 | 466 | } |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | print "Access to this page this way (POST method or GET with a sensible value for 'action' parameter) is refused by CSRF protection in main.inc.php. Token not provided.\n"; |
| 674 | 674 | print "If you access your server behind a proxy using url rewriting and the parameter is provided by caller, you might check that all HTTP header are propagated (or add the line \$dolibarr_nocsrfcheck=1 into your conf.php file or MAIN_SECURITY_CSRF_WITH_TOKEN to 0"; |
| 675 | 675 | if (getDolGlobalString('MAIN_SECURITY_CSRF_WITH_TOKEN')) { |
| 676 | - print " instead of " . getDolGlobalString('MAIN_SECURITY_CSRF_WITH_TOKEN'); |
|
| 676 | + print " instead of ".getDolGlobalString('MAIN_SECURITY_CSRF_WITH_TOKEN'); |
|
| 677 | 677 | } |
| 678 | 678 | print " into setup).\n"; |
| 679 | 679 | } |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | unset($_GET['action']); |
| 702 | 702 | unset($_GET['confirmmassaction']); |
| 703 | 703 | unset($_GET['massaction']); |
| 704 | - unset($_GET['token']); // TODO Make a redirect if we have a token in url to remove it ? |
|
| 704 | + unset($_GET['token']); // TODO Make a redirect if we have a token in url to remove it ? |
|
| 705 | 705 | if (isset($savid)) { |
| 706 | 706 | $_POST['id'] = ((int) $savid); |
| 707 | 707 | } |
@@ -869,7 +869,7 @@ discard block |
||
| 869 | 869 | |
| 870 | 870 | $allowedmethodtopostusername = 3; |
| 871 | 871 | if (defined('MAIN_AUTHENTICATION_POST_METHOD')) { |
| 872 | - $allowedmethodtopostusername = constant('MAIN_AUTHENTICATION_POST_METHOD'); // Note a value of 2 is not compatible with some authentication methods that put username as GET parameter |
|
| 872 | + $allowedmethodtopostusername = constant('MAIN_AUTHENTICATION_POST_METHOD'); // Note a value of 2 is not compatible with some authentication methods that put username as GET parameter |
|
| 873 | 873 | } |
| 874 | 874 | // TODO Remove use of $_COOKIE['login_dolibarr'] ? Replace $usertotest = with $usertotest = GETPOST("username", "alpha", $allowedmethodtopostusername); |
| 875 | 875 | $usertotest = (!empty($_COOKIE['login_dolibarr']) ? preg_replace('/[^a-zA-Z0-9_@\-\.]/', '', $_COOKIE['login_dolibarr']) : GETPOST("username", "alpha", $allowedmethodtopostusername)); |
@@ -1012,7 +1012,7 @@ discard block |
||
| 1012 | 1012 | if (!empty($_SERVER["HTTP_USER_AGENT"]) && $_SERVER["HTTP_USER_AGENT"] == 'securitytest') { |
| 1013 | 1013 | http_response_code(401); // It makes easier to understand if session was broken during security tests |
| 1014 | 1014 | } |
| 1015 | - dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc : '')); // This include http headers |
|
| 1015 | + dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc : '')); // This include http headers |
|
| 1016 | 1016 | } |
| 1017 | 1017 | exit; |
| 1018 | 1018 | } |
@@ -1364,7 +1364,7 @@ discard block |
||
| 1364 | 1364 | } else { |
| 1365 | 1365 | // We may have NOLOGIN set, but NOREQUIREUSER not |
| 1366 | 1366 | if (!empty($user) && method_exists($user, 'loadDefaultValues') && !defined('NODEFAULTVALUES')) { |
| 1367 | - $user->loadDefaultValues(); // Load default values for everybody (works even if $user->id = 0 |
|
| 1367 | + $user->loadDefaultValues(); // Load default values for everybody (works even if $user->id = 0 |
|
| 1368 | 1368 | } |
| 1369 | 1369 | } |
| 1370 | 1370 | |
@@ -1553,7 +1553,7 @@ discard block |
||
| 1553 | 1553 | |
| 1554 | 1554 | if (!empty(GETPOST('seteventmessages', 'alpha'))) { |
| 1555 | 1555 | $message = GETPOST('seteventmessages', 'alpha'); |
| 1556 | - $messages = explode(',', $message); |
|
| 1556 | + $messages = explode(',', $message); |
|
| 1557 | 1557 | foreach ($messages as $key => $msg) { |
| 1558 | 1558 | $tmp = explode(':', $msg); |
| 1559 | 1559 | setEventMessages($tmp[0], null, !empty($tmp[1]) ? $tmp[1] : 'mesgs'); |
@@ -1860,7 +1860,7 @@ discard block |
||
| 1860 | 1860 | |
| 1861 | 1861 | if (getDolGlobalString('THEME_ELDY_TOPMENU_BACK1')) { |
| 1862 | 1862 | // TODO: use auto theme color switch |
| 1863 | - print '<meta name="theme-color" content="rgb(' . getDolGlobalString('THEME_ELDY_TOPMENU_BACK1').')">'."\n"; |
|
| 1863 | + print '<meta name="theme-color" content="rgb('.getDolGlobalString('THEME_ELDY_TOPMENU_BACK1').')">'."\n"; |
|
| 1864 | 1864 | } |
| 1865 | 1865 | |
| 1866 | 1866 | // Auto refresh page |
@@ -2191,7 +2191,7 @@ discard block |
||
| 2191 | 2191 | print $head."\n"; |
| 2192 | 2192 | } |
| 2193 | 2193 | if (getDolGlobalString('MAIN_HTML_HEADER')) { |
| 2194 | - print getDolGlobalString('MAIN_HTML_HEADER') . "\n"; |
|
| 2194 | + print getDolGlobalString('MAIN_HTML_HEADER')."\n"; |
|
| 2195 | 2195 | } |
| 2196 | 2196 | |
| 2197 | 2197 | $parameters = array(); |
@@ -2993,7 +2993,7 @@ discard block |
||
| 2993 | 2993 | $langs->load(explode('@', $item['name'])[1]); |
| 2994 | 2994 | $dropDownQuickAddHtml .= ' |
| 2995 | 2995 | <a class="dropdown-item quickadd-item" href="'.DOL_URL_ROOT.$item['url'].'" title="'.$langs->trans(explode('@', $item['title'])[0]).'"> |
| 2996 | - '. img_picto('', $item['picto'], 'style="width:18px;"') . ' ' . $langs->trans(explode('@', $item['name'])[0]) . '</a> |
|
| 2996 | + '. img_picto('', $item['picto'], 'style="width:18px;"').' '.$langs->trans(explode('@', $item['name'])[0]).'</a> |
|
| 2997 | 2997 | '; |
| 2998 | 2998 | } |
| 2999 | 2999 | |
@@ -3105,7 +3105,7 @@ discard block |
||
| 3105 | 3105 | */ |
| 3106 | 3106 | function top_menu_search() |
| 3107 | 3107 | { |
| 3108 | - global $langs, $conf, $db, $user, $hookmanager; // used by htdocs/core/ajax/selectsearchbox.php |
|
| 3108 | + global $langs, $conf, $db, $user, $hookmanager; // used by htdocs/core/ajax/selectsearchbox.php |
|
| 3109 | 3109 | |
| 3110 | 3110 | $html = ''; |
| 3111 | 3111 | |
@@ -3862,7 +3862,7 @@ discard block |
||
| 3862 | 3862 | $forceping = GETPOST('forceping', 'alpha'); |
| 3863 | 3863 | if (($_SERVER["PHP_SELF"] == DOL_URL_ROOT.'/index.php') || $forceping) { |
| 3864 | 3864 | //print '<!-- instance_unique_id='.$conf->file->instance_unique_id.' MAIN_FIRST_PING_OK_ID='.$conf->global->MAIN_FIRST_PING_OK_ID.' -->'; |
| 3865 | - $hash_unique_id = dol_hash('dolibarr'.$conf->file->instance_unique_id, 'sha256'); // Note: if the global salt changes, this hash changes too so ping may be counted twice. We don't mind. It is for statistics purpose only. |
|
| 3865 | + $hash_unique_id = dol_hash('dolibarr'.$conf->file->instance_unique_id, 'sha256'); // Note: if the global salt changes, this hash changes too so ping may be counted twice. We don't mind. It is for statistics purpose only. |
|
| 3866 | 3866 | |
| 3867 | 3867 | if (!getDolGlobalString('MAIN_FIRST_PING_OK_DATE') |
| 3868 | 3868 | || (!empty($conf->file->instance_unique_id) && ($hash_unique_id != $conf->global->MAIN_FIRST_PING_OK_ID) && (getDolGlobalString('MAIN_FIRST_PING_OK_ID') != 'disabled')) |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | //include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; |
| 462 | 462 | |
| 463 | 463 | |
| 464 | -if (! ($object->id > 0)) { |
|
| 464 | +if (!($object->id > 0)) { |
|
| 465 | 465 | $langs->load("errors"); |
| 466 | 466 | print $langs->trans("ErrorRecordNotFound"); |
| 467 | 467 | } |
@@ -978,7 +978,7 @@ discard block |
||
| 978 | 978 | } |
| 979 | 979 | if (!$datefrom) { |
| 980 | 980 | // Guess the subscription start date |
| 981 | - $datefrom = $object->datevalid; // By default, the subscription start date is the payment date |
|
| 981 | + $datefrom = $object->datevalid; // By default, the subscription start date is the payment date |
|
| 982 | 982 | if (getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER')) { |
| 983 | 983 | $datefrom = dol_time_plus_duree($now, (int) substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), 0, -1), substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), -1)); |
| 984 | 984 | } elseif ($object->datefin > 0 && dol_time_plus_duree($object->datefin, $defaultdelay, $defaultdelayunit) > $now) { |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | |
| 1014 | 1014 | if ($adht->subscription) { |
| 1015 | 1015 | // Amount |
| 1016 | - print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="subscription" size="6" value="'.(GETPOSTISSET('subscription') ? GETPOST('subscription') : price($adht->amount, 0, '', 0)).'"> '.$langs->trans("Currency".$conf->currency) .'</td></tr>'; |
|
| 1016 | + print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="subscription" size="6" value="'.(GETPOSTISSET('subscription') ? GETPOST('subscription') : price($adht->amount, 0, '', 0)).'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>'; |
|
| 1017 | 1017 | |
| 1018 | 1018 | // Label |
| 1019 | 1019 | print '<tr><td>'.$langs->trans("Label").'</td>'; |
@@ -24,36 +24,36 @@ discard block |
||
| 24 | 24 | * \remarks To run this script as CLI: phpunit filename.php |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | -global $conf,$user,$langs,$db; |
|
| 27 | +global $conf, $user, $langs, $db; |
|
| 28 | 28 | //define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver |
| 29 | 29 | //require_once 'PHPUnit/Autoload.php'; |
| 30 | 30 | |
| 31 | -if (! defined('NOREQUIRESOC')) { |
|
| 31 | +if (!defined('NOREQUIRESOC')) { |
|
| 32 | 32 | define('NOREQUIRESOC', '1'); |
| 33 | 33 | } |
| 34 | -if (! defined('NOCSRFCHECK')) { |
|
| 34 | +if (!defined('NOCSRFCHECK')) { |
|
| 35 | 35 | define('NOCSRFCHECK', '1'); |
| 36 | 36 | } |
| 37 | -if (! defined('NOTOKENRENEWAL')) { |
|
| 37 | +if (!defined('NOTOKENRENEWAL')) { |
|
| 38 | 38 | define('NOTOKENRENEWAL', '1'); |
| 39 | 39 | } |
| 40 | -if (! defined('NOREQUIREMENU')) { |
|
| 40 | +if (!defined('NOREQUIREMENU')) { |
|
| 41 | 41 | define('NOREQUIREMENU', '1'); // If there is no menu to show |
| 42 | 42 | } |
| 43 | -if (! defined('NOREQUIREHTML')) { |
|
| 43 | +if (!defined('NOREQUIREHTML')) { |
|
| 44 | 44 | define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php |
| 45 | 45 | } |
| 46 | -if (! defined('NOREQUIREAJAX')) { |
|
| 46 | +if (!defined('NOREQUIREAJAX')) { |
|
| 47 | 47 | define('NOREQUIREAJAX', '1'); |
| 48 | 48 | } |
| 49 | -if (! defined("NOLOGIN")) { |
|
| 50 | - define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) |
|
| 49 | +if (!defined("NOLOGIN")) { |
|
| 50 | + define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) |
|
| 51 | 51 | } |
| 52 | -if (! defined("NOSESSION")) { |
|
| 52 | +if (!defined("NOSESSION")) { |
|
| 53 | 53 | define("NOSESSION", '1'); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | -require_once dirname(__FILE__).'/../../htdocs/main.inc.php'; // We force include of main.inc.php instead of master.inc.php even if we are in CLI mode because it contains a lot of security components we want to test. |
|
| 56 | +require_once dirname(__FILE__).'/../../htdocs/main.inc.php'; // We force include of main.inc.php instead of master.inc.php even if we are in CLI mode because it contains a lot of security components we want to test. |
|
| 57 | 57 | require_once dirname(__FILE__).'/../../htdocs/core/lib/security.lib.php'; |
| 58 | 58 | require_once dirname(__FILE__).'/../../htdocs/core/lib/security2.lib.php'; |
| 59 | 59 | require_once dirname(__FILE__).'/CommonClassTest.class.php'; |
@@ -227,8 +227,8 @@ discard block |
||
| 227 | 227 | $result = testSqlAndScriptInject($test, 0); |
| 228 | 228 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject eee'); |
| 229 | 229 | |
| 230 | - $test = "<IMG SRC=\"jav\tascript:alert('XSS');\">"; // Is locked by some browser like chrome because the default directive no-referrer-when-downgrade is sent when requesting the SRC and then refused because of browser protection on img src load without referrer. |
|
| 231 | - $test = "<IMG SRC=\"jav
ascript:alert('XSS');\">"; // Same |
|
| 230 | + $test = "<IMG SRC=\"jav\tascript:alert('XSS');\">"; // Is locked by some browser like chrome because the default directive no-referrer-when-downgrade is sent when requesting the SRC and then refused because of browser protection on img src load without referrer. |
|
| 231 | + $test = "<IMG SRC=\"jav
ascript:alert('XSS');\">"; // Same |
|
| 232 | 232 | |
| 233 | 233 | $test = '<SCRIPT/XSS SRC="http://xss.rocks/xss.js"></SCRIPT>'; |
| 234 | 234 | $result = testSqlAndScriptInject($test, 0); |
@@ -262,21 +262,21 @@ discard block |
||
| 262 | 262 | $result = testSqlAndScriptInject($test, 0); |
| 263 | 263 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject lll'); |
| 264 | 264 | |
| 265 | - $test = '<a onscrollend=alert(1) style="display:block;overflow:auto;border:1px+dashed;width:500px;height:100px;"><br><br><br><br><br><span+id=x>test</span></a>'; // Add the char %F6 into the variable |
|
| 265 | + $test = '<a onscrollend=alert(1) style="display:block;overflow:auto;border:1px+dashed;width:500px;height:100px;"><br><br><br><br><br><span+id=x>test</span></a>'; // Add the char %F6 into the variable |
|
| 266 | 266 | $result = testSqlAndScriptInject($test, 0); |
| 267 | 267 | //print "test=".$test." result=".$result."\n"; |
| 268 | 268 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject mmm'); |
| 269 | 269 | |
| 270 | 270 | |
| 271 | 271 | $test = "Text with ' encoded with the numeric html entity converted into text entity ' (like when submitted by CKEditor)"; |
| 272 | - $result = testSqlAndScriptInject($test, 0); // result must be 0 |
|
| 272 | + $result = testSqlAndScriptInject($test, 0); // result must be 0 |
|
| 273 | 273 | $this->assertEquals(0, $result, 'Error on testSqlAndScriptInject mmm, result should be 0 and is not'); |
| 274 | 274 | |
| 275 | 275 | $test = '<a href="j	a	v	asc
ri	pt:(a	l	e	r	t	(document.cookie))">XSS</a>'; |
| 276 | 276 | $result = testSqlAndScriptInject($test, 0); |
| 277 | 277 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject nnn, result should be >= 1 and is not'); |
| 278 | 278 | |
| 279 | - $test = "/dolibarr/htdocs/index.php/".chr('246')."abc"; // Add the char %F6 into the variable |
|
| 279 | + $test = "/dolibarr/htdocs/index.php/".chr('246')."abc"; // Add the char %F6 into the variable |
|
| 280 | 280 | $result = testSqlAndScriptInject($test, 2); |
| 281 | 281 | //print "test=".$test." result=".$result."\n"; |
| 282 | 282 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject with a non valid UTF8 char'); |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | */ |
| 290 | 290 | public function testGETPOST() |
| 291 | 291 | { |
| 292 | - global $conf,$user,$langs,$db; |
|
| 292 | + global $conf, $user, $langs, $db; |
|
| 293 | 293 | $conf = $this->savconf; |
| 294 | 294 | $user = $this->savuser; |
| 295 | 295 | $langs = $this->savlangs; |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | $_GET["param1"] = "222"; |
| 307 | 307 | $_POST["param1"] = "333"; |
| 308 | 308 | $_GET["param2"] = 'a/b#e(pr)qq-rr\cc'; |
| 309 | - $_GET["param3"] = '"na/b#e(pr)qq-rr\cc'; // Same than param2 + " and n |
|
| 309 | + $_GET["param3"] = '"na/b#e(pr)qq-rr\cc'; // Same than param2 + " and n |
|
| 310 | 310 | $_GET["param4a"] = '../../dir'; |
| 311 | 311 | $_GET["param4b"] = '..\..\dirwindows'; |
| 312 | 312 | $_GET["param4c"] = '\a123 \123 \u123 \x123'; |
@@ -314,11 +314,11 @@ discard block |
||
| 314 | 314 | $_POST["param6"] = ""><svg onload='console.log("123")'>"; |
| 315 | 315 | $_POST["param6b"] = '<<<../>../>../svg><<<../>../>../animate =alert(1)>abc'; |
| 316 | 316 | $_GET["param7"] = '"c:\this is a path~1\aaan &#x110;" abc<bad>def</bad>'; |
| 317 | - $_POST["param8a"] = "Hacker<svg onload='console.log("123")'"; // html tag is not closed so it is not detected as html tag but is still harmfull |
|
| 318 | - $_POST['param8b'] = '<img src=x onerror=alert(document.location) t='; // this is html obfuscated by non closing tag |
|
| 317 | + $_POST["param8a"] = "Hacker<svg onload='console.log("123")'"; // html tag is not closed so it is not detected as html tag but is still harmfull |
|
| 318 | + $_POST['param8b'] = '<img src=x onerror=alert(document.location) t='; // this is html obfuscated by non closing tag |
|
| 319 | 319 | $_POST['param8c'] = '< with space after is ok'; |
| 320 | 320 | $_POST['param8d'] = '<abc123 is html to clean'; |
| 321 | - $_POST['param8e'] = '<123abc is not html to clean'; // other similar case: '<2021-12-12' |
|
| 321 | + $_POST['param8e'] = '<123abc is not html to clean'; // other similar case: '<2021-12-12' |
|
| 322 | 322 | $_POST['param8f'] = 'abc<<svg <><<animate onbegin=alert(document.domain) a'; |
| 323 | 323 | $_POST["param9"] = 'is_object($object) ? ($object->id < 10 ? round($object->id / 2, 2) : (2 * $user->id) * (int) substr($mysoc->zip, 1, 2)) : \'objnotdefined\''; |
| 324 | 324 | $_POST["param10"] = 'is_object($object) ? ($object->id < 10 ? round($object->id / 2, 2) : (2 * $user->id) * (int) substr($mysoc->zip, 1, 2)) : \'<abc>objnotdefined\''; |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | |
| 339 | 339 | |
| 340 | 340 | |
| 341 | - $result = GETPOST('id', 'int'); // Must return nothing |
|
| 341 | + $result = GETPOST('id', 'int'); // Must return nothing |
|
| 342 | 342 | print __METHOD__." result=".$result."\n"; |
| 343 | 343 | $this->assertEquals('', $result); |
| 344 | 344 | |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | |
| 353 | 353 | // Test with alpha |
| 354 | 354 | |
| 355 | - $result = GETPOST("param0", 'alpha'); // a simple format, so " completely removed |
|
| 355 | + $result = GETPOST("param0", 'alpha'); // a simple format, so " completely removed |
|
| 356 | 356 | $resultexpected = 'A real string with aaa and and \' and & inside content'; |
| 357 | 357 | print __METHOD__." result=".$result."\n"; |
| 358 | 358 | $this->assertEquals($resultexpected, $result, 'Test on param0'); |
@@ -361,19 +361,19 @@ discard block |
||
| 361 | 361 | print __METHOD__." result=".$result."\n"; |
| 362 | 362 | $this->assertEquals('a/b#e(pr)qq-rr\cc', $result, 'Test on param2'); |
| 363 | 363 | |
| 364 | - $result = GETPOST("param3", 'alpha'); // Must return string sanitized from char " |
|
| 364 | + $result = GETPOST("param3", 'alpha'); // Must return string sanitized from char " |
|
| 365 | 365 | print __METHOD__." result=".$result."\n"; |
| 366 | 366 | $this->assertEquals('na/b#e(pr)qq-rr\cc', $result, 'Test on param3'); |
| 367 | 367 | |
| 368 | - $result = GETPOST("param4a", 'alpha'); // Must return string sanitized from ../ |
|
| 368 | + $result = GETPOST("param4a", 'alpha'); // Must return string sanitized from ../ |
|
| 369 | 369 | print __METHOD__." result=".$result."\n"; |
| 370 | 370 | $this->assertEquals('dir', $result); |
| 371 | 371 | |
| 372 | - $result = GETPOST("param4b", 'alpha'); // Must return string sanitized from ../ |
|
| 372 | + $result = GETPOST("param4b", 'alpha'); // Must return string sanitized from ../ |
|
| 373 | 373 | print __METHOD__." result=".$result."\n"; |
| 374 | 374 | $this->assertEquals('dirwindows', $result); |
| 375 | 375 | |
| 376 | - $result = GETPOST("param4c", 'alpha'); // Must return string sanitized from ../ |
|
| 376 | + $result = GETPOST("param4c", 'alpha'); // Must return string sanitized from ../ |
|
| 377 | 377 | print __METHOD__." result=".$result."\n"; |
| 378 | 378 | $this->assertEquals('\a123 /123 /u123 /x123', $result); |
| 379 | 379 | |
@@ -383,19 +383,19 @@ discard block |
||
| 383 | 383 | print __METHOD__." result=".$result."\n"; |
| 384 | 384 | $this->assertEquals($result, $_GET["param1"]); |
| 385 | 385 | |
| 386 | - $result = GETPOST("param2", 'aZ09'); // Must return '' as string contains car not in aZ09 definition |
|
| 386 | + $result = GETPOST("param2", 'aZ09'); // Must return '' as string contains car not in aZ09 definition |
|
| 387 | 387 | print __METHOD__." result=".$result."\n"; |
| 388 | 388 | $this->assertEquals($result, ''); |
| 389 | 389 | |
| 390 | - $result = GETPOST("param3", 'aZ09'); // Must return '' as string contains car not in aZ09 definition |
|
| 390 | + $result = GETPOST("param3", 'aZ09'); // Must return '' as string contains car not in aZ09 definition |
|
| 391 | 391 | print __METHOD__." result=".$result."\n"; |
| 392 | 392 | $this->assertEquals($result, ''); |
| 393 | 393 | |
| 394 | - $result = GETPOST("param4a", 'aZ09'); // Must return '' as string contains car not in aZ09 definition |
|
| 394 | + $result = GETPOST("param4a", 'aZ09'); // Must return '' as string contains car not in aZ09 definition |
|
| 395 | 395 | print __METHOD__." result=".$result."\n"; |
| 396 | 396 | $this->assertEquals('', $result); |
| 397 | 397 | |
| 398 | - $result = GETPOST("param4b", 'aZ09'); // Must return '' as string contains car not in aZ09 definition |
|
| 398 | + $result = GETPOST("param4b", 'aZ09'); // Must return '' as string contains car not in aZ09 definition |
|
| 399 | 399 | print __METHOD__." result=".$result."\n"; |
| 400 | 400 | $this->assertEquals('', $result); |
| 401 | 401 | |
@@ -506,9 +506,9 @@ discard block |
||
| 506 | 506 | print __METHOD__." result=".$result."\n"; |
| 507 | 507 | $this->assertEquals("Text with ' encoded with the numeric html entity converted into text entity ' (like when submitted by CKEditor)", $result, 'Test 14'); |
| 508 | 508 | |
| 509 | - $result = GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 509 | + $result = GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 510 | 510 | print __METHOD__." result=".$result."\n"; |
| 511 | - $this->assertEquals("<img onerror=alert(document.domain) src=>0xbeefed", $result, 'Test 15'); // The GETPOST return a harmull string |
|
| 511 | + $this->assertEquals("<img onerror=alert(document.domain) src=>0xbeefed", $result, 'Test 15'); // The GETPOST return a harmull string |
|
| 512 | 512 | |
| 513 | 513 | $result = GETPOST("param19", 'restricthtml'); |
| 514 | 514 | print __METHOD__." result=".$result."\n"; |
@@ -525,17 +525,17 @@ discard block |
||
| 525 | 525 | print __METHOD__." result for param0=".$result."\n"; |
| 526 | 526 | $this->assertEquals($resultexpected, $result, 'Test on param0'); |
| 527 | 527 | |
| 528 | - $result = GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 528 | + $result = GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 529 | 529 | print __METHOD__." result for param15=".$result."\n"; |
| 530 | 530 | //$this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b'); // With some PHP and libxml version, we got this result when parsing invalid HTML, but ... |
| 531 | 531 | //$this->assertEquals('<img onerror> src=>0xbeefed', $result, 'Test 15b'); // ... on other PHP and libxml versions, we got a HTML that has been cleaned |
| 532 | 532 | |
| 533 | - $result = GETPOST("param6", 'restricthtml'); // param6 = ""><svg onload='console.log("123")'>" |
|
| 533 | + $result = GETPOST("param6", 'restricthtml'); // param6 = ""><svg onload='console.log("123")'>" |
|
| 534 | 534 | print __METHOD__." result for param6=".$result." - before=".$_POST["param6"]."\n"; |
| 535 | 535 | //$this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b'); // With some PHP and libxml version, we got this result when parsing invalid HTML, but ... |
| 536 | 536 | //$this->assertEquals('">', $result); // ... on other PHP and libxml versions, we got a HTML that has been cleaned |
| 537 | 537 | |
| 538 | - $result = GETPOST("param7", 'restricthtml'); // param7 = "c:\this is a path~1\aaan &#x110;" abc<bad>def</bad> |
|
| 538 | + $result = GETPOST("param7", 'restricthtml'); // param7 = "c:\this is a path~1\aaan &#x110;" abc<bad>def</bad> |
|
| 539 | 539 | print __METHOD__." result param7 = ".$result."\n"; |
| 540 | 540 | //$this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b'); // With some PHP and libxml version, we got this result when parsing invalid HTML, but ... |
| 541 | 541 | //$this->assertEquals('"c:\this is a path~1\aaan 110;" abcdef', $result); // ... on other PHP and libxml versions, we got a HTML that has been cleaned |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | print __METHOD__." result for param0=".$result."\n"; |
| 553 | 553 | $this->assertEquals($resultexpected, $result, 'Test on param0'); |
| 554 | 554 | |
| 555 | - $result = GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 555 | + $result = GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 556 | 556 | print __METHOD__." result=".$result."\n"; |
| 557 | 557 | |
| 558 | 558 | $result = GETPOST("param6", 'restricthtml'); |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | print __METHOD__." result for param0=".$result."\n"; |
| 577 | 577 | $this->assertEquals($resultexpected, $result, 'Test on param0'); |
| 578 | 578 | |
| 579 | - $result = GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 579 | + $result = GETPOST("param15", 'restricthtml'); // param15 = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 580 | 580 | print __METHOD__." result=".$result."\n"; |
| 581 | 581 | |
| 582 | 582 | $result = GETPOST("param6", 'restricthtml'); |
@@ -789,21 +789,21 @@ discard block |
||
| 789 | 789 | { |
| 790 | 790 | global $conf; |
| 791 | 791 | |
| 792 | - $genpass1 = getRandomPassword(true); // Should be a string return by dol_hash (if no option set, will be md5) |
|
| 792 | + $genpass1 = getRandomPassword(true); // Should be a string return by dol_hash (if no option set, will be md5) |
|
| 793 | 793 | print __METHOD__." genpass1=".$genpass1."\n"; |
| 794 | 794 | $this->assertEquals(strlen($genpass1), 32); |
| 795 | 795 | |
| 796 | - $genpass1 = getRandomPassword(true, array('I')); // Should be a string return by dol_hash (if no option set, will be md5) |
|
| 796 | + $genpass1 = getRandomPassword(true, array('I')); // Should be a string return by dol_hash (if no option set, will be md5) |
|
| 797 | 797 | print __METHOD__." genpass1=".$genpass1."\n"; |
| 798 | 798 | $this->assertEquals(strlen($genpass1), 32); |
| 799 | 799 | |
| 800 | 800 | $conf->global->USER_PASSWORD_GENERATED = 'None'; |
| 801 | - $genpass2 = getRandomPassword(false); // Should return an empty string |
|
| 801 | + $genpass2 = getRandomPassword(false); // Should return an empty string |
|
| 802 | 802 | print __METHOD__." genpass2=".$genpass2."\n"; |
| 803 | 803 | $this->assertEquals($genpass2, ''); |
| 804 | 804 | |
| 805 | 805 | $conf->global->USER_PASSWORD_GENERATED = 'Standard'; |
| 806 | - $genpass3 = getRandomPassword(false); // Should return a password of 12 chars |
|
| 806 | + $genpass3 = getRandomPassword(false); // Should return a password of 12 chars |
|
| 807 | 807 | print __METHOD__." genpass3=".$genpass3."\n"; |
| 808 | 808 | $this->assertEquals(strlen($genpass3), 12); |
| 809 | 809 | |
@@ -817,7 +817,7 @@ discard block |
||
| 817 | 817 | */ |
| 818 | 818 | public function testRestrictedArea() |
| 819 | 819 | { |
| 820 | - global $conf,$user,$langs,$db; |
|
| 820 | + global $conf, $user, $langs, $db; |
|
| 821 | 821 | $conf = $this->savconf; |
| 822 | 822 | $user = $this->savuser; |
| 823 | 823 | $langs = $this->savlangs; |
@@ -848,40 +848,40 @@ discard block |
||
| 848 | 848 | $tmpvar = preg_match('/not supported/', $tmp['curl_error_msg']); |
| 849 | 849 | $this->assertEquals(1, $tmpvar, "Did not find the /not supported/ in getURLContent error message. We should."); |
| 850 | 850 | |
| 851 | - $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page |
|
| 852 | - $tmp = getURLContent($url, 'GET', '', 0); // We do NOT follow |
|
| 851 | + $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page |
|
| 852 | + $tmp = getURLContent($url, 'GET', '', 0); // We do NOT follow |
|
| 853 | 853 | print __METHOD__." url=".$url."\n"; |
| 854 | 854 | $this->assertEquals(301, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url 301 response'); |
| 855 | 855 | |
| 856 | - $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page |
|
| 857 | - $tmp = getURLContent($url); // We DO follow a page with return 300 so result should be 200 |
|
| 856 | + $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page |
|
| 857 | + $tmp = getURLContent($url); // We DO follow a page with return 300 so result should be 200 |
|
| 858 | 858 | print __METHOD__." url=".$url."\n"; |
| 859 | 859 | $this->assertEquals(200, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url 301 with a follow -> 200 but we get '.(empty($tmp['http_code']) ? 0 : $tmp['http_code'])); |
| 860 | 860 | |
| 861 | 861 | $url = 'http://localhost'; |
| 862 | - $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
| 862 | + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
| 863 | 863 | print __METHOD__." url=".$url."\n"; |
| 864 | - $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL |
|
| 864 | + $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL |
|
| 865 | 865 | |
| 866 | 866 | $url = 'http://127.0.0.1'; |
| 867 | - $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
| 867 | + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
| 868 | 868 | print __METHOD__." url=".$url."\n"; |
| 869 | - $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.0.1 is not an external URL |
|
| 869 | + $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.0.1 is not an external URL |
|
| 870 | 870 | |
| 871 | 871 | $url = 'http://127.0.2.1'; |
| 872 | - $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
| 872 | + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
| 873 | 873 | print __METHOD__." url=".$url."\n"; |
| 874 | - $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.2.1 is not an external URL |
|
| 874 | + $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.2.1 is not an external URL |
|
| 875 | 875 | |
| 876 | 876 | $url = 'https://169.254.0.1'; |
| 877 | - $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
| 877 | + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
| 878 | 878 | print __METHOD__." url=".$url."\n"; |
| 879 | - $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 169.254.0.1 is not an external URL |
|
| 879 | + $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 169.254.0.1 is not an external URL |
|
| 880 | 880 | |
| 881 | 881 | $url = 'http://[::1]'; |
| 882 | - $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
| 882 | + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
| 883 | 883 | print __METHOD__." url=".$url."\n"; |
| 884 | - $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because [::1] is not an external URL |
|
| 884 | + $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because [::1] is not an external URL |
|
| 885 | 885 | |
| 886 | 886 | /*$url = 'localtest.me'; |
| 887 | 887 | $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
@@ -890,9 +890,9 @@ discard block |
||
| 890 | 890 | */ |
| 891 | 891 | |
| 892 | 892 | $url = 'http://192.0.0.192'; |
| 893 | - $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL but on an IP in blacklist |
|
| 893 | + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL but on an IP in blacklist |
|
| 894 | 894 | print __METHOD__." url=".$url." tmp['http_code'] = ".(empty($tmp['http_code']) ? 0 : $tmp['http_code'])."\n"; |
| 895 | - $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Access should be refused and was not'); // Test we receive an error because ip is in blacklist |
|
| 895 | + $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Access should be refused and was not'); // Test we receive an error because ip is in blacklist |
|
| 896 | 896 | |
| 897 | 897 | return 0; |
| 898 | 898 | } |
@@ -904,7 +904,7 @@ discard block |
||
| 904 | 904 | */ |
| 905 | 905 | public function testDolSanitizeUrl() |
| 906 | 906 | { |
| 907 | - global $conf,$user,$langs,$db; |
|
| 907 | + global $conf, $user, $langs, $db; |
|
| 908 | 908 | $conf = $this->savconf; |
| 909 | 909 | $user = $this->savuser; |
| 910 | 910 | $langs = $this->savlangs; |
@@ -930,7 +930,7 @@ discard block |
||
| 930 | 930 | */ |
| 931 | 931 | public function testDolSanitizeEmail() |
| 932 | 932 | { |
| 933 | - global $conf,$user,$langs,$db; |
|
| 933 | + global $conf, $user, $langs, $db; |
|
| 934 | 934 | $conf = $this->savconf; |
| 935 | 935 | $user = $this->savuser; |
| 936 | 936 | $langs = $this->savlangs; |
@@ -960,7 +960,7 @@ discard block |
||
| 960 | 960 | */ |
| 961 | 961 | public function testDolSanitizeFileName() |
| 962 | 962 | { |
| 963 | - global $conf,$user,$langs,$db; |
|
| 963 | + global $conf, $user, $langs, $db; |
|
| 964 | 964 | $conf = $this->savconf; |
| 965 | 965 | $user = $this->savuser; |
| 966 | 966 | $langs = $this->savlangs; |
@@ -983,7 +983,7 @@ discard block |
||
| 983 | 983 | */ |
| 984 | 984 | public function testDolEval() |
| 985 | 985 | { |
| 986 | - global $conf,$user,$langs,$db; |
|
| 986 | + global $conf, $user, $langs, $db; |
|
| 987 | 987 | $conf = $this->savconf; |
| 988 | 988 | $user = $this->savuser; |
| 989 | 989 | $langs = $this->savlangs; |
@@ -993,7 +993,7 @@ discard block |
||
| 993 | 993 | include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
| 994 | 994 | include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; |
| 995 | 995 | |
| 996 | - $result = dol_eval('1==\x01', 1, 0); // Check that we can't make dol_eval on string containing \ char. |
|
| 996 | + $result = dol_eval('1==\x01', 1, 0); // Check that we can't make dol_eval on string containing \ char. |
|
| 997 | 997 | print "result0 = ".$result."\n"; |
| 998 | 998 | $this->assertStringContainsString('Bad string syntax to evaluate', $result); |
| 999 | 999 | |
@@ -1072,7 +1072,7 @@ discard block |
||
| 1072 | 1072 | print "result13 = ".$result."\n"; |
| 1073 | 1073 | $this->assertEquals('358080.38', $result); |
| 1074 | 1074 | |
| 1075 | - global $leftmenu; // Used into strings to eval |
|
| 1075 | + global $leftmenu; // Used into strings to eval |
|
| 1076 | 1076 | |
| 1077 | 1077 | $leftmenu = 'AAA'; |
| 1078 | 1078 | $result = dol_eval('$conf->currency && preg_match(\'/^(AAA|BBB)/\',$leftmenu)', 1, 1, '1'); |
@@ -1100,7 +1100,7 @@ discard block |
||
| 1100 | 1100 | print "result17 = ".$result."\n"; |
| 1101 | 1101 | $this->assertTrue($result); |
| 1102 | 1102 | |
| 1103 | - $result = dol_eval('1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL', 1, 0); // Should return false and not a 'Bad string syntax to evaluate ...' |
|
| 1103 | + $result = dol_eval('1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL', 1, 0); // Should return false and not a 'Bad string syntax to evaluate ...' |
|
| 1104 | 1104 | print "result18 = ".$result."\n"; |
| 1105 | 1105 | $this->assertFalse($result); |
| 1106 | 1106 | |
@@ -1130,12 +1130,12 @@ discard block |
||
| 1130 | 1130 | global $conf; |
| 1131 | 1131 | |
| 1132 | 1132 | // Set options for cleaning data |
| 1133 | - $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; // disabled, does not work on HTML5 and some libxml versions |
|
| 1133 | + $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; // disabled, does not work on HTML5 and some libxml versions |
|
| 1134 | 1134 | // Enabled option MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY if possible |
| 1135 | 1135 | if (extension_loaded('tidy') && class_exists("tidy")) { |
| 1136 | 1136 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1; |
| 1137 | 1137 | } |
| 1138 | - $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // disabled, does not work on HTML5 and some libxml versions |
|
| 1138 | + $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // disabled, does not work on HTML5 and some libxml versions |
|
| 1139 | 1139 | |
| 1140 | 1140 | |
| 1141 | 1141 | // For a string that is already HTML (contains HTML tags) with special tags but badly formatted |
@@ -1147,7 +1147,7 @@ discard block |
||
| 1147 | 1147 | //$result = dol_escape_htmltag(dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0)), 1, 1, 'common', 0, 1); |
| 1148 | 1148 | $result = dolPrintHTML($stringtotest); |
| 1149 | 1149 | print __METHOD__." result=".$result."\n"; |
| 1150 | - $this->assertEquals($stringfixed, $result, 'Error'); // Expected '' because should failed because login 'auto' does not exists |
|
| 1150 | + $this->assertEquals($stringfixed, $result, 'Error'); // Expected '' because should failed because login 'auto' does not exists |
|
| 1151 | 1151 | |
| 1152 | 1152 | |
| 1153 | 1153 | // For a string that is already HTML (contains HTML tags) with special tags but badly formatted |
@@ -1215,7 +1215,7 @@ discard block |
||
| 1215 | 1215 | // With cleaning options of HTML TIDY |
| 1216 | 1216 | if (extension_loaded('tidy') && class_exists("tidy")) { |
| 1217 | 1217 | $stringtotest = "Message<br>with ' and è and ' !"; |
| 1218 | - $stringexpected = "Message<br>\nwith ' and è and ' !"; // The ' is modified into ' because html tidy fix it. |
|
| 1218 | + $stringexpected = "Message<br>\nwith ' and è and ' !"; // The ' is modified into ' because html tidy fix it. |
|
| 1219 | 1219 | /* |
| 1220 | 1220 | var_dump($stringtotest); |
| 1221 | 1221 | var_dump(dol_htmlentitiesbr($stringtotest)); |
@@ -1247,11 +1247,11 @@ discard block |
||
| 1247 | 1247 | $this->assertEquals('a', $result); |
| 1248 | 1248 | |
| 1249 | 1249 | // Test that testRealCharforNumericEntities return an emoji utf8 char when code is inside Emoji range |
| 1250 | - $arraytmp = array(0 => '✅', 1 => '9989;'); // Encoded as decimal |
|
| 1250 | + $arraytmp = array(0 => '✅', 1 => '9989;'); // Encoded as decimal |
|
| 1251 | 1251 | $result = realCharForNumericEntities($arraytmp); |
| 1252 | 1252 | $this->assertEquals('✅', $result); |
| 1253 | 1253 | |
| 1254 | - $arraytmp = array(0 => '✅', 1 => 'x2705;'); // Encoded as hexadecimal |
|
| 1254 | + $arraytmp = array(0 => '✅', 1 => 'x2705;'); // Encoded as hexadecimal |
|
| 1255 | 1255 | $result = realCharForNumericEntities($arraytmp); |
| 1256 | 1256 | $this->assertEquals('✅', $result); |
| 1257 | 1257 | |
@@ -1313,16 +1313,16 @@ discard block |
||
| 1313 | 1313 | print __METHOD__." login=".$login."\n"; |
| 1314 | 1314 | $this->assertEquals($login, ''); |
| 1315 | 1315 | |
| 1316 | - $login = checkLoginPassEntity('admin', 'admin', 1, array('dolibarr')); // Should works because admin/admin exists |
|
| 1316 | + $login = checkLoginPassEntity('admin', 'admin', 1, array('dolibarr')); // Should works because admin/admin exists |
|
| 1317 | 1317 | print __METHOD__." login=".$login."\n"; |
| 1318 | 1318 | $this->assertEquals($login, 'admin', 'The test to check if pass of user "admin" is "admin" has failed'); |
| 1319 | 1319 | |
| 1320 | - $login = checkLoginPassEntity('admin', 'admin', 1, array('http','dolibarr')); // Should work because of second authentication method |
|
| 1320 | + $login = checkLoginPassEntity('admin', 'admin', 1, array('http', 'dolibarr')); // Should work because of second authentication method |
|
| 1321 | 1321 | print __METHOD__." login=".$login."\n"; |
| 1322 | 1322 | $this->assertEquals($login, 'admin'); |
| 1323 | 1323 | |
| 1324 | 1324 | $login = checkLoginPassEntity('admin', 'admin', 1, array('forceuser')); |
| 1325 | 1325 | print __METHOD__." login=".$login."\n"; |
| 1326 | - $this->assertEquals('', $login, 'Error'); // Expected '' because should failed because login 'auto' does not exists |
|
| 1326 | + $this->assertEquals('', $login, 'Error'); // Expected '' because should failed because login 'auto' does not exists |
|
| 1327 | 1327 | } |
| 1328 | 1328 | } |