';
+ $ret.= '
';
$ret.= $langs->trans($text);
$ret.= '
'."\n";
}
@@ -267,7 +267,8 @@ class Form
if (preg_match('/^(string|email|numeric)/',$inputType))
{
$tmp=explode(':',$inputType);
- $inputType=$tmp[0]; $inputOption=$tmp[1];
+ $inputType=$tmp[0];
+ if (! empty($tmp[1])) $inputOption=$tmp[1];
if (! empty($tmp[2])) $savemethod=$tmp[2];
}
else if (preg_match('/^datepicker/',$inputType))
@@ -2237,8 +2238,8 @@ class Form
{
foreach ($formquestion as $key => $input)
{
- array_push($inputok,$input['name']);
- if ($input['inputko'] == 1) array_push($inputko,$input['name']);
+ if (isset($input['name'])) array_push($inputok,$input['name']);
+ if (isset($input['inputko']) && $input['inputko'] == 1) array_push($inputko,$input['name']);
}
}
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 455758b6148..4503d8e9192 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -821,12 +821,12 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
// This part of code should not be used.
dol_syslog("Functions.lib::dol_print_date function call with deprecated value of time in page ".$_SERVER["PHP_SELF"], LOG_WARNING);
// Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' or 'YYYYMMDDHHMMSS'
- $syear = $reg[1];
- $smonth = $reg[2];
- $sday = $reg[3];
- $shour = $reg[4];
- $smin = $reg[5];
- $ssec = $reg[6];
+ $syear = (! empty($reg[1]) ? $reg[1] : '');
+ $smonth = (! empty($reg[2]) ? $reg[2] : '');
+ $sday = (! empty($reg[3]) ? $reg[3] : '');
+ $shour = (! empty($reg[4]) ? $reg[4] : '');
+ $smin = (! empty($reg[5]) ? $reg[5] : '');
+ $ssec = (! empty($reg[6]) ? $reg[6] : '');
$time=dol_mktime($shour,$smin,$ssec,$smonth,$sday,$syear,true);
$ret=adodb_strftime($format,$time+$offsettz+$offsetdst,$to_gmt);
@@ -966,7 +966,7 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
else $localtz = new DateTimeZone('UTC');
$dt = new DateTime(null,$localtz);
$dt->setDate($year,$month,$day);
- $dt->setTime($hour,$minute,$second);
+ $dt->setTime((int) $hour, (int) $minute, (int) $second);
$date=$dt->getTimestamp();
}
else
@@ -3852,7 +3852,7 @@ function picto_from_langcode($codelang)
*/
function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode='add')
{
- if (is_array($conf->tabs_modules[$type]))
+ if (isset($conf->tabs_modules[$type]) && is_array($conf->tabs_modules[$type]))
{
foreach ($conf->tabs_modules[$type] as $value)
{
diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php
index e13c7dbdc64..d811a3edfd1 100644
--- a/htdocs/core/lib/product.lib.php
+++ b/htdocs/core/lib/product.lib.php
@@ -123,7 +123,7 @@ function product_prepare_head($object, $user)
// More tabs from canvas
- if (is_array($object->onglets))
+ if (isset($object->onglets) && is_array($object->onglets))
{
foreach ($object->onglets as $onglet)
{
diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php
index b1047350a89..95cdb171a1d 100644
--- a/htdocs/core/lib/security.lib.php
+++ b/htdocs/core/lib/security.lib.php
@@ -115,10 +115,14 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
if ($dbt_select != 'rowid') $objectid = "'".$objectid."'";
// More features to check
- $features = explode("&",$features);
+ if (! empty($features)) {
+ $features = explode("&", $features);
+ }
// More parameters
- list($dbtablename, $sharedelement) = explode('&', $dbtablename);
+ if (! empty($dbtablename)) {
+ list($dbtablename, $sharedelement) = explode('&', $dbtablename);
+ }
// Check read permission from module
// TODO Replace "feature" param into caller by first level of permission
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 31f22ef81b6..2936da5720d 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -669,7 +669,7 @@ if (! defined('NOREQUIRETRAN'))
}
// Use php template engine
-if ($conf->global->MAIN_USE_TEMPLATE_ENGINE && ! defined('NOTEMPLATEENGINE'))
+if (! empty($conf->global->MAIN_USE_TEMPLATE_ENGINE) && ! defined('NOTEMPLATEENGINE'))
{
require_once(DOL_DOCUMENT_ROOT.'/includes/savant/Savant3.php');
@@ -893,14 +893,17 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
//print 'themepath='.$themepath.' themeparam='.$themeparam;exit;
print '
'."\n";
// CSS forced by modules (relative url starting with /)
- $dircss=(array) $conf->modules_parts['css'];
- foreach($dircss as $key => $cssfile)
+ if (isset($conf->modules_parts['css']))
{
- // cssfile is a relative path
- print '
'."\n";
+ $dircss=(array) $conf->modules_parts['css'];
+ foreach($dircss as $key => $cssfile)
+ {
+ // cssfile is a relative path
+ print '
'."\n";
+ }
}
// CSS forced by page in top_htmlhead call (relative url starting with /)
if (is_array($arrayofcss))
@@ -1207,7 +1210,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
print "\n".''."\n";
- if ($conf->use_javascript_ajax && $conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) print '
'."\n";
+ if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print '
'."\n";
print '\n";
+ if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print "
\n";
print "\n";
- if (! $conf->use_javascript_ajax || ! $conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) print '