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.= '
'; $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) {