diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 11e2e36dcfe..861f5208f5e 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -218,8 +218,7 @@ function run_sql($sqlfile, $silent = 1, $entity = 0, $usesavepoint = 1, $handler if (!count($versionrequest) || !count($versionarray) || versioncompare($versionrequest, $versionarray) > 0) { $qualified = 0; } - } else // This is a test on a constant. For example when we have -- VMYSQLUTF8UNICODE, we test constant $conf->global->UTF8UNICODE - { + } else { // This is a test on a constant. For example when we have -- VMYSQLUTF8UNICODE, we test constant $conf->global->UTF8UNICODE $dbcollation = strtoupper(preg_replace('/_/', '', $conf->db->dolibarr_main_db_collation)); //var_dump($reg[2]); //var_dump($dbcollation); @@ -243,7 +242,9 @@ function run_sql($sqlfile, $silent = 1, $entity = 0, $usesavepoint = 1, $handler if (empty($nocommentremoval)) { $buf = preg_replace('/([,;ERLT\)])\s*--.*$/i', '\1', $buf); //remove comment from a line that not start with -- before add it to the buffer } - if ($buffer) $buffer .= ' '; + if ($buffer) { + $buffer .= ' '; + } $buffer .= trim($buf); } @@ -1231,7 +1232,7 @@ function activateModule($value, $withdeps = 1, $noconfverification = 0) if (!count($ret['errors'])) { $ret['nbmodules']++; - $ret['nbperms'] += (is_array($objMod->rights)?count($objMod->rights):0); + $ret['nbperms'] += (is_array($objMod->rights) ? count($objMod->rights) : 0); } return $ret; @@ -1278,8 +1279,7 @@ function unActivateModule($value, $requiredby = 1) if ($result <= 0) { $ret = $objMod->error; } - } else // We come here when we try to unactivate a module when module does not exists anymore in sources - { + } else { // We come here when we try to unactivate a module when module does not exists anymore in sources //print $dir.$modFile;exit; // TODO Replace this after DolibarrModules is moved as abstract class with a try catch to show module we try to disable has not been found or could not be loaded include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; @@ -1746,7 +1746,7 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Valu if (!empty($tableau[$key]['tooltip'])) { print $form->textwithpicto($label ? $label : $langs->trans('Desc'.$const), $tableau[$key]['tooltip']); } else { - print ($label ? $label : $langs->trans('Desc'.$const)); + print($label ? $label : $langs->trans('Desc'.$const)); } if ($const == 'ADHERENT_MAILMAN_URL') { diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 17b639f0c2d..50e803c78c0 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -438,7 +438,7 @@ function actions_prepare_head($object) $head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=action&element_id='.$object->id; $listofresourcelinked = $resource->getElementResources($object->element, $object->id); - $nbResources = (is_array($listofresourcelinked) ?count($listofresourcelinked) : 0); + $nbResources = (is_array($listofresourcelinked) ? count($listofresourcelinked) : 0); $head[$h][1] = $langs->trans("Resources"); if ($nbResources > 0) { $head[$h][1] .= (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? ''.($nbResources).'' : ''); diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 3f152cf404e..17c41adf6d4 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -405,7 +405,7 @@ function ajax_dialog($title, $message, $w = 350, $h = 150) { global $langs; - $newtitle = dol_textishtml($title) ?dol_string_nohtmltag($title, 1) : $title; + $newtitle = dol_textishtml($title) ? dol_string_nohtmltag($title, 1) : $title; $msg = '
'; $msg .= $message; $msg .= '
'."\n"; @@ -685,8 +685,8 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof '."\n"; $out .= ''; - $out .= ''.($revertonoff ?img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort)).''; - $out .= ''.($revertonoff ?img_picto($langs->trans("Disabled"), 'switch_off'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Enabled"), 'switch_on'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort)).''; + $out .= ''.($revertonoff ? img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort)).''; + $out .= ''.($revertonoff ? img_picto($langs->trans("Disabled"), 'switch_off'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Enabled"), 'switch_on'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort)).''; $out .= "\n"; } diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 9dc327edf8f..3e8604c7599 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -329,7 +329,7 @@ function getIbanHumanReadable(Account $account) { if ($account->getCountryCode() == 'FR') { require_once DOL_DOCUMENT_ROOT.'/includes/php-iban/oophp-iban.php'; - $ibantoprint = preg_replace('/[^a-zA-Z0-9]/', '', empty($account->iban)?'':$account->iban); + $ibantoprint = preg_replace('/[^a-zA-Z0-9]/', '', empty($account->iban) ? '' : $account->iban); $iban = new PHP_IBAN\IBAN($ibantoprint); return $iban->HumanFormat(); } diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index a07af1797f0..cacfa0f4495 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1686,7 +1686,9 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin // Fields from hook $parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon); $reshook = $hookmanager->executeHooks('showActionsDoneListSelect', $parameters); // Note that $action and $object may have been modified by hook - if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint; + if (!empty($hookmanager->resPrint)) { + $sql.= $hookmanager->resPrint; + } $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action"; @@ -1702,7 +1704,9 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin // Fields from hook $parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon); $reshook = $hookmanager->executeHooks('showActionsDoneListFrom', $parameters); // Note that $action and $object may have been modified by hook - if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint; + if (!empty($hookmanager->resPrint)) { + $sql.= $hookmanager->resPrint; + } if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur'))) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; @@ -1825,7 +1829,9 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin // Fields from hook $parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon, 'module' => $module); $reshook = $hookmanager->executeHooks('showActionsDoneListWhere', $parameters); // Note that $action and $object may have been modified by hook - if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint; + if (!empty($hookmanager->resPrint)) { + $sql.= $hookmanager->resPrint; + } if (is_array($actioncode)) { foreach ($actioncode as $code) { @@ -2100,7 +2106,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin $out .= ''; $out .= $actionstatic->getTypePicto(); //if (empty($conf->dol_optimize_smallscreen)) { - $out .= $labeltype; + $out .= $labeltype; //} $out .= ''; diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 41945822dc1..02683de3c61 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -333,13 +333,27 @@ function convertDurationtoHour($duration_value, $duration_unit) { $result = 0; - if ($duration_unit == 's') $result = $duration_value / 3600; - if ($duration_unit == 'i') $result = $duration_value / 60; - if ($duration_unit == 'h') $result = $duration_value; - if ($duration_unit == 'd') $result = $duration_value * 24; - if ($duration_unit == 'w') $result = $duration_value * 24 * 7; - if ($duration_unit == 'm') $result = $duration_value * 730.484; - if ($duration_unit == 'y') $result = $duration_value * 365 * 24; + if ($duration_unit == 's') { + $result = $duration_value / 3600; + } + if ($duration_unit == 'i') { + $result = $duration_value / 60; + } + if ($duration_unit == 'h') { + $result = $duration_value; + } + if ($duration_unit == 'd') { + $result = $duration_value * 24; + } + if ($duration_unit == 'w') { + $result = $duration_value * 24 * 7; + } + if ($duration_unit == 'm') { + $result = $duration_value * 730.484; + } + if ($duration_unit == 'y') { + $result = $duration_value * 365 * 24; + } return $result; } @@ -932,7 +946,9 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', $date_1sunsept = strtotime('next thursday', strtotime('next sunday', mktime(0, 0, 0, 9, 1, $annee))); $jour_1sunsept = date("d", $date_1sunsept); $mois_1sunsept = date("m", $date_1sunsept); - if ($jour_1sunsept == $jour && $mois_1sunsept == $mois) $ferie=true; + if ($jour_1sunsept == $jour && $mois_1sunsept == $mois) { + $ferie=true; + } // Geneva fast in Switzerland } } @@ -945,7 +961,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', $jour_semaine = jddayofweek($jour_julien, 0); if ($includefriday) { //Friday (5), Saturday (6) and Sunday (0) if ($jour_semaine == 5) { - $ferie = true; + $ferie = true; } } if ($includesaturday) { //Friday (5), Saturday (6) and Sunday (0) diff --git a/htdocs/core/lib/fichinter.lib.php b/htdocs/core/lib/fichinter.lib.php index cffd051882e..53d3e944e69 100644 --- a/htdocs/core/lib/fichinter.lib.php +++ b/htdocs/core/lib/fichinter.lib.php @@ -68,7 +68,7 @@ function fichinter_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php'; $objectres = new Dolresource($db); $linked_resources = $objectres->getElementResources('fichinter', $object->id); - $nbResource = (is_array($linked_resources) ?count($linked_resources) : 0); + $nbResource = (is_array($linked_resources) ? count($linked_resources) : 0); // if (is_array($objectres->available_resources)) // { // foreach ($objectres->available_resources as $modresources => $resources) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index c7bf29fef0c..aff76b1ac9e 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -70,8 +70,8 @@ function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excl } $loaddate = ($mode == 1 || $mode == 2 || $nbsecondsold) ? true : false; - $loadsize = ($mode == 1 || $mode == 3) ?true : false; - $loadperm = ($mode == 1 || $mode == 4) ?true : false; + $loadsize = ($mode == 1 || $mode == 3) ? true : false; + $loadperm = ($mode == 1 || $mode == 4) ? true : false; // Clean parameters $path = preg_replace('/([\\/]+)$/i', '', $path); @@ -1129,7 +1129,9 @@ function dol_move_dir($srcdir, $destdir, $overwriteifexists = 1, $indexdatabase $files = dol_dir_list($newpathofdestdir); if (!empty($files) && is_array($files)) { foreach ($files as $key => $file) { - if (!file_exists($file["fullname"])) continue; + if (!file_exists($file["fullname"])) { + continue; + } $filepath = $file["path"]; $oldname = $file["name"]; @@ -1758,7 +1760,6 @@ function dol_init_file_process($pathtoscan = '', $trackid = '') */ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesession = 0, $varfiles = 'addedfile', $savingdocmask = '', $link = null, $trackid = '', $generatethumbs = 1, $object = null) { - global $db, $user, $conf, $langs; $res = 0; @@ -1867,7 +1868,9 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess // Update index table of files (llx_ecm_files) if ($donotupdatesession == 1) { $sharefile = 0; - if ($TFile['type'][$i] == 'application/pdf' && strpos($_SERVER["REQUEST_URI"], 'product') !== false && getDolGlobalString('PRODUCT_ALLOW_EXTERNAL_DOWNLOAD')) $sharefile = 1; + if ($TFile['type'][$i] == 'application/pdf' && strpos($_SERVER["REQUEST_URI"], 'product') !== false && getDolGlobalString('PRODUCT_ALLOW_EXTERNAL_DOWNLOAD')) { + $sharefile = 1; + } $result = addFileIntoDatabaseIndex($upload_dir, basename($destfile).($resupload == 2 ? '.noexe' : ''), $TFile['name'][$i], 'uploaded', $sharefile, $object); if ($result < 0) { if ($allowoverwrite) { @@ -1885,8 +1888,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors'); } elseif (preg_match('/ErrorFileIsInfectedWithAVirus/', $resupload)) { // Files infected by a virus setEventMessages($langs->trans("ErrorFileIsInfectedWithAVirus"), null, 'errors'); - } else // Known error - { + } else { // Known error setEventMessages($langs->trans($resupload), null, 'errors'); } } @@ -2022,8 +2024,12 @@ function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uplo dol_syslog('Error: object ' . get_class($object) . ' has no table_element attribute.'); return -1; } - if (isset($object->src_object_description)) $ecmfile->description = $object->src_object_description; - if (isset($object->src_object_keywords)) $ecmfile->keywords = $object->src_object_keywords; + if (isset($object->src_object_description)) { + $ecmfile->description = $object->src_object_description; + } + if (isset($object->src_object_keywords)) { + $ecmfile->keywords = $object->src_object_keywords; + } } if (getDolGlobalString('MAIN_FORCE_SHARING_ON_ANY_UPLOADED_FILE')) { @@ -2196,7 +2202,7 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring $rootPath = realpath($inputfile); dol_syslog("Class ZipArchive is set so we zip using ZipArchive to zip into ".$outputfile.' rootPath='.$rootPath); - $zip = new ZipArchive; + $zip = new ZipArchive(); if ($zip->open($outputfile, ZipArchive::CREATE) !== true) { $errorstring = "dol_compress_file failure - Failed to open file ".$outputfile."\n"; @@ -2341,7 +2347,7 @@ function dol_uncompress($inputfile, $outputdir) if (class_exists('ZipArchive')) { // Must install php-zip to have it dol_syslog("Class ZipArchive is set so we unzip using ZipArchive to unzip into ".$outputdir); - $zip = new ZipArchive; + $zip = new ZipArchive(); $res = $zip->open($inputfile); if ($res === true) { //$zip->extractTo($outputdir.'/'); @@ -2546,7 +2552,7 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles = function dol_most_recent_file($dir, $regexfilter = '', $excludefilter = array('(\.meta|_preview.*\.png)$', '^\.'), $nohook = false, $mode = '') { $tmparray = dol_dir_list($dir, 'files', 0, $regexfilter, $excludefilter, 'date', SORT_DESC, $mode, $nohook); - return isset($tmparray[0])?$tmparray[0]:null; + return isset($tmparray[0]) ? $tmparray[0] : null; } /** @@ -3228,8 +3234,8 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $tmpmodulepart = explode('-', $modulepart); if (!empty($tmpmodulepart[1])) { - $modulepart = $tmpmodulepart[0]; - $original_file = $tmpmodulepart[1].'/'.$original_file; + $modulepart = $tmpmodulepart[0]; + $original_file = $tmpmodulepart[1].'/'.$original_file; } // Define $accessallowed diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c71dbdfb931..583ab4e4d74 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -369,9 +369,10 @@ function isASecretKey($keyname) */ function num2Alpha($n) { - for ($r = ""; $n >= 0; $n = intval($n / 26) - 1) + for ($r = ""; $n >= 0; $n = intval($n / 26) - 1) { $r = chr($n % 26 + 0x41) . $r; - return $r; + } + return $r; } @@ -1976,7 +1977,8 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di $out = ''; - $backtopagejsfieldsid = ''; $backtopagejsfieldslabel = ''; + $backtopagejsfieldsid = ''; + $backtopagejsfieldslabel = ''; if ($backtopagejsfields) { $tmpbacktopagejsfields = explode(':', $backtopagejsfields); if (empty($tmpbacktopagejsfields[1])) { // If the part 'keyforpopupid:' is missing, we add $name for it. @@ -2029,10 +2031,10 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di var returnedlabel = jQuery("#varforreturndialoglabel'.$name.'").text(); console.log("popup has been closed. returnedid (js var defined into parent page)="+returnedid+" returnedlabel="+returnedlabel); if (returnedid != "" && returnedid != "div for returned id") { - jQuery("#'.(empty($backtopagejsfieldsid)?"none":$backtopagejsfieldsid).'").val(returnedid); + jQuery("#'.(empty($backtopagejsfieldsid) ? "none" : $backtopagejsfieldsid).'").val(returnedid); } if (returnedlabel != "" && returnedlabel != "div for returned label") { - jQuery("#'.(empty($backtopagejsfieldslabel)?"none":$backtopagejsfieldslabel).'").val(returnedlabel); + jQuery("#'.(empty($backtopagejsfieldslabel) ? "none" : $backtopagejsfieldslabel).'").val(returnedlabel); } } }); @@ -2171,7 +2173,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab } } elseif (!empty($links[$i][1])) { //print "x $i $active ".$links[$i][2]." z"; - $out .= '
'; + $out .= '
'; if (!empty($links[$i][0])) { $titletoshow = preg_replace('/<.*$/', '', $links[$i][1]); $out .= ''; @@ -2676,7 +2678,7 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : (empty($object->town) ? '' : $object->town)); $ret .= (($ret && $town) ? $sep : '').$town; - if (!empty($object->state)) { + if (!empty($object->state)) { $ret .= ($ret ? ($town ? ", " : $sep) : '').$object->state; } if (!empty($object->zip)) { @@ -2925,7 +2927,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $newformat = str_replace( array('%Y', '%y', '%m', '%d', '%H', '%I', '%M', '%S', '%p', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'), array('Y', 'y', 'm', 'd', 'H', 'h', 'i', 's', 'A', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), - $format); + $format + ); $ret = $dtts->format($newformat); $ret = str_replace( array('__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), @@ -2948,7 +2951,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $newformat = str_replace( array('%Y', '%y', '%m', '%d', '%H', '%I', '%M', '%S', '%p', '%w', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'), array('Y', 'y', 'm', 'd', 'H', 'h', 'i', 's', 'A', 'w', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), - $format); + $format + ); $ret = $dtts->format($newformat); $ret = str_replace( array('__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), @@ -3272,9 +3276,9 @@ function dol_print_url($url, $target = '_blank', $max = 32, $withpicto = 0, $mor $linkend = ''; if ($morecss == 'float') { // deprecated - return '
'.($withpicto ?img_picto($langs->trans("Url"), 'globe').' ' : '').$link.'
'; + return '
'.($withpicto ? img_picto($langs->trans("Url"), 'globe').' ' : '').$link.'
'; } else { - return $linkstart.''.($withpicto ?img_picto('', 'globe').' ' : '').$link.''.$linkend; + return $linkstart.''.($withpicto ? img_picto('', 'globe').' ' : '').$link.''.$linkend; } } @@ -3484,7 +3488,9 @@ function dol_print_profids($profID, $profIDtype, $countrycode = '', $addcpButton if (empty($profID) || empty($profIDtype)) { return ''; } - if (empty($countrycode)) $countrycode = $mysoc->country_code; + if (empty($countrycode)) { + $countrycode = $mysoc->country_code; + } $newProfID = $profID; $id = substr($profIDtype, -1); $ret = ''; @@ -3509,8 +3515,11 @@ function dol_print_profids($profID, $profIDtype, $countrycode = '', $addcpButton $newProfID = substr($newProfID, 0, 4).' '.substr($newProfID, 4, 3).' '.substr($newProfID, 7, 3).' '.substr($newProfID, 10, 3); } } - if (!empty($addcpButton)) $ret = showValueWithClipboardCPButton(dol_escape_htmltag($profID), ($addcpButton == 1 ? 1 : 0), $newProfID); - else $ret = $newProfID; + if (!empty($addcpButton)) { + $ret = showValueWithClipboardCPButton(dol_escape_htmltag($profID), ($addcpButton == 1 ? 1 : 0), $newProfID); + } else { + $ret = $newProfID; + } return $ret; } @@ -3745,9 +3754,9 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli $urlmask = $user->clicktodial_url; } - $clicktodial_poste = (!empty($user->clicktodial_poste) ?urlencode($user->clicktodial_poste) : ''); - $clicktodial_login = (!empty($user->clicktodial_login) ?urlencode($user->clicktodial_login) : ''); - $clicktodial_password = (!empty($user->clicktodial_password) ?urlencode($user->clicktodial_password) : ''); + $clicktodial_poste = (!empty($user->clicktodial_poste) ? urlencode($user->clicktodial_poste) : ''); + $clicktodial_login = (!empty($user->clicktodial_login) ? urlencode($user->clicktodial_login) : ''); + $clicktodial_password = (!empty($user->clicktodial_password) ? urlencode($user->clicktodial_password) : ''); // This line is for backward compatibility $url = sprintf($urlmask, urlencode($phone), $clicktodial_poste, $clicktodial_login, $clicktodial_password); // Thoose lines are for substitution @@ -5393,8 +5402,7 @@ function dol_print_error($db = '', $error = '', $errors = null) } if ($_SERVER['DOCUMENT_ROOT']) { // Mode web $out .= "".$langs->trans("Message").": ".dol_escape_htmltag($msg)."
\n"; - } else // Mode CLI - { + } else { // Mode CLI $out .= '> '.$langs->transnoentities("Message").":\n".$msg."\n"; } $syslog .= ", msg=".$msg; @@ -7519,7 +7527,9 @@ function dolGetFirstLineOfText($text, $nboflines = 1, $charset = 'UTF-8') $a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); $firstline = ''; - $i = 0; $countline = 0; $lastaddediscontent = 1; + $i = 0; + $countline = 0; + $lastaddediscontent = 1; while ($countline < $nboflines && isset($a[$i])) { if (preg_match('/]*>/', $a[$i])) { if (array_key_exists($i+1, $a) && !empty($a[$i+1])) { @@ -7599,7 +7609,7 @@ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = ' try { libxml_use_internal_errors(false); // Avoid to fill memory with xml errors - $dom = new DOMDocument; + $dom = new DOMDocument(); // Add a trick to solve pb with text without parent tag // like '

Foo

bar

' that wrongly ends up, without the trick, with '

Foo

bar

' // like 'abc' that wrongly ends up, without the trick, with '

abc

' @@ -7664,7 +7674,8 @@ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = ' // No need to use a loop here, this step is not to sanitize (this is done at next step, this is to try to save chars, even if they are // using a non coventionnel way to be encoded, to not have them sanitized just after) $out = preg_replace_callback('/&#(x?[0-9][0-9a-f]+;?)/i', function ($m) { - return realCharForNumericEntities($m); }, $out); + return realCharForNumericEntities($m); + }, $out); // Now we remove all remaining HTML entities starting with a number. We don't want such entities. @@ -7994,9 +8005,9 @@ function dol_textishtml($msg, $option = 0) function dol_concatdesc($text1, $text2, $forxml = false, $invert = false) { if (!empty($invert)) { - $tmp = $text1; - $text1 = $text2; - $text2 = $tmp; + $tmp = $text1; + $text1 = $text2; + $text2 = $tmp; } $ret = ''; @@ -8409,7 +8420,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__EXTRAFIELD_'.strtoupper($key).'__'] = $object->array_options['options_'.$key]; $substitutionarray['__EXTRAFIELD_'.strtoupper($key).'_FORMATED__'] = price($object->array_options['options_'.$key]); } elseif ($extrafields->attributes[$object->table_element]['type'][$key] != 'separator') { - $substitutionarray['__EXTRAFIELD_'.strtoupper($key).'__'] = !empty($object->array_options['options_'.$key]) ? $object->array_options['options_'.$key] :''; + $substitutionarray['__EXTRAFIELD_'.strtoupper($key).'__'] = !empty($object->array_options['options_'.$key]) ? $object->array_options['options_'.$key] : ''; } } } @@ -8451,7 +8462,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, } if ($object->id > 0) { - $substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__'] = ($paymenturl ?str_replace('\n', "\n", $outputlangs->trans("PredefinedMailContentLink", $paymenturl)) : ''); + $substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__'] = ($paymenturl ? str_replace('\n', "\n", $outputlangs->trans("PredefinedMailContentLink", $paymenturl)) : ''); $substitutionarray['__ONLINE_PAYMENT_URL__'] = $paymenturl; if (getDolGlobalString('PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD') && is_object($object) && $object->element == 'propal') { @@ -11381,7 +11392,7 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = ' $TCompiledAttr[] = $key.'="'.$value.'"'; } - $compiledAttributes = !empty($TCompiledAttr) ?implode(' ', $TCompiledAttr) : ''; + $compiledAttributes = !empty($TCompiledAttr) ? implode(' ', $TCompiledAttr) : ''; $tag = !empty($url) ? 'a' : 'span'; @@ -11555,9 +11566,9 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url = // Here, $url is a simple link - if (!empty($params['isDropdown'])) + if (!empty($params['isDropdown'])) { $class = "dropdown-item"; - else { + } else { $class = 'butAction'; if ($actionType == 'danger' || $actionType == 'delete') { $class = 'butActionDelete'; @@ -11662,7 +11673,9 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url = ); $reshook = $hookmanager->executeHooks('dolGetButtonAction', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } if (empty($reshook)) { if (dol_textishtml($text)) { // If content already HTML encoded @@ -12458,7 +12471,8 @@ function dolCheckFilters($sqlfilters, &$error = '') //$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; //$tmp=preg_replace_all('/'.$regexstring.'/', '', $sqlfilters); $tmp = $sqlfilters; - $i = 0; $nb = strlen($tmp); + $i = 0; + $nb = strlen($tmp); $counter = 0; while ($i < $nb) { if ($tmp[$i] == '(') { @@ -12538,7 +12552,7 @@ function dolForgeCriteriaCallback($matches) if ($operator == 'IN') { // IN is allowed for list of ID or code only //if (!preg_match('/^\(.*\)$/', $tmpescaped)) { - $tmpescaped = '('.$db->escape($db->sanitize($tmpescaped, 1, 0)).')'; + $tmpescaped = '('.$db->escape($db->sanitize($tmpescaped, 1, 0)).')'; //} else { // $tmpescaped = $db->escape($db->sanitize($tmpescaped, 1)); //} @@ -13398,7 +13412,9 @@ function GETPOSTDATE($prefix, $hourTime = '', $gm = 'auto') */ function buildParamDate($prefix, $timestamp = null, $hourTime = '', $gm = 'auto') { - if ($timestamp === null) $timestamp = GETPOSTDATE($prefix, $hourTime, $gm); + if ($timestamp === null) { + $timestamp = GETPOSTDATE($prefix, $hourTime, $gm); + } $TParam = array( $prefix . 'day' => intval(dol_print_date($timestamp, '%d')), $prefix . 'month' => intval(dol_print_date($timestamp, '%m')), diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 847009dbace..f102ecdd14b 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1146,8 +1146,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ if (dol_strlen($reg[$posy]) < 2) { return 'ErrorCantUseRazWithYearOnOneDigit'; } - } else // if reset is for a specific month in year, we need year - { + } else { // if reset is for a specific month in year, we need year if (preg_match('/^(.*)\{(m+)\}\{(y+)\}/i', $maskwithonlyymcode, $reg)) { $posy = 3; $posm = 2; @@ -1162,8 +1161,8 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ } } // Define length - $yearlen = $posy ?dol_strlen($reg[$posy]) : 0; - $monthlen = $posm ?dol_strlen($reg[$posm]) : 0; + $yearlen = $posy ? dol_strlen($reg[$posy]) : 0; + $monthlen = $posm ? dol_strlen($reg[$posm]) : 0; // Define pos $yearpos = (dol_strlen($reg[1]) + 1); $monthpos = ($yearpos + $yearlen); @@ -1435,8 +1434,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ $numFinal = preg_replace('/\{yyyy\}/i', date("Y", $date) + $yearoffset, $numFinal); $numFinal = preg_replace('/\{yy\}/i', date("y", $date) + $yearoffset, $numFinal); $numFinal = preg_replace('/\{y\}/i', substr(date("y", $date), 1, 1) + $yearoffset, $numFinal); - } else // we want yyyy to be current year - { + } else { // we want yyyy to be current year $numFinal = preg_replace('/\{yyyy\}/i', date("Y", $date), $numFinal); $numFinal = preg_replace('/\{yy\}/i', date("y", $date), $numFinal); $numFinal = preg_replace('/\{y\}/i', substr(date("y", $date), 1, 1), $numFinal); @@ -1491,13 +1489,13 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ function get_string_between($string, $start, $end) { $string = " ".$string; - $ini = strpos($string, $start); + $ini = strpos($string, $start); if ($ini == 0) { return ""; } - $ini += strlen($start); - $len = strpos($string, $end, $ini) - $ini; - return substr($string, $ini, $len); + $ini += strlen($start); + $len = strpos($string, $end, $ini) - $ini; + return substr($string, $ini, $len); } /** @@ -1707,15 +1705,14 @@ function numero_semaine($time) $premierJeudiAnnee = mktime(12, 0, 0, 1, 1, date("Y", $jeudiSemaine)) + (4 - date("w", mktime(12, 0, 0, 1, 1, date("Y", $jeudiSemaine)))) * 24 * 60 * 60; } elseif (date("w", mktime(12, 0, 0, 1, 1, date("Y", $jeudiSemaine))) > 4) { // du Vendredi au Samedi $premierJeudiAnnee = mktime(12, 0, 0, 1, 1, date("Y", $jeudiSemaine)) + (7 - (date("w", mktime(12, 0, 0, 1, 1, date("Y", $jeudiSemaine))) - 4)) * 24 * 60 * 60; - } else // Jeudi - { + } else { // Jeudi $premierJeudiAnnee = mktime(12, 0, 0, 1, 1, date("Y", $jeudiSemaine)); } // Definition du numero de semaine: nb de jours entre "premier Jeudi de l'annee" et "Jeudi de la semaine"; $numeroSemaine = ( - ( - date("z", mktime(12, 0, 0, date("m", $jeudiSemaine), date("d", $jeudiSemaine), date("Y", $jeudiSemaine))) + ( + date("z", mktime(12, 0, 0, date("m", $jeudiSemaine), date("d", $jeudiSemaine), date("Y", $jeudiSemaine))) - date("z", mktime(12, 0, 0, date("m", $premierJeudiAnnee), date("d", $premierJeudiAnnee), date("Y", $premierJeudiAnnee))) ) / 7 @@ -2078,11 +2075,11 @@ function getSoapParams() global $conf; $params = array(); - $proxyuse = (!getDolGlobalString('MAIN_PROXY_USE') ?false:true); - $proxyhost = (!getDolGlobalString('MAIN_PROXY_USE') ?false:$conf->global->MAIN_PROXY_HOST); - $proxyport = (!getDolGlobalString('MAIN_PROXY_USE') ?false:$conf->global->MAIN_PROXY_PORT); - $proxyuser = (!getDolGlobalString('MAIN_PROXY_USE') ?false:$conf->global->MAIN_PROXY_USER); - $proxypass = (!getDolGlobalString('MAIN_PROXY_USE') ?false:$conf->global->MAIN_PROXY_PASS); + $proxyuse = (!getDolGlobalString('MAIN_PROXY_USE') ? false : true); + $proxyhost = (!getDolGlobalString('MAIN_PROXY_USE') ? false : $conf->global->MAIN_PROXY_HOST); + $proxyport = (!getDolGlobalString('MAIN_PROXY_USE') ? false : $conf->global->MAIN_PROXY_PORT); + $proxyuser = (!getDolGlobalString('MAIN_PROXY_USE') ? false : $conf->global->MAIN_PROXY_USER); + $proxypass = (!getDolGlobalString('MAIN_PROXY_USE') ? false : $conf->global->MAIN_PROXY_PASS); $timeout = (!getDolGlobalString('MAIN_USE_CONNECT_TIMEOUT') ? 10 : $conf->global->MAIN_USE_CONNECT_TIMEOUT); // Connection timeout $response_timeout = (!getDolGlobalString('MAIN_USE_RESPONSE_TIMEOUT') ? 30 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT); // Response timeout //print extension_loaded('soap'); @@ -2485,8 +2482,7 @@ function colorAgressiveness($hex, $ratio = -50, $brightness = 0) if ($color < 128) { $color -= ($color * ($ratio / 100)); } - } else // We decrease agressiveness - { + } else { // We decrease agressiveness if ($color > 128) { $color -= (($color - 128) * (abs($ratio) / 100)); } @@ -2934,7 +2930,8 @@ function removeGlobalParenthesis($string) } $nbofchars = dol_strlen($string); - $i = 0; $g = 0; + $i = 0; + $g = 0; $countparenthesis = 0; while ($i < $nbofchars) { $char = dol_substr($string, $i, 1); diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index c594b5b43b0..bd49d2fe9ce 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -212,7 +212,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = if ($iptocheck) { // Set CURLOPT_CONNECT_TO so curl will not try another resolution that may give a different result. Possible only on PHP v7+ if (defined('CURLOPT_CONNECT_TO')) { - $connect_to = array(sprintf("%s:%d:%s:%d", $newUrlArray['host'], empty($newUrlArray['port'])?'':$newUrlArray['port'], $iptocheck, empty($newUrlArray['port'])?'':$newUrlArray['port'])); + $connect_to = array(sprintf("%s:%d:%s:%d", $newUrlArray['host'], empty($newUrlArray['port']) ? '' : $newUrlArray['port'], $iptocheck, empty($newUrlArray['port']) ? '' : $newUrlArray['port'])); //var_dump($newUrlArray); //var_dump($connect_to); curl_setopt($ch, CURLOPT_CONNECT_TO, $connect_to); diff --git a/htdocs/core/lib/invoice2.lib.php b/htdocs/core/lib/invoice2.lib.php index 3a9712ba58f..0bf4e5fecc4 100644 --- a/htdocs/core/lib/invoice2.lib.php +++ b/htdocs/core/lib/invoice2.lib.php @@ -255,10 +255,10 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte // Charge un document PDF depuis un fichier. $pagecount = $pdf->setSourceFile($file); for ($i = 1; $i <= $pagecount; $i++) { - $tplidx = $pdf->importPage($i); - $s = $pdf->getTemplatesize($tplidx); - $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); - $pdf->useTemplate($tplidx); + $tplidx = $pdf->importPage($i); + $s = $pdf->getTemplatesize($tplidx); + $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); + $pdf->useTemplate($tplidx); } } diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index de14221c282..778379e84a2 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -53,7 +53,7 @@ function member_prepare_head(Adherent $object) } if ($user->hasRight('adherent', 'cotisation', 'lire')) { - $nbSubscription = is_array($object->subscriptions) ?count($object->subscriptions) : 0; + $nbSubscription = is_array($object->subscriptions) ? count($object->subscriptions) : 0; $head[$h][0] = DOL_URL_ROOT.'/adherents/subscription.php?rowid='.$object->id; $head[$h][1] = $langs->trans("Subscriptions"); $head[$h][2] = 'subscription'; diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 321f3028e92..bd07f0d745a 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -129,7 +129,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = } $texttoinsert .= ' "enabled"=>"'.($val['enabled'] !== '' ? dol_escape_php($val['enabled']) : 1).'",'; $texttoinsert .= " 'position'=>".($val['position'] !== '' ? (int) $val['position'] : 50).","; - $texttoinsert .= " 'notnull'=>".(empty($val['notnull']) ? 0 :(int) $val['notnull']).","; + $texttoinsert .= " 'notnull'=>".(empty($val['notnull']) ? 0 : (int) $val['notnull']).","; $texttoinsert .= ' "visible"=>"'.($val['visible'] !== '' ? dol_escape_js($val['visible']) : -1).'",'; if (!empty($val['noteditable'])) { $texttoinsert .= ' "noteditable"=>"'.dol_escape_php($val['noteditable']).'",'; @@ -464,7 +464,6 @@ function dolGetListOfObjectClasses($destdir) */ function checkExistComment($file, $number) { - if (!file_exists($file)) { return -1; } @@ -598,8 +597,8 @@ function reWriteAllPermissions($file, $permissions, $key, $right, $objectname, $ $permissions[$i][4] = "\$this->rights[\$r][4] = '".$permissions[$i][4]."'"; $permissions[$i][5] = "\$this->rights[\$r][5] = '".$permissions[$i][5]."';\n\t\t"; } - // for group permissions by object - $perms_grouped = array(); + // for group permissions by object + $perms_grouped = array(); foreach ($permissions as $perms) { $object = $perms[4]; if (!isset($perms_grouped[$object])) { @@ -658,7 +657,6 @@ function reWriteAllPermissions($file, $permissions, $key, $right, $objectname, $ */ function parsePropertyString($string) { - $string = str_replace("'", '', $string); // Uses a regular expression to capture keys and values @@ -707,7 +705,7 @@ function writePropsInAsciiDoc($file, $objectname, $destfile) { // stock all properties in array - $attributesUnique = array ('type','label', 'enabled', 'position', 'notnull', 'visible', 'noteditable', 'index', 'default' , 'foreignkey', 'arrayofkeyval', 'alwayseditable','validate', 'searchall','comment', 'isameasure', 'css', 'cssview','csslist', 'help', 'showoncombobox','picto' ); + $attributesUnique = array('type','label', 'enabled', 'position', 'notnull', 'visible', 'noteditable', 'index', 'default' , 'foreignkey', 'arrayofkeyval', 'alwayseditable','validate', 'searchall','comment', 'isameasure', 'css', 'cssview','csslist', 'help', 'showoncombobox','picto' ); $start = "public \$fields=array("; $end = ");"; @@ -1136,7 +1134,8 @@ function reWriteAllMenus($file, $menus, $menuWantTo, $key, $action) dolReplaceInFile($file, array($beginMenu => $beginMenu."\n".$str_menu."\n")); return 1; - }return -1; + } + return -1; } /** @@ -1149,7 +1148,6 @@ function reWriteAllMenus($file, $menus, $menuWantTo, $key, $action) */ function updateDictionaryInFile($module, $file, $dicts) { - $isEmpty = false; $dicData = "\t\t\$this->dictionaries=array(\n"; $module = strtolower($module); @@ -1271,7 +1269,7 @@ function createNewDictionnary($modulename, $file, $namedic, $dictionnaires = nul $dictionnaires['tabhelp'][] = (array_key_exists('code', $columns) ? array('code'=>$langs->trans('CodeTooltipHelp'), 'field2' => 'field2tooltip') : ''); // Build the dictionary string - $writeInfile = updateDictionaryInFile($modulename, $file, $dictionnaires); + $writeInfile = updateDictionaryInFile($modulename, $file, $dictionnaires); if ($writeInfile > 0) { setEventMessages($langs->trans("DictionariesCreated", ucfirst(substr($namedic, 2))), null); } diff --git a/htdocs/core/lib/parsemd.lib.php b/htdocs/core/lib/parsemd.lib.php index 4015227a104..5e72271303e 100644 --- a/htdocs/core/lib/parsemd.lib.php +++ b/htdocs/core/lib/parsemd.lib.php @@ -78,7 +78,7 @@ function dolMd2Asciidoc($content, $parser = 'dolibarr', $replaceimagepath = null } //if ($parser == 'dolibarr') //{ - $content = preg_replace('//msU', '', $content); + $content = preg_replace('//msU', '', $content); //} //else //{ diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 4bf0f062f33..b8c749a3d23 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -205,7 +205,7 @@ function pdf_getInstance($format = '', $metric = 'mm', $pagetype = 'P') */ // For TCPDF, we specify permission we want to block - $pdfrights = (getDolGlobalString('PDF_SECURITY_ENCRYPTION_RIGHTS') ?json_decode($conf->global->PDF_SECURITY_ENCRYPTION_RIGHTS, true) : array('modify', 'copy')); // Json format in llx_const + $pdfrights = (getDolGlobalString('PDF_SECURITY_ENCRYPTION_RIGHTS') ? json_decode($conf->global->PDF_SECURITY_ENCRYPTION_RIGHTS, true) : array('modify', 'copy')); // Json format in llx_const // Password for the end user $pdfuserpass = (getDolGlobalString('PDF_SECURITY_ENCRYPTION_USERPASS') ? $conf->global->PDF_SECURITY_ENCRYPTION_USERPASS : ''); @@ -218,7 +218,7 @@ function pdf_getInstance($format = '', $metric = 'mm', $pagetype = 'P') // Array of recipients containing public-key certificates ('c') and permissions ('p'). // For example: array(array('c' => 'file://../examples/data/cert/tcpdf.crt', 'p' => array('print'))) - $pubkeys = (getDolGlobalString('PDF_SECURITY_ENCRYPTION_PUBKEYS') ?json_decode($conf->global->PDF_SECURITY_ENCRYPTION_PUBKEYS, true) : null); // Json format in llx_const + $pubkeys = (getDolGlobalString('PDF_SECURITY_ENCRYPTION_PUBKEYS') ? json_decode($conf->global->PDF_SECURITY_ENCRYPTION_PUBKEYS, true) : null); // Json format in llx_const $pdf->SetProtection($pdfrights, $pdfuserpass, $pdfownerpass, $encstrength, $pubkeys); } @@ -732,9 +732,13 @@ function pdf_pagehead(&$pdf, $outputlangs, $page_height) $filepath = $conf->mycompany->dir_output.'/logos/' . getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF'); if (file_exists($filepath)) { $pdf->SetAutoPageBreak(0, 0); // Disable auto pagebreak before adding image - if (getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF_ALPHA')) { $pdf->SetAlpha($conf->global->MAIN_USE_BACKGROUND_ON_PDF_ALPHA); } // Option for change opacity of background + if (getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF_ALPHA')) { + $pdf->SetAlpha($conf->global->MAIN_USE_BACKGROUND_ON_PDF_ALPHA); + } // Option for change opacity of background $pdf->Image($filepath, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_X : 0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y : 0), 0, $page_height); - if (getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF_ALPHA')) { $pdf->SetAlpha(1); } + if (getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF_ALPHA')) { + $pdf->SetAlpha(1); + } $pdf->SetPageMark(); // This option avoid to have the images missing on some pages $pdf->SetAutoPageBreak(1, 0); // Restore pagebreak } @@ -1234,7 +1238,9 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $pdf->SetAutoPageBreak(1, 0); // Restore pagebreak } - if (getDolGlobalInt('PDF_FREETEXT_DISABLE_PAGEBREAK') === 1) { $pdf->SetAutoPageBreak(0, 0); } // Option for disable auto pagebreak + if (getDolGlobalInt('PDF_FREETEXT_DISABLE_PAGEBREAK') === 1) { + $pdf->SetAutoPageBreak(0, 0); + } // Option for disable auto pagebreak if ($line) { // Free text $pdf->SetXY($dims['lm'], -$posy); if (!getDolGlobalString('PDF_ALLOW_HTML_FOR_FREE_TEXT')) { // by default @@ -1244,7 +1250,9 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ } $posy -= $freetextheight; } - if (getDolGlobalInt('PDF_FREETEXT_DISABLE_PAGEBREAK') === 1) { $pdf->SetAutoPageBreak(1, 0); } // Restore pagebreak + if (getDolGlobalInt('PDF_FREETEXT_DISABLE_PAGEBREAK') === 1) { + $pdf->SetAutoPageBreak(1, 0); + } // Restore pagebreak $pdf->SetY(-$posy); @@ -1260,9 +1268,13 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $posy--; } - if (getDolGlobalInt('PDF_FOOTER_DISABLE_PAGEBREAK') === 1) { $pdf->SetAutoPageBreak(0, 0); } // Option for disable auto pagebreak + if (getDolGlobalInt('PDF_FOOTER_DISABLE_PAGEBREAK') === 1) { + $pdf->SetAutoPageBreak(0, 0); + } // Option for disable auto pagebreak $pdf->writeHTMLCell($pdf->page_largeur - $pdf->margin_left - $pdf->margin_right, $mycustomfooterheight, $dims['lm'], $dims['hk'] - $posy, dol_htmlentitiesbr($mycustomfooter, 1, 'UTF-8', 0)); - if (getDolGlobalInt('PDF_FOOTER_DISABLE_PAGEBREAK') === 1) { $pdf->SetAutoPageBreak(1, 0); } // Restore pagebreak + if (getDolGlobalInt('PDF_FOOTER_DISABLE_PAGEBREAK') === 1) { + $pdf->SetAutoPageBreak(1, 0); + } // Restore pagebreak $posy -= $mycustomfooterheight - 3; } else { @@ -1278,7 +1290,9 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $pdf->SetAutoPageBreak(1, 0); // Restore pagebreak } - if (getDolGlobalInt('PDF_FREETEXT_DISABLE_PAGEBREAK') === 1) { $pdf->SetAutoPageBreak(0, 0); } // Option for disable auto pagebreak + if (getDolGlobalInt('PDF_FREETEXT_DISABLE_PAGEBREAK') === 1) { + $pdf->SetAutoPageBreak(0, 0); + } // Option for disable auto pagebreak if ($line) { // Free text $pdf->SetXY($dims['lm'], -$posy); if (!getDolGlobalString('PDF_ALLOW_HTML_FOR_FREE_TEXT')) { // by default @@ -1288,7 +1302,9 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ } $posy -= $freetextheight; } - if (getDolGlobalInt('PDF_FREETEXT_DISABLE_PAGEBREAK') === 1) { $pdf->SetAutoPageBreak(1, 0); } // Restore pagebreak + if (getDolGlobalInt('PDF_FREETEXT_DISABLE_PAGEBREAK') === 1) { + $pdf->SetAutoPageBreak(1, 0); + } // Restore pagebreak $pdf->SetY(-$posy); @@ -1337,12 +1353,12 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ } // Show page nb only on iso languages (so default Helvetica font) // if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') { - $pdf->SetXY($dims['wk'] - $dims['rm'] - 18 - getDolGlobalInt('PDF_FOOTER_PAGE_NUMBER_X', 0), -$posy - getDolGlobalInt('PDF_FOOTER_PAGE_NUMBER_Y', 0)); - // $pdf->MultiCell(18, 2, $pdf->getPageNumGroupAlias().' / '.$pdf->getPageGroupAlias(), 0, 'R', 0); - // $pdf->MultiCell(18, 2, $pdf->PageNo().' / '.$pdf->getAliasNbPages(), 0, 'R', 0); // doesn't works with all fonts - // $pagination = $pdf->getAliasNumPage().' / '.$pdf->getAliasNbPages(); // works with $pdf->Cell - $pagination = $pdf->PageNo().' / '.$pdf->getNumPages(); - $pdf->MultiCell(18, 2, $pagination, 0, 'R', 0); + $pdf->SetXY($dims['wk'] - $dims['rm'] - 18 - getDolGlobalInt('PDF_FOOTER_PAGE_NUMBER_X', 0), -$posy - getDolGlobalInt('PDF_FOOTER_PAGE_NUMBER_Y', 0)); + // $pdf->MultiCell(18, 2, $pdf->getPageNumGroupAlias().' / '.$pdf->getPageGroupAlias(), 0, 'R', 0); + // $pdf->MultiCell(18, 2, $pdf->PageNo().' / '.$pdf->getAliasNbPages(), 0, 'R', 0); // doesn't works with all fonts + // $pagination = $pdf->getAliasNumPage().' / '.$pdf->getAliasNbPages(); // works with $pdf->Cell + $pagination = $pdf->PageNo().' / '.$pdf->getNumPages(); + $pdf->MultiCell(18, 2, $pagination, 0, 'R', 0); // } // Show Draft Watermark @@ -1550,17 +1566,21 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_REF')) { foreach ($tmparrayofsubproducts as $subprodval) { - $libelleproduitservice = dol_concatdesc(dol_concatdesc($libelleproduitservice, " * ".$subprodval[3]), + $libelleproduitservice = dol_concatdesc( + dol_concatdesc($libelleproduitservice, " * ".$subprodval[3]), (!empty($qtyText) ? - $outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1]*$qtyText: - $outputlangs->trans('Qty').' '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1])); + $outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1]*$qtyText : + $outputlangs->trans('Qty').' '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1]) + ); } } else { foreach ($tmparrayofsubproducts as $subprodval) { - $libelleproduitservice = dol_concatdesc(dol_concatdesc($libelleproduitservice, " * ".$subprodval[5].(($subprodval[5] && $subprodval[3]) ? ' - ' : '').$subprodval[3]), + $libelleproduitservice = dol_concatdesc( + dol_concatdesc($libelleproduitservice, " * ".$subprodval[5].(($subprodval[5] && $subprodval[3]) ? ' - ' : '').$subprodval[3]), (!empty($qtyText) ? - $outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1]*$qtyText: - $outputlangs->trans('Qty').' '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1])); + $outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1]*$qtyText : + $outputlangs->trans('Qty').' '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1]) + ); } } } @@ -2470,7 +2490,7 @@ function pdf_getLinkedObjects(&$object, $outputlangs) if (count($objects) > 1 && count($objects) <= (getDolGlobalInt("MAXREFONDOC") ? getDolGlobalInt("MAXREFONDOC") : 10)) { $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("RefOrder").' :'); foreach ($objects as $elementobject) { - $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref).(empty($elementobject->ref_client) ?'' : ' ('.$elementobject->ref_client.')').(empty($elementobject->ref_supplier) ? '' : ' ('.$elementobject->ref_supplier.')').' '); + $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref).(empty($elementobject->ref_client) ? '' : ' ('.$elementobject->ref_client.')').(empty($elementobject->ref_supplier) ? '' : ' ('.$elementobject->ref_supplier.')').' '); $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("OrderDate").' : '.dol_print_date($elementobject->date, 'day', '', $outputlangs)); } } elseif (count($objects) == 1) { @@ -2599,8 +2619,7 @@ function pdf_getSizeForImage($realpath) if ($width > $maxwidth) { // Pb with maxheight, so i use maxwidth $width = $maxwidth; $height = (int) round($maxwidth * $tmp['height'] / $tmp['width']); - } else // No pb with maxheight - { + } else { // No pb with maxheight $height = $maxheight; } } diff --git a/htdocs/core/lib/phpsessionindb.lib.php b/htdocs/core/lib/phpsessionindb.lib.php index 9dd806d86fc..7d19730674e 100644 --- a/htdocs/core/lib/phpsessionindb.lib.php +++ b/htdocs/core/lib/phpsessionindb.lib.php @@ -48,12 +48,24 @@ function dolSessionOpen($save_path, $session_name) global $dolibarr_session_db_type, $dolibarr_session_db_host; global $dolibarr_session_db_user, $dolibarr_session_db_pass, $dolibarr_session_db_name, $dolibarr_session_db_port; - if (empty($dolibarr_session_db_type)) { $dolibarr_session_db_type = $dolibarr_main_db_type; } - if (empty($dolibarr_session_db_host)) { $dolibarr_session_db_host = $dolibarr_main_db_host; } - if (empty($dolibarr_session_db_user)) { $dolibarr_session_db_user = $dolibarr_main_db_user; } - if (empty($dolibarr_session_db_pass)) { $dolibarr_session_db_pass = $dolibarr_main_db_pass; } - if (empty($dolibarr_session_db_name)) { $dolibarr_session_db_name = $dolibarr_main_db_name; } - if (empty($dolibarr_session_db_port)) { $dolibarr_session_db_port = $dolibarr_main_db_port; } + if (empty($dolibarr_session_db_type)) { + $dolibarr_session_db_type = $dolibarr_main_db_type; + } + if (empty($dolibarr_session_db_host)) { + $dolibarr_session_db_host = $dolibarr_main_db_host; + } + if (empty($dolibarr_session_db_user)) { + $dolibarr_session_db_user = $dolibarr_main_db_user; + } + if (empty($dolibarr_session_db_pass)) { + $dolibarr_session_db_pass = $dolibarr_main_db_pass; + } + if (empty($dolibarr_session_db_name)) { + $dolibarr_session_db_name = $dolibarr_main_db_name; + } + if (empty($dolibarr_session_db_port)) { + $dolibarr_session_db_port = $dolibarr_main_db_port; + } //var_dump('open '.$database_name.' '.$table_name); $dbsession = getDoliDBInstance($dolibarr_session_db_type, $dolibarr_session_db_host, $dolibarr_session_db_user, $dolibarr_session_db_pass, $dolibarr_session_db_name, (int) $dolibarr_session_db_port); diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 4febb1fbe21..a2e42cde0c9 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -39,11 +39,11 @@ function product_prepare_head($object) $langs->load("products"); $label = $langs->trans('Product'); - $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('product', 'product_advance', 'read_prices'):$user->hasRight('product', 'read'); + $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('product', 'product_advance', 'read_prices') : $user->hasRight('product', 'read'); if ($object->isService()) { $label = $langs->trans('Service'); - $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('service', 'service_advance', 'read_prices'):$user->hasRight('service', 'read'); + $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('service', 'service_advance', 'read_prices') : $user->hasRight('service', 'read'); } $h = 0; diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index a74df640399..ddcae0393c5 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -230,7 +230,8 @@ function project_prepare_head(Project $project, $moreparam = '') $head[$h][1] = $langs->trans("EventOrganization"); // Enable caching of conf or booth count - $nbConfOrBooth = 0; $nbAttendees = 0; + $nbConfOrBooth = 0; + $nbAttendees = 0; require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; $cachekey = 'count_conferenceorbooth_'.$project->id; $dataretrieved = dol_getcache($cachekey); @@ -823,7 +824,8 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t // Progress calculated (Note: ->duration_effective is time spent) if (count($arrayfields) > 0 && !empty($arrayfields['t.progress_calculated']['checked'])) { - $s = ''; $shtml = ''; + $s = ''; + $shtml = ''; if ($lines[$i]->planned_workload || $lines[$i]->duration_effective) { if ($lines[$i]->planned_workload) { $s = round(100 * $lines[$i]->duration_effective / $lines[$i]->planned_workload, 2).' %'; @@ -2063,7 +2065,9 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ $modeinput = 'hours'; for ($idw = 0; $idw < 7; $idw++) { $tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); - if (!isset($totalforeachday[$tmpday])) $totalforeachday[$tmpday] = 0; + if (!isset($totalforeachday[$tmpday])) { + $totalforeachday[$tmpday] = 0; + } $cssonholiday = ''; if (!$isavailable[$tmpday]['morning'] && !$isavailable[$tmpday]['afternoon']) { $cssonholiday .= 'onholidayallday '; @@ -2362,7 +2366,9 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & $month = $firstdaytoshowarray['mon']; foreach ($TWeek as $weekIndex => $weekNb) { $weekWorkLoad = !empty($projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id]) ? $projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id] : 0 ; - if (!isset($totalforeachweek[$weekNb])) $totalforeachweek[$weekNb] = 0; + if (!isset($totalforeachweek[$weekNb])) { + $totalforeachweek[$weekNb] = 0; + } $totalforeachweek[$weekNb] += $weekWorkLoad; $alreadyspent = ''; @@ -2738,14 +2744,14 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks $plannedworkload = $objp->planned_workload; $total_plannedworkload += $plannedworkload; if (!in_array('plannedworkload', $hiddenfields)) { - print ''.($plannedworkload ?convertSecondToTime($plannedworkload) : '').''; + print ''.($plannedworkload ? convertSecondToTime($plannedworkload) : '').''; } if (!in_array('declaredprogress', $hiddenfields)) { $declaredprogressworkload = $objp->declared_progess_workload; $total_declaredprogressworkload += $declaredprogressworkload; print ''; //print $objp->planned_workload.'-'.$objp->declared_progess_workload."
"; - print ($plannedworkload ?round(100 * $declaredprogressworkload / $plannedworkload, 0).'%' : ''); + print($plannedworkload ? round(100 * $declaredprogressworkload / $plannedworkload, 0).'%' : ''); print ''; } } @@ -2787,10 +2793,10 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks if (!getDolGlobalString('PROJECT_HIDE_TASKS')) { print ''.$total_task.''; if (!in_array('plannedworkload', $hiddenfields)) { - print ''.($total_plannedworkload ?convertSecondToTime($total_plannedworkload) : '').''; + print ''.($total_plannedworkload ? convertSecondToTime($total_plannedworkload) : '').''; } if (!in_array('declaredprogress', $hiddenfields)) { - print ''.($total_plannedworkload ?round(100 * $total_declaredprogressworkload / $total_plannedworkload, 0).'%' : '').''; + print ''.($total_plannedworkload ? round(100 * $total_declaredprogressworkload / $total_plannedworkload, 0).'%' : '').''; } } if (!in_array('projectstatus', $hiddenfields)) { diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index 4431234bc46..5a4e166ec99 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -319,8 +319,8 @@ function getCustomerProposalPieChart($socid = 0) //if ($totalinprocess != $total) //{ // print ''; - // print ''.$langs->trans("Total").' ('.$langs->trans("CustomersOrdersRunning").')'; - // print ''.$totalinprocess.''; + // print ''.$langs->trans("Total").' ('.$langs->trans("CustomersOrdersRunning").')'; + // print ''.$totalinprocess.''; // print ''; //} diff --git a/htdocs/core/lib/report.lib.php b/htdocs/core/lib/report.lib.php index badeb47d6f4..b92963e0f7d 100644 --- a/htdocs/core/lib/report.lib.php +++ b/htdocs/core/lib/report.lib.php @@ -58,7 +58,7 @@ function report_header($reportname, $notused, $period, $periodlink, $description print dol_get_fiche_head(); foreach ($moreparam as $key => $value) { - print ''."\n"; + print ''."\n"; } print ''."\n"; diff --git a/htdocs/core/lib/resource.lib.php b/htdocs/core/lib/resource.lib.php index 13e0d6d09ee..8bdaf599d78 100644 --- a/htdocs/core/lib/resource.lib.php +++ b/htdocs/core/lib/resource.lib.php @@ -114,7 +114,6 @@ function resource_prepare_head($object) */ function resource_admin_prepare_head() { - global $conf, $db, $langs, $user; $extrafields = new ExtraFields($db); diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 39ab9cdeb41..1fb7dbdbdbf 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -741,7 +741,7 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', } } elseif ($feature == 'payment') { if (!$user->hasRight('facture', 'paiement')) { - $deleteok = 0; + $deleteok = 0; } } elseif ($feature == 'payment_sc') { if (!$user->hasRight('tax', 'charges', 'creer')) { diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 8eef224ae25..3745eddf513 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -195,7 +195,7 @@ function generate_random_id($car = 16) { $string = ""; $chaine = "abcdefghijklmnopqrstuvwxyz123456789"; - mt_srand((double) microtime() * 1000000); + mt_srand((float) microtime() * 1000000); for ($i = 0; $i < $car; $i++) { $string .= $chaine[mt_rand() % strlen($chaine)]; } diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index f34048fed3b..d679d230566 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -152,8 +152,8 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset //print 'rang='.$rang.'-x='.$x." rowid=".$tab[$x]['rowid']." tab[x]['fk_leftmenu'] = ".$tab[$x]['fk_leftmenu']." leftmenu pere = ".$pere['leftmenu']."
\n"; if (empty($ulprinted) && !empty($pere['rowid'])) { if (!empty($tree_recur_alreadyadded[$tab[$x]['rowid']])) { - dol_syslog('Error, record with id '.$tab[$x]['rowid'].' seems to be a child of record with id '.$pere['rowid'].' but it was already output. Complete field "leftmenu" and "mainmenu" on ALL records to avoid ambiguity.', LOG_WARNING); - continue; + dol_syslog('Error, record with id '.$tab[$x]['rowid'].' seems to be a child of record with id '.$pere['rowid'].' but it was already output. Complete field "leftmenu" and "mainmenu" on ALL records to avoid ambiguity.', LOG_WARNING); + continue; } print "\n".''; diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 20e7c93f965..60b52ba3101 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -527,7 +527,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print '
'; if ($edit) { //print ajax_constantonoff('THEME_TOPMENU_DISABLE_IMAGE', array(), null, 0, 0, 1); - print $form->selectarray('THEME_TOPMENU_DISABLE_IMAGE', $listoftopmenumodes, isset($conf->global->THEME_TOPMENU_DISABLE_IMAGE)?$conf->global->THEME_TOPMENU_DISABLE_IMAGE:0, 0, 0, 0, '', 0, 0, 0, '', 'widthcentpercentminusx maxwidth500'); + print $form->selectarray('THEME_TOPMENU_DISABLE_IMAGE', $listoftopmenumodes, isset($conf->global->THEME_TOPMENU_DISABLE_IMAGE) ? $conf->global->THEME_TOPMENU_DISABLE_IMAGE : 0, 0, 0, 0, '', 0, 0, 0, '', 'widthcentpercentminusx maxwidth500'); } else { $listoftopmenumodes[getDolGlobalString('THEME_TOPMENU_DISABLE_IMAGE')]; //print yn($conf->global->THEME_TOPMENU_DISABLE_IMAGE); diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 904fc9808e3..5f0bfd8915d 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -557,8 +557,7 @@ function redirectToContainer($containerref, $containeraliasalt = '', $containeri $newurl = $currenturi.'&pageref='.urlencode($containerref); } } - } else // When page called from virtual host server - { + } else { // When page called from virtual host server $newurl = '/'.$containerref.'.php'; } diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 36605571053..144d46d31de 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -103,7 +103,9 @@ function dolSavePageAlias($filealias, $object, $objectpage) $filename = basename($filealias); foreach (explode(',', $object->otherlang) as $sublang) { // Avoid to erase main alias file if $sublang is empty string - if (empty(trim($sublang))) continue; + if (empty(trim($sublang))) { + continue; + } $filealiassub = $dirname.'/'.$sublang.'/'.$filename; $aliascontent = 'otherlang) as $sublang) { // Avoid to erase main alias file if $sublang is empty string - if (empty(trim($sublang))) continue; + if (empty(trim($sublang))) { + continue; + } $fileindexsub = $dirname.'/'.$sublang.'/index.php'; // Same indexcontent than previously but with ../ instead of ./ for master and tpl file include/require_once. diff --git a/htdocs/core/lib/xcal.lib.php b/htdocs/core/lib/xcal.lib.php index b2b2194246d..bddcce12d72 100644 --- a/htdocs/core/lib/xcal.lib.php +++ b/htdocs/core/lib/xcal.lib.php @@ -330,7 +330,7 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt dol_syslog("xcal.lib.php::build_rssfile Build rss file ".$outputfile." to format ".$format); if (empty($outputfile)) { - // -1 = error + // -1 = error return -1; }