';
// TODO Replace this with a hook
// Google Adsense (need Google module)
-if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT))
-{
- if (empty($conf->dol_use_jmobile))
- {
+if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT)) {
+ if (empty($conf->dol_use_jmobile)) {
print '
'."\n";
print '';
diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php
index b99c4a39392..6b4b28f66fe 100644
--- a/htdocs/public/payment/paymentko.php
+++ b/htdocs/public/payment/paymentko.php
@@ -25,45 +25,57 @@
* This token can be used to get more informations.
*/
-if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged.
-if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
-if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
+if (!defined('NOLOGIN')) {
+ define("NOLOGIN", 1); // This means this output page does not require to be logged.
+}
+if (!defined('NOCSRFCHECK')) {
+ define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
+}
+if (!defined('NOIPCHECK')) {
+ define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
+}
+if (!defined('NOBROWSERNOTIF')) {
+ define('NOBROWSERNOTIF', '1');
+}
// For MultiCompany module.
// Do not use GETPOST here, function is not defined and this test must be done before including main.inc.php
// TODO This should be useless. Because entity must be retrieve from object ref and not from url.
$entity = (!empty($_GET['e']) ? (int) $_GET['e'] : (!empty($_POST['e']) ? (int) $_POST['e'] : 1));
-if (is_numeric($entity)) define("DOLENTITY", $entity);
+if (is_numeric($entity)) {
+ define("DOLENTITY", $entity);
+}
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
-if (!empty($conf->paypal->enabled))
-{
+if (!empty($conf->paypal->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php';
}
$langs->loadLangs(array("main", "other", "dict", "bills", "companies", "paybox", "paypal", "stripe"));
-if (!empty($conf->paypal->enabled))
-{
+if (!empty($conf->paypal->enabled)) {
$PAYPALTOKEN = GETPOST('TOKEN');
- if (empty($PAYPALTOKEN)) $PAYPALTOKEN = GETPOST('token');
+ if (empty($PAYPALTOKEN)) {
+ $PAYPALTOKEN = GETPOST('token');
+ }
$PAYPALPAYERID = GETPOST('PAYERID');
- if (empty($PAYPALPAYERID)) $PAYPALPAYERID = GETPOST('PayerID');
+ if (empty($PAYPALPAYERID)) {
+ $PAYPALPAYERID = GETPOST('PayerID');
+ }
}
-if (!empty($conf->paybox->enabled))
-{
+if (!empty($conf->paybox->enabled)) {
}
-if (!empty($conf->stripe->enabled))
-{
+if (!empty($conf->stripe->enabled)) {
}
$FULLTAG = GETPOST('FULLTAG');
-if (empty($FULLTAG)) $FULLTAG = GETPOST('fulltag');
+if (empty($FULLTAG)) {
+ $FULLTAG = GETPOST('fulltag');
+}
$suffix = GETPOST("suffix", 'aZ09');
@@ -71,12 +83,10 @@ $suffix = GETPOST("suffix", 'aZ09');
// Detect $paymentmethod
$paymentmethod = '';
$reg = array();
-if (preg_match('/PM=([^\.]+)/', $FULLTAG, $reg))
-{
+if (preg_match('/PM=([^\.]+)/', $FULLTAG, $reg)) {
$paymentmethod = $reg[1];
}
-if (empty($paymentmethod))
-{
+if (empty($paymentmethod)) {
dol_print_error(null, 'The back url does not contains a parameter fulltag that should help us to find the payment method used');
exit;
} else {
@@ -85,13 +95,21 @@ if (empty($paymentmethod))
$validpaymentmethod = array();
-if (!empty($conf->paypal->enabled)) $validpaymentmethod['paypal'] = 'paypal';
-if (!empty($conf->paybox->enabled)) $validpaymentmethod['paybox'] = 'paybox';
-if (!empty($conf->stripe->enabled)) $validpaymentmethod['stripe'] = 'stripe';
+if (!empty($conf->paypal->enabled)) {
+ $validpaymentmethod['paypal'] = 'paypal';
+}
+if (!empty($conf->paybox->enabled)) {
+ $validpaymentmethod['paybox'] = 'paybox';
+}
+if (!empty($conf->stripe->enabled)) {
+ $validpaymentmethod['stripe'] = 'stripe';
+}
// Security check
-if (empty($validpaymentmethod)) accessforbidden('', 0, 0, 1);
+if (empty($validpaymentmethod)) {
+ accessforbidden('', 0, 0, 1);
+}
$object = new stdClass(); // For triggers
@@ -111,12 +129,13 @@ $object = new stdClass(); // For triggers
dol_syslog("Callback url when an online payment is refused or canceled. query_string=".(empty($_SERVER["QUERY_STRING"]) ? '' : $_SERVER["QUERY_STRING"])." script_uri=".(empty($_SERVER["SCRIPT_URI"]) ? '' : $_SERVER["SCRIPT_URI"]), LOG_DEBUG, 0, '_payment');
$tracepost = "";
-foreach ($_POST as $k => $v) $tracepost .= "{$k} - {$v}\n";
+foreach ($_POST as $k => $v) {
+ $tracepost .= "{$k} - {$v}\n";
+}
dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment');
-if (!empty($_SESSION['ipaddress'])) // To avoid to make action twice
-{
+if (!empty($_SESSION['ipaddress'])) { // To avoid to make action twice
// Get on url call
$fulltag = $FULLTAG;
$onlinetoken = empty($PAYPALTOKEN) ? $_SESSION['onlinetoken'] : $PAYPALTOKEN;
@@ -132,20 +151,20 @@ if (!empty($_SESSION['ipaddress'])) // To avoid to make action twice
if (is_object($object) && method_exists($object, 'call_trigger')) {
// Call trigger
$result = $object->call_trigger('PAYMENTONLINE_PAYMENT_KO', $user);
- if ($result < 0) $error++;
+ if ($result < 0) {
+ $error++;
+ }
// End call triggers
}
// Send an email
$sendemail = '';
- if (!empty($conf->global->ONLINE_PAYMENT_SENDEMAIL))
- {
+ if (!empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) {
$sendemail = $conf->global->ONLINE_PAYMENT_SENDEMAIL;
}
// Send warning of error to administrator
- if ($sendemail)
- {
+ if ($sendemail) {
$companylangs = new Translate('', $conf);
$companylangs->setDefaultLang($mysoc->default_lang);
$companylangs->loadLangs(array('main', 'members', 'bills', 'paypal', 'paybox'));
@@ -155,14 +174,18 @@ if (!empty($_SESSION['ipaddress'])) // To avoid to make action twice
// Define link to login card
$appli = constant('DOL_APPLICATION_TITLE');
- if (!empty($conf->global->MAIN_APPLICATION_TITLE))
- {
+ if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
$appli = $conf->global->MAIN_APPLICATION_TITLE;
- if (preg_match('/\d\.\d/', $appli))
- {
- if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
- } else $appli .= " ".DOL_VERSION;
- } else $appli .= " ".DOL_VERSION;
+ if (preg_match('/\d\.\d/', $appli)) {
+ if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) {
+ $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
+ }
+ } else {
+ $appli .= " ".DOL_VERSION;
+ }
+ } else {
+ $appli .= " ".DOL_VERSION;
+ }
$urlback = $_SERVER["REQUEST_URI"];
$topic = '['.$appli.'] '.$companylangs->transnoentitiesnoconv("NewOnlinePaymentFailed");
@@ -183,8 +206,7 @@ if (!empty($_SESSION['ipaddress'])) // To avoid to make action twice
$mailfile = new CMailFile($topic, $sendto, $from, $content, array(), array(), array(), '', '', 0, $ishtml);
$result = $mailfile->sendfile();
- if ($result)
- {
+ if ($result) {
dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment');
} else {
dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment');
@@ -195,7 +217,9 @@ if (!empty($_SESSION['ipaddress'])) // To avoid to make action twice
}
$head = '';
-if (!empty($conf->global->ONLINE_PAYMENT_CSS_URL)) $head = ''."\n";
+if (!empty($conf->global->ONLINE_PAYMENT_CSS_URL)) {
+ $head = ''."\n";
+}
$conf->dol_hide_topmenu = 1;
$conf->dol_hide_leftmenu = 1;
@@ -213,25 +237,25 @@ print '
';
}
// EMail
diff --git a/htdocs/public/recruitment/index.php b/htdocs/public/recruitment/index.php
index 204d3bf3140..c7381059a39 100644
--- a/htdocs/public/recruitment/index.php
+++ b/htdocs/public/recruitment/index.php
@@ -32,8 +32,12 @@ if (!defined('NOREQUIREMENU')) {
if (!defined("NOLOGIN")) {
define("NOLOGIN", '1');
}
-if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
+if (!defined('NOIPCHECK')) {
+ define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
+}
+if (!defined('NOBROWSERNOTIF')) {
+ define('NOBROWSERNOTIF', '1');
+}
// If this page is public (can be called outside logged session)
require '../../main.inc.php';
@@ -206,7 +210,9 @@ if ($display_ticket_list) {
$limit = $conf->liste_limit;
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
- if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
+ if (empty($page) || $page == -1) {
+ $page = 0;
+ } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
@@ -237,8 +243,9 @@ if ($display_ticket_list) {
$sql .= " type.label as type_label, category.label as category_label, severity.label as severity_label";
// Add fields for extrafields
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
- foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
+ foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
+ }
}
$sql .= " FROM ".MAIN_DB_PREFIX."recruitment_recruitmentjobposition as t";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=t.fk_soc";
@@ -360,8 +367,7 @@ if ($display_ticket_list) {
print_liste_field_titre($selectedfields, $url_page_current, "", '', '', 'align="right"', $sortfield, $sortorder, 'center maxwidthsearch ');
print '';
- while ($obj = $db->fetch_object($resql))
- {
+ while ($obj = $db->fetch_object($resql)) {
print '
';
// Date ticket
diff --git a/htdocs/public/recruitment/view.php b/htdocs/public/recruitment/view.php
index b8858b921e9..27aaa0fd0f4 100644
--- a/htdocs/public/recruitment/view.php
+++ b/htdocs/public/recruitment/view.php
@@ -21,10 +21,18 @@
* \brief Public file to show on job
*/
-if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged.
-if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
-if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
+if (!defined('NOLOGIN')) {
+ define("NOLOGIN", 1); // This means this output page does not require to be logged.
+}
+if (!defined('NOCSRFCHECK')) {
+ define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
+}
+if (!defined('NOIPCHECK')) {
+ define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
+}
+if (!defined('NOBROWSERNOTIF')) {
+ define('NOBROWSERNOTIF', '1');
+}
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentjobposition.class.php';
@@ -52,10 +60,8 @@ if (isset($_SESSION['email_customer'])) {
$object = new RecruitmentJobPosition($db);
-if (!$action)
-{
- if (!$ref)
- {
+if (!$action) {
+ if (!$ref) {
print $langs->trans('ErrorBadParameters')." - ref missing";
exit;
} else {
@@ -73,10 +79,8 @@ $urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than curren
* Actions
*/
-if ($cancel)
-{
- if (!empty($backtopage))
- {
+if ($cancel) {
+ if (!empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
@@ -125,8 +129,7 @@ if ($action == "view" || $action == "presend" || $action == "close" || $action =
if ($error || $errors) {
setEventMessages($object->error, $object->errors, 'errors');
- if ($action == "add_message")
- {
+ if ($action == "add_message") {
$action = 'presend';
} else {
$action = '';
@@ -150,7 +153,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
*/
$head = '';
-if (!empty($conf->global->MAIN_RECRUITMENT_CSS_URL)) $head = ''."\n";
+if (!empty($conf->global->MAIN_RECRUITMENT_CSS_URL)) {
+ $head = ''."\n";
+}
$conf->dol_hide_topmenu = 1;
$conf->dol_hide_leftmenu = 1;
@@ -188,24 +193,24 @@ print '
@@ -171,7 +185,7 @@ if ($dolibarr_main_prod) {
LightDark
-
+
status
@@ -188,7 +202,7 @@ if ($dolibarr_main_prod) {
<span class="badge badge-pill badge-info">Info</span>
<span class="badge badge-pill badge-light">Light</span>
<span class="badge badge-pill badge-dark">Dark</span>
-
+
<span class="badge badge-pill badge-status" >status</span>
@@ -210,7 +224,7 @@ if ($dolibarr_main_prod) {
-
+
@@ -227,7 +241,7 @@ if ($dolibarr_main_prod) {
<span class="badge badge-dot badge-info"></span>
<span class="badge badge-dot badge-light"></span>
<span class="badge badge-dot badge-dark"></span>
-
+
<span class="badge badge-dot badge-status" ></span>
@@ -256,7 +270,7 @@ if ($dolibarr_main_prod) {
InfoLightDark
-
+
status
@@ -271,7 +285,7 @@ if ($dolibarr_main_prod) {
<a href="#" class="badge badge-info">Info</a>
<a href="#" class="badge badge-light">Light</a>
<a href="#" class="badge badge-dark">Dark</a>
-
+
<a href="#" class="badge badge-status" >status</a>
@@ -326,7 +340,7 @@ if ($dolibarr_main_prod) {
-
+
\ No newline at end of file
diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php
index 879f37ed5dc..b2a87a75480 100644
--- a/htdocs/public/test/test_arrays.php
+++ b/htdocs/public/test/test_arrays.php
@@ -2,15 +2,25 @@
//define("NOLOGIN",1); // This means this output page does not require to be logged.
//if (!defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1');
//if (!defined('NOREQUIREDB')) define('NOREQUIREDB', '1');
-if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
+if (!defined('NOREQUIRESOC')) {
+ define('NOREQUIRESOC', '1');
+}
//if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1');
-if (!defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
-if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check anti CSRF attack test
-if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not check anti POST attack test
+if (!defined('NOSTYLECHECK')) {
+ define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
+}
+if (!defined('NOCSRFCHECK')) {
+ define('NOCSRFCHECK', '1'); // Do not check anti CSRF attack test
+}
+if (!defined('NOTOKENRENEWAL')) {
+ define('NOTOKENRENEWAL', '1'); // Do not check anti POST attack test
+}
//if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
//if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
//if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
-if (!defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
+if (!defined("NOLOGIN")) {
+ define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
+}
require '../../main.inc.php';
@@ -29,8 +39,7 @@ $form = new Form($db);
// HEADER
//--------
-if (empty($usedolheader))
-{
+if (empty($usedolheader)) {
header("Content-type: text/html; charset=UTF8");
?>
@@ -75,7 +84,7 @@ if (empty($usedolheader))
'/includes/pdfmake/pdfmake.min.js',
'/includes/pdfmake/vfs_fonts.js'
);
- */
+ */
llxHeader('', '', '', '', 0, 0, $arrayjs, $arraycss);
}
@@ -125,14 +134,14 @@ This page is a sample of page using tables. It is designed to make test with
Example 0c: Table with table+tr+td containg a select that should be overflowed and truncated => Use this to align text or form
-
-
+
+
-
-
+
+
-
-
+
+
@@ -144,16 +153,16 @@ This page is a sample of page using tables. It is designed to make test with
@@ -169,19 +178,39 @@ $sortfield = 'aaa';
$sortorder = 'ASC';
$tasksarray = array(1, 2, 3); // To force having several lines
$tagidfortablednd = 'tablelines3';
-if (!empty($conf->use_javascript_ajax)) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
+if (!empty($conf->use_javascript_ajax)) {
+ include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
+}
$nav = '';
$nav .= '';
@@ -213,8 +242,7 @@ $cate_arbo = array('field1'=>'value1d into the select list D', 'field2'=>'value2
$moreforfilter .= $form->selectarray('search_ddd', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth300', 1); // List with js combo forced
$moreforfilter .= '
';
print $moreforfilter;
$parameters = array();
@@ -249,18 +277,18 @@ if (!empty($moreforfilter))
-->
@@ -299,54 +327,55 @@ $(document).ready(function(){
use_javascript_ajax)) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
+if (!empty($conf->use_javascript_ajax)) {
+ include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
+}
?>
-
-
Title A
-
title B
-
title C
-
title D
-
-
-
line4
-
dfsdf
-
-
bbbb
-
-
-
line5
-
dfsdf
-
-
bbbb
-
-
-
line6
-
jghjgh
-
5
-
lll
-
+
+
Title A
+
title B
+
title C
+
title D
+
+
+
line4
+
dfsdf
+
+
bbbb
+
+
+
line5
+
dfsdf
+
+
bbbb
+
+
+
line6
+
jghjgh
+
5
+
lll
+
+
line1
+
+
+
+
+ -->
diff --git a/htdocs/public/test/test_forms.php b/htdocs/public/test/test_forms.php
index 646eeb2abc1..d89e04e12a6 100644
--- a/htdocs/public/test/test_forms.php
+++ b/htdocs/public/test/test_forms.php
@@ -1,7 +1,9 @@
\n";
print 'PHP_SESSION_DISABLED='.PHP_SESSION_DISABLED." \n";
diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php
index 6b035a46643..81c375671b0 100644
--- a/htdocs/public/ticket/create_ticket.php
+++ b/htdocs/public/ticket/create_ticket.php
@@ -22,14 +22,30 @@
* \brief Display public form to add new ticket
*/
-if (!defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1');
-if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
-if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
-if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
-if (!defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged.
-if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
-if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
+if (!defined('NOREQUIREUSER')) {
+ define('NOREQUIREUSER', '1');
+}
+if (!defined('NOTOKENRENEWAL')) {
+ define('NOTOKENRENEWAL', '1');
+}
+if (!defined('NOREQUIREMENU')) {
+ define('NOREQUIREMENU', '1');
+}
+if (!defined('NOREQUIREHTML')) {
+ define('NOREQUIREHTML', '1');
+}
+if (!defined('NOLOGIN')) {
+ define("NOLOGIN", 1); // This means this output page does not require to be logged.
+}
+if (!defined('NOCSRFCHECK')) {
+ define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
+}
+if (!defined('NOIPCHECK')) {
+ define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
+}
+if (!defined('NOBROWSERNOTIF')) {
+ define('NOBROWSERNOTIF', '1');
+}
require '../../main.inc.php';
diff --git a/htdocs/public/ticket/index.php b/htdocs/public/ticket/index.php
index b3e8a5e237e..81d13832ca4 100644
--- a/htdocs/public/ticket/index.php
+++ b/htdocs/public/ticket/index.php
@@ -22,17 +22,29 @@
* \brief Public page to add and manage ticket
*/
-if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
-if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
-if (!defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
-if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
+if (!defined('NOCSRFCHECK')) {
+ define('NOCSRFCHECK', '1');
+}
+if (!defined('NOREQUIREMENU')) {
+ define('NOREQUIREMENU', '1');
+}
+if (!defined("NOLOGIN")) {
+ define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
+}
+if (!defined('NOIPCHECK')) {
+ define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
+}
+if (!defined('NOBROWSERNOTIF')) {
+ define('NOBROWSERNOTIF', '1');
+}
// For MultiCompany module.
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
// TODO This should be useless. Because entity must be retrieve from object ref and not from url.
$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
-if (is_numeric($entity)) define("DOLENTITY", $entity);
+if (is_numeric($entity)) {
+ define("DOLENTITY", $entity);
+}
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/ticket/class/actions_ticket.class.php';
@@ -57,8 +69,7 @@ $action = GETPOST('action', 'aZ09');
$form = new Form($db);
$formticket = new FormTicket($db);
-if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
-{
+if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
print $langs->trans('TicketPublicInterfaceForbidden');
exit;
}
diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php
index 0f9542c986a..befeee00a7b 100644
--- a/htdocs/public/ticket/list.php
+++ b/htdocs/public/ticket/list.php
@@ -32,8 +32,12 @@ if (!defined('NOREQUIREMENU')) {
if (!defined("NOLOGIN")) {
define("NOLOGIN", '1');
}
-if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
+if (!defined('NOIPCHECK')) {
+ define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
+}
+if (!defined('NOBROWSERNOTIF')) {
+ define('NOBROWSERNOTIF', '1');
+}
// If this page is public (can be called outside logged session)
require '../../main.inc.php';
@@ -174,8 +178,7 @@ llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss);
print '
';
-if ($action == "view_ticketlist")
-{
+if ($action == "view_ticketlist") {
print ' ';
if ($display_ticket_list) {
// Filters
@@ -295,7 +298,9 @@ if ($action == "view_ticketlist")
$limit = $conf->liste_limit;
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
- if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
+ if (empty($page) || $page == -1) {
+ $page = 0;
+ } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
@@ -326,8 +331,9 @@ if ($action == "view_ticketlist")
$sql .= " type.label as type_label, category.label as category_label, severity.label as severity_label";
// Add fields for extrafields
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
- foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
+ foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
+ }
}
$sql .= " FROM ".MAIN_DB_PREFIX."ticket as t";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code=t.type_code";
@@ -528,8 +534,7 @@ if ($action == "view_ticketlist")
print_liste_field_titre($selectedfields, $url_page_current, "", '', '', 'align="right"', $sortfield, $sortorder, 'center maxwidthsearch ');
print '
';
- while ($obj = $db->fetch_object($resql))
- {
+ while ($obj = $db->fetch_object($resql)) {
print '
';
// Date ticket
diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php
index 02c7c9e51d8..d556ca2935f 100644
--- a/htdocs/public/ticket/view.php
+++ b/htdocs/public/ticket/view.php
@@ -33,8 +33,12 @@ if (!defined('NOREQUIREMENU')) {
if (!defined("NOLOGIN")) {
define("NOLOGIN", '1');
}
-if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
+if (!defined('NOIPCHECK')) {
+ define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
+}
+if (!defined('NOBROWSERNOTIF')) {
+ define('NOBROWSERNOTIF', '1');
+}
// If this page is public (can be called outside logged session)
require '../../main.inc.php';
@@ -69,10 +73,8 @@ $object = new ActionsTicket($db);
* Actions
*/
-if ($cancel)
-{
- if (!empty($backtopage))
- {
+if ($cancel) {
+ if (!empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
@@ -104,13 +106,11 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
if ($ret && $object->dao->id > 0) {
// Check if emails provided is the one of author
$emailofticket = CMailFile::getValidAddress($object->dao->origin_email, 2);
- if ($emailofticket == $email)
- {
+ if ($emailofticket == $email) {
$display_ticket = true;
$_SESSION['email_customer'] = $email;
- }
- // Check if emails provided is inside list of contacts
- else {
+ } else {
+ // Check if emails provided is inside list of contacts
$contacts = $object->dao->liste_contact(-1, 'external');
foreach ($contacts as $contact) {
if ($contact['email'] == $email) {
@@ -131,8 +131,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
}
}
// Check if email is email of creator
- if ($object->dao->fk_user_create > 0)
- {
+ if ($object->dao->fk_user_create > 0) {
$tmpuser = new User($db);
$tmpuser->fetch($object->dao->fk_user_create);
if ($email == $tmpuser->email) {
@@ -141,8 +140,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
}
}
// Check if email is email of creator
- if ($object->dao->fk_user_assign > 0 && $object->dao->fk_user_assign != $object->dao->fk_user_create)
- {
+ if ($object->dao->fk_user_assign > 0 && $object->dao->fk_user_assign != $object->dao->fk_user_create) {
$tmpuser = new User($db);
$tmpuser->fetch($object->dao->fk_user_assign);
if ($email == $tmpuser->email) {
@@ -157,8 +155,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
}
}
- if (!$error && $action == 'confirm_public_close' && $display_ticket)
- {
+ if (!$error && $action == 'confirm_public_close' && $display_ticket) {
if ($object->dao->close($user)) {
setEventMessages($langs->trans('TicketMarkedAsClosed'), null, 'mesgs');
@@ -171,24 +168,21 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
}
}
- if (!$error && $action == "add_message" && $display_ticket && GETPOSTISSET('btn_add_message'))
- {
+ if (!$error && $action == "add_message" && $display_ticket && GETPOSTISSET('btn_add_message')) {
// TODO Add message...
$ret = $object->dao->newMessage($user, $action, 0, 1);
- if (!$error)
- {
+ if (!$error) {
$action = 'view_ticket';
}
}
if ($error || $errors) {
setEventMessages($object->error, $object->errors, 'errors');
- if ($action == "add_message")
- {
+ if ($action == "add_message") {
$action = 'presend';
} else {
$action = '';
@@ -228,8 +222,7 @@ llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss);
print '
';
if ($action == "view_ticket" || $action == "presend" || $action == "close" || $action == "confirm_public_close") {
- if ($display_ticket)
- {
+ if ($display_ticket) {
// Confirmation close
if ($action == 'close') {
print $form->formconfirm($_SERVER["PHP_SELF"]."?track_id=".$track_id, $langs->trans("CloseATicket"), $langs->trans("ConfirmCloseAticket"), "confirm_public_close", '', '', 1);
diff --git a/htdocs/public/website/index.php b/htdocs/public/website/index.php
index 4edd733b9e6..d72fedefa7e 100644
--- a/htdocs/public/website/index.php
+++ b/htdocs/public/website/index.php
@@ -30,14 +30,30 @@
* \brief Wrapper to output pages when website is powered by Dolibarr instead of a native web server
*/
-if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal
-if (!defined('NOLOGIN')) define("NOLOGIN", 1);
-if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
-if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
-if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
-if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
-if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
+if (!defined('NOTOKENRENEWAL')) {
+ define('NOTOKENRENEWAL', 1); // Disables token renewal
+}
+if (!defined('NOLOGIN')) {
+ define("NOLOGIN", 1);
+}
+if (!defined('NOCSRFCHECK')) {
+ define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
+}
+if (!defined('NOREQUIREMENU')) {
+ define('NOREQUIREMENU', '1');
+}
+if (!defined('NOREQUIREHTML')) {
+ define('NOREQUIREHTML', '1');
+}
+if (!defined('NOREQUIREAJAX')) {
+ define('NOREQUIREAJAX', '1');
+}
+if (!defined('NOIPCHECK')) {
+ define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
+}
+if (!defined('NOBROWSERNOTIF')) {
+ define('NOBROWSERNOTIF', '1');
+}
/**
* Header empty
@@ -69,18 +85,15 @@ $accessallowed = 1;
$type = '';
-if (empty($pageid))
-{
+if (empty($pageid)) {
require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
require_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
$object = new Website($db);
$object->fetch(0, $websitekey);
- if (empty($object->id))
- {
- if (empty($pageid))
- {
+ if (empty($object->id)) {
+ if (empty($pageid)) {
// Return header 404
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found", true, 404);
@@ -91,57 +104,52 @@ if (empty($pageid))
$objectpage = new WebsitePage($db);
- if ($pageref)
- {
+ if ($pageref) {
$result = $objectpage->fetch(0, $object->id, $pageref);
- if ($result > 0)
- {
+ if ($result > 0) {
$pageid = $objectpage->id;
- } elseif ($result == 0)
- {
+ } elseif ($result == 0) {
// Page not found from ref=pageurl, we try using alternative alias
$result = $objectpage->fetch(0, $object->id, null, $pageref);
- if ($result > 0)
- {
+ if ($result > 0) {
$pageid = $objectpage->id;
}
}
} else {
- if ($object->fk_default_home > 0)
- {
+ if ($object->fk_default_home > 0) {
$result = $objectpage->fetch($object->fk_default_home);
- if ($result > 0)
- {
+ if ($result > 0) {
$pageid = $objectpage->id;
}
}
- if (empty($pageid))
- {
+ if (empty($pageid)) {
$array = $objectpage->fetchAll($object->id); // TODO Can filter on container of type pages only ?
- if (is_array($array) && count($array) > 0)
- {
+ if (is_array($array) && count($array) > 0) {
$firstrep = reset($array);
$pageid = $firstrep->id;
}
}
}
}
-if (empty($pageid))
-{
+if (empty($pageid)) {
// Return header 404
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found", true, 404);
$langs->load("website");
- if (!GETPOSTISSET('pageref')) print $langs->trans("PreviewOfSiteNotYetAvailable", $websitekey);
+ if (!GETPOSTISSET('pageref')) {
+ print $langs->trans("PreviewOfSiteNotYetAvailable", $websitekey);
+ }
include DOL_DOCUMENT_ROOT.'/public/error-404.php';
exit;
}
$appli = constant('DOL_APPLICATION_TITLE');
-if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli = $conf->global->MAIN_APPLICATION_TITLE;
+if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
+ $appli = $conf->global->MAIN_APPLICATION_TITLE;
+}
@@ -155,8 +163,7 @@ if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli = $conf->global->MAIN_
// Security: Delete string ../ into $original_file
global $dolibarr_main_data_root;
-if ($pageid == 'css') // No more used ?
-{
+if ($pageid == 'css') { // No more used ?
header('Content-type: text/css');
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
//if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
@@ -172,16 +179,14 @@ $refname = basename(dirname($original_file)."/");
// Security:
// Limite acces si droits non corrects
-if (!$accessallowed)
-{
+if (!$accessallowed) {
accessforbidden();
}
// Security:
// On interdit les remontees de repertoire ainsi que les pipe dans
// les noms de fichiers.
-if (preg_match('/\.\./', $original_file) || preg_match('/[<>|]/', $original_file))
-{
+if (preg_match('/\.\./', $original_file) || preg_match('/[<>|]/', $original_file)) {
dol_syslog("Refused to deliver file ".$original_file);
$file = basename($original_file); // Do no show plain path of original_file in shown error message
dol_print_error(0, $langs->trans("ErrorFileNameInvalid", $file));
@@ -197,8 +202,7 @@ dol_syslog("index.php include $original_file $filename content-type=$type");
$original_file_osencoded = dol_osencode($original_file); // New file name encoded in OS encoding charset
// This test if file exists should be useless. We keep it to find bug more easily
-if (!file_exists($original_file_osencoded))
-{
+if (!file_exists($original_file_osencoded)) {
// Return header 404
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found", true, 404);
@@ -215,4 +219,6 @@ define('USEDOLIBARRSERVER', 1);
print ''."\n";
include_once $original_file_osencoded; // Note: The pageXXX.tpl.php showed here contains a formatage with dolWebsiteOutput() at end of page.
-if (is_object($db)) $db->close();
+if (is_object($db)) {
+ $db->close();
+}
diff --git a/htdocs/public/website/styles.css.php b/htdocs/public/website/styles.css.php
index 75257a8facc..a0002b5380b 100644
--- a/htdocs/public/website/styles.css.php
+++ b/htdocs/public/website/styles.css.php
@@ -21,14 +21,30 @@
* \brief Page to output style page. Called with
*/
-if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal
-if (!defined('NOLOGIN')) define("NOLOGIN", 1);
-if (!defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
-if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
-if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
-if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
-if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
+if (!defined('NOTOKENRENEWAL')) {
+ define('NOTOKENRENEWAL', 1); // Disables token renewal
+}
+if (!defined('NOLOGIN')) {
+ define("NOLOGIN", 1);
+}
+if (!defined('NOCSRFCHECK')) {
+ define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
+}
+if (!defined('NOREQUIREMENU')) {
+ define('NOREQUIREMENU', '1');
+}
+if (!defined('NOREQUIREHTML')) {
+ define('NOREQUIREHTML', '1');
+}
+if (!defined('NOREQUIREAJAX')) {
+ define('NOREQUIREAJAX', '1');
+}
+if (!defined('NOIPCHECK')) {
+ define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
+}
+if (!defined('NOBROWSERNOTIF')) {
+ define('NOBROWSERNOTIF', '1');
+}
/**
* Header empty
@@ -65,18 +81,18 @@ $type = '';
*/
$appli = constant('DOL_APPLICATION_TITLE');
-if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli = $conf->global->MAIN_APPLICATION_TITLE;
+if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
+ $appli = $conf->global->MAIN_APPLICATION_TITLE;
+}
//print 'Directory with '.$appli.' websites. ';
-if (empty($pageid))
-{
+if (empty($pageid)) {
require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
require_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
$object = new Website($db);
- if ($websiteid)
- {
+ if ($websiteid) {
$object->fetch($websiteid);
$website = $object->ref;
} else {
@@ -85,21 +101,21 @@ if (empty($pageid))
$objectpage = new WebsitePage($db);
/* Not required for CSS file
- $array=$objectpage->fetchAll($object->id);
+ $array=$objectpage->fetchAll($object->id);
- if (is_array($array) && count($array) > 0)
- {
- $firstrep=reset($array);
- $pageid=$firstrep->id;
- }
- */
+ if (is_array($array) && count($array) > 0)
+ {
+ $firstrep=reset($array);
+ $pageid=$firstrep->id;
+ }
+ */
}
/* Not required for CSS file
if (empty($pageid))
{
- $langs->load("website");
- print $langs->trans("PreviewOfSiteNotYetAvailable");
- exit;
+ $langs->load("website");
+ print $langs->trans("PreviewOfSiteNotYetAvailable");
+ exit;
}
*/
@@ -113,16 +129,14 @@ $refname = basename(dirname($original_file)."/");
// Security:
// Limite acces si droits non corrects
-if (!$accessallowed)
-{
+if (!$accessallowed) {
accessforbidden();
}
// Security:
// On interdit les remontees de repertoire ainsi que les pipe dans
// les noms de fichiers.
-if (preg_match('/\.\./', $original_file) || preg_match('/[<>|]/', $original_file))
-{
+if (preg_match('/\.\./', $original_file) || preg_match('/[<>|]/', $original_file)) {
dol_syslog("Refused to deliver file ".$original_file);
$file = basename($original_file); // Do no show plain path of original_file in shown error message
dol_print_error(0, $langs->trans("ErrorFileNameInvalid", $file));
@@ -138,8 +152,7 @@ dol_syslog("styles.css.php include $original_file $filename content-type=$type")
$original_file_osencoded = dol_osencode($original_file); // New file name encoded in OS encoding charset
// This test if file exists should be useless. We keep it to find bug more easily
-if (!file_exists($original_file_osencoded))
-{
+if (!file_exists($original_file_osencoded)) {
$langs->load("website");
print $langs->trans("RequestedPageHasNoContentYet", $pageid);
//dol_print_error(0,$langs->trans("ErrorFileDoesNotExists",$original_file));
@@ -153,4 +166,6 @@ print '/* Page content '.$original_file.' : CSS content that was saved into tpl
require_once $original_file_osencoded;
-if (is_object($db)) $db->close();
+if (is_object($db)) {
+ $db->close();
+}