From a305b7d55501a266dc734c5e19cbd55c0c6bcaaa Mon Sep 17 00:00:00 2001 From: simnandez Date: Mon, 2 Jul 2012 17:36:41 +0200 Subject: [PATCH 01/13] Trad: Add missing translations --- htdocs/langs/ca_ES/contracts.lang | 1 + htdocs/langs/ca_ES/install.lang | 6 +++++- htdocs/langs/es_ES/contracts.lang | 1 + htdocs/langs/es_ES/install.lang | 4 ++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/ca_ES/contracts.lang b/htdocs/langs/ca_ES/contracts.lang index 36a951891cb..08af34a7784 100644 --- a/htdocs/langs/ca_ES/contracts.lang +++ b/htdocs/langs/ca_ES/contracts.lang @@ -39,6 +39,7 @@ ConfirmCloseService=Esteu segur de voler tancar aquest servei? ValidateAContract=Validar un contracte ActivateService=Activar el servei ConfirmActivateService=Esteu segur de voler activar aquest servei en data %s? +RefContract=Ref. contracte DateContract=Data contracte DateServiceActivate=Data activació del servei DateServiceUnactivate=Data desactivació del servei diff --git a/htdocs/langs/ca_ES/install.lang b/htdocs/langs/ca_ES/install.lang index 02e7366f001..02e98c0a52c 100644 --- a/htdocs/langs/ca_ES/install.lang +++ b/htdocs/langs/ca_ES/install.lang @@ -155,7 +155,11 @@ MigrationShippingDelivery2=Actualització de les dades expedicions 2 MigrationFinished=Acabada l'actualització LastStepDesc=Últim pas: Indiqueu aquí el compte i la contrasenya del primer usuari que fareu servir per connectar-se a l'aplicació. No perdi aquests identificadors, és el compte que permet administrar la resta. ActivateModule=Activació del mòdul %s -#########= +LinkedElementsInvalidDeleted=han estat eliminats %s enllaços invàlids +NothingToDelete=No s'ha trobat enllaços invàlids +SourceType=Origen +TargetType=Destí +######### # upgrade= MigrationFixData=Correcció de dades desnormalitzades MigrationOrder=Migració de dades de les comandes clients diff --git a/htdocs/langs/es_ES/contracts.lang b/htdocs/langs/es_ES/contracts.lang index 0509a2951ae..e81f133a31f 100644 --- a/htdocs/langs/es_ES/contracts.lang +++ b/htdocs/langs/es_ES/contracts.lang @@ -39,6 +39,7 @@ ConfirmCloseService=¿Está seguro de querer cerrar este servicio? ValidateAContract=Validar un contrato ActivateService=Activar el servicio ConfirmActivateService=¿Está seguro de querer activar este servicio en fecha %s? +RefContract=Ref. contrato DateContract=Fecha contrato DateServiceActivate=Fecha activación del servicio DateServiceUnactivate=Fecha desactivación del servicio diff --git a/htdocs/langs/es_ES/install.lang b/htdocs/langs/es_ES/install.lang index 3e344427cca..52882e9b7c5 100644 --- a/htdocs/langs/es_ES/install.lang +++ b/htdocs/langs/es_ES/install.lang @@ -155,6 +155,10 @@ MigrationShippingDelivery2=Actualización de los datos de expediciones 2 MigrationFinished=Actualización terminada LastStepDesc=Último paso: Indique aquí la cuenta y la contraseña del primer usuario que usted utilizará para conectarse a la aplicación. No pierda estos identificadores, es la cuenta que permite administrar el resto. ActivateModule=Activación del módulo %s +LinkedElementsInvalidDeleted=han sido eliminados %s enlaces inválidos +NothingToDelete=No se han encontrado enlaces inválidos +SourceType=Origen +TargetType=Destino ######### # upgrade MigrationFixData=Corrección de datos desnormalizados From 41144643eb74dc532312086f767a2a3a799f7edc Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 10 Jul 2012 11:45:38 +0200 Subject: [PATCH 02/13] Fix: avoid warning php strict mode --- htdocs/admin/const.php | 22 ++++-- htdocs/admin/dict.php | 88 +++++++++++----------- htdocs/admin/mails.php | 91 +++++++++++++---------- htdocs/admin/user.php | 10 +-- htdocs/core/class/html.formmail.class.php | 50 ++++++------- htdocs/core/lib/functions.lib.php | 2 +- 6 files changed, 139 insertions(+), 124 deletions(-) diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index b7a69dddd26..783d6916c7b 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -30,10 +30,16 @@ $langs->load("admin"); if (! $user->admin) accessforbidden(); -$action = GETPOST('action'); -$debug = GETPOST('debug'); +$rowid=GETPOST('rowid','int'); +$entity=GETPOST('entity','int'); +$action=GETPOST('action'); +$update=GETPOST('update'); +$delete=GETPOST('delete'); +$debug=GETPOST('debug'); +$consts=GETPOST('const'); $typeconst=array('yesno','texte','chaine'); +$mesg=''; /* @@ -64,9 +70,9 @@ if ($action == 'add') } } -if (($_POST["const"] && isset($_POST["update"]) && $_POST["update"] == $langs->trans("Modify"))) +if (! empty($consts) && $update == $langs->trans("Modify")) { - foreach($_POST["const"] as $const) + foreach($consts as $const) { if ($const["check"]) { @@ -79,9 +85,9 @@ if (($_POST["const"] && isset($_POST["update"]) && $_POST["update"] == $langs->t } // Delete several lines at once -if ($_POST["const"] && $_POST["delete"] && $_POST["delete"] == $langs->trans("Delete")) +if (! empty($consts) && $delete == $langs->trans("Delete")) { - foreach($_POST["const"] as $const) + foreach($consts as $const) { if ($const["check"]) // Is checkbox checked { @@ -96,7 +102,7 @@ if ($_POST["const"] && $_POST["delete"] && $_POST["delete"] == $langs->trans("De // Delete line from delete picto if ($action == 'delete') { - if (dolibarr_del_const($db, $_GET["rowid"], $_GET["entity"]) < 0) + if (dolibarr_del_const($db, $rowid, $entity) < 0) { dol_print_error($db); } @@ -136,7 +142,7 @@ print_fiche_titre($langs->trans("OtherSetup"),'','setup'); print $langs->trans("ConstDesc")."
\n"; print "
\n"; -if ($mesg) print $mesg; +dol_htmloutput_mesg($mesg); print ''; print ''; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 71ec16150b6..13864a37183 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004 Rodolphe Quiedeville * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2011 Juanjo Menent * Copyright (C) 2011 Philippe Grand * Copyright (C) 2011 Remy Younes @@ -279,24 +279,24 @@ $tabcond[1] = true; $tabcond[2] = true; $tabcond[3] = true; $tabcond[4] = true; -$tabcond[5] = $conf->societe->enabled||$conf->adherent->enabled; -$tabcond[6] = $conf->agenda->enabled; -$tabcond[7] = $conf->tax->enabled; -$tabcond[8] = $conf->societe->enabled; +$tabcond[5] = (! empty($conf->societe->enabled) || ! empty($conf->adherent->enabled)); +$tabcond[6] = ! empty($conf->agenda->enabled); +$tabcond[7] = ! empty($conf->tax->enabled); +$tabcond[8] = ! empty($conf->societe->enabled); $tabcond[9] = true; $tabcond[10]= true; $tabcond[11]= true; -$tabcond[12]= $conf->commande->enabled||$conf->propal->enabled||$conf->facture->enabled||$conf->fournisseur->enabled; -$tabcond[13]= $conf->commande->enabled||$conf->propal->enabled||$conf->facture->enabled||$conf->fournisseur->enabled; -$tabcond[14]= $conf->product->enabled&&$conf->ecotax->enabled; +$tabcond[12]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled)); +$tabcond[13]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled)); +$tabcond[14]= (! empty($conf->product->enabled) && ! empty($conf->ecotax->enabled)); $tabcond[15]= true; -$tabcond[16]= $conf->societe->enabled && empty($conf->global->SOCIETE_DISABLE_PROSPECTS); -$tabcond[17]= $conf->deplacement->enabled; -$tabcond[18]= $conf->expedition->enabled; -$tabcond[19]= $conf->societe->enabled; -$tabcond[20]= $conf->fournisseur->enabled; -$tabcond[21]= $conf->propal->enabled; -$tabcond[22]= $conf->commande->enabled||$conf->propal->enabled; +$tabcond[16]= (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)); +$tabcond[17]= ! empty($conf->deplacement->enabled); +$tabcond[18]= ! empty($conf->expedition->enabled); +$tabcond[19]= ! empty($conf->societe->enabled); +$tabcond[20]= ! empty($conf->fournisseur->enabled); +$tabcond[21]= ! empty($conf->propal->enabled); +$tabcond[22]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled)); // List of help for fields $tabhelp=array(); @@ -347,7 +347,7 @@ if ($id == 11) "facture"=>$langs->trans("Bill"), "facture_fourn"=>$langs->trans("SupplierBill"), "fichinter"=>$langs->trans("InterventionCard")); - if ($conf->global->MAIN_SUPPORT_CONTACT_TYPE_FOR_THIRDPARTIES) $elementList["societe"]=$langs->trans("ThirdParty"); + if (! empty($conf->global->MAIN_SUPPORT_CONTACT_TYPE_FOR_THIRDPARTIES)) $elementList["societe"]=$langs->trans("ThirdParty"); $sourceList = array("internal"=>$langs->trans("Internal"), "external"=>$langs->trans("External")); } @@ -356,7 +356,7 @@ $msg=''; // Actions ajout ou modification d'une entree dans un dictionnaire de donnee -if ($_POST["actionadd"] || $_POST["actionmodify"]) +if (GETPOST('actionadd') || GETPOST('actionmodify')) { $listfield=explode(',',$tabfield[$id]); $listfieldinsert=explode(',',$tabfieldinsert[$id]); @@ -401,7 +401,7 @@ if ($_POST["actionadd"] || $_POST["actionmodify"]) } // Si verif ok et action add, on ajoute la ligne - if ($ok && $_POST["actionadd"]) + if ($ok && GETPOST('actionadd')) { if ($tabrowid[$id]) { @@ -466,7 +466,7 @@ if ($_POST["actionadd"] || $_POST["actionmodify"]) } // Si verif ok et action modify, on modifie la ligne - if ($ok && $_POST["actionmodify"]) + if ($ok && GETPOST('actionmodify')) { if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } else { $rowidcol="rowid"; } @@ -509,7 +509,7 @@ if ($_POST["actionadd"] || $_POST["actionmodify"]) $_GET["id"]=$_POST["id"]; // Force affichage dictionnaire en cours d'edition } -if ($_POST["actioncancel"]) +if (GETPOST('actioncancel')) { $_GET["id"]=$_POST["id"]; // Force affichage dictionnaire en cours d'edition } @@ -619,7 +619,7 @@ if ($id) // Complete requete recherche valeurs avec critere de tri $sql=$tabsql[$id]; - if ($_GET["sortfield"]) + if (GETPOST('sortfield')) { // If sort order is "pays", we use pays_code instead if ($_GET["sortfield"] == 'pays') $_GET["sortfield"]='pays_code'; @@ -687,7 +687,7 @@ if ($id) if ($valuetoshow != '') { print ''; @@ -704,7 +704,7 @@ if ($id) $obj=''; // If data was already input, we define them in obj to populate input fields. - if ($_POST["actionadd"]) + if (GETPOST('actionadd')) { foreach ($fieldlist as $key=>$val) { @@ -795,7 +795,7 @@ if ($id) //print_r($obj); print ""; - if ($action == 'edit' && ($rowid == ($obj->rowid?$obj->rowid:$obj->code))) + if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code))) { print ''; print ''; @@ -810,7 +810,7 @@ if ($id) if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id]); - print ''; } else @@ -866,7 +866,7 @@ if ($id) $key=$langs->trans("Action".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "Action".strtoupper($obj->code))?$key:$obj->$fieldlist[$field]; } - else if ($fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_currencies') { + else if (! empty($obj->code_iso) && $fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_currencies') { $key=$langs->trans("Currency".strtoupper($obj->code_iso)); $valuetoshow=($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso))?$key:$obj->$fieldlist[$field]; } @@ -926,18 +926,18 @@ if ($id) if (isset($obj->code) && ($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) $iserasable=0; if (isset($obj->code) && $obj->code == 'RECEP') $iserasable=0; if (isset($obj->code) && $obj->code == 'EF0') $iserasable=0; - if ($obj->type && $obj->type == 'system') $iserasable=0; + if (isset($obj->type) && $obj->type == 'system') $iserasable=0; - if ($iserasable) print ''.$actl[$obj->active].''; + if ($iserasable) print ''.$actl[$obj->active].''; else print $langs->trans("AlwaysActive"); print ""; // Modify link - if ($iserasable) print ''; + if ($iserasable) print ''; else print ''; // Delete link - if ($iserasable) print ''; + if ($iserasable) print ''; else print ''; print "\n"; @@ -971,7 +971,7 @@ else foreach ($taborder as $i) { - if ($tabname[$i] && empty($tabcond[$i])) continue; + if (isset($tabname[$i]) && empty($tabcond[$i])) continue; if ($i) { @@ -1011,9 +1011,9 @@ else print '
'; -$db->close(); llxFooter(); +$db->close(); /** @@ -1039,7 +1039,7 @@ function fieldList($fieldlist,$obj='',$tabname='') if ($fieldlist[$field] == 'pays') { if (in_array('region_id',$fieldlist)) { print ''; continue; } // For region page, we do not show the country input print ''; } elseif ($fieldlist[$field] == 'pays_id') { @@ -1052,7 +1052,7 @@ function fieldList($fieldlist,$obj='',$tabname='') print ''; } elseif ($fieldlist[$field] == 'region_id') { - $region_id = $obj->$fieldlist[$field]?$obj->$fieldlist[$field]:0; + $region_id = (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:0); print ''; } elseif ($fieldlist[$field] == 'lang') { @@ -1064,14 +1064,14 @@ function fieldList($fieldlist,$obj='',$tabname='') elseif ($fieldlist[$field] == 'element') { print ''; } // La source de l'element (pour les type de contact).' elseif ($fieldlist[$field] == 'source') { print ''; } elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX."c_actioncomm") @@ -1082,30 +1082,30 @@ function fieldList($fieldlist,$obj='',$tabname='') } elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'fdm') { print ''; } elseif (in_array($fieldlist[$field],array('nbjour','decalage','taux','localtax1','localtax2'))) { - print ''; + print ''; } elseif ($fieldlist[$field] == 'libelle_facture') { - print ''; + print ''; } elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) { - print ''; + print ''; } - elseif ($fieldlist[$field] == 'code') { - print ''; + elseif ($fieldlist[$field] == 'code' && isset($obj->$fieldlist[$field])) { + print ''; } elseif ($fieldlist[$field]=='unit') { print ''; } else { print ''; } } diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 29c1912c696..897e91a8c0a 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -1,6 +1,6 @@ - * Copyright (C) 2009-2011 Regis Houssin + * Copyright (C) 2009-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,7 +32,7 @@ $langs->load("mails"); $langs->load("other"); $langs->load("errors"); -if (!$user->admin) accessforbidden(); +if (! $user->admin) accessforbidden(); $substitutionarrayfortest=array( '__LOGIN__' => $user->login, @@ -46,6 +46,7 @@ $substitutionarrayfortest=array( complete_substitutions_array($substitutionarrayfortest, $langs); $action=GETPOST('action'); +$message=''; /* @@ -75,7 +76,7 @@ if ($action == 'update' && empty($_POST["cancel"])) /* * Add file in email form */ -if ($_POST['addfile'] || $_POST['addfilehtml']) +if (GETPOST('addfile') || GETPOST('addfilehtml')) { require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); @@ -163,7 +164,7 @@ if (! empty($_POST['removedfile']) || ! empty($_POST['removedfilehtml'])) /* * Cancel */ -if (($action == 'send' || $action == 'sendhtml') && $_POST['cancel']) +if (($action == 'send' || $action == 'sendhtml') && GETPOST('cancel')) { $message=''; } @@ -171,7 +172,7 @@ if (($action == 'send' || $action == 'sendhtml') && $_POST['cancel']) /* * Send mail */ -if (($action == 'send' || $action == 'sendhtml') && ! $_POST['addfile'] && ! $_POST['addfilehtml'] && ! $_POST["removedfile"] && ! $_POST['cancel']) +if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GETPOST('addfilehtml') && ! GETPOST('removedfile') && ! GETPOST('cancel')) { $error=0; @@ -378,22 +379,23 @@ if ($action == 'edit') } else { + $mainserver = (! empty($conf->global->MAIN_MAIL_SMTP_SERVER)?$conf->global->MAIN_MAIL_SMTP_SERVER:''); $smtpserver = ini_get('SMTP')?ini_get('SMTP'):$langs->transnoentities("Undefined"); if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike"); else print $langs->trans("MAIN_MAIL_SMTP_SERVER",$smtpserver); print ''; @@ -409,60 +411,63 @@ if ($action == 'edit') } else { + $mainport = (! empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : ''); $smtpport = ini_get('smtp_port')?ini_get('smtp_port'):$langs->transnoentities("Undefined"); if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike"); else print $langs->trans("MAIN_MAIL_SMTP_PORT",$smtpport); print ''; // ID - if ($conf->use_javascript_ajax || $conf->global->MAIN_MAIL_SENDMODE == 'smtps') + if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps')) { $var=!$var; + $mainstmpid=(! empty($conf->global->MAIN_MAIL_SMTPS_ID)?$conf->global->MAIN_MAIL_SMTPS_ID:''); print ''; } // PW - if ($conf->use_javascript_ajax || $conf->global->MAIN_MAIL_SENDMODE == 'smtps') + if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps')) { $var=!$var; + $mainsmtppw=(! empty($conf->global->MAIN_MAIL_SMTPS_PW)?$conf->global->MAIN_MAIL_SMTPS_PW:''); print ''; } @@ -470,11 +475,11 @@ if ($action == 'edit') // TLS $var=!$var; print ''; - print ''; // From $var=!$var; print ''; - print ''; // Autocopy to $var=!$var; print ''; - print ''; print '
'; - if (preg_match('/http:/i',$tabhelp[$id][$value])) print ''.$valuetoshow.''; + if (! empty($tabhelp[$id][$value]) && preg_match('/http:/i',$tabhelp[$id][$value])) print ''.$valuetoshow.''; else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]); else print $valuetoshow; print '
 '; + print ' '; print ' rowid?$obj->rowid:$obj->code).'">'.img_edit().'rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'">'.img_edit().' '.img_delete().''.img_delete().' 
 '; - print $form->select_country(($obj->pays_code?$obj->pays_code:$obj->pays),'pays'); + print $form->select_country((! empty($obj->pays_code)?$obj->pays_code:(! empty($obj->pays)?$obj->pays:'')),'pays'); print ''; - print $form->selectarray('element', $elementList,$obj->$fieldlist[$field]); + print $form->selectarray('element', $elementList,(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'')); print ''; - print $form->selectarray('source', $sourceList,$obj->$fieldlist[$field]); + print $form->selectarray('source', $sourceList,(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'')); print ''; - print $form->selectyesno($fieldlist[$field],$obj->$fieldlist[$field],1); + print $form->selectyesno($fieldlist[$field],(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''),1); print ''; - print $form->selectarray('unit',array('mm','cm','point','inch'),$obj->$fieldlist[$field],0,0,1); + print $form->selectarray('unit',array('mm','cm','point','inch'),(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''),0,0,1); print ''; - print ''; + print ''; print ''; // SuperAdministrator access only - if ((empty($conf->global->MAIN_MODULE_MULTICOMPANY)) || ($user->admin && !$user->entity)) + if (empty($conf->multicompany->enabled) || ($user->admin && ! $user->entity)) { - print ''; - print ''; + print ''; + print ''; } else { - $text = $conf->global->MAIN_MAIL_SMTP_SERVER ? $conf->global->MAIN_MAIL_SMTP_SERVER : $smtpserver; + $text = ! empty($mainserver) ? $mainserver : $smtpserver; $htmltext = $langs->trans("ContactSuperAdminForChange"); print $form->textwithpicto($text,$htmltext,1,'superadmin'); - print ''; + print ''; } } print '
'; // SuperAdministrator access only - if ((empty($conf->global->MAIN_MODULE_MULTICOMPANY)) || ($user->admin && !$user->entity)) + if (empty($conf->multicompany->enabled) || ($user->admin && ! $user->entity)) { - print ''; - print ''; + print ''; + print ''; } else { - $text = $conf->global->MAIN_MAIL_SMTP_PORT ? $conf->global->MAIN_MAIL_SMTP_PORT : $smtpport; + $text = (! empty($mainport) ? $mainport : $smtpport); $htmltext = $langs->trans("ContactSuperAdminForChange"); print $form->textwithpicto($text,$htmltext,1,'superadmin'); - print ''; + print ''; } } print '
'.$langs->trans("MAIN_MAIL_SMTPS_ID").''; // SuperAdministrator access only - if ((empty($conf->global->MAIN_MODULE_MULTICOMPANY)) || ($user->admin && !$user->entity)) + if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) { - print ''; + print ''; } else { $htmltext = $langs->trans("ContactSuperAdminForChange"); print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_ID,$htmltext,1,'superadmin'); - print ''; + print ''; } print '
'.$langs->trans("MAIN_MAIL_SMTPS_PW").''; // SuperAdministrator access only - if ((empty($conf->global->MAIN_MODULE_MULTICOMPANY)) || ($user->admin && !$user->entity)) + if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) { - print ''; + print ''; } else { $htmltext = $langs->trans("ContactSuperAdminForChange"); print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_PW,$htmltext,1,'superadmin'); - print ''; + print ''; } print '
'.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; - if ($conf->use_javascript_ajax || $conf->global->MAIN_MAIL_SENDMODE == 'smtps') + if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps')) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_TLS',$conf->global->MAIN_MAIL_EMAIL_TLS,1); + print $form->selectyesno('MAIN_MAIL_EMAIL_TLS',(! empty($conf->global->MAIN_MAIL_EMAIL_TLS)?$conf->global->MAIN_MAIL_EMAIL_TLS:0),1); } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -488,19 +493,19 @@ if ($action == 'edit') // From $var=!$var; print '
'.$langs->trans("MAIN_MAIL_EMAIL_FROM",ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).'
'.$langs->trans("MAIN_MAIL_ERRORS_TO").'
'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'
'; @@ -538,36 +543,36 @@ else // Server $var=!$var; - if ($linuxlike && $conf->global->MAIN_MAIL_SENDMODE == 'mail') + if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail')) { print ''.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").''; } else { - print ''.$langs->trans("MAIN_MAIL_SMTP_SERVER",ini_get('SMTP')?ini_get('SMTP'):$langs->transnoentities("Undefined")).''.$conf->global->MAIN_MAIL_SMTP_SERVER.''; + print ''.$langs->trans("MAIN_MAIL_SMTP_SERVER",ini_get('SMTP')?ini_get('SMTP'):$langs->transnoentities("Undefined")).''.(! empty($conf->global->MAIN_MAIL_SMTP_SERVER)?$conf->global->MAIN_MAIL_SMTP_SERVER:'').''; } // Port $var=!$var; - if ($linuxlike && $conf->global->MAIN_MAIL_SENDMODE == 'mail') + if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail')) { print ''.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").''; } else { - print ''.$langs->trans("MAIN_MAIL_SMTP_PORT",ini_get('smtp_port')?ini_get('smtp_port'):$langs->transnoentities("Undefined")).''.$conf->global->MAIN_MAIL_SMTP_PORT.''; + print ''.$langs->trans("MAIN_MAIL_SMTP_PORT",ini_get('smtp_port')?ini_get('smtp_port'):$langs->transnoentities("Undefined")).''.(! empty($conf->global->MAIN_MAIL_SMTP_PORT)?$conf->global->MAIN_MAIL_SMTP_PORT:'').''; } // SMTPS ID $var=!$var; - if ($conf->global->MAIN_MAIL_SENDMODE == 'smtps') + if (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps') { print ''.$langs->trans("MAIN_MAIL_SMTPS_ID").''.$conf->global->MAIN_MAIL_SMTPS_ID.''; } // SMTPS PW $var=!$var; - if ($conf->global->MAIN_MAIL_SENDMODE == 'smtps') + if (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps') { print ''.$langs->trans("MAIN_MAIL_SMTPS_PW").''.preg_replace('/./','*',$conf->global->MAIN_MAIL_SMTPS_PW).''; } @@ -575,7 +580,7 @@ else // TLS $var=!$var; print ''.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; - if ($conf->global->MAIN_MAIL_SENDMODE == 'smtps') + if (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps') { if (function_exists('openssl_open')) { @@ -594,21 +599,29 @@ else $var=!$var; print ''.$langs->trans("MAIN_MAIL_EMAIL_FROM",ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).''; print ''.$conf->global->MAIN_MAIL_EMAIL_FROM; - if (!empty($conf->global->MAIN_MAIL_EMAIL_FROM) && ! isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("ErrorBadEMail")); + if (! empty($conf->global->MAIN_MAIL_EMAIL_FROM) && ! isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("ErrorBadEMail")); print ''; // Errors To $var=!$var; print ''.$langs->trans("MAIN_MAIL_ERRORS_TO").''; print ''.$conf->global->MAIN_MAIL_ERRORS_TO; - if (!empty($conf->global->MAIN_MAIL_ERRORS_TO) && ! isValidEmail($conf->global->MAIN_MAIL_ERRORS_TO)) print img_warning($langs->trans("ErrorBadEMail")); + if (! empty($conf->global->MAIN_MAIL_ERRORS_TO) && ! isValidEmail($conf->global->MAIN_MAIL_ERRORS_TO)) print img_warning($langs->trans("ErrorBadEMail")); print ''; // Autocopy to $var=!$var; print ''.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").''; - print ''.$conf->global->MAIN_MAIL_AUTOCOPY_TO; - if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO) && ! isValidEmail($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print img_warning($langs->trans("ErrorBadEMail")); + print ''; + if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) + { + print $conf->global->MAIN_MAIL_AUTOCOPY_TO; + if (! isValidEmail($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print img_warning($langs->trans("ErrorBadEMail")); + } + else + { + print ' '; + } print ''; print ''; diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index c23310571e9..aebb05abed9 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -33,8 +33,7 @@ $langs->load("admin"); $langs->load("members"); $langs->load("users"); -if (!$user->admin) -accessforbidden(); +if (! $user->admin) accessforbidden(); /* * Action @@ -115,11 +114,8 @@ else print ''; print ''; -print '
'; - -$db->close(); - -print '
'; +print '

'; llxFooter(); +$db->close(); ?> \ No newline at end of file diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index b31d36406f5..55d7628ab19 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2011 Juanjo Menent * * This program is free software; you can redistribute it and/or modify @@ -245,7 +245,7 @@ class FormMail $out.= ''."\n"; // Substitution array - if ($this->withsubstit) + if (! empty($this->withsubstit)) { $out.= ''; $out.= ''; @@ -549,7 +549,7 @@ class FormMail } // Message - if ($this->withbody) + if (! empty($this->withbody)) { $defaultmessage=""; @@ -617,7 +617,7 @@ class FormMail $out.= "\n"; } - if ($this->withform) + if (! empty($this->withform)) { $out.= ''; print ''; + print ''; print ''; print ''; print ''; + print ''; print "\n"; print ''; print ''; + print ''; print "\n"; print '
'; $help=""; @@ -258,9 +258,9 @@ class FormMail } // From - if ($this->withfrom) + if (! empty($this->withfrom)) { - if ($this->withfromreadonly) + if (! empty($this->withfromreadonly)) { $out.= ''; $out.= ''; @@ -302,7 +302,7 @@ class FormMail } // Replyto - if ($this->withreplyto) + if (! empty($this->withreplyto)) { if ($this->withreplytoreadonly) { @@ -314,7 +314,7 @@ class FormMail } // Errorsto - if ($this->witherrorsto) + if (! empty($this->witherrorsto)) { //if (! $this->errorstomail) $this->errorstomail=$this->frommail; $errorstomail = (! empty($conf->global->MAIN_MAIL_ERRORS_TO) ? $conf->global->MAIN_MAIL_ERRORS_TO : $this->errorstomail); @@ -334,7 +334,7 @@ class FormMail } // To - if ($this->withto || is_array($this->withto)) + if (! empty($this->withto) || is_array($this->withto)) { $out.= '
'; if ($this->withtofree) $out.= $form->textwithpicto($langs->trans("MailTo"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients")); @@ -375,16 +375,16 @@ class FormMail } else { - if ($this->withtofree) + if (! empty($this->withtofree)) { $out.= 'withto) :"").'" />'; } - if (is_array($this->withto)) + if (! empty($this->withto) && is_array($this->withto)) { - if ($this->withtofree) $out.= " ".$langs->trans("or")." "; + if (! empty($this->withtofree)) $out.= " ".$langs->trans("or")." "; $out.= $form->selectarray("receiver", $this->withto, GETPOST("receiver"), 1); } - if ($this->withtosocid > 0) // deprecated. TODO Remove this. Instead, fill withto with array before calling method. + if (isset($this->withtosocid) && $this->withtosocid > 0) // deprecated. TODO Remove this. Instead, fill withto with array before calling method. { $liste=array(); $soc=new Societe($this->db); @@ -401,7 +401,7 @@ class FormMail } // CC - if ($this->withtocc || is_array($this->withtocc)) + if (! empty($this->withtocc) || is_array($this->withtocc)) { $out.= '
'; $out.= $form->textwithpicto($langs->trans("MailCC"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients")); @@ -413,12 +413,12 @@ class FormMail else { $out.= 'withtocc) : (isset($_POST["sendtocc"])?$_POST["sendtocc"]:"") ).'" />'; - if (is_array($this->withto)) + if (! empty($this->withto) && is_array($this->withto)) { $out.= " ".$langs->trans("or")." "; $out.= $form->selectarray("receivercc", $this->withto, GETPOST("receivercc"), 1); } - if ($this->withtoccsocid > 0) // deprecated. TODO Remove this. Instead, fill withto with array before calling method. + if (! empty($this->withtoccsocid) && $this->withtoccsocid > 0) // deprecated. TODO Remove this. Instead, fill withto with array before calling method. { $liste=array(); $soc=new Societe($this->db); @@ -435,24 +435,24 @@ class FormMail } // CCC - if ($this->withtoccc || is_array($this->withtoccc)) + if (! empty($this->withtoccc) || is_array($this->withtoccc)) { $out.= '
'; $out.= $form->textwithpicto($langs->trans("MailCCC"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients")); $out.= ''; - if ($this->withtocccreadonly) + if (! empty($this->withtocccreadonly)) { $out.= (! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))?$this->withtoccc:""; } else { $out.= 'withtoccc) : (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:"") ).'" />'; - if (is_array($this->withto)) + if (! empty($this->withto) && is_array($this->withto)) { $out.= " ".$langs->trans("or")." "; $out.= $form->selectarray("receiverccc", $this->withto, GETPOST("receiverccc"), 1); } - if ($this->withtocccsocid > 0) // deprecated. TODO Remove this. Instead, fill withto with array before calling method. + if (! empty($this->withtocccsocid) && $this->withtocccsocid > 0) // deprecated. TODO Remove this. Instead, fill withto with array before calling method. { $liste=array(); $soc=new Societe($this->db); @@ -470,11 +470,11 @@ class FormMail } // Ask delivery receipt - if ($this->withdeliveryreceipt) + if (! empty($this->withdeliveryreceipt)) { $out.= '
'.$langs->trans("DeliveryReceipt").''; - if ($this->withdeliveryreceiptreadonly) + if (! empty($this->withdeliveryreceiptreadonly)) { $out.= yn($this->withdeliveryreceipt); } @@ -487,7 +487,7 @@ class FormMail } // Topic - if ($this->withtopic) + if (! empty($this->withtopic)) { $this->withtopic=make_substitutions($this->withtopic,$this->substit); @@ -507,7 +507,7 @@ class FormMail } // Attached files - if ($this->withfile) + if (! empty($this->withfile)) { $out.= '
'.$langs->trans("MailFile").'
'; $out.= 'withform) $out.= ''."\n"; + if (! empty($this->withform)) $out.= ''."\n"; $out.= "\n"; return $out; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4503d8e9192..11a335a39b2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4024,7 +4024,7 @@ function getCurrencySymbol($currency_code) $form->load_cache_currencies(); - if (function_exists("mb_convert_encoding") && is_array($form->cache_currencies[$currency_code]['unicode']) && ! empty($form->cache_currencies[$currency_code]['unicode'])) + if (function_exists("mb_convert_encoding") && isset($form->cache_currencies[$currency_code]) && is_array($form->cache_currencies[$currency_code]['unicode']) && ! empty($form->cache_currencies[$currency_code]['unicode'])) { foreach($form->cache_currencies[$currency_code]['unicode'] as $unicode) { From 72e21e3640dac8ccff86c190126d3a03e298c1ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jul 2012 12:57:00 +0200 Subject: [PATCH 03/13] Add address format --- dev/iso-normes/address_format.txt | 1 + 1 file changed, 1 insertion(+) create mode 100755 dev/iso-normes/address_format.txt diff --git a/dev/iso-normes/address_format.txt b/dev/iso-normes/address_format.txt new file mode 100755 index 00000000000..cc3b23285c8 --- /dev/null +++ b/dev/iso-normes/address_format.txt @@ -0,0 +1 @@ +http://bitboost.com/ref/international-address-formats.html#Formats \ No newline at end of file From 226caf0152c5c8e691a634f4e8928d28254bab34 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 10 Jul 2012 13:20:53 +0200 Subject: [PATCH 04/13] Fix: and again, and again, and again... (strict mode) --- htdocs/contact/class/contact.class.php | 3 +- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/lib/functions.lib.php | 13 +- htdocs/core/lib/usergroups.lib.php | 10 +- htdocs/core/modules/DolibarrModules.class.php | 2 +- htdocs/user/class/usergroup.class.php | 4 +- htdocs/user/clicktodial.php | 21 +- htdocs/user/fiche.php | 195 +++++++++--------- htdocs/user/group/fiche.php | 34 +-- htdocs/user/group/index.php | 8 +- htdocs/user/group/perms.php | 2 +- htdocs/user/home.php | 8 +- htdocs/user/index.php | 9 +- htdocs/user/param_ihm.php | 30 +-- htdocs/user/perms.php | 9 +- 15 files changed, 177 insertions(+), 173 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 58356a5f386..d9b69e35fcf 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2002-2004 Rodolphe Quiedeville * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004-2010 Laurent Destailleur - * Copyright (C) 2005-2008 Regis Houssin + * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2008 Raphael Bertrand (Resultic) * @@ -534,7 +534,6 @@ class Contact extends CommonObject $this->mail = $obj->email; $this->birthday = $this->db->jdate($obj->birthday); - $this->birthday_alert = $obj->birthday_alert; $this->note = $obj->note; $this->default_lang = $obj->default_lang; $this->user_id = $obj->user_id; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 42a6119c611..044fbd74443 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3690,7 +3690,7 @@ class Form } else { - if ($conf->gravatar->enabled && $email) + if (! empty($conf->gravatar->enabled) && $email) { global $dolibarr_main_url_root; $ret.=''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 11a335a39b2..d81d3a3e006 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1177,19 +1177,22 @@ function dol_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$separ= if (! empty($addlink)) { - if ($conf->clicktodial->enabled) + if (! empty($conf->clicktodial->enabled)) { if (empty($user->clicktodial_loaded)) $user->fetch_clicktodial(); if (empty($conf->global->CLICKTODIAL_URL)) $urlmask='ErrorClickToDialModuleNotConfigured'; else $urlmask=$conf->global->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):''); // This line is for backward compatibility - $url = sprintf($urlmask, urlencode($phone), urlencode($user->clicktodial_poste), urlencode($user->clicktodial_login), urlencode($user->clicktodial_password)); + $url = sprintf($urlmask, urlencode($phone), $clicktodial_poste, $clicktodial_login, $clicktodial_password); // Thoose lines are for substitution - $substitarray=array('__PHONEFROM__'=>urlencode($user->clicktodial_poste), + $substitarray=array('__PHONEFROM__'=>$clicktodial_poste, '__PHONETO__'=>urlencode($phone), - '__LOGIN__'=>urlencode($user->clicktodial_login), - '__PASS__'=>urlencode($user->clicktodial_password)); + '__LOGIN__'=>$clicktodial_login, + '__PASS__'=>$clicktodial_password); $url = make_substitutions($url, $substitarray); $newphonesav=$newphone; $newphone ='ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE) + if (! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE)) { $langs->load("ldap"); $head[$h][0] = DOL_URL_ROOT.'/user/ldap.php?id='.$object->id; @@ -71,7 +71,7 @@ function user_prepare_head($object) $head[$h][2] = 'guisetup'; $h++; - if ($conf->clicktodial->enabled) + if (! empty($conf->clicktodial->enabled)) { $head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$object->id; $head[$h][1] = $langs->trans("ClickToDial"); @@ -85,7 +85,7 @@ function user_prepare_head($object) // $this->tabs = array('entity:-tabname:Title:@mymodule:conditiontoshow:/mymodule/mypage.php?id=__ID__'); to remove a tab complete_head_from_modules($conf,$langs,$object,$head,$h,'user'); - if (! $user->societe_id) + if (! empty($user->societe_id)) { $head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id; $head[$h][1] = $langs->trans("Note"); @@ -120,7 +120,7 @@ function group_prepare_head($object) $head[$h][2] = 'group'; $h++; - if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE) + if (! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_SYNCHRO_ACTIVE)) { $langs->load("ldap"); $head[$h][0] = DOL_URL_ROOT.'/user/group/ldap.php?id='.$object->id; @@ -166,7 +166,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) } $selected_theme=$conf->global->MAIN_THEME; - if (! empty($fuser)) $selected_theme=$fuser->conf->MAIN_THEME; + if (! empty($fuser->conf->MAIN_THEME)) $selected_theme=$fuser->conf->MAIN_THEME; $colspan=2; if ($foruserprofile) $colspan=4; diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 54386047e45..c98aff33804 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -900,7 +900,7 @@ abstract class DolibarrModules if ($resql) { $obj=$this->db->fetch_object($resql); - if ($obj->value) + if (! empty($obj->value) && ! empty($this->rights)) { // Si module actif foreach ($this->rights as $key => $value) diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 48b388bd971..4ec4d7fbed7 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -1,7 +1,7 @@ * Copyright (c) 2005-2012 Laurent Destailleur - * Copyright (c) 2005-2011 Regis Houssin + * Copyright (c) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -437,7 +437,7 @@ class UserGroup extends CommonObject return; } - if ($this->all_permissions_are_loaded) + if (! empty($this->all_permissions_are_loaded)) { // Si les permissions ont deja ete chargees, on quitte return; diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index 606dda9c780..bac1632013e 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -1,6 +1,7 @@ - * Copyright (C) 2005-2012 Laurent Destailleur +/* Copyright (C) 2005 Rodolphe Quiedeville + * Copyright (C) 2005-2012 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -133,17 +134,17 @@ if ($id) print '
ClickToDial '.$langs->trans("Login").''; - print '
ClickToDial '.$langs->trans("Password").''; - print '
ClickToDial '.$langs->trans("IdPhoneCaller").''; - print '
'; @@ -158,7 +159,7 @@ if ($id) print ''; - if ($user->admin) + if (! empty($user->admin)) { print "".''; print ''; } print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; print "\n"; print ''; - print ''; + print ''; print "
ClickToDial URL'; @@ -172,13 +173,13 @@ if ($id) print '
ClickToDial '.$langs->trans("Login").''.$fuser->clicktodial_login.''.(! empty($fuser->clicktodial_login)?$fuser->clicktodial_login:'').'
ClickToDial '.$langs->trans("Password").''.preg_replace('/./','*',$fuser->clicktodial_password).''.preg_replace('/./','*',(! empty($fuser->clicktodial_password)?$fuser->clicktodial_password:'')).'
ClickToDial '.$langs->trans("IdPhoneCaller").''.$fuser->clicktodial_poste.''.(! empty($fuser->clicktodial_poste)?$fuser->clicktodial_poste:'').'
\n"; } @@ -189,7 +190,7 @@ if ($id) */ print '
'; - if ($user->admin && $action <> 'edit') + if (! empty($user->admin) && $action <> 'edit') { print ''.$langs->trans("Modify").''; } diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 780422e8246..c18f584a34d 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -32,26 +32,28 @@ require_once(DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php"); require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/images.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/usergroups.lib.php"); -if ($conf->ldap->enabled) require_once(DOL_DOCUMENT_ROOT."/core/class/ldap.class.php"); -if ($conf->adherent->enabled) require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php"); +if (! empty($conf->ldap->enabled)) require_once(DOL_DOCUMENT_ROOT."/core/class/ldap.class.php"); +if (! empty($conf->adherent->enabled)) require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php"); if (! empty($conf->multicompany->enabled)) dol_include_once("/multicompany/class/actions_multicompany.class.php"); $id = GETPOST('id','int'); -$action = GETPOST("action"); +$action = GETPOST('action','alpha'); +$confirm = GETPOST('confirm','alpha'); +$subaction = GETPOST('subaction','alpha'); $group = GETPOST("group","int",3); -$confirm = GETPOST("confirm"); +$message=''; // Define value to know what current user can do on users -$canadduser=($user->admin || $user->rights->user->user->creer); -$canreaduser=($user->admin || $user->rights->user->user->lire); -$canedituser=($user->admin || $user->rights->user->user->creer); -$candisableuser=($user->admin || $user->rights->user->user->supprimer); +$canadduser=(! empty($user->admin) || $user->rights->user->user->creer); +$canreaduser=(! empty($user->admin) || $user->rights->user->user->lire); +$canedituser=(! empty($user->admin) || $user->rights->user->user->creer); +$candisableuser=(! empty($user->admin) || $user->rights->user->user->supprimer); $canreadgroup=$canreaduser; $caneditgroup=$canedituser; if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { - $canreadgroup=($user->admin || $user->rights->user->group_advance->read); - $caneditgroup=($user->admin || $user->rights->user->group_advance->write); + $canreadgroup=(! empty($user->admin) || $user->rights->user->group_advance->read); + $caneditgroup=(! empty($user->admin) || $user->rights->user->group_advance->write); } // Define value to know what current user can do on properties of edited user if ($id) @@ -87,14 +89,14 @@ $form = new Form($db); /** * Actions */ -if ($_GET["subaction"] == 'addrights' && $canedituser) +if ($subaction == 'addrights' && $canedituser) { $edituser = new User($db); $edituser->fetch($id); $edituser->addrights($_GET["rights"]); } -if ($_GET["subaction"] == 'delrights' && $canedituser) +if ($subaction == 'delrights' && $canedituser) { $edituser = new User($db); $edituser->fetch($id); @@ -116,8 +118,6 @@ if ($action == 'confirm_enable' && $confirm == "yes" && $candisableuser) { if ($id <> $user->id) { - $message=''; - $edituser = new User($db); $edituser->fetch($id); @@ -162,7 +162,6 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $candisableuser) // Action ajout user if ($action == 'add' && $canadduser) { - $message=""; if (! $_POST["nom"]) { $message='
'.$langs->trans("NameNotDefined").'
'; @@ -286,8 +285,6 @@ if ($action == 'update' && ! $_POST["cancel"]) if ($caneditfield) // Case we can edit all field { - $message=""; - if (! $_POST["nom"]) { $message='
'.$langs->trans("NameNotDefined").'
'; @@ -539,7 +536,9 @@ if (($action == 'create') || ($action == 'adduserldap')) print "
"; print "
"; - if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr') + dol_htmloutput_errors($message); + + if (! empty($conf->ldap->enabled) && (isset($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr')) { /* * Affiche formulaire d'ajout d'un compte depuis LDAP @@ -589,40 +588,35 @@ if (($action == 'create') || ($action == 'adduserldap')) { $message='
'.$ldap->error.'
'; } - } - dol_htmloutput_errors($message); - - if ($conf->ldap->enabled && $conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr') - { // Si la liste des users est rempli, on affiche la liste deroulante if (is_array($liste)) { - print "\n\n\n"; + print "\n\n\n"; - print '
'; - print ''; - print ''; - print ''; - print '
'; - print $langs->trans("LDAPUsers"); - print ''; - print ''; - print $form->selectarray('users', $liste, '', 1); - print ''; - print ''; - print '
'; - print '
'; + print '
'; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("LDAPUsers"); + print ''; + print ''; + print $form->selectarray('users', $liste, '', 1); + print ''; + print ''; + print '
'; + print '
'; - print "\n\n\n"; - print '
'; + print "\n\n\n"; + print '
'; } } - print '
'; + print ''; print ''; print ''; - if ($ldap_sid) print ''; + if (! empty($ldap_sid)) print ''; print ''; print ''; @@ -632,52 +626,52 @@ if (($action == 'create') || ($action == 'adduserldap')) // Nom print ''; print ''; // Prenom print ''; print ''; // Login print ''; print ''; $generated_password=''; - if (! $ldap_sid) // ldap_sid is for activedirectory + if (empty($ldap_sid)) // ldap_sid is for activedirectory { require_once(DOL_DOCUMENT_ROOT."/core/lib/security2.lib.php"); $generated_password=getRandomPassword(''); @@ -687,13 +681,13 @@ if (($action == 'create') || ($action == 'adduserldap')) // Mot de passe print ''; print ''; // Administrateur - if ($user->admin) + if (! empty($user->admin)) { print ''; print '
'.$langs->trans("Lastname").''; - if ($ldap_nom) + if (! empty($ldap_nom)) { print ''; print $ldap_nom; } else { - print ''; + print ''; } print '
'.$langs->trans("Firstname").''; - if ($ldap_prenom) + if (! empty($ldap_prenom)) { print ''; print $ldap_prenom; } else { - print ''; + print ''; } print '
'.$langs->trans("Login").''; - if ($ldap_login) + if (! empty($ldap_login)) { print ''; print $ldap_login; } - elseif ($ldap_loginsmb) + elseif (! empty($ldap_loginsmb)) { print ''; print $ldap_loginsmb; } else { - print ''; + print ''; } print '
'.$langs->trans("Password").''; - if ($ldap_sid) + if (! empty($ldap_sid)) { print 'Mot de passe du domaine'; } else { - if ($ldap_pass) + if (! empty($ldap_pass)) { print ''; print preg_replace('/./i','*',$ldap_pass); @@ -707,15 +701,15 @@ if (($action == 'create') || ($action == 'adduserldap')) print '
'.$langs->trans("Administrator").''; - print $form->selectyesno('admin',$_POST["admin"],1); + print $form->selectyesno('admin',GETPOST('admin'),1); if (! empty($conf->multicompany->enabled) && ! $user->entity && empty($conf->multicompany->transverse_mode)) { - if ($conf->use_javascript_ajax) + if (! empty($conf->use_javascript_ajax)) { print '