diff --git a/htdocs/adherents/type_ldap.php b/htdocs/adherents/type_ldap.php index 5658bf8ad0a..bfb81e8d5c4 100644 --- a/htdocs/adherents/type_ldap.php +++ b/htdocs/adherents/type_ldap.php @@ -30,27 +30,27 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/ldap.lib.php'; // Load translation files required by the page -$langs->loadLangs(array("admin","members","ldap")); +$langs->loadLangs(array("admin", "members", "ldap")); $id = GETPOST('rowid', 'int'); $action = GETPOST('action', 'alpha'); // Security check -$result=restrictedArea($user, 'adherent', $id, 'adherent_type'); +$result = restrictedArea($user, 'adherent', $id, 'adherent_type'); $object = new AdherentType($db); $object->fetch($id); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('membertypeldapcard','globalcard')); +$hookmanager->initHooks(array('membertypeldapcard', 'globalcard')); /* * Actions */ -$parameters=array(); -$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $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 (empty($reshook)) @@ -66,7 +66,7 @@ if (empty($reshook)) $info = $object->_load_ldap_info(); $dn = $object->_load_ldap_dn($info); - $olddn = $dn; // We can say that old dn = dn as we force synchro + $olddn = $dn; // We can say that old dn = dn as we force synchro $result = $ldap->update($dn, $info, $user, $olddn); } @@ -148,12 +148,12 @@ print '
';
+ $url = dol_buildpath('/google/gmaps.php?mode='.$mode.'&id='.$id, 1);
+ $out .= '
';
}
if ($showomap)
{
- $url=dol_buildpath('/openstreetmap/maps.php?mode='.$mode.'&id='.$id, 1);
- $out.='
';
+ $url = dol_buildpath('/openstreetmap/maps.php?mode='.$mode.'&id='.$id, 1);
+ $out .= '
';
}
}
}
@@ -2857,17 +2857,17 @@ function isValidMXRecord($domain)
{
if (function_exists('idn_to_ascii') && function_exists('checkdnsrr'))
{
- if (! checkdnsrr(idn_to_ascii($domain), 'MX'))
+ if (!checkdnsrr(idn_to_ascii($domain), 'MX'))
{
return 0;
}
if (function_exists('getmxrr'))
{
- $mxhosts=array();
- $weight=array();
+ $mxhosts = array();
+ $weight = array();
getmxrr(idn_to_ascii($domain), $mxhosts, $weight);
if (count($mxhosts) > 1) return 1;
- if (count($mxhosts) == 1 && ! empty($mxhosts[0])) return 1;
+ if (count($mxhosts) == 1 && !empty($mxhosts[0])) return 1;
return 0;
}
@@ -2915,29 +2915,29 @@ function dol_substr($string, $start, $length, $stringencoding = '', $trunconbyte
{
global $langs;
- if (empty($stringencoding)) $stringencoding=$langs->charset_output;
+ if (empty($stringencoding)) $stringencoding = $langs->charset_output;
- $ret='';
+ $ret = '';
if (empty($trunconbytes))
{
if (function_exists('mb_substr'))
{
- $ret=mb_substr($string, $start, $length, $stringencoding);
+ $ret = mb_substr($string, $start, $length, $stringencoding);
}
else
{
- $ret=substr($string, $start, $length);
+ $ret = substr($string, $start, $length);
}
}
else
{
if (function_exists('mb_strcut'))
{
- $ret=mb_strcut($string, $start, $length, $stringencoding);
+ $ret = mb_strcut($string, $start, $length, $stringencoding);
}
else
{
- $ret=substr($string, $start, $length);
+ $ret = substr($string, $start, $length);
}
}
return $ret;
@@ -2961,29 +2961,29 @@ function dol_trunc($string, $size = 40, $trunc = 'right', $stringencoding = 'UTF
{
global $conf;
- if ($size==0 || ! empty($conf->global->MAIN_DISABLE_TRUNC)) return $string;
+ if ($size == 0 || !empty($conf->global->MAIN_DISABLE_TRUNC)) return $string;
- if (empty($stringencoding)) $stringencoding='UTF-8';
+ if (empty($stringencoding)) $stringencoding = 'UTF-8';
// reduce for small screen
- if ($conf->dol_optimize_smallscreen==1 && $display==1) $size = round($size/3);
+ if ($conf->dol_optimize_smallscreen == 1 && $display == 1) $size = round($size / 3);
// We go always here
if ($trunc == 'right')
{
- $newstring=dol_textishtml($string)?dol_string_nohtmltag($string, 1):$string;
- if (dol_strlen($newstring, $stringencoding) > ($size+($nodot?0:3))) // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ...
- return dol_substr($newstring, 0, $size, $stringencoding).($nodot?'':'...');
+ $newstring = dol_textishtml($string) ?dol_string_nohtmltag($string, 1) : $string;
+ if (dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 3))) // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ...
+ return dol_substr($newstring, 0, $size, $stringencoding).($nodot ? '' : '...');
else
//return 'u'.$size.'-'.$newstring.'-'.dol_strlen($newstring,$stringencoding).'-'.$string;
return $string;
}
elseif ($trunc == 'middle')
{
- $newstring=dol_textishtml($string)?dol_string_nohtmltag($string, 1):$string;
- if (dol_strlen($newstring, $stringencoding) > 2 && dol_strlen($newstring, $stringencoding) > ($size+1))
+ $newstring = dol_textishtml($string) ?dol_string_nohtmltag($string, 1) : $string;
+ if (dol_strlen($newstring, $stringencoding) > 2 && dol_strlen($newstring, $stringencoding) > ($size + 1))
{
- $size1=round($size/2);
- $size2=round($size/2);
+ $size1 = round($size / 2);
+ $size2 = round($size / 2);
return dol_substr($newstring, 0, $size1, $stringencoding).'...'.dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size2, $size2, $stringencoding);
}
else
@@ -2991,17 +2991,17 @@ function dol_trunc($string, $size = 40, $trunc = 'right', $stringencoding = 'UTF
}
elseif ($trunc == 'left')
{
- $newstring=dol_textishtml($string)?dol_string_nohtmltag($string, 1):$string;
- if (dol_strlen($newstring, $stringencoding) > ($size+($nodot?0:3))) // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ...
+ $newstring = dol_textishtml($string) ?dol_string_nohtmltag($string, 1) : $string;
+ if (dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 3))) // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ...
return '...'.dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size, $size, $stringencoding);
else
return $string;
}
elseif ($trunc == 'wrap')
{
- $newstring=dol_textishtml($string)?dol_string_nohtmltag($string, 1):$string;
- if (dol_strlen($newstring, $stringencoding) > ($size+1))
- return dol_substr($newstring, 0, $size, $stringencoding)."\n".dol_trunc(dol_substr($newstring, $size, dol_strlen($newstring, $stringencoding)-$size, $stringencoding), $size, $trunc);
+ $newstring = dol_textishtml($string) ?dol_string_nohtmltag($string, 1) : $string;
+ if (dol_strlen($newstring, $stringencoding) > ($size + 1))
+ return dol_substr($newstring, 0, $size, $stringencoding)."\n".dol_trunc(dol_substr($newstring, $size, dol_strlen($newstring, $stringencoding) - $size, $stringencoding), $size, $trunc);
else
return $string;
}
@@ -3039,13 +3039,13 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
// Define fullpathpicto to use into src
if ($pictoisfullpath) {
// Clean parameters
- if (! preg_match('/(\.png|\.gif|\.svg)$/i', $picto)) {
+ if (!preg_match('/(\.png|\.gif|\.svg)$/i', $picto)) {
$picto .= '.png';
}
$fullpathpicto = $picto;
- $reg=array();
+ $reg = array();
if (preg_match('/class="([^"]+)"/', $moreatt, $reg)) {
- $morecss .= ($morecss ? ' ' : '') . $reg[1];
+ $morecss .= ($morecss ? ' ' : '').$reg[1];
$moreatt = str_replace('class="'.$reg[1].'"', '', $moreatt);
}
} else {
@@ -3056,25 +3056,25 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
'address', 'bank', 'bookmark', 'building', 'cash-register', 'close_title', 'cubes', 'delete', 'dolly', 'edit', 'ellipsis-h',
'filter', 'file-code', 'grip', 'grip_title', 'list', 'listlight', 'note',
- 'object_bookmark', 'object_list','object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
+ 'object_bookmark', 'object_list', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'stats',
'note', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'wrench', 'globe',
- 'jabber','skype','twitter','facebook','linkedin',
- 'instagram', 'snapchat', 'youtube', 'google-plus-g','whatsapp',
- 'chevron-left','chevron-right','chevron-down','chevron-top',
+ 'jabber', 'skype', 'twitter', 'facebook', 'linkedin',
+ 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp',
+ 'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top',
'home', 'companies', 'products', 'commercial', 'invoicing', 'accountancy', 'project', 'hrm', 'members', 'ticket', 'generic',
- 'error','warning',
+ 'error', 'warning',
'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda'
)
)) {
$fakey = $pictowithouttext;
$facolor = ''; $fasize = '';
- $fa='fas';
+ $fa = 'fas';
if (in_array($pictowithouttext, array('off', 'on', 'object_bookmark', 'bookmark'))) {
- $fa='far';
+ $fa = 'far';
}
- if (in_array($pictowithouttext, array('skype', 'twitter', 'facebook', 'linkedin', 'instagram','snapchat','youtube','google-plus-g','whatsapp'))) {
- $fa='fab';
+ if (in_array($pictowithouttext, array('skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp'))) {
+ $fa = 'fab';
}
$arrayconvpictotofa = array(
@@ -3082,7 +3082,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'hrm'=>'umbrella-beach', 'members'=>'users', 'ticket'=>'ticket-alt', 'generic'=>'folder-open',
'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'object_bookmark'=>'star', 'bookmark'=>'star', 'stats' => 'chart-bar',
'bank'=>'university', 'close_title'=>'window-close', 'delete'=>'trash', 'edit'=>'pencil', 'filter'=>'filter', 'split'=>'code-fork',
- 'object_list'=>'list-alt','object_calendar'=>'calendar-alt', 'object_calendarweek'=>'calendar-week', 'object_calendarmonth'=>'calendar-alt', 'object_calendarday'=>'calendar-day', 'object_calendarperuser'=>'table',
+ 'object_list'=>'list-alt', 'object_calendar'=>'calendar-alt', 'object_calendarweek'=>'calendar-week', 'object_calendarmonth'=>'calendar-alt', 'object_calendarday'=>'calendar-day', 'object_calendarperuser'=>'table',
'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle',
'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach', 'title_agenda'=>'calendar-alt'
);
@@ -3129,7 +3129,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
elseif ($pictowithouttext == 'listlight') {
$fakey = 'fa-download';
$facolor = '#999';
- $marginleftonlyshort=1;
+ $marginleftonlyshort = 1;
}
elseif ($pictowithouttext == 'printer') {
$fakey = 'fa-print';
@@ -3144,21 +3144,21 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$fakey = 'fa-sticky-note';
$fa = 'far';
$facolor = '#999';
- $marginleftonlyshort=1;
+ $marginleftonlyshort = 1;
}
elseif ($pictowithouttext == 'uparrow') {
$fakey = 'fa-mail-forward';
$facolor = '#555';
}
elseif (in_array($pictowithouttext, array('1uparrow', '1downarrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected'))) {
- $convertarray=array('1uparrow'=>'caret-up', '1downarrow'=>'caret-down', '1leftarrow'=>'caret-left', '1rightarrow'=>'caret-right', '1uparrow_selected'=>'caret-up', '1downarrow_selected'=>'caret-down', '1leftarrow_selected'=>'caret-left', '1rightarrow_selected'=>'caret-right');
+ $convertarray = array('1uparrow'=>'caret-up', '1downarrow'=>'caret-down', '1leftarrow'=>'caret-left', '1rightarrow'=>'caret-right', '1uparrow_selected'=>'caret-up', '1downarrow_selected'=>'caret-down', '1leftarrow_selected'=>'caret-left', '1rightarrow_selected'=>'caret-right');
$fakey = 'fa-'.$convertarray[$pictowithouttext];
if (preg_match('/selected/', $pictowithouttext)) $facolor = '#888';
$marginleftonlyshort = 1;
}
elseif ($pictowithouttext == 'sign-out') {
$fakey = 'fa-sign-out-alt';
- $marginleftonlyshort=0;
+ $marginleftonlyshort = 0;
}
elseif ($pictowithouttext == 'unlink') {
$fakey = 'fa-unlink';
@@ -3178,61 +3178,61 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
// Img for type of views
elseif (in_array($pictowithouttext, array('object_list', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser'))) {
$fakey = 'imgforviewmode fa-'.$arrayconvpictotofa[$pictowithouttext];
- $marginleftonlyshort=0;
+ $marginleftonlyshort = 0;
}
- elseif (! empty($arrayconvpictotofa[$pictowithouttext]))
+ elseif (!empty($arrayconvpictotofa[$pictowithouttext]))
{
$fakey = 'fa-'.$arrayconvpictotofa[$pictowithouttext];
//$facolor = '#444';
- $marginleftonlyshort=0;
+ $marginleftonlyshort = 0;
}
else {
$fakey = 'fa-'.$pictowithouttext;
//$facolor = '#444';
- $marginleftonlyshort=0;
+ $marginleftonlyshort = 0;
}
//this snippet only needed since function img_edit accepts only one additional parameter: no separate one for css only.
//class/style need to be extracted to avoid duplicate class/style validation errors when $moreatt is added to the end of the attributes
- $reg=array();
+ $reg = array();
if (preg_match('/class="([^"]+)"/', $moreatt, $reg)) {
- $morecss .= ($morecss ? ' ' : '') . $reg[1];
+ $morecss .= ($morecss ? ' ' : '').$reg[1];
$moreatt = str_replace('class="'.$reg[1].'"', '', $moreatt);
}
if (preg_match('/style="([^"]+)"/', $moreatt, $reg)) {
- $morestyle = ' '. $reg[1];
+ $morestyle = ' '.$reg[1];
$moreatt = str_replace('style="'.$reg[1].'"', '', $moreatt);
}
- $moreatt=trim($moreatt);
+ $moreatt = trim($moreatt);
- $enabledisablehtml = '';
- if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
- $enabledisablehtml.= $titlealt;
+ $enabledisablehtml = '';
+ if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
+ $enabledisablehtml .= $titlealt;
}
- $enabledisablehtml.= '';
+ $enabledisablehtml .= '';
return $enabledisablehtml;
}
- if (! empty($conf->global->MAIN_OVERWRITE_THEME_PATH)) {
- $path = $conf->global->MAIN_OVERWRITE_THEME_PATH.'/theme/'.$theme; // If the theme does not have the same name as the module
+ if (!empty($conf->global->MAIN_OVERWRITE_THEME_PATH)) {
+ $path = $conf->global->MAIN_OVERWRITE_THEME_PATH.'/theme/'.$theme; // If the theme does not have the same name as the module
}
- elseif (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) {
- $path = $conf->global->MAIN_OVERWRITE_THEME_RES.'/theme/'.$conf->global->MAIN_OVERWRITE_THEME_RES; // To allow an external module to overwrite image resources whatever is activated theme
+ elseif (!empty($conf->global->MAIN_OVERWRITE_THEME_RES)) {
+ $path = $conf->global->MAIN_OVERWRITE_THEME_RES.'/theme/'.$conf->global->MAIN_OVERWRITE_THEME_RES; // To allow an external module to overwrite image resources whatever is activated theme
}
- elseif (! empty($conf->modules_parts['theme']) && array_key_exists($theme, $conf->modules_parts['theme'])) {
- $path = $theme.'/theme/'.$theme; // If the theme have the same name as the module
+ elseif (!empty($conf->modules_parts['theme']) && array_key_exists($theme, $conf->modules_parts['theme'])) {
+ $path = $theme.'/theme/'.$theme; // If the theme have the same name as the module
}
// If we ask an image into $url/$mymodule/img (instead of default path)
if (preg_match('/^([^@]+)@([^@]+)$/i', $picto, $regs)) {
$picto = $regs[1];
- $path = $regs[2]; // $path is $mymodule
+ $path = $regs[2]; // $path is $mymodule
}
// Clean parameters
- if (! preg_match('/(\.png|\.gif|\.svg)$/i', $picto)) {
+ if (!preg_match('/(\.png|\.gif|\.svg)$/i', $picto)) {
$picto .= '.png';
}
// If alt path are defined, define url where img file is, according to physical path
@@ -3256,7 +3256,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
return $fullpathpicto;
}
// tag title is used for tooltip on , tag alt can be used with very simple text on image for blind people
- return '